Merge branch 'next'
[platform/upstream/automake.git] / automake.in
index 3549bdb..d494907 100755 (executable)
@@ -88,6 +88,9 @@ struct (# Short name of the language (c, f77...).
        # 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)).
@@ -112,7 +115,7 @@ sub finish ($)
   my ($self) = @_;
   if (defined $self->_finish)
     {
-      &{$self->_finish} ();
+      &{$self->_finish} (@_);
     }
 }
 
@@ -569,6 +572,7 @@ my @dist_targets;
 # Keep track of all programs declared in this Makefile, without
 # $(EXEEXT).  @substitutions@ are not listed.
 my %known_programs;
+my %known_libraries;
 
 # Keys in this hash are the basenames of files which must depend on
 # ansi2knr.  Values are either the empty string, or the directory in
@@ -699,6 +703,7 @@ sub initialize_per_input ()
     @dist_targets = ();
 
     %known_programs = ();
+    %known_libraries= ();
 
     %de_ansi_files = ();
 
@@ -729,6 +734,7 @@ register_language ('name' => 'c',
                   'ansi' => 1,
                   'autodep' => '',
                   'flags' => ['CFLAGS', 'CPPFLAGS'],
+                  'ccer' => 'CC',
                   'compiler' => 'COMPILE',
                   'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
                   'lder' => 'CCLD',
@@ -749,6 +755,7 @@ register_language ('name' => 'cxx',
                   'autodep' => 'CXX',
                   'flags' => ['CXXFLAGS', 'CPPFLAGS'],
                   'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
+                  'ccer' => 'CXX',
                   'compiler' => 'CXXCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -767,6 +774,7 @@ register_language ('name' => 'objc',
                   'autodep' => 'OBJC',
                   'flags' => ['OBJCFLAGS', 'CPPFLAGS'],
                   'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
+                  'ccer' => 'OBJC',
                   'compiler' => 'OBJCCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -784,6 +792,7 @@ register_language ('name' => 'upc',
                   'autodep' => 'UPC',
                   'flags' => ['UPCFLAGS', 'CPPFLAGS'],
                   'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)',
+                  'ccer' => 'UPC',
                   'compiler' => 'UPCCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -802,12 +811,29 @@ register_language ('name' => 'header',
                   # Nothing to do.
                   '_finish' => sub { });
 
+# Vala
+register_language ('name' => 'vala',
+                  'Name' => 'Vala',
+                  'config_vars' => ['VALAC'],
+                  'flags' => ['VALAFLAGS'],
+                  'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
+                  'ccer' => 'VALAC',
+                  'compiler' => 'VALACOMPILE',
+                  'extensions' => ['.vala'],
+                  'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/;
+                                               return ($ext,) },
+                  'rule_file' => 'vala',
+                  '_finish' => \&lang_vala_finish,
+                  '_target_hook' => \&lang_vala_target_hook,
+                  'nodist_specific' => 1);
+
 # Yacc (C & C++).
 register_language ('name' => 'yacc',
                   'Name' => 'Yacc',
                   'config_vars' => ['YACC'],
                   'flags' => ['YFLAGS'],
                   'compile' => '$(YACC) $(YFLAGS) $(AM_YFLAGS)',
+                  'ccer' => 'YACC',
                   'compiler' => 'YACCCOMPILE',
                   'extensions' => ['.y'],
                   'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/;
@@ -821,6 +847,7 @@ register_language ('name' => 'yaccxx',
                   'config_vars' => ['YACC'],
                   'rule_file' => 'yacc',
                   'flags' => ['YFLAGS'],
+                  'ccer' => 'YACC',
                   'compiler' => 'YACCCOMPILE',
                   'compile' => '$(YACC) $(YFLAGS) $(AM_YFLAGS)',
                   'extensions' => ['.y++', '.yy', '.yxx', '.ypp'],
@@ -837,6 +864,7 @@ register_language ('name' => 'lex',
                   'rule_file' => 'lex',
                   'flags' => ['LFLAGS'],
                   'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)',
+                  'ccer' => 'LEX',
                   'compiler' => 'LEXCOMPILE',
                   'extensions' => ['.l'],
                   'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
@@ -850,6 +878,7 @@ register_language ('name' => 'lexxx',
                   'rule_file' => 'lex',
                   'flags' => ['LFLAGS'],
                   'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)',
+                  'ccer' => 'LEX',
                   'compiler' => 'LEXCOMPILE',
                   'extensions' => ['.l++', '.ll', '.lxx', '.lpp'],
                   'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
@@ -868,6 +897,7 @@ register_language ('name' => 'asm',
                   # or anything else required.  They can also set CCAS.
                   # Or simply use Preprocessed Assembler.
                   'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+                  'ccer' => 'CCAS',
                   'compiler' => 'CCASCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -884,6 +914,7 @@ register_language ('name' => 'cppasm',
                   'autodep' => 'CCAS',
                   'flags' => ['CCASFLAGS', 'CPPFLAGS'],
                   'compile' => '$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+                  'ccer' => 'CPPAS',
                   'compiler' => 'CPPASCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -900,6 +931,7 @@ register_language ('name' => 'f77',
                   'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'flags' => ['FFLAGS'],
                   'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)',
+                  'ccer' => 'F77',
                   'compiler' => 'F77COMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -917,6 +949,7 @@ register_language ('name' => 'fc',
                   'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'flags' => ['FCFLAGS'],
                   'compile' => '$(FC) $(AM_FCFLAGS) $(FCFLAGS)',
+                  'ccer' => 'FC',
                   'compiler' => 'FCCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -935,6 +968,7 @@ register_language ('name' => 'ppfc',
                   'lder' => 'FCLD',
                   'ld' => '$(FC)',
                   'flags' => ['FCFLAGS', 'CPPFLAGS'],
+                  'ccer' => 'PPFC',
                   'compiler' => 'PPFCCOMPILE',
                   'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
                   'compile_flag' => '-c',
@@ -966,6 +1000,7 @@ register_language ('name' => 'ppf77',
                   'lder' => 'F77LD',
                   'ld' => '$(F77)',
                   'flags' => ['FFLAGS', 'CPPFLAGS'],
+                  'ccer' => 'PPF77',
                   'compiler' => 'PPF77COMPILE',
                   'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
                   'compile_flag' => '-c',
@@ -985,6 +1020,7 @@ register_language ('name' => 'ratfor',
                   'flags' => ['RFLAGS', 'FFLAGS'],
                   # FIXME also FFLAGS.
                   'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)',
+                  'ccer' => 'F77',
                   'compiler' => 'RCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -1001,6 +1037,7 @@ register_language ('name' => 'java',
                   'autodep' => 'GCJ',
                   'flags' => ['GCJFLAGS'],
                   'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)',
+                  'ccer' => 'GCJ',
                   'compiler' => 'GCJCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
@@ -1093,6 +1130,89 @@ sub backname ($)
 
 ################################################################
 
+# `silent-rules' mode handling functions.
+
+# verbose_var (NAME)
+# ------------------
+# The public variable stem used to implement `silent-rules'.
+sub verbose_var ($)
+{
+    my ($name) = @_;
+    return 'AM_V_' . $name;
+}
+
+# verbose_private_var (NAME)
+# --------------------------
+# The naming policy for the private variables for `silent-rules'.
+sub verbose_private_var ($)
+{
+    my ($name) = @_;
+    return 'am__v_' . $name;
+}
+
+# define_verbose_var (NAME, VAL)
+# ------------------------------
+# For `silent-rules' mode, setup VAR and dispatcher, to expand to VAL if silent.
+sub define_verbose_var ($$)
+{
+    my ($name, $val) = @_;
+    my $var = verbose_var ($name);
+    my $pvar = verbose_private_var ($name);
+    if (option 'silent-rules')
+      {
+       # Using `$V' instead of `$(V)' breaks IRIX make.
+       define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL);
+       define_variable ($pvar . '_', '$(' . $pvar . '_$(AM_DEFAULT_VERBOSITY))', INTERNAL);
+       define_variable ($pvar . '_0', $val, INTERNAL);
+      }
+}
+
+# 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 ($)
+{
+    my ($name) = @_;
+    return '$(' . verbose_var ($name) . ')'
+      if (option 'silent-rules');
+    return '';
+}
+
+# silent_flag
+# -----------
+# Contents of %SILENT%: variable to expand to `@' when silent.
+sub silent_flag ()
+{
+    return verbose_flag ('at');
+}
+
+# define_verbose_tagvar (NAME)
+# ----------------------------
+# Engage the needed `silent-rules' machinery for tag NAME.
+sub define_verbose_tagvar ($)
+{
+    my ($name) = @_;
+    if (option 'silent-rules')
+      {
+       define_verbose_var ($name, '@echo "  '. $name . ' ' x (6 - length ($name)) . '" $@;');
+       define_verbose_var ('at', '@');
+      }
+}
+
+# define_verbose_libtool
+# ----------------------
+# Engage the needed `silent-rules' machinery for `libtool --silent'.
+sub define_verbose_libtool ()
+{
+    define_verbose_var ('lt', '--silent');
+    return verbose_flag ('lt');
+}
+
+
+################################################################
+
 
 # Handle AUTOMAKE_OPTIONS variable.  Return 1 on error, 0 otherwise.
 sub handle_options
@@ -1113,6 +1233,10 @@ sub handle_options
        }
     }
 
+  # Override portability-recursive warning.
+  switch_warning ('no-portability-recursive')
+    if option 'silent-rules';
+
   if ($strictness == GNITS)
     {
       set_option ('readme-alpha', INTERNAL);
@@ -1252,6 +1376,9 @@ sub handle_languages
          (option 'no-dependencies' || $lang->autodep eq 'no')
          ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx");
 
+       my $verbose = verbose_flag ($lang->ccer || 'GEN');
+       my $silent = silent_flag ();
+
        my %transform = ('EXT'     => $ext,
                         'PFX'     => $pfx,
                         'FPFX'    => $fpfx,
@@ -1263,6 +1390,8 @@ sub handle_languages
                         SUBDIROBJ     => 0,
                         'DERIVED-EXT' => 'BUG',
                         DIST_SOURCE   => 1,
+                        VERBOSE   => $verbose,
+                        SILENT    => $silent,
                        );
 
        # Generate the appropriate rules for this extension.
@@ -1360,8 +1489,9 @@ sub handle_languages
            my $ptltflags = "${derived}_LIBTOOLFLAGS";
            $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags;
 
+           my $ltverbose = define_verbose_libtool ();
            my $obj_ltcompile =
-             "\$(LIBTOOL) $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
+             "\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
              . "--mode=compile $obj_compile";
 
            # We _need_ `-o' for per object rules.
@@ -1482,6 +1612,8 @@ sub handle_languages
                             OBJOBJ    => "$obj.obj",
                             LTOBJ     => "$obj.lo",
 
+                            VERBOSE   => $verbose,
+                            SILENT    => $silent,
                             COMPILE   => $obj_compile,
                             LTCOMPILE => $obj_ltcompile,
                             -o        => $output_flag,
@@ -1540,6 +1672,9 @@ sub handle_languages
          unless defined $done{$languages{'c'}};
        define_linker_variable ($languages{'c'});
       }
+
+    # Always provide the user with `AM_V_GEN' for `silent-rules' mode.
+    define_verbose_tagvar ('GEN');
 }
 
 
@@ -1802,7 +1937,16 @@ sub handle_single_transform ($$$$$%)
            {
                my $obj_sans_ext = substr ($object, 0,
                                           - length ($this_obj_ext));
-               my $full_ansi = $full;
+               my $full_ansi;
+               if ($directory ne '')
+                 {
+                       $full_ansi = $directory . '/' . $base . $extension;
+                 }
+               else
+                 {
+                       $full_ansi = $base . $extension;
+                 }
+
                if ($lang->ansi && option 'ansi2knr')
                  {
                    $full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/;
@@ -2508,7 +2652,8 @@ sub handle_programs
       set_seen ($xname . '_LDFLAGS');
 
       # Determine program to use for link.
-      my $xlink = &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 into a subdirectory,
       # make sure this directory will exist.
@@ -2521,6 +2666,7 @@ sub handle_programs
                                       PROGRAM  => $one_file,
                                       XPROGRAM => $xname,
                                       XLINK    => $xlink,
+                                      VERBOSE  => $vlink,
                                       DIRSTAMP => $dirstamp,
                                       EXEEXT   => '$(EXEEXT)');
 
@@ -2559,6 +2705,7 @@ sub handle_libraries
 
   &define_variable ('AR', 'ar', INTERNAL);
   &define_variable ('ARFLAGS', 'cru', INTERNAL);
+  &define_verbose_tagvar ('AR');
 
   foreach my $pair (@liblist)
     {
@@ -2577,6 +2724,8 @@ sub handle_libraries
               . "did you mean `$suggestion'?")
        }
 
+      ($known_libraries{$onelib} = $bn) =~ s/\.a$//;
+
       $where->push_context ("while processing library `$onelib'");
       $where->set (INTERNAL->get);
 
@@ -2618,9 +2767,13 @@ sub handle_libraries
       # If the resulting library lies into a subdirectory,
       # make sure this directory will exist.
       my $dirstamp = require_build_directory_maybe ($onelib);
+      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);
@@ -2778,6 +2931,8 @@ sub handle_ltlibraries
               . "did you mean `$suggestion'?")
        }
 
+      ($known_libraries{$onelib} = $bn) =~ s/\.la$//;
+
       $where->push_context ("while processing Libtool library `$onelib'");
       $where->set (INTERNAL->get);
 
@@ -2807,7 +2962,8 @@ sub handle_ltlibraries
                                             NONLIBTOOL => 0, LIBTOOL => 1);
 
       # Determine program to use for link.
-      my $xlink = &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";
       my $rpath = "\$($rpathvar)";
@@ -2857,6 +3013,7 @@ sub handle_ltlibraries
                                       XLTLIBRARY => $xlib,
                                       RPATH      => $rpath,
                                       XLINK      => $xlink,
+                                      VERBOSE    => $vlink,
                                       DIRSTAMP   => $dirstamp);
       if ($seen_libobjs)
        {
@@ -2886,7 +3043,7 @@ sub check_typos ()
            {
              $varname =~ /^(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
              msg_var ('syntax', $var, "variable `$varname' is defined but no"
-                      . " program or\nlibrary has `$1' as canonic name"
+                      . " program or\nlibrary has `$1' as canonical name"
                       . " (possible typo)")
                unless $var->rdef ($cond)->seen;
            }
@@ -3093,7 +3250,7 @@ sub output_texinfo_build_rules ($$$@)
 }
 
 
-# $TEXICLEANS
+# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN)
 # handle_texinfo_helper ($info_texinfos)
 # --------------------------------------
 # Handle all Texinfo source; helper for handle_texinfo.
@@ -3103,7 +3260,7 @@ sub handle_texinfo_helper ($)
   my (@infobase, @info_deps_list, @texi_deps);
   my %versions;
   my $done = 0;
-  my @texi_cleans;
+  my (@mostly_cleans, @texi_cleans, @maint_cleans) = ('', '', '');
 
   # Build a regex matching user-cleaned files.
   my $d = var 'DISTCLEANFILES';
@@ -3134,7 +3291,7 @@ sub handle_texinfo_helper ($)
       my ($out_file, $vtexi, @clean_files) =
        scan_texinfo_file ("$relative_dir/$texi")
        or next;
-      push (@texi_cleans, @clean_files);
+      push (@mostly_cleans, @clean_files);
 
       # If the Texinfo source is in a subdirectory, create the
       # resulting info in this subdirectory.  If it is in the current
@@ -3377,7 +3534,9 @@ sub handle_texinfo_helper ($)
        }
     }
 
-  return makefile_wrap ("", "\t  ", @texi_cleans);
+  return (makefile_wrap ("", "\t  ", @mostly_cleans),
+         makefile_wrap ("", "\t  ", @texi_cleans),
+         makefile_wrap ("", "\t  ", @maint_cleans));
 }
 
 
@@ -3391,14 +3550,20 @@ sub handle_texinfo ()
   reject_var 'html_TEXINFOS', "HTML generation not yet supported";
 
   my $info_texinfos = var ('info_TEXINFOS');
-  my $texiclean = "";
+  my ($mostlyclean, $clean, $maintclean) = ('', '', '');
   if ($info_texinfos)
     {
-      $texiclean = handle_texinfo_helper ($info_texinfos);
+      ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
+      chomp $mostlyclean;
+      chomp $clean;
+      chomp $maintclean;
     }
+
   $output_rules .=  file_contents ('texinfos',
                                   new Automake::Location,
-                                  TEXICLEAN     => $texiclean,
+                                  MOSTLYCLEAN   => $mostlyclean,
+                                  TEXICLEAN     => $clean,
+                                  MAINTCLEAN    => $maintclean,
                                   'LOCAL-TEXIS' => !!$info_texinfos);
 }
 
@@ -4048,6 +4213,9 @@ sub handle_configure ($$$@)
   define_pretty_variable ('am__configure_deps', TRUE, INTERNAL,
                          @configuredeps);
 
+  my $automake_options = '--' . (global_option 'cygnus' ? 'cygnus' : $strictness_name)
+                        . (global_option 'no-dependencies' ? ' --ignore-deps' : '');
+
   $output_rules .= file_contents
     ('configure',
      new Automake::Location,
@@ -4057,12 +4225,10 @@ sub handle_configure ($$$@)
      'MAKEFILE-IN'         => $rel_makefile_in,
      'MAKEFILE-IN-DEPS'    => "@include_stack",
      'MAKEFILE-AM'         => $rel_makefile_am,
-     STRICTNESS            => global_option 'cygnus'
-                               ? 'cygnus' : $strictness_name,
-     'USE-DEPS'            => global_option 'no-dependencies'
-                               ? ' --ignore-deps' : '',
+     'AUTOMAKE-OPTIONS'    => $automake_options,
      'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile",
-     'REGEN-ACLOCAL-M4'    => $regen_aclocal_m4);
+     'REGEN-ACLOCAL-M4'    => $regen_aclocal_m4,
+     VERBOSE               => verbose_flag ('GEN'));
 
   if ($relative_dir eq '.')
     {
@@ -4747,13 +4913,119 @@ sub handle_tests
     {
       push (@check_tests, 'check-TESTS');
       $output_rules .= &file_contents ('check', new Automake::Location,
-                                      COLOR => !! option 'color-tests');
+                                      COLOR => !! option 'color-tests',
+                                      PARALLEL_TESTS => !! option 'parallel-tests');
 
       # Tests that are known programs should have $(EXEEXT) appended.
       # For matching purposes, we need to adjust XFAIL_TESTS as well.
       append_exeext { exists $known_programs{$_[0]} } 'TESTS';
       append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
        if (var ('XFAIL_TESTS'));
+
+      if (option 'parallel-tests')
+        {
+         define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
+         define_variable ('TEST_SUITE_HTML', '$(TEST_SUITE_LOG:.log=.html)', INTERNAL);
+         my $suff = '.test';
+         my $at_exeext = '';
+         my $handle_exeext = exists $configure_vars{'EXEEXT'};
+         if ($handle_exeext)
+           {
+             $at_exeext = subst ('EXEEXT');
+             $suff = $at_exeext  . ' ' . $suff;
+           }
+         define_variable ('TEST_EXTENSIONS', $suff, INTERNAL);
+         # FIXME: this mishandles conditions.
+         my @test_suffixes = (var 'TEST_EXTENSIONS')->value_as_list_recursive;
+         if ($handle_exeext)
+           {
+             unshift (@test_suffixes, $at_exeext)
+               unless $test_suffixes[0] eq $at_exeext;
+           }
+         unshift (@test_suffixes, '');
+
+         transform_variable_recursively
+           ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL,
+             sub {
+               my ($subvar, $val, $cond, $full_cond) = @_;
+               my $obj = $val;
+               return $obj
+                 if $val =~ /^\@.*\@$/;
+               $obj =~ s/\$\(EXEEXT\)$//o;
+
+               if ($val =~ /(\$\((top_)?srcdir\))\//o)
+                 {
+                   msg ('error', $subvar->rdef ($cond)->location,
+                        "parallel-tests: using `$1' in TESTS is currently broken: `$val'");
+                 }
+
+               foreach my $test_suffix (@test_suffixes)
+                 {
+                   next
+                     if $test_suffix eq $at_exeext || $test_suffix eq '';
+                   return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log'
+                     if substr ($obj, - length ($test_suffix)) eq $test_suffix;
+                 }
+               $obj .= '.log';
+               my $compile = 'LOG_COMPILE';
+               define_variable ($compile,
+                                '$(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)', INTERNAL);
+               $output_rules .= file_contents ('check2', new Automake::Location,
+                                               GENERIC => 0,
+                                               OBJ => $obj,
+                                               SOURCE => $val,
+                                               COMPILE =>'$(' . $compile . ')',
+                                               EXT => '',
+                                               am__EXEEXT => 'FALSE');
+               return $obj;
+             });
+
+         my $nhelper=1;
+         my $prev = 'TESTS';
+         my $post = '';
+         my $last_suffix = $test_suffixes[$#test_suffixes];
+         my $cur = '';
+         foreach my $test_suffix (@test_suffixes)
+           {
+             if ($test_suffix eq $last_suffix)
+               {
+                 $cur = 'TEST_LOGS';
+               }
+             else
+               {
+                 $cur = 'am__test_logs' . $nhelper;
+               }
+             define_variable ($cur,
+               '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL);
+             $post = '.log';
+             $prev = $cur;
+             $nhelper++;
+             if ($test_suffix ne $at_exeext && $test_suffix ne '')
+               {
+                 (my $ext = $test_suffix) =~ s/^\.//;
+                 $ext = uc $ext;
+                 my $compile = $ext . '_LOG_COMPILE';
+                 define_variable ($compile,
+                                  '$(' . $ext . '_LOG_COMPILER) $(AM_' .  $ext . '_LOG_FLAGS)'
+                                  . ' $(' . $ext . '_LOG_FLAGS)', INTERNAL);
+                 my $am_exeext = $handle_exeext ? 'am__EXEEXT' : 'FALSE';
+                 $output_rules .= file_contents ('check2', new Automake::Location,
+                                                 GENERIC => 1,
+                                                 OBJ => '',
+                                                 SOURCE => '$<',
+                                                 COMPILE => '$(' . $compile . ')',
+                                                 EXT => $test_suffix,
+                                                 am__EXEEXT => $am_exeext);
+               }
+           }
+
+         define_variable ('TEST_LOGS_TMP', '$(TEST_LOGS:.log=.log-t)', INTERNAL);
+
+         $clean_files{'$(TEST_LOGS_TMP)'} = MOSTLY_CLEAN;
+         $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
+         $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
+         $clean_files{'$(TEST_SUITE_HTML)'} = MOSTLY_CLEAN;
+       }
     }
 }
 
@@ -4956,6 +5228,7 @@ sub scan_autoconf_traces ($)
                AM_INIT_AUTOMAKE => 0,
                AM_MAINTAINER_MODE => 0,
                AM_PROG_CC_C_O => 0,
+               AM_SILENT_RULES => 0,
                _AM_SUBST_NOTMAKE => 1,
                _AM_COND_IF => 1,
                _AM_COND_ELSE => 1,
@@ -5149,6 +5422,10 @@ sub scan_autoconf_traces ($)
        {
          $seen_cc_c_o = $where;
        }
+      elsif ($macro eq 'AM_SILENT_RULES')
+        {
+         set_global_option ('silent-rules', $where);
+       }
       elsif ($macro eq '_AM_COND_IF')
         {
          cond_stack_if ('', $args[1], $where);
@@ -5483,6 +5760,15 @@ sub lang_header_rewrite
     return LANG_IGNORE;
 }
 
+# Rewrite a single Vala source file.
+sub lang_vala_rewrite
+{
+    my ($directory, $base, $ext) = @_;
+
+    (my $newext = $ext) =~ s/vala$/c/;
+    return (LANG_SUBDIR, $newext);
+}
+
 # Rewrite a single yacc file.
 sub lang_yacc_rewrite
 {
@@ -5641,6 +5927,84 @@ sub lang_c_finish
     }
 }
 
+sub lang_vala_finish_target ($$)
+{
+  my ($self, $name) = @_;
+
+  my $derived = canonicalize ($name);
+  my $varname = $derived . '_SOURCES';
+  my $var = var ($varname);
+
+  if ($var)
+    {
+      foreach my $file ($var->value_as_list_recursive)
+        {
+          $output_rules .= "$file: ${derived}_vala.stamp\n".
+            "\t\@if test -f \$@; then :; else \\\n".
+            "\t  rm -f ${derived}_vala.stamp; \\\n".
+            "\t  \$(MAKE) \$(AM_MAKEFLAGS) ${derived}_vala.stamp; \\\n".
+            "\tfi\n"
+            if $file =~ s/(.*)\.vala$/$1.c/;
+        }
+    }
+
+  my $compile = $self->compile;
+
+  # Rewrite each occurrence of `AM_$flag' in the compile
+  # rule into `${derived}_$flag' if it exists.
+  for my $flag (@{$self->flags})
+    {
+      my $val = "${derived}_$flag";
+      $compile =~ s/\(AM_$flag\)/\($val\)/
+        if set_seen ($val);
+    }
+
+  my $dirname = dirname ($name);
+
+  # Only generate C code, do not run C compiler
+  $compile .= " -C";
+
+  my $verbose = verbose_flag ('VALAC');
+  my $silent = silent_flag ();
+
+  $output_rules .=
+    "${derived}_vala.stamp: \$(${derived}_SOURCES)\n".
+    "\t${verbose}${compile} \$(${derived}_SOURCES)\n".
+    "\t${silent}touch \$@\n";
+
+  push_dist_common ("${derived}_vala.stamp");
+
+  $clean_files{"${derived}_vala.stamp"} = MAINTAINER_CLEAN;
+}
+
+# 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
+{
+  my ($self) = @_;
+
+  foreach my $prog (keys %known_programs)
+    {
+      lang_vala_finish_target ($self, $prog);
+    }
+
+  while (my ($name) = each %known_libraries)
+    {
+      lang_vala_finish_target ($self, $name);
+    }
+}
+
+# The built .c files should be cleaned only on maintainer-clean
+# as the .c files are distributed. This function is called for each
+# .vala source file.
+sub lang_vala_target_hook
+{
+  my ($self, $aggregate, $output, $input, %transform) = @_;
+
+  $clean_files{$output} = MAINTAINER_CLEAN;
+}
+
 # This is a yacc helper which is called whenever we have decided to
 # compile a yacc file.
 sub lang_yacc_target_hook
@@ -6124,11 +6488,15 @@ sub define_compiler_variable ($)
     $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
       if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
     &define_variable ($var, $value, INTERNAL);
-    &define_variable ("LT$var",
-                     "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) "
-                     . "\$(LIBTOOLFLAGS) --mode=compile $value",
-                     INTERNAL)
-      if var ('LIBTOOL');
+    if (var ('LIBTOOL'))
+      {
+       my $verbose = define_verbose_libtool ();
+       &define_variable ("LT$var",
+                         "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
+                         . "\$(LIBTOOLFLAGS) --mode=compile $value",
+                         INTERNAL);
+      }
+    define_verbose_tagvar ($lang->ccer || 'GEN');
 }
 
 
@@ -6145,12 +6513,16 @@ sub define_linker_variable ($)
     # CCLD = $(CC).
     &define_variable ($lang->lder, $lang->ld, INTERNAL);
     # CCLINK = $(CCLD) blah blah...
-    &define_variable ($lang->linker,
-                     ((var ('LIBTOOL') ?
-                       "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) "
-                       . "\$(LIBTOOLFLAGS) --mode=link " : '')
-                      . $lang->link),
-                     INTERNAL);
+    my $link = '';
+    if (var ('LIBTOOL'))
+      {
+       my $verbose = define_verbose_libtool ();
+       $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');
 }
 
 sub define_per_target_linker_variable ($$)
@@ -6174,8 +6546,9 @@ sub define_per_target_linker_variable ($$)
       $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
        if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
 
+      my $verbose = define_verbose_libtool ();
       $link_command =
-       "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) "
+       "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) "
        . "--mode=link " . $link_command;
     }
 
@@ -6193,11 +6566,11 @@ sub define_per_target_linker_variable ($$)
 
   # If the computed command is the same as the generic command, use
   # the command linker variable.
-  return $lang->linker
+  return ($lang->linker, $lang->lder)
     if $link_command eq $orig_command;
 
   &define_variable ("${target}_LINK", $link_command, INTERNAL);
-  return "${target}_LINK";
+  return ("${target}_LINK", $lang->lder);
 }
 
 ################################################################
@@ -8011,7 +8384,7 @@ sub parse_arguments ()
      'f|force-missing'  => \$force_missing,
      'o|output-dir=s'  => \$output_directory,
      'a|add-missing'   => \$add_missing,
-     'c|copy'          => \$copy_missing,
+     'c|copy'          => \$copy_missing,
      'v|verbose'       => sub { setup_channel 'verb', silent => 0; },
      'W|warnings=s'     => \&parse_warnings,
      # These long options (--Werror and --Wno-error) for backward