blob: 433e3bff32f5cf05e9049aae0edfe4c68fa1f219 [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)
Harald Welte1861b552017-09-03 20:13:28 +020049PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.2)
Harald Weltef04e9c22017-11-10 11:39:16 +090050PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.2.0)
Philipp Maier39c609b2017-09-27 15:51:34 +020051PKG_CHECK_MODULES(LIBOSMOLEGACYMGCP, libosmo-legacy-mgcp >= 1.0.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010052
Harald Weltede729a12008-12-23 21:01:25 +000053dnl checks for header files
54AC_HEADER_STDC
Max7bb383a2017-05-02 12:59:15 +020055
56found_pcap=yes
57AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no)
58AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes)
Harald Welteca17ef82011-02-05 15:13:27 +010059
Harald Welte7465e4c2012-11-13 07:06:54 +010060found_cdk=yes
61AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
62AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
63
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +010064found_sqlite3=yes
65PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
66AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
67AC_SUBST(found_sqlite3)
68
Harald Weltede729a12008-12-23 21:01:25 +000069
70dnl Checks for typedefs, structures and compiler characteristics
71
Neels Hofmeyr17b773a2017-11-17 01:43:36 +010072AC_ARG_ENABLE(sanitize,
73 [AS_HELP_STRING(
74 [--enable-sanitize],
75 [Compile with address sanitizer enabled],
76 )],
77 [sanitize=$enableval], [sanitize="no"])
78if test x"$sanitize" = x"yes"
79then
80 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
81 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
82fi
83
Holger Freyther6d9f77a2009-06-08 10:32:54 +000084# The following test is taken from WebKit's webkit.m4
85saved_CFLAGS="$CFLAGS"
86CFLAGS="$CFLAGS -fvisibility=hidden "
87AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +020088AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +000089 [ AC_MSG_RESULT([yes])
90 SYMBOL_VISIBILITY="-fvisibility=hidden"],
91 AC_MSG_RESULT([no]))
92CFLAGS="$saved_CFLAGS"
93AC_SUBST(SYMBOL_VISIBILITY)
94
Max34f01262017-01-20 13:03:03 +010095AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
96AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
97AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
98AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
99AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
100AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
101
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100102# Coverage build taken from WebKit's configure.in
103AC_MSG_CHECKING([whether to enable code coverage support])
104AC_ARG_ENABLE(coverage,
105 AC_HELP_STRING([--enable-coverage],
106 [enable code coverage support [default=no]]),
107 [],[enable_coverage="no"])
108AC_MSG_RESULT([$enable_coverage])
109if test "$enable_coverage" = "yes"; then
110 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
111 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
112 AC_SUBST([COVERAGE_CFLAGS])
113 AC_SUBST([COVERAGE_LDFLAGS])
114fi
115
Max0bd729f2017-12-28 14:33:53 +0100116AC_ARG_ENABLE(profile,
117 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
118 [profile=$enableval], [profile="no"])
119if test x"$profile" = x"yes"
120then
121 CFLAGS="$CFLAGS -pg"
122 CPPFLAGS="$CPPFLAGS -pg"
123fi
124
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200125AC_ARG_ENABLE([vty_tests],
126 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200127 [Include the VTY/CTRL tests in make check (deprecated)
128 [default=no]]),
129 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200130AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200131 AC_HELP_STRING([--enable-external-tests],
132 [Include the VTY/CTRL tests in make check [default=no]]),
133 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
134if test "x$enable_ext_tests" = "xyes" ; then
Pau Espin Pedrol7e786812017-11-24 12:00:35 +0100135 AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes)
136 if test "x$PYTHON2_AVAIL" != "xyes" ; then
137 AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.])
138 fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200139 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
140 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr178d1372017-07-20 23:01:45 +0200141 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 +0200142 fi
143fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200144AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
145AC_MSG_RESULT([$enable_ext_tests])
146AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200147
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000148dnl Generate the output
149AM_CONFIG_HEADER(bscconfig.h)
150
Holger Freyther5f755982008-12-27 09:42:59 +0000151AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000152 include/Makefile
Neels Hofmeyrc0164792017-09-04 15:15:32 +0200153 include/osmocom/Makefile
154 include/osmocom/bsc/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000155 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100156 src/libbsc/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100157 src/libcommon/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200158 src/libfilter/Makefile
Neels Hofmeyrc69ee852016-05-10 12:50:31 +0200159 src/libcommon-cs/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100160 src/osmo-bsc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100161 src/ipaccess/Makefile
162 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000163 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100164 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000165 tests/gsm0408/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200166 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200167 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800168 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200169 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100170 tests/abis/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100171 tests/subscr/Makefile
Philippb4cb8382016-09-29 17:01:57 +0200172 tests/nanobts_omlattr/Makefile
Neels Hofmeyr9eb208f2017-11-07 03:38:28 +0100173 tests/bssap/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200174 doc/Makefile
175 doc/examples/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000176 Makefile)