I perform some checks during configure, which i set up with autoconf using the AC_CACHE_CHECK macro. Some checks are critical, so if they donÄt pass, I want configure to fail. How can I achieve this?
Thanks, Steffen
Not sure what you mean. Do you want to abort if the result is not cached? Or, if the result is not cached, do you want to attempt to assign a value but abort if unsuccesful? For the latter, just do:
# Replace 3rd argument with commands to assign the cache variable
# See autoconf documentation for how to name the cache variable
AC_CACHE_CHECK([myvariable], [sss_cv_type_myvar], [sss_cv_type_myvar=yes])
myvariable=$sss_cv_type_myvar
AS_IF([test x"$myvariable" != xyes],[AC_MSG_ERROR(
[myvariable not yes])])
If you want to abort merely because the variable is not cached, you could put an exit
in the 3rd argument to AC_CACHE_CHECK
. The commands in that option are used to assign the cache variable, and are not supposed to have side effects. Exiting the configure script is definitely a side effect, but that may be the behavior you want.