summaryrefslogtreecommitdiff
path: root/m4/extensions.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-02-08 15:37:17 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2013-02-08 15:37:17 -0800
commit8376d87efcbfa648b297c5b03b93e5c02386887d (patch)
tree1ceabd5ebd8843023616625f85639b52c5ac1039 /m4/extensions.m4
parente70e5000f0a6a945b7aad4cccea5bdfdb43a80f5 (diff)
downloademacs-8376d87efcbfa648b297c5b03b93e5c02386887d.tar.gz
Merge from gnulib.
Diffstat (limited to 'm4/extensions.m4')
-rw-r--r--m4/extensions.m447
1 files changed, 31 insertions, 16 deletions
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index 617323b244c..07ba376c0e7 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 12 -*- Autoconf -*-
+# serial 13 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
# Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc.
@@ -8,7 +8,7 @@
# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
# Autoconf. Perhaps we can remove this once we can assume Autoconf
-# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
+# 2.70 or later everywhere, but since Autoconf mutates rapidly
# enough in this area it's likely we'll need to redefine
# AC_USE_SYSTEM_EXTENSIONS for quite some time.
@@ -30,6 +30,7 @@
# ------------------------
# Enable extensions on systems that normally disable them,
# typically due to standards-conformance issues.
+#
# Remember that #undef in AH_VERBATIM gets replaced with #define by
# AC_DEFINE. The goal here is to define all known feature-enabling
# macros, then, if reports of conflicts are made, disable macros that
@@ -38,8 +39,6 @@ AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
- AC_REQUIRE([AC_CANONICAL_HOST])
-
AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
if test "$MINIX" = yes; then
AC_DEFINE([_POSIX_SOURCE], [1],
@@ -50,24 +49,18 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
except with this defined.])
AC_DEFINE([_MINIX], [1],
[Define to 1 if on MINIX.])
+ AC_DEFINE([_NETBSD_SOURCE], [1],
+ [Define to 1 to make NetBSD features available. MINIX 3 needs this.])
fi
- dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
- dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already
- dnl provided.
- case "$host_os" in
- hpux*)
- AC_DEFINE([_XOPEN_SOURCE], [500],
- [Define to 500 only on HP-UX.])
- ;;
- esac
-
- AH_VERBATIM([__EXTENSIONS__],
+dnl Use a different key than __EXTENSIONS__, as that name broke existing
+dnl configure.ac when using autoheader 2.62.
+ AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
[/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
-/* Enable general extensions on Mac OS X. */
+/* Enable general extensions on OS X. */
#ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE
#endif
@@ -83,6 +76,12 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
+/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
+ mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
+ whether compiling with -Ae or -D_HPUX_SOURCE=1. */
+#ifndef _XOPEN_SOURCE
+# undef _XOPEN_SOURCE
+#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
@@ -103,6 +102,22 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
AC_DEFINE([_GNU_SOURCE])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
AC_DEFINE([_TANDEM_SOURCE])
+ AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
+ [ac_cv_should_define__xopen_source],
+ [ac_cv_should_define__xopen_source=no
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #include <wchar.h>
+ mbstate_t x;]])],
+ [],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #define _XOPEN_SOURCE 500
+ #include <wchar.h>
+ mbstate_t x;]])],
+ [ac_cv_should_define__xopen_source=yes])])])
+ test $ac_cv_should_define__xopen_source = yes &&
+ AC_DEFINE([_XOPEN_SOURCE], [500])
])# AC_USE_SYSTEM_EXTENSIONS
# gl_USE_SYSTEM_EXTENSIONS