1dnl Id
2dnl
3dnl rk_CHECK_VAR(variable, includes)
4AC_DEFUN([rk_CHECK_VAR], [
5AC_MSG_CHECKING(for $1)
6AC_CACHE_VAL(ac_cv_var_$1, [
7m4_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])])
11if test "$ac_cv_var_$1" != yes ; then
12AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2
13extern int $1;
14int foo(void) { return $1; }]],[[foo()]])],
15	    [ac_cv_var_$1=yes],[ac_cv_var_$1=no])
16fi
17])
18ac_foo=`eval echo \\$ac_cv_var_$1`
19AC_MSG_RESULT($ac_foo)
20if test "$ac_foo" = yes; then
21	AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]$1), 1,
22		[Define if you have the `]$1[' variable.])
23	m4_ifval([$2], AC_CHECK_DECLS([$1],[],[],[$2]))
24fi
25])
26
27AC_WARNING_ENABLE([obsolete])
28AU_DEFUN([AC_CHECK_VAR], [rk_CHECK_VAR([$2], [$1])], [foo])
29