blob: 94549535c0d4dcf234fed327142d2bdf7fe6827a [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])
Vadim Yanitskiy70aa4ab2022-08-14 12:42:42 +07009AC_CONFIG_HEADERS([aux_config/config.h])
10AC_CONFIG_MACRO_DIRS([m4])
Harald Welte4b233b42012-11-07 08:32:31 +010011
Vadim Yanitskiya0e85ce2019-04-10 17:48:06 +070012dnl kernel style compile messages
13m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
14
Max823e7112017-08-28 11:51:11 +020015dnl include release helper
16RELMAKE='-include osmo-release.mk'
17AC_SUBST([RELMAKE])
18
Harald Welte4b233b42012-11-07 08:32:31 +010019# Checks for programs.
20AC_PROG_CC
21AM_PROG_CC_C_O
Harald Welte4b233b42012-11-07 08:32:31 +010022AC_PROG_INSTALL
Vadim Yanitskiy70aa4ab2022-08-14 12:42:42 +070023LT_INIT
Harald Welte4b233b42012-11-07 08:32:31 +010024
Eric7dbf4bb2020-04-11 01:17:00 +020025dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang
26AS_CASE(["$LD"],[*clang*],
27 [AS_CASE(["${host_os}"],
28 [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
29
Neels Hofmeyr943f0792016-10-01 00:50:11 +020030# check for pkg-config (explained in detail in libosmocore/configure.ac)
31AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
32if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
33 AC_MSG_WARN([You need to install pkg-config])
34fi
35PKG_PROG_PKG_CONFIG([0.20])
36
Harald Welte4b233b42012-11-07 08:32:31 +010037# Checks for libraries.
38
39# Checks for header files.
40AC_HEADER_STDC
Holger Hans Peter Freytherac4af142012-11-09 11:49:22 +010041AC_CHECK_HEADERS([stdlib.h netinet/in.h stdint.h string.h])
Harald Welte4b233b42012-11-07 08:32:31 +010042
Harald Welte9288d592012-11-09 09:12:42 +010043found_libxml2=yes
44PKG_CHECK_MODULES(LIBXML2, libxml-2.0, , found_libxml2=no)
45AM_CONDITIONAL(HAVE_LIBXML2, test "$found_libxml2" = yes)
46
Harald Welte4b233b42012-11-07 08:32:31 +010047# Checks for typedefs, structures, and compiler characteristics.
48
49# Checks for library functions.
50AC_FUNC_MALLOC
51AC_CHECK_FUNCS([memset])
Neels Hofmeyr7c2232e2017-11-17 01:43:36 +010052
53AC_ARG_ENABLE(sanitize,
54 [AS_HELP_STRING(
55 [--enable-sanitize],
56 [Compile with address sanitizer enabled],
57 )],
58 [sanitize=$enableval], [sanitize="no"])
59if test x"$sanitize" = x"yes"
60then
61 CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
62 CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
63fi
64
Neels Hofmeyr7fb2a402018-03-05 20:41:40 +010065AC_ARG_ENABLE(werror,
66 [AS_HELP_STRING(
67 [--enable-werror],
68 [Turn all compiler warnings into errors, with exceptions:
69 a) deprecation (allow upstream to mark deprecation without breaking builds);
70 b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds)
71 ]
72 )],
73 [werror=$enableval], [werror="no"])
74if test x"$werror" = x"yes"
75then
76 WERROR_FLAGS="-Werror"
Harald Weltec3e797b2022-11-03 11:57:42 +010077 WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition"
Neels Hofmeyr7fb2a402018-03-05 20:41:40 +010078 WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations"
79 WERROR_FLAGS+=" -Wno-error=cpp" # "#warning"
80 CFLAGS="$CFLAGS $WERROR_FLAGS"
81 CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
82fi
83
84AC_MSG_RESULT([CFLAGS="$CFLAGS"])
85AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
86
Vadim Yanitskiy70aa4ab2022-08-14 12:42:42 +070087AC_CONFIG_FILES([Makefile
88 def_frame/Makefile
89 def_list/Makefile
90 binaries/Makefile
91 test_apps/Makefile
92 libsmpp34.pc
93 contrib/libsmpp34.spec])
94AC_OUTPUT