summaryrefslogtreecommitdiffstats
path: root/gl/m4/onceonly_2_57.m4
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2007-01-24 22:47:25 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2007-01-24 22:47:25 +0000
commitfe856aa957978504137c1d425815d4ed8a22be40 (patch)
treea5bb46ce0e64b2056f75700eadbf27aba7c39418 /gl/m4/onceonly_2_57.m4
parent210f39bc84cfbb21cd72dc054e43f13815ee0616 (diff)
downloadmonitoring-plugins-fe856aa957978504137c1d425815d4ed8a22be40.tar.gz
Sync with gnulib - lots of extraneous code removed in preference to GNU code
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1580 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/m4/onceonly_2_57.m4')
-rw-r--r--gl/m4/onceonly_2_57.m486
1 files changed, 86 insertions, 0 deletions
diff --git a/gl/m4/onceonly_2_57.m4 b/gl/m4/onceonly_2_57.m4
new file mode 100644
index 00000000..15884b3e
--- /dev/null
+++ b/gl/m4/onceonly_2_57.m4
@@ -0,0 +1,86 @@
1# onceonly_2_57.m4 serial 4
2dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
3dnl This file is free software, distributed under the terms of the GNU
4dnl General Public License. As a special exception to the GNU General
5dnl Public License, this file may be distributed as part of a program
6dnl that contains a configuration script generated by Autoconf, under
7dnl the same distribution terms as the rest of that program.
8
9dnl This file defines some "once only" variants of standard autoconf macros.
10dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
11dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
12dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
13dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
14dnl The advantage is that the check for each of the headers/functions/decls
15dnl will be put only once into the 'configure' file. It keeps the size of
16dnl the 'configure' file down, and avoids redundant output when 'configure'
17dnl is run.
18dnl The drawback is that the checks cannot be conditionalized. If you write
19dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
20dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
21dnl empty, and the check will be inserted before the body of the AC_DEFUNed
22dnl function.
23
24dnl This is like onceonly.m4, except that it uses diversions to named sections
25dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once,
26dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
27dnl size reduction is ca. 9%.
28
29dnl Autoconf version 2.57 or newer is recommended.
30AC_PREREQ(2.57)
31
32# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
33# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
34AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
35 :
36 AC_FOREACH([gl_HEADER_NAME], [$1], [
37 AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
38 [./-], [___])), [
39 m4_divert_text([INIT_PREPARE],
40 [gl_header_list="$gl_header_list gl_HEADER_NAME"])
41 gl_HEADERS_EXPANSION
42 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
43 [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
44 ])
45 AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
46 [./-], [___])))
47 ])
48])
49m4_define([gl_HEADERS_EXPANSION], [
50 m4_divert_text([DEFAULTS], [gl_header_list=])
51 AC_CHECK_HEADERS([$gl_header_list])
52 m4_define([gl_HEADERS_EXPANSION], [])
53])
54
55# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
56# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
57AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
58 :
59 AC_FOREACH([gl_FUNC_NAME], [$1], [
60 AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
61 m4_divert_text([INIT_PREPARE],
62 [gl_func_list="$gl_func_list gl_FUNC_NAME"])
63 gl_FUNCS_EXPANSION
64 AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
65 [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
66 ])
67 AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
68 ])
69])
70m4_define([gl_FUNCS_EXPANSION], [
71 m4_divert_text([DEFAULTS], [gl_func_list=])
72 AC_CHECK_FUNCS([$gl_func_list])
73 m4_define([gl_FUNCS_EXPANSION], [])
74])
75
76# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
77# AC_CHECK_DECLS(DECL1, DECL2, ...).
78AC_DEFUN([AC_CHECK_DECLS_ONCE], [
79 :
80 AC_FOREACH([gl_DECL_NAME], [$1], [
81 AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
82 AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
83 ])
84 AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
85 ])
86])