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]) |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 9 | AM_CONFIG_HEADER([aux_config/config.h]) |
| 10 | |
Vadim Yanitskiy | a0e85ce | 2019-04-10 17:48:06 +0700 | [diff] [blame] | 11 | dnl kernel style compile messages |
| 12 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 13 | |
Max | 823e711 | 2017-08-28 11:51:11 +0200 | [diff] [blame] | 14 | dnl include release helper |
| 15 | RELMAKE='-include osmo-release.mk' |
| 16 | AC_SUBST([RELMAKE]) |
| 17 | |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 18 | # Checks for programs. |
| 19 | AC_PROG_CC |
| 20 | AM_PROG_CC_C_O |
| 21 | AC_PROG_LIBTOOL |
| 22 | AC_PROG_INSTALL |
| 23 | |
Eric | 7dbf4bb | 2020-04-11 01:17:00 +0200 | [diff] [blame] | 24 | dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang |
| 25 | AS_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 Hofmeyr | 943f079 | 2016-10-01 00:50:11 +0200 | [diff] [blame] | 29 | # check for pkg-config (explained in detail in libosmocore/configure.ac) |
| 30 | AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no) |
| 31 | if test "x$PKG_CONFIG_INSTALLED" = "xno"; then |
| 32 | AC_MSG_WARN([You need to install pkg-config]) |
| 33 | fi |
| 34 | PKG_PROG_PKG_CONFIG([0.20]) |
| 35 | |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 36 | # Checks for libraries. |
| 37 | |
| 38 | # Checks for header files. |
| 39 | AC_HEADER_STDC |
Holger Hans Peter Freyther | ac4af14 | 2012-11-09 11:49:22 +0100 | [diff] [blame] | 40 | AC_CHECK_HEADERS([stdlib.h netinet/in.h stdint.h string.h]) |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 41 | |
Harald Welte | 9288d59 | 2012-11-09 09:12:42 +0100 | [diff] [blame] | 42 | found_libxml2=yes |
| 43 | PKG_CHECK_MODULES(LIBXML2, libxml-2.0, , found_libxml2=no) |
| 44 | AM_CONDITIONAL(HAVE_LIBXML2, test "$found_libxml2" = yes) |
| 45 | |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 46 | # Checks for typedefs, structures, and compiler characteristics. |
| 47 | |
| 48 | # Checks for library functions. |
| 49 | AC_FUNC_MALLOC |
| 50 | AC_CHECK_FUNCS([memset]) |
Neels Hofmeyr | 7c2232e | 2017-11-17 01:43:36 +0100 | [diff] [blame] | 51 | |
| 52 | AC_ARG_ENABLE(sanitize, |
| 53 | [AS_HELP_STRING( |
| 54 | [--enable-sanitize], |
| 55 | [Compile with address sanitizer enabled], |
| 56 | )], |
| 57 | [sanitize=$enableval], [sanitize="no"]) |
| 58 | if test x"$sanitize" = x"yes" |
| 59 | then |
| 60 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 61 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 62 | fi |
| 63 | |
Neels Hofmeyr | 7fb2a40 | 2018-03-05 20:41:40 +0100 | [diff] [blame] | 64 | AC_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"]) |
| 73 | if test x"$werror" = x"yes" |
| 74 | then |
| 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" |
| 80 | fi |
| 81 | |
| 82 | AC_MSG_RESULT([CFLAGS="$CFLAGS"]) |
| 83 | AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"]) |
| 84 | |
Harald Welte | 4b233b4 | 2012-11-07 08:32:31 +0100 | [diff] [blame] | 85 | AC_OUTPUT([Makefile |
| 86 | def_frame/Makefile |
| 87 | def_list/Makefile |
Holger Hans Peter Freyther | 9738dfa | 2013-09-23 14:33:05 +0200 | [diff] [blame] | 88 | binaries/Makefile |
Harald Welte | 88029df | 2012-12-18 20:55:26 +0100 | [diff] [blame] | 89 | test_apps/Makefile |
Harald Welte | ae37eac | 2012-11-08 15:01:42 +0100 | [diff] [blame] | 90 | libsmpp34.pc]) |