Harald Welte | 2b944cf | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script |
Neels Hofmeyr | a2ea729 | 2017-09-04 15:17:33 +0200 | [diff] [blame] | 2 | AC_INIT([osmo-sgsn], |
Harald Welte | fa13cad | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 3 | m4_esyscmd([./git-version-gen .tarball-version]), |
Neels Hofmeyr | a2ea729 | 2017-09-04 15:17:33 +0200 | [diff] [blame] | 4 | [osmocom-net-gprs@lists.osmocom.org]) |
Harald Welte | 2b944cf | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 5 | |
Neels Hofmeyr | 7c61f75 | 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 | fa13cad | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 9 | AM_INIT_AUTOMAKE([dist-bzip2]) |
Holger Hans Peter Freyther | fee826b | 2012-01-06 15:16:12 +0100 | [diff] [blame] | 10 | AC_CONFIG_TESTDIR(tests) |
Harald Welte | 2b944cf | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 11 | |
Holger Hans Peter Freyther | c746e68 | 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 | 938cf56 | 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 | 2b944cf | 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 | 72ca134 | 2017-05-26 12:31:00 +0200 | [diff] [blame] | 23 | LT_INIT |
Harald Welte | 2b944cf | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 24 | |
Neels Hofmeyr | edb9ce3 | 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 | 0ff613c | 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 | 2b944cf | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 37 | dnl checks for libraries |
Jacob Erlbeck | 76fa57a | 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 | 2b944cf | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 41 | |
Neels Hofmeyr | 7aef97a | 2016-12-08 21:28:29 +0100 | [diff] [blame] | 42 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) |
Harald Welte | 4d109ff | 2011-05-08 09:41:45 +0200 | [diff] [blame] | 43 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) |
Harald Welte | 4f45c9b | 2014-08-21 15:56:00 +0200 | [diff] [blame] | 44 | PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl) |
Harald Welte | 9fda146 | 2016-05-06 23:28:52 +0200 | [diff] [blame] | 45 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.5) |
Jacob Erlbeck | 1a5c246 | 2014-03-31 13:42:11 +0200 | [diff] [blame] | 46 | PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) |
Holger Hans Peter Freyther | 5b57413 | 2013-10-15 13:29:06 +0200 | [diff] [blame] | 47 | PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4) |
Pablo Neira Ayuso | 4a2f659 | 2014-02-05 18:56:17 +0100 | [diff] [blame] | 48 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) |
Daniel Willmann | 5926596 | 2015-10-08 16:10:23 +0200 | [diff] [blame] | 49 | PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5) |
Jacob Erlbeck | 9fac800 | 2014-03-13 14:25:51 +0100 | [diff] [blame] | 50 | |
Daniel Willmann | 58b03e3 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 51 | # Enable/disable 3G aka IuPS + IuCS support? |
| 52 | AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])], |
| 53 | [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"]) |
| 54 | if test "x$osmo_ac_iu" = "xyes" ; then |
Philipp Maier | d394c6c | 2017-10-19 18:11:02 +0200 | [diff] [blame] | 55 | PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran) # TODO version? |
Daniel Willmann | 58b03e3 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 56 | PKG_CHECK_MODULES(LIBASN1C, libasn1c) # TODO version? |
| 57 | PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap) # TODO version? |
Daniel Willmann | 58b03e3 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 58 | AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support]) |
| 59 | fi |
| 60 | AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes") |
| 61 | AC_SUBST(osmo_ac_iu) |
| 62 | |
Holger Hans Peter Freyther | 61c586c | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 63 | |
Sylvain Munaut | f4b4e8f | 2011-10-18 13:27:00 +0200 | [diff] [blame] | 64 | found_libgtp=yes |
Max | ab65401 | 2017-09-27 15:08:17 +0200 | [diff] [blame] | 65 | PKG_CHECK_MODULES(LIBGTP, libgtp >= 1.0.0, , found_libgtp=no) |
Sylvain Munaut | f4b4e8f | 2011-10-18 13:27:00 +0200 | [diff] [blame] | 66 | AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes) |
Holger Hans Peter Freyther | 232f621 | 2014-09-30 09:10:25 +0200 | [diff] [blame] | 67 | AC_SUBST(found_libgtp) |
Sylvain Munaut | f4b4e8f | 2011-10-18 13:27:00 +0200 | [diff] [blame] | 68 | |
Holger Hans Peter Freyther | 180027c | 2015-05-25 01:21:50 +0800 | [diff] [blame] | 69 | found_libcares=yes |
| 70 | PKG_CHECK_MODULES([LIBCARES], [libcares], [], [found_libcares=no]) |
| 71 | AM_CONDITIONAL(HAVE_LIBCARES, test "$found_libcares" = yes) |
| 72 | AC_SUBST(found_libcares) |
| 73 | |
Neels Hofmeyr | 5c8090e | 2015-11-29 19:14:58 +0100 | [diff] [blame] | 74 | found_libgtp_and_libcares=no |
| 75 | if test "$found_libgtp" = "yes" -a "$found_libcares" = "yes"; then |
| 76 | found_libgtp_and_libcares=yes |
| 77 | fi |
| 78 | AC_SUBST(found_libgtp_and_libcares) |
| 79 | |
Harald Welte | 2b944cf | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 80 | dnl checks for header files |
| 81 | AC_HEADER_STDC |
Max | 24ca918 | 2017-05-02 12:59:15 +0200 | [diff] [blame] | 82 | |
| 83 | found_pcap=yes |
| 84 | AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no) |
| 85 | AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes) |
Harald Welte | c7841cc | 2011-02-05 15:13:27 +0100 | [diff] [blame] | 86 | |
Harald Welte | ec83de5 | 2012-11-13 07:06:54 +0100 | [diff] [blame] | 87 | found_cdk=yes |
| 88 | AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no) |
| 89 | AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes) |
| 90 | |
Harald Welte | 2b944cf | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 91 | |
| 92 | dnl Checks for typedefs, structures and compiler characteristics |
| 93 | |
Neels Hofmeyr | 4984c49 | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 94 | AC_ARG_ENABLE(sanitize, |
| 95 | [AS_HELP_STRING( |
| 96 | [--enable-sanitize], |
| 97 | [Compile with address sanitizer enabled], |
| 98 | )], |
| 99 | [sanitize=$enableval], [sanitize="no"]) |
| 100 | if test x"$sanitize" = x"yes" |
| 101 | then |
| 102 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 103 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 104 | fi |
| 105 | |
Holger Freyther | 64026e9 | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 106 | # The following test is taken from WebKit's webkit.m4 |
| 107 | saved_CFLAGS="$CFLAGS" |
| 108 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 109 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Alexander Huemer | 93ae2d6 | 2011-05-24 15:16:54 +0200 | [diff] [blame] | 110 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Holger Freyther | 64026e9 | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 111 | [ AC_MSG_RESULT([yes]) |
| 112 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 113 | AC_MSG_RESULT([no])) |
| 114 | CFLAGS="$saved_CFLAGS" |
| 115 | AC_SUBST(SYMBOL_VISIBILITY) |
| 116 | |
Max | 0ff613c | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 117 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 118 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 119 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
| 120 | AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"]) |
| 121 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 122 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 123 | |
Holger Hans Peter Freyther | 16bdb14 | 2010-11-15 18:37:57 +0100 | [diff] [blame] | 124 | # Coverage build taken from WebKit's configure.in |
| 125 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 126 | AC_ARG_ENABLE(coverage, |
| 127 | AC_HELP_STRING([--enable-coverage], |
| 128 | [enable code coverage support [default=no]]), |
| 129 | [],[enable_coverage="no"]) |
| 130 | AC_MSG_RESULT([$enable_coverage]) |
| 131 | if test "$enable_coverage" = "yes"; then |
| 132 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 133 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 134 | AC_SUBST([COVERAGE_CFLAGS]) |
| 135 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 136 | fi |
| 137 | |
Harald Welte | eaf4a52 | 2012-04-08 16:59:24 +0200 | [diff] [blame] | 138 | AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [ |
| 139 | AC_CACHE_CHECK( |
| 140 | [whether struct tm has tm_gmtoff member], |
| 141 | osmo_cv_tm_includes_tm_gmtoff, |
| 142 | [AC_LINK_IFELSE([ |
| 143 | AC_LANG_PROGRAM([ |
| 144 | #include <time.h> |
| 145 | ], [ |
| 146 | time_t t = time(NULL); |
| 147 | struct tm* lt = localtime(&t); |
| 148 | int off = lt->tm_gmtoff; |
| 149 | ]) |
| 150 | ], |
| 151 | osmo_cv_tm_includes_tm_gmtoff=yes, |
| 152 | osmo_cv_tm_includes_tm_gmtoff=no |
| 153 | )] |
| 154 | ) |
| 155 | if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then |
| 156 | AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1, |
| 157 | [Define if struct tm has tm_gmtoff member.]) |
| 158 | fi |
| 159 | ]) |
| 160 | |
| 161 | CHECK_TM_INCLUDES_TM_GMTOFF |
Holger Freyther | 64026e9 | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 162 | |
Katerina Barone-Adesi | ad5fb00 | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 163 | AC_ARG_ENABLE([vty_tests], |
| 164 | AC_HELP_STRING([--enable-vty-tests], |
Holger Hans Peter Freyther | 8fa08b0 | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 165 | [Include the VTY/CTRL tests in make check (deprecated) |
| 166 | [default=no]]), |
| 167 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
Pablo Neira Ayuso | 7194f63 | 2014-09-01 09:34:07 +0200 | [diff] [blame] | 168 | AC_ARG_ENABLE([external_tests], |
Holger Hans Peter Freyther | 8fa08b0 | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 169 | AC_HELP_STRING([--enable-external-tests], |
| 170 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 171 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 172 | if test "x$enable_ext_tests" = "xyes" ; then |
Pau Espin Pedrol | 266b61a | 2017-11-28 20:08:17 +0100 | [diff] [blame] | 173 | AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes) |
| 174 | if test "x$PYTHON2_AVAIL" != "xyes" ; then |
| 175 | AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.]) |
| 176 | fi |
Holger Hans Peter Freyther | 8fa08b0 | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 177 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 178 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
Neels Hofmeyr | 684caa4 | 2017-07-20 23:01:45 +0200 | [diff] [blame] | 179 | AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.]) |
Katerina Barone-Adesi | ad5fb00 | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 180 | fi |
| 181 | fi |
Holger Hans Peter Freyther | 8fa08b0 | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 182 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 183 | AC_MSG_RESULT([$enable_ext_tests]) |
| 184 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Katerina Barone-Adesi | ad5fb00 | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 185 | |
Holger Freyther | 64026e9 | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 186 | dnl Generate the output |
| 187 | AM_CONFIG_HEADER(bscconfig.h) |
| 188 | |
Holger Freyther | 1bad601 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 189 | AC_OUTPUT( |
Neels Hofmeyr | a759e3a | 2017-09-04 15:25:43 +0200 | [diff] [blame] | 190 | osmo-sgsn.pc |
Holger Freyther | 1bad601 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 191 | include/Makefile |
Neels Hofmeyr | 4b4c586 | 2017-09-04 15:13:25 +0200 | [diff] [blame] | 192 | include/osmocom/Makefile |
| 193 | include/osmocom/sgsn/Makefile |
Holger Freyther | 1bad601 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 194 | src/Makefile |
Harald Welte | 4f272cc | 2011-03-03 23:29:05 +0100 | [diff] [blame] | 195 | src/gprs/Makefile |
Holger Freyther | 1bad601 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 196 | tests/Makefile |
Holger Hans Peter Freyther | 34abf21 | 2012-01-09 22:53:04 +0100 | [diff] [blame] | 197 | tests/atlocal |
Holger Hans Peter Freyther | 6721a08 | 2011-06-23 17:53:27 -0400 | [diff] [blame] | 198 | tests/gprs/Makefile |
Jacob Erlbeck | 76fa57a | 2013-10-15 12:00:26 +0200 | [diff] [blame] | 199 | tests/gbproxy/Makefile |
Holger Hans Peter Freyther | 232f621 | 2014-09-30 09:10:25 +0200 | [diff] [blame] | 200 | tests/sgsn/Makefile |
Neels Hofmeyr | 2989ff8 | 2015-10-12 11:57:35 +0200 | [diff] [blame] | 201 | tests/oap/Makefile |
Neels Hofmeyr | 9f79664 | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 202 | tests/gtphub/Makefile |
Philipp | fcb979a | 2016-08-10 12:14:57 +0200 | [diff] [blame] | 203 | tests/xid/Makefile |
Philipp | 59971b8 | 2016-08-10 12:08:03 +0200 | [diff] [blame] | 204 | tests/sndcp_xid/Makefile |
Philipp | 4948209 | 2016-08-26 16:58:41 +0200 | [diff] [blame] | 205 | tests/slhc/Makefile |
Philipp | 8a3fe60 | 2016-09-02 13:32:38 +0200 | [diff] [blame] | 206 | tests/v42bis/Makefile |
Harald Welte | 2d6f49d | 2011-05-11 22:11:28 +0200 | [diff] [blame] | 207 | doc/Makefile |
| 208 | doc/examples/Makefile |
Neels Hofmeyr | 69cf461 | 2017-07-20 17:57:37 +0200 | [diff] [blame] | 209 | contrib/Makefile |
Holger Freyther | 1bad601 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 210 | Makefile) |