blob: 993d4d5dd82d228a033eb97ea4e6f4dbdf9795f6 [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
28dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
29AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
30if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
31 AC_MSG_WARN([You need to install pkg-config])
32fi
33PKG_PROG_PKG_CONFIG([0.20])
34
35PKG_CHECK_MODULES(TALLOC, [talloc >= 2.0.1])
36
Pau Espin Pedrolb9b224c2019-08-07 16:08:56 +020037PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.2.0)
38PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.2.0)
39PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.2.0)
40PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.2.0)
Harald Weltee0c6fe52019-01-20 19:29:59 +010041PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.6.0)
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010042
Neels Hofmeyrc317cc22016-12-13 14:33:26 +010043PKG_CHECK_MODULES(SQLITE3, sqlite3)
Neels Hofmeyr40d8b012016-12-11 00:27:48 +010044
45AC_CONFIG_MACRO_DIR([m4])
46
47dnl checks for header files
48AC_HEADER_STDC
49
Neels Hofmeyr6f3e8d62017-11-17 01:43:36 +010050AC_ARG_ENABLE(sanitize,
51 [AS_HELP_STRING(
52 [--enable-sanitize],
53 [Compile with address sanitizer enabled],
54 )],
55 [sanitize=$enableval], [sanitize="no"])
56if test x"$sanitize" = x"yes"
57then
58 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
59 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
60fi
61
Vadim Yanitskiyfbd736e2018-07-31 22:40:30 +070062AC_ARG_ENABLE([sqlite_talloc],
63 AC_HELP_STRING([--enable-sqlite-talloc],
64 [Configure SQLite3 to use talloc memory allocator [default=no]]),
65 [sqlite_talloc="$enableval"],[sqlite_talloc="no"])
66if test "x$sqlite_talloc" = "xyes" ; then
67 # Older versions of SQLite3 (at least 3.8.2) become unstable with talloc.
68 # Feel free to relax to 3.24.0 > VER > 3.8.2 if it works for you.
69 # FIXME: PKG_CHECK_MODULES() may return cached result here!
70 PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.24.0)
71 AC_DEFINE([SQLITE_USE_TALLOC], 1, [Use talloc for SQLite3])
72fi
73AC_MSG_CHECKING([whether to use talloc for SQLite3])
74AC_MSG_RESULT([$sqlite_talloc])
75AM_CONDITIONAL([DB_SQLITE_DEBUG], [test "x$sqlite_talloc" = "xyes"])
76
Neels Hofmeyr2e788582018-03-05 20:42:57 +010077AC_ARG_ENABLE(werror,
78 [AS_HELP_STRING(
79 [--enable-werror],
80 [Turn all compiler warnings into errors, with exceptions:
81 a) deprecation (allow upstream to mark deprecation without breaking builds);
82 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
83 ]
84 )],
85 [werror=$enableval], [werror="no"])
86if test x"$werror" = x"yes"
87then
88 WERROR_FLAGS="-Werror"
89 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
90 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
91 CFLAGS="$CFLAGS $WERROR_FLAGS"
92 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
93fi
94
Neels Hofmeyrf95ce042017-09-25 23:22:02 +020095AC_ARG_ENABLE([external_tests],
96 AC_HELP_STRING([--enable-external-tests],
97 [Include the VTY/CTRL tests in make check [default=no]]),
98 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
99if test "x$enable_ext_tests" = "xyes" ; then
100 AM_PATH_PYTHON
101 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
102 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
103 AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.])
104 fi
105fi
106AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
107AC_MSG_RESULT([$enable_ext_tests])
108AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
109
Oliver Smithf08da242018-11-14 10:47:01 +0100110# Generate manuals
111AC_ARG_ENABLE(manuals,
112 [AS_HELP_STRING(
113 [--enable-manuals],
114 [Generate manual PDFs [default=no]],
115 )],
116 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
117AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
118AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
119 fallback])
120if test x"$osmo_ac_build_manuals" = x"yes"
121then
122 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
123 if test -n "$OSMO_GSM_MANUALS_DIR"; then
124 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
125 else
126 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
127 if test -n "$OSMO_GSM_MANUALS_DIR"; then
128 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
129 else
130 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
131 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
132 fi
133 fi
134 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
135 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
136 fi
137
138 # Find and run check-depends
139 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
140 if ! test -x "$CHECK_DEPENDS"; then
141 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
142 fi
143 if ! $CHECK_DEPENDS; then
144 AC_MSG_ERROR("missing dependencies for --enable-manuals")
145 fi
146
147 # Put in Makefile with absolute path
148 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
149 AC_SUBST([OSMO_GSM_MANUALS_DIR])
150fi
151
Pau Espin Pedrol6fe1c222018-09-10 12:27:21 +0200152# https://www.freedesktop.org/software/systemd/man/daemon.html
153AC_ARG_WITH([systemdsystemunitdir],
154 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
155 [with_systemdsystemunitdir=auto])
156AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
157 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
158
159 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
160 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
161 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
162 with_systemdsystemunitdir=no],
163 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
164AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
165 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
166AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
167
Neels Hofmeyr2e788582018-03-05 20:42:57 +0100168AC_MSG_RESULT([CFLAGS="$CFLAGS"])
169AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
170
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100171AC_OUTPUT(
172 Makefile
Alexander Couzens38f08772017-11-16 01:01:09 +0100173 doc/Makefile
Pau Espin Pedrol966fcb22018-09-12 18:15:03 +0200174 doc/examples/Makefile
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100175 src/Makefile
Harald Welteec6915a2018-07-23 14:25:33 +0200176 src/gsupclient/Makefile
177 include/Makefile
178 libosmo-gsup-client.pc
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100179 sql/Makefile
Oliver Smithf08da242018-11-14 10:47:01 +0100180 doc/manuals/Makefile
Pau Espin Pedrol6fe1c222018-09-10 12:27:21 +0200181 contrib/Makefile
182 contrib/systemd/Makefile
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100183 tests/Makefile
184 tests/auc/Makefile
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100185 tests/auc/gen_ts_55_205_test_sets/Makefile
Neels Hofmeyrcab2fcd2017-03-15 00:07:43 +0100186 tests/gsup_server/Makefile
Neels Hofmeyr9d307ec2018-05-04 16:06:32 +0200187 tests/gsup/Makefile
Neels Hofmeyr98509462017-10-09 17:28:53 +0200188 tests/db/Makefile
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100189 )