blob: c74402a1bd98438aa5f987d474edc83784904415 [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
Neels Hofmeyr1bb55542018-03-05 20:08:43 +010084AC_ARG_ENABLE(werror,
85 [AS_HELP_STRING(
86 [--enable-werror],
87 [Turn all compiler warnings into errors, with exceptions:
88 a) deprecation (allow upstream to mark deprecation without breaking builds);
89 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
90 ]
91 )],
92 [werror=$enableval], [werror="no"])
93if test x"$werror" = x"yes"
94then
95 WERROR_FLAGS="-Werror"
96 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
97 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
98 CFLAGS="$CFLAGS $WERROR_FLAGS"
99 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
100fi
101
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000102# The following test is taken from WebKit's webkit.m4
103saved_CFLAGS="$CFLAGS"
104CFLAGS="$CFLAGS -fvisibility=hidden "
105AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +0200106AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000107 [ AC_MSG_RESULT([yes])
108 SYMBOL_VISIBILITY="-fvisibility=hidden"],
109 AC_MSG_RESULT([no]))
110CFLAGS="$saved_CFLAGS"
111AC_SUBST(SYMBOL_VISIBILITY)
112
Max34f01262017-01-20 13:03:03 +0100113AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
114AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
115AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
116AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
117AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
118AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
119
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +0100120# Coverage build taken from WebKit's configure.in
121AC_MSG_CHECKING([whether to enable code coverage support])
122AC_ARG_ENABLE(coverage,
123 AC_HELP_STRING([--enable-coverage],
124 [enable code coverage support [default=no]]),
125 [],[enable_coverage="no"])
126AC_MSG_RESULT([$enable_coverage])
127if test "$enable_coverage" = "yes"; then
128 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
129 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
130 AC_SUBST([COVERAGE_CFLAGS])
131 AC_SUBST([COVERAGE_LDFLAGS])
132fi
133
Max0bd729f2017-12-28 14:33:53 +0100134AC_ARG_ENABLE(profile,
135 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
136 [profile=$enableval], [profile="no"])
137if test x"$profile" = x"yes"
138then
139 CFLAGS="$CFLAGS -pg"
140 CPPFLAGS="$CPPFLAGS -pg"
141fi
142
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200143AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200144 AC_HELP_STRING([--enable-external-tests],
145 [Include the VTY/CTRL tests in make check [default=no]]),
146 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
147if test "x$enable_ext_tests" = "xyes" ; then
Pau Espin Pedrol7e786812017-11-24 12:00:35 +0100148 AC_CHECK_PROG(PYTHON2_AVAIL,python2,yes)
149 if test "x$PYTHON2_AVAIL" != "xyes" ; then
150 AC_MSG_ERROR([Please install python2 to run the VTY/CTRL tests.])
151 fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200152 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
153 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyr178d1372017-07-20 23:01:45 +0200154 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 +0200155 fi
156fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200157AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
158AC_MSG_RESULT([$enable_ext_tests])
159AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200160
Neels Hofmeyr1bb55542018-03-05 20:08:43 +0100161AC_MSG_RESULT([CFLAGS="$CFLAGS"])
162AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
163
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000164dnl Generate the output
165AM_CONFIG_HEADER(bscconfig.h)
166
Holger Freyther5f755982008-12-27 09:42:59 +0000167AC_OUTPUT(
Holger Freyther5f755982008-12-27 09:42:59 +0000168 include/Makefile
Neels Hofmeyrc0164792017-09-04 15:15:32 +0200169 include/osmocom/Makefile
170 include/osmocom/bsc/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000171 src/Makefile
Harald Welte89579b42011-03-04 13:18:30 +0100172 src/libbsc/Makefile
Holger Hans Peter Freyther4247cea2015-04-04 18:42:46 +0200173 src/libfilter/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100174 src/osmo-bsc/Makefile
Harald Welte31c00f72011-03-03 23:29:05 +0100175 src/ipaccess/Makefile
176 src/utils/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000177 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100178 tests/atlocal
Holger Freytheraa0fb362008-12-28 21:55:40 +0000179 tests/gsm0408/Makefile
Holger Hans Peter Freyther800d29d2009-06-10 12:36:38 +0200180 tests/channel/Makefile
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200181 tests/bsc/Makefile
Holger Hans Peter Freyther28e29882010-06-15 20:21:44 +0800182 tests/bsc-nat/Makefile
Holger Hans Peter Freyther85d3b342013-06-14 19:10:28 +0200183 tests/bsc-nat-trie/Makefile
Holger Hans Peter Freytherbce56752012-11-22 14:59:46 +0100184 tests/abis/Makefile
Jacob Erlbeck0acc0012014-12-03 13:05:16 +0100185 tests/subscr/Makefile
Philippb4cb8382016-09-29 17:01:57 +0200186 tests/nanobts_omlattr/Makefile
Neels Hofmeyr9eb208f2017-11-07 03:38:28 +0100187 tests/bssap/Makefile
Neels Hofmeyr909e9722017-12-07 03:54:01 +0100188 tests/handover/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200189 doc/Makefile
190 doc/examples/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000191 Makefile)