9
3

config-win.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. /* Defines for Win32 to make it compatible for MySQL */
  13. #define BIG_TABLES
  14. #if defined(_MSC_VER) && _MSC_VER >= 1400
  15. /* Avoid endless warnings about sprintf() etc. being unsafe. */
  16. #define _CRT_SECURE_NO_DEPRECATE 1
  17. #endif
  18. #include <sys/locking.h>
  19. #include <winsock2.h>
  20. #include <fcntl.h>
  21. #include <io.h>
  22. #include <malloc.h>
  23. #define HAVE_SMEM 1
  24. #if defined(_WIN64) || defined(WIN64)
  25. #define SYSTEM_TYPE "Win64"
  26. #elif defined(_WIN32) || defined(WIN32)
  27. #define SYSTEM_TYPE "Win32"
  28. #else
  29. #define SYSTEM_TYPE "Windows"
  30. #endif
  31. #if defined(_M_IA64)
  32. #define MACHINE_TYPE "ia64"
  33. #elif defined(_M_IX86)
  34. #define MACHINE_TYPE "ia32"
  35. #elif defined(_M_ALPHA)
  36. #define MACHINE_TYPE "axp"
  37. #else
  38. #define MACHINE_TYPE "unknown" /* Define to machine type name */
  39. #endif
  40. #if !(defined(_WIN64) || defined(WIN64))
  41. #ifndef _WIN32
  42. #define _WIN32 /* Compatible with old source */
  43. #endif
  44. #ifndef __WIN32__
  45. #define __WIN32__
  46. #endif
  47. #endif /* _WIN64 */
  48. #ifndef __WIN__
  49. #define __WIN__ /* To make it easier in VC++ */
  50. #endif
  51. #ifndef MAX_INDEXES
  52. #define MAX_INDEXES 64
  53. #endif
  54. /* File and lock constants */
  55. #define O_SHARE 0x1000 /* Open file in sharing mode */
  56. #ifdef __BORLANDC__
  57. #define F_RDLCK LK_NBLCK /* read lock */
  58. #define F_WRLCK LK_NBRLCK /* write lock */
  59. #define F_UNLCK LK_UNLCK /* remove lock(s) */
  60. #else
  61. #define F_RDLCK _LK_NBLCK /* read lock */
  62. #define F_WRLCK _LK_NBRLCK /* write lock */
  63. #define F_UNLCK _LK_UNLCK /* remove lock(s) */
  64. #endif
  65. #define F_EXCLUSIVE 1 /* We have only exclusive locking */
  66. #define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */
  67. #define F_OK 0 /* parameter to access() */
  68. #define W_OK 2
  69. #define S_IROTH S_IREAD /* for my_lib */
  70. #ifdef __BORLANDC__
  71. #define FILE_BINARY O_BINARY /* my_fopen in binary mode */
  72. #define O_TEMPORARY 0
  73. #define O_SHORT_LIVED 0
  74. #define SH_DENYNO _SH_DENYNO
  75. #else
  76. #define O_BINARY _O_BINARY /* compability with older style names */
  77. #define FILE_BINARY _O_BINARY /* my_fopen in binary mode */
  78. #define O_TEMPORARY _O_TEMPORARY
  79. #define O_SHORT_LIVED _O_SHORT_LIVED
  80. #define SH_DENYNO _SH_DENYNO
  81. #endif
  82. #define NO_OPEN_3 /* For my_create() */
  83. #define SIGQUIT SIGTERM /* No SIGQUIT */
  84. #undef _REENTRANT /* Crashes something for win32 */
  85. #undef SAFE_MUTEX /* Can't be used on windows */
  86. #if defined(_MSC_VER) && _MSC_VER >= 1310
  87. #define LL(A) A##ll
  88. #define ULL(A) A##ull
  89. #else
  90. #define LL(A) ((__int64) A)
  91. #define ULL(A) ((unsigned __int64) A)
  92. #endif
  93. #define LONGLONG_MIN LL(0x8000000000000000)
  94. #define LONGLONG_MAX LL(0x7FFFFFFFFFFFFFFF)
  95. #define ULONGLONG_MAX ULL(0xFFFFFFFFFFFFFFFF)
  96. /* Type information */
  97. #if !defined(HAVE_UINT)
  98. #undef HAVE_UINT
  99. #define HAVE_UINT
  100. typedef unsigned short ushort;
  101. typedef unsigned int uint;
  102. #endif /* !defined(HAVE_UINT) */
  103. typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
  104. typedef __int64 longlong;
  105. #ifndef HAVE_SIGSET_T
  106. typedef int sigset_t;
  107. #endif
  108. #define longlong_defined
  109. /*
  110. off_t should not be __int64 because of conflicts in header files;
  111. Use my_off_t or os_off_t instead
  112. */
  113. #ifndef HAVE_OFF_T
  114. typedef long off_t;
  115. #endif
  116. typedef __int64 os_off_t;
  117. #ifdef _WIN64
  118. typedef UINT_PTR rf_SetTimer;
  119. #else
  120. #ifndef HAVE_SIZE_T
  121. typedef unsigned int size_t;
  122. #endif
  123. typedef uint rf_SetTimer;
  124. #endif
  125. #define Socket_defined
  126. #define my_socket SOCKET
  127. #define SIGPIPE SIGINT
  128. #define RETQSORTTYPE void
  129. #define QSORT_TYPE_IS_VOID
  130. #define RETSIGTYPE void
  131. #define SOCKET_SIZE_TYPE int
  132. #define my_socket_defined
  133. #define byte_defined
  134. #define HUGE_PTR
  135. #define STDCALL __stdcall /* Used by libmysql.dll */
  136. #define isnan(X) _isnan(X)
  137. #define finite(X) _finite(X)
  138. #ifndef MYSQL_CLIENT_NO_THREADS
  139. #define THREAD
  140. #endif
  141. #define VOID_SIGHANDLER
  142. #define SIZEOF_CHAR 1
  143. #define SIZEOF_INT 4
  144. #define SIZEOF_LONG 4
  145. #define SIZEOF_LONG_LONG 8
  146. #define SIZEOF_OFF_T 8
  147. #ifdef _WIN64
  148. #define SIZEOF_CHARP 8
  149. #else
  150. #define SIZEOF_CHARP 4
  151. #endif
  152. #define HAVE_BROKEN_NETINET_INCLUDES
  153. #ifdef __NT__
  154. #define HAVE_NAMED_PIPE /* We can only create pipes on NT */
  155. #endif
  156. /* ERROR is defined in wingdi.h */
  157. #undef ERROR
  158. /* We need to close files to break connections on shutdown */
  159. #ifndef SIGNAL_WITH_VIO_CLOSE
  160. #define SIGNAL_WITH_VIO_CLOSE
  161. #endif
  162. /* All windows servers should support .sym files */
  163. #undef USE_SYMDIR
  164. #define USE_SYMDIR
  165. /* If LOAD DATA LOCAL INFILE should be enabled by default */
  166. #define ENABLED_LOCAL_INFILE 1
  167. /* If query profiling should be enabled by default */
  168. #define ENABLED_PROFILING 1
  169. /* Convert some simple functions to Posix */
  170. #define my_sigset(A,B) signal((A),(B))
  171. #define finite(A) _finite(A)
  172. #define sleep(A) Sleep((A)*1000)
  173. #define popen(A,B) _popen((A),(B))
  174. #define pclose(A) _pclose(A)
  175. #ifndef __BORLANDC__
  176. #define access(A,B) _access(A,B)
  177. #endif
  178. #if !defined(__cplusplus)
  179. #define inline __inline
  180. #endif /* __cplusplus */
  181. #ifdef _WIN64
  182. #define ulonglong2double(A) ((double) (ulonglong) (A))
  183. #define my_off_t2double(A) ((double) (my_off_t) (A))
  184. #else
  185. inline double ulonglong2double(ulonglong value)
  186. {
  187. longlong nr=(longlong) value;
  188. if (nr >= 0)
  189. return (double) nr;
  190. return (18446744073709551616.0 + (double) nr);
  191. }
  192. #define my_off_t2double(A) ulonglong2double(A)
  193. #endif /* _WIN64 */
  194. inline ulonglong double2ulonglong(double d)
  195. {
  196. double t= d - (double) 0x8000000000000000ULL;
  197. if (t >= 0)
  198. return ((ulonglong) t) + 0x8000000000000000ULL;
  199. return (ulonglong) d;
  200. }
  201. #if SIZEOF_OFF_T > 4
  202. #define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C))
  203. #define tell(A) _telli64(A)
  204. #endif
  205. #define STACK_DIRECTION -1
  206. /* Difference between GetSystemTimeAsFileTime() and now() */
  207. #define OFFSET_TO_EPOCH ULL(116444736000000000)
  208. #define HAVE_PERROR
  209. #define HAVE_VFPRINT
  210. #define HAVE_RENAME /* Have rename() as function */
  211. #define HAVE_BINARY_STREAMS /* Have "b" flag in streams */
  212. #define HAVE_LONG_JMP /* Have long jump function */
  213. #define HAVE_LOCKING /* have locking() call */
  214. #define HAVE_ERRNO_AS_DEFINE /* errno is a define */
  215. #define HAVE_STDLIB /* everything is include in this file */
  216. #define HAVE_MEMCPY
  217. #define HAVE_MEMMOVE
  218. #define HAVE_GETCWD
  219. #define HAVE_TELL
  220. #define HAVE_TZNAME
  221. #define HAVE_PUTENV
  222. #define HAVE_SELECT
  223. #define HAVE_SETLOCALE
  224. #define HAVE_SOCKET /* Giangi */
  225. #define HAVE_FLOAT_H
  226. #define HAVE_LIMITS_H
  227. #define HAVE_STDDEF_H
  228. #define NO_FCNTL_NONBLOCK /* No FCNTL */
  229. #define HAVE_ALLOCA
  230. #define HAVE_STRPBRK
  231. #define HAVE_STRSTR
  232. #define HAVE_COMPRESS
  233. #define HAVE_CREATESEMAPHORE
  234. #define HAVE_ISNAN
  235. #define HAVE_FINITE
  236. #define HAVE_QUERY_CACHE
  237. #define SPRINTF_RETURNS_INT
  238. #define HAVE_SETFILEPOINTER
  239. #define HAVE_VIO_READ_BUFF
  240. #if defined(_MSC_VER) && _MSC_VER >= 1400
  241. /* strnlen() appeared in Studio 2005 */
  242. #define HAVE_STRNLEN
  243. #endif
  244. #define HAVE_WINSOCK2
  245. #define strcasecmp stricmp
  246. #define strncasecmp strnicmp
  247. #ifndef __NT__
  248. #undef FILE_SHARE_DELETE
  249. #define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */
  250. #endif
  251. #ifdef NOT_USED
  252. #define HAVE_SNPRINTF /* Gave link error */
  253. #define _snprintf snprintf
  254. #endif
  255. #ifdef _MSC_VER
  256. #define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */
  257. #define HAVE_ANSI_INCLUDE
  258. #define HAVE_SYS_UTIME_H
  259. #define HAVE_STRTOUL
  260. #endif
  261. #define my_reinterpret_cast(A) reinterpret_cast <A>
  262. #define my_const_cast(A) const_cast<A>
  263. /* MYSQL OPTIONS */
  264. #ifdef _CUSTOMCONFIG_
  265. #include <custom_conf.h>
  266. #else
  267. #ifndef CMAKE_CONFIGD
  268. #define DEFAULT_MYSQL_HOME "c:\\mysql"
  269. #define MYSQL_DATADIR "c:\\mysql\\data"
  270. #define PACKAGE "mysql"
  271. #define DEFAULT_BASEDIR "C:\\"
  272. #define SHAREDIR "share"
  273. #define DEFAULT_CHARSET_HOME "C:/mysql/"
  274. #endif
  275. #endif
  276. #ifndef DEFAULT_HOME_ENV
  277. #define DEFAULT_HOME_ENV MYSQL_HOME
  278. #endif
  279. #ifndef DEFAULT_GROUP_SUFFIX_ENV
  280. #define DEFAULT_GROUP_SUFFIX_ENV MYSQL_GROUP_SUFFIX
  281. #endif
  282. /* File name handling */
  283. #define FN_LIBCHAR '\\'
  284. #define FN_ROOTDIR "\\"
  285. #define FN_DEVCHAR ':'
  286. #define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
  287. #define FN_NO_CASE_SENCE /* Files are not case-sensitive */
  288. #define OS_FILE_LIMIT 2048
  289. #define DO_NOT_REMOVE_THREAD_WRAPPERS
  290. #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
  291. #define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
  292. /* The following is only used for statistics, so it should be good enough */
  293. #ifdef __NT__ /* This should also work on Win98 but .. */
  294. #define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
  295. #define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
  296. #endif
  297. #define shared_memory_buffer_length 16000
  298. #define default_shared_memory_base_name "MYSQL"
  299. #define HAVE_SPATIAL 1
  300. #define HAVE_RTREE_KEYS 1
  301. #define HAVE_OPENSSL 1
  302. #define HAVE_YASSL 1
  303. #define COMMUNITY_SERVER 1
  304. #define ENABLED_PROFILING 1
  305. /*
  306. Our Windows binaries include all character sets which MySQL supports.
  307. Any changes to the available character sets must also go into
  308. config/ac-macros/character_sets.m4
  309. */
  310. #define MYSQL_DEFAULT_CHARSET_NAME "latin1"
  311. #define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
  312. #define USE_MB 1
  313. #define USE_MB_IDENT 1
  314. #define USE_STRCOLL 1
  315. #define HAVE_CHARSET_armscii8
  316. #define HAVE_CHARSET_ascii
  317. #define HAVE_CHARSET_big5 1
  318. #define HAVE_CHARSET_cp1250 1
  319. #define HAVE_CHARSET_cp1251
  320. #define HAVE_CHARSET_cp1256
  321. #define HAVE_CHARSET_cp1257
  322. #define HAVE_CHARSET_cp850
  323. #define HAVE_CHARSET_cp852
  324. #define HAVE_CHARSET_cp866
  325. #define HAVE_CHARSET_cp932 1
  326. #define HAVE_CHARSET_dec8
  327. #define HAVE_CHARSET_eucjpms 1
  328. #define HAVE_CHARSET_euckr 1
  329. #define HAVE_CHARSET_gb2312 1
  330. #define HAVE_CHARSET_gbk 1
  331. #define HAVE_CHARSET_geostd8
  332. #define HAVE_CHARSET_greek
  333. #define HAVE_CHARSET_hebrew
  334. #define HAVE_CHARSET_hp8
  335. #define HAVE_CHARSET_keybcs2
  336. #define HAVE_CHARSET_koi8r
  337. #define HAVE_CHARSET_koi8u
  338. #define HAVE_CHARSET_latin1 1
  339. #define HAVE_CHARSET_latin2 1
  340. #define HAVE_CHARSET_latin5
  341. #define HAVE_CHARSET_latin7
  342. #define HAVE_CHARSET_macce
  343. #define HAVE_CHARSET_macroman
  344. #define HAVE_CHARSET_sjis 1
  345. #define HAVE_CHARSET_swe7
  346. #define HAVE_CHARSET_tis620 1
  347. #define HAVE_CHARSET_ucs2 1
  348. #define HAVE_CHARSET_ujis 1
  349. #define HAVE_CHARSET_utf8 1
  350. #define HAVE_UCA_COLLATIONS 1
  351. #define HAVE_BOOL 1