blob: 775b3b75733a3199d8ec2cfc764c8358a868b446 [file] [log] [blame]
Harald Welte4b233b42012-11-07 08:32:31 +01001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.57)
Harald Welte16480662017-08-14 18:55:24 +02005AC_INIT(libsmpp34, m4_esyscmd([./git-version-gen .tarball-version]), ultraismo@yahoo.com)
6
Harald Welte4b233b42012-11-07 08:32:31 +01007AC_CONFIG_AUX_DIR(aux_config)
Harald Welte78b51892017-03-16 20:29:08 +01008AM_INIT_AUTOMAKE([foreign])
Harald Welte4b233b42012-11-07 08:32:31 +01009AM_CONFIG_HEADER([aux_config/config.h])
10
Vadim Yanitskiya0e85ce2019-04-10 17:48:06 +070011dnl kernel style compile messages
12m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
13
Max823e7112017-08-28 11:51:11 +020014dnl include release helper
15RELMAKE='-include osmo-release.mk'
16AC_SUBST([RELMAKE])
17
Harald Welte4b233b42012-11-07 08:32:31 +010018# Checks for programs.
19AC_PROG_CC
20AM_PROG_CC_C_O
21AC_PROG_LIBTOOL
22AC_PROG_INSTALL
23
Eric7dbf4bb2020-04-11 01:17:00 +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 Hofmeyr943f0792016-10-01 00:50:11 +020029# 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
Harald Welte4b233b42012-11-07 08:32:31 +010036# Checks for libraries.
37
38# Checks for header files.
39AC_HEADER_STDC
Holger Hans Peter Freytherac4af142012-11-09 11:49:22 +010040AC_CHECK_HEADERS([stdlib.h netinet/in.h stdint.h string.h])
Harald Welte4b233b42012-11-07 08:32:31 +010041
Harald Welte9288d592012-11-09 09:12:42 +010042found_libxml2=yes
43PKG_CHECK_MODULES(LIBXML2, libxml-2.0, , found_libxml2=no)
44AM_CONDITIONAL(HAVE_LIBXML2, test "$found_libxml2" = yes)
45
Harald Welte4b233b42012-11-07 08:32:31 +010046# Checks for typedefs, structures, and compiler characteristics.
47
48# Checks for library functions.
49AC_FUNC_MALLOC
50AC_CHECK_FUNCS([memset])
Neels Hofmeyr7c2232e2017-11-17 01:43:36 +010051
52AC_ARG_ENABLE(sanitize,
53 [AS_HELP_STRING(
54 [--enable-sanitize],
55 [Compile with address sanitizer enabled],
56 )],
57 [sanitize=$enableval], [sanitize="no"])
58if test x"$sanitize" = x"yes"
59then
60 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
61 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
62fi
63
Neels Hofmeyr7fb2a402018-03-05 20:41:40 +010064AC_ARG_ENABLE(werror,
65 [AS_HELP_STRING(
66 [--enable-werror],
67 [Turn all compiler warnings into errors, with exceptions:
68 a) deprecation (allow upstream to mark deprecation without breaking builds);
69 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
70 ]
71 )],
72 [werror=$enableval], [werror="no"])
73if test x"$werror" = x"yes"
74then
75 WERROR_FLAGS="-Werror"
76 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
77 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
78 CFLAGS="$CFLAGS $WERROR_FLAGS"
79 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
80fi
81
82AC_MSG_RESULT([CFLAGS="$CFLAGS"])
83AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
84
Harald Welte4b233b42012-11-07 08:32:31 +010085AC_OUTPUT([Makefile
86 def_frame/Makefile
87 def_list/Makefile
Holger Hans Peter Freyther9738dfa2013-09-23 14:33:05 +020088 binaries/Makefile
Harald Welte88029df2012-12-18 20:55:26 +010089 test_apps/Makefile
Harald Welteae37eac2012-11-08 15:01:42 +010090 libsmpp34.pc])