blob: 792988404e6c7905d973bb4c1e854cb7c8011ff8 [file] [log] [blame]
Harald Welte964cda32019-11-24 22:27:10 +01001AC_INIT([simtrace2],
2 m4_esyscmd([./git-version-gen .tarball-version]),
3 [simtrace@lists.osmocom.org])
4
5dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
6AC_CONFIG_AUX_DIR([.])
7
8AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects])
9AC_CONFIG_TESTDIR(tests)
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([pic-only])
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
31AC_CONFIG_MACRO_DIR([m4])
32
33CFLAGS="$CFLAGS -Wall"
34CPPFLAGS="$CPPFLAGS -Wall"
35
36AC_ARG_ENABLE(sanitize,
37 [AS_HELP_STRING(
38 [--enable-sanitize],
39 [Compile with address sanitizer enabled],
40 )],
41 [sanitize=$enableval], [sanitize="no"])
42if test x"$sanitize" = x"yes"
43then
44 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
45 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
46fi
47
48# The following test is taken from WebKit's webkit.m4
49saved_CFLAGS="$CFLAGS"
50CFLAGS="$CFLAGS -fvisibility=hidden "
51AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
52AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
53 [ AC_MSG_RESULT([yes])
54 SYMBOL_VISIBILITY="-fvisibility=hidden"],
55 AC_MSG_RESULT([no]))
56CFLAGS="$saved_CFLAGS"
57AC_SUBST(SYMBOL_VISIBILITY)
58
59PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0)
60PKG_CHECK_MODULES(LIBOSMOSIM, libosmosim >= 1.0.0)
61PKG_CHECK_MODULES(LIBUSB, libusb-1.0)
62
63AC_ARG_ENABLE(sanitize,
64 [AS_HELP_STRING(
65 [--enable-sanitize],
66 [Compile with address sanitizer enabled],
67 )],
68 [sanitize=$enableval], [sanitize="no"])
69if test x"$sanitize" = x"yes"
70then
71 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
72 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
73fi
74
75AC_ARG_ENABLE(werror,
76 [AS_HELP_STRING(
77 [--enable-werror],
78 [Turn all compiler warnings into errors, with exceptions:
79 a) deprecation (allow upstream to mark deprecation without breaking builds);
80 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
81 ]
82 )],
83 [werror=$enableval], [werror="no"])
84if test x"$werror" = x"yes"
85then
86 WERROR_FLAGS="-Werror"
87 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
88 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
89 CFLAGS="$CFLAGS $WERROR_FLAGS"
90 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
91fi
92
93AC_MSG_RESULT([CFLAGS="$CFLAGS"])
94AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
95
96AC_OUTPUT(
97 libosmo-simtrace2.pc
98 include/Makefile
99 src/Makefile
100 lib/Makefile
101 contrib/Makefile
102 Makefile)