1 # This file is part of Autoconf. -*- Autoconf -*-
2 # Interface with autoheader.
4 # Copyright (C) 1992-1996, 1998-2002, 2008-2017, 2020-2024 Free Software
7 # This file is part of Autoconf. This program is free
8 # software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the
10 # Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # Under Section 7 of GPL version 3, you are granted additional
19 # permissions described in the Autoconf Configure Script Exception,
20 # version 3.0, as published by the Free Software Foundation.
22 # You should have received a copy of the GNU General Public License
23 # and a copy of the Autoconf Configure Script Exception along with
24 # this program; see the files COPYINGv3 and COPYING.EXCEPTION
25 # respectively. If not, see <https://www.gnu.org/licenses/>.
27 # Written by David MacKenzie, with help from
28 # François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
29 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
32 # AH_OUTPUT(KEY, TEXT)
33 # --------------------
34 # Pass TEXT to autoheader.
35 # This macro is 'read' only via 'autoconf --trace', it outputs nothing.
36 m4_define([AH_OUTPUT], [])
39 # AH_VERBATIM(KEY, TEMPLATE)
40 # --------------------------
41 # If KEY is direct (i.e., no indirection such as in KEY=$my_func which
42 # may occur if there is AC_CHECK_FUNCS($my_func)), issue an autoheader
43 # TEMPLATE associated to the KEY. Otherwise, do nothing. TEMPLATE is
44 # output as is, with no formatting.
46 # Quote for Perl '' strings, which are those used by Autoheader.
47 m4_define([AH_VERBATIM],
48 [AS_LITERAL_WORD_IF([$1],
49 [AH_OUTPUT(_m4_expand([$1]), AS_ESCAPE([[$2]], [\']))])])
52 # AH_TEMPLATE(KEY, DESCRIPTION)
53 # -----------------------------
54 # Issue an autoheader template for KEY, i.e., a comment composed of
55 # DESCRIPTION (properly wrapped), and then #undef KEY.
56 m4_define([AH_TEMPLATE],
58 m4_text_wrap([$2 */], [ ], [/* ])[
59 @%:@undef ]_m4_expand([$1]))])
64 # Output TEXT at the top of 'config.h.in'.
66 [m4_define([_AH_COUNTER], m4_incr(_AH_COUNTER))dnl
67 AH_VERBATIM([0000]_AH_COUNTER, [$1])])
72 # Output TEXT at the bottom of 'config.h.in'.
73 m4_define([AH_BOTTOM],
74 [m4_define([_AH_COUNTER], m4_incr(_AH_COUNTER))dnl
75 AH_VERBATIM([zzzz]_AH_COUNTER, [$1])])
78 m4_define([_AH_COUNTER], [0])