From bce6d3a9a71e92858423a630a1de1432170e5b0e Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Wed, 11 Jan 2006 12:56:40 +0000
Subject: [PATCH] Don't waste time in a recursive autoreconf.

---
 ChangeLog   |  7 +++++++
 gnulib-tool | 21 ++++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5427de848b..45f3b942b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-01-08  Bruno Haible  <bruno@clisp.org>
+
+	* gnulib-tool (AUTOMAKEPATH, AUTOCONF, ACLOCAL, AUTOMAKE): New
+	variables.
+	(func_create_megatestdir): Call aclocal, autoconf, automake here, not
+	autoreconf.
+
 2006-01-11  Bruno Haible  <bruno@clisp.org>
 
 	* gnulib-tool (func_import, func_create_testdir): Replace build-aux
diff --git a/gnulib-tool b/gnulib-tool
index d3f1342357..5195171634 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2006-01-11 12:24:28 $'
+cvsdatestamp='$Date: 2006-01-11 12:56:40 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 
@@ -35,6 +35,12 @@ AUTOCONFPATH=
 #    ;;
 #esac
 
+# You can set AUTOMAKEPATH to empty if automake 1.9.x is already in your PATH.
+AUTOMAKEPATH=
+
+AUTOCONF="${AUTOCONFPATH}autoconf"
+ACLOCAL="${AUTOMAKEPATH}aclocal"
+AUTOMAKE="${AUTOMAKEPATH}automake"
 AUTORECONF="${AUTOCONFPATH}autoreconf"
 
 # func_usage
@@ -1646,8 +1652,17 @@ func_create_megatestdir ()
 
   # Create autogenerated files.
   (cd "$megatestdir"
-   echo "executing ${AUTORECONF} --install"
-   ${AUTORECONF} --install
+   # 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}
+   echo "executing mkdir build-aux"
+   mkdir build-aux
+   echo "executing ${AUTOCONF}"
+   ${AUTOCONF}
+   echo "executing ${AUTOMAKE} --add-missing --copy"
+   ${AUTOMAKE} --add-missing --copy
   )
 }
 
-- 
2.30.2