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