automake-patches
[Top][All Lists]
Advanced

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

FYI: Re: aclocal.m4-version-check.patch


From: Alexandre Duret-Lutz
Subject: FYI: Re: aclocal.m4-version-check.patch
Date: 07 Jan 2002 21:12:12 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

I'm checking this in.
(I'm not really proud of the the $ACLOCAL definition in test/defs.)

Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.1713
diff -u -r1.1713 ChangeLog
--- ChangeLog   2002/01/07 00:37:50     1.1713
+++ ChangeLog   2002/01/07 20:01:42
@@ -1,3 +1,20 @@
+2002-01-07  Alexandre Duret-Lutz  <address@hidden>
+
+       * configure.in (AUTOMAKE): Create m4/amversion.m4.
+       * m4/amversion.in: New file.
+       * m4/Makefile.am (m4data_DATA, EXTRA_DIST): Replace by ...
+       (dist_m4data_DATA): ... this.
+       (nodist_m4data_DATA, DISTCLEANFILES): Add amversion.m4.
+       * m4/init.m4 (AM_INIT_AUTOMAKE): Require
+       AM_SET_CURRENT_AUTOMAKE_VERSION.
+       * automake.in (seen_automake_version): New variable.
+       (scan_autoconf_traces, scan_one_autoconf_file,
+       scan_autoconf_files): Scan for AM_AUTOMAKE_VERSION and complain
+       when the version used in aclocal.m4 differs from Automake's.
+       * tests/defs (ACLOCAL): Look in ../m4 too.
+       * tests/installsh.test (ACLOCAL): Likewise.
+       * tests/installdir.test (installdirs-local): Run $ACLOCAL.
+
 2002-01-06  Raja R Harinath  <address@hidden>
 
        * automake.in (handle_languages): Emit an automake
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1258
diff -u -r1.1258 automake.in
--- automake.in 2002/01/07 00:37:50     1.1258
+++ automake.in 2002/01/07 20:02:08
@@ -6,7 +6,7 @@
     if 0;
 
 # automake - create Makefile.in from Makefile.am
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -396,6 +396,9 @@
 # TRUE if we've seen AM_INIT_AUTOMAKE.
 my $seen_init_automake = 0;
 
+# TRUE if we've seen AM_AUTOMAKE_VERSION.
+my $seen_automake_version = 0;
+
 # Hash table of discovered configure substitutions.  Keys are names,
 # values are `FILE:LINE' strings which are used by error message
 # generation.
@@ -4502,6 +4505,7 @@
                  AM_GNU_GETTEXT
                  AM_INIT_AUTOMAKE
                  AM_AUTOMAKE_OPTIONS
+                 AM_AUTOMAKE_VERSION
                  AM_MAINTAINER_MODE
                  AM_PATH_LISPDIR
                  AM_PATH_PYTHON
@@ -4596,6 +4600,17 @@
          $global_options = $args[1];
          $global_options_line = $here;
        }
+      elsif ($macro eq 'AM_AUTOMAKE_VERSION')
+        {
+         file_error ($here,
+                     "version mismatch.  This is Automake $VERSION,\n" .
+                     "but the definition used by this AM_INIT_AUTOMAKE\n" .
+                     "comes from Automake $args[1].  You should recreate\n" .
+                     "aclocal.m4 with aclocal and run automake again.\n")
+             if ($VERSION ne $args[1]);
+
+         $seen_automake_version = 1;
+        }
       elsif ($macro eq 'AM_MAINTAINER_MODE')
        {
          $seen_maint_mode = $here;
@@ -4838,6 +4853,19 @@
             $global_options_line = $here;
        }
 
+       if (/AM_AUTOMAKE_VERSION\(([^)]+)\)/)
+       {
+           my $vers = &unquote_m4_arg ($1);
+           file_error ($here,
+                       "version mismatch.  This is Automake $VERSION, " .
+                       "but $filename\nwas generated for Automake $vers.  " .
+                       "You should recreate\n$filename with aclocal and " .
+                       "run automake again.\n")
+                   if ($VERSION ne $vers);
+
+           $seen_automake_version = 1;
+       }
+
        if (/AM_PROG_LEX/)
        {
            $configure_vars{'LEX'} = $here;
@@ -4979,6 +5007,25 @@
 
     conf_error ("`AM_INIT_AUTOMAKE' must be used")
        if ! $seen_init_automake;
+
+    if (! $seen_automake_version)
+    {
+       if (-f 'aclocal.m4')
+       {
+           file_error ($package_version_location || $me,
+                       "your implementation of AM_INIT_AUTOMAKE comes from " .
+                       "an\nold Automake version.  You should recreate " .
+                       "aclocal.m4\nwith aclocal and run automake again.\n");
+       }
+       else
+       {
+           file_error ($package_version_location || $me,
+                       "no proper implementation of AM_INIT_AUTOMAKE was " .
+                       "found,\nprobably because aclocal.m4 is missing...\n" .
+                       "You should run aclocal to create this file, then\n" .
+                       "run automake again.\n");
+       }
+    }
 
     # Look for some files we need.  Always check for these.  This
     # check must be done for every run, even those where we are only
Index: configure.in
===================================================================
RCS file: /cvs/automake/automake/configure.in,v
retrieving revision 1.95
diff -u -r1.95 configure.in
--- configure.in        2002/01/04 18:47:34     1.95
+++ configure.in        2002/01/07 20:02:15
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 
-# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software
-# Foundation, Inc.
+# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# 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
@@ -49,9 +49,14 @@
 AC_CONFIG_FILES([automake], [chmod +x automake])
 AC_CONFIG_FILES([aclocal], [chmod +x aclocal])
 
-AC_OUTPUT([Makefile
-           lib/Makefile
-           lib/Automake/Makefile
-          lib/am/Makefile
-           m4/Makefile
-           tests/Makefile])
+AC_CONFIG_FILES([
+  Makefile
+  lib/Automake/Makefile
+  lib/Makefile
+  lib/am/Makefile
+  m4/Makefile
+  m4/amversion.m4:m4/amversion.in
+  tests/Makefile
+])
+
+AC_OUTPUT
Index: m4/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/m4/Makefile.am,v
retrieving revision 1.39
diff -u -r1.39 Makefile.am
--- Makefile.am 2001/12/31 00:16:37     1.39
+++ Makefile.am 2002/01/07 20:02:19
@@ -2,7 +2,7 @@
 
 ## Makefile for Automake m4.
 
-## Copyright 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+## Copyright 1996, 1997, 1998, 1999, 2001, 2002  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
@@ -21,10 +21,11 @@
 
 m4datadir = $(datadir)/aclocal
 
-m4data_DATA = as.m4 auxdir.m4 ccstdc.m4 cond.m4 depend.m4 depout.m4 \
+dist_m4data_DATA = as.m4 auxdir.m4 ccstdc.m4 cond.m4 depend.m4 depout.m4 \
 dmalloc.m4 gcj.m4 header.m4 init.m4 install-sh.m4 lex.m4 lispdir.m4 \
 make.m4 maintainer.m4 minuso.m4 missing.m4 multi.m4 options.m4 \
 protos.m4 python.m4 regex.m4 runlog.m4 sanity.m4 strip.m4 termios.m4 \
 winsz.m4
 
-EXTRA_DIST = $(m4data_DATA)
+nodist_m4data_DATA = amversion.m4
+DISTCLEANFILES = amversion.m4
Index: m4/amversion.in
===================================================================
RCS file: amversion.in
diff -N amversion.in
--- /dev/null   Tue May  5 13:32:27 1998
+++ amversion.in        Mon Jan  7 12:02:19 2002
@@ -0,0 +1,28 @@
+# Copyright 2002  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
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+        [AM_AUTOMAKE_VERSION(address@hidden@])])
Index: m4/init.m4
===================================================================
RCS file: /cvs/automake/automake/m4/init.m4,v
retrieving revision 1.35
diff -u -r1.35 init.m4
--- init.m4     2001/11/07 18:08:14     1.35
+++ init.m4     2002/01/07 20:02:19
@@ -3,7 +3,8 @@
 # This macro actually does too much some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 
-# Copyright 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# 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
@@ -38,7 +39,8 @@
 # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
 # ----------------------------------------------
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_REQUIRE([AC_PROG_INSTALL])dnl
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
 # test to see if srcdir already configured
 if test "`cd $srcdir && pwd`" != "`pwd`" &&
    test -f $srcdir/config.status; then
Index: tests/defs
===================================================================
RCS file: /cvs/automake/automake/tests/defs,v
retrieving revision 1.41
diff -u -r1.41 defs
--- defs        2001/12/26 08:22:05     1.41
+++ defs        2002/01/07 20:02:19
@@ -99,7 +99,10 @@
 if test -z "$ACLOCAL"; then
    perllibdir=$srcdir/../lib
    export perllibdir
-   ACLOCAL="$PERL ../../aclocal --acdir=$srcdir/../m4"
+   # Most of the files are in $srcdir/../m4.  However amversion.m4 is
+   # generated in ../m4, so we include that directory in the search
+   # path too.
+   ACLOCAL="$PERL ../../aclocal -I `pwd`/../../m4 --acdir=$srcdir/../m4"
 fi
 
 # We might need extra macros, e.g., from Libtool or Gettext.
Index: tests/installdir.test
===================================================================
RCS file: /cvs/automake/automake/tests/installdir.test,v
retrieving revision 1.1
diff -u -r1.1 installdir.test
--- installdir.test     2001/12/30 23:46:28     1.1
+++ installdir.test     2002/01/07 20:02:19
@@ -9,6 +9,7 @@
        @echo here
 END
 
+$ACLOCAL || exit 1
 $AUTOMAKE || exit 1
 
 test `grep installdirs-local Makefile.in | wc -l` -eq 2
Index: tests/installsh.test
===================================================================
RCS file: /cvs/automake/automake/tests/installsh.test,v
retrieving revision 1.7
diff -u -r1.7 installsh.test
--- installsh.test      2001/10/21 18:03:20     1.7
+++ installsh.test      2002/01/07 20:02:19
@@ -26,7 +26,7 @@
 esac
 
 AUTOMAKE="$PERL ../../../automake --libdir=$srcdir/../lib --foreign --Werror"
-ACLOCAL="$PERL ../../../aclocal --acdir=$srcdir/../m4"
+ACLOCAL="$PERL ../../../aclocal -I ../../../m4 --acdir=$srcdir/../m4"
 
 # Now we proceed with the test
 $ACLOCAL || exit 1

-- 
Alexandre Duret-Lutz



reply via email to

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