Debian Codegraph @

m4/minmax.m4

raw
1 # minmax.m4
2 # serial 4
3 dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
8
9 AC_PREREQ([2.53])
10
11 AC_DEFUN([gl_MINMAX],
12 [
13 AC_REQUIRE([gl_PREREQ_MINMAX])
14 ])
15
16 # Prerequisites of lib/minmax.h.
17 AC_DEFUN([gl_PREREQ_MINMAX],
18 [
19 gl_MINMAX_IN_HEADER([limits.h])
20 gl_MINMAX_IN_HEADER([sys/param.h])
21 ])
22
23 dnl gl_MINMAX_IN_HEADER(HEADER)
24 dnl The parameter has to be a literal header name; it cannot be macro,
25 dnl nor a shell variable. (Because autoheader collects only AC_DEFINE
26 dnl invocations with a literal macro name.)
27 AC_DEFUN([gl_MINMAX_IN_HEADER],
28 [
29 m4_pushdef([header], AS_TR_SH([$1]))
30 m4_pushdef([HEADER], AS_TR_CPP([$1]))
31 AC_CACHE_CHECK([whether <$1> defines MIN and MAX],
32 [gl_cv_minmax_in_]header,
33 [AC_COMPILE_IFELSE(
34 [AC_LANG_PROGRAM(
35 [[#include <$1>
36 int x = MIN (42, 17);]],
37 [[]])],
38 [gl_cv_minmax_in_]header[=yes],
39 [gl_cv_minmax_in_]header[=no])])
40 if test $gl_cv_minmax_in_[]header = yes; then
41 AC_DEFINE([HAVE_MINMAX_IN_]HEADER, 1,
42 [Define to 1 if <$1> defines the MIN and MAX macros.])
43 fi
44 m4_popdef([HEADER])
45 m4_popdef([header])
46 ])