Merge branch 'micro' into maint
[platform/upstream/automake.git] / bin / automake.in
similarity index 91%
rename from automake.in
rename to bin/automake.in
index 835d3bd..283d1bb 100644 (file)
@@ -25,7 +25,9 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
 # Perl reimplementation by Tom Tromey <tromey@redhat.com>, and
 # Alexandre Duret-Lutz <adl@gnu.org>.
 
-package Language;
+package Automake;
+
+use strict;
 
 BEGIN
 {
@@ -43,93 +45,6 @@ BEGIN
   $ENV{'SHELL'} = '@SHELL@' if exists $ENV{'DJDIR'};
 }
 
-use Class::Struct ();
-Class::Struct::struct (
-       # Short name of the language (c, f77...).
-       'name' => "\$",
-       # Nice name of the language (C, Fortran 77...).
-       'Name' => "\$",
-
-       # List of configure variables which must be defined.
-       'config_vars' => '@',
-
-       # 'pure' is '1' or ''.  A 'pure' language is one where, if
-       # all the files in a directory are of that language, then we
-       # do not require the C compiler or any code to call it.
-       'pure'   => "\$",
-
-       'autodep' => "\$",
-
-       # Name of the compiling variable (COMPILE).
-       'compiler'  => "\$",
-       # Content of the compiling variable.
-       'compile'  => "\$",
-       # Flag to require compilation without linking (-c).
-       'compile_flag' => "\$",
-       'extensions' => '@',
-       # A subroutine to compute a list of possible extensions of
-       # the product given the input extensions.
-       # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
-       'output_extensions' => "\$",
-       # A list of flag variables used in 'compile'.
-       # (defaults to [])
-       'flags' => "@",
-
-       # Any tag to pass to libtool while compiling.
-       'libtool_tag' => "\$",
-
-       # The file to use when generating rules for this language.
-       # The default is 'depend2'.
-       'rule_file' => "\$",
-
-       # Name of the linking variable (LINK).
-       'linker' => "\$",
-       # Content of the linking variable.
-       'link' => "\$",
-
-       # Name of the compiler variable (CC).
-       'ccer' => "\$",
-
-       # Name of the linker variable (LD).
-       'lder' => "\$",
-       # Content of the linker variable ($(CC)).
-       'ld' => "\$",
-
-       # Flag to specify the output file (-o).
-       'output_flag' => "\$",
-       '_finish' => "\$",
-
-       # This is a subroutine which is called whenever we finally
-       # determine the context in which a source file will be
-       # compiled.
-       '_target_hook' => "\$",
-
-       # If TRUE, nodist_ sources will be compiled using specific rules
-       # (i.e. not inference rules).  The default is FALSE.
-       'nodist_specific' => "\$");
-
-
-sub finish ($)
-{
-  my ($self) = @_;
-  if (defined $self->_finish)
-    {
-      &{$self->_finish} (@_);
-    }
-}
-
-sub target_hook ($$$$%)
-{
-    my ($self) = @_;
-    if (defined $self->_target_hook)
-    {
-       &{$self->_target_hook} (@_);
-    }
-}
-
-package Automake;
-
-use strict;
 use Automake::Config;
 BEGIN
 {
@@ -156,10 +71,18 @@ use Automake::VarDef;
 use Automake::Rule;
 use Automake::RuleDef;
 use Automake::Wrap 'makefile_wrap';
+use Automake::Language;
 use File::Basename;
 use File::Spec;
 use Carp;
 
+## ----------------------- ##
+## Subroutine prototypes.  ##
+## ----------------------- ##
+
+#! Prototypes here will automatically be generated by the build system.
+
+
 ## ----------- ##
 ## Constants.  ##
 ## ----------- ##
@@ -341,7 +264,7 @@ my %ac_config_files_location = ();
 my %ac_config_files_condition = ();
 
 # Directory to search for configure-required files.  This
-# will be computed by &locate_aux_dir and can be set using
+# will be computed by locate_aux_dir() and can be set using
 # AC_CONFIG_AUX_DIR in configure.ac.
 # $CONFIG_AUX_DIR is the 'raw' directory, valid only in the source-tree.
 my $config_aux_dir = '';
@@ -387,9 +310,6 @@ my $package_version_location;
 # TRUE if we've seen AM_PROG_AR
 my $seen_ar = 0;
 
-# TRUE if we've seen AM_PROG_CC_C_O
-my $seen_cc_c_o = 0;
-
 # Location of AC_REQUIRE_AUX_FILE calls, indexed by their argument.
 my %required_aux_file = ();
 
@@ -609,7 +529,7 @@ my %am_file_cache;
 # macro_define() call because SUFFIXES definitions impact
 # on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing
 # the input am file.
-sub var_SUFFIXES_trigger ($$)
+sub var_SUFFIXES_trigger
 {
     my ($type, $value) = @_;
     accept_extensions (split (' ', $value));
@@ -618,16 +538,9 @@ Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
 
 ################################################################
 
-## --------------------------------- ##
-## Forward subroutine declarations.  ##
-## --------------------------------- ##
-sub register_language (%);
-sub file_contents_internal ($$$%);
-sub define_files_variable ($\@$$);
 
-
-# &initialize_per_input ()
-# ------------------------
+# initialize_per_input ()
+# -----------------------
 # (Re)-Initialize per-Makefile.am variables.
 sub initialize_per_input ()
 {
@@ -696,6 +609,15 @@ sub initialize_per_input ()
 
 # Initialize our list of languages that are internally supported.
 
+my @cpplike_flags =
+  qw{
+    $(DEFS)
+    $(DEFAULT_INCLUDES)
+    $(INCLUDES)
+    $(AM_CPPFLAGS)
+    $(CPPFLAGS)
+  };
+
 # C.
 register_language ('name' => 'c',
                   'Name' => 'C',
@@ -704,12 +626,13 @@ register_language ('name' => 'c',
                   'flags' => ['CFLAGS', 'CPPFLAGS'],
                   'ccer' => 'CC',
                   'compiler' => 'COMPILE',
-                  'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
+                  'compile' => "\$(CC) @cpplike_flags \$(AM_CFLAGS) \$(CFLAGS)",
                   'lder' => 'CCLD',
                   'ld' => '$(CC)',
                   'linker' => 'LINK',
                   'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'compile_flag' => '-c',
+                  'output_flag' => '-o',
                   'libtool_tag' => 'CC',
                   'extensions' => ['.c']);
 
@@ -721,7 +644,7 @@ register_language ('name' => 'cxx',
                   'link' => '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'CXX',
                   'flags' => ['CXXFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
+                  'compile' => "\$(CXX) @cpplike_flags \$(AM_CXXFLAGS) \$(CXXFLAGS)",
                   'ccer' => 'CXX',
                   'compiler' => 'CXXCOMPILE',
                   'compile_flag' => '-c',
@@ -740,7 +663,7 @@ register_language ('name' => 'objc',
                   'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'OBJC',
                   'flags' => ['OBJCFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
+                  'compile' => "\$(OBJC) @cpplike_flags \$(AM_OBJCFLAGS) \$(OBJCFLAGS)",
                   'ccer' => 'OBJC',
                   'compiler' => 'OBJCCOMPILE',
                   'compile_flag' => '-c',
@@ -758,7 +681,7 @@ register_language ('name' => 'objcxx',
                   'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'OBJCXX',
                   'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)',
+                  'compile' => "\$(OBJCXX) @cpplike_flags \$(AM_OBJCXXFLAGS) \$(OBJCXXFLAGS)",
                   'ccer' => 'OBJCXX',
                   'compiler' => 'OBJCXXCOMPILE',
                   'compile_flag' => '-c',
@@ -776,7 +699,7 @@ register_language ('name' => 'upc',
                   'link' => '$(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'UPC',
                   'flags' => ['UPCFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)',
+                  'compile' => "\$(UPC) @cpplike_flags \$(AM_UPCFLAGS) \$(UPCFLAGS)",
                   'ccer' => 'UPC',
                   'compiler' => 'UPCCOMPILE',
                   'compile_flag' => '-c',
@@ -895,7 +818,7 @@ register_language ('name' => 'cppasm',
 
                   'autodep' => 'CCAS',
                   'flags' => ['CCASFLAGS', 'CPPFLAGS'],
-                  'compile' => '$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+                  'compile' => "\$(CCAS) @cpplike_flags \$(AM_CCASFLAGS) \$(CCASFLAGS)",
                   'ccer' => 'CPPAS',
                   'compiler' => 'CPPASCOMPILE',
                   'compile_flag' => '-c',
@@ -949,7 +872,7 @@ register_language ('name' => 'ppfc',
                   'flags' => ['FCFLAGS', 'CPPFLAGS'],
                   'ccer' => 'PPFC',
                   'compiler' => 'PPFCCOMPILE',
-                  'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
+                  'compile' => "\$(FC) @cpplike_flags \$(AM_FCFLAGS) \$(FCFLAGS)",
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'libtool_tag' => 'FC',
@@ -981,7 +904,7 @@ register_language ('name' => 'ppf77',
                   'flags' => ['FFLAGS', 'CPPFLAGS'],
                   'ccer' => 'PPF77',
                   'compiler' => 'PPF77COMPILE',
-                  'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
+                  'compile' => "\$(F77) @cpplike_flags \$(AM_FFLAGS) \$(FFLAGS)",
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'libtool_tag' => 'F77',
@@ -1033,7 +956,7 @@ register_language ('name' => 'java',
 # err_am ($MESSAGE, [%OPTIONS])
 # -----------------------------
 # Uncategorized errors about the current Makefile.am.
-sub err_am ($;%)
+sub err_am
 {
   msg_am ('error', @_);
 }
@@ -1041,7 +964,7 @@ sub err_am ($;%)
 # err_ac ($MESSAGE, [%OPTIONS])
 # -----------------------------
 # Uncategorized errors about configure.ac.
-sub err_ac ($;%)
+sub err_ac
 {
   msg_ac ('error', @_);
 }
@@ -1049,7 +972,7 @@ sub err_ac ($;%)
 # msg_am ($CHANNEL, $MESSAGE, [%OPTIONS])
 # ---------------------------------------
 # Messages about about the current Makefile.am.
-sub msg_am ($$;%)
+sub msg_am
 {
   my ($channel, $msg, %opts) = @_;
   msg $channel, "${am_file}.am", $msg, %opts;
@@ -1058,7 +981,7 @@ sub msg_am ($$;%)
 # msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS])
 # ---------------------------------------
 # Messages about about configure.ac.
-sub msg_ac ($$;%)
+sub msg_ac
 {
   my ($channel, $msg, %opts) = @_;
   msg $channel, $configure_ac, $msg, %opts;
@@ -1072,7 +995,7 @@ sub msg_ac ($$;%)
 # We do this to avoid having the substitutions directly in automake.in;
 # when we do that they are sometimes removed and this causes confusion
 # and bugs.
-sub subst ($)
+sub subst
 {
     my ($text) = @_;
     return '@' . $text . '@';
@@ -1082,12 +1005,12 @@ sub subst ($)
 
 
 # $BACKPATH
-# &backname ($RELDIR)
-# --------------------
+# backname ($RELDIR)
+# -------------------
 # If I "cd $RELDIR", then to come back, I should "cd $BACKPATH".
 # For instance 'src/foo' => '../..'.
 # Works with non strictly increasing paths, i.e., 'src/../lib' => '..'.
-sub backname ($)
+sub backname
 {
     my ($file) = @_;
     my @res;
@@ -1114,7 +1037,7 @@ sub backname ($)
 # verbose_var (NAME)
 # ------------------
 # The public variable stem used to implement silent rules.
-sub verbose_var ($)
+sub verbose_var
 {
     my ($name) = @_;
     return 'AM_V_' . $name;
@@ -1123,7 +1046,7 @@ sub verbose_var ($)
 # verbose_private_var (NAME)
 # --------------------------
 # The naming policy for the private variables for silent rules.
-sub verbose_private_var ($)
+sub verbose_private_var
 {
     my ($name) = @_;
     return 'am__v_' . $name;
@@ -1134,7 +1057,7 @@ sub verbose_private_var ($)
 # For  silent rules, setup VAR and dispatcher, to expand to
 # VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to
 # empty) if not.
-sub define_verbose_var ($$;$)
+sub define_verbose_var
 {
     my ($name, $silent_val, $verbose_val) = @_;
     $verbose_val = '' unless defined $verbose_val;
@@ -1157,18 +1080,16 @@ sub define_verbose_var ($$;$)
       if (! vardef ($verbose_var, TRUE));
 }
 
-# Above should not be needed in the general automake code.
-
 # verbose_flag (NAME)
 # -------------------
-# Contents of %VERBOSE%: variable to expand before rule command.
-sub verbose_flag ($)
+# Contents of '%VERBOSE%' variable to expand before rule command.
+sub verbose_flag
 {
     my ($name) = @_;
     return '$(' . verbose_var ($name) . ')';
 }
 
-sub verbose_nodep_flag ($)
+sub verbose_nodep_flag
 {
     my ($name) = @_;
     return '$(' . verbose_var ($name) . subst ('am__nodep') . ')';
@@ -1185,14 +1106,12 @@ sub silent_flag ()
 # define_verbose_tagvar (NAME)
 # ----------------------------
 # Engage the needed silent rules machinery for tag NAME.
-sub define_verbose_tagvar ($)
+sub define_verbose_tagvar
 {
     my ($name) = @_;
     define_verbose_var ($name, '@echo "  '. $name . ' ' x (8 - length ($name)) . '" $@;');
 }
 
-# define_verbose_texinfo
-# ----------------------
 # Engage the needed silent rules machinery for assorted texinfo commands.
 sub define_verbose_texinfo ()
 {
@@ -1205,8 +1124,6 @@ sub define_verbose_texinfo ()
   define_verbose_var('texidevnull', '> /dev/null');
 }
 
-# define_verbose_libtool
-# ----------------------
 # Engage the needed silent rules machinery for 'libtool --silent'.
 sub define_verbose_libtool ()
 {
@@ -1232,8 +1149,8 @@ sub handle_silent ()
 ################################################################
 
 
-# Handle AUTOMAKE_OPTIONS variable.  Return 1 on error, 0 otherwise.
-sub handle_options
+# Handle AUTOMAKE_OPTIONS variable.  Return 0 on error, 1 otherwise.
+sub handle_options ()
 {
   my $var = var ('AUTOMAKE_OPTIONS');
   if ($var)
@@ -1246,7 +1163,7 @@ sub handle_options
       my @options = map { { option => $_->[1], where => $_->[0] } }
                        $var->value_as_list_recursive (cond_filter => TRUE,
                                                       location => 1);
-      return 1 if process_option_list (@options);
+      return 0 unless process_option_list (@options);
     }
 
   if ($strictness == GNITS)
@@ -1256,7 +1173,7 @@ sub handle_options
       set_option ('check-news', INTERNAL);
     }
 
-  return 0;
+  return 1;
 }
 
 # shadow_unconditionally ($varname, $where)
@@ -1266,7 +1183,7 @@ sub handle_options
 # If the VAR wasn't defined conditionally, return $(VAR).
 # Otherwise we create an am__VAR_DIST variable which contains
 # all possible values, and return $(am__VAR_DIST).
-sub shadow_unconditionally ($$)
+sub shadow_unconditionally
 {
   my ($varname, $where) = @_;
   my $var = var $varname;
@@ -1283,7 +1200,7 @@ sub shadow_unconditionally ($$)
 # ----------------------------
 # Make sure each variable VAR in @LIST does not exist, suggest using AM_VAR
 # otherwise.
-sub check_user_variables (@)
+sub check_user_variables
 {
   my @dont_override = @_;
   foreach my $flag (@dont_override)
@@ -1306,7 +1223,7 @@ sub check_user_variables (@)
 }
 
 # Call finish function for each language that was used.
-sub handle_languages
+sub handle_languages ()
 {
     if (! option 'no-dependencies')
     {
@@ -1315,10 +1232,10 @@ sub handle_languages
        if (keys %extension_seen && keys %dep_files)
        {
            # Set location of depcomp.
-           &define_variable ('depcomp',
-                             "\$(SHELL) $am_config_aux_dir/depcomp",
-                             INTERNAL);
-           &define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
+           define_variable ('depcomp',
+                            "\$(SHELL) $am_config_aux_dir/depcomp",
+                            INTERNAL);
+           define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
 
            require_conf_file ("$am_file.am", FOREIGN, 'depcomp');
 
@@ -1341,15 +1258,15 @@ sub handle_languages
 
            # Compute the set of directories to remove in distclean-depend.
            my @depdirs = uniq (map { dirname ($_) } @deplist);
-           $output_rules .= &file_contents ('depend',
-                                            new Automake::Location,
-                                            DEPDIRS => "@depdirs");
+           $output_rules .= file_contents ('depend',
+                                           new Automake::Location,
+                                           DEPDIRS => "@depdirs");
        }
     }
     else
     {
-       &define_variable ('depcomp', '', INTERNAL);
-       &define_variable ('am__depfiles_maybe', '', INTERNAL);
+       define_variable ('depcomp', '', INTERNAL);
+       define_variable ('am__depfiles_maybe', '', INTERNAL);
     }
 
     my %done;
@@ -1384,7 +1301,7 @@ sub handle_languages
                         'FASTDEP' => $FASTDEP,
                         '-c'      => $lang->compile_flag || '',
                         # These are not used, but they need to be defined
-                        # so &transform do not complain.
+                        # so transform() do not complain.
                         SUBDIROBJ     => 0,
                         'DERIVED-EXT' => 'BUG',
                         DIST_SOURCE   => 1,
@@ -1397,17 +1314,9 @@ sub handle_languages
        if (((! option 'no-dependencies') && $lang->autodep ne 'no')
            || defined $lang->compile)
        {
-           # Some C compilers don't support -c -o.  Use it only if really
-           # needed.
-           my $output_flag = $lang->output_flag || '';
-           $output_flag = '-o'
-             if (! $output_flag
-                 && $lang->name eq 'c'
-                 && option 'subdir-objects');
-
            # Compute a possible derived extension.
            # This is not used by depend2.am.
-           my $der_ext = (&{$lang->output_extensions} ($ext))[0];
+           my $der_ext = ($lang->output_extensions->($ext))[0];
 
            # When we output an inference rule like '.c.o:' we
            # have two cases to consider: either subdir-objects
@@ -1448,7 +1357,7 @@ sub handle_languages
 
                             COMPILE   => '$(' . $lang->compiler . ')',
                             LTCOMPILE => '$(LT' . $lang->compiler . ')',
-                            -o        => $output_flag,
+                            -o        => $lang->output_flag,
                             SUBDIROBJ => !! option 'subdir-objects');
        }
 
@@ -1578,7 +1487,7 @@ sub handle_languages
     $needs_c = 1 if @languages_seen > 1;
     if ($need_link || $needs_c)
       {
-       &define_compiler_variable ($languages{'c'})
+       define_compiler_variable ($languages{'c'})
          unless defined $done{$languages{'c'}};
        define_linker_variable ($languages{'c'});
       }
@@ -1662,7 +1571,7 @@ sub check_libobjs_sources
 #     when producing explicit rules
 # Result is a list of the names of objects
 # %linkers_used will be updated with any linkers needed
-sub handle_single_transform ($$$$$%)
+sub handle_single_transform
 {
     my ($var, $topparent, $derived, $obj, $_file, %transform) = @_;
     my @files = ($_file);
@@ -1713,13 +1622,13 @@ sub handle_single_transform ($$$$$%)
        # language function.
        my $aggregate = 'AM';
 
-       $extension = &derive_suffix ($extension, $obj);
+       $extension = derive_suffix ($extension, $obj);
        my $lang;
        if ($extension_map{$extension} &&
            ($lang = $languages{$extension_map{$extension}}))
        {
            # Found the language, so see what it says.
-           &saw_extension ($extension);
+           saw_extension ($extension);
 
            # Do we have per-executable flags for this executable?
            my $have_per_exec_flags = 0;
@@ -1797,9 +1706,36 @@ sub handle_single_transform ($$$$$%)
 
            # If rewrite said it was ok, put the object into a
            # subdir.
-           if ($r == LANG_SUBDIR && $directory ne '')
+           if ($directory ne '')
            {
-               $object = $directory . '/' . $object;
+              if ($r == LANG_SUBDIR)
+                {
+                  $object = $directory . '/' . $object;
+                }
+              else
+                {
+                  # Since the next major version of automake (2.0) will
+                  # make the behaviour so far only activated with the
+                  # 'subdir-object' option mandatory, it's better if we
+                  # start warning users not using that option.
+                  # As suggested by Peter Johansson, we strive to avoid
+                  # the warning when it would be irrelevant, i.e., if
+                  # all source files sit in "current" directory.
+                  msg_var 'unsupported', $var,
+                          "source file '$full' is in a subdirectory,"
+                          . "\nbut option 'subdir-objects' is disabled";
+                  msg 'unsupported', INTERNAL, <<'EOF', uniq_scope => US_GLOBAL;
+possible forward-incompatibility.
+At least a source file is in a subdirectory, but the 'subdir-objects'
+automake option hasn't been enabled.  For now, the corresponding output
+object file(s) will be placed in the top-level directory.  However,
+this behaviour will change in future Automake versions: they will
+unconditionally cause object files to be placed in the same subdirectory
+of the corresponding sources.
+You are advised to start using 'subdir-objects' option throughout your
+project, to avoid future incompatibilities.
+EOF
+                }
            }
 
            # If the object file has been renamed (because per-target
@@ -1932,7 +1868,7 @@ sub handle_single_transform ($$$$$%)
            unshift (@files, $object);
            # Distribute derived sources unless the source they are
            # derived from is not.
-           &push_dist_common ($object)
+           push_dist_common ($object)
              unless ($topparent =~ /^(?:nobase_)?nodist_/);
            next;
          }
@@ -1987,7 +1923,7 @@ sub handle_single_transform ($$$$$%)
                  unless option 'no-dependencies';
            }
 
-           &pretty_print_rule ($object . ':', "\t", @dep_list)
+           pretty_print_rule ($object . ':', "\t", @dep_list)
                if scalar @dep_list > 0;
        }
 
@@ -2038,7 +1974,7 @@ sub handle_single_transform ($$$$$%)
 #
 # Result is a pair ($LINKER, $OBJVAR):
 #    $LINKER is a boolean, true if a linker is needed to deal with the objects
-sub define_objects_from_sources ($$$$$$$%)
+sub define_objects_from_sources
 {
   my ($var, $objvar, $nodefine, $one_file,
       $obj, $topparent, $where, %transform) = @_;
@@ -2072,7 +2008,7 @@ sub define_objects_from_sources ($$$$$$$%)
 #   extra arguments to pass to file_contents when producing rules
 # Return the name of the linker variable that must be used.
 # Empty return means just use 'LINK'.
-sub handle_source_transform ($$$$%)
+sub handle_source_transform
 {
     # one_file is canonical name.  unxformed is given name.  obj is
     # object extension.
@@ -2110,14 +2046,14 @@ sub handle_source_transform ($$$$%)
        $needlinker |=
            define_objects_from_sources ($varname,
                                         $xpfx . $one_file . '_OBJECTS',
-                                        $prefix =~ /EXTRA_/,
+                                        !!($prefix =~ /EXTRA_/),
                                         $one_file, $obj, $varname, $where,
                                         DIST_SOURCE => ($prefix !~ /^nodist_/),
                                         %transform);
     }
     if ($needlinker)
     {
-       $linker ||= &resolve_linker (%linkers_used);
+       $linker ||= resolve_linker (%linkers_used);
     }
 
     my @keys = sort keys %used_pfx;
@@ -2157,7 +2093,7 @@ sub handle_source_transform ($$$$%)
            $default_source = '$(srcdir)/' . $default_source;
          }
 
-       &define_variable ($one_file . "_SOURCES", $default_source, $where);
+       define_variable ($one_file . "_SOURCES", $default_source, $where);
        push (@sources, $default_source);
        push (@dist_sources, $default_source);
 
@@ -2167,7 +2103,7 @@ sub handle_source_transform ($$$$%)
                                   $one_file . '_SOURCES',
                                   $one_file, $obj,
                                   $default_source, %transform);
-       $linker ||= &resolve_linker (%linkers_used);
+       $linker ||= resolve_linker (%linkers_used);
        define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result);
     }
     else
@@ -2272,7 +2208,7 @@ sub handle_lib_objects
 # -------------------------------
 # Definitions common to LIBOBJS and ALLOCA.
 # VAR should be one of LIBOBJS, LTLIBOBJS, ALLOCA, or LTALLOCA.
-sub handle_LIBOBJS_or_ALLOCA ($)
+sub handle_LIBOBJS_or_ALLOCA
 {
   my ($var) = @_;
 
@@ -2311,7 +2247,7 @@ sub handle_LIBOBJS_or_ALLOCA ($)
   return $dir;
 }
 
-sub handle_LIBOBJS ($$$)
+sub handle_LIBOBJS
 {
   my ($var, $cond, $lt) = @_;
   my $myobjext = $lt ? 'lo' : 'o';
@@ -2326,8 +2262,8 @@ sub handle_LIBOBJS ($$$)
     {
       if ($iter =~ /\.[cly]$/)
        {
-         &saw_extension ($&);
-         &saw_extension ('.c');
+         saw_extension ($&);
+         saw_extension ('.c');
        }
 
       if ($iter =~ /\.h$/)
@@ -2350,7 +2286,7 @@ sub handle_LIBOBJS ($$$)
     }
 }
 
-sub handle_ALLOCA ($$$)
+sub handle_ALLOCA
 {
   my ($var, $cond, $lt) = @_;
   my $myobjext = $lt ? 'lo' : 'o';
@@ -2360,10 +2296,10 @@ sub handle_ALLOCA ($$$)
   $var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA');
   $dep_files{$dir . '$(DEPDIR)/alloca.P' . $myobjext} = 1;
   require_libsource_with_macro ($cond, $var, FOREIGN, 'alloca.c');
-  &saw_extension ('.c');
+  saw_extension ('.c');
 }
 
-# Canonicalize the input parameter
+# Canonicalize the input parameter.
 sub canonicalize
 {
     my ($string) = @_;
@@ -2378,7 +2314,7 @@ sub check_canonical_spelling
 {
   my ($name, @suffixes) = @_;
 
-  my $xname = &canonicalize ($name);
+  my $xname = canonicalize ($name);
   if ($xname ne $name)
     {
       foreach my $xt (@suffixes)
@@ -2390,9 +2326,6 @@ sub check_canonical_spelling
   return $xname;
 }
 
-
-# handle_compile ()
-# -----------------
 # Set up the compile suite.
 sub handle_compile ()
 {
@@ -2438,19 +2371,17 @@ sub handle_compile ()
     }
 
     my ($coms, $vars, $rules) =
-      &file_contents_internal (1, "$libdir/am/compile.am",
-                              new Automake::Location,
-                              ('DEFAULT_INCLUDES' => $default_includes,
-                               'MOSTLYRMS' => join ("\n", @mostly_rms),
-                               'DISTRMS' => join ("\n", @dist_rms)));
+      file_contents_internal (1, "$libdir/am/compile.am",
+                             new Automake::Location,
+                             'DEFAULT_INCLUDES' => $default_includes,
+                             'MOSTLYRMS' => join ("\n", @mostly_rms),
+                             'DISTRMS' => join ("\n", @dist_rms));
     $output_vars .= $vars;
     $output_rules .= "$coms$rules";
 }
 
-# handle_libtool ()
-# -----------------
 # Handle libtool rules.
-sub handle_libtool
+sub handle_libtool ()
 {
   return unless var ('LIBTOOL');
 
@@ -2471,24 +2402,22 @@ sub handle_libtool
   check_user_variables 'LIBTOOLFLAGS';
 
   # Output the libtool compilation rules.
-  $output_rules .= &file_contents ('libtool',
-                                  new Automake::Location,
+  $output_rules .= file_contents ('libtool',
+                                 new Automake::Location,
                                   LTRMS => join ("\n", @libtool_rms));
 }
 
-# handle_programs ()
-# ------------------
-# Handle C programs.
-sub handle_programs
+
+sub handle_programs ()
 {
-  my @proglist = &am_install_var ('progs', 'PROGRAMS',
-                                 'bin', 'sbin', 'libexec', 'pkglibexec',
-                                 'noinst', 'check');
+  my @proglist = am_install_var ('progs', 'PROGRAMS',
+                                'bin', 'sbin', 'libexec', 'pkglibexec',
+                                'noinst', 'check');
   return if ! @proglist;
   $must_handle_compiled_objects = 1;
 
   my $seen_global_libobjs =
-    var ('LDADD') && &handle_lib_objects ('', 'LDADD');
+    var ('LDADD') && handle_lib_objects ('', 'LDADD');
 
   foreach my $pair (@proglist)
     {
@@ -2500,30 +2429,30 @@ sub handle_programs
       $known_programs{$one_file} = $where;
 
       # Canonicalize names and check for misspellings.
-      my $xname = &check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS',
-                                            '_SOURCES', '_OBJECTS',
-                                            '_DEPENDENCIES');
+      my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS',
+                                            '_SOURCES', '_OBJECTS',
+                                            '_DEPENDENCIES');
 
       $where->push_context ("while processing program '$one_file'");
       $where->set (INTERNAL->get);
 
-      my $linker = &handle_source_transform ($xname, $one_file, $obj, $where,
-                                            NONLIBTOOL => 1, LIBTOOL => 0);
+      my $linker = handle_source_transform ($xname, $one_file, $obj, $where,
+                                            NONLIBTOOL => 1, LIBTOOL => 0);
 
       if (var ($xname . "_LDADD"))
        {
-         $seen_libobjs = &handle_lib_objects ($xname, $xname . '_LDADD');
+         $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD');
        }
       else
        {
          # User didn't define prog_LDADD override.  So do it.
-         &define_variable ($xname . '_LDADD', '$(LDADD)', $where);
+         define_variable ($xname . '_LDADD', '$(LDADD)', $where);
 
          # This does a bit too much work.  But we need it to
          # generate _DEPENDENCIES when appropriate.
          if (var ('LDADD'))
            {
-             $seen_libobjs = &handle_lib_objects ($xname, 'LDADD');
+             $seen_libobjs = handle_lib_objects ($xname, 'LDADD');
            }
        }
 
@@ -2535,7 +2464,7 @@ sub handle_programs
       set_seen ($xname . '_LDFLAGS');
 
       # Determine program to use for link.
-      my($xlink, $vlink) = &define_per_target_linker_variable ($linker, $xname);
+      my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname);
       $vlink = verbose_flag ($vlink || 'GEN');
 
       # If the resulting program lies in a subdirectory,
@@ -2544,37 +2473,34 @@ sub handle_programs
 
       $libtool_clean_directories{dirname ($one_file)} = 1;
 
-      $output_rules .= &file_contents ('program',
-                                      $where,
-                                      PROGRAM  => $one_file,
-                                      XPROGRAM => $xname,
-                                      XLINK    => $xlink,
-                                      VERBOSE  => $vlink,
-                                      DIRSTAMP => $dirstamp,
-                                      EXEEXT   => '$(EXEEXT)');
+      $output_rules .= file_contents ('program',
+                                      $where,
+                                      PROGRAM  => $one_file,
+                                      XPROGRAM => $xname,
+                                      XLINK    => $xlink,
+                                      VERBOSE  => $vlink,
+                                      DIRSTAMP => $dirstamp,
+                                      EXEEXT   => '$(EXEEXT)');
 
       if ($seen_libobjs || $seen_global_libobjs)
        {
          if (var ($xname . '_LDADD'))
            {
-             &check_libobjs_sources ($xname, $xname . '_LDADD');
+             check_libobjs_sources ($xname, $xname . '_LDADD');
            }
          elsif (var ('LDADD'))
            {
-             &check_libobjs_sources ($xname, 'LDADD');
+             check_libobjs_sources ($xname, 'LDADD');
            }
        }
     }
 }
 
 
-# handle_libraries ()
-# -------------------
-# Handle libraries.
-sub handle_libraries
+sub handle_libraries ()
 {
-  my @liblist = &am_install_var ('libs', 'LIBRARIES',
-                                'lib', 'pkglib', 'noinst', 'check');
+  my @liblist = am_install_var ('libs', 'LIBRARIES',
+                                'lib', 'pkglib', 'noinst', 'check');
   return if ! @liblist;
   $must_handle_compiled_objects = 1;
 
@@ -2587,9 +2513,9 @@ sub handle_libraries
       $var->requires_variables ('library used', 'RANLIB');
     }
 
-  &define_variable ('AR', 'ar', INTERNAL);
-  &define_variable ('ARFLAGS', 'cru', INTERNAL);
-  &define_verbose_tagvar ('AR');
+  define_variable ('AR', 'ar', INTERNAL);
+  define_variable ('ARFLAGS', 'cru', INTERNAL);
+  define_verbose_tagvar ('AR');
 
   foreach my $pair (@liblist)
     {
@@ -2616,27 +2542,27 @@ sub handle_libraries
       my $obj = '.$(OBJEXT)';
 
       # Canonicalize names and check for misspellings.
-      my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
-                                           '_OBJECTS', '_DEPENDENCIES',
-                                           '_AR');
+      my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
+                                           '_OBJECTS', '_DEPENDENCIES',
+                                           '_AR');
 
       if (! var ($xlib . '_AR'))
        {
-         &define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
+         define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
        }
 
       # Generate support for conditional object inclusion in
       # libraries.
       if (var ($xlib . '_LIBADD'))
        {
-         if (&handle_lib_objects ($xlib, $xlib . '_LIBADD'))
+         if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
            {
              $seen_libobjs = 1;
            }
        }
       else
        {
-         &define_variable ($xlib . "_LIBADD", '', $where);
+         define_variable ($xlib . "_LIBADD", '', $where);
        }
 
       reject_var ($xlib . '_LDADD',
@@ -2646,8 +2572,8 @@ sub handle_libraries
       set_seen ($xlib . '_DEPENDENCIES');
       set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
 
-      &handle_source_transform ($xlib, $onelib, $obj, $where,
-                               NONLIBTOOL => 1, LIBTOOL => 0);
+      handle_source_transform ($xlib, $onelib, $obj, $where,
+                               NONLIBTOOL => 1, LIBTOOL => 0);
 
       # If the resulting library lies in a subdirectory,
       # make sure this directory will exist.
@@ -2655,19 +2581,19 @@ sub handle_libraries
       my $verbose = verbose_flag ('AR');
       my $silent = silent_flag ();
 
-      $output_rules .= &file_contents ('library',
-                                      $where,
-                                      VERBOSE  => $verbose,
-                                      SILENT   => $silent,
-                                      LIBRARY  => $onelib,
-                                      XLIBRARY => $xlib,
-                                      DIRSTAMP => $dirstamp);
+      $output_rules .= file_contents ('library',
+                                       $where,
+                                       VERBOSE  => $verbose,
+                                       SILENT   => $silent,
+                                       LIBRARY  => $onelib,
+                                       XLIBRARY => $xlib,
+                                       DIRSTAMP => $dirstamp);
 
       if ($seen_libobjs)
        {
          if (var ($xlib . '_LIBADD'))
            {
-             &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+             check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
        }
 
@@ -2681,13 +2607,10 @@ sub handle_libraries
 }
 
 
-# handle_ltlibraries ()
-# ---------------------
-# Handle shared libraries.
-sub handle_ltlibraries
+sub handle_ltlibraries ()
 {
-  my @liblist = &am_install_var ('ltlib', 'LTLIBRARIES',
-                                'noinst', 'lib', 'pkglib', 'check');
+  my @liblist = am_install_var ('ltlib', 'LTLIBRARIES',
+                                'noinst', 'lib', 'pkglib', 'check');
   return if ! @liblist;
   $must_handle_compiled_objects = 1;
 
@@ -2789,9 +2712,9 @@ sub handle_ltlibraries
       my $obj = '.lo';
 
       # Canonicalize names and check for misspellings.
-      my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
-                                           '_SOURCES', '_OBJECTS',
-                                           '_DEPENDENCIES');
+      my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
+                                           '_SOURCES', '_OBJECTS',
+                                           '_DEPENDENCIES');
 
       # Check that the library fits the standard naming convention.
       my $libname_rx = '^lib.*\.la';
@@ -2838,25 +2761,25 @@ sub handle_ltlibraries
       # libraries.
       if (var ($xlib . '_LIBADD'))
        {
-         if (&handle_lib_objects ($xlib, $xlib . '_LIBADD'))
+         if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
            {
              $seen_libobjs = 1;
            }
        }
       else
        {
-         &define_variable ($xlib . "_LIBADD", '', $where);
+         define_variable ($xlib . "_LIBADD", '', $where);
        }
 
       reject_var ("${xlib}_LDADD",
                  "use '${xlib}_LIBADD', not '${xlib}_LDADD'");
 
 
-      my $linker = &handle_source_transform ($xlib, $onelib, $obj, $where,
-                                            NONLIBTOOL => 0, LIBTOOL => 1);
+      my $linker = handle_source_transform ($xlib, $onelib, $obj, $where,
+                                            NONLIBTOOL => 0, LIBTOOL => 1);
 
       # Determine program to use for link.
-      my($xlink, $vlink) = &define_per_target_linker_variable ($linker, $xlib);
+      my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib);
       $vlink = verbose_flag ($vlink || 'GEN');
 
       my $rpathvar = "am_${xlib}_rpath";
@@ -2901,19 +2824,19 @@ sub handle_ltlibraries
       my $dirname = dirname $onelib;
       $libtool_clean_directories{$dirname} = 1;
 
-      $output_rules .= &file_contents ('ltlibrary',
-                                      $where,
-                                      LTLIBRARY  => $onelib,
-                                      XLTLIBRARY => $xlib,
-                                      RPATH      => $rpath,
-                                      XLINK      => $xlink,
-                                      VERBOSE    => $vlink,
-                                      DIRSTAMP   => $dirstamp);
+      $output_rules .= file_contents ('ltlibrary',
+                                      $where,
+                                      LTLIBRARY  => $onelib,
+                                      XLTLIBRARY => $xlib,
+                                      RPATH      => $rpath,
+                                      XLINK      => $xlink,
+                                      VERBOSE    => $vlink,
+                                      DIRSTAMP   => $dirstamp);
       if ($seen_libobjs)
        {
          if (var ($xlib . '_LIBADD'))
            {
-             &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+             check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
        }
 
@@ -2953,30 +2876,27 @@ sub check_typos ()
 }
 
 
-# Handle scripts.
-sub handle_scripts
+sub handle_scripts ()
 {
     # NOTE we no longer automatically clean SCRIPTS, because it is
     # useful to sometimes distribute scripts verbatim.  This happens
     # e.g. in Automake itself.
-    &am_install_var ('-candist', 'scripts', 'SCRIPTS',
-                    'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
-                    'noinst', 'check');
+    am_install_var ('-candist', 'scripts', 'SCRIPTS',
+                    'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
+                    'noinst', 'check');
 }
 
 
-
-
 ## ------------------------ ##
 ## Handling Texinfo files.  ##
 ## ------------------------ ##
 
 # ($OUTFILE, $VFILE)
-# &scan_texinfo_file ($FILENAME)
-# ------------------------------
+# scan_texinfo_file ($FILENAME)
+# -----------------------------
 # $OUTFILE     - name of the info file produced by $FILENAME.
 # $VFILE       - name of the version.texi file used (undef if none).
-sub scan_texinfo_file ($)
+sub scan_texinfo_file
 {
   my ($filename) = @_;
 
@@ -3031,7 +2951,7 @@ sub scan_texinfo_file ($)
 # DEST - the destination Info file
 # INSRC - whether DEST should be built in the source tree
 # DEPENDENCIES - known dependencies
-sub output_texinfo_build_rules ($$$@)
+sub output_texinfo_build_rules
 {
   my ($source, $dest, $insrc, @deps) = @_;
 
@@ -3125,8 +3045,8 @@ sub output_texinfo_build_rules ($$$@)
 # ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN)
 # handle_texinfo_helper ($info_texinfos)
 # --------------------------------------
-# Handle all Texinfo source; helper for handle_texinfo.
-sub handle_texinfo_helper ($)
+# Handle all Texinfo source; helper for 'handle_texinfo'.
+sub handle_texinfo_helper
 {
   my ($info_texinfos) = @_;
   my (@infobase, @info_deps_list, @texi_deps);
@@ -3275,23 +3195,51 @@ sub handle_texinfo_helper ($)
       # have a single variable ($INSRC) that controls whether
       # the current .info file must be built in the source tree
       # or in the build tree.  Actually this variable is switched
-      # off for .info files that appear to be cleaned; this is
-      # for backward compatibility with package such as Texinfo,
-      # which do things like
-      #   info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
-      #   DISTCLEANFILES = texinfo texinfo-* info*.info*
-      #   # Do not create info files for distribution.
-      #   dist-info:
-      # in order not to distribute .info files.
-      my $insrc = ($out_file =~ $user_cleaned_files) ? 0 : 1;
-
+      # off in two cases:
+      #  (1) For '.info' files that appear to be cleaned; this is for
+      #      backward compatibility with package such as Texinfo,
+      #      which do things like
+      #        info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
+      #        DISTCLEANFILES = texinfo texinfo-* info*.info*
+      #        # Do not create info files for distribution.
+      #        dist-info:
+      #      in order not to distribute .info files.
+      #  (2) When the undocumented option 'info-in-builddir' is given.
+      #      This is done to allow the developers of GCC, GDB, GNU
+      #      binutils and the GNU bfd library to force the '.info' files
+      #      to be generated in the builddir rather than the srcdir, as
+      #      was once done when the (now removed) 'cygnus' option was
+      #      given.  See automake bug#11034 for more discussion.
+      my $insrc = 1;
       my $soutdir = '$(srcdir)/' . $outdir;
+
+      if (option 'info-in-builddir')
+        {
+          $insrc = 0;
+        }
+      elsif ($out_file =~ $user_cleaned_files)
+        {
+          $insrc = 0;
+          msg 'obsolete', "$am_file.am", <<EOF;
+Oops!
+    It appears this file (or files included by it) are triggering
+    an undocumented, soon-to-be-removed automake hack.
+    Future automake versions will no longer place in the builddir
+    (rather than in the srcdir) the generated '.info' files that
+    appear to be cleaned, by e.g. being listed in CLEANFILES or
+    DISTCLEANFILES.
+    If you want your '.info' files to be placed in the builddir
+    rather than in the srcdir, you have to use the shiny new
+    'info-in-builddir' automake option.
+EOF
+        }
+
       $outdir = $soutdir if $insrc;
 
       # If user specified file_TEXINFOS, then use that as explicit
       # dependency list.
       @texi_deps = ();
-      push (@texi_deps, "$soutdir$vtexi") if $vtexi;
+      push (@texi_deps, "${soutdir}${vtexi}") if $vtexi;
 
       my $canonical = canonicalize ($infobase);
       if (var ($canonical . "_TEXINFOS"))
@@ -3418,9 +3366,6 @@ sub handle_texinfo_helper ($)
 }
 
 
-# handle_texinfo ()
-# -----------------
-# Handle all Texinfo source.
 sub handle_texinfo ()
 {
   reject_var 'TEXINFOS', "'TEXINFOS' is an anachronism; use 'info_TEXINFOS'";
@@ -3449,8 +3394,7 @@ sub handle_texinfo ()
 }
 
 
-# Handle any man pages.
-sub handle_man_pages
+sub handle_man_pages ()
 {
   reject_var 'MANS', "'MANS' is an anachronism; use 'man_MANS'";
 
@@ -3484,7 +3428,7 @@ sub handle_man_pages
                      $trans_sect_vars{$varname} = 1;
                    }
 
-                 &push_dist_common ($varname)
+                 push_dist_common ($varname)
                    if $pfx eq 'dist_';
                }
            }
@@ -3519,7 +3463,7 @@ sub handle_man_pages
                {
                  $trans_vars{$varname} = 1;
                }
-             &push_dist_common ($varname)
+             push_dist_common ($varname)
                if $pfx eq 'dist_';
            }
        }
@@ -3563,18 +3507,18 @@ sub handle_man_pages
       @unsorted_deps = (keys %notrans_vars, keys %trans_vars,
                         keys %notrans_this_sect, keys %trans_this_sect);
       my @deps = sort @unsorted_deps;
-      $output_rules .= &file_contents ('mans',
-                                      new Automake::Location,
-                                      SECTION           => $section,
-                                      DEPS              => "@deps",
-                                      NOTRANS_MANS      => $notrans_mans,
-                                      NOTRANS_SECT_LIST => "@notrans_sect_list",
-                                      HAVE_NOTRANS      => $have_notrans,
-                                      NOTRANS_LIST      => "@notrans_list",
-                                      TRANS_MANS        => $trans_mans,
-                                      TRANS_SECT_LIST   => "@trans_sect_list",
-                                      HAVE_TRANS        => $have_trans,
-                                      TRANS_LIST        => "@trans_list");
+      $output_rules .= file_contents ('mans',
+                                      new Automake::Location,
+                                      SECTION           => $section,
+                                      DEPS              => "@deps",
+                                      NOTRANS_MANS      => $notrans_mans,
+                                      NOTRANS_SECT_LIST => "@notrans_sect_list",
+                                      HAVE_NOTRANS      => $have_notrans,
+                                      NOTRANS_LIST      => "@notrans_list",
+                                      TRANS_MANS        => $trans_mans,
+                                      TRANS_SECT_LIST   => "@trans_sect_list",
+                                      HAVE_TRANS        => $have_trans,
+                                      TRANS_LIST        => "@trans_list");
     }
 
   @unsorted_deps  = (keys %notrans_vars, keys %trans_vars,
@@ -3588,17 +3532,17 @@ sub handle_man_pages
     unless option 'no-installman';
 }
 
-# Handle DATA variables.
-sub handle_data
+
+sub handle_data ()
 {
-    &am_install_var ('-noextra', '-candist', 'data', 'DATA',
-                    'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
-                    'ps', 'sysconf', 'sharedstate', 'localstate',
-                    'pkgdata', 'lisp', 'noinst', 'check');
+    am_install_var ('-noextra', '-candist', 'data', 'DATA',
+                    'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
+                    'ps', 'sysconf', 'sharedstate', 'localstate',
+                    'pkgdata', 'lisp', 'noinst', 'check');
 }
 
-# Handle TAGS.
-sub handle_tags
+
+sub handle_tags ()
 {
     my @config;
     foreach my $spec (@config_headers)
@@ -3620,7 +3564,7 @@ sub handle_tags
     if (rvar('am__tagged_files')->value_as_list_recursive
           || var ('ETAGS_ARGS') || var ('SUBDIRS'))
       {
-       $output_rules .= &file_contents ('tags', new Automake::Location);
+       $output_rules .= file_contents ('tags', new Automake::Location);
        set_seen 'TAGS_DEPENDENCIES';
       }
     else
@@ -3645,7 +3589,7 @@ sub handle_tags
 # Return false if rule $NAME does not exist.  Otherwise,
 # declare it as phony, complete its definition (in case it is
 # conditional), and return its Automake::Rule instance.
-sub user_phony_rule ($)
+sub user_phony_rule
 {
   my ($name) = @_;
   my $rule = rule $name;
@@ -3665,8 +3609,6 @@ sub user_phony_rule ($)
 }
 
 
-# handle_dist
-# -----------
 # Handle 'dist' target.
 sub handle_dist ()
 {
@@ -3729,7 +3671,7 @@ sub handle_dist ()
   if ($relative_dir eq '.'
       && $config_aux_dir_set_in_configure_ac)
     {
-      if (! &is_make_dir ($config_aux_dir))
+      if (! is_make_dir ($config_aux_dir))
        {
          $check_aux = 1;
        }
@@ -3740,14 +3682,14 @@ sub handle_dist ()
          # The file might be absent, but if it can be built it's ok.
          || rule $cfile)
        {
-         &push_dist_common ($cfile);
+         push_dist_common ($cfile);
        }
 
       # Don't use 'elsif' here because a file might meaningfully
       # appear in both directories.
       if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile))
        {
-         &push_dist_common ("$config_aux_dir/$cfile")
+         push_dist_common ("$config_aux_dir/$cfile")
        }
     }
 
@@ -3775,7 +3717,7 @@ sub handle_dist ()
   # Files to distributed.  Don't use ->value_as_list_recursive
   # as it recursively expands '$(dist_pkgdata_DATA)' etc.
   my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
-  @dist_common = uniq @dist_common;
+  @dist_common = uniq (@dist_common);
   variable_delete 'DIST_COMMON';
   define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
 
@@ -3796,10 +3738,10 @@ sub handle_dist ()
   my $flm = option ('filename-length-max');
   my $filename_filter = $flm ? '.' x $flm->[1] : '';
 
-  $output_rules .= &file_contents ('distdir',
-                                  new Automake::Location,
-                                  %transform,
-                                  FILENAME_FILTER => $filename_filter);
+  $output_rules .= file_contents ('distdir',
+                                 new Automake::Location,
+                                 %transform,
+                                 FILENAME_FILTER => $filename_filter);
 }
 
 
@@ -3807,7 +3749,7 @@ sub handle_dist ()
 # -------------------------------------------------------
 # Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane
 # name.  Use $WHERE as a location in the diagnostic, if any.
-sub check_directory ($$;$)
+sub check_directory
 {
   my ($dir, $where, $reldir) = @_;
   $reldir = '.' unless defined $reldir;
@@ -3845,7 +3787,7 @@ sub check_directory ($$;$)
 # check_directories_in_var ($VARIABLE)
 # ------------------------------------
 # Recursively check all items in variables $VARIABLE as directories
-sub check_directories_in_var ($)
+sub check_directories_in_var
 {
   my ($var) = @_;
   $var->traverse_recursively
@@ -3859,9 +3801,7 @@ sub check_directories_in_var ($)
      skip_ac_subst => 1);
 }
 
-# &handle_subdirs ()
-# ------------------
-# Handle subdirectories.
+
 sub handle_subdirs ()
 {
   my $subdirs = var ('SUBDIRS');
@@ -3874,14 +3814,14 @@ sub handle_subdirs ()
   check_directories_in_var $dsubdirs
     if $dsubdirs;
 
-  $output_rules .= &file_contents ('subdirs', new Automake::Location);
+  $output_rules .= file_contents ('subdirs', new Automake::Location);
   rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
 }
 
 
 # ($REGEN, @DEPENDENCIES)
-# &scan_aclocal_m4
-# ----------------
+# scan_aclocal_m4
+# ---------------
 # If aclocal.m4 creation is automated, return the list of its dependencies.
 sub scan_aclocal_m4 ()
 {
@@ -3892,7 +3832,7 @@ sub scan_aclocal_m4 ()
 
   if (-f 'aclocal.m4')
     {
-      &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
+      define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
 
       my $aclocal = new Automake::XFile "< aclocal.m4";
       my $line = $aclocal->getline;
@@ -3917,8 +3857,8 @@ sub scan_aclocal_m4 ()
 }
 
 
-# Helper function for substitute_ac_subst_variables.
-sub substitute_ac_subst_variables_worker($)
+# Helper function for 'substitute_ac_subst_variables'.
+sub substitute_ac_subst_variables_worker
 {
   my ($token) = @_;
   return "\@$token\@" if var $token;
@@ -3929,22 +3869,22 @@ sub substitute_ac_subst_variables_worker($)
 # -------------------------------------
 # Replace any occurrence of ${FOO} in $TEXT by @FOO@ if FOO is an AC_SUBST
 # variable.
-sub substitute_ac_subst_variables ($)
+sub substitute_ac_subst_variables
 {
   my ($text) = @_;
-  $text =~ s/\${([^ \t=:+{}]+)}/&substitute_ac_subst_variables_worker ($1)/ge;
+  $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
   return $text;
 }
 
 # @DEPENDENCIES
-# &prepend_srcdir (@INPUTS)
-# -------------------------
+# prepend_srcdir (@INPUTS)
+# ------------------------
 # Prepend $(srcdir) or $(top_srcdir) to all @INPUTS.  The idea is that
 # if an input file has a directory part the same as the current
 # directory, then the directory part is simply replaced by $(srcdir).
 # But if the directory part is different, then $(top_srcdir) is
 # prepended.
-sub prepend_srcdir (@)
+sub prepend_srcdir
 {
   my (@inputs) = @_;
   my @newinputs;
@@ -3970,7 +3910,7 @@ sub prepend_srcdir (@)
 # rule of
 #   AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...)
 # Also distribute $INPUTs which are not built by another AC_CONFIG_FOOs.
-sub rewrite_inputs_into_dependencies ($@)
+sub rewrite_inputs_into_dependencies
 {
   my ($file, @inputs) = @_;
   my @res = ();
@@ -4011,11 +3951,11 @@ sub rewrite_inputs_into_dependencies ($@)
 
 
 
-# &handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
-# ------------------------------------------------------------------
+# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
+# -----------------------------------------------------------------
 # Handle remaking and configure stuff.
 # We need the name of the input file, to do proper remaking rules.
-sub handle_configure ($$$@)
+sub handle_configure
 {
   my ($makefile_am, $makefile_in, $makefile, @inputs) = @_;
 
@@ -4058,7 +3998,7 @@ sub handle_configure ($$$@)
 
   if ($relative_dir eq '.')
     {
-      &push_dist_common ('acconfig.h')
+      push_dist_common ('acconfig.h')
        if -f 'acconfig.h';
     }
 
@@ -4077,7 +4017,7 @@ sub handle_configure ($$$@)
       # directory and the header's directory doesn't have a
       # Makefile, then we also want to build the header.
       if ($relative_dir eq $config_h_dir
-         || ($relative_dir eq '.' && ! &is_make_dir ($config_h_dir)))
+         || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir)))
        {
          my ($cn_sans_dir, $stamp_dir);
          if ($relative_dir eq $config_h_dir)
@@ -4224,7 +4164,7 @@ sub handle_configure ($$$@)
       my $fd = dirname ($file);
       if ($fd ne $relative_dir)
        {
-         if ($relative_dir eq '.' && ! &is_make_dir ($fd))
+         if ($relative_dir eq '.' && ! is_make_dir ($fd))
            {
              $local = $file;
            }
@@ -4279,7 +4219,7 @@ sub handle_configure ($$$@)
          my $fd = dirname ($link);
          if ($fd ne $relative_dir)
            {
-             if ($relative_dir eq '.' && ! &is_make_dir ($fd))
+             if ($relative_dir eq '.' && ! is_make_dir ($fd))
                {
                  $local = $link;
                }
@@ -4307,7 +4247,7 @@ sub handle_configure ($$$@)
          # At the top-level ('.') we also distribute files whose
          # directory does not have a Makefile.
          if (($fd eq $relative_dir)
-             || ($relative_dir eq '.' && ! &is_make_dir ($fd)))
+             || ($relative_dir eq '.' && ! is_make_dir ($fd)))
            {
              # The following will distribute $file as a side-effect when
              # it is appropriate (i.e., when $file is not already an output).
@@ -4324,20 +4264,19 @@ sub handle_configure ($$$@)
                          @actual_other_vpath_files);
 }
 
-# Handle C headers.
-sub handle_headers
+sub handle_headers ()
 {
-    my @r = &am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
-                            'oldinclude', 'pkginclude',
-                            'noinst', 'check');
+    my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
+                           'oldinclude', 'pkginclude',
+                           'noinst', 'check');
     foreach (@r)
     {
       next unless $_->[1] =~ /\..*$/;
-      &saw_extension ($&);
+      saw_extension ($&);
     }
 }
 
-sub handle_gettext
+sub handle_gettext ()
 {
   return if ! $seen_gettext || $relative_dir ne '.';
 
@@ -4393,8 +4332,8 @@ sub handle_gettext
   require_file ($ac_gettext_location, GNU, 'ABOUT-NLS');
 }
 
-# Handle footer elements.
-sub handle_footer
+# Emit makefile footer.
+sub handle_footer ()
 {
     reject_rule ('.SUFFIXES',
                 "use variable 'SUFFIXES', not target '.SUFFIXES'");
@@ -4432,21 +4371,23 @@ sub handle_footer
 # Generate 'make install' rules.
 sub handle_install ()
 {
-  $output_rules .= &file_contents
+  $output_rules .= file_contents
     ('install',
      new Automake::Location,
      maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
                             ? (" \$(BUILT_SOURCES)\n"
                                . "\t\$(MAKE) \$(AM_MAKEFLAGS)")
                             : ''),
-     'installdirs-local' => (user_phony_rule 'installdirs-local'
+     'installdirs-local' => (user_phony_rule ('installdirs-local')
                             ? ' installdirs-local' : ''),
      am__installdirs => variable_value ('am__installdirs') || '');
 }
 
 
-# Deal with all and all-am.
-sub handle_all ($)
+# handle_all ($MAKEFILE)
+#-----------------------
+# Deal with 'all' and 'all-am'.
+sub handle_all
 {
     my ($makefile) = @_;
 
@@ -4468,8 +4409,8 @@ sub handle_all ($)
     push (@all, "all-local")
       if user_phony_rule "all-local";
 
-    &pretty_print_rule ("all-am:", "\t\t", @all);
-    &depend ('.PHONY', 'all-am', 'all');
+    pretty_print_rule ("all-am:", "\t\t", @all);
+    depend ('.PHONY', 'all-am', 'all');
 
 
     # Output 'all'.
@@ -4506,7 +4447,7 @@ sub handle_all ($)
       }
 }
 
-# Generate helper targets for user recursion, where needed.
+# Generate helper targets for user-defined recursive targets, where needed.
 sub handle_user_recursion ()
 {
   return unless @extra_recursive_targets;
@@ -4525,7 +4466,7 @@ sub handle_user_recursion ()
       # associated 'foo-local' rule; we define it as an empty rule by
       # default, so that the user can transparently extend it in his
       # own Makefile.am.
-      pretty_print_rule ("$target-local:");
+      pretty_print_rule ("$target-local:", '', '');
       # $target-recursive might as well be undefined, so do not add
       # it here; it's taken care of in subdirs.am anyway.
       depend (".PHONY", "$target-am", "$target-local");
@@ -4533,8 +4474,6 @@ sub handle_user_recursion ()
 }
 
 
-# &do_check_merge_target ()
-# -------------------------
 # Handle check merge target specially.
 sub do_check_merge_target ()
 {
@@ -4571,10 +4510,8 @@ sub do_check_merge_target ()
     if var ('BUILT_SOURCES');
 }
 
-# handle_clean ($MAKEFILE)
-# ------------------------
 # Handle all 'clean' targets.
-sub handle_clean ($)
+sub handle_clean
 {
   my ($makefile) = @_;
 
@@ -4612,7 +4549,7 @@ sub handle_clean ($)
       push @{$rms{$when}}, "\t-$rm\n";
     }
 
-  $output_rules .= &file_contents
+  $output_rules .= file_contents
     ('clean',
      new Automake::Location,
      MOSTLYCLEAN_RMS      => join ('', sort @{$rms{&MOSTLY_CLEAN}}),
@@ -4624,10 +4561,9 @@ sub handle_clean ($)
 }
 
 
-# &target_cmp ($A, $B)
-# --------------------
-# Subroutine for &handle_factored_dependencies to let '.PHONY' and
-# other '.TARGETS' be last.
+# Subroutine for handle_factored_dependencies() to let '.PHONY' and
+# other '.TARGETS' be last.  This is meant to be used as a comparison
+# subroutine passed to the sort built-int.
 sub target_cmp
 {
   return 0 if $a eq $b;
@@ -4643,10 +4579,8 @@ sub target_cmp
 }
 
 
-# &handle_factored_dependencies ()
-# --------------------------------
 # Handle everything related to gathered targets.
-sub handle_factored_dependencies
+sub handle_factored_dependencies ()
 {
   # Reject bad hooks.
   foreach my $utarg ('uninstall-data-local', 'uninstall-data-hook',
@@ -4723,7 +4657,7 @@ sub handle_factored_dependencies
       foreach my $cond (@undefined_conds)
        {
          my $condstr = $cond->subst_string;
-         &pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps);
+         pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps);
          $output_rules .= $actions{$_} if defined $actions{$_};
          $output_rules .= "\n";
        }
@@ -4731,14 +4665,14 @@ sub handle_factored_dependencies
 }
 
 
-# &handle_tests_dejagnu ()
-# ------------------------
-sub handle_tests_dejagnu
+sub handle_tests_dejagnu ()
 {
     push (@check_tests, 'check-DEJAGNU');
     $output_rules .= file_contents ('dejagnu', new Automake::Location);
 }
 
+# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM])
+#----------------------------------------------------
 sub handle_per_suffix_test
 {
   my ($test_suffix, %transform) = @_;
@@ -4792,7 +4726,7 @@ sub handle_per_suffix_test
 # ------------------------------
 # Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
 # otherwise.
-sub is_valid_test_extension ($)
+sub is_valid_test_extension
 {
   my $ext = shift;
   return 1
@@ -4802,12 +4736,12 @@ sub is_valid_test_extension ($)
   return 0;
 }
 
-# Handle TESTS variable and other checks.
-sub handle_tests
+
+sub handle_tests ()
 {
   if (option 'dejagnu')
     {
-      &handle_tests_dejagnu;
+      handle_tests_dejagnu;
     }
   else
     {
@@ -4822,9 +4756,9 @@ sub handle_tests
     {
       push (@check_tests, 'check-TESTS');
       my $check_deps = "@check";
-      $output_rules .= &file_contents ('check', new Automake::Location,
-                                      SERIAL_TESTS => !! option 'serial-tests',
-                                       CHECK_DEPS => $check_deps);
+      $output_rules .= file_contents ('check', new Automake::Location,
+                                      SERIAL_TESTS => !! option 'serial-tests',
+                                      CHECK_DEPS => $check_deps);
 
       # Tests that are known programs should have $(EXEEXT) appended.
       # For matching purposes, we need to adjust XFAIL_TESTS as well.
@@ -4936,11 +4870,10 @@ sub handle_tests
     }
 }
 
-# Handle Emacs Lisp.
-sub handle_emacs_lisp
+sub handle_emacs_lisp ()
 {
-  my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP',
-                                'lisp', 'noinst');
+  my @elfiles = am_install_var ('-candist', 'lisp', 'LISP',
+                                'lisp', 'noinst');
 
   return if ! @elfiles;
 
@@ -4957,24 +4890,22 @@ sub handle_emacs_lisp
                     'EMACS', 'lispdir');
 }
 
-# Handle Python
-sub handle_python
+sub handle_python ()
 {
-  my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON',
-                                'noinst');
+  my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON',
+                                'noinst');
   return if ! @pyfiles;
 
   require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON');
   require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile');
-  &define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
+  define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
 }
 
-# Handle Java.
-sub handle_java
+sub handle_java ()
 {
-    my @sourcelist = &am_install_var ('-candist',
-                                     'java', 'JAVA',
-                                     'noinst', 'check');
+    my @sourcelist = am_install_var ('-candist',
+                                     'java', 'JAVA',
+                                     'noinst', 'check');
     return if ! @sourcelist;
 
     my @prefixes = am_primary_prefixes ('JAVA', 1,
@@ -5014,8 +4945,7 @@ sub handle_java
 }
 
 
-# Handle some of the minor options.
-sub handle_minor_options
+sub handle_minor_options ()
 {
   if (option 'readme-alpha')
     {
@@ -5040,11 +4970,11 @@ sub handle_minor_options
 ################################################################
 
 # ($OUTPUT, @INPUTS)
-# &split_config_file_spec ($SPEC)
-# -------------------------------
+# split_config_file_spec ($SPEC)
+# ------------------------------
 # Decode the Autoconf syntax for config files (files, headers, links
 # etc.).
-sub split_config_file_spec ($)
+sub split_config_file_spec
 {
   my ($spec) = @_;
   my ($output, @inputs) = split (/:/, $spec);
@@ -5061,7 +4991,7 @@ sub split_config_file_spec ($)
 # AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in
 # This functions returns the first *.in file for which a *.am exists.
 # It returns undef otherwise.
-sub locate_am (@)
+sub locate_am
 {
   my (@rest) = @_;
   my $input;
@@ -5078,11 +5008,11 @@ sub locate_am (@)
 
 my %make_list;
 
-# &scan_autoconf_config_files ($WHERE, $CONFIG-FILES)
-# ---------------------------------------------------
+# scan_autoconf_config_files ($WHERE, $CONFIG-FILES)
+# --------------------------------------------------
 # Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES
 # (or AC_OUTPUT).
-sub scan_autoconf_config_files ($$)
+sub scan_autoconf_config_files
 {
   my ($where, $config_files) = @_;
 
@@ -5120,9 +5050,7 @@ sub scan_autoconf_config_files ($$)
 }
 
 
-# &scan_autoconf_traces ($FILENAME)
-# ---------------------------------
-sub scan_autoconf_traces ($)
+sub scan_autoconf_traces
 {
   my ($filename) = @_;
 
@@ -5153,7 +5081,6 @@ sub scan_autoconf_traces ($)
                AM_INIT_AUTOMAKE => 0,
                AM_MAINTAINER_MODE => 0,
                AM_PROG_AR => 0,
-               AM_PROG_CC_C_O => 0,
                _AM_SUBST_NOTMAKE => 1,
                _AM_COND_IF => 1,
                _AM_COND_ELSE => 1,
@@ -5346,7 +5273,7 @@ EOF
            {
              my @opts = split (' ', $args[1]);
              @opts = map { { option => $_, where => $where } } @opts;
-             exit $exit_code if process_global_option_list (@opts);
+             exit $exit_code unless process_global_option_list (@opts);
            }
        }
       elsif ($macro eq 'AM_MAINTAINER_MODE')
@@ -5357,10 +5284,6 @@ EOF
        {
          $seen_ar = $where;
        }
-      elsif ($macro eq 'AM_PROG_CC_C_O')
-       {
-         $seen_cc_c_o = $where;
-       }
       elsif ($macro eq '_AM_COND_IF')
         {
          cond_stack_if ('', $args[1], $where);
@@ -5431,8 +5354,6 @@ EOF
 }
 
 
-# &scan_autoconf_files ()
-# -----------------------
 # Check whether we use 'configure.ac' or 'configure.in'.
 # Scan it (and possibly 'aclocal.m4') for interesting things.
 # We must scan aclocal.m4 because there might be AC_SUBSTs and such there.
@@ -5518,7 +5439,7 @@ sub scan_autoconf_files ()
 ################################################################
 
 # Do any extra checking for GNU standards.
-sub check_gnu_standards
+sub check_gnu_standards ()
 {
   if ($relative_dir eq '.')
     {
@@ -5550,7 +5471,7 @@ sub check_gnu_standards
 }
 
 # Do any extra checking for GNITS standards.
-sub check_gnits_standards
+sub check_gnits_standards ()
 {
   if ($relative_dir eq '.')
     {
@@ -5576,50 +5497,11 @@ sub check_gnits_standards
 
 # This is just a convenience function that can be used to determine
 # when a subdir object should be used.
-sub lang_sub_obj
+sub lang_sub_obj ()
 {
     return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS;
 }
 
-# Rewrite a single C source file.
-sub lang_c_rewrite
-{
-  my ($directory, $base, $ext, $obj, $have_per_exec_flags, $var) = @_;
-
-  my $r = LANG_PROCESS;
-  if (option 'subdir-objects')
-    {
-      $r = LANG_SUBDIR;
-      if ($directory && $directory ne '.')
-       {
-         $base = $directory . '/' . $base;
-
-         # libtool is always able to put the object at the proper place,
-         # so we do not have to require AM_PROG_CC_C_O when building .lo files.
-         msg_var ('portability', $var,
-                  "compiling '$base.c' in subdir requires "
-                  . "'AM_PROG_CC_C_O' in '$configure_ac'",
-                  uniq_scope => US_GLOBAL,
-                  uniq_part => 'AM_PROG_CC_C_O subdir')
-           unless $seen_cc_c_o || $obj eq '.lo';
-       }
-    }
-
-  if (! $seen_cc_c_o
-      && $have_per_exec_flags
-      && ! option 'subdir-objects'
-      && $obj ne '.lo')
-    {
-      msg_var ('portability',
-              $var, "compiling '$base.c' with per-target flags requires "
-              . "'AM_PROG_CC_C_O' in '$configure_ac'",
-              uniq_scope => US_GLOBAL,
-              uniq_part => 'AM_PROG_CC_C_O per-target')
-    }
-
-    return $r;
-}
-
 # Rewrite a single header file.
 sub lang_header_rewrite
 {
@@ -5641,7 +5523,7 @@ sub lang_yacc_rewrite
 {
     my ($directory, $base, $ext) = @_;
 
-    my $r = &lang_sub_obj;
+    my $r = lang_sub_obj;
     (my $newext = $ext) =~ tr/y/c/;
     return ($r, $newext);
 }
@@ -5652,7 +5534,7 @@ sub lang_lex_rewrite
 {
     my ($directory, $base, $ext) = @_;
 
-    my $r = &lang_sub_obj;
+    my $r = lang_sub_obj;
     (my $newext = $ext) =~ tr/l/c/;
     return ($r, $newext);
 }
@@ -5669,7 +5551,7 @@ sub lang_java_rewrite
 # language, etc.  A finish function is only called if a source file of
 # the appropriate type has been seen.
 
-sub lang_vala_finish_target ($$)
+sub lang_vala_finish_target
 {
   my ($self, $name) = @_;
 
@@ -5764,7 +5646,7 @@ sub lang_vala_finish_target ($$)
 # Add output rules to invoke valac and create stamp file as a witness
 # to handle multiple outputs. This function is called after all source
 # file processing is done.
-sub lang_vala_finish
+sub lang_vala_finish ()
 {
   my ($self) = @_;
 
@@ -5850,9 +5732,9 @@ sub lang_yacc_target_hook
              . "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; fi\n";
          }
        # Distribute the generated file, unless its .y source was
-       # listed in a nodist_ variable.  (&handle_source_transform
+       # listed in a nodist_ variable.  (handle_source_transform()
        # will set DIST_SOURCE.)
-       &push_dist_common ($header)
+       push_dist_common ($header)
          if $transform{'DIST_SOURCE'};
 
        # The GNU rules say that yacc/lex output files should be removed
@@ -5878,17 +5760,17 @@ sub lang_lex_target_hook
 }
 
 # This is a helper for both lex and yacc.
-sub yacc_lex_finish_helper
+sub yacc_lex_finish_helper ()
 {
   return if defined $language_scratch{'lex-yacc-done'};
   $language_scratch{'lex-yacc-done'} = 1;
 
   # FIXME: for now, no line number.
   require_conf_file ($configure_ac, FOREIGN, 'ylwrap');
-  &define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
+  define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
 }
 
-sub lang_yacc_finish
+sub lang_yacc_finish ()
 {
   return if defined $language_scratch{'yacc-done'};
   $language_scratch{'yacc-done'} = 1;
@@ -5899,7 +5781,7 @@ sub lang_yacc_finish
 }
 
 
-sub lang_lex_finish
+sub lang_lex_finish ()
 {
   return if defined $language_scratch{'lex-done'};
   $language_scratch{'lex-done'} = 1;
@@ -5934,7 +5816,7 @@ sub saw_extension
 # ------------------------------
 # Register a single language.
 # Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE.
-sub register_language (%)
+sub register_language
 {
   my (%option) = @_;
 
@@ -5950,7 +5832,7 @@ sub register_language (%)
   $option{'nodist_specific'} = 0
     unless defined $option{'nodist_specific'};
 
-  my $lang = new Language (%option);
+  my $lang = new Automake::Language (%option);
 
   # Fill indexes.
   $extension_map{$_} = $lang->name foreach @{$lang->extensions};
@@ -5976,7 +5858,7 @@ sub register_language (%)
   # Update the suffix rules map.
   foreach my $suffix (@{$lang->extensions})
     {
-      foreach my $dest (&{$lang->output_extensions} ($suffix))
+      foreach my $dest ($lang->output_extensions->($suffix))
        {
          register_suffix_rule (INTERNAL, $suffix, $dest);
        }
@@ -5987,7 +5869,7 @@ sub register_language (%)
 # --------------------------
 # This function is used to find a path from a user-specified suffix $EXT
 # to $OBJ or to some other suffix we recognize internally, e.g. 'cc'.
-sub derive_suffix ($$)
+sub derive_suffix
 {
   my ($source_ext, $obj) = @_;
 
@@ -6002,12 +5884,10 @@ sub derive_suffix ($$)
 }
 
 
-################################################################
-
-# Pretty-print something and append to output_rules.
+# Pretty-print something and append to '$output_rules'.
 sub pretty_print_rule
 {
-    $output_rules .= &makefile_wrap (@_);
+    $output_rules .= makefile_wrap (shift, shift, @_);
 }
 
 
@@ -6022,7 +5902,7 @@ sub pretty_print_rule
 # $STRING
 # make_conditional_string ($NEGATE, $COND)
 # ----------------------------------------
-sub make_conditional_string ($$)
+sub make_conditional_string
 {
   my ($negate, $cond) = @_;
   $cond = "${cond}_TRUE"
@@ -6050,7 +5930,7 @@ my %_am_macro_for_cond =
 # $COND
 # cond_stack_if ($NEGATE, $COND, $WHERE)
 # --------------------------------------
-sub cond_stack_if ($$$)
+sub cond_stack_if
 {
   my ($negate, $cond, $where) = @_;
 
@@ -6080,7 +5960,7 @@ sub cond_stack_if ($$$)
 # $COND
 # cond_stack_else ($NEGATE, $COND, $WHERE)
 # ----------------------------------------
-sub cond_stack_else ($$$)
+sub cond_stack_else
 {
   my ($negate, $cond, $where) = @_;
 
@@ -6110,7 +5990,7 @@ sub cond_stack_else ($$$)
 # $COND
 # cond_stack_endif ($NEGATE, $COND, $WHERE)
 # -----------------------------------------
-sub cond_stack_endif ($$$)
+sub cond_stack_endif
 {
   my ($negate, $cond, $where) = @_;
   my $old_cond;
@@ -6145,15 +6025,15 @@ sub cond_stack_endif ($$$)
 ## ------------------------ ##
 
 
-# &define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
-# -----------------------------------------------------
+# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
+# ----------------------------------------------------
 # Like define_variable, but the value is a list, and the variable may
 # be defined conditionally.  The second argument is the condition
 # under which the value should be defined; this should be the empty
 # string to define the variable unconditionally.  The third argument
 # is a list holding the values to use for the variable.  The value is
 # pretty printed in the output file.
-sub define_pretty_variable ($$$@)
+sub define_pretty_variable
 {
     my ($var, $cond, $where, @value) = @_;
 
@@ -6170,7 +6050,7 @@ sub define_pretty_variable ($$$@)
 # --------------------------------------
 # Define a new Automake Makefile variable VAR to VALUE, but only if
 # not already defined.
-sub define_variable ($$$)
+sub define_variable
 {
     my ($var, $value, $where) = @_;
     define_pretty_variable ($var, TRUE, $where, $value);
@@ -6192,14 +6072,14 @@ sub define_files_variable ($\@$$)
 
 # Like define_variable, but define a variable to be the configure
 # substitution by the same name.
-sub define_configure_variable ($)
+sub define_configure_variable
 {
   my ($var) = @_;
   # Some variables we do not want to output.  For instance it
   # would be a bad idea to output `U = @U@` when `@U@` can be
   # substituted as `\`.
   my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
-  Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst $var,
+  Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var),
                              '', $configure_vars{$var}, $pretty);
 }
 
@@ -6208,7 +6088,7 @@ sub define_configure_variable ($)
 # --------------------------------
 # Define a compiler variable.  We also handle defining the 'LT'
 # version of the command when using libtool.
-sub define_compiler_variable ($)
+sub define_compiler_variable
 {
     my ($lang) = @_;
 
@@ -6216,23 +6096,20 @@ sub define_compiler_variable ($)
     my $libtool_tag = '';
     $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
       if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
-    &define_variable ($var, $value, INTERNAL);
+    define_variable ($var, $value, INTERNAL);
     if (var ('LIBTOOL'))
       {
        my $verbose = define_verbose_libtool ();
-       &define_variable ("LT$var",
-                         "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
-                         . "\$(LIBTOOLFLAGS) --mode=compile $value",
-                         INTERNAL);
+       define_variable ("LT$var",
+                         "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)"
+                         . " \$(LIBTOOLFLAGS) --mode=compile $value",
+                         INTERNAL);
       }
     define_verbose_tagvar ($lang->ccer || 'GEN');
 }
 
 
-# define_linker_variable ($LANG)
-# ------------------------------
-# Define linker variables.
-sub define_linker_variable ($)
+sub define_linker_variable
 {
     my ($lang) = @_;
 
@@ -6240,7 +6117,7 @@ sub define_linker_variable ($)
     $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
       if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
     # CCLD = $(CC).
-    &define_variable ($lang->lder, $lang->ld, INTERNAL);
+    define_variable ($lang->lder, $lang->ld, INTERNAL);
     # CCLINK = $(CCLD) blah blah...
     my $link = '';
     if (var ('LIBTOOL'))
@@ -6249,12 +6126,12 @@ sub define_linker_variable ($)
        $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
                . "\$(LIBTOOLFLAGS) --mode=link ";
       }
-    &define_variable ($lang->linker, $link . $lang->link, INTERNAL);
-    &define_variable ($lang->compiler,  $lang);
-    &define_verbose_tagvar ($lang->lder || 'GEN');
+    define_variable ($lang->linker, $link . $lang->link, INTERNAL);
+    define_variable ($lang->compiler, $lang, INTERNAL);
+    define_verbose_tagvar ($lang->lder || 'GEN');
 }
 
-sub define_per_target_linker_variable ($$)
+sub define_per_target_linker_variable
 {
   my ($linker, $target) = @_;
 
@@ -6298,14 +6175,14 @@ sub define_per_target_linker_variable ($$)
   return ($lang->linker, $lang->lder)
     if $link_command eq $orig_command;
 
-  &define_variable ("${target}_LINK", $link_command, INTERNAL);
+  define_variable ("${target}_LINK", $link_command, INTERNAL);
   return ("${target}_LINK", $lang->lder);
 }
 
 ################################################################
 
-# &check_trailing_slash ($WHERE, $LINE)
-# -------------------------------------
+# check_trailing_slash ($WHERE, $LINE)
+# ------------------------------------
 # Return 1 iff $LINE ends with a slash.
 # Might modify $LINE.
 sub check_trailing_slash ($\$)
@@ -6323,15 +6200,16 @@ sub check_trailing_slash ($\$)
 }
 
 
-# &read_am_file ($AMFILE, $WHERE)
-# -------------------------------
+# read_am_file ($AMFILE, $WHERE, $RELDIR)
+# ---------------------------------------
 # Read Makefile.am and set up %contents.  Simultaneously copy lines
 # from Makefile.am into $output_trailer, or define variables as
 # appropriate.  NOTE we put rules in the trailer section.  We want
 # user rules to come after our generated stuff.
-sub read_am_file ($$)
+sub read_am_file
 {
-    my ($amfile, $where) = @_;
+    my ($amfile, $where, $reldir) = @_;
+    my $canon_reldir = &canonicalize ($reldir);
 
     my $am_file = new Automake::XFile ("< $amfile");
     verb "reading $amfile";
@@ -6416,6 +6294,17 @@ sub read_am_file ($$)
 
        my $new_saw_bk = check_trailing_slash ($where, $_);
 
+       if ($reldir eq '.')
+         {
+           # If present, eat the following '_' or '/', converting
+           # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo"
+           # when $reldir is '.'.
+           $_ =~ s,%(D|reldir)%/,,g;
+           $_ =~ s,%(C|canon_reldir)%_,,g;
+         }
+       $_ =~ s/%(D|reldir)%/${reldir}/g;
+       $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g;
+
        if (/$IGNORE_PATTERN/o)
        {
            # Merely delete comments beginning with two hashes.
@@ -6577,8 +6466,10 @@ sub read_am_file ($$)
                push_dist_common ("\$\(srcdir\)/$path");
                $path = $relative_dir . "/" . $path if $relative_dir ne '.';
              }
+           my $new_reldir = File::Spec->abs2rel ($path, $relative_dir);
+           $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,;
            $where->push_context ("'$path' included from here");
-           &read_am_file ($path, $where);
+           read_am_file ($path, $where, $new_reldir);
            $where->pop_context;
        }
        else
@@ -6611,11 +6502,9 @@ sub read_am_file ($$)
 }
 
 
-# define_standard_variables ()
-# ----------------------------
 # A helper for read_main_am_file which initializes configure variables
 # and variables from header-vars.am.
-sub define_standard_variables
+sub define_standard_variables ()
 {
   my $saved_output_vars = $output_vars;
   my ($comments, undef, $rules) =
@@ -6624,14 +6513,16 @@ sub define_standard_variables
 
   foreach my $var (sort keys %configure_vars)
     {
-      &define_configure_variable ($var);
+      define_configure_variable ($var);
     }
 
   $output_vars .= $comments . $rules;
 }
 
-# Read main am file.
-sub read_main_am_file ($$)
+
+# read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN)
+# ----------------------------------------------
+sub read_main_am_file
 {
     my ($amfile, $infile) = @_;
 
@@ -6648,20 +6539,19 @@ sub read_main_am_file ($$)
 
     # We want to predefine as many variables as possible.  This lets
     # the user set them with '+=' in Makefile.am.
-    &define_standard_variables;
+    define_standard_variables;
 
     # Read user file, which might override some of our values.
-    &read_am_file ($amfile, new Automake::Location);
+    read_am_file ($amfile, new Automake::Location, '.');
 }
 
 
 
 ################################################################
 
-# $FLATTENED
-# &flatten ($STRING)
-# ------------------
-# Flatten the $STRING and return the result.
+# $STRING
+# flatten ($ORIGINAL_STRING)
+# --------------------------
 sub flatten
 {
   $_ = shift;
@@ -6676,10 +6566,10 @@ sub flatten
 
 
 # transform_token ($TOKEN, \%PAIRS, $KEY)
-# =======================================
+# ---------------------------------------
 # Return the value associated to $KEY in %PAIRS, as used on $TOKEN
 # (which should be ?KEY? or any of the special %% requests)..
-sub transform_token ($$$)
+sub transform_token ($\%$)
 {
   my ($token, $transform, $key) = @_;
   my $res = $transform->{$key};
@@ -6689,12 +6579,12 @@ sub transform_token ($$$)
 
 
 # transform ($TOKEN, \%PAIRS)
-# ===========================
+# ---------------------------
 # If ($TOKEN, $VAL) is in %PAIRS:
 #   - replaces %KEY% with $VAL,
 #   - enables/disables ?KEY? and ?!KEY?,
 #   - replaces %?KEY% with TRUE or FALSE.
-sub transform ($$)
+sub transform ($\%)
 {
   my ($token, $transform) = @_;
 
@@ -6703,18 +6593,18 @@ sub transform ($$)
   # when there is neither IFTRUE nor IFFALSE.
   if ($token =~ /^%([\w\-]+)%$/)
     {
-      return transform_token ($token, $transform, $1);
+      return transform_token ($token, %$transform, $1);
     }
   # %?KEY%.
   elsif ($token =~ /^%\?([\w\-]+)%$/)
     {
-      return transform_token ($token, $transform, $1) ? 'TRUE' : 'FALSE';
+      return transform_token ($token, %$transform, $1) ? 'TRUE' : 'FALSE';
     }
   # ?KEY? and ?!KEY?.
   elsif ($token =~ /^ \? (!?) ([\w\-]+) \? $/x)
     {
       my $neg = ($1 eq '!') ? 1 : 0;
-      my $val = transform_token ($token, $transform, $2);
+      my $val = transform_token ($token, %$transform, $2);
       return (!!$val == $neg) ? '##%' : '';
     }
   else
@@ -6729,7 +6619,7 @@ sub transform ($$)
 # Load a $MAKEFILE, apply the %TRANSFORM, and return the result.
 # No extra parsing or post-processing is done (i.e., recognition of
 # rules declaration or of make variables definitions).
-sub preprocess_file ($%)
+sub preprocess_file
 {
   my ($file, %transform) = @_;
 
@@ -6781,7 +6671,7 @@ sub preprocess_file ($%)
   # Substitute Automake template tokens.
   s/(?: % \?? [\w\-]+ %
       | \? !? [\w\-]+ \?
-    )/transform($&, \%transform)/gex;
+    )/transform($&, %transform)/gex;
   # transform() may have added some ##%-comments to strip.
   # (we use '##%' instead of '##' so we can distinguish ##%##%##% from
   # ####### and do not remove the latter.)
@@ -6792,11 +6682,11 @@ sub preprocess_file ($%)
 
 
 # @PARAGRAPHS
-# &make_paragraphs ($MAKEFILE, [%TRANSFORM])
-# ------------------------------------------
+# make_paragraphs ($MAKEFILE, [%TRANSFORM])
+# -----------------------------------------
 # Load a $MAKEFILE, apply the %TRANSFORM, and return it as a list of
 # paragraphs.
-sub make_paragraphs ($%)
+sub make_paragraphs
 {
   my ($file, %transform) = @_;
   $transform{FIRST} = !$transformed_files{$file};
@@ -6838,12 +6728,12 @@ sub make_paragraphs ($%)
 
 
 # ($COMMENT, $VARIABLES, $RULES)
-# &file_contents_internal ($IS_AM, $FILE, $WHERE, [%TRANSFORM])
-# -------------------------------------------------------------
+# file_contents_internal ($IS_AM, $FILE, $WHERE, [%TRANSFORM])
+# ------------------------------------------------------------
 # Return contents of a file from $libdir/am, automatically skipping
 # macros or rules which are already known. $IS_AM iff the caller is
 # reading an Automake file (as opposed to the user's Makefile.am).
-sub file_contents_internal ($$$%)
+sub file_contents_internal
 {
     my ($is_am, $file, $where, %transform) = @_;
 
@@ -6937,7 +6827,7 @@ sub file_contents_internal ($$$%)
          my ($targets, $dependencies) = ($1, $2);
          # Remove the escaped new lines.
          # I don't know why, but I have to use a tmp $flat_deps.
-         my $flat_deps = &flatten ($dependencies);
+         my $flat_deps = flatten ($dependencies);
          my @deps = split (' ', $flat_deps);
 
          foreach (split (' ', $targets))
@@ -6961,7 +6851,7 @@ sub file_contents_internal ($$$%)
              # Output only if not in FALSE.
              if (defined $dependencies{$_} && $cond != FALSE)
                {
-                 &depend ($_, @deps);
+                 depend ($_, @deps);
                  register_action ($_, $actions);
                }
              else
@@ -7031,11 +6921,11 @@ sub file_contents_internal ($$$%)
 
 
 # $CONTENTS
-# &file_contents ($BASENAME, $WHERE, [%TRANSFORM])
-# ------------------------------------------------
+# file_contents ($BASENAME, $WHERE, [%TRANSFORM])
+# -----------------------------------------------
 # Return contents of a file from $libdir/am, automatically skipping
 # macros or rules which are already known.
-sub file_contents ($$%)
+sub file_contents
 {
     my ($basename, $where, %transform) = @_;
     my ($comments, $variables, $rules) =
@@ -7046,8 +6936,8 @@ sub file_contents ($$%)
 
 
 # @PREFIX
-# &am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
-# -----------------------------------------------------
+# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
+# ----------------------------------------------------
 # Find all variable prefixes that are used for install directories.  A
 # prefix 'zar' qualifies iff:
 #
@@ -7061,7 +6951,7 @@ sub file_contents ($$%)
 # variable "zardir" is defined, then "zar_PROGRAMS" becomes valid.
 # This is to provide a little extra flexibility in those cases which
 # need it.
-sub am_primary_prefixes ($$@)
+sub am_primary_prefixes
 {
   my ($primary, $can_dist, @prefixes) = @_;
 
@@ -7121,6 +7011,9 @@ sub am_primary_prefixes ($$@)
 }
 
 
+# am_install_var (-OPTION..., file, HOW, where...)
+# ------------------------------------------------
+#
 # 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,
@@ -7135,7 +7028,6 @@ sub am_primary_prefixes ($$@)
 # FIXME: this should be rewritten to be cleaner.  It should be broken
 # up into multiple functions.
 #
-# Usage is: am_install_var (OPTION..., file, HOW, where...)
 sub am_install_var
 {
   my (@args) = @_;
@@ -7240,11 +7132,12 @@ sub am_install_var
            }
          else
            {
-             # Strip any $(EXEEXT) suffix the user might have added, or this
-             # will confuse &handle_source_transform and &check_canonical_spelling.
+             # Strip any $(EXEEXT) suffix the user might have added,
+              # or this will confuse handle_source_transform() and
+              # check_canonical_spelling().
              # We'll add $(EXEEXT) back later anyway.
-             # Do it here rather than in handle_programs so the uniquifying at the
-             # end of this function works.
+             # Do it here rather than in handle_programs so the
+              # uniquifying at the end of this function works.
              ${$locvals}[1] =~ s/\$\(EXEEXT\)$//
                if $primary eq 'PROGRAMS';
 
@@ -7288,18 +7181,17 @@ sub am_install_var
 
       # Singular form of $PRIMARY.
       (my $one_primary = $primary) =~ s/S$//;
-      $output_rules .= &file_contents ($file, $where,
-                                      PRIMARY     => $primary,
-                                      ONE_PRIMARY => $one_primary,
-                                      DIR         => $X,
-                                      NDIR        => $nodir_name,
-                                      BASE        => $strip_subdir,
-
-                                      EXEC      => $exec_p,
-                                      INSTALL   => $install_p,
-                                      DIST      => $dist_p,
-                                      DISTVAR   => $distvar,
-                                      'CK-OPTS' => $check_options_p);
+      $output_rules .= file_contents ($file, $where,
+                                      PRIMARY     => $primary,
+                                      ONE_PRIMARY => $one_primary,
+                                      DIR         => $X,
+                                      NDIR        => $nodir_name,
+                                      BASE        => $strip_subdir,
+                                      EXEC        => $exec_p,
+                                      INSTALL     => $install_p,
+                                      DIST        => $dist_p,
+                                      DISTVAR     => $distvar,
+                                      'CK-OPTS'   => $check_options_p);
     }
 
   # The JAVA variable is used as the name of the Java interpreter.
@@ -7342,6 +7234,8 @@ sub am_install_var
 my %make_dirs = ();
 my $make_dirs_set = 0;
 
+# is_make_dir ($DIRECTORY)
+# ------------------------
 sub is_make_dir
 {
     my ($dir) = @_;
@@ -7393,8 +7287,8 @@ sub locate_aux_dir ()
 }
 
 
-# &push_required_file ($DIR, $FILE, $FULLFILE)
-# --------------------------------------------------
+# push_required_file ($DIR, $FILE, $FULLFILE)
+# -------------------------------------------
 # Push the given file onto DIST_COMMON.
 sub push_required_file
 {
@@ -7430,7 +7324,7 @@ sub push_required_file
       $am_config_libobj_dir =~ s|/*$||;
       push_dist_common ("$am_config_libobj_dir/$file");
     }
-  elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
+  elsif ($relative_dir eq '.' && ! is_make_dir ($dir))
     {
       # If we are doing the topmost directory, and the file is in a
       # subdir which does not have a Makefile, then we distribute it
@@ -7480,10 +7374,10 @@ sub push_required_file
 # than once.
 my %required_file_not_found = ();
 
-# &required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
-# --------------------------------------------------------
+# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
+# -------------------------------------------------------
 # Verify that the file must exist in $DIRECTORY, or install it.
-sub required_file_check_or_copy ($$$)
+sub required_file_check_or_copy
 {
   my ($where, $dir, $file) = @_;
 
@@ -7589,13 +7483,13 @@ sub required_file_check_or_copy ($$$)
 }
 
 
-# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
-# ----------------------------------------------------------------------
+# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
+# ---------------------------------------------------------------------
 # Verify that the file must exist in $DIRECTORY, or install it.
 # $MYSTRICT is the strictness level at which this file becomes required.
 # Worker threads may queue up the action to be serialized by the master,
 # if $QUEUE is true
-sub require_file_internal ($$$@)
+sub require_file_internal
 {
   my ($where, $mystrict, $dir, $queue, @files) = @_;
 
@@ -7618,28 +7512,28 @@ sub require_file_internal ($$$@)
     }
 }
 
-# &require_file ($WHERE, $MYSTRICT, @FILES)
-# -----------------------------------------
-sub require_file ($$@)
+# require_file ($WHERE, $MYSTRICT, @FILES)
+# ----------------------------------------
+sub require_file
 {
     my ($where, $mystrict, @files) = @_;
     require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
 }
 
-# &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# -----------------------------------------------------------
-sub require_file_with_macro ($$$@)
+# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ----------------------------------------------------------
+sub require_file_with_macro
 {
     my ($cond, $macro, $mystrict, @files) = @_;
     $macro = rvar ($macro) unless ref $macro;
     require_file ($macro->rdef ($cond)->location, $mystrict, @files);
 }
 
-# &require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ----------------------------------------------------------------
+# require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
 # Require an AC_LIBSOURCEd file.  If AC_CONFIG_LIBOBJ_DIR was called, it
 # must be in that directory.  Otherwise expect it in the current directory.
-sub require_libsource_with_macro ($$$@)
+sub require_libsource_with_macro
 {
     my ($cond, $macro, $mystrict, @files) = @_;
     $macro = rvar ($macro) unless ref $macro;
@@ -7654,10 +7548,10 @@ sub require_libsource_with_macro ($$$@)
       }
 }
 
-# &queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
-#                                     $MYSTRICT, @FILES)
-# ---------------------------------------------------------------
-sub queue_required_file_check_or_copy ($$$$@)
+# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
+#                                    $MYSTRICT, @FILES)
+# --------------------------------------------------------------
+sub queue_required_file_check_or_copy
 {
     my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
     my @serial_loc;
@@ -7672,9 +7566,9 @@ sub queue_required_file_check_or_copy ($$$$@)
     $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
 }
 
-# &require_queued_file_check_or_copy ($QUEUE)
-# -------------------------------------------
-sub require_queued_file_check_or_copy ($)
+# require_queued_file_check_or_copy ($QUEUE)
+# ------------------------------------------
+sub require_queued_file_check_or_copy
 {
     my ($queue) = @_;
     my $where;
@@ -7705,10 +7599,10 @@ sub require_queued_file_check_or_copy ($)
       }
 }
 
-# &require_conf_file ($WHERE, $MYSTRICT, @FILES)
-# ----------------------------------------------
+# require_conf_file ($WHERE, $MYSTRICT, @FILES)
+# ---------------------------------------------
 # Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
-sub require_conf_file ($$@)
+sub require_conf_file
 {
     my ($where, $mystrict, @files) = @_;
     my $queue = defined $required_conf_file_queue ? 1 : 0;
@@ -7717,9 +7611,9 @@ sub require_conf_file ($$@)
 }
 
 
-# &require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ----------------------------------------------------------------
-sub require_conf_file_with_macro ($$$@)
+# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
+sub require_conf_file_with_macro
 {
     my ($cond, $macro, $mystrict, @files) = @_;
     require_conf_file (rvar ($macro)->rdef ($cond)->location,
@@ -7728,14 +7622,14 @@ sub require_conf_file_with_macro ($$$@)
 
 ################################################################
 
-# &require_build_directory ($DIRECTORY)
-# -------------------------------------
+# require_build_directory ($DIRECTORY)
+# ------------------------------------
 # Emit rules to create $DIRECTORY if needed, and return
 # the file that any target requiring this directory should be made
 # dependent upon.
 # We don't want to emit the rule twice, and want to reuse it
 # for directories with equivalent names (e.g., 'foo/bar' and './foo//bar').
-sub require_build_directory ($)
+sub require_build_directory
 {
   my $directory = shift;
 
@@ -7769,12 +7663,12 @@ sub require_build_directory ($)
   return $dirstamp;
 }
 
-# &require_build_directory_maybe ($FILE)
-# --------------------------------------
+# require_build_directory_maybe ($FILE)
+# -------------------------------------
 # If $FILE lies in a subdirectory, emit a rule to create this
 # directory and return the file that $FILE should be made
 # dependent upon.  Otherwise, just return the empty string.
-sub require_build_directory_maybe ($)
+sub require_build_directory_maybe
 {
     my $file = shift;
     my $directory = dirname ($file);
@@ -7791,7 +7685,7 @@ sub require_build_directory_maybe ($)
 
 ################################################################
 
-# Push a list of files onto dist_common.
+# Push a list of files onto '@dist_common'.
 sub push_dist_common
 {
   prog_error "push_dist_common run after handle_dist"
@@ -7807,7 +7701,7 @@ sub push_dist_common
 # ----------------------------------------------
 # Generate a Makefile.in given the name of the corresponding Makefile and
 # the name of the file output by config.status.
-sub generate_makefile ($$)
+sub generate_makefile
 {
   my ($makefile_am, $makefile_in) = @_;
 
@@ -7822,14 +7716,14 @@ sub generate_makefile ($$)
   # $OUTPUT is encoded.  If it contains a ":" then the first element
   # is the real output file, and all remaining elements are input
   # files.  We don't scan or otherwise deal with these input files,
-  # other than to mark them as dependencies.  See
-  # &scan_autoconf_files for details.
+  # other than to mark them as dependencies.  See the subroutine
+  # 'scan_autoconf_files' for details.
   my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in});
 
   $relative_dir = dirname ($makefile);
 
   read_main_am_file ($makefile_am, $makefile_in);
-  if (handle_options)
+  if (not handle_options)
     {
       # Process buffered warnings.
       flush_messages;
@@ -7879,9 +7773,9 @@ sub generate_makefile ($$)
 
   handle_silent;
 
-  # These must be run after all the sources are scanned.  They
-  # use variables defined by &handle_libraries, &handle_ltlibraries,
-  # or &handle_programs.
+  # These must be run after all the sources are scanned.  They use
+  # variables defined by handle_libraries(), handle_ltlibraries(),
+  # or handle_programs().
   handle_compile;
   handle_languages;
   handle_libtool;
@@ -7982,16 +7876,16 @@ sub generate_makefile ($$)
   print $gm_file $output;
 }
 
-################################################################
-
-
-
 
 ################################################################
 
+
 # Helper function for usage().
-sub print_autodist_files (@)
+sub print_autodist_files
 {
+  # NOTE: we need to call our 'uniq' function with the leading '&'
+  # here, because otherwise perl complains that "Unquoted string
+  # 'uniq' may clash with future reserved word".
   my @lcomm = sort (&uniq (@_));
 
   my @four;
@@ -8033,7 +7927,6 @@ sub print_autodist_files (@)
 }
 
 
-# Print usage information.
 sub usage ()
 {
     print "Usage: $0 [OPTION]... [Makefile]...
@@ -8084,9 +7977,6 @@ General help using GNU software: <http://www.gnu.org/gethelp/>.
 }
 
 
-# &version ()
-# -----------
-# Print version information
 sub version ()
 {
   print <<EOF;
@@ -8139,7 +8029,7 @@ sub parse_arguments ()
   set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
   for my $warning (@warnings)
     {
-      &parse_warnings ('-W', $warning);
+      parse_warnings ('-W', $warning);
     }
 
   return unless @ARGV;
@@ -8170,10 +8060,9 @@ sub parse_arguments ()
 }
 
 
-# handle_makefile ($MAKEFILE_IN)
-# ------------------------------
-# Deal with $MAKEFILE_IN.
-sub handle_makefile ($)
+# handle_makefile ($MAKEFILE)
+# ---------------------------
+sub handle_makefile
 {
   my ($file) =  @_;
   ($am_file = $file) =~ s/\.in$//;
@@ -8193,8 +8082,6 @@ sub handle_makefile ($)
     }
 }
 
-# handle_makefiles_serial ()
-# --------------------------
 # Deal with all makefiles, without threads.
 sub handle_makefiles_serial ()
 {
@@ -8204,10 +8091,8 @@ sub handle_makefiles_serial ()
     }
 }
 
-# get_number_of_threads ()
-# ------------------------
 # Logic for deciding how many worker threads to use.
-sub get_number_of_threads
+sub get_number_of_threads ()
 {
   my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0;
 
@@ -8236,7 +8121,7 @@ sub get_number_of_threads
 #
 # The latter requires that the makefile that deals with the aux dir
 # files be handled last, done by the master thread.
-sub handle_makefiles_threaded ($)
+sub handle_makefiles_threaded
 {
   my ($nthreads) = @_;