automake-patches
[Top][All Lists]
Advanced

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

Re: RFC: let aclocal output m4_includes for local m4 files


From: Alexandre Duret-Lutz
Subject: Re: RFC: let aclocal output m4_includes for local m4 files
Date: Fri, 18 Apr 2003 18:28:50 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux)

This fixes two spurious failures I didn't caught in the first
version of that patch.

2003-04-18  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (scan_aclocal_m4): Do not parse ACLOCAL_AMFLAGS
        and glob for m4_files (We've got all local m4 files while
        tracing m4_include's).  Diagnose ACLOCAL_M4_SOURCES as obsolete.
        Distribute aclocal.m4 only at the top-level.
        (my_glob): Remove.  This fixes PR automake/11.
        (handle_dist): Strip leading `./' from directories.
        * aclocal.in (add_file): Output 'm4_include([file.m4])' instead
        of copying local files.
        (write_aclocal, parse_arguments): Bump copyright date.
        * configure.in: De not build m4/amversion.m4 from here ...
        * m4/Makefile.am ($(srcdir)/amversion.m4): ... do this here.
        (nodist_m4data_DATA): Use $(srcdir)/amversion.m4 instead
        of amversion.m4.
        * tests/Makefile.am (XFAIL_TESTS): Remove aclocal5.test.
        (TESTS): Remove aclocal2.test.  Do not test aclocal.test twice.
        * tests/aclocal2.test: Delete (pointless).
        * tests/aclocal5.test: Make sure configure's dependencies are
        distributed.
        * tests/acinclude.test: Adjust to search for m4_include.
        * tests/dirlist.test, tests/dup3.test: Run $AUTOCONF and grep
        configure instead of aclocal.m4.

Index: NEWS
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/NEWS,v
retrieving revision 1.2
diff -u -r1.2 NEWS
--- NEWS        17 Apr 2003 19:35:49 -0000      1.2
+++ NEWS        17 Apr 2003 20:55:34 -0000
@@ -65,7 +65,8 @@
   dealing with non-POSIX ar implementations.
 
 * Any file which is m4_included from configure.ac will appear as
-  a configure and Makefile.in dependency.
+  a configure and Makefile.in dependency, and will be automatically
+  distributed.
 
 * The rules for rebuilding Makefiles and Makefile.ins will now rebuild
   all Makefiles and all Makefile.ins at once when one of configure's
@@ -82,6 +83,23 @@
   were using the CONFIG_STATUS_DEPENDENCIES and CONFIGURE_DEPENDENCIES
   (undocumented) variables, you will have to define them in all directories.
   This is easily done using an AC_SUBST.
+
+* aclocal will now use `m4_include' instead of copying local m4 files
+  into aclocal.m4.  (Local m4 files are those you ship with your
+  project, other files will be copied as usual.)
+
+  Because m4_included files are automatically distributed, it means
+  for most projects there is no point in EXTRA_DISTing the list
+  of m4 files which used.  (You can probably get rid of m4/Makefile.am
+  if you had one.)
+
+  Some users where using the undocumented ACLOCAL_M4_SOURCES variable
+  to override the aclocal.m4 dependencies computed (inaccurately) by
+  older versions of Automake; this variable should be considered obsolete
+  and will be flagged as such when running `automake -Wobsolete'.
+  Note that local m4 files are no longer dependencies of aclocal.m4
+  (since it only includes them) but they are dependencies of configure.
+
 
 New in 1.7:
 * Autoconf 2.54 is required.
Index: aclocal.in
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/aclocal.in,v
retrieving revision 1.1
diff -u -r1.1 aclocal.in
--- aclocal.in  13 Apr 2003 13:04:19 -0000      1.1
+++ aclocal.in  17 Apr 2003 21:59:35 -0000
@@ -7,7 +7,7 @@
 
 # aclocal - create aclocal.m4 by scanning configure.ac
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
 #           Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -161,7 +161,7 @@
        elsif ($arglist[0] eq '--version')
        {
            print "aclocal (GNU $PACKAGE) $VERSION\n\n";
-           print "Copyright (C) 2002 Free Software Foundation, Inc.\n";
+           print "Copyright (C) 2003 Free Software Foundation, Inc.\n";
            print "This is free software; see the source for copying 
conditions.  There is NO\n";
            print "warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE.\n\n";
            print "Written by Tom Tromey <address@hidden>\n";
@@ -357,7 +357,19 @@
     return if ($file_seen{$file});
     $file_seen{$file} = 1;
 
-    $output .= $file_contents{$file} . "\n";
+    # If the file to add looks like path outside the project,
+    # copy it to the output.
+    # The regex catches filenames starting with things like
+    #   / \ c:\ ../ ./../ etc.
+    if ($file =~ m,^(?:(?:\w:)?[\\/]|(?:\.[\\/]+)*\.\.[\\/]),)
+      {
+       $output .= $file_contents{$file} . "\n";
+      }
+    else
+      {
+       # Otherwise, simply include the file.
+       $output .= "m4_include([$file])\n";
+      }
     my (@rlist);
     foreach (split ("\n", $file_contents{$file}))
     {
@@ -443,7 +455,7 @@
     print $out
 "# generated automatically by aclocal $VERSION -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
 # Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
Index: automake.in
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/automake.in,v
retrieving revision 1.2
diff -u -r1.2 automake.in
--- automake.in 17 Apr 2003 19:35:49 -0000      1.2
+++ automake.in 17 Apr 2003 22:15:07 -0000
@@ -4157,6 +4157,8 @@
        next if /address@hidden@$/;
        s/\$\(top_srcdir\)/$topsrcdir/;
        s/\$\(srcdir\)/./;
+       # Strip any leading `./'.
+       s,^(:?\./+)*,,;
        next unless s,/+[^/]+$,,;
        $dist_dirs{$_} = 1
            unless $_ eq '.';
@@ -4287,7 +4289,8 @@
 
     if (-f 'aclocal.m4')
     {
-       &push_dist_common ('aclocal.m4');
+       &push_dist_common ('aclocal.m4')
+         if $relative_dir eq '.';
        &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
 
        my $aclocal = new Automake::XFile "< aclocal.m4";
@@ -4306,33 +4309,9 @@
     if (variable_defined ('ACLOCAL_M4_SOURCES'))
     {
        push (@ac_deps, '$(ACLOCAL_M4_SOURCES)');
-    }
-    elsif (variable_defined ('ACLOCAL_AMFLAGS'))
-    {
-       # Scan all -I directories for m4 files.  These are our
-       # dependencies.
-       my $examine_next = 0;
-       foreach my $amdir (&variable_value_as_list_recursive 
('ACLOCAL_AMFLAGS', TRUE))
-       {
-           if ($examine_next)
-           {
-               $examine_next = 0;
-               if ($amdir !~ /^\// && -d $amdir)
-               {
-                   foreach my $ac_dep (&my_glob ($amdir . '/*.m4'))
-                   {
-                       $ac_dep =~ s/^\.\/+//;
-                       push (@ac_deps, '$(top_srcdir)/' . $ac_dep)
-                         unless $ac_dep eq "aclocal.m4"
-                           || $ac_dep eq "acinclude.m4";
-                   }
-               }
-           }
-           elsif ($amdir eq '-I')
-           {
-               $examine_next = 1;
-           }
-       }
+       msg_var ('obsolete', 'ACLOCAL_M4_SOURCES',
+                "`ACLOCAL_M4_SOURCES' is obsolete.\n"
+                . "It should be safe to simply remove it.");
     }
 
     # Note that it might be possible that aclocal.m4 doesn't exist but
@@ -8661,16 +8640,6 @@
     }
 }
 
-
-################################################################
-
-# Glob something.  Do this to avoid indentation screwups everywhere we
-# want to glob.  Gross!
-sub my_glob
-{
-    my ($pat) = @_;
-    return <${pat}>;
-}
 
 ################################################################
 
Index: bootstrap
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/bootstrap,v
retrieving revision 1.1
diff -u -r1.1 bootstrap
--- bootstrap   13 Apr 2003 13:04:19 -0000      1.1
+++ bootstrap   17 Apr 2003 21:15:49 -0000
@@ -99,16 +99,13 @@
     -e "address@hidden@%$BOOTSTRAP_SHELL%g" \
     aclocal.in >aclocal.tmp
 
-# Create temporary replacement for amversion.m4
-sed -e "address@hidden@%$PERL%g" \
-    -e "address@hidden@%$VERSION%g" \
+# Overwrite amversion.m4
+sed -e "address@hidden@%$VERSION%g" \
     -e "address@hidden@%$APIVERSION%g" \
-    -e "address@hidden@%$PACKAGE%g" \
-    -e "address@hidden@%$datadir%g" \
-    m4/amversion.in >aclocal-$APIVERSION/amversion-tmp.m4
+    m4/amversion.in >m4/amversion.m4
 
 # Run aclocal
-$PERL ./aclocal.tmp -I aclocal-$APIVERSION -I m4
+$PERL ./aclocal.tmp -I m4
 
 # Create temporary replacement for automake
 sed -e "address@hidden@%$PERL%g" \
Index: configure.in
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/configure.in,v
retrieving revision 1.1
diff -u -r1.1 configure.in
--- configure.in        13 Apr 2003 13:04:19 -0000      1.1
+++ configure.in        17 Apr 2003 21:36:06 -0000
@@ -113,7 +113,6 @@
   lib/Makefile
   lib/am/Makefile
   m4/Makefile
-  m4/amversion.m4:m4/amversion.in
   tests/Makefile
   tests/defs
 ])
Index: tests/Makefile.am
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- tests/Makefile.am   17 Apr 2003 19:35:50 -0000      1.2
+++ tests/Makefile.am   17 Apr 2003 21:03:20 -0000
@@ -1,14 +1,11 @@
 ## Process this file with automake to create Makefile.in
 
-XFAIL_TESTS = aclocal5.test auxdir2.test cond17.test
+XFAIL_TESTS = auxdir2.test cond17.test
 
 TESTS =        \
 acinclude.test \
 aclibobj.test \
 aclocal.test \
-aclocal2.test \
-aclocal.test \
-aclocal2.test \
 aclocal3.test \
 aclocal4.test \
 aclocal5.test \
Index: tests/acinclude.test
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/acinclude.test,v
retrieving revision 1.1
diff -u -r1.1 acinclude.test
--- tests/acinclude.test        13 Apr 2003 13:04:21 -0000      1.1
+++ tests/acinclude.test        17 Apr 2003 20:58:25 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -23,8 +23,8 @@
 
 . ./defs || exit 1
 
-echo moo > acinclude.m4
+set -e
+: > acinclude.m4
 
-$ACLOCAL || exit 1
-
-grep moo aclocal.m4
+$ACLOCAL
+grep 'm4_include.*acinclude\.m4' aclocal.m4
Index: tests/aclocal2.test
===================================================================
RCS file: tests/aclocal2.test
diff -N tests/aclocal2.test
--- tests/aclocal2.test 13 Apr 2003 13:04:21 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2000, 2002  Free Software Foundation, Inc.
-#
-# This file is part of GNU Automake.
-#
-# GNU Automake 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.
-#
-# GNU Automake 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 autoconf; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# Make sure that ACLOCAL_AMFLAGS doesn't cause circular dependencies.
-. ./defs || exit 1
-
-echo AM_QUUX >> configure.in
-
-cat > quux.m4 << 'END'
-AC_DEFUN([AM_QUUX], [
-])
-END
-
-cat > Makefile.am << 'END'
-ACLOCAL_AMFLAGS = -I .
-END
-
-# We have to run aclocal first to make sure that aclocal.m4 exists.
-# Otherwise automake won't guess that we want to auto-generate it.
-$ACLOCAL -I . || exit 1
-
-$AUTOMAKE || exit 1
-
-grep "\$(ACLOCAL_M4): *configure.in *quux.m4" Makefile.in || exit 1
Index: tests/aclocal5.test
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/aclocal5.test,v
retrieving revision 1.2
diff -u -r1.2 aclocal5.test
--- tests/aclocal5.test 17 Apr 2003 19:49:06 -0000      1.2
+++ tests/aclocal5.test 17 Apr 2003 20:35:22 -0000
@@ -59,3 +59,7 @@
 cd ..
 grep GREPME Makefile
 grep GREPME sub/Makefile
+
+# Make sure configure dependencies are distributed.
+$MAKE distdir
+test -f aclocal5-1.0/m4/moredefs.m4
Index: tests/dirlist.test
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/dirlist.test,v
retrieving revision 1.1
diff -u -r1.1 dirlist.test
--- tests/dirlist.test  13 Apr 2003 13:04:23 -0000      1.1
+++ tests/dirlist.test  18 Apr 2003 16:21:19 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -46,11 +46,12 @@
 EOF
 
 $ACLOCAL
-grep 'DEFUN.*AM_INIT_GUILE_MODULE' aclocal.m4
+$AUTOCONF
+grep 'GUILE-VERSION' configure
 
 # This bug can occur only when we do a VPATH build of Automake
 # (beause of the `-I' passed to aclocal in tests/defs) but it's
 # ok because this is what `make distcheck' does.
-grep 'I should not be included' aclocal.m4 && exit 1
+grep 'I should not be included' configure && exit 1
 
 :
Index: tests/dup3.test
===================================================================
RCS file: /home/adl/CVSROOT/LOCAL/HEAD3-20030413-1504/tests/dup3.test,v
retrieving revision 1.1
diff -u -r1.1 dup3.test
--- tests/dup3.test     13 Apr 2003 13:04:23 -0000      1.1
+++ tests/dup3.test     18 Apr 2003 16:23:46 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -22,11 +22,6 @@
 
 . ./defs || exit 1
 
-cat >> configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE
-END
-
 mkdir zoo
 cat > zoo/zoo.m4 << 'END'
 AC_DEFUN([AM_INIT_AUTOMAKE], zardoz)
@@ -35,4 +30,5 @@
 # Strip all options from ACLOCAL, especially -I's.
 ACLOCAL="`echo $ACLOCAL | sed -e 's/ -.*$//'` --acdir=$testsrcdir/../m4"
 $ACLOCAL -I zoo || exit 1
-$FGREP zardoz aclocal.m4
+$AUTOCONF
+grep zardoz configure
-- 
Alexandre Duret-Lutz





reply via email to

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