Merge from vendor branch NTPD:
[dragonfly.git] / crypto / heimdal / cf / check-declaration.m4
1 dnl $Id: check-declaration.m4,v 1.3 1999/03/01 13:03:08 joda Exp $
2 dnl
3 dnl
4 dnl Check if we need the declaration of a variable
5 dnl
6
7 dnl AC_HAVE_DECLARATION(includes, variable)
8 AC_DEFUN(AC_CHECK_DECLARATION, [
9 AC_MSG_CHECKING([if $2 is properly declared])
10 AC_CACHE_VAL(ac_cv_var_$2_declaration, [
11 AC_TRY_COMPILE([$1
12 extern struct { int foo; } $2;],
13 [$2.foo = 1;],
14 eval "ac_cv_var_$2_declaration=no",
15 eval "ac_cv_var_$2_declaration=yes")
16 ])
17
18 define(foo, [HAVE_]translit($2, [a-z], [A-Z])[_DECLARATION])
19
20 AC_MSG_RESULT($ac_cv_var_$2_declaration)
21 if eval "test \"\$ac_cv_var_$2_declaration\" = yes"; then
22         AC_DEFINE(foo, 1, [define if your system declares $2])
23 fi
24 undefine([foo])
25 ])