1 /*
2  *     Copyright (c) 2000-2006 Alberto Reggiori <areggiori@webweaving.org>
3  *                        Dirk-Willem van Gulik <dirkx@webweaving.org>
4  *
5  * NOTICE
6  *
7  * This product is distributed under a BSD/ASF like license as described in the 'LICENSE'
8  * file you should have received together with this source code. If you did not get a
9  * a copy of such a license agreement you can pick up one at:
10  *
11  *     http://rdfstore.sourceforge.net/LICENSE
12  *
13  */
14 
15 #ifndef _DBMS_COMPAT_H
16 
17 #if !defined(WIN32)
18 #include <sys/param.h>
19 #endif
20 
21 /* to make it compiling on Solaris basically */
22 #ifndef INADDR_NONE
23 #define INADDR_NONE     0xffffffff
24 #endif  /* INADDR_NONE */
25 
26 #include <limits.h>
27 #include <sys/types.h>
28 #include <sys/uio.h>
29 #define _XPG4_2
30 #include <sys/socket.h>
31 #undef  _XPG4_2
32 
33 #include <unistd.h>
34 #include <stdlib.h>
35 #include <stdio.h>
36 #ifdef RDFSTORE_PLATFORM_DARWIN
37 #include <stdint.h>
38 #endif
39 #include <stdarg.h>
40 #include <errno.h>
41 #include <ctype.h>
42 #include <time.h>
43 
44 #include <assert.h>
45 #include <signal.h>
46 #include <string.h>
47 /* SOLARIS */
48 #include <strings.h>
49 
50 #include <pwd.h>
51 
52 #include <fcntl.h>
53 #include <sys/types.h>
54 #include <sys/stat.h>
55 #include <sys/time.h>
56 #include <sys/wait.h>
57 #include <sys/resource.h>
58 
59 #include <netdb.h>
60 #include <netinet/in.h>
61 #include <netinet/tcp.h>
62 #include <arpa/inet.h>
63 
64 #include <syslog.h>
65 
66 
67 #if 0
68 /* the following is needed to get rid of 'dereferencing pointer to incomplete type' error on line 144
69  of this file on SuSe Linux - probably to be fixed in the dependences */
70 struct  hostent {
71              char    *h_name;        /* official name of host */
72              char    **h_aliases;    /* alias list */
73              int     h_addrtype;     /* host address type */
74              int     h_length;       /* length of address */
75              char    **h_addr_list;  /* list of addresses from name server */
76      };
77 #define h_addr  h_addr_list[0]  /* address, for backward compatibility */
78 struct hostent * gethostbyname(const char *name);
79 #endif
80 
81 /* not using the following but euristics into main Makefile.PL to guess out paths for db.h */
82 #if 0
83 #ifdef DB1_INCLUDE
84 #	include <db1/db.h>
85 #else
86 #ifdef DB2_INCLUDE
87 #	include <db2/db.h>
88 #else
89 #ifdef DB3_INCLUDE
90 #       include <db3/db.h>
91 #else
92 #ifdef DB4_INCLUDE
93 #	include <db4/db.h>
94 #else
95 #ifdef COMPAT185
96 #	include <db_185.h>
97 #else
98 #	include "db.h"
99 #endif
100 #endif
101 #endif
102 #endif
103 #endif
104 #endif
105 /* end not used */
106 
107 #ifdef COMPAT185
108 #	include "db_185.h"
109 #else
110 #	include "db.h"
111 #endif
112 
113 #ifdef DB_VERSION_MAJOR
114 #	if DB_VERSION_MAJOR == 2
115 #    		define BERKELEY_DB_1_OR_2
116 #	endif
117 #	if DB_VERSION_MAJOR > 3 || (DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR >= 2)
118 #    		define AT_LEAST_DB_3_2
119 #	endif
120 #	define R_FIRST         DB_FIRST
121 #	define R_NEXT          DB_NEXT
122 #	define R_CURSOR        DB_SET_RANGE
123 #else /* db version 1.x */
124 #	define BERKELEY_DB_1
125 #	define BERKELEY_DB_1_OR_2
126 #endif
127 
128 #if defined(BSD)
129 #define _HAS_TIME_T
130 #define _HAS_SENSIBLE_SPRINTF
131 #endif
132 
133 #if defined(_HAS_TIMESPEC)
134 #define TIMESPEC struct timespec
135 #endif
136 
137 #if defined(_HAS_TIMESTRUC_T)
138 #define TIMESPEC timestruc_t
139 #endif
140 
141 #if defined(_HAS_TIME_T)
142 #define TIMESPEC time_t
143 #endif
144 
145 #if defined(_HAS_SENSIBLE_SPRINTF)
146 #define STRLEN(x) (x)
147 #endif
148 
149 #if defined(_HAS_SILLY_SPRINTF)
150 #define STRLEN(x) strlen(x)
151 #endif
152 
153 
154 #define _DBMS_COMPAT_H 1
155 #endif
156