autoconf-patches
[Top][All Lists]
Advanced

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

Re: expose m4_PACKAGE_VERSION,m4_version_compare


From: Eric Blake
Subject: Re: expose m4_PACKAGE_VERSION,m4_version_compare
Date: Thu, 13 Sep 2007 19:24:43 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Paolo Bonzini <bonzini <at> gnu.org> writes:

> > +** New m4sugar macro m4_AUTOCONF_VERSION.  Also, document the m4sugar 
macros
> > +   m4_ifndef, m4_version_compare, and m4_PACKAGE_VERSION (available
> > +   without documentation since at least autoconf 2.53), in part so
> > +   that packages can make decisions based on the current version of
> > +   autoconf used to evaluate a given configure.ac.  The name
> > +   m4_PACKAGE_VERSION may be marked obsolescent in a future release.
> 
> Sorry to come in late, but why not AC_VERSION and defining it in 
> general.m4?  Long term, m4sugar might be detached completely from 
> Autoconf (e.g. it could be distributed with M4 2.x) and already now it 
> is used by Bison.

Good point.  How about this followup?

2007-09-13  Eric Blake  <address@hidden>

        Use AC_VERSION, not m4_AUTOCONF_VERSION.
        * doc/autoconf.texi (Text processing Macros): Remove mention of
        m4_AUTOCONF_VERSION, and leave m4_PACKAGE_VERSION undocumented
        once again.
        (Notices): Move AC_PREREQ...
        (Versioning): ...to this new section, alongside the new AC_VERSION
        alias for the undocumented m4_PACKAGE_VERSION.
        * lib/m4sugar/m4sugar.m4 (m4_AUTOCONF_VERSION): Revert change.
        * lib/autoconf/general.m4 (AC_VERSION): New macro.
        * NEWS: Update to match this rename.
        * tests/m4sugar.at (m4@&address@hidden): Remove tests of
        m4_PACKAGE_VERSION.
        * tests/tools.at (autoconf: AC_VERSION): New test.
        Suggested by Paolo Bonzini and Benoit Sigoure.

Index: NEWS
===================================================================
RCS file: /sources/autoconf/autoconf/NEWS,v
retrieving revision 1.438
diff -u -p -r1.438 NEWS
--- NEWS        13 Sep 2007 03:21:18 -0000      1.438
+++ NEWS        13 Sep 2007 19:21:28 -0000
@@ -8,7 +8,7 @@ GNU Autoconf NEWS - User visible changes
    generated by autoconf under the license of your own program.
  FIXME - revisit this line once exception clause is finalized.
 
-** New Autoconf macros AC_OPENMP, AC_PATH_PROGS_FEATURE_CHECK.
+** New Autoconf macros AC_OPENMP, AC_PATH_PROGS_FEATURE_CHECK, AC_VERSION.
 
 ** AC_C_BIGENDIAN now supports universal binaries a la Mac OS X.
 
@@ -47,12 +47,10 @@ GNU Autoconf NEWS - User visible changes
    Autoconf and Automake.  GNU M4 1.4.8 or later is recommended.  The
    configure search for a working M4 is improved.
 
-** New m4sugar macro m4_AUTOCONF_VERSION.  Also, document the m4sugar macros
-   m4_ifndef, m4_version_compare, and m4_PACKAGE_VERSION (available
-   without documentation since at least autoconf 2.53), in part so
-   that packages can make decisions based on the current version of
-   autoconf used to evaluate a given configure.ac.  The name
-   m4_PACKAGE_VERSION may be marked obsolescent in a future release.
+** Document the m4sugar macros m4_ifndef and m4_version_compare
+   (available without documentation since at least autoconf 2.53).
+   Packages using the undocumented m4sugar macro m4_PACKAGE_VERSION
+   should consider using the new AC_VERSION instead.
 
 ** Warnings are now generated by default when an installer invokes
    'configure' with an unknown --enable-* or --with-* option.
Index: doc/autoconf.texi
===================================================================
RCS file: /sources/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1175
diff -u -p -r1.1175 autoconf.texi
--- doc/autoconf.texi   13 Sep 2007 16:50:38 -0000      1.1175
+++ doc/autoconf.texi   13 Sep 2007 19:21:28 -0000
@@ -302,6 +302,7 @@ Writing @file{configure.ac}
 Initialization and Output Files
 
 * Initializing configure::      Option processing etc.
+* Versioning::                  Dealing with Autoconf versions
 * Notices::                     Copyright, version numbers in @command
{configure}
 * Input::                       Where Autoconf should find files
 * Output::                      Outputting results from the configuration
@@ -1681,6 +1682,7 @@ initialization and the creation of outpu
 
 @menu
 * Initializing configure::      Option processing etc.
+* Versioning::                  Dealing with Autoconf versions
 * Notices::                     Copyright, version numbers in @command
{configure}
 * Input::                       Where Autoconf should find files
 * Output::                      Outputting results from the configuration
@@ -1767,15 +1769,15 @@ of updating @samp{$@@} and @samp{$*}.  H
 standard macros like @code{AC_ARG_ENABLE} instead of attempting to
 implement your own option processing.  @xref{Site Configuration}.
 
address@hidden Versioning
address@hidden Dealing with Autoconf versions
address@hidden Autoconf version
address@hidden version, Autoconf
 
address@hidden Notices
address@hidden Notices in @command{configure}
address@hidden Notices in @command{configure}
-
-The following macros manage version numbers for @command{configure}
-scripts.  Using them is optional.
+The following optional macros can be used to help choose the minimum
+version of Autoconf that can successfully compile a given
address@hidden
 
address@hidden FIXME: AC_PREREQ should not be here
 @defmac AC_PREREQ (@var{version})
 @acindex{PREREQ}
 @cindex Version
@@ -1792,6 +1794,26 @@ This macro is the only macro that may be
 for consistency, you are invited not to do so.
 @end defmac
 
address@hidden AC_VERSION
address@hidden
+This macro was introduced in Autoconf 2.62.  It identifies the version
+of Autoconf that is currently parsing the input file, in a format
+suitable for @code{m4_version_compare} (@pxref{m4_version_compare}); in
+other words, for this release of Autoconf, its value is
address@hidden@value{VERSION}}.  One potential use of this macro is for writing
+conditional fallbacks based on when a feature was added to Autoconf,
+rather than using @code{AC_PREREQ} to require the newer version of
+Autoconf.  However, remember that the Autoconf philosophy favors feature
+checks over version checks.
address@hidden defmac
+
address@hidden Notices
address@hidden Notices in @command{configure}
address@hidden Notices in @command{configure}
+
+The following macros manage version numbers for @command{configure}
+scripts.  Using them is optional.
+
 @defmac AC_COPYRIGHT (@var{copyright-notice})
 @acindex{COPYRIGHT}
 @cindex Copyright Notice
@@ -10278,6 +10300,7 @@ added.  @code{m4_append} can be used to 
 @code{m4_append_uniq} to grow strings without duplicating substrings.
 @end defmac
 
address@hidden
 @defmac m4_version_compare (@var{version-1}, @var{version-2})
 @msindex{version_compare}
 Introduced in autoconf 2.53.  Compare the version strings
@@ -10285,9 +10308,9 @@ Introduced in autoconf 2.53.  Compare th
 @var{version-1} is smaller, @samp{0} if they are the same, or @samp{1}
 @var{version-2} is smaller.  Version strings must be a list of elements
 separated by @samp{.}, where each element is a number along with an
-optional letter.  The comparison stops at the leftmost element that
-contains a difference, although a 0 element compares equal to a missing
-element.
+optional lower case letter.  The comparison stops at the leftmost
+element that contains a difference, although a 0 element compares equal
+to a missing element.
 
 @example
 m4_version_compare([1.1], [2.0])
@@ -10303,35 +10326,6 @@ m4_version_compare([1.0], [1])
 @end example
 @end defmac
 
address@hidden m4_AUTOCONF_VERSION
address@hidden m4_PACKAGE_VERSION
address@hidden
address@hidden
-These macros identify the version of Autoconf that is currently parsing
-the input file, in a format suitable for @code{m4_version_compare}.  The
-name @code{m4_AUTOCONF_VERSION} was introduced in Autoconf 2.62.  The
-synonym @code{m4_PACKAGE_VERSION} existed since Autoconf 2.53, but was
-undocumented for many years because it is not named very well, and it
-may be withdrawn in a future release.  One use of these macros is for
-writing conditional fallbacks based on when a feature was added to
-Autoconf, rather than using @code{AC_PREREQ} to require the newer
-version of Autoconf.
-
-For an example, @code{AC_USE_SYSTEM_EXTENSIONS} was only added in
-Autoconf 2.60 (@pxref{AC_USE_SYSTEM_EXTENSIONS}).  A @file{configure.ac}
-designed to work even with Autoconf 2.59 can do the following in a
-compatibility section, then use the newer macros elsewhere without
-worrying about Autoconf versions:
-
address@hidden
-m4_ifndef([m4_AUTOCONF_VERSION],
-          [m4_define([m4_AUTOCONF_VERSION],
-                     m4_defn([m4_PACKAGE_VERSION]))])
-m4_if(m4_version_compare(m4_AUTOCONF_VERSION, [2.60]), [-1],
-      [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])])
address@hidden example
address@hidden defmac
-
 
 @node Forbidden Patterns
 @subsection Forbidden Patterns
Index: lib/autoconf/general.m4
===================================================================
RCS file: /sources/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.955
diff -u -p -r1.955 general.m4
--- lib/autoconf/general.m4     23 Aug 2007 18:36:06 -0000      1.955
+++ lib/autoconf/general.m4     13 Sep 2007 19:21:28 -0000
@@ -299,6 +299,11 @@ AU_DEFUN([AC_PREREQ],
 m4_copy([m4_version_prereq], [AC_PREREQ])
 
 
+# AC_VERSION
+# ----------
+# The current version of Autoconf parsing this file.
+m4_copy([m4_PACKAGE_VERSION], [AC_VERSION])
+
 
 
 
Index: lib/m4sugar/m4sugar.m4
===================================================================
RCS file: /sources/autoconf/autoconf/lib/m4sugar/m4sugar.m4,v
retrieving revision 2.103
diff -u -p -r2.103 m4sugar.m4
--- lib/m4sugar/m4sugar.m4      13 Sep 2007 03:21:19 -0000      2.103
+++ lib/m4sugar/m4sugar.m4      13 Sep 2007 19:21:28 -0000
@@ -1725,15 +1725,6 @@ m4_define([m4_version_compare],
 m4_include([m4sugar/version.m4])
 
 
-# m4_AUTOCONF_VERSION
-# -------------------
-# A nicer synonym for the name m4_PACKAGE_VERSION.  However, since
-# automake 1.10 decided to use m4_PACKAGE_VERSION while it was still
-# undocumented, it will be a while before we can try to obsolete the
-# confusing name.
-m4_copy([m4_PACKAGE_VERSION], [m4_AUTOCONF_VERSION])
-
-
 # m4_version_prereq(VERSION, [IF-OK], [IF-NOT = FAIL])
 # ----------------------------------------------------
 # Check this Autoconf version against VERSION.
Index: tests/m4sugar.at
===================================================================
RCS file: /sources/autoconf/autoconf/tests/m4sugar.at,v
retrieving revision 1.35
diff -u -p -r1.35 m4sugar.at
--- tests/m4sugar.at    13 Sep 2007 03:21:19 -0000      1.35
+++ tests/m4sugar.at    13 Sep 2007 19:21:28 -0000
@@ -193,9 +193,6 @@ AT_CLEANUP
 
 AT_SETUP([m4@&address@hidden)
 
-# In addition to version checks, also check m4_AUTOCONF_VERSION, added
-# for autoconf 2.62.
-
 AT_CHECK_M4SUGAR_TEXT(
 [[m4_version_compare([1.1], [2.0])
 m4_version_compare([2.0b], [2.0a])
@@ -205,8 +202,6 @@ m4_version_compare([1.2], [1.1.1a])
 m4_version_compare([1.0], [1])
 m4_version_compare([1.0a], [1.0a])
 m4_version_compare([1.1a], [1.1a.1])
-m4_version_compare(m4_AUTOCONF_VERSION, [2.61])
-m4_version_compare(m4_defn([m4_AUTOCONF_VERSION]), [2.61])
 ]],
 [[-1
 1
@@ -216,8 +211,6 @@ m4_version_compare(m4_defn([m4_AUTOCONF_
 0
 0
 -1
-1
-1
 ]])
 
 AT_CLEANUP
Index: tests/tools.at
===================================================================
RCS file: /sources/autoconf/autoconf/tests/tools.at,v
retrieving revision 1.101
diff -u -p -r1.101 tools.at
--- tests/tools.at      20 Jul 2007 23:11:55 -0000      1.101
+++ tests/tools.at      13 Sep 2007 19:21:28 -0000
@@ -2,7 +2,8 @@
 
 AT_BANNER([Executables (autoheader, autoupdate...).])
 
-# Copyright (C) 2000, 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2004, 2006, 2007 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
@@ -404,6 +405,22 @@ AT_CHECK([echo 'AC_INIT(X, 2.0, bug-auto
 AT_CLEANUP
 
 
+# autoconf: AC_VERSION
+# --------------------------------------
+AT_SETUP([autoconf: AC_VERSION])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+version AC_VERSION version
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK([[grep 'version ]]AT_PACKAGE_VERSION[[ version' configure]],
+0, [ignore])
+
+AT_CLEANUP
+
 
 
 ## --------- ##







reply via email to

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