changeset 14700:6758fa38915e topic/libposix

manual merge
author Bruce Korb <bkorb@gnu.org>
date Fri, 06 May 2011 08:15:59 -0700
parents 04ce36b456cc (current diff) 6b83b217fcdd (diff)
children
files ChangeLog gnulib-tool lib/close-hook.c lib/close-hook.h m4/afunix.m4 modules/alloca-opt modules/argz modules/arpa_inet modules/byteswap modules/close-hook modules/ctype modules/dirent modules/errno modules/exit modules/fcntl-h modules/float modules/fnmatch modules/getopt-posix modules/glob modules/iconv-h modules/iconv_open modules/inttypes modules/langinfo modules/locale modules/math modules/netdb modules/netinet_in modules/poll-h modules/pthread modules/pty modules/sched modules/search modules/selinux-h modules/signal modules/spawn modules/stdarg modules/stdbool modules/stddef modules/stdint modules/stdio modules/stdlib modules/string modules/strings modules/sys_file modules/sys_ioctl modules/sys_select modules/sys_socket modules/sys_stat modules/sys_time modules/sys_times modules/sys_utsname modules/sys_wait modules/sysexits modules/termios modules/time modules/unistd modules/wchar modules/wctype
diffstat 584 files changed, 8672 insertions(+), 2488 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Apr 01 16:04:45 2011 -0700
+++ b/ChangeLog	Fri May 06 08:15:59 2011 -0700
@@ -1,3 +1,1649 @@
+2011-05-06  Jim Meyering  <meyering@redhat.com>
+
+	maint.mk: use info-gnu@ as the default only for a stable release
+	* top/maint.mk: Don't default to info-gnu for alpha or beta releases.
+	For those, just use $(PACKAGE_BUGREPORT), in which case we don't have
+	to set the Mail-Followup-To header.  Prompted by Reuben Thomas in
+	http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/26488
+
+2011-05-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+	assert-h: new module, which supports C1X-style static_assert
+	* lib/assert.in.h, m4/assert_h.m4, modules/assert-h: New files.
+	* lib/verify.h: Revamp so that this can be copied into assert.h,
+	while retaining the ability to use it standalone as before.
+	Rename private identifiers so as not to encroach on the
+	standard C namespace, since this is now used by assert.h.
+	(_GL_VERIFY_TYPE): New macro, factoring out differing parts of
+	the old verify_true.
+	(_GL_VERIFY_TRUE): New macro, with much of the contents of
+	the old verify_true.  Use _GL_VERIFY_TYPE.
+	(_GL_VERIFY): New macro, with much of the contents of the old verify.
+	(static_assert): New macro, if _GL_STATIC_ASSERT_H
+	is defined and static_assert is not; _GL_STATIC_ASSERT_H is
+	defined when this file is copied into the replacement assert.h.
+	(_Static_assert): New macro, if _GL_STATIC_ASSERT_H is defined
+	and _Static_assert is not built in.
+	(verify_true, verify): Define only if _GL_STATIC_ASSERT_H is not
+	defined, and use the new macros mentioned above.
+	* doc/posix-headers/assert.texi: Document this.
+
+2011-05-05  Bruno Haible  <bruno@clisp.org>
+
+	fclose, fflush: Respect rules for use of AC_LIBOBJ.
+	* m4/fflush.m4 (gl_FUNC_FFLUSH): Don't invoke gl_REPLACE_FCLOSE.
+	* m4/fclose.m4 (gl_FUNC_FCLOSE): Invoke gl_FUNC_FFLUSH_STDIN and
+	gl_REPLACE_FCLOSE here.
+	* modules/fflush (Depends-on): Remove fclose.
+	* doc/posix-functions/fclose.texi: Mention module 'fflush' only in
+	combination with module 'fclose'.
+
+2011-05-05  Bruno Haible  <bruno@clisp.org>
+
+	fflush, fseeko: Respect rules for use of AC_LIBOBJ.
+	* m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): New macro, extracted from
+	gl_FUNC_FFLUSH.
+	(gl_FUNC_FFLUSH): Use it.
+	(gl_REPLACE_FFLUSH): Don't invoke gl_REPLACE_FSEEKO.
+	* m4/fseeko.m4 (gl_FUNC_FSEEKO): Invoke gl_FUNC_FFLUSH_STDIN and
+	gl_REPLACE_FSEEKO here.
+
+2011-05-05  Bruno Haible  <bruno@clisp.org>
+
+	tzset: Relicense under LGPL.
+	* modules/tzset (License): Change to LGPL.
+	No agreement needed; it's a no-op.
+
+	strtoimax, strtoumax: Relicense under LGPL.
+	* modules/strtoimax (License): Change to LGPL.
+	* modules/strtoumax (License): Likewise.
+	With permission from Jim Meyering, Paul Eggert:
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00124.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00109.html>
+
+	getgroups: Relicense under LGPL.
+	* modules/getgroups (License): Change to LGPL.
+	With permission from Jim Meyering, Paul Eggert, Eric Blake:
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00111.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00148.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00138.html>
+
+	nanosleep: Relicense under LGPL.
+	* modules/nanosleep (License): Change to LGPL.
+	With permission from Jim Meyering, Paul Eggert, Eric Blake, Bruno
+	Haible:
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00111.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00148.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00138.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00131.html>
+
+	futimens: Relicense under LGPL.
+	* modules/futimens (License): Change to LGPL.
+	With permission from Eric Blake:
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00138.html>
+
+	fflush: Relicense under LGPL.
+	* modules/fflush (License): Change to LGPL.
+	With permission from Eric Blake, Bruno Haible, Jim Meyering:
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00138.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00131.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00133.html>
+
+	tmpfile: Relicense under LGPL.
+	* modules/tmpfile (License): Change to LGPL.
+	With permission from Ben Pfaff:
+	<http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00185.html>
+
+	isfinite: Relicense under LGPL.
+	* modules/isfinite (License): Change to LGPL.
+	With permission from Ben Pfaff, Bruno Haible:
+	<http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00185.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00130.html>
+
+	acosl..tanl: Relicense under LGPL.
+	* modules/acosl (License): Change to LGPL.
+	* modules/asinl (License): Likewise.
+	* modules/atanl (License): Likewise.
+	* modules/cosl (License): Likewise.
+	* modules/expl (License): Likewise.
+	* modules/logl (License): Likewise.
+	* modules/sinl (License): Likewise.
+	* modules/sqrtl (License): Likewise.
+	* modules/tanl (License): Likewise.
+	Source code originally from glibc and Paolo Bonzini. Agreements:
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00137.html>
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00128.html>
+
+2011-05-05  Bruno Haible  <bruno@clisp.org>
+
+	signal: Define sighandler_t.
+	* lib/signal.in.h (sighandler_t): New type.
+	* m4/signal_h.m4 (gl_SIGNAL_H): Require AC_USE_SYSTEM_EXTENSIONS. Test
+	whether sighandler_t is defined.
+	(gl_SIGNAL_H_DEFAULTS): Initialize HAVE_SIGHANDLER_T.
+	* modules/signal (Depends-on): Add extensions.
+	(Makefile.am): Substitute HAVE_SIGHANDLER_T.
+	* doc/posix-headers/signal.texi: Mention the problem with sighandler_t.
+	Suggested by Markus Steinborn <gnugv_maintainer@yahoo.de>.
+
+2011-05-05  Eric Blake  <eblake@redhat.com>
+
+	maint: remove useless REPLACE_*_H macros
+	* m4/arpa_inet_h.m4 (gl_REPLACE_ARPA_INET_H): Delete.
+	* m4/dirent_h.m4 (gl_REPLACE_DIRENT_H): Likewise.
+	* m4/locale_h.m4 (gl_REPLACE_LOCALE_H): Likewise.
+	* m4/poll_h.m4 (gl_REPLACE_POLL_H): Likewise.
+	* m4/spawn_h.m4 (gl_REPLACE_SPAWN_H): Likewise.
+	* m4/sys_ioctl_h.m4 (gl_REPLACE_SYS_IOCTL_H): Likewise.
+	* m4/wchar_h.m4 (gl_REPLACE_WCHAR_H): Likewise.
+	* m4/btowc.m4: Update callers.
+	* m4/dirfd.m4: Likewise.
+	* m4/duplocale.m4: Likewise.
+	* m4/fchdir.m4: Likewise.
+	* m4/fdopendir.m4: Likewise.
+	* m4/inet_ntop.m4: Likewise.
+	* m4/inet_pton.m4: Likewise.
+	* m4/ioctl.m4: Likewise.
+	* m4/mbrlen.m4: Likewise.
+	* m4/mbrtowc.m4: Likewise.
+	* m4/mbsinit.m4: Likewise.
+	* m4/mbsnrtowcs.m4: Likewise.
+	* m4/mbsrtowcs.m4: Likewise.
+	* m4/poll.m4: Likewise.
+	* m4/setlocale.m4: Likewise.
+	* m4/wcrtomb.m4: Likewise.
+	* m4/wcsnrtombs.m4: Likewise.
+	* m4/wcsrtombs.m4: Likewise.
+	* m4/wctob.m4: Likewise.
+	* m4/wcwidth.m4: Likewise.
+	* modules/posix_spawn: Likewise.
+	* modules/posix_spawn_file_actions_addclose: Likewise.
+	* modules/posix_spawn_file_actions_adddup2: Likewise.
+	* modules/posix_spawn_file_actions_addopen: Likewise.
+	* modules/posix_spawn_file_actions_destroy: Likewise.
+	* modules/posix_spawn_file_actions_init: Likewise.
+	* modules/posix_spawnattr_destroy: Likewise.
+	* modules/posix_spawnattr_getflags: Likewise.
+	* modules/posix_spawnattr_getpgroup: Likewise.
+	* modules/posix_spawnattr_getschedparam: Likewise.
+	* modules/posix_spawnattr_getschedpolicy: Likewise.
+	* modules/posix_spawnattr_getsigdefault: Likewise.
+	* modules/posix_spawnattr_getsigmask: Likewise.
+	* modules/posix_spawnattr_init: Likewise.
+	* modules/posix_spawnattr_setflags: Likewise.
+	* modules/posix_spawnattr_setpgroup: Likewise.
+	* modules/posix_spawnattr_setschedparam: Likewise.
+	* modules/posix_spawnattr_setschedpolicy: Likewise.
+	* modules/posix_spawnattr_setsigdefault: Likewise.
+	* modules/posix_spawnattr_setsigmask: Likewise.
+	* modules/posix_spawnp: Likewise.
+
+2011-05-04  Reuben Thomas  <rrt@sc3d.org>
+
+	Add option to do-release-commit-and-tag to specify branch.
+	* build-aux/do-release-commit-and-tag: Add --branch.
+
+2011-05-03  Bruno Haible  <bruno@clisp.org>
+
+	Avoid unnecessary compilation units, through conditional dependencies.
+	* modules/accept (Depends-on): Add conditions to the dependencies.
+	* modules/acosl (Depends-on): Likewise.
+	* modules/argz (Depends-on): Likewise.
+	* modules/asinl (Depends-on): Likewise.
+	* modules/atanl (Depends-on): Likewise.
+	* modules/atoll (Depends-on): Likewise.
+	* modules/bind (Depends-on): Likewise.
+	* modules/btowc (Depends-on): Likewise.
+	* modules/canonicalize-lgpl (Depends-on): Likewise.
+	* modules/ceil (Depends-on): Likewise.
+	* modules/ceilf (Depends-on): Likewise.
+	* modules/ceill (Depends-on): Likewise.
+	* modules/chdir-long (Depends-on): Likewise.
+	* modules/chown (Depends-on): Likewise.
+	* modules/close (Depends-on): Likewise.
+	* modules/connect (Depends-on): Likewise.
+	* modules/cosl (Depends-on): Likewise.
+	* modules/dirfd (Depends-on): Likewise.
+	* modules/dprintf (Depends-on): Likewise.
+	* modules/dprintf-posix (Depends-on): Likewise.
+	* modules/error (Depends-on): Likewise.
+	* modules/euidaccess (Depends-on): Likewise.
+	* modules/expl (Depends-on): Likewise.
+	* modules/faccessat (Depends-on): Likewise.
+	* modules/fchdir (Depends-on): Likewise.
+	* modules/fclose (Depends-on): Likewise.
+	* modules/fcntl (Depends-on): Likewise.
+	* modules/fdopendir (Depends-on): Likewise.
+	* modules/fflush (Depends-on): Likewise.
+	* modules/floor (Depends-on): Likewise.
+	* modules/floorf (Depends-on): Likewise.
+	* modules/floorl (Depends-on): Likewise.
+	* modules/fnmatch (Depends-on): Likewise.
+	* modules/fopen (Depends-on): Likewise.
+	* modules/fprintf-posix (Depends-on): Likewise.
+	* modules/frexp (Depends-on): Likewise.
+	* modules/frexp-nolibm (Depends-on): Likewise.
+	* modules/frexpl (Depends-on): Likewise.
+	* modules/frexpl-nolibm (Depends-on): Likewise.
+	* modules/fseek (Depends-on): Likewise.
+	* modules/fsusage (Depends-on): Likewise.
+	* modules/ftell (Depends-on): Likewise.
+	* modules/ftello (Depends-on): Likewise.
+	* modules/futimens (Depends-on): Likewise.
+	* modules/getcwd (Depends-on): Likewise.
+	* modules/getcwd-lgpl (Depends-on): Likewise.
+	* modules/getdelim (Depends-on): Likewise.
+	* modules/getdomainname (Depends-on): Likewise.
+	* modules/getgroups (Depends-on): Likewise.
+	* modules/gethostname (Depends-on): Likewise.
+	* modules/getline (Depends-on): Likewise.
+	* modules/getlogin_r (Depends-on): Likewise.
+	* modules/getopt-posix (Depends-on): Likewise.
+	* modules/getpeername (Depends-on): Likewise.
+	* modules/getsockname (Depends-on): Likewise.
+	* modules/getsockopt (Depends-on): Likewise.
+	* modules/getsubopt (Depends-on): Likewise.
+	* modules/getusershell (Depends-on): Likewise.
+	* modules/glob (Depends-on): Likewise.
+	* modules/grantpt (Depends-on): Likewise.
+	* modules/iconv_open (Depends-on): Likewise.
+	* modules/iconv_open-utf (Depends-on): Likewise.
+	* modules/inet_ntop (Depends-on): Likewise.
+	* modules/inet_pton (Depends-on): Likewise.
+	* modules/ioctl (Depends-on): Likewise.
+	* modules/isapipe (Depends-on): Likewise.
+	* modules/isfinite (Depends-on): Likewise.
+	* modules/isinf (Depends-on): Likewise.
+	* modules/lchown (Depends-on): Likewise.
+	* modules/ldexpl (Depends-on): Likewise.
+	* modules/link (Depends-on): Likewise.
+	* modules/linkat (Depends-on): Likewise.
+	* modules/listen (Depends-on): Likewise.
+	* modules/logl (Depends-on): Likewise.
+	* modules/lstat (Depends-on): Likewise.
+	* modules/mbrlen (Depends-on): Likewise.
+	* modules/mbrtowc (Depends-on): Likewise.
+	* modules/mbsinit (Depends-on): Likewise.
+	* modules/mbsnrtowcs (Depends-on): Likewise.
+	* modules/mbsrtowcs (Depends-on): Likewise.
+	* modules/mbtowc (Depends-on): Likewise.
+	* modules/memcmp (Depends-on): Likewise.
+	* modules/mkdir (Depends-on): Likewise.
+	* modules/mkdtemp (Depends-on): Likewise.
+	* modules/mkfifo (Depends-on): Likewise.
+	* modules/mkfifoat (Depends-on): Likewise.
+	* modules/mknod (Depends-on): Likewise.
+	* modules/mkostemp (Depends-on): Likewise.
+	* modules/mkostemps (Depends-on): Likewise.
+	* modules/mkstemp (Depends-on): Likewise.
+	* modules/mkstemps (Depends-on): Likewise.
+	* modules/mktime (Depends-on): Likewise.
+	* modules/nanosleep (Depends-on): Likewise.
+	* modules/open (Depends-on): Likewise.
+	* modules/openat (Depends-on): Likewise.
+	* modules/perror (Depends-on): Likewise.
+	* modules/poll (Depends-on): Likewise.
+	* modules/popen (Depends-on): Likewise.
+	* modules/posix_spawn (Depends-on): Likewise.
+	* modules/posix_spawn_file_actions_addclose (Depends-on): Likewise.
+	* modules/posix_spawn_file_actions_adddup2 (Depends-on): Likewise.
+	* modules/posix_spawn_file_actions_addopen (Depends-on): Likewise.
+	* modules/posix_spawnp (Depends-on): Likewise.
+	* modules/pread (Depends-on): Likewise.
+	* modules/printf-posix (Depends-on): Likewise.
+	* modules/ptsname (Depends-on): Likewise.
+	* modules/putenv (Depends-on): Likewise.
+	* modules/pwrite (Depends-on): Likewise.
+	* modules/readline (Depends-on): Likewise.
+	* modules/readlink (Depends-on): Likewise.
+	* modules/readlinkat (Depends-on): Likewise.
+	* modules/recv (Depends-on): Likewise.
+	* modules/recvfrom (Depends-on): Likewise.
+	* modules/regex (Depends-on): Likewise.
+	* modules/remove (Depends-on): Likewise.
+	* modules/rename (Depends-on): Likewise.
+	* modules/renameat (Depends-on): Likewise.
+	* modules/rmdir (Depends-on): Likewise.
+	* modules/round (Depends-on): Likewise.
+	* modules/roundf (Depends-on): Likewise.
+	* modules/roundl (Depends-on): Likewise.
+	* modules/rpmatch (Depends-on): Likewise.
+	* modules/select (Depends-on): Likewise.
+	* modules/send (Depends-on): Likewise.
+	* modules/sendto (Depends-on): Likewise.
+	* modules/setenv (Depends-on): Likewise.
+	* modules/setlocale (Depends-on): Likewise.
+	* modules/setsockopt (Depends-on): Likewise.
+	* modules/shutdown (Depends-on): Likewise.
+	* modules/sigaction (Depends-on): Likewise.
+	* modules/signbit (Depends-on): Likewise.
+	* modules/sigprocmask (Depends-on): Likewise.
+	* modules/sinl (Depends-on): Likewise.
+	* modules/sleep (Depends-on): Likewise.
+	* modules/snprintf (Depends-on): Likewise.
+	* modules/snprintf-posix (Depends-on): Likewise.
+	* modules/socket (Depends-on): Likewise.
+	* modules/sprintf-posix (Depends-on): Likewise.
+	* modules/sqrtl (Depends-on): Likewise.
+	* modules/stat (Depends-on): Likewise.
+	* modules/strchrnul (Depends-on): Likewise.
+	* modules/strdup-posix (Depends-on): Likewise.
+	* modules/strerror (Depends-on): Likewise.
+	* modules/strerror_r-posix (Depends-on): Likewise.
+	* modules/strndup (Depends-on): Likewise.
+	* modules/strnlen (Depends-on): Likewise.
+	* modules/strptime (Depends-on): Likewise.
+	* modules/strsep (Depends-on): Likewise.
+	* modules/strsignal (Depends-on): Likewise.
+	* modules/strstr-simple (Depends-on): Likewise.
+	* modules/strtod (Depends-on): Likewise.
+	* modules/strtoimax (Depends-on): Likewise.
+	* modules/strtok_r (Depends-on): Likewise.
+	* modules/strtoumax (Depends-on): Likewise.
+	* modules/symlink (Depends-on): Likewise.
+	* modules/symlinkat (Depends-on): Likewise.
+	* modules/tanl (Depends-on): Likewise.
+	* modules/tcgetsid (Depends-on): Likewise.
+	* modules/tmpfile (Depends-on): Likewise.
+	* modules/trunc (Depends-on): Likewise.
+	* modules/truncf (Depends-on): Likewise.
+	* modules/truncl (Depends-on): Likewise.
+	* modules/uname (Depends-on): Likewise.
+	* modules/unlink (Depends-on): Likewise.
+	* modules/unlockpt (Depends-on): Likewise.
+	* modules/unsetenv (Depends-on): Likewise.
+	* modules/usleep (Depends-on): Likewise.
+	* modules/utimensat (Depends-on): Likewise.
+	* modules/vasprintf (Depends-on): Likewise.
+	* modules/vdprintf (Depends-on): Likewise.
+	* modules/vdprintf-posix (Depends-on): Likewise.
+	* modules/vfprintf-posix (Depends-on): Likewise.
+	* modules/vprintf-posix (Depends-on): Likewise.
+	* modules/vsnprintf (Depends-on): Likewise.
+	* modules/vsnprintf-posix (Depends-on): Likewise.
+	* modules/vsprintf-posix (Depends-on): Likewise.
+	* modules/wcrtomb (Depends-on): Likewise.
+	* modules/wcscasecmp (Depends-on): Likewise.
+	* modules/wcscspn (Depends-on): Likewise.
+	* modules/wcsdup (Depends-on): Likewise.
+	* modules/wcsncasecmp (Depends-on): Likewise.
+	* modules/wcsnrtombs (Depends-on): Likewise.
+	* modules/wcspbrk (Depends-on): Likewise.
+	* modules/wcsrtombs (Depends-on): Likewise.
+	* modules/wcsspn (Depends-on): Likewise.
+	* modules/wcsstr (Depends-on): Likewise.
+	* modules/wcstok (Depends-on): Likewise.
+	* modules/wcswidth (Depends-on): Likewise.
+	* modules/wctob (Depends-on): Likewise.
+	* modules/wctomb (Depends-on): Likewise.
+	* modules/wctype (Depends-on): Likewise.
+	* modules/wcwidth (Depends-on): Likewise.
+	* modules/write (Depends-on): Likewise.
+
+2011-05-03  Bruno Haible  <bruno@clisp.org>
+
+	Support for conditional dependencies.
+	* doc/gnulib.texi (Module description): Document the syntax of
+	conditional dependencies.
+	* gnulib-tool: New option --conditional-dependencies.
+	(func_usage): Document it.
+	(cond_dependencies): New variable.
+	(func_get_automake_snippet_conditional,
+	func_get_automake_snippet_unconditional): New functions, extracted from
+	func_get_automake_snippet.
+	(func_get_automake_snippet): Use them.
+	(sed_first_32_chars): New variable.
+	(func_module_shellfunc_name): New function.
+	(func_module_shellvar_name): New function.
+	(func_module_conditional_name): New function.
+	(func_uncond_add_module, func_conddep_add_module, func_cond_module_p,
+	func_cond_module_condition): New functions.
+	(func_modules_transitive_closure): Add support for conditional
+	dependencies.
+	(func_emit_lib_Makefile_am): For a conditional module, enclose the
+	conditional automake snippet in an automake conditional.
+	(func_emit_autoconf_snippets): Emit shell functions that contain the
+	code for conditional modules.
+	(func_import, func_create_testdir): Update specification.
+
+2011-05-03  Eric Blake  <eblake@redhat.com>
+
+	test-getaddrinfo: report error information
+	* tests/test-getaddrinfo.c (simple): Use err outside of dbprintf.
+
+2011-05-03  Jim Meyering  <meyering@redhat.com>
+
+	bootstrap: avoid build failure when $GZIP is set
+	* build-aux/bootstrap (check_versions): Do not treat $GZIP as a
+	program name.  If defined at all, it is supposed to list gzip options.
+	Reported by Alan Curry in http://debbugs.gnu.org/8609
+
+2011-05-03  Reuben Thomas  <rrt@sc3d.org>
+
+	readme-release: new module with release instructions
+	* modules/readme-release: New module.
+	* top/README-release: New file, from coreutils, grep, diffutils.
+	* MODULES.html.sh (Support for maintaining and releasing): Add it.
+
+2011-05-02  Eric Blake  <eblake@redhat.com>
+
+	fflush: also replace fclose when fixing fflush
+	* modules/fflush (Depends-on): Add fclose.
+	* m4/fflush.m4 (gl_FUNC_FFLUSH): Also replace fclose.
+	* lib/fclose.c (rpl_fclose): Don't cause spurious failures on
+	memstreams with no backing fd.
+	* doc/posix-functions/fclose.texi (fclose): Document the use of
+	fflush module to fix the bug.
+	* tests/test-fclose.c (main): Relax test when fclose is used in
+	isolation.
+
+	fclose: add some tests
+	* modules/fclose-tests: New test module.
+	* tests/test-fclose.c: New file.
+	* doc/posix-functions/fclose.texi (fclose): Document the bug.
+
+	fclose: reduced dependencies
+	* modules/fclose (Depends-on): Switch from fflush/fseeko to
+	simpler lseek.
+	* lib/fclose.c (rpl_fclose): Likewise.
+	Reported by Simon Josefsson.
+
+	exit: drop remaining clients
+	* modules/argmatch (Depends-on): Replace exit with stdlib.
+	* modules/copy-file (Depends-on): Likewise.
+	* modules/execute (Depends-on): Likewise.
+	* modules/exitfail (Depends-on): Likewise.
+	* modules/obstack (Depends-on): Likewise.
+	* modules/pagealign_alloc (Depends-on): Likewise.
+	* modules/pipe-filter-gi (Depends-on): Likewise.
+	* modules/pipe-filter-ii (Depends-on): Likewise.
+	* modules/savewd (Depends-on): Likewise.
+	* modules/spawn-pipe (Depends-on): Likewise.
+	* modules/wait-process (Depends-on): Likewise.
+	* modules/xsetenv (Depends-on): Likewise.
+	* modules/chdir-long (Depends-on): Add stdlib, for EXIT_FAILURE.
+	* modules/git-merge-changelog (Depends-on): Likewise.
+	* modules/long-options (Depends-on): Likewise.
+	* modules/pt_chown (Depends-on): Likewise.
+	* modules/sysexits (Depends-on): Likewise.
+
+	freading: relax license from LGPLv3+ to LGPLv2+
+	* modules/freading (License): Relax LGPL version.
+
+2011-05-02  Bruno Haible  <bruno@clisp.org>
+
+	fchdir: Remove unused dependencies.
+	* modules/fchdir (Depends-on): Remove include_next.
+
+2011-05-02  Bruno Haible  <bruno@clisp.org>
+
+	gnulib-tool: Refactor.
+	* gnulib-tool (func_emit_autoconf_snippet): New function, extracted
+	from func_emit_autoconf_snippets.
+	(func_emit_autoconf_snippets): Use it.
+
+2011-05-02  Simon Josefsson  <simon@josefsson.org>
+
+	* NEWS: Document removal of 'exit'.
+	* modules/exit: Remove file.
+
+2011-05-01  Bruno Haible  <bruno@clisp.org>
+
+	Update DEPENDENCIES.
+	* DEPENDENCIES (gettext): Recommend the newest release.
+	Reported by Simon Josefsson.
+
+2011-05-01  Bruno Haible  <bruno@clisp.org>
+
+	gnulib-tool: Reduce code duplication.
+	* gnulib-tool (func_emit_autoconf_snippets): New function.
+	(func_import, func_create_testdir): Use it.
+
+2011-04-30  Eric Blake  <eblake@redhat.com>
+
+	fclose: don't fail on non-seekable input stream
+	* modules/fclose (Depends-on): Add freading, fflush, fseeko.
+	* lib/fclose.c (rpl_fclose): Skip fflush for non-seekable input,
+	since fflush is allowed to fail in that case.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	dup3: cleanup
+	* lib/dup3.c: Remove old code, leftover from 2009-12-16.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	netdb: Make it work in C++ mode.
+	* lib/netdb.in.h (struct addrinfo): In C++, define as a C struct.
+	(getaddrinfo, freeaddrinfo, getnameinfo): Use macros from c++defs
+	module.
+	* m4/netdb_h.m4 (gl_NETDB_MODULE_INDICATOR): Invoke
+	gl_MODULE_INDICATOR_FOR_TESTS.
+	* modules/netdb-tests (Depends-on): Add netdb-c++-tests.
+	* modules/netdb-c++-tests: New file.
+	* tests/test-netdb-c++.cc: New file.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	New modules 'vfscanf', 'vscanf'.
+	* modules/vfscanf: New file.
+	* modules/vscanf: New file.
+	* m4/stdio_h.m4 (gl_STDIO_H): Don't set GNULIB_VFSCANF, GNULIB_VSCANF
+	here.
+	* doc/posix-functions/vfscanf.texi: Mention module 'vfscanf'.
+	* doc/posix-functions/vscanf.texi: Mention module 'vscanf'.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	passfd: Add comments.
+	* lib/passfd.c: Add comments about platforms.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	sys_uio: Make <sys/uio.h> self-contained.
+	* lib/sys_uio.in.h: Include <sys/types.h> before <sys/uio.h>.
+	* doc/posix-headers/sys_uio.texi: Mention the OpenBSD problem.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	sys_socket: Ensure 'struct iovec' definition.
+	* lib/sys_socket.in.h: Include <sys/uio.h> also on platforms that have
+	<sys/socket.h>.
+	* doc/posix-headers/sys_socket.texi: Mention the OpenBSD problem.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	sys_uio: Protect definition of 'struct iovec'.
+	* lib/sys_uio.in.h (struct iovec): Avoid redefinition. In C++, define
+	it as a C struct.
+
+2011-04-30  Bruno Haible  <bruno@clisp.org>
+
+	manywarnings: fix indentation
+	* m4/manywarnings.m4: Indent by 2 spaces consistently.
+
+2011-04-30  Pádraig Brady <P@draigBrady.com>
+
+	manywarnings: add -Wno-missing-field-initializers if needed.
+	* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Add the above
+	option if it's needed to allow initialization with { 0, }
+
+2011-04-29  Reuben Thomas  <rrt@sc3d.org>
+
+	announce-gen: cosmetic improvement
+	* build-aux/announce-gen: Strip any leading ./ from the NEWS file name.
+
+2011-04-29  Jim Meyering  <meyering@redhat.com>
+
+	vc-list-files: indent with spaces, not TABs
+	* build-aux/vc-list-files: Convert leading TABs to spaces,
+	to match the style of most other files in gnulib.
+
+	announce-gen: indent with spaces, not TABs
+	* build-aux/announce-gen: Convert all TABs to spaces, to match
+	the style of most other files in gnulib.
+
+2011-04-29  Eric Blake  <eblake@redhat.com>
+
+	quotearg: avoid uninitialized variable use
+	* lib/quotearg.c (quoting_options_from_style): Initialize
+	remaining fields, and ensure that custom styles are only used via
+	quoting_options rather than quoting_style.
+
+2011-04-29  Jim Meyering  <meyering@redhat.com>
+
+	maint.mk: remove unused VC-tag variable
+	* top/maint.mk (VC-tag): Remove unused variable.
+
+2011-04-29  Bruno Haible  <bruno@clisp.org>
+
+	netdb: fix gai_strerror replacements
+	* lib/netdb.in.h: Add _GL_FUNCDECL_RPL definitions.
+	* modules/netdb: Substitute it.
+
+2011-04-29  Jim Meyering  <meyering@redhat.com>
+
+	test-getcwd.c: avoid new set-but-not-used warning
+	* tests/test-getcwd.c (test_abort_bug): Exit nonzero for any problem,
+	not just the glibc/abort one that getcwd-abort-bug.m4 detects.
+	* m4/getcwd-abort-bug.m4: Update this now-duplicated code to match,
+	and adjust the code that sets gl_cv_func_getcwd_abort_bug accordingly.
+
+	test-hash.c: avoid a new shadowing warning
+	* tests/test-hash.c (main): Don't shadow "dup".
+
+2011-04-28  Eric Blake  <eblake@redhat.com>
+
+	getaddrinfo: fix gai_strerror signature
+	* m4/getaddrinfo.m4 (gl_GETADDRINFO): Detect broken signatures,
+	and work around mingw with UNICODE defined.
+	(gl_PREREQ_GETADDRINFO): Drop redundant decl check.
+	* m4/netdb_h.m4 (gl_NETDB_H_DEFAULTS): Add witness.
+	* modules/netdb (Makefile.am): Substitute it.
+	* lib/netdb.in.h (gai_strerror): Declare replacement.
+	* lib/gai_strerror.c (rpl_gai_strerror): Fix signature.
+	* doc/posix-functions/gai_strerror.texi (gai_strerror): Document
+	the fix.
+
+	getsockopt: avoid compiler warning
+	* lib/getsockopt.c (rpl_getsockopt): Add a cast for mingw.
+	Reported by Matthias Bolte.
+
+	tests: drop unused link dependency
+	* modules/areadlinkat-tests (Makefile.am): Drop stale LDADD.
+	* modules/dirent-safer-tests (Makefile.am): Likewise.
+	* modules/fdopendir-tests (Makefile.am): Likewise.
+	* modules/mkfifoat-tests (Makefile.am): Likewise.
+	* modules/openat-safer-tests (Makefile.am): Likewise.
+	* modules/openat-tests (Makefile.am): Likewise.
+	* modules/readlinkat-tests (Makefile.am): Likewise.
+	* modules/symlinkat-tests (Makefile.am): Likewise.
+	* modules/linkat-tests (Makefile.am): Likewise.
+	(Depends-on): Switch to filenamecat-lgpl.
+	* modules/fdutimensat-tests (test_fdutimensat_LDADD): Drop unused
+	LIBINTL.
+	* modules/utimensat-tests (test_utimensat_LDADD): Likewise.
+	* tests/test-linkat.c (main): Don't require xalloc.
+
+	hash, mgetgroups: drop xalloc dependency
+	* lib/hash.c (includes): Adjust includes.
+	* lib/mgetgroups.c (includes): Likewise.
+	(xgetgroups): Move...
+	* lib/xgetgroups.c: ...to new file.
+	* lib/mgetgroups.h (xgetgroups): Make declaration conditional.
+	* modules/xgetgroups: New file, split from...
+	* modules/mgetgroups: ...here.
+	(Depends-on): Add xalloc-oversized.
+	* modules/hash (Depends-on): Likewise.
+	* modules/hash-tests (Depends-on): Drop xalloc.
+	(test_hash_LDADD): Drop unused library.
+	* tests/test-hash.c (main): Break xalloc dependency.
+	(includes): Drop unused include.
+
+	xalloc-oversized: new module
+	* modules/xalloc-oversized: New module.
+	* modules/xalloc (Depends-on): Add it.
+	* lib/xalloc.h (xalloc_oversized): Move...
+	* lib/xalloc-oversized.h: ...into new file.
+
+	utimecmp: drop dependency on xmalloc
+	* lib/utimecmp.c (utimecmp): Work even if hash table cache fails
+	due to memory pressure.
+	* modules/utimecmp (Depends-on): Drop xalloc.
+
+2011-04-27  Eric Blake  <eblake@redhat.com>
+
+	getcwd: fix mingw bugs
+	* m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Detect one mingw bug.
+	* doc/posix-functions/getcwd.texi (getcwd): Document the problems.
+	* lib/getcwd-lgpl.c (rpl_getcwd): Fix return type.
+
+2011-04-27  Bruno Haible  <bruno@clisp.org>
+
+	mkstemps: Ensure declaration on MacOS X 10.5.
+	* lib/stdlib.in.h: Include <unistd.h> when mkstemps is requested.
+	* doc/glibc-functions/mkstemps.texi: Document header file problem on
+	MacOS X.
+
+2011-04-27  Bruno Haible  <bruno@clisp.org>
+
+	mkstemp: More documentation.
+	* doc/posix-functions/mkstemp.texi: Document header file problem on
+	MacOS X.
+
+2011-04-27  Bruno Haible  <bruno@clisp.org>
+
+	mkstemp: Tweak configure message when cross-compiling.
+	* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): When cross-compiling, qualify the
+	result as a guess.
+
+2011-04-27  Bruno Haible  <bruno@clisp.org>
+
+	clean-temp: Clarify what it does.
+	* lib/clean-temp.h: Add more comments.
+	* doc/posix-functions/mkstemp.texi: Tweak reference to 'clean-temp'
+	module.
+	* doc/glibc-functions/mkostemp.texi: Mention 'clean-temp' here too.
+	* doc/glibc-functions/mkstemps.texi: Likewise.
+	* doc/glibc-functions/mkostemps.texi: Likewise.
+
+2011-04-27  Eric Blake  <eblake@redhat.com>
+
+	fchdir: avoid extra chdir and fix test
+	* modules/fchdir (Depends-on): Add dosname, filenamecat-lgpl,
+	getcwd-lgpl.
+	* lib/fchdir.c (get_name): Any absolute name will do; it does not
+	have to be canonical.
+	(canonicalize_file_name): Drop unused macro.
+	* m4/dup2.m4 (gl_REPLACE_DUP2): Ensure dup2 is replaced.
+
+	filenamecat-lgpl: fix licence
+	* modules/filenamecat-lgpl (License): Mark as LGPLv2+, as intended
+	when it was first created.
+
+	linkat, renameat: add missing dependency
+	* modules/linkat (Depends-on): Require getcwd-lgpl.
+	* modules/renameat (Depends-on): Likewise.
+
+	tests: reduce dependencies
+	* tests/test-linkat.c (main): Use lighter-weight getcwd.
+	* tests/test-renameat.c (main): Likewise.
+	* modules/linkat-tests (Depends-on): Relax dependency.
+	* modules/renameat-tests (Depends-on): Likewise.
+	* modules/fchdir-tests (Depends-on): Likewise.  Also make cloexec
+	dependency explicit.
+
+	save-cwd: reduce default dependency
+	* modules/save-cwd (Depends-on): Use getcwd-lgpl.
+	* lib/save-cwd.c: Update comments.
+	* NEWS: Document the semantic change.
+
+	getcwd: enhance tests
+	* tests/test-getcwd-lgpl.c: New file, taken from...
+	* tests/test-getcwd.c: ...old contents.  Rewrite this file to
+	repeat long path stress tests from m4 probe.
+	* modules/getcwd-lgpl-tests: New module.
+	* modules/getcwd-tests (Depends-on): Depend on lgpl tests.
+	* m4/getcwd-abort-bug.m4: Update comment.
+	* m4/getcwd-path-max.m4: Likewise.
+
+	getcwd-lgpl: new module
+	* modules/getcwd-lgpl: New module.
+	* lib/getcwd-lgpl.c: New file.
+	* doc/posix-functions/getcwd.texi (getcwd): Document it.
+	* MODULES.html.sh (lacking POSIX:2008): Likewise.
+	* modules/getcwd (configure.ac): Set C witness.
+	* m4/getcwd.m4 (gl_FUNC_GETCWD_LGPL): New macro.
+
+	getcwd: tweak comments
+	* m4/getcwd-abort-bug.m4: Fix comments.
+	* m4/getcwd-path-max.m4: Likewise.
+	* m4/getcwd.m4: Likewise.
+
+2011-04-27  Reuben Thomas  <rrt@sc3d.org>
+	and Eric Blake  <eblake@redhat.com>
+
+	mkstemp: replace if system version uses wrong permissions
+	* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Add test for non-owner
+	read/write mode bits set in file created by mkstemp.
+	* doc/posix-functions/mkstemp.texi (mkstemp): Document the fix.
+
+2011-04-27  Eric Blake  <eblake@redhat.com>
+
+	passfd: avoid compiler warning
+	* lib/passfd.c (sendfd, recvfd): Avoid shadowing names.
+	Reported by Laine Stump.
+
+2011-04-27  J.T. Conklin  <jtc@acorntoolworks.com>  (tiny change)
+
+	* gnulib-tool: change "join -a 2" to "join -a2", the latter is
+	required by the NetBSD (and perhaps other 4.4BSD derived) join.
+
+2011-04-27  Reuben Thomas  <rrt@sc3d.org>
+	and Eric Blake  <eblake@redhat.com>
+
+	mkstemp: mention clean-temp module
+	* lib/mkstemp.c: Add comment.
+	* doc/posix-functions/mkstemp.texi (mkstemp): Likewise.
+
+2011-04-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+	inttypes: also provide default values for 32-bit tests
+	* m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Also provide default values
+	for INT32_MAX_LT_INTMAX_MAX and for UINT32_MAX_LT_UINTMAX_MAX.
+
+2011-04-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+	strtoumax: remove dependency on strtoimax
+	This is like the strtoull change of yesterday.
+	* modules/strtoumax (Files): Add lib/strtoimax.c.
+	(Depends-on): Remove strtoimax and add verify.
+
+	inttypes-incomplete: new module
+	* m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): New macro, containing
+	all but the PRI* and SCN* parts of gl_INTTYPES_H.
+	(gl_INTTYPES_PRI_SCN): New macro, containing the PRI* and SCN* parts
+	of gl_INTTYPES_H.
+	(gl_INTTYPES_H): Rewrite in terms of these new macros.
+	(gl_INTTYPES_H_DEFAULTS): Provide defaults for the PRI* and SCN*
+	parts, in case gl_INTTYPE_PRI_SCN is not invoked.
+	* modules/imaxabs, modules/imaxdiv, modules/strtoimax (Depends-on):
+	* modules/strtoumax, modules/xstrtol (Depends-on):
+	Depend on inttypes-incomplete, not inttypes.
+	* modules/inttypes-incomplete: New module, containing the contents
+	of the old modules/inttypes module, except that the Files: section
+	omits m4/inttypes-pri.m4, and the configure.ac section invokes
+	gl_INTTYPES_INCOMPLETE rather than gl_INTTYPES_H.
+	* modules/inttypes (Files): Remove lib/inttypes.in.h, m4/inttypes.m4.
+	(Depends-on): Depend only on inttypes-incomplete.
+	(Makefile.am): Remove everything; this is now in inttypes-incomplete.
+
+	inttypes: omit now-redundant strtoimax and strtoumax work
+	* m4/inttypes.m4 (gl_INTTYPES_H): Do not check for strtoimax and
+	strtoumax decls; gl_FUNC_STRTOIMAX and gl_FUNC_STRTOUMAX now do this.
+
+	strtoimax, strtoumax: simplify, port to HP-UX 11.00 64-bit
+	This supports apps that need pointers to strtoimax and strtoumax,
+	and ports to HP-UX 11.00 64.bit, which has macros that expand to
+	nonexistent functions.  See
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00241.html>
+	et seq.
+	* lib/inttypes.in.h (strtoimax, strtoumax): #undef before declaring.
+	* m4/strtoimax.m4 (gl_FUNC_STRTOIMAX): Don't check whether it's
+	a macro.
+	* m4/strtoumax.m4 (gl_FUNC_STRTOUMAX): Likewise.
+
+2011-04-25  Simon Josefsson  <simon@josefsson.org>
+
+	* modules/gnumakefile (configure.ac): Replace TAB with SPCs.
+
+2011-04-25  Bruno Haible  <bruno@clisp.org>
+
+	strtol, strtoul: Mark modules as obsolete.
+	* modules/strtol (Status, Notice): New sections.
+	* modules/strtoul (Status, Notice): New sections.
+
+2011-04-25  Bruno Haible  <bruno@clisp.org>
+
+	strtod: Remove check for strtod, unless supporting old platforms.
+	* modules/strtod-obsolete: New file.
+	* m4/strtod-obsolete.m4: New file.
+	* m4/strtod.m4 (gl_FUNC_STRTOD): Don't check whether strtod is declared
+	if gl_FUNC_STRTOD_OBSOLETE is not also defined.
+	* modules/strtod (Depends-on): Add strtod-obsolete.
+	* doc/posix-functions/strtod.texi: Mention module strtod-obsolete.
+
+2011-04-25  Bruno Haible  <bruno@clisp.org>
+
+	strcase: Make module obsolete.
+	* modules/strcase (Status, Notice): New sections.
+
+2011-04-25  Bruno Haible  <bruno@clisp.org>
+
+	dup2: Remove check for dup2, unless supporting old obsolete platforms.
+	* modules/dup2-obsolete: New file.
+	* m4/dup2-obsolete.m4: New file.
+	* m4/dup2.m4 (gl_FUNC_DUP2): Don't check whether dup2 exists if
+	gl_FUNC_DUP2_OBSOLETE is not also defined.
+	* modules/dup2 (Depends-on): Add dup2-obsolete.
+	* doc/posix-functions/dup2.texi: Mention module dup2-obsolete.
+
+2011-04-25  Bruno Haible  <bruno@clisp.org>
+
+	strnlen: Avoid memchr related link error on old obsolete platforms.
+	* modules/memchr-obsolete: New file.
+	* m4/memchr-obsolete.m4: New file.
+	* m4/memchr.m4 (gl_FUNC_MEMCHR): Don't check whether memchr exists if
+	gl_FUNC_MEMCHR_OBSOLETE is not also defined.
+	* modules/memchr (Depends-on): Add memchr-obsolete.
+	* modules/strnlen (Depends-on): Likewise.
+	* doc/posix-functions/memchr.texi: Mention module memchr-obsolete.
+
+2011-04-25  Jim Meyering  <meyering@redhat.com>
+
+	maint.mk: makefile_at_at_check extend and clean up
+	* top/maint.mk (sc_makefile_at_at_check): Check *.mk files
+	in addition to */Makefile.am.
+	Exempt legitimate uses of @VAR@ notation, e.g.,
+	MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@
+	Remove obsolete coreutils-specific comment.
+	Prompted by discussion here:
+	http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/26074
+
+2011-04-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+	strtoul: remove dependency on strtol
+	This is so that 'configure' need not check for strtol merely because
+	the application needs strtoul.
+	* modules/strtoul (Files): Add lib/strtol.c.
+	(Depends-on): Remove strtol.
+
+	strtoull: remove dependency on strtoul
+	This is like the strtoll change.
+	* modules/strtoull (Files): Add lib/strtol.c, lib/strtoul.c.
+	(Depends-on): Remove strtoul.
+
+	strtoll: remove dependency on strtol
+	This is so that 'configure' need not check for strtol merely because
+	the application needs strtoll.
+	* modules/strtoll (Files): Add lib/strtol.c.
+	(Depends-on): Remove strtol.
+
+2011-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+	inttypes: Move some configure check to module 'imaxdiv'.
+	* m4/imaxdiv.m4 (gl_FUNC_IMAXDIV): Require gl_INTTYPES_H_DEFAULTS
+	instead of gl_INTTYPES_H.  Check for imaxdiv decl here.
+	* m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxdiv decl here.
+
+2011-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+	inttypes: Move some configure check to module 'imaxabs'.
+	* m4/imaxabs.m4 (gl_FUNC_IMAXABS): Require gl_INTTYPES_H_DEFAULTS
+	instead of gl_INTTYPES_H.  Check for imaxabs decl here.
+	* m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxabs decl here.
+
+2011-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+	inttypes: Remove configure tests that are not needed since 2009-12-31.
+	* m4/inttypes.m4 (gl_INTTYPES_H): Remove determination of
+	gl_cv_header_working_inttypes_h.
+
+2011-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* modules/strnlen (Depends-on): Remove memchr.
+	The strnlen implementation doesn't need the memchr module's fixes; see
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00237.html>.
+
+	strtol: remove dependency on wchar
+	* lib/strtol.c: Include <wchar.h> only if USE_WIDE_CHAR is defined.
+	* modules/strtol (Depends-on): Remove wchar.
+
+2011-04-21  Eric Blake  <eblake@redhat.com>
+
+	passfd: fix test regression on Linux
+	* modules/passfd-tests (configure.ac): Correct socketpair check.
+
+	passfd: speed up configure and drop unused code
+	* m4/afunix.m4 (gl_SOCKET_AFUNIX): Rename...
+	* m4/passfd.m4 (gl_PASSFD): ...to something more fitting of
+	its use.  Drop test for setting unused HAVE_UNIXSOCKET_SCM_RIGHTS.
+	Instead of probing at configure for unix_scm_rights_bsd44_way,
+	instead probe for CMSG_FIRSTHDR at compile time.  Simplify BSD 4.3
+	check to a struct member probe.
+	* lib/passfd.c (includes): Nothing here requires <sys/un.h>.
+	(sendfd, recvfd): Update preprocessor checks.
+	* modules/passfd (Files): Reflect rename, and drop unused file.
+	(Depends-on): Drop unused dependency.
+
+	passfd: allow compilation on mingw
+	* modules/sys_socket (Depends-on): Add sys_uio.
+	* lib/sys_socket.in.h [!@HAVE_SYS_SOCKET_H@]: Use it for struct
+	iovec and a minimal struct msghdr.
+	* m4/afunix.m4 (gl_SOCKET_AFUNIX): Detect recvmsg/sendmsg.
+	* tests/test-sys_socket.c (main): Enhance test.
+	* lib/passfd.c (include): Drop <sys/uio.h>; <sys/sockets.h> is
+	guaranteed to provide what we need.
+	(sendmsg, recvmsg): Declare fallbacks if we lack sendmsg.
+	* modules/passfd-tests (Depends-on): Add sys_wait.
+	* tests/test-passfd.c (main): Skip test on mingw, for now.
+	* doc/posix-headers/sys_socket.texi (sys/socket.h): Document the
+	partial 'struct msghdr' implementation.
+
+	sys_uio: new module
+	* modules/sys_uio: New module.
+	* modules/sys_uio-tests: Likewise.
+	* lib/sys_uio.in.h: New file.
+	* m4/sys_uio_h.m4: Likewise.
+	* tests/test-sys_uio.c: Likewise.
+	* doc/posix-headers/sys_uio.texi (sys/uio.h): Document it.
+	* MODULES.html.sh (systems lacking POSIX:2008): Likewise.
+
+2011-04-20  Jim Meyering  <meyering@redhat.com>
+
+	useless-if-before-free: avoid false-positive
+	* build-aux/useless-if-before-free: Adjust regexp for the non-brace
+	disjunct so that it too requires a terminating ";".  Without that,
+	this script would identify as useless one statement from gcc that
+	was not:
+	  if (aligned_ptr)
+	    free (((void **) aligned_ptr) [-1]);
+
+2011-04-20  Giuseppe Scrivano  <gscrivano@gnu.org>
+
+	doc: update users.txt.
+	* users.txt: Add barcode.
+
+2011-04-19  Bruno Haible  <bruno@clisp.org>
+
+	ioctl: Remove link dependency on native Windows.
+	* lib/fd-hook.h: Renamed from lib/close-hook.h.
+	(gl_close_fn, gl_ioctl_fn): New types.
+	(struct fd_hook): Renamed from struct close_hook. Change type of
+	private_close_fn field. Add private_ioctl_fn field.
+	(close_hook_fn): Add parameter for primary close method.
+	(execute_close_hooks, execute_all_close_hooks): Likewise.
+	(ioctl_hook_fn): New type.
+	(execute_ioctl_hooks, execute_all_ioctl_hooks): New declarations.
+	(register_fd_hook): Renamed from register_close_hook. Add ioctl_hook
+	argument.
+	(unregister_fd_hook): Renamed from unregister_close_hook.
+	* lib/fd-hook.c: Renamed from lib/close-hook.c.
+	Don't include <unistd.h>.
+	(close): Remove undef.
+	(anchor): Update.
+	(execute_close_hooks): Add argument for primary close method.
+	(execute_all_close_hooks): Likewise.
+	(execute_ioctl_hooks, execute_all_ioctl_hooks): New functions.
+	(register_fd_hook): Renamed from register_close_hook. Add ioctl_hook
+	argument. Allow each argument to be NULL.
+	(unregister_fd_hook): Renamed from unregister_close_hook.
+	* lib/close.c (rpl_close): Pass 'close' function pointer to
+	execute_all_close_hooks.
+	* lib/ioctl.c: Include <errno.h>, fd-hook.h.
+	(primary_ioctl): New function.
+	(ioctl): Don't call ioctlsocket here. Instead, call
+	execute_all_ioctl_hooks.
+	* lib/sockets.c (close_fd_maybe_socket): Add argument for primary
+	close method.
+	(ioctl_fd_maybe_socket): New function, with code from lib/ioctl.c.
+	(fd_sockets_hook): Renamed from close_sockets_hook.
+	(gl_sockets_startup, gl_sockets_cleanup): Update.
+	* modules/fd-hook: Renamed from modules/close-hook. Update.
+	* modules/close (Depends-on): Add fd-hook, remove close-hook.
+	* modules/sockets (Depends-on): Likewise.
+	* modules/ioctl (Depends-on): Add fd-hook.
+	* tests/test-nonblocking.c (main): Use GNULIB_TEST_SOCKET, not
+	GNULIB_SOCKET.
+
+2011-04-19  Bruno Haible  <bruno@clisp.org>
+
+	Move the support of O_NONBLOCK in open() to the 'open' module.
+	* modules/nonblocking (Depends-on): Remove 'open'.
+	* m4/nonblocking.m4 (gl_NONBLOCKING_IO_BODY): Set
+	gl_cv_have_open_O_NONBLOCK.
+	* m4/open.m4 (gl_FUNC_OPEN): Replace open() also when required for
+	O_NONBLOCK support.
+	* doc/posix-functions/open.texi: Document support for O_NONBLOCK.
+
+2011-04-17  Bruno Haible  <bruno@clisp.org>
+
+	pipe2: Simplify code.
+	* lib/pipe2.c (pipe2): Reduce code duplication.
+
+2011-04-17  Bruno Haible  <bruno@clisp.org>
+
+	nonblocking: Add comment.
+	* lib/fcntl.in.h (O_NONBLOCK): Add comment.
+
+2011-04-17  Bruno Haible  <bruno@clisp.org>
+
+	nonblocking: Add tests for sockets.
+	* tests/test-nonblocking-socket.sh: New file.
+	* tests/test-nonblocking-socket-main.c: New file.
+	* tests/test-nonblocking-socket-child.c: New file.
+	* tests/test-nonblocking-socket.h: New file.
+	* tests/socket-server.h: New file.
+	* tests/socket-client.h: New file.
+	* modules/nonblocking-socket-tests: New file.
+	* modules/nonblocking-tests (Depends-on): Add nonblocking-socket-tests.
+
+2011-04-17  Bruno Haible  <bruno@clisp.org>
+
+	nonblocking: Add tests for pipes.
+	* tests/test-nonblocking-pipe.sh: New file.
+	* tests/test-nonblocking-pipe-main.c: New file.
+	* tests/test-nonblocking-pipe-child.c: New file.
+	* tests/test-nonblocking-pipe.h: New file.
+	* tests/test-nonblocking-writer.h: New file.
+	* tests/test-nonblocking-reader.h: New file.
+	* tests/test-nonblocking-misc.h: New file.
+	* modules/nonblocking-pipe-tests: New file.
+	* modules/nonblocking-tests (Depends-on): Add nonblocking-pipe-tests.
+
+2011-04-16  Bruno Haible  <bruno@clisp.org>
+
+	gettext: Clarify the needed programmer actions.
+	* modules/gettext (Notice): New field.
+	Suggested by Ben Pfaff <blp@cs.stanford.edu>.
+
+2011-04-16  Bruno Haible  <bruno@clisp.org>
+
+	strchrnul: Tweak last commit.
+	* doc/glibc-functions/strchrnul.texi: Add more details about Cygwin
+	bug.
+	* lib/string.in.h (strchrnul): Use same arguments in _GL_FUNCDECL_RPL
+	as in _GL_FUNCDECL_SYS.
+	* m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Invoke gl_PREREQ_STRCHRNUL after
+	AC_LIBOBJ. When cross-compiling, say "guessing yes" not "yes".
+
+2011-04-15  Eric Blake  <eblake@redhat.com>
+
+	strchrnul: work around cygwin bug
+	* doc/glibc-functions/strchrnul.texi (strchrnul): Document bug.
+	* m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Detect it.
+	* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): New witness.
+	* modules/string (Makefile.am): Substitute it.
+	* lib/string.in.h (strchrnul): Use it.
+
+2011-04-15  Bruno Haible  <bruno@clisp.org>
+
+	Don't require lib/stdio-write.c when only module 'stdio' is used.
+	* m4/stdio_h.m4 (gl_STDIO_H): Move the AC_LIBOBJ back into the m4_ifdef
+	invocation.
+	Reported by Rob Vermaas <rob.vermaas@gmail.com>.
+
+2011-04-14  Bruno Haible  <bruno@clisp.org>
+
+	Support non-blocking pipe I/O in read() on native Windows.
+	* lib/unistd.in.h: Include <sys/types.h> also for 'read'.
+	(read): New declaration.
+	* lib/read.c: New file.
+	* lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT_SCANF,
+	_GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM): New macros.
+	(fgetc, fgets, fread, fscanf, getc, getchar, gets, scanf, vfscanf,
+	vscanf): New declarations.
+	* lib/stdio-read.c: New file.
+	* m4/read.m4: New file.
+	* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_READ,
+	REPLACE_READ.
+	* m4/stdio_h.m4 (gl_STDIO_H): Set GNULIB_FGETC, GNULIB_FGETS,
+	GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS,
+	GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF. In non-blocking I/O is
+	desired and needs workarounds, set REPLACE_STDIO_READ_FUNCS.
+	(gl_STDIO_H_DEFAULTS): Initialize GNULIB_FGETC, GNULIB_FGETS,
+	GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS,
+	GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS.
+	* modules/read: New file.
+	* modules/nonblocking (Files): Add lib/stdio-read.c.
+	* modules/unistd (Makefile.am): Substitute GNULIB_READ, REPLACE_READ.
+	* modules/stdio (Makefile.am): Substitute GNULIB_FGETC, GNULIB_FGETS,
+	GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS,
+	GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS.
+	* modules/pread (Depends-on): Add read.
+	* modules/safe-read (Depends-on): Likewise.
+	* tests/test-stdio-c++.cc (fgetc, fgets, fread, fscanf, getc, getchar,
+	gets, scanf, vfscanf, vscanf): Verify signatures.
+	* doc/posix-functions/read.texi: Mention 'nonblocking' module and
+	problem with non-blocking pipes.
+	* doc/posix-functions/fgetc.texi: Likewise.
+	* doc/posix-functions/fgets.texi: Likewise.
+	* doc/posix-functions/fread.texi: Likewise.
+	* doc/posix-functions/fscanf.texi: Likewise.
+	* doc/posix-functions/getc.texi: Likewise.
+	* doc/posix-functions/getchar.texi: Likewise.
+	* doc/posix-functions/gets.texi: Likewise.
+	* doc/posix-functions/scanf.texi: Likewise.
+	* doc/posix-functions/vfscanf.texi: Likewise.
+	* doc/posix-functions/vscanf.texi: Likewise.
+
+2011-04-14  Bruno Haible  <bruno@clisp.org>
+
+	Support non-blocking pipe I/O in write() on native Windows.
+	* lib/write.c (rpl_write): Split a write request that failed merely
+	because the byte count was larger than the pipe buffer's size.
+	* doc/posix-functions/write.texi: Mention the problem with large byte
+	counts.
+
+2011-04-14  Bruno Haible  <bruno@clisp.org>
+
+	wchar: Ensure that wchar_t gets defined on uClibc.
+	* lib/wchar.in.h: On uClibc, include <stddef.h>.
+	Reported by Giuseppe Scrivano <gscrivano@gnu.org>.
+
+2011-04-13  Bruno Haible  <bruno@clisp.org>
+
+	safe-write, full-read: Avoid unnecessary compilation units.
+	* modules/safe-write (Files): Add lib/safe-read.c, m4/safe-read.m4.
+	(Depends-on): Remove safe-read. Add ssize_t.
+	* modules/full-read (Files): Add lib/full-write.c.
+	(Depends-on): Add full-write.
+
+2011-04-13  Bruno Haible  <bruno@clisp.org>
+
+	Support non-blocking pipe I/O and SIGPIPE in pwrite().
+	* modules/pwrite (Depends-on): Add 'write'.
+
+2011-04-13  Bruno Haible  <bruno@clisp.org>
+
+	Support non-blocking pipe I/O in write() on native Windows.
+	* lib/unistd.in.h (write): Enable replacement also if
+	GNULIB_UNISTD_H_NONBLOCKING is 1.
+	* lib/write.c: Enable replacement also if GNULIB_NONBLOCKING.
+	(rpl_write): When failing to write on a non-blocking pipe, change
+	errno from ENOSPC to EAGAIN.
+	* lib/stdio.in.h (fprintf, fputc, fputs, fwrite, printf, putc,
+	putchar, puts, vfprintf, vprintf): Enable replacement also if
+	GNULIB_STDIO_H_NONBLOCKING is 1.
+	* lib/stdio-write.c: Enable replacements also if GNULIB_NONBLOCKING.
+	(CLEAR_ERRNO, HANDLE_ENOSPC): New macros.
+	(CLEAR_LastError, HANDLE_ERROR_NO_DATA): New macros, extracted from
+	CALL_WITH_SIGPIPE_EMULATION.
+	(CALL_WITH_SIGPIPE_EMULATION): Use them.
+	* m4/nonblocking.m4: New file.
+	* m4/write.m4 (gl_FUNC_WRITE): Enable REPLACE_WRITE also if required
+	for non-blocking I/O support.
+	* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize
+	GNULIB_UNISTD_H_NONBLOCKING.
+	* m4/stdio_h.m4 (gl_STDIO_H): Enable REPLACE_STDIO_WRITE_FUNCS also if
+	required for non-blocking I/O support.
+	(gl_STDIO_H_DEFAULTS): Initialize GNULIB_STDIO_H_NONBLOCKING.
+	* modules/nonblocking (Files): Add m4/nonblocking.m4,
+	lib/stdio-write.c, m4/asm-underscore.m4.
+	(Depends-on): Add stdio, unistd.
+	(configure.ac): Invoke gl_NONBLOCKING_IO. Define GNULIB_NONBLOCKING.
+	Set GNULIB_STDIO_H_NONBLOCKING, GNULIB_UNISTD_H_NONBLOCKING.
+	* modules/unistd (Makefile.am): Substitute GNULIB_UNISTD_H_NONBLOCKING.
+	* modules/stdio (Makefile.am): Substitute GNULIB_STDIO_H_NONBLOCKING.
+	* doc/posix-functions/fprintf.texi: Mention 'nonblocking' module and
+	problem with non-blocking pipes.
+	* doc/posix-functions/fputc.texi: Likewise.
+	* doc/posix-functions/fputs.texi: Likewise.
+	* doc/posix-functions/fwrite.texi: Likewise.
+	* doc/posix-functions/printf.texi: Likewise.
+	* doc/posix-functions/putc.texi: Likewise.
+	* doc/posix-functions/putchar.texi: Likewise.
+	* doc/posix-functions/puts.texi: Likewise.
+	* doc/posix-functions/vfprintf.texi: Likewise.
+	* doc/posix-functions/vprintf.texi: Likewise.
+	* doc/posix-functions/write.texi: Likewise.
+
+2011-04-10  Jim Meyering  <meyering@redhat.com>
+
+	maint.mk: prohibit doubled words
+	Detect them also when they're separated by a newline.
+	There are 3 ways to customize it:
+	  - disable the test on a per file basis, as usual with rules using
+	    $(VC_LIST_EXCEPT)
+	  - replace the default doubled-word-selecting regexp (affects all files)
+	  - ignore a particular file-vs-doubled-word match
+	I nearly used that last one to ignore the "is is" match in
+	coreutils' NEWS file, since the text was "ls -is is ..."
+	To do that, I would have added this line to cfg.mk:
+	  ignore_doubled_word_match_RE_ = ^NEWS:[0-9]+:is[ ]is$
+	but it would have ignored any "is is" match in NEWS.
+	Low probability, but still...
+	Instead, I changed the text, slightly:
+	  -  ls -is is now consistent with ls -lis in ignoring values returned
+	  +  "ls -is" is now consistent with ls -lis in ignoring values returned
+	* top/maint.mk (prohibit_double_word_RE_): Provide default.
+	(prohibit_doubled_word_): Define.
+	(sc_prohibit_doubled_word): New rule.
+	(sc_prohibit_the_the): Remove.  Subsumed by the above.
+
+2011-04-10  Jim Meyering  <meyering@redhat.com>
+
+	maint: fix doubled-word typo in comment
+	* m4/gethostname.m4: s/is is/it is/
+	* m4/getdomainname.m4: Likewise.
+
+2011-04-10  Jim Meyering  <meyering@redhat.com>
+
+	maint: remove doubled word: s/it it/it/
+	* lib/stat-time.h (get_stat_birthtime): s/it it/it/
+
+2011-04-10  Jim Meyering  <meyering@redhat.com>
+
+	maint.mk: remove useless semicolon and backslash
+	* top/maint.mk (sc_prohibit_empty_lines_at_EOF): Remove stray
+	semicolon and backslash.
+
+2011-04-10  Bruno Haible  <bruno@clisp.org>
+
+	stdint test: Fix compilation failure on OSF/1 with DTK compiler.
+	* modules/stdint-tests (Depends-on): Add wchar.
+
+2011-04-10  Jim Meyering  <meyering@redhat.com>
+
+	maint: remove doubled words in comments, e.g., s/a a/a/
+	* lib/strptime.c (day_of_the_week): s/the the/the/
+	* tests/test-chown.h (test_chown): s/a a/a/
+
+	test-chown.h: correct a cast
+	* tests/test-chown.h (test_chown): Cast -1 to gid_t (not uid_t)
+	when the destination is a stat.st_gid.
+
+2011-04-09  Mats Erik Andersson  <mats.andersson@gisladisker.se>  (tiny change)
+
+	getaddrinfo: Fix test for sa_len member.
+	* m4/getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): When testing for sa_len,
+	include <sys/types.h> before <sys/socket.h>.
+
+2011-04-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+	maint: change "can not" to "cannot"
+	* doc/posix-functions/iconv.texi (iconv): This one crossed line
+	boundaries.
+
+2011-04-09  Jim Meyering  <meyering@redhat.com>
+
+	maint: change "a a" to "a"
+	* tests/test-lchown.h (test_lchown): s/a a/a/
+
+	maint.mk: prohibit \<the the\>
+	* top/maint.mk (sc_prohibit_the_the): New rule.
+
+	maint: fix "the the" in comment
+	* lib/count-one-bits.h: s/the the/the/
+
+	maint: change "can not" to "cannot"
+	But do not change the occurrences in maintain.texi or in
+	build-aux/po/Makefile.in.in, which I presume comes from gettext.
+	* doc/gnulib-tool.texi: s/can not/cannot/
+	* doc/posix-functions/accept.texi (accept): Likewise.
+	* doc/posix-functions/socket.texi (socket): Likewise.
+	* lib/mbrtowc.c: Likewise.
+
+	maint.mk: prohibit use of "can not"
+	* top/maint.mk (sc_prohibit_can_not): New rule.
+	Writing "can not" (rather than "cannot") is too common.  Prohibit it.
+
+2011-04-09  Bruno Haible  <bruno@clisp.org>
+
+	careadlinkat: Guard against misuse of careadlinkatcwd.
+	* lib/careadlinkat.c: Include <stdlib.h>.
+	(careadlinkatcwd): Check that the fd argument is as expected.
+
+2011-04-09  Bruno Haible  <bruno@clisp.org>
+
+	careadlinkat: Use common coding style.
+	* lib/careadlinkat.c: Move gnulib includes after system includes.
+
+2011-04-09  Bruno Haible  <bruno@clisp.org>
+
+	careadlinkat: Clarify specification.
+	* lib/careadlinkat.h (careadlinkat): Clarify preadlinkat argument.
+	(careadlinkatcwd): Add comment.
+	* lib/careadlinkat.c (careadlinkat): Clarify preadlinkat argument.
+
+2011-04-09  Bruno Haible  <bruno@clisp.org>
+
+	areadlinkat: Avoid link error on many platforms.
+	* modules/areadlinkat (Depends-on): Add areadlink.
+
+2011-04-09  Bruno Haible  <bruno@clisp.org>
+
+	allocator, careadlinkat: Fix double-inclusion guard.
+	* lib/allocator.h: Fix double-inclusion guard.
+	* lib/careadlinkat.h: Likewise.
+
+2011-04-09  Bruno Haible  <bruno@clisp.org>
+
+	relocatable-prog-wrapper: Update after module 'areadlink' changed.
+	* lib/relocwrapper.c: Update dependencies hierarchy.
+	* build-aux/install-reloc: Update list of files to be compiled.
+	* modules/relocatable-prog-wrapper (Files): Add lib/careadlinkat.[hc],
+	lib/allocator.[hc].
+
+2011-04-08  Eric Blake  <eblake@redhat.com>
+
+	strftime: silence gnulib-tool warning
+	* modules/strftime-tests (Depends-on): Drop automatic dependency.
+
+2011-04-08  Bruno Haible  <bruno@clisp.org>
+
+	verify: Fix syntax error with GCC 4.6 in C++ mode.
+	* lib/verify.h (HAVE__STATIC_ASSERT): Don't define in C++ mode.
+	(HAVE_STATIC_ASSERT): New macro.
+	(verify_true, verify): Use 'static_assert' if it is supported and
+	'_Static_assert' is not supported.
+
+2011-04-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+	allocator: New module.
+	* modules/allocator, lib/allocator.c: New files.
+	* lib/allocator.h (stdlib_allocator): New decl.
+	* lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC, standard_allocator):
+	Remove.  Do not include <stdlib.h>.
+	(careadlinkat): Use stdlib_allocator instead of rolling our own.
+	* modules/careadlinkat (Files): Remove lib/allocator.h.
+	(Depends-on): Add allocator.
+
+	stdlib: let modules use system malloc, realloc
+	* lib/stdlib.in.h (malloc, realloc): Don't #define or add warnings
+	if !_GL_USE_STDLIB_ALLOC.
+	(malloc, realloc): Limit this change to a smaller scope.
+
+	* lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define.
+	(malloc, realloc): Don't #undef; no longer needed.
+	* lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
+	* lib/progreloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
+	* lib/setenv.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise.
+	* lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
+	* lib/relocatable.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
+	* lib/relocwrapper.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
+	* lib/malloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
+	* lib/realloc.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise.
+
+	careadlinkat: rename members to avoid problem
+	* lib/allocator.h (struct allocator): Rename members from
+	malloc/realloc to allocate/reallocate, to avoid problems if malloc
+	and realloc are #define'd.  Reported by Eric Blake in
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00091.html>.
+	* lib/careadlinkat.c (careadlinkat): Adjust to renaming.
+
+2011-04-08  Eric Blake  <eblake@redhat.com>
+
+	nonblocking: reduce dependency
+	* tests/test-nonblocking.c: Only test sockets when in use.
+	* modules/nonblocking-tests (Depends-on): Drop socket.
+	(Makefile.am): Link even if sockets are not present.
+	* modules/pipe2-tests (Makefile.am): Likewise.
+	* lib/ioctl.c (ioctl) [WIN32]: Fail if sockets are not also in use.
+
+	pipe2: fix O_NONBLOCK support on mingw
+	* modules/pipe2 (Depends-on): Add nonblocking.
+	* lib/pipe2.c (pipe2) [WIN32]: Add O_NONBLOCK support.
+	* tests/test-pipe2.c (is_nonblocking): Adjust test accordingly.
+	* tests/test-nonblocking.c (main): Likewise.
+	* modules/pipe2-tests (Makefile.am): Avoid link failure.
+
+	fcntl-h: fix O_ACCMODE on cygwin
+	* doc/posix-headers/fcntl.texi (fcntl.h): Document the bug.
+	* lib/fcntl.in.h (O_ACCMODE): Fix it.
+
+	pipe-filter: drop O_NONBLOCK workarounds
+	* modules/pipe-filter-gi (Depends-on): Add fcntl-h.
+	* modules/pipe-filter-ii (Depends-on): Likewise.
+	* lib/pipe-filter-aux.h (O_NONBLOCK): Delete workaround.
+
+	nonblocking: provide O_NONBLOCK for mingw
+	* modules/nonblocking (Depends-on): Add open.
+	(configure.ac): Set new witness macro.
+	* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Provide default for it.
+	* modules/fcntl-h (Makefile.am): Substitute it.
+	* lib/fcntl.in.h (O_NONBLOCK): Guarantee non-zero definition when
+	nonblocking module is in use.
+	* lib/nonblocking.c: Adjust portability test.
+	* lib/open.c (open): Don't let native open see gnulib flag.
+	* tests/test-fcntl-h.c (main): Enhance test.
+	* tests/test-open.h (test_open): Likewise.
+	* doc/posix-headers/fcntl.texi (fcntl.h): Document the replacement.
+
+	careadlinkat: fix compilation error on mingw
+	* lib/careadlinkat.c (standard_allocator): Avoid renaming fields
+	within struct allocator.
+
+2011-04-06  Eric Blake  <eblake@redhat.com>
+
+	binary-io: relicense under LGPLv2+
+	* modules/binary-io (License): Relax to LGPLv2+.
+	Requested for libvirt, and required by pipe2.
+
+2011-04-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+	verify: use _Static_assert if available
+	* lib/verify.h (HAVE__STATIC_ASSERT): New macro.
+	(verify_true, verify): Use it if available.  This generates better
+	diagnostics with GCC 4.6.0 and later.
+
+2011-04-05  Bruno Haible  <bruno@clisp.org>
+
+	Remove leftover generated .h files after config.status changed.
+
+	* m4/alloca.m4 (gl_FUNC_ALLOCA): New automake conditional
+	GL_GENERATE_ALLOCA_H.
+	* modules/alloca-opt (Makefile.am): Remove alloca.h if
+	GL_GENERATE_ALLOCA_H evaluates to false.
+
+	* m4/argz.m4 (gl_FUNC_ARGZ): New automake conditional
+	GL_GENERATE_ARGZ_H.
+	* modules/argz (Makefile.am): Remove argz.h if GL_GENERATE_ARGZ_H
+	evaluates to false.
+
+	* m4/byteswap.m4 (gl_BYTESWAP): New automake conditional
+	GL_GENERATE_BYTESWAP_H.
+	* modules/byteswap (Makefile.am): Remove byteswap.h if
+	GL_GENERATE_BYTESWAP_H evaluates to false.
+
+	* m4/errno_h.m4 (gl_HEADER_ERRNO_H): New automake conditional
+	GL_GENERATE_ERRNO_H.
+	* modules/errno (Makefile.am): Remove errno.h if GL_GENERATE_ERRNO_H
+	evaluates to false.
+
+	* m4/float_h.m4 (gl_FLOAT_H): New automake conditional
+	GL_GENERATE_FLOAT_H.
+	* modules/float (Makefile.am): Remove float.h if GL_GENERATE_FLOAT_H
+	evaluates to false.
+
+	* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): New automake conditional
+	GL_GENERATE_FNMATCH_H.
+	* modules/fnmatch (Makefile.am): Remove fnmatch.h if
+	GL_GENERATE_FNMATCH_H evaluates to false.
+
+	* m4/glob.m4 (gl_GLOB_SUBSTITUTE, gl_GLOB): New automake conditional
+	GL_GENERATE_GLOB_H.
+	* modules/glob (Makefile.am): Remove glob.h if GL_GENERATE_GLOB_H
+	evaluates to false.
+
+	* m4/iconv_h.m4 (gl_REPLACE_ICONV_H, gl_ICONV_H_DEFAULTS): New
+	automake conditional GL_GENERATE_ICONV_H.
+	* modules/iconv-h (Makefile.am): Remove iconv.h if GL_GENERATE_ICONV_H
+	evaluates to false.
+
+	* m4/netinet_in_h.m4 (gl_HEADER_NETINET_IN): New automake conditional
+	GL_GENERATE_NETINET_IN_H.
+	* modules/netinet_in (Makefile.am): Remove netinet/in.h if
+	GL_GENERATE_NETINET_IN_H evaluates to false.
+
+	* m4/pthread.m4 (gl_PTHREAD_CHECK): Set PTHREAD_H here. New automake
+	conditional GL_GENERATE_PTHREAD_H.
+	(gl_PTHREAD_DEFAULTS): Don't set PTHREAD_H here.
+	* modules/pthread (Makefile.am): Remove pthread.h if
+	GL_GENERATE_PTHREAD_H evaluates to false.
+
+	* m4/sched_h.m4 (gl_SCHED_H): New automake conditional
+	GL_GENERATE_SCHED_H.
+	* modules/sched (Makefile.am): Remove sched.h if GL_GENERATE_SCHED_H
+	evaluates to false.
+
+	* m4/selinux-context-h.m4 (gl_HEADERS_SELINUX_CONTEXT_H): New automake
+	conditional GL_GENERATE_SELINUX_CONTEXT_H.
+	* modules/selinux-h (Makefile.am): Remove selinux/context.h if
+	GL_GENERATE_SELINUX_CONTEXT_H evaluates to false.
+
+	* m4/stdarg.m4 (gl_STDARG_H): New automake conditional
+	GL_GENERATE_STDARG_H.
+	* modules/stdarg (Makefile.am): Remove stdarg.h if
+	GL_GENERATE_STDARG_H evaluates to false.
+
+	* m4/stdbool.m4 (AM_STDBOOL_H): New automake conditional
+	GL_GENERATE_STDBOOL_H.
+	* modules/stdbool (Makefile.am): Remove stdbool.h if
+	GL_GENERATE_STDBOOL_H evaluates to false.
+
+	* m4/stddef_h.m4 (gl_STDDEF_H): Set STDDEF_H here. New automake
+	conditional GL_GENERATE_STDDEF_H.
+	(gl_STDDEF_H_DEFAULTS): Don't set STDDEF_H here.
+	* modules/stddef (Makefile.am): Remove stddef.h if
+	GL_GENERATE_STDDEF_H evaluates to false.
+
+	* m4/stdint.m4 (gl_STDINT_H): New automake conditional
+	GL_GENERATE_STDINT_H.
+	* modules/stdint (Makefile.am): Remove stdint.h if
+	GL_GENERATE_STDINT_H evaluates to false.
+
+	* m4/sysexits.m4 (gl_SYSEXITS): New automake conditional
+	GL_GENERATE_SYSEXITS_H.
+	* modules/sysexits (Makefile.am): Remove sysexits.h if
+	GL_GENERATE_SYSEXITS_H evaluates to false.
+
+	Reported by Karl Berry and Ralf Wildenhues.
+
+2011-04-05  Bruno Haible  <bruno@clisp.org>
+
+	Ensure to rebuild generated .h files when config.status has changed.
+	* modules/arpa_inet (Makefile.am): Add dependency from .h file to
+	config.status.
+	* modules/ctype (Makefile.am): Likewise.
+	* modules/dirent (Makefile.am): Likewise.
+	* modules/errno (Makefile.am): Likewise.
+	* modules/fcntl-h (Makefile.am): Likewise.
+	* modules/float (Makefile.am): Likewise.
+	* modules/getopt-posix (Makefile.am): Likewise.
+	* modules/glob (Makefile.am): Likewise.
+	* modules/iconv-h (Makefile.am): Likewise.
+	* modules/inttypes (Makefile.am): Likewise.
+	* modules/langinfo (Makefile.am): Likewise.
+	* modules/locale (Makefile.am): Likewise.
+	* modules/math (Makefile.am): Likewise.
+	* modules/netdb (Makefile.am): Likewise.
+	* modules/netinet_in (Makefile.am): Likewise.
+	* modules/poll-h (Makefile.am): Likewise.
+	* modules/pthread (Makefile.am): Likewise.
+	* modules/pty (Makefile.am): Likewise.
+	* modules/sched (Makefile.am): Likewise.
+	* modules/search (Makefile.am): Likewise.
+	* modules/selinux-h (Makefile.am): Likewise.
+	* modules/signal (Makefile.am): Likewise.
+	* modules/spawn (Makefile.am): Likewise.
+	* modules/stdarg (Makefile.am): Likewise.
+	* modules/stdbool (Makefile.am): Likewise.
+	* modules/stddef (Makefile.am): Likewise.
+	* modules/stdint (Makefile.am): Likewise.
+	* modules/stdio (Makefile.am): Likewise.
+	* modules/stdlib (Makefile.am): Likewise.
+	* modules/string (Makefile.am): Likewise.
+	* modules/strings (Makefile.am): Likewise.
+	* modules/sys_file (Makefile.am): Likewise.
+	* modules/sys_ioctl (Makefile.am): Likewise.
+	* modules/sys_select (Makefile.am): Likewise.
+	* modules/sys_socket (Makefile.am): Likewise.
+	* modules/sys_stat (Makefile.am): Likewise.
+	* modules/sys_time (Makefile.am): Likewise.
+	* modules/sys_times (Makefile.am): Likewise.
+	* modules/sys_utsname (Makefile.am): Likewise.
+	* modules/sys_wait (Makefile.am): Likewise.
+	* modules/sysexits (Makefile.am): Likewise.
+	* modules/termios (Makefile.am): Likewise.
+	* modules/time (Makefile.am): Likewise.
+	* modules/unistd (Makefile.am): Likewise.
+	* modules/wchar (Makefile.am): Likewise.
+	* modules/wctype-h (Makefile.am): Likewise.
+	Reported by Karl Berry, Eric Blake, and Ralf Wildenhues.
+
+2011-04-05  Bruno Haible  <bruno@clisp.org>
+
+	pipe2: Relicense under LGPLv2+.
+	* modules/pipe2 (License): Change to LGPLv2+.
+	Requested by Eric Blake, for libvirt.
+
+2011-04-05  Bruce Korb  <bkorb@gnu.org>
+
+	bootstrap: compute gnulib_extra_files after updating build_aux
+	* build-aux/bootstrap (gnulib_extra_files): bootstrap.conf may
+	change build_aux or also supply gnulib_extra_files.  Handle correctly.
+
+2011-04-05  Eric Blake  <eblake@redhat.com>
+
+	bootstrap: preserve git whitelist item sorting
+	* build-aux/bootstrap (sort_patterns): New function.
+	(insert_sorted_if_absent): Use it to sink ! lines to the bottom.
+
+2011-04-05  Simon Josefsson  <simon@josefsson.org>
+
+	* top/maint.mk (sc_prohibit_empty_lines_at_EOF): Don't trigger
+	sc_space_tab check.
+
+2011-04-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+	areadlink, areadlinkat: rewrite in terms of careadlinkat
+	* lib/areadlink.c, lib/areadlinkat.c: Include careadlinkat.h
+	instead of errno.h, limits.h, stdint.h, stdlib.h, string.h, unistd.h.
+	(SSIZE_MAX, INITIAL_BUF_SIZE): Remove.
+	(malloc, realloc): Remove #undefs.
+	(areadlink, areadlinkat): Rewrite in terms of careadlinkat.
+	* modules/areadlink (Depends-on): Add careadlinkat.  Remove
+	readlink, ssize_t, stdint, unistd.
+	* modules/areadlinkat (Depends-on): Add careadlinkat.  Remove
+	areadlink, stdint.
+
+	careadlinkat: new module
+	* lib/allocator.h, lib/careadlinkat.h, lib/careadlinkat.c:
+	* modules/careadlinkat: New files, written by me with
+	a review and feedback from Ben Pfaff in
+	<http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00008.html>.
+
 2011-04-01  Bruno Haible  <bruno@clisp.org>
 
 	wmemchr, wcschr, wcsrchr, wcspbrk, wcsstr: Avoid errors in C++ mode.
@@ -606,7 +2252,7 @@
 	Reported by Tom G. Christensen <tgc@jupiterrise.com>.
 
 2011-03-20  Paul Eggert  <eggert@cs.ucla.edu>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	socklen: do not depend on sys_socket
 	While trying to modify Emacs to use gnulib's socklen module,
@@ -643,7 +2289,7 @@
 	* m4/socklen.m4: Update comment about platforms.
 
 2011-03-19  Paul Eggert  <eggert@cs.ucla.edu>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	inet_ntop, inet_pton: Simplify.
 	* modules/inet_ntop (Depends-on): Remove socklen, since sys_socket is
@@ -652,7 +2298,7 @@
 	* lib/arpa_inet.in.h: Adjust comment.
 
 2011-03-19  Paul Eggert  <eggert@cs.ucla.edu>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	netdb: Simplify.
 	* modules/netdb (Depends-on): Remove socklen, since sys_socket is
@@ -741,7 +2387,7 @@
 	(check): Depend on the new variable, not the hard-coded list.
 
 2011-03-13  Bastien Roucariès  <roucaries.bastien@gmail.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	passfd module, part 3.
 	* lib/passfd.h (recvfd): Add a flags argument.
@@ -917,8 +2563,8 @@
 	Suggested by Simon Josefsson <simon@josefsson.org>.
 
 2011-02-28  Corinna Vinschen  <vinschen@redhat.com>  (tiny change)
-            Charles Wilson  <cygwin@cwilson.fastmail.fm>  (tiny change)
-            Bruno Haible  <bruno@clisp.org>  (tiny change)
+	    Charles Wilson  <cygwin@cwilson.fastmail.fm>  (tiny change)
+	    Bruno Haible  <bruno@clisp.org>  (tiny change)
 
 	On Cygwin, use /proc file system instead of win32 API.
 	* lib/relocatable.c: On Cygwin, use file names from /proc, rather than
@@ -2765,7 +4411,7 @@
 	* lib/strerror_r.c (strerror_r): Fix return type.
 
 2011-01-21  Pádraig Brady  <P@draigBrady.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	uN_strstr: New unit tests.
 	* modules/unistr/u8-strstr-tests: New file.
@@ -2777,7 +4423,7 @@
 	* tests/unistr/test-u32-strstr.c: New file.
 
 2011-01-21  Pádraig Brady  <P@draigBrady.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Make uN_strstr functions O(n) worst-case.
 	* lib/unistr/u-strstr.h (FUNC): In the 8-bit case, use strstr. In the
@@ -2801,7 +4447,7 @@
 	(configure.ac): Update required libunistring version.
 
 2011-01-21  Pádraig Brady  <P@draigBrady.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Prepare for faster uN_strstr functions.
 	* lib/str-kmp.h: Support definable UNITs.
@@ -4344,7 +5990,7 @@
 	http://sourceware.org/bugzilla/show_bug.cgi?id=12348
 
 2010-12-28  Bruno Haible  <bruno@clisp.org>
-            Paul Eggert <eggert@cs.ucla.edu>
+	    Paul Eggert <eggert@cs.ucla.edu>
 
 	linkat: Make implementation robust against system behaviour variations.
 	* m4/link-follow.m4 (gl_FUNC_LINK_FOLLOWS_SYMLINK): Define
@@ -5377,7 +7023,7 @@
 	relate to each other.
 
 2010-12-15  Pádraig Brady <P@draigBrady.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Improve cross-compilation guesses for uClibc.
 	* m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): When cross-compiling, assume
@@ -5613,7 +7259,7 @@
 	* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Fix typo.
 
 2010-11-28  Bruno Haible  <bruno@clisp.org>
-            Paul Eggert  <eggert@cs.ucla.edu>
+	    Paul Eggert  <eggert@cs.ucla.edu>
 
 	Tests for module 'getdomainname'.
 	* modules/getdomainname-tests: New file.
@@ -5621,7 +7267,7 @@
 	tests/test-gethostname.c.
 
 2010-11-28  Bruno Haible  <bruno@clisp.org>
-            Paul Eggert  <eggert@cs.ucla.edu>
+	    Paul Eggert  <eggert@cs.ucla.edu>
 
 	getdomainname: Use the system function when possible.
 	* lib/unistd.in.h: Include <netdb.h>, for getdomainname's declaration.
@@ -7169,7 +8815,7 @@
 	styles, and some unnecessary blank lines.
 
 2010-10-03  Bruno Haible  <bruno@clisp.org>
-            Joachim Schmitz  <schmitz@hp.com>  (tiny change)
+	    Joachim Schmitz  <schmitz@hp.com>  (tiny change)
 
 	acl: Add support for ACLs on NonStop Kernel.
 	* m4/acl.m4 (gl_FUNC_ACL): For Solaris, test for facl(), not for acl().
@@ -7441,7 +9087,7 @@
 	Reported by Paul Eggert.
 
 2010-09-22  Pádraig Brady  <P@draigbrady.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Fix endless loop in mbmemcasecoll.
 	* lib/mbmemcasecoll.c (apply_towlower): When mbrtowc returns 0, copy 1
@@ -8217,7 +9863,7 @@
 	Reported by Johan Hattne <johan.hattne@utsouthwestern.edu>.
 
 2010-08-29  Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Make the module 'realloc-gnu' work again on AIX and OSF/1.
 	* m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Define HAVE_REALLOC_GNU instead
@@ -8228,7 +9874,7 @@
 	* modules/realloc-gnu (configure.ac): Use gl_MODULE_INDICATOR.
 
 2010-08-29  Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Make the module 'calloc-gnu' work again on AIX and OSF/1.
 	* m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Define HAVE_CALLOC_GNU instead of
@@ -8239,7 +9885,7 @@
 	* modules/calloc-gnu (configure.ac): Invoke gl_MODULE_INDICATOR.
 
 2010-08-29  Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Make the module 'malloc-gnu' work again on AIX and OSF/1.
 	* m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Define HAVE_MALLOC_GNU instead of
@@ -8315,8 +9961,8 @@
 	* lib/read-file.c (fread_file): Shrink the buffer at the end.
 
 2010-08-28  Giuseppe Scrivano  <gscrivano@gnu.org>
-            Eric Blake  <eblake@redhat.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Eric Blake  <eblake@redhat.com>
+	    Bruno Haible  <bruno@clisp.org>
 
 	read-file: Avoid memory reallocations with regular files.
 	* lib/read-file.c: Include <sys/stat.h>, <stdio.h>, <stdint.h>.
@@ -8654,7 +10300,7 @@
 	(Match-end-of-line Operator): Mention 'not_eol'.
 
 2010-08-14  Brian Gough  <bjg@gnu.org>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	git-merge-changelog: add doc relating to use with bzr and hg.
 	* lib/git-merge-changelog.c: Add comments regarding bzr, hg, diff3.
@@ -9345,7 +10991,7 @@
 	* modules/strtod-tests (Makefile.am): Likewise.
 
 2010-07-11  Pádraig Brady  <P@draigBrady.com>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	unistr/u8-strchr: Optimize ASCII argument case.
 	* lib/unistr/u8-strchr.c (u8_strchr): For ASCII arguments, use strchr.
@@ -9703,7 +11349,7 @@
 	* tests/test-inttostr.c: New file.  Test these functions.
 
 2010-06-09  Ben Pfaff  <blp@cs.stanford.edu>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Add "Extending Gnulib" chapter to manual.
 	* doc/gnulib.texi (Writing Modules): Add cross-reference to new
@@ -9743,7 +11389,7 @@
 	Suggested by Eric Blake.
 
 2010-06-04  Martin Lambers  <marlam@marlam.de>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	havelib: Allow library names with '+' characters.
 	* m4/lib-link.m4 (AC_LIB_LINKFLAGS, AC_LIB_HAVE_LINKFLAGS,
@@ -9999,7 +11645,7 @@
 	* modules/libunistring-optional (Files): Likewise.
 
 2010-05-18  Paolo Bonzini  <bonzini@gnu.org>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	New module 'libunistring-optional'.
 	* modules/libunistring-optional: New file.
@@ -11551,7 +13197,7 @@
 	(func_import): Set the excl_*_tests variables to empty.
 
 2010-04-25  Simon Josefsson  <simon@josefsson.org>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Work around a MacOS X 10.4 bug with openpty.
 	* doc/glibc-functions/openpty.texi: Mention the MacOS X 10.4 bug.
@@ -11620,7 +13266,7 @@
 	EPIPE.
 
 2010-04-20  Simon Josefsson  <simon@josefsson.org>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	visibility: Don't use -fvisibility if it leads to a warning.
 	* m4/visibility.m4 (gl_VISIBILITY): Check whether -Werror is usable. If
@@ -11656,7 +13302,7 @@
 	Reported by Ian Beckwith <ianb@erislabs.net>.
 
 2010-04-18  Andreas Gruenbacher  <agruen@suse.de>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	diffseq: Accommodate use-case with abstract arrays.
 	* lib/diffseq.h (struct context): Remove xvec, yvec fields if ELEMENT
@@ -11807,7 +13453,7 @@
 	declared.
 
 2010-04-11  Paolo Bonzini  <bonzini@gnu.org>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	libunistring: Improve configure output.
 	* m4/libunistring.m4 (gl_LIBUNISTRING): Check for libiconv first.
@@ -12230,14 +13876,14 @@
 	Reported by Hauke Fath <hauke@espresso.rhein-neckar.de>.
 
 2010-04-04  Hauke Fath  <hauke@espresso.rhein-neckar.de>  (tiny change)
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	wchar: Port to NetBSD 1.5.
 	* lib/wchar.in.h (WEOF): Provide fallback also when wint_t exists.
 	* lib/wctype.in.h (WEOF): Likewise.
 
 2010-04-04  Hauke Fath  <hauke@espresso.rhein-neckar.de>  (tiny change)
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Port extended stdio to NetBSD 1.5.
 	* lib/stdio-impl.h [NetBSD]: Include <sys/param.h>.
@@ -13018,7 +14664,7 @@
 	$(LIBSOCKET).
 
 2010-03-28  Bruno Haible  <bruno@clisp.org>
-            Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+	    Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
 	lib-ignore: Determine different options for different compilers.
 	* m4/lib-ignore.m4 (gl_IGNORE_UNUSED_LIBRARIES): Set a variable which
--- a/DEPENDENCIES	Fri Apr 01 16:04:45 2011 -0700
+++ b/DEPENDENCIES	Fri May 06 08:15:59 2011 -0700
@@ -90,7 +90,9 @@
     http://ftp.gnu.org/gnu/grep/
     ftp://ftp.gnu.org/gnu/grep/
 
-* GNU gettext 0.16.1.
+* GNU gettext.
+  + Always use the newest available gettext release, see
+    <http://www.gnu.org/software/gnulib/manual/html_node/gettextize-and-autopoint.html>.
   + Recommended.
     Needed if you use modules that use internationalization (many do).
   + Homepage:
--- a/MODULES.html.sh	Fri Apr 01 16:04:45 2011 -0700
+++ b/MODULES.html.sh	Fri May 06 08:15:59 2011 -0700
@@ -2353,6 +2353,7 @@
   func_module futimens
   func_module getaddrinfo
   func_module getcwd
+  func_module getcwd-lgpl
   func_module getgroups
   func_module gethostname
   func_module getlogin
@@ -2464,6 +2465,7 @@
   func_module sys_stat
   func_module sys_time
   func_module sys_times
+  func_module sys_uio
   func_module sys_utsname
   func_module sys_wait
   func_module tsearch
@@ -3474,6 +3476,7 @@
   func_module gnupload
   func_module maintainer-makefile
   func_module mktempd
+  func_module readme-release
   func_module update-copyright
   func_module useless-if-before-free
   func_module vc-list-files
--- a/NEWS	Fri Apr 01 16:04:45 2011 -0700
+++ b/NEWS	Fri May 06 08:15:59 2011 -0700
@@ -12,6 +12,20 @@
 
 Date        Modules         Changes
 
+2011-05-02  exit            The module is removed.  It was deprecated
+                            on 2010-03-05.  Use 'stdlib' directly instead.
+
+2011-04-27  mgetgroups      The 'xgetgroups' function has been split into
+                            a new 'xgetgroups' module.
+
+2011-04-27  save-cwd        This module pulls in fewer dependencies by
+                            default; to retain robust handling of directories
+                            with an absolute name longer than PATH_MAX, you
+                            must now explicitly include the 'getcwd' module.
+
+2011-04-19  close-hook      This module has been renamed to 'fd-hook' and
+                            generalized.
+
 2011-03-08  regex-quote     The last argument is no longer an 'int cflags'
                             but instead a pointer to a previously constructed
                             'struct regex_quote_spec'.
--- a/build-aux/announce-gen	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/announce-gen	Fri May 06 08:15:59 2011 -0700
@@ -3,7 +3,7 @@
     if 0;
 # Generate a release announcement message.
 
-my $VERSION = '2010-05-03 20:17'; # UTC
+my $VERSION = '2011-04-29 21:01'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -106,7 +106,7 @@
       my $t = `$cmd`;
       # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
       $@
-	and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
+        and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
       chomp $t;
       $t =~ s/^([\d.]+[MkK]).*/${1}B/;
       $res{$f} = $t;
@@ -128,12 +128,12 @@
   foreach my $url (@{$url})
     {
       for my $file (@file)
-	{
-	  print "  $url/$file";
-	  print "   (", $$size{$file}, ")"
-	    if exists $$size{$file};
-	  print "\n";
-	}
+        {
+          print "  $url/$file";
+          print "   (", $$size{$file}, ")"
+            if exists $$size{$file};
+          print "\n";
+        }
     }
   print "\n";
 }
@@ -154,17 +154,17 @@
   foreach my $meth (qw (md5 sha1))
     {
       foreach my $f (@file)
-	{
-	  open IN, '<', $f
-	    or die "$ME: $f: cannot open for reading: $!\n";
-	  binmode IN;
-	  my $dig =
-	    ($meth eq 'md5'
-	     ? Digest::MD5->new->addfile(*IN)->hexdigest
-	     : Digest::SHA1->new->addfile(*IN)->hexdigest);
-	  close IN;
-	  print "$dig  $f\n";
-	}
+        {
+          open IN, '<', $f
+            or die "$ME: $f: cannot open for reading: $!\n";
+          binmode IN;
+          my $dig =
+            ($meth eq 'md5'
+             ? Digest::MD5->new->addfile(*IN)->hexdigest
+             : Digest::SHA1->new->addfile(*IN)->hexdigest);
+          close IN;
+          print "$dig  $f\n";
+        }
     }
   print "\n";
 }
@@ -180,7 +180,10 @@
 {
   my ($news_file, $prev_version, $curr_version) = @_;
 
-  print "\n$news_file\n\n";
+  my $news_name = $news_file;
+  $news_name =~ s|^\./||;
+
+  print "\n$news_name\n\n";
 
   # Print all lines from $news_file, starting with the first one
   # that mentions $curr_version up to but not including
@@ -194,24 +197,24 @@
   while (defined (my $line = <NEWS>))
     {
       if ( ! $in_items)
-	{
-	  # Match lines like these:
-	  # * Major changes in release 5.0.1:
-	  # * Noteworthy changes in release 6.6 (2006-11-22) [stable]
-	  $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
-	    or next;
-	  $in_items = 1;
-	  print $line;
-	}
+        {
+          # Match lines like these:
+          # * Major changes in release 5.0.1:
+          # * Noteworthy changes in release 6.6 (2006-11-22) [stable]
+          $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
+            or next;
+          $in_items = 1;
+          print $line;
+        }
       else
-	{
-	  # This regexp must not match version numbers in NEWS items.
-	  # For example, they might well say `introduced in 4.5.5',
-	  # and we don't want that to match.
-	  $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
-	    and last;
-	  print $line;
-	}
+        {
+          # This regexp must not match version numbers in NEWS items.
+          # For example, they might well say `introduced in 4.5.5',
+          # and we don't want that to match.
+          $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
+            and last;
+          print $line;
+        }
     }
   close NEWS;
 
@@ -229,8 +232,8 @@
   use File::Find;
   my @changelog;
   find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
-			  and push @changelog, $File::Find::name}},
-	'.');
+                          and push @changelog, $File::Find::name}},
+        '.');
 
   # If there are no ChangeLog files, we're done.
   @changelog
@@ -255,7 +258,7 @@
       my $dot_slash = $d eq '.' ? $d : "./$d";
       my $target = "$dot_slash/ChangeLog";
       delete $changelog{$target}
-	and push @reordered, $target;
+        and push @reordered, $target;
     }
 
   # Append any remaining ChangeLog files.
@@ -282,20 +285,20 @@
   while (defined (my $line = <DIFF>))
     {
       if ($line =~ /^\+\+\+ /)
-	{
-	  my $separator = "*"x70 ."\n";
-	  $line =~ s///;
-	  $line =~ s/\s.*//;
-	  $prev_printed_line_empty
-	    or print "\n";
-	  print $separator, $line, $separator;
-	}
+        {
+          my $separator = "*"x70 ."\n";
+          $line =~ s///;
+          $line =~ s/\s.*//;
+          $prev_printed_line_empty
+            or print "\n";
+          print $separator, $line, $separator;
+        }
       elsif ($line =~ /^\+/)
-	{
-	  $line =~ s///;
-	  print $line;
-	  $prev_printed_line_empty = ($line =~ /^$/);
-	}
+        {
+          $line =~ s///;
+          print $line;
+          $prev_printed_line_empty = ($line =~ /^$/);
+        }
     }
   close DIFF;
 
@@ -316,25 +319,25 @@
   foreach my $t (@$tool_list)
     {
       if ($t eq 'gnulib')
-	{
-	  push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
-	  next;
-	}
+        {
+          push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
+          next;
+        }
       # Assume that the last "word" on the first line of
       # `tool --version` output is the version string.
       my ($first_line, undef) = split ("\n", `$t --version`);
       if ($first_line =~ /.* (\d[\w.-]+)$/)
-	{
-	  $t = ucfirst $t;
-	  push @tool_version_pair, "$t $1";
-	}
+        {
+          $t = ucfirst $t;
+          push @tool_version_pair, "$t $1";
+        }
       else
-	{
-	  defined $first_line
-	    and $first_line = '';
-	  warn "$ME: $t: unexpected --version output\n:$first_line";
-	  $fail = 1;
-	}
+        {
+          defined $first_line
+            and $first_line = '';
+          warn "$ME: $t: unexpected --version output\n:$first_line";
+          $fail = 1;
+        }
     }
 
   $fail
@@ -398,8 +401,8 @@
 
   grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
     and (warn "$ME: when specifying gnulib as a tool, you must also specify\n"
-	. "--gnulib-version=V, where V is the result of running git describe\n"
-	. "in the gnulib source directory.\n"), $fail = 1;
+        . "--gnulib-version=V, where V is the result of running git describe\n"
+        . "in the gnulib source directory.\n"), $fail = 1;
 
   exists $valid_release_types{$release_type}
     or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1;
@@ -448,11 +451,11 @@
   print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
   -f $xd
     and print_locations ("xdelta diffs (useful? if so, "
-			 . "please tell bug-gnulib\@gnu.org)",
-			 @url_dir_list, %size, $xd);
+                         . "please tell bug-gnulib\@gnu.org)",
+                         @url_dir_list, %size, $xd);
   my @sig_files = map { "$_.sig" } @tarballs;
   print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
-		   @sig_files);
+                   @sig_files);
   if ($url_dir_list[0] =~ "gnu\.org")
     {
       print "To reduce load on the main server, use a mirror listed at:\n";
--- a/build-aux/bootstrap	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/bootstrap	Fri May 06 08:15:59 2011 -0700
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2011-03-03.12; # UTC
+scriptversion=2011-05-03.08; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -130,18 +130,7 @@
 m4_base=m4
 doc_base=doc
 tests_base=tests
-
-# Extra files from gnulib, which override files from other sources.
-gnulib_extra_files="
-        $build_aux/install-sh
-        $build_aux/missing
-        $build_aux/mdate-sh
-        $build_aux/texinfo.tex
-        $build_aux/depcomp
-        $build_aux/config.guess
-        $build_aux/config.sub
-        doc/INSTALL
-"
+gnulib_extra_files=''
 
 # Additional gnulib-tool options to use.  Use "\newline" to break lines.
 gnulib_tool_option_extras=
@@ -229,6 +218,18 @@
   *) test -r "$0.conf" && . ./"$0.conf" ;;
 esac
 
+# Extra files from gnulib, which override files from other sources.
+test -z "${gnulib_extra_files}" && \
+  gnulib_extra_files="
+        $build_aux/install-sh
+        $build_aux/missing
+        $build_aux/mdate-sh
+        $build_aux/texinfo.tex
+        $build_aux/depcomp
+        $build_aux/config.guess
+        $build_aux/config.sub
+        doc/INSTALL
+"
 
 if test "$vc_ignore" = auto; then
   vc_ignore=
@@ -278,14 +279,29 @@
   exit 1
 fi
 
+# Ensure that lines starting with ! sort last, per gitignore conventions
+# for whitelisting exceptions after a more generic blacklist pattern.
+sort_patterns() {
+  sort -u "$@" | sed '/^!/ {
+    H
+    d
+  }
+  $ {
+    P
+    x
+    s/^\n//
+  }'
+}
+
 # If $STR is not already on a line by itself in $FILE, insert it,
 # sorting the new contents of the file and replacing $FILE with the result.
 insert_sorted_if_absent() {
   file=$1
   str=$2
   test -f $file || touch $file
-  echo "$str" | sort -u - $file | cmp - $file > /dev/null \
-    || echo "$str" | sort -u - $file -o $file \
+  echo "$str" | sort_patterns - $file | cmp - $file > /dev/null \
+    || { echo "$str" | sort_patterns - $file > $file.bak \
+      && mv $file.bak $file; } \
     || exit 1
 }
 
@@ -405,7 +421,10 @@
     # Honor $APP variables ($TAR, $AUTOCONF, etc.)
     appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
     test "$appvar" = TAR && appvar=AMTAR
-    eval "app=\${$appvar-$app}"
+    case $appvar in
+        GZIP) ;; # Do not use $GZIP:  it contains gzip options.
+        *) eval "app=\${$appvar-$app}" ;;
+    esac
     inst_ver=$(get_version $app)
     if [ ! "$inst_ver" ]; then
       echo "$me: Error: '$app' not found" >&2
--- a/build-aux/config.sub	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/config.sub	Fri May 06 08:15:59 2011 -0700
@@ -286,6 +286,7 @@
 	| nds32 | nds32le | nds32be \
 	| nios | nios2 \
 	| ns16k | ns32k \
+	| open8 \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle \
@@ -394,6 +395,7 @@
 	| nds32-* | nds32le-* | nds32be-* \
 	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
--- a/build-aux/depcomp	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/depcomp	Fri May 06 08:15:59 2011 -0700
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2010-10-07.20; # UTC
+scriptversion=2011-04-16.09; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010
-# Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
+# 2011 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
@@ -166,10 +166,12 @@
 ' < "$tmpdepfile" |
 ## Some versions of gcc put a space before the `:'.  On the theory
 ## that the space means something, we add a space to the output as
-## well.
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+      | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -557,7 +559,9 @@
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
+  # makedepend may prepend the VPATH from the source file name to the object.
+  # No need to regex-escape $object, excess matching of '.' is harmless.
+  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
   sed '1,2d' "$tmpdepfile" | tr ' ' '
 ' | \
 ## Some versions of the HPUX 10.20 sed can't process this invocation
--- a/build-aux/do-release-commit-and-tag	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/do-release-commit-and-tag	Fri May 06 08:15:59 2011 -0700
@@ -3,7 +3,7 @@
 # controlled .prev-version file, automate the procedure by which we record
 # the date, release-type and version string in the NEWS file.  That commit
 # will serve to identify the release, so apply a signed tag to it as well.
-VERSION=2010-06-07.07 # UTC
+VERSION=2011-05-04.11 # UTC
 
 # Note: this is a bash script (could be zsh or dash)
 
@@ -32,7 +32,7 @@
 {
   case $1 in
     --help) cat <<EOF
-Usage: $ME VERSION RELEASE_TYPE
+Usage: $ME [OPTION...] VERSION RELEASE_TYPE
 
 Run this script to perform the final pre-release NEWS update
 in which the date, release-type and version string are recorded.
@@ -46,8 +46,9 @@
 - a version-controlled .prev-version file
 
 Options:
-  --help     print this help, then exit
-  --version  print version number, then exit
+  --branch BRANCH            set release branch (default: master)
+  --help                     print this help, then exit
+  --version                  print version number, then exit
 
 EXAMPLE:
 To update NEWS and tag the beta 8.1 release of coreutils, I would run this:
@@ -73,10 +74,15 @@
   esac
 }
 
+branch=master
+case $1 in
+  --branch) shift; branch=$1; shift ;;
+esac
+
 case $# in
   1) help_version $1; exit 0;;
   2) ;;
-  *) warn "Usage: $ME VERSION TYPE"; exit 1;;
+  *) warn "Usage: $ME [OPTION...] VERSION TYPE"; exit 1;;
 esac
 
 ver=$1
@@ -121,9 +127,9 @@
  -e 'print $.==3 ? "$pfx $ver ($today) [$type]\n" : $_' \
      NEWS || die 'failed to update NEWS'
 
-# Ensure the current branch name is "master":
+# Ensure the current branch name is correct:
 curr_br=$(git rev-parse --symbolic-full-name HEAD)
-test "$curr_br" = refs/heads/master || die not on master
+test "$curr_br" = refs/heads/$branch || die not on branch $branch
 
 printf "version $ver\n\n* NEWS: Record release date.\n" \
     | git commit -F -  -a || die 'git commit failed'
--- a/build-aux/gendocs.sh	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/gendocs.sh	Fri May 06 08:15:59 2011 -0700
@@ -2,7 +2,7 @@
 # gendocs.sh -- generate a GNU manual in many formats.  This script is
 #   mentioned in maintain.texi.  See the help message below for usage details.
 
-scriptversion=2010-11-29.11
+scriptversion=2011-04-08.14
 
 # Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
 # Foundation, Inc.
@@ -305,10 +305,10 @@
   docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
   mv $PACKAGE-db.xml "$outdir/"
 
+  split_html_db_dir=html_node_db
   cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\""
   echo "Generating docbook HTML... ($cmd)"
   eval "$cmd"
-  split_html_db_dir=html_node_db
   (
     cd ${split_html_db_dir} || exit 1
     tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
--- a/build-aux/install-reloc	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/install-reloc	Fri May 06 08:15:59 2011 -0700
@@ -156,6 +156,8 @@
              "$srcdir"/progname.c \
              "$srcdir"/progreloc.c \
              "$srcdir"/areadlink.c \
+             "$srcdir"/careadlinkat.c \
+             "$srcdir"/allocator.c \
              "$srcdir"/readlink.c \
              "$srcdir"/canonicalize-lgpl.c \
              "$srcdir"/malloca.c \
@@ -172,6 +174,8 @@
       progreloc.o \
       xreadlink.o \
       areadlink.o \
+      careadlinkat.o \
+      allocator.o \
       canonicalize-lgpl.o \
       malloca.o \
       relocatable.o \
--- a/build-aux/texinfo.tex	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/texinfo.tex	Fri May 06 08:15:59 2011 -0700
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2011-02-24.09}
+\def\texinfoversion{2011-03-25.11}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -7053,12 +7053,14 @@
   % ... and for \example:
   \spaceisspace
   %
-  % The \empty here causes a following catcode 5 newline to be eaten
-  % as part of reading whitespace after a control sequence.  It does
-  % not eat a catcode 13 newline.  There's no good way to handle the
-  % two cases.  See the Macro Details node in the manual for the
-  % workaround we currently have to recommend for macros and
+  % The \empty here causes a following catcode 5 newline to be eaten as
+  % part of reading whitespace after a control sequence.  It does not
+  % eat a catcode 13 newline.  There's no good way to handle the two
+  % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
+  % would then have different behavior).  See the Macro Details node in
+  % the manual for the workaround we recommend for macros and
   % line-oriented commands.
+  % 
   \scantokens{#1\empty}%
 \endgroup}
 
--- a/build-aux/useless-if-before-free	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/useless-if-before-free	Fri May 06 08:15:59 2011 -0700
@@ -4,7 +4,7 @@
 # Detect instances of "if (p) free (p);".
 # Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
 
-my $VERSION = '2011-01-09 01:39'; # UTC
+my $VERSION = '2011-04-20 13:43'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -132,7 +132,7 @@
           while ($line =~
               /\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
               #  1          2                  3
-               (?:   \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)|
+               (?:   \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
                 \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
             {
               my $all = $1;
@@ -179,7 +179,7 @@
 git grep -l -z "$free *(" \
   | xargs -0 useless-if-before-free -l --name="$free" \
   | xargs -0 perl -0x3b -pi -e \
-   's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s'
+   's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
 
 # Use the following to remove redundant uses of kfree inside braces.
 # Note that -0777 puts perl in slurp-whole-file mode;
--- a/build-aux/vc-list-files	Fri Apr 01 16:04:45 2011 -0700
+++ b/build-aux/vc-list-files	Fri May 06 08:15:59 2011 -0700
@@ -2,7 +2,7 @@
 # List version-controlled file names.
 
 # Print a version string.
-scriptversion=2010-04-23.22; # UTC
+scriptversion=2011-04-29.20; # UTC
 
 # Copyright (C) 2006-2011 Free Software Foundation, Inc.
 
@@ -94,12 +94,12 @@
     eval cvsu --find --types=AFGM '"$dir"' $postprocess
   else
     eval awk -F/ \''{			\
-	if (!$1 && $3 !~ /^-/) {	\
-	  f=FILENAME;			\
-	  if (f ~ /CVS\/Entries$/)	\
-	    f = substr(f, 1, length(f)-11); \
-	  print f $2;			\
-	}}'\''				\
+        if (!$1 && $3 !~ /^-/) {	\
+          f=FILENAME;			\
+          if (f ~ /CVS\/Entries$/)	\
+            f = substr(f, 1, length(f)-11); \
+          print f $2;			\
+        }}'\''				\
       `find "$dir" -name Entries -print` /dev/null' $postprocess
   fi
 elif test -d .svn; then
--- a/doc/glibc-functions/mkostemp.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/glibc-functions/mkostemp.texi	Fri May 06 08:15:59 2011 -0700
@@ -15,3 +15,6 @@
 Portability problems not fixed by Gnulib:
 @itemize
 @end itemize
+
+The gnulib module @code{clean-temp} can create temporary files that will not
+be left behind after signals such as SIGINT.
--- a/doc/glibc-functions/mkostemps.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/glibc-functions/mkostemps.texi	Fri May 06 08:15:59 2011 -0700
@@ -15,3 +15,6 @@
 Portability problems not fixed by Gnulib:
 @itemize
 @end itemize
+
+The gnulib module @code{clean-temp} can create temporary files that will not
+be left behind after signals such as SIGINT.
--- a/doc/glibc-functions/mkstemps.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/glibc-functions/mkstemps.texi	Fri May 06 08:15:59 2011 -0700
@@ -10,8 +10,15 @@
 This function is missing on many non-glibc platforms:
 glibc 2.10, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin
 1.5.x, mingw, Interix 3.5, BeOS.
+@item
+This function is declared in @code{<unistd.h>} instead of @code{<stdlib.h>}
+on some platforms:
+MacOS X 10.5.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @end itemize
+
+The gnulib module @code{clean-temp} can create temporary files that will not
+be left behind after signals such as SIGINT.
--- a/doc/glibc-functions/strchrnul.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/glibc-functions/strchrnul.texi	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,13 @@
 Portability problems fixed by Gnulib:
 @itemize
 @item
-This function is missing on all non-glibc platforms:
-MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, Interix 3.5, BeOS.
+This function is missing on many non-glibc platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.7.8, mingw, Interix 3.5,
+BeOS.
+@item
+This function crashes when no occurrence is found on some platforms:
+Cygwin 1.7.9.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/gnulib-tool.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/gnulib-tool.texi	Fri May 06 08:15:59 2011 -0700
@@ -287,7 +287,7 @@
 @samp{_GNU_SOURCE} may be ineffective, or may have only a limited
 effect, if defined after the first system header file is included.
 
-Finally, note that you can not use @code{AC_LIBOBJ} or
+Finally, note that you cannot use @code{AC_LIBOBJ} or
 @code{AC_REPLACE_FUNCS} in your @file{configure.ac} and expect the
 resulting object files to be automatically added to @file{lib/libgnu.a}.
 This is because your @code{AC_LIBOBJ} and @code{AC_REPLACE_FUNCS} invocations
--- a/doc/gnulib.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/gnulib.texi	Fri May 06 08:15:59 2011 -0700
@@ -396,6 +396,15 @@
 depend on tests modules. (Recall that tests modules are built in a separate
 directory.)
 
+Each listed required module may be declared a conditional dependency.  This
+is indicated by placing the condition for the dependency on the same line,
+enclosed in brackets, after the name of the required module.  The condition
+is a shell expression that is run after the module's @code{configure.ac}
+statements.  For example:
+@smallexample
+strtoull   [test $ac_cv_func_strtoumax = no]
+@end smallexample
+
 @item configure.ac-early
 This field contains @file{configure.ac} stuff (Autoconf macro invocations and
 shell statements) that are logically placed early in the @file{configure.ac}
--- a/doc/posix-functions/accept.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/accept.texi	Fri May 06 08:15:59 2011 -0700
@@ -10,7 +10,7 @@
 @itemize
 @item
 On Windows platforms (excluding Cygwin), the descriptors returned by
-the @code{accept} function can not be used in calls to @code{read},
+the @code{accept} function cannot be used in calls to @code{read},
 @code{write}, and @code{close}; you have to use @code{recv}, @code{send},
 @code{closesocket} in these cases instead.
 @item
@@ -22,7 +22,7 @@
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-On BeOS, the descriptors returned by the @code{accept} function can not be used
+On BeOS, the descriptors returned by the @code{accept} function cannot be used
 in calls to @code{read}, @code{write}, and @code{close}; you have to use
 @code{recv}, @code{send}, @code{closesocket} in these cases instead.
 @item
--- a/doc/posix-functions/dup2.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/dup2.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,9 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/dup2.html}
 
-Gnulib module: dup2
+Gnulib module: dup2 or dup2-obsolete
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{dup2} or @code{dup2-obsolete}:
 @itemize
 @item
 This function always returns 0 for success on some platforms:
@@ -34,7 +34,10 @@
 extremely large targets, which interferes with using
 @code{dup2(fd,fd)==fd)} as the minimal @code{EBADF} filter:
 FreeBSD 6.1, Cygwin 1.5.
+@end itemize
 
+Portability problems fixed by Gnulib module @code{dup2-obsolete}:
+@itemize
 @item
 This function is missing on some older platforms.
 @end itemize
--- a/doc/posix-functions/fclose.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fclose.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,17 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fclose.html}
 
-Gnulib module: fclose
+Gnulib module: fclose, fflush
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{fclose} together with module @code{fflush}:
+@itemize
+@item
+On some platforms, this function fails to set the file position of a
+seekable input stream to the byte after the last one actually read:
+glibc 2.13, FreeBSD.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{fclose}:
 @itemize
 @item
 On Windows platforms (excluding Cygwin), @code{socket} and @code{accept}
--- a/doc/posix-functions/fgetc.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fgetc.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fgetc.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/fgets.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fgets.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fgets.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/fprintf.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fprintf.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fprintf.html}
 
-Gnulib module: fprintf-posix or stdio, sigpipe
+Gnulib module: fprintf-posix or stdio, nonblocking, sigpipe
 
 Portability problems fixed by Gnulib module @code{fprintf-posix}:
 @itemize
@@ -64,6 +64,15 @@
 MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
 @end itemize
 
+Portability problems fixed by Gnulib module @code{stdio} or @code{fprintf-posix}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
 Portability problems fixed by Gnulib module @code{stdio} or @code{fprintf-posix}, together with module @code{sigpipe}:
 @itemize
 @item
--- a/doc/posix-functions/fputc.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fputc.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fputc.html}
 
-Gnulib module: stdio, sigpipe
+Gnulib module: stdio, nonblocking, sigpipe
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
 @itemize
 @item
 When writing to a pipe with no readers, this function fails, instead of
--- a/doc/posix-functions/fputs.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fputs.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fputs.html}
 
-Gnulib module: stdio, sigpipe
+Gnulib module: stdio, nonblocking, sigpipe
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
 @itemize
 @item
 When writing to a pipe with no readers, this function fails, instead of
--- a/doc/posix-functions/fread.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fread.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fread.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/fscanf.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fscanf.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fscanf.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/fwrite.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/fwrite.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fwrite.html}
 
-Gnulib module: stdio, sigpipe
+Gnulib module: stdio, nonblocking, sigpipe
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
 @itemize
 @item
 When writing to a pipe with no readers, this function fails, instead of
--- a/doc/posix-functions/gai_strerror.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/gai_strerror.texi	Fri May 06 08:15:59 2011 -0700
@@ -10,13 +10,18 @@
 @itemize
 @item
 This function is missing on some platforms:
-HP-UX 11.11, IRIX 6.5, OSF/1 4.0, Solaris 7, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
+HP-UX 11.11, IRIX 6.5, OSF/1 4.0, Solaris 7, Cygwin 1.5.x, Interix
+3.5, BeOS.
+@item
+This function is only available in @code{<ws2tcpip.h>} on some
+platforms:
+mingw.
+@item
+This function's return type is @code{char *} instead of @code{const char *}
+on some platforms:
+AIX 7.1, HP-UX 11, OSF/1 5.1, Solaris 9, mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function's return type is @code{char *} instead of @code{const char *}
-on some platforms:
-AIX 7.1, HP-UX 11, OSF/1 5.1, Solaris 9.
 @end itemize
--- a/doc/posix-functions/getc.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/getc.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getc.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/getchar.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/getchar.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getchar.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/getcwd.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/getcwd.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,16 +4,26 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getcwd.html}
 
-Gnulib module: getcwd
+Gnulib module: getcwd or getcwd-lgpl
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{getcwd} or
+@code{getcwd-lgpl}:
+@itemize
+@item
+On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result.
+On some other platforms, this call is not allowed.  Conversely, mingw fails
+to honor non-zero @code{n}.
+@item
+On some platforms, the prototype for @code{getcwd} uses @code{int}
+instead of @code{size_t} for the size argument:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{getcwd}:
 @itemize
 @item
 This function is missing on some older platforms.
 @item
-On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result.
-On other platforms, this call is not allowed.
-@item
 This function does not handle long file names (greater than @code{PATH_MAX})
 correctly on some platforms.
 @end itemize
--- a/doc/posix-functions/gets.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/gets.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/gets.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/iconv.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/iconv.texi	Fri May 06 08:15:59 2011 -0700
@@ -27,8 +27,8 @@
 @item
 This function was not correctly implemented in glibc versions before 2.2.
 @item
-When @code{iconv} encounters an input character that is valid but that can
-not be converted to the output character set, glibc's and GNU libiconv's
+When @code{iconv} encounters an input character that is valid but that
+cannot be converted to the output character set, glibc's and GNU libiconv's
 @code{iconv} stop the conversion.  Some other implementations put an
 implementation-defined character into the output buffer.  ---
 Gnulib provides higher-level facilities @code{striconv} and @code{striconveh}
--- a/doc/posix-functions/memchr.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/memchr.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,18 +4,21 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/memchr.html}
 
-Gnulib module: memchr
+Gnulib module: memchr or memchr-obsolete
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{memchr} or @code{memchr-obsolete}:
 @itemize
 @item
-This function is missing on some older platforms.
-
-@item
 This function dereferences too much memory on some platforms:
 glibc 2.10 on x86_64, IA-64; glibc 2.11 on Alpha.
 @end itemize
 
+Portability problems fixed by Gnulib module @code{memchr-obsolete}:
+@itemize
+@item
+This function is missing on some older platforms.
+@end itemize
+
 Portability problems not fixed by Gnulib:
 @itemize
 @end itemize
--- a/doc/posix-functions/mkstemp.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/mkstemp.texi	Fri May 06 08:15:59 2011 -0700
@@ -12,15 +12,22 @@
 This function is missing on some platforms:
 mingw.
 @item
+This function is declared in @code{<unistd.h>} instead of @code{<stdlib.h>}
+on some platforms:
+MacOS X 10.3.
+@item
 On some platforms (HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a silly
 limit that it can create no more than 26 files from a given template.  On
 OSF/1 4.0f, it can create only 32 files per process.
+@item
+On some older platforms, @code{mkstemp} can create a world or group
+writable or readable file, if you haven't set the process umask to
+077.  This is a security risk.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-On platforms other than glibc 2.0.7 or newer, @code{mkstemp} can create a
-world or group writable or readable file, if you haven't set the process
-umask to 077.  This is a security risk.
 @end itemize
+
+The gnulib module @code{clean-temp} can create temporary files that will not
+be left behind after signals such as SIGINT.
--- a/doc/posix-functions/open.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/open.texi	Fri May 06 08:15:59 2011 -0700
@@ -14,6 +14,10 @@
 directory, on some platforms:
 FreeBSD 7.2, AIX 7.1, HP-UX 11.00, Solaris 9, Irix 5.3.
 @item
+This function does not support the @code{O_NONBLOCK} flag when it is defined
+by the gnulib module @code{nonblock} on some platforms:
+mingw.
+@item
 On Windows platforms (excluding Cygwin), this function does usually not
 recognize the @file{/dev/null} filename.
 @end itemize
--- a/doc/posix-functions/printf.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/printf.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/printf.html}
 
-Gnulib module: printf-posix or stdio, sigpipe
+Gnulib module: printf-posix or stdio, nonblocking, sigpipe
 
 Portability problems fixed by Gnulib module @code{printf-posix}:
 @itemize
@@ -64,6 +64,15 @@
 MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
 @end itemize
 
+Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
 Portability problems fixed by Gnulib module @code{stdio} or @code{printf-posix}, together with module @code{sigpipe}:
 @itemize
 @item
--- a/doc/posix-functions/putc.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/putc.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/putc.html}
 
-Gnulib module: stdio, sigpipe
+Gnulib module: stdio, nonblocking, sigpipe
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
 @itemize
 @item
 When writing to a pipe with no readers, this function fails, instead of
--- a/doc/posix-functions/putchar.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/putchar.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/putchar.html}
 
-Gnulib module: stdio, sigpipe
+Gnulib module: stdio, nonblocking, sigpipe
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
 @itemize
 @item
 When writing to a pipe with no readers, this function fails, instead of
--- a/doc/posix-functions/puts.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/puts.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,18 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/puts.html}
 
-Gnulib module: stdio, sigpipe
+Gnulib module: stdio, nonblocking, sigpipe
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
 @itemize
 @item
 When writing to a pipe with no readers, this function fails, instead of
--- a/doc/posix-functions/read.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/read.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/read.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/scanf.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/scanf.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/scanf.html}
 
-Gnulib module: ---
+Gnulib module: stdio, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/socket.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/socket.texi	Fri May 06 08:15:59 2011 -0700
@@ -10,7 +10,7 @@
 @itemize
 @item
 On Windows platforms (excluding Cygwin), the descriptors returned by
-the @code{socket} function can not be used in calls to @code{read},
+the @code{socket} function cannot be used in calls to @code{read},
 @code{write}, and @code{close}; you have to use @code{recv}, @code{send},
 @code{closesocket} in these cases instead.
 @item
@@ -22,7 +22,7 @@
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-On BeOS, the descriptors returned by the @code{socket} function can not be used
+On BeOS, the descriptors returned by the @code{socket} function cannot be used
 in calls to @code{read}, @code{write}, and @code{close}; you have to use
 @code{recv}, @code{send}, @code{closesocket} in these cases instead.
 @end itemize
--- a/doc/posix-functions/strtod.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/strtod.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,14 +4,11 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/strtod.html}
 
-Gnulib module: strtod
+Gnulib module: strtod or strtod-obsolete
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by either Gnulib module @code{strtod} or @code{strtod-obsolete}:
 @itemize
 @item
-This function is missing on some old platforms.
-
-@item
 This function mis-parses strings with leading @samp{+} on some old platforms:
 Old versions of Linux.
 
@@ -67,6 +64,12 @@
 AIX 7.1.
 @end itemize
 
+Portability problems fixed by Gnulib module @code{strtod-obsolete}:
+@itemize
+@item
+This function is missing on some old platforms.
+@end itemize
+
 Portability problems not fixed by Gnulib:
 @itemize
 @item
--- a/doc/posix-functions/vfprintf.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/vfprintf.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vfprintf.html}
 
-Gnulib module: vfprintf-posix or stdio, sigpipe
+Gnulib module: vfprintf-posix or stdio, nonblocking, sigpipe
 
 Portability problems fixed by Gnulib module @code{vfprintf-posix}:
 @itemize
@@ -64,6 +64,15 @@
 MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
 @end itemize
 
+Portability problems fixed by Gnulib module @code{stdio} or @code{vfprintf-posix}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
 Portability problems fixed by Gnulib module @code{stdio} or @code{vfprintf-posix}, together with module @code{sigpipe}:
 @itemize
 @item
--- a/doc/posix-functions/vfscanf.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/vfscanf.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vfscanf.html}
 
-Gnulib module: ---
+Gnulib module: vfscanf, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{vfscanf}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/vprintf.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/vprintf.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,7 +4,7 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vprintf.html}
 
-Gnulib module: vprintf-posix or stdio, sigpipe
+Gnulib module: vprintf-posix or stdio, nonblocking, sigpipe
 
 Portability problems fixed by Gnulib module @code{vprintf-posix}:
 @itemize
@@ -64,6 +64,15 @@
 MacOS X 10.3, FreeBSD 6.0, NetBSD 5.0.
 @end itemize
 
+Portability problems fixed by Gnulib module @code{stdio} or @code{vprintf-posix}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@end itemize
+
 Portability problems fixed by Gnulib module @code{stdio} or @code{vprintf-posix}, together with module @code{sigpipe}:
 @itemize
 @item
--- a/doc/posix-functions/vscanf.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/vscanf.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,15 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/vscanf.html}
 
-Gnulib module: ---
+Gnulib module: vscanf, nonblocking
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{vscanf}, together with module @code{nonblocking}:
 @itemize
+@item
+When reading from a non-blocking pipe whose buffer is empty, this function
+fails with @code{errno} being set to @code{EINVAL} instead of @code{EAGAIN} on
+some platforms:
+mingw.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-functions/write.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-functions/write.texi	Fri May 06 08:15:59 2011 -0700
@@ -4,9 +4,24 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/write.html}
 
-Gnulib module: write, sigpipe
+Gnulib module: write, nonblocking, sigpipe
 
-Portability problems fixed by Gnulib:
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{nonblocking}:
+@itemize
+@item
+When writing to a non-blocking pipe whose buffer is full, this function fails
+with @code{errno} being set to @code{ENOSPC} instead of @code{EAGAIN} on some
+platforms:
+mingw.
+@item
+When writing to a non-blocking pipe on which no reader is currently waiting
+an amount of bytes that exceeds the pipe buffer's size, then -- even if the
+pipe's buffer is empty -- this function fails, instead of performing a partial
+write into the pipe buffer, on some platforms:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{stdio}, together with module @code{sigpipe}:
 @itemize
 @item
 When writing to a pipe with no readers, this function fails with error
--- a/doc/posix-headers/assert.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-headers/assert.texi	Fri May 06 08:15:59 2011 -0700
@@ -3,12 +3,31 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/assert.h.html}
 
-Gnulib module: ---
+Gnulib module: assert-h
+
+See also the Gnulib module @code{assert}.
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+The draft C1X and C++0X @code{static_assert}, and the draft C1X
+@code{_Static_assert}, are not supported by many platforms.
+For example, GCC versions before 4.6.0 do not support @code{_Static_assert},
+and G++ versions through at least 4.6.0 do not support @code{static_assert}.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+Draft C1X @code{_Static_assert} and draft C++0X @code{static_assert}
+are keywords that can be used without including @code{<assert.h>}.
+The Gnulib substitutes are macros that require including @code{<assert.h>}.
+@item
+The draft C1X @code{static_assert} and @code{_Static_assert} can also
+be used within a @code{struct} or @code{union} specifier, in place of
+an ordinary declaration of a member of the struct or union.  The
+Gnulib substitute can be used only as an ordinary declaration.
+@item
+In C99, @code{assert} can be applied to any scalar expression.
+In C89, the argument to @code{assert} is of type @code{int}.
 @end itemize
--- a/doc/posix-headers/fcntl.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-headers/fcntl.texi	Fri May 06 08:15:59 2011 -0700
@@ -9,15 +9,25 @@
 @itemize
 @item
 @samp{O_CLOEXEC}, @samp{O_DIRECTORY}, @samp{O_DSYNC}, @samp{O_NOCTTY},
-@samp{O_NOFOLLOW}, @samp{O_NONBLOCK}, @samp{O_RSYNC}, @samp{O_SYNC},
+@samp{O_NOFOLLOW}, @samp{O_RSYNC}, @samp{O_SYNC},
 and @samp{O_TTY_INIT} are not defined on some platforms.  Gnulib defines
-these macros to 0.
+these macros to 0, which is generally safe.
+
+@item
+@samp{O_NONBLOCK} is not defined on some platforms.  If the
+@samp{nonblocking} module is in use, gnulib guarantees a working
+non-zero value; otherwise, the gnulib replacement is 0.
 
 @item
 @samp{O_EXEC} and @samp{O_SEARCH} are not defined on some platforms.
 Gnulib defines these macros to @samp{O_RDONLY}, which is typically 0.
 
 @item
+The @samp{O_ACCMODE} mask mistakenly omits @samp{O_SEARCH} and
+@samp{O_EXEC} on some platforms:
+Cygwin.
+
+@item
 @samp{O_BINARY}, @samp{O_TEXT} (not specified by POSIX, but essential for
 portability to Woe32 platforms) are defined on some platforms but not on
 others.
--- a/doc/posix-headers/signal.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-headers/signal.texi	Fri May 06 08:15:59 2011 -0700
@@ -28,6 +28,11 @@
 @item
 The macro @code{SA_NODEFER} is not defined on some platforms:
 Interix 3.5.
+@item
+The type @code{sighandler_t} (a GNU extension) is not defined on most non-glibc
+platforms:
+MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
+IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin, mingw, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
--- a/doc/posix-headers/sys_socket.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-headers/sys_socket.texi	Fri May 06 08:15:59 2011 -0700
@@ -17,6 +17,9 @@
 This header file does not define the type @code{socklen_t} on some platforms:
 HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS.
 @item
+This header file does not define the type @code{struct iovec} on some platforms:
+OpenBSD 4.4.
+@item
 This header file is lacking the @code{SHUT_RD}, @code{SHUT_WR},
 @code{SHUT_RDWR} macros on some platforms, despite having the @code{shutdown}
 functions:
@@ -29,4 +32,10 @@
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+This header file does not declare the @code{msg_control} and
+@code{msg_controllen} members of @code{struct msghdr} on some
+platforms.  This can be detected by the absence of the
+@code{CMSG_FIRSTHDR} macro:
+gnulib replacement header, old BSD
 @end itemize
--- a/doc/posix-headers/sys_uio.texi	Fri Apr 01 16:04:45 2011 -0700
+++ b/doc/posix-headers/sys_uio.texi	Fri May 06 08:15:59 2011 -0700
@@ -3,15 +3,19 @@
 
 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html}
 
-Gnulib module: ---
+Gnulib module: sys_uio
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This header file is missing on some platforms:
+mingw.
+@item
+This header file is not self-contained (it requires @code{<sys/types.h>} to be
+included first) on some platforms:
+OpenBSD 4.4.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This header file is missing on some platforms:
-mingw.
 @end itemize
--- a/gnulib-tool	Fri Apr 01 16:04:45 2011 -0700
+++ b/gnulib-tool	Fri May 06 08:15:59 2011 -0700
@@ -223,6 +223,10 @@
       --avoid=MODULE        Avoid including the given MODULE. Useful if you
                             have code that provides equivalent functionality.
                             This option can be repeated.
+      --conditional-dependencies
+                            Support conditional dependencies (experimental,
+                            may save configure time and object code, not
+                            compatible with --with-tests).
       --libtool             Use libtool rules.
       --no-libtool          Don't use libtool rules.
 
@@ -912,6 +916,8 @@
 # - excl_unportable_tests  true if --without-unportable-tests was given, blank
 #                          otherwise
 # - avoidlist       list of modules to avoid, from --avoid
+# - cond_dependencies  true if --conditional-dependencies was given, blank
+#                      otherwise
 # - lgpl            yes or a number if --lgpl was given, blank otherwise
 # - makefile_name   from --makefile-name
 # - libtool         true if --libtool was given, false if --no-libtool was
@@ -953,6 +959,7 @@
   excl_privileged_tests=
   excl_unportable_tests=
   avoidlist=
+  cond_dependencies=
   lgpl=
   makefile_name=
   libtool=
@@ -1002,7 +1009,7 @@
       --extract-* )
         mode=`echo "X$1" | sed -e 's/^X--//'`
         shift ;;
-      --copy-file | --copy-fil | --copy-fi | --copy-f | --copy- | --copy | --cop | --co )
+      --copy-file | --copy-fil | --copy-fi | --copy-f | --copy- | --copy | --cop )
         mode=copy-file
         shift ;;
       --dir )
@@ -1153,6 +1160,9 @@
         arg=`echo "X$1" | sed -e 's/^X--avoid=//'`
         func_append avoidlist " $arg"
         shift ;;
+      --conditional-dependencies | --conditional-dependencie | --conditional-dependenci | --conditional-dependenc | --conditional-dependen | --conditional-depende | --conditional-depend | --conditional-depen | --conditional-depe | --conditional-dep | --conditional-de | --conditional-d | --conditional- | --conditional | --conditiona | --condition | --conditio | --conditi | --condit | --condi | --cond | --con)
+        cond_dependencies=true
+        shift ;;
       --lgpl )
         lgpl=yes
         shift ;;
@@ -1298,6 +1308,10 @@
   if test -z "$pobase" && test -n "$po_domain"; then
     func_warning "--po-domain has no effect without a --po-base option"
   fi
+  if test -n "$cond_dependencies" && test -n "$inctests"; then
+    echo "gnulib-tool: option --conditional-dependencies is not supported with --with-tests" 1>&2
+    func_exit 1
+  fi
 
   # Determine the minimum supported autoconf version from the project's
   # configure.ac.
@@ -2128,11 +2142,13 @@
   fi
 }
 
-# func_get_automake_snippet module
+# func_get_automake_snippet_conditional module
+# returns the part of the Makefile.am snippet that can be put inside Automake
+# conditionals.
 # Input:
 # - local_gnulib_dir  from --local-dir
 # - modcache          true or false, from --cache-modules/--no-cache-modules
-func_get_automake_snippet ()
+func_get_automake_snippet_conditional ()
 {
   if ! $modcache; then
     func_lookup_file "modules/$1"
@@ -2152,6 +2168,16 @@
       fi
     fi
   fi
+}
+
+# func_get_automake_snippet_unconditional module
+# returns the part of the Makefile.am snippet that must stay outside of
+# Automake conditionals.
+# Input:
+# - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
+func_get_automake_snippet_unconditional ()
+{
   case "$1" in
     *-tests)
       # *-tests module live in tests/, not lib/.
@@ -2176,8 +2202,10 @@
       sed_extract_mentioned_files='s/^lib_SOURCES[	 ]*+=[	 ]*//p'
       already_mentioned_files=` \
         { if ! $modcache; then
+            func_lookup_file "modules/$1"
             sed -n -e "/^Makefile\.am$sed_extract_prog" < "$lookedup_file"
           else
+            func_cache_lookup_module "$1"
             if $have_associative; then
               if eval 'test -n "${modcache_makefile[$1]+set}"'; then
                 eval 'echo "${modcache_makefile[$1]}"'
@@ -2243,6 +2271,16 @@
   esac
 }
 
+# func_get_automake_snippet module
+# Input:
+# - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
+func_get_automake_snippet ()
+{
+  func_get_automake_snippet_conditional "$1"
+  func_get_automake_snippet_unconditional "$1"
+}
+
 # func_get_include_directive module
 # Input:
 # - local_gnulib_dir  from --local-dir
@@ -2380,6 +2418,143 @@
   return 0
 }
 
+# sed expression to keep the first 32 characters of each line.
+sed_first_32_chars='s/^\(................................\).*/\1/'
+
+# func_module_shellfunc_name module
+# computes the shell function name that will contain the m4 macros for the module.
+# Input:
+# - macro_prefix    prefix to use
+# Output:
+# - shellfunc       shell function name
+func_module_shellfunc_name ()
+{
+  case $1 in
+    *[!a-zA-Z0-9_]*)
+      shellfunc=func_${macro_prefix}_gnulib_m4code_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
+    *)
+      shellfunc=func_${macro_prefix}_gnulib_m4code_$1 ;;
+  esac
+}
+
+# func_module_shellvar_name module
+# computes the shell variable name the will be set to true once the m4 macros
+# for the module have been executed.
+# Output:
+# - shellvar        shell variable name
+func_module_shellvar_name ()
+{
+  case $1 in
+    *[!a-zA-Z0-9_]*)
+      shellvar=${macro_prefix}_gnulib_enabled_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
+    *)
+      shellvar=${macro_prefix}_gnulib_enabled_$1 ;;
+  esac
+}
+
+# func_module_conditional_name module
+# computes the automake conditional name for the module.
+# Output:
+# - conditional     name of automake conditional
+func_module_conditional_name ()
+{
+  case $1 in
+    *[!a-zA-Z0-9_]*)
+      conditional=${macro_prefix}_GNULIB_ENABLED_`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
+    *)
+      conditional=${macro_prefix}_GNULIB_ENABLED_$1 ;;
+  esac
+}
+
+# func_uncond_add_module B
+# notes the presence of B as an unconditional module.
+#
+# func_conddep_add_module A B cond
+# notes the presence of a conditional dependency from module A to module B,
+# subject to the condition that A is enabled and cond is true.
+#
+# func_cond_module_p B
+# tests whether module B is conditional.
+#
+# func_cond_module_condition A B
+# returns the condition when B should be enabled as a dependency of A, once the
+# m4 code for A has been executed.
+# Output: - condition
+#
+if $have_associative; then
+  declare -A conddep_isuncond
+  declare -A conddep_dependers
+  declare -A conddep_condition
+  func_uncond_add_module ()
+  {
+    eval 'conddep_isuncond[$1]=true'
+    eval 'unset conddep_dependers[$1]'
+  }
+  func_conddep_add_module ()
+  {
+    eval 'isuncond="${conddep_isuncond[$2]}"'
+    if test -z "$isuncond"; then
+      # No unconditional dependency to B known at this point.
+      eval 'conddep_dependers[$2]="${conddep_dependers[$2]} $1"'
+      eval 'conddep_condition[$1---$2]="$3"'
+    fi
+  }
+  func_cond_module_p ()
+  {
+    eval 'previous_dependers="${conddep_dependers[$1]}"'
+    test -n "$previous_dependers"
+  }
+  func_cond_module_condition ()
+  {
+    eval 'condition="${conddep_condition[$1---$2]}"'
+  }
+else
+  func_uncond_add_module ()
+  {
+    case $1 in
+      *[!a-zA-Z0-9_]*)
+        suffix=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
+      *)
+        suffix=$1 ;;
+    esac
+    eval 'conddep_isuncond_'"$suffix"'=true'
+    eval 'unset conddep_dependers_'"$suffix"
+  }
+  func_conddep_add_module ()
+  {
+    case $2 in
+      *[!a-zA-Z0-9_]*)
+        suffix=`echo "$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
+      *)
+        suffix=$2 ;;
+    esac
+    eval 'isuncond="${conddep_isuncond_'"$suffix"'}"'
+    if test -z "$isuncond"; then
+      eval 'conddep_dependers_'"$suffix"'="${conddep_dependers_'"$suffix"'} $1"'
+      suffix=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
+      eval 'conddep_condition_'"$suffix"'="$3"'
+    fi
+  }
+  func_cond_module_p ()
+  {
+    case $1 in
+      *[!a-zA-Z0-9_]*)
+        suffix=`echo "$1" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"` ;;
+      *)
+        suffix=$1 ;;
+    esac
+    eval 'previous_dependers="${conddep_dependers_'"$suffix"'}"'
+    test -n "$previous_dependers"
+  }
+  func_cond_module_condition ()
+  {
+    suffix=`echo "$1---$2" | md5sum | LC_ALL=C sed -e "$sed_first_32_chars"`
+    eval 'condition="${conddep_condition_'"$suffix"'}"'
+  }
+fi
+
+sed_dependencies_without_conditions='s/ *\[.*//'
+
 # func_modules_transitive_closure
 # Input:
 # - local_gnulib_dir  from --local-dir
@@ -2411,11 +2586,16 @@
 # - excl_unportable_tests  true if tests that fail on some platforms should be
 #                          excluded, blank otherwise
 # - avoidlist       list of modules to avoid
+# - cond_dependencies  true if conditional dependencies shall be supported,
+#                      blank otherwise
 # - tmp             pathname of a temporary directory
 # Output:
 # - modules         list of modules, including dependencies
+# - conddep_dependers, conddep_condition  information about conditionally
+#                                         enabled modules
 func_modules_transitive_closure ()
 {
+  sed_escape_dependency='s|\([/.]\)|\\\1|g'
   # In order to process every module only once (for speed), process an "input
   # list" of modules, producing an "output list" of modules. During each round,
   # more modules can be queued in the input list. Once a module on the input
@@ -2425,6 +2605,16 @@
   inmodules="$modules"
   outmodules=
   fmtc_inc_all_tests="$inc_all_direct_tests"
+  if test -n "$cond_dependencies"; then
+    for module in $inmodules; do
+      func_verify_module
+      if test -n "$module"; then
+        if func_acceptable $module; then
+          func_uncond_add_module $module
+        fi
+      fi
+    done
+  fi
   while test -n "$inmodules"; do
     inmodules_this_round="$inmodules"
     inmodules=                    # Accumulator, queue for next round
@@ -2433,7 +2623,23 @@
       if test -n "$module"; then
         if func_acceptable $module; then
           func_append outmodules " $module"
-          deps=`func_get_dependencies $module`
+          if test -n "$cond_dependencies"; then
+            if func_get_automake_snippet_conditional $module | grep '^if ' > /dev/null; then
+              # A module whose Makefile.am snippet contains a reference to an
+              # automake conditional. If we were to use it conditionally, we
+              # would get an error
+              #   configure: error: conditional "..." was never defined.
+              # because automake 1.11.1 does not handle nested conditionals
+              # correctly. As a workaround, make the module unconditional.
+              func_uncond_add_module $module
+            fi
+            if func_cond_module_p $module; then
+              conditional=true
+            else
+              conditional=false
+            fi
+          fi
+          deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
           # Duplicate dependencies are harmless, but Jim wants a warning.
           duplicated_deps=`echo "$deps" | LC_ALL=C sort | LC_ALL=C uniq -d`
           if test -n "$duplicated_deps"; then
@@ -2486,6 +2692,24 @@
             done
             if $inc; then
               func_append inmodules " $dep"
+              if test -n "$cond_dependencies"; then
+                escaped_dep=`echo "$dep" | sed -e "$sed_escape_dependency"`
+                sed_extract_condition1='/^ *'"$escaped_dep"' *$/{s/^.*$/true/p}'
+                sed_extract_condition2='/^ *'"$escaped_dep"' *\[.*\] *$/{s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p}'
+                condition=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
+                if test "$condition" = true; then
+                  condition=
+                fi
+                if test -n "$condition"; then
+                  func_conddep_add_module "$module" "$dep" "$condition"
+                else
+                  if $conditional; then
+                    func_conddep_add_module "$module" "$dep" true
+                  else
+                    func_uncond_add_module "$dep"
+                  fi
+                fi
+              fi
             fi
           done
         fi
@@ -2522,7 +2746,7 @@
   echo "Module list with included dependencies (indented):"
   echo "$specified_modules" | sed -e '/^$/d' -e 's/$/| /' > "$tmp"/specified-modules
   echo "$modules" | sed -e '/^$/d' \
-    | LC_ALL=C join -t '|' -a 2 "$tmp"/specified-modules - \
+    | LC_ALL=C join -t '|' -a2 "$tmp"/specified-modules - \
     | sed -e 's/^\(.*\)|.*/|\1/' -e 's/^/    /' -e 's/^    |\(.*\)$/  '"${bold_on}"'\1'"${bold_off}"'/'
 }
 
@@ -2812,7 +3036,7 @@
       func_verify_nontests_module
       if test -n "$module"; then
         {
-          func_get_automake_snippet "$module" |
+          func_get_automake_snippet_conditional "$module" |
             LC_ALL=C \
             sed -e 's,lib_LIBRARIES,lib%_LIBRARIES,g' \
                 -e 's,lib_LTLIBRARIES,lib%_LTLIBRARIES,g' \
@@ -2826,16 +3050,32 @@
             echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
             echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
           fi
-        } > "$tmp"/amsnippet
+        } > "$tmp"/amsnippet1
+        {
+          func_get_automake_snippet_unconditional "$module" |
+            LC_ALL=C sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g'
+        } > "$tmp"/amsnippet2
         # Skip the contents if it's entirely empty.
-        if grep '[^	 ]' "$tmp"/amsnippet > /dev/null ; then
+        if grep '[^	 ]' "$tmp"/amsnippet1 "$tmp"/amsnippet2 > /dev/null ; then
           echo "## begin gnulib module $module"
           echo
-          cat "$tmp"/amsnippet
+          if test -n "$cond_dependencies"; then
+            if func_cond_module_p "$module"; then
+              func_module_conditional_name "$module"
+              echo "if $conditional"
+            fi
+          fi
+          cat "$tmp"/amsnippet1
+          if test -n "$cond_dependencies"; then
+            if func_cond_module_p "$module"; then
+              echo "endif"
+            fi
+          fi
+          cat "$tmp"/amsnippet2
           echo "## end   gnulib module $module"
           echo
         fi
-        rm -f "$tmp"/amsnippet
+        rm -f "$tmp"/amsnippet1 "$tmp"/amsnippet2
         # Test whether there are some source files in subdirectories.
         for f in `func_get_filelist "$module"`; do
           case $f in
@@ -3380,6 +3620,190 @@
   echo "])"
 }
 
+# func_emit_autoconf_snippet indentation
+# emits the autoconf snippet of a module.
+# Input:
+# - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
+# - sed_replace_build_aux  sed expression that replaces reference to build-aux
+# - module            the module name
+# - toplevel          true or false. 'false' means a subordinate use of
+#                     gnulib-tool.
+# - disable_libtool   true or false. It tells whether to disable libtool
+#                     handling even if it has been specified through the
+#                     command line options.
+# - disable_gettext   true or false. It tells whether to disable AM_GNU_GETTEXT
+#                     invocations.
+# - indentation       spaces to prepend on each line
+func_emit_autoconf_snippet ()
+{
+  if { case $module in
+         gnumakefile | maintainer-makefile)
+           # These modules are meant to be used only in the top-level directory.
+           $toplevel ;;
+         *)
+           true ;;
+       esac
+     }; then
+    func_get_autoconf_snippet "$module" \
+      | sed -e '/^$/d;' -e "s/^/$indentation/" \
+            -e "$sed_replace_build_aux" \
+      | { if $disable_libtool; then
+            sed -e 's/\$gl_cond_libtool/false/g' \
+                -e 's/gl_libdeps/gltests_libdeps/g' \
+                -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
+          else
+            cat
+          fi
+        } \
+      | { if $disable_gettext; then
+            sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
+          else
+            cat
+          fi
+        }
+    if test "$module" = 'alloca' && test "$libtool" = true && ! $disable_libtool; then
+      echo 'changequote(,)dnl'
+      echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
+      echo 'changequote([, ])dnl'
+      echo 'AC_SUBST([LTALLOCA])'
+    fi
+  fi
+}
+
+# func_emit_autoconf_snippets modules verifier toplevel disable_libtool disable_gettext
+# collects and emit the autoconf snippets of a set of modules.
+# Input:
+# - local_gnulib_dir  from --local-dir
+# - modcache          true or false, from --cache-modules/--no-cache-modules
+# - sed_replace_build_aux  sed expression that replaces reference to build-aux
+# - modules           the list of modules.
+# - verifier          one of func_verify_module, func_verify_nontests_module,
+#                     func_verify_tests_module. It selects the subset of
+#                     $modules to consider.
+# - toplevel          true or false. 'false' means a subordinate use of
+#                     gnulib-tool.
+# - disable_libtool   true or false. It tells whether to disable libtool
+#                     handling even if it has been specified through the
+#                     command line options.
+# - disable_gettext   true or false. It tells whether to disable AM_GNU_GETTEXT
+#                     invocations.
+func_emit_autoconf_snippets ()
+{
+  verifier="$2"
+  toplevel="$3"
+  disable_libtool="$4"
+  disable_gettext="$5"
+  if test -n "$cond_dependencies"; then
+    # Emit the autoconf code for the unconditional modules.
+    for module in $1; do
+      eval $verifier
+      if test -n "$module"; then
+        if func_cond_module_p "$module"; then
+          :
+        else
+          func_emit_autoconf_snippet "  "
+        fi
+      fi
+    done
+    # Initialize the shell variables indicating that the modules are enabled.
+    for module in $1; do
+      eval $verifier
+      if test -n "$module"; then
+        if func_cond_module_p "$module"; then
+          func_module_shellvar_name "$module"
+          echo "  $shellvar=false"
+        fi
+      fi
+    done
+    # Emit the autoconf code for the conditional modules, each in a separate
+    # function. This makes it possible to support cycles among conditional
+    # modules.
+    for module in $1; do
+      eval $verifier
+      if test -n "$module"; then
+        if func_cond_module_p "$module"; then
+          func_module_shellfunc_name "$module"
+          func_module_shellvar_name "$module"
+          echo "  $shellfunc ()"
+          echo '  {'
+          echo "    if ! \$$shellvar; then"
+          func_emit_autoconf_snippet "      "
+          echo "      $shellvar=true"
+          deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
+          for dep in $deps; do
+            if func_cond_module_p "$dep"; then
+              func_module_shellfunc_name "$dep"
+              func_cond_module_condition "$module" "$dep"
+              if test "$condition" != true; then
+                echo '      if $condition; then'
+                echo "        $shellfunc"
+                echo '      fi'
+              else
+                echo "      $shellfunc"
+              fi
+            else
+              # The autoconf code for $dep has already been emitted above and
+              # therefore is already executed when this function is run.
+              :
+            fi
+          done
+          echo '    fi'
+          echo '  }'
+        fi
+      fi
+    done
+    # Emit the dependencies from the unconditional to the conditional modules.
+    for module in $1; do
+      eval $verifier
+      if test -n "$module"; then
+        if func_cond_module_p "$module"; then
+          :
+        else
+          deps=`func_get_dependencies $module | sed -e "$sed_dependencies_without_conditions"`
+          for dep in $deps; do
+            if func_cond_module_p "$dep"; then
+              func_module_shellfunc_name "$dep"
+              func_cond_module_condition "$module" "$dep"
+              if test "$condition" != true; then
+                echo "  if $condition; then"
+                echo "    $shellfunc"
+                echo '  fi'
+              else
+                echo "  $shellfunc"
+              fi
+            else
+              # The autoconf code for $dep has already been emitted above and
+              # therefore is already executed when this code is run.
+              :
+            fi
+          done
+        fi
+      fi
+    done
+    # Define the Automake conditionals.
+    echo "  m4_pattern_allow([^${macro_prefix}_GNULIB_ENABLED_])"
+    for module in $1; do
+      eval $verifier
+      if test -n "$module"; then
+        if func_cond_module_p "$module"; then
+          func_module_conditional_name "$module"
+          func_module_shellvar_name "$module"
+          echo "  AM_CONDITIONAL([$conditional], [\$$shellvar])"
+        fi
+      fi
+    done
+  else
+    # Ignore the conditions, and enable all modules unconditionally.
+    for module in $1; do
+      eval $verifier
+      if test -n "$module"; then
+        func_emit_autoconf_snippet "  "
+      fi
+    done
+  fi
+}
+
 # func_import modules
 # Uses also the variables
 # - mode            import or add-import or remove-import or update
@@ -3406,6 +3830,8 @@
 #                         otherwise
 # - inc_all_tests   true if --with-all-tests was given, blank otherwise
 # - avoidlist       list of modules to avoid, from --avoid
+# - cond_dependencies  true if conditional dependencies shall be supported,
+#                      blank otherwise
 # - lgpl            yes or a number if library's license shall be LGPL,
 #                   blank otherwise
 # - makefile_name   from --makefile-name
@@ -4568,22 +4994,7 @@
     echo "  gl_m4_base='$m4base'"
     func_emit_initmacro_start $macro_prefix
     echo "  gl_source_base='$sourcebase'"
-    for module in $main_modules; do
-      func_verify_module
-      if test -n "$module"; then
-        echo "  # Code from module $module:"
-        func_get_autoconf_snippet "$module" \
-          | sed -e '/^$/d;' -e 's/^/  /' \
-                -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
-                -e "$sed_replace_build_aux"
-        if test "$module" = 'alloca' && test "$libtool" = true; then
-          echo 'changequote(,)dnl'
-          echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
-          echo 'changequote([, ])dnl'
-          echo 'AC_SUBST([LTALLOCA])'
-        fi
-      fi
-    done
+    func_emit_autoconf_snippets "$main_modules" func_verify_module true false true
     echo "  # End of code from modules"
     func_emit_initmacro_end $macro_prefix
     echo "  gltests_libdeps="
@@ -4599,18 +5010,7 @@
     echo "  AC_SUBST([${macro_prefix}tests_WITNESS])"
     echo "  gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
     echo "  m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [\$gl_module_indicator_condition])"
-    for module in $testsrelated_modules; do
-      func_verify_module
-      if test -n "$module"; then
-        func_get_autoconf_snippet "$module" \
-          | sed -e '/^$/d;' -e 's/^/  /' \
-                -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./' \
-                -e "$sed_replace_build_aux" \
-                -e 's/\$gl_cond_libtool/false/g' \
-                -e 's/gl_libdeps/gltests_libdeps/g' \
-                -e 's/gl_ltlibdeps/gltests_ltlibdeps/g'
-      fi
-    done
+    func_emit_autoconf_snippets "$testsrelated_modules" func_verify_module true true true
     echo "  m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
     func_emit_initmacro_end ${macro_prefix}tests
     # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
@@ -4891,6 +5291,8 @@
 # - excl_unportable_tests  true if tests that fail on some platforms should be
 #                          excluded, blank otherwise
 # - avoidlist       list of modules to avoid
+# - cond_dependencies  true if conditional dependencies shall be supported,
+#                      blank otherwise
 # - libtool         true if --libtool was given, false if --no-libtool was
 #                   given, blank otherwise
 # - symbolic        true if files should be symlinked, copied otherwise
@@ -5163,34 +5565,9 @@
      # autoconf snippets. It's cleanest to put those of the library before
      # those of the tests.
      echo "gl_source_base='../$sourcebase'"
-     for module in $modules; do
-       func_verify_nontests_module
-       if test -n "$module"; then
-         case $module in
-           gnumakefile | maintainer-makefile)
-             # These modules are meant to be used only in the top-level directory.
-             ;;
-           *)
-             func_get_autoconf_snippet "$module" \
-               | sed -e "$sed_replace_build_aux"
-             if test "$module" = 'alloca' && test "$libtool" = true; then
-               echo 'changequote(,)dnl'
-               echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
-               echo 'changequote([, ])dnl'
-               echo 'AC_SUBST([LTALLOCA])'
-             fi
-             ;;
-         esac
-       fi
-     done
+     func_emit_autoconf_snippets "$modules" func_verify_nontests_module false false false
      echo "gl_source_base='.'"
-     for module in $modules; do
-       func_verify_tests_module
-       if test -n "$module"; then
-         func_get_autoconf_snippet "$module" \
-           | sed -e "$sed_replace_build_aux"
-       fi
-     done
+     func_emit_autoconf_snippets "$modules" func_verify_tests_module false false false
      func_emit_initmacro_end $macro_prefix
      # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
      # created using libtool, because libtool already handles the dependencies.
@@ -5296,19 +5673,7 @@
    echo "gl_m4_base='$m4base'"
    func_emit_initmacro_start $macro_prefix
    echo "gl_source_base='$sourcebase'"
-   for module in $modules; do
-     func_verify_nontests_module
-     if test -n "$module"; then
-       func_get_autoconf_snippet "$module" \
-         | sed -e "$sed_replace_build_aux"
-       if test "$module" = 'alloca' && test "$libtool" = true; then
-         echo 'changequote(,)dnl'
-         echo 'LTALLOCA=`echo "$ALLOCA" | sed -e '"'"'s/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'"'"'`'
-         echo 'changequote([, ])dnl'
-         echo 'AC_SUBST([LTALLOCA])'
-       fi
-     fi
-   done
+   func_emit_autoconf_snippets "$modules" func_verify_nontests_module true false false
    func_emit_initmacro_end $macro_prefix
    # _LIBDEPS and _LTLIBDEPS variables are not needed if this library is
    # created using libtool, because libtool already handles the dependencies.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/allocator.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,5 @@
+#define _GL_USE_STDLIB_ALLOC 1
+#include <config.h>
+#include "allocator.h"
+#include <stdlib.h>
+struct allocator const stdlib_allocator = { malloc, realloc, free, NULL };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/allocator.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,57 @@
+/* Memory allocators such as malloc+free.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef _GL_ALLOCATOR_H
+#define _GL_ALLOCATOR_H
+
+#include <stddef.h>
+
+/* An object describing a memory allocator family.  */
+
+struct allocator
+{
+  /* Do not use GCC attributes such as __attribute__ ((malloc)) with
+     the function types pointed at by these members, because these
+     attributes do not work with pointers to functions.  See
+     <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00007.html>.  */
+
+  /* Call ALLOCATE to allocate memory, like 'malloc'.  On failure ALLOCATE
+     should return NULL, though not necessarily set errno.  When given
+     a zero size it may return NULL even if successful.  */
+  void *(*allocate) (size_t);
+
+  /* If nonnull, call REALLOCATE to reallocate memory, like 'realloc'.
+     On failure REALLOCATE should return NULL, though not necessarily set
+     errno.  When given a zero size it may return NULL even if
+     successful.  */
+  void *(*reallocate) (void *, size_t);
+
+  /* Call FREE to free memory, like 'free'.  */
+  void (*free) (void *);
+
+  /* If nonnull, call DIE if MALLOC or REALLOC fails.  DIE should not
+     return.  DIE can be used by code that detects memory overflow
+     while calculating sizes to be passed to MALLOC or REALLOC.  */
+  void (*die) (void);
+};
+
+/* An allocator using the stdlib functions and a null DIE function.  */
+extern struct allocator const stdlib_allocator;
+
+#endif /* _GL_ALLOCATOR_H */
--- a/lib/areadlink.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/areadlink.c	Fri May 06 08:15:59 2011 -0700
@@ -24,108 +24,16 @@
 /* Specification.  */
 #include "areadlink.h"
 
-#include <errno.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
-
-/* Use the system functions, not the gnulib overrides in this file.  */
-#undef malloc
-#undef realloc
-
-/* The initial buffer size for the link value.  A power of 2
-   detects arithmetic overflow earlier, but is not required.  */
-enum {
-  INITIAL_BUF_SIZE = 1024
-};
+#include "careadlinkat.h"
 
 /* Call readlink to get the symbolic link value of FILENAME.
    Return a pointer to that NUL-terminated string in malloc'd storage.
    If readlink fails, return NULL and set errno.
-   If realloc fails, or if the link value is longer than SIZE_MAX :-),
+   If allocation fails, or if the link value is longer than SIZE_MAX :-),
    return NULL and set errno to ENOMEM.  */
 
 char *
 areadlink (char const *filename)
 {
-  /* Allocate the initial buffer on the stack.  This way, in the common
-     case of a symlink of small size, we get away with a single small malloc()
-     instead of a big malloc() followed by a shrinking realloc().  */
-  char initial_buf[INITIAL_BUF_SIZE];
-
-  char *buffer = initial_buf;
-  size_t buf_size = sizeof initial_buf;
-
-  while (1)
-    {
-      /* Attempt to read the link into the current buffer.  */
-      ssize_t link_length = readlink (filename, buffer, buf_size);
-
-      /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
-         with errno == ERANGE if the buffer is too small.  */
-      if (link_length < 0 && errno != ERANGE)
-        {
-          if (buffer != initial_buf)
-            {
-              int saved_errno = errno;
-              free (buffer);
-              errno = saved_errno;
-            }
-          return NULL;
-        }
-
-      if ((size_t) link_length < buf_size)
-        {
-          buffer[link_length++] = '\0';
-
-          /* Return it in a chunk of memory as small as possible.  */
-          if (buffer == initial_buf)
-            {
-              buffer = (char *) malloc (link_length);
-              if (buffer == NULL)
-                {
-                  /* It's easier to set errno to ENOMEM than to rely on the
-                     'malloc-posix' gnulib module.  */
-                  errno = ENOMEM;
-                  return NULL;
-                }
-              memcpy (buffer, initial_buf, link_length);
-            }
-          else
-            {
-              /* Shrink buffer before returning it.  */
-              if ((size_t) link_length < buf_size)
-                {
-                  char *smaller_buffer = (char *) realloc (buffer, link_length);
-
-                  if (smaller_buffer != NULL)
-                    buffer = smaller_buffer;
-                }
-            }
-          return buffer;
-        }
-
-      if (buffer != initial_buf)
-        free (buffer);
-      buf_size *= 2;
-      if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0))
-        {
-          errno = ENOMEM;
-          return NULL;
-        }
-      buffer = (char *) malloc (buf_size);
-      if (buffer == NULL)
-        {
-          /* It's easier to set errno to ENOMEM than to rely on the
-             'malloc-posix' gnulib module.  */
-          errno = ENOMEM;
-          return NULL;
-        }
-    }
+  return careadlinkat (AT_FDCWD, filename, NULL, 0, NULL, careadlinkatcwd);
 }
--- a/lib/areadlinkat.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/areadlinkat.c	Fri May 06 08:15:59 2011 -0700
@@ -25,101 +25,21 @@
 /* Specification.  */
 #include "areadlink.h"
 
-#include <errno.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
+#include "careadlinkat.h"
 
 #if HAVE_READLINKAT
 
-/* The initial buffer size for the link value.  A power of 2
-   detects arithmetic overflow earlier, but is not required.  */
-enum {
-  INITIAL_BUF_SIZE = 1024
-};
-
 /* Call readlinkat to get the symbolic link value of FILENAME relative to FD.
    Return a pointer to that NUL-terminated string in malloc'd storage.
    If readlinkat fails, return NULL and set errno (although failure to
    change directory will issue a diagnostic and exit).
-   If realloc fails, or if the link value is longer than SIZE_MAX :-),
+   If allocation fails, or if the link value is longer than SIZE_MAX :-),
    return NULL and set errno to ENOMEM.  */
 
 char *
 areadlinkat (int fd, char const *filename)
 {
-  /* Allocate the initial buffer on the stack.  This way, in the common
-     case of a symlink of small size, we get away with a single small malloc()
-     instead of a big malloc() followed by a shrinking realloc().  */
-  char initial_buf[INITIAL_BUF_SIZE];
-
-  char *buffer = initial_buf;
-  size_t buf_size = sizeof initial_buf;
-
-  while (1)
-    {
-      /* Attempt to read the link into the current buffer.  */
-       ssize_t link_length = readlinkat (fd, filename, buffer, buf_size);
-
-      /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
-         with errno == ERANGE if the buffer is too small.  */
-      if (link_length < 0 && errno != ERANGE)
-        {
-          if (buffer != initial_buf)
-            {
-              int saved_errno = errno;
-              free (buffer);
-              errno = saved_errno;
-            }
-          return NULL;
-        }
-
-      if ((size_t) link_length < buf_size)
-        {
-          buffer[link_length++] = '\0';
-
-          /* Return it in a chunk of memory as small as possible.  */
-          if (buffer == initial_buf)
-            {
-              buffer = (char *) malloc (link_length);
-              if (buffer == NULL)
-                /* errno is ENOMEM.  */
-                return NULL;
-              memcpy (buffer, initial_buf, link_length);
-            }
-          else
-            {
-              /* Shrink buffer before returning it.  */
-              if ((size_t) link_length < buf_size)
-                {
-                  char *smaller_buffer = (char *) realloc (buffer, link_length);
-
-                  if (smaller_buffer != NULL)
-                    buffer = smaller_buffer;
-                }
-            }
-          return buffer;
-        }
-
-      if (buffer != initial_buf)
-        free (buffer);
-      buf_size *= 2;
-      if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0))
-        {
-          errno = ENOMEM;
-          return NULL;
-        }
-      buffer = (char *) malloc (buf_size);
-      if (buffer == NULL)
-        /* errno is ENOMEM.  */
-        return NULL;
-    }
+  return careadlinkat (fd, filename, NULL, 0, NULL, readlinkat);
 }
 
 #else /* !HAVE_READLINKAT */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/assert.in.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,28 @@
+/* Substitute for and wrapper around <assert.h>
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Do not guard the include, since <assert.h> is supposed to define
+   the assert macro each time it is included.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#@INCLUDE_NEXT@ @NEXT_ASSERT_H@
+
+/* The definition of static_assert is copied here.  */
--- a/lib/canonicalize-lgpl.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/canonicalize-lgpl.c	Fri May 06 08:15:59 2011 -0700
@@ -16,6 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
+# define _GL_USE_STDLIB_ALLOC 1
 # include <config.h>
 #endif
 
@@ -68,8 +69,6 @@
 # endif
 # define __readlink readlink
 # define __set_errno(e) errno = (e)
-/* Use the system functions, not the gnulib overrides in this file.  */
-# undef malloc
 # ifndef MAXSYMLINKS
 #  ifdef SYMLOOP_MAX
 #   define MAXSYMLINKS SYMLOOP_MAX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/careadlinkat.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,171 @@
+/* Read symbolic links into a buffer without size limitation, relative to fd.
+
+   Copyright (C) 2001, 2003-2004, 2007, 2009-2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
+
+#include <config.h>
+
+#include "careadlinkat.h"
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Define this independently so that stdint.h is not a prerequisite.  */
+#ifndef SIZE_MAX
+# define SIZE_MAX ((size_t) -1)
+#endif
+
+#ifndef SSIZE_MAX
+# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
+#endif
+
+#include "allocator.h"
+
+#if ! HAVE_READLINKAT
+/* Get the symbolic link value of FILENAME and put it into BUFFER, with
+   size BUFFER_SIZE.  This function acts like readlink  but has
+   readlinkat's signature.  */
+ssize_t
+careadlinkatcwd (int fd, char const *filename, char *buffer,
+                 size_t buffer_size)
+{
+  /* FD must be AT_FDCWD here, otherwise the caller is using this
+     function in contexts for which it was not meant for.  */
+  if (fd != AT_FDCWD)
+    abort ();
+  return readlink (filename, buffer, buffer_size);
+}
+#endif
+
+/* Assuming the current directory is FD, get the symbolic link value
+   of FILENAME as a null-terminated string and put it into a buffer.
+   If FD is AT_FDCWD, FILENAME is interpreted relative to the current
+   working directory, as in openat.
+
+   If the link is small enough to fit into BUFFER put it there.
+   BUFFER's size is BUFFER_SIZE, and BUFFER can be null
+   if BUFFER_SIZE is zero.
+
+   If the link is not small, put it into a dynamically allocated
+   buffer managed by ALLOC.  It is the caller's responsibility to free
+   the returned value if it is nonnull and is not BUFFER.  A null
+   ALLOC stands for the standard allocator.
+
+   The PREADLINKAT function specifies how to read links.  It operates
+   like POSIX readlinkat()
+   <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>
+   but can assume that its first argument is the same as FD.
+
+   If successful, return the buffer address; otherwise return NULL and
+   set errno.  */
+
+char *
+careadlinkat (int fd, char const *filename,
+              char *buffer, size_t buffer_size,
+              struct allocator const *alloc,
+              ssize_t (*preadlinkat) (int, char const *, char *, size_t))
+{
+  char *buf;
+  size_t buf_size;
+  size_t buf_size_max =
+    SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
+  char stack_buf[1024];
+
+  if (! alloc)
+    alloc = &stdlib_allocator;
+
+  if (! buffer_size)
+    {
+      /* Allocate the initial buffer on the stack.  This way, in the
+         common case of a symlink of small size, we get away with a
+         single small malloc() instead of a big malloc() followed by a
+         shrinking realloc().  */
+      buffer = stack_buf;
+      buffer_size = sizeof stack_buf;
+    }
+
+  buf = buffer;
+  buf_size = buffer_size;
+
+  do
+    {
+      /* Attempt to read the link into the current buffer.  */
+      ssize_t link_length = preadlinkat (fd, filename, buf, buf_size);
+      size_t link_size;
+      if (link_length < 0)
+        {
+          /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1
+             with errno == ERANGE if the buffer is too small.  */
+          int readlinkat_errno = errno;
+          if (readlinkat_errno != ERANGE)
+            {
+              if (buf != buffer)
+                {
+                  alloc->free (buf);
+                  errno = readlinkat_errno;
+                }
+              return NULL;
+            }
+        }
+
+      link_size = link_length;
+
+      if (link_size < buf_size)
+        {
+          buf[link_size++] = '\0';
+
+          if (buf == stack_buf)
+            {
+              char *b = (char *) alloc->allocate (link_size);
+              if (! b)
+                break;
+              memcpy (b, buf, link_size);
+              buf = b;
+            }
+          else if (link_size < buf_size && buf != buffer && alloc->reallocate)
+            {
+              /* Shrink BUF before returning it.  */
+              char *b = (char *) alloc->reallocate (buf, link_size);
+              if (b)
+                buf = b;
+            }
+
+          return buf;
+        }
+
+      if (buf != buffer)
+        alloc->free (buf);
+
+      if (buf_size <= buf_size_max / 2)
+        buf_size *= 2;
+      else if (buf_size < buf_size_max)
+        buf_size = buf_size_max;
+      else
+        break;
+      buf = (char *) alloc->allocate (buf_size);
+    }
+  while (buf);
+
+  if (alloc->die)
+    alloc->die ();
+  errno = ENOMEM;
+  return NULL;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/careadlinkat.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,73 @@
+/* Read symbolic links into a buffer without size limitation, relative to fd.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
+
+#ifndef _GL_CAREADLINKAT_H
+#define _GL_CAREADLINKAT_H
+
+#include <fcntl.h>
+#include <unistd.h>
+
+struct allocator;
+
+/* Assuming the current directory is FD, get the symbolic link value
+   of FILENAME as a null-terminated string and put it into a buffer.
+   If FD is AT_FDCWD, FILENAME is interpreted relative to the current
+   working directory, as in openat.
+
+   If the link is small enough to fit into BUFFER put it there.
+   BUFFER's size is BUFFER_SIZE, and BUFFER can be null
+   if BUFFER_SIZE is zero.
+
+   If the link is not small, put it into a dynamically allocated
+   buffer managed by ALLOC.  It is the caller's responsibility to free
+   the returned value if it is nonnull and is not BUFFER.
+
+   The PREADLINKAT function specifies how to read links.  It operates
+   like POSIX readlinkat()
+   <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>
+   but can assume that its first argument is the same as FD.
+
+   If successful, return the buffer address; otherwise return NULL and
+   set errno.  */
+
+char *careadlinkat (int fd, char const *filename,
+                    char *buffer, size_t buffer_size,
+                    struct allocator const *alloc,
+                    ssize_t (*preadlinkat) (int, char const *,
+                                            char *, size_t));
+
+/* Suitable values for careadlinkat's FD and PREADLINKAT arguments,
+   when doing a plain readlink:
+   Pass FD = AT_FDCWD and PREADLINKAT = careadlinkatcwd.  */
+#if HAVE_READLINKAT
+/* AT_FDCWD is declared in <fcntl.h>, readlinkat in <unistd.h>.  */
+# define careadlinkatcwd readlinkat
+#else
+/* Define AT_FDCWD independently, so that the careadlinkat module does
+   not depend on the fcntl-h module.  The value does not matter, since
+   careadlinkatcwd ignores it, but we might as well use the same value
+   as fcntl-h.  */
+# ifndef AT_FDCWD
+#  define AT_FDCWD (-3041965)
+# endif
+ssize_t careadlinkatcwd (int fd, char const *filename,
+                         char *buffer, size_t buffer_size);
+#endif
+
+#endif /* _GL_CAREADLINKAT_H */
--- a/lib/clean-temp.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/clean-temp.h	Fri May 06 08:15:59 2011 -0700
@@ -1,5 +1,5 @@
 /* Temporary directories and temporary files with automatic cleanup.
-   Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
@@ -39,7 +39,11 @@
 
    This module provides support for temporary directories and temporary files
    inside these temporary directories.  Temporary files without temporary
-   directories are not supported here.  */
+   directories are not supported here.  The temporary directories and files
+   are automatically cleaned up (at the latest) when the program exits or
+   dies from a fatal signal such as SIGINT, SIGTERM, SIGHUP, but not if it
+   dies from a fatal signal such as SIGQUIT, SIGKILL, or SIGABRT, SIGSEGV,
+   SIGBUS, SIGILL, SIGFPE.  */
 
 struct temp_dir
 {
--- a/lib/close-hook.c	Fri Apr 01 16:04:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/* Hook for making the close() function extensible.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
-   Written by Bruno Haible <bruno@clisp.org>, 2009.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-
-/* Specification.  */
-#include "close-hook.h"
-
-#include <stdlib.h>
-#include <unistd.h>
-
-#undef close
-
-
-/* Currently, this entire code is only needed for the handling of sockets
-   on native Windows platforms.  */
-#if WINDOWS_SOCKETS
-
-/* The first and last link in the doubly linked list.
-   Initially the list is empty.  */
-static struct close_hook anchor = { &anchor, &anchor, NULL };
-
-int
-execute_close_hooks (int fd, const struct close_hook *remaining_list)
-{
-  if (remaining_list == &anchor)
-    /* End of list reached.  */
-    return close (fd);
-  else
-    return remaining_list->private_fn (fd, remaining_list->private_next);
-}
-
-int
-execute_all_close_hooks (int fd)
-{
-  return execute_close_hooks (fd, anchor.private_next);
-}
-
-void
-register_close_hook (close_hook_fn hook, struct close_hook *link)
-{
-  if (link->private_next == NULL && link->private_prev == NULL)
-    {
-      /* Add the link to the doubly linked list.  */
-      link->private_next = anchor.private_next;
-      link->private_prev = &anchor;
-      link->private_fn = hook;
-      anchor.private_next->private_prev = link;
-      anchor.private_next = link;
-    }
-  else
-    {
-      /* The link is already in use.  */
-      if (link->private_fn != hook)
-        abort ();
-    }
-}
-
-void
-unregister_close_hook (struct close_hook *link)
-{
-  struct close_hook *next = link->private_next;
-  struct close_hook *prev = link->private_prev;
-
-  if (next != NULL && prev != NULL)
-    {
-      /* The link is in use.  Remove it from the doubly linked list.  */
-      prev->private_next = next;
-      next->private_prev = prev;
-      /* Clear the link, to mark it unused.  */
-      link->private_next = NULL;
-      link->private_prev = NULL;
-      link->private_fn = NULL;
-    }
-}
-
-#endif
--- a/lib/close-hook.h	Fri Apr 01 16:04:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/* Hook for making the close() function extensible.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-#ifndef CLOSE_HOOK_H
-#define CLOSE_HOOK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Currently, this entire code is only needed for the handling of sockets
-   on native Windows platforms.  */
-#if WINDOWS_SOCKETS
-
-
-/* An element of the list of close hooks.
-   The fields of this structure are considered private.  */
-struct close_hook
-{
-  /* Doubly linked list.  */
-  struct close_hook *private_next;
-  struct close_hook *private_prev;
-  /* Function that treats the types of FD that it knows about and calls
-     execute_close_hooks (FD, REMAINING_LIST) as a fallback.  */
-  int (*private_fn) (int fd, const struct close_hook *remaining_list);
-};
-
-/* This type of function closes FD, applying special knowledge for the FD
-   types it knows about, and calls execute_close_hooks (FD, REMAINING_LIST)
-   for the other FD types.  */
-typedef int (*close_hook_fn) (int fd, const struct close_hook *remaining_list);
-
-/* Execute the close hooks in REMAINING_LIST.
-   Return 0 or -1, like close() would do.  */
-extern int execute_close_hooks (int fd, const struct close_hook *remaining_list);
-
-/* Execute all close hooks.
-   Return 0 or -1, like close() would do.  */
-extern int execute_all_close_hooks (int fd);
-
-/* Add a function to the list of close hooks.
-   The LINK variable points to a piece of memory which is guaranteed to be
-   accessible until the corresponding call to unregister_close_hook.  */
-extern void register_close_hook (close_hook_fn hook, struct close_hook *link);
-
-/* Removes a function from the list of close hooks.  */
-extern void unregister_close_hook (struct close_hook *link);
-
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CLOSE_HOOK_H */
--- a/lib/close.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/close.c	Fri May 06 08:15:59 2011 -0700
@@ -19,7 +19,7 @@
 /* Specification.  */
 #include <unistd.h>
 
-#include "close-hook.h"
+#include "fd-hook.h"
 
 /* Override close() to call into other gnulib modules.  */
 
@@ -28,7 +28,7 @@
 #undef close
 {
 #if WINDOWS_SOCKETS
-  int retval = execute_all_close_hooks (fd);
+  int retval = execute_all_close_hooks (close, fd);
 #else
   int retval = close (fd);
 #endif
--- a/lib/count-one-bits.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/count-one-bits.h	Fri May 06 08:15:59 2011 -0700
@@ -38,7 +38,7 @@
           count += count_one_bits_32 (x >> 31 >> 1);                        \
         return count;
 
-/* Compute and return the the number of 1-bits set in the least
+/* Compute and return the number of 1-bits set in the least
    significant 32 bits of X. */
 static inline int
 count_one_bits_32 (unsigned int x)
--- a/lib/dup3.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/dup3.c	Fri May 06 08:15:59 2011 -0700
@@ -26,20 +26,6 @@
 
 #include "binary-io.h"
 
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Woe32 API.  */
-
-# include <string.h>
-
-/* Get declarations of the Win32 API functions.  */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-
-/* Upper bound on getdtablesize().  See lib/getdtablesize.c.  */
-# define OPEN_MAX_MAX 0x10000
-
-#endif
-
 int
 dup3 (int oldfd, int newfd, int flags)
 {
--- a/lib/fchdir.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/fchdir.c	Fri May 06 08:15:59 2011 -0700
@@ -29,19 +29,13 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include "dosname.h"
+#include "filenamecat.h"
+
 #ifndef REPLACE_OPEN_DIRECTORY
 # define REPLACE_OPEN_DIRECTORY 0
 #endif
 
-#ifndef HAVE_CANONICALIZE_FILE_NAME
-# if GNULIB_CANONICALIZE || GNULIB_CANONICALIZE_LGPL
-#  define HAVE_CANONICALIZE_FILE_NAME 1
-# else
-#  define HAVE_CANONICALIZE_FILE_NAME 0
-#  define canonicalize_file_name(name) NULL
-# endif
-#endif
-
 /* This replacement assumes that a directory is not renamed while opened
    through a file descriptor.
 
@@ -90,36 +84,26 @@
   return true;
 }
 
-/* Return the canonical name of DIR in malloc'd storage.  */
+/* Return an absolute name of DIR in malloc'd storage.  */
 static char *
 get_name (char const *dir)
 {
+  char *cwd;
   char *result;
-  if (REPLACE_OPEN_DIRECTORY || !HAVE_CANONICALIZE_FILE_NAME)
-    {
-      /* The function canonicalize_file_name has not yet been ported
-         to mingw, with all its drive letter and backslash quirks.
-         Fortunately, getcwd is reliable in this case, but we ensure
-         we can get back to where we started before using it.  Treat
-         "." as a special case, as it is frequently encountered.  */
-      char *cwd = getcwd (NULL, 0);
-      int saved_errno;
-      if (dir[0] == '.' && dir[1] == '\0')
-        return cwd;
-      if (chdir (cwd))
-        return NULL;
-      result = chdir (dir) ? NULL : getcwd (NULL, 0);
-      saved_errno = errno;
-      if (chdir (cwd))
-        abort ();
-      free (cwd);
-      errno = saved_errno;
-    }
-  else
-    {
-      /* Avoid changing the directory.  */
-      result = canonicalize_file_name (dir);
-    }
+  int saved_errno;
+
+  if (IS_ABSOLUTE_FILE_NAME (dir))
+    return strdup (dir);
+
+  /* We often encounter "."; treat it as a special case.  */
+  cwd = getcwd (NULL, 0);
+  if (!cwd || (dir[0] == '.' && dir[1] == '\0'))
+    return cwd;
+
+  result = mfile_name_concat (cwd, dir, NULL);
+  saved_errno = errno;
+  free (cwd);
+  errno = saved_errno;
   return result;
 }
 
--- a/lib/fclose.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/fclose.c	Fri May 06 08:15:59 2011 -0700
@@ -22,18 +22,30 @@
 #include <errno.h>
 #include <unistd.h>
 
-/* Override fclose() to call the overridden close().  */
+#include "freading.h"
+
+/* Override fclose() to call the overridden fflush() or close().  */
 
 int
 rpl_fclose (FILE *fp)
 #undef fclose
 {
   int saved_errno = 0;
+  int fd;
 
-  if (fflush (fp))
+  /* Don't change behavior on memstreams.  */
+  fd = fileno (fp);
+  if (fd < 0)
+    return fclose (fp);
+
+  /* We only need to flush the file if it is not reading or if it is
+     seekable.  This only guarantees the file position of input files
+     if the fflush module is also in use.  */
+  if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1)
+      && fflush (fp))
     saved_errno = errno;
 
-  if (close (fileno (fp)) < 0 && saved_errno == 0)
+  if (close (fd) < 0 && saved_errno == 0)
     saved_errno = errno;
 
   fclose (fp); /* will fail with errno = EBADF */
--- a/lib/fcntl.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/fcntl.in.h	Fri May 06 08:15:59 2011 -0700
@@ -182,8 +182,7 @@
 #endif
 
 #if !defined O_CLOEXEC && defined O_NOINHERIT
-/* Mingw spells it `O_NOINHERIT'.  Intentionally leave it
-   undefined if not available.  */
+/* Mingw spells it `O_NOINHERIT'.  */
 # define O_CLOEXEC O_NOINHERIT
 #endif
 
@@ -219,6 +218,19 @@
 # define O_NONBLOCK O_NDELAY
 #endif
 
+/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero
+   value of O_NONBLOCK.  Otherwise, O_NONBLOCK is defined (above) to O_NDELAY
+   or to 0 as fallback.  */
+#if @GNULIB_NONBLOCKING@
+# if O_NONBLOCK
+#  define GNULIB_defined_O_NONBLOCK 0
+# else
+#  define GNULIB_defined_O_NONBLOCK 1
+#  undef O_NONBLOCK
+#  define O_NONBLOCK 0x40000000
+# endif
+#endif
+
 #ifndef O_NOCTTY
 # define O_NOCTTY 0
 #endif
@@ -247,6 +259,11 @@
 # define O_TTY_INIT 0
 #endif
 
+#if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+# undef O_ACCMODE
+# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+#endif
+
 /* For systems that distinguish between text and binary I/O.
    O_BINARY is usually declared in fcntl.h  */
 #if !defined O_BINARY && defined _O_BINARY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/fd-hook.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,116 @@
+/* Hook for making making file descriptor functions close(), ioctl() extensible.
+   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2009.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "fd-hook.h"
+
+#include <stdlib.h>
+
+/* Currently, this entire code is only needed for the handling of sockets
+   on native Windows platforms.  */
+#if WINDOWS_SOCKETS
+
+/* The first and last link in the doubly linked list.
+   Initially the list is empty.  */
+static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL };
+
+int
+execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary,
+                     int fd)
+{
+  if (remaining_list == &anchor)
+    /* End of list reached.  */
+    return primary (fd);
+  else
+    return remaining_list->private_close_fn (remaining_list->private_next,
+                                             primary, fd);
+}
+
+int
+execute_all_close_hooks (gl_close_fn primary, int fd)
+{
+  return execute_close_hooks (anchor.private_next, primary, fd);
+}
+
+int
+execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary,
+                     int fd, int request, void *arg)
+{
+  if (remaining_list == &anchor)
+    /* End of list reached.  */
+    return primary (fd, request, arg);
+  else
+    return remaining_list->private_ioctl_fn (remaining_list->private_next,
+                                             primary, fd, request, arg);
+}
+
+int
+execute_all_ioctl_hooks (gl_ioctl_fn primary,
+                         int fd, int request, void *arg)
+{
+  return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg);
+}
+
+void
+register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link)
+{
+  if (close_hook == NULL)
+    close_hook = execute_close_hooks;
+  if (ioctl_hook == NULL)
+    ioctl_hook = execute_ioctl_hooks;
+
+  if (link->private_next == NULL && link->private_prev == NULL)
+    {
+      /* Add the link to the doubly linked list.  */
+      link->private_next = anchor.private_next;
+      link->private_prev = &anchor;
+      link->private_close_fn = close_hook;
+      link->private_ioctl_fn = ioctl_hook;
+      anchor.private_next->private_prev = link;
+      anchor.private_next = link;
+    }
+  else
+    {
+      /* The link is already in use.  */
+      if (link->private_close_fn != close_hook
+          || link->private_ioctl_fn != ioctl_hook)
+        abort ();
+    }
+}
+
+void
+unregister_fd_hook (struct fd_hook *link)
+{
+  struct fd_hook *next = link->private_next;
+  struct fd_hook *prev = link->private_prev;
+
+  if (next != NULL && prev != NULL)
+    {
+      /* The link is in use.  Remove it from the doubly linked list.  */
+      prev->private_next = next;
+      next->private_prev = prev;
+      /* Clear the link, to mark it unused.  */
+      link->private_next = NULL;
+      link->private_prev = NULL;
+      link->private_close_fn = NULL;
+      link->private_ioctl_fn = NULL;
+    }
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/fd-hook.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,119 @@
+/* Hook for making making file descriptor functions close(), ioctl() extensible.
+   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+
+#ifndef FD_HOOK_H
+#define FD_HOOK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Currently, this entire code is only needed for the handling of sockets
+   on native Windows platforms.  */
+#if WINDOWS_SOCKETS
+
+
+/* Type of function that closes FD.  */
+typedef int (*gl_close_fn) (int fd);
+
+/* Type of function that applies a control request to FD.  */
+typedef int (*gl_ioctl_fn) (int fd, int request, void *arg);
+
+/* An element of the list of file descriptor hooks.
+   In CLOS (Common Lisp Object System) speak, it consists of an "around"
+   method for the close() function and an "around" method for the ioctl()
+   function.
+   The fields of this structure are considered private.  */
+struct fd_hook
+{
+  /* Doubly linked list.  */
+  struct fd_hook *private_next;
+  struct fd_hook *private_prev;
+  /* Function that treats the types of FD that it knows about and calls
+     execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback.  */
+  int (*private_close_fn) (const struct fd_hook *remaining_list,
+                           gl_close_fn primary,
+                           int fd);
+  /* Function that treats the types of FD that it knows about and calls
+     execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a
+     fallback.  */
+  int (*private_ioctl_fn) (const struct fd_hook *remaining_list,
+                           gl_ioctl_fn primary,
+                           int fd, int request, void *arg);
+};
+
+/* This type of function closes FD, applying special knowledge for the FD
+   types it knows about, and calls
+   execute_close_hooks (REMAINING_LIST, PRIMARY, FD)
+   for the other FD types.
+   In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
+   and PRIMARY is the "primary" method for close().  */
+typedef int (*close_hook_fn) (const struct fd_hook *remaining_list,
+                              gl_close_fn primary,
+                              int fd);
+
+/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method.
+   Return 0 or -1, like close() would do.  */
+extern int execute_close_hooks (const struct fd_hook *remaining_list,
+                                gl_close_fn primary,
+                                int fd);
+
+/* Execute all close hooks, with PRIMARY as "primary" method.
+   Return 0 or -1, like close() would do.  */
+extern int execute_all_close_hooks (gl_close_fn primary, int fd);
+
+/* This type of function applies a control request to FD, applying special
+   knowledge for the FD types it knows about, and calls
+   execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG)
+   for the other FD types.
+   In CLOS speak, REMAINING_LIST is the remaining list of "around" methods,
+   and PRIMARY is the "primary" method for ioctl().  */
+typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list,
+                              gl_ioctl_fn primary,
+                              int fd, int request, void *arg);
+
+/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method.
+   Return 0 or -1, like ioctl() would do.  */
+extern int execute_ioctl_hooks (const struct fd_hook *remaining_list,
+                                gl_ioctl_fn primary,
+                                int fd, int request, void *arg);
+
+/* Execute all ioctl hooks, with PRIMARY as "primary" method.
+   Return 0 or -1, like ioctl() would do.  */
+extern int execute_all_ioctl_hooks (gl_ioctl_fn primary,
+                                    int fd, int request, void *arg);
+
+/* Add a function pair to the list of file descriptor hooks.
+   CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change.
+   The LINK variable points to a piece of memory which is guaranteed to be
+   accessible until the corresponding call to unregister_fd_hook.  */
+extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook,
+                              struct fd_hook *link);
+
+/* Removes a hook from the list of file descriptor hooks.  */
+extern void unregister_fd_hook (struct fd_hook *link);
+
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FD_HOOK_H */
--- a/lib/gai_strerror.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/gai_strerror.c	Fri May 06 08:15:59 2011 -0700
@@ -32,6 +32,22 @@
 # define N_(String) String
 #endif
 
+#if HAVE_DECL_GAI_STRERROR
+
+# include <sys/socket.h>
+# undef gai_strerror
+# if HAVE_DECL_GAI_STRERRORA
+#  define gai_strerror gai_strerrorA
+# endif
+
+const char *
+rpl_gai_strerror (int code)
+{
+  return gai_strerror (code);
+}
+
+#else /* !HAVE_DECL_GAI_STRERROR */
+
 static struct
   {
     int code;
@@ -71,6 +87,7 @@
 
   return _("Unknown error");
 }
-#ifdef _LIBC
+# ifdef _LIBC
 libc_hidden_def (gai_strerror)
-#endif
+# endif
+#endif /* !HAVE_DECL_GAI_STRERROR */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/getcwd-lgpl.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,118 @@
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+   This file is part of gnulib.
+
+   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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification */
+#include <unistd.h>
+
+#include <errno.h>
+#include <string.h>
+
+#if GNULIB_GETCWD
+/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use.  */
+typedef int dummy;
+#else
+
+/* Get the name of the current working directory, and put it in SIZE
+   bytes of BUF.  Returns NULL if the directory couldn't be determined
+   (perhaps because the absolute name was longer than PATH_MAX, or
+   because of missing read/search permissions on parent directories)
+   or SIZE was too small.  If successful, returns BUF.  If BUF is
+   NULL, an array is allocated with `malloc'; the array is SIZE bytes
+   long, unless SIZE == 0, in which case it is as big as
+   necessary.  */
+
+# undef getcwd
+char *
+rpl_getcwd (char *buf, size_t size)
+{
+  char *ptr;
+  char *result;
+
+  /* Handle single size operations.  */
+  if (buf)
+    return getcwd (buf, size);
+
+  if (size)
+    {
+      buf = malloc (size);
+      if (!buf)
+        {
+          errno = ENOMEM;
+          return NULL;
+        }
+      result = getcwd (buf, size);
+      if (!result)
+        {
+          int saved_errno = errno;
+          free (buf);
+          errno = saved_errno;
+        }
+      return result;
+    }
+
+  /* Flexible sizing requested.  Avoid over-allocation for the common
+     case of a name that fits within a 4k page, minus some space for
+     local variables, to be sure we don't skip over a guard page.  */
+  {
+    char tmp[4032];
+    size = sizeof tmp;
+    ptr = getcwd (tmp, size);
+    if (ptr)
+      {
+        result = strdup (ptr);
+        if (!result)
+          errno = ENOMEM;
+        return result;
+      }
+    if (errno != ERANGE)
+      return NULL;
+  }
+
+  /* My what a large directory name we have.  */
+  do
+    {
+      size <<= 1;
+      ptr = realloc (buf, size);
+      if (ptr == NULL)
+        {
+          free (buf);
+          errno = ENOMEM;
+          return NULL;
+        }
+      buf = ptr;
+      result = getcwd (buf, size);
+    }
+  while (!result && errno == ERANGE);
+
+  if (!result)
+    {
+      int saved_errno = errno;
+      free (buf);
+      errno = saved_errno;
+    }
+  else
+    {
+      /* Trim to fit, if possible.  */
+      result = realloc (buf, strlen (buf) + 1);
+      if (!result)
+        result = buf;
+    }
+  return result;
+}
+
+#endif
--- a/lib/getsockopt.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/getsockopt.c	Fri May 06 08:15:59 2011 -0700
@@ -46,7 +46,8 @@
       int milliseconds_len = sizeof (int);
       struct timeval tv;
       size_t n;
-      r = getsockopt (sock, level, optname, &milliseconds, &milliseconds_len);
+      r = getsockopt (sock, level, optname, (char *) &milliseconds,
+                      &milliseconds_len);
       tv.tv_sec = milliseconds / 1000;
       tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000;
       n = sizeof (struct timeval);
--- a/lib/hash.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/hash.c	Fri May 06 08:15:59 2011 -0700
@@ -27,7 +27,7 @@
 #include "hash.h"
 
 #include "bitrotate.h"
-#include "xalloc.h"
+#include "xalloc-oversized.h"
 
 #include <stdint.h>
 #include <stdio.h>
--- a/lib/inttypes.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/inttypes.in.h	Fri May 06 08:15:59 2011 -0700
@@ -1076,6 +1076,7 @@
 
 #if @GNULIB_STRTOIMAX@
 # if !@HAVE_DECL_STRTOIMAX@
+#  undef strtoimax
 extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -1088,6 +1089,7 @@
 
 #if @GNULIB_STRTOUMAX@
 # if !@HAVE_DECL_STRTOUMAX@
+#  undef strtoumax
 extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
 # endif
 #elif defined GNULIB_POSIXCHECK
--- a/lib/ioctl.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/ioctl.c	Fri May 06 08:15:59 2011 -0700
@@ -44,35 +44,36 @@
 
 #else /* mingw */
 
-# define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-# include <sys/socket.h>
+# include <errno.h>
 
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-# include "w32sock.h"
+# include "fd-hook.h"
 
-int
-ioctl (int fd, int req, ...)
+static int
+primary_ioctl (int fd, int request, void *arg)
 {
-  void *buf;
-  va_list args;
-  SOCKET sock;
-  int r;
-
-  va_start (args, req);
-  buf = va_arg (args, void *);
-  va_end (args);
-
   /* We don't support FIONBIO on pipes here.  If you want to make pipe
      fds non-blocking, use the gnulib 'nonblocking' module, until
      gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK.  */
 
-  sock = FD_TO_SOCKET (fd);
-  r = ioctlsocket (sock, req, buf);
-  if (r < 0)
-    set_winsock_errno ();
+  errno = ENOSYS;
+  return -1;
+}
+
+int
+ioctl (int fd, int request, ... /* {void *,char *} arg */)
+{
+  void *arg;
+  va_list args;
 
-  return r;
+  va_start (args, request);
+  arg = va_arg (args, void *);
+  va_end (args);
+
+# if WINDOWS_SOCKETS
+  return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg);
+# else
+  return primary_ioctl (fd, request, arg);
+# endif
 }
 
 #endif
--- a/lib/malloc.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/malloc.c	Fri May 06 08:15:59 2011 -0700
@@ -18,6 +18,7 @@
 
 /* written by Jim Meyering and Bruno Haible */
 
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 /* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h.  */
 #ifdef malloc
@@ -28,14 +29,10 @@
 # define NEED_MALLOC_GNU 1
 #endif
 
-/* Specification.  */
 #include <stdlib.h>
 
 #include <errno.h>
 
-/* Call the system's malloc below.  */
-#undef malloc
-
 /* Allocate an N-byte block of memory from the heap.
    If N is zero, allocate a 1-byte block.  */
 
--- a/lib/malloca.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/malloca.c	Fri May 06 08:15:59 2011 -0700
@@ -16,6 +16,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
 /* Specification.  */
@@ -23,9 +24,6 @@
 
 #include "verify.h"
 
-/* Use the system functions, not the gnulib overrides in this file.  */
-#undef malloc
-
 /* The speed critical point in this file is freea() applied to an alloca()
    result: it must be fast, to match the speed of alloca().  The speed of
    mmalloca() and freea() in the other case are not critical, because they
--- a/lib/mbrtowc.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/mbrtowc.c	Fri May 06 08:15:59 2011 -0700
@@ -335,7 +335,7 @@
   {
     static mbstate_t internal_state;
 
-    /* Override mbrtowc's internal state.  We can not call mbsinit() on the
+    /* Override mbrtowc's internal state.  We cannot call mbsinit() on the
        hidden internal state, but we can call it on our variable.  */
     if (ps == NULL)
       ps = &internal_state;
--- a/lib/mgetgroups.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/mgetgroups.c	Fri May 06 08:15:59 2011 -0700
@@ -31,7 +31,7 @@
 #endif
 
 #include "getugroups.h"
-#include "xalloc.h"
+#include "xalloc-oversized.h"
 
 static gid_t *
 realloc_groupbuf (gid_t *g, size_t num)
@@ -193,14 +193,3 @@
 
   return ng;
 }
-
-/* Like mgetgroups, but call xalloc_die on allocation failure.  */
-
-int
-xgetgroups (char const *username, gid_t gid, gid_t **groups)
-{
-  int result = mgetgroups (username, gid, groups);
-  if (result == -1 && errno == ENOMEM)
-    xalloc_die ();
-  return result;
-}
--- a/lib/mgetgroups.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/mgetgroups.h	Fri May 06 08:15:59 2011 -0700
@@ -17,4 +17,6 @@
 #include <sys/types.h>
 
 int mgetgroups (const char *username, gid_t gid, gid_t **groups);
+#if GNULIB_XGETGROUPS
 int xgetgroups (const char *username, gid_t gid, gid_t **groups);
+#endif
--- a/lib/mkstemp.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/mkstemp.c	Fri May 06 08:15:59 2011 -0700
@@ -38,7 +38,11 @@
 /* Generate a unique temporary file name from XTEMPLATE.
    The last six characters of XTEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the file name unique.
-   Then open the file and return a fd. */
+   Then open the file and return a fd.
+
+   If you are creating temporary files which will later be removed,
+   consider using the clean-temp module, which avoids several pitfalls
+   of using mkstemp directly. */
 int
 mkstemp (char *xtemplate)
 {
--- a/lib/netdb.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/netdb.in.h	Fri May 06 08:15:59 2011 -0700
@@ -41,6 +41,8 @@
    'struct hostent' on MinGW.  */
 #include <sys/socket.h>
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
@@ -52,6 +54,10 @@
 
 # if !@HAVE_STRUCT_ADDRINFO@
 
+#  ifdef __cplusplus
+extern "C" {
+#  endif
+
 #  if !GNULIB_defined_struct_addrinfo
 /* Structure to contain information about address of a service provider.  */
 struct addrinfo
@@ -67,6 +73,11 @@
 };
 #   define GNULIB_defined_struct_addrinfo 1
 #  endif
+
+#  ifdef __cplusplus
+}
+#  endif
+
 # endif
 
 /* Possible values for `ai_flags' field in `addrinfo' structure.  */
@@ -153,37 +164,67 @@
    socket addresses.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
-extern int getaddrinfo (const char *restrict nodename,
-                        const char *restrict servname,
-                        const struct addrinfo *restrict hints,
-                        struct addrinfo **restrict res)
-     _GL_ARG_NONNULL ((4));
+_GL_FUNCDECL_SYS (getaddrinfo, int,
+                  (const char *restrict nodename,
+                   const char *restrict servname,
+                   const struct addrinfo *restrict hints,
+                   struct addrinfo **restrict res)
+                  _GL_ARG_NONNULL ((4)));
 # endif
+_GL_CXXALIAS_SYS (getaddrinfo, int,
+                  (const char *restrict nodename,
+                   const char *restrict servname,
+                   const struct addrinfo *restrict hints,
+                   struct addrinfo **restrict res));
+_GL_CXXALIASWARN (getaddrinfo);
 
 # if !@HAVE_DECL_FREEADDRINFO@
 /* Free `addrinfo' structure AI including associated storage.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
-extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
+                                      _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
+_GL_CXXALIASWARN (freeaddrinfo);
 
-# if !@HAVE_DECL_GAI_STRERROR@
+# if @REPLACE_GAI_STRERROR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gai_strerror
+#   define gai_strerror rpl_gai_strerror
+#  endif
+_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
+_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
+# else
+#  if !@HAVE_DECL_GAI_STRERROR@
 /* Convert error return from getaddrinfo() to a string.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/gai_strerror.html>.  */
-extern const char *gai_strerror (int ecode);
+_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
+#  endif
+_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
 # endif
+_GL_CXXALIASWARN (gai_strerror);
 
 # if !@HAVE_DECL_GETNAMEINFO@
 /* Convert socket address to printable node and service names.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
-extern int getnameinfo (const struct sockaddr *restrict sa, socklen_t salen,
+_GL_FUNCDECL_SYS (getnameinfo, int,
+                  (const struct sockaddr *restrict sa, socklen_t salen,
+                   char *restrict node, socklen_t nodelen,
+                   char *restrict service, socklen_t servicelen,
+                   int flags)
+                  _GL_ARG_NONNULL ((1)));
+# endif
+/* Need to cast, because on glibc systems, the seventh parameter is
+                        unsigned int flags.  */
+_GL_CXXALIAS_SYS_CAST (getnameinfo, int,
+                       (const struct sockaddr *restrict sa, socklen_t salen,
                         char *restrict node, socklen_t nodelen,
                         char *restrict service, socklen_t servicelen,
-                        int flags)
-     _GL_ARG_NONNULL ((1));
-# endif
+                        int flags));
+_GL_CXXALIASWARN (getnameinfo);
 
 /* Possible flags for getnameinfo.  */
 # ifndef NI_NUMERICHOST
--- a/lib/nonblocking.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/nonblocking.c	Fri May 06 08:15:59 2011 -0700
@@ -113,7 +113,7 @@
 
 # include <fcntl.h>
 
-# if !O_NONBLOCK
+# if GNULIB_defined_O_NONBLOCK
 #  error Please port nonblocking to your platform
 # endif
 
--- a/lib/open.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/open.c	Fri May 06 08:15:59 2011 -0700
@@ -63,6 +63,15 @@
       va_end (arg);
     }
 
+#if GNULIB_defined_O_NONBLOCK
+  /* The only known platform that lacks O_NONBLOCK is mingw, but it
+     also lacks named pipes and Unix sockets, which are the only two
+     file types that require non-blocking handling in open().
+     Therefore, it is safe to ignore O_NONBLOCK here.  It is handy
+     that mingw also lacks openat(), so that is also covered here.  */
+  flags &= ~O_NONBLOCK;
+#endif
+
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
   if (strcmp (filename, "/dev/null") == 0)
     filename = "NUL";
--- a/lib/passfd.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/passfd.c	Fri May 06 08:15:59 2011 -0700
@@ -24,20 +24,23 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
-#include <sys/uio.h>
 #include <unistd.h>
 
 #include <sys/socket.h>
-#if HAVE_SYS_UN_H
-# include <sys/un.h>
-#endif
 
 #include "cloexec.h"
 
+/* The code that uses CMSG_FIRSTHDR is enabled on
+   Linux, MacOS X, FreeBSD, OpenBSD, NetBSD, AIX, OSF/1, Cygwin.
+   The code that uses HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS is enabled on
+   HP-UX, IRIX, Solaris.  */
+
+/* MSG_CMSG_CLOEXEC is defined only on Linux, as of 2011.  */
 #ifndef MSG_CMSG_CLOEXEC
 # define MSG_CMSG_CLOEXEC 0
 #endif
 
+#if HAVE_SENDMSG
 /* sendfd sends the file descriptor fd along the socket
    to a process calling recvfd on the other end.
 
@@ -46,24 +49,24 @@
 int
 sendfd (int sock, int fd)
 {
-  char send = 0;
+  char byte = 0;
   struct iovec iov;
   struct msghdr msg;
-#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
+# ifdef CMSG_FIRSTHDR
   struct cmsghdr *cmsg;
   char buf[CMSG_SPACE (sizeof fd)];
-#endif
+# endif
 
   /* send at least one char */
   memset (&msg, 0, sizeof msg);
-  iov.iov_base = &send;
+  iov.iov_base = &byte;
   iov.iov_len = 1;
   msg.msg_iov = &iov;
   msg.msg_iovlen = 1;
   msg.msg_name = NULL;
   msg.msg_namelen = 0;
 
-#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
+# ifdef CMSG_FIRSTHDR
   msg.msg_control = buf;
   msg.msg_controllen = sizeof buf;
   cmsg = CMSG_FIRSTHDR (&msg);
@@ -72,19 +75,29 @@
   cmsg->cmsg_len = CMSG_LEN (sizeof fd);
   /* Initialize the payload: */
   memcpy (CMSG_DATA (cmsg), &fd, sizeof fd);
-#elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY
+# elif HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
   msg.msg_accrights = &fd;
   msg.msg_accrightslen = sizeof fd;
-#else
+# else
   errno = ENOSYS;
   return -1;
-#endif
+# endif
 
   if (sendmsg (sock, &msg, 0) != iov.iov_len)
     return -1;
   return 0;
 }
+#else
+int
+sendfd (int sock _GL_UNUSED, int fd _GL_UNUSED)
+{
+  errno = ENOSYS;
+  return -1;
+}
+#endif
 
+
+#if HAVE_RECVMSG
 /* recvfd receives a file descriptor through the socket.
    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>).
 
@@ -93,15 +106,15 @@
 int
 recvfd (int sock, int flags)
 {
-  char recv = 0;
+  char byte = 0;
   struct iovec iov;
   struct msghdr msg;
   int fd = -1;
-#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
+# ifdef CMSG_FIRSTHDR
   struct cmsghdr *cmsg;
   char buf[CMSG_SPACE (sizeof fd)];
   int flags_recvmsg = flags & O_CLOEXEC ? MSG_CMSG_CLOEXEC : 0;
-#endif
+# endif
 
   if ((flags & ~O_CLOEXEC) != 0)
     {
@@ -111,14 +124,14 @@
 
   /* send at least one char */
   memset (&msg, 0, sizeof msg);
-  iov.iov_base = &recv;
+  iov.iov_base = &byte;
   iov.iov_len = 1;
   msg.msg_iov = &iov;
   msg.msg_iovlen = 1;
   msg.msg_name = NULL;
   msg.msg_namelen = 0;
 
-#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY
+# ifdef CMSG_FIRSTHDR
   msg.msg_control = buf;
   msg.msg_controllen = sizeof buf;
   cmsg = CMSG_FIRSTHDR (&msg);
@@ -156,7 +169,7 @@
         }
     }
 
-#elif HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY
+# elif HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
   msg.msg_accrights = &fd;
   msg.msg_accrightslen = sizeof fd;
   if (recvmsg (sock, &msg, 0) < 0)
@@ -173,9 +186,17 @@
           return -1;
         }
     }
-#else
+# else
   errno = ENOSYS;
-#endif
+# endif
 
   return fd;
 }
+#else
+int
+recvfd (int sock _GL_UNUSED, int flags _GL_UNUSED)
+{
+  errno = ENOSYS;
+  return -1;
+}
+#endif
--- a/lib/pipe-filter-aux.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/pipe-filter-aux.h	Fri May 06 08:15:59 2011 -0700
@@ -102,9 +102,6 @@
 #endif
 
 /* Non-blocking I/O.  */
-#ifndef O_NONBLOCK
-# define O_NONBLOCK O_NDELAY
-#endif
 #if HAVE_SELECT
 # define IS_EAGAIN(errcode) 0
 #else
--- a/lib/pipe2.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/pipe2.c	Fri May 06 08:15:59 2011 -0700
@@ -24,6 +24,7 @@
 #include <fcntl.h>
 
 #include "binary-io.h"
+#include "nonblocking.h"
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 /* Native Woe32 API.  */
@@ -55,34 +56,37 @@
   }
 #endif
 
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Woe32 API.  */
-
   /* Check the supported flags.  */
-  if ((flags & ~(O_CLOEXEC | O_BINARY | O_TEXT)) != 0)
+  if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_BINARY | O_TEXT)) != 0)
     {
       errno = EINVAL;
       return -1;
     }
 
-  return _pipe (fd, 4096, flags);
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Native Woe32 API.  */
+
+  if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
+    return -1;
+
+  if (flags & O_NONBLOCK)
+    {
+      if (set_nonblocking_flag (fd[0], true) != 0
+          || set_nonblocking_flag (fd[1], true) != 0)
+        goto fail;
+    }
+
+  return 0;
 
 #else
 /* Unix API.  */
 
-  /* Check the supported flags.  */
-  if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_TEXT | O_BINARY)) != 0)
-    {
-      errno = EINVAL;
-      return -1;
-    }
-
   if (pipe (fd) < 0)
     return -1;
 
   /* POSIX <http://www.opengroup.org/onlinepubs/9699919799/functions/pipe.html>
      says that initially, the O_NONBLOCK and FD_CLOEXEC flags are cleared on
-     both fd[0] amd fd[1].  */
+     both fd[0] and fd[1].  */
 
   if (flags & O_NONBLOCK)
     {
@@ -121,6 +125,8 @@
 
   return 0;
 
+#endif
+
  fail:
   {
     int saved_errno = errno;
@@ -129,6 +135,4 @@
     errno = saved_errno;
     return -1;
   }
-
-#endif
 }
--- a/lib/progreloc.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/progreloc.c	Fri May 06 08:15:59 2011 -0700
@@ -16,6 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
 /* Specification.  */
@@ -94,7 +95,6 @@
 #undef close
 
 /* Use the system functions, not the gnulib overrides in this file.  */
-#undef malloc
 #undef sprintf
 
 #undef set_program_name
--- a/lib/quotearg.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/quotearg.c	Fri May 06 08:15:59 2011 -0700
@@ -168,10 +168,10 @@
 static struct quoting_options
 quoting_options_from_style (enum quoting_style style)
 {
-  struct quoting_options o;
+  struct quoting_options o = { 0 };
+  if (style == custom_quoting_style)
+    abort ();
   o.style = style;
-  o.flags = 0;
-  memset (o.quote_these_too, 0, sizeof o.quote_these_too);
   return o;
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/read.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,59 @@
+/* POSIX compatible read() function.
+   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <unistd.h>
+
+/* Replace this function only if module 'nonblocking' is requested.  */
+#if GNULIB_NONBLOCKING
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+#  include <errno.h>
+#  include <io.h>
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+ssize_t
+rpl_read (int fd, void *buf, size_t count)
+#undef read
+{
+  ssize_t ret = read (fd, buf, count);
+
+  if (ret < 0
+      && GetLastError () == ERROR_NO_DATA)
+    {
+      HANDLE h = (HANDLE) _get_osfhandle (fd);
+      if (GetFileType (h) == FILE_TYPE_PIPE)
+        {
+          /* h is a pipe or socket.  */
+          DWORD state;
+          if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL, NULL, 0)
+              && (state & PIPE_NOWAIT) != 0)
+            /* h is a pipe in non-blocking mode.
+               Change errno from EINVAL to EAGAIN.  */
+            errno = EAGAIN;
+        }
+    }
+  return ret;
+}
+
+# endif
+#endif
--- a/lib/realloc.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/realloc.c	Fri May 06 08:15:59 2011 -0700
@@ -18,6 +18,7 @@
 
 /* written by Jim Meyering and Bruno Haible */
 
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
 /* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h.  */
@@ -34,23 +35,10 @@
 # define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
 #endif
 
-/* Below we want to call the system's malloc and realloc.
-   Undefine the symbols here so that including <stdlib.h> provides a
-   declaration of malloc(), not of rpl_malloc(), and likewise for realloc.  */
-#undef malloc
-#undef realloc
-
-/* Specification.  */
 #include <stdlib.h>
 
 #include <errno.h>
 
-/* Below we want to call the system's malloc and realloc.
-   Undefine the symbols, if they were defined by gnulib's <stdlib.h>
-   replacement.  */
-#undef malloc
-#undef realloc
-
 /* Change the size of an allocated block of memory P to N bytes,
    with error checking.  If N is zero, change it to 1.  If P is NULL,
    use malloc.  */
--- a/lib/relocatable.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/relocatable.c	Fri May 06 08:15:59 2011 -0700
@@ -25,6 +25,7 @@
 # define _GNU_SOURCE 1
 #endif
 
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
 /* Specification.  */
@@ -86,9 +87,6 @@
 # define FILE_SYSTEM_PREFIX_LEN(P) 0
 #endif
 
-/* Use the system functions, not the gnulib overrides in this file.  */
-#undef malloc
-
 /* Original installation prefix.  */
 static char *orig_prefix;
 static size_t orig_prefix_len;
--- a/lib/relocwrapper.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/relocwrapper.c	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,9 @@
     -> progname
     -> progreloc
         -> areadlink
-           -> readlink
+           -> careadlinkat
+             -> allocator
+             -> readlink
         -> canonicalize-lgpl
            -> malloca
            -> readlink
@@ -43,6 +45,7 @@
    libc functions, no gettext(), no error(), no xmalloc(), no xsetenv().
  */
 
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
 #include <stdio.h>
@@ -58,7 +61,6 @@
 
 /* Use the system functions, not the gnulib overrides in this file.  */
 #undef fprintf
-#undef malloc
 
 /* Return a copy of the filename, with an extra ".bin" at the end.
    More generally, it replaces "${EXEEXT}" at the end with ".bin${EXEEXT}".  */
--- a/lib/save-cwd.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/save-cwd.c	Fri May 06 08:15:59 2011 -0700
@@ -50,7 +50,8 @@
    The `raison d'etre' for this interface is that the working directory
    is sometimes inaccessible, and getcwd is not robust or as efficient.
    So, we prefer to use the open/fchdir approach, but fall back on
-   getcwd if necessary.
+   getcwd if necessary.  This module works for most cases with just
+   the getcwd-lgpl module, but to be truly robust, use the getcwd module.
 
    Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin,
    SCO Xenix.  Also, SunOS 4 and Irix 5.3 provide the function, yet it
--- a/lib/setenv.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/setenv.c	Fri May 06 08:15:59 2011 -0700
@@ -15,6 +15,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #if !_LIBC
+# define _GL_USE_STDLIB_ALLOC 1
 # include <config.h>
 #endif
 
@@ -64,10 +65,6 @@
 # define clearenv __clearenv
 # define tfind __tfind
 # define tsearch __tsearch
-#else
-/* Use the system functions, not the gnulib overrides in this file.  */
-# undef malloc
-# undef realloc
 #endif
 
 /* In the GNU C library implementation we try to be more clever and
--- a/lib/signal.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/signal.in.h	Fri May 06 08:15:59 2011 -0700
@@ -66,6 +66,20 @@
 # endif
 #endif
 
+/* Define sighandler_t, the type of signal handlers.  A GNU extension.  */
+#if !@HAVE_SIGHANDLER_T@
+# ifdef __cplusplus
+extern "C" {
+# endif
+# if !GNULIB_defined_sighandler_t
+typedef void (*sighandler_t) (int);
+#  define GNULIB_defined_sighandler_t 1
+# endif
+# ifdef __cplusplus
+}
+# endif
+#endif
+
 
 #if @GNULIB_SIGNAL_H_SIGPIPE@
 # ifndef SIGPIPE
--- a/lib/sockets.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/sockets.c	Fri May 06 08:15:59 2011 -0700
@@ -27,13 +27,15 @@
 /* This includes winsock2.h on MinGW. */
 # include <sys/socket.h>
 
-# include "close-hook.h"
+# include "fd-hook.h"
 
 /* Get set_winsock_errno, FD_TO_SOCKET etc. */
 # include "w32sock.h"
 
 static int
-close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
+close_fd_maybe_socket (const struct fd_hook *remaining_list,
+                       gl_close_fn primary,
+                       int fd)
 {
   SOCKET sock;
   WSANETWORKEVENTS ev;
@@ -64,10 +66,38 @@
     }
   else
     /* Some other type of file descriptor.  */
-    return execute_close_hooks (fd, remaining_list);
+    return execute_close_hooks (remaining_list, primary, fd);
 }
 
-static struct close_hook close_sockets_hook;
+static int
+ioctl_fd_maybe_socket (const struct fd_hook *remaining_list,
+                       gl_ioctl_fn primary,
+                       int fd, int request, void *arg)
+{
+  SOCKET sock;
+  WSANETWORKEVENTS ev;
+
+  /* Test whether fd refers to a socket.  */
+  sock = FD_TO_SOCKET (fd);
+  ev.lNetworkEvents = 0xDEADBEEF;
+  WSAEnumNetworkEvents (sock, NULL, &ev);
+  if (ev.lNetworkEvents != 0xDEADBEEF)
+    {
+      /* fd refers to a socket.  */
+      if (ioctlsocket (sock, request, arg) < 0)
+        {
+          set_winsock_errno ();
+          return -1;
+        }
+      else
+        return 0;
+    }
+  else
+    /* Some other type of file descriptor.  */
+    return execute_ioctl_hooks (remaining_list, primary, fd, request, arg);
+}
+
+static struct fd_hook fd_sockets_hook;
 
 static int initialized_sockets_version /* = 0 */;
 
@@ -90,7 +120,8 @@
         return 2;
 
       if (initialized_sockets_version == 0)
-        register_close_hook (close_fd_maybe_socket, &close_sockets_hook);
+        register_fd_hook (close_fd_maybe_socket, ioctl_fd_maybe_socket,
+                          &fd_sockets_hook);
 
       initialized_sockets_version = version;
     }
@@ -107,7 +138,7 @@
 
   initialized_sockets_version = 0;
 
-  unregister_close_hook (&close_sockets_hook);
+  unregister_fd_hook (&fd_sockets_hook);
 
   err = WSACleanup ();
   if (err != 0)
--- a/lib/stat-time.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/stat-time.h	Fri May 06 08:15:59 2011 -0700
@@ -175,7 +175,7 @@
      using zero.  Attempt to work around this problem.  Alas, this can
      report failure even for valid time stamps.  Also, NetBSD
      sometimes returns junk in the birth time fields; work around this
-     bug if it it is detected.  There's no need to detect negative
+     bug if it is detected.  There's no need to detect negative
      tv_nsec junk as negative tv_nsec already indicates an error.  */
   if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec)
     t.tv_nsec = -1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/stdio-read.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,148 @@
+/* POSIX compatible FILE stream read function.
+   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Written by Bruno Haible <bruno@clisp.org>, 2011.
+
+   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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+/* Replace these functions only if module 'nonblocking' is requested.  */
+#if GNULIB_NONBLOCKING
+
+/* On native Windows platforms, when read() is called on a non-blocking pipe
+   with an empty buffer, ReadFile() fails with error GetLastError() =
+   ERROR_NO_DATA, and read() in consequence fails with error EINVAL.  This
+   read() function is at the basis of the function which fills the buffer of
+   a FILE stream.  */
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+
+#  include <errno.h>
+#  include <io.h>
+
+#  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#  include <windows.h>
+
+#  define CALL_WITH_ERRNO_FIX(RETTYPE, EXPRESSION, FAILED) \
+  if (ferror (stream))                                                        \
+    return (EXPRESSION);                                                      \
+  else                                                                        \
+    {                                                                         \
+      RETTYPE ret;                                                            \
+      SetLastError (0);                                                       \
+      ret = (EXPRESSION);                                                     \
+      if (FAILED)                                                             \
+        {                                                                     \
+          if (GetLastError () == ERROR_NO_DATA && ferror (stream))            \
+            {                                                                 \
+              int fd = fileno (stream);                                       \
+              if (fd >= 0)                                                    \
+                {                                                             \
+                  HANDLE h = (HANDLE) _get_osfhandle (fd);                    \
+                  if (GetFileType (h) == FILE_TYPE_PIPE)                      \
+                    {                                                         \
+                      /* h is a pipe or socket.  */                           \
+                      DWORD state;                                            \
+                      if (GetNamedPipeHandleState (h, &state, NULL, NULL,     \
+                                                   NULL, NULL, 0)             \
+                          && (state & PIPE_NOWAIT) != 0)                      \
+                        /* h is a pipe in non-blocking mode.                  \
+                           Change errno from EINVAL to EAGAIN.  */            \
+                        errno = EAGAIN;                                       \
+                    }                                                         \
+                }                                                             \
+            }                                                                 \
+        }                                                                     \
+      return ret;                                                             \
+    }
+
+int
+scanf (const char *format, ...)
+{
+  int retval;
+  va_list args;
+
+  va_start (args, format);
+  retval = vfscanf (stdin, format, args);
+  va_end (args);
+
+  return retval;
+}
+
+int
+fscanf (FILE *stream, const char *format, ...)
+{
+  int retval;
+  va_list args;
+
+  va_start (args, format);
+  retval = vfscanf (stream, format, args);
+  va_end (args);
+
+  return retval;
+}
+
+int
+vscanf (const char *format, va_list args)
+{
+  return vfscanf (stdin, format, args);
+}
+
+int
+vfscanf (FILE *stream, const char *format, va_list args)
+#undef vfscanf
+{
+  CALL_WITH_ERRNO_FIX (int, vfscanf (stream, format, args), ret == EOF)
+}
+
+int
+getchar (void)
+{
+  return fgetc (stdin);
+}
+
+int
+fgetc (FILE *stream)
+#undef fgetc
+{
+  CALL_WITH_ERRNO_FIX (int, fgetc (stream), ret == EOF)
+}
+
+char *
+fgets (char *s, int n, FILE *stream)
+#undef fgets
+{
+  CALL_WITH_ERRNO_FIX (char *, fgets (s, n, stream), ret == NULL)
+}
+
+char *
+gets (char *s)
+#undef gets
+{
+  FILE *stream = stdin;
+  CALL_WITH_ERRNO_FIX (char *, gets (s), ret == NULL)
+}
+
+size_t
+fread (void *ptr, size_t s, size_t n, FILE *stream)
+#undef fread
+{
+  CALL_WITH_ERRNO_FIX (size_t, fread (ptr, s, n, stream), ret < n)
+}
+
+# endif
+#endif
--- a/lib/stdio-write.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/stdio-write.c	Fri May 06 08:15:59 2011 -0700
@@ -20,8 +20,9 @@
 /* Specification.  */
 #include <stdio.h>
 
-/* Replace these functions only if module 'sigpipe' is requested.  */
-#if GNULIB_SIGPIPE
+/* Replace these functions only if module 'nonblocking' or module 'sigpipe' is
+   requested.  */
+#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE
 
 /* On native Windows platforms, SIGPIPE does not exist.  When write() is
    called on a pipe with no readers, WriteFile() fails with error
@@ -38,26 +39,73 @@
 #  define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 #  include <windows.h>
 
+#  if GNULIB_NONBLOCKING
+#   define CLEAR_ERRNO \
+      errno = 0;
+#   define HANDLE_ENOSPC \
+          if (errno == ENOSPC && ferror (stream))                             \
+            {                                                                 \
+              int fd = fileno (stream);                                       \
+              if (fd >= 0)                                                    \
+                {                                                             \
+                  HANDLE h = (HANDLE) _get_osfhandle (fd);                    \
+                  if (GetFileType (h) == FILE_TYPE_PIPE)                      \
+                    {                                                         \
+                      /* h is a pipe or socket.  */                           \
+                      DWORD state;                                            \
+                      if (GetNamedPipeHandleState (h, &state, NULL, NULL,     \
+                                                   NULL, NULL, 0)             \
+                          && (state & PIPE_NOWAIT) != 0)                      \
+                        /* h is a pipe in non-blocking mode.                  \
+                           Change errno from ENOSPC to EAGAIN.  */            \
+                        errno = EAGAIN;                                       \
+                    }                                                         \
+                }                                                             \
+            }                                                                 \
+          else
+#  else
+#   define CLEAR_ERRNO
+#   define HANDLE_ENOSPC
+#  endif
+
+#  if GNULIB_SIGPIPE
+#   define CLEAR_LastError \
+      SetLastError (0);
+#   define HANDLE_ERROR_NO_DATA \
+          if (GetLastError () == ERROR_NO_DATA && ferror (stream))            \
+            {                                                                 \
+              int fd = fileno (stream);                                       \
+              if (fd >= 0                                                     \
+                  && GetFileType ((HANDLE) _get_osfhandle (fd))               \
+                     == FILE_TYPE_PIPE)                                       \
+                {                                                             \
+                  /* Try to raise signal SIGPIPE.  */                         \
+                  raise (SIGPIPE);                                            \
+                  /* If it is currently blocked or ignored, change errno from \
+                     EINVAL to EPIPE.  */                                     \
+                  errno = EPIPE;                                              \
+                }                                                             \
+            }                                                                 \
+          else
+#  else
+#   define CLEAR_LastError
+#   define HANDLE_ERROR_NO_DATA
+#  endif
+
 #  define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \
   if (ferror (stream))                                                        \
     return (EXPRESSION);                                                      \
   else                                                                        \
     {                                                                         \
       RETTYPE ret;                                                            \
-      SetLastError (0);                                                       \
+      CLEAR_ERRNO                                                             \
+      CLEAR_LastError                                                         \
       ret = (EXPRESSION);                                                     \
-      if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream))      \
+      if (FAILED)                                                             \
         {                                                                     \
-          int fd = fileno (stream);                                           \
-          if (fd >= 0                                                         \
-              && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\
-            {                                                                 \
-              /* Try to raise signal SIGPIPE.  */                             \
-              raise (SIGPIPE);                                                \
-              /* If it is currently blocked or ignored, change errno from     \
-                 EINVAL to EPIPE.  */                                         \
-              errno = EPIPE;                                                  \
-            }                                                                 \
+          HANDLE_ENOSPC                                                       \
+          HANDLE_ERROR_NO_DATA                                                \
+          ;                                                                   \
         }                                                                     \
       return ret;                                                             \
     }
--- a/lib/stdio.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/stdio.in.h	Fri May 06 08:15:59 2011 -0700
@@ -87,6 +87,25 @@
 #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
   _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
 
+/* _GL_ATTRIBUTE_FORMAT_SCANF
+   indicates to GCC that the function takes a format string and arguments,
+   where the format string directives are the ones standardized by ISO C99
+   and POSIX.  */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
+   _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
+#else
+# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
+   _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
+#endif
+
+/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
+   except that it indicates to GCC that the supported format string directives
+   are the ones of the system scanf(), rather than the ones standardized by
+   ISO C99 and POSIX.  */
+#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
+  _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
+
 /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>.  */
 /* But in any case avoid namespace pollution on glibc systems.  */
 #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
@@ -175,11 +194,34 @@
                  "use gnulib module fflush for portable POSIX compliance");
 #endif
 
-/* It is very rare that the developer ever has full control of stdin,
-   so any use of gets warrants an unconditional warning.  Assume it is
-   always declared, since it is required by C89.  */
-#undef gets
-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#if @GNULIB_FGETC@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fgetc
+#   define fgetc rpl_fgetc
+#  endif
+_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
+# endif
+_GL_CXXALIASWARN (fgetc);
+#endif
+
+#if @GNULIB_FGETS@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fgets
+#   define fgets rpl_fgets
+#  endif
+_GL_FUNCDECL_RPL (fgets, char *, (char *s, int n, FILE *stream)
+                                 _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (fgets, char *, (char *s, int n, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fgets, char *, (char *s, int n, FILE *stream));
+# endif
+_GL_CXXALIASWARN (fgets);
+#endif
 
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
@@ -203,7 +245,7 @@
 
 #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
 # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
-     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
+     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define fprintf rpl_fprintf
 #  endif
@@ -262,7 +304,7 @@
 #endif
 
 #if @GNULIB_FPUTC@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef fputc
 #   define fputc rpl_fputc
@@ -276,7 +318,7 @@
 #endif
 
 #if @GNULIB_FPUTS@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef fputs
 #   define fputs rpl_fputs
@@ -290,6 +332,21 @@
 _GL_CXXALIASWARN (fputs);
 #endif
 
+#if @GNULIB_FREAD@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fread
+#   define fread rpl_fread
+#  endif
+_GL_FUNCDECL_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream)
+                                 _GL_ARG_NONNULL ((4)));
+_GL_CXXALIAS_RPL (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fread, size_t, (void *ptr, size_t s, size_t n, FILE *stream));
+# endif
+_GL_CXXALIASWARN (fread);
+#endif
+
 #if @GNULIB_FREOPEN@
 # if @REPLACE_FREOPEN@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -314,6 +371,22 @@
                  "use gnulib module freopen for portability");
 #endif
 
+#if @GNULIB_FSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fscanf
+#   define fscanf rpl_fscanf
+#  endif
+_GL_FUNCDECL_RPL (fscanf, int, (FILE *stream, const char *format, ...)
+                               _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
+                               _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fscanf, int, (FILE *stream, const char *format, ...));
+# else
+_GL_CXXALIAS_SYS (fscanf, int, (FILE *stream, const char *format, ...));
+# endif
+_GL_CXXALIASWARN (fscanf);
+#endif
+
 
 /* Set up the following warnings, based on which modules are in use.
    GNU Coding Standards discourage the use of fseek, since it imposes
@@ -506,7 +579,7 @@
 
 
 #if @GNULIB_FWRITE@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef fwrite
 #   define fwrite rpl_fwrite
@@ -540,6 +613,34 @@
 _GL_CXXALIASWARN (fwrite);
 #endif
 
+#if @GNULIB_GETC@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getc
+#   define getc rpl_fgetc
+#  endif
+_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
+# else
+_GL_CXXALIAS_SYS (getc, int, (FILE *stream));
+# endif
+_GL_CXXALIASWARN (getc);
+#endif
+
+#if @GNULIB_GETCHAR@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getchar
+#   define getchar rpl_getchar
+#  endif
+_GL_FUNCDECL_RPL (getchar, int, (void));
+_GL_CXXALIAS_RPL (getchar, int, (void));
+# else
+_GL_CXXALIAS_SYS (getchar, int, (void));
+# endif
+_GL_CXXALIASWARN (getchar);
+#endif
+
 #if @GNULIB_GETDELIM@
 /* Read input, up to (and including) the next occurrence of DELIMITER, from
    STREAM, store it in *LINEPTR (and NUL-terminate it).
@@ -616,6 +717,26 @@
 # endif
 #endif
 
+#if @GNULIB_GETS@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gets
+#   define gets rpl_gets
+#  endif
+_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gets, char *, (char *s));
+# else
+_GL_CXXALIAS_SYS (gets, char *, (char *s));
+#  undef gets
+# endif
+_GL_CXXALIASWARN (gets);
+/* It is very rare that the developer ever has full control of stdin,
+   so any use of gets warrants an unconditional warning.  Assume it is
+   always declared, since it is required by C89.  */
+_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
+
+
 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
 struct obstack;
 /* Grow an obstack with formatted output.  Return the number of
@@ -711,7 +832,7 @@
 
 #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
 # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
-     || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
+     || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
 #  if defined __GNUC__
 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 /* Don't break __attribute__((format(printf,M,N))).  */
@@ -760,7 +881,7 @@
 #endif
 
 #if @GNULIB_PUTC@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef putc
 #   define putc rpl_fputc
@@ -774,7 +895,7 @@
 #endif
 
 #if @GNULIB_PUTCHAR@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef putchar
 #   define putchar rpl_putchar
@@ -788,7 +909,7 @@
 #endif
 
 #if @GNULIB_PUTS@
-# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef puts
 #   define puts rpl_puts
@@ -872,6 +993,37 @@
 # endif
 #endif
 
+#if @GNULIB_SCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if defined __GNUC__
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef scanf
+/* Don't break __attribute__((format(scanf,M,N))).  */
+#    define scanf __scanf__
+#   endif
+_GL_FUNCDECL_RPL_1 (__scanf__, int,
+                    (const char *format, ...)
+                    __asm__ (@ASM_SYMBOL_PREFIX@
+                             _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
+                    _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
+                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *format, ...));
+#  else
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef scanf
+#    define scanf rpl_scanf
+#   endif
+_GL_FUNCDECL_RPL (scanf, int, (const char *format, ...)
+                              _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (scanf, int, (const char *format, ...));
+#  endif
+# else
+_GL_CXXALIAS_SYS (scanf, int, (const char *format, ...));
+# endif
+_GL_CXXALIASWARN (scanf);
+#endif
+
 #if @GNULIB_SNPRINTF@
 # if @REPLACE_SNPRINTF@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1031,7 +1183,7 @@
 
 #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
 # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
-     || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
+     || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define vfprintf rpl_vfprintf
 #  endif
@@ -1065,9 +1217,28 @@
                       "POSIX compliance");
 #endif
 
+#if @GNULIB_VFSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef vfscanf
+#   define vfscanf rpl_vfscanf
+#  endif
+_GL_FUNCDECL_RPL (vfscanf, int,
+                  (FILE *stream, const char *format, va_list args)
+                  _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (vfscanf, int,
+                  (FILE *stream, const char *format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vfscanf, int,
+                  (FILE *stream, const char *format, va_list args));
+# endif
+_GL_CXXALIASWARN (vfscanf);
+#endif
+
 #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
 # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
-     || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
+     || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define vprintf rpl_vprintf
 #  endif
@@ -1100,6 +1271,22 @@
                  "POSIX compliance");
 #endif
 
+#if @GNULIB_VSCANF@
+# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef vscanf
+#   define vscanf rpl_vscanf
+#  endif
+_GL_FUNCDECL_RPL (vscanf, int, (const char *format, va_list args)
+                               _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (vscanf, int, (const char *format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vscanf, int, (const char *format, va_list args));
+# endif
+_GL_CXXALIASWARN (vscanf);
+#endif
+
 #if @GNULIB_VSNPRINTF@
 # if @REPLACE_VSNPRINTF@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
--- a/lib/stdlib.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/stdlib.in.h	Fri May 06 08:15:59 2011 -0700
@@ -81,8 +81,9 @@
 # endif
 #endif
 
-#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
 /* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
+/* On MacOS X 10.5, only <unistd.h> declares mkstemps.  */
 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
 /* But avoid namespace pollution on glibc systems and native Windows.  */
 # include <unistd.h>
@@ -255,9 +256,14 @@
 # endif
 #endif
 
+/* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
+   rely on GNU or POSIX semantics for malloc and realloc (for example,
+   by never specifying a zero size), so it does not need malloc or
+   realloc to be redefined.  */
 #if @GNULIB_MALLOC_POSIX@
 # if @REPLACE_MALLOC@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+        || _GL_USE_STDLIB_ALLOC)
 #   undef malloc
 #   define malloc rpl_malloc
 #  endif
@@ -267,7 +273,7 @@
 _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
 # endif
 _GL_CXXALIASWARN (malloc);
-#elif defined GNULIB_POSIXCHECK
+#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
 # undef malloc
 /* Assume malloc is always declared.  */
 _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
@@ -531,7 +537,8 @@
 
 #if @GNULIB_REALLOC_POSIX@
 # if @REPLACE_REALLOC@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
+        || _GL_USE_STDLIB_ALLOC)
 #   undef realloc
 #   define realloc rpl_realloc
 #  endif
@@ -541,7 +548,7 @@
 _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
 # endif
 _GL_CXXALIASWARN (realloc);
-#elif defined GNULIB_POSIXCHECK
+#elif defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
 # undef realloc
 /* Assume realloc is always declared.  */
 _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
--- a/lib/string.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/string.in.h	Fri May 06 08:15:59 2011 -0700
@@ -277,17 +277,28 @@
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
 #if @GNULIB_STRCHRNUL@
-# if ! @HAVE_STRCHRNUL@
+# if @REPLACE_STRCHRNUL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strchrnul rpl_strchrnul
+#  endif
+_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in)
+                                     _GL_ATTRIBUTE_PURE
+                                     _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strchrnul, char *,
+                  (const char *str, int ch));
+# else
+#  if ! @HAVE_STRCHRNUL@
 _GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
                                      _GL_ATTRIBUTE_PURE
                                      _GL_ARG_NONNULL ((1)));
-# endif
+#  endif
   /* On some systems, this function is defined as an overloaded function:
        extern "C++" { const char * std::strchrnul (const char *, int); }
        extern "C++" { char * std::strchrnul (char *, int); }  */
 _GL_CXXALIAS_SYS_CAST2 (strchrnul,
                         char *, (char const *__s, int __c_in),
                         char const *, (char const *__s, int __c_in));
+# endif
 # if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
      && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
 _GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
--- a/lib/strptime.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/strptime.c	Fri May 06 08:15:59 2011 -0700
@@ -200,7 +200,7 @@
 day_of_the_week (struct tm *tm)
 {
   /* We know that January 1st 1970 was a Thursday (= 4).  Compute the
-     the difference between this data in the one on TM and so determine
+     difference between this data in the one on TM and so determine
      the weekday.  */
   int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2);
   int wday = (-473
--- a/lib/strtol.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/strtol.c	Fri May 06 08:15:59 2011 -0700
@@ -186,9 +186,8 @@
 # define LOCALE_PARAM_PROTO
 #endif
 
-#include <wchar.h>
-
 #ifdef USE_WIDE_CHAR
+# include <wchar.h>
 # include <wctype.h>
 # define L_(Ch) L##Ch
 # define UCHAR_TYPE wint_t
--- a/lib/sys_socket.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/sys_socket.in.h	Fri May 06 08:15:59 2011 -0700
@@ -108,6 +108,12 @@
 
 #endif
 
+/* Get struct iovec.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if ! defined __GLIBC__
+# include <sys/uio.h>
+#endif
+
 #if @HAVE_SYS_SOCKET_H@
 
 /* A platform that has <sys/socket.h>.  */
@@ -146,7 +152,6 @@
    suggests that getaddrinfo should be available on all Windows
    releases. */
 
-
 # if @HAVE_WINSOCK2_H@
 #  include <winsock2.h>
 # endif
@@ -177,6 +182,16 @@
 
 # endif
 
+/* Rudimentary 'struct msghdr'; this works as long as you don't try to
+   access msg_control or msg_controllen.  */
+struct msghdr {
+  void *msg_name;
+  socklen_t msg_namelen;
+  struct iovec *msg_iov;
+  int msg_iovlen;
+  int msg_flags;
+};
+
 #endif
 
 #if @HAVE_WINSOCK2_H@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/sys_uio.in.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,64 @@
+/* Substitute for <sys/uio.h>.
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+@PRAGMA_COLUMNS@
+
+#ifndef _GL_SYS_UIO_H
+
+#if @HAVE_SYS_UIO_H@
+
+/* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>.  */
+# include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@
+
+#endif
+
+#ifndef _GL_SYS_UIO_H
+#define _GL_SYS_UIO_H
+
+#if !@HAVE_SYS_UIO_H@
+/* A platform that lacks <sys/uio.h>.  */
+/* Get 'ssize_t'.  */
+# include <sys/types.h>
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if !GNULIB_defined_struct_iovec
+/* All known platforms that lack <sys/uio.h> also lack any declaration
+   of struct iovec in any other header.  */
+struct iovec {
+  void *iov_base;
+  size_t iov_len;
+};
+#  define GNULIB_defined_struct_iovec 1
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
+
+#endif /* _GL_SYS_UIO_H */
+#endif /* _GL_SYS_UIO_H */
--- a/lib/unistd.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/unistd.in.h	Fri May 06 08:15:59 2011 -0700
@@ -97,7 +97,8 @@
 # include <netdb.h>
 #endif
 
-#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
+#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
+     || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
      || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
 /* Get ssize_t.  */
 # include <sys/types.h>
@@ -1105,6 +1106,28 @@
 #endif
 
 
+#if @GNULIB_READ@
+/* Read up to COUNT bytes from file descriptor FD into the buffer starting
+   at BUF.  See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/read.html>.  */
+# if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef read
+#   define read rpl_read
+#  endif
+_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
+# else
+/* Need to cast, because on mingw, the third parameter is
+                                                          unsigned int count
+   and the return type is 'int'.  */
+_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (read);
+#endif
+
+
 #if @GNULIB_READLINK@
 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
    bytes of it into BUF.  Return the number of bytes placed into BUF if
@@ -1359,7 +1382,7 @@
 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/write.html>.  */
-# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+# if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@)
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef write
 #   define write rpl_write
--- a/lib/utimecmp.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/utimecmp.c	Fri May 06 08:15:59 2011 -0700
@@ -33,7 +33,6 @@
 #include "stat-time.h"
 #include "utimens.h"
 #include "verify.h"
-#include "xalloc.h"
 
 #ifndef MAX
 # define MAX(a, b) ((a) > (b) ? (a) : (b))
@@ -122,7 +121,9 @@
   /* Things to watch out for:
 
      The code uses a static hash table internally and is not safe in the
-     presence of signals, multiple threads, etc.
+     presence of signals, multiple threads, etc.  However, memory pressure
+     that prevents use of the hash table is not fatal - we just fall back
+     to redoing the computations on every call in that case.
 
      int and long int might be 32 bits.  Many of the calculations store
      numbers up to 2 billion, and multiply by 10; they have to avoid
@@ -143,12 +144,13 @@
     {
       /* Look up the time stamp resolution for the destination device.  */
 
-      /* Hash table for devices.  */
+      /* Hash table for caching information learned about devices.  */
       static Hash_table *ht;
 
       /* Information about the destination file system.  */
       static struct fs_res *new_dst_res;
-      struct fs_res *dst_res;
+      struct fs_res *dst_res = NULL;
+      struct fs_res tmp_dst_res;
 
       /* Time stamp resolution in nanoseconds.  */
       int res;
@@ -163,24 +165,46 @@
       if (src_s <= dst_s - 2)
         return 1;
 
+      /* Try to do a hash lookup, but fall back to stack variables and
+         recomputation on low memory situations.  */
       if (! ht)
         ht = hash_initialize (16, NULL, dev_info_hash, dev_info_compare, free);
-      if (! new_dst_res)
+      if (ht)
         {
-          new_dst_res = xmalloc (sizeof *new_dst_res);
-          new_dst_res->resolution = 2 * BILLION;
-          new_dst_res->exact = false;
+          if (! new_dst_res)
+            {
+              new_dst_res = malloc (sizeof *new_dst_res);
+              if (!new_dst_res)
+                goto low_memory;
+              new_dst_res->resolution = 2 * BILLION;
+              new_dst_res->exact = false;
+            }
+          new_dst_res->dev = dst_stat->st_dev;
+          dst_res = hash_insert (ht, new_dst_res);
+          if (! dst_res)
+            goto low_memory;
+
+          if (dst_res == new_dst_res)
+            {
+              /* NEW_DST_RES is now in use in the hash table, so allocate a
+                 new entry next time.  */
+              new_dst_res = NULL;
+            }
         }
-      new_dst_res->dev = dst_stat->st_dev;
-      dst_res = hash_insert (ht, new_dst_res);
-      if (! dst_res)
-        xalloc_die ();
-
-      if (dst_res == new_dst_res)
+      else
         {
-          /* NEW_DST_RES is now in use in the hash table, so allocate a
-             new entry next time.  */
-          new_dst_res = NULL;
+        low_memory:
+          if (ht)
+            {
+              tmp_dst_res.dev = dst_stat->st_dev;
+              dst_res = hash_lookup (ht, &tmp_dst_res);
+            }
+          if (!dst_res)
+            {
+              dst_res = &tmp_dst_res;
+              dst_res->resolution = 2 * BILLION;
+              dst_res->exact = false;
+            }
         }
 
       res = dst_res->resolution;
--- a/lib/verify.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/verify.h	Fri May 06 08:15:59 2011 -0700
@@ -17,21 +17,41 @@
 
 /* Written by Paul Eggert, Bruno Haible, and Jim Meyering.  */
 
-#ifndef VERIFY_H
-# define VERIFY_H 1
+#ifndef _GL_VERIFY_H
+# define _GL_VERIFY_H
+
+
+/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
+   C1X draft N1548 section 6.7.10.  This is supported by GCC 4.6.0 and
+   later, in C mode, and its use here generates easier-to-read diagnostics
+   when verify (R) fails.
+
+   Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the
+   C++0X draft N3242 section 7.(4).
+   This will likely be supported by future GCC versions, in C++ mode.
+
+   Use this only with GCC.  If we were willing to slow 'configure'
+   down we could also use it with other compilers, but since this
+   affects only the quality of diagnostics, why bother?  */
+# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus
+#  define _GL_HAVE__STATIC_ASSERT 1
+# endif
+/* The condition (99 < __GNUC__) is temporary, until we know about the
+   first G++ release that supports static_assert.  */
+# if (99 < __GNUC__) && defined __cplusplus
+#  define _GL_HAVE_STATIC_ASSERT 1
+# endif
 
 /* Each of these macros verifies that its argument R is nonzero.  To
    be portable, R should be an integer constant expression.  Unlike
    assert (R), there is no run-time overhead.
 
-   There are two macros, since no single macro can be used in all
-   contexts in C.  verify_true (R) is for scalar contexts, including
-   integer constant expression contexts.  verify (R) is for declaration
-   contexts, e.g., the top level.
+   If _Static_assert works, verify (R) uses it directly.  Similarly,
+   _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct
+   that is an operand of sizeof.
 
-   Symbols ending in "__" are private to this header.
-
-   The code below uses several ideas.
+   The code below uses several ideas for C++ compilers, and for C
+   compilers that do not support _Static_assert:
 
    * The first step is ((R) ? 1 : -1).  Given an expression R, of
      integral or boolean or floating-point type, this yields an
@@ -39,7 +59,9 @@
      constant and nonnegative.
 
    * Next this expression W is wrapped in a type
-     struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }.
+     struct _gl_verify_type {
+       unsigned int _gl_verify_error_if_negative: W;
+     }.
      If W is negative, this yields a compile-time error.  No compiler can
      deal with a bit-field of negative size.
 
@@ -53,7 +75,7 @@
 
        void function (int n) { verify (n < 0); }
 
-   * For the verify macro, the struct verify_type__ will need to
+   * For the verify macro, the struct _gl_verify_type will need to
      somehow be embedded into a declaration.  To be portable, this
      declaration must declare an object, a constant, a function, or a
      typedef name.  If the declared entity uses the type directly,
@@ -91,11 +113,11 @@
      Which of the following alternatives can be used?
 
        extern int dummy [sizeof (struct {...})];
-       extern int dummy [sizeof (struct verify_type__ {...})];
+       extern int dummy [sizeof (struct _gl_verify_type {...})];
        extern void dummy (int [sizeof (struct {...})]);
-       extern void dummy (int [sizeof (struct verify_type__ {...})]);
+       extern void dummy (int [sizeof (struct _gl_verify_type {...})]);
        extern int (*dummy (void)) [sizeof (struct {...})];
-       extern int (*dummy (void)) [sizeof (struct verify_type__ {...})];
+       extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})];
 
      In the second and sixth case, the struct type is exported to the
      outer scope; two such declarations therefore collide.  GCC warns
@@ -109,15 +131,9 @@
      __COUNTER__ macro that can let us generate unique identifiers for
      each dummy function, to suppress this warning.
 
-   * This implementation exploits the fact that GCC does not warn about
-     the last declaration mentioned above.  If a future version of GCC
-     introduces a warning for this, the problem could be worked around
-     by using code specialized to GCC, just as __COUNTER__ is already
-     being used if available.
-
-       #if 4 <= __GNUC__
-       # define verify(R) [another version to keep GCC happy]
-       #endif
+   * This implementation exploits the fact that older versions of GCC,
+     which do not support _Static_assert, also do not warn about the
+     last declaration mentioned above.
 
    * In C++, any struct definition inside sizeof is invalid.
      Use a template type to work around the problem.  */
@@ -140,24 +156,75 @@
    possible.  */
 # define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
 
-/* Verify requirement R at compile-time, as an integer constant expression.
-   Return 1.  */
+/* Verify requirement R at compile-time, as an integer constant expression
+   that returns 1.  If R is false, fail at compile-time, preferably
+   with a diagnostic that includes the string-literal DIAGNOSTIC.  */
+
+# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
+    (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
 
 # ifdef __cplusplus
 template <int w>
-  struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
-#  define verify_true(R) \
-     (!!sizeof (verify_type__<(R) ? 1 : -1>))
+  struct _gl_verify_type {
+    unsigned int _gl_verify_error_if_negative: w;
+  };
+#  define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+    _gl_verify_type<(R) ? 1 : -1>
+# elif defined _GL_HAVE__STATIC_ASSERT
+#  define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+     struct {                                   \
+       _Static_assert (R, DIAGNOSTIC);          \
+       int _gl_dummy;                          \
+     }
+# else
+#  define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+     struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
+# endif
+
+/* Verify requirement R at compile-time, as a declaration without a
+   trailing ';'.  If R is false, fail at compile-time, preferably
+   with a diagnostic that includes the string-literal DIAGNOSTIC.
+
+   Unfortunately, unlike C1X, this implementation must appear as an
+   ordinary declaration, and cannot appear inside struct { ... }.  */
+
+# ifdef _GL_HAVE__STATIC_ASSERT
+#  define _GL_VERIFY _Static_assert
 # else
-#  define verify_true(R) \
-     (!!sizeof \
-      (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
+#  define _GL_VERIFY(R, DIAGNOSTIC)				       \
+     extern int (*_GL_GENSYM (_gl_verify_function) (void))	       \
+       [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
 # endif
 
+/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h.  */
+# ifdef _GL_STATIC_ASSERT_H
+#  if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert
+#   define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
+#  endif
+#  if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
+#   define static_assert _Static_assert /* Draft C1X requires this #define.  */
+#  endif
+# else
+
+/* Each of these macros verifies that its argument R is nonzero.  To
+   be portable, R should be an integer constant expression.  Unlike
+   assert (R), there is no run-time overhead.
+
+   There are two macros, since no single macro can be used in all
+   contexts in C.  verify_true (R) is for scalar contexts, including
+   integer constant expression contexts.  verify (R) is for declaration
+   contexts, e.g., the top level.  */
+
+/* Verify requirement R at compile-time, as an integer constant expression.
+   Return 1.  */
+
+#  define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
+
 /* Verify requirement R at compile-time, as a declaration without a
    trailing ';'.  */
 
-# define verify(R) \
-    extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)]
+#  define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+
+# endif
 
 #endif
--- a/lib/wchar.in.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/wchar.in.h	Fri May 06 08:15:59 2011 -0700
@@ -61,9 +61,13 @@
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
    included before <wchar.h>.
+   In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
+   by <stddef.h>.
    But avoid namespace pollution on glibc systems.  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <stddef.h>
+#endif
 #ifndef __GLIBC__
-# include <stddef.h>
 # include <stdio.h>
 # include <time.h>
 #endif
--- a/lib/write.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/write.c	Fri May 06 08:15:59 2011 -0700
@@ -20,8 +20,9 @@
 /* Specification.  */
 #include <unistd.h>
 
-/* Replace this function only if module 'sigpipe' is requested.  */
-#if GNULIB_SIGPIPE
+/* Replace this function only if module 'nonblocking' or module 'sigpipe' is
+   requested.  */
+#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE
 
 /* On native Windows platforms, SIGPIPE does not exist.  When write() is
    called on a pipe with no readers, WriteFile() fails with error
@@ -41,21 +42,81 @@
 rpl_write (int fd, const void *buf, size_t count)
 #undef write
 {
-  ssize_t ret = write (fd, buf, count);
+  for (;;)
+    {
+      ssize_t ret = write (fd, buf, count);
 
-  if (ret < 0)
-    {
-      if (GetLastError () == ERROR_NO_DATA
-          && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)
+      if (ret < 0)
         {
-          /* Try to raise signal SIGPIPE.  */
-          raise (SIGPIPE);
-          /* If it is currently blocked or ignored, change errno from EINVAL
-             to EPIPE.  */
-          errno = EPIPE;
+#  if GNULIB_NONBLOCKING
+          if (errno == ENOSPC)
+            {
+              HANDLE h = (HANDLE) _get_osfhandle (fd);
+              if (GetFileType (h) == FILE_TYPE_PIPE)
+                {
+                  /* h is a pipe or socket.  */
+                  DWORD state;
+                  if (GetNamedPipeHandleState (h, &state, NULL, NULL, NULL,
+                                               NULL, 0)
+                      && (state & PIPE_NOWAIT) != 0)
+                    {
+                      /* h is a pipe in non-blocking mode.
+                         We can get here in four situations:
+                           1. When the pipe buffer is full.
+                           2. When count <= pipe_buf_size and the number of
+                              free bytes in the pipe buffer is < count.
+                           3. When count > pipe_buf_size and the number of free
+                              bytes in the pipe buffer is > 0, < pipe_buf_size.
+                           4. When count > pipe_buf_size and the pipe buffer is
+                              entirely empty.
+                         The cases 1 and 2 are POSIX compliant.  In cases 3 and
+                         4 POSIX specifies that write() must split the request
+                         and succeed with a partial write.  We fix case 4.
+                         We don't fix case 3 because it is not essential for
+                         programs.  */
+                      DWORD out_size; /* size of the buffer for outgoing data */
+                      DWORD in_size;  /* size of the buffer for incoming data */
+                      if (GetNamedPipeInfo (h, NULL, &out_size, &in_size, NULL))
+                        {
+                          size_t reduced_count = count;
+                          /* In theory we need only one of out_size, in_size.
+                             But I don't know which of the two.  The description
+                             is ambiguous.  */
+                          if (out_size != 0 && out_size < reduced_count)
+                            reduced_count = out_size;
+                          if (in_size != 0 && in_size < reduced_count)
+                            reduced_count = in_size;
+                          if (reduced_count < count)
+                            {
+                              /* Attempt to write only the first part.  */
+                              count = reduced_count;
+                              continue;
+                            }
+                        }
+                      /* Change errno from ENOSPC to EAGAIN.  */
+                      errno = EAGAIN;
+                    }
+                }
+            }
+          else
+#  endif
+            {
+#  if GNULIB_SIGPIPE
+              if (GetLastError () == ERROR_NO_DATA
+                  && GetFileType ((HANDLE) _get_osfhandle (fd))
+                     == FILE_TYPE_PIPE)
+                {
+                  /* Try to raise signal SIGPIPE.  */
+                  raise (SIGPIPE);
+                  /* If it is currently blocked or ignored, change errno from
+                     EINVAL to EPIPE.  */
+                  errno = EPIPE;
+                }
+#  endif
+            }
         }
+      return ret;
     }
-  return ret;
 }
 
 # endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/xalloc-oversized.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,38 @@
+/* xalloc-oversized.h -- memory allocation size checking
+
+   Copyright (C) 1990-2000, 2003-2004, 2006-2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef XALLOC_OVERSIZED_H_
+# define XALLOC_OVERSIZED_H_
+
+# include <stddef.h>
+
+/* Return 1 if an array of N objects, each of size S, cannot exist due
+   to size arithmetic overflow.  S must be positive and N must be
+   nonnegative.  This is a macro, not an inline function, so that it
+   works correctly even when SIZE_MAX < N.
+
+   By gnulib convention, SIZE_MAX represents overflow in size
+   calculations, so the conservative dividend to use here is
+   SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
+   However, malloc (SIZE_MAX) fails on all known hosts where
+   sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
+   exactly-SIZE_MAX allocations on such hosts; this avoids a test and
+   branch when S is known to be 1.  */
+# define xalloc_oversized(n, s) \
+    ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
+
+#endif /* !XALLOC_OVERSIZED_H_ */
--- a/lib/xalloc.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/lib/xalloc.h	Fri May 06 08:15:59 2011 -0700
@@ -20,6 +20,7 @@
 
 # include <stddef.h>
 
+# include "xalloc-oversized.h"
 
 # ifdef __cplusplus
 extern "C" {
@@ -65,22 +66,6 @@
 char *xstrdup (char const *str)
       _GL_ATTRIBUTE_MALLOC;
 
-/* Return 1 if an array of N objects, each of size S, cannot exist due
-   to size arithmetic overflow.  S must be positive and N must be
-   nonnegative.  This is a macro, not an inline function, so that it
-   works correctly even when SIZE_MAX < N.
-
-   By gnulib convention, SIZE_MAX represents overflow in size
-   calculations, so the conservative dividend to use here is
-   SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value.
-   However, malloc (SIZE_MAX) fails on all known hosts where
-   sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for
-   exactly-SIZE_MAX allocations on such hosts; this avoids a test and
-   branch when S is known to be 1.  */
-# define xalloc_oversized(n, s) \
-    ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n))
-
-
 /* In the following macros, T must be an elementary or structure/union or
    typedef'ed type, or a pointer to such a type.  To apply one of the
    following macros to a function pointer or array type, you need to typedef
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/xgetgroups.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,37 @@
+/* xgetgroups.c -- return a list of the groups a user or current process is in
+
+   Copyright (C) 2007-2011 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
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Extracted from coreutils' src/id.c. */
+
+#include <config.h>
+
+#include "mgetgroups.h"
+
+#include <errno.h>
+
+#include "xalloc.h"
+
+/* Like mgetgroups, but call xalloc_die on allocation failure.  */
+
+int
+xgetgroups (char const *username, gid_t gid, gid_t **groups)
+{
+  int result = mgetgroups (username, gid, groups);
+  if (result == -1 && errno == ENOMEM)
+    xalloc_die ();
+  return result;
+}
--- a/m4/afunix.m4	Fri Apr 01 16:04:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-# afunix.m4 serial 6
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_SOCKET_AFUNIX],
-[
-  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
-  AC_REQUIRE([gl_SOCKET_FAMILY_UNIX])
-
-  AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS])
-  AC_CACHE_VAL([gl_cv_socket_unix_scm_rights],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[#include <sys/types.h>
-            #ifdef HAVE_SYS_SOCKET_H
-            #include <sys/socket.h>
-            #endif
-            #ifdef HAVE_SYS_UN_H
-            #include <sys/un.h>
-            #endif
-            #ifdef HAVE_WINSOCK2_H
-            #include <winsock2.h>
-            #endif
-          ]],
-          [[struct cmsghdr cmh;
-            cmh.cmsg_level = SOL_SOCKET;
-            cmh.cmsg_type = SCM_RIGHTS;
-            if (&cmh) return 0;
-          ]])],
-       [gl_cv_socket_unix_scm_rights=yes],
-       [gl_cv_socket_unix_scm_rights=no])
-    ])
-  AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights])
-  if test $gl_cv_socket_unix_scm_rights = yes; then
-    AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS], [1],
-      [Define to 1 if <sys/socket.h> defines SCM_RIGHTS.])
-  fi
-
-  dnl Persuade AIX 5.2 <sys/socket.h> to declare CMSG_SPACE, CMSG_LEN.
-  AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
-    [Define in order to get some macros on AIX systems.])
-
-  AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS that behave in BSD4.4 way])
-  AC_CACHE_VAL([gl_cv_socket_unix_scm_rights_bsd44_way],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[#include <sys/types.h>
-            #include <stddef.h>
-            #ifdef HAVE_SYS_SOCKET_H
-            #include <sys/socket.h>
-            #endif
-            #ifdef HAVE_SYS_UN_H
-            #include <sys/un.h>
-            #endif
-            #ifdef HAVE_WINSOCK2_H
-            #include <winsock2.h>
-            #endif
-            ]],
-            [[struct msghdr msg = {0};
-              struct cmsghdr *cmsg;
-              int myfds[1] = {0};
-              char buf[CMSG_SPACE (sizeof (myfds))];
-
-              msg.msg_control = buf;
-              msg.msg_controllen = sizeof buf;
-              cmsg = CMSG_FIRSTHDR (&msg);
-              cmsg->cmsg_level = SOL_SOCKET;
-              cmsg->cmsg_type = SCM_RIGHTS;
-              cmsg->cmsg_len = CMSG_LEN (sizeof (int));
-              /* fake Initialize the payload: */
-              (void) CMSG_DATA (cmsg);
-              /* Sum of the length of all control messages in the buffer: */
-              msg.msg_controllen = cmsg->cmsg_len;
-              return 0;
-            ]])],
-       [gl_cv_socket_unix_scm_rights_bsd44_way=yes],
-       [gl_cv_socket_unix_scm_rights_bsd44_way=no])
-    ])
-  AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights_bsd44_way])
-  if test $gl_cv_socket_unix_scm_rights_bsd44_way = yes; then
-    AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY], [1],
-      [Define to 1 if fd can be sent/received in the BSD4.4 way.])
-  fi
-
-  AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHTS that behave in BSD4.3 way])
-  AC_CACHE_VAL([gl_cv_socket_unix_scm_rights_bsd43_way],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[#include <sys/types.h>
-            #ifdef HAVE_SYS_SOCKET_H
-            #include <sys/socket.h>
-            #endif
-            #ifdef HAVE_SYS_UN_H
-            #include <sys/un.h>
-            #endif
-            #ifdef HAVE_WINSOCK2_H
-            #include <winsock2.h>
-            #endif
-            ]],
-            [[struct msghdr msg;
-              int fd = 0;
-              msg.msg_accrights = &fd;
-              msg.msg_accrightslen = sizeof (fd);
-              if (&msg) return 0;
-            ]])],
-       [gl_cv_socket_unix_scm_rights_bsd43_way=yes],
-       [gl_cv_socket_unix_scm_rights_bsd43_way=no])
-    ])
-  AC_MSG_RESULT([$gl_cv_socket_unix_scm_rights_bsd43_way])
-  if test $gl_cv_socket_unix_scm_rights_bsd43_way = yes; then
-    AC_DEFINE([HAVE_UNIXSOCKET_SCM_RIGHTS_BSD43_WAY], [1],
-      [Define to 1 if fd can be sent/received in the BSD4.3 way.])
-  fi
-])
--- a/m4/alloca.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/alloca.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# alloca.m4 serial 10
+# alloca.m4 serial 11
 dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -36,6 +36,7 @@
     ALLOCA_H=alloca.h
   fi
   AC_SUBST([ALLOCA_H])
+  AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
 ])
 
 # Prerequisites of lib/alloca.c.
--- a/m4/argz.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/argz.m4	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 8 argz.m4
+# serial 9 argz.m4
 
 AC_DEFUN([gl_FUNC_ARGZ],
 [gl_PREREQ_ARGZ
@@ -74,6 +74,7 @@
         AC_LIBOBJ([argz])])])
 
 AC_SUBST([ARGZ_H])
+AM_CONDITIONAL([GL_GENERATE_ARGZ_H], [test -n "$ARGZ_H"])
 ])
 
 # Prerequisites of lib/argz.c.
--- a/m4/arpa_inet_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/arpa_inet_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# arpa_inet_h.m4 serial 11
+# arpa_inet_h.m4 serial 12
 dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -38,13 +38,6 @@
     ]], [inet_ntop inet_pton])
 ])
 
-dnl Unconditionally enables the replacement of <arpa/inet.h>.
-AC_DEFUN([gl_REPLACE_ARPA_INET_H],
-[
-  dnl This is a no-op, because <arpa/inet.h> is always overridden.
-  :
-])
-
 AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/assert_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,29 @@
+# assert-h.m4
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+AC_DEFUN([gl_ASSERT_H],
+[
+  ASSERT_H=
+  AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <assert.h>
+            static_assert (2 + 2 == 4, "arithmetic doesn't work");
+          ]],
+          [[
+            static_assert (sizeof (char) == 1, "sizeof doesn't work");
+          ]])],
+       [gl_cv_static_assert=yes],
+       [gl_cv_static_assert=no])])
+  if test $gl_cv_static_assert = no; then
+    ASSERT_H=assert.h
+    gl_NEXT_HEADERS([assert.h])
+  fi
+  AC_SUBST([ASSERT_H])
+  AM_CONDITIONAL([GL_GENERATE_ASSERT_H], [test -n "$ASSERT_H"])
+])
--- a/m4/btowc.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/btowc.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# btowc.m4 serial 8
+# btowc.m4 serial 9
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -109,7 +109,6 @@
     esac
   fi
   if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([btowc])
     gl_PREREQ_BTOWC
   fi
--- a/m4/byteswap.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/byteswap.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# byteswap.m4 serial 3
+# byteswap.m4 serial 4
 dnl Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,4 +15,5 @@
     BYTESWAP_H='byteswap.h'
   ])
   AC_SUBST([BYTESWAP_H])
+  AM_CONDITIONAL([GL_GENERATE_BYTESWAP_H], [test -n "$BYTESWAP_H"])
 ])
--- a/m4/dirent_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/dirent_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# dirent_h.m4 serial 13
+# dirent_h.m4 serial 14
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,13 +21,6 @@
     ]], [alphasort dirfd fdopendir scandir])
 ])
 
-dnl Unconditionally enables the replacement of <dirent.h>.
-AC_DEFUN([gl_REPLACE_DIRENT_H],
-[
-  dnl This is a no-op, because <dirent.h> is always overridden.
-  :
-])
-
 AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
--- a/m4/dirfd.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/dirfd.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# serial 19   -*- Autoconf -*-
+# serial 20   -*- Autoconf -*-
 
 dnl Find out how to get the file descriptor associated with an open DIR*.
 
@@ -12,7 +12,6 @@
 AC_DEFUN([gl_FUNC_DIRFD],
 [
   AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
-  gl_REPLACE_DIRENT_H
 
   dnl Persuade glibc <dirent.h> to declare dirfd().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/dup2-obsolete.m4	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,11 @@
+# dup2-obsolete.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_DUP2_OBSOLETE],
+[
+  dnl The real code is in dup2.m4.
+  :
+])
--- a/m4/dup2.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/dup2.m4	Fri May 06 08:15:59 2011 -0700
@@ -8,11 +8,17 @@
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_CHECK_FUNCS_ONCE([dup2 fcntl])
-  if test $ac_cv_func_dup2 = no; then
-    HAVE_DUP2=0
-    AC_LIBOBJ([dup2])
-  else
+  m4_ifdef([gl_FUNC_DUP2_OBSOLETE], [
+    AC_CHECK_FUNCS_ONCE([dup2])
+    if test $ac_cv_func_dup2 = no; then
+      HAVE_DUP2=0
+      AC_LIBOBJ([dup2])
+    fi
+  ], [
+    AC_DEFINE([HAVE_DUP2], [1], [Define to 1 if you have the 'dup2' function.])
+  ])
+  AC_CHECK_FUNCS_ONCE([fcntl])
+  if test $HAVE_DUP2 = 1; then
     AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works],
       [AC_RUN_IFELSE([
          AC_LANG_PROGRAM([[#include <unistd.h>
@@ -63,6 +69,7 @@
 AC_DEFUN([gl_REPLACE_DUP2],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([dup2])
   if test $ac_cv_func_dup2 = yes; then
     REPLACE_DUP2=1
   fi
--- a/m4/duplocale.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/duplocale.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# duplocale.m4 serial 5
+# duplocale.m4 serial 6
 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -60,7 +60,6 @@
     HAVE_DUPLOCALE=0
   fi
   if test $REPLACE_DUPLOCALE = 1; then
-    gl_REPLACE_LOCALE_H
     AC_LIBOBJ([duplocale])
     gl_PREREQ_DUPLOCALE
   fi
--- a/m4/errno_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/errno_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# errno_h.m4 serial 8
+# errno_h.m4 serial 9
 dnl Copyright (C) 2004, 2006, 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -54,6 +54,7 @@
     ERRNO_H='errno.h'
   fi
   AC_SUBST([ERRNO_H])
+  AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"])
   gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
   gl_REPLACE_ERRNO_VALUE([ENOLINK])
   gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
--- a/m4/fchdir.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/fchdir.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# fchdir.m4 serial 15
+# fchdir.m4 serial 16
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -33,7 +33,6 @@
     gl_REPLACE_DUP2
     dnl dup3 is already unconditionally replaced
     gl_REPLACE_FCNTL
-    gl_REPLACE_DIRENT_H
     AC_CACHE_CHECK([whether open can visit directories],
       [gl_cv_func_open_directory_works],
       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>
--- a/m4/fclose.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/fclose.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# fclose.m4 serial 2
+# fclose.m4 serial 3
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,6 +6,12 @@
 
 AC_DEFUN([gl_FUNC_FCLOSE],
 [
+  m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
+    gl_FUNC_FFLUSH_STDIN
+    if test $gl_cv_func_fflush_stdin = no; then
+      gl_REPLACE_FCLOSE
+    fi
+  ])
 ])
 
 AC_DEFUN([gl_REPLACE_FCLOSE],
--- a/m4/fcntl_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/fcntl_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -31,13 +31,14 @@
 
 AC_DEFUN([gl_FCNTL_H_DEFAULTS],
 [
-  GNULIB_FCNTL=0;   AC_SUBST([GNULIB_FCNTL])
-  GNULIB_OPEN=0;    AC_SUBST([GNULIB_OPEN])
-  GNULIB_OPENAT=0;  AC_SUBST([GNULIB_OPENAT])
+  GNULIB_FCNTL=0;        AC_SUBST([GNULIB_FCNTL])
+  GNULIB_NONBLOCKING=0;  AC_SUBST([GNULIB_NONBLOCKING])
+  GNULIB_OPEN=0;         AC_SUBST([GNULIB_OPEN])
+  GNULIB_OPENAT=0;       AC_SUBST([GNULIB_OPENAT])
   dnl Assume proper GNU behavior unless another module says otherwise.
-  HAVE_FCNTL=1;     AC_SUBST([HAVE_FCNTL])
-  HAVE_OPENAT=1;    AC_SUBST([HAVE_OPENAT])
-  REPLACE_FCNTL=0;  AC_SUBST([REPLACE_FCNTL])
-  REPLACE_OPEN=0;   AC_SUBST([REPLACE_OPEN])
-  REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT])
+  HAVE_FCNTL=1;          AC_SUBST([HAVE_FCNTL])
+  HAVE_OPENAT=1;         AC_SUBST([HAVE_OPENAT])
+  REPLACE_FCNTL=0;       AC_SUBST([REPLACE_FCNTL])
+  REPLACE_OPEN=0;        AC_SUBST([REPLACE_OPEN])
+  REPLACE_OPENAT=0;      AC_SUBST([REPLACE_OPENAT])
 ])
--- a/m4/fdopendir.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/fdopendir.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# serial 5
+# serial 6
 # See if we need to provide fdopendir.
 
 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
@@ -19,7 +19,6 @@
   if test $ac_cv_func_fdopendir = no; then
     AC_LIBOBJ([openat-proc])
     AC_LIBOBJ([fdopendir])
-    gl_REPLACE_DIRENT_H
     HAVE_FDOPENDIR=0
   else
     AC_CACHE_CHECK([whether fdopendir works],
@@ -42,7 +41,6 @@
          [gl_cv_func_fdopendir_works="guessing no"])])
     if test "$gl_cv_func_fdopendir_works" != yes; then
       REPLACE_FDOPENDIR=1
-      gl_REPLACE_DIRENT_H
       AC_LIBOBJ([fdopendir])
     fi
   fi
--- a/m4/fflush.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/fflush.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# fflush.m4 serial 8
+# fflush.m4 serial 11
 
 # Copyright (C) 2007-2011 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -12,6 +12,17 @@
 
 AC_DEFUN([gl_FUNC_FFLUSH],
 [
+  gl_FUNC_FFLUSH_STDIN
+  if test $gl_cv_func_fflush_stdin = no; then
+    gl_REPLACE_FFLUSH
+  fi
+])
+
+dnl Determine whether fflush works on input streams.
+dnl Sets gl_cv_func_fflush_stdin.
+
+AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
+[
   AC_CACHE_CHECK([whether fflush works on input streams],
     [gl_cv_func_fflush_stdin],
     [echo hello world > conftest.txt
@@ -59,9 +70,6 @@
       gl_cv_func_fflush_stdin=no])
      rm conftest.txt
     ])
-  if test $gl_cv_func_fflush_stdin = no; then
-    gl_REPLACE_FFLUSH
-  fi
 ])
 
 AC_DEFUN([gl_REPLACE_FFLUSH],
@@ -70,7 +78,6 @@
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   REPLACE_FFLUSH=1
   gl_PREREQ_FFLUSH
-  gl_REPLACE_FSEEKO
 ])
 
 # Prerequisites of lib/fflush.c.
--- a/m4/float_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/float_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# float_h.m4 serial 5
+# float_h.m4 serial 6
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -16,4 +16,5 @@
       ;;
   esac
   AC_SUBST([FLOAT_H])
+  AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"])
 ])
--- a/m4/fnmatch.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/fnmatch.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# Check for fnmatch - serial 5.
+# Check for fnmatch - serial 6.
 
 # Copyright (C) 2000-2007, 2009-2011 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -139,6 +139,7 @@
     AC_CHECK_HEADERS_ONCE([wctype.h])
   fi
   AC_SUBST([FNMATCH_H])
+  AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"])
 ])
 
 # Request a POSIX compliant fnmatch function with GNU extensions.
--- a/m4/fseeko.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/fseeko.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# fseeko.m4 serial 11
+# fseeko.m4 serial 12
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -23,6 +23,12 @@
       gl_REPLACE_FSEEKO
     fi
   fi
+  m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
+    gl_FUNC_FFLUSH_STDIN
+    if test $gl_cv_func_fflush_stdin = no; then
+      gl_REPLACE_FSEEKO
+    fi
+  ])
 ])
 
 dnl Tests whether fseeko is available.
--- a/m4/getaddrinfo.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/getaddrinfo.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 23
+# getaddrinfo.m4 serial 25
 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -62,9 +62,7 @@
   # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
   # inline function declared in ws2tcpip.h, so we need to get that
   # header included somehow.
-  AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
-    gl_cv_func_gai_strerror, [
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+  AC_CHECK_DECLS([gai_strerror, gai_strerrorA], [], [break], [[
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
@@ -76,11 +74,32 @@
 #include <ws2tcpip.h>
 #endif
 #include <stddef.h>
-]], [[gai_strerror (NULL);]])],
-        [gl_cv_func_gai_strerror=yes],
-        [gl_cv_func_gai_strerror=no])])
-  if test $gl_cv_func_gai_strerror = no; then
+]])
+  if test $ac_cv_have_decl_gai_strerror = no; then
     AC_LIBOBJ([gai_strerror])
+  else
+    dnl check for correct signature
+    AC_CACHE_CHECK([for gai_strerror with POSIX signature],
+     [gl_cv_func_gai_strerror_posix_signature], [
+      AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#include <stddef.h>
+extern const char *gai_strerror(int);]])],
+        [gl_cv_func_gai_strerror_posix_signature=yes],
+        [gl_cv_func_gai_strerror_posix_signature=no])])
+    if test $gl_cv_func_gai_strerror_posix_signature = no; then
+      REPLACE_GAI_STRERROR=1
+      AC_LIBOBJ([gai_strerror])
+    fi
   fi
 
   LIBS="$gai_saved_LIBS"
@@ -105,11 +124,14 @@
 
   dnl Including sys/socket.h is wrong for Windows, but Windows does not
   dnl have sa_len so the result is correct anyway.
-  AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>])
+  AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [
+#include <sys/types.h>
+#include <sys/socket.h>
+])
 
   AC_CHECK_HEADERS_ONCE([netinet/in.h])
 
-  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[
+  AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[
   /* sys/types.h is not needed according to POSIX, but the
      sys/socket.h in i386-unknown-freebsd4.10 and
      powerpc-apple-darwin5.5 required it. */
--- a/m4/getcwd-abort-bug.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/getcwd-abort-bug.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# serial 2
+# serial 4
 # Determine whether getcwd aborts when the length of the working directory
 # name is unusually large.  Any length between 4k and 16k trigger the bug
 # when using glibc-2.4.90-9 or older.
@@ -21,6 +21,7 @@
      rm -rf confdir-14B---
      # Arrange for deletion of the temporary directory this test creates.
      ac_clean_files="$ac_clean_files confdir-14B---"
+     dnl Please keep this in sync with tests/test-getcwd.c.
      AC_RUN_IFELSE(
        [AC_LANG_SOURCE(
           [[
@@ -58,13 +59,13 @@
   size_t d;
 
   /* The bug is triggered when PATH_MAX < getpagesize (), so skip
-     this relative expensive and invasive test if that's not true.  */
+     this relatively expensive and invasive test if that's not true.  */
   if (getpagesize () <= PATH_MAX)
     return 0;
 
   cwd = getcwd (NULL, 0);
   if (cwd == NULL)
-    return 0;
+    return 2;
 
   initial_cwd_len = strlen (cwd);
   free (cwd);
@@ -91,15 +92,22 @@
   while (0 < d--)
     {
       if (chdir ("..") < 0)
-        break;
+        {
+          fail = 5;
+          break;
+        }
       rmdir (dir_name);
     }
 
-  return 0;
+  return fail;
 }
           ]])],
     [gl_cv_func_getcwd_abort_bug=no],
-    [gl_cv_func_getcwd_abort_bug=yes],
+    dnl A "regular" nonzero return does not indicate this bug.
+    dnl An abort will provoke an exit code of something like 134 (128 + 6).
+    [test $? -gt 128 \
+      && gl_cv_func_getcwd_abort_bug=yes \
+      || gl_cv_func_getcwd_abort_bug=no],
     [gl_cv_func_getcwd_abort_bug=yes])
   ])
   AS_IF([test $gl_cv_func_getcwd_abort_bug = yes], [$1], [$2])
--- a/m4/getcwd-path-max.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/getcwd-path-max.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,10 +1,10 @@
-# serial 15
+# serial 16
 # Check for several getcwd bugs with long file names.
 # If so, arrange to compile the wrapper function.
 
 # This is necessary for at least GNU libc on linux-2.4.19 and 2.4.20.
 # I've heard that this is due to a Linux kernel bug, and that it has
-# been fixed between 2.4.21-pre3 and 2.4.21-pre4.  */
+# been fixed between 2.4.21-pre3 and 2.4.21-pre4.
 
 # Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -21,6 +21,7 @@
     gl_cv_func_getcwd_path_max,
     [# Arrange for deletion of the temporary directory this test creates.
      ac_clean_files="$ac_clean_files confdir3"
+     dnl Please keep this in sync with tests/test-getcwd.c.
      AC_RUN_IFELSE(
        [AC_LANG_SOURCE(
           [[
--- a/m4/getcwd.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/getcwd.m4	Fri May 06 08:15:59 2011 -0700
@@ -6,10 +6,11 @@
 # with or without modifications, as long as this notice is preserved.
 
 # Written by Paul Eggert.
-# serial 3
+# serial 6
 
 AC_DEFUN([gl_FUNC_GETCWD_NULL],
   [
+   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
    AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result],
      [gl_cv_func_getcwd_null],
      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
@@ -19,7 +20,8 @@
 #        endif
 ]], [[
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* mingw cwd does not start with '/', but getcwd does allocate.  */
+/* mingw cwd does not start with '/', but getcwd does allocate.
+   However, mingw fails to honor non-zero size.  */
 #else
            if (chdir ("/") != 0)
              return 1;
@@ -35,6 +37,9 @@
                return 0;
              }
 #endif
+         /* If size is non-zero, allocation must fail if size is too small */
+         if (getcwd (NULL, 1))
+           return 5;
          ]])],
         [gl_cv_func_getcwd_null=yes],
         [gl_cv_func_getcwd_null=no],
@@ -44,14 +49,37 @@
          *-gnu*)               gl_cv_func_getcwd_null="guessing yes";;
                                # Guess yes on Cygwin.
          cygwin*)              gl_cv_func_getcwd_null="guessing yes";;
-                               # Guess yes on mingw.
-         mingw*)               gl_cv_func_getcwd_null="guessing yes";;
                                # If we don't know, assume the worst.
          *)                    gl_cv_func_getcwd_null="guessing no";;
        esac
         ]])])
 ])
 
+
+dnl Guarantee that getcwd will malloc with a NULL first argument.  Assumes
+dnl that either the system getcwd is robust, or that calling code is okay
+dnl with spurious failures when run from a directory with an absolute name
+dnl larger than 4k bytes.
+dnl
+dnl Assumes that getcwd exists; if you are worried about obsolete
+dnl platforms that lacked getcwd(), then you need to use the GPL module.
+AC_DEFUN([gl_FUNC_GETCWD_LGPL],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_FUNC_GETCWD_NULL])
+
+  case $gl_cv_func_getcwd_null in
+  *yes) ;;
+  *)
+    dnl Minimal replacement
+    REPLACE_GETCWD=1
+    AC_LIBOBJ([getcwd-lgpl])
+    ;;
+  esac
+])
+
+dnl Check for all known getcwd bugs; useful for a program likely to be
+dnl executed from an arbitrary location.
 AC_DEFUN([gl_FUNC_GETCWD],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
@@ -70,13 +98,14 @@
   case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in
   *yes,yes,no) ;;
   *)
+    dnl Full replacement, overrides LGPL replacement.
     REPLACE_GETCWD=1
     AC_LIBOBJ([getcwd])
     gl_PREREQ_GETCWD;;
   esac
 ])
 
-# Prerequisites of lib/getcwd.c.
+# Prerequisites of lib/getcwd.c, when full replacement is in effect.
 AC_DEFUN([gl_PREREQ_GETCWD],
 [
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
--- a/m4/getdomainname.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/getdomainname.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# getdomainname.m4 serial 5
+# getdomainname.m4 serial 6
 dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,7 @@
   dnl   is discouraged, see
   dnl   <http://www.sun.com/software/solaris/programs/abi/appcert_faq.xml#q18>.
   dnl   We need to avoid a collision with this function.
-  dnl - Otherwise is is in libc.
+  dnl - Otherwise it is in libc.
   AC_CHECK_FUNCS([getdomainname], , [
     AC_CACHE_CHECK([for getdomainname in -lnsl],
       [gl_cv_func_getdomainname_in_libnsl],
--- a/m4/gethostname.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/gethostname.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# gethostname.m4 serial 10
+# gethostname.m4 serial 11
 dnl Copyright (C) 2002, 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,7 @@
 
   dnl Where is gethostname() defined?
   dnl - On native Windows, it is in ws2_32.dll.
-  dnl - Otherwise is is in libc.
+  dnl - Otherwise it is in libc.
   GETHOSTNAME_LIB=
   AC_CHECK_FUNCS([gethostname], , [
     AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32],
--- a/m4/glob.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/glob.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# glob.m4 serial 11
+# glob.m4 serial 12
 dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,11 +10,12 @@
 
 AC_DEFUN([gl_GLOB_SUBSTITUTE],
 [
+  AC_LIBOBJ([glob])
   gl_PREREQ_GLOB
 
   GLOB_H=glob.h
-  AC_LIBOBJ([glob])
   AC_SUBST([GLOB_H])
+  AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"])
 ])
 
 AC_DEFUN([gl_GLOB],
@@ -65,8 +66,11 @@
   rm -f conf$$-globtest
 
   if test -n "$GLOB_H"; then
-    gl_GLOB_SUBSTITUTE
+    AC_LIBOBJ([glob])
+    gl_PREREQ_GLOB
   fi
+  AC_SUBST([GLOB_H])
+  AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"])
 ])
 
 # Prerequisites of lib/glob.*.
--- a/m4/iconv_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/iconv_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# iconv_h.m4 serial 7
+# iconv_h.m4 serial 8
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,6 +18,7 @@
 [
   AC_REQUIRE([gl_ICONV_H_DEFAULTS])
   ICONV_H='iconv.h'
+  AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
 ])
 
 AC_DEFUN([gl_ICONV_MODULE_INDICATOR],
@@ -36,4 +37,5 @@
   REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN])
   REPLACE_ICONV_UTF=0;  AC_SUBST([REPLACE_ICONV_UTF])
   ICONV_H='';           AC_SUBST([ICONV_H])
+  AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"])
 ])
--- a/m4/imaxabs.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/imaxabs.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# imaxabs.m4 serial 1
+# imaxabs.m4 serial 2
 dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,8 +6,10 @@
 
 AC_DEFUN([gl_FUNC_IMAXABS],
 [
-  AC_REQUIRE([gl_INTTYPES_H])
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([imaxabs])
   if test "$ac_cv_have_decl_imaxabs" != yes; then
+    HAVE_DECL_IMAXABS=0
     AC_LIBOBJ([imaxabs])
     gl_PREREQ_IMAXABS
   fi
--- a/m4/imaxdiv.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/imaxdiv.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# imaxdiv.m4 serial 1
+# imaxdiv.m4 serial 2
 dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,8 +6,10 @@
 
 AC_DEFUN([gl_FUNC_IMAXDIV],
 [
-  AC_REQUIRE([gl_INTTYPES_H])
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([imaxdiv])
   if test "$ac_cv_have_decl_imaxdiv" != yes; then
+    HAVE_DECL_IMAXDIV=0
     AC_LIBOBJ([imaxdiv])
     gl_PREREQ_IMAXDIV
   fi
--- a/m4/inet_ntop.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/inet_ntop.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# inet_ntop.m4 serial 13
+# inet_ntop.m4 serial 14
 dnl Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,6 @@
   dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
-  gl_REPLACE_ARPA_INET_H
-
   dnl Most platforms that provide inet_ntop define it in libc.
   dnl Solaris 8..10 provide inet_ntop in libnsl instead.
   gl_save_LIBS=$LIBS
--- a/m4/inet_pton.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/inet_pton.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# inet_pton.m4 serial 11
+# inet_pton.m4 serial 12
 dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,6 @@
   dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
-  gl_REPLACE_ARPA_INET_H
-
   dnl Most platforms that provide inet_pton define it in libc.
   dnl Solaris 8..10 provide inet_pton in libnsl instead.
   gl_save_LIBS=$LIBS
--- a/m4/inttypes.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/inttypes.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 18
+# inttypes.m4 serial 23
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,132 +9,14 @@
 
 AC_DEFUN([gl_INTTYPES_H],
 [
-  AC_REQUIRE([gl_STDINT_H])
-  AC_REQUIRE([gt_INTTYPES_PRI])
-  AC_CHECK_HEADERS_ONCE([inttypes.h])
-  AC_CHECK_DECLS_ONCE([imaxabs])
-  AC_CHECK_DECLS_ONCE([imaxdiv])
-  AC_CHECK_DECLS_ONCE([strtoimax])
-  AC_CHECK_DECLS_ONCE([strtoumax])
-
-  dnl Now see if we need a substitute <inttypes.h>.
-  dnl A complete <inttypes.h> requires
-  dnl   - a complete <stdint.h>,
-  dnl   - the existence of an <inttypes.h>,
-  dnl   - that imaxabs, imaxdiv, strtoimax, strtoumax are declared,
-  dnl   - some additional tests.
-  AC_CACHE_CHECK([whether inttypes.h conforms to C99],
-    [gl_cv_header_working_inttypes_h],
-    [gl_cv_header_working_inttypes_h=no
-     if test "$gl_cv_header_working_stdint_h" = yes \
-        && test $ac_cv_header_inttypes_h = yes \
-        && test "$ac_cv_have_decl_imaxabs" = yes \
-        && test "$ac_cv_have_decl_imaxdiv" = yes \
-        && test "$ac_cv_have_decl_strtoimax" = yes \
-        && test "$ac_cv_have_decl_strtoumax" = yes; then
-       AC_COMPILE_IFELSE([
-         AC_LANG_PROGRAM([[
-#include <stddef.h>
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */
-#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */
-#include <inttypes.h>
-
-/* No need to duplicate the tests of stdint.m4; they are subsumed by
-   $gl_cv_header_working_stdint_h = yes.  */
-
-/* Tests for macros supposed to be defined in inttypes.h.  */
+  AC_REQUIRE([gl_INTTYPES_INCOMPLETE])
+  gl_INTTYPES_PRI_SCN
+])
 
-const char *k = /* implicit string concatenation */
-#ifdef INT8_MAX
-  PRId8 PRIi8
-#endif
-#ifdef UINT8_MAX
-  PRIo8 PRIu8 PRIx8 PRIX8
-#endif
-#ifdef INT16_MAX
-  PRId16 PRIi16
-#endif
-#ifdef UINT16_MAX
-  PRIo16 PRIu16 PRIx16 PRIX16
-#endif
-#ifdef INT32_MAX
-  PRId32 PRIi32
-#endif
-#ifdef UINT32_MAX
-  PRIo32 PRIu32 PRIx32 PRIX32
-#endif
-#ifdef INT64_MAX
-  PRId64 PRIi64
-#endif
-#ifdef UINT64_MAX
-  PRIo64 PRIu64 PRIx64 PRIX64
-#endif
-  PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8
-  PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16
-  PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32
-  PRIdLEAST64 PRIiLEAST64
-  PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64
-  PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8
-  PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16
-  PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32
-  PRIdFAST64 PRIiFAST64
-  PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64
-  PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX
-#ifdef INTPTR_MAX
-  PRIdPTR PRIiPTR
-#endif
-#ifdef UINTPTR_MAX
-  PRIoPTR PRIuPTR PRIxPTR PRIXPTR
-#endif
-  ;
-const char *l = /* implicit string concatenation */
-#ifdef INT8_MAX
-  SCNd8 SCNi8
-#endif
-#ifdef UINT8_MAX
-  SCNo8 SCNu8 SCNx8
-#endif
-#ifdef INT16_MAX
-  SCNd16 SCNi16
-#endif
-#ifdef UINT16_MAX
-  SCNo16 SCNu16 SCNx16
-#endif
-#ifdef INT32_MAX
-  SCNd32 SCNi32
-#endif
-#ifdef UINT32_MAX
-  SCNo32 SCNu32 SCNx32
-#endif
-#ifdef INT64_MAX
-  SCNd64 SCNi64
-#endif
-#ifdef UINT64_MAX
-  SCNo64 SCNu64 SCNx64
-#endif
-  SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8
-  SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16
-  SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32
-  SCNdLEAST64 SCNiLEAST64
-  SCNoLEAST64 SCNuLEAST64 SCNxLEAST64
-  SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8
-  SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16
-  SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32
-  SCNdFAST64 SCNiFAST64
-  SCNoFAST64 SCNuFAST64 SCNxFAST64
-  SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX
-#ifdef INTPTR_MAX
-  SCNdPTR SCNiPTR
-#endif
-#ifdef UINTPTR_MAX
-  SCNoPTR SCNuPTR SCNxPTR
-#endif
-  ;
-         ]])],
-         [gl_cv_header_working_inttypes_h=yes])
-     fi])
+AC_DEFUN([gl_INTTYPES_INCOMPLETE],
+[
+  AC_REQUIRE([gl_STDINT_H])
+  AC_CHECK_HEADERS_ONCE([inttypes.h])
 
   dnl Override <inttypes.h> always, so that the portability warnings work.
   AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
@@ -158,6 +40,17 @@
 #endif
 ])
 
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
+    ]], [imaxabs imaxdiv strtoimax strtoumax])
+])
+
+# Ensure that the PRI* and SCN* macros are defined appropriately.
+AC_DEFUN([gl_INTTYPES_PRI_SCN],
+[
+  AC_REQUIRE([gt_INTTYPES_PRI])
+
   PRIPTR_PREFIX=
   if test -n "$STDINT_H"; then
     dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
@@ -181,30 +74,6 @@
   fi
   AC_SUBST([PRIPTR_PREFIX])
 
-  if test "$ac_cv_have_decl_imaxabs" = yes; then
-    HAVE_DECL_IMAXABS=1
-  else
-    HAVE_DECL_IMAXABS=0
-  fi
-
-  if test "$ac_cv_have_decl_imaxdiv" = yes; then
-    HAVE_DECL_IMAXDIV=1
-  else
-    HAVE_DECL_IMAXDIV=0
-  fi
-
-  if test "$ac_cv_have_decl_strtoimax" = yes; then
-    HAVE_DECL_STRTOIMAX=1
-  else
-    HAVE_DECL_STRTOIMAX=0
-  fi
-
-  if test "$ac_cv_have_decl_strtoumax" = yes; then
-    HAVE_DECL_STRTOUMAX=1
-  else
-    HAVE_DECL_STRTOUMAX=0
-  fi
-
   gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
     [INT32_MAX_LT_INTMAX_MAX],
     [defined INT32_MAX && defined INTMAX_MAX],
@@ -233,11 +102,6 @@
   else
     UINT64_MAX_EQ_ULONG_MAX=-1
   fi
-
-  dnl Check for declarations of anything we want to poison if the
-  dnl corresponding gnulib module is not in use.
-  gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
-    ]], [imaxabs imaxdiv strtoimax strtoumax])
 ])
 
 # Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
@@ -299,4 +163,10 @@
   HAVE_DECL_IMAXDIV=1;   AC_SUBST([HAVE_DECL_IMAXDIV])
   HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
   HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
+  INT32_MAX_LT_INTMAX_MAX=1;  AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
+  INT64_MAX_EQ_LONG_MAX='defined _LP64';  AC_SUBST([INT64_MAX_EQ_LONG_MAX])
+  PRI_MACROS_BROKEN=0;   AC_SUBST([PRI_MACROS_BROKEN])
+  PRIPTR_PREFIX=__PRIPTR_PREFIX;  AC_SUBST([PRIPTR_PREFIX])
+  UINT32_MAX_LT_UINTMAX_MAX=1;  AC_SUBST([UINT32_MAX_LT_UINTMAX_MAX])
+  UINT64_MAX_EQ_ULONG_MAX='defined _LP64';  AC_SUBST([UINT64_MAX_EQ_ULONG_MAX])
 ])
--- a/m4/ioctl.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/ioctl.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# ioctl.m4 serial 1
+# ioctl.m4 serial 2
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,6 @@
     dnl application may use it and pass file descriptors that refer to
     dnl sockets to the ioctl() function. So enable the support for sockets.
     AC_LIBOBJ([ioctl])
-    gl_REPLACE_SYS_IOCTL_H
   else
     AC_CHECK_FUNCS([ioctl])
     dnl On glibc systems, the second parameter is 'unsigned long int request',
@@ -32,7 +31,6 @@
     if test $gl_cv_func_ioctl_posix_signature != yes; then
       REPLACE_IOCTL=1
       AC_LIBOBJ([ioctl])
-      gl_REPLACE_SYS_IOCTL_H
     fi
   fi
 ])
--- a/m4/locale_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/locale_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# locale_h.m4 serial 13
+# locale_h.m4 serial 14
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -57,12 +57,6 @@
   dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK.
   gl_NEXT_HEADERS([locale.h])
 
-  if test -n "$STDDEF_H" \
-     || test $gl_cv_header_locale_h_posix2001 = no \
-     || test $gl_cv_header_locale_h_needs_xlocale_h = yes; then
-    gl_REPLACE_LOCALE_H
-  fi
-
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <locale.h>
@@ -74,13 +68,6 @@
     [setlocale duplocale])
 ])
 
-dnl Unconditionally enables the replacement of <locale.h>.
-AC_DEFUN([gl_REPLACE_LOCALE_H],
-[
-  dnl This is a no-op, because <locale.h> is always overridden.
-  :
-])
-
 AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
--- a/m4/manywarnings.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/manywarnings.m4	Fri May 06 08:15:59 2011 -0700
@@ -35,74 +35,124 @@
 # using gl_WARN_ADD if you want to make sure your gcc understands it.
 AC_DEFUN([gl_MANYWARN_ALL_GCC],
 [
- gl_manywarn_set=
- for gl_manywarn_item in \
-   -Wall \
-   -W \
-   -Wformat-y2k \
-   -Wformat-nonliteral \
-   -Wformat-security \
-   -Winit-self \
-   -Wmissing-include-dirs \
-   -Wswitch-default \
-   -Wswitch-enum \
-   -Wunused \
-   -Wunknown-pragmas \
-   -Wstrict-aliasing \
-   -Wstrict-overflow \
-   -Wsystem-headers \
-   -Wfloat-equal \
-   -Wtraditional \
-   -Wtraditional-conversion \
-   -Wdeclaration-after-statement \
-   -Wundef \
-   -Wshadow \
-   -Wunsafe-loop-optimizations \
-   -Wpointer-arith \
-   -Wbad-function-cast \
-   -Wc++-compat \
-   -Wcast-qual \
-   -Wcast-align \
-   -Wwrite-strings \
-   -Wconversion \
-   -Wsign-conversion \
-   -Wlogical-op \
-   -Waggregate-return \
-   -Wstrict-prototypes \
-   -Wold-style-definition \
-   -Wmissing-prototypes \
-   -Wmissing-declarations \
-   -Wmissing-noreturn \
-   -Wmissing-format-attribute \
-   -Wpacked \
-   -Wpadded \
-   -Wredundant-decls \
-   -Wnested-externs \
-   -Wunreachable-code \
-   -Winline \
-   -Winvalid-pch \
-   -Wlong-long \
-   -Wvla \
-   -Wvolatile-register-var \
-   -Wdisabled-optimization \
-   -Wstack-protector \
-   -Woverlength-strings \
-   -Wbuiltin-macro-redefined \
-   -Wmudflap \
-   -Wpacked-bitfield-compat \
-   -Wsync-nand \
-  ; do
+  dnl First, check if -Wno-missing-field-initializers is needed.
+  dnl -Wmissing-field-initializers is implied by -W, but that issues
+  dnl warnings with GCC version before 4.7, for the common idiom
+  dnl of initializing types on the stack to zero, using { 0, }
+  AC_REQUIRE([AC_PROG_CC])
+  if test -n "$GCC"; then
+
+    dnl First, check -W -Werror -Wno-missing-field-initializers is supported
+    dnl with the current $CC $CFLAGS $CPPFLAGS.
+    AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
+    AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[]], [[]])],
+        [gl_cv_cc_nomfi_supported=yes],
+        [gl_cv_cc_nomfi_supported=no])
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_nomfi_supported])
+
+    if test "$gl_cv_cc_nomfi_supported" = yes; then
+      dnl Now check whether -Wno-missing-field-initializers is needed
+      dnl for the { 0, } construct.
+      AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed])
+      AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [
+        gl_save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS -W -Werror"
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[void f (void)
+               {
+                 typedef struct { int a; int b; } s_t;
+                 s_t s1 = { 0, };
+               }
+             ]],
+             [[]])],
+          [gl_cv_cc_nomfi_needed=no],
+          [gl_cv_cc_nomfi_needed=yes])
+        CFLAGS="$gl_save_CFLAGS"
+      ])
+      AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
+    fi
+  fi
+
+  gl_manywarn_set=
+  for gl_manywarn_item in \
+    -Wall \
+    -W \
+    -Wformat-y2k \
+    -Wformat-nonliteral \
+    -Wformat-security \
+    -Winit-self \
+    -Wmissing-include-dirs \
+    -Wswitch-default \
+    -Wswitch-enum \
+    -Wunused \
+    -Wunknown-pragmas \
+    -Wstrict-aliasing \
+    -Wstrict-overflow \
+    -Wsystem-headers \
+    -Wfloat-equal \
+    -Wtraditional \
+    -Wtraditional-conversion \
+    -Wdeclaration-after-statement \
+    -Wundef \
+    -Wshadow \
+    -Wunsafe-loop-optimizations \
+    -Wpointer-arith \
+    -Wbad-function-cast \
+    -Wc++-compat \
+    -Wcast-qual \
+    -Wcast-align \
+    -Wwrite-strings \
+    -Wconversion \
+    -Wsign-conversion \
+    -Wlogical-op \
+    -Waggregate-return \
+    -Wstrict-prototypes \
+    -Wold-style-definition \
+    -Wmissing-prototypes \
+    -Wmissing-declarations \
+    -Wmissing-noreturn \
+    -Wmissing-format-attribute \
+    -Wpacked \
+    -Wpadded \
+    -Wredundant-decls \
+    -Wnested-externs \
+    -Wunreachable-code \
+    -Winline \
+    -Winvalid-pch \
+    -Wlong-long \
+    -Wvla \
+    -Wvolatile-register-var \
+    -Wdisabled-optimization \
+    -Wstack-protector \
+    -Woverlength-strings \
+    -Wbuiltin-macro-redefined \
+    -Wmudflap \
+    -Wpacked-bitfield-compat \
+    -Wsync-nand \
+    ; do
     gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
   done
- # The following are not documented in the manual but are included in
- # output from gcc --help=warnings.
- for gl_manywarn_item in \
-   -Wattributes \
-   -Wcoverage-mismatch \
-   -Wmultichar \
-   -Wunused-macros \
-  ; do
+  # The following are not documented in the manual but are included in
+  # output from gcc --help=warnings.
+  for gl_manywarn_item in \
+    -Wattributes \
+    -Wcoverage-mismatch \
+    -Wmultichar \
+    -Wunused-macros \
+    ; do
     gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
   done
+
+  # Disable the missing-field-initializers warning if needed
+  if test "$gl_cv_cc_nomfi_needed" = yes; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
+  fi
+
   $1=$gl_manywarn_set
 ])
--- a/m4/mbrlen.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/mbrlen.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# mbrlen.m4 serial 5
+# mbrlen.m4 serial 6
 dnl Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -23,7 +23,6 @@
     fi
   fi
   if test $HAVE_MBRLEN = 0 || test $REPLACE_MBRLEN = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([mbrlen])
     gl_PREREQ_MBRLEN
   fi
--- a/m4/mbrtowc.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/mbrtowc.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# mbrtowc.m4 serial 22
+# mbrtowc.m4 serial 23
 dnl Copyright (C) 2001-2002, 2004-2005, 2008-2011 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -54,7 +54,6 @@
     fi
   fi
   if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([mbrtowc])
     gl_PREREQ_MBRTOWC
   fi
@@ -88,9 +87,6 @@
   else
     REPLACE_MBSTATE_T=1
   fi
-  if test $REPLACE_MBSTATE_T = 1; then
-    gl_REPLACE_WCHAR_H
-  fi
 ])
 
 dnl Test whether mbrtowc puts the state into non-initial state when parsing an
--- a/m4/mbsinit.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/mbsinit.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# mbsinit.m4 serial 5
+# mbsinit.m4 serial 6
 dnl Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -28,7 +28,6 @@
     fi
   fi
   if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([mbsinit])
     gl_PREREQ_MBSINIT
   fi
--- a/m4/mbsnrtowcs.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/mbsnrtowcs.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# mbsnrtowcs.m4 serial 2
+# mbsnrtowcs.m4 serial 3
 dnl Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -23,7 +23,6 @@
     fi
   fi
   if test $HAVE_MBSNRTOWCS = 0 || test $REPLACE_MBSNRTOWCS = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([mbsnrtowcs])
     AC_LIBOBJ([mbsrtowcs-state])
     gl_PREREQ_MBSNRTOWCS
--- a/m4/mbsrtowcs.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/mbsrtowcs.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# mbsrtowcs.m4 serial 10
+# mbsrtowcs.m4 serial 11
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,7 +26,6 @@
     fi
   fi
   if test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([mbsrtowcs])
     AC_LIBOBJ([mbsrtowcs-state])
     gl_PREREQ_MBSRTOWCS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/memchr-obsolete.m4	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,11 @@
+# memchr-obsolete.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_MEMCHR_OBSOLETE],
+[
+  dnl The real code is in memchr.m4.
+  :
+])
--- a/m4/memchr.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/memchr.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# memchr.m4 serial 10
+# memchr.m4 serial 11
 dnl Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,10 +11,16 @@
   AC_CHECK_HEADERS_ONCE([sys/mman.h])
   AC_CHECK_FUNCS_ONCE([mprotect])
 
-  dnl These days, we assume memchr is present.  But just in case...
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  AC_CHECK_FUNCS_ONCE([memchr])
-  if test $ac_cv_func_memchr = yes; then
+  m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [
+    dnl These days, we assume memchr is present.  But if support for old
+    dnl platforms is desired:
+    AC_CHECK_FUNCS_ONCE([memchr])
+    if test $ac_cv_func_memchr = no; then
+      HAVE_MEMCHR=0
+    fi
+  ])
+  if test $HAVE_MEMCHR = 1; then
     # Detect platform-specific bugs in some versions of glibc:
     # memchr should not dereference anything with length 0
     #   http://bugzilla.redhat.com/499689
@@ -73,8 +79,6 @@
     if test "$gl_cv_func_memchr_works" != yes; then
       REPLACE_MEMCHR=1
     fi
-  else
-    HAVE_MEMCHR=0
   fi
   if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
     AC_LIBOBJ([memchr])
--- a/m4/mkstemp.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/mkstemp.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-#serial 19
+#serial 20
 
 # Copyright (C) 2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -10,6 +10,8 @@
 # Other systems lack mkstemp altogether.
 # On OSF1/Tru64 V4.0F, the system-provided mkstemp function can create
 # only 32 files per process.
+# On some hosts, mkstemp creates files with mode 0666, which is a security
+# problem and a violation of POSIX 2008.
 # On systems like the above, arrange to use the replacement function.
 AC_DEFUN([gl_FUNC_MKSTEMP],
 [
@@ -30,6 +32,7 @@
               off_t large = (off_t) 4294967295u;
               if (large < 0)
                 large = 2147483647;
+              umask (0);
               for (i = 0; i < 70; i++)
                 {
                   char templ[] = "conftest.mkstemp/coXXXXXX";
@@ -39,18 +42,24 @@
                     result |= 1;
                   else
                     {
+                      struct stat st;
                       if (lseek (fd, large, SEEK_SET) != large)
                         result |= 2;
-                      close (fd);
+                      if (fstat (fd, &st) < 0)
+                        result |= 4;
+                      else if (st.st_mode & 0077)
+                        result |= 8;
+                      if (close (fd))
+                        result |= 16;
                     }
                 }
               return result;]])],
           [gl_cv_func_working_mkstemp=yes],
           [gl_cv_func_working_mkstemp=no],
-          [gl_cv_func_working_mkstemp=no])
+          [gl_cv_func_working_mkstemp="guessing no"])
         rm -rf conftest.mkstemp
       ])
-    if test $gl_cv_func_working_mkstemp != yes; then
+    if test "$gl_cv_func_working_mkstemp" != yes; then
       REPLACE_MKSTEMP=1
       AC_LIBOBJ([mkstemp])
       gl_PREREQ_MKSTEMP
--- a/m4/netdb_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/netdb_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# netdb_h.m4 serial 10
+# netdb_h.m4 serial 11
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -26,6 +26,8 @@
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
   AC_REQUIRE([gl_NETDB_H_DEFAULTS])
   gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
 ])
 
 AC_DEFUN([gl_NETDB_H_DEFAULTS],
@@ -37,4 +39,5 @@
   HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR])
   HAVE_DECL_GETADDRINFO=1;  AC_SUBST([HAVE_DECL_GETADDRINFO])
   HAVE_DECL_GETNAMEINFO=1;  AC_SUBST([HAVE_DECL_GETNAMEINFO])
+  REPLACE_GAI_STRERROR=0;   AC_SUBST([REPLACE_GAI_STRERROR])
 ])
--- a/m4/netinet_in_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/netinet_in_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# netinet_in_h.m4 serial 4
+# netinet_in_h.m4 serial 5
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -27,4 +27,5 @@
     AC_SUBST([HAVE_NETINET_IN_H])
   fi
   AC_SUBST([NETINET_IN_H])
+  AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"])
 ])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/nonblocking.m4	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,29 @@
+# nonblocking.m4 serial 2
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Tests whether non-blocking I/O is natively supported by read(), write().
+dnl Sets gl_cv_have_nonblocking.
+dnl Also tests whether open() supports O_NONBLOCK.
+dnl Sets gl_cv_have_open_O_NONBLOCK.
+AC_DEFUN([gl_NONBLOCKING_IO],
+[
+  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+  dnl once only, before all statements that occur in other macros.
+  AC_REQUIRE([gl_NONBLOCKING_IO_BODY])
+])
+
+AC_DEFUN([gl_NONBLOCKING_IO_BODY],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw*) gl_cv_have_nonblocking=no ;;
+    *)      gl_cv_have_nonblocking=yes ;;
+  esac
+  case "$host_os" in
+    mingw*) gl_cv_have_open_O_NONBLOCK=no ;;
+    *)      gl_cv_have_open_O_NONBLOCK=yes ;;
+  esac
+])
--- a/m4/open.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/open.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# open.m4 serial 11
+# open.m4 serial 12
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -62,6 +62,15 @@
       esac
       ;;
   esac
+  dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    if test $REPLACE_OPEN = 0; then
+      gl_NONBLOCKING_IO
+      if test $gl_cv_have_open_O_NONBLOCK != yes; then
+        gl_REPLACE_OPEN
+      fi
+    fi
+  ])
 ])
 
 AC_DEFUN([gl_REPLACE_OPEN],
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/passfd.m4	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,23 @@
+# passfd.m4 serial 8
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_PASSFD],
+[
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+  AC_CHECK_FUNCS_ONCE([recvmsg sendmsg])
+
+  dnl Persuade AIX 5.2 <sys/socket.h> to declare CMSG_SPACE, CMSG_LEN.
+  dnl CMSG_FIRSTHDR is POSIX 2008, but CMSG_SPACE is only in RFC 3542.
+  AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
+    [Define in order to get some macros on AIX systems.])
+
+  dnl Passfd prefers the POSIX use of msg.msg_control if the CMSG_* macros
+  dnl are present, but can fall back to BSD 4.3 style of msg.msg_accrights.
+  AC_CHECK_MEMBERS([struct msghdr.msg_accrights], [], [], [[
+    #include <sys/types.h>
+    #include <sys/socket.h>
+  ]])
+])
--- a/m4/poll.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/poll.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# poll.m4 serial 12
+# poll.m4 serial 13
 dnl Copyright (c) 2003, 2005-2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -63,7 +63,6 @@
     fi
   fi
   if test $HAVE_POLL = 0 || test $REPLACE_POLL = 1; then
-    gl_REPLACE_POLL_H
     AC_LIBOBJ([poll])
     gl_PREREQ_POLL
   else
--- a/m4/poll_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/poll_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# poll_h.m4 serial 1
+# poll_h.m4 serial 2
 dnl Copyright (C) 2010-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,6 @@
     HAVE_POLL_H=1
   else
     HAVE_POLL_H=0
-    gl_REPLACE_POLL_H
   fi
   AC_SUBST([HAVE_POLL_H])
 
@@ -30,13 +29,6 @@
     [poll])
 ])
 
-dnl Unconditionally enables the replacement of <poll.h>.
-AC_DEFUN([gl_REPLACE_POLL_H],
-[
-  dnl This is a no-op, because <poll.h> is always overridden.
-  :
-])
-
 AC_DEFUN([gl_POLL_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
--- a/m4/pthread.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/pthread.m4	Fri May 06 08:15:59 2011 -0700
@@ -30,7 +30,11 @@
       test $ac_cv_type_pthread_t != yes ||
       test $ac_cv_type_pthread_spinlock_t != yes; then
      PTHREAD_H='pthread.h'
+   else
+     PTHREAD_H=
    fi
+   AC_SUBST([PTHREAD_H])
+   AM_CONDITIONAL([GL_GENERATE_PTHREAD_H], [test -n "$PTHREAD_H"])
 
    LIB_PTHREAD=
    if test $ac_cv_header_pthread_h = yes; then
@@ -53,5 +57,4 @@
   HAVE_PTHREAD_H=1;              AC_SUBST([HAVE_PTHREAD_H])
   HAVE_PTHREAD_T=1;              AC_SUBST([HAVE_PTHREAD_T])
   HAVE_PTHREAD_SPINLOCK_T=1;     AC_SUBST([HAVE_PTHREAD_SPINLOCK_T])
-  PTHREAD_H='';                  AC_SUBST([PTHREAD_H])
 ])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/read.m4	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,20 @@
+# read.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_READ],
+[
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  dnl This ifdef is just an optimization, to avoid performing a configure
+  dnl check whose result is not used. It does not make the test of
+  dnl GNULIB_UNISTD_H_NONBLOCKING or GNULIB_NONBLOCKING redundant.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    gl_NONBLOCKING_IO
+    if test $gl_cv_have_nonblocking != yes; then
+      REPLACE_READ=1
+      AC_LIBOBJ([read])
+    fi
+  ])
+])
--- a/m4/sched_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/sched_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# sched_h.m4 serial 3
+# sched_h.m4 serial 4
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -32,4 +32,5 @@
      AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
     ])
   AC_SUBST([SCHED_H])
+  AM_CONDITIONAL([GL_GENERATE_SCHED_H], [test -n "$SCHED_H"])
 ])
--- a/m4/selinux-context-h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/selinux-context-h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# serial 2   -*- Autoconf -*-
+# serial 3   -*- Autoconf -*-
 # Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -18,4 +18,5 @@
     SELINUX_CONTEXT_H=selinux/context.h
   fi
   AC_SUBST([SELINUX_CONTEXT_H])
+  AM_CONDITIONAL([GL_GENERATE_SELINUX_CONTEXT_H], [test -n "$SELINUX_CONTEXT_H"])
 ])
--- a/m4/setlocale.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/setlocale.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# setlocale.m4 serial 1
+# setlocale.m4 serial 2
 dnl Copyright (C) 2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,6 @@
     mingw*) REPLACE_SETLOCALE=1 ;;
   esac
   if test $REPLACE_SETLOCALE = 1; then
-    gl_REPLACE_LOCALE_H
     AC_LIBOBJ([setlocale])
     gl_PREREQ_SETLOCALE
   fi
--- a/m4/signal_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/signal_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# signal_h.m4 serial 11
+# signal_h.m4 serial 12
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,14 +8,22 @@
 [
   AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
   gl_NEXT_HEADERS([signal.h])
+
 # AIX declares sig_atomic_t to already include volatile, and C89 compilers
 # then choke on 'volatile sig_atomic_t'.  C99 requires that it compile.
   AC_CHECK_TYPE([volatile sig_atomic_t], [],
     [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[
 #include <signal.h>
     ]])
+
   AC_REQUIRE([AC_TYPE_UID_T])
 
+  dnl Persuade glibc <signal.h> to define sighandler_t.
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[
+#include <signal.h>
+    ]])
+
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <signal.h>
@@ -46,4 +54,5 @@
                                AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION])
   HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1;
                                AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T])
+  HAVE_SIGHANDLER_T=1;         AC_SUBST([HAVE_SIGHANDLER_T])
 ])
--- a/m4/spawn_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/spawn_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 12
+# spawn_h.m4 serial 13
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -28,7 +28,6 @@
     HAVE_SPAWN_H=0
     HAVE_POSIX_SPAWNATTR_T=0
     HAVE_POSIX_SPAWN_FILE_ACTIONS_T=0
-    gl_REPLACE_SPAWN_H
   fi
   AC_SUBST([HAVE_SPAWN_H])
 
@@ -65,13 +64,6 @@
   fi
 ])
 
-dnl Unconditionally enables the replacement of <spawn.h>.
-AC_DEFUN([gl_REPLACE_SPAWN_H],
-[
-  dnl This is a no-op, because <spawn.h> is always overridden.
-  :
-])
-
 AC_DEFUN([gl_SPAWN_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
--- a/m4/stdarg.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/stdarg.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# stdarg.m4 serial 5
+# stdarg.m4 serial 6
 dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,8 @@
 
 AC_DEFUN([gl_STDARG_H],
 [
-  STDARG_H='';                AC_SUBST([STDARG_H])
-  NEXT_STDARG_H='<stdarg.h>'; AC_SUBST([NEXT_STDARG_H])
+  STDARG_H=''
+  NEXT_STDARG_H='<stdarg.h>'
   AC_MSG_CHECKING([for va_copy])
   AC_CACHE_VAL([gl_cv_func_va_copy], [
     AC_COMPILE_IFELSE(
@@ -72,4 +72,7 @@
       fi
     fi
   fi
+  AC_SUBST([STDARG_H])
+  AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"])
+  AC_SUBST([NEXT_STDARG_H])
 ])
--- a/m4/stdbool.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/stdbool.m4	Fri May 06 08:15:59 2011 -0700
@@ -5,7 +5,7 @@
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-#serial 4
+#serial 5
 
 # Prepare for substituting <stdbool.h> if it is not supported.
 
@@ -21,6 +21,7 @@
     STDBOOL_H='stdbool.h'
   fi
   AC_SUBST([STDBOOL_H])
+  AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"])
 
   if test "$ac_cv_type__Bool" = yes; then
     HAVE__BOOL=1
--- a/m4/stddef_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/stddef_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,5 +1,5 @@
 dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
-# stddef_h.m4 serial 3
+# stddef_h.m4 serial 4
 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,7 @@
 [
   AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
   AC_REQUIRE([gt_TYPE_WCHAR_T])
+  STDDEF_H=
   if test $gt_cv_c_wchar_t = no; then
     HAVE_WCHAR_T=0
     STDDEF_H=stddef.h
@@ -24,6 +25,8 @@
     REPLACE_NULL=1
     STDDEF_H=stddef.h
   fi
+  AC_SUBST([STDDEF_H])
+  AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"])
   if test -n "$STDDEF_H"; then
     gl_NEXT_HEADERS([stddef.h])
   fi
@@ -41,5 +44,4 @@
   dnl Assume proper GNU behavior unless another module says otherwise.
   REPLACE_NULL=0;                AC_SUBST([REPLACE_NULL])
   HAVE_WCHAR_T=1;                AC_SUBST([HAVE_WCHAR_T])
-  STDDEF_H='';                   AC_SUBST([STDDEF_H])
 ])
--- a/m4/stdint.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/stdint.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# stdint.m4 serial 39
+# stdint.m4 serial 40
 dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -305,6 +305,7 @@
     STDINT_H=stdint.h
   fi
   AC_SUBST([STDINT_H])
+  AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
 ])
 
 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
--- a/m4/stdio_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/stdio_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 33
+# stdio_h.m4 serial 37
 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,6 +9,30 @@
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([AC_C_INLINE])
   gl_NEXT_HEADERS([stdio.h])
+
+  dnl No need to create extra modules for these functions. Everyone who uses
+  dnl <stdio.h> likely needs them.
+  GNULIB_FSCANF=1
+  GNULIB_SCANF=1
+  GNULIB_FGETC=1
+  GNULIB_GETC=1
+  GNULIB_GETCHAR=1
+  GNULIB_FGETS=1
+  GNULIB_GETS=1
+  GNULIB_FREAD=1
+  dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
+  dnl "expected source file, required through AC_LIBSOURCES, not found". It is
+  dnl also an optimization, to avoid performing a configure check whose result
+  dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
+  dnl or GNULIB_NONBLOCKING redundant.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    gl_NONBLOCKING_IO
+    if test $gl_cv_have_nonblocking != yes; then
+      REPLACE_STDIO_READ_FUNCS=1
+      AC_LIBOBJ([stdio-read])
+    fi
+  ])
+
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
   GNULIB_FPRINTF=1
@@ -21,9 +45,11 @@
   GNULIB_FPUTS=1
   GNULIB_PUTS=1
   GNULIB_FWRITE=1
-  dnl This ifdef is just an optimization, to avoid performing a configure
-  dnl check whose result is not used. It does not make the test of
-  dnl GNULIB_STDIO_H_SIGPIPE or GNULIB_SIGPIPE redundant.
+  dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
+  dnl "expected source file, required through AC_LIBSOURCES, not found". It is
+  dnl also an optimization, to avoid performing a configure check whose result
+  dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or
+  dnl GNULIB_SIGPIPE redundant.
   m4_ifdef([gl_SIGNAL_SIGPIPE], [
     gl_SIGNAL_SIGPIPE
     if test $gl_cv_header_signal_h_SIGPIPE != yes; then
@@ -31,6 +57,18 @@
       AC_LIBOBJ([stdio-write])
     fi
   ])
+  dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
+  dnl "expected source file, required through AC_LIBSOURCES, not found". It is
+  dnl also an optimization, to avoid performing a configure check whose result
+  dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
+  dnl or GNULIB_NONBLOCKING redundant.
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    gl_NONBLOCKING_IO
+    if test $gl_cv_have_nonblocking != yes; then
+      REPLACE_STDIO_WRITE_FUNCS=1
+      AC_LIBOBJ([stdio-write])
+    fi
+  ])
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use, and which is not
@@ -54,20 +92,27 @@
   GNULIB_DPRINTF=0;              AC_SUBST([GNULIB_DPRINTF])
   GNULIB_FCLOSE=0;               AC_SUBST([GNULIB_FCLOSE])
   GNULIB_FFLUSH=0;               AC_SUBST([GNULIB_FFLUSH])
+  GNULIB_FGETC=0;                AC_SUBST([GNULIB_FGETC])
+  GNULIB_FGETS=0;                AC_SUBST([GNULIB_FGETS])
   GNULIB_FOPEN=0;                AC_SUBST([GNULIB_FOPEN])
   GNULIB_FPRINTF=0;              AC_SUBST([GNULIB_FPRINTF])
   GNULIB_FPRINTF_POSIX=0;        AC_SUBST([GNULIB_FPRINTF_POSIX])
   GNULIB_FPURGE=0;               AC_SUBST([GNULIB_FPURGE])
   GNULIB_FPUTC=0;                AC_SUBST([GNULIB_FPUTC])
   GNULIB_FPUTS=0;                AC_SUBST([GNULIB_FPUTS])
+  GNULIB_FREAD=0;                AC_SUBST([GNULIB_FREAD])
   GNULIB_FREOPEN=0;              AC_SUBST([GNULIB_FREOPEN])
+  GNULIB_FSCANF=0;               AC_SUBST([GNULIB_FSCANF])
   GNULIB_FSEEK=0;                AC_SUBST([GNULIB_FSEEK])
   GNULIB_FSEEKO=0;               AC_SUBST([GNULIB_FSEEKO])
   GNULIB_FTELL=0;                AC_SUBST([GNULIB_FTELL])
   GNULIB_FTELLO=0;               AC_SUBST([GNULIB_FTELLO])
   GNULIB_FWRITE=0;               AC_SUBST([GNULIB_FWRITE])
+  GNULIB_GETC=0;                 AC_SUBST([GNULIB_GETC])
+  GNULIB_GETCHAR=0;              AC_SUBST([GNULIB_GETCHAR])
   GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
   GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
+  GNULIB_GETS=0;                 AC_SUBST([GNULIB_GETS])
   GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
   GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
   GNULIB_PERROR=0;               AC_SUBST([GNULIB_PERROR])
@@ -80,11 +125,15 @@
   GNULIB_REMOVE=0;               AC_SUBST([GNULIB_REMOVE])
   GNULIB_RENAME=0;               AC_SUBST([GNULIB_RENAME])
   GNULIB_RENAMEAT=0;             AC_SUBST([GNULIB_RENAMEAT])
+  GNULIB_SCANF=0;                AC_SUBST([GNULIB_SCANF])
   GNULIB_SNPRINTF=0;             AC_SUBST([GNULIB_SNPRINTF])
   GNULIB_SPRINTF_POSIX=0;        AC_SUBST([GNULIB_SPRINTF_POSIX])
+  GNULIB_STDIO_H_NONBLOCKING=0;  AC_SUBST([GNULIB_STDIO_H_NONBLOCKING])
   GNULIB_STDIO_H_SIGPIPE=0;      AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
   GNULIB_TMPFILE=0;              AC_SUBST([GNULIB_TMPFILE])
   GNULIB_VASPRINTF=0;            AC_SUBST([GNULIB_VASPRINTF])
+  GNULIB_VFSCANF=0;              AC_SUBST([GNULIB_VFSCANF])
+  GNULIB_VSCANF=0;               AC_SUBST([GNULIB_VSCANF])
   GNULIB_VDPRINTF=0;             AC_SUBST([GNULIB_VDPRINTF])
   GNULIB_VFPRINTF=0;             AC_SUBST([GNULIB_VFPRINTF])
   GNULIB_VFPRINTF_POSIX=0;       AC_SUBST([GNULIB_VFPRINTF_POSIX])
@@ -129,6 +178,7 @@
   REPLACE_RENAMEAT=0;            AC_SUBST([REPLACE_RENAMEAT])
   REPLACE_SNPRINTF=0;            AC_SUBST([REPLACE_SNPRINTF])
   REPLACE_SPRINTF=0;             AC_SUBST([REPLACE_SPRINTF])
+  REPLACE_STDIO_READ_FUNCS=0;    AC_SUBST([REPLACE_STDIO_READ_FUNCS])
   REPLACE_STDIO_WRITE_FUNCS=0;   AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
   REPLACE_TMPFILE=0;             AC_SUBST([REPLACE_TMPFILE])
   REPLACE_VASPRINTF=0;           AC_SUBST([REPLACE_VASPRINTF])
--- a/m4/strchrnul.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/strchrnul.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# strchrnul.m4 serial 7
+# strchrnul.m4 serial 8
 dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,9 +10,42 @@
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  AC_REPLACE_FUNCS([strchrnul])
+  AC_CHECK_FUNCS([strchrnul])
   if test $ac_cv_func_strchrnul = no; then
     HAVE_STRCHRNUL=0
+  else
+    AC_CACHE_CHECK([whether strchrnul works],
+      [gl_cv_func_strchrnul_works],
+      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <string.h> /* for strchrnul */
+]], [[const char *buf = "a";
+      return strchrnul (buf, 'b') != buf + 1;
+    ]])],
+        [gl_cv_func_strchrnul_works=yes],
+        [gl_cv_func_strchrnul_works=no],
+        [dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10
+         AC_EGREP_CPP([Lucky user],
+           [
+#if defined __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9)
+  Lucky user
+ #endif
+#else
+  Lucky user
+#endif
+           ],
+           [gl_cv_func_strchrnul_works="guessing yes"],
+           [gl_cv_func_strchrnul_works="guessing no"])
+        ])
+      ])
+    case "$gl_cv_func_strchrnul_works" in
+      *yes) ;;
+      *) REPLACE_STRCHRNUL=1 ;;
+    esac
+  fi
+  if test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1; then
+    AC_LIBOBJ([strchrnul])
     gl_PREREQ_STRCHRNUL
   fi
 ])
--- a/m4/string_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/string_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 19
+# serial 20
 
 # Written by Paul Eggert.
 
@@ -104,6 +104,7 @@
   REPLACE_STRDUP=0;             AC_SUBST([REPLACE_STRDUP])
   REPLACE_STRSTR=0;             AC_SUBST([REPLACE_STRSTR])
   REPLACE_STRCASESTR=0;         AC_SUBST([REPLACE_STRCASESTR])
+  REPLACE_STRCHRNUL=0;          AC_SUBST([REPLACE_STRCHRNUL])
   REPLACE_STRERROR=0;           AC_SUBST([REPLACE_STRERROR])
   REPLACE_STRERROR_R=0;         AC_SUBST([REPLACE_STRERROR_R])
   REPLACE_STRNCAT=0;            AC_SUBST([REPLACE_STRNCAT])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/strtod-obsolete.m4	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,11 @@
+# strtod-obsolete.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_STRTOD_OBSOLETE],
+[
+  dnl The real code is in strtod.m4.
+  :
+])
--- a/m4/strtod.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/strtod.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# strtod.m4 serial 19
+# strtod.m4 serial 20
 dnl Copyright (C) 2002-2003, 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,15 +7,18 @@
 AC_DEFUN([gl_FUNC_STRTOD],
 [
   AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
-  dnl Test whether strtod is declared.
-  dnl Don't call AC_FUNC_STRTOD, because it does not have the right guess
-  dnl when cross-compiling.
-  dnl Don't call AC_CHECK_FUNCS([strtod]) because it would collide with the
-  dnl ac_cv_func_strtod variable set by the AC_FUNC_STRTOD macro.
-  AC_CHECK_DECLS_ONCE([strtod])
-  if test $ac_cv_have_decl_strtod != yes; then
-    HAVE_STRTOD=0
-  else
+  m4_ifdef([gl_FUNC_STRTOD_OBSOLETE], [
+    dnl Test whether strtod is declared.
+    dnl Don't call AC_FUNC_STRTOD, because it does not have the right guess
+    dnl when cross-compiling.
+    dnl Don't call AC_CHECK_FUNCS([strtod]) because it would collide with the
+    dnl ac_cv_func_strtod variable set by the AC_FUNC_STRTOD macro.
+    AC_CHECK_DECLS_ONCE([strtod])
+    if test $ac_cv_have_decl_strtod != yes; then
+      HAVE_STRTOD=0
+    fi
+  ])
+  if test $HAVE_STRTOD = 1; then
     AC_CACHE_CHECK([whether strtod obeys C99], [gl_cv_func_strtod_works],
       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <stdlib.h>
--- a/m4/strtoimax.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/strtoimax.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# strtoimax.m4 serial 8
+# strtoimax.m4 serial 9
 dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,16 +6,12 @@
 
 AC_DEFUN([gl_FUNC_STRTOIMAX],
 [
-  AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
-    gl_cv_func_strtoimax_macro,
-    [AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
-#ifdef strtoimax
- inttypes_h_defines_strtoimax
-#endif],
-       gl_cv_func_strtoimax_macro=yes,
-       gl_cv_func_strtoimax_macro=no)])
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
 
-  if test "$gl_cv_func_strtoimax_macro" != yes; then
+  AC_CHECK_DECLS_ONCE([strtoimax])
+  if test "$ac_cv_have_decl_strtoimax" != yes; then
+    HAVE_DECL_STRTOIMAX=0
+
     AC_REPLACE_FUNCS([strtoimax])
     if test $ac_cv_func_strtoimax = no; then
       gl_PREREQ_STRTOIMAX
--- a/m4/strtoumax.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/strtoumax.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# strtoumax.m4 serial 8
+# strtoumax.m4 serial 9
 dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,16 +6,12 @@
 
 AC_DEFUN([gl_FUNC_STRTOUMAX],
 [
-  AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
-    gl_cv_func_strtoumax_macro,
-    [AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
-#ifdef strtoumax
- inttypes_h_defines_strtoumax
-#endif],
-       gl_cv_func_strtoumax_macro=yes,
-       gl_cv_func_strtoumax_macro=no)])
+  AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
 
-  if test "$gl_cv_func_strtoumax_macro" != yes; then
+  AC_CHECK_DECLS_ONCE([strtoumax])
+  if test "$ac_cv_have_decl_strtoumax" != yes; then
+    HAVE_DECL_STRTOUMAX=0
+
     AC_REPLACE_FUNCS([strtoumax])
     if test $ac_cv_func_strtoumax = no; then
       gl_PREREQ_STRTOUMAX
--- a/m4/sys_ioctl_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/sys_ioctl_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# sys_ioctl_h.m4 serial 9
+# sys_ioctl_h.m4 serial 10
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -44,13 +44,6 @@
     ]], [ioctl])
 ])
 
-dnl Unconditionally enables the replacement of <sys/ioctl.h>.
-AC_DEFUN([gl_REPLACE_SYS_IOCTL_H],
-[
-  dnl This is a no-op, because <sys/ioctl.h> is always overridden.
-  :
-])
-
 AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/sys_uio_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,31 @@
+# sys_uio_h.m4 serial 1
+dnl Copyright (C) 2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_HEADER_SYS_UIO],
+[
+  AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
+  dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/uio.h])
+  if test $ac_cv_header_sys_uio_h = yes; then
+    HAVE_SYS_UIO_H=1
+  else
+    HAVE_SYS_UIO_H=0
+  fi
+  AC_SUBST([HAVE_SYS_UIO_H])
+])
+
+AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS])
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_SYS_UIO_H_DEFAULTS],
+[
+])
--- a/m4/sysexits.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/sysexits.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# sysexits.m4 serial 5
+# sysexits.m4 serial 6
 dnl Copyright (C) 2003, 2005, 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -40,4 +40,5 @@
   fi
   AC_SUBST([HAVE_SYSEXITS_H])
   AC_SUBST([SYSEXITS_H])
+  AM_CONDITIONAL([GL_GENERATE_SYSEXITS_H], [test -n "$SYSEXITS_H"])
 ])
--- a/m4/unistd_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/unistd_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 53
+# unistd_h.m4 serial 55
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -52,47 +52,49 @@
 
 AC_DEFUN([gl_UNISTD_H_DEFAULTS],
 [
-  GNULIB_CHOWN=0;            AC_SUBST([GNULIB_CHOWN])
-  GNULIB_CLOSE=0;            AC_SUBST([GNULIB_CLOSE])
-  GNULIB_DUP2=0;             AC_SUBST([GNULIB_DUP2])
-  GNULIB_DUP3=0;             AC_SUBST([GNULIB_DUP3])
-  GNULIB_ENVIRON=0;          AC_SUBST([GNULIB_ENVIRON])
-  GNULIB_EUIDACCESS=0;       AC_SUBST([GNULIB_EUIDACCESS])
-  GNULIB_FACCESSAT=0;        AC_SUBST([GNULIB_FACCESSAT])
-  GNULIB_FCHDIR=0;           AC_SUBST([GNULIB_FCHDIR])
-  GNULIB_FCHOWNAT=0;         AC_SUBST([GNULIB_FCHOWNAT])
-  GNULIB_FSYNC=0;            AC_SUBST([GNULIB_FSYNC])
-  GNULIB_FTRUNCATE=0;        AC_SUBST([GNULIB_FTRUNCATE])
-  GNULIB_GETCWD=0;           AC_SUBST([GNULIB_GETCWD])
-  GNULIB_GETDOMAINNAME=0;    AC_SUBST([GNULIB_GETDOMAINNAME])
-  GNULIB_GETDTABLESIZE=0;    AC_SUBST([GNULIB_GETDTABLESIZE])
-  GNULIB_GETGROUPS=0;        AC_SUBST([GNULIB_GETGROUPS])
-  GNULIB_GETHOSTNAME=0;      AC_SUBST([GNULIB_GETHOSTNAME])
-  GNULIB_GETLOGIN=0;         AC_SUBST([GNULIB_GETLOGIN])
-  GNULIB_GETLOGIN_R=0;       AC_SUBST([GNULIB_GETLOGIN_R])
-  GNULIB_GETPAGESIZE=0;      AC_SUBST([GNULIB_GETPAGESIZE])
-  GNULIB_GETUSERSHELL=0;     AC_SUBST([GNULIB_GETUSERSHELL])
-  GNULIB_LCHOWN=0;           AC_SUBST([GNULIB_LCHOWN])
-  GNULIB_LINK=0;             AC_SUBST([GNULIB_LINK])
-  GNULIB_LINKAT=0;           AC_SUBST([GNULIB_LINKAT])
-  GNULIB_LSEEK=0;            AC_SUBST([GNULIB_LSEEK])
-  GNULIB_PIPE=0;             AC_SUBST([GNULIB_PIPE])
-  GNULIB_PIPE2=0;            AC_SUBST([GNULIB_PIPE2])
-  GNULIB_PREAD=0;            AC_SUBST([GNULIB_PREAD])
-  GNULIB_PWRITE=0;           AC_SUBST([GNULIB_PWRITE])
-  GNULIB_READLINK=0;         AC_SUBST([GNULIB_READLINK])
-  GNULIB_READLINKAT=0;       AC_SUBST([GNULIB_READLINKAT])
-  GNULIB_RMDIR=0;            AC_SUBST([GNULIB_RMDIR])
-  GNULIB_SLEEP=0;            AC_SUBST([GNULIB_SLEEP])
-  GNULIB_SYMLINK=0;          AC_SUBST([GNULIB_SYMLINK])
-  GNULIB_SYMLINKAT=0;        AC_SUBST([GNULIB_SYMLINKAT])
-  GNULIB_TTYNAME_R=0;        AC_SUBST([GNULIB_TTYNAME_R])
-  GNULIB_UNISTD_H_GETOPT=0;  AC_SUBST([GNULIB_UNISTD_H_GETOPT])
-  GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
-  GNULIB_UNLINK=0;           AC_SUBST([GNULIB_UNLINK])
-  GNULIB_UNLINKAT=0;         AC_SUBST([GNULIB_UNLINKAT])
-  GNULIB_USLEEP=0;           AC_SUBST([GNULIB_USLEEP])
-  GNULIB_WRITE=0;            AC_SUBST([GNULIB_WRITE])
+  GNULIB_CHOWN=0;                AC_SUBST([GNULIB_CHOWN])
+  GNULIB_CLOSE=0;                AC_SUBST([GNULIB_CLOSE])
+  GNULIB_DUP2=0;                 AC_SUBST([GNULIB_DUP2])
+  GNULIB_DUP3=0;                 AC_SUBST([GNULIB_DUP3])
+  GNULIB_ENVIRON=0;              AC_SUBST([GNULIB_ENVIRON])
+  GNULIB_EUIDACCESS=0;           AC_SUBST([GNULIB_EUIDACCESS])
+  GNULIB_FACCESSAT=0;            AC_SUBST([GNULIB_FACCESSAT])
+  GNULIB_FCHDIR=0;               AC_SUBST([GNULIB_FCHDIR])
+  GNULIB_FCHOWNAT=0;             AC_SUBST([GNULIB_FCHOWNAT])
+  GNULIB_FSYNC=0;                AC_SUBST([GNULIB_FSYNC])
+  GNULIB_FTRUNCATE=0;            AC_SUBST([GNULIB_FTRUNCATE])
+  GNULIB_GETCWD=0;               AC_SUBST([GNULIB_GETCWD])
+  GNULIB_GETDOMAINNAME=0;        AC_SUBST([GNULIB_GETDOMAINNAME])
+  GNULIB_GETDTABLESIZE=0;        AC_SUBST([GNULIB_GETDTABLESIZE])
+  GNULIB_GETGROUPS=0;            AC_SUBST([GNULIB_GETGROUPS])
+  GNULIB_GETHOSTNAME=0;          AC_SUBST([GNULIB_GETHOSTNAME])
+  GNULIB_GETLOGIN=0;             AC_SUBST([GNULIB_GETLOGIN])
+  GNULIB_GETLOGIN_R=0;           AC_SUBST([GNULIB_GETLOGIN_R])
+  GNULIB_GETPAGESIZE=0;          AC_SUBST([GNULIB_GETPAGESIZE])
+  GNULIB_GETUSERSHELL=0;         AC_SUBST([GNULIB_GETUSERSHELL])
+  GNULIB_LCHOWN=0;               AC_SUBST([GNULIB_LCHOWN])
+  GNULIB_LINK=0;                 AC_SUBST([GNULIB_LINK])
+  GNULIB_LINKAT=0;               AC_SUBST([GNULIB_LINKAT])
+  GNULIB_LSEEK=0;                AC_SUBST([GNULIB_LSEEK])
+  GNULIB_PIPE=0;                 AC_SUBST([GNULIB_PIPE])
+  GNULIB_PIPE2=0;                AC_SUBST([GNULIB_PIPE2])
+  GNULIB_PREAD=0;                AC_SUBST([GNULIB_PREAD])
+  GNULIB_PWRITE=0;               AC_SUBST([GNULIB_PWRITE])
+  GNULIB_READ=0;                 AC_SUBST([GNULIB_READ])
+  GNULIB_READLINK=0;             AC_SUBST([GNULIB_READLINK])
+  GNULIB_READLINKAT=0;           AC_SUBST([GNULIB_READLINKAT])
+  GNULIB_RMDIR=0;                AC_SUBST([GNULIB_RMDIR])
+  GNULIB_SLEEP=0;                AC_SUBST([GNULIB_SLEEP])
+  GNULIB_SYMLINK=0;              AC_SUBST([GNULIB_SYMLINK])
+  GNULIB_SYMLINKAT=0;            AC_SUBST([GNULIB_SYMLINKAT])
+  GNULIB_TTYNAME_R=0;            AC_SUBST([GNULIB_TTYNAME_R])
+  GNULIB_UNISTD_H_GETOPT=0;      AC_SUBST([GNULIB_UNISTD_H_GETOPT])
+  GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
+  GNULIB_UNISTD_H_SIGPIPE=0;     AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
+  GNULIB_UNLINK=0;               AC_SUBST([GNULIB_UNLINK])
+  GNULIB_UNLINKAT=0;             AC_SUBST([GNULIB_UNLINKAT])
+  GNULIB_USLEEP=0;               AC_SUBST([GNULIB_USLEEP])
+  GNULIB_WRITE=0;                AC_SUBST([GNULIB_WRITE])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_CHOWN=1;           AC_SUBST([HAVE_CHOWN])
   HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
@@ -147,6 +149,7 @@
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
   REPLACE_PREAD=0;        AC_SUBST([REPLACE_PREAD])
   REPLACE_PWRITE=0;       AC_SUBST([REPLACE_PWRITE])
+  REPLACE_READ=0;         AC_SUBST([REPLACE_READ])
   REPLACE_READLINK=0;     AC_SUBST([REPLACE_READLINK])
   REPLACE_RMDIR=0;        AC_SUBST([REPLACE_RMDIR])
   REPLACE_SLEEP=0;        AC_SUBST([REPLACE_SLEEP])
--- a/m4/wchar_h.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/wchar_h.m4	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 38
+# wchar_h.m4 serial 39
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -119,13 +119,6 @@
   fi
 ])
 
-dnl Unconditionally enables the replacement of <wchar.h>.
-AC_DEFUN([gl_REPLACE_WCHAR_H],
-[
-  dnl This is a no-op, because <wchar.h> is always overridden.
-  :
-])
-
 AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
 [
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
--- a/m4/wcrtomb.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/wcrtomb.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# wcrtomb.m4 serial 8
+# wcrtomb.m4 serial 9
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -89,7 +89,6 @@
     fi
   fi
   if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([wcrtomb])
     gl_PREREQ_WCRTOMB
   fi
--- a/m4/wcsnrtombs.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/wcsnrtombs.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# wcsnrtombs.m4 serial 3
+# wcsnrtombs.m4 serial 4
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -20,7 +20,6 @@
     fi
   fi
   if test $HAVE_WCSNRTOMBS = 0 || test $REPLACE_WCSNRTOMBS = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([wcsnrtombs])
     AC_LIBOBJ([wcsrtombs-state])
     gl_PREREQ_WCSNRTOMBS
--- a/m4/wcsrtombs.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/wcsrtombs.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# wcsrtombs.m4 serial 8
+# wcsrtombs.m4 serial 9
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -35,7 +35,6 @@
     fi
   fi
   if test $HAVE_WCSRTOMBS = 0 || test $REPLACE_WCSRTOMBS = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([wcsrtombs])
     AC_LIBOBJ([wcsrtombs-state])
     gl_PREREQ_WCSRTOMBS
--- a/m4/wctob.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/wctob.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# wctob.m4 serial 7
+# wctob.m4 serial 8
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,7 +11,6 @@
   AC_CHECK_FUNCS_ONCE([wctob])
   if test $ac_cv_func_wctob = no; then
     HAVE_DECL_WCTOB=0
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([wctob])
     gl_PREREQ_WCTOB
   else
@@ -103,7 +102,6 @@
       *) REPLACE_WCTOB=1 ;;
     esac
     if test $REPLACE_WCTOB = 1; then
-      gl_REPLACE_WCHAR_H
       AC_LIBOBJ([wctob])
       gl_PREREQ_WCTOB
     else
@@ -121,7 +119,6 @@
 ])
       if test $ac_cv_have_decl_wctob != yes; then
         HAVE_DECL_WCTOB=0
-        gl_REPLACE_WCHAR_H
       fi
     fi
   fi
--- a/m4/wcwidth.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/wcwidth.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# wcwidth.m4 serial 18
+# wcwidth.m4 serial 19
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -93,10 +93,6 @@
   if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1; then
     AC_LIBOBJ([wcwidth])
   fi
-  if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1 \
-     || test $HAVE_DECL_WCWIDTH = 0; then
-    gl_REPLACE_WCHAR_H
-  fi
   dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not
   dnl have the wcwidth function, then it does not declare it.
 ])
--- a/m4/write.m4	Fri Apr 01 16:04:45 2011 -0700
+++ b/m4/write.m4	Fri May 06 08:15:59 2011 -0700
@@ -1,4 +1,4 @@
-# write.m4 serial 1
+# write.m4 serial 2
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,7 +14,15 @@
     gl_SIGNAL_SIGPIPE
     if test $gl_cv_header_signal_h_SIGPIPE != yes; then
       REPLACE_WRITE=1
-      AC_LIBOBJ([write])
     fi
   ])
+  m4_ifdef([gl_NONBLOCKING_IO], [
+    gl_NONBLOCKING_IO
+    if test $gl_cv_have_nonblocking != yes; then
+      REPLACE_WRITE=1
+    fi
+  ])
+  if test $REPLACE_WRITE = 1; then
+    AC_LIBOBJ([write])
+  fi
 ])
--- a/modules/accept	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/accept	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/acosl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/acosl	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 Depends-on:
 math
 extensions
-asinl
-sqrtl
+asinl           [test $HAVE_ACOSL = 0]
+sqrtl           [test $HAVE_ACOSL = 0]
 
 configure.ac:
 gl_FUNC_ACOSL
@@ -24,7 +24,7 @@
 $(ACOSL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- a/modules/alloca-opt	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/alloca-opt	Fri May 06 08:15:59 2011 -0700
@@ -20,12 +20,17 @@
 
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
-alloca.h: alloca.in.h
+if GL_GENERATE_ALLOCA_H
+alloca.h: alloca.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  cat $(srcdir)/alloca.in.h; \
 	} > $@-t && \
 	mv -f $@-t $@
+else
+alloca.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += alloca.h alloca.h-t
 
 Include:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/allocator	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,22 @@
+Description:
+Storage allocators.
+
+Files:
+lib/allocator.h
+lib/allocator.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += allocator.c
+
+Include:
+"allocator.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+all
--- a/modules/areadlink	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/areadlink	Fri May 06 08:15:59 2011 -0700
@@ -6,10 +6,7 @@
 lib/areadlink.c
 
 Depends-on:
-readlink
-ssize_t
-stdint
-unistd
+careadlinkat
 
 configure.ac:
 
--- a/modules/areadlinkat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/areadlinkat	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 areadlink
-stdint
+careadlinkat
 readlinkat
 
 configure.ac:
--- a/modules/areadlinkat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/areadlinkat-tests	Fri May 06 08:15:59 2011 -0700
@@ -13,4 +13,3 @@
 Makefile.am:
 TESTS += test-areadlinkat
 check_PROGRAMS += test-areadlinkat
-test_areadlinkat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/argmatch	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/argmatch	Fri May 06 08:15:59 2011 -0700
@@ -11,10 +11,10 @@
 error
 quotearg
 quote
-exit
 exitfail
 verify
 stdbool
+stdlib
 memcmp
 
 configure.ac:
--- a/modules/argz	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/argz	Fri May 06 08:15:59 2011 -0700
@@ -7,12 +7,12 @@
 m4/argz.m4
 
 Depends-on:
-memmove
-mempcpy
-stpcpy
-strndup
-strnlen
-strstr
+memmove         [test -n "$ARGZ_H"]
+mempcpy         [test -n "$ARGZ_H"]
+stpcpy          [test -n "$ARGZ_H"]
+strndup         [test -n "$ARGZ_H"]
+strnlen         [test -n "$ARGZ_H"]
+strstr          [test -n "$ARGZ_H"]
 
 configure.ac:
 gl_FUNC_ARGZ
@@ -25,12 +25,17 @@
 
 # We need the following in order to create <argz.h> when the system
 # doesn't have one that works with the given compiler.
-argz.h: argz.in.h
+if GL_GENERATE_ARGZ_H
+argz.h: argz.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  cat $(srcdir)/argz.in.h; \
 	} > $@-t && \
 	mv -f $@-t $@
+else
+argz.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += argz.h argz.h-t
 
 Include:
--- a/modules/arpa_inet	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/arpa_inet	Fri May 06 08:15:59 2011 -0700
@@ -23,7 +23,7 @@
 
 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) arpa
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/asinl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/asinl	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 Depends-on:
 math
 extensions
-sqrtl
+sqrtl           [test $HAVE_ASINL = 0]
 
 configure.ac:
 gl_FUNC_ASINL
@@ -23,7 +23,7 @@
 $(ASINL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/assert-h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,47 @@
+Description:
+An <assert.h> that conforms to C1X.
+
+Files:
+lib/assert.in.h
+lib/verify.h
+m4/assert_h.m4
+
+Depends-on:
+include_next
+
+configure.ac:
+gl_ASSERT_H
+
+Makefile.am:
+BUILT_SOURCES += $(ASSERT_H)
+
+# We need the following in order to create <assert.h> when the system
+# doesn't have one that works with the given compiler.
+if GL_GENERATE_ASSERT_H
+assert.h: assert.in.h verify.h $(top_builddir)/config.status
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+	      -e 's|@''NEXT_ASSERT_H''@|$(NEXT_ASSERT_H)|g' \
+	      < $(srcdir)/assert.in.h && \
+	  sed -e 's|_gl_verify|_gl_static_assert|g' \
+	      -e 's|_GL_VERIFY|_GL_STATIC_ASSERT|g' \
+	      < $(srcdir)/verify.h; \
+	} > $@-t && \
+	mv $@-t $@
+else
+assert.h: $(top_builddir)/config.status
+	rm -f $@
+endif
+MOSTLYCLEANFILES += assert.h assert.h-t
+
+Include:
+<assert.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Paul Eggert
--- a/modules/atanl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/atanl	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 Depends-on:
 math
 extensions
-isnanl
+isnanl          [test $HAVE_ATANL = 0]
 
 configure.ac:
 gl_FUNC_ATANL
@@ -23,7 +23,7 @@
 $(ATANL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- a/modules/atoll	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/atoll	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 m4/longlong.m4
 
 Depends-on:
-strtoll
+strtoll         [test $HAVE_ATOLL = 0]
 
 configure.ac:
 gl_FUNC_ATOLL
--- a/modules/binary-io	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/binary-io	Fri May 06 08:15:59 2011 -0700
@@ -16,7 +16,7 @@
 "binary-io.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible
--- a/modules/bind	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/bind	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/btowc	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/btowc	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 wchar
-mbtowc
+mbtowc          [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]
 
 configure.ac:
 gl_FUNC_BTOWC
--- a/modules/byteswap	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/byteswap	Fri May 06 08:15:59 2011 -0700
@@ -18,12 +18,17 @@
 
 # We need the following in order to create <byteswap.h> when the system
 # doesn't have one.
-byteswap.h: byteswap.in.h
+if GL_GENERATE_BYTESWAP_H
+byteswap.h: byteswap.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  cat $(srcdir)/byteswap.in.h; \
 	} > $@-t && \
 	mv -f $@-t $@
+else
+byteswap.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += byteswap.h byteswap.h-t
 
 Include:
--- a/modules/canonicalize-lgpl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/canonicalize-lgpl	Fri May 06 08:15:59 2011 -0700
@@ -7,16 +7,16 @@
 m4/double-slash-root.m4
 
 Depends-on:
-alloca-opt
-errno
 extensions
-lstat
-malloca
-memmove
-pathmax
-readlink
 stdlib
-sys_stat
+alloca-opt      [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1]
+errno           [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1]
+lstat           [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1]
+malloca         [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1]
+memmove         [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1]
+pathmax         [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1]
+readlink        [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1]
+sys_stat        [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1]
 
 configure.ac:
 gl_CANONICALIZE_LGPL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/careadlinkat	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,27 @@
+Description:
+Read symbolic links into a buffer without size limitation, relative to fd.
+
+Files:
+lib/careadlinkat.c
+lib/careadlinkat.h
+
+Depends-on:
+allocator
+readlink
+ssize_t
+unistd
+
+configure.ac:
+AC_CHECK_FUNCS_ONCE([readlinkat])
+
+Makefile.am:
+lib_SOURCES += careadlinkat.c
+
+Include:
+"careadlinkat.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Paul Eggert, Bruno Haible, Jim Meyering
--- a/modules/ceil	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ceil	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 math
-float
+float           [test $REPLACE_CEIL = 1]
 
 configure.ac:
 gl_FUNC_CEIL
--- a/modules/ceilf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ceilf	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_CEILF = 0 || test $REPLACE_CEILF = 1]
 
 configure.ac:
 gl_FUNC_CEILF
--- a/modules/ceill	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ceill	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1]
 
 configure.ac:
 gl_FUNC_CEILL
--- a/modules/chdir-long	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/chdir-long	Fri May 06 08:15:59 2011 -0700
@@ -7,14 +7,16 @@
 m4/chdir-long.m4
 
 Depends-on:
-atexit
-fchdir
-fcntl-h
-openat
-memchr
-mempcpy
-memrchr
-stdbool
+unistd
+atexit          [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
+fchdir          [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
+fcntl-h         [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
+openat          [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
+memchr          [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
+mempcpy         [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
+memrchr         [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
+stdbool         [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
+stdlib          [test $gl_cv_have_arbitrary_file_name_length_limit = yes]
 
 configure.ac:
 gl_FUNC_CHDIR_LONG
--- a/modules/chown	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/chown	Fri May 06 08:15:59 2011 -0700
@@ -7,11 +7,11 @@
 m4/chown.m4
 
 Depends-on:
-open
-stat
-stdbool
-sys_stat
 unistd
+open            [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1]
+stat            [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1]
+stdbool         [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1]
+sys_stat        [test $HAVE_CHOWN = 0 || test $REPLACE_CHOWN = 1]
 
 configure.ac:
 gl_FUNC_CHOWN
--- a/modules/close	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/close	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 unistd
-close-hook
+fd-hook         [test $REPLACE_CLOSE = 1]
 fclose
 
 configure.ac:
--- a/modules/close-hook	Fri Apr 01 16:04:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-Description:
-Hook for making close() extensible.
-
-Files:
-lib/close-hook.h
-lib/close-hook.c
-
-Depends-on:
-unistd
-
-configure.ac:
-
-Makefile.am:
-lib_SOURCES += close-hook.c
-
-Include:
-"close-hook.h"
-
-License:
-LGPLv2+
-
-Maintainer:
-Bruno Haible
--- a/modules/connect	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/connect	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/copy-file	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/copy-file	Fri May 06 08:15:59 2011 -0700
@@ -10,11 +10,11 @@
 acl
 binary-io
 error
-exit
 full-write
 gettext-h
 open
 safe-read
+stdlib
 unistd
 xalloc
 
--- a/modules/cosl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/cosl	Fri May 06 08:15:59 2011 -0700
@@ -11,10 +11,10 @@
 Depends-on:
 math
 extensions
-float
-isnanl
-floor
-floorl
+float           [test $HAVE_COSL = 0]
+isnanl          [test $HAVE_COSL = 0]
+floor           [test $HAVE_COSL = 0]
+floorl          [test $HAVE_COSL = 0]
 
 configure.ac:
 gl_FUNC_COSL
@@ -29,7 +29,7 @@
 $(ACOSL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- a/modules/ctype	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ctype	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,7 @@
 
 # We need the following in order to create <ctype.h> when the system
 # doesn't have one that works with the given compiler.
-ctype.h: ctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+ctype.h: ctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
--- a/modules/dirent	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/dirent	Fri May 06 08:15:59 2011 -0700
@@ -22,7 +22,7 @@
 
 # We need the following in order to create <dirent.h> when the system
 # doesn't have one that works with the given compiler.
-dirent.h: dirent.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+dirent.h: dirent.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
--- a/modules/dirent-safer-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/dirent-safer-tests	Fri May 06 08:15:59 2011 -0700
@@ -10,6 +10,3 @@
 Makefile.am:
 TESTS += test-dirent-safer
 check_PROGRAMS += test-dirent-safer
-# Link with libintl when needed. dirent-safer uses fdopendir if it is present,
-# and fdopendir indirectly depends on xgetcwd -> xalloc-die -> gettext-h.
-test_dirent_safer_LDADD = $(LDADD) $(LIBINTL)
--- a/modules/dirfd	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/dirfd	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 dirent
-errno
 extensions
+errno           [test $ac_cv_have_decl_dirfd = no || test $REPLACE_DIRFD = 1]
 
 configure.ac:
 gl_FUNC_DIRFD
--- a/modules/dprintf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/dprintf	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 
 Depends-on:
 stdio
-vasnprintf
-full-write
-errno
+vasnprintf      [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+full-write      [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+errno           [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
 
 configure.ac:
 gl_FUNC_DPRINTF
--- a/modules/dprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/dprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,18 +14,18 @@
 
 Depends-on:
 dprintf
-vasnprintf
-isnand-nolibm
-isnanl-nolibm
-frexp-nolibm
-frexpl-nolibm
-printf-frexp
-printf-frexpl
-signbit
-fpucw
 nocrash
 printf-safe
 multiarch
+vasnprintf      [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+isnand-nolibm   [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+isnanl-nolibm   [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+frexp-nolibm    [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+frexpl-nolibm   [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+printf-frexp    [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+printf-frexpl   [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+signbit         [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
+fpucw           [test $ac_cv_func_dprintf = no || test $REPLACE_DPRINTF = 1]
 
 configure.ac:
 gl_FUNC_DPRINTF_POSIX
--- a/modules/dup2	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/dup2	Fri May 06 08:15:59 2011 -0700
@@ -7,6 +7,7 @@
 
 Depends-on:
 unistd
+dup2-obsolete
 
 configure.ac:
 gl_FUNC_DUP2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/dup2-obsolete	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,28 @@
+Description:
+dup2() function for old platforms.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+m4/dup2-obsolete.m4
+
+Depends-on:
+dup2
+
+configure.ac:
+gl_FUNC_DUP2_OBSOLETE
+
+Makefile.am:
+
+Include:
+<unistd.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
--- a/modules/errno	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/errno	Fri May 06 08:15:59 2011 -0700
@@ -19,7 +19,8 @@
 
 # We need the following in order to create <errno.h> when the system
 # doesn't have one that is POSIX compliant.
-errno.h: errno.in.h
+if GL_GENERATE_ERRNO_H
+errno.h: errno.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -35,6 +36,10 @@
 	      < $(srcdir)/errno.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+errno.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += errno.h errno.h-t
 
 Include:
--- a/modules/error	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/error	Fri May 06 08:15:59 2011 -0700
@@ -12,8 +12,8 @@
 m4/error.m4
 
 Depends-on:
-strerror
-unistd
+strerror        [test $ac_cv_lib_error_at_line = no]
+unistd          [test $ac_cv_lib_error_at_line = no]
 
 configure.ac:
 gl_ERROR
--- a/modules/euidaccess	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/euidaccess	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 Depends-on:
 unistd
 extensions
-group-member
-stat
-sys_stat
+group-member    [test $HAVE_EUIDACCESS = 0]
+stat            [test $HAVE_EUIDACCESS = 0]
+sys_stat        [test $HAVE_EUIDACCESS = 0]
 
 configure.ac:
 gl_FUNC_EUIDACCESS
--- a/modules/execute	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/execute	Fri May 06 08:15:59 2011 -0700
@@ -11,7 +11,6 @@
 cloexec
 dup2
 error
-exit
 fatal-signal
 wait-process
 gettext-h
@@ -25,6 +24,7 @@
 posix_spawnattr_setflags
 posix_spawnattr_destroy
 stdbool
+stdlib
 strpbrk
 unistd
 environ
--- a/modules/exit	Fri Apr 01 16:04:45 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-Description:
-exit() function: program termination.
-
-Status:
-obsolete
-
-Notice:
-This module is obsolete. It will be removed on 2011-01-01.  Use 'stdlib'.
-
-Files:
-
-Depends-on:
-stdlib
-
-configure.ac:
-
-Makefile.am:
-
-Include:
-<stdlib.h>
-
-License:
-LGPLv2+
-
-Maintainer:
-Bruno Haible
--- a/modules/exitfail	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/exitfail	Fri May 06 08:15:59 2011 -0700
@@ -6,7 +6,7 @@
 lib/exitfail.c
 
 Depends-on:
-exit
+stdlib
 
 configure.ac:
 
--- a/modules/expl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/expl	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 Depends-on:
 math
 extensions
-float
-floorl
+float           [test $HAVE_EXPL = 0]
+floorl          [test $HAVE_EXPL = 0]
 
 configure.ac:
 gl_FUNC_EXPL
@@ -24,7 +24,7 @@
 $(EXPL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- a/modules/faccessat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/faccessat	Fri May 06 08:15:59 2011 -0700
@@ -6,11 +6,11 @@
 m4/faccessat.m4
 
 Depends-on:
-euidaccess
+unistd
 extensions
 fcntl-h
-openat
-unistd
+euidaccess      [test $HAVE_FACCESSAT = 0]
+openat          [test $HAVE_FACCESSAT = 0]
 
 configure.ac:
 gl_FUNC_FACCESSAT
--- a/modules/fchdir	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fchdir	Fri May 06 08:15:59 2011 -0700
@@ -6,21 +6,23 @@
 m4/fchdir.m4
 
 Depends-on:
-close
-dirent
-dirfd
-dup2
-fcntl
-fcntl-h
-include_next
-malloc-posix
-open
-realloc-posix
-stat
-stdbool
-strdup-posix
-sys_stat
 unistd
+close            [test $HAVE_FCHDIR = 0]
+dirent           [test $HAVE_FCHDIR = 0]
+dirfd            [test $HAVE_FCHDIR = 0]
+dosname          [test $HAVE_FCHDIR = 0]
+dup2             [test $HAVE_FCHDIR = 0]
+fcntl            [test $HAVE_FCHDIR = 0]
+fcntl-h          [test $HAVE_FCHDIR = 0]
+filenamecat-lgpl [test $HAVE_FCHDIR = 0]
+getcwd-lgpl      [test $HAVE_FCHDIR = 0]
+malloc-posix     [test $HAVE_FCHDIR = 0]
+open             [test $HAVE_FCHDIR = 0]
+realloc-posix    [test $HAVE_FCHDIR = 0]
+stat             [test $HAVE_FCHDIR = 0]
+stdbool          [test $HAVE_FCHDIR = 0]
+strdup-posix     [test $HAVE_FCHDIR = 0]
+sys_stat         [test $HAVE_FCHDIR = 0]
 
 configure.ac:
 gl_FUNC_FCHDIR
--- a/modules/fchdir-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fchdir-tests	Fri May 06 08:15:59 2011 -0700
@@ -4,7 +4,8 @@
 tests/macros.h
 
 Depends-on:
-getcwd
+cloexec
+getcwd-lgpl
 
 configure.ac:
 
--- a/modules/fclose	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fclose	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,9 @@
 
 Depends-on:
 stdio
-close
+close           [test $REPLACE_FCLOSE = 1]
+freading        [test $REPLACE_FCLOSE = 1]
+lseek           [test $REPLACE_FCLOSE = 1]
 
 configure.ac:
 gl_FUNC_FCLOSE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/fclose-tests	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,10 @@
+Files:
+tests/test-fclose.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fclose
+check_PROGRAMS += test-fclose
--- a/modules/fcntl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fcntl	Fri May 06 08:15:59 2011 -0700
@@ -6,10 +6,10 @@
 lib/fcntl.c
 
 Depends-on:
-dup2
 fcntl-h
-getdtablesize
 extensions
+dup2            [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1]
+getdtablesize   [test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1]
 
 configure.ac:
 gl_FUNC_FCNTL
--- a/modules/fcntl-h	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fcntl-h	Fri May 06 08:15:59 2011 -0700
@@ -24,7 +24,7 @@
 
 # We need the following in order to create <fcntl.h> when the system
 # doesn't have one that works with the given compiler.
-fcntl.h: fcntl.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -32,6 +32,7 @@
 	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
 	      -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \
 	      -e 's|@''GNULIB_FCNTL''@|$(GNULIB_FCNTL)|g' \
+	      -e 's|@''GNULIB_NONBLOCKING''@|$(GNULIB_NONBLOCKING)|g' \
 	      -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \
 	      -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \
 	      -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/fd-hook	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,23 @@
+Description:
+Hook for making file descriptor functions (close(), ioctl()) extensible.
+
+Files:
+lib/fd-hook.h
+lib/fd-hook.c
+
+Depends-on:
+unistd
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += fd-hook.c
+
+Include:
+"fd-hook.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
--- a/modules/fdopendir	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fdopendir	Fri May 06 08:15:59 2011 -0700
@@ -9,11 +9,11 @@
 
 Depends-on:
 dirent
-errno
 extensions
-fchdir
-openat-die
-save-cwd
+errno           [test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1]
+fchdir          [test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1]
+openat-die      [test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1]
+save-cwd        [test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1]
 
 configure.ac:
 gl_FUNC_FDOPENDIR
--- a/modules/fdopendir-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fdopendir-tests	Fri May 06 08:15:59 2011 -0700
@@ -12,4 +12,3 @@
 Makefile.am:
 TESTS += test-fdopendir
 check_PROGRAMS += test-fdopendir
-test_fdopendir_LDADD = $(LDADD) @LIBINTL@
--- a/modules/fdutimensat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fdutimensat-tests	Fri May 06 08:15:59 2011 -0700
@@ -19,4 +19,4 @@
 Makefile.am:
 TESTS += test-fdutimensat
 check_PROGRAMS += test-fdutimensat
-test_fdutimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBINTL@
+test_fdutimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
--- a/modules/fflush	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fflush	Fri May 06 08:15:59 2011 -0700
@@ -7,19 +7,20 @@
 m4/fflush.m4
 
 Depends-on:
-fpurge
-ftello
-freading
-lseek
 stdio
-unistd
-fseeko
+fpurge          [test $REPLACE_FFLUSH = 1]
+ftello          [test $REPLACE_FFLUSH = 1]
+freading        [test $REPLACE_FFLUSH = 1]
+lseek           [test $REPLACE_FFLUSH = 1]
+unistd          [test $REPLACE_FFLUSH = 1]
+fseeko          [test $REPLACE_FFLUSH = 1]
 
 configure.ac-early:
 AC_REQUIRE([AC_FUNC_FSEEKO])
 
 configure.ac:
 gl_FUNC_FFLUSH
+gl_MODULE_INDICATOR([fflush])
 gl_STDIO_MODULE_INDICATOR([fflush])
 
 Makefile.am:
@@ -28,7 +29,7 @@
 <stdio.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Eric Blake
--- a/modules/filenamecat-lgpl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/filenamecat-lgpl	Fri May 06 08:15:59 2011 -0700
@@ -18,7 +18,7 @@
 "filenamecat.h"
 
 License:
-GPL
+LGPLv2+
 
 Maintainer:
 Jim Meyering
--- a/modules/float	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/float	Fri May 06 08:15:59 2011 -0700
@@ -19,7 +19,8 @@
 
 # We need the following in order to create <float.h> when the system
 # doesn't have one that works with the given compiler.
-float.h: float.in.h
+if GL_GENERATE_FLOAT_H
+float.h: float.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -29,6 +30,10 @@
 	      < $(srcdir)/float.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+float.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += float.h float.h-t
 
 Include:
--- a/modules/floor	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/floor	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 math
-float
+float           [test $REPLACE_FLOOR = 1]
 
 configure.ac:
 gl_FUNC_FLOOR
--- a/modules/floorf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/floorf	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]
 
 configure.ac:
 gl_FUNC_FLOORF
--- a/modules/floorl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/floorl	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_FLOORL = 0 || test $REPLACE_FLOORL = 1]
 
 configure.ac:
 gl_FUNC_FLOORL
--- a/modules/fnmatch	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fnmatch	Fri May 06 08:15:59 2011 -0700
@@ -11,14 +11,14 @@
 Depends-on:
 arg-nonnull
 extensions
-alloca
-stdbool
-wchar
-wctype-h
-memchr
-memcmp
-mbsrtowcs
-mbsinit
+alloca          [test -n "$FNMATCH_H"]
+stdbool         [test -n "$FNMATCH_H"]
+wchar           [test -n "$FNMATCH_H"]
+wctype-h        [test -n "$FNMATCH_H"]
+memchr          [test -n "$FNMATCH_H"]
+memcmp          [test -n "$FNMATCH_H"]
+mbsrtowcs       [test -n "$FNMATCH_H"]
+mbsinit         [test -n "$FNMATCH_H"]
 
 configure.ac:
 gl_FUNC_FNMATCH_POSIX
@@ -31,13 +31,18 @@
 
 # We need the following in order to create <fnmatch.h> when the system
 # doesn't have one that supports the required API.
-fnmatch.h: fnmatch.in.h $(ARG_NONNULL_H)
+if GL_GENERATE_FNMATCH_H
+fnmatch.h: fnmatch.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
 	      < $(srcdir)/fnmatch.in.h; \
 	} > $@-t && \
 	mv -f $@-t $@
+else
+fnmatch.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
 
 Include:
--- a/modules/fopen	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fopen	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 stdio
-unistd
+unistd          [test $REPLACE_FOPEN = 1]
 
 configure.ac:
 gl_FUNC_FOPEN
--- a/modules/fprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,20 +14,20 @@
 
 Depends-on:
 stdio
-fseterr
-vasnprintf
-isnand-nolibm
-isnanl-nolibm
-frexp-nolibm
-frexpl-nolibm
-printf-frexp
-printf-frexpl
-signbit
-fpucw
 nocrash
 printf-safe
 errno
 multiarch
+fseterr         [test $REPLACE_FPRINTF = 1]
+vasnprintf      [test $REPLACE_FPRINTF = 1]
+isnand-nolibm   [test $REPLACE_FPRINTF = 1]
+isnanl-nolibm   [test $REPLACE_FPRINTF = 1]
+frexp-nolibm    [test $REPLACE_FPRINTF = 1]
+frexpl-nolibm   [test $REPLACE_FPRINTF = 1]
+printf-frexp    [test $REPLACE_FPRINTF = 1]
+printf-frexpl   [test $REPLACE_FPRINTF = 1]
+signbit         [test $REPLACE_FPRINTF = 1]
+fpucw           [test $REPLACE_FPRINTF = 1]
 
 configure.ac:
 gl_FUNC_FPRINTF_POSIX
--- a/modules/freading	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/freading	Fri May 06 08:15:59 2011 -0700
@@ -20,8 +20,7 @@
 "freading.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Eric Blake
-
--- a/modules/frexp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/frexp	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 math
-isnand-nolibm
+isnand-nolibm   [test $gl_func_frexp != yes]
 
 configure.ac:
 gl_FUNC_FREXP
--- a/modules/frexp-nolibm	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/frexp-nolibm	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 math
-isnand-nolibm
+isnand-nolibm   [test $gl_func_frexp_no_libm != yes]
 
 configure.ac:
 gl_FUNC_FREXP_NO_LIBM
--- a/modules/frexpl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/frexpl	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 
 Depends-on:
 math
-isnanl-nolibm
-fpucw
+isnanl-nolibm   [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no]
+fpucw           [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl = no]
 
 configure.ac:
 gl_FUNC_FREXPL
--- a/modules/frexpl-nolibm	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/frexpl-nolibm	Fri May 06 08:15:59 2011 -0700
@@ -9,8 +9,8 @@
 
 Depends-on:
 math
-isnanl-nolibm
-fpucw
+isnanl-nolibm   [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no]
+fpucw           [test $HAVE_DECL_FREXPL = 0 || test $gl_func_frexpl_no_libm = no]
 
 configure.ac:
 gl_FUNC_FREXPL_NO_LIBM
--- a/modules/fseek	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fseek	Fri May 06 08:15:59 2011 -0700
@@ -6,8 +6,8 @@
 m4/fseek.m4
 
 Depends-on:
-fseeko
 stdio
+fseeko          [test $REPLACE_FSEEK = 1]
 
 configure.ac:
 gl_FUNC_FSEEK
--- a/modules/fsusage	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/fsusage	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 m4/fsusage.m4
 
 Depends-on:
-full-read
 stdbool
 stdint
+full-read       [test $gl_cv_fs_space = yes]
 
 configure.ac:
 gl_FSUSAGE
--- a/modules/ftell	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ftell	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/ftell.m4
 
 Depends-on:
-ftello
 stdio
 errno
+ftello          [test $REPLACE_FTELL = 1]
 
 configure.ac:
 gl_FUNC_FTELL
--- a/modules/ftello	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ftello	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 m4/ftello.m4
 
 Depends-on:
+stdio
 extensions
-lseek
-stdio
+lseek           [test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1]
 
 configure.ac-early:
 AC_REQUIRE([AC_FUNC_FSEEKO])
--- a/modules/full-read	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/full-read	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,10 @@
 Files:
 lib/full-read.h
 lib/full-read.c
+lib/full-write.c
 
 Depends-on:
 safe-read
-full-write
 
 configure.ac:
 
--- a/modules/futimens	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/futimens	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 sys_stat
-utimens
 extensions
+utimens         [test $HAVE_FUTIMENS = 0 || test $REPLACE_FUTIMENS = 1]
 
 configure.ac:
 gl_FUNC_FUTIMENS
@@ -23,7 +23,7 @@
 $(LIB_CLOCK_GETTIME)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Eric Blake
--- a/modules/getcwd	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getcwd	Fri May 06 08:15:59 2011 -0700
@@ -8,18 +8,19 @@
 m4/getcwd.m4
 
 Depends-on:
-mempcpy
-d-ino
+unistd
 extensions
-memmove
-openat
-stdbool
-unistd
-malloc-posix
-strdup-posix
+mempcpy         [test $REPLACE_GETCWD = 1]
+d-ino           [test $REPLACE_GETCWD = 1]
+memmove         [test $REPLACE_GETCWD = 1]
+openat          [test $REPLACE_GETCWD = 1]
+stdbool         [test $REPLACE_GETCWD = 1]
+malloc-posix    [test $REPLACE_GETCWD = 1]
+strdup-posix    [test $REPLACE_GETCWD = 1]
 
 configure.ac:
 gl_FUNC_GETCWD
+gl_MODULE_INDICATOR([getcwd])
 gl_UNISTD_MODULE_INDICATOR([getcwd])
 
 Makefile.am:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/getcwd-lgpl	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,25 @@
+Description:
+Ensure getcwd(NULL, 0) returns a buffer allocated by malloc().
+
+Files:
+lib/getcwd-lgpl.c
+m4/getcwd.m4
+
+Depends-on:
+unistd
+strdup          [test $REPLACE_GETCWD = 1]
+
+configure.ac:
+gl_FUNC_GETCWD_LGPL
+gl_UNISTD_MODULE_INDICATOR([getcwd])
+
+Makefile.am:
+
+Include:
+<unistd.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Eric Blake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/getcwd-lgpl-tests	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,12 @@
+Files:
+tests/test-getcwd-lgpl.c
+tests/signature.h
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-getcwd-lgpl
+check_PROGRAMS += test-getcwd-lgpl
--- a/modules/getcwd-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getcwd-tests	Fri May 06 08:15:59 2011 -0700
@@ -1,9 +1,11 @@
 Files:
 tests/test-getcwd.c
-tests/signature.h
-tests/macros.h
 
 Depends-on:
+errno
+fcntl-h
+getcwd-lgpl
+sys_stat
 
 configure.ac:
 
--- a/modules/getdelim	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getdelim	Fri May 06 08:15:59 2011 -0700
@@ -6,11 +6,11 @@
 m4/getdelim.m4
 
 Depends-on:
+stdio
 extensions
-stdio
-stdint
-realloc-posix
-errno
+stdint          [test $HAVE_DECL_GETDELIM = 0 || test $REPLACE_GETDELIM = 1]
+realloc-posix   [test $HAVE_DECL_GETDELIM = 0 || test $REPLACE_GETDELIM = 1]
+errno           [test $HAVE_DECL_GETDELIM = 0 || test $REPLACE_GETDELIM = 1]
 
 configure.ac:
 gl_FUNC_GETDELIM
--- a/modules/getdomainname	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getdomainname	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 Depends-on:
 unistd
 extensions
-netdb
-sys_socket
+netdb           [test $HAVE_DECL_GETDOMAINNAME = 0 || test $REPLACE_GETDOMAINNAME = 1]
+sys_socket      [test $HAVE_DECL_GETDOMAINNAME = 0 || test $REPLACE_GETDOMAINNAME = 1]
 
 configure.ac:
 gl_FUNC_GETDOMAINNAME
--- a/modules/getgroups	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getgroups	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/getgroups.m4
 
 Depends-on:
-malloc-posix
-stdint
 unistd
+malloc-posix    [test $HAVE_GETGROUPS = 0 || test $REPLACE_GETGROUPS = 1]
+stdint          [test $HAVE_GETGROUPS = 0 || test $REPLACE_GETGROUPS = 1]
 
 configure.ac:
 gl_FUNC_GETGROUPS
@@ -20,7 +20,7 @@
 <unistd.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Jim Meyering, Eric Blake
--- a/modules/gethostname	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/gethostname	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 
 Depends-on:
 unistd
-sys_socket
-errno
-sockets
+sys_socket      [test $HAVE_GETHOSTNAME = 0]
+errno           [test $HAVE_GETHOSTNAME = 0]
+sockets         [test $HAVE_GETHOSTNAME = 0]
 
 configure.ac:
 gl_FUNC_GETHOSTNAME
--- a/modules/getline	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getline	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/getline.m4
 
 Depends-on:
+stdio
 extensions
-getdelim
-stdio
+getdelim        [test $REPLACE_GETLINE = 1]
 
 configure.ac:
 gl_FUNC_GETLINE
--- a/modules/getlogin_r	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getlogin_r	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/getlogin_r.m4
 
 Depends-on:
+unistd
 extensions
-unistd
-memchr
+memchr          [test $HAVE_GETLOGIN_R = 0 || test $REPLACE_GETLOGIN_R = 1]
 
 configure.ac:
 gl_FUNC_GETLOGIN_R
--- a/modules/getopt-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getopt-posix	Fri May 06 08:15:59 2011 -0700
@@ -9,11 +9,11 @@
 m4/getopt.m4
 
 Depends-on:
-gettext-h
 unistd
 extensions
 include_next
 arg-nonnull
+gettext-h       [test $GNULIB_UNISTD_H_GETOPT = 1]
 
 configure.ac:
 gl_FUNC_GETOPT_POSIX
@@ -26,7 +26,7 @@
 
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
-getopt.h: getopt.in.h $(ARG_NONNULL_H)
+getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
--- a/modules/getpeername	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getpeername	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/getsockname	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getsockname	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/getsockopt	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getsockopt	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 sys_socket
-sys_time
-errno
+sys_time        [test "$ac_cv_header_winsock2_h" = yes]
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/getsubopt	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getsubopt	Fri May 06 08:15:59 2011 -0700
@@ -6,10 +6,10 @@
 m4/getsubopt.m4
 
 Depends-on:
+stdlib
 extensions
-strchrnul
-stdlib
-memchr
+strchrnul       [test $HAVE_GETSUBOPT = 0]
+memchr          [test $HAVE_GETSUBOPT = 0]
 
 configure.ac:
 gl_FUNC_GETSUBOPT
--- a/modules/gettext	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/gettext	Fri May 06 08:15:59 2011 -0700
@@ -1,6 +1,9 @@
 Description:
 Translate messages to user's native language.
 
+Notice:
+You must add an invocation of AM_GNU_GETTEXT([external]) to configure.ac.
+
 Files:
 m4/codeset.m4
 m4/fcntl-o.m4
--- a/modules/getusershell	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/getusershell	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 Depends-on:
 unistd
 extensions
-fopen-safer
-xalloc
+fopen-safer     [test $ac_cv_func_getusershell = no]
+xalloc          [test $ac_cv_func_getusershell = no]
 
 configure.ac:
 gl_FUNC_GETUSERSHELL
--- a/modules/git-merge-changelog	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/git-merge-changelog	Fri May 06 08:15:59 2011 -0700
@@ -7,6 +7,7 @@
 Depends-on:
 getopt-gnu
 stdbool
+stdlib
 progname
 error
 read-file
--- a/modules/glob	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/glob	Fri May 06 08:15:59 2011 -0700
@@ -9,22 +9,22 @@
 m4/glob.m4
 
 Depends-on:
-alloca
 arg-nonnull
 c++defs
-d-type
-dirfd
 extensions
-fnmatch
-getlogin_r
-memchr
-mempcpy
-stdbool
-strdup
-sys_stat
-unistd
 warn-on-use
-malloc-posix
+alloca          [test -n "$GLOB_H"]
+d-type          [test -n "$GLOB_H"]
+dirfd           [test -n "$GLOB_H"]
+fnmatch         [test -n "$GLOB_H"]
+getlogin_r      [test -n "$GLOB_H"]
+memchr          [test -n "$GLOB_H"]
+mempcpy         [test -n "$GLOB_H"]
+stdbool         [test -n "$GLOB_H"]
+strdup          [test -n "$GLOB_H"]
+sys_stat        [test -n "$GLOB_H"]
+unistd          [test -n "$GLOB_H"]
+malloc-posix    [test -n "$GLOB_H"]
 
 configure.ac:
 gl_GLOB
@@ -37,7 +37,8 @@
 
 # We need the following in order to create <glob.h> when the system
 # doesn't have one that works with the given compiler.
-glob.h: glob.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+if GL_GENERATE_GLOB_H
+glob.h: glob.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
@@ -47,6 +48,10 @@
 	      < $(srcdir)/glob.in.h; \
 	} > $@-t && \
 	mv -f $@-t $@
+else
+glob.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += glob.h glob.h-t
 
 Include:
--- a/modules/gnumakefile	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/gnumakefile	Fri May 06 08:15:59 2011 -0700
@@ -14,9 +14,9 @@
 # builds, so use a shell variable to bypass this.
 GNUmakefile=GNUmakefile
 m4_if(m4_version_compare([2.61a.100],
-	m4_defn([m4_PACKAGE_VERSION])), [1], [],
+        m4_defn([m4_PACKAGE_VERSION])), [1], [],
       [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
-	[GNUmakefile=$GNUmakefile])])
+        [GNUmakefile=$GNUmakefile])])
 
 Makefile.am:
 distclean-local: clean-GNUmakefile
--- a/modules/grantpt	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/grantpt	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 Depends-on:
 stdlib
 extensions
-pt_chown
-waitpid
-configmake
+pt_chown        [test $HAVE_GRANTPT = 0]
+waitpid         [test $HAVE_GRANTPT = 0]
+configmake      [test $HAVE_GRANTPT = 0]
 
 configure.ac:
 gl_FUNC_GRANTPT
--- a/modules/hash	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/hash	Fri May 06 08:15:59 2011 -0700
@@ -1,5 +1,5 @@
 Description:
-Parametrizable hash table.
+Parameterizable hash table.
 
 Files:
 lib/hash.c
@@ -10,7 +10,7 @@
 bitrotate
 stdbool
 stdint
-xalloc
+xalloc-oversized
 
 configure.ac:
 gl_HASH
--- a/modules/hash-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/hash-tests	Fri May 06 08:15:59 2011 -0700
@@ -7,11 +7,9 @@
 inttostr
 progname
 stdbool
-xalloc
 
 configure.ac:
 
 Makefile.am:
 TESTS += test-hash
 check_PROGRAMS += test-hash
-test_hash_LDADD = $(LDADD) @LIBINTL@
--- a/modules/iconv-h	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/iconv-h	Fri May 06 08:15:59 2011 -0700
@@ -22,7 +22,8 @@
 
 # We need the following in order to create <iconv.h> when the system
 # doesn't have one that works with the given compiler.
-iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+if GL_GENERATE_ICONV_H
+iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -40,6 +41,10 @@
 	      < $(srcdir)/iconv.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+iconv.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += iconv.h iconv.h-t
 
 Include:
--- a/modules/iconv_open	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/iconv_open	Fri May 06 08:15:59 2011 -0700
@@ -14,8 +14,8 @@
 gperf
 iconv-h
 iconv
-c-ctype
-c-strcase
+c-ctype         [test $REPLACE_ICONV_OPEN = 1]
+c-strcase       [test $REPLACE_ICONV_OPEN = 1]
 
 configure.ac:
 gl_FUNC_ICONV_OPEN
--- a/modules/iconv_open-utf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/iconv_open-utf	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 
 Depends-on:
 iconv_open
-stdint
-unistr/u8-mbtoucr
-unistr/u8-uctomb
+stdint            [test $REPLACE_ICONV_UTF = 1]
+unistr/u8-mbtoucr [test $REPLACE_ICONV_UTF = 1]
+unistr/u8-uctomb  [test $REPLACE_ICONV_UTF = 1]
 
 configure.ac:
 gl_FUNC_ICONV_OPEN_UTF
--- a/modules/imaxabs	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/imaxabs	Fri May 06 08:15:59 2011 -0700
@@ -6,7 +6,7 @@
 m4/imaxabs.m4
 
 Depends-on:
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_FUNC_IMAXABS
--- a/modules/imaxdiv	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/imaxdiv	Fri May 06 08:15:59 2011 -0700
@@ -6,7 +6,7 @@
 m4/imaxdiv.m4
 
 Depends-on:
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_FUNC_IMAXDIV
--- a/modules/inet_ntop	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/inet_ntop	Fri May 06 08:15:59 2011 -0700
@@ -6,11 +6,11 @@
 m4/inet_ntop.m4
 
 Depends-on:
-sys_socket
 arpa_inet
-errno
-netinet_in
 extensions
+sys_socket      [test "$ac_cv_search_inet_ntop" = no && test $ac_cv_func_inet_ntop = no]
+errno           [test "$ac_cv_search_inet_ntop" = no && test $ac_cv_func_inet_ntop = no]
+netinet_in      [test "$ac_cv_search_inet_ntop" = no && test $ac_cv_func_inet_ntop = no]
 
 configure.ac:
 gl_FUNC_INET_NTOP
--- a/modules/inet_pton	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/inet_pton	Fri May 06 08:15:59 2011 -0700
@@ -6,12 +6,12 @@
 m4/inet_pton.m4
 
 Depends-on:
-c-ctype
-sys_socket
 arpa_inet
-errno
-netinet_in
 extensions
+c-ctype         [test "$ac_cv_search_inet_pton" = no && test $ac_cv_func_inet_pton = no]
+sys_socket      [test "$ac_cv_search_inet_pton" = no && test $ac_cv_func_inet_pton = no]
+errno           [test "$ac_cv_search_inet_pton" = no && test $ac_cv_func_inet_pton = no]
+netinet_in      [test "$ac_cv_search_inet_pton" = no && test $ac_cv_func_inet_pton = no]
 
 configure.ac:
 gl_FUNC_INET_PTON
--- a/modules/inttypes	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/inttypes	Fri May 06 08:15:59 2011 -0700
@@ -2,16 +2,10 @@
 An <inttypes.h> that nearly conforms to C99.
 
 Files:
-lib/inttypes.in.h
 m4/inttypes-pri.m4
-m4/inttypes.m4
 
 Depends-on:
-arg-nonnull
-include_next
-multiarch
-stdint
-warn-on-use
+inttypes-incomplete
 
 configure.ac:
 gl_INTTYPES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/inttypes-incomplete	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,62 @@
+Description:
+An <inttypes.h> that conforms to C99 except for PRI* and SCN* macros.
+
+Files:
+lib/inttypes.in.h
+m4/inttypes.m4
+
+Depends-on:
+arg-nonnull
+include_next
+multiarch
+stdint
+warn-on-use
+
+configure.ac:
+gl_INTTYPES_INCOMPLETE
+
+Makefile.am:
+BUILT_SOURCES += inttypes.h
+
+# We need the following in order to create <inttypes.h> when the system
+# doesn't have one that works with the given compiler.
+inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+	  sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
+	      -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+	      -e 's|@''NEXT_INTTYPES_H''@|$(NEXT_INTTYPES_H)|g' \
+	      -e 's/@''PRI_MACROS_BROKEN''@/$(PRI_MACROS_BROKEN)/g' \
+	      -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \
+	      -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \
+	      -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \
+	      -e 's/@''PRIPTR_PREFIX''@/$(PRIPTR_PREFIX)/g' \
+	      -e 's/@''GNULIB_IMAXABS''@/$(GNULIB_IMAXABS)/g' \
+	      -e 's/@''GNULIB_IMAXDIV''@/$(GNULIB_IMAXDIV)/g' \
+	      -e 's/@''GNULIB_STRTOIMAX''@/$(GNULIB_STRTOIMAX)/g' \
+	      -e 's/@''GNULIB_STRTOUMAX''@/$(GNULIB_STRTOUMAX)/g' \
+	      -e 's/@''HAVE_DECL_IMAXABS''@/$(HAVE_DECL_IMAXABS)/g' \
+	      -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
+	      -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
+	      -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
+	      -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
+	      -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
+	      -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
+	      -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \
+	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+	      < $(srcdir)/inttypes.in.h; \
+	} > $@-t && \
+	mv $@-t $@
+MOSTLYCLEANFILES += inttypes.h inttypes.h-t
+
+Include:
+<inttypes.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
--- a/modules/ioctl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ioctl	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,9 @@
 
 Depends-on:
 sys_ioctl
-sys_socket
-errno
+sys_socket      [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_IOCTL = 1]
+errno           [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_IOCTL = 1]
+fd-hook         [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_IOCTL = 1]
 
 configure.ac:
 gl_FUNC_IOCTL
--- a/modules/isapipe	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/isapipe	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 m4/isapipe.m4
 
 Depends-on:
-stdbool
-sys_stat
-unistd
+stdbool         [test $ac_cv_func_isapipe = no]
+sys_stat        [test $ac_cv_func_isapipe = no]
+unistd          [test $ac_cv_func_isapipe = no]
 
 configure.ac:
 gl_ISAPIPE
--- a/modules/isfinite	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/isfinite	Fri May 06 08:15:59 2011 -0700
@@ -7,11 +7,11 @@
 m4/check-math-lib.m4
 
 Depends-on:
-isnanf-nolibm
-isnand-nolibm
-isnanl-nolibm
 math
 extensions
+isnanf-nolibm   [test $REPLACE_ISFINITE = 1]
+isnand-nolibm   [test $REPLACE_ISFINITE = 1]
+isnanl-nolibm   [test $REPLACE_ISFINITE = 1]
 
 configure.ac:
 gl_ISFINITE
@@ -23,7 +23,7 @@
 <math.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Ben Pfaff
--- a/modules/isinf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/isinf	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 m4/check-math-lib.m4
 
 Depends-on:
-float
 math
 extensions
+float           [test $REPLACE_ISINF = 1]
 
 configure.ac:
 gl_ISINF
--- a/modules/langinfo	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/langinfo	Fri May 06 08:15:59 2011 -0700
@@ -21,7 +21,7 @@
 
 # We need the following in order to create an empty placeholder for
 # <langinfo.h> when the system doesn't have one.
-langinfo.h: langinfo.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \
--- a/modules/lchown	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/lchown	Fri May 06 08:15:59 2011 -0700
@@ -6,12 +6,12 @@
 m4/lchown.m4
 
 Depends-on:
-chown
-errno
-lstat
-stdbool
-sys_stat
 unistd
+chown           [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
+errno           [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
+lstat           [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
+stdbool         [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
+sys_stat        [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
 
 configure.ac:
 gl_FUNC_LCHOWN
--- a/modules/ldexpl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ldexpl	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 math
-isnanl
-fpucw
+isnanl          [test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no]
+fpucw           [test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no]
 
 configure.ac:
 gl_FUNC_LDEXPL
--- a/modules/link	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/link	Fri May 06 08:15:59 2011 -0700
@@ -6,10 +6,10 @@
 m4/link.m4
 
 Depends-on:
-stat
-strdup-posix
-sys_stat
 unistd
+stat            [test $HAVE_LINK = 0 || test $REPLACE_LINK = 1]
+strdup-posix    [test $HAVE_LINK = 0 || test $REPLACE_LINK = 1]
+sys_stat        [test $HAVE_LINK = 0 || test $REPLACE_LINK = 1]
 
 configure.ac:
 gl_FUNC_LINK
--- a/modules/linkat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/linkat	Fri May 06 08:15:59 2011 -0700
@@ -7,23 +7,24 @@
 m4/linkat.m4
 
 Depends-on:
-areadlink
-areadlinkat
-dirname-lgpl
-errno
+unistd
 extensions
-fcntl-h
-filenamecat-lgpl
-openat
-link
-link-follow
-lstat
-readlink
-same-inode
-stpcpy
-symlink
-symlinkat
-unistd
+areadlink        [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+areadlinkat      [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+dirname-lgpl     [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+errno            [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+fcntl-h          [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+filenamecat-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+getcwd-lgpl      [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+openat           [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+link             [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+link-follow      [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+lstat            [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+readlink         [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+same-inode       [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+stpcpy           [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+symlink          [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+symlinkat        [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
 
 configure.ac:
 gl_FUNC_LINKAT
--- a/modules/linkat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/linkat-tests	Fri May 06 08:15:59 2011 -0700
@@ -7,14 +7,13 @@
 Depends-on:
 ignore-value
 areadlink-with-size
-filenamecat
+filenamecat-lgpl
+getcwd-lgpl
 progname
 same-inode
-xgetcwd
 
 configure.ac:
 
 Makefile.am:
 TESTS += test-linkat
 check_PROGRAMS += test-linkat
-test_linkat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/listen	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/listen	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/locale	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/locale	Fri May 06 08:15:59 2011 -0700
@@ -23,7 +23,7 @@
 
 # We need the following in order to create <locale.h> when the system
 # doesn't have one that provides all definitions.
-locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
--- a/modules/logl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/logl	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 Depends-on:
 math
 extensions
-frexpl
-isnanl
-floorl
+frexpl          [test $HAVE_LOGL = 0]
+isnanl          [test $HAVE_LOGL = 0]
+floorl          [test $HAVE_LOGL = 0]
 
 configure.ac:
 gl_FUNC_LOGL
@@ -25,7 +25,7 @@
 $(LOGL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- a/modules/long-options	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/long-options	Fri May 06 08:15:59 2011 -0700
@@ -8,6 +8,7 @@
 
 Depends-on:
 getopt-gnu
+stdlib
 version-etc
 
 configure.ac:
--- a/modules/lstat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/lstat	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/lstat.m4
 
 Depends-on:
-dosname
-stat
 sys_stat
+dosname         [test $REPLACE_LSTAT = 1]
+stat            [test $REPLACE_LSTAT = 1]
 
 configure.ac:
 gl_FUNC_LSTAT
--- a/modules/math	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/math	Fri May 06 08:15:59 2011 -0700
@@ -21,7 +21,7 @@
 
 # We need the following in order to create <math.h> when the system
 # doesn't have one that works with the given compiler.
-math.h: math.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \
--- a/modules/mbrlen	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mbrlen	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 
 Depends-on:
 wchar
-mbrtowc
 extensions
+mbrtowc         [test $HAVE_MBRLEN = 0 || test $REPLACE_MBRLEN = 1]
 
 configure.ac:
 gl_FUNC_MBRLEN
--- a/modules/mbrtowc	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mbrtowc	Fri May 06 08:15:59 2011 -0700
@@ -12,11 +12,11 @@
 
 Depends-on:
 wchar
-mbsinit
-localcharset
-streq
-verify
 extensions
+mbsinit         [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
+localcharset    [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
+streq           [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
+verify          [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]
 
 configure.ac:
 gl_FUNC_MBRTOWC
--- a/modules/mbsinit	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mbsinit	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 
 Depends-on:
 wchar
-mbrtowc
-verify
 extensions
+mbrtowc         [test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1]
+verify          [test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1]
 
 configure.ac:
 gl_FUNC_MBSINIT
--- a/modules/mbsnrtowcs	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mbsnrtowcs	Fri May 06 08:15:59 2011 -0700
@@ -9,11 +9,11 @@
 m4/mbstate_t.m4
 
 Depends-on:
+wchar
 extensions
-wchar
-mbrtowc
-minmax
-strnlen1
+mbrtowc         [test $HAVE_MBSNRTOWCS = 0 || test $REPLACE_MBSNRTOWCS = 1]
+minmax          [test $HAVE_MBSNRTOWCS = 0 || test $REPLACE_MBSNRTOWCS = 1]
+strnlen1        [test $HAVE_MBSNRTOWCS = 0 || test $REPLACE_MBSNRTOWCS = 1]
 
 configure.ac:
 gl_FUNC_MBSNRTOWCS
--- a/modules/mbsrtowcs	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mbsrtowcs	Fri May 06 08:15:59 2011 -0700
@@ -14,9 +14,9 @@
 
 Depends-on:
 wchar
-mbrtowc
-strnlen1
 extensions
+mbrtowc         [test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1]
+strnlen1        [test $HAVE_MBSRTOWCS = 0 || test $REPLACE_MBSRTOWCS = 1]
 
 configure.ac:
 gl_FUNC_MBSRTOWCS
--- a/modules/mbtowc	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mbtowc	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 
 Depends-on:
 stdlib
-mbrtowc
-wchar
+mbrtowc         [test $REPLACE_MBTOWC = 1]
+wchar           [test $REPLACE_MBTOWC = 1]
 
 configure.ac:
 gl_FUNC_MBTOWC
--- a/modules/memchr	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/memchr	Fri May 06 08:15:59 2011 -0700
@@ -10,6 +10,7 @@
 Depends-on:
 extensions
 string
+memchr-obsolete
 
 configure.ac:
 gl_FUNC_MEMCHR
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/memchr-obsolete	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,28 @@
+Description:
+memchr() function for old platforms.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+m4/memchr-obsolete.m4
+
+Depends-on:
+memchr
+
+configure.ac:
+gl_FUNC_MEMCHR_OBSOLETE
+
+Makefile.am:
+
+Include:
+<string.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
--- a/modules/memcmp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/memcmp	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,7 @@
 m4/memcmp.m4
 
 Depends-on:
-stdint
+stdint          [test $ac_cv_func_memcmp_working = no]
 
 configure.ac:
 gl_FUNC_MEMCMP
--- a/modules/mgetgroups	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mgetgroups	Fri May 06 08:15:59 2011 -0700
@@ -10,7 +10,7 @@
 getgroups
 getugroups
 realloc-gnu
-xalloc
+xalloc-oversized
 
 configure.ac:
 gl_MGETGROUPS
--- a/modules/mkdir	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkdir	Fri May 06 08:15:59 2011 -0700
@@ -6,8 +6,8 @@
 m4/mkdir.m4
 
 Depends-on:
-dirname-lgpl
 sys_stat
+dirname-lgpl    [test $REPLACE_MKDIR = 1]
 
 configure.ac:
 gl_FUNC_MKDIR
--- a/modules/mkdtemp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkdtemp	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/mkdtemp.m4
 
 Depends-on:
-stdint
 stdlib
-tempname
+stdint          [test $HAVE_MKDTEMP = 0]
+tempname        [test $HAVE_MKDTEMP = 0]
 
 configure.ac:
 gt_FUNC_MKDTEMP
--- a/modules/mkfifo	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkfifo	Fri May 06 08:15:59 2011 -0700
@@ -6,8 +6,8 @@
 m4/mkfifo.m4
 
 Depends-on:
-stat
 sys_stat
+stat            [test $HAVE_MKFIFO = 0 || test $REPLACE_MKFIFO = 1]
 
 configure.ac:
 gl_FUNC_MKFIFO
--- a/modules/mkfifoat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkfifoat	Fri May 06 08:15:59 2011 -0700
@@ -7,12 +7,12 @@
 m4/mkfifoat.m4
 
 Depends-on:
+sys_stat
 extensions
 fcntl-h
-mkfifo
-mknod
-openat
-sys_stat
+mkfifo          [test $HAVE_MKFIFOAT = 0]
+mknod           [test $HAVE_MKNODAT = 0]
+openat          [test $HAVE_MKFIFOAT = 0 || test $HAVE_MKNODAT = 0]
 
 configure.ac:
 gl_FUNC_MKFIFOAT
--- a/modules/mkfifoat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkfifoat-tests	Fri May 06 08:15:59 2011 -0700
@@ -13,4 +13,3 @@
 Makefile.am:
 TESTS += test-mkfifoat
 check_PROGRAMS += test-mkfifoat
-test_mkfifoat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/mknod	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mknod	Fri May 06 08:15:59 2011 -0700
@@ -6,10 +6,10 @@
 m4/mknod.m4
 
 Depends-on:
-mkfifo
-stat
 sys_stat
 extensions
+mkfifo          [test $HAVE_MKNOD = 0 || test $REPLACE_MKNOD = 1]
+stat            [test $HAVE_MKNOD = 0 || test $REPLACE_MKNOD = 1]
 
 configure.ac:
 gl_FUNC_MKNOD
--- a/modules/mkostemp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkostemp	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 m4/mkostemp.m4
 
 Depends-on:
+stdlib
 extensions
-stdlib
-tempname
+tempname        [test $HAVE_MKOSTEMP = 0]
 
 configure.ac:
 gl_FUNC_MKOSTEMP
--- a/modules/mkostemps	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkostemps	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 m4/mkostemps.m4
 
 Depends-on:
+stdlib
 extensions
-stdlib
-tempname
+tempname        [test $HAVE_MKOSTEMPS = 0]
 
 configure.ac:
 gl_FUNC_MKOSTEMPS
--- a/modules/mkstemp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkstemp	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/mkstemp.m4
 
 Depends-on:
+stdlib
 extensions
-stdlib
-tempname
+tempname        [test $HAVE_MKSTEMP = 0 || test $REPLACE_MKSTEMP = 1]
 
 configure.ac:
 gl_FUNC_MKSTEMP
--- a/modules/mkstemps	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mkstemps	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/mkstemps.m4
 
 Depends-on:
+stdlib
 extensions
-stdlib
-tempname
+tempname        [test $HAVE_MKSTEMPS = 0]
 
 configure.ac:
 gl_FUNC_MKSTEMPS
--- a/modules/mktime	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/mktime	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 multiarch
-time_r
+time_r          [test $REPLACE_MKTIME = 1]
 
 configure.ac:
 gl_FUNC_MKTIME
--- a/modules/nanosleep	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/nanosleep	Fri May 06 08:15:59 2011 -0700
@@ -6,16 +6,16 @@
 m4/nanosleep.m4
 
 Depends-on:
+time
 extensions
-intprops
 multiarch
-select
-sigaction
-stdbool
-sys_select
-sys_time
-time
-verify
+intprops        [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
+select          [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
+sigaction       [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
+stdbool         [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
+sys_select      [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
+sys_time        [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
+verify          [test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1]
 
 configure.ac:
 gl_FUNC_NANOSLEEP
@@ -30,7 +30,7 @@
 $(LIB_NANOSLEEP)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Jim Meyering
--- a/modules/netdb	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/netdb	Fri May 06 08:15:59 2011 -0700
@@ -6,6 +6,7 @@
 m4/netdb_h.m4
 
 Depends-on:
+c++defs
 include_next
 arg-nonnull
 warn-on-use
@@ -21,7 +22,7 @@
 
 # We need the following in order to create <netdb.h> when the system
 # doesn't have one that works with the given compiler.
-netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+netdb.h: netdb.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -35,6 +36,8 @@
 	      -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
 	      -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
 	      -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
+	      -e 's|@''REPLACE_GAI_STRERROR''@|$(REPLACE_GAI_STRERROR)|g' \
+	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
 	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
 	      < $(srcdir)/netdb.in.h; \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/netdb-c++-tests	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,19 @@
+Files:
+tests/test-netdb-c++.cc
+tests/signature.h
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-netdb-c++
+check_PROGRAMS += test-netdb-c++
+test_netdb_c___SOURCES = test-netdb-c++.cc
+test_netdb_c___LDADD = $(LDADD) $(GETADDRINFO_LIB)
+endif
--- a/modules/netdb-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/netdb-tests	Fri May 06 08:15:59 2011 -0700
@@ -2,6 +2,7 @@
 tests/test-netdb.c
 
 Depends-on:
+netdb-c++-tests
 
 configure.ac:
 
--- a/modules/netinet_in	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/netinet_in	Fri May 06 08:15:59 2011 -0700
@@ -21,7 +21,8 @@
 
 # We need the following in order to create <netinet/in.h> when the system
 # doesn't have one.
-netinet/in.h: netinet_in.in.h
+if GL_GENERATE_NETINET_IN_H
+netinet/in.h: netinet_in.in.h $(top_builddir)/config.status
 	$(AM_V_at)$(MKDIR_P) netinet
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -33,6 +34,10 @@
 	      < $(srcdir)/netinet_in.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+netinet/in.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
 MOSTLYCLEANDIRS += netinet
 
--- a/modules/nonblocking	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/nonblocking	Fri May 06 08:15:59 2011 -0700
@@ -2,16 +2,33 @@
 Read, set or clear the non-blocking file descriptor flag.
 
 Files:
+lib/nonblocking.h
 lib/nonblocking.c
-lib/nonblocking.h
+m4/nonblocking.m4
+lib/stdio-read.c
+lib/stdio-write.c
+m4/asm-underscore.m4
 
 Depends-on:
 fcntl-h
 ioctl
 stdbool
+stdio
 sys_socket
+unistd
 
 configure.ac:
+gl_NONBLOCKING_IO
+gl_FCNTL_MODULE_INDICATOR([nonblocking])
+dnl Define the C macro GNULIB_NONBLOCKING to 1.
+gl_MODULE_INDICATOR([nonblocking])
+dnl Define the substituted variable GNULIB_STDIO_H_NONBLOCKING to 1.
+AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+AC_REQUIRE([gl_ASM_SYMBOL_PREFIX])
+GNULIB_STDIO_H_NONBLOCKING=1
+dnl Define the substituted variable GNULIB_UNISTD_H_NONBLOCKING to 1.
+AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+GNULIB_UNISTD_H_NONBLOCKING=1
 
 Makefile.am:
 lib_SOURCES += nonblocking.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/nonblocking-pipe-tests	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,34 @@
+Files:
+tests/test-nonblocking-pipe.sh
+tests/test-nonblocking-pipe-main.c
+tests/test-nonblocking-pipe-child.c
+tests/test-nonblocking-pipe.h
+tests/test-nonblocking-writer.h
+tests/test-nonblocking-reader.h
+tests/test-nonblocking-misc.h
+tests/macros.h
+
+Depends-on:
+stdbool
+unistd
+nonblocking
+wait-process
+pipe-posix
+dup2
+environ
+posix_spawnp
+binary-io
+gettimeofday
+snprintf
+vsnprintf
+strerror
+ssize_t
+usleep
+read
+write
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-nonblocking-pipe.sh
+check_PROGRAMS += test-nonblocking-pipe-main test-nonblocking-pipe-child
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/nonblocking-socket-tests	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,46 @@
+Files:
+tests/test-nonblocking-socket.sh
+tests/test-nonblocking-socket-main.c
+tests/test-nonblocking-socket-child.c
+tests/test-nonblocking-socket.h
+tests/test-nonblocking-writer.h
+tests/test-nonblocking-reader.h
+tests/test-nonblocking-misc.h
+tests/socket-server.h
+tests/socket-client.h
+tests/macros.h
+
+Depends-on:
+stdbool
+unistd
+sys_socket
+nonblocking
+wait-process
+environ
+posix_spawnp
+netinet_in
+arpa_inet
+socket
+setsockopt
+bind
+getsockname
+listen
+accept
+getsockopt
+connect
+gettimeofday
+snprintf
+vsnprintf
+strerror
+ssize_t
+usleep
+read
+write
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-nonblocking-socket.sh
+check_PROGRAMS += test-nonblocking-socket-main test-nonblocking-socket-child
+test_nonblocking_socket_main_LDADD = $(LDADD) $(LIBSOCKET)
+test_nonblocking_socket_child_LDADD = $(LDADD) $(LIBSOCKET)
--- a/modules/nonblocking-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/nonblocking-tests	Fri May 06 08:15:59 2011 -0700
@@ -5,11 +5,12 @@
 Depends-on:
 close
 pipe-posix
-socket
+nonblocking-pipe-tests
+nonblocking-socket-tests
 
 configure.ac:
 
 Makefile.am:
 TESTS += test-nonblocking
 check_PROGRAMS += test-nonblocking
-test_nonblocking_LDADD = $(LDADD) @LIBSOCKET@
+test_nonblocking_LDADD = $(LDADD) $(LIBSOCKET)
--- a/modules/obstack	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/obstack	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 
 Depends-on:
 gettext-h
-exit
 exitfail
 stdint
+stdlib
 
 configure.ac:
 AC_FUNC_OBSTACK
--- a/modules/open	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/open	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 fcntl-h
-stat
+stat            [test $REPLACE_OPEN = 1]
 
 configure.ac:
 gl_FUNC_OPEN
--- a/modules/openat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/openat	Fri May 06 08:15:59 2011 -0700
@@ -24,18 +24,18 @@
 fdopendir
 gettext-h
 intprops
-lchown
+lchown          [test $HAVE_FCHOWNAT = 0 || test $REPLACE_FCHOWNAT = 1]
 lstat
-mkdir
+mkdir           [test $HAVE_MKDIRAT = 0]
 open
 openat-die
-rmdir
+rmdir           [test $REPLACE_UNLINKAT = 1]
 same-inode
 save-cwd
 stdbool
 sys_stat
 unistd
-unlink
+unlink          [test $REPLACE_UNLINKAT = 1]
 
 configure.ac:
 gl_FUNC_OPENAT
--- a/modules/openat-safer-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/openat-safer-tests	Fri May 06 08:15:59 2011 -0700
@@ -9,4 +9,3 @@
 Makefile.am:
 TESTS += test-openat-safer
 check_PROGRAMS += test-openat-safer
-test_openat_safer_LDADD = $(LDADD) @LIBINTL@
--- a/modules/openat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/openat-tests	Fri May 06 08:15:59 2011 -0700
@@ -31,8 +31,3 @@
 TESTS += test-fchownat test-fstatat test-mkdirat test-openat test-unlinkat
 check_PROGRAMS += test-fchownat test-fstatat test-mkdirat test-openat \
   test-unlinkat
-test_fchownat_LDADD = $(LDADD) @LIBINTL@
-test_fstatat_LDADD = $(LDADD) @LIBINTL@
-test_mkdirat_LDADD = $(LDADD) @LIBINTL@
-test_openat_LDADD = $(LDADD) @LIBINTL@
-test_unlinkat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/pagealign_alloc	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pagealign_alloc	Fri May 06 08:15:59 2011 -0700
@@ -9,10 +9,10 @@
 
 Depends-on:
 error
-exit
 extensions
 getpagesize
 gettext-h
+stdlib
 xalloc
 unistd
 
--- a/modules/passfd	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/passfd	Fri May 06 08:15:59 2011 -0700
@@ -4,17 +4,15 @@
 Files:
 lib/passfd.h
 lib/passfd.c
-m4/afunix.m4
-m4/sockpfaf.m4
+m4/passfd.m4
 
 Depends-on:
 cloexec
 sys_socket
 socketlib
-extensions
 
 configure.ac:
-gl_SOCKET_AFUNIX
+gl_PASSFD
 
 Makefile.am:
 lib_SOURCES += passfd.c
--- a/modules/passfd-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/passfd-tests	Fri May 06 08:15:59 2011 -0700
@@ -3,9 +3,11 @@
 tests/macros.h
 
 Depends-on:
+sys_wait
 
 configure.ac:
 AC_CHECK_DECLS_ONCE([alarm])
+AC_CHECK_FUNCS_ONCE([socketpair])
 
 Makefile.am:
 TESTS += test-passfd
--- a/modules/perror	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/perror	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 stdio
-errno
-strerror
+errno           [test $REPLACE_PERROR = 1]
+strerror        [test $REPLACE_PERROR = 1]
 
 configure.ac:
 gl_FUNC_PERROR
--- a/modules/pipe-filter-gi	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pipe-filter-gi	Fri May 06 08:15:59 2011 -0700
@@ -10,10 +10,11 @@
 spawn-pipe
 wait-process
 error
-exit
+fcntl-h
 gettext-h
 stdbool
 stdint
+stdlib
 sys_select
 unistd
 
--- a/modules/pipe-filter-ii	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pipe-filter-ii	Fri May 06 08:15:59 2011 -0700
@@ -10,10 +10,11 @@
 spawn-pipe
 wait-process
 error
-exit
+fcntl-h
 gettext-h
 stdbool
 stdint
+stdlib
 sys_select
 unistd
 
--- a/modules/pipe2	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pipe2	Fri May 06 08:15:59 2011 -0700
@@ -10,6 +10,7 @@
 fcntl-h
 binary-io
 extensions
+nonblocking
 
 configure.ac:
 gl_FUNC_PIPE2
@@ -22,7 +23,7 @@
 <unistd.h>
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible, Eric Blake
--- a/modules/pipe2-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pipe2-tests	Fri May 06 08:15:59 2011 -0700
@@ -11,3 +11,4 @@
 Makefile.am:
 TESTS += test-pipe2
 check_PROGRAMS += test-pipe2
+test_pipe2_LDADD = $(LDADD) $(LIBSOCKET)
--- a/modules/poll	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/poll	Fri May 06 08:15:59 2011 -0700
@@ -7,11 +7,11 @@
 
 Depends-on:
 poll-h
-alloca
-select
-sys_select
-sys_time
-errno
+alloca          [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
+select          [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
+sys_select      [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
+sys_time        [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
+errno           [test $HAVE_POLL = 0 || test $REPLACE_POLL = 1]
 
 configure.ac:
 gl_FUNC_POLL
--- a/modules/poll-h	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/poll-h	Fri May 06 08:15:59 2011 -0700
@@ -21,7 +21,7 @@
 
 # We need the following in order to create <poll.h> when the system
 # doesn't have one.
-poll.h: poll.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+poll.h: poll.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_POLL_H''@|$(HAVE_POLL_H)|g' \
--- a/modules/popen	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/popen	Fri May 06 08:15:59 2011 -0700
@@ -6,8 +6,8 @@
 m4/popen.m4
 
 Depends-on:
-open
 stdio
+open            [test $REPLACE_POPEN = 1]
 
 configure.ac:
 gl_FUNC_POPEN
--- a/modules/posix_spawn	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawn	Fri May 06 08:15:59 2011 -0700
@@ -7,12 +7,11 @@
 
 Depends-on:
 spawn
-posix_spawn-internal
+posix_spawn-internal [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1]
 
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawn])
   gl_POSIX_SPAWN_INTERNAL
 fi
--- a/modules/posix_spawn_file_actions_addclose	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawn_file_actions_addclose	Fri May 06 08:15:59 2011 -0700
@@ -9,12 +9,11 @@
 
 Depends-on:
 spawn
-getdtablesize
+getdtablesize   [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1]
 
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawn_faction_addclose])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_addclose])
--- a/modules/posix_spawn_file_actions_adddup2	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawn_file_actions_adddup2	Fri May 06 08:15:59 2011 -0700
@@ -9,12 +9,11 @@
 
 Depends-on:
 spawn
-getdtablesize
+getdtablesize   [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1]
 
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawn_faction_adddup2])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_adddup2])
--- a/modules/posix_spawn_file_actions_addopen	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawn_file_actions_addopen	Fri May 06 08:15:59 2011 -0700
@@ -9,12 +9,11 @@
 
 Depends-on:
 spawn
-getdtablesize
+getdtablesize   [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1]
 
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawn_faction_addopen])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_addopen])
--- a/modules/posix_spawn_file_actions_destroy	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawn_file_actions_destroy	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawn_faction_destroy])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_destroy])
--- a/modules/posix_spawn_file_actions_init	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawn_file_actions_init	Fri May 06 08:15:59 2011 -0700
@@ -13,7 +13,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawn_faction_init])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawn_file_actions_init])
--- a/modules/posix_spawnattr_destroy	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_destroy	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_destroy])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_destroy])
--- a/modules/posix_spawnattr_getflags	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_getflags	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_getflags])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getflags])
--- a/modules/posix_spawnattr_getpgroup	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_getpgroup	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_getpgroup])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getpgroup])
--- a/modules/posix_spawnattr_getschedparam	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_getschedparam	Fri May 06 08:15:59 2011 -0700
@@ -14,7 +14,6 @@
 if test $HAVE_POSIX_SPAWN = 0 \
    || test $REPLACE_POSIX_SPAWN = 1 \
    || test $gl_cv_func_spawnattr_setschedparam = no; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_getschedparam])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getschedparam])
--- a/modules/posix_spawnattr_getschedpolicy	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_getschedpolicy	Fri May 06 08:15:59 2011 -0700
@@ -14,7 +14,6 @@
 if test $HAVE_POSIX_SPAWN = 0 \
    || test $REPLACE_POSIX_SPAWN = 1 \
    || test $gl_cv_func_spawnattr_setschedpolicy = no; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_getschedpolicy])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getschedpolicy])
--- a/modules/posix_spawnattr_getsigdefault	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_getsigdefault	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_getdefault])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getsigdefault])
--- a/modules/posix_spawnattr_getsigmask	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_getsigmask	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_getsigmask])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_getsigmask])
--- a/modules/posix_spawnattr_init	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_init	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_init])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_init])
--- a/modules/posix_spawnattr_setflags	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_setflags	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_setflags])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setflags])
--- a/modules/posix_spawnattr_setpgroup	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_setpgroup	Fri May 06 08:15:59 2011 -0700
@@ -11,7 +11,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_setpgroup])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setpgroup])
--- a/modules/posix_spawnattr_setschedparam	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_setschedparam	Fri May 06 08:15:59 2011 -0700
@@ -14,7 +14,6 @@
 if test $HAVE_POSIX_SPAWN = 0 \
    || test $REPLACE_POSIX_SPAWN = 1 \
    || test $gl_cv_func_spawnattr_setschedparam = no; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_setschedparam])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setschedparam])
--- a/modules/posix_spawnattr_setschedpolicy	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_setschedpolicy	Fri May 06 08:15:59 2011 -0700
@@ -14,7 +14,6 @@
 if test $HAVE_POSIX_SPAWN = 0 \
    || test $REPLACE_POSIX_SPAWN = 1 \
    || test $gl_cv_func_spawnattr_setschedpolicy = no; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_setschedpolicy])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setschedpolicy])
--- a/modules/posix_spawnattr_setsigdefault	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_setsigdefault	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_setdefault])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setsigdefault])
--- a/modules/posix_spawnattr_setsigmask	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnattr_setsigmask	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnattr_setsigmask])
 fi
 gl_SPAWN_MODULE_INDICATOR([posix_spawnattr_setsigmask])
--- a/modules/posix_spawnp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/posix_spawnp	Fri May 06 08:15:59 2011 -0700
@@ -7,12 +7,11 @@
 
 Depends-on:
 spawn
-posix_spawn-internal
+posix_spawn-internal [test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1]
 
 configure.ac:
 gl_POSIX_SPAWN
 if test $HAVE_POSIX_SPAWN = 0 || test $REPLACE_POSIX_SPAWN = 1; then
-  gl_REPLACE_SPAWN_H
   AC_LIBOBJ([spawnp])
   gl_POSIX_SPAWN_INTERNAL
 fi
--- a/modules/pread	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pread	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,10 @@
 m4/pread.m4
 
 Depends-on:
+unistd
 extensions
-lseek
-unistd
+lseek           [test $HAVE_PREAD = 0 || test $REPLACE_PREAD = 1]
+read            [test $HAVE_PREAD = 0 || test $REPLACE_PREAD = 1]
 
 configure.ac:
 gl_FUNC_PREAD
--- a/modules/printf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/printf-posix	Fri May 06 08:15:59 2011 -0700
@@ -15,8 +15,8 @@
 
 Depends-on:
 stdio
-vfprintf-posix
 printf-safe
+vfprintf-posix  [test $REPLACE_PRINTF = 1]
 
 configure.ac:
 gl_FUNC_PRINTF_POSIX
--- a/modules/pt_chown	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pt_chown	Fri May 06 08:15:59 2011 -0700
@@ -7,6 +7,7 @@
 
 Depends-on:
 ptsname
+stdlib
 
 configure.ac:
 
--- a/modules/pthread	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pthread	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,8 @@
 
 # We need the following in order to create <pthread.h> when the system
 # doesn't have one that works with the given compiler.
-pthread.h: pthread.in.h
+if GL_GENERATE_PTHREAD_H
+pthread.h: pthread.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_PTHREAD_H''@|$(HAVE_PTHREAD_H)|g' \
@@ -33,6 +34,10 @@
 	      < $(srcdir)/pthread.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+pthread.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += pthread.h pthread.h-t
 
 Include:
--- a/modules/ptsname	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/ptsname	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 Depends-on:
 stdlib
 extensions
-ttyname_r
+ttyname_r       [test $HAVE_PTSNAME = 0]
 
 configure.ac:
 gl_FUNC_PTSNAME
--- a/modules/pty	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pty	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,7 @@
 
 # We need the following in order to create <pty.h> when the system
 # doesn't have one that works with the given compiler.
-pty.h: pty.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+pty.h: pty.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_PTY_H''@|$(HAVE_PTY_H)|g' \
--- a/modules/putenv	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/putenv	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 stdlib
-malloc-posix
+malloc-posix    [test $REPLACE_PUTENV = 1]
 
 configure.ac:
 gl_FUNC_PUTENV
--- a/modules/pwrite	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/pwrite	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,10 @@
 m4/pwrite.m4
 
 Depends-on:
+unistd
 extensions
-lseek
-unistd
+lseek           [test $HAVE_PWRITE = 0 || test $REPLACE_PWRITE = 1]
+write           [test $HAVE_PWRITE = 0 || test $REPLACE_PWRITE = 1]
 
 configure.ac:
 gl_FUNC_PWRITE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/read	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,24 @@
+Description:
+POSIX compatible read() function: read data from a file descriptor
+
+Files:
+lib/read.c
+m4/read.m4
+
+Depends-on:
+unistd
+
+configure.ac:
+gl_FUNC_READ
+gl_UNISTD_MODULE_INDICATOR([read])
+
+Makefile.am:
+
+Include:
+<unistd.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
--- a/modules/readline	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/readline	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 m4/readline.m4
 
 Depends-on:
-getline
 havelib
+getline         [test "$gl_cv_lib_readline" = no]
 
 configure.ac:
 gl_FUNC_READLINE
--- a/modules/readlink	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/readlink	Fri May 06 08:15:59 2011 -0700
@@ -6,8 +6,8 @@
 m4/readlink.m4
 
 Depends-on:
-stat
 unistd
+stat            [test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1]
 
 configure.ac:
 gl_FUNC_READLINK
--- a/modules/readlinkat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/readlinkat	Fri May 06 08:15:59 2011 -0700
@@ -6,11 +6,11 @@
 m4/readlinkat.m4
 
 Depends-on:
+unistd
 extensions
 fcntl-h
-openat
-readlink
-unistd
+openat          [test $HAVE_READLINKAT = 0]
+readlink        [test $HAVE_READLINKAT = 0]
 
 configure.ac:
 gl_FUNC_READLINKAT
--- a/modules/readlinkat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/readlinkat-tests	Fri May 06 08:15:59 2011 -0700
@@ -13,4 +13,3 @@
 Makefile.am:
 TESTS += test-readlinkat
 check_PROGRAMS += test-readlinkat
-test_readlinkat_LDADD = $(LDADD) @LIBINTL@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/readme-release	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,31 @@
+Description:
+Add release instructions customized for the package.
+
+You should add a line like
+
+perl -pi -e "s/\@PACKAGE\@/$package/g" README-release
+
+to autogen.sh or bootstrap.conf's epilogue function to patch the
+package name in.  This is particularly handy for making various URLs
+copy-and-pastable.
+
+Note that, as with any gnulib-tool supplied file, README-release can
+be customized via a .diff file.  This is an easy way to add
+package-specific instructions.
+
+Files:
+top/README-release
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+
+License:
+GPLed build tool
+
+Maintainer:
+bug-gnulib@gnu.org
--- a/modules/recv	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/recv	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/recvfrom	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/recvfrom	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 sys_socket
-errno
-getpeername
+errno           [test "$ac_cv_header_winsock2_h" = yes]
+getpeername     [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/regex	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/regex	Fri May 06 08:15:59 2011 -0700
@@ -12,23 +12,23 @@
 m4/mbstate_t.m4
 
 Depends-on:
-alloca-opt
-btowc
 extensions
-gettext-h
-localcharset
-malloc-gnu
-memcmp
-memmove
-mbrtowc
-mbsinit
-nl_langinfo
-stdbool
-stdint
 ssize_t
-wchar
-wcrtomb
-wctype-h
+alloca-opt      [test $ac_use_included_regex = yes]
+btowc           [test $ac_use_included_regex = yes]
+gettext-h       [test $ac_use_included_regex = yes]
+localcharset    [test $ac_use_included_regex = yes]
+malloc-gnu      [test $ac_use_included_regex = yes]
+memcmp          [test $ac_use_included_regex = yes]
+memmove         [test $ac_use_included_regex = yes]
+mbrtowc         [test $ac_use_included_regex = yes]
+mbsinit         [test $ac_use_included_regex = yes]
+nl_langinfo     [test $ac_use_included_regex = yes]
+stdbool         [test $ac_use_included_regex = yes]
+stdint          [test $ac_use_included_regex = yes]
+wchar           [test $ac_use_included_regex = yes]
+wcrtomb         [test $ac_use_included_regex = yes]
+wctype-h        [test $ac_use_included_regex = yes]
 
 configure.ac:
 gl_REGEX
--- a/modules/relocatable-prog-wrapper	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/relocatable-prog-wrapper	Fri May 06 08:15:59 2011 -0700
@@ -10,6 +10,10 @@
 lib/progreloc.c
 lib/areadlink.h
 lib/areadlink.c
+lib/careadlinkat.h
+lib/careadlinkat.c
+lib/allocator.h
+lib/allocator.c
 lib/readlink.c
 lib/canonicalize-lgpl.c
 lib/malloca.h
--- a/modules/remove	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/remove	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/remove.m4
 
 Depends-on:
-rmdir
 stdio
-unlink
+rmdir           [test $REPLACE_REMOVE = 1]
+unlink          [test $REPLACE_REMOVE = 1]
 
 configure.ac:
 gl_FUNC_REMOVE
--- a/modules/rename	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/rename	Fri May 06 08:15:59 2011 -0700
@@ -6,14 +6,14 @@
 m4/rename.m4
 
 Depends-on:
-canonicalize-lgpl
-dirname-lgpl
-lstat
-rmdir
-same-inode
-stdbool
 stdio
-strdup
+canonicalize-lgpl [test $REPLACE_RENAME = 1]
+dirname-lgpl      [test $REPLACE_RENAME = 1]
+lstat             [test $REPLACE_RENAME = 1]
+rmdir             [test $REPLACE_RENAME = 1]
+same-inode        [test $REPLACE_RENAME = 1]
+stdbool           [test $REPLACE_RENAME = 1]
+strdup            [test $REPLACE_RENAME = 1]
 
 configure.ac:
 gl_FUNC_RENAME
--- a/modules/renameat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/renameat	Fri May 06 08:15:59 2011 -0700
@@ -7,14 +7,15 @@
 m4/renameat.m4
 
 Depends-on:
+stdio
 extensions
 fcntl-h
-filenamecat-lgpl
-openat
-rename
-same-inode
-stdio
-stpcpy
+filenamecat-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
+getcwd-lgpl      [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
+openat           [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
+rename           [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
+same-inode       [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
+stpcpy           [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
 
 configure.ac:
 gl_FUNC_RENAMEAT
--- a/modules/renameat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/renameat-tests	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 Depends-on:
 ignore-value
 filenamecat
+getcwd-lgpl
 progname
-xgetcwd
 
 configure.ac:
 
--- a/modules/rmdir	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/rmdir	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/rmdir.m4
 
 Depends-on:
-dosname
-sys_stat
 unistd
+dosname         [test $REPLACE_RMDIR = 1]
+sys_stat        [test $REPLACE_RMDIR = 1]
 
 configure.ac:
 gl_FUNC_RMDIR
--- a/modules/round	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/round	Fri May 06 08:15:59 2011 -0700
@@ -9,10 +9,10 @@
 m4/ceil.m4
 
 Depends-on:
-float
-floor
 math
 extensions
+float           [test $HAVE_DECL_ROUND = 0 || test $REPLACE_ROUND = 1]
+floor           [test $HAVE_DECL_ROUND = 0 || test $REPLACE_ROUND = 1]
 
 configure.ac:
 gl_FUNC_ROUND
--- a/modules/roundf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/roundf	Fri May 06 08:15:59 2011 -0700
@@ -10,9 +10,9 @@
 m4/ceilf.m4
 
 Depends-on:
-float
 math
 extensions
+float           [test $HAVE_DECL_ROUNDF = 0 || test $REPLACE_ROUNDF = 1]
 
 configure.ac:
 gl_FUNC_ROUNDF
--- a/modules/roundl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/roundl	Fri May 06 08:15:59 2011 -0700
@@ -10,9 +10,9 @@
 m4/ceill.m4
 
 Depends-on:
-float
 math
 extensions
+float           [test $HAVE_DECL_ROUNDL = 0 || test $REPLACE_ROUNDL = 1]
 
 configure.ac:
 gl_FUNC_ROUNDL
--- a/modules/rpmatch	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/rpmatch	Fri May 06 08:15:59 2011 -0700
@@ -8,10 +8,10 @@
 Depends-on:
 stdlib
 extensions
-stdbool
-gettext-h
-regex
-strdup
+stdbool         [test $HAVE_RPMATCH = 0]
+gettext-h       [test $HAVE_RPMATCH = 0]
+regex           [test $HAVE_RPMATCH = 0]
+strdup          [test $HAVE_RPMATCH = 0]
 
 configure.ac:
 gl_FUNC_RPMATCH
--- a/modules/safe-read	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/safe-read	Fri May 06 08:15:59 2011 -0700
@@ -7,6 +7,7 @@
 m4/safe-read.m4
 
 Depends-on:
+read
 ssize_t
 
 configure.ac:
--- a/modules/safe-write	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/safe-write	Fri May 06 08:15:59 2011 -0700
@@ -4,10 +4,12 @@
 Files:
 lib/safe-write.h
 lib/safe-write.c
+lib/safe-read.c
 m4/safe-write.m4
+m4/safe-read.m4
 
 Depends-on:
-safe-read
+ssize_t
 write
 
 configure.ac:
--- a/modules/save-cwd	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/save-cwd	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 chdir-long
 cloexec
-getcwd
+getcwd-lgpl
 fchdir
 stdbool
 unistd-safer
--- a/modules/savewd	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/savewd	Fri May 06 08:15:59 2011 -0700
@@ -9,12 +9,12 @@
 Depends-on:
 dosname
 errno
-exit
 fchdir
 fcntl-safer
 fcntl-h
 raise
 stdbool
+stdlib
 xalloc
 
 configure.ac:
--- a/modules/sched	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sched	Fri May 06 08:15:59 2011 -0700
@@ -19,7 +19,8 @@
 
 # We need the following in order to create a replacement for <sched.h> when
 # the system doesn't have one.
-sched.h: sched.in.h
+if GL_GENERATE_SCHED_H
+sched.h: sched.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_SCHED_H''@|$(HAVE_SCHED_H)|g' \
@@ -31,6 +32,10 @@
 	      < $(srcdir)/sched.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+sched.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += sched.h sched.h-t
 
 Include:
--- a/modules/search	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/search	Fri May 06 08:15:59 2011 -0700
@@ -21,7 +21,7 @@
 
 # We need the following in order to create <search.h> when the system
 # doesn't have one that works with the given compiler.
-search.h: search.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+search.h: search.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''HAVE_SEARCH_H''@|$(HAVE_SEARCH_H)|g' \
--- a/modules/select	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/select	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/select.m4
 
 Depends-on:
-alloca
-sockets
 sys_select
+alloca          [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_SELECT = 1]
+sockets         [test "$ac_cv_header_winsock2_h" = yes || test $REPLACE_SELECT = 1]
 
 configure.ac:
 gl_FUNC_SELECT
--- a/modules/selinux-h	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/selinux-h	Fri May 06 08:15:59 2011 -0700
@@ -23,7 +23,7 @@
 lib_SOURCES += se-context.in.h se-selinux.in.h
 
 BUILT_SOURCES += selinux/selinux.h
-selinux/selinux.h: se-selinux.in.h $(UNUSED_PARAMETER_H)
+selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H)
 	$(AM_V_at)$(MKDIR_P) selinux
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
@@ -39,7 +39,8 @@
 MOSTLYCLEANFILES += selinux/selinux.h selinux/selinux.h-t
 
 BUILT_SOURCES += $(SELINUX_CONTEXT_H)
-selinux/context.h: se-context.in.h $(UNUSED_PARAMETER_H)
+if GL_GENERATE_SELINUX_CONTEXT_H
+selinux/context.h: se-context.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H)
 	$(AM_V_at)$(MKDIR_P) selinux
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
@@ -48,6 +49,10 @@
 	} > $@-t && \
 	chmod a-x $@-t && \
 	mv $@-t $@
+else
+selinux/context.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += selinux/context.h selinux/context.h-t
 MOSTLYCLEANDIRS += selinux
 
--- a/modules/send	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/send	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/sendto	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sendto	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/setenv	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/setenv	Fri May 06 08:15:59 2011 -0700
@@ -7,10 +7,10 @@
 
 Depends-on:
 stdlib
-malloca
-alloca-opt
-unistd
-environ
+malloca         [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1]
+alloca-opt      [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1]
+unistd          [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1]
+environ         [test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1]
 
 configure.ac:
 gl_FUNC_SETENV
--- a/modules/setlocale	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/setlocale	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 locale
-localename
+localename      [test $REPLACE_SETLOCALE = 1]
 
 configure.ac:
 gl_FUNC_SETLOCALE
--- a/modules/setsockopt	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/setsockopt	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 sys_socket
-sys_time
-errno
+sys_time        [test "$ac_cv_header_winsock2_h" = yes]
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/shutdown	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/shutdown	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/sigaction	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sigaction	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 signal
-sigprocmask
+sigprocmask     [test $HAVE_SIGACTION = 0]
 
 configure.ac:
 gl_SIGACTION
--- a/modules/signal	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/signal	Fri May 06 08:15:59 2011 -0700
@@ -10,6 +10,7 @@
 c++defs
 include_next
 warn-on-use
+extensions
 
 configure.ac:
 gl_SIGNAL_H
@@ -21,7 +22,7 @@
 
 # We need the following in order to create <signal.h> when the system
 # doesn't have a complete one.
-signal.h: signal.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -37,6 +38,7 @@
 	      -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \
 	      -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \
 	      -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \
+	      -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \
 	      -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
 	      -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
 	      -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
--- a/modules/signbit	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/signbit	Fri May 06 08:15:59 2011 -0700
@@ -9,13 +9,13 @@
 m4/signbit.m4
 
 Depends-on:
-float
 math
-isnanf-nolibm
-isnand-nolibm
-isnanl-nolibm
-fpieee
-memcmp
+float           [test $REPLACE_SIGNBIT = 1]
+isnanf-nolibm   [test $REPLACE_SIGNBIT = 1]
+isnand-nolibm   [test $REPLACE_SIGNBIT = 1]
+isnanl-nolibm   [test $REPLACE_SIGNBIT = 1]
+fpieee          [test $REPLACE_SIGNBIT = 1]
+memcmp          [test $REPLACE_SIGNBIT = 1]
 
 configure.ac:
 gl_SIGNBIT
--- a/modules/sigprocmask	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sigprocmask	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 signal
-stdint
-raise
+stdint          [test $HAVE_POSIX_SIGNALBLOCKING = 0]
+raise           [test $HAVE_POSIX_SIGNALBLOCKING = 0]
 
 configure.ac:
 gl_SIGNALBLOCKING
--- a/modules/sinl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sinl	Fri May 06 08:15:59 2011 -0700
@@ -11,10 +11,10 @@
 Depends-on:
 math
 extensions
-float
-isnanl
-floor
-floorl
+float           [test $HAVE_SINL = 0]
+isnanl          [test $HAVE_SINL = 0]
+floor           [test $HAVE_SINL = 0]
+floorl          [test $HAVE_SINL = 0]
 
 configure.ac:
 gl_FUNC_SINL
@@ -29,7 +29,7 @@
 $(SINL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- a/modules/sleep	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sleep	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/sleep.m4
 
 Depends-on:
-stdint
 unistd
-verify
+stdint          [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1]
+verify          [test $HAVE_SLEEP = 0 || test $REPLACE_SLEEP = 1]
 
 configure.ac:
 gl_FUNC_SLEEP
--- a/modules/snprintf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/snprintf	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 
 Depends-on:
 stdio
-vasnprintf
-errno
+vasnprintf      [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+errno           [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
 
 configure.ac:
 gl_FUNC_SNPRINTF
--- a/modules/snprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/snprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,18 +14,18 @@
 
 Depends-on:
 snprintf
-vasnprintf
-isnand-nolibm
-isnanl-nolibm
-frexp-nolibm
-frexpl-nolibm
-printf-frexp
-printf-frexpl
-signbit
-fpucw
 nocrash
 printf-safe
 multiarch
+vasnprintf      [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+isnand-nolibm   [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+isnanl-nolibm   [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+frexp-nolibm    [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+frexpl-nolibm   [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+printf-frexp    [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+printf-frexpl   [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+signbit         [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
+fpucw           [test $ac_cv_func_snprintf = no || test $REPLACE_SNPRINTF = 1]
 
 configure.ac:
 gl_FUNC_SNPRINTF_POSIX
--- a/modules/socket	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/socket	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 sys_socket
-errno
-sockets
+errno           [test "$ac_cv_header_winsock2_h" = yes]
+sockets         [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
--- a/modules/sockets	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sockets	Fri May 06 08:15:59 2011 -0700
@@ -10,7 +10,7 @@
 Depends-on:
 socketlib
 sys_socket
-close-hook
+fd-hook
 
 configure.ac:
 gl_SOCKETS
--- a/modules/spawn	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/spawn	Fri May 06 08:15:59 2011 -0700
@@ -22,7 +22,7 @@
 
 # We need the following in order to create a replacement for <spawn.h> when
 # the system doesn't have one.
-spawn.h: spawn.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+spawn.h: spawn.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_SPAWN_H''@|$(HAVE_SPAWN_H)|g' \
--- a/modules/spawn-pipe	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/spawn-pipe	Fri May 06 08:15:59 2011 -0700
@@ -12,7 +12,6 @@
 dup2
 environ
 error
-exit
 fatal-signal
 gettext-h
 open
@@ -30,6 +29,7 @@
 posix_spawnattr_setflags
 posix_spawnattr_destroy
 stdbool
+stdlib
 strpbrk
 unistd
 unistd-safer
--- a/modules/sprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,20 +14,20 @@
 
 Depends-on:
 stdio
-vasnprintf
-isnand-nolibm
-isnanl-nolibm
-frexp-nolibm
-frexpl-nolibm
-printf-frexp
-printf-frexpl
-signbit
-fpucw
 nocrash
 printf-safe
-stdint
-errno
 multiarch
+vasnprintf      [test $REPLACE_SPRINTF = 1]
+isnand-nolibm   [test $REPLACE_SPRINTF = 1]
+isnanl-nolibm   [test $REPLACE_SPRINTF = 1]
+frexp-nolibm    [test $REPLACE_SPRINTF = 1]
+frexpl-nolibm   [test $REPLACE_SPRINTF = 1]
+printf-frexp    [test $REPLACE_SPRINTF = 1]
+printf-frexpl   [test $REPLACE_SPRINTF = 1]
+signbit         [test $REPLACE_SPRINTF = 1]
+fpucw           [test $REPLACE_SPRINTF = 1]
+stdint          [test $REPLACE_SPRINTF = 1]
+errno           [test $REPLACE_SPRINTF = 1]
 
 configure.ac:
 gl_FUNC_SPRINTF_POSIX
--- a/modules/sqrtl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sqrtl	Fri May 06 08:15:59 2011 -0700
@@ -8,11 +8,11 @@
 Depends-on:
 math
 extensions
-float
-isnanl
-frexpl
-ldexpl
-sqrt
+float           [test $HAVE_SQRTL = 0]
+isnanl          [test $HAVE_SQRTL = 0]
+frexpl          [test $HAVE_SQRTL = 0]
+ldexpl          [test $HAVE_SQRTL = 0]
+sqrt            [test $HAVE_SQRTL = 0]
 
 configure.ac:
 gl_FUNC_SQRTL
@@ -27,7 +27,7 @@
 $(SQRTL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- a/modules/stat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/stat	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/stat.m4
 
 Depends-on:
-dosname
-stdbool
 sys_stat
+dosname         [test $REPLACE_STAT = 1]
+stdbool         [test $REPLACE_STAT = 1]
 
 configure.ac:
 gl_FUNC_STAT
--- a/modules/stdarg	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/stdarg	Fri May 06 08:15:59 2011 -0700
@@ -26,7 +26,8 @@
 
 # We need the following in order to create <stdarg.h> when the system
 # doesn't have one that works with the given compiler.
-stdarg.h: stdarg.in.h
+if GL_GENERATE_STDARG_H
+stdarg.h: stdarg.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -36,6 +37,10 @@
 	      < $(srcdir)/stdarg.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+stdarg.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += stdarg.h stdarg.h-t
 
 Include:
--- a/modules/stdbool	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/stdbool	Fri May 06 08:15:59 2011 -0700
@@ -19,12 +19,17 @@
 
 # We need the following in order to create <stdbool.h> when the system
 # doesn't have one that works.
-stdbool.h: stdbool.in.h
+if GL_GENERATE_STDBOOL_H
+stdbool.h: stdbool.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+stdbool.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += stdbool.h stdbool.h-t
 
 Include:
--- a/modules/stddef	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/stddef	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,8 @@
 
 # We need the following in order to create <stddef.h> when the system
 # doesn't have one that works with the given compiler.
-stddef.h: stddef.in.h
+if GL_GENERATE_STDDEF_H
+stddef.h: stddef.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -32,6 +33,10 @@
 	      < $(srcdir)/stddef.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+stddef.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += stddef.h stddef.h-t
 
 Include:
--- a/modules/stdint	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/stdint	Fri May 06 08:15:59 2011 -0700
@@ -26,7 +26,8 @@
 
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
-stdint.h: stdint.in.h
+if GL_GENERATE_STDINT_H
+stdint.h: stdint.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
@@ -58,6 +59,10 @@
 	      < $(srcdir)/stdint.in.h; \
 	} > $@-t && \
 	mv $@-t $@
+else
+stdint.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += stdint.h stdint.h-t
 
 Include:
--- a/modules/stdint-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/stdint-tests	Fri May 06 08:15:59 2011 -0700
@@ -6,6 +6,7 @@
 Depends-on:
 verify
 intprops
+wchar
 
 configure.ac:
 gt_TYPE_WCHAR_T
--- a/modules/stdio	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/stdio	Fri May 06 08:15:59 2011 -0700
@@ -22,7 +22,7 @@
 
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -32,20 +32,27 @@
 	      -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \
 	      -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \
 	      -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
+	      -e 's|@''GNULIB_FGETC''@|$(GNULIB_FGETC)|g' \
+	      -e 's|@''GNULIB_FGETS''@|$(GNULIB_FGETS)|g' \
 	      -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
 	      -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \
 	      -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
 	      -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \
 	      -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \
 	      -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \
+	      -e 's|@''GNULIB_FREAD''@|$(GNULIB_FREAD)|g' \
 	      -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
+	      -e 's|@''GNULIB_FSCANF''@|$(GNULIB_FSCANF)|g' \
 	      -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
 	      -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
 	      -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
 	      -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
 	      -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \
+	      -e 's|@''GNULIB_GETC''@|$(GNULIB_GETC)|g' \
+	      -e 's|@''GNULIB_GETCHAR''@|$(GNULIB_GETCHAR)|g' \
 	      -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
 	      -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
+	      -e 's|@''GNULIB_GETS''@|$(GNULIB_GETS)|g' \
 	      -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \
 	      -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \
 	      -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \
@@ -58,14 +65,18 @@
 	      -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \
 	      -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \
 	      -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \
+	      -e 's|@''GNULIB_SCANF''@|$(GNULIB_SCANF)|g' \
 	      -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
 	      -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
+	      -e 's|@''GNULIB_STDIO_H_NONBLOCKING''@|$(GNULIB_STDIO_H_NONBLOCKING)|g' \
 	      -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \
 	      -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \
 	      -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
 	      -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \
 	      -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \
 	      -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
+	      -e 's|@''GNULIB_VFSCANF''@|$(GNULIB_VFSCANF)|g' \
+	      -e 's|@''GNULIB_VSCANF''@|$(GNULIB_VSCANF)|g' \
 	      -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \
 	      -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
 	      -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
@@ -107,6 +118,7 @@
 	      -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \
 	      -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
 	      -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
+	      -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \
 	      -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \
 	      -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \
 	      -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
--- a/modules/stdlib	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/stdlib	Fri May 06 08:15:59 2011 -0700
@@ -23,7 +23,7 @@
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
--- a/modules/strcase	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strcase	Fri May 06 08:15:59 2011 -0700
@@ -1,6 +1,12 @@
 Description:
 Case-insensitive string comparison functions.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
 Files:
 lib/strcasecmp.c
 lib/strncasecmp.c
--- a/modules/strchrnul	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strchrnul	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 m4/strchrnul.m4
 
 Depends-on:
+string
 extensions
-string
-rawmemchr
+rawmemchr       [test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1]
 
 configure.ac:
 gl_FUNC_STRCHRNUL
--- a/modules/strdup-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strdup-posix	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 string
-malloc-posix
+malloc-posix    [test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1]
 
 configure.ac:
 gl_FUNC_STRDUP_POSIX
--- a/modules/strerror	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strerror	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/strerror.m4
 
 Depends-on:
-errno
-intprops
 string
+errno           [test $REPLACE_STRERROR = 1]
+intprops        [test $REPLACE_STRERROR = 1]
 
 configure.ac:
 gl_FUNC_STRERROR
--- a/modules/strerror_r-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strerror_r-posix	Fri May 06 08:15:59 2011 -0700
@@ -7,10 +7,10 @@
 
 Depends-on:
 string
-errno
 extensions
-lock
-strerror
+errno           [test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1]
+lock            [test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1]
+strerror        [test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1]
 
 configure.ac:
 gl_FUNC_STRERROR_R
--- a/modules/strftime-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strftime-tests	Fri May 06 08:15:59 2011 -0700
@@ -3,7 +3,6 @@
 tests/macros.h
 
 Depends-on:
-strftime
 
 configure.ac:
 
--- a/modules/string	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/string	Fri May 06 08:15:59 2011 -0700
@@ -23,7 +23,7 @@
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -89,6 +89,7 @@
 	      -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
 	      -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
 	      -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
+	      -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \
 	      -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
 	      -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
 	      -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
--- a/modules/strings	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strings	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,7 @@
 
 # We need the following in order to create <strings.h> when the system
 # doesn't have one that works with the given compiler.
-strings.h: strings.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+strings.h: strings.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
--- a/modules/strndup	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strndup	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/strndup.m4
 
 Depends-on:
+string
 extensions
-string
-strnlen
+strnlen         [test $ac_cv_func_strndup = no || test $REPLACE_STRNDUP = 1]
 
 configure.ac:
 gl_FUNC_STRNDUP
--- a/modules/strnlen	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strnlen	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/strnlen.m4
 
 Depends-on:
+string
 extensions
-string
-memchr
+memchr-obsolete [test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1]
 
 configure.ac:
 gl_FUNC_STRNLEN
--- a/modules/strptime	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strptime	Fri May 06 08:15:59 2011 -0700
@@ -7,13 +7,13 @@
 m4/tm_gmtoff.m4
 
 Depends-on:
+time
 extensions
-sys_time
-string
-strcase
-stdbool
-time
-time_r
+sys_time        [test $HAVE_STRPTIME = 0]
+string          [test $HAVE_STRPTIME = 0]
+strcase         [test $HAVE_STRPTIME = 0]
+stdbool         [test $HAVE_STRPTIME = 0]
+time_r          [test $HAVE_STRPTIME = 0]
 
 configure.ac:
 gl_FUNC_STRPTIME
--- a/modules/strsep	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strsep	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/strsep.m4
 
 Depends-on:
+string
 extensions
-string
-strpbrk
+strpbrk         [test $HAVE_STRSEP = 0]
 
 configure.ac:
 gl_FUNC_STRSEP
--- a/modules/strsignal	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strsignal	Fri May 06 08:15:59 2011 -0700
@@ -8,12 +8,12 @@
 
 Depends-on:
 string
-gettext-h
-lock
-tls
-snprintf
-memset
 extensions
+gettext-h       [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1]
+lock            [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1]
+tls             [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1]
+snprintf        [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1]
+memset          [test $ac_cv_func_strsignal = no || test $REPLACE_STRSIGNAL = 1]
 
 configure.ac:
 gl_FUNC_STRSIGNAL
--- a/modules/strstr-simple	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strstr-simple	Fri May 06 08:15:59 2011 -0700
@@ -8,9 +8,9 @@
 
 Depends-on:
 string
-stdbool
-memchr
-memcmp
+stdbool         [test $REPLACE_STRSTR = 1]
+memchr          [test $REPLACE_STRSTR = 1]
+memcmp          [test $REPLACE_STRSTR = 1]
 
 configure.ac:
 gl_FUNC_STRSTR_SIMPLE
--- a/modules/strtod	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strtod	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,10 @@
 m4/ldexp.m4
 
 Depends-on:
-c-ctype
-stdbool
 stdlib
+strtod-obsolete
+c-ctype         [test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1]
+stdbool         [test $HAVE_STRTOD = 0 || test $REPLACE_STRTOD = 1]
 
 configure.ac:
 gl_FUNC_STRTOD
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/strtod-obsolete	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,28 @@
+Description:
+strtod() function for old platforms.
+
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
+Files:
+m4/strtod-obsolete.m4
+
+Depends-on:
+strtod
+
+configure.ac:
+gl_FUNC_STRTOD_OBSOLETE
+
+Makefile.am:
+
+Include:
+<string.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Bruno Haible
--- a/modules/strtoimax	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strtoimax	Fri May 06 08:15:59 2011 -0700
@@ -7,10 +7,10 @@
 m4/strtoimax.m4
 
 Depends-on:
-strtoll
-verify
-inttypes
-stdint
+inttypes-incomplete
+verify          [test "$ac_cv_have_decl_strtoimax" != yes && test $ac_cv_func_strtoimax = no]
+stdint          [test "$ac_cv_have_decl_strtoimax" != yes && test $ac_cv_func_strtoimax = no]
+strtoll         [test "$ac_cv_have_decl_strtoimax" != yes && test $ac_cv_func_strtoimax = no && test $ac_cv_type_long_long_int = yes]
 
 configure.ac:
 gl_FUNC_STRTOIMAX
@@ -22,7 +22,7 @@
 <inttypes.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paul Eggert
--- a/modules/strtok_r	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strtok_r	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 string
-strpbrk
+strpbrk         [test $ac_cv_func_strtok_r = no]
 
 configure.ac:
 gl_FUNC_STRTOK_R
--- a/modules/strtol	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strtol	Fri May 06 08:15:59 2011 -0700
@@ -1,12 +1,17 @@
 Description:
 strtol() function: convert string to 'long'.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
 Files:
 lib/strtol.c
 m4/strtol.m4
 
 Depends-on:
-wchar
 
 configure.ac:
 gl_FUNC_STRTOL
@@ -21,4 +26,3 @@
 
 Maintainer:
 glibc
-
--- a/modules/strtoll	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strtoll	Fri May 06 08:15:59 2011 -0700
@@ -2,13 +2,13 @@
 strtoll() function: convert string to 'long long'.
 
 Files:
+lib/strtol.c
 lib/strtoll.c
 m4/longlong.m4
 m4/strtoll.m4
 
 Depends-on:
 stdlib
-strtol
 
 configure.ac:
 gl_FUNC_STRTOLL
@@ -24,4 +24,3 @@
 
 Maintainer:
 glibc
-
--- a/modules/strtoul	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strtoul	Fri May 06 08:15:59 2011 -0700
@@ -1,12 +1,18 @@
 Description:
 strtoul() function: convert string to 'unsigned long'.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
 Files:
+lib/strtol.c
 lib/strtoul.c
 m4/strtoul.m4
 
 Depends-on:
-strtol
 
 configure.ac:
 gl_FUNC_STRTOUL
@@ -21,4 +27,3 @@
 
 Maintainer:
 glibc
-
--- a/modules/strtoull	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strtoull	Fri May 06 08:15:59 2011 -0700
@@ -2,13 +2,14 @@
 strtoull() function: convert string to 'unsigned long long'.
 
 Files:
+lib/strtol.c
+lib/strtoul.c
 lib/strtoull.c
 m4/longlong.m4
 m4/strtoull.m4
 
 Depends-on:
 stdlib
-strtoul
 
 configure.ac:
 gl_FUNC_STRTOULL
@@ -24,4 +25,3 @@
 
 Maintainer:
 glibc
-
--- a/modules/strtoumax	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/strtoumax	Fri May 06 08:15:59 2011 -0700
@@ -2,15 +2,16 @@
 strtoumax() function: convert string to 'uintmax_t'.
 
 Files:
+lib/strtoimax.c
 lib/strtoumax.c
 m4/longlong.m4
 m4/strtoumax.m4
 
 Depends-on:
-strtoimax
-strtoull
-inttypes
-stdint
+inttypes-incomplete
+verify          [test "$ac_cv_have_decl_strtoumax" != yes && test $ac_cv_func_strtoumax = no]
+stdint          [test "$ac_cv_have_decl_strtoumax" != yes && test $ac_cv_func_strtoumax = no]
+strtoull        [test "$ac_cv_have_decl_strtoumax" != yes && test $ac_cv_func_strtoumax = no && test $ac_cv_type_unsigned_long_long_int = yes]
 
 configure.ac:
 gl_FUNC_STRTOUMAX
@@ -22,7 +23,7 @@
 <inttypes.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paul Eggert
--- a/modules/symlink	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/symlink	Fri May 06 08:15:59 2011 -0700
@@ -6,8 +6,8 @@
 m4/symlink.m4
 
 Depends-on:
-lstat
 unistd
+lstat           [test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1]
 
 configure.ac:
 gl_FUNC_SYMLINK
--- a/modules/symlinkat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/symlinkat	Fri May 06 08:15:59 2011 -0700
@@ -6,11 +6,11 @@
 m4/symlinkat.m4
 
 Depends-on:
+unistd
 extensions
 fcntl-h
-openat
-symlink
-unistd
+openat          [test $HAVE_SYMLINKAT = 0]
+symlink         [test $HAVE_SYMLINKAT = 0]
 
 configure.ac:
 gl_FUNC_SYMLINKAT
--- a/modules/symlinkat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/symlinkat-tests	Fri May 06 08:15:59 2011 -0700
@@ -12,4 +12,3 @@
 Makefile.am:
 TESTS += test-symlinkat
 check_PROGRAMS += test-symlinkat
-test_symlinkat_LDADD = $(LDADD) @LIBINTL@
--- a/modules/sys_file	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_file	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,7 @@
 
 # We need the following in order to create <sys/file.h> when the system
 # has one that is incomplete.
-sys/file.h: sys_file.in.h $(WARN_ON_USE_H)
+sys/file.h: sys_file.in.h $(top_builddir)/config.status $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/sys_ioctl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_ioctl	Fri May 06 08:15:59 2011 -0700
@@ -22,7 +22,7 @@
 
 # We need the following in order to create <sys/ioctl.h> when the system
 # does not have a complete one.
-sys/ioctl.h: sys_ioctl.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+sys/ioctl.h: sys_ioctl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/sys_select	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_select	Fri May 06 08:15:59 2011 -0700
@@ -23,7 +23,7 @@
 
 # We need the following in order to create <sys/select.h> when the system
 # doesn't have one that works with the given compiler.
-sys/select.h: sys_select.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/sys_socket	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_socket	Fri May 06 08:15:59 2011 -0700
@@ -13,6 +13,7 @@
 errno
 include_next
 socklen
+sys_uio
 warn-on-use
 
 configure.ac:
@@ -26,7 +27,7 @@
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/sys_stat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_stat	Fri May 06 08:15:59 2011 -0700
@@ -24,7 +24,7 @@
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/sys_time	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_time	Fri May 06 08:15:59 2011 -0700
@@ -22,7 +22,7 @@
 
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
-sys/time.h: sys_time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/sys_times	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_times	Fri May 06 08:15:59 2011 -0700
@@ -21,7 +21,7 @@
 
 # We need the following in order to create <sys/times.h> when the system
 # doesn't have one that works with the given compiler.
-sys/times.h: sys_times.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+sys/times.h: sys_times.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/sys_uio	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,42 @@
+Description:
+A POSIX-like <sys/uio.h>.
+
+Files:
+lib/sys_uio.in.h
+m4/sys_uio_h.m4
+
+Depends-on:
+include_next
+
+configure.ac:
+gl_HEADER_SYS_UIO
+AC_PROG_MKDIR_P
+
+Makefile.am:
+BUILT_SOURCES += sys/uio.h
+
+# We need the following in order to create <sys/uio.h> when the system
+# doesn't have one that works with the given compiler.
+sys/uio.h: sys_uio.in.h $(top_builddir)/config.status
+	$(AM_V_at)$(MKDIR_P) sys
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+	      -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+	      -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+	      -e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \
+	      -e 's|@''HAVE_SYS_UIO_H''@|$(HAVE_SYS_UIO_H)|g' \
+	      < $(srcdir)/sys_uio.in.h; \
+	} > $@-t && \
+	mv -f $@-t $@
+MOSTLYCLEANFILES += sys/uio.h sys/uio.h-t
+MOSTLYCLEANDIRS += sys
+
+Include:
+<sys/uio.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+Eric Blake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/sys_uio-tests	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,10 @@
+Files:
+tests/test-sys_uio.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-sys_uio
+check_PROGRAMS += test-sys_uio
--- a/modules/sys_utsname	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_utsname	Fri May 06 08:15:59 2011 -0700
@@ -21,7 +21,7 @@
 
 # We need the following in order to create <sys/utsname.h> when the system
 # does not have one.
-sys/utsname.h: sys_utsname.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+sys/utsname.h: sys_utsname.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/sys_wait	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sys_wait	Fri May 06 08:15:59 2011 -0700
@@ -21,7 +21,7 @@
 
 # We need the following in order to create <sys/wait.h> when the system
 # has one that is incomplete.
-sys/wait.h: sys_wait.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+sys/wait.h: sys_wait.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_at)$(MKDIR_P) sys
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
--- a/modules/sysexits	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/sysexits	Fri May 06 08:15:59 2011 -0700
@@ -7,6 +7,7 @@
 
 Depends-on:
 include_next
+stdlib
 
 configure.ac:
 gl_SYSEXITS
@@ -19,7 +20,8 @@
 
 # We need the following in order to create <sysexits.h> when the system
 # doesn't have one that works with the given compiler.
-sysexits.h: sysexits.in.h
+if GL_GENERATE_SYSEXITS_H
+sysexits.h: sysexits.in.h $(top_builddir)/config.status
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_SYSEXITS_H''@|$(HAVE_SYSEXITS_H)|g' \
@@ -30,6 +32,10 @@
 	      < $(srcdir)/sysexits.in.h; \
 	} > $@-t && \
 	mv -f $@-t $@
+else
+sysexits.h: $(top_builddir)/config.status
+	rm -f $@
+endif
 MOSTLYCLEANFILES += sysexits.h sysexits.h-t
 
 Include:
--- a/modules/tanl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/tanl	Fri May 06 08:15:59 2011 -0700
@@ -10,10 +10,10 @@
 Depends-on:
 math
 extensions
-float
-isnanl
-floor
-floorl
+float           [test $HAVE_TANL = 0]
+isnanl          [test $HAVE_TANL = 0]
+floor           [test $HAVE_TANL = 0]
+floorl          [test $HAVE_TANL = 0]
 
 configure.ac:
 gl_FUNC_TANL
@@ -28,7 +28,7 @@
 $(TANL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
--- a/modules/tcgetsid	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/tcgetsid	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 termios
 extensions
-sys_ioctl
+sys_ioctl       [test $ac_cv_func_tcgetsid = no]
 
 configure.ac:
 gl_FUNC_TCGETSID
--- a/modules/termios	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/termios	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,7 @@
 
 # We need the following in order to create <termios.h> when the system
 # version does not have all declarations.
-termios.h: termios.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+termios.h: termios.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
--- a/modules/time	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/time	Fri May 06 08:15:59 2011 -0700
@@ -23,7 +23,7 @@
 
 # We need the following in order to create <time.h> when the system
 # doesn't have one that works with the given compiler.
-time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
--- a/modules/tmpfile	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/tmpfile	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 
 Depends-on:
 stdio
-pathmax
-tempname
-tmpdir
+pathmax         [test $REPLACE_TMPFILE = 1]
+tempname        [test $REPLACE_TMPFILE = 1]
+tmpdir          [test $REPLACE_TMPFILE = 1]
 
 configure.ac:
 gl_FUNC_TMPFILE
@@ -21,7 +21,7 @@
 <stdio.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Ben Pfaff
--- a/modules/trunc	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/trunc	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_TRUNC = 0 || test $REPLACE_TRUNC = 1]
 
 configure.ac:
 gl_FUNC_TRUNC
--- a/modules/truncf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/truncf	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_TRUNCF = 0 || test $REPLACE_TRUNCF = 1]
 
 configure.ac:
 gl_FUNC_TRUNCF
--- a/modules/truncl	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/truncl	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_TRUNCL = 0 || test $REPLACE_TRUNCL = 1]
 
 configure.ac:
 gl_FUNC_TRUNCL
--- a/modules/tzset	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/tzset	Fri May 06 08:15:59 2011 -0700
@@ -16,7 +16,7 @@
 <time.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Jim Meyering
--- a/modules/uname	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/uname	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 sys_utsname
-gethostname
+gethostname     [test $HAVE_UNAME = 0]
 
 configure.ac:
 gl_FUNC_UNAME
--- a/modules/unistd	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/unistd	Fri May 06 08:15:59 2011 -0700
@@ -22,7 +22,7 @@
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -58,6 +58,7 @@
 	      -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \
 	      -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \
 	      -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \
+	      -e 's|@''GNULIB_READ''@|$(GNULIB_READ)|g' \
 	      -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
 	      -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \
 	      -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \
@@ -66,6 +67,7 @@
 	      -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \
 	      -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \
 	      -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \
+	      -e 's|@''GNULIB_UNISTD_H_NONBLOCKING''@|$(GNULIB_UNISTD_H_NONBLOCKING)|g' \
 	      -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
 	      -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \
 	      -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
@@ -126,6 +128,7 @@
 	      -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
 	      -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \
 	      -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \
+	      -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \
 	      -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
 	      -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
 	      -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
--- a/modules/unlink	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/unlink	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/unlink.m4
 
 Depends-on:
-dosname
-lstat
 unistd
+dosname         [test $REPLACE_UNLINK = 1]
+lstat           [test $REPLACE_UNLINK = 1]
 
 configure.ac:
 gl_FUNC_UNLINK
--- a/modules/unlockpt	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/unlockpt	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 Depends-on:
 stdlib
 extensions
-ptsname
+ptsname         [test $HAVE_UNLOCKPT = 0]
 
 configure.ac:
 gl_FUNC_UNLOCKPT
--- a/modules/unsetenv	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/unsetenv	Fri May 06 08:15:59 2011 -0700
@@ -7,8 +7,8 @@
 
 Depends-on:
 stdlib
-unistd
-environ
+unistd          [test $ac_cv_func_unsetenv = no || test $REPLACE_UNSETENV = 1]
+environ         [test $ac_cv_func_unsetenv = no || test $REPLACE_UNSETENV = 1]
 
 configure.ac:
 gl_FUNC_UNSETENV
--- a/modules/usleep	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/usleep	Fri May 06 08:15:59 2011 -0700
@@ -6,9 +6,9 @@
 m4/usleep.m4
 
 Depends-on:
+unistd
 extensions
-sleep
-unistd
+sleep           [test $HAVE_USLEEP = 0 || test $REPLACE_USLEEP = 1]
 
 configure.ac:
 gl_FUNC_USLEEP
--- a/modules/utimecmp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/utimecmp	Fri May 06 08:15:59 2011 -0700
@@ -11,7 +11,6 @@
 stat-time
 time
 utimens
-xalloc
 intprops
 lstat
 stdbool
--- a/modules/utimensat	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/utimensat	Fri May 06 08:15:59 2011 -0700
@@ -6,10 +6,10 @@
 m4/utimensat.m4
 
 Depends-on:
-openat
 sys_stat
-utimens
 extensions
+openat          [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1]
+utimens         [test $HAVE_UTIMENSAT = 0 || test $REPLACE_UTIMENSAT = 1]
 
 configure.ac:
 gl_FUNC_UTIMENSAT
--- a/modules/utimensat-tests	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/utimensat-tests	Fri May 06 08:15:59 2011 -0700
@@ -19,4 +19,4 @@
 Makefile.am:
 TESTS += test-utimensat
 check_PROGRAMS += test-utimensat
-test_utimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBINTL@
+test_utimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
--- a/modules/vasprintf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/vasprintf	Fri May 06 08:15:59 2011 -0700
@@ -12,10 +12,10 @@
 m4/vasprintf.m4
 
 Depends-on:
+stdio
 extensions
-vasnprintf
-stdio
-errno
+vasnprintf      [test $HAVE_VASPRINTF = 0 || test $REPLACE_VASPRINTF = 1]
+errno           [test $HAVE_VASPRINTF = 0 || test $REPLACE_VASPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VASPRINTF
--- a/modules/vdprintf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/vdprintf	Fri May 06 08:15:59 2011 -0700
@@ -7,9 +7,9 @@
 
 Depends-on:
 stdio
-vasnprintf
-full-write
-errno
+vasnprintf      [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+full-write      [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+errno           [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VDPRINTF
--- a/modules/vdprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/vdprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,18 +14,18 @@
 
 Depends-on:
 vdprintf
-vasnprintf
-isnand-nolibm
-isnanl-nolibm
-frexp-nolibm
-frexpl-nolibm
-printf-frexp
-printf-frexpl
-signbit
-fpucw
 nocrash
 printf-safe
 multiarch
+vasnprintf      [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+isnand-nolibm   [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+isnanl-nolibm   [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+frexp-nolibm    [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+frexpl-nolibm   [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+printf-frexp    [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+printf-frexpl   [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+signbit         [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
+fpucw           [test $ac_cv_func_vdprintf = no || test $REPLACE_VDPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VDPRINTF_POSIX
--- a/modules/vfprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/vfprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,20 +14,20 @@
 
 Depends-on:
 stdio
-fseterr
-vasnprintf
-isnand-nolibm
-isnanl-nolibm
-frexp-nolibm
-frexpl-nolibm
-printf-frexp
-printf-frexpl
-signbit
-fpucw
 nocrash
 printf-safe
-errno
 multiarch
+fseterr         [test $REPLACE_VFPRINTF = 1]
+vasnprintf      [test $REPLACE_VFPRINTF = 1]
+isnand-nolibm   [test $REPLACE_VFPRINTF = 1]
+isnanl-nolibm   [test $REPLACE_VFPRINTF = 1]
+frexp-nolibm    [test $REPLACE_VFPRINTF = 1]
+frexpl-nolibm   [test $REPLACE_VFPRINTF = 1]
+printf-frexp    [test $REPLACE_VFPRINTF = 1]
+printf-frexpl   [test $REPLACE_VFPRINTF = 1]
+signbit         [test $REPLACE_VFPRINTF = 1]
+fpucw           [test $REPLACE_VFPRINTF = 1]
+errno           [test $REPLACE_VFPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VFPRINTF_POSIX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/vfscanf	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,21 @@
+Description:
+vfscanf() function: parse formatted text from a stream
+
+Files:
+
+Depends-on:
+stdio
+
+configure.ac:
+gl_STDIO_MODULE_INDICATOR([vfscanf])
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
--- a/modules/vprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/vprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,8 +14,8 @@
 
 Depends-on:
 stdio
-vfprintf-posix
 printf-safe
+vfprintf-posix  [test $REPLACE_VPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VPRINTF_POSIX
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/vscanf	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,21 @@
+Description:
+vscanf() function: parse formatted text from standard input
+
+Files:
+
+Depends-on:
+stdio
+
+configure.ac:
+gl_STDIO_MODULE_INDICATOR([vscanf])
+
+Makefile.am:
+
+Include:
+<stdio.h>
+
+License:
+LGPL
+
+Maintainer:
+Bruno Haible
--- a/modules/vsnprintf	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/vsnprintf	Fri May 06 08:15:59 2011 -0700
@@ -9,8 +9,8 @@
 
 Depends-on:
 stdio
-vasnprintf
-errno
+vasnprintf      [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+errno           [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VSNPRINTF
--- a/modules/vsnprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/vsnprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,18 +14,18 @@
 
 Depends-on:
 vsnprintf
-vasnprintf
-isnand-nolibm
-isnanl-nolibm
-frexp-nolibm
-frexpl-nolibm
-printf-frexp
-printf-frexpl
-signbit
-fpucw
 nocrash
 printf-safe
 multiarch
+vasnprintf      [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+isnand-nolibm   [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+isnanl-nolibm   [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+frexp-nolibm    [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+frexpl-nolibm   [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+printf-frexp    [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+printf-frexpl   [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+signbit         [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
+fpucw           [test $ac_cv_func_vsnprintf = no || test $REPLACE_VSNPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VSNPRINTF_POSIX
--- a/modules/vsprintf-posix	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/vsprintf-posix	Fri May 06 08:15:59 2011 -0700
@@ -14,20 +14,20 @@
 
 Depends-on:
 stdio
-vasnprintf
-isnand-nolibm
-isnanl-nolibm
-frexp-nolibm
-frexpl-nolibm
-printf-frexp
-printf-frexpl
-signbit
-fpucw
 nocrash
 printf-safe
-stdint
-errno
 multiarch
+vasnprintf      [test $REPLACE_VSPRINTF = 1]
+isnand-nolibm   [test $REPLACE_VSPRINTF = 1]
+isnanl-nolibm   [test $REPLACE_VSPRINTF = 1]
+frexp-nolibm    [test $REPLACE_VSPRINTF = 1]
+frexpl-nolibm   [test $REPLACE_VSPRINTF = 1]
+printf-frexp    [test $REPLACE_VSPRINTF = 1]
+printf-frexpl   [test $REPLACE_VSPRINTF = 1]
+signbit         [test $REPLACE_VSPRINTF = 1]
+fpucw           [test $REPLACE_VSPRINTF = 1]
+stdint          [test $REPLACE_VSPRINTF = 1]
+errno           [test $REPLACE_VSPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VSPRINTF_POSIX
--- a/modules/wait-process	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wait-process	Fri May 06 08:15:59 2011 -0700
@@ -10,10 +10,10 @@
 Depends-on:
 fatal-signal
 error
-exit
 xalloc
 gettext-h
 stdbool
+stdlib
 sys_wait
 unistd
 atexit
--- a/modules/wchar	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wchar	Fri May 06 08:15:59 2011 -0700
@@ -23,7 +23,7 @@
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
--- a/modules/wcrtomb	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcrtomb	Fri May 06 08:15:59 2011 -0700
@@ -12,9 +12,9 @@
 m4/codeset.m4
 
 Depends-on:
+wchar
 extensions
-wchar
-mbsinit
+mbsinit         [test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1]
 
 configure.ac:
 gl_FUNC_WCRTOMB
--- a/modules/wcscasecmp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcscasecmp	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 wchar
-wctype-h
+wctype-h        [test $HAVE_WCSCASECMP = 0]
 
 configure.ac:
 gl_FUNC_WCSCASECMP
--- a/modules/wcscspn	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcscspn	Fri May 06 08:15:59 2011 -0700
@@ -14,8 +14,8 @@
 
 Depends-on:
 wchar
-wcslen
-wcschr
+wcslen          [test $HAVE_WCSCSPN = 0]
+wcschr          [test $HAVE_WCSCSPN = 0]
 
 configure.ac:
 gl_FUNC_WCSCSPN
--- a/modules/wcsdup	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcsdup	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 
 Depends-on:
 wchar
-wcslen
-wmemcpy
+wcslen          [test $HAVE_WCSDUP = 0]
+wmemcpy         [test $HAVE_WCSDUP = 0]
 
 configure.ac:
 gl_FUNC_WCSDUP
--- a/modules/wcsncasecmp	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcsncasecmp	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 wchar
-wctype-h
+wctype-h        [test $HAVE_WCSNCASECMP = 0]
 
 configure.ac:
 gl_FUNC_WCSNCASECMP
--- a/modules/wcsnrtombs	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcsnrtombs	Fri May 06 08:15:59 2011 -0700
@@ -13,9 +13,9 @@
 m4/codeset.m4
 
 Depends-on:
+wchar
 extensions
-wchar
-wcrtomb
+wcrtomb         [test $HAVE_WCSNRTOMBS = 0 || test $REPLACE_WCSNRTOMBS = 1]
 
 configure.ac:
 gl_FUNC_WCSNRTOMBS
--- a/modules/wcspbrk	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcspbrk	Fri May 06 08:15:59 2011 -0700
@@ -14,7 +14,7 @@
 
 Depends-on:
 wchar
-wcschr
+wcschr          [test $HAVE_WCSPBRK = 0]
 
 configure.ac:
 gl_FUNC_WCSPBRK
--- a/modules/wcsrtombs	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcsrtombs	Fri May 06 08:15:59 2011 -0700
@@ -14,9 +14,9 @@
 m4/codeset.m4
 
 Depends-on:
+wchar
 extensions
-wchar
-wcrtomb
+wcrtomb         [test $HAVE_WCSRTOMBS = 0 || test $REPLACE_WCSRTOMBS = 1]
 
 configure.ac:
 gl_FUNC_WCSRTOMBS
--- a/modules/wcsspn	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcsspn	Fri May 06 08:15:59 2011 -0700
@@ -14,7 +14,7 @@
 
 Depends-on:
 wchar
-wcschr
+wcschr          [test $HAVE_WCSSPN = 0]
 
 configure.ac:
 gl_FUNC_WCSSPN
--- a/modules/wcsstr	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcsstr	Fri May 06 08:15:59 2011 -0700
@@ -8,7 +8,7 @@
 
 Depends-on:
 wchar
-wcschr
+wcschr          [test $HAVE_WCSSTR = 0]
 
 configure.ac:
 gl_FUNC_WCSSTR
--- a/modules/wcstok	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcstok	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 
 Depends-on:
 wchar
-wcsspn
-wcspbrk
+wcsspn          [test $HAVE_WCSTOK = 0]
+wcspbrk         [test $HAVE_WCSTOK = 0]
 
 configure.ac:
 gl_FUNC_WCSTOK
--- a/modules/wcswidth	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcswidth	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 
 Depends-on:
 wchar
-wcwidth
+wcwidth         [test $HAVE_WCSWIDTH = 0 || test $REPLACE_WCSWIDTH = 1]
 
 configure.ac:
 gl_FUNC_WCSWIDTH
--- a/modules/wctob	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wctob	Fri May 06 08:15:59 2011 -0700
@@ -9,7 +9,7 @@
 
 Depends-on:
 wchar
-wctomb
+wctomb          [test $ac_cv_func_wctob = no || test $REPLACE_WCTOB = 1]
 
 configure.ac:
 gl_FUNC_WCTOB
--- a/modules/wctomb	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wctomb	Fri May 06 08:15:59 2011 -0700
@@ -8,8 +8,8 @@
 
 Depends-on:
 stdlib
-wcrtomb
-wchar
+wcrtomb         [test $REPLACE_WCTOMB = 1]
+wchar           [test $REPLACE_WCTOMB = 1]
 
 configure.ac:
 gl_FUNC_WCTOMB
--- a/modules/wctype	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wctype	Fri May 06 08:15:59 2011 -0700
@@ -14,7 +14,7 @@
 
 Depends-on:
 wctype-h
-iswblank
+iswblank        [test $HAVE_WCTYPE_T = 0]
 
 configure.ac:
 gl_FUNC_WCTYPE
--- a/modules/wctype-h	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wctype-h	Fri May 06 08:15:59 2011 -0700
@@ -19,7 +19,7 @@
 
 # We need the following in order to create <wctype.h> when the system
 # doesn't have one that works with the given compiler.
-wctype.h: wctype.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
+wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
 	$(AM_V_GEN)rm -f $@-t $@ && \
 	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
 	  sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
--- a/modules/wcwidth	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/wcwidth	Fri May 06 08:15:59 2011 -0700
@@ -8,12 +8,12 @@
 m4/wint_t.m4
 
 Depends-on:
+wchar
 extensions
-wchar
-wctype-h
-localcharset
-streq
-uniwidth/width
+wctype-h        [test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1]
+localcharset    [test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1]
+streq           [test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1]
+uniwidth/width  [test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1]
 
 configure.ac:
 gl_FUNC_WCWIDTH
--- a/modules/write	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/write	Fri May 06 08:15:59 2011 -0700
@@ -7,7 +7,7 @@
 
 Depends-on:
 unistd
-raise
+raise           [test $REPLACE_WRITE = 1]
 
 configure.ac:
 gl_FUNC_WRITE
--- a/modules/xalloc	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/xalloc	Fri May 06 08:15:59 2011 -0700
@@ -9,6 +9,7 @@
 Depends-on:
 inline
 xalloc-die
+xalloc-oversized
 
 configure.ac:
 gl_XALLOC
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/xalloc-oversized	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,20 @@
+Description:
+Check for memory allocation overflow.  Also see xalloc.
+
+Files:
+lib/xalloc-oversized.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+"xalloc-oversized.h"
+
+License:
+GPL
+
+Maintainer:
+all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/xgetgroups	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,25 @@
+Description:
+Return the group IDs of a user or current process in malloc'd storage, with
+out-of-memory checking.
+
+Files:
+lib/xgetgroups.c
+
+Depends-on:
+mgetgroups
+xalloc
+
+configure.ac:
+gl_MODULE_INDICATOR([xgetgroups])
+
+Makefile.am:
+lib_SOURCES += xgetgroups.c
+
+Include:
+"mgetgroups.h"
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering, Eric Blake
--- a/modules/xsetenv	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/xsetenv	Fri May 06 08:15:59 2011 -0700
@@ -10,8 +10,8 @@
 setenv
 unsetenv
 error
-exit
 gettext-h
+stdlib
 
 configure.ac:
 
--- a/modules/xstrtol	Fri Apr 01 16:04:45 2011 -0700
+++ b/modules/xstrtol	Fri May 06 08:15:59 2011 -0700
@@ -14,7 +14,7 @@
 getopt-gnu
 gettext-h
 intprops
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_XSTRTOL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/socket-client.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,57 @@
+/* Create sockets for use in tests (client side).
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+/* Creates a client socket, by connecting to a server on the given port.  */
+static int
+create_client_socket (int port)
+{
+  int client_socket;
+
+  /* Create a client socket.  */
+  client_socket = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
+  ASSERT (client_socket >= 0);
+  /* Connect to the server process at the specified port.  */
+  {
+    struct sockaddr_in addr;
+
+    memset (&addr, 0, sizeof (addr)); /* needed on AIX and OSF/1 */
+    addr.sin_family = AF_INET;
+    #if 0 /* Unoptimized */
+    inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr);
+    #elif 0 /* Nearly optimized */
+    addr.sin_addr.s_addr = htonl (0x7F000001); /* 127.0.0.1 */
+    #else /* Fully optimized */
+    {
+      unsigned char dotted[4] = { 127, 0, 0, 1 }; /* 127.0.0.1 */
+      memcpy (&addr.sin_addr.s_addr, dotted, 4);
+    }
+    #endif
+    addr.sin_port = htons (port);
+
+    ASSERT (connect (client_socket,
+                     (const struct sockaddr *) &addr, sizeof (addr))
+            == 0);
+  }
+
+  return client_socket;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/socket-server.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,117 @@
+/* Create sockets for use in tests (server side).
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+/* Creates a server that can be used to listen on incoming
+   connections.  It uses the IPv4 protocol.
+   If PORT is 0, a port is assigned by the kernel.
+   Returns the server.  Returns the chosen port in *PPORT.  */
+static int
+create_server (int port, unsigned int max_backlog, int *pport)
+{
+  int server;
+
+  /* Create a server socket.  */
+  server = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP);
+  if (server < 0)
+    {
+      fputs ("Skipping test: cannot create server socket: socket() failed\n",
+             stderr);
+      exit (77);
+    }
+  /* Bind it to a local IPv4 address.  */
+  if (port != 0)
+    {
+      /* Set an option for the next bind() call: Avoid an EADDRINUSE error
+         in case there are TIME_WAIT or CLOSE_WAIT sockets hanging around on
+         the port. (Sockets in LISTEN or ESTABLISHED state on the same port
+         will still yield an error.)  */
+      unsigned int flag = 1;
+      if (setsockopt (server, SOL_SOCKET, SO_REUSEADDR, &flag,
+                      sizeof (flag))
+          < 0)
+        {
+          fputs ("Skipping test: cannot create server socket: setsockopt() failed\n",
+                 stderr);
+          exit (77);
+        }
+    }
+  {
+    struct sockaddr_in addr;
+
+    memset (&addr, 0, sizeof (addr)); /* needed on AIX and OSF/1 */
+    addr.sin_family = AF_INET;
+    #if 0 /* Unoptimized */
+    inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr);
+    #elif 0 /* Nearly optimized */
+    addr.sin_addr.s_addr = htonl (0x7F000001); /* 127.0.0.1 */
+    #else /* Fully optimized */
+    {
+      unsigned char dotted[4] = { 127, 0, 0, 1 }; /* 127.0.0.1 */
+      memcpy (&addr.sin_addr.s_addr, dotted, 4);
+    }
+    #endif
+    addr.sin_port = htons (port);
+
+    if (bind (server, (const struct sockaddr *) &addr, sizeof (addr)) < 0)
+      {
+        fputs ("Skipping test: cannot create server socket: bind() failed\n",
+               stderr);
+        exit (77);
+      }
+  }
+  if (port == 0)
+    {
+      /* Get the port that was assigned by bind().  */
+      struct sockaddr_in addr;
+      socklen_t addrlen = sizeof (addr);
+
+      if (getsockname (server, (struct sockaddr *) &addr, &addrlen) < 0)
+        {
+          fputs ("Skipping test: cannot create server socket: getsockname() failed\n",
+                 stderr);
+          exit (77);
+        }
+      port = ntohs (addr.sin_port);
+    }
+  /* Start listening for a connection from the child process.  */
+  if (listen (server, max_backlog) < 0)
+    {
+      fputs ("Skipping test: cannot create server socket: listen() failed\n",
+             stderr);
+      exit (77);
+    }
+
+  *pport = port;
+  return server;
+}
+
+/* Creates a server socket, by accepting a connection to a server.  */
+static int
+create_server_socket (int server)
+{
+  struct sockaddr_storage addr;
+  socklen_t addrlen = sizeof (addr);
+  int connected_socket = accept (server, (struct sockaddr *) &addr, &addrlen);
+  ASSERT (connected_socket >= 0);
+  return connected_socket;
+}
--- a/tests/test-chown.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-chown.h	Fri May 06 08:15:59 2011 -0700
@@ -38,7 +38,7 @@
   int result;
 
   /* Solaris 8 is interesting - if the current process belongs to
-     multiple groups, the current directory is owned by a a group that
+     multiple groups, the current directory is owned by a group that
      the current process belongs to but different than getegid(), and
      the current directory does not have the S_ISGID bit, then regular
      files created in the directory belong to the directory's group,
@@ -71,7 +71,7 @@
   ASSERT (close (creat (BASE "dir/file", 0600)) == 0);
   ASSERT (stat (BASE "dir/file", &st1) == 0);
   ASSERT (st1.st_uid != (uid_t) -1);
-  ASSERT (st1.st_gid != (uid_t) -1);
+  ASSERT (st1.st_gid != (gid_t) -1);
   ASSERT (st1.st_gid == getegid ());
 
   /* Sanity check of error cases.  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-fclose.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,93 @@
+/* Test of fclose module.
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* Written by Eric Blake.  */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (fclose, int, (FILE *));
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "macros.h"
+
+#define BASE "test-fclose.t"
+
+int
+main (int argc, char **argv)
+{
+  const char buf[] = "hello world";
+  int fd;
+  int fd2;
+  FILE *f;
+
+  /* Prepare a seekable file.  */
+  fd = open (BASE, O_RDWR | O_CREAT | O_TRUNC, 0600);
+  ASSERT (0 <= fd);
+  ASSERT (write (fd, buf, sizeof buf) == sizeof buf);
+  ASSERT (lseek (fd, 1, SEEK_SET) == 1);
+
+  /* Create an output stream visiting the file; when it is closed, all
+     other file descriptors visiting the file must see the new file
+     position.  */
+  fd2 = dup (fd);
+  ASSERT (0 <= fd2);
+  f = fdopen (fd2, "w");
+  ASSERT (f);
+  ASSERT (fputc (buf[1], f) == buf[1]);
+  ASSERT (fclose (f) == 0);
+  errno = 0;
+  ASSERT (lseek (fd2, 0, SEEK_CUR) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (lseek (fd, 0, SEEK_CUR) == 2);
+
+#if GNULIB_FFLUSH
+  /* Likewise for an input stream, but only when we know fflush works
+     on input streams.  */
+  fd2 = dup (fd);
+  ASSERT (0 <= fd2);
+  f = fdopen (fd2, "r");
+  ASSERT (f);
+  ASSERT (fgetc (f) == buf[2]);
+  ASSERT (fclose (f) == 0);
+  errno = 0;
+  ASSERT (lseek (fd2, 0, SEEK_CUR) == -1);
+  ASSERT (errno == EBADF);
+  ASSERT (lseek (fd, 0, SEEK_CUR) == 3);
+#endif
+
+  /* Test that fclose() sets errno if someone else closes the stream
+     fd behind the back of stdio.  */
+  f = fdopen (fd, "w+");
+  ASSERT (f);
+  ASSERT (close (fd) == 0);
+  errno = 0;
+  ASSERT (fclose (f) == EOF);
+  ASSERT (errno == EBADF);
+
+  /* Clean up.  */
+  ASSERT (remove (BASE) == 0);
+
+  return 0;
+}
--- a/tests/test-fcntl-h.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-fcntl-h.c	Fri May 06 08:15:59 2011 -0700
@@ -29,10 +29,88 @@
 int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };
 
 /* Check that the FD_* macros are defined.  */
-int fd = FD_CLOEXEC;
+int i = FD_CLOEXEC;
 
 int
 main (void)
 {
-  return 0;
+  /* Ensure no overlap in SEEK_*. */
+  switch (0)
+    {
+    case SEEK_CUR:
+    case SEEK_END:
+    case SEEK_SET:
+      ;
+    }
+
+  /* Ensure no dangerous overlap in non-zero gnulib-defined replacements.  */
+  switch (O_RDONLY)
+    {
+      /* Access modes */
+    case O_RDONLY:
+    case O_WRONLY:
+    case O_RDWR:
+#if O_EXEC && O_EXEC != O_RDONLY
+    case O_EXEC:
+#endif
+#if O_SEARCH && O_EXEC != O_SEARCH && O_SEARCH != O_RDONLY
+    case O_SEARCH:
+#endif
+      i = O_ACCMODE == (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH);
+      break;
+
+      /* Everyone should have these */
+    case O_CREAT:
+    case O_EXCL:
+    case O_TRUNC:
+    case O_APPEND:
+      break;
+
+      /* These might be 0 or O_RDONLY, only test non-zero versions.  */
+#if O_CLOEXEC
+    case O_CLOEXEC:
+#endif
+#if O_DIRECT
+    case O_DIRECT:
+#endif
+#if O_DIRECTORY
+    case O_DIRECTORY:
+#endif
+#if O_DSYNC
+    case O_DSYNC:
+#endif
+#if O_NOATIME
+    case O_NOATIME:
+#endif
+#if O_NONBLOCK
+    case O_NONBLOCK:
+#endif
+#if O_NOCTTY
+    case O_NOCTTY:
+#endif
+#if O_NOFOLLOW
+    case O_NOFOLLOW:
+#endif
+#if O_NOLINKS
+    case O_NOLINKS:
+#endif
+#if O_RSYNC && O_RSYNC != O_DSYNC
+    case O_RSYNC:
+#endif
+#if O_SYNC && O_SYNC != O_RSYNC
+    case O_SYNC:
+#endif
+#if O_TTY_INIT
+    case O_TTY_INIT:
+#endif
+#if O_BINARY
+    case O_BINARY:
+#endif
+#if O_TEXT
+    case O_TEXT:
+#endif
+      ;
+    }
+
+  return !i;
 }
--- a/tests/test-getaddrinfo.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-getaddrinfo.c	Fri May 06 08:15:59 2011 -0700
@@ -107,7 +107,7 @@
 #endif
       /* Provide details if errno was set.  */
       if (res == EAI_SYSTEM)
-        dbgprintf ("system error: %s\n", strerror (err));
+        fprintf (stderr, "system error: %s\n", strerror (err));
 
       return 1;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-getcwd-lgpl.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,87 @@
+/* Test of getcwd() function.
+   Copyright (C) 2009-2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+SIGNATURE_CHECK (getcwd, char *, (char *, size_t));
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "macros.h"
+
+int
+main (int argc, char **argv)
+{
+  char *pwd1;
+  char *pwd2;
+  /* If the user provides an argument, attempt to chdir there first.  */
+  if (1 < argc)
+    {
+      if (chdir (argv[1]) == 0)
+        printf ("changed to directory %s\n", argv[1]);
+    }
+
+  pwd1 = getcwd (NULL, 0);
+  ASSERT (pwd1 && *pwd1);
+  if (1 < argc)
+    printf ("cwd=%s\n", pwd1);
+
+  /* Make sure the result is usable.  */
+  ASSERT (chdir (pwd1) == 0);
+  ASSERT (chdir (".//./.") == 0);
+
+  /* Make sure that result is normalized.  */
+  pwd2 = getcwd (NULL, 0);
+  ASSERT (pwd2);
+  ASSERT (strcmp (pwd1, pwd2) == 0);
+  free (pwd2);
+  {
+    size_t len = strlen (pwd1);
+    ssize_t i = len - 10;
+    if (i < 1)
+      i = 1;
+    pwd2 = getcwd (NULL, len + 1);
+    ASSERT (pwd2);
+    free (pwd2);
+    pwd2 = malloc (len + 2);
+    for ( ; i <= len; i++)
+      {
+        errno = 0;
+        ASSERT (getcwd (pwd2, i) == NULL);
+        ASSERT (errno == ERANGE);
+        errno = 0;
+        ASSERT (getcwd (NULL, i) == NULL);
+        ASSERT (errno == ERANGE);
+      }
+    ASSERT (getcwd (pwd2, len + 1) == pwd2);
+    pwd2[len] = '/';
+    pwd2[len + 1] = '\0';
+  }
+  ASSERT (strstr (pwd2, "/./") == NULL);
+  ASSERT (strstr (pwd2, "/../") == NULL);
+  ASSERT (strstr (pwd2 + 1 + (pwd2[1] == '/'), "//") == NULL);
+
+  free (pwd1);
+  free (pwd2);
+
+  return 0;
+}
--- a/tests/test-getcwd.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-getcwd.c	Fri May 06 08:15:59 2011 -0700
@@ -18,59 +18,206 @@
 
 #include <unistd.h>
 
-#include "signature.h"
-SIGNATURE_CHECK (getcwd, char *, (char *, size_t));
-
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/stat.h>
 
 #include "macros.h"
 
+#if ! HAVE_GETPAGESIZE
+# define getpagesize() 0
+#endif
+
+/* This size is chosen to be larger than PATH_MAX (4k), yet smaller than
+   the 16kB pagesize on ia64 linux.  Those conditions make the code below
+   trigger a bug in glibc's getcwd implementation before 2.4.90-10.  */
+#define TARGET_LEN (5 * 1024)
+
+/* Keep this test in sync with m4/getcwd-abort-bug.m4.  */
+static int
+test_abort_bug (void)
+{
+  char const *dir_name = "confdir-14B---";
+  char *cwd;
+  size_t initial_cwd_len;
+  int fail = 0;
+  size_t desired_depth;
+  size_t d;
+
+  /* The bug is triggered when PATH_MAX < getpagesize (), so skip
+     this relatively expensive and invasive test if that's not true.  */
+  if (getpagesize () <= PATH_MAX)
+    return 0;
+
+  cwd = getcwd (NULL, 0);
+  if (cwd == NULL)
+    return 2;
+
+  initial_cwd_len = strlen (cwd);
+  free (cwd);
+  desired_depth = ((TARGET_LEN - 1 - initial_cwd_len)
+                   / (1 + strlen (dir_name)));
+  for (d = 0; d < desired_depth; d++)
+    {
+      if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0)
+        {
+          fail = 3; /* Unable to construct deep hierarchy.  */
+          break;
+        }
+    }
+
+  /* If libc has the bug in question, this invocation of getcwd
+     results in a failed assertion.  */
+  cwd = getcwd (NULL, 0);
+  if (cwd == NULL)
+    fail = 4; /* getcwd failed.  This is ok, and expected.  */
+  free (cwd);
+
+  /* Call rmdir first, in case the above chdir failed.  */
+  rmdir (dir_name);
+  while (0 < d--)
+    {
+      if (chdir ("..") < 0)
+        {
+          fail = 5;
+          break;
+        }
+      rmdir (dir_name);
+    }
+
+  return fail;
+}
+
+/* The length of this name must be 8.  */
+#define DIR_NAME "confdir3"
+#define DIR_NAME_LEN 8
+#define DIR_NAME_SIZE (DIR_NAME_LEN + 1)
+
+/* The length of "../".  */
+#define DOTDOTSLASH_LEN 3
+
+/* Leftover bytes in the buffer, to work around library or OS bugs.  */
+#define BUF_SLOP 20
+
+/* Keep this test in sync with m4/getcwd-path-max.m4.  */
+static int
+test_long_name (void)
+{
+#ifndef PATH_MAX
+  /* The Hurd doesn't define this, so getcwd can't exhibit the bug --
+     at least not on a local file system.  And if we were to start worrying
+     about remote file systems, we'd have to enable the wrapper function
+     all of the time, just to be safe.  That's not worth the cost.  */
+  return 0;
+#elif ((INT_MAX / (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1) \
+        - DIR_NAME_SIZE - BUF_SLOP) \
+       <= PATH_MAX)
+  /* FIXME: Assuming there's a system for which this is true,
+     this should be done in a compile test.  */
+  return 0;
+#else
+  char buf[PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN + 1)
+           + DIR_NAME_SIZE + BUF_SLOP];
+  char *cwd = getcwd (buf, PATH_MAX);
+  size_t initial_cwd_len;
+  size_t cwd_len;
+  int fail = 0;
+  size_t n_chdirs = 0;
+
+  if (cwd == NULL)
+    return 10;
+
+  cwd_len = initial_cwd_len = strlen (cwd);
+
+  while (1)
+    {
+      size_t dotdot_max = PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN);
+      char *c = NULL;
+
+      cwd_len += DIR_NAME_SIZE;
+      /* If mkdir or chdir fails, it could be that this system cannot create
+         any file with an absolute name longer than PATH_MAX, such as cygwin.
+         If so, leave fail as 0, because the current working directory can't
+         be too long for getcwd if it can't even be created.  For other
+         errors, be pessimistic and consider that as a failure, too.  */
+      if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0)
+        {
+          if (! (errno == ERANGE || errno == ENAMETOOLONG))
+            fail = 20;
+          break;
+        }
+
+      if (PATH_MAX <= cwd_len && cwd_len < PATH_MAX + DIR_NAME_SIZE)
+        {
+          c = getcwd (buf, PATH_MAX);
+          if (!c && errno == ENOENT)
+            {
+              fail = 11;
+              break;
+            }
+          if (c || ! (errno == ERANGE || errno == ENAMETOOLONG))
+            {
+              fail = 21;
+              break;
+            }
+        }
+
+      if (dotdot_max <= cwd_len - initial_cwd_len)
+        {
+          if (dotdot_max + DIR_NAME_SIZE < cwd_len - initial_cwd_len)
+            break;
+          c = getcwd (buf, cwd_len + 1);
+          if (!c)
+            {
+              if (! (errno == ERANGE || errno == ENOENT
+                     || errno == ENAMETOOLONG))
+                {
+                  fail = 22;
+                  break;
+                }
+              if (AT_FDCWD || errno == ERANGE || errno == ENOENT)
+                {
+                  fail = 12;
+                  break;
+                }
+            }
+        }
+
+      if (c && strlen (c) != cwd_len)
+        {
+          fail = 23;
+          break;
+        }
+      ++n_chdirs;
+    }
+
+  /* Leaving behind such a deep directory is not polite.
+     So clean up here, right away, even though the driving
+     shell script would also clean up.  */
+  {
+    size_t i;
+
+    /* Try rmdir first, in case the chdir failed.  */
+    rmdir (DIR_NAME);
+    for (i = 0; i <= n_chdirs; i++)
+      {
+        if (chdir ("..") < 0)
+          break;
+        if (rmdir (DIR_NAME) != 0)
+          break;
+      }
+  }
+
+  return fail;
+#endif
+}
+
 int
 main (int argc, char **argv)
 {
-  char *pwd1;
-  char *pwd2;
-  /* If the user provides an argument, attempt to chdir there first.  */
-  if (1 < argc)
-    {
-      if (chdir (argv[1]) == 0)
-        printf ("changed to directory %s\n", argv[1]);
-    }
-
-  pwd1 = getcwd (NULL, 0);
-  ASSERT (pwd1 && *pwd1);
-  if (1 < argc)
-    printf ("cwd=%s\n", pwd1);
-
-  /* Make sure the result is usable.  */
-  ASSERT (chdir (pwd1) == 0);
-  ASSERT (chdir ("././.") == 0);
-
-  /* Make sure that result is normalized.  */
-  pwd2 = getcwd (NULL, 0);
-  ASSERT (pwd2);
-  ASSERT (strcmp (pwd1, pwd2) == 0);
-  free (pwd2);
-  {
-    size_t len = strlen (pwd1);
-    ssize_t i = len - 10;
-    if (i < 0)
-      i = 0;
-    pwd2 = malloc (len + 2);
-    for ( ; i < len; i++)
-      ASSERT (getcwd (pwd2, i) == NULL);
-    pwd2 = getcwd (pwd2, len + 1);
-    ASSERT (pwd2);
-    pwd2[len] = '/';
-    pwd2[len + 1] = '\0';
-  }
-  ASSERT (strstr (pwd2, "/./") == NULL);
-  ASSERT (strstr (pwd2, "/../") == NULL);
-
-  free (pwd1);
-  free (pwd2);
-
-  return 0;
+  return test_abort_bug () + test_long_name ();
 }
--- a/tests/test-hash.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-hash.c	Fri May 06 08:15:59 2011 -0700
@@ -20,7 +20,6 @@
 #include "hash.h"
 #include "hash-pjw.h"
 #include "inttostr.h"
-#include "xalloc.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -114,8 +113,10 @@
       ASSERT (ht);
       insert_new (ht, "a");
       {
-        char *str1 = xstrdup ("a");
-        char *str2 = hash_insert (ht, str1);
+        char *str1 = strdup ("a");
+        char *str2;
+        ASSERT (str1);
+        str2 = hash_insert (ht, str1);
         ASSERT (str1 != str2);
         ASSERT (STREQ (str1, str2));
         free (str1);
@@ -161,7 +162,8 @@
       ht = hash_initialize (sz, NULL, NULL, NULL, NULL);
       ASSERT (ht);
       {
-        char *str = xstrdup ("a");
+        char *str = strdup ("a");
+        ASSERT (str);
         insert_new (ht, "a");
         insert_new (ht, str);
         ASSERT (hash_lookup (ht, str) == str);
@@ -206,7 +208,9 @@
               {
                 char buf[50];
                 char const *p = uinttostr (i, buf);
-                insert_new (ht, xstrdup (p));
+                char *p_dup = strdup (p);
+                ASSERT (p_dup);
+                insert_new (ht, p_dup);
               }
               break;
 
--- a/tests/test-lchown.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-lchown.h	Fri May 06 08:15:59 2011 -0700
@@ -46,7 +46,7 @@
   int result;
 
   /* Solaris 8 is interesting - if the current process belongs to
-     multiple groups, the current directory is owned by a a group that
+     multiple groups, the current directory is owned by a group that
      the current process belongs to but different than getegid(), and
      the current directory does not have the S_ISGID bit, then regular
      files created in the directory belong to the directory's group,
--- a/tests/test-linkat.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-linkat.c	Fri May 06 08:15:59 2011 -0700
@@ -34,7 +34,6 @@
 #include "areadlink.h"
 #include "filenamecat.h"
 #include "same-inode.h"
-#include "xgetcwd.h"
 #include "ignore-value.h"
 #include "macros.h"
 
@@ -119,7 +118,8 @@
   ASSERT (mkdir (BASE "sub1", 0700) == 0);
   ASSERT (mkdir (BASE "sub2", 0700) == 0);
   ASSERT (close (creat (BASE "00", 0600)) == 0);
-  cwd = xgetcwd ();
+  cwd = getcwd (NULL, 0);
+  ASSERT (cwd);
 
   dfd = open (BASE "sub1", O_RDONLY);
   ASSERT (0 <= dfd);
@@ -140,9 +140,11 @@
   for (i = 0; i < 32; i++)
     {
       int fd1 = (i & 8) ? dfd : AT_FDCWD;
-      char *file1 = file_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
+      char *file1 = mfile_name_concat ((i & 4) ? ".." : cwd, BASE "xx", NULL);
       int fd2 = (i & 2) ? dfd : AT_FDCWD;
-      char *file2 = file_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL);
+      char *file2 = mfile_name_concat ((i & 1) ? ".." : cwd, BASE "xx", NULL);
+      ASSERT (file1);
+      ASSERT (file2);
       flag = (i & 0x10 ? AT_SYMLINK_FOLLOW : 0);
 
       ASSERT (sprintf (strchr (file1, '\0') - 2, "%02d", i) == 2);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-netdb-c++.cc	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,42 @@
+/* Test of <netdb.h> substitute in C++ mode.
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2011.  */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <netdb.h>
+
+#include "signature.h"
+
+
+#if GNULIB_TEST_GETADDRINFO
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getaddrinfo, int,
+                 (const char *, const char *, const struct addrinfo *,
+                  struct addrinfo **));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::freeaddrinfo, void, (struct addrinfo *));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::gai_strerror, const char *, (int));
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getnameinfo, int,
+                 (const struct sockaddr *, socklen_t, char *, socklen_t,
+                  char *, socklen_t, int));
+#endif
+
+
+int
+main ()
+{
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-misc.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,108 @@
+/* Test for nonblocking read and write.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Whether to print debugging messages.  */
+#define ENABLE_DEBUGGING 0
+
+/* Delay (in microseconds) to sleep when write() or read() returned -1 with
+   errno = EAGAIN.  */
+#define SMALL_DELAY 10000
+
+/* Return a memory area, filled with the data to be transferred.  */
+static unsigned char *
+init_data (size_t data_block_size)
+{
+  unsigned char *data;
+  unsigned int i;
+
+  data = (unsigned char *) malloc (2 * data_block_size);
+  ASSERT (data != NULL);
+
+  for (i = 0; i < 2 * data_block_size; i++)
+    data[i] = (unsigned char) (i * i + (7 * i) % 61 + 4);
+
+  return data;
+}
+
+#if ENABLE_DEBUGGING
+# include <stdarg.h>
+static int dbgfprintf (FILE *fp, const char *format, ...)
+                      _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3);
+static int
+dbgfprintf (FILE *fp, const char *format, ...)
+{
+  /* Accumulate the entire line in a buffer, so that the output on fp
+     is done atomically.  */
+  char line[1024];
+  size_t line_len;
+  struct timeval current_time;
+  va_list args;
+  int ret;
+
+  line_len = 0;
+  gettimeofday (&current_time, NULL);
+  ret = snprintf (line, sizeof (line), "%.6f ",
+                  current_time.tv_sec + (double) current_time.tv_usec * 1e-6);
+  if (ret < 0)
+    return -1;
+  line_len = strlen (line);
+
+  va_start (args, format);
+  ret = vsnprintf (line + line_len, sizeof (line) - line_len, format, args);
+  va_end (args);
+  if (ret < 0)
+    return -1;
+  line_len += strlen (line + line_len);
+
+  ret = fwrite (line, 1, line_len, fp);
+
+  /* Make sure the debugging information is output, so that the order of the
+     messages reflects the timeline of events, and so that the output is not
+     lost if the program crashes afterwards (relevant on mingw).  */
+  fflush (fp);
+  return ret;
+}
+#else
+# define dbgfprintf if (1) ; else fprintf
+#endif
+
+/* Return a textual description of the error code ERR, if FAILED is true.
+   Return an empty string if FAILED is false.  */
+static const char *
+dbgstrerror (bool failed, int err)
+{
+  static char buf[256];
+  if (failed)
+    {
+      sprintf (buf, " %d %s", err, strerror (err));
+      return buf;
+    }
+  else
+    return "";
+}
+
+#define TIMING_DECLS \
+  struct timeval before_time; \
+  struct timeval after_time; \
+  double spent_time;
+#define START_TIMING \
+  gettimeofday (&before_time, NULL);
+#define END_TIMING \
+  gettimeofday (&after_time, NULL); \
+  spent_time = \
+    (after_time.tv_sec - before_time.tv_sec) \
+    + ((double) after_time.tv_usec - (double) before_time.tv_usec) * 1e-6;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-pipe-child.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,50 @@
+/* Child program invoked by test-nonblocking-pipe-main.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include "binary-io.h"
+
+#include "macros.h"
+#include "test-nonblocking-pipe.h"
+#define PROG_ROLE "child"
+#include "test-nonblocking-reader.h"
+
+int
+main (int argc, char *argv[])
+{
+  int test = atoi (argv[1]);
+
+  /* Close unused file descriptors.  */
+  close (STDOUT_FILENO);
+
+  /* STDIN_FILENO was created as binary in the parent process.  But since an
+     fd's mode is stored in the process, not in the kernel, on native Windows
+     we need to set it as binary in the child process again.  */
+  SET_BINARY (STDIN_FILENO);
+
+  main_reader_loop (test, PIPE_DATA_BLOCK_SIZE, STDIN_FILENO);
+
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-pipe-main.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,110 @@
+/* Test for nonblocking read and write on pipes.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# include <process.h>
+#else
+# include <spawn.h>
+#endif
+
+#include "nonblocking.h"
+#include "wait-process.h"
+
+#include "macros.h"
+#include "test-nonblocking-pipe.h"
+#define PROG_ROLE "main"
+#include "test-nonblocking-writer.h"
+
+int
+main (int argc, char *argv[])
+{
+  const char *child_path = argv[1];
+  int test = atoi (argv[2]);
+  int fd[2];
+  int child;
+  int exitcode;
+
+  /* Create a pipe.  */
+  ASSERT (pipe (fd) >= 0);
+
+  /* Map fd[0] to STDIN_FILENO and fd[1] to STDOUT_FILENO, because on Windows,
+     the only three file descriptors that are inherited by child processes are
+     STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO.  */
+  if (fd[0] != STDIN_FILENO)
+    {
+      ASSERT (dup2 (fd[0], STDIN_FILENO) >= 0);
+      close (fd[0]);
+    }
+  if (fd[1] != STDOUT_FILENO)
+    {
+      ASSERT (dup2 (fd[1], STDOUT_FILENO) >= 0);
+      close (fd[1]);
+    }
+
+  /* Prepare the file descriptors.  */
+  if (test & 1)
+    ASSERT (set_nonblocking_flag (STDOUT_FILENO, true) >= 0);
+  if (test & 2)
+    ASSERT (set_nonblocking_flag (STDIN_FILENO, true) >= 0);
+
+  /* Spawn the child process.  */
+  {
+    const char *child_argv[3];
+
+    child_argv[0] = child_path;
+    child_argv[1] = argv[2];
+    child_argv[2] = NULL;
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+    child = spawnvpe (P_NOWAIT, child_path, child_argv,
+                      (const char **) environ);
+    ASSERT (child >= 0);
+#else
+    {
+      pid_t child_pid;
+      int err =
+        posix_spawnp (&child_pid, child_path, NULL, NULL, (char **) child_argv,
+                      environ);
+      ASSERT (err == 0);
+      child = child_pid;
+    }
+#endif
+  }
+
+  /* Close unused file descriptors.  */
+  close (STDIN_FILENO);
+
+  exitcode =
+    main_writer_loop (test, PIPE_DATA_BLOCK_SIZE, STDOUT_FILENO, false);
+
+  {
+    int err =
+      wait_subprocess (child, child_path, false, false, false, false, NULL);
+    ASSERT (err == 0);
+  }
+
+  return exitcode;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-pipe.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,38 @@
+/* Test for nonblocking read and write.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* A data block ought to be larger than the size of the in-kernel buffer.
+   Working values of PIPE_DATA_BLOCK_SIZE, depending on kernel:
+
+     Platform                        PIPE_DATA_BLOCK_SIZE
+
+     Linux                           >= 63489
+     FreeBSD, OpenBSD, MacOS X       >= 65537
+     AIX                             >= 32769
+     HP-UX                           >= 8193
+     IRIX                            >= 10241
+     OSF/1                           >= 262145
+     Solaris <= 7                    >= 10241
+     Solaris >= 8                    >= 20481
+     Cygwin                          >= 65537
+     native Win32                    >= 4097 (depends on the _pipe argument)
+ */
+#if defined __osf__
+# define PIPE_DATA_BLOCK_SIZE 270000
+#else
+# define PIPE_DATA_BLOCK_SIZE 70000
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-pipe.sh	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Note: This test fails on Cygwin 1.5.x, because the non-blocking flag has
+# apparently no effect on STDOUT_FILENO. It is fixed in Cygwin 1.7.
+
+# Test blocking write() with blocking read().
+# Commented out because this test succeeds on all platforms anyway.
+#./test-nonblocking-pipe-main${EXEEXT} ./test-nonblocking-pipe-child${EXEEXT} 0 || exit 1
+
+# Test non-blocking write() with blocking read().
+./test-nonblocking-pipe-main${EXEEXT} ./test-nonblocking-pipe-child${EXEEXT} 1 || exit 1
+
+# Test blocking write() with non-blocking read().
+./test-nonblocking-pipe-main${EXEEXT} ./test-nonblocking-pipe-child${EXEEXT} 2 || exit 1
+
+# Test non-blocking write() with non-blocking read().
+./test-nonblocking-pipe-main${EXEEXT} ./test-nonblocking-pipe-child${EXEEXT} 3 || exit 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-reader.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,200 @@
+/* The reader part of a test program for non-blocking communication.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This program implements 4 tests:
+
+   test == 0:
+     Test blocking write() with blocking read().
+
+     Timeline         Main process             Child process
+        0 s           Start                    Start, read(10000)
+        1 s           write(20000)             Return from read(10000)
+        2 s                                    Next read(10000)
+        2 s           Return from write(20000) Return from read(10000)
+
+   test == 1:
+     Test non-blocking write() with blocking read().
+
+     Timeline         Main process             Child process
+        0 s           Start                    Start, read(10000)
+        1 s           write(20000)             Return from read(10000)
+                      Return with at least 10000,
+                      Repeatedly continue
+                      write() of the rest
+        2 s                                    Next read(10000)
+        2 s           Return from write(10000) Return from read(10000)
+
+   test == 2:
+     Test blocking write() with non-blocking read().
+
+     Timeline         Main process             Child process
+        0 s           Start                    Start, read(10000)
+                                               repeatedly polling
+        1 s           write(20000)             Return from read(10000)
+        2 s                                    Next read(10000)
+        2 s           Return from write(20000) Return from read(10000)
+
+   test == 3:
+     Test non-blocking write() with non-blocking read().
+ */
+
+#include "test-nonblocking-misc.h"
+
+static ssize_t
+full_read (size_t fd, void *buf, size_t count)
+{
+  size_t bytes_read;
+
+  bytes_read = 0;
+  while (bytes_read < count)
+    {
+      TIMING_DECLS
+      ssize_t ret;
+      int saved_errno;
+
+      dbgfprintf (stderr, "%s: >> read (%lu)\n", PROG_ROLE,
+                  (unsigned long) (count - bytes_read));
+      START_TIMING
+      ret = read (fd, (char *) buf + bytes_read, count - bytes_read);
+      saved_errno = errno;
+      END_TIMING
+      dbgfprintf (stderr, "%s: << read -> %ld%s\n", PROG_ROLE,
+                  (long) ret, dbgstrerror (ret < 0, saved_errno));
+      if (ret < 0)
+        return -1;
+      else
+        {
+          ASSERT (ret > 0);
+          bytes_read += ret;
+        }
+    }
+  return bytes_read;
+}
+
+static ssize_t
+full_read_from_nonblocking_fd (size_t fd, void *buf, size_t count)
+{
+  size_t bytes_read;
+
+  bytes_read = 0;
+  while (bytes_read < count)
+    {
+      TIMING_DECLS
+      ssize_t ret;
+      int saved_errno;
+
+      dbgfprintf (stderr, "%s: >> read (%lu)\n", PROG_ROLE,
+                  (unsigned long) (count - bytes_read));
+      START_TIMING
+      ret = read (fd, (char *) buf + bytes_read, count - bytes_read);
+      saved_errno = errno;
+      END_TIMING
+      dbgfprintf (stderr, "%s: << read -> %ld%s\n", PROG_ROLE,
+                  (long) ret, dbgstrerror (ret < 0, saved_errno));
+      /* This assertion fails if the non-blocking flag is effectively not set
+         on fd.  */
+      ASSERT (spent_time < 0.5);
+      if (ret < 0)
+        {
+          ASSERT (saved_errno == EAGAIN);
+          usleep (SMALL_DELAY);
+        }
+      else
+        {
+          ASSERT (ret > 0);
+          bytes_read += ret;
+        }
+    }
+  return bytes_read;
+}
+
+/* Execute the reader loop.  */
+static void
+main_reader_loop (int test, size_t data_block_size, int fd)
+{
+  unsigned char *expected;
+  unsigned char *data;
+
+  /* Set up the expected data.  */
+  expected = init_data (data_block_size);
+
+  data = (unsigned char *) malloc (2 * data_block_size);
+  ASSERT (data != NULL);
+
+  switch (test)
+    {
+    TIMING_DECLS
+    ssize_t ret;
+
+    case 0: /* Test blocking write() with blocking read().  */
+    case 1: /* Test non-blocking write() with blocking read().  */
+      START_TIMING
+      ret = full_read (fd, data, data_block_size);
+      END_TIMING
+      ASSERT (ret == data_block_size);
+      ASSERT (memcmp (data, expected, data_block_size) == 0);
+      ASSERT (spent_time > 0.5);
+      /* This assertion fails if data_block_size is very large and
+         ENABLE_DEBUGGING is 1.  */
+      ASSERT (spent_time < 1.5);
+
+      usleep (1000000);
+
+      START_TIMING
+      ret = full_read (fd, data, data_block_size);
+      END_TIMING
+      ASSERT (ret == data_block_size);
+      ASSERT (memcmp (data, expected + data_block_size, data_block_size) == 0);
+      /* This assertion fails if data_block_size is much larger than needed
+         and SMALL_DELAY is too large.  */
+      ASSERT (spent_time < 0.5);
+
+      break;
+
+    case 2: /* Test blocking write() with non-blocking read().  */
+    case 3: /* Test non-blocking write() with non-blocking read().  */
+      START_TIMING
+      ret = full_read_from_nonblocking_fd (fd, data, data_block_size);
+      END_TIMING
+      ASSERT (ret == data_block_size);
+      ASSERT (memcmp (data, expected, data_block_size) == 0);
+      ASSERT (spent_time > 0.5);
+      /* This assertion fails if data_block_size is much larger than needed
+         and SMALL_DELAY is too large, or if data_block_size is very large and
+         ENABLE_DEBUGGING is 1.  */
+      ASSERT (spent_time < 1.5);
+
+      usleep (1000000);
+
+      START_TIMING
+      ret = full_read_from_nonblocking_fd (fd, data, data_block_size);
+      END_TIMING
+      ASSERT (ret == data_block_size);
+      ASSERT (memcmp (data, expected + data_block_size, data_block_size) == 0);
+      /* This assertion fails if data_block_size is much larger than needed
+         and SMALL_DELAY is too large.  */
+      ASSERT (spent_time < 0.5);
+
+      break;
+
+    default:
+      abort ();
+    }
+
+  free (data);
+  free (expected);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-socket-child.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,52 @@
+/* Child program invoked by test-nonblocking-socket-main.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include "nonblocking.h"
+
+#include "macros.h"
+#include "socket-client.h"
+#include "test-nonblocking-socket.h"
+#define PROG_ROLE "child"
+#include "test-nonblocking-reader.h"
+
+int
+main (int argc, char *argv[])
+{
+  int test = atoi (argv[1]);
+  int port = atoi (argv[2]);
+  int client_socket;
+
+  /* Create a client socket.  */
+  client_socket = create_client_socket (port);
+
+  /* Prepare the file descriptor.  */
+  if (test & 2)
+    ASSERT (set_nonblocking_flag (client_socket, true) >= 0);
+
+  main_reader_loop (test, SOCKET_DATA_BLOCK_SIZE, client_socket);
+
+  return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-socket-main.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,121 @@
+/* Test for nonblocking read and write on sockets.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# include <process.h>
+#else
+# include <spawn.h>
+#endif
+
+#include "nonblocking.h"
+#include "wait-process.h"
+
+#include "macros.h"
+#include "socket-server.h"
+#include "test-nonblocking-socket.h"
+#define PROG_ROLE "main"
+#include "test-nonblocking-writer.h"
+
+int
+main (int argc, char *argv[])
+{
+  const char *child_path = argv[1];
+  int test = atoi (argv[2]);
+  int server;
+  int port;
+  int child;
+  int server_socket;
+  int exitcode;
+
+  /* Create a server socket.  */
+  server = create_server (0, 1, &port);
+
+  /* Spawn the child process.  */
+  {
+    char port_arg[10+1];
+    const char *child_argv[4];
+
+    sprintf (port_arg, "%u", port);
+    child_argv[0] = child_path;
+    child_argv[1] = argv[2];
+    child_argv[2] = port_arg;
+    child_argv[3] = NULL;
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+    child = spawnvpe (P_NOWAIT, child_path, child_argv,
+                      (const char **) environ);
+    ASSERT (child >= 0);
+#else
+    {
+      pid_t child_pid;
+      int err =
+        posix_spawnp (&child_pid, child_path, NULL, NULL, (char **) child_argv,
+                      environ);
+      ASSERT (err == 0);
+      child = child_pid;
+    }
+#endif
+  }
+
+  /* Accept a connection from the child process.  */
+  server_socket = create_server_socket (server);
+
+  /* Prepare the file descriptor.  */
+  if (test & 1)
+    ASSERT (set_nonblocking_flag (server_socket, true) >= 0);
+
+#if ENABLE_DEBUGGING
+# ifdef SO_SNDBUF
+  {
+    int value;
+    socklen_t value_len = sizeof (value);
+    if (getsockopt (server_socket, SOL_SOCKET, SO_SNDBUF, &value, &value_len) >= 0)
+      fprintf (stderr, "SO_SNDBUF = %d\n", value);
+  }
+# endif
+# ifdef SO_RCVBUF
+  {
+    int value;
+    socklen_t value_len = sizeof (value);
+    if (getsockopt (server_socket, SOL_SOCKET, SO_RCVBUF, &value, &value_len) >= 0)
+      fprintf (stderr, "SO_RCVBUF = %d\n", value);
+  }
+# endif
+#endif
+
+  exitcode =
+    main_writer_loop (test, SOCKET_DATA_BLOCK_SIZE, server_socket,
+                      SOCKET_HAS_LARGE_BUFFER);
+
+  {
+    int err =
+      wait_subprocess (child, child_path, false, false, false, false, NULL);
+    ASSERT (err == 0);
+  }
+
+  return exitcode;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-socket.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,51 @@
+/* Test for nonblocking read and write.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* A data block ought to be larger than the size of the in-kernel buffer.
+   Working values of SOCKET_DATA_BLOCK_SIZE, depending on kernel:
+
+     Platform                        SOCKET_DATA_BLOCK_SIZE
+
+     Linux                           >= 7350000 (depends on circumstances)
+     FreeBSD                         >= 107521
+     OpenBSD                         >= 28673
+     MacOS X                         >= 680000 (depends on circumstances)
+     AIX 5.1                         >= 125713
+     AIX 7.1                         >= 200000 (depends on circumstances)
+     HP-UX                           >= 114689
+     IRIX                            >= 61089
+     OSF/1                           >= 122881
+     Solaris 7                       >= 63000 (depends on circumstances)
+     Solaris 8                       >= 49153
+     Solaris 9                       >= 73729
+     Solaris 10                      >= 98305
+     Solaris 11 2010-11              >= 73729
+     Cygwin 1.5.x                    >= 66294401 but then write() fails with ENOBUFS
+     Cygwin 1.7.x                    >= 163838 (depends on circumstances)
+     native Win32                    >= 66294401
+ */
+#define SOCKET_DATA_BLOCK_SIZE 1000000
+
+/* On Linux, MacOS X, Cygwin 1.5.x, native Win32,
+   sockets have very large buffers in the kernel, so that write() calls
+   succeed before the reader has started reading, even if fd is blocking
+   and the amount of data is larger than 1 MB.  */
+#if defined __linux__ || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __WIN32__) || defined __CYGWIN__
+# define SOCKET_HAS_LARGE_BUFFER 1
+#else
+# define SOCKET_HAS_LARGE_BUFFER 0
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-socket.sh	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Test blocking write() with blocking read().
+./test-nonblocking-socket-main${EXEEXT} ./test-nonblocking-socket-child${EXEEXT} 0 || exit 1
+
+# Test non-blocking write() with blocking read().
+./test-nonblocking-socket-main${EXEEXT} ./test-nonblocking-socket-child${EXEEXT} 1 || exit 1
+
+# Test blocking write() with non-blocking read().
+./test-nonblocking-socket-main${EXEEXT} ./test-nonblocking-socket-child${EXEEXT} 2 || exit 1
+
+# Test non-blocking write() with non-blocking read().
+./test-nonblocking-socket-main${EXEEXT} ./test-nonblocking-socket-child${EXEEXT} 3 || exit 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nonblocking-writer.h	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,186 @@
+/* The writer part of a test program for non-blocking communication.
+
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This program implements 4 tests:
+
+   test == 0:
+     Test blocking write() with blocking read().
+
+     Timeline         Main process             Child process
+        0 s           Start                    Start, read(10000)
+        1 s           write(20000)             Return from read(10000)
+        2 s                                    Next read(10000)
+        2 s           Return from write(20000) Return from read(10000)
+
+   test == 1:
+     Test non-blocking write() with blocking read().
+
+     Timeline         Main process             Child process
+        0 s           Start                    Start, read(10000)
+        1 s           write(20000)             Return from read(10000)
+                      Return with at least 10000,
+                      Repeatedly continue
+                      write() of the rest
+        2 s                                    Next read(10000)
+        2 s           Return from write(10000) Return from read(10000)
+
+   test == 2:
+     Test blocking write() with non-blocking read().
+
+     Timeline         Main process             Child process
+        0 s           Start                    Start, read(10000)
+                                               repeatedly polling
+        1 s           write(20000)             Return from read(10000)
+        2 s                                    Next read(10000)
+        2 s           Return from write(20000) Return from read(10000)
+
+   test == 3:
+     Test non-blocking write() with non-blocking read().
+ */
+
+#include "test-nonblocking-misc.h"
+
+/* Execute the writer loop.
+   Returns 0 if successful, 1 if data_block_size is too small.  */
+static int
+main_writer_loop (int test, size_t data_block_size, int fd,
+                  bool has_large_buffer)
+{
+  int too_small = 0;
+  unsigned char *data;
+
+  /* Set up the data to transfer.  */
+  data = init_data (data_block_size);
+
+  switch (test)
+    {
+    TIMING_DECLS
+    ssize_t ret;
+
+    case 0: /* Test blocking write() with blocking read().  */
+    case 2: /* Test blocking write() with non-blocking read().  */
+      {
+        int saved_errno;
+
+        usleep (1000000);
+
+        dbgfprintf (stderr, "%s:1: >> write (%lu)\n", PROG_ROLE,
+                    (unsigned long) 2 * data_block_size);
+        START_TIMING
+        ret = write (fd, data, 2 * data_block_size);
+        saved_errno = errno;
+        END_TIMING
+        dbgfprintf (stderr, "%s:1: << write -> %ld%s\n", PROG_ROLE,
+                    (long) ret, dbgstrerror (ret < 0, saved_errno));
+        ASSERT (ret == 2 * data_block_size);
+        if (!has_large_buffer)
+          {
+            /* This assertion fails if data_block_size is too small.  */
+            if (!(spent_time > 0.5))
+              {
+                fprintf (stderr,
+                         "%s:1: spent_time = %g, data_block_size too small\n",
+                         PROG_ROLE, spent_time);
+                too_small = 1;
+              }
+          }
+        ASSERT (spent_time < 1.5);
+      }
+      break;
+
+    case 1: /* Test non-blocking write() with blocking read().  */
+    case 3: /* Test non-blocking write() with non-blocking read().  */
+      {
+        size_t bytes_written;
+        int saved_errno;
+
+        usleep (1000000);
+
+        bytes_written = 0;
+        while (bytes_written < 2 * data_block_size)
+          {
+            dbgfprintf (stderr, "%s:2: >> write (%lu)\n", PROG_ROLE,
+                        (unsigned long) (2 * data_block_size - bytes_written));
+            START_TIMING
+            ret = write (fd, data + bytes_written,
+                         2 * data_block_size - bytes_written);
+            saved_errno = errno;
+            END_TIMING
+            dbgfprintf (stderr, "%s:2: << write -> %ld%s\n", PROG_ROLE,
+                        (long) ret, dbgstrerror (ret < 0, saved_errno));
+            if (ret < 0 && bytes_written >= data_block_size)
+              {
+                ASSERT (saved_errno == EAGAIN);
+                ASSERT (spent_time < 0.5);
+                break;
+              }
+            /* This assertion fails if the non-blocking flag is effectively not
+               set on fd.  */
+            ASSERT (spent_time < 0.5);
+            if (ret < 0)
+              {
+                ASSERT (saved_errno == EAGAIN);
+                usleep (SMALL_DELAY);
+              }
+            else
+              {
+                /* This assertion fails if data_block_size is too small.  */
+                if (!(ret > 0))
+                  {
+                    fprintf (stderr,
+                             "%s:1: spent_time = %g, data_block_size too small\n",
+                             PROG_ROLE, spent_time);
+                    too_small = 1;
+                  }
+                bytes_written += ret;
+              }
+          }
+        ASSERT (bytes_written >= data_block_size);
+
+        while (bytes_written < 2 * data_block_size)
+          {
+            dbgfprintf (stderr, "%s:3: >> write (%lu)\n", PROG_ROLE,
+                        (unsigned long) (2 * data_block_size - bytes_written));
+            START_TIMING
+            ret = write (fd, data + bytes_written,
+                         2 * data_block_size - bytes_written);
+            saved_errno = errno;
+            END_TIMING
+            dbgfprintf (stderr, "%s:3: << write -> %ld%s\n", PROG_ROLE,
+                        (long) ret, dbgstrerror (ret < 0, saved_errno));
+            ASSERT (spent_time < 0.5);
+            if (ret < 0)
+              {
+                ASSERT (saved_errno == EAGAIN);
+                usleep (SMALL_DELAY);
+              }
+            else
+              {
+                ASSERT (ret > 0);
+                bytes_written += ret;
+              }
+          }
+      }
+      break;
+
+    default:
+      abort ();
+    }
+
+  free (data);
+  return too_small;
+}
--- a/tests/test-nonblocking.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-nonblocking.c	Fri May 06 08:15:59 2011 -0700
@@ -33,13 +33,6 @@
   const char *file = "test-nonblock.tmp";
   int fd_file;
   int fd_pipe[2];
-  int fd_sock;
-  bool sock_works = true;
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* For now, we can't get nonblocking status of windows sockets.  */
-  sock_works = false;
-#endif
 
   fd_file = creat (file, 0600);
 
@@ -79,28 +72,39 @@
   ASSERT (close (fd_pipe[1]) == 0);
 
 #if GNULIB_TEST_PIPE2
-  /* mingw still lacks O_NONBLOCK replacement.  */
   ASSERT (pipe2 (fd_pipe, O_NONBLOCK) == 0);
-  ASSERT (get_nonblocking_flag (fd_pipe[0]) == !!O_NONBLOCK);
-  ASSERT (get_nonblocking_flag (fd_pipe[1]) == !!O_NONBLOCK);
+  ASSERT (get_nonblocking_flag (fd_pipe[0]) == 1);
+  ASSERT (get_nonblocking_flag (fd_pipe[1]) == 1);
   ASSERT (close (fd_pipe[0]) == 0);
   ASSERT (close (fd_pipe[1]) == 0);
 #endif /* GNULIB_TEST_PIPE2 */
 
-  /* Test sockets.  */
-  fd_sock = socket (AF_INET, SOCK_STREAM, 0);
-  ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1));
-  ASSERT (set_nonblocking_flag (fd_sock, true) == 0);
-  ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1));
-  ASSERT (set_nonblocking_flag (fd_sock, false) == 0);
-  ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1));
-  ASSERT (close (fd_sock) == 0);
+#if GNULIB_TEST_SOCKET
+  {
+    /* Test sockets.  */
+    bool sock_works = true;
+    int fd_sock;
+
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+    /* For now, we can't get nonblocking status of windows sockets.  */
+    sock_works = false;
+# endif
 
-#if SOCK_NONBLOCK
-  fd_sock = socket (AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
-  ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1));
-  ASSERT (close (fd_sock) == 0);
-#endif /* SOCK_NONBLOCK */
+    fd_sock = socket (AF_INET, SOCK_STREAM, 0);
+    ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1));
+    ASSERT (set_nonblocking_flag (fd_sock, true) == 0);
+    ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1));
+    ASSERT (set_nonblocking_flag (fd_sock, false) == 0);
+    ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 0 : -1));
+    ASSERT (close (fd_sock) == 0);
+
+# if SOCK_NONBLOCK
+    fd_sock = socket (AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
+    ASSERT (get_nonblocking_flag (fd_sock) == (sock_works ? 1 : -1));
+    ASSERT (close (fd_sock) == 0);
+# endif /* SOCK_NONBLOCK */
+  }
+#endif /* GNULIB_TEST_SOCKET */
 
   /* Test error handling.  */
   {
--- a/tests/test-open.h	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-open.h	Fri May 06 08:15:59 2011 -0700
@@ -63,6 +63,12 @@
   ASSERT (write (fd, "c", 1) == 1);
   ASSERT (close (fd) == 0);
 
+  /* Although O_NONBLOCK on regular files can be ignored, it must not
+     cause a failure.  */
+  fd = func (BASE "file", O_NONBLOCK | O_RDONLY);
+  ASSERT (0 <= fd);
+  ASSERT (close (fd) == 0);
+
   /* Symlink handling, where supported.  */
   if (symlink (BASE "file", BASE "link") != 0)
     {
--- a/tests/test-passfd.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-passfd.c	Fri May 06 08:15:59 2011 -0700
@@ -18,6 +18,7 @@
 
 #include "passfd.h"
 
+#include <errno.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -33,6 +34,7 @@
 int
 main ()
 {
+#if HAVE_SOCKETPAIR
   int pair[2];
   int ret;
   pid_t pid;
@@ -41,11 +43,11 @@
   int fd;
   struct stat st;
 
-#if HAVE_DECL_ALARM
+# if HAVE_DECL_ALARM
   /* Avoid hanging on failure.  */
   signal (SIGALRM, SIG_DFL);
   alarm (5);
-#endif
+# endif
 
   fdnull = open ("/dev/null", O_RDWR);
   if (fdnull < 0)
@@ -115,4 +117,17 @@
         }
       return 0;
     }
+#else
+  errno = 0;
+  ASSERT(sendfd (0, 0) == -1);
+  ASSERT(errno == ENOSYS);
+
+  errno = 0;
+  ASSERT(recvfd (0, 0) == -1);
+  ASSERT(errno == ENOSYS);
+
+  fputs ("skipping test: socketpair not supported on this system\n",
+         stderr);
+  return 77;
+#endif
 }
--- a/tests/test-pipe2.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-pipe2.c	Fri May 06 08:15:59 2011 -0700
@@ -33,6 +33,7 @@
 
 #include "binary-io.h"
 #include "macros.h"
+#include "nonblocking.h"
 
 /* Return true if FD is open.  */
 static bool
@@ -67,49 +68,23 @@
 #endif
 }
 
-/* Return true if FD is in non-blocking mode.  */
-static bool
-is_nonblocking (int fd)
-{
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* We don't use the non-blocking mode for sockets here.  */
-  return 0;
-#else
-  int flags;
-  ASSERT ((flags = fcntl (fd, F_GETFL)) >= 0);
-  return (flags & O_NONBLOCK) != 0;
-#endif
-}
-
 int
 main ()
 {
   int use_nonblocking;
   int use_cloexec;
 
-#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
   for (use_nonblocking = 0; use_nonblocking <= 1; use_nonblocking++)
-#else
-  use_nonblocking = 0;
-#endif
-#if O_CLOEXEC
-    for (use_cloexec = 0; use_cloexec <= 1; use_cloexec++)
-#else
-    use_cloexec = 0;
-#endif
+    for (use_cloexec = 0; use_cloexec <= !!O_CLOEXEC; use_cloexec++)
       {
         int o_flags;
         int fd[2];
 
         o_flags = 0;
-#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
         if (use_nonblocking)
           o_flags |= O_NONBLOCK;
-#endif
-#if O_CLOEXEC
         if (use_cloexec)
           o_flags |= O_CLOEXEC;
-#endif
 
         fd[0] = -1;
         fd[1] = -1;
@@ -131,14 +106,17 @@
           }
         if (use_nonblocking)
           {
-            ASSERT (is_nonblocking (fd[0]));
-            ASSERT (is_nonblocking (fd[1]));
+            ASSERT (get_nonblocking_flag (fd[0]) == 1);
+            ASSERT (get_nonblocking_flag (fd[1]) == 1);
           }
         else
           {
-            ASSERT (!is_nonblocking (fd[0]));
-            ASSERT (!is_nonblocking (fd[1]));
+            ASSERT (get_nonblocking_flag (fd[0]) == 0);
+            ASSERT (get_nonblocking_flag (fd[1]) == 0);
           }
+
+        ASSERT (close (fd[0]) == 0);
+        ASSERT (close (fd[1]) == 0);
       }
 
   return 0;
--- a/tests/test-renameat.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-renameat.c	Fri May 06 08:15:59 2011 -0700
@@ -33,7 +33,6 @@
 #include <sys/stat.h>
 
 #include "filenamecat.h"
-#include "xgetcwd.h"
 #include "ignore-value.h"
 #include "macros.h"
 
@@ -79,7 +78,8 @@
   dfd = creat (BASE "00", 0600);
   ASSERT (0 <= dfd);
   ASSERT (close (dfd) == 0);
-  cwd = xgetcwd ();
+  cwd = getcwd (NULL, 0);
+  ASSERT (cwd);
 
   dfd = open (BASE "sub1", O_RDONLY);
   ASSERT (0 <= dfd);
--- a/tests/test-stdio-c++.cc	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-stdio-c++.cc	Fri May 06 08:15:59 2011 -0700
@@ -36,6 +36,14 @@
 SIGNATURE_CHECK (GNULIB_NAMESPACE::fflush, int, (FILE *));
 #endif
 
+#if GNULIB_TEST_FGETC
+SIGNATURE_CHECK (GNULIB_NAMESPACE::fgetc, int, (FILE *));
+#endif
+
+#if GNULIB_TEST_FGETS
+SIGNATURE_CHECK (GNULIB_NAMESPACE::fgets, char *, (char *, int, FILE *));
+#endif
+
 #if GNULIB_TEST_FOPEN
 SIGNATURE_CHECK (GNULIB_NAMESPACE::fopen, FILE *,
                  (const char *, const char *));
@@ -57,11 +65,20 @@
 SIGNATURE_CHECK (GNULIB_NAMESPACE::fputs, int, (const char *, FILE *));
 #endif
 
+#if GNULIB_TEST_FREAD
+SIGNATURE_CHECK (GNULIB_NAMESPACE::fread, size_t,
+                 (void *, size_t, size_t, FILE *));
+#endif
+
 #if GNULIB_TEST_FREOPEN
 SIGNATURE_CHECK (GNULIB_NAMESPACE::freopen, FILE *,
                  (const char *, const char *, FILE *));
 #endif
 
+#if GNULIB_TEST_FSCANF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::fscanf, int, (FILE *, const char *, ...));
+#endif
+
 #if GNULIB_TEST_FSEEK
 SIGNATURE_CHECK (GNULIB_NAMESPACE::fseek, int, (FILE *, long, int));
 #endif
@@ -83,6 +100,14 @@
                  (const void *, size_t, size_t, FILE *));
 #endif
 
+#if GNULIB_TEST_GETC
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getc, int, (FILE *));
+#endif
+
+#if GNULIB_TEST_GETCHAR
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getchar, int, (void));
+#endif
+
 #if GNULIB_TEST_GETDELIM
 SIGNATURE_CHECK (GNULIB_NAMESPACE::getdelim, ssize_t,
                  (char **, size_t *, int, FILE *));
@@ -93,6 +118,10 @@
                  (char **, size_t *, FILE *));
 #endif
 
+#if GNULIB_TEST_GETS
+SIGNATURE_CHECK (GNULIB_NAMESPACE::gets, char *, (char *));
+#endif
+
 #if GNULIB_TEST_OBSTACK_PRINTF || GNULIB_TEST_OBSTACK_PRINTF_POSIX
 SIGNATURE_CHECK (GNULIB_NAMESPACE::obstack_printf, int,
                  (struct obstack *, const char *, ...));
@@ -140,6 +169,10 @@
                  (int, char const *, int, char const *));
 #endif
 
+#if GNULIB_TEST_SCANF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::scanf, int, (const char *, ...));
+#endif
+
 #if GNULIB_TEST_SNPRINTF
 SIGNATURE_CHECK (GNULIB_NAMESPACE::snprintf, int,
                  (char *, size_t, const char *, ...));
@@ -170,10 +203,19 @@
                  (FILE *, const char *, va_list));
 #endif
 
+#if GNULIB_TEST_VFSCANF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::vfscanf, int,
+                 (FILE *, const char *, va_list));
+#endif
+
 #if GNULIB_TEST_VPRINTF_POSIX || GNULIB_TEST_VPRINTF
 SIGNATURE_CHECK (GNULIB_NAMESPACE::vprintf, int, (const char *, va_list));
 #endif
 
+#if GNULIB_TEST_VSCANF
+SIGNATURE_CHECK (GNULIB_NAMESPACE::vscanf, int, (const char *, va_list));
+#endif
+
 #if GNULIB_TEST_VSNPRINTF
 SIGNATURE_CHECK (GNULIB_NAMESPACE::vsnprintf, int,
                  (char *, size_t, const char *, va_list));
--- a/tests/test-sys_socket.c	Fri Apr 01 16:04:45 2011 -0700
+++ b/tests/test-sys_socket.c	Fri May 06 08:15:59 2011 -0700
@@ -30,6 +30,12 @@
 /* Check that the 'socklen_t' type is defined.  */
 socklen_t t1;
 
+/* Check that 'struct iovec' is defined.  */
+struct iovec io;
+
+/* Check that a minimal set of 'struct msghdr' is defined.  */
+struct msghdr msg;
+
 int
 main (void)
 {
@@ -51,10 +57,8 @@
 
   x.ss_family = 42;
   i = 42;
+  msg.msg_iov = &io;
 
-  /* Tell the compiler that these variables are used.  */
-  (void) x;
-  (void) i;
-
-  return 0;
+  return (x.ss_family - i + msg.msg_namelen + msg.msg_iov->iov_len
+          + msg.msg_iovlen);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-sys_uio.c	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,32 @@
+/* Test of <sys/uio.h> substitute.
+   Copyright (C) 2011 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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <eblake@redhat.com>, 2011.  */
+
+#include <config.h>
+
+#include <sys/uio.h>
+
+/* Check that necessary types are defined.  */
+size_t a;
+ssize_t b;
+struct iovec c;
+
+int
+main (void)
+{
+  return a + b + !!c.iov_base + c.iov_len;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/top/README-release	Fri May 06 08:15:59 2011 -0700
@@ -0,0 +1,89 @@
+Here are most of the steps we (maintainers) follow when making a release.
+
+* start from a clean, up-to-date git directory.
+
+    git checkout master; git pull
+
+* Run ./configure && make maintainer-clean
+
+* Ensure that the desired versions of autoconf, automake, etc.
+  are in your PATH.  See the buildreq list in bootstrap.conf for
+  the complete list.
+
+* Ensure that you're on "master" with no uncommitted diffs.
+  This should produce no output: git checkout master; git diff
+
+* Ensure that you've pushed all changes that belong in the release
+  and that the NixOS/Hydra autobuilder is reporting all is well:
+
+      http://hydra.nixos.org/jobset/gnu/@PACKAGE@-master
+
+* Run bootstrap one last time.  This downloads any new translations:
+
+    ./bootstrap
+
+* Pre-release testing:
+  Ensure that make check syntax-check succeeds.
+
+* Run "make distcheck"
+
+* Set the date, version number, and release type [stable/alpha/beta] on
+  line 3 of NEWS, commit that, and tag the release by running e.g.,
+
+    build-aux/do-release-commit-and-tag X.Y stable
+
+* Run the following to create release tarballs.  Your choice selects the
+  corresponding upload-to destination in the emitted gnupload command.
+  The different destinations are specified in cfg.mk.  See the definitions
+  of gnu_ftp_host-{alpha,beta,stable}.
+
+    # "TYPE" must be stable, beta or alpha
+    make TYPE
+
+* Test the tarball.  copy it to a few odd-ball systems and ensure that
+  it builds and passes all tests.
+
+* While that's happening, write the release announcement that you will
+  soon post.  Start with the template, $HOME/announce-@PACKAGE@-X.Y
+  that was just created by that "make" command.
+
+Once all the builds and tests have passed,
+
+* Run the gnupload command that was suggested by your "make stable" run above.
+
+* Wait a few minutes (maybe up to 30?) and then use the release URLs to
+  download all tarball/signature pairs and use gpg --verify to ensure
+  that they're all valid.
+
+* Push the NEWS-updating changes and the new tag:
+
+    v=$(cat .prev-version)
+    git push origin master tag v$v
+
+* Announce it on Savannah first, so you can include the preferable
+  savannah.org announcement link in the email message.
+
+  From here:
+    https://savannah.gnu.org/projects/@PACKAGE@/
+  click on the "submit news", then write something like the following:
+  (If there is no such button, then enable "News" for the project via
+   the Main -> "Select Features" menu item, or via this link:
+   https://savannah.gnu.org/project/admin/editgroupfeatures.php?group=@PACKAGE@)
+
+    Subject: @PACKAGE@-X.Y released [stable]
+    +verbatim+
+    ...paste the announcement here...
+    -verbatim-
+
+  Then go here to approve it:
+    https://savannah.gnu.org/news/approve.php?group=@PACKAGE@
+
+* Send the announcement email message.
+
+* After each non-alpha release, update the on-line manual accessible via
+
+    http://www.gnu.org/software/@PACKAGE@/manual/
+
+  by running this:
+
+    build-aux/gnu-web-doc-update
--- a/top/maint.mk	Fri Apr 01 16:04:45 2011 -0700
+++ b/top/maint.mk	Fri May 06 08:15:59 2011 -0700
@@ -33,7 +33,6 @@
 
 GIT = git
 VC = $(GIT)
-VC-tag = git tag -s -m '$(VERSION)' 'v$(VERSION)' -u '$(gpg_key_ID)'
 
 VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
 
@@ -823,8 +822,8 @@
   END { exit defined $$fail }
 sc_prohibit_empty_lines_at_EOF:
 	@perl -le '$(require_exactly_one_NL_at_EOF_)' $$($(VC_LIST_EXCEPT)) \
-          || { echo '$(ME): empty line(s) or no newline at EOF' 	\
-		1>&2; exit 1; } || :;					\
+	  || { echo '$(ME): empty line(s) or no newline at EOF'		\
+		1>&2; exit 1; } || :
 
 # Make sure we don't use st_blocks.  Use ST_NBLOCKS instead.
 # This is a bit of a kludge, since it prevents use of the string
@@ -841,6 +840,31 @@
 	halt='do not define S_IS* macros; include <sys/stat.h>'		\
 	  $(_sc_search_regexp)
 
+prohibit_doubled_word_RE_ ?= \
+  /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims
+prohibit_doubled_word_ =						\
+    -e 'while ($(prohibit_doubled_word_RE_))'				\
+    -e '  {'								\
+    -e '    $$n = ($$` =~ tr/\n/\n/ + 1);'				\
+    -e '    ($$v = $$&) =~ s/\n/\\n/g;'					\
+    -e '    print "$$ARGV:$$n:$$v\n";'					\
+    -e '  }'
+
+# Define this to a regular expression that matches
+# any filename:dd:match lines you want to ignore.
+# The default is to ignore no matches.
+ignore_doubled_word_match_RE_ ?= ^$$
+
+sc_prohibit_doubled_word:
+	@perl -n -0777 $(prohibit_doubled_word_) $$($(VC_LIST_EXCEPT))	\
+	  | grep -vE '$(ignore_doubled_word_match_RE_)'			\
+	  | grep . && { echo '$(ME): doubled words' 1>&2; exit 1; } || :
+
+sc_prohibit_can_not:
+	@prohibit='\<can[ ]not\>'					\
+	halt='use "cannot", not "can'' not"'				\
+	  $(_sc_search_regexp)
+
 _ptm1 = use "test C1 && test C2", not "test C1 -''a C2"
 _ptm2 = use "test C1 || test C2", not "test C1 -''o C2"
 # Using test's -a and -o operators is not portable.
@@ -917,16 +941,23 @@
 # Ensure that we use only the standard $(VAR) notation,
 # not @...@ in Makefile.am, now that we can rely on automake
 # to emit a definition for each substituted variable.
-# We use perl rather than "grep -nE ..." to exempt a single
-# use of an @...@-delimited variable name in src/Makefile.am.
+# However, there is still one case in which @VAR@ use is not just
+# legitimate, but actually required: when augmenting an automake-defined
+# variable with a prefix.  For example, gettext uses this:
+# MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@
+# otherwise, makeinfo would put German or French (current locale)
+# navigation hints in the otherwise-English documentation.
+#
 # Allow the package to add exceptions via a hook in cfg.mk;
 # for example, @PRAGMA_SYSTEM_HEADER@ can be permitted by
 # setting this to ' && !/PRAGMA_SYSTEM_HEADER/'.
 _makefile_at_at_check_exceptions ?=
 sc_makefile_at_at_check:
-	@perl -ne '/\@[A-Z_0-9]+\@/'$(_makefile_at_at_check_exceptions)	\
+	@perl -ne '/\@[A-Z_0-9]+\@/'					\
+          -e ' && !/([A-Z_0-9]+)\s+=.*\@\1\@$$/'			\
+          -e ''$(_makefile_at_at_check_exceptions)			\
 	  -e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}'	\
-	    $$($(VC_LIST_EXCEPT) | grep -E '(^|/)Makefile\.am$$')	\
+	    $$($(VC_LIST_EXCEPT) | grep -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \
 	  && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
 
 news-check: NEWS
@@ -1092,11 +1123,20 @@
 	  | sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig)
 
 translation_project_ ?= coordinator@translationproject.org
-announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT)
-announcement_mail_headers_ ?=						\
-To: info-gnu@gnu.org							\
-Cc: $(announcement_Cc_)							\
-Mail-Followup-To: $(PACKAGE_BUGREPORT)
+
+# Make info-gnu the default only for a stable release.
+ifeq ($(RELEASE_TYPE),stable)
+  announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT)
+  announcement_mail_headers_ ?=						\
+    To: info-gnu@gnu.org						\
+    Cc: $(announcement_Cc_)						\
+    Mail-Followup-To: $(PACKAGE_BUGREPORT)
+else
+  announcement_Cc_ ?= $(translation_project_)
+  announcement_mail_headers_ ?=						\
+    To: $(PACKAGE_BUGREPORT)						\
+    Cc: $(announcement_Cc_)
+endif
 
 announcement: NEWS ChangeLog $(rel-files)
 	@$(build_aux)/announce-gen					\
--- a/users.txt	Fri Apr 01 16:04:45 2011 -0700
+++ b/users.txt	Fri May 06 08:15:59 2011 -0700
@@ -7,6 +7,7 @@
   anubis          http://cvs.sv.gnu.org/viewcvs/anubis/anubis/
   augeas          http://augeas.net/
   autobuild       http://josefsson.org/autobuild/
+  barcode         http://git.sv.gnu.org/cgit/barcode.git/
   bison           http://git.sv.gnu.org/gitweb/?p=bison.git
   clisp           http://clisp.cvs.sourceforge.net/clisp/clisp/
   coreutils       http://git.sv.gnu.org/gitweb/?p=coreutils.git