Debian Codegraph @

am/check_macro.m4

raw
1 dnl
2 dnl Copyright (C) 1996-2026 Free Software Foundation, Inc.
3 dnl
4 dnl This file is part of GNU Inetutils.
5 dnl
6 dnl GNU Inetutils is free software: you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation, either version 3 of the License, or (at
9 dnl your option) any later version.
10 dnl
11 dnl GNU Inetutils is distributed in the hope that it will be useful, but
12 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program. If not, see `http://www.gnu.org/licenses/'.
18
19 dnl Written by Miles Bader.
20
21 dnl IU_CHECK_MACRO -- Check for cpp defines
22 dnl $1 - NAME -- printed in message
23 dnl $2 - INCLS -- C program text to include necessary files for testing
24 dnl $3 - MACROS -- a space-separated list of macros that all must be defined
25 dnl defaults to NAME
26 dnl $4 - TRUE -- what to do if all macros are defined; defaults to
27 dnl AC_DEFINE(upcase(HAVE_$1))
28 dnl $5 - FALSE -- what to do if some macros aren't defined
29 dnl
30 AC_DEFUN([IU_CHECK_MACRO], [
31 define([IU_CVAR], [inetutils_cv_macro_]translit($1, [A-Z ./<>], [a-z___]))dnl
32 define([IU_TAG], [IU_CHECK_MACRO_]translit($1, [a-z ./<>], [A-Z___]))dnl
33 AC_CACHE_CHECK([for $1], IU_CVAR,
34 AC_EGREP_CPP(IU_TAG,
35 IU_FLUSHLEFT(
36 [$2
37 #if ]dnl
38 changequote(<<,>>)dnl
39 patsubst(patsubst(ifelse(<<$3>>, , <<$1>>, <<$3>>),
40 <<\>[ ,]+\<>>, << && >>),
41 <<\w+>>, <<defined(\&)>>) dnl
42 changequote([,])dnl
43 [
44 ]IU_TAG[
45 #endif]),
46 IU_CVAR[=yes],
47 IU_CVAR[=no])) dnl
48 IU_RESULT_ACTIONS(IU_CVAR, [$1], [$4], [$5]) dnl
49 undefine([IU_CVAR]) undefine([IU_TAG])])dnl