root/src/mysql/config-win.h @ 1

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