]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Module 'minmax' from gnulib.
authorBruno Haible <bruno@clisp.org>
Sat, 22 Jul 2006 15:43:56 +0000 (15:43 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:13:39 +0000 (12:13 +0200)
gettext-tools/m4/ChangeLog
gettext-tools/m4/Makefile.am
gettext-tools/m4/minmax.m4 [new file with mode: 0644]

index 0ab037e000942449d09bb100f150594cf0f871ba..1e0dff69b16d5ffa6976a02602b6c6e82e2946cb 100644 (file)
@@ -1,5 +1,8 @@
 2006-07-22  Bruno Haible  <bruno@clisp.org>
 
+       * minmax.m4: New file, from gnulib.
+       * Makefile.am (EXTRA_DIST): Add it.
+
        * mbswidth.m4: Update from gnulib.
 
        * wcwidth.m4: New file, from gnulib.
index 2127047f50845ad4a181593c5a392a60e950c10f..0234e6e91c7950a71b7e01606774f73da664ec81 100644 (file)
@@ -74,6 +74,7 @@ mbrtowc.m4 \
 mbstate_t.m4 \
 mbswidth.m4 \
 memchr.m4 \
+minmax.m4 \
 mkdtemp.m4 \
 onceonly.m4 \
 pathmax.m4 \
diff --git a/gettext-tools/m4/minmax.m4 b/gettext-tools/m4/minmax.m4
new file mode 100644 (file)
index 0000000..bbd1ba0
--- /dev/null
@@ -0,0 +1,41 @@
+# minmax.m4 serial 2
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_PREREQ(2.52)
+
+AC_DEFUN([gl_MINMAX],
+[
+  AC_REQUIRE([gl_PREREQ_MINMAX])
+])
+
+# Prerequisites of lib/minmax.h.
+AC_DEFUN([gl_PREREQ_MINMAX],
+[
+  gl_MINMAX_IN_HEADER([limits.h])
+  gl_MINMAX_IN_HEADER([sys/param.h])
+])
+
+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. (Because autoheader collects only AC_DEFINE
+dnl invocations with a literal macro name.)
+AC_DEFUN([gl_MINMAX_IN_HEADER],
+[
+  m4_pushdef([header], AS_TR_SH([$1]))
+  m4_pushdef([HEADER], AS_TR_CPP([$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,
+      [Define to 1 if <$1> defines the MIN and MAX macros.])
+  fi
+  m4_popdef([HEADER])
+  m4_popdef([header])
+])