1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

gnulib update

Added pipe2 and open modules, to get O_CLOEXEC.

* libguile/Makefile.am (guile_filter_doc_snarfage$(EXEEXT)): Add gnulib
  here, in the native build case, for rpl_fflush if needed.

foo
This commit is contained in:
Andy Wingo 2011-06-16 18:22:50 +02:00
parent 0b77014f0c
commit 3d458a81c6
102 changed files with 4437 additions and 1496 deletions

View file

@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0; if 0;
# Generate a release announcement message. # Generate a release announcement message.
my $VERSION = '2010-05-03 20:17'; # UTC my $VERSION = '2011-05-17 20:25'; # UTC
# The definition above must lie within the first 8 lines in order # The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it. # for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook # If you change this file with Emacs, please let the write hook
@ -106,7 +106,7 @@ sub sizes (@)
my $t = `$cmd`; my $t = `$cmd`;
# FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS # FIXME-someday: give a better diagnostic, a la $PROCESS_STATUS
$@ $@
and (warn "$ME: command failed: `$cmd'\n"), $fail = 1; and (warn "$ME: command failed: `$cmd'\n"), $fail = 1;
chomp $t; chomp $t;
$t =~ s/^([\d.]+[MkK]).*/${1}B/; $t =~ s/^([\d.]+[MkK]).*/${1}B/;
$res{$f} = $t; $res{$f} = $t;
@ -128,12 +128,12 @@ sub print_locations ($\@\%@)
foreach my $url (@{$url}) foreach my $url (@{$url})
{ {
for my $file (@file) for my $file (@file)
{ {
print " $url/$file"; print " $url/$file";
print " (", $$size{$file}, ")" print " (", $$size{$file}, ")"
if exists $$size{$file}; if exists $$size{$file};
print "\n"; print "\n";
} }
} }
print "\n"; print "\n";
} }
@ -154,17 +154,17 @@ sub print_checksums (@)
foreach my $meth (qw (md5 sha1)) foreach my $meth (qw (md5 sha1))
{ {
foreach my $f (@file) foreach my $f (@file)
{ {
open IN, '<', $f open IN, '<', $f
or die "$ME: $f: cannot open for reading: $!\n"; or die "$ME: $f: cannot open for reading: $!\n";
binmode IN; binmode IN;
my $dig = my $dig =
($meth eq 'md5' ($meth eq 'md5'
? Digest::MD5->new->addfile(*IN)->hexdigest ? Digest::MD5->new->addfile(*IN)->hexdigest
: Digest::SHA1->new->addfile(*IN)->hexdigest); : Digest::SHA1->new->addfile(*IN)->hexdigest);
close IN; close IN;
print "$dig $f\n"; print "$dig $f\n";
} }
} }
print "\n"; print "\n";
} }
@ -180,7 +180,10 @@ sub print_news_deltas ($$$)
{ {
my ($news_file, $prev_version, $curr_version) = @_; my ($news_file, $prev_version, $curr_version) = @_;
print "\n$news_file\n\n"; my $news_name = $news_file;
$news_name =~ s|^\./||;
print "\n$news_name\n\n";
# Print all lines from $news_file, starting with the first one # Print all lines from $news_file, starting with the first one
# that mentions $curr_version up to but not including # that mentions $curr_version up to but not including
@ -189,34 +192,39 @@ sub print_news_deltas ($$$)
my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/; my $re_prefix = qr/(?:\* )?(?:Noteworthy c|Major c|C)(?i:hanges)/;
my $found_news;
open NEWS, '<', $news_file open NEWS, '<', $news_file
or die "$ME: $news_file: cannot open for reading: $!\n"; or die "$ME: $news_file: cannot open for reading: $!\n";
while (defined (my $line = <NEWS>)) while (defined (my $line = <NEWS>))
{ {
if ( ! $in_items) if ( ! $in_items)
{ {
# Match lines like these: # Match lines like these:
# * Major changes in release 5.0.1: # * Major changes in release 5.0.1:
# * Noteworthy changes in release 6.6 (2006-11-22) [stable] # * Noteworthy changes in release 6.6 (2006-11-22) [stable]
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
or next; or next;
$in_items = 1; $in_items = 1;
print $line; print $line;
} }
else else
{ {
# This regexp must not match version numbers in NEWS items. # This regexp must not match version numbers in NEWS items.
# For example, they might well say `introduced in 4.5.5', # For example, they might well say `introduced in 4.5.5',
# and we don't want that to match. # and we don't want that to match.
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o $line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
and last; and last;
print $line; print $line;
} $line =~ /\S/
and $found_news = 1;
}
} }
close NEWS; close NEWS;
$in_items $in_items
or die "$ME: $news_file: no matching lines for `$curr_version'\n"; or die "$ME: $news_file: no matching lines for `$curr_version'\n";
$found_news
or die "$ME: $news_file: no news item found for `$curr_version'\n";
} }
sub print_changelog_deltas ($$) sub print_changelog_deltas ($$)
@ -229,8 +237,8 @@ sub print_changelog_deltas ($$)
use File::Find; use File::Find;
my @changelog; my @changelog;
find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS' find ({wanted => sub {$_ eq 'ChangeLog' && -d 'CVS'
and push @changelog, $File::Find::name}}, and push @changelog, $File::Find::name}},
'.'); '.');
# If there are no ChangeLog files, we're done. # If there are no ChangeLog files, we're done.
@changelog @changelog
@ -255,7 +263,7 @@ sub print_changelog_deltas ($$)
my $dot_slash = $d eq '.' ? $d : "./$d"; my $dot_slash = $d eq '.' ? $d : "./$d";
my $target = "$dot_slash/ChangeLog"; my $target = "$dot_slash/ChangeLog";
delete $changelog{$target} delete $changelog{$target}
and push @reordered, $target; and push @reordered, $target;
} }
# Append any remaining ChangeLog files. # Append any remaining ChangeLog files.
@ -282,20 +290,20 @@ sub print_changelog_deltas ($$)
while (defined (my $line = <DIFF>)) while (defined (my $line = <DIFF>))
{ {
if ($line =~ /^\+\+\+ /) if ($line =~ /^\+\+\+ /)
{ {
my $separator = "*"x70 ."\n"; my $separator = "*"x70 ."\n";
$line =~ s///; $line =~ s///;
$line =~ s/\s.*//; $line =~ s/\s.*//;
$prev_printed_line_empty $prev_printed_line_empty
or print "\n"; or print "\n";
print $separator, $line, $separator; print $separator, $line, $separator;
} }
elsif ($line =~ /^\+/) elsif ($line =~ /^\+/)
{ {
$line =~ s///; $line =~ s///;
print $line; print $line;
$prev_printed_line_empty = ($line =~ /^$/); $prev_printed_line_empty = ($line =~ /^$/);
} }
} }
close DIFF; close DIFF;
@ -316,25 +324,25 @@ sub get_tool_versions ($$)
foreach my $t (@$tool_list) foreach my $t (@$tool_list)
{ {
if ($t eq 'gnulib') if ($t eq 'gnulib')
{ {
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version; push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
next; next;
} }
# Assume that the last "word" on the first line of # Assume that the last "word" on the first line of
# `tool --version` output is the version string. # `tool --version` output is the version string.
my ($first_line, undef) = split ("\n", `$t --version`); my ($first_line, undef) = split ("\n", `$t --version`);
if ($first_line =~ /.* (\d[\w.-]+)$/) if ($first_line =~ /.* (\d[\w.-]+)$/)
{ {
$t = ucfirst $t; $t = ucfirst $t;
push @tool_version_pair, "$t $1"; push @tool_version_pair, "$t $1";
} }
else else
{ {
defined $first_line defined $first_line
and $first_line = ''; and $first_line = '';
warn "$ME: $t: unexpected --version output\n:$first_line"; warn "$ME: $t: unexpected --version output\n:$first_line";
$fail = 1; $fail = 1;
} }
} }
$fail $fail
@ -398,8 +406,8 @@ sub get_tool_versions ($$)
grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
and (warn "$ME: when specifying gnulib as a tool, you must also specify\n" and (warn "$ME: when specifying gnulib as a tool, you must also specify\n"
. "--gnulib-version=V, where V is the result of running git describe\n" . "--gnulib-version=V, where V is the result of running git describe\n"
. "in the gnulib source directory.\n"), $fail = 1; . "in the gnulib source directory.\n"), $fail = 1;
exists $valid_release_types{$release_type} exists $valid_release_types{$release_type}
or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1; or (warn "$ME: `$release_type': invalid release type\n"), $fail = 1;
@ -448,11 +456,11 @@ EOF
print_locations ("compressed sources", @url_dir_list, %size, @tarballs); print_locations ("compressed sources", @url_dir_list, %size, @tarballs);
-f $xd -f $xd
and print_locations ("xdelta diffs (useful? if so, " and print_locations ("xdelta diffs (useful? if so, "
. "please tell bug-gnulib\@gnu.org)", . "please tell bug-gnulib\@gnu.org)",
@url_dir_list, %size, $xd); @url_dir_list, %size, $xd);
my @sig_files = map { "$_.sig" } @tarballs; my @sig_files = map { "$_.sig" } @tarballs;
print_locations ("GPG detached signatures[*]", @url_dir_list, %size, print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
@sig_files); @sig_files);
if ($url_dir_list[0] =~ "gnu\.org") if ($url_dir_list[0] =~ "gnu\.org")
{ {
print "To reduce load on the main server, use a mirror listed at:\n"; print "To reduce load on the main server, use a mirror listed at:\n";

View file

@ -2,7 +2,7 @@
# List version-controlled file names. # List version-controlled file names.
# Print a version string. # Print a version string.
scriptversion=2010-04-23.22; # UTC scriptversion=2011-05-16.22; # UTC
# Copyright (C) 2006-2011 Free Software Foundation, Inc. # Copyright (C) 2006-2011 Free Software Foundation, Inc.
@ -30,7 +30,7 @@ scriptversion=2010-04-23.22; # UTC
postprocess= postprocess=
case $1 in case $1 in
--help) cat <<EOF --help) cat <<EOF
Usage: $0 [-C SRCDIR] [DIR] Usage: $0 [-C SRCDIR] [DIR...]
Output a list of version-controlled files in DIR (default .), relative to Output a list of version-controlled files in DIR (default .), relative to
SRCDIR (default .). SRCDIR must be the top directory of a checkout. SRCDIR (default .). SRCDIR must be the top directory of a checkout.
@ -61,53 +61,48 @@ EOF
shift; shift ;; shift; shift ;;
esac esac
dir= test $# = 0 && set .
case $# in
0) ;;
1) dir=$1 ;;
*) echo "$0: too many arguments" 1>&2
echo "Usage: $0 [-C srcdir] [DIR]" 1>&2; exit 1;;
esac
test "x$dir" = x && dir=. for dir
do
if test -d .git; then if test -d .git; then
test "x$dir" = x. \ test "x$dir" = x. \
&& dir= sed_esc= \ && dir= sed_esc= \
|| { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; } || { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
# Ignore git symlinks - either they point into the tree, in which case # Ignore git symlinks - either they point into the tree, in which case
# we don't need to visit the target twice, or they point somewhere # we don't need to visit the target twice, or they point somewhere
# else (often into a submodule), in which case the content does not # else (often into a submodule), in which case the content does not
# belong to this package. # belong to this package.
eval exec git ls-tree -r 'HEAD:"$dir"' \ eval exec git ls-tree -r 'HEAD:"$dir"' \
\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess \| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
elif test -d .hg; then elif test -d .hg; then
eval exec hg locate '"$dir/*"' $postprocess eval exec hg locate '"$dir/*"' $postprocess
elif test -d .bzr; then elif test -d .bzr; then
test "$postprocess" = '' && postprocess="| sed 's|^\./||'" test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
eval exec bzr ls -R --versioned '"$dir"' $postprocess eval exec bzr ls -R --versioned '"$dir"' $postprocess
elif test -d CVS; then elif test -d CVS; then
test "$postprocess" = '' && postprocess="| sed 's|^\./||'" test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
if test -x build-aux/cvsu; then if test -x build-aux/cvsu; then
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
elif (cvsu --help) >/dev/null 2>&1; then elif (cvsu --help) >/dev/null 2>&1; then
eval cvsu --find --types=AFGM '"$dir"' $postprocess eval cvsu --find --types=AFGM '"$dir"' $postprocess
else
eval awk -F/ \''{ \
if (!$1 && $3 !~ /^-/) { \
f=FILENAME; \
if (f ~ /CVS\/Entries$/) \
f = substr(f, 1, length(f)-11); \
print f $2; \
}}'\'' \
`find "$dir" -name Entries -print` /dev/null' $postprocess
fi
elif test -d .svn; then
eval exec svn list -R '"$dir"' $postprocess
else else
eval awk -F/ \''{ \ echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
if (!$1 && $3 !~ /^-/) { \ exit 1
f=FILENAME; \
if (f ~ /CVS\/Entries$/) \
f = substr(f, 1, length(f)-11); \
print f $2; \
}}'\'' \
`find "$dir" -name Entries -print` /dev/null' $postprocess
fi fi
elif test -d .svn; then done
eval exec svn list -R '"$dir"' $postprocess
else
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
exit 1
fi
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@
# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) # define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
#endif #endif
/* Determine the good alignment of a object of the given type at compile time. /* Determine the good alignment of an object of the given type at compile time.
Note that this is not necessarily the same as alignof_slot(type). Note that this is not necessarily the same as alignof_slot(type).
For example, with GNU C on x86 platforms: alignof_type(double) = 8, but For example, with GNU C on x86 platforms: alignof_type(double) = 8, but
- when -malign-double is not specified: alignof_slot(double) = 4, - when -malign-double is not specified: alignof_slot(double) = 4,

View file

@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation, along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_ARPA_INET_H #ifndef _@GUARD_PREFIX@_ARPA_INET_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -47,8 +47,8 @@
#endif #endif
#ifndef _GL_ARPA_INET_H #ifndef _@GUARD_PREFIX@_ARPA_INET_H
#define _GL_ARPA_INET_H #define _@GUARD_PREFIX@_ARPA_INET_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -111,5 +111,5 @@ _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
#endif #endif
#endif /* _GL_ARPA_INET_H */ #endif /* _@GUARD_PREFIX@_ARPA_INET_H */
#endif /* _GL_ARPA_INET_H */ #endif /* _@GUARD_PREFIX@_ARPA_INET_H */

52
lib/binary-io.h Normal file
View file

@ -0,0 +1,52 @@
/* Binary mode I/O.
Copyright (C) 2001, 2003, 2005, 2008-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
#ifndef _BINARY_H
#define _BINARY_H
/* For systems that distinguish between text and binary I/O.
O_BINARY is guaranteed by the gnulib <fcntl.h>. */
#include <fcntl.h>
/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...',
so we include it here first. */
#include <stdio.h>
/* SET_BINARY (fd);
changes the file descriptor fd to perform binary I/O. */
#if O_BINARY
# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
# include <io.h> /* declares setmode() */
# else
# define setmode _setmode
# undef fileno
# define fileno _fileno
# endif
# ifdef __DJGPP__
# include <unistd.h> /* declares isatty() */
/* Avoid putting stdin/stdout in binary mode if it is connected to
the console, because that would make it impossible for the user
to interrupt the program through Ctrl-C or Ctrl-Break. */
# define SET_BINARY(fd) ((void) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0))
# else
# define SET_BINARY(fd) ((void) setmode (fd, O_BINARY))
# endif
#else
/* On reasonable systems, binary I/O is the default. */
# define SET_BINARY(fd) /* do nothing */ ((void) 0)
#endif
#endif /* _BINARY_H */

View file

@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation, along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_ERRNO_H #ifndef _@GUARD_PREFIX@_ERRNO_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -26,8 +26,8 @@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@ #@INCLUDE_NEXT@ @NEXT_ERRNO_H@
#ifndef _GL_ERRNO_H #ifndef _@GUARD_PREFIX@_ERRNO_H
#define _GL_ERRNO_H #define _@GUARD_PREFIX@_ERRNO_H
/* On native Windows platforms, many macros are not defined. */ /* On native Windows platforms, many macros are not defined. */
@ -163,5 +163,5 @@
# endif # endif
#endif /* _GL_ERRNO_H */ #endif /* _@GUARD_PREFIX@_ERRNO_H */
#endif /* _GL_ERRNO_H */ #endif /* _@GUARD_PREFIX@_ERRNO_H */

View file

@ -22,26 +22,63 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
/* Override fclose() to call the overridden close(). */ #include "freading.h"
/* Override fclose() to call the overridden fflush() or close(). */
int int
rpl_fclose (FILE *fp) rpl_fclose (FILE *fp)
#undef fclose #undef fclose
{ {
int saved_errno = 0; int saved_errno = 0;
int fd;
int result = 0;
if (fflush (fp)) /* Don't change behavior on memstreams. */
fd = fileno (fp);
if (fd < 0)
return fclose (fp);
/* We only need to flush the file if it is not reading or if it is
seekable. This only guarantees the file position of input files
if the fflush module is also in use. */
if ((!freading (fp) || lseek (fileno (fp), 0, SEEK_CUR) != -1)
&& fflush (fp))
saved_errno = errno; saved_errno = errno;
if (close (fileno (fp)) < 0 && saved_errno == 0) /* fclose() calls close(), but we need to also invoke all hooks that our
overridden close() function invokes. See lib/close.c. */
#if WINDOWS_SOCKETS
/* Call the overridden close(), then the original fclose().
Note about multithread-safety: There is a race condition where some
other thread could open fd between our close and fclose. */
if (close (fd) < 0 && saved_errno == 0)
saved_errno = errno; saved_errno = errno;
fclose (fp); /* will fail with errno = EBADF */ fclose (fp); /* will fail with errno = EBADF, if we did not lose a race */
#else /* !WINDOWS_SOCKETS */
/* Call fclose() and invoke all hooks of the overridden close(). */
# if REPLACE_FCHDIR
/* Note about multithread-safety: There is a race condition here as well.
Some other thread could open fd between our calls to fclose and
_gl_unregister_fd. */
result = fclose (fp);
if (result == 0)
_gl_unregister_fd (fd);
# else
/* No race condition here. */
result = fclose (fp);
# endif
#endif /* !WINDOWS_SOCKETS */
if (saved_errno != 0) if (saved_errno != 0)
{ {
errno = saved_errno; errno = saved_errno;
return EOF; result = EOF;
} }
return 0;
return result;
} }

325
lib/fcntl.in.h Normal file
View file

@ -0,0 +1,325 @@
/* Like <fcntl.h>, but with non-working flags defined to 0.
Copyright (C) 2006-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
/* written by Paul Eggert */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#if defined __need_system_fcntl_h
/* Special invocation convention. */
#include <sys/types.h>
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
extern "C" { ... } block, which leads to errors in C++ mode with the
overridden <sys/stat.h> from gnulib. These errors are known to be gone
with g++ version >= 4.3. */
#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
# include <sys/stat.h>
#endif
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
#else
/* Normal invocation convention. */
#ifndef _@GUARD_PREFIX@_FCNTL_H
#include <sys/types.h>
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an
extern "C" { ... } block, which leads to errors in C++ mode with the
overridden <sys/stat.h> from gnulib. These errors are known to be gone
with g++ version >= 4.3. */
#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
# include <sys/stat.h>
#endif
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FCNTL_H@
#ifndef _@GUARD_PREFIX@_FCNTL_H
#define _@GUARD_PREFIX@_FCNTL_H
#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */
# include <unistd.h>
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Declare overridden functions. */
#if @GNULIB_FCNTL@
# if @REPLACE_FCNTL@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fcntl
# define fcntl rpl_fcntl
# endif
_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...));
_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...));
# else
# if !@HAVE_FCNTL@
_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...));
# endif
_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...));
# endif
_GL_CXXALIASWARN (fcntl);
#elif defined GNULIB_POSIXCHECK
# undef fcntl
# if HAVE_RAW_DECL_FCNTL
_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - "
"use gnulib module fcntl for portability");
# endif
#endif
#if @GNULIB_OPEN@
# if @REPLACE_OPEN@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef open
# define open rpl_open
# endif
_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
# else
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
# endif
/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a
default argument. _GL_CXXALIASWARN does not work in this case. */
# if !defined __hpux
_GL_CXXALIASWARN (open);
# endif
#elif defined GNULIB_POSIXCHECK
# undef open
/* Assume open is always declared. */
_GL_WARN_ON_USE (open, "open is not always POSIX compliant - "
"use gnulib module open for portability");
#endif
#if @GNULIB_OPENAT@
# if @REPLACE_OPENAT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef openat
# define openat rpl_openat
# endif
_GL_FUNCDECL_RPL (openat, int,
(int fd, char const *file, int flags, /* mode_t mode */ ...)
_GL_ARG_NONNULL ((2)));
_GL_CXXALIAS_RPL (openat, int,
(int fd, char const *file, int flags, /* mode_t mode */ ...));
# else
# if !@HAVE_OPENAT@
_GL_FUNCDECL_SYS (openat, int,
(int fd, char const *file, int flags, /* mode_t mode */ ...)
_GL_ARG_NONNULL ((2)));
# endif
_GL_CXXALIAS_SYS (openat, int,
(int fd, char const *file, int flags, /* mode_t mode */ ...));
# endif
_GL_CXXALIASWARN (openat);
#elif defined GNULIB_POSIXCHECK
# undef openat
# if HAVE_RAW_DECL_OPENAT
_GL_WARN_ON_USE (openat, "openat is not portable - "
"use gnulib module openat for portability");
# endif
#endif
/* Fix up the FD_* macros, only known to be missing on mingw. */
#ifndef FD_CLOEXEC
# define FD_CLOEXEC 1
#endif
/* Fix up the supported F_* macros. Intentionally leave other F_*
macros undefined. Only known to be missing on mingw. */
#ifndef F_DUPFD_CLOEXEC
# define F_DUPFD_CLOEXEC 0x40000000
/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */
# define GNULIB_defined_F_DUPFD_CLOEXEC 1
#else
# define GNULIB_defined_F_DUPFD_CLOEXEC 0
#endif
#ifndef F_DUPFD
# define F_DUPFD 1
#endif
#ifndef F_GETFD
# define F_GETFD 2
#endif
/* Fix up the O_* macros. */
#if !defined O_DIRECT && defined O_DIRECTIO
/* Tru64 spells it `O_DIRECTIO'. */
# define O_DIRECT O_DIRECTIO
#endif
#if !defined O_CLOEXEC && defined O_NOINHERIT
/* Mingw spells it `O_NOINHERIT'. */
# define O_CLOEXEC O_NOINHERIT
#endif
#ifndef O_CLOEXEC
# define O_CLOEXEC 0
#endif
#ifndef O_DIRECT
# define O_DIRECT 0
#endif
#ifndef O_DIRECTORY
# define O_DIRECTORY 0
#endif
#ifndef O_DSYNC
# define O_DSYNC 0
#endif
#ifndef O_EXEC
# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
#endif
#ifndef O_NDELAY
# define O_NDELAY 0
#endif
#ifndef O_NOATIME
# define O_NOATIME 0
#endif
#ifndef O_NONBLOCK
# define O_NONBLOCK O_NDELAY
#endif
/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero
value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY
or to 0 as fallback. */
#if @GNULIB_NONBLOCKING@
# if O_NONBLOCK
# define GNULIB_defined_O_NONBLOCK 0
# else
# define GNULIB_defined_O_NONBLOCK 1
# undef O_NONBLOCK
# define O_NONBLOCK 0x40000000
# endif
#endif
#ifndef O_NOCTTY
# define O_NOCTTY 0
#endif
#ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
#endif
#ifndef O_NOLINKS
# define O_NOLINKS 0
#endif
#ifndef O_RSYNC
# define O_RSYNC 0
#endif
#ifndef O_SEARCH
# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */
#endif
#ifndef O_SYNC
# define O_SYNC 0
#endif
#ifndef O_TTY_INIT
# define O_TTY_INIT 0
#endif
#if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
# undef O_ACCMODE
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
#endif
/* For systems that distinguish between text and binary I/O.
O_BINARY is usually declared in fcntl.h */
#if !defined O_BINARY && defined _O_BINARY
/* For MSC-compatible compilers. */
# define O_BINARY _O_BINARY
# define O_TEXT _O_TEXT
#endif
#if defined __BEOS__ || defined __HAIKU__
/* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */
# undef O_BINARY
# undef O_TEXT
#endif
#ifndef O_BINARY
# define O_BINARY 0
# define O_TEXT 0
#endif
/* Fix up the AT_* macros. */
/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
value exceeds INT_MAX, so its use as an int doesn't conform to the
C standard, and GCC and Sun C complain in some cases. If the bug
is present, undef AT_FDCWD here, so it can be redefined below. */
#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
# undef AT_FDCWD
#endif
/* Use the same bit pattern as Solaris 9, but with the proper
signedness. The bit pattern is important, in case this actually is
Solaris with the above workaround. */
#ifndef AT_FDCWD
# define AT_FDCWD (-3041965)
#endif
/* Use the same values as Solaris 9. This shouldn't matter, but
there's no real reason to differ. */
#ifndef AT_SYMLINK_NOFOLLOW
# define AT_SYMLINK_NOFOLLOW 4096
#endif
#ifndef AT_REMOVEDIR
# define AT_REMOVEDIR 1
#endif
/* Solaris 9 lacks these two, so just pick unique values. */
#ifndef AT_SYMLINK_FOLLOW
# define AT_SYMLINK_FOLLOW 2
#endif
#ifndef AT_EACCESS
# define AT_EACCESS 4
#endif
#endif /* _@GUARD_PREFIX@_FCNTL_H */
#endif /* _@GUARD_PREFIX@_FCNTL_H */
#endif

218
lib/fflush.c Normal file
View file

@ -0,0 +1,218 @@
/* fflush.c -- allow flushing input streams
Copyright (C) 2007-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */
#include <config.h>
/* Specification. */
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include "freading.h"
#include "stdio-impl.h"
#undef fflush
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
static inline void
clear_ungetc_buffer_preserving_position (FILE *fp)
{
if (fp->_flags & _IO_IN_BACKUP)
/* _IO_free_backup_area is a bit complicated. Simply call fseek. */
fseeko (fp, 0, SEEK_CUR);
}
#else
/* Clear the stream's ungetc buffer. May modify the value of ftello (fp). */
static inline void
clear_ungetc_buffer (FILE *fp)
{
# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
if (HASUB (fp))
{
fp_->_p += fp_->_r;
fp_->_r = 0;
}
# elif defined __EMX__ /* emx+gcc */
if (fp->_ungetc_count > 0)
{
fp->_ungetc_count = 0;
fp->_rcount = - fp->_rcount;
}
# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
/* Nothing to do. */
# else /* other implementations */
fseeko (fp, 0, SEEK_CUR);
# endif
}
#endif
#if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
static inline int
disable_seek_optimization (FILE *fp)
{
int saved_flags = fp_->_flags & (__SOPT | __SNPT);
fp_->_flags = (fp_->_flags & ~__SOPT) | __SNPT;
return saved_flags;
}
static inline void
restore_seek_optimization (FILE *fp, int saved_flags)
{
fp_->_flags = (fp_->_flags & ~(__SOPT | __SNPT)) | saved_flags;
}
#endif
static inline void
update_fpos_cache (FILE *fp, off_t pos)
{
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __CYGWIN__
/* fp_->_offset is typed as an integer. */
fp_->_offset = pos;
# else
/* fp_->_offset is an fpos_t. */
/* Use a union, since on NetBSD, the compilation flags determine
whether fpos_t is typedef'd to off_t or a struct containing a
single off_t member. */
union
{
fpos_t f;
off_t o;
} u;
u.o = pos;
fp_->_offset = u.f;
# endif
fp_->_flags |= __SOFF;
#endif
}
/* Flush all pending data on STREAM according to POSIX rules. Both
output and seekable input streams are supported. */
int
rpl_fflush (FILE *stream)
{
/* When stream is NULL, POSIX and C99 only require flushing of "output
streams and update streams in which the most recent operation was not
input", and all implementations do this.
When stream is "an output stream or an update stream in which the most
recent operation was not input", POSIX and C99 requires that fflush
writes out any buffered data, and all implementations do this.
When stream is, however, an input stream or an update stream in
which the most recent operation was input, C99 specifies nothing,
and POSIX only specifies behavior if the stream is seekable.
mingw, in particular, drops the input buffer, leaving the file
descriptor positioned at the end of the input buffer. I.e. ftell
(stream) is lost. We don't want to call the implementation's
fflush in this case.
We test ! freading (stream) here, rather than fwriting (stream), because
what we need to know is whether the stream holds a "read buffer", and on
mingw this is indicated by _IOREAD, regardless of _IOWRT. */
if (stream == NULL || ! freading (stream))
return fflush (stream);
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
clear_ungetc_buffer_preserving_position (stream);
return fflush (stream);
#else
{
/* Notes about the file-position indicator:
1) The file position indicator is incremented by fgetc() and decremented
by ungetc():
<http://www.opengroup.org/susv3/functions/fgetc.html>
"... the fgetc() function shall ... advance the associated file
position indicator for the stream ..."
<http://www.opengroup.org/susv3/functions/ungetc.html>
"The file-position indicator is decremented by each successful
call to ungetc()..."
2) <http://www.opengroup.org/susv3/functions/ungetc.html> says:
"The value of the file-position indicator for the stream after
reading or discarding all pushed-back bytes shall be the same
as it was before the bytes were pushed back."
Here we are discarding all pushed-back bytes. But more specifically,
3) <http://www.opengroup.org/austin/aardvark/latest/xshbug3.txt> says:
"[After fflush(),] the file offset of the underlying open file
description shall be set to the file position of the stream, and
any characters pushed back onto the stream by ungetc() ... shall
be discarded." */
/* POSIX does not specify fflush behavior for non-seekable input
streams. Some implementations purge unread data, some return
EBADF, some do nothing. */
off_t pos = ftello (stream);
if (pos == -1)
{
errno = EBADF;
return EOF;
}
/* Clear the ungetc buffer. */
clear_ungetc_buffer (stream);
/* To get here, we must be flushing a seekable input stream, so the
semantics of fpurge are now appropriate to clear the buffer. To
avoid losing data, the lseek is also necessary. */
{
int result = fpurge (stream);
if (result != 0)
return result;
}
# if (defined __sferror || defined __DragonFly__) && defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
{
/* Disable seek optimization for the next fseeko call. This tells the
following fseeko call to seek to the desired position directly, rather
than to seek to a block-aligned boundary. */
int saved_flags = disable_seek_optimization (stream);
int result = fseeko (stream, pos, SEEK_SET);
restore_seek_optimization (stream, saved_flags);
return result;
}
# else
pos = lseek (fileno (stream), pos, SEEK_SET);
if (pos == -1)
return EOF;
/* After a successful lseek, update the file descriptor's position cache
in the stream. */
update_fpos_cache (stream, pos);
return 0;
# endif
}
#endif
}

View file

@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_FLOAT_H #ifndef _@GUARD_PREFIX@_FLOAT_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -25,8 +25,8 @@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_FLOAT_H@ #@INCLUDE_NEXT@ @NEXT_FLOAT_H@
#ifndef _GL_FLOAT_H #ifndef _@GUARD_PREFIX@_FLOAT_H
#define _GL_FLOAT_H #define _@GUARD_PREFIX@_FLOAT_H
/* 'long double' properties. */ /* 'long double' properties. */
#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__) #if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
@ -59,5 +59,5 @@
# define LDBL_MAX_10_EXP 4932 # define LDBL_MAX_10_EXP 4932
#endif #endif
#endif /* _GL_FLOAT_H */ #endif /* _@GUARD_PREFIX@_FLOAT_H */
#endif /* _GL_FLOAT_H */ #endif /* _@GUARD_PREFIX@_FLOAT_H */

137
lib/fpurge.c Normal file
View file

@ -0,0 +1,137 @@
/* Flushing buffers of a FILE stream.
Copyright (C) 2007-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <stdio.h>
#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */
# include <stdio_ext.h>
#endif
#include <stdlib.h>
#include "stdio-impl.h"
int
fpurge (FILE *fp)
{
#if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */
__fpurge (fp);
/* The __fpurge function does not have a return value. */
return 0;
#elif HAVE_FPURGE /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin 1.7 */
/* Call the system's fpurge function. */
# undef fpurge
# if !HAVE_DECL_FPURGE
extern int fpurge (FILE *);
# endif
int result = fpurge (fp);
# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
if (result == 0)
/* Correct the invariants that fpurge broke.
<stdio.h> on BSD systems says:
"The following always hold: if _flags & __SRD, _w is 0."
If this invariant is not fulfilled and the stream is read-write but
currently reading, subsequent putc or fputc calls will write directly
into the buffer, although they shouldn't be allowed to. */
if ((fp_->_flags & __SRD) != 0)
fp_->_w = 0;
# endif
return result;
#else
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_IO_read_end = fp->_IO_read_ptr;
fp->_IO_write_ptr = fp->_IO_write_base;
/* Avoid memory leak when there is an active ungetc buffer. */
if (fp->_IO_save_base != NULL)
{
free (fp->_IO_save_base);
fp->_IO_save_base = NULL;
}
return 0;
# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
fp_->_p = fp_->_bf._base;
fp_->_r = 0;
fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
? fp_->_bf._size
: 0);
/* Avoid memory leak when there is an active ungetc buffer. */
if (fp_ub._base != NULL)
{
if (fp_ub._base != fp_->_ubuf)
free (fp_ub._base);
fp_ub._base = NULL;
}
return 0;
# elif defined __EMX__ /* emx+gcc */
fp->_ptr = fp->_buffer;
fp->_rcount = 0;
fp->_wcount = 0;
fp->_ungetc_count = 0;
return 0;
# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
fp->_ptr = fp->_base;
if (fp->_ptr != NULL)
fp->_cnt = 0;
return 0;
# elif defined __UCLIBC__ /* uClibc */
# ifdef __STDIO_BUFFERS
if (fp->__modeflags & __FLAG_WRITING)
fp->__bufpos = fp->__bufstart;
else if (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING))
fp->__bufpos = fp->__bufread;
# endif
return 0;
# elif defined __QNX__ /* QNX */
fp->_Rback = fp->_Back + sizeof (fp->_Back);
fp->_Rsave = NULL;
if (fp->_Mode & 0x2000 /* _MWRITE */)
/* fp->_Buf <= fp->_Next <= fp->_Wend */
fp->_Next = fp->_Buf;
else
/* fp->_Buf <= fp->_Next <= fp->_Rend */
fp->_Rend = fp->_Next;
return 0;
# elif defined __MINT__ /* Atari FreeMiNT */
if (fp->__pushed_back)
{
fp->__bufp = fp->__pushback_bufp;
fp->__pushed_back = 0;
}
/* Preserve the current file position. */
if (fp->__target != -1)
fp->__target += fp->__bufp - fp->__buffer;
fp->__bufp = fp->__buffer;
/* Nothing in the buffer, next getc is nontrivial. */
fp->__get_limit = fp->__bufp;
/* Nothing in the buffer, next putc is nontrivial. */
fp->__put_limit = fp->__buffer;
return 0;
# else
# error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib."
# endif
#endif
}

68
lib/freading.c Normal file
View file

@ -0,0 +1,68 @@
/* Retrieve information about a FILE stream.
Copyright (C) 2007-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include "freading.h"
#include "stdio-impl.h"
/* Don't use glibc's __freading function in glibc < 2.7, see
<http://sourceware.org/bugzilla/show_bug.cgi?id=4359> */
#if !(HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)))
bool
freading (FILE *fp)
{
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
return ((fp->_flags & _IO_NO_WRITES) != 0
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
&& fp->_IO_read_base != NULL));
# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
return (fp_->_flags & __SRD) != 0;
# elif defined __EMX__ /* emx+gcc */
return (fp->_flags & _IOREAD) != 0;
# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
# if defined __sun /* Solaris */
return (fp->_flag & _IOREAD) != 0 && (fp->_flag & _IOWRT) == 0;
# else
return (fp->_flag & _IOREAD) != 0;
# endif
# elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
# elif defined __QNX__ /* QNX */
return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
|| (fp->_Mode & 0x1000 /* _MREAD */) != 0);
# elif defined __MINT__ /* Atari FreeMiNT */
if (!fp->__mode.__write)
return 1;
if (!fp->__mode.__read)
return 0;
# ifdef _IO_CURRENTLY_GETTING /* Flag added on 2009-02-28 */
return (fp->__flags & _IO_CURRENTLY_GETTING) != 0;
# else
return (fp->__buffer < fp->__get_limit /*|| fp->__bufp == fp->__put_limit ??*/);
# endif
# else
# error "Please port gnulib freading.c to your platform!"
# endif
}
#endif

53
lib/freading.h Normal file
View file

@ -0,0 +1,53 @@
/* Retrieve information about a FILE stream.
Copyright (C) 2007-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
#include <stdbool.h>
#include <stdio.h>
/* Return true if the stream STREAM is opened read-only, or if the
last operation on the stream was a read operation. Return false if
the stream is opened write-only or append-only, or if it supports
writing and there is no current read operation (such as fgetc).
freading and fwriting will never both be true. If STREAM supports
both reads and writes, then:
- both freading and fwriting might be false when the stream is first
opened, after read encounters EOF, or after fflush,
- freading might be false or true and fwriting might be false
after repositioning (such as fseek, fsetpos, or rewind),
depending on the underlying implementation.
STREAM must not be wide-character oriented. */
#if HAVE___FREADING && (!defined __GLIBC__ || defined __UCLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
/* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7 */
# include <stdio_ext.h>
# define freading(stream) (__freading (stream) != 0)
#else
# ifdef __cplusplus
extern "C" {
# endif
extern bool freading (FILE *stream);
# ifdef __cplusplus
}
# endif
#endif

30
lib/fseek.c Normal file
View file

@ -0,0 +1,30 @@
/* An fseek() function that, together with fflush(), is POSIX compliant.
Copyright (C) 2007, 2009-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <stdio.h>
/* Get off_t. */
#include <unistd.h>
int
fseek (FILE *fp, long offset, int whence)
{
/* Use the replacement fseeko function with all its workarounds. */
return fseeko (fp, (off_t)offset, whence);
}

146
lib/fseeko.c Normal file
View file

@ -0,0 +1,146 @@
/* An fseeko() function that, together with fflush(), is POSIX compliant.
Copyright (C) 2007-2011 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
the Free Software Foundation; either version 2, 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 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. */
#include <config.h>
/* Specification. */
#include <stdio.h>
/* Get off_t and lseek. */
#include <unistd.h>
#include "stdio-impl.h"
int
fseeko (FILE *fp, off_t offset, int whence)
#undef fseeko
#if !HAVE_FSEEKO
# undef fseek
# define fseeko fseek
#endif
{
#if LSEEK_PIPE_BROKEN
/* mingw gives bogus answers rather than failure on non-seekable files. */
if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
return EOF;
#endif
/* These tests are based on fpurge.c. */
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
if (fp->_IO_read_end == fp->_IO_read_ptr
&& fp->_IO_write_ptr == fp->_IO_write_base
&& fp->_IO_save_base == NULL)
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __SL64 && defined __SCLE /* Cygwin */
if ((fp->_flags & __SL64) == 0)
{
/* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
mode; but has an fseeko that requires 64-bit mode. */
FILE *tmp = fopen ("/dev/null", "r");
if (!tmp)
return -1;
fp->_flags |= __SL64;
fp->_seek64 = tmp->_seek64;
fclose (tmp);
}
# endif
if (fp_->_p == fp_->_bf._base
&& fp_->_r == 0
&& fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
? fp_->_bf._size
: 0)
&& fp_ub._base == NULL)
#elif defined __EMX__ /* emx+gcc */
if (fp->_ptr == fp->_buffer
&& fp->_rcount == 0
&& fp->_wcount == 0
&& fp->_ungetc_count == 0)
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
if (fp_->_ptr == fp_->_base
&& (fp_->_ptr == NULL || fp_->_cnt == 0))
#elif defined __UCLIBC__ /* uClibc */
if (((fp->__modeflags & __FLAG_WRITING) == 0
|| fp->__bufpos == fp->__bufstart)
&& ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
|| fp->__bufpos == fp->__bufread))
#elif defined __QNX__ /* QNX */
if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
&& fp->_Rback == fp->_Back + sizeof (fp->_Back)
&& fp->_Rsave == NULL)
#elif defined __MINT__ /* Atari FreeMiNT */
if (fp->__bufp == fp->__buffer
&& fp->__get_limit == fp->__bufp
&& fp->__put_limit == fp->__bufp
&& !fp->__pushed_back)
#else
#error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
#endif
{
/* We get here when an fflush() call immediately preceded this one. We
know there are no buffers.
POSIX requires us to modify the file descriptor's position.
But we cannot position beyond end of file here. */
off_t pos =
lseek (fileno (fp),
whence == SEEK_END && offset > 0 ? 0 : offset,
whence);
if (pos == -1)
{
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
fp_->_flags &= ~__SOFF;
#endif
return -1;
}
#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags &= ~_IO_EOF_SEEN;
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __CYGWIN__
/* fp_->_offset is typed as an integer. */
fp_->_offset = pos;
# else
/* fp_->_offset is an fpos_t. */
{
/* Use a union, since on NetBSD, the compilation flags
determine whether fpos_t is typedef'd to off_t or a struct
containing a single off_t member. */
union
{
fpos_t f;
off_t o;
} u;
u.o = pos;
fp_->_offset = u.f;
}
# endif
fp_->_flags |= __SOFF;
fp_->_flags &= ~__SEOF;
#elif defined __EMX__ /* emx+gcc */
fp->_flags &= ~_IOEOF;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
fp->_flag &= ~_IOEOF;
#elif defined __MINT__ /* Atari FreeMiNT */
fp->__offset = pos;
fp->__eof = 0;
#endif
/* If we were not requested to position beyond end of file, we're
done. */
if (!(whence == SEEK_END && offset > 0))
return 0;
}
return fseeko (fp, offset, whence);
}

38
lib/ftell.c Normal file
View file

@ -0,0 +1,38 @@
/* An ftell() function that works around platform bugs.
Copyright (C) 2007-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <stdio.h>
#include <errno.h>
/* Get off_t. */
#include <unistd.h>
long
ftell (FILE *fp)
{
/* Use the replacement ftello function with all its workarounds. */
off_t offset = ftello (fp);
if (offset == (long)offset)
return (long)offset;
else
{
errno = EOVERFLOW;
return -1;
}
}

77
lib/ftello.c Normal file
View file

@ -0,0 +1,77 @@
/* An ftello() function that works around platform bugs.
Copyright (C) 2007, 2009-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#include <stdio.h>
/* Get lseek. */
#include <unistd.h>
#include "stdio-impl.h"
off_t
ftello (FILE *fp)
#undef ftello
#if !HAVE_FTELLO
# undef ftell
# define ftello ftell
#endif
{
#if LSEEK_PIPE_BROKEN
/* mingw gives bogus answers rather than failure on non-seekable files. */
if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
return -1;
#endif
#if FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE /* Solaris */
/* The Solaris stdio leaves the _IOREAD flag set after reading from a file
reaches EOF and the program then starts writing to the file. ftello
gets confused by this. */
if (fp_->_flag & _IOWRT)
{
off_t pos;
/* Call ftello nevertheless, for the side effects that it does on fp. */
ftello (fp);
/* Compute the file position ourselves. */
pos = lseek (fileno (fp), (off_t) 0, SEEK_CUR);
if (pos >= 0)
{
if ((fp_->_flag & _IONBF) == 0 && fp_->_base != NULL)
pos += fp_->_ptr - fp_->_base;
}
return pos;
}
#endif
#if defined __SL64 && defined __SCLE /* Cygwin */
if ((fp->_flags & __SL64) == 0)
{
/* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
mode; but has an ftello that requires 64-bit mode. */
FILE *tmp = fopen ("/dev/null", "r");
if (!tmp)
return -1;
fp->_flags |= __SL64;
fp->_seek64 = tmp->_seek64;
fclose (tmp);
}
#endif
return ftello (fp);
}

View file

@ -32,6 +32,22 @@
# define N_(String) String # define N_(String) String
#endif #endif
#if HAVE_DECL_GAI_STRERROR
# include <sys/socket.h>
# undef gai_strerror
# if HAVE_DECL_GAI_STRERRORA
# define gai_strerror gai_strerrorA
# endif
const char *
rpl_gai_strerror (int code)
{
return gai_strerror (code);
}
#else /* !HAVE_DECL_GAI_STRERROR */
static struct static struct
{ {
int code; int code;
@ -71,6 +87,7 @@ gai_strerror (int code)
return _("Unknown error"); return _("Unknown error");
} }
#ifdef _LIBC # ifdef _LIBC
libc_hidden_def (gai_strerror) libc_hidden_def (gai_strerror)
#endif # endif
#endif /* !HAVE_DECL_GAI_STRERROR */

View file

@ -46,7 +46,8 @@ rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
int milliseconds_len = sizeof (int); int milliseconds_len = sizeof (int);
struct timeval tv; struct timeval tv;
size_t n; size_t n;
r = getsockopt (sock, level, optname, &milliseconds, &milliseconds_len); r = getsockopt (sock, level, optname, (char *) &milliseconds,
&milliseconds_len);
tv.tv_sec = milliseconds / 1000; tv.tv_sec = milliseconds / 1000;
tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000; tv.tv_usec = (milliseconds - 1000 * tv.tv_sec) * 1000;
n = sizeof (struct timeval); n = sizeof (struct timeval);

View file

@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation, along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_ICONV_H #ifndef _@GUARD_PREFIX@_ICONV_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -26,8 +26,8 @@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_ICONV_H@ #@INCLUDE_NEXT@ @NEXT_ICONV_H@
#ifndef _GL_ICONV_H #ifndef _@GUARD_PREFIX@_ICONV_H
#define _GL_ICONV_H #define _@GUARD_PREFIX@_ICONV_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -107,5 +107,5 @@ _GL_CXXALIASWARN (iconv_close);
#endif #endif
#endif /* _GL_ICONV_H */ #endif /* _@GUARD_PREFIX@_ICONV_H */
#endif /* _GL_ICONV_H */ #endif /* _@GUARD_PREFIX@_ICONV_H */

View file

@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_LOCALE_H #ifndef _@GUARD_PREFIX@_LOCALE_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -24,8 +24,8 @@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_LOCALE_H@ #@INCLUDE_NEXT@ @NEXT_LOCALE_H@
#ifndef _GL_LOCALE_H #ifndef _@GUARD_PREFIX@_LOCALE_H
#define _GL_LOCALE_H #define _@GUARD_PREFIX@_LOCALE_H
/* NetBSD 5.0 mis-defines NULL. */ /* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h> #include <stddef.h>
@ -92,5 +92,5 @@ _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
# endif # endif
#endif #endif
#endif /* _GL_LOCALE_H */ #endif /* _@GUARD_PREFIX@_LOCALE_H */
#endif /* _GL_LOCALE_H */ #endif /* _@GUARD_PREFIX@_LOCALE_H */

62
lib/lseek.c Normal file
View file

@ -0,0 +1,62 @@
/* An lseek() function that detects pipes.
Copyright (C) 2007, 2009-2011 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
the Free Software Foundation; either version 2, 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 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. */
#include <config.h>
/* Specification. */
#include <unistd.h>
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Windows platforms. */
/* Get GetFileType. */
# include <windows.h>
#else
# include <sys/stat.h>
#endif
#include <errno.h>
#undef lseek
off_t
rpl_lseek (int fd, off_t offset, int whence)
{
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */
HANDLE h = (HANDLE) _get_osfhandle (fd);
if (h == INVALID_HANDLE_VALUE)
{
errno = EBADF;
return -1;
}
if (GetFileType (h) != FILE_TYPE_DISK)
{
errno = ESPIPE;
return -1;
}
#else
/* BeOS lseek mistakenly succeeds on pipes... */
struct stat statbuf;
if (fstat (fd, &statbuf) < 0)
return -1;
if (!S_ISREG (statbuf.st_mode))
{
errno = ESPIPE;
return -1;
}
#endif
return lseek (fd, offset, whence);
}

View file

@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_MATH_H #ifndef _@GUARD_PREFIX@_MATH_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -25,8 +25,8 @@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@ #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
#ifndef _GL_MATH_H #ifndef _@GUARD_PREFIX@_MATH_H
#define _GL_MATH_H #define _@GUARD_PREFIX@_MATH_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -806,5 +806,5 @@ _GL_WARN_REAL_FLOATING_DECL (signbit);
#endif #endif
#endif /* _GL_MATH_H */ #endif /* _@GUARD_PREFIX@_MATH_H */
#endif /* _GL_MATH_H */ #endif /* _@GUARD_PREFIX@_MATH_H */

View file

@ -20,7 +20,7 @@
It is intended to provide definitions and prototypes needed by an It is intended to provide definitions and prototypes needed by an
application. */ application. */
#ifndef _GL_NETDB_H #ifndef _@GUARD_PREFIX@_NETDB_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -34,13 +34,15 @@
#endif #endif
#ifndef _GL_NETDB_H #ifndef _@GUARD_PREFIX@_NETDB_H
#define _GL_NETDB_H #define _@GUARD_PREFIX@_NETDB_H
/* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and /* Get <netdb.h> definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and
'struct hostent' on MinGW. */ 'struct hostent' on MinGW. */
#include <sys/socket.h> #include <sys/socket.h>
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */
@ -52,6 +54,10 @@
# if !@HAVE_STRUCT_ADDRINFO@ # if !@HAVE_STRUCT_ADDRINFO@
# ifdef __cplusplus
extern "C" {
# endif
# if !GNULIB_defined_struct_addrinfo # if !GNULIB_defined_struct_addrinfo
/* Structure to contain information about address of a service provider. */ /* Structure to contain information about address of a service provider. */
struct addrinfo struct addrinfo
@ -67,6 +73,11 @@ struct addrinfo
}; };
# define GNULIB_defined_struct_addrinfo 1 # define GNULIB_defined_struct_addrinfo 1
# endif # endif
# ifdef __cplusplus
}
# endif
# endif # endif
/* Possible values for `ai_flags' field in `addrinfo' structure. */ /* Possible values for `ai_flags' field in `addrinfo' structure. */
@ -153,37 +164,67 @@ struct addrinfo
socket addresses. socket addresses.
For more details, see the POSIX:2001 specification For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
extern int getaddrinfo (const char *restrict nodename, _GL_FUNCDECL_SYS (getaddrinfo, int,
const char *restrict servname, (const char *restrict nodename,
const struct addrinfo *restrict hints, const char *restrict servname,
struct addrinfo **restrict res) const struct addrinfo *restrict hints,
_GL_ARG_NONNULL ((4)); struct addrinfo **restrict res)
_GL_ARG_NONNULL ((4)));
# endif # endif
_GL_CXXALIAS_SYS (getaddrinfo, int,
(const char *restrict nodename,
const char *restrict servname,
const struct addrinfo *restrict hints,
struct addrinfo **restrict res));
_GL_CXXALIASWARN (getaddrinfo);
# if !@HAVE_DECL_FREEADDRINFO@ # if !@HAVE_DECL_FREEADDRINFO@
/* Free `addrinfo' structure AI including associated storage. /* Free `addrinfo' structure AI including associated storage.
For more details, see the POSIX:2001 specification For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */ <http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1)); _GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
_GL_ARG_NONNULL ((1)));
# endif # endif
_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
_GL_CXXALIASWARN (freeaddrinfo);
# if !@HAVE_DECL_GAI_STRERROR@ # if @REPLACE_GAI_STRERROR@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gai_strerror
# define gai_strerror rpl_gai_strerror
# endif
_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode));
_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode));
# else
# if !@HAVE_DECL_GAI_STRERROR@
/* Convert error return from getaddrinfo() to a string. /* Convert error return from getaddrinfo() to a string.
For more details, see the POSIX:2001 specification For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/gai_strerror.html>. */ <http://www.opengroup.org/susv3xsh/gai_strerror.html>. */
extern const char *gai_strerror (int ecode); _GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode));
# endif
_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode));
# endif # endif
_GL_CXXALIASWARN (gai_strerror);
# if !@HAVE_DECL_GETNAMEINFO@ # if !@HAVE_DECL_GETNAMEINFO@
/* Convert socket address to printable node and service names. /* Convert socket address to printable node and service names.
For more details, see the POSIX:2001 specification For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/getnameinfo.html>. */ <http://www.opengroup.org/susv3xsh/getnameinfo.html>. */
extern int getnameinfo (const struct sockaddr *restrict sa, socklen_t salen, _GL_FUNCDECL_SYS (getnameinfo, int,
(const struct sockaddr *restrict sa, socklen_t salen,
char *restrict node, socklen_t nodelen,
char *restrict service, socklen_t servicelen,
int flags)
_GL_ARG_NONNULL ((1)));
# endif
/* Need to cast, because on glibc systems, the seventh parameter is
unsigned int flags. */
_GL_CXXALIAS_SYS_CAST (getnameinfo, int,
(const struct sockaddr *restrict sa, socklen_t salen,
char *restrict node, socklen_t nodelen, char *restrict node, socklen_t nodelen,
char *restrict service, socklen_t servicelen, char *restrict service, socklen_t servicelen,
int flags) int flags));
_GL_ARG_NONNULL ((1)); _GL_CXXALIASWARN (getnameinfo);
# endif
/* Possible flags for getnameinfo. */ /* Possible flags for getnameinfo. */
# ifndef NI_NUMERICHOST # ifndef NI_NUMERICHOST
@ -221,5 +262,5 @@ _GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
#endif #endif
#endif /* _GL_NETDB_H */ #endif /* _@GUARD_PREFIX@_NETDB_H */
#endif /* _GL_NETDB_H */ #endif /* _@GUARD_PREFIX@_NETDB_H */

View file

@ -15,7 +15,7 @@
along with this program; if not, write to the Free Software Foundation, along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_NETINET_IN_H #ifndef _@GUARD_PREFIX@_NETINET_IN_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -33,8 +33,8 @@
#endif #endif
#ifndef _GL_NETINET_IN_H #ifndef _@GUARD_PREFIX@_NETINET_IN_H
#define _GL_NETINET_IN_H #define _@GUARD_PREFIX@_NETINET_IN_H
#if !@HAVE_NETINET_IN_H@ #if !@HAVE_NETINET_IN_H@
@ -44,5 +44,5 @@
#endif #endif
#endif /* _GL_NETINET_IN_H */ #endif /* _@GUARD_PREFIX@_NETINET_IN_H */
#endif /* _GL_NETINET_IN_H */ #endif /* _@GUARD_PREFIX@_NETINET_IN_H */

176
lib/open.c Normal file
View file

@ -0,0 +1,176 @@
/* Open a descriptor to a file.
Copyright (C) 2007-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#include <config.h>
/* Get the original definition of open. It might be defined as a macro. */
#define __need_system_fcntl_h
#include <fcntl.h>
#undef __need_system_fcntl_h
#include <sys/types.h>
static inline int
orig_open (const char *filename, int flags, mode_t mode)
{
return open (filename, flags, mode);
}
/* Specification. */
#include <fcntl.h>
#include <errno.h>
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#ifndef REPLACE_OPEN_DIRECTORY
# define REPLACE_OPEN_DIRECTORY 0
#endif
int
open (const char *filename, int flags, ...)
{
mode_t mode;
int fd;
mode = 0;
if (flags & O_CREAT)
{
va_list arg;
va_start (arg, flags);
/* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4
creates crashing code when 'mode_t' is smaller than 'int'. */
mode = va_arg (arg, PROMOTED_MODE_T);
va_end (arg);
}
#if GNULIB_defined_O_NONBLOCK
/* The only known platform that lacks O_NONBLOCK is mingw, but it
also lacks named pipes and Unix sockets, which are the only two
file types that require non-blocking handling in open().
Therefore, it is safe to ignore O_NONBLOCK here. It is handy
that mingw also lacks openat(), so that is also covered here. */
flags &= ~O_NONBLOCK;
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
if (strcmp (filename, "/dev/null") == 0)
filename = "NUL";
#endif
#if OPEN_TRAILING_SLASH_BUG
/* If the filename ends in a slash and one of O_CREAT, O_WRONLY, O_RDWR
is specified, then fail.
Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
says that
"A pathname that contains at least one non-slash character and that
ends with one or more trailing slashes shall be resolved as if a
single dot character ( '.' ) were appended to the pathname."
and
"The special filename dot shall refer to the directory specified by
its predecessor."
If the named file already exists as a directory, then
- if O_CREAT is specified, open() must fail because of the semantics
of O_CREAT,
- if O_WRONLY or O_RDWR is specified, open() must fail because POSIX
<http://www.opengroup.org/susv3/functions/open.html> says that it
fails with errno = EISDIR in this case.
If the named file does not exist or does not name a directory, then
- if O_CREAT is specified, open() must fail since open() cannot create
directories,
- if O_WRONLY or O_RDWR is specified, open() must fail because the
file does not contain a '.' directory. */
if (flags & (O_CREAT | O_WRONLY | O_RDWR))
{
size_t len = strlen (filename);
if (len > 0 && filename[len - 1] == '/')
{
errno = EISDIR;
return -1;
}
}
#endif
fd = orig_open (filename, flags, mode);
#if REPLACE_FCHDIR
/* Implementing fchdir and fdopendir requires the ability to open a
directory file descriptor. If open doesn't support that (as on
mingw), we use a dummy file that behaves the same as directories
on Linux (ie. always reports EOF on attempts to read()), and
override fstat() in fchdir.c to hide the fact that we have a
dummy. */
if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES
&& ((flags & O_ACCMODE) == O_RDONLY
|| (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH)))
{
struct stat statbuf;
if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
{
/* Maximum recursion depth of 1. */
fd = open ("/dev/null", flags, mode);
if (0 <= fd)
fd = _gl_register_fd (fd, filename);
}
else
errno = EACCES;
}
#endif
#if OPEN_TRAILING_SLASH_BUG
/* If the filename ends in a slash and fd does not refer to a directory,
then fail.
Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html>
says that
"A pathname that contains at least one non-slash character and that
ends with one or more trailing slashes shall be resolved as if a
single dot character ( '.' ) were appended to the pathname."
and
"The special filename dot shall refer to the directory specified by
its predecessor."
If the named file without the slash is not a directory, open() must fail
with ENOTDIR. */
if (fd >= 0)
{
/* We know len is positive, since open did not fail with ENOENT. */
size_t len = strlen (filename);
if (filename[len - 1] == '/')
{
struct stat statbuf;
if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
{
close (fd);
errno = ENOTDIR;
return -1;
}
}
}
#endif
#if REPLACE_FCHDIR
if (!REPLACE_OPEN_DIRECTORY && 0 <= fd)
fd = _gl_register_fd (fd, filename);
#endif
return fd;
}

151
lib/pipe2.c Normal file
View file

@ -0,0 +1,151 @@
/* Create a pipe, with specific opening flags.
Copyright (C) 2009-2011 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
the Free Software Foundation; either version 2, 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 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. */
#include <config.h>
/* Specification. */
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include "binary-io.h"
#include "verify.h"
#if GNULIB_defined_O_NONBLOCK
# include "nonblocking.h"
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Native Woe32 API. */
# include <io.h>
#endif
int
pipe2 (int fd[2], int flags)
{
#if HAVE_PIPE2
# undef pipe2
/* Try the system call first, if it exists. (We may be running with a glibc
that has the function but with an older kernel that lacks it.) */
{
/* Cache the information whether the system call really exists. */
static int have_pipe2_really; /* 0 = unknown, 1 = yes, -1 = no */
if (have_pipe2_really >= 0)
{
int result = pipe2 (fd, flags);
if (!(result < 0 && errno == ENOSYS))
{
have_pipe2_really = 1;
return result;
}
have_pipe2_really = -1;
}
}
#endif
/* Check the supported flags. */
if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_BINARY | O_TEXT)) != 0)
{
errno = EINVAL;
return -1;
}
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Native Woe32 API. */
if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
return -1;
/* O_NONBLOCK handling.
On native Windows platforms, O_NONBLOCK is defined by gnulib. Use the
functions defined by the gnulib module 'nonblocking'. */
# if GNULIB_defined_O_NONBLOCK
if (flags & O_NONBLOCK)
{
if (set_nonblocking_flag (fd[0], true) != 0
|| set_nonblocking_flag (fd[1], true) != 0)
goto fail;
}
# else
verify (O_NONBLOCK == 0);
# endif
return 0;
#else
/* Unix API. */
if (pipe (fd) < 0)
return -1;
/* POSIX <http://www.opengroup.org/onlinepubs/9699919799/functions/pipe.html>
says that initially, the O_NONBLOCK and FD_CLOEXEC flags are cleared on
both fd[0] and fd[1]. */
/* O_NONBLOCK handling.
On Unix platforms, O_NONBLOCK is defined by the system. Use fcntl(). */
if (flags & O_NONBLOCK)
{
int fcntl_flags;
if ((fcntl_flags = fcntl (fd[1], F_GETFL, 0)) < 0
|| fcntl (fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) == -1
|| (fcntl_flags = fcntl (fd[0], F_GETFL, 0)) < 0
|| fcntl (fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) == -1)
goto fail;
}
if (flags & O_CLOEXEC)
{
int fcntl_flags;
if ((fcntl_flags = fcntl (fd[1], F_GETFD, 0)) < 0
|| fcntl (fd[1], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1
|| (fcntl_flags = fcntl (fd[0], F_GETFD, 0)) < 0
|| fcntl (fd[0], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1)
goto fail;
}
# if O_BINARY
if (flags & O_BINARY)
{
setmode (fd[1], O_BINARY);
setmode (fd[0], O_BINARY);
}
else if (flags & O_TEXT)
{
setmode (fd[1], O_TEXT);
setmode (fd[0], O_TEXT);
}
# endif
return 0;
#endif
fail:
{
int saved_errno = errno;
close (fd[0]);
close (fd[1]);
errno = saved_errno;
return -1;
}
}

View file

@ -37,6 +37,10 @@ close_fd_maybe_socket (const struct fd_hook *remaining_list,
gl_close_fn primary, gl_close_fn primary,
int fd) int fd)
{ {
/* Note about multithread-safety: There is a race condition where, between
our calls to closesocket() and the primary close(), some other thread
could make system calls that allocate precisely the same HANDLE value
as sock; then the primary close() would call CloseHandle() on it. */
SOCKET sock; SOCKET sock;
WSANETWORKEVENTS ev; WSANETWORKEVENTS ev;

View file

@ -142,7 +142,7 @@ get_stat_mtime (struct stat const *st)
} }
/* Return *ST's birth time, if available; otherwise return a value /* Return *ST's birth time, if available; otherwise return a value
with negative tv_nsec. */ with tv_sec and tv_nsec both equal to -1. */
static inline struct timespec static inline struct timespec
get_stat_birthtime (struct stat const *st) get_stat_birthtime (struct stat const *st)
{ {
@ -161,7 +161,7 @@ get_stat_birthtime (struct stat const *st)
t.tv_sec = st->st_ctime; t.tv_sec = st->st_ctime;
t.tv_nsec = 0; t.tv_nsec = 0;
#else #else
/* Birth time is not supported. Set tv_sec to avoid undefined behavior. */ /* Birth time is not supported. */
t.tv_sec = -1; t.tv_sec = -1;
t.tv_nsec = -1; t.tv_nsec = -1;
/* Avoid a "parameter unused" warning. */ /* Avoid a "parameter unused" warning. */
@ -175,10 +175,12 @@ get_stat_birthtime (struct stat const *st)
using zero. Attempt to work around this problem. Alas, this can using zero. Attempt to work around this problem. Alas, this can
report failure even for valid time stamps. Also, NetBSD report failure even for valid time stamps. Also, NetBSD
sometimes returns junk in the birth time fields; work around this sometimes returns junk in the birth time fields; work around this
bug if it is detected. There's no need to detect negative bug if it is detected. */
tv_nsec junk as negative tv_nsec already indicates an error. */ if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000))
if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec) {
t.tv_nsec = -1; t.tv_sec = -1;
t.tv_nsec = -1;
}
#endif #endif
return t; return t;

View file

@ -38,9 +38,9 @@
remember if special invocation has ever been used to obtain wint_t, remember if special invocation has ever been used to obtain wint_t,
in which case we need to clean up NULL yet again. */ in which case we need to clean up NULL yet again. */
# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T) # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T)
# ifdef __need_wint_t # ifdef __need_wint_t
# undef _GL_STDDEF_H # undef _@GUARD_PREFIX@_STDDEF_H
# define _GL_STDDEF_WINT_T # define _GL_STDDEF_WINT_T
# endif # endif
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
@ -49,14 +49,14 @@
#else #else
/* Normal invocation convention. */ /* Normal invocation convention. */
# ifndef _GL_STDDEF_H # ifndef _@GUARD_PREFIX@_STDDEF_H
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@
# ifndef _GL_STDDEF_H # ifndef _@GUARD_PREFIX@_STDDEF_H
# define _GL_STDDEF_H # define _@GUARD_PREFIX@_STDDEF_H
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
#if @REPLACE_NULL@ #if @REPLACE_NULL@
@ -82,6 +82,6 @@
# define wchar_t int # define wchar_t int
#endif #endif
# endif /* _GL_STDDEF_H */ # endif /* _@GUARD_PREFIX@_STDDEF_H */
# endif /* _GL_STDDEF_H */ # endif /* _@GUARD_PREFIX@_STDDEF_H */
#endif /* __need_XXX */ #endif /* __need_XXX */

View file

@ -21,7 +21,7 @@
* <http://www.opengroup.org/susv3xbd/stdint.h.html> * <http://www.opengroup.org/susv3xbd/stdint.h.html>
*/ */
#ifndef _GL_STDINT_H #ifndef _@GUARD_PREFIX@_STDINT_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -52,13 +52,13 @@
/* Other systems may have an incomplete or buggy <stdint.h>. /* Other systems may have an incomplete or buggy <stdint.h>.
Include it before <inttypes.h>, since any "#include <stdint.h>" Include it before <inttypes.h>, since any "#include <stdint.h>"
in <inttypes.h> would reinclude us, skipping our contents because in <inttypes.h> would reinclude us, skipping our contents because
_GL_STDINT_H is defined. _@GUARD_PREFIX@_STDINT_H is defined.
The include_next requires a split double-inclusion guard. */ The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_STDINT_H@ # @INCLUDE_NEXT@ @NEXT_STDINT_H@
#endif #endif
#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
#define _GL_STDINT_H #define _@GUARD_PREFIX@_STDINT_H
/* <sys/types.h> defines some of the stdint.h types as well, on glibc, /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
@ -93,7 +93,7 @@
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H #undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
/* Minimum and maximum values for a integer type under the usual assumption. /* Minimum and maximum values for an integer type under the usual assumption.
Return an unspecified value if BITS == 0, adding a check to pacify Return an unspecified value if BITS == 0, adding a check to pacify
picky compilers. */ picky compilers. */
@ -588,5 +588,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ #endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
#endif /* _GL_STDINT_H */ #endif /* _@GUARD_PREFIX@_STDINT_H */
#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */

110
lib/stdio-impl.h Normal file
View file

@ -0,0 +1,110 @@
/* Implementation details of FILE streams.
Copyright (C) 2007-2008, 2010-2011 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
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 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, see <http://www.gnu.org/licenses/>. */
/* Many stdio implementations have the same logic and therefore can share
the same implementation of stdio extension API, except that some fields
have different naming conventions, or their access requires some casts. */
/* BSD stdio derived implementations. */
#if defined __NetBSD__ /* NetBSD */
/* Get __NetBSD_Version__. */
# include <sys/param.h>
#endif
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __DragonFly__ /* DragonFly */
/* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
# define fp_ ((struct { struct __FILE_public pub; \
struct { unsigned char *_base; int _size; } _bf; \
void *cookie; \
void *_close; \
void *_read; \
void *_seek; \
void *_write; \
struct { unsigned char *_base; int _size; } _ub; \
int _ur; \
unsigned char _ubuf[3]; \
unsigned char _nbuf[1]; \
struct { unsigned char *_base; int _size; } _lb; \
int _blksize; \
fpos_t _offset; \
/* More fields, not relevant here. */ \
} *) fp)
/* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
# define _p pub._p
# define _flags pub._flags
# define _r pub._r
# define _w pub._w
# else
# define fp_ fp
# endif
# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
struct __sfileext
{
struct __sbuf _ub; /* ungetc buffer */
/* More fields, not relevant here. */
};
# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
# else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, MacOS X, Cygwin */
# define fp_ub fp_->_ub
# endif
# define HASUB(fp) (fp_ub._base != NULL)
#endif
/* SystemV derived implementations. */
#ifdef __TANDEM /* NonStop Kernel */
# ifndef _IOERR
/* These values were determined by the program 'stdioext-flags' at
<http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00165.html>. */
# define _IOERR 0x40
# define _IOREAD 0x80
# define _IOWRT 0x4
# define _IORW 0x100
# endif
#endif
#if defined _IOERR
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
unsigned char *_end; \
long _cnt; \
int _file; \
unsigned int _flag; \
} *) fp)
# else
# define fp_ fp
# endif
# if defined _SCO_DS /* OpenServer */
# define _cnt __cnt
# define _ptr __ptr
# define _base __base
# define _flag __flag
# endif
#endif

View file

@ -35,7 +35,7 @@
#else #else
/* Normal invocation convention. */ /* Normal invocation convention. */
#ifndef _GL_STDIO_H #ifndef _@GUARD_PREFIX@_STDIO_H
#define _GL_ALREADY_INCLUDING_STDIO_H #define _GL_ALREADY_INCLUDING_STDIO_H
@ -44,8 +44,8 @@
#undef _GL_ALREADY_INCLUDING_STDIO_H #undef _GL_ALREADY_INCLUDING_STDIO_H
#ifndef _GL_STDIO_H #ifndef _@GUARD_PREFIX@_STDIO_H
#define _GL_STDIO_H #define _@GUARD_PREFIX@_STDIO_H
/* Get va_list. Needed on many systems, including glibc 2.8. */ /* Get va_list. Needed on many systems, including glibc 2.8. */
#include <stdarg.h> #include <stdarg.h>
@ -461,25 +461,6 @@ _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
# endif # endif
_GL_CXXALIASWARN (fseeko); _GL_CXXALIASWARN (fseeko);
# if (@REPLACE_FSEEKO@ || !@HAVE_FSEEKO@) && !@GNULIB_FSEEK@
/* Provide an fseek function that is consistent with fseeko. */
/* In order to avoid that fseek gets defined as a macro here, the
developer can request the 'fseek' module. */
# if !GNULIB_defined_fseek_function
# undef fseek
# define fseek rpl_fseek
static inline int _GL_ARG_NONNULL ((1))
rpl_fseek (FILE *fp, long offset, int whence)
{
# if @REPLACE_FSEEKO@
return rpl_fseeko (fp, offset, whence);
# else
return fseeko (fp, offset, whence);
# endif
}
# define GNULIB_defined_fseek_function 1
# endif
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# define _GL_FSEEK_WARN /* Category 1, above. */ # define _GL_FSEEK_WARN /* Category 1, above. */
# undef fseek # undef fseek
@ -539,25 +520,6 @@ _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
# endif # endif
_GL_CXXALIASWARN (ftello); _GL_CXXALIASWARN (ftello);
# if (@REPLACE_FTELLO@ || !@HAVE_FTELLO@) && !@GNULIB_FTELL@
/* Provide an ftell function that is consistent with ftello. */
/* In order to avoid that ftell gets defined as a macro here, the
developer can request the 'ftell' module. */
# if !GNULIB_defined_ftell_function
# undef ftell
# define ftell rpl_ftell
static inline long _GL_ARG_NONNULL ((1))
rpl_ftell (FILE *f)
{
# if @REPLACE_FTELLO@
return rpl_ftello (f);
# else
return ftello (f);
# endif
}
# define GNULIB_defined_ftell_function 1
# endif
# endif
#elif defined GNULIB_POSIXCHECK #elif defined GNULIB_POSIXCHECK
# define _GL_FTELL_WARN /* Category 1, above. */ # define _GL_FTELL_WARN /* Category 1, above. */
# undef ftell # undef ftell
@ -1345,6 +1307,6 @@ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
#endif #endif
#endif /* _GL_STDIO_H */ #endif /* _@GUARD_PREFIX@_STDIO_H */
#endif /* _GL_STDIO_H */ #endif /* _@GUARD_PREFIX@_STDIO_H */
#endif #endif

View file

@ -28,13 +28,13 @@
#else #else
/* Normal invocation convention. */ /* Normal invocation convention. */
#ifndef _GL_STDLIB_H #ifndef _@GUARD_PREFIX@_STDLIB_H
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@ #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
#ifndef _GL_STDLIB_H #ifndef _@GUARD_PREFIX@_STDLIB_H
#define _GL_STDLIB_H #define _@GUARD_PREFIX@_STDLIB_H
/* NetBSD 5.0 mis-defines NULL. */ /* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h> #include <stddef.h>
@ -81,8 +81,9 @@ struct random_data
# endif # endif
#endif #endif
#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */ /* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
/* On MacOS X 10.5, only <unistd.h> declares mkstemps. */
/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */ /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
/* But avoid namespace pollution on glibc systems and native Windows. */ /* But avoid namespace pollution on glibc systems and native Windows. */
# include <unistd.h> # include <unistd.h>
@ -760,6 +761,6 @@ _GL_CXXALIASWARN (wctomb);
#endif #endif
#endif /* _GL_STDLIB_H */ #endif /* _@GUARD_PREFIX@_STDLIB_H */
#endif /* _GL_STDLIB_H */ #endif /* _@GUARD_PREFIX@_STDLIB_H */
#endif #endif

View file

@ -16,7 +16,7 @@
along with this program; if not, write to the Free Software Foundation, along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _GL_STRING_H #ifndef _@GUARD_PREFIX@_STRING_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -26,8 +26,8 @@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STRING_H@ #@INCLUDE_NEXT@ @NEXT_STRING_H@
#ifndef _GL_STRING_H #ifndef _@GUARD_PREFIX@_STRING_H
#define _GL_STRING_H #define _@GUARD_PREFIX@_STRING_H
/* NetBSD 5.0 mis-defines NULL. */ /* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h> #include <stddef.h>
@ -736,9 +736,9 @@ _GL_CXXALIASWARN (mbschr);
and return a pointer to it. Return NULL if C is not found in STRING. and return a pointer to it. Return NULL if C is not found in STRING.
Unlike strrchr(), this function works correctly in multibyte locales with Unlike strrchr(), this function works correctly in multibyte locales with
encodings such as GB18030. */ encodings such as GB18030. */
# if defined __hpux # if defined __hpux || defined __INTERIX
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ # define mbsrchr rpl_mbsrchr /* avoid collision with system function */
# endif # endif
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
_GL_ARG_NONNULL ((1))); _GL_ARG_NONNULL ((1)));
@ -977,5 +977,5 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
#endif #endif
#endif /* _GL_STRING_H */ #endif /* _@GUARD_PREFIX@_STRING_H */
#endif /* _GL_STRING_H */ #endif /* _@GUARD_PREFIX@_STRING_H */

View file

@ -18,7 +18,7 @@
/* Written by Richard W.M. Jones. */ /* Written by Richard W.M. Jones. */
#ifndef _GL_SYS_FILE_H #ifndef _@GUARD_PREFIX@_SYS_FILE_H
#if __GNUC__ >= 3 #if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@ @PRAGMA_SYSTEM_HEADER@
@ -30,8 +30,8 @@
# @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@ # @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@
#endif #endif
#ifndef _GL_SYS_FILE_H #ifndef _@GUARD_PREFIX@_SYS_FILE_H
#define _GL_SYS_FILE_H #define _@GUARD_PREFIX@_SYS_FILE_H
#ifndef LOCK_SH #ifndef LOCK_SH
/* Operations for the 'flock' call (same as Linux kernel constants). */ /* Operations for the 'flock' call (same as Linux kernel constants). */
@ -60,5 +60,5 @@ _GL_WARN_ON_USE (flock, "flock is unportable - "
#endif #endif
#endif /* _GL_SYS_FILE_H */ #endif /* _@GUARD_PREFIX@_SYS_FILE_H */
#endif /* _GL_SYS_FILE_H */ #endif /* _@GUARD_PREFIX@_SYS_FILE_H */

View file

@ -40,7 +40,7 @@
#else #else
/* Normal invocation convention. */ /* Normal invocation convention. */
#ifndef _GL_SYS_SOCKET_H #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
#if @HAVE_SYS_SOCKET_H@ #if @HAVE_SYS_SOCKET_H@
@ -61,8 +61,8 @@
#endif #endif
#ifndef _GL_SYS_SOCKET_H #ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
#define _GL_SYS_SOCKET_H #define _@GUARD_PREFIX@_SYS_SOCKET_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -108,6 +108,12 @@ struct sockaddr_storage
#endif #endif
/* Get struct iovec. */
/* But avoid namespace pollution on glibc systems. */
#if ! defined __GLIBC__
# include <sys/uio.h>
#endif
#if @HAVE_SYS_SOCKET_H@ #if @HAVE_SYS_SOCKET_H@
/* A platform that has <sys/socket.h>. */ /* A platform that has <sys/socket.h>. */
@ -176,9 +182,6 @@ typedef int socklen_t;
# endif # endif
/* For struct iovec */
# include <sys/uio.h>
/* Rudimentary 'struct msghdr'; this works as long as you don't try to /* Rudimentary 'struct msghdr'; this works as long as you don't try to
access msg_control or msg_controllen. */ access msg_control or msg_controllen. */
struct msghdr { struct msghdr {
@ -221,7 +224,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
/* Wrap everything else to use libc file descriptors for sockets. */ /* Wrap everything else to use libc file descriptors for sockets. */
#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H #if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef close # undef close
# define close close_used_without_including_unistd_h # define close close_used_without_including_unistd_h
@ -231,7 +234,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
# endif # endif
#endif #endif
#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H #if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gethostname # undef gethostname
# define gethostname gethostname_used_without_including_unistd_h # define gethostname gethostname_used_without_including_unistd_h
@ -673,6 +676,6 @@ _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
# endif # endif
#endif #endif
#endif /* _GL_SYS_SOCKET_H */ #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
#endif /* _GL_SYS_SOCKET_H */ #endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
#endif #endif

View file

@ -34,7 +34,7 @@
#else #else
/* Normal invocation convention. */ /* Normal invocation convention. */
#ifndef _GL_SYS_STAT_H #ifndef _@GUARD_PREFIX@_SYS_STAT_H
/* Get nlink_t. */ /* Get nlink_t. */
#include <sys/types.h> #include <sys/types.h>
@ -45,8 +45,8 @@
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
#ifndef _GL_SYS_STAT_H #ifndef _@GUARD_PREFIX@_SYS_STAT_H
#define _GL_SYS_STAT_H #define _@GUARD_PREFIX@_SYS_STAT_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -653,6 +653,6 @@ _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
#endif #endif
#endif /* _GL_SYS_STAT_H */ #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
#endif /* _GL_SYS_STAT_H */ #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
#endif #endif

View file

@ -23,7 +23,7 @@
#endif #endif
@PRAGMA_COLUMNS@ @PRAGMA_COLUMNS@
#if defined _GL_SYS_TIME_H #if defined _@GUARD_PREFIX@_SYS_TIME_H
/* Simply delegate to the system's header, without adding anything. */ /* Simply delegate to the system's header, without adding anything. */
# if @HAVE_SYS_TIME_H@ # if @HAVE_SYS_TIME_H@
@ -32,7 +32,7 @@
#else #else
# define _GL_SYS_TIME_H # define _@GUARD_PREFIX@_SYS_TIME_H
# if @HAVE_SYS_TIME_H@ # if @HAVE_SYS_TIME_H@
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
@ -98,4 +98,4 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
# endif # endif
# endif # endif
#endif /* _GL_SYS_TIME_H */ #endif /* _@GUARD_PREFIX@_SYS_TIME_H */

View file

@ -20,30 +20,45 @@
# endif # endif
@PRAGMA_COLUMNS@ @PRAGMA_COLUMNS@
#ifndef _GL_SYS_UIO_H #ifndef _@GUARD_PREFIX@_SYS_UIO_H
#if @HAVE_SYS_UIO_H@ #if @HAVE_SYS_UIO_H@
/* On OpenBSD 4.4, <sys/uio.h> assumes prior inclusion of <sys/types.h>. */
# include <sys/types.h>
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@ # @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@
#endif #endif
#ifndef _GL_SYS_UIO_H #ifndef _@GUARD_PREFIX@_SYS_UIO_H
#define _GL_SYS_UIO_H #define _@GUARD_PREFIX@_SYS_UIO_H
#if !@HAVE_SYS_UIO_H@ #if !@HAVE_SYS_UIO_H@
/* A platform that lacks <sys/uio.h>. */ /* A platform that lacks <sys/uio.h>. */
/* Get 'ssize_t'. */ /* Get 'ssize_t'. */
# include <sys/types.h> # include <sys/types.h>
# ifdef __cplusplus
extern "C" {
# endif
# if !GNULIB_defined_struct_iovec
/* All known platforms that lack <sys/uio.h> also lack any declaration /* All known platforms that lack <sys/uio.h> also lack any declaration
of struct iovec in any other header. */ of struct iovec in any other header. */
struct iovec { struct iovec {
void *iov_base; void *iov_base;
size_t iov_len; size_t iov_len;
}; };
# define GNULIB_defined_struct_iovec 1
# endif
# ifdef __cplusplus
}
# endif
#endif #endif
#endif /* _GL_SYS_UIO_H */ #endif /* _@GUARD_PREFIX@_SYS_UIO_H */
#endif /* _GL_SYS_UIO_H */ #endif /* _@GUARD_PREFIX@_SYS_UIO_H */

View file

@ -28,13 +28,13 @@
without adding our own declarations. */ without adding our own declarations. */
#if (defined __need_time_t || defined __need_clock_t \ #if (defined __need_time_t || defined __need_clock_t \
|| defined __need_timespec \ || defined __need_timespec \
|| defined _GL_TIME_H) || defined _@GUARD_PREFIX@_TIME_H)
# @INCLUDE_NEXT@ @NEXT_TIME_H@ # @INCLUDE_NEXT@ @NEXT_TIME_H@
#else #else
# define _GL_TIME_H # define _@GUARD_PREFIX@_TIME_H
# @INCLUDE_NEXT@ @NEXT_TIME_H@ # @INCLUDE_NEXT@ @NEXT_TIME_H@

View file

@ -36,7 +36,7 @@
# define _GL_WINSOCK2_H_WITNESS # define _GL_WINSOCK2_H_WITNESS
/* Normal invocation. */ /* Normal invocation. */
#elif !defined _GL_UNISTD_H #elif !defined _@GUARD_PREFIX@_UNISTD_H
/* The include_next requires a split double-inclusion guard. */ /* The include_next requires a split double-inclusion guard. */
#if @HAVE_UNISTD_H@ #if @HAVE_UNISTD_H@
@ -51,8 +51,8 @@
# undef _GL_INCLUDING_WINSOCK2_H # undef _GL_INCLUDING_WINSOCK2_H
#endif #endif
#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
#define _GL_UNISTD_H #define _@GUARD_PREFIX@_UNISTD_H
/* NetBSD 5.0 mis-defines NULL. Also get size_t. */ /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
#include <stddef.h> #include <stddef.h>
@ -120,7 +120,7 @@
#if @GNULIB_GETHOSTNAME@ #if @GNULIB_GETHOSTNAME@
/* Get all possible declarations of gethostname(). */ /* Get all possible declarations of gethostname(). */
# if @UNISTD_H_HAVE_WINSOCK2_H@ # if @UNISTD_H_HAVE_WINSOCK2_H@
# if !defined _GL_SYS_SOCKET_H # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef socket # undef socket
# define socket socket_used_without_including_sys_socket_h # define socket socket_used_without_including_sys_socket_h
@ -181,7 +181,7 @@
"shutdown() used without including <sys/socket.h>"); "shutdown() used without including <sys/socket.h>");
# endif # endif
# endif # endif
# if !defined _GL_SYS_SELECT_H # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef select # undef select
# define select select_used_without_including_sys_select_h # define select select_used_without_including_sys_select_h
@ -871,6 +871,22 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
#endif #endif
#if @GNULIB_GROUP_MEMBER@
/* Determine whether group id is in calling user's group list. */
# if !@HAVE_GROUP_MEMBER@
_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
# endif
_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
_GL_CXXALIASWARN (group_member);
#elif defined GNULIB_POSIXCHECK
# undef group_member
# if HAVE_RAW_DECL_GROUP_MEMBER
_GL_WARN_ON_USE (group_member, "group_member is unportable - "
"use gnulib module group-member for portability");
# endif
#endif
#if @GNULIB_LCHOWN@ #if @GNULIB_LCHOWN@
/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
to GID (if GID is not -1). Do not follow symbolic links. to GID (if GID is not -1). Do not follow symbolic links.
@ -1400,5 +1416,5 @@ _GL_CXXALIASWARN (write);
#endif #endif
#endif /* _GL_UNISTD_H */ #endif /* _@GUARD_PREFIX@_UNISTD_H */
#endif /* _GL_UNISTD_H */ #endif /* _@GUARD_PREFIX@_UNISTD_H */

View file

@ -17,42 +17,37 @@
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ /* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
#ifndef VERIFY_H #ifndef _GL_VERIFY_H
# define VERIFY_H 1 # define _GL_VERIFY_H
/* Define HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and
later, in C mode, and its use here generates easier-to-read diagnostics later, in C mode, and its use here generates easier-to-read diagnostics
when verify (R) fails. when verify (R) fails.
Define HAVE_STATIC_ASSERT to 1 if static_assert works as per the Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the
C1X draft N1548 section 7.2 or the C++0X draft N3242 section 7.(4). C++0X draft N3242 section 7.(4).
This will likely be supported by future GCC versions, in C++ mode. This will likely be supported by future GCC versions, in C++ mode.
For now, use this only with GCC. Eventually whether _Static_assert Use this only with GCC. If we were willing to slow 'configure'
and static_assert works should be determined by 'configure'. */ down we could also use it with other compilers, but since this
affects only the quality of diagnostics, why bother? */
# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus # if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus
# define HAVE__STATIC_ASSERT 1 # define _GL_HAVE__STATIC_ASSERT 1
# endif # endif
/* The condition (99 < __GNUC__) is temporary, until we know about the /* The condition (99 < __GNUC__) is temporary, until we know about the
first G++ release that supports static_assert. */ first G++ release that supports static_assert. */
# if (99 < __GNUC__) && defined __cplusplus # if (99 < __GNUC__) && defined __cplusplus
# define HAVE_STATIC_ASSERT 1 # define _GL_HAVE_STATIC_ASSERT 1
# endif # endif
/* Each of these macros verifies that its argument R is nonzero. To /* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike be portable, R should be an integer constant expression. Unlike
assert (R), there is no run-time overhead. assert (R), there is no run-time overhead.
There are two macros, since no single macro can be used in all
contexts in C. verify_true (R) is for scalar contexts, including
integer constant expression contexts. verify (R) is for declaration
contexts, e.g., the top level.
Symbols ending in "__" are private to this header.
If _Static_assert works, verify (R) uses it directly. Similarly, If _Static_assert works, verify (R) uses it directly. Similarly,
verify_true (R) works by packaging a _Static_assert inside a struct _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct
that is an operand of sizeof. that is an operand of sizeof.
The code below uses several ideas for C++ compilers, and for C The code below uses several ideas for C++ compilers, and for C
@ -64,7 +59,9 @@
constant and nonnegative. constant and nonnegative.
* Next this expression W is wrapped in a type * Next this expression W is wrapped in a type
struct verify_type__ { unsigned int verify_error_if_negative_size__: W; }. struct _gl_verify_type {
unsigned int _gl_verify_error_if_negative: W;
}.
If W is negative, this yields a compile-time error. No compiler can If W is negative, this yields a compile-time error. No compiler can
deal with a bit-field of negative size. deal with a bit-field of negative size.
@ -78,7 +75,7 @@
void function (int n) { verify (n < 0); } void function (int n) { verify (n < 0); }
* For the verify macro, the struct verify_type__ will need to * For the verify macro, the struct _gl_verify_type will need to
somehow be embedded into a declaration. To be portable, this somehow be embedded into a declaration. To be portable, this
declaration must declare an object, a constant, a function, or a declaration must declare an object, a constant, a function, or a
typedef name. If the declared entity uses the type directly, typedef name. If the declared entity uses the type directly,
@ -116,11 +113,11 @@
Which of the following alternatives can be used? Which of the following alternatives can be used?
extern int dummy [sizeof (struct {...})]; extern int dummy [sizeof (struct {...})];
extern int dummy [sizeof (struct verify_type__ {...})]; extern int dummy [sizeof (struct _gl_verify_type {...})];
extern void dummy (int [sizeof (struct {...})]); extern void dummy (int [sizeof (struct {...})]);
extern void dummy (int [sizeof (struct verify_type__ {...})]); extern void dummy (int [sizeof (struct _gl_verify_type {...})]);
extern int (*dummy (void)) [sizeof (struct {...})]; extern int (*dummy (void)) [sizeof (struct {...})];
extern int (*dummy (void)) [sizeof (struct verify_type__ {...})]; extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})];
In the second and sixth case, the struct type is exported to the In the second and sixth case, the struct type is exported to the
outer scope; two such declarations therefore collide. GCC warns outer scope; two such declarations therefore collide. GCC warns
@ -159,44 +156,88 @@
possible. */ possible. */
# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) # define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
/* Verify requirement R at compile-time, as an integer constant expression. /* Verify requirement R at compile-time, as an integer constant expression
Return 1. */ that returns 1. If R is false, fail at compile-time, preferably
with a diagnostic that includes the string-literal DIAGNOSTIC. */
# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
(!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
# ifdef __cplusplus # ifdef __cplusplus
# if !GNULIB_defined_struct__gl_verify_type
template <int w> template <int w>
struct verify_type__ { unsigned int verify_error_if_negative_size__: w; }; struct _gl_verify_type {
# define verify_true(R) \ unsigned int _gl_verify_error_if_negative: w;
(!!sizeof (verify_type__<(R) ? 1 : -1>)) };
# elif HAVE__STATIC_ASSERT # define GNULIB_defined_struct__gl_verify_type 1
# define verify_true(R) \ # endif
(!!sizeof \ # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
(struct { \ _gl_verify_type<(R) ? 1 : -1>
_Static_assert (R, "verify_true (" #R ")"); \ # elif defined _GL_HAVE__STATIC_ASSERT
int verify_dummy__; \ # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
})) struct { \
# elif HAVE_STATIC_ASSERT _Static_assert (R, DIAGNOSTIC); \
# define verify_true(R) \ int _gl_dummy; \
(!!sizeof \ }
(struct { \
static_assert (R, "verify_true (" #R ")"); \
int verify_dummy__; \
}))
# else # else
# define verify_true(R) \ # define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
(!!sizeof \ struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
(struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
# endif # endif
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. If R is false, fail at compile-time, preferably
with a diagnostic that includes the string-literal DIAGNOSTIC.
Unfortunately, unlike C1X, this implementation must appear as an
ordinary declaration, and cannot appear inside struct { ... }. */
# ifdef _GL_HAVE__STATIC_ASSERT
# define _GL_VERIFY _Static_assert
# else
# define _GL_VERIFY(R, DIAGNOSTIC) \
extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
[_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
# endif
/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */
# ifdef _GL_STATIC_ASSERT_H
# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert
# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
# endif
# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
# define static_assert _Static_assert /* Draft C1X requires this #define. */
# endif
# endif
/* @assert.h omit start@ */
/* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike
assert (R), there is no run-time overhead.
There are two macros, since no single macro can be used in all
contexts in C. verify_true (R) is for scalar contexts, including
integer constant expression contexts. verify (R) is for declaration
contexts, e.g., the top level. */
/* Verify requirement R at compile-time, as an integer constant expression.
Return 1. This is equivalent to verify_expr (R, 1).
verify_true is obsolescent; please use verify_expr instead. */
# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
/* Verify requirement R at compile-time. Return the value of the
expression E. */
# define verify_expr(R, E) \
(_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
/* Verify requirement R at compile-time, as a declaration without a /* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */ trailing ';'. */
# if HAVE__STATIC_ASSERT # define verify(R) _GL_VERIFY (R, "verify (" #R ")")
# define verify(R) _Static_assert (R, "verify (" #R ")")
# elif HAVE_STATIC_ASSERT /* @assert.h omit end@ */
# define verify(R) static_assert (R, "verify (" #R ")")
# else
# define verify(R) \
extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)]
# endif
#endif #endif

View file

@ -49,7 +49,7 @@
#else #else
/* Normal invocation convention. */ /* Normal invocation convention. */
#ifndef _GL_WCHAR_H #ifndef _@GUARD_PREFIX@_WCHAR_H
#define _GL_ALREADY_INCLUDING_WCHAR_H #define _GL_ALREADY_INCLUDING_WCHAR_H
@ -81,8 +81,8 @@
#undef _GL_ALREADY_INCLUDING_WCHAR_H #undef _GL_ALREADY_INCLUDING_WCHAR_H
#ifndef _GL_WCHAR_H #ifndef _@GUARD_PREFIX@_WCHAR_H
#define _GL_WCHAR_H #define _@GUARD_PREFIX@_WCHAR_H
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@ -989,6 +989,6 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
#endif #endif
#endif /* _GL_WCHAR_H */ #endif /* _@GUARD_PREFIX@_WCHAR_H */
#endif /* _GL_WCHAR_H */ #endif /* _@GUARD_PREFIX@_WCHAR_H */
#endif #endif

View file

@ -105,7 +105,7 @@ guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile
if [ "$(cross_compiling)" = "yes" ]; then \ if [ "$(cross_compiling)" = "yes" ]; then \
$(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \ $(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
else \ else \
$(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(LIBS); \ $(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(gnulib_library) $(LIBS); \
fi fi

View file

@ -1,4 +1,4 @@
# arpa_inet_h.m4 serial 11 # arpa_inet_h.m4 serial 12
dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc. dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -38,13 +38,6 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
]], [inet_ntop inet_pton]) ]], [inet_ntop inet_pton])
]) ])
dnl Unconditionally enables the replacement of <arpa/inet.h>.
AC_DEFUN([gl_REPLACE_ARPA_INET_H],
[
dnl This is a no-op, because <arpa/inet.h> is always overridden.
:
])
AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
[ [
dnl Use AC_REQUIRE here, so that the default settings are expanded once only. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.

View file

@ -1,4 +1,4 @@
# canonicalize.m4 serial 17 # canonicalize.m4 serial 23
dnl Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.
@ -10,8 +10,6 @@ dnl with or without modifications, as long as this notice is preserved.
# not provide or fix realpath. # not provide or fix realpath.
AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE], AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE],
[ [
AC_LIBOBJ([canonicalize])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_CHECK_FUNCS_ONCE([canonicalize_file_name]) AC_CHECK_FUNCS_ONCE([canonicalize_file_name])
AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
@ -26,24 +24,23 @@ AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE],
# Provides canonicalize_file_name and realpath. # Provides canonicalize_file_name and realpath.
AC_DEFUN([gl_CANONICALIZE_LGPL], AC_DEFUN([gl_CANONICALIZE_LGPL],
[ [
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_CANONICALIZE_LGPL_SEPARATE]) AC_REQUIRE([gl_CANONICALIZE_LGPL_SEPARATE])
if test $ac_cv_func_canonicalize_file_name = no; then if test $ac_cv_func_canonicalize_file_name = no; then
HAVE_CANONICALIZE_FILE_NAME=0 HAVE_CANONICALIZE_FILE_NAME=0
AC_LIBOBJ([canonicalize-lgpl])
if test $ac_cv_func_realpath = no; then if test $ac_cv_func_realpath = no; then
HAVE_REALPATH=0 HAVE_REALPATH=0
elif test "$gl_cv_func_realpath_works" != yes; then elif test "$gl_cv_func_realpath_works" != yes; then
REPLACE_REALPATH=1 REPLACE_REALPATH=1
fi fi
elif test "$gl_cv_func_realpath_works" != yes; then elif test "$gl_cv_func_realpath_works" != yes; then
AC_LIBOBJ([canonicalize-lgpl])
REPLACE_REALPATH=1
REPLACE_CANONICALIZE_FILE_NAME=1 REPLACE_CANONICALIZE_FILE_NAME=1
REPLACE_REALPATH=1
fi fi
]) ])
# Like gl_CANONICALIZE_LGPL, except prepare for separate compilation # Like gl_CANONICALIZE_LGPL, except prepare for separate compilation
# (no AC_LIBOBJ). # (no REPLACE_CANONICALIZE_FILE_NAME, no REPLACE_REALPATH, no AC_LIBOBJ).
AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE], AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
[ [
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@ -61,9 +58,12 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
AC_CHECK_FUNCS_ONCE([realpath]) AC_CHECK_FUNCS_ONCE([realpath])
AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [ AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [
touch conftest.a touch conftest.a
mkdir conftest.d
AC_RUN_IFELSE([ AC_RUN_IFELSE([
AC_LANG_PROGRAM([[ AC_LANG_PROGRAM([[
]GL_NOCRASH[
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
]], [[ ]], [[
int result = 0; int result = 0;
{ {
@ -81,10 +81,17 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
if (name != NULL) if (name != NULL)
result |= 4; result |= 4;
} }
{
char *name1 = realpath (".", NULL);
char *name2 = realpath ("conftest.d//./..", NULL);
if (strcmp (name1, name2) != 0)
result |= 8;
}
return result; return result;
]]) ]])
], [gl_cv_func_realpath_works=yes], [gl_cv_func_realpath_works=no], ], [gl_cv_func_realpath_works=yes], [gl_cv_func_realpath_works=no],
[gl_cv_func_realpath_works="guessing no"]) [gl_cv_func_realpath_works="guessing no"])
rm -rf conftest.a conftest.d
]) ])
if test "$gl_cv_func_realpath_works" = yes; then if test "$gl_cv_func_realpath_works" = yes; then
AC_DEFINE([FUNC_REALPATH_WORKS], [1], [Define to 1 if realpath() AC_DEFINE([FUNC_REALPATH_WORKS], [1], [Define to 1 if realpath()

View file

@ -1,4 +1,4 @@
# ceil.m4 serial 5 # ceil.m4 serial 6
dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -48,7 +48,7 @@ int main()
fi fi
]) ])
if test $REPLACE_CEIL = 1; then if test $REPLACE_CEIL = 1; then
AC_LIBOBJ([ceil]) dnl No libraries are needed to link lib/ceil.c.
CEIL_LIBM= CEIL_LIBM=
fi fi
AC_SUBST([CEIL_LIBM]) AC_SUBST([CEIL_LIBM])

View file

@ -1,4 +1,4 @@
# duplocale.m4 serial 5 # duplocale.m4 serial 7
dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -59,11 +59,6 @@ int main ()
else else
HAVE_DUPLOCALE=0 HAVE_DUPLOCALE=0
fi fi
if test $REPLACE_DUPLOCALE = 1; then
gl_REPLACE_LOCALE_H
AC_LIBOBJ([duplocale])
gl_PREREQ_DUPLOCALE
fi
]) ])
# Prerequisites of lib/duplocale.c. # Prerequisites of lib/duplocale.c.

View file

@ -1,4 +1,4 @@
# fclose.m4 serial 2 # fclose.m4 serial 4
dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -6,6 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_FCLOSE], AC_DEFUN([gl_FUNC_FCLOSE],
[ [
gl_FUNC_FFLUSH_STDIN
if test $gl_cv_func_fflush_stdin = no; then
gl_REPLACE_FCLOSE
fi
]) ])
AC_DEFUN([gl_REPLACE_FCLOSE], AC_DEFUN([gl_REPLACE_FCLOSE],

112
m4/fcntl-o.m4 Normal file
View file

@ -0,0 +1,112 @@
# fcntl-o.m4 serial 3
dnl Copyright (C) 2006, 2009-2011 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 Written by Paul Eggert.
# Test whether the flags O_NOATIME and O_NOFOLLOW actually work.
# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
AC_DEFUN([gl_FCNTL_O_FLAGS],
[
dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
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])])
AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#ifndef O_NOATIME
#define O_NOATIME 0
#endif
#ifndef O_NOFOLLOW
#define O_NOFOLLOW 0
#endif
static int const constants[] =
{
O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
};
]],
[[
int result = !constants;
{
static char const sym[] = "conftest.sym";
if (symlink (".", sym) != 0)
result |= 2;
else
{
int fd = open (sym, O_RDONLY | O_NOFOLLOW);
if (fd >= 0)
{
close (fd);
result |= 4;
}
}
unlink (sym);
}
{
static char const file[] = "confdefs.h";
int fd = open (file, O_RDONLY | O_NOATIME);
if (fd < 0)
result |= 8;
else
{
struct stat st0;
if (fstat (fd, &st0) != 0)
result |= 16;
else
{
char c;
sleep (1);
if (read (fd, &c, 1) != 1)
result |= 24;
else
{
if (close (fd) != 0)
result |= 32;
else
{
struct stat st1;
if (stat (file, &st1) != 0)
result |= 40;
else
if (st0.st_atime != st1.st_atime)
result |= 64;
}
}
}
}
}
return result;]])],
[gl_cv_header_working_fcntl_h=yes],
[case $? in #(
4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
*) gl_cv_header_working_fcntl_h='no';;
esac],
[gl_cv_header_working_fcntl_h=cross-compiling])])
case $gl_cv_header_working_fcntl_h in #(
*O_NOATIME* | no | cross-compiling) ac_val=0;; #(
*) ac_val=1;;
esac
AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
[Define to 1 if O_NOATIME works.])
case $gl_cv_header_working_fcntl_h in #(
*O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
*) ac_val=1;;
esac
AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
[Define to 1 if O_NOFOLLOW works.])
])

44
m4/fcntl_h.m4 Normal file
View file

@ -0,0 +1,44 @@
# serial 13
# Configure fcntl.h.
dnl Copyright (C) 2006-2007, 2009-2011 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 Written by Paul Eggert.
AC_DEFUN([gl_FCNTL_H],
[
AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
AC_REQUIRE([gl_FCNTL_O_FLAGS])
gl_NEXT_HEADERS([fcntl.h])
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use, if it is not common
dnl enough to be declared everywhere.
gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
]], [fcntl openat])
])
AC_DEFUN([gl_FCNTL_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
AC_DEFUN([gl_FCNTL_H_DEFAULTS],
[
GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL])
GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING])
GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN])
GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL])
HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT])
REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL])
REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT])
])

81
m4/fflush.m4 Normal file
View file

@ -0,0 +1,81 @@
# fflush.m4 serial 12
# Copyright (C) 2007-2011 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.
dnl From Eric Blake
dnl Find out how to obey POSIX semantics of fflush(stdin) discarding
dnl unread input on seekable streams, rather than C99 undefined semantics.
AC_DEFUN([gl_FUNC_FFLUSH],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
gl_FUNC_FFLUSH_STDIN
if test $gl_cv_func_fflush_stdin = no; then
REPLACE_FFLUSH=1
fi
])
dnl Determine whether fflush works on input streams.
dnl Sets gl_cv_func_fflush_stdin.
AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
[
AC_CACHE_CHECK([whether fflush works on input streams],
[gl_cv_func_fflush_stdin],
[echo hello world > conftest.txt
AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[
#include <stdio.h>
#include <unistd.h>
]], [[FILE *f = fopen ("conftest.txt", "r");
char buffer[10];
int fd;
int c;
if (f == NULL)
return 1;
fd = fileno (f);
if (fd < 0 || fread (buffer, 1, 5, f) != 5)
return 2;
/* For deterministic results, ensure f read a bigger buffer. */
if (lseek (fd, 0, SEEK_CUR) == 5)
return 3;
/* POSIX requires fflush-fseek to set file offset of fd. This fails
on BSD systems and on mingw. */
if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0)
return 4;
if (lseek (fd, 0, SEEK_CUR) != 5)
return 5;
/* Verify behaviour of fflush after ungetc. See
<http://www.opengroup.org/austin/aardvark/latest/xshbug3.txt> */
/* Verify behaviour of fflush after a backup ungetc. This fails on
mingw. */
c = fgetc (f);
ungetc (c, f);
fflush (f);
if (fgetc (f) != c)
return 6;
/* Verify behaviour of fflush after a non-backup ungetc. This fails
on glibc 2.8 and on BSD systems. */
c = fgetc (f);
ungetc ('@', f);
fflush (f);
if (fgetc (f) != c)
return 7;
return 0;
]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no],
[dnl Pessimistically assume fflush is broken.
gl_cv_func_fflush_stdin=no])
rm conftest.txt
])
])
# Prerequisites of lib/fflush.c.
AC_DEFUN([gl_PREREQ_FFLUSH],
[
AC_REQUIRE([AC_C_INLINE])
:
])

View file

@ -1,4 +1,4 @@
# flock.m4 serial 2 # flock.m4 serial 3
dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -10,8 +10,6 @@ AC_DEFUN([gl_FUNC_FLOCK],
AC_CHECK_FUNCS_ONCE([flock]) AC_CHECK_FUNCS_ONCE([flock])
if test $ac_cv_func_flock = no; then if test $ac_cv_func_flock = no; then
HAVE_FLOCK=0 HAVE_FLOCK=0
AC_LIBOBJ([flock])
gl_PREREQ_FLOCK
fi fi
]) ])

View file

@ -1,4 +1,4 @@
# floor.m4 serial 5 # floor.m4 serial 6
dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -48,7 +48,7 @@ int main()
fi fi
]) ])
if test $REPLACE_FLOOR = 1; then if test $REPLACE_FLOOR = 1; then
AC_LIBOBJ([floor]) dnl No libraries are needed to link lib/floor.c.
FLOOR_LIBM= FLOOR_LIBM=
fi fi
AC_SUBST([FLOOR_LIBM]) AC_SUBST([FLOOR_LIBM])

45
m4/fpurge.m4 Normal file
View file

@ -0,0 +1,45 @@
# fpurge.m4 serial 7
dnl Copyright (C) 2007, 2009-2011 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_FPURGE],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_CHECK_FUNCS_ONCE([fpurge])
AC_CHECK_FUNCS_ONCE([__fpurge])
AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]])
if test "x$ac_cv_func_fpurge" = xyes; then
HAVE_FPURGE=1
# Detect BSD bug. Only cygwin 1.7 is known to be immune.
AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
]], [FILE *f = fopen ("conftest.txt", "w+");
if (!f) return 1;
if (fputc ('a', f) != 'a') return 2;
rewind (f);
if (fgetc (f) != 'a') return 3;
if (fgetc (f) != EOF) return 4;
if (fpurge (f) != 0) return 5;
if (putc ('b', f) != 'b') return 6;
if (fclose (f) != 0) return 7;
if ((f = fopen ("conftest.txt", "r")) == NULL) return 8;
if (fgetc (f) != 'a') return 9;
if (fgetc (f) != 'b') return 10;
if (fgetc (f) != EOF) return 11;
if (fclose (f) != 0) return 12;
if (remove ("conftest.txt") != 0) return 13;
return 0;])],
[gl_cv_func_fpurge_works=yes], [gl_cv_func_fpurge_works=no],
[gl_cv_func_fpurge_works='guessing no'])])
if test "x$gl_cv_func_fpurge_works" != xyes; then
REPLACE_FPURGE=1
fi
else
HAVE_FPURGE=0
fi
if test "x$ac_cv_have_decl_fpurge" = xno; then
HAVE_DECL_FPURGE=0
fi
])

10
m4/freading.m4 Normal file
View file

@ -0,0 +1,10 @@
# freading.m4 serial 1
dnl Copyright (C) 2007, 2009-2011 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_FREADING],
[
AC_CHECK_FUNCS_ONCE([__freading])
])

View file

@ -1,4 +1,4 @@
# frexp.m4 serial 10 # frexp.m4 serial 11
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -44,8 +44,6 @@ AC_DEFUN([gl_FUNC_FREXP],
if test $gl_func_frexp = yes; then if test $gl_func_frexp = yes; then
AC_DEFINE([HAVE_FREXP], [1], AC_DEFINE([HAVE_FREXP], [1],
[Define if the frexp() function is available and works.]) [Define if the frexp() function is available and works.])
else
AC_LIBOBJ([frexp])
fi fi
AC_SUBST([FREXP_LIBM]) AC_SUBST([FREXP_LIBM])
]) ])
@ -68,8 +66,6 @@ AC_DEFUN([gl_FUNC_FREXP_NO_LIBM],
if test $gl_func_frexp_no_libm = yes; then if test $gl_func_frexp_no_libm = yes; then
AC_DEFINE([HAVE_FREXP_IN_LIBC], [1], AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
[Define if the frexp() function is available in libc.]) [Define if the frexp() function is available in libc.])
else
AC_LIBOBJ([frexp])
fi fi
]) ])

15
m4/fseek.m4 Normal file
View file

@ -0,0 +1,15 @@
# fseek.m4 serial 4
dnl Copyright (C) 2007, 2009-2011 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_FSEEK],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_FSEEKO])
dnl When fseeko needs fixes, fseek needs them too.
if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
REPLACE_FSEEK=1
fi
])

61
m4/fseeko.m4 Normal file
View file

@ -0,0 +1,61 @@
# fseeko.m4 serial 15
dnl Copyright (C) 2007-2011 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_FSEEKO],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
AC_REQUIRE([AC_PROG_CC])
dnl Persuade glibc <stdio.h> to declare fseeko().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
]], [fseeko (stdin, 0, 0);])],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
AC_CHECK_DECLS_ONCE([fseeko])
if test $ac_cv_have_decl_fseeko = no; then
HAVE_DECL_FSEEKO=0
fi
if test $gl_cv_func_fseeko = no; then
HAVE_FSEEKO=0
else
if test $gl_cv_var_stdin_large_offset = no; then
REPLACE_FSEEKO=1
fi
m4_ifdef([gl_FUNC_FFLUSH_STDIN], [
gl_FUNC_FFLUSH_STDIN
if test $gl_cv_func_fflush_stdin = no; then
REPLACE_FSEEKO=1
fi
])
fi
])
dnl Code shared by fseeko and ftello. Determine if large files are supported,
dnl but stdin does not start as a large file by default.
AC_DEFUN([gl_STDIN_LARGE_OFFSET],
[
AC_CACHE_CHECK([whether stdin defaults to large file offsets],
[gl_cv_var_stdin_large_offset],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
[[#if defined __SL64 && defined __SCLE /* cygwin */
/* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and
it is easier to do a version check than building a runtime test. */
# include <cygwin/version.h>
# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
choke me
# endif
#endif]])],
[gl_cv_var_stdin_large_offset=yes],
[gl_cv_var_stdin_large_offset=no])])
])

15
m4/ftell.m4 Normal file
View file

@ -0,0 +1,15 @@
# ftell.m4 serial 3
dnl Copyright (C) 2007, 2009-2011 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_FTELL],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_FTELLO])
dnl When ftello needs fixes, ftell needs them too.
if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
REPLACE_FTELL=1
fi
])

127
m4/ftello.m4 Normal file
View file

@ -0,0 +1,127 @@
# ftello.m4 serial 10
dnl Copyright (C) 2007-2011 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_FTELLO],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
dnl Persuade glibc <stdio.h> to declare ftello().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_CHECK_DECLS_ONCE([ftello])
if test $ac_cv_have_decl_ftello = no; then
HAVE_DECL_FTELLO=0
fi
AC_CACHE_CHECK([for ftello], [gl_cv_func_ftello],
[
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdio.h>]],
[[ftello (stdin);]])],
[gl_cv_func_ftello=yes],
[gl_cv_func_ftello=no])
])
if test $gl_cv_func_ftello = no; then
HAVE_FTELLO=0
else
if test $gl_cv_var_stdin_large_offset = no; then
REPLACE_FTELLO=1
else
dnl Detect bug on Solaris.
dnl ftell and ftello produce incorrect results after putc that followed a
dnl getc call that reached EOF on Solaris. This is because the _IOREAD
dnl flag does not get cleared in this case, even though _IOWRT gets set,
dnl and ftell and ftello look whether the _IOREAD flag is set.
AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([whether ftello works],
[gl_cv_func_ftello_works],
[
dnl Initial guess, used when cross-compiling or when /dev/tty cannot
dnl be opened.
changequote(,)dnl
case "$host_os" in
# Guess no on Solaris.
solaris*) gl_cv_func_ftello_works="guessing no" ;;
# Guess yes otherwise.
*) gl_cv_func_ftello_works="guessing yes" ;;
esac
changequote([,])dnl
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TESTFILE "conftest.tmp"
int
main (void)
{
FILE *fp;
/* Create a file with some contents. */
fp = fopen (TESTFILE, "w");
if (fp == NULL)
return 70;
if (fwrite ("foogarsh", 1, 8, fp) < 8)
return 71;
if (fclose (fp))
return 72;
/* The file's contents is now "foogarsh". */
/* Try writing after reading to EOF. */
fp = fopen (TESTFILE, "r+");
if (fp == NULL)
return 73;
if (fseek (fp, -1, SEEK_END))
return 74;
if (!(getc (fp) == 'h'))
return 1;
if (!(getc (fp) == EOF))
return 2;
if (!(ftell (fp) == 8))
return 3;
if (!(ftell (fp) == 8))
return 4;
if (!(putc ('!', fp) == '!'))
return 5;
if (!(ftell (fp) == 9))
return 6;
if (!(fclose (fp) == 0))
return 7;
fp = fopen (TESTFILE, "r");
if (fp == NULL)
return 75;
{
char buf[10];
if (!(fread (buf, 1, 10, fp) == 9))
return 10;
if (!(memcmp (buf, "foogarsh!", 9) == 0))
return 11;
}
if (!(fclose (fp) == 0))
return 12;
/* The file's contents is now "foogarsh!". */
return 0;
}]])],
[gl_cv_func_ftello_works=yes],
[gl_cv_func_ftello_works=no], [:])
])
case "$gl_cv_func_ftello_works" in
*yes) ;;
*)
REPLACE_FTELLO=1
AC_DEFINE([FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE], [1],
[Define to 1 if the system's ftello function has the Solaris bug.])
;;
esac
fi
fi
])

View file

@ -1,4 +1,4 @@
# getaddrinfo.m4 serial 24 # getaddrinfo.m4 serial 26
dnl Copyright (C) 2004-2011 Free Software Foundation, Inc. dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -24,6 +24,7 @@ AC_DEFUN([gl_GETADDRINFO],
fi]) fi])
LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
HAVE_GETADDRINFO=1
AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [ AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h> #include <sys/types.h>
@ -55,16 +56,14 @@ AC_DEFUN([gl_GETADDRINFO],
GETADDRINFO_LIB="-lws2_32" GETADDRINFO_LIB="-lws2_32"
LIBS="$gai_saved_LIBS $GETADDRINFO_LIB" LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
else else
AC_LIBOBJ([getaddrinfo]) HAVE_GETADDRINFO=0
fi fi
fi fi
# We can't use AC_REPLACE_FUNCS here because gai_strerror may be an # 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 # inline function declared in ws2tcpip.h, so we need to get that
# header included somehow. # header included somehow.
AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)], AC_CHECK_DECLS([gai_strerror, gai_strerrorA], [], [break], [[
gl_cv_func_gai_strerror, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
@ -76,11 +75,29 @@ AC_DEFUN([gl_GETADDRINFO],
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif
#include <stddef.h> #include <stddef.h>
]], [[gai_strerror (NULL);]])], ]])
[gl_cv_func_gai_strerror=yes], if test $ac_cv_have_decl_gai_strerror = yes; then
[gl_cv_func_gai_strerror=no])]) dnl check for correct signature
if test $gl_cv_func_gai_strerror = no; then AC_CACHE_CHECK([for gai_strerror with POSIX signature],
AC_LIBOBJ([gai_strerror]) [gl_cv_func_gai_strerror_posix_signature], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
#include <stddef.h>
extern const char *gai_strerror(int);]])],
[gl_cv_func_gai_strerror_posix_signature=yes],
[gl_cv_func_gai_strerror_posix_signature=no])])
if test $gl_cv_func_gai_strerror_posix_signature = no; then
REPLACE_GAI_STRERROR=1
fi
fi fi
LIBS="$gai_saved_LIBS" LIBS="$gai_saved_LIBS"
@ -112,7 +129,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
AC_CHECK_HEADERS_ONCE([netinet/in.h]) AC_CHECK_HEADERS_ONCE([netinet/in.h])
AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror, getnameinfo],,,[ AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, getnameinfo],,,[
/* sys/types.h is not needed according to POSIX, but the /* sys/types.h is not needed according to POSIX, but the
sys/socket.h in i386-unknown-freebsd4.10 and sys/socket.h in i386-unknown-freebsd4.10 and
powerpc-apple-darwin5.5 required it. */ powerpc-apple-darwin5.5 required it. */

View file

@ -15,7 +15,7 @@
# Specification in the form of a command-line invocation: # Specification in the form of a command-line invocation:
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar # gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom send sendto setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
# Specification in the form of a few gnulib-tool.m4 macro invocations: # Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([]) gl_LOCAL_DIR([])
@ -67,6 +67,8 @@ gl_MODULES([
malloc-gnu malloc-gnu
malloca malloca
nproc nproc
open
pipe2
putenv putenv
recv recv
recvfrom recvfrom
@ -99,4 +101,5 @@ gl_MAKEFILE_NAME([])
gl_LIBTOOL gl_LIBTOOL
gl_MACRO_PREFIX([gl]) gl_MACRO_PREFIX([gl])
gl_PO_DOMAIN([]) gl_PO_DOMAIN([])
gl_WITNESS_C_DOMAIN([])
gl_VC_FILES([false]) gl_VC_FILES([false])

View file

@ -1,4 +1,4 @@
# gnulib-common.m4 serial 24 # gnulib-common.m4 serial 26
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -34,6 +34,20 @@ AC_DEFUN([gl_COMMON_BODY], [
/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
is a misnomer outside of parameter lists. */ is a misnomer outside of parameter lists. */
#define _UNUSED_PARAMETER_ _GL_UNUSED #define _UNUSED_PARAMETER_ _GL_UNUSED
/* The __pure__ attribute was added in gcc 2.96. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
# define _GL_ATTRIBUTE_PURE /* empty */
#endif
/* The __const__ attribute was added in gcc 2.95. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
#else
# define _GL_ATTRIBUTE_CONST /* empty */
#endif
]) ])
dnl Preparation for running test programs: dnl Preparation for running test programs:
dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
@ -47,16 +61,49 @@ AC_DEFUN([gl_COMMON_BODY], [
# expands to a C preprocessor expression that evaluates to 1 or 0, depending # expands to a C preprocessor expression that evaluates to 1 or 0, depending
# whether a gnulib module that has been requested shall be considered present # whether a gnulib module that has been requested shall be considered present
# or not. # or not.
AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) # gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
# sets the shell variable that indicates the presence of the given module to # sets the shell variable that indicates the presence of the given module to
# a C preprocessor expression that will evaluate to 1. # a C preprocessor expression that will evaluate to 1.
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
[ [
GNULIB_[]m4_translit([[$1]], gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
[abcdefghijklmnopqrstuvwxyz./-], [GNULIB_[]m4_translit([[$1]],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION [abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])],
[gl_MODULE_INDICATOR_CONDITION])
])
# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable])
# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION.
# The shell variable's value is a C preprocessor expression that evaluates
# to 0 or 1.
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX],
[
m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1],
[
dnl Simplify the expression VALUE || 1 to 1.
$1=1
],
[gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1],
[gl_MODULE_INDICATOR_CONDITION])])
])
# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition])
# modifies the shell variable to include the given condition. The shell
# variable's value is a C preprocessor expression that evaluates to 0 or 1.
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR],
[
dnl Simplify the expression 1 || CONDITION to 1.
if test "$[]$1" != 1; then
dnl Simplify the expression 0 || CONDITION to CONDITION.
if test "$[]$1" = 0; then
$1=$2
else
$1="($[]$1 || $2)"
fi
fi
]) ])
# gl_MODULE_INDICATOR([modulename]) # gl_MODULE_INDICATOR([modulename])

View file

@ -35,6 +35,7 @@ AC_DEFUN([gl_EARLY],
# Code from module arpa_inet: # Code from module arpa_inet:
# Code from module autobuild: # Code from module autobuild:
AB_INIT AB_INIT
# Code from module binary-io:
# Code from module bind: # Code from module bind:
# Code from module byteswap: # Code from module byteswap:
# Code from module c++defs: # Code from module c++defs:
@ -52,13 +53,24 @@ AC_DEFUN([gl_EARLY],
# Code from module extensions: # Code from module extensions:
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
# Code from module fclose: # Code from module fclose:
# Code from module fcntl-h:
# Code from module fd-hook: # Code from module fd-hook:
# Code from module fflush:
AC_REQUIRE([AC_FUNC_FSEEKO])
# Code from module float: # Code from module float:
# Code from module flock: # Code from module flock:
# Code from module floor: # Code from module floor:
# Code from module fpieee: # Code from module fpieee:
AC_REQUIRE([gl_FP_IEEE]) AC_REQUIRE([gl_FP_IEEE])
# Code from module fpurge:
# Code from module freading:
# Code from module frexp: # Code from module frexp:
# Code from module fseek:
# Code from module fseeko:
AC_REQUIRE([AC_FUNC_FSEEKO])
# Code from module ftell:
# Code from module ftello:
AC_REQUIRE([AC_FUNC_FSEEKO])
# Code from module full-read: # Code from module full-read:
# Code from module full-write: # Code from module full-write:
# Code from module func: # Code from module func:
@ -97,6 +109,7 @@ AC_DEFUN([gl_EARLY],
# Code from module listen: # Code from module listen:
# Code from module locale: # Code from module locale:
# Code from module log1p: # Code from module log1p:
# Code from module lseek:
# Code from module lstat: # Code from module lstat:
# Code from module maintainer-makefile: # Code from module maintainer-makefile:
# Code from module malloc-gnu: # Code from module malloc-gnu:
@ -107,8 +120,11 @@ AC_DEFUN([gl_EARLY],
# Code from module multiarch: # Code from module multiarch:
# Code from module netdb: # Code from module netdb:
# Code from module netinet_in: # Code from module netinet_in:
# Code from module nocrash:
# Code from module nproc: # Code from module nproc:
# Code from module open:
# Code from module pathmax: # Code from module pathmax:
# Code from module pipe2:
# Code from module putenv: # Code from module putenv:
# Code from module read: # Code from module read:
# Code from module readlink: # Code from module readlink:
@ -181,375 +197,390 @@ AC_DEFUN([gl_INIT],
m4_pushdef([gl_LIBSOURCES_DIR], []) m4_pushdef([gl_LIBSOURCES_DIR], [])
gl_COMMON gl_COMMON
gl_source_base='lib' gl_source_base='lib'
# Code from module accept: AC_REQUIRE([gl_HEADER_SYS_SOCKET])
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) if test "$ac_cv_header_winsock2_h" = yes; then
if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([accept])
AC_LIBOBJ([accept]) fi
fi gl_SYS_SOCKET_MODULE_INDICATOR([accept])
gl_SYS_SOCKET_MODULE_INDICATOR([accept]) gl_FUNC_ALLOCA
# Code from module alignof: gl_HEADER_ARPA_INET
# Code from module alloca-opt: AC_PROG_MKDIR_P
gl_FUNC_ALLOCA AC_REQUIRE([gl_HEADER_SYS_SOCKET])
# Code from module announce-gen: if test "$ac_cv_header_winsock2_h" = yes; then
# Code from module arg-nonnull: AC_LIBOBJ([bind])
# Code from module arpa_inet: fi
gl_HEADER_ARPA_INET gl_SYS_SOCKET_MODULE_INDICATOR([bind])
AC_PROG_MKDIR_P gl_BYTESWAP
# Code from module autobuild: gl_CANONICALIZE_LGPL
# Code from module bind: if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_LIBOBJ([canonicalize-lgpl])
if test "$ac_cv_header_winsock2_h" = yes; then fi
AC_LIBOBJ([bind]) gl_MODULE_INDICATOR([canonicalize-lgpl])
fi gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
gl_SYS_SOCKET_MODULE_INDICATOR([bind]) gl_STDLIB_MODULE_INDICATOR([realpath])
# Code from module byteswap: gl_FUNC_CEIL
gl_BYTESWAP if test $REPLACE_CEIL = 1; then
# Code from module c++defs: AC_LIBOBJ([ceil])
# Code from module c-ctype: fi
# Code from module c-strcase: gl_MATH_MODULE_INDICATOR([ceil])
# Code from module c-strcaseeq: gl_FUNC_CLOSE
# Code from module canonicalize-lgpl: gl_UNISTD_MODULE_INDICATOR([close])
gl_CANONICALIZE_LGPL AC_REQUIRE([gl_HEADER_SYS_SOCKET])
gl_MODULE_INDICATOR([canonicalize-lgpl]) if test "$ac_cv_header_winsock2_h" = yes; then
gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name]) AC_LIBOBJ([connect])
gl_STDLIB_MODULE_INDICATOR([realpath]) fi
# Code from module ceil: gl_SYS_SOCKET_MODULE_INDICATOR([connect])
gl_FUNC_CEIL gl_FUNC_DUPLOCALE
gl_MATH_MODULE_INDICATOR([ceil]) if test $REPLACE_DUPLOCALE = 1; then
# Code from module close: AC_LIBOBJ([duplocale])
gl_FUNC_CLOSE gl_PREREQ_DUPLOCALE
gl_UNISTD_MODULE_INDICATOR([close]) fi
# Code from module connect: gl_LOCALE_MODULE_INDICATOR([duplocale])
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) gl_ENVIRON
if test "$ac_cv_header_winsock2_h" = yes; then gl_UNISTD_MODULE_INDICATOR([environ])
AC_LIBOBJ([connect]) gl_HEADER_ERRNO_H
fi gl_FUNC_FCLOSE
gl_SYS_SOCKET_MODULE_INDICATOR([connect]) gl_STDIO_MODULE_INDICATOR([fclose])
# Code from module dosname: gl_FCNTL_H
# Code from module duplocale: gl_FUNC_FFLUSH
gl_FUNC_DUPLOCALE if test $REPLACE_FFLUSH = 1; then
gl_LOCALE_MODULE_INDICATOR([duplocale]) AC_LIBOBJ([fflush])
# Code from module environ: gl_PREREQ_FFLUSH
gl_ENVIRON fi
gl_UNISTD_MODULE_INDICATOR([environ]) gl_MODULE_INDICATOR([fflush])
# Code from module errno: gl_STDIO_MODULE_INDICATOR([fflush])
gl_HEADER_ERRNO_H gl_FLOAT_H
# Code from module extensions: gl_FUNC_FLOCK
# Code from module fclose: if test $HAVE_FLOCK = 0; then
gl_FUNC_FCLOSE AC_LIBOBJ([flock])
gl_STDIO_MODULE_INDICATOR([fclose]) gl_PREREQ_FLOCK
# Code from module fd-hook: fi
# Code from module float: gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock])
gl_FLOAT_H gl_FUNC_FLOOR
# Code from module flock: if test $REPLACE_FLOOR = 1; then
gl_FUNC_FLOCK AC_LIBOBJ([floor])
gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock]) fi
# Code from module floor: gl_MATH_MODULE_INDICATOR([floor])
gl_FUNC_FLOOR gl_FUNC_FPURGE
gl_MATH_MODULE_INDICATOR([floor]) if test $HAVE_FPURGE = 0 || test $REPLACE_FPURGE = 1; then
# Code from module fpieee: AC_LIBOBJ([fpurge])
# Code from module frexp: fi
gl_FUNC_FREXP gl_STDIO_MODULE_INDICATOR([fpurge])
gl_MATH_MODULE_INDICATOR([frexp]) gl_FUNC_FREADING
# Code from module full-read: gl_FUNC_FREXP
# Code from module full-write: if test $gl_func_frexp != yes; then
# Code from module func: AC_LIBOBJ([frexp])
gl_FUNC fi
# Code from module gendocs: gl_MATH_MODULE_INDICATOR([frexp])
# Code from module getaddrinfo: gl_FUNC_FSEEK
gl_GETADDRINFO if test $REPLACE_FSEEK = 1; then
gl_NETDB_MODULE_INDICATOR([getaddrinfo]) AC_LIBOBJ([fseek])
# Code from module getpeername: fi
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) gl_STDIO_MODULE_INDICATOR([fseek])
if test "$ac_cv_header_winsock2_h" = yes; then gl_FUNC_FSEEKO
AC_LIBOBJ([getpeername]) if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
fi AC_LIBOBJ([fseeko])
gl_SYS_SOCKET_MODULE_INDICATOR([getpeername]) fi
# Code from module getsockname: gl_STDIO_MODULE_INDICATOR([fseeko])
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) gl_FUNC_FTELL
if test "$ac_cv_header_winsock2_h" = yes; then if test $REPLACE_FTELL = 1; then
AC_LIBOBJ([getsockname]) AC_LIBOBJ([ftell])
fi fi
gl_SYS_SOCKET_MODULE_INDICATOR([getsockname]) gl_STDIO_MODULE_INDICATOR([ftell])
# Code from module getsockopt: gl_FUNC_FTELLO
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([ftello])
AC_LIBOBJ([getsockopt]) fi
fi gl_STDIO_MODULE_INDICATOR([ftello])
gl_SYS_SOCKET_MODULE_INDICATOR([getsockopt]) gl_FUNC
# Code from module gettext-h: gl_GETADDRINFO
AC_SUBST([LIBINTL]) if test $HAVE_GETADDRINFO = 0; then
AC_SUBST([LTLIBINTL]) AC_LIBOBJ([getaddrinfo])
# Code from module git-version-gen: fi
# Code from module gitlog-to-changelog: if test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1; then
# Code from module gnu-web-doc-update: AC_LIBOBJ([gai_strerror])
# Code from module gnumakefile: fi
# Autoconf 2.61a.99 and earlier don't support linking a file only gl_NETDB_MODULE_INDICATOR([getaddrinfo])
# in VPATH builds. But since GNUmakefile is for maintainer use AC_REQUIRE([gl_HEADER_SYS_SOCKET])
# only, it does not matter if we skip the link with older autoconf. if test "$ac_cv_header_winsock2_h" = yes; then
# Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH AC_LIBOBJ([getpeername])
# builds, so use a shell variable to bypass this. fi
GNUmakefile=GNUmakefile gl_SYS_SOCKET_MODULE_INDICATOR([getpeername])
m4_if(m4_version_compare([2.61a.100], AC_REQUIRE([gl_HEADER_SYS_SOCKET])
m4_defn([m4_PACKAGE_VERSION])), [1], [], if test "$ac_cv_header_winsock2_h" = yes; then
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [], AC_LIBOBJ([getsockname])
[GNUmakefile=$GNUmakefile])]) fi
# Code from module gnupload: gl_SYS_SOCKET_MODULE_INDICATOR([getsockname])
# Code from module gperf: AC_REQUIRE([gl_HEADER_SYS_SOCKET])
# Code from module havelib: if test "$ac_cv_header_winsock2_h" = yes; then
# Code from module hostent: AC_LIBOBJ([getsockopt])
gl_HOSTENT fi
# Code from module iconv: gl_SYS_SOCKET_MODULE_INDICATOR([getsockopt])
AM_ICONV AC_SUBST([LIBINTL])
m4_ifdef([gl_ICONV_MODULE_INDICATOR], AC_SUBST([LTLIBINTL])
[gl_ICONV_MODULE_INDICATOR([iconv])]) # Autoconf 2.61a.99 and earlier don't support linking a file only
# Code from module iconv-h: # in VPATH builds. But since GNUmakefile is for maintainer use
gl_ICONV_H # only, it does not matter if we skip the link with older autoconf.
# Code from module iconv_open: # Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH
gl_FUNC_ICONV_OPEN # builds, so use a shell variable to bypass this.
# Code from module iconv_open-utf: GNUmakefile=GNUmakefile
gl_FUNC_ICONV_OPEN_UTF m4_if(m4_version_compare([2.61a.100],
# Code from module include_next: m4_defn([m4_PACKAGE_VERSION])), [1], [],
# Code from module inet_ntop: [AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
gl_FUNC_INET_NTOP [GNUmakefile=$GNUmakefile])])
gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) gl_HOSTENT
# Code from module inet_pton: AM_ICONV
gl_FUNC_INET_PTON m4_ifdef([gl_ICONV_MODULE_INDICATOR],
gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) [gl_ICONV_MODULE_INDICATOR([iconv])])
# Code from module inline: gl_ICONV_H
gl_INLINE gl_FUNC_ICONV_OPEN
# Code from module isinf: if test $REPLACE_ICONV_OPEN = 1; then
gl_ISINF AC_LIBOBJ([iconv_open])
gl_MATH_MODULE_INDICATOR([isinf]) fi
# Code from module isnan: if test $REPLACE_ICONV = 1; then
gl_ISNAN AC_LIBOBJ([iconv])
gl_MATH_MODULE_INDICATOR([isnan]) AC_LIBOBJ([iconv_close])
# Code from module isnand: fi
gl_FUNC_ISNAND gl_FUNC_ICONV_OPEN_UTF
gl_MATH_MODULE_INDICATOR([isnand]) gl_FUNC_INET_NTOP
# Code from module isnand-nolibm: if test $HAVE_INET_NTOP = 0; then
gl_FUNC_ISNAND_NO_LIBM AC_LIBOBJ([inet_ntop])
# Code from module isnanf: gl_PREREQ_INET_NTOP
gl_FUNC_ISNANF fi
gl_MATH_MODULE_INDICATOR([isnanf]) gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
# Code from module isnanl: gl_FUNC_INET_PTON
gl_FUNC_ISNANL if test $HAVE_INET_PTON = 0; then
gl_MATH_MODULE_INDICATOR([isnanl]) AC_LIBOBJ([inet_pton])
# Code from module ldexp: gl_PREREQ_INET_PTON
gl_FUNC_LDEXP fi
# Code from module lib-symbol-versions: gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
gl_LD_VERSION_SCRIPT gl_INLINE
# Code from module lib-symbol-visibility: gl_ISINF
gl_VISIBILITY if test $REPLACE_ISINF = 1; then
# Code from module libunistring: AC_LIBOBJ([isinf])
gl_LIBUNISTRING fi
# Code from module listen: gl_MATH_MODULE_INDICATOR([isinf])
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) gl_ISNAN
if test "$ac_cv_header_winsock2_h" = yes; then gl_MATH_MODULE_INDICATOR([isnan])
AC_LIBOBJ([listen]) gl_FUNC_ISNAND
fi m4_ifdef([gl_ISNAN], [
gl_SYS_SOCKET_MODULE_INDICATOR([listen]) AC_REQUIRE([gl_ISNAN])
# Code from module locale: ])
gl_LOCALE_H if test $HAVE_ISNAND = 0 || test $REPLACE_ISNAN = 1; then
# Code from module log1p: AC_LIBOBJ([isnand])
gl_COMMON_DOUBLE_MATHFUNC([log1p]) gl_PREREQ_ISNAND
# Code from module lstat: fi
gl_FUNC_LSTAT gl_MATH_MODULE_INDICATOR([isnand])
gl_SYS_STAT_MODULE_INDICATOR([lstat]) gl_FUNC_ISNAND_NO_LIBM
# Code from module maintainer-makefile: if test $gl_func_isnand_no_libm != yes; then
AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER], AC_LIBOBJ([isnand])
[AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])]) gl_PREREQ_ISNAND
# Code from module malloc-gnu: fi
gl_FUNC_MALLOC_GNU gl_FUNC_ISNANF
gl_MODULE_INDICATOR([malloc-gnu]) m4_ifdef([gl_ISNAN], [
# Code from module malloc-posix: AC_REQUIRE([gl_ISNAN])
gl_FUNC_MALLOC_POSIX ])
gl_STDLIB_MODULE_INDICATOR([malloc-posix]) if test $HAVE_ISNANF = 0 || test $REPLACE_ISNAN = 1; then
# Code from module malloca: AC_LIBOBJ([isnanf])
gl_MALLOCA gl_PREREQ_ISNANF
# Code from module math: fi
gl_MATH_H gl_MATH_MODULE_INDICATOR([isnanf])
# Code from module memchr: gl_FUNC_ISNANL
gl_FUNC_MEMCHR m4_ifdef([gl_ISNAN], [
gl_STRING_MODULE_INDICATOR([memchr]) AC_REQUIRE([gl_ISNAN])
# Code from module multiarch: ])
gl_MULTIARCH if test $HAVE_ISNANL = 0 || test $REPLACE_ISNAN = 1; then
# Code from module netdb: AC_LIBOBJ([isnanl])
gl_HEADER_NETDB gl_PREREQ_ISNANL
# Code from module netinet_in: fi
gl_HEADER_NETINET_IN gl_MATH_MODULE_INDICATOR([isnanl])
AC_PROG_MKDIR_P gl_FUNC_LDEXP
# Code from module nproc: gl_LD_VERSION_SCRIPT
gl_NPROC gl_VISIBILITY
# Code from module pathmax: gl_LIBUNISTRING
gl_PATHMAX AC_REQUIRE([gl_HEADER_SYS_SOCKET])
# Code from module putenv: if test "$ac_cv_header_winsock2_h" = yes; then
gl_FUNC_PUTENV AC_LIBOBJ([listen])
gl_STDLIB_MODULE_INDICATOR([putenv]) fi
# Code from module read: gl_SYS_SOCKET_MODULE_INDICATOR([listen])
gl_FUNC_READ gl_LOCALE_H
gl_UNISTD_MODULE_INDICATOR([read]) gl_COMMON_DOUBLE_MATHFUNC([log1p])
# Code from module readlink: gl_FUNC_LSEEK
gl_FUNC_READLINK if test $REPLACE_LSEEK = 1; then
gl_UNISTD_MODULE_INDICATOR([readlink]) AC_LIBOBJ([lseek])
# Code from module recv: fi
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) gl_UNISTD_MODULE_INDICATOR([lseek])
if test "$ac_cv_header_winsock2_h" = yes; then gl_FUNC_LSTAT
AC_LIBOBJ([recv]) if test $REPLACE_LSTAT = 1; then
fi AC_LIBOBJ([lstat])
gl_SYS_SOCKET_MODULE_INDICATOR([recv]) gl_PREREQ_LSTAT
# Code from module recvfrom: fi
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) gl_SYS_STAT_MODULE_INDICATOR([lstat])
if test "$ac_cv_header_winsock2_h" = yes; then AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
AC_LIBOBJ([recvfrom]) [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
fi gl_FUNC_MALLOC_GNU
gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom]) if test $REPLACE_MALLOC = 1; then
# Code from module safe-read: AC_LIBOBJ([malloc])
gl_SAFE_READ fi
# Code from module safe-write: gl_MODULE_INDICATOR([malloc-gnu])
gl_SAFE_WRITE gl_FUNC_MALLOC_POSIX
# Code from module send: if test $REPLACE_MALLOC = 1; then
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_LIBOBJ([malloc])
if test "$ac_cv_header_winsock2_h" = yes; then fi
AC_LIBOBJ([send]) gl_STDLIB_MODULE_INDICATOR([malloc-posix])
fi gl_MALLOCA
gl_SYS_SOCKET_MODULE_INDICATOR([send]) gl_MATH_H
# Code from module sendto: gl_FUNC_MEMCHR
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([memchr])
AC_LIBOBJ([sendto]) gl_PREREQ_MEMCHR
fi fi
gl_SYS_SOCKET_MODULE_INDICATOR([sendto]) gl_STRING_MODULE_INDICATOR([memchr])
# Code from module servent: gl_MULTIARCH
gl_SERVENT gl_HEADER_NETDB
# Code from module setsockopt: gl_HEADER_NETINET_IN
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) AC_PROG_MKDIR_P
if test "$ac_cv_header_winsock2_h" = yes; then gl_NPROC
AC_LIBOBJ([setsockopt]) gl_FUNC_OPEN
fi gl_FCNTL_MODULE_INDICATOR([open])
gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt]) gl_PATHMAX
# Code from module shutdown: gl_FUNC_PIPE2
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) gl_UNISTD_MODULE_INDICATOR([pipe2])
if test "$ac_cv_header_winsock2_h" = yes; then gl_FUNC_PUTENV
AC_LIBOBJ([shutdown]) if test $REPLACE_PUTENV = 1; then
fi AC_LIBOBJ([putenv])
gl_SYS_SOCKET_MODULE_INDICATOR([shutdown]) fi
# Code from module size_max: gl_STDLIB_MODULE_INDICATOR([putenv])
gl_SIZE_MAX gl_FUNC_READ
# Code from module snprintf: if test $REPLACE_READ = 1; then
gl_FUNC_SNPRINTF AC_LIBOBJ([read])
gl_STDIO_MODULE_INDICATOR([snprintf]) fi
gl_MODULE_INDICATOR([snprintf]) gl_UNISTD_MODULE_INDICATOR([read])
# Code from module socket: gl_FUNC_READLINK
AC_REQUIRE([gl_HEADER_SYS_SOCKET]) if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([readlink])
AC_LIBOBJ([socket]) gl_PREREQ_READLINK
fi fi
# When this module is used, sockets may actually occur as file descriptors, gl_UNISTD_MODULE_INDICATOR([readlink])
# hence it is worth warning if the modules 'close' and 'ioctl' are not used. AC_REQUIRE([gl_HEADER_SYS_SOCKET])
m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) if test "$ac_cv_header_winsock2_h" = yes; then
m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) AC_LIBOBJ([recv])
AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2]) fi
if test "$ac_cv_header_winsock2_h" = yes; then gl_SYS_SOCKET_MODULE_INDICATOR([recv])
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 if test "$ac_cv_header_winsock2_h" = yes; then
fi AC_LIBOBJ([recvfrom])
gl_SYS_SOCKET_MODULE_INDICATOR([socket]) fi
# Code from module socketlib: gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
gl_SOCKETLIB gl_PREREQ_SAFE_READ
# Code from module sockets: gl_PREREQ_SAFE_WRITE
gl_SOCKETS AC_REQUIRE([gl_HEADER_SYS_SOCKET])
# Code from module socklen: if test "$ac_cv_header_winsock2_h" = yes; then
gl_TYPE_SOCKLEN_T AC_LIBOBJ([send])
# Code from module ssize_t: fi
gt_TYPE_SSIZE_T gl_SYS_SOCKET_MODULE_INDICATOR([send])
# Code from module stat: AC_REQUIRE([gl_HEADER_SYS_SOCKET])
gl_FUNC_STAT if test "$ac_cv_header_winsock2_h" = yes; then
gl_SYS_STAT_MODULE_INDICATOR([stat]) AC_LIBOBJ([sendto])
# Code from module stat-time: fi
gl_STAT_TIME gl_SYS_SOCKET_MODULE_INDICATOR([sendto])
gl_STAT_BIRTHTIME gl_SERVENT
# Code from module stdbool: AC_REQUIRE([gl_HEADER_SYS_SOCKET])
AM_STDBOOL_H if test "$ac_cv_header_winsock2_h" = yes; then
# Code from module stddef: AC_LIBOBJ([setsockopt])
gl_STDDEF_H fi
# Code from module stdint: gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt])
gl_STDINT_H AC_REQUIRE([gl_HEADER_SYS_SOCKET])
# Code from module stdio: if test "$ac_cv_header_winsock2_h" = yes; then
gl_STDIO_H AC_LIBOBJ([shutdown])
# Code from module stdlib: fi
gl_STDLIB_H gl_SYS_SOCKET_MODULE_INDICATOR([shutdown])
# Code from module strftime: gl_SIZE_MAX
gl_FUNC_GNU_STRFTIME gl_FUNC_SNPRINTF
# Code from module striconveh: gl_STDIO_MODULE_INDICATOR([snprintf])
if test $gl_cond_libtool = false; then gl_MODULE_INDICATOR([snprintf])
gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV" AC_REQUIRE([gl_HEADER_SYS_SOCKET])
gl_libdeps="$gl_libdeps $LIBICONV" if test "$ac_cv_header_winsock2_h" = yes; then
fi AC_LIBOBJ([socket])
# Code from module string: fi
gl_HEADER_STRING_H # When this module is used, sockets may actually occur as file descriptors,
# Code from module sys_file: # hence it is worth warning if the modules 'close' and 'ioctl' are not used.
gl_HEADER_SYS_FILE_H m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
AC_PROG_MKDIR_P m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
# Code from module sys_socket: AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])
gl_HEADER_SYS_SOCKET if test "$ac_cv_header_winsock2_h" = yes; then
AC_PROG_MKDIR_P UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
# Code from module sys_stat: SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
gl_HEADER_SYS_STAT_H fi
AC_PROG_MKDIR_P gl_SYS_SOCKET_MODULE_INDICATOR([socket])
# Code from module sys_time: gl_SOCKETLIB
gl_HEADER_SYS_TIME_H gl_SOCKETS
AC_PROG_MKDIR_P gl_TYPE_SOCKLEN_T
# Code from module sys_uio: gt_TYPE_SSIZE_T
gl_HEADER_SYS_UIO gl_FUNC_STAT
AC_PROG_MKDIR_P if test $REPLACE_STAT = 1; then
# Code from module time: AC_LIBOBJ([stat])
gl_HEADER_TIME_H gl_PREREQ_STAT
# Code from module time_r: fi
gl_TIME_R gl_SYS_STAT_MODULE_INDICATOR([stat])
gl_TIME_MODULE_INDICATOR([time_r]) gl_STAT_TIME
# Code from module trunc: gl_STAT_BIRTHTIME
gl_FUNC_TRUNC AM_STDBOOL_H
gl_MATH_MODULE_INDICATOR([trunc]) gl_STDDEF_H
# Code from module unistd: gl_STDINT_H
gl_UNISTD_H gl_STDIO_H
# Code from module unistr/base: gl_STDLIB_H
gl_LIBUNISTRING_LIBHEADER([0.9.2], [unistr.h]) gl_FUNC_GNU_STRFTIME
# Code from module unistr/u8-mbtouc: if test $gl_cond_libtool = false; then
gl_MODULE_INDICATOR([unistr/u8-mbtouc]) gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV"
gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc]) gl_libdeps="$gl_libdeps $LIBICONV"
# Code from module unistr/u8-mbtouc-unsafe: fi
gl_MODULE_INDICATOR([unistr/u8-mbtouc-unsafe]) gl_HEADER_STRING_H
gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc-unsafe]) gl_HEADER_SYS_FILE_H
# Code from module unistr/u8-mbtoucr: AC_PROG_MKDIR_P
gl_MODULE_INDICATOR([unistr/u8-mbtoucr]) gl_HEADER_SYS_SOCKET
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtoucr]) AC_PROG_MKDIR_P
# Code from module unistr/u8-prev: gl_HEADER_SYS_STAT_H
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-prev]) AC_PROG_MKDIR_P
# Code from module unistr/u8-uctomb: gl_HEADER_SYS_TIME_H
gl_MODULE_INDICATOR([unistr/u8-uctomb]) AC_PROG_MKDIR_P
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-uctomb]) gl_HEADER_SYS_UIO
# Code from module unitypes: AC_PROG_MKDIR_P
gl_LIBUNISTRING_LIBHEADER([0.9], [unitypes.h]) gl_HEADER_TIME_H
# Code from module unused-parameter: gl_TIME_R
# Code from module useless-if-before-free: if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
# Code from module vasnprintf: AC_LIBOBJ([time_r])
gl_FUNC_VASNPRINTF gl_PREREQ_TIME_R
# Code from module vc-list-files: fi
# Code from module verify: gl_TIME_MODULE_INDICATOR([time_r])
# Code from module vsnprintf: gl_FUNC_TRUNC
gl_FUNC_VSNPRINTF if test $HAVE_DECL_TRUNC = 0 || test $REPLACE_TRUNC = 1; then
gl_STDIO_MODULE_INDICATOR([vsnprintf]) AC_LIBOBJ([trunc])
# Code from module warn-on-use: fi
# Code from module warnings: gl_MATH_MODULE_INDICATOR([trunc])
AC_SUBST([WARN_CFLAGS]) gl_UNISTD_H
# Code from module wchar: gl_LIBUNISTRING_LIBHEADER([0.9.2], [unistr.h])
gl_WCHAR_H gl_MODULE_INDICATOR([unistr/u8-mbtouc])
# Code from module write: gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc])
gl_FUNC_WRITE gl_MODULE_INDICATOR([unistr/u8-mbtouc-unsafe])
gl_UNISTD_MODULE_INDICATOR([write]) gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc-unsafe])
# Code from module xsize: gl_MODULE_INDICATOR([unistr/u8-mbtoucr])
gl_XSIZE gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtoucr])
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-prev])
gl_MODULE_INDICATOR([unistr/u8-uctomb])
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-uctomb])
gl_LIBUNISTRING_LIBHEADER([0.9], [unitypes.h])
gl_FUNC_VASNPRINTF
gl_FUNC_VSNPRINTF
gl_STDIO_MODULE_INDICATOR([vsnprintf])
AC_SUBST([WARN_CFLAGS])
gl_WCHAR_H
gl_FUNC_WRITE
if test $REPLACE_WRITE = 1; then
AC_LIBOBJ([write])
fi
gl_UNISTD_MODULE_INDICATOR([write])
gl_XSIZE
# End of code from modules # End of code from modules
m4_ifval(gl_LIBSOURCES_LIST, [ m4_ifval(gl_LIBSOURCES_LIST, [
m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
@ -705,6 +736,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/alloca.in.h lib/alloca.in.h
lib/arpa_inet.in.h lib/arpa_inet.in.h
lib/asnprintf.c lib/asnprintf.c
lib/binary-io.h
lib/bind.c lib/bind.c
lib/byteswap.in.h lib/byteswap.in.h
lib/c-ctype.c lib/c-ctype.c
@ -721,13 +753,22 @@ AC_DEFUN([gl_FILE_LIST], [
lib/duplocale.c lib/duplocale.c
lib/errno.in.h lib/errno.in.h
lib/fclose.c lib/fclose.c
lib/fcntl.in.h
lib/fd-hook.c lib/fd-hook.c
lib/fd-hook.h lib/fd-hook.h
lib/fflush.c
lib/float+.h lib/float+.h
lib/float.in.h lib/float.in.h
lib/flock.c lib/flock.c
lib/floor.c lib/floor.c
lib/fpurge.c
lib/freading.c
lib/freading.h
lib/frexp.c lib/frexp.c
lib/fseek.c
lib/fseeko.c
lib/ftell.c
lib/ftello.c
lib/full-read.c lib/full-read.c
lib/full-read.h lib/full-read.h
lib/full-write.c lib/full-write.c
@ -759,6 +800,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/libunistring.valgrind lib/libunistring.valgrind
lib/listen.c lib/listen.c
lib/locale.in.h lib/locale.in.h
lib/lseek.c
lib/lstat.c lib/lstat.c
lib/malloc.c lib/malloc.c
lib/malloca.c lib/malloca.c
@ -771,7 +813,9 @@ AC_DEFUN([gl_FILE_LIST], [
lib/netinet_in.in.h lib/netinet_in.in.h
lib/nproc.c lib/nproc.c
lib/nproc.h lib/nproc.h
lib/open.c
lib/pathmax.h lib/pathmax.h
lib/pipe2.c
lib/printf-args.c lib/printf-args.c
lib/printf-args.h lib/printf-args.h
lib/printf-parse.c lib/printf-parse.c
@ -799,6 +843,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stdbool.in.h lib/stdbool.in.h
lib/stddef.in.h lib/stddef.in.h
lib/stdint.in.h lib/stdint.in.h
lib/stdio-impl.h
lib/stdio.in.h lib/stdio.in.h
lib/stdlib.in.h lib/stdlib.in.h
lib/strftime.c lib/strftime.c
@ -853,17 +898,27 @@ AC_DEFUN([gl_FILE_LIST], [
m4/exponentl.m4 m4/exponentl.m4
m4/extensions.m4 m4/extensions.m4
m4/fclose.m4 m4/fclose.m4
m4/fcntl-o.m4
m4/fcntl_h.m4
m4/fflush.m4
m4/float_h.m4 m4/float_h.m4
m4/flock.m4 m4/flock.m4
m4/floor.m4 m4/floor.m4
m4/fpieee.m4 m4/fpieee.m4
m4/fpurge.m4
m4/freading.m4
m4/frexp.m4 m4/frexp.m4
m4/fseek.m4
m4/fseeko.m4
m4/ftell.m4
m4/ftello.m4
m4/func.m4 m4/func.m4
m4/getaddrinfo.m4 m4/getaddrinfo.m4
m4/gnulib-common.m4 m4/gnulib-common.m4
m4/hostent.m4 m4/hostent.m4
m4/iconv.m4 m4/iconv.m4
m4/iconv_h.m4 m4/iconv_h.m4
m4/iconv_open-utf.m4
m4/iconv_open.m4 m4/iconv_open.m4
m4/include_next.m4 m4/include_next.m4
m4/inet_ntop.m4 m4/inet_ntop.m4
@ -885,6 +940,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/libunistring.m4 m4/libunistring.m4
m4/locale_h.m4 m4/locale_h.m4
m4/longlong.m4 m4/longlong.m4
m4/lseek.m4
m4/lstat.m4 m4/lstat.m4
m4/malloc.m4 m4/malloc.m4
m4/malloca.m4 m4/malloca.m4
@ -892,11 +948,15 @@ AC_DEFUN([gl_FILE_LIST], [
m4/mathfunc.m4 m4/mathfunc.m4
m4/memchr.m4 m4/memchr.m4
m4/mmap-anon.m4 m4/mmap-anon.m4
m4/mode_t.m4
m4/multiarch.m4 m4/multiarch.m4
m4/netdb_h.m4 m4/netdb_h.m4
m4/netinet_in_h.m4 m4/netinet_in_h.m4
m4/nocrash.m4
m4/nproc.m4 m4/nproc.m4
m4/open.m4
m4/pathmax.m4 m4/pathmax.m4
m4/pipe2.m4
m4/printf.m4 m4/printf.m4
m4/putenv.m4 m4/putenv.m4
m4/read.m4 m4/read.m4

231
m4/iconv_open-utf.m4 Normal file
View file

@ -0,0 +1,231 @@
# iconv_open-utf.m4 serial 1
dnl Copyright (C) 2007-2011 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.
# A placeholder to ensure that this m4 file gets included by aclocal.
AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF], [])
AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF_SUPPORT],
[
dnl This macro relies on am_cv_func_iconv and gl_func_iconv_gnu from
dnl gl_FUNC_ICONV_OPEN, but is called from within gl_FUNC_ICONV_OPEN.
dnl *Not* AC_REQUIRE([gl_FUNC_ICONV_OPEN]).
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_ICONV_H_DEFAULTS])
if test "$am_cv_func_iconv" = yes; then
AC_CACHE_CHECK([whether iconv supports conversion between UTF-8 and UTF-{16,32}{BE,LE}],
[gl_cv_func_iconv_supports_utf],
[
save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <iconv.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main ()
{
int result = 0;
/* Test conversion from UTF-8 to UTF-16BE with no errors. */
{
static const char input[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
static const char expected[] =
"\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]";
iconv_t cd;
cd = iconv_open ("UTF-16BE", "UTF-8");
if (cd == (iconv_t)(-1))
result |= 1;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 1;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 1;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 1;
else if (!(iconv_close (cd) == 0))
result |= 1;
}
}
/* Test conversion from UTF-8 to UTF-16LE with no errors. */
{
static const char input[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
static const char expected[] =
"J\000a\000p\000a\000n\000e\000s\000e\000 \000(\000\345\145\054\147\236\212)\000 \000[\000\065\330\015\335\065\330\036\335\065\330\055\335]\000";
iconv_t cd;
cd = iconv_open ("UTF-16LE", "UTF-8");
if (cd == (iconv_t)(-1))
result |= 2;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 2;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 2;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 2;
else if (!(iconv_close (cd) == 0))
result |= 2;
}
}
/* Test conversion from UTF-8 to UTF-32BE with no errors. */
{
static const char input[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
static const char expected[] =
"\000\000\000J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\145\345\000\000\147\054\000\000\212\236\000\000\000)\000\000\000 \000\000\000[\000\001\325\015\000\001\325\036\000\001\325\055\000\000\000]";
iconv_t cd;
cd = iconv_open ("UTF-32BE", "UTF-8");
if (cd == (iconv_t)(-1))
result |= 4;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 4;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 4;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 4;
else if (!(iconv_close (cd) == 0))
result |= 4;
}
}
/* Test conversion from UTF-8 to UTF-32LE with no errors. */
{
static const char input[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
static const char expected[] =
"J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\000\345\145\000\000\054\147\000\000\236\212\000\000)\000\000\000 \000\000\000[\000\000\000\015\325\001\000\036\325\001\000\055\325\001\000]\000\000\000";
iconv_t cd;
cd = iconv_open ("UTF-32LE", "UTF-8");
if (cd == (iconv_t)(-1))
result |= 8;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 8;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 8;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 8;
else if (!(iconv_close (cd) == 0))
result |= 8;
}
}
/* Test conversion from UTF-16BE to UTF-8 with no errors.
This test fails on NetBSD 3.0. */
{
static const char input[] =
"\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]";
static const char expected[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
iconv_t cd;
cd = iconv_open ("UTF-8", "UTF-16BE");
if (cd == (iconv_t)(-1))
result |= 16;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 16;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 16;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 16;
else if (!(iconv_close (cd) == 0))
result |= 16;
}
}
return result;
}]])],
[gl_cv_func_iconv_supports_utf=yes],
[gl_cv_func_iconv_supports_utf=no],
[
dnl We know that GNU libiconv, GNU libc, and Solaris >= 9 do.
dnl OSF/1 5.1 has these encodings, but inserts a BOM in the "to"
dnl direction.
gl_cv_func_iconv_supports_utf=no
if test $gl_func_iconv_gnu = yes; then
gl_cv_func_iconv_supports_utf=yes
else
changequote(,)dnl
case "$host_os" in
solaris2.9 | solaris2.1[0-9]) gl_cv_func_iconv_supports_utf=yes ;;
esac
changequote([,])dnl
fi
])
LIBS="$save_LIBS"
])
fi
])

View file

@ -1,4 +1,4 @@
# iconv_open.m4 serial 12 # iconv_open.m4 serial 14
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -36,6 +36,16 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN],
gl_REPLACE_ICONV_OPEN gl_REPLACE_ICONV_OPEN
fi fi
fi fi
m4_ifdef([gl_FUNC_ICONV_OPEN_UTF_SUPPORT], [
gl_FUNC_ICONV_OPEN_UTF_SUPPORT
if test $gl_cv_func_iconv_supports_utf = no; then
REPLACE_ICONV_UTF=1
AC_DEFINE([REPLACE_ICONV_UTF], [1],
[Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.])
REPLACE_ICONV=1
gl_REPLACE_ICONV_OPEN
fi
])
fi fi
]) ])
@ -43,235 +53,4 @@ AC_DEFUN([gl_REPLACE_ICONV_OPEN],
[ [
gl_REPLACE_ICONV_H gl_REPLACE_ICONV_H
REPLACE_ICONV_OPEN=1 REPLACE_ICONV_OPEN=1
AC_LIBOBJ([iconv_open])
])
AC_DEFUN([gl_FUNC_ICONV_OPEN_UTF],
[
AC_REQUIRE([gl_FUNC_ICONV_OPEN])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_ICONV_H_DEFAULTS])
if test "$am_cv_func_iconv" = yes; then
AC_CACHE_CHECK([whether iconv supports conversion between UTF-8 and UTF-{16,32}{BE,LE}],
[gl_cv_func_iconv_supports_utf],
[
save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <iconv.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main ()
{
int result = 0;
/* Test conversion from UTF-8 to UTF-16BE with no errors. */
{
static const char input[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
static const char expected[] =
"\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]";
iconv_t cd;
cd = iconv_open ("UTF-16BE", "UTF-8");
if (cd == (iconv_t)(-1))
result |= 1;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 1;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 1;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 1;
else if (!(iconv_close (cd) == 0))
result |= 1;
}
}
/* Test conversion from UTF-8 to UTF-16LE with no errors. */
{
static const char input[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
static const char expected[] =
"J\000a\000p\000a\000n\000e\000s\000e\000 \000(\000\345\145\054\147\236\212)\000 \000[\000\065\330\015\335\065\330\036\335\065\330\055\335]\000";
iconv_t cd;
cd = iconv_open ("UTF-16LE", "UTF-8");
if (cd == (iconv_t)(-1))
result |= 2;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 2;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 2;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 2;
else if (!(iconv_close (cd) == 0))
result |= 2;
}
}
/* Test conversion from UTF-8 to UTF-32BE with no errors. */
{
static const char input[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
static const char expected[] =
"\000\000\000J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\145\345\000\000\147\054\000\000\212\236\000\000\000)\000\000\000 \000\000\000[\000\001\325\015\000\001\325\036\000\001\325\055\000\000\000]";
iconv_t cd;
cd = iconv_open ("UTF-32BE", "UTF-8");
if (cd == (iconv_t)(-1))
result |= 4;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 4;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 4;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 4;
else if (!(iconv_close (cd) == 0))
result |= 4;
}
}
/* Test conversion from UTF-8 to UTF-32LE with no errors. */
{
static const char input[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
static const char expected[] =
"J\000\000\000a\000\000\000p\000\000\000a\000\000\000n\000\000\000e\000\000\000s\000\000\000e\000\000\000 \000\000\000(\000\000\000\345\145\000\000\054\147\000\000\236\212\000\000)\000\000\000 \000\000\000[\000\000\000\015\325\001\000\036\325\001\000\055\325\001\000]\000\000\000";
iconv_t cd;
cd = iconv_open ("UTF-32LE", "UTF-8");
if (cd == (iconv_t)(-1))
result |= 8;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 8;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 8;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 8;
else if (!(iconv_close (cd) == 0))
result |= 8;
}
}
/* Test conversion from UTF-16BE to UTF-8 with no errors.
This test fails on NetBSD 3.0. */
{
static const char input[] =
"\000J\000a\000p\000a\000n\000e\000s\000e\000 \000(\145\345\147\054\212\236\000)\000 \000[\330\065\335\015\330\065\335\036\330\065\335\055\000]";
static const char expected[] =
"Japanese (\346\227\245\346\234\254\350\252\236) [\360\235\224\215\360\235\224\236\360\235\224\255]";
iconv_t cd;
cd = iconv_open ("UTF-8", "UTF-16BE");
if (cd == (iconv_t)(-1))
result |= 16;
else
{
char buf[100];
const char *inptr;
size_t inbytesleft;
char *outptr;
size_t outbytesleft;
size_t res;
inptr = input;
inbytesleft = sizeof (input) - 1;
outptr = buf;
outbytesleft = sizeof (buf);
res = iconv (cd,
(ICONV_CONST char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (!(res == 0 && inbytesleft == 0))
result |= 16;
else if (!(outptr == buf + (sizeof (expected) - 1)))
result |= 16;
else if (!(memcmp (buf, expected, sizeof (expected) - 1) == 0))
result |= 16;
else if (!(iconv_close (cd) == 0))
result |= 16;
}
}
return result;
}]])],
[gl_cv_func_iconv_supports_utf=yes],
[gl_cv_func_iconv_supports_utf=no],
[
dnl We know that GNU libiconv, GNU libc, and Solaris >= 9 do.
dnl OSF/1 5.1 has these encodings, but inserts a BOM in the "to"
dnl direction.
gl_cv_func_iconv_supports_utf=no
if test $gl_func_iconv_gnu = yes; then
gl_cv_func_iconv_supports_utf=yes
else
changequote(,)dnl
case "$host_os" in
solaris2.9 | solaris2.1[0-9]) gl_cv_func_iconv_supports_utf=yes ;;
esac
changequote([,])dnl
fi
])
LIBS="$save_LIBS"
])
if test $gl_cv_func_iconv_supports_utf = no; then
REPLACE_ICONV_UTF=1
AC_DEFINE([REPLACE_ICONV_UTF], [1],
[Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.])
REPLACE_ICONV=1
gl_REPLACE_ICONV_OPEN
AC_LIBOBJ([iconv])
AC_LIBOBJ([iconv_close])
fi
fi
]) ])

View file

@ -1,4 +1,4 @@
# inet_ntop.m4 serial 13 # inet_ntop.m4 serial 15
dnl Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc. dnl Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -9,14 +9,18 @@ AC_DEFUN([gl_FUNC_INET_NTOP],
dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop. dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
gl_REPLACE_ARPA_INET_H
dnl Most platforms that provide inet_ntop define it in libc. dnl Most platforms that provide inet_ntop define it in libc.
dnl Solaris 8..10 provide inet_ntop in libnsl instead. dnl Solaris 8..10 provide inet_ntop in libnsl instead.
HAVE_INET_NTOP=1
gl_save_LIBS=$LIBS gl_save_LIBS=$LIBS
AC_SEARCH_LIBS([inet_ntop], [nsl], [], AC_SEARCH_LIBS([inet_ntop], [nsl], [],
[AC_REPLACE_FUNCS([inet_ntop])]) [AC_CHECK_FUNCS([inet_ntop])
if test $ac_cv_func_inet_ntop = no; then
HAVE_INET_NTOP=0
fi
])
LIBS=$gl_save_LIBS LIBS=$gl_save_LIBS
INET_NTOP_LIB= INET_NTOP_LIB=
if test "$ac_cv_search_inet_ntop" != "no" && if test "$ac_cv_search_inet_ntop" != "no" &&
test "$ac_cv_search_inet_ntop" != "none required"; then test "$ac_cv_search_inet_ntop" != "none required"; then
@ -24,11 +28,6 @@ AC_DEFUN([gl_FUNC_INET_NTOP],
fi fi
AC_SUBST([INET_NTOP_LIB]) AC_SUBST([INET_NTOP_LIB])
gl_PREREQ_INET_NTOP
])
# Prerequisites of lib/inet_ntop.c.
AC_DEFUN([gl_PREREQ_INET_NTOP], [
AC_CHECK_HEADERS_ONCE([netdb.h]) AC_CHECK_HEADERS_ONCE([netdb.h])
AC_CHECK_DECLS([inet_ntop],,, AC_CHECK_DECLS([inet_ntop],,,
[#include <arpa/inet.h> [#include <arpa/inet.h>
@ -38,7 +37,11 @@ AC_DEFUN([gl_PREREQ_INET_NTOP], [
]) ])
if test $ac_cv_have_decl_inet_ntop = no; then if test $ac_cv_have_decl_inet_ntop = no; then
HAVE_DECL_INET_NTOP=0 HAVE_DECL_INET_NTOP=0
AC_REQUIRE([AC_C_RESTRICT])
fi fi
AC_REQUIRE([gl_SOCKET_FAMILIES]) ])
AC_REQUIRE([AC_C_RESTRICT])
# Prerequisites of lib/inet_ntop.c.
AC_DEFUN([gl_PREREQ_INET_NTOP], [
AC_REQUIRE([gl_SOCKET_FAMILIES])
]) ])

View file

@ -1,4 +1,4 @@
# inet_pton.m4 serial 11 # inet_pton.m4 serial 13
dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc. dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -9,14 +9,18 @@ AC_DEFUN([gl_FUNC_INET_PTON],
dnl Persuade Solaris <arpa/inet.h> to declare inet_pton. dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
gl_REPLACE_ARPA_INET_H
dnl Most platforms that provide inet_pton define it in libc. dnl Most platforms that provide inet_pton define it in libc.
dnl Solaris 8..10 provide inet_pton in libnsl instead. dnl Solaris 8..10 provide inet_pton in libnsl instead.
HAVE_INET_PTON=1
gl_save_LIBS=$LIBS gl_save_LIBS=$LIBS
AC_SEARCH_LIBS([inet_pton], [nsl], [], AC_SEARCH_LIBS([inet_pton], [nsl], [],
[AC_REPLACE_FUNCS([inet_pton])]) [AC_CHECK_FUNCS([inet_pton])
if test $ac_cv_func_inet_pton = no; then
HAVE_INET_PTON=0
fi
])
LIBS=$gl_save_LIBS LIBS=$gl_save_LIBS
INET_PTON_LIB= INET_PTON_LIB=
if test "$ac_cv_search_inet_pton" != "no" && if test "$ac_cv_search_inet_pton" != "no" &&
test "$ac_cv_search_inet_pton" != "none required"; then test "$ac_cv_search_inet_pton" != "none required"; then
@ -24,11 +28,6 @@ AC_DEFUN([gl_FUNC_INET_PTON],
fi fi
AC_SUBST([INET_PTON_LIB]) AC_SUBST([INET_PTON_LIB])
gl_PREREQ_INET_PTON
])
# Prerequisites of lib/inet_pton.c.
AC_DEFUN([gl_PREREQ_INET_PTON], [
AC_CHECK_HEADERS_ONCE([netdb.h]) AC_CHECK_HEADERS_ONCE([netdb.h])
AC_CHECK_DECLS([inet_pton],,, AC_CHECK_DECLS([inet_pton],,,
[#include <arpa/inet.h> [#include <arpa/inet.h>
@ -38,7 +37,11 @@ AC_DEFUN([gl_PREREQ_INET_PTON], [
]) ])
if test $ac_cv_have_decl_inet_pton = no; then if test $ac_cv_have_decl_inet_pton = no; then
HAVE_DECL_INET_PTON=0 HAVE_DECL_INET_PTON=0
AC_REQUIRE([AC_C_RESTRICT])
fi fi
AC_REQUIRE([gl_SOCKET_FAMILIES]) ])
AC_REQUIRE([AC_C_RESTRICT])
# Prerequisites of lib/inet_pton.c.
AC_DEFUN([gl_PREREQ_INET_PTON], [
AC_REQUIRE([gl_SOCKET_FAMILIES])
]) ])

View file

@ -1,4 +1,4 @@
# isinf.m4 serial 3 # isinf.m4 serial 4
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -24,7 +24,7 @@ AC_DEFUN([gl_ISINF],
if test "$ac_cv_have_decl_isinf" != yes || if test "$ac_cv_have_decl_isinf" != yes ||
test "$ISINF_LIBM" = missing; then test "$ISINF_LIBM" = missing; then
REPLACE_ISINF=1 REPLACE_ISINF=1
AC_LIBOBJ([isinf]) dnl No libraries are needed to link lib/isinf.c.
ISINF_LIBM= ISINF_LIBM=
fi fi
AC_SUBST([ISINF_LIBM]) AC_SUBST([ISINF_LIBM])

View file

@ -1,4 +1,4 @@
# isnan.m4 serial 3 # isnan.m4 serial 5
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -36,11 +36,8 @@ AC_DEFUN([gl_ISNAN],
esac esac
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
dnl REPLACE_ISNAN=1 also makes sure the rpl_isnan[fdl] functions get built.
REPLACE_ISNAN=1 REPLACE_ISNAN=1
# Make sure the rpl_isnan[fdl] functions get built.
gl_BUILD_ISNANF
gl_BUILD_ISNAND
gl_BUILD_ISNANL
ISNAN_LIBM= ISNAN_LIBM=
fi fi
AC_SUBST([ISNAN_LIBM]) AC_SUBST([ISNAN_LIBM])

View file

@ -1,4 +1,4 @@
# isnand.m4 serial 8 # isnand.m4 serial 10
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -24,7 +24,6 @@ AC_DEFUN([gl_FUNC_ISNAND],
else else
gl_func_isnand=no gl_func_isnand=no
HAVE_ISNAND=0 HAVE_ISNAND=0
gl_BUILD_ISNAND
fi fi
AC_SUBST([ISNAND_LIBM]) AC_SUBST([ISNAND_LIBM])
]) ])
@ -34,18 +33,16 @@ dnl Check how to get or define isnand() without linking with libm.
AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM], AC_DEFUN([gl_FUNC_ISNAND_NO_LIBM],
[ [
gl_HAVE_ISNAND_NO_LIBM gl_HAVE_ISNAND_NO_LIBM
gl_func_isnand_no_libm=$gl_cv_func_isnand_no_libm
if test $gl_cv_func_isnand_no_libm = yes; then if test $gl_cv_func_isnand_no_libm = yes; then
AC_DEFINE([HAVE_ISNAND_IN_LIBC], [1], AC_DEFINE([HAVE_ISNAND_IN_LIBC], [1],
[Define if the isnan(double) function is available in libc.]) [Define if the isnan(double) function is available in libc.])
else
gl_BUILD_ISNAND
fi fi
]) ])
dnl Pull in replacement isnand definition. It does not need -lm. dnl Prerequisites of replacement isnand definition. It does not need -lm.
AC_DEFUN([gl_BUILD_ISNAND], AC_DEFUN([gl_PREREQ_ISNAND],
[ [
AC_LIBOBJ([isnand])
gl_DOUBLE_EXPONENT_LOCATION gl_DOUBLE_EXPONENT_LOCATION
]) ])

View file

@ -1,4 +1,4 @@
# isnanf.m4 serial 12 # isnanf.m4 serial 14
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -17,6 +17,7 @@ AC_DEFUN([gl_FUNC_ISNANF],
ISNANF_LIBM=-lm ISNANF_LIBM=-lm
fi fi
fi fi
dnl The variable gl_func_isnanf set here is used by isnan.m4.
if test $gl_cv_func_isnanf_no_libm = yes \ if test $gl_cv_func_isnanf_no_libm = yes \
|| test $gl_cv_func_isnanf_in_libm = yes; then || test $gl_cv_func_isnanf_in_libm = yes; then
save_LIBS="$LIBS" save_LIBS="$LIBS"
@ -32,7 +33,6 @@ AC_DEFUN([gl_FUNC_ISNANF],
fi fi
if test $gl_func_isnanf != yes; then if test $gl_func_isnanf != yes; then
HAVE_ISNANF=0 HAVE_ISNANF=0
gl_BUILD_ISNANF
fi fi
AC_SUBST([ISNANF_LIBM]) AC_SUBST([ISNANF_LIBM])
]) ])
@ -51,17 +51,17 @@ AC_DEFUN([gl_FUNC_ISNANF_NO_LIBM],
*) false;; *) false;;
esac esac
}; then }; then
gl_func_isnanf_no_libm=yes
AC_DEFINE([HAVE_ISNANF_IN_LIBC], [1], AC_DEFINE([HAVE_ISNANF_IN_LIBC], [1],
[Define if the isnan(float) function is available in libc.]) [Define if the isnan(float) function is available in libc.])
else else
gl_BUILD_ISNANF gl_func_isnanf_no_libm=no
fi fi
]) ])
dnl Pull in replacement isnanf definition. It does not need -lm. dnl Prerequisites of replacement isnanf definition. It does not need -lm.
AC_DEFUN([gl_BUILD_ISNANF], AC_DEFUN([gl_PREREQ_ISNANF],
[ [
AC_LIBOBJ([isnanf])
gl_FLOAT_EXPONENT_LOCATION gl_FLOAT_EXPONENT_LOCATION
]) ])

View file

@ -1,4 +1,4 @@
# isnanl.m4 serial 14 # isnanl.m4 serial 16
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_ISNANL],
ISNANL_LIBM=-lm ISNANL_LIBM=-lm
fi fi
fi fi
dnl The variable gl_func_isnanl set here is used by isnan.m4.
if test $gl_cv_func_isnanl_no_libm = yes \ if test $gl_cv_func_isnanl_no_libm = yes \
|| test $gl_cv_func_isnanl_in_libm = yes; then || test $gl_cv_func_isnanl_in_libm = yes; then
save_LIBS="$LIBS" save_LIBS="$LIBS"
@ -30,7 +31,6 @@ AC_DEFUN([gl_FUNC_ISNANL],
fi fi
if test $gl_func_isnanl != yes; then if test $gl_func_isnanl != yes; then
HAVE_ISNANL=0 HAVE_ISNANL=0
gl_BUILD_ISNANL
fi fi
AC_SUBST([ISNANL_LIBM]) AC_SUBST([ISNANL_LIBM])
]) ])
@ -49,15 +49,12 @@ AC_DEFUN([gl_FUNC_ISNANL_NO_LIBM],
if test $gl_func_isnanl_no_libm = yes; then if test $gl_func_isnanl_no_libm = yes; then
AC_DEFINE([HAVE_ISNANL_IN_LIBC], [1], AC_DEFINE([HAVE_ISNANL_IN_LIBC], [1],
[Define if the isnan(long double) function is available in libc.]) [Define if the isnan(long double) function is available in libc.])
else
gl_BUILD_ISNANL
fi fi
]) ])
dnl Pull in replacement isnanl definition. It does not need -lm. dnl Prerequisites of replacement isnanl definition. It does not need -lm.
AC_DEFUN([gl_BUILD_ISNANL], AC_DEFUN([gl_PREREQ_ISNANL],
[ [
AC_LIBOBJ([isnanl])
gl_LONG_DOUBLE_EXPONENT_LOCATION gl_LONG_DOUBLE_EXPONENT_LOCATION
]) ])

View file

@ -1,4 +1,4 @@
# locale_h.m4 serial 13 # locale_h.m4 serial 14
dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -57,12 +57,6 @@ AC_DEFUN([gl_LOCALE_H],
dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK. dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK.
gl_NEXT_HEADERS([locale.h]) gl_NEXT_HEADERS([locale.h])
if test -n "$STDDEF_H" \
|| test $gl_cv_header_locale_h_posix2001 = no \
|| test $gl_cv_header_locale_h_needs_xlocale_h = yes; then
gl_REPLACE_LOCALE_H
fi
dnl Check for declarations of anything we want to poison if the dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use. dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <locale.h> gl_WARN_ON_USE_PREPARE([[#include <locale.h>
@ -74,13 +68,6 @@ AC_DEFUN([gl_LOCALE_H],
[setlocale duplocale]) [setlocale duplocale])
]) ])
dnl Unconditionally enables the replacement of <locale.h>.
AC_DEFUN([gl_REPLACE_LOCALE_H],
[
dnl This is a no-op, because <locale.h> is always overridden.
:
])
AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
[ [
dnl Use AC_REQUIRE here, so that the default settings are expanded once only. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.

42
m4/lseek.m4 Normal file
View file

@ -0,0 +1,42 @@
# lseek.m4 serial 7
dnl Copyright (C) 2007, 2009-2011 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_LSEEK],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
[if test $cross_compiling = no; then
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h> /* for off_t */
#include <stdio.h> /* for SEEK_CUR */
#include <unistd.h>]], [[
/* Exit with success only if stdin is seekable. */
return lseek (0, (off_t)0, SEEK_CUR) < 0;
]])],
[if test -s conftest$ac_exeext \
&& ./conftest$ac_exeext < conftest.$ac_ext \
&& test 1 = "`echo hi \
| { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then
gl_cv_func_lseek_pipe=yes
else
gl_cv_func_lseek_pipe=no
fi],
[gl_cv_func_lseek_pipe=no])
else
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__
/* mingw and BeOS mistakenly return 0 when trying to seek on pipes. */
Choke me.
#endif]])],
[gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
fi])
if test $gl_cv_func_lseek_pipe = no; then
REPLACE_LSEEK=1
AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
[Define to 1 if lseek does not detect pipes.])
fi
])

View file

@ -1,4 +1,4 @@
# serial 21 # serial 22
# Copyright (C) 1997-2001, 2003-2011 Free Software Foundation, Inc. # Copyright (C) 1997-2001, 2003-2011 Free Software Foundation, Inc.
# #
@ -16,23 +16,27 @@ AC_DEFUN([gl_FUNC_LSTAT],
AC_CHECK_FUNCS_ONCE([lstat]) AC_CHECK_FUNCS_ONCE([lstat])
if test $ac_cv_func_lstat = yes; then if test $ac_cv_func_lstat = yes; then
AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then if test $gl_cv_func_lstat_dereferences_slashed_symlink = no; then
dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ([lstat]).
REPLACE_LSTAT=1 REPLACE_LSTAT=1
fi fi
# Prerequisites of lib/lstat.c.
AC_REQUIRE([AC_C_INLINE])
else else
HAVE_LSTAT=0 HAVE_LSTAT=0
fi fi
]) ])
# Redefine AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, because it is no longer # Prerequisites of lib/lstat.c.
# maintained in Autoconf. AC_DEFUN([gl_PREREQ_LSTAT],
AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
[ [
AC_REQUIRE([AC_C_INLINE])
:
])
AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
[
dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it
dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ.
AC_CACHE_CHECK([whether lstat correctly handles trailing slash], AC_CACHE_CHECK([whether lstat correctly handles trailing slash],
[ac_cv_func_lstat_dereferences_slashed_symlink], [gl_cv_func_lstat_dereferences_slashed_symlink],
[rm -f conftest.sym conftest.file [rm -f conftest.sym conftest.file
echo >conftest.file echo >conftest.file
if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
@ -45,25 +49,22 @@ AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
have to compile and use the lstat wrapper. */ have to compile and use the lstat wrapper. */
return lstat ("conftest.sym/", &sbuf) == 0; return lstat ("conftest.sym/", &sbuf) == 0;
]])], ]])],
[ac_cv_func_lstat_dereferences_slashed_symlink=yes], [gl_cv_func_lstat_dereferences_slashed_symlink=yes],
[ac_cv_func_lstat_dereferences_slashed_symlink=no], [gl_cv_func_lstat_dereferences_slashed_symlink=no],
[# When cross-compiling, be pessimistic so we will end up using the [# When cross-compiling, be pessimistic so we will end up using the
# replacement version of lstat that checks for trailing slashes and # replacement version of lstat that checks for trailing slashes and
# calls lstat a second time when necessary. # calls lstat a second time when necessary.
ac_cv_func_lstat_dereferences_slashed_symlink=no gl_cv_func_lstat_dereferences_slashed_symlink=no
]) ])
else else
# If the 'ln -s' command failed, then we probably don't even # If the 'ln -s' command failed, then we probably don't even
# have an lstat function. # have an lstat function.
ac_cv_func_lstat_dereferences_slashed_symlink=no gl_cv_func_lstat_dereferences_slashed_symlink=no
fi fi
rm -f conftest.sym conftest.file rm -f conftest.sym conftest.file
]) ])
test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && test $gl_cv_func_lstat_dereferences_slashed_symlink = yes &&
AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1], AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
[Define to 1 if `lstat' dereferences a symlink specified [Define to 1 if `lstat' dereferences a symlink specified
with a trailing slash.]) with a trailing slash.])
if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
AC_LIBOBJ([lstat])
fi
]) ])

View file

@ -1,4 +1,4 @@
# malloc.m4 serial 12 # malloc.m4 serial 13
dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU],
[Define to 1 if your system has a GNU libc compatible 'malloc' [Define to 1 if your system has a GNU libc compatible 'malloc'
function, and to 0 otherwise.])], function, and to 0 otherwise.])],
[AC_DEFINE([HAVE_MALLOC_GNU], [0]) [AC_DEFINE([HAVE_MALLOC_GNU], [0])
gl_REPLACE_MALLOC REPLACE_MALLOC=1
]) ])
]) ])
@ -33,7 +33,7 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX],
AC_DEFINE([HAVE_MALLOC_POSIX], [1], AC_DEFINE([HAVE_MALLOC_POSIX], [1],
[Define if the 'malloc' function is POSIX compliant.]) [Define if the 'malloc' function is POSIX compliant.])
else else
gl_REPLACE_MALLOC REPLACE_MALLOC=1
fi fi
]) ])
@ -58,9 +58,3 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX],
[gl_cv_func_malloc_posix=no]) [gl_cv_func_malloc_posix=no])
]) ])
]) ])
AC_DEFUN([gl_REPLACE_MALLOC],
[
AC_LIBOBJ([malloc])
REPLACE_MALLOC=1
])

View file

@ -1,4 +1,4 @@
# memchr.m4 serial 11 # memchr.m4 serial 12
dnl Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2002-2004, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -80,10 +80,6 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
REPLACE_MEMCHR=1 REPLACE_MEMCHR=1
fi fi
fi fi
if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
AC_LIBOBJ([memchr])
gl_PREREQ_MEMCHR
fi
]) ])
# Prerequisites of lib/memchr.c. # Prerequisites of lib/memchr.c.

26
m4/mode_t.m4 Normal file
View file

@ -0,0 +1,26 @@
# mode_t.m4 serial 2
dnl Copyright (C) 2009-2011 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.
# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and
# include <sys/types.h>.
# Define PROMOTED_MODE_T to the type that is the result of "default argument
# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t.
AC_DEFUN([gl_PROMOTED_TYPE_MODE_T],
[
AC_REQUIRE([AC_TYPE_MODE_T])
AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [
dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int',
dnl and to itself otherwise. This assumption is not guaranteed by the ISO C
dnl standard, but we don't know of any real-world counterexamples.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
[[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])],
[gl_cv_promoted_mode_t='int'],
[gl_cv_promoted_mode_t='mode_t'])
])
AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t],
[Define to the type that is the result of default argument promotions of type mode_t.])
])

View file

@ -1,4 +1,4 @@
# netdb_h.m4 serial 10 # netdb_h.m4 serial 11
dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -26,6 +26,8 @@ AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
dnl Use AC_REQUIRE here, so that the default settings are expanded once only. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_NETDB_H_DEFAULTS]) AC_REQUIRE([gl_NETDB_H_DEFAULTS])
gl_MODULE_INDICATOR_SET_VARIABLE([$1]) gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
]) ])
AC_DEFUN([gl_NETDB_H_DEFAULTS], AC_DEFUN([gl_NETDB_H_DEFAULTS],
@ -37,4 +39,5 @@ AC_DEFUN([gl_NETDB_H_DEFAULTS],
HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR]) HAVE_DECL_GAI_STRERROR=1; AC_SUBST([HAVE_DECL_GAI_STRERROR])
HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO]) HAVE_DECL_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO])
HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO]) HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO])
REPLACE_GAI_STRERROR=0; AC_SUBST([REPLACE_GAI_STRERROR])
]) ])

102
m4/nocrash.m4 Normal file
View file

@ -0,0 +1,102 @@
# nocrash.m4 serial 2
dnl Copyright (C) 2005, 2009-2011 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 Based on libsigsegv, from Bruno Haible and Paolo Bonzini.
AC_PREREQ([2.13])
dnl Expands to some code for use in .c programs that will cause the configure
dnl test to exit instead of crashing. This is useful to avoid triggering
dnl action from a background debugger and to avoid core dumps.
dnl Usage: ...
dnl ]GL_NOCRASH[
dnl ...
dnl int main() { nocrash_init(); ... }
AC_DEFUN([GL_NOCRASH],[[
#include <stdlib.h>
#if defined __MACH__ && defined __APPLE__
/* Avoid a crash on MacOS X. */
#include <mach/mach.h>
#include <mach/mach_error.h>
#include <mach/thread_status.h>
#include <mach/exception.h>
#include <mach/task.h>
#include <pthread.h>
/* The exception port on which our thread listens. */
static mach_port_t our_exception_port;
/* The main function of the thread listening for exceptions of type
EXC_BAD_ACCESS. */
static void *
mach_exception_thread (void *arg)
{
/* Buffer for a message to be received. */
struct {
mach_msg_header_t head;
mach_msg_body_t msgh_body;
char data[1024];
} msg;
mach_msg_return_t retval;
/* Wait for a message on the exception port. */
retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg),
our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
if (retval != MACH_MSG_SUCCESS)
abort ();
exit (1);
}
static void
nocrash_init (void)
{
mach_port_t self = mach_task_self ();
/* Allocate a port on which the thread shall listen for exceptions. */
if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port)
== KERN_SUCCESS) {
/* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */
if (mach_port_insert_right (self, our_exception_port, our_exception_port,
MACH_MSG_TYPE_MAKE_SEND)
== KERN_SUCCESS) {
/* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting
for us. */
exception_mask_t mask = EXC_MASK_BAD_ACCESS;
/* Create the thread listening on the exception port. */
pthread_attr_t attr;
pthread_t thread;
if (pthread_attr_init (&attr) == 0
&& pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0
&& pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) {
pthread_attr_destroy (&attr);
/* Replace the exception port info for these exceptions with our own.
Note that we replace the exception port for the entire task, not only
for a particular thread. This has the effect that when our exception
port gets the message, the thread specific exception port has already
been asked, and we don't need to bother about it.
See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */
task_set_exception_ports (self, mask, our_exception_port,
EXCEPTION_DEFAULT, MACHINE_THREAD_STATE);
}
}
}
}
#else
/* Avoid a crash on POSIX systems. */
#include <signal.h>
/* A POSIX signal handler. */
static void
exception_handler (int sig)
{
exit (1);
}
static void
nocrash_init (void)
{
#ifdef SIGSEGV
signal (SIGSEGV, exception_handler);
#endif
#ifdef SIGBUS
signal (SIGBUS, exception_handler);
#endif
}
#endif
]])

90
m4/open.m4 Normal file
View file

@ -0,0 +1,90 @@
# open.m4 serial 12
dnl Copyright (C) 2007-2011 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_OPEN],
[
AC_REQUIRE([AC_CANONICAL_HOST])
case "$host_os" in
mingw* | pw*)
gl_REPLACE_OPEN
;;
*)
dnl open("foo/") should not create a file when the file name has a
dnl trailing slash. FreeBSD only has the problem on symlinks.
AC_CHECK_FUNCS_ONCE([lstat])
AC_CACHE_CHECK([whether open recognizes a trailing slash],
[gl_cv_func_open_slash],
[# Assume that if we have lstat, we can also check symlinks.
if test $ac_cv_func_lstat = yes; then
touch conftest.tmp
ln -s conftest.tmp conftest.lnk
fi
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <fcntl.h>
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
int main ()
{
int result = 0;
#if HAVE_LSTAT
if (open ("conftest.lnk/", O_RDONLY) != -1)
result |= 1;
#endif
if (open ("conftest.sl/", O_CREAT, 0600) >= 0)
result |= 2;
return result;
}]])],
[gl_cv_func_open_slash=yes],
[gl_cv_func_open_slash=no],
[
changequote(,)dnl
case "$host_os" in
freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*)
gl_cv_func_open_slash="guessing no" ;;
*)
gl_cv_func_open_slash="guessing yes" ;;
esac
changequote([,])dnl
])
rm -f conftest.sl conftest.tmp conftest.lnk
])
case "$gl_cv_func_open_slash" in
*no)
AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1],
[Define to 1 if open() fails to recognize a trailing slash.])
gl_REPLACE_OPEN
;;
esac
;;
esac
dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag.
m4_ifdef([gl_NONBLOCKING_IO], [
if test $REPLACE_OPEN = 0; then
gl_NONBLOCKING_IO
if test $gl_cv_have_open_O_NONBLOCK != yes; then
gl_REPLACE_OPEN
fi
fi
])
])
AC_DEFUN([gl_REPLACE_OPEN],
[
AC_REQUIRE([gl_FCNTL_H_DEFAULTS])
REPLACE_OPEN=1
AC_LIBOBJ([open])
gl_PREREQ_OPEN
])
# Prerequisites of lib/open.c.
AC_DEFUN([gl_PREREQ_OPEN],
[
AC_REQUIRE([AC_C_INLINE])
AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T])
:
])

18
m4/pipe2.m4 Normal file
View file

@ -0,0 +1,18 @@
# pipe2.m4 serial 2
dnl Copyright (C) 2009-2011 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_PIPE2],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
dnl Persuade glibc <unistd.h> to declare pipe2().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_CHECK_FUNCS_ONCE([pipe2])
if test $ac_cv_func_pipe2 != yes; then
HAVE_PIPE2=0
fi
])

View file

@ -1,4 +1,4 @@
# putenv.m4 serial 17 # putenv.m4 serial 18
dnl Copyright (C) 2002-2011 Free Software Foundation, Inc. dnl Copyright (C) 2002-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -36,6 +36,5 @@ AC_DEFUN([gl_FUNC_PUTENV],
]) ])
if test $gl_cv_func_svid_putenv = no; then if test $gl_cv_func_svid_putenv = no; then
REPLACE_PUTENV=1 REPLACE_PUTENV=1
AC_LIBOBJ([putenv])
fi fi
]) ])

View file

@ -1,4 +1,4 @@
# read.m4 serial 1 # read.m4 serial 2
dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl Copyright (C) 2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -14,7 +14,6 @@ AC_DEFUN([gl_FUNC_READ],
gl_NONBLOCKING_IO gl_NONBLOCKING_IO
if test $gl_cv_have_nonblocking != yes; then if test $gl_cv_have_nonblocking != yes; then
REPLACE_READ=1 REPLACE_READ=1
AC_LIBOBJ([read])
fi fi
]) ])
]) ])

View file

@ -1,4 +1,4 @@
# readlink.m4 serial 9 # readlink.m4 serial 11
dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -10,8 +10,6 @@ AC_DEFUN([gl_FUNC_READLINK],
AC_CHECK_FUNCS_ONCE([readlink]) AC_CHECK_FUNCS_ONCE([readlink])
if test $ac_cv_func_readlink = no; then if test $ac_cv_func_readlink = no; then
HAVE_READLINK=0 HAVE_READLINK=0
AC_LIBOBJ([readlink])
gl_PREREQ_READLINK
else else
AC_CACHE_CHECK([whether readlink signature is correct], AC_CACHE_CHECK([whether readlink signature is correct],
[gl_cv_decl_readlink_works], [gl_cv_decl_readlink_works],
@ -40,15 +38,14 @@ AC_DEFUN([gl_FUNC_READLINK],
AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
fails to recognize a trailing slash.]) fails to recognize a trailing slash.])
REPLACE_READLINK=1 REPLACE_READLINK=1
AC_LIBOBJ([readlink])
elif test "$gl_cv_decl_readlink_works" != yes; then elif test "$gl_cv_decl_readlink_works" != yes; then
REPLACE_READLINK=1 REPLACE_READLINK=1
AC_LIBOBJ([readlink])
fi fi
fi fi
]) ])
# Like gl_FUNC_READLINK, except prepare for separate compilation (no AC_LIBOBJ). # Like gl_FUNC_READLINK, except prepare for separate compilation
# (no REPLACE_READLINK, no AC_LIBOBJ).
AC_DEFUN([gl_FUNC_READLINK_SEPARATE], AC_DEFUN([gl_FUNC_READLINK_SEPARATE],
[ [
AC_CHECK_FUNCS_ONCE([readlink]) AC_CHECK_FUNCS_ONCE([readlink])

View file

@ -1,17 +1,10 @@
# safe-read.m4 serial 5 # safe-read.m4 serial 6
dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation, dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation,
dnl Inc. dnl Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_SAFE_READ],
[
AC_LIBOBJ([safe-read])
gl_PREREQ_SAFE_READ
])
# Prerequisites of lib/safe-read.c. # Prerequisites of lib/safe-read.c.
AC_DEFUN([gl_PREREQ_SAFE_READ], AC_DEFUN([gl_PREREQ_SAFE_READ],
[ [

View file

@ -1,16 +1,9 @@
# safe-write.m4 serial 3 # safe-write.m4 serial 4
dnl Copyright (C) 2002, 2005-2006, 2009-2011 Free Software Foundation, Inc. dnl Copyright (C) 2002, 2005-2006, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_SAFE_WRITE],
[
AC_LIBOBJ([safe-write])
gl_PREREQ_SAFE_WRITE
])
# Prerequisites of lib/safe-write.c. # Prerequisites of lib/safe-write.c.
AC_DEFUN([gl_PREREQ_SAFE_WRITE], AC_DEFUN([gl_PREREQ_SAFE_WRITE],
[ [

View file

@ -1,4 +1,4 @@
# serial 7 # serial 8
# Copyright (C) 2009-2011 Free Software Foundation, Inc. # Copyright (C) 2009-2011 Free Software Foundation, Inc.
# #
@ -58,9 +58,11 @@ AC_DEFUN([gl_FUNC_STAT],
AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs
help when passed a file name with a trailing slash]);; help when passed a file name with a trailing slash]);;
esac esac
if test $REPLACE_STAT = 1; then ])
AC_LIBOBJ([stat])
dnl Prerequisites of lib/stat.c. # Prerequisites of lib/stat.c.
AC_REQUIRE([AC_C_INLINE]) AC_DEFUN([gl_PREREQ_STAT],
fi [
AC_REQUIRE([AC_C_INLINE])
:
]) ])

View file

@ -1,4 +1,4 @@
# stdint.m4 serial 40 # stdint.m4 serial 41
dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, 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.
dnl From Paul Eggert and Bruno Haible. dnl From Paul Eggert and Bruno Haible.
dnl Test whether <stdint.h> is supported or must be substituted. dnl Test whether <stdint.h> is supported or must be substituted.
AC_DEFUN([gl_STDINT_H], AC_DEFUN_ONCE([gl_STDINT_H],
[ [
AC_PREREQ([2.59])dnl AC_PREREQ([2.59])dnl

View file

@ -1,4 +1,4 @@
# stdio_h.m4 serial 36 # stdio_h.m4 serial 37
dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -14,8 +14,6 @@ AC_DEFUN([gl_STDIO_H],
dnl <stdio.h> likely needs them. dnl <stdio.h> likely needs them.
GNULIB_FSCANF=1 GNULIB_FSCANF=1
GNULIB_SCANF=1 GNULIB_SCANF=1
GNULIB_VFSCANF=1
GNULIB_VSCANF=1
GNULIB_FGETC=1 GNULIB_FGETC=1
GNULIB_GETC=1 GNULIB_GETC=1
GNULIB_GETCHAR=1 GNULIB_GETCHAR=1

View file

@ -1,4 +1,4 @@
# serial 32 # serial 33
# Copyright (C) 1996-1997, 1999-2007, 2009-2011 Free Software Foundation, Inc. # Copyright (C) 1996-1997, 1999-2007, 2009-2011 Free Software Foundation, Inc.
# #
@ -16,8 +16,6 @@ AC_DEFUN([gl_FUNC_GNU_STRFTIME],
# These are the prerequisite macros for GNU's strftime.c replacement. # These are the prerequisite macros for GNU's strftime.c replacement.
AC_DEFUN([gl_FUNC_STRFTIME], AC_DEFUN([gl_FUNC_STRFTIME],
[ [
AC_LIBOBJ([strftime])
# This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE. # This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
AC_REQUIRE([AC_STRUCT_TIMEZONE]) AC_REQUIRE([AC_STRUCT_TIMEZONE])

View file

@ -50,10 +50,6 @@ AC_DEFUN([gl_TIME_R],
else else
HAVE_LOCALTIME_R=0 HAVE_LOCALTIME_R=0
fi fi
if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
AC_LIBOBJ([time_r])
gl_PREREQ_TIME_R
fi
]) ])
# Prerequisites of lib/time_r.c. # Prerequisites of lib/time_r.c.

View file

@ -1,4 +1,4 @@
# trunc.m4 serial 5 # trunc.m4 serial 6
dnl Copyright (C) 2007, 2010-2011 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2010-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -79,7 +79,7 @@ int main()
HAVE_DECL_TRUNC=0 HAVE_DECL_TRUNC=0
fi fi
if test $HAVE_DECL_TRUNC = 0 || test $REPLACE_TRUNC = 1; then if test $HAVE_DECL_TRUNC = 0 || test $REPLACE_TRUNC = 1; then
AC_LIBOBJ([trunc]) dnl No libraries are needed to link lib/trunc.c.
TRUNC_LIBM= TRUNC_LIBM=
fi fi
AC_SUBST([TRUNC_LIBM]) AC_SUBST([TRUNC_LIBM])

View file

@ -1,4 +1,4 @@
# unistd_h.m4 serial 55 # unistd_h.m4 serial 56
dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -36,8 +36,8 @@ AC_DEFUN([gl_UNISTD_H],
]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat ]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
fsync ftruncate getcwd getdomainname getdtablesize getgroups fsync ftruncate getcwd getdomainname getdtablesize getgroups
gethostname getlogin getlogin_r getpagesize getusershell setusershell gethostname getlogin getlogin_r getpagesize getusershell setusershell
endusershell lchown link linkat lseek pipe pipe2 pread pwrite readlink endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite
readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
usleep]) usleep])
]) ])
@ -72,6 +72,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER])
GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
@ -110,6 +111,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN])
HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER])
HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN])
HAVE_LINK=1; AC_SUBST([HAVE_LINK]) HAVE_LINK=1; AC_SUBST([HAVE_LINK])
HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT])

View file

@ -1,4 +1,4 @@
# warnings.m4 serial 2 # warnings.m4 serial 3
dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -21,12 +21,12 @@ m4_ifdef([AS_VAR_APPEND],
AC_DEFUN([gl_WARN_ADD], AC_DEFUN([gl_WARN_ADD],
[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl [AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [ AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
save_CPPFLAGS="$CPPFLAGS" gl_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="${CPPFLAGS} $1" CPPFLAGS="${CPPFLAGS} $1"
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
[AS_VAR_SET([gl_Warn], [yes])], [AS_VAR_SET([gl_Warn], [yes])],
[AS_VAR_SET([gl_Warn], [no])]) [AS_VAR_SET([gl_Warn], [no])])
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$gl_save_CPPFLAGS"
]) ])
AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl AS_VAR_PUSHDEF([gl_Flags], m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]))dnl
AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])]) AS_VAR_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])

View file

@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake. dnl Written by Eric Blake.
# wchar_h.m4 serial 38 # wchar_h.m4 serial 39
AC_DEFUN([gl_WCHAR_H], AC_DEFUN([gl_WCHAR_H],
[ [
@ -119,13 +119,6 @@ Configuration aborted.])
fi fi
]) ])
dnl Unconditionally enables the replacement of <wchar.h>.
AC_DEFUN([gl_REPLACE_WCHAR_H],
[
dnl This is a no-op, because <wchar.h> is always overridden.
:
])
AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
[ [
dnl Use AC_REQUIRE here, so that the default settings are expanded once only. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.

Some files were not shown because too many files have changed in this diff Show more