Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script |
| 2 | AC_INIT([osmo-pcap], |
| 3 | m4_esyscmd([./git-version-gen .tarball-version]), |
| 4 | [openbsc-devel@lists.openbsc.org]) |
| 5 | |
| 6 | AM_INIT_AUTOMAKE([dist-bzip2]) |
Holger Hans Peter Freyther | 0b4b824 | 2016-09-08 15:09:16 +0200 | [diff] [blame] | 7 | AC_CONFIG_TESTDIR(tests) |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 8 | |
Oliver Smith | 288c39b | 2021-01-27 17:52:22 +0100 | [diff] [blame] | 9 | CFLAGS="$CFLAGS -std=gnu11" |
| 10 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 11 | dnl kernel style compile messages |
| 12 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 13 | |
Max | 53044df | 2017-08-28 12:05:57 +0200 | [diff] [blame] | 14 | dnl include release helper |
| 15 | RELMAKE='-include osmo-release.mk' |
| 16 | AC_SUBST([RELMAKE]) |
| 17 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 18 | dnl checks for programs |
| 19 | AC_PROG_MAKE_SET |
| 20 | AC_PROG_CC |
| 21 | AC_PROG_INSTALL |
| 22 | AC_PROG_RANLIB |
| 23 | |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame] | 24 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 25 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 26 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 27 | AC_MSG_WARN([You need to install pkg-config]) |
| 28 | fi |
| 29 | PKG_PROG_PKG_CONFIG([0.20]) |
| 30 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 31 | dnl checks for header files |
| 32 | AC_HEADER_STDC |
| 33 | |
Pau Espin Pedrol | e241ead | 2018-10-08 13:39:51 +0200 | [diff] [blame] | 34 | AC_ARG_ENABLE(sanitize, |
| 35 | [AS_HELP_STRING( |
| 36 | [--enable-sanitize], |
| 37 | [Compile with address sanitizer enabled], |
| 38 | )], |
| 39 | [sanitize=$enableval], [sanitize="no"]) |
| 40 | if test x"$sanitize" = x"yes" |
| 41 | then |
| 42 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 43 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 44 | fi |
| 45 | |
Pau Espin Pedrol | f59fabf | 2018-10-08 13:38:42 +0200 | [diff] [blame] | 46 | AC_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"]) |
| 55 | if test x"$werror" = x"yes" |
| 56 | then |
| 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" |
| 62 | fi |
| 63 | |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame] | 64 | # https://www.freedesktop.org/software/systemd/man/daemon.html |
| 65 | AC_ARG_WITH([systemdsystemunitdir], |
| 66 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, |
| 67 | [with_systemdsystemunitdir=auto]) |
| 68 | AS_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"])]) |
| 75 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 76 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 77 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 78 | |
Holger Hans Peter Freyther | 0b4b824 | 2016-09-08 15:09:16 +0200 | [diff] [blame] | 79 | AC_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"]) |
| 83 | if 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 |
| 89 | fi |
| 90 | AC_MSG_CHECKING([whether to enable VTY tests]) |
| 91 | AC_MSG_RESULT([$enable_ext_tests]) |
| 92 | AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes") |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 93 | |
| 94 | dnl Checks for typedefs, structures and compiler characteristics |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 95 | AC_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], [])]) |
| 99 | if test x$pcapcfg = "x"; then |
| 100 | AC_MSG_ERROR([pcap-config can not be found]) |
| 101 | fi |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 102 | |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 103 | dnl CentOS 5 and Debian 6.0 do not ship with a pcap-config and we somehow |
| 104 | dnl need to support these versions. Once we drop support for these two distros |
| 105 | dnl the below can be simplified again. |
| 106 | AC_ARG_VAR([PCAP_LIBS], [PCAP library files]) |
| 107 | AC_ARG_VAR([PCAP_CFLAGS], [PCAP C compiler flags]) |
| 108 | |
| 109 | if test "x$ac_cv_env_PCAP_LIBS_set" != "xset"; then |
| 110 | PCAP_LIBS=`$pcapcfg --libs` |
| 111 | fi |
| 112 | |
| 113 | if test "x$ac_cv_env_PCAP_CFLAGS_set" != "xset"; then |
| 114 | PCAP_CFLAGS=`$pcapcfg --cflags` |
| 115 | fi |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 116 | AC_SUBST([PCAP_LIBS]) |
| 117 | AC_SUBST([PCAP_CFLAGS]) |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 118 | |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 119 | dnl checks for libraries |
Pau Espin Pedrol | 06303a6 | 2021-02-23 13:19:37 +0100 | [diff] [blame] | 120 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.5.0) |
| 121 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.5.0) |
| 122 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.5.0) |
Holger Hans Peter Freyther | e024869 | 2016-08-05 15:47:08 +0200 | [diff] [blame] | 123 | PKG_CHECK_MODULES(LIBZMQ, libzmq >= 3.2.2) |
Holger Hans Peter Freyther | c266796 | 2016-08-25 23:07:44 +0200 | [diff] [blame] | 124 | PKG_CHECK_MODULES(LIBGNUTLS, gnutls) |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 125 | |
| 126 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 127 | # Coverage build taken from WebKit's configure.in |
| 128 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 129 | AC_ARG_ENABLE(coverage, |
| 130 | AC_HELP_STRING([--enable-coverage], |
| 131 | [enable code coverage support [default=no]]), |
| 132 | [],[enable_coverage="no"]) |
| 133 | AC_MSG_RESULT([$enable_coverage]) |
| 134 | if 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]) |
| 139 | fi |
| 140 | |
Holger Hans Peter Freyther | 530ecc0 | 2011-05-31 15:47:44 +0200 | [diff] [blame] | 141 | AM_CONFIG_HEADER(osmopcapconfig.h) |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 142 | |
| 143 | dnl Generate the output |
| 144 | AC_OUTPUT( |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 145 | include/Makefile |
| 146 | include/osmo-pcap/Makefile |
| 147 | src/Makefile |
Daniel Willmann | 5d62ed0 | 2011-07-19 11:58:15 +0200 | [diff] [blame] | 148 | contrib/Makefile |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame] | 149 | contrib/systemd/Makefile |
Oliver Smith | fd387ec | 2020-05-14 11:50:15 +0200 | [diff] [blame] | 150 | contrib/osmo-pcap.spec |
Pau Espin Pedrol | 45283d8 | 2018-10-31 11:05:00 +0100 | [diff] [blame] | 151 | doc/Makefile |
| 152 | doc/examples/Makefile |
Holger Hans Peter Freyther | 0b4b824 | 2016-09-08 15:09:16 +0200 | [diff] [blame] | 153 | tests/Makefile |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 154 | Makefile) |