blob: b7dd0163b613d08bf392aaedc3ce028eb7e8037c [file] [log] [blame]
Harald Weltede729a12008-12-23 21:01:25 +00001dnl Process this file with autoconf to produce a configure script
Harald Welte630df7d2017-09-03 22:29:45 +02002AC_INIT([osmo-bsc],
Harald Welte5a29c7f2010-03-23 00:09:32 +08003 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
Max88d8bcb2017-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
Harald Welteb069f652017-10-28 12:59:20 +020042PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.10.0)
43PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.10.0)
44PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.10.0)
45PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.10.0)
46PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.3.2)
47PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.1.0)
48PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.8.0)
Daniel Willmanncdeb8152015-10-08 16:10:23 +020049PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= 0.9.5)
Harald Welte1861b552017-09-03 20:13:28 +020050PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
Harald Weltef04e9c22017-11-10 11:39:16 +090051PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.2.0)
Philipp Maier39c609b2017-09-27 15:51:34 +020052PKG_CHECK_MODULES(LIBOSMOLEGACYMGCP, libosmo-legacy-mgcp >= 1.0.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010053
Harald Weltede729a12008-12-23 21:01:25 +000054dnl checks for header files
55AC_HEADER_STDC
Max7bb383a2017-05-02 12:59:15 +020056
57found_pcap=yes
58AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no)
59AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes)
Harald Welteca17ef82011-02-05 15:13:27 +010060
Harald Welte7465e4c2012-11-13 07:06:54 +010061found_cdk=yes
62AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
63AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
64
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +010065found_sqlite3=yes
66PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
67AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
68AC_SUBST(found_sqlite3)
69
Harald Weltede729a12008-12-23 21:01:25 +000070
71dnl Checks for typedefs, structures and compiler characteristics
72
Neels Hofmeyr17b773a2017-11-17 01:43:36 +010073AC_ARG_ENABLE(sanitize,
74 [AS_HELP_STRING(
75 [--enable-sanitize],
76 [Compile with address sanitizer enabled],
77 )],
78 [sanitize=$enableval], [sanitize="no"])
79if test x"$sanitize" = x"yes"
80then
81 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
82 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
83fi
84
Holger Freyther6d9f77a2009-06-08 10:32:54 +000085# The following test is taken from WebKit's webkit.m4
86saved_CFLAGS="$CFLAGS"
87CFLAGS="$CFLAGS -fvisibility=hidden "
88AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +020089AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +000090 [ AC_MSG_RESULT([yes])
91 SYMBOL_VISIBILITY="-fvisibility=hidden"],
92 AC_MSG_RESULT([no]))
93CFLAGS="$saved_CFLAGS"
94AC_SUBST(SYMBOL_VISIBILITY)
95
Max34f01262017-01-20 13:03:03 +010096AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
97AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
98AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
99AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
100AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
101AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
102
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100103# Coverage build taken from WebKit's configure.in
104AC_MSG_CHECKING([whether to enable code coverage support])
105AC_ARG_ENABLE(coverage,
106 AC_HELP_STRING([--enable-coverage],
107 [enable code coverage support [default=no]]),
108 [],[enable_coverage="no"])
109AC_MSG_RESULT([$enable_coverage])
110if test "$enable_coverage" = "yes"; then
111 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
112 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
113 AC_SUBST([COVERAGE_CFLAGS])
114 AC_SUBST([COVERAGE_LDFLAGS])
115fi
116
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200117AC_ARG_ENABLE([vty_tests],
118 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200119 [Include the VTY/CTRL tests in make check (deprecated)
120 [default=no]]),
121 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200122AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200123 AC_HELP_STRING([--enable-external-tests],
124 [Include the VTY/CTRL tests in make check [default=no]]),
125 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
126if test "x$enable_ext_tests" = "xyes" ; then
Pau Espin Pedrol7e786812017-11-24 12:00:35 +0100127 AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes)
128 if test "x$PYTHON2_AVAIL" != "xyes" ; then
129 AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.])
130 fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200131 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
132 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr178d1372017-07-20 23:01:45 +0200133 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 +0200134 fi
135fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200136AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
137AC_MSG_RESULT([$enable_ext_tests])
138AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200139
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000140dnl Generate the output
141AM_CONFIG_HEADER(bscconfig.h)
142
Holger Freyther5f755982008-12-27 09:42:59 +0000143AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000144 include/Makefile
Neels Hofmeyrc0164792017-09-04 15:15:32 +0200145 include/osmocom/Makefile
146 include/osmocom/bsc/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000147 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100148 src/libtrau/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100149 src/libbsc/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100150 src/libcommon/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200151 src/libfilter/Makefile
Neels Hofmeyrc69ee852016-05-10 12:50:31 +0200152 src/libcommon-cs/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100153 src/osmo-bsc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100154 src/ipaccess/Makefile
155 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000156 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100157 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000158 tests/gsm0408/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200159 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200160 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800161 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200162 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100163 tests/abis/Makefile
Andreas Eversbergd074f8f2013-12-06 16:59:10 +0100164 tests/trau/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100165 tests/subscr/Makefile
Philippb4cb8382016-09-29 17:01:57 +0200166 tests/nanobts_omlattr/Makefile
Neels Hofmeyr9eb208f2017-11-07 03:38:28 +0100167 tests/bssap/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200168 doc/Makefile
169 doc/examples/Makefile
Neels Hofmeyr5809e1e2017-07-20 17:57:37 +0200170 contrib/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000171 Makefile)