diff options
author | Werner Koch <wk@gnupg.org> | 2012-11-21 11:47:35 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2012-11-21 11:47:35 +0100 |
commit | 6368ed542150956ff4ba8170a15bbc534143675c (patch) | |
tree | 2388176fc6735fbdd1a8c2f0dae01fabe8047c43 /configure.ac | |
parent | a96974de734beb51a733a89b3283bcf7b433b54c (diff) | |
download | libgcrypt-6368ed542150956ff4ba8170a15bbc534143675c.tar.gz |
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.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 24 |
1 files changed, 24 insertions, 0 deletions
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 <<G10EOF G10EOF fi +if test "$gcry_cv_gcc_attribute_aligned" != "yes" ; then +cat <<G10EOF + + Please not that your compiler does not support the GCC style + aligned attribute. Using this software may evoke bus errors. + +G10EOF +fi + if test -n "$gpl"; then echo "Please note that you are building a version of Libgcrypt with" echo " $gpl" |