blob: f095cf50932c283beb76b1ed01bd5efb7357fa0b [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
Eric73a73c02020-04-11 01:15:40 +020024dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
25AS_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 Hofmeyr24796f22016-10-01 00:48:43 +020029dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
30AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
31if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
32 AC_MSG_WARN([You need to install pkg-config])
33fi
34PKG_PROG_PKG_CONFIG([0.20])
35
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020036AC_CONFIG_MACRO_DIR([m4])
37
Pau Espin Pedrol65529bc2017-07-05 22:02:53 +020038CFLAGS="$CFLAGS -Wall"
39CPPFLAGS="$CPPFLAGS -Wall"
Pau Espin Pedrol62eddcd2017-06-21 07:43:14 +020040
Neels Hofmeyr2e05f882017-11-17 01:43:36 +010041AC_ARG_ENABLE(sanitize,
42 [AS_HELP_STRING(
43 [--enable-sanitize],
44 [Compile with address sanitizer enabled],
45 )],
46 [sanitize=$enableval], [sanitize="no"])
47if test x"$sanitize" = x"yes"
48then
49 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
50 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
51fi
52
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020053# The following test is taken from WebKit's webkit.m4
54saved_CFLAGS="$CFLAGS"
55CFLAGS="$CFLAGS -fvisibility=hidden "
56AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
57AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
58 [ AC_MSG_RESULT([yes])
59 SYMBOL_VISIBILITY="-fvisibility=hidden"],
60 AC_MSG_RESULT([no]))
61CFLAGS="$saved_CFLAGS"
62AC_SUBST(SYMBOL_VISIBILITY)
63
64dnl Generate the output
65AM_CONFIG_HEADER(config.h)
66
Harald Welte176a1fb2019-01-19 22:20:47 +010067PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.0.0)
68PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.0.0)
69PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.0.0)
Max15d9b792016-04-28 12:05:27 +020070PKG_CHECK_MODULES(ORTP, ortp >= 0.22.0)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020071
Harald Welted4be6962019-11-11 17:00:12 +010072AC_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"])
76AM_CONDITIONAL(ENABLE_DAHDI, test "x$enable_dahdi" = "xyes")
77if test "x$enable_dahdi" = "xyes"; then
78 AC_CHECK_HEADERS([dahdi/user.h],[],[AC_MSG_ERROR([DAHDI input driver enabled but DAHDI not found])])
79else
80 AC_MSG_WARN([DAHDI input driver will not be built])
81fi
Pablo Neira Ayuso0b9ed9a2011-07-02 17:25:19 +020082
Sylvain Munautb559a532019-05-09 11:14:26 +020083AC_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 ])
94AS_IF([test "x$ENABLE_E1D" = "xyes"], [
95 PKG_CHECK_MODULES(LIBOSMOE1D, libosmo-e1d)
96])
97AM_CONDITIONAL(ENABLE_E1D, test "x$ENABLE_E1D" = "xyes")
98AC_SUBST(ENABLE_E1D)
99if test x"$ENABLE_E1D" = x"yes"
100then
101 AC_DEFINE([HAVE_E1D], [1], [Enable osmo-e1d driver support])
102fi
103
Max8a3be282017-02-20 18:24:03 +0100104AC_ARG_ENABLE(sanitize,
105 [AS_HELP_STRING(
106 [--enable-sanitize],
107 [Compile with address sanitizer enabled],
108 )],
109 [sanitize=$enableval], [sanitize="no"])
110if test x"$sanitize" = x"yes"
111then
Pau Espin Pedrol65529bc2017-07-05 22:02:53 +0200112 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
113 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
Max8a3be282017-02-20 18:24:03 +0100114fi
115
Neels Hofmeyrbb83e6f2018-03-05 20:37:13 +0100116AC_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"])
125if test x"$werror" = x"yes"
126then
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"
132fi
133
Harald Weltebf7976c2017-04-04 12:10:54 +0000134_cflags_save=$CFLAGS
135CFLAGS="$CFLAGS $ORTP_CFLAGS"
Pau Espin Pedrolc42bf192017-03-24 17:26:49 +0100136AC_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 Weltebf7976c2017-04-04 12:10:54 +0000145CFLAGS=$_cflags_save
Pau Espin Pedrolc42bf192017-03-24 17:26:49 +0100146
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200147_cflags_save=$CFLAGS
Pau Espin Pedrol43b5b692018-04-10 18:15:48 +0200148CFLAGS="$CFLAGS $ORTP_CFLAGS -Werror"
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200149AC_COMPILE_IFELSE(
150 [AC_LANG_PROGRAM(
Pau Espin Pedrol1307b7a2017-07-13 22:14:37 +0200151 [[#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 Pedrol05df2d62017-06-21 07:37:45 +0200154 )],
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])])
159CFLAGS=$_cflags_save
160
Neels Hofmeyrbb83e6f2018-03-05 20:37:13 +0100161AC_MSG_RESULT([CFLAGS="$CFLAGS"])
162AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200163
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200164AC_OUTPUT(
165 libosmoabis.pc
Harald Welte41d0d842011-09-03 15:33:24 +0200166 libosmotrau.pc
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200167 include/Makefile
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200168 src/Makefile
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200169 tests/Makefile
Oliver Smith85887b22020-05-14 11:30:01 +0200170 Makefile
171 contrib/libosmo-abis.spec)