blob: 0e03ff0de7c9d93b9a90a54baf6d5affe1be5743 [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
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010015dnl kernel style compile messages
16m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
17
Max43bf7bc2017-08-25 18:27:28 +020018dnl include release helper
19RELMAKE='-include osmo-release.mk'
20AC_SUBST([RELMAKE])
21
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010022dnl checks for programs
23AC_PROG_MAKE_SET
24AC_PROG_MKDIR_P
25AC_PROG_CC
26AC_PROG_INSTALL
27
Eric08358b22020-04-11 01:18:20 +020028dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
29AS_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 Hofmeyr40d8b012016-12-11 00:27:48 +010033dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
34AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
35if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
36 AC_MSG_WARN([You need to install pkg-config])
37fi
38PKG_PROG_PKG_CONFIG([0.20])
39
40PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
41
Pau Espin Pedrol3a666982020-01-03 12:37:35 +010042PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.3.0)
43PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.3.0)
44PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.3.0)
45PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.3.0)
Harald Weltee0c6fe52019-01-20 19:29:59 +010046PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.6.0)
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010047
Neels Hofmeyrc317cc22016-12-13 14:33:26 +010048PKG_CHECK_MODULES(SQLITE3, sqlite3)
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010049
50AC_CONFIG_MACRO_DIR([m4])
51
52dnl checks for header files
53AC_HEADER_STDC
54
Neels Hofmeyr6f3e8d62017-11-17 01:43:36 +010055AC_ARG_ENABLE(sanitize,
56 [AS_HELP_STRING(
57 [--enable-sanitize],
58 [Compile with address sanitizer enabled],
59 )],
60 [sanitize=$enableval], [sanitize="no"])
61if test x"$sanitize" = x"yes"
62then
63 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
64 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
65fi
66
Vadim Yanitskiyfbd736e2018-07-31 22:40:30 +070067AC_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"])
71if 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])
77fi
78AC_MSG_CHECKING([whether to use talloc for SQLite3])
79AC_MSG_RESULT([$sqlite_talloc])
80AM_CONDITIONAL([DB_SQLITE_DEBUG], [test "x$sqlite_talloc" = "xyes"])
81
Neels Hofmeyr2e788582018-03-05 20:42:57 +010082AC_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"])
91if test x"$werror" = x"yes"
92then
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"
98fi
99
Neels Hofmeyrf95ce042017-09-25 23:22:02 +0200100AC_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"])
104if 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
110fi
111AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
112AC_MSG_RESULT([$enable_ext_tests])
113AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
114
Oliver Smithf0e90e62020-01-30 09:55:00 +0100115# mslookup_client_mdns_test (OS#4385: does not work everywhere)
116AC_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"])
120AC_MSG_CHECKING([whether to enable mslookup_client_mdns_test])
121AC_MSG_RESULT([$enable_mslookup_client_mdns_test])
122AM_CONDITIONAL(ENABLE_MSLOOKUP_CLIENT_MDNS_TEST, test "x$enable_mslookup_client_mdns_test" = "xyes")
123
Oliver Smithf08da242018-11-14 10:47:01 +0100124# Generate manuals
125AC_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"])
131AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
132AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
133 fallback])
134if test x"$osmo_ac_build_manuals" = x"yes"
135then
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])
164fi
165
Pau Espin Pedrol6fe1c222018-09-10 12:27:21 +0200166# https://www.freedesktop.org/software/systemd/man/daemon.html
167AC_ARG_WITH([systemdsystemunitdir],
168 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
169 [with_systemdsystemunitdir=auto])
170AS_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"])])
178AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
179 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
180AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
181
Neels Hofmeyr2e788582018-03-05 20:42:57 +0100182AC_MSG_RESULT([CFLAGS="$CFLAGS"])
183AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
184
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100185AC_OUTPUT(
186 Makefile
Alexander Couzens38f08772017-11-16 01:01:09 +0100187 doc/Makefile
Pau Espin Pedrol966fcb22018-09-12 18:15:03 +0200188 doc/examples/Makefile
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100189 src/Makefile
Harald Welteec6915a2018-07-23 14:25:33 +0200190 src/gsupclient/Makefile
Oliver Smithbf7deda2019-11-20 10:56:35 +0100191 src/mslookup/Makefile
Harald Welteec6915a2018-07-23 14:25:33 +0200192 include/Makefile
Neels Hofmeyr2f758032019-11-20 00:37:07 +0100193 include/osmocom/Makefile
194 include/osmocom/hlr/Makefile
Oliver Smith3a9f2672019-11-20 10:56:35 +0100195 include/osmocom/mslookup/Makefile
Harald Welteec6915a2018-07-23 14:25:33 +0200196 libosmo-gsup-client.pc
Oliver Smithbf7deda2019-11-20 10:56:35 +0100197 libosmo-mslookup.pc
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100198 sql/Makefile
Oliver Smithf08da242018-11-14 10:47:01 +0100199 doc/manuals/Makefile
Pau Espin Pedrol6fe1c222018-09-10 12:27:21 +0200200 contrib/Makefile
201 contrib/systemd/Makefile
Neels Hofmeyr52ef60f2019-11-20 12:37:41 +0100202 contrib/dgsm/Makefile
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100203 tests/Makefile
204 tests/auc/Makefile
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100205 tests/auc/gen_ts_55_205_test_sets/Makefile
Neels Hofmeyrcab2fcd2017-03-15 00:07:43 +0100206 tests/gsup_server/Makefile
Neels Hofmeyrad868e22019-11-20 02:36:45 +0100207 tests/gsup/Makefile
Neels Hofmeyr98509462017-10-09 17:28:53 +0200208 tests/db/Makefile
Neels Hofmeyr5b654612019-10-31 02:03:48 +0100209 tests/db_upgrade/Makefile
Oliver Smithbf7deda2019-11-20 10:56:35 +0100210 tests/mslookup/Makefile
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100211 )