blob: a2dfa5be37c3195149cf31d81ed7f1060fae86c4 [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
Harald Welte811f6802019-01-21 00:16:26 +010038PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0)
39PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.0.0)
40PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.0.0)
41PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.0.0)
42PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.6.0)
43PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.4.0)
44PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.0.0)
45PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 1.0.0)
46PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.5.0)
47PKG_CHECK_MODULES(LIBOSMOGSUPCLIENT, libosmo-gsup-client >= 1.0.0)
Harald Weltef98a4972010-02-20 17:29:27 +010048
Harald Welte84528502019-02-06 17:11:25 +010049old_LIBS=$LIBS
50AC_SEARCH_LIBS([sctp_send], [sctp], [
51 AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support])
52 AC_SUBST(HAVE_LIBSCTP, [1])
53 if test -n "$ac_lib"; then
54 AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib])
55 fi
56 ], [
57 AC_MSG_ERROR([sctp_send not found in searched libs])])
58LIBS=$old_LIBS
59
Neels Hofmeyr7cec3882017-11-17 01:43:36 +010060AC_ARG_ENABLE(sanitize,
61 [AS_HELP_STRING(
62 [--enable-sanitize],
63 [Compile with address sanitizer enabled],
64 )],
65 [sanitize=$enableval], [sanitize="no"])
66if test x"$sanitize" = x"yes"
67then
68 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
69 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
70fi
71
Neels Hofmeyr620ba932018-03-05 20:43:44 +010072AC_ARG_ENABLE(werror,
73 [AS_HELP_STRING(
74 [--enable-werror],
75 [Turn all compiler warnings into errors, with exceptions:
76 a) deprecation (allow upstream to mark deprecation without breaking builds);
77 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
78 ]
79 )],
80 [werror=$enableval], [werror="no"])
81if test x"$werror" = x"yes"
82then
83 WERROR_FLAGS="-Werror"
84 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
85 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
86 CFLAGS="$CFLAGS $WERROR_FLAGS"
87 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
88fi
89
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020090# Enable/disable smpp support in the msc?
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010091AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020092 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010093if test "$osmo_ac_build_smpp" = "yes" ; then
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +020094 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.13.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010095 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
96fi
97AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020098AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010099
Daniel Willmann3af96602016-05-20 21:42:55 +0200100# Enable/disable 3G aka IuPS + IuCS support?
101AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
102 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
103if test "x$osmo_ac_iu" = "xyes" ; then
Pau Espin Pedrolcb8c75b2018-05-03 18:52:03 +0200104 PKG_CHECK_MODULES(LIBASN1C, libasn1c >= 0.9.30)
105 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap >= 0.3.0)
Daniel Willmann3af96602016-05-20 21:42:55 +0200106 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
107fi
108AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
109AC_SUBST(osmo_ac_iu)
110
Harald Weltede729a12008-12-23 21:01:25 +0000111dnl checks for header files
112AC_HEADER_STDC
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +0100113AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Max7bb383a2017-05-02 12:59:15 +0200114
Harald Weltede729a12008-12-23 21:01:25 +0000115
116dnl Checks for typedefs, structures and compiler characteristics
Max34f01262017-01-20 13:03:03 +0100117AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
118AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
119AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
120AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
121AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
122AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
123
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100124# Coverage build taken from WebKit's configure.in
125AC_MSG_CHECKING([whether to enable code coverage support])
126AC_ARG_ENABLE(coverage,
127 AC_HELP_STRING([--enable-coverage],
128 [enable code coverage support [default=no]]),
129 [],[enable_coverage="no"])
130AC_MSG_RESULT([$enable_coverage])
131if 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])
136fi
137
Harald Welte9c3dc902012-04-08 16:59:24 +0200138AC_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
161CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000162
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200163AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200164 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"])
167if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200168 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200169 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
170 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr772205a2017-07-20 23:01:45 +0200171 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 +0200172 fi
173fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200174AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
175AC_MSG_RESULT([$enable_ext_tests])
176AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200177
Oliver Smith39093762018-11-14 10:47:01 +0100178# Generate manuals
179AC_ARG_ENABLE(manuals,
180 [AS_HELP_STRING(
181 [--enable-manuals],
182 [Generate manual PDFs [default=no]],
183 )],
184 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
185AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
186AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
187 fallback])
188if test x"$osmo_ac_build_manuals" = x"yes"
189then
190 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
191 if test -n "$OSMO_GSM_MANUALS_DIR"; then
192 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
193 else
194 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
195 if test -n "$OSMO_GSM_MANUALS_DIR"; then
196 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
197 else
198 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
199 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
200 fi
201 fi
202 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
203 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
204 fi
205
206 # Find and run check-depends
207 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
208 if ! test -x "$CHECK_DEPENDS"; then
209 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
210 fi
211 if ! $CHECK_DEPENDS; then
212 AC_MSG_ERROR("missing dependencies for --enable-manuals")
213 fi
214
215 # Put in Makefile with absolute path
216 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
217 AC_SUBST([OSMO_GSM_MANUALS_DIR])
218fi
219
Pau Espin Pedrolf282f332018-09-10 12:55:00 +0200220# https://www.freedesktop.org/software/systemd/man/daemon.html
221AC_ARG_WITH([systemdsystemunitdir],
222 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
223 [with_systemdsystemunitdir=auto])
224AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
225 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
226
227 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
228 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
229 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
230 with_systemdsystemunitdir=no],
231 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
232AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
233 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
234AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
235
Neels Hofmeyr620ba932018-03-05 20:43:44 +0100236AC_MSG_RESULT([CFLAGS="$CFLAGS"])
237AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
238
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000239dnl Generate the output
Neels Hofmeyr4ac80092019-03-04 02:46:37 +0100240AM_CONFIG_HEADER(config.h)
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000241
Holger Freyther5f755982008-12-27 09:42:59 +0000242AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000243 include/Makefile
Neels Hofmeyr90843962017-09-04 15:04:35 +0200244 include/osmocom/Makefile
245 include/osmocom/msc/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000246 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100247 src/libmsc/Makefile
Harald Welteb8b85a12016-06-17 00:06:42 +0200248 src/libvlr/Makefile
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200249 src/osmo-msc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100250 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000251 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100252 tests/atlocal
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200253 tests/smpp/Makefile
Vadim Yanitskiye1e72472019-04-09 16:55:44 +0700254 tests/db_sms/Makefile
Harald Welte2483f1b2016-06-19 18:06:02 +0200255 tests/sms_queue/Makefile
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100256 tests/msc_vlr/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200257 doc/Makefile
258 doc/examples/Makefile
Oliver Smith39093762018-11-14 10:47:01 +0100259 doc/manuals/Makefile
Neels Hofmeyrc4628a32018-12-07 14:47:34 +0100260 doc/sequence_charts/Makefile
Pau Espin Pedrolf282f332018-09-10 12:55:00 +0200261 contrib/Makefile
262 contrib/systemd/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000263 Makefile)