autoconf
[Top][All Lists]
Advanced

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

Re: caching variables


From: Sam Steingold
Subject: Re: caching variables
Date: Fri, 11 Sep 2009 12:15:32 -0400

Hi Ralf,

thanks for your reply

On Mon, Sep 7, 2009 at 4:59 PM, Ralf Wildenhues <address@hidden> wrote:
> * Sam Steingold wrote on Wed, Sep 02, 2009 at 07:51:20PM CEST:
>> does the cache variable name matter?
>> e.g., ac_cv_have_readline is not declared cached in
>> http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/src/m4/readline.m4
>> but I do see it in config.cache.
>
> Generally, configure currently saves all variables matching *_cv_*
> (glob notation), and considers a variable cached also if its value
> is empty.  It uses AS_VAR_TEST_SET to test if the variable is cached.
> Being very precise, we don't document that you can use cache variables
> without one of the AC_CACHE_{CHECK,VAL} macros, but I'm not sure whether
> a future Autoconf version may make this a requirement.

this pretty much leaves the issue moot: if you have this (undocumented)
feature and people rely on it, getting rid of it would be hard.

>> specifically:
>>
>> AC_DEFUN([AC_FOO],[dnl
>> AC_ARG_WITH([foo],
>> AC_HELP_STRING([--with-foo],[use this FOO installation]),
>> [ac_cv_use_foo="$withval"], [ac_cv_use_foo=default])
>
> By overwriting the cache variable with the value obtained from
> --with-foo, you cannot tell any more whether the variable was cached
> or you just read a command line argument.

then, I guess, I do not want it cached.

>> 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!

>> I want all the ac_cv_* vars to be cached.
>> how do I arrange for that?
>> i.e., should I put the "if $ac_cv_foo_command bar;" inside AC_CACHE_CHECK?
>> would those _nested_ AC_CACHE_CHECKs work?
>
> You should have one
>  AC_CACHE_CHECK(MESSAGE, CACHE-ID, COMMANDS)
>
> or one
>  AC_CACHE_VAL(CACHE-ID, COMMANDS)
>
> for one of the CACHE-IDs.  The important thing is that you don't set
> that CACHE-ID outside of COMMANDS, and the COMMANDS should only set the
> CACHE-ID (and the other, dependent ones, I guess).

yes, this is what the manual says.
alas, it does not answer my question.

let me try again.

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"?

thanks.

-- 
Sam Steingold <http://sds.podval.org>




reply via email to

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