blob: 44a040c03177ad972b26c3b4dfaf1f5eda6bdcb2 [file] [log] [blame]
Harald Welte54ca6f42018-06-04 21:52:30 +02001dnl Process this file with autoconf to produce a configure script
Harald Welteb8038882018-06-04 22:00:03 +02002AC_INIT([osmo-sysmon],
Harald Welte54ca6f42018-06-04 21:52:30 +02003 m4_esyscmd([./git-version-gen .tarball-version]),
4 [openbsc@lists.osmocom.org])
5
6dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
7AC_CONFIG_AUX_DIR([.])
8
9AM_INIT_AUTOMAKE([dist-bzip2 foreign])
10
11dnl kernel style compile messages
12m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
13
14dnl include release helper
15RELMAKE='-include osmo-release.mk'
16AC_SUBST([RELMAKE])
17
18dnl checks for programs
19AC_PROG_MAKE_SET
20AC_PROG_CC
21AC_PROG_INSTALL
22LT_INIT
23
24dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
25AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
26if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
27 AC_MSG_WARN([You need to install pkg-config])
28fi
29PKG_PROG_PKG_CONFIG([0.20])
30
31dnl check for AX_CHECK_COMPILE_FLAG
32m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [
33 AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.])
34 ])
35
36dnl checks for libraries
37AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
38AC_SUBST(LIBRARY_DL)
39
40
41PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.11.0)
42PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.11.0)
43PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 0.11.0)
44PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.11.0)
Max9a852f22019-01-31 15:58:57 +010045PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.4.0)
Harald Welte54ca6f42018-06-04 21:52:30 +020046PKG_CHECK_MODULES(LIBMNL, libmnl)
Max8066a412019-01-28 23:59:03 +010047dnl FIXME: bump to 1.10.0 once it's available on build slaves and remove workaround from osysmon_ping.c
48PKG_CHECK_MODULES(LIBOPING, liboping >= 1.9.0)
Harald Welte54ca6f42018-06-04 21:52:30 +020049
50dnl checks for header files
51AC_HEADER_STDC
52
53dnl Checks for typedefs, structures and compiler characteristics
54
55AC_ARG_ENABLE(sanitize,
56 [AS_HELP_STRING(
57 [--enable-sanitize],
58 [Compile with address sanitizer enabled],
59 )],
60 [sanitize=$enableval], [sanitize="no"])
61if test x"$sanitize" = x"yes"
62then
63 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
64 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
65fi
66
67AC_ARG_ENABLE(werror,
68 [AS_HELP_STRING(
69 [--enable-werror],
70 [Turn all compiler warnings into errors, with exceptions:
71 a) deprecation (allow upstream to mark deprecation without breaking builds);
72 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
73 ]
74 )],
75 [werror=$enableval], [werror="no"])
76if test x"$werror" = x"yes"
77then
78 WERROR_FLAGS="-Werror"
79 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
80 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
81 CFLAGS="$CFLAGS $WERROR_FLAGS"
82 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
83fi
84
85# The following test is taken from WebKit's webkit.m4
86saved_CFLAGS="$CFLAGS"
87CFLAGS="$CFLAGS -fvisibility=hidden "
88AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
89AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
90 [ AC_MSG_RESULT([yes])
91 SYMBOL_VISIBILITY="-fvisibility=hidden"],
92 AC_MSG_RESULT([no]))
93CFLAGS="$saved_CFLAGS"
94AC_SUBST(SYMBOL_VISIBILITY)
95
96AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
97AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
98AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
99AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
100AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
101AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
102
103# Coverage build taken from WebKit's configure.in
104AC_MSG_CHECKING([whether to enable code coverage support])
105AC_ARG_ENABLE(coverage,
106 AC_HELP_STRING([--enable-coverage],
107 [enable code coverage support [default=no]]),
108 [],[enable_coverage="no"])
109AC_MSG_RESULT([$enable_coverage])
110if test "$enable_coverage" = "yes"; then
111 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
112 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
113 AC_SUBST([COVERAGE_CFLAGS])
114 AC_SUBST([COVERAGE_LDFLAGS])
115fi
116
117AC_ARG_ENABLE(profile,
118 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
119 [profile=$enableval], [profile="no"])
120if test x"$profile" = x"yes"
121then
122 CFLAGS="$CFLAGS -pg"
123 CPPFLAGS="$CPPFLAGS -pg"
124fi
125
126AC_MSG_RESULT([CFLAGS="$CFLAGS"])
127AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
128
129dnl Generate the output
130AM_CONFIG_HEADER(config.h)
131
132AC_OUTPUT(
Maxbf357192018-11-22 13:32:27 +0100133 doc/Makefile
134 doc/examples/Makefile
Pau Espin Pedrol2768f952018-12-12 19:19:14 +0100135 src/Makefile
Harald Welte54ca6f42018-06-04 21:52:30 +0200136 Makefile)