Commit | Line | Data |
---|---|---|
f0007cad | 1 | # Check for stdalign.h that conforms to C11. |
7f1ea859 | 2 | |
f0007cad | 3 | dnl Copyright 2011-2012 Free Software Foundation, Inc. |
7f1ea859 LC |
4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | |
6 | dnl with or without modifications, as long as this notice is preserved. | |
7 | ||
8 | # Prepare for substituting <stdalign.h> if it is not supported. | |
9 | ||
10 | AC_DEFUN([gl_STDALIGN_H], | |
11 | [ | |
12 | AC_CACHE_CHECK([for working stdalign.h], | |
13 | [gl_cv_header_working_stdalign_h], | |
14 | [AC_COMPILE_IFELSE( | |
15 | [AC_LANG_PROGRAM( | |
16 | [[#include <stdalign.h> | |
17 | int align_int = alignof (int) + _Alignof (double); | |
18 | ||
19 | /* Test _Alignas only on platforms where gnulib can help. */ | |
20 | #if \ | |
21 | (__GNUC__ || __IBMC__ || __IBMCPP__ \ | |
22 | || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER) | |
23 | int alignas (8) alignas_int = 1; | |
24 | #endif | |
25 | ]])], | |
26 | [gl_cv_header_working_stdalign_h=yes], | |
27 | [gl_cv_header_working_stdalign_h=no])]) | |
28 | ||
29 | if test $gl_cv_header_working_stdalign_h = yes; then | |
30 | STDALIGN_H='' | |
31 | else | |
32 | STDALIGN_H='stdalign.h' | |
33 | fi | |
34 | ||
35 | AC_SUBST([STDALIGN_H]) | |
36 | AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"]) | |
37 | ]) |