blob: 2511b37b1974b1acf35934f5f63ebbb5e14fdc14 [file] [log] [blame]
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +02001dnl Process this file with autoconf to produce a configure script
2AC_INIT([osmo-pcap],
3 m4_esyscmd([./git-version-gen .tarball-version]),
4 [openbsc-devel@lists.openbsc.org])
5
6AM_INIT_AUTOMAKE([dist-bzip2])
Holger Hans Peter Freyther0b4b8242016-09-08 15:09:16 +02007AC_CONFIG_TESTDIR(tests)
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +02008
9dnl kernel style compile messages
10m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11
Max53044df2017-08-28 12:05:57 +020012dnl include release helper
13RELMAKE='-include osmo-release.mk'
14AC_SUBST([RELMAKE])
15
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +020016dnl checks for programs
17AC_PROG_MAKE_SET
18AC_PROG_CC
19AC_PROG_INSTALL
20AC_PROG_RANLIB
21
Pau Espin Pedrolb29f84f2018-10-31 10:38:18 +010022dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
23AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
24if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
25 AC_MSG_WARN([You need to install pkg-config])
26fi
27PKG_PROG_PKG_CONFIG([0.20])
28
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +020029dnl checks for header files
30AC_HEADER_STDC
31
Pau Espin Pedrole241ead2018-10-08 13:39:51 +020032AC_ARG_ENABLE(sanitize,
33 [AS_HELP_STRING(
34 [--enable-sanitize],
35 [Compile with address sanitizer enabled],
36 )],
37 [sanitize=$enableval], [sanitize="no"])
38if test x"$sanitize" = x"yes"
39then
40 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
41 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
42fi
43
Pau Espin Pedrolf59fabf2018-10-08 13:38:42 +020044AC_ARG_ENABLE(werror,
45 [AS_HELP_STRING(
46 [--enable-werror],
47 [Turn all compiler warnings into errors, with exceptions:
48 a) deprecation (allow upstream to mark deprecation without breaking builds);
49 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
50 ]
51 )],
52 [werror=$enableval], [werror="no"])
53if test x"$werror" = x"yes"
54then
55 WERROR_FLAGS="-Werror"
56 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
57 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
58 CFLAGS="$CFLAGS $WERROR_FLAGS"
59 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
60fi
61
Pau Espin Pedrolb29f84f2018-10-31 10:38:18 +010062# https://www.freedesktop.org/software/systemd/man/daemon.html
63AC_ARG_WITH([systemdsystemunitdir],
64 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
65 [with_systemdsystemunitdir=auto])
66AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
67 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
68 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
69 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
70 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
71 with_systemdsystemunitdir=no],
72 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
73AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
74 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
75AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
76
Holger Hans Peter Freyther0b4b8242016-09-08 15:09:16 +020077AC_ARG_ENABLE([external_tests],
78 AC_HELP_STRING([--enable-external-tests],
79 [Include the VTY tests in make check [default=no]]),
80 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
81if test "x$enable_ext_tests" = "xyes" ; then
82 AM_PATH_PYTHON
83 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
84 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
85 AC_MSG_ERROR([Please install osmocom-python to run the VTY tests.])
86 fi
87fi
88AC_MSG_CHECKING([whether to enable VTY tests])
89AC_MSG_RESULT([$enable_ext_tests])
90AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +020091
92dnl Checks for typedefs, structures and compiler characteristics
Holger Hans Peter Freyther430366a2011-05-31 11:16:40 +020093AC_ARG_WITH([pcap-config],
94 AC_HELP_STRING([--with-pcap-config=FILE], [Use given pcap-config]),
95 [pcapcfg="$withval" ],
96 [AC_PATH_PROG([pcapcfg], [pcap-config], [])])
97if test x$pcapcfg = "x"; then
98 AC_MSG_ERROR([pcap-config can not be found])
99fi
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200100
Holger Hans Peter Freyther6d06bb12012-11-06 23:38:57 +0100101dnl CentOS 5 and Debian 6.0 do not ship with a pcap-config and we somehow
102dnl need to support these versions. Once we drop support for these two distros
103dnl the below can be simplified again.
104AC_ARG_VAR([PCAP_LIBS], [PCAP library files])
105AC_ARG_VAR([PCAP_CFLAGS], [PCAP C compiler flags])
106
107if test "x$ac_cv_env_PCAP_LIBS_set" != "xset"; then
108 PCAP_LIBS=`$pcapcfg --libs`
109fi
110
111if test "x$ac_cv_env_PCAP_CFLAGS_set" != "xset"; then
112 PCAP_CFLAGS=`$pcapcfg --cflags`
113fi
Holger Hans Peter Freyther430366a2011-05-31 11:16:40 +0200114AC_SUBST([PCAP_LIBS])
115AC_SUBST([PCAP_CFLAGS])
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200116
Holger Hans Peter Freyther6d06bb12012-11-06 23:38:57 +0100117dnl checks for libraries
Pau Espin Pedrolce0660c2019-08-07 13:11:01 +0200118PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0)
119PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0)
120PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0)
Holger Hans Peter Freythere0248692016-08-05 15:47:08 +0200121PKG_CHECK_MODULES(LIBZMQ, libzmq >= 3.2.2)
Holger Hans Peter Freytherc2667962016-08-25 23:07:44 +0200122PKG_CHECK_MODULES(LIBGNUTLS, gnutls)
Holger Hans Peter Freyther6d06bb12012-11-06 23:38:57 +0100123
124
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200125# Coverage build taken from WebKit's configure.in
126AC_MSG_CHECKING([whether to enable code coverage support])
127AC_ARG_ENABLE(coverage,
128 AC_HELP_STRING([--enable-coverage],
129 [enable code coverage support [default=no]]),
130 [],[enable_coverage="no"])
131AC_MSG_RESULT([$enable_coverage])
132if test "$enable_coverage" = "yes"; then
133 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
134 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
135 AC_SUBST([COVERAGE_CFLAGS])
136 AC_SUBST([COVERAGE_LDFLAGS])
137fi
138
Holger Hans Peter Freyther530ecc02011-05-31 15:47:44 +0200139AM_CONFIG_HEADER(osmopcapconfig.h)
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200140
141dnl Generate the output
142AC_OUTPUT(
Holger Hans Peter Freyther430366a2011-05-31 11:16:40 +0200143 include/Makefile
144 include/osmo-pcap/Makefile
145 src/Makefile
Daniel Willmann5d62ed02011-07-19 11:58:15 +0200146 contrib/Makefile
Pau Espin Pedrolb29f84f2018-10-31 10:38:18 +0100147 contrib/systemd/Makefile
Pau Espin Pedrol45283d82018-10-31 11:05:00 +0100148 doc/Makefile
149 doc/examples/Makefile
Holger Hans Peter Freyther0b4b8242016-09-08 15:09:16 +0200150 tests/Makefile
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200151 Makefile)