automake-patches
[Top][All Lists]
Advanced

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

[PATCH 5/6] coverage: expose a bug in aclocal (spurious warnings)


From: Stefano Lattarini
Subject: [PATCH 5/6] coverage: expose a bug in aclocal (spurious warnings)
Date: Sat, 3 Nov 2012 13:36:22 +0100

When some macro expanded in configure.ac calls AC_REQUIRE on another
macro that is defined in one of the local m4 macro dirs specified
with one of the macros AC_CONFIG_MACRO_DIRS or AC_CONFIG_MACRO_DIR,
aclocal prints spurious warnings like:

    configure.ac:4: warning: MY_BAR is m4_require'd but not m4_defun'd
    configure.ac:3: MY_FOO is expanded from...

Expose this weakness in our testsuite.

Reported by Nick Bowler; see point (4) of:
<http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html>

* t/aclocal-macrodir.tap ("AC_CONFIG_MACRO_DIR interaction with
AC_REQUIRE"): New test, still xfailing.
* t/aclocal-macrodirs.tap ("AC_CONFIG_MACRO_DIRS interaction with
AC_REQUIRE"): Likewise.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 t/aclocal-macrodir.tap  | 27 ++++++++++++++++++++++++++-
 t/aclocal-macrodirs.tap | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/t/aclocal-macrodir.tap b/t/aclocal-macrodir.tap
index 4114edb..c48b31f 100755
--- a/t/aclocal-macrodir.tap
+++ b/t/aclocal-macrodir.tap
@@ -20,7 +20,7 @@
 am_create_testdir=empty
 . test-init.sh
 
-plan_ 5
+plan_ 6
 
 ocwd=$(pwd) || fatal_ "getting current working directory"
 ACLOCAL_PATH=; unset ACLOCAL_PATH
@@ -173,4 +173,29 @@ test_end
 
 #---------------------------------------------------------------------------
 
+test_begin "AC_CONFIG_MACRO_DIR interaction with AC_REQUIRE" TODO
+
+cat > configure.ac <<'END'
+AC_INIT([req], [1.0])
+AC_CONFIG_MACRO_DIR([macro-dir])
+AC_DEFUN([MY_FOO], [AC_REQUIRE([MY_BAR])])
+MY_FOO
+END
+
+mkdir macro-dir
+echo 'AC_DEFUN([MY_BAR], [//my//bar//])' > macro-dir/x.m4
+
+st=0; $ACLOCAL 2>stderr || st=$?
+cat stderr >&2
+
+test $st -eq 0 \
+  && test ! -s stderr \
+  && $FGREP 'm4_include([macro-dir/x.m4])' aclocal.m4 \
+  && $AUTOCONF \
+  && not $EGREP 'MY_(FOO|BAR)' configure \
+  && $FGREP '//my//bar//' configure \
+  || r='not ok'
+
+test_end
+
 :
diff --git a/t/aclocal-macrodirs.tap b/t/aclocal-macrodirs.tap
index 81ca75e..3007ed4 100755
--- a/t/aclocal-macrodirs.tap
+++ b/t/aclocal-macrodirs.tap
@@ -26,7 +26,7 @@ am_create_testdir=empty
 END
 } || skip_all_ "autoconf doesn't define the AC_CONFIG_MACRO_DIRS macro"
 
-plan_ 12
+plan_ 13
 
 ocwd=$(pwd) || fatal_ "getting current working directory"
 ACLOCAL_PATH=; unset ACLOCAL_PATH
@@ -341,4 +341,35 @@ test_end
 
 #---------------------------------------------------------------------------
 
+test_begin "AC_CONFIG_MACRO_DIRS interaction with AC_REQUIRE" TODO
+
+cat > configure.ac <<'END'
+AC_INIT([req], [1.0])
+AC_CONFIG_MACRO_DIRS([m1 m2])
+AC_DEFUN([MY_FOO], [
+  AC_REQUIRE([MY_BAR])
+  AC_REQUIRE([MY_BAZ])
+])
+MY_FOO
+END
+
+mkdir m1 m2
+echo 'AC_DEFUN([MY_BAR], [^^my^^bar^^])' > m1/x.m4
+echo 'AC_DEFUN([MY_BAZ], [~~my~~baz~~])' > m2/x.m4
+
+st=0; $ACLOCAL 2>stderr || st=$?
+cat stderr >&2
+
+test $st -eq 0 \
+  && test ! -s stderr \
+  && $FGREP 'm4_include([m1/x.m4])' aclocal.m4 \
+  && $FGREP 'm4_include([m2/x.m4])' aclocal.m4 \
+  && $AUTOCONF \
+  && not $EGREP 'MY_(FOO|BAR|BAZ)' configure \
+  && $FGREP '^^my^^bar^^' configure \
+  && $FGREP '~~my~~baz~~' configure \
+  || r='not ok'
+
+test_end
+
 :
-- 
1.8.0




reply via email to

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