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 | |
Harald Welte | b069f65 | 2017-10-28 12:59:20 +0200 | [diff] [blame] | 42 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.10.0) |
| 43 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.10.0) |
| 44 | PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.10.0) |
| 45 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.10.0) |
| 46 | PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2) |
| 47 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.1.0) |
| 48 | PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.8.0) |
Harald Welte | 1861b55 | 2017-09-03 20:13:28 +0200 | [diff] [blame] | 49 | PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2) |
Harald Welte | f04e9c2 | 2017-11-10 11:39:16 +0900 | [diff] [blame] | 50 | PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.2.0) |
Philipp Maier | 39c609b | 2017-09-27 15:51:34 +0200 | [diff] [blame] | 51 | PKG_CHECK_MODULES(LIBOSMOLEGACYMGCP, libosmo-legacy-mgcp >= 1.0.0) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 52 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 53 | dnl checks for header files |
| 54 | AC_HEADER_STDC |
Max | 7bb383a | 2017-05-02 12:59:15 +0200 | [diff] [blame] | 55 | |
| 56 | found_pcap=yes |
| 57 | AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no) |
| 58 | AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes) |
Harald Welte | ca17ef8 | 2011-02-05 15:13:27 +0100 | [diff] [blame] | 59 | |
Harald Welte | 7465e4c | 2012-11-13 07:06:54 +0100 | [diff] [blame] | 60 | found_cdk=yes |
| 61 | AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no) |
| 62 | AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes) |
| 63 | |
Holger Hans Peter Freyther | bb06eb9 | 2015-01-10 09:51:31 +0100 | [diff] [blame] | 64 | found_sqlite3=yes |
| 65 | PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no) |
| 66 | AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes) |
| 67 | AC_SUBST(found_sqlite3) |
| 68 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 69 | |
| 70 | dnl Checks for typedefs, structures and compiler characteristics |
| 71 | |
Neels Hofmeyr | 17b773a | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 72 | AC_ARG_ENABLE(sanitize, |
| 73 | [AS_HELP_STRING( |
| 74 | [--enable-sanitize], |
| 75 | [Compile with address sanitizer enabled], |
| 76 | )], |
| 77 | [sanitize=$enableval], [sanitize="no"]) |
| 78 | if test x"$sanitize" = x"yes" |
| 79 | then |
| 80 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 81 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 82 | fi |
| 83 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 84 | # The following test is taken from WebKit's webkit.m4 |
| 85 | saved_CFLAGS="$CFLAGS" |
| 86 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 87 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Alexander Huemer | db1bd69 | 2011-05-24 15:16:54 +0200 | [diff] [blame] | 88 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 89 | [ AC_MSG_RESULT([yes]) |
| 90 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 91 | AC_MSG_RESULT([no])) |
| 92 | CFLAGS="$saved_CFLAGS" |
| 93 | AC_SUBST(SYMBOL_VISIBILITY) |
| 94 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 95 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 96 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 97 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
| 98 | AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"]) |
| 99 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 100 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 101 | |
Holger Hans Peter Freyther | ecd94a4 | 2010-11-15 18:37:57 +0100 | [diff] [blame] | 102 | # Coverage build taken from WebKit's configure.in |
| 103 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 104 | AC_ARG_ENABLE(coverage, |
| 105 | AC_HELP_STRING([--enable-coverage], |
| 106 | [enable code coverage support [default=no]]), |
| 107 | [],[enable_coverage="no"]) |
| 108 | AC_MSG_RESULT([$enable_coverage]) |
| 109 | if test "$enable_coverage" = "yes"; then |
| 110 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 111 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 112 | AC_SUBST([COVERAGE_CFLAGS]) |
| 113 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 114 | fi |
| 115 | |
Max | 0bd729f | 2017-12-28 14:33:53 +0100 | [diff] [blame] | 116 | AC_ARG_ENABLE(profile, |
| 117 | [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )], |
| 118 | [profile=$enableval], [profile="no"]) |
| 119 | if test x"$profile" = x"yes" |
| 120 | then |
| 121 | CFLAGS="$CFLAGS -pg" |
| 122 | CPPFLAGS="$CPPFLAGS -pg" |
| 123 | fi |
| 124 | |
Pablo Neira Ayuso | 9224010 | 2014-09-01 09:34:07 +0200 | [diff] [blame] | 125 | AC_ARG_ENABLE([external_tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 126 | AC_HELP_STRING([--enable-external-tests], |
| 127 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 128 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 129 | if test "x$enable_ext_tests" = "xyes" ; then |
Pau Espin Pedrol | 7e78681 | 2017-11-24 12:00:35 +0100 | [diff] [blame] | 130 | AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes) |
| 131 | if test "x$PYTHON2_AVAIL" != "xyes" ; then |
| 132 | AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.]) |
| 133 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 134 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 135 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
Neels Hofmeyr | 178d137 | 2017-07-20 23:01:45 +0200 | [diff] [blame] | 136 | 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] | 137 | fi |
| 138 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 139 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 140 | AC_MSG_RESULT([$enable_ext_tests]) |
| 141 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 142 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 143 | dnl Generate the output |
| 144 | AM_CONFIG_HEADER(bscconfig.h) |
| 145 | |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 146 | AC_OUTPUT( |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 147 | include/Makefile |
Neels Hofmeyr | c016479 | 2017-09-04 15:15:32 +0200 | [diff] [blame] | 148 | include/osmocom/Makefile |
| 149 | include/osmocom/bsc/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 150 | src/Makefile |
Harald Welte | 89579b4 | 2011-03-04 13:18:30 +0100 | [diff] [blame] | 151 | src/libbsc/Makefile |
Harald Welte | 89579b4 | 2011-03-04 13:18:30 +0100 | [diff] [blame] | 152 | src/libcommon/Makefile |
Holger Hans Peter Freyther | 4247cea | 2015-04-04 18:42:46 +0200 | [diff] [blame] | 153 | src/libfilter/Makefile |
Neels Hofmeyr | c69ee85 | 2016-05-10 12:50:31 +0200 | [diff] [blame] | 154 | src/libcommon-cs/Makefile |
Harald Welte | 31c00f7 | 2011-03-03 23:29:05 +0100 | [diff] [blame] | 155 | src/osmo-bsc/Makefile |
Harald Welte | 31c00f7 | 2011-03-03 23:29:05 +0100 | [diff] [blame] | 156 | src/ipaccess/Makefile |
| 157 | src/utils/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 158 | tests/Makefile |
Holger Hans Peter Freyther | 93ef33e | 2012-01-09 22:53:04 +0100 | [diff] [blame] | 159 | tests/atlocal |
Holger Freyther | aa0fb36 | 2008-12-28 21:55:40 +0000 | [diff] [blame] | 160 | tests/gsm0408/Makefile |
Holger Hans Peter Freyther | 800d29d | 2009-06-10 12:36:38 +0200 | [diff] [blame] | 161 | tests/channel/Makefile |
Jacob Erlbeck | 946d141 | 2013-09-17 13:59:29 +0200 | [diff] [blame] | 162 | tests/bsc/Makefile |
Holger Hans Peter Freyther | 28e2988 | 2010-06-15 20:21:44 +0800 | [diff] [blame] | 163 | tests/bsc-nat/Makefile |
Holger Hans Peter Freyther | 85d3b34 | 2013-06-14 19:10:28 +0200 | [diff] [blame] | 164 | tests/bsc-nat-trie/Makefile |
Holger Hans Peter Freyther | bce5675 | 2012-11-22 14:59:46 +0100 | [diff] [blame] | 165 | tests/abis/Makefile |
Jacob Erlbeck | 0acc001 | 2014-12-03 13:05:16 +0100 | [diff] [blame] | 166 | tests/subscr/Makefile |
Philipp | b4cb838 | 2016-09-29 17:01:57 +0200 | [diff] [blame] | 167 | tests/nanobts_omlattr/Makefile |
Neels Hofmeyr | 9eb208f | 2017-11-07 03:38:28 +0100 | [diff] [blame] | 168 | tests/bssap/Makefile |
Harald Welte | eb11313 | 2011-05-11 22:11:28 +0200 | [diff] [blame] | 169 | doc/Makefile |
| 170 | doc/examples/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 171 | Makefile) |