Subject: [PATCH 1/4] Documentation for Guile support.

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

* doc/automake.texi (Guile): New chapter.
(Top, Other GNU Tools): Update menus.
* NEWS: Update.
Initial suggestion and lots of ideas and from Andy Wingo and
Ludovic Courtè.
---
 ChangeLog         |    9 +++
 NEWS              |    5 ++
 doc/automake.texi |  154 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 167 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 12b8e9f..c338e8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-20  Ralf Wildenhues  <[email-masked]>
+
+	Documentation for Guile support.
+	* doc/automake.texi (Guile): New chapter.
+	(Top, Other GNU Tools): Update menus.
+	* NEWS: Update.
+	Initial suggestion and lots of ideas and from Andy Wingo and
+	Ludovic Courtès.
+
 2011-02-16  Stefano Lattarini  <[email-masked]>
 	    Ralf Wildenhues  <[email-masked]>
 
diff --git a/NEWS b/NEWS
index a5dc93f..401d69b 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,11 @@ New in 1.11a:
 
   - New `cscope' target to build a cscope database for the source tree.
 
+* Languages changes:
+
+  - Support for compilation and installation of Guile source code and compiled
+    Guile source code via the new `GUILE' primary.
+
 * Miscellaneous changes:
 
   - The `dist' and `dist-all' targets now can run compressors in parallel.
diff --git a/doc/automake.texi b/doc/automake.texi
index 474f5a1..078dfbb 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -291,6 +291,7 @@ Top
 * Libtool::                     Libtool
 * Java::                        Java
 * Python::                      Python
+* Guile::                       Guile
 
 Building documentation
 
@@ -2073,7 +2074,7 @@ Uniform
 objects are not installed either.
 
 The current primary names are @samp{PROGRAMS}, @samp{LIBRARIES},
-@samp{LTLIBRARIES}, @samp{LISP}, @samp{PYTHON}, @samp{JAVA},
+@samp{LTLIBRARIES}, @samp{LISP}, @samp{PYTHON}, @samp{GUILE}, @samp{JAVA},
 @samp{SCRIPTS}, @samp{DATA}, @samp{HEADERS}, @samp{MANS}, and
 @samp{TEXINFOS}.
 @vindex PROGRAMS
@@ -2081,6 +2082,7 @@ Uniform
 @vindex LTLIBRARIES
 @vindex LISP
 @vindex PYTHON
+@vindex GUILE
 @vindex JAVA
 @vindex SCRIPTS
 @vindex DATA
@@ -7446,6 +7448,7 @@ Other GNU Tools
 * Libtool::                     Libtool
 * Java::                        Java
 * Python::                      Python
+* Guile::                       Guile
 @end menu

@@ -7736,6 +7739,155 @@ Python
 Install Paths}.

+@node Guile
+@section Guile
+
+@cindex @code{_GUILE} primary, defined
+@cindex @code{GUILE} primary, defined
+@cindex Primary variable, @code{GUILE}
+@vindex _GUILE
+
+Automake provides support for compiled Guile source files with the
+@code{GUILE} primary as well as for installation of extensions modules
+for Guile in a compiled language such as C.  A typical setup is to call
+@code{AM_PATH_GUILE} in @file{configure.ac} and use a line like the
+following in @file{Makefile.am}:
+
+@example
+guile_GUILE = foo.scm bar.sls baz.sps zork.ss
+@end example
+
+Here's a longer example with different types of file handling:
+
+@example
+guile_GUILE = compiled-and-installed.scm
+nodist_guile_GUILE = not-distributed.scm
+guile_DATA = not-compiled.scm
+noinst_GUILE = compiled-but-not-installed.scm
+dist_noinst_DATA = just-distributed-blob.scm
+
+# object files will be installed in respective subdir of guileexecdir.
+nobase_guile_GUILE = installed-in-subdir/foo.scm
+
+pkgguile_GUILE = installed-in-package-dir.scm
+@end example
+
+Here's an example of a typical extension module written in C:
+
+@example
+guileext_LTLIBRARIES = foo.la
+foo_la_SOURCES = foo.c
+foo_la_LDFLAGS = -module -avoid-version
+foo_la_LIBADD = $(GUILELIBS)
+AM_CFLAGS = $(GUILECFLAGS)
+AM_CPPFLAGS = $(GUILECPPFLAGS)
+@end example
+
+When @samp{AM_PATH_GUILE} is used, the suffixes @file{.scm}, @file{.sls},
+@file{.sps}, and @file{.ss} are assumed to be Guile sources, and
+compiled files will carry the @file{.go} extension.
+
+Any files listed in a @code{_GUILE} variable will be byte-compiled
+with @command{guile-tools compile} if that is available and new enough
+to compile Guile sources.
+
+Automake ships with an Autoconf macro called @code{AM_PATH_GUILE}
+that will determine some Guile-related directory variables (see
+below).  If you have called @code{AM_PATH_GUILE} from
+@file{configure.ac}, then you may use the variables
+@code{guile_GUILE} or @code{pkgguile_GUILE} to list Guile source
+files in your @file{Makefile.am}, depending on where you want your files
+installed (see the definitions of @code{guiledir} and
+@code{pkgguiledir} below).
+
+@defmac AM_PATH_GUILE (@ovar{version}, @ovar{action-if-found}, @
+  @ovar{action-if-not-found})
+
+Search for a Guile compiler @samp{guile-tools compile} on the system.
+This macro takes three optional arguments.  The first argument, if
+present, is the minimum version of Guile required for this package:
+@code{AM_PATH_GUILE} will skip any Guile interpreter that is older than
+@var{version}.  If an interpreter is found and satisfies @var{version},
+then @var{action-if-found} is run.  Otherwise, @var{action-if-not-found}
+is run.  Without a @var{version} argument, a minimum version of 1.8 is
+checked against.
+
+If @var{action-if-not-found} is not specified, as in the following
+example, the default is to abort @command{configure}.
+
+@example
+AM_PATH_GUILE([2.0])
+@end example
+
+@noindent
+This is fine when Guile is an absolute requirement for the package.
+If Guile >= 2.0 was only @emph{optional} to the package,
+@code{AM_PATH_GUILE} could be called as follows.
+
+@example
+AM_PATH_GUILE([2.0],, [:])
+@end example
+
+@code{AM_PATH_GUILE} creates the following output variables based on
+the Guile installation found during configuration.
+@end defmac
+
+@vtable @code
+@item GUILE_TOOLS
+The name of the @command{guile-tools} executable, or @samp{:} if no
+suitable compiler could be found.
+
+Assuming @var{action-if-not-found} is used (otherwise @file{./configure}
+will abort if Guile is absent), the value of @code{GUILE} can be used
+to setup a conditional in order to disable the relevant part of a build
+as follows.
+
+@example
+AM_PATH_GUILE(,, [:])
+AM_CONDITIONAL([HAVE_GUILE], [test "$GUILE_TOOLS" != :])
+@end example
+
+@item GUILE_VERSION
+The Guile version number, in the form @var{major}.@var{minor}
+(e.g., @samp{1.8}).
+
+@item guiledir
+The directory name for the installation of user Guile source code.
+By default, that is @samp{$(datarootdir)/guile/site/@var{x.y}} for
+Guile versions @var{x.y} greater than 1.8, and
+@samp{$(datarootdir)/guile/site} for version 1.8.
+
+@item pkgguiledir
+This is the directory under @code{guiledir} that is named after the
+package.  That is, it is @samp{$(guiledir)/$(PACKAGE)}.  It is provided
+as a convenience.
+
+@item guileexecdir
+This is the directory where compiled Guile source code will be installed.
+The default is @samp{$(libdir)/guile/@var{x.y}/ccache} if a Guile Scheme
+compiler is available, and @samp{$(libdir)} otherwise.
+
+@item guileextdir
+This is the directory where Guile C extensions will be installed.
+The default is @samp{$(libdir)/guile/@var{x.y}/extensions} for versions
+@var{x.y} greater than 1.8, and @samp{$(libdir)} otherwise.
+
+@c @example
+@c XXX
+@c @end example
+@end vtable
+
+All these directory variables have values that start with either
+@samp{$@{prefix@}} or @samp{$@{exec_prefix@}} unexpanded.  This works
+fine in @file{Makefiles}, but it makes these variables hard to use in
+@file{configure}.  This is mandated by the GNU coding standards, so
+that the user can run @samp{make prefix=/foo install}.  The Autoconf
+manual has a section with more details on this topic
+(@pxref{Installation Directory Variables, , Installation Directory
+Variables, autoconf, The Autoconf Manual}).  See also @ref{Hard-Coded
+Install Paths}.
+
+
 @node Documentation
 @chapter Building documentation
 
-- 
1.7.4.1.48.g5673d