blob: 618ae2385e68f997f4fbdc3c85665c4b36c31167 [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 Pedrolcb360f02018-05-03 16:27:14 +020037PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0)
38PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0)
39PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0)
40PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.11.0)
41PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.5.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
Neels Hofmeyr2e788582018-03-05 20:42:57 +010062AC_ARG_ENABLE(werror,
63 [AS_HELP_STRING(
64 [--enable-werror],
65 [Turn all compiler warnings into errors, with exceptions:
66 a) deprecation (allow upstream to mark deprecation without breaking builds);
67 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
68 ]
69 )],
70 [werror=$enableval], [werror="no"])
71if test x"$werror" = x"yes"
72then
73 WERROR_FLAGS="-Werror"
74 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
75 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
76 CFLAGS="$CFLAGS $WERROR_FLAGS"
77 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
78fi
79
Neels Hofmeyrf95ce042017-09-25 23:22:02 +020080AC_ARG_ENABLE([external_tests],
81 AC_HELP_STRING([--enable-external-tests],
82 [Include the VTY/CTRL tests in make check [default=no]]),
83 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
84if test "x$enable_ext_tests" = "xyes" ; then
85 AM_PATH_PYTHON
86 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
87 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
88 AC_MSG_ERROR([Please install git://osmocom.org/python/osmo-python-tests to run the VTY/CTRL tests.])
89 fi
90fi
91AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
92AC_MSG_RESULT([$enable_ext_tests])
93AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
94
Oliver Smithf08da242018-11-14 10:47:01 +010095# Generate manuals
96AC_ARG_ENABLE(manuals,
97 [AS_HELP_STRING(
98 [--enable-manuals],
99 [Generate manual PDFs [default=no]],
100 )],
101 [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"])
102AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"])
103AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals"
104 fallback])
105if test x"$osmo_ac_build_manuals" = x"yes"
106then
107 # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback)
108 if test -n "$OSMO_GSM_MANUALS_DIR"; then
109 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)"
110 else
111 OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)"
112 if test -n "$OSMO_GSM_MANUALS_DIR"; then
113 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)"
114 else
115 OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals"
116 echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)"
117 fi
118 fi
119 if ! test -d "$OSMO_GSM_MANUALS_DIR"; then
120 AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.")
121 fi
122
123 # Find and run check-depends
124 CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh"
125 if ! test -x "$CHECK_DEPENDS"; then
126 CHECK_DEPENDS="osmo-gsm-manuals-check-depends"
127 fi
128 if ! $CHECK_DEPENDS; then
129 AC_MSG_ERROR("missing dependencies for --enable-manuals")
130 fi
131
132 # Put in Makefile with absolute path
133 OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")"
134 AC_SUBST([OSMO_GSM_MANUALS_DIR])
135fi
136
Pau Espin Pedrol6fe1c222018-09-10 12:27:21 +0200137# https://www.freedesktop.org/software/systemd/man/daemon.html
138AC_ARG_WITH([systemdsystemunitdir],
139 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
140 [with_systemdsystemunitdir=auto])
141AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
142 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
143
144 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
145 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
146 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
147 with_systemdsystemunitdir=no],
148 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
149AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
150 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
151AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
152
Neels Hofmeyr2e788582018-03-05 20:42:57 +0100153AC_MSG_RESULT([CFLAGS="$CFLAGS"])
154AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
155
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100156AC_OUTPUT(
157 Makefile
Alexander Couzens38f08772017-11-16 01:01:09 +0100158 doc/Makefile
Pau Espin Pedrol966fcb22018-09-12 18:15:03 +0200159 doc/examples/Makefile
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100160 src/Makefile
Harald Welteec6915a2018-07-23 14:25:33 +0200161 src/gsupclient/Makefile
162 include/Makefile
163 libosmo-gsup-client.pc
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100164 sql/Makefile
Oliver Smithf08da242018-11-14 10:47:01 +0100165 doc/manuals/Makefile
Pau Espin Pedrol6fe1c222018-09-10 12:27:21 +0200166 contrib/Makefile
167 contrib/systemd/Makefile
Neels Hofmeyr00c06972017-01-31 01:19:27 +0100168 tests/Makefile
169 tests/auc/Makefile
Neels Hofmeyr6b883f72017-01-31 16:40:28 +0100170 tests/auc/gen_ts_55_205_test_sets/Makefile
Neels Hofmeyrcab2fcd2017-03-15 00:07:43 +0100171 tests/gsup_server/Makefile
Neels Hofmeyr9d307ec2018-05-04 16:06:32 +0200172 tests/gsup/Makefile
Neels Hofmeyr98509462017-10-09 17:28:53 +0200173 tests/db/Makefile
Neels Hofmeyr40d8b012016-12-11 00:27:48 +0100174 )