Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script |
| 2 | AC_INIT([osmo-pcu], |
| 3 | m4_esyscmd([./git-version-gen .tarball-version]), |
Holger Hans Peter Freyther | 5752285 | 2015-05-22 10:43:34 +0800 | [diff] [blame] | 4 | [osmocom-net-gprs@lists.osmocom.org]) |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 5 | |
Neels Hofmeyr | da933e0 | 2016-10-01 00:35:06 +0200 | [diff] [blame] | 6 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 7 | AC_CONFIG_AUX_DIR([.]) |
| 8 | |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 9 | AM_INIT_AUTOMAKE([dist-bzip2]) |
Holger Hans Peter Freyther | e13298d | 2013-07-28 16:45:54 +0200 | [diff] [blame] | 10 | AC_CONFIG_TESTDIR(tests) |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 11 | |
| 12 | dnl kernel style compile messages |
| 13 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 14 | |
Max | d78adfb | 2017-08-24 13:53:25 +0200 | [diff] [blame] | 15 | dnl include release helper |
| 16 | RELMAKE='-include osmo-release.mk' |
| 17 | AC_SUBST([RELMAKE]) |
| 18 | |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 19 | dnl checks for programs |
| 20 | AC_PROG_MAKE_SET |
| 21 | AC_PROG_CC |
| 22 | AC_PROG_CXX |
| 23 | AC_PROG_INSTALL |
| 24 | LT_INIT |
| 25 | |
Neels Hofmeyr | da66f71 | 2016-10-01 00:52:10 +0200 | [diff] [blame] | 26 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 27 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 28 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 29 | AC_MSG_WARN([You need to install pkg-config]) |
| 30 | fi |
| 31 | PKG_PROG_PKG_CONFIG([0.20]) |
| 32 | |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 33 | dnl checks for header files |
| 34 | AC_HEADER_STDC |
| 35 | |
| 36 | dnl Checks for typedefs, structures and compiler characteristics |
| 37 | |
Max | b2f0b62 | 2017-12-21 17:27:34 +0100 | [diff] [blame] | 38 | AC_ARG_ENABLE(sanitize, |
| 39 | [AS_HELP_STRING([--enable-sanitize], [Compile with address sanitizer enabled], )], |
| 40 | [sanitize=$enableval], [sanitize="no"]) |
| 41 | if test x"$sanitize" = x"yes" |
| 42 | then |
| 43 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
Pau Espin Pedrol | 3e9c071 | 2018-09-10 14:50:24 +0200 | [diff] [blame] | 44 | CXXFLAGS="$CXXFLAGS -fsanitize=address -fsanitize=undefined" |
Max | b2f0b62 | 2017-12-21 17:27:34 +0100 | [diff] [blame] | 45 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
Max | 2141962 | 2018-01-14 22:17:10 +0100 | [diff] [blame] | 46 | LDFLAGS="$LDFLAGS -fsanitize=address -fsanitize=undefined" |
Max | b2f0b62 | 2017-12-21 17:27:34 +0100 | [diff] [blame] | 47 | fi |
| 48 | |
Neels Hofmeyr | 5a59194 | 2018-03-05 20:44:11 +0100 | [diff] [blame] | 49 | AC_ARG_ENABLE(werror, |
| 50 | [AS_HELP_STRING( |
| 51 | [--enable-werror], |
| 52 | [Turn all compiler warnings into errors, with exceptions: |
| 53 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 54 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 55 | ] |
| 56 | )], |
| 57 | [werror=$enableval], [werror="no"]) |
| 58 | if test x"$werror" = x"yes" |
| 59 | then |
| 60 | WERROR_FLAGS="-Werror" |
| 61 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 62 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 63 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 64 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 65 | fi |
| 66 | |
Max | effdec6 | 2017-12-28 14:18:02 +0100 | [diff] [blame] | 67 | AC_ARG_ENABLE(profile, |
| 68 | [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )], |
| 69 | [profile=$enableval], [profile="no"]) |
| 70 | if test x"$profile" = x"yes" |
| 71 | then |
| 72 | CFLAGS="$CFLAGS -pg" |
| 73 | CPPFLAGS="$CPPFLAGS -pg" |
| 74 | fi |
| 75 | |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 76 | dnl checks for libraries |
Pau Espin Pedrol | 448750e | 2018-07-27 21:56:39 +0200 | [diff] [blame] | 77 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.12.0) |
| 78 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.12.0) |
| 79 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.12.0) |
| 80 | PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.12.0) |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 81 | |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 82 | AC_MSG_CHECKING([whether to enable direct DSP access for PDCH of sysmocom-bts]) |
| 83 | AC_ARG_ENABLE(sysmocom-dsp, |
Neels Hofmeyr | a661bcd | 2018-03-29 16:47:41 +0200 | [diff] [blame] | 84 | AC_HELP_STRING([--enable-sysmocom-dsp], |
| 85 | [enable code for direct sysmocom DSP access[default=no]]), |
| 86 | [enable_sysmocom_dsp="$enableval"], [enable_sysmocom_dsp="unset"]) |
| 87 | AC_ARG_WITH([sysmobts], |
| 88 | [AS_HELP_STRING([--with-sysmobts=INCLUDE_DIR], |
| 89 | [Location of the sysmobts API header files, implies --enable-sysmocom-dsp])], |
| 90 | [sysmobts_incdir="$withval"], [sysmobts_incdir=""]) |
| 91 | if test "x$sysmobts_incdir" != "x"; then |
| 92 | # --with-sysmobts was passed, imply enable_sysmocom_dsp |
| 93 | if test "x$enable_sysmocom_dsp" = "xno"; then |
| 94 | AC_MSG_RESULT([error]) |
| 95 | AC_MSG_ERROR([--with-sysmobts does not work with --disable-sysmocom-dsp]) |
| 96 | fi |
| 97 | enable_sysmocom_dsp="yes" |
| 98 | # 'readlink' should make an absolute path, but must not return empty if the path does not exist, |
| 99 | # so we can still report on it below. |
| 100 | sysmobts_incdir="$(readlink -fm "$sysmobts_incdir")" |
| 101 | AC_SUBST([SYSMOBTS_INCDIR], $sysmobts_incdir) |
| 102 | AC_MSG_RESULT([yes, using -I$SYSMOBTS_INCDIR]) |
| 103 | else |
| 104 | AC_SUBST([SYSMOBTS_INCDIR], "") |
| 105 | AC_MSG_RESULT([$enable_sysmocom_dsp]) |
| 106 | fi |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 107 | AM_CONDITIONAL(ENABLE_SYSMODSP, test "x$enable_sysmocom_dsp" = "xyes") |
Neels Hofmeyr | a661bcd | 2018-03-29 16:47:41 +0200 | [diff] [blame] | 108 | if test "x$enable_sysmocom_dsp" = "xyes"; then |
| 109 | oldCPPFLAGS="$CPPFLAGS" |
| 110 | _sysmobts_include="" |
| 111 | _sysmobts_include_msg="" |
| 112 | if test -n "$SYSMOBTS_INCDIR"; then |
| 113 | _sysmobts_include="-I$SYSMOBTS_INCDIR" |
| 114 | _sysmobts_include_msg=" in -I$SYSMOBTS_INCDIR" |
| 115 | fi |
| 116 | CPPFLAGS="$CPPFLAGS $_sysmobts_include -I$srcdir/include $LIBOSMOCORE_CFLAGS" |
Max | 186206c | 2018-01-15 16:43:22 +0100 | [diff] [blame] | 117 | AC_CHECK_HEADER([sysmocom/femtobts/superfemto.h],[], |
Neels Hofmeyr | a661bcd | 2018-03-29 16:47:41 +0200 | [diff] [blame] | 118 | [AC_MSG_ERROR([sysmocom/femtobts/superfemto.h can not be found$_sysmobts_include_msg, see --with-sysmobts])], |
Max | 186206c | 2018-01-15 16:43:22 +0100 | [diff] [blame] | 119 | [#include <sysmocom/femtobts/superfemto.h>]) |
Neels Hofmeyr | a661bcd | 2018-03-29 16:47:41 +0200 | [diff] [blame] | 120 | CPPFLAGS="$oldCPPFLAGS" |
Max | 186206c | 2018-01-15 16:43:22 +0100 | [diff] [blame] | 121 | fi |
Andreas Eversberg | a23c7ee | 2012-12-18 10:47:28 +0100 | [diff] [blame] | 122 | |
Yves Godin | 660709d | 2016-05-19 11:08:03 +0200 | [diff] [blame] | 123 | AC_MSG_CHECKING([whether to enable direct PHY access for PDCH of NuRAN Wireless Litecell 1.5 BTS]) |
| 124 | AC_ARG_ENABLE(lc15bts-phy, |
| 125 | AC_HELP_STRING([--enable-lc15bts-phy], |
| 126 | [enable code for Litecell 1.5 PHY [default=no]]), |
| 127 | [enable_lc15bts_phy="$enableval"],[enable_lc15bts_phy="no"]) |
| 128 | AC_ARG_WITH([litecell15], [AS_HELP_STRING([--with-litecell15=INCLUDE_DIR], [Location of the litecell 1.5 API header files])], |
Harald Welte | c136be0 | 2017-06-11 11:36:33 +0200 | [diff] [blame] | 129 | [litecell15_cflags="-I$withval"],[litecell15_cflags=""]) |
| 130 | AC_SUBST([LITECELL15_CFLAGS], $litecell15_cflags) |
Yves Godin | 660709d | 2016-05-19 11:08:03 +0200 | [diff] [blame] | 131 | AC_MSG_RESULT([$enable_lc15bts_phy]) |
| 132 | AM_CONDITIONAL(ENABLE_LC15BTS_PHY, test "x$enable_lc15bts_phy" = "xyes") |
| 133 | if test "$enable_litecell15" = "yes"; then |
Neels Hofmeyr | 9f06cbf | 2018-03-29 17:04:43 +0200 | [diff] [blame] | 134 | oldCPPFLAGS="$CPPFLAGS" |
Harald Welte | c136be0 | 2017-06-11 11:36:33 +0200 | [diff] [blame] | 135 | CPPFLAGS="$CPPFLAGS $LITECELL15_CFLAGS -I$srcdir/include $LIBOSMOCORE_CFLAGS" |
Yves Godin | 660709d | 2016-05-19 11:08:03 +0200 | [diff] [blame] | 136 | AC_CHECK_HEADER([nrw/litecell15/litecell15.h],[], |
Harald Welte | c136be0 | 2017-06-11 11:36:33 +0200 | [diff] [blame] | 137 | [AC_MSG_ERROR([nrw/litecell15/litecell15.h can not be found using $litecell15_cflags])], |
Yves Godin | 660709d | 2016-05-19 11:08:03 +0200 | [diff] [blame] | 138 | [#include <nrw/litecell15/litecell15.h>]) |
Neels Hofmeyr | 9f06cbf | 2018-03-29 17:04:43 +0200 | [diff] [blame] | 139 | CPPFLAGS="$oldCPPFLAGS" |
Yves Godin | 660709d | 2016-05-19 11:08:03 +0200 | [diff] [blame] | 140 | fi |
| 141 | |
Kat | 7dac486 | 2013-04-05 21:44:46 +0200 | [diff] [blame] | 142 | AC_ARG_ENABLE([vty_tests], |
| 143 | AC_HELP_STRING([--enable-vty-tests], |
Ivan Kluchnikov | b6bb55d | 2013-04-24 15:53:25 +0400 | [diff] [blame] | 144 | [Include the VTY tests in make check [default=no]]), |
| 145 | [enable_vty_tests="$enableval"],[enable_vty_tests="no"]) |
Kat | 7dac486 | 2013-04-05 21:44:46 +0200 | [diff] [blame] | 146 | if test "x$enable_vty_tests" = "xyes" ; then |
| 147 | AM_PATH_PYTHON |
| 148 | AC_CHECK_PROG(OSMOTESTVTY_CHECK,osmotestvty.py,yes) |
| 149 | if test "x$OSMOTESTVTY_CHECK" != "xyes" ; then |
| 150 | AC_MSG_ERROR([Please install osmocom-python to run the vty tests.]) |
| 151 | fi |
| 152 | fi |
| 153 | AC_MSG_CHECKING([whether to enable VTY tests]) |
| 154 | AC_MSG_RESULT([$enable_vty_tests]) |
| 155 | AM_CONDITIONAL(ENABLE_VTY_TESTS, test "x$enable_vty_tests" = "xyes") |
| 156 | |
Neels Hofmeyr | 6348aea | 2016-09-30 16:25:16 +0200 | [diff] [blame] | 157 | STD_DEFINES_AND_INCLUDES="-Wall" |
| 158 | AC_SUBST(STD_DEFINES_AND_INCLUDES) |
| 159 | |
Pau Espin Pedrol | 516697e | 2018-09-10 13:28:25 +0200 | [diff] [blame^] | 160 | # https://www.freedesktop.org/software/systemd/man/daemon.html |
| 161 | AC_ARG_WITH([systemdsystemunitdir], |
| 162 | [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, |
| 163 | [with_systemdsystemunitdir=auto]) |
| 164 | AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [ |
| 165 | def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) |
| 166 | |
| 167 | AS_IF([test "x$def_systemdsystemunitdir" = "x"], |
| 168 | [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], |
| 169 | [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) |
| 170 | with_systemdsystemunitdir=no], |
| 171 | [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) |
| 172 | AS_IF([test "x$with_systemdsystemunitdir" != "xno"], |
| 173 | [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) |
| 174 | AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) |
| 175 | |
Neels Hofmeyr | 5a59194 | 2018-03-05 20:44:11 +0100 | [diff] [blame] | 176 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
Pau Espin Pedrol | 3e9c071 | 2018-09-10 14:50:24 +0200 | [diff] [blame] | 177 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 178 | AC_MSG_RESULT([CXXFLAGS="$CXXFLAGS"]) |
| 179 | AC_MSG_RESULT([LDFLAGS="$LDFLAGS"]) |
Neels Hofmeyr | 5a59194 | 2018-03-05 20:44:11 +0100 | [diff] [blame] | 180 | |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 181 | AC_OUTPUT( |
Max | 727295f | 2017-03-08 11:58:57 +0100 | [diff] [blame] | 182 | osmo-pcu.pc |
Harald Welte | 68fc127 | 2016-11-16 22:48:33 +0100 | [diff] [blame] | 183 | include/Makefile |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 184 | src/Makefile |
Harald Welte | e405011 | 2013-01-11 17:49:22 +0100 | [diff] [blame] | 185 | examples/Makefile |
Holger Hans Peter Freyther | bb00704 | 2013-07-28 16:15:41 +0200 | [diff] [blame] | 186 | tests/Makefile |
Pau Espin Pedrol | 516697e | 2018-09-10 13:28:25 +0200 | [diff] [blame^] | 187 | contrib/Makefile |
| 188 | contrib/systemd/Makefile |
Harald Welte | 57f6b02 | 2012-06-14 21:05:44 +0800 | [diff] [blame] | 189 | Makefile) |