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 | |
Harald Welte | 176a1fb | 2019-01-19 22:20:47 +0100 | [diff] [blame] | 62 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0) |
| 63 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.0.0) |
| 64 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.0.0) |
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 | d4be696 | 2019-11-11 17:00:12 +0100 | [diff] [blame] | 67 | AC_ARG_ENABLE([dahdi], |
| 68 | AC_HELP_STRING([--disable-dahdi], |
| 69 | [disable support for DAHID ISDN (E1/T1) cards [default=yes]]), |
| 70 | [enable_dahdi="$enableval"], [enable_dahdi="yes"]) |
| 71 | AM_CONDITIONAL(ENABLE_DAHDI, test "x$enable_dahdi" = "xyes") |
| 72 | if test "x$enable_dahdi" = "xyes"; then |
| 73 | AC_CHECK_HEADERS([dahdi/user.h],[],[AC_MSG_ERROR([DAHDI input driver enabled but DAHDI not found])]) |
| 74 | else |
| 75 | AC_MSG_WARN([DAHDI input driver will not be built]) |
| 76 | fi |
Pablo Neira Ayuso | 0b9ed9a | 2011-07-02 17:25:19 +0200 | [diff] [blame] | 77 | |
Sylvain Munaut | b559a53 | 2019-05-09 11:14:26 +0200 | [diff] [blame] | 78 | AC_ARG_ENABLE([e1d], |
| 79 | [AS_HELP_STRING( |
| 80 | [--enable-e1d], |
| 81 | [Enable osmo-e1d driver support] |
| 82 | )], |
| 83 | [ |
| 84 | ENABLE_E1D=$enableval |
| 85 | ], |
| 86 | [ |
| 87 | ENABLE_E1D="no" |
| 88 | ]) |
| 89 | AS_IF([test "x$ENABLE_E1D" = "xyes"], [ |
| 90 | PKG_CHECK_MODULES(LIBOSMOE1D, libosmo-e1d) |
| 91 | ]) |
| 92 | AM_CONDITIONAL(ENABLE_E1D, test "x$ENABLE_E1D" = "xyes") |
| 93 | AC_SUBST(ENABLE_E1D) |
| 94 | if test x"$ENABLE_E1D" = x"yes" |
| 95 | then |
| 96 | AC_DEFINE([HAVE_E1D], [1], [Enable osmo-e1d driver support]) |
| 97 | fi |
| 98 | |
Max | 8a3be28 | 2017-02-20 18:24:03 +0100 | [diff] [blame] | 99 | AC_ARG_ENABLE(sanitize, |
| 100 | [AS_HELP_STRING( |
| 101 | [--enable-sanitize], |
| 102 | [Compile with address sanitizer enabled], |
| 103 | )], |
| 104 | [sanitize=$enableval], [sanitize="no"]) |
| 105 | if test x"$sanitize" = x"yes" |
| 106 | then |
Pau Espin Pedrol | 65529bc | 2017-07-05 22:02:53 +0200 | [diff] [blame] | 107 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 108 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
Max | 8a3be28 | 2017-02-20 18:24:03 +0100 | [diff] [blame] | 109 | fi |
| 110 | |
Neels Hofmeyr | bb83e6f | 2018-03-05 20:37:13 +0100 | [diff] [blame] | 111 | AC_ARG_ENABLE(werror, |
| 112 | [AS_HELP_STRING( |
| 113 | [--enable-werror], |
| 114 | [Turn all compiler warnings into errors, with exceptions: |
| 115 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 116 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 117 | ] |
| 118 | )], |
| 119 | [werror=$enableval], [werror="no"]) |
| 120 | if test x"$werror" = x"yes" |
| 121 | then |
| 122 | WERROR_FLAGS="-Werror" |
| 123 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 124 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 125 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 126 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 127 | fi |
| 128 | |
Harald Welte | bf7976c | 2017-04-04 12:10:54 +0000 | [diff] [blame] | 129 | _cflags_save=$CFLAGS |
| 130 | CFLAGS="$CFLAGS $ORTP_CFLAGS" |
Pau Espin Pedrol | c42bf19 | 2017-03-24 17:26:49 +0100 | [diff] [blame] | 131 | AC_COMPILE_IFELSE( |
| 132 | [AC_LANG_PROGRAM( |
| 133 | [[#include <ortp/ortp.h>]], |
| 134 | [[ortp_set_log_level_mask(NULL, 0xffff);]] |
| 135 | )], |
| 136 | [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [1], |
| 137 | [ortp_set_log_level_mask requires domain parameter])], |
| 138 | [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [0], |
| 139 | [ortp_set_log_level_mask has no domain parameter])]) |
Harald Welte | bf7976c | 2017-04-04 12:10:54 +0000 | [diff] [blame] | 140 | CFLAGS=$_cflags_save |
Pau Espin Pedrol | c42bf19 | 2017-03-24 17:26:49 +0100 | [diff] [blame] | 141 | |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 142 | _cflags_save=$CFLAGS |
Pau Espin Pedrol | 43b5b69 | 2018-04-10 18:15:48 +0200 | [diff] [blame] | 143 | CFLAGS="$CFLAGS $ORTP_CFLAGS -Werror" |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 144 | AC_COMPILE_IFELSE( |
| 145 | [AC_LANG_PROGRAM( |
Pau Espin Pedrol | 1307b7a | 2017-07-13 22:14:37 +0200 | [diff] [blame] | 146 | [[#include <ortp/ortp.h> |
| 147 | void fake_cb(struct _RtpSession *r, void *arg1, void *arg2, void *arg3) { return; }]], |
| 148 | [[rtp_session_signal_connect(NULL, "", fake_cb, (void*) fake_cb);]] |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 149 | )], |
| 150 | [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(void*)(arg)], |
| 151 | [rtp_session_signal_connect requires pointer parameter])], |
| 152 | [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(unsigned long)(arg)], |
| 153 | [rtp_session_signal_connect requires ulong parameter])]) |
| 154 | CFLAGS=$_cflags_save |
| 155 | |
Neels Hofmeyr | bb83e6f | 2018-03-05 20:37:13 +0100 | [diff] [blame] | 156 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 157 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 158 | |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 159 | AC_OUTPUT( |
| 160 | libosmoabis.pc |
Harald Welte | 41d0d84 | 2011-09-03 15:33:24 +0200 | [diff] [blame] | 161 | libosmotrau.pc |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 162 | include/Makefile |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 163 | src/Makefile |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 164 | tests/Makefile |
| 165 | Makefile) |