heimdal Extend the 'hdb as a keytab' code [HEIMDAL-600]
[heimdal.git] / cf / check-var.m4
blobf81f3524c15931415b84d191b537b8613e802575
1 dnl $Id$
2 dnl
3 dnl rk_CHECK_VAR(variable, includes)
4 AC_DEFUN([rk_CHECK_VAR], [
5 AC_MSG_CHECKING(for $1)
6 AC_CACHE_VAL(ac_cv_var_$1, [
7 m4_ifval([$2],[
8         AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2
9         void * foo(void) { return &$1; }]],[[foo()]])],
10             [ac_cv_var_$1=yes],[ac_cv_var_$1=no])])
11 if test "$ac_cv_var_$1" != yes ; then
12 AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int $1;
13 int foo(void) { return $1; }]],[[foo()]])],
14             [ac_cv_var_$1=yes],[ac_cv_var_$1=no])
17 ac_foo=`eval echo \\$ac_cv_var_$1`
18 AC_MSG_RESULT($ac_foo)
19 if test "$ac_foo" = yes; then
20         AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]$1), 1, 
21                 [Define if you have the `]$1[' variable.])
22         m4_ifval([$2], AC_CHECK_DECLS([$1],[],[],[$2]))
26 AC_WARNING_ENABLE([obsolete])
27 AU_DEFUN([AC_CHECK_VAR], [rk_CHECK_VAR([$2], [$1])], [foo])