diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-14 17:25:54 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-14 17:25:54 +0200 |
commit | d8728d7219ceb91d9bddda4064d91f83558b44b7 (patch) | |
tree | bc1b79f3aab723efd25bd4afd8551242775d7daa /m4 | |
parent | b10d5cccee5d2945b1924a732a9b7d9d79d91b0b (diff) | |
download | xine-lib-d8728d7219ceb91d9bddda4064d91f83558b44b7.tar.gz xine-lib-d8728d7219ceb91d9bddda4064d91f83558b44b7.tar.bz2 |
Check for __malloc__ attribute during configure stage, avoid conditional in xineutils.h for it, instead use XINE_MALLOC.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/attributes.m4 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/m4/attributes.m4 b/m4/attributes.m4 index c46715d0e..23b5f2ee4 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -342,3 +342,23 @@ AC_DEFUN([CC_ATTRIBUTE_PACKED], [ ifelse([$2], , [:], [$2]) fi ]) + +AC_DEFUN([CC_ATTRIBUTE_MALLOC], [ + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([if $CC supports __attribute__((__malloc__))], + [cc_cv_attribute_malloc], + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_COMPILE_IFELSE([void *fooalloc(int size) __attribute__((__malloc__));], + [cc_cv_attribute_malloc=yes], + [cc_cv_attribute_malloc=no]) + CFLAGS="$ac_save_CFLAGS" + ]) + + if test x$cc_cv_attribute_malloc = xyes; then + AC_DEFINE([SUPPORT_ATTRIBUTE_MALLOC], 1, [Define this if the compiler supports __attribute__((__malloc__))]) + ifelse([$1], , [:], [$1]) + else + ifelse([$2], , [:], [$2]) + fi +]) |