xref: /netbsd-src/external/gpl3/autoconf/dist/lib/autoconf/autoheader.m4 (revision d874e91932377fc40d53f102e48fc3ee6f4fe9de)
1# This file is part of Autoconf.                       -*- Autoconf -*-
2# Interface with autoheader.
3
4# Copyright (C) 1992-1996, 1998-2002, 2008-2012 Free Software
5# Foundation, Inc.
6
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.
12#
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.
17#
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.
21#
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 <http://www.gnu.org/licenses/>.
26
27# Written by David MacKenzie, with help from
28# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
29# Roland McGrath, Noah Friedman, david d zuhn, and many others.
30
31
32# AH_OUTPUT(KEY, TEXT)
33# --------------------
34# Pass TEXT to autoheader.
35# This macro is `read' only via `autoconf --trace', it outputs nothing.
36m4_define([AH_OUTPUT], [])
37
38
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.
45#
46# Quote for Perl '' strings, which are those used by Autoheader.
47m4_define([AH_VERBATIM],
48[AS_LITERAL_WORD_IF([$1],
49	       [AH_OUTPUT(_m4_expand([$1]), AS_ESCAPE([[$2]], [\']))])])
50
51
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.
56m4_define([AH_TEMPLATE],
57[AH_VERBATIM([$1],
58	     m4_text_wrap([$2 */], [   ], [/* ])[
59@%:@undef ]_m4_expand([$1]))])
60
61
62# AH_TOP(TEXT)
63# ------------
64# Output TEXT at the top of `config.h.in'.
65m4_define([AH_TOP],
66[m4_define([_AH_COUNTER], m4_incr(_AH_COUNTER))dnl
67AH_VERBATIM([0000]_AH_COUNTER, [$1])])
68
69
70# AH_BOTTOM(TEXT)
71# ---------------
72# Output TEXT at the bottom of `config.h.in'.
73m4_define([AH_BOTTOM],
74[m4_define([_AH_COUNTER], m4_incr(_AH_COUNTER))dnl
75AH_VERBATIM([zzzz]_AH_COUNTER, [$1])])
76
77# Initialize.
78m4_define([_AH_COUNTER], [0])
79