stddef_h.m4 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
  2. # stddef_h.m4 serial 2
  3. dnl Copyright (C) 2009, 2010 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. if test $gt_cv_c_wchar_t = no; then
  12. HAVE_WCHAR_T=0
  13. STDDEF_H=stddef.h
  14. fi
  15. AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
  16. [gl_cv_decl_null_works],
  17. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
  18. int test[2 * (sizeof NULL == sizeof (void *)) -1];
  19. ]])],
  20. [gl_cv_decl_null_works=yes],
  21. [gl_cv_decl_null_works=no])])
  22. if test $gl_cv_decl_null_works = no; then
  23. REPLACE_NULL=1
  24. STDDEF_H=stddef.h
  25. fi
  26. if test -n "$STDDEF_H"; then
  27. gl_CHECK_NEXT_HEADERS([stddef.h])
  28. fi
  29. ])
  30. AC_DEFUN([gl_STDDEF_MODULE_INDICATOR],
  31. [
  32. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  33. AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
  34. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  35. ])
  36. AC_DEFUN([gl_STDDEF_H_DEFAULTS],
  37. [
  38. dnl Assume proper GNU behavior unless another module says otherwise.
  39. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
  40. HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
  41. STDDEF_H=''; AC_SUBST([STDDEF_H])
  42. ])