blob: 3395ecc0d06136db28b2fd892703791d1a9a55f4 [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
Pau Espin Pedrolb7f97ea2021-11-16 17:44:54 +010039PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.6.0)
40PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.6.0)
41PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.6.0)
42PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.6.0)
43PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.2.0)
Pau Espin Pedrol59764b62021-02-23 20:22:34 +010044PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.1.0)
Pau Espin Pedrolb7f97ea2021-11-16 17:44:54 +010045PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.5.0)
46PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 1.5.0)
47PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.9.0)
48PKG_CHECK_MODULES(LIBOSMOGSUPCLIENT, libosmo-gsup-client >= 1.4.0)
Harald Weltef98a4972010-02-20 17:29:27 +010049
Harald Welte84528502019-02-06 17:11:25 +010050old_LIBS=$LIBS
51AC_SEARCH_LIBS([sctp_send], [sctp], [
52 AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support])
53 AC_SUBST(HAVE_LIBSCTP, [1])
54 if test -n "$ac_lib"; then
55 AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib])
56 fi
57 ], [
58 AC_MSG_ERROR([sctp_send not found in searched libs])])
59LIBS=$old_LIBS
60
Neels Hofmeyr7cec3882017-11-17 01:43:36 +010061AC_ARG_ENABLE(sanitize,
62 [AS_HELP_STRING(
63 [--enable-sanitize],
64 [Compile with address sanitizer enabled],
65 )],
66 [sanitize=$enableval], [sanitize="no"])
67if test x"$sanitize" = x"yes"
68then
69 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
70 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
71fi
72
Neels Hofmeyr620ba932018-03-05 20:43:44 +010073AC_ARG_ENABLE(werror,
74 [AS_HELP_STRING(
75 [--enable-werror],
76 [Turn all compiler warnings into errors, with exceptions:
77 a) deprecation (allow upstream to mark deprecation without breaking builds);
78 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
79 ]
80 )],
81 [werror=$enableval], [werror="no"])
82if test x"$werror" = x"yes"
83then
84 WERROR_FLAGS="-Werror"
85 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
86 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
87 CFLAGS="$CFLAGS $WERROR_FLAGS"
88 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
89fi
90
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020091# Enable/disable smpp support in the msc?
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010092AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020093 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010094if test "$osmo_ac_build_smpp" = "yes" ; then
Pau Espin Pedrolb0504632019-08-08 15:49:52 +020095 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.14.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010096 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
97fi
98AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020099AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +0100100
Daniel Willmann3af96602016-05-20 21:42:55 +0200101# Enable/disable 3G aka IuPS + IuCS support?
102AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
103 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
104if test "x$osmo_ac_iu" = "xyes" ; then
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +0200105 PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.30)
Pau Espin Pedrolb7f97ea2021-11-16 17:44:54 +0100106 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.8.0)
Daniel Willmann3af96602016-05-20 21:42:55 +0200107 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
108fi
109AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
110AC_SUBST(osmo_ac_iu)
111
Harald Weltede729a12008-12-23 21:01:25 +0000112dnl checks for header files
113AC_HEADER_STDC
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +0100114AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Max7bb383a2017-05-02 12:59:15 +0200115
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100116# Coverage build taken from WebKit's configure.in
117AC_MSG_CHECKING([whether to enable code coverage support])
118AC_ARG_ENABLE(coverage,
119 AC_HELP_STRING([--enable-coverage],
120 [enable code coverage support [default=no]]),
121 [],[enable_coverage="no"])
122AC_MSG_RESULT([$enable_coverage])
123if test "$enable_coverage" = "yes"; then
124 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
125 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
126 AC_SUBST([COVERAGE_CFLAGS])
127 AC_SUBST([COVERAGE_LDFLAGS])
128fi
129
Harald Welte9c3dc902012-04-08 16:59:24 +0200130AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
131 AC_CACHE_CHECK(
132 [whether struct tm has tm_gmtoff member],
133 osmo_cv_tm_includes_tm_gmtoff,
134 [AC_LINK_IFELSE([
135 AC_LANG_PROGRAM([
136 #include <time.h>
137 ], [
138 time_t t = time(NULL);
139 struct tm* lt = localtime(&t);
140 int off = lt->tm_gmtoff;
141 ])
142 ],
143 osmo_cv_tm_includes_tm_gmtoff=yes,
144 osmo_cv_tm_includes_tm_gmtoff=no
145 )]
146 )
147 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
148 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
149 [Define if struct tm has tm_gmtoff member.])
150 fi
151])
152
153CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000154
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200155AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200156 AC_HELP_STRING([--enable-external-tests],
157 [Include the VTY/CTRL tests in make check [default=no]]),
158 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
159if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200160 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200161 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
162 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr772205a2017-07-20 23:01:45 +0200163 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 +0200164 fi
165fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200166AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
167AC_MSG_RESULT([$enable_ext_tests])
168AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200169
Oliver Smith39093762018-11-14 10:47:01 +0100170# Generate manuals
171AC_ARG_ENABLE(manuals,
172 [AS_HELP_STRING(
173 [--enable-manuals],
174 [Generate manual PDFs [default=no]],
175 )],
176 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
177AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
178AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
179 fallback])
180if test x"$osmo_ac_build_manuals" = x"yes"
181then
182 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
183 if test -n "$OSMO_GSM_MANUALS_DIR"; then
184 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
185 else
186 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
187 if test -n "$OSMO_GSM_MANUALS_DIR"; then
188 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
189 else
190 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
191 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
192 fi
193 fi
194 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
195 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
196 fi
197
198 # Find and run check-depends
199 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
200 if ! test -x "$CHECK_DEPENDS"; then
201 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
202 fi
203 if ! $CHECK_DEPENDS; then
204 AC_MSG_ERROR("missing dependencies for --enable-manuals")
205 fi
206
207 # Put in Makefile with absolute path
208 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
209 AC_SUBST([OSMO_GSM_MANUALS_DIR])
210fi
211
Pau Espin Pedrolf282f332018-09-10 12:55:00 +0200212# https://www.freedesktop.org/software/systemd/man/daemon.html
213AC_ARG_WITH([systemdsystemunitdir],
214 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
215 [with_systemdsystemunitdir=auto])
216AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
217 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
218
219 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
220 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
221 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
222 with_systemdsystemunitdir=no],
223 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
224AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
225 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
226AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
227
Neels Hofmeyr620ba932018-03-05 20:43:44 +0100228AC_MSG_RESULT([CFLAGS="$CFLAGS"])
229AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
230
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000231dnl Generate the output
Neels Hofmeyr4ac80092019-03-04 02:46:37 +0100232AM_CONFIG_HEADER(config.h)
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000233
Holger Freyther5f755982008-12-27 09:42:59 +0000234AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000235 include/Makefile
Neels Hofmeyr90843962017-09-04 15:04:35 +0200236 include/osmocom/Makefile
237 include/osmocom/msc/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
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200241 src/osmo-msc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100242 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000243 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100244 tests/atlocal
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200245 tests/smpp/Makefile
Vadim Yanitskiye1e72472019-04-09 16:55:44 +0700246 tests/db_sms/Makefile
Harald Welte2483f1b2016-06-19 18:06:02 +0200247 tests/sms_queue/Makefile
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100248 tests/msc_vlr/Makefile
Neels Hofmeyreef45782019-10-21 03:24:04 +0200249 tests/sdp_msg/Makefile
Neels Hofmeyrb4552052019-10-21 03:00:26 +0200250 tests/mncc/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200251 doc/Makefile
252 doc/examples/Makefile
Oliver Smith39093762018-11-14 10:47:01 +0100253 doc/manuals/Makefile
Neels Hofmeyrc4628a32018-12-07 14:47:34 +0100254 doc/sequence_charts/Makefile
Pau Espin Pedrolf282f332018-09-10 12:55:00 +0200255 contrib/Makefile
256 contrib/systemd/Makefile
Oliver Smith03145932020-05-14 11:49:00 +0200257 contrib/osmo-msc.spec
Holger Freyther5f755982008-12-27 09:42:59 +0000258 Makefile)