Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script |
Neels Hofmeyr | e9920f2 | 2017-07-10 15:07:22 +0200 | [diff] [blame] | 2 | AC_INIT([osmo-mgw], |
Harald Welte | 5a29c7f | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 3 | m4_esyscmd([./git-version-gen .tarball-version]), |
Holger Hans Peter Freyther | 47d8f02 | 2014-05-15 12:26:16 +0200 | [diff] [blame] | 4 | [openbsc@lists.osmocom.org]) |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 5 | |
Neels Hofmeyr | b810312 | 2016-10-01 00:34:31 +0200 | [diff] [blame] | 6 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 7 | AC_CONFIG_AUX_DIR([.]) |
| 8 | |
Harald Welte | 5a29c7f | 2010-03-23 00:09:32 +0800 | [diff] [blame] | 9 | AM_INIT_AUTOMAKE([dist-bzip2]) |
Holger Hans Peter Freyther | 6c88217 | 2012-01-06 15:16:12 +0100 | [diff] [blame] | 10 | AC_CONFIG_TESTDIR(tests) |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 11 | |
Holger Hans Peter Freyther | 1f59ac4 | 2009-10-27 03:34:49 +0100 | [diff] [blame] | 12 | dnl kernel style compile messages |
| 13 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 14 | |
Max | 58cfd25 | 2017-08-28 12:04:18 +0200 | [diff] [blame] | 15 | dnl include release helper |
| 16 | RELMAKE='-include osmo-release.mk' |
| 17 | AC_SUBST([RELMAKE]) |
| 18 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 19 | dnl checks for programs |
| 20 | AC_PROG_MAKE_SET |
| 21 | AC_PROG_CC |
| 22 | AC_PROG_INSTALL |
Max | eab5f59 | 2017-05-26 12:31:00 +0200 | [diff] [blame] | 23 | LT_INIT |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 24 | |
Neels Hofmeyr | a8f91df | 2016-10-01 00:50:25 +0200 | [diff] [blame] | 25 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 26 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 27 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 28 | AC_MSG_WARN([You need to install pkg-config]) |
| 29 | fi |
| 30 | PKG_PROG_PKG_CONFIG([0.20]) |
| 31 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 32 | dnl check for AX_CHECK_COMPILE_FLAG |
| 33 | m4_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 Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 37 | dnl checks for libraries |
Jacob Erlbeck | 51a869c | 2013-10-15 12:00:26 +0200 | [diff] [blame] | 38 | AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""]) |
| 39 | AC_SUBST(LIBRARY_DL) |
| 40 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 41 | |
Neels Hofmeyr | ef02278 | 2016-12-08 21:28:29 +0100 | [diff] [blame] | 42 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.9.5) |
Harald Welte | ef466d4 | 2011-05-08 09:41:45 +0200 | [diff] [blame] | 43 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) |
Pablo Neira Ayuso | cab6e75 | 2014-02-05 18:56:17 +0100 | [diff] [blame] | 44 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.0.1) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 45 | |
Jacob Erlbeck | 239a853 | 2014-03-13 14:25:51 +0100 | [diff] [blame] | 46 | # Enable/disable transcoding within osmo-bsc_mgcp? |
| 47 | AC_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"]) |
| 49 | AC_ARG_WITH([g729], [AS_HELP_STRING([--with-g729], [Enable G.729 encoding/decoding.])], [osmo_ac_with_g729="$withval"],[osmo_ac_with_g729="no"]) |
| 50 | |
| 51 | if test "$osmo_ac_mgcp_transcoding" = "yes" ; then |
Neels Hofmeyr | f8e02aa | 2016-06-15 14:43:20 +0200 | [diff] [blame] | 52 | AC_SEARCH_LIBS([gsm_create], [gsm], [LIBRARY_GSM="$LIBS";LIBS=""], [AC_MSG_ERROR([--enable-mgcp-transcoding: cannot find usable libgsm])]) |
Holger Hans Peter Freyther | b69518f | 2015-07-02 09:51:31 +0200 | [diff] [blame] | 53 | AC_SUBST(LIBRARY_GSM) |
Jacob Erlbeck | 239a853 | 2014-03-13 14:25:51 +0100 | [diff] [blame] | 54 | 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]) |
| 58 | fi |
| 59 | AM_CONDITIONAL(BUILD_MGCP_TRANSCODING, test "x$osmo_ac_mgcp_transcoding" = "xyes") |
| 60 | AC_SUBST(osmo_ac_mgcp_transcoding) |
| 61 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 62 | dnl Checks for typedefs, structures and compiler characteristics |
| 63 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 64 | # The following test is taken from WebKit's webkit.m4 |
| 65 | saved_CFLAGS="$CFLAGS" |
| 66 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 67 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Alexander Huemer | db1bd69 | 2011-05-24 15:16:54 +0200 | [diff] [blame] | 68 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 69 | [ AC_MSG_RESULT([yes]) |
| 70 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 71 | AC_MSG_RESULT([no])) |
| 72 | CFLAGS="$saved_CFLAGS" |
| 73 | AC_SUBST(SYMBOL_VISIBILITY) |
| 74 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 75 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 76 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 77 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
| 78 | AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"]) |
| 79 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 80 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 81 | |
Holger Hans Peter Freyther | ecd94a4 | 2010-11-15 18:37:57 +0100 | [diff] [blame] | 82 | # Coverage build taken from WebKit's configure.in |
| 83 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 84 | AC_ARG_ENABLE(coverage, |
| 85 | AC_HELP_STRING([--enable-coverage], |
| 86 | [enable code coverage support [default=no]]), |
| 87 | [],[enable_coverage="no"]) |
| 88 | AC_MSG_RESULT([$enable_coverage]) |
| 89 | if 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]) |
| 94 | fi |
| 95 | |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 96 | AC_ARG_ENABLE([vty_tests], |
| 97 | AC_HELP_STRING([--enable-vty-tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 98 | [Include the VTY/CTRL tests in make check (deprecated) |
| 99 | [default=no]]), |
| 100 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
Pablo Neira Ayuso | 9224010 | 2014-09-01 09:34:07 +0200 | [diff] [blame] | 101 | AC_ARG_ENABLE([external_tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 102 | 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"]) |
| 105 | if test "x$enable_ext_tests" = "xyes" ; then |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 106 | AM_PATH_PYTHON |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 107 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 108 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
Neels Hofmeyr | b6cd793 | 2017-07-20 23:01:45 +0200 | [diff] [blame] | 109 | AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.]) |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 110 | fi |
| 111 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 112 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 113 | AC_MSG_RESULT([$enable_ext_tests]) |
| 114 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 115 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 116 | dnl Generate the output |
| 117 | AM_CONFIG_HEADER(bscconfig.h) |
| 118 | |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 119 | AC_OUTPUT( |
Neels Hofmeyr | e9920f2 | 2017-07-10 15:07:22 +0200 | [diff] [blame] | 120 | libosmo-legacy-mgcp.pc |
Neels Hofmeyr | 97df691 | 2017-09-03 23:52:51 +0200 | [diff] [blame] | 121 | libosmo-mgcp-client.pc |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 122 | include/Makefile |
Neels Hofmeyr | e9920f2 | 2017-07-10 15:07:22 +0200 | [diff] [blame] | 123 | include/osmocom/Makefile |
| 124 | include/osmocom/legacy_mgcp/Makefile |
Neels Hofmeyr | 97df691 | 2017-09-03 23:52:51 +0200 | [diff] [blame] | 125 | include/osmocom/mgcp_client/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 126 | src/Makefile |
Neels Hofmeyr | e9920f2 | 2017-07-10 15:07:22 +0200 | [diff] [blame] | 127 | src/libosmo-legacy-mgcp/Makefile |
Neels Hofmeyr | 97df691 | 2017-09-03 23:52:51 +0200 | [diff] [blame] | 128 | src/libosmo-mgcp-client/Makefile |
Harald Welte | a17faf8 | 2011-03-03 23:36:48 +0100 | [diff] [blame] | 129 | src/osmo-bsc_mgcp/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 130 | tests/Makefile |
Holger Hans Peter Freyther | 93ef33e | 2012-01-09 22:53:04 +0100 | [diff] [blame] | 131 | tests/atlocal |
Neels Hofmeyr | e9920f2 | 2017-07-10 15:07:22 +0200 | [diff] [blame] | 132 | tests/legacy_mgcp/Makefile |
Neels Hofmeyr | 97df691 | 2017-09-03 23:52:51 +0200 | [diff] [blame] | 133 | tests/mgcp_client/Makefile |
Harald Welte | eb11313 | 2011-05-11 22:11:28 +0200 | [diff] [blame] | 134 | doc/Makefile |
| 135 | doc/examples/Makefile |
Neels Hofmeyr | ffebe6e | 2017-07-20 17:57:37 +0200 | [diff] [blame] | 136 | contrib/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 137 | Makefile) |