1dnl ######################################################################
2dnl Compile a program with <any>FS headers to try and find a feature.
3dnl The headers part are fixed.  Only three arguments are allowed:
4dnl [$1] is the program to compile (2nd arg to AC_TRY_COMPILE)
5dnl [$2] action to take if the program compiled (3rd arg to AC_TRY_COMPILE)
6dnl [$3] action to take if program did not compile (4rd arg to AC_TRY_COMPILE)
7AC_DEFUN([AC_TRY_COMPILE_ANYFS],
8[# try to compile a program which may have a definition for a structure
9AC_TRY_COMPILE(
10[
11#ifdef HAVE_SYS_TYPES_H
12# include <sys/types.h>
13#endif /* HAVE_SYS_TYPES_H */
14#ifdef HAVE_SYS_ERRNO_H
15# include <sys/errno.h>
16#endif /* HAVE_SYS_ERRNO_H */
17#ifdef HAVE_SYS_PARAM_H
18# include <sys/param.h>
19#endif /* HAVE_SYS_PARAM_H */
20
21#if TIME_WITH_SYS_TIME
22# include <sys/time.h>
23# include <time.h>
24#else /* not TIME_WITH_SYS_TIME */
25# if HAVE_SYS_TIME_H
26#  include <sys/time.h>
27# else /* not HAVE_SYS_TIME_H */
28#  include <time.h>
29# endif /* not HAVE_SYS_TIME_H */
30#endif /* not TIME_WITH_SYS_TIME */
31
32#ifdef HAVE_NETINET_IN_H
33# include <netinet/in.h>
34#endif /* HAVE_NETINET_IN_H */
35#ifdef HAVE_SYS_TIUSER_H
36# include <sys/tiuser.h>
37#endif /* HAVE_SYS_TIUSER_H */
38
39#ifdef HAVE_SYS_MOUNT_H
40# ifndef NFSCLIENT
41#  define NFSCLIENT
42# endif /* not NFSCLIENT */
43# ifndef PCFS
44#  define PCFS
45# endif /* not PCFS */
46# ifndef LOFS
47#  define LOFS
48# endif /* not LOFS */
49# ifndef RFS
50#  define RFS
51# endif /* not RFS */
52# ifndef MSDOSFS
53#  define MSDOSFS
54# endif /* not MSDOSFS */
55# ifndef MFS
56#  define MFS 1
57# endif /* not MFS */
58# ifndef CD9660
59#  define CD9660
60# endif /* not CD9660 */
61# ifndef NFS
62#  define NFS
63# endif /* not NFS */
64# include <sys/mount.h>
65#endif /* HAVE_SYS_MOUNT_H */
66
67#ifdef HAVE_SYS_VMOUNT_H
68# include <sys/vmount.h>
69#endif /* HAVE_SYS_VMOUNT_H */
70
71/*
72 * There is no point in including this on a glibc2 system
73 * we're only asking for trouble
74 */
75#if defined HAVE_LINUX_FS_H && (!defined __GLIBC__ || __GLIBC__ < 2)
76/*
77 * There's a conflict of definitions on redhat alpha linux between
78 * <netinet/in.h> and <linux/fs.h>.
79 * Also a conflict in definitions of ntohl/htonl in RH-5.1 sparc64
80 * between <netinet/in.h> and <linux/byteorder/generic.h> (2.1 kernels).
81 */
82# ifdef HAVE_SOCKETBITS_H
83#  define _LINUX_SOCKET_H
84#  undef BLKFLSBUF
85#  undef BLKGETSIZE
86#  undef BLKRAGET
87#  undef BLKRASET
88#  undef BLKROGET
89#  undef BLKROSET
90#  undef BLKRRPART
91#  undef MS_MGC_VAL
92#  undef MS_RMT_MASK
93# endif /* HAVE_SOCKETBITS_H */
94# ifdef HAVE_LINUX_POSIX_TYPES_H
95#  include <linux/posix_types.h>
96# endif /* HAVE_LINUX_POSIX_TYPES_H */
97# ifndef _LINUX_BYTEORDER_GENERIC_H
98#  define _LINUX_BYTEORDER_GENERIC_H
99# endif /* _LINUX_BYTEORDER_GENERIC_H */
100# ifndef _LINUX_STRING_H_
101#  define _LINUX_STRING_H_
102# endif /* not _LINUX_STRING_H_ */
103# ifdef HAVE_LINUX_KDEV_T_H
104#  define __KERNEL__
105#  include <linux/kdev_t.h>
106#  undef __KERNEL__
107# endif /* HAVE_LINUX_KDEV_T_H */
108# ifdef HAVE_LINUX_LIST_H
109#  define __KERNEL__
110#  include <linux/list.h>
111#  undef __KERNEL__
112# endif /* HAVE_LINUX_LIST_H */
113# include <linux/fs.h>
114#endif /* HAVE_LINUX_FS_H && (!__GLIBC__ || __GLIBC__ < 2) */
115
116#ifdef HAVE_SYS_FS_AUTOFS_H
117# include <sys/fs/autofs.h>
118#endif /* HAVE_SYS_FS_AUTOFS_H */
119#ifdef HAVE_SYS_FS_CACHEFS_FS_H
120# include <sys/fs/cachefs_fs.h>
121#endif /* HAVE_SYS_FS_CACHEFS_FS_H */
122
123#ifdef HAVE_SYS_FS_PC_FS_H
124# include <sys/fs/pc_fs.h>
125#endif /* HAVE_SYS_FS_PC_FS_H */
126#ifdef HAVE_MSDOSFS_MSDOSFSMOUNT_H
127# include <msdosfs/msdosfsmount.h>
128#endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */
129#ifdef HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H
130# include <fs/msdosfs/msdosfsmount.h>
131#endif /* HAVE_FS_MSDOSFS_MSDOSFSMOUNT_H */
132
133#ifdef HAVE_SYS_FS_TMP_H
134# include <sys/fs/tmp.h>
135#endif /* HAVE_SYS_FS_TMP_H */
136#ifdef HAVE_FS_TMPFS_TMPFS_ARGS_H
137# include <fs/tmpfs/tmpfs_args.h>
138#endif /* HAVE_FS_TMPFS_TMPFS_ARGS_H */
139
140#ifdef HAVE_UFS_UFS_MOUNT_H
141# include <ufs/ufs_mount.h>
142#endif /* HAVE_UFS_UFS_MOUNT_H */
143#ifdef HAVE_UFS_UFS_UFSMOUNT_H
144# ifndef MAXQUOTAS
145#  define MAXQUOTAS     2
146# endif /* not MAXQUOTAS */
147struct netexport { int this_is_SO_wrong; }; /* for bsdi-2.1 */
148/* netbsd-1.4 does't protect <ufs/ufs/ufsmount.h> */
149# ifndef _UFS_UFS_UFSMOUNT_H
150#  include <ufs/ufs/ufsmount.h>
151#  define _UFS_UFS_UFSMOUNT_H
152# endif /* not _UFS_UFS_UFSMOUNT_H */
153#endif /* HAVE_UFS_UFS_UFSMOUNT_H */
154#ifdef HAVE_SYS_FS_UFS_MOUNT_H
155# include <sys/fs/ufs_mount.h>
156#endif /* HAVE_SYS_FS_UFS_MOUNT_H */
157#ifdef HAVE_SYS_FS_EFS_CLNT_H
158# include <sys/fs/efs_clnt.h>
159#endif /* HAVE_SYS_FS_EFS_CLNT_H */
160#ifdef HAVE_FS_EFS_EFS_MOUNT_H
161# include <fs/efs/efs_mount.h>
162#endif /* HAVE_FS_EFS_EFS_MOUNT_H */
163#ifdef HAVE_SYS_FS_XFS_CLNT_H
164# include <sys/fs/xfs_clnt.h>
165#endif /* HAVE_SYS_FS_XFS_CLNT_H */
166
167#ifdef HAVE_CDFS_CDFS_MOUNT_H
168# include <cdfs/cdfs_mount.h>
169#endif /* HAVE_CDFS_CDFS_MOUNT_H */
170#ifdef HAVE_HSFS_HSFS_H
171# include <hsfs/hsfs.h>
172#endif /* HAVE_HSFS_HSFS_H */
173#ifdef HAVE_CDFS_CDFSMOUNT_H
174# include <cdfs/cdfsmount.h>
175#endif /* HAVE_CDFS_CDFSMOUNT_H */
176#ifdef HAVE_ISOFS_CD9660_CD9660_MOUNT_H
177# include <isofs/cd9660/cd9660_mount.h>
178#endif /* HAVE_ISOFS_CD9660_CD9660_MOUNT_H */
179
180#ifdef HAVE_FS_UDF_UDF_MOUNT_H
181# include <fs/udf/udf_mount.h>
182#endif /* HAVE_FS_UDF_UDF_MOUNT_H */
183], [$1], [$2], [$3])
184])
185dnl ======================================================================
186