blob: 2546b61410adb28f61c8a0c2ee5f0e51c08db8d6 [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
Oliver Smithe3f31be2021-01-27 17:57:44 +010011CFLAGS="$CFLAGS -std=gnu11"
12
Harald Welte54ca6f42018-06-04 21:52:30 +020013dnl kernel style compile messages
14m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
15
16dnl include release helper
17RELMAKE='-include osmo-release.mk'
18AC_SUBST([RELMAKE])
19
20dnl checks for programs
21AC_PROG_MAKE_SET
22AC_PROG_CC
23AC_PROG_INSTALL
24LT_INIT
25
26dnl 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 Welte54ca6f42018-06-04 21:52:30 +020033dnl checks for libraries
34AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DL="$LIBS";LIBS=""])
35AC_SUBST(LIBRARY_DL)
36
37
Harald Welteefd1ea32021-01-06 16:55:49 +010038PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.1)
39PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.0.1)
40PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.0.1)
41PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.0.1)
Max9a852f22019-01-31 15:58:57 +010042PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.4.0)
Harald Welte54ca6f42018-06-04 21:52:30 +020043PKG_CHECK_MODULES(LIBMNL, libmnl)
Max8066a412019-01-28 23:59:03 +010044dnl 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 +010045dnl FIXME: debian8 provides 1.7.0, debian9 provides 1.9.0
46PKG_CHECK_MODULES(LIBOPING, liboping >= 1.7.0)
Harald Welte54ca6f42018-06-04 21:52:30 +020047
48dnl checks for header files
49AC_HEADER_STDC
50
51dnl Checks for typedefs, structures and compiler characteristics
52
53AC_ARG_ENABLE(sanitize,
54 [AS_HELP_STRING(
55 [--enable-sanitize],
56 [Compile with address sanitizer enabled],
57 )],
58 [sanitize=$enableval], [sanitize="no"])
59if test x"$sanitize" = x"yes"
60then
61 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
62 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
63fi
64
65AC_ARG_ENABLE(werror,
66 [AS_HELP_STRING(
67 [--enable-werror],
68 [Turn all compiler warnings into errors, with exceptions:
69 a) deprecation (allow upstream to mark deprecation without breaking builds);
70 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
71 ]
72 )],
73 [werror=$enableval], [werror="no"])
74if test x"$werror" = x"yes"
75then
76 WERROR_FLAGS="-Werror"
77 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
78 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
79 CFLAGS="$CFLAGS $WERROR_FLAGS"
80 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
81fi
82
83# The following test is taken from WebKit's webkit.m4
84saved_CFLAGS="$CFLAGS"
85CFLAGS="$CFLAGS -fvisibility=hidden "
86AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
87AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
88 [ AC_MSG_RESULT([yes])
89 SYMBOL_VISIBILITY="-fvisibility=hidden"],
90 AC_MSG_RESULT([no]))
91CFLAGS="$saved_CFLAGS"
92AC_SUBST(SYMBOL_VISIBILITY)
93
Harald Welte54ca6f42018-06-04 21:52:30 +020094# Coverage build taken from WebKit's configure.in
95AC_MSG_CHECKING([whether to enable code coverage support])
96AC_ARG_ENABLE(coverage,
97 AC_HELP_STRING([--enable-coverage],
98 [enable code coverage support [default=no]]),
99 [],[enable_coverage="no"])
100AC_MSG_RESULT([$enable_coverage])
101if test "$enable_coverage" = "yes"; then
102 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
103 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
104 AC_SUBST([COVERAGE_CFLAGS])
105 AC_SUBST([COVERAGE_LDFLAGS])
106fi
107
108AC_ARG_ENABLE(profile,
109 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
110 [profile=$enableval], [profile="no"])
111if test x"$profile" = x"yes"
112then
113 CFLAGS="$CFLAGS -pg"
114 CPPFLAGS="$CPPFLAGS -pg"
115fi
116
117AC_MSG_RESULT([CFLAGS="$CFLAGS"])
118AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
119
120dnl Generate the output
121AM_CONFIG_HEADER(config.h)
122
123AC_OUTPUT(
Maxbf357192018-11-22 13:32:27 +0100124 doc/Makefile
125 doc/examples/Makefile
Pau Espin Pedrol2768f952018-12-12 19:19:14 +0100126 src/Makefile
Harald Welte54ca6f42018-06-04 21:52:30 +0200127 Makefile)