summaryrefslogtreecommitdiff
path: root/m4/stdalign.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-10-16 16:56:59 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-10-27 13:05:41 -0700
commit6dc2ffa573d23caeeb62c4ba3b9a630a1261e35d (patch)
treeb2ab3e3ae38b6c75782d1617c71fae4b7609f950 /m4/stdalign.m4
parent3cab861e90cc830e108af9581884e26b3c45ce21 (diff)
downloadgnulib-6dc2ffa573d23caeeb62c4ba3b9a630a1261e35d.tar.gz
stdalign: new module
* doc/posix-headers/stdalign.texi, lib/stdalign.in.h, m4/stdalign.m4: * modules/stdalign: New files. * MODULES.html.sh (c1x_core_properties): Add stdalign. * doc/gnulib.texi (Header File Substitutes): Add stdalign.
Diffstat (limited to 'm4/stdalign.m4')
-rw-r--r--m4/stdalign.m437
1 files changed, 37 insertions, 0 deletions
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
new file mode 100644
index 0000000000..d90cee3756
--- /dev/null
+++ b/m4/stdalign.m4
@@ -0,0 +1,37 @@
+# Check for stdalign.h that conforms to C1x.
+
+dnl Copyright 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Prepare for substituting <stdalign.h> if it is not supported.
+
+AC_DEFUN([gl_STDALIGN_H],
+[
+ AC_CHECK_HEADERS_ONCE([stdalign.h])
+ HAVE_ATTRIBUTE_ALIGNED='?'
+
+ if test "$ac_cv_header_stdalign_h" = yes; then
+ STDALIGN_H=''
+ else
+ STDALIGN_H='stdalign.h'
+ AC_CACHE_CHECK([for __attribute__ ((__aligned__ (expr)))],
+ [gl_cv_attribute_aligned],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[char __attribute__ ((__aligned__ (1 << 3))) c;]],
+ [[]])],
+ [gl_cv_attribute_aligned=yes],
+ [gl_cv_attribute_aligned=no])])
+ if test $gl_cv_attribute_aligned = yes; then
+ HAVE_ATTRIBUTE_ALIGNED=1
+ else
+ HAVE_ATTRIBUTE_ALIGNED=0
+ fi
+ fi
+
+ AC_SUBST([HAVE_ATTRIBUTE_ALIGNED])
+ AC_SUBST([STDALIGN_H])
+ AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"])
+])