root/trunk/dep/include/mysql/config-win.h @ 2

Revision 2, 12.9 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1/* Copyright (C) 2000 MySQL AB
2
3   This program is free software; you can redistribute it and/or modify
4   it under the terms of the GNU General Public License as published by
5   the Free Software Foundation; version 2 of the License.
6
7   This program is distributed in the hope that it will be useful,
8   but WITHOUT ANY WARRANTY; without even the implied warranty of
9   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10   GNU General Public License for more details.
11
12   You should have received a copy of the GNU General Public License
13   along with this program; if not, write to the Free Software
14   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
16/* Defines for Win32 to make it compatible for MySQL */
17
18#ifdef __WIN2000__
19/* We have to do this define before including windows.h to get the AWE API
20functions */
21#define _WIN32_WINNT     0x0500
22#else
23/* Get NT 4.0 functions */
24#define _WIN32_WINNT     0x0400
25#endif
26
27#if defined(_MSC_VER) && _MSC_VER >= 1400
28/* Avoid endless warnings about sprintf() etc. being unsafe. */
29#define _CRT_SECURE_NO_DEPRECATE 1
30#endif
31
32#include <sys/locking.h>
33#include <windows.h>
34#include <math.h>                       /* Because of rint() */
35#include <fcntl.h>
36#include <io.h>
37#include <malloc.h>
38
39#define BIG_TABLES 1
40#define HAVE_SMEM 1
41
42#if defined(_WIN64) || defined(WIN64)
43#define SYSTEM_TYPE     "Win64"
44#elif defined(_WIN32) || defined(WIN32)
45#define SYSTEM_TYPE     "Win32"
46#else
47#define SYSTEM_TYPE     "Windows"
48#endif
49
50#if defined(_M_IA64)
51#define MACHINE_TYPE    "ia64"
52#elif defined(_M_IX86)
53#define MACHINE_TYPE    "ia32"
54#elif defined(_M_ALPHA)
55#define MACHINE_TYPE    "axp"
56#else
57#define MACHINE_TYPE    "unknown"       /* Define to machine type name */
58#endif
59 
60#if !(defined(_WIN64) || defined(WIN64))
61#ifndef _WIN32
62#define _WIN32                          /* Compatible with old source */
63#endif
64#ifndef __WIN32__
65#define __WIN32__
66#endif
67#endif /* _WIN64 */
68#ifndef __WIN__
69#define __WIN__                       /* To make it easier in VC++ */
70#endif
71
72#ifndef MAX_INDEXES
73#define MAX_INDEXES 64
74#endif
75
76/* File and lock constants */
77#define O_SHARE         0x1000          /* Open file in sharing mode */
78#ifdef __BORLANDC__
79#define F_RDLCK         LK_NBLCK        /* read lock */
80#define F_WRLCK         LK_NBRLCK       /* write lock */
81#define F_UNLCK         LK_UNLCK        /* remove lock(s) */
82#else
83#define F_RDLCK         _LK_NBLCK       /* read lock */
84#define F_WRLCK         _LK_NBRLCK      /* write lock */
85#define F_UNLCK         _LK_UNLCK       /* remove lock(s) */
86#endif
87
88#define F_EXCLUSIVE     1               /* We have only exclusive locking */
89#define F_TO_EOF        (INT_MAX32/2)   /* size for lock of all file */
90#define F_OK            0               /* parameter to access() */
91#define W_OK            2
92
93#define S_IROTH         S_IREAD         /* for my_lib */
94
95#ifdef __BORLANDC__
96#define FILE_BINARY     O_BINARY        /* my_fopen in binary mode */
97#define O_TEMPORARY     0
98#define O_SHORT_LIVED   0
99#define SH_DENYNO       _SH_DENYNO
100#else
101#define O_BINARY        _O_BINARY       /* compability with MSDOS */
102#define FILE_BINARY     _O_BINARY       /* my_fopen in binary mode */
103#define O_TEMPORARY     _O_TEMPORARY
104#define O_SHORT_LIVED   _O_SHORT_LIVED
105#define SH_DENYNO       _SH_DENYNO
106#endif
107#define NO_OPEN_3                       /* For my_create() */
108
109#define SIGQUIT         SIGTERM         /* No SIGQUIT */
110
111#undef _REENTRANT                       /* Crashes something for win32 */
112#undef SAFE_MUTEX                       /* Can't be used on windows */
113
114#if defined(_MSC_VER) && _MSC_VER >= 1310
115#define LL(A)           A##ll
116#define ULL(A)          A##ull
117#else
118#define LL(A)           ((__int64) A)
119#define ULL(A)          ((unsigned __int64) A)
120#endif
121
122#define LONGLONG_MIN    LL(0x8000000000000000)
123#define LONGLONG_MAX    LL(0x7FFFFFFFFFFFFFFF)
124#define ULONGLONG_MAX   ULL(0xFFFFFFFFFFFFFFFF)
125
126/* Type information */
127
128#if defined(__EMX__) || !defined(HAVE_UINT)
129#undef HAVE_UINT
130#define HAVE_UINT
131typedef unsigned short  ushort;
132typedef unsigned int    uint;
133#endif /* defined(__EMX__) || !defined(HAVE_UINT) */
134
135typedef unsigned __int64 ulonglong;     /* Microsofts 64 bit types */
136typedef __int64 longlong;
137#ifndef HAVE_SIGSET_T
138typedef int sigset_t;
139#endif
140#define longlong_defined
141/*
142  off_t should not be __int64 because of conflicts in header files;
143  Use my_off_t or os_off_t instead
144*/
145#ifndef HAVE_OFF_T
146typedef long off_t;
147#endif
148typedef __int64 os_off_t;
149#ifdef _WIN64
150typedef UINT_PTR rf_SetTimer;
151#else
152#ifndef HAVE_SIZE_T
153typedef unsigned int size_t;
154#endif
155typedef uint rf_SetTimer;
156#endif
157
158#define Socket_defined
159#define my_socket SOCKET
160#define bool BOOL
161#define SIGPIPE SIGINT
162#define RETQSORTTYPE void
163#define QSORT_TYPE_IS_VOID
164#define RETSIGTYPE void
165#define SOCKET_SIZE_TYPE int
166#define my_socket_defined
167#define bool_defined
168#define byte_defined
169#define HUGE_PTR
170#define STDCALL __stdcall           /* Used by libmysql.dll */
171#define isnan(X) _isnan(X)
172#define finite(X) _finite(X)
173
174#ifndef UNDEF_THREAD_HACK
175#define THREAD
176#endif
177#define VOID_SIGHANDLER
178#define SIZEOF_CHAR             1
179#define SIZEOF_LONG             4
180#define SIZEOF_LONG_LONG        8
181#define SIZEOF_OFF_T            8
182#ifdef _WIN64
183#define SIZEOF_CHARP            8
184#else
185#define SIZEOF_CHARP            4
186#endif
187#define HAVE_BROKEN_NETINET_INCLUDES
188#ifdef __NT__
189#define HAVE_NAMED_PIPE                 /* We can only create pipes on NT */
190#endif
191
192/* ERROR is defined in wingdi.h */
193#undef ERROR
194
195/* We need to close files to break connections on shutdown */
196#ifndef SIGNAL_WITH_VIO_CLOSE
197#define SIGNAL_WITH_VIO_CLOSE
198#endif
199
200/* Use all character sets in MySQL */
201#define USE_MB 1
202#define USE_MB_IDENT 1
203#define USE_STRCOLL 1
204
205/* All windows servers should support .sym files */
206#undef USE_SYMDIR
207#define USE_SYMDIR
208
209/* If LOAD DATA LOCAL INFILE should be enabled by default */
210#define ENABLED_LOCAL_INFILE 1
211
212/* Convert some simple functions to Posix */
213
214#define my_sigset(A,B) signal((A),(B))
215#define finite(A) _finite(A)
216#define sleep(A)  Sleep((A)*1000)
217#define popen(A,B) _popen((A),(B))
218#define pclose(A) _pclose(A)
219
220#ifndef __BORLANDC__
221#define access(A,B) _access(A,B)
222#endif
223
224#if !defined(__cplusplus)
225#define inline __inline
226#endif /* __cplusplus */
227
228inline double rint(double nr)
229{
230  double f = floor(nr);
231  double c = ceil(nr);
232  return (((c-nr) >= (nr-f)) ? f :c);
233}
234
235#ifdef _WIN64
236#define ulonglong2double(A) ((double) (ulonglong) (A))
237#define my_off_t2double(A)  ((double) (my_off_t) (A))
238
239#else
240inline double ulonglong2double(ulonglong value)
241{
242  longlong nr=(longlong) value;
243  if (nr >= 0)
244    return (double) nr;
245  return (18446744073709551616.0 + (double) nr);
246}
247#define my_off_t2double(A) ulonglong2double(A)
248#endif /* _WIN64 */
249
250#if SIZEOF_OFF_T > 4
251#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
252#define tell(A) _telli64(A)
253#endif
254
255
256#define STACK_DIRECTION -1
257
258/* Optimized store functions for Intel x86 */
259
260#ifndef _WIN64
261#define sint2korr(A)    (*((int16 *) (A)))
262#define sint3korr(A)    ((int32) ((((uchar) (A)[2]) & 128) ? \
263                                  (((uint32) 255L << 24) | \
264                                   (((uint32) (uchar) (A)[2]) << 16) |\
265                                   (((uint32) (uchar) (A)[1]) << 8) | \
266                                   ((uint32) (uchar) (A)[0])) : \
267                                  (((uint32) (uchar) (A)[2]) << 16) |\
268                                  (((uint32) (uchar) (A)[1]) << 8) | \
269                                  ((uint32) (uchar) (A)[0])))
270#define sint4korr(A)    (*((long *) (A)))
271#define uint2korr(A)    (*((uint16 *) (A)))
272/*
273   ATTENTION !
274   
275    Please, note, uint3korr reads 4 bytes (not 3) !
276    It means, that you have to provide enough allocated space !
277*/
278#define uint3korr(A)    (long) (*((unsigned int *) (A)) & 0xFFFFFF)
279#define uint4korr(A)    (*((unsigned long *) (A)))
280#define uint5korr(A)    ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
281                                    (((uint32) ((uchar) (A)[1])) << 8) +\
282                                    (((uint32) ((uchar) (A)[2])) << 16) +\
283                                    (((uint32) ((uchar) (A)[3])) << 24)) +\
284                                    (((ulonglong) ((uchar) (A)[4])) << 32))
285#define uint8korr(A)    (*((ulonglong *) (A)))
286#define sint8korr(A)    (*((longlong *) (A)))
287#define int2store(T,A)  *((uint16*) (T))= (uint16) (A)
288#define int3store(T,A)          { *(T)=  (uchar) ((A));\
289                                  *(T+1)=(uchar) (((uint) (A) >> 8));\
290                                  *(T+2)=(uchar) (((A) >> 16)); }
291#define int4store(T,A)  *((long *) (T))= (long) (A)
292#define int5store(T,A)  { *(T)= (uchar)((A));\
293                          *((T)+1)=(uchar) (((A) >> 8));\
294                          *((T)+2)=(uchar) (((A) >> 16));\
295                          *((T)+3)=(uchar) (((A) >> 24)); \
296                          *((T)+4)=(uchar) (((A) >> 32)); }
297#define int8store(T,A)  *((ulonglong *) (T))= (ulonglong) (A)
298
299#define doubleget(V,M)  do { *((long *) &V) = *((long*) M); \
300                            *(((long *) &V)+1) = *(((long*) M)+1); } while(0)
301#define doublestore(T,V) do { *((long *) T) = *((long*) &V); \
302                              *(((long *) T)+1) = *(((long*) &V)+1); } while(0)
303#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); }
304#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
305#define floatget(V,M)   memcpy((byte*)(&V), (byte*)(M), sizeof(float))
306#define float8get(V,M) doubleget((V),(M))
307#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
308#define float8store(V,M) doublestore((V),(M))
309#endif /* _WIN64 */
310
311#define HAVE_PERROR
312#define HAVE_VFPRINT
313#define HAVE_RENAME             /* Have rename() as function */
314#define HAVE_BINARY_STREAMS     /* Have "b" flag in streams */
315#define HAVE_LONG_JMP           /* Have long jump function */
316#define HAVE_LOCKING            /* have locking() call */
317#define HAVE_ERRNO_AS_DEFINE    /* errno is a define */
318#define HAVE_STDLIB             /* everything is include in this file */
319#define HAVE_MEMCPY
320#define HAVE_MEMMOVE
321#define HAVE_GETCWD
322#define HAVE_TELL
323#define HAVE_TZNAME
324#define HAVE_PUTENV
325#define HAVE_SELECT
326#define HAVE_SETLOCALE
327#define HAVE_SOCKET             /* Giangi */
328#define HAVE_FLOAT_H
329#define HAVE_LIMITS_H
330#define HAVE_STDDEF_H
331#define HAVE_RINT               /* defined in this file */
332#define NO_FCNTL_NONBLOCK       /* No FCNTL */
333#define HAVE_ALLOCA
334#define HAVE_STRPBRK
335#define HAVE_STRSTR
336#define HAVE_COMPRESS
337#define HAVE_CREATESEMAPHORE
338#define HAVE_ISNAN
339#define HAVE_FINITE
340#define HAVE_QUERY_CACHE
341#define SPRINTF_RETURNS_INT
342#define HAVE_SETFILEPOINTER
343#define HAVE_VIO_READ_BUFF
344#define HAVE_STRNLEN
345
346#ifndef __NT__
347#undef FILE_SHARE_DELETE
348#define FILE_SHARE_DELETE 0     /* Not implemented on Win 98/ME */
349#endif
350
351#ifdef NOT_USED
352#define HAVE_SNPRINTF           /* Gave link error */
353#define _snprintf snprintf
354#endif
355
356#ifdef _MSC_VER
357#define HAVE_LDIV               /* The optimizer breaks in zortech for ldiv */
358#define HAVE_ANSI_INCLUDE
359#define HAVE_SYS_UTIME_H
360#define HAVE_STRTOUL
361#endif
362#define my_reinterpret_cast(A) reinterpret_cast <A>
363#define my_const_cast(A) const_cast<A>
364
365
366/* MYSQL OPTIONS */
367
368#ifdef _CUSTOMCONFIG_
369#include <custom_conf.h>
370#else
371#define DEFAULT_MYSQL_HOME      "c:\\mysql"
372#define DATADIR                 "c:\\mysql\\data"
373#define PACKAGE                 "mysql"
374#define DEFAULT_BASEDIR         "C:\\"
375#define SHAREDIR                "share"
376#define DEFAULT_CHARSET_HOME    "C:/mysql/"
377#endif
378#ifndef DEFAULT_HOME_ENV
379#define DEFAULT_HOME_ENV MYSQL_HOME
380#endif
381#ifndef DEFAULT_GROUP_SUFFIX_ENV
382#define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX
383#endif
384
385/* File name handling */
386
387#define FN_LIBCHAR      '\\'
388#define FN_ROOTDIR      "\\"
389#define FN_DEVCHAR      ':'
390#define FN_NETWORK_DRIVES       /* Uses \\ to indicate network drives */
391#define FN_NO_CASE_SENCE        /* Files are not case-sensitive */
392#define OS_FILE_LIMIT   2048
393
394#define DO_NOT_REMOVE_THREAD_WRAPPERS
395#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
396#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
397/* The following is only used for statistics, so it should be good enough */
398#ifdef __NT__  /* This should also work on Win98 but .. */
399#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
400#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
401#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
402#else
403#define thread_safe_add(V,C,L) \
404        pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
405#define thread_safe_sub(V,C,L) \
406        pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
407#define statistic_add(V,C,L)     (V)+=(C)
408#endif
409#define statistic_increment(V,L) thread_safe_increment((V),(L))
410#define statistic_decrement(V,L) thread_safe_decrement((V),(L))
411
412#define shared_memory_buffer_length 16000
413#define default_shared_memory_base_name "MYSQL"
414
415#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
416#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
417
418#define HAVE_SPATIAL 1
419#define HAVE_RTREE_KEYS 1
420
421#define HAVE_OPENSSL 1
422#define HAVE_YASSL 1
423
424/* Define charsets you want */
425/* #undef HAVE_CHARSET_armscii8 */
426/* #undef HAVE_CHARSET_ascii */
427#define HAVE_CHARSET_big5 1
428#define HAVE_CHARSET_cp1250 1
429/* #undef HAVE_CHARSET_cp1251 */
430/* #undef HAVE_CHARSET_cp1256 */
431/* #undef HAVE_CHARSET_cp1257 */
432/* #undef HAVE_CHARSET_cp850 */
433/* #undef HAVE_CHARSET_cp852 */
434/* #undef HAVE_CHARSET_cp866 */
435#define HAVE_CHARSET_cp932 1
436/* #undef HAVE_CHARSET_dec8 */
437#define HAVE_CHARSET_eucjpms 1
438#define HAVE_CHARSET_euckr 1
439#define HAVE_CHARSET_gb2312 1
440#define HAVE_CHARSET_gbk 1
441/* #undef HAVE_CHARSET_greek */
442/* #undef HAVE_CHARSET_hebrew */
443/* #undef HAVE_CHARSET_hp8 */
444/* #undef HAVE_CHARSET_keybcs2 */
445/* #undef HAVE_CHARSET_koi8r */
446/* #undef HAVE_CHARSET_koi8u */
447#define HAVE_CHARSET_latin1 1
448#define HAVE_CHARSET_latin2 1
449/* #undef HAVE_CHARSET_latin5 */
450/* #undef HAVE_CHARSET_latin7 */
451/* #undef HAVE_CHARSET_macce */
452/* #undef HAVE_CHARSET_macroman */
453#define HAVE_CHARSET_sjis 1
454/* #undef HAVE_CHARSET_swe7 */
455#define HAVE_CHARSET_tis620 1
456#define HAVE_CHARSET_ucs2 1
457#define HAVE_CHARSET_ujis 1
458#define HAVE_CHARSET_utf8 1
459#define HAVE_UCA_COLLATIONS 1
460
Note: See TracBrowser for help on using the browser.