Hi Bruno,

I read your macro in minmax.m4.  I'd like to propose some
changes in style:
- avoid the obsoleted AC_TRY_COMPILE
- use m4_pushdef/m4_popdef instead of define/undefine
- use AS_TR_* instead of raw m4_translit

A patch with my proposal is attached; it's not tested, sorry.

Could you please find some time to look at it?

[FYI: I'll be offline Jun 7 - Jun 21.]

Have a nice day,
        Stepan
2005-06-03  Stepan Kasal  <[EMAIL PROTECTED]>

        * minmax.m4 (gl_MINMAX_IN_HEADER): 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        3 Jun 2005 11:53:03 -0000
@@ -19,20 +19,19 @@
 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)
+  AS_LITERAL_IF([$1], [],
+    [m4_fatal([gl_MINMAX_IN_HEADER requires a literal parameter.])])
+  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