.
[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/types.h>
17 #include <sys/mount.h>
18           ],
19           [struct statfs s; int i = sizeof s.f_fstypename;],
20           fu_cv_sys_f_fstypename_in_statfs=yes,
21           fu_cv_sys_f_fstypename_in_statfs=no
22         )
23       ]
24     )
25
26     if test $fu_cv_sys_f_fstypename_in_statfs = yes; then
27       if test x = y; then
28         # This code is deliberately never run via ./configure.
29         # FIXME: this is a hack to make autoheader put the corresponding
30         # HAVE_* undef for this symbol in config.h.in.  This saves me the
31         # trouble of having to maintain the #undef in acconfig.h manually.
32         AC_CHECK_FUNCS(F_FSTYPENAME_IN_STATFS)
33       fi
34       # Defining it this way (rather than via AC_DEFINE) short-circuits the
35       # autoheader check -- autoheader doesn't know it's already been taken
36       # care of by the hack above.
37       ac_kludge=HAVE_F_FSTYPENAME_IN_STATFS
38       AC_DEFINE_UNQUOTED($ac_kludge)
39     fi
40   ]
41 )