Merge branch 'maint'
[platform/upstream/automake.git] / automake.in
index 91133bd..faa2d29 100644 (file)
@@ -373,8 +373,6 @@ my $libtool_new_api = 0;
 
 # Most important AC_CANONICAL_* macro seen so far.
 my $seen_canonical = 0;
-# Location of that macro.
-my $canonical_location;
 
 # Where AM_MAINTAINER_MODE appears.
 my $seen_maint_mode;
@@ -484,16 +482,10 @@ my $am_file = 'BUG';
 ## ------------------------------------------ ##
 
 # Basename and relative dir of the input file.
-my $am_file_name;
 my $am_relative_dir;
-
 # Same but wrt Makefile.in.
-my $in_file_name;
 my $relative_dir;
 
-# Relative path to the top directory.
-my $topsrcdir;
-
 # Greatest timestamp of the output's dependencies (excluding
 # configure's dependencies).
 my $output_deps_greatest_timestamp;
@@ -642,12 +634,8 @@ sub initialize_per_input ()
 {
     reset_local_duplicates ();
 
-    $am_file_name = undef;
     $am_relative_dir = undef;
-
-    $in_file_name = undef;
     $relative_dir = undef;
-    $topsrcdir = undef;
 
     $output_deps_greatest_timestamp = 0;
 
@@ -2302,8 +2290,10 @@ sub handle_LIBOBJS_or_ALLOCA ($)
          # we are already there, and since the targets are built without
          # a $(top_builddir), it helps BSD Make to match them with
          # dependencies.
-         $dir = "$config_libobj_dir/" if $config_libobj_dir ne '.';
-         $dir = "$topsrcdir/$dir" if $relative_dir ne '.';
+         $dir = "$config_libobj_dir/"
+           if $config_libobj_dir ne '.';
+         $dir = backname ($relative_dir) . "/$dir"
+           if $relative_dir ne '.';
          define_variable ('LIBOBJDIR', "$dir", INTERNAL);
          $clean_files{"\$($var)"} = MOSTLY_CLEAN;
          # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
@@ -5201,7 +5191,6 @@ sub scan_autoconf_traces ($)
          if ($seen_canonical <= AC_CANONICAL_BUILD)
            {
              $seen_canonical = AC_CANONICAL_BUILD;
-             $canonical_location = $where;
            }
        }
       elsif ($macro eq 'AC_CANONICAL_HOST')
@@ -5209,13 +5198,11 @@ sub scan_autoconf_traces ($)
          if ($seen_canonical <= AC_CANONICAL_HOST)
            {
              $seen_canonical = AC_CANONICAL_HOST;
-             $canonical_location = $where;
            }
        }
       elsif ($macro eq 'AC_CANONICAL_TARGET')
        {
          $seen_canonical = AC_CANONICAL_TARGET;
-         $canonical_location = $where;
        }
       elsif ($macro eq 'AC_CONFIG_AUX_DIR')
        {
@@ -6707,9 +6694,9 @@ sub define_standard_variables
 }
 
 # Read main am file.
-sub read_main_am_file
+sub read_main_am_file ($$)
 {
-    my ($amfile) = @_;
+    my ($amfile, $infile) = @_;
 
     # This supports the strange variable tricks we are about to play.
     prog_error ("variable defined before read_main_am_file\n" . variables_dump ())
@@ -6717,8 +6704,8 @@ sub read_main_am_file
 
     # Generate copyright header for generated Makefile.in.
     # We do discard the output of predefined variables, handled below.
-    $output_vars = ("# $in_file_name generated by automake "
-                  . $VERSION . " from $am_file_name.\n");
+    $output_vars = ("# " . basename ($infile) . " generated by automake "
+                  . $VERSION . " from " . basename ($amfile) . ".\n");
     $output_vars .= '# ' . subst ('configure_input') . "\n";
     $output_vars .= $gen_copyright;
 
@@ -7897,11 +7884,6 @@ sub generate_makefile ($$)
   # we have processed AUTOMAKE_OPTIONS.
   buffer_messages ('warning');
 
-  # Name of input file ("Makefile.am") and output file
-  # ("Makefile.in").  These have no directory components.
-  $am_file_name = basename ($makefile_am);
-  $in_file_name = basename ($makefile_in);
-
   # $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,
@@ -7911,9 +7893,8 @@ sub generate_makefile ($$)
 
   $relative_dir = dirname ($makefile);
   $am_relative_dir = dirname ($makefile_am);
-  $topsrcdir = backname ($relative_dir);
 
-  read_main_am_file ($makefile_am);
+  read_main_am_file ($makefile_am, $makefile_in);
   if (handle_options)
     {
       # Process buffered warnings.