blob: 0e07330d5af40ca3b5b13e1ecee035447ea8af7a [file] [log] [blame]
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +02001AC_INIT([libosmo-abis],
2 m4_esyscmd([./git-version-gen .tarball-version]),
Holger Hans Peter Freyther584672e2012-03-26 16:36:21 +02003 [openbsc@lists.osmocom.org])
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +02004
Neels Hofmeyrf5d28602016-10-01 00:33:39 +02005dnl *This* is the root dir, even if an install-sh exists in ../ or ../../
6AC_CONFIG_AUX_DIR([.])
7
Harald Welteb37c5d42015-08-15 10:50:53 +02008AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip 1.6 subdir-objects])
Holger Hans Peter Freyther5c65e792012-10-11 08:05:14 +02009AC_CONFIG_TESTDIR(tests)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020010
11dnl kernel style compile messages
12m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
13
Maxe3260722017-07-05 15:08:39 +020014dnl include release helper
15RELMAKE='-include osmo-release.mk'
16AC_SUBST([RELMAKE])
17
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020018dnl checks for programs
19AC_PROG_MAKE_SET
20AC_PROG_CC
21AC_PROG_INSTALL
Diego Elio Pettenò62f0e062012-06-30 15:22:56 -070022LT_INIT([pic-only])
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020023
Neels Hofmeyr24796f22016-10-01 00:48:43 +020024dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
25AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
26if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
27 AC_MSG_WARN([You need to install pkg-config])
28fi
29PKG_PROG_PKG_CONFIG([0.20])
30
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020031AC_CONFIG_MACRO_DIR([m4])
32
Pau Espin Pedrol65529bc2017-07-05 22:02:53 +020033CFLAGS="$CFLAGS -Wall"
34CPPFLAGS="$CPPFLAGS -Wall"
Pau Espin Pedrol62eddcd2017-06-21 07:43:14 +020035
Neels Hofmeyr2e05f882017-11-17 01:43:36 +010036AC_ARG_ENABLE(sanitize,
37 [AS_HELP_STRING(
38 [--enable-sanitize],
39 [Compile with address sanitizer enabled],
40 )],
41 [sanitize=$enableval], [sanitize="no"])
42if test x"$sanitize" = x"yes"
43then
44 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
45 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
46fi
47
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020048# The following test is taken from WebKit's webkit.m4
49saved_CFLAGS="$CFLAGS"
50CFLAGS="$CFLAGS -fvisibility=hidden "
51AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
52AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
53 [ AC_MSG_RESULT([yes])
54 SYMBOL_VISIBILITY="-fvisibility=hidden"],
55 AC_MSG_RESULT([no]))
56CFLAGS="$saved_CFLAGS"
57AC_SUBST(SYMBOL_VISIBILITY)
58
59dnl Generate the output
60AM_CONFIG_HEADER(config.h)
61
62PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.0)
63PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.3.0)
Harald Welte43f4e082011-10-10 08:49:01 +020064PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.10)
Max15d9b792016-04-28 12:05:27 +020065PKG_CHECK_MODULES(ORTP, ortp >= 0.22.0)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020066
Harald Welte3bc78852011-08-24 08:32:38 +020067AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built))
Pablo Neira Ayuso0b9ed9a2011-07-02 17:25:19 +020068
Max8a3be282017-02-20 18:24:03 +010069AC_ARG_ENABLE(sanitize,
70 [AS_HELP_STRING(
71 [--enable-sanitize],
72 [Compile with address sanitizer enabled],
73 )],
74 [sanitize=$enableval], [sanitize="no"])
75if test x"$sanitize" = x"yes"
76then
Pau Espin Pedrol65529bc2017-07-05 22:02:53 +020077 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
78 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
Max8a3be282017-02-20 18:24:03 +010079fi
80
Harald Weltebf7976c2017-04-04 12:10:54 +000081_cflags_save=$CFLAGS
82CFLAGS="$CFLAGS $ORTP_CFLAGS"
Pau Espin Pedrolc42bf192017-03-24 17:26:49 +010083AC_COMPILE_IFELSE(
84 [AC_LANG_PROGRAM(
85 [[#include <ortp/ortp.h>]],
86 [[ortp_set_log_level_mask(NULL, 0xffff);]]
87 )],
88 [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [1],
89 [ortp_set_log_level_mask requires domain parameter])],
90 [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [0],
91 [ortp_set_log_level_mask has no domain parameter])])
Harald Weltebf7976c2017-04-04 12:10:54 +000092CFLAGS=$_cflags_save
Pau Espin Pedrolc42bf192017-03-24 17:26:49 +010093
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +020094_cflags_save=$CFLAGS
95CFLAGS="$CFLAGS $ORTP_CFLAGS"
96AC_COMPILE_IFELSE(
97 [AC_LANG_PROGRAM(
Pau Espin Pedrol1307b7a2017-07-13 22:14:37 +020098 [[#include <ortp/ortp.h>
99 void fake_cb(struct _RtpSession *r, void *arg1, void *arg2, void *arg3) { return; }]],
100 [[rtp_session_signal_connect(NULL, "", fake_cb, (void*) fake_cb);]]
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200101 )],
102 [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(void*)(arg)],
103 [rtp_session_signal_connect requires pointer parameter])],
104 [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(unsigned long)(arg)],
105 [rtp_session_signal_connect requires ulong parameter])])
106CFLAGS=$_cflags_save
107
108
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200109AC_OUTPUT(
110 libosmoabis.pc
Harald Welte41d0d842011-09-03 15:33:24 +0200111 libosmotrau.pc
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200112 include/Makefile
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200113 src/Makefile
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200114 tests/Makefile
115 Makefile)