blob: 94bde9d62772375338ae6746b7bd44feb63ce863 [file] [log] [blame]
Harald Welte681f1192020-04-20 12:00:33 +02001# Process this file with autoconf to produce a configure script.
2AC_INIT([osmo-uecups],[m4_esyscmd(./git-version-gen .tarball-version)],[osmocom-net-gprs@lists.osmocom.org])
3
4dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
5AC_CONFIG_AUX_DIR([.])
6
7AM_INIT_AUTOMAKE([dist-bzip2])
8
9dnl kernel style compile messages
10m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11
12dnl include release helper
13RELMAKE='-include osmo-release.mk'
14AC_SUBST([RELMAKE])
15
16# Checks for programs.
17AC_PROG_MAKE_SET
18AC_PROG_CC
19AC_PROG_INSTALL
20LT_INIT
21
22dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
23AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
24if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
25 AC_MSG_WARN([You need to install pkg-config])
26fi
27PKG_PROG_PKG_CONFIG([0.20])
28
29dnl check for AX_CHECK_COMPILE_FLAG
30m4_ifdef([AX_CHECK_COMPILE_FLAG], [], [
31 AC_MSG_ERROR([Please install autoconf-archive; re-run 'autoreconf -fi' for it to take effect.])
32 ])
33
34PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.1.0)
35PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.1.0)
36PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 0.7.0)
37PKG_CHECK_MODULES(LIBJANSSON, jansson)
38PKG_CHECK_MODULES(LIBNLROUTE3, libnl-route-3.0)
39
40AC_HEADER_STDC
41
42AC_ARG_ENABLE(sanitize,
43 [AS_HELP_STRING(
44 [--enable-sanitize],
45 [Compile with address sanitizer enabled],
46 )],
47 [sanitize=$enableval], [sanitize="no"])
48if test x"$sanitize" = x"yes"
49then
50 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
51 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
52fi
53
54AC_ARG_ENABLE(werror,
55 [AS_HELP_STRING(
56 [--enable-werror],
57 [Turn all compiler warnings into errors, with exceptions:
58 a) deprecation (allow upstream to mark deprecation without breaking builds);
59 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
60 ]
61 )],
62 [werror=$enableval], [werror="no"])
63if test x"$werror" = x"yes"
64then
65 WERROR_FLAGS="-Werror"
66 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
67 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
68 CFLAGS="$CFLAGS $WERROR_FLAGS"
69 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
70fi
71
72# The following test is taken from WebKit's webkit.m4
73saved_CFLAGS="$CFLAGS"
74CFLAGS="$CFLAGS -fvisibility=hidden "
75AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
76AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
77 [ AC_MSG_RESULT([yes])
78 SYMBOL_VISIBILITY="-fvisibility=hidden"],
79 AC_MSG_RESULT([no]))
80CFLAGS="$saved_CFLAGS"
81AC_SUBST(SYMBOL_VISIBILITY)
82
83AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
84AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
85AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
86AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [CFLAGS="$CFLAGS -Wnull-dereference"])
87AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
88AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
89
90# Coverage build taken from WebKit's configure.in
91AC_MSG_CHECKING([whether to enable code coverage support])
92AC_ARG_ENABLE(coverage,
93 AC_HELP_STRING([--enable-coverage],
94 [enable code coverage support [default=no]]),
95 [],[enable_coverage="no"])
96AC_MSG_RESULT([$enable_coverage])
97if test "$enable_coverage" = "yes"; then
98 COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
99 COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
100 AC_SUBST([COVERAGE_CFLAGS])
101 AC_SUBST([COVERAGE_LDFLAGS])
102fi
103
104AC_ARG_ENABLE(profile,
105 [AS_HELP_STRING([--enable-profile], [Compile with profiling support enabled], )],
106 [profile=$enableval], [profile="no"])
107if test x"$profile" = x"yes"
108then
109 CFLAGS="$CFLAGS -pg"
110 CPPFLAGS="$CPPFLAGS -pg"
111fi
112
113
114
115
116AC_MSG_RESULT([CFLAGS="$CFLAGS"])
117AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
118
119AC_OUTPUT(
120 Makefile
121 daemon/Makefile
122 doc/Makefile
123 doc/examples/Makefile
124 )