Update Gnulib to v0.0-6703-g4e0358a.
authorLudovic Courtès <ludo@gnu.org>
Wed, 14 Dec 2011 22:02:29 +0000 (23:02 +0100)
committerLudovic Courtès <ludo@gnu.org>
Wed, 14 Dec 2011 22:46:22 +0000 (23:46 +0100)
30 files changed:
.gitignore
GNUmakefile
build-aux/announce-gen
build-aux/git-version-gen
build-aux/gitlog-to-changelog
lib/Makefile.am
lib/alignof.h
lib/c-ctype.h
lib/c-strcase.h
lib/dirname.h
lib/errno.in.h
lib/isnan.c
lib/math.in.h
lib/putenv.c
lib/sockets.h
lib/stdalign.in.h [new file with mode: 0644]
lib/stdint.in.h
lib/stdlib.in.h
lib/sys_socket.in.h
lib/unistd.in.h
lib/w32sock.h
m4/gnulib-common.m4
m4/gnulib-comp.m4
m4/math_h.m4
m4/mathfunc.m4
m4/stdalign.m4 [new file with mode: 0644]
m4/stdint.m4
m4/stdlib_h.m4
m4/unistd_h.m4
maint.mk

index df62247..0e44257 100644 (file)
@@ -144,3 +144,4 @@ INSTALL
 /test-suite/standalone/test-pthread-create-secondary
 /lib/fcntl.h
 /lib/sys/uio.h
+/lib/stdalign.h
index 6e00ec8..86bc60f 100644 (file)
@@ -45,12 +45,13 @@ include Makefile
 
 # Some projects override e.g., _autoreconf here.
 -include $(srcdir)/cfg.mk
-include $(srcdir)/maint.mk
 
 # Allow cfg.mk to override these.
 _build-aux ?= build-aux
 _autoreconf ?= autoreconf -v
 
+include $(srcdir)/maint.mk
+
 # Ensure that $(VERSION) is up to date for dist-related targets, but not
 # for others: rerunning autoreconf and recompiling everything isn't cheap.
 _have-git-version-gen := \
@@ -100,6 +101,11 @@ srcdir = .
 
 # The package can override .DEFAULT_GOAL to run actions like autoreconf.
 -include ./cfg.mk
+
+# Allow cfg.mk to override these.
+_build-aux ?= build-aux
+_autoreconf ?= autoreconf -v
+
 include ./maint.mk
 
 ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
index 0eb6b5b..3866381 100755 (executable)
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
     if 0;
 # Generate a release announcement message.
 
-my $VERSION = '2011-05-17 20:25'; # UTC
+my $VERSION = '2011-11-09 21:30'; # 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
@@ -453,28 +453,50 @@ FIXME: put comments here
 
 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);
-  my @sig_files = map { "$_.sig" } @tarballs;
-  print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
-                   @sig_files);
+  if (@url_dir_list == 1 && @tarballs == 1)
+    {
+      # When there's only one tarball and one URL, use a more concise form.
+      my $m = "$url_dir_list[0]/$tarballs[0]";
+      print "Here are the compressed sources and a GPG detached signature[*]:\n"
+        . "  $m\n"
+        . "  $m.sig\n\n";
+    }
+  else
+    {
+      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);
+      my @sig_files = map { "$_.sig" } @tarballs;
+      print_locations ("GPG detached signatures[*]", @url_dir_list, %size,
+                       @sig_files);
+    }
+
   if ($url_dir_list[0] =~ "gnu\.org")
     {
-      print "To reduce load on the main server, use a mirror listed at:\n";
-      print "  http://www.gnu.org/order/ftp.html\n\n";
+      print "Use a mirror for higher download bandwidth:\n";
+      if (@tarballs == 1 && $url_dir_list[0] =~ m!http://ftp\.gnu\.org/gnu/!)
+        {
+          (my $m = "$url_dir_list[0]/$tarballs[0]")
+            =~ s!http://ftp\.gnu\.org/gnu/!http://ftpmirror\.gnu\.org/!;
+          print "  $m\n"
+              . "  $m.sig\n\n";
+
+        }
+      else
+        {
+          print "  http://www.gnu.org/order/ftp.html\n\n";
+        }
     }
 
   $print_checksums_p
     and print_checksums (@sizable);
 
   print <<EOF;
-[*] You can use either of the above signature files to verify that
-the corresponding file (without the .sig suffix) is intact.  First,
-be sure to download both the .sig file and the corresponding tarball.
-Then, run a command like this:
+[*] Use a .sig file to verify that the corresponding file (without the
+.sig suffix) is intact.  First, be sure to download both the .sig file
+and the corresponding tarball.  Then, run a command like this:
 
   gpg --verify $tarballs[0].sig
 
index 168d81a..c7a58af 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2011-08-11.12; # UTC
+scriptversion=2011-11-13.13; # UTC
 
 # Copyright (C) 2007-2011 Free Software Foundation, Inc.
 #
@@ -69,15 +69,59 @@ scriptversion=2011-08-11.12; # UTC
 # dist-hook:
 #      echo $(VERSION) > $(distdir)/.tarball-version
 
-case $# in
-    1|2) ;;
-    *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version" \
-         '[TAG-NORMALIZATION-SED-SCRIPT]'
-       exit 1;;
-esac
 
-tarball_version_file=$1
-tag_sed_script="${2:-s/x/x/}"
+me=$0
+
+version="git-version-gen $scriptversion
+
+Copyright 2011 Free Software Foundation, Inc.
+There is NO warranty.  You may redistribute this software
+under the terms of the GNU General Public License.
+For more information about these matters, see the files named COPYING."
+
+usage="\
+Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
+Print a version string.
+
+Options:
+
+   --prefix           prefix of git tags (default 'v')
+
+   --help             display this help and exit
+   --version          output version information and exit
+
+Running without arguments will suffice in most cases."
+
+while test $# -gt 0; do
+  case $1 in
+    --help) echo "$usage"; exit 0;;
+    --version) echo "$version"; exit 0;;
+    --prefix) shift; prefix="$1";;
+    -*)
+      echo "$0: Unknown option \`$1'." >&2
+      echo "$0: Try \`--help' for more information." >&2
+      exit 1;;
+    *)
+      if test -z "$tarball_version_file"; then
+        tarball_version_file="$1"
+      elif test -z "$tag_sed_script"; then
+        tag_sed_script="$1"
+      else
+        echo "$0: extra non-option argument \`$1'." >&2
+        exit 1
+      fi;;
+  esac
+  shift
+done
+
+if test -z "$tarball_version_file"; then
+    echo "$usage"
+    exit 1
+fi
+
+tag_sed_script="${tag_sed_script:-s/x/x/}"
+prefix="${prefix:-v}"
+
 nl='
 '
 
@@ -106,11 +150,11 @@ then
 # directory, and "git describe" output looks sensible, use that to
 # derive a version string.
 elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
-    && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
+    && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
           || git describe --abbrev=4 HEAD 2>/dev/null` \
     && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
     && case $v in
-         v[0-9]*) ;;
+         $prefix[0-9]*) ;;
          *) (exit 1) ;;
        esac
 then
@@ -143,7 +187,7 @@ else
     v=UNKNOWN
 fi
 
-v=`echo "$v" |sed 's/^v//'`
+v=`echo "$v" |sed "s/^$prefix//"`
 
 # Test whether to append the "-dirty" suffix only if the version
 # string we're using came from git.  I.e., skip the test if it's "UNKNOWN"
index 4559704..40a8035 100755 (executable)
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
     if 0;
 # Convert git log output to ChangeLog format.
 
-my $VERSION = '2009-10-30 13:46'; # UTC
+my $VERSION = '2011-11-02 07:53'; # 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
@@ -60,6 +60,10 @@ $ME, they may be preceded by '--'.
 
 OPTIONS:
 
+   --amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that
+                  makes a change to SHA1's commit log text or metadata.
+   --append-dot append a dot to the first line of each commit message if
+                  there is no other punctuation or blank at the end.
    --since=DATE convert only the logs since DATE;
                   the default is to convert all log entries.
    --format=FMT set format string for commit subject and body;
@@ -74,6 +78,23 @@ EXAMPLE:
   $ME --since=2008-01-01 > ChangeLog
   $ME -- -n 5 foo > last-5-commits-to-branch-foo
 
+In a FILE specified via --amend, comment lines (starting with "#") are ignored.
+FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on
+a line) referring to a commit in the current project, and CODE refers to one
+or more consecutive lines of Perl code.  Pairs must be separated by one or
+more blank line.
+
+Here is sample input for use with --amend=FILE, from coreutils:
+
+3a169f4c5d9159283548178668d2fae6fced3030
+# fix typo in title:
+s/all tile types/all file types/
+
+1379ed974f1fa39b12e2ffab18b3f7a607082202
+# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself.
+# Change the author to be Paul.  Note the escaped "@":
+s,Jim .*>,Paul Eggert <eggert\@cs.ucla.edu>,
+
 EOF
     }
   exit $exit_code;
@@ -99,24 +120,87 @@ sub quoted_cmd(@)
   return join (' ', map {shell_quote $_} @_);
 }
 
+# Parse file F.
+# Comment lines (starting with "#") are ignored.
+# F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1
+# (alone on a line) referring to a commit in the current project, and
+# CODE refers to one or more consecutive lines of Perl code.
+# Pairs must be separated by one or more blank line.
+sub parse_amend_file($)
 {
-  my $since_date = '1970-01-01 UTC';
+  my ($f) = @_;
+
+  open F, '<', $f
+    or die "$ME: $f: failed to open for reading: $!\n";
+
+  my $fail;
+  my $h = {};
+  my $in_code = 0;
+  my $sha;
+  while (defined (my $line = <F>))
+    {
+      $line =~ /^\#/
+        and next;
+      chomp $line;
+      $line eq ''
+        and $in_code = 0, next;
+
+      if (!$in_code)
+        {
+          $line =~ /^([0-9a-fA-F]{40})$/
+            or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"),
+              $fail = 1, next;
+          $sha = lc $1;
+          $in_code = 1;
+          exists $h->{$sha}
+            and (warn "$ME: $f:$.: duplicate SHA1\n"),
+              $fail = 1, next;
+        }
+      else
+        {
+          $h->{$sha} ||= '';
+          $h->{$sha} .= "$line\n";
+        }
+    }
+  close F;
+
+  $fail
+    and exit 1;
+
+  return $h;
+}
+
+{
+  my $since_date;
   my $format_string = '%s%n%b%n';
+  my $amend_file;
+  my $append_dot = 0;
   GetOptions
     (
      help => sub { usage 0 },
      version => sub { print "$ME version $VERSION\n"; exit },
      'since=s' => \$since_date,
      'format=s' => \$format_string,
+     'amend=s' => \$amend_file,
+     'append-dot' => \$append_dot,
     ) or usage 1;
 
-  my @cmd = (qw (git log --log-size), "--since=$since_date",
-             '--pretty=format:%ct  %an  <%ae>%n%n'.$format_string, @ARGV);
+
+  defined $since_date
+    and unshift @ARGV, "--since=$since_date";
+
+  # This is a hash that maps an SHA1 to perl code (i.e., s/old/new/)
+  # that makes a correction in the log or attribution of that commit.
+  my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
+
+  my @cmd = (qw (git log --log-size),
+             '--pretty=format:%H:%ct  %an  <%ae>%n%n'.$format_string, @ARGV);
   open PIPE, '-|', @cmd
     or die ("$ME: failed to run `". quoted_cmd (@cmd) ."': $!\n"
             . "(Is your Git too old?  Version 1.5.1 or later is required.)\n");
 
   my $prev_date_line = '';
+  my @prev_coauthors = ();
   while (1)
     {
       defined (my $in = <PIPE>)
@@ -130,7 +214,34 @@ sub quoted_cmd(@)
       $n_read == $log_nbytes
         or die "$ME:$.: unexpected EOF\n";
 
-      my @line = split "\n", $log;
+      # Extract leading hash.
+      my ($sha, $rest) = split ':', $log, 2;
+      defined $sha
+        or die "$ME:$.: malformed log entry\n";
+      $sha =~ /^[0-9a-fA-F]{40}$/
+        or die "$ME:$.: invalid SHA1: $sha\n";
+
+      # If this commit's log requires any transformation, do it now.
+      my $code = $amend_code->{$sha};
+      if (defined $code)
+        {
+          eval 'use Safe';
+          my $s = new Safe;
+          # Put the unpreprocessed entry into "$_".
+          $_ = $rest;
+
+          # Let $code operate on it, safely.
+          my $r = $s->reval("$code")
+            or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n";
+
+          # Note that we've used this entry.
+          delete $amend_code->{$sha};
+
+          # Update $rest upon success.
+          $rest = $_;
+        }
+
+      my @line = split "\n", $rest;
       my $author_line = shift @line;
       defined $author_line
         or die "$ME:$.: unexpected EOF\n";
@@ -139,18 +250,43 @@ sub quoted_cmd(@)
           . "(expected date/author/email):\n$author_line\n";
 
       my $date_line = sprintf "%s  $2\n", strftime ("%F", localtime ($1));
-      # If this line would be the same as the previous date/name/email
-      # line, then arrange not to print it.
-      if ($date_line ne $prev_date_line)
+
+      # Format 'Co-authored-by: A U Thor <email@example.com>' lines in
+      # standard multi-author ChangeLog format.
+      my @coauthors = grep /^Co-authored-by:.*$/, @line;
+      for (@coauthors)
+        {
+          s/^Co-authored-by:\s*/\t    /;
+          s/\s*</  </;
+
+          /<.*?@.*\..*>/
+            or warn "$ME: warning: missing email address for "
+              . substr ($_, 5) . "\n";
+        }
+
+      # If this header would be the same as the previous date/name/email/
+      # coauthors header, then arrange not to print it.
+      if ($date_line ne $prev_date_line or "@coauthors" ne "@prev_coauthors")
         {
           $prev_date_line eq ''
             or print "\n";
           print $date_line;
+          @coauthors
+            and print join ("\n", @coauthors), "\n";
         }
       $prev_date_line = $date_line;
+      @prev_coauthors = @coauthors;
 
-      # Omit "Signed-off-by..." lines.
+      # Omit "Co-authored-by..." and "Signed-off-by..." lines.
       @line = grep !/^Signed-off-by: .*>$/, @line;
+      @line = grep !/^Co-authored-by: /, @line;
+
+      # Remove leading and trailing blank lines.
+      if (@line)
+        {
+          while ($line[0] =~ /^\s*$/) { shift @line; }
+          while ($line[$#line] =~ /^\s*$/) { pop @line; }
+        }
 
       # If there were any lines
       if (@line == 0)
@@ -159,9 +295,17 @@ sub quoted_cmd(@)
         }
       else
         {
-          # Remove leading and trailing blank lines.
-          while ($line[0] =~ /^\s*$/) { shift @line; }
-          while ($line[$#line] =~ /^\s*$/) { pop @line; }
+          if ($append_dot)
+            {
+              # If the first line of the message has enough room, then
+              if (length $line[0] < 72)
+                {
+                  # append a dot if there is no other punctuation or blank
+                  # at the end.
+                  $line[0] =~ /[[:punct:]\s]$/
+                    or $line[0] .= '.';
+                }
+            }
 
           # Prefix each non-empty line with a TAB.
           @line = map { length $_ ? "\t$_" : '' } @line;
@@ -178,6 +322,16 @@ sub quoted_cmd(@)
   close PIPE
     or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
   # FIXME-someday: include $PROCESS_STATUS in the diagnostic
+
+  # Complain about any unused entry in the --amend=F specified file.
+  my $fail = 0;
+  foreach my $sha (keys %$amend_code)
+    {
+      warn "$ME:$amend_file: unused entry: $sha\n";
+      $fail = 1;
+    }
+
+  exit $fail;
 }
 
 # Local Variables:
index 22ddd38..355f361 100644 (file)
@@ -789,6 +789,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \
              -e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
              -e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
+             -e 's/@''GNULIB_FMA''@/$(GNULIB_FMA)/g' \
+             -e 's/@''GNULIB_FMAF''@/$(GNULIB_FMAF)/g' \
+             -e 's/@''GNULIB_FMAL''@/$(GNULIB_FMAL)/g' \
              -e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
              -e 's/@''GNULIB_FREXPF''@/$(GNULIB_FREXPF)/g' \
              -e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \
@@ -842,6 +845,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''HAVE_EXPF''@|$(HAVE_EXPF)|g' \
              -e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
              -e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
+             -e 's|@''HAVE_FMA''@|$(HAVE_FMA)|g' \
+             -e 's|@''HAVE_FMAF''@|$(HAVE_FMAF)|g' \
+             -e 's|@''HAVE_FMAL''@|$(HAVE_FMAL)|g' \
              -e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \
              -e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|g' \
              -e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
@@ -893,6 +899,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''REPLACE_FLOOR''@|$(REPLACE_FLOOR)|g' \
              -e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
              -e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \
+             -e 's|@''REPLACE_FMA''@|$(REPLACE_FMA)|g' \
+             -e 's|@''REPLACE_FMAF''@|$(REPLACE_FMAF)|g' \
+             -e 's|@''REPLACE_FMAL''@|$(REPLACE_FMAL)|g' \
              -e 's|@''REPLACE_FREXPF''@|$(REPLACE_FREXPF)|g' \
              -e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
              -e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
@@ -1373,6 +1382,29 @@ EXTRA_DIST += stat-time.h
 
 ## end   gnulib module stat-time
 
+## begin gnulib module stdalign
+
+BUILT_SOURCES += $(STDALIGN_H)
+
+# We need the following in order to create <stdalign.h> when the system
+# doesn't have one that works.
+if GL_GENERATE_STDALIGN_H
+stdalign.h: stdalign.in.h $(top_builddir)/config.status
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/stdalign.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+else
+stdalign.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES += stdalign.h stdalign.h-t
+
+EXTRA_DIST += stdalign.in.h
+
+## end   gnulib module stdalign
+
 ## begin gnulib module stdbool
 
 BUILT_SOURCES += $(STDBOOL_H)
@@ -1636,6 +1668,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
              -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
              -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
+             -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/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' \
@@ -1663,6 +1696,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
              -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
              -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
+             -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
              -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
              -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
              -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
@@ -1680,6 +1714,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
              -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
@@ -2153,11 +2188,12 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
              -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
              -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
+             -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/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_GETOPT''@/0$(GNULIB_GL_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' \
@@ -2190,6 +2226,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
+             -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
@@ -2202,6 +2239,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
              -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
+             -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
              -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
index 4d03e35..2049142 100644 (file)
 
 #include <stddef.h>
 
-/* Determine the alignment of a structure slot (field) of a given type,
+/* alignof_slot (TYPE)
+   Determine the alignment of a structure slot (field) of a given type,
    at compile time.  Note that the result depends on the ABI.
+   This is the same as alignof (TYPE) and _Alignof (TYPE), defined in
+   <stdalign.h> if __alignof_is_defined is 1.
    Note: The result cannot be used as a value for an 'enum' constant,
    due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc.  */
 #if defined __cplusplus
@@ -31,7 +34,8 @@
 # define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; }, __slot2)
 #endif
 
-/* Determine the good alignment of an object of the given type at compile time.
+/* alignof_type (TYPE)
+   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,
 # define alignof_type alignof_slot
 #endif
 
-/* alignof is an alias for alignof_slot semantics, since that's what most
-   callers need.
-   Note: The result cannot be used as a value for an 'enum' constant,
-   due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc.  */
-#define alignof alignof_slot
-
 #endif /* _ALIGNOF_H */
index ccf53e7..669673f 100644 (file)
@@ -118,23 +118,23 @@ extern "C" {
          if (c_isalpha (*s)) ...
  */
 
-extern bool c_isascii (int c); /* not locale dependent */
-
-extern bool c_isalnum (int c);
-extern bool c_isalpha (int c);
-extern bool c_isblank (int c);
-extern bool c_iscntrl (int c);
-extern bool c_isdigit (int c);
-extern bool c_islower (int c);
-extern bool c_isgraph (int c);
-extern bool c_isprint (int c);
-extern bool c_ispunct (int c);
-extern bool c_isspace (int c);
-extern bool c_isupper (int c);
-extern bool c_isxdigit (int c);
-
-extern int c_tolower (int c);
-extern int c_toupper (int c);
+extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */
+
+extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_islower (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST;
+
+extern int c_tolower (int c) _GL_ATTRIBUTE_CONST;
+extern int c_toupper (int c) _GL_ATTRIBUTE_CONST;
 
 
 #if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS
index 1e3d45a..5173cb2 100644 (file)
@@ -40,12 +40,13 @@ extern "C" {
 /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
    greater than zero if S1 is lexicographically less than, equal to or greater
    than S2.  */
-extern int c_strcasecmp (const char *s1, const char *s2);
+extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE;
 
 /* Compare no more than N characters of strings S1 and S2, ignoring case,
    returning less than, equal to or greater than zero if S1 is
    lexicographically less than, equal to or greater than S2.  */
-extern int c_strncasecmp (const char *s1, const char *s2, size_t n);
+extern int c_strncasecmp (const char *s1, const char *s2, size_t n)
+  _GL_ATTRIBUTE_PURE;
 
 
 #ifdef __cplusplus
index 6e7f1e9..821b24e 100644 (file)
@@ -37,9 +37,9 @@ char *dir_name (char const *file);
 # endif
 
 char *mdir_name (char const *file);
-size_t base_len (char const *file);
-size_t dir_len (char const *file);
-char *last_component (char const *file);
+size_t base_len (char const *file) _GL_ATTRIBUTE_PURE;
+size_t dir_len (char const *file) _GL_ATTRIBUTE_PURE;
+char *last_component (char const *file) _GL_ATTRIBUTE_PURE;
 
 bool strip_trailing_slashes (char *file);
 
index 653a263..c01c3c1 100644 (file)
 /* On native Windows platforms, many macros are not defined.  */
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
-/* POSIX says that EAGAIN and EWOULDBLOCK may have the same value.  */
-#  define EWOULDBLOCK     EAGAIN
-
-/* Values >= 100 seem safe to use.  */
-#  define ETXTBSY   100
-#  define GNULIB_defined_ETXTBSY 1
+/* These are the same values as defined by MSVC 10, for interoperability.  */
+
+#  ifndef ENOMSG
+#   define ENOMSG    122
+#   define GNULIB_defined_ENOMSG 1
+#  endif
+
+#  ifndef EIDRM
+#   define EIDRM     111
+#   define GNULIB_defined_EIDRM 1
+#  endif
+
+#  ifndef ENOLINK
+#   define ENOLINK   121
+#   define GNULIB_defined_ENOLINK 1
+#  endif
+
+#  ifndef EPROTO
+#   define EPROTO    134
+#   define GNULIB_defined_EPROTO 1
+#  endif
+
+#  ifndef EBADMSG
+#   define EBADMSG   104
+#   define GNULIB_defined_EBADMSG 1
+#  endif
+
+#  ifndef EOVERFLOW
+#   define EOVERFLOW 132
+#   define GNULIB_defined_EOVERFLOW 1
+#  endif
+
+#  ifndef ENOTSUP
+#   define ENOTSUP   129
+#   define GNULIB_defined_ENOTSUP 1
+#  endif
+
+#  ifndef ENETRESET
+#   define ENETRESET 117
+#   define GNULIB_defined_ENETRESET 1
+#  endif
+
+#  ifndef ECONNABORTED
+#   define ECONNABORTED 106
+#   define GNULIB_defined_ECONNABORTED 1
+#  endif
+
+#  ifndef ECANCELED
+#   define ECANCELED 105
+#   define GNULIB_defined_ECANCELED 1
+#  endif
+
+#  ifndef EINPROGRESS
+#   define EINPROGRESS     112
+#   define EALREADY        103
+#   define ENOTSOCK        128
+#   define EDESTADDRREQ    109
+#   define EMSGSIZE        115
+#   define EPROTOTYPE      136
+#   define ENOPROTOOPT     123
+#   define EPROTONOSUPPORT 135
+#   define EOPNOTSUPP      130
+#   define EAFNOSUPPORT    102
+#   define EADDRINUSE      100
+#   define EADDRNOTAVAIL   101
+#   define ENETDOWN        116
+#   define ENETUNREACH     118
+#   define ECONNRESET      108
+#   define ENOBUFS         119
+#   define EISCONN         113
+#   define ENOTCONN        126
+#   define ETIMEDOUT       138
+#   define ECONNREFUSED    107
+#   define ELOOP           114
+#   define EHOSTUNREACH    110
+#   define EWOULDBLOCK     140
+#   define ETXTBSY         139
+#   define ENODATA         120  /* not required by POSIX */
+#   define ENOSR           124  /* not required by POSIX */
+#   define ENOSTR          125  /* not required by POSIX */
+#   define ENOTRECOVERABLE 127  /* not required by POSIX */
+#   define EOWNERDEAD      133  /* not required by POSIX */
+#   define ETIME           137  /* not required by POSIX */
+#   define EOTHER          131  /* not required by POSIX */
+#   define GNULIB_defined_ESOCK 1
+#  endif
 
 /* These are intentionally the same values as the WSA* error numbers, defined
    in <winsock2.h>.  */
-#  define EINPROGRESS     10036
-#  define EALREADY        10037
-#  define ENOTSOCK        10038
-#  define EDESTADDRREQ    10039
-#  define EMSGSIZE        10040
-#  define EPROTOTYPE      10041
-#  define ENOPROTOOPT     10042
-#  define EPROTONOSUPPORT 10043
 #  define ESOCKTNOSUPPORT 10044  /* not required by POSIX */
-#  define EOPNOTSUPP      10045
 #  define EPFNOSUPPORT    10046  /* not required by POSIX */
-#  define EAFNOSUPPORT    10047
-#  define EADDRINUSE      10048
-#  define EADDRNOTAVAIL   10049
-#  define ENETDOWN        10050
-#  define ENETUNREACH     10051
-#  define ENETRESET       10052
-#  define ECONNABORTED    10053
-#  define ECONNRESET      10054
-#  define ENOBUFS         10055
-#  define EISCONN         10056
-#  define ENOTCONN        10057
 #  define ESHUTDOWN       10058  /* not required by POSIX */
 #  define ETOOMANYREFS    10059  /* not required by POSIX */
-#  define ETIMEDOUT       10060
-#  define ECONNREFUSED    10061
-#  define ELOOP           10062
 #  define EHOSTDOWN       10064  /* not required by POSIX */
-#  define EHOSTUNREACH    10065
 #  define EPROCLIM        10067  /* not required by POSIX */
 #  define EUSERS          10068  /* not required by POSIX */
 #  define EDQUOT          10069
 #  define ESTALE          10070
 #  define EREMOTE         10071  /* not required by POSIX */
-#  define GNULIB_defined_ESOCK 1
+#  define GNULIB_defined_EWINSOCK 1
 
 # endif
 
index 7779e4d..b83d093 100644 (file)
@@ -21,7 +21,7 @@
 /* Specification.  */
 #ifdef USE_LONG_DOUBLE
 /* Specification found in math.h or isnanl-nolibm.h.  */
-extern int rpl_isnanl (long double x);
+extern int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
 #elif ! defined USE_FLOAT
 /* Specification found in math.h or isnand-nolibm.h.  */
 extern int rpl_isnand (double x);
index 1605638..1703a12 100644 (file)
@@ -507,6 +507,80 @@ _GL_WARN_ON_USE (floorl, "floorl is unportable - "
 #endif
 
 
+#if @GNULIB_FMAF@
+# if @REPLACE_FMAF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fmaf
+#   define fmaf rpl_fmaf
+#  endif
+_GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z));
+_GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
+# else
+#  if !@HAVE_FMAF@
+_GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z));
+#  endif
+_GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
+# endif
+_GL_CXXALIASWARN (fmaf);
+#elif defined GNULIB_POSIXCHECK
+# undef fmaf
+# if HAVE_RAW_DECL_FMAF
+_GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
+                 "use gnulib module fmaf for portability");
+# endif
+#endif
+
+#if @GNULIB_FMA@
+# if @REPLACE_FMA@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fma
+#   define fma rpl_fma
+#  endif
+_GL_FUNCDECL_RPL (fma, double, (double x, double y, double z));
+_GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
+# else
+#  if !@HAVE_FMA@
+_GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
+#  endif
+_GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
+# endif
+_GL_CXXALIASWARN (fma);
+#elif defined GNULIB_POSIXCHECK
+# undef fma
+# if HAVE_RAW_DECL_FMA
+_GL_WARN_ON_USE (fma, "fma is unportable - "
+                 "use gnulib module fma for portability");
+# endif
+#endif
+
+#if @GNULIB_FMAL@
+# if @REPLACE_FMAL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fmal
+#   define fmal rpl_fmal
+#  endif
+_GL_FUNCDECL_RPL (fmal, long double,
+                  (long double x, long double y, long double z));
+_GL_CXXALIAS_RPL (fmal, long double,
+                  (long double x, long double y, long double z));
+# else
+#  if !@HAVE_FMAL@
+_GL_FUNCDECL_SYS (fmal, long double,
+                  (long double x, long double y, long double z));
+#  endif
+_GL_CXXALIAS_SYS (fmal, long double,
+                  (long double x, long double y, long double z));
+# endif
+_GL_CXXALIASWARN (fmal);
+#elif defined GNULIB_POSIXCHECK
+# undef fmal
+# if HAVE_RAW_DECL_FMAL
+_GL_WARN_ON_USE (fmal, "fmal is unportable - "
+                 "use gnulib module fmal for portability");
+# endif
+#endif
+
+
 #if @GNULIB_FMODF@
 # if !@HAVE_FMODF@
 #  undef fmodf
@@ -1172,7 +1246,7 @@ _GL_EXTERN_C int isnand (double x);
 /* Test whether X is a NaN.  */
 #  undef isnanl
 #  define isnanl rpl_isnanl
-_GL_EXTERN_C int isnanl (long double x);
+_GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
 # endif
 #endif
 
@@ -1198,7 +1272,7 @@ _GL_EXTERN_C int rpl_isnand (double x);
 #  if @HAVE_ISNANL@ && __GNUC__ >= 4
 #   define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
 #  else
-_GL_EXTERN_C int rpl_isnanl (long double x);
+_GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
 #   define gl_isnan_l(x) rpl_isnanl (x)
 #  endif
 #  undef isnan
index ec5fe1a..bf17744 100644 (file)
@@ -36,7 +36,7 @@
 
 #if _LIBC
 # if HAVE_GNU_LD
-# define environ __environ
+#  define environ __environ
 # else
 extern char **environ;
 # endif
index d47112c..a45bc5f 100644 (file)
 #define SOCKETS_2_1 0x201
 #define SOCKETS_2_2 0x202
 
-int gl_sockets_startup (int version);
-int gl_sockets_cleanup (void);
+int gl_sockets_startup (int version)
+#if !WINDOWS_SOCKETS
+  _GL_ATTRIBUTE_CONST
+#endif
+  ;
+
+int gl_sockets_cleanup (void)
+#if !WINDOWS_SOCKETS
+  _GL_ATTRIBUTE_CONST
+#endif
+  ;
 
 /* This function is useful it you create a socket using gnulib's
    Winsock wrappers but needs to pass on the socket handle to some
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
new file mode 100644 (file)
index 0000000..16213d2
--- /dev/null
@@ -0,0 +1,89 @@
+/* A substitute for ISO C 1x <stdalign.h>.
+
+   Copyright 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.  */
+
+/* Written by Paul Eggert and Bruno Haible.  */
+
+#ifndef _GL_STDALIGN_H
+#define _GL_STDALIGN_H
+
+/* ISO C1X <stdalign.h> for platforms that lack it.
+
+   References:
+   ISO C1X <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>
+   sections 6.5.3.4, 6.7.5, 7.15.
+   C++0X <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>
+   section 18.10. */
+
+/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
+   requirement of a structure member (i.e., slot or field) that is of
+   type TYPE, as an integer constant expression.
+
+   This differs from GCC's __alignof__ operator, which can yield a
+   better-performing alignment for an object of that type.  For
+   example, on x86 with GCC, __alignof__ (double) and __alignof__
+   (long long) are 8, whereas alignof (double) and alignof (long long)
+   are 4 unless the option '-malign-double' is used.
+
+   The result cannot be used as a value for an 'enum' constant, if you
+   want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.  */
+#include <stddef.h>
+#if defined __cplusplus
+   template <class __t> struct __alignof_helper { char __a; __t __b; };
+# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+#else
+# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+#endif
+#define alignof _Alignof
+#define __alignof_is_defined 1
+
+/* alignas (A), also known as _Alignas (A), aligns a variable or type
+   to the alignment A, where A is an integer constant expression.  For
+   example:
+
+      int alignas (8) foo;
+      struct s { int a; int alignas (8) bar; };
+
+   aligns the address of FOO and the offset of BAR to be multiples of 8.
+
+   A should be a power of two that is at least the type's alignment
+   and at most the implementation's alignment limit.  This limit is
+   2**28 on typical GNUish hosts, and 2**13 on MSVC.  To be portable
+   to MSVC through at least version 10.0, A should be an integer
+   constant, as MSVC does not support expressions such as 1 << 3.
+   To be portable to Sun C 5.11, do not align auto variables to
+   anything stricter than their default alignment.
+
+   The following draft C1X requirements are not supported here:
+
+     - If A is zero, alignas has no effect.
+     - alignas can be used multiple times; the strictest one wins.
+     - alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
+
+   */
+
+#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C
+# define _Alignas(a) __attribute__ ((__aligned__ (a)))
+#elif 1300 <= _MSC_VER
+# define _Alignas(a) __declspec (align (a))
+#endif
+#ifdef _Alignas
+# define alignas _Alignas
+# define __alignas_is_defined 1
+#endif
+
+#endif /* _GL_STDALIGN_H */
index 16967f2..1451dbf 100644 (file)
       diagnostics.  */
 #  define __STDINT_H__
 # endif
+
+  /* Some pre-C++11 <stdint.h> implementations need this.  */
+# ifdef __cplusplus
+#  ifndef __STDC_CONSTANT_MACROS
+#   define __STDC_CONSTANT_MACROS 1
+#  endif
+#  ifndef __STDC_LIMIT_MACROS
+#   define __STDC_LIMIT_MACROS 1
+#  endif
+# endif
+
   /* 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
@@ -313,8 +324,6 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 
 /* 7.18.2. Limits of specified-width integer types */
 
-#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
-
 /* 7.18.2.1. Limits of exact-width integer types */
 
 /* Here we assume a standard architecture where the hardware integer
@@ -534,12 +543,8 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 #define WINT_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
 
-#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
-
 /* 7.18.4. Macros for integer constants */
 
-#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
-
 /* 7.18.4.1. Macros for minimum-width integer constants */
 /* According to ISO C 99 Technical Corrigendum 1 */
 
@@ -600,7 +605,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 # endif
 #endif
 
-#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
-
 #endif /* _@GUARD_PREFIX@_STDINT_H */
 #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
index f5a846a..2b453ba 100644 (file)
@@ -247,7 +247,7 @@ _GL_CXXALIASWARN (grantpt);
 #elif defined GNULIB_POSIXCHECK
 # undef grantpt
 # if HAVE_RAW_DECL_GRANTPT
-_GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
+_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
                  "use gnulib module grantpt for portability");
 # endif
 #endif
@@ -455,6 +455,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
 # endif
 #endif
 
+#if @GNULIB_PTSNAME_R@
+/* Set the pathname of the pseudo-terminal slave associated with
+   the master FD is open on and return 0, or set errno and return
+   non-zero on errors.  */
+# if @REPLACE_PTSNAME_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ptsname_r
+#   define ptsname_r rpl_ptsname_r
+#  endif
+_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+# else
+#  if !@HAVE_PTSNAME_R@
+_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+#  endif
+_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+# endif
+_GL_CXXALIASWARN (ptsname_r);
+#elif defined GNULIB_POSIXCHECK
+# undef ptsname_r
+# if HAVE_RAW_DECL_PTSNAME_R
+_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
+                 "use gnulib module ptsname_r for portability");
+# endif
+#endif
+
 #if @GNULIB_PUTENV@
 # if @REPLACE_PUTENV@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
index 5fadb1a..a92d36b 100644 (file)
@@ -85,7 +85,7 @@ typedef unsigned short  sa_family_t;
 #  endif
 # endif
 #else
-# include <alignof.h>
+# include <stdalign.h>
 /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
    2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
 # define __ss_aligntype unsigned long int
index e54a91e..69cd814 100644 (file)
@@ -1268,6 +1268,33 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
 #endif
 
 
+#if @GNULIB_SETHOSTNAME@
+/* Set the host name of the machine.
+   The host name may or may not be fully qualified.
+
+   Put LEN bytes of NAME into the host name.
+   Return 0 if successful, otherwise, set errno and return -1.
+
+   Platforms with no ability to set the hostname return -1 and set
+   errno = ENOSYS.  */
+# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
+_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+# endif
+/* Need to cast, because on Solaris 11 2011-10, MacOS X 10.5, IRIX 6.5
+   and FreeBSD 6.4 the second parameter is int.  On Solaris 11
+   2011-10, the first parameter is not const.  */
+_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
+_GL_CXXALIASWARN (sethostname);
+#elif defined GNULIB_POSIXCHECK
+# undef sethostname
+# if HAVE_RAW_DECL_SETHOSTNAME
+_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
+                 "use gnulib module sethostname for portability");
+# endif
+#endif
+
+
 #if @GNULIB_SLEEP@
 /* Pause the execution of the current thread for N seconds.
    Returns the number of seconds left to sleep.
index 20cb7c3..1929303 100644 (file)
@@ -48,15 +48,87 @@ set_winsock_errno (void)
     case WSA_INVALID_PARAMETER:
       errno = EINVAL;
       break;
-    case WSAEWOULDBLOCK:
-      errno = EWOULDBLOCK;
-      break;
     case WSAENAMETOOLONG:
       errno = ENAMETOOLONG;
       break;
     case WSAENOTEMPTY:
       errno = ENOTEMPTY;
       break;
+    case WSAEWOULDBLOCK:
+      errno = EWOULDBLOCK;
+      break;
+    case WSAEINPROGRESS:
+      errno = EINPROGRESS;
+      break;
+    case WSAEALREADY:
+      errno = EALREADY;
+      break;
+    case WSAENOTSOCK:
+      errno = ENOTSOCK;
+      break;
+    case WSAEDESTADDRREQ:
+      errno = EDESTADDRREQ;
+      break;
+    case WSAEMSGSIZE:
+      errno = EMSGSIZE;
+      break;
+    case WSAEPROTOTYPE:
+      errno = EPROTOTYPE;
+      break;
+    case WSAENOPROTOOPT:
+      errno = ENOPROTOOPT;
+      break;
+    case WSAEPROTONOSUPPORT:
+      errno = EPROTONOSUPPORT;
+      break;
+    case WSAEOPNOTSUPP:
+      errno = EOPNOTSUPP;
+      break;
+    case WSAEAFNOSUPPORT:
+      errno = EAFNOSUPPORT;
+      break;
+    case WSAEADDRINUSE:
+      errno = EADDRINUSE;
+      break;
+    case WSAEADDRNOTAVAIL:
+      errno = EADDRNOTAVAIL;
+      break;
+    case WSAENETDOWN:
+      errno = ENETDOWN;
+      break;
+    case WSAENETUNREACH:
+      errno = ENETUNREACH;
+      break;
+    case WSAENETRESET:
+      errno = ENETRESET;
+      break;
+    case WSAECONNABORTED:
+      errno = ECONNABORTED;
+      break;
+    case WSAECONNRESET:
+      errno = ECONNRESET;
+      break;
+    case WSAENOBUFS:
+      errno = ENOBUFS;
+      break;
+    case WSAEISCONN:
+      errno = EISCONN;
+      break;
+    case WSAENOTCONN:
+      errno = ENOTCONN;
+      break;
+    case WSAETIMEDOUT:
+      errno = ETIMEDOUT;
+      break;
+    case WSAECONNREFUSED:
+      errno = ECONNREFUSED;
+      break;
+    case WSAELOOP:
+      errno = ELOOP;
+      break;
+    case WSAEHOSTUNREACH:
+      errno = EHOSTUNREACH;
+      break;
     default:
       errno = (err > 10000 && err < 10025) ? err - 10000 : err;
       break;
index 7d83299..8621dec 100644 (file)
@@ -18,7 +18,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
-# elif 1200 <= _MSC_VER
+# elif defined _MSC_VER && 1200 <= _MSC_VER
 #  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
index c1e54d3..1a007e6 100644 (file)
@@ -162,6 +162,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module ssize_t:
   # Code from module stat:
   # Code from module stat-time:
+  # Code from module stdalign:
   # Code from module stdbool:
   # Code from module stddef:
   # Code from module stdint:
@@ -548,6 +549,7 @@ fi
 gl_SYS_STAT_MODULE_INDICATOR([stat])
 gl_STAT_TIME
 gl_STAT_BIRTHTIME
+gl_STDALIGN_H
 AM_STDBOOL_H
 gl_STDDEF_H
 gl_STDINT_H
@@ -872,6 +874,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/sockets.h
   lib/stat-time.h
   lib/stat.c
+  lib/stdalign.in.h
   lib/stdbool.in.h
   lib/stddef.in.h
   lib/stdint.in.h
@@ -1006,6 +1009,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/ssize_t.m4
   m4/stat-time.m4
   m4/stat.m4
+  m4/stdalign.m4
   m4/stdbool.m4
   m4/stddef_h.m4
   m4/stdint.m4
index e5a2892..e58a9e9 100644 (file)
@@ -1,4 +1,4 @@
-# math_h.m4 serial 53
+# math_h.m4 serial 56
 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,
@@ -41,7 +41,7 @@ AC_DEFUN([gl_MATH_H],
   gl_WARN_ON_USE_PREPARE([[#include <math.h>]],
     [acosf acosl asinf asinl atanf atanl
      ceilf ceill copysign copysignf copysignl cosf cosl coshf
-     expf expl fabsf floorf floorl fmodf frexpf frexpl
+     expf expl fabsf floorf floorl fma fmaf fmal fmodf frexpf frexpl
      ldexpf ldexpl logb logf logl log10f modff powf
      rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl
      tanf tanl tanhf trunc truncf truncl])
@@ -80,6 +80,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   GNULIB_FLOOR=0;     AC_SUBST([GNULIB_FLOOR])
   GNULIB_FLOORF=0;    AC_SUBST([GNULIB_FLOORF])
   GNULIB_FLOORL=0;    AC_SUBST([GNULIB_FLOORL])
+  GNULIB_FMA=0;       AC_SUBST([GNULIB_FMA])
+  GNULIB_FMAF=0;      AC_SUBST([GNULIB_FMAF])
+  GNULIB_FMAL=0;      AC_SUBST([GNULIB_FMAL])
   GNULIB_FMODF=0;     AC_SUBST([GNULIB_FMODF])
   GNULIB_FREXPF=0;    AC_SUBST([GNULIB_FREXPF])
   GNULIB_FREXP=0;     AC_SUBST([GNULIB_FREXP])
@@ -133,6 +136,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_EXPF=1;                 AC_SUBST([HAVE_EXPF])
   HAVE_EXPL=1;                 AC_SUBST([HAVE_EXPL])
   HAVE_FABSF=1;                AC_SUBST([HAVE_FABSF])
+  HAVE_FMA=1;                  AC_SUBST([HAVE_FMA])
+  HAVE_FMAF=1;                 AC_SUBST([HAVE_FMAF])
+  HAVE_FMAL=1;                 AC_SUBST([HAVE_FMAL])
   HAVE_FMODF=1;                AC_SUBST([HAVE_FMODF])
   HAVE_FREXPF=1;               AC_SUBST([HAVE_FREXPF])
   HAVE_ISNANF=1;               AC_SUBST([HAVE_ISNANF])
@@ -183,6 +189,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   REPLACE_FLOOR=0;             AC_SUBST([REPLACE_FLOOR])
   REPLACE_FLOORF=0;            AC_SUBST([REPLACE_FLOORF])
   REPLACE_FLOORL=0;            AC_SUBST([REPLACE_FLOORL])
+  REPLACE_FMA=0;               AC_SUBST([REPLACE_FMA])
+  REPLACE_FMAF=0;              AC_SUBST([REPLACE_FMAF])
+  REPLACE_FMAL=0;              AC_SUBST([REPLACE_FMAL])
   REPLACE_FREXPF=0;            AC_SUBST([REPLACE_FREXPF])
   REPLACE_FREXP=0;             AC_SUBST([REPLACE_FREXP])
   REPLACE_FREXPL=0;            AC_SUBST([REPLACE_FREXPL])
index b7a1239..c75e7b9 100644 (file)
@@ -1,11 +1,11 @@
-# mathfunc.m4 serial 9
+# mathfunc.m4 serial 10
 dnl Copyright (C) 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,
 dnl with or without modifications, as long as this notice is preserved.
 
-# gl_MATHFUNC(FUNC, RETTYPE, PARAMTYPES [, EXTRA-CODE])
-# -----------------------------------------------------
+# gl_MATHFUNC(FUNC, RETTYPE, PARAMTYPES [, INCLUDES] [, EXTRA-CODE])
+# ------------------------------------------------------------------
 # tests whether the function FUNC is available in libc or libm.
 # RETTYPE is the return type. PARAMTYPES is a parameter list, with parentheses.
 # It sets FUNC_LIBM to empty or "-lm" accordingly.
@@ -38,15 +38,17 @@ AC_DEFUN([gl_MATHFUNC],
                                     [m4_bpatsubst(
                                        [m4_bpatsubst(
                                           [m4_bpatsubst(
-                                             [$3],
-                                             [int \*], [&i_ret])],
-                                          [float \*], [&f_ret])],
-                                       [double \*], [&d_ret])],
-                                    [long double \*], [&l_ret])],
-                                 [int], [2])],
-                              [float], [1.618034f])],
-                           [long double], [1.618033988749894848L])],
-                        [double], [1.6180339887])])
+                                             [m4_bpatsubst(
+                                                [$3],
+                                                [int \*], [&i_ret])],
+                                             [float \*], [&f_ret])],
+                                          [double \*], [&d_ret])],
+                                       [long double \*], [&l_ret])],
+                                    [int], [2])],
+                                 [float], [1.618034f])],
+                              [long double], [1.618033988749894848L])],
+                           [double], [1.6180339887])],
+                        [void], [])])
   FUNC[]_LIBM=
   AC_CACHE_CHECK([whether func() can be used without linking with libm],
     [gl_cv_func_]func[_no_libm],
@@ -57,13 +59,14 @@ AC_DEFUN([gl_MATHFUNC],
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
+             $4
              $2 (*funcptr) $3 = ]func[;
              int i_ret;
              float f_ret;
              double d_ret;
              long double l_ret;]],
            [[$2 y = funcptr ]ARGS[ + ]func[ ]ARGS[;
-             $4
+             $5
              return y < 0.3 || y > 1.7;
            ]])],
         [gl_cv_func_]func[_no_libm=yes],
@@ -81,13 +84,14 @@ AC_DEFUN([gl_MATHFUNC],
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
+               $4
                $2 (*funcptr) $3 = ]func[;
                int i_ret;
                float f_ret;
                double d_ret;
                long double l_ret;]],
              [[$2 y = funcptr ]ARGS[ + ]func[ ]ARGS[;
-               $4
+               $5
                return y < 0.3 || y > 1.7;
              ]])],
           [gl_cv_func_]func[_in_libm=yes],
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
new file mode 100644 (file)
index 0000000..2641dce
--- /dev/null
@@ -0,0 +1,37 @@
+# Check for stdalign.h that conforms to C1x.
+
+dnl Copyright 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.
+
+# Prepare for substituting <stdalign.h> if it is not supported.
+
+AC_DEFUN([gl_STDALIGN_H],
+[
+  AC_CACHE_CHECK([for working stdalign.h],
+    [gl_cv_header_working_stdalign_h],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdalign.h>
+            int align_int = alignof (int) + _Alignof (double);
+
+            /* Test _Alignas only on platforms where gnulib can help.  */
+            #if \
+                (__GNUC__ || __IBMC__ || __IBMCPP__ \
+                 || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
+              int alignas (8) alignas_int = 1;
+            #endif
+          ]])],
+       [gl_cv_header_working_stdalign_h=yes],
+       [gl_cv_header_working_stdalign_h=no])])
+
+  if test $gl_cv_header_working_stdalign_h = yes; then
+    STDALIGN_H=''
+  else
+    STDALIGN_H='stdalign.h'
+  fi
+
+  AC_SUBST([STDALIGN_H])
+  AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"])
+])
index 092161c..cfad016 100644 (file)
@@ -1,4 +1,4 @@
-# stdint.m4 serial 41
+# stdint.m4 serial 42
 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,
@@ -69,8 +69,8 @@ AC_DEFUN_ONCE([gl_STDINT_H],
       [gl_cv_header_working_stdint_h=no
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
+#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ before C++11 */
+#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ before C++11 */
 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 #include <stdint.h>
 /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
@@ -219,8 +219,8 @@ struct s {
           dnl This detects a bug on HP-UX 11.23/ia64.
           AC_RUN_IFELSE([
             AC_LANG_PROGRAM([[
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
+#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ before C++11 */
+#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ before C++11 */
 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 #include <stdint.h>
 ]
index fbdba98..0a8a9e5 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 37
+# stdlib_h.m4 serial 39
 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,
@@ -21,8 +21,8 @@ AC_DEFUN([gl_STDLIB_H],
 #endif
     ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
     initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt
-    ptsname random_r realpath rpmatch setenv setstate_r srandom_r strtod
-    strtoll strtoull unlockpt unsetenv])
+    ptsname ptsname_r random_r realpath rpmatch setenv setstate_r srandom_r
+    strtod strtoll strtoull unlockpt unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -52,6 +52,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_MKSTEMPS=0;      AC_SUBST([GNULIB_MKSTEMPS])
   GNULIB_POSIX_OPENPT=0;  AC_SUBST([GNULIB_POSIX_OPENPT])
   GNULIB_PTSNAME=0;       AC_SUBST([GNULIB_PTSNAME])
+  GNULIB_PTSNAME_R=0;     AC_SUBST([GNULIB_PTSNAME_R])
   GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
   GNULIB_RANDOM_R=0;      AC_SUBST([GNULIB_RANDOM_R])
   GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
@@ -79,6 +80,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_MKSTEMPS=1;           AC_SUBST([HAVE_MKSTEMPS])
   HAVE_POSIX_OPENPT=1;       AC_SUBST([HAVE_POSIX_OPENPT])
   HAVE_PTSNAME=1;            AC_SUBST([HAVE_PTSNAME])
+  HAVE_PTSNAME_R=1;          AC_SUBST([HAVE_PTSNAME_R])
   HAVE_RANDOM_H=1;           AC_SUBST([HAVE_RANDOM_H])
   HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
   HAVE_REALPATH=1;           AC_SUBST([HAVE_REALPATH])
@@ -97,6 +99,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
   REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
+  REPLACE_PTSNAME_R=0;       AC_SUBST([REPLACE_PTSNAME_R])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_REALLOC=0;         AC_SUBST([REPLACE_REALLOC])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
index 57c8094..34bdef5 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 61
+# unistd_h.m4 serial 62
 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,
@@ -43,8 +43,8 @@ AC_DEFUN([gl_UNISTD_H],
     fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups
     gethostname getlogin getlogin_r getpagesize getusershell setusershell
     endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite
-    readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
-    usleep])
+    readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r
+    unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -94,11 +94,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_READLINK=0;             AC_SUBST([GNULIB_READLINK])
   GNULIB_READLINKAT=0;           AC_SUBST([GNULIB_READLINKAT])
   GNULIB_RMDIR=0;                AC_SUBST([GNULIB_RMDIR])
+  GNULIB_SETHOSTNAME=0;          AC_SUBST([GNULIB_SETHOSTNAME])
   GNULIB_SLEEP=0;                AC_SUBST([GNULIB_SLEEP])
   GNULIB_SYMLINK=0;              AC_SUBST([GNULIB_SYMLINK])
   GNULIB_SYMLINKAT=0;            AC_SUBST([GNULIB_SYMLINKAT])
   GNULIB_TTYNAME_R=0;            AC_SUBST([GNULIB_TTYNAME_R])
-  GNULIB_UNISTD_H_GETOPT=0;      AC_SUBST([GNULIB_UNISTD_H_GETOPT])
   GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
   GNULIB_UNISTD_H_SIGPIPE=0;     AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
   GNULIB_UNLINK=0;               AC_SUBST([GNULIB_UNLINK])
@@ -131,6 +131,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_PWRITE=1;          AC_SUBST([HAVE_PWRITE])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
   HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
+  HAVE_SETHOSTNAME=1;     AC_SUBST([HAVE_SETHOSTNAME])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
   HAVE_SYMLINK=1;         AC_SUBST([HAVE_SYMLINK])
   HAVE_SYMLINKAT=1;       AC_SUBST([HAVE_SYMLINKAT])
@@ -143,6 +144,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
   HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
   HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
+  HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
   HAVE_DECL_TTYNAME_R=1;  AC_SUBST([HAVE_DECL_TTYNAME_R])
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
index d51fec6..e4efb5f 100644 (file)
--- a/maint.mk
+++ b/maint.mk
 # ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
 ME := maint.mk
 
-# Override this in cfg.mk if you use a non-standard build-aux directory.
-build_aux ?= $(srcdir)/build-aux
+# Diagnostic for continued use of deprecated variable.
+# Remove in 2013
+ifneq ($(build_aux),)
+ $(error "$(ME): \
+set $$(_build-aux) relative to $$(srcdir) instead of $$(build_aux)")
+endif
 
 # Do not save the original name or timestamp in the .tar.gz file.
 # Use --rsyncable if available.
@@ -34,7 +38,7 @@ GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
 GIT = git
 VC = $(GIT)
 
-VC_LIST = $(build_aux)/vc-list-files -C $(srcdir)
+VC_LIST = $(srcdir)/$(_build-aux)/vc-list-files -C $(srcdir)
 
 # You can override this variable in cfg.mk to set your own regexp
 # matching files to ignore.
@@ -274,7 +278,7 @@ define _sc_search_regexp
 endef
 
 sc_avoid_if_before_free:
-       @$(build_aux)/useless-if-before-free                            \
+       @$(srcdir)/$(_build-aux)/useless-if-before-free                 \
                $(useless_free_options)                                 \
            $$($(VC_LIST_EXCEPT) | grep -v useless-if-before-free) &&   \
          { echo '$(ME): found useless "if" before "free" above' 1>&2;  \
@@ -618,7 +622,17 @@ _stddef_syms_re = NULL|offsetof|ptrdiff_t|size_t|wchar_t
 # Prohibit the inclusion of stddef.h without an actual use.
 sc_prohibit_stddef_without_use:
        @h='stddef.h'                                                   \
-       re='\<($(_stddef_syms_re)) *\('                                 \
+       re='\<($(_stddef_syms_re))\>'                                   \
+         $(_sc_header_without_use)
+
+_de1 = dirfd|(close|(fd)?open|read|rewind|seek|tell)dir(64)?(_r)?
+_de2 = (versionsort|struct dirent|getdirentries|alphasort|scandir(at)?)(64)?
+_de3 = MAXNAMLEN|DIR|ino_t|d_ino|d_fileno|d_namlen
+_dirent_syms_re = $(_de1)|$(_de2)|$(_de3)
+# Prohibit the inclusion of dirent.h without an actual use.
+sc_prohibit_dirent_without_use:
+       @h='dirent.h'                                                   \
+       re='\<($(_dirent_syms_re))\>'                                   \
          $(_sc_header_without_use)
 
 # Prohibit the inclusion of verify.h without an actual use.
@@ -749,10 +763,12 @@ gl_other_headers_ ?= \
 
 # Perl -lne code to extract "significant" cpp-defined symbols from a
 # gnulib header file, eliminating a few common false-positives.
+# The exempted names below are defined only conditionally in gnulib,
+# and hence sometimes must/may be defined in application code.
 gl_extract_significant_defines_ = \
   /^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\
     && $$2 !~ /(?:rpl_|_used_without_)/\
-    && $$1 !~ /^(?:NSIG)$$/\
+    && $$1 !~ /^(?:NSIG|ENODATA)$$/\
     && $$1 !~ /^(?:SA_RESETHAND|SA_RESTART)$$/\
     and print $$1
 
@@ -1141,6 +1157,16 @@ sc_cross_check_PATH_usage_in_tests:
                1>&2; exit 1; } || :;                                   \
        fi
 
+# BRE regex of file contents to identify a test script.
+_test_script_regex ?= \<init\.sh\>
+
+# In tests, use "compare expected actual", not the reverse.
+sc_prohibit_reversed_compare_failure:
+       @prohibit='\<compare [^ ]+ ([^ ]*exp|/dev/null)'                \
+       containing='$(_test_script_regex)'                              \
+       halt='reversed compare arguments'                               \
+         $(_sc_search_regexp)
+
 # #if HAVE_... will evaluate to false for any non numeric string.
 # That would be flagged by using -Wundef, however gnulib currently
 # tests many undefined macros, and so we can't enable that option.
@@ -1187,9 +1213,9 @@ bootstrap-tools ?= autoconf,automake,gnulib
 # If it's not already specified, derive the GPG key ID from
 # the signed tag we've just applied to mark this release.
 gpg_key_ID ?= \
-  $$(git cat-file tag v$(VERSION) > .ann-sig \
-     && gpgv .ann-sig - < /dev/null 2>&1 \
-         | sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig)
+  $$(git cat-file tag v$(VERSION) \
+     | gpgv --status-fd 1 --keyring /dev/null - - 2>/dev/null \
+     | sed -n '/^\[GNUPG:\] ERRSIG /{s///;s/ .*//p;q}')
 
 translation_project_ ?= coordinator@translationproject.org
 
@@ -1208,7 +1234,7 @@ else
 endif
 
 announcement: NEWS ChangeLog $(rel-files)
-       @$(build_aux)/announce-gen                                      \
+       @$(srcdir)/$(_build-aux)/announce-gen                           \
            --mail-headers='$(announcement_mail_headers_)'              \
            --release-type=$(RELEASE_TYPE)                              \
            --package=$(PACKAGE)                                        \
@@ -1232,7 +1258,7 @@ upload_dest_dir_ ?= $(PACKAGE)
 emit_upload_commands:
        @echo =====================================
        @echo =====================================
-       @echo "$(build_aux)/gnupload $(GNUPLOADFLAGS) \\"
+       @echo "$(srcdir)/$(_build-aux)/gnupload $(GNUPLOADFLAGS) \\"
        @echo "    --to $(gnu_rel_host):$(upload_dest_dir_) \\"
        @echo "  $(rel-files)"
        @echo '# send the ~/announce-$(my_distdir) e-mail'
@@ -1327,7 +1353,7 @@ web-manual:
        @test -z "$(manual_title)" \
          && { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
        @cd '$(srcdir)/doc'; \
-         $(SHELL) ../$(build_aux)/gendocs.sh $(gendocs_options_) \
+         $(SHELL) ../$(_build-aux)/gendocs.sh $(gendocs_options_) \
             -o '$(abs_builddir)/doc/manual' \
             --email $(PACKAGE_BUGREPORT) $(PACKAGE) \
            "$(PACKAGE_NAME) - $(manual_title)"
@@ -1392,7 +1418,7 @@ update-copyright-env ?=
 update-copyright:
        grep -l -w Copyright                                             \
          $$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \
-         | $(update-copyright-env) xargs $(build_aux)/$@
+         | $(update-copyright-env) xargs $(srcdir)/$(_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.
@@ -1422,7 +1448,7 @@ sc_tight_scope: tight-scope.mk
 
 tight-scope.mk: $(ME)
        @rm -f $@ $@-t
-       @perl -ne '/^# TS-start/.../^# TS-end/ and print' $(ME) > $@-t
+       @perl -ne '/^# TS-start/.../^# TS-end/ and print' $(srcdir)/$(ME) > $@-t
        @chmod a=r $@-t && mv $@-t $@
 
 ifeq (a,b)