blob: cdfe49aec914b6d8fcc989ebb69b29f33759e6eb [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
Lev Walkinf15320b2004-06-03 03:38:44 +000010AM_PROG_LIBTOOL
11
Lev Walkinf15320b2004-06-03 03:38:44 +000012dnl Checks for programs.
13AC_PROG_CC
14AC_PROG_CPP
15AC_PROG_INSTALL
16AC_PROG_LN_S
17AC_PROG_MAKE_SET
18AC_PROG_YACC
19AM_PROG_LEX
Lev Walkinc10e06c2005-03-30 05:14:26 +000020AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris
Lev Walkinf15320b2004-06-03 03:38:44 +000021
Lev Walkin32789952014-10-12 18:51:52 -070022dnl If you need to see the details, just run make V=1.
23m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Frank Morgnerfb63c012013-05-21 09:56:38 +020024
Lev Walkinbec70d82004-08-23 10:40:21 +000025case "$host_os" in
Lev Walkin19abe222006-03-18 06:39:12 +000026cygwin)
Lev Walkinbec70d82004-08-23 10:40:21 +000027 case "$target" in
28 *mingw*)
29 CC="$CC -mno-cygwin"
30 esac
31 ;;
Lev Walkin615a7fa2006-03-18 06:24:33 +000032esac
33
Lev Walkin04c23172004-09-26 14:18:32 +000034AC_ARG_ENABLE(Werror,
Lev Walkin271131c2015-04-10 00:09:57 -070035 [AS_HELP_STRING([--enable-Werror],
36 [abort compilation after any C compiler warning])],
37 [enable_werror=$enableval], [enable_werror=no])
38 AS_IF([test x$enable_werror != xno], [
39 TESTSUITE_CFLAGS="-Werror -W -Wpointer-arith"
40 ADD_CFLAGS="-Werror -W -Wpointer-arith"
41 ])
Lev Walkinf15320b2004-06-03 03:38:44 +000042
Lev Walkin58ecc7b2014-09-17 00:32:03 -070043AC_ARG_ENABLE([ASN_DEBUG],
Lev Walkin271131c2015-04-10 00:09:57 -070044 [AS_HELP_STRING([--enable-ASN_DEBUG],
45 [produce debug log during `make check` testing])],
46 [enable_asn_debug=$enableval], [enable_asn_debug=no])
47 AS_IF([test x$enable_asn_debug != xno], [
48 TESTSUITE_CFLAGS="-DEMIT_ASN_DEBUG"
49 ])
Lev Walkin58ecc7b2014-09-17 00:32:03 -070050
Lev Walkinf84cc012014-01-14 02:12:24 -080051AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
52AX_CHECK_COMPILE_FLAG([-Wcast-qual], [CFLAGS="$CFLAGS -Wcast-qual"])
53AX_CHECK_COMPILE_FLAG([-Wchar-subscripts],
Lev Walkin65907f02014-09-14 17:19:21 -070054 [CFLAGS="$CFLAGS -Wchar-subscripts"])
Lev Walkinf84cc012014-01-14 02:12:24 -080055AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes],
Lev Walkin65907f02014-09-14 17:19:21 -070056 [CFLAGS="$CFLAGS -Wmissing-prototypes"])
Lev Walkinf84cc012014-01-14 02:12:24 -080057AX_CHECK_COMPILE_FLAG([-Wmissing-declarations],
Lev Walkin65907f02014-09-14 17:19:21 -070058 [CFLAGS="$CFLAGS -Wmissing-declarations"])
Lev Walkinf15320b2004-06-03 03:38:44 +000059
Lev Walkinf84cc012014-01-14 02:12:24 -080060dnl There are legitimate uses for these features, disable warnings/errors.
61AX_CHECK_COMPILE_FLAG([-Wno-error=cast-align],
Lev Walkin65907f02014-09-14 17:19:21 -070062 [CFLAGS="$CFLAGS -Wno-error=cast-align"])
Lev Walkinf84cc012014-01-14 02:12:24 -080063AX_CHECK_COMPILE_FLAG([-Wno-error=visibility],
Lev Walkin65907f02014-09-14 17:19:21 -070064 [CFLAGS="$CFLAGS -Wno-error=visibility"])
Lev Walkinf84cc012014-01-14 02:12:24 -080065AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality],
Lev Walkin65907f02014-09-14 17:19:21 -070066 [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"])
67AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable],
68 [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"])
69
70AC_SUBST(ADD_CFLAGS)
71AC_SUBST(TESTSUITE_CFLAGS)
Lev Walkinf15320b2004-06-03 03:38:44 +000072
73dnl Checks for header files.
74AC_HEADER_STDC
Lev Walkin79f54952004-08-13 16:58:19 +000075AC_CHECK_HEADERS(sys/param.h)
Lev Walkinf15320b2004-06-03 03:38:44 +000076
77dnl Checks for typedefs, structures, and compiler characteristics.
78AC_C_BIGENDIAN
79AC_TYPE_OFF_T
80AC_TYPE_SIZE_T
81AC_STRUCT_TM
82AC_CHECK_TYPE(intmax_t, int64_t)
83
Lev Walkinb40ec412014-02-24 00:57:18 -080084dnl Test if we should check features that depend on 64-bitness.
85AC_MSG_CHECKING(size of long is longer than 32 bit)
86AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG])
87AC_TRY_COMPILE([#include "confdefs.h"
88#include <sys/types.h>
89], [switch (0) case 0: case (sizeof ($1) >= 8):;],
90 WIDE_LONG=yes, WIDE_LONG=no)
91AC_MSG_RESULT($WIDE_LONG)
92AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes])
93AS_VAR_POPDEF([WIDE_LONG])
94
Lev Walkin058e2222007-12-04 00:27:38 +000095dnl For mingw
96AC_SEARCH_LIBS(getopt, iberty)
97
Lev Walkinf15320b2004-06-03 03:38:44 +000098AC_CHECK_FUNCS(strtoimax strtoll)
Lev Walkin49b0a3e2004-06-28 21:22:35 +000099AC_CHECK_FUNCS(mergesort)
Lev Walkin27fd0b62007-08-27 23:57:45 +0000100AC_CHECK_FUNCS(mkstemps)
Lev Walkin04fbe622014-09-17 02:27:01 -0700101AC_CHECK_FUNCS(timegm)
Frank Morgnercab30af2013-05-21 14:28:35 +0200102AC_CHECK_DECLS(alloca strcasecmp)
Frank Morgner8a759ad2013-05-16 13:32:49 +0200103AC_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 +0000104
Lev Walkine315a182006-03-06 11:33:39 +0000105AC_OUTPUT( \
Lev Walkine315a182006-03-06 11:33:39 +0000106skeletons/tests/Makefile \
107libasn1compiler/Makefile \
108libasn1parser/Makefile \
109libasn1print/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000110asn1c/tests/Makefile \
111libasn1fix/Makefile \
Lev Walkine7c4b962010-11-09 03:10:36 -0800112doc/docsrc/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000113skeletons/Makefile \
114examples/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000115asn1c/Makefile \
116doc/Makefile \
117asn1c.spec \
118Makefile \
Lev Walkinf15320b2004-06-03 03:38:44 +0000119)
120