blob: 62a7dd06d751e46921f3a58469c4951967eb82a9 [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
Harald Weltede729a12008-12-23 21:01:25 +000052dnl checks for header files
53AC_HEADER_STDC
Max7bb383a2017-05-02 12:59:15 +020054
55found_pcap=yes
56AC_CHECK_HEADERS(pcap/pcap.h,,found_pcap=no)
57AM_CONDITIONAL(HAVE_PCAP, test "$found_pcap" = yes)
Harald Welteca17ef82011-02-05 15:13:27 +010058
Harald Welte7465e4c2012-11-13 07:06:54 +010059found_cdk=yes
60AC_CHECK_HEADERS(cdk/cdk.h,,found_cdk=no)
61AM_CONDITIONAL(HAVE_LIBCDK, test "$found_cdk" = yes)
62
Holger Hans Peter Freytherbb06eb92015-01-10 09:51:31 +010063found_sqlite3=yes
64PKG_CHECK_MODULES(SQLITE3, sqlite3, ,found_sqlite3=no)
65AM_CONDITIONAL(HAVE_SQLITE3, test "$found_sqlite3" = yes)
66AC_SUBST(found_sqlite3)
67
Harald Weltede729a12008-12-23 21:01:25 +000068
69dnl Checks for typedefs, structures and compiler characteristics
70
Neels Hofmeyr17b773a2017-11-17 01:43:36 +010071AC_ARG_ENABLE(sanitize,
72 [AS_HELP_STRING(
73 [--enable-sanitize],
74 [Compile with address sanitizer enabled],
75 )],
76 [sanitize=$enableval], [sanitize="no"])
77if test x"$sanitize" = x"yes"
78then
79 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
80 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
81fi
82
Neels Hofmeyr1bb55542018-03-05 20:08:43 +010083AC_ARG_ENABLE(werror,
84 [AS_HELP_STRING(
85 [--enable-werror],
86 [Turn all compiler warnings into errors, with exceptions:
87 a) deprecation (allow upstream to mark deprecation without breaking builds);
88 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
89 ]
90 )],
91 [werror=$enableval], [werror="no"])
92if test x"$werror" = x"yes"
93then
94 WERROR_FLAGS="-Werror"
95 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
96 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
97 CFLAGS="$CFLAGS $WERROR_FLAGS"
98 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
99fi
100
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000101# The following test is taken from WebKit's webkit.m4
102saved_CFLAGS="$CFLAGS"
103CFLAGS="$CFLAGS -fvisibility=hidden "
104AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200105AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000106 [ AC_MSG_RESULT([yes])
107 SYMBOL_VISIBILITY="-fvisibility=hidden"],
108 AC_MSG_RESULT([no]))
109CFLAGS="$saved_CFLAGS"
110AC_SUBST(SYMBOL_VISIBILITY)
111
Max34f01262017-01-20 13:03:03 +0100112AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
113AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
114AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
115AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
116AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
117AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
118
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100119# Coverage build taken from WebKit's configure.in
120AC_MSG_CHECKING([whether to enable code coverage support])
121AC_ARG_ENABLE(coverage,
122 AC_HELP_STRING([--enable-coverage],
123 [enable code coverage support [default=no]]),
124 [],[enable_coverage="no"])
125AC_MSG_RESULT([$enable_coverage])
126if test "$enable_coverage" = "yes"; then
127 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
128 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
129 AC_SUBST([COVERAGE_CFLAGS])
130 AC_SUBST([COVERAGE_LDFLAGS])
131fi
132
Max0bd729f2017-12-28 14:33:53 +0100133AC_ARG_ENABLE(profile,
134 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
135 [profile=$enableval], [profile="no"])
136if test x"$profile" = x"yes"
137then
138 CFLAGS="$CFLAGS -pg"
139 CPPFLAGS="$CPPFLAGS -pg"
140fi
141
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200142AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200143 AC_HELP_STRING([--enable-external-tests],
144 [Include the VTY/CTRL tests in make check [default=no]]),
145 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
146if test "x$enable_ext_tests" = "xyes" ; then
Pau Espin Pedrol7e786812017-11-24 12:00:35 +0100147 AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes)
148 if test "x$PYTHON2_AVAIL" != "xyes" ; then
149 AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.])
150 fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200151 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
152 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr178d1372017-07-20 23:01:45 +0200153 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 +0200154 fi
155fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200156AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
157AC_MSG_RESULT([$enable_ext_tests])
158AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200159
Neels Hofmeyr1bb55542018-03-05 20:08:43 +0100160AC_MSG_RESULT([CFLAGS="$CFLAGS"])
161AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
162
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000163dnl Generate the output
164AM_CONFIG_HEADER(bscconfig.h)
165
Holger Freyther5f755982008-12-27 09:42:59 +0000166AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000167 include/Makefile
Neels Hofmeyrc0164792017-09-04 15:15:32 +0200168 include/osmocom/Makefile
169 include/osmocom/bsc/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000170 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100171 src/libbsc/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200172 src/libfilter/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100173 src/osmo-bsc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100174 src/ipaccess/Makefile
175 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000176 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100177 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000178 tests/gsm0408/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200179 tests/bsc/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100180 tests/abis/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100181 tests/subscr/Makefile
Philippb4cb8382016-09-29 17:01:57 +0200182 tests/nanobts_omlattr/Makefile
Neels Hofmeyr909e9722017-12-07 03:54:01 +0100183 tests/handover/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200184 doc/Makefile
185 doc/examples/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000186 Makefile)