blob: a4979cfb914fb4c84aa42c77229bb1e46fe94dd3 [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 +000037
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +020038PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0)
39PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0)
40PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.11.0)
41PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0)
42PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.5.0)
43PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.2.0)
44PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.9.0)
45PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.9.0)
46PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.3.0)
Harald Welte1ea6baf2018-07-31 19:40:52 +020047PKG_CHECK_MODULES(LIBOSMOGSUPCLIENT, libosmo-gsup-client >= 0.2.1)
Harald Weltef98a4972010-02-20 17:29:27 +010048
Neels Hofmeyr7cec3882017-11-17 01:43:36 +010049AC_ARG_ENABLE(sanitize,
50 [AS_HELP_STRING(
51 [--enable-sanitize],
52 [Compile with address sanitizer enabled],
53 )],
54 [sanitize=$enableval], [sanitize="no"])
55if test x"$sanitize" = x"yes"
56then
57 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
58 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
59fi
60
Neels Hofmeyr620ba932018-03-05 20:43:44 +010061AC_ARG_ENABLE(werror,
62 [AS_HELP_STRING(
63 [--enable-werror],
64 [Turn all compiler warnings into errors, with exceptions:
65 a) deprecation (allow upstream to mark deprecation without breaking builds);
66 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
67 ]
68 )],
69 [werror=$enableval], [werror="no"])
70if test x"$werror" = x"yes"
71then
72 WERROR_FLAGS="-Werror"
73 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
74 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
75 CFLAGS="$CFLAGS $WERROR_FLAGS"
76 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
77fi
78
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020079# Enable/disable smpp support in the msc?
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010080AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020081 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010082if test "$osmo_ac_build_smpp" = "yes" ; then
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +020083 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.13.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010084 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
85fi
86AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020087AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010088
Daniel Willmann3af96602016-05-20 21:42:55 +020089# Enable/disable 3G aka IuPS + IuCS support?
90AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
91 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
92if test "x$osmo_ac_iu" = "xyes" ; then
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +020093 PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.30)
94 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.3.0)
Daniel Willmann3af96602016-05-20 21:42:55 +020095 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
96fi
97AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
98AC_SUBST(osmo_ac_iu)
99
Harald Weltede729a12008-12-23 21:01:25 +0000100dnl checks for header files
101AC_HEADER_STDC
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +0100102AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Max7bb383a2017-05-02 12:59:15 +0200103
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +0100104found_sqlite3=yes
105PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
106AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
107AC_SUBST(found_sqlite3)
108
Harald Weltede729a12008-12-23 21:01:25 +0000109
110dnl Checks for typedefs, structures and compiler characteristics
111
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000112# The following test is taken from WebKit's webkit.m4
113saved_CFLAGS="$CFLAGS"
114CFLAGS="$CFLAGS -fvisibility=hidden "
115AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200116AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000117 [ AC_MSG_RESULT([yes])
118 SYMBOL_VISIBILITY="-fvisibility=hidden"],
119 AC_MSG_RESULT([no]))
120CFLAGS="$saved_CFLAGS"
121AC_SUBST(SYMBOL_VISIBILITY)
122
Max34f01262017-01-20 13:03:03 +0100123AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
124AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
125AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
126AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
127AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
128AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
129
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100130# Coverage build taken from WebKit's configure.in
131AC_MSG_CHECKING([whether to enable code coverage support])
132AC_ARG_ENABLE(coverage,
133 AC_HELP_STRING([--enable-coverage],
134 [enable code coverage support [default=no]]),
135 [],[enable_coverage="no"])
136AC_MSG_RESULT([$enable_coverage])
137if test "$enable_coverage" = "yes"; then
138 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
139 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
140 AC_SUBST([COVERAGE_CFLAGS])
141 AC_SUBST([COVERAGE_LDFLAGS])
142fi
143
Harald Welte9c3dc902012-04-08 16:59:24 +0200144AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
145 AC_CACHE_CHECK(
146 [whether struct tm has tm_gmtoff member],
147 osmo_cv_tm_includes_tm_gmtoff,
148 [AC_LINK_IFELSE([
149 AC_LANG_PROGRAM([
150 #include <time.h>
151 ], [
152 time_t t = time(NULL);
153 struct tm* lt = localtime(&t);
154 int off = lt->tm_gmtoff;
155 ])
156 ],
157 osmo_cv_tm_includes_tm_gmtoff=yes,
158 osmo_cv_tm_includes_tm_gmtoff=no
159 )]
160 )
161 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
162 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
163 [Define if struct tm has tm_gmtoff member.])
164 fi
165])
166
167CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000168
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200169AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200170 AC_HELP_STRING([--enable-external-tests],
171 [Include the VTY/CTRL tests in make check [default=no]]),
172 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
173if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200174 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200175 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
176 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr772205a2017-07-20 23:01:45 +0200177 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 +0200178 fi
179fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200180AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
181AC_MSG_RESULT([$enable_ext_tests])
182AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200183
Oliver Smith39093762018-11-14 10:47:01 +0100184# Generate manuals
185AC_ARG_ENABLE(manuals,
186 [AS_HELP_STRING(
187 [--enable-manuals],
188 [Generate manual PDFs [default=no]],
189 )],
190 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
191AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
192AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
193 fallback])
194if test x"$osmo_ac_build_manuals" = x"yes"
195then
196 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
197 if test -n "$OSMO_GSM_MANUALS_DIR"; then
198 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
199 else
200 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
201 if test -n "$OSMO_GSM_MANUALS_DIR"; then
202 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
203 else
204 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
205 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
206 fi
207 fi
208 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
209 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
210 fi
211
212 # Find and run check-depends
213 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
214 if ! test -x "$CHECK_DEPENDS"; then
215 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
216 fi
217 if ! $CHECK_DEPENDS; then
218 AC_MSG_ERROR("missing dependencies for --enable-manuals")
219 fi
220
221 # Put in Makefile with absolute path
222 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
223 AC_SUBST([OSMO_GSM_MANUALS_DIR])
224fi
225
Pau Espin Pedrolf282f332018-09-10 12:55:00 +0200226# https://www.freedesktop.org/software/systemd/man/daemon.html
227AC_ARG_WITH([systemdsystemunitdir],
228 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
229 [with_systemdsystemunitdir=auto])
230AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
231 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
232
233 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
234 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
235 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
236 with_systemdsystemunitdir=no],
237 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
238AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
239 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
240AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
241
Neels Hofmeyr620ba932018-03-05 20:43:44 +0100242AC_MSG_RESULT([CFLAGS="$CFLAGS"])
243AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
244
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000245dnl Generate the output
246AM_CONFIG_HEADER(bscconfig.h)
247
Holger Freyther5f755982008-12-27 09:42:59 +0000248AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000249 include/Makefile
Neels Hofmeyr90843962017-09-04 15:04:35 +0200250 include/osmocom/Makefile
251 include/osmocom/msc/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000252 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100253 src/libmsc/Makefile
Harald Welteb8b85a12016-06-17 00:06:42 +0200254 src/libvlr/Makefile
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200255 src/osmo-msc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100256 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000257 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100258 tests/atlocal
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200259 tests/smpp/Makefile
Harald Welte2483f1b2016-06-19 18:06:02 +0200260 tests/sms_queue/Makefile
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100261 tests/msc_vlr/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200262 doc/Makefile
263 doc/examples/Makefile
Oliver Smith39093762018-11-14 10:47:01 +0100264 doc/manuals/Makefile
Pau Espin Pedrolf282f332018-09-10 12:55:00 +0200265 contrib/Makefile
266 contrib/systemd/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000267 Makefile)