Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script |
Harald Welte | 630df7d | 2017-09-03 22:29:45 +0200 | [diff] [blame] | 2 | AC_INIT([osmo-bsc], |
Harald Welte | 5a29c7f | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 3 | m4_esyscmd([./git-version-gen .tarball-version]), |
Holger Hans Peter Freyther | 47d8f02 | 2014-05-15 12:26:16 +0200 | [diff] [blame] | 4 | [openbsc@lists.osmocom.org]) |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 5 | |
Neels Hofmeyr | b810312 | 2016-10-01 00:34:31 +0200 | [diff] [blame] | 6 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 7 | AC_CONFIG_AUX_DIR([.]) |
| 8 | |
Harald Welte | 5a29c7f | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 9 | AM_INIT_AUTOMAKE([dist-bzip2]) |
Holger Hans Peter Freyther | 6c88217 | 2012-01-06 15:16:12 +0100 | [diff] [blame] | 10 | AC_CONFIG_TESTDIR(tests) |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 11 | |
Holger Hans Peter Freyther | 1f59ac4 | 2009-10-27 03:34:49 +0100 | [diff] [blame] | 12 | dnl kernel style compile messages |
| 13 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 14 | |
Max | 88d8bcb | 2017-08-28 12:04:18 +0200 | [diff] [blame] | 15 | dnl include release helper |
| 16 | RELMAKE='-include osmo-release.mk' |
| 17 | AC_SUBST([RELMAKE]) |
| 18 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 19 | dnl checks for programs |
| 20 | AC_PROG_MAKE_SET |
| 21 | AC_PROG_CC |
| 22 | AC_PROG_INSTALL |
Max | eab5f59 | 2017-05-26 12:31:00 +0200 | [diff] [blame] | 23 | LT_INIT |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 24 | |
Neels Hofmeyr | a8f91df | 2016-10-01 00:50:25 +0200 | [diff] [blame] | 25 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 26 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 27 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 28 | AC_MSG_WARN([You need to install pkg-config]) |
| 29 | fi |
| 30 | PKG_PROG_PKG_CONFIG([0.20]) |
| 31 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 32 | dnl check for AX_CHECK_COMPILE_FLAG |
| 33 | m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [ |
| 34 | AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.]) |
| 35 | ]) |
| 36 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 37 | dnl checks for libraries |
Jacob Erlbeck | 51a869c | 2013-10-15 12:00:26 +0200 | [diff] [blame] | 38 | AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""]) |
| 39 | AC_SUBST(LIBRARY_DL) |
| 40 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 41 | |
Pau Espin Pedrol | 08d02dd | 2018-07-27 19:25:05 +0200 | [diff] [blame] | 42 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.12.0) |
| 43 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.12.0) |
| 44 | PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.12.0) |
| 45 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.12.0) |
| 46 | PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.5.1) |
| 47 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.3.0) |
| 48 | PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.10.0) |
| 49 | PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.10.0) |
| 50 | PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.4.0) |
Philipp Maier | 65df74d | 2018-05-02 15:11:01 +0200 | [diff] [blame] | 51 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 52 | dnl checks for header files |
| 53 | AC_HEADER_STDC |
Max | 7bb383a | 2017-05-02 12:59:15 +0200 | [diff] [blame] | 54 | |
| 55 | found_pcap=yes |
| 56 | AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no) |
| 57 | AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes) |
Harald Welte | ca17ef8 | 2011-02-05 15:13:27 +0100 | [diff] [blame] | 58 | |
Harald Welte | 7465e4c | 2012-11-13 07:06:54 +0100 | [diff] [blame] | 59 | found_cdk=yes |
| 60 | AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no) |
| 61 | AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes) |
| 62 | |
Holger Hans Peter Freyther | bb06eb9 | 2015-01-10 09:51:31 +0100 | [diff] [blame] | 63 | found_sqlite3=yes |
| 64 | PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no) |
| 65 | AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes) |
| 66 | AC_SUBST(found_sqlite3) |
| 67 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 68 | |
| 69 | dnl Checks for typedefs, structures and compiler characteristics |
| 70 | |
Neels Hofmeyr | 17b773a | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 71 | AC_ARG_ENABLE(sanitize, |
| 72 | [AS_HELP_STRING( |
| 73 | [--enable-sanitize], |
| 74 | [Compile with address sanitizer enabled], |
| 75 | )], |
| 76 | [sanitize=$enableval], [sanitize="no"]) |
| 77 | if test x"$sanitize" = x"yes" |
| 78 | then |
| 79 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 80 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 81 | fi |
| 82 | |
Neels Hofmeyr | 1bb5554 | 2018-03-05 20:08:43 +0100 | [diff] [blame] | 83 | AC_ARG_ENABLE(werror, |
| 84 | [AS_HELP_STRING( |
| 85 | [--enable-werror], |
| 86 | [Turn all compiler warnings into errors, with exceptions: |
| 87 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 88 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 89 | ] |
| 90 | )], |
| 91 | [werror=$enableval], [werror="no"]) |
| 92 | if test x"$werror" = x"yes" |
| 93 | then |
| 94 | WERROR_FLAGS="-Werror" |
| 95 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 96 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 97 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 98 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 99 | fi |
| 100 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 101 | # The following test is taken from WebKit's webkit.m4 |
| 102 | saved_CFLAGS="$CFLAGS" |
| 103 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 104 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Alexander Huemer | db1bd69 | 2011-05-24 15:16:54 +0200 | [diff] [blame] | 105 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 106 | [ AC_MSG_RESULT([yes]) |
| 107 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 108 | AC_MSG_RESULT([no])) |
| 109 | CFLAGS="$saved_CFLAGS" |
| 110 | AC_SUBST(SYMBOL_VISIBILITY) |
| 111 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 112 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 113 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 114 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
| 115 | AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"]) |
| 116 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 117 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 118 | |
Holger Hans Peter Freyther | ecd94a4 | 2010-11-15 18:37:57 +0100 | [diff] [blame] | 119 | # Coverage build taken from WebKit's configure.in |
| 120 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 121 | AC_ARG_ENABLE(coverage, |
| 122 | AC_HELP_STRING([--enable-coverage], |
| 123 | [enable code coverage support [default=no]]), |
| 124 | [],[enable_coverage="no"]) |
| 125 | AC_MSG_RESULT([$enable_coverage]) |
| 126 | if test "$enable_coverage" = "yes"; then |
| 127 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 128 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 129 | AC_SUBST([COVERAGE_CFLAGS]) |
| 130 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 131 | fi |
| 132 | |
Max | 0bd729f | 2017-12-28 14:33:53 +0100 | [diff] [blame] | 133 | AC_ARG_ENABLE(profile, |
| 134 | [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )], |
| 135 | [profile=$enableval], [profile="no"]) |
| 136 | if test x"$profile" = x"yes" |
| 137 | then |
| 138 | CFLAGS="$CFLAGS -pg" |
| 139 | CPPFLAGS="$CPPFLAGS -pg" |
| 140 | fi |
| 141 | |
Pablo Neira Ayuso | 9224010 | 2014-09-01 09:34:07 +0200 | [diff] [blame] | 142 | AC_ARG_ENABLE([external_tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 143 | AC_HELP_STRING([--enable-external-tests], |
| 144 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 145 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 146 | if test "x$enable_ext_tests" = "xyes" ; then |
Pau Espin Pedrol | 7e78681 | 2017-11-24 12:00:35 +0100 | [diff] [blame] | 147 | AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes) |
| 148 | if test "x$PYTHON2_AVAIL" != "xyes" ; then |
| 149 | AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.]) |
| 150 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 151 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 152 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
Neels Hofmeyr | 178d137 | 2017-07-20 23:01:45 +0200 | [diff] [blame] | 153 | AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.]) |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 154 | fi |
| 155 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 156 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 157 | AC_MSG_RESULT([$enable_ext_tests]) |
| 158 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 159 | |
Neels Hofmeyr | 1bb5554 | 2018-03-05 20:08:43 +0100 | [diff] [blame] | 160 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 161 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 162 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 163 | dnl Generate the output |
| 164 | AM_CONFIG_HEADER(bscconfig.h) |
| 165 | |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 166 | AC_OUTPUT( |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 167 | include/Makefile |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 168 | include/osmocom/Makefile |
| 169 | include/osmocom/bsc/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 170 | src/Makefile |
Holger Hans Peter Freyther | 4247cea | 2015-04-04 18:42:46 +0200 | [diff] [blame] | 171 | src/libfilter/Makefile |
Harald Welte | 31c00f7 | 2011-03-03 23:29:05 +0100 | [diff] [blame] | 172 | src/osmo-bsc/Makefile |
Harald Welte | 31c00f7 | 2011-03-03 23:29:05 +0100 | [diff] [blame] | 173 | src/ipaccess/Makefile |
| 174 | src/utils/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 175 | tests/Makefile |
Holger Hans Peter Freyther | 93ef33e | 2012-01-09 22:53:04 +0100 | [diff] [blame] | 176 | tests/atlocal |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 177 | tests/gsm0408/Makefile |
Jacob Erlbeck | 946d141 | 2013-09-17 13:59:29 +0200 | [diff] [blame] | 178 | tests/bsc/Makefile |
Philipp Maier | 844876f | 2018-07-13 09:17:07 +0200 | [diff] [blame] | 179 | tests/codec_pref/Makefile |
Holger Hans Peter Freyther | bce5675 | 2012-11-22 14:59:46 +0100 | [diff] [blame] | 180 | tests/abis/Makefile |
Jacob Erlbeck | 0acc001 | 2014-12-03 13:05:16 +0100 | [diff] [blame] | 181 | tests/subscr/Makefile |
Philipp | b4cb838 | 2016-09-29 17:01:57 +0200 | [diff] [blame] | 182 | tests/nanobts_omlattr/Makefile |
Neels Hofmeyr | 909e972 | 2017-12-07 03:54:01 +0100 | [diff] [blame] | 183 | tests/handover/Makefile |
Harald Welte | eb11313 | 2011-05-11 22:11:28 +0200 | [diff] [blame] | 184 | doc/Makefile |
| 185 | doc/examples/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 186 | Makefile) |