Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script |
Neels Hofmeyr | 6ebf4a4 | 2017-09-04 15:17:33 +0200 | [diff] [blame] | 2 | AC_INIT([osmo-sgsn], |
Harald Welte | 5a29c7f | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 3 | m4_esyscmd([./git-version-gen .tarball-version]), |
Neels Hofmeyr | 6ebf4a4 | 2017-09-04 15:17:33 +0200 | [diff] [blame] | 4 | [osmocom-net-gprs@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 | 868dd5d | 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 | 39c67e2 | 2018-05-03 19:01:44 +0200 | [diff] [blame] | 42 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0) |
| 43 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0) |
| 44 | PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.11.0) |
| 45 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0) |
| 46 | PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.5.0) |
| 47 | PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.11.0) |
| 48 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.2.0) |
Jacob Erlbeck | 239a853 | 2014-03-13 14:25:51 +0100 | [diff] [blame] | 49 | |
Daniel Willmann | 3af9660 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 50 | # Enable/disable 3G aka IuPS + IuCS support? |
| 51 | AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])], |
| 52 | [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"]) |
| 53 | if test "x$osmo_ac_iu" = "xyes" ; then |
Pau Espin Pedrol | 39c67e2 | 2018-05-03 19:01:44 +0200 | [diff] [blame] | 54 | PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.9.0) |
| 55 | PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.30) |
| 56 | PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.3.0) |
Daniel Willmann | 3af9660 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 57 | AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support]) |
| 58 | fi |
| 59 | AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes") |
| 60 | AC_SUBST(osmo_ac_iu) |
| 61 | |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 62 | |
Pau Espin Pedrol | 39c67e2 | 2018-05-03 19:01:44 +0200 | [diff] [blame] | 63 | PKG_CHECK_MODULES(LIBGTP, libgtp >= 1.2.0) |
Alexander Couzens | d9a54af | 2018-01-30 15:59:40 +0100 | [diff] [blame] | 64 | PKG_CHECK_MODULES(LIBCARES, libcares) |
Neels Hofmeyr | 8defadb | 2015-11-29 19:14:58 +0100 | [diff] [blame] | 65 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 66 | dnl checks for header files |
| 67 | AC_HEADER_STDC |
Max | 7bb383a | 2017-05-02 12:59:15 +0200 | [diff] [blame] | 68 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 69 | dnl Checks for typedefs, structures and compiler characteristics |
| 70 | |
Neels Hofmeyr | d1c232e | 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 | 5926e84 | 2018-03-05 20:44:29 +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 | |
Pau Espin Pedrol | 54e4849 | 2018-01-07 18:24:34 +0100 | [diff] [blame] | 112 | CPPFLAGS="$CPPFLAGS -Wall" |
| 113 | CFLAGS="$CFLAGS -Wall" |
| 114 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 115 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 116 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 117 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
| 118 | AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"]) |
| 119 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 120 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 121 | |
Holger Hans Peter Freyther | ecd94a4 | 2010-11-15 18:37:57 +0100 | [diff] [blame] | 122 | # Coverage build taken from WebKit's configure.in |
| 123 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 124 | AC_ARG_ENABLE(coverage, |
| 125 | AC_HELP_STRING([--enable-coverage], |
| 126 | [enable code coverage support [default=no]]), |
| 127 | [],[enable_coverage="no"]) |
| 128 | AC_MSG_RESULT([$enable_coverage]) |
| 129 | if test "$enable_coverage" = "yes"; then |
| 130 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 131 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 132 | AC_SUBST([COVERAGE_CFLAGS]) |
| 133 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 134 | fi |
| 135 | |
Harald Welte | 9c3dc90 | 2012-04-08 16:59:24 +0200 | [diff] [blame] | 136 | AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [ |
| 137 | AC_CACHE_CHECK( |
| 138 | [whether struct tm has tm_gmtoff member], |
| 139 | osmo_cv_tm_includes_tm_gmtoff, |
| 140 | [AC_LINK_IFELSE([ |
| 141 | AC_LANG_PROGRAM([ |
| 142 | #include <time.h> |
| 143 | ], [ |
| 144 | time_t t = time(NULL); |
| 145 | struct tm* lt = localtime(&t); |
| 146 | int off = lt->tm_gmtoff; |
| 147 | ]) |
| 148 | ], |
| 149 | osmo_cv_tm_includes_tm_gmtoff=yes, |
| 150 | osmo_cv_tm_includes_tm_gmtoff=no |
| 151 | )] |
| 152 | ) |
| 153 | if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then |
| 154 | AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1, |
| 155 | [Define if struct tm has tm_gmtoff member.]) |
| 156 | fi |
| 157 | ]) |
| 158 | |
| 159 | CHECK_TM_INCLUDES_TM_GMTOFF |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 160 | |
Pablo Neira Ayuso | 9224010 | 2014-09-01 09:34:07 +0200 | [diff] [blame] | 161 | AC_ARG_ENABLE([external_tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 162 | AC_HELP_STRING([--enable-external-tests], |
| 163 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 164 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 165 | if test "x$enable_ext_tests" = "xyes" ; then |
Pau Espin Pedrol | 2f89547 | 2017-11-28 20:08:17 +0100 | [diff] [blame] | 166 | AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes) |
| 167 | if test "x$PYTHON2_AVAIL" != "xyes" ; then |
| 168 | AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.]) |
| 169 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 170 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 171 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
Neels Hofmeyr | 7a921fc | 2017-07-20 23:01:45 +0200 | [diff] [blame] | 172 | 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] | 173 | fi |
| 174 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 175 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 176 | AC_MSG_RESULT([$enable_ext_tests]) |
| 177 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 178 | |
Neels Hofmeyr | 5926e84 | 2018-03-05 20:44:29 +0100 | [diff] [blame] | 179 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 180 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 181 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 182 | dnl Generate the output |
| 183 | AM_CONFIG_HEADER(bscconfig.h) |
| 184 | |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 185 | AC_OUTPUT( |
Neels Hofmeyr | 2c17747 | 2017-09-04 15:25:43 +0200 | [diff] [blame] | 186 | osmo-sgsn.pc |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 187 | include/Makefile |
Neels Hofmeyr | 396f2e6 | 2017-09-04 15:13:25 +0200 | [diff] [blame] | 188 | include/osmocom/Makefile |
| 189 | include/osmocom/sgsn/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 190 | src/Makefile |
Harald Welte | 31c00f7 | 2011-03-03 23:29:05 +0100 | [diff] [blame] | 191 | src/gprs/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 192 | tests/Makefile |
Holger Hans Peter Freyther | 93ef33e | 2012-01-09 22:53:04 +0100 | [diff] [blame] | 193 | tests/atlocal |
Holger Hans Peter Freyther | faf1f64 | 2011-06-23 17:53:27 -0400 | [diff] [blame] | 194 | tests/gprs/Makefile |
Jacob Erlbeck | 51a869c | 2013-10-15 12:00:26 +0200 | [diff] [blame] | 195 | tests/gbproxy/Makefile |
Holger Hans Peter Freyther | 68c6f88 | 2014-09-30 09:10:25 +0200 | [diff] [blame] | 196 | tests/sgsn/Makefile |
Neels Hofmeyr | c8a614d | 2015-09-24 17:32:30 +0200 | [diff] [blame] | 197 | tests/gtphub/Makefile |
Philipp | a536fc6 | 2016-08-10 12:14:57 +0200 | [diff] [blame] | 198 | tests/xid/Makefile |
Philipp | 22611be | 2016-08-10 12:08:03 +0200 | [diff] [blame] | 199 | tests/sndcp_xid/Makefile |
Philipp | 2c7f837 | 2016-08-26 16:58:41 +0200 | [diff] [blame] | 200 | tests/slhc/Makefile |
Philipp | d8b4577 | 2016-09-02 13:32:38 +0200 | [diff] [blame] | 201 | tests/v42bis/Makefile |
Harald Welte | eb11313 | 2011-05-11 22:11:28 +0200 | [diff] [blame] | 202 | doc/Makefile |
| 203 | doc/examples/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 204 | Makefile) |