blob: 588df6d5dbb596e6c4c212f5e0a596cc4b679a04 [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 Walkina1e5b9d2015-09-14 12:50:42 -07005AM_INIT_AUTOMAKE([-Wall -Wno-extra-portability -Werror foreign])
brchiuf9c7f852015-08-01 09:52:42 +08006m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
7LT_INIT
Lev Walkine7c4b962010-11-09 03:10:36 -08008AC_CONFIG_MACRO_DIR([m4])
Lev Walkinf15320b2004-06-03 03:38:44 +00009
Lev Walkine0d321a2014-09-11 01:28:57 -070010AM_MAINTAINER_MODE
11
Lev Walkinf15320b2004-06-03 03:38:44 +000012AM_PROG_LIBTOOL
13
Lev Walkinf15320b2004-06-03 03:38:44 +000014dnl Checks for programs.
15AC_PROG_CC
16AC_PROG_CPP
17AC_PROG_INSTALL
18AC_PROG_LN_S
19AC_PROG_MAKE_SET
20AC_PROG_YACC
21AM_PROG_LEX
Lev Walkinc10e06c2005-03-30 05:14:26 +000022AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris
Lev Walkinf15320b2004-06-03 03:38:44 +000023
Lev Walkin32789952014-10-12 18:51:52 -070024dnl If you need to see the details, just run make V=1.
25m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Frank Morgnerfb63c012013-05-21 09:56:38 +020026
Lev Walkinbec70d82004-08-23 10:40:21 +000027case "$host_os" in
Lev Walkin19abe222006-03-18 06:39:12 +000028cygwin)
Lev Walkinbec70d82004-08-23 10:40:21 +000029 case "$target" in
30 *mingw*)
31 CC="$CC -mno-cygwin"
32 esac
33 ;;
Lev Walkin615a7fa2006-03-18 06:24:33 +000034esac
35
Lev Walkin04c23172004-09-26 14:18:32 +000036AC_ARG_ENABLE(Werror,
Lev Walkin271131c2015-04-10 00:09:57 -070037 [AS_HELP_STRING([--enable-Werror],
38 [abort compilation after any C compiler warning])],
39 [enable_werror=$enableval], [enable_werror=no])
40 AS_IF([test x$enable_werror != xno], [
41 TESTSUITE_CFLAGS="-Werror -W -Wpointer-arith"
42 ADD_CFLAGS="-Werror -W -Wpointer-arith"
43 ])
Lev Walkinf15320b2004-06-03 03:38:44 +000044
Lev Walkin58ecc7b2014-09-17 00:32:03 -070045AC_ARG_ENABLE([ASN_DEBUG],
Lev Walkin271131c2015-04-10 00:09:57 -070046 [AS_HELP_STRING([--enable-ASN_DEBUG],
47 [produce debug log during `make check` testing])],
48 [enable_asn_debug=$enableval], [enable_asn_debug=no])
49 AS_IF([test x$enable_asn_debug != xno], [
50 TESTSUITE_CFLAGS="-DEMIT_ASN_DEBUG"
51 ])
Lev Walkin58ecc7b2014-09-17 00:32:03 -070052
Lev Walkinf84cc012014-01-14 02:12:24 -080053AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
54AX_CHECK_COMPILE_FLAG([-Wcast-qual], [CFLAGS="$CFLAGS -Wcast-qual"])
55AX_CHECK_COMPILE_FLAG([-Wchar-subscripts],
Lev Walkin65907f02014-09-14 17:19:21 -070056 [CFLAGS="$CFLAGS -Wchar-subscripts"])
Lev Walkinf84cc012014-01-14 02:12:24 -080057AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes],
Lev Walkin65907f02014-09-14 17:19:21 -070058 [CFLAGS="$CFLAGS -Wmissing-prototypes"])
Lev Walkinf84cc012014-01-14 02:12:24 -080059AX_CHECK_COMPILE_FLAG([-Wmissing-declarations],
Lev Walkin65907f02014-09-14 17:19:21 -070060 [CFLAGS="$CFLAGS -Wmissing-declarations"])
Lev Walkinf15320b2004-06-03 03:38:44 +000061
Lev Walkinf84cc012014-01-14 02:12:24 -080062dnl There are legitimate uses for these features, disable warnings/errors.
63AX_CHECK_COMPILE_FLAG([-Wno-error=cast-align],
Lev Walkin65907f02014-09-14 17:19:21 -070064 [CFLAGS="$CFLAGS -Wno-error=cast-align"])
Lev Walkinf84cc012014-01-14 02:12:24 -080065AX_CHECK_COMPILE_FLAG([-Wno-error=visibility],
Lev Walkin65907f02014-09-14 17:19:21 -070066 [CFLAGS="$CFLAGS -Wno-error=visibility"])
Lev Walkinf84cc012014-01-14 02:12:24 -080067AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality],
Lev Walkin65907f02014-09-14 17:19:21 -070068 [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"])
69AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable],
70 [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"])
71
72AC_SUBST(ADD_CFLAGS)
73AC_SUBST(TESTSUITE_CFLAGS)
Lev Walkinf15320b2004-06-03 03:38:44 +000074
75dnl Checks for header files.
76AC_HEADER_STDC
Lev Walkin79f54952004-08-13 16:58:19 +000077AC_CHECK_HEADERS(sys/param.h)
Lev Walkinf15320b2004-06-03 03:38:44 +000078
79dnl Checks for typedefs, structures, and compiler characteristics.
80AC_C_BIGENDIAN
81AC_TYPE_OFF_T
82AC_TYPE_SIZE_T
83AC_STRUCT_TM
84AC_CHECK_TYPE(intmax_t, int64_t)
85
Lev Walkinb40ec412014-02-24 00:57:18 -080086dnl Test if we should check features that depend on 64-bitness.
87AC_MSG_CHECKING(size of long is longer than 32 bit)
88AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG])
89AC_TRY_COMPILE([#include "confdefs.h"
90#include <sys/types.h>
91], [switch (0) case 0: case (sizeof ($1) >= 8):;],
92 WIDE_LONG=yes, WIDE_LONG=no)
93AC_MSG_RESULT($WIDE_LONG)
94AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes])
95AS_VAR_POPDEF([WIDE_LONG])
96
Lev Walkin058e2222007-12-04 00:27:38 +000097dnl For mingw
98AC_SEARCH_LIBS(getopt, iberty)
99
Lev Walkinf15320b2004-06-03 03:38:44 +0000100AC_CHECK_FUNCS(strtoimax strtoll)
Lev Walkin49b0a3e2004-06-28 21:22:35 +0000101AC_CHECK_FUNCS(mergesort)
Lev Walkin27fd0b62007-08-27 23:57:45 +0000102AC_CHECK_FUNCS(mkstemps)
Lev Walkin04fbe622014-09-17 02:27:01 -0700103AC_CHECK_FUNCS(timegm)
Frank Morgnercab30af2013-05-21 14:28:35 +0200104AC_CHECK_DECLS(alloca strcasecmp)
Frank Morgner8a759ad2013-05-16 13:32:49 +0200105AC_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 +0000106
Lev Walkine315a182006-03-06 11:33:39 +0000107AC_OUTPUT( \
Lev Walkine315a182006-03-06 11:33:39 +0000108skeletons/tests/Makefile \
109libasn1compiler/Makefile \
110libasn1parser/Makefile \
111libasn1print/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000112asn1c/tests/Makefile \
113libasn1fix/Makefile \
Lev Walkine7c4b962010-11-09 03:10:36 -0800114doc/docsrc/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000115skeletons/Makefile \
116examples/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000117asn1c/Makefile \
118doc/Makefile \
119asn1c.spec \
120Makefile \
Lev Walkinf15320b2004-06-03 03:38:44 +0000121)
122