Hello Bruno.

I think it's time to re-submit my patch to minmax.m4.
A new version of the patch is attached to this mail.

Again, it features:

> - use m4_pushdef/m4_popdef instead of define/undefine

As I explained before, you cannot inadvertently undefine([HEADER]).

> - avoid the obsoleted AC_TRY_COMPILE

Some people run "autoconf -W obsolete", and the macros from gnulib
shouldn't spoil it.

> - use AS_TR_* instead of raw m4_translit


Do you see any problem with this patch?  All used macros are now documented.

Have a nice day,
        Stepan

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

        * minmax.m4 (gl_MINMAX_IN_HEADER): Use m4_pushdef/m4_popdef.
        Also use more modern macros.

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        30 Jun 2005 16:36:01 -0000
@@ -17,22 +17,21 @@
 ])
 
 dnl gl_MINMAX_IN_HEADER(HEADER)
+dnl   The parameter has to be a literal header name; it cannot be macro,
+dnl   nor a shell variable.
 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_[]AS_TR_SH([$1]))
   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
-    AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
+    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_]AS_TR_CPP([$1]), 1,
       [Define to 1 if <$1> defines the MIN and MAX macros.])
   fi
-  undefine([HEADER])
-  undefine([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