#endif
-#if defined(HAVE_RPC_RPC_H)
-#include <rpc/rpc.h>
+/* if we have both SYSV IPC and shared mmap then we need to choose. For most
+ systems it is much faster to use SYSV IPC, but under Linux it is
+ about 5 times faster to use fcntl, so for Linux systems we force
+ fcntl based locking */
+#if (defined(HAVE_SYSV_IPC) && defined(HAVE_SHARED_MMAP))
+# ifdef LINUX
+# undef HAVE_SYSV_IPC
+# else
+# undef HAVE_SHARED_MMAP
+# endif
#endif
+
#include <sys/types.h>
#ifdef TIME_WITH_SYS_TIME
#include <stdio.h>
#include <stddef.h>
+#include <netinet/in.h>
+#if defined(HAVE_RPC_RPC_H)
+#include <rpc/rpc.h>
+#endif
+
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <varargs.h>
#endif
-#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <syslog.h>
#include <sys/sem.h>
#endif
+#if 0
/*
- * Seems to be needed by some OS's that complain
- * about struct rtentry not being defined.
- */
-
+ * I have removed this as it prevents compilation under SCO Server
+ * 3.2. If you need to add it back in then please add a comment as to
+ * why it's needed and what OS it's needed for so we can work out how
+ * to test for it properly (tridge) */
#ifdef HAVE_NET_ROUTE_H
#include <net/route.h>
#endif
+#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#endif
+#ifndef PRINTCAP_NAME
+#define PRINTCAP_NAME "/etc/printcap"
+#endif
+
#ifndef SIGCLD
#define SIGCLD SIGCHLD
#endif