unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#10488: guile-config deprecation?
@ 2012-01-12 18:42 Mike Gran
  2012-02-02 13:41 ` Andy Wingo
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Gran @ 2012-01-12 18:42 UTC (permalink / raw)
  To: 10488

Hi-

There's a bit of confusion on the guile-config deprecation.

NEWS says that guile-config "will be deprecated"

meta/guile-config.in says it "has been deprecated"

meta/guile.m4's GUILE_PROGS rule will error "guile-config required
but not found"

likewise those rules that depend on GUILE_PROGS, such as GUILE_FLAGS
and GUILE_SITE_DIR


In the manual, in the "parallel installations" section, it implies
that GUILE_SITE_DIR is the way to get the sitedir from pkg-config,
but with guile.m4, it is getting that information via guile-config,
which itself gets it from pkg-config.


In the README, it suggests "guile-config" is the way to get the
sitedir for the installation of slib.

The man page for pkg-config describes the PKG_CHECK_MODULES macro,
but doesn't give any indication of how to set up any autoconf
flags beyond _CFLAGS and _LIBS.  So it isn't clear that PKG_CHECK_MODULES
could be used as a replacement for GUILE_SITE_DIR.


It seems to me, that there is some inconsistency here.  I'm worried
that guile-config will just disappear with no equally powerful,
documented replacement in place.


The quickest fix would be to not deprecated it, while
maybe creating and documenting a parallel set of pkg-config based

macros in guile.m4 for extracting things like sitedir.


Thanks,

Mike






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
  2012-01-12 18:42 bug#10488: guile-config deprecation? Mike Gran
@ 2012-02-02 13:41 ` Andy Wingo
  2012-02-02 18:49   ` dsmich
  2012-03-30 18:05   ` Andy Wingo
  0 siblings, 2 replies; 10+ messages in thread
From: Andy Wingo @ 2012-02-02 13:41 UTC (permalink / raw)
  To: Mike Gran; +Cc: 10488

On Thu 12 Jan 2012 19:42, Mike Gran <spk121@yahoo.com> writes:

> There's a bit of confusion on the guile-config deprecation.

Indeed.

> NEWS says that guile-config "will be deprecated"

This reflects what I would like to happen, but I share your concern that
we not create a situation in which "guile-config will just disappear
with no equally powerful, documented replacement in place".  Hence the
slowness of this transition.  Thanks for bringing it up.

> meta/guile-config.in says it "has been deprecated"

I changed the text to "will be deprecated".  It's somewhat
weasel-worded, I guess.

> meta/guile.m4's GUILE_PROGS rule will error "guile-config required
> but not found"

Uf, this is a can of worms.  I hacked on this a bit this morning, and
came up with the following.  What do you think?

# GUILE_PKG -- find Guile development files
#
# Usage: GUILE_PKG([VERSIONS])
#
# This macro runs the @code{pkg-config} tool to find development files
# for an available version of Guile.
#
# By default, this macro will search for the latest stable version of
# Guile (e.g. 2.0), falling back to the previous stable version
# (e.g. 1.8) if it is available.  If no guile-@var{VERSION}.pc file is
# found, an error is signalled.  The found version is stored in
# @var{GUILE_EFFECTIVE_VERSION}.
#
# If @code{GUILE_PROGS} was already invoked, this macro ensures that the
# development files have the same effective version as the Guile
# program.
#
# @var{GUILE_EFFECTIVE_VERSION} is marked for substitution, as by
# @code{AC_SUBST}.
#
AC_DEFUN([GUILE_PKG],
 [PKG_PROG_PKG_CONFIG
  _guile_versions_to_search=m4_default([$1], [2.0 1.8])
  if test -z "$GUILE_EFFECTIVE_VERSION"; then
    _guile_tmp=""
    for v in $_guile_versions_to_search; do
      if test "$v" = "$GUILE_EFFECTIVE_VERSION"
        _guile_tmp=$v
      fi
    done
    if test -z "$_guile_tmp"; then
      AC_MSG_FAILURE([searching for guile development files for versions $_guile_versions_to_search, but previously found $GUILE version $GUILE_EFFECTIVE_VERSION])
    fi
    _guile_versions_to_search=$GUILE_EFFECTIVE_VERSION
  fi
  GUILE_EFFECTIVE_VERSION=""
  _guile_errors=""
  for v in $_guile_versions_to_search; do
    AC_MSG_NOTICE([checking for guile $v])
    if test -z "$GUILE_EFFECTIVE_VERSION"; then
      PKG_CHECK_EXISTS([guile-$v], [GUILE_EFFECTIVE_VERSION=$v], [])
    fi
  done

  if test -z "$GUILE_EFFECTIVE_VERSION"; then
    AC_MSG_ERROR([
No Guile development packages were found.

Please verify that you have Guile installed.  If you installed Guile
from a binary distribution, please verify that you have also installed
the development packages.  If you installed it yourself, you might need
to adjust your PKG_CONFIG_PATH; see the pkg-config man page for more.
])
  fi
  AC_MSG_NOTICE([found guile $v])
  AC_SUBST([GUILE_EFFECTIVE_VERSION])
 ])

# GUILE_FLAGS -- set flags for compiling and linking with Guile
#
# Usage: GUILE_FLAGS
#
# This macro runs the @code{pkg-config} tool to find out how to compile
# and link programs against Guile.  It sets four variables:
# @var{GUILE_CFLAGS}, @var{GUILE_LDFLAGS}, @var{GUILE_LIBS}, and
# @var{GUILE_LTLIBS}.
#
# @var{GUILE_CFLAGS}: flags to pass to a C or C++ compiler to build code that
# uses Guile header files.  This is almost always just one or more @code{-I}
# flags.
#
# @var{GUILE_LDFLAGS}: flags to pass to the compiler to link a program
# against Guile.  This includes @code{-lguile-@var{VERSION}} for the
# Guile library itself, and may also include one or more @code{-L} flag
# to tell the compiler where to find the libraries.  But it does not
# include flags that influence the program's runtime search path for
# libraries, and will therefore lead to a program that fails to start,
# unless all necessary libraries are installed in a standard location
# such as @file{/usr/lib}.
#
# @var{GUILE_LIBS} and @var{GUILE_LTLIBS}: flags to pass to the compiler or to
# libtool, respectively, to link a program against Guile.  It includes flags
# that augment the program's runtime search path for libraries, so that shared
# libraries will be found at the location where they were during linking, even
# in non-standard locations.  @var{GUILE_LIBS} is to be used when linking the
# program directly with the compiler, whereas @var{GUILE_LTLIBS} is to be used
# when linking the program is done through libtool.
#
# The variables are marked for substitution, as by @code{AC_SUBST}.
#
AC_DEFUN([GUILE_FLAGS],
 [AC_REQUIRE([GUILE_PKG])
  PKG_CHECK_MODULES(GUILE, [guile-$GUILE_EFFECTIVE_VERSION])

  dnl GUILE_CFLAGS and GUILE_LIBS are already defined and AC_SUBST'd by
  dnl PKG_CHECK_MODULES.  But GUILE_LIBS to pkg-config is GUILE_LDFLAGS
  dnl to us.

  GUILE_LDFLAGS=$GUILE_LIBS

  dnl Determine the platform dependent parameters needed to use rpath.
  dnl AC_LIB_LINKFLAGS_FROM_LIBS is defined in gnulib/m4/lib-link.m4 and needs
  dnl the file gnulib/build-aux/config.rpath.
  AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LIBS], [$GUILE_LDFLAGS], [])
  GUILE_LIBS="$GUILE_LDFLAGS $GUILE_LIBS"
  AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LTLIBS], [$GUILE_LDFLAGS], [yes])
  GUILE_LTLIBS="$GUILE_LDFLAGS $GUILE_LTLIBS"

  AC_SUBST([GUILE_EFFECTIVE_VERSION])
  AC_SUBST([GUILE_CFLAGS])
  AC_SUBST([GUILE_LDFLAGS])
  AC_SUBST([GUILE_LIBS])
  AC_SUBST([GUILE_LTLIBS])
 ])

# GUILE_SITE_DIR -- find path to Guile "site" directory
#
# Usage: GUILE_SITE_DIR
#
# This looks for Guile's "site" directory, usually something like
# PREFIX/share/guile/site, and sets var @var{GUILE_SITE} to the path.
# Note that the var name is different from the macro name.
#
# The variable is marked for substitution, as by @code{AC_SUBST}.
#
AC_DEFUN([GUILE_SITE_DIR],
 [AC_REQUIRE([GUILE_PKG])
  AC_MSG_CHECKING(for Guile site directory)
  GUILE_SITE=`$PKG_CONFIG --print-errors --variable=sitedir guile-$GUILE_EFFECTIVE_VERSION`
  AC_MSG_RESULT($GUILE_SITE)
  if test "$GUILE_SITE" = ""; then
     AC_MSG_FAILURE(sitedir not found)
  fi
  AC_SUBST(GUILE_SITE)
 ])

# GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
#
# Usage: GUILE_PROGS
#
# This macro looks for programs @code{guile} and @code{guild}, setting
# variables @var{GUILE} and @var{GUILD} to their paths, respectively.
# If @code{guile} is not found, signal an error.
#
# The effective version of the found @code{guile} is set to
# @var{GUILE_EFFECTIVE_VERSION}.  This macro ensures that the effective
# version is compatible with the result of a previous invocation of
# @code{GUILE_FLAGS}, if any.
#
# As a legacy interface, it also looks for @code{guile-config} and
# @code{guile-tools}, setting @var{GUILE_CONFIG} and @var{GUILE_TOOLS}.
#
# The variables are marked for substitution, as by @code{AC_SUBST}.
#
AC_DEFUN([GUILE_PROGS],
 [AC_PATH_PROG(GUILE,guile)
  if test "$GUILE" = "" ; then
      AC_MSG_ERROR([guile required but not found])
  fi
  AC_SUBST(GUILE)

  _guile_prog_version=`$GUILE -c "(display (effective-version))"`
  if test -z "$GUILE_EFFECTIVE_VERSION"; then
    GUILE_EFFECTIVE_VERSION=$_guile_prog_version
  elif test "$GUILE_EFFECTIVE_VERSION" != "$_guile_prog_version"; then
    AC_MSG_ERROR([found development files for Guile $GUILE_EFFECTIVE_VERSION, but $GUILE has effective version $_guile_prog_version])
  fi

  AC_PATH_PROG(GUILD,guild)
  AC_SUBST(GUILD)

  AC_PATH_PROG(GUILE_CONFIG,guile-config)
  AC_SUBST(GUILE_CONFIG)
  if test -n "$GUILD"; then
    GUILE_TOOLS=$GUILD
  else
    AC_PATH_PROG(GUILE_TOOLS,guile-tools)
  fi
  AC_SUBST(GUILE_TOOLS)
 ])


-- 
http://wingolog.org/





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
  2012-02-02 13:41 ` Andy Wingo
@ 2012-02-02 18:49   ` dsmich
  2012-02-02 20:42     ` Andy Wingo
  2012-03-30 18:05   ` Andy Wingo
  1 sibling, 1 reply; 10+ messages in thread
From: dsmich @ 2012-02-02 18:49 UTC (permalink / raw)
  To: Andy Wingo, Mike Gran; +Cc: 10488


---- Andy Wingo <wingo@pobox.com> wrote: 
> On Thu 12 Jan 2012 19:42, Mike Gran <spk121@yahoo.com> writes:
> 
> > There's a bit of confusion on the guile-config deprecation.
> 
> Indeed.
> 
> > NEWS says that guile-config "will be deprecated"
> 
> This reflects what I would like to happen, but I share your concern that
> we not create a situation in which "guile-config will just disappear
> with no equally powerful, documented replacement in place".  Hence the
> slowness of this transition.  Thanks for bringing it up.
> 
> > meta/guile-config.in says it "has been deprecated"
> 
> I changed the text to "will be deprecated".  It's somewhat
> weasel-worded, I guess.
> 
> > meta/guile.m4's GUILE_PROGS rule will error "guile-config required
> > but not found"
> 
> Uf, this is a can of worms.  I hacked on this a bit this morning, and
> came up with the following.  What do you think?

How about adding something for extensiondir ?

-Dale






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
  2012-02-02 18:49   ` dsmich
@ 2012-02-02 20:42     ` Andy Wingo
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Wingo @ 2012-02-02 20:42 UTC (permalink / raw)
  To: dsmich; +Cc: 10488, Mike Gran

On Thu 02 Feb 2012 19:49, <dsmich@roadrunner.com> writes:

> How about adding something for extensiondir ?

That's a good idea.  The dir for the .go files, too.

Andy
-- 
http://wingolog.org/





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
  2012-02-02 13:41 ` Andy Wingo
  2012-02-02 18:49   ` dsmich
@ 2012-03-30 18:05   ` Andy Wingo
  2013-03-02 18:42     ` Andy Wingo
  1 sibling, 1 reply; 10+ messages in thread
From: Andy Wingo @ 2012-03-30 18:05 UTC (permalink / raw)
  To: Mike Gran; +Cc: 10488

On Thu 02 Feb 2012 14:41, Andy Wingo <wingo@pobox.com> writes:

>> meta/guile.m4's GUILE_PROGS rule will error "guile-config required
>> but not found"
>
> Uf, this is a can of worms.  I hacked on this a bit this morning, and
> came up with the following.  What do you think?

I pushed this as wip-guile-pkg, for review.  It needs documentation
still.

Andy
-- 
http://wingolog.org/





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
  2012-03-30 18:05   ` Andy Wingo
@ 2013-03-02 18:42     ` Andy Wingo
  2013-03-02 21:41       ` Ludovic Courtès
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Andy Wingo @ 2013-03-02 18:42 UTC (permalink / raw)
  To: 10488

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

Hi,

An old bug.  Here Mike notes that the manual said "guile-config is
deprecated", but that guile.m4 still used it.

To solve that, I fixed the docs to be say "will be deprecated", and went
to look at the .m4.  I ended up rewriting it.  The new guile.m4 lets you
choose a version, which is nice.  It also checks to make sure that the
Guile found via checking for GUILE_FLAGS was the same as the Guile found
via checking for GUILE_PROGS.

I pushed it to a branch a year ago but it never got review.  Here's the
patch, rebased and attached.  I'll commit it soon if there are no
objections.

Regards,

Andy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-guile.m4-allows-selection-of-guile-2.0-1.8-etc.patch --]
[-- Type: text/x-diff, Size: 9934 bytes --]

From fde2e48a1e17e9f5844bae8c43f0938bcb02e60a Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@pobox.com>
Date: Fri, 30 Mar 2012 20:04:16 +0200
Subject: [PATCH] guile.m4 allows selection of guile 2.0, 1.8, etc.

* meta/guile.m4 (GUILE_PKG): New macro, chooses a version of Guile
  against which to compile.
  (GUILE_FLAGS, GUILE_PROGS): Rewrite to call GUILE_PKG as necessary, to
  respect any previous call to GUILE_PKG, and to not require
  guile-tools.
---
 meta/guile.m4 |  171 +++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 124 insertions(+), 47 deletions(-)

diff --git a/meta/guile.m4 b/meta/guile.m4
index a7186fb..a3e1ef1 100644
--- a/meta/guile.m4
+++ b/meta/guile.m4
@@ -1,6 +1,6 @@
 ## Autoconf macros for working with Guile.
 ##
-##   Copyright (C) 1998,2001, 2006, 2010 Free Software Foundation, Inc.
+##   Copyright (C) 1998,2001, 2006, 2010, 2012 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
@@ -22,6 +22,7 @@
 ## Index
 ## -----
 ##
+## GUILE_PKG -- find Guile development files
 ## GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
 ## GUILE_FLAGS -- set flags for compiling and linking with Guile
 ## GUILE_SITE_DIR -- find path to Guile "site" directory
@@ -38,53 +39,85 @@
 ## NOTE: Comments preceding an AC_DEFUN (starting from "Usage:") are massaged
 ## into doc/ref/autoconf-macros.texi (see Makefile.am in that directory).
 
-# GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
-#
-# Usage: GUILE_PROGS
-#
-# This macro looks for programs @code{guile}, @code{guile-config} and
-# @code{guile-tools}, and sets variables @var{GUILE}, @var{GUILE_CONFIG} and
-# @var{GUILE_TOOLS}, to their paths, respectively.  If either of the first two
-# is not found, signal error.
-#
-# The variables are marked for substitution, as by @code{AC_SUBST}.
-#
-AC_DEFUN([GUILE_PROGS],
- [AC_PATH_PROG(GUILE,guile)
-  if test "$GUILE" = "" ; then
-      AC_MSG_ERROR([guile required but not found])
+# GUILE_PKG -- find Guile development files
+#
+# Usage: GUILE_PKG([VERSIONS])
+#
+# This macro runs the @code{pkg-config} tool to find development files
+# for an available version of Guile.
+#
+# By default, this macro will search for the latest stable version of
+# Guile (e.g. 2.0), falling back to the previous stable version
+# (e.g. 1.8) if it is available.  If no guile-@var{VERSION}.pc file is
+# found, an error is signalled.  The found version is stored in
+# @var{GUILE_EFFECTIVE_VERSION}.
+#
+# If @code{GUILE_PROGS} was already invoked, this macro ensures that the
+# development files have the same effective version as the Guile
+# program.
+#
+# @var{GUILE_EFFECTIVE_VERSION} is marked for substitution, as by
+# @code{AC_SUBST}.
+#
+AC_DEFUN([GUILE_PKG],
+ [PKG_PROG_PKG_CONFIG
+  _guile_versions_to_search="m4_default([$1], [2.0 1.8])"
+  if test -n "$GUILE_EFFECTIVE_VERSION"; then
+    _guile_tmp=""
+    for v in $_guile_versions_to_search; do
+      if test "$v" = "$GUILE_EFFECTIVE_VERSION"; then
+        _guile_tmp=$v
+      fi
+    done
+    if test -z "$_guile_tmp"; then
+      AC_MSG_FAILURE([searching for guile development files for versions $_guile_versions_to_search, but previously found $GUILE version $GUILE_EFFECTIVE_VERSION])
+    fi
+    _guile_versions_to_search=$GUILE_EFFECTIVE_VERSION
   fi
-  AC_SUBST(GUILE)
-  AC_PATH_PROG(GUILE_CONFIG,guile-config)
-  if test "$GUILE_CONFIG" = "" ; then
-      AC_MSG_ERROR([guile-config required but not found])
+  GUILE_EFFECTIVE_VERSION=""
+  _guile_errors=""
+  for v in $_guile_versions_to_search; do
+    AC_MSG_NOTICE([checking for guile $v])
+    if test -z "$GUILE_EFFECTIVE_VERSION"; then
+      PKG_CHECK_EXISTS([guile-$v], [GUILE_EFFECTIVE_VERSION=$v], [])
+    fi
+  done
+
+  if test -z "$GUILE_EFFECTIVE_VERSION"; then
+    AC_MSG_ERROR([
+No Guile development packages were found.
+
+Please verify that you have Guile installed.  If you installed Guile
+from a binary distribution, please verify that you have also installed
+the development packages.  If you installed it yourself, you might need
+to adjust your PKG_CONFIG_PATH; see the pkg-config man page for more.
+])
   fi
-  AC_SUBST(GUILE_CONFIG)
-  AC_PATH_PROG(GUILE_TOOLS,guile-tools)
-  AC_SUBST(GUILE_TOOLS)
+  AC_MSG_NOTICE([found guile $v])
+  AC_SUBST([GUILE_EFFECTIVE_VERSION])
  ])
 
 # GUILE_FLAGS -- set flags for compiling and linking with Guile
 #
 # Usage: GUILE_FLAGS
 #
-# This macro runs the @code{guile-config} script, installed with Guile, to
-# find out where Guile's header files and libraries are installed.  It sets
-# four variables, @var{GUILE_CFLAGS}, @var{GUILE_LDFLAGS}, @var{GUILE_LIBS},
-# and @var{GUILE_LTLIBS}.
+# This macro runs the @code{pkg-config} tool to find out how to compile
+# and link programs against Guile.  It sets four variables:
+# @var{GUILE_CFLAGS}, @var{GUILE_LDFLAGS}, @var{GUILE_LIBS}, and
+# @var{GUILE_LTLIBS}.
 #
 # @var{GUILE_CFLAGS}: flags to pass to a C or C++ compiler to build code that
 # uses Guile header files.  This is almost always just one or more @code{-I}
 # flags.
 #
-# @var{GUILE_LDFLAGS}: flags to pass to the compiler to link a program against
-# Guile.  This includes @code{-lguile} for the Guile library itself, any
-# libraries that Guile itself requires (like -lqthreads), and so on.  It may
-# also include one or more @code{-L} flag to tell the compiler where to find
-# the libraries.  But it does not include flags that influence the program's
-# runtime search path for libraries, and will therefore lead to a program
-# that fails to start, unless all necessary libraries are installed in a
-# standard location such as @file{/usr/lib}.
+# @var{GUILE_LDFLAGS}: flags to pass to the compiler to link a program
+# against Guile.  This includes @code{-lguile-@var{VERSION}} for the
+# Guile library itself, and may also include one or more @code{-L} flag
+# to tell the compiler where to find the libraries.  But it does not
+# include flags that influence the program's runtime search path for
+# libraries, and will therefore lead to a program that fails to start,
+# unless all necessary libraries are installed in a standard location
+# such as @file{/usr/lib}.
 #
 # @var{GUILE_LIBS} and @var{GUILE_LTLIBS}: flags to pass to the compiler or to
 # libtool, respectively, to link a program against Guile.  It includes flags
@@ -97,16 +130,14 @@ AC_DEFUN([GUILE_PROGS],
 # The variables are marked for substitution, as by @code{AC_SUBST}.
 #
 AC_DEFUN([GUILE_FLAGS],
- [dnl Find guile-config.
-  AC_REQUIRE([GUILE_PROGS])dnl
+ [AC_REQUIRE([GUILE_PKG])
+  PKG_CHECK_MODULES(GUILE, [guile-$GUILE_EFFECTIVE_VERSION])
 
-  AC_MSG_CHECKING([libguile compile flags])
-  GUILE_CFLAGS="`$GUILE_CONFIG compile`"
-  AC_MSG_RESULT([$GUILE_CFLAGS])
+  dnl GUILE_CFLAGS and GUILE_LIBS are already defined and AC_SUBST'd by
+  dnl PKG_CHECK_MODULES.  But GUILE_LIBS to pkg-config is GUILE_LDFLAGS
+  dnl to us.
 
-  AC_MSG_CHECKING([libguile link flags])
-  GUILE_LDFLAGS="`$GUILE_CONFIG link`"
-  AC_MSG_RESULT([$GUILE_LDFLAGS])
+  GUILE_LDFLAGS=$GUILE_LIBS
 
   dnl Determine the platform dependent parameters needed to use rpath.
   dnl AC_LIB_LINKFLAGS_FROM_LIBS is defined in gnulib/m4/lib-link.m4 and needs
@@ -116,6 +147,7 @@ AC_DEFUN([GUILE_FLAGS],
   AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LTLIBS], [$GUILE_LDFLAGS], [yes])
   GUILE_LTLIBS="$GUILE_LDFLAGS $GUILE_LTLIBS"
 
+  AC_SUBST([GUILE_EFFECTIVE_VERSION])
   AC_SUBST([GUILE_CFLAGS])
   AC_SUBST([GUILE_LDFLAGS])
   AC_SUBST([GUILE_LIBS])
@@ -133,16 +165,61 @@ AC_DEFUN([GUILE_FLAGS],
 # The variable is marked for substitution, as by @code{AC_SUBST}.
 #
 AC_DEFUN([GUILE_SITE_DIR],
- [AC_REQUIRE([GUILE_PROGS])dnl
+ [AC_REQUIRE([GUILE_PKG])
   AC_MSG_CHECKING(for Guile site directory)
-  GUILE_SITE=`[$GUILE_CONFIG] info sitedir`
+  GUILE_SITE=`$PKG_CONFIG --print-errors --variable=sitedir guile-$GUILE_EFFECTIVE_VERSION`
+  AC_MSG_RESULT($GUILE_SITE)
   if test "$GUILE_SITE" = ""; then
-     GUILE_SITE=`[$GUILE_CONFIG] info pkgdatadir`/site
+     AC_MSG_FAILURE(sitedir not found)
   fi
-  AC_MSG_RESULT($GUILE_SITE)
   AC_SUBST(GUILE_SITE)
  ])
 
+# GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
+#
+# Usage: GUILE_PROGS
+#
+# This macro looks for programs @code{guile} and @code{guild}, setting
+# variables @var{GUILE} and @var{GUILD} to their paths, respectively.
+# If @code{guile} is not found, signal an error.
+#
+# The effective version of the found @code{guile} is set to
+# @var{GUILE_EFFECTIVE_VERSION}.  This macro ensures that the effective
+# version is compatible with the result of a previous invocation of
+# @code{GUILE_FLAGS}, if any.
+#
+# As a legacy interface, it also looks for @code{guile-config} and
+# @code{guile-tools}, setting @var{GUILE_CONFIG} and @var{GUILE_TOOLS}.
+#
+# The variables are marked for substitution, as by @code{AC_SUBST}.
+#
+AC_DEFUN([GUILE_PROGS],
+ [AC_PATH_PROG(GUILE,guile)
+  if test "$GUILE" = "" ; then
+      AC_MSG_ERROR([guile required but not found])
+  fi
+  AC_SUBST(GUILE)
+
+  _guile_prog_version=`$GUILE -c "(display (effective-version))"`
+  if test -z "$GUILE_EFFECTIVE_VERSION"; then
+    GUILE_EFFECTIVE_VERSION=$_guile_prog_version
+  elif test "$GUILE_EFFECTIVE_VERSION" != "$_guile_prog_version"; then
+    AC_MSG_ERROR([found development files for Guile $GUILE_EFFECTIVE_VERSION, but $GUILE has effective version $_guile_prog_version])
+  fi
+
+  AC_PATH_PROG(GUILD,guild)
+  AC_SUBST(GUILD)
+
+  AC_PATH_PROG(GUILE_CONFIG,guile-config)
+  AC_SUBST(GUILE_CONFIG)
+  if test -n "$GUILD"; then
+    GUILE_TOOLS=$GUILD
+  else
+    AC_PATH_PROG(GUILE_TOOLS,guile-tools)
+  fi
+  AC_SUBST(GUILE_TOOLS)
+ ])
+
 # GUILE_CHECK -- evaluate Guile Scheme code and capture the return value
 #
 # Usage: GUILE_CHECK_RETVAL(var,check)
-- 
1.7.10.4


[-- Attachment #3: Type: text/plain, Size: 26 bytes --]


-- 
http://wingolog.org/

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
  2013-03-02 18:42     ` Andy Wingo
@ 2013-03-02 21:41       ` Ludovic Courtès
  2013-03-09 10:20         ` Andy Wingo
       [not found]       ` <878v65q84t.fsf@zigzag.favinet>
  2013-03-10 22:35       ` Andy Wingo
  2 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2013-03-02 21:41 UTC (permalink / raw)
  To: Andy Wingo; +Cc: 10488

Hi!

Andy Wingo <wingo@pobox.com> skribis:

> +# GUILE_PKG -- find Guile development files
> +#
> +# Usage: GUILE_PKG([VERSIONS])
> +#
> +# This macro runs the @code{pkg-config} tool to find development files
> +# for an available version of Guile.
> +#
> +# By default, this macro will search for the latest stable version of
> +# Guile (e.g. 2.0), falling back to the previous stable version
> +# (e.g. 1.8) if it is available.  If no guile-@var{VERSION}.pc file is
> +# found, an error is signalled.  The found version is stored in
> +# @var{GUILE_EFFECTIVE_VERSION}.
> +#
> +# If @code{GUILE_PROGS} was already invoked, this macro ensures that the
> +# development files have the same effective version as the Guile
> +# program.
> +#
> +# @var{GUILE_EFFECTIVE_VERSION} is marked for substitution, as by
> +# @code{AC_SUBST}.

Looks good.  My main grief would be that it makes guile.m4 depend on
pkg.m4, which we don’t distribute ourselves.  And so this may cause
“PKG_PROG_PKG_CONFIG: command not found” bug reports.

Hmm, WDYT?

Ludo’.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
  2013-03-02 21:41       ` Ludovic Courtès
@ 2013-03-09 10:20         ` Andy Wingo
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Wingo @ 2013-03-09 10:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 10488

On Sat 02 Mar 2013 22:41, ludo@gnu.org (Ludovic Courtès) writes:

> Looks good.  My main grief would be that it makes guile.m4 depend on
> pkg.m4, which we don’t distribute ourselves.  And so this may cause
> “PKG_PROG_PKG_CONFIG: command not found” bug reports.

We can just tell people to cat pkg.m4 into their acinclude.m4, if that's
an issue.  guile-config already calls the pkg-config binary, so builders
will probably have it installed anyway.

Andy
-- 
http://wingolog.org/





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
       [not found]       ` <878v65q84t.fsf@zigzag.favinet>
@ 2013-03-09 10:28         ` Andy Wingo
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Wingo @ 2013-03-09 10:28 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: 10488

Hi,

On Sun 03 Mar 2013 08:01, Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> () Andy Wingo <wingo@pobox.com>
> () Sat, 02 Mar 2013 19:42:19 +0100
>
>    I pushed it to a branch a year ago but it never got review.  Here's
>    the patch, rebased and attached.  I'll commit it soon if there are no
>    objections.
>
> Not an objection, but a suggestion: If the purpose of the code is to
> select a Guile version, why not call it guile-sel.m4 (or somesuch),
> and distribute it alongside guile.m4?

With parallel installation, there is no obvious global choice of which
version of Guile is the right one.  Projects should choose, explicitly.
A guile.m4 update will adjust the default search order, but projects
should probably also bundle a copy of guile.m4 to prevent bug reports
about inexplicable autoconf errors.  So even if the system guile.m4 is
updated, a typical project's choice of version does not change.

There is also the difficulty that Guile provides two APIs: one for C and
one for Scheme.  When guile.m4 goes to look for the details of those
APIs (e.g. the guild binary, and the libguile library), they need to
come from the same Guile installation.  For this reason guile.m4 should
be aware of which choice the user has made, and have an easy way of
correlating C and Scheme API.

Andy
-- 
http://wingolog.org/





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#10488: guile-config deprecation?
  2013-03-02 18:42     ` Andy Wingo
  2013-03-02 21:41       ` Ludovic Courtès
       [not found]       ` <878v65q84t.fsf@zigzag.favinet>
@ 2013-03-10 22:35       ` Andy Wingo
  2 siblings, 0 replies; 10+ messages in thread
From: Andy Wingo @ 2013-03-10 22:35 UTC (permalink / raw)
  To: 10488-done

On Sat 02 Mar 2013 19:42, Andy Wingo <wingo@pobox.com> writes:

> I pushed it to a branch a year ago but it never got review.  Here's the
> patch, rebased and attached.  I'll commit it soon if there are no
> objections.

I have pushed this.  Please test with your applications!

Andy
-- 
http://wingolog.org/





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-03-10 22:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 18:42 bug#10488: guile-config deprecation? Mike Gran
2012-02-02 13:41 ` Andy Wingo
2012-02-02 18:49   ` dsmich
2012-02-02 20:42     ` Andy Wingo
2012-03-30 18:05   ` Andy Wingo
2013-03-02 18:42     ` Andy Wingo
2013-03-02 21:41       ` Ludovic Courtès
2013-03-09 10:20         ` Andy Wingo
     [not found]       ` <878v65q84t.fsf@zigzag.favinet>
2013-03-09 10:28         ` Andy Wingo
2013-03-10 22:35       ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).