[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24657: Autoconf macro GUILE_PROGS only looks for guile without versi

From: Andy Wingo
Subject: bug#24657: Autoconf macro GUILE_PROGS only looks for guile without version suffix even if given version - patch included
Date: Thu, 23 Feb 2017 10:43:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi Freja,

Thanks for this bug report and the patch, and sorry for the delay :)

On Mon 10 Oct 2016 11:45, Freja Nordsiek <address@hidden> writes:

> While trying to build a package that uses guile with autotools, I
> found a problem in the provided GUILE_PROGS macro.
> The macro searches for the executables guile, guild, guile-config, and
> guile-tools. The problem is that even if the macro is given the
> version, it only looks for guile, guild, etc. with no version suffix.

Applied your patch with some small modifications; attached.  Let me know
if it works for you!


>From b6d3ab6c0f912c48463b597ccfa18879f550cf50 Mon Sep 17 00:00:00 2001
From: Freja Nordsiek <address@hidden>
Date: Mon, 10 Oct 2016 15:50:19 +0700
Subject: [PATCH] Fixed specific version of guile search in autoconf macro

* meta/guile.m4 (GUILE_PROGS): Search for guile with suffixes
  first ('-X.Y' and 'X.Y' where X.Y denotes the version) before
  searching for guile with no suffix.  Patch co-authored by Andy Wingo.
 meta/guile.m4 | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/meta/guile.m4 b/meta/guile.m4
index 9fd4f1a..2e4f3dc 100644
--- a/meta/guile.m4
+++ b/meta/guile.m4
@@ -181,7 +181,12 @@ AC_DEFUN([GUILE_SITE_DIR],
 # 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 macro will attempt to find @code{guile} with the suffix of
+# @code{-X.Y}, followed by looking for it with the suffix @code{X.Y}, and
+# then fall back to looking for @code{guile} with no suffix. If
+# @code{guile} is still not found, signal an error. The suffix, if any,
+# that was required to find @code{guile} will be used for @code{guild}
+# as well.
 # By default, this macro will search for the latest stable version of
 # Guile (e.g. 2.0). x.y or x.y.z versions can be specified. If an older
@@ -198,16 +203,25 @@ AC_DEFUN([GUILE_SITE_DIR],
 # The variables are marked for substitution, as by @code{AC_SUBST}.
-  _guile_required_version="m4_default([$1], [$GUILE_EFFECTIVE_VERSION])"
+ [_guile_required_version="m4_default([$1], [$GUILE_EFFECTIVE_VERSION])"
   if test -z "$_guile_required_version"; then
-  if test "$GUILE" = "" ; then
+  _guile_candidates=guile
+  _tmp=
+  for v in `echo "$_guile_required_version" | tr . ' '`; do
+    if test -n "$_tmp"; then _tmp=.$_tmp; fi
+    _tmp=$v$_tmp
+    _guile_candidates="guile-$_tmp guile$_tmp $_guile_candidates"
+  done
+  AC_PATH_PROGS(GUILE,[$_guile_candidates])
+  if test -z "$GUILE"; then
       AC_MSG_ERROR([guile required but not found])
+  _guile_suffix=`echo "$GUILE" | sed -e 's,^.*/guile\(.*\)$,\1,'`
   _guile_effective_version=`$GUILE -c "(display (effective-version))"`
   if test -z "$GUILE_EFFECTIVE_VERSION"; then
@@ -246,15 +260,15 @@ AC_DEFUN([GUILE_PROGS],
+  AC_PATH_PROG(GUILD,[guild$_guile_suffix])
-  AC_PATH_PROG(GUILE_CONFIG,guile-config)
+  AC_PATH_PROG(GUILE_CONFIG,[guile-config$_guile_suffix])
   if test -n "$GUILD"; then
-    AC_PATH_PROG(GUILE_TOOLS,guile-tools)
+    AC_PATH_PROG(GUILE_TOOLS,[guile-tools$_guile_suffix])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]