提交 57f15f77 编写于 作者: J Jim Meyering

update from gnulib

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