automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

require_file_* factorization + compile&depcomp requirement minor fixes


From: Alexandre Duret-Lutz
Subject: require_file_* factorization + compile&depcomp requirement minor fixes
Date: 22 Sep 2001 18:43:29 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

[This does NOT fix Pavel's distcommon2.test]

There was some code shared between these three Automake functions:

  require_config_file              (require a file from configure.ac)
  require_conf_file_with_conf_line (require a file from configure.ac:line)
  require_conf_file_with_line      (require a file from Makefile.am:line)

This patch moves all the code in the new function
`require_aux_file_with_line', and also adds

  require_conf_file                (require a file from Makefile.am)

(I can't say I really like the naming scheme used here, but I
don't have a better idea to offer...)

Finally, `depcomp' and `compile' are required with
`require_conf_file' instead of `require_config_file'.  That way,
running `automake --foreign --add-missing' on the files from
Pavel's distcommon2.test, you get 

automake: configure.ac: installing `./install-sh'
automake: configure.ac: installing `./mkinstalldirs'
automake: configure.ac: installing `./missing'
automake: subdir/Makefile.am: installing `./compile'
automake: subdir/Makefile.am: installing `./depcomp'

which obviously is more accurate than the 1.5 output:

automake: configure.ac: installing `./install-sh'
automake: configure.ac: installing `./mkinstalldirs'
automake: configure.ac: installing `./missing'
automake: configure.ac: installing `./compile'
automake: configure.ac: installing `./depcomp'

OK for HEAD and branch-real-1-5 ?

2001-09-22  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (handle_languages, handle_single_transform_list,
        lang_c_rewrite): Use require_conf_file instead of
        require_config_file to require depcomp or compile from Makefile.am.
        (require_aux_file_with_line): New function, adapted from
        require_conf_file_with_line.
        (require_conf_file_with_line, require_conf_file_with_conf_line):
        Simplify using require_aux_file_with_line.
        (require_config_file): Simplify using require_conf_file_with_conf_line.
        (require_conf_file): New function.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1173
diff -u -b -u -r1.1173 automake.in
--- automake.in 2001/08/28 03:53:10     1.1173
+++ automake.in 2001/09/22 15:52:50
@@ -1509,7 +1509,7 @@
            # Set location of depcomp.
            &define_variable ('depcomp', "\$(SHELL) $config_aux_dir/depcomp");
 
-           &require_config_file ($FOREIGN, 'depcomp');
+           &require_conf_file ($FOREIGN, 'depcomp');
 
            my @deplist = sort keys %dep_files;
 
@@ -1873,7 +1873,7 @@
                 }
                 $object = $dname . '-' . $object;
 
-                &require_config_file ($FOREIGN, 'compile')
+                &require_conf_file ($FOREIGN, 'compile')
                     if $lang->name eq 'c';
 
                 &prog_error ("$lang->name flags defined without compiler")
@@ -5037,7 +5037,7 @@
            &am_error ("C objects in subdir but `AM_PROG_CC_C_O' not in 
`$configure_ac'");
        }
 
-       &require_config_file ($FOREIGN, 'compile');
+       &require_conf_file ($FOREIGN, 'compile');
     }
 
     $de_ansi_files{$base} = 1;
@@ -7850,13 +7850,18 @@
     &require_file_internal (0, '', @_);
 }
 
-# Require a file that is also required by Autoconf.  Looks in
-# configuration path, as specified by AC_CONFIG_AUX_DIR.
-sub require_config_file
+# Require an auxiliary file.
+# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
+sub require_aux_file_with_line
 {
+    my $from = shift;  # 1 for configure.ac, 0 for Makefile.am
+    my $line = shift;
     @require_file_paths = @config_aux_path;
-    &require_file_internal (1, '', @_);
+    &require_file_internal ($from, $line, @_);
     my $dir = $require_file_paths[0];
+    # &require_file_internal pruned the file path to the
+    # exact directory where the file is lying.  Update
+    # @config_aux_path to speed up future uses.
     @config_aux_path = @require_file_paths;
      # Avoid unsightly '/.'s.
     $config_aux_dir = '$(top_srcdir)' . ($dir eq '.' ? "" : "/$dir");
@@ -7865,23 +7870,25 @@
 # Assumes that the line number is in Makefile.am.
 sub require_conf_file_with_line
 {
-    @require_file_paths = @config_aux_path;
-    &require_file_internal (0, @_);
-    my $dir = $require_file_paths[0];
-    @config_aux_path = @require_file_paths;
-     # Avoid unsightly '/.'s.
-    $config_aux_dir = '$(top_srcdir)' . ($dir eq '.' ? "" : "/$dir");
+    &require_aux_file_with_line (0, @_);
+}
+
+# File required from a Makefile.am.  No line number available.
+sub require_conf_file
+{
+    &require_conf_file_with_line ('', @_);
 }
 
 # Assumes that the line number is in configure.ac.
 sub require_conf_file_with_conf_line
 {
-    @require_file_paths = @config_aux_path;
-    &require_file_internal (1, @_);
-    my $dir = $require_file_paths[0];
-    @config_aux_path = @require_file_paths;
-    # avoid unsightly '/.'s.
-    $config_aux_dir = '$(top_srcdir)' . ($dir eq '.' ? "" : "/$dir");
+    &require_aux_file_with_line (1, @_);
+}
+
+# Require a file that is also required by Autoconf.  No line number available.
+sub require_config_file
+{
+    &require_conf_file_with_conf_line ('', @_);
 }
 
 ################################################################

-- 
Alexandre Duret-Lutz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]