Bruno Haible [Tue, 21 Dec 2010 16:16:09 +0000 (17:16 +0100)]
Tests for module 'floor'.
* modules/floor-tests: New file.
* tests/test-floor1.c: New file, based on tests/test-floorl.c.
* tests/test-floor2.c: New file, based on tests/test-floorf2.c.
Bruno Haible [Tue, 21 Dec 2010 11:54:21 +0000 (12:54 +0100)]
Fix cross-compilation guesses on Solaris.
* m4/fopen.m4 (gl_FUNC_FOPEN): Correct shell pattern so that it does
not match "solaris2.10".
* m4/open.m4 (gl_FUNC_OPEN): Likewise.
* m4/printf.m4 (gl_SNPRINTF_TRUNCATION_C99, gl_SNPRINTF_DIRECTIVE_N,
gl_VSNPRINTF_ZEROSIZE_C99): Likewise.
Paul Eggert [Tue, 21 Dec 2010 09:15:32 +0000 (01:15 -0800)]
snprintf: port snprintf (NULL, 0, ...) to Solaris 8 and 9
This fixes a problem observed with the latest coreutils snapshot
that caused a test to fail on Solaris 8. src/csplit.c's call
snprintf (NULL, 0, format, UINT_MAX) returns -1 on Solaris 9 and
earlier, instead of returning the number of bytes that would have
been generated; this causes csplit to incorrectly report memory
exhaustion.
* m4/printf.m4 (gl_SNPRINTF_RETVAL_C99): Also check for
snprintf (NULL, 0, ...) and (for good measure) snprintf (buf, 0, ...).
Guess that it doesn't work on Solaris 2.6 through 9. Adjust
comments to match.
(gl_PRINTF_SIZES_C99, gl_PRINTF_DIRECTIVE_F, gl_SNPRINTF_RETVAL_C99):
Fix typo in matching older versions of Solaris: "solaris2.10"
is matched by the shell pattern "solaris2.[0-9]*". This matters
only for guessing while cross-compiling.
* m4/snprintf.m4 (gl_FUNC_SNPRINTF): Also check gl_SNPRINTF_RETVAL_C99.
Paul Eggert [Tue, 21 Dec 2010 07:48:19 +0000 (23:48 -0800)]
ftoastr: fix comment again
* lib/ftoastr.h: Fix typo in comment. Noted by Ben Pfaff in
<http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00149.html>.
Also, simplify example a bit by using flags = 0.
Bruno Haible [Mon, 20 Dec 2010 12:10:22 +0000 (13:10 +0100)]
ttyname_r: Add missing declaration on HP-UX 11.
* lib/unistd.in.h (ttyname_r): Test HAVE_DECL_TTYNAME_R instead of
HAVE_TTYNAME_R.
* m4/ttyname_r.m4 (gl_FUNC_TTYNAME_R): Test whether ttyname_r is
declared. Set HAVE_TTYNAME_R always.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize
HAVE_DECL_TTYNAME_R, not HAVE_TTYNAME_R.
* modules/unistd (Makefile.am): Substitute HAVE_DECL_TTYNAME_R, not
HAVE_TTYNAME_R.
* doc/posix-functions/ttyname_r.texi: Document the HP-UX 11 problem.
Bruno Haible [Mon, 20 Dec 2010 01:18:07 +0000 (02:18 +0100)]
wctype: Make it work in C++ mode on OSF/1 5.1.
* lib/wctype.in.h (iswblank): Declare but not define here.
* lib/iswblank.c: New file, extracted from lib/wctype.in.h.
* m4/wctype_h.m4 (gl_WCTYPE_H): Arrange to compile it if needed.
* modules/wctype (Files): Add lib/iswblank.c.
Bruno Haible [Sun, 19 Dec 2010 23:47:57 +0000 (00:47 +0100)]
tcgetsid: Add missing declaration on OSF/1 5.1.
* lib/termios.in.h (tcgetsid): Test HAVE_DECL_TCGETSID instead of
HAVE_TCGETSID.
* m4/tcgetsid.m4 (gl_FUNC_TCGETSID): Test whether tcgetsid is declared.
Don't set HAVE_TCGETSID.
* m4/termios_h.m4 (gl_TERMIOS_H_DEFAULTS): Initialize
HAVE_DECL_TCGETSID, not HAVE_TCGETSID.
* modules/termios (Makefile.am): Substitute HAVE_DECL_TCGETSID, not
HAVE_TCGETSID.
* doc/posix-functions/tcgetsid.texi: Mention the OSF/1 5.1 problem.
Jim Meyering [Sun, 19 Dec 2010 21:48:27 +0000 (22:48 +0100)]
setenv: restore to working order
$HAVE_SETENV is used in gl_FUNC_SETENV, yet its definitions were
mistakenly removed.
* m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Restore code to set
HAVE_SETENV.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Restore code to initialize
HAVE_SETENV.
Bruno Haible [Sun, 19 Dec 2010 17:35:54 +0000 (18:35 +0100)]
unsetenv: Add missing declaration on OSF/1 5.1.
* lib/stdlib.in.h (setenv): Test HAVE_DECL_UNSETENV, not HAVE_UNSETENV.
* m4/setenv.m4 (gl_FUNC_UNSETENV): Test whether unsetenv is declared.
Don't set HAVE_UNSETENV. In the test program, set _BSD.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_UNSETENV,
not HAVE_UNSETENV.
* modules/stdlib (Makefile.am): Substitute HAVE_DECL_UNSETENV, not
HAVE_UNSETENV.
* doc/posix-functions/unsetenv.texi: Mention the OSF/1 5.1 problem.
Bruno Haible [Sun, 19 Dec 2010 17:08:03 +0000 (18:08 +0100)]
setenv: Add missing declaration on OSF/1 5.1.
* lib/stdlib.in.h (setenv): Test HAVE_DECL_SETENV, not HAVE_SETENV.
* m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Test whether setenv is
declared. Don't set HAVE_SETENV.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_SETENV,
not HAVE_SETENV.
* modules/stdlib (Makefile.am): Substitute HAVE_DECL_SETENV, not
HAVE_SETENV.
* doc/posix-functions/setenv.texi: Mention the OSF/1 5.1 problem.
Bruno Haible [Sun, 19 Dec 2010 10:59:10 +0000 (11:59 +0100)]
relocatable-prog-wrapper: Separate from relocatable-prog.
* modules/relocatable-prog (Makefile.am): Define uninstall-hook and
uninstall-relocwrapper rule here.
* modules/relocatable-prog-wrapper (Makefile.am): ... not here.
Reported by Ian Beckwith <ianb@erislabs.net>.
Paul Eggert [Sun, 19 Dec 2010 06:22:43 +0000 (22:22 -0800)]
acl: port to Solaris 8 when copying from tmpfs to ufs
* lib/copy-acl.c (qcopy_acl): Also allow EINVAL as an ignorable
error number. Problem observed on Solaris 8 with latest
coreutils, with "mv A B", where A is on a tmpfs file system and B
is on a ufs file system. This caused coreutils' mv/part-symlink
test to fail.
Paul Eggert [Sun, 19 Dec 2010 03:54:27 +0000 (19:54 -0800)]
tests: set fail=0 at start
* tests/init.sh (setup_): Move fail=0 initialization here ...
(mktempd_): ... from here, so that tests can rely on fail being
set to 0 initially. This fixes a problem in coreutils; see:
http://lists.gnu.org/archive/html/coreutils/2010-12/msg00083.html
Pádraig Brady [Tue, 22 Jun 2010 23:42:54 +0000 (00:42 +0100)]
memmem: rearrange memmem and expand memmem-simple modules
Move all functional checks to memmem-simple so that one has
a fully functional memmem by using just this module.
Restrict the memmem module to performance checks only.
Document exactly how the memmem and memmem-simple modules
relate to each other.
* m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE, gl_FUNC_MEMMEM): Move the
empty needle check from the memmem module to memmem-simple.
Also expand the empty needle check to ensure the correct
pointer is returned, not just a non NULL pointer.
In gl_FUNC_MEMMEM, make the cross compilation check only
consider the versions with performance issues.
* doc/glibc-functions/memmem.texi: Rearrange the portability
documentation to correlate with the rearranged checks.
Pádraig Brady [Wed, 15 Dec 2010 19:28:52 +0000 (20:28 +0100)]
Improve cross-compilation guesses for uClibc.
* m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE): When cross-compiling, assume
that uClibc does not have the glibc bug.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Likewise.
* m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Likewise.
Pádraig Brady [Mon, 13 Dec 2010 08:08:23 +0000 (08:08 +0000)]
read-file: reorganize to avoid various issues
* lib/read-file.c (fread_file): Read 1 more byte than is
currently in a regular file, to immediately detect EOF,
and thus avoid any realloc()s. As well as being slower,
these may fail, thus artificially limiting the supported size.
Allocate up to SIZE_MAX for streams, rather than limiting
to about SIZE_MAX - SIZE_MAX/5.
Don't use the 'size + BUFSIZ + 1' expression, which
could overflow and cause invalid operation.
As a style decision, explicitly check for overflow rather
than using a temporary roll over variable (new_alloc).
Eric Blake [Fri, 10 Dec 2010 22:18:38 +0000 (15:18 -0700)]
pipe-posix: new module
* modules/pipe-posix: New file.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Set default.
(gl_UNISTD_H): Check for declaration.
* modules/unistd (Makefile.am): Substitute it.
* lib/unistd.in.h (pipe): Provide it for mingw.
* doc/posix-functions/pipe.texi (pipe): Update documentation.
* MODULES.html.sh (File descriptor based Input/Output): Likewise.
Paul Eggert [Thu, 2 Dec 2010 05:25:56 +0000 (21:25 -0800)]
utimecmp: fine-grained src to nearby coarse-grained dest
* lib/utimecmp.c (utimecmp): When UTIMECMP_TRUNCATE_SOURCE is set,
and the source is on a file system with higher-resolution time
stamps, than the destination, and _PC_TIMESTAMP_RESOLUTION does
not work, and the time stamps are close together, the algorithm to
determine the exact resolution from the read-back mtime was buggy:
it had a "!=" where it should have had an "==". This bug has been
in the code ever since it was introduced to gnulib.
Problem reported by Dan Jacobson in
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7529>.
Bruno Haible [Tue, 30 Nov 2010 20:27:21 +0000 (21:27 +0100)]
getdomainname: Use the system function when possible.
* lib/unistd.in.h: Include <netdb.h>, for getdomainname's declaration.
(getdomainname): Replace if needed. Provide the declaration if it is
missing. Don't use _GL_CXXALIAS_SYS_CAST.
* lib/getdomainname.c: Include <limits.h> and <sys/systeminfo.h>.
(getdomainname): When the system has getdomainname, call the system
function. When sysinfo (SI_SRPC_DOMAIN, ...) is possible, use that.
* m4/getdomainname.m4 (gl_FUNC_GETDOMAINNAME): Require
gl_HEADER_SYS_SOCKET and gl_HEADER_NETDB. Test whether the function is
found in libnsl. Look for the declaration also in <netdb.h>. Replace
the function if its second argument is of type 'int' or if it is found
in libnsl.
(gl_PREREQ_GETDOMAINNAME): Define HAVE_GETDOMAINNAME. Check for
<sys/systeminfo.h> and sysinfo().
* modules/getdomainname (Depends-on): Add netdb, sys_socket.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize
HAVE_DECL_GETDOMAINNAME and REPLACE_GETDOMAINNAME instead of
HAVE_GETDOMAINNAME.
* modules/unistd (Makefile.am): Substitute HAVE_DECL_GETDOMAINNAME and
REPLACE_GETDOMAINNAME instead of HAVE_GETDOMAINNAME.
* doc/glibc-functions/getdomainname.texi: Document the problems with
the getdomainname declaration.
Bruno Haible [Sat, 27 Nov 2010 03:08:53 +0000 (04:08 +0100)]
iconv-h: Fix test-iconv-h-c++ failure on Solaris 11 2010-11.
* lib/iconv.in.h (iconv_open, iconv, iconv_close): Define only if the
'iconv' module is present.
(ICONV_CONST): New macro.
* m4/iconv_h.m4 (gl_ICONV_H_DEFAULTS): Initialize GNULIB_ICONV and
ICONV_CONST.
* m4/iconv.m4 (AM_ICONV): If the gnulib module 'iconv-h' is present,
set ICONV_CONST.
* m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN_UTF): Don't set ICONV_CONST
here.
* modules/iconv (configure.ac): Invoke gl_ICONV_MODULE_INDICATOR.
* modules/iconv-h (Makefile.am): Substitute GNULIB_ICONV.
* tests/test-iconv-h.c (ICONV_CONST): Don't define here.
* tests/test-iconv-h-c++.cc (ICONV_CONST): Don't define here.
(iconv_open, iconv, iconv_close): Test only if the 'iconv' module is
present.
Paul Eggert [Wed, 24 Nov 2010 20:05:43 +0000 (12:05 -0800)]
stdint: port to GCC 4.3 + OSX + Octave
On this platform, stdint.h is buggy and defines int64_t to long
long int. The replacement defined it to long int, causing
problems with C++ style name mangling. Instead, trust the system
definition if INT64_MAX is defined, and likewise for the unsigned
variant. Problem reported by Jarno Rajahalme in
<http://lists.gnu.org/archive/html/bug-gnulib/2010-04/msg00143.html>.
* lib/stdint.in.h (GL_INT64_T): Define if INT64_MAX is defined,
and don't mess with int64_t and INT64_MAX in this case.
(GL_UINT64_T): Likewise for UINT64_MAX and uint64_t.
Ben Pfaff [Tue, 23 Nov 2010 04:50:41 +0000 (20:50 -0800)]
Uninstall ".bin" files installed by relocwrapper.
* modules/relocatable-prog-wrapper (uninstall-relocwrapper):
Recursively run "make uninstall" with ".bin" prefixed to EXEEXT,
unless it is already there.
Bruno Haible [Sun, 21 Nov 2010 20:31:19 +0000 (21:31 +0100)]
Update for NetBSD 5.0.
* m4/printf.m4 (gl_PRINTF_INFINITE_LONG_DOUBLE): Don't guess yes on
NetBSD; the test fails on NetBSD 5.0.
* doc/{glibc,posix,pastposix}-{headers,functions}/*.texi: Update info
about NetBSD.
Bruno Haible [Sun, 21 Nov 2010 17:42:29 +0000 (18:42 +0100)]
Update for MacOS X 10.5.
* m4/printf.m4 (gl_PRINTF_INFINITE_LONG_DOUBLE): Don't guess yes on
MacOS X; the test fails on MacOS X 10.5.8.
* doc/{glibc,posix,pastposix}-{headers,functions}/*.texi: Update info
about MacOS X.
Joel E. Denny [Sat, 20 Nov 2010 14:37:45 +0000 (09:37 -0500)]
bootstrap: add bootstrap_sync option.
See discussion at
<http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00369.html>,
<http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00200.html>.
* build-aux/bootstrap: Accept --bootstrap-sync to update
bootstrap if it is not identical to the local gnulib's
bootstrap. Accept bootstrap_sync=true in bootstrap.conf to
enable this by default. Accept --no-bootstrap-sync to disable
it.
Paul Eggert [Fri, 19 Nov 2010 22:36:12 +0000 (14:36 -0800)]
ftoastr: don't assume snprintf
* lib/ftoastr.c (snprintf) [! GNULIB_SNPRINTF_POSIX]:
Implement a subset of snprintf here, by using sprintf safely.
* modules/ftoastr (Depends-on): Remove snprintf.
Paul Eggert [Fri, 19 Nov 2010 05:30:29 +0000 (21:30 -0800)]
ftoastr: depend on snprintf, improve comments
* lib/ftoastr.c: Also mention Loitsch's draft.
* lib/ftoastr.h: Require WIDTH to be nonnegative. This isn't
needed in the current implementation, but it might simplify
speeding up the code later.
* modules/ftoastr: Depend on snprintf; this improves portability.
Suggested by Bruno Haible in the same email.
Paul Eggert [Fri, 19 Nov 2010 01:31:52 +0000 (17:31 -0800)]
ftoastr: port to hosts lacking strtof and strtold
Problem reported by Bruno Haible in
<http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00242.html>.
* lib/ftoastr.c (STRTOF): Define to strtod if in a pre-C99
environment and strtold (and presumably strtof) are not available.
* modules/ftoastr (Files): Add m4/c-strtod.m4.
(configure.ac): Require gl_C99_STRTOLD.
Bruno Haible [Fri, 19 Nov 2010 00:57:49 +0000 (01:57 +0100)]
c-strtold: Avoid link error on AIX 7.
* lib/c-strtod.c: Test also HAVE_STRTOD_L or HAVE_STRTOLD_L.
* m4/c-strtod.m4 (gl_C_STRTOD): Test whether strtod_l exists.
(gl_C_STRTOLD): Test whether strtold_l exists.
Reported by Albert Chin <bug-gnulib@mlists.thewrittenword.com>.
Paul Eggert [Thu, 18 Nov 2010 00:29:40 +0000 (16:29 -0800)]
intprops: new macro INT_BITS_STRLEN_BOUND
* lib/intprops.h (INT_BITS_STRLEN_BOUND): New macro, needed by
ftoastr.h. This exposes an internal of intprops.h that was formerly
not exposed. Also, it uses a slightly tighter bound than before;
though this makes no practical difference, we might as well be as
tight as we easily can.