blob: 69e0775c2672b8106e6428e5af4015fd61007a5d [file] [log] [blame]
Harald Welte57f6b022012-06-14 21:05:44 +08001dnl Process this file with autoconf to produce a configure script
2AC_INIT([osmo-pcu],
3 m4_esyscmd([./git-version-gen .tarball-version]),
Holger Hans Peter Freyther57522852015-05-22 10:43:34 +08004 [osmocom-net-gprs@lists.osmocom.org])
Harald Welte57f6b022012-06-14 21:05:44 +08005
Neels Hofmeyrda933e02016-10-01 00:35:06 +02006dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
7AC_CONFIG_AUX_DIR([.])
8
Harald Welte57f6b022012-06-14 21:05:44 +08009AM_INIT_AUTOMAKE([dist-bzip2])
Holger Hans Peter Freythere13298d2013-07-28 16:45:54 +020010AC_CONFIG_TESTDIR(tests)
Harald Welte57f6b022012-06-14 21:05:44 +080011
12dnl kernel style compile messages
13m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
14
Maxd78adfb2017-08-24 13:53:25 +020015dnl include release helper
16RELMAKE='-include osmo-release.mk'
17AC_SUBST([RELMAKE])
18
Harald Welte57f6b022012-06-14 21:05:44 +080019dnl checks for programs
20AC_PROG_MAKE_SET
21AC_PROG_CC
22AC_PROG_CXX
23AC_PROG_INSTALL
24LT_INIT
25
Neels Hofmeyrda66f712016-10-01 00:52:10 +020026dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
27AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
28if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
29 AC_MSG_WARN([You need to install pkg-config])
30fi
31PKG_PROG_PKG_CONFIG([0.20])
32
Harald Welte57f6b022012-06-14 21:05:44 +080033dnl checks for header files
34AC_HEADER_STDC
35
36dnl Checks for typedefs, structures and compiler characteristics
37
Maxb2f0b622017-12-21 17:27:34 +010038AC_ARG_ENABLE(sanitize,
39 [AS_HELP_STRING([--enable-sanitize], [Compile with address sanitizer enabled], )],
40 [sanitize=$enableval], [sanitize="no"])
41if test x"$sanitize" = x"yes"
42then
43 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
44 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
Max21419622018-01-14 22:17:10 +010045 LDFLAGS="$LDFLAGS -fsanitize=address -fsanitize=undefined"
Maxb2f0b622017-12-21 17:27:34 +010046fi
47
Neels Hofmeyr5a591942018-03-05 20:44:11 +010048AC_ARG_ENABLE(werror,
49 [AS_HELP_STRING(
50 [--enable-werror],
51 [Turn all compiler warnings into errors, with exceptions:
52 a) deprecation (allow upstream to mark deprecation without breaking builds);
53 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
54 ]
55 )],
56 [werror=$enableval], [werror="no"])
57if test x"$werror" = x"yes"
58then
59 WERROR_FLAGS="-Werror"
60 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
61 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
62 CFLAGS="$CFLAGS $WERROR_FLAGS"
63 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
64fi
65
Maxeffdec62017-12-28 14:18:02 +010066AC_ARG_ENABLE(profile,
67 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
68 [profile=$enableval], [profile="no"])
69if test x"$profile" = x"yes"
70then
71 CFLAGS="$CFLAGS -pg"
72 CPPFLAGS="$CPPFLAGS -pg"
73fi
74
Harald Welte57f6b022012-06-14 21:05:44 +080075dnl checks for libraries
Pau Espin Pedrol448750e2018-07-27 21:56:39 +020076PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.12.0)
77PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.12.0)
78PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.12.0)
79PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.12.0)
Harald Welte57f6b022012-06-14 21:05:44 +080080
Andreas Eversberga23c7ee2012-12-18 10:47:28 +010081AC_MSG_CHECKING([whether to enable direct DSP access for PDCH of sysmocom-bts])
82AC_ARG_ENABLE(sysmocom-dsp,
Neels Hofmeyra661bcd2018-03-29 16:47:41 +020083 AC_HELP_STRING([--enable-sysmocom-dsp],
84 [enable code for direct sysmocom DSP access[default=no]]),
85 [enable_sysmocom_dsp="$enableval"], [enable_sysmocom_dsp="unset"])
86AC_ARG_WITH([sysmobts],
87 [AS_HELP_STRING([--with-sysmobts=INCLUDE_DIR],
88 [Location of the sysmobts API header files, implies --enable-sysmocom-dsp])],
89 [sysmobts_incdir="$withval"], [sysmobts_incdir=""])
90if test "x$sysmobts_incdir" != "x"; then
91 # --with-sysmobts was passed, imply enable_sysmocom_dsp
92 if test "x$enable_sysmocom_dsp" = "xno"; then
93 AC_MSG_RESULT([error])
94 AC_MSG_ERROR([--with-sysmobts does not work with --disable-sysmocom-dsp])
95 fi
96 enable_sysmocom_dsp="yes"
97 # 'readlink' should make an absolute path, but must not return empty if the path does not exist,
98 # so we can still report on it below.
99 sysmobts_incdir="$(readlink -fm "$sysmobts_incdir")"
100 AC_SUBST([SYSMOBTS_INCDIR], $sysmobts_incdir)
101 AC_MSG_RESULT([yes, using -I$SYSMOBTS_INCDIR])
102else
103 AC_SUBST([SYSMOBTS_INCDIR], "")
104 AC_MSG_RESULT([$enable_sysmocom_dsp])
105fi
Andreas Eversberga23c7ee2012-12-18 10:47:28 +0100106AM_CONDITIONAL(ENABLE_SYSMODSP, test "x$enable_sysmocom_dsp" = "xyes")
Neels Hofmeyra661bcd2018-03-29 16:47:41 +0200107if test "x$enable_sysmocom_dsp" = "xyes"; then
108 oldCPPFLAGS="$CPPFLAGS"
109 _sysmobts_include=""
110 _sysmobts_include_msg=""
111 if test -n "$SYSMOBTS_INCDIR"; then
112 _sysmobts_include="-I$SYSMOBTS_INCDIR"
113 _sysmobts_include_msg=" in -I$SYSMOBTS_INCDIR"
114 fi
115 CPPFLAGS="$CPPFLAGS $_sysmobts_include -I$srcdir/include $LIBOSMOCORE_CFLAGS"
Max186206c2018-01-15 16:43:22 +0100116 AC_CHECK_HEADER([sysmocom/femtobts/superfemto.h],[],
Neels Hofmeyra661bcd2018-03-29 16:47:41 +0200117 [AC_MSG_ERROR([sysmocom/femtobts/superfemto.h can not be found$_sysmobts_include_msg, see --with-sysmobts])],
Max186206c2018-01-15 16:43:22 +0100118 [#include <sysmocom/femtobts/superfemto.h>])
Neels Hofmeyra661bcd2018-03-29 16:47:41 +0200119 CPPFLAGS="$oldCPPFLAGS"
Max186206c2018-01-15 16:43:22 +0100120fi
Andreas Eversberga23c7ee2012-12-18 10:47:28 +0100121
Yves Godin660709d2016-05-19 11:08:03 +0200122AC_MSG_CHECKING([whether to enable direct PHY access for PDCH of NuRAN Wireless Litecell 1.5 BTS])
123AC_ARG_ENABLE(lc15bts-phy,
124 AC_HELP_STRING([--enable-lc15bts-phy],
125 [enable code for Litecell 1.5 PHY [default=no]]),
126 [enable_lc15bts_phy="$enableval"],[enable_lc15bts_phy="no"])
127AC_ARG_WITH([litecell15], [AS_HELP_STRING([--with-litecell15=INCLUDE_DIR], [Location of the litecell 1.5 API header files])],
Harald Weltec136be02017-06-11 11:36:33 +0200128 [litecell15_cflags="-I$withval"],[litecell15_cflags=""])
129AC_SUBST([LITECELL15_CFLAGS], $litecell15_cflags)
Yves Godin660709d2016-05-19 11:08:03 +0200130AC_MSG_RESULT([$enable_lc15bts_phy])
131AM_CONDITIONAL(ENABLE_LC15BTS_PHY, test "x$enable_lc15bts_phy" = "xyes")
132if test "$enable_litecell15" = "yes"; then
Neels Hofmeyr9f06cbf2018-03-29 17:04:43 +0200133 oldCPPFLAGS="$CPPFLAGS"
Harald Weltec136be02017-06-11 11:36:33 +0200134 CPPFLAGS="$CPPFLAGS $LITECELL15_CFLAGS -I$srcdir/include $LIBOSMOCORE_CFLAGS"
Yves Godin660709d2016-05-19 11:08:03 +0200135 AC_CHECK_HEADER([nrw/litecell15/litecell15.h],[],
Harald Weltec136be02017-06-11 11:36:33 +0200136 [AC_MSG_ERROR([nrw/litecell15/litecell15.h can not be found using $litecell15_cflags])],
Yves Godin660709d2016-05-19 11:08:03 +0200137 [#include <nrw/litecell15/litecell15.h>])
Neels Hofmeyr9f06cbf2018-03-29 17:04:43 +0200138 CPPFLAGS="$oldCPPFLAGS"
Yves Godin660709d2016-05-19 11:08:03 +0200139fi
140
Kat7dac4862013-04-05 21:44:46 +0200141AC_ARG_ENABLE([vty_tests],
142 AC_HELP_STRING([--enable-vty-tests],
Ivan Kluchnikovb6bb55d2013-04-24 15:53:25 +0400143 [Include the VTY tests in make check [default=no]]),
144 [enable_vty_tests="$enableval"],[enable_vty_tests="no"])
Kat7dac4862013-04-05 21:44:46 +0200145if test "x$enable_vty_tests" = "xyes" ; then
146 AM_PATH_PYTHON
147 AC_CHECK_PROG(OSMOTESTVTY_CHECK,osmotestvty.py,yes)
148 if test "x$OSMOTESTVTY_CHECK" != "xyes" ; then
149 AC_MSG_ERROR([Please install osmocom-python to run the vty tests.])
150 fi
151fi
152AC_MSG_CHECKING([whether to enable VTY tests])
153AC_MSG_RESULT([$enable_vty_tests])
154AM_CONDITIONAL(ENABLE_VTY_TESTS, test "x$enable_vty_tests" = "xyes")
155
Neels Hofmeyr6348aea2016-09-30 16:25:16 +0200156STD_DEFINES_AND_INCLUDES="-Wall"
157AC_SUBST(STD_DEFINES_AND_INCLUDES)
158
Neels Hofmeyr5a591942018-03-05 20:44:11 +0100159AC_MSG_RESULT([CFLAGS="$CFLAGS"])
160AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
161
Harald Welte57f6b022012-06-14 21:05:44 +0800162AC_OUTPUT(
Max727295f2017-03-08 11:58:57 +0100163 osmo-pcu.pc
Harald Welte68fc1272016-11-16 22:48:33 +0100164 include/Makefile
Harald Welte57f6b022012-06-14 21:05:44 +0800165 src/Makefile
Harald Weltee4050112013-01-11 17:49:22 +0100166 examples/Makefile
Holger Hans Peter Freytherbb007042013-07-28 16:15:41 +0200167 tests/Makefile
Harald Welte57f6b022012-06-14 21:05:44 +0800168 Makefile)