summaryrefslogtreecommitdiffstats
path: root/gl/m4/extensions.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/extensions.m4')
-rw-r--r--gl/m4/extensions.m456
1 files changed, 38 insertions, 18 deletions
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4
index 7d9458a..e30f122 100644
--- a/gl/m4/extensions.m4
+++ b/gl/m4/extensions.m4
@@ -1,14 +1,14 @@
1# serial 9 -*- Autoconf -*- 1# serial 13 -*- Autoconf -*-
2# Enable extensions on systems that normally disable them. 2# Enable extensions on systems that normally disable them.
3 3
4# Copyright (C) 2003, 2006-2010 Free Software Foundation, Inc. 4# Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation 5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it, 6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved. 7# with or without modifications, as long as this notice is preserved.
8 8
9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS 9# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
10# Autoconf. Perhaps we can remove this once we can assume Autoconf 10# Autoconf. Perhaps we can remove this once we can assume Autoconf
11# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly 11# 2.70 or later everywhere, but since Autoconf mutates rapidly
12# enough in this area it's likely we'll need to redefine 12# enough in this area it's likely we'll need to redefine
13# AC_USE_SYSTEM_EXTENSIONS for quite some time. 13# AC_USE_SYSTEM_EXTENSIONS for quite some time.
14 14
@@ -30,6 +30,7 @@
30# ------------------------ 30# ------------------------
31# Enable extensions on systems that normally disable them, 31# Enable extensions on systems that normally disable them,
32# typically due to standards-conformance issues. 32# typically due to standards-conformance issues.
33#
33# Remember that #undef in AH_VERBATIM gets replaced with #define by 34# Remember that #undef in AH_VERBATIM gets replaced with #define by
34# AC_DEFINE. The goal here is to define all known feature-enabling 35# AC_DEFINE. The goal here is to define all known feature-enabling
35# macros, then, if reports of conflicts are made, disable macros that 36# macros, then, if reports of conflicts are made, disable macros that
@@ -38,35 +39,31 @@ AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
38[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl 39[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
39AC_BEFORE([$0], [AC_RUN_IFELSE])dnl 40AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
40 41
41 AC_REQUIRE([AC_CANONICAL_HOST])
42
43 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) 42 AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
44 if test "$MINIX" = yes; then 43 if test "$MINIX" = yes; then
45 AC_DEFINE([_POSIX_SOURCE], [1], 44 AC_DEFINE([_POSIX_SOURCE], [1],
46 [Define to 1 if you need to in order for `stat' and other 45 [Define to 1 if you need to in order for 'stat' and other
47 things to work.]) 46 things to work.])
48 AC_DEFINE([_POSIX_1_SOURCE], [2], 47 AC_DEFINE([_POSIX_1_SOURCE], [2],
49 [Define to 2 if the system does not provide POSIX.1 features 48 [Define to 2 if the system does not provide POSIX.1 features
50 except with this defined.]) 49 except with this defined.])
51 AC_DEFINE([_MINIX], [1], 50 AC_DEFINE([_MINIX], [1],
52 [Define to 1 if on MINIX.]) 51 [Define to 1 if on MINIX.])
52 AC_DEFINE([_NETBSD_SOURCE], [1],
53 [Define to 1 to make NetBSD features available. MINIX 3 needs this.])
53 fi 54 fi
54 55
55 dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, 56dnl Use a different key than __EXTENSIONS__, as that name broke existing
56 dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already 57dnl configure.ac when using autoheader 2.62.
57 dnl provided. 58 AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
58 case "$host_os" in
59 hpux*)
60 AC_DEFINE([_XOPEN_SOURCE], [500],
61 [Define to 500 only on HP-UX.])
62 ;;
63 esac
64
65 AH_VERBATIM([__EXTENSIONS__],
66[/* Enable extensions on AIX 3, Interix. */ 59[/* Enable extensions on AIX 3, Interix. */
67#ifndef _ALL_SOURCE 60#ifndef _ALL_SOURCE
68# undef _ALL_SOURCE 61# undef _ALL_SOURCE
69#endif 62#endif
63/* Enable general extensions on OS X. */
64#ifndef _DARWIN_C_SOURCE
65# undef _DARWIN_C_SOURCE
66#endif
70/* Enable GNU extensions on systems that have them. */ 67/* Enable GNU extensions on systems that have them. */
71#ifndef _GNU_SOURCE 68#ifndef _GNU_SOURCE
72# undef _GNU_SOURCE 69# undef _GNU_SOURCE
@@ -79,6 +76,12 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
79#ifndef _TANDEM_SOURCE 76#ifndef _TANDEM_SOURCE
80# undef _TANDEM_SOURCE 77# undef _TANDEM_SOURCE
81#endif 78#endif
79/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
80 mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
81 whether compiling with -Ae or -D_HPUX_SOURCE=1. */
82#ifndef _XOPEN_SOURCE
83# undef _XOPEN_SOURCE
84#endif
82/* Enable general extensions on Solaris. */ 85/* Enable general extensions on Solaris. */
83#ifndef __EXTENSIONS__ 86#ifndef __EXTENSIONS__
84# undef __EXTENSIONS__ 87# undef __EXTENSIONS__
@@ -95,9 +98,26 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
95 test $ac_cv_safe_to_define___extensions__ = yes && 98 test $ac_cv_safe_to_define___extensions__ = yes &&
96 AC_DEFINE([__EXTENSIONS__]) 99 AC_DEFINE([__EXTENSIONS__])
97 AC_DEFINE([_ALL_SOURCE]) 100 AC_DEFINE([_ALL_SOURCE])
101 AC_DEFINE([_DARWIN_C_SOURCE])
98 AC_DEFINE([_GNU_SOURCE]) 102 AC_DEFINE([_GNU_SOURCE])
99 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 103 AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
100 AC_DEFINE([_TANDEM_SOURCE]) 104 AC_DEFINE([_TANDEM_SOURCE])
105 AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
106 [ac_cv_should_define__xopen_source],
107 [ac_cv_should_define__xopen_source=no
108 AC_COMPILE_IFELSE(
109 [AC_LANG_PROGRAM([[
110 #include <wchar.h>
111 mbstate_t x;]])],
112 [],
113 [AC_COMPILE_IFELSE(
114 [AC_LANG_PROGRAM([[
115 #define _XOPEN_SOURCE 500
116 #include <wchar.h>
117 mbstate_t x;]])],
118 [ac_cv_should_define__xopen_source=yes])])])
119 test $ac_cv_should_define__xopen_source = yes &&
120 AC_DEFINE([_XOPEN_SOURCE], [500])
101])# AC_USE_SYSTEM_EXTENSIONS 121])# AC_USE_SYSTEM_EXTENSIONS
102 122
103# gl_USE_SYSTEM_EXTENSIONS 123# gl_USE_SYSTEM_EXTENSIONS