From ec7f4aaff613442e708e2ee3b2c5c90fecbca2c1 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Tue, 12 Sep 2006 16:16:23 +0000 Subject: [PATCH] Update. --- gl/Makefile.am | 23 ++++++++++++++--------- gl/error.c | 18 +++++++++--------- gl/m4/gnulib-cache.m4 | 1 + gl/m4/gnulib-comp.m4 | 5 +++++ gl/m4/lib-link.m4 | 24 +++++++++++++++++++----- gl/vasnprintf.c | 22 +++++----------------- lib/gl/Makefile.am | 14 ++++++-------- lib/gl/m4/gnulib-cache.m4 | 1 + lib/gl/m4/gnulib-comp.m4 | 5 +++++ lib/gl/m4/lib-link.m4 | 24 +++++++++++++++++++----- lib/gl/m4/stdint.m4 | 6 +----- lib/gl/stdint_.h | 4 +++- lib/gl/vasnprintf.c | 22 +++++----------------- lib/gl/vasprintf.c | 20 ++++++++++++++++---- 14 files changed, 109 insertions(+), 80 deletions(-) diff --git a/gl/Makefile.am b/gl/Makefile.am index c875879..d3fdd0b 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -16,6 +16,7 @@ noinst_LTLIBRARIES = libgl.la libgl_la_SOURCES = libgl_la_LIBADD = @LTLIBOBJS@ +libgl_la_LDFLAGS = $(AM_LDFLAGS) noinst_HEADERS = EXTRA_DIST = BUILT_SOURCES = @@ -36,8 +37,8 @@ EXTRA_DIST += alloca_.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. alloca.h: alloca_.h - cp $(srcdir)/alloca_.h $@-t - mv $@-t $@ + cp -f $(srcdir)/alloca_.h $@-t + mv -f $@-t $@ MOSTLYCLEANFILES += alloca.h alloca.h-t ## end gnulib module alloca-opt @@ -50,6 +51,7 @@ BUILT_SOURCES += $(ARPA_INET_H) # doesn't have one. arpa/inet.h: test -d arpa || mkdir arpa + rm -f $@-t $@ echo '#include ' >$@-t mv $@-t $@ MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t @@ -95,8 +97,8 @@ EXTRA_DIST += getopt_.h getopt_int.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. getopt.h: getopt_.h - cp $(srcdir)/getopt_.h $@-t - mv $@-t $@ + cp -f $(srcdir)/getopt_.h $@-t + mv -f $@-t $@ MOSTLYCLEANFILES += getopt.h getopt.h-t ## end gnulib module getopt @@ -116,7 +118,9 @@ libgl_la_SOURCES += gettext.h ## begin gnulib module iconvme libgl_la_SOURCES += iconvme.h iconvme.c -libgl_la_LIBADD += $(LTLIBICONV) +if GL_COND_LIBTOOL +libgl_la_LDFLAGS += $(LTLIBICONV) +endif ## end gnulib module iconvme @@ -134,6 +138,7 @@ BUILT_SOURCES += $(NETINET_IN_H) # doesn't have one. netinet/in.h: test -d netinet || mkdir netinet + rm -f $@-t $@ echo '#include ' >$@-t mv $@-t $@ MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t @@ -185,6 +190,7 @@ EXTRA_DIST += stdbool_.h # We need the following in order to create when the system # doesn't have one that works. stdbool.h: stdbool_.h + rm -f $@-t $@ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t @@ -205,6 +211,7 @@ BUILT_SOURCES += $(SYS_SELECT_H) # doesn't have one that works with the given compiler. sys/select.h: test -d sys || mkdir sys + rm -f $@-t $@ echo '#include ' >$@-t mv $@-t $@ MOSTLYCLEANFILES += sys/select.h sys/select.h-t @@ -221,8 +228,8 @@ EXTRA_DIST += socket_.h # doesn't have one that works with the given compiler. sys/socket.h: socket_.h test -d sys || mkdir sys - cp $(srcdir)/socket_.h $@-t - mv $@-t $@ + cp -f $(srcdir)/socket_.h $@-t + mv -f $@-t $@ MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t MOSTLYCLEANDIRS += sys @@ -272,5 +279,3 @@ mostlyclean-local: mostlyclean-generic echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done - -# Makefile.am ends here diff --git a/gl/error.c b/gl/error.c index d8814e0..e6e6807 100644 --- a/gl/error.c +++ b/gl/error.c @@ -92,23 +92,19 @@ extern void __error_at_line (int status, int errnum, const char *file_name, char *strerror_r (); # endif -# ifndef SIZE_MAX -# define SIZE_MAX ((size_t) -1) -# endif - /* The calling program should define program_name and set it to the name of the executing program. */ extern char *program_name; # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r -# endif +# endif /* HAVE_STRERROR_R || defined strerror_r */ #endif /* not _LIBC */ static void print_errno_message (int errnum) { - char const *s = NULL; + char const *s; #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; @@ -117,11 +113,15 @@ print_errno_message (int errnum) # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) s = errbuf; + else + s = 0; # endif +#else + s = strerror (errnum); #endif #if !_LIBC - if (! s && ! (s = strerror (errnum))) + if (! s) s = _("Unknown system error"); #endif @@ -312,10 +312,10 @@ error_at_line (int status, int errnum, const char *file_name, #if _LIBC __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + file_name, line_number); #else fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", - file_name, line_number); + file_name, line_number); #endif va_start (args, message); diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 602298e..384153d 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -26,5 +26,6 @@ gl_M4_BASE([gl/m4]) gl_DOC_BASE([doc]) gl_TESTS_BASE([gl/tests]) gl_LIB([libgl]) +gl_MAKEFILE_NAME([]) gl_LIBTOOL gl_MACRO_PREFIX([gl]) diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index dd17dbe..e256a58 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -30,6 +30,7 @@ AC_DEFUN([gl_EARLY], AC_DEFUN([gl_INIT], [ AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) + gl_cond_libtool=true gl_FUNC_ALLOCA gl_HEADER_ARPA_INET gl_ERROR @@ -41,6 +42,10 @@ AC_DEFUN([gl_INIT], gl_FUNC_GETPASS AM_ICONV gl_ICONVME + if test $gl_cond_libtool = false; then + gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV" + gl_libdeps="$gl_libdeps $LIBICONV" + fi gl_INET_NTOP gl_HEADER_NETINET_IN gl_QUOTE diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4 index 9292919..a196556 100644 --- a/gl/m4/lib-link.m4 +++ b/gl/m4/lib-link.m4 @@ -1,4 +1,4 @@ -# lib-link.m4 serial 8 (gettext-0.15) +# lib-link.m4 serial 9 (gettext-0.15.1) dnl Copyright (C) 2001-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -198,9 +198,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], found_so= found_a= if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + if test -n "$shlibext" \ + && { test -f "$additional_libdir/lib$name.$shlibext" \ + || { test "$shlibext" = dll \ + && test -f "$additional_libdir/lib$name.dll.a"; }; }; then found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.$shlibext"; then + found_so="$additional_libdir/lib$name.$shlibext" + else + found_so="$additional_libdir/lib$name.dll.a" + fi if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi @@ -220,9 +227,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + if test -n "$shlibext" \ + && { test -f "$dir/lib$name.$shlibext" \ + || { test "$shlibext" = dll \ + && test -f "$dir/lib$name.dll.a"; }; }; then found_dir="$dir" - found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.$shlibext"; then + found_so="$dir/lib$name.$shlibext" + else + found_so="$dir/lib$name.dll.a" + fi if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c index 3b496d2..b68c1bb 100644 --- a/gl/vasnprintf.c +++ b/gl/vasnprintf.c @@ -40,7 +40,7 @@ #include /* abort(), malloc(), realloc(), free() */ #include /* memcpy(), strlen() */ #include /* errno */ -#include /* CHAR_BIT, INT_MAX */ +#include /* CHAR_BIT */ #include /* DBL_MAX_EXP, LDBL_MAX_EXP */ #if WIDE_CHAR_VERSION # include "wprintf-parse.h" @@ -51,11 +51,6 @@ /* Checked size_t computations. */ #include "xsize.h" -/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ -#ifndef EOVERFLOW -# define EOVERFLOW E2BIG -#endif - #ifdef HAVE_WCHAR_T # ifdef HAVE_WCSLEN # define local_wcslen wcslen @@ -869,19 +864,12 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar free (buf_malloced); CLEANUP (); *lengthp = length; - if (length > INT_MAX) - goto length_overflow; + /* Note that we can produce a big string of a length > INT_MAX. POSIX + says that snprintf() fails with errno = EOVERFLOW in this case, but + that's only because snprintf() returns an 'int'. This function does + not have this limitation. */ return result; - length_overflow: - /* We could produce such a big string, but its length doesn't fit into - an 'int'. POSIX says that snprintf() fails with errno = EOVERFLOW in - this case. */ - if (result != resultbuf) - free (result); - errno = EOVERFLOW; - return NULL; - out_of_memory: if (!(result == resultbuf || result == NULL)) free (result); diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am index 380ed14..25f6a44 100644 --- a/lib/gl/Makefile.am +++ b/lib/gl/Makefile.am @@ -16,6 +16,7 @@ noinst_LTLIBRARIES = libgl.la libgl_la_SOURCES = libgl_la_LIBADD = @LTLIBOBJS@ +libgl_la_LDFLAGS = $(AM_LDFLAGS) noinst_HEADERS = EXTRA_DIST = BUILT_SOURCES = @@ -36,8 +37,8 @@ EXTRA_DIST += alloca_.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. alloca.h: alloca_.h - cp $(srcdir)/alloca_.h $@-t - mv $@-t $@ + cp -f $(srcdir)/alloca_.h $@-t + mv -f $@-t $@ MOSTLYCLEANFILES += alloca.h alloca.h-t ## end gnulib module alloca-opt @@ -52,9 +53,7 @@ libgl_la_SOURCES += base64.h base64.c EXTRA_DIST += gc.h if GL_COND_LIBTOOL -libgl_la_LIBADD += $(LTLIBGCRYPT) -else -libgl_la_LIBADD += $(LIBGCRYPT) +libgl_la_LDFLAGS += $(LTLIBGCRYPT) endif ## end gnulib module gc @@ -111,6 +110,7 @@ EXTRA_DIST += stdbool_.h # We need the following in order to create when the system # doesn't have one that works. stdbool.h: stdbool_.h + rm -f $@-t $@ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h > $@-t mv $@-t $@ MOSTLYCLEANFILES += stdbool.h stdbool.h-t @@ -125,12 +125,12 @@ EXTRA_DIST += stdint_.h # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdint.h: stdint_.h + rm -f $@-t $@ sed -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ -e 's|@''ABSOLUTE_STDINT_H''@|$(ABSOLUTE_STDINT_H)|g' \ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ - -e 's|@''ABSOLUTE_INTTYPES_H''@|$(ABSOLUTE_INTTYPES_H)|g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ @@ -191,5 +191,3 @@ mostlyclean-local: mostlyclean-generic echo "rmdir $$dir"; rmdir $$dir; \ fi; \ done - -# Makefile.am ends here diff --git a/lib/gl/m4/gnulib-cache.m4 b/lib/gl/m4/gnulib-cache.m4 index daa8ea5..f805004 100644 --- a/lib/gl/m4/gnulib-cache.m4 +++ b/lib/gl/m4/gnulib-cache.m4 @@ -27,5 +27,6 @@ gl_DOC_BASE([doc]) gl_TESTS_BASE([tests]) gl_LIB([libgl]) gl_LGPL +gl_MAKEFILE_NAME([]) gl_LIBTOOL gl_MACRO_PREFIX([gl]) diff --git a/lib/gl/m4/gnulib-comp.m4 b/lib/gl/m4/gnulib-comp.m4 index 725ce38..49c2ece 100644 --- a/lib/gl/m4/gnulib-comp.m4 +++ b/lib/gl/m4/gnulib-comp.m4 @@ -31,9 +31,14 @@ AC_DEFUN([gl_EARLY], AC_DEFUN([gl_INIT], [ AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) + gl_cond_libtool=true gl_FUNC_ALLOCA gl_FUNC_BASE64 gl_GC + if test $gl_cond_libtool = false; then + gl_ltlibdeps="$gl_ltlibdeps $LTLIBGCRYPT" + gl_libdeps="$gl_libdeps $LIBGCRYPT" + fi gl_GC_HMAC_MD5 gl_GC_MD5 gl_GC_RANDOM diff --git a/lib/gl/m4/lib-link.m4 b/lib/gl/m4/lib-link.m4 index 9292919..a196556 100644 --- a/lib/gl/m4/lib-link.m4 +++ b/lib/gl/m4/lib-link.m4 @@ -1,4 +1,4 @@ -# lib-link.m4 serial 8 (gettext-0.15) +# lib-link.m4 serial 9 (gettext-0.15.1) dnl Copyright (C) 2001-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -198,9 +198,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], found_so= found_a= if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + if test -n "$shlibext" \ + && { test -f "$additional_libdir/lib$name.$shlibext" \ + || { test "$shlibext" = dll \ + && test -f "$additional_libdir/lib$name.dll.a"; }; }; then found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.$shlibext"; then + found_so="$additional_libdir/lib$name.$shlibext" + else + found_so="$additional_libdir/lib$name.dll.a" + fi if test -f "$additional_libdir/lib$name.la"; then found_la="$additional_libdir/lib$name.la" fi @@ -220,9 +227,16 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + if test -n "$shlibext" \ + && { test -f "$dir/lib$name.$shlibext" \ + || { test "$shlibext" = dll \ + && test -f "$dir/lib$name.dll.a"; }; }; then found_dir="$dir" - found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.$shlibext"; then + found_so="$dir/lib$name.$shlibext" + else + found_so="$dir/lib$name.dll.a" + fi if test -f "$dir/lib$name.la"; then found_la="$dir/lib$name.la" fi diff --git a/lib/gl/m4/stdint.m4 b/lib/gl/m4/stdint.m4 index b48fb9d..48748c6 100644 --- a/lib/gl/m4/stdint.m4 +++ b/lib/gl/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 19 +# stdint.m4 serial 18 dnl Copyright (C) 2001-2002, 2004-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,14 +32,10 @@ AC_DEFUN([gl_STDINT_H], dnl Check for . dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. if test $ac_cv_header_inttypes_h = yes; then - gl_ABSOLUTE_HEADER([inttypes.h]) - ABSOLUTE_INTTYPES_H=\"$gl_cv_absolute_inttypes_h\" HAVE_INTTYPES_H=1 else - ABSOLUTE_INTTYPES_H=\"no/such/file/inttypes.h\" HAVE_INTTYPES_H=0 fi - AC_SUBST([ABSOLUTE_INTTYPES_H]) AC_SUBST([HAVE_INTTYPES_H]) dnl Check for . diff --git a/lib/gl/stdint_.h b/lib/gl/stdint_.h index a173d4e..033bf92 100644 --- a/lib/gl/stdint_.h +++ b/lib/gl/stdint_.h @@ -62,7 +62,9 @@ /* In OpenBSD 3.8, includes , which defines int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. also defines intptr_t and uintptr_t. */ -# include @ABSOLUTE_INTTYPES_H@ +# define _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H +# include +# undef _GL_JUST_INCLUDE_ABSOLUTE_INTTYPES_H #elif @HAVE_SYS_INTTYPES_H@ /* Solaris 7 has the types except the *_fast*_t types, and the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ diff --git a/lib/gl/vasnprintf.c b/lib/gl/vasnprintf.c index c041324..23b626f 100644 --- a/lib/gl/vasnprintf.c +++ b/lib/gl/vasnprintf.c @@ -40,7 +40,7 @@ #include /* abort(), malloc(), realloc(), free() */ #include /* memcpy(), strlen() */ #include /* errno */ -#include /* CHAR_BIT, INT_MAX */ +#include /* CHAR_BIT */ #include /* DBL_MAX_EXP, LDBL_MAX_EXP */ #if WIDE_CHAR_VERSION # include "wprintf-parse.h" @@ -51,11 +51,6 @@ /* Checked size_t computations. */ #include "xsize.h" -/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ -#ifndef EOVERFLOW -# define EOVERFLOW E2BIG -#endif - #ifdef HAVE_WCHAR_T # ifdef HAVE_WCSLEN # define local_wcslen wcslen @@ -869,19 +864,12 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar free (buf_malloced); CLEANUP (); *lengthp = length; - if (length > INT_MAX) - goto length_overflow; + /* Note that we can produce a big string of a length > INT_MAX. POSIX + says that snprintf() fails with errno = EOVERFLOW in this case, but + that's only because snprintf() returns an 'int'. This function does + not have this limitation. */ return result; - length_overflow: - /* We could produce such a big string, but its length doesn't fit into - an 'int'. POSIX says that snprintf() fails with errno = EOVERFLOW in - this case. */ - if (result != resultbuf) - free (result); - errno = EOVERFLOW; - return NULL; - out_of_memory: if (!(result == resultbuf || result == NULL)) free (result); diff --git a/lib/gl/vasprintf.c b/lib/gl/vasprintf.c index 3ee1721..3c59c57 100644 --- a/lib/gl/vasprintf.c +++ b/lib/gl/vasprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -22,10 +22,17 @@ /* Specification. */ #include "vasprintf.h" +#include +#include #include #include "vasnprintf.h" +/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ +#ifndef EOVERFLOW +# define EOVERFLOW E2BIG +#endif + int vasprintf (char **resultp, const char *format, va_list args) { @@ -34,9 +41,14 @@ vasprintf (char **resultp, const char *format, va_list args) if (result == NULL) return -1; + if (length > INT_MAX) + { + free (result); + errno = EOVERFLOW; + return -1; + } + *resultp = result; - /* Return the number of resulting bytes, excluding the trailing NUL. - If it wouldn't fit in an 'int', vasnprintf() would have returned NULL - and set errno to EOVERFLOW. */ + /* Return the number of resulting bytes, excluding the trailing NUL. */ return length; } -- 2.11.4.GIT