summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2007-04-14 17:19:44 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2007-04-14 17:19:44 +0100
commit2339bb34dc3fcc155a04abda51df9fa00732df93 (patch)
tree1832d05244d55417fb3505263af74c238ec3c2a2 /m4
parent1860c0e221f617406df80b0d35d22462dbcb9055 (diff)
parentdc36f8d045cf4f723c44766f44c92e1810e37f4f (diff)
downloadxine-lib-2339bb34dc3fcc155a04abda51df9fa00732df93.tar.gz
xine-lib-2339bb34dc3fcc155a04abda51df9fa00732df93.tar.bz2
Merge changes.
Diffstat (limited to 'm4')
-rw-r--r--m4/attributes.m420
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
+])