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 | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 65 | # Enable/disable smpp support in the msc? |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 66 | 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] | 67 | [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"]) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 68 | if test "$osmo_ac_build_smpp" = "yes" ; then |
Harald Welte | 2d23e90 | 2017-08-14 19:16:42 +0200 | [diff] [blame] | 69 | PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.12) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 70 | AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP]) |
| 71 | fi |
| 72 | 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] | 73 | AC_SUBST(osmo_ac_build_smpp) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 74 | |
Daniel Willmann | 3af9660 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 75 | # Enable/disable 3G aka IuPS + IuCS support? |
| 76 | AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])], |
| 77 | [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"]) |
| 78 | if test "x$osmo_ac_iu" = "xyes" ; then |
Harald Welte | c44cf84 | 2017-10-28 14:22:57 +0200 | [diff] [blame] | 79 | PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.28) |
| 80 | PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.2.0) |
Daniel Willmann | 3af9660 | 2016-05-20 21:42:55 +0200 | [diff] [blame] | 81 | AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support]) |
| 82 | fi |
| 83 | AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes") |
| 84 | AC_SUBST(osmo_ac_iu) |
| 85 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 86 | dnl checks for header files |
| 87 | AC_HEADER_STDC |
Pablo Neira Ayuso | 5d7ad47 | 2011-03-08 13:38:49 +0100 | [diff] [blame] | 88 | 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] | 89 | |
| 90 | found_pcap=yes |
| 91 | AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no) |
| 92 | AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes) |
Harald Welte | ca17ef8 | 2011-02-05 15:13:27 +0100 | [diff] [blame] | 93 | |
Harald Welte | 7465e4c | 2012-11-13 07:06:54 +0100 | [diff] [blame] | 94 | found_cdk=yes |
| 95 | AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no) |
| 96 | AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes) |
| 97 | |
Holger Hans Peter Freyther | bb06eb9 | 2015-01-10 09:51:31 +0100 | [diff] [blame] | 98 | found_sqlite3=yes |
| 99 | PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no) |
| 100 | AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes) |
| 101 | AC_SUBST(found_sqlite3) |
| 102 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 103 | |
| 104 | dnl Checks for typedefs, structures and compiler characteristics |
| 105 | |
Holger Freyther | 6d9f77a | 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 | db1bd69 | 2011-05-24 15:16:54 +0200 | [diff] [blame] | 110 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Holger Freyther | 6d9f77a | 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 | 34f0126 | 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 | ecd94a4 | 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 | 9c3dc90 | 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 | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 162 | |
Pablo Neira Ayuso | 9224010 | 2014-09-01 09:34:07 +0200 | [diff] [blame] | 163 | AC_ARG_ENABLE([external_tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 164 | AC_HELP_STRING([--enable-external-tests], |
| 165 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 166 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 167 | if test "x$enable_ext_tests" = "xyes" ; then |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 168 | AM_PATH_PYTHON |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 169 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 170 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
Neels Hofmeyr | 772205a | 2017-07-20 23:01:45 +0200 | [diff] [blame] | 171 | 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] | 172 | fi |
| 173 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 174 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 175 | AC_MSG_RESULT([$enable_ext_tests]) |
| 176 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 177 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 178 | dnl Generate the output |
| 179 | AM_CONFIG_HEADER(bscconfig.h) |
| 180 | |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 181 | AC_OUTPUT( |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 182 | include/Makefile |
Neels Hofmeyr | 9084396 | 2017-09-04 15:04:35 +0200 | [diff] [blame] | 183 | include/osmocom/Makefile |
| 184 | include/osmocom/msc/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 185 | src/Makefile |
Harald Welte | 89579b4 | 2011-03-04 13:18:30 +0100 | [diff] [blame] | 186 | src/libmsc/Makefile |
Harald Welte | b8b85a1 | 2016-06-17 00:06:42 +0200 | [diff] [blame] | 187 | src/libvlr/Makefile |
Harald Welte | 89579b4 | 2011-03-04 13:18:30 +0100 | [diff] [blame] | 188 | src/libcommon/Makefile |
Neels Hofmeyr | c69ee85 | 2016-05-10 12:50:31 +0200 | [diff] [blame] | 189 | src/libcommon-cs/Makefile |
Neels Hofmeyr | 84da6b1 | 2016-05-20 21:59:55 +0200 | [diff] [blame] | 190 | src/osmo-msc/Makefile |
Harald Welte | 31c00f7 | 2011-03-03 23:29:05 +0100 | [diff] [blame] | 191 | src/utils/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 | a7328a5 | 2013-07-13 17:09:56 +0200 | [diff] [blame] | 194 | tests/smpp/Makefile |
Harald Welte | 2483f1b | 2016-06-19 18:06:02 +0200 | [diff] [blame] | 195 | tests/sms_queue/Makefile |
Neels Hofmeyr | 6a29d32 | 2017-01-25 15:04:16 +0100 | [diff] [blame] | 196 | tests/msc_vlr/Makefile |
Harald Welte | eb11313 | 2011-05-11 22:11:28 +0200 | [diff] [blame] | 197 | doc/Makefile |
| 198 | doc/examples/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 199 | Makefile) |