bug#7995: Guile support in Automake

2011-02-19 Thread Ralf Wildenhues
[ http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7995 aka
  http://thread.gmane.org/gmane.comp.sysutils.automake.bugs/5303 ]

* Ralf Wildenhues wrote on Sun, Feb 06, 2011 at 11:22:57PM CET:
 Automake should support Guile.

 I actually have patches for some tests, documentation and half an
 implementation from last year;

Here we go.  For now I've done little with the patches except rebase
and squash the intermediate stages, update copyright years, remove
notes from git, and ensure there are no syntax errors.

That means however, that nothing really works yet.  It's still a total
mess.  So what I would like to ask from readers at this point is:
please go through the doc changes and let's discuss them first.
Also, it is important to not step on guile/meta/guile.m4 toes (or vice
versa), so some checking for that is prodent.  When we know what is
desired, the tests should be amended/fixed to cover that, and then we
can fix the implementation to follow.

If you prefer, I can also put them in a temporary branch (which for the
moment I would expect to be rewound at some point later).

Here's a preliminary list of issues that I see:

- Why guile_GUILE and not guile_LISP?  What's the rationale for naming
  it differently, and what's the rationale for actually treating it
  differently?  This question has two parts: LISP is treated by emacs
  not guile-tools, and IIUC then the idea was that GUILE is compiled
  already at 'make all' time and not just at 'make install' time, right?
  Is the latter part just nice to have or an important feature?

- The current tests assume _GUILE sources are distributed by default;
  OTOH, _LISP are not.  Rationale for this semantic difference?

- Please fix errors you can find in the tests; esp. the extension module
  in guile3.test doesn't seem to do the right thing yet (with my
  unfinished implementation).

- I renamed guileextensiondir from earlier suggestions to guileextdir,
  both for brevity, and to avoid the question of whether there is a
  trailing 's' in the name.  OK?

- The Guile manual documents Autoconf macros distributed in
  $datarootdir/aclocal/guile.m4.  The names in there are a bit
  unfortunate in that the macros more or less use the same GUILE_*
  namespace that we would like to use for some variables (which means
  you cannot easily turn on checking for unexpanded macro names through
  something like
m4_pattern_forbid([^GUILE_])dnl

  and there is even overlap in the semantics and shell variable names.
  We need to address that; esp. since the macros shipped with Guile have
  been out there for long, we cannot just expect them to disappear
  instantly.  There should be a clear, backward-compatible upgrade path,
  and a clear intent on how usage should be in the future, for Guile
  users both with and without Automake.

- The handling of compile and link flags is still quite suboptimal.
  I still need to think about that a bit more.

- I haven't yet considered the handling of flags to uninstalled module
  stuff.  This is just TODO.

- My current plan is to either not provide something like
foo_scm_GUILEFLAGS = override for $(AM_GUILEFLAGS)

  or to not let it cause renamed .go files.  Do you think users will
  need per-target guile-tools compile flags?  Because if they do, then
  we need to document this stuff, and that it's not in line with how
  Automake operates elsewhere, etc.

- The register_language bits in the last patch are totally unused yet,
  as the machinery isn't yet able to handle languages that either don't
  use a linker in the end, or don't rename objects with per-target flags
  which is probably desirable for Guile (similar to how Python support
  works).

I should apologize for taking totally random and unorganized notes
below.  They are basically just a jot-down from last year of what Andy
and Ludo said.

Thanks,
Ralf


Notes about Guile support:

# set from guile-config
# or from pkg-config if guile major version known

.go: compiled guile files
 sys-dep not executable byte-code
.scm: source guile files (can have other extensions)
.sls .sps .ss

One problem will be: when we add Go support, .go has conflicting
semantics.


cat  Makefile.am \END
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

# without guile compiler, just install sources
# but also install objects whenever possible

GUILE_TOOLS = guile-tools
GUILE_TOOLS_COMPILE = $(GUILE_TOOLS) compile
GUILE_COMPILE = $(GUILE_TOOLS_COMPILE) $(AM_GUILEFLAGS) $(GUILEFLAGS)

$(GUILE_TOOLS_COMPILE) $(AM_GUILEFLAGS) $(GUILEFLAGS) -o $@ $
# no ordering req
# no renaming

foo_scm_GUILEFLAGS should not cause the output to be renamed.


AM_PATH_GUILE([minimum-version], 

bug#7995: [PATCH 1/4] Documentation for Guile support.

2011-02-19 Thread Ralf Wildenhues
* 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  ralf.wildenh...@gmx.de
+
+   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  stefano.lattar...@gmail.com
Ralf Wildenhues  ralf.wildenh...@gmx.de
 
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

bug#7995: [PATCH 2/4] Testsuite coverage for Guile support.

2011-02-19 Thread Ralf Wildenhues
* tests/guile1.test, tests/guile2.test, tests/guile3.test,
tests/guile4.test: New tests.
* tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
---
 ChangeLog |5 ++
 tests/Makefile.am |8 +++
 tests/Makefile.in |7 ++-
 tests/guile1.test |   54 ++
 tests/guile2.test |  132 +
 tests/guile3.test |   91 
 tests/guile4.test |   48 +++
 7 files changed, 344 insertions(+), 1 deletions(-)
 create mode 100755 tests/guile1.test
 create mode 100755 tests/guile2.test
 create mode 100755 tests/guile3.test
 create mode 100755 tests/guile4.test

diff --git a/ChangeLog b/ChangeLog
index c338e8a..5483ce4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-02-20  Ralf Wildenhues  ralf.wildenh...@gmx.de
 
+   Testsuite coverage for Guile support.
+   * tests/guile1.test, tests/guile2.test, tests/guile3.test,
+   tests/guile4.test: New tests.
+   * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
Documentation for Guile support.
* doc/automake.texi (Guile): New chapter.
(Top, Other GNU Tools): Update menus.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e3eb9e9..b993678 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,6 +24,10 @@ all.test \
 auxdir2.test \
 cond17.test \
 gcj6.test \
+guile1.test \
+guile2.test \
+guile3.test \
+guile4.test \
 override-conditional-2.test \
 txinfo5.test
 
@@ -460,6 +464,10 @@ gnuwarn2.test \
 gnits.test \
 gnits2.test \
 gnits3.test \
+guile1.test \
+guile2.test \
+guile3.test \
+guile4.test \
 header.test \
 help.test \
 help2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 1f367cd..e449137 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -284,7 +284,8 @@ top_srcdir = @top_srcdir@
 MAINTAINERCLEANFILES = $(parallel_tests) $(instspc_tests)
 EXTRA_DIST = ChangeLog-old gen-parallel-tests instspc-tests.sh \
$(TESTS)
-XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
+XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test guile1.test \
+   guile2.test guile3.test guile4.test \
override-conditional-2.test txinfo5.test \
$(instspc_xfail_tests)
 parallel_tests = backcompat5-p.test check-exported-srcdir-p.test \
@@ -722,6 +723,10 @@ gnuwarn2.test \
 gnits.test \
 gnits2.test \
 gnits3.test \
+guile1.test \
+guile2.test \
+guile3.test \
+guile4.test \
 header.test \
 help.test \
 help2.test \
diff --git a/tests/guile1.test b/tests/guile1.test
new file mode 100755
index 000..94efa82
--- /dev/null
+++ b/tests/guile1.test
@@ -0,0 +1,54 @@
+#! /bin/sh
+# 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/.
+
+# Basic Guile support: guile_GUILE.
+
+. ./defs || Exit 1
+
+set -e
+
+cat configure.in \END
+AM_PATH_GUILE
+AC_OUTPUT
+END
+
+cat  Makefile.am \END
+guile_GUILE = foo.scm bar.scm baz.scm
+END
+
+: foo.scm
+: bar.scm
+: baz.scm
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+grep '^GUILECOMPILE' Makefile.in
+grep '^GUILEFLAGS' Makefile.in
+
+inst=`pwd`/inst
+./configure --prefix=$inst
+
+env GUILE_TOOLS=false $MAKE -e  Exit 1
+env AM_GUILEFLAGS=--nosuchflag $MAKE -e  Exit 1
+env GUILEFLAGS=--nosuchflag $MAKE -e  Exit 1
+
+$MAKE
+$MAKE install
+$MAKE distcheck
+
+:
diff --git a/tests/guile2.test b/tests/guile2.test
new file mode 100755
index 000..d355518
--- /dev/null
+++ b/tests/guile2.test
@@ -0,0 +1,132 @@
+#! /bin/sh
+# 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/.
+
+# Ensure that we compile and install Guile sources properly.
+
+required='guile-tools'
+. ./defs || Exit 1
+
+set -e
+
+cat configure.in \END
+AM_PATH_GUILE([1.8],,
+  [AC_MSG_ERROR([Guile installation 

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

2011-02-19 Thread Ralf Wildenhues
* 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  ralf.wildenh...@gmx.de
 
+   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 

bug#7995: [PATCH 3/4] Guile macro AM_PATH_GUILE.

2011-02-19 Thread Ralf Wildenhues
* m4/guile.m4 (AM_PATH_GUILE): New file, new macro.
* m4/Makefile.am (dist_m4data_DATA): Add guile.m4.
---
 ChangeLog  |4 +++
 m4/Makefile.am |3 +-
 m4/Makefile.in |3 +-
 m4/guile.m4|   63 
 4 files changed, 71 insertions(+), 2 deletions(-)
 create mode 100644 m4/guile.m4

diff --git a/ChangeLog b/ChangeLog
index 5483ce4..bd27a05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-02-20  Ralf Wildenhues  ralf.wildenh...@gmx.de
 
+   Guile macro AM_PATH_GUILE.
+   * m4/guile.m4 (AM_PATH_GUILE): New file, new macro.
+   * m4/Makefile.am (dist_m4data_DATA): Add guile.m4.
+
Testsuite coverage for Guile support.
* tests/guile1.test, tests/guile2.test, tests/guile3.test,
tests/guile4.test: New tests.
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 0cf074b..fe7a8d6 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -3,7 +3,7 @@
 ## Makefile for Automake m4.
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 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
@@ -31,6 +31,7 @@ depend.m4 \
 depout.m4 \
 dmalloc.m4 \
 gcj.m4 \
+guile.m4 \
 header.m4 \
 init.m4 \
 install-sh.m4 \
diff --git a/m4/Makefile.in b/m4/Makefile.in
index e508848..49f46a7 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -16,7 +16,7 @@
 @SET_MAKE@
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 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
@@ -201,6 +201,7 @@ depend.m4 \
 depout.m4 \
 dmalloc.m4 \
 gcj.m4 \
+guile.m4 \
 header.m4 \
 init.m4 \
 install-sh.m4 \
diff --git a/m4/guile.m4 b/m4/guile.m4
new file mode 100644
index 000..d16da79
--- /dev/null
+++ b/m4/guile.m4
@@ -0,0 +1,63 @@
+# Guile file handling  -*- Autoconf -*-
+
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PATH_GUILE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# --
+# Adds support for distributing Guile source files and compiled sources.
+# To install files, copy them to $(guiledir), using the guile_GUILE
+# automake variable.  To install a package with the same name as the
+# automake package, install to $(pkgguiledir), or use the
+# pkgguile_GUILE automake variable.
+#
+# The variables $(guileexecdir) and $(guileextensiondir) are provided as
+# locations to install Guile extension modules (shared libraries).
+# The XXX macro is required to find the appropriate flags to compile
+# extension modules.
+#
+# If the MINIMUM-VERSION argument is passed, AM_PATH_GUILE will
+# cause an error if the version of python installed on the system
+# doesn't meet the requirement.  MINIMUM-VERSION should consist of
+# numbers and dots only.
+AC_DEFUN([AM_PATH_GUILE],
+[AC_PATH_PROG([GUILE_TOOLS], [guile-tools], [:])
+am__guile_apiversion=1.6
+if test $GUILE_TOOLS != :; then
+  GUILE_VERSION=`$GUILE_TOOLS --version | sed '[s/.*\([1-9][0-9.]*\).*/\1/]'`
+  AS_VERSION_COMPARE([$GUILE_VERSION], [1.8],
+[am__guile_apiversion=1.6],
+[am__guile_apiversion=1.8],
+[am__guile_apiversion=2.0])
+fi
+AC_SUBST([GUILE_VERSION])
+case $am__guile_apiversion in #(
+1.6) ;; #(
+1.8)
+  guiledir='${datarootdir}'/guile/site/$GUILE_VERSION
+  guileexecdir='${libdir}'/guile/$GUILE_VERSION/ccache
+  guileextdir='${libdir}'/guile/$GUILE_VERSION/extensions
+  ;; #(
+*)
+  guiledir='${datarootdir}'/guile/site/$GUILE_VERSION
+  guileexecdir='${libdir}'
+  guileextdir='${libdir}'
+  ;;
+esac
+case $am__guile_apiversion in #(
+1.6)
+  m4_default([$3], [AC_MSG_ERROR([no working Guile installation found])])
+  ;; #(
+*)
+  $2
+  ;;
+esac
+AC_SUBST([guiledir])dnl
+AC_SUBST([pkgguiledir], ['${guiledir}'/$PACKAGE])dnl
+AC_SUBST([guileexecdir])dnl
+AC_SUBST([guileextdir])dnl
+AC_ARG_VAR([GUILEFLAGS], [Flags for compilation of Guile source files])dnl
+])
-- 
1.7.4.1.48.g5673d






Re: [PATCH] {maint} tests: tempdirs with restrictive permissions are cleaned correctly

2011-02-19 Thread Ralf Wildenhues
Hi Stefano,

sorry for the silence, I've been traveling.  My plan is to do slowly but
steady catchup over the next week(end)s ...

* Stefano Lattarini wrote on Wed, Feb 16, 2011 at 09:26:17PM CET:
 * tests/defs: Ensure that all the subdirectories of a temporary
 test directory have the 'read', 'write' and 'execute' bits set,
 before trying to remove it with `rm -rf'.
 * tests/Makefile.am (clean-local-check): Likewise.

OK, but ...

 --- a/tests/Makefile.am
 +++ b/tests/Makefile.am
 @@ -839,6 +839,6 @@ clean-local-check:
if test $$#,$$1 = 1,*.dir; then \
  : there is no test directory to clean; \
else \
 -find $$@ -type d '!' -perm -200 -exec chmod u+w {} ';'; \
 +find $$@ -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
  rm -rf $$@; \
fi;

please don't remove the quoting from the ! here.  It exists to
facilitate copy and pasting commands from make output to the command
line, so even if it's not needed inside scripts, it is good defensive
coding to have it there too.

Also, it would seem that this issue is present in lib/am/distdir.am
as well.  Care to address that (in another patch, if you like)?

Thanks,
Ralf



Re: debbugs, and a FAQ, for Autotools

2011-02-19 Thread Ralf Wildenhues
Hello everyone,

* Ralf Wildenhues wrote on Sun, Feb 13, 2011 at 07:12:02PM CET:
 2) Autotools should have a FAQ document.

I've done a brain dump now, here's a rough initial version:
http://www.gnu.org/software/automake/faq/autotools-faq.html and
http://www.gnu.org/software/automake/faq/autotools-faq.texi
(the former is generated from the latter via the Makefile).
It is all incomplete, buggy, partly ugly, probably missing
gnulib and gettext references in places, and everything, but
I would like something to point users to now.  Should all be
reformulated nicely eventually ...

I'd be happy about feedback, help, anything.  For now there
are several more questions than answers, and there are
certainly many more questions that you can think of, so
please write them.

I don't actually care about the license, as long as we can
move text between FAQ and manuals without too much hassle.

Thanks,
Ralf



Re: debbugs, and a FAQ, for Autotools

2011-02-19 Thread Ralf Wildenhues
Hi Russell,

* Russell Shaw wrote on Mon, Feb 14, 2011 at 12:00:14AM CET:
 I'd ask more about how the internals of ./configure and autoconf works.

Can you formulate more specific questions?

 And questions on how to make bison get handled without being forced to
 mimic standard yacc.

I've added that question there now (without answer so far).

Thanks,
Ralf



Re: debbugs, and a FAQ, for Autotools

2011-02-19 Thread Russell Shaw

On 20/02/11 06:10, Ralf Wildenhues wrote:

Hi Russell,

* Russell Shaw wrote on Mon, Feb 14, 2011 at 12:00:14AM CET:

I'd ask more about how the internals of ./configure and autoconf works.


Can you formulate more specific questions?


And questions on how to make bison get handled without being forced to
mimic standard yacc.


I've added that question there now (without answer so far).

Thanks,
Ralf



Hi,
I'm not in autoconf debugging mode atm, so i'll have to ask more detailed
things some other time.

Looking through a ./configure script, i see lots of things being done
with file descriptors 5 and 6. What is going on here? eg:


##  ##
## Autoconf initialization. ##
##  ##

# ac_fn_c_try_compile LINENO
# --
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_compile ()
{
  as_lineno=${as_lineno-$1} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  rm -f conftest.$ac_objext
  if { { ac_try=$ac_compile
case (($ac_try in
  *\* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo=\\$as_me:${as_lineno-$LINENO}: $ac_try_echo\
$as_echo $ac_try_echo; } 5
  (eval $ac_compile) 2conftest.err
  ac_status=$?
  if test -s conftest.err; then
grep -v '^ *+' conftest.err conftest.er1
cat conftest.er1 5
mv -f conftest.er1 conftest.err
  fi
  $as_echo $as_me:${as_lineno-$LINENO}: \$? = $ac_status 5
  test $ac_status = 0; }  {
 test -z $ac_c_werror_flag ||
 test ! -s conftest.err
   }  test -s conftest.$ac_objext; then :
  ac_retval=0
else
  $as_echo $as_me: failed program was: 5
sed 's/^/| /' conftest.$ac_ext 5

ac_retval=1
fi
  eval $as_lineno_stack; test x$as_lineno_stack = x  { as_lineno=; unset 
as_lineno;}

  as_fn_set_status $ac_retval

} # ac_fn_c_try_compile




Re: about what goes into a distribution file

2011-02-19 Thread Ralf Wildenhues
Hi Vincent,

* Vincent Torri wrote on Fri, Feb 18, 2011 at 08:33:01AM CET:
 from the automake documentation, all the files read by AC_CONFIG_FILES are
 added in the distribution. But why aren't the generated files not in the
 tarball (the .pc.in are in but not the .pc for example) ?

Just to answer the question for whoever else stumbles over this:
because the point of generating them is that they may look differently
on different systems.  Thus it makes no sense to distribute them.

And actually, the rules are a bit more complicated: the .in files are
distributed only if they are mentioned literally in configure.ac (i.e.,
not as shell variable), and when they are not the output file of another
AC_CONFIG_FILES command (e.g., foo.in.in - foo.in - foo).  The gory
details are documented here:
http://www.gnu.org/software/automake/manual/html_node/Requirements.html

Cheers,
Ralf



Re: dynamic executables for check_PROGRAMS?

2011-02-19 Thread Ralf Wildenhues
Hello Jeff,

* Daily, Jeff A wrote on Fri, Feb 18, 2011 at 12:06:13AM CET:
 I wrote a profiling layer for my library utilizing weak symbols.  I
 thought for starters it would be nice to profile some of my test
 programs, to make sure things are working okay.  I'm using autoconf,
 automake, and libtool, so I configured using --enable-shared
 --disable-static, however, my test programs are not created as dynamic
 executables.

I'm not sure I understand this.  Programs are typically not created
differently based on whether they are check_PROGRAMS or bin_PROGRAMS.
Maybe you are thinking of uninstalled libraries which those programs
depend on and which are noinst_LTLIBRARIES thus only generated as
convenience archives?  Here's how you can let them be shared libraries:

noinst_LTLIBRARIES = libtesthelper.la
libtesthelper_la_LDFLAGS = -rpath /nowhere

The actual path you specify is not important, except that it should not
be world-accessible because the system might try to find files there.

If I have misunderstood your question, the maybe it helps to show a
small example?

Thanks,
Ralf