blob: b0d6b236d175d1f0543e6fc2b5263579082a4213 [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
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 +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)
Daniel Willmanncdeb8152015-10-08 16:10:23 +020049PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
Harald Weltef98a4972010-02-20 17:29:27 +010050
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010051# Enabke/disable the NAT?
52AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
53 [osmo_ac_build_nat="$enableval"],[osmo_ac_build_nat="no"])
54if test "$osmo_ac_build_nat" = "yes" ; then
55 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
56fi
57AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
58AC_SUBST(osmo_ac_build_nat)
59
60# Enable/disable the BSC?
61AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Jacob Erlbeck946d1412013-09-17 13:59:29 +020062 [osmo_ac_build_bsc="$enableval"],[osmo_ac_build_bsc="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010063if test "$osmo_ac_build_bsc" = "yes" ; then
64 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
65fi
66AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
Jacob Erlbeck946d1412013-09-17 13:59:29 +020067AC_SUBST(osmo_ac_build_bsc)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010068
Neels Hofmeyr84da6b12016-05-20 21:59:55 +020069# Enable/disable smpp support in the msc?
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010070AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020071 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010072if test "$osmo_ac_build_smpp" = "yes" ; then
Harald Welte2d23e902017-08-14 19:16:42 +020073 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.12)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010074 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
75fi
76AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020077AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010078
Jacob Erlbeck239a8532014-03-13 14:25:51 +010079# Enable/disable transcoding within osmo-bsc_mgcp?
80AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
81 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
82AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
83
84if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Neels Hofmeyrf8e02aa2016-06-15 14:43:20 +020085 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 +020086 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck239a8532014-03-13 14:25:51 +010087 if test "$osmo_ac_with_g729" = "yes" ; then
88 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
89 fi
90 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
91fi
92AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
93AC_SUBST(osmo_ac_mgcp_transcoding)
94
Daniel Willmann3af96602016-05-20 21:42:55 +020095# Enable/disable 3G aka IuPS + IuCS support?
96AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
97 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
98if test "x$osmo_ac_iu" = "xyes" ; then
99 PKG_CHECK_MODULES(LIBASN1C, libasn1c) # TODO version?
100 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap) # TODO version?
101 PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran) # TODO version?
102 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
103fi
104AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
105AC_SUBST(osmo_ac_iu)
106
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +0100107
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200108found_libgtp=yes
Harald Welte0d21ac82015-11-20 10:40:07 +0100109PKG_CHECK_MODULES(LIBGTP, libgtp >= 0.92, , found_libgtp=no)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200110AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +0200111AC_SUBST(found_libgtp)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +0200112
Holger Hans Peter Freyther66e71062015-05-25 01:21:50 +0800113found_libcares=yes
114PKG_CHECK_MODULES([LIBCARES], [libcares], [], [found_libcares=no])
115AM_CONDITIONAL(HAVE_LIBCARES, test "$found_libcares" = yes)
116AC_SUBST(found_libcares)
117
Neels Hofmeyr8defadb2015-11-29 19:14:58 +0100118found_libgtp_and_libcares=no
119if test "$found_libgtp" = "yes" -a "$found_libcares" = "yes"; then
120 found_libgtp_and_libcares=yes
121fi
122AC_SUBST(found_libgtp_and_libcares)
123
Harald Weltede729a12008-12-23 21:01:25 +0000124dnl checks for header files
125AC_HEADER_STDC
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +0100126AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Max7bb383a2017-05-02 12:59:15 +0200127
128found_pcap=yes
129AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no)
130AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes)
Harald Welteca17ef82011-02-05 15:13:27 +0100131
Harald Welte7465e4c2012-11-13 07:06:54 +0100132found_cdk=yes
133AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
134AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
135
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +0100136found_sqlite3=yes
137PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
138AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
139AC_SUBST(found_sqlite3)
140
Harald Weltede729a12008-12-23 21:01:25 +0000141
142dnl Checks for typedefs, structures and compiler characteristics
143
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000144# The following test is taken from WebKit's webkit.m4
145saved_CFLAGS="$CFLAGS"
146CFLAGS="$CFLAGS -fvisibility=hidden "
147AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200148AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000149 [ AC_MSG_RESULT([yes])
150 SYMBOL_VISIBILITY="-fvisibility=hidden"],
151 AC_MSG_RESULT([no]))
152CFLAGS="$saved_CFLAGS"
153AC_SUBST(SYMBOL_VISIBILITY)
154
Max34f01262017-01-20 13:03:03 +0100155AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
156AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
157AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
158AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
159AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
160AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
161
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100162# Coverage build taken from WebKit's configure.in
163AC_MSG_CHECKING([whether to enable code coverage support])
164AC_ARG_ENABLE(coverage,
165 AC_HELP_STRING([--enable-coverage],
166 [enable code coverage support [default=no]]),
167 [],[enable_coverage="no"])
168AC_MSG_RESULT([$enable_coverage])
169if test "$enable_coverage" = "yes"; then
170 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
171 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
172 AC_SUBST([COVERAGE_CFLAGS])
173 AC_SUBST([COVERAGE_LDFLAGS])
174fi
175
Harald Welte9c3dc902012-04-08 16:59:24 +0200176AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
177 AC_CACHE_CHECK(
178 [whether struct tm has tm_gmtoff member],
179 osmo_cv_tm_includes_tm_gmtoff,
180 [AC_LINK_IFELSE([
181 AC_LANG_PROGRAM([
182 #include <time.h>
183 ], [
184 time_t t = time(NULL);
185 struct tm* lt = localtime(&t);
186 int off = lt->tm_gmtoff;
187 ])
188 ],
189 osmo_cv_tm_includes_tm_gmtoff=yes,
190 osmo_cv_tm_includes_tm_gmtoff=no
191 )]
192 )
193 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
194 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
195 [Define if struct tm has tm_gmtoff member.])
196 fi
197])
198
199CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000200
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200201AC_ARG_ENABLE([vty_tests],
202 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200203 [Include the VTY/CTRL tests in make check (deprecated)
204 [default=no]]),
205 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200206AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200207 AC_HELP_STRING([--enable-external-tests],
208 [Include the VTY/CTRL tests in make check [default=no]]),
209 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
210if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200211 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200212 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
213 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr772205a2017-07-20 23:01:45 +0200214 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 +0200215 fi
216fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200217AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
218AC_MSG_RESULT([$enable_ext_tests])
219AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200220
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000221dnl Generate the output
222AM_CONFIG_HEADER(bscconfig.h)
223
Holger Freyther5f755982008-12-27 09:42:59 +0000224AC_OUTPUT(
Holger Freytherc7aa3c42009-06-08 10:32:39 +0000225 openbsc.pc
Holger Freyther5f755982008-12-27 09:42:59 +0000226 include/openbsc/Makefile
227 include/Makefile
228 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100229 src/libtrau/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100230 src/libbsc/Makefile
231 src/libmsc/Makefile
Harald Welteb8b85a12016-06-17 00:06:42 +0200232 src/libvlr/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100233 src/libmgcp/Makefile
234 src/libcommon/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200235 src/libfilter/Makefile
Neels Hofmeyrbfa88782016-05-20 21:38:32 +0200236 src/libiu/Makefile
Neels Hofmeyrc69ee852016-05-10 12:50:31 +0200237 src/libcommon-cs/Makefile
Neels Hofmeyr84da6b12016-05-20 21:59:55 +0200238 src/osmo-msc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100239 src/osmo-bsc/Makefile
Harald Weltea17faf82011-03-03 23:36:48 +0100240 src/osmo-bsc_nat/Makefile
241 src/osmo-bsc_mgcp/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100242 src/ipaccess/Makefile
243 src/utils/Makefile
244 src/gprs/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000245 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100246 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000247 tests/gsm0408/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200248 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200249 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800250 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200251 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freyther9f239a22011-01-06 19:32:52 +0100252 tests/mgcp/Makefile
Holger Hans Peter Freytherfaf1f642011-06-23 17:53:27 -0400253 tests/gprs/Makefile
Jacob Erlbeck51a869c2013-10-15 12:00:26 +0200254 tests/gbproxy/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100255 tests/abis/Makefile
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200256 tests/smpp/Makefile
Andreas Eversbergd074f8f2013-12-06 16:59:10 +0100257 tests/trau/Makefile
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +0200258 tests/sgsn/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100259 tests/subscr/Makefile
Neels Hofmeyrf06046b2015-10-12 11:57:35 +0200260 tests/oap/Makefile
Neels Hofmeyrc8a614d2015-09-24 17:32:30 +0200261 tests/gtphub/Makefile
Philippa536fc62016-08-10 12:14:57 +0200262 tests/xid/Makefile
Philipp22611be2016-08-10 12:08:03 +0200263 tests/sndcp_xid/Makefile
Philipp2c7f8372016-08-26 16:58:41 +0200264 tests/slhc/Makefile
Philippd8b45772016-09-02 13:32:38 +0200265 tests/v42bis/Makefile
Philippb4cb8382016-09-29 17:01:57 +0200266 tests/nanobts_omlattr/Makefile
Harald Welte2483f1b2016-06-19 18:06:02 +0200267 tests/sms_queue/Makefile
Neels Hofmeyr6a29d322017-01-25 15:04:16 +0100268 tests/msc_vlr/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200269 doc/Makefile
270 doc/examples/Makefile
Neels Hofmeyr625e05a2017-07-20 17:57:37 +0200271 contrib/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000272 Makefile)