blob: 7e244bc65dc4df72be98f67456690f9a671f72a5 [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
Harald Weltede729a12008-12-23 21:01:25 +000015dnl checks for programs
16AC_PROG_MAKE_SET
17AC_PROG_CC
18AC_PROG_INSTALL
Holger Freyther3281f6e2009-02-20 18:33:00 +000019AC_PROG_RANLIB
Harald Weltede729a12008-12-23 21:01:25 +000020
Neels Hofmeyra8f91df2016-10-01 00:50:25 +020021dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
22AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
23if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
24 AC_MSG_WARN([You need to install pkg-config])
25fi
26PKG_PROG_PKG_CONFIG([0.20])
27
Max34f01262017-01-20 13:03:03 +010028dnl check for AX_CHECK_COMPILE_FLAG
29m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [
30 AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.])
31 ])
32
Harald Weltede729a12008-12-23 21:01:25 +000033dnl checks for libraries
Jacob Erlbeck51a869c2013-10-15 12:00:26 +020034AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
35AC_SUBST(LIBRARY_DL)
36
Harald Weltede729a12008-12-23 21:01:25 +000037
Neels Hofmeyref022782016-12-08 21:28:29 +010038PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5)
Harald Welteef466d42011-05-08 09:41:45 +020039PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Harald Welte0ad23822014-08-21 15:56:00 +020040PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
Harald Welte736474c2016-05-06 23:28:52 +020041PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.9.5)
Jacob Erlbecke8278122014-03-31 13:42:11 +020042PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
Holger Hans Peter Freyther8c90f472013-10-15 13:29:06 +020043PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
Pablo Neira Ayusocab6e752014-02-05 18:56:17 +010044PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
Daniel Willmanncdeb8152015-10-08 16:10:23 +020045PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
Harald Weltef98a4972010-02-20 17:29:27 +010046
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010047# Enabke/disable the NAT?
48AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
49 [osmo_ac_build_nat="$enableval"],[osmo_ac_build_nat="no"])
50if test "$osmo_ac_build_nat" = "yes" ; then
51 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
52fi
53AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
54AC_SUBST(osmo_ac_build_nat)
55
56# Enable/disable the BSC?
57AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Jacob Erlbeck946d1412013-09-17 13:59:29 +020058 [osmo_ac_build_bsc="$enableval"],[osmo_ac_build_bsc="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010059if test "$osmo_ac_build_bsc" = "yes" ; then
60 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
61fi
62AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
Jacob Erlbeck946d1412013-09-17 13:59:29 +020063AC_SUBST(osmo_ac_build_bsc)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010064
65# Enable/disable smpp support in the nitb?
66AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020067 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010068if test "$osmo_ac_build_smpp" = "yes" ; then
69 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.10)
70 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
71fi
72AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020073AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010074
Jacob Erlbeck239a8532014-03-13 14:25:51 +010075# Enable/disable transcoding within osmo-bsc_mgcp?
76AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
77 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
78AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
79
80if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Neels Hofmeyrf8e02aa2016-06-15 14:43:20 +020081 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 +020082 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck239a8532014-03-13 14:25:51 +010083 if test "$osmo_ac_with_g729" = "yes" ; then
84 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
85 fi
86 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
87fi
88AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
89AC_SUBST(osmo_ac_mgcp_transcoding)
90
Daniel Willmann3af96602016-05-20 21:42:55 +020091# Enable/disable 3G aka IuPS + IuCS support?
92AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
93 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
94if test "x$osmo_ac_iu" = "xyes" ; then
95 PKG_CHECK_MODULES(LIBASN1C, libasn1c) # TODO version?
96 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap) # TODO version?
97 PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran) # TODO version?
98 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
99fi
100AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
101AC_SUBST(osmo_ac_iu)
102
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +0100103
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200104found_libgtp=yes
Harald Welte0d21ac82015-11-20 10:40:07 +0100105PKG_CHECK_MODULES(LIBGTP, libgtp >= 0.92, , found_libgtp=no)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200106AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +0200107AC_SUBST(found_libgtp)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200108
Holger Hans Peter Freyther66e71062015-05-25 01:21:50 +0800109found_libcares=yes
110PKG_CHECK_MODULES([LIBCARES], [libcares], [], [found_libcares=no])
111AM_CONDITIONAL(HAVE_LIBCARES, test "$found_libcares" = yes)
112AC_SUBST(found_libcares)
113
Neels Hofmeyr8defadb2015-11-29 19:14:58 +0100114found_libgtp_and_libcares=no
115if test "$found_libgtp" = "yes" -a "$found_libcares" = "yes"; then
116 found_libgtp_and_libcares=yes
117fi
118AC_SUBST(found_libgtp_and_libcares)
119
Harald Weltede729a12008-12-23 21:01:25 +0000120dnl checks for header files
121AC_HEADER_STDC
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +0100122AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Neels Hofmeyr51cf69c2015-09-15 11:39:47 +0200123AC_CHECK_HEADERS(pcap/pcap.h,,AC_MSG_ERROR(PCAP library is not installed))
Harald Welteca17ef82011-02-05 15:13:27 +0100124
Harald Welte7465e4c2012-11-13 07:06:54 +0100125found_cdk=yes
126AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
127AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
128
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +0100129found_sqlite3=yes
130PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
131AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
132AC_SUBST(found_sqlite3)
133
Harald Weltede729a12008-12-23 21:01:25 +0000134
135dnl Checks for typedefs, structures and compiler characteristics
136
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000137# The following test is taken from WebKit's webkit.m4
138saved_CFLAGS="$CFLAGS"
139CFLAGS="$CFLAGS -fvisibility=hidden "
140AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200141AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000142 [ AC_MSG_RESULT([yes])
143 SYMBOL_VISIBILITY="-fvisibility=hidden"],
144 AC_MSG_RESULT([no]))
145CFLAGS="$saved_CFLAGS"
146AC_SUBST(SYMBOL_VISIBILITY)
147
Max34f01262017-01-20 13:03:03 +0100148AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
149AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
150AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
151AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
152AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
153AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
154
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100155# Coverage build taken from WebKit's configure.in
156AC_MSG_CHECKING([whether to enable code coverage support])
157AC_ARG_ENABLE(coverage,
158 AC_HELP_STRING([--enable-coverage],
159 [enable code coverage support [default=no]]),
160 [],[enable_coverage="no"])
161AC_MSG_RESULT([$enable_coverage])
162if test "$enable_coverage" = "yes"; then
163 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
164 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
165 AC_SUBST([COVERAGE_CFLAGS])
166 AC_SUBST([COVERAGE_LDFLAGS])
167fi
168
Harald Welte9c3dc902012-04-08 16:59:24 +0200169AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
170 AC_CACHE_CHECK(
171 [whether struct tm has tm_gmtoff member],
172 osmo_cv_tm_includes_tm_gmtoff,
173 [AC_LINK_IFELSE([
174 AC_LANG_PROGRAM([
175 #include <time.h>
176 ], [
177 time_t t = time(NULL);
178 struct tm* lt = localtime(&t);
179 int off = lt->tm_gmtoff;
180 ])
181 ],
182 osmo_cv_tm_includes_tm_gmtoff=yes,
183 osmo_cv_tm_includes_tm_gmtoff=no
184 )]
185 )
186 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
187 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
188 [Define if struct tm has tm_gmtoff member.])
189 fi
190])
191
192CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000193
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200194AC_ARG_ENABLE([vty_tests],
195 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200196 [Include the VTY/CTRL tests in make check (deprecated)
197 [default=no]]),
198 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200199AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200200 AC_HELP_STRING([--enable-external-tests],
201 [Include the VTY/CTRL tests in make check [default=no]]),
202 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
203if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200204 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200205 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
206 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
207 AC_MSG_ERROR([Please install osmocom-python to run the VTY/CTRL tests.])
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200208 fi
209fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200210AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
211AC_MSG_RESULT([$enable_ext_tests])
212AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200213
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000214dnl Generate the output
215AM_CONFIG_HEADER(bscconfig.h)
216
Holger Freyther5f755982008-12-27 09:42:59 +0000217AC_OUTPUT(
Holger Freytherc7aa3c42009-06-08 10:32:39 +0000218 openbsc.pc
Holger Freyther5f755982008-12-27 09:42:59 +0000219 include/openbsc/Makefile
220 include/Makefile
221 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100222 src/libtrau/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100223 src/libbsc/Makefile
224 src/libmsc/Makefile
225 src/libmgcp/Makefile
226 src/libcommon/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200227 src/libfilter/Makefile
Neels Hofmeyrbfa88782016-05-20 21:38:32 +0200228 src/libiu/Makefile
Neels Hofmeyrc69ee852016-05-10 12:50:31 +0200229 src/libcommon-cs/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100230 src/osmo-nitb/Makefile
231 src/osmo-bsc/Makefile
Harald Weltea17faf82011-03-03 23:36:48 +0100232 src/osmo-bsc_nat/Makefile
233 src/osmo-bsc_mgcp/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100234 src/ipaccess/Makefile
235 src/utils/Makefile
236 src/gprs/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000237 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100238 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000239 tests/gsm0408/Makefile
Holger Freytherdbede4e2008-12-31 23:25:05 +0000240 tests/db/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200241 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200242 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800243 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200244 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freyther9f239a22011-01-06 19:32:52 +0100245 tests/mgcp/Makefile
Holger Hans Peter Freytherfaf1f642011-06-23 17:53:27 -0400246 tests/gprs/Makefile
Jacob Erlbeck51a869c2013-10-15 12:00:26 +0200247 tests/gbproxy/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100248 tests/abis/Makefile
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200249 tests/smpp/Makefile
Andreas Eversbergd074f8f2013-12-06 16:59:10 +0100250 tests/trau/Makefile
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +0200251 tests/sgsn/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100252 tests/subscr/Makefile
Neels Hofmeyrf06046b2015-10-12 11:57:35 +0200253 tests/oap/Makefile
Neels Hofmeyrc8a614d2015-09-24 17:32:30 +0200254 tests/gtphub/Makefile
Neels Hofmeyr37984bd2016-03-30 11:22:24 +0200255 tests/mm_auth/Makefile
Philippa536fc62016-08-10 12:14:57 +0200256 tests/xid/Makefile
Philipp22611be2016-08-10 12:08:03 +0200257 tests/sndcp_xid/Makefile
Philipp2c7f8372016-08-26 16:58:41 +0200258 tests/slhc/Makefile
Philippd8b45772016-09-02 13:32:38 +0200259 tests/v42bis/Makefile
Philippb4cb8382016-09-29 17:01:57 +0200260 tests/nanobts_omlattr/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200261 doc/Makefile
262 doc/examples/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000263 Makefile)