1/*
2* $Id: config.h,v 1.8 2007/01/04 21:29:21 jms Exp $
3*
4* Revision History
5* ===================
6* $Log: config.h,v $
7* Revision 1.8 2007/01/04 21:29:21 jms
8* Porting changes uncovered as part of move to VS2005. No impact on data set
9*
10* Revision 1.7 2006/06/29 20:46:17 jms
11* 2.4.0 changes from Meikel
12*
13* Revision 1.6 2006/05/31 22:25:21 jms
14* Rework UnifInt calls in varsub to handle lack of PROTO defn in windows
15*
16* Revision 1.5 2006/05/25 22:35:36 jms
17* qgen porting changes for 32b/64b
18*
19* Revision 1.4 2006/03/09 18:54:55 jms
20* porting bugs
21*
22* Revision 1.3 2005/03/04 19:48:39 jms
23* Changes from Doug Johnson to address very large scale factors
24*
25* Revision 1.2 2005/01/03 20:08:58 jms
26* change line terminations
27*
28* Revision 1.1.1.1 2004/11/24 23:31:46 jms
29* re-establish external server
30*
31* Revision 1.7 2004/04/08 17:36:47 jms
32* clarify config.h/makefile linkage
33*
34* Revision 1.6 2004/04/08 17:35:00 jms
35* SUN/SOLARIS ifdef merge between machines
36*
37* Revision 1.5 2004/04/08 17:27:53 jms
38* solaris porting fixes
39*
40* Revision 1.4 2003/08/12 16:45:26 jms
41* linux porting changes
42*
43* Revision 1.3 2003/08/08 21:35:26 jms
44* first integration of rng64 for o_custkey and l_partkey
45*
46* Revision 1.2 2003/08/07 17:58:34 jms
47* Convery RNG to 64bit space as preparation for new large scale RNG
48*
49* Revision 1.1.1.1 2003/04/03 18:54:21 jms
50* initial checkin
51*
52*
53*/
54/*
55 * this file allows the compilation of DBGEN to be tailored to specific
56 * architectures and operating systems. Some options are grouped
57 * together to allow easier compilation on a given vendor's hardware.
58 *
59 * The following #defines will effect the code:
60 * KILL(pid) -- how to terminate a process in a parallel load
61 * SPAWN -- name of system call to clone an existing process
62 * SET_HANDLER(proc) -- name of routine to handle signals in parallel load
63 * WAIT(res, pid) -- how to await the termination of a child
64 * SEPARATOR -- character used to separate fields in flat files
65 * STDLIB_HAS_GETOPT -- to prevent confilcts with gloabal getopt()
66 * MDY_DATE -- generate dates as MM-DD-YY
67 * WIN32 -- support for WindowsNT
68 * SUPPORT_64BITS -- compiler defines a 64 bit datatype
69 * DSS_HUGE -- 64 bit data type
70 * HUGE_FORMAT -- printf string for 64 bit data type
71 * EOL_HANDLING -- flat files don't need final column separator
72 *
73 * Certain defines must be provided in the makefile:
74 * MACHINE defines
75 * ==========
76 * ATT -- getopt() handling
77 * DOS -- disable all multi-user functionality/dependency
78 * HP -- posix source inclusion differences
79 * IBM -- posix source inclusion differences
80 * SGI -- getopt() handling
81 * SUN -- getopt() handling
82 * LINUX
83 * WIN32 -- for WINDOWS
84 *
85 * DATABASE defines
86 * ================
87 * DB2 -- use DB2 dialect in QGEN
88 * INFORMIX -- use Informix dialect in QGEN
89 * SQLSERVER -- use SQLSERVER dialect in QGEN
90 * SYBASE -- use Sybase dialect in QGEN
91 * TDAT -- use Teradata dialect in QGEN
92 *
93 * WORKLOAD defines
94 * ================
95 * TPCH -- make will create TPCH (set in makefile)
96 */
97
98#ifdef DOS
99#define PATH_SEP '\\'
100#else
101
102
103#ifdef ATT
104#define STDLIB_HAS_GETOPT
105#ifdef SQLSERVER
106#define WIN32
107#else
108/* the 64 bit defines are for the Metaware compiler */
109#define SUPPORT_64BITS
110#define DSS_HUGE long long
111#define RNG_A 6364136223846793005ull
112#define RNG_C 1ull
113#define HUGE_FORMAT "%LLd"
114#define HUGE_DATE_FORMAT "%02LLd"
115#endif /* SQLSERVER or MP/RAS */
116#endif /* ATT */
117
118#ifdef HP
119#define _INCLUDE_POSIX_SOURCE
120#define STDLIB_HAS_GETOPT
121#define SUPPORT_64BITS
122#define DSS_HUGE long
123#define HUGE_COUNT 2
124#define HUGE_FORMAT "%ld"
125#define HUGE_DATE_FORMAT "%02lld"
126#define RNG_C 1ull
127#define RNG_A 6364136223846793005ull
128#endif /* HP */
129
130#ifdef IBM
131#define STDLIB_HAS_GETOPT
132#define SUPPORT_64BITS
133#define DSS_HUGE long long
134#define HUGE_FORMAT "%lld"
135#define HUGE_DATE_FORMAT "%02lld"
136#define RNG_A 6364136223846793005ull
137#define RNG_C 1ull
138#endif /* IBM */
139
140#ifdef LINUX
141#define STDLIB_HAS_GETOPT
142#define SUPPORT_64BITS
143#define DSS_HUGE long long int
144#define HUGE_FORMAT "%lld"
145#define HUGE_DATE_FORMAT "%02lld"
146#define RNG_A 6364136223846793005ull
147#define RNG_C 1ull
148#endif /* LINUX */
149
150#ifdef MAC
151#define _POSIX_C_SOURCE 200112L
152#define _POSIX_SOURCE
153#define STDLIB_HAS_GETOPT
154#define SUPPORT_64BITS
155#define DSS_HUGE long
156#define HUGE_FORMAT "%ld"
157#define HUGE_DATE_FORMAT "%02ld"
158#define RNG_A 6364136223846793005ull
159#define RNG_C 1ull
160#endif /* MAC */
161
162#ifdef SUN
163#define STDLIB_HAS_GETOPT
164#define RNG_A 6364136223846793005ull
165#define RNG_C 1ull
166#define SUPPORT_64BITS
167#define DSS_HUGE long long
168#define HUGE_FORMAT "%lld"
169#define HUGE_DATE_FORMAT "%02lld"
170#endif /* SUN */
171
172#ifdef SGI
173#define STDLIB_HAS_GETOPT
174#define SUPPORT_64BITS
175#define DSS_HUGE __int64_t
176#endif /* SGI */
177
178#if (defined(WIN32)&&!defined(_POSIX_))
179#define pid_t int
180#define SET_HANDLER(proc) signal(SIGINT, proc)
181#define KILL(pid) \
182 TerminateProcess(OpenProcess(PROCESS_TERMINATE,FALSE,pid),3)
183#if (defined (__WATCOMC__))
184#define SPAWN() spawnv(P_NOWAIT, spawn_args[0], spawn_args)
185#define WAIT(res, pid) cwait(res, pid, WAIT_CHILD)
186#else
187#define SPAWN() _spawnv(_P_NOWAIT, spawn_args[0], spawn_args)
188#define WAIT(res, pid) _cwait(res, pid, _WAIT_CHILD)
189#define getpid _getpid
190#endif /* WATCOMC */
191#define SIGS_DEFINED
192#define PATH_SEP '\\'
193#define SUPPORT_64BITS
194#define DSS_HUGE __int64
195#define RNG_A 6364136223846793005uI64
196#define RNG_C 1uI64
197#define HUGE_FORMAT "%I64d"
198#define HUGE_DATE_FORMAT "%02I64d"
199/* need to define process termination codes to match UNIX */
200/* these are copied from Linux/GNU and need to be verified as part of a rework of */
201/* process handling under NT (29 Apr 98) */
202#define WIFEXITED(s) ((s & 0xFF) == 0)
203#define WIFSIGNALED(s) (((unsigned int)((status)-1) & 0xFFFF) < 0xFF)
204#define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
205#define WTERMSIG(s) ((s) & 0x7f)
206#define WSTOPSIG(s) (((s) & 0xff00) >> 8)
207/* requried by move to Visual Studio 2005 */
208#define strdup(x) _strdup(x)
209#endif /* WIN32 */
210
211#ifndef SIGS_DEFINED
212#define KILL(pid) kill(SIGUSR1, pid)
213#define SET_HANDLER(proc) signal(SIGUSR1, proc)
214#define SPAWN fork
215#define WAIT(res, pid) wait(res)
216#endif /* DEFAULT */
217
218#endif /* DOS */
219
220#ifndef PATH_SEP
221#define PATH_SEP '/'
222#endif /* PATH_SEP */
223
224#ifndef DSS_HUGE
225#error Support for a 64-bit datatype is required in this release
226#endif
227
228#ifndef DOUBLE_CAST
229#define DOUBLE_CAST (double)
230#endif /* DOUBLE_CAST */
231
232