Re: pkg-config

Aaron VanDevender <[email protected]>
Newsgroups gmane.lisp.guile.user,gmane.lisp.guile.sources
Message-ID <[email protected]>
On Mon, 2006-06-12 at 23:27 +0100, Neil Jerram wrote:
> Yes, sounds like it.  Is your most recent patch still how you think
> this should be done?

I think we should apply both my pkg-config patch as well as this patch,
which fixes the RETVAL situation, and adds a macro for checking the
version explicitly. That way people could choose whether they want to
use pkg-config or our own macros to check for guile versions.

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 05:47:58 -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,31 @@
   $1=$?
  ])
 
+# GUILE_CHECK_VERSION -- check for a particular Guile version
+#
+# Usage: GUILE_CHECK_VERSION(MIN-VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOTFOUND])
+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))))))])
+GUILE_VERSION=[`guile -c "(display (version))"`]
+AC_SUBST(GUILE_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)


-- 

[email protected]
Plead the First.


_______________________________________________
Guile-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.