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 | |
Eric | 73a73c0 | 2020-04-11 01:15:40 +0200 | [diff] [blame] | 24 | dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang |
| 25 | AS_CASE(["$LD"],[*clang*], |
| 26 | [AS_CASE(["${host_os}"], |
| 27 | [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])]) |
| 28 | |
Neels Hofmeyr | 24796f2 | 2016-10-01 00:48:43 +0200 | [diff] [blame] | 29 | dnl check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 30 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 31 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 32 | AC_MSG_WARN([You need to install pkg-config]) |
| 33 | fi |
| 34 | PKG_PROG_PKG_CONFIG([0.20]) |
| 35 | |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 36 | AC_CONFIG_MACRO_DIR([m4]) |
| 37 | |
Pau Espin Pedrol | 65529bc | 2017-07-05 22:02:53 +0200 | [diff] [blame] | 38 | CFLAGS="$CFLAGS -Wall" |
| 39 | CPPFLAGS="$CPPFLAGS -Wall" |
Pau Espin Pedrol | 62eddcd | 2017-06-21 07:43:14 +0200 | [diff] [blame] | 40 | |
Neels Hofmeyr | 2e05f88 | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 41 | AC_ARG_ENABLE(sanitize, |
| 42 | [AS_HELP_STRING( |
| 43 | [--enable-sanitize], |
| 44 | [Compile with address sanitizer enabled], |
| 45 | )], |
| 46 | [sanitize=$enableval], [sanitize="no"]) |
| 47 | if test x"$sanitize" = x"yes" |
| 48 | then |
| 49 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 50 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 51 | fi |
| 52 | |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 53 | # The following test is taken from WebKit's webkit.m4 |
| 54 | saved_CFLAGS="$CFLAGS" |
| 55 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 56 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
| 57 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
| 58 | [ AC_MSG_RESULT([yes]) |
| 59 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 60 | AC_MSG_RESULT([no])) |
| 61 | CFLAGS="$saved_CFLAGS" |
| 62 | AC_SUBST(SYMBOL_VISIBILITY) |
| 63 | |
| 64 | dnl Generate the output |
| 65 | AM_CONFIG_HEADER(config.h) |
| 66 | |
Pau Espin Pedrol | 5196cd5 | 2020-07-14 17:52:09 +0200 | [diff] [blame^] | 67 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.1.0) |
| 68 | PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.1.0) |
| 69 | PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.1.0) |
Max | 15d9b79 | 2016-04-28 12:05:27 +0200 | [diff] [blame] | 70 | PKG_CHECK_MODULES(ORTP, ortp >= 0.22.0) |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 71 | |
Harald Welte | d4be696 | 2019-11-11 17:00:12 +0100 | [diff] [blame] | 72 | AC_ARG_ENABLE([dahdi], |
| 73 | AC_HELP_STRING([--disable-dahdi], |
| 74 | [disable support for DAHID ISDN (E1/T1) cards [default=yes]]), |
| 75 | [enable_dahdi="$enableval"], [enable_dahdi="yes"]) |
| 76 | AM_CONDITIONAL(ENABLE_DAHDI, test "x$enable_dahdi" = "xyes") |
| 77 | if test "x$enable_dahdi" = "xyes"; then |
| 78 | AC_CHECK_HEADERS([dahdi/user.h],[],[AC_MSG_ERROR([DAHDI input driver enabled but DAHDI not found])]) |
| 79 | else |
| 80 | AC_MSG_WARN([DAHDI input driver will not be built]) |
| 81 | fi |
Pablo Neira Ayuso | 0b9ed9a | 2011-07-02 17:25:19 +0200 | [diff] [blame] | 82 | |
Sylvain Munaut | b559a53 | 2019-05-09 11:14:26 +0200 | [diff] [blame] | 83 | AC_ARG_ENABLE([e1d], |
| 84 | [AS_HELP_STRING( |
| 85 | [--enable-e1d], |
| 86 | [Enable osmo-e1d driver support] |
| 87 | )], |
| 88 | [ |
| 89 | ENABLE_E1D=$enableval |
| 90 | ], |
| 91 | [ |
| 92 | ENABLE_E1D="no" |
| 93 | ]) |
| 94 | AS_IF([test "x$ENABLE_E1D" = "xyes"], [ |
| 95 | PKG_CHECK_MODULES(LIBOSMOE1D, libosmo-e1d) |
| 96 | ]) |
| 97 | AM_CONDITIONAL(ENABLE_E1D, test "x$ENABLE_E1D" = "xyes") |
| 98 | AC_SUBST(ENABLE_E1D) |
| 99 | if test x"$ENABLE_E1D" = x"yes" |
| 100 | then |
| 101 | AC_DEFINE([HAVE_E1D], [1], [Enable osmo-e1d driver support]) |
| 102 | fi |
| 103 | |
Max | 8a3be28 | 2017-02-20 18:24:03 +0100 | [diff] [blame] | 104 | AC_ARG_ENABLE(sanitize, |
| 105 | [AS_HELP_STRING( |
| 106 | [--enable-sanitize], |
| 107 | [Compile with address sanitizer enabled], |
| 108 | )], |
| 109 | [sanitize=$enableval], [sanitize="no"]) |
| 110 | if test x"$sanitize" = x"yes" |
| 111 | then |
Pau Espin Pedrol | 65529bc | 2017-07-05 22:02:53 +0200 | [diff] [blame] | 112 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 113 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
Max | 8a3be28 | 2017-02-20 18:24:03 +0100 | [diff] [blame] | 114 | fi |
| 115 | |
Neels Hofmeyr | bb83e6f | 2018-03-05 20:37:13 +0100 | [diff] [blame] | 116 | AC_ARG_ENABLE(werror, |
| 117 | [AS_HELP_STRING( |
| 118 | [--enable-werror], |
| 119 | [Turn all compiler warnings into errors, with exceptions: |
| 120 | a) deprecation (allow upstream to mark deprecation without breaking builds); |
| 121 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) |
| 122 | ] |
| 123 | )], |
| 124 | [werror=$enableval], [werror="no"]) |
| 125 | if test x"$werror" = x"yes" |
| 126 | then |
| 127 | WERROR_FLAGS="-Werror" |
| 128 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" |
| 129 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" |
| 130 | CFLAGS="$CFLAGS $WERROR_FLAGS" |
| 131 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" |
| 132 | fi |
| 133 | |
Harald Welte | bf7976c | 2017-04-04 12:10:54 +0000 | [diff] [blame] | 134 | _cflags_save=$CFLAGS |
| 135 | CFLAGS="$CFLAGS $ORTP_CFLAGS" |
Pau Espin Pedrol | c42bf19 | 2017-03-24 17:26:49 +0100 | [diff] [blame] | 136 | AC_COMPILE_IFELSE( |
| 137 | [AC_LANG_PROGRAM( |
| 138 | [[#include <ortp/ortp.h>]], |
| 139 | [[ortp_set_log_level_mask(NULL, 0xffff);]] |
| 140 | )], |
| 141 | [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [1], |
| 142 | [ortp_set_log_level_mask requires domain parameter])], |
| 143 | [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [0], |
| 144 | [ortp_set_log_level_mask has no domain parameter])]) |
Harald Welte | bf7976c | 2017-04-04 12:10:54 +0000 | [diff] [blame] | 145 | CFLAGS=$_cflags_save |
Pau Espin Pedrol | c42bf19 | 2017-03-24 17:26:49 +0100 | [diff] [blame] | 146 | |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 147 | _cflags_save=$CFLAGS |
Pau Espin Pedrol | 43b5b69 | 2018-04-10 18:15:48 +0200 | [diff] [blame] | 148 | CFLAGS="$CFLAGS $ORTP_CFLAGS -Werror" |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 149 | AC_COMPILE_IFELSE( |
| 150 | [AC_LANG_PROGRAM( |
Pau Espin Pedrol | 1307b7a | 2017-07-13 22:14:37 +0200 | [diff] [blame] | 151 | [[#include <ortp/ortp.h> |
| 152 | void fake_cb(struct _RtpSession *r, void *arg1, void *arg2, void *arg3) { return; }]], |
| 153 | [[rtp_session_signal_connect(NULL, "", fake_cb, (void*) fake_cb);]] |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 154 | )], |
| 155 | [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(void*)(arg)], |
| 156 | [rtp_session_signal_connect requires pointer parameter])], |
| 157 | [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(unsigned long)(arg)], |
| 158 | [rtp_session_signal_connect requires ulong parameter])]) |
| 159 | CFLAGS=$_cflags_save |
| 160 | |
Neels Hofmeyr | bb83e6f | 2018-03-05 20:37:13 +0100 | [diff] [blame] | 161 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 162 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
Pau Espin Pedrol | 05df2d6 | 2017-06-21 07:37:45 +0200 | [diff] [blame] | 163 | |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 164 | AC_OUTPUT( |
| 165 | libosmoabis.pc |
Harald Welte | 41d0d84 | 2011-09-03 15:33:24 +0200 | [diff] [blame] | 166 | libosmotrau.pc |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 167 | include/Makefile |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 168 | src/Makefile |
Pablo Neira Ayuso | 0ba77d5 | 2011-06-05 18:32:44 +0200 | [diff] [blame] | 169 | tests/Makefile |
Oliver Smith | 85887b2 | 2020-05-14 11:30:01 +0200 | [diff] [blame] | 170 | Makefile |
| 171 | contrib/libosmo-abis.spec) |