blob: 53720b91800dc4d7b93ddada7fbc99a113944e46 [file] [log] [blame]
Pau Espin Pedrol42b18e22018-05-03 18:20:57 +02001AC_INIT([libasn1c],
2 m4_esyscmd([./git-version-gen .tarball-version]),
Harald Weltebdff5e62010-06-12 19:05:23 +02003 [openbsc-devel@lists.openbsc.org])
4
5AM_INIT_AUTOMAKE([dist-bzip2])
6
7dnl kernel style compile messages
8m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
9
Pau Espin Pedrol96ef99e2018-05-03 17:15:26 +020010dnl include release helper
11RELMAKE='-include osmo-release.mk'
12AC_SUBST([RELMAKE])
13
Harald Weltebdff5e62010-06-12 19:05:23 +020014dnl checks for programs
15AC_PROG_MAKE_SET
16AC_PROG_CC
17AC_PROG_INSTALL
18LT_INIT
19AC_PROG_LIBTOOL
20
21AC_CONFIG_MACRO_DIR([m4])
22
Holger Hans Peter Freytherf3c30492016-04-05 16:25:43 +020023PKG_CHECK_MODULES(LIBTALLOC, talloc)
Harald Weltefa034002010-07-18 23:15:24 +020024
Neels Hofmeyrbd217372017-11-17 01:43:36 +010025AC_ARG_ENABLE(sanitize,
26 [AS_HELP_STRING(
27 [--enable-sanitize],
28 [Compile with address sanitizer enabled],
29 )],
30 [sanitize=$enableval], [sanitize="no"])
31if test x"$sanitize" = x"yes"
32then
33 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
34 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
35fi
36
Neels Hofmeyr6e152f22018-03-05 19:46:44 +010037AC_ARG_ENABLE(werror,
38 [AS_HELP_STRING(
39 [--enable-werror],
40 [Turn all compiler warnings into errors, with exceptions:
41 a) deprecation (allow upstream to mark deprecation without breaking builds);
42 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
43 ]
44 )],
45 [werror=$enableval], [werror="no"])
46if test x"$werror" = x"yes"
47then
48 WERROR_FLAGS="-Werror"
49 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
50 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
51 CFLAGS="$CFLAGS $WERROR_FLAGS"
52 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
53fi
54
Harald Weltebdff5e62010-06-12 19:05:23 +020055# The following test is taken from WebKit's webkit.m4
56saved_CFLAGS="$CFLAGS"
57CFLAGS="$CFLAGS -fvisibility=hidden "
58AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Harald Weltef6b91732015-08-31 09:06:57 +020059AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Harald Weltebdff5e62010-06-12 19:05:23 +020060 [ AC_MSG_RESULT([yes])
61 SYMBOL_VISIBILITY="-fvisibility=hidden"],
62 AC_MSG_RESULT([no]))
63CFLAGS="$saved_CFLAGS"
64AC_SUBST(SYMBOL_VISIBILITY)
65
Harald Weltea37b06d2015-12-18 15:37:17 +010066AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Buld the library with EMIT_ASN_DEBUG enabled])],
67 [build_debug="$enableval"], [build_debug="no"])
68AM_CONDITIONAL(BUILD_DEBUG, test "x$build_debug" = "xyes")
69
Neels Hofmeyr6e152f22018-03-05 19:46:44 +010070AC_MSG_RESULT([CFLAGS="$CFLAGS"])
71AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
72
Harald Weltebdff5e62010-06-12 19:05:23 +020073AC_OUTPUT(
74 libasn1c.pc
75 src/Makefile
Harald Welte98cb8362010-06-12 19:15:51 +020076 include/Makefile
77 include/asn1c/Makefile
Harald Weltebdff5e62010-06-12 19:05:23 +020078 Makefile)