2004-05-15 Alexandre Duret-Lutz <adl@gnu.org>
+ * aclocal.in (add_macro): Do not error out on undefined required
+ macros. We are not sure they are really used, and Autoconf
+ already diagnoses them.
+ (scan_configure_dep): Diagnose missing AM_ macros as warnings rather
+ than errors.
+ * tests/aclocal3.test, tests/ammissing.test: Adjust to expect a
+ warning instead of an error.
+ * tests/aclocal8.test: AC_REQUIRE an undefined macro in an unused
+ macro, and ensure aclocal works anyway.
+ * tests/acloca17.test: New file.
+ * tests/error.test: Delete, superseded by tests/acloca17.test.
+ * tests/Makefile.am (TESTS): Add acloca17.test and remove error.test.
+ Report from Jim Meyering.
+
* lib/am/texibuild.am (?!GENERIC_INFO?%DEST_INFO_PREFIX%%DEST_SUFFIX%):
Fold a few lines to reduce the output by 5 lines.
Suggested by Karl Berry.
endif
liba_la_SOURCES = ...
-* aclocal now ensures that AC_DEFUNs and AU_DEFUNs it discovers are
- really evaluated, before it decides to include them in aclocal.m4.
- This solves nasty problems with conditional redefinitions of
- Autoconf macros in /usr/share/aclocal/*.m4 files causing extraneous
- *.m4 files to be included in any project using these macros.
- (Calls to AC_PROG_EGREP causing libtool.m4 to be included is the
- most famous instance of this bug.)
+* Changes to aclocal:
+
+ - aclocal now ensures that AC_DEFUNs and AU_DEFUNs it discovers are
+ really evaluated, before it decides to include them in aclocal.m4.
+ This solves nasty problems with conditional redefinitions of
+ Autoconf macros in /usr/share/aclocal/*.m4 files causing extraneous
+ *.m4 files to be included in any project using these macros.
+ (Calls to AC_PROG_EGREP causing libtool.m4 to be included is the
+ most famous instance of this bug.)
+
+ - Do not complain about missing conditionally AC_REQUIREd macros
+ that are not actually used. In 1.8.x aclocal would correctly
+ determine which of these macros were really needed (and include
+ only these in the package); unfortunately it would also require
+ all of them to be present in order to run. This created
+ situations were aclocal would not work on a tarball distributing
+ all the macros it uses. For instance running aclocal on a project
+ containing only the subset of the Gettext macros in use by the
+ project did not work, because gettext conditionally requires other
+ macros.
* Diagnose AC_CONFIG_AUX_DIR calls following AM_INIT_AUTOMAKE. (PR/49)
{
local ($macro) = @_;
- # We want to ignore AC_ macros. However, if an AC_ macro is
- # defined in (eg) acinclude.m4, then we want to make sure we mark
- # it as seen.
- return if $macro =~ /^AC_/ && ! defined $map{$macro};
-
- if (! defined $map{$macro})
- {
- warn "aclocal: macro `$macro' required but not defined\n";
- $exit_code = 1;
- return;
- }
+ # Ignore unknown required macros. Either they are not really
+ # needed (e.g., a conditional AC_REQUIRE), in which case aclocal
+ # should be quiet, or they are needed and Autoconf itself will
+ # complain when we trace for macro usage later.
+ return unless defined $map{$macro};
print STDERR "aclocal: saw macro $macro\n" if $verbose;
$macro_seen{$macro} = 1;
if (! &search && /(^|\s+)(AM_[A-Z0-9_]+)($|[^\]\)=A-Z0-9_])/)
{
# Macro not found, but AM_ prefix found.
- warn "aclocal: $file: $line: macro `$2' not found in library\n";
- $exit_code = 1;
+ # Make this just a warning, because we do not know whether
+ # the macro is actually used (it could be called conditionally).
+ warn ("aclocal:$file:$line: warning: "
+ . "macro `$2' not found in library\n");
}
}
acloca14.test \
acloca15.test \
acloca16.test \
+acloca17.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
empty2.test \
empty3.test \
empty4.test \
-error.test \
exdir.test \
exdir2.test \
exeext.test \
acloca14.test \
acloca15.test \
acloca16.test \
+acloca17.test \
acoutnoq.test \
acoutpt.test \
acoutpt2.test \
empty2.test \
empty3.test \
empty4.test \
-error.test \
exdir.test \
exdir2.test \
exeext.test \
#! /bin/sh
-# Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-# Test to make sure error handling in add_file works.
+# Make sure aclocal report unused required macros.
. ./defs || exit 1
-cat > configure.in << 'END'
-AM_ONE_MACRO
-END
+set -e
-# Set up a strange environment, where AM_ONE_MACRO exists but its
-# dependency does not.
-cat > AM_ONE_MACRO.m4 << 'END'
-AC_DEFUN([AM_ONE_MACRO],
-[AC_REQUIRE([AM_NONEXISTENT_MACRO])])
+cat >> configure.in << 'END'
+SOME_DEFS
END
-$ACLOCAL && exit 1
-exit 0
+mkdir m4
+cat >m4/somedefs.m4 <<EOF
+AC_DEFUN([SOME_DEFS], [
+ AC_REQUIRE([UNDEFINED_MACRO])
+])
+EOF
+
+# FIXME: We want autom4te's 'undefined required macro' warning to be fatal,
+# but have no means to say so to aclocal. We use WARNINGS=error instead.
+
+WARNINGS=error $ACLOCAL -I m4 2>stderr && exit 1
+cat stderr
+grep 'configure.in:4:.*UNDEFINED_MACRO' stderr
#! /bin/sh
-# Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
])
END
-$ACLOCAL -I macros && exit 1
-exit 0
+$ACLOCAL -I macros 2>stderr
+cat stderr
+grep 'macros/gnome.m4:2:.*AM_PATH_GTK.*not found' stderr
#! /bin/sh
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
EOF
echo 'AC_DEFUN([MACRO1],)' >m4/macro1.m4
-echo 'AC_DEFUN([MACRO2],)' >m4/macro2.m4
+echo 'AC_DEFUN([MACRO2], [AC_REQUIRE([AM_UNUSED_MACRO])])' >m4/macro2.m4
-$ACLOCAL -I m4
+$ACLOCAL -I m4 >output 2>&1
+cat output
+test 0 = `wc -l <output`
grep macro1.m4 aclocal.m4
grep macro2.m4 aclocal.m4 && exit 1
:
#! /bin/sh
-# Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
echo AM_ZARDOZ >> configure.in
-$ACLOCAL && exit 1
-exit 0
+$ACLOCAL 2>stderr
+cat stderr
+grep 'configure.in:.*AM_ZARDOZ.*not found' stderr