autoconf
[Top][All Lists]
Advanced

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

Re: How to use cache variables


From: Lars Hecking
Subject: Re: How to use cache variables
Date: Tue, 5 Feb 2002 17:26:10 +0000
User-agent: Mutt/1.5.0i

John D. Burger writes:
> I have what I think is a style question:
> 
> If I want to do something with the results of autoconf tests in my
> configure script, what's the best way to check these results?  For
> instance, say I'd like to do this:
> 
>   AC_CHECK_LIB(norman, snStackPush)
>   AC_CHECK_HEADERS([norman.h])
> 
>   # Gripe if neither the library nor the header is around
> 
>   if test $SOME_VAR = no && test $SOME_OTHER_VAR = no; then
>     AC_MSG_WARN([$PACKAGE requires libnorman])
>   fi
> 
> My question is, are SOME_VAR and SOME_OTHER_VAR things I should set
> myself in the optional arguments to the AC_CHECK macros, or should I use
> cache variables?  I'm uneasy about using the latter, because I've had
> trouble predicting the names of some macros' cache vars, and having to
> slog through the generated configure
> script makes me think I'm doing something wrong.

 The names are fairly obvious, and there's a section in the autoconf manual
 that explains them (Results of Tests->Caching Results->Cache Variable Names).

 But you don't need to do it this way.

 If you check the documentation for AC_CHECK_LIB() and AC_CHECK_HEADERS(),
 you'll find that they can be used to execute stuff if your particular
 header/lib is not found. E.g.

 AC_CHECK_LIB(norman, snStackPush,
  AC_CHECK_HEADERS(norman.h,,AC_MSG_WARN(norman.h not found)),
  AC_MSG_WARN(snStackPush not found in libnorman)
 )

 You can do more in the ACTION-IF-FOUND/ACTION-IF-NOT-FOUND parts,
 but then you should enclose these parts in [], resp.




reply via email to

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