blob: 41e51dad6220bf9daf402197168abc1d671c1c01 [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
Oliver Smith09dac132021-01-27 17:51:49 +010012CFLAGS="$CFLAGS -std=gnu11"
13
Holger Hans Peter Freyther1f59ac42009-10-27 03:34:49 +010014dnl kernel style compile messages
15m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
16
Max09e2c9f2017-08-28 12:04:18 +020017dnl include release helper
18RELMAKE='-include osmo-release.mk'
19AC_SUBST([RELMAKE])
20
Harald Weltede729a12008-12-23 21:01:25 +000021dnl checks for programs
22AC_PROG_MAKE_SET
23AC_PROG_CC
24AC_PROG_INSTALL
Maxeab5f592017-05-26 12:31:00 +020025LT_INIT
Harald Weltede729a12008-12-23 21:01:25 +000026
Pau Espin Pedrold54e07f2020-08-18 13:31:06 +020027dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
Ericb73ecbf2020-04-11 01:19:12 +020028AS_CASE(["$LD"],[*clang*],
29 [AS_CASE(["${host_os}"],
30 [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
31
Neels Hofmeyra8f91df2016-10-01 00:50:25 +020032dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
33AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
34if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
35 AC_MSG_WARN([You need to install pkg-config])
36fi
37PKG_PROG_PKG_CONFIG([0.20])
38
Harald Welte467fc572022-05-13 19:48:08 +020039PKG_CHECK_MODULES(LIBSQLITE3, sqlite3)
Pau Espin Pedrol5b06a8d2022-06-29 11:32:11 +020040PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.7.0)
41PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.7.0)
42PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.7.0)
43PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.7.0)
44PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.3.0)
45PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.2.0)
46PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.6.0)
47PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 1.6.0)
48PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.10.0)
49PKG_CHECK_MODULES(LIBOSMOGSUPCLIENT, libosmo-gsup-client >= 1.5.0)
Harald Weltef98a4972010-02-20 17:29:27 +010050
Harald Weltee6f11602022-05-17 18:25:14 +020051AC_CHECK_FUNC([timegm], [AC_DEFINE(HAVE_TIMEGM, 1, Define if libc implements timegm)])
52
Harald Welte84528502019-02-06 17:11:25 +010053old_LIBS=$LIBS
54AC_SEARCH_LIBS([sctp_send], [sctp], [
55 AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support])
56 AC_SUBST(HAVE_LIBSCTP, [1])
57 if test -n "$ac_lib"; then
58 AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib])
59 fi
60 ], [
61 AC_MSG_ERROR([sctp_send not found in searched libs])])
62LIBS=$old_LIBS
63
Neels Hofmeyr7cec3882017-11-17 01:43:36 +010064AC_ARG_ENABLE(sanitize,
65 [AS_HELP_STRING(
66 [--enable-sanitize],
67 [Compile with address sanitizer enabled],
68 )],
69 [sanitize=$enableval], [sanitize="no"])
70if test x"$sanitize" = x"yes"
71then
72 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
73 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
74fi
75
Neels Hofmeyr620ba932018-03-05 20:43:44 +010076AC_ARG_ENABLE(werror,
77 [AS_HELP_STRING(
78 [--enable-werror],
79 [Turn all compiler warnings into errors, with exceptions:
80 a) deprecation (allow upstream to mark deprecation without breaking builds);
81 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
82 ]
83 )],
84 [werror=$enableval], [werror="no"])
85if test x"$werror" = x"yes"
86then
87 WERROR_FLAGS="-Werror"
88 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
89 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
90 CFLAGS="$CFLAGS $WERROR_FLAGS"
91 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
92fi
93
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020094# Enable/disable smpp support in the msc?
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010095AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020096 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010097if test "$osmo_ac_build_smpp" = "yes" ; then
Pau Espin Pedrolb0504632019-08-08 15:49:52 +020098 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.14.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010099 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
100fi
101AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200102AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +0100103
Daniel Willmann3af96602016-05-20 21:42:55 +0200104# Enable/disable 3G aka IuPS + IuCS support?
105AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
106 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
107if test "x$osmo_ac_iu" = "xyes" ; then
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +0200108 PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.30)
Pau Espin Pedrol5b06a8d2022-06-29 11:32:11 +0200109 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 1.3.0)
Daniel Willmann3af96602016-05-20 21:42:55 +0200110 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
111fi
112AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
113AC_SUBST(osmo_ac_iu)
114
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100115# Coverage build taken from WebKit's configure.in
116AC_MSG_CHECKING([whether to enable code coverage support])
117AC_ARG_ENABLE(coverage,
118 AC_HELP_STRING([--enable-coverage],
119 [enable code coverage support [default=no]]),
120 [],[enable_coverage="no"])
121AC_MSG_RESULT([$enable_coverage])
122if test "$enable_coverage" = "yes"; then
123 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
124 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
125 AC_SUBST([COVERAGE_CFLAGS])
126 AC_SUBST([COVERAGE_LDFLAGS])
127fi
128
Harald Welte9c3dc902012-04-08 16:59:24 +0200129AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
130 AC_CACHE_CHECK(
131 [whether struct tm has tm_gmtoff member],
132 osmo_cv_tm_includes_tm_gmtoff,
133 [AC_LINK_IFELSE([
134 AC_LANG_PROGRAM([
135 #include <time.h>
136 ], [
137 time_t t = time(NULL);
138 struct tm* lt = localtime(&t);
139 int off = lt->tm_gmtoff;
140 ])
141 ],
142 osmo_cv_tm_includes_tm_gmtoff=yes,
143 osmo_cv_tm_includes_tm_gmtoff=no
144 )]
145 )
146 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
147 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
148 [Define if struct tm has tm_gmtoff member.])
149 fi
150])
151
152CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000153
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200154AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200155 AC_HELP_STRING([--enable-external-tests],
156 [Include the VTY/CTRL tests in make check [default=no]]),
157 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
158if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200159 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200160 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
161 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Harald Welte3b13edf2022-06-18 12:20:11 +0200162 AC_MSG_ERROR([Please install https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests to run the VTY/CTRL tests.])
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200163 fi
164fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200165AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
166AC_MSG_RESULT([$enable_ext_tests])
167AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200168
Oliver Smith39093762018-11-14 10:47:01 +0100169# Generate manuals
170AC_ARG_ENABLE(manuals,
171 [AS_HELP_STRING(
172 [--enable-manuals],
173 [Generate manual PDFs [default=no]],
174 )],
175 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
176AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
177AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
178 fallback])
179if test x"$osmo_ac_build_manuals" = x"yes"
180then
181 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
182 if test -n "$OSMO_GSM_MANUALS_DIR"; then
183 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
184 else
185 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
186 if test -n "$OSMO_GSM_MANUALS_DIR"; then
187 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
188 else
189 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
190 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
191 fi
192 fi
193 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
194 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
195 fi
196
197 # Find and run check-depends
198 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
199 if ! test -x "$CHECK_DEPENDS"; then
200 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
201 fi
202 if ! $CHECK_DEPENDS; then
203 AC_MSG_ERROR("missing dependencies for --enable-manuals")
204 fi
205
206 # Put in Makefile with absolute path
207 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
208 AC_SUBST([OSMO_GSM_MANUALS_DIR])
209fi
210
Pau Espin Pedrolf282f332018-09-10 12:55:00 +0200211# https://www.freedesktop.org/software/systemd/man/daemon.html
212AC_ARG_WITH([systemdsystemunitdir],
213 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
214 [with_systemdsystemunitdir=auto])
215AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
216 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
217
218 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
219 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
220 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
221 with_systemdsystemunitdir=no],
222 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
223AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
224 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
225AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
226
Neels Hofmeyr620ba932018-03-05 20:43:44 +0100227AC_MSG_RESULT([CFLAGS="$CFLAGS"])
228AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
229
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000230dnl Generate the output
Neels Hofmeyr4ac80092019-03-04 02:46:37 +0100231AM_CONFIG_HEADER(config.h)
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000232
Holger Freyther5f755982008-12-27 09:42:59 +0000233AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000234 include/Makefile
Neels Hofmeyr90843962017-09-04 15:04:35 +0200235 include/osmocom/Makefile
236 include/osmocom/msc/Makefile
Max5346f692022-07-28 14:19:22 +0700237 include/osmocom/smpp/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000238 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100239 src/libmsc/Makefile
Harald Welteb8b85a12016-06-17 00:06:42 +0200240 src/libvlr/Makefile
Max5346f692022-07-28 14:19:22 +0700241 src/libsmpputil/Makefile
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200242 src/osmo-msc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100243 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000244 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100245 tests/atlocal
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200246 tests/smpp/Makefile
Vadim Yanitskiye1e72472019-04-09 16:55:44 +0700247 tests/db_sms/Makefile
Harald Welte2483f1b2016-06-19 18:06:02 +0200248 tests/sms_queue/Makefile
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100249 tests/msc_vlr/Makefile
Neels Hofmeyreef45782019-10-21 03:24:04 +0200250 tests/sdp_msg/Makefile
Neels Hofmeyrb4552052019-10-21 03:00:26 +0200251 tests/mncc/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200252 doc/Makefile
253 doc/examples/Makefile
Oliver Smith39093762018-11-14 10:47:01 +0100254 doc/manuals/Makefile
Neels Hofmeyrc4628a32018-12-07 14:47:34 +0100255 doc/sequence_charts/Makefile
Pau Espin Pedrolf282f332018-09-10 12:55:00 +0200256 contrib/Makefile
257 contrib/systemd/Makefile
Oliver Smith03145932020-05-14 11:49:00 +0200258 contrib/osmo-msc.spec
Holger Freyther5f755982008-12-27 09:42:59 +0000259 Makefile)