blob: 5482b8c077574c3b02a46862256466b48759d508 [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
Neels Hofmeyref022782016-12-08 21:28:29 +010042PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5)
Harald Welteef466d42011-05-08 09:41:45 +020043PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Pablo Neira Ayusocab6e752014-02-05 18:56:17 +010044PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1)
Holger Hans Peter Freyther25b70ce2012-12-20 23:49:24 +010045
Jacob Erlbeck239a8532014-03-13 14:25:51 +010046# Enable/disable transcoding within osmo-bsc_mgcp?
47AC_ARG_ENABLE([mgcp-transcoding], [AS_HELP_STRING([--enable-mgcp-transcoding], [Build the MGCP gateway with internal transcoding enabled.])],
48 [osmo_ac_mgcp_transcoding="$enableval"],[osmo_ac_mgcp_transcoding="no"])
49AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"])
50
51if test "$osmo_ac_mgcp_transcoding" = "yes" ; then
Neels Hofmeyrf8e02aa2016-06-15 14:43:20 +020052 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 +020053 AC_SUBST(LIBRARY_GSM)
Jacob Erlbeck239a8532014-03-13 14:25:51 +010054 if test "$osmo_ac_with_g729" = "yes" ; then
55 PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 0.1, [AC_DEFINE([HAVE_BCG729], [1], [Use bgc729 decoder/encoder])])
56 fi
57 AC_DEFINE(BUILD_MGCP_TRANSCODING, 1, [Define if we want to build the MGCP gateway with transcoding support])
58fi
59AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes")
60AC_SUBST(osmo_ac_mgcp_transcoding)
61
Harald Weltede729a12008-12-23 21:01:25 +000062dnl Checks for typedefs, structures and compiler characteristics
63
Holger Freyther6d9f77a2009-06-08 10:32:54 +000064# The following test is taken from WebKit's webkit.m4
65saved_CFLAGS="$CFLAGS"
66CFLAGS="$CFLAGS -fvisibility=hidden "
67AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
Alexander Huemerdb1bd692011-05-24 15:16:54 +020068AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
Holger Freyther6d9f77a2009-06-08 10:32:54 +000069 [ AC_MSG_RESULT([yes])
70 SYMBOL_VISIBILITY="-fvisibility=hidden"],
71 AC_MSG_RESULT([no]))
72CFLAGS="$saved_CFLAGS"
73AC_SUBST(SYMBOL_VISIBILITY)
74
Max34f01262017-01-20 13:03:03 +010075AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
76AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
77AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
78AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
79AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
80AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
81
Holger Hans Peter Freytherecd94a42010-11-15 18:37:57 +010082# Coverage build taken from WebKit's configure.in
83AC_MSG_CHECKING([whether to enable code coverage support])
84AC_ARG_ENABLE(coverage,
85 AC_HELP_STRING([--enable-coverage],
86 [enable code coverage support [default=no]]),
87 [],[enable_coverage="no"])
88AC_MSG_RESULT([$enable_coverage])
89if test "$enable_coverage" = "yes"; then
90 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
91 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
92 AC_SUBST([COVERAGE_CFLAGS])
93 AC_SUBST([COVERAGE_LDFLAGS])
94fi
95
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +020096AC_ARG_ENABLE([vty_tests],
97 AC_HELP_STRING([--enable-vty-tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +020098 [Include the VTY/CTRL tests in make check (deprecated)
99 [default=no]]),
100 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
Pablo Neira Ayuso92240102014-09-01 09:34:07 +0200101AC_ARG_ENABLE([external_tests],
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200102 AC_HELP_STRING([--enable-external-tests],
103 [Include the VTY/CTRL tests in make check [default=no]]),
104 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
105if test "x$enable_ext_tests" = "xyes" ; then
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200106 AM_PATH_PYTHON
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200107 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
108 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
Neels Hofmeyrb6cd7932017-07-20 23:01:45 +0200109 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 +0200110 fi
111fi
Holger Hans Peter Freytherdd588ae2014-08-22 00:29:04 +0200112AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
113AC_MSG_RESULT([$enable_ext_tests])
114AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Katerina Barone-Adesie0aee7a2013-04-05 17:36:09 +0200115
Holger Freyther6d9f77a2009-06-08 10:32:54 +0000116dnl Generate the output
117AM_CONFIG_HEADER(bscconfig.h)
118
Holger Freyther5f755982008-12-27 09:42:59 +0000119AC_OUTPUT(
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200120 libosmo-legacy-mgcp.pc
Holger Freyther5f755982008-12-27 09:42:59 +0000121 include/Makefile
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200122 include/osmocom/Makefile
123 include/osmocom/legacy_mgcp/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000124 src/Makefile
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200125 src/libosmo-legacy-mgcp/Makefile
Harald Weltea17faf82011-03-03 23:36:48 +0100126 src/osmo-bsc_mgcp/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000127 tests/Makefile
Holger Hans Peter Freyther93ef33e2012-01-09 22:53:04 +0100128 tests/atlocal
Neels Hofmeyre9920f22017-07-10 15:07:22 +0200129 tests/legacy_mgcp/Makefile
Harald Welteeb113132011-05-11 22:11:28 +0200130 doc/Makefile
131 doc/examples/Makefile
Neels Hofmeyrffebe6e2017-07-20 17:57:37 +0200132 contrib/Makefile
Holger Freyther5f755982008-12-27 09:42:59 +0000133 Makefile)