On Mon, 2006-06-12 at 09:42 +0200, Ludovic Courtès wrote:
> For instance, you could use the following tests within your `configure.ac':
> 
>   GUILE_PROGS
>   GUILE_CHECK_RETVAL([correct_version_p],
>     [(exit (string>=? (version) "1.6.7"))])

The guile.m4 that is currently in CVS has a comment about
GUILE_CHECK_RETVAL, but the code beneath it implements a function called
simply GUILE_CHECK. We should decide whether we want to call it _RETVAL
or not, but it is probably bad form to document one and implement the
other.

Secondly, the code above fails if (version) is 1.6.10, since the string
comparison operators are char by char.

So instead we'd be better off with:

GUILE_CHECK([correct_version_p],
    [(exit (let loop ((v1 (map string->number (string-split (version) 
(string-ref \".\" 0))))
             (v2 (map string->number (string-split \"1.6.7\" (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))))))])

But this is pretty ugly, so maybe we'd really be better off with
pkg-config.

-- 

[EMAIL PROTECTED]
Plead the First.


_______________________________________________
Guile-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to