blob: d98de89fca31ae8315750f8fbb12521b5698df96 [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)
45PKG_CHECK_MODULES(LIBMNL, libmnl)
Max8066a412019-01-28 23:59:03 +010046dnl FIXME: bump to 1.10.0 once it's available on build slaves and remove workaround from osysmon_ping.c
47PKG_CHECK_MODULES(LIBOPING, liboping >= 1.9.0)
Harald Welte54ca6f42018-06-04 21:52:30 +020048
49dnl checks for header files
50AC_HEADER_STDC
51
52dnl Checks for typedefs, structures and compiler characteristics
53
54AC_ARG_ENABLE(sanitize,
55 [AS_HELP_STRING(
56 [--enable-sanitize],
57 [Compile with address sanitizer enabled],
58 )],
59 [sanitize=$enableval], [sanitize="no"])
60if test x"$sanitize" = x"yes"
61then
62 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
63 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
64fi
65
66AC_ARG_ENABLE(werror,
67 [AS_HELP_STRING(
68 [--enable-werror],
69 [Turn all compiler warnings into errors, with exceptions:
70 a) deprecation (allow upstream to mark deprecation without breaking builds);
71 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
72 ]
73 )],
74 [werror=$enableval], [werror="no"])
75if test x"$werror" = x"yes"
76then
77 WERROR_FLAGS="-Werror"
78 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
79 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
80 CFLAGS="$CFLAGS $WERROR_FLAGS"
81 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
82fi
83
84# The following test is taken from WebKit's webkit.m4
85saved_CFLAGS="$CFLAGS"
86CFLAGS="$CFLAGS -fvisibility=hidden "
87AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
88AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
89 [ AC_MSG_RESULT([yes])
90 SYMBOL_VISIBILITY="-fvisibility=hidden"],
91 AC_MSG_RESULT([no]))
92CFLAGS="$saved_CFLAGS"
93AC_SUBST(SYMBOL_VISIBILITY)
94
95AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
96AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
97AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
98AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
99AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
100AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
101
102# Coverage build taken from WebKit's configure.in
103AC_MSG_CHECKING([whether to enable code coverage support])
104AC_ARG_ENABLE(coverage,
105 AC_HELP_STRING([--enable-coverage],
106 [enable code coverage support [default=no]]),
107 [],[enable_coverage="no"])
108AC_MSG_RESULT([$enable_coverage])
109if test "$enable_coverage" = "yes"; then
110 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
111 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
112 AC_SUBST([COVERAGE_CFLAGS])
113 AC_SUBST([COVERAGE_LDFLAGS])
114fi
115
116AC_ARG_ENABLE(profile,
117 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
118 [profile=$enableval], [profile="no"])
119if test x"$profile" = x"yes"
120then
121 CFLAGS="$CFLAGS -pg"
122 CPPFLAGS="$CPPFLAGS -pg"
123fi
124
125AC_MSG_RESULT([CFLAGS="$CFLAGS"])
126AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
127
128dnl Generate the output
129AM_CONFIG_HEADER(config.h)
130
131AC_OUTPUT(
Maxbf357192018-11-22 13:32:27 +0100132 doc/Makefile
133 doc/examples/Makefile
Pau Espin Pedrol2768f952018-12-12 19:19:14 +0100134 src/Makefile
Harald Welte54ca6f42018-06-04 21:52:30 +0200135 Makefile)