36f75c9899d082168b8e4eb1b8671a22075ce3e2
[openafs.git] / src / cf / have-struct-field.m4
1 dnl Borrowed from Heimdal, but renamed as I don't think we
2 dnl should be shipping AC_ macros.
3
4 AC_DEFUN([OPENAFS_HAVE_STRUCT_FIELD], [
5 define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
6 AC_CACHE_CHECK([for $2 in $1], cache_val,[
7 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]],
8         [[$1 x; memset(&x, 0, sizeof(x)); x.$2]])],
9         [cache_val=yes],
10         [cache_val=no])
11 ])
12 if test "$cache_val" = yes; then
13         define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
14         AC_DEFINE(foo, 1, [Define if $1 has field $2.])
15         undefine([foo])
16 fi
17 undefine([cache_val])
18 ])
19