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 dnl The parameter has to be a literal header name; it cannot be macro,
21 dnl nor a shell variable.
22 AC_DEFUN([gl_MINMAX_IN_HEADER],
24 define([header],[translit([$1],[./-],
26 define([HEADER],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
27 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
28 AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
29 [gl_cv_minmax_in_]header,
30 [AC_TRY_COMPILE([#include <$1>
31 int x = MIN (42, 17);], [],
32 [gl_cv_minmax_in_]header[=yes],
33 [gl_cv_minmax_in_]header[=no])])
34 if test $gl_cv_minmax_in_[]header = yes; then
35 AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
36 [Define to 1 if <$1> defines the MIN and MAX macros.])