blob: 16109730b40df2351d43c75e034a920271f8022f [file] [log] [blame]
Harald Welte41b85d52015-08-31 08:56:53 +02001AC_INIT([libasn1c], [0.9.28],
Harald Weltebdff5e62010-06-12 19:05:23 +02002 [openbsc-devel@lists.openbsc.org])
3
4AM_INIT_AUTOMAKE([dist-bzip2])
5
6dnl kernel style compile messages
7m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
8
9dnl checks for programs
10AC_PROG_MAKE_SET
11AC_PROG_CC
12AC_PROG_INSTALL
13LT_INIT
14AC_PROG_LIBTOOL
15
16AC_CONFIG_MACRO_DIR([m4])
17
Holger Hans Peter Freytherf3c30492016-04-05 16:25:43 +020018PKG_CHECK_MODULES(LIBTALLOC, talloc)
Harald Weltefa034002010-07-18 23:15:24 +020019
Neels Hofmeyrbd217372017-11-17 01:43:36 +010020AC_ARG_ENABLE(sanitize,
21 [AS_HELP_STRING(
22 [--enable-sanitize],
23 [Compile with address sanitizer enabled],
24 )],
25 [sanitize=$enableval], [sanitize="no"])
26if test x"$sanitize" = x"yes"
27then
28 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
29 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
30fi
31
Neels Hofmeyr6e152f22018-03-05 19:46:44 +010032AC_ARG_ENABLE(werror,
33 [AS_HELP_STRING(
34 [--enable-werror],
35 [Turn all compiler warnings into errors, with exceptions:
36 a) deprecation (allow upstream to mark deprecation without breaking builds);
37 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
38 ]
39 )],
40 [werror=$enableval], [werror="no"])
41if test x"$werror" = x"yes"
42then
43 WERROR_FLAGS="-Werror"
44 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
45 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
46 CFLAGS="$CFLAGS $WERROR_FLAGS"
47 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
48fi
49
Harald Weltebdff5e62010-06-12 19:05:23 +020050# The following test is taken from WebKit's webkit.m4
51saved_CFLAGS="$CFLAGS"
52CFLAGS="$CFLAGS -fvisibility=hidden "
53AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Harald Weltef6b91732015-08-31 09:06:57 +020054AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Harald Weltebdff5e62010-06-12 19:05:23 +020055 [ AC_MSG_RESULT([yes])
56 SYMBOL_VISIBILITY="-fvisibility=hidden"],
57 AC_MSG_RESULT([no]))
58CFLAGS="$saved_CFLAGS"
59AC_SUBST(SYMBOL_VISIBILITY)
60
Harald Weltea37b06d2015-12-18 15:37:17 +010061AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Buld the library with EMIT_ASN_DEBUG enabled])],
62 [build_debug="$enableval"], [build_debug="no"])
63AM_CONDITIONAL(BUILD_DEBUG, test "x$build_debug" = "xyes")
64
Neels Hofmeyr6e152f22018-03-05 19:46:44 +010065AC_MSG_RESULT([CFLAGS="$CFLAGS"])
66AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
67
Harald Weltebdff5e62010-06-12 19:05:23 +020068AC_OUTPUT(
69 libasn1c.pc
70 src/Makefile
Harald Welte98cb8362010-06-12 19:15:51 +020071 include/Makefile
72 include/asn1c/Makefile
Harald Weltebdff5e62010-06-12 19:05:23 +020073 Makefile)
74