config-win.h 13 KB

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