1
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
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.
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.
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 */
16
/* Defines for Win32 to make it compatible for MySQL */
20
#if defined(_MSC_VER) && _MSC_VER >= 1400
21
/* Avoid endless warnings about sprintf() etc. being unsafe. */
22
#define _CRT_SECURE_NO_DEPRECATE 1
25
#include <sys/locking.h>
33
#if defined(_WIN64) || defined(WIN64)
34
#define SYSTEM_TYPE "Win64"
35
#elif defined(_WIN32) || defined(WIN32)
36
#define SYSTEM_TYPE "Win32"
38
#define SYSTEM_TYPE "Windows"
42
#define MACHINE_TYPE "ia64"
43
#elif defined(_M_IX86)
44
#define MACHINE_TYPE "ia32"
45
#elif defined(_M_ALPHA)
46
#define MACHINE_TYPE "axp"
48
#define MACHINE_TYPE "unknown" /* Define to machine type name */
51
#if !(defined(_WIN64) || defined(WIN64))
53
#define _WIN32 /* Compatible with old source */
60
#define __WIN__ /* To make it easier in VC++ */
64
#define MAX_INDEXES 64
67
/* File and lock constants */
68
#define O_SHARE 0x1000 /* Open file in sharing mode */
70
#define F_RDLCK LK_NBLCK /* read lock */
71
#define F_WRLCK LK_NBRLCK /* write lock */
72
#define F_UNLCK LK_UNLCK /* remove lock(s) */
74
#define F_RDLCK _LK_NBLCK /* read lock */
75
#define F_WRLCK _LK_NBRLCK /* write lock */
76
#define F_UNLCK _LK_UNLCK /* remove lock(s) */
79
#define F_EXCLUSIVE 1 /* We have only exclusive locking */
80
#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
81
#define F_OK 0 /* parameter to access() */
84
#define S_IROTH S_IREAD /* for my_lib */
87
#define FILE_BINARY O_BINARY /* my_fopen in binary mode */
89
#define O_SHORT_LIVED 0
90
#define SH_DENYNO _SH_DENYNO
92
#define O_BINARY _O_BINARY /* compability with older style names */
93
#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
94
#define O_TEMPORARY _O_TEMPORARY
95
#define O_SHORT_LIVED _O_SHORT_LIVED
96
#define SH_DENYNO _SH_DENYNO
98
#define NO_OPEN_3 /* For my_create() */
100
#define SIGQUIT SIGTERM /* No SIGQUIT */
102
#undef _REENTRANT /* Crashes something for win32 */
103
#undef SAFE_MUTEX /* Can't be used on windows */
105
#if defined(_MSC_VER) && _MSC_VER >= 1310
107
#define ULL(A) A##ull
109
#define LL(A) ((__int64) A)
110
#define ULL(A) ((unsigned __int64) A)
113
#define LONGLONG_MIN LL(0x8000000000000000)
114
#define LONGLONG_MAX LL(0x7FFFFFFFFFFFFFFF)
115
#define ULONGLONG_MAX ULL(0xFFFFFFFFFFFFFFFF)
117
/* Type information */
119
#if !defined(HAVE_UINT)
122
typedef unsigned short ushort;
123
typedef unsigned int uint;
124
#endif /* !defined(HAVE_UINT) */
126
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
127
typedef __int64 longlong;
128
#ifndef HAVE_SIGSET_T
129
typedef int sigset_t;
131
#define longlong_defined
133
off_t should not be __int64 because of conflicts in header files;
134
Use my_off_t or os_off_t instead
139
typedef __int64 os_off_t;
141
typedef UINT_PTR rf_SetTimer;
144
typedef unsigned int size_t;
146
typedef uint rf_SetTimer;
149
#define Socket_defined
150
#define my_socket SOCKET
151
#define SIGPIPE SIGINT
152
#define RETQSORTTYPE void
153
#define QSORT_TYPE_IS_VOID
154
#define RETSIGTYPE void
155
#define SOCKET_SIZE_TYPE int
156
#define my_socket_defined
159
#define STDCALL __stdcall /* Used by libmysql.dll */
160
#define isnan(X) _isnan(X)
161
#define finite(X) _finite(X)
163
#ifndef MYSQL_CLIENT_NO_THREADS
166
#define VOID_SIGHANDLER
167
#define SIZEOF_CHAR 1
169
#define SIZEOF_LONG 4
170
#define SIZEOF_LONG_LONG 8
171
#define SIZEOF_OFF_T 8
173
#define SIZEOF_CHARP 8
175
#define SIZEOF_CHARP 4
177
#define HAVE_BROKEN_NETINET_INCLUDES
179
#define HAVE_NAMED_PIPE /* We can only create pipes on NT */
182
/* ERROR is defined in wingdi.h */
185
/* We need to close files to break connections on shutdown */
186
#ifndef SIGNAL_WITH_VIO_CLOSE
187
#define SIGNAL_WITH_VIO_CLOSE
190
/* All windows servers should support .sym files */
194
/* If LOAD DATA LOCAL INFILE should be enabled by default */
195
#define ENABLED_LOCAL_INFILE 1
197
/* If query profiling should be enabled by default */
198
#define ENABLED_PROFILING 1
200
/* Convert some simple functions to Posix */
202
#define my_sigset(A,B) signal((A),(B))
203
#define finite(A) _finite(A)
204
#define sleep(A) Sleep((A)*1000)
205
#define popen(A,B) _popen((A),(B))
206
#define pclose(A) _pclose(A)
209
#define access(A,B) _access(A,B)
212
#if !defined(__cplusplus)
213
#define inline __inline
214
#endif /* __cplusplus */
217
#define ulonglong2double(A) ((double) (ulonglong) (A))
218
#define my_off_t2double(A) ((double) (my_off_t) (A))
221
inline double ulonglong2double(ulonglong value)
223
longlong nr=(longlong) value;
226
return (18446744073709551616.0 + (double) nr);
228
#define my_off_t2double(A) ulonglong2double(A)
231
inline ulonglong double2ulonglong(double d)
233
double t= d - (double) 0x8000000000000000ULL;
236
return ((ulonglong) t) + 0x8000000000000000ULL;
237
return (ulonglong) d;
241
#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
242
#define tell(A) _telli64(A)
245
#define STACK_DIRECTION -1
247
/* Difference between GetSystemTimeAsFileTime() and now() */
248
#define OFFSET_TO_EPOCH ULL(116444736000000000)
252
#define HAVE_RENAME /* Have rename() as function */
253
#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */
254
#define HAVE_LONG_JMP /* Have long jump function */
255
#define HAVE_LOCKING /* have locking() call */
256
#define HAVE_ERRNO_AS_DEFINE /* errno is a define */
257
#define HAVE_STDLIB /* everything is include in this file */
265
#define HAVE_SETLOCALE
266
#define HAVE_SOCKET /* Giangi */
268
#define HAVE_LIMITS_H
269
#define HAVE_STDDEF_H
270
#define NO_FCNTL_NONBLOCK /* No FCNTL */
274
#define HAVE_COMPRESS
275
#define HAVE_CREATESEMAPHORE
278
#define HAVE_QUERY_CACHE
279
#define SPRINTF_RETURNS_INT
280
#define HAVE_SETFILEPOINTER
281
#define HAVE_VIO_READ_BUFF
282
#if defined(_MSC_VER) && _MSC_VER >= 1400
283
/* strnlen() appeared in Studio 2005 */
286
#define HAVE_WINSOCK2
288
#define strcasecmp stricmp
289
#define strncasecmp strnicmp
292
#undef FILE_SHARE_DELETE
293
#define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */
297
#define HAVE_SNPRINTF /* Gave link error */
298
#define _snprintf snprintf
302
#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
303
#define HAVE_ANSI_INCLUDE
304
#define HAVE_SYS_UTIME_H
307
#define my_reinterpret_cast(A) reinterpret_cast <A>
308
#define my_const_cast(A) const_cast<A>
313
#ifdef _CUSTOMCONFIG_
314
#include <custom_conf.h>
316
#ifndef CMAKE_CONFIGD
317
#define DEFAULT_MYSQL_HOME "c:\\mysql"
318
#define MYSQL_DATADIR "c:\\mysql\\data"
319
#define PACKAGE "mysql"
320
#define DEFAULT_BASEDIR "C:\\"
321
#define SHAREDIR "share"
322
#define DEFAULT_CHARSET_HOME "C:/mysql/"
325
#ifndef DEFAULT_HOME_ENV
326
#define DEFAULT_HOME_ENV MYSQL_HOME
328
#ifndef DEFAULT_GROUP_SUFFIX_ENV
329
#define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX
332
/* File name handling */
334
#define FN_LIBCHAR '\\'
335
#define FN_ROOTDIR "\\"
336
#define FN_DEVCHAR ':'
337
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
338
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */
339
#define OS_FILE_LIMIT 2048
341
#define DO_NOT_REMOVE_THREAD_WRAPPERS
342
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
343
#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
344
/* The following is only used for statistics, so it should be good enough */
345
#ifdef __NT__ /* This should also work on Win98 but .. */
346
#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
347
#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
350
#define shared_memory_buffer_length 16000
351
#define default_shared_memory_base_name "MYSQL"
353
#define HAVE_SPATIAL 1
354
#define HAVE_RTREE_KEYS 1
356
#define HAVE_OPENSSL 1
359
#define COMMUNITY_SERVER 1
360
#define ENABLED_PROFILING 1
363
Our Windows binaries include all character sets which MySQL supports.
364
Any changes to the available character sets must also go into
365
config/ac-macros/character_sets.m4
368
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
369
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
372
#define USE_MB_IDENT 1
373
#define USE_STRCOLL 1
375
#define HAVE_CHARSET_armscii8
376
#define HAVE_CHARSET_ascii
377
#define HAVE_CHARSET_big5 1
378
#define HAVE_CHARSET_cp1250 1
379
#define HAVE_CHARSET_cp1251
380
#define HAVE_CHARSET_cp1256
381
#define HAVE_CHARSET_cp1257
382
#define HAVE_CHARSET_cp850
383
#define HAVE_CHARSET_cp852
384
#define HAVE_CHARSET_cp866
385
#define HAVE_CHARSET_cp932 1
386
#define HAVE_CHARSET_dec8
387
#define HAVE_CHARSET_eucjpms 1
388
#define HAVE_CHARSET_euckr 1
389
#define HAVE_CHARSET_gb2312 1
390
#define HAVE_CHARSET_gbk 1
391
#define HAVE_CHARSET_geostd8
392
#define HAVE_CHARSET_greek
393
#define HAVE_CHARSET_hebrew
394
#define HAVE_CHARSET_hp8
395
#define HAVE_CHARSET_keybcs2
396
#define HAVE_CHARSET_koi8r
397
#define HAVE_CHARSET_koi8u
398
#define HAVE_CHARSET_latin1 1
399
#define HAVE_CHARSET_latin2 1
400
#define HAVE_CHARSET_latin5
401
#define HAVE_CHARSET_latin7
402
#define HAVE_CHARSET_macce
403
#define HAVE_CHARSET_macroman
404
#define HAVE_CHARSET_sjis 1
405
#define HAVE_CHARSET_swe7
406
#define HAVE_CHARSET_tis620 1
407
#define HAVE_CHARSET_ucs2 1
408
#define HAVE_CHARSET_ujis 1
409
#define HAVE_CHARSET_utf8 1
411
#define HAVE_UCA_COLLATIONS 1