blob: b0b0d21066ea20633a0006a1042ad932ab8bc9d6 [file] [log] [blame]
Harald Weltede729a12008-12-23 21:01:25 +00001dnl Process this file with autoconf to produce a configure script
Neels Hofmeyre9920f22017-07-10 15:07:22 +02002AC_INIT([osmo-mgw],
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
Max58cfd252017-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 Pedrol304b3eb2018-07-27 19:05:23 +020042PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.12.0)
43PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.12.0)
44PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.12.0)
45PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.3.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010046
Neels Hofmeyr7c20c9d2017-11-17 01:43:36 +010047AC_ARG_ENABLE(sanitize,
48 [AS_HELP_STRING(
49 [--enable-sanitize],
50 [Compile with address sanitizer enabled],
51 )],
52 [sanitize=$enableval], [sanitize="no"])
53if test x"$sanitize" = x"yes"
54then
55 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
56 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
57fi
58
Neels Hofmeyr4f7613e2018-03-05 20:43:27 +010059AC_ARG_ENABLE(werror,
60 [AS_HELP_STRING(
61 [--enable-werror],
62 [Turn all compiler warnings into errors, with exceptions:
63 a) deprecation (allow upstream to mark deprecation without breaking builds);
64 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
65 ]
66 )],
67 [werror=$enableval], [werror="no"])
68if test x"$werror" = x"yes"
69then
70 WERROR_FLAGS="-Werror"
71 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
72 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
73 CFLAGS="$CFLAGS $WERROR_FLAGS"
74 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
75fi
76
Jacob Erlbeck239a8532014-03-13 14:25:51 +010077# Enable/disable transcoding within osmo-bsc_mgcp?
78AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
79 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
80AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
81
82if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Pau Espin Pedrole547bdd2018-07-28 02:46:12 +020083 AC_CHECK_HEADERS([gsm.h gsm/gsm.h], [osmo_ac_found_gsm_headers=yes])
84 if test "$osmo_ac_found_gsm_headers" != "yes" ; then
85 AC_MSG_ERROR([Unable to find the libgsm headers])
86 fi
87 AC_SUBST(HAVE_GSM_H)
88 AC_SUBST(HAVE_GSM_GSM_H)
89
Neels Hofmeyrf8e02aa2016-06-15 14:43:20 +020090 AC_SEARCH_LIBS([gsm_create], [gsm], [LIBRARY_GSM="$LIBS";LIBS=""], [AC_MSG_ERROR([--enable-mgcp-transcoding: cannot find usable libgsm])])
Holger Hans Peter Freytherb69518f2015-07-02 09:51:31 +020091 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck239a8532014-03-13 14:25:51 +010092 if test "$osmo_ac_with_g729" = "yes" ; then
93 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
94 fi
95 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
96fi
97AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
98AC_SUBST(osmo_ac_mgcp_transcoding)
99
Harald Weltede729a12008-12-23 21:01:25 +0000100dnl Checks for typedefs, structures and compiler characteristics
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
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200134AC_ARG_ENABLE([vty_tests],
135 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200136 [Include the VTY/CTRL tests in make check (deprecated)
137 [default=no]]),
138 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200139AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200140 AC_HELP_STRING([--enable-external-tests],
141 [Include the VTY/CTRL tests in make check [default=no]]),
142 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
143if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200144 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200145 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
146 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyrb6cd7932017-07-20 23:01:45 +0200147 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 +0200148 fi
149fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200150AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
151AC_MSG_RESULT([$enable_ext_tests])
152AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200153
Neels Hofmeyr4f7613e2018-03-05 20:43:27 +0100154AC_MSG_RESULT([CFLAGS="$CFLAGS"])
155AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
156
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000157dnl Generate the output
158AM_CONFIG_HEADER(bscconfig.h)
159
Holger Freyther5f755982008-12-27 09:42:59 +0000160AC_OUTPUT(
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200161 libosmo-legacy-mgcp.pc
Neels Hofmeyr97df6912017-09-03 23:52:51 +0200162 libosmo-mgcp-client.pc
Holger Freyther5f755982008-12-27 09:42:59 +0000163 include/Makefile
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200164 include/osmocom/Makefile
165 include/osmocom/legacy_mgcp/Makefile
Neels Hofmeyr97df6912017-09-03 23:52:51 +0200166 include/osmocom/mgcp_client/Makefile
Philipp Maier87bd9be2017-08-22 16:35:41 +0200167 include/osmocom/mgcp/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000168 src/Makefile
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200169 src/libosmo-legacy-mgcp/Makefile
Neels Hofmeyr97df6912017-09-03 23:52:51 +0200170 src/libosmo-mgcp-client/Makefile
Philipp Maier87bd9be2017-08-22 16:35:41 +0200171 src/libosmo-mgcp/Makefile
Harald Weltea17faf82011-03-03 23:36:48 +0100172 src/osmo-bsc_mgcp/Makefile
Philipp Maier87bd9be2017-08-22 16:35:41 +0200173 src/osmo-mgw/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000174 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100175 tests/atlocal
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200176 tests/legacy_mgcp/Makefile
Neels Hofmeyr97df6912017-09-03 23:52:51 +0200177 tests/mgcp_client/Makefile
Philipp Maier87bd9be2017-08-22 16:35:41 +0200178 tests/mgcp/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200179 doc/Makefile
180 doc/examples/Makefile
Neels Hofmeyrffebe6e2017-07-20 17:57:37 +0200181 contrib/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000182 Makefile)