blob: 394972f46f39cda77cbb1e757fa2c802a75a2af8 [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
Harald Welte5a29c7f2010-03-23 00:09:32 +08006AM_INIT_AUTOMAKE([dist-bzip2])
Holger Hans Peter Freyther6c882172012-01-06 15:16:12 +01007AC_CONFIG_TESTDIR(tests)
Harald Weltede729a12008-12-23 21:01:25 +00008
Holger Hans Peter Freyther1f59ac42009-10-27 03:34:49 +01009dnl kernel style compile messages
10m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11
Harald Weltede729a12008-12-23 21:01:25 +000012dnl checks for programs
13AC_PROG_MAKE_SET
14AC_PROG_CC
15AC_PROG_INSTALL
Holger Freyther3281f6e2009-02-20 18:33:00 +000016AC_PROG_RANLIB
Harald Weltede729a12008-12-23 21:01:25 +000017
18dnl checks for libraries
Holger Freytherb424ecb2009-06-08 10:32:28 +000019AC_SEARCH_LIBS(crypt, crypt,
20 [LIBCRYPT="-lcrypt"; AC_DEFINE([VTY_CRYPT_PW], [], [Use crypt functionality of vty.])])
Jacob Erlbeck51a869c2013-10-15 12:00:26 +020021AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
22AC_SUBST(LIBRARY_DL)
23
Harald Weltede729a12008-12-23 21:01:25 +000024
Holger Hans Peter Freyther8c90f472013-10-15 13:29:06 +020025PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.6.4)
Harald Welteef466d42011-05-08 09:41:45 +020026PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Harald Welte0ad23822014-08-21 15:56:00 +020027PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl)
28PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.7.0)
Jacob Erlbecke8278122014-03-31 13:42:11 +020029PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.2.0)
Holger Hans Peter Freyther8c90f472013-10-15 13:29:06 +020030PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.6.4)
Pablo Neira Ayusocab6e752014-02-05 18:56:17 +010031PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
Harald Weltef98a4972010-02-20 17:29:27 +010032
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010033# Enabke/disable the NAT?
34AC_ARG_ENABLE([nat], [AS_HELP_STRING([--enable-nat], [Build the BSC NAT. Requires SCCP])],
35 [osmo_ac_build_nat="$enableval"],[osmo_ac_build_nat="no"])
36if test "$osmo_ac_build_nat" = "yes" ; then
37 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
38fi
39AM_CONDITIONAL(BUILD_NAT, test "x$osmo_ac_build_nat" = "xyes")
40AC_SUBST(osmo_ac_build_nat)
41
42# Enable/disable the BSC?
43AC_ARG_ENABLE([osmo-bsc], [AS_HELP_STRING([--enable-osmo-bsc], [Build the Osmo BSC])],
Jacob Erlbeck946d1412013-09-17 13:59:29 +020044 [osmo_ac_build_bsc="$enableval"],[osmo_ac_build_bsc="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010045if test "$osmo_ac_build_bsc" = "yes" ; then
46 PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.6)
47fi
48AM_CONDITIONAL(BUILD_BSC, test "x$osmo_ac_build_bsc" = "xyes")
Jacob Erlbeck946d1412013-09-17 13:59:29 +020049AC_SUBST(osmo_ac_build_bsc)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010050
51# Enable/disable smpp support in the nitb?
52AC_ARG_ENABLE([smpp], [AS_HELP_STRING([--enable-smpp], [Build the SMPP interface])],
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020053 [osmo_ac_build_smpp="$enableval"],[osmo_ac_build_smpp="no"])
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010054if test "$osmo_ac_build_smpp" = "yes" ; then
55 PKG_CHECK_MODULES(LIBSMPP34, libsmpp34 >= 1.10)
56 AC_DEFINE(BUILD_SMPP, 1, [Define if we want to build SMPP])
57fi
58AM_CONDITIONAL(BUILD_SMPP, test "x$osmo_ac_build_smpp" = "xyes")
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +020059AC_SUBST(osmo_ac_build_smpp)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010060
Jacob Erlbeck239a8532014-03-13 14:25:51 +010061# Enable/disable transcoding within osmo-bsc_mgcp?
62AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
63 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
64AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
65
66if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
67 AC_SEARCH_LIBS(gsm_create, gsm)
68 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 Freyther25b70ce2012-12-20 23:49:24 +010076
Sylvain Munaut86aaefe2011-10-18 13:27:00 +020077found_libgtp=yes
78PKG_CHECK_MODULES(LIBGTP, libgtp, , found_libgtp=no)
79AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +020080AC_SUBST(found_libgtp)
Sylvain Munaut86aaefe2011-10-18 13:27:00 +020081
Harald Weltede729a12008-12-23 21:01:25 +000082dnl checks for header files
83AC_HEADER_STDC
Harald Welteca17ef82011-02-05 15:13:27 +010084AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built))
Pablo Neira Ayuso5d7ad472011-03-08 13:38:49 +010085AC_CHECK_HEADERS(dbi/dbd.h,,AC_MSG_ERROR(DBI library is not installed))
Harald Welteca17ef82011-02-05 15:13:27 +010086
Harald Welte7465e4c2012-11-13 07:06:54 +010087found_cdk=yes
88AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
89AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
90
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +010091found_sqlite3=yes
92PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
93AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
94AC_SUBST(found_sqlite3)
95
Harald Weltede729a12008-12-23 21:01:25 +000096
97dnl Checks for typedefs, structures and compiler characteristics
98
Holger Freyther6d9f77a2009-06-08 10:32:54 +000099# The following test is taken from WebKit's webkit.m4
100saved_CFLAGS="$CFLAGS"
101CFLAGS="$CFLAGS -fvisibility=hidden "
102AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200103AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000104 [ AC_MSG_RESULT([yes])
105 SYMBOL_VISIBILITY="-fvisibility=hidden"],
106 AC_MSG_RESULT([no]))
107CFLAGS="$saved_CFLAGS"
108AC_SUBST(SYMBOL_VISIBILITY)
109
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100110# Coverage build taken from WebKit's configure.in
111AC_MSG_CHECKING([whether to enable code coverage support])
112AC_ARG_ENABLE(coverage,
113 AC_HELP_STRING([--enable-coverage],
114 [enable code coverage support [default=no]]),
115 [],[enable_coverage="no"])
116AC_MSG_RESULT([$enable_coverage])
117if test "$enable_coverage" = "yes"; then
118 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
119 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
120 AC_SUBST([COVERAGE_CFLAGS])
121 AC_SUBST([COVERAGE_LDFLAGS])
122fi
123
Harald Welte9c3dc902012-04-08 16:59:24 +0200124AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [
125 AC_CACHE_CHECK(
126 [whether struct tm has tm_gmtoff member],
127 osmo_cv_tm_includes_tm_gmtoff,
128 [AC_LINK_IFELSE([
129 AC_LANG_PROGRAM([
130 #include <time.h>
131 ], [
132 time_t t = time(NULL);
133 struct tm* lt = localtime(&t);
134 int off = lt->tm_gmtoff;
135 ])
136 ],
137 osmo_cv_tm_includes_tm_gmtoff=yes,
138 osmo_cv_tm_includes_tm_gmtoff=no
139 )]
140 )
141 if test "x$osmo_cv_tm_includes_tm_gmtoff" = xyes; then
142 AC_DEFINE(HAVE_TM_GMTOFF_IN_TM, 1,
143 [Define if struct tm has tm_gmtoff member.])
144 fi
145])
146
147CHECK_TM_INCLUDES_TM_GMTOFF
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000148
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200149AC_ARG_ENABLE([vty_tests],
150 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200151 [Include the VTY/CTRL tests in make check (deprecated)
152 [default=no]]),
153 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200154AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200155 AC_HELP_STRING([--enable-external-tests],
156 [Include the VTY/CTRL tests in make check [default=no]]),
157 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
158if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200159 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200160 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
161 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
162 AC_MSG_ERROR([Please install osmocom-python to run the VTY/CTRL tests.])
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200163 fi
164fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200165AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
166AC_MSG_RESULT([$enable_ext_tests])
167AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200168
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000169dnl Generate the output
170AM_CONFIG_HEADER(bscconfig.h)
171
Holger Freyther5f755982008-12-27 09:42:59 +0000172AC_OUTPUT(
Holger Freytherc7aa3c42009-06-08 10:32:39 +0000173 openbsc.pc
Holger Freyther5f755982008-12-27 09:42:59 +0000174 include/openbsc/Makefile
175 include/Makefile
176 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100177 src/libtrau/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100178 src/libbsc/Makefile
179 src/libmsc/Makefile
180 src/libmgcp/Makefile
181 src/libcommon/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200182 src/libfilter/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100183 src/osmo-nitb/Makefile
184 src/osmo-bsc/Makefile
Harald Weltea17faf82011-03-03 23:36:48 +0100185 src/osmo-bsc_nat/Makefile
186 src/osmo-bsc_mgcp/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100187 src/ipaccess/Makefile
188 src/utils/Makefile
189 src/gprs/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000190 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100191 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000192 tests/gsm0408/Makefile
Holger Freytherdbede4e2008-12-31 23:25:05 +0000193 tests/db/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200194 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200195 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800196 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200197 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freyther9f239a22011-01-06 19:32:52 +0100198 tests/mgcp/Makefile
Holger Hans Peter Freytherfaf1f642011-06-23 17:53:27 -0400199 tests/gprs/Makefile
Jacob Erlbeck51a869c2013-10-15 12:00:26 +0200200 tests/gbproxy/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100201 tests/abis/Makefile
Holger Hans Peter Freythera7328a52013-07-13 17:09:56 +0200202 tests/smpp/Makefile
Andreas Eversbergd074f8f2013-12-06 16:59:10 +0100203 tests/trau/Makefile
Holger Hans Peter Freyther68c6f882014-09-30 09:10:25 +0200204 tests/sgsn/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100205 tests/subscr/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200206 doc/Makefile
207 doc/examples/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000208 Makefile)