>From ac4e636a2c726437659c57634fb29b38932b412d Mon Sep 17 00:00:00 2001
From: Pavel Raiskup
Date: Fri, 8 Feb 2013 12:49:30 +0100
Subject: [PATCH 1/3] maint: Warn only if primary -Idir directory does not
exist
Every bootstrapping process which does not need to have the "target" macro
directory existing in version control system (because it does not have any
user-defined macros) would fail during autoreconf -vfi phase if the
AC_CONFIG_MACRO_DIRS([m4]) is specified (to force tools to use 'm4' as
target directory and to instruct aclocal to look into this directory):
autoreconf: Entering directory `.'
autoreconf: running: aclocal --force
aclocal: error: couldn't open directory 'm4': No such file or directory
autoreconf: aclocal failed with exit status: 1
The problem is that when the aclocal is run for the first time during
autoreconf, the directory 'm4' does not exist yet. It will be created by
e.g. by 'libtoolize' later on. During the second run (after libtoolize),
the 'm4' directory exists and aclocal does not complain anything.
For that reason, we degrade the error to warning only (when the --install
option is not passed). The warning is quite useful for running aclocal by
hand - so not removing completely.
See:
* aclocal.in (scan_m4_dirs): Change the $err_on_nonexisting semantic so
that 2 means error now, 1 is warning. Fail or warn only when expected.
(scan_m4_files): Switch passed values 1 ~> 2 to reflect ^^^.
Suggested-by: Ben Pfaff
---
aclocal.in | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/aclocal.in b/aclocal.in
index b51c09d..6fa8eeb 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -359,6 +359,9 @@ sub list_compare (address@hidden@)
# -----------------------------------------------
# Scan all M4 files installed in @DIRS for new macro definitions.
# Register each file as of type $TYPE (one of the FT_* constants).
+# Warn on non-existing include directory when $ERR_ON_NONEXISTING
+# equals to 1, fail without discussion if it equals to 2 and don't
+# complain anyting when it equals to zero.
sub scan_m4_dirs ($$@)
{
my ($type, $err_on_nonexisting, @dirlist) = @_;
@@ -368,8 +371,14 @@ sub scan_m4_dirs ($$@)
if (! opendir (DIR, $m4dir))
{
# TODO: maybe avoid complaining only if errno == ENONENT?
+ my $message = "couldn't open directory '$m4dir': $!";
next unless $err_on_nonexisting;
- fatal "couldn't open directory '$m4dir': $!";
+
+ # fail without discussion for non-"primary" macro directory
+ fatal $message if $err_on_nonexisting == 2;
+ # just a warning for the "primary" directory
+ msg ('unsupported', $message);
+ next
}
# We reverse the directory contents so that foo2.m4 gets
@@ -409,10 +418,10 @@ sub scan_m4_files ()
# 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, 2, @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, 2, @automake_includes);
+ scan_m4_dirs (FT_SYSTEM, 2, @system_includes);
# Construct a new function that does the searching. We use a
# function (instead of just evaluating $search in the loop) so that
--
1.7.11.7