diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-03-20 00:30:55 +0000 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-03-20 00:30:55 +0000 |
commit | e87c7e045dd5a8fe64a6f70d3195b174513deed2 (patch) | |
tree | 52fae196f51950dc566c6f1ba0ce61b5e3d8d7ad /m4 | |
parent | 3ca4981e58cb1c95e9959c1d49bf96aee294b5f7 (diff) | |
download | xine-lib-e87c7e045dd5a8fe64a6f70d3195b174513deed2.tar.gz xine-lib-e87c7e045dd5a8fe64a6f70d3195b174513deed2.tar.bz2 |
The AC_C_ATTRIBUTE_ALIGNED macro is broken, it always reports maximum aligned available as 64 even on Darwin where the maximum is 16, as it does not use -Werror, and the wrong alignment is considered only a warning. Rewrite it as CC_ATTRIBUTE_ALIGNED (in attributes.m4, where other similar macros are located). Also reverse the order of the checks, so that the highest version is tried first; this way you can avoid five compile tests on systems where 64 is the highest alignment available.
CVS patchset: 8726
CVS date: 2007/03/20 00:30:55
Diffstat (limited to 'm4')
-rw-r--r-- | m4/_xine.m4 | 18 | ||||
-rw-r--r-- | m4/attributes.m4 | 22 |
2 files changed, 22 insertions, 18 deletions
diff --git a/m4/_xine.m4 b/m4/_xine.m4 index 8ff2d67ca..630758298 100644 --- a/m4/_xine.m4 +++ b/m4/_xine.m4 @@ -142,24 +142,6 @@ AC_DEFUN([AC_CHECK_DXR3], fi ]) - -dnl AC_C_ATTRIBUTE_ALIGNED -dnl define ATTRIBUTE_ALIGNED_MAX to the maximum alignment if this is supported -AC_DEFUN([AC_C_ATTRIBUTE_ALIGNED], - [AC_CACHE_CHECK([__attribute__ ((aligned ())) support], - [ac_cv_c_attribute_aligned], - [ac_cv_c_attribute_aligned=0 - for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do - AC_TRY_COMPILE([], - [static char c __attribute__ ((aligned($ac_cv_c_attr_align_try))) = 0 -; return c;], - [ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try]) - done]) - if test x"$ac_cv_c_attribute_aligned" != x"0"; then - AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], - [$ac_cv_c_attribute_aligned],[maximum supported data alignment]) - fi]) - dnl AC_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS]) dnl check if $CC supports a given set of cflags AC_DEFUN([AC_TRY_CFLAGS], diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 28e2e5839..2d52cebc4 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -305,3 +305,25 @@ AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ $2 fi ]) + +AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported], + [cc_cv_attribute_aligned], + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + for cc_attribute_align_try in 64 32 16 8 4 2; do + AC_COMPILE_IFELSE([ + int main() { + static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0; + return c; + }], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) + done + CFLAGS="$ac_save_CFLAGS" + ]) + + if test "x$cc_cv_attribute_aligned" != "x"; then + AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned], + [Define the highest alignment supported]) + fi +]) |