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 | |
| 9 | dnl kernel style compile messages |
| 10 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 11 | |
Max | 53044df | 2017-08-28 12:05:57 +0200 | [diff] [blame] | 12 | dnl include release helper |
| 13 | RELMAKE='-include osmo-release.mk' |
| 14 | AC_SUBST([RELMAKE]) |
| 15 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 16 | dnl checks for programs |
| 17 | AC_PROG_MAKE_SET |
| 18 | AC_PROG_CC |
| 19 | AC_PROG_INSTALL |
| 20 | AC_PROG_RANLIB |
| 21 | |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame^] | 22 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 23 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 24 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 25 | AC_MSG_WARN([You need to install pkg-config]) |
| 26 | fi |
| 27 | PKG_PROG_PKG_CONFIG([0.20]) |
| 28 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 29 | dnl checks for header files |
| 30 | AC_HEADER_STDC |
| 31 | |
Pau Espin Pedrol | e241ead | 2018-10-08 13:39:51 +0200 | [diff] [blame] | 32 | AC_ARG_ENABLE(sanitize, |
| 33 | [AS_HELP_STRING( |
| 34 | [--enable-sanitize], |
| 35 | [Compile with address sanitizer enabled], |
| 36 | )], |
| 37 | [sanitize=$enableval], [sanitize="no"]) |
| 38 | if test x"$sanitize" = x"yes" |
| 39 | then |
| 40 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 41 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 42 | fi |
| 43 | |
Pau Espin Pedrol | f59fabf | 2018-10-08 13:38:42 +0200 | [diff] [blame] | 44 | AC_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"]) |
| 53 | if test x"$werror" = x"yes" |
| 54 | then |
| 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" |
| 60 | fi |
| 61 | |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame^] | 62 | # https://www.freedesktop.org/software/systemd/man/daemon.html |
| 63 | AC_ARG_WITH([systemdsystemunitdir], |
| 64 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, |
| 65 | [with_systemdsystemunitdir=auto]) |
| 66 | AS_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"])]) |
| 73 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 74 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 75 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 76 | |
Holger Hans Peter Freyther | 0b4b824 | 2016-09-08 15:09:16 +0200 | [diff] [blame] | 77 | AC_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"]) |
| 81 | if 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 |
| 87 | fi |
| 88 | AC_MSG_CHECKING([whether to enable VTY tests]) |
| 89 | AC_MSG_RESULT([$enable_ext_tests]) |
| 90 | 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] | 91 | |
| 92 | dnl Checks for typedefs, structures and compiler characteristics |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 93 | AC_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], [])]) |
| 97 | if test x$pcapcfg = "x"; then |
| 98 | AC_MSG_ERROR([pcap-config can not be found]) |
| 99 | fi |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 100 | |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 101 | dnl CentOS 5 and Debian 6.0 do not ship with a pcap-config and we somehow |
| 102 | dnl need to support these versions. Once we drop support for these two distros |
| 103 | dnl the below can be simplified again. |
| 104 | AC_ARG_VAR([PCAP_LIBS], [PCAP library files]) |
| 105 | AC_ARG_VAR([PCAP_CFLAGS], [PCAP C compiler flags]) |
| 106 | |
| 107 | if test "x$ac_cv_env_PCAP_LIBS_set" != "xset"; then |
| 108 | PCAP_LIBS=`$pcapcfg --libs` |
| 109 | fi |
| 110 | |
| 111 | if test "x$ac_cv_env_PCAP_CFLAGS_set" != "xset"; then |
| 112 | PCAP_CFLAGS=`$pcapcfg --cflags` |
| 113 | fi |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 114 | AC_SUBST([PCAP_LIBS]) |
| 115 | AC_SUBST([PCAP_CFLAGS]) |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 116 | |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 117 | dnl checks for libraries |
| 118 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.2) |
Holger Hans Peter Freyther | b7a834b | 2015-09-10 16:45:45 +0200 | [diff] [blame] | 119 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.2) |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 120 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) |
Holger Hans Peter Freyther | e024869 | 2016-08-05 15:47:08 +0200 | [diff] [blame] | 121 | PKG_CHECK_MODULES(LIBZMQ, libzmq >= 3.2.2) |
Holger Hans Peter Freyther | c266796 | 2016-08-25 23:07:44 +0200 | [diff] [blame] | 122 | PKG_CHECK_MODULES(LIBGNUTLS, gnutls) |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 123 | |
| 124 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 125 | # Coverage build taken from WebKit's configure.in |
| 126 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 127 | AC_ARG_ENABLE(coverage, |
| 128 | AC_HELP_STRING([--enable-coverage], |
| 129 | [enable code coverage support [default=no]]), |
| 130 | [],[enable_coverage="no"]) |
| 131 | AC_MSG_RESULT([$enable_coverage]) |
| 132 | if 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]) |
| 137 | fi |
| 138 | |
Holger Hans Peter Freyther | 530ecc0 | 2011-05-31 15:47:44 +0200 | [diff] [blame] | 139 | AM_CONFIG_HEADER(osmopcapconfig.h) |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 140 | |
| 141 | dnl Generate the output |
| 142 | AC_OUTPUT( |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 143 | include/Makefile |
| 144 | include/osmo-pcap/Makefile |
| 145 | src/Makefile |
Daniel Willmann | 5d62ed0 | 2011-07-19 11:58:15 +0200 | [diff] [blame] | 146 | contrib/Makefile |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame^] | 147 | contrib/systemd/Makefile |
Holger Hans Peter Freyther | 0b4b824 | 2016-09-08 15:09:16 +0200 | [diff] [blame] | 148 | tests/Makefile |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 149 | Makefile) |