* guile.m4
@ 2006-06-13 14:40 Aaron VanDevender
2006-06-14 0:17 ` guile.m4 Neil Jerram
2006-06-15 0:57 ` guile.m4 Kevin Ryde
0 siblings, 2 replies; 6+ messages in thread
From: Aaron VanDevender @ 2006-06-13 14:40 UTC (permalink / raw)
Cc: guile-sources
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: guile.m4
2006-06-13 14:40 guile.m4 Aaron VanDevender
@ 2006-06-14 0:17 ` Neil Jerram
2006-06-14 3:02 ` guile.m4 Aaron VanDevender
2006-06-15 0:57 ` guile.m4 Kevin Ryde
1 sibling, 1 reply; 6+ messages in thread
From: Neil Jerram @ 2006-06-14 0:17 UTC (permalink / raw)
Cc: guile-user, guile-sources
Aaron VanDevender <sig@netdot.net> writes:
> 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
Thanks for working on this. I have a couple of queries.
> +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)))))
Can we use #\. instead of (string-ref "." 0), or is the former a
nightmare to quote correctly?
> + (cond ((and (null? v1) (null? v2)) 0)
> + ((null? v1) 0)
> + ((null? v2) 1)
> + ((> (car v1) (car v2)) 0)
> + ((< (car v1) (car v2)) 1)
Shouldn't the (null? v1) case have the same polarity as the (< v1 v2)
case (because absence == 0) ?
Regards,
Neil
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: guile.m4
2006-06-14 0:17 ` guile.m4 Neil Jerram
@ 2006-06-14 3:02 ` Aaron VanDevender
0 siblings, 0 replies; 6+ messages in thread
From: Aaron VanDevender @ 2006-06-14 3:02 UTC (permalink / raw)
Cc: guile-user, guile-sources
On Wed, 2006-06-14 at 01:17 +0100, Neil Jerram wrote:
> > +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)))))
>
> Can we use #\. instead of (string-ref "." 0), or is the former a
> nightmare to quote correctly?
I tried to escape it, and I couldn't figure it out. And from
guile.m4:GUILE_CHECK:
# Avoid using the character "#" since that confuses autoconf.
It may not be possible. I don't know.
> > + (cond ((and (null? v1) (null? v2)) 0)
> > + ((null? v1) 0)
> > + ((null? v2) 1)
> > + ((> (car v1) (car v2)) 0)
> > + ((< (car v1) (car v2)) 1)
>
> Shouldn't the (null? v1) case have the same polarity as the (< v1 v2)
> case (because absence == 0) ?
Yes, you are correct. It should be:
(cond ((and (null? v1) (null? v2)) 0)
((null? v1) 1)
((null? v2) 0)
((> (car v1) (car v2)) 0)
((< (car v1) (car v2)) 1)
(else (loop (cdr v1) (cdr v2))))))
I had it all figured out with #f's and #t's instead of 1's and 0's, but
then I couldn't get it to escape in autoconf, so I guess I messed it up
when I switched to 0's and 1's.
Good eyes.
--
sig@netdot.net
Plead the First.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: guile.m4
2006-06-13 14:40 guile.m4 Aaron VanDevender
2006-06-14 0:17 ` guile.m4 Neil Jerram
@ 2006-06-15 0:57 ` Kevin Ryde
2006-06-15 1:59 ` guile.m4 Aaron VanDevender
1 sibling, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2006-06-15 0:57 UTC (permalink / raw)
Aaron VanDevender <sig@netdot.net> writes:
>
> +# GUILE_CHECK_VERSION -- check for a particular Guile version
> +#
> +# Usage: GUILE_CHECK_VERSION(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOTFOUND])
The autoconf philosophy is usually not to check version numbers
explicitly if it can be avoided, better to check for desired
feature(s).
Since guile is interpreted you can do a lot at runtime instead of
worrying about it during configure too.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: guile.m4
2006-06-15 0:57 ` guile.m4 Kevin Ryde
@ 2006-06-15 1:59 ` Aaron VanDevender
2006-06-15 5:52 ` guile.m4 Stephen Compall
0 siblings, 1 reply; 6+ messages in thread
From: Aaron VanDevender @ 2006-06-15 1:59 UTC (permalink / raw)
Cc: guile-user
On Thu, 2006-06-15 at 10:57 +1000, Kevin Ryde wrote:
> The autoconf philosophy is usually not to check version numbers
> explicitly if it can be avoided, better to check for desired
> feature(s).
>
> Since guile is interpreted you can do a lot at runtime instead of
> worrying about it during configure too.
Not really for my purposes. I want to be able to decide if I should use
SCM_MUST_MALLOC or scm_gc_malloc. This isn't something that the
interpreter can tell me. I suppose I can grep though the header file,
but it seemed that checking for the version was more robust.
Is there a better way?
--
sig@netdot.net
Plead the First.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: guile.m4
2006-06-15 1:59 ` guile.m4 Aaron VanDevender
@ 2006-06-15 5:52 ` Stephen Compall
0 siblings, 0 replies; 6+ messages in thread
From: Stephen Compall @ 2006-06-15 5:52 UTC (permalink / raw)
Cc: guile-user
On Jun 14, 2006, at 8:59 PM, Aaron VanDevender wrote:
> Not really for my purposes. I want to be able to decide if I should
> use
> SCM_MUST_MALLOC or scm_gc_malloc. This isn't something that the
> interpreter can tell me. I suppose I can grep though the header file,
> but it seemed that checking for the version was more robust.
>
> Is there a better way?
Add the Guile libs to $LIBS and see if you can compile a test call to
scm_gc_malloc using AC_CHECK_FUNCS(scm_gc_malloc).
The general formula for autoconf is to do things directly. In your
case, you want to see if you can use scm_gc_malloc; therefore, the
way to go is to directly try to compile a call to said function.
--
Stephen Compall
http://scompall.nocandysw.com/blog
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-06-15 5:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-13 14:40 guile.m4 Aaron VanDevender
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
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).