annotate m4/onceonly.m4 @ 445:7899511b2102 3.0

Added tag 3.0.1 for changeset a8934dfba400
author lost@l-w.ca
date Sat, 30 Oct 2010 15:22:55 -0600
parents b8bf63962a99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
434
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
1 # onceonly.m4 serial 6
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
2 dnl Copyright (C) 2002-2003, 2005-2006, 2008-2010 Free Software Foundation,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
3 dnl Inc.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
4 dnl This file is free software, distributed under the terms of the GNU
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
5 dnl General Public License. As a special exception to the GNU General
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
6 dnl Public License, this file may be distributed as part of a program
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
7 dnl that contains a configuration script generated by Autoconf, under
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
8 dnl the same distribution terms as the rest of that program.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
9
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
10 dnl This file defines some "once only" variants of standard autoconf macros.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
11 dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
12 dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
13 dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
14 dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
15 dnl The advantage is that the check for each of the headers/functions/decls
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
16 dnl will be put only once into the 'configure' file. It keeps the size of
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
17 dnl the 'configure' file down, and avoids redundant output when 'configure'
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
18 dnl is run.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
19 dnl The drawback is that the checks cannot be conditionalized. If you write
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
20 dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
21 dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
22 dnl empty, and the check will be inserted before the body of the AC_DEFUNed
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
23 dnl function.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
24
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
25 dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
26 dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
27 dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
28 dnl headers at once, thus reducing the size of 'configure'. It is known to work
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
29 dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
30
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
31 dnl Autoconf version 2.59 plus gnulib is required; this file is not needed
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
32 dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
33 dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
34 dnl argument!
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
35 AC_PREREQ([2.59])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
36
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
37 # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
38 # AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
39 AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
40 :
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
41 m4_foreach_w([gl_HEADER_NAME], [$1], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
42 AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
43 [./-], [___])), [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
44 m4_divert_text([INIT_PREPARE],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
45 [gl_header_list="$gl_header_list gl_HEADER_NAME"])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
46 gl_HEADERS_EXPANSION
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
47 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
48 [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
49 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
50 AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
51 [./-], [___])))
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
52 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
53 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
54 m4_define([gl_HEADERS_EXPANSION], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
55 m4_divert_text([DEFAULTS], [gl_header_list=])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
56 AC_CHECK_HEADERS([$gl_header_list])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
57 m4_define([gl_HEADERS_EXPANSION], [])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
58 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
59
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
60 # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
61 # AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
62 AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
63 :
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
64 m4_foreach_w([gl_FUNC_NAME], [$1], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
65 AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
66 m4_divert_text([INIT_PREPARE],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
67 [gl_func_list="$gl_func_list gl_FUNC_NAME"])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
68 gl_FUNCS_EXPANSION
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
69 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
70 [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
71 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
72 AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
73 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
74 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
75 m4_define([gl_FUNCS_EXPANSION], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
76 m4_divert_text([DEFAULTS], [gl_func_list=])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
77 AC_CHECK_FUNCS([$gl_func_list])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
78 m4_define([gl_FUNCS_EXPANSION], [])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
79 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
80
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
81 # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
82 # AC_CHECK_DECLS(DECL1, DECL2, ...).
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
83 AC_DEFUN([AC_CHECK_DECLS_ONCE], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
84 :
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
85 m4_foreach_w([gl_DECL_NAME], [$1], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
86 AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
87 AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
88 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
89 AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
90 ])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
91 ])