Subject: bug#12786: [PATCH 0/2] AC_CONFIG_MACRO_DIRS: implementation and documentation

From: Stefano Lattarini <[email-masked]>
Date: Fri, 02 Nov 2012 10:50:34 +0100

[+cc: automake-patches, bug-libtool]
[re-sending because delivery to automake and autoconf lists failed]

References:
<http://lists.gnu.org/archive/html/autoconf-patches/2012-10/msg00007.html>
<http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html>

On 11/01/2012 07:05 PM, Nick Bowler wrote:
> Hi Stefano, sorry for the delay.
>
Hi Nick, and thanks for the testing.

> On 2012-10-31 11:03 +0100, Stefano Lattarini wrote:
>> On 10/23/2012 12:59 AM, Nick Bowler wrote:
>>> I am going to try all these patches to automake/autoconf/libtool soon; I
>>> will report back with the results!
>>>
>> Has anybody had a chance to try these patches?  If not, does anyone
>> object to the idea of committing them anyway, and see how things work
>> out?  It doesn't seem we're near to a release, so there's ample time
>> to revert these changes before cutting Autoconf 2.70, in case they
>> won't work as expected, or will reveal unforeseen issues.
> I got a chance to try these.  I applied the patches on top of latest git
> autoconf and automake, as of today, and also checked out latest git
> libtool.
>
> I tried converting a package to use these, which originally had
> ACLOCAL_AMFLAGS = -I m4 -I common/m4.  I removed the ACLOCAL_AMFLAGS
> from Makefile.am and added AC_CONFIG_MACRO_DIRS([m4 common/m4]) to
> configure.ac.  Here are some initial observations:
>
> 1) Newlines can be used to separate items in AC_CONFIG_FILES, etc.
>    However, aclocal explodes if you try to do this with
>    AC_CONFIG_MACRO_DIRS:
>
>      Use of uninitialized value $macro in exists at /tmp/autotools-test/bin/aclocal line 753, <GEN40> line 2.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 755, <GEN40> line 2.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 755, <GEN40> line 2.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 755, <GEN40> line 2.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 760, <GEN40> line 2.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 764, <GEN40> line 2.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 768, <GEN40> line 2.
>      Use of uninitialized value $macro in exists at /tmp/autotools-test/bin/aclocal line 753, <GEN82> line 3.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 755, <GEN82> line 3.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 755, <GEN82> line 3.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 755, <GEN82> line 3.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 760, <GEN82> line 3.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 764, <GEN82> line 3.
>      Use of uninitialized value $macro in string eq at /tmp/autotools-test/bin/aclocal line 768, <GEN82> line 3.
>
>    This strikes me as extremely odd because the output
>    of autoconf --trace AC_CONFIG_MACRO_DIRS is the same
>    in either case.
>
I can reproduce the problem.  The patch below enhances the automake
testsuite in order to catch it.  I hope I'll be able to come up with
a fix soon enough.

> 2) Git libtool seems broken, as libtoolize is deleting files installed
>    by gnulib-tool into the snippet directory.  This breaks the build.
>    I suspect the problem is unrelated to the AC_CONFIG_MACRO_DIRS
>    change, but git libtool was required to test it.
>
> 3) Libtoolize still complains that ACLOCAL_AMFLAGS is not set in
>    Makefile.am, but the warning seems harmless and it nevertheless
>    prints that it has picked up AC_CONFIG_MACRO_DIRS.
>
I believe these issues should be reported to the libtool developers,
so I've added the bug-libtool list in CC:.

> 4) I get a bunch of new warnings from aclocal, of the form:
>
>      configure.ac:42: warning: DX_EXPORTED_SH is m4_require'd but not m4_defun'd
>
>    The invocation comes from an AC_REQUIRE([DX_EXPORTED_SH]) and the
>    DX_EXPORTED_SH macro is expected to be picked up by aclocal -- it is,
>    and things seem to work in the end, but the warnings are annoying
>    (and are printed multiple times).
>
And you say they weren't there before these series?  Or is this regression
already present in master?  I'll investigate.

> Other than requiring a manual workaround for item #2, everything seems
> to be working at a first glance.  I can cook up some test cases for
> these issues if necessary.
>
For the automake part, there should be no need of test cases: your
description is clear and precise enough that I can cook up some myself,
and that will save hassles with copyright issues and assignment forms.

> These all look like fixable problems to me.
>
> Cheers,
Thanks again,
  Stefano

---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

>From 5716ef6d6483183721ef47dbba1b9bbf142ee2d9 Mon Sep 17 00:00:00 2001
Message-Id: <5716ef6d6[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Fri, 2 Nov 2012 10:09:36 +0100
Subject: [PATCH] tests: better coverage for AC_CONFIG_MACRO_DIRS

Suggested by a report from Nick Bowler:
<http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00000.html>

* t/aclocal-macrodirs.sh: Enhance to check use of extra whitespaces
and newline characters in the arguments to AC_CONFIG_MACRO_DIRS.  Other
minor edits, enhancements, and simplification.

Signed-off-by: Stefano Lattarini <[email-masked]>
---
 t/aclocal-macrodirs.tap | 53 ++++++++++++++++++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 18 deletions(-)

diff --git a/t/aclocal-macrodirs.tap b/t/aclocal-macrodirs.tap
index a0eeb96..00d2359 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_ 11
+plan_ 12

 ocwd=$(pwd) || fatal_ "getting current working directory"
 ACLOCAL_PATH=; unset ACLOCAL_PATH
@@ -99,23 +99,21 @@ test_end

 #---------------------------------------------------------------------------

-two_dirs_check ()
+three_dirs_check ()
 {
-  if test $have_macrodirs = no; then
-    directive=SKIP
-    reason='AC_CONFIG_MACRO_DIRS not supported'
-    return
-  fi
-  mkdir sys-dir dir1 dir2
+  mkdir dir1 dir2 dir3
   echo 'AC_DEFUN([MY_FOO], [::my::foo::])' > dir1/foo.m4
   echo 'AC_DEFUN([MY_BAR], [!!my!!bar!!])' > dir2/zap.m4
+  echo 'AC_DEFUN([MY_BAZ], [==my==baz==])' > dir3/0.m4
   $ACLOCAL \
     && $FGREP 'm4_include([dir1/foo.m4])' aclocal.m4 \
     && $FGREP 'm4_include([dir2/zap.m4])' aclocal.m4 \
+    && $FGREP 'm4_include([dir3/0.m4])'   aclocal.m4 \
     && $AUTOCONF \
-    && not $EGREP 'MY_(FOO|BAR)' configure \
+    && not $EGREP 'MY_(FOO|BAR|BAZ)' configure \
     && $FGREP '::my::foo::' configure \
     && $FGREP '!!my!!bar!!' configure \
+    && $FGREP '==my==baz==' configure \
     || r='not ok'
 }

@@ -125,12 +123,13 @@ test_begin "AC_CONFIG_MACRO_DIRS: several arguments"

 cat > configure.ac <<'END'
 AC_INIT([more-args], [0.2])
-AC_CONFIG_MACRO_DIRS([dir1 dir2])
+AC_CONFIG_MACRO_DIRS([dir1 dir2 dir3])
 MY_FOO
 MY_BAR
+MY_BAZ
 END

-two_dirs_check
+three_dirs_check

 test_end

@@ -141,12 +140,35 @@ test_begin "AC_CONFIG_MACRO_DIRS: several calls"
 cat > configure.ac <<'END'
 AC_INIT([more-calls], [2.0])
 AC_CONFIG_MACRO_DIRS([dir1])
-AC_CONFIG_MACRO_DIRS([dir2])
+AC_CONFIG_MACRO_DIRS([dir2 dir3])
+MY_FOO
+MY_BAR
+MY_BAZ
+END
+
+three_dirs_check
+
+test_end
+
+#---------------------------------------------------------------------------
+
+test_begin "AC_CONFIG_MACRO_DIRS: extra whitespace"
+
+bslash=\\
+
+cat > configure.ac <<END
+AC_INIT([more-args], [0.2])
+AC_CONFIG_MACRO_DIRS([   dir1${bslash}
+${tab} dir2   ${tab}${tab}dir3
+${bslash}
+
+])
 MY_FOO
 MY_BAR
+MY_BAZ
 END

-two_dirs_check
+three_dirs_check

 test_end

@@ -174,11 +196,6 @@ test_end

 two_dirs_install_check ()
 {
-  if test $have_macrodirs = no; then
-    directive=SKIP
-    reason='AC_CONFIG_MACRO_DIRS not supported'
-    return
-  fi
   mkdir sys-dir dir1 dir2
   echo 'AC_DEFUN([THE_MACRO], [:])' > sys-dir/my.m4
   echo 'AC_DEFUN([AX_FOO], [:])' > dir2/zap.m4
--
1.8.0