Pau Espin Pedrol | 42b18e2 | 2018-05-03 18:20:57 +0200 | [diff] [blame^] | 1 | AC_INIT([libasn1c], |
| 2 | m4_esyscmd([./git-version-gen .tarball-version]), |
Harald Welte | bdff5e6 | 2010-06-12 19:05:23 +0200 | [diff] [blame] | 3 | [openbsc-devel@lists.openbsc.org]) |
| 4 | |
| 5 | AM_INIT_AUTOMAKE([dist-bzip2]) |
| 6 | |
| 7 | dnl kernel style compile messages |
| 8 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 9 | |
Pau Espin Pedrol | 96ef99e | 2018-05-03 17:15:26 +0200 | [diff] [blame] | 10 | dnl include release helper |
| 11 | RELMAKE='-include osmo-release.mk' |
| 12 | AC_SUBST([RELMAKE]) |
| 13 | |
Harald Welte | bdff5e6 | 2010-06-12 19:05:23 +0200 | [diff] [blame] | 14 | dnl checks for programs |
| 15 | AC_PROG_MAKE_SET |
| 16 | AC_PROG_CC |
| 17 | AC_PROG_INSTALL |
| 18 | LT_INIT |
| 19 | AC_PROG_LIBTOOL |
| 20 | |
| 21 | AC_CONFIG_MACRO_DIR([m4]) |
| 22 | |
Holger Hans Peter Freyther | f3c3049 | 2016-04-05 16:25:43 +0200 | [diff] [blame] | 23 | PKG_CHECK_MODULES(LIBTALLOC, talloc) |
Harald Welte | fa03400 | 2010-07-18 23:15:24 +0200 | [diff] [blame] | 24 | |
Neels Hofmeyr | bd21737 | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 25 | AC_ARG_ENABLE(sanitize, |
| 26 | [AS_HELP_STRING( |
| 27 | [--enable-sanitize], |
| 28 | [Compile with address sanitizer enabled], |
| 29 | )], |
| 30 | [sanitize=$enableval], [sanitize="no"]) |
| 31 | if test x"$sanitize" = x"yes" |
| 32 | then |
| 33 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 34 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 35 | fi |
| 36 | |
Neels Hofmeyr | 6e152f2 | 2018-03-05 19:46:44 +0100 | [diff] [blame] | 37 | AC_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"]) |
| 46 | if test x"$werror" = x"yes" |
| 47 | then |
| 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" |
| 53 | fi |
| 54 | |
Harald Welte | bdff5e6 | 2010-06-12 19:05:23 +0200 | [diff] [blame] | 55 | # The following test is taken from WebKit's webkit.m4 |
| 56 | saved_CFLAGS="$CFLAGS" |
| 57 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 58 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Harald Welte | f6b9173 | 2015-08-31 09:06:57 +0200 | [diff] [blame] | 59 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Harald Welte | bdff5e6 | 2010-06-12 19:05:23 +0200 | [diff] [blame] | 60 | [ AC_MSG_RESULT([yes]) |
| 61 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 62 | AC_MSG_RESULT([no])) |
| 63 | CFLAGS="$saved_CFLAGS" |
| 64 | AC_SUBST(SYMBOL_VISIBILITY) |
| 65 | |
Harald Welte | a37b06d | 2015-12-18 15:37:17 +0100 | [diff] [blame] | 66 | AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Buld the library with EMIT_ASN_DEBUG enabled])], |
| 67 | [build_debug="$enableval"], [build_debug="no"]) |
| 68 | AM_CONDITIONAL(BUILD_DEBUG, test "x$build_debug" = "xyes") |
| 69 | |
Neels Hofmeyr | 6e152f2 | 2018-03-05 19:46:44 +0100 | [diff] [blame] | 70 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 71 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 72 | |
Harald Welte | bdff5e6 | 2010-06-12 19:05:23 +0200 | [diff] [blame] | 73 | AC_OUTPUT( |
| 74 | libasn1c.pc |
| 75 | src/Makefile |
Harald Welte | 98cb836 | 2010-06-12 19:15:51 +0200 | [diff] [blame] | 76 | include/Makefile |
| 77 | include/asn1c/Makefile |
Harald Welte | bdff5e6 | 2010-06-12 19:05:23 +0200 | [diff] [blame] | 78 | Makefile) |