autoconf
[Top][All Lists]
Advanced

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

Re: caching variables


From: Ralf Wildenhues
Subject: Re: caching variables
Date: Fri, 11 Sep 2009 19:27:41 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

* Sam Steingold wrote on Fri, Sep 11, 2009 at 06:15:32PM CEST:
> On Mon, Sep 7, 2009 at 4:59 PM, Ralf Wildenhues wrote:
> >> ac_cv_have_foo=no
> >
> > Here you just overwrite the value obtained above again.
> >
> >> if test "$ac_cv_use_foo" = "no";
> >
> > This will then always be true.
> 
> why?! I set "_have_" to "no", and I am testing "_use_" here!

So much for my reading skills.  Sorry about that.

> I am testing for a presence of a clisp installation, please see
> http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/src/m4/clisp.m4
> (BTW, any critique is welcome!).
> 
> what I do is:
> 
> cl_cv_have_clisp=no
> if cl_cv_use_clisp = yes; then
>   check_for_THIS
>   if cl_cv_have_THIS = yes; then
>     check_for_THAT
>     if cl_cv_have_THAT = yes; then
>       cl_cv_have_clisp=yes
>     fi
>   fi
> fi
> 
> here is the question: where do I put AC_CACHE_VAL?
> around the whole top "if cl_cv_use_clisp"?
> or in the innermost "if cl_cv_have_THAT"?

I'd do it like below, completely untested.  Maybe I'd even move the last
AC_CACHE_CHECK after the last 'fi', so that it is always run, and add
  test "$cl_use_clisp" != "no" && test "X$cl_cv_clisp" != "X" && ...

The way I did below it probably also still needs
  test "X$cl_cv_clisp" != "X" ...

added

Hope that helps.

Cheers,
Ralf

--- clisp.m4.orig       2009-09-11 18:50:14.000000000 +0200
+++ clisp.m4    2009-09-11 18:58:34.000000000 +0200
@@ -20,12 +20,11 @@
 AC_DEFUN([CL_CLISP],[dnl
 AC_ARG_WITH([clisp],
 AC_HELP_STRING([--with-clisp],[use a specific CLISP installation]),
-[cl_cv_use_clisp="$withval"], [cl_cv_use_clisp=default])
-cl_cv_have_clisp=no
-if test "$cl_cv_use_clisp" != "no"; then
-  if test "$cl_cv_use_clisp" = default -o "$cl_cv_use_clisp" = yes;
+[cl_use_clisp="$withval"], [cl_use_clisp=default])
+if test "$cl_use_clisp" != "no"; then
+  if test "$cl_use_clisp" = default -o "$cl_use_clisp" = yes;
   then AC_PATH_PROG(cl_cv_clisp, clisp)
-  else cl_cv_clisp="$cl_cv_use_clisp"
+  else cl_cv_clisp="$cl_use_clisp"
   fi
   if test "X$cl_cv_clisp" != "X"; then
     AC_CACHE_CHECK([for CLISP version], [cl_cv_clisp_version], [dnl
@@ -60,11 +59,15 @@
     AC_SUBST(CLISP_LIBS)dnl
     AC_SUBST(CLISP_CFLAGS)dnl
     AC_SUBST(CLISP_CPPFLAGS)dnl
-    AC_CACHE_CHECK([for CLISP], [cl_cv_have_clisp],
-     [test -d $cl_cv_clisp_libdir -a -d $cl_cv_clisp_linkset && \
-       cl_cv_have_clisp=yes])
   fi
-fi])
+  AC_CACHE_CHECK([for CLISP], [cl_cv_have_clisp],
+   [if test -d $cl_cv_clisp_libdir && test -d $cl_cv_clisp_linkset; then
+      cl_cv_have_clisp=yes
+    else
+      cl_cv_have_clisp=no
+    fi])
+fi
+])
 
 AC_DEFUN([CL_CLISP_NEED_FFI],[AC_REQUIRE([CL_CLISP])dnl
 AC_CACHE_CHECK([for FFI in CLISP], [cl_cv_clisp_ffi],




reply via email to

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