Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 1 | AC_INIT([libosmo-abis], |
| 2 | m4_esyscmd([./git-version-gen .tarball-version]), |
Holger Hans Peter Freyther | 584672e | 2012-03-26 16:36:21 +0200 | [diff] [blame] | 3 | [openbsc@lists.osmocom.org]) |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 4 | |
Neels Hofmeyr | f5d2860 | 2016-10-01 00:33:39 +0200 | [diff] [blame] | 5 | dnl *This* is the root dir, even if an install-sh exists in ../ or ../../ |
| 6 | AC_CONFIG_AUX_DIR([.]) |
| 7 | |
Harald Welte | b37c5d4 | 2015-08-15 10:50:53 +0200 | [diff] [blame] | 8 | AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects]) |
Holger Hans Peter Freyther | 5c65e79 | 2012-10-11 08:05:14 +0200 | [diff] [blame] | 9 | AC_CONFIG_TESTDIR(tests) |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 10 | |
| 11 | dnl kernel style compile messages |
| 12 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 13 | |
Max | e326072 | 2017-07-05 15:08:39 +0200 | [diff] [blame] | 14 | dnl include release helper |
| 15 | RELMAKE='-include osmo-release.mk' |
| 16 | AC_SUBST([RELMAKE]) |
| 17 | |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 18 | dnl checks for programs |
| 19 | AC_PROG_MAKE_SET |
| 20 | AC_PROG_CC |
| 21 | AC_PROG_INSTALL |
Diego Elio Pettenò | 62f0e06 | 2012-06-30 15:22:56 -0700 | [diff] [blame] | 22 | LT_INIT([pic-only]) |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 23 | |
Neels Hofmeyr | 24796f2 | 2016-10-01 00:48:43 +0200 | [diff] [blame] | 24 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 25 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 26 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 27 | AC_MSG_WARN([You need to install pkg-config]) |
| 28 | fi |
| 29 | PKG_PROG_PKG_CONFIG([0.20]) |
| 30 | |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 31 | AC_CONFIG_MACRO_DIR([m4]) |
| 32 | |
Pau Espin Pedrol | 65529bc | 2017-07-05 22:02:53 +0200 | [diff] [blame] | 33 | CFLAGS="$CFLAGS -Wall" |
| 34 | CPPFLAGS="$CPPFLAGS -Wall" |
Pau Espin Pedrol | 62eddcd | 2017-06-21 07:43:14 +0200 | [diff] [blame] | 35 | |
Neels Hofmeyr | 2e05f88 | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 36 | AC_ARG_ENABLE(sanitize, |
| 37 | [AS_HELP_STRING( |
| 38 | [--enable-sanitize], |
| 39 | [Compile with address sanitizer enabled], |
| 40 | )], |
| 41 | [sanitize=$enableval], [sanitize="no"]) |
| 42 | if test x"$sanitize" = x"yes" |
| 43 | then |
| 44 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 45 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 46 | fi |
| 47 | |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 48 | # The following test is taken from WebKit's webkit.m4 |
| 49 | saved_CFLAGS="$CFLAGS" |
| 50 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 51 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
| 52 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
| 53 | [ AC_MSG_RESULT([yes]) |
| 54 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 55 | AC_MSG_RESULT([no])) |
| 56 | CFLAGS="$saved_CFLAGS" |
| 57 | AC_SUBST(SYMBOL_VISIBILITY) |
| 58 | |
| 59 | dnl Generate the output |
| 60 | AM_CONFIG_HEADER(config.h) |
| 61 | |
| 62 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.0) |
| 63 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0) |
Harald Welte | 43f4e08 | 2011-10-10 08:49:01 +0200 | [diff] [blame] | 64 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.10) |
Max | 15d9b79 | 2016-04-28 12:05:27 +0200 | [diff] [blame] | 65 | PKG_CHECK_MODULES(ORTP, ortp >= 0.22.0) |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 66 | |
Harald Welte | 3bc7885 | 2011-08-24 08:32:38 +0200 | [diff] [blame] | 67 | AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built)) |
Pablo Neira Ayuso | 0b9ed9a | 2011-07-02 17:25:19 +0200 | [diff] [blame] | 68 | |
Max | 8a3be28 | 2017-02-20 18:24:03 +0100 | [diff] [blame] | 69 | AC_ARG_ENABLE(sanitize, |
| 70 | [AS_HELP_STRING( |
| 71 | [--enable-sanitize], |
| 72 | [Compile with address sanitizer enabled], |
| 73 | )], |
| 74 | [sanitize=$enableval], [sanitize="no"]) |
| 75 | if test x"$sanitize" = x"yes" |
| 76 | then |
Pau Espin Pedrol | 65529bc | 2017-07-05 22:02:53 +0200 | [diff] [blame] | 77 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 78 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
Max | 8a3be28 | 2017-02-20 18:24:03 +0100 | [diff] [blame] | 79 | fi |
| 80 | |
Neels Hofmeyr | bb83e6f | 2018-03-05 20:37:13 +0100 | [diff] [blame] | 81 | AC_ARG_ENABLE(werror, |
| 82 | [AS_HELP_STRING( |
| 83 | [--enable-werror], |
| 84 | [Turn all compiler warnings into errors, with exceptions: |
| 85 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 86 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 87 | ] |
| 88 | )], |
| 89 | [werror=$enableval], [werror="no"]) |
| 90 | if test x"$werror" = x"yes" |
| 91 | then |
| 92 | WERROR_FLAGS="-Werror" |
| 93 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 94 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 95 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 96 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 97 | fi |
| 98 | |
Harald Welte | bf7976c | 2017-04-04 12:10:54 +0000 | [diff] [blame] | 99 | _cflags_save=$CFLAGS |
| 100 | CFLAGS="$CFLAGS $ORTP_CFLAGS" |
Pau Espin Pedrol | c42bf19 | 2017-03-24 17:26:49 +0100 | [diff] [blame] | 101 | AC_COMPILE_IFELSE( |
| 102 | [AC_LANG_PROGRAM( |
| 103 | [[#include <ortp/ortp.h>]], |
| 104 | [[ortp_set_log_level_mask(NULL, 0xffff);]] |
| 105 | )], |
| 106 | [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [1], |
| 107 | [ortp_set_log_level_mask requires domain parameter])], |
| 108 | [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [0], |
| 109 | [ortp_set_log_level_mask has no domain parameter])]) |
Harald Welte | bf7976c | 2017-04-04 12:10:54 +0000 | [diff] [blame] | 110 | CFLAGS=$_cflags_save |
Pau Espin Pedrol | c42bf19 | 2017-03-24 17:26:49 +0100 | [diff] [blame] | 111 | |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 112 | _cflags_save=$CFLAGS |
Pau Espin Pedrol | 43b5b69 | 2018-04-10 18:15:48 +0200 | [diff] [blame^] | 113 | CFLAGS="$CFLAGS $ORTP_CFLAGS -Werror" |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 114 | AC_COMPILE_IFELSE( |
| 115 | [AC_LANG_PROGRAM( |
Pau Espin Pedrol | 1307b7a | 2017-07-13 22:14:37 +0200 | [diff] [blame] | 116 | [[#include <ortp/ortp.h> |
| 117 | void fake_cb(struct _RtpSession *r, void *arg1, void *arg2, void *arg3) { return; }]], |
| 118 | [[rtp_session_signal_connect(NULL, "", fake_cb, (void*) fake_cb);]] |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 119 | )], |
| 120 | [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(void*)(arg)], |
| 121 | [rtp_session_signal_connect requires pointer parameter])], |
| 122 | [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(unsigned long)(arg)], |
| 123 | [rtp_session_signal_connect requires ulong parameter])]) |
| 124 | CFLAGS=$_cflags_save |
| 125 | |
Neels Hofmeyr | bb83e6f | 2018-03-05 20:37:13 +0100 | [diff] [blame] | 126 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 127 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 128 | |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 129 | AC_OUTPUT( |
| 130 | libosmoabis.pc |
Harald Welte | 41d0d84 | 2011-09-03 15:33:24 +0200 | [diff] [blame] | 131 | libosmotrau.pc |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 132 | include/Makefile |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 133 | src/Makefile |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 134 | tests/Makefile |
| 135 | Makefile) |