From 90698c4de3c25f36a595d0e1b1cf498abedaa33b Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 15 May 2004 18:19:57 +0000 Subject: [PATCH] * 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. --- ChangeLog | 14 ++++++++++++++ NEWS | 27 +++++++++++++++++++------- aclocal.in | 22 +++++++++------------ tests/Makefile.am | 2 +- tests/Makefile.in | 2 +- tests/{error.test => acloca17.test} | 30 +++++++++++++++++------------ tests/aclocal3.test | 7 ++++--- tests/aclocal8.test | 8 +++++--- tests/ammissing.test | 7 ++++--- 9 files changed, 76 insertions(+), 43 deletions(-) rename tests/{error.test => acloca17.test} (60%) diff --git a/ChangeLog b/ChangeLog index 785747948..db6ac5f32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2004-05-15 Alexandre Duret-Lutz + * 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. diff --git a/NEWS b/NEWS index eb804a070..93c030d3f 100644 --- a/NEWS +++ b/NEWS @@ -34,13 +34,26 @@ New in 1.8a: 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) diff --git a/aclocal.in b/aclocal.in index 0a07dc6d8..3423841cd 100644 --- a/aclocal.in +++ b/aclocal.in @@ -189,17 +189,11 @@ sub add_macro ($) { 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; @@ -272,8 +266,10 @@ sub scan_configure_dep ($) 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"); } } diff --git a/tests/Makefile.am b/tests/Makefile.am index 760bca1c4..507aae15a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,6 +19,7 @@ acloca13.test \ acloca14.test \ acloca15.test \ acloca16.test \ +acloca17.test \ acoutnoq.test \ acoutpt.test \ acoutpt2.test \ @@ -200,7 +201,6 @@ empty.test \ empty2.test \ empty3.test \ empty4.test \ -error.test \ exdir.test \ exdir2.test \ exeext.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index bb3a32c61..561e60243 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -136,6 +136,7 @@ acloca13.test \ acloca14.test \ acloca15.test \ acloca16.test \ +acloca17.test \ acoutnoq.test \ acoutpt.test \ acoutpt2.test \ @@ -317,7 +318,6 @@ empty.test \ empty2.test \ empty3.test \ empty4.test \ -error.test \ exdir.test \ exdir2.test \ exeext.test \ diff --git a/tests/error.test b/tests/acloca17.test similarity index 60% rename from tests/error.test rename to tests/acloca17.test index 176fb32e0..882b61564 100755 --- a/tests/error.test +++ b/tests/acloca17.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1996, 2002 Free Software Foundation, Inc. +# Copyright (C) 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -18,20 +18,26 @@ # 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 <stderr && exit 1 +cat stderr +grep 'configure.in:4:.*UNDEFINED_MACRO' stderr diff --git a/tests/aclocal3.test b/tests/aclocal3.test index d39e86d75..4c43c3b5e 100755 --- a/tests/aclocal3.test +++ b/tests/aclocal3.test @@ -1,5 +1,5 @@ #! /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. # @@ -31,5 +31,6 @@ AC_DEFUN([GNOME_X_CHECKS], [ ]) 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 diff --git a/tests/aclocal8.test b/tests/aclocal8.test index df68b805e..c4675d3eb 100755 --- a/tests/aclocal8.test +++ b/tests/aclocal8.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -36,9 +36,11 @@ AC_DEFUN([SOME_DEFS], [ 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 > configure.in -$ACLOCAL && exit 1 -exit 0 +$ACLOCAL 2>stderr +cat stderr +grep 'configure.in:.*AM_ZARDOZ.*not found' stderr -- 2.47.2