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 | 1b03c79 | 2014-10-12 17:31:26 -0700 | [diff] [blame] | 5 | AM_INIT_AUTOMAKE([-Wall -Werror 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 | |
Lev Walkin | e0d321a | 2014-09-11 01:28:57 -0700 | [diff] [blame] | 8 | AM_MAINTAINER_MODE |
| 9 | |
Holger Hans Peter Freyther | 98427f7 | 2016-01-13 13:49:52 +0100 | [diff] [blame] | 10 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 11 | AM_PROG_LIBTOOL |
| 12 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 13 | dnl Checks for programs. |
| 14 | AC_PROG_CC |
| 15 | AC_PROG_CPP |
| 16 | AC_PROG_INSTALL |
| 17 | AC_PROG_LN_S |
| 18 | AC_PROG_MAKE_SET |
| 19 | AC_PROG_YACC |
| 20 | AM_PROG_LEX |
Lev Walkin | c10e06c | 2005-03-30 05:14:26 +0000 | [diff] [blame] | 21 | 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] | 22 | |
Lev Walkin | 3278995 | 2014-10-12 18:51:52 -0700 | [diff] [blame] | 23 | dnl If you need to see the details, just run make V=1. |
| 24 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
Frank Morgner | fb63c01 | 2013-05-21 09:56:38 +0200 | [diff] [blame] | 25 | |
Lev Walkin | bec70d8 | 2004-08-23 10:40:21 +0000 | [diff] [blame] | 26 | case "$host_os" in |
Lev Walkin | 19abe22 | 2006-03-18 06:39:12 +0000 | [diff] [blame] | 27 | cygwin) |
Lev Walkin | bec70d8 | 2004-08-23 10:40:21 +0000 | [diff] [blame] | 28 | case "$target" in |
| 29 | *mingw*) |
| 30 | CC="$CC -mno-cygwin" |
| 31 | esac |
| 32 | ;; |
Lev Walkin | 615a7fa | 2006-03-18 06:24:33 +0000 | [diff] [blame] | 33 | esac |
| 34 | |
Lev Walkin | 04c2317 | 2004-09-26 14:18:32 +0000 | [diff] [blame] | 35 | AC_ARG_ENABLE(Werror, |
Lev Walkin | 271131c | 2015-04-10 00:09:57 -0700 | [diff] [blame] | 36 | [AS_HELP_STRING([--enable-Werror], |
| 37 | [abort compilation after any C compiler warning])], |
| 38 | [enable_werror=$enableval], [enable_werror=no]) |
| 39 | AS_IF([test x$enable_werror != xno], [ |
| 40 | TESTSUITE_CFLAGS="-Werror -W -Wpointer-arith" |
| 41 | ADD_CFLAGS="-Werror -W -Wpointer-arith" |
| 42 | ]) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 43 | |
Lev Walkin | 58ecc7b | 2014-09-17 00:32:03 -0700 | [diff] [blame] | 44 | AC_ARG_ENABLE([ASN_DEBUG], |
Lev Walkin | 271131c | 2015-04-10 00:09:57 -0700 | [diff] [blame] | 45 | [AS_HELP_STRING([--enable-ASN_DEBUG], |
| 46 | [produce debug log during `make check` testing])], |
| 47 | [enable_asn_debug=$enableval], [enable_asn_debug=no]) |
| 48 | AS_IF([test x$enable_asn_debug != xno], [ |
| 49 | TESTSUITE_CFLAGS="-DEMIT_ASN_DEBUG" |
| 50 | ]) |
Lev Walkin | 58ecc7b | 2014-09-17 00:32:03 -0700 | [diff] [blame] | 51 | |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 52 | AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"]) |
| 53 | AX_CHECK_COMPILE_FLAG([-Wcast-qual], [CFLAGS="$CFLAGS -Wcast-qual"]) |
| 54 | AX_CHECK_COMPILE_FLAG([-Wchar-subscripts], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 55 | [CFLAGS="$CFLAGS -Wchar-subscripts"]) |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 56 | AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 57 | [CFLAGS="$CFLAGS -Wmissing-prototypes"]) |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 58 | AX_CHECK_COMPILE_FLAG([-Wmissing-declarations], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 59 | [CFLAGS="$CFLAGS -Wmissing-declarations"]) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 60 | |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 61 | dnl There are legitimate uses for these features, disable warnings/errors. |
| 62 | AX_CHECK_COMPILE_FLAG([-Wno-error=cast-align], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 63 | [CFLAGS="$CFLAGS -Wno-error=cast-align"]) |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 64 | AX_CHECK_COMPILE_FLAG([-Wno-error=visibility], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 65 | [CFLAGS="$CFLAGS -Wno-error=visibility"]) |
Lev Walkin | f84cc01 | 2014-01-14 02:12:24 -0800 | [diff] [blame] | 66 | AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality], |
Lev Walkin | 65907f0 | 2014-09-14 17:19:21 -0700 | [diff] [blame] | 67 | [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"]) |
| 68 | AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable], |
| 69 | [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"]) |
| 70 | |
| 71 | AC_SUBST(ADD_CFLAGS) |
| 72 | AC_SUBST(TESTSUITE_CFLAGS) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 73 | |
| 74 | dnl Checks for header files. |
| 75 | AC_HEADER_STDC |
Lev Walkin | 79f5495 | 2004-08-13 16:58:19 +0000 | [diff] [blame] | 76 | AC_CHECK_HEADERS(sys/param.h) |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 77 | |
| 78 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 79 | AC_C_BIGENDIAN |
| 80 | AC_TYPE_OFF_T |
| 81 | AC_TYPE_SIZE_T |
| 82 | AC_STRUCT_TM |
| 83 | AC_CHECK_TYPE(intmax_t, int64_t) |
| 84 | |
Lev Walkin | b40ec41 | 2014-02-24 00:57:18 -0800 | [diff] [blame] | 85 | dnl Test if we should check features that depend on 64-bitness. |
| 86 | AC_MSG_CHECKING(size of long is longer than 32 bit) |
| 87 | AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG]) |
| 88 | AC_TRY_COMPILE([#include "confdefs.h" |
| 89 | #include <sys/types.h> |
| 90 | ], [switch (0) case 0: case (sizeof ($1) >= 8):;], |
| 91 | WIDE_LONG=yes, WIDE_LONG=no) |
| 92 | AC_MSG_RESULT($WIDE_LONG) |
| 93 | AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes]) |
| 94 | AS_VAR_POPDEF([WIDE_LONG]) |
| 95 | |
Lev Walkin | 058e222 | 2007-12-04 00:27:38 +0000 | [diff] [blame] | 96 | dnl For mingw |
| 97 | AC_SEARCH_LIBS(getopt, iberty) |
| 98 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 99 | AC_CHECK_FUNCS(strtoimax strtoll) |
Lev Walkin | 49b0a3e | 2004-06-28 21:22:35 +0000 | [diff] [blame] | 100 | AC_CHECK_FUNCS(mergesort) |
Lev Walkin | 27fd0b6 | 2007-08-27 23:57:45 +0000 | [diff] [blame] | 101 | AC_CHECK_FUNCS(mkstemps) |
Lev Walkin | 04fbe62 | 2014-09-17 02:27:01 -0700 | [diff] [blame] | 102 | AC_CHECK_FUNCS(timegm) |
Frank Morgner | cab30af | 2013-05-21 14:28:35 +0200 | [diff] [blame] | 103 | AC_CHECK_DECLS(alloca strcasecmp) |
Frank Morgner | 8a759ad | 2013-05-16 13:32:49 +0200 | [diff] [blame] | 104 | 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] | 105 | |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 106 | AC_OUTPUT( \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 107 | skeletons/tests/Makefile \ |
| 108 | libasn1compiler/Makefile \ |
| 109 | libasn1parser/Makefile \ |
| 110 | libasn1print/Makefile \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 111 | asn1c/tests/Makefile \ |
| 112 | libasn1fix/Makefile \ |
Lev Walkin | e7c4b96 | 2010-11-09 03:10:36 -0800 | [diff] [blame] | 113 | doc/docsrc/Makefile \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 114 | skeletons/Makefile \ |
| 115 | examples/Makefile \ |
Lev Walkin | e315a18 | 2006-03-06 11:33:39 +0000 | [diff] [blame] | 116 | asn1c/Makefile \ |
| 117 | doc/Makefile \ |
| 118 | asn1c.spec \ |
| 119 | Makefile \ |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 120 | ) |
| 121 | |