*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / gnulib / m4 / onceonly_2_57.m4
CommitLineData
f6ea5628 1# onceonly_2_57.m4 serial 4
4c38e0a4
JB
2dnl Copyright (C) 2002-2003, 2005-2006, 2009, 2010
3Free Software Foundation, Inc.
f6ea5628
DJ
4dnl This file is free software, distributed under the terms of the GNU
5dnl General Public License. As a special exception to the GNU General
6dnl Public License, this file may be distributed as part of a program
7dnl that contains a configuration script generated by Autoconf, under
8dnl the same distribution terms as the rest of that program.
9
10dnl This file defines some "once only" variants of standard autoconf macros.
11dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
12dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
13dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
14dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
15dnl The advantage is that the check for each of the headers/functions/decls
16dnl will be put only once into the 'configure' file. It keeps the size of
17dnl the 'configure' file down, and avoids redundant output when 'configure'
18dnl is run.
19dnl The drawback is that the checks cannot be conditionalized. If you write
20dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
21dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
22dnl empty, and the check will be inserted before the body of the AC_DEFUNed
23dnl function.
24
25dnl This is like onceonly.m4, except that it uses diversions to named sections
26dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once,
27dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
28dnl size reduction is ca. 9%.
29
30dnl Autoconf version 2.57 or newer is recommended.
31AC_PREREQ(2.57)
32
33# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
34# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
35AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
36 :
37 AC_FOREACH([gl_HEADER_NAME], [$1], [
38 AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
39 [./-], [___])), [
40 m4_divert_text([INIT_PREPARE],
41 [gl_header_list="$gl_header_list gl_HEADER_NAME"])
42 gl_HEADERS_EXPANSION
43 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
44 [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
45 ])
46 AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
47 [./-], [___])))
48 ])
49])
50m4_define([gl_HEADERS_EXPANSION], [
51 m4_divert_text([DEFAULTS], [gl_header_list=])
52 AC_CHECK_HEADERS([$gl_header_list])
53 m4_define([gl_HEADERS_EXPANSION], [])
54])
55
56# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
57# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
58AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
59 :
60 AC_FOREACH([gl_FUNC_NAME], [$1], [
61 AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
62 m4_divert_text([INIT_PREPARE],
63 [gl_func_list="$gl_func_list gl_FUNC_NAME"])
64 gl_FUNCS_EXPANSION
65 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
66 [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
67 ])
68 AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
69 ])
70])
71m4_define([gl_FUNCS_EXPANSION], [
72 m4_divert_text([DEFAULTS], [gl_func_list=])
73 AC_CHECK_FUNCS([$gl_func_list])
74 m4_define([gl_FUNCS_EXPANSION], [])
75])
76
77# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
78# AC_CHECK_DECLS(DECL1, DECL2, ...).
79AC_DEFUN([AC_CHECK_DECLS_ONCE], [
80 :
81 AC_FOREACH([gl_DECL_NAME], [$1], [
82 AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
83 AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
84 ])
85 AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
86 ])
87])
This page took 0.19266 seconds and 4 git commands to generate.