Subject: bug#7995: [PATCH 4/4] Implement Guile support.

From: Ralf Wildenhues <[email-masked]>
Date: Sun, 20 Feb 2011 08:32:33 +0100

* automake.in: Register new language 'Guile'.
(handle_guile): New function.
(generate_makefile): Call it.
(am_install_var): Treat 'GUILE' primary like JAVA and PYTHON.
* lib/am/guile.am: New file.
* lib/am/Makefile.am (dist_am_DATA): Add guile.am.
---
 ChangeLog          |    8 ++++++++
 automake.in        |   36 ++++++++++++++++++++++++++++++++----
 lib/am/Makefile.am |    3 ++-
 lib/am/Makefile.in |    3 ++-
 lib/am/guile.am    |   35 +++++++++++++++++++++++++++++++++++
 5 files changed, 79 insertions(+), 6 deletions(-)
 create mode 100644 lib/am/guile.am

diff --git a/ChangeLog b/ChangeLog
index bd27a05..bff6c15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-02-20  Ralf Wildenhues  <[email-masked]>
 
+	Implement Guile support.
+	* automake.in: Register new language 'Guile'.
+	(handle_guile): New function.
+	(generate_makefile): Call it.
+	(am_install_var): Treat 'GUILE' primary like JAVA and PYTHON.
+	* lib/am/guile.am: New file.
+	* lib/am/Makefile.am (dist_am_DATA): Add guile.am.
+
 	Guile macro AM_PATH_GUILE.
 	* m4/guile.m4 (AM_PATH_GUILE): New file, new macro.
 	* m4/Makefile.am (dist_m4data_DATA): Add guile.m4.
diff --git a/automake.in b/automake.in
index ef3b8a6..240dc7f 100644
--- a/automake.in
+++ b/automake.in
@@ -1041,6 +1041,18 @@ register_language ('name' => 'java',
 		   'pure' => 1,
 		   'extensions' => ['.java', '.class', '.zip', '.jar']);
 
+# Guile.
+register_language ('name' => 'guile',
+		   'Name' => 'Guile',
+		   'config_vars' => ['GUILE_TOOLS'],
+		   'flags' => ['GUILEFLAGS'],
+		   'compile' => '$(GUILE_TOOLS) compile $(AM_GUILEFLAGS) $(GUILEFLAGS)',
+		   'output_flag' => '-o',
+		   'ccer' => 'GUILE_TOOLS',
+		   'compiler' => 'GUILECOMPILE',
+		   'pure' => 1,
+		   'extensions' => ['.scm', '.sls', '.sps', '.ss']);
+
 ################################################################
 
 # Error reporting functions.
@@ -5122,6 +5134,16 @@ sub handle_python
   &define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
 }
 
+# Handle Guile
+sub handle_guile
+{
+  my @guilefiles = &am_install_var ('-defaultdist', 'guile', 'GUILE',
+				    'noinst');
+  return if ! @guilefiles;
+
+  require_variables ($guilefiles[0][0], "Guile sources seen", TRUE, 'GUILE_TOOLS');
+}
+
 # Handle Java.
 sub handle_java
 {
@@ -7541,9 +7563,11 @@ sub am_install_var
   # variables, it is an error to actually define the primary.  We
   # allow `JAVA', as it is customarily used to mean the Java
   # interpreter.  This is but one of several Java hacks.  Similarly,
-  # `PYTHON' is customarily used to mean the Python interpreter.
+  # `PYTHON' is customarily used to mean the Python interpreter,
+  # and `GUILE' is set by the Autoconf macros from Guile.
   reject_var $primary, "`$primary' is an anachronism"
-    unless $primary eq 'JAVA' || $primary eq 'PYTHON';
+    unless $primary eq 'JAVA' || $primary eq 'PYTHON'
+    || $primary eq 'GUILE';
 
   # Get the prefixes which are valid and actually used.
   @prefix = am_primary_prefixes ($primary, $can_dist, @prefix);
@@ -7674,7 +7698,9 @@ sub am_install_var
 
   # The JAVA variable is used as the name of the Java interpreter.
   # The PYTHON variable is used as the name of the Python interpreter.
-  if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON')
+  # The GUILE variable is used as the name of the Guile interpreter.
+  if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON'
+      && $primary ne 'GUILE')
     {
       # Define it.
       define_pretty_variable ($primary, TRUE, INTERNAL, @used);
@@ -7688,7 +7714,8 @@ sub am_install_var
 
   # Push here because PRIMARY might be configure time determined.
   push (@all, '$(' . $primary . ')')
-    if @used && $primary ne 'JAVA' && $primary ne 'PYTHON';
+    if @used && $primary ne 'JAVA' && $primary ne 'PYTHON'
+       && $primary ne 'GUILE';
 
   # Make the result unique.  This lets the user use conditionals in
   # a natural way, but still lets us program lazily -- we don't have
@@ -8260,6 +8287,7 @@ sub generate_makefile ($$)
   handle_texinfo;
   handle_emacs_lisp;
   handle_python;
+  handle_guile;
   handle_java;
   handle_man_pages;
   handle_data;
diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am
index a255f70..ad08582 100644
--- a/lib/am/Makefile.am
+++ b/lib/am/Makefile.am
@@ -3,7 +3,7 @@
 ## Makefile for Automake lib/am.
 
 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2008,
-# 2009  Free Software Foundation, Inc.
+# 2009, 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@ depend.am \
 depend2.am \
 distdir.am \
 footer.am \
+guile.am \
 header-vars.am \
 header.am \
 install.am \
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 059ae97..f0cf036 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -16,7 +16,7 @@
 @SET_MAKE@
 
 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2008,
-# 2009  Free Software Foundation, Inc.
+# 2009, 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -204,6 +204,7 @@ depend.am \
 depend2.am \
 distdir.am \
 footer.am \
+guile.am \
 header-vars.am \
 header.am \
 install.am \
diff --git a/lib/am/guile.am b/lib/am/guile.am
new file mode 100644
index 0000000..26d92d2
--- /dev/null
+++ b/lib/am/guile.am
@@ -0,0 +1,35 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright (C) 2011 Free Software Foundation, Inc.
+
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if %?INSTALL%
+include inst-vars.am
+endif %?INSTALL%
+
+
+## Exactly the same as data.am.
+include data.am
+
+## ---------- ##
+## Cleaning.  ##
+## ---------- ##
+
+## -------------- ##
+## Distributing.  ##
+## -------------- ##
+
+if %?DIST%
+DIST_COMMON += %DISTVAR%
+endif %?DIST%
-- 
1.7.4.1.48.g5673d