2 dnl Copyright (C) 2005 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
9 AC_REQUIRE([gl_PREREQ_MINMAX])
12 # Prerequisites of lib/minmax.h.
13 AC_DEFUN([gl_PREREQ_MINMAX],
15 gl_MINMAX_IN_HEADER([limits.h])
16 gl_MINMAX_IN_HEADER([sys/param.h])
19 dnl gl_MINMAX_IN_HEADER(HEADER)
20 AC_DEFUN([gl_MINMAX_IN_HEADER],
22 define([header],[translit([$1],[./-],
24 define([HEADER],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
25 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
26 AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
27 [gl_cv_minmax_in_]header,
28 [AC_TRY_COMPILE([#include <$1>
29 int x = MIN (42, 17);], [],
30 [gl_cv_minmax_in_]header[=yes],
31 [gl_cv_minmax_in_]header[=no])])
32 if test $gl_cv_minmax_in_[]header = yes; then
33 AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
34 [Define to 1 if <$1> defines the MIN and MAX macros.])