blob: 8ec9c8823b1055617976f0f33f0bc35982f0cdf3 [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
Oliver Smith288c39b2021-01-27 17:52:22 +01009CFLAGS="$CFLAGS -std=gnu11"
10
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +020011dnl kernel style compile messages
12m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
13
Max53044df2017-08-28 12:05:57 +020014dnl include release helper
15RELMAKE='-include osmo-release.mk'
16AC_SUBST([RELMAKE])
17
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +020018dnl checks for programs
19AC_PROG_MAKE_SET
20AC_PROG_CC
21AC_PROG_INSTALL
22AC_PROG_RANLIB
23
Pau Espin Pedrolb29f84f2018-10-31 10:38:18 +010024dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
25AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
26if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
27 AC_MSG_WARN([You need to install pkg-config])
28fi
29PKG_PROG_PKG_CONFIG([0.20])
30
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +020031dnl checks for header files
32AC_HEADER_STDC
33
Pau Espin Pedrole241ead2018-10-08 13:39:51 +020034AC_ARG_ENABLE(sanitize,
35 [AS_HELP_STRING(
36 [--enable-sanitize],
37 [Compile with address sanitizer enabled],
38 )],
39 [sanitize=$enableval], [sanitize="no"])
40if test x"$sanitize" = x"yes"
41then
42 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
43 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
44fi
45
Pau Espin Pedrolf59fabf2018-10-08 13:38:42 +020046AC_ARG_ENABLE(werror,
47 [AS_HELP_STRING(
48 [--enable-werror],
49 [Turn all compiler warnings into errors, with exceptions:
50 a) deprecation (allow upstream to mark deprecation without breaking builds);
51 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
52 ]
53 )],
54 [werror=$enableval], [werror="no"])
55if test x"$werror" = x"yes"
56then
57 WERROR_FLAGS="-Werror"
58 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
59 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
60 CFLAGS="$CFLAGS $WERROR_FLAGS"
61 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
62fi
63
Pau Espin Pedrolb29f84f2018-10-31 10:38:18 +010064# https://www.freedesktop.org/software/systemd/man/daemon.html
65AC_ARG_WITH([systemdsystemunitdir],
66 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
67 [with_systemdsystemunitdir=auto])
68AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
69 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
70 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
71 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
72 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
73 with_systemdsystemunitdir=no],
74 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
75AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
76 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
77AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
78
Holger Hans Peter Freyther0b4b8242016-09-08 15:09:16 +020079AC_ARG_ENABLE([external_tests],
80 AC_HELP_STRING([--enable-external-tests],
81 [Include the VTY tests in make check [default=no]]),
82 [enable_ext_tests="$enableval"],[enable_ext_tests="no"])
83if test "x$enable_ext_tests" = "xyes" ; then
84 AM_PATH_PYTHON
85 AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes)
86 if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then
87 AC_MSG_ERROR([Please install osmocom-python to run the VTY tests.])
88 fi
89fi
90AC_MSG_CHECKING([whether to enable VTY tests])
91AC_MSG_RESULT([$enable_ext_tests])
92AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +020093
94dnl Checks for typedefs, structures and compiler characteristics
Holger Hans Peter Freyther430366a2011-05-31 11:16:40 +020095AC_ARG_WITH([pcap-config],
96 AC_HELP_STRING([--with-pcap-config=FILE], [Use given pcap-config]),
97 [pcapcfg="$withval" ],
98 [AC_PATH_PROG([pcapcfg], [pcap-config], [])])
99if test x$pcapcfg = "x"; then
100 AC_MSG_ERROR([pcap-config can not be found])
101fi
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200102
Holger Hans Peter Freyther6d06bb12012-11-06 23:38:57 +0100103dnl CentOS 5 and Debian 6.0 do not ship with a pcap-config and we somehow
104dnl need to support these versions. Once we drop support for these two distros
105dnl the below can be simplified again.
106AC_ARG_VAR([PCAP_LIBS], [PCAP library files])
107AC_ARG_VAR([PCAP_CFLAGS], [PCAP C compiler flags])
108
109if test "x$ac_cv_env_PCAP_LIBS_set" != "xset"; then
110 PCAP_LIBS=`$pcapcfg --libs`
111fi
112
113if test "x$ac_cv_env_PCAP_CFLAGS_set" != "xset"; then
114 PCAP_CFLAGS=`$pcapcfg --cflags`
115fi
Holger Hans Peter Freyther430366a2011-05-31 11:16:40 +0200116AC_SUBST([PCAP_LIBS])
117AC_SUBST([PCAP_CFLAGS])
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200118
Holger Hans Peter Freyther6d06bb12012-11-06 23:38:57 +0100119dnl checks for libraries
Pau Espin Pedrol06303a62021-02-23 13:19:37 +0100120PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.5.0)
121PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.5.0)
122PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.5.0)
Holger Hans Peter Freythere0248692016-08-05 15:47:08 +0200123PKG_CHECK_MODULES(LIBZMQ, libzmq >= 3.2.2)
Holger Hans Peter Freytherc2667962016-08-25 23:07:44 +0200124PKG_CHECK_MODULES(LIBGNUTLS, gnutls)
Holger Hans Peter Freyther6d06bb12012-11-06 23:38:57 +0100125
126
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200127# Coverage build taken from WebKit's configure.in
128AC_MSG_CHECKING([whether to enable code coverage support])
129AC_ARG_ENABLE(coverage,
130 AC_HELP_STRING([--enable-coverage],
131 [enable code coverage support [default=no]]),
132 [],[enable_coverage="no"])
133AC_MSG_RESULT([$enable_coverage])
134if test "$enable_coverage" = "yes"; then
135 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
136 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
137 AC_SUBST([COVERAGE_CFLAGS])
138 AC_SUBST([COVERAGE_LDFLAGS])
139fi
140
Holger Hans Peter Freyther530ecc02011-05-31 15:47:44 +0200141AM_CONFIG_HEADER(osmopcapconfig.h)
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200142
143dnl Generate the output
144AC_OUTPUT(
Holger Hans Peter Freyther430366a2011-05-31 11:16:40 +0200145 include/Makefile
146 include/osmo-pcap/Makefile
147 src/Makefile
Daniel Willmann5d62ed02011-07-19 11:58:15 +0200148 contrib/Makefile
Pau Espin Pedrolb29f84f2018-10-31 10:38:18 +0100149 contrib/systemd/Makefile
Oliver Smithfd387ec2020-05-14 11:50:15 +0200150 contrib/osmo-pcap.spec
Pau Espin Pedrol45283d82018-10-31 11:05:00 +0100151 doc/Makefile
152 doc/examples/Makefile
Holger Hans Peter Freyther0b4b8242016-09-08 15:09:16 +0200153 tests/Makefile
Holger Hans Peter Freytherfbea3902011-05-31 10:19:47 +0200154 Makefile)