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 | |
Eric | eebbf2b | 2020-04-11 00:53:38 +0200 | [diff] [blame] | 25 | dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang |
| 26 | AS_CASE(["$LD"],[*clang*], |
| 27 | [AS_CASE(["${host_os}"], |
| 28 | [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])]) |
| 29 | |
Neels Hofmeyr | a8f91df | 2016-10-01 00:50:25 +0200 | [diff] [blame] | 30 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 31 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 32 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 33 | AC_MSG_WARN([You need to install pkg-config]) |
| 34 | fi |
| 35 | PKG_PROG_PKG_CONFIG([0.20]) |
| 36 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 37 | dnl check for AX_CHECK_COMPILE_FLAG |
| 38 | m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [ |
| 39 | AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.]) |
| 40 | ]) |
| 41 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 42 | dnl checks for libraries |
Jacob Erlbeck | 51a869c | 2013-10-15 12:00:26 +0200 | [diff] [blame] | 43 | AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""]) |
| 44 | AC_SUBST(LIBRARY_DL) |
| 45 | |
Eric | e885bc5 | 2020-04-11 00:52:43 +0200 | [diff] [blame] | 46 | AC_SEARCH_LIBS([dlsym], [dl dld], [LIBRARY_DLSYM="$LIBS";LIBS=""]) |
| 47 | AC_SUBST(LIBRARY_DLSYM) |
| 48 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 49 | |
Pau Espin Pedrol | ec45068 | 2020-01-03 13:35:10 +0100 | [diff] [blame] | 50 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.1.0) |
| 51 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.1.0) |
Harald Welte | 9852e22 | 2020-03-08 10:22:14 +0100 | [diff] [blame] | 52 | PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.1.0) |
Pau Espin Pedrol | ec45068 | 2020-01-03 13:35:10 +0100 | [diff] [blame] | 53 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.1.0) |
Pau Espin Pedrol | a2d1021 | 2019-08-07 16:42:26 +0200 | [diff] [blame] | 54 | PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.6.0) |
Holger Hans Peter Freyther | 25b70ce | 2012-12-20 23:49:24 +0100 | [diff] [blame] | 55 | |
Neels Hofmeyr | 7c20c9d | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 56 | AC_ARG_ENABLE(sanitize, |
| 57 | [AS_HELP_STRING( |
| 58 | [--enable-sanitize], |
| 59 | [Compile with address sanitizer enabled], |
| 60 | )], |
| 61 | [sanitize=$enableval], [sanitize="no"]) |
| 62 | if test x"$sanitize" = x"yes" |
| 63 | then |
| 64 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 65 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 66 | fi |
| 67 | |
Neels Hofmeyr | 4f7613e | 2018-03-05 20:43:27 +0100 | [diff] [blame] | 68 | AC_ARG_ENABLE(werror, |
| 69 | [AS_HELP_STRING( |
| 70 | [--enable-werror], |
| 71 | [Turn all compiler warnings into errors, with exceptions: |
| 72 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 73 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 74 | ] |
| 75 | )], |
| 76 | [werror=$enableval], [werror="no"]) |
| 77 | if test x"$werror" = x"yes" |
| 78 | then |
| 79 | WERROR_FLAGS="-Werror" |
| 80 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 81 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 82 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 83 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 84 | fi |
| 85 | |
Harald Welte | de729a1 | 2008-12-23 21:01:25 +0000 | [diff] [blame] | 86 | dnl Checks for typedefs, structures and compiler characteristics |
| 87 | |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 88 | AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"]) |
| 89 | AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"]) |
| 90 | AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"]) |
Hoernchen | 199c5e9 | 2019-07-19 00:49:22 +0200 | [diff] [blame] | 91 | AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [CFLAGS="$CFLAGS -Wnull-dereference"]) |
Max | 34f0126 | 2017-01-20 13:03:03 +0100 | [diff] [blame] | 92 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"]) |
| 93 | AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"]) |
| 94 | |
Holger Hans Peter Freyther | ecd94a4 | 2010-11-15 18:37:57 +0100 | [diff] [blame] | 95 | # Coverage build taken from WebKit's configure.in |
| 96 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 97 | AC_ARG_ENABLE(coverage, |
| 98 | AC_HELP_STRING([--enable-coverage], |
| 99 | [enable code coverage support [default=no]]), |
| 100 | [],[enable_coverage="no"]) |
| 101 | AC_MSG_RESULT([$enable_coverage]) |
| 102 | if test "$enable_coverage" = "yes"; then |
| 103 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 104 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 105 | AC_SUBST([COVERAGE_CFLAGS]) |
| 106 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 107 | fi |
| 108 | |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 109 | AC_ARG_ENABLE([vty_tests], |
| 110 | AC_HELP_STRING([--enable-vty-tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 111 | [Include the VTY/CTRL tests in make check (deprecated) |
| 112 | [default=no]]), |
| 113 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
Pablo Neira Ayuso | 9224010 | 2014-09-01 09:34:07 +0200 | [diff] [blame] | 114 | AC_ARG_ENABLE([external_tests], |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 115 | AC_HELP_STRING([--enable-external-tests], |
| 116 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 117 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 118 | if test "x$enable_ext_tests" = "xyes" ; then |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 119 | AM_PATH_PYTHON |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 120 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 121 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
Neels Hofmeyr | b6cd793 | 2017-07-20 23:01:45 +0200 | [diff] [blame] | 122 | 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] | 123 | fi |
| 124 | fi |
Holger Hans Peter Freyther | dd588ae | 2014-08-22 00:29:04 +0200 | [diff] [blame] | 125 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 126 | AC_MSG_RESULT([$enable_ext_tests]) |
| 127 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Katerina Barone-Adesi | e0aee7a | 2013-04-05 17:36:09 +0200 | [diff] [blame] | 128 | |
Oliver Smith | 7c0b70a | 2018-11-14 10:47:01 +0100 | [diff] [blame] | 129 | # Generate manuals |
| 130 | AC_ARG_ENABLE(manuals, |
| 131 | [AS_HELP_STRING( |
| 132 | [--enable-manuals], |
| 133 | [Generate manual PDFs [default=no]], |
| 134 | )], |
| 135 | [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"]) |
| 136 | AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"]) |
| 137 | AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals" |
| 138 | fallback]) |
| 139 | if test x"$osmo_ac_build_manuals" = x"yes" |
| 140 | then |
| 141 | # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback) |
| 142 | if test -n "$OSMO_GSM_MANUALS_DIR"; then |
| 143 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)" |
| 144 | else |
| 145 | OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)" |
| 146 | if test -n "$OSMO_GSM_MANUALS_DIR"; then |
| 147 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)" |
| 148 | else |
| 149 | OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals" |
| 150 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)" |
| 151 | fi |
| 152 | fi |
| 153 | if ! test -d "$OSMO_GSM_MANUALS_DIR"; then |
| 154 | AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.") |
| 155 | fi |
| 156 | |
| 157 | # Find and run check-depends |
| 158 | CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh" |
| 159 | if ! test -x "$CHECK_DEPENDS"; then |
| 160 | CHECK_DEPENDS="osmo-gsm-manuals-check-depends" |
| 161 | fi |
| 162 | if ! $CHECK_DEPENDS; then |
| 163 | AC_MSG_ERROR("missing dependencies for --enable-manuals") |
| 164 | fi |
| 165 | |
| 166 | # Put in Makefile with absolute path |
| 167 | OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")" |
| 168 | AC_SUBST([OSMO_GSM_MANUALS_DIR]) |
| 169 | fi |
| 170 | |
Pau Espin Pedrol | e686675 | 2018-09-10 12:46:47 +0200 | [diff] [blame] | 171 | # https://www.freedesktop.org/software/systemd/man/daemon.html |
| 172 | AC_ARG_WITH([systemdsystemunitdir], |
| 173 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, |
| 174 | [with_systemdsystemunitdir=auto]) |
| 175 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ |
| 176 | def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 177 | |
| 178 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 179 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 180 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) |
| 181 | with_systemdsystemunitdir=no], |
| 182 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) |
| 183 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 184 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 185 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 186 | |
Neels Hofmeyr | 4f7613e | 2018-03-05 20:43:27 +0100 | [diff] [blame] | 187 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 188 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 189 | |
Holger Freyther | 6d9f77a | 2009-06-08 10:32:54 +0000 | [diff] [blame] | 190 | dnl Generate the output |
| 191 | AM_CONFIG_HEADER(bscconfig.h) |
| 192 | |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 193 | AC_OUTPUT( |
Neels Hofmeyr | 97df691 | 2017-09-03 23:52:51 +0200 | [diff] [blame] | 194 | libosmo-mgcp-client.pc |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 195 | include/Makefile |
Neels Hofmeyr | e9920f2 | 2017-07-10 15:07:22 +0200 | [diff] [blame] | 196 | include/osmocom/Makefile |
Neels Hofmeyr | 97df691 | 2017-09-03 23:52:51 +0200 | [diff] [blame] | 197 | include/osmocom/mgcp_client/Makefile |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 198 | include/osmocom/mgcp/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 199 | src/Makefile |
Neels Hofmeyr | 97df691 | 2017-09-03 23:52:51 +0200 | [diff] [blame] | 200 | src/libosmo-mgcp-client/Makefile |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 201 | src/libosmo-mgcp/Makefile |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 202 | src/osmo-mgw/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 203 | tests/Makefile |
Holger Hans Peter Freyther | 93ef33e | 2012-01-09 22:53:04 +0100 | [diff] [blame] | 204 | tests/atlocal |
Neels Hofmeyr | 97df691 | 2017-09-03 23:52:51 +0200 | [diff] [blame] | 205 | tests/mgcp_client/Makefile |
Philipp Maier | 87bd9be | 2017-08-22 16:35:41 +0200 | [diff] [blame] | 206 | tests/mgcp/Makefile |
Harald Welte | eb11313 | 2011-05-11 22:11:28 +0200 | [diff] [blame] | 207 | doc/Makefile |
| 208 | doc/examples/Makefile |
Oliver Smith | 7c0b70a | 2018-11-14 10:47:01 +0100 | [diff] [blame] | 209 | doc/manuals/Makefile |
Neels Hofmeyr | ffebe6e | 2017-07-20 17:57:37 +0200 | [diff] [blame] | 210 | contrib/Makefile |
Pau Espin Pedrol | e686675 | 2018-09-10 12:46:47 +0200 | [diff] [blame] | 211 | contrib/systemd/Makefile |
Holger Freyther | 5f75598 | 2008-12-27 09:42:59 +0000 | [diff] [blame] | 212 | Makefile) |