diff --git a/ChangeLog b/ChangeLog index fd7b4771dd20030cc41f75b99903ab5853646b66..ed20bb02e4d00142ad52a7304c69ef28603edbe7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,35 @@ Wed Aug 7 13:30:44 CEST 2008 Jim Meyering + update from gnulib: portability and bug fixes + * build-aux/mktempd: + * build-aux/useless-if-before-free: + * build-aux/vc-list-files: + * gnulib/lib/.cvsignore: + * gnulib/lib/Makefile.am: + * gnulib/lib/poll.c: + * gnulib/lib/stdbool.in.h: + * gnulib/lib/stdio-impl.h: + * gnulib/lib/stdio.in.h (vasprintf, obstack_printf) + (obstack_vprintf): + * gnulib/lib/vasnprintf.c (_GNU_SOURCE, sprintf, IF_LINT, exp) + (remainder, scale10_round_decimal_long_double) + (scale10_round_decimal_double, pad_ourselves): + * gnulib/m4/gnulib-cache.m4: + * gnulib/m4/gnulib-common.m4 (gl_MODULE_INDICATOR): + * gnulib/m4/gnulib-tool.m4 (gl_LOCAL_DIR, gl_M4_BASE, gl_PO_BASE) + (gl_DOC_BASE, gl_TESTS_BASE, gl_WITH_TESTS, gl_LIB, gl_LGPL) + (gl_MAKEFILE_NAME, gl_MACRO_PREFIX, gl_PO_DOMAIN, gl_VC_FILES): + * gnulib/m4/lock.m4 (gl_LOCK_EARLY_BODY, gl_PREREQ_LOCK) + (gl_DISABLE_THREADS): + * gnulib/m4/onceonly.m4: + * gnulib/m4/posix-shell.m4 (gl_POSIX_SHELL): + * gnulib/m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): + * gnulib/tests/test-getaddrinfo.c (ENABLE_DEBUGGING, dbgprintf) + (simple): + * gnulib/tests/test-stdint.c (UINTMAX_MAX, or): + * gnulib/tests/test-vc-list-files-cvs.sh: + * gnulib/tests/test-vc-list-files-git.sh: + complete the MinGW inet_pton portability fix * gnulib/m4/inet_pton.m4: New file. Required for MinGW. * gnulib/m4/gnulib-comp.m4: Regenerate via gnulib-tool. diff --git a/build-aux/mktempd b/build-aux/mktempd index 7ac914b31c992fa81532d06150cc509d26cca05e..2bb424f69efd583369ad674ce89b3944f8c19953 100755 --- a/build-aux/mktempd +++ b/build-aux/mktempd @@ -44,7 +44,7 @@ rand_bytes() dev_rand=/dev/urandom if test -r "$dev_rand"; then # Note: 256-length($chars) == 194; 3 copies of $chars is 186 + 8 = 194. - head -c$n "$dev_rand" | tr -c $chars 01234567$chars$chars$chars + dd ibs=$n count=1 if="$dev_rand" | tr -c $chars 01234567$chars$chars$chars return fi @@ -114,7 +114,9 @@ mktempd() base_template=`echo "$template"|sed 's/XX*$//'` # Calculate how many X's we've just removed. - nx=`expr length "$template" - length "$base_template"` + template_length=`echo "$template" | wc -c` + nx=`echo "$base_template" | wc -c` + nx=`expr $template_length - $nx` err= i=1 diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free index 48f55c661a84cf5fcde88e044f758af03350e7b0..0bae2c4d05ae683239f699b902a4425fdafb5032 100755 --- a/build-aux/useless-if-before-free +++ b/build-aux/useless-if-before-free @@ -2,7 +2,7 @@ # Detect instances of "if (p) free (p);". # Likewise for "if (p != NULL) free (p);". And with braces. -my $VERSION = '2008-05-01 19:11'; # UTC +my $VERSION = '2008-05-25 17:36'; # 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 @@ -122,14 +122,22 @@ EOF while (defined (my $line = )) { while ($line =~ - /\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\) - (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*\2\s*\)| - \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*\2\s*\)\s*;\s*\}))/sxg) + /\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*NULL)?\s*\) + (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)| + \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg) { - $found_match = 1; - $list - and (print "$file\0"), next FILE; - print "$file: $1\n"; + # Compare "if" expression and free'd expression, + # without regard to white space. + (my $e1 = $2) =~ tr/ \t//d; + my $e2 = defined $3 ? $3 : $4; + $e2 =~ tr/ \t//d; + if ($e1 eq $e2) + { + $found_match = 1; + $list + and (print "$file\0"), next FILE; + print "$file: $1\n"; + } } } } @@ -149,12 +157,12 @@ my $foo = <<'EOF'; # This adjusts them, removing the unnecessary "if (p)" part. # FIXME: do something like this as an option (doesn't do braces): -git ls-files -z |xargs -0 \ -perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(k?free\s*\(\s*\1\s*\))/$2/s' - useless-if-before-free -l $(lid -knone free) | xargs -0 \ perl -0x3b -pi -e \ - 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(free\s*\(\s*\1\s*\))/$2/s' + 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(free\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s' + +# Or, with git: +git ls-files -z |xargs -0 perl -0x3b -pi -e '...' Be careful that the result of the above transformation is valid. If the matched string is followed by "else", then obviously, it won't be. diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files index 8ca4530f7ab268711784c4c7eee144e5fce70542..419ab2acab5983e15d1a2592e5c19e65c300070e 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=2008-05-01.10 +scriptversion=2008-07-11.19 # Copyright (C) 2006-2008 Free Software Foundation, Inc. @@ -88,7 +88,8 @@ elif test -d CVS; then eval awk -F/ \''{ \ if (!$1 && $3 !~ /^-/) { \ f=FILENAME; \ - sub(/CVS\/Entries/, "", f); \ + if (f ~ /CVS\/Entries$/) \ + f = substr(f, 0, length(f)-11); \ print f $2; \ }}'\'' \ `find "$dir" -name Entries -print` /dev/null' $postprocess diff --git a/gnulib/lib/.cvsignore b/gnulib/lib/.cvsignore index 554c9fd0e29c9046adedd3e5d365d3c9fd29aa50..2849ca97d0212fc31b009aefe282269b51205e02 100644 --- a/gnulib/lib/.cvsignore +++ b/gnulib/lib/.cvsignore @@ -1,18 +1,18 @@ -alloca.h -arpa_inet.h -.deps -float.h *.la -.libs *.lo +.deps +.libs Makefile Makefile.in +alloca.h +arpa_inet.h +float.h netinet_in.h poll.h stdbool.h stdint.h -stdio.h stdio-impl.h +stdio.h stdlib.h string.h sys_select.h diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am index 8706bcb87aaa06f6ddd696f1f51802a9a687a7ad..576b95123117ed9ca9e52e4b6c1e71bad35e15b1 100644 --- a/gnulib/lib/Makefile.am +++ b/gnulib/lib/Makefile.am @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl c-ctype getaddrinfo getpass gettext mktempd physmem poll posix-shell strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files verify +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl c-ctype getaddrinfo getpass gettext inet_pton mktempd physmem poll posix-shell strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files verify AUTOMAKE_OPTIONS = 1.5 gnits @@ -188,6 +188,15 @@ EXTRA_libgnu_la_SOURCES += inet_ntop.c ## end gnulib module inet_ntop +## begin gnulib module inet_pton + + +EXTRA_DIST += inet_pton.c + +EXTRA_libgnu_la_SOURCES += inet_pton.c + +## end gnulib module inet_pton + ## begin gnulib module link-warning LINK_WARNING_H=$(top_srcdir)/build-aux/link-warning.h @@ -382,6 +391,8 @@ stdio.h: stdio.in.h -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ + -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ + -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ @@ -420,6 +431,8 @@ stdio.h: stdio.in.h -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ + -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ + -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/stdio.in.h; \ } > $@-t diff --git a/gnulib/lib/poll.c b/gnulib/lib/poll.c index b92c0f3f5c560f7bf841fbf313632a1964fad929..b84cad3d0e1d70bc772b547606113c21de77f810 100644 --- a/gnulib/lib/poll.c +++ b/gnulib/lib/poll.c @@ -55,19 +55,25 @@ poll (pfd, nfd, timeout) int timeout; { fd_set rfds, wfds, efds; - struct timeval tv, *ptv; + struct timeval tv; + struct timeval *ptv; int maxfd, rc; nfds_t i; #ifdef _SC_OPEN_MAX - if (nfd > sysconf (_SC_OPEN_MAX)) + static int sc_open_max = -1; + + if (nfd < 0 + || (nfd > sc_open_max + && (sc_open_max != -1 + || nfd > (sc_open_max = sysconf (_SC_OPEN_MAX))))) { errno = EINVAL; return -1; } #else /* !_SC_OPEN_MAX */ #ifdef OPEN_MAX - if (nfd > OPEN_MAX) + if (nfd < 0 || nfd > OPEN_MAX) { errno = EINVAL; return -1; @@ -84,10 +90,15 @@ poll (pfd, nfd, timeout) } /* convert timeout number into a timeval structure */ - ptv = &tv; - if (timeout >= 0) + if (timeout == 0) + { + ptv = &tv; + ptv->tv_sec = 0; + ptv->tv_usec = 0; + } + else if (timeout > 0) { - /* return immediately or after timeout */ + ptv = &tv; ptv->tv_sec = timeout / 1000; ptv->tv_usec = (timeout % 1000) * 1000; } @@ -155,6 +166,7 @@ poll (pfd, nfd, timeout) if (FD_ISSET (pfd[i].fd, &rfds)) { int r; + int socket_errno; #if defined __MACH__ && defined __APPLE__ /* There is a bug in Mac OS X that causes it to ignore MSG_PEEK @@ -162,23 +174,25 @@ poll (pfd, nfd, timeout) connected socket, a server socket, or something else using a 0-byte recv, and use ioctl(2) to detect POLLHUP. */ r = recv (pfd[i].fd, NULL, 0, MSG_PEEK); - if (r == 0 || errno == ENOTSOCK) + socket_errno = (r < 0) ? errno : 0; + if (r == 0 || socket_errno == ENOTSOCK) ioctl(pfd[i].fd, FIONREAD, &r); #else char data[64]; r = recv (pfd[i].fd, data, sizeof (data), MSG_PEEK); + socket_errno = (r < 0) ? errno : 0; #endif if (r == 0) happened |= POLLHUP; /* If the event happened on an unconnected server socket, that's fine. */ - else if (r > 0 || ( /* (r == -1) && */ errno == ENOTCONN)) + else if (r > 0 || ( /* (r == -1) && */ socket_errno == ENOTCONN)) happened |= (POLLIN | POLLRDNORM) & sought; /* Distinguish hung-up sockets from other errors. */ - else if (errno == ESHUTDOWN || errno == ECONNRESET - || errno == ECONNABORTED || errno == ENETRESET) + else if (socket_errno == ESHUTDOWN || socket_errno == ECONNRESET + || socket_errno == ECONNABORTED || socket_errno == ENETRESET) happened |= POLLHUP; else diff --git a/gnulib/lib/stdbool.in.h b/gnulib/lib/stdbool.in.h index 4e043a0b0bd51c8b28d8689012ba4f4c2cd613d1..45375b367ed96944c55560c4d3da1bdbdf04a5d1 100644 --- a/gnulib/lib/stdbool.in.h +++ b/gnulib/lib/stdbool.in.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify @@ -58,7 +58,7 @@ /* BeOS already #defines false 0, true 1. We use the same definitions below, but temporarily we have to #undef them. */ -#ifdef __BEOS__ +#if defined __BEOS__ && !defined __HAIKU__ # include /* defines bool but not _Bool */ # undef false # undef true @@ -73,7 +73,7 @@ (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the enum; this ensures that '_Bool' promotes to 'int'. */ -#if defined __cplusplus || defined __BEOS__ +#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) /* A compiler known to have 'bool'. */ /* If the compiler already has both 'bool' and '_Bool', we can assume they are the same types. */ diff --git a/gnulib/lib/stdio-impl.h b/gnulib/lib/stdio-impl.h index 199d62ebeb0b7e353f397f3e81a17bddc6692236..e52a7d8840d34dbbaf6c518ecd6bcd000fdf3d29 100644 --- a/gnulib/lib/stdio-impl.h +++ b/gnulib/lib/stdio-impl.h @@ -35,7 +35,7 @@ struct { unsigned char *_base; int _size; } _ub; \ int _ur; \ unsigned char _ubuf[3]; \ - unsigned cahr _nbuf[1]; \ + unsigned char _nbuf[1]; \ struct { unsigned char *_base; int _size; } _lb; \ int _blksize; \ fpos_t _offset; \ @@ -60,7 +60,7 @@ }; # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub # else /* FreeBSD, DragonFly, MacOS X, Cygwin */ -# define fp_ub fp->_ub +# define fp_ub fp_->_ub # endif # define HASUB(fp) (fp_ub._base != NULL) diff --git a/gnulib/lib/stdio.in.h b/gnulib/lib/stdio.in.h index d5962aa4fc02a70df351ad8bfaf73f81faa13dfe..ea4df7c6517c321f39d86b57e486b55b97f4634e 100644 --- a/gnulib/lib/stdio.in.h +++ b/gnulib/lib/stdio.in.h @@ -212,6 +212,26 @@ extern int vsprintf (char *str, const char *format, va_list args) # endif #endif +#if @GNULIB_OBSTACK_PRINTF@ +# if @REPLACE_OBSTACK_PRINTF@ +# define obstack_printf rpl_osbtack_printf +# define obstack_vprintf rpl_obstack_vprintf +# endif +# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@ + struct obstack; + /* Grow an obstack with formatted output. Return the number of + bytes added to OBS. No trailing nul byte is added, and the + object should be closed with obstack_finish before use. Upon + memory allocation error, call obstack_alloc_failed_handler. Upon + other error, return -1. */ + extern int obstack_printf (struct obstack *obs, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + extern int obstack_vprintf (struct obstack *obs, const char *format, + va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#endif + #if @GNULIB_FOPEN@ # if @REPLACE_FOPEN@ # define fopen rpl_fopen diff --git a/gnulib/lib/vasnprintf.c b/gnulib/lib/vasnprintf.c index 4583f7d865337da3c24ceedc4f3481796149221d..495f9ad82ea2d28889a05fd2f0c90fb1c678a427 100644 --- a/gnulib/lib/vasnprintf.c +++ b/gnulib/lib/vasnprintf.c @@ -95,7 +95,7 @@ #if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL # include -# include "isnand.h" +# include "isnand-nolibm.h" #endif #if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL @@ -106,7 +106,7 @@ #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL # include -# include "isnand.h" +# include "isnand-nolibm.h" # include "printf-frexp.h" #endif @@ -200,6 +200,21 @@ local_wcslen (const wchar_t *s) /* Here we need to call the native sprintf, not rpl_sprintf. */ #undef sprintf +/* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized" + warnings in this file. Use -Dlint to suppress them. */ +#ifdef lint +# define IF_LINT(Code) Code +#else +# define IF_LINT(Code) /* empty */ +#endif + +/* Avoid some warnings from "gcc -Wshadow". + This file doesn't use the exp() and remainder() functions. */ +#undef exp +#define exp expo +#undef remainder +#define remainder rem + #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL /* Determine the decimal-point character according to the current locale. */ # ifndef decimal_point_char_defined @@ -1198,7 +1213,7 @@ scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n) static char * scale10_round_decimal_long_double (long double x, int n) { - int e; + int e IF_LINT(= 0); mpn_t m; void *memory = decode_long_double (x, &e, &m); return scale10_round_decimal_decoded (e, m, memory, n); @@ -1216,7 +1231,7 @@ scale10_round_decimal_long_double (long double x, int n) static char * scale10_round_decimal_double (double x, int n) { - int e; + int e IF_LINT(= 0); mpn_t m; void *memory = decode_double (x, &e, &m); return scale10_round_decimal_decoded (e, m, memory, n); @@ -3693,7 +3708,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #endif TCHAR_T *fbp; unsigned int prefix_count; - int prefixes[2]; + int prefixes[2] IF_LINT (= { 0 }); #if !USE_SNPRINTF size_t tmp_length; TCHAR_T tmpbuf[700]; diff --git a/gnulib/m4/gnulib-cache.m4 b/gnulib/m4/gnulib-cache.m4 index 04b349891206b44e898b54d31091bb190c1055b7..d26e7f05d5637632987c71a5cdee7fc3878c26ee 100644 --- a/gnulib/m4/gnulib-cache.m4 +++ b/gnulib/m4/gnulib-cache.m4 @@ -15,11 +15,28 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl c-ctype getaddrinfo getpass gettext mktempd physmem poll posix-shell strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files verify +# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib/lib --m4-base=gnulib/m4 --doc-base=doc --aux-dir=build-aux --with-tests --lgpl=2 --libtool --macro-prefix=gl c-ctype getaddrinfo getpass gettext inet_pton mktempd physmem poll posix-shell strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files verify # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) -gl_MODULES([c-ctype getaddrinfo getpass gettext mktempd physmem poll posix-shell strndup strsep sys_stat useless-if-before-free vasprintf vc-list-files verify]) +gl_MODULES([ + c-ctype + getaddrinfo + getpass + gettext + inet_pton + mktempd + physmem + poll + posix-shell + strndup + strsep + sys_stat + useless-if-before-free + vasprintf + vc-list-files + verify +]) gl_AVOID([]) gl_SOURCE_BASE([gnulib/lib]) gl_M4_BASE([gnulib/m4]) diff --git a/gnulib/m4/gnulib-common.m4 b/gnulib/m4/gnulib-common.m4 index 3edfc120f81f9a135aeab6c15994b2327f414f1c..34d91c728f0765ebfd801df3973604d15814c9d9 100644 --- a/gnulib/m4/gnulib-common.m4 +++ b/gnulib/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 4 +# gnulib-common.m4 serial 5 dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -31,6 +31,13 @@ AC_DEFUN([gl_MODULE_INDICATOR], [Define to 1 when using the gnulib module ]$1[.]) ]) +# m4_foreach_w +# is a backport of autoconf-2.59c's m4_foreach_w. +# Remove this macro when we can assume autoconf >= 2.60. +m4_ifndef([m4_foreach_w], + [m4_define([m4_foreach_w], + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) + # AC_PROG_MKDIR_P # is a backport of autoconf-2.60's AC_PROG_MKDIR_P. # Remove this macro when we can assume autoconf >= 2.60. diff --git a/gnulib/m4/gnulib-tool.m4 b/gnulib/m4/gnulib-tool.m4 index ef59320316b9796903a2c4a46ed7b810508dc8c7..4438d488698b2e25a911a6741d8903cb9fd35ebf 100644 --- a/gnulib/m4/gnulib-tool.m4 +++ b/gnulib/m4/gnulib-tool.m4 @@ -1,4 +1,4 @@ -# gnulib-tool.m4 serial 1 +# gnulib-tool.m4 serial 2 dnl Copyright (C) 2004-2005 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,6 +8,9 @@ dnl The following macros need not be invoked explicitly. dnl Invoking them does nothing except to declare default arguments dnl for "gnulib-tool --import". +dnl Usage: gl_LOCAL_DIR([DIR]) +AC_DEFUN([gl_LOCAL_DIR], []) + dnl Usage: gl_MODULES([module1 module2 ...]) AC_DEFUN([gl_MODULES], []) @@ -20,14 +23,35 @@ AC_DEFUN([gl_SOURCE_BASE], []) dnl Usage: gl_M4_BASE([DIR]) AC_DEFUN([gl_M4_BASE], []) +dnl Usage: gl_PO_BASE([DIR]) +AC_DEFUN([gl_PO_BASE], []) + +dnl Usage: gl_DOC_BASE([DIR]) +AC_DEFUN([gl_DOC_BASE], []) + +dnl Usage: gl_TESTS_BASE([DIR]) +AC_DEFUN([gl_TESTS_BASE], []) + +dnl Usage: gl_WITH_TESTS +AC_DEFUN([gl_WITH_TESTS], []) + dnl Usage: gl_LIB([LIBNAME]) AC_DEFUN([gl_LIB], []) -dnl Usage: gl_LGPL +dnl Usage: gl_LGPL or gl_LGPL([VERSION]) AC_DEFUN([gl_LGPL], []) +dnl Usage: gl_MAKEFILE_NAME([FILENAME]) +AC_DEFUN([gl_MAKEFILE_NAME], []) + dnl Usage: gl_LIBTOOL AC_DEFUN([gl_LIBTOOL], []) dnl Usage: gl_MACRO_PREFIX([PREFIX]) AC_DEFUN([gl_MACRO_PREFIX], []) + +dnl Usage: gl_PO_DOMAIN([DOMAIN]) +AC_DEFUN([gl_PO_DOMAIN], []) + +dnl Usage: gl_VC_FILES([BOOLEAN]) +AC_DEFUN([gl_VC_FILES], []) diff --git a/gnulib/m4/lock.m4 b/gnulib/m4/lock.m4 index 91119335356e33ab293f852fa730ec925a30f258..d59028953e322e9e9dff1a83afaad51bf71b1fa1 100644 --- a/gnulib/m4/lock.m4 +++ b/gnulib/m4/lock.m4 @@ -1,11 +1,13 @@ -# lock.m4 serial 7 (gettext-0.17) -dnl Copyright (C) 2005-2007 Free Software Foundation, Inc. +# lock.m4 serial 8 (gettext-0.18) +dnl Copyright (C) 2005-2008 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 Bruno Haible. +dnl gl_LOCK +dnl ------- dnl Tests for a multithreading library to be used. dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, dnl USE_PTH_THREADS, USE_WIN32_THREADS @@ -42,17 +44,22 @@ AC_DEFUN([gl_LOCK_EARLY_BODY], [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. + m4_divert_text([DEFAULTS], [gl_use_threads_default=]) AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) AC_HELP_STRING([--disable-threads], [build without multithread safety]), [gl_use_threads=$enableval], - [case "$host_os" in - dnl Disable multithreading by default on OSF/1, because it interferes - dnl with fork()/exec(): When msgexec is linked with -lpthread, its child - dnl process gets an endless segmentation fault inside execvp(). - osf*) gl_use_threads=no ;; - *) gl_use_threads=yes ;; - esac + [if test -n "$gl_use_threads_default"; then + gl_use_threads="$gl_use_threads_default" + else + case "$host_os" in + dnl Disable multithreading by default on OSF/1, because it interferes + dnl with fork()/exec(): When msgexec is linked with -lpthread, its + dnl child process gets an endless segmentation fault inside execvp(). + osf*) gl_use_threads=no ;; + *) gl_use_threads=yes ;; + esac + fi ]) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then # For using : @@ -262,6 +269,18 @@ AC_DEFUN([gl_PREREQ_LOCK], [ AC_REQUIRE([AC_C_INLINE]) ]) + +dnl gl_DISABLE_THREADS +dnl ------------------ +dnl Sets the gl_LOCK default so that threads are not used by default. +dnl The user can still override it at installation time, by using the +dnl configure option '--enable-threads'. + +AC_DEFUN([gl_DISABLE_THREADS], [ + m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) +]) + + dnl Survey of platforms: dnl dnl Platform Available Compiler Supports test-lock diff --git a/gnulib/m4/onceonly.m4 b/gnulib/m4/onceonly.m4 index 2bf1590d59c99d962c65c1d4f5dbff21fda3abdc..108cd6c1a5fceaaccfdec6681e24a13285fc5881 100644 --- a/gnulib/m4/onceonly.m4 +++ b/gnulib/m4/onceonly.m4 @@ -1,4 +1,4 @@ -# onceonly.m4 serial 5 +# onceonly.m4 serial 6 dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc. dnl This file is free software, distributed under the terms of the GNU dnl General Public License. As a special exception to the GNU General @@ -21,13 +21,16 @@ dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to dnl empty, and the check will be inserted before the body of the AC_DEFUNed dnl function. -dnl This is like onceonly.m4, except that it uses diversions to named sections -dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once, -dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The -dnl size reduction is ca. 9%. +dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE +dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to +dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested +dnl headers at once, thus reducing the size of 'configure'. It is known to work +dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%. dnl Autoconf version 2.59 plus gnulib is required; this file is not needed -dnl with Autoconf 2.60 or greater. +dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of +dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first +dnl argument! AC_PREREQ([2.59]) # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of diff --git a/gnulib/m4/posix-shell.m4 b/gnulib/m4/posix-shell.m4 index ac526d5c3788a606351beb57d597e69f7b20a9aa..7f3b1e944f4ca6f98119f35073d0eb4d2b06b5ed 100644 --- a/gnulib/m4/posix-shell.m4 +++ b/gnulib/m4/posix-shell.m4 @@ -1,6 +1,6 @@ # Find a POSIX-conforming shell. -# Copyright (C) 2007 Free Software Foundation, Inc. +# Copyright (C) 2007-2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,7 @@ AC_DEFUN([gl_POSIX_SHELL], [ AC_CACHE_CHECK([for a shell that conforms to POSIX], [gl_cv_posix_shell], - [gl_test_POSIX_SHELL=' + [gl_test_posix_shell_script=' func_return () { (exit [$]1) } @@ -42,7 +42,8 @@ AC_DEFUN([gl_POSIX_SHELL], "$CONFIG_SHELL" "$SHELL" /bin/sh /bin/bash /bin/ksh /bin/sh5 no; do case $gl_cv_posix_shell in /*) - "$gl_cv_posix_shell" -c "$gl_test_POSIX_shell" 2>/dev/null && break;; + "$gl_cv_posix_shell" -c "$gl_test_posix_shell_script" 2>/dev/null \ + && break;; esac done]) diff --git a/gnulib/m4/stdio_h.m4 b/gnulib/m4/stdio_h.m4 index fa262e359c304269ca78c289559f3e07aa5dca5c..4980f9e0dcbd6d14686c9dde8ed31c0be3600b6a 100644 --- a/gnulib/m4/stdio_h.m4 +++ b/gnulib/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 10 +# stdio_h.m4 serial 11 dnl Copyright (C) 2007-2008 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,6 +21,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], [ GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) + GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) + GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) @@ -62,6 +64,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) + HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) + REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) ]) dnl Code shared by fseeko and ftello. Determine if large files are supported, diff --git a/gnulib/tests/test-getaddrinfo.c b/gnulib/tests/test-getaddrinfo.c index 530f8dc3103ea9bff0418b39a5f343a9595d69e2..bfdb9cf0e85cd1af517e6bb6613f322e9c4170b8 100644 --- a/gnulib/tests/test-getaddrinfo.c +++ b/gnulib/tests/test-getaddrinfo.c @@ -24,6 +24,15 @@ #include #include +/* Whether to print debugging messages. */ +#define ENABLE_DEBUGGING 0 + +#if ENABLE_DEBUGGING +# define dbgprintf printf +#else +# define dbgprintf if (0) printf +#endif + /* BeOS does not have AF_UNSPEC. */ #ifndef AF_UNSPEC # define AF_UNSPEC 0 @@ -40,7 +49,7 @@ int simple (char *host, char *service) struct addrinfo *ai0, *ai; int res; - printf ("Finding %s service %s...\n", host, service); + dbgprintf ("Finding %s service %s...\n", host, service); /* This initializes "hints" but does not use it. Is there a reason for this? If so, please fix this comment. */ @@ -51,7 +60,7 @@ int simple (char *host, char *service) res = getaddrinfo (host, service, 0, &ai0); - printf ("res %d: %s\n", res, gai_strerror (res)); + dbgprintf ("res %d: %s\n", res, gai_strerror (res)); if (res != 0) { @@ -73,18 +82,18 @@ int simple (char *host, char *service) for (ai = ai0; ai; ai = ai->ai_next) { - printf ("\tflags %x\n", ai->ai_flags); - printf ("\tfamily %x\n", ai->ai_family); - printf ("\tsocktype %x\n", ai->ai_socktype); - printf ("\tprotocol %x\n", ai->ai_protocol); - printf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen); - printf ("\tFound %s\n", - inet_ntop (ai->ai_family, - &((struct sockaddr_in *) - ai->ai_addr)->sin_addr, - buf, sizeof (buf) - 1)); + dbgprintf ("\tflags %x\n", ai->ai_flags); + dbgprintf ("\tfamily %x\n", ai->ai_family); + dbgprintf ("\tsocktype %x\n", ai->ai_socktype); + dbgprintf ("\tprotocol %x\n", ai->ai_protocol); + dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen); + dbgprintf ("\tFound %s\n", + inet_ntop (ai->ai_family, + &((struct sockaddr_in *) + ai->ai_addr)->sin_addr, + buf, sizeof (buf) - 1)); if (ai->ai_canonname) - printf ("\tFound %s...\n", ai->ai_canonname); + dbgprintf ("\tFound %s...\n", ai->ai_canonname); { char ipbuf[BUFSIZ]; @@ -94,11 +103,11 @@ int simple (char *host, char *service) ipbuf, sizeof (ipbuf) - 1, portbuf, sizeof (portbuf) - 1, NI_NUMERICHOST|NI_NUMERICSERV); - printf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res)); + dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res)); if (res == 0) { - printf ("\t\tip %s\n", ipbuf); - printf ("\t\tport %s\n", portbuf); + dbgprintf ("\t\tip %s\n", ipbuf); + dbgprintf ("\t\tport %s\n", portbuf); } } diff --git a/gnulib/tests/test-stdint.c b/gnulib/tests/test-stdint.c index 9e1d57e530eedb71980fb79714e68cb67fa3550d..a2bf42ac899451eabcbe4dcf041c726951841a7d 100644 --- a/gnulib/tests/test-stdint.c +++ b/gnulib/tests/test-stdint.c @@ -1,5 +1,5 @@ /* Test of substitute. - Copyright (C) 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2006-2008 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 @@ -246,11 +246,15 @@ uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX }; verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0); +/* As of 2007, Sun C and HP-UX 10.20 cc don't support 'long long' constants in + the preprocessor. */ +#if !(defined __SUNPRO_C || (defined __hpux && !defined __GNUC__)) #if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX /* ok */ #else err or; #endif +#endif /* 7.18.3. Limits of other integer types */ diff --git a/gnulib/tests/test-vc-list-files-cvs.sh b/gnulib/tests/test-vc-list-files-cvs.sh index febd13b43f02d3acf1be549b03cfce332e5ea4f8..c87267cde358c1a7e85e65a464e91176e35486c5 100755 --- a/gnulib/tests/test-vc-list-files-cvs.sh +++ b/gnulib/tests/test-vc-list-files-cvs.sh @@ -44,7 +44,8 @@ for i in with-cvsu without; do ok=0 mkdir $tmpdir && cd $tmpdir && # without cvs, skip the test - { cvs -Q -d "$repo" init || exit 77; } && + # The double use of 'exit' is needed for the reference to $? inside the trap. + { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 || { (exit 77); exit 77; }; } && mkdir w && cd w && mkdir d && touch d/a b c && diff --git a/gnulib/tests/test-vc-list-files-git.sh b/gnulib/tests/test-vc-list-files-git.sh index 5b8d94fb78656089986bcf45e0efca8c2e44da05..ac50971db19580768a2241db33e73b18b820b718 100755 --- a/gnulib/tests/test-vc-list-files-git.sh +++ b/gnulib/tests/test-vc-list-files-git.sh @@ -31,7 +31,8 @@ trap '(exit $?); exit $?' 1 2 13 15 fail=1 mkdir $tmpdir && cd $tmpdir && # without git, skip the test - { git init -q || exit 77; } && + # The double use of 'exit' is needed for the reference to $? inside the trap. + { ( git init -q ) > /dev/null 2>&1 || { (exit 77); exit 77; }; } && mkdir d && touch d/a b c && git add . > /dev/null &&