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