bug-automake
[Top][All Lists]
Advanced

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

bug#13514: [PATCH 2/2] aclocal: fix for more-than-once specified directo


From: Pavel Raiskup
Subject: bug#13514: [PATCH 2/2] aclocal: fix for more-than-once specified directories
Date: Mon, 11 Feb 2013 13:11:52 +0100

Related to automake bug#13514.

Do not explore these directories multiple times in 'aclocal'.  This
causes problems on older packages that specify

    configure.ac:  AC_CONFIG_MACRO_DIRS([m4])
    Makefile.am:   ACLOCAL_AMFLAGS = -I m4

when the m4 directory does not exist.

See:
<http://lists.gnu.org/archive/html/bug-automake/2013-01/msg00115.html>

* aclocal.in (scan_m4_files): Remove duplicities in @user_includes.
* t/aclocal-macrodir.tap: Check whether the multiple specified not
existing primary local macro directory does not break the build.
---
 aclocal.in             | 10 ++++++++++
 t/aclocal-macrodir.tap | 22 +++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/aclocal.in b/aclocal.in
index 8bae156..29be10e 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -419,6 +419,16 @@ sub scan_m4_files ()
 
   if (@user_includes)
     {
+      # Don't explore the same directory multiple times.  This is here not
+      # only for speedup purposes.  We need this when the user has e.g.
+      # specified 'ACLOCAL_AMFLAGS = -I m4' and has also set
+      # AC_CONFIG_MACRO_DIR[S]([m4]) in configure.ac.  This makes the 'm4'
+      # directory to occur twice here and fail on the second call to
+      # scan_m4_dirs([m4]) when the 'm4' directory doesn't exist.
+      # TODO: Shouldn't there be rather a check in scan_m4_dirs for
+      #       @user_includes[0]?
+      @user_includes = uniq @user_includes;
+
       # Don't complain if the first user directory doesn't exist, in case
       # we need to create it later (can happen if '--install' was given).
       my $first_dir_lvl = $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN;
diff --git a/t/aclocal-macrodir.tap b/t/aclocal-macrodir.tap
index 4673d71..bdeb30d 100755
--- a/t/aclocal-macrodir.tap
+++ b/t/aclocal-macrodir.tap
@@ -20,7 +20,7 @@
 am_create_testdir=empty
 . test-init.sh
 
-plan_ 6
+plan_ 7
 
 ocwd=$(pwd) || fatal_ "getting current working directory"
 ACLOCAL_PATH=; unset ACLOCAL_PATH
@@ -177,6 +177,26 @@ test_end
 
 #---------------------------------------------------------------------------
 
+test_begin "AC_CONFIG_MACRO_DIR([not-exist]) and ACLOCAL_AMFLAGS = -I 
not-exist"
+
+cat > configure.ac << 'END'
+AC_INIT([oops], [1.0])
+AC_CONFIG_MACRO_DIR([not-exist])
+END
+
+cat > Makefile.am << 'END'
+ACLOCAL_AMFLAGS = -I not-exist
+END
+
+$ACLOCAL -Wno-error 2>stderr \
+  && cat stderr >&2 \
+  && grep "couldn't open directory 'not-exist'" stderr \
+  || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
 # Avoid spurious failures with pre-2.70 autoconf.
 # FIXME: remove this in automake 1.14, once we require Autoconf 2.70.
 if echo 'AC_INIT AC_CONFIG_MACRO_DIRS' | $AUTOCONF -o/dev/null -; then
-- 
1.7.11.7






reply via email to

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