blob: f72b9e1da6fc44aa16a6a2ce622e60dc50450264 [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
Harald Welte1e940d62017-10-28 11:51:07 +020042PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.10.0)
43PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.10.0)
44PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.1.0)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010045
Neels Hofmeyr7c20c9d2017-11-17 01:43:36 +010046AC_ARG_ENABLE(sanitize,
47 [AS_HELP_STRING(
48 [--enable-sanitize],
49 [Compile with address sanitizer enabled],
50 )],
51 [sanitize=$enableval], [sanitize="no"])
52if test x"$sanitize" = x"yes"
53then
54 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
55 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
56fi
57
Jacob Erlbeck239a8532014-03-13 14:25:51 +010058# Enable/disable transcoding within osmo-bsc_mgcp?
59AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
60 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
61AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
62
63if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Neels Hofmeyrf8e02aa2016-06-15 14:43:20 +020064 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 +020065 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck239a8532014-03-13 14:25:51 +010066 if test "$osmo_ac_with_g729" = "yes" ; then
67 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
68 fi
69 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
70fi
71AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
72AC_SUBST(osmo_ac_mgcp_transcoding)
73
Harald Weltede729a12008-12-23 21:01:25 +000074dnl Checks for typedefs, structures and compiler characteristics
75
Holger Freyther6d9f77a2009-06-08 10:32:54 +000076# The following test is taken from WebKit's webkit.m4
77saved_CFLAGS="$CFLAGS"
78CFLAGS="$CFLAGS -fvisibility=hidden "
79AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +020080AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +000081 [ AC_MSG_RESULT([yes])
82 SYMBOL_VISIBILITY="-fvisibility=hidden"],
83 AC_MSG_RESULT([no]))
84CFLAGS="$saved_CFLAGS"
85AC_SUBST(SYMBOL_VISIBILITY)
86
Max34f01262017-01-20 13:03:03 +010087AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
88AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
89AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
90AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
91AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
92AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
93
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +010094# Coverage build taken from WebKit's configure.in
95AC_MSG_CHECKING([whether to enable code coverage support])
96AC_ARG_ENABLE(coverage,
97 AC_HELP_STRING([--enable-coverage],
98 [enable code coverage support [default=no]]),
99 [],[enable_coverage="no"])
100AC_MSG_RESULT([$enable_coverage])
101if test "$enable_coverage" = "yes"; then
102 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
103 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
104 AC_SUBST([COVERAGE_CFLAGS])
105 AC_SUBST([COVERAGE_LDFLAGS])
106fi
107
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200108AC_ARG_ENABLE([vty_tests],
109 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200110 [Include the VTY/CTRL tests in make check (deprecated)
111 [default=no]]),
112 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200113AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200114 AC_HELP_STRING([--enable-external-tests],
115 [Include the VTY/CTRL tests in make check [default=no]]),
116 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
117if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200118 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200119 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
120 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyrb6cd7932017-07-20 23:01:45 +0200121 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 +0200122 fi
123fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200124AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
125AC_MSG_RESULT([$enable_ext_tests])
126AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200127
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000128dnl Generate the output
129AM_CONFIG_HEADER(bscconfig.h)
130
Holger Freyther5f755982008-12-27 09:42:59 +0000131AC_OUTPUT(
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200132 libosmo-legacy-mgcp.pc
Neels Hofmeyr97df6912017-09-03 23:52:51 +0200133 libosmo-mgcp-client.pc
Philipp Maier87bd9be2017-08-22 16:35:41 +0200134 libosmo-mgcp.pc
Holger Freyther5f755982008-12-27 09:42:59 +0000135 include/Makefile
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200136 include/osmocom/Makefile
137 include/osmocom/legacy_mgcp/Makefile
Neels Hofmeyr97df6912017-09-03 23:52:51 +0200138 include/osmocom/mgcp_client/Makefile
Philipp Maier87bd9be2017-08-22 16:35:41 +0200139 include/osmocom/mgcp/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000140 src/Makefile
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200141 src/libosmo-legacy-mgcp/Makefile
Neels Hofmeyr97df6912017-09-03 23:52:51 +0200142 src/libosmo-mgcp-client/Makefile
Philipp Maier87bd9be2017-08-22 16:35:41 +0200143 src/libosmo-mgcp/Makefile
Harald Weltea17faf82011-03-03 23:36:48 +0100144 src/osmo-bsc_mgcp/Makefile
Philipp Maier87bd9be2017-08-22 16:35:41 +0200145 src/osmo-mgw/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000146 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100147 tests/atlocal
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200148 tests/legacy_mgcp/Makefile
Neels Hofmeyr97df6912017-09-03 23:52:51 +0200149 tests/mgcp_client/Makefile
Philipp Maier87bd9be2017-08-22 16:35:41 +0200150 tests/mgcp/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200151 doc/Makefile
152 doc/examples/Makefile
Neels Hofmeyrffebe6e2017-07-20 17:57:37 +0200153 contrib/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000154 Makefile)