automake-patches
[Top][All Lists]
Advanced

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

aclocal.m4-version-check.patch


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

This adds some magic to aclocal.m4 so that Automake version X
can ensure that aclocal.m4 has been generated with m4 files from
Automake version X.

I'm ambivalent about issuing a warning or an error on version
mismatch.

Index: ChangeLog
--- ChangeLog
+++ ChangeLog
@@ -1,1 +1,14 @@
+2002-01-02  Alexandre Duret-Lutz  <address@hidden>
+
+       * m4/amversion.in, m4/amversion.m4: New files.
+       * m4/Makefile.am (amversion.m4): New target.
+       (EXTRA_DIST): Add amversion.in.
+       (m4data_DATA, MAINTAINERCLEAN): 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 warn
+       when the version used in aclocal.m4 differs from Automake's.
+

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1256
diff -u -r1.1256 automake.in
--- automake.in 2002/01/02 16:01:21     1.1256
+++ automake.in 2002/01/02 22:36:35
@@ -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.
@@ -4500,6 +4503,7 @@
                  AM_GNU_GETTEXT
                  AM_INIT_AUTOMAKE
                  AM_AUTOMAKE_OPTIONS
+                 AM_AUTOMAKE_VERSION
                  AM_MAINTAINER_MODE
                  AM_PATH_LISPDIR
                  AM_PATH_PYTHON
@@ -4594,6 +4598,15 @@
          $global_options = $args[1];
          $global_options_line = $here;
        }
+      elsif ($macro eq 'AM_AUTOMAKE_VERSION')
+        {
+         warn ("$here: version mismatch.  This is Automake $VERSION,\n" .
+               "$here: but the definition used by this AM_INIT_AUTOMAKE\n" .
+               "$here: comes from Automake $args[1].  You should recreate\n" .
+               "$here: 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;
@@ -4836,6 +4849,17 @@
             $global_options_line = $here;
        }
 
+       if (/AM_AUTOMAKE_VERSION\(([^)]+)\)/)
+       {
+           my $vers = &unquote_m4_arg ($1);
+           warn ("$here: version mismatch.  This is Automake $VERSION,\n" .
+                 "$here: but $filename was generated for Automake $vers.\n" .
+                 "$here: You should recreate $filename with aclocal and\n" .
+                 "$here: run automake again.\n")
+               if ($VERSION ne $vers);
+           $seen_automake_version = 1;
+       }
+
        if (/AM_PROG_LEX/)
        {
            $configure_vars{'LEX'} = $here;
@@ -4977,6 +5001,14 @@
 
     conf_error ("`AM_INIT_AUTOMAKE' must be used")
        if ! $seen_init_automake;
+
+    if (! $seen_automake_version)
+    {
+       my $h = $package_version_location;
+       warn ("$h: your implementation of AM_INIT_AUTOMAKE comes from an\n" .
+             "$h: old Automake version.  You should recreate aclocal.m4\n" .
+             "$h: with aclocal and 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: 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/02 22:36:42
@@ -21,10 +21,22 @@
 
 m4datadir = $(datadir)/aclocal
 
-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 \
+
+m4data_DATA = amversion.m4 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
+
+# Do the substitution here, not from config.status, because the latter
+# would cause amversion.m4 to be recreated identically on each
+# installation (overkill).
+# This needs to be updated only when $(VERSION) changes, hence the
+# configure.in dependency.
+amversion.m4: $(srcdir)/amversion.in $(top_srcdir)/configure.in
+       sed -e 's,@VERSION\@,$(VERSION),g' \
+         $(srcdir)/amversion.in > amversion.tmp
+       mv amversion.tmp amversion.m4
 
-EXTRA_DIST = $(m4data_DATA)
+EXTRA_DIST = $(m4data_DATA) amversion.in
+MAINTAINERCLEANFILES = 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        Wed Jan  2 14:36:45 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 accompagning 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/amversion.m4
===================================================================
RCS file: amversion.m4
diff -N amversion.m4
--- /dev/null   Tue May  5 13:32:27 1998
+++ amversion.m4        Wed Jan  2 14:36:45 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 accompagning 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([1.5c])])
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/02 22:36:45
@@ -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

-- 
Alexandre Duret-Lutz



reply via email to

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