Harald Welte | 681f119 | 2020-04-20 12:00:33 +0200 | [diff] [blame] | 1 | # Process this file with autoconf to produce a configure script. |
| 2 | AC_INIT([osmo-uecups],[m4_esyscmd(./git-version-gen .tarball-version)],[osmocom-net-gprs@lists.osmocom.org]) |
| 3 | |
| 4 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 5 | AC_CONFIG_AUX_DIR([.]) |
| 6 | |
| 7 | AM_INIT_AUTOMAKE([dist-bzip2]) |
| 8 | |
| 9 | dnl kernel style compile messages |
| 10 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 11 | |
| 12 | dnl include release helper |
| 13 | RELMAKE='-include osmo-release.mk' |
| 14 | AC_SUBST([RELMAKE]) |
| 15 | |
| 16 | # Checks for programs. |
| 17 | AC_PROG_MAKE_SET |
| 18 | AC_PROG_CC |
| 19 | AC_PROG_INSTALL |
| 20 | LT_INIT |
| 21 | |
| 22 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 23 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 24 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 25 | AC_MSG_WARN([You need to install pkg-config]) |
| 26 | fi |
| 27 | PKG_PROG_PKG_CONFIG([0.20]) |
| 28 | |
| 29 | dnl check for AX_CHECK_COMPILE_FLAG |
| 30 | m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [ |
| 31 | AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.]) |
| 32 | ]) |
| 33 | |
| 34 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.1.0) |
| 35 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.1.0) |
| 36 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.7.0) |
| 37 | PKG_CHECK_MODULES(LIBJANSSON, jansson) |
| 38 | PKG_CHECK_MODULES(LIBNLROUTE3, libnl-route-3.0) |
| 39 | |
| 40 | AC_HEADER_STDC |
| 41 | |
| 42 | AC_ARG_ENABLE(sanitize, |
| 43 | [AS_HELP_STRING( |
| 44 | [--enable-sanitize], |
| 45 | [Compile with address sanitizer enabled], |
| 46 | )], |
| 47 | [sanitize=$enableval], [sanitize="no"]) |
| 48 | if test x"$sanitize" = x"yes" |
| 49 | then |
| 50 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 51 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 52 | fi |
| 53 | |
| 54 | AC_ARG_ENABLE(werror, |
| 55 | [AS_HELP_STRING( |
| 56 | [--enable-werror], |
| 57 | [Turn all compiler warnings into errors, with exceptions: |
| 58 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 59 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 60 | ] |
| 61 | )], |
| 62 | [werror=$enableval], [werror="no"]) |
| 63 | if test x"$werror" = x"yes" |
| 64 | then |
| 65 | WERROR_FLAGS="-Werror" |
| 66 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 67 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 68 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 69 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 70 | fi |
| 71 | |
| 72 | # The following test is taken from WebKit's webkit.m4 |
| 73 | saved_CFLAGS="$CFLAGS" |
| 74 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 75 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
| 76 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
| 77 | [ AC_MSG_RESULT([yes]) |
| 78 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 79 | AC_MSG_RESULT([no])) |
| 80 | CFLAGS="$saved_CFLAGS" |
| 81 | AC_SUBST(SYMBOL_VISIBILITY) |
| 82 | |
| 83 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 84 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 85 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
| 86 | AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [CFLAGS="$CFLAGS -Wnull-dereference"]) |
| 87 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 88 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 89 | |
| 90 | # Coverage build taken from WebKit's configure.in |
| 91 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 92 | AC_ARG_ENABLE(coverage, |
| 93 | AC_HELP_STRING([--enable-coverage], |
| 94 | [enable code coverage support [default=no]]), |
| 95 | [],[enable_coverage="no"]) |
| 96 | AC_MSG_RESULT([$enable_coverage]) |
| 97 | if test "$enable_coverage" = "yes"; then |
| 98 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 99 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 100 | AC_SUBST([COVERAGE_CFLAGS]) |
| 101 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 102 | fi |
| 103 | |
| 104 | AC_ARG_ENABLE(profile, |
| 105 | [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )], |
| 106 | [profile=$enableval], [profile="no"]) |
| 107 | if test x"$profile" = x"yes" |
| 108 | then |
| 109 | CFLAGS="$CFLAGS -pg" |
| 110 | CPPFLAGS="$CPPFLAGS -pg" |
| 111 | fi |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 117 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 118 | |
| 119 | AC_OUTPUT( |
| 120 | Makefile |
| 121 | daemon/Makefile |
| 122 | doc/Makefile |
| 123 | doc/examples/Makefile |
| 124 | ) |