am_defs.h revision 42633
138494Sobrien/*
238494Sobrien * Copyright (c) 1997-1998 Erez Zadok
338494Sobrien * Copyright (c) 1990 Jan-Simon Pendry
438494Sobrien * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
538494Sobrien * Copyright (c) 1990 The Regents of the University of California.
638494Sobrien * All rights reserved.
738494Sobrien *
838494Sobrien * This code is derived from software contributed to Berkeley by
938494Sobrien * Jan-Simon Pendry at Imperial College, London.
1038494Sobrien *
1138494Sobrien * Redistribution and use in source and binary forms, with or without
1238494Sobrien * modification, are permitted provided that the following conditions
1338494Sobrien * are met:
1438494Sobrien * 1. Redistributions of source code must retain the above copyright
1538494Sobrien *    notice, this list of conditions and the following disclaimer.
1638494Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1738494Sobrien *    notice, this list of conditions and the following disclaimer in the
1838494Sobrien *    documentation and/or other materials provided with the distribution.
1938494Sobrien * 3. All advertising materials mentioning features or use of this software
2042633Sobrien *    must display the following acknowledgment:
2138494Sobrien *      This product includes software developed by the University of
2238494Sobrien *      California, Berkeley and its contributors.
2338494Sobrien * 4. Neither the name of the University nor the names of its contributors
2438494Sobrien *    may be used to endorse or promote products derived from this software
2538494Sobrien *    without specific prior written permission.
2638494Sobrien *
2738494Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2838494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2938494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3038494Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3138494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3238494Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3338494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3438494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3538494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3638494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3738494Sobrien * SUCH DAMAGE.
3838494Sobrien *
3938494Sobrien *      %W% (Berkeley) %G%
4038494Sobrien *
4142633Sobrien * $Id: am_defs.h,v 1.3 1998/11/14 03:13:32 obrien Exp $
4238494Sobrien *
4338494Sobrien */
4438494Sobrien
4538494Sobrien/*
4638494Sobrien * Definitions that are not specific to the am-utils package, but
4738494Sobrien * are rather generic, and can be used elsewhere.
4838494Sobrien */
4938494Sobrien
5038494Sobrien#ifndef _AM_DEFS_H
5138494Sobrien#define _AM_DEFS_H
5238494Sobrien
5338494Sobrien/*
5438494Sobrien * Actions to take if ANSI C.
5538494Sobrien */
5638494Sobrien#if STDC_HEADERS
5738494Sobrien# include <string.h>
5838494Sobrien/* for function prototypes */
5938494Sobrien# define P(x) x
6038494Sobrien# define P_void void
6138494Sobrien#else /* not STDC_HEADERS */
6238494Sobrien/* empty function prototypes */
6338494Sobrien# define P(x) ()
6438494Sobrien# define P_void
6538494Sobrien# ifndef HAVE_STRCHR
6638494Sobrien#  define strchr index
6738494Sobrien#  define strrchr rindex
6838494Sobrien# endif /* not HAVE_STRCHR */
6938494Sobrienchar *strchr(), *strrchr(), *strdup();
7038494Sobrien#endif /* not STDC_HEADERS */
7138494Sobrien
7238494Sobrien/*
7338494Sobrien * How to handle signals of any type
7438494Sobrien */
7538494Sobrien#ifdef HAVE_SYS_WAIT_H
7638494Sobrien# include <sys/wait.h>
7738494Sobrien#endif /* HAVE_SYS_WAIT_H */
7838494Sobrien#ifndef WEXITSTATUS
7938494Sobrien# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
8038494Sobrien#endif /* not WEXITSTATUS */
8138494Sobrien#ifndef WIFEXITED
8238494Sobrien# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
8338494Sobrien#endif /* not WIFEXITED */
8438494Sobrien
8538494Sobrien/*
8638494Sobrien * Actions to take regarding <time.h> and <sys/time.h>.
8738494Sobrien */
8838494Sobrien#if TIME_WITH_SYS_TIME
8938494Sobrien# include <sys/time.h>
9038494Sobrien# include <time.h>
9138494Sobrien#else /* not TIME_WITH_SYS_TIME */
9238494Sobrien# if HAVE_SYS_TIME_H
9338494Sobrien#  include <sys/time.h>
9438494Sobrien# else /* not HAVE_SYS_TIME_H */
9538494Sobrien#  include <time.h>
9638494Sobrien# endif /* not HAVE_SYS_TIME_H */
9738494Sobrien#endif /* not TIME_WITH_SYS_TIME */
9838494Sobrien
9938494Sobrien/*
10038494Sobrien * Actions to take if <machine/endian.h> exists.
10138494Sobrien */
10238494Sobrien#ifdef HAVE_MACHINE_ENDIAN_H
10338494Sobrien# include <machine/endian.h>
10438494Sobrien#endif /* HAVE_MACHINE_ENDIAN_H */
10538494Sobrien
10638494Sobrien/*
10738494Sobrien * Big-endian or little-endian?
10838494Sobrien */
10938494Sobrien#ifdef WORDS_BIGENDIAN
11038494Sobrien# define ARCH_ENDIAN "big"
11138494Sobrien#else /* not WORDS_BIGENDIAN */
11238494Sobrien# define ARCH_ENDIAN "little"
11338494Sobrien#endif /* not WORDS_BIGENDIAN */
11438494Sobrien
11538494Sobrien/*
11638494Sobrien * Actions to take if HAVE_SYS_TYPES_H is defined.
11738494Sobrien */
11838494Sobrien#if HAVE_SYS_TYPES_H
11938494Sobrien# include <sys/types.h>
12038494Sobrien#endif /* HAVE_SYS_TYPES_H */
12138494Sobrien
12238494Sobrien/*
12338494Sobrien * Actions to take if HAVE_UNISTD_H is defined.
12438494Sobrien */
12538494Sobrien#if HAVE_UNISTD_H
12638494Sobrien# include <unistd.h>
12738494Sobrien#endif /* HAVE_UNISTD_H */
12838494Sobrien
12938494Sobrien/* after <unistd.h>, check if this is a POSIX.1 system */
13038494Sobrien#ifdef _POSIX_VERSION
13138494Sobrien/* Code for POSIX.1 systems. */
13238494Sobrien#endif /* _POSIX_VERSION */
13338494Sobrien
13438494Sobrien/*
13538494Sobrien * Variable length argument lists.
13638494Sobrien * Must use only one of the two!
13738494Sobrien */
13838494Sobrien#ifdef HAVE_STDARG_H
13938494Sobrien# include <stdarg.h>
14038494Sobrien/*
14138494Sobrien * On Solaris 2.6, <sys/varargs.h> is included in <sys/fs/autofs.h>
14238494Sobrien * So this ensures that only one is included.
14338494Sobrien */
14438494Sobrien# ifndef _SYS_VARARGS_H
14538494Sobrien#  define _SYS_VARARGS_H
14638494Sobrien# endif /* not _SYS_VARARGS_H */
14738494Sobrien#else /* not HAVE_STDARG_H */
14838494Sobrien# ifdef HAVE_VARARGS_H
14938494Sobrien#  include <varargs.h>
15038494Sobrien# endif /* HAVE_VARARGS_H */
15138494Sobrien#endif /* not HAVE_STDARG_H */
15238494Sobrien
15338494Sobrien/*
15438494Sobrien * Pick the right header file and macros for directory processing functions.
15538494Sobrien */
15638494Sobrien#if HAVE_DIRENT_H
15738494Sobrien# include <dirent.h>
15838494Sobrien# define NAMLEN(dirent) strlen((dirent)->d_name)
15938494Sobrien#else /* not HAVE_DIRENT_H */
16038494Sobrien# define dirent direct
16138494Sobrien# define NAMLEN(dirent) (dirent)->d_namlen
16238494Sobrien# if HAVE_SYS_NDIR_H
16338494Sobrien#  include <sys/ndir.h>
16438494Sobrien# endif /* HAVE_SYS_NDIR_H */
16538494Sobrien# if HAVE_SYS_DIR_H
16638494Sobrien#  include <sys/dir.h>
16738494Sobrien# endif /* HAVE_SYS_DIR_H */
16838494Sobrien# if HAVE_NDIR_H
16938494Sobrien#  include <ndir.h>
17038494Sobrien# endif /* HAVE_NDIR_H */
17138494Sobrien#endif /* not HAVE_DIRENT_H */
17238494Sobrien
17338494Sobrien/*
17438494Sobrien * Actions to take if HAVE_FCNTL_H is defined.
17538494Sobrien */
17638494Sobrien#if HAVE_FCNTL_H
17738494Sobrien# include <fcntl.h>
17838494Sobrien#endif /* HAVE_FCNTL_H */
17938494Sobrien
18038494Sobrien/*
18138494Sobrien * Actions to take if HAVE_MEMORY_H is defined.
18238494Sobrien */
18338494Sobrien#if HAVE_MEMORY_H
18438494Sobrien# include <memory.h>
18538494Sobrien#endif /* HAVE_MEMORY_H */
18638494Sobrien
18738494Sobrien/*
18838494Sobrien * Actions to take if HAVE_SYS_FILE_H is defined.
18938494Sobrien */
19038494Sobrien#if HAVE_SYS_FILE_H
19138494Sobrien# include <sys/file.h>
19238494Sobrien#endif /* HAVE_SYS_FILE_H */
19338494Sobrien
19438494Sobrien/*
19538494Sobrien * Actions to take if HAVE_SYS_IOCTL_H is defined.
19638494Sobrien */
19738494Sobrien#if HAVE_SYS_IOCTL_H
19838494Sobrien# include <sys/ioctl.h>
19938494Sobrien#endif /* HAVE_SYS_IOCTL_H */
20038494Sobrien
20138494Sobrien/*
20238494Sobrien * Actions to take if HAVE_SYSLOG_H or HAVE_SYS_SYSLOG_H is defined.
20338494Sobrien */
20438494Sobrien#ifdef HAVE_SYSLOG_H
20538494Sobrien# include <syslog.h>
20638494Sobrien#else /* not HAVE_SYSLOG_H */
20738494Sobrien# if HAVE_SYS_SYSLOG_H
20838494Sobrien#  include <sys/syslog.h>
20938494Sobrien# endif /* HAVE_SYS_SYSLOG_H */
21038494Sobrien#endif /* HAVE_SYSLOG_H */
21138494Sobrien
21238494Sobrien/*
21338494Sobrien * Actions to take if <sys/param.h> exists.
21438494Sobrien */
21538494Sobrien#ifdef HAVE_SYS_PARAM_H
21638494Sobrien# include <sys/param.h>
21738494Sobrien#endif /* HAVE_SYS_PARAM_H */
21838494Sobrien
21938494Sobrien/*
22038494Sobrien * Actions to take if <sys/socket.h> exists.
22138494Sobrien */
22238494Sobrien#ifdef HAVE_SYS_SOCKET_H
22338494Sobrien# include <sys/socket.h>
22438494Sobrien#endif /* HAVE_SYS_SOCKET_H */
22538494Sobrien
22638494Sobrien/*
22738494Sobrien * Actions to take if <rpc/rpc.h> exists.
22838494Sobrien */
22938494Sobrien#ifdef HAVE_RPC_RPC_H
23038494Sobrien/*
23138494Sobrien * Turn on PORTMAP, so that additional header files would get included
23238494Sobrien * and the important definition for UDPMSGSIZE is included too.
23338494Sobrien */
23438494Sobrien# ifndef PORTMAP
23538494Sobrien#  define PORTMAP
23638494Sobrien# endif /* not PORTMAP */
23738494Sobrien# include <rpc/rpc.h>
23838494Sobrien# ifndef XDRPROC_T_TYPE
23938494Sobrientypedef bool_t (*xdrproc_t) __P ((XDR *, __ptr_t, ...));
24038494Sobrien# endif /* not XDRPROC_T_TYPE */
24138494Sobrien#endif /* HAVE_RPC_RPC_H */
24238494Sobrien
24338494Sobrien/*
24438494Sobrien * Actions to take if <rpc/types.h> exists.
24538494Sobrien */
24638494Sobrien#ifdef HAVE_RPC_TYPES_H
24738494Sobrien# include <rpc/types.h>
24838494Sobrien#endif /* HAVE_RPC_TYPES_H */
24938494Sobrien
25038494Sobrien/*
25138494Sobrien * Actions to take if <rpc/xdr.h> exists.
25238494Sobrien */
25338494Sobrien/* Prevent multiple inclusion on Ultrix 4 */
25438494Sobrien#if defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__)
25538494Sobrien# include <rpc/xdr.h>
25638494Sobrien#endif /* defined(HAVE_RPC_XDR_H) && !defined(__XDR_HEADER__) */
25738494Sobrien
25838494Sobrien/*
25938494Sobrien * Actions to take if <malloc.h> exists.
26038494Sobrien */
26138494Sobrien#ifdef HAVE_MALLOC_H
26238494Sobrien# include <malloc.h>
26338494Sobrien#endif /* HAVE_MALLOC_H */
26438494Sobrien
26538494Sobrien/*
26638494Sobrien * Actions to take if <mntent.h> exists.
26738494Sobrien */
26838494Sobrien#ifdef HAVE_MNTENT_H
26938494Sobrien/* some systems need <stdio.h> before <mntent.h> is included */
27038494Sobrien# ifdef HAVE_STDIO_H
27138494Sobrien#  include <stdio.h>
27238494Sobrien# endif /* HAVE_STDIO_H */
27338494Sobrien# include <mntent.h>
27438494Sobrien#endif /* HAVE_MNTENT_H */
27538494Sobrien
27638494Sobrien/*
27738494Sobrien * Actions to take if <sys/errno.h> exists.
27838494Sobrien */
27938494Sobrien#ifdef HAVE_SYS_ERRNO_H
28038494Sobrien# include <sys/errno.h>
28138494Sobrienextern int errno;
28238494Sobrien#endif /* HAVE_SYS_ERRNO_H */
28338494Sobrien
28438494Sobrien/*
28538494Sobrien * Actions to take if <sys/fsid.h> exists.
28638494Sobrien */
28738494Sobrien#ifdef HAVE_SYS_FSID_H
28838494Sobrien# include <sys/fsid.h>
28938494Sobrien#endif /* HAVE_SYS_FSID_H */
29038494Sobrien
29138494Sobrien/*
29238494Sobrien * Actions to take if <sys/utsname.h> exists.
29338494Sobrien */
29438494Sobrien#ifdef HAVE_SYS_UTSNAME_H
29538494Sobrien# include <sys/utsname.h>
29638494Sobrien#endif /* HAVE_SYS_UTSNAME_H */
29738494Sobrien
29838494Sobrien/*
29938494Sobrien * Actions to take if <sys/mntent.h> exists.
30038494Sobrien */
30138494Sobrien#ifdef HAVE_SYS_MNTENT_H
30238494Sobrien# include <sys/mntent.h>
30338494Sobrien#endif /* HAVE_SYS_MNTENT_H */
30438494Sobrien
30538494Sobrien/*
30638494Sobrien * Actions to take if <ndbm.h> exists.
30738494Sobrien * Should be included before <rpcsvc/yp_prot.h> because on some systems
30838494Sobrien * like Linux, it also defines "struct datum".
30938494Sobrien */
31038494Sobrien#ifdef HAVE_NDBM_H
31138494Sobrien# include <ndbm.h>
31238494Sobrien# ifndef DATUM
31338494Sobrien/* ensure that struct datum is not included again from <rpcsvc/yp_prot.h> */
31438494Sobrien#  define DATUM
31538494Sobrien# endif /* not DATUM */
31638494Sobrien#endif /* HAVE_NDBM_H */
31738494Sobrien
31838494Sobrien/*
31938494Sobrien * Actions to take if <net/errno.h> exists.
32038494Sobrien */
32138494Sobrien#ifdef HAVE_NET_ERRNO_H
32238494Sobrien# include <net/errno.h>
32338494Sobrien#endif /* HAVE_NET_ERRNO_H */
32438494Sobrien
32538494Sobrien/*
32638494Sobrien * Actions to take if <net/if.h> exists.
32738494Sobrien */
32838494Sobrien#ifdef HAVE_NET_ROUTE_H
32938494Sobrien# include <net/route.h>
33038494Sobrien#endif /* HAVE_NET_ROUTE_H */
33138494Sobrien
33238494Sobrien/*
33338494Sobrien * Actions to take if <net/if.h> exists.
33438494Sobrien */
33538494Sobrien#ifdef HAVE_SYS_MBUF_H
33638494Sobrien# include <sys/mbuf.h>
33738494Sobrien/*
33838494Sobrien * OSF4 (DU-4.0) defines m_next and m_data also in <sys/mount> so I must
33938494Sobrien # undefine them here to avoid conflicts.
34038494Sobrien */
34138494Sobrien# ifdef m_next
34238494Sobrien#  undef m_next
34338494Sobrien# endif /* m_next */
34438494Sobrien# ifdef m_data
34538494Sobrien#  undef m_data
34638494Sobrien# endif /* m_data */
34738494Sobrien/*
34838494Sobrien * AIX 3 defines MFREE and m_flags also in <sys/mount>.
34938494Sobrien */
35038494Sobrien# ifdef m_flags
35138494Sobrien#  undef m_flags
35238494Sobrien# endif /* m_flags */
35338494Sobrien# ifdef MFREE
35438494Sobrien#  undef MFREE
35538494Sobrien# endif /* MFREE */
35638494Sobrien#endif /* HAVE_SYS_MBUF_H */
35738494Sobrien
35838494Sobrien/*
35938494Sobrien * Actions to take if <net/if.h> exists.
36038494Sobrien */
36138494Sobrien#ifdef HAVE_NET_IF_H
36238494Sobrien# include <net/if.h>
36338494Sobrien#endif /* HAVE_NET_IF_H */
36438494Sobrien
36538494Sobrien/*
36638494Sobrien * Actions to take if <netdb.h> exists.
36738494Sobrien */
36838494Sobrien#ifdef HAVE_NETDB_H
36938494Sobrien# include <netdb.h>
37038494Sobrien#endif /* HAVE_NETDB_H */
37138494Sobrien
37238494Sobrien/*
37338494Sobrien * Actions to take if <netdir.h> exists.
37438494Sobrien */
37538494Sobrien#ifdef HAVE_NETDIR_H
37638494Sobrien# include <netdir.h>
37738494Sobrien#endif /* HAVE_NETDIR_H */
37838494Sobrien
37938494Sobrien/*
38038494Sobrien * Actions to take if <net/if_var.h> exists.
38138494Sobrien */
38238494Sobrien#ifdef HAVE_NET_IF_VAR_H
38338494Sobrien# include <net/if_var.h>
38438494Sobrien#endif /* HAVE_NET_IF_VAR_H */
38538494Sobrien
38638494Sobrien/*
38738494Sobrien * Actions to take if <netinet/if_ether.h> exists.
38838494Sobrien */
38938494Sobrien#ifdef HAVE_NETINET_IF_ETHER_H
39038494Sobrien# include <netinet/if_ether.h>
39138494Sobrien#endif /* HAVE_NETINET_IF_ETHER_H */
39238494Sobrien
39338494Sobrien/*
39438494Sobrien * Actions to take if <netinet/in.h> exists.
39538494Sobrien */
39638494Sobrien#ifdef HAVE_NETINET_IN_H
39738494Sobrien# include <netinet/in.h>
39838494Sobrien#endif /* HAVE_NETINET_IN_H */
39938494Sobrien
40038494Sobrien/*
40138494Sobrien * Actions to take if <rpcsvc/yp_prot.h> exists.
40238494Sobrien */
40338494Sobrien#ifdef HAVE_RPCSVC_YP_PROT_H
40442633Sobrien# ifdef HAVE_BAD_HEADERS
40542633Sobrien/* avoid circular dependency in aix 4.3 with <rpcsvc/ypclnt.h> */
40642633Sobrienstruct ypall_callback;
40742633Sobrien# endif /* HAVE_BAD_HEADERS */
40838494Sobrien# include <rpcsvc/yp_prot.h>
40938494Sobrien#endif /* HAVE_RPCSVC_YP_PROT_H */
41038494Sobrien
41138494Sobrien/*
41238494Sobrien * Actions to take if <rpcsvc/ypclnt.h> exists.
41338494Sobrien */
41438494Sobrien#ifdef HAVE_RPCSVC_YPCLNT_H
41538494Sobrien# include <rpcsvc/ypclnt.h>
41638494Sobrien#endif /* HAVE_RPCSVC_YPCLNT_H */
41738494Sobrien
41838494Sobrien/*
41938494Sobrien * Actions to take if <sys/ucred.h> exists.
42038494Sobrien */
42138494Sobrien#ifdef HAVE_SYS_UCRED_H
42238494Sobrien# include <sys/ucred.h>
42338494Sobrien#endif /* HAVE_SYS_UCRED_H */
42438494Sobrien
42538494Sobrien
42638494Sobrien/*
42738494Sobrien * Actions to take if <sys/mount.h> exists.
42838494Sobrien */
42938494Sobrien#ifdef HAVE_SYS_MOUNT_H
43038494Sobrien/*
43138494Sobrien * Some operating systems must define these variables to get
43238494Sobrien * NFS and other definitions included.
43338494Sobrien */
43438494Sobrien# ifndef NFSCLIENT
43538494Sobrien#  define NFSCLIENT
43638494Sobrien# endif /* not NFSCLIENT */
43738494Sobrien# ifndef NFS
43838494Sobrien#  define NFS
43938494Sobrien# endif /* not NFS */
44038494Sobrien# ifndef PCFS
44138494Sobrien#  define PCFS
44238494Sobrien# endif /* not PCFS */
44338494Sobrien# ifndef LOFS
44438494Sobrien#  define LOFS
44538494Sobrien# endif /* not LOFS */
44638494Sobrien# ifndef RFS
44738494Sobrien#  define RFS
44838494Sobrien# endif /* not RFS */
44938494Sobrien# ifndef MSDOSFS
45038494Sobrien#  define MSDOSFS
45138494Sobrien# endif /* not MSDOSFS */
45238494Sobrien# ifndef MFS
45338494Sobrien#  define MFS
45438494Sobrien# endif /* not MFS */
45538494Sobrien# ifndef CD9660
45638494Sobrien#  define CD9660
45738494Sobrien# endif /* not CD9660 */
45838494Sobrien# ifndef NFS
45938494Sobrien#  define NFS
46038494Sobrien# endif /* not NFS */
46138494Sobrien# include <sys/mount.h>
46238494Sobrien#endif /* HAVE_SYS_MOUNT_H */
46338494Sobrien
46438494Sobrien#ifdef HAVE_SYS_VMOUNT_H
46538494Sobrien# include <sys/vmount.h>
46638494Sobrien#endif /* HAVE_SYS_VMOUNT_H */
46738494Sobrien
46838494Sobrien/*
46938494Sobrien * Actions to take if <linux/fs.h> exists.
47038494Sobrien */
47138494Sobrien#ifdef HAVE_LINUX_FS_H
47238494Sobrien/*
47338494Sobrien * There's a conflict of definitions on redhat alpha linux between
47438494Sobrien * <netinet/in.h> and <linux/fs.h>.
47538494Sobrien */
47638494Sobrien# ifdef HAVE_SOCKETBITS_H
47738494Sobrien/* conflicts with <socketbits.h> */
47838494Sobrien#  define _LINUX_SOCKET_H
47938494Sobrien#  undef BLKFLSBUF
48038494Sobrien#  undef BLKGETSIZE
48138494Sobrien#  undef BLKRAGET
48238494Sobrien#  undef BLKRASET
48338494Sobrien#  undef BLKROGET
48438494Sobrien#  undef BLKROSET
48538494Sobrien#  undef BLKRRPART
48638494Sobrien#  undef MS_MGC_VAL
48738494Sobrien#  undef MS_RMT_MASK
48838494Sobrien/* conflicts with <waitflags.h> */
48938494Sobrien#  undef WNOHANG
49038494Sobrien#  undef WUNTRACED
49138494Sobrien/* conflicts with <statfsbuf.h> */
49238494Sobrien#  define _SYS_STATFS_H
49338494Sobrien# endif /* HAVE_SOCKETBITS_H */
49441145Sobrien# ifdef HAVE_LINUX_POSIX_TYPES_H
49541145Sobrien#  include <linux/posix_types.h>
49641145Sobrien# endif /* HAVE_LINUX_POSIX_TYPES_H */
49741145Sobrien# ifndef _LINUX_BYTEORDER_GENERIC_H
49841145Sobrien#  define _LINUX_BYTEORDER_GENERIC_H
49941145Sobrien# endif /* _LINUX_BYTEORDER_GENERIC_H */
50041145Sobrien/* conflicts with <sys/mount.h> in 2.1 kernels */
50141145Sobrien# ifdef _SYS_MOUNT_H
50241145Sobrien#  ifdef BLOCK_SIZE
50341145Sobrien#   undef BLOCK_SIZE
50441145Sobrien#  endif /* BLOCK_SIZE */
50541145Sobrien# endif /* _SYS_MOUNT_H */
50638494Sobrien# include <linux/fs.h>
50738494Sobrien#endif /* HAVE_LINUX_FS_H */
50838494Sobrien
50938494Sobrien#ifdef HAVE_CDFS_CDFS_MOUNT_H
51038494Sobrien# include <cdfs/cdfs_mount.h>
51138494Sobrien#endif /* HAVE_CDFS_CDFS_MOUNT_H */
51238494Sobrien
51338494Sobrien#ifdef HAVE_CDFS_CDFSMOUNT_H
51438494Sobrien# include <cdfs/cdfsmount.h>
51538494Sobrien#endif /* HAVE_CDFS_CDFSMOUNT_H */
51638494Sobrien
51738494Sobrien/*
51838494Sobrien * Actions to take if <linux/auto_fs.h> exists.
51938494Sobrien */
52038494Sobrien#ifdef HAVE_LINUX_AUTO_FS_H
52138494Sobrien# include <linux/auto_fs.h>
52238494Sobrien#endif /* HAVE_LINUX_AUTO_FS_H */
52338494Sobrien
52438494Sobrien/*
52538494Sobrien * Actions to take if <sys/fs/autofs.h> exists.
52638494Sobrien */
52738494Sobrien#ifdef HAVE_SYS_FS_AUTOFS_H
52838494Sobrien# include <sys/fs/autofs.h>
52938494Sobrien#endif /* HAVE_SYS_FS_AUTOFS_H */
53038494Sobrien
53138494Sobrien/*
53238494Sobrien * Actions to take if <sys/fs/autofs_prot.h> exists.
53338494Sobrien */
53438494Sobrien#ifdef HAVE_SYS_FS_AUTOFS_PROT_H
53538494Sobrien# include <sys/fs/autofs_prot.h>
53638494Sobrien#endif /* HAVE_SYS_FS_AUTOFS_PROT_H */
53738494Sobrien
53838494Sobrien/*
53938494Sobrien * NFS PROTOCOL HEADER FILES:
54038494Sobrien */
54138494Sobrien
54238494Sobrien/*
54338494Sobrien * Actions to take if <nfs/export.h> exists.
54438494Sobrien */
54538494Sobrien#ifdef HAVE_NFS_EXPORT_H
54638494Sobrien# include <nfs/export.h>
54738494Sobrien#endif /* HAVE_NFS_EXPORT_H */
54838494Sobrien
54938494Sobrien/****************************************************************************
55038494Sobrien ** IMPORTANT!!!							   **
55138494Sobrien ** We always include am-util's amu_nfs_prot.h.				   **
55238494Sobrien ** That is actually defined in "conf/nfs_prot/nfs_prot_${host_os_name}.h" **
55338494Sobrien ****************************************************************************/
55438494Sobrien#include <amu_nfs_prot.h>
55538494Sobrien
55638494Sobrien/*
55738494Sobrien * DO NOT INCLUDE THESE FILES:
55838494Sobrien * They conflicts with other NFS headers and are generally not needed.
55938494Sobrien */
56038494Sobrien#ifdef DO_NOT_INCLUDE
56138494Sobrien# ifdef HAVE_NFS_NFS_CLNT_H
56238494Sobrien#  include <nfs/nfs_clnt.h>
56338494Sobrien# endif /* HAVE_NFS_NFS_CLNT_H */
56438494Sobrien# ifdef HAVE_LINUX_NFS_H
56538494Sobrien#  include <linux/nfs.h>
56638494Sobrien# endif /* HAVE_LINUX_NFS_H */
56738494Sobrien#endif /* DO NOT INCLUDE */
56838494Sobrien
56938494Sobrien/*
57038494Sobrien * Actions to take if one of the nfs headers exists.
57138494Sobrien */
57238494Sobrien#ifdef HAVE_NFS_NFS_GFS_H
57338494Sobrien# include <nfs/nfs_gfs.h>
57438494Sobrien#endif /* HAVE_NFS_NFS_GFS_H */
57538494Sobrien#ifdef HAVE_NFS_MOUNT_H
57638494Sobrien# include <nfs/mount.h>
57738494Sobrien#endif /* HAVE_NFS_MOUNT_H */
57838494Sobrien#ifdef HAVE_NFS_NFS_MOUNT_H_off
57938494Sobrien/* broken on netxtep3 (includes non-existing headers) */
58038494Sobrien# include <nfs/nfs_mount.h>
58138494Sobrien#endif /* HAVE_NFS_NFS_MOUNT_H */
58238494Sobrien#ifdef HAVE_NFS_PATHCONF_H
58338494Sobrien# include <nfs/pathconf.h>
58438494Sobrien#endif /* HAVE_NFS_PATHCONF_H */
58538494Sobrien#ifdef HAVE_SYS_FS_NFS_MOUNT_H
58638494Sobrien# include <sys/fs/nfs/mount.h>
58738494Sobrien#endif /* HAVE_SYS_FS_NFS_MOUNT_H */
58838494Sobrien#ifdef HAVE_SYS_FS_NFS_NFS_CLNT_H
58938494Sobrien# include <sys/fs/nfs/nfs_clnt.h>
59038494Sobrien#endif /* HAVE_SYS_FS_NFS_NFS_CLNT_H */
59138494Sobrien#ifdef HAVE_SYS_FS_NFS_CLNT_H
59238494Sobrien# include <sys/fs/nfs_clnt.h>
59338494Sobrien#endif /* HAVE_SYS_FS_NFS_CLNT_H */
59438494Sobrien#ifdef HAVE_LINUX_NFS_MOUNT_H
59538494Sobrien# include <linux/nfs_mount.h>
59638494Sobrien#endif /* HAVE_LINUX_NFS_MOUNT_H */
59738494Sobrien
59838494Sobrien/*
59938494Sobrien * Actions to take if <pwd.h> exists.
60038494Sobrien */
60138494Sobrien#ifdef HAVE_PWD_H
60238494Sobrien# include <pwd.h>
60338494Sobrien#endif /* HAVE_PWD_H */
60438494Sobrien
60538494Sobrien/*
60638494Sobrien * Actions to take if <hesiod.h> exists.
60738494Sobrien */
60838494Sobrien#ifdef HAVE_HESIOD_H
60938494Sobrien# include <hesiod.h>
61038494Sobrien#endif /* HAVE_HESIOD_H */
61138494Sobrien
61238494Sobrien/*
61338494Sobrien * Actions to take if <lber.h> exists.
61438494Sobrien * This header file is required before <ldap.h> can be included.
61538494Sobrien */
61638494Sobrien#ifdef HAVE_LBER_H
61738494Sobrien# include <lber.h>
61838494Sobrien#endif /* HAVE_LBER_H */
61938494Sobrien
62038494Sobrien/*
62138494Sobrien * Actions to take if <ldap.h> exists.
62238494Sobrien */
62338494Sobrien#ifdef HAVE_LDAP_H
62438494Sobrien# include <ldap.h>
62538494Sobrien#endif /* HAVE_LDAP_H */
62638494Sobrien
62738494Sobrien/*
62838494Sobrien * Actions to take if <arpa/nameser.h> exists.
62938494Sobrien * Should be included before <resolv.h>.
63038494Sobrien */
63138494Sobrien#ifdef HAVE_ARPA_NAMESER_H
63238494Sobrien# ifdef NOERROR
63338494Sobrien#  undef NOERROR
63438494Sobrien# endif /* NOERROR */
63538494Sobrien/*
63638494Sobrien * Conflicts with <sys/tpicommon.h> which is included from <sys/tiuser.h>
63738494Sobrien * on Solaris 2.6 systems.  So undefine it first.
63838494Sobrien */
63938494Sobrien# ifdef T_UNSPEC
64038494Sobrien#  undef T_UNSPEC
64138494Sobrien# endif /* T_UNSPEC */
64238494Sobrien# include <arpa/nameser.h>
64338494Sobrien#endif /* HAVE_ARPA_NAMESER_H */
64438494Sobrien
64538494Sobrien/*
64638494Sobrien * Actions to take if <arpa/inet.h> exists.
64738494Sobrien */
64838494Sobrien#ifdef HAVE_ARPA_INET_H
64942633Sobrien# ifdef HAVE_BAD_HEADERS
65042633Sobrien/* aix 4.3: avoid including <net/if_dl.h> */
65142633Sobrienstruct sockaddr_dl;
65242633Sobrien# endif /* HAVE_BAD_HEADERS */
65338494Sobrien# include <arpa/inet.h>
65438494Sobrien#endif /* HAVE_ARPA_INET_H */
65538494Sobrien
65638494Sobrien/*
65738494Sobrien * Actions to take if <resolv.h> exists.
65838494Sobrien */
65938494Sobrien#ifdef HAVE_RESOLV_H
66038494Sobrien# include <resolv.h>
66138494Sobrien#endif /* HAVE_RESOLV_H */
66238494Sobrien
66338494Sobrien/*
66438494Sobrien * Actions to take if <sys/uio.h> exists.
66538494Sobrien */
66638494Sobrien#ifdef HAVE_SYS_UIO_H
66738494Sobrien# include <sys/uio.h>
66838494Sobrien#endif /* HAVE_SYS_UIO_H */
66938494Sobrien
67038494Sobrien/*
67138494Sobrien * Actions to take if <sys/fs/cachefs_fs.h> exists.
67238494Sobrien */
67338494Sobrien#ifdef HAVE_SYS_FS_CACHEFS_FS_H
67438494Sobrien# include <sys/fs/cachefs_fs.h>
67538494Sobrien#endif /* HAVE_SYS_FS_CACHEFS_FS_H */
67638494Sobrien
67738494Sobrien/*
67838494Sobrien * Actions to take if <sys/fs/pc_fs.h> exists.
67938494Sobrien */
68038494Sobrien#ifdef HAVE_SYS_FS_PC_FS_H
68138494Sobrien# include <sys/fs/pc_fs.h>
68238494Sobrien#endif /* HAVE_SYS_FS_PC_FS_H */
68338494Sobrien
68438494Sobrien/*
68538494Sobrien * Actions to take if <msdosfs/msdosfsmount.h> exists.
68638494Sobrien */
68738494Sobrien#ifdef HAVE_MSDOSFS_MSDOSFSMOUNT_H
68838494Sobrien# include <msdosfs/msdosfsmount.h>
68938494Sobrien#endif /* HAVE_MSDOSFS_MSDOSFSMOUNT_H */
69038494Sobrien
69138494Sobrien/*
69238494Sobrien * Actions to take if <sys/fs/tmp.h> exists.
69338494Sobrien */
69438494Sobrien#ifdef HAVE_SYS_FS_TMP_H
69538494Sobrien# include <sys/fs/tmp.h>
69638494Sobrien#endif /* HAVE_SYS_FS_TMP_H */
69738494Sobrien
69838494Sobrien/*
69938494Sobrien * Actions to take if <sys/fs/ufs_mount.h> exists.
70038494Sobrien */
70138494Sobrien#ifdef HAVE_SYS_FS_UFS_MOUNT_H
70238494Sobrien# include <sys/fs/ufs_mount.h>
70338494Sobrien#endif /* HAVE_SYS_FS_UFS_MOUNT_H */
70438494Sobrien
70538494Sobrien/*
70638494Sobrien * Actions to take if <sys/fs/efs_clnt.h> exists.
70738494Sobrien */
70838494Sobrien#ifdef HAVE_SYS_FS_EFS_CLNT_H
70938494Sobrien# include <sys/fs/efs_clnt.h>
71038494Sobrien#endif /* HAVE_SYS_FS_EFS_CLNT_H */
71138494Sobrien
71238494Sobrien/*
71338494Sobrien * Actions to take if <sys/fs/xfs_clnt.h> exists.
71438494Sobrien */
71538494Sobrien#ifdef HAVE_SYS_FS_XFS_CLNT_H
71638494Sobrien# include <sys/fs/xfs_clnt.h>
71738494Sobrien#endif /* HAVE_SYS_FS_XFS_CLNT_H */
71838494Sobrien
71938494Sobrien/*
72038494Sobrien * Actions to take if <assert.h> exists.
72138494Sobrien */
72238494Sobrien#ifdef HAVE_ASSERT_H
72338494Sobrien# include <assert.h>
72438494Sobrien#endif /* HAVE_ASSERT_H */
72538494Sobrien
72638494Sobrien/*
72738494Sobrien * Actions to take if <cfs.h> exists.
72838494Sobrien */
72938494Sobrien#ifdef HAVE_CFS_H
73038494Sobrien# include <cfs.h>
73138494Sobrien#endif /* HAVE_CFS_H */
73238494Sobrien
73338494Sobrien/*
73438494Sobrien * Actions to take if <cluster.h> exists.
73538494Sobrien */
73638494Sobrien#ifdef HAVE_CLUSTER_H
73738494Sobrien# include <cluster.h>
73838494Sobrien#endif /* HAVE_CLUSTER_H */
73938494Sobrien
74038494Sobrien/*
74138494Sobrien * Actions to take if <ctype.h> exists.
74238494Sobrien */
74338494Sobrien#ifdef HAVE_CTYPE_H
74438494Sobrien# include <ctype.h>
74538494Sobrien#endif /* HAVE_CTYPE_H */
74638494Sobrien
74738494Sobrien/*
74838494Sobrien * Actions to take if <errno.h> exists.
74938494Sobrien */
75038494Sobrien#ifdef HAVE_ERRNO_H
75138494Sobrien# include <errno.h>
75238494Sobrien#endif /* HAVE_ERRNO_H */
75338494Sobrien
75438494Sobrien/*
75538494Sobrien * Actions to take if <grp.h> exists.
75638494Sobrien */
75738494Sobrien#ifdef HAVE_GRP_H
75838494Sobrien# include <grp.h>
75938494Sobrien#endif /* HAVE_GRP_H */
76038494Sobrien
76138494Sobrien/*
76238494Sobrien * Actions to take if <hsfs/hsfs.h> exists.
76338494Sobrien */
76438494Sobrien#ifdef HAVE_HSFS_HSFS_H
76538494Sobrien# include <hsfs/hsfs.h>
76638494Sobrien#endif /* HAVE_HSFS_HSFS_H */
76738494Sobrien
76838494Sobrien/*
76938494Sobrien * Actions to take if <cdfs/cdfsmount.h> exists.
77038494Sobrien */
77138494Sobrien#ifdef HAVE_CDFS_CDFSMOUNT_H
77238494Sobrien# include <cdfs/cdfsmount.h>
77338494Sobrien#endif /* HAVE_CDFS_CDFSMOUNT_H */
77438494Sobrien
77538494Sobrien/*
77638494Sobrien * Actions to take if <isofs/cd9660/cd9660_mount.h> exists.
77738494Sobrien */
77838494Sobrien#ifdef HAVE_ISOFS_CD9660_CD9660_MOUNT_H
77938494Sobrien# include <isofs/cd9660/cd9660_mount.h>
78038494Sobrien#endif /* HAVE_ISOFS_CD9660_CD9660_MOUNT_H */
78138494Sobrien
78238494Sobrien/*
78338494Sobrien * Actions to take if <mount.h> exists.
78438494Sobrien */
78538494Sobrien#ifdef HAVE_MOUNT_H
78638494Sobrien# include <mount.h>
78738494Sobrien#endif /* HAVE_MOUNT_H */
78838494Sobrien
78938494Sobrien/*
79038494Sobrien * Actions to take if <nsswitch.h> exists.
79138494Sobrien */
79238494Sobrien#ifdef HAVE_NSSWITCH_H
79338494Sobrien# include <nsswitch.h>
79438494Sobrien#endif /* HAVE_NSSWITCH_H */
79538494Sobrien
79638494Sobrien/*
79738494Sobrien * Actions to take if <rpc/auth_des.h> exists.
79838494Sobrien */
79938494Sobrien#ifdef HAVE_RPC_AUTH_DES_H
80038494Sobrien# include <rpc/auth_des.h>
80138494Sobrien#endif /* HAVE_RPC_AUTH_DES_H */
80238494Sobrien
80338494Sobrien/*
80438494Sobrien * Actions to take if <rpc/pmap_clnt.h> exists.
80538494Sobrien */
80638494Sobrien#ifdef HAVE_RPC_PMAP_CLNT_H
80738494Sobrien# include <rpc/pmap_clnt.h>
80838494Sobrien#endif /* HAVE_RPC_PMAP_CLNT_H */
80938494Sobrien
81038494Sobrien/*
81138494Sobrien * Actions to take if <rpc/pmap_prot.h> exists.
81238494Sobrien */
81338494Sobrien#ifdef HAVE_RPC_PMAP_PROT_H
81438494Sobrien# include <rpc/pmap_prot.h>
81538494Sobrien#endif /* HAVE_RPC_PMAP_PROT_H */
81638494Sobrien
81738494Sobrien
81838494Sobrien/*
81938494Sobrien * Actions to take if <rpcsvc/mount.h> exists.
82038494Sobrien * AIX does not protect against this file doubly included,
82138494Sobrien * so I have to do my own protection here.
82238494Sobrien */
82338578Sobrien#ifdef COMMENT_OUT
82438494Sobrien#ifdef HAVE_RPCSVC_MOUNT_H
82538494Sobrien# ifndef _RPCSVC_MOUNT_H
82638494Sobrien#  include <rpcsvc/mount.h>
82738494Sobrien# endif /* not _RPCSVC_MOUNT_H */
82838494Sobrien#endif /* HAVE_RPCSVC_MOUNT_H */
82938578Sobrien#endif
83038578Sobrien#  include "mount.h"
83138494Sobrien
83238494Sobrien/*
83338494Sobrien * Actions to take if <rpcsvc/nis.h> exists.
83438494Sobrien */
83538494Sobrien#ifdef HAVE_RPCSVC_NIS_H
83638494Sobrien# include <rpcsvc/nis.h>
83738494Sobrien#endif /* HAVE_RPCSVC_NIS_H */
83838494Sobrien
83938494Sobrien/*
84038494Sobrien * Actions to take if <setjmp.h> exists.
84138494Sobrien */
84238494Sobrien#ifdef HAVE_SETJMP_H
84338494Sobrien# include <setjmp.h>
84438494Sobrien#endif /* HAVE_SETJMP_H */
84538494Sobrien
84638494Sobrien/*
84738494Sobrien * Actions to take if <signal.h> exists.
84838494Sobrien */
84938494Sobrien#ifdef HAVE_SIGNAL_H
85038494Sobrien# include <signal.h>
85138494Sobrien#endif /* HAVE_SIGNAL_H */
85238494Sobrien
85338494Sobrien/*
85438494Sobrien * Actions to take if <string.h> exists.
85538494Sobrien */
85638494Sobrien#ifdef HAVE_STRING_H
85738494Sobrien# include <string.h>
85838494Sobrien#endif /* HAVE_STRING_H */
85938494Sobrien
86038494Sobrien/*
86138494Sobrien * Actions to take if <strings.h> exists.
86238494Sobrien */
86338494Sobrien#ifdef HAVE_STRINGS_H
86438494Sobrien# include <strings.h>
86538494Sobrien#endif /* HAVE_STRINGS_H */
86638494Sobrien
86738494Sobrien/*
86838494Sobrien * Actions to take if <sys/config.h> exists.
86938494Sobrien */
87038494Sobrien#ifdef HAVE_SYS_CONFIG_H
87138494Sobrien# include <sys/config.h>
87238494Sobrien#endif /* HAVE_SYS_CONFIG_H */
87338494Sobrien
87438494Sobrien/*
87538494Sobrien * Actions to take if <sys/dg_mount.h> exists.
87638494Sobrien */
87738494Sobrien#ifdef HAVE_SYS_DG_MOUNT_H
87838494Sobrien# include <sys/dg_mount.h>
87938494Sobrien#endif /* HAVE_SYS_DG_MOUNT_H */
88038494Sobrien
88138494Sobrien/*
88238494Sobrien * Actions to take if <sys/fs_types.h> exists.
88338494Sobrien */
88438494Sobrien#ifdef HAVE_SYS_FS_TYPES_H
88538494Sobrien/*
88638494Sobrien * Define KERNEL here to avoid multiple definitions of gt_names[] on
88738494Sobrien * Ultrix 4.3.
88838494Sobrien */
88938494Sobrien# define KERNEL
89038494Sobrien# include <sys/fs_types.h>
89138494Sobrien# undef KERNEL
89238494Sobrien#endif /* HAVE_SYS_FS_TYPES_H */
89338494Sobrien
89438494Sobrien/*
89538494Sobrien * Actions to take if <sys/fstyp.h> exists.
89638494Sobrien */
89738494Sobrien#ifdef HAVE_SYS_FSTYP_H
89838494Sobrien# include <sys/fstyp.h>
89938494Sobrien#endif /* HAVE_SYS_FSTYP_H */
90038494Sobrien
90138494Sobrien/*
90238494Sobrien * Actions to take if <sys/lock.h> exists.
90338494Sobrien */
90438494Sobrien#ifdef HAVE_SYS_LOCK_H
90538494Sobrien# include <sys/lock.h>
90638494Sobrien#endif /* HAVE_SYS_LOCK_H */
90738494Sobrien
90838494Sobrien/*
90938494Sobrien * Actions to take if <sys/machine.h> exists.
91038494Sobrien */
91138494Sobrien#ifdef HAVE_SYS_MACHINE_H
91238494Sobrien# include <sys/machine.h>
91338494Sobrien#endif /* HAVE_SYS_MACHINE_H */
91438494Sobrien
91538494Sobrien/*
91638494Sobrien * Actions to take if <sys/mntctl.h> exists.
91738494Sobrien */
91838494Sobrien#ifdef HAVE_SYS_MNTCTL_H
91938494Sobrien# include <sys/mntctl.h>
92038494Sobrien#endif /* HAVE_SYS_MNTCTL_H */
92138494Sobrien
92238494Sobrien/*
92338494Sobrien * Actions to take if <sys/mnttab.h> exists.
92438494Sobrien */
92538494Sobrien#ifdef HAVE_SYS_MNTTAB_H
92638494Sobrien# include <sys/mnttab.h>
92738494Sobrien#endif /* HAVE_SYS_MNTTAB_H */
92838494Sobrien
92938494Sobrien/*
93038494Sobrien * Actions to take if <mnttab.h> exists.
93138494Sobrien * Do not include it if MNTTAB is already defined because it probably
93238494Sobrien * came from <sys/mnttab.h> and we do not want conflicting definitions.
93338494Sobrien */
93438494Sobrien#if defined(HAVE_MNTTAB_H) && !defined(MNTTAB)
93538494Sobrien# include <mnttab.h>
93638494Sobrien#endif /* defined(HAVE_MNTTAB_H) && !defined(MNTTAB) */
93738494Sobrien
93838494Sobrien/*
93938494Sobrien * Actions to take if <netconfig.h> exists.
94038494Sobrien */
94138494Sobrien#ifdef HAVE_NETCONFIG_H
94238494Sobrien# include <netconfig.h>
94338494Sobrien/* Some systems (Solaris 2.5.1) don't declare this external */
94438494Sobrienextern char *nc_sperror(void);
94538494Sobrien#endif /* HAVE_NETCONFIG_H */
94638494Sobrien
94738494Sobrien/*
94838494Sobrien * Actions to take if <sys/netconfig.h> exists.
94938494Sobrien */
95038494Sobrien#ifdef HAVE_SYS_NETCONFIG_H
95138494Sobrien# include <sys/netconfig.h>
95238494Sobrien#endif /* HAVE_SYS_NETCONFIG_H */
95338494Sobrien
95438494Sobrien/*
95538494Sobrien * Actions to take if <sys/pathconf.h> exists.
95638494Sobrien */
95738494Sobrien#ifdef HAVE_SYS_PATHCONF_H
95838494Sobrien# include <sys/pathconf.h>
95938494Sobrien#endif /* HAVE_SYS_PATHCONF_H */
96038494Sobrien
96138494Sobrien/*
96238494Sobrien * Actions to take if <sys/resource.h> exists.
96338494Sobrien */
96438494Sobrien#ifdef HAVE_SYS_RESOURCE_H
96538494Sobrien# include <sys/resource.h>
96638494Sobrien#endif /* HAVE_SYS_RESOURCE_H */
96738494Sobrien
96838494Sobrien/*
96938494Sobrien * Actions to take if <sys/sema.h> exists.
97038494Sobrien */
97138494Sobrien#ifdef HAVE_SYS_SEMA_H
97238494Sobrien# include <sys/sema.h>
97338494Sobrien#endif /* HAVE_SYS_SEMA_H */
97438494Sobrien
97538494Sobrien/*
97638494Sobrien * Actions to take if <sys/signal.h> exists.
97738494Sobrien */
97838494Sobrien#ifdef HAVE_SYS_SIGNAL_H
97938494Sobrien# include <sys/signal.h>
98038494Sobrien#endif /* HAVE_SYS_SIGNAL_H */
98138494Sobrien
98238494Sobrien/*
98338494Sobrien * Actions to take if <sys/sockio.h> exists.
98438494Sobrien */
98538494Sobrien#ifdef HAVE_SYS_SOCKIO_H
98638494Sobrien# include <sys/sockio.h>
98738494Sobrien#endif /* HAVE_SYS_SOCKIO_H */
98838494Sobrien
98938494Sobrien/*
99038494Sobrien * Actions to take if <sys/syscall.h> exists.
99138494Sobrien */
99238494Sobrien#ifdef HAVE_SYS_SYSCALL_H
99338494Sobrien# include <sys/syscall.h>
99438494Sobrien#endif /* HAVE_SYS_SYSCALL_H */
99538494Sobrien
99638494Sobrien/*
99738494Sobrien * Actions to take if <sys/syslimits.h> exists.
99838494Sobrien */
99938494Sobrien#ifdef HAVE_SYS_SYSLIMITS_H
100038494Sobrien# include <sys/syslimits.h>
100138494Sobrien#endif /* HAVE_SYS_SYSLIMITS_H */
100238494Sobrien
100338494Sobrien/*
100438494Sobrien * Actions to take if <tiuser.h> exists.
100538494Sobrien */
100638494Sobrien#ifdef HAVE_TIUSER_H
100738494Sobrien/*
100842633Sobrien * Some systems like AIX have multiple definitions for T_NULL and others
100938494Sobrien * that are defined first in <arpa/nameser.h>.
101038494Sobrien */
101138494Sobrien# ifdef HAVE_ARPA_NAMESER_H
101238494Sobrien#  ifdef T_NULL
101338494Sobrien#   undef T_NULL
101438494Sobrien#  endif /* T_NULL */
101538494Sobrien#  ifdef T_UNSPEC
101638494Sobrien#   undef T_UNSPEC
101738494Sobrien#  endif /* T_UNSPEC */
101838494Sobrien#  ifdef T_IDLE
101938494Sobrien#   undef T_IDLE
102038494Sobrien#  endif /* T_IDLE */
102138494Sobrien# endif /* HAVE_ARPA_NAMESER_H */
102238494Sobrien# include <tiuser.h>
102338494Sobrien#endif /* HAVE_TIUSER_H */
102438494Sobrien
102538494Sobrien/*
102638494Sobrien * Actions to take if <sys/tiuser.h> exists.
102738494Sobrien */
102838494Sobrien#ifdef HAVE_SYS_TIUSER_H
102938494Sobrien# include <sys/tiuser.h>
103038494Sobrien#endif /* HAVE_SYS_TIUSER_H */
103138494Sobrien
103238494Sobrien/*
103338494Sobrien * Actions to take if <sys/statfs.h> exists.
103438494Sobrien */
103538494Sobrien#ifdef HAVE_SYS_STATFS_H
103638494Sobrien# include <sys/statfs.h>
103738494Sobrien#endif /* HAVE_SYS_STATFS_H */
103838494Sobrien
103938494Sobrien/*
104038494Sobrien * Actions to take if <sys/vfs.h> exists.
104138494Sobrien */
104238494Sobrien#ifdef HAVE_SYS_VFS_H
104338494Sobrien# include <sys/vfs.h>
104438494Sobrien#endif /* HAVE_SYS_VFS_H */
104538494Sobrien
104638494Sobrien/*
104738494Sobrien * Actions to take if <sys/vmount.h> exists.
104838494Sobrien */
104938494Sobrien#ifdef HAVE_SYS_VMOUNT_H
105038494Sobrien# include <sys/vmount.h>
105138494Sobrien#endif /* HAVE_SYS_VMOUNT_H */
105238494Sobrien
105338494Sobrien/*
105438494Sobrien * Actions to take if <ufs/ufs_mount.h> exists.
105538494Sobrien */
105638494Sobrien#ifdef HAVE_UFS_UFS_MOUNT_H
105738494Sobrien# include <ufs/ufs_mount.h>
105838494Sobrien#endif /* HAVE_UFS_UFS_MOUNT_H */
105938494Sobrien
106038494Sobrien/*
106138494Sobrien * Are S_ISDIR, S_ISREG, et al broken?  If not, include <sys/stat.h>.
106238494Sobrien * Turned off the not using sys/stat.h based on if the macros are
106338494Sobrien * "broken", because they incorrectly get reported as broken on
106438494Sobrien * ncr2.
106538494Sobrien */
106638494Sobrien#ifndef STAT_MACROS_BROKEN_notused
106738494Sobrien/*
106838494Sobrien * RedHat Linux 4.2 (alpha) has a problem in the headers that causes
106942633Sobrien * duplicate definitions, and also some other nasty bugs.  Upgrade to Redhat
107038494Sobrien * 5.0!
107138494Sobrien */
107238494Sobrien# ifdef HAVE_SYS_STAT_H
107338494Sobrien/* avoid duplicates or conflicts with <linux/stat.h> (RedHat alpha linux) */
107438494Sobrien#  if defined(S_IFREG) && defined(HAVE_STATBUF_H)
107538494Sobrien#   include <statbuf.h>
107638494Sobrien#   undef S_IFBLK
107738494Sobrien#   undef S_IFCHR
107838494Sobrien#   undef S_IFDIR
107938494Sobrien#   undef S_IFIFO
108038494Sobrien#   undef S_IFLNK
108138494Sobrien#   undef S_IFMT
108238494Sobrien#   undef S_IFREG
108338494Sobrien#   undef S_IFSOCK
108438494Sobrien#   undef S_IRGRP
108538494Sobrien#   undef S_IROTH
108638494Sobrien#   undef S_IRUSR
108738494Sobrien#   undef S_IRWXG
108838494Sobrien#   undef S_IRWXO
108938494Sobrien#   undef S_IRWXU
109038494Sobrien#   undef S_ISBLK
109138494Sobrien#   undef S_ISCHR
109238494Sobrien#   undef S_ISDIR
109338494Sobrien#   undef S_ISFIFO
109438494Sobrien#   undef S_ISGID
109538494Sobrien#   undef S_ISLNK
109638494Sobrien#   undef S_ISREG
109738494Sobrien#   undef S_ISSOCK
109838494Sobrien#   undef S_ISUID
109938494Sobrien#   undef S_ISVTX
110038494Sobrien#   undef S_IWGRP
110138494Sobrien#   undef S_IWOTH
110238494Sobrien#   undef S_IWUSR
110338494Sobrien#   undef S_IXGRP
110438494Sobrien#   undef S_IXOTH
110538494Sobrien#   undef S_IXUSR
110638494Sobrien#  endif /* defined(S_IFREG) && defined(HAVE_STATBUF_H) */
110738494Sobrien#  include <sys/stat.h>
110838494Sobrien# endif /* HAVE_SYS_STAT_H */
110938494Sobrien#endif /* not STAT_MACROS_BROKEN_notused */
111038494Sobrien
111138494Sobrien/*
111238494Sobrien * Actions to take if <stdio.h> exists.
111338494Sobrien */
111438494Sobrien#ifdef HAVE_STDIO_H
111538494Sobrien# include <stdio.h>
111638494Sobrien#endif /* HAVE_STDIO_H */
111738494Sobrien
111838494Sobrien/*
111938494Sobrien * Actions to take if <stdlib.h> exists.
112038494Sobrien */
112138494Sobrien#ifdef HAVE_STDLIB_H
112238494Sobrien# include <stdlib.h>
112338494Sobrien#endif /* HAVE_STDLIB_H */
112438494Sobrien
112538494Sobrien/*
112638494Sobrien * Actions to take if <regex.h> exists.
112738494Sobrien */
112838494Sobrien#ifdef HAVE_REGEX_H
112938494Sobrien# include <regex.h>
113038494Sobrien#endif /* HAVE_REGEX_H */
113138494Sobrien
113238494Sobrien
113338494Sobrien/****************************************************************************/
113438494Sobrien/*
113538494Sobrien * Specific macros we're looking for.
113638494Sobrien */
113738494Sobrien#ifndef HAVE_MEMSET
113838494Sobrien# ifdef HAVE_BZERO
113938494Sobrien#  define	memset(ptr, val, len)	bzero((ptr), (len))
114038494Sobrien# else /* not HAVE_BZERO */
114138494Sobrien#  error Cannot find either memset or bzero!
114238494Sobrien# endif /* not HAVE_BZERO */
114338494Sobrien#endif /* not HAVE_MEMSET */
114438494Sobrien
114538494Sobrien#ifndef HAVE_MEMMOVE
114638494Sobrien# ifdef HAVE_BCOPY
114738494Sobrien#  define	memmove(to, from, len)	bcopy((from), (to), (len))
114838494Sobrien# else /* not HAVE_BCOPY */
114938494Sobrien#  error Cannot find either memmove or bcopy!
115038494Sobrien# endif /* not HAVE_BCOPY */
115138494Sobrien#endif /* not HAVE_MEMMOVE */
115238494Sobrien
115338494Sobrien/*
115438494Sobrien * memcmp() is more problematic:
115538494Sobrien * Systems that don't have it, but have bcmp(), will use bcmp() instead.
115638494Sobrien * Those that have it, but it is bad (SunOS 4 doesn't handle
115738494Sobrien * 8 bit comparisons correctly), will get to use am_memcmp().
115838494Sobrien * Otherwise if you have memcmp() and it is good, use it.
115938494Sobrien */
116038494Sobrien#ifdef HAVE_MEMCMP
116138494Sobrien# ifdef HAVE_BAD_MEMCMP
116238494Sobrien#  define	memcmp		am_memcmp
116338494Sobrienextern int am_memcmp(const voidp s1, const voidp s2, size_t len);
116438494Sobrien# endif /* HAVE_BAD_MEMCMP */
116538494Sobrien#else /* not HAVE_MEMCMP */
116638494Sobrien# ifdef HAVE_BCMP
116738494Sobrien#  define	memcmp(a, b, len)	bcmp((a), (b), (len))
116838494Sobrien# endif /* HAVE_BCMP */
116938494Sobrien#endif /* not HAVE_MEMCMP */
117038494Sobrien
117138494Sobrien#ifndef HAVE_SETEUID
117238494Sobrien# ifdef HAVE_SETRESUID
117338494Sobrien#  define	seteuid(x)		setresuid(-1,(x),-1)
117438494Sobrien# else /* not HAVE_SETRESUID */
117538494Sobrien#  error Cannot find either seteuid or setresuid!
117638494Sobrien# endif /* not HAVE_SETRESUID */
117738494Sobrien#endif /* not HAVE_SETEUID */
117838494Sobrien
117938494Sobrien/*
118038494Sobrien * Define type of mntent_t.
118138494Sobrien * Defaults to struct mntent, else struct mnttab.  If neither is found, and
118238494Sobrien * the operating system does keep not mount tables in the kernel, then flag
118338494Sobrien * it as an error.  If neither is found and the OS keeps mount tables in the
118438494Sobrien * kernel, then define our own version of mntent; it will be needed for amd
118538494Sobrien * to keep its own internal version of the mount tables.
118638494Sobrien */
118738494Sobrien#ifdef HAVE_STRUCT_MNTENT
118838494Sobrientypedef struct mntent mntent_t;
118938494Sobrien#else /* not HAVE_STRUCT_MNTENT */
119038494Sobrien# ifdef HAVE_STRUCT_MNTTAB
119138494Sobrientypedef struct mnttab mntent_t;
119238494Sobrien/* map struct mnttab field names to struct mntent field names */
119338494Sobrien#  define mnt_fsname	mnt_special
119438494Sobrien#  define mnt_dir	mnt_mountp
119538494Sobrien#  define mnt_opts	mnt_mntopts
119638494Sobrien#  define mnt_type	mnt_fstype
119738494Sobrien# else /* not HAVE_STRUCT_MNTTAB */
119838494Sobrien#  ifdef MOUNT_TABLE_ON_FILE
119938494Sobrien#   error Could not find definition for struct mntent or struct mnttab!
120038494Sobrien#  else /* not MOUNT_TABLE_ON_FILE */
120138494Sobrientypedef struct _am_mntent {
120238494Sobrien  char	*mnt_fsname;		/* name of mounted file system */
120338494Sobrien  char	*mnt_dir;		/* file system path prefix */
120438494Sobrien  char	*mnt_type;		/* MNTTAB_TYPE_* */
120538494Sobrien  char	*mnt_opts;		/* MNTTAB_OPT_* */
120638494Sobrien  int	mnt_freq;		/* dump frequency, in days */
120738494Sobrien  int	mnt_passno;		/* pass number on parallel fsck */
120838494Sobrien} mntent_t;
120938494Sobrien#  endif /* not MOUNT_TABLE_ON_FILE */
121038494Sobrien# endif /* not HAVE_STRUCT_MNTTAB */
121138494Sobrien#endif /* not HAVE_STRUCT_MNTENT */
121238494Sobrien
121338494Sobrien
121438494Sobrien/*
121538494Sobrien * Complete external definitions missing from some systems.
121638494Sobrien */
121738494Sobrien
121838494Sobrien#ifndef HAVE_EXTERN_SYS_ERRLIST
121938494Sobrienextern const char * const sys_errlist[];
122038494Sobrien#endif /* not HAVE_EXTERN_SYS_ERRLIST */
122138494Sobrien
122238494Sobrien#ifndef HAVE_EXTERN_OPTARG
122338494Sobrienextern char *optarg;
122438494Sobrienextern int optind;
122538494Sobrien#endif /* not HAVE_EXTERN_OPTARG */
122638494Sobrien
122738494Sobrien#if defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO)
122838494Sobrienextern char *clnt_sperrno(const enum clnt_stat num);
122938494Sobrien#endif /* defined(HAVE_CLNT_SPERRNO) && !defined(HAVE_EXTERN_CLNT_SPERRNO) */
123038494Sobrien
123138494Sobrien#ifndef HAVE_EXTERN_FREE
123238494Sobrienextern void free(voidp);
123338494Sobrien#endif /* not HAVE_EXTERN_FREE */
123438494Sobrien
123538494Sobrien#if defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS)
123638494Sobrienextern void get_myaddress(struct sockaddr_in *addr);
123738494Sobrien#endif /* defined(HAVE_GET_MYADDRESS) && !defined(HAVE_EXTERN_GET_MYADDRESS) */
123838494Sobrien
123938494Sobrien#if defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME)
124038494Sobrien# if defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS)
124138494Sobrienextern int getdomainname(char *name, int namelen);
124238494Sobrien# endif /* defined(HAVE_MAP_NIS) || defined(HAVE_MAP_NISPLUS) */
124338494Sobrien#endif /* defined(HAVE_GETDOMAINNAME) && !defined(HAVE_EXTERN_GETDOMAINNAME) */
124438494Sobrien
124538494Sobrien#if defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE)
124638494Sobrienextern int getdtablesize(void);
124738494Sobrien#endif /* defined(HAVE_GETDTABLESIZE) && !defined(HAVE_EXTERN_GETDTABLESIZE) */
124838494Sobrien
124938494Sobrien#if defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME)
125038494Sobrienextern int gethostname(char *name, int namelen);
125138494Sobrien#endif /* defined(HAVE_GETHOSTNAME) && !defined(HAVE_EXTERN_GETHOSTNAME) */
125238494Sobrien
125342633Sobrien#ifndef HAVE_EXTERN_GETLOGIN
125442633Sobrienextern char *getlogin(void);
125542633Sobrien#endif /* not HAVE_EXTERN_GETLOGIN */
125642633Sobrien
125738494Sobrien#if defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE)
125838494Sobrienextern int getpagesize(void);
125938494Sobrien#endif /* defined(HAVE_GETPAGESIZE) && !defined(HAVE_EXTERN_GETPAGESIZE) */
126038494Sobrien
126138494Sobrien#ifndef HAVE_EXTERN_GETWD
126238494Sobrienextern char *getwd(char *s);
126338494Sobrien#endif /* not HAVE_EXTERN_GETWD */
126438494Sobrien
126538494Sobrien#ifndef HAVE_EXTERN_INNETGR
126638494Sobrienextern int innetgr(char *, char *, char *, char *);
126738494Sobrien#endif /* not HAVE_EXTERN_INNETGR */
126838494Sobrien
126938494Sobrien#if defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP)
127038494Sobrienextern int mkstemp(char *);
127138494Sobrien#endif /* defined(HAVE_MKSTEMP) && !defined(HAVE_EXTERN_MKSTEMP) */
127238494Sobrien
127338494Sobrien#ifndef HAVE_EXTERN_SBRK
127438494Sobrienextern caddr_t sbrk(int incr);
127538494Sobrien#endif /* not HAVE_EXTERN_SBRK */
127638494Sobrien
127742633Sobrien#if defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID)
127842633Sobrienextern int seteuid(uid_t euid);
127942633Sobrien#endif /* not defined(HAVE_SETEUID) && !defined(HAVE_EXTERN_SETEUID) */
128042633Sobrien
128138494Sobrien#ifndef HAVE_EXTERN_STRCASECMP
128238494Sobrien/*
128338494Sobrien * define this extern even if function does not exist, for it will
128438494Sobrien * be filled in by libamu/strcasecmp.c
128538494Sobrien */
128638494Sobrienextern int strcasecmp(const char *s1, const char *s2);
128738494Sobrien#endif /* not HAVE_EXTERN_STRCASECMP */
128838494Sobrien
128938494Sobrien#ifndef HAVE_EXTERN_STRDUP
129038494Sobrien/*
129138494Sobrien * define this extern even if function does not exist, for it will
129238494Sobrien * be filled in by libamu/strdup.c
129338494Sobrien */
129438494Sobrienextern char *strdup(const char *s);
129538494Sobrien#endif /* not HAVE_EXTERN_STRDUP */
129638494Sobrien
129738494Sobrien#if defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR)
129838494Sobrienextern char *strstr(const char *s1, const char *s2);
129938494Sobrien#endif /* defined(HAVE_STRSTR) && !defined(HAVE_EXTERN_STRSTR) */
130038494Sobrien
130138494Sobrien#if defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP)
130238494Sobrienextern int usleep(u_int useconds);
130338494Sobrien#endif /* defined(HAVE_USLEEP) && !defined(HAVE_EXTERN_USLEEP) */
130438494Sobrien
130538494Sobrien#ifndef HAVE_EXTERN_UALARM
130638494Sobrienextern u_int ualarm(u_int usecs, u_int interval);
130738494Sobrien#endif /* not HAVE_EXTERN_UALARM */
130838494Sobrien
130938494Sobrien#if defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3)
131038494Sobrienextern int wait3(int *statusp, int options, struct rusage *rusage);
131138494Sobrien#endif /* defined(HAVE_WAIT3) && !defined(HAVE_EXTERN_WAIT3) */
131238494Sobrien
131338494Sobrien#ifndef HAVE_EXTERN_XDR_OPAQUE_AUTH
131442633Sobrienextern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *auth);
131538494Sobrien#endif /* not HAVE_EXTERN_XDR_OPAQUE_AUTH */
131638494Sobrien
131738494Sobrien
131838494Sobrien/****************************************************************************/
131938494Sobrien/*
132038494Sobrien * amd-specific header files.
132138494Sobrien */
132238494Sobrien#ifdef THIS_HEADER_FILE_IS_INCLUDED_ABOVE
132338494Sobrien# include <amu_nfs_prot.h>
132438494Sobrien#endif /* THIS_HEADER_FILE_IS_INCLUDED_ABOVE */
132538494Sobrien#include <am_utils.h>
132638494Sobrien#include <amq_defs.h>
132738494Sobrien#include <aux_conf.h>
132842633Sobrien/* compatibility with old amd, while autoconfiscating it */
132938494Sobrien#include <am_compat.h>
133038494Sobrien
133138494Sobrien
133238494Sobrien/****************************************************************************/
133338494Sobrien/*
133442633Sobrien * External definitions that depend on other macros available (or not)
133538494Sobrien * and those are probably declared in any of the above headers.
133638494Sobrien */
133738494Sobrien
133838494Sobrien#ifndef HAVE_HASMNTOPT
133938494Sobrienextern char *hasmntopt(mntent_t *mnt, char *opt);
134038494Sobrien#endif /* not HAVE_HASMNTOPT */
134138494Sobrien
134238494Sobrien/*
134338494Sobrien * include definitions of all possible xdr functions that are otherwise
134438494Sobrien * not defined elsewhere.
134538494Sobrien */
134638494Sobrien#include <am_xdr_func.h>
134738494Sobrien
134838494Sobrien#endif /* not _AM_DEFS_H */
1349