bug-automake
[Top][All Lists]
Advanced

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

Re: Problems with the new Var code


From: Alexandre Duret-Lutz
Subject: Re: Problems with the new Var code
Date: Tue, 03 Jun 2003 01:36:00 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3 (gnu/linux)

>>> "Akim" == Akim Demaille <address@hidden> writes:

 Akim> Notice the Perl warning below.  

Thanks!

 Akim> Maybe you could catch Perl warnings (I think __SIGNAL__,
 Akim> or whatever its name, can do that) and make them actually
 Akim> errors?  Or is it simply that modules lack their use
 Akim> strict?

It's already the case, but as this test was already expecting a
failure it did not see the failure into the failure :)

 Akim> Also, while on $configure_ac: Is it really good to initialize it to a
 Akim> valid value '' instead of keeping it undef?

 Akim> ~/src/am % grep 'configure_ac.*=' automake.in                     
nostromo 9:12
 Akim> my $configure_ac = '';
 Akim> $configure_ac = find_configure_ac;

I'm checking this in.  (It's also a short step on the
split-General.pm road.)  I've preserved the semantic of the old
General::find_configure_ac in Configure_ac::search_configure_ac
because I know autoscan needs it (all the other tools really
want to find the file).

2003-06-03  Alexandre Duret-Lutz  <address@hidden>

        * alocal.in: Use Automake::Configure_ac.
        ($configure_ac): Delete.
        (scan_configure): Adjust use of find_configure_ac;
        * automake.in: Use Automake::Configure_ac.
        ($configure_ac): Delete.
        (scan_autoconf_files): Adjust use of find_configure_ac;
        * lib/Automake/Configure_ac.pm: New file.
        * lib/Automake/General.pm (find_configure_ac): Delete.  Now
        replaced by Automake::Configure_ac::search_configure_ac.
        * lib/Automake/Makefile.am (dist_perllib_DATA): Add Configure_ac.pm.
        * lib/Automake/Variable.pm: Use Automake::Configure_ac.
        (require_variables): Adjust use of $configure_ac.

Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.79
diff -u -r1.79 aclocal.in
--- aclocal.in  6 May 2003 12:07:22 -0000       1.79
+++ aclocal.in  2 Jun 2003 23:20:46 -0000
@@ -34,6 +34,7 @@
 }
 
 use Automake::General;
+use Automake::Configure_ac;
 use Automake::XFile;
 use File::stat;
 
@@ -56,9 +57,6 @@
 # Exit status.
 $exit_status = 0;
 
-# Name of the top autoconf input: `configure.ac' or `configure.in'.
-$configure_ac = find_configure_ac;
-
 # Text to output.
 $output = '';
 
@@ -238,8 +236,7 @@
 
 sub scan_configure ()
 {
-    die "aclocal: `configure.ac' or `configure.in' is required\n"
-        if !$configure_ac;
+    find_configure_ac;
 
     open (CONFIGURE, $configure_ac)
        || die "aclocal: couldn't open `$configure_ac': $!\n";
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1461
diff -u -r1.1461 automake.in
--- automake.in 29 May 2003 19:05:55 -0000      1.1461
+++ automake.in 2 Jun 2003 23:20:51 -0000
@@ -125,6 +125,7 @@
 use Automake::XFile;
 use Automake::Channels;
 use Automake::ChannelDefs;
+use Automake::Configure_ac;
 use Automake::Location;
 use Automake::Condition qw/TRUE FALSE/;
 use Automake::DisjConditions;
@@ -309,9 +310,6 @@
 ## Variables filled during files scanning.  ##
 ## ---------------------------------------- ##
 
-# Name of the top autoconf input: `configure.ac' or `configure.in'.
-my $configure_ac = '';
-
 # Files found by scanning configure.ac for LIBOBJS.
 my %libsources = ();
 
@@ -5081,11 +5079,7 @@
     # that won't always be the case.
     %libsources = ();
 
-    $configure_ac = find_configure_ac;
-    fatal "`configure.ac' or `configure.in' is required\n"
-        if !$configure_ac;
-
-    scan_autoconf_traces ($configure_ac);
+    scan_autoconf_traces (find_configure_ac);
 
     # Set input and output files if not specified by user.
     if (! @input_files)
Index: lib/Automake/Configure_ac.pm
===================================================================
RCS file: lib/Automake/Configure_ac.pm
diff -N lib/Automake/Configure_ac.pm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lib/Automake/Configure_ac.pm        2 Jun 2003 23:20:52 -0000
@@ -0,0 +1,95 @@
+# Copyright (C) 2003  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+package Automake::Configure_ac;
+
+use strict;
+use Exporter;
+use Automake::Channels;
+use Automake::ChannelDefs;
+
+use vars qw (@ISA @EXPORT);
+
address@hidden = qw (Exporter);
address@hidden = qw ($configure_ac &search_configure_ac &find_configure_ac);
+
+=head1 NAME
+
+Automake::Configure_ac - Locate configure.ac or configure.in.
+
+=head1 SYNOPSIS
+
+  use Automake::Configure_ac;
+
+  # Try to locate configure.in or configure.ac in the current
+  # directory.  It may be absent.  Complain if both files exist.
+  my $filename = search_configure_ac;
+
+  # Likewise, but bomb out if the file does not exist.
+  my $filename = find_configure_ac;
+
+In both cases, the name of the file found is also put in the
+C<$configure_ac> global variable.
+
+=cut
+
+use vars '$configure_ac';
+
+sub search_configure_ac ()
+{
+  if (-f 'configure.ac')
+    {
+      if (-f 'configure.in')
+       {
+         msg ('unsupported',
+              "`configure.ac' and `configure.in' both present.\n"
+              . "proceeding with `configure.ac'.");
+       }
+      $configure_ac = 'configure.ac';
+    }
+  elsif (-f 'configure.in')
+    {
+      $configure_ac = 'configure.in';
+    }
+  return $configure_ac;
+}
+
+sub find_configure_ac ()
+{
+  fatal "`configure.ac' or `configure.in' is required"
+    unless search_configure_ac;
+  return $configure_ac;
+}
+
+1;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
Index: lib/Automake/General.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/General.pm,v
retrieving revision 1.2
diff -u -r1.2 General.pm
--- lib/Automake/General.pm     6 May 2003 12:07:22 -0000       1.2
+++ lib/Automake/General.pm     2 Jun 2003 23:20:52 -0000
@@ -28,7 +28,7 @@
 use vars qw (@ISA @EXPORT);
 
 @ISA = qw (Exporter);
address@hidden = qw (&debug &find_configure_ac &find_file &getopt &mktmpdir 
&mtime
address@hidden = qw (&debug &find_file &getopt &mktmpdir &mtime
               &uniq &update_file &verbose &xsystem &contents
              $debug $help $me $tmp $verbose $version);
 
@@ -95,28 +95,6 @@
 {
   print STDERR "$me: ", @_, "\n"
     if $verbose && $debug;
-}
-
-
-# $CONFIGURE_AC
-# &find_configure_ac ()
-# ---------------------
-sub find_configure_ac ()
-{
-  if (-f 'configure.ac')
-    {
-      if (-f 'configure.in')
-       {
-         carp "warning: `configure.ac' and `configure.in' both present.\n";
-         carp "warning: proceeding with `configure.ac'.\n";
-       }
-      return 'configure.ac';
-    }
-  elsif (-f 'configure.in')
-    {
-      return 'configure.in';
-    }
-  return;
 }
 
 
Index: lib/Automake/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Makefile.am,v
retrieving revision 1.13
diff -u -r1.13 Makefile.am
--- lib/Automake/Makefile.am    25 May 2003 20:05:50 -0000      1.13
+++ lib/Automake/Makefile.am    2 Jun 2003 23:20:52 -0000
@@ -24,6 +24,7 @@
   ChannelDefs.pm \
   Channels.pm \
   Condition.pm \
+  Configure_ac.pm \
   DisjConditions.pm \
   General.pm \
   Location.pm \
Index: lib/Automake/Variable.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/Variable.pm,v
retrieving revision 1.3
diff -u -r1.3 Variable.pm
--- lib/Automake/Variable.pm    29 May 2003 19:05:55 -0000      1.3
+++ lib/Automake/Variable.pm    2 Jun 2003 23:20:52 -0000
@@ -20,6 +20,7 @@
 use Carp;
 use Automake::Channels;
 use Automake::ChannelDefs;
+use Automake::Configure_ac;
 use Automake::VarDef;
 use Automake::Condition qw (TRUE FALSE);
 use Automake::DisjConditions;
@@ -1226,13 +1227,13 @@
       if (exists $_am_macro_for_var{$var})
        {
          $text .= "\nThe usual way to define `$var' is to add "
-           . "`$_am_macro_for_var{$var}'\nto `$Automake::configure_ac' and "
+           . "`$_am_macro_for_var{$var}'\nto `$configure_ac' and "
            . "run `aclocal' and `autoconf' again.";
        }
       elsif (exists $_ac_macro_for_var{$var})
        {
          $text .= "\nThe usual way to define `$var' is to add "
-           . "`$_ac_macro_for_var{$var}'\nto `$Automake::configure_ac' and "
+           . "`$_ac_macro_for_var{$var}'\nto `$configure_ac' and "
            . "run `autoconf' again.";
        }
 
-- 
Alexandre Duret-Lutz





reply via email to

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