diff options
author | Simon Josefsson <simon@josefsson.org> | 2007-10-22 08:35:09 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2007-10-22 08:35:09 +0200 |
commit | 4d59ff82f4a40333df0562de340ec2b995b1f31c (patch) | |
tree | 3dc271245c107926fd907b96fe9cea640876d1c8 | |
parent | ead3e58c4189b6c407ab723aa8208df766edcf7a (diff) | |
download | gnutls-4d59ff82f4a40333df0562de340ec2b995b1f31c.tar.gz |
Update gnulib files.
-rwxr-xr-x | build-aux/config.rpath | 102 | ||||
-rw-r--r-- | build-aux/maint.mk | 2 | ||||
-rw-r--r-- | gl/error.c | 11 | ||||
-rw-r--r-- | gl/error.h | 11 | ||||
-rw-r--r-- | gl/fseeko.c | 4 | ||||
-rw-r--r-- | gl/gnulib.mk | 22 | ||||
-rw-r--r-- | gl/inet_pton.c | 9 | ||||
-rw-r--r-- | gl/inet_pton.h | 9 | ||||
-rw-r--r-- | gl/intprops.h | 77 | ||||
-rw-r--r-- | gl/m4/extensions.m4 | 82 | ||||
-rw-r--r-- | gl/m4/getaddrinfo.m4 | 33 | ||||
-rw-r--r-- | gl/m4/getdelim.m4 | 4 | ||||
-rw-r--r-- | gl/m4/getline.m4 | 4 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 38 | ||||
-rw-r--r-- | gl/m4/socklen.m4 | 4 | ||||
-rw-r--r-- | gl/m4/strerror.m4 | 46 | ||||
-rw-r--r-- | gl/netinet_in.in.h (renamed from gl/netinet_in_.h) | 0 | ||||
-rw-r--r-- | gl/progname.c | 9 | ||||
-rw-r--r-- | gl/progname.h | 9 | ||||
-rw-r--r-- | gl/readline.c | 9 | ||||
-rw-r--r-- | gl/readline.h | 9 | ||||
-rw-r--r-- | gl/strerror.c | 49 | ||||
-rw-r--r-- | gl/version-etc-fsf.c | 9 | ||||
-rw-r--r-- | gl/version-etc.c | 9 | ||||
-rw-r--r-- | gl/version-etc.h | 9 | ||||
-rw-r--r-- | lgl/Makefile.am | 79 | ||||
-rw-r--r-- | lgl/alloca.in.h (renamed from lgl/alloca_.h) | 0 | ||||
-rw-r--r-- | lgl/dummy.c | 10 | ||||
-rw-r--r-- | lgl/float.in.h (renamed from lgl/float_.h) | 9 | ||||
-rw-r--r-- | lgl/gc-gnulib.c | 2 | ||||
-rw-r--r-- | lgl/gc-libgcrypt.c | 10 | ||||
-rw-r--r-- | lgl/gc.h | 4 | ||||
-rw-r--r-- | lgl/m4/extensions.m4 | 52 | ||||
-rw-r--r-- | lgl/m4/gnulib-comp.m4 | 53 | ||||
-rw-r--r-- | lgl/m4/lock.m4 | 11 | ||||
-rw-r--r-- | lgl/m4/longlong.m4 | 13 | ||||
-rw-r--r-- | lgl/m4/memmem.m4 | 4 | ||||
-rw-r--r-- | lgl/m4/socklen.m4 | 4 | ||||
-rw-r--r-- | lgl/m4/stdint.m4 | 4 | ||||
-rw-r--r-- | lgl/m4/stdio_h.m4 | 6 | ||||
-rw-r--r-- | lgl/m4/string_h.m4 | 3 | ||||
-rw-r--r-- | lgl/m4/strverscmp.m4 | 6 | ||||
-rw-r--r-- | lgl/m4/ulonglong.m4 | 13 | ||||
-rw-r--r-- | lgl/m4/vasprintf.m4 | 4 | ||||
-rw-r--r-- | lgl/printf-parse.c | 2 | ||||
-rw-r--r-- | lgl/realloc.c | 9 | ||||
-rw-r--r-- | lgl/stdbool.in.h (renamed from lgl/stdbool_.h) | 0 | ||||
-rw-r--r-- | lgl/stdint.in.h (renamed from lgl/stdint_.h) | 0 | ||||
-rw-r--r-- | lgl/stdio.in.h (renamed from lgl/stdio_.h) | 53 | ||||
-rw-r--r-- | lgl/stdlib.in.h (renamed from lgl/stdlib_.h) | 9 | ||||
-rw-r--r-- | lgl/string.in.h (renamed from lgl/string_.h) | 15 | ||||
-rw-r--r-- | lgl/sys_socket.in.h (renamed from lgl/sys_socket_.h) | 0 | ||||
-rw-r--r-- | lgl/sys_stat.in.h (renamed from lgl/sys_stat_.h) | 0 | ||||
-rw-r--r-- | lgl/time.in.h (renamed from lgl/time_.h) | 0 | ||||
-rw-r--r-- | lgl/unistd.in.h (renamed from lgl/unistd_.h) | 0 | ||||
-rw-r--r-- | lgl/vasnprintf.c | 45 | ||||
-rw-r--r-- | lgl/wchar.in.h (renamed from lgl/wchar_.h) | 0 |
57 files changed, 727 insertions, 263 deletions
diff --git a/build-aux/config.rpath b/build-aux/config.rpath index c492a93b66..c547c68825 100755 --- a/build-aux/config.rpath +++ b/build-aux/config.rpath @@ -2,7 +2,7 @@ # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in an executable. # -# Copyright 1996-2006 Free Software Foundation, Inc. +# Copyright 1996-2007 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # @@ -64,7 +64,7 @@ else ;; esac ;; - mingw* | pw32* | os2*) + mingw* | cygwin* | pw32* | os2*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' @@ -74,7 +74,7 @@ else ;; newsos6) ;; - linux*) + linux* | k*bsd*-gnu) case $cc_basename in icc* | ecc*) wl='-Wl,' @@ -100,7 +100,7 @@ else osf3* | osf4* | osf5*) wl='-Wl,' ;; - sco3.2v5*) + rdos*) ;; solaris*) wl='-Wl,' @@ -108,11 +108,14 @@ else sunos4*) wl='-Qoption ld ' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; unicos*) wl='-Wl,' ;; @@ -189,11 +192,11 @@ if test "$with_gnu_ld" = yes; then ld_shlibs=no fi ;; - interix3*) + interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; - linux*) + gnu* | linux* | k*bsd*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else @@ -280,7 +283,7 @@ else strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 - hardcode_direct=yes + : else # We have old collect2 hardcode_direct=unsupported @@ -359,7 +362,7 @@ else hardcode_direct=yes hardcode_minus_L=yes ;; - freebsd* | kfreebsd*-gnu | dragonfly*) + freebsd* | dragonfly*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; @@ -412,18 +415,22 @@ else hardcode_libdir_separator=: ;; openbsd*) - hardcode_direct=yes - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi else - case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac + ld_shlibs=no fi ;; os2*) @@ -471,7 +478,7 @@ else ld_shlibs=yes fi ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' @@ -488,33 +495,51 @@ fi # Check dynamic linker characteristics # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) + library_names_spec='$libname.a' ;; aix4* | aix5*) + library_names_spec='$libname$shrext' ;; amigaos*) + library_names_spec='$libname.a' ;; beos*) + library_names_spec='$libname$shrext' ;; bsdi[45]*) + library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32*) shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib + library_names_spec='$libname$shrext' ;; dgux*) + library_names_spec='$libname$shrext' ;; freebsd1*) ;; - kfreebsd*-gnu) - ;; freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac ;; gnu*) + library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in @@ -528,10 +553,13 @@ case "$host_os" in shrext=.sl ;; esac + library_names_spec='$libname$shrext' ;; - interix3*) + interix[3-9]*) + library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= @@ -548,41 +576,59 @@ case "$host_os" in ;; linux*oldld* | linux*aout* | linux*coff*) ;; - linux*) + linux* | k*bsd*-gnu) + library_names_spec='$libname$shrext' ;; knetbsd*-gnu) + library_names_spec='$libname$shrext' ;; netbsd*) + library_names_spec='$libname$shrext' ;; newsos6) + library_names_spec='$libname$shrext' ;; nto-qnx*) + library_names_spec='$libname$shrext' ;; openbsd*) + library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll + library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) ;; solaris*) + library_names_spec='$libname$shrext' ;; sunos4*) + library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' ;; sysv4*MP*) + library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' ;; uts4*) + library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF @@ -596,6 +642,12 @@ libext="$libext" # Shared library suffix (normally "so"). shlibext="$shlibext" +# Format of library name prefix. +libname_spec="$escaped_libname_spec" + +# Library names that the linker finds when passed -lNAME. +library_names_spec="$escaped_library_names_spec" + # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" diff --git a/build-aux/maint.mk b/build-aux/maint.mk index a7a5a28f87..662b37174f 100644 --- a/build-aux/maint.mk +++ b/build-aux/maint.mk @@ -30,7 +30,7 @@ C_SOURCES += $(C_SOURCES_ADD) # Do not save the original name or timestamp in the .tar.gz file. # Use --rsyncable if available. gzip_rsyncable := \ - $(shell gzip --help|grep rsyncable >/dev/null && echo --rsyncable) + $(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null && echo --rsyncable) GZIP_ENV = '--no-name --best $(gzip_rsyncable)' # Prevent programs like 'sort' from considering distinct strings to be equal. diff --git a/gl/error.c b/gl/error.c index 9cf67ff904..3177bd5d2c 100644 --- a/gl/error.c +++ b/gl/error.c @@ -2,19 +2,18 @@ Copyright (C) 1990-1998, 2000-2007 Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ diff --git a/gl/error.h b/gl/error.h index 5a5f247658..8c215a7fd3 100644 --- a/gl/error.h +++ b/gl/error.h @@ -2,19 +2,18 @@ Copyright (C) 1995, 1996, 1997, 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. - This program is free software; you can redistribute it and/or modify + 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. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _ERROR_H #define _ERROR_H 1 diff --git a/gl/fseeko.c b/gl/fseeko.c index 209ce9c690..48c833b840 100644 --- a/gl/fseeko.c +++ b/gl/fseeko.c @@ -90,6 +90,10 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) || fp->__bufpos == fp->__bufstart) && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0 || fp->__bufpos == fp->__bufread)) +#elif defined __QNX__ /* QNX */ + if ((fp->_Mode & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend) + && fp->_Rback == fp->_Back + sizeof (fp->_Back) + && fp->_Rsave == NULL) #else #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib." #endif diff --git a/gl/gnulib.mk b/gl/gnulib.mk index f727afe883..74a060f439 100644 --- a/gl/gnulib.mk +++ b/gl/gnulib.mk @@ -126,6 +126,13 @@ EXTRA_libgnu_la_SOURCES += inet_pton.c ## end gnulib module inet_pton +## begin gnulib module intprops + + +EXTRA_DIST += intprops.h + +## end gnulib module intprops + ## begin gnulib module lseek @@ -147,20 +154,20 @@ 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.h: netinet_in.in.h @MKDIR_P@ netinet rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \ -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \ - < $(srcdir)/netinet_in_.h; \ + < $(srcdir)/netinet_in.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t MOSTLYCLEANDIRS += netinet -EXTRA_DIST += netinet_in_.h +EXTRA_DIST += netinet_in.in.h ## end gnulib module netinet_in @@ -188,6 +195,15 @@ EXTRA_libgnu_la_SOURCES += strdup.c ## end gnulib module strdup +## begin gnulib module strerror + + +EXTRA_DIST += strerror.c + +EXTRA_libgnu_la_SOURCES += strerror.c + +## end gnulib module strerror + ## begin gnulib module version-etc libgnu_la_SOURCES += version-etc.h version-etc.c diff --git a/gl/inet_pton.c b/gl/inet_pton.c index 5ec88a43ac..6cbf8cb2bd 100644 --- a/gl/inet_pton.c +++ b/gl/inet_pton.c @@ -2,10 +2,10 @@ Copyright (C) 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -13,8 +13,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (c) 1996,1999 by Internet Software Consortium. diff --git a/gl/inet_pton.h b/gl/inet_pton.h index 70f1c4b056..3335cb8cfa 100644 --- a/gl/inet_pton.h +++ b/gl/inet_pton.h @@ -1,10 +1,10 @@ /* Convert internet address from text to binary format. Copyright (C) 2005, 2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -12,8 +12,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/types.h> #include <sys/socket.h> diff --git a/gl/intprops.h b/gl/intprops.h new file mode 100644 index 0000000000..002161ee57 --- /dev/null +++ b/gl/intprops.h @@ -0,0 +1,77 @@ +/* intprops.h -- properties of integer types + + Copyright (C) 2001, 2002, 2003, 2004, 2005 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. */ + +#include <limits.h> + +/* The extra casts in the following macros work around compiler bugs, + e.g., in Cray C 5.0.3.0. */ + +/* True if the arithmetic type T is an integer type. bool counts as + an integer. */ +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) + +/* True if negative values of the signed integer type T use two's + complement, ones' complement, or signed magnitude representation, + respectively. Much GNU code assumes two's complement, but some + people like to be portable to all possible C hosts. */ +#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) +#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) +#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) + +/* True if the arithmetic type T is signed. */ +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* The maximum and minimum values for the integer type T. These + macros have undefined behavior if T is signed and has padding bits. + If this is a problem for you, please let us know how to fix it for + your host. */ +#define TYPE_MINIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) 0 \ + : TYPE_SIGNED_MAGNITUDE (t) \ + ? ~ (t) 0 \ + : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) + +/* Return zero if T can be determined to be an unsigned type. + Otherwise, return 1. + When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a + tighter bound. Otherwise, it overestimates the true bound by one byte + when applied to unsigned types of size 2, 4, 16, ... bytes. + The symbol signed_type_or_expr__ is private to this header file. */ +#if __GNUC__ >= 2 +# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define signed_type_or_expr__(t) 1 +#endif + +/* Bound on length of the string representing an integer type or expression T. + Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485; + add 1 for integer division truncation; add 1 more for a minus sign + if needed. */ +#define INT_STRLEN_BOUND(t) \ + ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \ + + signed_type_or_expr__ (t) + 1) + +/* Bound on buffer size needed to represent an integer type or expression T, + including the terminating null. */ +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 new file mode 100644 index 0000000000..bcbb3ceee2 --- /dev/null +++ b/gl/m4/extensions.m4 @@ -0,0 +1,82 @@ +# serial 5 -*- Autoconf -*- +# Enable extensions on systems that normally disable them. + +# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS +# Autoconf. Perhaps we can remove this once we can assume Autoconf +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly +# enough in this area it's likely we'll need to redefine +# AC_USE_SYSTEM_EXTENSIONS for quite some time. + +# AC_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +# Remember that #undef in AH_VERBATIM gets replaced with #define by +# AC_DEFINE. The goal here is to define all known feature-enabling +# macros, then, if reports of conflicts are made, disable macros that +# cause problems on some platforms (such as __EXTENSIONS__). +AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl + + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) + if test "$MINIX" = yes; then + AC_DEFINE([_POSIX_SOURCE], [1], + [Define to 1 if you need to in order for `stat' and other + things to work.]) + AC_DEFINE([_POSIX_1_SOURCE], [2], + [Define to 2 if the system does not provide POSIX.1 features + except with this defined.]) + AC_DEFINE([_MINIX], [1], + [Define to 1 if on MINIX.]) + fi + + AH_VERBATIM([__EXTENSIONS__], +[/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +]) + AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], + [ac_cv_safe_to_define___extensions__], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ +# define __EXTENSIONS__ 1 + AC_INCLUDES_DEFAULT])], + [ac_cv_safe_to_define___extensions__=yes], + [ac_cv_safe_to_define___extensions__=no])]) + test $ac_cv_safe_to_define___extensions__ = yes && + AC_DEFINE([__EXTENSIONS__]) + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) + AC_DEFINE([_TANDEM_SOURCE]) +])# AC_USE_SYSTEM_EXTENSIONS + +# gl_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 4a1e09f775..5d36c19505 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 12 +# getaddrinfo.m4 serial 15 dnl Copyright (C) 2004, 2005, 2006, 2007 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,23 @@ AC_DEFUN([gl_GETADDRINFO], AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo]) + AC_CHECK_HEADERS_ONCE(netdb.h) + AC_SEARCH_LIBS(getaddrinfo, [nsl socket]) - AC_CHECK_FUNCS(getaddrinfo,, [ + AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ + AC_TRY_LINK([ +#include <sys/types.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETDB_H +#include <netdb.h> +#endif +#include <stddef.h> +], [getaddrinfo("", "", NULL, NULL);], + [gl_cv_func_getaddrinfo=yes], + [gl_cv_func_getaddrinfo=no])]) + if test $gl_cv_func_getaddrinfo = no; then AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32, gl_cv_w32_getaddrinfo, [ gl_cv_w32_getaddrinfo=no @@ -20,19 +35,19 @@ AC_DEFUN([gl_GETADDRINFO], #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif -], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes) +#include <stddef.h> +], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes) LIBS="$am_save_LIBS"]) if test "$gl_cv_w32_getaddrinfo" = "yes"; then LIBS="$LIBS -lws2_32" else AC_LIBOBJ(getaddrinfo) fi - ]) + fi # 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_CHECK_HEADERS_ONCE(netdb.h) AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], gl_cv_func_gai_strerror, [ AC_TRY_LINK([ @@ -46,7 +61,8 @@ AC_DEFUN([gl_GETADDRINFO], #ifdef HAVE_WS2TCPIP_H #include <ws2tcpip.h> #endif -], [gai_strerror (0);], +#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 @@ -71,7 +87,8 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif -], [gethostbyname(0);], gl_cv_w32_gethostbyname=yes) +#include <stddef.h> +], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes) LIBS="$am_save_LIBS"]) if test "$gl_cv_w32_gethostbyname" = "yes"; then LIBS="$LIBS -lws2_32" @@ -81,7 +98,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_REQUIRE([gl_SOCKET_FAMILIES]) AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_REQUIRE([AC_C_INLINE]) - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CHECK_HEADERS_ONCE(netinet/in.h netdb.h) AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ /* sys/types.h is not needed according to POSIX, but the diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 7f6e3b41f7..d81be22a72 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 @@ -1,4 +1,4 @@ -# getdelim.m4 serial 3 +# getdelim.m4 serial 4 dnl Copyright (C) 2005, 2006, 2007 Free Software dnl Foundation, Inc. dnl @@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) dnl Persuade glibc <stdio.h> to declare getdelim(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REPLACE_FUNCS([getdelim]) AC_CHECK_DECLS_ONCE([getdelim]) diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4 index 11949b71cc..afd77669ad 100644 --- a/gl/m4/getline.m4 +++ b/gl/m4/getline.m4 @@ -1,4 +1,4 @@ -# getline.m4 serial 16 +# getline.m4 serial 17 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free dnl Software Foundation, Inc. @@ -18,7 +18,7 @@ AC_DEFUN([gl_FUNC_GETLINE], AC_REQUIRE([gl_STDIO_H_DEFAULTS]) dnl Persuade glibc <stdio.h> to declare getline(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CHECK_DECLS_ONCE([getline]) diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index fcade33317..1eec4134cb 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -26,6 +26,7 @@ AC_DEFUN([gl_EARLY], m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_FUNC_FSEEKO]) dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode dnl for the builtin va_copy to work. With Autoconf 2.60 or later, @@ -66,6 +67,8 @@ AC_DEFUN([gl_INIT], gl_STDARG_H gl_FUNC_STRDUP gl_STRING_MODULE_INDICATOR([strdup]) + gl_FUNC_STRERROR + gl_STRING_MODULE_INDICATOR([strerror]) m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_LIBOBJ]) @@ -87,18 +90,31 @@ AC_DEFUN([gl_INIT], # Like AC_LIBOBJ, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([gl_LIBOBJ], - [gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"]) +AC_DEFUN([gl_LIBOBJ], [ + AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl + gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" +]) # Like AC_REPLACE_FUNCS, except that the module name goes # into gl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([gl_REPLACE_FUNCS], - [AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])]) +AC_DEFUN([gl_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) +]) -# Like AC_LIBSOURCES, except that it does nothing. -# We rely on EXTRA_lib..._SOURCES instead. -AC_DEFUN([gl_LIBSOURCES], - []) +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parametrization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([gl_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_syscmd([test -r gl/]_gl_NAME[ || test ! -d gl])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([missing gl/]_gl_NAME)]) + ]) + ]) +]) # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. @@ -125,18 +141,21 @@ AC_DEFUN([gl_FILE_LIST], [ lib/inet_ntop.h lib/inet_pton.c lib/inet_pton.h + lib/intprops.h lib/lseek.c - lib/netinet_in_.h + lib/netinet_in.in.h lib/progname.c lib/progname.h lib/readline.c lib/readline.h lib/strdup.c + lib/strerror.c lib/version-etc-fsf.c lib/version-etc.c lib/version-etc.h m4/arpa_inet_h.m4 m4/error.m4 + m4/extensions.m4 m4/fseeko.m4 m4/getaddrinfo.m4 m4/getdelim.m4 @@ -155,4 +174,5 @@ AC_DEFUN([gl_FILE_LIST], [ m4/socklen.m4 m4/stdarg.m4 m4/strdup.m4 + m4/strerror.m4 ]) diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index d39a314e17..b755757be4 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 @@ -1,4 +1,4 @@ -# socklen.m4 serial 5 +# socklen.m4 serial 6 dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,7 +12,7 @@ dnl types for the argument to getsockopt, getpeername, etc. So we dnl have to test to find something that will work. dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find -dnl it there first. That file is included by gnulib's sys_socket_.h, which +dnl it there first. That file is included by gnulib's sys_socket.in.h, which dnl all users of this module should include. Cygwin must not include dnl ws2tcpip.h. AC_DEFUN([gl_TYPE_SOCKLEN_T], diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4 new file mode 100644 index 0000000000..9cb5769b12 --- /dev/null +++ b/gl/m4/strerror.m4 @@ -0,0 +1,46 @@ +# strerror.m4 serial 6 +dnl Copyright (C) 2002, 2007 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_STRERROR], +[ + AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE]) + if test $gl_cv_func_working_strerror = no; then + AC_LIBOBJ([strerror]) + AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR], + [Define this to 1 if strerror is broken.]) + fi +]) + +# Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ). +AC_DEFUN([gl_FUNC_STRERROR_SEPARATE], +[ + AC_CACHE_CHECK([for working strerror function], + [gl_cv_func_working_strerror], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [#include <string.h> + ], + [return !*strerror (-2);])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no], + [dnl Assume crossbuild works if it compiles. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include <string.h> + ], + [return !*strerror (-2);])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no])])]) + if test $gl_cv_func_working_strerror = no ; then + REPLACE_STRERROR=1 + gl_PREREQ_STRERROR + fi +]) + +# Prerequisites of lib/strerror.c. +AC_DEFUN([gl_PREREQ_STRERROR], [ + AC_CHECK_DECLS([strerror]) +]) diff --git a/gl/netinet_in_.h b/gl/netinet_in.in.h index aa00e45ced..aa00e45ced 100644 --- a/gl/netinet_in_.h +++ b/gl/netinet_in.in.h diff --git a/gl/progname.c b/gl/progname.c index df52f60921..fa5aa8bec7 100644 --- a/gl/progname.c +++ b/gl/progname.c @@ -2,10 +2,10 @@ Copyright (C) 2001-2003, 2005-2006 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -13,8 +13,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gl/progname.h b/gl/progname.h index 206c2cc063..82615c6bc0 100644 --- a/gl/progname.h +++ b/gl/progname.h @@ -2,10 +2,10 @@ Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -13,8 +13,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _PROGNAME_H #define _PROGNAME_H diff --git a/gl/readline.c b/gl/readline.c index 1eadabd971..a8db7ec68e 100644 --- a/gl/readline.c +++ b/gl/readline.c @@ -2,10 +2,10 @@ Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. Written by Simon Josefsson - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -13,8 +13,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/gl/readline.h b/gl/readline.h index a5d339acc1..04b3adb478 100644 --- a/gl/readline.h +++ b/gl/readline.h @@ -2,10 +2,10 @@ Copyright (C) 2005 Free Software Foundation, Inc. Written by Simon Josefsson - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -13,8 +13,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GL_READLINE_H #define GL_READLINE_H diff --git a/gl/strerror.c b/gl/strerror.c new file mode 100644 index 0000000000..9b9ffd104d --- /dev/null +++ b/gl/strerror.c @@ -0,0 +1,49 @@ +/* strerror.c --- POSIX compatible system error routine + + Copyright (C) 2007 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 <string.h> + +#if REPLACE_STRERROR + +# include <stdio.h> + +# include "intprops.h" + +# undef strerror +# if ! HAVE_DECL_STRERROR +# define strerror(n) NULL +# endif + +char * +rpl_strerror (int n) +{ + char *result = strerror (n); + + if (! result) + { + static char const fmt[] = "Unknown error (%d)"; + static char mesg[sizeof fmt + INT_STRLEN_BOUND (n)]; + sprintf (mesg, fmt, n); + return mesg; + } + + return result; +} + +#endif diff --git a/gl/version-etc-fsf.c b/gl/version-etc-fsf.c index f25eb653ea..4c0d174d63 100644 --- a/gl/version-etc-fsf.c +++ b/gl/version-etc-fsf.c @@ -1,10 +1,10 @@ /* Variable with FSF copyright information, for version-etc. Copyright (C) 1999-2006 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -12,8 +12,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/gl/version-etc.c b/gl/version-etc.c index 1ae82c4179..23eb92fa49 100644 --- a/gl/version-etc.c +++ b/gl/version-etc.c @@ -1,10 +1,10 @@ /* Utility to help print --version output in a consistent format. Copyright (C) 1999-2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -12,8 +12,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/gl/version-etc.h b/gl/version-etc.h index 84da535001..d9d1340eb5 100644 --- a/gl/version-etc.h +++ b/gl/version-etc.h @@ -1,10 +1,10 @@ /* Utility to help print --version output in a consistent format. Copyright (C) 1999, 2003, 2005 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + 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. + 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 @@ -12,8 +12,7 @@ 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. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Written by Jim Meyering. */ diff --git a/lgl/Makefile.am b/lgl/Makefile.am index 703701a48a..ca8f208d6a 100644 --- a/lgl/Makefile.am +++ b/lgl/Makefile.am @@ -50,14 +50,14 @@ 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_.h +alloca.h: alloca.in.h { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - cat $(srcdir)/alloca_.h; \ + cat $(srcdir)/alloca.in.h; \ } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += alloca.h alloca.h-t -EXTRA_DIST += alloca_.h +EXTRA_DIST += alloca.in.h ## end gnulib module alloca-opt @@ -179,17 +179,17 @@ 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_.h +float.h: float.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ - < $(srcdir)/float_.h; \ + < $(srcdir)/float.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += float.h float.h-t -EXTRA_DIST += float_.h +EXTRA_DIST += float.in.h ## end gnulib module float @@ -293,15 +293,15 @@ 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_.h +stdbool.h: stdbool.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t -EXTRA_DIST += stdbool_.h +EXTRA_DIST += stdbool.in.h ## end gnulib module stdbool @@ -311,7 +311,7 @@ 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_.h +stdint.h: stdint.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ @@ -336,12 +336,12 @@ stdint.h: stdint_.h -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ - < $(srcdir)/stdint_.h; \ + < $(srcdir)/stdint.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdint.h stdint.h-t -EXTRA_DIST += stdint_.h +EXTRA_DIST += stdint.in.h ## end gnulib module stdint @@ -351,7 +351,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_.h +stdio.h: stdio.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -365,6 +365,8 @@ stdio.h: stdio_.h -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ + -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ + -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ @@ -384,6 +386,8 @@ stdio.h: stdio_.h -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ + -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ + -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ @@ -393,12 +397,12 @@ stdio.h: stdio_.h -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/stdio_.h; \ + < $(srcdir)/stdio.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdio.h stdio.h-t -EXTRA_DIST += stdio_.h +EXTRA_DIST += stdio.in.h ## end gnulib module stdio @@ -408,7 +412,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_.h +stdlib.h: stdlib.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -426,12 +430,12 @@ stdlib.h: stdlib_.h -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/stdlib_.h; \ + < $(srcdir)/stdlib.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdlib.h stdlib.h-t -EXTRA_DIST += stdlib_.h +EXTRA_DIST += stdlib.in.h ## end gnulib module stdlib @@ -441,7 +445,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_.h +string.h: string.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -473,6 +477,7 @@ string.h: string_.h -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ + -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ @@ -489,13 +494,15 @@ string.h: string_.h -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/string_.h; \ + < $(srcdir)/string.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += string.h string.h-t -EXTRA_DIST += string_.h +EXTRA_DIST += string.in.h ## end gnulib module string @@ -514,7 +521,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_.h +sys/socket.h: sys_socket.in.h @MKDIR_P@ sys { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -522,13 +529,13 @@ sys/socket.h: sys_socket_.h -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ - < $(srcdir)/sys_socket_.h; \ + < $(srcdir)/sys_socket.in.h; \ } > $@-t mv -f $@-t $@ MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t MOSTLYCLEANDIRS += sys -EXTRA_DIST += sys_socket_.h +EXTRA_DIST += sys_socket.in.h ## end gnulib module sys_socket @@ -538,7 +545,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_.h +sys/stat.h: sys_stat.in.h @MKDIR_P@ sys rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ @@ -547,13 +554,13 @@ sys/stat.h: sys_stat_.h -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \ -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \ - < $(srcdir)/sys_stat_.h; \ + < $(srcdir)/sys_stat.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t MOSTLYCLEANDIRS += sys -EXTRA_DIST += sys_stat_.h +EXTRA_DIST += sys_stat.in.h ## end gnulib module sys_stat @@ -563,7 +570,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_.h +time.h: time.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -574,12 +581,12 @@ time.h: time_.h -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ -e 's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ - < $(srcdir)/time_.h; \ + < $(srcdir)/time.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += time.h time.h-t -EXTRA_DIST += time_.h +EXTRA_DIST += time.in.h ## end gnulib module time @@ -598,7 +605,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_.h +unistd.h: unistd.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ @@ -624,12 +631,12 @@ unistd.h: unistd_.h -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ - < $(srcdir)/unistd_.h; \ + < $(srcdir)/unistd.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += unistd.h unistd.h-t -EXTRA_DIST += unistd_.h +EXTRA_DIST += unistd.in.h ## end gnulib module unistd @@ -657,7 +664,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_.h +wchar.h: wchar.in.h rm -f $@-t $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \ @@ -667,12 +674,12 @@ wchar.h: wchar_.h -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \ -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ - < $(srcdir)/wchar_.h; \ + < $(srcdir)/wchar.in.h; \ } > $@-t mv $@-t $@ MOSTLYCLEANFILES += wchar.h wchar.h-t -EXTRA_DIST += wchar_.h +EXTRA_DIST += wchar.in.h ## end gnulib module wchar diff --git a/lgl/alloca_.h b/lgl/alloca.in.h index 1c1d9e68ed..1c1d9e68ed 100644 --- a/lgl/alloca_.h +++ b/lgl/alloca.in.h diff --git a/lgl/dummy.c b/lgl/dummy.c index 42a82de177..5834053b05 100644 --- a/lgl/dummy.c +++ b/lgl/dummy.c @@ -1,10 +1,10 @@ /* A dummy file, to prevent empty libraries from breaking builds. Copyright (C) 2004, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,9 +12,7 @@ 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Some systems, reportedly OpenBSD and Mac OS X, refuse to create libraries without any object files. You might get an error like: diff --git a/lgl/float_.h b/lgl/float.in.h index c31f193d03..7cf07915fa 100644 --- a/lgl/float_.h +++ b/lgl/float.in.h @@ -2,10 +2,10 @@ Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _GL_FLOAT_H diff --git a/lgl/gc-gnulib.c b/lgl/gc-gnulib.c index c3cf0c529e..c199833774 100644 --- a/lgl/gc-gnulib.c +++ b/lgl/gc-gnulib.c @@ -581,6 +581,8 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) Gc_rc rc = GC_OK; ctx = calloc (sizeof (*ctx), 1); + if (!ctx) + return GC_MALLOC_ERROR; ctx->alg = hash; ctx->mode = mode; diff --git a/lgl/gc-libgcrypt.c b/lgl/gc-libgcrypt.c index f28a20f9f9..683c73ffb4 100644 --- a/lgl/gc-libgcrypt.c +++ b/lgl/gc-libgcrypt.c @@ -142,16 +142,6 @@ gc_cipher_open (Gc_cipher alg, Gc_cipher_mode mode, gcryalg = GCRY_CIPHER_RFC2268_40; break; -#ifdef ENABLE_CAMELLIA - case GC_CAMELLIA128: - gcryalg = GCRY_CIPHER_CAMELLIA128; - break; - - case GC_CAMELLIA256: - gcryalg = GCRY_CIPHER_CAMELLIA256; - break; -#endif - default: return GC_INVALID_CIPHER; } @@ -79,9 +79,7 @@ enum Gc_cipher GC_DES, GC_ARCFOUR128, GC_ARCFOUR40, - GC_ARCTWO40, - GC_CAMELLIA128, - GC_CAMELLIA256 + GC_ARCTWO40 }; typedef enum Gc_cipher Gc_cipher; diff --git a/lgl/m4/extensions.m4 b/lgl/m4/extensions.m4 index 143a9e5403..bcbb3ceee2 100644 --- a/lgl/m4/extensions.m4 +++ b/lgl/m4/extensions.m4 @@ -1,14 +1,14 @@ -# serial 4 -*- Autoconf -*- +# serial 5 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. @@ -16,26 +16,48 @@ # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. +# Remember that #undef in AH_VERBATIM gets replaced with #define by +# AC_DEFINE. The goal here is to define all known feature-enabling +# macros, then, if reports of conflicts are made, disable macros that +# cause problems on some platforms (such as __EXTENSIONS__). AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], -[ - AC_BEFORE([$0], [AC_COMPILE_IFELSE]) - AC_BEFORE([$0], [AC_RUN_IFELSE]) +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - AC_REQUIRE([AC_GNU_SOURCE]) - AC_REQUIRE([AC_AIX]) - AC_REQUIRE([AC_MINIX]) + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) + if test "$MINIX" = yes; then + AC_DEFINE([_POSIX_SOURCE], [1], + [Define to 1 if you need to in order for `stat' and other + things to work.]) + AC_DEFINE([_POSIX_1_SOURCE], [2], + [Define to 2 if the system does not provide POSIX.1 features + except with this defined.]) + AC_DEFINE([_MINIX], [1], + [Define to 1 if on MINIX.]) + fi AH_VERBATIM([__EXTENSIONS__], -[/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ +[/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE #endif +/* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE -#endif]) +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +]) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( @@ -46,9 +68,11 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [ac_cv_safe_to_define___extensions__=no])]) test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) -]) +])# AC_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS # ------------------------ diff --git a/lgl/m4/gnulib-comp.m4 b/lgl/m4/gnulib-comp.m4 index 10e3e26fe8..55c46f19cc 100644 --- a/lgl/m4/gnulib-comp.m4 +++ b/lgl/m4/gnulib-comp.m4 @@ -124,25 +124,38 @@ AC_DEFUN([lgl_INIT], # Like AC_LIBOBJ, except that the module name goes # into lgl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([lgl_LIBOBJ], - [lgl_LIBOBJS="$lgl_LIBOBJS $1.$ac_objext"]) +AC_DEFUN([lgl_LIBOBJ], [ + AS_LITERAL_IF([$1], [lgl_LIBSOURCES([$1.c])])dnl + lgl_LIBOBJS="$lgl_LIBOBJS $1.$ac_objext" +]) # Like AC_REPLACE_FUNCS, except that the module name goes # into lgl_LIBOBJS instead of into LIBOBJS. -AC_DEFUN([lgl_REPLACE_FUNCS], - [AC_CHECK_FUNCS([$1], , [lgl_LIBOBJ($ac_func)])]) +AC_DEFUN([lgl_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [lgl_LIBOBJ($ac_func)]) +]) -# Like AC_LIBSOURCES, except that it does nothing. -# We rely on EXTRA_lib..._SOURCES instead. -AC_DEFUN([lgl_LIBSOURCES], - []) +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parametrization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([lgl_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_syscmd([test -r lgl/]_gl_NAME[ || test ! -d lgl])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([missing lgl/]_gl_NAME)]) + ]) + ]) +]) # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([lgl_FILE_LIST], [ build-aux/config.rpath build-aux/link-warning.h - lib/alloca_.h + lib/alloca.in.h lib/arcfour.c lib/arcfour.h lib/arctwo.c @@ -153,7 +166,7 @@ AC_DEFUN([lgl_FILE_LIST], [ lib/des.h lib/dummy.c lib/float+.h - lib/float_.h + lib/float.in.h lib/gc-gnulib.c lib/gc-libgcrypt.c lib/gc-pbkdf2-sha1.c @@ -188,22 +201,22 @@ AC_DEFUN([lgl_FILE_LIST], [ lib/sha1.h lib/size_max.h lib/snprintf.c - lib/stdbool_.h - lib/stdint_.h - lib/stdio_.h - lib/stdlib_.h - lib/string_.h + lib/stdbool.in.h + lib/stdint.in.h + lib/stdio.in.h + lib/stdlib.in.h + lib/string.in.h lib/strverscmp.c lib/strverscmp.h - lib/sys_socket_.h - lib/sys_stat_.h - lib/time_.h + lib/sys_socket.in.h + lib/sys_stat.in.h + lib/time.in.h lib/time_r.c - lib/unistd_.h + lib/unistd.in.h lib/vasnprintf.c lib/vasnprintf.h lib/vasprintf.c - lib/wchar_.h + lib/wchar.in.h lib/xsize.h m4/absolute-header.m4 m4/alloca.m4 diff --git a/lgl/m4/lock.m4 b/lgl/m4/lock.m4 index 0224f2ff87..4cc585ea2e 100644 --- a/lgl/m4/lock.m4 +++ b/lgl/m4/lock.m4 @@ -1,5 +1,5 @@ -# lock.m4 serial 6 (gettext-0.16) -dnl Copyright (C) 2005-2006 Free Software Foundation, Inc. +# lock.m4 serial 7 (gettext-0.16.2) +dnl Copyright (C) 2005-2007 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. @@ -35,7 +35,12 @@ AC_DEFUN([gl_LOCK_EARLY_BODY], AC_BEFORE([$0], [gl_ARGP])dnl AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems + dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. + dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes + dnl AC_GNU_SOURCE. + m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], + [AC_REQUIRE([AC_GNU_SOURCE])]) dnl Check for multithreading. AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API]) diff --git a/lgl/m4/longlong.m4 b/lgl/m4/longlong.m4 index 1f9e862ef1..5799c3965a 100644 --- a/lgl/m4/longlong.m4 +++ b/lgl/m4/longlong.m4 @@ -1,5 +1,5 @@ -# longlong.m4 serial 10 -dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. +# longlong.m4 serial 11 +dnl Copyright (C) 1999-2007 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. @@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.60, but can be removed once we -# assume 2.61 everywhere. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. # Note: If the type 'long long int' exists but is only 32 bits large # (as on some very old compilers), HAVE_LONG_LONG_INT will not be @@ -19,7 +19,10 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT], AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[long long int ll = 9223372036854775807ll; + [[#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + error in preprocessor; + #endif + long long int ll = 9223372036854775807ll; long long int nll = -9223372036854775807LL; typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) diff --git a/lgl/m4/memmem.m4 b/lgl/m4/memmem.m4 index e6d40068e4..e6a3da193c 100644 --- a/lgl/m4/memmem.m4 +++ b/lgl/m4/memmem.m4 @@ -1,4 +1,4 @@ -# memmem.m4 serial 4 +# memmem.m4 serial 5 dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MEMMEM], [ dnl Persuade glibc <string.h> to declare memmem(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REPLACE_FUNCS(memmem) diff --git a/lgl/m4/socklen.m4 b/lgl/m4/socklen.m4 index d39a314e17..b755757be4 100644 --- a/lgl/m4/socklen.m4 +++ b/lgl/m4/socklen.m4 @@ -1,4 +1,4 @@ -# socklen.m4 serial 5 +# socklen.m4 serial 6 dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -12,7 +12,7 @@ dnl types for the argument to getsockopt, getpeername, etc. So we dnl have to test to find something that will work. dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find -dnl it there first. That file is included by gnulib's sys_socket_.h, which +dnl it there first. That file is included by gnulib's sys_socket.in.h, which dnl all users of this module should include. Cygwin must not include dnl ws2tcpip.h. AC_DEFUN([gl_TYPE_SOCKLEN_T], diff --git a/lgl/m4/stdint.m4 b/lgl/m4/stdint.m4 index 03bb093202..bb6c34fe1e 100644 --- a/lgl/m4/stdint.m4 +++ b/lgl/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 28 +# stdint.m4 serial 29 dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -370,7 +370,7 @@ AC_DEFUN([gl_STDINT_INCLUDES], dnl gl_STDINT_TYPE_PROPERTIES dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t -dnl of interest to stdint_.h. +dnl of interest to stdint.in.h. AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], [ gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t], diff --git a/lgl/m4/stdio_h.m4 b/lgl/m4/stdio_h.m4 index b9a69984f6..45e54e2a62 100644 --- a/lgl/m4/stdio_h.m4 +++ b/lgl/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 7 +# stdio_h.m4 serial 8 dnl Copyright (C) 2007 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,6 +28,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) + GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) + GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) @@ -48,6 +50,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) + REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) + REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) diff --git a/lgl/m4/string_h.m4 b/lgl/m4/string_h.m4 index ec51e9a018..d811e26b88 100644 --- a/lgl/m4/string_h.m4 +++ b/lgl/m4/string_h.m4 @@ -57,6 +57,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) + GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) @@ -74,4 +75,6 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) + HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) ]) diff --git a/lgl/m4/strverscmp.m4 b/lgl/m4/strverscmp.m4 index ab20c1809d..5f01ba9e5b 100644 --- a/lgl/m4/strverscmp.m4 +++ b/lgl/m4/strverscmp.m4 @@ -1,5 +1,5 @@ -# strverscmp.m4 serial 4 -dnl Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. +# strverscmp.m4 serial 5 +dnl Copyright (C) 2002, 2005, 2006, 2007 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. @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRVERSCMP], [ dnl Persuade glibc <string.h> to declare strverscmp(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REPLACE_FUNCS(strverscmp) if test $ac_cv_func_strverscmp = no; then diff --git a/lgl/m4/ulonglong.m4 b/lgl/m4/ulonglong.m4 index 9fae98e3a6..e9807895a7 100644 --- a/lgl/m4/ulonglong.m4 +++ b/lgl/m4/ulonglong.m4 @@ -1,5 +1,5 @@ -# ulonglong.m4 serial 6 -dnl Copyright (C) 1999-2006 Free Software Foundation, Inc. +# ulonglong.m4 serial 7 +dnl Copyright (C) 1999-2007 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. @@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert. # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.60, but can be removed once we -# assume 2.61 everywhere. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. # Note: If the type 'unsigned long long int' exists but is only 32 bits # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT @@ -21,7 +21,10 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], [ac_cv_type_unsigned_long_long_int], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[unsigned long long int ull = 18446744073709551615ULL; + [[#if ! (18446744073709551615ULL <= -1u) + error in preprocessor; + #endif + unsigned long long int ull = 18446744073709551615ULL; typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1 ? 1 : -1)]; int i = 63;]], diff --git a/lgl/m4/vasprintf.m4 b/lgl/m4/vasprintf.m4 index 4f0c79a71a..074b03cf72 100644 --- a/lgl/m4/vasprintf.m4 +++ b/lgl/m4/vasprintf.m4 @@ -1,4 +1,4 @@ -# vasprintf.m4 serial 5 +# vasprintf.m4 serial 6 dnl Copyright (C) 2002-2003, 2006-2007 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,7 +31,7 @@ AC_DEFUN([gl_REPLACE_VASPRINTF], AC_DEFUN([gl_PREREQ_VASPRINTF_H], [ dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf(). - AC_REQUIRE([AC_GNU_SOURCE]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) ]) # Prerequisites of lib/vasprintf.c. diff --git a/lgl/printf-parse.c b/lgl/printf-parse.c index 1c3e6c0a11..0b75c2860d 100644 --- a/lgl/printf-parse.c +++ b/lgl/printf-parse.c @@ -49,7 +49,7 @@ #include <stddef.h> /* Get intmax_t. */ -#ifdef IN_LIBINTL +#if defined IN_LIBINTL || defined IN_LIBASPRINTF # if HAVE_STDINT_H_WITH_UINTMAX # include <stdint.h> # endif diff --git a/lgl/realloc.c b/lgl/realloc.c index bcb6969ec5..4f6cddf537 100644 --- a/lgl/realloc.c +++ b/lgl/realloc.c @@ -2,10 +2,10 @@ Copyright (C) 1997, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* written by Jim Meyering and Bruno Haible */ diff --git a/lgl/stdbool_.h b/lgl/stdbool.in.h index 4762a5c301..4762a5c301 100644 --- a/lgl/stdbool_.h +++ b/lgl/stdbool.in.h diff --git a/lgl/stdint_.h b/lgl/stdint.in.h index 163378ce7d..163378ce7d 100644 --- a/lgl/stdint_.h +++ b/lgl/stdint.in.h diff --git a/lgl/stdio_.h b/lgl/stdio.in.h index 42bac02bdb..b17642438d 100644 --- a/lgl/stdio_.h +++ b/lgl/stdio.in.h @@ -212,6 +212,32 @@ extern int vsprintf (char *str, const char *format, va_list args) # endif #endif +#if @GNULIB_FOPEN@ +# if @REPLACE_FOPEN@ +# define fopen rpl_fopen +extern FILE * fopen (const char *filename, const char *mode); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fopen +# define fopen(f,m) \ + (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \ + "use gnulib module fopen for portability"), \ + fopen (f, m)) +#endif + +#if @GNULIB_FREOPEN@ +# if @REPLACE_FREOPEN@ +# define freopen rpl_freopen +extern FILE * freopen (const char *filename, const char *mode, FILE *stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef freopen +# define freopen(f,m,s) \ + (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \ + "use gnulib module freopen for portability"), \ + freopen (f, m, s)) +#endif + #if @GNULIB_FSEEKO@ # if @REPLACE_FSEEKO@ /* Provide fseek, fseeko functions that are aware of a preceding @@ -308,12 +334,14 @@ extern long rpl_ftell (FILE *fp); #if @GNULIB_GETDELIM@ # if !@HAVE_DECL_GETDELIM@ - /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and - NUL-terminate it). *LINEPTR is a pointer returned from malloc (or - NULL), pointing to *N characters of space. It is realloc'ed as - necessary. Returns the number of characters read (not including - the null terminator), or -1 on error or EOF. */ - extern ssize_t getdelim (char **, size_t *, int delim, FILE *); +/* Read input, up to (and including) the next occurrence of DELIMITER, from + STREAM, store it in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter, + FILE *stream); # endif #elif defined GNULIB_POSIXCHECK # undef getdelim @@ -329,12 +357,13 @@ extern long rpl_ftell (FILE *fp); # define getline rpl_getline # endif # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@ - /* Read up to (and including) a newline from FP into *LINEPTR (and - NUL-terminate it). *LINEPTR is a pointer returned from malloc (or - NULL), pointing to *N characters of space. It is realloc'ed as - necessary. Returns the number of characters read (not including - the null terminator), or -1 on error or EOF. */ - extern ssize_t getline (char **, size_t *, FILE *); +/* Read a line, up to (and including) the next newline, from STREAM, store it + in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream); # endif #elif defined GNULIB_POSIXCHECK # undef getline diff --git a/lgl/stdlib_.h b/lgl/stdlib.in.h index 9ca200bcef..7d46562414 100644 --- a/lgl/stdlib_.h +++ b/lgl/stdlib.in.h @@ -2,10 +2,10 @@ Copyright (C) 1995, 2001-2002, 2006-2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1, or (at your option) - any later version. + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,8 +13,7 @@ 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ #if defined __need_malloc_and_calloc /* Special invocation convention inside glibc header files. */ diff --git a/lgl/string_.h b/lgl/string.in.h index b7edebed56..f458f4400d 100644 --- a/lgl/string_.h +++ b/lgl/string.in.h @@ -539,6 +539,21 @@ extern char * mbssep (char **stringp, const char *delim); extern char * mbstok_r (char *string, const char *delim, char **save_ptr); #endif +/* Map any int, typically from errno, into an error message. */ +#if @GNULIB_STRERROR@ +# if @REPLACE_STRERROR@ +# undef strerror +# define strerror rpl_strerror +extern char *strerror (int); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror +# define strerror(e) \ + (GL_LINK_WARNING ("strerror is unportable - " \ + "use gnulib module strerror to guarantee non-NULL result"), \ + strerror (e)) +#endif + #ifdef __cplusplus } diff --git a/lgl/sys_socket_.h b/lgl/sys_socket.in.h index 35cde40b23..35cde40b23 100644 --- a/lgl/sys_socket_.h +++ b/lgl/sys_socket.in.h diff --git a/lgl/sys_stat_.h b/lgl/sys_stat.in.h index ff2159f3e0..ff2159f3e0 100644 --- a/lgl/sys_stat_.h +++ b/lgl/sys_stat.in.h diff --git a/lgl/time_.h b/lgl/time.in.h index 3f5ad0061f..3f5ad0061f 100644 --- a/lgl/time_.h +++ b/lgl/time.in.h diff --git a/lgl/unistd_.h b/lgl/unistd.in.h index 5405baf881..5405baf881 100644 --- a/lgl/unistd_.h +++ b/lgl/unistd.in.h diff --git a/lgl/vasnprintf.c b/lgl/vasnprintf.c index 75c6e9ee9f..ee7c319023 100644 --- a/lgl/vasnprintf.c +++ b/lgl/vasnprintf.c @@ -3385,9 +3385,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, #endif *fbp = dp->conversion; #if USE_SNPRINTF +# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) fbp[1] = '%'; fbp[2] = 'n'; fbp[3] = '\0'; +# else + /* On glibc2 systems from glibc >= 2.3 - probably also older + ones - we know that snprintf's returns value conforms to + ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes. + Therefore we can avoid using %n in this situation. + On glibc2 systems from 2004-10-18 or newer, the use of %n + in format strings in writable memory may crash the program + (if compiled with _FORTIFY_SOURCE=2), so we should avoid it + in this situation. */ + fbp[1] = '\0'; +# endif #else fbp[1] = '\0'; #endif @@ -3430,7 +3442,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* SNPRINTF can fail if its second argument is > INT_MAX. */ if (maxlen > INT_MAX / TCHARS_PER_DCHAR) - goto overflow; + maxlen = INT_MAX / TCHARS_PER_DCHAR; maxlen = maxlen * TCHARS_PER_DCHAR; # define SNPRINTF_BUF(arg) \ switch (prefix_count) \ @@ -3651,17 +3663,26 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, /* Handle overflow of the allocated buffer. */ if (count >= maxlen) { - /* Need at least count * sizeof (TCHAR_T) bytes. But - allocate proportionally, to avoid looping eternally - if snprintf() reports a too small count. */ - size_t n = - xmax (xsum (length, - (count + TCHARS_PER_DCHAR - 1) - / TCHARS_PER_DCHAR), - xtimes (allocated, 2)); - - ENSURE_ALLOCATION (n); - continue; + /* If maxlen already has attained its allowed maximum, + allocating more memory will not increase maxlen. + Instead of looping, bail out. */ + if (maxlen == INT_MAX / TCHARS_PER_DCHAR) + goto overflow; + else + { + /* Need at least count * sizeof (TCHAR_T) bytes. + But allocate proportionally, to avoid looping + eternally if snprintf() reports a too small + count. */ + size_t n = + xmax (xsum (length, + (count + TCHARS_PER_DCHAR - 1) + / TCHARS_PER_DCHAR), + xtimes (allocated, 2)); + + ENSURE_ALLOCATION (n); + continue; + } } #endif diff --git a/lgl/wchar_.h b/lgl/wchar.in.h index 0aba1cac10..0aba1cac10 100644 --- a/lgl/wchar_.h +++ b/lgl/wchar.in.h |