Merge commit 'stable/20110609'
authorIan Beckwith <ianb@erislabs.net>
Fri, 10 Jun 2011 01:09:47 +0000 (02:09 +0100)
committerIan Beckwith <ianb@erislabs.net>
Fri, 10 Jun 2011 01:09:47 +0000 (02:09 +0100)
664 files changed:
ChangeLog
DEPENDENCIES
MODULES.html.sh
NEWS
NEWS.stable
README
STATUS-libposix [new file with mode: 0644]
build-aux/announce-gen
build-aux/bootstrap
build-aux/config.guess
build-aux/config.sub
build-aux/depcomp
build-aux/do-release-commit-and-tag
build-aux/install-reloc
build-aux/texinfo.tex
build-aux/useless-if-before-free
build-aux/vc-list-files
doc/glibc-functions/group_member.texi
doc/glibc-functions/mkostemp.texi
doc/glibc-functions/mkostemps.texi
doc/glibc-functions/mkstemps.texi
doc/glibc-functions/pipe2.texi
doc/glibc-functions/strchrnul.texi
doc/gnulib-intro.texi
doc/gnulib-tool.texi
doc/gnulib.texi
doc/intprops.texi [new file with mode: 0644]
doc/lgpl-2.1.texi
doc/maintain.texi
doc/posix-functions/accept.texi
doc/posix-functions/dup2.texi
doc/posix-functions/fclose.texi
doc/posix-functions/fgetc.texi
doc/posix-functions/fgets.texi
doc/posix-functions/fprintf.texi
doc/posix-functions/fputc.texi
doc/posix-functions/fputs.texi
doc/posix-functions/fread.texi
doc/posix-functions/fscanf.texi
doc/posix-functions/fwrite.texi
doc/posix-functions/gai_strerror.texi
doc/posix-functions/getc.texi
doc/posix-functions/getchar.texi
doc/posix-functions/getcwd.texi
doc/posix-functions/gets.texi
doc/posix-functions/iconv.texi
doc/posix-functions/memchr.texi
doc/posix-functions/mkstemp.texi
doc/posix-functions/open.texi
doc/posix-functions/printf.texi
doc/posix-functions/putc.texi
doc/posix-functions/putchar.texi
doc/posix-functions/puts.texi
doc/posix-functions/read.texi
doc/posix-functions/realpath.texi
doc/posix-functions/scanf.texi
doc/posix-functions/setlocale.texi
doc/posix-functions/socket.texi
doc/posix-functions/strtod.texi
doc/posix-functions/vfprintf.texi
doc/posix-functions/vfscanf.texi
doc/posix-functions/vprintf.texi
doc/posix-functions/vscanf.texi
doc/posix-functions/write.texi
doc/posix-headers/assert.texi
doc/posix-headers/fcntl.texi
doc/posix-headers/signal.texi
doc/posix-headers/sys_select.texi
doc/posix-headers/sys_socket.texi
doc/posix-headers/sys_uio.texi
doc/posix-headers/wctype.texi
doc/regex.texi
doc/standards.texi
doc/verify.texi
gnulib-tool
lib/alignof.h
lib/allocator.c [new file with mode: 0644]
lib/allocator.h [new file with mode: 0644]
lib/areadlink.c
lib/areadlinkat.c
lib/argmatch.h
lib/argp-help.c
lib/argp-parse.c
lib/assert.in.h [new file with mode: 0644]
lib/canonicalize-lgpl.c
lib/careadlinkat.c [new file with mode: 0644]
lib/careadlinkat.h [new file with mode: 0644]
lib/clean-temp.h
lib/close-hook.c [deleted file]
lib/close-hook.h [deleted file]
lib/close.c
lib/count-one-bits.h
lib/dup3.c
lib/euidaccess.c
lib/execute.c
lib/fchdir.c
lib/fclose.c
lib/fcntl.in.h
lib/fd-hook.c [new file with mode: 0644]
lib/fd-hook.h [new file with mode: 0644]
lib/fnmatch_loop.c
lib/fts.c
lib/gai_strerror.c
lib/gc.h
lib/gen-uni-tables.c
lib/getcwd-lgpl.c [new file with mode: 0644]
lib/getsockopt.c
lib/glthread/thread.h
lib/group-member.c
lib/group-member.h [deleted file]
lib/hash.c
lib/intprops.h
lib/inttypes.in.h
lib/ioctl.c
lib/localename.c
lib/localename.h
lib/malloc.c
lib/malloca.c
lib/mbrtowc.c
lib/mgetgroups.c
lib/mgetgroups.h
lib/mkstemp.c
lib/netdb.in.h
lib/nonblocking.c
lib/open.c
lib/openat-proc.c
lib/opendir-safer.c
lib/parse-datetime.y
lib/passfd.c
lib/pipe-filter-aux.h
lib/pipe-filter-ii.c
lib/pipe2.c
lib/progreloc.c
lib/quotearg.c
lib/read.c [new file with mode: 0644]
lib/realloc.c
lib/relocatable.c
lib/relocatable.h
lib/relocwrapper.c
lib/save-cwd.c
lib/setenv.c
lib/signal.in.h
lib/sockets.c
lib/spawn-pipe.c
lib/stat-time.h
lib/stdint.in.h
lib/stdio-read.c [new file with mode: 0644]
lib/stdio-write.c
lib/stdio.in.h
lib/stdlib.in.h
lib/string.in.h
lib/strptime.c
lib/strtol.c
lib/sys_select.in.h
lib/sys_socket.in.h
lib/sys_uio.in.h [new file with mode: 0644]
lib/trim.c
lib/unigbrk.in.h
lib/unistd.in.h
lib/unsetenv.c
lib/userspec.c
lib/utimecmp.c
lib/utimensat.c
lib/verify.h
lib/wchar.in.h
lib/wctype.in.h
lib/write.c
lib/xalloc-oversized.h [new file with mode: 0644]
lib/xalloc.h
lib/xgetgroups.c [new file with mode: 0644]
m4/afunix.m4 [deleted file]
m4/alloca.m4
m4/ansi-c++.m4
m4/argz.m4
m4/arpa_inet_h.m4
m4/assert_h.m4 [new file with mode: 0644]
m4/btowc.m4
m4/byteswap.m4
m4/canonicalize.m4
m4/dirent_h.m4
m4/dirfd.m4
m4/dup2-obsolete.m4 [new file with mode: 0644]
m4/dup2.m4
m4/duplocale.m4
m4/errno_h.m4
m4/fchdir.m4
m4/fclose.m4
m4/fcntl_h.m4
m4/fdopendir.m4
m4/fflush.m4
m4/float_h.m4
m4/fnmatch.m4
m4/fseeko.m4
m4/gc.m4
m4/getaddrinfo.m4
m4/getcwd-abort-bug.m4
m4/getcwd-path-max.m4
m4/getcwd.m4
m4/getdomainname.m4
m4/gethostname.m4
m4/getloadavg.m4
m4/glob.m4
m4/group-member.m4
m4/iconv_h.m4
m4/imaxabs.m4
m4/imaxdiv.m4
m4/inet_ntop.m4
m4/inet_pton.m4
m4/inttypes.m4
m4/ioctl.m4
m4/isnanf.m4
m4/isnanl.m4
m4/locale_h.m4
m4/manywarnings.m4
m4/mbrlen.m4
m4/mbrtowc.m4
m4/mbsinit.m4
m4/mbsnrtowcs.m4
m4/mbsrtowcs.m4
m4/memchr-obsolete.m4 [new file with mode: 0644]
m4/memchr.m4
m4/mkstemp.m4
m4/netdb_h.m4
m4/netinet_in_h.m4
m4/nonblocking.m4 [new file with mode: 0644]
m4/open.m4
m4/passfd.m4 [new file with mode: 0644]
m4/poll.m4
m4/poll_h.m4
m4/pthread.m4
m4/read.m4 [new file with mode: 0644]
m4/readlink.m4
m4/sched_h.m4
m4/selinux-context-h.m4
m4/setenv.m4
m4/setlocale.m4
m4/signal_h.m4
m4/spawn_h.m4
m4/stdarg.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/stdint.m4
m4/stdio_h.m4
m4/strchrnul.m4
m4/string_h.m4
m4/strtod-obsolete.m4 [new file with mode: 0644]
m4/strtod.m4
m4/strtoimax.m4
m4/strtoumax.m4
m4/sys_ioctl_h.m4
m4/sys_uio_h.m4 [new file with mode: 0644]
m4/sysexits.m4
m4/tzset.m4
m4/unistd_h.m4
m4/warnings.m4
m4/wchar_h.m4
m4/wcrtomb.m4
m4/wcsnrtombs.m4
m4/wcsrtombs.m4
m4/wctob.m4
m4/wcwidth.m4
m4/write.m4
modules/accept
modules/acosl
modules/alloca-opt
modules/allocator [new file with mode: 0644]
modules/areadlink
modules/areadlinkat
modules/argmatch
modules/argz
modules/arpa_inet
modules/asinl
modules/assert-h [new file with mode: 0644]
modules/atanl
modules/atoll
modules/bind
modules/btowc
modules/byteswap
modules/calloc
modules/canonicalize
modules/canonicalize-lgpl
modules/careadlinkat [new file with mode: 0644]
modules/ceil
modules/ceilf
modules/ceill
modules/chdir-long
modules/chown
modules/clock-time
modules/close
modules/close-hook [deleted file]
modules/connect
modules/copy-file
modules/cosl
modules/ctype
modules/dirent
modules/dirent-safer-tests
modules/dirfd
modules/dprintf
modules/dprintf-posix
modules/dup2
modules/dup2-obsolete [new file with mode: 0644]
modules/errno
modules/error
modules/euidaccess
modules/execute
modules/exit [deleted file]
modules/exitfail
modules/expl
modules/faccessat
modules/fchdir
modules/fchdir-tests
modules/fclose
modules/fclose-tests [new file with mode: 0644]
modules/fcntl
modules/fcntl-h
modules/fd-hook [new file with mode: 0644]
modules/fdopendir
modules/fflush
modules/filenamecat-lgpl
modules/float
modules/floor
modules/floorf
modules/floorl
modules/fnmatch
modules/fnmatch-posix
modules/fopen
modules/fprintf-posix
modules/fpurge
modules/freading
modules/frexp
modules/frexp-nolibm
modules/frexpl
modules/frexpl-nolibm
modules/fseek
modules/fsusage
modules/ftell
modules/ftello
modules/full-read
modules/futimens
modules/getcwd
modules/getcwd-lgpl [new file with mode: 0644]
modules/getcwd-lgpl-tests [new file with mode: 0644]
modules/getcwd-tests
modules/getdate
modules/getdelim
modules/getdomainname
modules/getgroups
modules/gethostname
modules/getline
modules/getloadavg
modules/getlogin_r
modules/getopt
modules/getopt-posix
modules/getpeername
modules/getsockname
modules/getsockopt
modules/getsubopt
modules/gettext
modules/getugroups
modules/getusershell
modules/git-merge-changelog
modules/glob
modules/gnumakefile
modules/grantpt
modules/group-member
modules/hash
modules/hash-tests
modules/iconv-h
modules/iconv_open
modules/iconv_open-utf
modules/idcache
modules/ignore-value
modules/imaxabs
modules/imaxdiv
modules/inet_ntop
modules/inet_pton
modules/intprops-tests [new file with mode: 0644]
modules/inttypes
modules/inttypes-incomplete [new file with mode: 0644]
modules/ioctl
modules/isapipe
modules/isfinite
modules/isinf
modules/langinfo
modules/lchown
modules/ldexpl
modules/link
modules/linkat
modules/linkat-tests
modules/listen
modules/locale
modules/localename
modules/localename-tests
modules/logl
modules/long-options
modules/lstat
modules/malloc
modules/math
modules/mbrlen
modules/mbrtowc
modules/mbsinit
modules/mbsnrtowcs
modules/mbsrtowcs
modules/mbtowc
modules/memchr
modules/memchr-obsolete [new file with mode: 0644]
modules/memcmp
modules/mgetgroups
modules/mkdir
modules/mkdtemp
modules/mkfifo
modules/mkfifoat
modules/mknod
modules/mkostemp
modules/mkostemps
modules/mkstemp
modules/mkstemps
modules/mktime
modules/nanosleep
modules/netdb
modules/netdb-c++-tests [new file with mode: 0644]
modules/netdb-tests
modules/netinet_in
modules/nonblocking
modules/nonblocking-pipe-tests [new file with mode: 0644]
modules/nonblocking-socket-tests [new file with mode: 0644]
modules/nonblocking-tests
modules/obstack
modules/open
modules/openat
modules/pagealign_alloc
modules/passfd
modules/passfd-tests
modules/perror
modules/pipe
modules/pipe-filter-gi
modules/pipe-filter-ii
modules/pipe2
modules/pipe2-tests
modules/poll
modules/poll-h
modules/popen
modules/posix_spawn
modules/posix_spawn_file_actions_addclose
modules/posix_spawn_file_actions_adddup2
modules/posix_spawn_file_actions_addopen
modules/posix_spawn_file_actions_destroy
modules/posix_spawn_file_actions_init
modules/posix_spawnattr_destroy
modules/posix_spawnattr_getflags
modules/posix_spawnattr_getpgroup
modules/posix_spawnattr_getschedparam
modules/posix_spawnattr_getschedpolicy
modules/posix_spawnattr_getsigdefault
modules/posix_spawnattr_getsigmask
modules/posix_spawnattr_init
modules/posix_spawnattr_setflags
modules/posix_spawnattr_setpgroup
modules/posix_spawnattr_setschedparam
modules/posix_spawnattr_setschedpolicy
modules/posix_spawnattr_setsigdefault
modules/posix_spawnattr_setsigmask
modules/posix_spawnp
modules/pread
modules/printf-posix
modules/pt_chown
modules/pthread
modules/ptsname
modules/pty
modules/putenv
modules/pwrite
modules/read [new file with mode: 0644]
modules/readline
modules/readlink
modules/readlinkat
modules/readme-release [new file with mode: 0644]
modules/realloc
modules/recv
modules/recvfrom
modules/regex
modules/relocatable-prog-wrapper
modules/remove
modules/rename
modules/rename-dest-slash
modules/renameat
modules/renameat-tests
modules/rmdir
modules/round
modules/roundf
modules/roundl
modules/rpmatch
modules/safe-read
modules/safe-write
modules/save-cwd
modules/savewd
modules/sched
modules/search
modules/select
modules/selinux-h
modules/send
modules/sendto
modules/setenv
modules/setlocale
modules/setsockopt
modules/shutdown
modules/sigaction
modules/signal
modules/signbit
modules/sigprocmask
modules/sinl
modules/sleep
modules/snprintf
modules/snprintf-posix
modules/socket
modules/sockets
modules/spawn
modules/spawn-pipe
modules/sprintf-posix
modules/sqrtl
modules/stat
modules/stdarg
modules/stdbool
modules/stddef
modules/stdint
modules/stdio
modules/stdlib
modules/strcase
modules/strchrnul
modules/strdup-posix
modules/strerror
modules/strerror_r-posix
modules/strftime-tests
modules/string
modules/strings
modules/strndup
modules/strnlen
modules/strptime
modules/strsep
modules/strsignal
modules/strstr-simple
modules/strtod
modules/strtod-obsolete [new file with mode: 0644]
modules/strtoimax
modules/strtok_r
modules/strtol
modules/strtoll
modules/strtoul
modules/strtoull
modules/strtoumax
modules/symlink
modules/symlinkat
modules/sys_file
modules/sys_ioctl
modules/sys_select
modules/sys_socket
modules/sys_stat
modules/sys_time
modules/sys_times
modules/sys_uio [new file with mode: 0644]
modules/sys_uio-tests [new file with mode: 0644]
modules/sys_utsname
modules/sys_wait
modules/sysexits
modules/tanl
modules/tcgetsid
modules/termios
modules/time
modules/tmpfile
modules/trunc
modules/truncf
modules/truncl
modules/tzset
modules/uname
modules/unictype/bidicategory-all
modules/unictype/bidicategory-byname
modules/unictype/bidicategory-name
modules/unictype/bidicategory-of
modules/unictype/bidicategory-test
modules/unistd
modules/unlink
modules/unlockpt
modules/unsetenv
modules/usleep
modules/utimecmp
modules/utimensat
modules/vasprintf
modules/vdprintf
modules/vdprintf-posix
modules/verify
modules/vfprintf-posix
modules/vfscanf [new file with mode: 0644]
modules/vprintf-posix
modules/vscanf [new file with mode: 0644]
modules/vsnprintf
modules/vsnprintf-posix
modules/vsprintf-posix
modules/wait-process
modules/wchar
modules/wcrtomb
modules/wcscasecmp
modules/wcscspn
modules/wcsdup
modules/wcsncasecmp
modules/wcsnrtombs
modules/wcspbrk
modules/wcsrtombs
modules/wcsspn
modules/wcsstr
modules/wcstok
modules/wcswidth
modules/wctob
modules/wctomb
modules/wctype
modules/wctype-h
modules/wcwidth
modules/write
modules/xalloc
modules/xalloc-oversized [new file with mode: 0644]
modules/xgetgroups [new file with mode: 0644]
modules/xsetenv
modules/xstrtol
tests/init.sh
tests/socket-client.h [new file with mode: 0644]
tests/socket-server.h [new file with mode: 0644]
tests/test-atexit.sh
tests/test-chown.h
tests/test-fclose.c [new file with mode: 0644]
tests/test-fcntl-h.c
tests/test-fflush.c
tests/test-fnmatch.c
tests/test-getaddrinfo.c
tests/test-getcwd-lgpl.c [new file with mode: 0644]
tests/test-getcwd.c
tests/test-hash.c
tests/test-intprops.c [new file with mode: 0644]
tests/test-inttostr.c
tests/test-lchown.h
tests/test-linkat.c
tests/test-netdb-c++.cc [new file with mode: 0644]
tests/test-nonblocking-misc.h [new file with mode: 0644]
tests/test-nonblocking-pipe-child.c [new file with mode: 0644]
tests/test-nonblocking-pipe-main.c [new file with mode: 0644]
tests/test-nonblocking-pipe.h [new file with mode: 0644]
tests/test-nonblocking-pipe.sh [new file with mode: 0755]
tests/test-nonblocking-reader.h [new file with mode: 0644]
tests/test-nonblocking-socket-child.c [new file with mode: 0644]
tests/test-nonblocking-socket-main.c [new file with mode: 0644]
tests/test-nonblocking-socket.h [new file with mode: 0644]
tests/test-nonblocking-socket.sh [new file with mode: 0755]
tests/test-nonblocking-writer.h [new file with mode: 0644]
tests/test-nonblocking.c
tests/test-open.h
tests/test-passfd.c
tests/test-pipe2.c
tests/test-renameat.c
tests/test-rmdir.h
tests/test-sameacls.c
tests/test-stdio-c++.cc
tests/test-sys_socket.c
tests/test-sys_uio.c [new file with mode: 0644]
tests/test-unistd-c++.cc
top/README-release [new file with mode: 0644]
top/maint.mk
users.txt

index be6cff3..f26d2c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2011-06-09  Bruno Haible  <bruno@clisp.org>
+
+       thread: Fix confusion between NULL and 0.
+       * lib/glthread/thread.h (gl_thread_self): Use NULL and 0 appropriately.
+       Reported by Paul Eggert.
+
+2011-06-09  Bruno Haible  <bruno@clisp.org>
+
+       acl tests: Fix compilation error on HP-UX 11.
+       * tests/test-sameacls.c: Include <sys/acl.h> also on HP-UX.
+
+2011-06-09  Bruno Haible  <bruno@clisp.org>
+
+       rmdir: Avoid test failure on HP-UX 10.20.
+       * tests/test-rmdir.h (test_rmdir_func): Accept ENOTEMPTY error, like
+       EEXIST.
+
+2011-06-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix usage message in 'mktempd_'
+       * tests/init.sh (mktempd_): In the usage message, use literal
+       'mktempd_', not '$ME' (which is even undefined), as the name of
+       the subroutine.
+
+2011-06-06  Eric Blake  <eblake@redhat.com>
+
+       canonicalize-lgpl: use common idiom
+       * m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Prefer older rm -rf
+       over newer POSIX -Rf.
+       Reported by Bruno Haible.
+
+       canonicalize-lgpl: work around AIX realpath bug
+       * m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Expose AIX bug.
+       * doc/posix-functions/realpath.texi (realpath): Document it.
+       Reported by Bruno Haible.
+
+2011-06-06  Bruno Haible  <bruno@clisp.org>
+
+       careadlinkat: Avoid mismatch between ssize_t and int.
+       * lib/careadlinkat.h (careadlinkatcwd): Declare as a function always.
+       * lib/careadlinkat.c (careadlinkatcwd): Define always.
+
+2011-06-05  Bruno Haible  <bruno@clisp.org>
+
+       ansi-c++-opt: Interoperability with libtool.
+       * m4/ansi-c++.m4 (gl_PROG_ANSI_CXX): When a C++ compiler is not found,
+       set the variable to "no", not to ":".
+       * NEWS: Mention the change.
+
+2011-06-05  Bruno Haible  <bruno@clisp.org>
+
+       acl: Fix test failure on AIX 7.
+       * tests/test-sameacls.c (main) [AIX]: Fix aclx_printStr invocation.
+       Based on a patch by Jørn Amundsen <Jorn.Amundsen@ntnu.no>.
+
+2011-06-05  Bruno Haible  <bruno@clisp.org>
+
+       pipe-filter-ii: Fix test failure on AIX and IRIX.
+       * lib/pipe-filter-ii.c (pipe_filter_ii_execute): When write() fails
+       with EAGAIN, retry with a smaller buffer size.
+
+2011-06-05  Bruno Haible  <bruno@clisp.org>
+
+       localename: Fix link dependencies.
+       * modules/localename (Link): Mention $(LIBTHREAD) or $(LTLIBTHREAD).
+       * modules/localename-tests (Makefile.am): Link test-localename with
+       $(LIBTHREAD).
+
+2011-06-05  Bruno Haible  <bruno@clisp.org>
+
+       unsetenv: Avoid gcc warning.
+       * lib/unsetenv.c (unsetenv): Provide declaration if system lacks it.
+
+2011-06-05  Bruno Haible  <bruno@clisp.org>
+
+       setenv: Avoid gcc warning.
+       * lib/setenv.c (setenv): Provide declaration if system lacks it.
+
+2011-06-05  Bruno Haible  <bruno@clisp.org>
+
+       sys_select: Ensure memset is declared also on AIX 7.
+       * lib/sys_select.in.h: Include <string.h> also on AIX.
+       * doc/posix-headers/sys_select.texi: Mention that <sys/select.h> is not
+       self-contained also on AIX 7.1.
+
+2011-06-04  Bruno Haible  <bruno@clisp.org>
+
+       setlocale: Enable replacement on Cygwin 1.5.
+       * m4/setlocale.m4 (gl_FUNC_SETLOCALE): Set REPLACE_SETLOCALE also on
+       Cygwin 1.5.x.
+       * doc/posix-functions/setlocale.texi: Mention that the problem with the
+       LC_CTYPE category also exists on Cygwin 1.5.x.
+
+2011-06-03  Bruno Haible  <bruno@clisp.org>
+
+       Copyright: Use LGPL 2.1 instead of LGPL 2.0.
+       * lib/localename.h: Update copyright header.
+       * lib/localename.c: Likewise.
+       * lib/relocatable.h: Likewise.
+       * lib/relocatable.c: Likewise.
+
+2011-06-02  Bruno Haible  <bruno@clisp.org>
+
+       doc: Fix a module name.
+       * doc/posix-functions/open.texi: Fix module name 'nonblocking'.
+
+2011-06-02  Bruno Haible  <bruno@clisp.org>
+
+       pipe2: Remove dependency on 'nonblocking' module.
+       * lib/pipe2.c: Include verify.h. Include nonblocking.h only if
+       O_NONBLOCK is defined by gnulib.
+       (pipe2) [WIN32]: If O_NONBLOCK is not defined by gnulib, verify that it
+       is zero.
+       * modules/pipe2 (Depends-on): Add verify. Remove nonblocking.
+       * tests/test-pipe2.c: Include nonblocking.h only if O_NONBLOCK is
+       defined by gnulib.
+       (get_nonblocking_flag): New function.
+       (main): Test O_NONBLOCK flag only if it is nonzero.
+       * doc/glibc-functions/pipe2.texi: Mention the 'nonblocking' module.
+
+2011-05-31  Bruno Haible  <bruno@clisp.org>
+
+       Fix link errors in tests: openat-die uses gettext-h.
+       * modules/areadlinkat-tests (Makefile.am): Link test-areadlinkat
+       against $(LIBINTL).
+       * modules/dirent-safer-tests (Makefile.am): Link test-dirent-safer
+       against $(LIBINTL).
+       * modules/fdopendir-tests (Makefile.am): Link test-fdopendir against
+       $(LIBINTL).
+       * modules/fdutimensat-tests (Makefile.am): Link test-fdutimensat
+       against $(LIBINTL).
+       * modules/linkat-tests (Makefile.am): Link test-linkat against
+       $(LIBINTL).
+       * modules/mkfifoat-tests (Makefile.am): Link test-mkfifoat against
+       $(LIBINTL).
+       * modules/openat-safer-tests (Makefile.am): Link test-openat-safer
+       against $(LIBINTL).
+       * modules/openat-tests (Makefile.am): Link test-fchownat, test-fstatat,
+       test-mkdirat, test-openat, test-unlinkat against $(LIBINTL).
+       * modules/readlinkat-tests (Makefile.am): Link test-readlinkat against
+       $(LIBINTL).
+       * modules/symlinkat-tests (Makefile.am): Link test-symlinkat against
+       $(LIBINTL).
+       * modules/utimensat-tests (Makefile.am): Link test-utimensat against
+       $(LIBINTL).
+       Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
+2011-05-31  Bruno Haible  <bruno@clisp.org>
+
+       Fix link errors in tests: wait-process uses gettext-h.
+       * modules/nonblocking-pipe-tests (Makefile.am): Set
+       test_nonblocking_pipe_main_LDADD.
+       * modules/nonblocking-socket-tests (Makefile.am): Link
+       test-nonblocking-socket-main against $(LIBINTL).
+       Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
+2011-05-29  Bruno Haible  <bruno@clisp.org>
+
+       wctype-h: Avoid namespace pollution on Solaris 2.6.
+       * lib/wctype.in.h: On Solaris, undefine 'multibyte' and a few other
+       identifiers.
+       * doc/posix-headers/wctype.texi: Mention the problem.
+       Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
+2011-05-28  Jim Meyering  <meyering@redhat.com>
+
+       parse-datetime.y: accommodate -Wstrict-overflow
+       * lib/parse-datetime.y (yylex): Rearrange pointer arithmetic to
+       placate -Wstrict-overflow.
+
+       trim: avoid a warning from -O2 -Wstrict-overflow
+       * lib/trim.c (trim2): Declare local to be "unsigned int", not "int".
+
+2011-05-28  Bruno Haible  <bruno@clisp.org>
+
+       getloadavg: Remove an unreliable safety check.
+       * m4/getloadavg.m4 (gl_GETLOADAVG): Drop argument. Remove test whether
+       getloadavg.c is in place.
+       * modules/getloadavg (configure.ac): Drop argument of gl_GETLOADAVG.
+       Reported by Sam Steingold <sds@gnu.org>.
+
+2011-05-26  Simon Josefsson  <simon@josefsson.org>
+
+       * lib/gen-uni-tables.c: Say "gen-uni-tables.c" consistently.
+
+2011-05-26  Bruno Haible  <bruno@clisp.org>
+
+       mbsrchr: Avoid collision with system function on Interix.
+       * lib/string.in.h (mbsrchr): Define as rpl_mbsrchr also on Interix.
+       Reported by Markus Duft <mduft@gentoo.org>.
+
+2011-05-25  Eric Blake  <eblake@redhat.com>
+
+       getcwd: work around mingw bug
+       * lib/getcwd-lgpl.c (rpl_getcwd): Guarantee correct error.
+       * doc/posix-functions/getcwd.texi (getcwd): Document it.
+       Reported by Matthias Bolte.
+
+2011-05-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       test-intprops: disable -Wtype-limits diagnostics
+       * tests/test-intprops.c: Use a pragma to ignore -Wtype-limits
+       diagnostics.  Otherwise, the integer overflow macros generate many
+       diagnostics.  Reported by Jim Meyering in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00528.html>.
+
+2011-05-24  Eric Blake  <eblake@redhat.com>
+
+       docs: document recently fixed glibc printf bug
+       * doc/posix-functions/fprintf.texi (fprintf): Document it.
+       * doc/posix-functions/printf.texi (printf): Likewise.
+       * doc/posix-functions/vfprintf.texi (vfprintf): Likewise.
+       * doc/posix-functions/vprintf.texi (vprintf): Likewise.
+
+2011-05-24  Eric Blake  <eblake@redhat.com>
+
+       tests: fix logic bug in init.sh
+       * tests/init.sh: (gl_set_x_corrupts_stderr_): Clear for successful
+       shell.
+
+2011-05-24  Jim Meyering  <meyering@redhat.com>
+
+       utimensat: do not reference an out-of-scope buffer
+       Otherwise, with __linux__ defined, "times" would point to a buffer, "ts"
+       declared in an inner scope, yet "times" would be dereferenced outside
+       the scope in which "ts" was valid.
+       * lib/utimensat.c (rpl_utimensat) [__linux__]: Move the declaration
+       of ts[2] "out/up", so that the use of aliased "times" (via
+       "times = ts;") does not end up referencing an out-of-scope "ts"
+
+       opendir-safer.c: don't clobber errno; don't close negative FD
+       * lib/opendir-safer.c (opendir_safer):
+       [HAVE_FDOPENDIR || GNULIB_FDOPENDIR]: Don't close a negative
+       file descriptor, and more importantly, don't clobber the
+       offending errno value with EINVAL.  Before, upon failure
+       of dup_safer, we would pass the negative file descriptor to
+       fdopendir, which would clobber errno.
+
+2011-05-23  Bruno Haible  <bruno@clisp.org>
+
+       idcache: Fix module description.
+       * modules/idcache (Include): Set to "idcache.h".
+
+2011-05-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       gnulib-tool: fix portability problem with MacOS sed
+       A sed command like "/x/{s/a/b/}" is not portable; a newline is needed
+       before the "}".  Problem reported by Leo in
+       <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00717.html>.
+       * gnulib-tool (func_modules_transitive_closure): Insert newlines in
+       sed_extract_condition1, sed_extract_condition2.
+
+2011-05-23  Bruno Haible  <bruno@clisp.org>
+
+       getugroups: Fix module description.
+       * modules/getugroups (Include): Set to "getugroups.h".
+
+2011-05-23  Bruno Haible  <bruno@clisp.org>
+           Eric Blake  <eblake@redhat.com>
+
+       linkat, renameat: Update dependencies.
+       * modules/renameat (Depends-on): Add dosname, save-cwd. Remove stpcpy.
+       * modules/linkat (Depends-on): Likewise. Remove also readlink,
+       symlinkat.
+
+2011-05-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       verify: fix bug when gnulib <assert.h> is also included
+       * lib/verify.h (verify, verify_true): Define if _GL_VERIFY_H
+       is defined, not if _GL_STATIC_ASSERT_H is not defined.
+       Perhaps there's a better way, but this fixes the immediate problem.
+       Problem reported by Bruno Haible in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00478.html>.
+
+2011-05-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       clock-time: change to LGPLv2+.
+       * modules/clock-time: Change from GPL to LGPLv2+.  Actually, it's
+       BSD-like but we have no mark for that; this is good enough for now.
+
+2011-05-21  Bruno Haible  <bruno@clisp.org>
+
+       relocatable-prog-wrapper: Fix possible link error.
+       * m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Move determination of
+       HAVE_SETENV and REPLACE_SETENV and AC_LIBOBJ invocation from here...
+       (gl_FUNC_SETENV): ... to here.
+       * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL_SEPARATE): Update comment.
+       * m4/readlink.m4 (gl_FUNC_READLINK_SEPARATE): Likewise.
+
+2011-05-20  Jim Meyering  <meyering@redhat.com>
+
+       maint: replace misused "a" with "an"
+       * doc/intprops.texi: "a integer"
+       * doc/regex.texi: "a explanation"
+       * lib/alignof.h: "a object"
+       * lib/argmatch.h: "a explanation"
+       * lib/argp-help.c: "a option" and "a OPTION_DOC"
+       * lib/stdint.in.h: "a integer"
+       * lib/userspec.c: "a owner"
+       * doc/gnulib.texi: Fix "a idea", and reword.
+
+2011-05-19  Jim Meyering  <meyering@redhat.com>
+
+       maint: correct misuse of "a" and "an"
+       * doc/regex.texi (Collating Symbol Operators): s/an close.../a close/
+       * lib/argp-help.c: "an docum...": s/an/a/
+       * lib/argp-parse.c: "An vector": s/An/A/
+       * lib/execute.c: "an native": s/an/a/
+       * lib/spawn-pipe.c: Likewise.
+       * lib/gc.h: "an Gc_rc": s/an/a/
+       * lib/unigbrk.in.h: "an grapheme": s/an/a/
+       * lib/fts.c: "an stat.st_dev": s/an/a/
+
+2011-05-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       intprops: work around IRIX 6.5 cc bug with 0u - 0u + -1
+       See http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html
+       * lib/intprops.h (_GL_INT_NEGATE_CONVERT): New macro.
+       (_GL_INT_SIGNED, _GL_INT_MAXIMUM, _GL_DIVIDE_OVERFLOW):
+       (_GL_REMAINDER_OVERFLOW): Use it.
+
+       intprops: work around C compiler bugs
+       * lib/intprops.h (INT_MULTIPLY_RANGE_OVERFLOW): Work around compiler
+       bug in Sun C 5.11 2010/08/13 and other compilers; see
+       <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>.
+
+       intprops: TYPE_IS_INTEGER, TYPE_SIGNED not integer constant exprs
+       * doc/intprops.texi (Integer Type Determination): Fix
+       documentation for TYPE_IS_INTEGER: it returns an constant
+       expression, not an integer constant expression.  Fix doc for
+       TYPE_SIGNED: it returns an integer constant expression only if its
+       argument is an integer type.  (TYPE_IS_INTEGER is the same, but is
+       hardly worth documented that way....)
+
+2011-05-18  Eric Blake  <eblake@redhat.com>
+
+       fnmatch: avoid compiler warning
+       * lib/fnmatch_loop.c (FCT): Use correct type.
+       Reported by Matthias Bolte.
+
+2011-05-13  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: three new prohibit_<HDR>_without_use rules
+       * top/maint.mk (sc_prohibit_stdio--_without_use): New rule.
+       (sc_prohibit_stdio-safer_without_use): Likewise.
+       (sc_prohibit_xfreopen_without_use): Likewise.
+
+2011-05-17  Jim Meyering  <meyering@redhat.com>
+
+       announce-gen: fail if the NEWS delta is empty
+       If there's nothing noteworthy in NEWS, then either you forgot
+       or you shouldn't be releasing.
+       * build-aux/announce-gen: Die if the NEWS delta is effectively empty.
+
+2011-05-17  Pádraig Brady <P@draigBrady.com>
+
+       * top/maint.mk (_gl_tight_scope:): Automatically exclude compiler
+       reserved symbols starting with double underscore from the check.
+
+2011-05-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       intprops: add doc
+       * doc/intprops.texi: New file, documenting intprops.
+       * doc/gnulib.texi (Particular Modules): Include it.
+
+       verify: add doc to gnulib manual and fix example
+       * doc/gnulib.texi (Compile-time Assertions): New node, for 'verify'.
+       * doc/verify.texi (Compile-time Assertions): Update 'assert' doc.
+       (Compile-time Assertions): Fix example so it can't overflow.
+
+2011-05-17  Jim Meyering  <meyering@redhat.com>
+
+       warnings.m4: don't usurp save_CPPFLAGS variable name
+       * m4/warnings.m4: Prefix local temporary variable name with gl_.
+
+       doc: fix typo
+       * doc/gnulib-intro.texi (Target Platforms): s/is/are/
+
+2011-05-16  Paul Eggert  <eggert@cs.ucla.edu>
+           Bruno Haible  <bruno@clisp.org>
+
+       doc: Tweak recent change.
+       * README (Portability guidelines): Tweak new text.
+       * doc/gnulib-intro.texi (Target Platforms): Likewise. Mention
+       Interix 6.1.
+
+2011-05-16  Eric Blake  <eblake@redhat.com>
+
+       inttypes: avoid autoconf warning
+       * m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): Only expand once.
+       * m4/stdint.m4 (gl_STDINT_H): Likewise.
+
+2011-05-16  Sam Steingold <sds@gnu.org>
+       and Eric Blake  <eblake@redhat.com>
+
+       vc-list-files: accept multiple directory operands
+       * build-aux/vc-list-files: Iterate over all remaining operands.
+
+2011-05-16  Bruno Haible  <bruno@clisp.org>
+
+       Fix confusion regarding deprecated modules.
+       * modules/calloc (Status, Notice): Mark module as deprecated, not
+       obsolete.
+       * modules/fnmatch-posix (Status, Notice): Likewise.
+       * modules/getdate (Status, Notice): Likewise.
+       * modules/getopt (Status, Notice): Likewise.
+       * modules/malloc (Status, Notice): Likewise.
+       * modules/pipe (Status, Notice): Likewise.
+       * modules/realloc (Status, Notice): Likewise.
+       * modules/rename-dest-slash (Status, Notice): Likewise.
+       * modules/unictype/bidicategory-all (Status, Notice): Likewise.
+       * modules/unictype/bidicategory-byname (Status, Notice): Likewise.
+       * modules/unictype/bidicategory-name (Status, Notice): Likewise.
+       * modules/unictype/bidicategory-of (Status, Notice): Likewise.
+       * modules/unictype/bidicategory-test (Status, Notice): Likewise.
+
+2011-05-16  Bruno Haible  <bruno@clisp.org>
+
+       doc: List the target platforms.
+       * doc/gnulib-intro.texi (Target Platforms): New section.
+       * doc/gnulib.texi (Introduction): Update menu.
+       * README (Portability guidelines): Refer to the new section. Update
+       statement about oldest supported environment. Remove rationale why
+       <errno.h>, <string.h>, <stdlib.h> are assumed. Update example of an
+       unportable C89 function.
+       Reported by Bastien Roucariès <roucaries.bastien@gmail.com> and
+       Charles Wilson <cygwin@cwilson.fastmail.fm>. Feedback from Paul Eggert.
+
+2011-05-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * build-aux/bootstrap (gnulib_tool): Handle symlink timestamps better.
+
+2011-05-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       intprops-tests: new module
+       * modules/intprops-tests, tests/test-intprops.c: New files.
+
+       intprops: add safe, portable integer overflow checking
+       * lib/intprops.h (_GL_INT_CONVERT, _GL_INT_TWOS_COMPLEMENT):
+       (_GL_INT_SIGNED, _GL_INT_MINIMUM, _GL_INT_MAXIMUM):
+       (_GL_SIGNED_INT_MINIMUM, INT_ADD_RANGE_OVERFLOW):
+       (INT__SUBTRACT__RANGE_OVERFLOW, INT_NEGATE_RANGE_OVERFLOW):
+       (INT_MULTIPLY_RANGE_OVERFLOW, INT_REMAINDER_RANGE_OVERFLOW):
+       (INT_LEFT_SHIFT_RANGE_OVERFLOW, _GL_ADD_OVERFLOW):
+       (_GL__SUBTRACT__OVERFLOW, _GL_MULTIPLY_OVERFLOW, _GL_DIVIDE_OVERFLOW):
+       (_GL_REMAINDER_OVERFLOW, _GL_UNSIGNED_NEG_MULTIPLE, INT_ADD_OVERFLOW):
+       (INT__SUBTRACT__OVERFLOW, INT_NEGATE_OVERFLOW, INT_MULTIPLY_OVERFLOW):
+       (INT_DIVIDE_OVERFLOW, INT_REMAINDER_OVERFLOW):
+       (INT_LEFT_SHIFT_OVERFLOW, _GL_BINARY_OP_OVERFLOW): New macros.
+
+2011-05-12  James Youngman  <jay@gnu.org>
+
+       Add a test for glibc's Bugzilla bug #12378.
+       * m4/fnmatch.m4: Use gnulib's fnmatch if the system fnmatch
+       doesn't allow the literal matching of a lone "[" (which is
+       required by POSIX).
+       * tests/test-fnmatch.c (main): Check that "[/b" matches itself.
+
+2011-05-11  Ulrich Drepper  <drepper@gmail.com>
+
+       Sync glibc change fixing Bugzilla bug #12378.
+       * lib/fnmatch_loop.c (FCT): When matching '[' keep track of
+       beginning and fall back to matching as normal character if the
+       string ends before the matching ']' is found.  This is what POSIX
+       requires.
+
+2011-05-13  Eric Blake  <eblake@redhat.com>
+
+       getcwd-lgpl: relax test for FreeBSD
+       * doc/posix-functions/getcwd.texi (getcwd): Document portability
+       issue.
+       * tests/test-getcwd-lgpl.c (main): Relax test.
+       Reported by Matthias Bolte.
+
+2011-05-11  Eric Blake  <eblake@redhat.com>
+
+       test-fflush: silence compiler warning
+       * tests/test-fflush.c (main): Don't fclose a NULL pointer.
+
+2011-05-11  Bruno Haible  <bruno@clisp.org>
+
+       canonicalize, canonicalize-lgpl: Avoid crash dialog on MacOS X.
+       * m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Add GL_NOCRASH code.
+       * modules/canonicalize (Depends-on): Add 'nocrash'.
+       * modules/canonicalize-lgpl (Depends-on): Likewise.
+       * doc/posix-functions/realpath.texi: Update platforms list.
+       Reported by Ryan Schmidt <ryandesign@macports.org>.
+
+2011-05-11  Bruno Haible  <bruno@clisp.org>
+
+       group-member: Declare function in <unistd.h>.
+       * lib/unistd.in.h (group_member): New declaration.
+       * lib/group-member.h: Remove file.
+       * lib/group-member.c: Include <unistd.h> instead of group-member.h.
+       * tests/test-unistd-c++.cc: Check signature of group_member.
+       * m4/group-member.m4 (gl_FUNC_GROUP_MEMBER): Require
+       gl_UNISTD_H_DEFAULTS. Set HAVE_GROUP_MEMBER.
+       * m4/unistd_h.m4 (gl_UNISTD_H): Check whether group_member is declared.
+       (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_GROUP_MEMBER,
+       HAVE_GROUP_MEMBER.
+       * modules/group-member (Files): Remove lib/group-member.h.
+       (Depends-on): Add unistd. Specify conditions.
+       (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
+       (Include): Change to <unistd.h>.
+       * modules/unistd (Makefile.am): Substitute GNULIB_GROUP_MEMBER,
+       HAVE_GROUP_MEMBER.
+       * NEWS: Mention the change.
+       * lib/euidaccess.c: Don't include group-member.h.
+
+2011-05-11  Bruno Haible  <bruno@clisp.org>
+
+       group-member: Document module.
+       * doc/glibc-functions/group_member.texi: Mention the 'group-member'
+       module.
+
+2011-05-11  Bruno Haible  <bruno@clisp.org>
+
+       fclose: Fix mistake earlier today.
+       * lib/fclose.c (rpl_fclose): Don't assume that EOF < 0.
+
+2011-05-11  Eric Blake  <eblake@redhat.com>
+
+       fclose: preserve fflush errors
+       * lib/fclose.c (rpl_fclose): Don't lose fflush errors.
+       Reported by Jim Meyering.
+
+       bootstrap: support a prereq of 'rpcgen -' on RHEL5
+       * build-aux/bootstrap (check_versions): When no specific version
+       is required, merely check that the app produces an exit status
+       that indicates its existence.
+
+       maint.mk: drop redundant check
+       * top/maint.mk (sc_the_the): Delete; sc_prohibit_doubled_word does
+       the same but better.
+
+2011-05-11  Bruno Haible  <bruno@clisp.org>
+
+       fclose: Fix possible link error.
+       * lib/fclose.c (rpl_fclose): Invoke _gl_unregister_fd, not
+       unregister_shadow_fd. Improve comments.
+       * lib/sockets.c (close_fd_maybe_socket): Add comments. Reported by
+       Eric Blake.
+
+2011-05-11  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: improve "can not" detection and generalize rule name
+       * top/maint.mk (sc_prohibit_undesirable_word_seq): Renamed from
+       sc_prohibit_can_not, since we'll probably add a few more word pairs here.
+       Use the same technique as in sc_prohibit_doubled_word, so that
+       we recognize "can not" also when the words are separated by a newline.
+       Suggested by Eric Blake.
+       (perl_filename_lineno_text_): Define.  Factored out of...
+       (prohibit_doubled_word_): ...here.  Use the new definition.
+       (prohibit_undesirable_word_seq_): New var.  Use it here, too.
+       (prohibit_undesirable_word_seq_RE_): New overridable variable.
+       (ignore_undesirable_word_sequence_RE_): New overridable variable.
+
+2011-05-10  Eric Blake  <eblake@redhat.com>
+
+       fclose: avoid double close race when possible
+       * lib/fclose.c (rpl_fclose): Rewrite to avoid double-close race on
+       all but WINDOWS_SOCKETS.
+
+2011-05-10  Bastien Roucariès  <roucaries.bastien@gmail.com>
+
+       openat: correct new comment
+       * lib/openat-proc.c (openat_proc_name): Correct the comment.
+
+2011-05-10  Jim Meyering  <meyering@redhat.com>
+
+       openat: add comments
+       * lib/openat-proc.c (openat_proc_name): Add comments,
+       mostly from Eric Blake.
+
+2011-05-09  Eric Blake  <eblake@redhat.com>
+
+       openat: reduce syscalls in first probe of /proc
+       * lib/openat-proc.c (openat_proc_name): Require that /proc/self/fd
+       be a directory.  Simplify the probe for .. bugs.
+       * modules/openat (Depends-on): Drop same-inode.
+       Reported by Bastien ROUCARIES.
+
+2011-05-09  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: change semantics/name of tight_scope variables
+       * top/maint.mk (_gl_TS_var_match, _gl_TS_function_match):
+       Rename variables to align with semantics that make them more useful.
+
+       maint.mk: tweak new rule's name not to impinge
+       * top/maint.mk (_gl_tight_scope): Rename from sc_tight_scope-0.
+       (sc_tight_scope): Use new rule name rather than $@-0.
+
+       maint.mk: add a syntax-check rule to ensure tightly-scoped symbols
+       * top/maint.mk (sc_tight_scope): New rule.
+       (sc_tight_scope-0): New rule, ifdef'd out.
+       (_gl_TS_dir): Default.
+       (_gl_TS_unmarked_extern_functions, _gl_TS_function_regex): Define.
+       (_gl_TS_unmarked_extern_vars, _gl_TS_var_regex): Define.
+
+2011-05-09  Simon Josefsson  <simon@josefsson.org>
+
+       * m4/gc.m4: Remove gl_PREREQ_GC (not used).  Reported by Bruno
+       Haible <bruno@clisp.org>.
+
+2011-05-08  Bruno Haible  <bruno@clisp.org>
+
+       Comments.
+       * m4/isnanf.m4: Add comment.
+       * m4/isnanl.m4: Likewise.
+
+2011-05-08  Bruno Haible  <bruno@clisp.org>
+
+       glob: Remove obsolete macro.
+       * m4/glob.m4 (gl_GLOB_SUBSTITUTE): Remove macro.
+
+2011-05-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       intprops: Sun C 5.11 supports __typeof__
+       * lib/intprops.h (_GL_HAVE___TYPEOF__): New macro, which is set
+       for either GCC 2 or later, as before, or for Sun C 5.11 or later,
+       which is new.
+       (_GL_SIGNED_TYPE_OR_EXPR): Use it.
+
+       intprops: switch to usual gnulib indenting and naming
+       * lib/intprops.h (_GL_INTPROPS_H): Rename from GL_INTPROPS_H.
+       (_GL_SIGNED_TYPE_OR_EXPR): Rename from signed_type_or_expr__.
+
+       * tests/test-inttostr.c (IS_TIGHT): Adjust to above renaming.
+
+2011-05-08  Jim Meyering  <meyering@redhat.com>
+
+       maint.mk: suppress "Entering/Leaving directory" diag in announcement
+       * top/maint.mk (release-prep): Use make's --no-print-directory
+       option when generating the announcement.  This eliminates the
+       pesky "make[2]: Entering/Leaving directory" diagnostics in the
+       generated announcement template.
+
+2011-05-08  Bruno Haible  <bruno@clisp.org>
+
+       tzset: Fix gettimeofday wrapper on Solaris 2.6.
+       * m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): When invoking
+       gl_GETTIMEOFDAY_REPLACE_LOCALTIME, also set REPLACE_GETTIMEOFDAY.
+
+2011-05-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       ignore-value, verify: Omit include files from lib_SOURCES.
+       * modules/ignore-value, modules/verify (Makefile.am):
+       Don't put ignore-value.h, or verify.h, into lib_SOURCES, as
+       that leads Automake to duplicate use of am__objects_... variables
+       in Makefile.in.  See
+       <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00257.html>.
+
+2011-05-07  Bruno Haible  <bruno@clisp.org>
+
+       fclose: Simplify autoconf macro.
+       * m4/fclose.m4 (gl_FUNC_FCLOSE): Assume gl_FUNC_FFLUSH_STDIN is
+       defined.
+
+2011-05-07  Bruno Haible  <bruno@clisp.org>
+
+       canonicalize-lgpl: Fix autoconf macro ordering bug.
+       * m4/canonicalize.m4 (gl_CANONICALIZE_LGPL): Require
+       gl_STDLIB_H_DEFAULTS.
+
+2011-05-06  Eric Blake  <eblake@redhat.com>
+
+       maintainer-makefile: make sc_po_check easier to tune
+       * top/maint.mk (sc_po_check): Allow overriding which non-VC files
+       to probe for strings, such as an alternate location for gnulib.
+
+       fclose: guarantee behavior on seekable stdin
+       * modules/fclose (Depends-on): Add fflush.
+       * doc/posix-functions/fclose.texi (fclose): Document this.
+       * tests/test-fclose.c (main): Make test for this unconditional.
+
+2011-05-06  Bruno Haible  <bruno@clisp.org>
+
+       fflush, fpurge: Relicense under LGPLv2+.
+       * modules/fflush (License): Change from LGPLv3+ to LGPLv2+.
+       * modules/fpurge (License): Likewise.
+       With permission from Eric Blake and Jim Meyering.
+       Suggested by Eric Blake.
+
+2011-05-06  Karl Berry  <karl@gnu.org>
+
+       * MODULES.html.sh (func_all_modules): remove exit.
+
+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.
 
 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.
        * 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.
        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,
        * 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
        * 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
        (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.
        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
        * 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.
        * 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
        (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.
        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
        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
        * 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.
        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.
        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().
        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
        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
        * 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
        * 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
        * 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>.
        (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.
        * 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.
        * 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
        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,
        * 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.
        (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.
        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
        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
        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.
        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>.
        $(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
index 2117e7d..f025ab2 100644 (file)
@@ -90,7 +90,9 @@ at any time.
     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:
index 708f3cc..3d3add3 100755 (executable)
@@ -1604,7 +1604,6 @@ func_all_modules ()
 
   func_begin_table
   func_module stdlib
-  func_module exit
   func_module strtol
   func_module strtoul
   func_module memcmp
@@ -2353,6 +2352,7 @@ func_all_modules ()
   func_module futimens
   func_module getaddrinfo
   func_module getcwd
+  func_module getcwd-lgpl
   func_module getgroups
   func_module gethostname
   func_module getlogin
@@ -2464,6 +2464,7 @@ func_all_modules ()
   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 +3475,7 @@ func_all_modules ()
   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
diff --git a/NEWS b/NEWS
index 767d0ab..a87c3a4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,26 @@ User visible incompatible changes
 
 Date        Modules         Changes
 
+2011-06-05  ansi-c++-opt    When a C++ compiler is not found, the variable CXX
+                            is now set to "no", not to ":".
+
+2011-05-11  group-member    The include file is changed from "group-member.h"
+                            to <unistd.h>.
+
+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'.
index 5614908..38949e0 100644 (file)
@@ -1,6 +1,69 @@
                        Gnulib stable snapshot
                        ----------------------
 
+  * 20110609-stable
+
+Snapshot taken based on:
+
+commit 0c4be75eb0966bde4533bc111778e0ab494a93be
+Date:   Wed May 18 13:13:03 2011 -0600
+
+with the following additional commits:
+
+    * [48cc748]->[a5f8483] intprops: TYPE_IS_INTEGER, TYPE_SIGNED not integer constant exprs
+    * [8cc0fee]->[8c5e817] intprops: work around C compiler bugs
+    * [92c71a1]->[2dd0ce3] intprops: work around IRIX 6.5 cc bug with 0u - 0u + -1
+    * [c9ff025]->[056b00f] maint: correct misuse of "a" and "an"
+    * [93d7550]->[0cc5541] maint: replace misused "a" with "an"
+    * [325f131]->[f00bf3d] relocatable-prog-wrapper: Fix possible link error.
+    * [21eb071]->[8694861] clock-time: change to LGPLv2+.
+    * [6c8bcfc]->[617bbef] * doc/intprops.texi: fix typo in copyright date
+    * [99b3138]->[9279f19] verify: fix bug when gnulib <assert.h> is also included
+    * [64c6332]->[98ce667] linkat, renameat: Update dependencies.
+    * [fbd3cc5]->[be2aacf] getugroups: Fix module description.
+    * [ddd54c7]->[cd78e73] gnulib-tool: fix portability problem with MacOS sed
+    * [59ed6e8]->[1166200] idcache: Fix module description.
+    * [1e8752a]->[4831e70] Fix recent ChangeLog entry.
+    * [d94bbd1]->[4af1887] opendir-safer.c: don't clobber errno; don't close negative FD
+    * [6dc42e2]->[d0fe920] utimensat: do not reference an out-of-scope buffer
+    * [866bbae]->[b9bb8b9] tests: fix logic bug in init.sh
+    * [fc9b0f6]->[cca883f] atexit-tests: ensure reliable exit status
+    * [f4c4af0]->[61c4bf6] docs: document recently fixed glibc printf bug
+    * [9d196fa]->[a3a87d2] test-intprops: disable -Wtype-limits diagnostics
+    * [1622b36]->[527d6c4] getcwd: work around mingw bug
+    * [4ed9779]->[d1c9bfc] mbsrchr: Avoid collision with system function on Interix.
+    * [03f358b]->[1ad6403] gen-uni-tables: Say "gen-uni-tables.c" consistently.
+    * [8d8a973]->[cb6151a] getloadavg: Remove an unreliable safety check.
+    * [fdc9e6c]->[264ebf0] Status of work-in-progress around libposix.
+    * [2449068]->[cfd76ac] trim: avoid a warning from -O2 -Wstrict-overflow
+    * [a8ff65c]->[264aa35] parse-datetime.y: accommodate -Wstrict-overflow
+    * [05f391a]->[ca57003] wctype-h: Avoid namespace pollution on Solaris 2.6.
+    * [224c034]->[225c8ef] Fix link errors in tests: wait-process uses gettext-h.
+    * [9c3746f]->[7f56311] build-aux/config.sub
+    * [7c886ca]->[802ee67] Fix link errors in tests: openat-die uses gettext-h.
+    * [64e3383]->[e54b616] pipe2: Remove dependency on 'nonblocking' module.
+    * [27edfbd]->[4ba5a2c] doc: Fix a module name.
+    * [872f360]->[8248d1a] Copyright: Use LGPL 2.1 instead of LGPL 2.0.
+    * [0605107]->[d9883ac] setlocale: Enable replacement on Cygwin 1.5.
+    * [d3e6271]->[1a2b0e6] sys_select: Ensure memset is declared also on AIX 7.
+    * [c00787b]->[11da7a4] setenv: Avoid gcc warning.
+    * [6f88ff3]->[4c509f3] unsetenv: Avoid gcc warning.
+    * [1866b23]->[0560196] localename: Fix link dependencies.
+    * [bf7690a]->[54731c1] pipe-filter-ii: Fix test failure on AIX and IRIX.
+    * [e7754b0]->[52062c8] acl: Fix test failure on AIX 7.
+    * [c914617]->[34d3cce] ansi-c++-opt: Interoperability with libtool.
+    * [3f9fff2]->[0bd455a] careadlinkat: Avoid mismatch between ssize_t and int.
+    * [c224523]->[5c698ae] canonicalize-lgpl: work around AIX realpath bug
+    * [79aac72]->[cc1a9b7] canonicalize-lgpl: use common idiom
+    * [3180807]->[768eb31] doc/lgpl-2.1.texi
+    * [fba3245]->[a96c4d5] tests: fix usage message in 'mktempd_'
+    * [7b2b693]->[a43f6fd] autoupdate
+    * [3639716]->[74c0798] rmdir: Avoid test failure on HP-UX 10.20.
+    * [9776680]->[6ddae30] acl tests: Fix compilation error on HP-UX 11.
+    * [5f0441a]->[c1bf224] thread: Fix confusion between NULL and 0.
+
+----------------------------------------------------------------------
+
   * 20110412-stable
 
 Snapshot taken based on:
diff --git a/README b/README
index 492827a..ef58c0d 100644 (file)
--- a/README
+++ b/README
@@ -77,6 +77,7 @@ changes.
 
 Contributing to Gnulib
 ======================
+
 All software here is copyrighted by the Free Software Foundation - you need
 to have filled out an assignment form for a project that uses the
 module for that contribution to be accepted here.
@@ -201,7 +202,8 @@ Portability guidelines
 ----------------------
 
 Gnulib code is intended to be portable to a wide variety of platforms,
-not just GNU platforms.
+not just GNU platforms.  See the documentation section "Target Platforms"
+for details.
 
 Many Gnulib modules exist so that applications need not worry about
 undesirable variability in implementations.  For example, an
@@ -210,27 +212,17 @@ application that uses the 'malloc' module need not worry about (malloc
 need not worry about localtime_r returning int (not char *) on some
 platforms that predate POSIX 1003.1-2001.
 
-Originally much of the Gnulib code was portable to ancient hosts like
-4.2BSD, but it is a maintenance hassle to maintain compatibility with
-unused hosts, so currently we assume at least a freestanding C89
-compiler, possibly operating with a C library that predates C89.  The
-oldest environment currently ported to is probably SunOS 4 + GCC 1.x,
-though we haven't tested this exact combination.  SunOS 4 last shipped
-on 1998-09-30, and Sun dropped support for it on 2003-10-01, so at
-some point we may start assuming a C89 library as well.
+Currently we assume at least a freestanding C89 compiler, possibly
+operating with a C library that predates C89.  The oldest environments
+currently ported to are probably HP-UX 10.20 and IRIX 5.3, though we
+are not testing these platforms very often.
 
 Because we assume a freestanding C89 compiler, Gnulib code can include
 <float.h>, <limits.h>, <stdarg.h>, and <stddef.h> unconditionally.  It
 can also assume the existence of <ctime.h>, <errno.h>, <fcntl.h>,
-<locale.h>, <signal.h>, <stdio.h>, <stdlib.h>, <string.h>, and
-<time.h>.  Some of these headers, such as <errno.h>, were present in
-Unix Version 7 and are thus widely available.  <string.h> and
-<stdlib.h> were not in Unix Version 7, so they weren't universally
-available on ancient hosts, but they are both in SunOS 4 (the oldest
-platform still in relatively-common use) so Gnulib assumes them now.
-Similarly, many modules include <sys/types.h> even though it's not
-even in C99; that's OK since <sys/types.h> has been around nearly
-forever.
+<locale.h>, <signal.h>, <stdio.h>, <stdlib.h>, <string.h>, and <time.h>.
+Similarly, many modules include <sys/types.h> even though it's not even
+in C99; that's OK since <sys/types.h> has been around nearly forever.
 
 Even if the include files exist, they may not conform to C89.
 However, GCC has a "fixincludes" script that attempts to fix most
@@ -239,10 +231,10 @@ largely conform to C89 or better.  People still using ancient hosts
 should use fixincludes or fix their include files manually.
 
 Even if the include files conform to C89, the library itself may not.
-For example, SunOS 4's (free (NULL)) can dump core, so Gnulib code
-must avoid freeing a null pointer, even though C89 allows it.
+For example, strtod and mktime have some bugs on some platforms.
 You can work around some of these problems by requiring the relevant
-modules, e.g., the Gnulib 'free' module supplies a conforming 'free'.
+modules, e.g., the Gnulib 'mktime' module supplies a working and
+conforming 'mktime'.
 
 The GNU coding standards allow one departure from strict C99: Gnulib
 code can assume that standard internal types like size_t are no wider
diff --git a/STATUS-libposix b/STATUS-libposix
new file mode 100644 (file)
index 0000000..58b7506
--- /dev/null
@@ -0,0 +1,127 @@
+Status for libposix
+===================
+
+This file documents the status of work-in-progress.
+No ChangeLog entries are needed for this file.
+
+Status for the libposix branch
+------------------------------
+
+Bruce Korb says:
+
+I think a real big step in libposix is to get a little experience with it.
+There are also some few little nits pointed out in the discussions that
+need some careful consideration, but some experience in using it would
+be good, too.  The intended/expected usage is along the lines of:
+
+1.  configure, build and install the thing.  Perhaps from:
+    http://autogen.sourceforge.net/data/
+    or roll your own, but the distribution should be there, I think.
+
+2.  fiddle a project to detect that it is "sufficiently recent" to
+    cover the needs of this unnamed project.  That is an interesting
+    issue, though:  the concept behind "configure" is that you do
+    feature tests rather than version testing.  However, if you choose
+    to not test the version of libposix and test the features you
+    need of libposix, then I have an extremely difficult time trying
+    to understand the point of libposix -- you are back to running
+    a bunch of feature tests that take too long.  Testing for a
+    libposix current as of some marker (version number or date)
+    seems right to me, though there are some caveats to consider
+    regarding "retired" POSIX features.
+
+    Anyway, the "fiddle a project" should boil down to testing
+    for libposix in some way and then dying if it is not up to snuff.
+
+3.  configure, build, test, install and test installation of said project.
+
+
+TODO list for master
+--------------------
+
+Bruno Haible says:
+
+1) ... 7)
+  proposed by Gary in the thread starting at
+  [PATCH 0/7] contents of topic/libposix for merge to master
+  in <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/threads.html>
+
+1) Allow generate header files to coexist without shadowing each other.
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00283.html>
+
+  Discussion:
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00289.html>
+
+  Half of the work has been done, but not yet pushed.
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00199.html>
+  <http://lists.gnu.org/archive/html/bug-gnulib/2011-02/msg00078.html>
+
+2) Allow using libgnu's file name in module descriptions.
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00284.html>
+
+  Discussion:
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00291.html>
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00308.html
+
+3) iconv_open's file file list
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00282.html>
+
+  Discussion:
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00290.html>
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00307.html>
+  libposix needs to install only selected headers, not all of them. Let the
+  script look at the 'Include:' section of each module description.
+
+4) Module libposix
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00280.html>
+
+  Discussion:
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00292.html>
+  More discussion needed
+
+5) Installable headers
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00281.html>
+
+  Discussion:
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00293.html>
+  Patch to be rewritten to use nobase_nodist_include_HEADERS,
+  also need to add an Automake conditional to distinguish libposix from
+  other projects.
+  Also see whether the Automake bug can be fixed.
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00325.html>
+
+6) libposix subdirectory
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00277.html>
+
+  Discussion:
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00294.html>
+
+7) use git-version-gen for version numbering
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00279.html>
+
+  Discussion:
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00297.html>
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00303.html>
+  Patch to be revised.
+
+8) Licensing
+  <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00184.html>
+
+  Status: A majority of the issues have been handled.
+  Obsolete modules (free, memcpy) can be ignored.
+  To be done:
+    getcwd
+    faccessat
+    fdopendir
+    linkat
+    mkfifoat
+    openat
+    readlinkat
+    renameat
+    symlinkat
+    utimensat
+
+9) Versioning
+  <http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00163.html>
+
+  Status: No real plan exists.
index 4886926..0eb6b5b 100755 (executable)
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
     if 0;
 # Generate a release announcement message.
 
-my $VERSION = '2010-05-03 20:17'; # UTC
+my $VERSION = '2011-05-17 20:25'; # 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 @@ sub sizes (@)
       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 @@ sub print_locations ($\@\%@)
   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 @@ sub print_checksums (@)
   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 @@ sub print_news_deltas ($$$)
 {
   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
@@ -189,34 +192,39 @@ sub print_news_deltas ($$$)
 
   my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/;
 
+  my $found_news;
   open NEWS, '<', $news_file
     or die "$ME: $news_file: cannot open for reading: $!\n";
   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;
+          $line =~ /\S/
+            and $found_news = 1;
+        }
     }
   close NEWS;
 
   $in_items
     or die "$ME: $news_file: no matching lines for `$curr_version'\n";
+  $found_news
+    or die "$ME: $news_file: no news item found for `$curr_version'\n";
 }
 
 sub print_changelog_deltas ($$)
@@ -229,8 +237,8 @@ sub print_changelog_deltas ($$)
   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 +263,7 @@ sub print_changelog_deltas ($$)
       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 +290,20 @@ sub print_changelog_deltas ($$)
   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 +324,25 @@ sub get_tool_versions ($$)
   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 +406,8 @@ sub get_tool_versions ($$)
 
   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 +456,11 @@ EOF
   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";
index f004ad3..522ac70 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2011-03-03.12; # UTC
+scriptversion=2011-05-16.16; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -130,18 +130,7 @@ source_base=lib
 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 @@ case "$0" in
   *) 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 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
   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,18 +421,32 @@ check_versions() {
     # Honor $APP variables ($TAR, $AUTOCONF, etc.)
     appvar=`echo $app | tr '[a-z]-' '[A-Z]_'`
     test "$appvar" = TAR && appvar=AMTAR
-    eval "app=\${$appvar-$app}"
-    inst_ver=$(get_version $app)
-    if [ ! "$inst_ver" ]; then
-      echo "$me: Error: '$app' not found" >&2
-      ret=1
-    elif [ ! "$req_ver" = "-" ]; then
-      latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
-      if [ ! "$latest_ver" = "$inst_ver" ]; then
-        echo "$me: Error: '$app' version == $inst_ver is too old" >&2
-        echo "       '$app' version >= $req_ver is required" >&2
+    case $appvar in
+        GZIP) ;; # Do not use $GZIP:  it contains gzip options.
+        *) eval "app=\${$appvar-$app}" ;;
+    esac
+    if [ "$req_ver" = "-" ]; then
+      # Merely require app to exist; not all prereq apps are well-behaved
+      # so we have to rely on $? rather than get_version.
+      $app --version >/dev/null 2>&1
+      if [ 126 -le $? ]; then
+        echo "$me: Error: '$app' not found" >&2
         ret=1
       fi
+    else
+      # Require app to produce a new enough version string.
+      inst_ver=$(get_version $app)
+      if [ ! "$inst_ver" ]; then
+        echo "$me: Error: '$app' not found" >&2
+        ret=1
+      else
+        latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
+        if [ ! "$latest_ver" = "$inst_ver" ]; then
+          echo "$me: Error: '$app' version == $inst_ver is too old" >&2
+          echo "       '$app' version >= $req_ver is required" >&2
+          ret=1
+        fi
+      fi
     fi
   done
 
@@ -640,10 +670,18 @@ symlink_to_dir()
         cp -fp "$src" "$dst"
       }
     else
+      # Leave any existing symlink alone, if it already points to the source,
+      # so that broken build tools that care about symlink times
+      # aren't confused into doing unnecessary builds.  Conversely, if the
+      # existing symlink's time stamp is older than the source, make it afresh,
+      # so that broken tools aren't confused into skipping needed builds.  See
+      # <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00326.html>.
       test -h "$dst" &&
       src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
       dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
-      test "$src_i" = "$dst_i" || {
+      test "$src_i" = "$dst_i" &&
+      both_ls=`ls -dt "$src" "$dst"` &&
+      test "X$both_ls" = "X$dst$nl$src" || {
         dot_dots=
         case $src in
         /*) ;;
index 187cd54..b02565c 100755 (executable)
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 #   2011 Free Software Foundation, Inc.
 
-timestamp='2011-02-02'
+timestamp='2011-06-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -882,7 +882,13 @@ EOF
        then
            echo ${UNAME_MACHINE}-unknown-linux-gnu
        else
-           echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+           if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+               | grep -q __ARM_PCS_VFP
+           then
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+           else
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+           fi
        fi
        exit ;;
     avr32*:Linux:*:*)
@@ -972,7 +978,7 @@ EOF
        echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
     tile*:Linux:*:*)
-       echo ${UNAME_MACHINE}-tilera-linux-gnu
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
     vax:Linux:*:*)
        echo ${UNAME_MACHINE}-dec-linux-gnu
index 30fdca8..f9fcdc8 100755 (executable)
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 #   2011 Free Software Foundation, Inc.
 
-timestamp='2011-03-23'
+timestamp='2011-06-03'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -300,7 +300,7 @@ case $basic_machine in
        | spu \
        | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
        | ubicom32 \
-       | v850 | v850e \
+       | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
        | we32k \
        | x86 | xc16x | xstormy16 | xtensa \
        | z8k | z80)
@@ -408,10 +408,11 @@ case $basic_machine in
        | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
        | tahoe-* \
        | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-       | tile-* | tilegx-* \
+       | tile*-* \
        | tron-* \
        | ubicom32-* \
-       | v850-* | v850e-* | vax-* \
+       | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+       | vax-* \
        | we32k-* \
        | x86-* | x86_64-* | xc16x-* | xps100-* \
        | xstormy16-* | xtensa*-* \
@@ -1120,13 +1121,8 @@ case $basic_machine in
                basic_machine=t90-cray
                os=-unicos
                ;;
-       # This must be matched before tile*.
-       tilegx*)
-               basic_machine=tilegx-unknown
-               os=-linux-gnu
-               ;;
        tile*)
-               basic_machine=tile-unknown
+               basic_machine=$basic_machine-unknown
                os=-linux-gnu
                ;;
        tx39)
index 01e9bbe..9825d56 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2011-04-13.22; # 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
@@ -170,7 +170,7 @@ gcc)
 ## 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 "s|.*$object$||" '/:$/d' \
+    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
       | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
@@ -559,7 +559,9 @@ makedepend)
   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
index ca89bdc..b1eaf88 100755 (executable)
@@ -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 @@ help_version()
 {
   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 @@ Requirements:
 - 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 @@ EOF
   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 @@ perl -MPOSIX -ni -e 'my $today = strftime "%F", localtime time;' \
  -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'
index 4ca4bed..bc07e67 100755 (executable)
@@ -156,6 +156,8 @@ func_verbose $compile_command \
              "$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 @@ rm -f relocwrapper.o \
       progreloc.o \
       xreadlink.o \
       areadlink.o \
+      careadlinkat.o \
+      allocator.o \
       canonicalize-lgpl.o \
       malloca.o \
       relocatable.o \
index 9f64511..47837c9 100644 (file)
@@ -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-03-25.11}
+\def\texinfoversion{2011-05-11.16}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -8424,7 +8424,7 @@ directory should work if nowhere else does.}
 %
 % Latin1 (ISO-8859-1) character definitions.
 \def\latonechardefs{%
-  \gdef^^a0{~}
+  \gdef^^a0{\tie}
   \gdef^^a1{\exclamdown}
   \gdef^^a2{\missingcharmsg{CENT SIGN}}
   \gdef^^a3{{\pounds}}
@@ -8546,7 +8546,7 @@ directory should work if nowhere else does.}
 
 % Latin2 (ISO-8859-2) character definitions.
 \def\lattwochardefs{%
-  \gdef^^a0{~}
+  \gdef^^a0{\tie}
   \gdef^^a1{\ogonek{A}}
   \gdef^^a2{\u{}}
   \gdef^^a3{\L}
@@ -9395,6 +9395,8 @@ directory should work if nowhere else does.}
 
 \message{and turning on texinfo input format.}
 
+\def^^L{\par} % remove \outer, so ^L can appear in an @comment
+
 % DEL is a comment character, in case @c does not suffice.
 \catcode`\^^? = 14
 
index a6c228b..b8f5a26 100755 (executable)
@@ -4,7 +4,7 @@ eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
 # 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 @@ sub is_NULL ($)
           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 @@ free=xfree
 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;
index 9bb6fe6..405e458 100755 (executable)
@@ -2,7 +2,7 @@
 # List version-controlled file names.
 
 # Print a version string.
-scriptversion=2010-04-23.22; # UTC
+scriptversion=2011-05-16.22; # UTC
 
 # Copyright (C) 2006-2011 Free Software Foundation, Inc.
 
@@ -30,7 +30,7 @@ scriptversion=2010-04-23.22; # UTC
 postprocess=
 case $1 in
   --help) cat <<EOF
-Usage: $0 [-C SRCDIR] [DIR]
+Usage: $0 [-C SRCDIR] [DIR...]
 
 Output a list of version-controlled files in DIR (default .), relative to
 SRCDIR (default .).  SRCDIR must be the top directory of a checkout.
@@ -61,53 +61,48 @@ EOF
     shift; shift ;;
 esac
 
-dir=
-case $# in
-  0) ;;
-  1) dir=$1 ;;
-  *) echo "$0: too many arguments" 1>&2
-     echo "Usage: $0 [-C srcdir] [DIR]" 1>&2; exit 1;;
-esac
-
-test "x$dir" = x && dir=.
-
-if test -d .git; then
-  test "x$dir" = x. \
-    && dir= sed_esc= \
-    || { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
-  # Ignore git symlinks - either they point into the tree, in which case
-  # we don't need to visit the target twice, or they point somewhere
-  # else (often into a submodule), in which case the content does not
-  # belong to this package.
-  eval exec git ls-tree -r 'HEAD:"$dir"' \
-    \| sed -n '"s/^100[^       ]*./$sed_esc/p"' $postprocess
-elif test -d .hg; then
-  eval exec hg locate '"$dir/*"' $postprocess
-elif test -d .bzr; then
-  test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
-  eval exec bzr ls -R --versioned '"$dir"' $postprocess
-elif test -d CVS; then
-  test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
-  if test -x build-aux/cvsu; then
-    eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
-  elif (cvsu --help) >/dev/null 2>&1; then
-    eval cvsu --find --types=AFGM '"$dir"' $postprocess
+test $# = 0 && set .
+
+for dir
+do
+  if test -d .git; then
+    test "x$dir" = x. \
+      && dir= sed_esc= \
+      || { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
+    # Ignore git symlinks - either they point into the tree, in which case
+    # we don't need to visit the target twice, or they point somewhere
+    # else (often into a submodule), in which case the content does not
+    # belong to this package.
+    eval exec git ls-tree -r 'HEAD:"$dir"' \
+      \| sed -n '"s/^100[^     ]*./$sed_esc/p"' $postprocess
+  elif test -d .hg; then
+    eval exec hg locate '"$dir/*"' $postprocess
+  elif test -d .bzr; then
+    test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
+    eval exec bzr ls -R --versioned '"$dir"' $postprocess
+  elif test -d CVS; then
+    test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
+    if test -x build-aux/cvsu; then
+      eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
+    elif (cvsu --help) >/dev/null 2>&1; then
+      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;                        \
+          }}'\''                               \
+        `find "$dir" -name Entries -print` /dev/null' $postprocess
+    fi
+  elif test -d .svn; then
+    eval exec svn list -R '"$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;                   \
-       }}'\''                          \
-      `find "$dir" -name Entries -print` /dev/null' $postprocess
+    echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
+    exit 1
   fi
-elif test -d .svn; then
-  eval exec svn list -R '"$dir"' $postprocess
-else
-  echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
-  exit 1
-fi
+done
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
index dd3a503..52f7cac 100644 (file)
@@ -2,15 +2,15 @@
 @subsection @code{group_member}
 @findex group_member
 
-Gnulib module: ---
+Gnulib module: group-member
 
 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 11 2010-11, Cygwin, mingw, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not 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 11 2010-11, Cygwin, mingw, Interix 3.5, BeOS.
 @end itemize
index ff1db30..44e3ab3 100644 (file)
@@ -15,3 +15,6 @@ IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin 1.7.5, mingw, Interix 3.5, BeOS.
 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.
index b847fae..033d462 100644 (file)
@@ -15,3 +15,6 @@ glibc 2.10, MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX
 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.
index a321a49..845d5dc 100644 (file)
@@ -10,8 +10,15 @@ Portability problems fixed by Gnulib:
 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.
index f33d90d..5721ae9 100644 (file)
@@ -15,3 +15,6 @@ IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin 1.7.1, mingw, Interix 3.5, BeOS.
 Portability problems not fixed by Gnulib:
 @itemize
 @end itemize
+
+Note: This function portably supports the @code{O_NONBLOCK} flag only if the
+gnulib module @code{nonblocking} is also used.
index fcb461e..f108c54 100644 (file)
@@ -7,8 +7,13 @@ Gnulib module: strchrnul
 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:
index 2a32c81..ab518c8 100644 (file)
@@ -74,6 +74,119 @@ as an application aid: it takes care of redirecting stdin and/or
 stdout if desired, and emits an error message if the subprocess
 failed.
 
+@node Target Platforms
+@section Target Platforms
+
+Gnulib supports a number of platforms that we call the ``reasonable
+portability targets''.  This class consists of widespread operating systems,
+for three years after their last availability, or --- for proprietary
+operating systems --- as long as the vendor provides commercial support for
+it.  Already existing Gnulib code for older operating systems is usually
+left in place for longer than these three years.  So it comes that programs
+that use Gnulib run pretty well also on these older operating systems.
+
+Some operating systems are not very widespread, but are Free Software and
+are actively developed.  Such platforms are also supported by Gnulib, if
+that OS's developers community keeps in touch with the Gnulib developers,
+by providing bug reports, analyses, or patches.  For such platforms, Gnulib
+supports only the versions of the last year or the last few months,
+depending on the maturity of said OS project, the number of its users, and
+how often these users upgrade.
+
+Niche operating systems are generally unsupported by Gnulib, unless some
+of their developers or users contribute support to Gnulib.
+
+The degree of support Gnulib guarantees for a platform depends on the
+amount of testing it gets from volunteers.  Platforms on which Gnulib
+is frequently tested are the best supported.  Then come platforms with
+occasional testing, then platforms which are rarely tested.  Usually,
+we fix bugs when they are reported.  Except that some rarely tested
+platforms are also low priority; bug fixes for these platforms can
+take longer.
+
+As of 2011, the list of supported platforms is the following:
+
+@itemize
+@item
+glibc systems.  With glibc 2.8 or newer, they are frequently tested.  With
+glibc 2.3 or newer, they are occasionally tested.
+@item
+MacOS X.  In versions 10.5 and 10.6, it's frequently tested.  In version
+10.4, it's rarely tested.
+@item
+FreeBSD 6.0 or newer is occasionally tested.  FreeBSD 5.x is rarely tested.
+@item
+NetBSD 5.0 or newer is occasionally tested.  NetBSD 3.0 or newer is rarely
+tested.
+@item
+OpenBSD 4.0 or newer is occasionally tested.  OpenBSD 3.8 or newer is rarely
+tested.
+@item
+AIX 6.1 or newer is occasionally tested.  AIX 5.1 or newer is rarely tested.
+@item
+HP-UX 11.11 or newer is occasionally tested.  HP-UX 11.00 is rarely tested.
+HP-UX 10.20 is rarely tested and low priority.
+@item
+IRIX 6.5 is occasionally tested.  IRIX 5.3 is rarely tested and low priority.
+@item
+OSF/1 5.1 is occasionally tested.  OSF/1 4.0 is rarely tested and low
+priority.
+@item
+Solaris 8 and newer are occasionally tested.  Solaris 7 is rarely tested.
+Solaris 2.6 and older are rarely tested and low priority.
+@item
+Cygwin 1.7.x is frequently tested.  Cygwin 1.5.x is occasionally tested.
+@item
+mingw is frequently tested.  But note that some modules are currently
+unsupported on mingw: @code{mgetgroups}, @code{getugroups}, @code{idcache},
+@code{userspec}, @code{openpty}, @code{login_tty}, @code{forkpty},
+@code{pt_chown}, @code{grantpt}, @code{pty}, @code{savewd},
+@code{mkancesdirs}, @code{mkdir-p}, @code{euidaccess}, @code{faccessat}.
+The versions of Windows that are supported are Windows XP and newer.
+@item
+Native Windows, with MSVC as compiler, is not tested and low priority.
+@item
+mingw in 64-bit mode is not tested and low priority so far.
+@item
+Interix 6.1 is rarely tested, and requires the @code{suacomp} library
+(@url{http://sourceforge.net/projects/suacomp/}) in version 0.6.8 or newer.
+Interix 3.5 is not tested.
+@item
+Haiku is rarely tested, BeOS is not tested and low priority.
+@item
+uClibc on Linux is rarely tested.
+@item
+QNX is not tested and low priority.
+@end itemize
+
+Gnulib supports these operating systems only in an unvirtualized environment.
+When you run an OS inside a virtual machine, you have to be aware that the
+virtual machine can bring in bugs of its own.  For example, floating-point
+operations on Solaris can behave slightly differently in QEMU than on real
+hardware.  And Haiku's @command{bash} program misbehaves in VirtualBox 3,
+whereas it behaves fine in VirtualBox 4.
+
+Similarly, running native Windows binaries on GNU/Linux under WINE is
+rarely tested and low priority: WINE has a set of behaviours and bugs that
+is slightly different from native Windows.
+
+The following platforms are not supported by Gnulib.  The cost of
+supporting them would exceed the benefit because they are rarely used, or
+poorly documented, or have been supplanted by other platforms, or diverge
+too much from POSIX, or some combination of these and other factors.
+Please don't bother sending us patches for them.
+
+@itemize
+@item
+Windows 95/98/ME.
+@item
+DJGPP and EMX (the 32-bit operating systems running in DOS).
+@item
+MSDOS (the 16-bit operating system).
+@item
+Windows Mobile, Symbian OS, iOS.
+@end itemize
+
 @node Modules
 @section Modules
 
index 8e38c38..443cbc2 100644 (file)
@@ -287,7 +287,7 @@ Also, on some platforms macros like @samp{_FILE_OFFSET_BITS} and
 @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
index 966560d..1e1ad40 100644 (file)
@@ -108,6 +108,7 @@ Resources:
 * Benefits::
 * Library vs Reusable Code::
 * Portability and Application Code::
+* Target Platforms::
 * Modules::
 * Various Kinds of Modules::
 * Collaborative Development::
@@ -396,6 +397,15 @@ Tests modules can depend on non-tests modules.  Non-tests modules should not
 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}
@@ -540,7 +550,7 @@ used here.  It contains a convenient @code{ASSERT} macro.
 
 The body of the test, then, contains many @code{ASSERT} invocations.  When
 a test fails, the @code{ASSERT} macro prints the line number of the failing
-statement, thus giving you as a developer a idea which part of the test
+statement, thus giving you, the developer, an idea of which part of the test
 failed, even when you don't have access to the machine where the test failed
 and the reporting user cannot run a debugger.
 
@@ -6486,6 +6496,8 @@ This list of functions is sorted according to the header that declares them.
 * alloca::
 * alloca-opt::
 * Safe Allocation Macros::
+* Compile-time Assertions::
+* Integer Properties::
 * String Functions in C Locale::
 * Quoting::
 * error and progname::
@@ -6514,6 +6526,10 @@ This list of functions is sorted according to the header that declares them.
 
 @include safe-alloc.texi
 
+@include verify.texi
+
+@include intprops.texi
+
 @node String Functions in C Locale
 @section Character and String Functions in C Locale
 
diff --git a/doc/intprops.texi b/doc/intprops.texi
new file mode 100644 (file)
index 0000000..6942663
--- /dev/null
@@ -0,0 +1,337 @@
+@node Integer Properties
+@section Integer Properties
+
+@c Copyright (C) 2011 Free Software Foundation, Inc.
+
+@c Permission is granted to copy, distribute and/or modify this document
+@c under the terms of the GNU Free Documentation License, Version 1.3 or
+@c any later version published by the Free Software Foundation; with no
+@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+@c Texts.  A copy of the license is included in the ``GNU Free
+@c Documentation License'' file as part of this distribution.
+
+@c Written by Paul Eggert.
+
+@cindex integer properties
+
+The @code{intprops} module consists of an include file @code{<intprops.h>}
+that defines several macros useful for testing properties of integer
+types.
+
+@cindex integer overflow
+@cindex overflow, integer
+
+Integer overflow is a common source of problems in programs written in
+C and other languages.  In some cases, such as signed integer
+arithmetic in C programs, the resulting behavior is undefined, and
+practical platforms do not always behave as if integers wrap around
+reliably.  In other cases, such as unsigned integer arithmetic in C,
+the resulting behavior is well-defined, but programs may still
+misbehave badly after overflow occurs.
+
+Many techniques have been proposed to attack these problems.  These
+include precondition testing, GCC's @option{-ftrapv} option, GCC's
+no-undefined-overflow branch, the As-if Infinitely Ranged (AIR) model
+implemented in Clang, saturation semantics where overflow reliably
+yields an extreme value, the RICH static transformer to an
+overflow-checking variant, and special testing methods.  For more
+information about these techniques, see: Dannenberg R, Dormann W,
+Keaton D @emph{et al.},
+@url{http://www.sei.cmu.edu/library/abstracts/reports/10tn008.cfm,
+As-if Infinitely Ranged integer model -- 2nd ed.}, Software Engineering
+Institute Technical Note CMU/SEI-2010-TN-008, April 2010.
+
+Gnulib supports the precondition testing technique, as this is easy to
+support portably.  There are two families of precondition tests: the
+first, for integer ranges, has a simple and straightforward implementation,
+while the second, for integer types, is easier to use.
+
+@menu
+* Integer Type Determination::  Whether a type has integer properties.
+* Integer Bounds::              Bounds on integer values and representations.
+* Integer Range Overflow::      Integer overflow checking if bounds are known.
+* Integer Type Overflow::       General integer overflow checking.
+@end menu
+
+@node Integer Type Determination
+@subsection Integer Type Determination
+
+@findex TYPE_IS_INTEGER
+@code{TYPE_IS_INTEGER (@var{t})} expands to a constant
+expression that is 1 if the arithmetic type @var{t} is an integer type.
+@code{_Bool} counts as an integer type.
+
+@findex TYPE_SIGNED
+@code{TYPE_SIGNED (@var{t})} expands to a constant expression
+that is 1 if the arithmetic type @var{t} is a signed integer type or a
+floating type.  If @var{t} is an integer type, @code{TYPE_SIGNED (@var{t})}
+expands to an integer constant expression.
+
+Example usage:
+
+@example
+#include <intprops.h>
+#include <time.h>
+enum
+@{
+  time_t_is_signed_integer =
+    TYPE_IS_INTEGER (time_t) && TYPE_SIGNED (time_t)
+@};
+@end example
+
+@node Integer Bounds
+@subsection Integer Bounds
+
+@cindex integer bounds
+
+@findex INT_BUFSIZE_BOUND
+@code{INT_BUFSIZE_BOUND (@var{t})} expands to an integer constant
+expression that is a bound on the size of the string representing an
+integer type or expression @var{t} in decimal notation, including the
+terminating null character and any leading @code{-} character.  For
+example, if @code{INT_STRLEN_BOUND (int)} is 12, any value of type
+@code{int} can be represented in 12 bytes or less, including the
+terminating null.  The bound is not necessarily tight.
+
+Example usage:
+
+@example
+#include <intprops.h>
+#include <stdio.h>
+int
+int_strlen (int i)
+@{
+  char buf[INT_BUFSIZE_BOUND (int)];
+  return sprintf (buf, "%d", i);
+@}
+@end example
+
+@findex INT_STRLEN_BOUND
+@code{INT_STRLEN_BOUND (@var{t})} expands to an integer constant
+expression that is a bound on the length of the string representing an
+integer type or expression @var{t} in decimal notation, including any
+leading @code{-} character.  This is one less than
+@code{INT_BUFSIZE_BOUND (@var{t})}.
+
+@findex TYPE_MINIMUM
+@findex TYPE_MAXIMUM
+@code{TYPE_MINIMUM (@var{t})} and @code{TYPE_MAXIMUM (@var{t})} expand
+to integer constant expressions equal to the minimum and maximum
+values of the integer type @var{t}.  These expressions are of the type
+@var{t} (or more precisely, the type @var{t} after integer
+promotions).
+
+Example usage:
+
+@example
+#include <stdint.h>
+#include <sys/types.h>
+#include <intprops.h>
+int
+in_off_t_range (intmax_t a)
+@{
+  return TYPE_MINIMUM (off_t) <= a && a <= TYPE_MAXIMUM (off_t);
+@}
+@end example
+
+@node Integer Range Overflow
+@subsection Integer Range Overflow
+
+@cindex integer range overflow
+@cindex overflow, integer range
+
+These macros yield 1 if the corresponding C operators might not yield
+numerically correct answers due to arithmetic overflow.  They do not
+rely on undefined or implementation-defined behavior.  They expand to
+integer constant expresssions if their arguments are.  Their
+implementations are simple and straightforward, but they are typically
+harder to use than the integer type overflow macros.  @xref{Integer
+Type Overflow}.
+
+Although the implementation of these macros is similar to that
+suggested in Seacord R, The CERT C Secure Coding Standard (2009,
+revised 2011), in its two sections
+``@url{https://www.securecoding.cert.org/confluence/display/seccode/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap,
+INT30-C. Ensure that unsigned integer operations do not wrap}'' and
+``@url{https://www.securecoding.cert.org/confluence/display/seccode/INT32-C.+Ensure+that+operations+on+signed+integers+do+not+result+in+overflow,
+INT32-C. Ensure that operations on signed integers do not result in
+overflow}'', Gnulib's implementation was derived independently of
+CERT's suggestions.
+
+Example usage:
+
+@example
+#include <intprops.h>
+void
+print_product (long int a, long int b)
+@{
+  if (INT_MULTIPLY_RANGE_OVERFLOW (a, b, LONG_MIN, LONG_MAX))
+    printf ("multiply would overflow");
+  else
+    printf ("product is %ld", a * b);
+@}
+@end example
+
+@noindent
+These macros have the following restrictions:
+
+@itemize @bullet
+@item
+Their arguments must be integer expressions.
+
+@item
+They may evaluate their arguments zero or multiple times, so
+the arguments should not have side effects.
+
+@item
+The arithmetic arguments (including the @var{min} and @var{max}
+arguments) must be of the same integer type after the usual arithmetic
+conversions, and the type must have minimum value @var{min} and
+maximum @var{max}.  Unsigned values should use a zero @var{min} of the
+proper type, for example, @code{(unsigned int) 0}.
+@end itemize
+
+These macros are tuned for constant @var{min} and @var{max}.  For
+commutative operations such as @code{@var{a} + @var{b}}, they are also
+tuned for constant @var{b}.
+
+@table @code
+@item INT_ADD_RANGE_OVERFLOW (@var{a}, @var{b}, @var{min}, @var{max})
+@findex INT_ADD_RANGE_OVERFLOW
+Yield 1 if @code{@var{a} + @var{b}} would overflow in
+[@var{min},@var{max}] integer arithmetic.  See above for restrictions.
+
+@item INT_SUBTRACT_RANGE_OVERFLOW (@var{a}, @var{b}, @var{min}, @var{max})
+@findex INT_SUBTRACT_RANGE_OVERFLOW
+Yield 1 if @code{@var{a} - @var{b}} would overflow in
+[@var{min},@var{max}] integer arithmetic.  See above for restrictions.
+
+@item INT_NEGATE_RANGE_OVERFLOW (@var{a}, @var{min}, @var{max})
+@findex INT_NEGATE_RANGE_OVERFLOW
+Yield 1 if @code{-@var{a}} would overflow in [@var{min},@var{max}]
+integer arithmetic.  See above for restrictions.
+
+@item INT_MULTIPLY_RANGE_OVERFLOW (@var{a}, @var{b}, @var{min}, @var{max})
+@findex INT_MULTIPLY_RANGE_OVERFLOW
+Yield 1 if @code{@var{a} * @var{b}} would overflow in
+[@var{min},@var{max}] integer arithmetic.  See above for restrictions.
+
+@item INT_DIVIDE_RANGE_OVERFLOW (@var{a}, @var{b}, @var{min}, @var{max})
+@findex INT_DIVIDE_RANGE_OVERFLOW
+Yield 1 if @code{@var{a} / @var{b}} would overflow in
+[@var{min},@var{max}] integer arithmetic.  See above for restrictions.
+Division overflow can happen on two's complement hosts when dividing
+the most negative integer by @minus{}1.  This macro does not check for
+division by zero.
+
+@item INT_REMAINDER_RANGE_OVERFLOW (@var{a}, @var{b}, @var{min}, @var{max})
+@findex INT_REMAINDER_RANGE_OVERFLOW
+Yield 1 if @code{@var{a} % @var{b}} would overflow in
+[@var{min},@var{max}] integer arithmetic.  See above for restrictions.
+Remainder overflow can happen on two's complement hosts when dividing
+the most negative integer by @minus{}1; although the mathematical
+result is always 0, in practice some implementations trap, so this
+counts as an overflow.  This macro does not check for division by
+zero.
+
+@item INT_LEFT_SHIFT_RANGE_OVERFLOW (@var{a}, @var{b}, @var{min}, @var{max})
+@findex INT_LEFT_SHIFT_RANGE_OVERFLOW
+Yield 1 if @code{@var{a} << @var{b}} would overflow in
+[@var{min},@var{max}] integer arithmetic.  See above for restrictions.
+Here, @var{min} and @var{max} are for @var{a} only, and @var{b} need
+not be of the same type as the other arguments.  The C standard says
+that behavior is undefined for shifts unless 0@leq{}@var{b}<@var{w}
+where @var{w} is @var{a}'s word width, and that when @var{a} is negative
+then @code{@var{a} << @var{b}} has undefined behavior and
+@code{@var{a} >> @var{b}} has implementation-defined behavior, but
+this macro does not check these other restrictions.
+@end table
+
+@node Integer Type Overflow
+@subsection Integer Type Overflow
+
+@cindex integer type overflow
+@cindex overflow, integer type
+
+These macros yield 1 if the corresponding C operators might not yield
+numerically correct answers due to arithmetic overflow of an integer
+type.  They work correctly on all known practical hosts, and do not
+rely on undefined behavior due to signed arithmetic overflow.  They
+expand to integer constant expresssions if their arguments are.  They
+are easier to use than the integer range overflow macros
+(@pxref{Integer Range Overflow}).
+
+Example usage:
+
+@example
+#include <intprops.h>
+void
+print_product (long int a, long int b)
+@{
+  if (INT_MULTIPLY_OVERFLOW (a, b))
+    printf ("multiply would overflow");
+  else
+    printf ("product is %ld", a * b);
+@}
+@end example
+
+@noindent
+These macros have the following restrictions:
+
+@itemize @bullet
+@item
+Their arguments must be integer expressions.
+
+@item
+They may evaluate their arguments zero or multiple times, so the
+arguments should not have side effects.
+@end itemize
+
+These macros are tuned for their last argument being a constant.
+
+@table @code
+@item INT_ADD_OVERFLOW (@var{a}, @var{b})
+@findex INT_ADD_OVERFLOW
+Yield 1 if @code{@var{a} + @var{b}} would overflow.  See above for
+restrictions.
+
+@item INT_SUBTRACT_OVERFLOW (@var{a}, @var{b})
+@findex INT_SUBTRACT_OVERFLOW
+Yield 1 if @code{@var{a} - @var{b}} would overflow.  See above for
+restrictions.
+
+@item INT_NEGATE_OVERFLOW (@var{a})
+@findex INT_NEGATE_OVERFLOW
+Yields 1 if @code{-@var{a}} would overflow.  See above for restrictions.
+
+@item INT_MULTIPLY_OVERFLOW (@var{a}, @var{b})
+@findex INT_MULTIPLY_OVERFLOW
+Yield 1 if @code{@var{a} * @var{b}} would overflow.  See above for
+restrictions.
+
+@item INT_DIVIDE_OVERFLOW (@var{a}, @var{b})
+@findex INT_DIVIDE_OVERFLOW
+Yields 1 if @code{@var{a} / @var{b}} would overflow.  See above for
+restrictions.  Division overflow can happen on two's complement hosts
+when dividing the most negative integer by @minus{}1.  This macro does
+not check for division by zero.
+
+@item INT_REMAINDER_OVERFLOW (@var{a}, @var{b})
+@findex INT_REMAINDER_OVERFLOW
+Yield 1 if @code{@var{a} % @var{b}} would overflow.  See above for
+restrictions.  Remainder overflow can happen on two's complement hosts
+when dividing the most negative integer by @minus{}1; although the
+mathematical result is always 0, in practice some implementations
+trap, so this counts as an overflow.  This macro does not check for
+division by zero.
+
+@item INT_LEFT_SHIFT_OVERFLOW (@var{a}, @var{b})
+@findex INT_LEFT_SHIFT_OVERFLOW
+Yield 1 if @code{@var{a} << @var{b}} would overflow.  See above for
+restrictions.  The C standard says that behavior is undefined for
+shifts unless 0@leq{}@var{b}<@var{w} where @var{w} is @var{a}'s word
+width, and that when @var{a} is negative then @code{@var{a} <<
+@var{b}} has undefined behavior and @code{@var{a} >> @var{b}} has
+implementation-defined behavior, but this macro does not check these
+other restrictions.
+@end table
index a2ba64b..ab03d6c 100644 (file)
@@ -470,13 +470,7 @@ decision will be guided by the two goals of preserving the free status
 of all derivatives of our free software and of promoting the sharing
 and reuse of software generally.
 
-@iftex
-@heading NO WARRANTY
-@end iftex
-@ifinfo
-@center NO WARRANTY
-
-@end ifinfo
+@center @b{NO WARRANTY}
 
 @item
 BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
@@ -502,13 +496,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 DAMAGES.
 @end enumerate
 
-@iftex
-@heading END OF TERMS AND CONDITIONS
-@end iftex
-@ifinfo
-@center END OF TERMS AND CONDITIONS
-
-@end ifinfo
+@subheading END OF TERMS AND CONDITIONS
 
 @page
 @subheading How to Apply These Terms to Your New Libraries
index 08657cd..126b19c 100644 (file)
@@ -5,7 +5,7 @@
 @c For double-sided printing, uncomment:
 @c @setchapternewpage odd
 @c This date is automagically updated when you save this file:
-@set lastupdate January 20, 2011
+@set lastupdate May 9, 2011
 @c %**end of header
 
 @dircategory GNU organization
@@ -128,10 +128,12 @@ This release of the GNU Maintainer Information was last updated
 @cindex help, getting
 
 @cindex @code{mentors@@gnu.org} mailing list
-If you have general questions or encounter a situation where it isn't
-clear what to do, you can ask @email{mentors@@gnu.org}, which is a
-list of a few experienced GNU contributors who have offered to answer
-questions for new maintainers.
+If you have any general questions or encounter a situation where it
+isn't clear how to get something done or who to ask, you (as a GNU
+contributor) can always write to @email{mentors@@gnu.org}, which is a
+list of a few experienced GNU folks who have volunteered to answer
+questions.  Any GNU-related question is fair game for the
+@code{mentors} list.
 
 @cindex advisory committee
 The GNU Advisory Committee helps to coordinate activities in the GNU
@@ -142,6 +144,21 @@ committee at @email{gnu-advisory@@gnu.org}.  See
 committee members.  Additional information is in
 @file{/gd/gnuorg/advisory}.
 
+@cindex down, when GNU machines are
+@cindex outage, of GNU machines
+@cindex @url{http://identi.ca/group/fsfstatus}
+If you find that any GNU computer systems (@code{fencepost.gnu.org},
+@code{ftp.gnu.org}, @code{www.gnu.org}, @code{savannah.gnu.org},
+@dots{}) seem to be down, you can check the current status at
+@url{http://identi.ca/group/fsfstatus}.  Most likely the problem, if
+it can be alleviated at the FSF end, is already being worked on.
+
+@cindex sysadmin, FSF
+@cindex FSF system administrators
+@cindex GNU system administrators
+The FSF system administrators are responsible for the network and GNU
+hardware.  You can email them at @email{sysadmin@@fsf.org}, but please
+try not to burden them unnecessarily.
 
 
 @node Getting a GNU Account
@@ -162,15 +179,6 @@ the package.
 
 @gdgnuorgtext{}
 
-@cindex down, when GNU machines are
-@cindex outage, of GNU machines
-@cindex @url{http://identi.ca/group/fsfstatus}
-If you find that any GNU computer systems (@code{fencepost.gnu.org},
-@code{ftp.gnu.org}, @code{www.gnu.org}, @code{savannah.gnu.org},
-@dots{}) seem to be down, you can check the current status at
-@url{http://identi.ca/group/fsfstatus}.  Most likely the problem, if
-it can be alleviated at the FSF end, is already being worked on.
-
 
 @node Stepping Down
 @chapter Stepping Down
@@ -1163,8 +1171,9 @@ useful for your package.
 It is very important to keep backup files of all source files of GNU.
 You can do this using a source control system (such as Bazaar, RCS,
 CVS, Git, Subversion, @dots{}) if you like.  The easiest way to use
-RCS or CVS is via the Version Control library in Emacs (@pxref{VC
-Concepts,, Concepts of Version Control, emacs, The GNU Emacs Manual}).
+RCS or CVS is via the Version Control library in Emacs
+(@pxref{Introduction to VC,, Introduction to Version Control, emacs,
+The GNU Emacs Manual}).
 
 The history of previous revisions and log entries is very important for
 future maintainers of the package, so even if you do not make it
index 61b0093..b937e15 100644 (file)
@@ -10,7 +10,7 @@ Portability problems fixed by Gnulib:
 @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 @@ used instead.
 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
index fc1e359..6054c30 100644 (file)
@@ -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 @@ This function returns @code{EMFILE} instead of @code{EBADF} for
 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
index da26c87..40a2052 100644 (file)
@@ -9,6 +9,10 @@ Gnulib module: fclose
 Portability problems fixed by Gnulib:
 @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.
+@item
 On Windows platforms (excluding Cygwin), @code{socket} and @code{accept}
 followed by @code{fdopen} do not return streams that can be closed by
 @code{fclose}.
index 057efe7..4cbe30e 100644 (file)
@@ -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:
index fd0744e..2d840b1 100644 (file)
@@ -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:
index e922e85..44bcca3 100644 (file)
@@ -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 @@ This function can crash in out-of-memory conditions on some platforms:
 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
@@ -74,4 +83,8 @@ mingw.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+Attempting to write to a read-only stream fails with @code{EOF} but
+does not set the error flag for @code{ferror} on some platforms:
+glibc 2.13.
 @end itemize
index 2f09a8a..9d6c9fd 100644 (file)
@@ -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
index d2c46ef..7fc4bf5 100644 (file)
@@ -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
index 6f02f51..57155c2 100644 (file)
@@ -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:
index 49d528a..1c47ec2 100644 (file)
@@ -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:
index d9defec..20f7fb8 100644 (file)
@@ -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
index ece2bdc..d94a6ed 100644 (file)
@@ -10,13 +10,18 @@ Portability problems fixed by Gnulib:
 @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
index 7c92ab4..fea0511 100644 (file)
@@ -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:
index d365f8d..3b11d99 100644 (file)
@@ -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:
index 4d00af8..ffb5086 100644 (file)
@@ -4,15 +4,28 @@
 
 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
-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.
+On some other platforms, this call is not allowed.
+@item
+On some platforms, the prototype for @code{getcwd} uses @code{int}
+instead of @code{size_t} for the size argument:
+mingw.
+@item
+On some platforms, @code{getcwd (buf, 0)} fails with @code{ERANGE}
+instead of the required @code{EINVAL}:
+mingw.
+@end itemize
+
+Portability problems fixed by Gnulib module @code{getcwd}:
+@itemize
+@item
+This function is missing on some older platforms.
 @item
 This function does not handle long file names (greater than @code{PATH_MAX})
 correctly on some platforms.
@@ -20,4 +33,11 @@ correctly on some platforms.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+When using @code{getcwd(NULL, nonzero)}, some platforms, such as glibc
+or cygwin, allocate exactly @code{nonzero} bytes and fail with
+@code{ERANGE} if it was not big enough, while other platforms, such as
+FreeBSD or mingw, ignore the size argument and allocate whatever size
+is necessary.  If this call succeeds, an application cannot portably
+access beyond the string length of the result.
 @end itemize
index af29450..1a3b277 100644 (file)
@@ -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:
index 3f984b5..7ba2cfc 100644 (file)
@@ -27,8 +27,8 @@ when GNU libiconv is not installed.
 @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}
index 3c9cfcb..68a15a2 100644 (file)
@@ -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
index 55b42a9..ebe8c50 100644 (file)
@@ -12,15 +12,22 @@ Portability problems fixed by Gnulib:
 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.
index 223126f..55b333c 100644 (file)
@@ -14,6 +14,10 @@ and (without the slash) names a nonexistent file or a file that is not a
 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{nonblocking} on some platforms:
+mingw.
+@item
 On Windows platforms (excluding Cygwin), this function does usually not
 recognize the @file{/dev/null} filename.
 @end itemize
index eaee96a..8fc8cb0 100644 (file)
@@ -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 @@ This function can crash in out-of-memory conditions on some platforms:
 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
@@ -74,4 +83,8 @@ mingw.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+Attempting to write to a read-only stream fails with @code{EOF} but
+does not set the error flag for @code{ferror} on some platforms:
+glibc 2.13.
 @end itemize
index b7011a0..d156461 100644 (file)
@@ -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
index d89ab71..aeb6b43 100644 (file)
@@ -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
index 69ee72e..ef350ac 100644 (file)
@@ -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
index 385fb77..2f5312d 100644 (file)
@@ -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:
index 0c20b4e..fd3f160 100644 (file)
@@ -14,7 +14,7 @@ mingw, BeOS.
 @item
 This function does not allow for a NULL @samp{resolved} parameter on
 some platforms:
-Solaris 10.
+MacOS X 10.5, FreeBSD 6.4, OpenBSD 4.4, Solaris 10.
 @item
 This function does not always return an absolute path on some
 platforms:
@@ -27,6 +27,9 @@ glibc 2.3.5.
 This function fails to recognize non-directories followed @samp{..} on
 some platforms:
 cygwin.
+@item
+This function misbehaves on consecutive slashes on some platforms:
+AIX 7.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index fbca167..f29378c 100644 (file)
@@ -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:
index c54018e..ee4d477 100644 (file)
@@ -13,9 +13,9 @@ On Windows platforms (excluding Cygwin), @code{setlocale(@var{category},NULL)}
 ignores the environment variables @code{LC_ALL}, @code{@var{category}}, and
 @code{LANG}.
 @item
-On Windows platforms (excluding Cygwin), @code{setlocale(LC_ALL,@var{name})}
-succeeds and sets the LC_CTYPE category to @samp{C} when it does not support
-the encoding, instead of failing.
+On Windows platforms (excluding Cygwin) and Cygwin 1.5.x,
+@code{setlocale(LC_ALL,@var{name})} succeeds and sets the LC_CTYPE category to
+@samp{C} when it does not support the encoding, instead of failing.
 @item
 On Windows platforms (excluding Cygwin), @code{setlocale} understands different
 locale names, that are not based on ISO 639 language names and ISO 3166 country
index bc3ee0f..a91ebd6 100644 (file)
@@ -10,7 +10,7 @@ Portability problems fixed by Gnulib:
 @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 @@ used instead.
 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
index 222f584..4f8f08b 100644 (file)
@@ -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 @@ platforms:
 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
index 7e50234..c6fab25 100644 (file)
@@ -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 @@ This function can crash in out-of-memory conditions on some platforms:
 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
@@ -74,4 +83,8 @@ mingw.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+Attempting to write to a read-only stream fails with @code{EOF} but
+does not set the error flag for @code{ferror} on some platforms:
+glibc 2.13.
 @end itemize
index 9f3da4d..d051e6d 100644 (file)
@@ -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:
index 526070e..21d4bc6 100644 (file)
@@ -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 @@ This function can crash in out-of-memory conditions on some platforms:
 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
@@ -74,4 +83,8 @@ mingw.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+Attempting to write to a read-only stream fails with @code{EOF} but
+does not set the error flag for @code{ferror} on some platforms:
+glibc 2.13.
 @end itemize
index 980f1a8..feff03a 100644 (file)
@@ -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:
index 826151c..604507d 100644 (file)
@@ -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
index 02a1c3b..aa78ee7 100644 (file)
@@ -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
index 12f0f65..c87e872 100644 (file)
@@ -9,9 +9,14 @@ Portability problems fixed by Gnulib:
 @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.
index 77a5432..7e953ce 100644 (file)
@@ -28,6 +28,11 @@ mingw.
 @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:
index db1b969..2f7cf63 100644 (file)
@@ -19,7 +19,7 @@ OSF/1 4.0.
 @item
 This header file is not self-contained --- it requires @code{<string.h>}
 before @code{FD_ZERO} can be used --- on some platforms:
-Solaris 11 2010-11.
+AIX 7.1, Solaris 11 2010-11.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index c8e4228..72fd688 100644 (file)
@@ -17,6 +17,9 @@ This header file is not self-contained on some platforms: it requires
 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 @@ AIX 7.1.
 
 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
index 44282f2..1f8c8a2 100644 (file)
@@ -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
index 13c5014..38c239c 100644 (file)
@@ -25,6 +25,10 @@ IRIX 6.5.30.
 @item
 The functions @code{isw*} are actually defined as macros that don't work,
 on IRIX 5.3.
+@item
+This header file defines some identifiers, such as @code{multibyte}, as macros
+on some platforms:
+Solaris 2.6.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 093f4cc..52ecf9b 100644 (file)
@@ -885,7 +885,7 @@ All other characters are ordinary.  For example, @samp{[.*]} matches
 Collating symbols can be represented inside lists.
 You form a @dfn{collating symbol} by
 putting a collating element between an @dfn{open-collating-symbol
-operator} and an @dfn{close-collating-symbol operator}.  @samp{[.}
+operator} and a @dfn{close-collating-symbol operator}.  @samp{[.}
 represents the open-collating-symbol operator and @samp{.]} represents
 the close-collating-symbol operator.  For example, if @samp{ll} is a
 collating element, then @samp{[[.ll.]]} would match @samp{ll}.
@@ -1624,7 +1624,7 @@ compiled pattern.  @var{string} is the string you want to match; it can
 contain newline and null characters.  @var{size} is the length of that
 string.  @var{start} is the string index at which you want to
 begin matching; the first character of @var{string} is at index zero.
-@xref{Using Registers}, for a explanation of @var{regs}; you can safely
+@xref{Using Registers}, for an explanation of @var{regs}; you can safely
 pass zero.
 
 @code{re_match} matches the regular expression in @var{pattern_buffer}
index 1847370..4c7eead 100644 (file)
@@ -3,7 +3,7 @@
 @setfilename standards.info
 @settitle GNU Coding Standards
 @c This date is automagically updated when you save this file:
-@set lastupdate March 28, 2011
+@set lastupdate May 5, 2011
 @c %**end of header
 
 @dircategory GNU organization
@@ -181,6 +181,7 @@ Or turn some parts of the program into independently usable libraries.
 Or use a simple garbage collector instead of tracking precisely when
 to free memory, or use a new GNU facility such as obstacks.
 
+
 @node Contributions
 @section Accepting Contributions
 @cindex legal papers
@@ -223,10 +224,11 @@ The very worst thing is if you forget to tell us about the other
 contributor.  We could be very embarrassed in court some day as a
 result.
 
-We have more detailed advice for maintainers of programs; if you have
-reached the stage of actually maintaining a program for GNU (whether
-released or not), please ask us for a copy.  It is also available
-online for your perusal: @uref{http://www.gnu.org/prep/maintain/}.
+We have more detailed advice for maintainers of GNU packages.  If you
+have reached the stage of maintaining a GNU program (whether released
+or not), please take a look: @pxref{Legal Matters,,, maintain,
+Information for GNU Maintainers}.
+
 
 @node Trademarks
 @section Trademarks
@@ -594,6 +596,7 @@ POSIX is never a problem in practice, and it is very useful.
 In particular, don't reject a new feature, or remove an old one,
 merely because a standard says it is ``forbidden'' or ``deprecated.''
 
+
 @node Semantics
 @section Writing Robust Programs
 
@@ -604,6 +607,7 @@ all data structures dynamically.  In most Unix utilities, ``long lines
 are silently truncated''.  This is not acceptable in a GNU utility.
 
 @cindex @code{NUL} characters
+@findex libiconv
 Utilities reading files should not drop NUL characters, or any other
 nonprinting characters @emph{including those with codes above 0177}.
 The only sensible exceptions would be utilities specifically intended
@@ -611,15 +615,16 @@ for interface to certain types of terminals or printers
 that can't handle those characters.
 Whenever possible, try to make programs work properly with
 sequences of bytes that represent multibyte characters, using encodings
-such as UTF-8 and others.
+such as UTF-8 and others.  You can use libiconv to deal with a wide
+range of encodings.
 
 @cindex error messages
-Check every system call for an error return, unless you know you wish to
-ignore errors.  Include the system error text (from @code{perror} or
-equivalent) in @emph{every} error message resulting from a failing
-system call, as well as the name of the file if any and the name of the
-utility.  Just ``cannot open foo.c'' or ``stat failed'' is not
-sufficient.
+Check every system call for an error return, unless you know you wish
+to ignore errors.  Include the system error text (from @code{perror},
+@code{strerror}, or equivalent) in @emph{every} error message
+resulting from a failing system call, as well as the name of the file
+if any and the name of the utility.  Just ``cannot open foo.c'' or
+``stat failed'' is not sufficient.
 
 @cindex @code{malloc} return value
 @cindex memory allocation failure
@@ -2329,10 +2334,11 @@ memory and give a fatal error if @code{malloc} returns zero.
 
 @pindex valgrind
 @cindex memory leak
-Memory leak detectors such as @command{valgrind} can be useful, but
+Memory analysis tools such as @command{valgrind} can be useful, but
 don't complicate a program merely to avoid their false alarms.  For
 example, if memory is used until just before a process exits, don't
-free it simply to silence a leak detector.
+free it simply to silence such a tool.
+
 
 @node File Usage
 @section File Usage
index 86ab8fe..f95279d 100644 (file)
@@ -17,7 +17,7 @@
 @findex verify_true
 
 The @samp{verify} module supports compile-time tests, as opposed to
-the standard @file{assert.h} header which supports only runtime tests.
+the standard @code{assert} macro which supports only runtime tests.
 Since the tests occur at compile-time, they are more reliable, and
 they require no runtime overhead.
 
@@ -45,7 +45,17 @@ integer constant expression, then a compiler might reject a usage like
 @samp{verify (@var{EXPRESSION});} even when @var{EXPRESSION} is
 nonzero.
 
-Here are some example uses.
+Although the standard @code{assert} macro is a runtime test, draft C1X
+specifies a builtin @code{_Static_assert (@var{EXPRESSION},
+@var{STRING-LITERAL})}, its @file{assert.h} header has a similar macro
+named @code{static_assert}, and draft C++0X has a similar
+@code{static_assert} builtin.  These draft builtins and macros differ
+from @code{verify} in two major ways.  First, they can also be used
+within a @code{struct} or @code{union} specifier, in place of an
+ordinary member declaration.  Second, they require the programmer to
+specify a compile-time diagnostic as a string literal.
+
+Here are some example uses of @code{verify} and @code{verify_true}.
 
 @example
 #include <verify.h>
@@ -56,9 +66,8 @@ Here are some example uses.
 /* Verify that time_t is an integer type.  */
 verify ((time_t) 1.5 == 1);
 
-/* Verify that time_t is at least as wide as int.  */
-verify (INT_MIN == (time_t) INT_MIN);
-verify (INT_MAX == (time_t) INT_MAX);
+/* Verify that time_t is no smaller than int.  */
+verify (sizeof (int) <= sizeof (time_t));
 
 /* Verify that time_t is signed.  */
 verify ((time_t) -1 < 0);
index 34fc3cc..16e63eb 100755 (executable)
@@ -223,6 +223,10 @@ Options for --import, --add/remove-import,
       --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 @@ fi
 # - 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 @@ fi
   excl_privileged_tests=
   excl_unportable_tests=
   avoidlist=
+  cond_dependencies=
   lgpl=
   makefile_name=
   libtool=
@@ -1002,7 +1009,7 @@ fi
       --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 @@ fi
         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 @@ fi
   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 @@ func_get_autoconf_snippet ()
   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 @@ func_get_automake_snippet ()
       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 @@ func_get_automake_snippet ()
       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 @@ func_get_automake_snippet ()
   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 @@ func_acceptable ()
   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 @@ func_acceptable ()
 # - 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 @@ func_modules_transitive_closure ()
   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 @@ func_modules_transitive_closure ()
       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,28 @@ func_modules_transitive_closure ()
             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 +2750,7 @@ func_show_module_list ()
   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}"'/'
 }
 
@@ -2807,7 +3035,7 @@ func_emit_lib_Makefile_am ()
       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' \
@@ -2820,16 +3048,32 @@ func_emit_lib_Makefile_am ()
             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
@@ -3360,6 +3604,190 @@ func_emit_initmacro_done ()
   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
@@ -3386,6 +3814,8 @@ func_emit_initmacro_done ()
 #                         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
@@ -4541,22 +4971,7 @@ s,//*$,/,'
     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="
@@ -4572,18 +4987,7 @@ s,//*$,/,'
     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
@@ -4864,6 +5268,8 @@ s,//*$,/,'
 # - 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
@@ -5136,34 +5542,9 @@ func_create_testdir ()
      # 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.
@@ -5269,19 +5650,7 @@ func_create_testdir ()
    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.
index 24f4bc9..9b8e00d 100644 (file)
@@ -31,7 +31,7 @@
 # define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
 #endif
 
-/* Determine the good alignment of a object of the given type at compile time.
+/* Determine the good alignment of an object of the given type at compile time.
    Note that this is not necessarily the same as alignof_slot(type).
    For example, with GNU C on x86 platforms: alignof_type(double) = 8, but
    - when -malign-double is not specified:  alignof_slot(double) = 4,
diff --git a/lib/allocator.c b/lib/allocator.c
new file mode 100644 (file)
index 0000000..2c1a3da
--- /dev/null
@@ -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 };
diff --git a/lib/allocator.h b/lib/allocator.h
new file mode 100644 (file)
index 0000000..953117d
--- /dev/null
@@ -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 */
index bc6104f..6bf9a0c 100644 (file)
 /* 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);
 }
index a13c0e5..2c227f3 100644 (file)
 /* 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 */
index 9ebe2d1..f87729d 100644 (file)
@@ -73,8 +73,8 @@ void argmatch_valid (char const *const *arglist,
 
 
 
-/* Same as argmatch, but upon failure, reports a explanation on the
-   failure, and exits using the function EXIT_FN. */
+/* Same as argmatch, but upon failure, report an explanation of the
+   failure, and exit using the function EXIT_FN. */
 
 ptrdiff_t __xargmatch_internal (char const *context,
                                 char const *arg, char const *const *arglist,
index 48c37a9..7993794 100644 (file)
@@ -259,7 +259,7 @@ fill_in_uparams (const struct argp_state *state)
 /* Returns true if OPT is an alias for an earlier option.  */
 #define oalias(opt) ((opt)->flags & OPTION_ALIAS)
 
-/* Returns true if OPT is an documentation-only entry.  */
+/* Returns true if OPT is a documentation-only entry.  */
 #define odoc(opt) ((opt)->flags & OPTION_DOC)
 
 /* Returns true if OPT should not be translated */
@@ -359,7 +359,7 @@ struct hol_entry
   /* A pointers into the HOL's short_options field, to the first short option
      letter for this entry.  The order of the characters following this point
      corresponds to the order of options pointed to by OPT, and there are at
-     most NUM.  A short option recorded in a option following OPT is only
+     most NUM.  A short option recorded in an option following OPT is only
      valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's
      probably been shadowed by some other entry).  */
   char *short_options;
@@ -713,7 +713,7 @@ hol_cluster_is_child (const struct hol_cluster *cl1,
   return cl1 == cl2;
 }
 \f
-/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail
+/* Given the name of an OPTION_DOC option, modifies NAME to start at the tail
    that should be used for comparisons, and returns true iff it should be
    treated as a non-option.  */
 static int
@@ -1551,7 +1551,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
     free ((char *) inp_text);   /* We copied INP_TEXT, so free it now.  */
 
   if (post && argp->help_filter)
-    /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text.  */
+    /* Now see if we have to output an ARGP_KEY_HELP_EXTRA text.  */
     {
       text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input);
       if (text)
index c884b89..5cab8ce 100644 (file)
@@ -254,7 +254,7 @@ struct parser
   struct group *groups;
   /* The end of the GROUPS array.  */
   struct group *egroup;
-  /* An vector containing storage for the CHILD_INPUTS field in all groups.  */
+  /* A vector containing storage for the CHILD_INPUTS field in all groups.  */
   void **child_inputs;
 
   /* True if we think using getopt is still useful; if false, then
diff --git a/lib/assert.in.h b/lib/assert.in.h
new file mode 100644 (file)
index 0000000..1857ceb
--- /dev/null
@@ -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.  */
index 9bfb44f..1574ec1 100644 (file)
@@ -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
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
new file mode 100644 (file)
index 0000000..0b8f74e
--- /dev/null
@@ -0,0 +1,169 @@
+/* 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"
+
+/* 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);
+}
+
+/* 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;
+}
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h
new file mode 100644 (file)
index 0000000..6576fb2
--- /dev/null
@@ -0,0 +1,72 @@
+/* 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>.  */
+#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
+#endif
+ssize_t careadlinkatcwd (int fd, char const *filename,
+                         char *buffer, size_t buffer_size);
+
+#endif /* _GL_CAREADLINKAT_H */
index 07c45ab..8a0774d 100644 (file)
@@ -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 @@ extern "C" {
 
    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
 {
diff --git a/lib/close-hook.c b/lib/close-hook.c
deleted file mode 100644 (file)
index 0fdf323..0000000
+++ /dev/null
@@ -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
diff --git a/lib/close-hook.h b/lib/close-hook.h
deleted file mode 100644 (file)
index adcf11c..0000000
+++ /dev/null
@@ -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 */
index 1c06c16..2c41c75 100644 (file)
@@ -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 @@ rpl_close (int fd)
 #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
index 930e861..093165c 100644 (file)
@@ -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)
index 2f87da6..7525142 100644 (file)
 
 #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)
 {
index 101f975..4178354 100644 (file)
 # undef stat
 # define stat stat64
 
-#else
-
-# include "group-member.h"
-
 #endif
 
 /* Return 0 if the user has permission of type MODE on FILE;
index fe57e22..6de6c62 100644 (file)
@@ -158,7 +158,7 @@ execute (const char *progname,
                            (const char **) environ);
       if (exitcode < 0 && errno == ENOEXEC)
         {
-          /* prog is not an native executable.  Try to execute it as a
+          /* prog is not a native executable.  Try to execute it as a
              shell script.  Note that prepare_spawn() has already prepended
              a hidden element "sh.exe" to prog_argv.  */
           --prog_argv;
index 94c4e71..6dd704f 100644 (file)
 #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 @@ ensure_dirs_slot (size_t fd)
   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;
 }
 
index 1d7e85b..27f6836 100644 (file)
 #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;
+  int result = 0;
+
+  /* Don't change behavior on memstreams.  */
+  fd = fileno (fp);
+  if (fd < 0)
+    return fclose (fp);
 
-  if (fflush (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)
+  /* fclose() calls close(), but we need to also invoke all hooks that our
+     overridden close() function invokes.  See lib/close.c.  */
+#if WINDOWS_SOCKETS
+  /* Call the overridden close(), then the original fclose().
+     Note about multithread-safety: There is a race condition where some
+     other thread could open fd between our close and fclose.  */
+  if (close (fd) < 0 && saved_errno == 0)
     saved_errno = errno;
 
-  fclose (fp); /* will fail with errno = EBADF */
+  fclose (fp); /* will fail with errno = EBADF, if we did not lose a race */
+
+#else /* !WINDOWS_SOCKETS */
+  /* Call fclose() and invoke all hooks of the overridden close().  */
+
+# if REPLACE_FCHDIR
+  /* Note about multithread-safety: There is a race condition here as well.
+     Some other thread could open fd between our calls to fclose and
+     _gl_unregister_fd.  */
+  result = fclose (fp);
+  if (result == 0)
+    _gl_unregister_fd (fd);
+# else
+  /* No race condition here.  */
+  result = fclose (fp);
+# endif
+
+#endif /* !WINDOWS_SOCKETS */
 
   if (saved_errno != 0)
     {
       errno = saved_errno;
-      return EOF;
+      result = EOF;
     }
-  return 0;
+
+  return result;
 }
index a238a85..ce7c8c0 100644 (file)
@@ -182,8 +182,7 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
 #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 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
 # 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
diff --git a/lib/fd-hook.c b/lib/fd-hook.c
new file mode 100644 (file)
index 0000000..40fbeeb
--- /dev/null
@@ -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
diff --git a/lib/fd-hook.h b/lib/fd-hook.h
new file mode 100644 (file)
index 0000000..aab4d91
--- /dev/null
@@ -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 */
index ed760dd..8334491 100644 (file)
@@ -200,6 +200,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
         case L_('['):
           {
             /* Nonzero if the sense of the character class is inverted.  */
+            const CHAR *p_init = p;
+            const CHAR *n_init = n;
             register bool not;
             CHAR cold;
             UCHAR fn;
@@ -410,8 +412,13 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
                   }
 #endif
                 else if (c == L_('\0'))
-                  /* [ (unterminated) loses.  */
-                  return FNM_NOMATCH;
+                  {
+                    /* [ unterminated, treat as normal character.  */
+                    p = p_init;
+                    n = n_init;
+                    c = L_('[');
+                    goto normal_match;
+                  }
                 else
                   {
                     bool is_range = false;
index ad762dd..d3ad1cd 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -710,7 +710,7 @@ leaf_optimization_applies (int dir_fd _GL_UNUSED) { return false; }
 #endif
 
 /* link-count-optimization entry:
-   map an stat.st_dev number to a boolean: leaf_optimization_works */
+   map a stat.st_dev number to a boolean: leaf_optimization_works */
 struct LCO_ent
 {
   dev_t st_dev;
index ee595e1..f758f8e 100644 (file)
 # 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 @@ gai_strerror (int code)
 
   return _("Unknown error");
 }
-#ifdef _LIBC
+# ifdef _LIBC
 libc_hidden_def (gai_strerror)
-#endif
+# endif
+#endif /* !HAVE_DECL_GAI_STRERROR */
index 03d27c1..d514748 100644 (file)
--- a/lib/gc.h
+++ b/lib/gc.h
@@ -168,7 +168,7 @@ extern Gc_rc gc_hmac_sha1 (const void *key, size_t keylen,
    larger value means this function take more time (typical iteration
    counts are 1000-20000).  This function "stretches" the key to be
    exactly dkLen bytes long.  GC_OK is returned on success, otherwise
-   an Gc_rc error code is returned.  */
+   a Gc_rc error code is returned.  */
 extern Gc_rc
 gc_pbkdf2_sha1 (const char *P, size_t Plen,
                 const char *S, size_t Slen,
index e63a18d..0eddbb1 100644 (file)
@@ -5672,7 +5672,7 @@ output_tables (const char *filename, const char *version)
   fprintf (stream, "escape_char /\n");
   fprintf (stream, "comment_char %%\n");
   fprintf (stream, "\n");
-  fprintf (stream, "%% Generated automatically by gen-unicode-ctype for Unicode %s.\n",
+  fprintf (stream, "%% Generated automatically by gen-uni-tables.c for Unicode %s.\n",
            version);
   fprintf (stream, "\n");
 
@@ -7297,7 +7297,7 @@ output_lbrk_tables (const char *filename1, const char *filename2, const char *ve
 
       fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
       fprintf (stream, "/* Line breaking properties of Unicode characters.  */\n");
-      fprintf (stream, "/* Generated automatically by gen-lbrk for Unicode %s.  */\n",
+      fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
                version);
       fprintf (stream, "\n");
 
@@ -7778,7 +7778,7 @@ output_wbrk_tables (const char *filename, const char *version)
 
   fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
   fprintf (stream, "/* Line breaking properties of Unicode characters.  */\n");
-  fprintf (stream, "/* Generated automatically by gen-uni-tables for Unicode %s.  */\n",
+  fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
            version);
   fprintf (stream, "\n");
 
@@ -8528,7 +8528,7 @@ output_composition_tables (const char *filename, const char *version)
 
   fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
   fprintf (stream, "/* Canonical composition of Unicode characters.  */\n");
-  fprintf (stream, "/* Generated automatically by gen-uni-tables for Unicode %s.  */\n",
+  fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
            version);
   fprintf (stream, "\n");
 
@@ -8661,7 +8661,7 @@ output_simple_mapping_test (const char *filename,
   fprintf (stream, "   You should have received a copy of the GNU General Public License\n");
   fprintf (stream, "   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\n");
   fprintf (stream, "\n");
-  fprintf (stream, "/* Generated automatically by gen-case.c for Unicode %s.  */\n",
+  fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
            version);
   fprintf (stream, "\n");
   fprintf (stream, "#include \"test-mapping-part1.h\"\n");
@@ -8723,7 +8723,7 @@ output_simple_mapping (const char *filename,
 
   fprintf (stream, "/* DO NOT EDIT! GENERATED AUTOMATICALLY! */\n");
   fprintf (stream, "/* Simple character mapping of Unicode characters.  */\n");
-  fprintf (stream, "/* Generated automatically by gen-case.c for Unicode %s.  */\n",
+  fprintf (stream, "/* Generated automatically by gen-uni-tables.c for Unicode %s.  */\n",
            version);
 
   t.p = 7;
diff --git a/lib/getcwd-lgpl.c b/lib/getcwd-lgpl.c
new file mode 100644 (file)
index 0000000..2761422
--- /dev/null
@@ -0,0 +1,125 @@
+/* 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)
+    {
+      if (!size)
+        {
+          errno = EINVAL;
+          return NULL;
+        }
+      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
index c136772..d82ea5f 100644 (file)
@@ -46,7 +46,8 @@ rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
       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);
index 5d72040..a0d40f8 100644 (file)
@@ -205,7 +205,7 @@ typedef pth_t gl_thread_t;
 # define glthread_join(THREAD, RETVALP) \
     (pth_in_use () && !pth_join (THREAD, RETVALP) ? errno : 0)
 # define gl_thread_self() \
-    (pth_in_use () ? (void *) pth_self () : 0)
+    (pth_in_use () ? (void *) pth_self () : NULL)
 # define gl_thread_exit(RETVAL) \
     (pth_in_use () ? pth_exit (RETVAL) : 0)
 # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
@@ -257,7 +257,7 @@ typedef thread_t gl_thread_t;
 # define glthread_join(THREAD, RETVALP) \
     (thread_in_use () ? thr_join (THREAD, NULL, RETVALP) : 0)
 # define gl_thread_self() \
-    (thread_in_use () ? (void *) thr_self () : 0)
+    (thread_in_use () ? (void *) thr_self () : NULL)
 # define gl_thread_exit(RETVAL) \
     (thread_in_use () ? thr_exit (RETVAL) : 0)
 # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
@@ -322,7 +322,7 @@ typedef int gl_thread_t;
 # define glthread_create(THREADP, FUNC, ARG) ENOSYS
 # define glthread_sigmask(HOW, SET, OSET) 0
 # define glthread_join(THREAD, RETVALP) 0
-# define gl_thread_self() NULL
+# define gl_thread_self() 0
 # define gl_thread_exit(RETVAL) 0
 # define glthread_atfork(PREPARE_FUNC, PARENT_FUNC, CHILD_FUNC) 0
 
index 6d1cd66..cc787d1 100644 (file)
 
 #include <config.h>
 
-#include "group-member.h"
+/* Specification.  */
+#include <unistd.h>
 
 #include <stdbool.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <stdlib.h>
 
-#include <unistd.h>
-
 #include "xalloc.h"
 
 struct group_info
diff --git a/lib/group-member.h b/lib/group-member.h
deleted file mode 100644 (file)
index cb89ee3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Determine whether group id is in calling user's group list.
-
-   Copyright (C) 1994, 1997, 2003, 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/>.  */
-
-#ifndef GROUP_MEMBER_H_
-# define GROUP_MEMBER_H_ 1
-
-# include <sys/types.h>
-
-int group_member (gid_t);
-
-#endif /* GROUP_MEMBER_H_ */
index f3de2aa..4d76f76 100644 (file)
@@ -27,7 +27,7 @@
 #include "hash.h"
 
 #include "bitrotate.h"
-#include "xalloc.h"
+#include "xalloc-oversized.h"
 
 #include <stdint.h>
 #include <stdio.h>
index 58b1b3f..bd9f040 100644 (file)
 
 /* Written by Paul Eggert.  */
 
-#ifndef GL_INTPROPS_H
-# define GL_INTPROPS_H
+#ifndef _GL_INTPROPS_H
+#define _GL_INTPROPS_H
 
-# include <limits.h>
+#include <limits.h>
+
+/* Return a integer value, converted to the same type as the integer
+   expression E after integer type promotion.  V is the unconverted value.
+   E should not have side effects.  */
+#define _GL_INT_CONVERT(e, v) ((e) - (e) + (v))
+
+/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see
+   <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html>.  */
+#define _GL_INT_NEGATE_CONVERT(e, v) ((e) - (e) - (v))
 
 /* The extra casts in the following macros work around compiler bugs,
    e.g., in Cray C 5.0.3.0.  */
 
 /* True if the arithmetic type T is an integer type.  bool counts as
    an integer.  */
-# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
+#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
 
 /* True if negative values of the signed integer type T use two's
    complement, ones' complement, or signed magnitude representation,
    respectively.  Much GNU code assumes two's complement, but some
    people like to be portable to all possible C hosts.  */
-# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
+#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
+#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
+
+/* True if the signed integer expression E uses two's complement.  */
+#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1)
 
 /* True if the arithmetic type T is signed.  */
-# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
 
-/* The maximum and minimum values for the integer type T.  These
+/* Return 1 if the integer expression E, after integer promotion, has
+   a signed type.  E should not have side effects.  */
+#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0)
+
+
+/* Minimum and maximum values for integer types and expressions.  These
    macros have undefined behavior if T is signed and has padding bits.
    If this is a problem for you, please let us know how to fix it for
    your host.  */
-# define TYPE_MINIMUM(t) \
-  ((t) (! TYPE_SIGNED (t) \
-        ? (t) 0 \
-        : TYPE_SIGNED_MAGNITUDE (t) \
-        ? ~ (t) 0 \
+
+/* The maximum and minimum values for the integer type T.  */
+#define TYPE_MINIMUM(t)                                                 \
+  ((t) (! TYPE_SIGNED (t)                                               \
+        ? (t) 0                                                         \
+        : TYPE_SIGNED_MAGNITUDE (t)                                     \
+        ? ~ (t) 0                                                       \
         : ~ TYPE_MAXIMUM (t)))
-# define TYPE_MAXIMUM(t) \
-  ((t) (! TYPE_SIGNED (t) \
-        ? (t) -1 \
+#define TYPE_MAXIMUM(t)                                                 \
+  ((t) (! TYPE_SIGNED (t)                                               \
+        ? (t) -1                                                        \
         : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
 
-/* Return zero if T can be determined to be an unsigned type.
-   Otherwise, return 1.
-   When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a
-   tighter bound.  Otherwise, it overestimates the true bound by one byte
-   when applied to unsigned types of size 2, 4, 16, ... bytes.
-   The symbol signed_type_or_expr__ is private to this header file.  */
-# if __GNUC__ >= 2
-#  define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
-# else
-#  define signed_type_or_expr__(t) 1
-# endif
+/* The maximum and minimum values for the type of the expression E,
+   after integer promotion.  E should not have side effects.  */
+#define _GL_INT_MINIMUM(e)                                              \
+  (_GL_INT_SIGNED (e)                                                   \
+   ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e)         \
+   : _GL_INT_CONVERT (e, 0))
+#define _GL_INT_MAXIMUM(e)                                              \
+  (_GL_INT_SIGNED (e)                                                   \
+   ? _GL_SIGNED_INT_MAXIMUM (e)                                         \
+   : _GL_INT_NEGATE_CONVERT (e, 1))
+#define _GL_SIGNED_INT_MAXIMUM(e)                                       \
+  (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1)
+
+
+/* Return 1 if the __typeof__ keyword works.  This could be done by
+   'configure', but for now it's easier to do it by hand.  */
+#if 2 <= __GNUC__ || 0x5110 <= __SUNPRO_C
+# define _GL_HAVE___TYPEOF__ 1
+#else
+# define _GL_HAVE___TYPEOF__ 0
+#endif
+
+/* Return 1 if the integer type or expression T might be signed.  Return 0
+   if it is definitely unsigned.  This macro does not evaluate its argument,
+   and expands to an integer constant expression.  */
+#if _GL_HAVE___TYPEOF__
+# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t))
+#else
+# define _GL_SIGNED_TYPE_OR_EXPR(t) 1
+#endif
 
 /* Bound on length of the string representing an unsigned integer
    value representable in B bits.  log10 (2.0) < 146/485.  The
    smallest value of B where this bound is not tight is 2621.  */
-# define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)
+#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)
 
 /* Bound on length of the string representing an integer type or expression T.
    Subtract 1 for the sign bit if T is signed, and then add 1 more for
-   a minus sign if needed.  */
-# define INT_STRLEN_BOUND(t) \
-  (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) \
-   + signed_type_or_expr__ (t))
+   a minus sign if needed.
+
+   Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 0 when its argument is
+   signed, this macro may overestimate the true bound by one byte when
+   applied to unsigned types of size 2, 4, 16, ... bytes.  */
+#define INT_STRLEN_BOUND(t)                                     \
+  (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT                 \
+                          - _GL_SIGNED_TYPE_OR_EXPR (t))        \
+   + _GL_SIGNED_TYPE_OR_EXPR (t))
 
 /* Bound on buffer size needed to represent an integer type or expression T,
    including the terminating null.  */
-# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
+
+
+/* Range overflow checks.
+
+   The INT_<op>_RANGE_OVERFLOW macros return 1 if the corresponding C
+   operators might not yield numerically correct answers due to
+   arithmetic overflow.  They do not rely on undefined or
+   implementation-defined behavior.  Their implementations are simple
+   and straightforward, but they are a bit harder to use than the
+   INT_<op>_OVERFLOW macros described below.
+
+   Example usage:
+
+     long int i = ...;
+     long int j = ...;
+     if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX))
+       printf ("multiply would overflow");
+     else
+       printf ("product is %ld", i * j);
+
+   Restrictions on *_RANGE_OVERFLOW macros:
+
+   These macros do not check for all possible numerical problems or
+   undefined or unspecified behavior: they do not check for division
+   by zero, for bad shift counts, or for shifting negative numbers.
+
+   These macros may evaluate their arguments zero or multiple times,
+   so the arguments should not have side effects.  The arithmetic
+   arguments (including the MIN and MAX arguments) must be of the same
+   integer type after the usual arithmetic conversions, and the type
+   must have minimum value MIN and maximum MAX.  Unsigned types should
+   use a zero MIN of the proper type.
+
+   These macros are tuned for constant MIN and MAX.  For commutative
+   operations such as A + B, they are also tuned for constant B.  */
+
+/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  */
+#define INT_ADD_RANGE_OVERFLOW(a, b, min, max)          \
+  ((b) < 0                                              \
+   ? (a) < (min) - (b)                                  \
+   : (max) - (b) < (a))
+
+/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  */
+#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max)     \
+  ((b) < 0                                              \
+   ? (max) + (b) < (a)                                  \
+   : (a) < (min) + (b))
+
+/* Return 1 if - A would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  */
+#define INT_NEGATE_RANGE_OVERFLOW(a, min, max)          \
+  ((min) < 0                                            \
+   ? (a) < - (max)                                      \
+   : 0 < (a))
+
+/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  Avoid && and || as they tickle
+   bugs in Sun C 5.11 2010/08/13 and other compilers; see
+   <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>.  */
+#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max)     \
+  ((b) < 0                                              \
+   ? ((a) < 0                                           \
+      ? (a) < (max) / (b)                               \
+      : (b) == -1                                       \
+      ? 0                                               \
+      : (min) / (b) < (a))                              \
+   : (b) == 0                                           \
+   ? 0                                                  \
+   : ((a) < 0                                           \
+      ? (a) < (min) / (b)                               \
+      : (max) / (b) < (a)))
+
+/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  Do not check for division by zero.  */
+#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max)       \
+  ((min) < 0 && (b) == -1 && (a) < - (max))
+
+/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  Do not check for division by zero.
+   Mathematically, % should never overflow, but on x86-like hosts
+   INT_MIN % -1 traps, and the C standard permits this, so treat this
+   as an overflow too.  */
+#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max)    \
+  INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max)
+
+/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic.
+   See above for restrictions.  Here, MIN and MAX are for A only, and B need
+   not be of the same type as the other arguments.  The C standard says that
+   behavior is undefined for shifts unless 0 <= B < wordwidth, and that when
+   A is negative then A << B has undefined behavior and A >> B has
+   implementation-defined behavior, but do not check these other
+   restrictions.  */
+#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max)   \
+  ((a) < 0                                              \
+   ? (a) < (min) >> (b)                                 \
+   : (max) >> (b) < (a))
+
+
+/* The _GL*_OVERFLOW macros have the same restrictions as the
+   *_RANGE_OVERFLOW macros, except that they do not assume that operands
+   (e.g., A and B) have the same type as MIN and MAX.  Instead, they assume
+   that the result (e.g., A + B) has that type.  */
+#define _GL_ADD_OVERFLOW(a, b, min, max)                                \
+  ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max)                  \
+   : (a) < 0 ? (b) <= (a) + (b)                                         \
+   : (b) < 0 ? (a) <= (a) + (b)                                         \
+   : (a) + (b) < (b))
+#define _GL_SUBTRACT_OVERFLOW(a, b, min, max)                           \
+  ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max)             \
+   : (a) < 0 ? 1                                                        \
+   : (b) < 0 ? (a) - (b) <= (a)                                         \
+   : (a) < (b))
+#define _GL_MULTIPLY_OVERFLOW(a, b, min, max)                           \
+  (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a))))       \
+   || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max))
+#define _GL_DIVIDE_OVERFLOW(a, b, min, max)                             \
+  ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max)  \
+   : (a) < 0 ? (b) <= (a) + (b) - 1                                     \
+   : (b) < 0 && (a) + (b) <= (a))
+#define _GL_REMAINDER_OVERFLOW(a, b, min, max)                          \
+  ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max)  \
+   : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b)                     \
+   : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max))
+
+/* Return a nonzero value if A is a mathematical multiple of B, where
+   A is unsigned, B is negative, and MAX is the maximum value of A's
+   type.  A's type must be the same as (A % B)'s type.  Normally (A %
+   -B == 0) suffices, but things get tricky if -B would overflow.  */
+#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max)                            \
+  (((b) < -_GL_SIGNED_INT_MAXIMUM (b)                                   \
+    ? (_GL_SIGNED_INT_MAXIMUM (b) == (max)                              \
+       ? (a)                                                            \
+       : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1))   \
+    : (a) % - (b))                                                      \
+   == 0)
+
+
+/* Integer overflow checks.
+
+   The INT_<op>_OVERFLOW macros return 1 if the corresponding C operators
+   might not yield numerically correct answers due to arithmetic overflow.
+   They work correctly on all known practical hosts, and do not rely
+   on undefined behavior due to signed arithmetic overflow.
+
+   Example usage:
+
+     long int i = ...;
+     long int j = ...;
+     if (INT_MULTIPLY_OVERFLOW (i, j))
+       printf ("multiply would overflow");
+     else
+       printf ("product is %ld", i * j);
+
+   These macros do not check for all possible numerical problems or
+   undefined or unspecified behavior: they do not check for division
+   by zero, for bad shift counts, or for shifting negative numbers.
+
+   These macros may evaluate their arguments zero or multiple times, so the
+   arguments should not have side effects.
+
+   These macros are tuned for their last argument being a constant.
+
+   Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B,
+   A % B, and A << B would overflow, respectively.  */
+
+#define INT_ADD_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW)
+#define INT_SUBTRACT_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW)
+#define INT_NEGATE_OVERFLOW(a) \
+  INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+#define INT_MULTIPLY_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW)
+#define INT_DIVIDE_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW)
+#define INT_REMAINDER_OVERFLOW(a, b) \
+  _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW)
+#define INT_LEFT_SHIFT_OVERFLOW(a, b) \
+  INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \
+                                 _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a))
+
+/* Return 1 if the expression A <op> B would overflow,
+   where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test,
+   assuming MIN and MAX are the minimum and maximum for the result type.
+
+   This macro assumes that A | B is a valid integer if both A and B are,
+   which is true of all known practical hosts.  If this is a problem
+   for you, please let us know how to fix it for your host.  */
+#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow)        \
+  op_result_overflow (a, b,                                     \
+                      _GL_INT_MINIMUM ((a) | (b)),              \
+                      _GL_INT_MAXIMUM ((a) | (b)))
 
-#endif /* GL_INTPROPS_H */
+#endif /* _GL_INTPROPS_H */
index 6a8f46d..7abf394 100644 (file)
@@ -1076,6 +1076,7 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
 
 #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 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
 
 #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
index 4bbed76..c6ba989 100644 (file)
@@ -44,35 +44,36 @@ rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
 
 #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;
+
+  va_start (args, request);
+  arg = va_arg (args, void *);
+  va_end (args);
 
-  return r;
+# if WINDOWS_SOCKETS
+  return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg);
+# else
+  return primary_ioctl (fd, request, arg);
+# endif
 }
 
 #endif
index 3ab8822..8fd5d89 100644 (file)
@@ -1,20 +1,18 @@
 /* Determine name of the currently selected locale.
    Copyright (C) 1995-2011 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU Library General Public License as published
-   by the Free Software Foundation; either version 2, or (at your option)
-   any later version.
+   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 2.1 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
-   Library General Public License for more details.
+   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 Library 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.  */
+   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/>.  */
 
 /* Written by Ulrich Drepper <drepper@gnu.org>, 1995.  */
 /* Win32 code written by Tor Lillqvist <tml@iki.fi>.  */
index 493a7e5..118a426 100644 (file)
@@ -1,20 +1,18 @@
 /* Determine name of the currently selected locale.
    Copyright (C) 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 Library General Public License as published
-   by the Free Software Foundation; either version 2, or (at your option)
-   any later version.
+   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 2.1 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
-   Library General Public License for more details.
+   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 Library 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.  */
+   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 _GL_LOCALENAME_H
 #define _GL_LOCALENAME_H
index 73c503f..ef07f6c 100644 (file)
@@ -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
 # 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.  */
 
index be3783e..45d3075 100644 (file)
@@ -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
index d9c25cc..7a8e599 100644 (file)
@@ -335,7 +335,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
   {
     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;
index 5c79915..e0aa250 100644 (file)
@@ -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 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
 
   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;
-}
index a1fd040..7a572bc 100644 (file)
@@ -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
index b0a8df3..3c8437e 100644 (file)
 /* 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)
 {
index d789e34..6951d3d 100644 (file)
@@ -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.  */
 
 # 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 @@ struct addrinfo
 };
 #   define GNULIB_defined_struct_addrinfo 1
 #  endif
+
+#  ifdef __cplusplus
+}
+#  endif
+
 # endif
 
 /* Possible values for `ai_flags' field in `addrinfo' structure.  */
@@ -153,37 +164,67 @@ struct addrinfo
    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
index f28e423..9f7bce9 100644 (file)
@@ -113,7 +113,7 @@ set_nonblocking_flag (int desc, bool value)
 
 # include <fcntl.h>
 
-# if !O_NONBLOCK
+# if GNULIB_defined_O_NONBLOCK
 #  error Please port nonblocking to your platform
 # endif
 
index 2e2cc74..e60b619 100644 (file)
@@ -63,6 +63,15 @@ open (const char *filename, int flags, ...)
       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";
index 4a470c5..2e2e966 100644 (file)
@@ -31,7 +31,6 @@
 #include <unistd.h>
 
 #include "intprops.h"
-#include "same-inode.h"
 
 /* The results of open() in this file are not used with fchdir,
    and we do not leak fds to any single-threaded code that could use stdio,
@@ -75,20 +74,20 @@ openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file)
          problem is exhibited on code that built on Solaris 8 and
          running on Solaris 10.  */
 
-      int proc_self_fd = open ("/proc/self/fd", O_SEARCH);
+      int proc_self_fd = open ("/proc/self/fd",
+                               O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
       if (proc_self_fd < 0)
         proc_status = -1;
       else
         {
-          struct stat proc_self_fd_dotdot_st;
-          struct stat proc_self_st;
-          char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof ".." - 1)];
-          sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "..");
-          proc_status =
-            ((stat (dotdot_buf, &proc_self_fd_dotdot_st) == 0
-              && stat ("/proc/self", &proc_self_st) == 0
-              && SAME_INODE (proc_self_fd_dotdot_st, proc_self_st))
-             ? 1 : -1);
+          /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the
+             number of a file descriptor open on /proc/self/fd.  On Linux,
+             that name resolves to /proc/self/fd, which was opened above.
+             However, on Solaris, it may resolve to /proc/self/fd/fd, which
+             cannot exist, since all names in /proc/self/fd are numeric.  */
+          char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof "../fd" - 1)];
+          sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "../fd");
+          proc_status = access (dotdot_buf, F_OK) ? -1 : 1;
           close (proc_self_fd);
         }
     }
index f1e5fb7..3726f88 100644 (file)
@@ -50,10 +50,18 @@ opendir_safer (char const *name)
           int e;
 #if HAVE_FDOPENDIR || GNULIB_FDOPENDIR
           int f = dup_safer (fd);
-          newdp = fdopendir (f);
-          e = errno;
-          if (! newdp)
-            close (f);
+          if (f < 0)
+            {
+              e = errno;
+              newdp = NULL;
+            }
+          else
+            {
+              newdp = fdopendir (f);
+              e = errno;
+              if (! newdp)
+                close (f);
+            }
 #else /* !FDOPENDIR */
           newdp = opendir_safer (name);
           e = errno;
index d77955f..23a9a41 100644 (file)
@@ -1119,7 +1119,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc)
 
           do
             {
-              if (p < buff + sizeof buff - 1)
+              if (p - buff < sizeof buff - 1)
                 *p++ = c;
               c = *++pc->input;
             }
index 1ab94b4..9458820 100644 (file)
 #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.
 
 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 @@ sendfd (int sock, int fd)
   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 @@ sendfd (int sock, int fd)
 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 @@ recvfd (int sock, int flags)
 
   /* 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 @@ recvfd (int sock, int flags)
         }
     }
 
-#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 @@ recvfd (int sock, int flags)
           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
index 118970b..8c6cb74 100644 (file)
@@ -102,9 +102,6 @@ nonintr_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
 #endif
 
 /* Non-blocking I/O.  */
-#ifndef O_NONBLOCK
-# define O_NONBLOCK O_NDELAY
-#endif
 #if HAVE_SELECT
 # define IS_EAGAIN(errcode) 0
 #else
index f20b7b4..d0eb86b 100644 (file)
@@ -347,21 +347,42 @@ pipe_filter_ii_execute (const char *progname,
             const void *buf = prepare_write (&bufsize, private_data);
             if (buf != NULL)
               {
-                ssize_t nwritten =
-                  write (fd[1], buf,
-                         bufsize > SSIZE_MAX ? SSIZE_MAX : bufsize);
-                if (nwritten < 0)
+                /* Writing to a pipe in non-blocking mode is tricky: The
+                   write() call may fail with EAGAIN, simply because suffcient
+                   space is not available in the pipe. See POSIX:2008
+                   <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>.
+                   This happens actually on AIX and IRIX, when bufsize >= 8192
+                   (even though PIPE_BUF and pathconf ("/", _PC_PIPE_BUF) are
+                   both 32768).  */
+                size_t attempt_to_write =
+                  (bufsize > SSIZE_MAX ? SSIZE_MAX : bufsize);
+                for (;;)
                   {
-                    if (!IS_EAGAIN (errno))
+                    ssize_t nwritten = write (fd[1], buf, attempt_to_write);
+                    if (nwritten < 0)
                       {
-                        if (exit_on_error)
-                          error (EXIT_FAILURE, errno,
-                                 _("write to %s subprocess failed"), progname);
-                        goto fail;
+                        if (errno == EAGAIN)
+                          {
+                            attempt_to_write = attempt_to_write / 2;
+                            if (attempt_to_write == 0)
+                              break;
+                          }
+                        else if (!IS_EAGAIN (errno))
+                          {
+                            if (exit_on_error)
+                              error (EXIT_FAILURE, errno,
+                                     _("write to %s subprocess failed"),
+                                     progname);
+                            goto fail;
+                          }
+                      }
+                    else
+                      {
+                        if (nwritten > 0)
+                          done_write ((void *) buf, nwritten, private_data);
+                        break;
                       }
                   }
-                else if (nwritten > 0)
-                  done_write ((void *) buf, nwritten, private_data);
               }
             else
               {
index 4fa014f..f50dae6 100644 (file)
 #include <fcntl.h>
 
 #include "binary-io.h"
+#include "verify.h"
+
+#if GNULIB_defined_O_NONBLOCK
+# include "nonblocking.h"
+#endif
 
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 /* Native Woe32 API.  */
@@ -55,35 +60,47 @@ pipe2 (int fd[2], int flags)
   }
 #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.  */
 
-#else
-/* Unix API.  */
+  if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
+    return -1;
 
-  /* Check the supported flags.  */
-  if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_TEXT | O_BINARY)) != 0)
+  /* O_NONBLOCK handling.
+     On native Windows platforms, O_NONBLOCK is defined by gnulib.  Use the
+     functions defined by the gnulib module 'nonblocking'.  */
+# if GNULIB_defined_O_NONBLOCK
+  if (flags & O_NONBLOCK)
     {
-      errno = EINVAL;
-      return -1;
+      if (set_nonblocking_flag (fd[0], true) != 0
+          || set_nonblocking_flag (fd[1], true) != 0)
+        goto fail;
     }
+# else
+  verify (O_NONBLOCK == 0);
+# endif
+
+  return 0;
+
+#else
+/* Unix API.  */
 
   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].  */
 
+  /* O_NONBLOCK handling.
+     On Unix platforms, O_NONBLOCK is defined by the system.  Use fcntl().  */
   if (flags & O_NONBLOCK)
     {
       int fcntl_flags;
@@ -121,6 +138,8 @@ pipe2 (int fd[2], int flags)
 
   return 0;
 
+#endif
+
  fail:
   {
     int saved_errno = errno;
@@ -129,6 +148,4 @@ pipe2 (int fd[2], int flags)
     errno = saved_errno;
     return -1;
   }
-
-#endif
 }
index 0769c5e..4a3fa48 100644 (file)
@@ -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 @@ extern char * canonicalize_file_name (const char *name);
 #undef close
 
 /* Use the system functions, not the gnulib overrides in this file.  */
-#undef malloc
 #undef sprintf
 
 #undef set_program_name
index fb49559..da8ba1e 100644 (file)
@@ -168,10 +168,10 @@ set_custom_quoting (struct quoting_options *o,
 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;
 }
 
diff --git a/lib/read.c b/lib/read.c
new file mode 100644 (file)
index 0000000..21b90db
--- /dev/null
@@ -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
index 6ef37e7..0c96ffa 100644 (file)
@@ -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.  */
 # 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.  */
index cbff85f..fa73098 100644 (file)
@@ -2,20 +2,18 @@
    Copyright (C) 2003-2006, 2008-2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU Library General Public License as published
-   by the Free Software Foundation; either version 2, or (at your option)
-   any later version.
+   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 2.1 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
-   Library General Public License for more details.
+   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 Library 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.  */
+   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/>.  */
 
 
 /* Tell glibc's <stdio.h> to provide a prototype for getline().
@@ -25,6 +23,7 @@
 # define _GNU_SOURCE 1
 #endif
 
+#define _GL_USE_STDLIB_ALLOC 1
 #include <config.h>
 
 /* Specification.  */
@@ -86,9 +85,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;
index 68fe83e..80c43e6 100644 (file)
@@ -2,20 +2,18 @@
    Copyright (C) 2003, 2005, 2008-2011 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU Library General Public License as published
-   by the Free Software Foundation; either version 2, or (at your option)
-   any later version.
+   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 2.1 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
-   Library General Public License for more details.
+   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 Library 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.  */
+   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 _RELOCATABLE_H
 #define _RELOCATABLE_H
index 2f4e845..a64b54d 100644 (file)
@@ -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}".  */
index 16ffa2c..5f8eb7c 100644 (file)
@@ -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
index 7c06192..0a5f67d 100644 (file)
@@ -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 @@ __libc_lock_define_initialized (static, envlock)
 # 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
@@ -353,6 +350,9 @@ weak_alias (__clearenv, clearenv)
 #if HAVE_SETENV
 
 # undef setenv
+# if !HAVE_DECL_SETENV
+extern int setenv (const char *, const char *, int);
+# endif
 # define STREQ(a, b) (strcmp (a, b) == 0)
 
 int
index 7a6d6ee..036e4f2 100644 (file)
@@ -66,6 +66,20 @@ typedef unsigned int sigset_t;
 # 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
index 4e905e1..53cb66e 100644 (file)
 /* 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)
 {
+  /* Note about multithread-safety: There is a race condition where, between
+     our calls to closesocket() and the primary close(), some other thread
+     could make system calls that allocate precisely the same HANDLE value
+     as sock; then the primary close() would call CloseHandle() on it.  */
   SOCKET sock;
   WSANETWORKEVENTS ev;
 
@@ -64,10 +70,38 @@ close_fd_maybe_socket (int fd, const struct close_hook *remaining_list)
     }
   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 +124,8 @@ gl_sockets_startup (int version _GL_UNUSED)
         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 +142,7 @@ gl_sockets_cleanup (void)
 
   initialized_sockets_version = 0;
 
-  unregister_close_hook (&close_sockets_hook);
+  unregister_fd_hook (&fd_sockets_hook);
 
   err = WSACleanup ();
   if (err != 0)
index 96d01aa..742987f 100644 (file)
@@ -196,7 +196,7 @@ create_pipe (const char *progname,
                         (const char **) environ);
       if (child < 0 && errno == ENOEXEC)
         {
-          /* prog is not an native executable.  Try to execute it as a
+          /* prog is not a native executable.  Try to execute it as a
              shell script.  Note that prepare_spawn() has already prepended
              a hidden element "sh.exe" to prog_argv.  */
           --prog_argv;
index 8a11978..d36a78e 100644 (file)
@@ -175,7 +175,7 @@ get_stat_birthtime (struct stat const *st)
      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;
index c518f3b..5aedeee 100644 (file)
@@ -93,7 +93,7 @@
 
 #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 
-/* Minimum and maximum values for a integer type under the usual assumption.
+/* Minimum and maximum values for an integer type under the usual assumption.
    Return an unspecified value if BITS == 0, adding a check to pacify
    picky compilers.  */
 
diff --git a/lib/stdio-read.c b/lib/stdio-read.c
new file mode 100644 (file)
index 0000000..d7901dd
--- /dev/null
@@ -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
index 10fcfba..a586c35 100644 (file)
@@ -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
 #  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;                                                             \
     }
index f12d3be..79e7f7d 100644 (file)
 #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 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
                  "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 @@ _GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
 
 #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 @@ _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
 #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 @@ _GL_CXXALIASWARN (fputc);
 #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_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
 _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 @@ _GL_WARN_ON_USE (freopen,
                  "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 @@ _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
 
 
 #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 @@ rpl_fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
 _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 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 # 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 @@ _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
 
 #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 @@ _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
 #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 @@ _GL_CXXALIASWARN (putc);
 #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 @@ _GL_CXXALIASWARN (putchar);
 #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 @@ _GL_WARN_ON_USE (renameat, "renameat is not portable - "
 # 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 @@ _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
 
 #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 @@ _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
                       "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 @@ _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
                  "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)
index 2697a4b..7513553 100644 (file)
@@ -81,8 +81,9 @@ struct random_data
 # 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 @@ _GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
 # 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_RPL (malloc, void *, (size_t size));
 _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 @@ _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
 
 #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_RPL (realloc, void *, (void *ptr, size_t size));
 _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 - "
index 652c940..eef9db0 100644 (file)
@@ -277,17 +277,28 @@ _GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
 
 /* 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));
@@ -725,9 +736,9 @@ _GL_CXXALIASWARN (mbschr);
    and return a pointer to it.  Return NULL if C is not found in STRING.
    Unlike strrchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
-# if defined __hpux
+# if defined __hpux || defined __INTERIX
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
+#   define mbsrchr rpl_mbsrchr /* avoid collision with system function */
 #  endif
 _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
                                    _GL_ARG_NONNULL ((1)));
index 9e4394b..6cf44bc 100644 (file)
@@ -200,7 +200,7 @@ static void
 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
index b6a761e..6c15d11 100644 (file)
 # 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
index c378f10..1ea73f9 100644 (file)
 #  include <sys/time.h>
 # endif
 
-/* On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
+/* On AIX 7 and Solaris 10, <sys/select.h> provides an FD_ZERO implementation
    that relies on memset(), but without including <string.h>.
    But in any case avoid namespace pollution on glibc systems.  */
-# if (defined __OpenBSD__ || defined __sun || defined __osf__ || defined __BEOS__) \
+# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \
      && ! defined __GLIBC__
 #  include <string.h>
 # endif
index b60789f..7802669 100644 (file)
@@ -108,6 +108,12 @@ struct sockaddr_storage
 
 #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 @@ struct sockaddr_storage
    suggests that getaddrinfo should be available on all Windows
    releases. */
 
-
 # if @HAVE_WINSOCK2_H@
 #  include <winsock2.h>
 # endif
@@ -177,6 +182,16 @@ typedef int socklen_t;
 
 # 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@
diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h
new file mode 100644 (file)
index 0000000..0eaff61
--- /dev/null
@@ -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 */
index 1f4d0c1..6515cfa 100644 (file)
@@ -65,7 +65,7 @@ trim2 (const char *s, int how)
       /* Trim trailing whitespaces. */
       if (how != TRIM_LEADING)
         {
-          int state = 0;
+          unsigned int state = 0;
           char *r IF_LINT (= NULL); /* used only while state = 2 */
 
           mbi_init (i, d, strlen (d));
@@ -130,4 +130,3 @@ trim2 (const char *s, int how)
 
   return d;
 }
-
index 6dda1ea..906fc1d 100644 (file)
@@ -62,7 +62,7 @@ extern int
 
 /* Grapheme cluster breaks.  */
 
-/* Returns true if there is an grapheme cluster boundary between Unicode code
+/* Returns true if there is a grapheme cluster boundary between Unicode code
    points A and B.  A "grapheme cluster" is an approximation to a
    user-perceived character, which sometimes corresponds to multiple code
    points.  For example, an English letter followed by an acute accent can be
index 156e864..5596533 100644 (file)
@@ -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>
@@ -870,6 +871,22 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
 #endif
 
 
+#if @GNULIB_GROUP_MEMBER@
+/* Determine whether group id is in calling user's group list.  */
+# if !@HAVE_GROUP_MEMBER@
+_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
+# endif
+_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
+_GL_CXXALIASWARN (group_member);
+#elif defined GNULIB_POSIXCHECK
+# undef group_member
+# if HAVE_RAW_DECL_GROUP_MEMBER
+_GL_WARN_ON_USE (group_member, "group_member is unportable - "
+                 "use gnulib module group-member for portability");
+# endif
+#endif
+
+
 #if @GNULIB_LCHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Do not follow symbolic links.
@@ -1105,6 +1122,28 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
 #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 +1398,7 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
 /* 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
index 215bba0..16b50d1 100644 (file)
@@ -97,6 +97,13 @@ weak_alias (__unsetenv, unsetenv)
 #else /* HAVE_UNSETENV */
 
 # undef unsetenv
+# if !HAVE_DECL_UNSETENV
+#  if VOID_UNSETENV
+extern void unsetenv (const char *);
+#  else
+extern int unsetenv (const char *);
+#  endif
+# endif
 
 /* Call the underlying unsetenv, in case there is hidden bookkeeping
    that needs updating beyond just modifying environ.  */
index bf3b792..a96b63a 100644 (file)
@@ -254,7 +254,7 @@ parse_user_spec (char const *spec, uid_t *uid, gid_t *gid,
   if (!colon && error_msg)
     {
       /* If there's no colon but there is a dot, and if looking up the
-         whole spec failed (i.e., the spec is not a owner name that
+         whole spec failed (i.e., the spec is not an owner name that
          includes a dot), then try again, but interpret the dot as a
          separator.  This is a compatible extension to POSIX, since
          the POSIX-required behavior is always tried first.  */
index 356763f..c0f6713 100644 (file)
@@ -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 @@ utimecmp (char const *dst_name,
   /* 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 @@ utimecmp (char const *dst_name,
     {
       /* 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 @@ utimecmp (char const *dst_name,
       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;
-        }
-      new_dst_res->dev = dst_stat->st_dev;
-      dst_res = hash_insert (ht, new_dst_res);
-      if (! dst_res)
-        xalloc_die ();
+          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)
+          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;
+            }
+        }
+      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;
index e63692a..5a55e64 100644 (file)
@@ -48,6 +48,10 @@ int
 rpl_utimensat (int fd, char const *file, struct timespec const times[2],
                int flag)
 {
+# ifdef __linux__
+  struct timespec ts[2];
+# endif
+
   /* See comments in utimens.c for details.  */
   static int utimensat_works_really; /* 0 = unknown, 1 = yes, -1 = no.  */
   if (0 <= utimensat_works_really)
@@ -55,7 +59,6 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
       int result;
 # ifdef __linux__
       struct stat st;
-      struct timespec ts[2];
       /* As recently as Linux kernel 2.6.32 (Dec 2009), several file
          systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
          but work if both times are either explicitly specified or
index 5e91abd..3294b30 100644 (file)
 
 /* 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.
-
-   Symbols ending in "__" are private to this header.
+   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.
 
-   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,
      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
      __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.  */
    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 verify_true(R) \
-     (!!sizeof \
-      (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
+#  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 _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
+# endif
+
+# ifdef _GL_VERIFY_H
+
+/* 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
index d2bf17d..c7f306a 100644 (file)
    <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.  */
-#ifndef __GLIBC__
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
 # include <stddef.h>
+#endif
+#ifndef __GLIBC__
 # include <stdio.h>
 # include <time.h>
 #endif
index feef37d..680d6b0 100644 (file)
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
+/* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
+   #defines a number of identifiers in the application namespace.  Revert
+   these #defines.  */
+#ifdef __sun
+# undef multibyte
+# undef eucw1
+# undef eucw2
+# undef eucw3
+# undef scrw1
+# undef scrw2
+# undef scrw3
+#endif
+
 /* Define wint_t and WEOF.  (Also done in wchar.in.h.)  */
 #if !@HAVE_WINT_T@ && !defined wint_t
 # define wint_t int
index 4cf2962..b0ffa94 100644 (file)
@@ -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 @@ ssize_t
 rpl_write (int fd, const void *buf, size_t count)
 #undef write
 {
-  ssize_t ret = write (fd, buf, count);
-
-  if (ret < 0)
+  for (;;)
     {
-      if (GetLastError () == ERROR_NO_DATA
-          && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)
+      ssize_t ret = write (fd, buf, count);
+
+      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
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
new file mode 100644 (file)
index 0000000..ab19bcf
--- /dev/null
@@ -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_ */
index 86b9b3e..c1bbe7e 100644 (file)
@@ -20,6 +20,7 @@
 
 # include <stddef.h>
 
+# include "xalloc-oversized.h"
 
 # ifdef __cplusplus
 extern "C" {
@@ -65,22 +66,6 @@ void *xmemdup (void const *p, size_t s)
 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
diff --git a/lib/xgetgroups.c b/lib/xgetgroups.c
new file mode 100644 (file)
index 0000000..41886c9
--- /dev/null
@@ -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;
+}
diff --git a/m4/afunix.m4 b/m4/afunix.m4
deleted file mode 100644 (file)
index 13f7583..0000000
+++ /dev/null
@@ -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
-])
index e2e8a05..689da75 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_ALLOCA],
     ALLOCA_H=alloca.h
   fi
   AC_SUBST([ALLOCA_H])
+  AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
 ])
 
 # Prerequisites of lib/alloca.c.
index d6352ee..fbb5d64 100644 (file)
@@ -1,4 +1,4 @@
-# ansi-c++.m4 serial 7
+# ansi-c++.m4 serial 8
 dnl Copyright (C) 2002-2003, 2005, 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,
@@ -41,7 +41,7 @@ AC_DEFUN([gl_CXX_CHOICE],
 
 # gl_PROG_ANSI_CXX([ANSICXX_VARIABLE], [ANSICXX_CONDITIONAL])
 # Sets ANSICXX_VARIABLE to the name of a sufficiently ANSI C++ compliant
-# compiler, or to ":" if none is found.
+# compiler, or to "no" if none is found.
 # Defines the Automake condition ANSICXX_CONDITIONAL to true if such a compiler
 # was found, or to false if not.
 
@@ -51,7 +51,7 @@ AC_DEFUN([gl_PROG_ANSI_CXX],
   m4_if([$1], [CXX], [],
     [gl_save_CXX="$CXX"])
   if test "$CXX_CHOICE" = no; then
-    CXX=":"
+    CXX=no
   fi
   if test -z "$CXX"; then
     if test -n "$CCC"; then
@@ -62,7 +62,7 @@ AC_DEFUN([gl_PROG_ANSI_CXX],
                      [:])
     fi
   fi
-  if test "$CXX" != ":"; then
+  if test "$CXX" != no; then
     dnl Use a modified version of AC_PROG_CXX_WORKS that does not exit
     dnl upon failure.
     AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works])
@@ -114,9 +114,9 @@ EOF
      CXX="$gl_save_CXX"])
   AC_SUBST([$1])
 
-  AM_CONDITIONAL([$2], [test "$$1" != ":"])
+  AM_CONDITIONAL([$2], [test "$$1" != no])
 
-  if test "$$1" != ":"; then
+  if test "$$1" != no; then
     dnl This macro invocation resolves an automake error:
     dnl /usr/local/share/automake-1.11/am/depend2.am: am__fastdepCXX does not appear in AM_CONDITIONAL
     dnl /usr/local/share/automake-1.11/am/depend2.am:   The usual way to define `am__fastdepCXX' is to add `AC_PROG_CXX'
index f4fa3a0..0248a45 100644 (file)
@@ -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 @@ AS_IF([test -z "$ARGZ_H"],
         AC_LIBOBJ([argz])])])
 
 AC_SUBST([ARGZ_H])
+AM_CONDITIONAL([GL_GENERATE_ARGZ_H], [test -n "$ARGZ_H"])
 ])
 
 # Prerequisites of lib/argz.c.
index d21b162..6dc0fdb 100644 (file)
@@ -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 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
     ]], [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.
diff --git a/m4/assert_h.m4 b/m4/assert_h.m4
new file mode 100644 (file)
index 0000000..30ca248
--- /dev/null
@@ -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"])
+])
index 603298f..32bf0cf 100644 (file)
@@ -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 @@ int main ()
     esac
   fi
   if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([btowc])
     gl_PREREQ_BTOWC
   fi
index a033acd..2d4de46 100644 (file)
@@ -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 @@ AC_DEFUN([gl_BYTESWAP],
     BYTESWAP_H='byteswap.h'
   ])
   AC_SUBST([BYTESWAP_H])
+  AM_CONDITIONAL([GL_GENERATE_BYTESWAP_H], [test -n "$BYTESWAP_H"])
 ])
index dcc6039..c08a786 100644 (file)
@@ -1,4 +1,4 @@
-# canonicalize.m4 serial 17
+# canonicalize.m4 serial 21
 
 dnl Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.
 
@@ -26,6 +26,7 @@ AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE],
 # Provides canonicalize_file_name and realpath.
 AC_DEFUN([gl_CANONICALIZE_LGPL],
 [
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   AC_REQUIRE([gl_CANONICALIZE_LGPL_SEPARATE])
   if test $ac_cv_func_canonicalize_file_name = no; then
     HAVE_CANONICALIZE_FILE_NAME=0
@@ -43,7 +44,7 @@ AC_DEFUN([gl_CANONICALIZE_LGPL],
 ])
 
 # Like gl_CANONICALIZE_LGPL, except prepare for separate compilation
-# (no AC_LIBOBJ).
+# (no REPLACE_CANONICALIZE_FILE_NAME, no REPLACE_REALPATH, no AC_LIBOBJ).
 AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
 [
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -61,9 +62,12 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
   AC_CHECK_FUNCS_ONCE([realpath])
   AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [
     touch conftest.a
+    mkdir conftest.d
     AC_RUN_IFELSE([
       AC_LANG_PROGRAM([[
+        ]GL_NOCRASH[
         #include <stdlib.h>
+        #include <string.h>
       ]], [[
         int result = 0;
         {
@@ -81,10 +85,17 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
           if (name != NULL)
             result |= 4;
         }
+        {
+          char *name1 = realpath (".", NULL);
+          char *name2 = realpath ("conftest.d//./..", NULL);
+          if (strcmp (name1, name2) != 0)
+            result |= 8;
+        }
         return result;
       ]])
     ], [gl_cv_func_realpath_works=yes], [gl_cv_func_realpath_works=no],
        [gl_cv_func_realpath_works="guessing no"])
+    rm -rf conftest.a conftest.d
   ])
   if test "$gl_cv_func_realpath_works" = yes; then
     AC_DEFINE([FUNC_REALPATH_WORKS], [1], [Define to 1 if realpath()
index 853ac7d..fdc2c44 100644 (file)
@@ -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 @@ AC_DEFUN([gl_DIRENT_H],
     ]], [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.
index b8789c2..f401f6c 100644 (file)
@@ -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 @@ dnl From Jim Meyering
 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])
diff --git a/m4/dup2-obsolete.m4 b/m4/dup2-obsolete.m4
new file mode 100644 (file)
index 0000000..8816498
--- /dev/null
@@ -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.
+  :
+])
index def263b..62e31a8 100644 (file)
@@ -8,11 +8,17 @@ AC_DEFUN([gl_FUNC_DUP2],
 [
   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_FUNC_DUP2],
 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
index 4393d82..d61a8d2 100644 (file)
@@ -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 @@ int main ()
     HAVE_DUPLOCALE=0
   fi
   if test $REPLACE_DUPLOCALE = 1; then
-    gl_REPLACE_LOCALE_H
     AC_LIBOBJ([duplocale])
     gl_PREREQ_DUPLOCALE
   fi
index 687baff..a6d37f3 100644 (file)
@@ -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 @@ booboo
     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])
index 49d89d1..829373a 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_FCHDIR],
     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>
index 278859c..349b5f1 100644 (file)
@@ -1,4 +1,4 @@
-# fclose.m4 serial 2
+# fclose.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,
@@ -6,6 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_FCLOSE],
 [
+  gl_FUNC_FFLUSH_STDIN
+  if test $gl_cv_func_fflush_stdin = no; then
+    gl_REPLACE_FCLOSE
+  fi
 ])
 
 AC_DEFUN([gl_REPLACE_FCLOSE],
index 1ef4f45..c466da4 100644 (file)
@@ -31,13 +31,14 @@ AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
 
 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])
 ])
index f192a62..05aa772 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_FDOPENDIR],
   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 @@ extern DIR *fdopendir (int);
          [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
index f7645de..69eb86e 100644 (file)
@@ -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 @@ dnl unread input on seekable streams, rather than C99 undefined semantics.
 
 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 @@ AC_DEFUN([gl_FUNC_FFLUSH],
       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_DEFUN([gl_REPLACE_FFLUSH],
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   REPLACE_FFLUSH=1
   gl_PREREQ_FFLUSH
-  gl_REPLACE_FSEEKO
 ])
 
 # Prerequisites of lib/fflush.c.
index 265a4c1..21a7529 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FLOAT_H],
       ;;
   esac
   AC_SUBST([FLOAT_H])
+  AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"])
 ])
index 9b537a7..4ddfbae 100644 (file)
@@ -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
@@ -65,6 +65,8 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
               return 1;
             if (!y ("a*", "abc", 0))
               return 1;
+            if (!y ("[/b", "[/b", 0)) /*"]]"*/ /* glibc Bugzilla bug 12378 */
+              return 1;
             if (!n ("d*/*1", "d/s/1", FNM_PATHNAME))
               return 2;
             if (!y ("a\\\\bc", "abc", 0))
@@ -139,6 +141,7 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
     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.
index 76507d1..28da81b 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_FSEEKO],
       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.
index a309010..976c0d9 100644 (file)
--- a/m4/gc.m4
+++ b/m4/gc.m4
@@ -1,4 +1,4 @@
-# gc.m4 serial 6
+# gc.m4 serial 7
 dnl Copyright (C) 2005-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,
@@ -18,10 +18,3 @@ AC_DEFUN([gl_GC],
     AC_LIBOBJ([gc-gnulib])
   fi
 ])
-
-# Prerequisites of lib/gc.h
-AC_DEFUN([gl_PREREQ_GC],
-[
-  AC_REQUIRE([AC_C_RESTRICT])
-  :
-])
index e576236..f29e903 100644 (file)
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 24
+# 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 @@ AC_DEFUN([gl_GETADDRINFO],
   # 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 @@ AC_DEFUN([gl_GETADDRINFO],
 #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"
@@ -112,7 +131,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
 
   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. */
index 21be828..fd6820d 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_GETCWD_ABORT_BUG],
      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 @@ main ()
   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 @@ main ()
   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])
index 2ab2645..475ae96 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX],
     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(
           [[
index 7098056..eb2c9d9 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
 #        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 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
                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 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL],
          *-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 @@ AC_DEFUN([gl_FUNC_GETCWD],
   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])
index b4bf052..db7d480 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_GETDOMAINNAME],
   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],
index 9bdfb7c..b813c36 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME],
 
   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],
index e58d29b..0e44b69 100644 (file)
@@ -7,23 +7,19 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 2
+#serial 3
 
 # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
 # New applications should use gl_GETLOADAVG instead.
 
-# gl_GETLOADAVG(LIBOBJDIR)
-# ------------------------
+# gl_GETLOADAVG
+# -------------
 AC_DEFUN([gl_GETLOADAVG],
 [AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
 
 # Persuade glibc <stdlib.h> to declare getloadavg().
 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-# Make sure getloadavg.c is where it belongs, at configure-time.
-test -f "$srcdir/$1/getloadavg.c" ||
-  AC_MSG_ERROR([$srcdir/$1/getloadavg.c is missing])
-
 gl_save_LIBS=$LIBS
 
 # getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,
index 759c6f8..8dbfa9e 100644 (file)
@@ -1,4 +1,4 @@
-# glob.m4 serial 11
+# glob.m4 serial 13
 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,
@@ -8,15 +8,6 @@ dnl with or without modifications, as long as this notice is preserved.
 # rather than vanilla POSIX glob.  This means your code should
 # always include <glob.h> for the glob prototypes.
 
-AC_DEFUN([gl_GLOB_SUBSTITUTE],
-[
-  gl_PREREQ_GLOB
-
-  GLOB_H=glob.h
-  AC_LIBOBJ([glob])
-  AC_SUBST([GLOB_H])
-])
-
 AC_DEFUN([gl_GLOB],
 [ GLOB_H=
   AC_CHECK_HEADERS([glob.h], [], [GLOB_H=glob.h])
@@ -65,8 +56,11 @@ if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) return 1;]])],
   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.*.
index 5f7aa8a..a415a32 100644 (file)
@@ -1,4 +1,4 @@
-# serial 12
+# serial 13
 
 # Copyright (C) 1999-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
 
@@ -10,15 +10,20 @@ dnl Written by Jim Meyering
 
 AC_DEFUN([gl_FUNC_GROUP_MEMBER],
 [
+  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+
   dnl Persuade glibc <unistd.h> to declare group_member().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
   dnl Do this replacement check manually because I want the hyphen
   dnl (not the underscore) in the filename.
   AC_CHECK_FUNC([group_member], , [
+    HAVE_GROUP_MEMBER=0
+  ])
+  if test $HAVE_GROUP_MEMBER = 0; then
     AC_LIBOBJ([group-member])
     gl_PREREQ_GROUP_MEMBER
-  ])
+  fi
 ])
 
 # Prerequisites of lib/group-member.c.
index abfacff..8cca7fd 100644 (file)
@@ -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_DEFUN([gl_REPLACE_ICONV_H],
 [
   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 @@ AC_DEFUN([gl_ICONV_H_DEFAULTS],
   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"])
 ])
index 535a26f..2450353 100644 (file)
@@ -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 @@ dnl with or without modifications, as long as this notice is preserved.
 
 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
index b23f636..4939912 100644 (file)
@@ -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 @@ dnl with or without modifications, as long as this notice is preserved.
 
 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
index 57580b8..0167dd2 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_INET_NTOP],
   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
index 9a7ad3b..073df21 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_INET_PTON],
   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
index 92a4ac0..cc027a4 100644 (file)
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 18
+# inttypes.m4 serial 24
 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 @@ dnl Test whether <inttypes.h> is supported or must be substituted.
 
 AC_DEFUN([gl_INTTYPES_H],
 [
+  AC_REQUIRE([gl_INTTYPES_INCOMPLETE])
+  gl_INTTYPES_PRI_SCN
+])
+
+AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE],
+[
   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.  */
-
-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])
 
   dnl Override <inttypes.h> always, so that the portability warnings work.
   AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
@@ -158,6 +40,17 @@ const char *l = /* implicit string concatenation */
 #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 @@ const char *l = /* implicit string concatenation */
   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 @@ const char *l = /* implicit string concatenation */
   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 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
   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])
 ])
index 8cb36d8..3c17a2e 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_IOCTL],
     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 @@ AC_DEFUN([gl_FUNC_IOCTL],
     if test $gl_cv_func_ioctl_posix_signature != yes; then
       REPLACE_IOCTL=1
       AC_LIBOBJ([ioctl])
-      gl_REPLACE_SYS_IOCTL_H
     fi
   fi
 ])
index 92024bb..f4aa44d 100644 (file)
@@ -17,6 +17,7 @@ AC_DEFUN([gl_FUNC_ISNANF],
       ISNANF_LIBM=-lm
     fi
   fi
+  dnl The variable gl_func_isnanf set here is used by isnan.m4.
   if test $gl_cv_func_isnanf_no_libm = yes \
      || test $gl_cv_func_isnanf_in_libm = yes; then
     save_LIBS="$LIBS"
index 5d73759..4c94b4d 100644 (file)
@@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_ISNANL],
       ISNANL_LIBM=-lm
     fi
   fi
+  dnl The variable gl_func_isnanl set here is used by isnan.m4.
   if test $gl_cv_func_isnanl_no_libm = yes \
      || test $gl_cv_func_isnanl_in_libm = yes; then
     save_LIBS="$LIBS"
index 4d0f894..e77a303 100644 (file)
@@ -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 @@ AC_DEFUN([gl_LOCALE_H],
   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 @@ AC_DEFUN([gl_LOCALE_H],
     [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.
index e928821..67db064 100644 (file)
@@ -35,74 +35,124 @@ AC_DEFUN([gl_MANYWARN_COMPLEMENT],
 # 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
 ])
index b056895..8f55e36 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_MBRLEN],
     fi
   fi
   if test $HAVE_MBRLEN = 0 || test $REPLACE_MBRLEN = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([mbrlen])
     gl_PREREQ_MBRLEN
   fi
index c353862..b5b6aaa 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
     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 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN],
   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
index 47e2d14..b42a49a 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_MBSINIT],
     fi
   fi
   if test $HAVE_MBSINIT = 0 || test $REPLACE_MBSINIT = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([mbsinit])
     gl_PREREQ_MBSINIT
   fi
index 1ba443e..d72942f 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_MBSNRTOWCS],
     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
index 1fe8dcf..4410741 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_MBSRTOWCS],
     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
diff --git a/m4/memchr-obsolete.m4 b/m4/memchr-obsolete.m4
new file mode 100644 (file)
index 0000000..c65f651
--- /dev/null
@@ -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.
+  :
+])
index 3c2b313..a544e2b 100644 (file)
@@ -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_DEFUN_ONCE([gl_FUNC_MEMCHR],
   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 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
     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])
index c5cd282..0437f14 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_MKSTEMP],
               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 @@ AC_DEFUN([gl_FUNC_MKSTEMP],
                     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
index 9a01cd6..a54d670 100644 (file)
@@ -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 @@ AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
   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 @@ AC_DEFUN([gl_NETDB_H_DEFAULTS],
   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])
 ])
index e2d022d..87235b7 100644 (file)
@@ -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_DEFUN([gl_HEADER_NETINET_IN],
     AC_SUBST([HAVE_NETINET_IN_H])
   fi
   AC_SUBST([NETINET_IN_H])
+  AM_CONDITIONAL([GL_GENERATE_NETINET_IN_H], [test -n "$NETINET_IN_H"])
 ])
diff --git a/m4/nonblocking.m4 b/m4/nonblocking.m4
new file mode 100644 (file)
index 0000000..fd6faee
--- /dev/null
@@ -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
+])
index bfebdab..690cc64 100644 (file)
@@ -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 @@ changequote([,])dnl
       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],
diff --git a/m4/passfd.m4 b/m4/passfd.m4
new file mode 100644 (file)
index 0000000..2028f7f
--- /dev/null
@@ -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>
+  ]])
+])
index 4f8df1e..d226e1c 100644 (file)
@@ -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 @@ This is MacOSX or AIX
     fi
   fi
   if test $HAVE_POLL = 0 || test $REPLACE_POLL = 1; then
-    gl_REPLACE_POLL_H
     AC_LIBOBJ([poll])
     gl_PREREQ_POLL
   else
index 758f29b..3f2abf4 100644 (file)
@@ -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 @@ AC_DEFUN([gl_POLL_H],
     HAVE_POLL_H=1
   else
     HAVE_POLL_H=0
-    gl_REPLACE_POLL_H
   fi
   AC_SUBST([HAVE_POLL_H])
 
@@ -30,13 +29,6 @@ AC_DEFUN([gl_POLL_H],
     [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.
index 9f77cde..6111185 100644 (file)
@@ -30,7 +30,11 @@ AC_DEFUN([gl_PTHREAD_CHECK],
       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 @@ AC_DEFUN([gl_PTHREAD_DEFAULTS],
   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])
 ])
diff --git a/m4/read.m4 b/m4/read.m4
new file mode 100644 (file)
index 0000000..032761f
--- /dev/null
@@ -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
+  ])
+])
index a502ca5..ec737d3 100644 (file)
@@ -1,4 +1,4 @@
-# readlink.m4 serial 9
+# readlink.m4 serial 10
 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,
@@ -48,7 +48,8 @@ AC_DEFUN([gl_FUNC_READLINK],
   fi
 ])
 
-# Like gl_FUNC_READLINK, except prepare for separate compilation (no AC_LIBOBJ).
+# Like gl_FUNC_READLINK, except prepare for separate compilation
+# (no REPLACE_READLINK, no AC_LIBOBJ).
 AC_DEFUN([gl_FUNC_READLINK_SEPARATE],
 [
   AC_CHECK_FUNCS_ONCE([readlink])
index 6a46e47..9cff891 100644 (file)
@@ -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_DEFUN([gl_SCHED_H],
      AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
     ])
   AC_SUBST([SCHED_H])
+  AM_CONDITIONAL([GL_GENERATE_SCHED_H], [test -n "$SCHED_H"])
 ])
index 227ab6b..54a388d 100644 (file)
@@ -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 @@ AC_DEFUN([gl_HEADERS_SELINUX_CONTEXT_H],
     SELINUX_CONTEXT_H=selinux/context.h
   fi
   AC_SUBST([SELINUX_CONTEXT_H])
+  AM_CONDITIONAL([GL_GENERATE_SELINUX_CONTEXT_H], [test -n "$SELINUX_CONTEXT_H"])
 ])
index ba619b0..c8b025c 100644 (file)
@@ -1,4 +1,4 @@
-# setenv.m4 serial 21
+# setenv.m4 serial 22
 dnl Copyright (C) 2001-2004, 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,20 +7,6 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_SETENV],
 [
   AC_REQUIRE([gl_FUNC_SETENV_SEPARATE])
-  if test $HAVE_SETENV$REPLACE_SETENV != 10; then
-    AC_LIBOBJ([setenv])
-  fi
-])
-
-# Like gl_FUNC_SETENV, except prepare for separate compilation (no AC_LIBOBJ).
-AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
-[
-  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
-  AC_CHECK_DECLS_ONCE([setenv])
-  if test $ac_cv_have_decl_setenv = no; then
-    HAVE_DECL_SETENV=0
-  fi
-  AC_CHECK_FUNCS_ONCE([setenv])
   if test $ac_cv_func_setenv = no; then
     HAVE_SETENV=0
   else
@@ -50,9 +36,23 @@ AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
       [gl_cv_func_setenv_works="guessing no"])])
     if test "$gl_cv_func_setenv_works" != yes; then
       REPLACE_SETENV=1
-      AC_LIBOBJ([setenv])
     fi
   fi
+  if test $HAVE_SETENV$REPLACE_SETENV != 10; then
+    AC_LIBOBJ([setenv])
+  fi
+])
+
+# Like gl_FUNC_SETENV, except prepare for separate compilation
+# (no REPLACE_SETENV, no AC_LIBOBJ).
+AC_DEFUN([gl_FUNC_SETENV_SEPARATE],
+[
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
+  AC_CHECK_DECLS_ONCE([setenv])
+  if test $ac_cv_have_decl_setenv = no; then
+    HAVE_DECL_SETENV=0
+  fi
+  AC_CHECK_FUNCS_ONCE([setenv])
   gl_PREREQ_SETENV
 ])
 
index 6672c34..92f76f4 100644 (file)
@@ -1,4 +1,4 @@
-# setlocale.m4 serial 1
+# setlocale.m4 serial 3
 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,
@@ -12,9 +12,15 @@ AC_DEFUN([gl_FUNC_SETLOCALE],
     dnl On native Windows systems, setlocale(category,NULL) does not look at
     dnl the environment variables LC_ALL, category, and LANG.
     mingw*) REPLACE_SETLOCALE=1 ;;
+    dnl On Cygwin 1.5.x, setlocale always succeeds but setlocale(LC_CTYPE,NULL)
+    dnl is then still "C".
+    cygwin*)
+      case `uname -r` in
+        1.5.*) REPLACE_SETLOCALE=1 ;;
+      esac
+      ;;
   esac
   if test $REPLACE_SETLOCALE = 1; then
-    gl_REPLACE_LOCALE_H
     AC_LIBOBJ([setlocale])
     gl_PREREQ_SETLOCALE
   fi
index 77eb125..459ec00 100644 (file)
@@ -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_DEFUN([gl_SIGNAL_H],
 [
   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_DEFUN([gl_SIGNAL_H_DEFAULTS],
                                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])
 ])
index a044e37..4903b6a 100644 (file)
@@ -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 @@ AC_DEFUN([gl_SPAWN_H],
     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 @@ AC_DEFUN([gl_HAVE_POSIX_SPAWN],
   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.
index a1ef178..5705de9 100644 (file)
@@ -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 @@ dnl Provide a working va_copy in combination with <stdarg.h>.
 
 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 @@ error, bail out
       fi
     fi
   fi
+  AC_SUBST([STDARG_H])
+  AM_CONDITIONAL([GL_GENERATE_STDARG_H], [test -n "$STDARG_H"])
+  AC_SUBST([NEXT_STDARG_H])
 ])
index 838cf0f..1ebf3e6 100644 (file)
@@ -5,7 +5,7 @@ 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.
 
-#serial 4
+#serial 5
 
 # Prepare for substituting <stdbool.h> if it is not supported.
 
@@ -21,6 +21,7 @@ AC_DEFUN([AM_STDBOOL_H],
     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
index 1942b6a..1ae2344 100644 (file)
@@ -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_DEFUN([gl_STDDEF_H],
 [
   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 @@ AC_DEFUN([gl_STDDEF_H],
     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 @@ AC_DEFUN([gl_STDDEF_H_DEFAULTS],
   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])
 ])
index e7d0d07..c75e957 100644 (file)
@@ -1,4 +1,4 @@
-# stdint.m4 serial 39
+# stdint.m4 serial 41
 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,
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 dnl From Paul Eggert and Bruno Haible.
 dnl Test whether <stdint.h> is supported or must be substituted.
 
-AC_DEFUN([gl_STDINT_H],
+AC_DEFUN_ONCE([gl_STDINT_H],
 [
   AC_PREREQ([2.59])dnl
 
@@ -305,6 +305,7 @@ static const char *macro_values[] =
     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)
index 7f3ae56..a8326f3 100644 (file)
@@ -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_DEFUN([gl_STDIO_H],
   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 @@ AC_DEFUN([gl_STDIO_H],
   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_DEFUN([gl_STDIO_H],
       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 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   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 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   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 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   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])
index a64e805..fbfd5ae 100644 (file)
@@ -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_DEFUN([gl_FUNC_STRCHRNUL],
   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
 ])
index 30ddfbc..df8c403 100644 (file)
@@ -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 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   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])
diff --git a/m4/strtod-obsolete.m4 b/m4/strtod-obsolete.m4
new file mode 100644 (file)
index 0000000..baeb898
--- /dev/null
@@ -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.
+  :
+])
index 4619c33..f40e342 100644 (file)
@@ -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 @@ dnl with or without modifications, as long as this notice is preserved.
 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>
index e82e7cd..d46673b 100644 (file)
@@ -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 @@ dnl with or without modifications, as long as this notice is preserved.
 
 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])
+
+  AC_CHECK_DECLS_ONCE([strtoimax])
+  if test "$ac_cv_have_decl_strtoimax" != yes; then
+    HAVE_DECL_STRTOIMAX=0
 
-  if test "$gl_cv_func_strtoimax_macro" != yes; then
     AC_REPLACE_FUNCS([strtoimax])
     if test $ac_cv_func_strtoimax = no; then
       gl_PREREQ_STRTOIMAX
index 448c4d9..7fa5636 100644 (file)
@@ -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 @@ dnl with or without modifications, as long as this notice is preserved.
 
 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])
+
+  AC_CHECK_DECLS_ONCE([strtoumax])
+  if test "$ac_cv_have_decl_strtoumax" != yes; then
+    HAVE_DECL_STRTOUMAX=0
 
-  if test "$gl_cv_func_strtoumax_macro" != yes; then
     AC_REPLACE_FUNCS([strtoumax])
     if test $ac_cv_func_strtoumax = no; then
       gl_PREREQ_STRTOUMAX
index 97cab84..8c7d112 100644 (file)
@@ -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 @@ AC_DEFUN([gl_SYS_IOCTL_H],
     ]], [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.
diff --git a/m4/sys_uio_h.m4 b/m4/sys_uio_h.m4
new file mode 100644 (file)
index 0000000..bafa0ac
--- /dev/null
@@ -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],
+[
+])
index 4d14572..cff6606 100644 (file)
@@ -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 @@ AC_DEFUN([gl_SYSEXITS],
   fi
   AC_SUBST([HAVE_SYSEXITS_H])
   AC_SUBST([SYSEXITS_H])
+  AM_CONDITIONAL([GL_GENERATE_SYSEXITS_H], [test -n "$SYSEXITS_H"])
 ])
index 28ad00f..3c78b3b 100644 (file)
@@ -1,4 +1,4 @@
-# serial 4
+# serial 5
 
 # Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -49,6 +49,7 @@ main ()
     [Define to 1 if you have run the test for working tzset.])
 
   if test $gl_cv_func_tzset_clobber = yes; then
+    REPLACE_GETTIMEOFDAY=1
     gl_GETTIMEOFDAY_REPLACE_LOCALTIME
 
     AC_DEFINE([tzset], [rpl_tzset],
index c81a113..fb6fe07 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 53
+# unistd_h.m4 serial 56
 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,
@@ -36,8 +36,8 @@ AC_DEFUN([gl_UNISTD_H],
     ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
     fsync ftruncate getcwd getdomainname getdtablesize getgroups
     gethostname getlogin getlogin_r getpagesize getusershell setusershell
-    endusershell lchown link linkat lseek pipe pipe2 pread pwrite readlink
-    readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
+    endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite
+    readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
     usleep])
 ])
 
@@ -52,47 +52,50 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
 
 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_GROUP_MEMBER=0;         AC_SUBST([GNULIB_GROUP_MEMBER])
+  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])
@@ -108,6 +111,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_GETHOSTNAME=1;     AC_SUBST([HAVE_GETHOSTNAME])
   HAVE_GETLOGIN=1;        AC_SUBST([HAVE_GETLOGIN])
   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
+  HAVE_GROUP_MEMBER=1;    AC_SUBST([HAVE_GROUP_MEMBER])
   HAVE_LCHOWN=1;          AC_SUBST([HAVE_LCHOWN])
   HAVE_LINK=1;            AC_SUBST([HAVE_LINK])
   HAVE_LINKAT=1;          AC_SUBST([HAVE_LINKAT])
@@ -147,6 +151,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   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])
index a8f3466..b2d1a29 100644 (file)
@@ -1,4 +1,4 @@
-# warnings.m4 serial 2
+# warnings.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,
@@ -21,12 +21,12 @@ m4_ifdef([AS_VAR_APPEND],
 AC_DEFUN([gl_WARN_ADD],
 [AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
 AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
-  save_CPPFLAGS="$CPPFLAGS"
+  gl_save_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS="${CPPFLAGS} $1"
   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
                     [AS_VAR_SET([gl_Warn], [yes])],
                     [AS_VAR_SET([gl_Warn], [no])])
-  CPPFLAGS="$save_CPPFLAGS"
+  CPPFLAGS="$gl_save_CPPFLAGS"
 ])
 AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
 AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
index 6255ff3..977491f 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 38
+# wchar_h.m4 serial 39
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -119,13 +119,6 @@ Configuration aborted.])
   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.
index 2905d9b..4f58e3f 100644 (file)
@@ -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 @@ int main ()
     fi
   fi
   if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then
-    gl_REPLACE_WCHAR_H
     AC_LIBOBJ([wcrtomb])
     gl_PREREQ_WCRTOMB
   fi
index 5607807..ba61129 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_WCSNRTOMBS],
     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
index 19f0c78..cd51506 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_WCSRTOMBS],
     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
index 3b4633c..b66e755 100644 (file)
@@ -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_DEFUN([gl_FUNC_WCTOB],
   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 @@ int main ()
       *) 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 @@ int main ()
 ])
       if test $ac_cv_have_decl_wctob != yes; then
         HAVE_DECL_WCTOB=0
-        gl_REPLACE_WCHAR_H
       fi
     fi
   fi
index bf39d1d..dbcc231 100644 (file)
@@ -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 @@ changequote([,])dnl
   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.
 ])
index 8695c89..63ab5e4 100644 (file)
@@ -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 @@ AC_DEFUN([gl_FUNC_WRITE],
     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
 ])
index d1c954e..fb46f98 100644 (file)
@@ -7,7 +7,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 3c49196..0726070 100644 (file)
@@ -8,8 +8,8 @@ m4/acosl.m4
 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 @@ Link:
 $(ACOSL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
index 9ced93b..d4468de 100644 (file)
@@ -17,12 +17,17 @@ BUILT_SOURCES += $(ALLOCA_H)
 
 # 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:
diff --git a/modules/allocator b/modules/allocator
new file mode 100644 (file)
index 0000000..6ff5552
--- /dev/null
@@ -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
index 3166269..daf0232 100644 (file)
@@ -6,10 +6,7 @@ lib/areadlink.h
 lib/areadlink.c
 
 Depends-on:
-readlink
-ssize_t
-stdint
-unistd
+careadlinkat
 
 configure.ac:
 
index 072f823..8c621d5 100644 (file)
@@ -7,7 +7,7 @@ lib/areadlinkat.c
 
 Depends-on:
 areadlink
-stdint
+careadlinkat
 readlinkat
 
 configure.ac:
index 0dd643c..c322597 100644 (file)
@@ -11,10 +11,10 @@ gettext-h
 error
 quotearg
 quote
-exit
 exitfail
 verify
 stdbool
+stdlib
 memcmp
 
 configure.ac:
index 5f9c749..2cbb212 100644 (file)
@@ -7,12 +7,12 @@ lib/argz.c
 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
@@ -22,12 +22,17 @@ BUILT_SOURCES += $(ARGZ_H)
 
 # 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:
index 34b9881..365f36d 100644 (file)
@@ -21,7 +21,7 @@ BUILT_SOURCES += arpa/inet.h
 
 # 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! */'; \
index 7f254ab..19e049c 100644 (file)
@@ -8,7 +8,7 @@ m4/asinl.m4
 Depends-on:
 math
 extensions
-sqrtl
+sqrtl           [test $HAVE_ASINL = 0]
 
 configure.ac:
 gl_FUNC_ASINL
@@ -23,7 +23,7 @@ Link:
 $(ASINL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
diff --git a/modules/assert-h b/modules/assert-h
new file mode 100644 (file)
index 0000000..50bd9f8
--- /dev/null
@@ -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
index f6ba1b8..4f3f9ea 100644 (file)
@@ -8,7 +8,7 @@ m4/atanl.m4
 Depends-on:
 math
 extensions
-isnanl
+isnanl          [test $HAVE_ATANL = 0]
 
 configure.ac:
 gl_FUNC_ATANL
@@ -23,7 +23,7 @@ Link:
 $(ATANL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
index 5f05712..d979a00 100644 (file)
@@ -7,7 +7,7 @@ m4/atoll.m4
 m4/longlong.m4
 
 Depends-on:
-strtoll
+strtoll         [test $HAVE_ATOLL = 0]
 
 configure.ac:
 gl_FUNC_ATOLL
index 050f0e6..5c4595f 100644 (file)
@@ -7,7 +7,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 10c5f3f..1566a2f 100644 (file)
@@ -8,7 +8,7 @@ m4/locale-fr.m4
 
 Depends-on:
 wchar
-mbtowc
+mbtowc          [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]
 
 configure.ac:
 gl_FUNC_BTOWC
index 6a3ce15..c1da400 100644 (file)
@@ -15,12 +15,17 @@ BUILT_SOURCES += $(BYTESWAP_H)
 
 # 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:
index cdeee11..8869bb1 100644 (file)
@@ -2,10 +2,10 @@ Description:
 calloc() function that is glibc compatible.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'calloc-gnu' instead.
+This module is deprecated. Use the module 'calloc-gnu' instead.
 
 Files:
 
index 4ed943b..3b7b7fe 100644 (file)
@@ -15,6 +15,7 @@ file-set
 hash-triple
 lstat
 memmove
+nocrash
 pathmax
 sys_stat
 xalloc
index 6a748f3..ab31bea 100644 (file)
@@ -7,16 +7,17 @@ m4/canonicalize.m4
 m4/double-slash-root.m4
 
 Depends-on:
-alloca-opt
-errno
 extensions
-lstat
-malloca
-memmove
-pathmax
-readlink
 stdlib
-sys_stat
+nocrash
+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
diff --git a/modules/careadlinkat b/modules/careadlinkat
new file mode 100644 (file)
index 0000000..b4bc4a4
--- /dev/null
@@ -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
index 90e03fc..1a3a5de 100644 (file)
@@ -7,7 +7,7 @@ m4/ceil.m4
 
 Depends-on:
 math
-float
+float           [test $REPLACE_CEIL = 1]
 
 configure.ac:
 gl_FUNC_CEIL
index 3c0082c..beba067 100644 (file)
@@ -9,7 +9,7 @@ m4/ceilf.m4
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_CEILF = 0 || test $REPLACE_CEILF = 1]
 
 configure.ac:
 gl_FUNC_CEILF
index a2365c2..51d5b92 100644 (file)
@@ -9,7 +9,7 @@ m4/ceill.m4
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_CEILL = 0 || test $REPLACE_CEILL = 1]
 
 configure.ac:
 gl_FUNC_CEILL
index 4025b45..0c8e792 100644 (file)
@@ -7,14 +7,16 @@ lib/chdir-long.c
 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
index 94bff84..ccfeb3b 100644 (file)
@@ -7,11 +7,11 @@ lib/fchown-stub.c
 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
index ba866d9..fc867ae 100644 (file)
@@ -18,7 +18,7 @@ Link:
 $(LIB_CLOCK_GETTIME)
 
 License:
-GPL
+LGPLv2+
 
 Maintainer:
 Paul Eggert, Jim Meyering
index e294292..cbfa080 100644 (file)
@@ -7,7 +7,7 @@ m4/close.m4
 
 Depends-on:
 unistd
-close-hook
+fd-hook         [test $REPLACE_CLOSE = 1]
 fclose
 
 configure.ac:
diff --git a/modules/close-hook b/modules/close-hook
deleted file mode 100644 (file)
index ae32ad0..0000000
+++ /dev/null
@@ -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
index 1381ffa..c90f094 100644 (file)
@@ -7,7 +7,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 6941e5a..4ca553e 100644 (file)
@@ -10,11 +10,11 @@ Depends-on:
 acl
 binary-io
 error
-exit
 full-write
 gettext-h
 open
 safe-read
+stdlib
 unistd
 xalloc
 
index 88ebf9c..391a841 100644 (file)
@@ -11,10 +11,10 @@ m4/cosl.m4
 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 @@ Link:
 $(ACOSL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
index f0ec911..8285218 100644 (file)
@@ -18,7 +18,7 @@ BUILT_SOURCES += ctype.h
 
 # 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' \
index 3029d73..94f53a9 100644 (file)
@@ -20,7 +20,7 @@ BUILT_SOURCES += dirent.h
 
 # 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' \
index 172c662..d516d52 100644 (file)
@@ -11,5 +11,5 @@ 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.
+# and fdopendir indirectly depends on openat-die -> gettext-h.
 test_dirent_safer_LDADD = $(LDADD) $(LIBINTL)
index 42ff4d7..8410f38 100644 (file)
@@ -7,8 +7,8 @@ m4/dirfd.m4
 
 Depends-on:
 dirent
-errno
 extensions
+errno           [test $ac_cv_have_decl_dirfd = no || test $REPLACE_DIRFD = 1]
 
 configure.ac:
 gl_FUNC_DIRFD
index 6ebbde4..8c08def 100644 (file)
@@ -7,9 +7,9 @@ m4/dprintf.m4
 
 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
index 19a4718..2423d61 100644 (file)
@@ -14,18 +14,18 @@ m4/printf.m4
 
 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
index cea1a97..17cafd1 100644 (file)
@@ -7,6 +7,7 @@ m4/dup2.m4
 
 Depends-on:
 unistd
+dup2-obsolete
 
 configure.ac:
 gl_FUNC_DUP2
diff --git a/modules/dup2-obsolete b/modules/dup2-obsolete
new file mode 100644 (file)
index 0000000..ba71bb9
--- /dev/null
@@ -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
index b730071..9516901 100644 (file)
@@ -16,7 +16,8 @@ BUILT_SOURCES += $(ERRNO_H)
 
 # 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' \
@@ -32,6 +33,10 @@ errno.h: errno.in.h
              < $(srcdir)/errno.in.h; \
        } > $@-t && \
        mv $@-t $@
+else
+errno.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 MOSTLYCLEANFILES += errno.h errno.h-t
 
 Include:
index 7d43aba..a1ec1e9 100644 (file)
@@ -12,8 +12,8 @@ lib/error.c
 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
index 93333f5..56bcf28 100644 (file)
@@ -8,9 +8,9 @@ m4/euidaccess.m4
 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
index 755e3e5..a65696b 100644 (file)
@@ -11,7 +11,6 @@ Depends-on:
 cloexec
 dup2
 error
-exit
 fatal-signal
 wait-process
 gettext-h
@@ -25,6 +24,7 @@ posix_spawnattr_setsigmask
 posix_spawnattr_setflags
 posix_spawnattr_destroy
 stdbool
+stdlib
 strpbrk
 unistd
 environ
diff --git a/modules/exit b/modules/exit
deleted file mode 100644 (file)
index 18899f2..0000000
+++ /dev/null
@@ -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
index 641f99d..0dd3ec6 100644 (file)
@@ -6,7 +6,7 @@ lib/exitfail.h
 lib/exitfail.c
 
 Depends-on:
-exit
+stdlib
 
 configure.ac:
 
index 3870440..a0ccf88 100644 (file)
@@ -8,8 +8,8 @@ m4/expl.m4
 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 @@ Link:
 $(EXPL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
index 92d8185..ce8fa0d 100644 (file)
@@ -6,11 +6,11 @@ lib/faccessat.c
 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
index 46b481f..7b7cb04 100644 (file)
@@ -6,21 +6,23 @@ lib/fchdir.c
 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
index 462e709..8f82dce 100644 (file)
@@ -4,7 +4,8 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
-getcwd
+cloexec
+getcwd-lgpl
 
 configure.ac:
 
index 4f6f786..e6493c9 100644 (file)
@@ -7,7 +7,10 @@ m4/fclose.m4
 
 Depends-on:
 stdio
-close
+close           [test $REPLACE_FCLOSE = 1]
+fflush          [test $REPLACE_FCLOSE = 1]
+freading        [test $REPLACE_FCLOSE = 1]
+lseek           [test $REPLACE_FCLOSE = 1]
 
 configure.ac:
 gl_FUNC_FCLOSE
@@ -23,4 +26,3 @@ LGPLv2+
 
 Maintainer:
 Bruno Haible
-
diff --git a/modules/fclose-tests b/modules/fclose-tests
new file mode 100644 (file)
index 0000000..6334f65
--- /dev/null
@@ -0,0 +1,10 @@
+Files:
+tests/test-fclose.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-fclose
+check_PROGRAMS += test-fclose
index 67630f9..855ee9f 100644 (file)
@@ -6,10 +6,10 @@ m4/fcntl.m4
 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
index c275a4e..45593f6 100644 (file)
@@ -22,7 +22,7 @@ BUILT_SOURCES += fcntl.h
 
 # 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' \
@@ -30,6 +30,7 @@ fcntl.h: fcntl.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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' \
diff --git a/modules/fd-hook b/modules/fd-hook
new file mode 100644 (file)
index 0000000..7127083
--- /dev/null
@@ -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
index 203f6c7..0612b74 100644 (file)
@@ -9,11 +9,11 @@ m4/fdopendir.m4
 
 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
index a8a151e..1d26b61 100644 (file)
@@ -7,19 +7,20 @@ lib/stdio-impl.h
 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 @@ Include:
 <stdio.h>
 
 License:
-GPL
+LGPLv2+
 
 Maintainer:
 Eric Blake
index a744933..4dd3993 100644 (file)
@@ -18,7 +18,7 @@ Include:
 "filenamecat.h"
 
 License:
-GPL
+LGPLv2+
 
 Maintainer:
 Jim Meyering
index c98853b..4a1c16a 100644 (file)
@@ -16,7 +16,8 @@ BUILT_SOURCES += $(FLOAT_H)
 
 # 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' \
@@ -26,6 +27,10 @@ float.h: float.in.h
              < $(srcdir)/float.in.h; \
        } > $@-t && \
        mv $@-t $@
+else
+float.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 MOSTLYCLEANFILES += float.h float.h-t
 
 Include:
index ee898d3..1393dad 100644 (file)
@@ -7,7 +7,7 @@ m4/floor.m4
 
 Depends-on:
 math
-float
+float           [test $REPLACE_FLOOR = 1]
 
 configure.ac:
 gl_FUNC_FLOOR
index 47b9d5c..1f9d9da 100644 (file)
@@ -9,7 +9,7 @@ m4/floorf.m4
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]
 
 configure.ac:
 gl_FUNC_FLOORF
index 66c1362..e211993 100644 (file)
@@ -9,7 +9,7 @@ m4/floorl.m4
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_FLOORL = 0 || test $REPLACE_FLOORL = 1]
 
 configure.ac:
 gl_FUNC_FLOORL
index bf7158f..12e5906 100644 (file)
@@ -11,14 +11,14 @@ m4/fnmatch.m4
 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
@@ -28,13 +28,18 @@ BUILT_SOURCES += $(FNMATCH_H)
 
 # 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:
index b6df7da..1676a76 100644 (file)
@@ -2,10 +2,10 @@ Description:
 fnmatch() function: wildcard matching.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'fnmatch' instead.
+This module is deprecated. Use the module 'fnmatch' instead.
 
 Files:
 
index eddd7f6..2177a3b 100644 (file)
@@ -7,7 +7,7 @@ m4/fopen.m4
 
 Depends-on:
 stdio
-unistd
+unistd          [test $REPLACE_FOPEN = 1]
 
 configure.ac:
 gl_FUNC_FOPEN
index be2b010..47e76c5 100644 (file)
@@ -14,20 +14,20 @@ m4/printf.m4
 
 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
index ec11062..6cebcff 100644 (file)
@@ -19,7 +19,7 @@ Include:
 <stdio.h>
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Bruno Haible, Eric Blake
index d2a0278..b5c00c6 100644 (file)
@@ -20,8 +20,7 @@ Include:
 "freading.h"
 
 License:
-LGPL
+LGPLv2+
 
 Maintainer:
 Eric Blake
-
index 7fae366..3ada9b2 100644 (file)
@@ -7,7 +7,7 @@ m4/frexp.m4
 
 Depends-on:
 math
-isnand-nolibm
+isnand-nolibm   [test $gl_func_frexp != yes]
 
 configure.ac:
 gl_FUNC_FREXP
index 6a909e9..34eb958 100644 (file)
@@ -7,7 +7,7 @@ m4/frexp.m4
 
 Depends-on:
 math
-isnand-nolibm
+isnand-nolibm   [test $gl_func_frexp_no_libm != yes]
 
 configure.ac:
 gl_FUNC_FREXP_NO_LIBM
index 185d54d..d1f0159 100644 (file)
@@ -8,8 +8,8 @@ m4/frexpl.m4
 
 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
index 80ce8fb..dbe1a82 100644 (file)
@@ -9,8 +9,8 @@ m4/frexpl.m4
 
 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
index 07f948e..98c6d3f 100644 (file)
@@ -6,8 +6,8 @@ lib/fseek.c
 m4/fseek.m4
 
 Depends-on:
-fseeko
 stdio
+fseeko          [test $REPLACE_FSEEK = 1]
 
 configure.ac:
 gl_FUNC_FSEEK
index c849688..cdefb60 100644 (file)
@@ -7,9 +7,9 @@ lib/fsusage.c
 m4/fsusage.m4
 
 Depends-on:
-full-read
 stdbool
 stdint
+full-read       [test $gl_cv_fs_space = yes]
 
 configure.ac:
 gl_FSUSAGE
index 6e9dc25..cc95d16 100644 (file)
@@ -6,9 +6,9 @@ lib/ftell.c
 m4/ftell.m4
 
 Depends-on:
-ftello
 stdio
 errno
+ftello          [test $REPLACE_FTELL = 1]
 
 configure.ac:
 gl_FUNC_FTELL
index 0cf160c..b042e84 100644 (file)
@@ -8,9 +8,9 @@ m4/fseeko.m4
 m4/ftello.m4
 
 Depends-on:
-extensions
-lseek
 stdio
+extensions
+lseek           [test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1]
 
 configure.ac-early:
 AC_REQUIRE([AC_FUNC_FSEEKO])
index d559911..5bae3ae 100644 (file)
@@ -4,10 +4,10 @@ An interface to the read() function that reads all it is asked to read.
 Files:
 lib/full-read.h
 lib/full-read.c
+lib/full-write.c
 
 Depends-on:
 safe-read
-full-write
 
 configure.ac:
 
index 17bff44..4ed403e 100644 (file)
@@ -7,8 +7,8 @@ m4/futimens.m4
 
 Depends-on:
 sys_stat
-utimens
 extensions
+utimens         [test $HAVE_FUTIMENS = 0 || test $REPLACE_FUTIMENS = 1]
 
 configure.ac:
 gl_FUNC_FUTIMENS
@@ -23,7 +23,7 @@ Link:
 $(LIB_CLOCK_GETTIME)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Eric Blake
index 108f14b..cc80bfe 100644 (file)
@@ -8,18 +8,19 @@ m4/getcwd-path-max.m4
 m4/getcwd.m4
 
 Depends-on:
-mempcpy
-d-ino
-extensions
-memmove
-openat
-stdbool
 unistd
-malloc-posix
-strdup-posix
+extensions
+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:
diff --git a/modules/getcwd-lgpl b/modules/getcwd-lgpl
new file mode 100644 (file)
index 0000000..72e6a7f
--- /dev/null
@@ -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
diff --git a/modules/getcwd-lgpl-tests b/modules/getcwd-lgpl-tests
new file mode 100644 (file)
index 0000000..07fdf73
--- /dev/null
@@ -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
index 016961f..2187acc 100644 (file)
@@ -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:
 
index 5dca5cf..37c37f9 100644 (file)
@@ -2,10 +2,10 @@ Description:
 Convert a date/time string to linear time.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'parse-datetime' instead.
+This module is deprecated. Use the module 'parse-datetime' instead.
 
 Files:
 doc/getdate.texi
index 0f17b60..c3ef317 100644 (file)
@@ -6,11 +6,11 @@ lib/getdelim.c
 m4/getdelim.m4
 
 Depends-on:
-extensions
 stdio
-stdint
-realloc-posix
-errno
+extensions
+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
index 5a9d23f..c7f77b0 100644 (file)
@@ -8,8 +8,8 @@ m4/getdomainname.m4
 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
index aabcefc..4903123 100644 (file)
@@ -6,9 +6,9 @@ lib/getgroups.c
 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 @@ Include:
 <unistd.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Jim Meyering, Eric Blake
index 8c24571..359434a 100644 (file)
@@ -8,9 +8,9 @@ lib/w32sock.h
 
 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
index 1fb9b9c..b565f66 100644 (file)
@@ -6,9 +6,9 @@ lib/getline.c
 m4/getline.m4
 
 Depends-on:
-extensions
-getdelim
 stdio
+extensions
+getdelim        [test $REPLACE_GETLINE = 1]
 
 configure.ac:
 gl_FUNC_GETLINE
index 9db688b..c17281c 100644 (file)
@@ -12,7 +12,7 @@ stdbool
 stdlib
 
 configure.ac:
-gl_GETLOADAVG([$gl_source_base])
+gl_GETLOADAVG
 gl_STDLIB_MODULE_INDICATOR([getloadavg])
 
 Makefile.am:
index 1d5c20b..c0fb4a6 100644 (file)
@@ -6,9 +6,9 @@ lib/getlogin_r.c
 m4/getlogin_r.m4
 
 Depends-on:
-extensions
 unistd
-memchr
+extensions
+memchr          [test $HAVE_GETLOGIN_R = 0 || test $REPLACE_GETLOGIN_R = 1]
 
 configure.ac:
 gl_FUNC_GETLOGIN_R
index 402e676..5d4f3c4 100644 (file)
@@ -2,10 +2,10 @@ Description:
 Process command line arguments.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'getopt-posix' or 'getopt-gnu' instead.
+This module is deprecated. Use the module 'getopt-posix' or 'getopt-gnu' instead.
 
 Files:
 
index 39b10a4..6be0cbc 100644 (file)
@@ -9,11 +9,11 @@ lib/getopt_int.h
 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
@@ -23,7 +23,7 @@ BUILT_SOURCES += $(GETOPT_H)
 
 # 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' \
index a8a4fca..4cdae38 100644 (file)
@@ -8,7 +8,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index a7f8881..223479e 100644 (file)
@@ -8,7 +8,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 40ff649..5b8c18d 100644 (file)
@@ -7,8 +7,8 @@ lib/w32sock.h
 
 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])
index a28e2a0..eaf8e87 100644 (file)
@@ -6,10 +6,10 @@ lib/getsubopt.c
 m4/getsubopt.m4
 
 Depends-on:
-extensions
-strchrnul
 stdlib
-memchr
+extensions
+strchrnul       [test $HAVE_GETSUBOPT = 0]
+memchr          [test $HAVE_GETSUBOPT = 0]
 
 configure.ac:
 gl_FUNC_GETSUBOPT
index cab538e..ca0b684 100644 (file)
@@ -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
index 0cd52b2..9aa02f2 100644 (file)
@@ -15,6 +15,7 @@ gl_GETUGROUPS
 Makefile.am:
 
 Include:
+"getugroups.h"
 
 License:
 GPL
index 9ae7dca..56e8b5f 100644 (file)
@@ -8,8 +8,8 @@ m4/getusershell.m4
 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
index d0e2ad0..857a8bc 100644 (file)
@@ -7,6 +7,7 @@ lib/git-merge-changelog.c
 Depends-on:
 getopt-gnu
 stdbool
+stdlib
 progname
 error
 read-file
index 0caaeef..db5410b 100644 (file)
@@ -9,22 +9,22 @@ lib/glob.c
 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
@@ -34,7 +34,8 @@ BUILT_SOURCES += $(GLOB_H)
 
 # 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' \
@@ -44,6 +45,10 @@ glob.h: glob.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              < $(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:
index 483ff74..a86475a 100644 (file)
@@ -14,9 +14,9 @@ configure.ac:
 # 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
index a5d9eb4..589360d 100644 (file)
@@ -8,9 +8,9 @@ m4/grantpt.m4
 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
index 20075dd..9da67f7 100644 (file)
@@ -2,23 +2,24 @@ Description:
 Determine whether the current process has the permissions of a given group ID.
 
 Files:
-lib/group-member.h
 lib/group-member.c
 m4/group-member.m4
 
 Depends-on:
+unistd
 extensions
-getgroups
-xalloc
-stdbool
+getgroups       [test $HAVE_GROUP_MEMBER = 0]
+xalloc          [test $HAVE_GROUP_MEMBER = 0]
+stdbool         [test $HAVE_GROUP_MEMBER = 0]
 
 configure.ac:
 gl_FUNC_GROUP_MEMBER
+gl_UNISTD_MODULE_INDICATOR([group-member])
 
 Makefile.am:
 
 Include:
-"group-member.h"
+<unistd.h>
 
 License:
 GPL
index 75a99da..72afda6 100644 (file)
@@ -1,5 +1,5 @@
 Description:
-Parametrizable hash table.
+Parameterizable hash table.
 
 Files:
 lib/hash.c
@@ -10,7 +10,7 @@ Depends-on:
 bitrotate
 stdbool
 stdint
-xalloc
+xalloc-oversized
 
 configure.ac:
 gl_HASH
index a77bfe7..b3f814b 100644 (file)
@@ -7,11 +7,9 @@ hash-pjw
 inttostr
 progname
 stdbool
-xalloc
 
 configure.ac:
 
 Makefile.am:
 TESTS += test-hash
 check_PROGRAMS += test-hash
-test_hash_LDADD = $(LDADD) @LIBINTL@
index df0e070..82330f6 100644 (file)
@@ -19,7 +19,8 @@ BUILT_SOURCES += $(ICONV_H)
 
 # 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' \
@@ -37,6 +38,10 @@ iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              < $(srcdir)/iconv.in.h; \
        } > $@-t && \
        mv $@-t $@
+else
+iconv.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 MOSTLYCLEANFILES += iconv.h iconv.h-t
 
 Include:
index 7b8190f..ee7de0e 100644 (file)
@@ -14,8 +14,8 @@ Depends-on:
 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
index be6ff9f..b29b309 100644 (file)
@@ -8,9 +8,9 @@ m4/iconv_open.m4
 
 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
index 2348641..6334de2 100644 (file)
@@ -16,6 +16,7 @@ gl_IDCACHE
 Makefile.am:
 
 Include:
+"idcache.h"
 
 License:
 GPL
index 8d48863..9d00c1f 100644 (file)
@@ -10,7 +10,6 @@ configure.ac:
 AC_REQUIRE([AC_C_INLINE])
 
 Makefile.am:
-lib_SOURCES += ignore-value.h
 
 Include:
 "ignore-value.h"
index 481486d..8da390f 100644 (file)
@@ -6,7 +6,7 @@ lib/imaxabs.c
 m4/imaxabs.m4
 
 Depends-on:
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_FUNC_IMAXABS
index 7eacbc7..7589024 100644 (file)
@@ -6,7 +6,7 @@ lib/imaxdiv.c
 m4/imaxdiv.m4
 
 Depends-on:
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_FUNC_IMAXDIV
index 3b00b62..7e9c7f4 100644 (file)
@@ -6,11 +6,11 @@ lib/inet_ntop.c
 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
index 44c50b8..18fe07e 100644 (file)
@@ -6,12 +6,12 @@ lib/inet_pton.c
 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
diff --git a/modules/intprops-tests b/modules/intprops-tests
new file mode 100644 (file)
index 0000000..4aa04d9
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-intprops.c
+
+Depends-on:
+inttypes
+stdbool
+verify
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-intprops
+check_PROGRAMS += test-intprops
index 674d83e..157b597 100644 (file)
@@ -2,56 +2,15 @@ Description:
 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
 
 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 $(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>
diff --git a/modules/inttypes-incomplete b/modules/inttypes-incomplete
new file mode 100644 (file)
index 0000000..ef743dd
--- /dev/null
@@ -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
index 5ba70ed..57328f3 100644 (file)
@@ -8,8 +8,9 @@ m4/ioctl.m4
 
 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
index 6352af4..ee1c220 100644 (file)
@@ -7,9 +7,9 @@ lib/isapipe.h
 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
index f122c5a..259da35 100644 (file)
@@ -7,11 +7,11 @@ m4/isfinite.m4
 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 @@ Include:
 <math.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Ben Pfaff
index 2c6851c..1a8399f 100644 (file)
@@ -7,9 +7,9 @@ m4/isinf.m4
 m4/check-math-lib.m4
 
 Depends-on:
-float
 math
 extensions
+float           [test $REPLACE_ISINF = 1]
 
 configure.ac:
 gl_ISINF
index fd23db9..c2b239a 100644 (file)
@@ -19,7 +19,7 @@ BUILT_SOURCES += langinfo.h
 
 # 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' \
index 9fea1b3..d9d140e 100644 (file)
@@ -6,12 +6,12 @@ lib/lchown.c
 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
index 7dd82cc..517a40a 100644 (file)
@@ -7,8 +7,8 @@ m4/ldexpl.m4
 
 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
index 6a006c3..38cf5ec 100644 (file)
@@ -6,10 +6,10 @@ lib/link.c
 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
index 53e2a07..1f09785 100644 (file)
@@ -7,23 +7,23 @@ lib/linkat.c
 m4/linkat.m4
 
 Depends-on:
-areadlink
-areadlinkat
-dirname-lgpl
-errno
-extensions
-fcntl-h
-filenamecat-lgpl
-openat
-link
-link-follow
-lstat
-readlink
-same-inode
-stpcpy
-symlink
-symlinkat
 unistd
+extensions
+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]
+dosname          [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]
+same-inode       [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+save-cwd         [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
+symlink          [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1]
 
 configure.ac:
 gl_FUNC_LINKAT
index 6df4781..76eb5de 100644 (file)
@@ -7,10 +7,10 @@ tests/macros.h
 Depends-on:
 ignore-value
 areadlink-with-size
-filenamecat
+filenamecat-lgpl
+getcwd-lgpl
 progname
 same-inode
-xgetcwd
 
 configure.ac:
 
index 6912f5d..7c77557 100644 (file)
@@ -7,7 +7,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 9c350cf..a565c03 100644 (file)
@@ -21,7 +21,7 @@ BUILT_SOURCES += locale.h
 
 # 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' \
index 165de35..b6b62e7 100644 (file)
@@ -23,6 +23,7 @@ Include:
 
 Link:
 @INTL_MACOSX_LIBS@
+$(LTLIBTHREAD) when linking with libtool, $(LIBTHREAD) otherwise
 
 License:
 LGPLv2+
index 3b53c6c..f7633f0 100644 (file)
@@ -14,5 +14,5 @@ AC_CHECK_FUNCS_ONCE([newlocale])
 Makefile.am:
 TESTS += test-localename
 check_PROGRAMS += test-localename
-test_localename_LDADD = $(LDADD) @INTL_MACOSX_LIBS@
+test_localename_LDADD = $(LDADD) @INTL_MACOSX_LIBS@ $(LIBTHREAD)
 
index c9b7237..95fd1a0 100644 (file)
@@ -8,9 +8,9 @@ m4/logl.m4
 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 @@ Link:
 $(LOGL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
index 29bf734..207610c 100644 (file)
@@ -8,6 +8,7 @@ m4/long-options.m4
 
 Depends-on:
 getopt-gnu
+stdlib
 version-etc
 
 configure.ac:
index e53ac7e..a945a11 100644 (file)
@@ -6,9 +6,9 @@ lib/lstat.c
 m4/lstat.m4
 
 Depends-on:
-dosname
-stat
 sys_stat
+dosname         [test $REPLACE_LSTAT = 1]
+stat            [test $REPLACE_LSTAT = 1]
 
 configure.ac:
 gl_FUNC_LSTAT
index 831f659..366408a 100644 (file)
@@ -7,10 +7,10 @@ otherwise when this module occurs as a tests-related module, it will
 have side effects on the compilation of the main modules in lib/.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'malloc-gnu' instead.
+This module is deprecated. Use the module 'malloc-gnu' instead.
 
 Files:
 
index bcf08c7..6bc0d9f 100644 (file)
@@ -19,7 +19,7 @@ BUILT_SOURCES += math.h
 
 # 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' \
index e7f3673..5bc9f29 100644 (file)
@@ -8,8 +8,8 @@ m4/mbstate_t.m4
 
 Depends-on:
 wchar
-mbrtowc
 extensions
+mbrtowc         [test $HAVE_MBRLEN = 0 || test $REPLACE_MBRLEN = 1]
 
 configure.ac:
 gl_FUNC_MBRLEN
index 5981633..85cde1e 100644 (file)
@@ -12,11 +12,11 @@ m4/codeset.m4
 
 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
index 4e673c7..a8ee058 100644 (file)
@@ -8,9 +8,9 @@ m4/mbstate_t.m4
 
 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
index e8975b8..a179296 100644 (file)
@@ -9,11 +9,11 @@ m4/mbsnrtowcs.m4
 m4/mbstate_t.m4
 
 Depends-on:
-extensions
 wchar
-mbrtowc
-minmax
-strnlen1
+extensions
+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
index 973b695..66dd78f 100644 (file)
@@ -14,9 +14,9 @@ m4/codeset.m4
 
 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
index f41d508..02b0c88 100644 (file)
@@ -8,8 +8,8 @@ m4/mbtowc.m4
 
 Depends-on:
 stdlib
-mbrtowc
-wchar
+mbrtowc         [test $REPLACE_MBTOWC = 1]
+wchar           [test $REPLACE_MBTOWC = 1]
 
 configure.ac:
 gl_FUNC_MBTOWC
index 495f2e2..229b3a5 100644 (file)
@@ -10,6 +10,7 @@ m4/mmap-anon.m4
 Depends-on:
 extensions
 string
+memchr-obsolete
 
 configure.ac:
 gl_FUNC_MEMCHR
diff --git a/modules/memchr-obsolete b/modules/memchr-obsolete
new file mode 100644 (file)
index 0000000..c1033b6
--- /dev/null
@@ -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
index c6bc262..dda4324 100644 (file)
@@ -12,7 +12,7 @@ lib/memcmp.c
 m4/memcmp.m4
 
 Depends-on:
-stdint
+stdint          [test $ac_cv_func_memcmp_working = no]
 
 configure.ac:
 gl_FUNC_MEMCMP
index c404d01..1aa1c79 100644 (file)
@@ -10,7 +10,7 @@ Depends-on:
 getgroups
 getugroups
 realloc-gnu
-xalloc
+xalloc-oversized
 
 configure.ac:
 gl_MGETGROUPS
index 08089d0..44b9057 100644 (file)
@@ -6,8 +6,8 @@ lib/mkdir.c
 m4/mkdir.m4
 
 Depends-on:
-dirname-lgpl
 sys_stat
+dirname-lgpl    [test $REPLACE_MKDIR = 1]
 
 configure.ac:
 gl_FUNC_MKDIR
index 3c5aeee..4ca30c4 100644 (file)
@@ -6,9 +6,9 @@ lib/mkdtemp.c
 m4/mkdtemp.m4
 
 Depends-on:
-stdint
 stdlib
-tempname
+stdint          [test $HAVE_MKDTEMP = 0]
+tempname        [test $HAVE_MKDTEMP = 0]
 
 configure.ac:
 gt_FUNC_MKDTEMP
index 3eaaad6..dae3755 100644 (file)
@@ -6,8 +6,8 @@ lib/mkfifo.c
 m4/mkfifo.m4
 
 Depends-on:
-stat
 sys_stat
+stat            [test $HAVE_MKFIFO = 0 || test $REPLACE_MKFIFO = 1]
 
 configure.ac:
 gl_FUNC_MKFIFO
index 2bc7e65..705fb4f 100644 (file)
@@ -7,12 +7,12 @@ lib/mknodat.c
 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
index c965606..6db2d5e 100644 (file)
@@ -6,10 +6,10 @@ lib/mknod.c
 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
index 8a61dbe..85b01b7 100644 (file)
@@ -7,9 +7,9 @@ lib/mkostemp.c
 m4/mkostemp.m4
 
 Depends-on:
-extensions
 stdlib
-tempname
+extensions
+tempname        [test $HAVE_MKOSTEMP = 0]
 
 configure.ac:
 gl_FUNC_MKOSTEMP
index a4175bd..ff3c97a 100644 (file)
@@ -7,9 +7,9 @@ lib/mkostemps.c
 m4/mkostemps.m4
 
 Depends-on:
-extensions
 stdlib
-tempname
+extensions
+tempname        [test $HAVE_MKOSTEMPS = 0]
 
 configure.ac:
 gl_FUNC_MKOSTEMPS
index 265144b..0f4fef6 100644 (file)
@@ -6,9 +6,9 @@ lib/mkstemp.c
 m4/mkstemp.m4
 
 Depends-on:
-extensions
 stdlib
-tempname
+extensions
+tempname        [test $HAVE_MKSTEMP = 0 || test $REPLACE_MKSTEMP = 1]
 
 configure.ac:
 gl_FUNC_MKSTEMP
index 2a49777..56718a9 100644 (file)
@@ -6,9 +6,9 @@ lib/mkstemps.c
 m4/mkstemps.m4
 
 Depends-on:
-extensions
 stdlib
-tempname
+extensions
+tempname        [test $HAVE_MKSTEMPS = 0]
 
 configure.ac:
 gl_FUNC_MKSTEMPS
index d5b0ee7..81aa714 100644 (file)
@@ -8,7 +8,7 @@ m4/mktime.m4
 
 Depends-on:
 multiarch
-time_r
+time_r          [test $REPLACE_MKTIME = 1]
 
 configure.ac:
 gl_FUNC_MKTIME
index dfe1c7a..32af74b 100644 (file)
@@ -6,16 +6,16 @@ lib/nanosleep.c
 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 @@ Link:
 $(LIB_NANOSLEEP)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Jim Meyering
index 9b95a6e..59f2689 100644 (file)
@@ -6,6 +6,7 @@ lib/netdb.in.h
 m4/netdb_h.m4
 
 Depends-on:
+c++defs
 include_next
 arg-nonnull
 warn-on-use
@@ -19,7 +20,7 @@ BUILT_SOURCES += netdb.h
 
 # 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' \
@@ -33,6 +34,8 @@ netdb.h: netdb.in.h $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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; \
diff --git a/modules/netdb-c++-tests b/modules/netdb-c++-tests
new file mode 100644 (file)
index 0000000..af07dee
--- /dev/null
@@ -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
index 1c3ae0b..3590c94 100644 (file)
@@ -2,6 +2,7 @@ Files:
 tests/test-netdb.c
 
 Depends-on:
+netdb-c++-tests
 
 configure.ac:
 
index 06df756..da68081 100644 (file)
@@ -18,7 +18,8 @@ BUILT_SOURCES += $(NETINET_IN_H)
 
 # 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! */'; \
@@ -30,6 +31,10 @@ netinet/in.h: netinet_in.in.h
              < $(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
 
index 9528405..2d469eb 100644 (file)
@@ -2,16 +2,33 @@ Description:
 Read, set or clear the non-blocking file descriptor flag.
 
 Files:
-lib/nonblocking.c
 lib/nonblocking.h
+lib/nonblocking.c
+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
diff --git a/modules/nonblocking-pipe-tests b/modules/nonblocking-pipe-tests
new file mode 100644 (file)
index 0000000..fa3b771
--- /dev/null
@@ -0,0 +1,35 @@
+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
+test_nonblocking_pipe_main_LDADD = $(LDADD) @LIBINTL@
diff --git a/modules/nonblocking-socket-tests b/modules/nonblocking-socket-tests
new file mode 100644 (file)
index 0000000..2eb883e
--- /dev/null
@@ -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) @LIBINTL@
+test_nonblocking_socket_child_LDADD = $(LDADD) $(LIBSOCKET)
index 34d206d..b84a327 100644 (file)
@@ -5,11 +5,12 @@ tests/macros.h
 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)
index af12846..bceecdc 100644 (file)
@@ -7,9 +7,9 @@ lib/obstack.c
 
 Depends-on:
 gettext-h
-exit
 exitfail
 stdint
+stdlib
 
 configure.ac:
 AC_FUNC_OBSTACK
index 2982908..ea0f5ae 100644 (file)
@@ -8,7 +8,7 @@ m4/mode_t.m4
 
 Depends-on:
 fcntl-h
-stat
+stat            [test $REPLACE_OPEN = 1]
 
 configure.ac:
 gl_FUNC_OPEN
index 35917c5..c0cb834 100644 (file)
@@ -24,18 +24,17 @@ fcntl-h
 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
-same-inode
+rmdir           [test $REPLACE_UNLINKAT = 1]
 save-cwd
 stdbool
 sys_stat
 unistd
-unlink
+unlink          [test $REPLACE_UNLINKAT = 1]
 
 configure.ac:
 gl_FUNC_OPENAT
index 5972aa1..357a335 100644 (file)
@@ -9,10 +9,10 @@ m4/pagealign_alloc.m4
 
 Depends-on:
 error
-exit
 extensions
 getpagesize
 gettext-h
+stdlib
 xalloc
 unistd
 
index 74ef410..b3d8a3c 100644 (file)
@@ -4,17 +4,15 @@ Pass file descriptors along Unix domain sockets
 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
index 477754b..9bb1c5c 100644 (file)
@@ -3,9 +3,11 @@ tests/test-passfd.c
 tests/macros.h
 
 Depends-on:
+sys_wait
 
 configure.ac:
 AC_CHECK_DECLS_ONCE([alarm])
+AC_CHECK_FUNCS_ONCE([socketpair])
 
 Makefile.am:
 TESTS += test-passfd
index c019029..d2147b6 100644 (file)
@@ -7,8 +7,8 @@ m4/perror.m4
 
 Depends-on:
 stdio
-errno
-strerror
+errno           [test $REPLACE_PERROR = 1]
+strerror        [test $REPLACE_PERROR = 1]
 
 configure.ac:
 gl_FUNC_PERROR
index 06e0706..cfc008d 100644 (file)
@@ -2,10 +2,10 @@ Description:
 Creation of subprocesses, communicating via pipes.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'spawn-pipe' instead.
+This module is deprecated. Use the module 'spawn-pipe' instead.
 
 Files:
 lib/pipe.h
index 7122c1a..ac56c60 100644 (file)
@@ -10,10 +10,11 @@ Depends-on:
 spawn-pipe
 wait-process
 error
-exit
+fcntl-h
 gettext-h
 stdbool
 stdint
+stdlib
 sys_select
 unistd
 
index f845a8f..faa4e1a 100644 (file)
@@ -10,10 +10,11 @@ Depends-on:
 spawn-pipe
 wait-process
 error
-exit
+fcntl-h
 gettext-h
 stdbool
 stdint
+stdlib
 sys_select
 unistd
 
index 1183657..62872a2 100644 (file)
@@ -10,6 +10,7 @@ unistd
 fcntl-h
 binary-io
 extensions
+verify
 
 configure.ac:
 gl_FUNC_PIPE2
index 5d24bd7..2e6c3f7 100644 (file)
@@ -11,3 +11,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-pipe2
 check_PROGRAMS += test-pipe2
+test_pipe2_LDADD = $(LDADD) $(LIBSOCKET)
index 8690271..478e99b 100644 (file)
@@ -7,11 +7,11 @@ m4/poll.m4
 
 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
index 347fc60..8673fe4 100644 (file)
@@ -19,7 +19,7 @@ BUILT_SOURCES += poll.h
 
 # 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' \
index 75e278d..d4ba0ab 100644 (file)
@@ -6,8 +6,8 @@ lib/popen.c
 m4/popen.m4
 
 Depends-on:
-open
 stdio
+open            [test $REPLACE_POPEN = 1]
 
 configure.ac:
 gl_FUNC_POPEN
index a4967b9..54e08d8 100644 (file)
@@ -7,12 +7,11 @@ m4/posix_spawn.m4
 
 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
index 80b1c91..eef7b63 100644 (file)
@@ -9,12 +9,11 @@ m4/posix_spawn.m4
 
 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])
index 173dc64..1cab62f 100644 (file)
@@ -9,12 +9,11 @@ m4/posix_spawn.m4
 
 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])
index d621d2d..464e649 100644 (file)
@@ -9,12 +9,11 @@ m4/posix_spawn.m4
 
 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])
index 8ca5aa2..ae1ea0d 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index 7431aab..7afc5be 100644 (file)
@@ -13,7 +13,6 @@ spawn
 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])
index 426b382..59fd22b 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index 47a70dd..ffade0c 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index 60d62cc..58e59d3 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index c8cd1e4..6767db6 100644 (file)
@@ -14,7 +14,6 @@ gl_POSIX_SPAWN
 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])
index a3be8cc..19188c9 100644 (file)
@@ -14,7 +14,6 @@ gl_POSIX_SPAWN
 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])
index 6a93722..980a59a 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index a984e96..3435de2 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index 796f264..fd8a116 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index 54cbc99..2fad145 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index 6affe36..4f00f63 100644 (file)
@@ -11,7 +11,6 @@ spawn
 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])
index eb448f8..6827501 100644 (file)
@@ -14,7 +14,6 @@ gl_POSIX_SPAWN
 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])
index 44b487b..2de648d 100644 (file)
@@ -14,7 +14,6 @@ gl_POSIX_SPAWN
 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])
index e9f5bb1..3d8ec56 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index d73840b..5e2bf44 100644 (file)
@@ -12,7 +12,6 @@ spawn
 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])
index 1cac784..ec6accb 100644 (file)
@@ -7,12 +7,11 @@ m4/posix_spawn.m4
 
 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
index 4c6e6ec..5fcb47c 100644 (file)
@@ -6,9 +6,10 @@ lib/pread.c
 m4/pread.m4
 
 Depends-on:
-extensions
-lseek
 unistd
+extensions
+lseek           [test $HAVE_PREAD = 0 || test $REPLACE_PREAD = 1]
+read            [test $HAVE_PREAD = 0 || test $REPLACE_PREAD = 1]
 
 configure.ac:
 gl_FUNC_PREAD
index 0597ef9..1c763a0 100644 (file)
@@ -15,8 +15,8 @@ m4/asm-underscore.m4
 
 Depends-on:
 stdio
-vfprintf-posix
 printf-safe
+vfprintf-posix  [test $REPLACE_PRINTF = 1]
 
 configure.ac:
 gl_FUNC_PRINTF_POSIX
index b861331..0002ab7 100644 (file)
@@ -7,6 +7,7 @@ lib/pty-private.h
 
 Depends-on:
 ptsname
+stdlib
 
 configure.ac:
 
index e29016a..3a00c77 100644 (file)
@@ -17,7 +17,8 @@ BUILT_SOURCES += $(PTHREAD_H)
 
 # 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' \
@@ -30,6 +31,10 @@ pthread.h: pthread.in.h
              < $(srcdir)/pthread.in.h; \
        } > $@-t && \
        mv $@-t $@
+else
+pthread.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 MOSTLYCLEANFILES += pthread.h pthread.h-t
 
 Include:
index d6ae046..ab14894 100644 (file)
@@ -8,7 +8,7 @@ m4/ptsname.m4
 Depends-on:
 stdlib
 extensions
-ttyname_r
+ttyname_r       [test $HAVE_PTSNAME = 0]
 
 configure.ac:
 gl_FUNC_PTSNAME
index 93f280c..8be8e02 100644 (file)
@@ -18,7 +18,7 @@ BUILT_SOURCES += pty.h
 
 # 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' \
index 3874b54..ce28e4c 100644 (file)
@@ -7,7 +7,7 @@ m4/putenv.m4
 
 Depends-on:
 stdlib
-malloc-posix
+malloc-posix    [test $REPLACE_PUTENV = 1]
 
 configure.ac:
 gl_FUNC_PUTENV
index b6511a2..f2dd02f 100644 (file)
@@ -6,9 +6,10 @@ lib/pwrite.c
 m4/pwrite.m4
 
 Depends-on:
-extensions
-lseek
 unistd
+extensions
+lseek           [test $HAVE_PWRITE = 0 || test $REPLACE_PWRITE = 1]
+write           [test $HAVE_PWRITE = 0 || test $REPLACE_PWRITE = 1]
 
 configure.ac:
 gl_FUNC_PWRITE
diff --git a/modules/read b/modules/read
new file mode 100644 (file)
index 0000000..85a9e02
--- /dev/null
@@ -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
index 933ae5b..7f2af8f 100644 (file)
@@ -7,8 +7,8 @@ lib/readline.c
 m4/readline.m4
 
 Depends-on:
-getline
 havelib
+getline         [test "$gl_cv_lib_readline" = no]
 
 configure.ac:
 gl_FUNC_READLINE
index eb32ef5..37c03a7 100644 (file)
@@ -6,8 +6,8 @@ lib/readlink.c
 m4/readlink.m4
 
 Depends-on:
-stat
 unistd
+stat            [test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1]
 
 configure.ac:
 gl_FUNC_READLINK
index 593f2c2..18f2f95 100644 (file)
@@ -6,11 +6,11 @@ lib/readlinkat.c
 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
diff --git a/modules/readme-release b/modules/readme-release
new file mode 100644 (file)
index 0000000..a2128bf
--- /dev/null
@@ -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
index 42c7d70..b712e02 100644 (file)
@@ -7,10 +7,10 @@ otherwise when this module occurs as a tests-related module, it will
 have side effects on the compilation of the main modules in lib/.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'realloc-gnu' instead.
+This module is deprecated. Use the module 'realloc-gnu' instead.
 
 Files:
 
index 04602f9..c225917 100644 (file)
@@ -7,7 +7,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 8237565..9a6d833 100644 (file)
@@ -7,8 +7,8 @@ lib/w32sock.h
 
 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])
index 6a8f4c2..730076c 100644 (file)
@@ -12,23 +12,23 @@ m4/regex.m4
 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
index b968929..8246e56 100644 (file)
@@ -10,6 +10,10 @@ lib/progname.c
 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
index 886a039..4723801 100644 (file)
@@ -6,9 +6,9 @@ lib/remove.c
 m4/remove.m4
 
 Depends-on:
-rmdir
 stdio
-unlink
+rmdir           [test $REPLACE_REMOVE = 1]
+unlink          [test $REPLACE_REMOVE = 1]
 
 configure.ac:
 gl_FUNC_REMOVE
index ae8390a..449d9be 100644 (file)
@@ -6,14 +6,14 @@ lib/rename.c
 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
index f52b3b8..e175761 100644 (file)
@@ -2,10 +2,10 @@ Description:
 rename() function: change the name or location of a file.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete; use the rename module instead.
+This module is deprecated. Use the 'rename' module instead.
 
 Files:
 
index 14de04a..cefdb13 100644 (file)
@@ -7,14 +7,16 @@ lib/renameat.c
 m4/renameat.m4
 
 Depends-on:
+stdio
 extensions
 fcntl-h
-filenamecat-lgpl
-openat
-rename
-same-inode
-stdio
-stpcpy
+dosname          [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
+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]
+save-cwd         [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
 
 configure.ac:
 gl_FUNC_RENAMEAT
index dcef7c1..9e7b337 100644 (file)
@@ -7,8 +7,8 @@ tests/macros.h
 Depends-on:
 ignore-value
 filenamecat
+getcwd-lgpl
 progname
-xgetcwd
 
 configure.ac:
 
index eaa5a68..95e7b1d 100644 (file)
@@ -6,9 +6,9 @@ lib/rmdir.c
 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
index c4acba1..07dcd88 100644 (file)
@@ -9,10 +9,10 @@ m4/floor.m4
 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
index d77b2a1..d9c283e 100644 (file)
@@ -10,9 +10,9 @@ m4/floorf.m4
 m4/ceilf.m4
 
 Depends-on:
-float
 math
 extensions
+float           [test $HAVE_DECL_ROUNDF = 0 || test $REPLACE_ROUNDF = 1]
 
 configure.ac:
 gl_FUNC_ROUNDF
index 9eb9f1d..516ee0b 100644 (file)
@@ -10,9 +10,9 @@ m4/floorl.m4
 m4/ceill.m4
 
 Depends-on:
-float
 math
 extensions
+float           [test $HAVE_DECL_ROUNDL = 0 || test $REPLACE_ROUNDL = 1]
 
 configure.ac:
 gl_FUNC_ROUNDL
index 17a6c20..bfa5380 100644 (file)
@@ -8,10 +8,10 @@ m4/rpmatch.m4
 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
index 533d83b..89e79a9 100644 (file)
@@ -7,6 +7,7 @@ lib/safe-read.c
 m4/safe-read.m4
 
 Depends-on:
+read
 ssize_t
 
 configure.ac:
index 137c94a..cdc80d2 100644 (file)
@@ -4,10 +4,12 @@ An interface to the write() function that retries after interrupts.
 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:
index 02a0723..974b596 100644 (file)
@@ -9,7 +9,7 @@ m4/save-cwd.m4
 Depends-on:
 chdir-long
 cloexec
-getcwd
+getcwd-lgpl
 fchdir
 stdbool
 unistd-safer
index 1f32372..1e95b41 100644 (file)
@@ -9,12 +9,12 @@ m4/savewd.m4
 Depends-on:
 dosname
 errno
-exit
 fchdir
 fcntl-safer
 fcntl-h
 raise
 stdbool
+stdlib
 xalloc
 
 configure.ac:
index d126fc7..e0a3936 100644 (file)
@@ -16,7 +16,8 @@ BUILT_SOURCES += $(SCHED_H)
 
 # 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' \
@@ -28,6 +29,10 @@ sched.h: sched.in.h
              < $(srcdir)/sched.in.h; \
        } > $@-t && \
        mv $@-t $@
+else
+sched.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 MOSTLYCLEANFILES += sched.h sched.h-t
 
 Include:
index ceed3ff..4650d31 100644 (file)
@@ -19,7 +19,7 @@ BUILT_SOURCES += search.h
 
 # 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' \
index 18865f1..ab4af6e 100644 (file)
@@ -6,9 +6,9 @@ lib/select.c
 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
index 745ea49..66429f7 100644 (file)
@@ -21,7 +21,7 @@ Makefile.am:
 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! */' && \
@@ -37,7 +37,8 @@ selinux/selinux.h: se-selinux.in.h $(UNUSED_PARAMETER_H)
 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! */' && \
@@ -46,6 +47,10 @@ selinux/context.h: se-context.in.h $(UNUSED_PARAMETER_H)
        } > $@-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
 
index 4317d6f..8a07da9 100644 (file)
@@ -7,7 +7,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index d9a292c..b28a7ea 100644 (file)
@@ -7,7 +7,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 8112616..95ff0a0 100644 (file)
@@ -7,10 +7,10 @@ m4/setenv.m4
 
 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
index 5d3e58b..918a037 100644 (file)
@@ -7,7 +7,7 @@ m4/setlocale.m4
 
 Depends-on:
 locale
-localename
+localename      [test $REPLACE_SETLOCALE = 1]
 
 configure.ac:
 gl_FUNC_SETLOCALE
index b429510..33726b1 100644 (file)
@@ -7,8 +7,8 @@ lib/w32sock.h
 
 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])
index c1e0621..322ff8d 100644 (file)
@@ -7,7 +7,7 @@ lib/w32sock.h
 
 Depends-on:
 sys_socket
-errno
+errno           [test "$ac_cv_header_winsock2_h" = yes]
 
 configure.ac:
 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
index 0e42e94..93b848a 100644 (file)
@@ -8,7 +8,7 @@ m4/sigaction.m4
 
 Depends-on:
 signal
-sigprocmask
+sigprocmask     [test $HAVE_SIGACTION = 0]
 
 configure.ac:
 gl_SIGACTION
index c9ff197..c8d93a1 100644 (file)
@@ -10,6 +10,7 @@ arg-nonnull
 c++defs
 include_next
 warn-on-use
+extensions
 
 configure.ac:
 gl_SIGNAL_H
@@ -19,7 +20,7 @@ BUILT_SOURCES += signal.h
 
 # 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' \
@@ -35,6 +36,7 @@ signal.h: signal.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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)' \
index 14a5754..b3ad388 100644 (file)
@@ -9,13 +9,13 @@ lib/float+.h
 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
index e46abc9..fee745f 100644 (file)
@@ -7,8 +7,8 @@ m4/signalblocking.m4
 
 Depends-on:
 signal
-stdint
-raise
+stdint          [test $HAVE_POSIX_SIGNALBLOCKING = 0]
+raise           [test $HAVE_POSIX_SIGNALBLOCKING = 0]
 
 configure.ac:
 gl_SIGNALBLOCKING
index 67621ed..7f2007a 100644 (file)
@@ -11,10 +11,10 @@ m4/sinl.m4
 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 @@ Link:
 $(SINL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
index e859e59..c9b6c40 100644 (file)
@@ -6,9 +6,9 @@ lib/sleep.c
 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
index e8b5dfb..cd048aa 100644 (file)
@@ -8,8 +8,8 @@ m4/printf.m4
 
 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
index 16b38b7..874ba5a 100644 (file)
@@ -14,18 +14,18 @@ m4/printf.m4
 
 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
index f5daa49..92df980 100644 (file)
@@ -7,8 +7,8 @@ lib/w32sock.h
 
 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])
index b79a02f..fe92926 100644 (file)
@@ -10,7 +10,7 @@ m4/sockets.m4
 Depends-on:
 socketlib
 sys_socket
-close-hook
+fd-hook
 
 configure.ac:
 gl_SOCKETS
index 61e5e07..f133422 100644 (file)
@@ -20,7 +20,7 @@ BUILT_SOURCES += spawn.h
 
 # 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' \
index 04441b1..9898b37 100644 (file)
@@ -12,7 +12,6 @@ cloexec
 dup2
 environ
 error
-exit
 fatal-signal
 gettext-h
 open
@@ -30,6 +29,7 @@ posix_spawnattr_setsigmask
 posix_spawnattr_setflags
 posix_spawnattr_destroy
 stdbool
+stdlib
 strpbrk
 unistd
 unistd-safer
index b5f02f6..cdcc8aa 100644 (file)
@@ -14,20 +14,20 @@ m4/printf.m4
 
 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
index d488666..d7f73ca 100644 (file)
@@ -8,11 +8,11 @@ m4/sqrtl.m4
 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 @@ Link:
 $(SQRTL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
index 744aa7a..db179aa 100644 (file)
@@ -6,9 +6,9 @@ lib/stat.c
 m4/stat.m4
 
 Depends-on:
-dosname
-stdbool
 sys_stat
+dosname         [test $REPLACE_STAT = 1]
+stdbool         [test $REPLACE_STAT = 1]
 
 configure.ac:
 gl_FUNC_STAT
index 05a01db..6cb1db8 100644 (file)
@@ -23,7 +23,8 @@ BUILT_SOURCES += $(STDARG_H)
 
 # 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' \
@@ -33,6 +34,10 @@ stdarg.h: stdarg.in.h
              < $(srcdir)/stdarg.in.h; \
        } > $@-t && \
        mv $@-t $@
+else
+stdarg.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 MOSTLYCLEANFILES += stdarg.h stdarg.h-t
 
 Include:
index 80fe2db..cfb9aac 100644 (file)
@@ -16,12 +16,17 @@ BUILT_SOURCES += $(STDBOOL_H)
 
 # 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:
index 4836bc7..94b57da 100644 (file)
@@ -17,7 +17,8 @@ BUILT_SOURCES += $(STDDEF_H)
 
 # 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' \
@@ -29,6 +30,10 @@ stddef.h: stddef.in.h
              < $(srcdir)/stddef.in.h; \
        } > $@-t && \
        mv $@-t $@
+else
+stddef.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 MOSTLYCLEANFILES += stddef.h stddef.h-t
 
 Include:
index 45b02d4..c11825a 100644 (file)
@@ -23,7 +23,8 @@ BUILT_SOURCES += $(STDINT_H)
 
 # 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' \
@@ -55,6 +56,10 @@ stdint.h: stdint.in.h
              < $(srcdir)/stdint.in.h; \
        } > $@-t && \
        mv $@-t $@
+else
+stdint.h: $(top_builddir)/config.status
+       rm -f $@
+endif
 MOSTLYCLEANFILES += stdint.h stdint.h-t
 
 Include:
index 2e6c726..376e75f 100644 (file)
@@ -20,7 +20,7 @@ BUILT_SOURCES += stdio.h
 
 # 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' \
@@ -30,20 +30,27 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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' \
@@ -56,14 +63,18 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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' \
@@ -105,6 +116,7 @@ stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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' \
index d666be7..a24a593 100644 (file)
@@ -21,7 +21,7 @@ BUILT_SOURCES += stdlib.h
 
 # 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' \
index 0023f46..0c91e06 100644 (file)
@@ -1,6 +1,12 @@
 Description:
 Case-insensitive string comparison functions.
 
+Status:
+obsolete
+
+Notice:
+This module is obsolete.
+
 Files:
 lib/strcasecmp.c
 lib/strncasecmp.c
index 8ae3ea6..59c4cc6 100644 (file)
@@ -8,9 +8,9 @@ lib/strchrnul.valgrind
 m4/strchrnul.m4
 
 Depends-on:
-extensions
 string
-rawmemchr
+extensions
+rawmemchr       [test $HAVE_STRCHRNUL = 0 || test $REPLACE_STRCHRNUL = 1]
 
 configure.ac:
 gl_FUNC_STRCHRNUL
index 4a47488..d158873 100644 (file)
@@ -7,7 +7,7 @@ m4/strdup.m4
 
 Depends-on:
 string
-malloc-posix
+malloc-posix    [test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1]
 
 configure.ac:
 gl_FUNC_STRDUP_POSIX
index 1a204fa..cd14d12 100644 (file)
@@ -6,9 +6,9 @@ lib/strerror.c
 m4/strerror.m4
 
 Depends-on:
-errno
-intprops
 string
+errno           [test $REPLACE_STRERROR = 1]
+intprops        [test $REPLACE_STRERROR = 1]
 
 configure.ac:
 gl_FUNC_STRERROR
index 1a1d8c6..75345ed 100644 (file)
@@ -7,10 +7,10 @@ m4/strerror_r.m4
 
 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
index 96ad213..20bc7cd 100644 (file)
@@ -3,7 +3,6 @@ tests/test-strftime.c
 tests/macros.h
 
 Depends-on:
-strftime
 
 configure.ac:
 
index 78ad324..a88bdce 100644 (file)
@@ -21,7 +21,7 @@ BUILT_SOURCES += string.h
 
 # 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' \
@@ -87,6 +87,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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' \
index 9b7a48e..6019f5d 100644 (file)
@@ -18,7 +18,7 @@ BUILT_SOURCES += strings.h
 
 # 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' \
index 80f143b..c76e966 100644 (file)
@@ -6,9 +6,9 @@ lib/strndup.c
 m4/strndup.m4
 
 Depends-on:
-extensions
 string
-strnlen
+extensions
+strnlen         [test $ac_cv_func_strndup = no || test $REPLACE_STRNDUP = 1]
 
 configure.ac:
 gl_FUNC_STRNDUP
index 9f9f2ca..97fdd66 100644 (file)
@@ -6,9 +6,9 @@ lib/strnlen.c
 m4/strnlen.m4
 
 Depends-on:
-extensions
 string
-memchr
+extensions
+memchr-obsolete [test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1]
 
 configure.ac:
 gl_FUNC_STRNLEN
index 667d552..763dca5 100644 (file)
@@ -7,13 +7,13 @@ m4/strptime.m4
 m4/tm_gmtoff.m4
 
 Depends-on:
-extensions
-sys_time
-string
-strcase
-stdbool
 time
-time_r
+extensions
+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
index 10ca817..eaa3032 100644 (file)
@@ -6,9 +6,9 @@ lib/strsep.c
 m4/strsep.m4
 
 Depends-on:
-extensions
 string
-strpbrk
+extensions
+strpbrk         [test $HAVE_STRSEP = 0]
 
 configure.ac:
 gl_FUNC_STRSEP
index 41dda4e..c8e3bfa 100644 (file)
@@ -8,12 +8,12 @@ m4/strsignal.m4
 
 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
index 9ebf5da..5f66b27 100644 (file)
@@ -8,9 +8,9 @@ m4/strstr.m4
 
 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
index 056ff42..4c21519 100644 (file)
@@ -7,9 +7,10 @@ m4/strtod.m4
 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
diff --git a/modules/strtod-obsolete b/modules/strtod-obsolete
new file mode 100644 (file)
index 0000000..323df8a
--- /dev/null
@@ -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
index 9f82af4..5c8d5e3 100644 (file)
@@ -7,10 +7,10 @@ m4/longlong.m4
 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 @@ Include:
 <inttypes.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paul Eggert
index 08afb43..bbfef2b 100644 (file)
@@ -7,7 +7,7 @@ m4/strtok_r.m4
 
 Depends-on:
 string
-strpbrk
+strpbrk         [test $ac_cv_func_strtok_r = no]
 
 configure.ac:
 gl_FUNC_STRTOK_R
index 8a313a4..654b2f7 100644 (file)
@@ -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 @@ LGPL
 
 Maintainer:
 glibc
-
index 738c9ef..8295e83 100644 (file)
@@ -2,13 +2,13 @@ Description:
 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 @@ LGPL
 
 Maintainer:
 glibc
-
index 8cb6d66..dc2b50b 100644 (file)
@@ -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 @@ LGPL
 
 Maintainer:
 glibc
-
index f02e9b0..97ce1fd 100644 (file)
@@ -2,13 +2,14 @@ Description:
 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 @@ LGPL
 
 Maintainer:
 glibc
-
index e886285..7ad6846 100644 (file)
@@ -2,15 +2,16 @@ Description:
 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 @@ Include:
 <inttypes.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paul Eggert
index 313a6a0..729f01c 100644 (file)
@@ -6,8 +6,8 @@ lib/symlink.c
 m4/symlink.m4
 
 Depends-on:
-lstat
 unistd
+lstat           [test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1]
 
 configure.ac:
 gl_FUNC_SYMLINK
index 16646be..f2666af 100644 (file)
@@ -6,11 +6,11 @@ lib/symlinkat.c
 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
index 1da1655..fdfba45 100644 (file)
@@ -18,7 +18,7 @@ BUILT_SOURCES += sys/file.h
 
 # 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! */'; \
index 669f70b..d0130da 100644 (file)
@@ -20,7 +20,7 @@ BUILT_SOURCES += sys/ioctl.h
 
 # 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! */'; \
index 3fbbd57..79a8581 100644 (file)
@@ -21,7 +21,7 @@ BUILT_SOURCES += sys/select.h
 
 # 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! */'; \
index 775996f..f5cd1f7 100644 (file)
@@ -13,6 +13,7 @@ c++defs
 errno
 include_next
 socklen
+sys_uio
 warn-on-use
 
 configure.ac:
@@ -24,7 +25,7 @@ BUILT_SOURCES += sys/socket.h
 
 # 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! */'; \
index 40bcf6d..7971617 100644 (file)
@@ -22,7 +22,7 @@ BUILT_SOURCES += sys/stat.h
 
 # 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! */'; \
index 92f2ebb..b2c3914 100644 (file)
@@ -20,7 +20,7 @@ BUILT_SOURCES += sys/time.h
 
 # 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! */'; \
index 7a543b4..5905285 100644 (file)
@@ -19,7 +19,7 @@ BUILT_SOURCES += sys/times.h
 
 # 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! */'; \
diff --git a/modules/sys_uio b/modules/sys_uio
new file mode 100644 (file)
index 0000000..2152718
--- /dev/null
@@ -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
diff --git a/modules/sys_uio-tests b/modules/sys_uio-tests
new file mode 100644 (file)
index 0000000..0258579
--- /dev/null
@@ -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
index 4dec661..0bfafd4 100644 (file)
@@ -19,7 +19,7 @@ BUILT_SOURCES += sys/utsname.h
 
 # 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! */'; \
index 0299f9e..a6395e4 100644 (file)
@@ -19,7 +19,7 @@ BUILT_SOURCES += sys/wait.h
 
 # 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! */'; \
index fc47260..5f6896a 100644 (file)
@@ -7,6 +7,7 @@ m4/sysexits.m4
 
 Depends-on:
 include_next
+stdlib
 
 configure.ac:
 gl_SYSEXITS
@@ -16,7 +17,8 @@ BUILT_SOURCES += $(SYSEXITS_H)
 
 # 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' \
@@ -27,6 +29,10 @@ sysexits.h: sysexits.in.h
              < $(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:
index b00fd1b..7840dc1 100644 (file)
@@ -10,10 +10,10 @@ m4/tanl.m4
 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 @@ Link:
 $(TANL_LIBM)
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Paolo Bonzini
index 1b72c8d..6dddb6e 100644 (file)
@@ -9,7 +9,7 @@ m4/tcgetsid.m4
 Depends-on:
 termios
 extensions
-sys_ioctl
+sys_ioctl       [test $ac_cv_func_tcgetsid = no]
 
 configure.ac:
 gl_FUNC_TCGETSID
index 09539f6..ec3f6fc 100644 (file)
@@ -18,7 +18,7 @@ BUILT_SOURCES += termios.h
 
 # 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' \
index ab5efe9..9660144 100644 (file)
@@ -21,7 +21,7 @@ BUILT_SOURCES += time.h
 
 # 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' \
index 0fa61e8..6adf22a 100644 (file)
@@ -7,9 +7,9 @@ m4/tmpfile.m4
 
 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 @@ Include:
 <stdio.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Ben Pfaff
index 1c6f706..71863a5 100644 (file)
@@ -8,7 +8,7 @@ m4/trunc.m4
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_TRUNC = 0 || test $REPLACE_TRUNC = 1]
 
 configure.ac:
 gl_FUNC_TRUNC
index 6c4c46f..15e35e8 100644 (file)
@@ -9,7 +9,7 @@ m4/truncf.m4
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_TRUNCF = 0 || test $REPLACE_TRUNCF = 1]
 
 configure.ac:
 gl_FUNC_TRUNCF
index d3d8884..808c63e 100644 (file)
@@ -9,7 +9,7 @@ m4/truncl.m4
 Depends-on:
 math
 extensions
-float
+float           [test $HAVE_DECL_TRUNCL = 0 || test $REPLACE_TRUNCL = 1]
 
 configure.ac:
 gl_FUNC_TRUNCL
index 54f13e3..608f775 100644 (file)
@@ -16,7 +16,7 @@ Include:
 <time.h>
 
 License:
-GPL
+LGPL
 
 Maintainer:
 Jim Meyering
index ac5ad88..e7364ad 100644 (file)
@@ -7,7 +7,7 @@ m4/uname.m4
 
 Depends-on:
 sys_utsname
-gethostname
+gethostname     [test $HAVE_UNAME = 0]
 
 configure.ac:
 gl_FUNC_UNAME
index 480f74e..2411237 100644 (file)
@@ -2,10 +2,10 @@ Description:
 Unicode character bidi category functions.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'unictype/bidiclass-all' instead.
+This module is deprecated. Use the module 'unictype/bidiclass-all' instead.
 
 Files:
 
index 0bff75d..7e908e8 100644 (file)
@@ -2,10 +2,10 @@ Description:
 Find a Unicode character bidi category, given its name.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'unictype/bidiclass-byname' instead.
+This module is deprecated. Use the module 'unictype/bidiclass-byname' instead.
 
 Files:
 
index 2f90ca7..58f6687 100644 (file)
@@ -2,10 +2,10 @@ Description:
 Name of Unicode character bidi category.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'unictype/bidiclass-name' instead.
+This module is deprecated. Use the module 'unictype/bidiclass-name' instead.
 
 Files:
 
index f1d2b48..4380a35 100644 (file)
@@ -2,10 +2,10 @@ Description:
 Determine bidi category of a Unicode character.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'unictype/bidiclass-of' instead.
+This module is deprecated. Use the module 'unictype/bidiclass-of' instead.
 
 Files:
 
index ee8c94b..89e6b75 100644 (file)
@@ -2,10 +2,10 @@ Description:
 Test whether a Unicode character belongs to a given bidi category.
 
 Status:
-obsolete
+deprecated
 
 Notice:
-This module is obsolete. Use the module 'unictype/bidiclass-test' instead.
+This module is deprecated. Use the module 'unictype/bidiclass-test' instead.
 
 Files:
 
index fbff100..c9a9b76 100644 (file)
@@ -20,7 +20,7 @@ BUILT_SOURCES += unistd.h
 
 # 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' \
@@ -48,6 +48,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
              -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
+             -e 's|@''GNULIB_GROUP_MEMBER''@|$(GNULIB_GROUP_MEMBER)|g' \
              -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
              -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \
              -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \
@@ -56,6 +57,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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' \
@@ -64,6 +66,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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' \
@@ -84,6 +87,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
              -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
+             -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \
              -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
              -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \
              -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \
@@ -124,6 +128,7 @@ unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
              -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' \
index a27a308..26af43d 100644 (file)
@@ -6,9 +6,9 @@ lib/unlink.c
 m4/unlink.m4
 
 Depends-on:
-dosname
-lstat
 unistd
+dosname         [test $REPLACE_UNLINK = 1]
+lstat           [test $REPLACE_UNLINK = 1]
 
 configure.ac:
 gl_FUNC_UNLINK
index 4eadff8..3a5c7b8 100644 (file)
@@ -9,7 +9,7 @@ m4/unlockpt.m4
 Depends-on:
 stdlib
 extensions
-ptsname
+ptsname         [test $HAVE_UNLOCKPT = 0]
 
 configure.ac:
 gl_FUNC_UNLOCKPT
index 6dff883..26662b3 100644 (file)
@@ -7,8 +7,8 @@ m4/setenv.m4
 
 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
index c77826b..0bee1cc 100644 (file)
@@ -6,9 +6,9 @@ lib/usleep.c
 m4/usleep.m4
 
 Depends-on:
-extensions
-sleep
 unistd
+extensions
+sleep           [test $HAVE_USLEEP = 0 || test $REPLACE_USLEEP = 1]
 
 configure.ac:
 gl_FUNC_USLEEP
index 7be906b..a3160c8 100644 (file)
@@ -11,7 +11,6 @@ hash
 stat-time
 time
 utimens
-xalloc
 intprops
 lstat
 stdbool
index 2377080..858fee1 100644 (file)
@@ -6,10 +6,10 @@ lib/utimensat.c
 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
index e0eed16..0b8e141 100644 (file)
@@ -12,10 +12,10 @@ lib/asprintf.c
 m4/vasprintf.m4
 
 Depends-on:
-extensions
-vasnprintf
 stdio
-errno
+extensions
+vasnprintf      [test $HAVE_VASPRINTF = 0 || test $REPLACE_VASPRINTF = 1]
+errno           [test $HAVE_VASPRINTF = 0 || test $REPLACE_VASPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VASPRINTF
index 3ddda20..eba4471 100644 (file)
@@ -7,9 +7,9 @@ m4/vdprintf.m4
 
 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
index 649eacf..518ecde 100644 (file)
@@ -14,18 +14,18 @@ m4/printf.m4
 
 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
index eebb1cd..5216ce8 100644 (file)
@@ -9,7 +9,6 @@ Depends-on:
 configure.ac:
 
 Makefile.am:
-lib_SOURCES += verify.h
 
 Include:
 "verify.h"
index 45af363..69b6608 100644 (file)
@@ -14,20 +14,20 @@ m4/printf.m4
 
 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
diff --git a/modules/vfscanf b/modules/vfscanf
new file mode 100644 (file)
index 0000000..c2d6a8d
--- /dev/null
@@ -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
index 319d83d..b861d10 100644 (file)
@@ -14,8 +14,8 @@ m4/printf.m4
 
 Depends-on:
 stdio
-vfprintf-posix
 printf-safe
+vfprintf-posix  [test $REPLACE_VPRINTF = 1]
 
 configure.ac:
 gl_FUNC_VPRINTF_POSIX
diff --git a/modules/vscanf b/modules/vscanf
new file mode 100644 (file)
index 0000000..cf1d8c2
--- /dev/null
@@ -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
index ce44cf1..053b10c 100644 (file)
@@ -9,8 +9,8 @@ m4/printf.m4
 
 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
index 0f36cd9..198beeb 100644 (file)
@@ -14,18 +14,18 @@ m4/printf.m4
 
 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
index 44d89f5..10e5385 100644 (file)
@@ -14,20 +14,20 @@ m4/printf.m4
 
 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
index 9120bbc..afc8854 100644 (file)
@@ -10,10 +10,10 @@ m4/sig_atomic_t.m4
 Depends-on:
 fatal-signal
 error
-exit
 xalloc
 gettext-h
 stdbool
+stdlib
 sys_wait
 unistd
 atexit
index 06ee6ab..855d18d 100644 (file)
@@ -21,7 +21,7 @@ BUILT_SOURCES += wchar.h
 
 # 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' \
index cdafa55..f9fea15 100644 (file)
@@ -12,9 +12,9 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
-extensions
 wchar
-mbsinit
+extensions
+mbsinit         [test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1]
 
 configure.ac:
 gl_FUNC_WCRTOMB
index 18c549c..4639354 100644 (file)
@@ -8,7 +8,7 @@ m4/wcscasecmp.m4
 
 Depends-on:
 wchar
-wctype-h
+wctype-h        [test $HAVE_WCSCASECMP = 0]
 
 configure.ac:
 gl_FUNC_WCSCASECMP
index 2034b81..14b9a24 100644 (file)
@@ -14,8 +14,8 @@ m4/wcscspn.m4
 
 Depends-on:
 wchar
-wcslen
-wcschr
+wcslen          [test $HAVE_WCSCSPN = 0]
+wcschr          [test $HAVE_WCSCSPN = 0]
 
 configure.ac:
 gl_FUNC_WCSCSPN
index 7e3cd66..49a512e 100644 (file)
@@ -8,8 +8,8 @@ m4/wcsdup.m4
 
 Depends-on:
 wchar
-wcslen
-wmemcpy
+wcslen          [test $HAVE_WCSDUP = 0]
+wmemcpy         [test $HAVE_WCSDUP = 0]
 
 configure.ac:
 gl_FUNC_WCSDUP
index 88f3619..3a1f84a 100644 (file)
@@ -8,7 +8,7 @@ m4/wcsncasecmp.m4
 
 Depends-on:
 wchar
-wctype-h
+wctype-h        [test $HAVE_WCSNCASECMP = 0]
 
 configure.ac:
 gl_FUNC_WCSNCASECMP
index e8e975a..3582ae5 100644 (file)
@@ -13,9 +13,9 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
-extensions
 wchar
-wcrtomb
+extensions
+wcrtomb         [test $HAVE_WCSNRTOMBS = 0 || test $REPLACE_WCSNRTOMBS = 1]
 
 configure.ac:
 gl_FUNC_WCSNRTOMBS
index a5b34f5..b7aefa4 100644 (file)
@@ -14,7 +14,7 @@ m4/wcspbrk.m4
 
 Depends-on:
 wchar
-wcschr
+wcschr          [test $HAVE_WCSPBRK = 0]
 
 configure.ac:
 gl_FUNC_WCSPBRK
index 235b06b..49c0503 100644 (file)
@@ -14,9 +14,9 @@ m4/locale-zh.m4
 m4/codeset.m4
 
 Depends-on:
-extensions
 wchar
-wcrtomb
+extensions
+wcrtomb         [test $HAVE_WCSRTOMBS = 0 || test $REPLACE_WCSRTOMBS = 1]
 
 configure.ac:
 gl_FUNC_WCSRTOMBS
index 3ecd53b..035398d 100644 (file)
@@ -14,7 +14,7 @@ m4/wcsspn.m4
 
 Depends-on:
 wchar
-wcschr
+wcschr          [test $HAVE_WCSSPN = 0]
 
 configure.ac:
 gl_FUNC_WCSSPN
index 22a2fb7..d4f22f8 100644 (file)
@@ -8,7 +8,7 @@ m4/wcsstr.m4
 
 Depends-on:
 wchar
-wcschr
+wcschr          [test $HAVE_WCSSTR = 0]
 
 configure.ac:
 gl_FUNC_WCSSTR
index 6f92b05..dc78e13 100644 (file)
@@ -8,8 +8,8 @@ m4/wcstok.m4
 
 Depends-on:
 wchar
-wcsspn
-wcspbrk
+wcsspn          [test $HAVE_WCSTOK = 0]
+wcspbrk         [test $HAVE_WCSTOK = 0]
 
 configure.ac:
 gl_FUNC_WCSTOK
index 2b748eb..629f21d 100644 (file)
@@ -9,7 +9,7 @@ m4/wcswidth.m4
 
 Depends-on:
 wchar
-wcwidth
+wcwidth         [test $HAVE_WCSWIDTH = 0 || test $REPLACE_WCSWIDTH = 1]
 
 configure.ac:
 gl_FUNC_WCSWIDTH
index eba2ebf..be430eb 100644 (file)
@@ -9,7 +9,7 @@ m4/codeset.m4
 
 Depends-on:
 wchar
-wctomb
+wctomb          [test $ac_cv_func_wctob = no || test $REPLACE_WCTOB = 1]
 
 configure.ac:
 gl_FUNC_WCTOB
index 81d41c4..5077005 100644 (file)
@@ -8,8 +8,8 @@ m4/wctomb.m4
 
 Depends-on:
 stdlib
-wcrtomb
-wchar
+wcrtomb         [test $REPLACE_WCTOMB = 1]
+wchar           [test $REPLACE_WCTOMB = 1]
 
 configure.ac:
 gl_FUNC_WCTOMB
index d248164..ffc76a8 100644 (file)
@@ -14,7 +14,7 @@ m4/wctype.m4
 
 Depends-on:
 wctype-h
-iswblank
+iswblank        [test $HAVE_WCTYPE_T = 0]
 
 configure.ac:
 gl_FUNC_WCTYPE
index f0d7989..30c5cea 100644 (file)
@@ -19,7 +19,7 @@ BUILT_SOURCES += wctype.h
 
 # 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' \
index e4a9460..27327a1 100644 (file)
@@ -8,12 +8,12 @@ m4/wchar_t.m4
 m4/wint_t.m4
 
 Depends-on:
-extensions
 wchar
-wctype-h
-localcharset
-streq
-uniwidth/width
+extensions
+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
index 0f0fc5f..736e40b 100644 (file)
@@ -7,7 +7,7 @@ m4/write.m4
 
 Depends-on:
 unistd
-raise
+raise           [test $REPLACE_WRITE = 1]
 
 configure.ac:
 gl_FUNC_WRITE
index 43ee942..0edcfc6 100644 (file)
@@ -9,6 +9,7 @@ m4/xalloc.m4
 Depends-on:
 inline
 xalloc-die
+xalloc-oversized
 
 configure.ac:
 gl_XALLOC
diff --git a/modules/xalloc-oversized b/modules/xalloc-oversized
new file mode 100644 (file)
index 0000000..708c621
--- /dev/null
@@ -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
diff --git a/modules/xgetgroups b/modules/xgetgroups
new file mode 100644 (file)
index 0000000..6ae3614
--- /dev/null
@@ -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
index 29319f1..66c1c4c 100644 (file)
@@ -10,8 +10,8 @@ Depends-on:
 setenv
 unsetenv
 error
-exit
 gettext-h
+stdlib
 
 configure.ac:
 
index 3ce76a8..b48a4bb 100644 (file)
@@ -14,7 +14,7 @@ error
 getopt-gnu
 gettext-h
 intprops
-inttypes
+inttypes-incomplete
 
 configure.ac:
 gl_XSTRTOL
index 71c6516..9852d83 100644 (file)
@@ -167,7 +167,10 @@ else
     st_=$?
 
     # $re_shell_ works just fine.  Use it.
-    test $st_ = 10 && break
+    if test $st_ = 10; then
+      gl_set_x_corrupts_stderr_=false
+      break
+    fi
 
     # If this is our first marginally acceptable shell, remember it.
     if test "$st_:$marginal_" = 9: ; then
@@ -400,7 +403,7 @@ mktempd_ ()
 {
   case $# in
   2);;
-  *) fail_ "Usage: $ME DIR TEMPLATE";;
+  *) fail_ "Usage: mktempd_ DIR TEMPLATE";;
   esac
 
   destdir_=$1
diff --git a/tests/socket-client.h b/tests/socket-client.h
new file mode 100644 (file)
index 0000000..ac82463
--- /dev/null
@@ -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;
+}
diff --git a/tests/socket-server.h b/tests/socket-server.h
new file mode 100644 (file)
index 0000000..283ef2f
--- /dev/null
@@ -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;
+}
index 05f23eb..643a72f 100755 (executable)
@@ -25,4 +25,4 @@ if test -f t-atexit.tmp; then
   Exit 1
 fi
 
-exit 0
+Exit 0
index c99ffc1..85cbb5a 100644 (file)
@@ -38,7 +38,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print)
   int result;
 
   /* Solaris 8 is interesting - if the current process belongs to
-     multiple groups, the current directory is owned by 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,
diff --git a/tests/test-fclose.c b/tests/test-fclose.c
new file mode 100644 (file)
index 0000000..a11eca9
--- /dev/null
@@ -0,0 +1,90 @@
+/* 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);
+
+  /* Likewise for an input stream.  */
+  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);
+
+  /* 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;
+}
index dd20fbb..648701e 100644 (file)
@@ -29,10 +29,88 @@ int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK
 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;
 }
index 3c36ed9..a6c0e18 100644 (file)
@@ -50,7 +50,8 @@ main (void)
   if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5)
     {
       fputs ("Failed initial read of sample file.\n", stderr);
-      fclose (f);
+      if (f)
+        fclose (f);
       unlink ("test-fflush.txt");
       return 1;
     }
index 66f9b1c..71664a8 100644 (file)
@@ -46,5 +46,11 @@ main ()
   ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", 0) == 0);
   ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", FNM_NOESCAPE) == FNM_NOMATCH);
 
+  /* Verify that an unmatched [ is treated as a literal, as POSIX
+     requires.  This test ensures that glibc Bugzilla bug #12378 stays
+     fixed.
+   */
+  ASSERT (res = fnmatch ("[/b", "[/b", 0) == 0);
+
   return 0;
 }
index 4826989..d2984e2 100644 (file)
@@ -107,7 +107,7 @@ simple (char const *host, char const *service)
 #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;
     }
diff --git a/tests/test-getcwd-lgpl.c b/tests/test-getcwd-lgpl.c
new file mode 100644 (file)
index 0000000..69a7b90
--- /dev/null
@@ -0,0 +1,102 @@
+/* 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++)
+      {
+        char *tmp;
+        errno = 0;
+        ASSERT (getcwd (pwd2, i) == NULL);
+        ASSERT (errno == ERANGE);
+        /* Allow either glibc or BSD behavior, since POSIX allows both.  */
+        errno = 0;
+        tmp = getcwd (NULL, i);
+        if (tmp)
+          {
+            ASSERT (strcmp (pwd1, tmp) == 0);
+            free (tmp);
+          }
+        else
+          {
+            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);
+
+  /* Validate a POSIX requirement on size.  */
+  errno = 0;
+  ASSERT (getcwd(pwd2, 0) == NULL);
+  ASSERT (errno == EINVAL);
+
+  free (pwd1);
+  free (pwd2);
+
+  return 0;
+}
index 18fc74f..14a526f 100644 (file)
 
 #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"
 
-int
-main (int argc, char **argv)
+#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 *pwd1;
-  char *pwd2;
-  /* If the user provides an argument, attempt to chdir there first.  */
-  if (1 < argc)
+  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 (chdir (argv[1]) == 0)
-        printf ("changed to directory %s\n", argv[1]);
+      if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0)
+        {
+          fail = 3; /* Unable to construct deep hierarchy.  */
+          break;
+        }
     }
 
-  pwd1 = getcwd (NULL, 0);
-  ASSERT (pwd1 && *pwd1);
-  if (1 < argc)
-    printf ("cwd=%s\n", pwd1);
+  /* 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;
+            }
+        }
 
-  /* Make sure the result is usable.  */
-  ASSERT (chdir (pwd1) == 0);
-  ASSERT (chdir ("././.") == 0);
+      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;
+                }
+            }
+        }
 
-  /* Make sure that result is normalized.  */
-  pwd2 = getcwd (NULL, 0);
-  ASSERT (pwd2);
-  ASSERT (strcmp (pwd1, pwd2) == 0);
-  free (pwd2);
+      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 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';
+    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;
+      }
   }
-  ASSERT (strstr (pwd2, "/./") == NULL);
-  ASSERT (strstr (pwd2, "/../") == NULL);
 
-  free (pwd1);
-  free (pwd2);
+  return fail;
+#endif
+}
 
-  return 0;
+int
+main (int argc, char **argv)
+{
+  return test_abort_bug () + test_long_name ();
 }
index 108daef..4a8a3be 100644 (file)
@@ -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 @@ main (int argc, char **argv)
       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 @@ main (int argc, char **argv)
       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 @@ main (int argc, char **argv)
               {
                 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;
 
diff --git a/tests/test-intprops.c b/tests/test-intprops.c
new file mode 100644 (file)
index 0000000..5779482
--- /dev/null
@@ -0,0 +1,259 @@
+/* Test intprops.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 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.  */
+
+/* Tell gcc not to warn about the many (X < 0) expressions that
+   the overflow macros expand to.  */
+#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
+#include <config.h>
+
+#include "intprops.h"
+#include "verify.h"
+
+#include <stdbool.h>
+#include <inttypes.h>
+
+/* TYPE_IS_INTEGER.  */
+verify (TYPE_IS_INTEGER (bool));
+verify (TYPE_IS_INTEGER (char));
+verify (TYPE_IS_INTEGER (signed char));
+verify (TYPE_IS_INTEGER (unsigned char));
+verify (TYPE_IS_INTEGER (short int));
+verify (TYPE_IS_INTEGER (unsigned short int));
+verify (TYPE_IS_INTEGER (int));
+verify (TYPE_IS_INTEGER (unsigned int));
+verify (TYPE_IS_INTEGER (long int));
+verify (TYPE_IS_INTEGER (unsigned long int));
+verify (TYPE_IS_INTEGER (intmax_t));
+verify (TYPE_IS_INTEGER (uintmax_t));
+verify (! TYPE_IS_INTEGER (float));
+verify (! TYPE_IS_INTEGER (double));
+verify (! TYPE_IS_INTEGER (long double));
+
+/* Integer representation.  */
+verify (INT_MIN + INT_MAX < 0
+        ? (TYPE_TWOS_COMPLEMENT (int)
+           && ! TYPE_ONES_COMPLEMENT (int) && ! TYPE_SIGNED_MAGNITUDE (int))
+        : (! TYPE_TWOS_COMPLEMENT (int)
+           && (TYPE_ONES_COMPLEMENT (int) || TYPE_SIGNED_MAGNITUDE (int))));
+
+/* TYPE_SIGNED.  */
+/* verify (! TYPE_SIGNED (bool)); */ /* not guaranteed by gnulib substitute */
+verify (TYPE_SIGNED (signed char));
+verify (! TYPE_SIGNED (unsigned char));
+verify (TYPE_SIGNED (short int));
+verify (! TYPE_SIGNED (unsigned short int));
+verify (TYPE_SIGNED (int));
+verify (! TYPE_SIGNED (unsigned int));
+verify (TYPE_SIGNED (long int));
+verify (! TYPE_SIGNED (unsigned long int));
+verify (TYPE_SIGNED (intmax_t));
+verify (! TYPE_SIGNED (uintmax_t));
+verify (TYPE_SIGNED (float));
+verify (TYPE_SIGNED (double));
+verify (TYPE_SIGNED (long double));
+
+/* TYPE_MINIMUM, TYPE_MAXIMUM.  */
+verify (TYPE_MINIMUM (char) == CHAR_MIN);
+verify (TYPE_MAXIMUM (char) == CHAR_MAX);
+verify (TYPE_MINIMUM (unsigned char) == 0);
+verify (TYPE_MAXIMUM (unsigned char) == UCHAR_MAX);
+verify (TYPE_MINIMUM (signed char) == SCHAR_MIN);
+verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
+verify (TYPE_MINIMUM (short int) == SHRT_MIN);
+verify (TYPE_MAXIMUM (short int) == SHRT_MAX);
+verify (TYPE_MINIMUM (unsigned short int) == 0);
+verify (TYPE_MAXIMUM (unsigned short int) == USHRT_MAX);
+verify (TYPE_MINIMUM (int) == INT_MIN);
+verify (TYPE_MAXIMUM (int) == INT_MAX);
+verify (TYPE_MINIMUM (unsigned int) == 0);
+verify (TYPE_MAXIMUM (unsigned int) == UINT_MAX);
+verify (TYPE_MINIMUM (long int) == LONG_MIN);
+verify (TYPE_MAXIMUM (long int) == LONG_MAX);
+verify (TYPE_MINIMUM (unsigned long int) == 0);
+verify (TYPE_MAXIMUM (unsigned long int) == ULONG_MAX);
+verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN);
+verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX);
+verify (TYPE_MINIMUM (uintmax_t) == 0);
+verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX);
+
+/* INT_BITS_STRLEN_BOUND.  */
+verify (INT_BITS_STRLEN_BOUND (1) == 1);
+verify (INT_BITS_STRLEN_BOUND (2620) == 789);
+
+/* INT_STRLEN_BOUND, INT_BUFSIZE_BOUND.  */
+#ifdef INT32_MAX /* POSIX guarantees int32_t; this ports to non-POSIX hosts */
+verify (INT_STRLEN_BOUND (int32_t) == sizeof ("-2147483648") - 1);
+verify (INT_BUFSIZE_BOUND (int32_t) == sizeof ("-2147483648"));
+#endif
+#ifdef INT64_MAX
+verify (INT_STRLEN_BOUND (int64_t) == sizeof ("-9223372036854775808") - 1);
+verify (INT_BUFSIZE_BOUND (int64_t) == sizeof ("-9223372036854775808"));
+#endif
+
+/* All the INT_<op>_RANGE_OVERFLOW tests are equally valid as
+   INT_<op>_OVERFLOW tests, so define a single macro to do both.  */
+#define check_binop(op, a, b, min, max, overflow)                      \
+  (INT_##op##_RANGE_OVERFLOW (a, b, min, max) == (overflow)            \
+   && INT_##op##_OVERFLOW (a, b) == (overflow))
+#define check_unop(op, a, min, max, overflow)                          \
+  (INT_##op##_RANGE_OVERFLOW (a, min, max) == (overflow)               \
+   && INT_##op##_OVERFLOW (a) == (overflow))
+
+/* INT_<op>_RANGE_OVERFLOW, INT_<op>_OVERFLOW.  */
+verify (INT_ADD_RANGE_OVERFLOW (INT_MAX, 1, INT_MIN, INT_MAX));
+verify (INT_ADD_OVERFLOW (INT_MAX, 1));
+verify (check_binop (ADD, INT_MAX, 1, INT_MIN, INT_MAX, true));
+verify (check_binop (ADD, INT_MAX, -1, INT_MIN, INT_MAX, false));
+verify (check_binop (ADD, INT_MIN, 1, INT_MIN, INT_MAX, false));
+verify (check_binop (ADD, INT_MIN, -1, INT_MIN, INT_MAX, true));
+verify (check_binop (ADD, UINT_MAX, 1u, 0u, UINT_MAX, true));
+verify (check_binop (ADD, 0u, 1u, 0u, UINT_MAX, false));
+
+verify (check_binop (SUBTRACT, INT_MAX, 1, INT_MIN, INT_MAX, false));
+verify (check_binop (SUBTRACT, INT_MAX, -1, INT_MIN, INT_MAX, true));
+verify (check_binop (SUBTRACT, INT_MIN, 1, INT_MIN, INT_MAX, true));
+verify (check_binop (SUBTRACT, INT_MIN, -1, INT_MIN, INT_MAX, false));
+verify (check_binop (SUBTRACT, UINT_MAX, 1u, 0u, UINT_MAX, false));
+verify (check_binop (SUBTRACT, 0u, 1u, 0u, UINT_MAX, true));
+
+verify (check_unop (NEGATE, INT_MIN, INT_MIN, INT_MAX,
+                    TYPE_TWOS_COMPLEMENT (int)));
+verify (check_unop (NEGATE, 0, INT_MIN, INT_MAX, false));
+verify (check_unop (NEGATE, INT_MAX, INT_MIN, INT_MAX, false));
+verify (check_unop (NEGATE, 0u, 0u, UINT_MAX, false));
+verify (check_unop (NEGATE, 1u, 0u, UINT_MAX, true));
+verify (check_unop (NEGATE, UINT_MAX, 0u, UINT_MAX, true));
+
+verify (check_binop (MULTIPLY, INT_MAX, INT_MAX, INT_MIN, INT_MAX, true));
+verify (check_binop (MULTIPLY, INT_MAX, INT_MIN, INT_MIN, INT_MAX, true));
+verify (check_binop (MULTIPLY, INT_MIN, INT_MAX, INT_MIN, INT_MAX, true));
+verify (check_binop (MULTIPLY, INT_MIN, INT_MIN, INT_MIN, INT_MAX, true));
+verify (check_binop (MULTIPLY, -1, INT_MIN, INT_MIN, INT_MAX,
+                     INT_NEGATE_OVERFLOW (INT_MIN)));
+verify (check_binop (MULTIPLY, LONG_MIN / INT_MAX, (long int) INT_MAX,
+                     LONG_MIN, LONG_MIN, false));
+
+verify (check_binop (DIVIDE, INT_MIN, -1, INT_MIN, INT_MAX,
+                     INT_NEGATE_OVERFLOW (INT_MIN)));
+verify (check_binop (DIVIDE, INT_MAX, 1, INT_MIN, INT_MAX, false));
+verify (check_binop (DIVIDE, (unsigned int) INT_MIN,
+                     -1u, 0u, UINT_MAX, false));
+
+verify (check_binop (REMAINDER, INT_MIN, -1, INT_MIN, INT_MAX,
+                     INT_NEGATE_OVERFLOW (INT_MIN)));
+verify (check_binop (REMAINDER, INT_MAX, 1, INT_MIN, INT_MAX, false));
+verify (check_binop (REMAINDER, (unsigned int) INT_MIN,
+                     -1u, 0u, UINT_MAX, false));
+
+verify (check_binop (LEFT_SHIFT, UINT_MAX, 1, 0u, UINT_MAX, true));
+verify (check_binop (LEFT_SHIFT, UINT_MAX / 2 + 1, 1, 0u, UINT_MAX, true));
+verify (check_binop (LEFT_SHIFT, UINT_MAX / 2, 1, 0u, UINT_MAX, false));
+
+/* INT_<op>_OVERFLOW with mixed types.  */
+#define check_sum(a, b, overflow)                       \
+  verify (INT_ADD_OVERFLOW (a, b) == (overflow));       \
+  verify (INT_ADD_OVERFLOW (b, a) == (overflow))
+check_sum (-1, LONG_MIN, true);
+check_sum (-1, UINT_MAX, false);
+check_sum (-1L, INT_MIN, INT_MIN == LONG_MIN);
+check_sum (0u, -1, true);
+check_sum (0u, 0, false);
+check_sum (0u, 1, false);
+check_sum (1, LONG_MAX, true);
+check_sum (1, UINT_MAX, true);
+check_sum (1L, INT_MAX, INT_MAX == LONG_MAX);
+check_sum (1u, INT_MAX, INT_MAX == UINT_MAX);
+check_sum (1u, INT_MIN, true);
+
+verify (! INT_SUBTRACT_OVERFLOW (INT_MAX, 1u));
+verify (! INT_SUBTRACT_OVERFLOW (UINT_MAX, 1));
+verify (! INT_SUBTRACT_OVERFLOW (0u, -1));
+verify (INT_SUBTRACT_OVERFLOW (UINT_MAX, -1));
+verify (INT_SUBTRACT_OVERFLOW (INT_MIN, 1u));
+verify (INT_SUBTRACT_OVERFLOW (-1, 0u));
+
+#define check_product(a, b, overflow)                   \
+  verify (INT_MULTIPLY_OVERFLOW (a, b) == (overflow));   \
+  verify (INT_MULTIPLY_OVERFLOW (b, a) == (overflow))
+
+check_product (-1, 1u, true);
+check_product (-1, INT_MIN, INT_NEGATE_OVERFLOW (INT_MIN));
+check_product (-1, UINT_MAX, true);
+check_product (-12345, LONG_MAX / -12345 - 1, true);
+check_product (-12345, LONG_MAX / -12345, false);
+check_product (0, -1, false);
+check_product (0, 0, false);
+check_product (0, 0u, false);
+check_product (0, 1, false);
+check_product (0, INT_MAX, false);
+check_product (0, INT_MIN, false);
+check_product (0, UINT_MAX, false);
+check_product (0u, -1, false);
+check_product (0u, 0, false);
+check_product (0u, 0u, false);
+check_product (0u, 1, false);
+check_product (0u, INT_MAX, false);
+check_product (0u, INT_MIN, false);
+check_product (0u, UINT_MAX, false);
+check_product (1, INT_MAX, false);
+check_product (1, INT_MIN, false);
+check_product (1, UINT_MAX, false);
+check_product (1u, INT_MIN, true);
+check_product (1u, INT_MAX, UINT_MAX < INT_MAX);
+check_product (INT_MAX, UINT_MAX, true);
+check_product (INT_MAX, ULONG_MAX, true);
+check_product (INT_MIN, LONG_MAX / INT_MIN - 1, true);
+check_product (INT_MIN, LONG_MAX / INT_MIN, false);
+check_product (INT_MIN, UINT_MAX, true);
+check_product (INT_MIN, ULONG_MAX, true);
+
+verify (INT_DIVIDE_OVERFLOW (INT_MIN, -1L)
+        == (TYPE_TWOS_COMPLEMENT (long int) && INT_MIN == LONG_MIN));
+verify (! INT_DIVIDE_OVERFLOW (INT_MIN, UINT_MAX));
+verify (! INT_DIVIDE_OVERFLOW (INTMAX_MIN, UINTMAX_MAX));
+verify (! INT_DIVIDE_OVERFLOW (INTMAX_MIN, UINT_MAX));
+verify (INT_DIVIDE_OVERFLOW (-11, 10u));
+verify (INT_DIVIDE_OVERFLOW (-10, 10u));
+verify (! INT_DIVIDE_OVERFLOW (-9, 10u));
+verify (INT_DIVIDE_OVERFLOW (11u, -10));
+verify (INT_DIVIDE_OVERFLOW (10u, -10));
+verify (! INT_DIVIDE_OVERFLOW (9u, -10));
+
+verify (INT_REMAINDER_OVERFLOW (INT_MIN, -1L)
+        == (TYPE_TWOS_COMPLEMENT (long int) && INT_MIN == LONG_MIN));
+verify (INT_REMAINDER_OVERFLOW (-1, UINT_MAX));
+verify (INT_REMAINDER_OVERFLOW ((intmax_t) -1, UINTMAX_MAX));
+verify (INT_REMAINDER_OVERFLOW (INTMAX_MIN, UINT_MAX)
+        == (INTMAX_MAX < UINT_MAX
+            && - (unsigned int) INTMAX_MIN % UINT_MAX != 0));
+verify (INT_REMAINDER_OVERFLOW (INT_MIN, ULONG_MAX)
+        == (INT_MIN % ULONG_MAX != 1));
+verify (! INT_REMAINDER_OVERFLOW (1u, -1));
+verify (! INT_REMAINDER_OVERFLOW (37*39u, -39));
+verify (INT_REMAINDER_OVERFLOW (37*39u + 1, -39));
+verify (INT_REMAINDER_OVERFLOW (37*39u - 1, -39));
+verify (! INT_REMAINDER_OVERFLOW (LONG_MAX, -INT_MAX));
+
+int
+main (void)
+{
+  return 0;
+}
index 9bed25e..cd8ed4e 100644 (file)
@@ -32,7 +32,7 @@
 #define CAST_VAL(T,V) (TYPE_SIGNED (T) ? (intmax_t) (V) : (uintmax_t) (V))
 #define V_min(T) (CAST_VAL (T, TYPE_MINIMUM (T)))
 #define V_max(T) (CAST_VAL (T, TYPE_MAXIMUM (T)))
-#define IS_TIGHT(T) (signed_type_or_expr__(T) == TYPE_SIGNED (T))
+#define IS_TIGHT(T) (_GL_SIGNED_TYPE_OR_EXPR (T) == TYPE_SIGNED (T))
 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
 
 /* Verify that an inttostr function works as advertised.
index aa10674..229ed6b 100644 (file)
@@ -46,7 +46,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
   int result;
 
   /* Solaris 8 is interesting - if the current process belongs to
-     multiple groups, the current directory is owned by 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,
index 8d179e2..2bf1790 100644 (file)
@@ -34,7 +34,6 @@ SIGNATURE_CHECK (linkat, int, (int, char const *, int, char const *, int));
 #include "areadlink.h"
 #include "filenamecat.h"
 #include "same-inode.h"
-#include "xgetcwd.h"
 #include "ignore-value.h"
 #include "macros.h"
 
@@ -119,7 +118,8 @@ main (void)
   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 @@ main (void)
   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);
diff --git a/tests/test-netdb-c++.cc b/tests/test-netdb-c++.cc
new file mode 100644 (file)
index 0000000..0dc47b9
--- /dev/null
@@ -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 ()
+{
+}
diff --git a/tests/test-nonblocking-misc.h b/tests/test-nonblocking-misc.h
new file mode 100644 (file)
index 0000000..66a13e4
--- /dev/null
@@ -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;
diff --git a/tests/test-nonblocking-pipe-child.c b/tests/test-nonblocking-pipe-child.c
new file mode 100644 (file)
index 0000000..d12a6e0
--- /dev/null
@@ -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;
+}
diff --git a/tests/test-nonblocking-pipe-main.c b/tests/test-nonblocking-pipe-main.c
new file mode 100644 (file)
index 0000000..e61269c
--- /dev/null
@@ -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;
+}
diff --git a/tests/test-nonblocking-pipe.h b/tests/test-nonblocking-pipe.h
new file mode 100644 (file)
index 0000000..c4e6561
--- /dev/null
@@ -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
diff --git a/tests/test-nonblocking-pipe.sh b/tests/test-nonblocking-pipe.sh
new file mode 100755 (executable)
index 0000000..dd692be
--- /dev/null
@@ -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
diff --git a/tests/test-nonblocking-reader.h b/tests/test-nonblocking-reader.h
new file mode 100644 (file)
index 0000000..220862f
--- /dev/null
@@ -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);
+}
diff --git a/tests/test-nonblocking-socket-child.c b/tests/test-nonblocking-socket-child.c
new file mode 100644 (file)
index 0000000..17545cf
--- /dev/null
@@ -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;
+}
diff --git a/tests/test-nonblocking-socket-main.c b/tests/test-nonblocking-socket-main.c
new file mode 100644 (file)
index 0000000..034873d
--- /dev/null
@@ -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;
+}
diff --git a/tests/test-nonblocking-socket.h b/tests/test-nonblocking-socket.h
new file mode 100644 (file)
index 0000000..5f2268d
--- /dev/null
@@ -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
diff --git a/tests/test-nonblocking-socket.sh b/tests/test-nonblocking-socket.sh
new file mode 100755 (executable)
index 0000000..3818c93
--- /dev/null
@@ -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
diff --git a/tests/test-nonblocking-writer.h b/tests/test-nonblocking-writer.h
new file mode 100644 (file)
index 0000000..6db53f6
--- /dev/null
@@ -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;
+}
index f1b7610..f3f1f13 100644 (file)
@@ -33,13 +33,6 @@ main (void)
   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 @@ main (void)
   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 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 */
+#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
+
+    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.  */
   {
index 3e5c5e1..2ba5d13 100644 (file)
@@ -63,6 +63,12 @@ test_open (int (*func) (char const *, int, ...), bool print)
   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)
     {
index d657ad9..315e6c2 100644 (file)
@@ -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 @@ main ()
   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 @@ main ()
         }
       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
 }
index ddfb819..d83162c 100644 (file)
@@ -33,6 +33,9 @@ SIGNATURE_CHECK (pipe2, int, (int[2], int));
 
 #include "binary-io.h"
 #include "macros.h"
+#if GNULIB_NONBLOCKING
+# include "nonblocking.h"
+#endif
 
 /* Return true if FD is open.  */
 static bool
@@ -67,19 +70,22 @@ is_cloexec (int fd)
 #endif
 }
 
-/* Return true if FD is in non-blocking mode.  */
-static bool
-is_nonblocking (int fd)
+#if ! GNULIB_NONBLOCKING
+static int
+get_nonblocking_flag (int fd)
 {
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  /* We don't use the non-blocking mode for sockets here.  */
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
   return 0;
-#else
+# else
+#  ifndef F_GETFL
+#   error Please port fcntl to your platform
+#  endif
   int flags;
   ASSERT ((flags = fcntl (fd, F_GETFL)) >= 0);
   return (flags & O_NONBLOCK) != 0;
-#endif
+# endif
 }
+#endif
 
 int
 main ()
@@ -87,29 +93,17 @@ 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_nonblocking = 0; use_nonblocking <= !!O_NONBLOCK; use_nonblocking++)
+    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 +125,17 @@ main ()
           }
         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;
index 1849a24..96fe3a7 100644 (file)
@@ -33,7 +33,6 @@ SIGNATURE_CHECK (renameat, int, (int, char const *, int, char const *));
 #include <sys/stat.h>
 
 #include "filenamecat.h"
-#include "xgetcwd.h"
 #include "ignore-value.h"
 #include "macros.h"
 
@@ -79,7 +78,8 @@ main (void)
   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);
index 757d030..476b307 100644 (file)
@@ -66,7 +66,8 @@ test_rmdir_func (int (*func) (char const *name), bool print)
   ASSERT (unlink (BASE "dir/file") == 0);
   errno = 0;
   ASSERT (func (BASE "dir/.//") == -1);
-  ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST);
+  ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
+          || errno == ENOTEMPTY);
   ASSERT (func (BASE "dir") == 0);
 
   /* Test symlink behavior.  Specifying trailing slash should remove
index 23a777e..0f777b5 100644 (file)
@@ -24,7 +24,7 @@
 #include <string.h>
 #include <sys/stat.h>
 
-#if HAVE_ACL_GET_FILE || HAVE_FACL || HAVE_ACLX_GET || HAVE_STATACL || HAVE_ACLSORT
+#if HAVE_ACL_GET_FILE || HAVE_FACL || HAVE_GETACL || HAVE_ACLX_GET || HAVE_STATACL || HAVE_ACLSORT
 # include <sys/types.h>
 # include <sys/acl.h>
 #endif
@@ -430,11 +430,13 @@ main (int argc, char *argv[])
   size_t aclsize1 = sizeof (acl1);
   mode_t mode1;
   char text1[1000];
+  size_t textsize1 = sizeof (text1);
   acl_type_t type2;
   char acl2[1000];
   size_t aclsize2 = sizeof (acl2);
   mode_t mode2;
   char text2[1000];
+  size_t textsize2 = sizeof (text2);
 
   /* The docs say that type1 being 0 is equivalent to ACL_ANY, but it is not
      true, in AIX 5.3.  */
@@ -445,7 +447,7 @@ main (int argc, char *argv[])
       fflush (stderr);
       abort ();
     }
-  if (aclx_printStr (text1, sizeof (text1), acl1, aclsize1, type1, file1, 0) < 0)
+  if (aclx_printStr (text1, &textsize1, acl1, aclsize1, type1, file1, 0) < 0)
     {
       fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file1);
       fflush (stderr);
@@ -461,7 +463,7 @@ main (int argc, char *argv[])
       fflush (stderr);
       abort ();
     }
-  if (aclx_printStr (text2, sizeof (text2), acl2, aclsize2, type2, file2, 0) < 0)
+  if (aclx_printStr (text2, &textsize2, acl2, aclsize2, type2, file2, 0) < 0)
     {
       fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file2);
       fflush (stderr);
index a9d00a3..07faf0f 100644 (file)
@@ -36,6 +36,14 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::fclose, int, (FILE *));
 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::fputc, int, (int, FILE *));
 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 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::fwrite, size_t,
                  (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 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::getline, ssize_t,
                  (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 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::renameat, int,
                  (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 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::vfprintf, int,
                  (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));
index 8f323ca..a6e99d6 100644 (file)
@@ -30,6 +30,12 @@ int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
 /* 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 @@ main (void)
 
   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);
 }
diff --git a/tests/test-sys_uio.c b/tests/test-sys_uio.c
new file mode 100644 (file)
index 0000000..7855a6b
--- /dev/null
@@ -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;
+}
index c63cf3d..12e415b 100644 (file)
@@ -112,6 +112,10 @@ SIGNATURE_CHECK (GNULIB_NAMESPACE::setusershell, void, (void));
 SIGNATURE_CHECK (GNULIB_NAMESPACE::endusershell, void, (void));
 #endif
 
+#if GNULIB_TEST_GROUP_MEMBER
+SIGNATURE_CHECK (GNULIB_NAMESPACE::group_member, int, (gid_t));
+#endif
+
 #if GNULIB_TEST_LCHOWN
 SIGNATURE_CHECK (GNULIB_NAMESPACE::lchown, int, (char const *, uid_t, gid_t));
 #endif
diff --git a/top/README-release b/top/README-release
new file mode 100644 (file)
index 0000000..69841d2
--- /dev/null
@@ -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
index 693e5ab..c838516 100644 (file)
@@ -33,7 +33,6 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
 
 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)
 
@@ -569,6 +568,16 @@ sc_prohibit_signal_without_use:
        re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>'          \
          $(_sc_header_without_use)
 
+# Don't include stdio--.h unless you use one of its functions.
+sc_prohibit_stdio--_without_use:
+       @h='"stdio--.h"' re='\<((f(re)?|p)open|tmpfile) *\('    \
+         $(_sc_header_without_use)
+
+# Don't include stdio-safer.h unless you use one of its functions.
+sc_prohibit_stdio-safer_without_use:
+       @h='"stdio-safer.h"' re='\<((f(re)?|p)open|tmpfile)_safer *\('  \
+         $(_sc_header_without_use)
+
 # Prohibit the inclusion of strings.h without a sensible use.
 # Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible.
 sc_prohibit_strings_without_use:
@@ -596,6 +605,10 @@ sc_prohibit_stddef_without_use:
        re='\<($(_stddef_syms_re)) *\('                                 \
          $(_sc_header_without_use)
 
+# Don't include xfreopen.h unless you use one of its functions.
+sc_prohibit_xfreopen_without_use:
+       @h='"xfreopen.h"' re='\<xfreopen *\(' $(_sc_header_without_use)
+
 sc_obsolete_symbols:
        @prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>'                     \
        halt='do not use HAVE''_FCNTL_H or O'_NDELAY                    \
@@ -647,12 +660,6 @@ sc_require_test_exit_idiom:
              exit 1; } || :;                                           \
        fi
 
-sc_the_the:
-       @prohibit='\<the ''the\>'                                       \
-       ignore_case=1                                                   \
-       halt='found use of "the ''the";'                                \
-         $(_sc_search_regexp)
-
 sc_trailing_blank:
        @prohibit='[     ]$$'                                           \
        halt='found trailing blank(s)'                                  \
@@ -824,7 +831,7 @@ require_exactly_one_NL_at_EOF_ =                                    \
 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; } || :;                                   \
+               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 +848,50 @@ sc_prohibit_S_IS_definition:
        halt='do not define S_IS* macros; include <sys/stat.h>'         \
          $(_sc_search_regexp)
 
+# Perl block to convert a match to FILE_NAME:LINENO:TEST,
+# that is shared by two definitions below.
+perl_filename_lineno_text_ =                                           \
+    -e '  {'                                                           \
+    -e '    $$n = ($$` =~ tr/\n/\n/ + 1);'                             \
+    -e '    ($$v = $$&) =~ s/\n/\\n/g;'                                        \
+    -e '    print "$$ARGV:$$n:$$v\n";'                                 \
+    -e '  }'
+
+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_))'                          \
+    $(perl_filename_lineno_text_)
+
+# 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; } || :
+
+# A regular expression matching undesirable combinations of words like
+# "can not"; this matches them even when the two words appear on different
+# lines, but not when there is an intervening delimiter like "#" or "*".
+prohibit_undesirable_word_seq_RE_ ?=                                   \
+  /\bcan\s+not\b/gims
+prohibit_undesirable_word_seq_ =                                       \
+    -e 'while ($(prohibit_undesirable_word_seq_RE_))'                  \
+    $(perl_filename_lineno_text_)
+# 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_undesirable_word_sequence_RE_ ?= ^$$
+
+sc_prohibit_undesirable_word_seq:
+       @perl -n -0777 $(prohibit_undesirable_word_seq_)                \
+            $$($(VC_LIST_EXCEPT))                                      \
+         | grep -vE '$(ignore_undesirable_word_sequence_RE_)' | grep . \
+         && { echo '$(ME): undesirable word sequence' >&2; exit 1; } || :
+
 _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 +968,23 @@ update-NEWS-hash: NEWS
 # 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
@@ -956,12 +1014,13 @@ apply the above patch\n'
 
 # Verify that all source files using _() are listed in po/POTFILES.in.
 po_file ?= $(srcdir)/po/POTFILES.in
+generated_files ?= $(srcdir)/lib/*.[ch]
 sc_po_check:
        @if test -f $(po_file); then                                    \
          grep -E -v '^(#|$$)' $(po_file)                               \
            | grep -v '^src/false\.c$$' | sort > $@-1;                  \
          files=;                                                       \
-         for file in $$($(VC_LIST_EXCEPT)) $(srcdir)/lib/*.[ch]; do    \
+         for file in $$($(VC_LIST_EXCEPT)) $(generated_files); do      \
            test -r $$file || continue;                                 \
            case $$file in                                              \
              *.m4|*.mk) continue ;;                                    \
@@ -1092,11 +1151,20 @@ gpg_key_ID ?= \
          | 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                                      \
@@ -1197,7 +1265,7 @@ gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?]
 release-prep:
        case $$RELEASE_TYPE in alpha|beta|stable) ;; \
          *) echo "invalid RELEASE_TYPE: $$RELEASE_TYPE" 1>&2; exit 1;; esac
-       $(MAKE) -s announcement > ~/announce-$(my_distdir)
+       $(MAKE) --no-print-directory -s announcement > ~/announce-$(my_distdir)
        if test -d $(release_archive_dir); then                 \
          ln $(rel-files) $(release_archive_dir);               \
          chmod a-w $(rel-files);                               \
@@ -1284,3 +1352,77 @@ update-copyright:
        grep -l -w Copyright                                             \
          $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \
          | $(update-copyright-env) xargs $(build_aux)/$@
+
+# NOTE: This test is silently skipped if $(_gl_TS_dir)/Makefile.am
+# does not mention noinst_HEADERS.
+# NOTE: to override these _gl_TS_* default values, you must
+# define the variable(s) using "export" in cfg.mk.
+_gl_TS_dir ?= src
+ALL_RECURSIVE_TARGETS += sc_tight_scope
+sc_tight_scope: tight-scope.mk
+       @grep noinst_HEADERS $(_gl_TS_dir)/Makefile.am > /dev/null 2>&1 \
+         && $(MAKE) -s -C $(_gl_TS_dir) -f Makefile                    \
+             -f '$(abs_srcdir)/tight-scope.mk' _gl_tight_scope         \
+         || :
+       @rm -f $<
+
+tight-scope.mk: $(ME)
+       @rm -f $@ $@-t
+       @perl -ne '/^# TS-start/.../^# TS-end/ and print' $(ME) > $@-t
+       @chmod a=r $@-t && mv $@-t $@
+
+ifeq (a,b)
+# TS-start
+# Most functions should have static scope.
+# Any that don't must be marked with `extern', but `main'
+# and `usage' are exceptions: they're always extern, but
+# do not need to be marked.  Symbols matching `__.*' are
+# reserved by the compiler, so are automatically excluded below.
+_gl_TS_unmarked_extern_functions ?= main usage
+_gl_TS_function_match ?= \
+  /^(?:extern|XTERN) +(?:void|(?:struct |const |enum )?\S+) +\**(\S+) +\(/
+
+# The second nm|grep checks for file-scope variables with `extern' scope.
+# Without gnulib's progname module, you might put program_name here.
+# Symbols matching `__.*' are reserved by the compiler,
+# so are automatically excluded below.
+_gl_TS_unmarked_extern_vars ?=
+
+# NOTE: the _match variables are perl expressions -- not mere regular
+# expressions -- so that you can extend them to match other patterns
+# and easily extract matched variable names.
+# For example, if your project declares some global variables via
+# a macro like this: GLOBAL(type, var_name, initializer), then you
+# can override this definition to automatically extract those names:
+# export _gl_TS_var_match = \
+#   /^(?:extern|XTERN) .*?\**(\w+)(\[.*?\])?;/ || /\bGLOBAL\(.*?,\s*(.*?),/
+_gl_TS_var_match ?= /^(?:extern|XTERN) .*?\**(\w+)(\[.*?\])?;/
+.PHONY: _gl_tight_scope
+_gl_tight_scope: $(bin_PROGRAMS)
+       t=exceptions-$$$$;                                              \
+       trap 's=$$?; rm -f $$t; exit $$s' 0;                            \
+       for sig in 1 2 3 13 15; do                                      \
+         eval "trap 'v=`expr $$sig + 128`; (exit $$v); exit $$v' $$sig"; \
+       done;                                                           \
+       src=`for f in $(SOURCES); do                                    \
+              test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`;   \
+       hdr=`for f in $(noinst_HEADERS); do                             \
+              test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`;   \
+       ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_functions);  \
+         grep -h -A1 '^extern .*[^;]$$' $$src                          \
+           | grep -vE '^(extern |--)' | sed 's/ .*//';                 \
+         perl -lne '$(_gl_TS_function_match)'                          \
+                 -e 'and print $$1' $$hdr;                             \
+       ) | sort -u | sed 's/^/^/;s/$$/$$/' > $$t;                      \
+       nm -e *.$(OBJEXT) | sed -n 's/.* T //p' | grep -Ev -f $$t       \
+         && { echo the above functions should have static scope >&2;   \
+              exit 1; } || : ;                                         \
+       ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_vars);       \
+         perl -lne '$(_gl_TS_var_match) and print "^$$1\$$"'           \
+           $$hdr *.h ) | sort -u > $$t;                                \
+       nm -e *.$(OBJEXT) | sed -n 's/.* [BCDGRS] //p'                  \
+            | sort -u | grep -Ev -f $$t                                        \
+         && { echo the above variables should have static scope >&2;   \
+              exit 1; } || :
+# TS-end
+endif
index 7151184..b56239f 100644 (file)
--- a/users.txt
+++ b/users.txt
@@ -7,6 +7,7 @@ The following packages appear to be using gnulib and gnulib-tool:
   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