]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/Autom4te/Configure_ac.pm (&find_configure_ac)
authorAkim Demaille <akim@epita.fr>
Thu, 21 Aug 2003 06:55:41 +0000 (06:55 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 21 Aug 2003 06:55:41 +0000 (06:55 +0000)
(&require_configure_ac): Accept an optional directory argument.
($configure_ac): Remove.
* lib/Autom4te/General.pm (&find_configure_ac, &canonfile)
(&catfile): Remove.
* bin/autoheader.in, bin/autoreconf.in, bin/autoupdate.in,
* bin/autoscan.in: Adjust.

ChangeLog
bin/autoheader.in
bin/autoreconf.in
bin/autoscan.in
bin/autoupdate.in
lib/Autom4te/Configure_ac.pm
lib/Autom4te/General.pm

index 47fee8961c5dcd57cb5e24fdd2c3d2fe0a8a61dc..ead3f53fe0e631ed6fa8e86146330d4e5687d5bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-08-21  Akim Demaille  <akim@epita.fr>
+
+       * lib/Autom4te/Configure_ac.pm (&find_configure_ac)
+       (&require_configure_ac): Accept an optional directory argument.
+       ($configure_ac): Remove.
+       * lib/Autom4te/General.pm (&find_configure_ac, &canonfile)
+       (&catfile): Remove.
+       * bin/autoheader.in, bin/autoreconf.in, bin/autoupdate.in,
+       * bin/autoscan.in: Adjust.
+
 2003-08-20  Akim Demaille  <akim@epita.fr>
 
        * bin/autoheader.in: Remove duplicate 'use Autom4te::FileUtils'.
index 420c7426652937046b120eeaf3d29cd5dbc7aa8e..9ada8ff61870a15b92ef09e0d434ad2e22e8f64b 100644 (file)
@@ -41,6 +41,7 @@ BEGIN
 
 use Autom4te::ChannelDefs;
 use Autom4te::Channels;
+use Autom4te::Configure_ac;
 use Autom4te::FileUtils;
 use Autom4te::General;
 use Autom4te::XFile;
@@ -121,9 +122,7 @@ sub parse_args ()
 
   if (! @ARGV)
     {
-      my $configure_ac = find_configure_ac;
-      error "no input file"
-       unless $configure_ac;
+      my $configure_ac = require_configure_ac;
       push @ARGV, $configure_ac;
     }
 }
index cb2f9e69d035978f6b6565b9b004e77c675495d5..ed09cf2b5aeb2e05224308726d98655c0c6f009d 100644 (file)
@@ -39,6 +39,7 @@ BEGIN
   $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
 }
 
+use Autom4te::Configure_ac;
 use Autom4te::FileUtils;
 use Autom4te::General;
 use Autom4te::XFile;
@@ -290,9 +291,7 @@ sub run_aclocal ($$)
 # -----------------------------
 sub autoreconf_current_directory ()
 {
-  my $configure_ac = find_configure_ac;
-  error "cannot find `configure.ac'"
-    unless $configure_ac;
+  my $configure_ac = require_configure_ac;
 
   # ---------------------- #
   # Is it using Autoconf?  #
index d1bcf818b4278da1ecd1c9c0331c67633e58ca62..1d460888feca87a52326c1535cd7c15553637ebe 100644 (file)
@@ -36,6 +36,7 @@ BEGIN
   $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
 }
 
+use Autom4te::Configure_ac;
 use Autom4te::General;
 use Autom4te::XFile;
 use File::Basename;
index c4e9ed23524c0c04d50b90f08d545ba8feb40c97..6ca8fb0c7d158f05f15ccfd2cedefe941a18adfc 100644 (file)
@@ -39,6 +39,7 @@ BEGIN
 
 use Autom4te::ChannelDefs;
 use Autom4te::Channels;
+use Autom4te::Configure_ac;
 use Autom4te::FileUtils;
 use Autom4te::General;
 use Autom4te::XFile;
@@ -108,9 +109,7 @@ sub parse_args ()
 
   if (! @ARGV)
     {
-      my $configure_ac = find_configure_ac;
-      error "no input file"
-       unless $configure_ac;
+      my $configure_ac = require_configure_ac;
       push @ARGV, $configure_ac;
     }
 }
index ae74eb8d05aa3a0742dbc0ed8ade80fb5261e515..2b07dc780b7264f83243b9ce650164159250bf2b 100644 (file)
@@ -25,7 +25,7 @@ use Autom4te::ChannelDefs;
 use vars qw (@ISA @EXPORT);
 
 @ISA = qw (Exporter);
-@EXPORT = qw ($configure_ac &find_configure_ac &require_configure_ac);
+@EXPORT = qw (&find_configure_ac &require_configure_ac);
 
 =head1 NAME
 
@@ -42,37 +42,45 @@ Autom4te::Configure_ac - Locate configure.ac or configure.in.
   # 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 c4c30bc95829081efec5f8d44e6ec02b8c169253..518c6b897688db3d635139bce5f600e022a10e60 100644 (file)
@@ -53,8 +53,8 @@ my @export_vars =
 
 # Functions we define and export.
 my @export_subs =
-  qw (&catfile &canonpath &debug &error
-      &file_name_is_absolute &find_configure_ac
+  qw (&debug &error
+      &file_name_is_absolute
       &getopt &mktmpdir
       &uniq &verbose);
 
@@ -229,43 +229,6 @@ sub END
 ## Functions.  ##
 ## ----------- ##
 
-=item C<catfile ()>
-
-Wrapper around C<File::Spec->catfile>.  Concatenate one or more
-directory names and a filename to form a complete path ending with a
-filename.
-
-=cut
-
-# $FILE
-# &catfile (@COMPONENT)
-# ---------------------
-sub catfile (@)
-{
-  my (@component) = @_;
-  return File::Spec->catfile (@component);
-}
-
-
-=item C<canonpath ()>
-
-Wrapper around C<File::Spec->canonpath>.  No physical check on the
-filesystem, but a logical cleanup of a path. On UNIX eliminates
-successive slashes and successive "/.".
-
-    $cpath = canonpath ($path) ;
-
-=cut
-
-# $FILE
-# &canonpath ($FILE)
-# ------------------
-sub canonpath ($)
-{
-  my ($file) = @_;
-  return File::Spec->canonpath ($file);
-}
-
 
 =item C<debug (@message)>
 
@@ -301,42 +264,6 @@ sub file_name_is_absolute ($)
 }
 
 
-=item C<find_configure_ac ([$directory = C<.>])>
-
-Look for C<configure.ac> or C<configure.in> in the C<$directory> and
-return the one which should be used.  Report ambiguities to the user,
-but prefer C<configure.ac>.
-
-=cut
-
-# $CONFIGURE_AC
-# &find_configure_ac ([$DIRECTORY = `.'])
-# ---------------------------------------
-sub find_configure_ac (;$)
-{
-  my ($directory) = @_;
-  $directory ||= '.';
-  my $configure_ac = canonpath (catfile ($directory, 'configure.ac'));
-  my $configure_in = canonpath (catfile ($directory, 'configure.in'));
-
-  if (-f $configure_ac)
-    {
-      if (-f $configure_in)
-       {
-         carp "$me: warning: `$configure_ac' and `$configure_in' both present.\n";
-         carp "$me: warning: proceeding with `$configure_ac'.\n";
-       }
-      return $configure_ac;
-    }
-  elsif (-f $configure_in)
-    {
-      return $configure_in;
-    }
-  return;
-}
-
-
-
 
 =item C<getopt (%option)>