stddef_h.m4 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. dnl A placeholder for <stddef.h>, for platforms that have issues.
  2. # stddef_h.m4 serial 5
  3. dnl Copyright (C) 2009-2017 Free Software Foundation, Inc.
  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. AC_DEFUN([gl_STDDEF_H],
  8. [
  9. AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
  10. AC_REQUIRE([gt_TYPE_WCHAR_T])
  11. STDDEF_H=
  12. AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h],
  13. [[#include <stddef.h>
  14. ]])
  15. if test $gt_cv_c_wchar_t = no; then
  16. HAVE_WCHAR_T=0
  17. STDDEF_H=stddef.h
  18. fi
  19. AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
  20. [gl_cv_decl_null_works],
  21. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
  22. int test[2 * (sizeof NULL == sizeof (void *)) -1];
  23. ]])],
  24. [gl_cv_decl_null_works=yes],
  25. [gl_cv_decl_null_works=no])])
  26. if test $gl_cv_decl_null_works = no; then
  27. REPLACE_NULL=1
  28. STDDEF_H=stddef.h
  29. fi
  30. AC_SUBST([STDDEF_H])
  31. AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"])
  32. if test -n "$STDDEF_H"; then
  33. gl_NEXT_HEADERS([stddef.h])
  34. fi
  35. ])
  36. AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
  37. [
  38. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  39. AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
  40. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  41. ])
  42. AC_DEFUN([gl_STDDEF_H_DEFAULTS],
  43. [
  44. dnl Assume proper GNU behavior unless another module says otherwise.
  45. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
  46. HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T])
  47. HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
  48. ])