home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / mySQL / mysql-5.0.1-alpha-snapshot-win / data1.cab / Development / include / config-win.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-07-28  |  11.3 KB  |  388 lines

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