xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/struct_field_nfs_fh.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1dnl ######################################################################
2dnl Find the name of the nfs filehandle field in nfs_args_t.
3AC_DEFUN([AMU_STRUCT_FIELD_NFS_FH],
4[
5dnl make sure this is called before macros which depend on it
6AC_BEFORE([$0], [AC_TYPE_NFS_FH])
7AC_CACHE_CHECK(for the name of the nfs filehandle field in nfs_args_t,
8ac_cv_struct_field_nfs_fh,
9[
10# set to a default value
11ac_cv_struct_field_nfs_fh=notfound
12# look for name "fh" (most systems)
13if test "$ac_cv_struct_field_nfs_fh" = notfound
14then
15AC_TRY_COMPILE_NFS(
16[ nfs_args_t nat;
17  char *cp = (char *) &(nat.fh);
18], ac_cv_struct_field_nfs_fh=fh, ac_cv_struct_field_nfs_fh=notfound)
19fi
20
21# look for name "root" (for example Linux)
22if test "$ac_cv_struct_field_nfs_fh" = notfound
23then
24AC_TRY_COMPILE_NFS(
25[ nfs_args_t nat;
26  char *cp = (char *) &(nat.root);
27], ac_cv_struct_field_nfs_fh=root, ac_cv_struct_field_nfs_fh=notfound)
28fi
29])
30if test "$ac_cv_struct_field_nfs_fh" != notfound
31then
32  AC_DEFINE_UNQUOTED(NFS_FH_FIELD, $ac_cv_struct_field_nfs_fh)
33fi
34])
35dnl ======================================================================
36