Defer Guile initialization until the first $(guile...) call.

This commit is contained in:
Paul Smith 2013-09-22 12:11:13 -04:00
parent 65931ce7a9
commit f69922b335
2 changed files with 15 additions and 3 deletions

View file

@ -1,5 +1,11 @@
2013-09-22 Paul Smith <psmith@gnu.org> 2013-09-22 Paul Smith <psmith@gnu.org>
* guile.c (guile_gmake_setup): Don't initialize Guile so early.
(func_guile): Lazily initialize Guile the first time the $(guile ..)
function is invoked. Guile can steal file descriptors which
confuses our jobserver FD checking, so we don't want to initialize
it before we have to.
VMS port updates by Hartmut Becker <becker.ismaning@freenet.de> VMS port updates by Hartmut Becker <becker.ismaning@freenet.de>
* makefile.com: Add output to the filelist. * makefile.com: Add output to the filelist.

12
guile.c
View file

@ -107,6 +107,15 @@ internal_guile_eval (void *arg)
static char * static char *
func_guile (const char *funcname UNUSED, int argc UNUSED, char **argv) func_guile (const char *funcname UNUSED, int argc UNUSED, char **argv)
{ {
static int init = 0;
if (! init)
{
/* Initialize the Guile interpreter. */
scm_with_guile (guile_init, NULL);
init = 1;
}
if (argv[0] && argv[0][0] != '\0') if (argv[0] && argv[0][0] != '\0')
return scm_with_guile (internal_guile_eval, argv[0]); return scm_with_guile (internal_guile_eval, argv[0]);
@ -120,9 +129,6 @@ func_guile (const char *funcname UNUSED, int argc UNUSED, char **argv)
int int
guile_gmake_setup (const gmk_floc *flocp UNUSED) guile_gmake_setup (const gmk_floc *flocp UNUSED)
{ {
/* Initialize the Guile interpreter. */
scm_with_guile (guile_init, NULL);
/* Create a make function "guile". */ /* Create a make function "guile". */
gmk_add_function ("guile", func_guile, 0, 1, 1); gmk_add_function ("guile", func_guile, 0, 1, 1);