[csw-devel] [PATCH] Test for posix_memalign in ./configure

Maciej Blizinski maciej at opencsw.org
Tue Feb 28 10:45:07 CET 2012


---
 configure.ac         |    5 +++++
 include/vlc_common.h |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6d2562c..b5e8473 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1056,6 +1056,11 @@ dnl Check for backtrace() support
 AC_CHECK_HEADERS(execinfo.h)
 AC_CHECK_FUNCS(backtrace)
 
+dnl Check for posix_memalign() support
+AC_CHECK_FUNCS(posix_memalign, [
+  AC_DEFINE(HAVE_POSIX_MEMALIGN, 1,
+            [Define to 1 if you have the posix_memalign() function.])])
+
 dnl
 dnl  default modules
 dnl
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 545b1cd..707ecc7 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -904,7 +904,7 @@ static void vlc_free(void *ptr)
     if (ptr)
         free((char*)ptr - ((char*)ptr)[-1]);
 }
-#elif defined(__ANDROID__)
+#elif !defined(HAVE_POSIX_MEMALIGN) || defined(__ANDROID__)
 # define vlc_memalign(align, size) memalign(align, size)
 # define vlc_free(base) free(base)
 #else
-- 
1.7.9



More information about the devel mailing list