blob: 0f91cf214d4e857ebf5f18f5ee85a0b1d41551ba [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)
Harald Welte7f7de1e2019-12-15 20:17:44 +010061PKG_CHECK_MODULES(LIBOSMOUSB, libosmousb >= 0.0.0)
Harald Welte964cda32019-11-24 22:27:10 +010062PKG_CHECK_MODULES(LIBUSB, libusb-1.0)
63
64AC_ARG_ENABLE(sanitize,
65 [AS_HELP_STRING(
66 [--enable-sanitize],
67 [Compile with address sanitizer enabled],
68 )],
69 [sanitize=$enableval], [sanitize="no"])
70if test x"$sanitize" = x"yes"
71then
72 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
73 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
74fi
75
76AC_ARG_ENABLE(werror,
77 [AS_HELP_STRING(
78 [--enable-werror],
79 [Turn all compiler warnings into errors, with exceptions:
80 a) deprecation (allow upstream to mark deprecation without breaking builds);
81 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
82 ]
83 )],
84 [werror=$enableval], [werror="no"])
85if test x"$werror" = x"yes"
86then
87 WERROR_FLAGS="-Werror"
88 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
89 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
90 CFLAGS="$CFLAGS $WERROR_FLAGS"
91 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
92fi
93
94AC_MSG_RESULT([CFLAGS="$CFLAGS"])
95AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
96
97AC_OUTPUT(
98 libosmo-simtrace2.pc
99 include/Makefile
100 src/Makefile
101 lib/Makefile
102 contrib/Makefile
103 Makefile)