unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Aaron VanDevender <sig@netdot.net>
Cc: guile-sources@gnu.org
Subject: guile.m4
Date: Tue, 13 Jun 2006 09:40:43 -0500	[thread overview]
Message-ID: <1150209643.2726.146.camel@lazlo.netdot.net> (raw)

Here is a slightly improved version of my guile.m4 patch. It has some
more explicit comments and uses the guile executable set by GUILE_PROGS

Index: guile.m4
===================================================================
RCS file: /sources/guile/guile/guile-core/guile-config/guile.m4,v
retrieving revision 1.8
diff -u -r1.8 guile.m4
--- guile.m4	16 Apr 2006 23:36:35 -0000	1.8
+++ guile.m4	13 Jun 2006 14:35:50 -0000
@@ -23,6 +23,7 @@
 ## GUILE_FLAGS -- set flags for compiling and linking with Guile
 ## GUILE_SITE_DIR -- find path to Guile "site" directory
 ## GUILE_CHECK -- evaluate Guile Scheme code and capture the return value
+## GUILE_CHECK_VERSION -- checks for a version of the guile interpreter
 ## GUILE_MODULE_CHECK -- check feature of a Guile Scheme module
 ## GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module
 ## GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable
@@ -112,7 +113,7 @@
 
 # GUILE_CHECK -- evaluate Guile Scheme code and capture the return value
 #
-# Usage: GUILE_CHECK_RETVAL(var,check)
+# Usage: GUILE_CHECK(var,check)
 #
 # @var{var} is a shell variable name to be set to the return value.
 # @var{check} is a Guile Scheme expression, evaluated with "$GUILE -c", and
@@ -126,6 +127,36 @@
   $1=$?
  ])
 
+# GUILE_CHECK_VERSION -- check for a particular Guile version
+#
+# Usage: GUILE_CHECK_VERSION(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOTFOUND])
+#
+# @var{MIN-VERSION} is the minimum guile version to check for.
+# @var{ACTION-IF-FOUND} is an action to perform if guile version MIN-VERSION or
+#    or greater is found. Defaults to do nothing.
+# @var{ACTION-IF-NOT-FOUND} is an action to perform if no guile version MIN-VERSION
+#    or greater is found. Defaults to throwing a configure error.
+AC_DEFUN([GUILE_CHECK_VERSION],
+[AC_REQUIRE([GUILE_PROGS])dnl
+AC_MSG_CHECKING([for guile version >= $1])
+GUILE_CHECK([GUILE_CORRECT_VERSION_P],
+    [(exit (let loop ((v1 (map string->number (string-split (version) (string-ref \".\" 0))))
+             (v2 (map string->number (string-split \"$1\" (string-ref \".\" 0)))))
+             (cond ((and (null? v1) (null? v2)) 0)
+                   ((null? v1) 0)
+                   ((null? v2) 1)
+                   ((> (car v1) (car v2)) 0)
+                   ((< (car v1) (car v2)) 1)
+                   (else (loop (cdr v1) (cdr v2))))))])
+AC_SUBST(GUILE_VERSION,[`$GUILE -c "(display (version))"`])
+if test 0 -eq "$GUILE_CORRECT_VERSION_P" ; then
+   AC_MSG_RESULT([yes ($GUILE_VERSION)])
+m4_ifval([$2], [   $2])dnl
+   else
+   AC_MSG_RESULT([no ($GUILE_VERSION)])
+m4_ifvaln([$3], [   $3], [   AC_MSG_ERROR([requires guile >= $1])])dnl
+fi])
+
 # GUILE_MODULE_CHECK -- check feature of a Guile Scheme module
 #
 # Usage: GUILE_MODULE_CHECK(var,module,featuretest,description)




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


             reply	other threads:[~2006-06-13 14:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-13 14:40 Aaron VanDevender [this message]
2006-06-14  0:17 ` guile.m4 Neil Jerram
2006-06-14  3:02   ` guile.m4 Aaron VanDevender
2006-06-15  0:57 ` guile.m4 Kevin Ryde
2006-06-15  1:59   ` guile.m4 Aaron VanDevender
2006-06-15  5:52     ` guile.m4 Stephen Compall

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=1150209643.2726.146.camel@lazlo.netdot.net \
    --to=sig@netdot.net \
    --cc=guile-sources@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).