diff options
author | Andy Wingo <wingo@pobox.com> | 2011-06-16 18:22:50 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-06-16 19:47:25 +0200 |
commit | 3d458a81c64e4696157b23c7c4c4c150aa4a93b8 (patch) | |
tree | 1478fb3a9faaf203f517a8776f54d00884efdef6 | |
parent | 0b77014f0c7d53b8bdbc7059c92f526560e1cacd (diff) |
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
102 files changed, 4435 insertions, 1494 deletions
diff --git a/build-aux/announce-gen b/build-aux/announce-gen index 488692681..0eb6b5b6e 100755 --- a/build-aux/announce-gen +++ b/build-aux/announce-gen @@ -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"; diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files index 9bb6fe6d3..405e458f5 100755 --- a/build-aux/vc-list-files +++ b/build-aux/vc-list-files @@ -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 "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 +test $# = 0 && set . + +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) diff --git a/lib/Makefile.am b/lib/Makefile.am index 217fcf6a4..dfba180a9 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=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 +# Reproduce by: 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 AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects @@ -136,14 +136,15 @@ arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON $(AM_V_at)$(MKDIR_P) arpa $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \ -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ - -e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \ - -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \ + -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \ + -e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \ -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \ -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ @@ -159,6 +160,12 @@ EXTRA_DIST += arpa_inet.in.h ## end gnulib module arpa_inet +## begin gnulib module binary-io + +libgnu_la_SOURCES += binary-io.h + +## end gnulib module binary-io + ## begin gnulib module bind @@ -296,7 +303,8 @@ if GL_GENERATE_ERRNO_H errno.h: errno.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ @@ -328,6 +336,41 @@ EXTRA_libgnu_la_SOURCES += fclose.c ## end gnulib module fclose +## begin gnulib module fcntl-h + +BUILT_SOURCES += fcntl.h + +# We need the following in order to create <fcntl.h> when the system +# doesn't have one that works with the given compiler. +fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ + -e 's/@''GNULIB_FCNTL''@/$(GNULIB_FCNTL)/g' \ + -e 's/@''GNULIB_NONBLOCKING''@/$(GNULIB_NONBLOCKING)/g' \ + -e 's/@''GNULIB_OPEN''@/$(GNULIB_OPEN)/g' \ + -e 's/@''GNULIB_OPENAT''@/$(GNULIB_OPENAT)/g' \ + -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ + -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ + -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ + -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/fcntl.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += fcntl.h fcntl.h-t + +EXTRA_DIST += fcntl.in.h + +## end gnulib module fcntl-h + ## begin gnulib module fd-hook libgnu_la_SOURCES += fd-hook.c @@ -336,6 +379,15 @@ EXTRA_DIST += fd-hook.h ## end gnulib module fd-hook +## begin gnulib module fflush + + +EXTRA_DIST += fflush.c stdio-impl.h + +EXTRA_libgnu_la_SOURCES += fflush.c + +## end gnulib module fflush + ## begin gnulib module float BUILT_SOURCES += $(FLOAT_H) @@ -346,7 +398,8 @@ if GL_GENERATE_FLOAT_H float.h: float.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \ @@ -381,6 +434,23 @@ EXTRA_libgnu_la_SOURCES += floor.c ## end gnulib module floor +## begin gnulib module fpurge + + +EXTRA_DIST += fpurge.c stdio-impl.h + +EXTRA_libgnu_la_SOURCES += fpurge.c + +## end gnulib module fpurge + +## begin gnulib module freading + +libgnu_la_SOURCES += freading.c + +EXTRA_DIST += freading.h stdio-impl.h + +## end gnulib module freading + ## begin gnulib module frexp @@ -390,6 +460,42 @@ EXTRA_libgnu_la_SOURCES += frexp.c ## end gnulib module frexp +## begin gnulib module fseek + + +EXTRA_DIST += fseek.c + +EXTRA_libgnu_la_SOURCES += fseek.c + +## end gnulib module fseek + +## begin gnulib module fseeko + + +EXTRA_DIST += fseeko.c stdio-impl.h + +EXTRA_libgnu_la_SOURCES += fseeko.c + +## end gnulib module fseeko + +## begin gnulib module ftell + + +EXTRA_DIST += ftell.c + +EXTRA_libgnu_la_SOURCES += ftell.c + +## end gnulib module ftell + +## begin gnulib module ftello + + +EXTRA_DIST += ftello.c stdio-impl.h + +EXTRA_libgnu_la_SOURCES += ftello.c + +## end gnulib module ftello + ## begin gnulib module full-read libgnu_la_SOURCES += full-read.h full-read.c @@ -516,11 +622,12 @@ if GL_GENERATE_ICONV_H iconv.h: iconv.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_ICONV_H''@|$(NEXT_ICONV_H)|g' \ - -e 's|@''GNULIB_ICONV''@|$(GNULIB_ICONV)|g' \ + -e 's/@''GNULIB_ICONV''@/$(GNULIB_ICONV)/g' \ -e 's|@''ICONV_CONST''@|$(ICONV_CONST)|g' \ -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \ -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \ @@ -563,21 +670,12 @@ MOSTLYCLEANFILES += iconv_open-aix.h-t iconv_open-hpux.h-t iconv_open-irix.h MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h EXTRA_DIST += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h iconv_open-osf.h iconv_open-solaris.h -EXTRA_DIST += iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c +EXTRA_DIST += iconv.c iconv_close.c iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c -EXTRA_libgnu_la_SOURCES += iconv_open.c +EXTRA_libgnu_la_SOURCES += iconv.c iconv_close.c iconv_open.c ## end gnulib module iconv_open -## begin gnulib module iconv_open-utf - - -EXTRA_DIST += iconv.c iconv_close.c - -EXTRA_libgnu_la_SOURCES += iconv.c iconv_close.c - -## end gnulib module iconv_open-utf - ## begin gnulib module inet_ntop @@ -676,12 +774,13 @@ BUILT_SOURCES += locale.h locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \ - -e 's|@''GNULIB_SETLOCALE''@|$(GNULIB_SETLOCALE)|g' \ - -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \ + -e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \ + -e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \ -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \ -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \ -e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \ @@ -698,6 +797,15 @@ EXTRA_DIST += locale.in.h ## end gnulib module locale +## begin gnulib module lseek + + +EXTRA_DIST += lseek.c + +EXTRA_libgnu_la_SOURCES += lseek.c + +## end gnulib module lseek + ## begin gnulib module lstat @@ -748,42 +856,43 @@ BUILT_SOURCES += math.h math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT_AS_FIRST_DIRECTIVE''@|$(INCLUDE_NEXT_AS_FIRST_DIRECTIVE)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_AS_FIRST_DIRECTIVE_MATH_H''@|$(NEXT_AS_FIRST_DIRECTIVE_MATH_H)|g' \ - -e 's|@''GNULIB_ACOSL''@|$(GNULIB_ACOSL)|g' \ - -e 's|@''GNULIB_ASINL''@|$(GNULIB_ASINL)|g' \ - -e 's|@''GNULIB_ATANL''@|$(GNULIB_ATANL)|g' \ - -e 's|@''GNULIB_CEIL''@|$(GNULIB_CEIL)|g' \ - -e 's|@''GNULIB_CEILF''@|$(GNULIB_CEILF)|g' \ - -e 's|@''GNULIB_CEILL''@|$(GNULIB_CEILL)|g' \ - -e 's|@''GNULIB_COSL''@|$(GNULIB_COSL)|g' \ - -e 's|@''GNULIB_EXPL''@|$(GNULIB_EXPL)|g' \ - -e 's|@''GNULIB_FLOOR''@|$(GNULIB_FLOOR)|g' \ - -e 's|@''GNULIB_FLOORF''@|$(GNULIB_FLOORF)|g' \ - -e 's|@''GNULIB_FLOORL''@|$(GNULIB_FLOORL)|g' \ - -e 's|@''GNULIB_FREXP''@|$(GNULIB_FREXP)|g' \ - -e 's|@''GNULIB_FREXPL''@|$(GNULIB_FREXPL)|g' \ - -e 's|@''GNULIB_ISFINITE''@|$(GNULIB_ISFINITE)|g' \ - -e 's|@''GNULIB_ISINF''@|$(GNULIB_ISINF)|g' \ - -e 's|@''GNULIB_ISNAN''@|$(GNULIB_ISNAN)|g' \ - -e 's|@''GNULIB_ISNANF''@|$(GNULIB_ISNANF)|g' \ - -e 's|@''GNULIB_ISNAND''@|$(GNULIB_ISNAND)|g' \ - -e 's|@''GNULIB_ISNANL''@|$(GNULIB_ISNANL)|g' \ - -e 's|@''GNULIB_LDEXPL''@|$(GNULIB_LDEXPL)|g' \ - -e 's|@''GNULIB_LOGB''@|$(GNULIB_LOGB)|g' \ - -e 's|@''GNULIB_LOGL''@|$(GNULIB_LOGL)|g' \ - -e 's|@''GNULIB_ROUND''@|$(GNULIB_ROUND)|g' \ - -e 's|@''GNULIB_ROUNDF''@|$(GNULIB_ROUNDF)|g' \ - -e 's|@''GNULIB_ROUNDL''@|$(GNULIB_ROUNDL)|g' \ - -e 's|@''GNULIB_SIGNBIT''@|$(GNULIB_SIGNBIT)|g' \ - -e 's|@''GNULIB_SINL''@|$(GNULIB_SINL)|g' \ - -e 's|@''GNULIB_SQRTL''@|$(GNULIB_SQRTL)|g' \ - -e 's|@''GNULIB_TANL''@|$(GNULIB_TANL)|g' \ - -e 's|@''GNULIB_TRUNC''@|$(GNULIB_TRUNC)|g' \ - -e 's|@''GNULIB_TRUNCF''@|$(GNULIB_TRUNCF)|g' \ - -e 's|@''GNULIB_TRUNCL''@|$(GNULIB_TRUNCL)|g' \ + -e 's/@''GNULIB_ACOSL''@/$(GNULIB_ACOSL)/g' \ + -e 's/@''GNULIB_ASINL''@/$(GNULIB_ASINL)/g' \ + -e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/g' \ + -e 's/@''GNULIB_CEIL''@/$(GNULIB_CEIL)/g' \ + -e 's/@''GNULIB_CEILF''@/$(GNULIB_CEILF)/g' \ + -e 's/@''GNULIB_CEILL''@/$(GNULIB_CEILL)/g' \ + -e 's/@''GNULIB_COSL''@/$(GNULIB_COSL)/g' \ + -e 's/@''GNULIB_EXPL''@/$(GNULIB_EXPL)/g' \ + -e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \ + -e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \ + -e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \ + -e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \ + -e 's/@''GNULIB_FREXPL''@/$(GNULIB_FREXPL)/g' \ + -e 's/@''GNULIB_ISFINITE''@/$(GNULIB_ISFINITE)/g' \ + -e 's/@''GNULIB_ISINF''@/$(GNULIB_ISINF)/g' \ + -e 's/@''GNULIB_ISNAN''@/$(GNULIB_ISNAN)/g' \ + -e 's/@''GNULIB_ISNANF''@/$(GNULIB_ISNANF)/g' \ + -e 's/@''GNULIB_ISNAND''@/$(GNULIB_ISNAND)/g' \ + -e 's/@''GNULIB_ISNANL''@/$(GNULIB_ISNANL)/g' \ + -e 's/@''GNULIB_LDEXPL''@/$(GNULIB_LDEXPL)/g' \ + -e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \ + -e 's/@''GNULIB_LOGL''@/$(GNULIB_LOGL)/g' \ + -e 's/@''GNULIB_ROUND''@/$(GNULIB_ROUND)/g' \ + -e 's/@''GNULIB_ROUNDF''@/$(GNULIB_ROUNDF)/g' \ + -e 's/@''GNULIB_ROUNDL''@/$(GNULIB_ROUNDL)/g' \ + -e 's/@''GNULIB_SIGNBIT''@/$(GNULIB_SIGNBIT)/g' \ + -e 's/@''GNULIB_SINL''@/$(GNULIB_SINL)/g' \ + -e 's/@''GNULIB_SQRTL''@/$(GNULIB_SQRTL)/g' \ + -e 's/@''GNULIB_TANL''@/$(GNULIB_TANL)/g' \ + -e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \ + -e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \ + -e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \ < $(srcdir)/math.in.h | \ sed -e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \ -e 's|@''HAVE_ASINL''@|$(HAVE_ASINL)|g' \ @@ -868,20 +977,23 @@ BUILT_SOURCES += netdb.h # We need the following in order to create <netdb.h> when the system # doesn't have one that works with the given compiler. -netdb.h: netdb.in.h $(top_builddir)/config.status $(ARG_NONNULL_H) $(WARN_ON_USE_H) +netdb.h: netdb.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \ -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \ - -e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \ + -e 's/@''GNULIB_GETADDRINFO''@/$(GNULIB_GETADDRINFO)/g' \ -e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \ -e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \ -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \ -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \ -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \ + -e 's|@''REPLACE_GAI_STRERROR''@|$(REPLACE_GAI_STRERROR)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ < $(srcdir)/netdb.in.h; \ @@ -904,7 +1016,8 @@ netinet/in.h: netinet_in.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) netinet $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \ @@ -931,6 +1044,15 @@ EXTRA_DIST += nproc.h ## end gnulib module nproc +## begin gnulib module open + + +EXTRA_DIST += open.c + +EXTRA_libgnu_la_SOURCES += open.c + +## end gnulib module open + ## begin gnulib module pathmax @@ -938,6 +1060,12 @@ EXTRA_DIST += pathmax.h ## end gnulib module pathmax +## begin gnulib module pipe2 + +libgnu_la_SOURCES += pipe2.c + +## end gnulib module pipe2 + ## begin gnulib module putenv @@ -985,19 +1113,19 @@ EXTRA_libgnu_la_SOURCES += recvfrom.c ## begin gnulib module safe-read +libgnu_la_SOURCES += safe-read.c -EXTRA_DIST += safe-read.c safe-read.h - -EXTRA_libgnu_la_SOURCES += safe-read.c +EXTRA_DIST += safe-read.h ## end gnulib module safe-read ## begin gnulib module safe-write +libgnu_la_SOURCES += safe-write.c -EXTRA_DIST += safe-read.c safe-write.c safe-write.h +EXTRA_DIST += safe-read.c safe-write.h -EXTRA_libgnu_la_SOURCES += safe-read.c safe-write.c +EXTRA_libgnu_la_SOURCES += safe-read.c ## end gnulib module safe-write @@ -1118,7 +1246,8 @@ if GL_GENERATE_STDDEF_H stddef.h: stddef.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ @@ -1147,7 +1276,8 @@ if GL_GENERATE_STDINT_H stdint.h: stdint.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @@ -1195,62 +1325,63 @@ BUILT_SOURCES += stdio.h stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ - -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \ - -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ - -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ - -e 's|@''GNULIB_FGETC''@|$(GNULIB_FGETC)|g' \ - -e 's|@''GNULIB_FGETS''@|$(GNULIB_FGETS)|g' \ - -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \ - -e 's|@''GNULIB_FPRINTF''@|$(GNULIB_FPRINTF)|g' \ - -e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \ - -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ - -e 's|@''GNULIB_FPUTS''@|$(GNULIB_FPUTS)|g' \ - -e 's|@''GNULIB_FREAD''@|$(GNULIB_FREAD)|g' \ - -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \ - -e 's|@''GNULIB_FSCANF''@|$(GNULIB_FSCANF)|g' \ - -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \ - -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \ - -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ - -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ - -e 's|@''GNULIB_FWRITE''@|$(GNULIB_FWRITE)|g' \ - -e 's|@''GNULIB_GETC''@|$(GNULIB_GETC)|g' \ - -e 's|@''GNULIB_GETCHAR''@|$(GNULIB_GETCHAR)|g' \ - -e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \ - -e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \ - -e 's|@''GNULIB_GETS''@|$(GNULIB_GETS)|g' \ - -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ - -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ - -e 's|@''GNULIB_PERROR''@|$(GNULIB_PERROR)|g' \ - -e 's|@''GNULIB_POPEN''@|$(GNULIB_POPEN)|g' \ - -e 's|@''GNULIB_PRINTF''@|$(GNULIB_PRINTF)|g' \ - -e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \ - -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \ - -e 's|@''GNULIB_PUTCHAR''@|$(GNULIB_PUTCHAR)|g' \ - -e 's|@''GNULIB_PUTS''@|$(GNULIB_PUTS)|g' \ - -e 's|@''GNULIB_REMOVE''@|$(GNULIB_REMOVE)|g' \ - -e 's|@''GNULIB_RENAME''@|$(GNULIB_RENAME)|g' \ - -e 's|@''GNULIB_RENAMEAT''@|$(GNULIB_RENAMEAT)|g' \ - -e 's|@''GNULIB_SCANF''@|$(GNULIB_SCANF)|g' \ - -e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \ - -e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_STDIO_H_NONBLOCKING''@|$(GNULIB_STDIO_H_NONBLOCKING)|g' \ - -e 's|@''GNULIB_STDIO_H_SIGPIPE''@|$(GNULIB_STDIO_H_SIGPIPE)|g' \ - -e 's|@''GNULIB_TMPFILE''@|$(GNULIB_TMPFILE)|g' \ - -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ - -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \ - -e 's|@''GNULIB_VFPRINTF''@|$(GNULIB_VFPRINTF)|g' \ - -e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_VFSCANF''@|$(GNULIB_VFSCANF)|g' \ - -e 's|@''GNULIB_VSCANF''@|$(GNULIB_VSCANF)|g' \ - -e 's|@''GNULIB_VPRINTF''@|$(GNULIB_VPRINTF)|g' \ - -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ - -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ - -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ + -e 's/@''GNULIB_DPRINTF''@/$(GNULIB_DPRINTF)/g' \ + -e 's/@''GNULIB_FCLOSE''@/$(GNULIB_FCLOSE)/g' \ + -e 's/@''GNULIB_FFLUSH''@/$(GNULIB_FFLUSH)/g' \ + -e 's/@''GNULIB_FGETC''@/$(GNULIB_FGETC)/g' \ + -e 's/@''GNULIB_FGETS''@/$(GNULIB_FGETS)/g' \ + -e 's/@''GNULIB_FOPEN''@/$(GNULIB_FOPEN)/g' \ + -e 's/@''GNULIB_FPRINTF''@/$(GNULIB_FPRINTF)/g' \ + -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GNULIB_FPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_FPURGE''@/$(GNULIB_FPURGE)/g' \ + -e 's/@''GNULIB_FPUTC''@/$(GNULIB_FPUTC)/g' \ + -e 's/@''GNULIB_FPUTS''@/$(GNULIB_FPUTS)/g' \ + -e 's/@''GNULIB_FREAD''@/$(GNULIB_FREAD)/g' \ + -e 's/@''GNULIB_FREOPEN''@/$(GNULIB_FREOPEN)/g' \ + -e 's/@''GNULIB_FSCANF''@/$(GNULIB_FSCANF)/g' \ + -e 's/@''GNULIB_FSEEK''@/$(GNULIB_FSEEK)/g' \ + -e 's/@''GNULIB_FSEEKO''@/$(GNULIB_FSEEKO)/g' \ + -e 's/@''GNULIB_FTELL''@/$(GNULIB_FTELL)/g' \ + -e 's/@''GNULIB_FTELLO''@/$(GNULIB_FTELLO)/g' \ + -e 's/@''GNULIB_FWRITE''@/$(GNULIB_FWRITE)/g' \ + -e 's/@''GNULIB_GETC''@/$(GNULIB_GETC)/g' \ + -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \ + -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \ + -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \ + -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PERROR''@/$(GNULIB_PERROR)/g' \ + -e 's/@''GNULIB_POPEN''@/$(GNULIB_POPEN)/g' \ + -e 's/@''GNULIB_PRINTF''@/$(GNULIB_PRINTF)/g' \ + -e 's/@''GNULIB_PRINTF_POSIX''@/$(GNULIB_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PUTC''@/$(GNULIB_PUTC)/g' \ + -e 's/@''GNULIB_PUTCHAR''@/$(GNULIB_PUTCHAR)/g' \ + -e 's/@''GNULIB_PUTS''@/$(GNULIB_PUTS)/g' \ + -e 's/@''GNULIB_REMOVE''@/$(GNULIB_REMOVE)/g' \ + -e 's/@''GNULIB_RENAME''@/$(GNULIB_RENAME)/g' \ + -e 's/@''GNULIB_RENAMEAT''@/$(GNULIB_RENAMEAT)/g' \ + -e 's/@''GNULIB_SCANF''@/$(GNULIB_SCANF)/g' \ + -e 's/@''GNULIB_SNPRINTF''@/$(GNULIB_SNPRINTF)/g' \ + -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GNULIB_SPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GNULIB_STDIO_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GNULIB_STDIO_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_TMPFILE''@/$(GNULIB_TMPFILE)/g' \ + -e 's/@''GNULIB_VASPRINTF''@/$(GNULIB_VASPRINTF)/g' \ + -e 's/@''GNULIB_VDPRINTF''@/$(GNULIB_VDPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF''@/$(GNULIB_VFPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GNULIB_VFPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VFSCANF''@/$(GNULIB_VFSCANF)/g' \ + -e 's/@''GNULIB_VSCANF''@/$(GNULIB_VSCANF)/g' \ + -e 's/@''GNULIB_VPRINTF''@/$(GNULIB_VPRINTF)/g' \ + -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GNULIB_VPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VSNPRINTF''@/$(GNULIB_VSNPRINTF)/g' \ + -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GNULIB_VSPRINTF_POSIX)/g' \ < $(srcdir)/stdio.in.h | \ sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ @@ -1318,38 +1449,39 @@ BUILT_SOURCES += stdlib.h stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ - -e 's|@''GNULIB__EXIT''@|$(GNULIB__EXIT)|g' \ - -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ - -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ - -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \ - -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ - -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ - -e 's|@''GNULIB_GRANTPT''@|$(GNULIB_GRANTPT)|g' \ - -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ - -e 's|@''GNULIB_MBTOWC''@|$(GNULIB_MBTOWC)|g' \ - -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ - -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ - -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ - -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ - -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \ - -e 's|@''GNULIB_PTSNAME''@|$(GNULIB_PTSNAME)|g' \ - -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ - -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ - -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ - -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \ - -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ - -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ - -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ - -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ - -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ - -e 's|@''GNULIB_SYSTEM_POSIX''@|$(GNULIB_SYSTEM_POSIX)|g' \ - -e 's|@''GNULIB_UNLOCKPT''@|$(GNULIB_UNLOCKPT)|g' \ - -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ - -e 's|@''GNULIB_WCTOMB''@|$(GNULIB_WCTOMB)|g' \ + -e 's/@''GNULIB__EXIT''@/$(GNULIB__EXIT)/g' \ + -e 's/@''GNULIB_ATOLL''@/$(GNULIB_ATOLL)/g' \ + -e 's/@''GNULIB_CALLOC_POSIX''@/$(GNULIB_CALLOC_POSIX)/g' \ + -e 's/@''GNULIB_CANONICALIZE_FILE_NAME''@/$(GNULIB_CANONICALIZE_FILE_NAME)/g' \ + -e 's/@''GNULIB_GETLOADAVG''@/$(GNULIB_GETLOADAVG)/g' \ + -e 's/@''GNULIB_GETSUBOPT''@/$(GNULIB_GETSUBOPT)/g' \ + -e 's/@''GNULIB_GRANTPT''@/$(GNULIB_GRANTPT)/g' \ + -e 's/@''GNULIB_MALLOC_POSIX''@/$(GNULIB_MALLOC_POSIX)/g' \ + -e 's/@''GNULIB_MBTOWC''@/$(GNULIB_MBTOWC)/g' \ + -e 's/@''GNULIB_MKDTEMP''@/$(GNULIB_MKDTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMP''@/$(GNULIB_MKOSTEMP)/g' \ + -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ + -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ + -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ + -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ + -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ + -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ + -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ + -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ + -e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \ + -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \ + -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \ + -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \ + -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \ + -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \ + -e 's/@''GNULIB_UNLOCKPT''@/$(GNULIB_UNLOCKPT)/g' \ + -e 's/@''GNULIB_UNSETENV''@/$(GNULIB_UNSETENV)/g' \ + -e 's/@''GNULIB_WCTOMB''@/$(GNULIB_WCTOMB)/g' \ < $(srcdir)/stdlib.in.h | \ sed -e 's|@''HAVE__EXIT''@|$(HAVE__EXIT)|g' \ -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ @@ -1400,10 +1532,9 @@ EXTRA_DIST += stdlib.in.h ## begin gnulib module strftime +libgnu_la_SOURCES += strftime.c -EXTRA_DIST += strftime.c strftime.h - -EXTRA_libgnu_la_SOURCES += strftime.c +EXTRA_DIST += strftime.h ## end gnulib module strftime @@ -1427,45 +1558,46 @@ BUILT_SOURCES += string.h string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ - -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ - -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ - -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ - -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ - -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ - -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ - -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ - -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ - -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ - -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ - -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ - -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ - -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ - -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ - -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \ - -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ - -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ - -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ - -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ - -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ - -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ - -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ - -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ - -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ - -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ - -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ - -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ - -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ - -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ - -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ - -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ - -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ - -e 's|@''GNULIB_STRERROR_R''@|$(GNULIB_STRERROR_R)|g' \ - -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ - -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ + -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ + -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \ + -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \ + -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \ + -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \ + -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \ + -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \ + -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \ + -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \ + -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \ + -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \ + -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \ + -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \ + -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \ + -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \ + -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \ + -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \ + -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \ + -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \ + -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \ + -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \ + -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \ + -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \ + -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \ + -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \ + -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \ + -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \ + -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \ + -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \ + -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ + -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ @@ -1523,7 +1655,8 @@ sys/file.h: sys_file.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_SYS_FILE_H''@/$(HAVE_SYS_FILE_H)/g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_SYS_FILE_H''@/$(HAVE_SYS_FILE_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @@ -1551,27 +1684,28 @@ sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_SOCKET_H''@|$(NEXT_SYS_SOCKET_H)|g' \ -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \ - -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ - -e 's|@''GNULIB_SOCKET''@|$(GNULIB_SOCKET)|g' \ - -e 's|@''GNULIB_CONNECT''@|$(GNULIB_CONNECT)|g' \ - -e 's|@''GNULIB_ACCEPT''@|$(GNULIB_ACCEPT)|g' \ - -e 's|@''GNULIB_BIND''@|$(GNULIB_BIND)|g' \ - -e 's|@''GNULIB_GETPEERNAME''@|$(GNULIB_GETPEERNAME)|g' \ - -e 's|@''GNULIB_GETSOCKNAME''@|$(GNULIB_GETSOCKNAME)|g' \ - -e 's|@''GNULIB_GETSOCKOPT''@|$(GNULIB_GETSOCKOPT)|g' \ - -e 's|@''GNULIB_LISTEN''@|$(GNULIB_LISTEN)|g' \ - -e 's|@''GNULIB_RECV''@|$(GNULIB_RECV)|g' \ - -e 's|@''GNULIB_SEND''@|$(GNULIB_SEND)|g' \ - -e 's|@''GNULIB_RECVFROM''@|$(GNULIB_RECVFROM)|g' \ - -e 's|@''GNULIB_SENDTO''@|$(GNULIB_SENDTO)|g' \ - -e 's|@''GNULIB_SETSOCKOPT''@|$(GNULIB_SETSOCKOPT)|g' \ - -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \ - -e 's|@''GNULIB_ACCEPT4''@|$(GNULIB_ACCEPT4)|g' \ + -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_SOCKET''@/$(GNULIB_SOCKET)/g' \ + -e 's/@''GNULIB_CONNECT''@/$(GNULIB_CONNECT)/g' \ + -e 's/@''GNULIB_ACCEPT''@/$(GNULIB_ACCEPT)/g' \ + -e 's/@''GNULIB_BIND''@/$(GNULIB_BIND)/g' \ + -e 's/@''GNULIB_GETPEERNAME''@/$(GNULIB_GETPEERNAME)/g' \ + -e 's/@''GNULIB_GETSOCKNAME''@/$(GNULIB_GETSOCKNAME)/g' \ + -e 's/@''GNULIB_GETSOCKOPT''@/$(GNULIB_GETSOCKOPT)/g' \ + -e 's/@''GNULIB_LISTEN''@/$(GNULIB_LISTEN)/g' \ + -e 's/@''GNULIB_RECV''@/$(GNULIB_RECV)/g' \ + -e 's/@''GNULIB_SEND''@/$(GNULIB_SEND)/g' \ + -e 's/@''GNULIB_RECVFROM''@/$(GNULIB_RECVFROM)/g' \ + -e 's/@''GNULIB_SENDTO''@/$(GNULIB_SENDTO)/g' \ + -e 's/@''GNULIB_SETSOCKOPT''@/$(GNULIB_SETSOCKOPT)/g' \ + -e 's/@''GNULIB_SHUTDOWN''@/$(GNULIB_SHUTDOWN)/g' \ + -e 's/@''GNULIB_ACCEPT4''@/$(GNULIB_ACCEPT4)/g' \ -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \ @@ -1601,22 +1735,23 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ - -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ - -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ - -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ - -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ - -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ - -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ - -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ - -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ - -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ - -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ - -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ - -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ + -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ + -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ + -e 's/@''GNULIB_FUTIMENS''@/$(GNULIB_FUTIMENS)/g' \ + -e 's/@''GNULIB_LCHMOD''@/$(GNULIB_LCHMOD)/g' \ + -e 's/@''GNULIB_LSTAT''@/$(GNULIB_LSTAT)/g' \ + -e 's/@''GNULIB_MKDIRAT''@/$(GNULIB_MKDIRAT)/g' \ + -e 's/@''GNULIB_MKFIFO''@/$(GNULIB_MKFIFO)/g' \ + -e 's/@''GNULIB_MKFIFOAT''@/$(GNULIB_MKFIFOAT)/g' \ + -e 's/@''GNULIB_MKNOD''@/$(GNULIB_MKNOD)/g' \ + -e 's/@''GNULIB_MKNODAT''@/$(GNULIB_MKNODAT)/g' \ + -e 's/@''GNULIB_STAT''@/$(GNULIB_STAT)/g' \ + -e 's/@''GNULIB_UTIMENSAT''@/$(GNULIB_UTIMENSAT)/g' \ -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ @@ -1660,7 +1795,8 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @@ -1691,7 +1827,8 @@ sys/uio.h: sys_uio.in.h $(top_builddir)/config.status $(AM_V_at)$(MKDIR_P) sys $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_SYS_UIO_H''@|$(NEXT_SYS_UIO_H)|g' \ @@ -1715,15 +1852,16 @@ BUILT_SOURCES += time.h time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ - -e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \ - -e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \ - -e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \ - -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \ - -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \ + -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \ + -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ + -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ + -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ @@ -1774,54 +1912,56 @@ BUILT_SOURCES += unistd.h unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ - -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ - -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \ - -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ - -e 's|@''GNULIB_DUP3''@|$(GNULIB_DUP3)|g' \ - -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \ - -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \ - -e 's|@''GNULIB_FACCESSAT''@|$(GNULIB_FACCESSAT)|g' \ - -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ - -e 's|@''GNULIB_FCHOWNAT''@|$(GNULIB_FCHOWNAT)|g' \ - -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \ - -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ - -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ - -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \ - -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \ - -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \ - -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \ - -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \ - -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \ - -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ - -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ - -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ - -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ - -e 's|@''GNULIB_LINKAT''@|$(GNULIB_LINKAT)|g' \ - -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ - -e 's|@''GNULIB_PIPE''@|$(GNULIB_PIPE)|g' \ - -e 's|@''GNULIB_PIPE2''@|$(GNULIB_PIPE2)|g' \ - -e 's|@''GNULIB_PREAD''@|$(GNULIB_PREAD)|g' \ - -e 's|@''GNULIB_PWRITE''@|$(GNULIB_PWRITE)|g' \ - -e 's|@''GNULIB_READ''@|$(GNULIB_READ)|g' \ - -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ - -e 's|@''GNULIB_READLINKAT''@|$(GNULIB_READLINKAT)|g' \ - -e 's|@''GNULIB_RMDIR''@|$(GNULIB_RMDIR)|g' \ - -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ - -e 's|@''GNULIB_SYMLINK''@|$(GNULIB_SYMLINK)|g' \ - -e 's|@''GNULIB_SYMLINKAT''@|$(GNULIB_SYMLINKAT)|g' \ - -e 's|@''GNULIB_TTYNAME_R''@|$(GNULIB_TTYNAME_R)|g' \ - -e 's|@''GNULIB_UNISTD_H_GETOPT''@|$(GNULIB_UNISTD_H_GETOPT)|g' \ - -e 's|@''GNULIB_UNISTD_H_NONBLOCKING''@|$(GNULIB_UNISTD_H_NONBLOCKING)|g' \ - -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \ - -e 's|@''GNULIB_UNLINK''@|$(GNULIB_UNLINK)|g' \ - -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \ - -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \ - -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \ + -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ + -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_DUP2''@/$(GNULIB_DUP2)/g' \ + -e 's/@''GNULIB_DUP3''@/$(GNULIB_DUP3)/g' \ + -e 's/@''GNULIB_ENVIRON''@/$(GNULIB_ENVIRON)/g' \ + -e 's/@''GNULIB_EUIDACCESS''@/$(GNULIB_EUIDACCESS)/g' \ + -e 's/@''GNULIB_FACCESSAT''@/$(GNULIB_FACCESSAT)/g' \ + -e 's/@''GNULIB_FCHDIR''@/$(GNULIB_FCHDIR)/g' \ + -e 's/@''GNULIB_FCHOWNAT''@/$(GNULIB_FCHOWNAT)/g' \ + -e 's/@''GNULIB_FSYNC''@/$(GNULIB_FSYNC)/g' \ + -e 's/@''GNULIB_FTRUNCATE''@/$(GNULIB_FTRUNCATE)/g' \ + -e 's/@''GNULIB_GETCWD''@/$(GNULIB_GETCWD)/g' \ + -e 's/@''GNULIB_GETDOMAINNAME''@/$(GNULIB_GETDOMAINNAME)/g' \ + -e 's/@''GNULIB_GETDTABLESIZE''@/$(GNULIB_GETDTABLESIZE)/g' \ + -e 's/@''GNULIB_GETGROUPS''@/$(GNULIB_GETGROUPS)/g' \ + -e 's/@''GNULIB_GETHOSTNAME''@/$(GNULIB_GETHOSTNAME)/g' \ + -e 's/@''GNULIB_GETLOGIN''@/$(GNULIB_GETLOGIN)/g' \ + -e 's/@''GNULIB_GETLOGIN_R''@/$(GNULIB_GETLOGIN_R)/g' \ + -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ + -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ + -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ + -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \ + -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \ + -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \ + -e 's/@''GNULIB_LSEEK''@/$(GNULIB_LSEEK)/g' \ + -e 's/@''GNULIB_PIPE''@/$(GNULIB_PIPE)/g' \ + -e 's/@''GNULIB_PIPE2''@/$(GNULIB_PIPE2)/g' \ + -e 's/@''GNULIB_PREAD''@/$(GNULIB_PREAD)/g' \ + -e 's/@''GNULIB_PWRITE''@/$(GNULIB_PWRITE)/g' \ + -e 's/@''GNULIB_READ''@/$(GNULIB_READ)/g' \ + -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \ + -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \ + -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \ + -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ + -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ + -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ + -e 's/@''GNULIB_UNISTD_H_GETOPT''@/$(GNULIB_UNISTD_H_GETOPT)/g' \ + -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \ + -e 's/@''GNULIB_UNLINKAT''@/$(GNULIB_UNLINKAT)/g' \ + -e 's/@''GNULIB_USLEEP''@/$(GNULIB_USLEEP)/g' \ + -e 's/@''GNULIB_WRITE''@/$(GNULIB_WRITE)/g' \ < $(srcdir)/unistd.in.h | \ sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \ @@ -1837,6 +1977,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ @@ -2022,7 +2163,8 @@ EXTRA_DIST += $(top_srcdir)/build-aux/vc-list-files ## begin gnulib module verify -libgnu_la_SOURCES += verify.h + +EXTRA_DIST += verify.h ## end gnulib module verify @@ -2063,51 +2205,52 @@ BUILT_SOURCES += wchar.h wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ - -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \ - -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \ - -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \ - -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \ - -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \ - -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \ - -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \ - -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \ - -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \ - -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \ - -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \ - -e 's|@''GNULIB_WMEMCHR''@|$(GNULIB_WMEMCHR)|g' \ - -e 's|@''GNULIB_WMEMCMP''@|$(GNULIB_WMEMCMP)|g' \ - -e 's|@''GNULIB_WMEMCPY''@|$(GNULIB_WMEMCPY)|g' \ - -e 's|@''GNULIB_WMEMMOVE''@|$(GNULIB_WMEMMOVE)|g' \ - -e 's|@''GNULIB_WMEMSET''@|$(GNULIB_WMEMSET)|g' \ - -e 's|@''GNULIB_WCSLEN''@|$(GNULIB_WCSLEN)|g' \ - -e 's|@''GNULIB_WCSNLEN''@|$(GNULIB_WCSNLEN)|g' \ - -e 's|@''GNULIB_WCSCPY''@|$(GNULIB_WCSCPY)|g' \ - -e 's|@''GNULIB_WCPCPY''@|$(GNULIB_WCPCPY)|g' \ - -e 's|@''GNULIB_WCSNCPY''@|$(GNULIB_WCSNCPY)|g' \ - -e 's|@''GNULIB_WCPNCPY''@|$(GNULIB_WCPNCPY)|g' \ - -e 's|@''GNULIB_WCSCAT''@|$(GNULIB_WCSCAT)|g' \ - -e 's|@''GNULIB_WCSNCAT''@|$(GNULIB_WCSNCAT)|g' \ - -e 's|@''GNULIB_WCSCMP''@|$(GNULIB_WCSCMP)|g' \ - -e 's|@''GNULIB_WCSNCMP''@|$(GNULIB_WCSNCMP)|g' \ - -e 's|@''GNULIB_WCSCASECMP''@|$(GNULIB_WCSCASECMP)|g' \ - -e 's|@''GNULIB_WCSNCASECMP''@|$(GNULIB_WCSNCASECMP)|g' \ - -e 's|@''GNULIB_WCSCOLL''@|$(GNULIB_WCSCOLL)|g' \ - -e 's|@''GNULIB_WCSXFRM''@|$(GNULIB_WCSXFRM)|g' \ - -e 's|@''GNULIB_WCSDUP''@|$(GNULIB_WCSDUP)|g' \ - -e 's|@''GNULIB_WCSCHR''@|$(GNULIB_WCSCHR)|g' \ - -e 's|@''GNULIB_WCSRCHR''@|$(GNULIB_WCSRCHR)|g' \ - -e 's|@''GNULIB_WCSCSPN''@|$(GNULIB_WCSCSPN)|g' \ - -e 's|@''GNULIB_WCSSPN''@|$(GNULIB_WCSSPN)|g' \ - -e 's|@''GNULIB_WCSPBRK''@|$(GNULIB_WCSPBRK)|g' \ - -e 's|@''GNULIB_WCSSTR''@|$(GNULIB_WCSSTR)|g' \ - -e 's|@''GNULIB_WCSTOK''@|$(GNULIB_WCSTOK)|g' \ - -e 's|@''GNULIB_WCSWIDTH''@|$(GNULIB_WCSWIDTH)|g' \ + -e 's/@''GNULIB_BTOWC''@/$(GNULIB_BTOWC)/g' \ + -e 's/@''GNULIB_WCTOB''@/$(GNULIB_WCTOB)/g' \ + -e 's/@''GNULIB_MBSINIT''@/$(GNULIB_MBSINIT)/g' \ + -e 's/@''GNULIB_MBRTOWC''@/$(GNULIB_MBRTOWC)/g' \ + -e 's/@''GNULIB_MBRLEN''@/$(GNULIB_MBRLEN)/g' \ + -e 's/@''GNULIB_MBSRTOWCS''@/$(GNULIB_MBSRTOWCS)/g' \ + -e 's/@''GNULIB_MBSNRTOWCS''@/$(GNULIB_MBSNRTOWCS)/g' \ + -e 's/@''GNULIB_WCRTOMB''@/$(GNULIB_WCRTOMB)/g' \ + -e 's/@''GNULIB_WCSRTOMBS''@/$(GNULIB_WCSRTOMBS)/g' \ + -e 's/@''GNULIB_WCSNRTOMBS''@/$(GNULIB_WCSNRTOMBS)/g' \ + -e 's/@''GNULIB_WCWIDTH''@/$(GNULIB_WCWIDTH)/g' \ + -e 's/@''GNULIB_WMEMCHR''@/$(GNULIB_WMEMCHR)/g' \ + -e 's/@''GNULIB_WMEMCMP''@/$(GNULIB_WMEMCMP)/g' \ + -e 's/@''GNULIB_WMEMCPY''@/$(GNULIB_WMEMCPY)/g' \ + -e 's/@''GNULIB_WMEMMOVE''@/$(GNULIB_WMEMMOVE)/g' \ + -e 's/@''GNULIB_WMEMSET''@/$(GNULIB_WMEMSET)/g' \ + -e 's/@''GNULIB_WCSLEN''@/$(GNULIB_WCSLEN)/g' \ + -e 's/@''GNULIB_WCSNLEN''@/$(GNULIB_WCSNLEN)/g' \ + -e 's/@''GNULIB_WCSCPY''@/$(GNULIB_WCSCPY)/g' \ + -e 's/@''GNULIB_WCPCPY''@/$(GNULIB_WCPCPY)/g' \ + -e 's/@''GNULIB_WCSNCPY''@/$(GNULIB_WCSNCPY)/g' \ + -e 's/@''GNULIB_WCPNCPY''@/$(GNULIB_WCPNCPY)/g' \ + -e 's/@''GNULIB_WCSCAT''@/$(GNULIB_WCSCAT)/g' \ + -e 's/@''GNULIB_WCSNCAT''@/$(GNULIB_WCSNCAT)/g' \ + -e 's/@''GNULIB_WCSCMP''@/$(GNULIB_WCSCMP)/g' \ + -e 's/@''GNULIB_WCSNCMP''@/$(GNULIB_WCSNCMP)/g' \ + -e 's/@''GNULIB_WCSCASECMP''@/$(GNULIB_WCSCASECMP)/g' \ + -e 's/@''GNULIB_WCSNCASECMP''@/$(GNULIB_WCSNCASECMP)/g' \ + -e 's/@''GNULIB_WCSCOLL''@/$(GNULIB_WCSCOLL)/g' \ + -e 's/@''GNULIB_WCSXFRM''@/$(GNULIB_WCSXFRM)/g' \ + -e 's/@''GNULIB_WCSDUP''@/$(GNULIB_WCSDUP)/g' \ + -e 's/@''GNULIB_WCSCHR''@/$(GNULIB_WCSCHR)/g' \ + -e 's/@''GNULIB_WCSRCHR''@/$(GNULIB_WCSRCHR)/g' \ + -e 's/@''GNULIB_WCSCSPN''@/$(GNULIB_WCSCSPN)/g' \ + -e 's/@''GNULIB_WCSSPN''@/$(GNULIB_WCSSPN)/g' \ + -e 's/@''GNULIB_WCSPBRK''@/$(GNULIB_WCSPBRK)/g' \ + -e 's/@''GNULIB_WCSSTR''@/$(GNULIB_WCSSTR)/g' \ + -e 's/@''GNULIB_WCSTOK''@/$(GNULIB_WCSTOK)/g' \ + -e 's/@''GNULIB_WCSWIDTH''@/$(GNULIB_WCSWIDTH)/g' \ < $(srcdir)/wchar.in.h | \ sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \ -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \ diff --git a/lib/alignof.h b/lib/alignof.h index 5e71f6cbb..4d03e35c9 100644 --- a/lib/alignof.h +++ b/lib/alignof.h @@ -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, diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h index 1fa1f5289..a7871a7a4 100644 --- a/lib/arpa_inet.in.h +++ b/lib/arpa_inet.in.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_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 */ diff --git a/lib/binary-io.h b/lib/binary-io.h new file mode 100644 index 000000000..874fe689e --- /dev/null +++ b/lib/binary-io.h @@ -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 */ diff --git a/lib/errno.in.h b/lib/errno.in.h index 98355be69..1eb77afd6 100644 --- a/lib/errno.in.h +++ b/lib/errno.in.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 */ diff --git a/lib/fclose.c b/lib/fclose.c index 805449a20..a4a519f7c 100644 --- a/lib/fclose.c +++ b/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; + + /* Don't change behavior on memstreams. */ + fd = fileno (fp); + if (fd < 0) + return fclose (fp); - if (fflush (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; } diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h new file mode 100644 index 000000000..77d69a3e5 --- /dev/null +++ b/lib/fcntl.in.h @@ -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 diff --git a/lib/fflush.c b/lib/fflush.c new file mode 100644 index 000000000..f90ba6fa1 --- /dev/null +++ b/lib/fflush.c @@ -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 +} diff --git a/lib/float.in.h b/lib/float.in.h index d252bf074..58a5f736e 100644 --- a/lib/float.in.h +++ b/lib/float.in.h @@ -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 */ diff --git a/lib/fpurge.c b/lib/fpurge.c new file mode 100644 index 000000000..5c53ee763 --- /dev/null +++ b/lib/fpurge.c @@ -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 +} diff --git a/lib/freading.c b/lib/freading.c new file mode 100644 index 000000000..1d13121ce --- /dev/null +++ b/lib/freading.c @@ -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 diff --git a/lib/freading.h b/lib/freading.h new file mode 100644 index 000000000..89bf453c1 --- /dev/null +++ b/lib/freading.h @@ -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 diff --git a/lib/fseek.c b/lib/fseek.c new file mode 100644 index 000000000..74625d0f5 --- /dev/null +++ b/lib/fseek.c @@ -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); +} diff --git a/lib/fseeko.c b/lib/fseeko.c new file mode 100644 index 000000000..e55a42bf2 --- /dev/null +++ b/lib/fseeko.c @@ -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); +} diff --git a/lib/ftell.c b/lib/ftell.c new file mode 100644 index 000000000..5ba3b32df --- /dev/null +++ b/lib/ftell.c @@ -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; + } +} diff --git a/lib/ftello.c b/lib/ftello.c new file mode 100644 index 000000000..2aaa048a4 --- /dev/null +++ b/lib/ftello.c @@ -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); +} diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c index 92b4dd054..cc6f9c062 100644 --- a/lib/gai_strerror.c +++ b/lib/gai_strerror.c @@ -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 */ diff --git a/lib/getsockopt.c b/lib/getsockopt.c index 7c83f01aa..8433ab921 100644 --- a/lib/getsockopt.c +++ b/lib/getsockopt.c @@ -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); diff --git a/lib/iconv.in.h b/lib/iconv.in.h index 6cb698e92..66fc8ef5d 100644 --- a/lib/iconv.in.h +++ b/lib/iconv.in.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_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 */ diff --git a/lib/locale.in.h b/lib/locale.in.h index 02db8dadb..da722ab9c 100644 --- a/lib/locale.in.h +++ b/lib/locale.in.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 */ diff --git a/lib/lseek.c b/lib/lseek.c new file mode 100644 index 000000000..32e8bd17c --- /dev/null +++ b/lib/lseek.c @@ -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); +} diff --git a/lib/math.in.h b/lib/math.in.h index 7ff01026b..e926a1851 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -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 */ diff --git a/lib/netdb.in.h b/lib/netdb.in.h index 5b64e486b..3077b9fbd 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.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 */ diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h index 11c587a47..97df933be 100644 --- a/lib/netinet_in.in.h +++ b/lib/netinet_in.in.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 */ diff --git a/lib/open.c b/lib/open.c new file mode 100644 index 000000000..480017750 --- /dev/null +++ b/lib/open.c @@ -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; +} diff --git a/lib/pipe2.c b/lib/pipe2.c new file mode 100644 index 000000000..e1884fadd --- /dev/null +++ b/lib/pipe2.c @@ -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; + } +} diff --git a/lib/sockets.c b/lib/sockets.c index 25ab97f3d..432f3b584 100644 --- a/lib/sockets.c +++ b/lib/sockets.c @@ -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; diff --git a/lib/stat-time.h b/lib/stat-time.h index 47a288a7e..2d0191096 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -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; diff --git a/lib/stddef.in.h b/lib/stddef.in.h index 70f5a8678..1668addbe 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -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 */ diff --git a/lib/stdint.in.h b/lib/stdint.in.h index b60e9cc0b..547f6840a 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -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 */ diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h new file mode 100644 index 000000000..03f1cf019 --- /dev/null +++ b/lib/stdio-impl.h @@ -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 diff --git a/lib/stdio.in.h b/lib/stdio.in.h index b4469a9b8..53d2a6cdf 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -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 diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 9651e94cd..bced0037f 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -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 diff --git a/lib/string.in.h b/lib/string.in.h index 9eb0d5c30..3a613fca0 100644 --- a/lib/string.in.h +++ b/lib/string.in.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_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 */ diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h index 2526ea68e..e518dfcc4 100644 --- a/lib/sys_file.in.h +++ b/lib/sys_file.in.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 */ diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h index c13f33663..d04357c0a 100644 --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.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 diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index cc5ab1b37..a669edd97 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -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 diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h index 1dbc0f210..7d829416d 100644 --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -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 */ diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h index 28aea2838..b0f762de5 100644 --- a/lib/sys_uio.in.h +++ b/lib/sys_uio.in.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 */ diff --git a/lib/time.in.h b/lib/time.in.h index afccc78c0..a38fd13e9 100644 --- a/lib/time.in.h +++ b/lib/time.in.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@ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 1bbab0fe1..2101bced5 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.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 */ diff --git a/lib/verify.h b/lib/verify.h index 9fa5111b6..330ff3bd4 100644 --- a/lib/verify.h +++ b/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 ';'. */ + 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 { ... }. */ -# if HAVE__STATIC_ASSERT -# define verify(R) _Static_assert (R, "verify (" #R ")") -# elif HAVE_STATIC_ASSERT -# define verify(R) static_assert (R, "verify (" #R ")") +# ifdef _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY _Static_assert # else -# define verify(R) \ - extern int (* _GL_GENSYM (verify_function) (void)) [verify_true (R)] +# 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 ';'. */ + +# define verify(R) _GL_VERIFY (R, "verify (" #R ")") + +/* @assert.h omit end@ */ + #endif diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 3cc0fc4b3..7514958fe 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -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 diff --git a/libguile/Makefile.am b/libguile/Makefile.am index 880028f38..9cc14344f 100644 --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -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 diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4 index d21b162fc..6dc0fdb58 100644 --- a/m4/arpa_inet_h.m4 +++ b/m4/arpa_inet_h.m4 @@ -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. diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4 index dcc6039ed..ba7a38bb9 100644 --- a/m4/canonicalize.m4 +++ b/m4/canonicalize.m4 @@ -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() diff --git a/m4/ceil.m4 b/m4/ceil.m4 index 21d04b468..157407745 100644 --- a/m4/ceil.m4 +++ b/m4/ceil.m4 @@ -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]) diff --git a/m4/duplocale.m4 b/m4/duplocale.m4 index 4393d82df..cfb7f4b53 100644 --- a/m4/duplocale.m4 +++ b/m4/duplocale.m4 @@ -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. diff --git a/m4/fclose.m4 b/m4/fclose.m4 index 278859c6c..349b5f14c 100644 --- a/m4/fclose.m4 +++ b/m4/fclose.m4 @@ -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], diff --git a/m4/fcntl-o.m4 b/m4/fcntl-o.m4 new file mode 100644 index 000000000..88db07ec7 --- /dev/null +++ b/m4/fcntl-o.m4 @@ -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.]) +]) diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 new file mode 100644 index 000000000..c466da4df --- /dev/null +++ b/m4/fcntl_h.m4 @@ -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]) +]) diff --git a/m4/fflush.m4 b/m4/fflush.m4 new file mode 100644 index 000000000..a91ee0bea --- /dev/null +++ b/m4/fflush.m4 @@ -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]) + : +]) diff --git a/m4/flock.m4 b/m4/flock.m4 index 7d8c7030d..c1b64c807 100644 --- a/m4/flock.m4 +++ b/m4/flock.m4 @@ -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 ]) diff --git a/m4/floor.m4 b/m4/floor.m4 index 568310785..62d19fed7 100644 --- a/m4/floor.m4 +++ b/m4/floor.m4 @@ -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]) diff --git a/m4/fpurge.m4 b/m4/fpurge.m4 new file mode 100644 index 000000000..234f563f8 --- /dev/null +++ b/m4/fpurge.m4 @@ -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 +]) diff --git a/m4/freading.m4 b/m4/freading.m4 new file mode 100644 index 000000000..59d502efd --- /dev/null +++ b/m4/freading.m4 @@ -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]) +]) diff --git a/m4/frexp.m4 b/m4/frexp.m4 index 2e0fb3b47..0021ed2b9 100644 --- a/m4/frexp.m4 +++ b/m4/frexp.m4 @@ -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 ]) diff --git a/m4/fseek.m4 b/m4/fseek.m4 new file mode 100644 index 000000000..135a22bdc --- /dev/null +++ b/m4/fseek.m4 @@ -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 +]) diff --git a/m4/fseeko.m4 b/m4/fseeko.m4 new file mode 100644 index 000000000..391948d4e --- /dev/null +++ b/m4/fseeko.m4 @@ -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])]) +]) diff --git a/m4/ftell.m4 b/m4/ftell.m4 new file mode 100644 index 000000000..c529c5030 --- /dev/null +++ b/m4/ftell.m4 @@ -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 +]) diff --git a/m4/ftello.m4 b/m4/ftello.m4 new file mode 100644 index 000000000..10cf4291b --- /dev/null +++ b/m4/ftello.m4 @@ -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 +]) diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4 index e57623694..20a622611 100644 --- a/m4/getaddrinfo.m4 +++ b/m4/getaddrinfo.m4 @@ -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. */ diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index 70f8b9ae5..64dfef04b 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -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]) diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index c4d7a20ea..843efe051 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -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]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 257258734..79f61fb3d 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -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 diff --git a/m4/iconv_open-utf.m4 b/m4/iconv_open-utf.m4 new file mode 100644 index 000000000..dd035301a --- /dev/null +++ b/m4/iconv_open-utf.m4 @@ -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 +]) diff --git a/m4/iconv_open.m4 b/m4/iconv_open.m4 index b062e73b2..accdecc22 100644 --- a/m4/iconv_open.m4 +++ b/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 ]) diff --git a/m4/inet_ntop.m4 b/m4/inet_ntop.m4 index 57580b8a4..45be497be 100644 --- a/m4/inet_ntop.m4 +++ b/m4/inet_ntop.m4 @@ -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 +]) + +# Prerequisites of lib/inet_ntop.c. +AC_DEFUN([gl_PREREQ_INET_NTOP], [ AC_REQUIRE([gl_SOCKET_FAMILIES]) - AC_REQUIRE([AC_C_RESTRICT]) ]) diff --git a/m4/inet_pton.m4 b/m4/inet_pton.m4 index 9a7ad3b38..9fc64df4e 100644 --- a/m4/inet_pton.m4 +++ b/m4/inet_pton.m4 @@ -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 +]) + +# Prerequisites of lib/inet_pton.c. +AC_DEFUN([gl_PREREQ_INET_PTON], [ AC_REQUIRE([gl_SOCKET_FAMILIES]) - AC_REQUIRE([AC_C_RESTRICT]) ]) diff --git a/m4/isinf.m4 b/m4/isinf.m4 index ab3cf9e6f..f6056e610 100644 --- a/m4/isinf.m4 +++ b/m4/isinf.m4 @@ -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]) diff --git a/m4/isnan.m4 b/m4/isnan.m4 index dc3e290cd..a99cbb3b9 100644 --- a/m4/isnan.m4 +++ b/m4/isnan.m4 @@ -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]) diff --git a/m4/isnand.m4 b/m4/isnand.m4 index fb2c0f9be..2b18b0ac6 100644 --- a/m4/isnand.m4 +++ b/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 ]) diff --git a/m4/isnanf.m4 b/m4/isnanf.m4 index 92024bb10..66ed954be 100644 --- a/m4/isnanf.m4 +++ b/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 ]) diff --git a/m4/isnanl.m4 b/m4/isnanl.m4 index 5d7375992..c79308b03 100644 --- a/m4/isnanl.m4 +++ b/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 ]) diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 index 4d0f89426..e77a3032e 100644 --- a/m4/locale_h.m4 +++ b/m4/locale_h.m4 @@ -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. diff --git a/m4/lseek.m4 b/m4/lseek.m4 new file mode 100644 index 000000000..b45488445 --- /dev/null +++ b/m4/lseek.m4 @@ -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 +]) diff --git a/m4/lstat.m4 b/m4/lstat.m4 index b9b22a6b2..72c76c6cf 100644 --- a/m4/lstat.m4 +++ b/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 ]) diff --git a/m4/malloc.m4 b/m4/malloc.m4 index 809444450..87018ec87 100644 --- a/m4/malloc.m4 +++ b/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 -]) diff --git a/m4/memchr.m4 b/m4/memchr.m4 index a544e2b4e..f6dc3e712 100644 --- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -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. diff --git a/m4/mode_t.m4 b/m4/mode_t.m4 new file mode 100644 index 000000000..f9cf70472 --- /dev/null +++ b/m4/mode_t.m4 @@ -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.]) +]) diff --git a/m4/netdb_h.m4 b/m4/netdb_h.m4 index 9a01cd6a7..a54d6701b 100644 --- a/m4/netdb_h.m4 +++ b/m4/netdb_h.m4 @@ -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]) ]) diff --git a/m4/nocrash.m4 b/m4/nocrash.m4 new file mode 100644 index 000000000..0cc0d53eb --- /dev/null +++ b/m4/nocrash.m4 @@ -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 +]]) diff --git a/m4/open.m4 b/m4/open.m4 new file mode 100644 index 000000000..690cc648d --- /dev/null +++ b/m4/open.m4 @@ -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]) + : +]) diff --git a/m4/pipe2.m4 b/m4/pipe2.m4 new file mode 100644 index 000000000..10f1e1489 --- /dev/null +++ b/m4/pipe2.m4 @@ -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 +]) diff --git a/m4/putenv.m4 b/m4/putenv.m4 index de3900bf2..1497b4a79 100644 --- a/m4/putenv.m4 +++ b/m4/putenv.m4 @@ -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 ]) diff --git a/m4/read.m4 b/m4/read.m4 index 032761f1b..310e5ebcf 100644 --- a/m4/read.m4 +++ b/m4/read.m4 @@ -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 ]) ]) diff --git a/m4/readlink.m4 b/m4/readlink.m4 index a502ca560..91d7df3c9 100644 --- a/m4/readlink.m4 +++ b/m4/readlink.m4 @@ -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]) diff --git a/m4/safe-read.m4 b/m4/safe-read.m4 index ea8eedbfc..791624205 100644 --- a/m4/safe-read.m4 +++ b/m4/safe-read.m4 @@ -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], [ diff --git a/m4/safe-write.m4 b/m4/safe-write.m4 index 7f6b9f81a..6631ab658 100644 --- a/m4/safe-write.m4 +++ b/m4/safe-write.m4 @@ -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], [ diff --git a/m4/stat.m4 b/m4/stat.m4 index 27f82d5a9..c63f59fd5 100644 --- a/m4/stat.m4 +++ b/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]) + : ]) diff --git a/m4/stdint.m4 b/m4/stdint.m4 index dff37fe1b..c75e95722 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -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 diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 8b013c2f3..a8326f3c3 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -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 diff --git a/m4/strftime.m4 b/m4/strftime.m4 index d9de341bf..dd30ccfc0 100644 --- a/m4/strftime.m4 +++ b/m4/strftime.m4 @@ -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]) diff --git a/m4/time_r.m4 b/m4/time_r.m4 index 9bb28005f..d646edc2d 100644 --- a/m4/time_r.m4 +++ b/m4/time_r.m4 @@ -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. diff --git a/m4/trunc.m4 b/m4/trunc.m4 index e1069115c..953f5b131 100644 --- a/m4/trunc.m4 +++ b/m4/trunc.m4 @@ -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]) diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index eeb3360b0..fb6fe0772 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -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]) diff --git a/m4/warnings.m4 b/m4/warnings.m4 index a8f346632..b2d1a29e2 100644 --- a/m4/warnings.m4 +++ b/m4/warnings.m4 @@ -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"])]) diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index 6255ff352..977491fe8 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -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. diff --git a/m4/write.m4 b/m4/write.m4 index 63ab5e4c0..c39d3d07a 100644 --- a/m4/write.m4 +++ b/m4/write.m4 @@ -1,4 +1,4 @@ -# write.m4 serial 2 +# write.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, @@ -22,7 +22,4 @@ AC_DEFUN([gl_FUNC_WRITE], REPLACE_WRITE=1 fi ]) - if test $REPLACE_WRITE = 1; then - AC_LIBOBJ([write]) - fi ]) @@ -33,7 +33,6 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)' GIT = git VC = $(GIT) -VC-tag = git tag -s -m '$(VERSION)' 'v$(VERSION)' -u '$(gpg_key_ID)' VC_LIST = $(build_aux)/vc-list-files -C $(srcdir) @@ -496,6 +495,16 @@ sc_prohibit_hash_without_use: re='$(_hash_fn)|$(_hash_struct)'\ $(_sc_header_without_use) +sc_prohibit_cloexec_without_use: + @h='"cloexec.h"' re='\<(set_cloexec_flag|dup_cloexec) *\(' \ + $(_sc_header_without_use) + +sc_prohibit_posixver_without_use: + @h='"posixver.h"' re='\<posix2_version *\(' $(_sc_header_without_use) + +sc_prohibit_same_without_use: + @h='"same.h"' re='\<same_name *\(' $(_sc_header_without_use) + sc_prohibit_hash_pjw_without_use: @h='"hash-pjw.h"' \ re='\<hash_pjw *\(' \ @@ -569,6 +578,16 @@ sc_prohibit_signal_without_use: re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>' \ $(_sc_header_without_use) +# Don't include stdio--.h unless you use one of its functions. +sc_prohibit_stdio--_without_use: + @h='"stdio--.h"' re='\<((f(re)?|p)open|tmpfile) *\(' \ + $(_sc_header_without_use) + +# Don't include stdio-safer.h unless you use one of its functions. +sc_prohibit_stdio-safer_without_use: + @h='"stdio-safer.h"' re='\<((f(re)?|p)open|tmpfile)_safer *\(' \ + $(_sc_header_without_use) + # Prohibit the inclusion of strings.h without a sensible use. # Using the likes of bcmp, bcopy, bzero, index or rindex is not sensible. sc_prohibit_strings_without_use: @@ -596,6 +615,10 @@ sc_prohibit_stddef_without_use: re='\<($(_stddef_syms_re)) *\(' \ $(_sc_header_without_use) +# Don't include xfreopen.h unless you use one of its functions. +sc_prohibit_xfreopen_without_use: + @h='"xfreopen.h"' re='\<xfreopen *\(' $(_sc_header_without_use) + sc_obsolete_symbols: @prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \ halt='do not use HAVE''_FCNTL_H or O'_NDELAY \ @@ -647,12 +670,6 @@ sc_require_test_exit_idiom: exit 1; } || :; \ fi -sc_the_the: - @prohibit='\<the ''the\>' \ - ignore_case=1 \ - halt='found use of "the ''the";' \ - $(_sc_search_regexp) - sc_trailing_blank: @prohibit='[ ]$$' \ halt='found trailing blank(s)' \ @@ -667,11 +684,16 @@ sc_two_space_separator_in_usage: halt='help2man requires at least two spaces between an option and its description'\ $(_sc_search_regexp) +# A regexp matching function names like "error" that may be used +# to emit translatable messages. +_gl_translatable_diag_func_re ?= error + # Look for diagnostics that aren't marked for translation. # This won't find any for which error's format string is on a separate line. sc_unmarked_diagnostics: @grep -nE \ - '\<error *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \ + '\<$(_gl_translatable_diag_func_re) *\([^"]*"[^"]*[a-z]{3}' \ + $$($(VC_LIST_EXCEPT)) \ | grep -Ev '(_|ngettext ?)\(' && \ { echo '$(ME): found unmarked diagnostic(s)' 1>&2; \ exit 1; } || : @@ -841,16 +863,21 @@ sc_prohibit_S_IS_definition: halt='do not define S_IS* macros; include <sys/stat.h>' \ $(_sc_search_regexp) -prohibit_doubled_word_RE_ ?= \ - /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims -prohibit_doubled_word_ = \ - -e 'while ($(prohibit_doubled_word_RE_))' \ +# Perl block to convert a match to FILE_NAME:LINENO:TEST, +# that is shared by two definitions below. +perl_filename_lineno_text_ = \ -e ' {' \ -e ' $$n = ($$` =~ tr/\n/\n/ + 1);' \ -e ' ($$v = $$&) =~ s/\n/\\n/g;' \ -e ' print "$$ARGV:$$n:$$v\n";' \ -e ' }' +prohibit_doubled_word_RE_ ?= \ + /\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims +prohibit_doubled_word_ = \ + -e 'while ($(prohibit_doubled_word_RE_))' \ + $(perl_filename_lineno_text_) + # Define this to a regular expression that matches # any filename:dd:match lines you want to ignore. # The default is to ignore no matches. @@ -861,10 +888,24 @@ sc_prohibit_doubled_word: | grep -vE '$(ignore_doubled_word_match_RE_)' \ | grep . && { echo '$(ME): doubled words' 1>&2; exit 1; } || : -sc_prohibit_can_not: - @prohibit='\<can[ ]not\>' \ - halt='use "cannot", not "can'' not"' \ - $(_sc_search_regexp) +# A regular expression matching undesirable combinations of words like +# "can not"; this matches them even when the two words appear on different +# lines, but not when there is an intervening delimiter like "#" or "*". +prohibit_undesirable_word_seq_RE_ ?= \ + /\bcan\s+not\b/gims +prohibit_undesirable_word_seq_ = \ + -e 'while ($(prohibit_undesirable_word_seq_RE_))' \ + $(perl_filename_lineno_text_) +# Define this to a regular expression that matches +# any filename:dd:match lines you want to ignore. +# The default is to ignore no matches. +ignore_undesirable_word_sequence_RE_ ?= ^$$ + +sc_prohibit_undesirable_word_seq: + @perl -n -0777 $(prohibit_undesirable_word_seq_) \ + $$($(VC_LIST_EXCEPT)) \ + | grep -vE '$(ignore_undesirable_word_sequence_RE_)' | grep . \ + && { echo '$(ME): undesirable word sequence' >&2; exit 1; } || : _ptm1 = use "test C1 && test C2", not "test C1 -''a C2" _ptm2 = use "test C1 || test C2", not "test C1 -''o C2" @@ -988,12 +1029,13 @@ apply the above patch\n' # Verify that all source files using _() are listed in po/POTFILES.in. po_file ?= $(srcdir)/po/POTFILES.in +generated_files ?= $(srcdir)/lib/*.[ch] sc_po_check: @if test -f $(po_file); then \ grep -E -v '^(#|$$)' $(po_file) \ | grep -v '^src/false\.c$$' | sort > $@-1; \ files=; \ - for file in $$($(VC_LIST_EXCEPT)) $(srcdir)/lib/*.[ch]; do \ + for file in $$($(VC_LIST_EXCEPT)) $(generated_files); do \ test -r $$file || continue; \ case $$file in \ *.m4|*.mk) continue ;; \ @@ -1124,11 +1166,20 @@ gpg_key_ID ?= \ | sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig) translation_project_ ?= coordinator@translationproject.org -announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT) -announcement_mail_headers_ ?= \ -To: info-gnu@gnu.org \ -Cc: $(announcement_Cc_) \ -Mail-Followup-To: $(PACKAGE_BUGREPORT) + +# Make info-gnu the default only for a stable release. +ifeq ($(RELEASE_TYPE),stable) + announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT) + announcement_mail_headers_ ?= \ + To: info-gnu@gnu.org \ + Cc: $(announcement_Cc_) \ + Mail-Followup-To: $(PACKAGE_BUGREPORT) +else + announcement_Cc_ ?= $(translation_project_) + announcement_mail_headers_ ?= \ + To: $(PACKAGE_BUGREPORT) \ + Cc: $(announcement_Cc_) +endif announcement: NEWS ChangeLog $(rel-files) @$(build_aux)/announce-gen \ @@ -1229,7 +1280,7 @@ gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?] release-prep: case $$RELEASE_TYPE in alpha|beta|stable) ;; \ *) echo "invalid RELEASE_TYPE: $$RELEASE_TYPE" 1>&2; exit 1;; esac - $(MAKE) -s announcement > ~/announce-$(my_distdir) + $(MAKE) --no-print-directory -s announcement > ~/announce-$(my_distdir) if test -d $(release_archive_dir); then \ ln $(rel-files) $(release_archive_dir); \ chmod a-w $(rel-files); \ @@ -1316,3 +1367,101 @@ update-copyright: grep -l -w Copyright \ $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \ | $(update-copyright-env) xargs $(build_aux)/$@ + +# This tight_scope test is skipped with a warning if $(_gl_TS_headers) is not +# overridden and $(_gl_TS_dir)/Makefile.am does not mention noinst_HEADERS. + +# NOTE: to override any _gl_TS_* default value, you must +# define the variable(s) using "export" in cfg.mk. +_gl_TS_dir ?= src + +ALL_RECURSIVE_TARGETS += sc_tight_scope +sc_tight_scope: tight-scope.mk + @if ! grep '^ *export _gl_TS_headers *=' $(srcdir)/cfg.mk \ + > /dev/null \ + && ! grep -w noinst_HEADERS $(srcdir)/$(_gl_TS_dir)/Makefile.am \ + > /dev/null 2>&1; then \ + echo '$(ME): skipping $@'; \ + else \ + $(MAKE) -s -C $(_gl_TS_dir) \ + -f Makefile \ + -f $(abs_top_srcdir)/cfg.mk \ + -f $(abs_top_builddir)/$< \ + _gl_tight_scope \ + || fail=1; \ + fi + @rm -f $< + +tight-scope.mk: $(ME) + @rm -f $@ $@-t + @perl -ne '/^# TS-start/.../^# TS-end/ and print' $(ME) > $@-t + @chmod a=r $@-t && mv $@-t $@ + +ifeq (a,b) +# TS-start + +# Most functions should have static scope. +# Any that don't must be marked with `extern', but `main' +# and `usage' are exceptions: they're always extern, but +# do not need to be marked. Symbols matching `__.*' are +# reserved by the compiler, so are automatically excluded below. +_gl_TS_unmarked_extern_functions ?= main usage +_gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\S+) +\(/ + +# If your project uses a macro like "XTERN", then put +# the following in cfg.mk to override this default: +# export _gl_TS_extern = extern|XTERN +_gl_TS_extern ?= extern + +# The second nm|grep checks for file-scope variables with `extern' scope. +# Without gnulib's progname module, you might put program_name here. +# Symbols matching `__.*' are reserved by the compiler, +# so are automatically excluded below. +_gl_TS_unmarked_extern_vars ?= + +# NOTE: the _match variables are perl expressions -- not mere regular +# expressions -- so that you can extend them to match other patterns +# and easily extract matched variable names. +# For example, if your project declares some global variables via +# a macro like this: GLOBAL(type, var_name, initializer), then you +# can override this definition to automatically extract those names: +# export _gl_TS_var_match = \ +# /^(?:$(_gl_TS_extern)) .*?\**(\w+)(\[.*?\])?;/ || /\bGLOBAL\(.*?,\s*(.*?),/ +_gl_TS_var_match ?= /^(?:$(_gl_TS_extern)) .*?(\w+)(\[.*?\])?;/ + +# The names of object files in (or relative to) $(_gl_TS_dir). +_gl_TS_obj_files ?= *.$(OBJEXT) + +# Files in which to search for the one-line style extern declarations. +# $(_gl_TS_dir)-relative. +_gl_TS_headers ?= $(noinst_HEADERS) + +.PHONY: _gl_tight_scope +_gl_tight_scope: $(bin_PROGRAMS) + t=exceptions-$$$$; \ + trap 's=$$?; rm -f $$t; exit $$s' 0; \ + for sig in 1 2 3 13 15; do \ + eval "trap 'v=`expr $$sig + 128`; (exit $$v); exit $$v' $$sig"; \ + done; \ + src=`for f in $(SOURCES); do \ + test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \ + hdr=`for f in $(_gl_TS_headers); do \ + test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \ + ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_functions); \ + grep -h -A1 '^extern .*[^;]$$' $$src \ + | grep -vE '^(extern |--)' | sed 's/ .*//'; \ + perl -lne \ + '$(_gl_TS_function_match) and print "^$$1\$$"' $$hdr; \ + ) | sort -u > $$t; \ + nm -e $(_gl_TS_obj_files) | sed -n 's/.* T //p'|grep -Ev -f $$t \ + && { echo the above functions should have static scope >&2; \ + exit 1; } || : ; \ + ( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_vars); \ + perl -lne '$(_gl_TS_var_match) and print "^$$1\$$"' $$hdr *.h \ + ) | sort -u > $$t; \ + nm -e $(_gl_TS_obj_files) | sed -n 's/.* [BCDGRS] //p' \ + | sort -u | grep -Ev -f $$t \ + && { echo the above variables should have static scope >&2; \ + exit 1; } || : +# TS-end +endif |