blob: deee84bc28cbaa264e5523f7d01cc922abbc0fa2 [file] [log] [blame]
Harald Weltede729a12008-12-23 21:01:25 +00001dnl Process this file with autoconf to produce a configure script
Neels Hofmeyr458aa742017-09-03 23:22:06 +02002AC_INIT([osmo-msc],
Harald Welte5a29c7f2010-03-23 00:09:32 +08003 m4_esyscmd([./git-version-gen .tarball-version]),
Holger Hans Peter Freyther47d8f022014-05-15 12:26:16 +02004 [openbsc@lists.osmocom.org])
Harald Weltede729a12008-12-23 21:01:25 +00005
Neels Hofmeyrb8103122016-10-01 00:34:31 +02006dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
7AC_CONFIG_AUX_DIR([.])
8
Harald Welte5a29c7f2010-03-23 00:09:32 +08009AM_INIT_AUTOMAKE([dist-bzip2])
Holger Hans Peter Freyther6c882172012-01-06 15:16:12 +010010AC_CONFIG_TESTDIR(tests)
Harald Weltede729a12008-12-23 21:01:25 +000011
Holger Hans Peter Freyther1f59ac42009-10-27 03:34:49 +010012dnl kernel style compile messages
13m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
14
Max09e2c9f2017-08-28 12:04:18 +020015dnl include release helper
16RELMAKE='-include osmo-release.mk'
17AC_SUBST([RELMAKE])
18
Harald Weltede729a12008-12-23 21:01:25 +000019dnl checks for programs
20AC_PROG_MAKE_SET
21AC_PROG_CC
22AC_PROG_INSTALL
Maxeab5f592017-05-26 12:31:00 +020023LT_INIT
Harald Weltede729a12008-12-23 21:01:25 +000024
Neels Hofmeyra8f91df2016-10-01 00:50:25 +020025dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
26AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
27if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
28 AC_MSG_WARN([You need to install pkg-config])
29fi
30PKG_PROG_PKG_CONFIG([0.20])
31
Max34f01262017-01-20 13:03:03 +010032dnl check for AX_CHECK_COMPILE_FLAG
33m4_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 Weltede729a12008-12-23 21:01:25 +000037dnl checks for libraries
Jacob Erlbeck51a869c2013-10-15 12:00:26 +020038AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
39AC_SUBST(LIBRARY_DL)
40
Harald Weltede729a12008-12-23 21:01:25 +000041
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +020042PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0)
43PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0)
44PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.11.0)
45PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0)
46PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.5.0)
47PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.2.0)
48PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.9.0)
49PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.9.0)
50PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.3.0)
51PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.13.0)
Harald Weltef98a4972010-02-20 17:29:27 +010052
Neels Hofmeyr7cec3882017-11-17 01:43:36 +010053AC_ARG_ENABLE(sanitize,
54 [AS_HELP_STRING(
55 [--enable-sanitize],
56 [Compile with address sanitizer enabled],
57 )],
58 [sanitize=$enableval], [sanitize="no"])
59if test x"$sanitize" = x"yes"
60then
61 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
62 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
63fi
64
Neels Hofmeyr620ba932018-03-05 20:43:44 +010065AC_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"])
74if test x"$werror" = x"yes"
75then
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"
81fi
82
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020083# Enable/disable smpp support in the msc?
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010084AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020085 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010086if test "$osmo_ac_build_smpp" = "yes" ; then
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +020087 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.13.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010088 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
89fi
90AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020091AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010092
Daniel Willmann3af96602016-05-20 21:42:55 +020093# Enable/disable 3G aka IuPS + IuCS support?
94AC_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"])
96if test "x$osmo_ac_iu" = "xyes" ; then
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +020097 PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.30)
98 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.3.0)
Daniel Willmann3af96602016-05-20 21:42:55 +020099 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
100fi
101AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
102AC_SUBST(osmo_ac_iu)
103
Harald Weltede729a12008-12-23 21:01:25 +0000104dnl checks for header files
105AC_HEADER_STDC
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +0100106AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Max7bb383a2017-05-02 12:59:15 +0200107
108found_pcap=yes
109AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no)
110AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes)
Harald Welteca17ef82011-02-05 15:13:27 +0100111
Harald Welte7465e4c2012-11-13 07:06:54 +0100112found_cdk=yes
113AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
114AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
115
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +0100116found_sqlite3=yes
117PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
118AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
119AC_SUBST(found_sqlite3)
120
Harald Weltede729a12008-12-23 21:01:25 +0000121
122dnl Checks for typedefs, structures and compiler characteristics
123
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000124# The following test is taken from WebKit's webkit.m4
125saved_CFLAGS="$CFLAGS"
126CFLAGS="$CFLAGS -fvisibility=hidden "
127AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200128AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000129 [ AC_MSG_RESULT([yes])
130 SYMBOL_VISIBILITY="-fvisibility=hidden"],
131 AC_MSG_RESULT([no]))
132CFLAGS="$saved_CFLAGS"
133AC_SUBST(SYMBOL_VISIBILITY)
134
Max34f01262017-01-20 13:03:03 +0100135AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
136AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
137AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
138AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
139AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
140AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
141
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100142# Coverage build taken from WebKit's configure.in
143AC_MSG_CHECKING([whether to enable code coverage support])
144AC_ARG_ENABLE(coverage,
145 AC_HELP_STRING([--enable-coverage],
146 [enable code coverage support [default=no]]),
147 [],[enable_coverage="no"])
148AC_MSG_RESULT([$enable_coverage])
149if 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])
154fi
155
Harald Welte9c3dc902012-04-08 16:59:24 +0200156AC_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
179CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000180
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200181AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200182 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"])
185if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200186 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200187 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
188 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr772205a2017-07-20 23:01:45 +0200189 AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.])
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200190 fi
191fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200192AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
193AC_MSG_RESULT([$enable_ext_tests])
194AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200195
Neels Hofmeyr620ba932018-03-05 20:43:44 +0100196AC_MSG_RESULT([CFLAGS="$CFLAGS"])
197AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
198
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000199dnl Generate the output
200AM_CONFIG_HEADER(bscconfig.h)
201
Holger Freyther5f755982008-12-27 09:42:59 +0000202AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000203 include/Makefile
Neels Hofmeyr90843962017-09-04 15:04:35 +0200204 include/osmocom/Makefile
205 include/osmocom/msc/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000206 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100207 src/libmsc/Makefile
Harald Welteb8b85a12016-06-17 00:06:42 +0200208 src/libvlr/Makefile
Neels Hofmeyr8ea65b32018-03-22 16:15:01 +0100209 src/libgsupclient/Makefile
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200210 src/osmo-msc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100211 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000212 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100213 tests/atlocal
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200214 tests/smpp/Makefile
Harald Welte2483f1b2016-06-19 18:06:02 +0200215 tests/sms_queue/Makefile
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100216 tests/msc_vlr/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200217 doc/Makefile
218 doc/examples/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000219 Makefile)