blob: 0d6a1da9524b2e0154fe6c17eec27753fd1d0bff [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
Harald Weltefa13cad2010-03-23 00:09:32 +08006AM_INIT_AUTOMAKE([dist-bzip2])
Holger Hans Peter Freytherfee826b2012-01-06 15:16:12 +01007AC_CONFIG_TESTDIR(tests)
Harald Welte2b944cf2008-12-23 21:01:25 +00008
Holger Hans Peter Freytherc746e682009-10-27 03:34:49 +01009dnl kernel style compile messages
10m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11
Harald Welte2b944cf2008-12-23 21:01:25 +000012dnl checks for programs
13AC_PROG_MAKE_SET
14AC_PROG_CC
15AC_PROG_INSTALL
Holger Freyther91f49f62009-02-20 18:33:00 +000016AC_PROG_RANLIB
Harald Welte2b944cf2008-12-23 21:01:25 +000017
18dnl checks for libraries
Jacob Erlbeck76fa57a2013-10-15 12:00:26 +020019AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
20AC_SUBST(LIBRARY_DL)
21
Harald Welte2b944cf2008-12-23 21:01:25 +000022
Holger Hans Peter Freyther5b574132013-10-15 13:29:06 +020023PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4)
Harald Welte4d109ff2011-05-08 09:41:45 +020024PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Harald Welte4f45c9b2014-08-21 15:56:00 +020025PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
26PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0)
Jacob Erlbeck1a5c2462014-03-31 13:42:11 +020027PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
Holger Hans Peter Freyther5b574132013-10-15 13:29:06 +020028PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
Pablo Neira Ayuso4a2f6592014-02-05 18:56:17 +010029PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
Daniel Willmann59265962015-10-08 16:10:23 +020030PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
Harald Welte9c38ed62010-02-20 17:29:27 +010031
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010032# Enabke/disable the NAT?
33AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
34 [osmo_ac_build_nat="$enableval"],[osmo_ac_build_nat="no"])
35if test "$osmo_ac_build_nat" = "yes" ; then
36 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
37fi
38AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
39AC_SUBST(osmo_ac_build_nat)
40
41# Enable/disable the BSC?
42AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +020043 [osmo_ac_build_bsc="$enableval"],[osmo_ac_build_bsc="no"])
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010044if test "$osmo_ac_build_bsc" = "yes" ; then
45 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
46fi
47AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +020048AC_SUBST(osmo_ac_build_bsc)
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010049
50# Enable/disable smpp support in the nitb?
51AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +020052 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010053if test "$osmo_ac_build_smpp" = "yes" ; then
54 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.10)
55 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
56fi
57AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +020058AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010059
Jacob Erlbeck9fac8002014-03-13 14:25:51 +010060# Enable/disable transcoding within osmo-bsc_mgcp?
61AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
62 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
63AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
64
65if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Holger Hans Peter Freyther2431e592015-07-02 09:51:31 +020066 AC_SEARCH_LIBS([gsm_create], [gsm], [LIBRARY_GSM="$LIBS";LIBS=""])
67 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck9fac8002014-03-13 14:25:51 +010068 if test "$osmo_ac_with_g729" = "yes" ; then
69 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
70 fi
71 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
72fi
73AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
74AC_SUBST(osmo_ac_mgcp_transcoding)
75
Holger Hans Peter Freyther61c586c2012-12-20 23:49:24 +010076
Sylvain Munautf4b4e8f2011-10-18 13:27:00 +020077found_libgtp=yes
Harald Weltef0b23c02015-11-20 10:40:07 +010078PKG_CHECK_MODULES(LIBGTP, libgtp >= 0.92, , found_libgtp=no)
Sylvain Munautf4b4e8f2011-10-18 13:27:00 +020079AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
Holger Hans Peter Freyther232f6212014-09-30 09:10:25 +020080AC_SUBST(found_libgtp)
Sylvain Munautf4b4e8f2011-10-18 13:27:00 +020081
Holger Hans Peter Freyther180027c2015-05-25 01:21:50 +080082found_libcares=yes
83PKG_CHECK_MODULES([LIBCARES], [libcares], [], [found_libcares=no])
84AM_CONDITIONAL(HAVE_LIBCARES, test "$found_libcares" = yes)
85AC_SUBST(found_libcares)
86
Neels Hofmeyr5c8090e2015-11-29 19:14:58 +010087found_libgtp_and_libcares=no
88if test "$found_libgtp" = "yes" -a "$found_libcares" = "yes"; then
89 found_libgtp_and_libcares=yes
90fi
91AC_SUBST(found_libgtp_and_libcares)
92
Harald Welte2b944cf2008-12-23 21:01:25 +000093dnl checks for header files
94AC_HEADER_STDC
Harald Weltec7841cc2011-02-05 15:13:27 +010095AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built))
Pablo Neira Ayusof58692f2011-03-08 13:38:49 +010096AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Neels Hofmeyr0d877db2015-09-15 11:39:47 +020097AC_CHECK_HEADERS(pcap/pcap.h,,AC_MSG_ERROR(PCAP library is not installed))
Harald Weltec7841cc2011-02-05 15:13:27 +010098
Harald Welteec83de52012-11-13 07:06:54 +010099found_cdk=yes
100AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
101AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
102
Holger Hans Peter Freytherc9145852015-01-10 09:51:31 +0100103found_sqlite3=yes
104PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
105AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
106AC_SUBST(found_sqlite3)
107
Harald Welte2b944cf2008-12-23 21:01:25 +0000108
109dnl Checks for typedefs, structures and compiler characteristics
110
Holger Freyther64026e92009-06-08 10:32:54 +0000111# The following test is taken from WebKit's webkit.m4
112saved_CFLAGS="$CFLAGS"
113CFLAGS="$CFLAGS -fvisibility=hidden "
114AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemer93ae2d62011-05-24 15:16:54 +0200115AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther64026e92009-06-08 10:32:54 +0000116 [ AC_MSG_RESULT([yes])
117 SYMBOL_VISIBILITY="-fvisibility=hidden"],
118 AC_MSG_RESULT([no]))
119CFLAGS="$saved_CFLAGS"
120AC_SUBST(SYMBOL_VISIBILITY)
121
Holger Hans Peter Freyther16bdb142010-11-15 18:37:57 +0100122# Coverage build taken from WebKit's configure.in
123AC_MSG_CHECKING([whether to enable code coverage support])
124AC_ARG_ENABLE(coverage,
125 AC_HELP_STRING([--enable-coverage],
126 [enable code coverage support [default=no]]),
127 [],[enable_coverage="no"])
128AC_MSG_RESULT([$enable_coverage])
129if test "$enable_coverage" = "yes"; then
130 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
131 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
132 AC_SUBST([COVERAGE_CFLAGS])
133 AC_SUBST([COVERAGE_LDFLAGS])
134fi
135
Harald Welteeaf4a522012-04-08 16:59:24 +0200136AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
137 AC_CACHE_CHECK(
138 [whether struct tm has tm_gmtoff member],
139 osmo_cv_tm_includes_tm_gmtoff,
140 [AC_LINK_IFELSE([
141 AC_LANG_PROGRAM([
142 #include <time.h>
143 ], [
144 time_t t = time(NULL);
145 struct tm* lt = localtime(&t);
146 int off = lt->tm_gmtoff;
147 ])
148 ],
149 osmo_cv_tm_includes_tm_gmtoff=yes,
150 osmo_cv_tm_includes_tm_gmtoff=no
151 )]
152 )
153 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
154 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
155 [Define if struct tm has tm_gmtoff member.])
156 fi
157])
158
159CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther64026e92009-06-08 10:32:54 +0000160
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200161AC_ARG_ENABLE([vty_tests],
162 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freyther8fa08b02014-08-22 00:29:04 +0200163 [Include the VTY/CTRL tests in make check (deprecated)
164 [default=no]]),
165 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso7194f632014-09-01 09:34:07 +0200166AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freyther8fa08b02014-08-22 00:29:04 +0200167 AC_HELP_STRING([--enable-external-tests],
168 [Include the VTY/CTRL tests in make check [default=no]]),
169 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
170if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200171 AM_PATH_PYTHON
Holger Hans Peter Freyther8fa08b02014-08-22 00:29:04 +0200172 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
173 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
174 AC_MSG_ERROR([Please install osmocom-python to run the VTY/CTRL tests.])
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200175 fi
176fi
Holger Hans Peter Freyther8fa08b02014-08-22 00:29:04 +0200177AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
178AC_MSG_RESULT([$enable_ext_tests])
179AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesiad5fb002013-04-05 17:36:09 +0200180
Holger Freyther64026e92009-06-08 10:32:54 +0000181dnl Generate the output
182AM_CONFIG_HEADER(bscconfig.h)
183
Holger Freyther1bad6012008-12-27 09:42:59 +0000184AC_OUTPUT(
Holger Freytherb27d8452009-06-08 10:32:39 +0000185 openbsc.pc
Holger Freyther1bad6012008-12-27 09:42:59 +0000186 include/openbsc/Makefile
187 include/Makefile
188 src/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100189 src/libtrau/Makefile
Harald Welte3d1aaac2011-03-04 13:18:30 +0100190 src/libbsc/Makefile
191 src/libmsc/Makefile
192 src/libmgcp/Makefile
193 src/libcommon/Makefile
Holger Hans Peter Freyther10f2c492015-04-04 18:42:46 +0200194 src/libfilter/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100195 src/osmo-nitb/Makefile
196 src/osmo-bsc/Makefile
Harald Welteacdcfea2011-03-03 23:36:48 +0100197 src/osmo-bsc_nat/Makefile
198 src/osmo-bsc_mgcp/Makefile
Harald Welte4f272cc2011-03-03 23:29:05 +0100199 src/ipaccess/Makefile
200 src/utils/Makefile
201 src/gprs/Makefile
Holger Freyther1bad6012008-12-27 09:42:59 +0000202 tests/Makefile
Holger Hans Peter Freyther34abf212012-01-09 22:53:04 +0100203 tests/atlocal
Holger Freytherec5b1d82008-12-28 21:55:40 +0000204 tests/gsm0408/Makefile
Holger Freytherc1e11922008-12-31 23:25:05 +0000205 tests/db/Makefile
Holger Hans Peter Freytherf8584a12009-06-10 12:36:38 +0200206 tests/channel/Makefile
Jacob Erlbeckcc0d8842013-09-17 13:59:29 +0200207 tests/bsc/Makefile
Holger Hans Peter Freyther4dfa08d2010-06-15 20:21:44 +0800208 tests/bsc-nat/Makefile
Holger Hans Peter Freytheraaa3d082013-06-14 19:10:28 +0200209 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freytherf0bc0752011-01-06 19:32:52 +0100210 tests/mgcp/Makefile
Holger Hans Peter Freyther6721a082011-06-23 17:53:27 -0400211 tests/gprs/Makefile
Jacob Erlbeck76fa57a2013-10-15 12:00:26 +0200212 tests/gbproxy/Makefile
Holger Hans Peter Freyther23e80002012-11-22 14:59:46 +0100213 tests/abis/Makefile
Holger Hans Peter Freyther5292edc2013-07-13 17:09:56 +0200214 tests/smpp/Makefile
Andreas Eversberg2c202cd2013-12-06 16:59:10 +0100215 tests/trau/Makefile
Holger Hans Peter Freyther232f6212014-09-30 09:10:25 +0200216 tests/sgsn/Makefile
Jacob Erlbeck6bc3b7f2014-12-03 13:05:16 +0100217 tests/subscr/Makefile
Neels Hofmeyr2989ff82015-10-12 11:57:35 +0200218 tests/oap/Makefile
Neels Hofmeyr9f796642015-09-24 17:32:30 +0200219 tests/gtphub/Makefile
Harald Welte2d6f49d2011-05-11 22:11:28 +0200220 doc/Makefile
221 doc/examples/Makefile
Holger Freyther1bad6012008-12-27 09:42:59 +0000222 Makefile)