Include sys/param.h. NetBSD 1.3.1 requires this
[gnulib.git] / m4 / fstypename.m4
1 #serial 1
2
3 dnl From Jim Meyering.
4 dnl
5 dnl See if struct statfs has the f_fstypename member.
6 dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS.
7 dnl
8
9 AC_DEFUN(jm_FSTYPENAME,
10   [
11     AC_CACHE_CHECK([for f_fstypename in struct statfs],
12                    fu_cv_sys_f_fstypename_in_statfs,
13       [
14         AC_TRY_COMPILE(
15           [
16 #include <sys/param.h>
17 #include <sys/types.h>
18 #include <sys/mount.h>
19           ],
20           [struct statfs s; int i = sizeof s.f_fstypename;],
21           fu_cv_sys_f_fstypename_in_statfs=yes,
22           fu_cv_sys_f_fstypename_in_statfs=no
23         )
24       ]
25     )
26
27     if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
28       if test x = y; then
29         # This code is deliberately never run via ./configure.
30         # FIXME: this is a hack to make autoheader put the corresponding
31         # HAVE_* undef for this symbol in config.h.in.  This saves me the
32         # trouble of having to maintain the #undef in acconfig.h manually.
33         AC_CHECK_FUNCS(F_FSTYPENAME_IN_STATFS)
34       fi
35       # Defining it this way (rather than via AC_DEFINE) short-circuits the
36       # autoheader check -- autoheader doesn't know it's already been taken
37       # care of by the hack above.
38       ac_kludge=HAVE_F_FSTYPENAME_IN_STATFS
39       AC_DEFINE_UNQUOTED($ac_kludge)
40     fi
41   ]
42 )