automake-patches
[Top][All Lists]
Advanced

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

Configure_ac.pm


From: Akim Demaille
Subject: Configure_ac.pm
Date: Thu, 21 Aug 2003 09:36:52 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

autoreconf needs to be able to pass the directory where we look for
configure.ac, hence this update.  OK?

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * lib/Automake/Configure_ac.pm (&find_configure_ac)
        (&require_configure_ac): Accept an optional directory argument.
        ($configure_ac): Remove.
        * aclocal.in, automake.in ($configure_ac): New.
        * lib/Automake/Variable.pm: Don't use $configure_ac, just
        configure.ac.

Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.84
diff -u -u -w -u -r1.84 aclocal.in
--- aclocal.in 7 Aug 2003 00:32:29 -0000 1.84
+++ aclocal.in 21 Aug 2003 07:35:07 -0000
@@ -52,6 +52,9 @@
 
 # Some globals.
 
+# configure.ac or configure.in.
+my $configure_ac = require_configure_ac;
+
 # Exit status.
 $exit_status = 0;
 
@@ -235,8 +238,6 @@
 
 sub scan_configure ()
 {
-    require_configure_ac;
-
     if (! open (CONFIGURE, $configure_ac))
       {
        print STDERR "aclocal: couldn't open `$configure_ac': $!\n";
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1498
diff -u -u -w -u -r1.1498 automake.in
--- automake.in 12 Aug 2003 17:52:07 -0000 1.1498
+++ automake.in 21 Aug 2003 07:35:08 -0000
@@ -288,6 +288,9 @@
 ## Variables filled during files scanning.  ##
 ## ---------------------------------------- ##
 
+# Name of the configure.ac file.
+my $configure_ac = require_configure_ac;
+
 # Files found by scanning configure.ac for LIBOBJS.
 my %libsources = ();
 
@@ -3268,7 +3271,7 @@
 # &scan_aclocal_m4
 # ----------------
 # If aclocal.m4 creation is automated, return the list of its dependencies.
-sub scan_aclocal_m4
+sub scan_aclocal_m4 ()
 {
     my $regen_aclocal = 0;
 
@@ -3363,7 +3366,7 @@
 
   my @rewritten = rewrite_inputs_into_dependencies (1, @secondary_inputs);
 
-  my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4 ();
+  my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4;
 
 
   define_pretty_variable ('am__configure_deps', TRUE, INTERNAL,
@@ -4169,7 +4172,7 @@
 # -------------------------------------------
 # 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 ($config_files) = @_;
     # Look at potential Makefile.am's.
@@ -4383,14 +4386,14 @@
 # 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.
-sub scan_autoconf_files
+sub scan_autoconf_files ()
 {
     # Reinitialize libsources here.  This isn't really necessary,
     # since we currently assume there is only one configure.ac.  But
     # that won't always be the case.
     %libsources = ();
 
-    scan_autoconf_traces (require_configure_ac);
+  scan_autoconf_traces ($configure_ac);
 
     # Set input and output files if not specified by user.
     if (! @input_files)
@@ -6462,9 +6465,11 @@
 
 ################################################################
 
+# generate_makefile ($OUTPUT, $MAKEFILE)
+# --------------------------------------
 # 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 ($output, $makefile) = @_;
 
Index: lib/Automake/Configure_ac.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Configure_ac.pm,v
retrieving revision 1.2
diff -u -u -w -u -r1.2 Configure_ac.pm
--- lib/Automake/Configure_ac.pm 3 Jun 2003 21:09:22 -0000 1.2
+++ lib/Automake/Configure_ac.pm 21 Aug 2003 07:35:08 -0000
@@ -25,7 +25,7 @@
 use vars qw (@ISA @EXPORT);
 
 @ISA = qw (Exporter);
address@hidden = qw ($configure_ac &find_configure_ac &require_configure_ac);
address@hidden = qw (&find_configure_ac &require_configure_ac);
 
 =head1 NAME
 
@@ -42,37 +42,45 @@
   # Likewise, but bomb out if the file does not exist.
   my $filename = require_configure_ac;
 
-In both cases, the name of the file found is also put in the
-C<$configure_ac> global variable.
+  # Likewise, but in $dir.
+  my $filename = find_configure_ac ($dir);
+  my $filename = require_configure_ac ($dir);
 
 =cut
 
-use vars '$configure_ac';
-
-sub find_configure_ac ()
+sub find_configure_ac (;@)
 {
-  if (-f 'configure.ac')
+  my ($directory) = @_;
+  $directory ||= '.';
+  my $configure_ac =
+    File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.ac'));
+  my $configure_in =
+    File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.in'));
+
+  if (-f $configure_ac)
     {
-      if (-f 'configure.in')
+      if (-f $configure_in)
        {
          msg ('unsupported',
-              "`configure.ac' and `configure.in' both present.\n"
-              . "proceeding with `configure.ac'.");
+              "`$configure_ac' and `$configure_in' both present.\n"
+              . "proceeding with `$configure_ac'.");
        }
-      $configure_ac = 'configure.ac';
+      return $configure_ac
     }
   elsif (-f 'configure.in')
     {
-      $configure_ac = 'configure.in';
+      return $configure_in;
     }
   return $configure_ac;
 }
 
-sub require_configure_ac ()
+
+sub require_configure_ac (;$)
 {
+  my $res = find_configure_ac (@_);
   fatal "`configure.ac' or `configure.in' is required"
-    unless find_configure_ac;
-  return $configure_ac;
+    unless defined $res;
+  return $res
 }
 
 1;
Index: lib/Automake/Variable.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Variable.pm,v
retrieving revision 1.18
diff -u -u -w -u -r1.18 Variable.pm
--- lib/Automake/Variable.pm 12 Aug 2003 22:33:44 -0000 1.18
+++ lib/Automake/Variable.pm 21 Aug 2003 07:35:08 -0000
@@ -179,6 +179,9 @@
    YACC => 'AC_PROG_YACC',
    );
 
+# The name of the configure.ac file.
+my $configure_ac = require_configure_ac;
+
 # Variables that can be overriden without complaint from -Woverride
 my %_silent_variable_override =
   (AR => 1,




reply via email to

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