Harald Welte | 54ca6f4 | 2018-06-04 21:52:30 +0200 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script |
Harald Welte | b803888 | 2018-06-04 22:00:03 +0200 | [diff] [blame] | 2 | AC_INIT([osmo-sysmon], |
Harald Welte | 54ca6f4 | 2018-06-04 21:52:30 +0200 | [diff] [blame] | 3 | m4_esyscmd([./git-version-gen .tarball-version]), |
| 4 | [openbsc@lists.osmocom.org]) |
| 5 | |
| 6 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 7 | AC_CONFIG_AUX_DIR([.]) |
| 8 | |
| 9 | AM_INIT_AUTOMAKE([dist-bzip2 foreign]) |
| 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 |
| 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 | dnl check for AX_CHECK_COMPILE_FLAG |
| 32 | m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [ |
| 33 | AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.]) |
| 34 | ]) |
| 35 | |
| 36 | dnl checks for libraries |
| 37 | AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""]) |
| 38 | AC_SUBST(LIBRARY_DL) |
| 39 | |
| 40 | |
| 41 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0) |
| 42 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0) |
| 43 | PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.11.0) |
| 44 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0) |
Max | 9a852f2 | 2019-01-31 15:58:57 +0100 | [diff] [blame] | 45 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.4.0) |
Harald Welte | 54ca6f4 | 2018-06-04 21:52:30 +0200 | [diff] [blame] | 46 | PKG_CHECK_MODULES(LIBMNL, libmnl) |
Max | 8066a41 | 2019-01-28 23:59:03 +0100 | [diff] [blame] | 47 | dnl FIXME: bump to 1.10.0 once it's available on build slaves and remove workaround from osysmon_ping.c |
Pau Espin Pedrol | 9784c81 | 2019-03-20 14:35:03 +0100 | [diff] [blame] | 48 | dnl FIXME: debian8 provides 1.7.0, debian9 provides 1.9.0 |
| 49 | PKG_CHECK_MODULES(LIBOPING, liboping >= 1.7.0) |
Harald Welte | 54ca6f4 | 2018-06-04 21:52:30 +0200 | [diff] [blame] | 50 | |
| 51 | dnl checks for header files |
| 52 | AC_HEADER_STDC |
| 53 | |
| 54 | dnl Checks for typedefs, structures and compiler characteristics |
| 55 | |
| 56 | AC_ARG_ENABLE(sanitize, |
| 57 | [AS_HELP_STRING( |
| 58 | [--enable-sanitize], |
| 59 | [Compile with address sanitizer enabled], |
| 60 | )], |
| 61 | [sanitize=$enableval], [sanitize="no"]) |
| 62 | if test x"$sanitize" = x"yes" |
| 63 | then |
| 64 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 65 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 66 | fi |
| 67 | |
| 68 | AC_ARG_ENABLE(werror, |
| 69 | [AS_HELP_STRING( |
| 70 | [--enable-werror], |
| 71 | [Turn all compiler warnings into errors, with exceptions: |
| 72 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 73 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 74 | ] |
| 75 | )], |
| 76 | [werror=$enableval], [werror="no"]) |
| 77 | if test x"$werror" = x"yes" |
| 78 | then |
| 79 | WERROR_FLAGS="-Werror" |
| 80 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 81 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 82 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 83 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 84 | fi |
| 85 | |
| 86 | # The following test is taken from WebKit's webkit.m4 |
| 87 | saved_CFLAGS="$CFLAGS" |
| 88 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 89 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
| 90 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
| 91 | [ AC_MSG_RESULT([yes]) |
| 92 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 93 | AC_MSG_RESULT([no])) |
| 94 | CFLAGS="$saved_CFLAGS" |
| 95 | AC_SUBST(SYMBOL_VISIBILITY) |
| 96 | |
| 97 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 98 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 99 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
| 100 | AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"]) |
| 101 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 102 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 103 | |
| 104 | # Coverage build taken from WebKit's configure.in |
| 105 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 106 | AC_ARG_ENABLE(coverage, |
| 107 | AC_HELP_STRING([--enable-coverage], |
| 108 | [enable code coverage support [default=no]]), |
| 109 | [],[enable_coverage="no"]) |
| 110 | AC_MSG_RESULT([$enable_coverage]) |
| 111 | if test "$enable_coverage" = "yes"; then |
| 112 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 113 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 114 | AC_SUBST([COVERAGE_CFLAGS]) |
| 115 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 116 | fi |
| 117 | |
| 118 | AC_ARG_ENABLE(profile, |
| 119 | [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )], |
| 120 | [profile=$enableval], [profile="no"]) |
| 121 | if test x"$profile" = x"yes" |
| 122 | then |
| 123 | CFLAGS="$CFLAGS -pg" |
| 124 | CPPFLAGS="$CPPFLAGS -pg" |
| 125 | fi |
| 126 | |
| 127 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 128 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 129 | |
| 130 | dnl Generate the output |
| 131 | AM_CONFIG_HEADER(config.h) |
| 132 | |
| 133 | AC_OUTPUT( |
Max | bf35719 | 2018-11-22 13:32:27 +0100 | [diff] [blame] | 134 | doc/Makefile |
| 135 | doc/examples/Makefile |
Pau Espin Pedrol | 2768f95 | 2018-12-12 19:19:14 +0100 | [diff] [blame] | 136 | src/Makefile |
Harald Welte | 54ca6f4 | 2018-06-04 21:52:30 +0200 | [diff] [blame] | 137 | Makefile) |