From 6368ed542150956ff4ba8170a15bbc534143675c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 21 Nov 2012 11:47:35 +0100 Subject: Use configure test for aligned attribute. * configure.ac (HAVE_GCC_ATTRIBUTE_ALIGNED): New test and ac_define. * cipher/cipher-internal.h, cipher/rijndael.c, random/rndhw.c: Use new macro instead of a fixed test for __GNUC__. -- We assume that compilers that grok "__attribute__ ((aligned (16)))" implement that in the same way as gcc does. In case it turns out that this is not the case we will need to do two more things: Detect such different behaviour and come up with a construct to allows the use of that other style of alignment forcing. --- configure.ac | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 0e99ca5b..a2235a8a 100644 --- a/configure.ac +++ b/configure.ac @@ -789,6 +789,21 @@ if test "$gcry_cv_visibility_attribute" = "yes" \ fi +# +# Check whether the compiler supports the GCC style aligned attribute +# +AC_CACHE_CHECK([whether the GCC style aligned attribute is supported], + [gcry_cv_gcc_attribute_aligned], + [gcry_cv_gcc_attribute_aligned=no + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [[struct { int a; } foo __attribute__ ((aligned (16)));]])], + [gcry_cv_gcc_attribute_aligned=yes])]) +if test "$gcry_cv_gcc_attribute_aligned" = "yes" ; then + AC_DEFINE(HAVE_GCC_ATTRIBUTE_ALIGNED,1, + [Defined if a GCC style "__attribute__ ((aligned (n))" is supported]) +fi + + ####################################### #### Checks for library functions. #### ####################################### @@ -1286,6 +1301,15 @@ cat <