diff options
author | Bruce Korb <bkorb@gnu.org> | 2011-05-06 08:15:59 -0700 |
---|---|---|
committer | Bruce Korb <bkorb@gnu.org> | 2011-05-06 08:15:59 -0700 |
commit | 10c1e9dc30730133dbb631c9be0a4e84ce0b0eaa (patch) | |
tree | c1ecc41b19fbec4e92c119d5cba945b8b91ac7d7 | |
parent | 9bccf2c3e4f68a37499615fddd51c727d6bb2624 (diff) | |
parent | d801cb77b966678e21af7a106b15a3fe598d5ec4 (diff) | |
download | gnulib-topic/libposix.tar.gz |
manual mergetopic/libposix
582 files changed, 8571 insertions, 2387 deletions
@@ -1,3 +1,1649 @@ +2011-05-06 Jim Meyering <meyering@redhat.com> + + maint.mk: use info-gnu@ as the default only for a stable release + * top/maint.mk: Don't default to info-gnu for alpha or beta releases. + For those, just use $(PACKAGE_BUGREPORT), in which case we don't have + to set the Mail-Followup-To header. Prompted by Reuben Thomas in + http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/26488 + +2011-05-05 Paul Eggert <eggert@cs.ucla.edu> + + assert-h: new module, which supports C1X-style static_assert + * lib/assert.in.h, m4/assert_h.m4, modules/assert-h: New files. + * lib/verify.h: Revamp so that this can be copied into assert.h, + while retaining the ability to use it standalone as before. + Rename private identifiers so as not to encroach on the + standard C namespace, since this is now used by assert.h. + (_GL_VERIFY_TYPE): New macro, factoring out differing parts of + the old verify_true. + (_GL_VERIFY_TRUE): New macro, with much of the contents of + the old verify_true. Use _GL_VERIFY_TYPE. + (_GL_VERIFY): New macro, with much of the contents of the old verify. + (static_assert): New macro, if _GL_STATIC_ASSERT_H + is defined and static_assert is not; _GL_STATIC_ASSERT_H is + defined when this file is copied into the replacement assert.h. + (_Static_assert): New macro, if _GL_STATIC_ASSERT_H is defined + and _Static_assert is not built in. + (verify_true, verify): Define only if _GL_STATIC_ASSERT_H is not + defined, and use the new macros mentioned above. + * doc/posix-headers/assert.texi: Document this. + +2011-05-05 Bruno Haible <bruno@clisp.org> + + fclose, fflush: Respect rules for use of AC_LIBOBJ. + * m4/fflush.m4 (gl_FUNC_FFLUSH): Don't invoke gl_REPLACE_FCLOSE. + * m4/fclose.m4 (gl_FUNC_FCLOSE): Invoke gl_FUNC_FFLUSH_STDIN and + gl_REPLACE_FCLOSE here. + * modules/fflush (Depends-on): Remove fclose. + * doc/posix-functions/fclose.texi: Mention module 'fflush' only in + combination with module 'fclose'. + +2011-05-05 Bruno Haible <bruno@clisp.org> + + fflush, fseeko: Respect rules for use of AC_LIBOBJ. + * m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): New macro, extracted from + gl_FUNC_FFLUSH. + (gl_FUNC_FFLUSH): Use it. + (gl_REPLACE_FFLUSH): Don't invoke gl_REPLACE_FSEEKO. + * m4/fseeko.m4 (gl_FUNC_FSEEKO): Invoke gl_FUNC_FFLUSH_STDIN and + gl_REPLACE_FSEEKO here. + +2011-05-05 Bruno Haible <bruno@clisp.org> + + tzset: Relicense under LGPL. + * modules/tzset (License): Change to LGPL. + No agreement needed; it's a no-op. + + strtoimax, strtoumax: Relicense under LGPL. + * modules/strtoimax (License): Change to LGPL. + * modules/strtoumax (License): Likewise. + With permission from Jim Meyering, Paul Eggert: + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00124.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00109.html> + + getgroups: Relicense under LGPL. + * modules/getgroups (License): Change to LGPL. + With permission from Jim Meyering, Paul Eggert, Eric Blake: + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00111.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00148.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00138.html> + + nanosleep: Relicense under LGPL. + * modules/nanosleep (License): Change to LGPL. + With permission from Jim Meyering, Paul Eggert, Eric Blake, Bruno + Haible: + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00111.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00148.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00138.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00131.html> + + futimens: Relicense under LGPL. + * modules/futimens (License): Change to LGPL. + With permission from Eric Blake: + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00138.html> + + fflush: Relicense under LGPL. + * modules/fflush (License): Change to LGPL. + With permission from Eric Blake, Bruno Haible, Jim Meyering: + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00138.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00131.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00133.html> + + tmpfile: Relicense under LGPL. + * modules/tmpfile (License): Change to LGPL. + With permission from Ben Pfaff: + <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00185.html> + + isfinite: Relicense under LGPL. + * modules/isfinite (License): Change to LGPL. + With permission from Ben Pfaff, Bruno Haible: + <http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00185.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00130.html> + + acosl..tanl: Relicense under LGPL. + * modules/acosl (License): Change to LGPL. + * modules/asinl (License): Likewise. + * modules/atanl (License): Likewise. + * modules/cosl (License): Likewise. + * modules/expl (License): Likewise. + * modules/logl (License): Likewise. + * modules/sinl (License): Likewise. + * modules/sqrtl (License): Likewise. + * modules/tanl (License): Likewise. + Source code originally from glibc and Paolo Bonzini. Agreements: + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00137.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00128.html> + +2011-05-05 Bruno Haible <bruno@clisp.org> + + signal: Define sighandler_t. + * lib/signal.in.h (sighandler_t): New type. + * m4/signal_h.m4 (gl_SIGNAL_H): Require AC_USE_SYSTEM_EXTENSIONS. Test + whether sighandler_t is defined. + (gl_SIGNAL_H_DEFAULTS): Initialize HAVE_SIGHANDLER_T. + * modules/signal (Depends-on): Add extensions. + (Makefile.am): Substitute HAVE_SIGHANDLER_T. + * doc/posix-headers/signal.texi: Mention the problem with sighandler_t. + Suggested by Markus Steinborn <gnugv_maintainer@yahoo.de>. + +2011-05-05 Eric Blake <eblake@redhat.com> + + maint: remove useless REPLACE_*_H macros + * m4/arpa_inet_h.m4 (gl_REPLACE_ARPA_INET_H): Delete. + * m4/dirent_h.m4 (gl_REPLACE_DIRENT_H): Likewise. + * m4/locale_h.m4 (gl_REPLACE_LOCALE_H): Likewise. + * m4/poll_h.m4 (gl_REPLACE_POLL_H): Likewise. + * m4/spawn_h.m4 (gl_REPLACE_SPAWN_H): Likewise. + * m4/sys_ioctl_h.m4 (gl_REPLACE_SYS_IOCTL_H): Likewise. + * m4/wchar_h.m4 (gl_REPLACE_WCHAR_H): Likewise. + * m4/btowc.m4: Update callers. + * m4/dirfd.m4: Likewise. + * m4/duplocale.m4: Likewise. + * m4/fchdir.m4: Likewise. + * m4/fdopendir.m4: Likewise. + * m4/inet_ntop.m4: Likewise. + * m4/inet_pton.m4: Likewise. + * m4/ioctl.m4: Likewise. + * m4/mbrlen.m4: Likewise. + * m4/mbrtowc.m4: Likewise. + * m4/mbsinit.m4: Likewise. + * m4/mbsnrtowcs.m4: Likewise. + * m4/mbsrtowcs.m4: Likewise. + * m4/poll.m4: Likewise. + * m4/setlocale.m4: Likewise. + * m4/wcrtomb.m4: Likewise. + * m4/wcsnrtombs.m4: Likewise. + * m4/wcsrtombs.m4: Likewise. + * m4/wctob.m4: Likewise. + * m4/wcwidth.m4: Likewise. + * modules/posix_spawn: Likewise. + * modules/posix_spawn_file_actions_addclose: Likewise. + * modules/posix_spawn_file_actions_adddup2: Likewise. + * modules/posix_spawn_file_actions_addopen: Likewise. + * modules/posix_spawn_file_actions_destroy: Likewise. + * modules/posix_spawn_file_actions_init: Likewise. + * modules/posix_spawnattr_destroy: Likewise. + * modules/posix_spawnattr_getflags: Likewise. + * modules/posix_spawnattr_getpgroup: Likewise. + * modules/posix_spawnattr_getschedparam: Likewise. + * modules/posix_spawnattr_getschedpolicy: Likewise. + * modules/posix_spawnattr_getsigdefault: Likewise. + * modules/posix_spawnattr_getsigmask: Likewise. + * modules/posix_spawnattr_init: Likewise. + * modules/posix_spawnattr_setflags: Likewise. + * modules/posix_spawnattr_setpgroup: Likewise. + * modules/posix_spawnattr_setschedparam: Likewise. + * modules/posix_spawnattr_setschedpolicy: Likewise. + * modules/posix_spawnattr_setsigdefault: Likewise. + * modules/posix_spawnattr_setsigmask: Likewise. + * modules/posix_spawnp: Likewise. + +2011-05-04 Reuben Thomas <rrt@sc3d.org> + + Add option to do-release-commit-and-tag to specify branch. + * build-aux/do-release-commit-and-tag: Add --branch. + +2011-05-03 Bruno Haible <bruno@clisp.org> + + Avoid unnecessary compilation units, through conditional dependencies. + * modules/accept (Depends-on): Add conditions to the dependencies. + * modules/acosl (Depends-on): Likewise. + * modules/argz (Depends-on): Likewise. + * modules/asinl (Depends-on): Likewise. + * modules/atanl (Depends-on): Likewise. + * modules/atoll (Depends-on): Likewise. + * modules/bind (Depends-on): Likewise. + * modules/btowc (Depends-on): Likewise. + * modules/canonicalize-lgpl (Depends-on): Likewise. + * modules/ceil (Depends-on): Likewise. + * modules/ceilf (Depends-on): Likewise. + * modules/ceill (Depends-on): Likewise. + * modules/chdir-long (Depends-on): Likewise. + * modules/chown (Depends-on): Likewise. + * modules/close (Depends-on): Likewise. + * modules/connect (Depends-on): Likewise. + * modules/cosl (Depends-on): Likewise. + * modules/dirfd (Depends-on): Likewise. + * modules/dprintf (Depends-on): Likewise. + * modules/dprintf-posix (Depends-on): Likewise. + * modules/error (Depends-on): Likewise. + * modules/euidaccess (Depends-on): Likewise. + * modules/expl (Depends-on): Likewise. + * modules/faccessat (Depends-on): Likewise. + * modules/fchdir (Depends-on): Likewise. + * modules/fclose (Depends-on): Likewise. + * modules/fcntl (Depends-on): Likewise. + * modules/fdopendir (Depends-on): Likewise. + * modules/fflush (Depends-on): Likewise. + * modules/floor (Depends-on): Likewise. + * modules/floorf (Depends-on): Likewise. + * modules/floorl (Depends-on): Likewise. + * modules/fnmatch (Depends-on): Likewise. + * modules/fopen (Depends-on): Likewise. + * modules/fprintf-posix (Depends-on): Likewise. + * modules/frexp (Depends-on): Likewise. + * modules/frexp-nolibm (Depends-on): Likewise. + * modules/frexpl (Depends-on): Likewise. + * modules/frexpl-nolibm (Depends-on): Likewise. + * modules/fseek (Depends-on): Likewise. + * modules/fsusage (Depends-on): Likewise. + * modules/ftell (Depends-on): Likewise. + * modules/ftello (Depends-on): Likewise. + * modules/futimens (Depends-on): Likewise. + * modules/getcwd (Depends-on): Likewise. + * modules/getcwd-lgpl (Depends-on): Likewise. + * modules/getdelim (Depends-on): Likewise. + * modules/getdomainname (Depends-on): Likewise. + * modules/getgroups (Depends-on): Likewise. + * modules/gethostname (Depends-on): Likewise. + * modules/getline (Depends-on): Likewise. + * modules/getlogin_r (Depends-on): Likewise. + * modules/getopt-posix (Depends-on): Likewise. + * modules/getpeername (Depends-on): Likewise. + * modules/getsockname (Depends-on): Likewise. + * modules/getsockopt (Depends-on): Likewise. + * modules/getsubopt (Depends-on): Likewise. + * modules/getusershell (Depends-on): Likewise. + * modules/glob (Depends-on): Likewise. + * modules/grantpt (Depends-on): Likewise. + * modules/iconv_open (Depends-on): Likewise. + * modules/iconv_open-utf (Depends-on): Likewise. + * modules/inet_ntop (Depends-on): Likewise. + * modules/inet_pton (Depends-on): Likewise. + * modules/ioctl (Depends-on): Likewise. + * modules/isapipe (Depends-on): Likewise. + * modules/isfinite (Depends-on): Likewise. + * modules/isinf (Depends-on): Likewise. + * modules/lchown (Depends-on): Likewise. + * modules/ldexpl (Depends-on): Likewise. + * modules/link (Depends-on): Likewise. + * modules/linkat (Depends-on): Likewise. + * modules/listen (Depends-on): Likewise. + * modules/logl (Depends-on): Likewise. + * modules/lstat (Depends-on): Likewise. + * modules/mbrlen (Depends-on): Likewise. + * modules/mbrtowc (Depends-on): Likewise. + * modules/mbsinit (Depends-on): Likewise. + * modules/mbsnrtowcs (Depends-on): Likewise. + * modules/mbsrtowcs (Depends-on): Likewise. + * modules/mbtowc (Depends-on): Likewise. + * modules/memcmp (Depends-on): Likewise. + * modules/mkdir (Depends-on): Likewise. + * modules/mkdtemp (Depends-on): Likewise. + * modules/mkfifo (Depends-on): Likewise. + * modules/mkfifoat (Depends-on): Likewise. + * modules/mknod (Depends-on): Likewise. + * modules/mkostemp (Depends-on): Likewise. + * modules/mkostemps (Depends-on): Likewise. + * modules/mkstemp (Depends-on): Likewise. + * modules/mkstemps (Depends-on): Likewise. + * modules/mktime (Depends-on): Likewise. + * modules/nanosleep (Depends-on): Likewise. + * modules/open (Depends-on): Likewise. + * modules/openat (Depends-on): Likewise. + * modules/perror (Depends-on): Likewise. + * modules/poll (Depends-on): Likewise. + * modules/popen (Depends-on): Likewise. + * modules/posix_spawn (Depends-on): Likewise. + * modules/posix_spawn_file_actions_addclose (Depends-on): Likewise. + * modules/posix_spawn_file_actions_adddup2 (Depends-on): Likewise. + * modules/posix_spawn_file_actions_addopen (Depends-on): Likewise. + * modules/posix_spawnp (Depends-on): Likewise. + * modules/pread (Depends-on): Likewise. + * modules/printf-posix (Depends-on): Likewise. + * modules/ptsname (Depends-on): Likewise. + * modules/putenv (Depends-on): Likewise. + * modules/pwrite (Depends-on): Likewise. + * modules/readline (Depends-on): Likewise. + * modules/readlink (Depends-on): Likewise. + * modules/readlinkat (Depends-on): Likewise. + * modules/recv (Depends-on): Likewise. + * modules/recvfrom (Depends-on): Likewise. + * modules/regex (Depends-on): Likewise. + * modules/remove (Depends-on): Likewise. + * modules/rename (Depends-on): Likewise. + * modules/renameat (Depends-on): Likewise. + * modules/rmdir (Depends-on): Likewise. + * modules/round (Depends-on): Likewise. + * modules/roundf (Depends-on): Likewise. + * modules/roundl (Depends-on): Likewise. + * modules/rpmatch (Depends-on): Likewise. + * modules/select (Depends-on): Likewise. + * modules/send (Depends-on): Likewise. + * modules/sendto (Depends-on): Likewise. + * modules/setenv (Depends-on): Likewise. + * modules/setlocale (Depends-on): Likewise. + * modules/setsockopt (Depends-on): Likewise. + * modules/shutdown (Depends-on): Likewise. + * modules/sigaction (Depends-on): Likewise. + * modules/signbit (Depends-on): Likewise. + * modules/sigprocmask (Depends-on): Likewise. + * modules/sinl (Depends-on): Likewise. + * modules/sleep (Depends-on): Likewise. + * modules/snprintf (Depends-on): Likewise. + * modules/snprintf-posix (Depends-on): Likewise. + * modules/socket (Depends-on): Likewise. + * modules/sprintf-posix (Depends-on): Likewise. + * modules/sqrtl (Depends-on): Likewise. + * modules/stat (Depends-on): Likewise. + * modules/strchrnul (Depends-on): Likewise. + * modules/strdup-posix (Depends-on): Likewise. + * modules/strerror (Depends-on): Likewise. + * modules/strerror_r-posix (Depends-on): Likewise. + * modules/strndup (Depends-on): Likewise. + * modules/strnlen (Depends-on): Likewise. + * modules/strptime (Depends-on): Likewise. + * modules/strsep (Depends-on): Likewise. + * modules/strsignal (Depends-on): Likewise. + * modules/strstr-simple (Depends-on): Likewise. + * modules/strtod (Depends-on): Likewise. + * modules/strtoimax (Depends-on): Likewise. + * modules/strtok_r (Depends-on): Likewise. + * modules/strtoumax (Depends-on): Likewise. + * modules/symlink (Depends-on): Likewise. + * modules/symlinkat (Depends-on): Likewise. + * modules/tanl (Depends-on): Likewise. + * modules/tcgetsid (Depends-on): Likewise. + * modules/tmpfile (Depends-on): Likewise. + * modules/trunc (Depends-on): Likewise. + * modules/truncf (Depends-on): Likewise. + * modules/truncl (Depends-on): Likewise. + * modules/uname (Depends-on): Likewise. + * modules/unlink (Depends-on): Likewise. + * modules/unlockpt (Depends-on): Likewise. + * modules/unsetenv (Depends-on): Likewise. + * modules/usleep (Depends-on): Likewise. + * modules/utimensat (Depends-on): Likewise. + * modules/vasprintf (Depends-on): Likewise. + * modules/vdprintf (Depends-on): Likewise. + * modules/vdprintf-posix (Depends-on): Likewise. + * modules/vfprintf-posix (Depends-on): Likewise. + * modules/vprintf-posix (Depends-on): Likewise. + * modules/vsnprintf (Depends-on): Likewise. + * modules/vsnprintf-posix (Depends-on): Likewise. + * modules/vsprintf-posix (Depends-on): Likewise. + * modules/wcrtomb (Depends-on): Likewise. + * modules/wcscasecmp (Depends-on): Likewise. + * modules/wcscspn (Depends-on): Likewise. + * modules/wcsdup (Depends-on): Likewise. + * modules/wcsncasecmp (Depends-on): Likewise. + * modules/wcsnrtombs (Depends-on): Likewise. + * modules/wcspbrk (Depends-on): Likewise. + * modules/wcsrtombs (Depends-on): Likewise. + * modules/wcsspn (Depends-on): Likewise. + * modules/wcsstr (Depends-on): Likewise. + * modules/wcstok (Depends-on): Likewise. + * modules/wcswidth (Depends-on): Likewise. + * modules/wctob (Depends-on): Likewise. + * modules/wctomb (Depends-on): Likewise. + * modules/wctype (Depends-on): Likewise. + * modules/wcwidth (Depends-on): Likewise. + * modules/write (Depends-on): Likewise. + +2011-05-03 Bruno Haible <bruno@clisp.org> + + Support for conditional dependencies. + * doc/gnulib.texi (Module description): Document the syntax of + conditional dependencies. + * gnulib-tool: New option --conditional-dependencies. + (func_usage): Document it. + (cond_dependencies): New variable. + (func_get_automake_snippet_conditional, + func_get_automake_snippet_unconditional): New functions, extracted from + func_get_automake_snippet. + (func_get_automake_snippet): Use them. + (sed_first_32_chars): New variable. + (func_module_shellfunc_name): New function. + (func_module_shellvar_name): New function. + (func_module_conditional_name): New function. + (func_uncond_add_module, func_conddep_add_module, func_cond_module_p, + func_cond_module_condition): New functions. + (func_modules_transitive_closure): Add support for conditional + dependencies. + (func_emit_lib_Makefile_am): For a conditional module, enclose the + conditional automake snippet in an automake conditional. + (func_emit_autoconf_snippets): Emit shell functions that contain the + code for conditional modules. + (func_import, func_create_testdir): Update specification. + +2011-05-03 Eric Blake <eblake@redhat.com> + + test-getaddrinfo: report error information + * tests/test-getaddrinfo.c (simple): Use err outside of dbprintf. + +2011-05-03 Jim Meyering <meyering@redhat.com> + + bootstrap: avoid build failure when $GZIP is set + * build-aux/bootstrap (check_versions): Do not treat $GZIP as a + program name. If defined at all, it is supposed to list gzip options. + Reported by Alan Curry in http://debbugs.gnu.org/8609 + +2011-05-03 Reuben Thomas <rrt@sc3d.org> + + readme-release: new module with release instructions + * modules/readme-release: New module. + * top/README-release: New file, from coreutils, grep, diffutils. + * MODULES.html.sh (Support for maintaining and releasing): Add it. + +2011-05-02 Eric Blake <eblake@redhat.com> + + fflush: also replace fclose when fixing fflush + * modules/fflush (Depends-on): Add fclose. + * m4/fflush.m4 (gl_FUNC_FFLUSH): Also replace fclose. + * lib/fclose.c (rpl_fclose): Don't cause spurious failures on + memstreams with no backing fd. + * doc/posix-functions/fclose.texi (fclose): Document the use of + fflush module to fix the bug. + * tests/test-fclose.c (main): Relax test when fclose is used in + isolation. + + fclose: add some tests + * modules/fclose-tests: New test module. + * tests/test-fclose.c: New file. + * doc/posix-functions/fclose.texi (fclose): Document the bug. + + fclose: reduced dependencies + * modules/fclose (Depends-on): Switch from fflush/fseeko to + simpler lseek. + * lib/fclose.c (rpl_fclose): Likewise. + Reported by Simon Josefsson. + + exit: drop remaining clients + * modules/argmatch (Depends-on): Replace exit with stdlib. + * modules/copy-file (Depends-on): Likewise. + * modules/execute (Depends-on): Likewise. + * modules/exitfail (Depends-on): Likewise. + * modules/obstack (Depends-on): Likewise. + * modules/pagealign_alloc (Depends-on): Likewise. + * modules/pipe-filter-gi (Depends-on): Likewise. + * modules/pipe-filter-ii (Depends-on): Likewise. + * modules/savewd (Depends-on): Likewise. + * modules/spawn-pipe (Depends-on): Likewise. + * modules/wait-process (Depends-on): Likewise. + * modules/xsetenv (Depends-on): Likewise. + * modules/chdir-long (Depends-on): Add stdlib, for EXIT_FAILURE. + * modules/git-merge-changelog (Depends-on): Likewise. + * modules/long-options (Depends-on): Likewise. + * modules/pt_chown (Depends-on): Likewise. + * modules/sysexits (Depends-on): Likewise. + + freading: relax license from LGPLv3+ to LGPLv2+ + * modules/freading (License): Relax LGPL version. + +2011-05-02 Bruno Haible <bruno@clisp.org> + + fchdir: Remove unused dependencies. + * modules/fchdir (Depends-on): Remove include_next. + +2011-05-02 Bruno Haible <bruno@clisp.org> + + gnulib-tool: Refactor. + * gnulib-tool (func_emit_autoconf_snippet): New function, extracted + from func_emit_autoconf_snippets. + (func_emit_autoconf_snippets): Use it. + +2011-05-02 Simon Josefsson <simon@josefsson.org> + + * NEWS: Document removal of 'exit'. + * modules/exit: Remove file. + +2011-05-01 Bruno Haible <bruno@clisp.org> + + Update DEPENDENCIES. + * DEPENDENCIES (gettext): Recommend the newest release. + Reported by Simon Josefsson. + +2011-05-01 Bruno Haible <bruno@clisp.org> + + gnulib-tool: Reduce code duplication. + * gnulib-tool (func_emit_autoconf_snippets): New function. + (func_import, func_create_testdir): Use it. + +2011-04-30 Eric Blake <eblake@redhat.com> + + fclose: don't fail on non-seekable input stream + * modules/fclose (Depends-on): Add freading, fflush, fseeko. + * lib/fclose.c (rpl_fclose): Skip fflush for non-seekable input, + since fflush is allowed to fail in that case. + +2011-04-30 Bruno Haible <bruno@clisp.org> + + dup3: cleanup + * lib/dup3.c: Remove old code, leftover from 2009-12-16. + +2011-04-30 Bruno Haible <bruno@clisp.org> + + netdb: Make it work in C++ mode. + * lib/netdb.in.h (struct addrinfo): In C++, define as a C struct. + (getaddrinfo, freeaddrinfo, getnameinfo): Use macros from c++defs + module. + * m4/netdb_h.m4 (gl_NETDB_MODULE_INDICATOR): Invoke + gl_MODULE_INDICATOR_FOR_TESTS. + * modules/netdb-tests (Depends-on): Add netdb-c++-tests. + * modules/netdb-c++-tests: New file. + * tests/test-netdb-c++.cc: New file. + +2011-04-30 Bruno Haible <bruno@clisp.org> + + New modules 'vfscanf', 'vscanf'. + * modules/vfscanf: New file. + * modules/vscanf: New file. + * m4/stdio_h.m4 (gl_STDIO_H): Don't set GNULIB_VFSCANF, GNULIB_VSCANF + here. + * doc/posix-functions/vfscanf.texi: Mention module 'vfscanf'. + * doc/posix-functions/vscanf.texi: Mention module 'vscanf'. + +2011-04-30 Bruno Haible <bruno@clisp.org> + + passfd: Add comments. + * lib/passfd.c: Add comments about platforms. + +2011-04-30 Bruno Haible <bruno@clisp.org> + + sys_uio: Make <sys/uio.h> self-contained. + * lib/sys_uio.in.h: Include <sys/types.h> before <sys/uio.h>. + * doc/posix-headers/sys_uio.texi: Mention the OpenBSD problem. + +2011-04-30 Bruno Haible <bruno@clisp.org> + + sys_socket: Ensure 'struct iovec' definition. + * lib/sys_socket.in.h: Include <sys/uio.h> also on platforms that have + <sys/socket.h>. + * doc/posix-headers/sys_socket.texi: Mention the OpenBSD problem. + +2011-04-30 Bruno Haible <bruno@clisp.org> + + sys_uio: Protect definition of 'struct iovec'. + * lib/sys_uio.in.h (struct iovec): Avoid redefinition. In C++, define + it as a C struct. + +2011-04-30 Bruno Haible <bruno@clisp.org> + + manywarnings: fix indentation + * m4/manywarnings.m4: Indent by 2 spaces consistently. + +2011-04-30 Pádraig Brady <P@draigBrady.com> + + manywarnings: add -Wno-missing-field-initializers if needed. + * m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC): Add the above + option if it's needed to allow initialization with { 0, } + +2011-04-29 Reuben Thomas <rrt@sc3d.org> + + announce-gen: cosmetic improvement + * build-aux/announce-gen: Strip any leading ./ from the NEWS file name. + +2011-04-29 Jim Meyering <meyering@redhat.com> + + vc-list-files: indent with spaces, not TABs + * build-aux/vc-list-files: Convert leading TABs to spaces, + to match the style of most other files in gnulib. + + announce-gen: indent with spaces, not TABs + * build-aux/announce-gen: Convert all TABs to spaces, to match + the style of most other files in gnulib. + +2011-04-29 Eric Blake <eblake@redhat.com> + + quotearg: avoid uninitialized variable use + * lib/quotearg.c (quoting_options_from_style): Initialize + remaining fields, and ensure that custom styles are only used via + quoting_options rather than quoting_style. + +2011-04-29 Jim Meyering <meyering@redhat.com> + + maint.mk: remove unused VC-tag variable + * top/maint.mk (VC-tag): Remove unused variable. + +2011-04-29 Bruno Haible <bruno@clisp.org> + + netdb: fix gai_strerror replacements + * lib/netdb.in.h: Add _GL_FUNCDECL_RPL definitions. + * modules/netdb: Substitute it. + +2011-04-29 Jim Meyering <meyering@redhat.com> + + test-getcwd.c: avoid new set-but-not-used warning + * tests/test-getcwd.c (test_abort_bug): Exit nonzero for any problem, + not just the glibc/abort one that getcwd-abort-bug.m4 detects. + * m4/getcwd-abort-bug.m4: Update this now-duplicated code to match, + and adjust the code that sets gl_cv_func_getcwd_abort_bug accordingly. + + test-hash.c: avoid a new shadowing warning + * tests/test-hash.c (main): Don't shadow "dup". + +2011-04-28 Eric Blake <eblake@redhat.com> + + getaddrinfo: fix gai_strerror signature + * m4/getaddrinfo.m4 (gl_GETADDRINFO): Detect broken signatures, + and work around mingw with UNICODE defined. + (gl_PREREQ_GETADDRINFO): Drop redundant decl check. + * m4/netdb_h.m4 (gl_NETDB_H_DEFAULTS): Add witness. + * modules/netdb (Makefile.am): Substitute it. + * lib/netdb.in.h (gai_strerror): Declare replacement. + * lib/gai_strerror.c (rpl_gai_strerror): Fix signature. + * doc/posix-functions/gai_strerror.texi (gai_strerror): Document + the fix. + + getsockopt: avoid compiler warning + * lib/getsockopt.c (rpl_getsockopt): Add a cast for mingw. + Reported by Matthias Bolte. + + tests: drop unused link dependency + * modules/areadlinkat-tests (Makefile.am): Drop stale LDADD. + * modules/dirent-safer-tests (Makefile.am): Likewise. + * modules/fdopendir-tests (Makefile.am): Likewise. + * modules/mkfifoat-tests (Makefile.am): Likewise. + * modules/openat-safer-tests (Makefile.am): Likewise. + * modules/openat-tests (Makefile.am): Likewise. + * modules/readlinkat-tests (Makefile.am): Likewise. + * modules/symlinkat-tests (Makefile.am): Likewise. + * modules/linkat-tests (Makefile.am): Likewise. + (Depends-on): Switch to filenamecat-lgpl. + * modules/fdutimensat-tests (test_fdutimensat_LDADD): Drop unused + LIBINTL. + * modules/utimensat-tests (test_utimensat_LDADD): Likewise. + * tests/test-linkat.c (main): Don't require xalloc. + + hash, mgetgroups: drop xalloc dependency + * lib/hash.c (includes): Adjust includes. + * lib/mgetgroups.c (includes): Likewise. + (xgetgroups): Move... + * lib/xgetgroups.c: ...to new file. + * lib/mgetgroups.h (xgetgroups): Make declaration conditional. + * modules/xgetgroups: New file, split from... + * modules/mgetgroups: ...here. + (Depends-on): Add xalloc-oversized. + * modules/hash (Depends-on): Likewise. + * modules/hash-tests (Depends-on): Drop xalloc. + (test_hash_LDADD): Drop unused library. + * tests/test-hash.c (main): Break xalloc dependency. + (includes): Drop unused include. + + xalloc-oversized: new module + * modules/xalloc-oversized: New module. + * modules/xalloc (Depends-on): Add it. + * lib/xalloc.h (xalloc_oversized): Move... + * lib/xalloc-oversized.h: ...into new file. + + utimecmp: drop dependency on xmalloc + * lib/utimecmp.c (utimecmp): Work even if hash table cache fails + due to memory pressure. + * modules/utimecmp (Depends-on): Drop xalloc. + +2011-04-27 Eric Blake <eblake@redhat.com> + + getcwd: fix mingw bugs + * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Detect one mingw bug. + * doc/posix-functions/getcwd.texi (getcwd): Document the problems. + * lib/getcwd-lgpl.c (rpl_getcwd): Fix return type. + +2011-04-27 Bruno Haible <bruno@clisp.org> + + mkstemps: Ensure declaration on MacOS X 10.5. + * lib/stdlib.in.h: Include <unistd.h> when mkstemps is requested. + * doc/glibc-functions/mkstemps.texi: Document header file problem on + MacOS X. + +2011-04-27 Bruno Haible <bruno@clisp.org> + + mkstemp: More documentation. + * doc/posix-functions/mkstemp.texi: Document header file problem on + MacOS X. + +2011-04-27 Bruno Haible <bruno@clisp.org> + + mkstemp: Tweak configure message when cross-compiling. + * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): When cross-compiling, qualify the + result as a guess. + +2011-04-27 Bruno Haible <bruno@clisp.org> + + clean-temp: Clarify what it does. + * lib/clean-temp.h: Add more comments. + * doc/posix-functions/mkstemp.texi: Tweak reference to 'clean-temp' + module. + * doc/glibc-functions/mkostemp.texi: Mention 'clean-temp' here too. + * doc/glibc-functions/mkstemps.texi: Likewise. + * doc/glibc-functions/mkostemps.texi: Likewise. + +2011-04-27 Eric Blake <eblake@redhat.com> + + fchdir: avoid extra chdir and fix test + * modules/fchdir (Depends-on): Add dosname, filenamecat-lgpl, + getcwd-lgpl. + * lib/fchdir.c (get_name): Any absolute name will do; it does not + have to be canonical. + (canonicalize_file_name): Drop unused macro. + * m4/dup2.m4 (gl_REPLACE_DUP2): Ensure dup2 is replaced. + + filenamecat-lgpl: fix licence + * modules/filenamecat-lgpl (License): Mark as LGPLv2+, as intended + when it was first created. + + linkat, renameat: add missing dependency + * modules/linkat (Depends-on): Require getcwd-lgpl. + * modules/renameat (Depends-on): Likewise. + + tests: reduce dependencies + * tests/test-linkat.c (main): Use lighter-weight getcwd. + * tests/test-renameat.c (main): Likewise. + * modules/linkat-tests (Depends-on): Relax dependency. + * modules/renameat-tests (Depends-on): Likewise. + * modules/fchdir-tests (Depends-on): Likewise. Also make cloexec + dependency explicit. + + save-cwd: reduce default dependency + * modules/save-cwd (Depends-on): Use getcwd-lgpl. + * lib/save-cwd.c: Update comments. + * NEWS: Document the semantic change. + + getcwd: enhance tests + * tests/test-getcwd-lgpl.c: New file, taken from... + * tests/test-getcwd.c: ...old contents. Rewrite this file to + repeat long path stress tests from m4 probe. + * modules/getcwd-lgpl-tests: New module. + * modules/getcwd-tests (Depends-on): Depend on lgpl tests. + * m4/getcwd-abort-bug.m4: Update comment. + * m4/getcwd-path-max.m4: Likewise. + + getcwd-lgpl: new module + * modules/getcwd-lgpl: New module. + * lib/getcwd-lgpl.c: New file. + * doc/posix-functions/getcwd.texi (getcwd): Document it. + * MODULES.html.sh (lacking POSIX:2008): Likewise. + * modules/getcwd (configure.ac): Set C witness. + * m4/getcwd.m4 (gl_FUNC_GETCWD_LGPL): New macro. + + getcwd: tweak comments + * m4/getcwd-abort-bug.m4: Fix comments. + * m4/getcwd-path-max.m4: Likewise. + * m4/getcwd.m4: Likewise. + +2011-04-27 Reuben Thomas <rrt@sc3d.org> + and Eric Blake <eblake@redhat.com> + + mkstemp: replace if system version uses wrong permissions + * m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Add test for non-owner + read/write mode bits set in file created by mkstemp. + * doc/posix-functions/mkstemp.texi (mkstemp): Document the fix. + +2011-04-27 Eric Blake <eblake@redhat.com> + + passfd: avoid compiler warning + * lib/passfd.c (sendfd, recvfd): Avoid shadowing names. + Reported by Laine Stump. + +2011-04-27 J.T. Conklin <jtc@acorntoolworks.com> (tiny change) + + * gnulib-tool: change "join -a 2" to "join -a2", the latter is + required by the NetBSD (and perhaps other 4.4BSD derived) join. + +2011-04-27 Reuben Thomas <rrt@sc3d.org> + and Eric Blake <eblake@redhat.com> + + mkstemp: mention clean-temp module + * lib/mkstemp.c: Add comment. + * doc/posix-functions/mkstemp.texi (mkstemp): Likewise. + +2011-04-26 Paul Eggert <eggert@cs.ucla.edu> + + inttypes: also provide default values for 32-bit tests + * m4/inttypes.m4 (gl_INTTYPES_H_DEFAULTS): Also provide default values + for INT32_MAX_LT_INTMAX_MAX and for UINT32_MAX_LT_UINTMAX_MAX. + +2011-04-25 Paul Eggert <eggert@cs.ucla.edu> + + strtoumax: remove dependency on strtoimax + This is like the strtoull change of yesterday. + * modules/strtoumax (Files): Add lib/strtoimax.c. + (Depends-on): Remove strtoimax and add verify. + + inttypes-incomplete: new module + * m4/inttypes.m4 (gl_INTTYPES_INCOMPLETE): New macro, containing + all but the PRI* and SCN* parts of gl_INTTYPES_H. + (gl_INTTYPES_PRI_SCN): New macro, containing the PRI* and SCN* parts + of gl_INTTYPES_H. + (gl_INTTYPES_H): Rewrite in terms of these new macros. + (gl_INTTYPES_H_DEFAULTS): Provide defaults for the PRI* and SCN* + parts, in case gl_INTTYPE_PRI_SCN is not invoked. + * modules/imaxabs, modules/imaxdiv, modules/strtoimax (Depends-on): + * modules/strtoumax, modules/xstrtol (Depends-on): + Depend on inttypes-incomplete, not inttypes. + * modules/inttypes-incomplete: New module, containing the contents + of the old modules/inttypes module, except that the Files: section + omits m4/inttypes-pri.m4, and the configure.ac section invokes + gl_INTTYPES_INCOMPLETE rather than gl_INTTYPES_H. + * modules/inttypes (Files): Remove lib/inttypes.in.h, m4/inttypes.m4. + (Depends-on): Depend only on inttypes-incomplete. + (Makefile.am): Remove everything; this is now in inttypes-incomplete. + + inttypes: omit now-redundant strtoimax and strtoumax work + * m4/inttypes.m4 (gl_INTTYPES_H): Do not check for strtoimax and + strtoumax decls; gl_FUNC_STRTOIMAX and gl_FUNC_STRTOUMAX now do this. + + strtoimax, strtoumax: simplify, port to HP-UX 11.00 64-bit + This supports apps that need pointers to strtoimax and strtoumax, + and ports to HP-UX 11.00 64.bit, which has macros that expand to + nonexistent functions. See + <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00241.html> + et seq. + * lib/inttypes.in.h (strtoimax, strtoumax): #undef before declaring. + * m4/strtoimax.m4 (gl_FUNC_STRTOIMAX): Don't check whether it's + a macro. + * m4/strtoumax.m4 (gl_FUNC_STRTOUMAX): Likewise. + +2011-04-25 Simon Josefsson <simon@josefsson.org> + + * modules/gnumakefile (configure.ac): Replace TAB with SPCs. + +2011-04-25 Bruno Haible <bruno@clisp.org> + + strtol, strtoul: Mark modules as obsolete. + * modules/strtol (Status, Notice): New sections. + * modules/strtoul (Status, Notice): New sections. + +2011-04-25 Bruno Haible <bruno@clisp.org> + + strtod: Remove check for strtod, unless supporting old platforms. + * modules/strtod-obsolete: New file. + * m4/strtod-obsolete.m4: New file. + * m4/strtod.m4 (gl_FUNC_STRTOD): Don't check whether strtod is declared + if gl_FUNC_STRTOD_OBSOLETE is not also defined. + * modules/strtod (Depends-on): Add strtod-obsolete. + * doc/posix-functions/strtod.texi: Mention module strtod-obsolete. + +2011-04-25 Bruno Haible <bruno@clisp.org> + + strcase: Make module obsolete. + * modules/strcase (Status, Notice): New sections. + +2011-04-25 Bruno Haible <bruno@clisp.org> + + dup2: Remove check for dup2, unless supporting old obsolete platforms. + * modules/dup2-obsolete: New file. + * m4/dup2-obsolete.m4: New file. + * m4/dup2.m4 (gl_FUNC_DUP2): Don't check whether dup2 exists if + gl_FUNC_DUP2_OBSOLETE is not also defined. + * modules/dup2 (Depends-on): Add dup2-obsolete. + * doc/posix-functions/dup2.texi: Mention module dup2-obsolete. + +2011-04-25 Bruno Haible <bruno@clisp.org> + + strnlen: Avoid memchr related link error on old obsolete platforms. + * modules/memchr-obsolete: New file. + * m4/memchr-obsolete.m4: New file. + * m4/memchr.m4 (gl_FUNC_MEMCHR): Don't check whether memchr exists if + gl_FUNC_MEMCHR_OBSOLETE is not also defined. + * modules/memchr (Depends-on): Add memchr-obsolete. + * modules/strnlen (Depends-on): Likewise. + * doc/posix-functions/memchr.texi: Mention module memchr-obsolete. + +2011-04-25 Jim Meyering <meyering@redhat.com> + + maint.mk: makefile_at_at_check extend and clean up + * top/maint.mk (sc_makefile_at_at_check): Check *.mk files + in addition to */Makefile.am. + Exempt legitimate uses of @VAR@ notation, e.g., + MAKEINFO = env LANG= LC_MESSAGES= LC_ALL= LANGUAGE= @MAKEINFO@ + Remove obsolete coreutils-specific comment. + Prompted by discussion here: + http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/26074 + +2011-04-24 Paul Eggert <eggert@cs.ucla.edu> + + strtoul: remove dependency on strtol + This is so that 'configure' need not check for strtol merely because + the application needs strtoul. + * modules/strtoul (Files): Add lib/strtol.c. + (Depends-on): Remove strtol. + + strtoull: remove dependency on strtoul + This is like the strtoll change. + * modules/strtoull (Files): Add lib/strtol.c, lib/strtoul.c. + (Depends-on): Remove strtoul. + + strtoll: remove dependency on strtol + This is so that 'configure' need not check for strtol merely because + the application needs strtoll. + * modules/strtoll (Files): Add lib/strtol.c. + (Depends-on): Remove strtol. + +2011-04-22 Paul Eggert <eggert@cs.ucla.edu> + + inttypes: Move some configure check to module 'imaxdiv'. + * m4/imaxdiv.m4 (gl_FUNC_IMAXDIV): Require gl_INTTYPES_H_DEFAULTS + instead of gl_INTTYPES_H. Check for imaxdiv decl here. + * m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxdiv decl here. + +2011-04-22 Paul Eggert <eggert@cs.ucla.edu> + + inttypes: Move some configure check to module 'imaxabs'. + * m4/imaxabs.m4 (gl_FUNC_IMAXABS): Require gl_INTTYPES_H_DEFAULTS + instead of gl_INTTYPES_H. Check for imaxabs decl here. + * m4/inttypes.m4 (gl_INTTYPES_H): Don't check for imaxabs decl here. + +2011-04-22 Paul Eggert <eggert@cs.ucla.edu> + + inttypes: Remove configure tests that are not needed since 2009-12-31. + * m4/inttypes.m4 (gl_INTTYPES_H): Remove determination of + gl_cv_header_working_inttypes_h. + +2011-04-22 Paul Eggert <eggert@cs.ucla.edu> + + * modules/strnlen (Depends-on): Remove memchr. + The strnlen implementation doesn't need the memchr module's fixes; see + <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00237.html>. + + strtol: remove dependency on wchar + * lib/strtol.c: Include <wchar.h> only if USE_WIDE_CHAR is defined. + * modules/strtol (Depends-on): Remove wchar. + +2011-04-21 Eric Blake <eblake@redhat.com> + + passfd: fix test regression on Linux + * modules/passfd-tests (configure.ac): Correct socketpair check. + + passfd: speed up configure and drop unused code + * m4/afunix.m4 (gl_SOCKET_AFUNIX): Rename... + * m4/passfd.m4 (gl_PASSFD): ...to something more fitting of + its use. Drop test for setting unused HAVE_UNIXSOCKET_SCM_RIGHTS. + Instead of probing at configure for unix_scm_rights_bsd44_way, + instead probe for CMSG_FIRSTHDR at compile time. Simplify BSD 4.3 + check to a struct member probe. + * lib/passfd.c (includes): Nothing here requires <sys/un.h>. + (sendfd, recvfd): Update preprocessor checks. + * modules/passfd (Files): Reflect rename, and drop unused file. + (Depends-on): Drop unused dependency. + + passfd: allow compilation on mingw + * modules/sys_socket (Depends-on): Add sys_uio. + * lib/sys_socket.in.h [!@HAVE_SYS_SOCKET_H@]: Use it for struct + iovec and a minimal struct msghdr. + * m4/afunix.m4 (gl_SOCKET_AFUNIX): Detect recvmsg/sendmsg. + * tests/test-sys_socket.c (main): Enhance test. + * lib/passfd.c (include): Drop <sys/uio.h>; <sys/sockets.h> is + guaranteed to provide what we need. + (sendmsg, recvmsg): Declare fallbacks if we lack sendmsg. + * modules/passfd-tests (Depends-on): Add sys_wait. + * tests/test-passfd.c (main): Skip test on mingw, for now. + * doc/posix-headers/sys_socket.texi (sys/socket.h): Document the + partial 'struct msghdr' implementation. + + sys_uio: new module + * modules/sys_uio: New module. + * modules/sys_uio-tests: Likewise. + * lib/sys_uio.in.h: New file. + * m4/sys_uio_h.m4: Likewise. + * tests/test-sys_uio.c: Likewise. + * doc/posix-headers/sys_uio.texi (sys/uio.h): Document it. + * MODULES.html.sh (systems lacking POSIX:2008): Likewise. + +2011-04-20 Jim Meyering <meyering@redhat.com> + + useless-if-before-free: avoid false-positive + * build-aux/useless-if-before-free: Adjust regexp for the non-brace + disjunct so that it too requires a terminating ";". Without that, + this script would identify as useless one statement from gcc that + was not: + if (aligned_ptr) + free (((void **) aligned_ptr) [-1]); + +2011-04-20 Giuseppe Scrivano <gscrivano@gnu.org> + + doc: update users.txt. + * users.txt: Add barcode. + +2011-04-19 Bruno Haible <bruno@clisp.org> + + ioctl: Remove link dependency on native Windows. + * lib/fd-hook.h: Renamed from lib/close-hook.h. + (gl_close_fn, gl_ioctl_fn): New types. + (struct fd_hook): Renamed from struct close_hook. Change type of + private_close_fn field. Add private_ioctl_fn field. + (close_hook_fn): Add parameter for primary close method. + (execute_close_hooks, execute_all_close_hooks): Likewise. + (ioctl_hook_fn): New type. + (execute_ioctl_hooks, execute_all_ioctl_hooks): New declarations. + (register_fd_hook): Renamed from register_close_hook. Add ioctl_hook + argument. + (unregister_fd_hook): Renamed from unregister_close_hook. + * lib/fd-hook.c: Renamed from lib/close-hook.c. + Don't include <unistd.h>. + (close): Remove undef. + (anchor): Update. + (execute_close_hooks): Add argument for primary close method. + (execute_all_close_hooks): Likewise. + (execute_ioctl_hooks, execute_all_ioctl_hooks): New functions. + (register_fd_hook): Renamed from register_close_hook. Add ioctl_hook + argument. Allow each argument to be NULL. + (unregister_fd_hook): Renamed from unregister_close_hook. + * lib/close.c (rpl_close): Pass 'close' function pointer to + execute_all_close_hooks. + * lib/ioctl.c: Include <errno.h>, fd-hook.h. + (primary_ioctl): New function. + (ioctl): Don't call ioctlsocket here. Instead, call + execute_all_ioctl_hooks. + * lib/sockets.c (close_fd_maybe_socket): Add argument for primary + close method. + (ioctl_fd_maybe_socket): New function, with code from lib/ioctl.c. + (fd_sockets_hook): Renamed from close_sockets_hook. + (gl_sockets_startup, gl_sockets_cleanup): Update. + * modules/fd-hook: Renamed from modules/close-hook. Update. + * modules/close (Depends-on): Add fd-hook, remove close-hook. + * modules/sockets (Depends-on): Likewise. + * modules/ioctl (Depends-on): Add fd-hook. + * tests/test-nonblocking.c (main): Use GNULIB_TEST_SOCKET, not + GNULIB_SOCKET. + +2011-04-19 Bruno Haible <bruno@clisp.org> + + Move the support of O_NONBLOCK in open() to the 'open' module. + * modules/nonblocking (Depends-on): Remove 'open'. + * m4/nonblocking.m4 (gl_NONBLOCKING_IO_BODY): Set + gl_cv_have_open_O_NONBLOCK. + * m4/open.m4 (gl_FUNC_OPEN): Replace open() also when required for + O_NONBLOCK support. + * doc/posix-functions/open.texi: Document support for O_NONBLOCK. + +2011-04-17 Bruno Haible <bruno@clisp.org> + + pipe2: Simplify code. + * lib/pipe2.c (pipe2): Reduce code duplication. + +2011-04-17 Bruno Haible <bruno@clisp.org> + + nonblocking: Add comment. + * lib/fcntl.in.h (O_NONBLOCK): Add comment. + +2011-04-17 Bruno Haible <bruno@clisp.org> + + nonblocking: Add tests for sockets. + * tests/test-nonblocking-socket.sh: New file. + * tests/test-nonblocking-socket-main.c: New file. + * tests/test-nonblocking-socket-child.c: New file. + * tests/test-nonblocking-socket.h: New file. + * tests/socket-server.h: New file. + * tests/socket-client.h: New file. + * modules/nonblocking-socket-tests: New file. + * modules/nonblocking-tests (Depends-on): Add nonblocking-socket-tests. + +2011-04-17 Bruno Haible <bruno@clisp.org> + + nonblocking: Add tests for pipes. + * tests/test-nonblocking-pipe.sh: New file. + * tests/test-nonblocking-pipe-main.c: New file. + * tests/test-nonblocking-pipe-child.c: New file. + * tests/test-nonblocking-pipe.h: New file. + * tests/test-nonblocking-writer.h: New file. + * tests/test-nonblocking-reader.h: New file. + * tests/test-nonblocking-misc.h: New file. + * modules/nonblocking-pipe-tests: New file. + * modules/nonblocking-tests (Depends-on): Add nonblocking-pipe-tests. + +2011-04-16 Bruno Haible <bruno@clisp.org> + + gettext: Clarify the needed programmer actions. + * modules/gettext (Notice): New field. + Suggested by Ben Pfaff <blp@cs.stanford.edu>. + +2011-04-16 Bruno Haible <bruno@clisp.org> + + strchrnul: Tweak last commit. + * doc/glibc-functions/strchrnul.texi: Add more details about Cygwin + bug. + * lib/string.in.h (strchrnul): Use same arguments in _GL_FUNCDECL_RPL + as in _GL_FUNCDECL_SYS. + * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Invoke gl_PREREQ_STRCHRNUL after + AC_LIBOBJ. When cross-compiling, say "guessing yes" not "yes". + +2011-04-15 Eric Blake <eblake@redhat.com> + + strchrnul: work around cygwin bug + * doc/glibc-functions/strchrnul.texi (strchrnul): Document bug. + * m4/strchrnul.m4 (gl_FUNC_STRCHRNUL): Detect it. + * m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): New witness. + * modules/string (Makefile.am): Substitute it. + * lib/string.in.h (strchrnul): Use it. + +2011-04-15 Bruno Haible <bruno@clisp.org> + + Don't require lib/stdio-write.c when only module 'stdio' is used. + * m4/stdio_h.m4 (gl_STDIO_H): Move the AC_LIBOBJ back into the m4_ifdef + invocation. + Reported by Rob Vermaas <rob.vermaas@gmail.com>. + +2011-04-14 Bruno Haible <bruno@clisp.org> + + Support non-blocking pipe I/O in read() on native Windows. + * lib/unistd.in.h: Include <sys/types.h> also for 'read'. + (read): New declaration. + * lib/read.c: New file. + * lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT_SCANF, + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM): New macros. + (fgetc, fgets, fread, fscanf, getc, getchar, gets, scanf, vfscanf, + vscanf): New declarations. + * lib/stdio-read.c: New file. + * m4/read.m4: New file. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_READ, + REPLACE_READ. + * m4/stdio_h.m4 (gl_STDIO_H): Set GNULIB_FGETC, GNULIB_FGETS, + GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, + GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF. In non-blocking I/O is + desired and needs workarounds, set REPLACE_STDIO_READ_FUNCS. + (gl_STDIO_H_DEFAULTS): Initialize GNULIB_FGETC, GNULIB_FGETS, + GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, + GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS. + * modules/read: New file. + * modules/nonblocking (Files): Add lib/stdio-read.c. + * modules/unistd (Makefile.am): Substitute GNULIB_READ, REPLACE_READ. + * modules/stdio (Makefile.am): Substitute GNULIB_FGETC, GNULIB_FGETS, + GNULIB_FREAD, GNULIB_FSCANF, GNULIB_GETC, GNULIB_GETCHAR, GNULIB_GETS, + GNULIB_SCANF, GNULIB_VFSCANF, GNULIB_VSCANF, REPLACE_STDIO_READ_FUNCS. + * modules/pread (Depends-on): Add read. + * modules/safe-read (Depends-on): Likewise. + * tests/test-stdio-c++.cc (fgetc, fgets, fread, fscanf, getc, getchar, + gets, scanf, vfscanf, vscanf): Verify signatures. + * doc/posix-functions/read.texi: Mention 'nonblocking' module and + problem with non-blocking pipes. + * doc/posix-functions/fgetc.texi: Likewise. + * doc/posix-functions/fgets.texi: Likewise. + * doc/posix-functions/fread.texi: Likewise. + * doc/posix-functions/fscanf.texi: Likewise. + * doc/posix-functions/getc.texi: Likewise. + * doc/posix-functions/getchar.texi: Likewise. + * doc/posix-functions/gets.texi: Likewise. + * doc/posix-functions/scanf.texi: Likewise. + * doc/posix-functions/vfscanf.texi: Likewise. + * doc/posix-functions/vscanf.texi: Likewise. + +2011-04-14 Bruno Haible <bruno@clisp.org> + + Support non-blocking pipe I/O in write() on native Windows. + * lib/write.c (rpl_write): Split a write request that failed merely + because the byte count was larger than the pipe buffer's size. + * doc/posix-functions/write.texi: Mention the problem with large byte + counts. + +2011-04-14 Bruno Haible <bruno@clisp.org> + + wchar: Ensure that wchar_t gets defined on uClibc. + * lib/wchar.in.h: On uClibc, include <stddef.h>. + Reported by Giuseppe Scrivano <gscrivano@gnu.org>. + +2011-04-13 Bruno Haible <bruno@clisp.org> + + safe-write, full-read: Avoid unnecessary compilation units. + * modules/safe-write (Files): Add lib/safe-read.c, m4/safe-read.m4. + (Depends-on): Remove safe-read. Add ssize_t. + * modules/full-read (Files): Add lib/full-write.c. + (Depends-on): Add full-write. + +2011-04-13 Bruno Haible <bruno@clisp.org> + + Support non-blocking pipe I/O and SIGPIPE in pwrite(). + * modules/pwrite (Depends-on): Add 'write'. + +2011-04-13 Bruno Haible <bruno@clisp.org> + + Support non-blocking pipe I/O in write() on native Windows. + * lib/unistd.in.h (write): Enable replacement also if + GNULIB_UNISTD_H_NONBLOCKING is 1. + * lib/write.c: Enable replacement also if GNULIB_NONBLOCKING. + (rpl_write): When failing to write on a non-blocking pipe, change + errno from ENOSPC to EAGAIN. + * lib/stdio.in.h (fprintf, fputc, fputs, fwrite, printf, putc, + putchar, puts, vfprintf, vprintf): Enable replacement also if + GNULIB_STDIO_H_NONBLOCKING is 1. + * lib/stdio-write.c: Enable replacements also if GNULIB_NONBLOCKING. + (CLEAR_ERRNO, HANDLE_ENOSPC): New macros. + (CLEAR_LastError, HANDLE_ERROR_NO_DATA): New macros, extracted from + CALL_WITH_SIGPIPE_EMULATION. + (CALL_WITH_SIGPIPE_EMULATION): Use them. + * m4/nonblocking.m4: New file. + * m4/write.m4 (gl_FUNC_WRITE): Enable REPLACE_WRITE also if required + for non-blocking I/O support. + * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize + GNULIB_UNISTD_H_NONBLOCKING. + * m4/stdio_h.m4 (gl_STDIO_H): Enable REPLACE_STDIO_WRITE_FUNCS also if + required for non-blocking I/O support. + (gl_STDIO_H_DEFAULTS): Initialize GNULIB_STDIO_H_NONBLOCKING. + * modules/nonblocking (Files): Add m4/nonblocking.m4, + lib/stdio-write.c, m4/asm-underscore.m4. + (Depends-on): Add stdio, unistd. + (configure.ac): Invoke gl_NONBLOCKING_IO. Define GNULIB_NONBLOCKING. + Set GNULIB_STDIO_H_NONBLOCKING, GNULIB_UNISTD_H_NONBLOCKING. + * modules/unistd (Makefile.am): Substitute GNULIB_UNISTD_H_NONBLOCKING. + * modules/stdio (Makefile.am): Substitute GNULIB_STDIO_H_NONBLOCKING. + * doc/posix-functions/fprintf.texi: Mention 'nonblocking' module and + problem with non-blocking pipes. + * doc/posix-functions/fputc.texi: Likewise. + * doc/posix-functions/fputs.texi: Likewise. + * doc/posix-functions/fwrite.texi: Likewise. + * doc/posix-functions/printf.texi: Likewise. + * doc/posix-functions/putc.texi: Likewise. + * doc/posix-functions/putchar.texi: Likewise. + * doc/posix-functions/puts.texi: Likewise. + * doc/posix-functions/vfprintf.texi: Likewise. + * doc/posix-functions/vprintf.texi: Likewise. + * doc/posix-functions/write.texi: Likewise. + +2011-04-10 Jim Meyering <meyering@redhat.com> + + maint.mk: prohibit doubled words + Detect them also when they're separated by a newline. + There are 3 ways to customize it: + - disable the test on a per file basis, as usual with rules using + $(VC_LIST_EXCEPT) + - replace the default doubled-word-selecting regexp (affects all files) + - ignore a particular file-vs-doubled-word match + I nearly used that last one to ignore the "is is" match in + coreutils' NEWS file, since the text was "ls -is is ..." + To do that, I would have added this line to cfg.mk: + ignore_doubled_word_match_RE_ = ^NEWS:[0-9]+:is[ ]is$ + but it would have ignored any "is is" match in NEWS. + Low probability, but still... + Instead, I changed the text, slightly: + - ls -is is now consistent with ls -lis in ignoring values returned + + "ls -is" is now consistent with ls -lis in ignoring values returned + * top/maint.mk (prohibit_double_word_RE_): Provide default. + (prohibit_doubled_word_): Define. + (sc_prohibit_doubled_word): New rule. + (sc_prohibit_the_the): Remove. Subsumed by the above. + +2011-04-10 Jim Meyering <meyering@redhat.com> + + maint: fix doubled-word typo in comment + * m4/gethostname.m4: s/is is/it is/ + * m4/getdomainname.m4: Likewise. + +2011-04-10 Jim Meyering <meyering@redhat.com> + + maint: remove doubled word: s/it it/it/ + * lib/stat-time.h (get_stat_birthtime): s/it it/it/ + +2011-04-10 Jim Meyering <meyering@redhat.com> + + maint.mk: remove useless semicolon and backslash + * top/maint.mk (sc_prohibit_empty_lines_at_EOF): Remove stray + semicolon and backslash. + +2011-04-10 Bruno Haible <bruno@clisp.org> + + stdint test: Fix compilation failure on OSF/1 with DTK compiler. + * modules/stdint-tests (Depends-on): Add wchar. + +2011-04-10 Jim Meyering <meyering@redhat.com> + + maint: remove doubled words in comments, e.g., s/a a/a/ + * lib/strptime.c (day_of_the_week): s/the the/the/ + * tests/test-chown.h (test_chown): s/a a/a/ + + test-chown.h: correct a cast + * tests/test-chown.h (test_chown): Cast -1 to gid_t (not uid_t) + when the destination is a stat.st_gid. + +2011-04-09 Mats Erik Andersson <mats.andersson@gisladisker.se> (tiny change) + + getaddrinfo: Fix test for sa_len member. + * m4/getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): When testing for sa_len, + include <sys/types.h> before <sys/socket.h>. + +2011-04-09 Paul Eggert <eggert@cs.ucla.edu> + + maint: change "can not" to "cannot" + * doc/posix-functions/iconv.texi (iconv): This one crossed line + boundaries. + +2011-04-09 Jim Meyering <meyering@redhat.com> + + maint: change "a a" to "a" + * tests/test-lchown.h (test_lchown): s/a a/a/ + + maint.mk: prohibit \<the the\> + * top/maint.mk (sc_prohibit_the_the): New rule. + + maint: fix "the the" in comment + * lib/count-one-bits.h: s/the the/the/ + + maint: change "can not" to "cannot" + But do not change the occurrences in maintain.texi or in + build-aux/po/Makefile.in.in, which I presume comes from gettext. + * doc/gnulib-tool.texi: s/can not/cannot/ + * doc/posix-functions/accept.texi (accept): Likewise. + * doc/posix-functions/socket.texi (socket): Likewise. + * lib/mbrtowc.c: Likewise. + + maint.mk: prohibit use of "can not" + * top/maint.mk (sc_prohibit_can_not): New rule. + Writing "can not" (rather than "cannot") is too common. Prohibit it. + +2011-04-09 Bruno Haible <bruno@clisp.org> + + careadlinkat: Guard against misuse of careadlinkatcwd. + * lib/careadlinkat.c: Include <stdlib.h>. + (careadlinkatcwd): Check that the fd argument is as expected. + +2011-04-09 Bruno Haible <bruno@clisp.org> + + careadlinkat: Use common coding style. + * lib/careadlinkat.c: Move gnulib includes after system includes. + +2011-04-09 Bruno Haible <bruno@clisp.org> + + careadlinkat: Clarify specification. + * lib/careadlinkat.h (careadlinkat): Clarify preadlinkat argument. + (careadlinkatcwd): Add comment. + * lib/careadlinkat.c (careadlinkat): Clarify preadlinkat argument. + +2011-04-09 Bruno Haible <bruno@clisp.org> + + areadlinkat: Avoid link error on many platforms. + * modules/areadlinkat (Depends-on): Add areadlink. + +2011-04-09 Bruno Haible <bruno@clisp.org> + + allocator, careadlinkat: Fix double-inclusion guard. + * lib/allocator.h: Fix double-inclusion guard. + * lib/careadlinkat.h: Likewise. + +2011-04-09 Bruno Haible <bruno@clisp.org> + + relocatable-prog-wrapper: Update after module 'areadlink' changed. + * lib/relocwrapper.c: Update dependencies hierarchy. + * build-aux/install-reloc: Update list of files to be compiled. + * modules/relocatable-prog-wrapper (Files): Add lib/careadlinkat.[hc], + lib/allocator.[hc]. + +2011-04-08 Eric Blake <eblake@redhat.com> + + strftime: silence gnulib-tool warning + * modules/strftime-tests (Depends-on): Drop automatic dependency. + +2011-04-08 Bruno Haible <bruno@clisp.org> + + verify: Fix syntax error with GCC 4.6 in C++ mode. + * lib/verify.h (HAVE__STATIC_ASSERT): Don't define in C++ mode. + (HAVE_STATIC_ASSERT): New macro. + (verify_true, verify): Use 'static_assert' if it is supported and + '_Static_assert' is not supported. + +2011-04-08 Paul Eggert <eggert@cs.ucla.edu> + + allocator: New module. + * modules/allocator, lib/allocator.c: New files. + * lib/allocator.h (stdlib_allocator): New decl. + * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC, standard_allocator): + Remove. Do not include <stdlib.h>. + (careadlinkat): Use stdlib_allocator instead of rolling our own. + * modules/careadlinkat (Files): Remove lib/allocator.h. + (Depends-on): Add allocator. + + stdlib: let modules use system malloc, realloc + * lib/stdlib.in.h (malloc, realloc): Don't #define or add warnings + if !_GL_USE_STDLIB_ALLOC. + (malloc, realloc): Limit this change to a smaller scope. + + * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define. + (malloc, realloc): Don't #undef; no longer needed. + * lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/progreloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/setenv.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. + * lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/relocatable.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/relocwrapper.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/malloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise. + * lib/realloc.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise. + + careadlinkat: rename members to avoid problem + * lib/allocator.h (struct allocator): Rename members from + malloc/realloc to allocate/reallocate, to avoid problems if malloc + and realloc are #define'd. Reported by Eric Blake in + <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00091.html>. + * lib/careadlinkat.c (careadlinkat): Adjust to renaming. + +2011-04-08 Eric Blake <eblake@redhat.com> + + nonblocking: reduce dependency + * tests/test-nonblocking.c: Only test sockets when in use. + * modules/nonblocking-tests (Depends-on): Drop socket. + (Makefile.am): Link even if sockets are not present. + * modules/pipe2-tests (Makefile.am): Likewise. + * lib/ioctl.c (ioctl) [WIN32]: Fail if sockets are not also in use. + + pipe2: fix O_NONBLOCK support on mingw + * modules/pipe2 (Depends-on): Add nonblocking. + * lib/pipe2.c (pipe2) [WIN32]: Add O_NONBLOCK support. + * tests/test-pipe2.c (is_nonblocking): Adjust test accordingly. + * tests/test-nonblocking.c (main): Likewise. + * modules/pipe2-tests (Makefile.am): Avoid link failure. + + fcntl-h: fix O_ACCMODE on cygwin + * doc/posix-headers/fcntl.texi (fcntl.h): Document the bug. + * lib/fcntl.in.h (O_ACCMODE): Fix it. + + pipe-filter: drop O_NONBLOCK workarounds + * modules/pipe-filter-gi (Depends-on): Add fcntl-h. + * modules/pipe-filter-ii (Depends-on): Likewise. + * lib/pipe-filter-aux.h (O_NONBLOCK): Delete workaround. + + nonblocking: provide O_NONBLOCK for mingw + * modules/nonblocking (Depends-on): Add open. + (configure.ac): Set new witness macro. + * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Provide default for it. + * modules/fcntl-h (Makefile.am): Substitute it. + * lib/fcntl.in.h (O_NONBLOCK): Guarantee non-zero definition when + nonblocking module is in use. + * lib/nonblocking.c: Adjust portability test. + * lib/open.c (open): Don't let native open see gnulib flag. + * tests/test-fcntl-h.c (main): Enhance test. + * tests/test-open.h (test_open): Likewise. + * doc/posix-headers/fcntl.texi (fcntl.h): Document the replacement. + + careadlinkat: fix compilation error on mingw + * lib/careadlinkat.c (standard_allocator): Avoid renaming fields + within struct allocator. + +2011-04-06 Eric Blake <eblake@redhat.com> + + binary-io: relicense under LGPLv2+ + * modules/binary-io (License): Relax to LGPLv2+. + Requested for libvirt, and required by pipe2. + +2011-04-06 Paul Eggert <eggert@cs.ucla.edu> + + verify: use _Static_assert if available + * lib/verify.h (HAVE__STATIC_ASSERT): New macro. + (verify_true, verify): Use it if available. This generates better + diagnostics with GCC 4.6.0 and later. + +2011-04-05 Bruno Haible <bruno@clisp.org> + + Remove leftover generated .h files after config.status changed. + + * m4/alloca.m4 (gl_FUNC_ALLOCA): New automake conditional + GL_GENERATE_ALLOCA_H. + * modules/alloca-opt (Makefile.am): Remove alloca.h if + GL_GENERATE_ALLOCA_H evaluates to false. + + * m4/argz.m4 (gl_FUNC_ARGZ): New automake conditional + GL_GENERATE_ARGZ_H. + * modules/argz (Makefile.am): Remove argz.h if GL_GENERATE_ARGZ_H + evaluates to false. + + * m4/byteswap.m4 (gl_BYTESWAP): New automake conditional + GL_GENERATE_BYTESWAP_H. + * modules/byteswap (Makefile.am): Remove byteswap.h if + GL_GENERATE_BYTESWAP_H evaluates to false. + + * m4/errno_h.m4 (gl_HEADER_ERRNO_H): New automake conditional + GL_GENERATE_ERRNO_H. + * modules/errno (Makefile.am): Remove errno.h if GL_GENERATE_ERRNO_H + evaluates to false. + + * m4/float_h.m4 (gl_FLOAT_H): New automake conditional + GL_GENERATE_FLOAT_H. + * modules/float (Makefile.am): Remove float.h if GL_GENERATE_FLOAT_H + evaluates to false. + + * m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): New automake conditional + GL_GENERATE_FNMATCH_H. + * modules/fnmatch (Makefile.am): Remove fnmatch.h if + GL_GENERATE_FNMATCH_H evaluates to false. + + * m4/glob.m4 (gl_GLOB_SUBSTITUTE, gl_GLOB): New automake conditional + GL_GENERATE_GLOB_H. + * modules/glob (Makefile.am): Remove glob.h if GL_GENERATE_GLOB_H + evaluates to false. + + * m4/iconv_h.m4 (gl_REPLACE_ICONV_H, gl_ICONV_H_DEFAULTS): New + automake conditional GL_GENERATE_ICONV_H. + * modules/iconv-h (Makefile.am): Remove iconv.h if GL_GENERATE_ICONV_H + evaluates to false. + + * m4/netinet_in_h.m4 (gl_HEADER_NETINET_IN): New automake conditional + GL_GENERATE_NETINET_IN_H. + * modules/netinet_in (Makefile.am): Remove netinet/in.h if + GL_GENERATE_NETINET_IN_H evaluates to false. + + * m4/pthread.m4 (gl_PTHREAD_CHECK): Set PTHREAD_H here. New automake + conditional GL_GENERATE_PTHREAD_H. + (gl_PTHREAD_DEFAULTS): Don't set PTHREAD_H here. + * modules/pthread (Makefile.am): Remove pthread.h if + GL_GENERATE_PTHREAD_H evaluates to false. + + * m4/sched_h.m4 (gl_SCHED_H): New automake conditional + GL_GENERATE_SCHED_H. + * modules/sched (Makefile.am): Remove sched.h if GL_GENERATE_SCHED_H + evaluates to false. + + * m4/selinux-context-h.m4 (gl_HEADERS_SELINUX_CONTEXT_H): New automake + conditional GL_GENERATE_SELINUX_CONTEXT_H. + * modules/selinux-h (Makefile.am): Remove selinux/context.h if + GL_GENERATE_SELINUX_CONTEXT_H evaluates to false. + + * m4/stdarg.m4 (gl_STDARG_H): New automake conditional + GL_GENERATE_STDARG_H. + * modules/stdarg (Makefile.am): Remove stdarg.h if + GL_GENERATE_STDARG_H evaluates to false. + + * m4/stdbool.m4 (AM_STDBOOL_H): New automake conditional + GL_GENERATE_STDBOOL_H. + * modules/stdbool (Makefile.am): Remove stdbool.h if + GL_GENERATE_STDBOOL_H evaluates to false. + + * m4/stddef_h.m4 (gl_STDDEF_H): Set STDDEF_H here. New automake + conditional GL_GENERATE_STDDEF_H. + (gl_STDDEF_H_DEFAULTS): Don't set STDDEF_H here. + * modules/stddef (Makefile.am): Remove stddef.h if + GL_GENERATE_STDDEF_H evaluates to false. + + * m4/stdint.m4 (gl_STDINT_H): New automake conditional + GL_GENERATE_STDINT_H. + * modules/stdint (Makefile.am): Remove stdint.h if + GL_GENERATE_STDINT_H evaluates to false. + + * m4/sysexits.m4 (gl_SYSEXITS): New automake conditional + GL_GENERATE_SYSEXITS_H. + * modules/sysexits (Makefile.am): Remove sysexits.h if + GL_GENERATE_SYSEXITS_H evaluates to false. + + Reported by Karl Berry and Ralf Wildenhues. + +2011-04-05 Bruno Haible <bruno@clisp.org> + + Ensure to rebuild generated .h files when config.status has changed. + * modules/arpa_inet (Makefile.am): Add dependency from .h file to + config.status. + * modules/ctype (Makefile.am): Likewise. + * modules/dirent (Makefile.am): Likewise. + * modules/errno (Makefile.am): Likewise. + * modules/fcntl-h (Makefile.am): Likewise. + * modules/float (Makefile.am): Likewise. + * modules/getopt-posix (Makefile.am): Likewise. + * modules/glob (Makefile.am): Likewise. + * modules/iconv-h (Makefile.am): Likewise. + * modules/inttypes (Makefile.am): Likewise. + * modules/langinfo (Makefile.am): Likewise. + * modules/locale (Makefile.am): Likewise. + * modules/math (Makefile.am): Likewise. + * modules/netdb (Makefile.am): Likewise. + * modules/netinet_in (Makefile.am): Likewise. + * modules/poll-h (Makefile.am): Likewise. + * modules/pthread (Makefile.am): Likewise. + * modules/pty (Makefile.am): Likewise. + * modules/sched (Makefile.am): Likewise. + * modules/search (Makefile.am): Likewise. + * modules/selinux-h (Makefile.am): Likewise. + * modules/signal (Makefile.am): Likewise. + * modules/spawn (Makefile.am): Likewise. + * modules/stdarg (Makefile.am): Likewise. + * modules/stdbool (Makefile.am): Likewise. + * modules/stddef (Makefile.am): Likewise. + * modules/stdint (Makefile.am): Likewise. + * modules/stdio (Makefile.am): Likewise. + * modules/stdlib (Makefile.am): Likewise. + * modules/string (Makefile.am): Likewise. + * modules/strings (Makefile.am): Likewise. + * modules/sys_file (Makefile.am): Likewise. + * modules/sys_ioctl (Makefile.am): Likewise. + * modules/sys_select (Makefile.am): Likewise. + * modules/sys_socket (Makefile.am): Likewise. + * modules/sys_stat (Makefile.am): Likewise. + * modules/sys_time (Makefile.am): Likewise. + * modules/sys_times (Makefile.am): Likewise. + * modules/sys_utsname (Makefile.am): Likewise. + * modules/sys_wait (Makefile.am): Likewise. + * modules/sysexits (Makefile.am): Likewise. + * modules/termios (Makefile.am): Likewise. + * modules/time (Makefile.am): Likewise. + * modules/unistd (Makefile.am): Likewise. + * modules/wchar (Makefile.am): Likewise. + * modules/wctype-h (Makefile.am): Likewise. + Reported by Karl Berry, Eric Blake, and Ralf Wildenhues. + +2011-04-05 Bruno Haible <bruno@clisp.org> + + pipe2: Relicense under LGPLv2+. + * modules/pipe2 (License): Change to LGPLv2+. + Requested by Eric Blake, for libvirt. + +2011-04-05 Bruce Korb <bkorb@gnu.org> + + bootstrap: compute gnulib_extra_files after updating build_aux + * build-aux/bootstrap (gnulib_extra_files): bootstrap.conf may + change build_aux or also supply gnulib_extra_files. Handle correctly. + +2011-04-05 Eric Blake <eblake@redhat.com> + + bootstrap: preserve git whitelist item sorting + * build-aux/bootstrap (sort_patterns): New function. + (insert_sorted_if_absent): Use it to sink ! lines to the bottom. + +2011-04-05 Simon Josefsson <simon@josefsson.org> + + * top/maint.mk (sc_prohibit_empty_lines_at_EOF): Don't trigger + sc_space_tab check. + +2011-04-05 Paul Eggert <eggert@cs.ucla.edu> + + areadlink, areadlinkat: rewrite in terms of careadlinkat + * lib/areadlink.c, lib/areadlinkat.c: Include careadlinkat.h + instead of errno.h, limits.h, stdint.h, stdlib.h, string.h, unistd.h. + (SSIZE_MAX, INITIAL_BUF_SIZE): Remove. + (malloc, realloc): Remove #undefs. + (areadlink, areadlinkat): Rewrite in terms of careadlinkat. + * modules/areadlink (Depends-on): Add careadlinkat. Remove + readlink, ssize_t, stdint, unistd. + * modules/areadlinkat (Depends-on): Add careadlinkat. Remove + areadlink, stdint. + + careadlinkat: new module + * lib/allocator.h, lib/careadlinkat.h, lib/careadlinkat.c: + * modules/careadlinkat: New files, written by me with + a review and feedback from Ben Pfaff in + <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00008.html>. + 2011-04-01 Bruno Haible <bruno@clisp.org> wmemchr, wcschr, wcsrchr, wcspbrk, wcsstr: Avoid errors in C++ mode. @@ -606,7 +2252,7 @@ Reported by Tom G. Christensen <tgc@jupiterrise.com>. 2011-03-20 Paul Eggert <eggert@cs.ucla.edu> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> socklen: do not depend on sys_socket While trying to modify Emacs to use gnulib's socklen module, @@ -643,7 +2289,7 @@ * m4/socklen.m4: Update comment about platforms. 2011-03-19 Paul Eggert <eggert@cs.ucla.edu> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> inet_ntop, inet_pton: Simplify. * modules/inet_ntop (Depends-on): Remove socklen, since sys_socket is @@ -652,7 +2298,7 @@ * lib/arpa_inet.in.h: Adjust comment. 2011-03-19 Paul Eggert <eggert@cs.ucla.edu> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> netdb: Simplify. * modules/netdb (Depends-on): Remove socklen, since sys_socket is @@ -741,7 +2387,7 @@ (check): Depend on the new variable, not the hard-coded list. 2011-03-13 Bastien Roucariès <roucaries.bastien@gmail.com> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> passfd module, part 3. * lib/passfd.h (recvfd): Add a flags argument. @@ -917,8 +2563,8 @@ Suggested by Simon Josefsson <simon@josefsson.org>. 2011-02-28 Corinna Vinschen <vinschen@redhat.com> (tiny change) - Charles Wilson <cygwin@cwilson.fastmail.fm> (tiny change) - Bruno Haible <bruno@clisp.org> (tiny change) + Charles Wilson <cygwin@cwilson.fastmail.fm> (tiny change) + Bruno Haible <bruno@clisp.org> (tiny change) On Cygwin, use /proc file system instead of win32 API. * lib/relocatable.c: On Cygwin, use file names from /proc, rather than @@ -2765,7 +4411,7 @@ * lib/strerror_r.c (strerror_r): Fix return type. 2011-01-21 Pádraig Brady <P@draigBrady.com> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> uN_strstr: New unit tests. * modules/unistr/u8-strstr-tests: New file. @@ -2777,7 +4423,7 @@ * tests/unistr/test-u32-strstr.c: New file. 2011-01-21 Pádraig Brady <P@draigBrady.com> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Make uN_strstr functions O(n) worst-case. * lib/unistr/u-strstr.h (FUNC): In the 8-bit case, use strstr. In the @@ -2801,7 +4447,7 @@ (configure.ac): Update required libunistring version. 2011-01-21 Pádraig Brady <P@draigBrady.com> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Prepare for faster uN_strstr functions. * lib/str-kmp.h: Support definable UNITs. @@ -4344,7 +5990,7 @@ http://sourceware.org/bugzilla/show_bug.cgi?id=12348 2010-12-28 Bruno Haible <bruno@clisp.org> - Paul Eggert <eggert@cs.ucla.edu> + Paul Eggert <eggert@cs.ucla.edu> linkat: Make implementation robust against system behaviour variations. * m4/link-follow.m4 (gl_FUNC_LINK_FOLLOWS_SYMLINK): Define @@ -5377,7 +7023,7 @@ relate to each other. 2010-12-15 Pádraig Brady <P@draigBrady.com> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Improve cross-compilation guesses for uClibc. * m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): When cross-compiling, assume @@ -5613,7 +7259,7 @@ * m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Fix typo. 2010-11-28 Bruno Haible <bruno@clisp.org> - Paul Eggert <eggert@cs.ucla.edu> + Paul Eggert <eggert@cs.ucla.edu> Tests for module 'getdomainname'. * modules/getdomainname-tests: New file. @@ -5621,7 +7267,7 @@ tests/test-gethostname.c. 2010-11-28 Bruno Haible <bruno@clisp.org> - Paul Eggert <eggert@cs.ucla.edu> + Paul Eggert <eggert@cs.ucla.edu> getdomainname: Use the system function when possible. * lib/unistd.in.h: Include <netdb.h>, for getdomainname's declaration. @@ -7169,7 +8815,7 @@ styles, and some unnecessary blank lines. 2010-10-03 Bruno Haible <bruno@clisp.org> - Joachim Schmitz <schmitz@hp.com> (tiny change) + Joachim Schmitz <schmitz@hp.com> (tiny change) acl: Add support for ACLs on NonStop Kernel. * m4/acl.m4 (gl_FUNC_ACL): For Solaris, test for facl(), not for acl(). @@ -7441,7 +9087,7 @@ Reported by Paul Eggert. 2010-09-22 Pádraig Brady <P@draigbrady.com> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Fix endless loop in mbmemcasecoll. * lib/mbmemcasecoll.c (apply_towlower): When mbrtowc returns 0, copy 1 @@ -8217,7 +9863,7 @@ Reported by Johan Hattne <johan.hattne@utsouthwestern.edu>. 2010-08-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Make the module 'realloc-gnu' work again on AIX and OSF/1. * m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Define HAVE_REALLOC_GNU instead @@ -8228,7 +9874,7 @@ * modules/realloc-gnu (configure.ac): Use gl_MODULE_INDICATOR. 2010-08-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Make the module 'calloc-gnu' work again on AIX and OSF/1. * m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Define HAVE_CALLOC_GNU instead of @@ -8239,7 +9885,7 @@ * modules/calloc-gnu (configure.ac): Invoke gl_MODULE_INDICATOR. 2010-08-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Make the module 'malloc-gnu' work again on AIX and OSF/1. * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Define HAVE_MALLOC_GNU instead of @@ -8315,8 +9961,8 @@ * lib/read-file.c (fread_file): Shrink the buffer at the end. 2010-08-28 Giuseppe Scrivano <gscrivano@gnu.org> - Eric Blake <eblake@redhat.com> - Bruno Haible <bruno@clisp.org> + Eric Blake <eblake@redhat.com> + Bruno Haible <bruno@clisp.org> read-file: Avoid memory reallocations with regular files. * lib/read-file.c: Include <sys/stat.h>, <stdio.h>, <stdint.h>. @@ -8654,7 +10300,7 @@ (Match-end-of-line Operator): Mention 'not_eol'. 2010-08-14 Brian Gough <bjg@gnu.org> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> git-merge-changelog: add doc relating to use with bzr and hg. * lib/git-merge-changelog.c: Add comments regarding bzr, hg, diff3. @@ -9345,7 +10991,7 @@ * modules/strtod-tests (Makefile.am): Likewise. 2010-07-11 Pádraig Brady <P@draigBrady.com> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> unistr/u8-strchr: Optimize ASCII argument case. * lib/unistr/u8-strchr.c (u8_strchr): For ASCII arguments, use strchr. @@ -9703,7 +11349,7 @@ * tests/test-inttostr.c: New file. Test these functions. 2010-06-09 Ben Pfaff <blp@cs.stanford.edu> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Add "Extending Gnulib" chapter to manual. * doc/gnulib.texi (Writing Modules): Add cross-reference to new @@ -9743,7 +11389,7 @@ Suggested by Eric Blake. 2010-06-04 Martin Lambers <marlam@marlam.de> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> havelib: Allow library names with '+' characters. * m4/lib-link.m4 (AC_LIB_LINKFLAGS, AC_LIB_HAVE_LINKFLAGS, @@ -9999,7 +11645,7 @@ * modules/libunistring-optional (Files): Likewise. 2010-05-18 Paolo Bonzini <bonzini@gnu.org> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> New module 'libunistring-optional'. * modules/libunistring-optional: New file. @@ -11551,7 +13197,7 @@ (func_import): Set the excl_*_tests variables to empty. 2010-04-25 Simon Josefsson <simon@josefsson.org> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Work around a MacOS X 10.4 bug with openpty. * doc/glibc-functions/openpty.texi: Mention the MacOS X 10.4 bug. @@ -11620,7 +13266,7 @@ EPIPE. 2010-04-20 Simon Josefsson <simon@josefsson.org> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> visibility: Don't use -fvisibility if it leads to a warning. * m4/visibility.m4 (gl_VISIBILITY): Check whether -Werror is usable. If @@ -11656,7 +13302,7 @@ Reported by Ian Beckwith <ianb@erislabs.net>. 2010-04-18 Andreas Gruenbacher <agruen@suse.de> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> diffseq: Accommodate use-case with abstract arrays. * lib/diffseq.h (struct context): Remove xvec, yvec fields if ELEMENT @@ -11807,7 +13453,7 @@ declared. 2010-04-11 Paolo Bonzini <bonzini@gnu.org> - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> libunistring: Improve configure output. * m4/libunistring.m4 (gl_LIBUNISTRING): Check for libiconv first. @@ -12230,14 +13876,14 @@ Reported by Hauke Fath <hauke@espresso.rhein-neckar.de>. 2010-04-04 Hauke Fath <hauke@espresso.rhein-neckar.de> (tiny change) - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> wchar: Port to NetBSD 1.5. * lib/wchar.in.h (WEOF): Provide fallback also when wint_t exists. * lib/wctype.in.h (WEOF): Likewise. 2010-04-04 Hauke Fath <hauke@espresso.rhein-neckar.de> (tiny change) - Bruno Haible <bruno@clisp.org> + Bruno Haible <bruno@clisp.org> Port extended stdio to NetBSD 1.5. * lib/stdio-impl.h [NetBSD]: Include <sys/param.h>. @@ -13018,7 +14664,7 @@ $(LIBSOCKET). 2010-03-28 Bruno Haible <bruno@clisp.org> - Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + Ralf Wildenhues <Ralf.Wildenhues@gmx.de> lib-ignore: Determine different options for different compilers. * m4/lib-ignore.m4 (gl_IGNORE_UNUSED_LIBRARIES): Set a variable which diff --git a/DEPENDENCIES b/DEPENDENCIES index 2117e7dbce..f025ab2d5c 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -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: diff --git a/MODULES.html.sh b/MODULES.html.sh index 708f3cccfc..c9f1f9e188 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2353,6 +2353,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 +2465,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 +3476,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 @@ -12,6 +12,20 @@ User visible incompatible changes Date Modules Changes +2011-05-02 exit The module is removed. It was deprecated + on 2010-03-05. Use 'stdlib' directly instead. + +2011-04-27 mgetgroups The 'xgetgroups' function has been split into + a new 'xgetgroups' module. + +2011-04-27 save-cwd This module pulls in fewer dependencies by + default; to retain robust handling of directories + with an absolute name longer than PATH_MAX, you + must now explicitly include the 'getcwd' module. + +2011-04-19 close-hook This module has been renamed to 'fd-hook' and + generalized. + 2011-03-08 regex-quote The last argument is no longer an 'int cflags' but instead a pointer to a previously constructed 'struct regex_quote_spec'. diff --git a/build-aux/announce-gen b/build-aux/announce-gen index 488692681e..233ee9b959 100755 --- a/build-aux/announce-gen +++ b/build-aux/announce-gen @@ -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-04-29 21:01'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -106,7 +106,7 @@ 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 @@ -194,24 +197,24 @@ sub print_news_deltas ($$$) while (defined (my $line = <NEWS>)) { if ( ! $in_items) - { - # Match lines like these: - # * Major changes in release 5.0.1: - # * Noteworthy changes in release 6.6 (2006-11-22) [stable] - $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o - or next; - $in_items = 1; - print $line; - } + { + # Match lines like these: + # * Major changes in release 5.0.1: + # * Noteworthy changes in release 6.6 (2006-11-22) [stable] + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o + or next; + $in_items = 1; + print $line; + } else - { - # This regexp must not match version numbers in NEWS items. - # For example, they might well say `introduced in 4.5.5', - # and we don't want that to match. - $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o - and last; - print $line; - } + { + # This regexp must not match version numbers in NEWS items. + # For example, they might well say `introduced in 4.5.5', + # and we don't want that to match. + $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o + and last; + print $line; + } } close NEWS; @@ -229,8 +232,8 @@ 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 +258,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 +285,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 +319,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 +401,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 +451,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"; diff --git a/build-aux/bootstrap b/build-aux/bootstrap index f004ad3260..d91611b4a4 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh # Print a version string. -scriptversion=2011-03-03.12; # UTC +scriptversion=2011-05-03.08; # UTC # Bootstrap this package from checked-out sources. @@ -130,18 +130,7 @@ 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,7 +421,10 @@ 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}" + case $appvar in + GZIP) ;; # Do not use $GZIP: it contains gzip options. + *) eval "app=\${$appvar-$app}" ;; + esac inst_ver=$(get_version $app) if [ ! "$inst_ver" ]; then echo "$me: Error: '$app' not found" >&2 diff --git a/build-aux/config.sub b/build-aux/config.sub index 18b17aa463..30fdca8121 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -286,6 +286,7 @@ case $basic_machine in | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ + | open8 \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ @@ -394,6 +395,7 @@ case $basic_machine in | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ diff --git a/build-aux/depcomp b/build-aux/depcomp index c3163befc3..9825d56d74 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -1,10 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2010-10-07.20; # UTC +scriptversion=2011-04-16.09; # UTC -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010 -# Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, +# 2011 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -166,10 +166,12 @@ gcc) ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as -## well. +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -557,7 +559,9 @@ 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 diff --git a/build-aux/do-release-commit-and-tag b/build-aux/do-release-commit-and-tag index ca89bdc9db..b1eaf8800e 100755 --- a/build-aux/do-release-commit-and-tag +++ b/build-aux/do-release-commit-and-tag @@ -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' diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh index 34ef112e35..c8abd55fb3 100755 --- a/build-aux/gendocs.sh +++ b/build-aux/gendocs.sh @@ -2,7 +2,7 @@ # gendocs.sh -- generate a GNU manual in many formats. This script is # mentioned in maintain.texi. See the help message below for usage details. -scriptversion=2010-11-29.11 +scriptversion=2011-04-08.14 # Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. @@ -305,10 +305,10 @@ if test -n "$docbook"; then docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"` mv $PACKAGE-db.xml "$outdir/" + split_html_db_dir=html_node_db cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\"" echo "Generating docbook HTML... ($cmd)" eval "$cmd" - split_html_db_dir=html_node_db ( cd ${split_html_db_dir} || exit 1 tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html diff --git a/build-aux/install-reloc b/build-aux/install-reloc index 4ca4bedfa7..bc07e67cc0 100755 --- a/build-aux/install-reloc +++ b/build-aux/install-reloc @@ -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 \ diff --git a/build-aux/texinfo.tex b/build-aux/texinfo.tex index 7b943897de..9f64511ea2 100644 --- a/build-aux/texinfo.tex +++ b/build-aux/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2011-02-24.09} +\def\texinfoversion{2011-03-25.11} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -7053,12 +7053,14 @@ end % ... and for \example: \spaceisspace % - % The \empty here causes a following catcode 5 newline to be eaten - % as part of reading whitespace after a control sequence. It does - % not eat a catcode 13 newline. There's no good way to handle the - % two cases. See the Macro Details node in the manual for the - % workaround we currently have to recommend for macros and + % The \empty here causes a following catcode 5 newline to be eaten as + % part of reading whitespace after a control sequence. It does not + % eat a catcode 13 newline. There's no good way to handle the two + % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX + % would then have different behavior). See the Macro Details node in + % the manual for the workaround we recommend for macros and % line-oriented commands. + % \scantokens{#1\empty}% \endgroup} diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free index a6c228bcf4..b8f5a2635e 100755 --- a/build-aux/useless-if-before-free +++ b/build-aux/useless-if-before-free @@ -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; diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files index 9bb6fe6d3d..2fced256bf 100755 --- a/build-aux/vc-list-files +++ b/build-aux/vc-list-files @@ -2,7 +2,7 @@ # List version-controlled file names. # Print a version string. -scriptversion=2010-04-23.22; # UTC +scriptversion=2011-04-29.20; # UTC # Copyright (C) 2006-2011 Free Software Foundation, Inc. @@ -94,12 +94,12 @@ elif test -d CVS; 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; \ - }}'\'' \ + 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 diff --git a/doc/glibc-functions/mkostemp.texi b/doc/glibc-functions/mkostemp.texi index ff1db30817..44e3ab3138 100644 --- a/doc/glibc-functions/mkostemp.texi +++ b/doc/glibc-functions/mkostemp.texi @@ -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. diff --git a/doc/glibc-functions/mkostemps.texi b/doc/glibc-functions/mkostemps.texi index b847fae925..033d462c77 100644 --- a/doc/glibc-functions/mkostemps.texi +++ b/doc/glibc-functions/mkostemps.texi @@ -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. diff --git a/doc/glibc-functions/mkstemps.texi b/doc/glibc-functions/mkstemps.texi index a321a49800..845d5dcf36 100644 --- a/doc/glibc-functions/mkstemps.texi +++ b/doc/glibc-functions/mkstemps.texi @@ -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. diff --git a/doc/glibc-functions/strchrnul.texi b/doc/glibc-functions/strchrnul.texi index fcb461ea8a..f108c54063 100644 --- a/doc/glibc-functions/strchrnul.texi +++ b/doc/glibc-functions/strchrnul.texi @@ -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: diff --git a/doc/gnulib-tool.texi b/doc/gnulib-tool.texi index 8e38c38e99..443cbc216e 100644 --- a/doc/gnulib-tool.texi +++ b/doc/gnulib-tool.texi @@ -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 diff --git a/doc/gnulib.texi b/doc/gnulib.texi index 966560d595..b59306ff7b 100644 --- a/doc/gnulib.texi +++ b/doc/gnulib.texi @@ -396,6 +396,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} diff --git a/doc/posix-functions/accept.texi b/doc/posix-functions/accept.texi index 61b009345c..b937e15f00 100644 --- a/doc/posix-functions/accept.texi +++ b/doc/posix-functions/accept.texi @@ -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 diff --git a/doc/posix-functions/dup2.texi b/doc/posix-functions/dup2.texi index fc1e3595a9..6054c303ba 100644 --- a/doc/posix-functions/dup2.texi +++ b/doc/posix-functions/dup2.texi @@ -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 diff --git a/doc/posix-functions/fclose.texi b/doc/posix-functions/fclose.texi index da26c87e89..a7b576088e 100644 --- a/doc/posix-functions/fclose.texi +++ b/doc/posix-functions/fclose.texi @@ -4,9 +4,17 @@ POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/fclose.html} -Gnulib module: fclose +Gnulib module: fclose, fflush -Portability problems fixed by Gnulib: +Portability problems fixed by Gnulib module @code{fclose} together with module @code{fflush}: +@itemize +@item +On some platforms, this function fails to set the file position of a +seekable input stream to the byte after the last one actually read: +glibc 2.13, FreeBSD. +@end itemize + +Portability problems fixed by Gnulib module @code{fclose}: @itemize @item On Windows platforms (excluding Cygwin), @code{socket} and @code{accept} diff --git a/doc/posix-functions/fgetc.texi b/doc/posix-functions/fgetc.texi index 057efe78ab..4cbe30eb6a 100644 --- a/doc/posix-functions/fgetc.texi +++ b/doc/posix-functions/fgetc.texi @@ -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: diff --git a/doc/posix-functions/fgets.texi b/doc/posix-functions/fgets.texi index fd0744e106..2d840b168b 100644 --- a/doc/posix-functions/fgets.texi +++ b/doc/posix-functions/fgets.texi @@ -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: diff --git a/doc/posix-functions/fprintf.texi b/doc/posix-functions/fprintf.texi index e922e85e08..04c4c72cae 100644 --- a/doc/posix-functions/fprintf.texi +++ b/doc/posix-functions/fprintf.texi @@ -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 diff --git a/doc/posix-functions/fputc.texi b/doc/posix-functions/fputc.texi index 2f09a8a98f..9d6c9fd29c 100644 --- a/doc/posix-functions/fputc.texi +++ b/doc/posix-functions/fputc.texi @@ -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 diff --git a/doc/posix-functions/fputs.texi b/doc/posix-functions/fputs.texi index d2c46ef8bd..7fc4bf5311 100644 --- a/doc/posix-functions/fputs.texi +++ b/doc/posix-functions/fputs.texi @@ -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 diff --git a/doc/posix-functions/fread.texi b/doc/posix-functions/fread.texi index 6f02f51f55..57155c22f2 100644 --- a/doc/posix-functions/fread.texi +++ b/doc/posix-functions/fread.texi @@ -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: diff --git a/doc/posix-functions/fscanf.texi b/doc/posix-functions/fscanf.texi index 49d528a5f4..1c47ec2cce 100644 --- a/doc/posix-functions/fscanf.texi +++ b/doc/posix-functions/fscanf.texi @@ -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: diff --git a/doc/posix-functions/fwrite.texi b/doc/posix-functions/fwrite.texi index d9defec9c8..20f7fb8100 100644 --- a/doc/posix-functions/fwrite.texi +++ b/doc/posix-functions/fwrite.texi @@ -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 diff --git a/doc/posix-functions/gai_strerror.texi b/doc/posix-functions/gai_strerror.texi index ece2bdc991..d94a6ed9bd 100644 --- a/doc/posix-functions/gai_strerror.texi +++ b/doc/posix-functions/gai_strerror.texi @@ -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 diff --git a/doc/posix-functions/getc.texi b/doc/posix-functions/getc.texi index 7c92ab4d16..fea05113af 100644 --- a/doc/posix-functions/getc.texi +++ b/doc/posix-functions/getc.texi @@ -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: diff --git a/doc/posix-functions/getchar.texi b/doc/posix-functions/getchar.texi index d365f8d3ac..3b11d99343 100644 --- a/doc/posix-functions/getchar.texi +++ b/doc/posix-functions/getchar.texi @@ -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: diff --git a/doc/posix-functions/getcwd.texi b/doc/posix-functions/getcwd.texi index 4d00af8955..1f6dd187d2 100644 --- a/doc/posix-functions/getcwd.texi +++ b/doc/posix-functions/getcwd.texi @@ -4,15 +4,25 @@ 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. Conversely, mingw fails +to honor non-zero @code{n}. +@item +On some platforms, the prototype for @code{getcwd} uses @code{int} +instead of @code{size_t} for the size argument: +mingw. +@end itemize + +Portability problems fixed by Gnulib module @code{getcwd}: +@itemize +@item +This function is missing on some older platforms. @item This function does not handle long file names (greater than @code{PATH_MAX}) correctly on some platforms. diff --git a/doc/posix-functions/gets.texi b/doc/posix-functions/gets.texi index af29450a8c..1a3b277439 100644 --- a/doc/posix-functions/gets.texi +++ b/doc/posix-functions/gets.texi @@ -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: diff --git a/doc/posix-functions/iconv.texi b/doc/posix-functions/iconv.texi index 3f984b5940..7ba2cfcc49 100644 --- a/doc/posix-functions/iconv.texi +++ b/doc/posix-functions/iconv.texi @@ -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} diff --git a/doc/posix-functions/memchr.texi b/doc/posix-functions/memchr.texi index 3c9cfcb9d2..68a15a23f6 100644 --- a/doc/posix-functions/memchr.texi +++ b/doc/posix-functions/memchr.texi @@ -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 diff --git a/doc/posix-functions/mkstemp.texi b/doc/posix-functions/mkstemp.texi index 55b42a9feb..ebe8c50c8b 100644 --- a/doc/posix-functions/mkstemp.texi +++ b/doc/posix-functions/mkstemp.texi @@ -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. diff --git a/doc/posix-functions/open.texi b/doc/posix-functions/open.texi index 223126f61e..7ccb4861e4 100644 --- a/doc/posix-functions/open.texi +++ b/doc/posix-functions/open.texi @@ -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{nonblock} on some platforms: +mingw. +@item On Windows platforms (excluding Cygwin), this function does usually not recognize the @file{/dev/null} filename. @end itemize diff --git a/doc/posix-functions/printf.texi b/doc/posix-functions/printf.texi index eaee96a753..df7813f6a4 100644 --- a/doc/posix-functions/printf.texi +++ b/doc/posix-functions/printf.texi @@ -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 diff --git a/doc/posix-functions/putc.texi b/doc/posix-functions/putc.texi index b7011a01be..d156461ace 100644 --- a/doc/posix-functions/putc.texi +++ b/doc/posix-functions/putc.texi @@ -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 diff --git a/doc/posix-functions/putchar.texi b/doc/posix-functions/putchar.texi index d89ab7189f..aeb6b4307c 100644 --- a/doc/posix-functions/putchar.texi +++ b/doc/posix-functions/putchar.texi @@ -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 diff --git a/doc/posix-functions/puts.texi b/doc/posix-functions/puts.texi index 69ee72e3de..ef350ac1b1 100644 --- a/doc/posix-functions/puts.texi +++ b/doc/posix-functions/puts.texi @@ -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 diff --git a/doc/posix-functions/read.texi b/doc/posix-functions/read.texi index 385fb77b0f..2f5312de84 100644 --- a/doc/posix-functions/read.texi +++ b/doc/posix-functions/read.texi @@ -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: diff --git a/doc/posix-functions/scanf.texi b/doc/posix-functions/scanf.texi index fbca16749a..f29378c097 100644 --- a/doc/posix-functions/scanf.texi +++ b/doc/posix-functions/scanf.texi @@ -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: diff --git a/doc/posix-functions/socket.texi b/doc/posix-functions/socket.texi index bc3ee0f719..a91ebd6d76 100644 --- a/doc/posix-functions/socket.texi +++ b/doc/posix-functions/socket.texi @@ -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 diff --git a/doc/posix-functions/strtod.texi b/doc/posix-functions/strtod.texi index 222f584a79..4f8f08bdb7 100644 --- a/doc/posix-functions/strtod.texi +++ b/doc/posix-functions/strtod.texi @@ -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 diff --git a/doc/posix-functions/vfprintf.texi b/doc/posix-functions/vfprintf.texi index 7e502347de..b40a334167 100644 --- a/doc/posix-functions/vfprintf.texi +++ b/doc/posix-functions/vfprintf.texi @@ -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 diff --git a/doc/posix-functions/vfscanf.texi b/doc/posix-functions/vfscanf.texi index 9f3da4da28..d051e6d0c7 100644 --- a/doc/posix-functions/vfscanf.texi +++ b/doc/posix-functions/vfscanf.texi @@ -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: diff --git a/doc/posix-functions/vprintf.texi b/doc/posix-functions/vprintf.texi index 526070e22d..342d182c64 100644 --- a/doc/posix-functions/vprintf.texi +++ b/doc/posix-functions/vprintf.texi @@ -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 diff --git a/doc/posix-functions/vscanf.texi b/doc/posix-functions/vscanf.texi index 980f1a8a92..feff03ac5c 100644 --- a/doc/posix-functions/vscanf.texi +++ b/doc/posix-functions/vscanf.texi @@ -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: diff --git a/doc/posix-functions/write.texi b/doc/posix-functions/write.texi index 826151c9ee..604507d30c 100644 --- a/doc/posix-functions/write.texi +++ b/doc/posix-functions/write.texi @@ -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 diff --git a/doc/posix-headers/assert.texi b/doc/posix-headers/assert.texi index 02a1c3b547..aa78ee7bc5 100644 --- a/doc/posix-headers/assert.texi +++ b/doc/posix-headers/assert.texi @@ -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 diff --git a/doc/posix-headers/fcntl.texi b/doc/posix-headers/fcntl.texi index 1b64195180..c87e8726d4 100644 --- a/doc/posix-headers/fcntl.texi +++ b/doc/posix-headers/fcntl.texi @@ -9,15 +9,25 @@ 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. Gnulib defines these macros to @samp{O_RDONLY}, which is typically 0. @item +The @samp{O_ACCMODE} mask mistakenly omits @samp{O_SEARCH} and +@samp{O_EXEC} on some platforms: +Cygwin. + +@item @samp{O_BINARY}, @samp{O_TEXT} (not specified by POSIX, but essential for portability to Woe32 platforms) are defined on some platforms but not on others. diff --git a/doc/posix-headers/signal.texi b/doc/posix-headers/signal.texi index 77a54323c3..7e953ce1ff 100644 --- a/doc/posix-headers/signal.texi +++ b/doc/posix-headers/signal.texi @@ -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: diff --git a/doc/posix-headers/sys_socket.texi b/doc/posix-headers/sys_socket.texi index c8e42280f1..72fd688705 100644 --- a/doc/posix-headers/sys_socket.texi +++ b/doc/posix-headers/sys_socket.texi @@ -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 diff --git a/doc/posix-headers/sys_uio.texi b/doc/posix-headers/sys_uio.texi index 44282f22f6..1f8c8a2c86 100644 --- a/doc/posix-headers/sys_uio.texi +++ b/doc/posix-headers/sys_uio.texi @@ -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 diff --git a/gnulib-tool b/gnulib-tool index a74ba73819..5ff24eacb7 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -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,24 @@ 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 +2746,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}"'/' } @@ -2812,7 +3036,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' \ @@ -2826,16 +3050,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 @@ -3380,6 +3620,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 @@ -3406,6 +3830,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 @@ -4568,22 +4994,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=" @@ -4599,18 +5010,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 @@ -4891,6 +5291,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 @@ -5163,34 +5565,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. @@ -5296,19 +5673,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. diff --git a/lib/allocator.c b/lib/allocator.c new file mode 100644 index 0000000000..2c1a3da03a --- /dev/null +++ b/lib/allocator.c @@ -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 index 0000000000..953117da83 --- /dev/null +++ b/lib/allocator.h @@ -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 */ diff --git a/lib/areadlink.c b/lib/areadlink.c index bc6104f7e8..6bf9a0c415 100644 --- a/lib/areadlink.c +++ b/lib/areadlink.c @@ -24,108 +24,16 @@ /* Specification. */ #include "areadlink.h" -#include <errno.h> -#include <limits.h> -#include <stdint.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#ifndef SSIZE_MAX -# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) -#endif - -/* Use the system functions, not the gnulib overrides in this file. */ -#undef malloc -#undef realloc - -/* The initial buffer size for the link value. A power of 2 - detects arithmetic overflow earlier, but is not required. */ -enum { - INITIAL_BUF_SIZE = 1024 -}; +#include "careadlinkat.h" /* Call readlink to get the symbolic link value of FILENAME. Return a pointer to that NUL-terminated string in malloc'd storage. If readlink fails, return NULL and set errno. - If realloc fails, or if the link value is longer than SIZE_MAX :-), + If allocation fails, or if the link value is longer than SIZE_MAX :-), return NULL and set errno to ENOMEM. */ char * areadlink (char const *filename) { - /* Allocate the initial buffer on the stack. This way, in the common - case of a symlink of small size, we get away with a single small malloc() - instead of a big malloc() followed by a shrinking realloc(). */ - char initial_buf[INITIAL_BUF_SIZE]; - - char *buffer = initial_buf; - size_t buf_size = sizeof initial_buf; - - while (1) - { - /* Attempt to read the link into the current buffer. */ - ssize_t link_length = readlink (filename, buffer, buf_size); - - /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 - with errno == ERANGE if the buffer is too small. */ - if (link_length < 0 && errno != ERANGE) - { - if (buffer != initial_buf) - { - int saved_errno = errno; - free (buffer); - errno = saved_errno; - } - return NULL; - } - - if ((size_t) link_length < buf_size) - { - buffer[link_length++] = '\0'; - - /* Return it in a chunk of memory as small as possible. */ - if (buffer == initial_buf) - { - buffer = (char *) malloc (link_length); - if (buffer == NULL) - { - /* It's easier to set errno to ENOMEM than to rely on the - 'malloc-posix' gnulib module. */ - errno = ENOMEM; - return NULL; - } - memcpy (buffer, initial_buf, link_length); - } - else - { - /* Shrink buffer before returning it. */ - if ((size_t) link_length < buf_size) - { - char *smaller_buffer = (char *) realloc (buffer, link_length); - - if (smaller_buffer != NULL) - buffer = smaller_buffer; - } - } - return buffer; - } - - if (buffer != initial_buf) - free (buffer); - buf_size *= 2; - if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0)) - { - errno = ENOMEM; - return NULL; - } - buffer = (char *) malloc (buf_size); - if (buffer == NULL) - { - /* It's easier to set errno to ENOMEM than to rely on the - 'malloc-posix' gnulib module. */ - errno = ENOMEM; - return NULL; - } - } + return careadlinkat (AT_FDCWD, filename, NULL, 0, NULL, careadlinkatcwd); } diff --git a/lib/areadlinkat.c b/lib/areadlinkat.c index a13c0e506d..2c227f36d9 100644 --- a/lib/areadlinkat.c +++ b/lib/areadlinkat.c @@ -25,101 +25,21 @@ /* Specification. */ #include "areadlink.h" -#include <errno.h> -#include <limits.h> -#include <stdint.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#ifndef SSIZE_MAX -# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) -#endif +#include "careadlinkat.h" #if HAVE_READLINKAT -/* The initial buffer size for the link value. A power of 2 - detects arithmetic overflow earlier, but is not required. */ -enum { - INITIAL_BUF_SIZE = 1024 -}; - /* Call readlinkat to get the symbolic link value of FILENAME relative to FD. Return a pointer to that NUL-terminated string in malloc'd storage. If readlinkat fails, return NULL and set errno (although failure to change directory will issue a diagnostic and exit). - If realloc fails, or if the link value is longer than SIZE_MAX :-), + If allocation fails, or if the link value is longer than SIZE_MAX :-), return NULL and set errno to ENOMEM. */ char * areadlinkat (int fd, char const *filename) { - /* Allocate the initial buffer on the stack. This way, in the common - case of a symlink of small size, we get away with a single small malloc() - instead of a big malloc() followed by a shrinking realloc(). */ - char initial_buf[INITIAL_BUF_SIZE]; - - char *buffer = initial_buf; - size_t buf_size = sizeof initial_buf; - - while (1) - { - /* Attempt to read the link into the current buffer. */ - ssize_t link_length = readlinkat (fd, filename, buffer, buf_size); - - /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 - with errno == ERANGE if the buffer is too small. */ - if (link_length < 0 && errno != ERANGE) - { - if (buffer != initial_buf) - { - int saved_errno = errno; - free (buffer); - errno = saved_errno; - } - return NULL; - } - - if ((size_t) link_length < buf_size) - { - buffer[link_length++] = '\0'; - - /* Return it in a chunk of memory as small as possible. */ - if (buffer == initial_buf) - { - buffer = (char *) malloc (link_length); - if (buffer == NULL) - /* errno is ENOMEM. */ - return NULL; - memcpy (buffer, initial_buf, link_length); - } - else - { - /* Shrink buffer before returning it. */ - if ((size_t) link_length < buf_size) - { - char *smaller_buffer = (char *) realloc (buffer, link_length); - - if (smaller_buffer != NULL) - buffer = smaller_buffer; - } - } - return buffer; - } - - if (buffer != initial_buf) - free (buffer); - buf_size *= 2; - if (SSIZE_MAX < buf_size || (SIZE_MAX / 2 < SSIZE_MAX && buf_size == 0)) - { - errno = ENOMEM; - return NULL; - } - buffer = (char *) malloc (buf_size); - if (buffer == NULL) - /* errno is ENOMEM. */ - return NULL; - } + return careadlinkat (fd, filename, NULL, 0, NULL, readlinkat); } #else /* !HAVE_READLINKAT */ diff --git a/lib/assert.in.h b/lib/assert.in.h new file mode 100644 index 0000000000..1857cebbbb --- /dev/null +++ b/lib/assert.in.h @@ -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. */ diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c index 9bfb44f982..1574ec108c 100644 --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -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 index 0000000000..e2909c766d --- /dev/null +++ b/lib/careadlinkat.c @@ -0,0 +1,171 @@ +/* Read symbolic links into a buffer without size limitation, relative to fd. + + Copyright (C) 2001, 2003-2004, 2007, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#include <config.h> + +#include "careadlinkat.h" + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +/* Define this independently so that stdint.h is not a prerequisite. */ +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t) -1) +#endif + +#ifndef SSIZE_MAX +# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) +#endif + +#include "allocator.h" + +#if ! HAVE_READLINKAT +/* Get the symbolic link value of FILENAME and put it into BUFFER, with + size BUFFER_SIZE. This function acts like readlink but has + readlinkat's signature. */ +ssize_t +careadlinkatcwd (int fd, char const *filename, char *buffer, + size_t buffer_size) +{ + /* FD must be AT_FDCWD here, otherwise the caller is using this + function in contexts for which it was not meant for. */ + if (fd != AT_FDCWD) + abort (); + return readlink (filename, buffer, buffer_size); +} +#endif + +/* Assuming the current directory is FD, get the symbolic link value + of FILENAME as a null-terminated string and put it into a buffer. + If FD is AT_FDCWD, FILENAME is interpreted relative to the current + working directory, as in openat. + + If the link is small enough to fit into BUFFER put it there. + BUFFER's size is BUFFER_SIZE, and BUFFER can be null + if BUFFER_SIZE is zero. + + If the link is not small, put it into a dynamically allocated + buffer managed by ALLOC. It is the caller's responsibility to free + the returned value if it is nonnull and is not BUFFER. A null + ALLOC stands for the standard allocator. + + The PREADLINKAT function specifies how to read links. It operates + like POSIX readlinkat() + <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html> + but can assume that its first argument is the same as FD. + + If successful, return the buffer address; otherwise return NULL and + set errno. */ + +char * +careadlinkat (int fd, char const *filename, + char *buffer, size_t buffer_size, + struct allocator const *alloc, + ssize_t (*preadlinkat) (int, char const *, char *, size_t)) +{ + char *buf; + size_t buf_size; + size_t buf_size_max = + SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; + char stack_buf[1024]; + + if (! alloc) + alloc = &stdlib_allocator; + + if (! buffer_size) + { + /* Allocate the initial buffer on the stack. This way, in the + common case of a symlink of small size, we get away with a + single small malloc() instead of a big malloc() followed by a + shrinking realloc(). */ + buffer = stack_buf; + buffer_size = sizeof stack_buf; + } + + buf = buffer; + buf_size = buffer_size; + + do + { + /* Attempt to read the link into the current buffer. */ + ssize_t link_length = preadlinkat (fd, filename, buf, buf_size); + size_t link_size; + if (link_length < 0) + { + /* On AIX 5L v5.3 and HP-UX 11i v2 04/09, readlink returns -1 + with errno == ERANGE if the buffer is too small. */ + int readlinkat_errno = errno; + if (readlinkat_errno != ERANGE) + { + if (buf != buffer) + { + alloc->free (buf); + errno = readlinkat_errno; + } + return NULL; + } + } + + link_size = link_length; + + if (link_size < buf_size) + { + buf[link_size++] = '\0'; + + if (buf == stack_buf) + { + char *b = (char *) alloc->allocate (link_size); + if (! b) + break; + memcpy (b, buf, link_size); + buf = b; + } + else if (link_size < buf_size && buf != buffer && alloc->reallocate) + { + /* Shrink BUF before returning it. */ + char *b = (char *) alloc->reallocate (buf, link_size); + if (b) + buf = b; + } + + return buf; + } + + if (buf != buffer) + alloc->free (buf); + + if (buf_size <= buf_size_max / 2) + buf_size *= 2; + else if (buf_size < buf_size_max) + buf_size = buf_size_max; + else + break; + buf = (char *) alloc->allocate (buf_size); + } + while (buf); + + if (alloc->die) + alloc->die (); + errno = ENOMEM; + return NULL; +} diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h new file mode 100644 index 0000000000..4f0184bbc3 --- /dev/null +++ b/lib/careadlinkat.h @@ -0,0 +1,73 @@ +/* Read symbolic links into a buffer without size limitation, relative to fd. + + Copyright (C) 2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#ifndef _GL_CAREADLINKAT_H +#define _GL_CAREADLINKAT_H + +#include <fcntl.h> +#include <unistd.h> + +struct allocator; + +/* Assuming the current directory is FD, get the symbolic link value + of FILENAME as a null-terminated string and put it into a buffer. + If FD is AT_FDCWD, FILENAME is interpreted relative to the current + working directory, as in openat. + + If the link is small enough to fit into BUFFER put it there. + BUFFER's size is BUFFER_SIZE, and BUFFER can be null + if BUFFER_SIZE is zero. + + If the link is not small, put it into a dynamically allocated + buffer managed by ALLOC. It is the caller's responsibility to free + the returned value if it is nonnull and is not BUFFER. + + The PREADLINKAT function specifies how to read links. It operates + like POSIX readlinkat() + <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html> + but can assume that its first argument is the same as FD. + + If successful, return the buffer address; otherwise return NULL and + set errno. */ + +char *careadlinkat (int fd, char const *filename, + char *buffer, size_t buffer_size, + struct allocator const *alloc, + ssize_t (*preadlinkat) (int, char const *, + char *, size_t)); + +/* Suitable values for careadlinkat's FD and PREADLINKAT arguments, + when doing a plain readlink: + Pass FD = AT_FDCWD and PREADLINKAT = careadlinkatcwd. */ +#if HAVE_READLINKAT +/* AT_FDCWD is declared in <fcntl.h>, readlinkat in <unistd.h>. */ +# define careadlinkatcwd readlinkat +#else +/* Define AT_FDCWD independently, so that the careadlinkat module does + not depend on the fcntl-h module. The value does not matter, since + careadlinkatcwd ignores it, but we might as well use the same value + as fcntl-h. */ +# ifndef AT_FDCWD +# define AT_FDCWD (-3041965) +# endif +ssize_t careadlinkatcwd (int fd, char const *filename, + char *buffer, size_t buffer_size); +#endif + +#endif /* _GL_CAREADLINKAT_H */ diff --git a/lib/clean-temp.h b/lib/clean-temp.h index 07c45ab22d..8a0774dcac 100644 --- a/lib/clean-temp.h +++ b/lib/clean-temp.h @@ -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.h b/lib/close-hook.h deleted file mode 100644 index adcf11c22a..0000000000 --- a/lib/close-hook.h +++ /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 */ diff --git a/lib/close.c b/lib/close.c index 1c06c166f7..2c41c75b8b 100644 --- a/lib/close.c +++ b/lib/close.c @@ -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 diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h index 930e861e64..093165c154 100644 --- a/lib/count-one-bits.h +++ b/lib/count-one-bits.h @@ -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) diff --git a/lib/dup3.c b/lib/dup3.c index 2f87da6167..7525142d7f 100644 --- a/lib/dup3.c +++ b/lib/dup3.c @@ -26,20 +26,6 @@ #include "binary-io.h" -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Native Woe32 API. */ - -# include <string.h> - -/* Get declarations of the Win32 API functions. */ -# define WIN32_LEAN_AND_MEAN -# include <windows.h> - -/* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ -# define OPEN_MAX_MAX 0x10000 - -#endif - int dup3 (int oldfd, int newfd, int flags) { diff --git a/lib/fchdir.c b/lib/fchdir.c index 94c4e71871..6dd704f625 100644 --- a/lib/fchdir.c +++ b/lib/fchdir.c @@ -29,19 +29,13 @@ #include <sys/types.h> #include <sys/stat.h> +#include "dosname.h" +#include "filenamecat.h" + #ifndef REPLACE_OPEN_DIRECTORY # define REPLACE_OPEN_DIRECTORY 0 #endif -#ifndef HAVE_CANONICALIZE_FILE_NAME -# if GNULIB_CANONICALIZE || GNULIB_CANONICALIZE_LGPL -# define HAVE_CANONICALIZE_FILE_NAME 1 -# else -# define HAVE_CANONICALIZE_FILE_NAME 0 -# define canonicalize_file_name(name) NULL -# endif -#endif - /* This replacement assumes that a directory is not renamed while opened through a file descriptor. @@ -90,36 +84,26 @@ 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; } diff --git a/lib/fclose.c b/lib/fclose.c index 1d7e85b668..bed561bdb1 100644 --- a/lib/fclose.c +++ b/lib/fclose.c @@ -22,18 +22,30 @@ #include <errno.h> #include <unistd.h> -/* Override fclose() to call the overridden close(). */ +#include "freading.h" + +/* Override fclose() to call the overridden fflush() or close(). */ int rpl_fclose (FILE *fp) #undef fclose { int saved_errno = 0; - - if (fflush (fp)) + int fd; + + /* Don't change behavior on memstreams. */ + fd = fileno (fp); + if (fd < 0) + return fclose (fp); + + /* We only need to flush the file if it is not reading or if it is + seekable. This only guarantees the file position of input files + if the fflush module is also in use. */ + if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1) + && fflush (fp)) saved_errno = errno; - if (close (fileno (fp)) < 0 && saved_errno == 0) + if (close (fd) < 0 && saved_errno == 0) saved_errno = errno; fclose (fp); /* will fail with errno = EBADF */ diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index 18cac454ab..ce7c8c016c 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -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 @@ -247,6 +259,11 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # define O_TTY_INIT 0 #endif +#if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) +# undef O_ACCMODE +# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) +#endif + /* For systems that distinguish between text and binary I/O. O_BINARY is usually declared in fcntl.h */ #if !defined O_BINARY && defined _O_BINARY diff --git a/lib/close-hook.c b/lib/fd-hook.c index 0fdf323588..40fbeeb345 100644 --- a/lib/close-hook.c +++ b/lib/fd-hook.c @@ -1,4 +1,4 @@ -/* Hook for making the close() function extensible. +/* 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. @@ -18,13 +18,9 @@ #include <config.h> /* Specification. */ -#include "close-hook.h" +#include "fd-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. */ @@ -32,49 +28,77 @@ /* The first and last link in the doubly linked list. Initially the list is empty. */ -static struct close_hook anchor = { &anchor, &anchor, NULL }; +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_close_hooks (int fd, const struct close_hook *remaining_list) +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 close (fd); + return primary (fd, request, arg); else - return remaining_list->private_fn (fd, remaining_list->private_next); + return remaining_list->private_ioctl_fn (remaining_list->private_next, + primary, fd, request, arg); } int -execute_all_close_hooks (int fd) +execute_all_ioctl_hooks (gl_ioctl_fn primary, + int fd, int request, void *arg) { - return execute_close_hooks (fd, anchor.private_next); + return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg); } void -register_close_hook (close_hook_fn hook, struct close_hook *link) +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_fn = hook; + 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_fn != hook) + if (link->private_close_fn != close_hook + || link->private_ioctl_fn != ioctl_hook) abort (); } } void -unregister_close_hook (struct close_hook *link) +unregister_fd_hook (struct fd_hook *link) { - struct close_hook *next = link->private_next; - struct close_hook *prev = link->private_prev; + struct fd_hook *next = link->private_next; + struct fd_hook *prev = link->private_prev; if (next != NULL && prev != NULL) { @@ -84,7 +108,8 @@ unregister_close_hook (struct close_hook *link) /* Clear the link, to mark it unused. */ link->private_next = NULL; link->private_prev = NULL; - link->private_fn = NULL; + link->private_close_fn = NULL; + link->private_ioctl_fn = NULL; } } diff --git a/lib/fd-hook.h b/lib/fd-hook.h new file mode 100644 index 0000000000..aab4d913c1 --- /dev/null +++ b/lib/fd-hook.h @@ -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 */ diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c index ee595e1a7e..f758f8e909 100644 --- a/lib/gai_strerror.c +++ b/lib/gai_strerror.c @@ -32,6 +32,22 @@ # define N_(String) String #endif +#if HAVE_DECL_GAI_STRERROR + +# include <sys/socket.h> +# undef gai_strerror +# if HAVE_DECL_GAI_STRERRORA +# define gai_strerror gai_strerrorA +# endif + +const char * +rpl_gai_strerror (int code) +{ + return gai_strerror (code); +} + +#else /* !HAVE_DECL_GAI_STRERROR */ + static struct { int code; @@ -71,6 +87,7 @@ gai_strerror (int code) return _("Unknown error"); } -#ifdef _LIBC +# ifdef _LIBC libc_hidden_def (gai_strerror) -#endif +# endif +#endif /* !HAVE_DECL_GAI_STRERROR */ diff --git a/lib/getcwd-lgpl.c b/lib/getcwd-lgpl.c new file mode 100644 index 0000000000..53c5562357 --- /dev/null +++ b/lib/getcwd-lgpl.c @@ -0,0 +1,118 @@ +/* Copyright (C) 2011 Free Software Foundation, Inc. + This file is part of gnulib. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +/* Specification */ +#include <unistd.h> + +#include <errno.h> +#include <string.h> + +#if GNULIB_GETCWD +/* Favor GPL getcwd.c if both getcwd and getcwd-lgpl modules are in use. */ +typedef int dummy; +#else + +/* Get the name of the current working directory, and put it in SIZE + bytes of BUF. Returns NULL if the directory couldn't be determined + (perhaps because the absolute name was longer than PATH_MAX, or + because of missing read/search permissions on parent directories) + or SIZE was too small. If successful, returns BUF. If BUF is + NULL, an array is allocated with `malloc'; the array is SIZE bytes + long, unless SIZE == 0, in which case it is as big as + necessary. */ + +# undef getcwd +char * +rpl_getcwd (char *buf, size_t size) +{ + char *ptr; + char *result; + + /* Handle single size operations. */ + if (buf) + return getcwd (buf, size); + + if (size) + { + buf = malloc (size); + if (!buf) + { + errno = ENOMEM; + return NULL; + } + result = getcwd (buf, size); + if (!result) + { + int saved_errno = errno; + free (buf); + errno = saved_errno; + } + return result; + } + + /* Flexible sizing requested. Avoid over-allocation for the common + case of a name that fits within a 4k page, minus some space for + local variables, to be sure we don't skip over a guard page. */ + { + char tmp[4032]; + size = sizeof tmp; + ptr = getcwd (tmp, size); + if (ptr) + { + result = strdup (ptr); + if (!result) + errno = ENOMEM; + return result; + } + if (errno != ERANGE) + return NULL; + } + + /* My what a large directory name we have. */ + do + { + size <<= 1; + ptr = realloc (buf, size); + if (ptr == NULL) + { + free (buf); + errno = ENOMEM; + return NULL; + } + buf = ptr; + result = getcwd (buf, size); + } + while (!result && errno == ERANGE); + + if (!result) + { + int saved_errno = errno; + free (buf); + errno = saved_errno; + } + else + { + /* Trim to fit, if possible. */ + result = realloc (buf, strlen (buf) + 1); + if (!result) + result = buf; + } + return result; +} + +#endif diff --git a/lib/getsockopt.c b/lib/getsockopt.c index c136772a85..d82ea5ff21 100644 --- a/lib/getsockopt.c +++ b/lib/getsockopt.c @@ -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); diff --git a/lib/hash.c b/lib/hash.c index f3de2aaaac..4d76f765e9 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -27,7 +27,7 @@ #include "hash.h" #include "bitrotate.h" -#include "xalloc.h" +#include "xalloc-oversized.h" #include <stdint.h> #include <stdio.h> diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index 6a8f46dddc..7abf39403f 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -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 diff --git a/lib/ioctl.c b/lib/ioctl.c index 4bbed7653d..c6ba989ee5 100644 --- a/lib/ioctl.c +++ b/lib/ioctl.c @@ -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 diff --git a/lib/malloc.c b/lib/malloc.c index 73c503fac7..ef07f6c427 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -18,6 +18,7 @@ /* written by Jim Meyering and Bruno Haible */ +#define _GL_USE_STDLIB_ALLOC 1 #include <config.h> /* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ #ifdef malloc @@ -28,14 +29,10 @@ # define NEED_MALLOC_GNU 1 #endif -/* Specification. */ #include <stdlib.h> #include <errno.h> -/* Call the system's malloc below. */ -#undef malloc - /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ diff --git a/lib/malloca.c b/lib/malloca.c index be3783e9d3..45d3075b9a 100644 --- a/lib/malloca.c +++ b/lib/malloca.c @@ -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 diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c index d9c25cced6..7a8e5996d0 100644 --- a/lib/mbrtowc.c +++ b/lib/mbrtowc.c @@ -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; diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c index 5c79915bcc..e0aa250ca4 100644 --- a/lib/mgetgroups.c +++ b/lib/mgetgroups.c @@ -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; -} diff --git a/lib/mgetgroups.h b/lib/mgetgroups.h index a1fd040e73..7a572bc2f7 100644 --- a/lib/mgetgroups.h +++ b/lib/mgetgroups.h @@ -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 diff --git a/lib/mkstemp.c b/lib/mkstemp.c index b0a8df306a..3c8437e5a4 100644 --- a/lib/mkstemp.c +++ b/lib/mkstemp.c @@ -38,7 +38,11 @@ /* Generate a unique temporary file name from XTEMPLATE. The last six characters of XTEMPLATE must be "XXXXXX"; they are replaced with a string that makes the file name unique. - Then open the file and return a fd. */ + Then open the file and return a fd. + + If you are creating temporary files which will later be removed, + consider using the clean-temp module, which avoids several pitfalls + of using mkstemp directly. */ int mkstemp (char *xtemplate) { diff --git a/lib/netdb.in.h b/lib/netdb.in.h index d789e34224..6951d3da49 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -41,6 +41,8 @@ 'struct hostent' on MinGW. */ #include <sys/socket.h> +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ @@ -52,6 +54,10 @@ # if !@HAVE_STRUCT_ADDRINFO@ +# ifdef __cplusplus +extern "C" { +# endif + # if !GNULIB_defined_struct_addrinfo /* Structure to contain information about address of a service provider. */ struct addrinfo @@ -67,6 +73,11 @@ 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 diff --git a/lib/nonblocking.c b/lib/nonblocking.c index f28e4231b0..9f7bce916f 100644 --- a/lib/nonblocking.c +++ b/lib/nonblocking.c @@ -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 diff --git a/lib/open.c b/lib/open.c index 2e2cc74dc6..e60b619949 100644 --- a/lib/open.c +++ b/lib/open.c @@ -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"; diff --git a/lib/passfd.c b/lib/passfd.c index 1ab94b48b3..945882045e 100644 --- a/lib/passfd.c +++ b/lib/passfd.c @@ -24,20 +24,23 @@ #include <stdlib.h> #include <string.h> #include <sys/types.h> -#include <sys/uio.h> #include <unistd.h> #include <sys/socket.h> -#if HAVE_SYS_UN_H -# include <sys/un.h> -#endif #include "cloexec.h" +/* The code that uses CMSG_FIRSTHDR is enabled on + Linux, MacOS X, FreeBSD, OpenBSD, NetBSD, AIX, OSF/1, Cygwin. + The code that uses HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS is enabled on + HP-UX, IRIX, Solaris. */ + +/* MSG_CMSG_CLOEXEC is defined only on Linux, as of 2011. */ #ifndef MSG_CMSG_CLOEXEC # define MSG_CMSG_CLOEXEC 0 #endif +#if HAVE_SENDMSG /* sendfd sends the file descriptor fd along the socket to a process calling recvfd on the other end. @@ -46,24 +49,24 @@ int sendfd (int sock, int fd) { - char send = 0; + char byte = 0; struct iovec iov; struct msghdr msg; -#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# ifdef CMSG_FIRSTHDR struct cmsghdr *cmsg; char buf[CMSG_SPACE (sizeof fd)]; -#endif +# endif /* send at least one char */ memset (&msg, 0, sizeof msg); - iov.iov_base = &send; + iov.iov_base = &byte; iov.iov_len = 1; msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_name = NULL; msg.msg_namelen = 0; -#if HAVE_UNIXSOCKET_SCM_RIGHTS_BSD44_WAY +# ifdef CMSG_FIRSTHDR msg.msg_control = buf; msg.msg_controllen = sizeof buf; cmsg = CMSG_FIRSTHDR (&msg); @@ -72,19 +75,29 @@ 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 diff --git a/lib/pipe-filter-aux.h b/lib/pipe-filter-aux.h index 118970b850..8c6cb747aa 100644 --- a/lib/pipe-filter-aux.h +++ b/lib/pipe-filter-aux.h @@ -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 diff --git a/lib/pipe2.c b/lib/pipe2.c index 4fa014f82b..18098c4b4e 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -24,6 +24,7 @@ #include <fcntl.h> #include "binary-io.h" +#include "nonblocking.h" #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Native Woe32 API. */ @@ -55,34 +56,37 @@ 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) + 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; } + 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]. */ if (flags & O_NONBLOCK) { @@ -121,6 +125,8 @@ pipe2 (int fd[2], int flags) return 0; +#endif + fail: { int saved_errno = errno; @@ -129,6 +135,4 @@ pipe2 (int fd[2], int flags) errno = saved_errno; return -1; } - -#endif } diff --git a/lib/progreloc.c b/lib/progreloc.c index 0769c5e1cb..4a3fa48be4 100644 --- a/lib/progreloc.c +++ b/lib/progreloc.c @@ -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 diff --git a/lib/quotearg.c b/lib/quotearg.c index fb4955993e..da8ba1eac6 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -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 index 0000000000..21b90db675 --- /dev/null +++ b/lib/read.c @@ -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 diff --git a/lib/realloc.c b/lib/realloc.c index 6ef37e794f..0c96ffacba 100644 --- a/lib/realloc.c +++ b/lib/realloc.c @@ -18,6 +18,7 @@ /* written by Jim Meyering and Bruno Haible */ +#define _GL_USE_STDLIB_ALLOC 1 #include <config.h> /* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */ @@ -34,23 +35,10 @@ # define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1 #endif -/* Below we want to call the system's malloc and realloc. - Undefine the symbols here so that including <stdlib.h> provides a - declaration of malloc(), not of rpl_malloc(), and likewise for realloc. */ -#undef malloc -#undef realloc - -/* Specification. */ #include <stdlib.h> #include <errno.h> -/* Below we want to call the system's malloc and realloc. - Undefine the symbols, if they were defined by gnulib's <stdlib.h> - replacement. */ -#undef malloc -#undef realloc - /* Change the size of an allocated block of memory P to N bytes, with error checking. If N is zero, change it to 1. If P is NULL, use malloc. */ diff --git a/lib/relocatable.c b/lib/relocatable.c index cbff85fa62..a7bbd99dca 100644 --- a/lib/relocatable.c +++ b/lib/relocatable.c @@ -25,6 +25,7 @@ # define _GNU_SOURCE 1 #endif +#define _GL_USE_STDLIB_ALLOC 1 #include <config.h> /* Specification. */ @@ -86,9 +87,6 @@ # define FILE_SYSTEM_PREFIX_LEN(P) 0 #endif -/* Use the system functions, not the gnulib overrides in this file. */ -#undef malloc - /* Original installation prefix. */ static char *orig_prefix; static size_t orig_prefix_len; diff --git a/lib/relocwrapper.c b/lib/relocwrapper.c index 2f4e8456b6..a64b54d5f8 100644 --- a/lib/relocwrapper.c +++ b/lib/relocwrapper.c @@ -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}". */ diff --git a/lib/save-cwd.c b/lib/save-cwd.c index 16ffa2c490..5f8eb7ca53 100644 --- a/lib/save-cwd.c +++ b/lib/save-cwd.c @@ -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 diff --git a/lib/setenv.c b/lib/setenv.c index 7c061925dd..173d95f28b 100644 --- a/lib/setenv.c +++ b/lib/setenv.c @@ -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 diff --git a/lib/signal.in.h b/lib/signal.in.h index 7a6d6ee856..036e4f2deb 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -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 diff --git a/lib/sockets.c b/lib/sockets.c index 4e905e1ddd..42b8f9ea58 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -27,13 +27,15 @@ /* This includes winsock2.h on MinGW. */ # include <sys/socket.h> -# include "close-hook.h" +# include "fd-hook.h" /* Get set_winsock_errno, FD_TO_SOCKET etc. */ # include "w32sock.h" static int -close_fd_maybe_socket (int fd, const struct close_hook *remaining_list) +close_fd_maybe_socket (const struct fd_hook *remaining_list, + gl_close_fn primary, + int fd) { SOCKET sock; WSANETWORKEVENTS ev; @@ -64,10 +66,38 @@ 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 +120,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 +138,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) diff --git a/lib/stat-time.h b/lib/stat-time.h index 8a119788b8..d36a78ec54 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -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; diff --git a/lib/stdio-read.c b/lib/stdio-read.c new file mode 100644 index 0000000000..d7901dd676 --- /dev/null +++ b/lib/stdio-read.c @@ -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 diff --git a/lib/stdio-write.c b/lib/stdio-write.c index 10fcfba9e3..a586c35120 100644 --- a/lib/stdio-write.c +++ b/lib/stdio-write.c @@ -20,8 +20,9 @@ /* Specification. */ #include <stdio.h> -/* Replace these functions only if module 'sigpipe' is requested. */ -#if GNULIB_SIGPIPE +/* Replace these functions only if module 'nonblocking' or module 'sigpipe' is + requested. */ +#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE /* On native Windows platforms, SIGPIPE does not exist. When write() is called on a pipe with no readers, WriteFile() fails with error @@ -38,26 +39,73 @@ # define WIN32_LEAN_AND_MEAN /* avoid including junk */ # include <windows.h> +# if GNULIB_NONBLOCKING +# define CLEAR_ERRNO \ + errno = 0; +# define HANDLE_ENOSPC \ + if (errno == ENOSPC && ferror (stream)) \ + { \ + int fd = fileno (stream); \ + if (fd >= 0) \ + { \ + HANDLE h = (HANDLE) _get_osfhandle (fd); \ + if (GetFileType (h) == FILE_TYPE_PIPE) \ + { \ + /* h is a pipe or socket. */ \ + DWORD state; \ + if (GetNamedPipeHandleState (h, &state, NULL, NULL, \ + NULL, NULL, 0) \ + && (state & PIPE_NOWAIT) != 0) \ + /* h is a pipe in non-blocking mode. \ + Change errno from ENOSPC to EAGAIN. */ \ + errno = EAGAIN; \ + } \ + } \ + } \ + else +# else +# define CLEAR_ERRNO +# define HANDLE_ENOSPC +# endif + +# if GNULIB_SIGPIPE +# define CLEAR_LastError \ + SetLastError (0); +# define HANDLE_ERROR_NO_DATA \ + if (GetLastError () == ERROR_NO_DATA && ferror (stream)) \ + { \ + int fd = fileno (stream); \ + if (fd >= 0 \ + && GetFileType ((HANDLE) _get_osfhandle (fd)) \ + == FILE_TYPE_PIPE) \ + { \ + /* Try to raise signal SIGPIPE. */ \ + raise (SIGPIPE); \ + /* If it is currently blocked or ignored, change errno from \ + EINVAL to EPIPE. */ \ + errno = EPIPE; \ + } \ + } \ + else +# else +# define CLEAR_LastError +# define HANDLE_ERROR_NO_DATA +# endif + # define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \ if (ferror (stream)) \ return (EXPRESSION); \ else \ { \ RETTYPE ret; \ - SetLastError (0); \ + CLEAR_ERRNO \ + CLEAR_LastError \ ret = (EXPRESSION); \ - if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \ + if (FAILED) \ { \ - int fd = fileno (stream); \ - if (fd >= 0 \ - && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\ - { \ - /* Try to raise signal SIGPIPE. */ \ - raise (SIGPIPE); \ - /* If it is currently blocked or ignored, change errno from \ - EINVAL to EPIPE. */ \ - errno = EPIPE; \ - } \ + HANDLE_ENOSPC \ + HANDLE_ERROR_NO_DATA \ + ; \ } \ return ret; \ } diff --git a/lib/stdio.in.h b/lib/stdio.in.h index f12d3be8e8..79e7f7d8aa 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -87,6 +87,25 @@ #define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) +/* _GL_ATTRIBUTE_FORMAT_SCANF + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) +#else +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) +#endif + +/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, + except that it indicates to GCC that the supported format string directives + are the ones of the system scanf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) + /* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */ /* But in any case avoid namespace pollution on glibc systems. */ #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \ @@ -175,11 +194,34 @@ _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) diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 2697a4bd1d..7513553b67 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -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 - " diff --git a/lib/string.in.h b/lib/string.in.h index 652c9407bc..f120a1b094 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -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)); diff --git a/lib/strptime.c b/lib/strptime.c index 9e4394b883..6cf44bce42 100644 --- a/lib/strptime.c +++ b/lib/strptime.c @@ -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 diff --git a/lib/strtol.c b/lib/strtol.c index b6a761ecb9..6c15d11e8f 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -186,9 +186,8 @@ # define LOCALE_PARAM_PROTO #endif -#include <wchar.h> - #ifdef USE_WIDE_CHAR +# include <wchar.h> # include <wctype.h> # define L_(Ch) L##Ch # define UCHAR_TYPE wint_t diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index b60789f2a1..78026697bd 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -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 index 0000000000..0eaff612a3 --- /dev/null +++ b/lib/sys_uio.in.h @@ -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 */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 156e864f3c..d216e38515 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -97,7 +97,8 @@ # include <netdb.h> #endif -#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ +#if (@GNULIB_READ@ || @GNULIB_WRITE@ \ + || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) /* Get ssize_t. */ # include <sys/types.h> @@ -1105,6 +1106,28 @@ _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 +1382,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 diff --git a/lib/utimecmp.c b/lib/utimecmp.c index 356763ff61..c0f6713e3b 100644 --- a/lib/utimecmp.c +++ b/lib/utimecmp.c @@ -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; diff --git a/lib/verify.h b/lib/verify.h index 5e91abdbec..e5065ffa00 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -17,21 +17,41 @@ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ -#ifndef VERIFY_H -# define VERIFY_H 1 +#ifndef _GL_VERIFY_H +# define _GL_VERIFY_H + + +/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the + C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and + later, in C mode, and its use here generates easier-to-read diagnostics + when verify (R) fails. + + Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the + C++0X draft N3242 section 7.(4). + This will likely be supported by future GCC versions, in C++ mode. + + Use this only with GCC. If we were willing to slow 'configure' + down we could also use it with other compilers, but since this + affects only the quality of diagnostics, why bother? */ +# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus +# define _GL_HAVE__STATIC_ASSERT 1 +# endif +/* The condition (99 < __GNUC__) is temporary, until we know about the + first G++ release that supports static_assert. */ +# if (99 < __GNUC__) && defined __cplusplus +# define _GL_HAVE_STATIC_ASSERT 1 +# endif /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. - There are two macros, since no single macro can be used in all - contexts in C. verify_true (R) is for scalar contexts, including - integer constant expression contexts. verify (R) is for declaration - contexts, e.g., the top level. - - 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, @@ -91,11 +113,11 @@ Which of the following alternatives can be used? extern int dummy [sizeof (struct {...})]; - extern int dummy [sizeof (struct verify_type__ {...})]; + extern int dummy [sizeof (struct _gl_verify_type {...})]; extern void dummy (int [sizeof (struct {...})]); - extern void dummy (int [sizeof (struct verify_type__ {...})]); + extern void dummy (int [sizeof (struct _gl_verify_type {...})]); extern int (*dummy (void)) [sizeof (struct {...})]; - extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; + extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; In the second and sixth case, the struct type is exported to the outer scope; two such declarations therefore collide. GCC warns @@ -109,15 +131,9 @@ __COUNTER__ macro that can let us generate unique identifiers for each dummy function, to suppress this warning. - * This implementation exploits the fact that GCC does not warn about - the last declaration mentioned above. If a future version of GCC - introduces a warning for this, the problem could be worked around - by using code specialized to GCC, just as __COUNTER__ is already - being used if available. - - #if 4 <= __GNUC__ - # define verify(R) [another version to keep GCC happy] - #endif + * This implementation exploits the fact that older versions of GCC, + which do not support _Static_assert, also do not warn about the + last declaration mentioned above. * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ @@ -140,24 +156,75 @@ possible. */ # define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) -/* Verify requirement R at compile-time, as an integer constant expression. - Return 1. */ +/* Verify requirement R at compile-time, as an integer constant expression + that returns 1. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. */ + +# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ + (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) # ifdef __cplusplus template <int w> - struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; -# define verify_true(R) \ - (!!sizeof (verify_type__<(R) ? 1 : -1>)) + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: w; + }; +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + _gl_verify_type<(R) ? 1 : -1> +# elif defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { \ + _Static_assert (R, DIAGNOSTIC); \ + int _gl_dummy; \ + } +# else +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } +# endif + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. + + Unfortunately, unlike C1X, this implementation must appear as an + ordinary declaration, and cannot appear inside struct { ... }. */ + +# ifdef _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY _Static_assert # else -# define verify_true(R) \ - (!!sizeof \ - (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; })) +# define _GL_VERIFY(R, DIAGNOSTIC) \ + extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ + [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] # endif +/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ +# ifdef _GL_STATIC_ASSERT_H +# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert +# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) +# endif +# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert +# define static_assert _Static_assert /* Draft C1X requires this #define. */ +# endif +# else + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_true (R) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. */ + +/* Verify requirement R at compile-time, as an integer constant expression. + Return 1. */ + +# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") + /* Verify requirement R at compile-time, as a declaration without a trailing ';'. */ -# define verify(R) \ - extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] +# define verify(R) _GL_VERIFY (R, "verify (" #R ")") + +# endif #endif diff --git a/lib/wchar.in.h b/lib/wchar.in.h index d2bf17d6eb..c7f306a9c0 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -61,9 +61,13 @@ <wchar.h>. BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included before <wchar.h>. + In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined + by <stddef.h>. But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ +#if !(defined __GLIBC__ && !defined __UCLIBC__) # include <stddef.h> +#endif +#ifndef __GLIBC__ # include <stdio.h> # include <time.h> #endif diff --git a/lib/write.c b/lib/write.c index 4cf296255f..b0ffa94e93 100644 --- a/lib/write.c +++ b/lib/write.c @@ -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 index 0000000000..ab19bcf2f9 --- /dev/null +++ b/lib/xalloc-oversized.h @@ -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_ */ diff --git a/lib/xalloc.h b/lib/xalloc.h index 86b9b3e6e0..c1bbe7e5b6 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -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 index 0000000000..41886c9122 --- /dev/null +++ b/lib/xgetgroups.c @@ -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 index 13f758316d..0000000000 --- a/m4/afunix.m4 +++ /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 -]) diff --git a/m4/alloca.m4 b/m4/alloca.m4 index e2e8a05a6e..689da75a2a 100644 --- a/m4/alloca.m4 +++ b/m4/alloca.m4 @@ -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. diff --git a/m4/argz.m4 b/m4/argz.m4 index f4fa3a0da0..0248a453da 100644 --- a/m4/argz.m4 +++ b/m4/argz.m4 @@ -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. diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4 index d21b162fc7..6dc0fdb58b 100644 --- a/m4/arpa_inet_h.m4 +++ b/m4/arpa_inet_h.m4 @@ -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 index 0000000000..30ca248949 --- /dev/null +++ b/m4/assert_h.m4 @@ -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"]) +]) diff --git a/m4/btowc.m4 b/m4/btowc.m4 index 603298f43f..32bf0cfca0 100644 --- a/m4/btowc.m4 +++ b/m4/btowc.m4 @@ -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 diff --git a/m4/byteswap.m4 b/m4/byteswap.m4 index a033acd8da..2d4de4659f 100644 --- a/m4/byteswap.m4 +++ b/m4/byteswap.m4 @@ -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"]) ]) diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4 index 853ac7dad4..fdc2c440d6 100644 --- a/m4/dirent_h.m4 +++ b/m4/dirent_h.m4 @@ -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. diff --git a/m4/dirfd.m4 b/m4/dirfd.m4 index b8789c2e75..f401f6ced4 100644 --- a/m4/dirfd.m4 +++ b/m4/dirfd.m4 @@ -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 index 0000000000..881649882c --- /dev/null +++ b/m4/dup2-obsolete.m4 @@ -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. + : +]) diff --git a/m4/dup2.m4 b/m4/dup2.m4 index def263b87a..62e31a88d5 100644 --- a/m4/dup2.m4 +++ b/m4/dup2.m4 @@ -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 diff --git a/m4/duplocale.m4 b/m4/duplocale.m4 index 4393d82dfb..d61a8d2c56 100644 --- a/m4/duplocale.m4 +++ b/m4/duplocale.m4 @@ -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 diff --git a/m4/errno_h.m4 b/m4/errno_h.m4 index 687bafff2d..a6d37f3b32 100644 --- a/m4/errno_h.m4 +++ b/m4/errno_h.m4 @@ -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]) diff --git a/m4/fchdir.m4 b/m4/fchdir.m4 index 49d89d1840..829373a707 100644 --- a/m4/fchdir.m4 +++ b/m4/fchdir.m4 @@ -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> diff --git a/m4/fclose.m4 b/m4/fclose.m4 index 278859c6c2..17acf1547a 100644 --- a/m4/fclose.m4 +++ b/m4/fclose.m4 @@ -1,4 +1,4 @@ -# fclose.m4 serial 2 +# fclose.m4 serial 3 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,6 +6,12 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FCLOSE], [ + m4_ifdef([gl_FUNC_FFLUSH_STDIN], [ + gl_FUNC_FFLUSH_STDIN + if test $gl_cv_func_fflush_stdin = no; then + gl_REPLACE_FCLOSE + fi + ]) ]) AC_DEFUN([gl_REPLACE_FCLOSE], diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index 1ef4f455b7..c466da4df5 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -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]) ]) diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4 index f192a62830..05aa77213f 100644 --- a/m4/fdopendir.m4 +++ b/m4/fdopendir.m4 @@ -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 diff --git a/m4/fflush.m4 b/m4/fflush.m4 index f7645deff6..69eb86efe1 100644 --- a/m4/fflush.m4 +++ b/m4/fflush.m4 @@ -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. diff --git a/m4/float_h.m4 b/m4/float_h.m4 index 265a4c1a6e..21a7529fe0 100644 --- a/m4/float_h.m4 +++ b/m4/float_h.m4 @@ -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"]) ]) diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4 index 9b537a7e0c..c8ed9e74e7 100644 --- a/m4/fnmatch.m4 +++ b/m4/fnmatch.m4 @@ -1,4 +1,4 @@ -# Check for fnmatch - serial 5. +# Check for fnmatch - serial 6. # Copyright (C) 2000-2007, 2009-2011 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -139,6 +139,7 @@ AC_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. diff --git a/m4/fseeko.m4 b/m4/fseeko.m4 index 76507d128f..28da81b1cc 100644 --- a/m4/fseeko.m4 +++ b/m4/fseeko.m4 @@ -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. diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4 index 94c276f836..f29e903987 100644 --- a/m4/getaddrinfo.m4 +++ b/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 23 +# getaddrinfo.m4 serial 25 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -62,9 +62,7 @@ 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" @@ -105,11 +124,14 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ dnl Including sys/socket.h is wrong for Windows, but Windows does not dnl have sa_len so the result is correct anyway. - AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>]) + AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [ +#include <sys/types.h> +#include <sys/socket.h> +]) AC_CHECK_HEADERS_ONCE([netinet/in.h]) - AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ + AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[ /* sys/types.h is not needed according to POSIX, but the sys/socket.h in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ diff --git a/m4/getcwd-abort-bug.m4 b/m4/getcwd-abort-bug.m4 index 21be828b62..fd6820dc60 100644 --- a/m4/getcwd-abort-bug.m4 +++ b/m4/getcwd-abort-bug.m4 @@ -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]) diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4 index 2ab264501c..475ae96d16 100644 --- a/m4/getcwd-path-max.m4 +++ b/m4/getcwd-path-max.m4 @@ -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( [[ diff --git a/m4/getcwd.m4 b/m4/getcwd.m4 index 70980567d7..eb2c9d9375 100644 --- a/m4/getcwd.m4 +++ b/m4/getcwd.m4 @@ -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]) diff --git a/m4/getdomainname.m4 b/m4/getdomainname.m4 index b4bf05251d..db7d480ed1 100644 --- a/m4/getdomainname.m4 +++ b/m4/getdomainname.m4 @@ -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], diff --git a/m4/gethostname.m4 b/m4/gethostname.m4 index 9bdfb7c70d..b813c36fb6 100644 --- a/m4/gethostname.m4 +++ b/m4/gethostname.m4 @@ -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], diff --git a/m4/glob.m4 b/m4/glob.m4 index 759c6f84f7..4b79148d32 100644 --- a/m4/glob.m4 +++ b/m4/glob.m4 @@ -1,4 +1,4 @@ -# glob.m4 serial 11 +# glob.m4 serial 12 dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,11 +10,12 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_GLOB_SUBSTITUTE], [ + AC_LIBOBJ([glob]) gl_PREREQ_GLOB GLOB_H=glob.h - AC_LIBOBJ([glob]) AC_SUBST([GLOB_H]) + AM_CONDITIONAL([GL_GENERATE_GLOB_H], [test -n "$GLOB_H"]) ]) AC_DEFUN([gl_GLOB], @@ -65,8 +66,11 @@ 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.*. diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4 index abfacffb49..8cca7fd802 100644 --- a/m4/iconv_h.m4 +++ b/m4/iconv_h.m4 @@ -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"]) ]) diff --git a/m4/imaxabs.m4 b/m4/imaxabs.m4 index 535a26f141..2450353822 100644 --- a/m4/imaxabs.m4 +++ b/m4/imaxabs.m4 @@ -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 diff --git a/m4/imaxdiv.m4 b/m4/imaxdiv.m4 index b23f636c80..4939912c5a 100644 --- a/m4/imaxdiv.m4 +++ b/m4/imaxdiv.m4 @@ -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 diff --git a/m4/inet_ntop.m4 b/m4/inet_ntop.m4 index 57580b8a4a..0167dd2b48 100644 --- a/m4/inet_ntop.m4 +++ b/m4/inet_ntop.m4 @@ -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 diff --git a/m4/inet_pton.m4 b/m4/inet_pton.m4 index 9a7ad3b384..073df21a93 100644 --- a/m4/inet_pton.m4 +++ b/m4/inet_pton.m4 @@ -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 diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index 92a4ac019f..1e81990bda 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 18 +# inttypes.m4 serial 23 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,132 +9,14 @@ 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([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]) ]) diff --git a/m4/ioctl.m4 b/m4/ioctl.m4 index 8cb36d88fe..3c17a2ed47 100644 --- a/m4/ioctl.m4 +++ b/m4/ioctl.m4 @@ -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 ]) diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 index 4d0f894261..e77a3032eb 100644 --- a/m4/locale_h.m4 +++ b/m4/locale_h.m4 @@ -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. diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index e928821952..67db064a9f 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -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 ]) diff --git a/m4/mbrlen.m4 b/m4/mbrlen.m4 index b056895b39..8f55e3627d 100644 --- a/m4/mbrlen.m4 +++ b/m4/mbrlen.m4 @@ -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 diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4 index c353862973..b5b6aaa031 100644 --- a/m4/mbrtowc.m4 +++ b/m4/mbrtowc.m4 @@ -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 diff --git a/m4/mbsinit.m4 b/m4/mbsinit.m4 index 47e2d14a73..b42a49ab49 100644 --- a/m4/mbsinit.m4 +++ b/m4/mbsinit.m4 @@ -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 diff --git a/m4/mbsnrtowcs.m4 b/m4/mbsnrtowcs.m4 index 1ba443e5ad..d72942f033 100644 --- a/m4/mbsnrtowcs.m4 +++ b/m4/mbsnrtowcs.m4 @@ -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 diff --git a/m4/mbsrtowcs.m4 b/m4/mbsrtowcs.m4 index 1fe8dcf27d..4410741d78 100644 --- a/m4/mbsrtowcs.m4 +++ b/m4/mbsrtowcs.m4 @@ -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 index 0000000000..c65f651e13 --- /dev/null +++ b/m4/memchr-obsolete.m4 @@ -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. + : +]) diff --git a/m4/memchr.m4 b/m4/memchr.m4 index 3c2b313916..a544e2b4e7 100644 --- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -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]) diff --git a/m4/mkstemp.m4 b/m4/mkstemp.m4 index c5cd2820d1..0437f14e31 100644 --- a/m4/mkstemp.m4 +++ b/m4/mkstemp.m4 @@ -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 diff --git a/m4/netdb_h.m4 b/m4/netdb_h.m4 index 9a01cd6a76..a54d6701b7 100644 --- a/m4/netdb_h.m4 +++ b/m4/netdb_h.m4 @@ -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]) ]) diff --git a/m4/netinet_in_h.m4 b/m4/netinet_in_h.m4 index e2d022df7a..87235b73bc 100644 --- a/m4/netinet_in_h.m4 +++ b/m4/netinet_in_h.m4 @@ -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 index 0000000000..fd6faeea63 --- /dev/null +++ b/m4/nonblocking.m4 @@ -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 +]) diff --git a/m4/open.m4 b/m4/open.m4 index bfebdab7b6..690cc648d0 100644 --- a/m4/open.m4 +++ b/m4/open.m4 @@ -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 index 0000000000..2028f7f559 --- /dev/null +++ b/m4/passfd.m4 @@ -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> + ]]) +]) diff --git a/m4/poll.m4 b/m4/poll.m4 index 4f8df1e04a..d226e1c011 100644 --- a/m4/poll.m4 +++ b/m4/poll.m4 @@ -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 diff --git a/m4/poll_h.m4 b/m4/poll_h.m4 index 758f29b0bf..3f2abf4974 100644 --- a/m4/poll_h.m4 +++ b/m4/poll_h.m4 @@ -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. diff --git a/m4/pthread.m4 b/m4/pthread.m4 index 9f77cde093..6111185fb0 100644 --- a/m4/pthread.m4 +++ b/m4/pthread.m4 @@ -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 index 0000000000..032761f1ba --- /dev/null +++ b/m4/read.m4 @@ -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 + ]) +]) diff --git a/m4/sched_h.m4 b/m4/sched_h.m4 index 6a46e4745f..9cff891950 100644 --- a/m4/sched_h.m4 +++ b/m4/sched_h.m4 @@ -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"]) ]) diff --git a/m4/selinux-context-h.m4 b/m4/selinux-context-h.m4 index 227ab6bfc7..54a388db75 100644 --- a/m4/selinux-context-h.m4 +++ b/m4/selinux-context-h.m4 @@ -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"]) ]) diff --git a/m4/setlocale.m4 b/m4/setlocale.m4 index 6672c34133..cc3ab776f2 100644 --- a/m4/setlocale.m4 +++ b/m4/setlocale.m4 @@ -1,4 +1,4 @@ -# setlocale.m4 serial 1 +# setlocale.m4 serial 2 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,7 +14,6 @@ AC_DEFUN([gl_FUNC_SETLOCALE], mingw*) REPLACE_SETLOCALE=1 ;; esac if test $REPLACE_SETLOCALE = 1; then - gl_REPLACE_LOCALE_H AC_LIBOBJ([setlocale]) gl_PREREQ_SETLOCALE fi diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 77eb125710..459ec007f3 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -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]) ]) diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4 index a044e372f0..4903b6a4a1 100644 --- a/m4/spawn_h.m4 +++ b/m4/spawn_h.m4 @@ -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. diff --git a/m4/stdarg.m4 b/m4/stdarg.m4 index a1ef178c55..5705de9eca 100644 --- a/m4/stdarg.m4 +++ b/m4/stdarg.m4 @@ -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]) ]) diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 index 838cf0f467..1ebf3e6808 100644 --- a/m4/stdbool.m4 +++ b/m4/stdbool.m4 @@ -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 diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 index 1942b6aa0d..1ae2344318 100644 --- a/m4/stddef_h.m4 +++ b/m4/stddef_h.m4 @@ -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]) ]) diff --git a/m4/stdint.m4 b/m4/stdint.m4 index e7d0d0765a..dff37fe1bf 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 39 +# stdint.m4 serial 40 dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -305,6 +305,7 @@ 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) diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 7f3ae56295..a8326f3c34 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -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]) diff --git a/m4/strchrnul.m4 b/m4/strchrnul.m4 index a64e805bd4..fbfd5aebd5 100644 --- a/m4/strchrnul.m4 +++ b/m4/strchrnul.m4 @@ -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 ]) diff --git a/m4/string_h.m4 b/m4/string_h.m4 index 30ddfbc3a4..df8c40353b 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -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 index 0000000000..baeb898032 --- /dev/null +++ b/m4/strtod-obsolete.m4 @@ -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. + : +]) diff --git a/m4/strtod.m4 b/m4/strtod.m4 index 4619c3357f..f40e342f43 100644 --- a/m4/strtod.m4 +++ b/m4/strtod.m4 @@ -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> diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4 index e82e7cd08f..d46673b2a8 100644 --- a/m4/strtoimax.m4 +++ b/m4/strtoimax.m4 @@ -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 diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4 index 448c4d9b77..7fa563642a 100644 --- a/m4/strtoumax.m4 +++ b/m4/strtoumax.m4 @@ -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 diff --git a/m4/sys_ioctl_h.m4 b/m4/sys_ioctl_h.m4 index 97cab84b06..8c7d112cf9 100644 --- a/m4/sys_ioctl_h.m4 +++ b/m4/sys_ioctl_h.m4 @@ -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 index 0000000000..bafa0ac457 --- /dev/null +++ b/m4/sys_uio_h.m4 @@ -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], +[ +]) diff --git a/m4/sysexits.m4 b/m4/sysexits.m4 index 4d14572278..cff6606c6e 100644 --- a/m4/sysexits.m4 +++ b/m4/sysexits.m4 @@ -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"]) ]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index c81a1138e9..eeb3360b05 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 53 +# unistd_h.m4 serial 55 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -52,47 +52,49 @@ AC_DEFUN([gl_UNISTD_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_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) + GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) + GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) + GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) + GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) + GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) + GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) + GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) + GNULIB_READ=0; AC_SUBST([GNULIB_READ]) + GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) + GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) + GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) + GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) + GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) + GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) + GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) + GNULIB_UNISTD_H_GETOPT=0; AC_SUBST([GNULIB_UNISTD_H_GETOPT]) + GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) + GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) + GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) + GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) + GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) + GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) @@ -147,6 +149,7 @@ 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]) diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index 6255ff352d..977491fe8d 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -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. diff --git a/m4/wcrtomb.m4 b/m4/wcrtomb.m4 index 2905d9ba4d..4f58e3f5de 100644 --- a/m4/wcrtomb.m4 +++ b/m4/wcrtomb.m4 @@ -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 diff --git a/m4/wcsnrtombs.m4 b/m4/wcsnrtombs.m4 index 5607807bfd..ba61129a5b 100644 --- a/m4/wcsnrtombs.m4 +++ b/m4/wcsnrtombs.m4 @@ -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 diff --git a/m4/wcsrtombs.m4 b/m4/wcsrtombs.m4 index 19f0c78a9e..cd51506a2b 100644 --- a/m4/wcsrtombs.m4 +++ b/m4/wcsrtombs.m4 @@ -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 diff --git a/m4/wctob.m4 b/m4/wctob.m4 index 3b4633c42f..b66e755d4d 100644 --- a/m4/wctob.m4 +++ b/m4/wctob.m4 @@ -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 diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4 index bf39d1d238..dbcc231be4 100644 --- a/m4/wcwidth.m4 +++ b/m4/wcwidth.m4 @@ -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. ]) diff --git a/m4/write.m4 b/m4/write.m4 index 8695c89623..63ab5e4c08 100644 --- a/m4/write.m4 +++ b/m4/write.m4 @@ -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 ]) diff --git a/modules/accept b/modules/accept index d1c954edbf..fb46f98a89 100644 --- a/modules/accept +++ b/modules/accept @@ -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]) diff --git a/modules/acosl b/modules/acosl index 3c49196f35..0726070617 100644 --- a/modules/acosl +++ b/modules/acosl @@ -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 diff --git a/modules/alloca-opt b/modules/alloca-opt index 4ae08b0dd8..1f3f2dba05 100644 --- a/modules/alloca-opt +++ b/modules/alloca-opt @@ -20,12 +20,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 index 0000000000..6ff55526c4 --- /dev/null +++ b/modules/allocator @@ -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 diff --git a/modules/areadlink b/modules/areadlink index 316626994f..daf02325a7 100644 --- a/modules/areadlink +++ b/modules/areadlink @@ -6,10 +6,7 @@ lib/areadlink.h lib/areadlink.c Depends-on: -readlink -ssize_t -stdint -unistd +careadlinkat configure.ac: diff --git a/modules/areadlinkat b/modules/areadlinkat index 072f823bef..8c621d5757 100644 --- a/modules/areadlinkat +++ b/modules/areadlinkat @@ -7,7 +7,7 @@ lib/areadlinkat.c Depends-on: areadlink -stdint +careadlinkat readlinkat configure.ac: diff --git a/modules/areadlinkat-tests b/modules/areadlinkat-tests index 422ac61412..23e5278486 100644 --- a/modules/areadlinkat-tests +++ b/modules/areadlinkat-tests @@ -13,4 +13,3 @@ configure.ac: Makefile.am: TESTS += test-areadlinkat check_PROGRAMS += test-areadlinkat -test_areadlinkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/argmatch b/modules/argmatch index 0dd643cdfb..c3225976d6 100644 --- a/modules/argmatch +++ b/modules/argmatch @@ -11,10 +11,10 @@ gettext-h error quotearg quote -exit exitfail verify stdbool +stdlib memcmp configure.ac: diff --git a/modules/argz b/modules/argz index 1a33f37d40..652243e2e5 100644 --- a/modules/argz +++ b/modules/argz @@ -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 @@ -25,12 +25,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: diff --git a/modules/arpa_inet b/modules/arpa_inet index 35c2167a57..92d67aa036 100644 --- a/modules/arpa_inet +++ b/modules/arpa_inet @@ -23,7 +23,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! */'; \ diff --git a/modules/asinl b/modules/asinl index 7f254ab461..19e049c2ac 100644 --- a/modules/asinl +++ b/modules/asinl @@ -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 index 0000000000..50bd9f83e1 --- /dev/null +++ b/modules/assert-h @@ -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 diff --git a/modules/atanl b/modules/atanl index f6ba1b85a9..4f3f9eab64 100644 --- a/modules/atanl +++ b/modules/atanl @@ -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 diff --git a/modules/atoll b/modules/atoll index 5f0571293e..d979a008f2 100644 --- a/modules/atoll +++ b/modules/atoll @@ -7,7 +7,7 @@ m4/atoll.m4 m4/longlong.m4 Depends-on: -strtoll +strtoll [test $HAVE_ATOLL = 0] configure.ac: gl_FUNC_ATOLL diff --git a/modules/binary-io b/modules/binary-io index eb41ec0a3c..4386ec924d 100644 --- a/modules/binary-io +++ b/modules/binary-io @@ -16,7 +16,7 @@ Include: "binary-io.h" License: -LGPL +LGPLv2+ Maintainer: Bruno Haible diff --git a/modules/bind b/modules/bind index 050f0e65c7..5c4595ffda 100644 --- a/modules/bind +++ b/modules/bind @@ -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]) diff --git a/modules/btowc b/modules/btowc index 10c5f3f9a5..1566a2fa71 100644 --- a/modules/btowc +++ b/modules/btowc @@ -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 diff --git a/modules/byteswap b/modules/byteswap index d16af57f6a..760df6e614 100644 --- a/modules/byteswap +++ b/modules/byteswap @@ -18,12 +18,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: diff --git a/modules/canonicalize-lgpl b/modules/canonicalize-lgpl index 6a748f3000..1fb23c29f3 100644 --- a/modules/canonicalize-lgpl +++ b/modules/canonicalize-lgpl @@ -7,16 +7,16 @@ m4/canonicalize.m4 m4/double-slash-root.m4 Depends-on: -alloca-opt -errno extensions -lstat -malloca -memmove -pathmax -readlink stdlib -sys_stat +alloca-opt [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +errno [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +lstat [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +malloca [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +memmove [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +pathmax [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +readlink [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] +sys_stat [test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1] configure.ac: gl_CANONICALIZE_LGPL diff --git a/modules/careadlinkat b/modules/careadlinkat new file mode 100644 index 0000000000..b4bc4a4dfb --- /dev/null +++ b/modules/careadlinkat @@ -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 diff --git a/modules/ceil b/modules/ceil index 90e03fce2c..1a3a5de496 100644 --- a/modules/ceil +++ b/modules/ceil @@ -7,7 +7,7 @@ m4/ceil.m4 Depends-on: math -float +float [test $REPLACE_CEIL = 1] configure.ac: gl_FUNC_CEIL diff --git a/modules/ceilf b/modules/ceilf index 3c0082c783..beba067aea 100644 --- a/modules/ceilf +++ b/modules/ceilf @@ -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 diff --git a/modules/ceill b/modules/ceill index a2365c272b..51d5b92bc5 100644 --- a/modules/ceill +++ b/modules/ceill @@ -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 diff --git a/modules/chdir-long b/modules/chdir-long index 4025b45afc..0c8e7926ef 100644 --- a/modules/chdir-long +++ b/modules/chdir-long @@ -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 diff --git a/modules/chown b/modules/chown index 94bff841c7..ccfeb3bcdd 100644 --- a/modules/chown +++ b/modules/chown @@ -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 diff --git a/modules/close b/modules/close index e294292b02..cbfa08059f 100644 --- a/modules/close +++ b/modules/close @@ -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 index ae32ad0530..0000000000 --- a/modules/close-hook +++ /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 diff --git a/modules/connect b/modules/connect index 1381ffaf91..c90f094382 100644 --- a/modules/connect +++ b/modules/connect @@ -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]) diff --git a/modules/copy-file b/modules/copy-file index 6941e5a8e4..4ca553e302 100644 --- a/modules/copy-file +++ b/modules/copy-file @@ -10,11 +10,11 @@ Depends-on: acl binary-io error -exit full-write gettext-h open safe-read +stdlib unistd xalloc diff --git a/modules/cosl b/modules/cosl index 88ebf9c40e..391a841837 100644 --- a/modules/cosl +++ b/modules/cosl @@ -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 diff --git a/modules/ctype b/modules/ctype index e37e622c64..722adf9b46 100644 --- a/modules/ctype +++ b/modules/ctype @@ -20,7 +20,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' \ diff --git a/modules/dirent b/modules/dirent index 094a84e2b6..624d080684 100644 --- a/modules/dirent +++ b/modules/dirent @@ -22,7 +22,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' \ diff --git a/modules/dirent-safer-tests b/modules/dirent-safer-tests index 172c662de4..2bc95933fd 100644 --- a/modules/dirent-safer-tests +++ b/modules/dirent-safer-tests @@ -10,6 +10,3 @@ configure.ac: Makefile.am: TESTS += test-dirent-safer check_PROGRAMS += test-dirent-safer -# Link with libintl when needed. dirent-safer uses fdopendir if it is present, -# and fdopendir indirectly depends on xgetcwd -> xalloc-die -> gettext-h. -test_dirent_safer_LDADD = $(LDADD) $(LIBINTL) diff --git a/modules/dirfd b/modules/dirfd index 42ff4d7a0f..8410f38d72 100644 --- a/modules/dirfd +++ b/modules/dirfd @@ -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 diff --git a/modules/dprintf b/modules/dprintf index 6ebbde4c0a..8c08def360 100644 --- a/modules/dprintf +++ b/modules/dprintf @@ -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 diff --git a/modules/dprintf-posix b/modules/dprintf-posix index 19a471807e..2423d61628 100644 --- a/modules/dprintf-posix +++ b/modules/dprintf-posix @@ -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 diff --git a/modules/dup2 b/modules/dup2 index cea1a974b5..17cafd1c6a 100644 --- a/modules/dup2 +++ b/modules/dup2 @@ -7,6 +7,7 @@ m4/dup2.m4 Depends-on: unistd +dup2-obsolete configure.ac: gl_FUNC_DUP2 diff --git a/modules/exit b/modules/dup2-obsolete index 18899f28c3..ba71bb97cf 100644 --- a/modules/exit +++ b/modules/dup2-obsolete @@ -1,23 +1,25 @@ Description: -exit() function: program termination. +dup2() function for old platforms. Status: obsolete Notice: -This module is obsolete. It will be removed on 2011-01-01. Use 'stdlib'. +This module is obsolete. Files: +m4/dup2-obsolete.m4 Depends-on: -stdlib +dup2 configure.ac: +gl_FUNC_DUP2_OBSOLETE Makefile.am: Include: -<stdlib.h> +<unistd.h> License: LGPLv2+ diff --git a/modules/errno b/modules/errno index 221bebf0de..d44f377557 100644 --- a/modules/errno +++ b/modules/errno @@ -19,7 +19,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' \ @@ -35,6 +36,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: diff --git a/modules/error b/modules/error index 7d43aba1cc..a1ec1e953f 100644 --- a/modules/error +++ b/modules/error @@ -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 diff --git a/modules/euidaccess b/modules/euidaccess index 93333f5e8e..56bcf28f1b 100644 --- a/modules/euidaccess +++ b/modules/euidaccess @@ -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 diff --git a/modules/execute b/modules/execute index 755e3e5b6d..a65696bb53 100644 --- a/modules/execute +++ b/modules/execute @@ -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/exitfail b/modules/exitfail index 641f99d1be..0dd3ec6897 100644 --- a/modules/exitfail +++ b/modules/exitfail @@ -6,7 +6,7 @@ lib/exitfail.h lib/exitfail.c Depends-on: -exit +stdlib configure.ac: diff --git a/modules/expl b/modules/expl index 3870440e75..a0ccf88448 100644 --- a/modules/expl +++ b/modules/expl @@ -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 diff --git a/modules/faccessat b/modules/faccessat index 92d818556b..ce8fa0d892 100644 --- a/modules/faccessat +++ b/modules/faccessat @@ -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 diff --git a/modules/fchdir b/modules/fchdir index 46b481fd14..7b7cb043b5 100644 --- a/modules/fchdir +++ b/modules/fchdir @@ -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 diff --git a/modules/fchdir-tests b/modules/fchdir-tests index 462e709211..8f82dcee43 100644 --- a/modules/fchdir-tests +++ b/modules/fchdir-tests @@ -4,7 +4,8 @@ tests/signature.h tests/macros.h Depends-on: -getcwd +cloexec +getcwd-lgpl configure.ac: diff --git a/modules/fclose b/modules/fclose index 4f6f786910..ac383aa24b 100644 --- a/modules/fclose +++ b/modules/fclose @@ -7,7 +7,9 @@ m4/fclose.m4 Depends-on: stdio -close +close [test $REPLACE_FCLOSE = 1] +freading [test $REPLACE_FCLOSE = 1] +lseek [test $REPLACE_FCLOSE = 1] configure.ac: gl_FUNC_FCLOSE diff --git a/modules/fclose-tests b/modules/fclose-tests new file mode 100644 index 0000000000..6334f6594a --- /dev/null +++ b/modules/fclose-tests @@ -0,0 +1,10 @@ +Files: +tests/test-fclose.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-fclose +check_PROGRAMS += test-fclose diff --git a/modules/fcntl b/modules/fcntl index 67630f9f01..855ee9f974 100644 --- a/modules/fcntl +++ b/modules/fcntl @@ -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 diff --git a/modules/fcntl-h b/modules/fcntl-h index 6a33fc7ac0..f244de04de 100644 --- a/modules/fcntl-h +++ b/modules/fcntl-h @@ -24,7 +24,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' \ @@ -32,6 +32,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 index 0000000000..7127083763 --- /dev/null +++ b/modules/fd-hook @@ -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 diff --git a/modules/fdopendir b/modules/fdopendir index 203f6c72d1..0612b74d68 100644 --- a/modules/fdopendir +++ b/modules/fdopendir @@ -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 diff --git a/modules/fdopendir-tests b/modules/fdopendir-tests index bee2df7df5..39575ba3f0 100644 --- a/modules/fdopendir-tests +++ b/modules/fdopendir-tests @@ -12,4 +12,3 @@ configure.ac: Makefile.am: TESTS += test-fdopendir check_PROGRAMS += test-fdopendir -test_fdopendir_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/fdutimensat-tests b/modules/fdutimensat-tests index 48ea78d233..1d107ce5c1 100644 --- a/modules/fdutimensat-tests +++ b/modules/fdutimensat-tests @@ -19,4 +19,4 @@ configure.ac: Makefile.am: TESTS += test-fdutimensat check_PROGRAMS += test-fdutimensat -test_fdutimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBINTL@ +test_fdutimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) diff --git a/modules/fflush b/modules/fflush index a8a151e93a..f1d696bd3d 100644 --- a/modules/fflush +++ b/modules/fflush @@ -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 +LGPL Maintainer: Eric Blake diff --git a/modules/filenamecat-lgpl b/modules/filenamecat-lgpl index a7449334d2..4dd39933b1 100644 --- a/modules/filenamecat-lgpl +++ b/modules/filenamecat-lgpl @@ -18,7 +18,7 @@ Include: "filenamecat.h" License: -GPL +LGPLv2+ Maintainer: Jim Meyering diff --git a/modules/float b/modules/float index 004d2bf42a..6073c3fa3e 100644 --- a/modules/float +++ b/modules/float @@ -19,7 +19,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' \ @@ -29,6 +30,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: diff --git a/modules/floor b/modules/floor index ee898d3cd6..1393dadad4 100644 --- a/modules/floor +++ b/modules/floor @@ -7,7 +7,7 @@ m4/floor.m4 Depends-on: math -float +float [test $REPLACE_FLOOR = 1] configure.ac: gl_FUNC_FLOOR diff --git a/modules/floorf b/modules/floorf index 47b9d5ca24..1f9d9da595 100644 --- a/modules/floorf +++ b/modules/floorf @@ -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 diff --git a/modules/floorl b/modules/floorl index 66c13621ad..e21199335e 100644 --- a/modules/floorl +++ b/modules/floorl @@ -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 diff --git a/modules/fnmatch b/modules/fnmatch index 3703192b22..a10b0398ba 100644 --- a/modules/fnmatch +++ b/modules/fnmatch @@ -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 @@ -31,13 +31,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: diff --git a/modules/fopen b/modules/fopen index eddd7f650c..2177a3bf95 100644 --- a/modules/fopen +++ b/modules/fopen @@ -7,7 +7,7 @@ m4/fopen.m4 Depends-on: stdio -unistd +unistd [test $REPLACE_FOPEN = 1] configure.ac: gl_FUNC_FOPEN diff --git a/modules/fprintf-posix b/modules/fprintf-posix index be2b010dd8..47e76c5c50 100644 --- a/modules/fprintf-posix +++ b/modules/fprintf-posix @@ -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 diff --git a/modules/freading b/modules/freading index d2a027801e..b5c00c65d2 100644 --- a/modules/freading +++ b/modules/freading @@ -20,8 +20,7 @@ Include: "freading.h" License: -LGPL +LGPLv2+ Maintainer: Eric Blake - diff --git a/modules/frexp b/modules/frexp index 7fae366dbe..3ada9b2f29 100644 --- a/modules/frexp +++ b/modules/frexp @@ -7,7 +7,7 @@ m4/frexp.m4 Depends-on: math -isnand-nolibm +isnand-nolibm [test $gl_func_frexp != yes] configure.ac: gl_FUNC_FREXP diff --git a/modules/frexp-nolibm b/modules/frexp-nolibm index 6a909e972f..34eb958a99 100644 --- a/modules/frexp-nolibm +++ b/modules/frexp-nolibm @@ -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 diff --git a/modules/frexpl b/modules/frexpl index 185d54dde2..d1f0159b63 100644 --- a/modules/frexpl +++ b/modules/frexpl @@ -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 diff --git a/modules/frexpl-nolibm b/modules/frexpl-nolibm index 80ce8fb701..dbe1a82820 100644 --- a/modules/frexpl-nolibm +++ b/modules/frexpl-nolibm @@ -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 diff --git a/modules/fseek b/modules/fseek index 07f948e8e1..98c6d3f57f 100644 --- a/modules/fseek +++ b/modules/fseek @@ -6,8 +6,8 @@ lib/fseek.c m4/fseek.m4 Depends-on: -fseeko stdio +fseeko [test $REPLACE_FSEEK = 1] configure.ac: gl_FUNC_FSEEK diff --git a/modules/fsusage b/modules/fsusage index c8496880bd..cdefb60cf2 100644 --- a/modules/fsusage +++ b/modules/fsusage @@ -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 diff --git a/modules/ftell b/modules/ftell index 6e9dc25965..cc95d169f0 100644 --- a/modules/ftell +++ b/modules/ftell @@ -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 diff --git a/modules/ftello b/modules/ftello index 0cf160c981..b042e84808 100644 --- a/modules/ftello +++ b/modules/ftello @@ -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]) diff --git a/modules/full-read b/modules/full-read index d559911c07..5bae3ae5e2 100644 --- a/modules/full-read +++ b/modules/full-read @@ -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: diff --git a/modules/futimens b/modules/futimens index 17bff44a0a..4ed403e946 100644 --- a/modules/futimens +++ b/modules/futimens @@ -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 diff --git a/modules/getcwd b/modules/getcwd index 108f14b28a..cc80bfe882 100644 --- a/modules/getcwd +++ b/modules/getcwd @@ -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 index 0000000000..72e6a7fc08 --- /dev/null +++ b/modules/getcwd-lgpl @@ -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 index 0000000000..07fdf73d5c --- /dev/null +++ b/modules/getcwd-lgpl-tests @@ -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 diff --git a/modules/getcwd-tests b/modules/getcwd-tests index 016961fc71..2187acc75f 100644 --- a/modules/getcwd-tests +++ b/modules/getcwd-tests @@ -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: diff --git a/modules/getdelim b/modules/getdelim index 0f17b608fa..c3ef317a11 100644 --- a/modules/getdelim +++ b/modules/getdelim @@ -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 diff --git a/modules/getdomainname b/modules/getdomainname index 5a9d23f585..c7f77b0ec0 100644 --- a/modules/getdomainname +++ b/modules/getdomainname @@ -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 diff --git a/modules/getgroups b/modules/getgroups index aabcefc5cc..4903123eb5 100644 --- a/modules/getgroups +++ b/modules/getgroups @@ -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 diff --git a/modules/gethostname b/modules/gethostname index 8c24571276..359434ab37 100644 --- a/modules/gethostname +++ b/modules/gethostname @@ -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 diff --git a/modules/getline b/modules/getline index 1fb9b9c22e..b565f6620b 100644 --- a/modules/getline +++ b/modules/getline @@ -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 diff --git a/modules/getlogin_r b/modules/getlogin_r index 1d5c20b836..c0fb4a691f 100644 --- a/modules/getlogin_r +++ b/modules/getlogin_r @@ -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 diff --git a/modules/getopt-posix b/modules/getopt-posix index 93d7fccf10..0443524b3c 100644 --- a/modules/getopt-posix +++ b/modules/getopt-posix @@ -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 @@ -26,7 +26,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' \ diff --git a/modules/getpeername b/modules/getpeername index a8a4fcaff2..4cdae38e2e 100644 --- a/modules/getpeername +++ b/modules/getpeername @@ -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]) diff --git a/modules/getsockname b/modules/getsockname index a7f8881c74..223479e406 100644 --- a/modules/getsockname +++ b/modules/getsockname @@ -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]) diff --git a/modules/getsockopt b/modules/getsockopt index 40ff649817..5b8c18d854 100644 --- a/modules/getsockopt +++ b/modules/getsockopt @@ -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]) diff --git a/modules/getsubopt b/modules/getsubopt index a28e2a0a2c..eaf8e87b38 100644 --- a/modules/getsubopt +++ b/modules/getsubopt @@ -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 diff --git a/modules/gettext b/modules/gettext index cab538e3c0..ca0b6841dc 100644 --- a/modules/gettext +++ b/modules/gettext @@ -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 diff --git a/modules/getusershell b/modules/getusershell index 9ae7dcae1e..56e8b5f0e0 100644 --- a/modules/getusershell +++ b/modules/getusershell @@ -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 diff --git a/modules/git-merge-changelog b/modules/git-merge-changelog index d0e2ad02f2..857a8bc5b2 100644 --- a/modules/git-merge-changelog +++ b/modules/git-merge-changelog @@ -7,6 +7,7 @@ lib/git-merge-changelog.c Depends-on: getopt-gnu stdbool +stdlib progname error read-file diff --git a/modules/glob b/modules/glob index beaf476c11..2dd31c62cd 100644 --- a/modules/glob +++ b/modules/glob @@ -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 @@ -37,7 +37,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' \ @@ -47,6 +48,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: diff --git a/modules/gnumakefile b/modules/gnumakefile index 483ff74dd3..a86475a3ff 100644 --- a/modules/gnumakefile +++ b/modules/gnumakefile @@ -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 diff --git a/modules/grantpt b/modules/grantpt index a5d9eb4034..589360d175 100644 --- a/modules/grantpt +++ b/modules/grantpt @@ -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 diff --git a/modules/hash b/modules/hash index 75a99da373..72afda6cf1 100644 --- a/modules/hash +++ b/modules/hash @@ -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 diff --git a/modules/hash-tests b/modules/hash-tests index a77bfe7d68..b3f814b6ec 100644 --- a/modules/hash-tests +++ b/modules/hash-tests @@ -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@ diff --git a/modules/iconv-h b/modules/iconv-h index 1c35ecd3e0..968800ec41 100644 --- a/modules/iconv-h +++ b/modules/iconv-h @@ -22,7 +22,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' \ @@ -40,6 +41,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: diff --git a/modules/iconv_open b/modules/iconv_open index 194440b046..527160e793 100644 --- a/modules/iconv_open +++ b/modules/iconv_open @@ -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 diff --git a/modules/iconv_open-utf b/modules/iconv_open-utf index be6ff9f4ee..b29b3092d9 100644 --- a/modules/iconv_open-utf +++ b/modules/iconv_open-utf @@ -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 diff --git a/modules/imaxabs b/modules/imaxabs index 481486d145..8da390f736 100644 --- a/modules/imaxabs +++ b/modules/imaxabs @@ -6,7 +6,7 @@ lib/imaxabs.c m4/imaxabs.m4 Depends-on: -inttypes +inttypes-incomplete configure.ac: gl_FUNC_IMAXABS diff --git a/modules/imaxdiv b/modules/imaxdiv index 7eacbc750d..7589024c07 100644 --- a/modules/imaxdiv +++ b/modules/imaxdiv @@ -6,7 +6,7 @@ lib/imaxdiv.c m4/imaxdiv.m4 Depends-on: -inttypes +inttypes-incomplete configure.ac: gl_FUNC_IMAXDIV diff --git a/modules/inet_ntop b/modules/inet_ntop index 3b00b62a08..7e9c7f4198 100644 --- a/modules/inet_ntop +++ b/modules/inet_ntop @@ -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 diff --git a/modules/inet_pton b/modules/inet_pton index 44c50b892e..18fe07ec5f 100644 --- a/modules/inet_pton +++ b/modules/inet_pton @@ -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/inttypes b/modules/inttypes index 991fe4e1a3..68a272e002 100644 --- a/modules/inttypes +++ b/modules/inttypes @@ -2,16 +2,10 @@ 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 diff --git a/modules/inttypes-incomplete b/modules/inttypes-incomplete new file mode 100644 index 0000000000..ef743dd604 --- /dev/null +++ b/modules/inttypes-incomplete @@ -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 diff --git a/modules/ioctl b/modules/ioctl index 5ba70ed98c..57328f3efb 100644 --- a/modules/ioctl +++ b/modules/ioctl @@ -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 diff --git a/modules/isapipe b/modules/isapipe index 6352af4519..ee1c2202d6 100644 --- a/modules/isapipe +++ b/modules/isapipe @@ -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 diff --git a/modules/isfinite b/modules/isfinite index f122c5ad70..259da35f5a 100644 --- a/modules/isfinite +++ b/modules/isfinite @@ -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 diff --git a/modules/isinf b/modules/isinf index 2c6851c060..1a8399fe7b 100644 --- a/modules/isinf +++ b/modules/isinf @@ -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 diff --git a/modules/langinfo b/modules/langinfo index e864c91a89..91c87750ad 100644 --- a/modules/langinfo +++ b/modules/langinfo @@ -21,7 +21,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' \ diff --git a/modules/lchown b/modules/lchown index 9fea1b3375..d9d140e3c4 100644 --- a/modules/lchown +++ b/modules/lchown @@ -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 diff --git a/modules/ldexpl b/modules/ldexpl index 7dd82ccb38..517a40a8dd 100644 --- a/modules/ldexpl +++ b/modules/ldexpl @@ -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 diff --git a/modules/link b/modules/link index 6a006c31e0..38cf5ec9f0 100644 --- a/modules/link +++ b/modules/link @@ -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 diff --git a/modules/linkat b/modules/linkat index 53e2a071e2..2cb717776f 100644 --- a/modules/linkat +++ b/modules/linkat @@ -7,23 +7,24 @@ 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] +errno [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +fcntl-h [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +filenamecat-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +getcwd-lgpl [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +openat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +link [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +link-follow [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +lstat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +readlink [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +same-inode [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +stpcpy [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +symlink [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] +symlinkat [test $HAVE_LINKAT = 0 || test $REPLACE_LINKAT = 1] configure.ac: gl_FUNC_LINKAT diff --git a/modules/linkat-tests b/modules/linkat-tests index 6df4781973..3f2d3f090c 100644 --- a/modules/linkat-tests +++ b/modules/linkat-tests @@ -7,14 +7,13 @@ tests/macros.h Depends-on: ignore-value areadlink-with-size -filenamecat +filenamecat-lgpl +getcwd-lgpl progname same-inode -xgetcwd configure.ac: Makefile.am: TESTS += test-linkat check_PROGRAMS += test-linkat -test_linkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/listen b/modules/listen index 6912f5d695..7c77557d5c 100644 --- a/modules/listen +++ b/modules/listen @@ -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]) diff --git a/modules/locale b/modules/locale index 7b4d1c7b15..bab5a7d48b 100644 --- a/modules/locale +++ b/modules/locale @@ -23,7 +23,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' \ diff --git a/modules/logl b/modules/logl index c9b7237dc2..95fd1a0371 100644 --- a/modules/logl +++ b/modules/logl @@ -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 diff --git a/modules/long-options b/modules/long-options index 29bf734dc0..207610c63d 100644 --- a/modules/long-options +++ b/modules/long-options @@ -8,6 +8,7 @@ m4/long-options.m4 Depends-on: getopt-gnu +stdlib version-etc configure.ac: diff --git a/modules/lstat b/modules/lstat index e53ac7ed70..a945a11636 100644 --- a/modules/lstat +++ b/modules/lstat @@ -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 diff --git a/modules/math b/modules/math index 3208d4d310..01544c5115 100644 --- a/modules/math +++ b/modules/math @@ -21,7 +21,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' \ diff --git a/modules/mbrlen b/modules/mbrlen index e7f36734eb..5bc9f297ca 100644 --- a/modules/mbrlen +++ b/modules/mbrlen @@ -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 diff --git a/modules/mbrtowc b/modules/mbrtowc index 5981633e60..85cde1e394 100644 --- a/modules/mbrtowc +++ b/modules/mbrtowc @@ -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 diff --git a/modules/mbsinit b/modules/mbsinit index 4e673c7742..a8ee058a0e 100644 --- a/modules/mbsinit +++ b/modules/mbsinit @@ -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 diff --git a/modules/mbsnrtowcs b/modules/mbsnrtowcs index e8975b8545..a179296810 100644 --- a/modules/mbsnrtowcs +++ b/modules/mbsnrtowcs @@ -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 diff --git a/modules/mbsrtowcs b/modules/mbsrtowcs index 973b69538d..66dd78f67b 100644 --- a/modules/mbsrtowcs +++ b/modules/mbsrtowcs @@ -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 diff --git a/modules/mbtowc b/modules/mbtowc index f41d508385..02b0c88dcf 100644 --- a/modules/mbtowc +++ b/modules/mbtowc @@ -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 diff --git a/modules/memchr b/modules/memchr index 495f2e26bd..229b3a5bfe 100644 --- a/modules/memchr +++ b/modules/memchr @@ -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 index 0000000000..c1033b6605 --- /dev/null +++ b/modules/memchr-obsolete @@ -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 diff --git a/modules/memcmp b/modules/memcmp index c6bc26200a..dda4324882 100644 --- a/modules/memcmp +++ b/modules/memcmp @@ -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 diff --git a/modules/mgetgroups b/modules/mgetgroups index c404d01435..1aa1c79ae6 100644 --- a/modules/mgetgroups +++ b/modules/mgetgroups @@ -10,7 +10,7 @@ Depends-on: getgroups getugroups realloc-gnu -xalloc +xalloc-oversized configure.ac: gl_MGETGROUPS diff --git a/modules/mkdir b/modules/mkdir index 08089d008f..44b9057fc8 100644 --- a/modules/mkdir +++ b/modules/mkdir @@ -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 diff --git a/modules/mkdtemp b/modules/mkdtemp index 3c5aeee29b..4ca30c49ac 100644 --- a/modules/mkdtemp +++ b/modules/mkdtemp @@ -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 diff --git a/modules/mkfifo b/modules/mkfifo index 3eaaad6c69..dae3755f73 100644 --- a/modules/mkfifo +++ b/modules/mkfifo @@ -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 diff --git a/modules/mkfifoat b/modules/mkfifoat index 2bc7e65573..705fb4f9cf 100644 --- a/modules/mkfifoat +++ b/modules/mkfifoat @@ -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 diff --git a/modules/mkfifoat-tests b/modules/mkfifoat-tests index 8be33df05d..a1e33c9812 100644 --- a/modules/mkfifoat-tests +++ b/modules/mkfifoat-tests @@ -13,4 +13,3 @@ configure.ac: Makefile.am: TESTS += test-mkfifoat check_PROGRAMS += test-mkfifoat -test_mkfifoat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/mknod b/modules/mknod index c965606e7f..6db2d5e08c 100644 --- a/modules/mknod +++ b/modules/mknod @@ -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 diff --git a/modules/mkostemp b/modules/mkostemp index 8a61dbeb07..85b01b7e26 100644 --- a/modules/mkostemp +++ b/modules/mkostemp @@ -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 diff --git a/modules/mkostemps b/modules/mkostemps index a4175bdb50..ff3c97acee 100644 --- a/modules/mkostemps +++ b/modules/mkostemps @@ -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 diff --git a/modules/mkstemp b/modules/mkstemp index 265144b942..0f4fef6665 100644 --- a/modules/mkstemp +++ b/modules/mkstemp @@ -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 diff --git a/modules/mkstemps b/modules/mkstemps index 2a49777674..56718a9b42 100644 --- a/modules/mkstemps +++ b/modules/mkstemps @@ -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 diff --git a/modules/mktime b/modules/mktime index d5b0ee7954..81aa7148d0 100644 --- a/modules/mktime +++ b/modules/mktime @@ -8,7 +8,7 @@ m4/mktime.m4 Depends-on: multiarch -time_r +time_r [test $REPLACE_MKTIME = 1] configure.ac: gl_FUNC_MKTIME diff --git a/modules/nanosleep b/modules/nanosleep index dfe1c7acbe..32af74b9fb 100644 --- a/modules/nanosleep +++ b/modules/nanosleep @@ -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 diff --git a/modules/netdb b/modules/netdb index c68692c7e6..efc989b3c2 100644 --- a/modules/netdb +++ b/modules/netdb @@ -6,6 +6,7 @@ lib/netdb.in.h m4/netdb_h.m4 Depends-on: +c++defs include_next arg-nonnull warn-on-use @@ -21,7 +22,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' \ @@ -35,6 +36,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 index 0000000000..af07dee341 --- /dev/null +++ b/modules/netdb-c++-tests @@ -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 diff --git a/modules/netdb-tests b/modules/netdb-tests index 1c3ae0b3e3..3590c94aaa 100644 --- a/modules/netdb-tests +++ b/modules/netdb-tests @@ -2,6 +2,7 @@ Files: tests/test-netdb.c Depends-on: +netdb-c++-tests configure.ac: diff --git a/modules/netinet_in b/modules/netinet_in index 28b80c8e27..abd425c9aa 100644 --- a/modules/netinet_in +++ b/modules/netinet_in @@ -21,7 +21,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! */'; \ @@ -33,6 +34,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 diff --git a/modules/nonblocking b/modules/nonblocking index 9528405fab..2d469ebaa4 100644 --- a/modules/nonblocking +++ b/modules/nonblocking @@ -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 index 0000000000..428452f78e --- /dev/null +++ b/modules/nonblocking-pipe-tests @@ -0,0 +1,34 @@ +Files: +tests/test-nonblocking-pipe.sh +tests/test-nonblocking-pipe-main.c +tests/test-nonblocking-pipe-child.c +tests/test-nonblocking-pipe.h +tests/test-nonblocking-writer.h +tests/test-nonblocking-reader.h +tests/test-nonblocking-misc.h +tests/macros.h + +Depends-on: +stdbool +unistd +nonblocking +wait-process +pipe-posix +dup2 +environ +posix_spawnp +binary-io +gettimeofday +snprintf +vsnprintf +strerror +ssize_t +usleep +read +write + +configure.ac: + +Makefile.am: +TESTS += test-nonblocking-pipe.sh +check_PROGRAMS += test-nonblocking-pipe-main test-nonblocking-pipe-child diff --git a/modules/nonblocking-socket-tests b/modules/nonblocking-socket-tests new file mode 100644 index 0000000000..368bed8828 --- /dev/null +++ b/modules/nonblocking-socket-tests @@ -0,0 +1,46 @@ +Files: +tests/test-nonblocking-socket.sh +tests/test-nonblocking-socket-main.c +tests/test-nonblocking-socket-child.c +tests/test-nonblocking-socket.h +tests/test-nonblocking-writer.h +tests/test-nonblocking-reader.h +tests/test-nonblocking-misc.h +tests/socket-server.h +tests/socket-client.h +tests/macros.h + +Depends-on: +stdbool +unistd +sys_socket +nonblocking +wait-process +environ +posix_spawnp +netinet_in +arpa_inet +socket +setsockopt +bind +getsockname +listen +accept +getsockopt +connect +gettimeofday +snprintf +vsnprintf +strerror +ssize_t +usleep +read +write + +configure.ac: + +Makefile.am: +TESTS += test-nonblocking-socket.sh +check_PROGRAMS += test-nonblocking-socket-main test-nonblocking-socket-child +test_nonblocking_socket_main_LDADD = $(LDADD) $(LIBSOCKET) +test_nonblocking_socket_child_LDADD = $(LDADD) $(LIBSOCKET) diff --git a/modules/nonblocking-tests b/modules/nonblocking-tests index 34d206d779..b84a32713f 100644 --- a/modules/nonblocking-tests +++ b/modules/nonblocking-tests @@ -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) diff --git a/modules/obstack b/modules/obstack index af12846b95..bceecdc64c 100644 --- a/modules/obstack +++ b/modules/obstack @@ -7,9 +7,9 @@ lib/obstack.c Depends-on: gettext-h -exit exitfail stdint +stdlib configure.ac: AC_FUNC_OBSTACK diff --git a/modules/open b/modules/open index 29829084eb..ea0f5ae57c 100644 --- a/modules/open +++ b/modules/open @@ -8,7 +8,7 @@ m4/mode_t.m4 Depends-on: fcntl-h -stat +stat [test $REPLACE_OPEN = 1] configure.ac: gl_FUNC_OPEN diff --git a/modules/openat b/modules/openat index 35917c59d7..abd3b63b95 100644 --- a/modules/openat +++ b/modules/openat @@ -24,18 +24,18 @@ 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 +rmdir [test $REPLACE_UNLINKAT = 1] same-inode save-cwd stdbool sys_stat unistd -unlink +unlink [test $REPLACE_UNLINKAT = 1] configure.ac: gl_FUNC_OPENAT diff --git a/modules/openat-safer-tests b/modules/openat-safer-tests index 1f0b158fc0..a33d2c6b68 100644 --- a/modules/openat-safer-tests +++ b/modules/openat-safer-tests @@ -9,4 +9,3 @@ configure.ac: Makefile.am: TESTS += test-openat-safer check_PROGRAMS += test-openat-safer -test_openat_safer_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/openat-tests b/modules/openat-tests index 250a574593..959d882333 100644 --- a/modules/openat-tests +++ b/modules/openat-tests @@ -31,8 +31,3 @@ Makefile.am: TESTS += test-fchownat test-fstatat test-mkdirat test-openat test-unlinkat check_PROGRAMS += test-fchownat test-fstatat test-mkdirat test-openat \ test-unlinkat -test_fchownat_LDADD = $(LDADD) @LIBINTL@ -test_fstatat_LDADD = $(LDADD) @LIBINTL@ -test_mkdirat_LDADD = $(LDADD) @LIBINTL@ -test_openat_LDADD = $(LDADD) @LIBINTL@ -test_unlinkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/pagealign_alloc b/modules/pagealign_alloc index 5972aa152d..357a335197 100644 --- a/modules/pagealign_alloc +++ b/modules/pagealign_alloc @@ -9,10 +9,10 @@ m4/pagealign_alloc.m4 Depends-on: error -exit extensions getpagesize gettext-h +stdlib xalloc unistd diff --git a/modules/passfd b/modules/passfd index 74ef4102c4..b3d8a3c022 100644 --- a/modules/passfd +++ b/modules/passfd @@ -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 diff --git a/modules/passfd-tests b/modules/passfd-tests index 477754b2ba..9bb1c5c1be 100644 --- a/modules/passfd-tests +++ b/modules/passfd-tests @@ -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 diff --git a/modules/perror b/modules/perror index c01902959b..d2147b6b66 100644 --- a/modules/perror +++ b/modules/perror @@ -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 diff --git a/modules/pipe-filter-gi b/modules/pipe-filter-gi index 7122c1ad49..ac56c60f3d 100644 --- a/modules/pipe-filter-gi +++ b/modules/pipe-filter-gi @@ -10,10 +10,11 @@ Depends-on: spawn-pipe wait-process error -exit +fcntl-h gettext-h stdbool stdint +stdlib sys_select unistd diff --git a/modules/pipe-filter-ii b/modules/pipe-filter-ii index f845a8f5ac..faa4e1a6fb 100644 --- a/modules/pipe-filter-ii +++ b/modules/pipe-filter-ii @@ -10,10 +10,11 @@ Depends-on: spawn-pipe wait-process error -exit +fcntl-h gettext-h stdbool stdint +stdlib sys_select unistd diff --git a/modules/pipe2 b/modules/pipe2 index 45813962cb..ca722168a7 100644 --- a/modules/pipe2 +++ b/modules/pipe2 @@ -10,6 +10,7 @@ unistd fcntl-h binary-io extensions +nonblocking configure.ac: gl_FUNC_PIPE2 @@ -22,7 +23,7 @@ Include: <unistd.h> License: -LGPL +LGPLv2+ Maintainer: Bruno Haible, Eric Blake diff --git a/modules/pipe2-tests b/modules/pipe2-tests index 5d24bd747c..2e6c3f78a7 100644 --- a/modules/pipe2-tests +++ b/modules/pipe2-tests @@ -11,3 +11,4 @@ configure.ac: Makefile.am: TESTS += test-pipe2 check_PROGRAMS += test-pipe2 +test_pipe2_LDADD = $(LDADD) $(LIBSOCKET) diff --git a/modules/poll b/modules/poll index 8690271e0d..478e99ba74 100644 --- a/modules/poll +++ b/modules/poll @@ -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 diff --git a/modules/poll-h b/modules/poll-h index 8fc15cdb1a..33cad6c097 100644 --- a/modules/poll-h +++ b/modules/poll-h @@ -21,7 +21,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' \ diff --git a/modules/popen b/modules/popen index 75e278d8ec..d4ba0ab062 100644 --- a/modules/popen +++ b/modules/popen @@ -6,8 +6,8 @@ lib/popen.c m4/popen.m4 Depends-on: -open stdio +open [test $REPLACE_POPEN = 1] configure.ac: gl_FUNC_POPEN diff --git a/modules/posix_spawn b/modules/posix_spawn index a4967b9c28..54e08d8413 100644 --- a/modules/posix_spawn +++ b/modules/posix_spawn @@ -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 diff --git a/modules/posix_spawn_file_actions_addclose b/modules/posix_spawn_file_actions_addclose index 80b1c91536..eef7b63c55 100644 --- a/modules/posix_spawn_file_actions_addclose +++ b/modules/posix_spawn_file_actions_addclose @@ -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]) diff --git a/modules/posix_spawn_file_actions_adddup2 b/modules/posix_spawn_file_actions_adddup2 index 173dc64344..1cab62fb9c 100644 --- a/modules/posix_spawn_file_actions_adddup2 +++ b/modules/posix_spawn_file_actions_adddup2 @@ -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]) diff --git a/modules/posix_spawn_file_actions_addopen b/modules/posix_spawn_file_actions_addopen index d621d2df8c..464e6491e8 100644 --- a/modules/posix_spawn_file_actions_addopen +++ b/modules/posix_spawn_file_actions_addopen @@ -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]) diff --git a/modules/posix_spawn_file_actions_destroy b/modules/posix_spawn_file_actions_destroy index 8ca5aa2f11..ae1ea0d886 100644 --- a/modules/posix_spawn_file_actions_destroy +++ b/modules/posix_spawn_file_actions_destroy @@ -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]) diff --git a/modules/posix_spawn_file_actions_init b/modules/posix_spawn_file_actions_init index 7431aabcc8..7afc5bef77 100644 --- a/modules/posix_spawn_file_actions_init +++ b/modules/posix_spawn_file_actions_init @@ -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]) diff --git a/modules/posix_spawnattr_destroy b/modules/posix_spawnattr_destroy index 426b382aba..59fd22bded 100644 --- a/modules/posix_spawnattr_destroy +++ b/modules/posix_spawnattr_destroy @@ -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]) diff --git a/modules/posix_spawnattr_getflags b/modules/posix_spawnattr_getflags index 47a70dd2b0..ffade0c3d0 100644 --- a/modules/posix_spawnattr_getflags +++ b/modules/posix_spawnattr_getflags @@ -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]) diff --git a/modules/posix_spawnattr_getpgroup b/modules/posix_spawnattr_getpgroup index 60d62ccae7..58e59d31c1 100644 --- a/modules/posix_spawnattr_getpgroup +++ b/modules/posix_spawnattr_getpgroup @@ -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]) diff --git a/modules/posix_spawnattr_getschedparam b/modules/posix_spawnattr_getschedparam index c8cd1e4c71..6767db665c 100644 --- a/modules/posix_spawnattr_getschedparam +++ b/modules/posix_spawnattr_getschedparam @@ -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]) diff --git a/modules/posix_spawnattr_getschedpolicy b/modules/posix_spawnattr_getschedpolicy index a3be8cc239..19188c9cb5 100644 --- a/modules/posix_spawnattr_getschedpolicy +++ b/modules/posix_spawnattr_getschedpolicy @@ -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]) diff --git a/modules/posix_spawnattr_getsigdefault b/modules/posix_spawnattr_getsigdefault index 6a93722eff..980a59acf0 100644 --- a/modules/posix_spawnattr_getsigdefault +++ b/modules/posix_spawnattr_getsigdefault @@ -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]) diff --git a/modules/posix_spawnattr_getsigmask b/modules/posix_spawnattr_getsigmask index a984e96ec2..3435de2f25 100644 --- a/modules/posix_spawnattr_getsigmask +++ b/modules/posix_spawnattr_getsigmask @@ -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]) diff --git a/modules/posix_spawnattr_init b/modules/posix_spawnattr_init index 796f264208..fd8a11677a 100644 --- a/modules/posix_spawnattr_init +++ b/modules/posix_spawnattr_init @@ -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]) diff --git a/modules/posix_spawnattr_setflags b/modules/posix_spawnattr_setflags index 54cbc991c6..2fad14506d 100644 --- a/modules/posix_spawnattr_setflags +++ b/modules/posix_spawnattr_setflags @@ -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]) diff --git a/modules/posix_spawnattr_setpgroup b/modules/posix_spawnattr_setpgroup index 6affe367c6..4f00f63a79 100644 --- a/modules/posix_spawnattr_setpgroup +++ b/modules/posix_spawnattr_setpgroup @@ -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]) diff --git a/modules/posix_spawnattr_setschedparam b/modules/posix_spawnattr_setschedparam index eb448f80f6..6827501a63 100644 --- a/modules/posix_spawnattr_setschedparam +++ b/modules/posix_spawnattr_setschedparam @@ -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]) diff --git a/modules/posix_spawnattr_setschedpolicy b/modules/posix_spawnattr_setschedpolicy index 44b487b13f..2de648dd24 100644 --- a/modules/posix_spawnattr_setschedpolicy +++ b/modules/posix_spawnattr_setschedpolicy @@ -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]) diff --git a/modules/posix_spawnattr_setsigdefault b/modules/posix_spawnattr_setsigdefault index e9f5bb134a..3d8ec56d0c 100644 --- a/modules/posix_spawnattr_setsigdefault +++ b/modules/posix_spawnattr_setsigdefault @@ -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]) diff --git a/modules/posix_spawnattr_setsigmask b/modules/posix_spawnattr_setsigmask index d73840b6a1..5e2bf44964 100644 --- a/modules/posix_spawnattr_setsigmask +++ b/modules/posix_spawnattr_setsigmask @@ -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]) diff --git a/modules/posix_spawnp b/modules/posix_spawnp index 1cac784a42..ec6accb82d 100644 --- a/modules/posix_spawnp +++ b/modules/posix_spawnp @@ -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 diff --git a/modules/pread b/modules/pread index 4c6e6ecda5..5fcb47ca24 100644 --- a/modules/pread +++ b/modules/pread @@ -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 diff --git a/modules/printf-posix b/modules/printf-posix index 0597ef9c6f..1c763a0c12 100644 --- a/modules/printf-posix +++ b/modules/printf-posix @@ -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 diff --git a/modules/pt_chown b/modules/pt_chown index b861331d2a..0002ab79a8 100644 --- a/modules/pt_chown +++ b/modules/pt_chown @@ -7,6 +7,7 @@ lib/pty-private.h Depends-on: ptsname +stdlib configure.ac: diff --git a/modules/pthread b/modules/pthread index 7aaaffac40..68551e14b3 100644 --- a/modules/pthread +++ b/modules/pthread @@ -20,7 +20,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' \ @@ -33,6 +34,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: diff --git a/modules/ptsname b/modules/ptsname index d6ae046830..ab14894d3b 100644 --- a/modules/ptsname +++ b/modules/ptsname @@ -8,7 +8,7 @@ m4/ptsname.m4 Depends-on: stdlib extensions -ttyname_r +ttyname_r [test $HAVE_PTSNAME = 0] configure.ac: gl_FUNC_PTSNAME diff --git a/modules/pty b/modules/pty index f490b344b8..1521d5bafd 100644 --- a/modules/pty +++ b/modules/pty @@ -20,7 +20,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' \ diff --git a/modules/putenv b/modules/putenv index 3874b541b8..ce28e4c6e9 100644 --- a/modules/putenv +++ b/modules/putenv @@ -7,7 +7,7 @@ m4/putenv.m4 Depends-on: stdlib -malloc-posix +malloc-posix [test $REPLACE_PUTENV = 1] configure.ac: gl_FUNC_PUTENV diff --git a/modules/pwrite b/modules/pwrite index b6511a2099..f2dd02fb23 100644 --- a/modules/pwrite +++ b/modules/pwrite @@ -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 index 0000000000..85a9e02bbf --- /dev/null +++ b/modules/read @@ -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 diff --git a/modules/readline b/modules/readline index 933ae5b629..7f2af8f061 100644 --- a/modules/readline +++ b/modules/readline @@ -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 diff --git a/modules/readlink b/modules/readlink index eb32ef53ee..37c03a78af 100644 --- a/modules/readlink +++ b/modules/readlink @@ -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 diff --git a/modules/readlinkat b/modules/readlinkat index 593f2c2573..18f2f959a4 100644 --- a/modules/readlinkat +++ b/modules/readlinkat @@ -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/readlinkat-tests b/modules/readlinkat-tests index de23df8dde..96faa5699b 100644 --- a/modules/readlinkat-tests +++ b/modules/readlinkat-tests @@ -13,4 +13,3 @@ configure.ac: Makefile.am: TESTS += test-readlinkat check_PROGRAMS += test-readlinkat -test_readlinkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/readme-release b/modules/readme-release new file mode 100644 index 0000000000..a2128bf49d --- /dev/null +++ b/modules/readme-release @@ -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 diff --git a/modules/recv b/modules/recv index 04602f9801..c225917b17 100644 --- a/modules/recv +++ b/modules/recv @@ -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]) diff --git a/modules/recvfrom b/modules/recvfrom index 8237565b9d..9a6d833ccb 100644 --- a/modules/recvfrom +++ b/modules/recvfrom @@ -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]) diff --git a/modules/regex b/modules/regex index 6a8f4c25fd..730076c2b3 100644 --- a/modules/regex +++ b/modules/regex @@ -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 diff --git a/modules/relocatable-prog-wrapper b/modules/relocatable-prog-wrapper index b96892952e..8246e56baa 100644 --- a/modules/relocatable-prog-wrapper +++ b/modules/relocatable-prog-wrapper @@ -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 diff --git a/modules/remove b/modules/remove index 886a03937f..4723801893 100644 --- a/modules/remove +++ b/modules/remove @@ -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 diff --git a/modules/rename b/modules/rename index ae8390a3ec..449d9beeab 100644 --- a/modules/rename +++ b/modules/rename @@ -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 diff --git a/modules/renameat b/modules/renameat index 14de04a021..15bc1ecd97 100644 --- a/modules/renameat +++ b/modules/renameat @@ -7,14 +7,15 @@ lib/renameat.c m4/renameat.m4 Depends-on: +stdio extensions fcntl-h -filenamecat-lgpl -openat -rename -same-inode -stdio -stpcpy +filenamecat-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +getcwd-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +openat [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +rename [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +same-inode [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] +stpcpy [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1] configure.ac: gl_FUNC_RENAMEAT diff --git a/modules/renameat-tests b/modules/renameat-tests index dcef7c19d0..9e7b337d79 100644 --- a/modules/renameat-tests +++ b/modules/renameat-tests @@ -7,8 +7,8 @@ tests/macros.h Depends-on: ignore-value filenamecat +getcwd-lgpl progname -xgetcwd configure.ac: diff --git a/modules/rmdir b/modules/rmdir index eaa5a68542..95e7b1df6a 100644 --- a/modules/rmdir +++ b/modules/rmdir @@ -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 diff --git a/modules/round b/modules/round index c4acba133f..07dcd880b7 100644 --- a/modules/round +++ b/modules/round @@ -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 diff --git a/modules/roundf b/modules/roundf index d77b2a198d..d9c283eb33 100644 --- a/modules/roundf +++ b/modules/roundf @@ -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 diff --git a/modules/roundl b/modules/roundl index 9eb9f1de54..516ee0b5df 100644 --- a/modules/roundl +++ b/modules/roundl @@ -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 diff --git a/modules/rpmatch b/modules/rpmatch index 17a6c2083a..bfa5380da1 100644 --- a/modules/rpmatch +++ b/modules/rpmatch @@ -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 diff --git a/modules/safe-read b/modules/safe-read index 533d83bbf7..89e79a9b67 100644 --- a/modules/safe-read +++ b/modules/safe-read @@ -7,6 +7,7 @@ lib/safe-read.c m4/safe-read.m4 Depends-on: +read ssize_t configure.ac: diff --git a/modules/safe-write b/modules/safe-write index 137c94a63e..cdc80d21f5 100644 --- a/modules/safe-write +++ b/modules/safe-write @@ -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: diff --git a/modules/save-cwd b/modules/save-cwd index 02a0723391..974b5962c1 100644 --- a/modules/save-cwd +++ b/modules/save-cwd @@ -9,7 +9,7 @@ m4/save-cwd.m4 Depends-on: chdir-long cloexec -getcwd +getcwd-lgpl fchdir stdbool unistd-safer diff --git a/modules/savewd b/modules/savewd index 1f32372849..1e95b4127d 100644 --- a/modules/savewd +++ b/modules/savewd @@ -9,12 +9,12 @@ m4/savewd.m4 Depends-on: dosname errno -exit fchdir fcntl-safer fcntl-h raise stdbool +stdlib xalloc configure.ac: diff --git a/modules/sched b/modules/sched index 128ec35eec..c0c0d6c5ca 100644 --- a/modules/sched +++ b/modules/sched @@ -19,7 +19,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' \ @@ -31,6 +32,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: diff --git a/modules/search b/modules/search index 3f7ecc060c..b303b249f7 100644 --- a/modules/search +++ b/modules/search @@ -21,7 +21,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' \ diff --git a/modules/select b/modules/select index 18865f1423..ab4af6e7cb 100644 --- a/modules/select +++ b/modules/select @@ -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 diff --git a/modules/selinux-h b/modules/selinux-h index 589729df3a..f919efc802 100644 --- a/modules/selinux-h +++ b/modules/selinux-h @@ -23,7 +23,7 @@ nobase_nodist_pkginclude_HEADERS += selinux/selinux.h lib_SOURCES += se-context.in.h se-selinux.in.h BUILT_SOURCES += selinux/selinux.h -selinux/selinux.h: se-selinux.in.h $(UNUSED_PARAMETER_H) +selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H) $(AM_V_at)$(MKDIR_P) selinux $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ @@ -39,7 +39,8 @@ 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! */' && \ @@ -48,6 +49,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 diff --git a/modules/send b/modules/send index 4317d6fb91..8a07da9d46 100644 --- a/modules/send +++ b/modules/send @@ -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]) diff --git a/modules/sendto b/modules/sendto index d9a292c857..b28a7ea354 100644 --- a/modules/sendto +++ b/modules/sendto @@ -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]) diff --git a/modules/setenv b/modules/setenv index 8112616221..95ff0a0e3d 100644 --- a/modules/setenv +++ b/modules/setenv @@ -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 diff --git a/modules/setlocale b/modules/setlocale index 5d3e58b208..918a037da3 100644 --- a/modules/setlocale +++ b/modules/setlocale @@ -7,7 +7,7 @@ m4/setlocale.m4 Depends-on: locale -localename +localename [test $REPLACE_SETLOCALE = 1] configure.ac: gl_FUNC_SETLOCALE diff --git a/modules/setsockopt b/modules/setsockopt index b429510a01..33726b11b9 100644 --- a/modules/setsockopt +++ b/modules/setsockopt @@ -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]) diff --git a/modules/shutdown b/modules/shutdown index c1e062104d..322ff8d891 100644 --- a/modules/shutdown +++ b/modules/shutdown @@ -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]) diff --git a/modules/sigaction b/modules/sigaction index 0e42e94487..93b848aca7 100644 --- a/modules/sigaction +++ b/modules/sigaction @@ -8,7 +8,7 @@ m4/sigaction.m4 Depends-on: signal -sigprocmask +sigprocmask [test $HAVE_SIGACTION = 0] configure.ac: gl_SIGACTION diff --git a/modules/signal b/modules/signal index ed9b14737e..d9d101777c 100644 --- a/modules/signal +++ b/modules/signal @@ -10,6 +10,7 @@ arg-nonnull c++defs include_next warn-on-use +extensions configure.ac: gl_SIGNAL_H @@ -21,7 +22,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' \ @@ -37,6 +38,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)' \ diff --git a/modules/signbit b/modules/signbit index 14a5754539..b3ad38836b 100644 --- a/modules/signbit +++ b/modules/signbit @@ -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 diff --git a/modules/sigprocmask b/modules/sigprocmask index e46abc97ac..fee745fa68 100644 --- a/modules/sigprocmask +++ b/modules/sigprocmask @@ -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 diff --git a/modules/sinl b/modules/sinl index 67621ed316..7f2007a948 100644 --- a/modules/sinl +++ b/modules/sinl @@ -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 diff --git a/modules/sleep b/modules/sleep index e859e59e52..c9b6c40809 100644 --- a/modules/sleep +++ b/modules/sleep @@ -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 diff --git a/modules/snprintf b/modules/snprintf index e8b5dfb47b..cd048aa646 100644 --- a/modules/snprintf +++ b/modules/snprintf @@ -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 diff --git a/modules/snprintf-posix b/modules/snprintf-posix index 16b38b7dde..874ba5a46f 100644 --- a/modules/snprintf-posix +++ b/modules/snprintf-posix @@ -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 diff --git a/modules/socket b/modules/socket index f5daa4919b..92df980466 100644 --- a/modules/socket +++ b/modules/socket @@ -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]) diff --git a/modules/sockets b/modules/sockets index b79a02fb7c..fe9292631c 100644 --- a/modules/sockets +++ b/modules/sockets @@ -10,7 +10,7 @@ m4/sockets.m4 Depends-on: socketlib sys_socket -close-hook +fd-hook configure.ac: gl_SOCKETS diff --git a/modules/spawn b/modules/spawn index eb0d4c13a6..a0e2a930fe 100644 --- a/modules/spawn +++ b/modules/spawn @@ -22,7 +22,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' \ diff --git a/modules/spawn-pipe b/modules/spawn-pipe index 04441b1a4e..9898b37598 100644 --- a/modules/spawn-pipe +++ b/modules/spawn-pipe @@ -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 diff --git a/modules/sprintf-posix b/modules/sprintf-posix index b5f02f6aaf..cdcc8aa510 100644 --- a/modules/sprintf-posix +++ b/modules/sprintf-posix @@ -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 diff --git a/modules/sqrtl b/modules/sqrtl index d4886665af..d7f73cac92 100644 --- a/modules/sqrtl +++ b/modules/sqrtl @@ -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 diff --git a/modules/stat b/modules/stat index 744aa7a0cb..db179aa38f 100644 --- a/modules/stat +++ b/modules/stat @@ -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 diff --git a/modules/stdarg b/modules/stdarg index 105a54c52d..92072e380f 100644 --- a/modules/stdarg +++ b/modules/stdarg @@ -26,7 +26,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' \ @@ -36,6 +37,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: diff --git a/modules/stdbool b/modules/stdbool index 5c1fe3ce36..b15aee7d72 100644 --- a/modules/stdbool +++ b/modules/stdbool @@ -19,12 +19,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: diff --git a/modules/stddef b/modules/stddef index 62e874a3cf..0909fc1ad5 100644 --- a/modules/stddef +++ b/modules/stddef @@ -20,7 +20,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' \ @@ -32,6 +33,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: diff --git a/modules/stdint b/modules/stdint index 76d8e7ea7c..da69a3d557 100644 --- a/modules/stdint +++ b/modules/stdint @@ -26,7 +26,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' \ @@ -58,6 +59,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: diff --git a/modules/stdint-tests b/modules/stdint-tests index ad320b2296..d83cd4c06d 100644 --- a/modules/stdint-tests +++ b/modules/stdint-tests @@ -6,6 +6,7 @@ m4/wint_t.m4 Depends-on: verify intprops +wchar configure.ac: gt_TYPE_WCHAR_T diff --git a/modules/stdio b/modules/stdio index c42a34f25b..c7065cc11e 100644 --- a/modules/stdio +++ b/modules/stdio @@ -22,7 +22,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' \ @@ -32,20 +32,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' \ @@ -58,14 +65,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' \ @@ -107,6 +118,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' \ diff --git a/modules/stdlib b/modules/stdlib index f00a862bd4..33766ac229 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -23,7 +23,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' \ diff --git a/modules/strcase b/modules/strcase index 0023f46794..0c91e06c4f 100644 --- a/modules/strcase +++ b/modules/strcase @@ -1,6 +1,12 @@ Description: Case-insensitive string comparison functions. +Status: +obsolete + +Notice: +This module is obsolete. + Files: lib/strcasecmp.c lib/strncasecmp.c diff --git a/modules/strchrnul b/modules/strchrnul index 8ae3ea6fb2..59c4cc68ab 100644 --- a/modules/strchrnul +++ b/modules/strchrnul @@ -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 diff --git a/modules/strdup-posix b/modules/strdup-posix index 4a474881b3..d158873fbe 100644 --- a/modules/strdup-posix +++ b/modules/strdup-posix @@ -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 diff --git a/modules/strerror b/modules/strerror index 1a204fa09e..cd14d12576 100644 --- a/modules/strerror +++ b/modules/strerror @@ -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 diff --git a/modules/strerror_r-posix b/modules/strerror_r-posix index 1a1d8c6dd8..75345ed123 100644 --- a/modules/strerror_r-posix +++ b/modules/strerror_r-posix @@ -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 diff --git a/modules/strftime-tests b/modules/strftime-tests index 96ad21334a..20bc7cd1e3 100644 --- a/modules/strftime-tests +++ b/modules/strftime-tests @@ -3,7 +3,6 @@ tests/test-strftime.c tests/macros.h Depends-on: -strftime configure.ac: diff --git a/modules/string b/modules/string index c109bca5c4..68ac30db06 100644 --- a/modules/string +++ b/modules/string @@ -23,7 +23,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' \ @@ -89,6 +89,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' \ diff --git a/modules/strings b/modules/strings index e5ef663942..b595e57459 100644 --- a/modules/strings +++ b/modules/strings @@ -20,7 +20,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' \ diff --git a/modules/strndup b/modules/strndup index 80f143bee5..c76e966a57 100644 --- a/modules/strndup +++ b/modules/strndup @@ -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 diff --git a/modules/strnlen b/modules/strnlen index 9f9f2ca22f..97fdd667f1 100644 --- a/modules/strnlen +++ b/modules/strnlen @@ -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 diff --git a/modules/strptime b/modules/strptime index 667d55245c..763dca5031 100644 --- a/modules/strptime +++ b/modules/strptime @@ -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 diff --git a/modules/strsep b/modules/strsep index 10ca817a82..eaa30329de 100644 --- a/modules/strsep +++ b/modules/strsep @@ -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 diff --git a/modules/strsignal b/modules/strsignal index 41dda4ec1b..c8e3bfab74 100644 --- a/modules/strsignal +++ b/modules/strsignal @@ -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 diff --git a/modules/strstr-simple b/modules/strstr-simple index 9ebf5dac89..5f66b279c2 100644 --- a/modules/strstr-simple +++ b/modules/strstr-simple @@ -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 diff --git a/modules/strtod b/modules/strtod index 056ff4263d..4c2151962a 100644 --- a/modules/strtod +++ b/modules/strtod @@ -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 index 0000000000..323df8aac1 --- /dev/null +++ b/modules/strtod-obsolete @@ -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 diff --git a/modules/strtoimax b/modules/strtoimax index 9f82af4536..5c8d5e3790 100644 --- a/modules/strtoimax +++ b/modules/strtoimax @@ -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 diff --git a/modules/strtok_r b/modules/strtok_r index 08afb439e3..bbfef2b68f 100644 --- a/modules/strtok_r +++ b/modules/strtok_r @@ -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 diff --git a/modules/strtol b/modules/strtol index 8a313a4029..654b2f77f3 100644 --- a/modules/strtol +++ b/modules/strtol @@ -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 - diff --git a/modules/strtoll b/modules/strtoll index 738c9efe05..8295e83c2a 100644 --- a/modules/strtoll +++ b/modules/strtoll @@ -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 - diff --git a/modules/strtoul b/modules/strtoul index 8cb6d66c48..dc2b50b12f 100644 --- a/modules/strtoul +++ b/modules/strtoul @@ -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 - diff --git a/modules/strtoull b/modules/strtoull index f02e9b0f53..97ce1fd850 100644 --- a/modules/strtoull +++ b/modules/strtoull @@ -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 - diff --git a/modules/strtoumax b/modules/strtoumax index e88628526f..7ad6846913 100644 --- a/modules/strtoumax +++ b/modules/strtoumax @@ -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 diff --git a/modules/symlink b/modules/symlink index 313a6a0d28..729f01cbeb 100644 --- a/modules/symlink +++ b/modules/symlink @@ -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 diff --git a/modules/symlinkat b/modules/symlinkat index 16646be699..f2666afff2 100644 --- a/modules/symlinkat +++ b/modules/symlinkat @@ -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 diff --git a/modules/symlinkat-tests b/modules/symlinkat-tests index 90331494a4..13ae9bd8a1 100644 --- a/modules/symlinkat-tests +++ b/modules/symlinkat-tests @@ -12,4 +12,3 @@ configure.ac: Makefile.am: TESTS += test-symlinkat check_PROGRAMS += test-symlinkat -test_symlinkat_LDADD = $(LDADD) @LIBINTL@ diff --git a/modules/sys_file b/modules/sys_file index 27d87ec9f4..64c3d4d3f0 100644 --- a/modules/sys_file +++ b/modules/sys_file @@ -20,7 +20,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! */'; \ diff --git a/modules/sys_ioctl b/modules/sys_ioctl index f5051be2e0..1f8fb86028 100644 --- a/modules/sys_ioctl +++ b/modules/sys_ioctl @@ -22,7 +22,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! */'; \ diff --git a/modules/sys_select b/modules/sys_select index 9c24a6d639..a70d317a9b 100644 --- a/modules/sys_select +++ b/modules/sys_select @@ -23,7 +23,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! */'; \ diff --git a/modules/sys_socket b/modules/sys_socket index 66c3164487..9d05fd4773 100644 --- a/modules/sys_socket +++ b/modules/sys_socket @@ -13,6 +13,7 @@ c++defs errno include_next socklen +sys_uio warn-on-use configure.ac: @@ -26,7 +27,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! */'; \ diff --git a/modules/sys_stat b/modules/sys_stat index ba70116eac..ac7110a0d7 100644 --- a/modules/sys_stat +++ b/modules/sys_stat @@ -24,7 +24,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! */'; \ diff --git a/modules/sys_time b/modules/sys_time index f4dfa19b90..26c55207e3 100644 --- a/modules/sys_time +++ b/modules/sys_time @@ -22,7 +22,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! */'; \ diff --git a/modules/sys_times b/modules/sys_times index 2ce8e73e2f..febba0f293 100644 --- a/modules/sys_times +++ b/modules/sys_times @@ -21,7 +21,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 index 0000000000..2152718cca --- /dev/null +++ b/modules/sys_uio @@ -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 index 0000000000..0258579530 --- /dev/null +++ b/modules/sys_uio-tests @@ -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 diff --git a/modules/sys_utsname b/modules/sys_utsname index ff60b4ed5f..87f9bec588 100644 --- a/modules/sys_utsname +++ b/modules/sys_utsname @@ -21,7 +21,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! */'; \ diff --git a/modules/sys_wait b/modules/sys_wait index ad42623fe7..654f7217c5 100644 --- a/modules/sys_wait +++ b/modules/sys_wait @@ -21,7 +21,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! */'; \ diff --git a/modules/sysexits b/modules/sysexits index 191ba60ca9..5b1111e096 100644 --- a/modules/sysexits +++ b/modules/sysexits @@ -7,6 +7,7 @@ m4/sysexits.m4 Depends-on: include_next +stdlib configure.ac: gl_SYSEXITS @@ -19,7 +20,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' \ @@ -30,6 +32,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: diff --git a/modules/tanl b/modules/tanl index b00fd1bd51..7840dc18b9 100644 --- a/modules/tanl +++ b/modules/tanl @@ -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 diff --git a/modules/tcgetsid b/modules/tcgetsid index 1b72c8d43a..6dddb6eb33 100644 --- a/modules/tcgetsid +++ b/modules/tcgetsid @@ -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 diff --git a/modules/termios b/modules/termios index 6af1195a3d..71fd548dd1 100644 --- a/modules/termios +++ b/modules/termios @@ -20,7 +20,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' \ diff --git a/modules/time b/modules/time index 8cbe99dffd..140f6dd4b8 100644 --- a/modules/time +++ b/modules/time @@ -23,7 +23,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' \ diff --git a/modules/tmpfile b/modules/tmpfile index 0fa61e8e3c..6adf22a9de 100644 --- a/modules/tmpfile +++ b/modules/tmpfile @@ -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 diff --git a/modules/trunc b/modules/trunc index 1c6f706276..71863a54a6 100644 --- a/modules/trunc +++ b/modules/trunc @@ -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 diff --git a/modules/truncf b/modules/truncf index 6c4c46f12a..15e35e8acf 100644 --- a/modules/truncf +++ b/modules/truncf @@ -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 diff --git a/modules/truncl b/modules/truncl index d3d88847ae..808c63ed84 100644 --- a/modules/truncl +++ b/modules/truncl @@ -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 diff --git a/modules/tzset b/modules/tzset index 54f13e3801..608f7756d7 100644 --- a/modules/tzset +++ b/modules/tzset @@ -16,7 +16,7 @@ Include: <time.h> License: -GPL +LGPL Maintainer: Jim Meyering diff --git a/modules/uname b/modules/uname index ac5ad88fa7..e7364ad3c3 100644 --- a/modules/uname +++ b/modules/uname @@ -7,7 +7,7 @@ m4/uname.m4 Depends-on: sys_utsname -gethostname +gethostname [test $HAVE_UNAME = 0] configure.ac: gl_FUNC_UNAME diff --git a/modules/unistd b/modules/unistd index c30513305f..f750cecf4f 100644 --- a/modules/unistd +++ b/modules/unistd @@ -22,7 +22,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' \ @@ -58,6 +58,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' \ @@ -66,6 +67,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' \ @@ -126,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' \ diff --git a/modules/unlink b/modules/unlink index a27a308dce..26af43ddcc 100644 --- a/modules/unlink +++ b/modules/unlink @@ -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 diff --git a/modules/unlockpt b/modules/unlockpt index 4eadff8521..3a5c7b86fd 100644 --- a/modules/unlockpt +++ b/modules/unlockpt @@ -9,7 +9,7 @@ m4/unlockpt.m4 Depends-on: stdlib extensions -ptsname +ptsname [test $HAVE_UNLOCKPT = 0] configure.ac: gl_FUNC_UNLOCKPT diff --git a/modules/unsetenv b/modules/unsetenv index 6dff883c71..26662b349b 100644 --- a/modules/unsetenv +++ b/modules/unsetenv @@ -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 diff --git a/modules/usleep b/modules/usleep index c77826bbd7..0bee1cc8b0 100644 --- a/modules/usleep +++ b/modules/usleep @@ -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 diff --git a/modules/utimecmp b/modules/utimecmp index 7be906b219..a3160c8d54 100644 --- a/modules/utimecmp +++ b/modules/utimecmp @@ -11,7 +11,6 @@ hash stat-time time utimens -xalloc intprops lstat stdbool diff --git a/modules/utimensat b/modules/utimensat index 2377080999..858fee18b7 100644 --- a/modules/utimensat +++ b/modules/utimensat @@ -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 diff --git a/modules/utimensat-tests b/modules/utimensat-tests index 26dbac6762..987a86abc5 100644 --- a/modules/utimensat-tests +++ b/modules/utimensat-tests @@ -19,4 +19,4 @@ configure.ac: Makefile.am: TESTS += test-utimensat check_PROGRAMS += test-utimensat -test_utimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBINTL@ +test_utimensat_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) diff --git a/modules/vasprintf b/modules/vasprintf index e0eed16b24..0b8e1419aa 100644 --- a/modules/vasprintf +++ b/modules/vasprintf @@ -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 diff --git a/modules/vdprintf b/modules/vdprintf index 3ddda20d13..eba447167c 100644 --- a/modules/vdprintf +++ b/modules/vdprintf @@ -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 diff --git a/modules/vdprintf-posix b/modules/vdprintf-posix index 649eacfce4..518ecde526 100644 --- a/modules/vdprintf-posix +++ b/modules/vdprintf-posix @@ -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 diff --git a/modules/vfprintf-posix b/modules/vfprintf-posix index 45af3638f5..69b6608e09 100644 --- a/modules/vfprintf-posix +++ b/modules/vfprintf-posix @@ -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 index 0000000000..c2d6a8d35d --- /dev/null +++ b/modules/vfscanf @@ -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 diff --git a/modules/vprintf-posix b/modules/vprintf-posix index 319d83d6bc..b861d10552 100644 --- a/modules/vprintf-posix +++ b/modules/vprintf-posix @@ -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 index 0000000000..cf1d8c2405 --- /dev/null +++ b/modules/vscanf @@ -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 diff --git a/modules/vsnprintf b/modules/vsnprintf index ce44cf1536..053b10c32a 100644 --- a/modules/vsnprintf +++ b/modules/vsnprintf @@ -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 diff --git a/modules/vsnprintf-posix b/modules/vsnprintf-posix index 0f36cd9909..198beeb58a 100644 --- a/modules/vsnprintf-posix +++ b/modules/vsnprintf-posix @@ -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 diff --git a/modules/vsprintf-posix b/modules/vsprintf-posix index 44d89f5407..10e5385612 100644 --- a/modules/vsprintf-posix +++ b/modules/vsprintf-posix @@ -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 diff --git a/modules/wait-process b/modules/wait-process index 9120bbcf0a..afc8854220 100644 --- a/modules/wait-process +++ b/modules/wait-process @@ -10,10 +10,10 @@ m4/sig_atomic_t.m4 Depends-on: fatal-signal error -exit xalloc gettext-h stdbool +stdlib sys_wait unistd atexit diff --git a/modules/wchar b/modules/wchar index 154fb81131..5af5cb7dee 100644 --- a/modules/wchar +++ b/modules/wchar @@ -23,7 +23,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' \ diff --git a/modules/wcrtomb b/modules/wcrtomb index cdafa555ac..f9fea15ff1 100644 --- a/modules/wcrtomb +++ b/modules/wcrtomb @@ -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 diff --git a/modules/wcscasecmp b/modules/wcscasecmp index 18c549c2f6..4639354bf5 100644 --- a/modules/wcscasecmp +++ b/modules/wcscasecmp @@ -8,7 +8,7 @@ m4/wcscasecmp.m4 Depends-on: wchar -wctype-h +wctype-h [test $HAVE_WCSCASECMP = 0] configure.ac: gl_FUNC_WCSCASECMP diff --git a/modules/wcscspn b/modules/wcscspn index 2034b81b17..14b9a24e85 100644 --- a/modules/wcscspn +++ b/modules/wcscspn @@ -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 diff --git a/modules/wcsdup b/modules/wcsdup index 7e3cd66172..49a512e607 100644 --- a/modules/wcsdup +++ b/modules/wcsdup @@ -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 diff --git a/modules/wcsncasecmp b/modules/wcsncasecmp index 88f36198da..3a1f84a1cd 100644 --- a/modules/wcsncasecmp +++ b/modules/wcsncasecmp @@ -8,7 +8,7 @@ m4/wcsncasecmp.m4 Depends-on: wchar -wctype-h +wctype-h [test $HAVE_WCSNCASECMP = 0] configure.ac: gl_FUNC_WCSNCASECMP diff --git a/modules/wcsnrtombs b/modules/wcsnrtombs index e8e975a73f..3582ae57fc 100644 --- a/modules/wcsnrtombs +++ b/modules/wcsnrtombs @@ -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 diff --git a/modules/wcspbrk b/modules/wcspbrk index a5b34f538b..b7aefa47c4 100644 --- a/modules/wcspbrk +++ b/modules/wcspbrk @@ -14,7 +14,7 @@ m4/wcspbrk.m4 Depends-on: wchar -wcschr +wcschr [test $HAVE_WCSPBRK = 0] configure.ac: gl_FUNC_WCSPBRK diff --git a/modules/wcsrtombs b/modules/wcsrtombs index 235b06b043..49c0503953 100644 --- a/modules/wcsrtombs +++ b/modules/wcsrtombs @@ -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 diff --git a/modules/wcsspn b/modules/wcsspn index 3ecd53b979..035398d9bc 100644 --- a/modules/wcsspn +++ b/modules/wcsspn @@ -14,7 +14,7 @@ m4/wcsspn.m4 Depends-on: wchar -wcschr +wcschr [test $HAVE_WCSSPN = 0] configure.ac: gl_FUNC_WCSSPN diff --git a/modules/wcsstr b/modules/wcsstr index 22a2fb763c..d4f22f8509 100644 --- a/modules/wcsstr +++ b/modules/wcsstr @@ -8,7 +8,7 @@ m4/wcsstr.m4 Depends-on: wchar -wcschr +wcschr [test $HAVE_WCSSTR = 0] configure.ac: gl_FUNC_WCSSTR diff --git a/modules/wcstok b/modules/wcstok index 6f92b050b9..dc78e135bc 100644 --- a/modules/wcstok +++ b/modules/wcstok @@ -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 diff --git a/modules/wcswidth b/modules/wcswidth index 2b748eb7a6..629f21db80 100644 --- a/modules/wcswidth +++ b/modules/wcswidth @@ -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 diff --git a/modules/wctob b/modules/wctob index eba2ebf293..be430ebf41 100644 --- a/modules/wctob +++ b/modules/wctob @@ -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 diff --git a/modules/wctomb b/modules/wctomb index 81d41c4b90..5077005487 100644 --- a/modules/wctomb +++ b/modules/wctomb @@ -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 diff --git a/modules/wctype b/modules/wctype index d2481640a1..ffc76a863e 100644 --- a/modules/wctype +++ b/modules/wctype @@ -14,7 +14,7 @@ m4/wctype.m4 Depends-on: wctype-h -iswblank +iswblank [test $HAVE_WCTYPE_T = 0] configure.ac: gl_FUNC_WCTYPE diff --git a/modules/wctype-h b/modules/wctype-h index f0d7989fd5..30c5ceaeed 100644 --- a/modules/wctype-h +++ b/modules/wctype-h @@ -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' \ diff --git a/modules/wcwidth b/modules/wcwidth index e4a9460e94..27327a15c9 100644 --- a/modules/wcwidth +++ b/modules/wcwidth @@ -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 diff --git a/modules/write b/modules/write index 0f0fc5f234..736e40b091 100644 --- a/modules/write +++ b/modules/write @@ -7,7 +7,7 @@ m4/write.m4 Depends-on: unistd -raise +raise [test $REPLACE_WRITE = 1] configure.ac: gl_FUNC_WRITE diff --git a/modules/xalloc b/modules/xalloc index 43ee94205c..0edcfc6eac 100644 --- a/modules/xalloc +++ b/modules/xalloc @@ -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 index 0000000000..708c621f30 --- /dev/null +++ b/modules/xalloc-oversized @@ -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 index 0000000000..6ae3614342 --- /dev/null +++ b/modules/xgetgroups @@ -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 diff --git a/modules/xsetenv b/modules/xsetenv index 29319f1223..66c1c4c373 100644 --- a/modules/xsetenv +++ b/modules/xsetenv @@ -10,8 +10,8 @@ Depends-on: setenv unsetenv error -exit gettext-h +stdlib configure.ac: diff --git a/modules/xstrtol b/modules/xstrtol index 3ce76a8802..b48a4bb1b6 100644 --- a/modules/xstrtol +++ b/modules/xstrtol @@ -14,7 +14,7 @@ error getopt-gnu gettext-h intprops -inttypes +inttypes-incomplete configure.ac: gl_XSTRTOL diff --git a/tests/socket-client.h b/tests/socket-client.h new file mode 100644 index 0000000000..ac82463ce1 --- /dev/null +++ b/tests/socket-client.h @@ -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 index 0000000000..283ef2fc2a --- /dev/null +++ b/tests/socket-server.h @@ -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; +} diff --git a/tests/test-chown.h b/tests/test-chown.h index 7630de48da..85cbb5afc9 100644 --- a/tests/test-chown.h +++ b/tests/test-chown.h @@ -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 a group that + multiple groups, the current directory is owned by a group that the current process belongs to but different than getegid(), and the current directory does not have the S_ISGID bit, then regular files created in the directory belong to the directory's group, @@ -71,7 +71,7 @@ test_chown (int (*func) (char const *, uid_t, gid_t), bool print) ASSERT (close (creat (BASE "dir/file", 0600)) == 0); ASSERT (stat (BASE "dir/file", &st1) == 0); ASSERT (st1.st_uid != (uid_t) -1); - ASSERT (st1.st_gid != (uid_t) -1); + ASSERT (st1.st_gid != (gid_t) -1); ASSERT (st1.st_gid == getegid ()); /* Sanity check of error cases. */ diff --git a/tests/test-fclose.c b/tests/test-fclose.c new file mode 100644 index 0000000000..d9b940619b --- /dev/null +++ b/tests/test-fclose.c @@ -0,0 +1,93 @@ +/* Test of fclose module. + Copyright (C) 2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake. */ + +#include <config.h> + +#include <stdio.h> + +#include "signature.h" +SIGNATURE_CHECK (fclose, int, (FILE *)); + +#include <errno.h> +#include <fcntl.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "macros.h" + +#define BASE "test-fclose.t" + +int +main (int argc, char **argv) +{ + const char buf[] = "hello world"; + int fd; + int fd2; + FILE *f; + + /* Prepare a seekable file. */ + fd = open (BASE, O_RDWR | O_CREAT | O_TRUNC, 0600); + ASSERT (0 <= fd); + ASSERT (write (fd, buf, sizeof buf) == sizeof buf); + ASSERT (lseek (fd, 1, SEEK_SET) == 1); + + /* Create an output stream visiting the file; when it is closed, all + other file descriptors visiting the file must see the new file + position. */ + fd2 = dup (fd); + ASSERT (0 <= fd2); + f = fdopen (fd2, "w"); + ASSERT (f); + ASSERT (fputc (buf[1], f) == buf[1]); + ASSERT (fclose (f) == 0); + errno = 0; + ASSERT (lseek (fd2, 0, SEEK_CUR) == -1); + ASSERT (errno == EBADF); + ASSERT (lseek (fd, 0, SEEK_CUR) == 2); + +#if GNULIB_FFLUSH + /* Likewise for an input stream, but only when we know fflush works + on input streams. */ + fd2 = dup (fd); + ASSERT (0 <= fd2); + f = fdopen (fd2, "r"); + ASSERT (f); + ASSERT (fgetc (f) == buf[2]); + ASSERT (fclose (f) == 0); + errno = 0; + ASSERT (lseek (fd2, 0, SEEK_CUR) == -1); + ASSERT (errno == EBADF); + ASSERT (lseek (fd, 0, SEEK_CUR) == 3); +#endif + + /* Test that fclose() sets errno if someone else closes the stream + fd behind the back of stdio. */ + f = fdopen (fd, "w+"); + ASSERT (f); + ASSERT (close (fd) == 0); + errno = 0; + ASSERT (fclose (f) == EOF); + ASSERT (errno == EBADF); + + /* Clean up. */ + ASSERT (remove (BASE) == 0); + + return 0; +} diff --git a/tests/test-fcntl-h.c b/tests/test-fcntl-h.c index dd20fbb406..648701ef4b 100644 --- a/tests/test-fcntl-h.c +++ b/tests/test-fcntl-h.c @@ -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; } diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c index 482698937a..d2984e226b 100644 --- a/tests/test-getaddrinfo.c +++ b/tests/test-getaddrinfo.c @@ -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 index 0000000000..67ee66d539 --- /dev/null +++ b/tests/test-getcwd-lgpl.c @@ -0,0 +1,87 @@ +/* Test of getcwd() function. + Copyright (C) 2009-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> + +#include <unistd.h> + +#include "signature.h" +SIGNATURE_CHECK (getcwd, char *, (char *, size_t)); + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "macros.h" + +int +main (int argc, char **argv) +{ + char *pwd1; + char *pwd2; + /* If the user provides an argument, attempt to chdir there first. */ + if (1 < argc) + { + if (chdir (argv[1]) == 0) + printf ("changed to directory %s\n", argv[1]); + } + + pwd1 = getcwd (NULL, 0); + ASSERT (pwd1 && *pwd1); + if (1 < argc) + printf ("cwd=%s\n", pwd1); + + /* Make sure the result is usable. */ + ASSERT (chdir (pwd1) == 0); + ASSERT (chdir (".//./.") == 0); + + /* Make sure that result is normalized. */ + pwd2 = getcwd (NULL, 0); + ASSERT (pwd2); + ASSERT (strcmp (pwd1, pwd2) == 0); + free (pwd2); + { + size_t len = strlen (pwd1); + ssize_t i = len - 10; + if (i < 1) + i = 1; + pwd2 = getcwd (NULL, len + 1); + ASSERT (pwd2); + free (pwd2); + pwd2 = malloc (len + 2); + for ( ; i <= len; i++) + { + errno = 0; + ASSERT (getcwd (pwd2, i) == NULL); + ASSERT (errno == ERANGE); + errno = 0; + ASSERT (getcwd (NULL, i) == NULL); + ASSERT (errno == ERANGE); + } + ASSERT (getcwd (pwd2, len + 1) == pwd2); + pwd2[len] = '/'; + pwd2[len + 1] = '\0'; + } + ASSERT (strstr (pwd2, "/./") == NULL); + ASSERT (strstr (pwd2, "/../") == NULL); + ASSERT (strstr (pwd2 + 1 + (pwd2[1] == '/'), "//") == NULL); + + free (pwd1); + free (pwd2); + + return 0; +} diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c index 18fc74f94b..14a526f65e 100644 --- a/tests/test-getcwd.c +++ b/tests/test-getcwd.c @@ -18,59 +18,206 @@ #include <unistd.h> -#include "signature.h" -SIGNATURE_CHECK (getcwd, char *, (char *, size_t)); - +#include <errno.h> +#include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/stat.h> #include "macros.h" -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 (); } diff --git a/tests/test-hash.c b/tests/test-hash.c index 108daefdf4..4a8a3bef37 100644 --- a/tests/test-hash.c +++ b/tests/test-hash.c @@ -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-lchown.h b/tests/test-lchown.h index aa10674187..229ed6b01b 100644 --- a/tests/test-lchown.h +++ b/tests/test-lchown.h @@ -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 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-linkat.c b/tests/test-linkat.c index 8d179e2faf..2bf1790524 100644 --- a/tests/test-linkat.c +++ b/tests/test-linkat.c @@ -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 index 0000000000..0dc47b9ae7 --- /dev/null +++ b/tests/test-netdb-c++.cc @@ -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 index 0000000000..66a13e47e4 --- /dev/null +++ b/tests/test-nonblocking-misc.h @@ -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 (¤t_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 index 0000000000..d12a6e0ce5 --- /dev/null +++ b/tests/test-nonblocking-pipe-child.c @@ -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 index 0000000000..e61269ce5d --- /dev/null +++ b/tests/test-nonblocking-pipe-main.c @@ -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 index 0000000000..c4e65616a4 --- /dev/null +++ b/tests/test-nonblocking-pipe.h @@ -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 index 0000000000..dd692be7ee --- /dev/null +++ b/tests/test-nonblocking-pipe.sh @@ -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 index 0000000000..220862ff2d --- /dev/null +++ b/tests/test-nonblocking-reader.h @@ -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 index 0000000000..17545cf644 --- /dev/null +++ b/tests/test-nonblocking-socket-child.c @@ -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 index 0000000000..034873d5d2 --- /dev/null +++ b/tests/test-nonblocking-socket-main.c @@ -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 index 0000000000..5f2268d9c3 --- /dev/null +++ b/tests/test-nonblocking-socket.h @@ -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 index 0000000000..3818c93d3a --- /dev/null +++ b/tests/test-nonblocking-socket.sh @@ -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 index 0000000000..6db53f6dab --- /dev/null +++ b/tests/test-nonblocking-writer.h @@ -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; +} diff --git a/tests/test-nonblocking.c b/tests/test-nonblocking.c index f1b7610543..f3f1f1355b 100644 --- a/tests/test-nonblocking.c +++ b/tests/test-nonblocking.c @@ -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. */ { diff --git a/tests/test-open.h b/tests/test-open.h index 3e5c5e1726..2ba5d137bf 100644 --- a/tests/test-open.h +++ b/tests/test-open.h @@ -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) { diff --git a/tests/test-passfd.c b/tests/test-passfd.c index d657ad9d66..315e6c21ba 100644 --- a/tests/test-passfd.c +++ b/tests/test-passfd.c @@ -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 } diff --git a/tests/test-pipe2.c b/tests/test-pipe2.c index ddfb819abb..8ca8e01363 100644 --- a/tests/test-pipe2.c +++ b/tests/test-pipe2.c @@ -33,6 +33,7 @@ SIGNATURE_CHECK (pipe2, int, (int[2], int)); #include "binary-io.h" #include "macros.h" +#include "nonblocking.h" /* Return true if FD is open. */ static bool @@ -67,49 +68,23 @@ is_cloexec (int fd) #endif } -/* Return true if FD is in non-blocking mode. */ -static bool -is_nonblocking (int fd) -{ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* We don't use the non-blocking mode for sockets here. */ - return 0; -#else - int flags; - ASSERT ((flags = fcntl (fd, F_GETFL)) >= 0); - return (flags & O_NONBLOCK) != 0; -#endif -} - int main () { int use_nonblocking; int use_cloexec; -#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) for (use_nonblocking = 0; use_nonblocking <= 1; use_nonblocking++) -#else - use_nonblocking = 0; -#endif -#if O_CLOEXEC - for (use_cloexec = 0; use_cloexec <= 1; use_cloexec++) -#else - use_cloexec = 0; -#endif + for (use_cloexec = 0; use_cloexec <= !!O_CLOEXEC; use_cloexec++) { int o_flags; int fd[2]; o_flags = 0; -#if !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) if (use_nonblocking) o_flags |= O_NONBLOCK; -#endif -#if O_CLOEXEC if (use_cloexec) o_flags |= O_CLOEXEC; -#endif fd[0] = -1; fd[1] = -1; @@ -131,14 +106,17 @@ 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; diff --git a/tests/test-renameat.c b/tests/test-renameat.c index 1849a24413..96fe3a7555 100644 --- a/tests/test-renameat.c +++ b/tests/test-renameat.c @@ -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); diff --git a/tests/test-stdio-c++.cc b/tests/test-stdio-c++.cc index a9d00a39f8..07faf0fa02 100644 --- a/tests/test-stdio-c++.cc +++ b/tests/test-stdio-c++.cc @@ -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)); diff --git a/tests/test-sys_socket.c b/tests/test-sys_socket.c index 8f323ca1d9..a6e99d6008 100644 --- a/tests/test-sys_socket.c +++ b/tests/test-sys_socket.c @@ -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 index 0000000000..7855a6bc43 --- /dev/null +++ b/tests/test-sys_uio.c @@ -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; +} diff --git a/top/README-release b/top/README-release new file mode 100644 index 0000000000..69841d20eb --- /dev/null +++ b/top/README-release @@ -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 diff --git a/top/maint.mk b/top/maint.mk index 524b69f470..07efceca13 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -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) @@ -823,8 +822,8 @@ require_exactly_one_NL_at_EOF_ = \ END { exit defined $$fail } sc_prohibit_empty_lines_at_EOF: @perl -le '$(require_exactly_one_NL_at_EOF_)' $$($(VC_LIST_EXCEPT)) \ - || { echo '$(ME): empty line(s) or no newline at EOF' \ - 1>&2; exit 1; } || :; \ + || { echo '$(ME): empty line(s) or no newline at EOF' \ + 1>&2; exit 1; } || : # Make sure we don't use st_blocks. Use ST_NBLOCKS instead. # This is a bit of a kludge, since it prevents use of the string @@ -841,6 +840,31 @@ sc_prohibit_S_IS_definition: halt='do not define S_IS* macros; include <sys/stat.h>' \ $(_sc_search_regexp) +prohibit_doubled_word_RE_ ?= \ + /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims +prohibit_doubled_word_ = \ + -e 'while ($(prohibit_doubled_word_RE_))' \ + -e ' {' \ + -e ' $$n = ($$` =~ tr/\n/\n/ + 1);' \ + -e ' ($$v = $$&) =~ s/\n/\\n/g;' \ + -e ' print "$$ARGV:$$n:$$v\n";' \ + -e ' }' + +# Define this to a regular expression that matches +# any filename:dd:match lines you want to ignore. +# The default is to ignore no matches. +ignore_doubled_word_match_RE_ ?= ^$$ + +sc_prohibit_doubled_word: + @perl -n -0777 $(prohibit_doubled_word_) $$($(VC_LIST_EXCEPT)) \ + | grep -vE '$(ignore_doubled_word_match_RE_)' \ + | grep . && { echo '$(ME): doubled words' 1>&2; exit 1; } || : + +sc_prohibit_can_not: + @prohibit='\<can[ ]not\>' \ + halt='use "cannot", not "can'' not"' \ + $(_sc_search_regexp) + _ptm1 = use "test C1 && test C2", not "test C1 -''a C2" _ptm2 = use "test C1 || test C2", not "test C1 -''o C2" # Using test's -a and -o operators is not portable. @@ -917,16 +941,23 @@ 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 @@ -1092,11 +1123,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 \ @@ -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 |