4 |
|
|
5 |
When Guile is installed, a set of autoconf macros is also installed as |
When Guile is installed, a set of autoconf macros is also installed as |
6 |
PREFIX/share/aclocal/guile.m4. This chapter documents the macros provided in |
PREFIX/share/aclocal/guile.m4. This chapter documents the macros provided in |
7 |
that file. @xref{Top,The GNU Autoconf Manual,,autoconf}, for more info. |
that file, as well as the high-level guile-tool Autofrisk. @xref{Top,The GNU |
8 |
|
Autoconf Manual,,autoconf}, for more info. |
9 |
|
|
10 |
@menu |
@menu |
11 |
* Autoconf Background:: Why use autoconf? |
* Autoconf Background:: Why use autoconf? |
12 |
* Autoconf Macros:: The GUILE_* macros. |
* Autoconf Macros:: The GUILE_* macros. |
13 |
* Using Autoconf Macros:: How to use them, plus examples. |
* Using Autoconf Macros:: How to use them, plus examples. |
14 |
|
* Autofrisk:: AUTOFRISK_CHECKS and AUTOFRISK_SUMMARY. |
15 |
|
* Using Autofrisk:: Example modules.af files. |
16 |
@end menu |
@end menu |
17 |
|
|
18 |
|
|
123 |
$(INSTALL) my/*.scm $(instdir) |
$(INSTALL) my/*.scm $(instdir) |
124 |
@end example |
@end example |
125 |
|
|
126 |
|
|
127 |
|
@node Autofrisk |
128 |
|
@section Autofrisk |
129 |
|
|
130 |
|
The @dfn{guile-tools autofrisk} command looks for the file @file{modules.af} |
131 |
|
in the current directory and writes out @file{modules.af.m4} containing |
132 |
|
autoconf definitions for @code{AUTOFRISK_CHECKS} and @code{AUTOFRISK_SUMMARY}. |
133 |
|
@xref{Autoconf Background}, and @xref{Using Autoconf Macros}, for more info. |
134 |
|
|
135 |
|
The modules.af file consists of a series of configuration forms (Scheme |
136 |
|
lists), which have one of the following formats: |
137 |
|
|
138 |
|
@example |
139 |
|
(files-glob PATTERN ...) ;; required |
140 |
|
(non-critical-external MODULE ...) ;; optional |
141 |
|
(non-critical-internal MODULE ...) ;; optional |
142 |
|
(programs (MODULE PROG ...) ...) ;; optional |
143 |
|
(pww-varname VARNAME) ;; optional |
144 |
|
@end example |
145 |
|
|
146 |
|
@var{pattern} is a string that may contain "*" and "?" characters to be |
147 |
|
expanded into filenames. @var{module} is a list of symbols naming a module, |
148 |
|
such as `(srfi srfi-1)'. @var{varname} is a shell-safe name to use instead of |
149 |
|
@code{probably_wont_work}, the default. This var is passed to `AC_SUBST'. |
150 |
|
@var{prog} is a string that names a program, such as "gpg". |
151 |
|
|
152 |
|
Autofrisk expands the @code{files-glob} pattern(s) into a list of files, scans |
153 |
|
each file's module definition form(s), and constructs a module dependency |
154 |
|
graph wherein modules defined by @code{define-module} are considered |
155 |
|
@dfn{internal} and the remaining, @dfn{external}. For each external module |
156 |
|
that has an internal dependency, Autofrisk emits a |
157 |
|
@code{GUILE_MODULE_REQUIRED} check (@pxref{Autoconf Macros}), which altogether |
158 |
|
form the body of @code{AUTOFRISK_CHECKS}. |
159 |
|
|
160 |
|
@code{GUILE_MODULE_REQUIRED} causes the @file{configure} script to exit with |
161 |
|
an error message if the specified module is not available; it enforces a |
162 |
|
strong dependency. You can temper dependency strength by using the |
163 |
|
@code{non-critical-external} and @code{non-critical-internal} configuration |
164 |
|
forms in modules.af. For graph edges that touch such non-critical modules, |
165 |
|
Autofrisk uses @code{GUILE_MODULE_AVAILABLE}, and arranges for |
166 |
|
@code{AUTOFRISK_SUMMARY} to display a warning if they are not found. |
167 |
|
|
168 |
|
The shell code resulting from the expansion of @code{AUTOFRISK_CHECKS} and |
169 |
|
@code{AUTOFRISK_SUMMARY} uses the shell variable @code{probably_wont_work} to |
170 |
|
collect the names of unfound non-critical modules. If this bothers you, use |
171 |
|
configuration form @code{(pww-name foo)} in modules.af. |
172 |
|
|
173 |
|
Although Autofrisk does not detect when a module uses a program (for example, |
174 |
|
in a @code{system} call), it can generate @code{AC_PATH_PROG} forms anyway if |
175 |
|
you use the @code{programs} configuration form in modules.af. These are |
176 |
|
collected into @code{AUTOCONF_CHECKS}. |
177 |
|
|
178 |
|
@xref{Using Autofrisk}, for some modules.af examples. |
179 |
|
|
180 |
|
|
181 |
|
@node Using Autofrisk |
182 |
|
@section Using Autofrisk |
183 |
|
|
184 |
|
Using Autofrisk (@pxref{Autofrisk}) involves writing @file{modules.af} and |
185 |
|
adding two macro calls to @file{configure.in}. Here is an example of the |
186 |
|
latter: |
187 |
|
|
188 |
|
@example |
189 |
|
AUTOFRISK_CHECKS |
190 |
|
AUTOFRISK_SUMMARY |
191 |
|
@end example |
192 |
|
|
193 |
|
Here is an adaptation of the second "GUILE_*" example (@pxref{Using Autoconf |
194 |
|
Macros}) that does basically the same thing. |
195 |
|
|
196 |
|
@example |
197 |
|
(files-glob "my/*.scm") |
198 |
|
(non-critical-external (database postgres)) |
199 |
|
(programs ((my gpgutils) "gpg")) ;; (my gpgutils) uses "gpg" |
200 |
|
@end example |
201 |
|
|
202 |
|
If the SRFI modules (@pxref{SRFI Support}) were a separate package, we could |
203 |
|
use @code{guile-tools frisk} to find out its dependencies: |
204 |
|
|
205 |
|
@example |
206 |
|
$ guile-tools frisk srfi/*.scm |
207 |
|
13 files, 18 modules (13 internal, 5 external), 9 edges |
208 |
|
|
209 |
|
x (ice-9 and-let-star) |
210 |
|
regular (srfi srfi-2) |
211 |
|
x (ice-9 syncase) |
212 |
|
regular (srfi srfi-11) |
213 |
|
x (ice-9 rdelim) |
214 |
|
regular (srfi srfi-10) |
215 |
|
x (ice-9 receive) |
216 |
|
regular (srfi srfi-8) |
217 |
|
regular (srfi srfi-1) |
218 |
|
x (ice-9 session) |
219 |
|
regular (srfi srfi-1) |
220 |
|
@end example |
221 |
|
|
222 |
|
Then, we could use the following modules.af to help configure it: |
223 |
|
|
224 |
|
@example |
225 |
|
(files-glob "srfi/*.scm") |
226 |
|
(non-critical-external ;; relatively recent |
227 |
|
(ice-9 rdelim) |
228 |
|
(ice-9 receive) |
229 |
|
(ice-9 and-let-star)) |
230 |
|
(pww-varname not_fully_supported) |
231 |
|
@end example |
232 |
|
|
233 |
@c autoconf.texi ends here |
@c autoconf.texi ends here |