guile-user
[Top][All Lists]
Advanced

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

Re: pkg-config


From: Aaron VanDevender
Subject: Re: pkg-config
Date: Mon, 12 Jun 2006 12:37:51 -0500

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.

-- 

address@hidden
Plead the First.




reply via email to

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