Harald Welte | 964cda3 | 2019-11-24 22:27:10 +0100 | [diff] [blame] | 1 | AC_INIT([simtrace2], |
| 2 | m4_esyscmd([./git-version-gen .tarball-version]), |
| 3 | [simtrace@lists.osmocom.org]) |
| 4 | |
| 5 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 6 | AC_CONFIG_AUX_DIR([.]) |
| 7 | |
| 8 | AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects]) |
| 9 | AC_CONFIG_TESTDIR(tests) |
| 10 | |
| 11 | dnl kernel style compile messages |
| 12 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 13 | |
| 14 | dnl include release helper |
| 15 | RELMAKE='-include osmo-release.mk' |
| 16 | AC_SUBST([RELMAKE]) |
| 17 | |
| 18 | dnl checks for programs |
| 19 | AC_PROG_MAKE_SET |
| 20 | AC_PROG_CC |
| 21 | AC_PROG_INSTALL |
| 22 | LT_INIT([pic-only]) |
| 23 | |
| 24 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 25 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 26 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 27 | AC_MSG_WARN([You need to install pkg-config]) |
| 28 | fi |
| 29 | PKG_PROG_PKG_CONFIG([0.20]) |
| 30 | |
| 31 | AC_CONFIG_MACRO_DIR([m4]) |
| 32 | |
| 33 | CFLAGS="$CFLAGS -Wall" |
| 34 | CPPFLAGS="$CPPFLAGS -Wall" |
| 35 | |
| 36 | AC_ARG_ENABLE(sanitize, |
| 37 | [AS_HELP_STRING( |
| 38 | [--enable-sanitize], |
| 39 | [Compile with address sanitizer enabled], |
| 40 | )], |
| 41 | [sanitize=$enableval], [sanitize="no"]) |
| 42 | if test x"$sanitize" = x"yes" |
| 43 | then |
| 44 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 45 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 46 | fi |
| 47 | |
| 48 | # The following test is taken from WebKit's webkit.m4 |
| 49 | saved_CFLAGS="$CFLAGS" |
| 50 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 51 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
| 52 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
| 53 | [ AC_MSG_RESULT([yes]) |
| 54 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 55 | AC_MSG_RESULT([no])) |
| 56 | CFLAGS="$saved_CFLAGS" |
| 57 | AC_SUBST(SYMBOL_VISIBILITY) |
| 58 | |
| 59 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0) |
| 60 | PKG_CHECK_MODULES(LIBOSMOSIM, libosmosim >= 1.0.0) |
| 61 | PKG_CHECK_MODULES(LIBUSB, libusb-1.0) |
| 62 | |
| 63 | AC_ARG_ENABLE(sanitize, |
| 64 | [AS_HELP_STRING( |
| 65 | [--enable-sanitize], |
| 66 | [Compile with address sanitizer enabled], |
| 67 | )], |
| 68 | [sanitize=$enableval], [sanitize="no"]) |
| 69 | if test x"$sanitize" = x"yes" |
| 70 | then |
| 71 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 72 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 73 | fi |
| 74 | |
| 75 | AC_ARG_ENABLE(werror, |
| 76 | [AS_HELP_STRING( |
| 77 | [--enable-werror], |
| 78 | [Turn all compiler warnings into errors, with exceptions: |
| 79 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 80 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 81 | ] |
| 82 | )], |
| 83 | [werror=$enableval], [werror="no"]) |
| 84 | if test x"$werror" = x"yes" |
| 85 | then |
| 86 | WERROR_FLAGS="-Werror" |
| 87 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 88 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 89 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 90 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 91 | fi |
| 92 | |
| 93 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 94 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 95 | |
| 96 | AC_OUTPUT( |
| 97 | libosmo-simtrace2.pc |
| 98 | include/Makefile |
| 99 | src/Makefile |
| 100 | lib/Makefile |
| 101 | contrib/Makefile |
| 102 | Makefile) |