blob: d24010ed28da25dc092c0de1360909021e392a25 [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
Pau Espin Pedrol5196cd52020-07-14 17:52:09 +020067PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.1.0)
68PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.1.0)
69PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.1.0)
Harald Weltedbb429c2020-08-04 09:50:24 +020070PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 1.1.0)
Max15d9b792016-04-28 12:05:27 +020071PKG_CHECK_MODULES(ORTP, ortp >= 0.22.0)
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +020072
Harald Welted4be6962019-11-11 17:00:12 +010073AC_ARG_ENABLE([dahdi],
74 AC_HELP_STRING([--disable-dahdi],
75 [disable support for DAHID ISDN (E1/T1) cards [default=yes]]),
76 [enable_dahdi="$enableval"], [enable_dahdi="yes"])
77AM_CONDITIONAL(ENABLE_DAHDI, test "x$enable_dahdi" = "xyes")
78if test "x$enable_dahdi" = "xyes"; then
79 AC_CHECK_HEADERS([dahdi/user.h],[],[AC_MSG_ERROR([DAHDI input driver enabled but DAHDI not found])])
80else
81 AC_MSG_WARN([DAHDI input driver will not be built])
82fi
Pablo Neira Ayuso0b9ed9a2011-07-02 17:25:19 +020083
Sylvain Munautb559a532019-05-09 11:14:26 +020084AC_ARG_ENABLE([e1d],
85 [AS_HELP_STRING(
86 [--enable-e1d],
87 [Enable osmo-e1d driver support]
88 )],
89 [
90 ENABLE_E1D=$enableval
91 ],
92 [
93 ENABLE_E1D="no"
94 ])
95AS_IF([test "x$ENABLE_E1D" = "xyes"], [
96 PKG_CHECK_MODULES(LIBOSMOE1D, libosmo-e1d)
97])
98AM_CONDITIONAL(ENABLE_E1D, test "x$ENABLE_E1D" = "xyes")
99AC_SUBST(ENABLE_E1D)
100if test x"$ENABLE_E1D" = x"yes"
101then
102 AC_DEFINE([HAVE_E1D], [1], [Enable osmo-e1d driver support])
103fi
104
Max8a3be282017-02-20 18:24:03 +0100105AC_ARG_ENABLE(sanitize,
106 [AS_HELP_STRING(
107 [--enable-sanitize],
108 [Compile with address sanitizer enabled],
109 )],
110 [sanitize=$enableval], [sanitize="no"])
111if test x"$sanitize" = x"yes"
112then
Pau Espin Pedrol65529bc2017-07-05 22:02:53 +0200113 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
114 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
Max8a3be282017-02-20 18:24:03 +0100115fi
116
Neels Hofmeyrbb83e6f2018-03-05 20:37:13 +0100117AC_ARG_ENABLE(werror,
118 [AS_HELP_STRING(
119 [--enable-werror],
120 [Turn all compiler warnings into errors, with exceptions:
121 a) deprecation (allow upstream to mark deprecation without breaking builds);
122 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
123 ]
124 )],
125 [werror=$enableval], [werror="no"])
126if test x"$werror" = x"yes"
127then
128 WERROR_FLAGS="-Werror"
129 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
130 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
131 CFLAGS="$CFLAGS $WERROR_FLAGS"
132 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
133fi
134
Harald Weltebf7976c2017-04-04 12:10:54 +0000135_cflags_save=$CFLAGS
136CFLAGS="$CFLAGS $ORTP_CFLAGS"
Pau Espin Pedrolc42bf192017-03-24 17:26:49 +0100137AC_COMPILE_IFELSE(
138 [AC_LANG_PROGRAM(
139 [[#include <ortp/ortp.h>]],
140 [[ortp_set_log_level_mask(NULL, 0xffff);]]
141 )],
142 [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [1],
143 [ortp_set_log_level_mask requires domain parameter])],
144 [AC_DEFINE([HAVE_ORTP_LOG_DOMAIN], [0],
145 [ortp_set_log_level_mask has no domain parameter])])
Harald Weltebf7976c2017-04-04 12:10:54 +0000146CFLAGS=$_cflags_save
Pau Espin Pedrolc42bf192017-03-24 17:26:49 +0100147
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200148_cflags_save=$CFLAGS
Pau Espin Pedrol43b5b692018-04-10 18:15:48 +0200149CFLAGS="$CFLAGS $ORTP_CFLAGS -Werror"
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200150AC_COMPILE_IFELSE(
151 [AC_LANG_PROGRAM(
Pau Espin Pedrol1307b7a2017-07-13 22:14:37 +0200152 [[#include <ortp/ortp.h>
153 void fake_cb(struct _RtpSession *r, void *arg1, void *arg2, void *arg3) { return; }]],
154 [[rtp_session_signal_connect(NULL, "", fake_cb, (void*) fake_cb);]]
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200155 )],
156 [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(void*)(arg)],
157 [rtp_session_signal_connect requires pointer parameter])],
158 [AC_DEFINE([RTP_SIGNAL_PTR_CAST(arg)], [(unsigned long)(arg)],
159 [rtp_session_signal_connect requires ulong parameter])])
160CFLAGS=$_cflags_save
161
Neels Hofmeyrbb83e6f2018-03-05 20:37:13 +0100162AC_MSG_RESULT([CFLAGS="$CFLAGS"])
163AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
Pau Espin Pedrol05df2d62017-06-21 07:37:45 +0200164
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200165AC_OUTPUT(
166 libosmoabis.pc
Harald Welte41d0d842011-09-03 15:33:24 +0200167 libosmotrau.pc
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200168 include/Makefile
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200169 src/Makefile
Pablo Neira Ayuso0ba77d52011-06-05 18:32:44 +0200170 tests/Makefile
Oliver Smith85887b22020-05-14 11:30:01 +0200171 Makefile
172 contrib/libosmo-abis.spec)