Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 1 | AC_PREREQ([2.65]) |
Harald Welte | 0790f03 | 2015-11-05 21:25:32 +0100 | [diff] [blame] | 2 | AC_INIT([gapk], |
Vadim Yanitskiy | 6831ebd | 2017-09-08 10:55:05 +0300 | [diff] [blame] | 3 | m4_esyscmd([./git-version-gen .tarball-version]), |
| 4 | [openbsc@lists.osmocom.org]) |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 5 | |
Sylvain Munaut | ea1c6c6 | 2015-12-30 10:53:16 +0100 | [diff] [blame] | 6 | AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects]) |
Sylvain Munaut | ac967d2 | 2015-12-30 10:53:53 +0100 | [diff] [blame] | 7 | LT_INIT([disable-static]) |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 8 | |
Oliver Smith | 20cbe33 | 2021-01-27 17:30:19 +0100 | [diff] [blame] | 9 | CFLAGS="$CFLAGS -std=gnu11" |
| 10 | |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 11 | # kernel style compile messages |
| 12 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 13 | |
Vadim Yanitskiy | f8d91a0 | 2017-09-07 00:04:01 +0300 | [diff] [blame] | 14 | AC_CONFIG_SRCDIR([src/app_osmo_gapk.c]) |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 15 | AC_CONFIG_HEADERS([config.h]) |
| 16 | AC_CONFIG_MACRO_DIR([m4]) |
Vadim Yanitskiy | f069eb3 | 2017-09-12 15:26:31 +0300 | [diff] [blame] | 17 | AC_CONFIG_TESTDIR(tests) |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 18 | |
Eric | ed469d8 | 2023-05-15 17:02:04 +0200 | [diff] [blame] | 19 | dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang |
| 20 | AS_CASE(["$LD"],[*clang*], |
| 21 | [AS_CASE(["${host_os}"], |
| 22 | [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])]) |
| 23 | |
| 24 | |
Sylvain Munaut | 0d2a82c | 2010-11-12 17:10:44 +0100 | [diff] [blame] | 25 | # Options |
| 26 | AC_ARG_ENABLE(gsmhr, |
| 27 | [AS_HELP_STRING( |
Vadim Yanitskiy | 27bc25c | 2018-06-30 21:31:01 +0700 | [diff] [blame] | 28 | [--enable-gsmhr], |
| 29 | [Enable support for GSM HR codec using GSM 06.06 reference code] |
Sylvain Munaut | 0d2a82c | 2010-11-12 17:10:44 +0100 | [diff] [blame] | 30 | )], |
Vadim Yanitskiy | 27bc25c | 2018-06-30 21:31:01 +0700 | [diff] [blame] | 31 | [enable_gsmhr="yes"], [enable_gsmhr=$enableval]) |
Vadim Yanitskiy | 35c45f2 | 2018-02-11 20:59:16 +0700 | [diff] [blame] | 32 | AM_CONDITIONAL(ENABLE_GSMHR, test "x$enable_gsmhr" = "xyes") |
| 33 | if test "x$enable_gsmhr" = "xyes"; then |
Sylvain Munaut | aa55d30 | 2010-11-12 19:36:21 +0100 | [diff] [blame] | 34 | AM_PATH_PYTHON([2.4]) |
Sylvain Munaut | 0d2a82c | 2010-11-12 17:10:44 +0100 | [diff] [blame] | 35 | AC_DEFINE(HAVE_LIBGSMHR, 1, [Define to 1 if libgsmhr is available]) |
| 36 | fi |
| 37 | |
| 38 | # Check for -fvisibility support |
| 39 | # (The following test is taken from WebKit's webkit.m4) |
| 40 | saved_CFLAGS="$CFLAGS" |
| 41 | CFLAGS="$CFLAGS -fvisibility=hidden " |
| 42 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) |
Sylvain Munaut | 19428ca | 2011-09-30 12:15:12 +0200 | [diff] [blame] | 43 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], |
Sylvain Munaut | 0d2a82c | 2010-11-12 17:10:44 +0100 | [diff] [blame] | 44 | [ AC_MSG_RESULT([yes]) |
| 45 | SYMBOL_VISIBILITY="-fvisibility=hidden"], |
| 46 | AC_MSG_RESULT([no])) |
| 47 | CFLAGS="$saved_CFLAGS" |
| 48 | AC_SUBST(SYMBOL_VISIBILITY) |
| 49 | |
Vadim Yanitskiy | 4f0a47d | 2017-08-31 17:49:36 +0700 | [diff] [blame] | 50 | dnl check os: some linker flags not available on osx |
| 51 | case $host in |
| 52 | *-darwin*) |
| 53 | ;; |
| 54 | *) |
| 55 | LTLDFLAGS_OSMOGAPK='-Wl,--version-script=$(srcdir)/libosmogapk.map' |
| 56 | ;; |
| 57 | esac |
| 58 | AC_SUBST(LTLDFLAGS_OSMOGAPK) |
| 59 | |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 60 | # Checks for programs. |
| 61 | AC_PROG_CC |
| 62 | |
Max | 725e003 | 2018-02-12 13:04:32 +0100 | [diff] [blame] | 63 | AC_ARG_ENABLE(sanitize, |
| 64 | [AS_HELP_STRING([--enable-sanitize], [Compile with address sanitizer enabled], )], |
| 65 | [sanitize=$enableval], [sanitize="no"]) |
| 66 | if test x"$sanitize" = x"yes" |
| 67 | then |
| 68 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" |
| 69 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" |
| 70 | fi |
| 71 | |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 72 | # Checks for libraries. |
Sylvain Munaut | dc5b38b | 2010-11-11 13:51:31 +0100 | [diff] [blame] | 73 | # libosmocore (codec module) |
Harald Welte | ce94d97 | 2013-02-11 11:34:58 +0100 | [diff] [blame] | 74 | PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.2) |
Sylvain Munaut | 553b3b6 | 2010-10-24 18:33:20 +0200 | [diff] [blame] | 75 | PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 0.1.25) |
Harald Welte | 2ae47af | 2017-05-27 23:35:23 +0200 | [diff] [blame] | 76 | PKG_CHECK_MODULES(LIBALSA, alsa, [AC_DEFINE([HAVE_ALSA], [1], [We have ALSA])]) |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 77 | |
Sylvain Munaut | 8552b9d | 2010-11-11 13:57:41 +0100 | [diff] [blame] | 78 | # opencore-amrnb for AMR and EFR decoding |
| 79 | found_opencore_amrnb=yes |
Sylvain Munaut | 3c9c2fb | 2010-11-13 00:19:09 +0100 | [diff] [blame] | 80 | PKG_CHECK_MODULES(OPENCORE_AMRNB, opencore-amrnb >= 0.1.0, , found_opencore_amrnb=no) |
Sylvain Munaut | 8552b9d | 2010-11-11 13:57:41 +0100 | [diff] [blame] | 81 | if test "$found_opencore_amrnb" = yes; then |
| 82 | AC_DEFINE(HAVE_OPENCORE_AMRNB, 1, [Define to 1 if OpenCore AMR-NB library is available]) |
| 83 | fi |
| 84 | |
Sylvain Munaut | dc5b38b | 2010-11-11 13:51:31 +0100 | [diff] [blame] | 85 | # libgsm for FR decoding |
| 86 | found_libgsm=yes |
| 87 | AC_CHECK_HEADERS(gsm/gsm.h, , |
| 88 | [AC_CHECK_HEADERS(gsm.h, ,found_libgsm=no)]) |
| 89 | AC_CHECK_LIB(gsm, gsm_create, LIBGSM_LIBS="-lgsm", found_libgsm=no) |
| 90 | if test "$found_libgsm" = yes; then |
| 91 | AC_DEFINE(HAVE_LIBGSM, 1, [Define to 1 if libgsm is available]) |
| 92 | fi |
| 93 | AC_SUBST(LIBGSM_LIBS) |
| 94 | |
Vadim Yanitskiy | 35c45f2 | 2018-02-11 20:59:16 +0700 | [diff] [blame] | 95 | # Conditional codec tests |
| 96 | AC_SUBST(ENABLE_AMR_EFR_TESTS, [$found_opencore_amrnb]) |
| 97 | AC_SUBST(ENABLE_HR_TESTS, [$enable_gsmhr]) |
| 98 | AC_SUBST(ENABLE_FR_TESTS, [$found_libgsm]) |
| 99 | |
Sylvain Munaut | 96b1c3b | 2010-10-24 10:22:06 +0200 | [diff] [blame] | 100 | # Checks for header files. |
| 101 | AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h]) |
| 102 | |
| 103 | # Checks for typedefs, structures, and compiler characteristics. |
| 104 | AC_C_INLINE |
| 105 | AC_TYPE_INT16_T |
| 106 | AC_TYPE_INT32_T |
| 107 | AC_TYPE_UINT16_T |
| 108 | AC_TYPE_UINT32_T |
| 109 | AC_TYPE_UINT64_T |
| 110 | AC_TYPE_UINT8_T |
| 111 | |
| 112 | # Checks for library functions. |
| 113 | AC_FUNC_MALLOC |
| 114 | AC_CHECK_FUNCS([memset]) |
| 115 | |
Vadim Yanitskiy | 1a15bb6 | 2022-08-04 20:07:23 +0700 | [diff] [blame] | 116 | AC_CONFIG_FILES([contrib/gapk.spec |
| 117 | Makefile |
| 118 | src/Makefile |
| 119 | libgsmhr/Makefile |
| 120 | include/Makefile |
| 121 | include/gsmhr/Makefile |
| 122 | libosmogapk.pc |
| 123 | tests/atlocal |
| 124 | tests/Makefile]) |
| 125 | AC_OUTPUT |