blob: b846c8cd9175dfaeac02993f358375f1fa0bc7b3 [file] [log] [blame]
Pablo Neira Ayuso14506662014-02-20 18:43:15 +01001dnl Process this file with autoconf to create configure.
2
Pau Espin Pedrolb1adcf72018-05-02 16:15:26 +02003AC_INIT([libgtpnl],
4 m4_esyscmd([./git-version-gen .tarball-version]),
5 [osmocom-net-gprs@lists.osmocom.org])
Pablo Neira Ayuso14506662014-02-20 18:43:15 +01006AC_CONFIG_AUX_DIR([build-aux])
7AC_CANONICAL_HOST
8AC_CONFIG_MACRO_DIR([m4])
9AC_CONFIG_HEADERS([config.h])
10AM_INIT_AUTOMAKE([foreign tar-pax no-dist-gzip dist-bzip2 1.6 subdir-objects])
11
Oliver Smithdd335ef2023-10-19 15:38:53 +020012CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_REENTRANT"
13CFLAGS="$CFLAGS -Wall -Waggregate-return -Wmissing-declarations \
14 -Wmissing-prototypes -Wshadow -Wstrict-prototypes \
15 -Wformat=2 -pipe"
16
Pau Espin Pedrol16fa45f2018-05-02 13:55:46 +020017dnl include release helper
18RELMAKE='-include osmo-release.mk'
19AC_SUBST([RELMAKE])
20
Oliver Smith5314ea42021-01-27 17:31:54 +010021CFLAGS="$CFLAGS -std=gnu11"
22
Pablo Neira Ayuso14506662014-02-20 18:43:15 +010023dnl kernel style compile messages
24m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
25
26dnl Dependencies
27PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.0])
28
Harald Welte51c10b72017-11-12 23:25:00 +090029dnl include release helper
30RELMAKE='-include osmo-release.mk'
31AC_SUBST([RELMAKE])
32
Pablo Neira Ayuso14506662014-02-20 18:43:15 +010033AC_PROG_CC
34AM_PROG_CC_C_O
35AC_EXEEXT
36AC_DISABLE_STATIC
37LT_INIT
38CHECK_GCC_FVISIBILITY
39case "$host" in
40*-*-linux* | *-*-uclinux*) ;;
41*) AC_MSG_ERROR([Linux only, dude!]);;
42esac
43
Harald Welte134d0a32017-11-12 22:41:54 +090044AC_ARG_ENABLE(sanitize,
45 [AS_HELP_STRING(
46 [--enable-sanitize],
47 [Compile with address sanitizer enabled],
48 )],
49 [sanitize=$enableval], [sanitize="no"])
50if test x"$sanitize" = x"yes"
51then
52 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
53 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
54fi
55
Oliver Smith0bd1e0d2023-10-19 15:41:39 +020056AC_ARG_ENABLE(werror,
57 [AS_HELP_STRING(
58 [--enable-werror],
59 [Turn all compiler warnings into errors, with exceptions:
60 a) deprecation (allow upstream to mark deprecation without breaking builds);
61 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
62 ]
63 )],
64 [werror=$enableval], [werror="no"])
65if test x"$werror" = x"yes"
66then
67 WERROR_FLAGS="-Werror"
68 WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition"
69 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
70 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
71 CFLAGS="$CFLAGS $WERROR_FLAGS"
72 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
73fi
74
Oliver Smitha3108a32023-10-26 15:14:16 +020075AC_ARG_ENABLE(qemu_tests,
76 [AS_HELP_STRING(
77 [--enable-qemu-tests],
78 [Run automated tests in QEMU]
79 )],
80 [qemu_tests=$enableval], [qemu_tests="no"])
81AC_MSG_CHECKING([whether to enable QEMU tests])
82AC_MSG_RESULT([$qemu_tests])
83AM_CONDITIONAL(ENABLE_QEMU_TESTS, test x"$qemu_tests" = x"yes")
84if test x"$qemu_tests" = x"yes" && ! $srcdir/tests/qemu/check-depends.sh; then
85 AC_MSG_ERROR([missing programs for --enable-qemu-tests])
86fi
87
Oliver Smithdd335ef2023-10-19 15:38:53 +020088AC_SUBST([CPPFLAGS])
89AC_SUBST([CFLAGS])
Oliver Smith858e2db2023-10-26 15:23:19 +020090AC_CONFIG_FILES([
91 Makefile
92 contrib/libgtpnl.spec
93 include/Makefile
94 include/libgtpnl/Makefile
95 include/linux/Makefile
96 libgtpnl.pc
97 src/Makefile
Oliver Smitha3108a32023-10-26 15:14:16 +020098 tests/Makefile
Oliver Smith858e2db2023-10-26 15:23:19 +020099 tools/Makefile
100])
101AC_OUTPUT()