Don't abort if the 'long double' type has excess precision.
[gnulib.git] / gnulib-tool
index 7cad5d3..5d3a785 100755 (executable)
@@ -2,10 +2,10 @@
 #
 # Copyright (C) 2002-2007 Free Software Foundation, Inc.
 #
-# This program is free software; you can redistribute it and/or modify
+# This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
+# 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
@@ -13,8 +13,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU 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.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
 # This program is meant for authors or maintainers which want to import
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2007-07-23 22:08:02 $'
+cvsdatestamp='$Date: 2007-09-17 10:26:33 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
+# Sometimes last_checkin_date is "YYYY/MM/DD ...", sometimes "YYYY-MM-DD ...".
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
+# version is in YYYY-MM-DD format.
 nl='
 '
 IFS=" ""       $nl"
@@ -73,6 +74,17 @@ fi
 # gnulib-tool generates, since we don't want "sed --posix" to leak
 # into makefiles.
 if (alias) > /dev/null 2>&1 && echo | sed --posix -e d >/dev/null 2>&1; then
+  # Define sed as an alias.
+  # It is not always possible to use aliases. Aliases are guaranteed to work
+  # if the executing shell is bash and either it is invoked as /bin/sh or
+  # is a version >= 2.0, supporting shopt. This is the common case.
+  # Two other approaches (use of a variable $sed or of a function func_sed
+  # instead of an alias) require massive, fragile code changes.
+  # An other approach (use of function sed) requires `which sed` - but 'which'
+  # is hard to emulate, due to missing "test -x" on some platforms.
+  if test -n "$BASH_VERSION"; then
+    shopt -s expand_aliases >/dev/null 2>&1
+  fi
   alias sed='sed --posix'
 fi
 
@@ -89,6 +101,7 @@ Usage: gnulib-tool --list
        gnulib-tool --test --dir=directory module1 ... moduleN
        gnulib-tool --megatest --dir=directory [module1 ... moduleN]
        gnulib-tool --extract-description module
+       gnulib-tool --extract-notice module
        gnulib-tool --extract-filelist module
        gnulib-tool --extract-dependencies module
        gnulib-tool --extract-autoconf-snippet module
@@ -114,6 +127,7 @@ Operation modes:
       --megatest            test the given modules one by one and all together
                             (recommended to use CC=\"gcc -Wall\" here)
       --extract-description        extract the description
+      --extract-notice             extract the notice or banner
       --extract-filelist           extract the list of files
       --extract-dependencies       extract the dependencies
       --extract-autoconf-snippet   extract the snippet for configure.ac
@@ -132,6 +146,8 @@ General options:
                             directory.
       --local-dir=DIRECTORY  Specify a local override directory where to look
                             up files before looking in gnulib's directory.
+      --verbose             Increase verbosity. May be repeated.
+      --quiet               Decrease verbosity. May be repeated.
 
 Options for --import:
       --lib=LIBRARY         Specify the library name.  Defaults to 'libgnu'.
@@ -153,8 +169,10 @@ Options for --import:
       --avoid=MODULE        Avoid including the given MODULE. Useful if you
                             have code that provides equivalent functionality.
                             This option can be repeated.
-      --lgpl                Abort if modules aren't available under the LGPL.
+      --lgpl[=2|=3]         Abort if modules aren't available under the LGPL.
                             Also modify license template from GPL to LGPL.
+                            The version number of the LGPL can be specified;
+                            the default is currently LGPLv3.
       --makefile-name=NAME  Name of makefile in automake syntax in the
                             source-base and tests-base directories
                             (default \"Makefile.am\").
@@ -181,7 +199,7 @@ Report bugs to <bug-gnulib@gnu.org>."
 # outputs to stdout the --version message.
 func_version ()
 {
-  year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'`
+  year=`echo "$version" | sed -e 's,-.*$,,'`
   echo "\
 $progname (GNU $package) $version
 Copyright (C) $year Free Software Foundation, Inc.
@@ -409,7 +427,7 @@ func_ln_if_changed ()
     echo "usage: func_ln_if_changed SRC DEST" >&2
   fi
   ln_target=`func_readlink "$2"`
-  if test -L "$2" && test "$1" = "$ln_target"; then
+  if test -h "$2" && test "$1" = "$ln_target"; then
     :
   else
     rm -f "$2"
@@ -568,6 +586,7 @@ fi
 # - mode            list or import or create-testdir or create-megatestdir
 # - destdir         from --dir
 # - local_gnulib_dir  from --local-dir
+# - verbose         integer, default 0, inc/decremented by --verbose/--quiet
 # - libname, supplied_libname  from --lib
 # - sourcebase      from --source-base
 # - m4base          from --m4-base
@@ -577,7 +596,7 @@ fi
 # - auxdir          from --aux-dir
 # - inctests        true if --with-tests was given, blank otherwise
 # - avoidlist       list of modules to avoid, from --avoid
-# - lgpl            true if --lgpl was given, blank otherwise
+# - lgpl            yes or a number if --lgpl was given, blank otherwise
 # - makefile_name   from --makefile-name
 # - libtool         true if --libtool was given, false if --no-libtool was
 #                   given, blank otherwise
@@ -594,6 +613,7 @@ fi
   mode=
   destdir=
   local_gnulib_dir=
+  verbose=0
   libname=libgnu
   supplied_libname=
   sourcebase=
@@ -663,6 +683,12 @@ fi
       --local-dir=* )
         local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
         shift ;;
+      --verbose | --verbos | --verbo | --verb )
+        verbose=`expr $verbose + 1`
+        shift ;;
+      --quiet | --quie | --qui | --qu | --q )
+        verbose=`expr $verbose - 1`
+        shift ;;
       --lib )
         shift
         if test $# = 0; then
@@ -750,7 +776,15 @@ fi
         func_append avoidlist " $arg"
         shift ;;
       --lgpl )
-        lgpl=true
+        lgpl=yes
+        shift ;;
+      --lgpl=* )
+        arg=`echo "X$1" | sed -e 's/^X--lgpl=//'`
+        case "$arg" in
+          2 | 3) ;;
+          *) func_fatal_error "invalid LGPL version number for --lgpl" ;;
+        esac
+        lgpl=$arg
         shift ;;
       --makefile-name )
         shift
@@ -807,7 +841,7 @@ fi
       --help | --hel | --he | --h )
         func_usage
         func_exit $? ;;
-      --version | --versio | --versi | --vers | --ver | --ve | --v )
+      --version | --versio | --versi | --vers )
         func_version
         func_exit $? ;;
       -- )
@@ -1132,6 +1166,7 @@ sed_extract_prog=':[       ]*$/ {
   :a
     n
     s/^Description:[    ]*$//
+    s/^Notice:[         ]*$//
     s/^Files:[  ]*$//
     s/^Depends-on:[     ]*$//
     s/^configure\.ac-early:[    ]*$//
@@ -1156,6 +1191,15 @@ func_get_description ()
   sed -n -e "/^Description$sed_extract_prog" < "$lookedup_file"
 }
 
+# func_get_notice module
+# Input:
+# - local_gnulib_dir  from --local-dir
+func_get_notice ()
+{
+  func_lookup_file "modules/$1"
+  sed -n -e "/^Notice$sed_extract_prog" < "$lookedup_file"
+}
+
 # func_get_filelist module
 # Input:
 # - local_gnulib_dir  from --local-dir
@@ -1178,7 +1222,7 @@ func_get_filelist ()
 func_get_dependencies ()
 {
   # ${module}-tests always implicitly depends on ${module}.
-  echo "$1" | sed -n -e 's/-tests//p'
+  echo "$1" | sed -n -e 's/-tests$//p'
   # Then the explicit dependencies listed in the module description.
   func_lookup_file "modules/$1"
   sed -n -e "/^Depends-on$sed_extract_prog" < "$lookedup_file"
@@ -1212,6 +1256,18 @@ func_get_automake_snippet ()
   case "$1" in
     *-tests)
       # *-tests module live in tests/, not lib/.
+      # Synthesize an EXTRA_DIST augmentation.
+      all_files=`func_get_filelist $1`
+      tests_files=`for f in $all_files; do \
+                     case $f in \
+                       tests/*) echo $f ;; \
+                     esac; \
+                   done | sed -e 's,^tests/,,'`
+      extra_files="$tests_files"
+      if test -n "$extra_files"; then
+        echo "EXTRA_DIST +=" $extra_files
+        echo
+      fi
       ;;
     *)
       # Synthesize an EXTRA_DIST augmentation.
@@ -1434,6 +1490,27 @@ ba
   fi
 }
 
+# func_modules_notice
+# Input:
+# - local_gnulib_dir  from --local-dir
+# - verbose         integer, default 0, inc/decremented by --verbose/--quiet
+# - modules         list of modules, including dependencies
+func_modules_notice ()
+{
+  if test $verbose -ge -1; then
+    for module in $modules; do
+      func_verify_module
+      if test -n "$module"; then
+        msg=`func_get_notice $module`
+        if test -n "$msg"; then
+          echo "Notice from module $module:"
+          echo "$msg" | sed -e 's/^/  /'
+        fi
+      fi
+    done
+  fi
+}
+
 # func_modules_to_filelist
 # Input:
 # - local_gnulib_dir  from --local-dir
@@ -1453,6 +1530,31 @@ func_modules_to_filelist ()
   files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
 }
 
+# func_execute_command command [args...]
+# Executes a command.
+# Uses also the variables
+# - verbose         integer, default 0, inc/decremented by --verbose/--quiet
+func_execute_command ()
+{
+  if test $verbose -ge 0; then
+    echo "executing $*"
+    "$@"
+  else
+    # Commands like automake produce output to stderr even when the succeed.
+    # Turn this output off if the command succeeds.
+    "$@" > "$tmp"/cmdout 2>&1
+    cmdret=$?
+    if test $cmdret = 0; then
+      rm -f "$tmp"/cmdout
+    else
+      echo "executing $*"
+      cat "$tmp"/cmdout 1>&2
+      rm -f "$tmp"/cmdout
+      (exit $cmdret)
+    fi
+  fi
+}
+
 # func_emit_lib_Makefile_am
 # emits the contents of library makefile to standard output.
 # Input:
@@ -1851,29 +1953,44 @@ func_emit_initmacro_end ()
 # func_emit_initmacro_done
 # emits a few statements after the gl_INIT macro to standard output.
 # - macro_prefix    prefix of gl_EARLY, gl_INIT macros to use
+# - sourcebase      directory relative to destdir where to place source code
 func_emit_initmacro_done ()
 {
   echo
   echo "# Like AC_LIBOBJ, except that the module name goes"
   echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
-  echo "AC_DEFUN([${macro_prefix}_LIBOBJ],"
-  echo "  [${macro_prefix}_LIBOBJS=\"\$${macro_prefix}_LIBOBJS \$1.\$ac_objext\"])"
+  echo "AC_DEFUN([${macro_prefix}_LIBOBJ], ["
+  echo "  AS_LITERAL_IF([\$1], [${macro_prefix}_LIBSOURCES([\$1.c])])dnl"
+  echo "  ${macro_prefix}_LIBOBJS=\"\$${macro_prefix}_LIBOBJS \$1.\$ac_objext\""
+  echo "])"
   echo
   echo "# Like AC_REPLACE_FUNCS, except that the module name goes"
   echo "# into ${macro_prefix}_LIBOBJS instead of into LIBOBJS."
-  echo "AC_DEFUN([${macro_prefix}_REPLACE_FUNCS],"
-  echo "  [AC_CHECK_FUNCS([\$1], , [${macro_prefix}_LIBOBJ(\$ac_func)])])"
+  echo "AC_DEFUN([${macro_prefix}_REPLACE_FUNCS], ["
+  echo "  m4_foreach_w([gl_NAME], [\$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl"
+  echo "  AC_CHECK_FUNCS([\$1], , [${macro_prefix}_LIBOBJ(\$ac_func)])"
+  echo "])"
   echo
-  echo "# Like AC_LIBSOURCES, except that it does nothing."
-  echo "# We rely on EXTRA_lib..._SOURCES instead."
-  echo "AC_DEFUN([${macro_prefix}_LIBSOURCES],"
-  echo "  [])"
+  echo "# Like AC_LIBSOURCES, except the directory where the source file is"
+  echo "# expected is derived from the gnulib-tool parametrization,"
+  echo "# and alloca is special cased (for the alloca-opt module)."
+  echo "# We could also entirely rely on EXTRA_lib..._SOURCES."
+  echo "AC_DEFUN([${macro_prefix}_LIBSOURCES], ["
+  echo "  m4_foreach([_gl_NAME], [\$1], ["
+  echo "    m4_if(_gl_NAME, [alloca.c], [], ["
+  echo "      m4_syscmd([test -r $sourcebase/]_gl_NAME[ || test ! -d $sourcebase])dnl"
+  echo "      m4_if(m4_sysval, [0], [],"
+  echo "        [AC_FATAL([missing $sourcebase/]_gl_NAME)])"
+  echo "    ])"
+  echo "  ])"
+  echo "])"
 }
 
 # func_import modules
 # Uses also the variables
 # - destdir         target directory
 # - local_gnulib_dir  from --local-dir
+# - verbose         integer, default 0, inc/decremented by --verbose/--quiet
 # - libname         library name
 # - sourcebase      directory relative to destdir where to place source code
 # - m4base          directory relative to destdir where to place *.m4 macros
@@ -1883,7 +2000,8 @@ func_emit_initmacro_done ()
 # - auxdir          directory relative to destdir where to place build aux files
 # - inctests        true if --with-tests was given, blank otherwise
 # - avoidlist       list of modules to avoid, from --avoid
-# - lgpl            true if library's license shall be LGPL, blank otherwise
+# - lgpl            yes or a number if library's license shall be LGPL,
+#                   blank otherwise
 # - makefile_name   from --makefile-name
 # - libtool         true if --libtool was given, false if --no-libtool was
 #                   given, blank otherwise
@@ -1952,8 +2070,11 @@ func_import ()
       /gl_LIB(/ {
         s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
       }
+      /gl_LGPL(/ {
+        s,^.*gl_LGPL([[ ]*\([^])]*\).*$,cached_lgpl="\1",p
+      }
       /gl_LGPL/ {
-        s,^.*$,cached_lgpl=true,p
+        s,^.*$,cached_lgpl=yes,p
       }
       /gl_MAKEFILE_NAME(/ {
         s,^.*gl_MAKEFILE_NAME([[ ]*\([^])]*\).*$,cached_makefile_name="\1",p
@@ -2091,8 +2212,10 @@ func_import ()
   # Determine final module list.
   modules="$specified_modules"
   func_modules_transitive_closure
-  echo "Module list with included dependencies:"
-  echo "$modules" | sed -e 's/^/  /'
+  if test $verbose -ge 0; then
+    echo "Module list with included dependencies:"
+    echo "$modules" | sed -e 's/^/  /'
+  fi
 
   # Add the dummy module if needed.
   func_modules_add_dummy
@@ -2102,13 +2225,32 @@ func_import ()
     for module in $modules; do
       license=`func_get_license $module`
       case $license in
-        LGPL | LGPLv2+ | 'GPLed build tool') ;;
+        'GPLed build tool') ;;
         'public domain' | 'unlimited' | 'unmodifiable license text') ;;
-        *) func_fatal_error "incompatible license on module $module: $license" ;;
+        *)
+          case "$lgpl" in
+            yes | 3)
+              case $license in
+                LGPL | LGPLv2+) ;;
+                *) func_fatal_error "incompatible license on module $module: $license" ;;
+              esac
+              ;;
+            2)
+              case $license in
+                LGPLv2+) ;;
+                *) func_fatal_error "incompatible license on module $module: $license" ;;
+              esac
+              ;;
+            *) func_fatal_error "invalid value lgpl=$lgpl" ;;
+          esac
+          ;;
       esac
     done
   fi
 
+  # Show banner notice of every module.
+  func_modules_notice
+
   # Determine script to apply to imported library files.
   sed_transform_lib_file=
   for module in $modules; do
@@ -2123,17 +2265,36 @@ func_import ()
   if test -n "$do_copyrights"; then
     if test -n "$lgpl"; then
       # Update license.
+      case "$lgpl" in
+        yes | 3)
+          sed_transform_lib_file=$sed_transform_lib_file'
+            s/GNU General/GNU Lesser General/g
+          '
+          ;;
+        2)
+          sed_transform_lib_file=$sed_transform_lib_file'
+            s/GNU General/GNU Lesser General/g
+            s/version [23]\([ ,]\)/version 2.1\1/g
+          '
+          ;;
+        *) func_fatal_error "invalid value lgpl=$lgpl" ;;
+      esac
+    else
+      # Update license.
       sed_transform_lib_file=$sed_transform_lib_file'
-        s/GNU General/GNU Lesser General/g
-        s/version 2\([ ,]\)/version 2.1\1/g
+        s/GNU Lesser General/GNU General/g
+        s/GNU Library General/GNU General/g
+        s/version \(2\|2\.1\)\([ ,]\)/version 3\2/g
       '
     fi
   fi
 
   # Determine final file list.
   func_modules_to_filelist
-  echo "File list:"
-  echo "$files" | sed -e 's/^/  /'
+  if test $verbose -ge 0; then
+    echo "File list:"
+    echo "$files" | sed -e 's/^/  /'
+  fi
 
   test -n "$files" \
     || func_fatal_error "refusing to do nothing"
@@ -2230,7 +2391,7 @@ func_import ()
   sed_take_first_column='s,'"$delimiter"'.*,,'
   for g in `LC_ALL=C join -t"$delimiter" -v1 "$tmp"/old-files "$tmp"/new-files | sed -e "$sed_take_first_column"`; do
     # Remove the file. Do nothing if the user already removed it.
-    if test -f "$destdir/$g"; then
+    if test -f "$destdir/$g" || test -h "$destdir/$g"; then
       if $doit; then
         echo "Removing file $g (backup in ${g}~)"
         mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
@@ -2359,7 +2520,11 @@ func_import ()
     func_append actioncmd " --avoid=$module"
   done
   if test -n "$lgpl"; then
-    func_append actioncmd " --lgpl"
+    if test "$lgpl" = yes; then
+      func_append actioncmd " --lgpl"
+    else
+      func_append actioncmd " --lgpl=$lgpl"
+    fi
   fi
   if test -n "$makefile_name"; then
     func_append actioncmd " --makefile-name=$makefile_name"
@@ -2497,10 +2662,18 @@ func_import ()
     fi
     # Fetch PO files.
     TP_URL="http://translationproject.org/latest/"
+    TP_RSYNC_URI="translationproject.org::tp/latest/"
     if $doit; then
       echo "Fetching gnulib PO files from $TP_URL"
       (cd "$destdir"/$pobase \
-       && wget --quiet -r -l1 -nd -np -A.po "${TP_URL}gnulib"
+       && { # Prefer rsync over wget if it is available, since it consumes
+            # less network bandwidth, due to compression.
+            if type rsync 2>/dev/null | grep / > /dev/null; then
+              rsync -Lrtz "${TP_RSYNC_URI}gnulib/" .
+            else
+              wget --quiet -r -l1 -nd -np -A.po "${TP_URL}gnulib"
+            fi
+          }
       )
     else
       echo "Fetch gnulib PO files from $TP_URL"
@@ -2573,7 +2746,13 @@ func_import ()
     echo "gl_TESTS_BASE([$testsbase])"
     test -z "$inctests" || echo "gl_WITH_TESTS"
     echo "gl_LIB([$libname])"
-    test -z "$lgpl" || echo "gl_LGPL"
+    if test -n "$lgpl"; then
+      if test "$lgpl" = yes; then
+        echo "gl_LGPL"
+      else
+        echo "gl_LGPL([$lgpl])"
+      fi
+    fi
     echo "gl_MAKEFILE_NAME([$makefile_name])"
     if test "$libtool" = true; then
       echo "gl_LIBTOOL"
@@ -3011,16 +3190,23 @@ func_create_testdir ()
 
   # Determine final module list.
   func_modules_transitive_closure
-  echo "Module list with included dependencies:"
-  echo "$modules" | sed -e 's/^/  /'
+  if test $verbose -ge 0; then
+    echo "Module list with included dependencies:"
+    echo "$modules" | sed -e 's/^/  /'
+  fi
 
   # Add the dummy module if needed.
   func_modules_add_dummy
 
+  # Show banner notice of every module.
+  func_modules_notice
+
   # Determine final file list.
   func_modules_to_filelist
-  echo "File list:"
-  echo "$files" | sed -e 's/^/  /'
+  if test $verbose -ge 0; then
+    echo "File list:"
+    echo "$files" | sed -e 's/^/  /'
+  fi
 
   sed_rewrite_files="\
     s,^build-aux/,$auxdir/,
@@ -3320,24 +3506,18 @@ func_create_testdir ()
    # Do not use "${AUTORECONF} --force --install", because it may invoke
    # autopoint, which brings in older versions of some of our .m4 files.
    if test -f $m4base/gettext.m4; then
-     echo "executing ${AUTOPOINT} --force"
-     ${AUTOPOINT} --force || func_exit 1
+     func_execute_command ${AUTOPOINT} --force || func_exit 1
      for f in $m4base/*.m4~; do
        mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
      done
    fi
-   echo "executing ${ACLOCAL} -I $m4base"
-   ${ACLOCAL} -I $m4base || func_exit 1
+   func_execute_command ${ACLOCAL} -I $m4base || func_exit 1
    if ! test -d build-aux; then
-     echo "executing mkdir build-aux"
-     mkdir build-aux || func_exit 1
+     func_execute_command mkdir build-aux || func_exit 1
    fi
-   echo "executing ${AUTOCONF}"
-   ${AUTOCONF} || func_exit 1
-   echo "executing ${AUTOHEADER}"
-   ${AUTOHEADER} || func_exit 1
-   echo "executing ${AUTOMAKE} --add-missing --copy"
-   ${AUTOMAKE} --add-missing --copy || func_exit 1
+   func_execute_command ${AUTOCONF} || func_exit 1
+   func_execute_command ${AUTOHEADER} || func_exit 1
+   func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
   ) || func_exit 1
   if test -n "$inctests"; then
     # Create autogenerated files.
@@ -3345,24 +3525,18 @@ func_create_testdir ()
      # Do not use "${AUTORECONF} --force --install", because it may invoke
      # autopoint, which brings in older versions of some of our .m4 files.
      if test -f ../$m4base/gettext.m4; then
-       echo "executing ${AUTOPOINT} --force"
-       ${AUTOPOINT} --force || func_exit 1
+       func_execute_command ${AUTOPOINT} --force || func_exit 1
        for f in ../$m4base/*.m4~; do
          mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
        done
      fi
-     echo "executing ${ACLOCAL} -I ../$m4base"
-     ${ACLOCAL} -I ../$m4base || func_exit 1
+     func_execute_command ${ACLOCAL} -I ../$m4base || func_exit 1
      if ! test -d ../build-aux; then
-       echo "executing mkdir ../build-aux"
-       mkdir ../build-aux
+       func_execute_command mkdir ../build-aux
      fi
-     echo "executing ${AUTOCONF}"
-     ${AUTOCONF} || func_exit 1
-     echo "executing ${AUTOHEADER}"
-     ${AUTOHEADER} || func_exit 1
-     echo "executing ${AUTOMAKE} --add-missing --copy"
-     ${AUTOMAKE} --add-missing --copy || func_exit 1
+     func_execute_command ${AUTOCONF} || func_exit 1
+     func_execute_command ${AUTOHEADER} || func_exit 1
+     func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
     ) || func_exit 1
   fi
   # Need to run configure and make once, to create built files that are to be
@@ -3421,7 +3595,12 @@ func_create_megatestdir ()
   func_append megasubdirs "ALL"
 
   # Create autobuild.
-  cvsdate=`sh "$gnulib_dir/build-aux/mdate-sh" "$gnulib_dir/CVS/Entries" \
+  cvsdate=`if test -f "$gnulib_dir/CVS/Entries"; then \
+             vc_witness="$gnulib_dir/CVS/Entries"; \
+           else \
+             vc_witness="$gnulib_dir/.git/refs/heads/master"; \
+           fi; \
+           sh "$gnulib_dir/build-aux/mdate-sh" "$vc_witness" \
              | sed -e 's,January,01,'   -e 's,Jan,01,' \
                    -e 's,February,02,'  -e 's,Feb,02,' \
                    -e 's,March,03,'     -e 's,Mar,03,' \
@@ -3485,14 +3664,10 @@ func_create_megatestdir ()
    # Do not use "${AUTORECONF} --install", because autoreconf operates
    # recursively, but the subdirectories are already finished, therefore
    # calling autoreconf here would only waste lots of CPU time.
-   echo "executing ${ACLOCAL}"
-   ${ACLOCAL} || func_exit 1
-   echo "executing mkdir build-aux"
-   mkdir build-aux
-   echo "executing ${AUTOCONF}"
-   ${AUTOCONF} || func_exit 1
-   echo "executing ${AUTOMAKE} --add-missing --copy"
-   ${AUTOMAKE} --add-missing --copy || func_exit 1
+   func_execute_command ${ACLOCAL} || func_exit 1
+   func_execute_command mkdir build-aux
+   func_execute_command ${AUTOCONF} || func_exit 1
+   func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
   ) || func_exit 1
 }
 
@@ -3712,6 +3887,16 @@ case $mode in
     done
     ;;
 
+  extract-notice )
+    for module
+    do
+      func_verify_module
+      if test -n "$module"; then
+        func_get_notice "$module"
+      fi
+    done
+    ;;
+
   extract-filelist )
     for module
     do