Pablo Neira Ayuso | 1450666 | 2014-02-20 18:43:15 +0100 | [diff] [blame] | 1 | dnl Process this file with autoconf to create configure. |
| 2 | |
Pau Espin Pedrol | b1adcf7 | 2018-05-02 16:15:26 +0200 | [diff] [blame] | 3 | AC_INIT([libgtpnl], |
| 4 | m4_esyscmd([./git-version-gen .tarball-version]), |
| 5 | [osmocom-net-gprs@lists.osmocom.org]) |
Pablo Neira Ayuso | 1450666 | 2014-02-20 18:43:15 +0100 | [diff] [blame] | 6 | AC_CONFIG_AUX_DIR([build-aux]) |
| 7 | AC_CANONICAL_HOST |
| 8 | AC_CONFIG_MACRO_DIR([m4]) |
| 9 | AC_CONFIG_HEADERS([config.h]) |
| 10 | AM_INIT_AUTOMAKE([foreign tar-pax no-dist-gzip dist-bzip2 1.6 subdir-objects]) |
| 11 | |
Oliver Smith | dd335ef | 2023-10-19 15:38:53 +0200 | [diff] [blame] | 12 | CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_REENTRANT" |
| 13 | CFLAGS="$CFLAGS -Wall -Waggregate-return -Wmissing-declarations \ |
| 14 | -Wmissing-prototypes -Wshadow -Wstrict-prototypes \ |
| 15 | -Wformat=2 -pipe" |
| 16 | |
Pau Espin Pedrol | 16fa45f | 2018-05-02 13:55:46 +0200 | [diff] [blame] | 17 | dnl include release helper |
| 18 | RELMAKE='-include osmo-release.mk' |
| 19 | AC_SUBST([RELMAKE]) |
| 20 | |
Oliver Smith | 5314ea4 | 2021-01-27 17:31:54 +0100 | [diff] [blame] | 21 | CFLAGS="$CFLAGS -std=gnu11" |
| 22 | |
Pablo Neira Ayuso | 1450666 | 2014-02-20 18:43:15 +0100 | [diff] [blame] | 23 | dnl kernel style compile messages |
| 24 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 25 | |
| 26 | dnl Dependencies |
| 27 | PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.0]) |
| 28 | |
Harald Welte | 51c10b7 | 2017-11-12 23:25:00 +0900 | [diff] [blame] | 29 | dnl include release helper |
| 30 | RELMAKE='-include osmo-release.mk' |
| 31 | AC_SUBST([RELMAKE]) |
| 32 | |
Pablo Neira Ayuso | 1450666 | 2014-02-20 18:43:15 +0100 | [diff] [blame] | 33 | AC_PROG_CC |
| 34 | AM_PROG_CC_C_O |
| 35 | AC_EXEEXT |
| 36 | AC_DISABLE_STATIC |
| 37 | LT_INIT |
| 38 | CHECK_GCC_FVISIBILITY |
| 39 | case "$host" in |
| 40 | *-*-linux* | *-*-uclinux*) ;; |
| 41 | *) AC_MSG_ERROR([Linux only, dude!]);; |
| 42 | esac |
| 43 | |
Harald Welte | 134d0a3 | 2017-11-12 22:41:54 +0900 | [diff] [blame] | 44 | AC_ARG_ENABLE(sanitize, |
| 45 | [AS_HELP_STRING( |
| 46 | [--enable-sanitize], |
| 47 | [Compile with address sanitizer enabled], |
| 48 | )], |
| 49 | [sanitize=$enableval], [sanitize="no"]) |
| 50 | if test x"$sanitize" = x"yes" |
| 51 | then |
| 52 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 53 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 54 | fi |
| 55 | |
Oliver Smith | 0bd1e0d | 2023-10-19 15:41:39 +0200 | [diff] [blame] | 56 | AC_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"]) |
| 65 | if test x"$werror" = x"yes" |
| 66 | then |
| 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" |
| 73 | fi |
| 74 | |
Oliver Smith | dd335ef | 2023-10-19 15:38:53 +0200 | [diff] [blame] | 75 | AC_SUBST([CPPFLAGS]) |
| 76 | AC_SUBST([CFLAGS]) |
Oliver Smith | 9c14b50 | 2023-10-26 15:23:19 +0200 | [diff] [blame^] | 77 | AC_CONFIG_FILES([ |
| 78 | Makefile |
| 79 | contrib/libgtpnl.spec |
| 80 | include/Makefile |
| 81 | include/libgtpnl/Makefile |
| 82 | include/linux/Makefile |
| 83 | libgtpnl.pc |
| 84 | src/Makefile |
| 85 | tools/Makefile |
| 86 | ]) |
| 87 | AC_OUTPUT() |