+2007-09-11 Eric Blake <ebb9@byu.net>
+
+ Centralize all system extensions checks.
+ * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Inline code
+ from AC_AIX, AC_GNU_SOURCE, AC_MINIX. Add Interix support.
+ (AC_AIX, AC_GNU_SOURCE, AC_MINIX): Obsolete, and point to
+ AC_USE_SYSTEM_EXTENSIONS.
+ (AC_ISC_POSIX): Obsolete, and point to AC_SEARCH_LIBS.
+ (AC_XENIX_DIR, AC_IRIX_SUN): Promote proper quoting in AU_DEFUN.
+ * doc/autoconf.texi (Posix Variants): Reword this section,
+ emphasizing that AC_USE_SYSTEM_EXTENSIONS is the preferred method,
+ rather than a series of system-specific checks.
+ (Obsolete Macros): Add AC_AIX, AC_GNU_SOURCE, AC_ISC_POSIX,
+ AC_MINIX.
+ * NEWS: Document this change.
+ * THANKS: Update.
+ Reported by Martin Koeppe.
+
2007-09-08 Eric Blake <ebb9@byu.net>
Clean up obsolete macros references.
** AC_INIT no longer alters $@; regression introduced in 2.60.
+** AC_USE_SYSTEM_EXTENSIONS now defines _ALL_SOURCE for Interix platforms.
+
** The command 'autoconf -' now correctly processes a file from stdin.
** Autotest now determines $srcdir correctly.
** For portability with the eventual M4 2.0, macros should no longer use
anything larger than $9 to refer to arguments.
-** Obsolete macros
+** Existing obsolete macros
The documentation for the following macros is adjusted to make it
more clear that they have previously been marked obsolete, as their
functionality can be accomplished by other macros. We have no
AC_ENABLE AC_STRUCT_ST_BLKSIZE AC_STRUCT_ST_RDEV AC_WITH
+** Newly obsolete macros
+ The following macros have been marked obsolete, as they only
+ perform a subset of AC_USE_SYSTEM_EXTENSIONS. We have no current
+ plans to remove them.
+
+ AC_AIX AC_GNU_SOURCE AC_ISC_POSIX AC_MINIX
+
** AC_C_LONG_DOUBLE is obsolescent.
The documentation now says that AC_C_LONG_DOUBLE is obsolescent: it
tests for problems that are so old that it is no longer of
Markus Oberhumer markus.oberhumer@jk.uni-linz.ac.at
Martin Buchholz martin@xemacs.org
Martin Frydl martin@systinet.com
+Martin Koeppe mkoeppe@gmx.de
Martin Mokrejs mmokrejs@natur.cuni.cz
Martin Wilck martin@tropos.de
Martyn Johnson Martyn.Johnson@cl.cam.ac.uk
[nsl])} instead of @code{AC_CHECK_LIB([nsl], [gethostbyname])}.
@end defmac
-
+@anchor{AC_SEARCH_LIBS}
@defmac AC_SEARCH_LIBS (@var{function}, @var{search-libs}, @
@ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{other-libraries})
@acindex{SEARCH_LIBS}
@node Posix Variants
@section Posix Variants
-The following macros check for certain operating systems that need
-special treatment for some programs, due to exceptional oddities in
-their header files or libraries. These macros are warts; they will be
-replaced by a more systematic approach, based on the functions they make
-available or the environments they provide.
-
-@defmac AC_AIX
-@acindex{AIX}
-@cvindex _ALL_SOURCE
-If on @acronym{AIX}, define @code{_ALL_SOURCE}.
-Allows the use of some @acronym{BSD}
-functions. Should be called before any macros that run the C compiler.
-@end defmac
-
-@defmac AC_GNU_SOURCE
-@acindex{GNU_SOURCE}
-@cvindex _GNU_SOURCE
-If using the @acronym{GNU} C library, define @code{_GNU_SOURCE}.
-Allows the use of some @acronym{GNU} functions. Should be called
-before any macros that run the C compiler.
-@end defmac
-
-@defmac AC_ISC_POSIX
-@acindex{ISC_POSIX}
-@ovindex LIBS
-For @sc{interactive} Systems Corporation Unix, add @option{-lcposix} to output
-variable @code{LIBS} if necessary for Posix facilities. Call this
-after @code{AC_PROG_CC} and before any other macros that use Posix
-interfaces.
-
-This macro is obsolescent, as @sc{interactive} Unix is obsolete, and Sun
-dropped support for it on 2006-07-23. New programs need not use this
-macro.
-@end defmac
-
-@defmac AC_MINIX
-@acindex{MINIX}
-@cvindex _MINIX
-@cvindex _POSIX_SOURCE
-@cvindex _POSIX_1_SOURCE
-If on Minix, define @code{_MINIX} and @code{_POSIX_SOURCE} and define
-@code{_POSIX_1_SOURCE} to be 2. This allows the use of Posix
-facilities. Should be called before any macros that run the C compiler.
-@end defmac
+The following macro makes it possible to use features of Posix that are
+extensions to C, as well as platform extensions not defined by Posix.
+@anchor{AC_USE_SYSTEM_EXTENSIONS}
@defmac AC_USE_SYSTEM_EXTENSIONS
@acindex{USE_SYSTEM_EXTENSIONS}
@cvindex _ALL_SOURCE
@cvindex _POSIX_SOURCE
@cvindex _TANDEM_SOURCE
@cvindex __EXTENSIONS__
-If possible, enable extensions to Posix on hosts that normally disable
-the extensions, typically due to standards-conformance namespace issues.
-This may involve defining @code{__EXTENSIONS__} and
-@code{_POSIX_PTHREAD_SEMANTICS}, which are macros used by Solaris.
-It also defines @code{_TANDEM_SOURCE} for the @acronym{HP} NonStop platform.
-This macro also has the combined effects of @code{AC_GNU_SOURCE},
-@code{AC_AIX}, and @code{AC_MINIX}.
+This macro was introduced in Autoconf 2.60. If possible, enable
+extensions to C or Posix on hosts that normally disable the extensions,
+typically due to standards-conformance namespace issues. This should be
+called before any macros that run the C compiler. The following
+preprocessor macros are defined where appropriate:
+
+@table @code
+@item _GNU_SOURCE
+Enable extensions on @acronym{GNU}/Linux.
+@item __EXTENSIONS__
+Enable general extensions on Solaris.
+@item _POSIX_PTHREAD_SEMANTICS
+Enable threading extensions on Solaris.
+@item _TANDEM_SOURCE
+Enable extensions for the @acronym{HP} NonStop platform.
+@item _ALL_SOURCE
+Enable extensions for @acronym{AIX} 3, and for Interix.
+@item _POSIX_SOURCE
+Enable Posix functions for Minix.
+@item _POSIX_1_SOURCE
+Enable additional Posix functions for Minix.
+@item _MINIX
+Identify Minix platform. This particular preprocessor macro is
+obsolescent, and may be removed in a future release of Autoconf.
+@end table
@end defmac
refer to the definition of the new macro for the signature and the
description.
+@defmac AC_AIX
+@acindex{AIX}
+@cvindex _ALL_SOURCE
+This macro is a platform-specific subset of
+@code{AC_USE_SYSTEM_EXTENSIONS} (@pxref{AC_USE_SYSTEM_EXTENSIONS}).
+@end defmac
+
@defmac AC_ALLOCA
@acindex{ALLOCA}
Replaced by @code{AC_FUNC_ALLOCA} (@pxref{AC_FUNC_ALLOCA}).
Replaced by @code{AC_FUNC_GETLOADAVG} (@pxref{AC_FUNC_GETLOADAVG}).
@end defmac
+@defmac AC_GNU_SOURCE
+@acindex{GNU_SOURCE}
+@cvindex _GNU_SOURCE
+This macro is a platform-specific subset of
+@code{AC_USE_SYSTEM_EXTENSIONS} (@pxref{AC_USE_SYSTEM_EXTENSIONS}).
+@end defmac
+
@defmac AC_HAVE_FUNCS
@acindex{HAVE_FUNCS}
Replaced by @code{AC_CHECK_FUNCS} (@pxref{AC_CHECK_FUNCS}).
See @ref{AC_FUNC_GETMNTENT} and @ref{AC_CHECK_LIB}.
@end defmac
+@defmac AC_ISC_POSIX
+@acindex{ISC_POSIX}
+@ovindex LIBS
+This macro adds @option{-lcposix} to output variable @code{LIBS} if
+necessary for Posix facilities. Sun dropped support for the obsolete
+@sc{interactive} Systems Corporation Unix on 2006-07-23. New programs
+need not use this macro. It is implemented as
+@code{AC_SEARCH_LIBS([strerror], [cposix])} (@pxref{AC_SEARCH_LIBS}).
+@end defmac
+
@defmac AC_LANG_C
@acindex{LANG_C}
Same as @samp{AC_LANG([C])} (@pxref{AC_LANG}).
@code{AC_CANONICAL_HOST} (@pxref{Canonicalizing}).
@end defmac
+@defmac AC_MINIX
+@acindex{MINIX}
+@cvindex _MINIX
+@cvindex _POSIX_SOURCE
+@cvindex _POSIX_1_SOURCE
+This macro is a platform-specific subset of
+@code{AC_USE_SYSTEM_EXTENSIONS} (@pxref{AC_USE_SYSTEM_EXTENSIONS}).
+@end defmac
+
@defmac AC_MINUS_C_MINUS_O
@acindex{MINUS_C_MINUS_O}
Replaced by @code{AC_PROG_CC_C_O} (@pxref{AC_PROG_CC_C_O}).
# Macros that test for specific, unclassified, features.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# AC_GNU_SOURCE
# --------------
-AC_DEFUN([AC_GNU_SOURCE],
-[AH_VERBATIM([_GNU_SOURCE],
-[/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif])dnl
-AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_DEFINE([_GNU_SOURCE])
-])
+AU_DEFUN([AC_GNU_SOURCE], [AC_USE_SYSTEM_EXTENSIONS])
# AC_CYGWIN
# ------------------------
# 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
+# cause problems on some platforms (such as __EXTENSIONS__).
AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-[
- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
- AC_BEFORE([$0], [AC_RUN_IFELSE])
+[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
- AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([AC_AIX])
- AC_REQUIRE([AC_MINIX])
+ AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
+ if test "$MINIX" = yes; then
+ AC_DEFINE([_POSIX_SOURCE], [1],
+ [Define to 1 if you need to in order for `stat' and other
+ things to work.])
+ AC_DEFINE([_POSIX_1_SOURCE], [2],
+ [Define to 2 if the system does not provide POSIX.1 features
+ except with this defined.])
+ AC_DEFINE([_MINIX], [1],
+ [Define to 1 if on MINIX.])
+ fi
AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
+[/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
+/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
-#endif])
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+])
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
[ac_cv_safe_to_define___extensions__],
[AC_COMPILE_IFELSE(
[ac_cv_safe_to_define___extensions__=no])])
test $ac_cv_safe_to_define___extensions__ = yes &&
AC_DEFINE([__EXTENSIONS__])
+ AC_DEFINE([_ALL_SOURCE])
+ AC_DEFINE([_GNU_SOURCE])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
AC_DEFINE([_TANDEM_SOURCE])
-])
-
+])# AC_USE_SYSTEM_EXTENSIONS
# AC_AIX
# ------
-AC_DEFUN([AC_AIX],
-[AH_VERBATIM([_ALL_SOURCE],
-[/* Define to 1 if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
-@%:@ifndef _ALL_SOURCE
-@%:@ undef _ALL_SOURCE
-@%:@endif])dnl
-AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_MSG_CHECKING([for AIX])
-AC_EGREP_CPP(yes,
-[#ifdef _AIX
- yes
-#endif
-],
-[AC_MSG_RESULT([yes])
-AC_DEFINE(_ALL_SOURCE)],
-[AC_MSG_RESULT([no])])
-])# AC_AIX
+AU_DEFUN([AC_AIX], [AC_USE_SYSTEM_EXTENSIONS])
# AC_MINIX
# --------
-AC_DEFUN([AC_MINIX],
-[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
-if test "$MINIX" = yes; then
- AC_DEFINE(_POSIX_SOURCE, 1,
- [Define to 1 if you need to in order for `stat' and other things to
- work.])
- AC_DEFINE(_POSIX_1_SOURCE, 2,
- [Define to 2 if the system does not provide POSIX.1 features except
- with this defined.])
- AC_DEFINE(_MINIX, 1,
- [Define to 1 if on MINIX.])
-fi
-])# AC_MINIX
+AU_DEFUN([AC_MINIX], [AC_USE_SYSTEM_EXTENSIONS])
# AC_ISC_POSIX
# ------------
-AC_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS(strerror, cposix)])
+AU_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS([strerror], [cposix])])
# AC_XENIX_DIR
# ------------
AU_DEFUN([AC_XENIX_DIR],
[AC_MSG_CHECKING([for Xenix])
-AC_EGREP_CPP(yes,
+AC_EGREP_CPP([yes],
[#if defined M_XENIX && ! defined M_UNIX
yes
@%:@endif],
# -----------
AU_DEFUN([AC_IRIX_SUN],
[AC_FUNC_GETMNTENT
-AC_CHECK_LIB(sun, getpwnam)])
+AC_CHECK_LIB([sun], [getpwnam])])
# AC_SCO_INTL