annotate m4/onceonly_2_57.m4 @ 6479:913b40e88d1a

Update
author Sergey Poznyakoff <gray@gnu.org.ua>
date Fri, 09 Dec 2005 12:34:04 +0000
parents 954deae9185d
children b392232a8925
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4259
5281b6fad974 Require autoconf 2.54 or newer.
Bruno Haible <bruno@clisp.org>
parents: 4258
diff changeset
1 # onceonly_2_57.m4 serial 3
6018
954deae9185d Really require autoconf-2.57.
Bruno Haible <bruno@clisp.org>
parents: 4262
diff changeset
2 dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software, distributed under the terms of the GNU
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl General Public License. As a special exception to the GNU General
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl Public License, this file may be distributed as part of a program
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 dnl that contains a configuration script generated by Autoconf, under
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 dnl the same distribution terms as the rest of that program.
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 dnl This file defines some "once only" variants of standard autoconf macros.
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 dnl The advantage is that the check for each of the headers/functions/decls
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 dnl will be put only once into the 'configure' file. It keeps the size of
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 dnl the 'configure' file down, and avoids redundant output when 'configure'
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 dnl is run.
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 dnl The drawback is that the checks cannot be conditionalized. If you write
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 dnl empty, and the check will be inserted before the body of the AC_DEFUNed
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 dnl function.
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 dnl This is like onceonly.m4, except that it uses diversions to named sections
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once,
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 dnl size reduction is ca. 9%.
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
4259
5281b6fad974 Require autoconf 2.54 or newer.
Bruno Haible <bruno@clisp.org>
parents: 4258
diff changeset
29 dnl Autoconf version 2.57 or newer is recommended.
6018
954deae9185d Really require autoconf-2.57.
Bruno Haible <bruno@clisp.org>
parents: 4262
diff changeset
30 AC_PREREQ(2.57)
4259
5281b6fad974 Require autoconf 2.54 or newer.
Bruno Haible <bruno@clisp.org>
parents: 4258
diff changeset
31
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 # AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 :
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 AC_FOREACH([gl_HEADER_NAME], [$1], [
4257
3f4c98927276 Fix quoting bug.
Bruno Haible <bruno@clisp.org>
parents: 4107
diff changeset
37 AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
3f4c98927276 Fix quoting bug.
Bruno Haible <bruno@clisp.org>
parents: 4107
diff changeset
38 [./-], [___])), [
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 m4_divert_text([INIT_PREPARE],
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 [gl_header_list="$gl_header_list gl_HEADER_NAME"])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 gl_HEADERS_EXPANSION
4262
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
42 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
43 [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 ])
4257
3f4c98927276 Fix quoting bug.
Bruno Haible <bruno@clisp.org>
parents: 4107
diff changeset
45 AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
3f4c98927276 Fix quoting bug.
Bruno Haible <bruno@clisp.org>
parents: 4107
diff changeset
46 [./-], [___])))
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 m4_define([gl_HEADERS_EXPANSION], [
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 m4_divert_text([DEFAULTS], [gl_header_list=])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 AC_CHECK_HEADERS([$gl_header_list])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 m4_define([gl_HEADERS_EXPANSION], [])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 # AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 :
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 AC_FOREACH([gl_FUNC_NAME], [$1], [
4262
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
60 AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 m4_divert_text([INIT_PREPARE],
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 [gl_func_list="$gl_func_list gl_FUNC_NAME"])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 gl_FUNCS_EXPANSION
4262
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
64 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
65 [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 ])
4262
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
67 AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 m4_define([gl_FUNCS_EXPANSION], [
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
71 m4_divert_text([DEFAULTS], [gl_func_list=])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 AC_CHECK_FUNCS([$gl_func_list])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 m4_define([gl_FUNCS_EXPANSION], [])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 # AC_CHECK_DECLS(DECL1, DECL2, ...).
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 AC_DEFUN([AC_CHECK_DECLS_ONCE], [
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
79 :
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 AC_FOREACH([gl_DECL_NAME], [$1], [
4262
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
81 AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
82 AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
83 ])
4262
4df9cc2741fb Use new documented autoconf macros.
Bruno Haible <bruno@clisp.org>
parents: 4259
diff changeset
84 AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
4107
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
85 ])
7c1a6b73f48e An autoconf macro for its associated module.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
86 ])