Hello,

On Fri, Jun 03, 2005 at 05:53:00PM +0200, Bruno Haible wrote:
> AS_TR_* are not documented in the autoconf manual

You are right.  I have to start by documenting AS_TR_SH, AS_TR_CPP,
AS_LITERAL_IF and m4_fatal.  Then I can resubmit the patch.

> AC_TRY_COMPILE is shorter and more mnemonic than the *_IFELSE macros.

I believe there were good reasons why it was obsoleted.  (Double quotes
its param, and we cannot change the behaviour without renaming it.)
If people continue to use it, they can experience unwanted surprises.

If you use obsolete macros in your code, users will follow you.
Please help spreading the message and avoid using it.

> > - use m4_pushdef/m4_popdef instead of define/undefine

This change was important.

Your macro does m4_undefine([header]) and m4_undefine([HEADER]).
What if these symboles were already defined?
(Perhaps by another macro, written in a similar style.)

An updated patch attached.

Stepan
2005-06-04  Stepan Kasal  <[EMAIL PROTECTED]>

        * minmax.m4 (gl_MINMAX_IN_HEADER): Don't use obsolete AC_TRY_COMPILE;
          use m4_pushdef/m4_popdef.

Index: m4/minmax.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/minmax.m4,v
retrieving revision 1.1
diff -u -r1.1 minmax.m4
--- m4/minmax.m4        23 May 2005 10:25:53 -0000      1.1
+++ m4/minmax.m4        4 Jun 2005 06:43:55 -0000
@@ -19,20 +19,20 @@
 dnl gl_MINMAX_IN_HEADER(HEADER)
 AC_DEFUN([gl_MINMAX_IN_HEADER],
 [
-  define([header],[translit([$1],[./-],
-                                 [___])])
-  define([HEADER],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                                 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  AC_PREREQ(2.50)
+  m4_pushdef([gl_CACHE_VAR], gl_cv_minmax_in_[]translit([$1], [./-], [___]))
+  m4_pushdef([HEADER],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
   AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
-    [gl_cv_minmax_in_]header,
-    [AC_TRY_COMPILE([#include <$1>
-int x = MIN (42, 17);], [],
-       [gl_cv_minmax_in_]header[=yes],
-       [gl_cv_minmax_in_]header[=no])])
-  if test $gl_cv_minmax_in_[]header = yes; then
+    gl_CACHE_VAR,
+    [AC_COMPILE_IFELSE([#include <$1>
+                       int x = MIN (42, 17);],
+       [gl_CACHE_VAR=yes],
+       [gl_CACHE_VAR=no])])
+  if test $gl_CACHE_VAR = yes; then
     AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
       [Define to 1 if <$1> defines the MIN and MAX macros.])
   fi
-  undefine([HEADER])
-  undefine([header])
+  m4_popdef([HEADER])
+  m4_popdef([gl_CACHE_VAR])
 ])
_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to