stdalign.m4 1.2 KB

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