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 | 458aa74 | 2017-09-03 23:22:06 +0200 | [diff] [blame] | 2 | AC_INIT([osmo-msc], |
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 | 09e2c9f | 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 | c44cf84 | 2017-10-28 14:22:57 +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) |
Jacob Erlbeck | e827812 | 2014-03-31 13:42:11 +0200 | [diff] [blame] | 46 | PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0) |
Harald Welte | c44cf84 | 2017-10-28 14:22:57 +0200 | [diff] [blame] | 47 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.1.0) |
| 48 | PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.8.0) |
Harald Welte | 6a9d9ba | 2017-10-28 23:49:47 +0200 | [diff] [blame] | 49 | PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp) |
Harald Welte | c44cf84 | 2017-10-28 14:22:57 +0200 | [diff] [blame] | 50 | PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.1.0) |
Alexander Huemer | a55dda7 | 2017-12-02 22:28:52 +0100 | [diff] [blame] | 51 | PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.12.0) |
Harald Welte | f98a497 | 2010-02-20 17:29:27 +0100 | [diff] [blame] | 52 | |
Neels Hofmeyr | 7cec388 | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 53 | AC_ARG_ENABLE(sanitize, |
| 54 | [AS_HELP_STRING( |
| 55 | [--enable-sanitize], |
| 56 | [Compile with address sanitizer enabled], |
| 57 | )], |
| 58 | [sanitize=$enableval], [sanitize="no"]) |
| 59 | if test x"$sanitize" = x"yes" |
| 60 | then |
| 61 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 62 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 63 | fi |
| 64 | |
Neels Hofmeyr | 620ba93 | 2018-03-05 20:43:44 +0100 | [diff] [blame] | 65 | AC_ARG_ENABLE(werror, |
| 66 | [AS_HELP_STRING( |
| 67 | [--enable-werror], |
| 68 | [Turn all compiler warnings into errors, with exceptions: |
| 69 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 70 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 71 | ] |
| 72 | )], |
| 73 | [werror=$enableval], [werror="no"]) |
| 74 | if test x"$werror" = x"yes" |
| 75 | then |
| 76 | WERROR_FLAGS="-Werror" |
| 77 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 78 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 79 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 80 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 81 | fi |
| 82 | |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 83 | # Enable/disable smpp support in the msc? |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 84 | AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])], |
Holger Hans Peter Freyther | a7328a5 | 2013-07-13 17:09:56 +0200 | [diff] [blame] | 85 | [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"]) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 86 | if test "$osmo_ac_build_smpp" = "yes" ; then |
Harald Welte | 2d23e90 | 2017-08-14 19:16:42 +0200 | [diff] [blame] | 87 | PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.12) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 88 | AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP]) |
| 89 | fi |
| 90 | AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes") |
Holger Hans Peter Freyther | a7328a5 | 2013-07-13 17:09:56 +0200 | [diff] [blame] | 91 | AC_SUBST(osmo_ac_build_smpp) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 92 | |
Daniel Willmann | 3af9660 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 93 | # Enable/disable 3G aka IuPS + IuCS support? |
| 94 | AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])], |
| 95 | [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"]) |
| 96 | if test "x$osmo_ac_iu" = "xyes" ; then |
Harald Welte | c44cf84 | 2017-10-28 14:22:57 +0200 | [diff] [blame] | 97 | PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.28) |
| 98 | PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.2.0) |
Daniel Willmann | 3af9660 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 99 | AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support]) |
| 100 | fi |
| 101 | AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes") |
| 102 | AC_SUBST(osmo_ac_iu) |
| 103 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 104 | dnl checks for header files |
| 105 | AC_HEADER_STDC |
Pablo Neira Ayuso | 5d7ad47 | 2011-03-08 13:38:49 +0100 | [diff] [blame] | 106 | AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed)) |
Max | 7bb383a | 2017-05-02 12:59:15 +0200 | [diff] [blame] | 107 | |
| 108 | found_pcap=yes |
| 109 | AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no) |
| 110 | AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes) |
Harald Welte | ca17ef8 | 2011-02-05 15:13:27 +0100 | [diff] [blame] | 111 | |
Harald Welte | 7465e4c | 2012-11-13 07:06:54 +0100 | [diff] [blame] | 112 | found_cdk=yes |
| 113 | AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no) |
| 114 | AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes) |
| 115 | |
Holger Hans Peter Freyther | bb06eb9 | 2015-01-10 09:51:31 +0100 | [diff] [blame] | 116 | found_sqlite3=yes |
| 117 | PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no) |
| 118 | AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes) |
| 119 | AC_SUBST(found_sqlite3) |
| 120 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 121 | |
| 122 | dnl Checks for typedefs, structures and compiler characteristics |
| 123 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 124 | # The following test is taken from WebKit's webkit.m4 |
| 125 | saved_CFLAGS="$CFLAGS" |
| 126 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 127 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Alexander Huemer | db1bd69 | 2011-05-24 15:16:54 +0200 | [diff] [blame] | 128 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 129 | [ AC_MSG_RESULT([yes]) |
| 130 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 131 | AC_MSG_RESULT([no])) |
| 132 | CFLAGS="$saved_CFLAGS" |
| 133 | AC_SUBST(SYMBOL_VISIBILITY) |
| 134 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 135 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 136 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 137 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
| 138 | AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"]) |
| 139 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 140 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 141 | |
Holger Hans Peter Freyther | ecd94a4 | 2010-11-15 18:37:57 +0100 | [diff] [blame] | 142 | # Coverage build taken from WebKit's configure.in |
| 143 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 144 | AC_ARG_ENABLE(coverage, |
| 145 | AC_HELP_STRING([--enable-coverage], |
| 146 | [enable code coverage support [default=no]]), |
| 147 | [],[enable_coverage="no"]) |
| 148 | AC_MSG_RESULT([$enable_coverage]) |
| 149 | if test "$enable_coverage" = "yes"; then |
| 150 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 151 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 152 | AC_SUBST([COVERAGE_CFLAGS]) |
| 153 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 154 | fi |
| 155 | |
Harald Welte | 9c3dc90 | 2012-04-08 16:59:24 +0200 | [diff] [blame] | 156 | AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [ |
| 157 | AC_CACHE_CHECK( |
| 158 | [whether struct tm has tm_gmtoff member], |
| 159 | osmo_cv_tm_includes_tm_gmtoff, |
| 160 | [AC_LINK_IFELSE([ |
| 161 | AC_LANG_PROGRAM([ |
| 162 | #include <time.h> |
| 163 | ], [ |
| 164 | time_t t = time(NULL); |
| 165 | struct tm* lt = localtime(&t); |
| 166 | int off = lt->tm_gmtoff; |
| 167 | ]) |
| 168 | ], |
| 169 | osmo_cv_tm_includes_tm_gmtoff=yes, |
| 170 | osmo_cv_tm_includes_tm_gmtoff=no |
| 171 | )] |
| 172 | ) |
| 173 | if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then |
| 174 | AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1, |
| 175 | [Define if struct tm has tm_gmtoff member.]) |
| 176 | fi |
| 177 | ]) |
| 178 | |
| 179 | CHECK_TM_INCLUDES_TM_GMTOFF |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 180 | |
Pablo Neira Ayuso | 9224010 | 2014-09-01 09:34:07 +0200 | [diff] [blame] | 181 | AC_ARG_ENABLE([external_tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 182 | AC_HELP_STRING([--enable-external-tests], |
| 183 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 184 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 185 | if test "x$enable_ext_tests" = "xyes" ; then |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 186 | AM_PATH_PYTHON |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 187 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 188 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
Neels Hofmeyr | 772205a | 2017-07-20 23:01:45 +0200 | [diff] [blame] | 189 | 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] | 190 | fi |
| 191 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 192 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 193 | AC_MSG_RESULT([$enable_ext_tests]) |
| 194 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 195 | |
Neels Hofmeyr | 620ba93 | 2018-03-05 20:43:44 +0100 | [diff] [blame] | 196 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 197 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 198 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 199 | dnl Generate the output |
| 200 | AM_CONFIG_HEADER(bscconfig.h) |
| 201 | |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 202 | AC_OUTPUT( |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 203 | include/Makefile |
Neels Hofmeyr | 9084396 | 2017-09-04 15:04:35 +0200 | [diff] [blame] | 204 | include/osmocom/Makefile |
| 205 | include/osmocom/msc/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 206 | src/Makefile |
Harald Welte | 89579b4 | 2011-03-04 13:18:30 +0100 | [diff] [blame] | 207 | src/libmsc/Makefile |
Harald Welte | b8b85a1 | 2016-06-17 00:06:42 +0200 | [diff] [blame] | 208 | src/libvlr/Makefile |
Harald Welte | 89579b4 | 2011-03-04 13:18:30 +0100 | [diff] [blame] | 209 | src/libcommon/Makefile |
Neels Hofmeyr | c69ee85 | 2016-05-10 12:50:31 +0200 | [diff] [blame] | 210 | src/libcommon-cs/Makefile |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 211 | src/osmo-msc/Makefile |
Harald Welte | 31c00f7 | 2011-03-03 23:29:05 +0100 | [diff] [blame] | 212 | src/utils/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 213 | tests/Makefile |
Holger Hans Peter Freyther | 93ef33e | 2012-01-09 22:53:04 +0100 | [diff] [blame] | 214 | tests/atlocal |
Holger Hans Peter Freyther | a7328a5 | 2013-07-13 17:09:56 +0200 | [diff] [blame] | 215 | tests/smpp/Makefile |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 216 | tests/sms_queue/Makefile |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 217 | tests/msc_vlr/Makefile |
Harald Welte | eb11313 | 2011-05-11 22:11:28 +0200 | [diff] [blame] | 218 | doc/Makefile |
| 219 | doc/examples/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 220 | Makefile) |