blob: cc07f7a01fc470f96055901376007477ab7b9b71 [file] [log] [blame]
Harald Weltede729a12008-12-23 21:01:25 +00001dnl Process this file with autoconf to produce a configure script
Harald Welte5a29c7f2010-03-23 00:09:32 +08002AC_INIT([openbsc],
3 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
Max88d8bcb2017-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
Neels Hofmeyref022782016-12-08 21:28:29 +010042PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5)
Harald Welteef466d42011-05-08 09:41:45 +020043PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Harald Welte0ad23822014-08-21 15:56:00 +020044PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
Harald Welte736474c2016-05-06 23:28:52 +020045PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.5)
Jacob Erlbecke8278122014-03-31 13:42:11 +020046PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
Holger Hans Peter Freyther8c90f472013-10-15 13:29:06 +020047PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
Pablo Neira Ayusocab6e752014-02-05 18:56:17 +010048PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
Philipp Maier39f62bb2017-04-09 12:32:51 +020049PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran) # TODO version?
Daniel Willmanncdeb8152015-10-08 16:10:23 +020050PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
Neels Hofmeyrbecfc4c2017-07-19 16:48:42 +020051PKG_CHECK_MODULES(LIBOSMOLEGACYMGCP, libosmo-legacy-mgcp >= 0.0.1)
Harald Weltef98a4972010-02-20 17:29:27 +010052
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010053# Enabke/disable the NAT?
54AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
55 [osmo_ac_build_nat="$enableval"],[osmo_ac_build_nat="no"])
56if test "$osmo_ac_build_nat" = "yes" ; then
57 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
58fi
59AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
60AC_SUBST(osmo_ac_build_nat)
61
62# Enable/disable the BSC?
63AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Jacob Erlbeck946d1412013-09-17 13:59:29 +020064 [osmo_ac_build_bsc="$enableval"],[osmo_ac_build_bsc="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010065if test "$osmo_ac_build_bsc" = "yes" ; then
66 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
67fi
68AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
Jacob Erlbeck946d1412013-09-17 13:59:29 +020069AC_SUBST(osmo_ac_build_bsc)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010070
Neels Hofmeyrc29505e2016-05-20 21:59:55 +020071# Enable/disable smpp support in the msc?
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010072AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020073 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010074if test "$osmo_ac_build_smpp" = "yes" ; then
Harald Weltecf523382017-08-14 19:16:42 +020075 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.12)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010076 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
77fi
78AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020079AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010080
Jacob Erlbeck239a8532014-03-13 14:25:51 +010081# Enable/disable transcoding within osmo-bsc_mgcp?
82AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
83 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
84AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
85
86if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Neels Hofmeyrf8e02aa2016-06-15 14:43:20 +020087 AC_SEARCH_LIBS([gsm_create], [gsm], [LIBRARY_GSM="$LIBS";LIBS=""], [AC_MSG_ERROR([--enable-mgcp-transcoding: cannot find usable libgsm])])
Holger Hans Peter Freytherb69518f2015-07-02 09:51:31 +020088 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck239a8532014-03-13 14:25:51 +010089 if test "$osmo_ac_with_g729" = "yes" ; then
90 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
91 fi
92 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
93fi
94AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
95AC_SUBST(osmo_ac_mgcp_transcoding)
96
Daniel Willmann3af96602016-05-20 21:42:55 +020097# Enable/disable 3G aka IuPS + IuCS support?
98AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
99 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
100if test "x$osmo_ac_iu" = "xyes" ; then
101 PKG_CHECK_MODULES(LIBASN1C, libasn1c) # TODO version?
102 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap) # TODO version?
Daniel Willmann3af96602016-05-20 21:42:55 +0200103 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
104fi
105AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
106AC_SUBST(osmo_ac_iu)
107
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +0100108
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200109found_libgtp=yes
Harald Welte0d21ac82015-11-20 10:40:07 +0100110PKG_CHECK_MODULES(LIBGTP, libgtp >= 0.92, , found_libgtp=no)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200111AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +0200112AC_SUBST(found_libgtp)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200113
Holger Hans Peter Freyther66e71062015-05-25 01:21:50 +0800114found_libcares=yes
115PKG_CHECK_MODULES([LIBCARES], [libcares], [], [found_libcares=no])
116AM_CONDITIONAL(HAVE_LIBCARES, test "$found_libcares" = yes)
117AC_SUBST(found_libcares)
118
Neels Hofmeyr8defadb2015-11-29 19:14:58 +0100119found_libgtp_and_libcares=no
120if test "$found_libgtp" = "yes" -a "$found_libcares" = "yes"; then
121 found_libgtp_and_libcares=yes
122fi
123AC_SUBST(found_libgtp_and_libcares)
124
Harald Weltede729a12008-12-23 21:01:25 +0000125dnl checks for header files
126AC_HEADER_STDC
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +0100127AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Max7bb383a2017-05-02 12:59:15 +0200128
129found_pcap=yes
130AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no)
131AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes)
Harald Welteca17ef82011-02-05 15:13:27 +0100132
Harald Welte7465e4c2012-11-13 07:06:54 +0100133found_cdk=yes
134AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
135AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
136
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +0100137found_sqlite3=yes
138PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
139AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
140AC_SUBST(found_sqlite3)
141
Harald Weltede729a12008-12-23 21:01:25 +0000142
143dnl Checks for typedefs, structures and compiler characteristics
144
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000145# The following test is taken from WebKit's webkit.m4
146saved_CFLAGS="$CFLAGS"
147CFLAGS="$CFLAGS -fvisibility=hidden "
148AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200149AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000150 [ AC_MSG_RESULT([yes])
151 SYMBOL_VISIBILITY="-fvisibility=hidden"],
152 AC_MSG_RESULT([no]))
153CFLAGS="$saved_CFLAGS"
154AC_SUBST(SYMBOL_VISIBILITY)
155
Max34f01262017-01-20 13:03:03 +0100156AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
157AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
158AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
159AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
160AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
161AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
162
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100163# Coverage build taken from WebKit's configure.in
164AC_MSG_CHECKING([whether to enable code coverage support])
165AC_ARG_ENABLE(coverage,
166 AC_HELP_STRING([--enable-coverage],
167 [enable code coverage support [default=no]]),
168 [],[enable_coverage="no"])
169AC_MSG_RESULT([$enable_coverage])
170if test "$enable_coverage" = "yes"; then
171 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
172 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
173 AC_SUBST([COVERAGE_CFLAGS])
174 AC_SUBST([COVERAGE_LDFLAGS])
175fi
176
Harald Welte9c3dc902012-04-08 16:59:24 +0200177AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
178 AC_CACHE_CHECK(
179 [whether struct tm has tm_gmtoff member],
180 osmo_cv_tm_includes_tm_gmtoff,
181 [AC_LINK_IFELSE([
182 AC_LANG_PROGRAM([
183 #include <time.h>
184 ], [
185 time_t t = time(NULL);
186 struct tm* lt = localtime(&t);
187 int off = lt->tm_gmtoff;
188 ])
189 ],
190 osmo_cv_tm_includes_tm_gmtoff=yes,
191 osmo_cv_tm_includes_tm_gmtoff=no
192 )]
193 )
194 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
195 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
196 [Define if struct tm has tm_gmtoff member.])
197 fi
198])
199
200CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000201
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200202AC_ARG_ENABLE([vty_tests],
203 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200204 [Include the VTY/CTRL tests in make check (deprecated)
205 [default=no]]),
206 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200207AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200208 AC_HELP_STRING([--enable-external-tests],
209 [Include the VTY/CTRL tests in make check [default=no]]),
210 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
211if test "x$enable_ext_tests" = "xyes" ; then
Neels Hofmeyr7b656882017-07-09 22:09:18 +0200212AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200213 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
214 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr178d1372017-07-20 23:01:45 +0200215 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 +0200216 fi
217fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200218AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
219AC_MSG_RESULT([$enable_ext_tests])
220AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200221
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000222dnl Generate the output
223AM_CONFIG_HEADER(bscconfig.h)
224
Holger Freyther5f755982008-12-27 09:42:59 +0000225AC_OUTPUT(
Holger Freytherc7aa3c42009-06-08 10:32:39 +0000226 openbsc.pc
Holger Freyther5f755982008-12-27 09:42:59 +0000227 include/openbsc/Makefile
228 include/Makefile
229 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100230 src/libtrau/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100231 src/libbsc/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100232 src/libcommon/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200233 src/libfilter/Makefile
Neels Hofmeyrc69ee852016-05-10 12:50:31 +0200234 src/libcommon-cs/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100235 src/osmo-bsc/Makefile
Harald Weltea17faf82011-03-03 23:36:48 +0100236 src/osmo-bsc_nat/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100237 src/ipaccess/Makefile
238 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000239 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100240 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000241 tests/gsm0408/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200242 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200243 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800244 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200245 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100246 tests/abis/Makefile
Andreas Eversbergd074f8f2013-12-06 16:59:10 +0100247 tests/trau/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100248 tests/subscr/Makefile
Philippb4cb8382016-09-29 17:01:57 +0200249 tests/nanobts_omlattr/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200250 doc/Makefile
251 doc/examples/Makefile
Neels Hofmeyr5809e1e2017-07-20 17:57:37 +0200252 contrib/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000253 Makefile)