diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-10 13:13:59 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-04-10 13:13:59 +0200 |
commit | f0bb7ea04c1c860c96dcfdd0a837d9c3eb906100 (patch) | |
tree | 59387c5505866f34ce304c3895210d0727cf9f72 | |
parent | 1e61f032793a3460ad97b0e38b7a1ec58324999d (diff) | |
download | xine-lib-f0bb7ea04c1c860c96dcfdd0a837d9c3eb906100.tar.gz xine-lib-f0bb7ea04c1c860c96dcfdd0a837d9c3eb906100.tar.bz2 |
Add a new check for __attribute__((packed)), and if present, define XINE_PACKED.
This is the first step to sanitise the handling of PACKED attribute.
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | m4/attributes.m4 | 20 |
2 files changed, 25 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 75f8645df..9034b6352 100644 --- a/configure.ac +++ b/configure.ac @@ -2094,6 +2094,11 @@ dnl --------------------------------------------- CC_ATTRIBUTE_ALIGNED +CC_ATTRIBUTE_PACKED( + [AC_DEFINE([XINE_PACKED], [__attribute__((packed))], [Mark a structure as being packed])], + [AC_DEFINE([XINE_PACKED], [], [Dummy mark a structure as being packed])] +) + CC_ATTRIBUTE_VISIBILITY([protected], [visibility_export="protected"], [CC_ATTRIBUTE_VISIBILITY([default], [visibility_export="default"])] ) diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 55f34c9f7..c46715d0e 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -322,3 +322,23 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ [Define the highest alignment supported]) fi ]) + +AC_DEFUN([CC_ATTRIBUTE_PACKED], [ + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([if $CC supports __attribute__((packed))], + [cc_cv_attribute_packed], + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_COMPILE_IFELSE([struct { char a; short b; int c; } __attribute__((packed)) foo;], + [cc_cv_attribute_packed=yes], + [cc_cv_attribute_packed=no]) + CFLAGS="$ac_save_CFLAGS" + ]) + + if test x$cc_cv_attribute_packed = xyes; then + AC_DEFINE([SUPPORT_ATTRIBUTE_PACKED], 1, [Define this if the compiler supports __attribute__((packed))]) + ifelse([$1], , [:], [$1]) + else + ifelse([$2], , [:], [$2]) + fi +]) |