automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] {maint} Tests: fix requirement of m4 files


From: Stefano Lattarini
Subject: [PATCH] {maint} Tests: fix requirement of m4 files
Date: Fri, 24 Sep 2010 01:00:02 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Hello automakers.

While testing my recent patches, I found a nasty weakness in the 
testsuite (a real weakness this time, not a theoretical one ;-).

When running "make distcheck", *all* the tests requiring libtool are 
skipped, because `tests/defs' looks for the required `libtool.m4' into 
`${prefix}/share/aclocal' (and possibly other dirs mentioned in the 
`dirlist' special file, if it's present in that directory); but during 
"make distcheck", `${prefix}' is set to `$(top_builddir)/_inst', so
no `${prefix}/share/aclocal' exists and no `libtool.m4' can be found.
Ouch.

Incidentally, the same problem can also happen to a user or developer 
having working libtool and automake installations, when he tests a new
automake version configured with ${prefix} != from the prefix of the
pre-existing automake installation.

In fact, this happened to me (my default aclocal program is installed 
from Debian packages, thus with ${prefix} = /usr).  Previously, I had 
hacked around the problem by simply creating a proper hand-written 
`/usr/local/share/aclocal/dirlist' file.  This has been "good enough", 
until I've hit the distcheck issue today, which is IMHO unacceptable.

The attached patch (which has been somewhat tricky to get right!) 
fixes the problem.  Since I consider it a bugfix, I created it for 
maint; this might require some additional tweaking when merging into 
master and tests-init, but that's an acceptable price for keeping 
maint correct IMVHO.

Regards,
  Stefano
From 05d6d441c3bf79e468f8617d153fd675ef23e369 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 24 Sep 2010 00:44:35 +0200
Subject: [PATCH] Tests: fix requirement of m4 files.

When "libtool" was in $required, the testsuite initialization code
in `tests/defs.in' looked for the required `libtool.m4' file into
`${prefix}/share/aclocal' (and possibly other dirs mentioned in
the `dirlist' special file, if it was present in that directory),
to make that m4 file accessible to aclocal.  But this behaviour
was wrong, and worked only by sheer luck.
For example, assume a developer, who has properly working libtool
and automake installations on his system, is testing a newer
automake version, and configures it with a ${prefix} different
from the prefix of his pre-existing automake installation.  Then
the `${prefix}/share/aclocal' directory probably doesn't exist,
thus the libtool.m4 file is not found, and the libtool-requiring
tests are spuriously skipped.
To make thigs even worse, during a "make distcheck" run, ${prefix}
is set to `$(top_builddir)/_inst', so `${prefix}/share/aclocal' is
again non-existent, and the libtool-requiring tests are spuriously
skipped again.
The present change remodies to the just-described problem, and to
similar ones holding when gettext and libtoolize (at least) were
in $required.
* configure.ac (am_AUTOMAKE, am_ACLOCAL): New AC_SUBST's variables,
which can be set to the path of pre-existing respectively aclocal
and automake programs.
* tests/Makefile.am (extra_m4_macros_shell_defs): New variable,
contains paths of generated shell scripts (all following pattern
`m4/*/*-defs.sh') which can be sourced by `tests/defs.in' to help
requiring proper *.m4 files.
($(extra_m4_macros_shell_defs)): New rule.
(clean-local-m4): New clean rule.
(clean-local): Depend on it.
(mostlyclean-local-m4): New clean rule.
(mostlyclean-local): Depend on it.
(check_SCRIPTS): Updated.
* tests/defs.in: Use new generated shell scripts `m4/*/*-defs.sh'
instead of by-hand (incorrect) search to locate and made available
required *.m4 files.
* tests/.gitignore (m4/): New ignored directory.
---
 ChangeLog                      |   41 +++++++++++++++++++++
 Makefile.in                    |    2 +
 configure                      |   13 +++++--
 configure.ac                   |    9 +++--
 doc/Makefile.in                |    2 +
 lib/Automake/Makefile.in       |    2 +
 lib/Automake/tests/Makefile.in |    2 +
 lib/Makefile.in                |    2 +
 lib/am/Makefile.in             |    2 +
 m4/Makefile.in                 |    2 +
 tests/.gitignore               |    1 +
 tests/Makefile.am              |   77 +++++++++++++++++++++++++++++++++++++++-
 tests/Makefile.in              |   75 ++++++++++++++++++++++++++++++++++++---
 tests/defs.in                  |   49 ++++++++++---------------
 14 files changed, 237 insertions(+), 42 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 00b9e4b..aabce51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+2010-09-24  Stefano Lattarini  <address@hidden>
+
+       Tests: fix requirement of m4 files.
+       When "libtool" was in $required, the testsuite initialization code
+       in `tests/defs.in' looked for the required `libtool.m4' file into
+       `${prefix}/share/aclocal' (and possibly other dirs mentioned in
+       the `dirlist' special file, if it was present in that directory),
+       to make that m4 file accessible to aclocal.  But this behaviour
+       was wrong, and worked only by sheer luck.
+       For example, assume a developer, who has properly working libtool
+       and automake installations on his system, is testing a newer
+       automake version, and configures it with a ${prefix} different
+       from the prefix of his pre-existing automake installation.  Then
+       the `${prefix}/share/aclocal' directory probably doesn't exist,
+       thus the libtool.m4 file is not found, and the libtool-requiring
+       tests are spuriously skipped.
+       To make thigs even worse, during a "make distcheck" run, ${prefix}
+       is set to `$(top_builddir)/_inst', so `${prefix}/share/aclocal' is
+       again non-existent, and the libtool-requiring tests are spuriously
+       skipped again.
+       The present change remodies to the just-described problem, and to
+       similar ones holding when gettext and libtoolize (at least) were
+       in $required.
+       * configure.ac (am_AUTOMAKE, am_ACLOCAL): New AC_SUBST's variables,
+       which can be set to the path of pre-existing respectively aclocal
+       and automake programs.
+       * tests/Makefile.am (extra_m4_macros_shell_defs): New variable,
+       contains paths of generated shell scripts (all following pattern
+       `m4/*/*-defs.sh') which can be sourced by `tests/defs.in' to help
+       requiring proper *.m4 files.
+       ($(extra_m4_macros_shell_defs)): New rule.
+       (clean-local-m4): New clean rule.
+       (clean-local): Depend on it.
+       (mostlyclean-local-m4): New clean rule.
+       (mostlyclean-local): Depend on it.
+       (check_SCRIPTS): Updated.
+       * tests/defs.in: Use new generated shell scripts `m4/*/*-defs.sh'
+       instead of by-hand (incorrect) search to locate and made available
+       required *.m4 files.
+       * tests/.gitignore (m4/): New ignored directory.
+
 2010-09-22  Stefano Lattarini  <address@hidden>
 
        Perl modules: remove references to "Automake CVS repository".
diff --git a/Makefile.in b/Makefile.in
index 528b80e..86500d5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -192,8 +192,10 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+am_ACLOCAL = @am_ACLOCAL@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOMAKE = @am_AUTOMAKE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
diff --git a/configure b/configure
index ae88625..6086559 100755
--- a/configure
+++ b/configure
@@ -595,6 +595,8 @@ am__isrc
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
+am_ACLOCAL
+am_AUTOMAKE
 am_AUTOHEADER
 am_AUTOCONF
 build_os
@@ -1764,13 +1766,17 @@ case $build_os in *\ *) build_os=`echo "$build_os" | 
sed 's/ /-/g'`;; esac
 
 
 
-# Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
-# way we can run Autoconf tests from configure (or from the test
-# suite) without being bothered by `missing'.  Likewise for autoheader.
+# Save the AUTOCONF, ACLOCAL etc. settings before AM_INIT_AUTOMAKE
+# overrides them; this way we can run them from configure, make, or
+# the test suite, without being bothered by `missing'.
 am_AUTOCONF="${AUTOCONF-autoconf}"
 
 am_AUTOHEADER="${AUTOHEADER-autoheader}"
 
+am_AUTOMAKE="${AUTOMAKE-automake}"
+
+am_ACLOCAL="${ACLOCAL-aclocal}"
+
 
 am__api_version='1.11'
 
@@ -2408,6 +2414,7 @@ HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"}
 # installation was broken since --version appeared to work.
 
 required_autoconf_version=2.62
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether autoconf is 
installed" >&5
 $as_echo_n "checking whether autoconf is installed... " >&6; }
 if test "${am_cv_autoconf_installed+set}" = set; then :
diff --git a/configure.ac b/configure.ac
index de4583d..dfac907 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,11 +26,13 @@ AC_CONFIG_AUX_DIR(lib)
 
 AC_CANONICAL_BUILD
 
-# Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
-# way we can run Autoconf tests from configure (or from the test
-# suite) without being bothered by `missing'.  Likewise for autoheader.
+# Save the AUTOCONF, ACLOCAL etc. settings before AM_INIT_AUTOMAKE
+# overrides them; this way we can run them from configure, make, or
+# the test suite, without being bothered by `missing'.
 AC_SUBST([am_AUTOCONF], ["${AUTOCONF-autoconf}"])
 AC_SUBST([am_AUTOHEADER], ["${AUTOHEADER-autoheader}"])
+AC_SUBST([am_AUTOMAKE], ["${AUTOMAKE-automake}"])
+AC_SUBST([am_ACLOCAL], ["${ACLOCAL-aclocal}"])
 
 AM_INIT_AUTOMAKE([1.10a dist-bzip2 filename-length-max=99 color-tests 
parallel-tests])
 
@@ -103,6 +105,7 @@ AM_MISSING_PROG([HELP2MAN], [help2man])
 # installation was broken since --version appeared to work.
 
 required_autoconf_version=2.62
+
 AC_CACHE_CHECK([whether autoconf is installed], [am_cv_autoconf_installed],
 [if AM_RUN_LOG([eval $am_AUTOCONF --version]);
 then
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 95a8fb8..a3b2e25 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -159,8 +159,10 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+am_ACLOCAL = @am_ACLOCAL@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOMAKE = @am_AUTOMAKE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index e068ab8..0126f1a 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -179,8 +179,10 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+am_ACLOCAL = @am_ACLOCAL@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOMAKE = @am_AUTOMAKE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 567802b..9c66c50 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -195,8 +195,10 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+am_ACLOCAL = @am_ACLOCAL@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOMAKE = @am_AUTOMAKE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
diff --git a/lib/Makefile.in b/lib/Makefile.in
index f90b085..2c27e24 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -181,8 +181,10 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+am_ACLOCAL = @am_ACLOCAL@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOMAKE = @am_AUTOMAKE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 8924d17..e375d98 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -139,8 +139,10 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+am_ACLOCAL = @am_ACLOCAL@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOMAKE = @am_AUTOMAKE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 270ee91..1663cec 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -139,8 +139,10 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+am_ACLOCAL = @am_ACLOCAL@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOMAKE = @am_AUTOMAKE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
diff --git a/tests/.gitignore b/tests/.gitignore
index 3c1f990..9456529 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,3 +1,4 @@
+m4/
 aclocal-*
 automake-*
 defs
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ba695f5..d4db3ec 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -23,6 +23,80 @@ cond17.test \
 gcj6.test \
 txinfo5.test
 
+# Collect extra m4 files that might be needed by the testsuite.
+# We used to do this in `defs.in', in a much simpler and more naive
+# way, but that proved to be insufficient eventually.
+
+extra_m4_macros_shell_defs = m4/libtool-defs.sh m4/gettext-defs.sh
+
+$(extra_m4_macros_shell_defs): Makefile
+       $(AM_V_GEN)(test -d m4 || mkdir m4) \
+         && rm -f $@ \
+         && tgt=`echo $@ | sed -e 's,.*/,,' -e 's/-defs\.sh$$//'` \
+## Will be meaningully filled up later.
+         && macros='' \
+         && case $$tgt in \
+             libtool) \
+## To bring in libtool.m4
+               macros="$$macros AC_PROG_LIBTOOL"; \
+## To bring in ltdl.m4
+               macros="$$macros AC_WITH_LTDL"; \
+## Should be enough.
+               ;; \
+             gettext) \
+## To bring in gettext.m4
+               macros="$$macros AM_GNU_GETTEXT"; \
+## To bring in intldir.m4
+               macros="$$macros AM_GNU_GETTEXT_INTL_SUBDIR"; \
+## To bring in po.m4
+               macros="$$macros AM_PO_SUBDIRS"; \
+## To bring in iconv.m4
+               macros="$$macros AM_ICONV"; \
+## Should be enough.
+               ;; \
+             *) echo "$@: invalid \$$tgt \`$$tgt"; exit 1;; \
+            esac \
+         && rm -rf m4/$$tgt.tmpdir m4/$$tgt \
+         && mkdir m4/$$tgt.tmpdir \
+         && $(am__cd) m4/$$tgt.tmpdir \
+## The macros considered above might invoked each other, and some
+## of them don't like to be invoked more than once.  Ouch.  So we
+## have use the following trick.
+         && ( : \
+             && echo "AC_INIT" \
+             && echo "AC_DEFUN([_AM_FOO], [" \
+             && for m in $$macros; do \
+                  echo "  AC_REQUIRE([$$m])" || exit 1; \
+                done \
+             && echo "])" \
+             && echo "_AM_FOO" \
+          ) > configure.ac; \
+       $(am_ACLOCAL) -I . --install; \
+       aclocal_status=$$?; \
+       case $$aclocal_status in \
+         0) echo have_$${tgt}_m4=yes;; \
+         *) echo have_$${tgt}_m4=no;; \
+       esac > defs.sh || exit 1; \
+       $(am__cd) '$(abs_builddir)' \
+         && rm -f m4/$$tgt.tmpdir/aclocal.m4 \
+         && mkdir m4/$$tgt \
+         && case $$aclocal_status in \
+              0) mv -f m4/$$tgt.tmpdir/*.m4 m4/$$tgt;; \
+              *) : ;; \
+            esac \
+         && mv -f m4/$$tgt.tmpdir/defs.sh $@ \
+         && rm -rf m4/$$tgt.tmpdir
+
+# Associated cleanup rules.
+clean-local: clean-local-m4
+clean-local-m4:
+       rm -rf m4
+mostlyclean-local: mostlyclean-local-m4
+mostlyclean-local-m4:
+       rm -rf m4/*.tmpdir
+.PHONY: clean-local-m4 mostlyclean-local-m4
+
+
 include $(srcdir)/parallel-tests.am
 
 $(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
@@ -793,7 +867,8 @@ $(parallel_tests)
 EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
 # Each test case depends on defs, aclocal, and automake.
-check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
+check_SCRIPTS = defs $(extra_m4_macros_shell_defs) \
+                aclocal-$(APIVERSION) automake-$(APIVERSION)
 
 clean-local: clean-local-check
 .PHONY: clean-local-check
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 9ea9d74..b7bf9c0 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -200,8 +200,10 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+am_ACLOCAL = @am_ACLOCAL@
 am_AUTOCONF = @am_AUTOCONF@
 am_AUTOHEADER = @am_AUTOHEADER@
+am_AUTOMAKE = @am_AUTOMAKE@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -250,6 +252,11 @@ cond17.test \
 gcj6.test \
 txinfo5.test
 
+
+# Collect extra m4 files that might be needed by the testsuite.
+# We used to do this in `defs.in', in a much simpler and more naive
+# way, but that proved to be insufficient eventually.
+extra_m4_macros_shell_defs = m4/libtool-defs.sh m4/gettext-defs.sh
 parallel_tests = \
 check-p.test \
 check10-p.test \
@@ -1031,7 +1038,9 @@ $(parallel_tests)
 EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
 # Each test case depends on defs, aclocal, and automake.
-check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
+check_SCRIPTS = defs $(extra_m4_macros_shell_defs) \
+                aclocal-$(APIVERSION) automake-$(APIVERSION)
+
 all: all-am
 
 .SUFFIXES:
@@ -1355,7 +1364,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-am
 
-mostlyclean-am: mostlyclean-generic
+mostlyclean-am: mostlyclean-generic mostlyclean-local
 
 pdf: pdf-am
 
@@ -1378,9 +1387,65 @@ uninstall-am:
        install-info install-info-am install-man install-pdf \
        install-pdf-am install-ps install-ps-am install-strip \
        installcheck installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
-       pdf-am ps ps-am recheck recheck-html uninstall uninstall-am
-
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-local pdf pdf-am ps ps-am recheck recheck-html \
+       uninstall uninstall-am
+
+
+$(extra_m4_macros_shell_defs): Makefile
+       $(AM_V_GEN)(test -d m4 || mkdir m4) \
+         && rm -f $@ \
+         && tgt=`echo $@ | sed -e 's,.*/,,' -e 's/-defs\.sh$$//'` \
+         && macros='' \
+         && case $$tgt in \
+             libtool) \
+               macros="$$macros AC_PROG_LIBTOOL"; \
+               macros="$$macros AC_WITH_LTDL"; \
+               ;; \
+             gettext) \
+               macros="$$macros AM_GNU_GETTEXT"; \
+               macros="$$macros AM_GNU_GETTEXT_INTL_SUBDIR"; \
+               macros="$$macros AM_PO_SUBDIRS"; \
+               macros="$$macros AM_ICONV"; \
+               ;; \
+             *) echo "$@: invalid \$$tgt \`$$tgt"; exit 1;; \
+            esac \
+         && rm -rf m4/$$tgt.tmpdir m4/$$tgt \
+         && mkdir m4/$$tgt.tmpdir \
+         && $(am__cd) m4/$$tgt.tmpdir \
+         && ( : \
+             && echo "AC_INIT" \
+             && echo "AC_DEFUN([_AM_FOO], [" \
+             && for m in $$macros; do \
+                  echo "  AC_REQUIRE([$$m])" || exit 1; \
+                done \
+             && echo "])" \
+             && echo "_AM_FOO" \
+          ) > configure.ac; \
+       $(am_ACLOCAL) -I . --install; \
+       aclocal_status=$$?; \
+       case $$aclocal_status in \
+         0) echo have_$${tgt}_m4=yes;; \
+         *) echo have_$${tgt}_m4=no;; \
+       esac > defs.sh || exit 1; \
+       $(am__cd) '$(abs_builddir)' \
+         && rm -f m4/$$tgt.tmpdir/aclocal.m4 \
+         && mkdir m4/$$tgt \
+         && case $$aclocal_status in \
+              0) mv -f m4/$$tgt.tmpdir/*.m4 m4/$$tgt;; \
+              *) : ;; \
+            esac \
+         && mv -f m4/$$tgt.tmpdir/defs.sh $@ \
+         && rm -rf m4/$$tgt.tmpdir
+
+# Associated cleanup rules.
+clean-local: clean-local-m4
+clean-local-m4:
+       rm -rf m4
+mostlyclean-local: mostlyclean-local-m4
+mostlyclean-local-m4:
+       rm -rf m4/*.tmpdir
+.PHONY: clean-local-m4 mostlyclean-local-m4
 
 $(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
        (cd $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@
diff --git a/tests/defs.in b/tests/defs.in
index 1744a07..959e38a 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -324,45 +324,34 @@ unset VERBOSE
 echo "=== Running test $0"
 
 # We might need extra macros, e.g., from Libtool or Gettext.
-# Find them on the system.
-# Use `-I $srcdir/../m4' in addition to `--acdir=$srcdir/../m4', because the
-# other `-I' directories added for libtool and gettext might contain
-# files from an old version of Automake that we don't want to use.
+# Ensure that they have been found on the system, and saved in the local
+# directory `m4'.
 # Use `-Wno-syntax' because we do not want our test suite to fail because
-# some third-party .m4 file is underquoted.
+# some third-party .m4 file is underquoted (FIXME: is this concern still
+# relevant, now that we only bring in libtool's and gettext's m4 files?).
 case $required in
-  *libtool* | *gettext* )
-    aclocaldir='@prefix@/share/aclocal'
-    extra_includes=""
-    if test -f $aclocaldir/dirlist; then
-       extra_includes=`
-       <$aclocaldir/dirlist \
-       sed  's/#.*//;s/[        ][      ]*$//g' \
-       | while read dir; do test ! -d "$dir" || echo "-I $dir"; done`
-    else :; fi
-
-    libtool_found=no
-    gettext_found=no
-    for d in $extra_includes $aclocaldir ; do
-       test "x$d" != x-I || continue
-       if test -f "$d/libtool.m4"; then
-         libtool_found=yes
-       fi
-       if test -f "$d/gettext.m4"; then
-         gettext_found=yes
-       fi
-    done
-    case $required in
-      *libtool* ) test $libtool_found = yes || Exit 77 ;;
-      *gettext* ) test $gettext_found = yes || Exit 77 ;;
-    esac
+  *libtool*)
+    . "$curdir/m4/libtool-defs.sh" || Exit 99
+    test x"$have_libtool_m4" = x"yes" || Exit 77
+    ACLOCAL="$ACLOCAL -Wno-syntax -I $curdir/m4/libtool"
+    ;;
+esac
+case $required in
+  *gettext*)
+    . "$curdir/m4/gettext-defs.sh" || Exit 99
+    test x"$have_gettext_m4" = x"yes" || Exit 77
+    ACLOCAL="$ACLOCAL -Wno-syntax -I $curdir/m4/gettext"
+    ;;
+esac
+
+case $required in
+  *libtool*|*gettext*)
     # Libtool cannot cope with spaces in the build tree.  Our testsuite setup
     # cannot cope with spaces in the source tree name for Libtool and gettext
     # tests.
     case $srcdir,`pwd` in
       *\ * | *\        *) Exit 77 ;;
     esac
-    ACLOCAL="$ACLOCAL -Wno-syntax -I $srcdir/../m4 $extra_includes -I 
$aclocaldir"
     ;;
 esac
 
-- 
1.7.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]