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:
parent
0b77014f0c
commit
3d458a81c6
102 changed files with 4437 additions and 1496 deletions
|
@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
|
|||
if 0;
|
||||
# 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
|
||||
# for the Emacs time-stamp write hook (at end) to update it.
|
||||
# If you change this file with Emacs, please let the write hook
|
||||
|
@ -106,7 +106,7 @@ sub sizes (@)
|
|||
my $t = `$cmd`;
|
||||
# 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;
|
||||
$t =~ s/^([\d.]+[MkK]).*/${1}B/;
|
||||
$res{$f} = $t;
|
||||
|
@ -128,12 +128,12 @@ sub print_locations ($\@\%@)
|
|||
foreach my $url (@{$url})
|
||||
{
|
||||
for my $file (@file)
|
||||
{
|
||||
print " $url/$file";
|
||||
print " (", $$size{$file}, ")"
|
||||
if exists $$size{$file};
|
||||
print "\n";
|
||||
}
|
||||
{
|
||||
print " $url/$file";
|
||||
print " (", $$size{$file}, ")"
|
||||
if exists $$size{$file};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
@ -154,17 +154,17 @@ sub print_checksums (@)
|
|||
foreach my $meth (qw (md5 sha1))
|
||||
{
|
||||
foreach my $f (@file)
|
||||
{
|
||||
open IN, '<', $f
|
||||
or die "$ME: $f: cannot open for reading: $!\n";
|
||||
binmode IN;
|
||||
my $dig =
|
||||
($meth eq 'md5'
|
||||
? Digest::MD5->new->addfile(*IN)->hexdigest
|
||||
: Digest::SHA1->new->addfile(*IN)->hexdigest);
|
||||
close IN;
|
||||
print "$dig $f\n";
|
||||
}
|
||||
{
|
||||
open IN, '<', $f
|
||||
or die "$ME: $f: cannot open for reading: $!\n";
|
||||
binmode IN;
|
||||
my $dig =
|
||||
($meth eq 'md5'
|
||||
? Digest::MD5->new->addfile(*IN)->hexdigest
|
||||
: Digest::SHA1->new->addfile(*IN)->hexdigest);
|
||||
close IN;
|
||||
print "$dig $f\n";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
@ -180,7 +180,10 @@ sub print_news_deltas ($$$)
|
|||
{
|
||||
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
|
||||
# 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 $found_news;
|
||||
open NEWS, '<', $news_file
|
||||
or die "$ME: $news_file: cannot open for reading: $!\n";
|
||||
while (defined (my $line = <NEWS>))
|
||||
{
|
||||
if ( ! $in_items)
|
||||
{
|
||||
# Match lines like these:
|
||||
# * Major changes in release 5.0.1:
|
||||
# * Noteworthy changes in release 6.6 (2006-11-22) [stable]
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
|
||||
or next;
|
||||
$in_items = 1;
|
||||
print $line;
|
||||
}
|
||||
{
|
||||
# Match lines like these:
|
||||
# * Major changes in release 5.0.1:
|
||||
# * Noteworthy changes in release 6.6 (2006-11-22) [stable]
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$curr_version\E(?:[^\d.]|$)/o
|
||||
or next;
|
||||
$in_items = 1;
|
||||
print $line;
|
||||
}
|
||||
else
|
||||
{
|
||||
# This regexp must not match version numbers in NEWS items.
|
||||
# For example, they might well say `introduced in 4.5.5',
|
||||
# and we don't want that to match.
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
|
||||
and last;
|
||||
print $line;
|
||||
}
|
||||
{
|
||||
# This regexp must not match version numbers in NEWS items.
|
||||
# For example, they might well say `introduced in 4.5.5',
|
||||
# and we don't want that to match.
|
||||
$line =~ /^$re_prefix.*(?:[^\d.]|$)\Q$prev_version\E(?:[^\d.]|$)/o
|
||||
and last;
|
||||
print $line;
|
||||
$line =~ /\S/
|
||||
and $found_news = 1;
|
||||
}
|
||||
}
|
||||
close NEWS;
|
||||
|
||||
$in_items
|
||||
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 ($$)
|
||||
|
@ -229,8 +237,8 @@ sub print_changelog_deltas ($$)
|
|||
use File::Find;
|
||||
my @changelog;
|
||||
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.
|
||||
@changelog
|
||||
|
@ -255,7 +263,7 @@ sub print_changelog_deltas ($$)
|
|||
my $dot_slash = $d eq '.' ? $d : "./$d";
|
||||
my $target = "$dot_slash/ChangeLog";
|
||||
delete $changelog{$target}
|
||||
and push @reordered, $target;
|
||||
and push @reordered, $target;
|
||||
}
|
||||
|
||||
# Append any remaining ChangeLog files.
|
||||
|
@ -282,20 +290,20 @@ sub print_changelog_deltas ($$)
|
|||
while (defined (my $line = <DIFF>))
|
||||
{
|
||||
if ($line =~ /^\+\+\+ /)
|
||||
{
|
||||
my $separator = "*"x70 ."\n";
|
||||
$line =~ s///;
|
||||
$line =~ s/\s.*//;
|
||||
$prev_printed_line_empty
|
||||
or print "\n";
|
||||
print $separator, $line, $separator;
|
||||
}
|
||||
{
|
||||
my $separator = "*"x70 ."\n";
|
||||
$line =~ s///;
|
||||
$line =~ s/\s.*//;
|
||||
$prev_printed_line_empty
|
||||
or print "\n";
|
||||
print $separator, $line, $separator;
|
||||
}
|
||||
elsif ($line =~ /^\+/)
|
||||
{
|
||||
$line =~ s///;
|
||||
print $line;
|
||||
$prev_printed_line_empty = ($line =~ /^$/);
|
||||
}
|
||||
{
|
||||
$line =~ s///;
|
||||
print $line;
|
||||
$prev_printed_line_empty = ($line =~ /^$/);
|
||||
}
|
||||
}
|
||||
close DIFF;
|
||||
|
||||
|
@ -316,25 +324,25 @@ sub get_tool_versions ($$)
|
|||
foreach my $t (@$tool_list)
|
||||
{
|
||||
if ($t eq 'gnulib')
|
||||
{
|
||||
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
|
||||
next;
|
||||
}
|
||||
{
|
||||
push @tool_version_pair, ucfirst $t . ' ' . $gnulib_version;
|
||||
next;
|
||||
}
|
||||
# Assume that the last "word" on the first line of
|
||||
# `tool --version` output is the version string.
|
||||
my ($first_line, undef) = split ("\n", `$t --version`);
|
||||
if ($first_line =~ /.* (\d[\w.-]+)$/)
|
||||
{
|
||||
$t = ucfirst $t;
|
||||
push @tool_version_pair, "$t $1";
|
||||
}
|
||||
{
|
||||
$t = ucfirst $t;
|
||||
push @tool_version_pair, "$t $1";
|
||||
}
|
||||
else
|
||||
{
|
||||
defined $first_line
|
||||
and $first_line = '';
|
||||
warn "$ME: $t: unexpected --version output\n:$first_line";
|
||||
$fail = 1;
|
||||
}
|
||||
{
|
||||
defined $first_line
|
||||
and $first_line = '';
|
||||
warn "$ME: $t: unexpected --version output\n:$first_line";
|
||||
$fail = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$fail
|
||||
|
@ -398,8 +406,8 @@ sub get_tool_versions ($$)
|
|||
|
||||
grep (/^gnulib$/, @tool_list) ^ defined $gnulib_version
|
||||
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"
|
||||
. "in the gnulib source directory.\n"), $fail = 1;
|
||||
. "--gnulib-version=V, where V is the result of running git describe\n"
|
||||
. "in the gnulib source directory.\n"), $fail = 1;
|
||||
|
||||
exists $valid_release_types{$release_type}
|
||||
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);
|
||||
-f $xd
|
||||
and print_locations ("xdelta diffs (useful? if so, "
|
||||
. "please tell bug-gnulib\@gnu.org)",
|
||||
@url_dir_list, %size, $xd);
|
||||
. "please tell bug-gnulib\@gnu.org)",
|
||||
@url_dir_list, %size, $xd);
|
||||
my @sig_files = map { "$_.sig" } @tarballs;
|
||||
print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
|
||||
@sig_files);
|
||||
@sig_files);
|
||||
if ($url_dir_list[0] =~ "gnu\.org")
|
||||
{
|
||||
print "To reduce load on the main server, use a mirror listed at:\n";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# List version-controlled file names.
|
||||
|
||||
# Print a version string.
|
||||
scriptversion=2010-04-23.22; # UTC
|
||||
scriptversion=2011-05-16.22; # UTC
|
||||
|
||||
# Copyright (C) 2006-2011 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -30,7 +30,7 @@ scriptversion=2010-04-23.22; # UTC
|
|||
postprocess=
|
||||
case $1 in
|
||||
--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
|
||||
SRCDIR (default .). SRCDIR must be the top directory of a checkout.
|
||||
|
@ -61,53 +61,48 @@ EOF
|
|||
shift; shift ;;
|
||||
esac
|
||||
|
||||
dir=
|
||||
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 $# = 0 && set .
|
||||
|
||||
test "x$dir" = x && dir=.
|
||||
|
||||
if test -d .git; then
|
||||
test "x$dir" = x. \
|
||||
&& dir= sed_esc= \
|
||||
|| { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
|
||||
# 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
|
||||
# else (often into a submodule), in which case the content does not
|
||||
# belong to this package.
|
||||
eval exec git ls-tree -r 'HEAD:"$dir"' \
|
||||
\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
|
||||
elif test -d .hg; then
|
||||
eval exec hg locate '"$dir/*"' $postprocess
|
||||
elif test -d .bzr; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
eval exec bzr ls -R --versioned '"$dir"' $postprocess
|
||||
elif test -d CVS; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
if test -x build-aux/cvsu; then
|
||||
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
elif (cvsu --help) >/dev/null 2>&1; then
|
||||
eval cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
for dir
|
||||
do
|
||||
if test -d .git; then
|
||||
test "x$dir" = x. \
|
||||
&& dir= sed_esc= \
|
||||
|| { dir="$dir/"; sed_esc=`echo "$dir"|env sed 's,\([\\/]\),\\\\\1,g'`; }
|
||||
# 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
|
||||
# else (often into a submodule), in which case the content does not
|
||||
# belong to this package.
|
||||
eval exec git ls-tree -r 'HEAD:"$dir"' \
|
||||
\| sed -n '"s/^100[^ ]*./$sed_esc/p"' $postprocess
|
||||
elif test -d .hg; then
|
||||
eval exec hg locate '"$dir/*"' $postprocess
|
||||
elif test -d .bzr; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
eval exec bzr ls -R --versioned '"$dir"' $postprocess
|
||||
elif test -d CVS; then
|
||||
test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
|
||||
if test -x build-aux/cvsu; then
|
||||
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
|
||||
elif (cvsu --help) >/dev/null 2>&1; then
|
||||
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
|
||||
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
|
||||
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
elif test -d .svn; then
|
||||
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
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
|
|
765
lib/Makefile.am
765
lib/Makefile.am
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,7 @@
|
|||
# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
|
||||
#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).
|
||||
For example, with GNU C on x86 platforms: alignof_type(double) = 8, but
|
||||
- when -malign-double is not specified: alignof_slot(double) = 4,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
along with this program; if not, write to the Free Software Foundation,
|
||||
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
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -47,8 +47,8 @@
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef _GL_ARPA_INET_H
|
||||
#define _GL_ARPA_INET_H
|
||||
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
|
||||
#define _@GUARD_PREFIX@_ARPA_INET_H
|
||||
|
||||
/* 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 /* _GL_ARPA_INET_H */
|
||||
#endif /* _GL_ARPA_INET_H */
|
||||
#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
|
||||
#endif /* _@GUARD_PREFIX@_ARPA_INET_H */
|
||||
|
|
52
lib/binary-io.h
Normal file
52
lib/binary-io.h
Normal 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 */
|
|
@ -16,7 +16,7 @@
|
|||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GL_ERRNO_H
|
||||
#ifndef _@GUARD_PREFIX@_ERRNO_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -26,8 +26,8 @@
|
|||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_ERRNO_H@
|
||||
|
||||
#ifndef _GL_ERRNO_H
|
||||
#define _GL_ERRNO_H
|
||||
#ifndef _@GUARD_PREFIX@_ERRNO_H
|
||||
#define _@GUARD_PREFIX@_ERRNO_H
|
||||
|
||||
|
||||
/* On native Windows platforms, many macros are not defined. */
|
||||
|
@ -163,5 +163,5 @@
|
|||
# endif
|
||||
|
||||
|
||||
#endif /* _GL_ERRNO_H */
|
||||
#endif /* _GL_ERRNO_H */
|
||||
#endif /* _@GUARD_PREFIX@_ERRNO_H */
|
||||
#endif /* _@GUARD_PREFIX@_ERRNO_H */
|
||||
|
|
49
lib/fclose.c
49
lib/fclose.c
|
@ -22,26 +22,63 @@
|
|||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Override fclose() to call the overridden close(). */
|
||||
#include "freading.h"
|
||||
|
||||
/* Override fclose() to call the overridden fflush() or close(). */
|
||||
|
||||
int
|
||||
rpl_fclose (FILE *fp)
|
||||
#undef fclose
|
||||
{
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
errno = saved_errno;
|
||||
return EOF;
|
||||
result = EOF;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
325
lib/fcntl.in.h
Normal file
325
lib/fcntl.in.h
Normal 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
218
lib/fflush.c
Normal 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
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
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 _GL_FLOAT_H
|
||||
#ifndef _@GUARD_PREFIX@_FLOAT_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -25,8 +25,8 @@
|
|||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
|
||||
|
||||
#ifndef _GL_FLOAT_H
|
||||
#define _GL_FLOAT_H
|
||||
#ifndef _@GUARD_PREFIX@_FLOAT_H
|
||||
#define _@GUARD_PREFIX@_FLOAT_H
|
||||
|
||||
/* 'long double' properties. */
|
||||
#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
|
||||
|
@ -59,5 +59,5 @@
|
|||
# define LDBL_MAX_10_EXP 4932
|
||||
#endif
|
||||
|
||||
#endif /* _GL_FLOAT_H */
|
||||
#endif /* _GL_FLOAT_H */
|
||||
#endif /* _@GUARD_PREFIX@_FLOAT_H */
|
||||
#endif /* _@GUARD_PREFIX@_FLOAT_H */
|
||||
|
|
137
lib/fpurge.c
Normal file
137
lib/fpurge.c
Normal 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
68
lib/freading.c
Normal 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
53
lib/freading.h
Normal 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
30
lib/fseek.c
Normal 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
146
lib/fseeko.c
Normal 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
38
lib/ftell.c
Normal 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
77
lib/ftello.c
Normal 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);
|
||||
}
|
|
@ -32,6 +32,22 @@
|
|||
# define N_(String) String
|
||||
#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
|
||||
{
|
||||
int code;
|
||||
|
@ -71,6 +87,7 @@ gai_strerror (int code)
|
|||
|
||||
return _("Unknown error");
|
||||
}
|
||||
#ifdef _LIBC
|
||||
# ifdef _LIBC
|
||||
libc_hidden_def (gai_strerror)
|
||||
#endif
|
||||
# endif
|
||||
#endif /* !HAVE_DECL_GAI_STRERROR */
|
||||
|
|
|
@ -46,7 +46,8 @@ rpl_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen)
|
|||
int milliseconds_len = sizeof (int);
|
||||
struct timeval tv;
|
||||
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_usec = (milliseconds - 1000 * tv.tv_sec) * 1000;
|
||||
n = sizeof (struct timeval);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GL_ICONV_H
|
||||
#ifndef _@GUARD_PREFIX@_ICONV_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -26,8 +26,8 @@
|
|||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_ICONV_H@
|
||||
|
||||
#ifndef _GL_ICONV_H
|
||||
#define _GL_ICONV_H
|
||||
#ifndef _@GUARD_PREFIX@_ICONV_H
|
||||
#define _@GUARD_PREFIX@_ICONV_H
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
||||
|
@ -107,5 +107,5 @@ _GL_CXXALIASWARN (iconv_close);
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_ICONV_H */
|
||||
#endif /* _GL_ICONV_H */
|
||||
#endif /* _@GUARD_PREFIX@_ICONV_H */
|
||||
#endif /* _@GUARD_PREFIX@_ICONV_H */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
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 _GL_LOCALE_H
|
||||
#ifndef _@GUARD_PREFIX@_LOCALE_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -24,8 +24,8 @@
|
|||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_LOCALE_H@
|
||||
|
||||
#ifndef _GL_LOCALE_H
|
||||
#define _GL_LOCALE_H
|
||||
#ifndef _@GUARD_PREFIX@_LOCALE_H
|
||||
#define _@GUARD_PREFIX@_LOCALE_H
|
||||
|
||||
/* NetBSD 5.0 mis-defines NULL. */
|
||||
#include <stddef.h>
|
||||
|
@ -92,5 +92,5 @@ _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _GL_LOCALE_H */
|
||||
#endif /* _GL_LOCALE_H */
|
||||
#endif /* _@GUARD_PREFIX@_LOCALE_H */
|
||||
#endif /* _@GUARD_PREFIX@_LOCALE_H */
|
||||
|
|
62
lib/lseek.c
Normal file
62
lib/lseek.c
Normal 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);
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
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 _GL_MATH_H
|
||||
#ifndef _@GUARD_PREFIX@_MATH_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -25,8 +25,8 @@
|
|||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
|
||||
|
||||
#ifndef _GL_MATH_H
|
||||
#define _GL_MATH_H
|
||||
#ifndef _@GUARD_PREFIX@_MATH_H
|
||||
#define _@GUARD_PREFIX@_MATH_H
|
||||
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
@ -806,5 +806,5 @@ _GL_WARN_REAL_FLOATING_DECL (signbit);
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_MATH_H */
|
||||
#endif /* _GL_MATH_H */
|
||||
#endif /* _@GUARD_PREFIX@_MATH_H */
|
||||
#endif /* _@GUARD_PREFIX@_MATH_H */
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
It is intended to provide definitions and prototypes needed by an
|
||||
application. */
|
||||
|
||||
#ifndef _GL_NETDB_H
|
||||
#ifndef _@GUARD_PREFIX@_NETDB_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -34,13 +34,15 @@
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef _GL_NETDB_H
|
||||
#define _GL_NETDB_H
|
||||
#ifndef _@GUARD_PREFIX@_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
|
||||
'struct hostent' on MinGW. */
|
||||
#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_WARN_ON_USE is copied here. */
|
||||
|
@ -52,6 +54,10 @@
|
|||
|
||||
# if !@HAVE_STRUCT_ADDRINFO@
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# if !GNULIB_defined_struct_addrinfo
|
||||
/* Structure to contain information about address of a service provider. */
|
||||
struct addrinfo
|
||||
|
@ -67,6 +73,11 @@ struct addrinfo
|
|||
};
|
||||
# define GNULIB_defined_struct_addrinfo 1
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
# endif
|
||||
|
||||
/* Possible values for `ai_flags' field in `addrinfo' structure. */
|
||||
|
@ -153,37 +164,67 @@ struct addrinfo
|
|||
socket addresses.
|
||||
For more details, see the POSIX:2001 specification
|
||||
<http://www.opengroup.org/susv3xsh/getaddrinfo.html>. */
|
||||
extern int getaddrinfo (const char *restrict nodename,
|
||||
const char *restrict servname,
|
||||
const struct addrinfo *restrict hints,
|
||||
struct addrinfo **restrict res)
|
||||
_GL_ARG_NONNULL ((4));
|
||||
_GL_FUNCDECL_SYS (getaddrinfo, int,
|
||||
(const char *restrict nodename,
|
||||
const char *restrict servname,
|
||||
const struct addrinfo *restrict hints,
|
||||
struct addrinfo **restrict res)
|
||||
_GL_ARG_NONNULL ((4)));
|
||||
# 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@
|
||||
/* Free `addrinfo' structure AI including associated storage.
|
||||
For more details, see the POSIX:2001 specification
|
||||
<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
|
||||
_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.
|
||||
For more details, see the POSIX:2001 specification
|
||||
<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
|
||||
_GL_CXXALIASWARN (gai_strerror);
|
||||
|
||||
# if !@HAVE_DECL_GETNAMEINFO@
|
||||
/* Convert socket address to printable node and service names.
|
||||
For more details, see the POSIX:2001 specification
|
||||
<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 service, socklen_t servicelen,
|
||||
int flags)
|
||||
_GL_ARG_NONNULL ((1));
|
||||
# endif
|
||||
int flags));
|
||||
_GL_CXXALIASWARN (getnameinfo);
|
||||
|
||||
/* Possible flags for getnameinfo. */
|
||||
# ifndef NI_NUMERICHOST
|
||||
|
@ -221,5 +262,5 @@ _GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - "
|
|||
|
||||
#endif
|
||||
|
||||
#endif /* _GL_NETDB_H */
|
||||
#endif /* _GL_NETDB_H */
|
||||
#endif /* _@GUARD_PREFIX@_NETDB_H */
|
||||
#endif /* _@GUARD_PREFIX@_NETDB_H */
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
along with this program; if not, write to the Free Software Foundation,
|
||||
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
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -33,8 +33,8 @@
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef _GL_NETINET_IN_H
|
||||
#define _GL_NETINET_IN_H
|
||||
#ifndef _@GUARD_PREFIX@_NETINET_IN_H
|
||||
#define _@GUARD_PREFIX@_NETINET_IN_H
|
||||
|
||||
#if !@HAVE_NETINET_IN_H@
|
||||
|
||||
|
@ -44,5 +44,5 @@
|
|||
|
||||
#endif
|
||||
|
||||
#endif /* _GL_NETINET_IN_H */
|
||||
#endif /* _GL_NETINET_IN_H */
|
||||
#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
|
||||
#endif /* _@GUARD_PREFIX@_NETINET_IN_H */
|
||||
|
|
176
lib/open.c
Normal file
176
lib/open.c
Normal 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
151
lib/pipe2.c
Normal 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;
|
||||
}
|
||||
}
|
|
@ -37,6 +37,10 @@ close_fd_maybe_socket (const struct fd_hook *remaining_list,
|
|||
gl_close_fn primary,
|
||||
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;
|
||||
WSANETWORKEVENTS ev;
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ get_stat_mtime (struct stat const *st)
|
|||
}
|
||||
|
||||
/* 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
|
||||
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_nsec = 0;
|
||||
#else
|
||||
/* Birth time is not supported. Set tv_sec to avoid undefined behavior. */
|
||||
/* Birth time is not supported. */
|
||||
t.tv_sec = -1;
|
||||
t.tv_nsec = -1;
|
||||
/* 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
|
||||
report failure even for valid time stamps. Also, NetBSD
|
||||
sometimes returns junk in the birth time fields; work around this
|
||||
bug if it is detected. There's no need to detect negative
|
||||
tv_nsec junk as negative tv_nsec already indicates an error. */
|
||||
if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec)
|
||||
t.tv_nsec = -1;
|
||||
bug if it is detected. */
|
||||
if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000))
|
||||
{
|
||||
t.tv_sec = -1;
|
||||
t.tv_nsec = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return t;
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
remember if special invocation has ever been used to obtain wint_t,
|
||||
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
|
||||
# undef _GL_STDDEF_H
|
||||
# undef _@GUARD_PREFIX@_STDDEF_H
|
||||
# define _GL_STDDEF_WINT_T
|
||||
# endif
|
||||
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
||||
|
@ -49,14 +49,14 @@
|
|||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
# ifndef _GL_STDDEF_H
|
||||
# ifndef _@GUARD_PREFIX@_STDDEF_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
|
||||
# @INCLUDE_NEXT@ @NEXT_STDDEF_H@
|
||||
|
||||
# ifndef _GL_STDDEF_H
|
||||
# define _GL_STDDEF_H
|
||||
# ifndef _@GUARD_PREFIX@_STDDEF_H
|
||||
# define _@GUARD_PREFIX@_STDDEF_H
|
||||
|
||||
/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */
|
||||
#if @REPLACE_NULL@
|
||||
|
@ -82,6 +82,6 @@
|
|||
# define wchar_t int
|
||||
#endif
|
||||
|
||||
# endif /* _GL_STDDEF_H */
|
||||
# endif /* _GL_STDDEF_H */
|
||||
# endif /* _@GUARD_PREFIX@_STDDEF_H */
|
||||
# endif /* _@GUARD_PREFIX@_STDDEF_H */
|
||||
#endif /* __need_XXX */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
|
||||
*/
|
||||
|
||||
#ifndef _GL_STDINT_H
|
||||
#ifndef _@GUARD_PREFIX@_STDINT_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -52,13 +52,13 @@
|
|||
/* Other systems may have an incomplete or buggy <stdint.h>.
|
||||
Include it before <inttypes.h>, since any "#include <stdint.h>"
|
||||
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. */
|
||||
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
|
||||
#endif
|
||||
|
||||
#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
|
||||
#define _GL_STDINT_H
|
||||
#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
|
||||
#define _@GUARD_PREFIX@_STDINT_H
|
||||
|
||||
/* <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>).
|
||||
|
@ -93,7 +93,7 @@
|
|||
|
||||
#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
|
||||
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 /* _GL_STDINT_H */
|
||||
#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
|
||||
#endif /* _@GUARD_PREFIX@_STDINT_H */
|
||||
#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
|
||||
|
|
110
lib/stdio-impl.h
Normal file
110
lib/stdio-impl.h
Normal 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
|
|
@ -35,7 +35,7 @@
|
|||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_STDIO_H
|
||||
#ifndef _@GUARD_PREFIX@_STDIO_H
|
||||
|
||||
#define _GL_ALREADY_INCLUDING_STDIO_H
|
||||
|
||||
|
@ -44,8 +44,8 @@
|
|||
|
||||
#undef _GL_ALREADY_INCLUDING_STDIO_H
|
||||
|
||||
#ifndef _GL_STDIO_H
|
||||
#define _GL_STDIO_H
|
||||
#ifndef _@GUARD_PREFIX@_STDIO_H
|
||||
#define _@GUARD_PREFIX@_STDIO_H
|
||||
|
||||
/* Get va_list. Needed on many systems, including glibc 2.8. */
|
||||
#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));
|
||||
# endif
|
||||
_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
|
||||
# define _GL_FSEEK_WARN /* Category 1, above. */
|
||||
# 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));
|
||||
# endif
|
||||
_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
|
||||
# define _GL_FTELL_WARN /* Category 1, above. */
|
||||
# undef ftell
|
||||
|
@ -1345,6 +1307,6 @@ _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_STDIO_H */
|
||||
#endif /* _GL_STDIO_H */
|
||||
#endif /* _@GUARD_PREFIX@_STDIO_H */
|
||||
#endif /* _@GUARD_PREFIX@_STDIO_H */
|
||||
#endif
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_STDLIB_H
|
||||
#ifndef _@GUARD_PREFIX@_STDLIB_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
|
||||
|
||||
#ifndef _GL_STDLIB_H
|
||||
#define _GL_STDLIB_H
|
||||
#ifndef _@GUARD_PREFIX@_STDLIB_H
|
||||
#define _@GUARD_PREFIX@_STDLIB_H
|
||||
|
||||
/* NetBSD 5.0 mis-defines NULL. */
|
||||
#include <stddef.h>
|
||||
|
@ -81,8 +81,9 @@ struct random_data
|
|||
# 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.5, only <unistd.h> declares mkstemps. */
|
||||
/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
|
||||
/* But avoid namespace pollution on glibc systems and native Windows. */
|
||||
# include <unistd.h>
|
||||
|
@ -760,6 +761,6 @@ _GL_CXXALIASWARN (wctomb);
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_STDLIB_H */
|
||||
#endif /* _GL_STDLIB_H */
|
||||
#endif /* _@GUARD_PREFIX@_STDLIB_H */
|
||||
#endif /* _@GUARD_PREFIX@_STDLIB_H */
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#ifndef _GL_STRING_H
|
||||
#ifndef _@GUARD_PREFIX@_STRING_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -26,8 +26,8 @@
|
|||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_STRING_H@
|
||||
|
||||
#ifndef _GL_STRING_H
|
||||
#define _GL_STRING_H
|
||||
#ifndef _@GUARD_PREFIX@_STRING_H
|
||||
#define _@GUARD_PREFIX@_STRING_H
|
||||
|
||||
/* NetBSD 5.0 mis-defines NULL. */
|
||||
#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.
|
||||
Unlike strrchr(), this function works correctly in multibyte locales with
|
||||
encodings such as GB18030. */
|
||||
# if defined __hpux
|
||||
# if defined __hpux || defined __INTERIX
|
||||
# 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
|
||||
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
|
@ -977,5 +977,5 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_STRING_H */
|
||||
#endif /* _GL_STRING_H */
|
||||
#endif /* _@GUARD_PREFIX@_STRING_H */
|
||||
#endif /* _@GUARD_PREFIX@_STRING_H */
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
/* Written by Richard W.M. Jones. */
|
||||
|
||||
#ifndef _GL_SYS_FILE_H
|
||||
#ifndef _@GUARD_PREFIX@_SYS_FILE_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
|
@ -30,8 +30,8 @@
|
|||
# @INCLUDE_NEXT@ @NEXT_SYS_FILE_H@
|
||||
#endif
|
||||
|
||||
#ifndef _GL_SYS_FILE_H
|
||||
#define _GL_SYS_FILE_H
|
||||
#ifndef _@GUARD_PREFIX@_SYS_FILE_H
|
||||
#define _@GUARD_PREFIX@_SYS_FILE_H
|
||||
|
||||
#ifndef LOCK_SH
|
||||
/* Operations for the 'flock' call (same as Linux kernel constants). */
|
||||
|
@ -60,5 +60,5 @@ _GL_WARN_ON_USE (flock, "flock is unportable - "
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_SYS_FILE_H */
|
||||
#endif /* _GL_SYS_FILE_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_FILE_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_FILE_H */
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_SYS_SOCKET_H
|
||||
#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
|
||||
|
||||
#if @HAVE_SYS_SOCKET_H@
|
||||
|
||||
|
@ -61,8 +61,8 @@
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef _GL_SYS_SOCKET_H
|
||||
#define _GL_SYS_SOCKET_H
|
||||
#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
|
||||
#define _@GUARD_PREFIX@_SYS_SOCKET_H
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
||||
|
@ -108,6 +108,12 @@ struct sockaddr_storage
|
|||
|
||||
#endif
|
||||
|
||||
/* Get struct iovec. */
|
||||
/* But avoid namespace pollution on glibc systems. */
|
||||
#if ! defined __GLIBC__
|
||||
# include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#if @HAVE_SYS_SOCKET_H@
|
||||
|
||||
/* A platform that has <sys/socket.h>. */
|
||||
|
@ -176,9 +182,6 @@ typedef int socklen_t;
|
|||
|
||||
# endif
|
||||
|
||||
/* For struct iovec */
|
||||
# include <sys/uio.h>
|
||||
|
||||
/* Rudimentary 'struct msghdr'; this works as long as you don't try to
|
||||
access msg_control or msg_controllen. */
|
||||
struct msghdr {
|
||||
|
@ -221,7 +224,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
|
|||
|
||||
/* 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)
|
||||
# undef close
|
||||
# define close close_used_without_including_unistd_h
|
||||
|
@ -231,7 +234,7 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
|
|||
# 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)
|
||||
# undef gethostname
|
||||
# define gethostname gethostname_used_without_including_unistd_h
|
||||
|
@ -673,6 +676,6 @@ _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _GL_SYS_SOCKET_H */
|
||||
#endif /* _GL_SYS_SOCKET_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_SOCKET_H */
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_SYS_STAT_H
|
||||
#ifndef _@GUARD_PREFIX@_SYS_STAT_H
|
||||
|
||||
/* Get nlink_t. */
|
||||
#include <sys/types.h>
|
||||
|
@ -45,8 +45,8 @@
|
|||
/* The include_next requires a split double-inclusion guard. */
|
||||
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
|
||||
|
||||
#ifndef _GL_SYS_STAT_H
|
||||
#define _GL_SYS_STAT_H
|
||||
#ifndef _@GUARD_PREFIX@_SYS_STAT_H
|
||||
#define _@GUARD_PREFIX@_SYS_STAT_H
|
||||
|
||||
/* 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 /* _GL_SYS_STAT_H */
|
||||
#endif /* _GL_SYS_STAT_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#endif
|
||||
@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. */
|
||||
# if @HAVE_SYS_TIME_H@
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
#else
|
||||
|
||||
# define _GL_SYS_TIME_H
|
||||
# define _@GUARD_PREFIX@_SYS_TIME_H
|
||||
|
||||
# if @HAVE_SYS_TIME_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
|
||||
|
@ -98,4 +98,4 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
|
|||
# endif
|
||||
# endif
|
||||
|
||||
#endif /* _GL_SYS_TIME_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
|
||||
|
|
|
@ -20,30 +20,45 @@
|
|||
# endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
#ifndef _GL_SYS_UIO_H
|
||||
#ifndef _@GUARD_PREFIX@_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. */
|
||||
# @INCLUDE_NEXT@ @NEXT_SYS_UIO_H@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _GL_SYS_UIO_H
|
||||
#define _GL_SYS_UIO_H
|
||||
#ifndef _@GUARD_PREFIX@_SYS_UIO_H
|
||||
#define _@GUARD_PREFIX@_SYS_UIO_H
|
||||
|
||||
#if !@HAVE_SYS_UIO_H@
|
||||
/* A platform that lacks <sys/uio.h>. */
|
||||
/* Get 'ssize_t'. */
|
||||
# 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
|
||||
of struct iovec in any other header. */
|
||||
struct iovec {
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
# define GNULIB_defined_struct_iovec 1
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _GL_SYS_UIO_H */
|
||||
#endif /* _GL_SYS_UIO_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
|
||||
#endif /* _@GUARD_PREFIX@_SYS_UIO_H */
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
without adding our own declarations. */
|
||||
#if (defined __need_time_t || defined __need_clock_t \
|
||||
|| defined __need_timespec \
|
||||
|| defined _GL_TIME_H)
|
||||
|| defined _@GUARD_PREFIX@_TIME_H)
|
||||
|
||||
# @INCLUDE_NEXT@ @NEXT_TIME_H@
|
||||
|
||||
#else
|
||||
|
||||
# define _GL_TIME_H
|
||||
# define _@GUARD_PREFIX@_TIME_H
|
||||
|
||||
# @INCLUDE_NEXT@ @NEXT_TIME_H@
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
# define _GL_WINSOCK2_H_WITNESS
|
||||
|
||||
/* Normal invocation. */
|
||||
#elif !defined _GL_UNISTD_H
|
||||
#elif !defined _@GUARD_PREFIX@_UNISTD_H
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if @HAVE_UNISTD_H@
|
||||
|
@ -51,8 +51,8 @@
|
|||
# undef _GL_INCLUDING_WINSOCK2_H
|
||||
#endif
|
||||
|
||||
#if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
|
||||
#define _GL_UNISTD_H
|
||||
#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
|
||||
#define _@GUARD_PREFIX@_UNISTD_H
|
||||
|
||||
/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
|
||||
#include <stddef.h>
|
||||
|
@ -120,7 +120,7 @@
|
|||
#if @GNULIB_GETHOSTNAME@
|
||||
/* Get all possible declarations of gethostname(). */
|
||||
# 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)
|
||||
# undef socket
|
||||
# define socket socket_used_without_including_sys_socket_h
|
||||
|
@ -181,7 +181,7 @@
|
|||
"shutdown() used without including <sys/socket.h>");
|
||||
# endif
|
||||
# endif
|
||||
# if !defined _GL_SYS_SELECT_H
|
||||
# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef select
|
||||
# define select select_used_without_including_sys_select_h
|
||||
|
@ -871,6 +871,22 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
|
|||
#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@
|
||||
/* 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.
|
||||
|
@ -1400,5 +1416,5 @@ _GL_CXXALIASWARN (write);
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_UNISTD_H */
|
||||
#endif /* _GL_UNISTD_H */
|
||||
#endif /* _@GUARD_PREFIX@_UNISTD_H */
|
||||
#endif /* _@GUARD_PREFIX@_UNISTD_H */
|
||||
|
|
145
lib/verify.h
145
lib/verify.h
|
@ -17,42 +17,37 @@
|
|||
|
||||
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
|
||||
|
||||
#ifndef VERIFY_H
|
||||
# define VERIFY_H 1
|
||||
#ifndef _GL_VERIFY_H
|
||||
# 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
|
||||
later, in C mode, and its use here generates easier-to-read diagnostics
|
||||
when verify (R) fails.
|
||||
|
||||
Define 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).
|
||||
Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the
|
||||
C++0X draft N3242 section 7.(4).
|
||||
This will likely be supported by future GCC versions, in C++ mode.
|
||||
|
||||
For now, use this only with GCC. Eventually whether _Static_assert
|
||||
and static_assert works should be determined by 'configure'. */
|
||||
Use this only with GCC. If we were willing to slow '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
|
||||
# define HAVE__STATIC_ASSERT 1
|
||||
# define _GL_HAVE__STATIC_ASSERT 1
|
||||
# endif
|
||||
/* The condition (99 < __GNUC__) is temporary, until we know about the
|
||||
first G++ release that supports static_assert. */
|
||||
# if (99 < __GNUC__) && defined __cplusplus
|
||||
# define HAVE_STATIC_ASSERT 1
|
||||
# define _GL_HAVE_STATIC_ASSERT 1
|
||||
# endif
|
||||
|
||||
/* 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.
|
||||
|
||||
Symbols ending in "__" are private to this header.
|
||||
|
||||
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.
|
||||
|
||||
The code below uses several ideas for C++ compilers, and for C
|
||||
|
@ -64,7 +59,9 @@
|
|||
constant and nonnegative.
|
||||
|
||||
* 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
|
||||
deal with a bit-field of negative size.
|
||||
|
||||
|
@ -78,7 +75,7 @@
|
|||
|
||||
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
|
||||
declaration must declare an object, a constant, a function, or a
|
||||
typedef name. If the declared entity uses the type directly,
|
||||
|
@ -116,11 +113,11 @@
|
|||
Which of the following alternatives can be used?
|
||||
|
||||
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 verify_type__ {...})]);
|
||||
extern void dummy (int [sizeof (struct _gl_verify_type {...})]);
|
||||
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
|
||||
outer scope; two such declarations therefore collide. GCC warns
|
||||
|
@ -159,44 +156,88 @@
|
|||
possible. */
|
||||
# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
|
||||
|
||||
/* Verify requirement R at compile-time, as an integer constant expression.
|
||||
Return 1. */
|
||||
/* Verify requirement R at compile-time, as an integer constant expression
|
||||
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
|
||||
# if !GNULIB_defined_struct__gl_verify_type
|
||||
template <int w>
|
||||
struct verify_type__ { unsigned int verify_error_if_negative_size__: w; };
|
||||
# define verify_true(R) \
|
||||
(!!sizeof (verify_type__<(R) ? 1 : -1>))
|
||||
# elif HAVE__STATIC_ASSERT
|
||||
# define verify_true(R) \
|
||||
(!!sizeof \
|
||||
(struct { \
|
||||
_Static_assert (R, "verify_true (" #R ")"); \
|
||||
int verify_dummy__; \
|
||||
}))
|
||||
# elif HAVE_STATIC_ASSERT
|
||||
# define verify_true(R) \
|
||||
(!!sizeof \
|
||||
(struct { \
|
||||
static_assert (R, "verify_true (" #R ")"); \
|
||||
int verify_dummy__; \
|
||||
}))
|
||||
struct _gl_verify_type {
|
||||
unsigned int _gl_verify_error_if_negative: w;
|
||||
};
|
||||
# define GNULIB_defined_struct__gl_verify_type 1
|
||||
# endif
|
||||
# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
|
||||
_gl_verify_type<(R) ? 1 : -1>
|
||||
# elif defined _GL_HAVE__STATIC_ASSERT
|
||||
# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
|
||||
struct { \
|
||||
_Static_assert (R, DIAGNOSTIC); \
|
||||
int _gl_dummy; \
|
||||
}
|
||||
# else
|
||||
# define verify_true(R) \
|
||||
(!!sizeof \
|
||||
(struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
|
||||
# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
|
||||
struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
|
||||
# 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
|
||||
trailing ';'. */
|
||||
|
||||
# if HAVE__STATIC_ASSERT
|
||||
# define verify(R) _Static_assert (R, "verify (" #R ")")
|
||||
# elif HAVE_STATIC_ASSERT
|
||||
# define verify(R) static_assert (R, "verify (" #R ")")
|
||||
# else
|
||||
# define verify(R) \
|
||||
extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)]
|
||||
# endif
|
||||
# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
|
||||
|
||||
/* @assert.h omit end@ */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#else
|
||||
/* Normal invocation convention. */
|
||||
|
||||
#ifndef _GL_WCHAR_H
|
||||
#ifndef _@GUARD_PREFIX@_WCHAR_H
|
||||
|
||||
#define _GL_ALREADY_INCLUDING_WCHAR_H
|
||||
|
||||
|
@ -81,8 +81,8 @@
|
|||
|
||||
#undef _GL_ALREADY_INCLUDING_WCHAR_H
|
||||
|
||||
#ifndef _GL_WCHAR_H
|
||||
#define _GL_WCHAR_H
|
||||
#ifndef _@GUARD_PREFIX@_WCHAR_H
|
||||
#define _@GUARD_PREFIX@_WCHAR_H
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
||||
|
@ -989,6 +989,6 @@ _GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
|
|||
#endif
|
||||
|
||||
|
||||
#endif /* _GL_WCHAR_H */
|
||||
#endif /* _GL_WCHAR_H */
|
||||
#endif /* _@GUARD_PREFIX@_WCHAR_H */
|
||||
#endif /* _@GUARD_PREFIX@_WCHAR_H */
|
||||
#endif
|
||||
|
|
|
@ -105,7 +105,7 @@ guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile
|
|||
if [ "$(cross_compiling)" = "yes" ]; then \
|
||||
$(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
|
||||
else \
|
||||
$(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(LIBS); \
|
||||
$(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(gnulib_library) $(LIBS); \
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -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 This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -38,13 +38,6 @@ AC_DEFUN([gl_HEADER_ARPA_INET],
|
|||
]], [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],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# canonicalize.m4 serial 17
|
||||
# canonicalize.m4 serial 23
|
||||
|
||||
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.
|
||||
AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE],
|
||||
[
|
||||
AC_LIBOBJ([canonicalize])
|
||||
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
AC_CHECK_FUNCS_ONCE([canonicalize_file_name])
|
||||
AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
|
||||
|
@ -26,24 +24,23 @@ AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE],
|
|||
# Provides canonicalize_file_name and realpath.
|
||||
AC_DEFUN([gl_CANONICALIZE_LGPL],
|
||||
[
|
||||
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
|
||||
AC_REQUIRE([gl_CANONICALIZE_LGPL_SEPARATE])
|
||||
if test $ac_cv_func_canonicalize_file_name = no; then
|
||||
HAVE_CANONICALIZE_FILE_NAME=0
|
||||
AC_LIBOBJ([canonicalize-lgpl])
|
||||
if test $ac_cv_func_realpath = no; then
|
||||
HAVE_REALPATH=0
|
||||
elif test "$gl_cv_func_realpath_works" != yes; then
|
||||
REPLACE_REALPATH=1
|
||||
fi
|
||||
elif test "$gl_cv_func_realpath_works" != yes; then
|
||||
AC_LIBOBJ([canonicalize-lgpl])
|
||||
REPLACE_REALPATH=1
|
||||
REPLACE_CANONICALIZE_FILE_NAME=1
|
||||
REPLACE_REALPATH=1
|
||||
fi
|
||||
])
|
||||
|
||||
# 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_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
|
@ -61,9 +58,12 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
|
|||
AC_CHECK_FUNCS_ONCE([realpath])
|
||||
AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [
|
||||
touch conftest.a
|
||||
mkdir conftest.d
|
||||
AC_RUN_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
]GL_NOCRASH[
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
]], [[
|
||||
int result = 0;
|
||||
{
|
||||
|
@ -81,10 +81,17 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
|
|||
if (name != NULL)
|
||||
result |= 4;
|
||||
}
|
||||
{
|
||||
char *name1 = realpath (".", NULL);
|
||||
char *name2 = realpath ("conftest.d//./..", NULL);
|
||||
if (strcmp (name1, name2) != 0)
|
||||
result |= 8;
|
||||
}
|
||||
return result;
|
||||
]])
|
||||
], [gl_cv_func_realpath_works=yes], [gl_cv_func_realpath_works=no],
|
||||
[gl_cv_func_realpath_works="guessing no"])
|
||||
rm -rf conftest.a conftest.d
|
||||
])
|
||||
if test "$gl_cv_func_realpath_works" = yes; then
|
||||
AC_DEFINE([FUNC_REALPATH_WORKS], [1], [Define to 1 if realpath()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# ceil.m4 serial 5
|
||||
# ceil.m4 serial 6
|
||||
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,
|
||||
|
@ -48,7 +48,7 @@ int main()
|
|||
fi
|
||||
])
|
||||
if test $REPLACE_CEIL = 1; then
|
||||
AC_LIBOBJ([ceil])
|
||||
dnl No libraries are needed to link lib/ceil.c.
|
||||
CEIL_LIBM=
|
||||
fi
|
||||
AC_SUBST([CEIL_LIBM])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# duplocale.m4 serial 5
|
||||
# duplocale.m4 serial 7
|
||||
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,
|
||||
|
@ -59,11 +59,6 @@ int main ()
|
|||
else
|
||||
HAVE_DUPLOCALE=0
|
||||
fi
|
||||
if test $REPLACE_DUPLOCALE = 1; then
|
||||
gl_REPLACE_LOCALE_H
|
||||
AC_LIBOBJ([duplocale])
|
||||
gl_PREREQ_DUPLOCALE
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/duplocale.c.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# fclose.m4 serial 2
|
||||
# fclose.m4 serial 4
|
||||
dnl Copyright (C) 2008-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,
|
||||
|
@ -6,6 +6,10 @@ dnl with or without modifications, as long as this notice is preserved.
|
|||
|
||||
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],
|
||||
|
|
112
m4/fcntl-o.m4
Normal file
112
m4/fcntl-o.m4
Normal 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
44
m4/fcntl_h.m4
Normal 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
81
m4/fflush.m4
Normal 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])
|
||||
:
|
||||
])
|
|
@ -1,4 +1,4 @@
|
|||
# flock.m4 serial 2
|
||||
# flock.m4 serial 3
|
||||
dnl Copyright (C) 2008-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,
|
||||
|
@ -10,8 +10,6 @@ AC_DEFUN([gl_FUNC_FLOCK],
|
|||
AC_CHECK_FUNCS_ONCE([flock])
|
||||
if test $ac_cv_func_flock = no; then
|
||||
HAVE_FLOCK=0
|
||||
AC_LIBOBJ([flock])
|
||||
gl_PREREQ_FLOCK
|
||||
fi
|
||||
])
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# floor.m4 serial 5
|
||||
# floor.m4 serial 6
|
||||
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,
|
||||
|
@ -48,7 +48,7 @@ int main()
|
|||
fi
|
||||
])
|
||||
if test $REPLACE_FLOOR = 1; then
|
||||
AC_LIBOBJ([floor])
|
||||
dnl No libraries are needed to link lib/floor.c.
|
||||
FLOOR_LIBM=
|
||||
fi
|
||||
AC_SUBST([FLOOR_LIBM])
|
||||
|
|
45
m4/fpurge.m4
Normal file
45
m4/fpurge.m4
Normal 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
10
m4/freading.m4
Normal 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])
|
||||
])
|
|
@ -1,4 +1,4 @@
|
|||
# frexp.m4 serial 10
|
||||
# frexp.m4 serial 11
|
||||
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,
|
||||
|
@ -44,8 +44,6 @@ AC_DEFUN([gl_FUNC_FREXP],
|
|||
if test $gl_func_frexp = yes; then
|
||||
AC_DEFINE([HAVE_FREXP], [1],
|
||||
[Define if the frexp() function is available and works.])
|
||||
else
|
||||
AC_LIBOBJ([frexp])
|
||||
fi
|
||||
AC_SUBST([FREXP_LIBM])
|
||||
])
|
||||
|
@ -68,8 +66,6 @@ AC_DEFUN([gl_FUNC_FREXP_NO_LIBM],
|
|||
if test $gl_func_frexp_no_libm = yes; then
|
||||
AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
|
||||
[Define if the frexp() function is available in libc.])
|
||||
else
|
||||
AC_LIBOBJ([frexp])
|
||||
fi
|
||||
])
|
||||
|
||||
|
|
15
m4/fseek.m4
Normal file
15
m4/fseek.m4
Normal 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
61
m4/fseeko.m4
Normal 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
15
m4/ftell.m4
Normal 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
127
m4/ftello.m4
Normal 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
|
||||
])
|
|
@ -1,4 +1,4 @@
|
|||
# getaddrinfo.m4 serial 24
|
||||
# getaddrinfo.m4 serial 26
|
||||
dnl Copyright (C) 2004-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,
|
||||
|
@ -24,6 +24,7 @@ AC_DEFUN([gl_GETADDRINFO],
|
|||
fi])
|
||||
LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
|
||||
|
||||
HAVE_GETADDRINFO=1
|
||||
AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <sys/types.h>
|
||||
|
@ -55,16 +56,14 @@ AC_DEFUN([gl_GETADDRINFO],
|
|||
GETADDRINFO_LIB="-lws2_32"
|
||||
LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
|
||||
else
|
||||
AC_LIBOBJ([getaddrinfo])
|
||||
HAVE_GETADDRINFO=0
|
||||
fi
|
||||
fi
|
||||
|
||||
# We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
|
||||
# inline function declared in ws2tcpip.h, so we need to get that
|
||||
# header included somehow.
|
||||
AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
|
||||
gl_cv_func_gai_strerror, [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_CHECK_DECLS([gai_strerror, gai_strerrorA], [], [break], [[
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
|
@ -76,11 +75,29 @@ AC_DEFUN([gl_GETADDRINFO],
|
|||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
]], [[gai_strerror (NULL);]])],
|
||||
[gl_cv_func_gai_strerror=yes],
|
||||
[gl_cv_func_gai_strerror=no])])
|
||||
if test $gl_cv_func_gai_strerror = no; then
|
||||
AC_LIBOBJ([gai_strerror])
|
||||
]])
|
||||
if test $ac_cv_have_decl_gai_strerror = yes; then
|
||||
dnl check for correct signature
|
||||
AC_CACHE_CHECK([for gai_strerror with POSIX signature],
|
||||
[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
|
||||
|
||||
LIBS="$gai_saved_LIBS"
|
||||
|
@ -112,7 +129,7 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
|
|||
|
||||
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/socket.h in i386-unknown-freebsd4.10 and
|
||||
powerpc-apple-darwin5.5 required it. */
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
|
||||
# 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:
|
||||
gl_LOCAL_DIR([])
|
||||
|
@ -67,6 +67,8 @@ gl_MODULES([
|
|||
malloc-gnu
|
||||
malloca
|
||||
nproc
|
||||
open
|
||||
pipe2
|
||||
putenv
|
||||
recv
|
||||
recvfrom
|
||||
|
@ -99,4 +101,5 @@ gl_MAKEFILE_NAME([])
|
|||
gl_LIBTOOL
|
||||
gl_MACRO_PREFIX([gl])
|
||||
gl_PO_DOMAIN([])
|
||||
gl_WITNESS_C_DOMAIN([])
|
||||
gl_VC_FILES([false])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# gnulib-common.m4 serial 24
|
||||
# gnulib-common.m4 serial 26
|
||||
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,
|
||||
|
@ -34,6 +34,20 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
|
||||
is a misnomer outside of parameter lists. */
|
||||
#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 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
|
||||
# whether a gnulib module that has been requested shall be considered present
|
||||
# or not.
|
||||
AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1])
|
||||
m4_define([gl_MODULE_INDICATOR_CONDITION], [1])
|
||||
|
||||
# gl_MODULE_INDICATOR_SET_VARIABLE([modulename])
|
||||
# sets the shell variable that indicates the presence of the given module to
|
||||
# a C preprocessor expression that will evaluate to 1.
|
||||
AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
|
||||
[
|
||||
GNULIB_[]m4_translit([[$1]],
|
||||
[abcdefghijklmnopqrstuvwxyz./-],
|
||||
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION
|
||||
gl_MODULE_INDICATOR_SET_VARIABLE_AUX(
|
||||
[GNULIB_[]m4_translit([[$1]],
|
||||
[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])
|
||||
|
|
|
@ -35,6 +35,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module arpa_inet:
|
||||
# Code from module autobuild:
|
||||
AB_INIT
|
||||
# Code from module binary-io:
|
||||
# Code from module bind:
|
||||
# Code from module byteswap:
|
||||
# Code from module c++defs:
|
||||
|
@ -52,13 +53,24 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module extensions:
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
# Code from module fclose:
|
||||
# Code from module fcntl-h:
|
||||
# Code from module fd-hook:
|
||||
# Code from module fflush:
|
||||
AC_REQUIRE([AC_FUNC_FSEEKO])
|
||||
# Code from module float:
|
||||
# Code from module flock:
|
||||
# Code from module floor:
|
||||
# Code from module fpieee:
|
||||
AC_REQUIRE([gl_FP_IEEE])
|
||||
# Code from module fpurge:
|
||||
# Code from module freading:
|
||||
# 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-write:
|
||||
# Code from module func:
|
||||
|
@ -97,6 +109,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module listen:
|
||||
# Code from module locale:
|
||||
# Code from module log1p:
|
||||
# Code from module lseek:
|
||||
# Code from module lstat:
|
||||
# Code from module maintainer-makefile:
|
||||
# Code from module malloc-gnu:
|
||||
|
@ -107,8 +120,11 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module multiarch:
|
||||
# Code from module netdb:
|
||||
# Code from module netinet_in:
|
||||
# Code from module nocrash:
|
||||
# Code from module nproc:
|
||||
# Code from module open:
|
||||
# Code from module pathmax:
|
||||
# Code from module pipe2:
|
||||
# Code from module putenv:
|
||||
# Code from module read:
|
||||
# Code from module readlink:
|
||||
|
@ -181,375 +197,390 @@ AC_DEFUN([gl_INIT],
|
|||
m4_pushdef([gl_LIBSOURCES_DIR], [])
|
||||
gl_COMMON
|
||||
gl_source_base='lib'
|
||||
# Code from module accept:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([accept])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([accept])
|
||||
# Code from module alignof:
|
||||
# Code from module alloca-opt:
|
||||
gl_FUNC_ALLOCA
|
||||
# Code from module announce-gen:
|
||||
# Code from module arg-nonnull:
|
||||
# Code from module arpa_inet:
|
||||
gl_HEADER_ARPA_INET
|
||||
AC_PROG_MKDIR_P
|
||||
# Code from module autobuild:
|
||||
# Code from module bind:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([bind])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([bind])
|
||||
# Code from module byteswap:
|
||||
gl_BYTESWAP
|
||||
# Code from module c++defs:
|
||||
# Code from module c-ctype:
|
||||
# Code from module c-strcase:
|
||||
# Code from module c-strcaseeq:
|
||||
# Code from module canonicalize-lgpl:
|
||||
gl_CANONICALIZE_LGPL
|
||||
gl_MODULE_INDICATOR([canonicalize-lgpl])
|
||||
gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
|
||||
gl_STDLIB_MODULE_INDICATOR([realpath])
|
||||
# Code from module ceil:
|
||||
gl_FUNC_CEIL
|
||||
gl_MATH_MODULE_INDICATOR([ceil])
|
||||
# Code from module close:
|
||||
gl_FUNC_CLOSE
|
||||
gl_UNISTD_MODULE_INDICATOR([close])
|
||||
# Code from module connect:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([connect])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([connect])
|
||||
# Code from module dosname:
|
||||
# Code from module duplocale:
|
||||
gl_FUNC_DUPLOCALE
|
||||
gl_LOCALE_MODULE_INDICATOR([duplocale])
|
||||
# Code from module environ:
|
||||
gl_ENVIRON
|
||||
gl_UNISTD_MODULE_INDICATOR([environ])
|
||||
# Code from module errno:
|
||||
gl_HEADER_ERRNO_H
|
||||
# Code from module extensions:
|
||||
# Code from module fclose:
|
||||
gl_FUNC_FCLOSE
|
||||
gl_STDIO_MODULE_INDICATOR([fclose])
|
||||
# Code from module fd-hook:
|
||||
# Code from module float:
|
||||
gl_FLOAT_H
|
||||
# Code from module flock:
|
||||
gl_FUNC_FLOCK
|
||||
gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock])
|
||||
# Code from module floor:
|
||||
gl_FUNC_FLOOR
|
||||
gl_MATH_MODULE_INDICATOR([floor])
|
||||
# Code from module fpieee:
|
||||
# Code from module frexp:
|
||||
gl_FUNC_FREXP
|
||||
gl_MATH_MODULE_INDICATOR([frexp])
|
||||
# Code from module full-read:
|
||||
# Code from module full-write:
|
||||
# Code from module func:
|
||||
gl_FUNC
|
||||
# Code from module gendocs:
|
||||
# Code from module getaddrinfo:
|
||||
gl_GETADDRINFO
|
||||
gl_NETDB_MODULE_INDICATOR([getaddrinfo])
|
||||
# Code from module getpeername:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([getpeername])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([getpeername])
|
||||
# Code from module getsockname:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([getsockname])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([getsockname])
|
||||
# Code from module getsockopt:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([getsockopt])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([getsockopt])
|
||||
# Code from module gettext-h:
|
||||
AC_SUBST([LIBINTL])
|
||||
AC_SUBST([LTLIBINTL])
|
||||
# Code from module git-version-gen:
|
||||
# Code from module gitlog-to-changelog:
|
||||
# Code from module gnu-web-doc-update:
|
||||
# Code from module gnumakefile:
|
||||
# Autoconf 2.61a.99 and earlier don't support linking a file only
|
||||
# in VPATH builds. But since GNUmakefile is for maintainer use
|
||||
# only, it does not matter if we skip the link with older autoconf.
|
||||
# Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH
|
||||
# builds, so use a shell variable to bypass this.
|
||||
GNUmakefile=GNUmakefile
|
||||
m4_if(m4_version_compare([2.61a.100],
|
||||
m4_defn([m4_PACKAGE_VERSION])), [1], [],
|
||||
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
|
||||
[GNUmakefile=$GNUmakefile])])
|
||||
# Code from module gnupload:
|
||||
# Code from module gperf:
|
||||
# Code from module havelib:
|
||||
# Code from module hostent:
|
||||
gl_HOSTENT
|
||||
# Code from module iconv:
|
||||
AM_ICONV
|
||||
m4_ifdef([gl_ICONV_MODULE_INDICATOR],
|
||||
[gl_ICONV_MODULE_INDICATOR([iconv])])
|
||||
# Code from module iconv-h:
|
||||
gl_ICONV_H
|
||||
# Code from module iconv_open:
|
||||
gl_FUNC_ICONV_OPEN
|
||||
# Code from module iconv_open-utf:
|
||||
gl_FUNC_ICONV_OPEN_UTF
|
||||
# Code from module include_next:
|
||||
# Code from module inet_ntop:
|
||||
gl_FUNC_INET_NTOP
|
||||
gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
|
||||
# Code from module inet_pton:
|
||||
gl_FUNC_INET_PTON
|
||||
gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
|
||||
# Code from module inline:
|
||||
gl_INLINE
|
||||
# Code from module isinf:
|
||||
gl_ISINF
|
||||
gl_MATH_MODULE_INDICATOR([isinf])
|
||||
# Code from module isnan:
|
||||
gl_ISNAN
|
||||
gl_MATH_MODULE_INDICATOR([isnan])
|
||||
# Code from module isnand:
|
||||
gl_FUNC_ISNAND
|
||||
gl_MATH_MODULE_INDICATOR([isnand])
|
||||
# Code from module isnand-nolibm:
|
||||
gl_FUNC_ISNAND_NO_LIBM
|
||||
# Code from module isnanf:
|
||||
gl_FUNC_ISNANF
|
||||
gl_MATH_MODULE_INDICATOR([isnanf])
|
||||
# Code from module isnanl:
|
||||
gl_FUNC_ISNANL
|
||||
gl_MATH_MODULE_INDICATOR([isnanl])
|
||||
# Code from module ldexp:
|
||||
gl_FUNC_LDEXP
|
||||
# Code from module lib-symbol-versions:
|
||||
gl_LD_VERSION_SCRIPT
|
||||
# Code from module lib-symbol-visibility:
|
||||
gl_VISIBILITY
|
||||
# Code from module libunistring:
|
||||
gl_LIBUNISTRING
|
||||
# Code from module listen:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([listen])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([listen])
|
||||
# Code from module locale:
|
||||
gl_LOCALE_H
|
||||
# Code from module log1p:
|
||||
gl_COMMON_DOUBLE_MATHFUNC([log1p])
|
||||
# Code from module lstat:
|
||||
gl_FUNC_LSTAT
|
||||
gl_SYS_STAT_MODULE_INDICATOR([lstat])
|
||||
# Code from module maintainer-makefile:
|
||||
AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
|
||||
[AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
|
||||
# Code from module malloc-gnu:
|
||||
gl_FUNC_MALLOC_GNU
|
||||
gl_MODULE_INDICATOR([malloc-gnu])
|
||||
# Code from module malloc-posix:
|
||||
gl_FUNC_MALLOC_POSIX
|
||||
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
|
||||
# Code from module malloca:
|
||||
gl_MALLOCA
|
||||
# Code from module math:
|
||||
gl_MATH_H
|
||||
# Code from module memchr:
|
||||
gl_FUNC_MEMCHR
|
||||
gl_STRING_MODULE_INDICATOR([memchr])
|
||||
# Code from module multiarch:
|
||||
gl_MULTIARCH
|
||||
# Code from module netdb:
|
||||
gl_HEADER_NETDB
|
||||
# Code from module netinet_in:
|
||||
gl_HEADER_NETINET_IN
|
||||
AC_PROG_MKDIR_P
|
||||
# Code from module nproc:
|
||||
gl_NPROC
|
||||
# Code from module pathmax:
|
||||
gl_PATHMAX
|
||||
# Code from module putenv:
|
||||
gl_FUNC_PUTENV
|
||||
gl_STDLIB_MODULE_INDICATOR([putenv])
|
||||
# Code from module read:
|
||||
gl_FUNC_READ
|
||||
gl_UNISTD_MODULE_INDICATOR([read])
|
||||
# Code from module readlink:
|
||||
gl_FUNC_READLINK
|
||||
gl_UNISTD_MODULE_INDICATOR([readlink])
|
||||
# Code from module recv:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([recv])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([recv])
|
||||
# Code from module recvfrom:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([recvfrom])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
|
||||
# Code from module safe-read:
|
||||
gl_SAFE_READ
|
||||
# Code from module safe-write:
|
||||
gl_SAFE_WRITE
|
||||
# Code from module send:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([send])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([send])
|
||||
# Code from module sendto:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([sendto])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([sendto])
|
||||
# Code from module servent:
|
||||
gl_SERVENT
|
||||
# Code from module setsockopt:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([setsockopt])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt])
|
||||
# Code from module shutdown:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([shutdown])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([shutdown])
|
||||
# Code from module size_max:
|
||||
gl_SIZE_MAX
|
||||
# Code from module snprintf:
|
||||
gl_FUNC_SNPRINTF
|
||||
gl_STDIO_MODULE_INDICATOR([snprintf])
|
||||
gl_MODULE_INDICATOR([snprintf])
|
||||
# Code from module socket:
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([socket])
|
||||
fi
|
||||
# When this module is used, sockets may actually occur as file descriptors,
|
||||
# hence it is worth warning if the modules 'close' and 'ioctl' are not used.
|
||||
m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
|
||||
m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
|
||||
AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
|
||||
SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([socket])
|
||||
# Code from module socketlib:
|
||||
gl_SOCKETLIB
|
||||
# Code from module sockets:
|
||||
gl_SOCKETS
|
||||
# Code from module socklen:
|
||||
gl_TYPE_SOCKLEN_T
|
||||
# Code from module ssize_t:
|
||||
gt_TYPE_SSIZE_T
|
||||
# Code from module stat:
|
||||
gl_FUNC_STAT
|
||||
gl_SYS_STAT_MODULE_INDICATOR([stat])
|
||||
# Code from module stat-time:
|
||||
gl_STAT_TIME
|
||||
gl_STAT_BIRTHTIME
|
||||
# Code from module stdbool:
|
||||
AM_STDBOOL_H
|
||||
# Code from module stddef:
|
||||
gl_STDDEF_H
|
||||
# Code from module stdint:
|
||||
gl_STDINT_H
|
||||
# Code from module stdio:
|
||||
gl_STDIO_H
|
||||
# Code from module stdlib:
|
||||
gl_STDLIB_H
|
||||
# Code from module strftime:
|
||||
gl_FUNC_GNU_STRFTIME
|
||||
# Code from module striconveh:
|
||||
if test $gl_cond_libtool = false; then
|
||||
gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV"
|
||||
gl_libdeps="$gl_libdeps $LIBICONV"
|
||||
fi
|
||||
# Code from module string:
|
||||
gl_HEADER_STRING_H
|
||||
# Code from module sys_file:
|
||||
gl_HEADER_SYS_FILE_H
|
||||
AC_PROG_MKDIR_P
|
||||
# Code from module sys_socket:
|
||||
gl_HEADER_SYS_SOCKET
|
||||
AC_PROG_MKDIR_P
|
||||
# Code from module sys_stat:
|
||||
gl_HEADER_SYS_STAT_H
|
||||
AC_PROG_MKDIR_P
|
||||
# Code from module sys_time:
|
||||
gl_HEADER_SYS_TIME_H
|
||||
AC_PROG_MKDIR_P
|
||||
# Code from module sys_uio:
|
||||
gl_HEADER_SYS_UIO
|
||||
AC_PROG_MKDIR_P
|
||||
# Code from module time:
|
||||
gl_HEADER_TIME_H
|
||||
# Code from module time_r:
|
||||
gl_TIME_R
|
||||
gl_TIME_MODULE_INDICATOR([time_r])
|
||||
# Code from module trunc:
|
||||
gl_FUNC_TRUNC
|
||||
gl_MATH_MODULE_INDICATOR([trunc])
|
||||
# Code from module unistd:
|
||||
gl_UNISTD_H
|
||||
# Code from module unistr/base:
|
||||
gl_LIBUNISTRING_LIBHEADER([0.9.2], [unistr.h])
|
||||
# Code from module unistr/u8-mbtouc:
|
||||
gl_MODULE_INDICATOR([unistr/u8-mbtouc])
|
||||
gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc])
|
||||
# Code from module unistr/u8-mbtouc-unsafe:
|
||||
gl_MODULE_INDICATOR([unistr/u8-mbtouc-unsafe])
|
||||
gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc-unsafe])
|
||||
# Code from module unistr/u8-mbtoucr:
|
||||
gl_MODULE_INDICATOR([unistr/u8-mbtoucr])
|
||||
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-mbtoucr])
|
||||
# Code from module unistr/u8-prev:
|
||||
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-prev])
|
||||
# Code from module unistr/u8-uctomb:
|
||||
gl_MODULE_INDICATOR([unistr/u8-uctomb])
|
||||
gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-uctomb])
|
||||
# Code from module unitypes:
|
||||
gl_LIBUNISTRING_LIBHEADER([0.9], [unitypes.h])
|
||||
# Code from module unused-parameter:
|
||||
# Code from module useless-if-before-free:
|
||||
# Code from module vasnprintf:
|
||||
gl_FUNC_VASNPRINTF
|
||||
# Code from module vc-list-files:
|
||||
# Code from module verify:
|
||||
# Code from module vsnprintf:
|
||||
gl_FUNC_VSNPRINTF
|
||||
gl_STDIO_MODULE_INDICATOR([vsnprintf])
|
||||
# Code from module warn-on-use:
|
||||
# Code from module warnings:
|
||||
AC_SUBST([WARN_CFLAGS])
|
||||
# Code from module wchar:
|
||||
gl_WCHAR_H
|
||||
# Code from module write:
|
||||
gl_FUNC_WRITE
|
||||
gl_UNISTD_MODULE_INDICATOR([write])
|
||||
# Code from module xsize:
|
||||
gl_XSIZE
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([accept])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([accept])
|
||||
gl_FUNC_ALLOCA
|
||||
gl_HEADER_ARPA_INET
|
||||
AC_PROG_MKDIR_P
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([bind])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([bind])
|
||||
gl_BYTESWAP
|
||||
gl_CANONICALIZE_LGPL
|
||||
if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then
|
||||
AC_LIBOBJ([canonicalize-lgpl])
|
||||
fi
|
||||
gl_MODULE_INDICATOR([canonicalize-lgpl])
|
||||
gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
|
||||
gl_STDLIB_MODULE_INDICATOR([realpath])
|
||||
gl_FUNC_CEIL
|
||||
if test $REPLACE_CEIL = 1; then
|
||||
AC_LIBOBJ([ceil])
|
||||
fi
|
||||
gl_MATH_MODULE_INDICATOR([ceil])
|
||||
gl_FUNC_CLOSE
|
||||
gl_UNISTD_MODULE_INDICATOR([close])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([connect])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([connect])
|
||||
gl_FUNC_DUPLOCALE
|
||||
if test $REPLACE_DUPLOCALE = 1; then
|
||||
AC_LIBOBJ([duplocale])
|
||||
gl_PREREQ_DUPLOCALE
|
||||
fi
|
||||
gl_LOCALE_MODULE_INDICATOR([duplocale])
|
||||
gl_ENVIRON
|
||||
gl_UNISTD_MODULE_INDICATOR([environ])
|
||||
gl_HEADER_ERRNO_H
|
||||
gl_FUNC_FCLOSE
|
||||
gl_STDIO_MODULE_INDICATOR([fclose])
|
||||
gl_FCNTL_H
|
||||
gl_FUNC_FFLUSH
|
||||
if test $REPLACE_FFLUSH = 1; then
|
||||
AC_LIBOBJ([fflush])
|
||||
gl_PREREQ_FFLUSH
|
||||
fi
|
||||
gl_MODULE_INDICATOR([fflush])
|
||||
gl_STDIO_MODULE_INDICATOR([fflush])
|
||||
gl_FLOAT_H
|
||||
gl_FUNC_FLOCK
|
||||
if test $HAVE_FLOCK = 0; then
|
||||
AC_LIBOBJ([flock])
|
||||
gl_PREREQ_FLOCK
|
||||
fi
|
||||
gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock])
|
||||
gl_FUNC_FLOOR
|
||||
if test $REPLACE_FLOOR = 1; then
|
||||
AC_LIBOBJ([floor])
|
||||
fi
|
||||
gl_MATH_MODULE_INDICATOR([floor])
|
||||
gl_FUNC_FPURGE
|
||||
if test $HAVE_FPURGE = 0 || test $REPLACE_FPURGE = 1; then
|
||||
AC_LIBOBJ([fpurge])
|
||||
fi
|
||||
gl_STDIO_MODULE_INDICATOR([fpurge])
|
||||
gl_FUNC_FREADING
|
||||
gl_FUNC_FREXP
|
||||
if test $gl_func_frexp != yes; then
|
||||
AC_LIBOBJ([frexp])
|
||||
fi
|
||||
gl_MATH_MODULE_INDICATOR([frexp])
|
||||
gl_FUNC_FSEEK
|
||||
if test $REPLACE_FSEEK = 1; then
|
||||
AC_LIBOBJ([fseek])
|
||||
fi
|
||||
gl_STDIO_MODULE_INDICATOR([fseek])
|
||||
gl_FUNC_FSEEKO
|
||||
if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
|
||||
AC_LIBOBJ([fseeko])
|
||||
fi
|
||||
gl_STDIO_MODULE_INDICATOR([fseeko])
|
||||
gl_FUNC_FTELL
|
||||
if test $REPLACE_FTELL = 1; then
|
||||
AC_LIBOBJ([ftell])
|
||||
fi
|
||||
gl_STDIO_MODULE_INDICATOR([ftell])
|
||||
gl_FUNC_FTELLO
|
||||
if test $HAVE_FTELLO = 0 || test $REPLACE_FTELLO = 1; then
|
||||
AC_LIBOBJ([ftello])
|
||||
fi
|
||||
gl_STDIO_MODULE_INDICATOR([ftello])
|
||||
gl_FUNC
|
||||
gl_GETADDRINFO
|
||||
if test $HAVE_GETADDRINFO = 0; then
|
||||
AC_LIBOBJ([getaddrinfo])
|
||||
fi
|
||||
if test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1; then
|
||||
AC_LIBOBJ([gai_strerror])
|
||||
fi
|
||||
gl_NETDB_MODULE_INDICATOR([getaddrinfo])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([getpeername])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([getpeername])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([getsockname])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([getsockname])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([getsockopt])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([getsockopt])
|
||||
AC_SUBST([LIBINTL])
|
||||
AC_SUBST([LTLIBINTL])
|
||||
# Autoconf 2.61a.99 and earlier don't support linking a file only
|
||||
# in VPATH builds. But since GNUmakefile is for maintainer use
|
||||
# only, it does not matter if we skip the link with older autoconf.
|
||||
# Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH
|
||||
# builds, so use a shell variable to bypass this.
|
||||
GNUmakefile=GNUmakefile
|
||||
m4_if(m4_version_compare([2.61a.100],
|
||||
m4_defn([m4_PACKAGE_VERSION])), [1], [],
|
||||
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
|
||||
[GNUmakefile=$GNUmakefile])])
|
||||
gl_HOSTENT
|
||||
AM_ICONV
|
||||
m4_ifdef([gl_ICONV_MODULE_INDICATOR],
|
||||
[gl_ICONV_MODULE_INDICATOR([iconv])])
|
||||
gl_ICONV_H
|
||||
gl_FUNC_ICONV_OPEN
|
||||
if test $REPLACE_ICONV_OPEN = 1; then
|
||||
AC_LIBOBJ([iconv_open])
|
||||
fi
|
||||
if test $REPLACE_ICONV = 1; then
|
||||
AC_LIBOBJ([iconv])
|
||||
AC_LIBOBJ([iconv_close])
|
||||
fi
|
||||
gl_FUNC_ICONV_OPEN_UTF
|
||||
gl_FUNC_INET_NTOP
|
||||
if test $HAVE_INET_NTOP = 0; then
|
||||
AC_LIBOBJ([inet_ntop])
|
||||
gl_PREREQ_INET_NTOP
|
||||
fi
|
||||
gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
|
||||
gl_FUNC_INET_PTON
|
||||
if test $HAVE_INET_PTON = 0; then
|
||||
AC_LIBOBJ([inet_pton])
|
||||
gl_PREREQ_INET_PTON
|
||||
fi
|
||||
gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
|
||||
gl_INLINE
|
||||
gl_ISINF
|
||||
if test $REPLACE_ISINF = 1; then
|
||||
AC_LIBOBJ([isinf])
|
||||
fi
|
||||
gl_MATH_MODULE_INDICATOR([isinf])
|
||||
gl_ISNAN
|
||||
gl_MATH_MODULE_INDICATOR([isnan])
|
||||
gl_FUNC_ISNAND
|
||||
m4_ifdef([gl_ISNAN], [
|
||||
AC_REQUIRE([gl_ISNAN])
|
||||
])
|
||||
if test $HAVE_ISNAND = 0 || test $REPLACE_ISNAN = 1; then
|
||||
AC_LIBOBJ([isnand])
|
||||
gl_PREREQ_ISNAND
|
||||
fi
|
||||
gl_MATH_MODULE_INDICATOR([isnand])
|
||||
gl_FUNC_ISNAND_NO_LIBM
|
||||
if test $gl_func_isnand_no_libm != yes; then
|
||||
AC_LIBOBJ([isnand])
|
||||
gl_PREREQ_ISNAND
|
||||
fi
|
||||
gl_FUNC_ISNANF
|
||||
m4_ifdef([gl_ISNAN], [
|
||||
AC_REQUIRE([gl_ISNAN])
|
||||
])
|
||||
if test $HAVE_ISNANF = 0 || test $REPLACE_ISNAN = 1; then
|
||||
AC_LIBOBJ([isnanf])
|
||||
gl_PREREQ_ISNANF
|
||||
fi
|
||||
gl_MATH_MODULE_INDICATOR([isnanf])
|
||||
gl_FUNC_ISNANL
|
||||
m4_ifdef([gl_ISNAN], [
|
||||
AC_REQUIRE([gl_ISNAN])
|
||||
])
|
||||
if test $HAVE_ISNANL = 0 || test $REPLACE_ISNAN = 1; then
|
||||
AC_LIBOBJ([isnanl])
|
||||
gl_PREREQ_ISNANL
|
||||
fi
|
||||
gl_MATH_MODULE_INDICATOR([isnanl])
|
||||
gl_FUNC_LDEXP
|
||||
gl_LD_VERSION_SCRIPT
|
||||
gl_VISIBILITY
|
||||
gl_LIBUNISTRING
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([listen])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([listen])
|
||||
gl_LOCALE_H
|
||||
gl_COMMON_DOUBLE_MATHFUNC([log1p])
|
||||
gl_FUNC_LSEEK
|
||||
if test $REPLACE_LSEEK = 1; then
|
||||
AC_LIBOBJ([lseek])
|
||||
fi
|
||||
gl_UNISTD_MODULE_INDICATOR([lseek])
|
||||
gl_FUNC_LSTAT
|
||||
if test $REPLACE_LSTAT = 1; then
|
||||
AC_LIBOBJ([lstat])
|
||||
gl_PREREQ_LSTAT
|
||||
fi
|
||||
gl_SYS_STAT_MODULE_INDICATOR([lstat])
|
||||
AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
|
||||
[AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
|
||||
gl_FUNC_MALLOC_GNU
|
||||
if test $REPLACE_MALLOC = 1; then
|
||||
AC_LIBOBJ([malloc])
|
||||
fi
|
||||
gl_MODULE_INDICATOR([malloc-gnu])
|
||||
gl_FUNC_MALLOC_POSIX
|
||||
if test $REPLACE_MALLOC = 1; then
|
||||
AC_LIBOBJ([malloc])
|
||||
fi
|
||||
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
|
||||
gl_MALLOCA
|
||||
gl_MATH_H
|
||||
gl_FUNC_MEMCHR
|
||||
if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
|
||||
AC_LIBOBJ([memchr])
|
||||
gl_PREREQ_MEMCHR
|
||||
fi
|
||||
gl_STRING_MODULE_INDICATOR([memchr])
|
||||
gl_MULTIARCH
|
||||
gl_HEADER_NETDB
|
||||
gl_HEADER_NETINET_IN
|
||||
AC_PROG_MKDIR_P
|
||||
gl_NPROC
|
||||
gl_FUNC_OPEN
|
||||
gl_FCNTL_MODULE_INDICATOR([open])
|
||||
gl_PATHMAX
|
||||
gl_FUNC_PIPE2
|
||||
gl_UNISTD_MODULE_INDICATOR([pipe2])
|
||||
gl_FUNC_PUTENV
|
||||
if test $REPLACE_PUTENV = 1; then
|
||||
AC_LIBOBJ([putenv])
|
||||
fi
|
||||
gl_STDLIB_MODULE_INDICATOR([putenv])
|
||||
gl_FUNC_READ
|
||||
if test $REPLACE_READ = 1; then
|
||||
AC_LIBOBJ([read])
|
||||
fi
|
||||
gl_UNISTD_MODULE_INDICATOR([read])
|
||||
gl_FUNC_READLINK
|
||||
if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
|
||||
AC_LIBOBJ([readlink])
|
||||
gl_PREREQ_READLINK
|
||||
fi
|
||||
gl_UNISTD_MODULE_INDICATOR([readlink])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([recv])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([recv])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([recvfrom])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
|
||||
gl_PREREQ_SAFE_READ
|
||||
gl_PREREQ_SAFE_WRITE
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([send])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([send])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([sendto])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([sendto])
|
||||
gl_SERVENT
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([setsockopt])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([shutdown])
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([shutdown])
|
||||
gl_SIZE_MAX
|
||||
gl_FUNC_SNPRINTF
|
||||
gl_STDIO_MODULE_INDICATOR([snprintf])
|
||||
gl_MODULE_INDICATOR([snprintf])
|
||||
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
AC_LIBOBJ([socket])
|
||||
fi
|
||||
# When this module is used, sockets may actually occur as file descriptors,
|
||||
# hence it is worth warning if the modules 'close' and 'ioctl' are not used.
|
||||
m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
|
||||
m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
|
||||
AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2])
|
||||
if test "$ac_cv_header_winsock2_h" = yes; then
|
||||
UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
|
||||
SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1
|
||||
fi
|
||||
gl_SYS_SOCKET_MODULE_INDICATOR([socket])
|
||||
gl_SOCKETLIB
|
||||
gl_SOCKETS
|
||||
gl_TYPE_SOCKLEN_T
|
||||
gt_TYPE_SSIZE_T
|
||||
gl_FUNC_STAT
|
||||
if test $REPLACE_STAT = 1; then
|
||||
AC_LIBOBJ([stat])
|
||||
gl_PREREQ_STAT
|
||||
fi
|
||||
gl_SYS_STAT_MODULE_INDICATOR([stat])
|
||||
gl_STAT_TIME
|
||||
gl_STAT_BIRTHTIME
|
||||
AM_STDBOOL_H
|
||||
gl_STDDEF_H
|
||||
gl_STDINT_H
|
||||
gl_STDIO_H
|
||||
gl_STDLIB_H
|
||||
gl_FUNC_GNU_STRFTIME
|
||||
if test $gl_cond_libtool = false; then
|
||||
gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV"
|
||||
gl_libdeps="$gl_libdeps $LIBICONV"
|
||||
fi
|
||||
gl_HEADER_STRING_H
|
||||
gl_HEADER_SYS_FILE_H
|
||||
AC_PROG_MKDIR_P
|
||||
gl_HEADER_SYS_SOCKET
|
||||
AC_PROG_MKDIR_P
|
||||
gl_HEADER_SYS_STAT_H
|
||||
AC_PROG_MKDIR_P
|
||||
gl_HEADER_SYS_TIME_H
|
||||
AC_PROG_MKDIR_P
|
||||
gl_HEADER_SYS_UIO
|
||||
AC_PROG_MKDIR_P
|
||||
gl_HEADER_TIME_H
|
||||
gl_TIME_R
|
||||
if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
|
||||
AC_LIBOBJ([time_r])
|
||||
gl_PREREQ_TIME_R
|
||||
fi
|
||||
gl_TIME_MODULE_INDICATOR([time_r])
|
||||
gl_FUNC_TRUNC
|
||||
if test $HAVE_DECL_TRUNC = 0 || test $REPLACE_TRUNC = 1; then
|
||||
AC_LIBOBJ([trunc])
|
||||
fi
|
||||
gl_MATH_MODULE_INDICATOR([trunc])
|
||||
gl_UNISTD_H
|
||||
gl_LIBUNISTRING_LIBHEADER([0.9.2], [unistr.h])
|
||||
gl_MODULE_INDICATOR([unistr/u8-mbtouc])
|
||||
gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc])
|
||||
gl_MODULE_INDICATOR([unistr/u8-mbtouc-unsafe])
|
||||
gl_LIBUNISTRING_MODULE([0.9.4], [unistr/u8-mbtouc-unsafe])
|
||||
gl_MODULE_INDICATOR([unistr/u8-mbtoucr])
|
||||
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
|
||||
m4_ifval(gl_LIBSOURCES_LIST, [
|
||||
m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
|
||||
|
@ -705,6 +736,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/alloca.in.h
|
||||
lib/arpa_inet.in.h
|
||||
lib/asnprintf.c
|
||||
lib/binary-io.h
|
||||
lib/bind.c
|
||||
lib/byteswap.in.h
|
||||
lib/c-ctype.c
|
||||
|
@ -721,13 +753,22 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/duplocale.c
|
||||
lib/errno.in.h
|
||||
lib/fclose.c
|
||||
lib/fcntl.in.h
|
||||
lib/fd-hook.c
|
||||
lib/fd-hook.h
|
||||
lib/fflush.c
|
||||
lib/float+.h
|
||||
lib/float.in.h
|
||||
lib/flock.c
|
||||
lib/floor.c
|
||||
lib/fpurge.c
|
||||
lib/freading.c
|
||||
lib/freading.h
|
||||
lib/frexp.c
|
||||
lib/fseek.c
|
||||
lib/fseeko.c
|
||||
lib/ftell.c
|
||||
lib/ftello.c
|
||||
lib/full-read.c
|
||||
lib/full-read.h
|
||||
lib/full-write.c
|
||||
|
@ -759,6 +800,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/libunistring.valgrind
|
||||
lib/listen.c
|
||||
lib/locale.in.h
|
||||
lib/lseek.c
|
||||
lib/lstat.c
|
||||
lib/malloc.c
|
||||
lib/malloca.c
|
||||
|
@ -771,7 +813,9 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/netinet_in.in.h
|
||||
lib/nproc.c
|
||||
lib/nproc.h
|
||||
lib/open.c
|
||||
lib/pathmax.h
|
||||
lib/pipe2.c
|
||||
lib/printf-args.c
|
||||
lib/printf-args.h
|
||||
lib/printf-parse.c
|
||||
|
@ -799,6 +843,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/stdbool.in.h
|
||||
lib/stddef.in.h
|
||||
lib/stdint.in.h
|
||||
lib/stdio-impl.h
|
||||
lib/stdio.in.h
|
||||
lib/stdlib.in.h
|
||||
lib/strftime.c
|
||||
|
@ -853,17 +898,27 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/exponentl.m4
|
||||
m4/extensions.m4
|
||||
m4/fclose.m4
|
||||
m4/fcntl-o.m4
|
||||
m4/fcntl_h.m4
|
||||
m4/fflush.m4
|
||||
m4/float_h.m4
|
||||
m4/flock.m4
|
||||
m4/floor.m4
|
||||
m4/fpieee.m4
|
||||
m4/fpurge.m4
|
||||
m4/freading.m4
|
||||
m4/frexp.m4
|
||||
m4/fseek.m4
|
||||
m4/fseeko.m4
|
||||
m4/ftell.m4
|
||||
m4/ftello.m4
|
||||
m4/func.m4
|
||||
m4/getaddrinfo.m4
|
||||
m4/gnulib-common.m4
|
||||
m4/hostent.m4
|
||||
m4/iconv.m4
|
||||
m4/iconv_h.m4
|
||||
m4/iconv_open-utf.m4
|
||||
m4/iconv_open.m4
|
||||
m4/include_next.m4
|
||||
m4/inet_ntop.m4
|
||||
|
@ -885,6 +940,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/libunistring.m4
|
||||
m4/locale_h.m4
|
||||
m4/longlong.m4
|
||||
m4/lseek.m4
|
||||
m4/lstat.m4
|
||||
m4/malloc.m4
|
||||
m4/malloca.m4
|
||||
|
@ -892,11 +948,15 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/mathfunc.m4
|
||||
m4/memchr.m4
|
||||
m4/mmap-anon.m4
|
||||
m4/mode_t.m4
|
||||
m4/multiarch.m4
|
||||
m4/netdb_h.m4
|
||||
m4/netinet_in_h.m4
|
||||
m4/nocrash.m4
|
||||
m4/nproc.m4
|
||||
m4/open.m4
|
||||
m4/pathmax.m4
|
||||
m4/pipe2.m4
|
||||
m4/printf.m4
|
||||
m4/putenv.m4
|
||||
m4/read.m4
|
||||
|
|
231
m4/iconv_open-utf.m4
Normal file
231
m4/iconv_open-utf.m4
Normal 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
|
||||
])
|
243
m4/iconv_open.m4
243
m4/iconv_open.m4
|
@ -1,4 +1,4 @@
|
|||
# iconv_open.m4 serial 12
|
||||
# iconv_open.m4 serial 14
|
||||
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,
|
||||
|
@ -36,6 +36,16 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN],
|
|||
gl_REPLACE_ICONV_OPEN
|
||||
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
|
||||
])
|
||||
|
||||
|
@ -43,235 +53,4 @@ AC_DEFUN([gl_REPLACE_ICONV_OPEN],
|
|||
[
|
||||
gl_REPLACE_ICONV_H
|
||||
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
|
||||
])
|
||||
|
|
|
@ -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 This file is free software; the Free Software Foundation
|
||||
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.
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
gl_REPLACE_ARPA_INET_H
|
||||
|
||||
dnl Most platforms that provide inet_ntop define it in libc.
|
||||
dnl Solaris 8..10 provide inet_ntop in libnsl instead.
|
||||
HAVE_INET_NTOP=1
|
||||
gl_save_LIBS=$LIBS
|
||||
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
|
||||
|
||||
INET_NTOP_LIB=
|
||||
if test "$ac_cv_search_inet_ntop" != "no" &&
|
||||
test "$ac_cv_search_inet_ntop" != "none required"; then
|
||||
|
@ -24,11 +28,6 @@ AC_DEFUN([gl_FUNC_INET_NTOP],
|
|||
fi
|
||||
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_DECLS([inet_ntop],,,
|
||||
[#include <arpa/inet.h>
|
||||
|
@ -38,7 +37,11 @@ AC_DEFUN([gl_PREREQ_INET_NTOP], [
|
|||
])
|
||||
if test $ac_cv_have_decl_inet_ntop = no; then
|
||||
HAVE_DECL_INET_NTOP=0
|
||||
AC_REQUIRE([AC_C_RESTRICT])
|
||||
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])
|
||||
])
|
||||
|
|
|
@ -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 This file is free software; the Free Software Foundation
|
||||
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.
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
gl_REPLACE_ARPA_INET_H
|
||||
|
||||
dnl Most platforms that provide inet_pton define it in libc.
|
||||
dnl Solaris 8..10 provide inet_pton in libnsl instead.
|
||||
HAVE_INET_PTON=1
|
||||
gl_save_LIBS=$LIBS
|
||||
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
|
||||
|
||||
INET_PTON_LIB=
|
||||
if test "$ac_cv_search_inet_pton" != "no" &&
|
||||
test "$ac_cv_search_inet_pton" != "none required"; then
|
||||
|
@ -24,11 +28,6 @@ AC_DEFUN([gl_FUNC_INET_PTON],
|
|||
fi
|
||||
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_DECLS([inet_pton],,,
|
||||
[#include <arpa/inet.h>
|
||||
|
@ -38,7 +37,11 @@ AC_DEFUN([gl_PREREQ_INET_PTON], [
|
|||
])
|
||||
if test $ac_cv_have_decl_inet_pton = no; then
|
||||
HAVE_DECL_INET_PTON=0
|
||||
AC_REQUIRE([AC_C_RESTRICT])
|
||||
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])
|
||||
])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# isinf.m4 serial 3
|
||||
# isinf.m4 serial 4
|
||||
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,
|
||||
|
@ -24,7 +24,7 @@ AC_DEFUN([gl_ISINF],
|
|||
if test "$ac_cv_have_decl_isinf" != yes ||
|
||||
test "$ISINF_LIBM" = missing; then
|
||||
REPLACE_ISINF=1
|
||||
AC_LIBOBJ([isinf])
|
||||
dnl No libraries are needed to link lib/isinf.c.
|
||||
ISINF_LIBM=
|
||||
fi
|
||||
AC_SUBST([ISINF_LIBM])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# isnan.m4 serial 3
|
||||
# isnan.m4 serial 5
|
||||
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,
|
||||
|
@ -36,11 +36,8 @@ AC_DEFUN([gl_ISNAN],
|
|||
esac
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
dnl REPLACE_ISNAN=1 also makes sure the rpl_isnan[fdl] functions get built.
|
||||
REPLACE_ISNAN=1
|
||||
# Make sure the rpl_isnan[fdl] functions get built.
|
||||
gl_BUILD_ISNANF
|
||||
gl_BUILD_ISNAND
|
||||
gl_BUILD_ISNANL
|
||||
ISNAN_LIBM=
|
||||
fi
|
||||
AC_SUBST([ISNAN_LIBM])
|
||||
|
|
11
m4/isnand.m4
11
m4/isnand.m4
|
@ -1,4 +1,4 @@
|
|||
# isnand.m4 serial 8
|
||||
# isnand.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,
|
||||
|
@ -24,7 +24,6 @@ AC_DEFUN([gl_FUNC_ISNAND],
|
|||
else
|
||||
gl_func_isnand=no
|
||||
HAVE_ISNAND=0
|
||||
gl_BUILD_ISNAND
|
||||
fi
|
||||
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],
|
||||
[
|
||||
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
|
||||
AC_DEFINE([HAVE_ISNAND_IN_LIBC], [1],
|
||||
[Define if the isnan(double) function is available in libc.])
|
||||
else
|
||||
gl_BUILD_ISNAND
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Pull in replacement isnand definition. It does not need -lm.
|
||||
AC_DEFUN([gl_BUILD_ISNAND],
|
||||
dnl Prerequisites of replacement isnand definition. It does not need -lm.
|
||||
AC_DEFUN([gl_PREREQ_ISNAND],
|
||||
[
|
||||
AC_LIBOBJ([isnand])
|
||||
gl_DOUBLE_EXPONENT_LOCATION
|
||||
])
|
||||
|
||||
|
|
12
m4/isnanf.m4
12
m4/isnanf.m4
|
@ -1,4 +1,4 @@
|
|||
# isnanf.m4 serial 12
|
||||
# isnanf.m4 serial 14
|
||||
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,
|
||||
|
@ -17,6 +17,7 @@ AC_DEFUN([gl_FUNC_ISNANF],
|
|||
ISNANF_LIBM=-lm
|
||||
fi
|
||||
fi
|
||||
dnl The variable gl_func_isnanf set here is used by isnan.m4.
|
||||
if test $gl_cv_func_isnanf_no_libm = yes \
|
||||
|| test $gl_cv_func_isnanf_in_libm = yes; then
|
||||
save_LIBS="$LIBS"
|
||||
|
@ -32,7 +33,6 @@ AC_DEFUN([gl_FUNC_ISNANF],
|
|||
fi
|
||||
if test $gl_func_isnanf != yes; then
|
||||
HAVE_ISNANF=0
|
||||
gl_BUILD_ISNANF
|
||||
fi
|
||||
AC_SUBST([ISNANF_LIBM])
|
||||
])
|
||||
|
@ -51,17 +51,17 @@ AC_DEFUN([gl_FUNC_ISNANF_NO_LIBM],
|
|||
*) false;;
|
||||
esac
|
||||
}; then
|
||||
gl_func_isnanf_no_libm=yes
|
||||
AC_DEFINE([HAVE_ISNANF_IN_LIBC], [1],
|
||||
[Define if the isnan(float) function is available in libc.])
|
||||
else
|
||||
gl_BUILD_ISNANF
|
||||
gl_func_isnanf_no_libm=no
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Pull in replacement isnanf definition. It does not need -lm.
|
||||
AC_DEFUN([gl_BUILD_ISNANF],
|
||||
dnl Prerequisites of replacement isnanf definition. It does not need -lm.
|
||||
AC_DEFUN([gl_PREREQ_ISNANF],
|
||||
[
|
||||
AC_LIBOBJ([isnanf])
|
||||
gl_FLOAT_EXPONENT_LOCATION
|
||||
])
|
||||
|
||||
|
|
11
m4/isnanl.m4
11
m4/isnanl.m4
|
@ -1,4 +1,4 @@
|
|||
# isnanl.m4 serial 14
|
||||
# isnanl.m4 serial 16
|
||||
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,
|
||||
|
@ -15,6 +15,7 @@ AC_DEFUN([gl_FUNC_ISNANL],
|
|||
ISNANL_LIBM=-lm
|
||||
fi
|
||||
fi
|
||||
dnl The variable gl_func_isnanl set here is used by isnan.m4.
|
||||
if test $gl_cv_func_isnanl_no_libm = yes \
|
||||
|| test $gl_cv_func_isnanl_in_libm = yes; then
|
||||
save_LIBS="$LIBS"
|
||||
|
@ -30,7 +31,6 @@ AC_DEFUN([gl_FUNC_ISNANL],
|
|||
fi
|
||||
if test $gl_func_isnanl != yes; then
|
||||
HAVE_ISNANL=0
|
||||
gl_BUILD_ISNANL
|
||||
fi
|
||||
AC_SUBST([ISNANL_LIBM])
|
||||
])
|
||||
|
@ -49,15 +49,12 @@ AC_DEFUN([gl_FUNC_ISNANL_NO_LIBM],
|
|||
if test $gl_func_isnanl_no_libm = yes; then
|
||||
AC_DEFINE([HAVE_ISNANL_IN_LIBC], [1],
|
||||
[Define if the isnan(long double) function is available in libc.])
|
||||
else
|
||||
gl_BUILD_ISNANL
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Pull in replacement isnanl definition. It does not need -lm.
|
||||
AC_DEFUN([gl_BUILD_ISNANL],
|
||||
dnl Prerequisites of replacement isnanl definition. It does not need -lm.
|
||||
AC_DEFUN([gl_PREREQ_ISNANL],
|
||||
[
|
||||
AC_LIBOBJ([isnanl])
|
||||
gl_LONG_DOUBLE_EXPONENT_LOCATION
|
||||
])
|
||||
|
||||
|
|
|
@ -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 This file is free software; the Free Software Foundation
|
||||
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.
|
||||
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 corresponding gnulib module is not in use.
|
||||
gl_WARN_ON_USE_PREPARE([[#include <locale.h>
|
||||
|
@ -74,13 +68,6 @@ AC_DEFUN([gl_LOCALE_H],
|
|||
[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],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
|
|
42
m4/lseek.m4
Normal file
42
m4/lseek.m4
Normal 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
|
||||
])
|
35
m4/lstat.m4
35
m4/lstat.m4
|
@ -1,4 +1,4 @@
|
|||
# serial 21
|
||||
# serial 22
|
||||
|
||||
# Copyright (C) 1997-2001, 2003-2011 Free Software Foundation, Inc.
|
||||
#
|
||||
|
@ -16,23 +16,27 @@ AC_DEFUN([gl_FUNC_LSTAT],
|
|||
AC_CHECK_FUNCS_ONCE([lstat])
|
||||
if test $ac_cv_func_lstat = yes; then
|
||||
AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
|
||||
if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
|
||||
dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ([lstat]).
|
||||
if test $gl_cv_func_lstat_dereferences_slashed_symlink = no; then
|
||||
REPLACE_LSTAT=1
|
||||
fi
|
||||
# Prerequisites of lib/lstat.c.
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
else
|
||||
HAVE_LSTAT=0
|
||||
fi
|
||||
])
|
||||
|
||||
# Redefine AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, because it is no longer
|
||||
# maintained in Autoconf.
|
||||
AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
|
||||
# Prerequisites of lib/lstat.c.
|
||||
AC_DEFUN([gl_PREREQ_LSTAT],
|
||||
[
|
||||
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_cv_func_lstat_dereferences_slashed_symlink],
|
||||
[gl_cv_func_lstat_dereferences_slashed_symlink],
|
||||
[rm -f conftest.sym conftest.file
|
||||
echo >conftest.file
|
||||
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. */
|
||||
return lstat ("conftest.sym/", &sbuf) == 0;
|
||||
]])],
|
||||
[ac_cv_func_lstat_dereferences_slashed_symlink=yes],
|
||||
[ac_cv_func_lstat_dereferences_slashed_symlink=no],
|
||||
[gl_cv_func_lstat_dereferences_slashed_symlink=yes],
|
||||
[gl_cv_func_lstat_dereferences_slashed_symlink=no],
|
||||
[# When cross-compiling, be pessimistic so we will end up using the
|
||||
# replacement version of lstat that checks for trailing slashes and
|
||||
# calls lstat a second time when necessary.
|
||||
ac_cv_func_lstat_dereferences_slashed_symlink=no
|
||||
gl_cv_func_lstat_dereferences_slashed_symlink=no
|
||||
])
|
||||
else
|
||||
# If the 'ln -s' command failed, then we probably don't even
|
||||
# have an lstat function.
|
||||
ac_cv_func_lstat_dereferences_slashed_symlink=no
|
||||
gl_cv_func_lstat_dereferences_slashed_symlink=no
|
||||
fi
|
||||
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],
|
||||
[Define to 1 if `lstat' dereferences a symlink specified
|
||||
with a trailing slash.])
|
||||
if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
|
||||
AC_LIBOBJ([lstat])
|
||||
fi
|
||||
])
|
||||
|
|
12
m4/malloc.m4
12
m4/malloc.m4
|
@ -1,4 +1,4 @@
|
|||
# malloc.m4 serial 12
|
||||
# malloc.m4 serial 13
|
||||
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,
|
||||
|
@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU],
|
|||
[Define to 1 if your system has a GNU libc compatible 'malloc'
|
||||
function, and to 0 otherwise.])],
|
||||
[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],
|
||||
[Define if the 'malloc' function is POSIX compliant.])
|
||||
else
|
||||
gl_REPLACE_MALLOC
|
||||
REPLACE_MALLOC=1
|
||||
fi
|
||||
])
|
||||
|
||||
|
@ -58,9 +58,3 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX],
|
|||
[gl_cv_func_malloc_posix=no])
|
||||
])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_REPLACE_MALLOC],
|
||||
[
|
||||
AC_LIBOBJ([malloc])
|
||||
REPLACE_MALLOC=1
|
||||
])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# memchr.m4 serial 11
|
||||
# memchr.m4 serial 12
|
||||
dnl Copyright (C) 2002-2004, 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,
|
||||
|
@ -80,10 +80,6 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
|
|||
REPLACE_MEMCHR=1
|
||||
fi
|
||||
fi
|
||||
if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
|
||||
AC_LIBOBJ([memchr])
|
||||
gl_PREREQ_MEMCHR
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/memchr.c.
|
||||
|
|
26
m4/mode_t.m4
Normal file
26
m4/mode_t.m4
Normal 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.])
|
||||
])
|
|
@ -1,4 +1,4 @@
|
|||
# netdb_h.m4 serial 10
|
||||
# netdb_h.m4 serial 11
|
||||
dnl Copyright (C) 2008-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,
|
||||
|
@ -26,6 +26,8 @@ AC_DEFUN([gl_NETDB_MODULE_INDICATOR],
|
|||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
AC_REQUIRE([gl_NETDB_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_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_GETADDRINFO=1; AC_SUBST([HAVE_DECL_GETADDRINFO])
|
||||
HAVE_DECL_GETNAMEINFO=1; AC_SUBST([HAVE_DECL_GETNAMEINFO])
|
||||
REPLACE_GAI_STRERROR=0; AC_SUBST([REPLACE_GAI_STRERROR])
|
||||
])
|
||||
|
|
102
m4/nocrash.m4
Normal file
102
m4/nocrash.m4
Normal 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
90
m4/open.m4
Normal 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
18
m4/pipe2.m4
Normal 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
|
||||
])
|
|
@ -1,4 +1,4 @@
|
|||
# putenv.m4 serial 17
|
||||
# putenv.m4 serial 18
|
||||
dnl Copyright (C) 2002-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,
|
||||
|
@ -36,6 +36,5 @@ AC_DEFUN([gl_FUNC_PUTENV],
|
|||
])
|
||||
if test $gl_cv_func_svid_putenv = no; then
|
||||
REPLACE_PUTENV=1
|
||||
AC_LIBOBJ([putenv])
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# read.m4 serial 1
|
||||
# read.m4 serial 2
|
||||
dnl Copyright (C) 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,
|
||||
|
@ -14,7 +14,6 @@ AC_DEFUN([gl_FUNC_READ],
|
|||
gl_NONBLOCKING_IO
|
||||
if test $gl_cv_have_nonblocking != yes; then
|
||||
REPLACE_READ=1
|
||||
AC_LIBOBJ([read])
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# readlink.m4 serial 9
|
||||
# readlink.m4 serial 11
|
||||
dnl Copyright (C) 2003, 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,
|
||||
|
@ -10,8 +10,6 @@ AC_DEFUN([gl_FUNC_READLINK],
|
|||
AC_CHECK_FUNCS_ONCE([readlink])
|
||||
if test $ac_cv_func_readlink = no; then
|
||||
HAVE_READLINK=0
|
||||
AC_LIBOBJ([readlink])
|
||||
gl_PREREQ_READLINK
|
||||
else
|
||||
AC_CACHE_CHECK([whether readlink signature is correct],
|
||||
[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
|
||||
fails to recognize a trailing slash.])
|
||||
REPLACE_READLINK=1
|
||||
AC_LIBOBJ([readlink])
|
||||
elif test "$gl_cv_decl_readlink_works" != yes; then
|
||||
REPLACE_READLINK=1
|
||||
AC_LIBOBJ([readlink])
|
||||
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_CHECK_FUNCS_ONCE([readlink])
|
||||
|
|
|
@ -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 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_SAFE_READ],
|
||||
[
|
||||
AC_LIBOBJ([safe-read])
|
||||
|
||||
gl_PREREQ_SAFE_READ
|
||||
])
|
||||
|
||||
# Prerequisites of lib/safe-read.c.
|
||||
AC_DEFUN([gl_PREREQ_SAFE_READ],
|
||||
[
|
||||
|
|
|
@ -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 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_SAFE_WRITE],
|
||||
[
|
||||
AC_LIBOBJ([safe-write])
|
||||
|
||||
gl_PREREQ_SAFE_WRITE
|
||||
])
|
||||
|
||||
# Prerequisites of lib/safe-write.c.
|
||||
AC_DEFUN([gl_PREREQ_SAFE_WRITE],
|
||||
[
|
||||
|
|
14
m4/stat.m4
14
m4/stat.m4
|
@ -1,4 +1,4 @@
|
|||
# serial 7
|
||||
# serial 8
|
||||
|
||||
# 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
|
||||
help when passed a file name with a trailing slash]);;
|
||||
esac
|
||||
if test $REPLACE_STAT = 1; then
|
||||
AC_LIBOBJ([stat])
|
||||
dnl Prerequisites of lib/stat.c.
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/stat.c.
|
||||
AC_DEFUN([gl_PREREQ_STAT],
|
||||
[
|
||||
AC_REQUIRE([AC_C_INLINE])
|
||||
:
|
||||
])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# stdint.m4 serial 40
|
||||
# stdint.m4 serial 41
|
||||
dnl Copyright (C) 2001-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,
|
||||
|
@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
|
|||
dnl From Paul Eggert and Bruno Haible.
|
||||
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
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# stdio_h.m4 serial 36
|
||||
# stdio_h.m4 serial 37
|
||||
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,
|
||||
|
@ -14,8 +14,6 @@ AC_DEFUN([gl_STDIO_H],
|
|||
dnl <stdio.h> likely needs them.
|
||||
GNULIB_FSCANF=1
|
||||
GNULIB_SCANF=1
|
||||
GNULIB_VFSCANF=1
|
||||
GNULIB_VSCANF=1
|
||||
GNULIB_FGETC=1
|
||||
GNULIB_GETC=1
|
||||
GNULIB_GETCHAR=1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# serial 32
|
||||
# serial 33
|
||||
|
||||
# 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.
|
||||
AC_DEFUN([gl_FUNC_STRFTIME],
|
||||
[
|
||||
AC_LIBOBJ([strftime])
|
||||
|
||||
# This defines (or not) HAVE_TZNAME and HAVE_TM_ZONE.
|
||||
AC_REQUIRE([AC_STRUCT_TIMEZONE])
|
||||
|
||||
|
|
|
@ -50,10 +50,6 @@ AC_DEFUN([gl_TIME_R],
|
|||
else
|
||||
HAVE_LOCALTIME_R=0
|
||||
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.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# trunc.m4 serial 5
|
||||
# trunc.m4 serial 6
|
||||
dnl Copyright (C) 2007, 2010-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,
|
||||
|
@ -79,7 +79,7 @@ int main()
|
|||
HAVE_DECL_TRUNC=0
|
||||
fi
|
||||
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=
|
||||
fi
|
||||
AC_SUBST([TRUNC_LIBM])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# unistd_h.m4 serial 55
|
||||
# unistd_h.m4 serial 56
|
||||
dnl Copyright (C) 2006-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,
|
||||
|
@ -36,8 +36,8 @@ AC_DEFUN([gl_UNISTD_H],
|
|||
]], [chown dup2 dup3 environ euidaccess faccessat fchdir fchownat
|
||||
fsync ftruncate getcwd getdomainname getdtablesize getgroups
|
||||
gethostname getlogin getlogin_r getpagesize getusershell setusershell
|
||||
endusershell lchown link linkat lseek pipe pipe2 pread pwrite readlink
|
||||
readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
|
||||
endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite
|
||||
readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
|
||||
usleep])
|
||||
])
|
||||
|
||||
|
@ -72,6 +72,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
|
|||
GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
|
||||
GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
|
||||
GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
|
||||
GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER])
|
||||
GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
|
||||
GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
|
||||
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_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN])
|
||||
HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
|
||||
HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER])
|
||||
HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN])
|
||||
HAVE_LINK=1; AC_SUBST([HAVE_LINK])
|
||||
HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# warnings.m4 serial 2
|
||||
# warnings.m4 serial 3
|
||||
dnl Copyright (C) 2008-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,
|
||||
|
@ -21,12 +21,12 @@ m4_ifdef([AS_VAR_APPEND],
|
|||
AC_DEFUN([gl_WARN_ADD],
|
||||
[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_$1])dnl
|
||||
AC_CACHE_CHECK([whether compiler handles $1], [gl_Warn], [
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
gl_save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="${CPPFLAGS} $1"
|
||||
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
|
||||
[AS_VAR_SET([gl_Warn], [yes])],
|
||||
[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_IF([gl_Warn], [yes], [gl_AS_VAR_APPEND([gl_Flags], [" $1"])])
|
||||
|
|
|
@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
|
|||
|
||||
dnl Written by Eric Blake.
|
||||
|
||||
# wchar_h.m4 serial 38
|
||||
# wchar_h.m4 serial 39
|
||||
|
||||
AC_DEFUN([gl_WCHAR_H],
|
||||
[
|
||||
|
@ -119,13 +119,6 @@ Configuration aborted.])
|
|||
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],
|
||||
[
|
||||
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
Loading…
Add table
Add a link
Reference in a new issue