Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
| 4 | AC_PREREQ(2.57) |
Harald Welte | 1648066 | 2017-08-14 18:55:24 +0200 | [diff] [blame] | 5 | AC_INIT(libsmpp34, m4_esyscmd([./git-version-gen .tarball-version]), ultraismo@yahoo.com) |
| 6 | |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 7 | AC_CONFIG_AUX_DIR(aux_config) |
Harald Welte | 78b5189 | 2017-03-16 20:29:08 +0100 | [diff] [blame] | 8 | AM_INIT_AUTOMAKE([foreign]) |
Vadim Yanitskiy | 70aa4ab | 2022-08-14 12:42:42 +0700 | [diff] [blame] | 9 | AC_CONFIG_HEADERS([aux_config/config.h]) |
| 10 | AC_CONFIG_MACRO_DIRS([m4]) |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 11 | |
Vadim Yanitskiy | a0e85ce | 2019-04-10 17:48:06 +0700 | [diff] [blame] | 12 | dnl kernel style compile messages |
| 13 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 14 | |
Max | 823e711 | 2017-08-28 11:51:11 +0200 | [diff] [blame] | 15 | dnl include release helper |
| 16 | RELMAKE='-include osmo-release.mk' |
| 17 | AC_SUBST([RELMAKE]) |
| 18 | |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 19 | # Checks for programs. |
| 20 | AC_PROG_CC |
| 21 | AM_PROG_CC_C_O |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 22 | AC_PROG_INSTALL |
Vadim Yanitskiy | 70aa4ab | 2022-08-14 12:42:42 +0700 | [diff] [blame] | 23 | LT_INIT |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 24 | |
Eric | 7dbf4bb | 2020-04-11 01:17:00 +0200 | [diff] [blame] | 25 | dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang |
| 26 | AS_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 Hofmeyr | 943f079 | 2016-10-01 00:50:11 +0200 | [diff] [blame] | 30 | # check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 31 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 32 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 33 | AC_MSG_WARN([You need to install pkg-config]) |
| 34 | fi |
| 35 | PKG_PROG_PKG_CONFIG([0.20]) |
| 36 | |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 37 | # Checks for libraries. |
| 38 | |
| 39 | # Checks for header files. |
| 40 | AC_HEADER_STDC |
Holger Hans Peter Freyther | ac4af14 | 2012-11-09 11:49:22 +0100 | [diff] [blame] | 41 | AC_CHECK_HEADERS([stdlib.h netinet/in.h stdint.h string.h]) |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 42 | |
Harald Welte | 9288d59 | 2012-11-09 09:12:42 +0100 | [diff] [blame] | 43 | found_libxml2=yes |
| 44 | PKG_CHECK_MODULES(LIBXML2, libxml-2.0, , found_libxml2=no) |
| 45 | AM_CONDITIONAL(HAVE_LIBXML2, test "$found_libxml2" = yes) |
| 46 | |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 47 | # Checks for typedefs, structures, and compiler characteristics. |
| 48 | |
| 49 | # Checks for library functions. |
| 50 | AC_FUNC_MALLOC |
| 51 | AC_CHECK_FUNCS([memset]) |
Neels Hofmeyr | 7c2232e | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 52 | |
| 53 | AC_ARG_ENABLE(sanitize, |
| 54 | [AS_HELP_STRING( |
| 55 | [--enable-sanitize], |
| 56 | [Compile with address sanitizer enabled], |
| 57 | )], |
| 58 | [sanitize=$enableval], [sanitize="no"]) |
| 59 | if test x"$sanitize" = x"yes" |
| 60 | then |
| 61 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 62 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 63 | fi |
| 64 | |
Neels Hofmeyr | 7fb2a40 | 2018-03-05 20:41:40 +0100 | [diff] [blame] | 65 | AC_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"]) |
| 74 | if test x"$werror" = x"yes" |
| 75 | then |
| 76 | WERROR_FLAGS="-Werror" |
Harald Welte | c3e797b | 2022-11-03 11:57:42 +0100 | [diff] [blame] | 77 | WERROR_FLAGS+=" -Werror=implicit-int -Werror=int-conversion -Werror=old-style-definition" |
Neels Hofmeyr | 7fb2a40 | 2018-03-05 20:41:40 +0100 | [diff] [blame] | 78 | 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" |
| 82 | fi |
| 83 | |
| 84 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 85 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 86 | |
Vadim Yanitskiy | 70aa4ab | 2022-08-14 12:42:42 +0700 | [diff] [blame] | 87 | AC_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]) |
| 94 | AC_OUTPUT |