summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-02-21 15:35:04 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-02-21 15:35:04 +0100
commita8933e87ca570f3e710559b12cddad4473525c19 (patch)
tree923aeded098771ed36ca4ba13ce01b157a1e4300
parentb7ac9a37b3c7c78db1ba2beb32cf10bda9db996b (diff)
parent7a3d7cee2b3270443bcd3b91e7e4ada8a1a858a1 (diff)
downloadautomake-a8933e87ca570f3e710559b12cddad4473525c19.tar.gz
Merge branch 'fix-pr13514' into branch-1.13.2
* fix-pr13514: aclocal: fix for more-than-once specified directories aclocal: just warn if the primary local m4 dir doesn't exist (don't error)
-rw-r--r--NEWS7
-rw-r--r--THANKS1
-rw-r--r--aclocal.in56
-rwxr-xr-xt/aclocal-macrodir.tap34
-rwxr-xr-xt/aclocal-macrodirs.tap39
5 files changed, 121 insertions, 16 deletions
diff --git a/NEWS b/NEWS
index 1ea9fa638..81377e104 100644
--- a/NEWS
+++ b/NEWS
@@ -127,6 +127,13 @@ New in 1.13.2:
Automake 1.13, has turned out to be a similarly very bad idea,
for exactly the same reason.
+ - Aclocal no longer error out if the first local m4 directory (as
+ specified by the '-I' option or the 'AC_CONFIG_MACRO_DIRS' or
+ 'AC_CONFIG_MACRO_DIR' macros) doesn't exist; it merely report a
+ warning in the 'unsupported' category. This is done to support
+ some pre-existing real-world usages; refer to automake bug#13514
+ for more details.
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New in 1.13.1:
diff --git a/THANKS b/THANKS
index d591d143d..c8ec3fdef 100644
--- a/THANKS
+++ b/THANKS
@@ -298,6 +298,7 @@ Paul Jarc prj@po.cwru.edu
Paul Lunau temp@lunau.me.uk
Paul Martinolich martinol@datasync.com
Paul Thomas PTHOMAS@novell.com
+Pavel Raiskup praiskup@redhat.com
Pavel Roskin pavel_roskin@geocities.com
Pavel Sanda ps@twin.jikos.cz
Per Bothner bothner@cygnus.com
diff --git a/aclocal.in b/aclocal.in
index 82e903174..078701914 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -165,6 +165,11 @@ my @ac_config_macro_dirs;
# If set, names a temporary file that must be erased on abnormal exit.
my $erase_me;
+# Constants for the $ERR_LEVEL parameter of the 'scan_m4_dirs' function.
+use constant SCAN_M4_DIRS_SILENT => 0;
+use constant SCAN_M4_DIRS_WARN => 1;
+use constant SCAN_M4_DIRS_ERROR => 2;
+
################################################################
# Prototypes for all subroutines.
@@ -355,21 +360,42 @@ sub list_compare (\@\@)
################################################################
-# scan_m4_dirs($TYPE, $ERR_ON_NONEXISTING, @DIRS)
+# scan_m4_dirs($TYPE, $ERR_LEVEL, @DIRS)
# -----------------------------------------------
# Scan all M4 files installed in @DIRS for new macro definitions.
# Register each file as of type $TYPE (one of the FT_* constants).
+# If a directory in @DIRS cannot be read:
+# - fail hard if $ERR_LEVEL == SCAN_M4_DIRS_ERROR
+# - just print a warning if $ERR_LEVEL == SCAN_M4_DIRS_WA
+# - continue silently if $ERR_LEVEL == SCAN_M4_DIRS_SILENT
sub scan_m4_dirs ($$@)
{
- my ($type, $err_on_nonexisting, @dirlist) = @_;
+ my ($type, $err_level, @dirlist) = @_;
foreach my $m4dir (@dirlist)
{
if (! opendir (DIR, $m4dir))
{
# TODO: maybe avoid complaining only if errno == ENONENT?
- next unless $err_on_nonexisting;
- fatal "couldn't open directory '$m4dir': $!";
+ my $message = "couldn't open directory '$m4dir': $!";
+
+ if ($err_level == SCAN_M4_DIRS_ERROR)
+ {
+ fatal $message;
+ }
+ elsif ($err_level == SCAN_M4_DIRS_WARN)
+ {
+ msg ('unsupported', $message);
+ next;
+ }
+ elsif ($err_level == SCAN_M4_DIRS_SILENT)
+ {
+ next; # Silently ignore.
+ }
+ else
+ {
+ prog_error "invalid \$err_level value '$err_level'";
+ }
}
# We reverse the directory contents so that foo2.m4 gets
@@ -406,13 +432,27 @@ 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).
- scan_m4_dirs (FT_USER, !$install, $user_includes[0]);
- scan_m4_dirs (FT_USER, 1, @user_includes[1..$#user_includes]);
+ scan_m4_dirs (FT_USER,
+ $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN,
+ $user_includes[0]);
+ scan_m4_dirs (FT_USER,
+ SCAN_M4_DIRS_ERROR,
+ @user_includes[1..$#user_includes]);
}
- scan_m4_dirs (FT_AUTOMAKE, 1, @automake_includes);
- scan_m4_dirs (FT_SYSTEM, 1, @system_includes);
+ scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes);
+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes);
# Construct a new function that does the searching. We use a
# function (instead of just evaluating $search in the loop) so that
diff --git a/t/aclocal-macrodir.tap b/t/aclocal-macrodir.tap
index 44af05fa9..fb8060968 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
@@ -157,16 +157,44 @@ test_end
#---------------------------------------------------------------------------
-test_begin "AC_CONFIG_MACRO_DIR([non-existent]) errors out (1)"
+test_begin "AC_CONFIG_MACRO_DIR([non-existent]) warns with -Wunsupported"
cat > configure.ac << 'END'
AC_INIT([oops], [1.0])
AC_CONFIG_MACRO_DIR([non-existent])
+AM_INIT_AUTOMAKE
END
-not $ACLOCAL -Wnone 2>stderr \
+$ACLOCAL -Wno-error 2>stderr \
&& cat stderr >&2 \
&& grep "couldn't open directory 'non-existent'" stderr \
+ && test -f aclocal.m4 \
+ || r='not ok'
+
+rm -rf aclocal.m4 autom4te*.cache
+
+$ACLOCAL -Werror -Wno-unsupported \
+ && test -f aclocal.m4 \
+ || r='not ok'
+
+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 \
+ && test $(grep -c "couldn't open directory 'not-exist'" stderr) -eq 1 \
|| r='not ok'
test_end
diff --git a/t/aclocal-macrodirs.tap b/t/aclocal-macrodirs.tap
index ac594bb6a..0898c29ef 100755
--- a/t/aclocal-macrodirs.tap
+++ b/t/aclocal-macrodirs.tap
@@ -20,7 +20,7 @@
am_create_testdir=empty
. test-init.sh
-plan_ 14
+plan_ 15
ocwd=$(pwd) || fatal_ "getting current working directory"
ACLOCAL_PATH=; unset ACLOCAL_PATH
@@ -317,23 +317,31 @@ test_end
#---------------------------------------------------------------------------
-test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (1)"
+test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) warns (1)"
cat > configure.ac << 'END'
AC_INIT([oops], [1.0])
AC_CONFIG_MACRO_DIRS([non-existent])
+AM_INIT_AUTOMAKE
END
-not $ACLOCAL 2>stderr \
+$ACLOCAL -Wno-error 2>stderr \
&& cat stderr >&2 \
&& grep "couldn't open directory 'non-existent'" stderr \
+ && test -f aclocal.m4 \
+ || r='not ok'
+
+rm -rf aclocal.m4 autom4te*.cache
+
+$ACLOCAL -Werror -Wno-unsupported \
+ && test -f aclocal.m4 \
|| r='not ok'
test_end
#---------------------------------------------------------------------------
-test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (2)"
+test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) warns (2)"
cat > configure.ac << 'END'
AC_INIT([oops], [1.0])
@@ -346,13 +354,14 @@ not $ACLOCAL 2>stderr \
&& cat stderr >&2 \
&& grep "couldn't open directory 'dir-ko'" stderr \
&& not grep "dir-ok" stderr \
+ && test ! -e aclocal.m4 \
|| r='not ok'
test_end
#---------------------------------------------------------------------------
-test_begin "AC_CONFIG_MACRO_DIRS([non-existent]) errors out (tricky setup)"
+test_begin "AC_CONFIG_MACRO_DIRS([existent non-existent]) errors out"
cat > configure.ac << 'END'
AC_INIT([oops], [1.0])
@@ -372,6 +381,26 @@ test_end
#---------------------------------------------------------------------------
+test_begin "AC_CONFIG_MACRO_DIRS([not-exist]) and ACLOCAL_AMFLAGS = -I not-exist"
+
+cat > configure.ac << 'END'
+AC_INIT([oops], [1.0])
+AC_CONFIG_MACRO_DIRS([not-exist])
+END
+
+cat > Makefile.am << 'END'
+ACLOCAL_AMFLAGS = -I not-exist
+END
+
+$ACLOCAL -Wno-error 2>stderr \
+ && cat stderr >&2 \
+ && test $(grep -c "couldn't open directory 'not-exist'" stderr) -eq 1 \
+ || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
# Avoid spurious failures with pre-2.70 autoconf.
# FIXME: remove this in automake 2.0, once we require Autoconf 2.70.
if echo 'AC_INIT AC_CONFIG_MACRO_DIRS' | $AUTOCONF -o/dev/null -; then