[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: s/$cygnus_mode/$options{'cygnus'}/
From: |
Alexandre Duret-Lutz |
Subject: |
Re: FYI: s/$cygnus_mode/$options{'cygnus'}/ |
Date: |
Fri, 25 Jul 2003 00:54:15 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:
[...]
adl> I've recently changed most (I thought all) of the %options values to
adl> hold a Locations. Especially, gnu_check_standards uses
adl> $options{'no-installinfo'} as a Location. (Obviously I forgot to
adl> update these $cygnus_mode assignments.) Anyway, wouldn't it look
adl> better to use $options{'cygnus'} like the other options? An option is
adl> turned off if its key does not exist, and otherwise it contains the
adl> Location of its definition. But what is the Location of a command
adl> line option? An empty one?
adl> This patch also introduced a bug. %options is reset for each
adl> file, so any setting done while parsing the command line
adl> argument will be lost. Presently the --cygnus command line
adl> argument is completely ignored.
[...]
This should fix it. It also removes a few more global variables.
Note that I've removed the cygnus => 0 default and changed all
"if ($options{'cygnus'})" to "if (defined $options{'cygnus'})"
because that is more consistent with other %options uses; but on
second thought perhaps we should switch to "if ($options{'foo'})"
everywhere. After all, no legitimate value of $options{'foo'}
can be false except undef. I'll look into this tomorrow.
2003-07-25 Alexandre Duret-Lutz <address@hidden>
Complete changes from 2003-07-08.
* automake.in ($cmdline_use_dependencies, $use_dependencies): Remove,
replaced by $options{'no-dependencies'}.
($global_options): Remove.
(%global_options): New variable.
(initialize_per_input): Empty %options.
(process_option_list): Take a location and %options ref argument,
process no-dependencies as other options.
(handle_options): Do not reparse the global options, just initialize
%options from %global_options and fill it with local options.
(handle_languages, handle_single_transform_list)
(handle_texinfo_helper, handle_configure, do_check_merge_target)
(check_cygnus): Adjust usage of $options{'cygnus'} and
$options{'no-dependencies'}.
(parse_arguments): Set cygnus and no-dependencies in %global_options.
(scan_autoconf_traces) <AM_INIT_AUTOMAKE>: Call process_option_list
to fill %global_options.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1485
diff -u -r1.1485 automake.in
--- automake.in 24 Jul 2003 21:26:54 -0000 1.1485
+++ automake.in 24 Jul 2003 22:51:53 -0000
@@ -287,10 +287,6 @@
# Name of strictness level, as set on command line.
my $default_strictness_name = 'gnu';
-# This is TRUE if automatic dependency generation code should be
-# included in generated Makefile.in.
-my $cmdline_use_dependencies = 1;
-
# From the Perl manual.
my $symlink_exists = (eval 'symlink ("", "");', $@ eq '');
@@ -431,9 +427,6 @@
# should distribute depcomp -- has been generated.)
my $automake_needs_to_reprocess_all_files = 0;
-# Options set via AM_INIT_AUTOMAKE.
-my $global_options = '';
-
# Same as $suffix_rules (declared below), but records only the
# default rules supplied by the languages Automake supports.
my $suffix_rules_default;
@@ -573,12 +566,11 @@
my $strictness;
my $strictness_name;
-# Options from AUTOMAKE_OPTIONS.
-my %options;
-
-# Whether or not dependencies are handled. Can be further changed
-# in handle_options.
-my $use_dependencies;
+# Automake options.
+# Values are the Automake::Location of the definition, except
+# for 'ansi2knr' whose value is a pair [filename, Location].
+my %options; # From AUTOMAKE_OPTIONS
+my %global_options; # From AM_INIT_AUTOMAKE or the command line.
# This is a list of all targets to run during "make dist".
my @dist_targets;
@@ -784,13 +776,7 @@
$strictness = $default_strictness;
$strictness_name = $default_strictness_name;
- %options =
- (
- # TRUE if --cygnus seen.
- 'cygnus' => 0,
- );
-
- $use_dependencies = $cmdline_use_dependencies;
+ %options = ();
@dist_targets = ();
@@ -1174,23 +1160,18 @@
################################################################
# $BOOL
-# process_option_list ($CONFIG, @OPTIONS)
-# ---------------------------------------
+# process_option_list (\%OPTIONS, $WHERE, @OPTIONS)
+# -------------------------------------------------
# Process a list of options. Return 1 on error, 0 otherwise.
-# This is a helper for handle_options. CONFIG is true if we're
-# handling global options.
-sub process_option_list
-{
- my ($config, @list) = @_;
-
- # FIXME: We should disallow conditional definitions of AUTOMAKE_OPTIONS.
- my $where = ($config ?
- $seen_init_automake :
- rvar ('AUTOMAKE_OPTIONS')->rdef (TRUE)->location);
+# \%OPTIONS is the hash to fill with options data, $WHERE is
+# the location where @OPTIONS occured.
+sub process_option_list (\%$@)
+{
+ my ($options, $where, @list) = @_;
foreach (@list)
{
- $options{$_} = $where;
+ $options->{$_} = $where;
if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
{
&set_strictness ($_);
@@ -1200,7 +1181,7 @@
# An option like "../lib/ansi2knr" is allowed. With no
# path prefix, we assume the required programs are in this
# directory. We save the actual option for later.
- $options{'ansi2knr'} = [$_, $where];
+ $options->{'ansi2knr'} = [$_, $where];
}
elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo'
|| $_ eq 'dist-shar' || $_ eq 'dist-zip'
@@ -1211,14 +1192,10 @@
|| $_ eq 'subdir-objects' || $_ eq 'nostdinc'
|| $_ eq 'no-exeext' || $_ eq 'no-define'
|| $_ eq 'std-options'
- || $_ eq 'cygnus')
+ || $_ eq 'cygnus' || $_ eq 'no-dependencies')
{
# Explicitly recognize these.
}
- elsif ($_ eq 'no-dependencies')
- {
- $use_dependencies = 0;
- }
elsif (/^\d+\.\d+(?:\.\d+)?[a-z]?(?:-[A-Za-z0-9]+)?$/)
{
# Got a version number.
@@ -1249,17 +1226,15 @@
# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
sub handle_options
{
- # Process global options first so that more specific options can
- # override.
- if (&process_option_list (1, split (' ', $global_options)))
- {
- return 1;
- }
+ %options = %global_options;
my $var = var ('AUTOMAKE_OPTIONS');
if ($var)
{
- if (&process_option_list (0, $var->value_as_list_recursive (TRUE)))
+ # FIXME: We should disallow conditional definitions of AUTOMAKE_OPTIONS.
+ if (process_option_list (%options,
+ $var->rdef (TRUE)->location,
+ $var->value_as_list_recursive (TRUE)))
{
return 1;
}
@@ -1301,7 +1276,7 @@
# Call finish function for each language that was used.
sub handle_languages
{
- if ($use_dependencies)
+ if (! defined $options{'no-dependencies'})
{
# Include auto-dep code. Don't include it if DEP_FILES would
# be empty.
@@ -1368,10 +1343,9 @@
my $pfx = $lang->autodep;
my $fpfx = ($pfx eq '') ? 'CC' : $pfx;
- my $AMDEP = (($use_dependencies && $lang->autodep ne 'no')
- ? 'AMDEP' : 'FALSE');
- my $FASTDEP = (($use_dependencies && $lang->autodep ne 'no')
- ? ('am__fastdep' . $fpfx) : 'FALSE');
+ my ($AMDEP, $FASTDEP) =
+ (defined $options{'no-dependencies'} || $lang->autodep eq 'no')
+ ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx");
my %transform = ('EXT' => $ext,
'PFX' => $pfx,
@@ -1383,7 +1357,7 @@
=> (count_files_for_language ($lang->name) >
1));
# Generate the appropriate rules for this extension.
- if (($use_dependencies && $lang->autodep ne 'no')
+ if (((! defined $options{'no-dependencies'}) && $lang->autodep ne 'no')
|| defined $lang->compile)
{
# Some C compilers don't support -c -o. Use it only if really
@@ -1987,7 +1961,7 @@
# .deps directory is created.
push (@dep_list,
require_build_directory ($directory . '/$(DEPDIR)'))
- if $use_dependencies;
+ unless defined $options{'no-dependencies'};
}
&pretty_print_rule ($object . ':', "\t", @dep_list)
@@ -3091,7 +3065,7 @@
# Handle location of texinfo.tex.
my $need_texi_file = 0;
my $texinfodir;
- if ($options{'cygnus'})
+ if (defined $options{'cygnus'})
{
$texinfodir = '$(top_srcdir)/../texinfo';
define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL);
@@ -3367,7 +3341,7 @@
# `make dist' isn't used in a Cygnus-style tree.
# Omit the rules so that people don't try to use them.
- return if $options{'cygnus'};
+ return if defined $options{'cygnus'};
# At least one of the archive formats must be enabled.
if ($relative_dir eq '.')
@@ -3707,8 +3681,10 @@
'MAKEFILE-IN' => $infile,
'MAKEFILE-IN-DEPS' => "@include_stack",
'MAKEFILE-AM' => $amfile,
- STRICTNESS => $options{'cygnus'} ? 'cygnus' : $strictness_name,
- 'USE-DEPS' => $cmdline_use_dependencies ? '' : ' --ignore-deps',
+ STRICTNESS => defined ($options{'cygnus'})
+ ? 'cygnus' : $strictness_name,
+ 'USE-DEPS' => defined ($options{'no-dependencies'})
+ ? ' --ignore-deps' : '',
'MAKEFILE-AM-SOURCES' => "$input$colon_infile",
'REGEN-ACLOCAL-M4' => $regen_aclocal_m4,
ACLOCAL_M4_DEPS => "@aclocal_m4_deps");
@@ -4167,7 +4143,7 @@
}
# In --cygnus mode, check doesn't depend on all.
- if ($options{'cygnus'})
+ if (defined $options{'cygnus'})
{
# Just run the local check rules.
pretty_print_rule ('check-am:', "\t\t", @check);
@@ -4676,7 +4652,9 @@
}
elsif (defined $args[1])
{
- $global_options = $args[1];
+ exit $exit_code
+ if (process_option_list (%global_options, $seen_init_automake,
+ split (' ', $args[1])));
}
}
elsif ($macro eq 'AM_MAINTAINER_MODE')
@@ -4775,12 +4753,11 @@
# Set up for Cygnus mode.
sub check_cygnus
{
- return unless $options{'cygnus'};
+ return unless defined $options{'cygnus'};
&set_strictness ('foreign');
$options{'no-installinfo'} = $options{'cygnus'};
$options{'no-dependencies'} = $options{'cygnus'};
- $use_dependencies = 0;
err_ac "`AM_MAINTAINER_MODE' required when --cygnus specified"
if !$seen_maint_mode;
@@ -6202,7 +6179,7 @@
"s/$IGNORE_PATTERN//gm;"
. transform (%transform,
- 'CYGNUS' => $options{'cygnus'},
+ 'CYGNUS' => defined $options{'cygnus'},
'MAINTAINER-MODE'
=> $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '',
@@ -7470,17 +7447,19 @@
sub parse_arguments ()
{
# Start off as gnu.
- &set_strictness ('gnu');
+ set_strictness ('gnu');
+ my $cli_where = new Automake::Location;
my %cli_options =
(
'libdir:s' => \$libdir,
- 'gnu' => sub { &set_strictness ('gnu'); },
- 'gnits' => sub { &set_strictness ('gnits'); },
- 'cygnus' => \$options{'cygnus'},
- 'foreign' => sub { &set_strictness ('foreign'); },
- 'include-deps' => sub { $cmdline_use_dependencies = 1; },
- 'i|ignore-deps' => sub { $cmdline_use_dependencies = 0; },
+ 'gnu' => sub { set_strictness ('gnu'); },
+ 'gnits' => sub { set_strictness ('gnits'); },
+ 'cygnus' => sub { $global_options{'cygnus'} = $cli_where; },
+ 'foreign' => sub { set_strictness ('foreign'); },
+ 'include-deps' => sub { delete $global_options{'no-dependencies'}; },
+ 'i|ignore-deps' => sub { $global_options{'no-dependencies'}
+ = $cli_where; },
'no-force' => sub { $force_generation = 0; },
'f|force-missing' => \$force_missing,
'o|output-dir:s' => \$output_directory,
--
Alexandre Duret-Lutz