autoconf
[Top][All Lists]
Advanced

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

caching variables


From: Sam Steingold
Subject: caching variables
Date: Wed, 02 Sep 2009 11:26:46 -0400
User-agent: Thunderbird 2.0.0.22 (X11/20090625)

Hi,
I want to cache several dependent variables, and I cannot figure out how to do
that correctly.
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])
ac_cv_have_foo=no
if test "$ac_cv_use_foo" = "no";
then AC_MSG_NOTICE([not checking for FOO])
else
  if test "$ac_cv_use_foo" = default -o "$ac_cv_use_foo" = yes;
  then AC_PATH_PROG(ac_cv_foo_command, foo)
  else ac_cv_foo_command="$ac_cv_use_foo"
  fi
  if X$ac_cv_foo_command = X; then
    AC_MSG_RESULT([no FOO])
  else
    if $ac_cv_foo_command bar; then
      AC_MSG_RESULT([no FOO])
    else
      ac_cv_foo_bar=bar
      if  $ac_cv_foo_command zot; then
        AC_MSG_RESULT([no FOO])
      else
        ac_cv_foo_zot=zot
        ac_cv_have_foo=yes
      fi
    fi
  fi
fi
FOO=$ac_cv_foo_command; AC_SUBST(FOO)
FOO_BAR=$ac_cv_foo_bar; AC_SUBST(FOO_BAR)
FOO_ZOT=$ac_cv_foo_zot; AC_SUBST(FOO_ZOT)
])

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?
thanks
Sam.





reply via email to

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