blob: e2575c1830edd537a15651e9e669ba402c13b740 [file] [log] [blame]
Harald Welte2b944cf2008-12-23 21:01:25 +00001dnl Process this file with autoconf to produce a configure script
Harald Weltefa13cad2010-03-23 00:09:32 +08002AC_INIT([openbsc],
3 m4_esyscmd([./git-version-gen .tarball-version]),
Holger Hans Peter Freyther794f04e2014-05-15 12:26:16 +02004 [openbsc@lists.osmocom.org])
Harald Welte2b944cf2008-12-23 21:01:25 +00005
Neels Hofmeyr7c61f752016-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 Weltefa13cad2010-03-23 00:09:32 +08009AM_INIT_AUTOMAKE([dist-bzip2])
Holger Hans Peter Freytherfee826b2012-01-06 15:16:12 +010010AC_CONFIG_TESTDIR(tests)
Harald Welte2b944cf2008-12-23 21:01:25 +000011
Holger Hans Peter Freytherc746e682009-10-27 03:34:49 +010012dnl kernel style compile messages
13m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
14
Harald Welte2b944cf2008-12-23 21:01:25 +000015dnl checks for programs
16AC_PROG_MAKE_SET
17AC_PROG_CC
18AC_PROG_INSTALL
Holger Freyther91f49f62009-02-20 18:33:00 +000019AC_PROG_RANLIB
Harald Welte2b944cf2008-12-23 21:01:25 +000020
Neels Hofmeyredb9ce32016-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
Harald Welte2b944cf2008-12-23 21:01:25 +000028dnl checks for libraries
Jacob Erlbeck76fa57a2013-10-15 12:00:26 +020029AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
30AC_SUBST(LIBRARY_DL)
31
Harald Welte2b944cf2008-12-23 21:01:25 +000032
Holger Hans Peter Freyther5b574132013-10-15 13:29:06 +020033PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4)
Harald Welte4d109ff2011-05-08 09:41:45 +020034PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Harald Welte4f45c9b2014-08-21 15:56:00 +020035PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
36PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0)
Jacob Erlbeck1a5c2462014-03-31 13:42:11 +020037PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
Holger Hans Peter Freyther5b574132013-10-15 13:29:06 +020038PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
Pablo Neira Ayuso4a2f6592014-02-05 18:56:17 +010039PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
Daniel Willmann59265962015-10-08 16:10:23 +020040PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
Harald Welte9c38ed62010-02-20 17:29:27 +010041
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010042# Enabke/disable the NAT?
43AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
44 [osmo_ac_build_nat="$enableval"],[osmo_ac_build_nat="no"])
45if test "$osmo_ac_build_nat" = "yes" ; then
46 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
47fi
48AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
49AC_SUBST(osmo_ac_build_nat)
50
51# Enable/disable the BSC?
52AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +020053 [osmo_ac_build_bsc="$enableval"],[osmo_ac_build_bsc="no"])
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010054if test "$osmo_ac_build_bsc" = "yes" ; then
55 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
56fi
57AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +020058AC_SUBST(osmo_ac_build_bsc)
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010059
60# Enable/disable smpp support in the nitb?
61AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +020062 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010063if test "$osmo_ac_build_smpp" = "yes" ; then
64 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.10)
65 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
66fi
67AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +020068AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010069
Jacob Erlbeck9fac8002014-03-13 14:25:51 +010070# Enable/disable transcoding within osmo-bsc_mgcp?
71AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
72 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
73AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
74
75if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Neels Hofmeyr6a65dfc2016-06-15 14:43:20 +020076 AC_SEARCH_LIBS([gsm_create], [gsm], [LIBRARY_GSM="$LIBS";LIBS=""], [AC_MSG_ERROR([--enable-mgcp-transcoding: cannot find usable libgsm])])
Holger Hans Peter Freyther2431e592015-07-02 09:51:31 +020077 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck9fac8002014-03-13 14:25:51 +010078 if test "$osmo_ac_with_g729" = "yes" ; then
79 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
80 fi
81 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
82fi
83AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
84AC_SUBST(osmo_ac_mgcp_transcoding)
85
Daniel Willmann58b03e32016-05-20 21:42:55 +020086# Enable/disable 3G aka IuPS + IuCS support?
87AC_ARG_ENABLE([iu], [AS_HELP_STRING([--enable-iu], [Build 3G support, aka IuPS and IuCS interfaces])],
88 [osmo_ac_iu="$enableval"],[osmo_ac_iu="no"])
89if test "x$osmo_ac_iu" = "xyes" ; then
90 PKG_CHECK_MODULES(LIBASN1C, libasn1c) # TODO version?
91 PKG_CHECK_MODULES(LIBOSMORANAP, libosmo-ranap) # TODO version?
92 PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran) # TODO version?
93 AC_DEFINE(BUILD_IU, 1, [Define if we want to build IuPS and IuCS interfaces support])
94fi
95AM_CONDITIONAL(BUILD_IU, test "x$osmo_ac_iu" = "xyes")
96AC_SUBST(osmo_ac_iu)
97
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010098
Sylvain Munautf4b4e8f2011-10-18 13:27:00 +020099found_libgtp=yes
Harald Weltef0b23c02015-11-20 10:40:07 +0100100PKG_CHECK_MODULES(LIBGTP, libgtp >= 0.92, , found_libgtp=no)
Sylvain Munautf4b4e8f2011-10-18 13:27:00 +0200101AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
Holger Hans Peter Freyther232f6212014-09-30 09:10:25 +0200102AC_SUBST(found_libgtp)
Sylvain Munautf4b4e8f2011-10-18 13:27:00 +0200103
Holger Hans Peter Freyther180027c2015-05-25 01:21:50 +0800104found_libcares=yes
105PKG_CHECK_MODULES([LIBCARES], [libcares], [], [found_libcares=no])
106AM_CONDITIONAL(HAVE_LIBCARES, test "$found_libcares" = yes)
107AC_SUBST(found_libcares)
108
Neels Hofmeyr5c8090e2015-11-29 19:14:58 +0100109found_libgtp_and_libcares=no
110if test "$found_libgtp" = "yes" -a "$found_libcares" = "yes"; then
111 found_libgtp_and_libcares=yes
112fi
113AC_SUBST(found_libgtp_and_libcares)
114
Harald Welte2b944cf2008-12-23 21:01:25 +0000115dnl checks for header files
116AC_HEADER_STDC
Pablo Neira Ayusof58692f2011-03-08 13:38:49 +0100117AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Neels Hofmeyr0d877db2015-09-15 11:39:47 +0200118AC_CHECK_HEADERS(pcap/pcap.h,,AC_MSG_ERROR(PCAP library is not installed))
Harald Weltec7841cc2011-02-05 15:13:27 +0100119
Harald Welteec83de52012-11-13 07:06:54 +0100120found_cdk=yes
121AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
122AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
123
Holger Hans Peter Freytherc9145852015-01-10 09:51:31 +0100124found_sqlite3=yes
125PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
126AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
127AC_SUBST(found_sqlite3)
128
Harald Welte2b944cf2008-12-23 21:01:25 +0000129
130dnl Checks for typedefs, structures and compiler characteristics
131
Holger Freyther64026e92009-06-08 10:32:54 +0000132# The following test is taken from WebKit's webkit.m4
133saved_CFLAGS="$CFLAGS"
134CFLAGS="$CFLAGS -fvisibility=hidden "
135AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemer93ae2d62011-05-24 15:16:54 +0200136AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther64026e92009-06-08 10:32:54 +0000137 [ AC_MSG_RESULT([yes])
138 SYMBOL_VISIBILITY="-fvisibility=hidden"],
139 AC_MSG_RESULT([no]))
140CFLAGS="$saved_CFLAGS"
141AC_SUBST(SYMBOL_VISIBILITY)
142
Holger Hans Peter Freyther16bdb142010-11-15 18:37:57 +0100143# Coverage build taken from WebKit's configure.in
144AC_MSG_CHECKING([whether to enable code coverage support])
145AC_ARG_ENABLE(coverage,
146 AC_HELP_STRING([--enable-coverage],
147 [enable code coverage support [default=no]]),
148 [],[enable_coverage="no"])
149AC_MSG_RESULT([$enable_coverage])
150if test "$enable_coverage" = "yes"; then
151 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
152 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
153 AC_SUBST([COVERAGE_CFLAGS])
154 AC_SUBST([COVERAGE_LDFLAGS])
155fi
156
Harald Welteeaf4a522012-04-08 16:59:24 +0200157AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
158 AC_CACHE_CHECK(
159 [whether struct tm has tm_gmtoff member],
160 osmo_cv_tm_includes_tm_gmtoff,
161 [AC_LINK_IFELSE([
162 AC_LANG_PROGRAM([
163 #include <time.h>
164 ], [
165 time_t t = time(NULL);
166 struct tm* lt = localtime(&t);
167 int off = lt->tm_gmtoff;
168 ])
169 ],
170 osmo_cv_tm_includes_tm_gmtoff=yes,
171 osmo_cv_tm_includes_tm_gmtoff=no
172 )]
173 )
174 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
175 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
176 [Define if struct tm has tm_gmtoff member.])
177 fi
178])
179
180CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther64026e92009-06-08 10:32:54 +0000181
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200182AC_ARG_ENABLE([vty_tests],
183 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freyther8fa08b02014-08-22 00:29:04 +0200184 [Include the VTY/CTRL tests in make check (deprecated)
185 [default=no]]),
186 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso7194f632014-09-01 09:34:07 +0200187AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freyther8fa08b02014-08-22 00:29:04 +0200188 AC_HELP_STRING([--enable-external-tests],
189 [Include the VTY/CTRL tests in make check [default=no]]),
190 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
191if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200192 AM_PATH_PYTHON
Holger Hans Peter Freyther8fa08b02014-08-22 00:29:04 +0200193 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
194 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
195 AC_MSG_ERROR([Please install osmocom-python to run the VTY/CTRL tests.])
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200196 fi
197fi
Holger Hans Peter Freyther8fa08b02014-08-22 00:29:04 +0200198AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
199AC_MSG_RESULT([$enable_ext_tests])
200AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200201
Holger Freyther64026e92009-06-08 10:32:54 +0000202dnl Generate the output
203AM_CONFIG_HEADER(bscconfig.h)
204
Holger Freyther1bad6012008-12-27 09:42:59 +0000205AC_OUTPUT(
Holger Freytherb27d8452009-06-08 10:32:39 +0000206 openbsc.pc
Holger Freyther1bad6012008-12-27 09:42:59 +0000207 include/openbsc/Makefile
208 include/Makefile
209 src/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100210 src/libtrau/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100211 src/libbsc/Makefile
212 src/libmsc/Makefile
213 src/libmgcp/Makefile
214 src/libcommon/Makefile
Holger Hans Peter Freyther10f2c492015-04-04 18:42:46 +0200215 src/libfilter/Makefile
Neels Hofmeyrda6853a2016-05-20 21:38:32 +0200216 src/libiu/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100217 src/osmo-nitb/Makefile
218 src/osmo-bsc/Makefile
Harald Welteacdcfea2011-03-03 23:36:48 +0100219 src/osmo-bsc_nat/Makefile
220 src/osmo-bsc_mgcp/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100221 src/ipaccess/Makefile
222 src/utils/Makefile
223 src/gprs/Makefile
Holger Freyther1bad6012008-12-27 09:42:59 +0000224 tests/Makefile
Holger Hans Peter Freyther34abf212012-01-09 22:53:04 +0100225 tests/atlocal
Holger Freytherec5b1d82008-12-28 21:55:40 +0000226 tests/gsm0408/Makefile
Holger Freytherc1e11922008-12-31 23:25:05 +0000227 tests/db/Makefile
Holger Hans Peter Freytherf8584a12009-06-10 12:36:38 +0200228 tests/channel/Makefile
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +0200229 tests/bsc/Makefile
Holger Hans Peter Freyther4dfa08d2010-06-15 20:21:44 +0800230 tests/bsc-nat/Makefile
Holger Hans Peter Freytheraaa3d082013-06-14 19:10:28 +0200231 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freytherf0bc0752011-01-06 19:32:52 +0100232 tests/mgcp/Makefile
Holger Hans Peter Freyther6721a082011-06-23 17:53:27 -0400233 tests/gprs/Makefile
Jacob Erlbeck76fa57a2013-10-15 12:00:26 +0200234 tests/gbproxy/Makefile
Holger Hans Peter Freyther23e80002012-11-22 14:59:46 +0100235 tests/abis/Makefile
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +0200236 tests/smpp/Makefile
Andreas Eversberg2c202cd2013-12-06 16:59:10 +0100237 tests/trau/Makefile
Holger Hans Peter Freyther232f6212014-09-30 09:10:25 +0200238 tests/sgsn/Makefile
Jacob Erlbeck6bc3b7f2014-12-03 13:05:16 +0100239 tests/subscr/Makefile
Neels Hofmeyr2989ff82015-10-12 11:57:35 +0200240 tests/oap/Makefile
Neels Hofmeyr9f796642015-09-24 17:32:30 +0200241 tests/gtphub/Makefile
Neels Hofmeyr221c4c12016-03-30 11:22:24 +0200242 tests/mm_auth/Makefile
Philippfcb979a2016-08-10 12:14:57 +0200243 tests/xid/Makefile
Philipp59971b82016-08-10 12:08:03 +0200244 tests/sndcp_xid/Makefile
Philipp49482092016-08-26 16:58:41 +0200245 tests/slhc/Makefile
Philipp8a3fe602016-09-02 13:32:38 +0200246 tests/v42bis/Makefile
Harald Welte2d6f49d2011-05-11 22:11:28 +0200247 doc/Makefile
248 doc/examples/Makefile
Holger Freyther1bad6012008-12-27 09:42:59 +0000249 Makefile)