blob: a937bf2b7f7130e65d67637545da9cca3a67c993 [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 Walkinf7613202016-01-10 13:27:18 -08005AM_INIT_AUTOMAKE([foreign])
Lev Walkine7c4b962010-11-09 03:10:36 -08006AC_CONFIG_MACRO_DIR([m4])
Lev Walkinf15320b2004-06-03 03:38:44 +00007
8AM_PROG_LIBTOOL
9
Lev Walkinf15320b2004-06-03 03:38:44 +000010dnl Checks for programs.
11AC_PROG_CC
12AC_PROG_CPP
13AC_PROG_INSTALL
14AC_PROG_LN_S
15AC_PROG_MAKE_SET
16AC_PROG_YACC
17AM_PROG_LEX
Lev Walkinc10e06c2005-03-30 05:14:26 +000018AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris
Lev Walkinf15320b2004-06-03 03:38:44 +000019
Lev Walkin32789952014-10-12 18:51:52 -070020dnl If you need to see the details, just run make V=1.
21m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Frank Morgnerfb63c012013-05-21 09:56:38 +020022
Lev Walkinbec70d82004-08-23 10:40:21 +000023case "$host_os" in
Lev Walkin19abe222006-03-18 06:39:12 +000024cygwin)
Lev Walkinbec70d82004-08-23 10:40:21 +000025 case "$target" in
26 *mingw*)
27 CC="$CC -mno-cygwin"
28 esac
29 ;;
Lev Walkin615a7fa2006-03-18 06:24:33 +000030esac
31
Lev Walkin58ecc7b2014-09-17 00:32:03 -070032AC_ARG_ENABLE([ASN_DEBUG],
Lev Walkin271131c2015-04-10 00:09:57 -070033 [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 Walkin58ecc7b2014-09-17 00:32:03 -070039
Lev Walkinf84cc012014-01-14 02:12:24 -080040AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
41AX_CHECK_COMPILE_FLAG([-Wcast-qual], [CFLAGS="$CFLAGS -Wcast-qual"])
42AX_CHECK_COMPILE_FLAG([-Wchar-subscripts],
Lev Walkin65907f02014-09-14 17:19:21 -070043 [CFLAGS="$CFLAGS -Wchar-subscripts"])
Lev Walkinf84cc012014-01-14 02:12:24 -080044AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes],
Lev Walkin65907f02014-09-14 17:19:21 -070045 [CFLAGS="$CFLAGS -Wmissing-prototypes"])
Lev Walkinf84cc012014-01-14 02:12:24 -080046AX_CHECK_COMPILE_FLAG([-Wmissing-declarations],
Lev Walkin65907f02014-09-14 17:19:21 -070047 [CFLAGS="$CFLAGS -Wmissing-declarations"])
Lev Walkinf15320b2004-06-03 03:38:44 +000048
Lev Walkinf84cc012014-01-14 02:12:24 -080049dnl There are legitimate uses for these features, disable warnings/errors.
50AX_CHECK_COMPILE_FLAG([-Wno-error=cast-align],
Lev Walkin65907f02014-09-14 17:19:21 -070051 [CFLAGS="$CFLAGS -Wno-error=cast-align"])
Lev Walkinf84cc012014-01-14 02:12:24 -080052AX_CHECK_COMPILE_FLAG([-Wno-error=visibility],
Lev Walkin65907f02014-09-14 17:19:21 -070053 [CFLAGS="$CFLAGS -Wno-error=visibility"])
Lev Walkinf84cc012014-01-14 02:12:24 -080054AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality],
Lev Walkin65907f02014-09-14 17:19:21 -070055 [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"])
56AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable],
57 [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"])
58
Lev Walkinf7613202016-01-10 13:27:18 -080059AC_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
67AC_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 Walkin65907f02014-09-14 17:19:21 -070075AC_SUBST(ADD_CFLAGS)
76AC_SUBST(TESTSUITE_CFLAGS)
Lev Walkinf15320b2004-06-03 03:38:44 +000077
Lev Walkin97363482016-01-24 19:23:02 -080078dnl Skeletons should be very compatible with most of the compilers, hence
79dnl very strict backward compatibility flags.
80SKELETONS_CFLAGS="${ADD_CFLAGS}"
81AX_CHECK_COMPILE_FLAG([-std=c89],
82 [SKELETONS_FLAGS="$SKELETONS_FLAGS -std=c89"])
83AX_CHECK_COMPILE_FLAG([-Wpedantic],
84 [SKELETONS_FLAGS="$SKELETONS_FLAGS -Wpedantic"])
85AC_SUBST(SKELETONS_CFLAGS)
86
Lev Walkinf15320b2004-06-03 03:38:44 +000087dnl Checks for header files.
88AC_HEADER_STDC
Lev Walkin79f54952004-08-13 16:58:19 +000089AC_CHECK_HEADERS(sys/param.h)
Lev Walkinf15320b2004-06-03 03:38:44 +000090
91dnl Checks for typedefs, structures, and compiler characteristics.
92AC_C_BIGENDIAN
93AC_TYPE_OFF_T
94AC_TYPE_SIZE_T
95AC_STRUCT_TM
96AC_CHECK_TYPE(intmax_t, int64_t)
97
Lev Walkinb40ec412014-02-24 00:57:18 -080098dnl Test if we should check features that depend on 64-bitness.
99AC_MSG_CHECKING(size of long is longer than 32 bit)
100AS_VAR_PUSHDEF([WIDE_LONG], [WIDE_LONG])
101AC_TRY_COMPILE([#include "confdefs.h"
102#include <sys/types.h>
103], [switch (0) case 0: case (sizeof ($1) >= 8):;],
104 WIDE_LONG=yes, WIDE_LONG=no)
105AC_MSG_RESULT($WIDE_LONG)
106AM_CONDITIONAL([TEST_64BIT], [test x$WIDE_LONG = xyes])
107AS_VAR_POPDEF([WIDE_LONG])
108
Lev Walkin058e2222007-12-04 00:27:38 +0000109dnl For mingw
110AC_SEARCH_LIBS(getopt, iberty)
111
Lev Walkinf15320b2004-06-03 03:38:44 +0000112AC_CHECK_FUNCS(strtoimax strtoll)
Lev Walkin49b0a3e2004-06-28 21:22:35 +0000113AC_CHECK_FUNCS(mergesort)
Lev Walkin27fd0b62007-08-27 23:57:45 +0000114AC_CHECK_FUNCS(mkstemps)
Lev Walkin04fbe622014-09-17 02:27:01 -0700115AC_CHECK_FUNCS(timegm)
Frank Morgnercab30af2013-05-21 14:28:35 +0200116AC_CHECK_DECLS(alloca strcasecmp)
Frank Morgner8a759ad2013-05-16 13:32:49 +0200117AC_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 +0000118
Lev Walkinc6080fd2016-01-23 06:35:34 -0800119dnl Use pandoc to generate manual pages.
120AC_PATH_PROG([PANDOC], pandoc)
121AM_CONDITIONAL([HAVE_PANDOC], [test -n "$PANDOC"])
122
Lev Walkine315a182006-03-06 11:33:39 +0000123AC_OUTPUT( \
Lev Walkine315a182006-03-06 11:33:39 +0000124skeletons/tests/Makefile \
125libasn1compiler/Makefile \
126libasn1parser/Makefile \
127libasn1print/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000128asn1c/tests/Makefile \
129libasn1fix/Makefile \
Lev Walkine7c4b962010-11-09 03:10:36 -0800130doc/docsrc/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000131skeletons/Makefile \
132examples/Makefile \
Lev Walkinc6080fd2016-01-23 06:35:34 -0800133doc/man/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000134asn1c/Makefile \
135doc/Makefile \
Lev Walkine315a182006-03-06 11:33:39 +0000136Makefile \
Lev Walkinf15320b2004-06-03 03:38:44 +0000137)
138