annotate m4/onceonly.m4 @ 276:23034db7dd8a 2.5

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