From 9eb887af478eb7615cfbb1f43055e5c1b73ee9ef Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 12 May 2015 00:36:45 -0500 Subject: [PATCH] fix clang build on wheezy and other platforms that have aligned_alloc in libc but not in headers --- libs/spandsp/configure.ac | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac index 412caa203f..43265fb2a2 100644 --- a/libs/spandsp/configure.ac +++ b/libs/spandsp/configure.ac @@ -37,6 +37,27 @@ m4_include(m4/ax_c99_features.m4) m4_include(m4/ax_check_export_capability.m4) m4_include(m4/ax_check_arm_neon.m4) +AC_DEFUN([AC_FUNC_ALIGNED_ALLOC],[ +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Werror" + AC_CACHE_CHECK([checking for aligned_alloc], + [ac_cv_func_aligned_alloc], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #define _ISOC11_SOURCE + #include + ], + [ + aligned_alloc(0,0); + ])], + [ac_cv_func_aligned_alloc=yes], + [ac_cv_func_aligned_alloc=no])]) + + if test "x${ac_cv_func_aligned_alloc}" = "xyes" ; then + AC_DEFINE([HAVE_ALIGNED_ALLOC], [1], [Define to 1 if you have the aligned_alloc() function.]) + fi +CFLAGS="$saved_CFLAGS" +]) + AC_CONFIG_SRCDIR([src/tone_generate.c]) AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([m4]) @@ -174,7 +195,7 @@ fi AX_C99_FLEXIBLE_ARRAY -AC_CHECK_FUNCS([aligned_alloc]) +AC_FUNC_ALIGNED_ALLOC AC_CHECK_FUNCS([memalign]) AC_CHECK_FUNCS([posix_memalign]) AC_CHECK_FUNCS([memmove])