extensions.m4 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # serial 5 -*- Autoconf -*-
  2. # Enable extensions on systems that normally disable them.
  3. # Copyright (C) 2003, 2006, 2007 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_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
  24. if test "$MINIX" = yes; then
  25. AC_DEFINE([_POSIX_SOURCE], [1],
  26. [Define to 1 if you need to in order for `stat' and other
  27. things to work.])
  28. AC_DEFINE([_POSIX_1_SOURCE], [2],
  29. [Define to 2 if the system does not provide POSIX.1 features
  30. except with this defined.])
  31. AC_DEFINE([_MINIX], [1],
  32. [Define to 1 if on MINIX.])
  33. fi
  34. AH_VERBATIM([__EXTENSIONS__],
  35. [/* Enable extensions on AIX 3, Interix. */
  36. #ifndef _ALL_SOURCE
  37. # undef _ALL_SOURCE
  38. #endif
  39. /* Enable GNU extensions on systems that have them. */
  40. #ifndef _GNU_SOURCE
  41. # undef _GNU_SOURCE
  42. #endif
  43. /* Enable threading extensions on Solaris. */
  44. #ifndef _POSIX_PTHREAD_SEMANTICS
  45. # undef _POSIX_PTHREAD_SEMANTICS
  46. #endif
  47. /* Enable extensions on HP NonStop. */
  48. #ifndef _TANDEM_SOURCE
  49. # undef _TANDEM_SOURCE
  50. #endif
  51. /* Enable general extensions on Solaris. */
  52. #ifndef __EXTENSIONS__
  53. # undef __EXTENSIONS__
  54. #endif
  55. ])
  56. AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
  57. [ac_cv_safe_to_define___extensions__],
  58. [AC_COMPILE_IFELSE(
  59. [AC_LANG_PROGRAM([
  60. # define __EXTENSIONS__ 1
  61. AC_INCLUDES_DEFAULT])],
  62. [ac_cv_safe_to_define___extensions__=yes],
  63. [ac_cv_safe_to_define___extensions__=no])])
  64. test $ac_cv_safe_to_define___extensions__ = yes &&
  65. AC_DEFINE([__EXTENSIONS__])
  66. AC_DEFINE([_ALL_SOURCE])
  67. AC_DEFINE([_GNU_SOURCE])
  68. AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
  69. AC_DEFINE([_TANDEM_SOURCE])
  70. ])# AC_USE_SYSTEM_EXTENSIONS
  71. # gl_USE_SYSTEM_EXTENSIONS
  72. # ------------------------
  73. # Enable extensions on systems that normally disable them,
  74. # typically due to standards-conformance issues.
  75. AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
  76. [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])