fix --disable-modules build
authorAndy Wingo <wingo@pobox.com>
Thu, 30 Jun 2011 10:26:31 +0000 (12:26 +0200)
committerAndy Wingo <wingo@pobox.com>
Thu, 30 Jun 2011 10:26:31 +0000 (12:26 +0200)
* configure.ac (HAVE_MODULES): Define HAVE_MODULES iff
  --enable-modules.

* libguile/deprecated.c (scm_dynamic_args_call)
* libguile/extensions.c (load_extension):
* libguile/init.c (scm_i_init_guile): Use HAVE_MODULES in a few places.

configure.ac
libguile/deprecated.c
libguile/extensions.c
libguile/init.c

index 890557b..cf31cfe 100644 (file)
@@ -234,6 +234,8 @@ dnl files which are destined for separate modules.
 
 if test "$use_modules" != no; then
    AC_LIBOBJ([dynl])
+   AC_DEFINE([HAVE_MODULES], 1,
+     [Define this if you want support for dynamically loaded modules in Guile.])
 fi
 
 if test "$enable_posix" = yes; then
index 2026788..fb93cbd 100644 (file)
@@ -1898,7 +1898,15 @@ SCM_DEFINE (scm_dynamic_args_call, "dynamic-args-call", 3, 0, 0,
   char **argv;
 
   if (scm_is_string (func))
-    func = scm_dynamic_func (func, dobj);
+    {
+#if HAVE_MODULES
+      func = scm_dynamic_func (func, dobj);
+#else
+      scm_misc_error ("dynamic-args-call",
+                      "dynamic-func not available to resolve ~S",
+                      scm_list_1 (func));
+#endif
+    }
   SCM_VALIDATE_POINTER (SCM_ARG1, func);
 
   fptr = SCM_POINTER_VALUE (func);
index d830acb..1c3d28f 100644 (file)
@@ -1,6 +1,6 @@
 /* extensions.c - registering and loading extensions.
  *
- * Copyright (C) 2001, 2006, 2009, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -111,7 +111,13 @@ load_extension (SCM lib, SCM init)
     }
 
   /* Dynamically link the library. */
+#if HAVE_MODULES
   scm_dynamic_call (init, scm_dynamic_link (lib));
+#else
+  scm_misc_error ("load-extension",
+                  "extension ~S:~S not registered and dynamic-link disabled",
+                  scm_list_2 (init, lib));
+#endif
 }
 
 void
index 94de5c9..3dd966f 100644 (file)
@@ -501,7 +501,9 @@ scm_i_init_guile (void *base)
   scm_init_debug ();   /* Requires macro smobs */
   scm_init_random ();   /* Requires smob_prehistory */
   scm_init_simpos ();
+#if HAVE_MODULES
   scm_init_dynamic_linking (); /* Requires smob_prehistory */
+#endif
   scm_bootstrap_i18n ();
   scm_init_script ();