blob: c496409900f2667e201a7b53e52ff83e868be0ee [file] [log] [blame]
Neels Hofmeyr40d8b012016-12-11 00:27:48 +01001AC_INIT([osmo-hlr],
2 m4_esyscmd([./git-version-gen .tarball-version]),
3 [openbsc@lists.osmocom.org])
4
5dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
6AC_CONFIG_AUX_DIR([.])
7
8dnl libtool init
9LT_INIT
10
11AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.9])
12
Neels Hofmeyr00c06972017-01-31 01:19:27 +010013AC_CONFIG_TESTDIR(tests)
14
Oliver Smithdd746942021-01-27 17:50:52 +010015CFLAGS="$CFLAGS -std=gnu11"
16
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010017dnl kernel style compile messages
18m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
19
Max43bf7bc2017-08-25 18:27:28 +020020dnl include release helper
21RELMAKE='-include osmo-release.mk'
22AC_SUBST([RELMAKE])
23
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010024dnl checks for programs
25AC_PROG_MAKE_SET
26AC_PROG_MKDIR_P
27AC_PROG_CC
28AC_PROG_INSTALL
29
Pau Espin Pedrole893eeb2020-08-18 12:49:05 +020030dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
Eric08358b22020-04-11 01:18:20 +020031AS_CASE(["$LD"],[*clang*],
32 [AS_CASE(["${host_os}"],
33 [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
34
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010035dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
36AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
37if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
38 AC_MSG_WARN([You need to install pkg-config])
39fi
40PKG_PROG_PKG_CONFIG([0.20])
41
42PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
43
Pau Espin Pedrol62404652021-02-23 18:13:53 +010044PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.5.0)
45PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.5.0)
46PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.5.0)
47PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.5.0)
48PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.1.0)
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010049
Neels Hofmeyrc317cc22016-12-13 14:33:26 +010050PKG_CHECK_MODULES(SQLITE3, sqlite3)
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010051
52AC_CONFIG_MACRO_DIR([m4])
53
54dnl checks for header files
55AC_HEADER_STDC
56
Neels Hofmeyr6f3e8d62017-11-17 01:43:36 +010057AC_ARG_ENABLE(sanitize,
58 [AS_HELP_STRING(
59 [--enable-sanitize],
60 [Compile with address sanitizer enabled],
61 )],
62 [sanitize=$enableval], [sanitize="no"])
63if test x"$sanitize" = x"yes"
64then
65 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
66 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
67fi
68
Vadim Yanitskiyfbd736e2018-07-31 22:40:30 +070069AC_ARG_ENABLE([sqlite_talloc],
70 AC_HELP_STRING([--enable-sqlite-talloc],
71 [Configure SQLite3 to use talloc memory allocator [default=no]]),
72 [sqlite_talloc="$enableval"],[sqlite_talloc="no"])
73if test "x$sqlite_talloc" = "xyes" ; then
74 # Older versions of SQLite3 (at least 3.8.2) become unstable with talloc.
75 # Feel free to relax to 3.24.0 > VER > 3.8.2 if it works for you.
76 # FIXME: PKG_CHECK_MODULES() may return cached result here!
77 PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.24.0)
78 AC_DEFINE([SQLITE_USE_TALLOC], 1, [Use talloc for SQLite3])
79fi
80AC_MSG_CHECKING([whether to use talloc for SQLite3])
81AC_MSG_RESULT([$sqlite_talloc])
82AM_CONDITIONAL([DB_SQLITE_DEBUG], [test "x$sqlite_talloc" = "xyes"])
83
Neels Hofmeyr2e788582018-03-05 20:42:57 +010084AC_ARG_ENABLE(werror,
85 [AS_HELP_STRING(
86 [--enable-werror],
87 [Turn all compiler warnings into errors, with exceptions:
88 a) deprecation (allow upstream to mark deprecation without breaking builds);
89 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
90 ]
91 )],
92 [werror=$enableval], [werror="no"])
93if test x"$werror" = x"yes"
94then
95 WERROR_FLAGS="-Werror"
96 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
97 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
98 CFLAGS="$CFLAGS $WERROR_FLAGS"
99 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
100fi
101
Neels Hofmeyrf95ce042017-09-25 23:22:02 +0200102AC_ARG_ENABLE([external_tests],
103 AC_HELP_STRING([--enable-external-tests],
104 [Include the VTY/CTRL tests in make check [default=no]]),
105 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
106if test "x$enable_ext_tests" = "xyes" ; then
107 AM_PATH_PYTHON
108 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
109 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
110 AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.])
111 fi
112fi
113AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
114AC_MSG_RESULT([$enable_ext_tests])
115AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
116
Oliver Smithf0e90e62020-01-30 09:55:00 +0100117# mslookup_client_mdns_test (OS#4385: does not work everywhere)
118AC_ARG_ENABLE([mslookup_client_mdns_test],
119 AC_HELP_STRING([--enable-mslookup-client-mdns-test],
120 [Include the mslookup_client_mdns_test in make check [default=no]]),
121 [enable_mslookup_client_mdns_test="$enableval"],[enable_mslookup_client_mdns_test="no"])
122AC_MSG_CHECKING([whether to enable mslookup_client_mdns_test])
123AC_MSG_RESULT([$enable_mslookup_client_mdns_test])
124AM_CONDITIONAL(ENABLE_MSLOOKUP_CLIENT_MDNS_TEST, test "x$enable_mslookup_client_mdns_test" = "xyes")
125
Oliver Smithf08da242018-11-14 10:47:01 +0100126# Generate manuals
127AC_ARG_ENABLE(manuals,
128 [AS_HELP_STRING(
129 [--enable-manuals],
130 [Generate manual PDFs [default=no]],
131 )],
132 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
133AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
134AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
135 fallback])
136if test x"$osmo_ac_build_manuals" = x"yes"
137then
138 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
139 if test -n "$OSMO_GSM_MANUALS_DIR"; then
140 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
141 else
142 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
143 if test -n "$OSMO_GSM_MANUALS_DIR"; then
144 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
145 else
146 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
147 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
148 fi
149 fi
150 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
151 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
152 fi
153
154 # Find and run check-depends
155 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
156 if ! test -x "$CHECK_DEPENDS"; then
157 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
158 fi
159 if ! $CHECK_DEPENDS; then
160 AC_MSG_ERROR("missing dependencies for --enable-manuals")
161 fi
162
163 # Put in Makefile with absolute path
164 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
165 AC_SUBST([OSMO_GSM_MANUALS_DIR])
166fi
167
Pau Espin Pedrol6fe1c222018-09-10 12:27:21 +0200168# https://www.freedesktop.org/software/systemd/man/daemon.html
169AC_ARG_WITH([systemdsystemunitdir],
170 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
171 [with_systemdsystemunitdir=auto])
172AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
173 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
174
175 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
176 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
177 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
178 with_systemdsystemunitdir=no],
179 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
180AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
181 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
182AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
183
Neels Hofmeyr2e788582018-03-05 20:42:57 +0100184AC_MSG_RESULT([CFLAGS="$CFLAGS"])
185AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
186
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100187AC_OUTPUT(
188 Makefile
Alexander Couzens38f08772017-11-16 01:01:09 +0100189 doc/Makefile
Pau Espin Pedrol966fcb22018-09-12 18:15:03 +0200190 doc/examples/Makefile
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100191 src/Makefile
Harald Welteec6915a2018-07-23 14:25:33 +0200192 src/gsupclient/Makefile
Oliver Smithbf7deda2019-11-20 10:56:35 +0100193 src/mslookup/Makefile
Harald Welteec6915a2018-07-23 14:25:33 +0200194 include/Makefile
Neels Hofmeyr2f758032019-11-20 00:37:07 +0100195 include/osmocom/Makefile
196 include/osmocom/hlr/Makefile
Oliver Smith3a9f2672019-11-20 10:56:35 +0100197 include/osmocom/mslookup/Makefile
Harald Welteec6915a2018-07-23 14:25:33 +0200198 libosmo-gsup-client.pc
Oliver Smithbf7deda2019-11-20 10:56:35 +0100199 libosmo-mslookup.pc
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100200 sql/Makefile
Oliver Smithf08da242018-11-14 10:47:01 +0100201 doc/manuals/Makefile
Pau Espin Pedrol6fe1c222018-09-10 12:27:21 +0200202 contrib/Makefile
203 contrib/systemd/Makefile
Neels Hofmeyr52ef60f2019-11-20 12:37:41 +0100204 contrib/dgsm/Makefile
Oliver Smith102e3622020-05-14 11:46:08 +0200205 contrib/osmo-hlr.spec
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100206 tests/Makefile
207 tests/auc/Makefile
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100208 tests/auc/gen_ts_55_205_test_sets/Makefile
Neels Hofmeyrcab2fcd2017-03-15 00:07:43 +0100209 tests/gsup_server/Makefile
Neels Hofmeyrad868e22019-11-20 02:36:45 +0100210 tests/gsup/Makefile
Neels Hofmeyr98509462017-10-09 17:28:53 +0200211 tests/db/Makefile
Neels Hofmeyr5b654612019-10-31 02:03:48 +0100212 tests/db_upgrade/Makefile
Oliver Smithbf7deda2019-11-20 10:56:35 +0100213 tests/mslookup/Makefile
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100214 )