Portability for Guile 1.8. Force UTF-8 encoding.
authorPaul Smith <psmith@gnu.org>
Sun, 29 Sep 2013 17:16:21 +0000 (13:16 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 29 Sep 2013 17:16:21 +0000 (13:16 -0400)
ChangeLog
NEWS
TODO.private
guile.c

index fa31980c738d6d897ee702cffff2e04ca54293a8..14ea56d99a74a7bf5517bf955aede916b3d2e684 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2013-09-29  Paul Smith  <psmith@gnu.org>
 
+       * guile.c (GSUBR_TYPE): Pre-2.0 Guile doesn't provide a typedef
+       for gsubr pointers.  Create one.
+       (guile_define_module): Use it.
+       (internal_guile_eval): Force UTF-8 encoding for Guile strings.
+
        * main.c (main): Clear GNUMAKEFLAGS after parsing, to avoid
        proliferation of options.
        * NEWS: Document it.
diff --git a/NEWS b/NEWS
index d190fd3350e8fde115ae2676e36a4ec9d8fc5485..1250ca99217875ce8de7e6ccf56db5649a26362c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,14 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
   * Each backslash/newline (plus subsequent whitespace) is converted to a
     single space
 
+* New feature: GNU Guile integration
+  This version of GNU make can be compiled with GNU Guile integration.
+  GNU Guile serves as an embedded extension language for make.
+  See the "Guile Function" section in the GNU Make manual for details.
+  Currently GNU Guile 1.8 and 2.0+ are supported.  In Guile 1.8 there is no
+  support for internationalized character sets.  In Guile 2.0+, scripts can be
+  encoded in UTF-8.
+
 * New command line option: --output-sync (-O) enables grouping of output by
   target or by recursive make.  This is useful during parallel builds to avoid
   mixing output from different jobs together giving hard-to-understand
@@ -47,6 +55,8 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
 
 * New feature: "!=" shell assignment operator as an alternative to the
   $(shell ...) function.  Implemented for compatibility with BSD makefiles.
+  Note there are subtle differences between "!=" and $(shell ...).  See the
+  description in the GNU make manual.
   WARNING: Backward-incompatibility!
   Variables ending in "!" previously defined as "variable!= value" will now be
   interpreted as shell assignment.  Change your assignment to add whitespace
@@ -58,11 +68,6 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set
   version of POSIX (see http://austingroupbugs.net/view.php?id=330).  It is
   not necessary to define the .POSIX target to access this operator.
 
-* New feature: GNU Guile integration
-  This version of GNU make can be compiled with GNU Guile integration.
-  GNU Guile serves as an embedded extension language for make.
-  See the "Guile Function" section in the GNU Make manual for details.
-
 * New feature: Loadable objects
   This version of GNU make contains a "technology preview": the ability to
   load dynamic objects into the make runtime.  These objects can be created by
index 5c73d9c0577e7d18c9ff0b53955ca53035f459b7..8faa63ec88870a57b67d73ba6b7856dd28be1d06 100644 (file)
@@ -99,30 +99,6 @@ The Rest of the List
     you just can't figure it out.  The way variables are expanded now
     means this isn't 100% trivial, but it probably won't be hard.
 
- 8) Integration of Guile as an embedded scripting language.  This means:
-    allowing Guile functions to be declared in makefiles somehow, then
-    providing a syntax for invoking them.  At least one formulation of
-    that would have the function resolve to a string which would be
-    substituted in the makefile, kind of like $(shell ...) does now, but
-    using the embedded interpreter so there's no process forked of
-    course.  Obviously this is an optional add-on feature.
-
-    It could be more advanced than that, even, who knows?  Maybe make
-    could provide Guile functions that allow Guile scripts more direct
-    access to internal make structures, somehow.  This kind of thing
-    needs a lot of thought.
-
-    Also there's always the flip side: in some very fundamental ways
-    make isn't the best choice right now for a complex build tool.  It's
-    great for simple-to-medium tasks, but there are already other tools
-    available for the really tough situations.  Ask yourself,
-    realistically, how much work is worthwhile to add to make, given the
-    fundamentals you can't really overcome without significantly
-    affecting backward compatibility--and then why not use another tool
-    in the first place?
-
-    Something to think about.
-
 \f
 -------------------------------------------------------------------------------
 Copyright (C) 1997-2013 Free Software Foundation, Inc.
diff --git a/guile.c b/guile.c
index 9c9bf5c44b8701d73ca37cbf108619013251f450..142c321c8b4f565f953b8e927e6a9107c02be7d3 100644 (file)
--- a/guile.c
+++ b/guile.c
@@ -24,6 +24,15 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <libguile.h>
 
+/* Pre-2.0 versions of Guile don't have a typedef for gsubr function types.  */
+#if SCM_MAJOR_VERSION < 2
+# define GSUBR_TYPE               SCM (*) ()
+/* Guile 1.x doesn't really support i18n.  */
+# define scm_from_utf8_string(_s) (_s)
+#else
+# define GSUBR_TYPE     scm_t_subr
+#endif
+
 static SCM make_mod = SCM_EOL;
 static SCM obj_to_str = SCM_EOL;
 
@@ -72,10 +81,10 @@ guile_define_module (void *data UNUSED)
 #include "gmk-default.h"
 
   /* Register a subr for GNU make's eval capability.  */
-  scm_c_define_gsubr ("gmk-expand", 1, 0, 0, (scm_t_subr) guile_expand_wrapper);
+  scm_c_define_gsubr ("gmk-expand", 1, 0, 0, (GSUBR_TYPE) guile_expand_wrapper);
 
   /* Register a subr for GNU make's eval capability.  */
-  scm_c_define_gsubr ("gmk-eval", 1, 0, 0, (scm_t_subr) guile_eval_wrapper);
+  scm_c_define_gsubr ("gmk-eval", 1, 0, 0, (GSUBR_TYPE) guile_eval_wrapper);
 
   /* Define the rest of the module.  */
   scm_c_eval_string (GUILE_module_defn);
@@ -100,7 +109,7 @@ guile_init (void *arg UNUSED)
 static void *
 internal_guile_eval (void *arg)
 {
-  return cvt_scm_to_str (scm_c_eval_string (arg));
+  return cvt_scm_to_str (scm_eval_string (scm_from_utf8_string (arg)));
 }
 
 /* This is the function registered with make  */