From 45c12937685ff16691ad6adb843444a2ef4265d7 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Mon, 28 May 2007 15:46:54 +0000
Subject: [PATCH] Remember the presence of the --with-tests command-line option
 through "gnulib-tool --update".

---
 ChangeLog   |  6 ++++++
 gnulib-tool | 17 +++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8f2ab6f98b..0fd5a0b7bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-05-28  Bruno Haible  <bruno@clisp.org>
+
+	* gnulib-tool (func_import): Remember the --with-tests command-line
+	option through the macro gl_WITH_TESTS in the gnulib-cache.m4.
+	Reported by Eric Blake.
+
 2007-05-28  Bruno Haible  <bruno@clisp.org>
 
 	* modules/ftell-tests: New file.
diff --git a/gnulib-tool b/gnulib-tool
index 8c12e06435..72fa60eb66 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2007-04-12 13:02:00 $'
+cvsdatestamp='$Date: 2007-05-28 15:46:55 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 nl='
@@ -1566,6 +1566,7 @@ func_import ()
   cached_m4base=
   cached_docbase=
   cached_testsbase=
+  cached_inctests=
   cached_libname=
   cached_lgpl=
   cached_makefile_name=
@@ -1599,6 +1600,9 @@ func_import ()
       /gl_TESTS_BASE(/ {
         s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p
       }
+      /gl_WITH_TESTS/ {
+        s,^.*$,cached_inctests=true,p
+      }
       /gl_LIB(/ {
         s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
       }
@@ -1687,6 +1691,10 @@ func_import ()
       func_fatal_error "missing --tests-base option"
     fi
   fi
+  # Require the tests if specified either way.
+  if test -z "$inctests"; then
+    inctests="$cached_inctests"
+  fi
   # The libname defaults to the cached one.
   if test -z "$supplied_libname"; then
     libname="$cached_libname"
@@ -1977,6 +1985,9 @@ func_import ()
   func_append actioncmd " --m4-base=$m4base"
   func_append actioncmd " --doc-base=$docbase"
   func_append actioncmd " --aux-dir=$auxdir"
+  if test -n "$inctests"; then
+    func_append actioncmd " --with-tests"
+  fi
   for module in $avoidlist; do
     func_append actioncmd " --avoid=$module"
   done
@@ -2066,6 +2077,7 @@ func_import ()
     echo "gl_M4_BASE([$m4base])"
     echo "gl_DOC_BASE([$docbase])"
     echo "gl_TESTS_BASE([$testsbase])"
+    test -z "$inctests" || echo "gl_WITH_TESTS"
     echo "gl_LIB([$libname])"
     test -z "$lgpl" || echo "gl_LGPL"
     echo "gl_MAKEFILE_NAME([$makefile_name])"
@@ -3080,7 +3092,8 @@ case $mode in
               # Perform func_import in a subshell, so that variable values
               # such as
               #   local_gnulib_dir, avoidlist, sourcebase, m4base, docbase,
-              #   testsbase, libname, lgpl, makefile_name, libtool, macro_prefix
+              #   testsbase, inctests, libname, lgpl, makefile_name, libtool,
+              #   macro_prefix
               # don't propagate from one directory to another.
               (func_import) || func_exit 1
             done
-- 
2.30.2