Lev Walkin | eace46c | 2014-09-17 02:18:44 -0700 | [diff] [blame] | 1 | AC_INIT([asn1c], [0.9.28], [vlm@lionet.info]) |
Lev Walkin | 1b03c79 | 2014-10-12 17:31:26 -0700 | [diff] [blame] | 2 | |
| 3 | AC_CONFIG_AUX_DIR(config) |
Lev Walkin | e7c4b96 | 2010-11-09 03:10:36 -0800 | [diff] [blame] | 4 | AC_CONFIG_HEADER([config.h]) |
Lev Walkin | f761320 | 2016-01-10 13:27:18 -0800 | [diff] [blame] | 5 | AM_INIT_AUTOMAKE([foreign]) |
Lev Walkin | e7c4b96 | 2010-11-09 03:10:36 -0800 | [diff] [blame] | 6 | AC_CONFIG_MACRO_DIR([m4]) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 7 | |
| 8 | AM_PROG_LIBTOOL |
| 9 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 10 | dnl Checks for programs. |
| 11 | AC_PROG_CC |
| 12 | AC_PROG_CPP |
| 13 | AC_PROG_INSTALL |
| 14 | AC_PROG_LN_S |
| 15 | AC_PROG_MAKE_SET |
| 16 | AC_PROG_YACC |
| 17 | AM_PROG_LEX |
Lev Walkin | c10e06c | 2005-03-30 05:14:26 +0000 | [diff] [blame] | 18 | AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 19 | |
Lev Walkin | 3278995 | 2014-10-12 18:51:52 -0700 | [diff] [blame] | 20 | dnl If you need to see the details, just run make V=1. |
| 21 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
Frank Morgner | fb63c01 | 2013-05-21 09:56:38 +0200 | [diff] [blame] | 22 | |
Lev Walkin | bec70d8 | 2004-08-23 10:40:21 +0000 | [diff] [blame] | 23 | case "$host_os" in |
Lev Walkin | 19abe22 | 2006-03-18 06:39:12 +0000 | [diff] [blame] | 24 | cygwin) |
Lev Walkin | bec70d8 | 2004-08-23 10:40:21 +0000 | [diff] [blame] | 25 | case "$target" in |
| 26 | *mingw*) |
| 27 | CC="$CC -mno-cygwin" |
| 28 | esac |
| 29 | ;; |
Lev Walkin | 615a7fa | 2006-03-18 06:24:33 +0000 | [diff] [blame] | 30 | esac |
| 31 | |
Lev Walkin | 58ecc7b | 2014-09-17 00:32:03 -0700 | [diff] [blame] | 32 | AC_ARG_ENABLE([ASN_DEBUG], |
Lev Walkin | 271131c | 2015-04-10 00:09:57 -0700 | [diff] [blame] | 33 | [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 Walkin | 58ecc7b | 2014-09-17 00:32:03 -0700 | [diff] [blame] | 39 | |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 40 | AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) |
| 41 | AX_CHECK_COMPILE_FLAG([-Wcast-qual], [CFLAGS="$CFLAGS -Wcast-qual"]) |
| 42 | AX_CHECK_COMPILE_FLAG([-Wchar-subscripts], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 43 | [CFLAGS="$CFLAGS -Wchar-subscripts"]) |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 44 | AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 45 | [CFLAGS="$CFLAGS -Wmissing-prototypes"]) |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 46 | AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 47 | [CFLAGS="$CFLAGS -Wmissing-declarations"]) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 48 | |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 49 | dnl There are legitimate uses for these features, disable warnings/errors. |
| 50 | AX_CHECK_COMPILE_FLAG([-Wno-error=cast-align], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 51 | [CFLAGS="$CFLAGS -Wno-error=cast-align"]) |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 52 | AX_CHECK_COMPILE_FLAG([-Wno-error=visibility], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 53 | [CFLAGS="$CFLAGS -Wno-error=visibility"]) |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 54 | AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 55 | [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"]) |
| 56 | AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable], |
| 57 | [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"]) |
| 58 | |
Lev Walkin | f761320 | 2016-01-10 13:27:18 -0800 | [diff] [blame] | 59 | AC_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 | |
| 67 | AC_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 Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 75 | AC_SUBST(ADD_CFLAGS) |
| 76 | AC_SUBST(TESTSUITE_CFLAGS) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 77 | |
Lev Walkin | 9736348 | 2016-01-24 19:23:02 -0800 | [diff] [blame] | 78 | dnl Skeletons should be very compatible with most of the compilers, hence |
| 79 | dnl very strict backward compatibility flags. |
| 80 | SKELETONS_CFLAGS="${ADD_CFLAGS}" |
| 81 | AX_CHECK_COMPILE_FLAG([-std=c89], |
Lev Walkin | 104af19 | 2016-01-24 22:13:27 -0800 | [diff] [blame] | 82 | [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -std=c89"]) |
Lev Walkin | 9736348 | 2016-01-24 19:23:02 -0800 | [diff] [blame] | 83 | AX_CHECK_COMPILE_FLAG([-Wpedantic], |
Lev Walkin | 104af19 | 2016-01-24 22:13:27 -0800 | [diff] [blame] | 84 | [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wpedantic"]) |
| 85 | AX_CHECK_COMPILE_FLAG([-Wno-duplicate-decl-specifier], |
| 86 | [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wno-duplicate-decl-specifier"]) |
Lev Walkin | 9736348 | 2016-01-24 19:23:02 -0800 | [diff] [blame] | 87 | AC_SUBST(SKELETONS_CFLAGS) |
| 88 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 89 | dnl Checks for header files. |
| 90 | AC_HEADER_STDC |
Lev Walkin | 79f5495 | 2004-08-13 16:58:19 +0000 | [diff] [blame] | 91 | AC_CHECK_HEADERS(sys/param.h) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 92 | |
| 93 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 94 | AC_C_BIGENDIAN |
| 95 | AC_TYPE_OFF_T |
| 96 | AC_TYPE_SIZE_T |
| 97 | AC_STRUCT_TM |
| 98 | AC_CHECK_TYPE(intmax_t, int64_t) |
| 99 | |
Lev Walkin | b40ec41 | 2014-02-24 00:57:18 -0800 | [diff] [blame] | 100 | dnl Test if we should check features that depend on 64-bitness. |
| 101 | AC_MSG_CHECKING(size of long is longer than 32 bit) |
| 102 | AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG]) |
| 103 | AC_TRY_COMPILE([#include "confdefs.h" |
| 104 | #include <sys/types.h> |
| 105 | ], [switch (0) case 0: case (sizeof ($1) >= 8):;], |
| 106 | WIDE_LONG=yes, WIDE_LONG=no) |
| 107 | AC_MSG_RESULT($WIDE_LONG) |
| 108 | AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes]) |
| 109 | AS_VAR_POPDEF([WIDE_LONG]) |
| 110 | |
Lev Walkin | 058e222 | 2007-12-04 00:27:38 +0000 | [diff] [blame] | 111 | dnl For mingw |
| 112 | AC_SEARCH_LIBS(getopt, iberty) |
| 113 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 114 | AC_CHECK_FUNCS(strtoimax strtoll) |
Lev Walkin | 49b0a3e | 2004-06-28 21:22:35 +0000 | [diff] [blame] | 115 | AC_CHECK_FUNCS(mergesort) |
Lev Walkin | 27fd0b6 | 2007-08-27 23:57:45 +0000 | [diff] [blame] | 116 | AC_CHECK_FUNCS(mkstemps) |
Lev Walkin | 04fbe62 | 2014-09-17 02:27:01 -0700 | [diff] [blame] | 117 | AC_CHECK_FUNCS(timegm) |
Frank Morgner | cab30af | 2013-05-21 14:28:35 +0200 | [diff] [blame] | 118 | AC_CHECK_DECLS(alloca strcasecmp) |
Frank Morgner | 8a759ad | 2013-05-16 13:32:49 +0200 | [diff] [blame] | 119 | AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])]) |
Lev Walkin | 27fd0b6 | 2007-08-27 23:57:45 +0000 | [diff] [blame] | 120 | |
Lev Walkin | c6080fd | 2016-01-23 06:35:34 -0800 | [diff] [blame] | 121 | dnl Use pandoc to generate manual pages. |
| 122 | AC_PATH_PROG([PANDOC], pandoc) |
| 123 | AM_CONDITIONAL([HAVE_PANDOC], [test -n "$PANDOC"]) |
| 124 | |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 125 | AC_OUTPUT( \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 126 | skeletons/tests/Makefile \ |
| 127 | libasn1compiler/Makefile \ |
| 128 | libasn1parser/Makefile \ |
| 129 | libasn1print/Makefile \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 130 | asn1c/tests/Makefile \ |
| 131 | libasn1fix/Makefile \ |
Lev Walkin | e7c4b96 | 2010-11-09 03:10:36 -0800 | [diff] [blame] | 132 | doc/docsrc/Makefile \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 133 | skeletons/Makefile \ |
| 134 | examples/Makefile \ |
Lev Walkin | c6080fd | 2016-01-23 06:35:34 -0800 | [diff] [blame] | 135 | doc/man/Makefile \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 136 | asn1c/Makefile \ |
| 137 | doc/Makefile \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 138 | Makefile \ |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 139 | ) |
| 140 | |