blob: 18389b32106371f9b644bce85ce343c14ebbb980 [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 Walkin1b03c792014-10-12 17:31:26 -07005AM_INIT_AUTOMAKE([-Wall -Werror foreign])
Lev Walkine7c4b962010-11-09 03:10:36 -08006AC_CONFIG_MACRO_DIR([m4])
Lev Walkinf15320b2004-06-03 03:38:44 +00007
Lev Walkine0d321a2014-09-11 01:28:57 -07008AM_MAINTAINER_MODE
9
Holger Hans Peter Freyther98427f72016-01-13 13:49:52 +010010m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Lev Walkinf15320b2004-06-03 03:38:44 +000011AM_PROG_LIBTOOL
12
Lev Walkinf15320b2004-06-03 03:38:44 +000013dnl Checks for programs.
14AC_PROG_CC
15AC_PROG_CPP
16AC_PROG_INSTALL
17AC_PROG_LN_S
18AC_PROG_MAKE_SET
19AC_PROG_YACC
20AM_PROG_LEX
Lev Walkinc10e06c2005-03-30 05:14:26 +000021AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris
Lev Walkinf15320b2004-06-03 03:38:44 +000022
Lev Walkin32789952014-10-12 18:51:52 -070023dnl If you need to see the details, just run make V=1.
24m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Frank Morgnerfb63c012013-05-21 09:56:38 +020025
Lev Walkinbec70d82004-08-23 10:40:21 +000026case "$host_os" in
Lev Walkin19abe222006-03-18 06:39:12 +000027cygwin)
Lev Walkinbec70d82004-08-23 10:40:21 +000028 case "$target" in
29 *mingw*)
30 CC="$CC -mno-cygwin"
31 esac
32 ;;
Lev Walkin615a7fa2006-03-18 06:24:33 +000033esac
34
Lev Walkin04c23172004-09-26 14:18:32 +000035AC_ARG_ENABLE(Werror,
Lev Walkin271131c2015-04-10 00:09:57 -070036 [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 Walkinf15320b2004-06-03 03:38:44 +000043
Lev Walkin58ecc7b2014-09-17 00:32:03 -070044AC_ARG_ENABLE([ASN_DEBUG],
Lev Walkin271131c2015-04-10 00:09:57 -070045 [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 Walkin58ecc7b2014-09-17 00:32:03 -070051
Lev Walkinf84cc012014-01-14 02:12:24 -080052AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
53AX_CHECK_COMPILE_FLAG([-Wcast-qual], [CFLAGS="$CFLAGS -Wcast-qual"])
54AX_CHECK_COMPILE_FLAG([-Wchar-subscripts],
Lev Walkin65907f02014-09-14 17:19:21 -070055 [CFLAGS="$CFLAGS -Wchar-subscripts"])
Lev Walkinf84cc012014-01-14 02:12:24 -080056AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes],
Lev Walkin65907f02014-09-14 17:19:21 -070057 [CFLAGS="$CFLAGS -Wmissing-prototypes"])
Lev Walkinf84cc012014-01-14 02:12:24 -080058AX_CHECK_COMPILE_FLAG([-Wmissing-declarations],
Lev Walkin65907f02014-09-14 17:19:21 -070059 [CFLAGS="$CFLAGS -Wmissing-declarations"])
Lev Walkinf15320b2004-06-03 03:38:44 +000060
Lev Walkinf84cc012014-01-14 02:12:24 -080061dnl There are legitimate uses for these features, disable warnings/errors.
62AX_CHECK_COMPILE_FLAG([-Wno-error=cast-align],
Lev Walkin65907f02014-09-14 17:19:21 -070063 [CFLAGS="$CFLAGS -Wno-error=cast-align"])
Lev Walkinf84cc012014-01-14 02:12:24 -080064AX_CHECK_COMPILE_FLAG([-Wno-error=visibility],
Lev Walkin65907f02014-09-14 17:19:21 -070065 [CFLAGS="$CFLAGS -Wno-error=visibility"])
Lev Walkinf84cc012014-01-14 02:12:24 -080066AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality],
Lev Walkin65907f02014-09-14 17:19:21 -070067 [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"])
68AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable],
69 [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"])
70
71AC_SUBST(ADD_CFLAGS)
72AC_SUBST(TESTSUITE_CFLAGS)
Lev Walkinf15320b2004-06-03 03:38:44 +000073
74dnl Checks for header files.
75AC_HEADER_STDC
Lev Walkin79f54952004-08-13 16:58:19 +000076AC_CHECK_HEADERS(sys/param.h)
Lev Walkinf15320b2004-06-03 03:38:44 +000077
78dnl Checks for typedefs, structures, and compiler characteristics.
79AC_C_BIGENDIAN
80AC_TYPE_OFF_T
81AC_TYPE_SIZE_T
82AC_STRUCT_TM
83AC_CHECK_TYPE(intmax_t, int64_t)
84
Lev Walkinb40ec412014-02-24 00:57:18 -080085dnl Test if we should check features that depend on 64-bitness.
86AC_MSG_CHECKING(size of long is longer than 32 bit)
87AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG])
88AC_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)
92AC_MSG_RESULT($WIDE_LONG)
93AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes])
94AS_VAR_POPDEF([WIDE_LONG])
95
Lev Walkin058e2222007-12-04 00:27:38 +000096dnl For mingw
97AC_SEARCH_LIBS(getopt, iberty)
98
Lev Walkinf15320b2004-06-03 03:38:44 +000099AC_CHECK_FUNCS(strtoimax strtoll)
Lev Walkin49b0a3e2004-06-28 21:22:35 +0000100AC_CHECK_FUNCS(mergesort)
Lev Walkin27fd0b62007-08-27 23:57:45 +0000101AC_CHECK_FUNCS(mkstemps)
Lev Walkin04fbe622014-09-17 02:27:01 -0700102AC_CHECK_FUNCS(timegm)
Frank Morgnercab30af2013-05-21 14:28:35 +0200103AC_CHECK_DECLS(alloca strcasecmp)
Frank Morgner8a759ad2013-05-16 13:32:49 +0200104AC_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 +0000105
Lev Walkine315a182006-03-06 11:33:39 +0000106AC_OUTPUT( \
Lev Walkine315a182006-03-06 11:33:39 +0000107skeletons/tests/Makefile \
108libasn1compiler/Makefile \
109libasn1parser/Makefile \
110libasn1print/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000111asn1c/tests/Makefile \
112libasn1fix/Makefile \
Lev Walkine7c4b962010-11-09 03:10:36 -0800113doc/docsrc/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000114skeletons/Makefile \
115examples/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000116asn1c/Makefile \
117doc/Makefile \
118asn1c.spec \
119Makefile \
Lev Walkinf15320b2004-06-03 03:38:44 +0000120)
121