blob: 52c592b29701e5131a6e8e163c1867a74d99ddf0 [file] [log] [blame]
Lev Walkineace46c2014-09-17 02:18:44 -07001AC_INIT([asn1c], [0.9.28], [vlm@lionet.info])
Lev Walkin1b03c792014-10-12 17:31:26 -07002
3AC_CONFIG_AUX_DIR(config)
Lev Walkine7c4b962010-11-09 03:10:36 -08004AC_CONFIG_HEADER([config.h])
Lev Walkinf7613202016-01-10 13:27:18 -08005AM_INIT_AUTOMAKE([foreign])
Lev Walkine7c4b962010-11-09 03:10:36 -08006AC_CONFIG_MACRO_DIR([m4])
Lev Walkinf15320b2004-06-03 03:38:44 +00007
8AM_PROG_LIBTOOL
9
Lev Walkinf15320b2004-06-03 03:38:44 +000010dnl Checks for programs.
11AC_PROG_CC
12AC_PROG_CPP
13AC_PROG_INSTALL
14AC_PROG_LN_S
15AC_PROG_MAKE_SET
16AC_PROG_YACC
17AM_PROG_LEX
Lev Walkinc10e06c2005-03-30 05:14:26 +000018AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris
Lev Walkinf15320b2004-06-03 03:38:44 +000019
Lev Walkin32789952014-10-12 18:51:52 -070020dnl If you need to see the details, just run make V=1.
21m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Frank Morgnerfb63c012013-05-21 09:56:38 +020022
Lev Walkinbec70d82004-08-23 10:40:21 +000023case "$host_os" in
Lev Walkin19abe222006-03-18 06:39:12 +000024cygwin)
Lev Walkinbec70d82004-08-23 10:40:21 +000025 case "$target" in
26 *mingw*)
27 CC="$CC -mno-cygwin"
28 esac
29 ;;
Lev Walkin615a7fa2006-03-18 06:24:33 +000030esac
31
Lev Walkin58ecc7b2014-09-17 00:32:03 -070032AC_ARG_ENABLE([ASN_DEBUG],
Lev Walkin271131c2015-04-10 00:09:57 -070033 [AS_HELP_STRING([--enable-ASN_DEBUG],
34 [produce debug log during `make check` testing])],
35 [enable_asn_debug=$enableval], [enable_asn_debug=no])
36 AS_IF([test x$enable_asn_debug != xno], [
37 TESTSUITE_CFLAGS="-DEMIT_ASN_DEBUG"
38 ])
Lev Walkin58ecc7b2014-09-17 00:32:03 -070039
Lev Walkinf84cc012014-01-14 02:12:24 -080040AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
41AX_CHECK_COMPILE_FLAG([-Wcast-qual], [CFLAGS="$CFLAGS -Wcast-qual"])
42AX_CHECK_COMPILE_FLAG([-Wchar-subscripts],
Lev Walkin65907f02014-09-14 17:19:21 -070043 [CFLAGS="$CFLAGS -Wchar-subscripts"])
Lev Walkinf84cc012014-01-14 02:12:24 -080044AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes],
Lev Walkin65907f02014-09-14 17:19:21 -070045 [CFLAGS="$CFLAGS -Wmissing-prototypes"])
Lev Walkinf84cc012014-01-14 02:12:24 -080046AX_CHECK_COMPILE_FLAG([-Wmissing-declarations],
Lev Walkin65907f02014-09-14 17:19:21 -070047 [CFLAGS="$CFLAGS -Wmissing-declarations"])
Lev Walkinf15320b2004-06-03 03:38:44 +000048
Lev Walkinf84cc012014-01-14 02:12:24 -080049dnl There are legitimate uses for these features, disable warnings/errors.
50AX_CHECK_COMPILE_FLAG([-Wno-error=cast-align],
Lev Walkin65907f02014-09-14 17:19:21 -070051 [CFLAGS="$CFLAGS -Wno-error=cast-align"])
Lev Walkinf84cc012014-01-14 02:12:24 -080052AX_CHECK_COMPILE_FLAG([-Wno-error=visibility],
Lev Walkin65907f02014-09-14 17:19:21 -070053 [CFLAGS="$CFLAGS -Wno-error=visibility"])
Lev Walkinf84cc012014-01-14 02:12:24 -080054AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality],
Lev Walkin65907f02014-09-14 17:19:21 -070055 [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"])
56AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable],
57 [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"])
58
Lev Walkinf7613202016-01-10 13:27:18 -080059AC_ARG_ENABLE(Werror,
60 [AS_HELP_STRING([--enable-Werror],
61 [abort compilation after any C compiler warning])],
62 [enable_werror=$enableval], [enable_werror=no])
63 AS_IF([test x$enable_werror != xno], [
64 ADD_CFLAGS="-Werror -W -Wpointer-arith"
65 ])
66
67AC_ARG_ENABLE(test-Werror,
68 [AS_HELP_STRING([--enable-test-Werror],
69 [abort compiling tests after any C compiler warning])],
70 [enable_test_werror=$enableval], [enable_test_werror=no])
71 AS_IF([test x$enable_test_werror != xno], [
72 TESTSUITE_CFLAGS="-Werror -W -Wpointer-arith"
73 ])
74
Lev Walkin65907f02014-09-14 17:19:21 -070075AC_SUBST(ADD_CFLAGS)
76AC_SUBST(TESTSUITE_CFLAGS)
Lev Walkinf15320b2004-06-03 03:38:44 +000077
78dnl Checks for header files.
79AC_HEADER_STDC
Lev Walkin79f54952004-08-13 16:58:19 +000080AC_CHECK_HEADERS(sys/param.h)
Lev Walkinf15320b2004-06-03 03:38:44 +000081
82dnl Checks for typedefs, structures, and compiler characteristics.
83AC_C_BIGENDIAN
84AC_TYPE_OFF_T
85AC_TYPE_SIZE_T
86AC_STRUCT_TM
87AC_CHECK_TYPE(intmax_t, int64_t)
88
Lev Walkinb40ec412014-02-24 00:57:18 -080089dnl Test if we should check features that depend on 64-bitness.
90AC_MSG_CHECKING(size of long is longer than 32 bit)
91AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG])
92AC_TRY_COMPILE([#include "confdefs.h"
93#include <sys/types.h>
94], [switch (0) case 0: case (sizeof ($1) >= 8):;],
95 WIDE_LONG=yes, WIDE_LONG=no)
96AC_MSG_RESULT($WIDE_LONG)
97AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes])
98AS_VAR_POPDEF([WIDE_LONG])
99
Lev Walkin058e2222007-12-04 00:27:38 +0000100dnl For mingw
101AC_SEARCH_LIBS(getopt, iberty)
102
Lev Walkinf15320b2004-06-03 03:38:44 +0000103AC_CHECK_FUNCS(strtoimax strtoll)
Lev Walkin49b0a3e2004-06-28 21:22:35 +0000104AC_CHECK_FUNCS(mergesort)
Lev Walkin27fd0b62007-08-27 23:57:45 +0000105AC_CHECK_FUNCS(mkstemps)
Lev Walkin04fbe622014-09-17 02:27:01 -0700106AC_CHECK_FUNCS(timegm)
Frank Morgnercab30af2013-05-21 14:28:35 +0200107AC_CHECK_DECLS(alloca strcasecmp)
Frank Morgner8a759ad2013-05-16 13:32:49 +0200108AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])])
Lev Walkin27fd0b62007-08-27 23:57:45 +0000109
Lev Walkinc6080fd2016-01-23 06:35:34 -0800110dnl Use pandoc to generate manual pages.
111AC_PATH_PROG([PANDOC], pandoc)
112AM_CONDITIONAL([HAVE_PANDOC], [test -n "$PANDOC"])
113
Lev Walkine315a182006-03-06 11:33:39 +0000114AC_OUTPUT( \
Lev Walkine315a182006-03-06 11:33:39 +0000115skeletons/tests/Makefile \
116libasn1compiler/Makefile \
117libasn1parser/Makefile \
118libasn1print/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000119asn1c/tests/Makefile \
120libasn1fix/Makefile \
Lev Walkine7c4b962010-11-09 03:10:36 -0800121doc/docsrc/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000122skeletons/Makefile \
123examples/Makefile \
Lev Walkinc6080fd2016-01-23 06:35:34 -0800124doc/man/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000125asn1c/Makefile \
126doc/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000127Makefile \
Lev Walkinf15320b2004-06-03 03:38:44 +0000128)
129