blob: ccfce19b0e0630cdb4e2728d8d1290b7277fbf3d [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
Pau Espin Pedrol1b11bc82018-05-03 18:40:12 +020042PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0)
43PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0)
44PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.11.0)
45PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0)
46PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.5.0)
47PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.2.0)
48PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 0.9.0)
49PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.9.0)
50PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.3.0)
Philipp Maier65df74d2018-05-02 15:11:01 +020051
52#NOTE: osmo-bsc does not depend on libosmo-legacy-mgcp anymore, but we still
53# need the dependancy for osmo-bsc-nat, which still uses the old API.
Pau Espin Pedrol1b11bc82018-05-03 18:40:12 +020054PKG_CHECK_MODULES(LIBOSMOLEGACYMGCP, libosmo-legacy-mgcp >= 1.3.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010055
Harald Weltede729a12008-12-23 21:01:25 +000056dnl checks for header files
57AC_HEADER_STDC
Max7bb383a2017-05-02 12:59:15 +020058
59found_pcap=yes
60AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no)
61AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes)
Harald Welteca17ef82011-02-05 15:13:27 +010062
Harald Welte7465e4c2012-11-13 07:06:54 +010063found_cdk=yes
64AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
65AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
66
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +010067found_sqlite3=yes
68PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
69AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
70AC_SUBST(found_sqlite3)
71
Harald Weltede729a12008-12-23 21:01:25 +000072
73dnl Checks for typedefs, structures and compiler characteristics
74
Neels Hofmeyr17b773a2017-11-17 01:43:36 +010075AC_ARG_ENABLE(sanitize,
76 [AS_HELP_STRING(
77 [--enable-sanitize],
78 [Compile with address sanitizer enabled],
79 )],
80 [sanitize=$enableval], [sanitize="no"])
81if test x"$sanitize" = x"yes"
82then
83 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
84 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
85fi
86
Neels Hofmeyr1bb55542018-03-05 20:08:43 +010087AC_ARG_ENABLE(werror,
88 [AS_HELP_STRING(
89 [--enable-werror],
90 [Turn all compiler warnings into errors, with exceptions:
91 a) deprecation (allow upstream to mark deprecation without breaking builds);
92 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
93 ]
94 )],
95 [werror=$enableval], [werror="no"])
96if test x"$werror" = x"yes"
97then
98 WERROR_FLAGS="-Werror"
99 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
100 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
101 CFLAGS="$CFLAGS $WERROR_FLAGS"
102 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
103fi
104
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000105# The following test is taken from WebKit's webkit.m4
106saved_CFLAGS="$CFLAGS"
107CFLAGS="$CFLAGS -fvisibility=hidden "
108AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200109AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000110 [ AC_MSG_RESULT([yes])
111 SYMBOL_VISIBILITY="-fvisibility=hidden"],
112 AC_MSG_RESULT([no]))
113CFLAGS="$saved_CFLAGS"
114AC_SUBST(SYMBOL_VISIBILITY)
115
Max34f01262017-01-20 13:03:03 +0100116AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
117AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
118AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
119AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
120AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
121AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
122
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100123# Coverage build taken from WebKit's configure.in
124AC_MSG_CHECKING([whether to enable code coverage support])
125AC_ARG_ENABLE(coverage,
126 AC_HELP_STRING([--enable-coverage],
127 [enable code coverage support [default=no]]),
128 [],[enable_coverage="no"])
129AC_MSG_RESULT([$enable_coverage])
130if test "$enable_coverage" = "yes"; then
131 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
132 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
133 AC_SUBST([COVERAGE_CFLAGS])
134 AC_SUBST([COVERAGE_LDFLAGS])
135fi
136
Max0bd729f2017-12-28 14:33:53 +0100137AC_ARG_ENABLE(profile,
138 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
139 [profile=$enableval], [profile="no"])
140if test x"$profile" = x"yes"
141then
142 CFLAGS="$CFLAGS -pg"
143 CPPFLAGS="$CPPFLAGS -pg"
144fi
145
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200146AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200147 AC_HELP_STRING([--enable-external-tests],
148 [Include the VTY/CTRL tests in make check [default=no]]),
149 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
150if test "x$enable_ext_tests" = "xyes" ; then
Pau Espin Pedrol7e786812017-11-24 12:00:35 +0100151 AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes)
152 if test "x$PYTHON2_AVAIL" != "xyes" ; then
153 AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.])
154 fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200155 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
156 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr178d1372017-07-20 23:01:45 +0200157 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 +0200158 fi
159fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200160AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
161AC_MSG_RESULT([$enable_ext_tests])
162AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200163
Neels Hofmeyr1bb55542018-03-05 20:08:43 +0100164AC_MSG_RESULT([CFLAGS="$CFLAGS"])
165AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
166
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000167dnl Generate the output
168AM_CONFIG_HEADER(bscconfig.h)
169
Holger Freyther5f755982008-12-27 09:42:59 +0000170AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000171 include/Makefile
Neels Hofmeyrc0164792017-09-04 15:15:32 +0200172 include/osmocom/Makefile
173 include/osmocom/bsc/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000174 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100175 src/libbsc/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200176 src/libfilter/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100177 src/osmo-bsc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100178 src/ipaccess/Makefile
179 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000180 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100181 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000182 tests/gsm0408/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200183 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200184 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800185 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200186 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100187 tests/abis/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100188 tests/subscr/Makefile
Philippb4cb8382016-09-29 17:01:57 +0200189 tests/nanobts_omlattr/Makefile
Neels Hofmeyr9eb208f2017-11-07 03:38:28 +0100190 tests/bssap/Makefile
Neels Hofmeyr909e9722017-12-07 03:54:01 +0100191 tests/handover/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200192 doc/Makefile
193 doc/examples/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000194 Makefile)