From e579dd9e190b80233f7f398fc0a27bda20e09c0e Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 28 Oct 2001 14:01:41 +0000 Subject: [PATCH] * automake.in (am_primary_prefixes): Now, in accordance with its comment, return the list of prefixes actually used, not all the possible prefixes for a primary. (&handle_libraries, &handle_ltlibraries, &handle_java) (&am_install_var): Adjust. * Makefile.am (maintainer-check): Allow `local $_;'. --- ChangeLog | 9 +++++++++ Makefile.am | 5 +++-- Makefile.in | 3 ++- automake.in | 67 ++++++++++++++++++++++++++----------------------------------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 945d795..72e7cad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2001-10-28 Akim Demaille + * automake.in (am_primary_prefixes): Now, in accordance with its + comment, return the list of prefixes actually used, not all the + possible prefixes for a primary. + (&handle_libraries, &handle_ltlibraries, &handle_java) + (&am_install_var): Adjust. + * Makefile.am (maintainer-check): Allow `local $_;'. + +2001-10-28 Akim Demaille + * automake.in: Various formatting changes. (&variable_defined): Second argument is optional. diff --git a/Makefile.am b/Makefile.am index 994c5a9..23e6b90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -106,8 +106,9 @@ maintainer-check: automake aclocal echo "Don't use \`local' with parens: use several \`local' above." >&2; \ exit 1; \ fi -## Up to now we manage to limit to 1 use of local. - @locals=`grep -c '^[ \t]*local [^*]' $(srcdir)/automake.in`; \ +## Up to now we manage to limit to 1 use of local, but for `local $_;'. + @locals=`grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \ + grep -c '^[ \t]*local [^*]'`; \ case $$locals in \ [0] ) \ echo "Wow, congrats! There are no \`local' now!." >&2; \ diff --git a/Makefile.in b/Makefile.in index 054ef15..a2a80fd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -601,7 +601,8 @@ maintainer-check: automake aclocal echo "Don't use \`local' with parens: use several \`local' above." >&2; \ exit 1; \ fi - @locals=`grep -c '^[ \t]*local [^*]' $(srcdir)/automake.in`; \ + @locals=`grep -v '^[ \t]*local \$$_;' $(srcdir)/automake.in | \ + grep -c '^[ \t]*local [^*]'`; \ case $$locals in \ [0] ) \ echo "Wow, congrats! There are no \`local' now!." >&2; \ diff --git a/automake.in b/automake.in index 5c0a5d3..771f2e7 100755 --- a/automake.in +++ b/automake.in @@ -2598,23 +2598,17 @@ sub handle_libraries 'lib', 'pkglib', 'noinst', 'check'); return if ! @liblist; - my @valid = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib', + my @prefix = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib', 'noinst', 'check'); - if (! defined $configure_vars{'RANLIB'}) - { - foreach my $macro (map { $_ . '_LIBRARIES' } @valid) - { - if (variable_defined ($macro)) - { - macro_error ($macro, - "library used but `RANLIB' not defined in `$configure_ac'"); - # Only get this error once. If this is ever printed, - # we have a bug. - $configure_vars{'RANLIB'} = 'BUG'; - last; - } - } - } + if (! defined $configure_vars{'RANLIB'} + && @prefix) + { + macro_error ($prefix[0] . '_LIBRARIES', + "library used but `RANLIB' not defined in `$configure_ac'"); + # Only get this error once. If this is ever printed, we have + # a bug. + $configure_vars{'RANLIB'} = 'BUG'; + } my $seen_libobjs = 0; foreach my $onelib (@liblist) @@ -2699,14 +2693,11 @@ sub handle_ltlibraries return if ! @liblist; my %instdirs; - my @valid = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib', + my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib', 'noinst', 'check'); - foreach my $key (@valid) + foreach my $key (@prefix) { - next - unless variable_defined ($key . '_LTLIBRARIES'); - if (!$seen_libtool) { macro_error ($key . '_LTLIBRARIES', @@ -4287,24 +4278,21 @@ sub handle_java 'java', 'noinst', 'check'); return if ! @sourcelist; - my @valid = am_primary_prefixes ('JAVA', 1, + my @prefix = am_primary_prefixes ('JAVA', 1, 'java', 'noinst', 'check'); my $dir; - foreach my $curs (@valid) - { - if (! variable_defined ($curs . '_JAVA') || $curs eq 'EXTRA') - { - next; - } + foreach my $curs (@prefix) + { + next + if $curs eq 'EXTRA'; - if (defined $dir) - { - macro_error ($curs . '_JAVA', - "multiple _JAVA primaries in use"); - } + macro_error ($curs . '_JAVA', + "multiple _JAVA primaries in use") + if defined $dir; $dir = $curs; - } + } + push (@all, 'class' . $dir . '.stamp'); } @@ -7292,6 +7280,7 @@ sub am_primary_prefixes ($$@) { my ($primary, $can_dist, @prefixes) = @_; + local $_; my %valid = map { $_ => 0 } @prefixes; $valid{'EXTRA'} = 0; foreach my $varname (keys %var_value) @@ -7329,9 +7318,11 @@ sub am_primary_prefixes ($$@) } } - return sort keys %valid; + # Return only those which are actually defined. + return sort grep { variable_defined ($_ . '_' . $primary) } keys %valid; } + # Handle `where_HOW' variable magic. Does all lookups, generates # install code, and possibly generates code to define the primary # variable. The first argument is the name of the .am file to munge, @@ -7391,7 +7382,7 @@ sub am_install_var # instance, if the variable "zardir" is defined, then # "zar_PROGRAMS" becomes valid. This is to provide a little extra # flexibility in those cases which need it. - my @valid = am_primary_prefixes ($primary, $can_dist, @prefixes); + my @prefix = am_primary_prefixes ($primary, $can_dist, @prefixes); # If a primary includes a configure substitution, then the EXTRA_ # form is required. Otherwise we can't properly do our job. @@ -7404,12 +7395,10 @@ sub am_install_var # True if the iteration is the first one. Used for instance to # output parts of the associated file only once. my $first = 1; - foreach my $X (@valid) + foreach my $X (@prefix) { my $nodir_name = $X; my $one_name = $X . '_' . $primary; - next - unless (variable_defined ($one_name)); my $strip_subdir = 1; # If subdir prefix should be preserved, do so. -- 2.7.4