Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 1 | AC_INIT([osmo-hlr], |
| 2 | m4_esyscmd([./git-version-gen .tarball-version]), |
| 3 | [openbsc@lists.osmocom.org]) |
| 4 | |
| 5 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 6 | AC_CONFIG_AUX_DIR([.]) |
| 7 | |
| 8 | dnl libtool init |
| 9 | LT_INIT |
| 10 | |
| 11 | AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.9]) |
| 12 | |
Neels Hofmeyr | 00c0697 | 2017-01-31 01:19:27 +0100 | [diff] [blame] | 13 | AC_CONFIG_TESTDIR(tests) |
| 14 | |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 15 | dnl kernel style compile messages |
| 16 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 17 | |
Max | 43bf7bc | 2017-08-25 18:27:28 +0200 | [diff] [blame] | 18 | dnl include release helper |
| 19 | RELMAKE='-include osmo-release.mk' |
| 20 | AC_SUBST([RELMAKE]) |
| 21 | |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 22 | dnl checks for programs |
| 23 | AC_PROG_MAKE_SET |
| 24 | AC_PROG_MKDIR_P |
| 25 | AC_PROG_CC |
| 26 | AC_PROG_INSTALL |
| 27 | |
Eric | 08358b2 | 2020-04-11 01:18:20 +0200 | [diff] [blame] | 28 | dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang |
| 29 | AS_CASE(["$LD"],[*clang*], |
| 30 | [AS_CASE(["${host_os}"], |
| 31 | [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])]) |
| 32 | |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 33 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 34 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 35 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 36 | AC_MSG_WARN([You need to install pkg-config]) |
| 37 | fi |
| 38 | PKG_PROG_PKG_CONFIG([0.20]) |
| 39 | |
| 40 | PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1]) |
| 41 | |
Pau Espin Pedrol | 3a66698 | 2020-01-03 12:37:35 +0100 | [diff] [blame] | 42 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.3.0) |
| 43 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.3.0) |
| 44 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.3.0) |
| 45 | PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.3.0) |
Harald Welte | e0c6fe5 | 2019-01-20 19:29:59 +0100 | [diff] [blame] | 46 | PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.6.0) |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 47 | |
Neels Hofmeyr | c317cc2 | 2016-12-13 14:33:26 +0100 | [diff] [blame] | 48 | PKG_CHECK_MODULES(SQLITE3, sqlite3) |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 49 | |
| 50 | AC_CONFIG_MACRO_DIR([m4]) |
| 51 | |
| 52 | dnl checks for header files |
| 53 | AC_HEADER_STDC |
| 54 | |
Neels Hofmeyr | 6f3e8d6 | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 55 | AC_ARG_ENABLE(sanitize, |
| 56 | [AS_HELP_STRING( |
| 57 | [--enable-sanitize], |
| 58 | [Compile with address sanitizer enabled], |
| 59 | )], |
| 60 | [sanitize=$enableval], [sanitize="no"]) |
| 61 | if test x"$sanitize" = x"yes" |
| 62 | then |
| 63 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 64 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 65 | fi |
| 66 | |
Vadim Yanitskiy | fbd736e | 2018-07-31 22:40:30 +0700 | [diff] [blame] | 67 | AC_ARG_ENABLE([sqlite_talloc], |
| 68 | AC_HELP_STRING([--enable-sqlite-talloc], |
| 69 | [Configure SQLite3 to use talloc memory allocator [default=no]]), |
| 70 | [sqlite_talloc="$enableval"],[sqlite_talloc="no"]) |
| 71 | if test "x$sqlite_talloc" = "xyes" ; then |
| 72 | # Older versions of SQLite3 (at least 3.8.2) become unstable with talloc. |
| 73 | # Feel free to relax to 3.24.0 > VER > 3.8.2 if it works for you. |
| 74 | # FIXME: PKG_CHECK_MODULES() may return cached result here! |
| 75 | PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.24.0) |
| 76 | AC_DEFINE([SQLITE_USE_TALLOC], 1, [Use talloc for SQLite3]) |
| 77 | fi |
| 78 | AC_MSG_CHECKING([whether to use talloc for SQLite3]) |
| 79 | AC_MSG_RESULT([$sqlite_talloc]) |
| 80 | AM_CONDITIONAL([DB_SQLITE_DEBUG], [test "x$sqlite_talloc" = "xyes"]) |
| 81 | |
Neels Hofmeyr | 2e78858 | 2018-03-05 20:42:57 +0100 | [diff] [blame] | 82 | AC_ARG_ENABLE(werror, |
| 83 | [AS_HELP_STRING( |
| 84 | [--enable-werror], |
| 85 | [Turn all compiler warnings into errors, with exceptions: |
| 86 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 87 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 88 | ] |
| 89 | )], |
| 90 | [werror=$enableval], [werror="no"]) |
| 91 | if test x"$werror" = x"yes" |
| 92 | then |
| 93 | WERROR_FLAGS="-Werror" |
| 94 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 95 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 96 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 97 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 98 | fi |
| 99 | |
Neels Hofmeyr | f95ce04 | 2017-09-25 23:22:02 +0200 | [diff] [blame] | 100 | AC_ARG_ENABLE([external_tests], |
| 101 | AC_HELP_STRING([--enable-external-tests], |
| 102 | [Include the VTY/CTRL tests in make check [default=no]]), |
| 103 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 104 | if test "x$enable_ext_tests" = "xyes" ; then |
| 105 | AM_PATH_PYTHON |
| 106 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 107 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
| 108 | AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.]) |
| 109 | fi |
| 110 | fi |
| 111 | AC_MSG_CHECKING([whether to enable VTY/CTRL tests]) |
| 112 | AC_MSG_RESULT([$enable_ext_tests]) |
| 113 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
| 114 | |
Oliver Smith | f0e90e6 | 2020-01-30 09:55:00 +0100 | [diff] [blame] | 115 | # mslookup_client_mdns_test (OS#4385: does not work everywhere) |
| 116 | AC_ARG_ENABLE([mslookup_client_mdns_test], |
| 117 | AC_HELP_STRING([--enable-mslookup-client-mdns-test], |
| 118 | [Include the mslookup_client_mdns_test in make check [default=no]]), |
| 119 | [enable_mslookup_client_mdns_test="$enableval"],[enable_mslookup_client_mdns_test="no"]) |
| 120 | AC_MSG_CHECKING([whether to enable mslookup_client_mdns_test]) |
| 121 | AC_MSG_RESULT([$enable_mslookup_client_mdns_test]) |
| 122 | AM_CONDITIONAL(ENABLE_MSLOOKUP_CLIENT_MDNS_TEST, test "x$enable_mslookup_client_mdns_test" = "xyes") |
| 123 | |
Oliver Smith | f08da24 | 2018-11-14 10:47:01 +0100 | [diff] [blame] | 124 | # Generate manuals |
| 125 | AC_ARG_ENABLE(manuals, |
| 126 | [AS_HELP_STRING( |
| 127 | [--enable-manuals], |
| 128 | [Generate manual PDFs [default=no]], |
| 129 | )], |
| 130 | [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"]) |
| 131 | AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"]) |
| 132 | AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals" |
| 133 | fallback]) |
| 134 | if test x"$osmo_ac_build_manuals" = x"yes" |
| 135 | then |
| 136 | # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback) |
| 137 | if test -n "$OSMO_GSM_MANUALS_DIR"; then |
| 138 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)" |
| 139 | else |
| 140 | OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)" |
| 141 | if test -n "$OSMO_GSM_MANUALS_DIR"; then |
| 142 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)" |
| 143 | else |
| 144 | OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals" |
| 145 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)" |
| 146 | fi |
| 147 | fi |
| 148 | if ! test -d "$OSMO_GSM_MANUALS_DIR"; then |
| 149 | AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.") |
| 150 | fi |
| 151 | |
| 152 | # Find and run check-depends |
| 153 | CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh" |
| 154 | if ! test -x "$CHECK_DEPENDS"; then |
| 155 | CHECK_DEPENDS="osmo-gsm-manuals-check-depends" |
| 156 | fi |
| 157 | if ! $CHECK_DEPENDS; then |
| 158 | AC_MSG_ERROR("missing dependencies for --enable-manuals") |
| 159 | fi |
| 160 | |
| 161 | # Put in Makefile with absolute path |
| 162 | OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")" |
| 163 | AC_SUBST([OSMO_GSM_MANUALS_DIR]) |
| 164 | fi |
| 165 | |
Pau Espin Pedrol | 6fe1c22 | 2018-09-10 12:27:21 +0200 | [diff] [blame] | 166 | # https://www.freedesktop.org/software/systemd/man/daemon.html |
| 167 | AC_ARG_WITH([systemdsystemunitdir], |
| 168 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, |
| 169 | [with_systemdsystemunitdir=auto]) |
| 170 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ |
| 171 | def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 172 | |
| 173 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 174 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 175 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) |
| 176 | with_systemdsystemunitdir=no], |
| 177 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) |
| 178 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 179 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 180 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 181 | |
Neels Hofmeyr | 2e78858 | 2018-03-05 20:42:57 +0100 | [diff] [blame] | 182 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 183 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 184 | |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 185 | AC_OUTPUT( |
| 186 | Makefile |
Alexander Couzens | 38f0877 | 2017-11-16 01:01:09 +0100 | [diff] [blame] | 187 | doc/Makefile |
Pau Espin Pedrol | 966fcb2 | 2018-09-12 18:15:03 +0200 | [diff] [blame] | 188 | doc/examples/Makefile |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 189 | src/Makefile |
Harald Welte | ec6915a | 2018-07-23 14:25:33 +0200 | [diff] [blame] | 190 | src/gsupclient/Makefile |
Oliver Smith | bf7deda | 2019-11-20 10:56:35 +0100 | [diff] [blame] | 191 | src/mslookup/Makefile |
Harald Welte | ec6915a | 2018-07-23 14:25:33 +0200 | [diff] [blame] | 192 | include/Makefile |
Neels Hofmeyr | 2f75803 | 2019-11-20 00:37:07 +0100 | [diff] [blame] | 193 | include/osmocom/Makefile |
| 194 | include/osmocom/hlr/Makefile |
Oliver Smith | 3a9f267 | 2019-11-20 10:56:35 +0100 | [diff] [blame] | 195 | include/osmocom/mslookup/Makefile |
Harald Welte | ec6915a | 2018-07-23 14:25:33 +0200 | [diff] [blame] | 196 | libosmo-gsup-client.pc |
Oliver Smith | bf7deda | 2019-11-20 10:56:35 +0100 | [diff] [blame] | 197 | libosmo-mslookup.pc |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 198 | sql/Makefile |
Oliver Smith | f08da24 | 2018-11-14 10:47:01 +0100 | [diff] [blame] | 199 | doc/manuals/Makefile |
Pau Espin Pedrol | 6fe1c22 | 2018-09-10 12:27:21 +0200 | [diff] [blame] | 200 | contrib/Makefile |
| 201 | contrib/systemd/Makefile |
Neels Hofmeyr | 52ef60f | 2019-11-20 12:37:41 +0100 | [diff] [blame] | 202 | contrib/dgsm/Makefile |
Neels Hofmeyr | 00c0697 | 2017-01-31 01:19:27 +0100 | [diff] [blame] | 203 | tests/Makefile |
| 204 | tests/auc/Makefile |
Neels Hofmeyr | 6b883f7 | 2017-01-31 16:40:28 +0100 | [diff] [blame] | 205 | tests/auc/gen_ts_55_205_test_sets/Makefile |
Neels Hofmeyr | cab2fcd | 2017-03-15 00:07:43 +0100 | [diff] [blame] | 206 | tests/gsup_server/Makefile |
Neels Hofmeyr | b2553eb | 2019-11-20 02:36:45 +0100 | [diff] [blame] | 207 | tests/gsup/Makefile |
Neels Hofmeyr | 9850946 | 2017-10-09 17:28:53 +0200 | [diff] [blame] | 208 | tests/db/Makefile |
Neels Hofmeyr | 5b65461 | 2019-10-31 02:03:48 +0100 | [diff] [blame] | 209 | tests/db_upgrade/Makefile |
Oliver Smith | bf7deda | 2019-11-20 10:56:35 +0100 | [diff] [blame] | 210 | tests/mslookup/Makefile |
Neels Hofmeyr | 40d8b01 | 2016-12-11 00:27:48 +0100 | [diff] [blame] | 211 | ) |