Bruno proposed using undocumented macros:

http://lists.gnu.org/archive/html/bug-gnulib/2007-09/msg00092.html

As I am not a fan of that approach, perhaps it is time to document the macros 
instead, so that the use is kosher?  These two macros have been available since 
2.53, with no major change in functionality, so I think they are robust enough 
to expose.  Any arguments why I should not apply this?

2007-09-12  Eric Blake  <[EMAIL PROTECTED]>

        Publish m4_version_compare, m4_PACKAGE_VERSION.
        * doc/autoconf.texi (Text processing Macros): Document
        m4_version_compare, m4_PACKAGE_VERSION.
        * NEWS: Document this change.
        * lib/m4sugar/Makefile.am (version.m4): Update copyright dates.
        Reported by Bruno Haible.

Index: NEWS
===================================================================
RCS file: /sources/autoconf/autoconf/NEWS,v
retrieving revision 1.437
diff -u -p -r1.437 NEWS
--- NEWS        11 Sep 2007 17:13:13 -0000      1.437
+++ NEWS        12 Sep 2007 15:20:40 -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 macros AC_OPENMP, AC_PATH_PROGS_FEATURE_CHECK.
+** New Autoconf macros AC_OPENMP, AC_PATH_PROGS_FEATURE_CHECK.
 
 ** AC_C_BIGENDIAN now supports universal binaries a la Mac OS X.
 
@@ -47,6 +47,9 @@ 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.
 
+** Document m4sugar macros m4_version_compare, m4_PACKAGE_VERSION (available
+   without documentation since autoconf 2.53).
+
 ** Warnings are now generated by default when an installer invokes
    'configure' with an unknown --enable-* or --with-* option.
    These warnings can be disabled with the new AC_DISABLE_OPTION_CHECKING
Index: doc/autoconf.texi
===================================================================
RCS file: /sources/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1172
diff -u -p -r1.1172 autoconf.texi
--- doc/autoconf.texi   11 Sep 2007 17:13:13 -0000      1.1172
+++ doc/autoconf.texi   12 Sep 2007 15:20:41 -0000
@@ -10266,6 +10266,42 @@ added.  @code{m4_append} can be used to 
 @code{m4_append_uniq} to grow strings without duplicating substrings.
 @end defmac
 
[EMAIL PROTECTED] m4_version_compare (@var{version-1}, @var{version-2})
[EMAIL PROTECTED]
+Introduced in autoconf 2.53.  Compare the version strings
[EMAIL PROTECTED] and @var{version-2}, and expand to @samp{-1} if
[EMAIL PROTECTED] is smaller, @samp{0} if they are the same, or @samp{1}
[EMAIL PROTECTED] 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.
+
[EMAIL PROTECTED]
+m4_version_compare([1.1], [2.0])
[EMAIL PROTECTED]
+m4_version_compare([2.0b], [2.0a])
[EMAIL PROTECTED]
+m4_version_compare([1.1.1], [1.1.1a])
[EMAIL PROTECTED]
+m4_version_compare([1.2], [1.1.1a])
[EMAIL PROTECTED]
[EMAIL PROTECTED] example
[EMAIL PROTECTED] defmac
+
[EMAIL PROTECTED] m4_PACKAGE_VERSION
[EMAIL PROTECTED]
+Introduced in Autoconf 2.53.  Contains the version of Autoconf currently
+processing the file.  This macro can be used for conditional fallbacks.
+For example, @code{AC_USE_SYSTEM_EXTENSIONS} was only added in Autoconf
+2.60 (@pxref{AC_USE_SYSTEM_EXTENSIONS}), so code that is intended to run
+even with Autoconf 2.59 can do the following in a compatibility file,
+then use the newer macro without worrying about Autoconf versions:
+
[EMAIL PROTECTED]
+m4_if(m4_version_compare(m4_PACKAGE_VERSION, [2.60]), [-1],
+      [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])])
[EMAIL PROTECTED] example
[EMAIL PROTECTED] defmac
 
 
 @node Forbidden Patterns
Index: lib/m4sugar/Makefile.am
===================================================================
RCS file: /sources/autoconf/autoconf/lib/m4sugar/Makefile.am,v
retrieving revision 1.16
diff -u -p -r1.16 Makefile.am
--- lib/m4sugar/Makefile.am     20 Jul 2007 23:11:53 -0000      1.16
+++ lib/m4sugar/Makefile.am     12 Sep 2007 15:20:41 -0000
@@ -1,6 +1,6 @@
 # Make Autoconf library for M4sugar.
 
-# Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 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
@@ -28,7 +28,7 @@ version.m4: $(top_srcdir)/configure.ac
        {                                       \
          echo '# This file is part of -*- Autoconf -*-.'; \
          echo '# Version of Autoconf.'; \
-         echo '# Copyright (C) 1999, 2000, 2001, 2002'; \
+         echo '# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2007'; \
          echo '# Free Software Foundation, Inc.'; \
          echo ;\
          echo 'm4_define([m4_PACKAGE_NAME],      [$(PACKAGE_NAME)])'; \




Reply via email to