sub scan_autoconf_traces
{
my ($filename) = @_;
- local (*TRACES);
+ local *TRACES;
my $traces = "$ENV{amtraces} ";
sub scan_one_autoconf_file
{
my ($filename) = @_;
- local (*CONFIGURE);
+ local *CONFIGURE;
open (CONFIGURE, $filename)
|| die "automake: couldn't open \`$filename': $!\n";
%libsources = ();
# Watchout: these guys need dynamic scope!
- local (%make_list, @make_input_list);
+ local %make_list;
+ local @make_input_list;
warn "automake: both \`configure.ac' and \`configure.in' present:"
. " ignoring \`configure.in'\n"
# check must be done for every run, even those where we are only
# looking at a subdir Makefile. We must set relative_dir so that
# the file-finding machinery works.
- local ($relative_dir) = '.';
+ # Needs dynamic scopes.
+ local $relative_dir = '.';
&require_config_file ($FOREIGN, 'install-sh', 'mkinstalldirs', 'missing');
&am_error ("\`install.sh' is an anachronism; use \`install-sh' instead")
if -f $config_aux_path[0] . '/install.sh';
# Rewrite a single C source file.
sub lang_c_rewrite
{
- local ($directory, $base, $ext) = @_;
+ my ($directory, $base, $ext) = @_;
if (defined $options{'ansi2knr'} && $base =~ /_$/)
{
&am_error ("C source file \`$base.c' would be deleted by ansi2knr rules");
}
- local ($r) = $LANG_PROCESS;
+ my $r = $LANG_PROCESS;
if (defined $options{'subdir-objects'})
{
$r = $LANG_SUBDIR;
{
my ($directory, $base, $ext) = @_;
- local ($r) = &lang_c_rewrite ($directory, $base, $ext);
- local ($pfx) = '';
+ my $r = &lang_c_rewrite ($directory, $base, $ext);
+ my $pfx = '';
if ($r == $LANG_SUBDIR)
{
$pfx = $directory . '/';
{
my ($directory, $base, $ext) = @_;
- local ($r) = $LANG_PROCESS;
- local ($pfx) = '';
+ my $r = $LANG_PROCESS;
+ my $pfx = '';
if (defined $options{'subdir-objects'})
{
$pfx = $directory . '/';
{
my ($directory, $base, $ext) = @_;
- local ($r) = &lang_c_rewrite ($directory, $base, $ext);
- local ($pfx) = '';
+ my $r = &lang_c_rewrite ($directory, $base, $ext);
+ my $pfx = '';
if ($r == $LANG_SUBDIR)
{
$pfx = $directory . '/';
{
my ($directory, $base, $ext) = @_;
- local ($r) = $LANG_PROCESS;
- local ($pfx) = '';
+ my $r = $LANG_PROCESS;
+ my $pfx = '';
if (defined $options{'subdir-objects'})
{
$pfx = $directory . '/';
sub lang_cxx_finish
{
- local ($ltcompile, $ltlink) = &libtool_compiler;
+ my ($ltcompile, $ltlink) = &libtool_compiler;
&define_variable ('CXXLD', '$(CXX)');
&define_variable ('CXXLINK', $ltlink . '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
return if defined $language_scratch{'yacc-done'};
$language_scratch{'yacc-done'} = 1;
- local ($base, $hname, $cname);
- local (%seen_suffix) = ();
- local (@yacc_files) = sort keys %yacc_sources;
- local ($yacc_count) = scalar (@yacc_files);
+ my %seen_suffix = ();
+ my @yacc_files = sort keys %yacc_sources;
+ my $yacc_count = scalar (@yacc_files);
foreach my $file (@yacc_files)
{
$file =~ /(\..*)$/;
$seen_suffix{$1} = 1;
$file =~ /^(.*)\.(y|yy|y\+\+|yxx|ypp)$/;
- $base = $1;
- $hname = 'h'; # Always use `.h' for header file.
- ($cname = $2) =~ tr/y/c/;
+ my $base = $1;
+ my $hname = 'h'; # Always use `.h' for header file.
+ my $cname = $2;
+ $cname =~ tr/y/c/;
if ((&variable_defined ('AM_YFLAGS')
&& &variable_value ('AM_YFLAGS') =~ /(^|\s)-d(\s|$)/)
return if defined $language_scratch{'lex-done'};
$language_scratch{'lex-done'} = 1;
- local (%seen_suffix) = ();
- my $cname;
+ my %seen_suffix = ();
my $lex_count = scalar (keys %lex_sources);
foreach my $file (sort keys %lex_sources)
{
# should be removed by maintainer-clean. So that's what we
# do.
$file =~ /^(.*)\.(l|ll|l\+\+|lxx|lpp)$/;
+ my $cname;
($cname = $2) =~ tr/l/c/;
push (@maintainer_clean_files, "${1}.${cname}");
}
# FIXME: this function can be called more than once. We should
# arrange for it to only do anything the first time through.
- local ($ltcompile, $ltlink) = &libtool_compiler;
+ my ($ltcompile, $ltlink) = &libtool_compiler;
&define_variable ('F77LD', '$(F77)');
- &define_variable ('F77LINK', $ltlink . '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
+ &define_variable ('F77LINK',
+ $ltlink . '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
if (! defined $configure_vars{'F77'})
{
sub lang_objc_finish
{
- local ($ltcompile, $ltlink) = &libtool_compiler;
+ my ($ltcompile, $ltlink) = &libtool_compiler;
&define_variable ('OBJCLD', '$(OBJC)');
&define_variable ('OBJCLINK', $ltlink . '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
sub lang_java_finish
{
- local ($ltcompile, $ltlink) = &libtool_compiler;
+ my ($ltcompile, $ltlink) = &libtool_compiler;
&define_variable ('GCJLD', '$(GCJ)');
&define_variable ('GCJLINK', $ltlink . '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@');
# for compiler and linker.
sub libtool_compiler
{
- local ($ltcompile, $ltlink) = ('', '');
+ my ($ltcompile, $ltlink) = ('', '');
if ($seen_libtool)
{
&define_configure_variable ("LIBTOOL");
# required.
sub resolve_linker
{
- local (%linkers) = @_;
+ my (%linkers) = @_;
return 'GCJLINK'
if defined $linkers{'GCJLINK'};
# Called to indicate that an extension was used.
sub saw_extension
{
- local ($ext) = @_;
+ my ($ext) = @_;
$extension_seen{$ext} = 1;
}
}
else
{
- local (@exts) = &lang_extensions ('header');
+ my @exts = &lang_extensions ('header');
$headers = @exts;
}
# `o' or to some other suffix we recognize internally, eg `cc'.
sub derive_suffix
{
- local ($source_ext) = @_;
+ my ($source_ext) = @_;
# FIXME: hard-coding `o' is a mistake. Doing something
# intelligent is harder.
# Fill length is number of characters. However, each Tab
# character counts for eight. So we count the number of Tabs and
# multiply by 7.
- local ($fill_length) = length ($fill);
+ my $fill_length = length ($fill);
$fill_length += 7 * ($fill =~ tr/\t/\t/d);
- local ($bol) = ($head eq '');
+ my $bol = $head eq '';
foreach (@values)
{
# "71" because we also print a space.
# See if a target exists.
sub target_defined
{
- local ($target) = @_;
+ my ($target) = @_;
return defined $targets{$target};
}
sub variable_conditions
{
my ($var) = @_;
- local (%uniqify);
- local (@uniq_list);
+ my %uniqify;
+ my @uniq_list;
%vars_scanned = ();
foreach my $cond (&variable_conditions_sub ($var, '', ()))
# in @this_conds.
foreach my $this_cond (@this_conds)
{
- local (@perms) =
+ my @perms =
&variable_conditions_permutations (split('@', $this_cond));
foreach my $perm (@perms)
{
# Subroutine for variable_conditions_sort
sub variable_conditions_cmp
{
- local ($as) = $a;
+ my $as = $a;
$as =~ s/[^@]//g;
- local ($bs) = $b;
+ my $bs = $b;
$bs =~ s/[^@]//g;
return (length ($as) <=> length ($bs)
|| $a cmp $b);
# @COND1_TRUE@ are in the list, discard the latter.
sub variable_conditions_reduce
{
- local (@conds) = @_;
- local (@ret) = ();
+ my (@conds) = @_;
+ my @ret = ();
foreach my $cond (sort variable_conditions_cmp @conds)
{
next
# Return a list of permutations of a conditional string.
sub variable_conditions_permutations
{
- local (@comps) = @_;
+ my (@comps) = @_;
return ()
if ! @comps;
- local ($comp) = shift (@comps);
+ my $comp = shift (@comps);
return &variable_conditions_permutations (@comps)
if $comp eq '';
- local ($neg) = $comp;
+ my $neg = $comp;
$neg =~ s/TRUE$/TRUEO/;
$neg =~ s/FALSE$/TRUE/;
$neg =~ s/TRUEO$/FALSE/;
# if the variable is conditionally defined.
sub variable_value
{
- local ($var) = @_;
+ my ($var) = @_;
&variable_conditionally_defined ($var);
return $contents{$var};
}
# version of the command when using libtool.
sub define_compiler_variable
{
- local ($var, $ltcompile, $value) = @_;
- local ($name) = $var;
+ my ($var, $ltcompile, $value) = @_;
+ my $name = $var;
&define_variable ($name, $value);
&define_variable ('LT' . $name, $ltcompile . $value)
if $seen_libtool;
# Cygnus mode. Defaults to PROGRAM.
sub define_program_variable
{
- local ($var, $whatdir, $subdir, $program, $override) = @_;
+ my ($var, $whatdir, $subdir, $program, $override) = @_;
if (! $override)
{
if ($cygnus_mode)
{
- local ($full) = ('$(top_' . $whatdir . 'dir)/../'
- . $subdir . '/' . $program);
+ my $full = ('$(top_' . $whatdir . 'dir)/../'
+ . $subdir . '/' . $program);
&define_variable ($var, ('`if test -f ' . $full
. '; then echo ' . $full . '; else echo '
. $program . '; fi`'));
# user rules to come after our generated stuff.
sub read_am_file
{
- local ($amfile) = @_;
- local (*AM_FILE);
+ my ($amfile) = @_;
+ local *AM_FILE;
open (AM_FILE, $amfile) || die "automake: couldn't open \`$amfile': $!\n";
print "automake: reading $amfile\n" if $verbose;
- local ($saw_bk) = 0;
- local ($was_rule) = 0;
- local ($spacing) = '';
- local ($comment) = '';
- local ($last_var_name) = '';
- local ($blank) = 0;
-
- # We save the conditional stack on entry, and then check to make
- # sure it is the same on exit. This lets us conditonally include
- # other files.
- local (@saved_cond_stack) = @conditional_stack;
+ my $spacing = '';
+ my $comment = '';
+ my $blank = 0;
while (<AM_FILE>)
{
$comment = '';
$spacing = "\n";
- local ($is_ok_macro);
+ # We save the conditional stack on entry, and then check to make
+ # sure it is the same on exit. This lets us conditonally include
+ # other files.
+ my @saved_cond_stack = @conditional_stack;
+
+ my $saw_bk = 0;
+ my $was_rule = 0;
+ my $is_ok_macro;
+ my $last_var_name = '';
while ($_)
{
$_ .= "\n"
# Check the rule for being a suffix rule. If so, store in
# a hash.
- local ($source_suffix);
- local ($object_suffix);
+ my $source_suffix;
+ my $object_suffix;
- if (($source_suffix, $object_suffix) = ($1 =~ $SUFFIX_RULE_PATTERN))
+ if (($source_suffix, $object_suffix)
+ = ($1 =~ $SUFFIX_RULE_PATTERN))
{
$suffix_rules{$source_suffix} = $object_suffix;
- print "Sources ending in .$source_suffix become .$object_suffix\n" if $verbose;
+ print "Sources ending in .$source_suffix become .$object_suffix\n"
+ if $verbose;
$source_suffix_pattern = "(" . join ('|', keys %suffix_rules) . ")";
}
&am_line_error ($1,
"$1 defined both conditionally and unconditionally");
}
- local ($value);
+ my $value;
if ($3 ne '' && substr ($3, -1) eq "\\")
{
# We preserve the `\' because otherwise the long lines
{
$value = $3;
}
- local ($type) = $2;
+ my $type = $2;
if (! defined $contents{$last_var_name})
{
}
elsif (/$INCLUDE_PATTERN/o)
{
- local ($path) = $1;
+ my $path = $1;
if ($path =~ s/^\$\(top_srcdir\)\///)
{
# Read main am file.
sub read_main_am_file
{
- local ($amfile) = @_;
+ my ($amfile) = @_;
# The keys here are variables we want to dump at the end of this
# function. The values are corresponding comments.
- local (%am_vars) = ();
- local (@var_list) = ();
- local (%def_type) = ();
+ # Need dynamic scopes.
+ local %am_vars = ();
+ local @var_list = ();
+ local %def_type = ();
# This supports the strange variable tricks we are about to play.
&prog_error ("variable defined before read_main_am_file")
# First pass.
&define_standard_variables;
- local (%saved_contents) = %contents;
+ my %saved_contents = %contents;
# Read user file, but discard text of variable assignments we just
# made.
# Swallow into $CONTENTS the whole content of the file, after
# having performed the $COMMAND, and removed Automake comments.
- local ($contents) = '';
+ my $contents = '';
while (<FC_FILE>)
{
# 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.
- local (%valid) = &am_primary_prefixes ($primary, $can_dist, @prefixes);
+ my %valid = &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.
}
else
{
- local ($condvals) = '';
+ my $condvals = '';
foreach my $cond (@conds)
{
my @one_binlist = ();
while (@condvals)
{
$cond = shift (@condvals);
- local (@val) = split (' ', shift (@condvals));
+ my @val = split (' ', shift (@condvals));
&define_pretty_variable ($one_name, $cond, @val);
}
}
sub is_make_dir
{
- local ($dir) = @_;
+ my ($dir) = @_;
if (! $make_dirs_set)
{
foreach my $iter (@configure_input_files)
# encodes the rules for deciding when to do so.
sub maybe_push_required_file
{
- local ($dir, $file, $fullfile) = @_;
+ my ($dir, $file, $fullfile) = @_;
# FIXME: Once again, special-case `.'.
if ($dir eq $relative_dir || $dir eq '.')
unlink ($fullfile);
}
- local ($trailer) = '';
- local ($suppress) = 0;
+ my $trailer = '';
+ my $suppress = 0;
# Only install missing files according to our desired
# strictness level.
- local ($message) = "required file \`$errfile' not found";
+ my $message = "required file \`$errfile' not found";
if ($add_missing)
{
$suppress = 1;
# Maybe run libtoolize.
- local @syslist = ('libtoolize', '--automake');
+ my @syslist = ('libtoolize', '--automake');
push @syslist, '--copy'
if $copy_missing;
if ($seen_libtool
$file, $errfile);
}
- local ($save) = $exit_status;
+ my $save = $exit_status;
if ($is_configure)
{
# FIXME: allow actual file to be specified.
{
@require_file_paths = @config_aux_path;
&require_file_internal (1, '', @_);
- local ($dir) = $require_file_paths[0];
+ my $dir = $require_file_paths[0];
@config_aux_path = @require_file_paths;
if ($dir eq '.')
{
{
@require_file_paths = @config_aux_path;
&require_file_internal (0, @_);
- local ($dir) = $require_file_paths[0];
+ my $dir = $require_file_paths[0];
@config_aux_path = @require_file_paths;
if ($dir eq '.')
{
{
@require_file_paths = @config_aux_path;
&require_file_internal (1, @_);
- local ($dir) = $require_file_paths[0];
+ my $dir = $require_file_paths[0];
@config_aux_path = @require_file_paths;
if ($dir eq '.')
{
# Ensure a file exists.
sub create
{
- local ($file) = @_;
+ my ($file) = @_;
open (TOUCH, ">> $file");
close (TOUCH);
# want to glob. Gross!
sub my_glob
{
- local ($pat) = @_;
+ my ($pat) = @_;
return <${pat}>;
}
sub am_line_error
{
- local ($symbol, @args) = @_;
+ my ($symbol, @args) = @_;
if ($symbol && "$symbol" ne '-1')
{
- local ($file) = "${am_file}.am";
+ my $file = "${am_file}.am";
if ($symbol =~ /^\d+$/)
{
# Error message with line number referring to configure.ac.
sub am_conf_line_error
{
- local ($file, $line, @args) = @_;
+ my ($file, $line, @args) = @_;
if ($line)
{
# Does not affect exit_status
sub am_conf_line_warning
{
- local ($saved_exit_status) = $exit_status;
+ my $saved_exit_status = $exit_status;
&am_conf_line_error (@_);
$exit_status = $saved_exit_status;
}
# Tell user where our aclocal.m4 is, but only once.
sub keyed_aclocal_warning
{
- local ($key) = @_;
+ my ($key) = @_;
warn "automake: macro \`$key' can be generated by \`aclocal'\n";
}
--force-missing force update of standard files
EOF
- print "\nFiles which are automatically distributed, if found:\n";
- $~ = "USAGE_FORMAT";
my ($last, @lcomm);
$last = '';
foreach my $iter (sort ((@common_files, @common_sometimes)))
$last = $iter;
}
- local ($one, $two, $three, $four, $i, $max);
+ my ($one, $two, $three, $four, $max);
+ print "\nFiles which are automatically distributed, if found:\n";
+ format USAGE_FORMAT =
+ @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<
+ $one, $two, $three, $four
+.
+ $~ = "USAGE_FORMAT";
$max = int (($#lcomm + 1) / 4);
- for ($i = 0; $i < $max; ++$i)
+ for (my $i = 0; $i < $max; ++$i)
{
$one = $lcomm[$i];
$two = $lcomm[$max + $i];
write;
}
- local ($mod) = ($#lcomm + 1) % 4;
+ my $mod = ($#lcomm + 1) % 4;
if ($mod != 0)
{
$one = $lcomm[$max];
exit 0;
}
-
-format USAGE_FORMAT =
- @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<
- $one, $two, $three, $four
-.