blob: 4b00af73fe528af74079f18911439372798b4f3d [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
21dnl checks for libraries
Jacob Erlbeck51a869c2013-10-15 12:00:26 +020022AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
23AC_SUBST(LIBRARY_DL)
24
Harald Weltede729a12008-12-23 21:01:25 +000025
Holger Hans Peter Freyther8c90f472013-10-15 13:29:06 +020026PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4)
Harald Welteef466d42011-05-08 09:41:45 +020027PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Harald Welte0ad23822014-08-21 15:56:00 +020028PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
29PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0)
Jacob Erlbecke8278122014-03-31 13:42:11 +020030PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
Holger Hans Peter Freyther8c90f472013-10-15 13:29:06 +020031PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
Pablo Neira Ayusocab6e752014-02-05 18:56:17 +010032PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
Daniel Willmanncdeb8152015-10-08 16:10:23 +020033PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
Harald Weltef98a4972010-02-20 17:29:27 +010034
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010035# Enabke/disable the NAT?
36AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
37 [osmo_ac_build_nat="$enableval"],[osmo_ac_build_nat="no"])
38if test "$osmo_ac_build_nat" = "yes" ; then
39 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
40fi
41AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
42AC_SUBST(osmo_ac_build_nat)
43
44# Enable/disable the BSC?
45AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Jacob Erlbeck946d1412013-09-17 13:59:29 +020046 [osmo_ac_build_bsc="$enableval"],[osmo_ac_build_bsc="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010047if test "$osmo_ac_build_bsc" = "yes" ; then
48 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
49fi
50AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
Jacob Erlbeck946d1412013-09-17 13:59:29 +020051AC_SUBST(osmo_ac_build_bsc)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010052
53# Enable/disable smpp support in the nitb?
54AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020055 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010056if test "$osmo_ac_build_smpp" = "yes" ; then
57 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.10)
58 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
59fi
60AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020061AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010062
Jacob Erlbeck239a8532014-03-13 14:25:51 +010063# Enable/disable transcoding within osmo-bsc_mgcp?
64AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
65 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
66AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
67
68if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Neels Hofmeyrf8e02aa2016-06-15 14:43:20 +020069 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 +020070 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck239a8532014-03-13 14:25:51 +010071 if test "$osmo_ac_with_g729" = "yes" ; then
72 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
73 fi
74 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
75fi
76AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
77AC_SUBST(osmo_ac_mgcp_transcoding)
78
Daniel Willmann3af96602016-05-20 21:42:55 +020079# Enable/disable 3G aka IuPS + IuCS support?
80AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
81 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
82if test "x$osmo_ac_iu" = "xyes" ; then
83 PKG_CHECK_MODULES(LIBASN1C, libasn1c) # TODO version?
84 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap) # TODO version?
85 PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran) # TODO version?
86 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
87fi
88AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
89AC_SUBST(osmo_ac_iu)
90
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010091
Sylvain Munaut86aaefe2011-10-18 13:27:00 +020092found_libgtp=yes
Harald Welte0d21ac82015-11-20 10:40:07 +010093PKG_CHECK_MODULES(LIBGTP, libgtp >= 0.92, , found_libgtp=no)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +020094AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +020095AC_SUBST(found_libgtp)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +020096
Holger Hans Peter Freyther66e71062015-05-25 01:21:50 +080097found_libcares=yes
98PKG_CHECK_MODULES([LIBCARES], [libcares], [], [found_libcares=no])
99AM_CONDITIONAL(HAVE_LIBCARES, test "$found_libcares" = yes)
100AC_SUBST(found_libcares)
101
Neels Hofmeyr8defadb2015-11-29 19:14:58 +0100102found_libgtp_and_libcares=no
103if test "$found_libgtp" = "yes" -a "$found_libcares" = "yes"; then
104 found_libgtp_and_libcares=yes
105fi
106AC_SUBST(found_libgtp_and_libcares)
107
Harald Weltede729a12008-12-23 21:01:25 +0000108dnl checks for header files
109AC_HEADER_STDC
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +0100110AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Neels Hofmeyr51cf69c2015-09-15 11:39:47 +0200111AC_CHECK_HEADERS(pcap/pcap.h,,AC_MSG_ERROR(PCAP library is not installed))
Harald Welteca17ef82011-02-05 15:13:27 +0100112
Harald Welte7465e4c2012-11-13 07:06:54 +0100113found_cdk=yes
114AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
115AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
116
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +0100117found_sqlite3=yes
118PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
119AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
120AC_SUBST(found_sqlite3)
121
Harald Weltede729a12008-12-23 21:01:25 +0000122
123dnl Checks for typedefs, structures and compiler characteristics
124
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000125# The following test is taken from WebKit's webkit.m4
126saved_CFLAGS="$CFLAGS"
127CFLAGS="$CFLAGS -fvisibility=hidden "
128AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200129AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000130 [ AC_MSG_RESULT([yes])
131 SYMBOL_VISIBILITY="-fvisibility=hidden"],
132 AC_MSG_RESULT([no]))
133CFLAGS="$saved_CFLAGS"
134AC_SUBST(SYMBOL_VISIBILITY)
135
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100136# Coverage build taken from WebKit's configure.in
137AC_MSG_CHECKING([whether to enable code coverage support])
138AC_ARG_ENABLE(coverage,
139 AC_HELP_STRING([--enable-coverage],
140 [enable code coverage support [default=no]]),
141 [],[enable_coverage="no"])
142AC_MSG_RESULT([$enable_coverage])
143if test "$enable_coverage" = "yes"; then
144 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
145 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
146 AC_SUBST([COVERAGE_CFLAGS])
147 AC_SUBST([COVERAGE_LDFLAGS])
148fi
149
Harald Welte9c3dc902012-04-08 16:59:24 +0200150AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
151 AC_CACHE_CHECK(
152 [whether struct tm has tm_gmtoff member],
153 osmo_cv_tm_includes_tm_gmtoff,
154 [AC_LINK_IFELSE([
155 AC_LANG_PROGRAM([
156 #include <time.h>
157 ], [
158 time_t t = time(NULL);
159 struct tm* lt = localtime(&t);
160 int off = lt->tm_gmtoff;
161 ])
162 ],
163 osmo_cv_tm_includes_tm_gmtoff=yes,
164 osmo_cv_tm_includes_tm_gmtoff=no
165 )]
166 )
167 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
168 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
169 [Define if struct tm has tm_gmtoff member.])
170 fi
171])
172
173CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000174
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200175AC_ARG_ENABLE([vty_tests],
176 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200177 [Include the VTY/CTRL tests in make check (deprecated)
178 [default=no]]),
179 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200180AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200181 AC_HELP_STRING([--enable-external-tests],
182 [Include the VTY/CTRL tests in make check [default=no]]),
183 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
184if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200185 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200186 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
187 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
188 AC_MSG_ERROR([Please install osmocom-python to run the VTY/CTRL tests.])
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200189 fi
190fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200191AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
192AC_MSG_RESULT([$enable_ext_tests])
193AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200194
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000195dnl Generate the output
196AM_CONFIG_HEADER(bscconfig.h)
197
Holger Freyther5f755982008-12-27 09:42:59 +0000198AC_OUTPUT(
Holger Freytherc7aa3c42009-06-08 10:32:39 +0000199 openbsc.pc
Holger Freyther5f755982008-12-27 09:42:59 +0000200 include/openbsc/Makefile
201 include/Makefile
202 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100203 src/libtrau/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100204 src/libbsc/Makefile
205 src/libmsc/Makefile
206 src/libmgcp/Makefile
207 src/libcommon/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200208 src/libfilter/Makefile
Neels Hofmeyrbfa88782016-05-20 21:38:32 +0200209 src/libiu/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100210 src/osmo-nitb/Makefile
211 src/osmo-bsc/Makefile
Harald Weltea17faf82011-03-03 23:36:48 +0100212 src/osmo-bsc_nat/Makefile
213 src/osmo-bsc_mgcp/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100214 src/ipaccess/Makefile
215 src/utils/Makefile
216 src/gprs/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000217 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100218 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000219 tests/gsm0408/Makefile
Holger Freytherdbede4e2008-12-31 23:25:05 +0000220 tests/db/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200221 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200222 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800223 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200224 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freyther9f239a22011-01-06 19:32:52 +0100225 tests/mgcp/Makefile
Holger Hans Peter Freytherfaf1f642011-06-23 17:53:27 -0400226 tests/gprs/Makefile
Jacob Erlbeck51a869c2013-10-15 12:00:26 +0200227 tests/gbproxy/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100228 tests/abis/Makefile
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200229 tests/smpp/Makefile
Andreas Eversbergd074f8f2013-12-06 16:59:10 +0100230 tests/trau/Makefile
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +0200231 tests/sgsn/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100232 tests/subscr/Makefile
Neels Hofmeyrf06046b2015-10-12 11:57:35 +0200233 tests/oap/Makefile
Neels Hofmeyrc8a614d2015-09-24 17:32:30 +0200234 tests/gtphub/Makefile
Neels Hofmeyr37984bd2016-03-30 11:22:24 +0200235 tests/mm_auth/Makefile
Philippa536fc62016-08-10 12:14:57 +0200236 tests/xid/Makefile
Philipp22611be2016-08-10 12:08:03 +0200237 tests/sndcp_xid/Makefile
Philipp2c7f8372016-08-26 16:58:41 +0200238 tests/slhc/Makefile
Philippd8b45772016-09-02 13:32:38 +0200239 tests/v42bis/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200240 doc/Makefile
241 doc/examples/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000242 Makefile)