unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Aleix Conchillo Flaqué" <aconchillo@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: [PATCH] allow specifying a required version in GUILE_PROGS
Date: Mon, 14 Oct 2013 14:35:43 -0700	[thread overview]
Message-ID: <CA+XASoVTqQiowy8UnpZPrZmyzXC6Be6-jfXEC_5mCw9AvfVBYw@mail.gmail.com> (raw)
In-Reply-To: <87vc0zh8az.fsf@gnu.org>

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

Hi!

On Mon, Oct 14, 2013 at 2:05 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> Hi Aleix,
>
> (Second try.)
>
> The patch looks good to me.
>
> Perhaps error messages should show
> $_guile_major_version.$_guile_minor_version.$_guile_micro_version since
> that could differ from $_guile_prog_version (for instance in Debian
> $_guile_prog_version is something like 2.0.9-deb42.)
>

Yes, I saw that and thought it was OK as the check was successfully
anyway. But probably it looks better as you suggested. In the attached
patch I don't get the version from (version) and I build
_guile_prog_version with macro.minor.micro.

> For code contributed to Guile, we ask for a copyright assignment to the
> FSF.  Would that be OK with you?  If yes, I can send you the form
> off-list, and then we can proceed (you might even be able to avoid snail
> mail entirely.)
>

Yes, sure.

Aleix

[-- Attachment #2: guile-progs.patch --]
[-- Type: application/octet-stream, Size: 4559 bytes --]

From 05a621e880155849d293ce1db4155fb9a97c3c66 Mon Sep 17 00:00:00 2001
From: Aleix Conchillo Flaque <aconchillo@gmail.com>
Date: Thu, 3 Oct 2013 15:49:07 -0700
Subject: [PATCH] allow specifying a required version in GUILE_PROGS

* meta/guile.m4: GUILE_PROGS now takes an optional argument to specify a
  required Guile version. By default, it requires Guile >= 2.0. A micro
  version can also be specified (e.g. GUILE_PROGS([2.0.10])).
---
 meta/guile.m4 | 44 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 8 deletions(-)

diff --git a/meta/guile.m4 b/meta/guile.m4
index a3e1ef1..304dea9 100644
--- a/meta/guile.m4
+++ b/meta/guile.m4
@@ -1,17 +1,17 @@
 ## Autoconf macros for working with Guile.
 ##
-##   Copyright (C) 1998,2001, 2006, 2010, 2012 Free Software Foundation, Inc.
+##   Copyright (C) 1998,2001, 2006, 2010, 2012, 2013 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
 ## as published by the Free Software Foundation; either version 3 of
 ## the License, or (at your option) any later version.
-## 
+##
 ## This library 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
 ## Lesser General Public License for more details.
-## 
+##
 ## You should have received a copy of the GNU Lesser General Public
 ## License along with this library; if not, write to the Free Software
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
@@ -177,12 +177,15 @@ AC_DEFUN([GUILE_SITE_DIR],
 
 # GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
 #
-# Usage: GUILE_PROGS
+# Usage: GUILE_PROGS([VERSION])
 #
 # 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.
 #
+# By default, this macro will search for the latest stable version of
+# Guile (e.g. 2.0).
+#
 # 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
@@ -195,17 +198,42 @@ AC_DEFUN([GUILE_SITE_DIR],
 #
 AC_DEFUN([GUILE_PROGS],
  [AC_PATH_PROG(GUILE,guile)
+  _guile_required_version="m4_default([$1], [2.0])"
   if test "$GUILE" = "" ; then
       AC_MSG_ERROR([guile required but not found])
   fi
   AC_SUBST(GUILE)
 
-  _guile_prog_version=`$GUILE -c "(display (effective-version))"`
+  _guile_effective_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])
+    GUILE_EFFECTIVE_VERSION=$_guile_effective_version
+  elif test "$GUILE_EFFECTIVE_VERSION" != "$_guile_effective_version"; then
+    AC_MSG_ERROR([found development files for Guile $GUILE_EFFECTIVE_VERSION, but $GUILE has effective version $_guile_effective_version])
+  fi
+
+  _guile_major_version=`$GUILE -c "(display (major-version))"`
+  _guile_minor_version=`$GUILE -c "(display (minor-version))"`
+  _guile_micro_version=`$GUILE -c "(display (micro-version))"`
+  _guile_prog_version="$_guile_major_version.$_guile_minor_version.$_guile_micro_version"
+
+  AC_MSG_CHECKING([for Guile version >= $_guile_required_version])
+  _major_version=`echo $_guile_required_version | cut -d . -f 1`
+  _minor_version=`echo $_guile_required_version | cut -d . -f 2`
+  _micro_version=`echo $_guile_required_version | cut -d . -f 3`
+  if test "$_guile_major_version" -ge "$_major_version"; then
+    if test "$_guile_minor_version" -ge "$_minor_version"; then
+      if test -n "$_micro_version"; then
+        if test "$_guile_micro_version" -lt "$_micro_version"; then
+          AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found])
+        fi
+      fi
+    else
+      AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found])
+    fi
+  else
+    AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found])
   fi
+  AC_MSG_RESULT([$_guile_prog_version])
 
   AC_PATH_PROG(GUILD,guild)
   AC_SUBST(GUILD)
-- 
1.8.4.rc3


  reply	other threads:[~2013-10-14 21:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03 22:55 [PATCH] allow specifying a required version in GUILE_PROGS Aleix Conchillo Flaqué
2013-10-14 21:05 ` Ludovic Courtès
2013-10-14 21:35   ` Aleix Conchillo Flaqué [this message]
2013-10-18 21:50     ` Ludovic Courtès
2013-10-19  0:55       ` Aleix Conchillo Flaqué
2013-12-21 21:05         ` Ludovic Courtès
2013-12-22  6:24           ` Aleix Conchillo Flaqué

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+XASoVTqQiowy8UnpZPrZmyzXC6Be6-jfXEC_5mCw9AvfVBYw@mail.gmail.com \
    --to=aconchillo@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).