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) |
Joachim Steiger | 52f06fd | 2021-04-09 23:57:01 +0200 | [diff] [blame] | 8 | AC_ARG_ENABLE(manuals, |
| 9 | [AS_HELP_STRING( |
| 10 | [--enable-manuals], |
| 11 | [Generate manual PDFs [default=no]], |
| 12 | )], |
| 13 | [osmo_ac_build_manuals=$enableval], [osmo_ac_build_manuals="no"]) |
| 14 | AM_CONDITIONAL([BUILD_MANUALS], [test x"$osmo_ac_build_manuals" = x"yes"]) |
| 15 | AC_ARG_VAR(OSMO_GSM_MANUALS_DIR, [path to common osmo-gsm-manuals files, overriding pkg-config and "../osmo-gsm-manuals" |
| 16 | fallback]) |
| 17 | if test x"$osmo_ac_build_manuals" = x"yes" |
| 18 | then |
| 19 | # Find OSMO_GSM_MANUALS_DIR (env, pkg-conf, fallback) |
| 20 | if test -n "$OSMO_GSM_MANUALS_DIR"; then |
| 21 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from env)" |
| 22 | else |
| 23 | OSMO_GSM_MANUALS_DIR="$($PKG_CONFIG osmo-gsm-manuals --variable=osmogsmmanualsdir 2>/dev/null)" |
| 24 | if test -n "$OSMO_GSM_MANUALS_DIR"; then |
| 25 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (from pkg-conf)" |
| 26 | else |
| 27 | OSMO_GSM_MANUALS_DIR="../osmo-gsm-manuals" |
| 28 | echo "checking for OSMO_GSM_MANUALS_DIR... $OSMO_GSM_MANUALS_DIR (fallback)" |
| 29 | fi |
| 30 | fi |
| 31 | if ! test -d "$OSMO_GSM_MANUALS_DIR"; then |
| 32 | AC_MSG_ERROR("OSMO_GSM_MANUALS_DIR does not exist! Install osmo-gsm-manuals or set OSMO_GSM_MANUALS_DIR.") |
| 33 | fi |
| 34 | |
| 35 | # Find and run check-depends |
| 36 | CHECK_DEPENDS="$OSMO_GSM_MANUALS_DIR/check-depends.sh" |
| 37 | if ! test -x "$CHECK_DEPENDS"; then |
| 38 | CHECK_DEPENDS="osmo-gsm-manuals-check-depends" |
| 39 | fi |
| 40 | if ! $CHECK_DEPENDS; then |
| 41 | AC_MSG_ERROR("missing dependencies for --enable-manuals") |
| 42 | fi |
| 43 | |
| 44 | # Put in Makefile with absolute path |
| 45 | OSMO_GSM_MANUALS_DIR="$(realpath "$OSMO_GSM_MANUALS_DIR")" |
| 46 | AC_SUBST([OSMO_GSM_MANUALS_DIR]) |
| 47 | fi |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 48 | |
Oliver Smith | 288c39b | 2021-01-27 17:52:22 +0100 | [diff] [blame] | 49 | CFLAGS="$CFLAGS -std=gnu11" |
| 50 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 51 | dnl kernel style compile messages |
| 52 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 53 | |
Max | 53044df | 2017-08-28 12:05:57 +0200 | [diff] [blame] | 54 | dnl include release helper |
| 55 | RELMAKE='-include osmo-release.mk' |
| 56 | AC_SUBST([RELMAKE]) |
| 57 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 58 | dnl checks for programs |
| 59 | AC_PROG_MAKE_SET |
| 60 | AC_PROG_CC |
| 61 | AC_PROG_INSTALL |
| 62 | AC_PROG_RANLIB |
| 63 | |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame] | 64 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 65 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 66 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 67 | AC_MSG_WARN([You need to install pkg-config]) |
| 68 | fi |
| 69 | PKG_PROG_PKG_CONFIG([0.20]) |
| 70 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 71 | dnl checks for header files |
| 72 | AC_HEADER_STDC |
| 73 | |
Pau Espin Pedrol | e241ead | 2018-10-08 13:39:51 +0200 | [diff] [blame] | 74 | AC_ARG_ENABLE(sanitize, |
| 75 | [AS_HELP_STRING( |
| 76 | [--enable-sanitize], |
| 77 | [Compile with address sanitizer enabled], |
| 78 | )], |
| 79 | [sanitize=$enableval], [sanitize="no"]) |
| 80 | if test x"$sanitize" = x"yes" |
| 81 | then |
| 82 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 83 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 84 | fi |
| 85 | |
Pau Espin Pedrol | f59fabf | 2018-10-08 13:38:42 +0200 | [diff] [blame] | 86 | AC_ARG_ENABLE(werror, |
| 87 | [AS_HELP_STRING( |
| 88 | [--enable-werror], |
| 89 | [Turn all compiler warnings into errors, with exceptions: |
| 90 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 91 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 92 | ] |
| 93 | )], |
| 94 | [werror=$enableval], [werror="no"]) |
| 95 | if test x"$werror" = x"yes" |
| 96 | then |
| 97 | WERROR_FLAGS="-Werror" |
| 98 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 99 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 100 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 101 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 102 | fi |
| 103 | |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame] | 104 | # https://www.freedesktop.org/software/systemd/man/daemon.html |
| 105 | AC_ARG_WITH([systemdsystemunitdir], |
| 106 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, |
| 107 | [with_systemdsystemunitdir=auto]) |
| 108 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ |
| 109 | def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 110 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 111 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 112 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) |
| 113 | with_systemdsystemunitdir=no], |
| 114 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) |
| 115 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 116 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 117 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 118 | |
Holger Hans Peter Freyther | 0b4b824 | 2016-09-08 15:09:16 +0200 | [diff] [blame] | 119 | AC_ARG_ENABLE([external_tests], |
| 120 | AC_HELP_STRING([--enable-external-tests], |
| 121 | [Include the VTY tests in make check [default=no]]), |
| 122 | [enable_ext_tests="$enableval"],[enable_ext_tests="no"]) |
| 123 | if test "x$enable_ext_tests" = "xyes" ; then |
| 124 | AM_PATH_PYTHON |
| 125 | AC_CHECK_PROG(OSMOTESTEXT_CHECK,osmotestvty.py,yes) |
| 126 | if test "x$OSMOTESTEXT_CHECK" != "xyes" ; then |
| 127 | AC_MSG_ERROR([Please install osmocom-python to run the VTY tests.]) |
| 128 | fi |
| 129 | fi |
| 130 | AC_MSG_CHECKING([whether to enable VTY tests]) |
| 131 | AC_MSG_RESULT([$enable_ext_tests]) |
| 132 | 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] | 133 | |
| 134 | dnl Checks for typedefs, structures and compiler characteristics |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 135 | AC_ARG_WITH([pcap-config], |
| 136 | AC_HELP_STRING([--with-pcap-config=FILE], [Use given pcap-config]), |
| 137 | [pcapcfg="$withval" ], |
| 138 | [AC_PATH_PROG([pcapcfg], [pcap-config], [])]) |
| 139 | if test x$pcapcfg = "x"; then |
| 140 | AC_MSG_ERROR([pcap-config can not be found]) |
| 141 | fi |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 142 | |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 143 | dnl CentOS 5 and Debian 6.0 do not ship with a pcap-config and we somehow |
| 144 | dnl need to support these versions. Once we drop support for these two distros |
| 145 | dnl the below can be simplified again. |
| 146 | AC_ARG_VAR([PCAP_LIBS], [PCAP library files]) |
| 147 | AC_ARG_VAR([PCAP_CFLAGS], [PCAP C compiler flags]) |
| 148 | |
| 149 | if test "x$ac_cv_env_PCAP_LIBS_set" != "xset"; then |
| 150 | PCAP_LIBS=`$pcapcfg --libs` |
| 151 | fi |
| 152 | |
| 153 | if test "x$ac_cv_env_PCAP_CFLAGS_set" != "xset"; then |
| 154 | PCAP_CFLAGS=`$pcapcfg --cflags` |
| 155 | fi |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 156 | AC_SUBST([PCAP_LIBS]) |
| 157 | AC_SUBST([PCAP_CFLAGS]) |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 158 | |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 159 | dnl checks for libraries |
Pau Espin Pedrol | bddebae | 2022-06-28 17:36:44 +0200 | [diff] [blame^] | 160 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.7.0) |
Oliver Smith | 235eba3 | 2021-12-13 12:36:24 +0100 | [diff] [blame] | 161 | # libosmogb: needed for osmocom/gprs includes |
Pau Espin Pedrol | bddebae | 2022-06-28 17:36:44 +0200 | [diff] [blame^] | 162 | PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 1.7.0) |
| 163 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.7.0) |
| 164 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.7.0) |
Holger Hans Peter Freyther | e024869 | 2016-08-05 15:47:08 +0200 | [diff] [blame] | 165 | PKG_CHECK_MODULES(LIBZMQ, libzmq >= 3.2.2) |
Holger Hans Peter Freyther | c266796 | 2016-08-25 23:07:44 +0200 | [diff] [blame] | 166 | PKG_CHECK_MODULES(LIBGNUTLS, gnutls) |
Holger Hans Peter Freyther | 6d06bb1 | 2012-11-06 23:38:57 +0100 | [diff] [blame] | 167 | |
| 168 | |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 169 | # Coverage build taken from WebKit's configure.in |
| 170 | AC_MSG_CHECKING([whether to enable code coverage support]) |
| 171 | AC_ARG_ENABLE(coverage, |
| 172 | AC_HELP_STRING([--enable-coverage], |
| 173 | [enable code coverage support [default=no]]), |
| 174 | [],[enable_coverage="no"]) |
| 175 | AC_MSG_RESULT([$enable_coverage]) |
| 176 | if test "$enable_coverage" = "yes"; then |
| 177 | COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs" |
| 178 | COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs" |
| 179 | AC_SUBST([COVERAGE_CFLAGS]) |
| 180 | AC_SUBST([COVERAGE_LDFLAGS]) |
| 181 | fi |
| 182 | |
Holger Hans Peter Freyther | 530ecc0 | 2011-05-31 15:47:44 +0200 | [diff] [blame] | 183 | AM_CONFIG_HEADER(osmopcapconfig.h) |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 184 | |
| 185 | dnl Generate the output |
| 186 | AC_OUTPUT( |
Holger Hans Peter Freyther | 430366a | 2011-05-31 11:16:40 +0200 | [diff] [blame] | 187 | include/Makefile |
| 188 | include/osmo-pcap/Makefile |
| 189 | src/Makefile |
Daniel Willmann | 5d62ed0 | 2011-07-19 11:58:15 +0200 | [diff] [blame] | 190 | contrib/Makefile |
Pau Espin Pedrol | b29f84f | 2018-10-31 10:38:18 +0100 | [diff] [blame] | 191 | contrib/systemd/Makefile |
Oliver Smith | fd387ec | 2020-05-14 11:50:15 +0200 | [diff] [blame] | 192 | contrib/osmo-pcap.spec |
Pau Espin Pedrol | 45283d8 | 2018-10-31 11:05:00 +0100 | [diff] [blame] | 193 | doc/Makefile |
| 194 | doc/examples/Makefile |
Joachim Steiger | 52f06fd | 2021-04-09 23:57:01 +0200 | [diff] [blame] | 195 | doc/manuals/Makefile |
Holger Hans Peter Freyther | 0b4b824 | 2016-09-08 15:09:16 +0200 | [diff] [blame] | 196 | tests/Makefile |
Holger Hans Peter Freyther | fbea390 | 2011-05-31 10:19:47 +0200 | [diff] [blame] | 197 | Makefile) |