summaryrefslogtreecommitdiff
path: root/gl/m4/stdalign.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/stdalign.m4')
-rw-r--r--gl/m4/stdalign.m423
1 files changed, 19 insertions, 4 deletions
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4
index da64dc6332..9752ba568b 100644
--- a/gl/m4/stdalign.m4
+++ b/gl/m4/stdalign.m4
@@ -1,6 +1,6 @@
-# Check for stdalign.h that conforms to C1x.
+# Check for stdalign.h that conforms to C11.
-dnl Copyright 2011 Free Software Foundation, Inc.
+dnl Copyright 2011-2012 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.
@@ -9,9 +9,24 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_STDALIGN_H],
[
- AC_CHECK_HEADERS_ONCE([stdalign.h])
+ AC_CACHE_CHECK([for working stdalign.h],
+ [gl_cv_header_working_stdalign_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdalign.h>
+ int align_int = alignof (int) + _Alignof (double);
- if test $ac_cv_header_stdalign_h = yes; then
+ /* Test _Alignas only on platforms where gnulib can help. */
+ #if \
+ (__GNUC__ || __IBMC__ || __IBMCPP__ \
+ || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
+ int alignas (8) alignas_int = 1;
+ #endif
+ ]])],
+ [gl_cv_header_working_stdalign_h=yes],
+ [gl_cv_header_working_stdalign_h=no])])
+
+ if test $gl_cv_header_working_stdalign_h = yes; then
STDALIGN_H=''
else
STDALIGN_H='stdalign.h'