blob: 35b83282eae5e1156c0dac7426b70d61f648d2ee [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
Harald Welte176a1fb2019-01-19 22:20:47 +010062PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0)
63PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.0.0)
64PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.0.0)
Max15d9b792016-04-28 12:05:27 +020065PKG_CHECK_MODULES(ORTP, ortp >= 0.22.0)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020066
Harald Welted4be6962019-11-11 17:00:12 +010067AC_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"])
71AM_CONDITIONAL(ENABLE_DAHDI, test "x$enable_dahdi" = "xyes")
72if test "x$enable_dahdi" = "xyes"; then
73 AC_CHECK_HEADERS([dahdi/user.h],[],[AC_MSG_ERROR([DAHDI input driver enabled but DAHDI not found])])
74else
75 AC_MSG_WARN([DAHDI input driver will not be built])
76fi
Pablo Neira Ayuso0b9ed9a2011-07-02 17:25:19 +020077
Sylvain Munautb559a532019-05-09 11:14:26 +020078AC_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 ])
89AS_IF([test "x$ENABLE_E1D" = "xyes"], [
90 PKG_CHECK_MODULES(LIBOSMOE1D, libosmo-e1d)
91])
92AM_CONDITIONAL(ENABLE_E1D, test "x$ENABLE_E1D" = "xyes")
93AC_SUBST(ENABLE_E1D)
94if test x"$ENABLE_E1D" = x"yes"
95then
96 AC_DEFINE([HAVE_E1D], [1], [Enable osmo-e1d driver support])
97fi
98
Max8a3be282017-02-20 18:24:03 +010099AC_ARG_ENABLE(sanitize,
100 [AS_HELP_STRING(
101 [--enable-sanitize],
102 [Compile with address sanitizer enabled],
103 )],
104 [sanitize=$enableval], [sanitize="no"])
105if test x"$sanitize" = x"yes"
106then
Pau Espin Pedrol65529bc2017-07-05 22:02:53 +0200107 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
108 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
Max8a3be282017-02-20 18:24:03 +0100109fi
110
Neels Hofmeyrbb83e6f2018-03-05 20:37:13 +0100111AC_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"])
120if test x"$werror" = x"yes"
121then
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"
127fi
128
Harald Weltebf7976c2017-04-04 12:10:54 +0000129_cflags_save=$CFLAGS
130CFLAGS="$CFLAGS $ORTP_CFLAGS"
Pau Espin Pedrolc42bf192017-03-24 17:26:49 +0100131AC_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 Weltebf7976c2017-04-04 12:10:54 +0000140CFLAGS=$_cflags_save
Pau Espin Pedrolc42bf192017-03-24 17:26:49 +0100141
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200142_cflags_save=$CFLAGS
Pau Espin Pedrol43b5b692018-04-10 18:15:48 +0200143CFLAGS="$CFLAGS $ORTP_CFLAGS -Werror"
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200144AC_COMPILE_IFELSE(
145 [AC_LANG_PROGRAM(
Pau Espin Pedrol1307b7a2017-07-13 22:14:37 +0200146 [[#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 Pedrol05df2d62017-06-21 07:37:45 +0200149 )],
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])])
154CFLAGS=$_cflags_save
155
Neels Hofmeyrbb83e6f2018-03-05 20:37:13 +0100156AC_MSG_RESULT([CFLAGS="$CFLAGS"])
157AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200158
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200159AC_OUTPUT(
160 libosmoabis.pc
Harald Welte41d0d842011-09-03 15:33:24 +0200161 libosmotrau.pc
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200162 include/Makefile
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200163 src/Makefile
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200164 tests/Makefile
165 Makefile)