extensions.m4 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # serial 6 -*- Autoconf -*-
  2. # Enable extensions on systems that normally disable them.
  3. # Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc.
  4. # This file is free software; the Free Software Foundation
  5. # gives unlimited permission to copy and/or distribute it,
  6. # with or without modifications, as long as this notice is preserved.
  7. # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
  8. # Autoconf. Perhaps we can remove this once we can assume Autoconf
  9. # 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
  10. # enough in this area it's likely we'll need to redefine
  11. # AC_USE_SYSTEM_EXTENSIONS for quite some time.
  12. # AC_USE_SYSTEM_EXTENSIONS
  13. # ------------------------
  14. # Enable extensions on systems that normally disable them,
  15. # typically due to standards-conformance issues.
  16. # Remember that #undef in AH_VERBATIM gets replaced with #define by
  17. # AC_DEFINE. The goal here is to define all known feature-enabling
  18. # macros, then, if reports of conflicts are made, disable macros that
  19. # cause problems on some platforms (such as __EXTENSIONS__).
  20. AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
  21. [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
  22. AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
  23. AC_REQUIRE([AC_CANONICAL_HOST])
  24. AC_CHECK_HEADER([minix/gear_config.h], [MINIX=yes], [MINIX=])
  25. if test "$MINIX" = yes; then
  26. AC_DEFINE([_POSIX_SOURCE], [1],
  27. [Define to 1 if you need to in order for `stat' and other
  28. things to work.])
  29. AC_DEFINE([_POSIX_1_SOURCE], [2],
  30. [Define to 2 if the system does not provide POSIX.1 features
  31. except with this defined.])
  32. AC_DEFINE([_MINIX], [1],
  33. [Define to 1 if on MINIX.])
  34. fi
  35. dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
  36. dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already
  37. dnl provided.
  38. case "$host_os" in
  39. hpux*)
  40. AC_DEFINE([_XOPEN_SOURCE], [500],
  41. [Define to 500 only on HP-UX.])
  42. ;;
  43. esac
  44. AH_VERBATIM([__EXTENSIONS__],
  45. [/* Enable extensions on AIX 3, Interix. */
  46. #ifndef _ALL_SOURCE
  47. # undef _ALL_SOURCE
  48. #endif
  49. /* Enable GNU extensions on systems that have them. */
  50. #ifndef _GNU_SOURCE
  51. # undef _GNU_SOURCE
  52. #endif
  53. /* Enable threading extensions on Solaris. */
  54. #ifndef _POSIX_PTHREAD_SEMANTICS
  55. # undef _POSIX_PTHREAD_SEMANTICS
  56. #endif
  57. /* Enable extensions on HP NonStop. */
  58. #ifndef _TANDEM_SOURCE
  59. # undef _TANDEM_SOURCE
  60. #endif
  61. /* Enable general extensions on Solaris. */
  62. #ifndef __EXTENSIONS__
  63. # undef __EXTENSIONS__
  64. #endif
  65. ])
  66. AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
  67. [ac_cv_safe_to_define___extensions__],
  68. [AC_COMPILE_IFELSE(
  69. [AC_LANG_PROGRAM([[
  70. # define __EXTENSIONS__ 1
  71. ]AC_INCLUDES_DEFAULT])],
  72. [ac_cv_safe_to_define___extensions__=yes],
  73. [ac_cv_safe_to_define___extensions__=no])])
  74. test $ac_cv_safe_to_define___extensions__ = yes &&
  75. AC_DEFINE([__EXTENSIONS__])
  76. AC_DEFINE([_ALL_SOURCE])
  77. AC_DEFINE([_GNU_SOURCE])
  78. AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
  79. AC_DEFINE([_TANDEM_SOURCE])
  80. ])# AC_USE_SYSTEM_EXTENSIONS
  81. # gl_USE_SYSTEM_EXTENSIONS
  82. # ------------------------
  83. # Enable extensions on systems that normally disable them,
  84. # typically due to standards-conformance issues.
  85. AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
  86. [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])