Fixed compilations problems and warnings on windows

parent 6d78655a
...@@ -35,6 +35,12 @@ ...@@ -35,6 +35,12 @@
#define YASSL_VERSION "1.5.8" #define YASSL_VERSION "1.5.8"
#if defined(_WIN32) || defined(_WIN64)
#include <winsock2.h>
typedef SOCKET socket_t;
#else
typedef int socket_t;
#endif
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
...@@ -189,13 +195,6 @@ enum { /* ERR Constants */ ...@@ -189,13 +195,6 @@ enum { /* ERR Constants */
EVP_R_BAD_DECRYPT = 2 EVP_R_BAD_DECRYPT = 2
}; };
#if defined(_WIN32) || defined(_WIN64)
#include <winsock2.h>
typedef SOCKET socket_t;
#else
typedef int socket_t;
#endif
SSL_CTX* SSL_CTX_new(SSL_METHOD*); SSL_CTX* SSL_CTX_new(SSL_METHOD*);
SSL* SSL_new(SSL_CTX*); SSL* SSL_new(SSL_CTX*);
......
...@@ -28,9 +28,8 @@ ...@@ -28,9 +28,8 @@
#include <assert.h> #include <assert.h>
#if defined(_WIN32) || defined(_WIN64) #include "openssl/ssl.h" /* for socket_t */
#include <winsock2.h> #if !defined(_WIN32) && !defined(_WIN64)
#else
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
...@@ -38,7 +37,6 @@ ...@@ -38,7 +37,6 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#include "openssl/ssl.h" /* for socket_t */
namespace yaSSL { namespace yaSSL {
......
...@@ -27,7 +27,7 @@ functions */ ...@@ -27,7 +27,7 @@ functions */
#endif #endif
#include <sys/locking.h> #include <sys/locking.h>
#include <windows.h> #include <winsock2.h>
#include <math.h> /* Because of rint() */ #include <math.h> /* Because of rint() */
#include <fcntl.h> #include <fcntl.h>
#include <io.h> #include <io.h>
......
...@@ -42,7 +42,7 @@ extern "C" { ...@@ -42,7 +42,7 @@ extern "C" {
#ifndef _global_h /* If not standard header */ #ifndef _global_h /* If not standard header */
#include <sys/types.h> #include <sys/types.h>
#ifdef __LCC__ #ifdef __LCC__
#include <winsock.h> /* For windows */ #include <winsock2.h> /* For windows */
#endif #endif
typedef char my_bool; typedef char my_bool;
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) #if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#pragma hdrstop #pragma hdrstop
#include "emb_samples.h" #include "emb_samples.h"
#include <winsock.h> #include <winsock2.h>
#include <mysql.h> #include <mysql.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <windows.h> #include <winsock2.h>
#include <signal.h> #include <signal.h>
#include "log.h" #include "log.h"
#include "options.h" #include "options.h"
......
...@@ -25,9 +25,6 @@ ...@@ -25,9 +25,6 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include <m_ctype.h> #include <m_ctype.h>
#ifdef HAVE_OPENSSL
#include <openssl/des.h>
#endif /* HAVE_OPENSSL */
#include "md5.h" #include "md5.h"
#include "sha1.h" #include "sha1.h"
#include "my_aes.h" #include "my_aes.h"
......
...@@ -222,7 +222,7 @@ static SYMBOL symbols[] = { ...@@ -222,7 +222,7 @@ static SYMBOL symbols[] = {
{ "GLOBAL", SYM(GLOBAL_SYM)}, { "GLOBAL", SYM(GLOBAL_SYM)},
{ "GRANT", SYM(GRANT)}, { "GRANT", SYM(GRANT)},
{ "GRANTS", SYM(GRANTS)}, { "GRANTS", SYM(GRANTS)},
{ "GROUP", SYM(GROUP)}, { "GROUP", SYM(GROUP_SYM)},
{ "HANDLER", SYM(HANDLER_SYM)}, { "HANDLER", SYM(HANDLER_SYM)},
{ "HASH", SYM(HASH_SYM)}, { "HASH", SYM(HASH_SYM)},
{ "HAVING", SYM(HAVING)}, { "HAVING", SYM(HAVING)},
......
...@@ -47,9 +47,6 @@ ...@@ -47,9 +47,6 @@
#include <violite.h> #include <violite.h>
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#ifdef __WIN__
#include <winsock.h>
#endif
#ifdef __NETWARE__ #ifdef __NETWARE__
#include <sys/select.h> #include <sys/select.h>
#endif #endif
......
...@@ -2554,7 +2554,7 @@ namespace { ...@@ -2554,7 +2554,7 @@ namespace {
: m_memory(0) : m_memory(0)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
m_alloc_checked= false; m_alloc_checked= FALSE;
#endif #endif
allocate_memory(table, len1); allocate_memory(table, len1);
m_ptr[0]= has_memory() ? m_memory : 0; m_ptr[0]= has_memory() ? m_memory : 0;
...@@ -2565,7 +2565,7 @@ namespace { ...@@ -2565,7 +2565,7 @@ namespace {
: m_memory(0) : m_memory(0)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
m_alloc_checked= false; m_alloc_checked= FALSE;
#endif #endif
allocate_memory(table, len1 + len2); allocate_memory(table, len1 + len2);
m_ptr[0]= has_memory() ? m_memory : 0; m_ptr[0]= has_memory() ? m_memory : 0;
...@@ -2586,7 +2586,7 @@ namespace { ...@@ -2586,7 +2586,7 @@ namespace {
*/ */
bool has_memory() const { bool has_memory() const {
#ifndef DBUG_OFF #ifndef DBUG_OFF
m_alloc_checked= true; m_alloc_checked= TRUE;
#endif #endif
return m_memory != 0; return m_memory != 0;
} }
...@@ -2595,7 +2595,7 @@ namespace { ...@@ -2595,7 +2595,7 @@ namespace {
{ {
DBUG_ASSERT(s < sizeof(m_ptr)/sizeof(*m_ptr)); DBUG_ASSERT(s < sizeof(m_ptr)/sizeof(*m_ptr));
DBUG_ASSERT(m_ptr[s] != 0); DBUG_ASSERT(m_ptr[s] != 0);
DBUG_ASSERT(m_alloc_checked == true); DBUG_ASSERT(m_alloc_checked == TRUE);
return m_ptr[s]; return m_ptr[s];
} }
...@@ -2625,12 +2625,12 @@ namespace { ...@@ -2625,12 +2625,12 @@ namespace {
table->write_row_record= table->write_row_record=
(byte *) alloc_root(&table->mem_root, 2 * maxlen); (byte *) alloc_root(&table->mem_root, 2 * maxlen);
m_memory= table->write_row_record; m_memory= table->write_row_record;
m_release_memory_on_destruction= false; m_release_memory_on_destruction= FALSE;
} }
else else
{ {
m_memory= (byte *) my_malloc(total_length, MYF(MY_WME)); m_memory= (byte *) my_malloc(total_length, MYF(MY_WME));
m_release_memory_on_destruction= true; m_release_memory_on_destruction= TRUE;
} }
} }
......
...@@ -4597,7 +4597,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, ...@@ -4597,7 +4597,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
Table_ident *table_ident) Table_ident *table_ident)
{ {
TABLE *tmp_table; TABLE *tmp_table;
char src_path[FN_REFLEN], dst_path[FN_REFLEN], tmp_path[FN_REFLEN]; char src_path[FN_REFLEN], dst_path[FN_REFLEN];
char src_table_name_buff[FN_REFLEN], src_db_name_buff[FN_REFLEN]; char src_table_name_buff[FN_REFLEN], src_db_name_buff[FN_REFLEN];
uint dst_path_length; uint dst_path_length;
char *db= table->db; char *db= table->db;
...@@ -4608,7 +4608,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, ...@@ -4608,7 +4608,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
bool res= TRUE, unlock_dst_table= FALSE; bool res= TRUE, unlock_dst_table= FALSE;
enum legacy_db_type not_used; enum legacy_db_type not_used;
HA_CREATE_INFO *create_info; HA_CREATE_INFO *create_info;
#ifdef WITH_PARTITION_STORAGE_ENGINE
char tmp_path[FN_REFLEN];
#endif
TABLE_LIST src_tables_list, dst_tables_list; TABLE_LIST src_tables_list, dst_tables_list;
DBUG_ENTER("mysql_create_like_table"); DBUG_ENTER("mysql_create_like_table");
......
...@@ -556,7 +556,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -556,7 +556,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token GLOBAL_SYM /* SQL-2003-R */ %token GLOBAL_SYM /* SQL-2003-R */
%token GRANT /* SQL-2003-R */ %token GRANT /* SQL-2003-R */
%token GRANTS %token GRANTS
%token GROUP /* SQL-2003-R */ %token GROUP_SYM /* SQL-2003-R */
%token GROUP_CONCAT_SYM %token GROUP_CONCAT_SYM
%token GT_SYM /* OPERATOR */ %token GT_SYM /* OPERATOR */
%token HANDLER_SYM %token HANDLER_SYM
...@@ -1505,7 +1505,7 @@ create: ...@@ -1505,7 +1505,7 @@ create:
{ {
Lex->sql_command = SQLCOM_CREATE_USER; Lex->sql_command = SQLCOM_CREATE_USER;
} }
| CREATE LOGFILE_SYM GROUP logfile_group_info | CREATE LOGFILE_SYM GROUP_SYM logfile_group_info
{ {
Lex->alter_tablespace_info->ts_cmd_type= CREATE_LOGFILE_GROUP; Lex->alter_tablespace_info->ts_cmd_type= CREATE_LOGFILE_GROUP;
} }
...@@ -3081,11 +3081,11 @@ trg_event: ...@@ -3081,11 +3081,11 @@ trg_event:
ALTER TABLESPACE name CHANGE DATAFILE ... ALTER TABLESPACE name CHANGE DATAFILE ...
ALTER TABLESPACE name ADD DATAFILE ... ALTER TABLESPACE name ADD DATAFILE ...
ALTER TABLESPACE name access_mode ALTER TABLESPACE name access_mode
CREATE LOGFILE GROUP name ... CREATE LOGFILE GROUP_SYM name ...
ALTER LOGFILE GROUP name ADD UNDOFILE .. ALTER LOGFILE GROUP_SYM name ADD UNDOFILE ..
ALTER LOGFILE GROUP name ADD REDOFILE .. ALTER LOGFILE GROUP_SYM name ADD REDOFILE ..
DROP TABLESPACE name DROP TABLESPACE name
DROP LOGFILE GROUP name DROP LOGFILE GROUP_SYM name
*/ */
change_tablespace_access: change_tablespace_access:
tablespace_name tablespace_name
...@@ -3107,7 +3107,7 @@ tablespace_info: ...@@ -3107,7 +3107,7 @@ tablespace_info:
opt_logfile_group_name: opt_logfile_group_name:
/* empty */ {} /* empty */ {}
| USE_SYM LOGFILE_SYM GROUP ident | USE_SYM LOGFILE_SYM GROUP_SYM ident
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->alter_tablespace_info->logfile_group_name= $4.str; lex->alter_tablespace_info->logfile_group_name= $4.str;
...@@ -5073,7 +5073,7 @@ alter: ...@@ -5073,7 +5073,7 @@ alter:
LEX *lex= Lex; LEX *lex= Lex;
lex->alter_tablespace_info->ts_cmd_type= ALTER_TABLESPACE; lex->alter_tablespace_info->ts_cmd_type= ALTER_TABLESPACE;
} }
| ALTER LOGFILE_SYM GROUP alter_logfile_group_info | ALTER LOGFILE_SYM GROUP_SYM alter_logfile_group_info
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->alter_tablespace_info->ts_cmd_type= ALTER_LOGFILE_GROUP; lex->alter_tablespace_info->ts_cmd_type= ALTER_LOGFILE_GROUP;
...@@ -7552,7 +7552,7 @@ opt_escape: ...@@ -7552,7 +7552,7 @@ opt_escape:
group_clause: group_clause:
/* empty */ /* empty */
| GROUP BY group_list olap_opt; | GROUP_SYM BY group_list olap_opt;
group_list: group_list:
group_list ',' order_ident order_dir group_list ',' order_ident order_dir
...@@ -8016,7 +8016,7 @@ drop: ...@@ -8016,7 +8016,7 @@ drop:
LEX *lex= Lex; LEX *lex= Lex;
lex->alter_tablespace_info->ts_cmd_type= DROP_TABLESPACE; lex->alter_tablespace_info->ts_cmd_type= DROP_TABLESPACE;
} }
| DROP LOGFILE_SYM GROUP logfile_group_name opt_ts_engine opt_ts_wait | DROP LOGFILE_SYM GROUP_SYM logfile_group_name opt_ts_engine opt_ts_wait
{ {
LEX *lex= Lex; LEX *lex= Lex;
lex->alter_tablespace_info->ts_cmd_type= DROP_LOGFILE_GROUP; lex->alter_tablespace_info->ts_cmd_type= DROP_LOGFILE_GROUP;
......
...@@ -684,7 +684,7 @@ longlong sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, ...@@ -684,7 +684,7 @@ longlong sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args,
****************************************************************************/ ****************************************************************************/
#ifdef __WIN__ #ifdef __WIN__
#include <winsock.h> #include <winsock2.h>
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
......
...@@ -13,13 +13,21 @@ a variety of project systems. This tool is combined with a set of jscript ...@@ -13,13 +13,21 @@ a variety of project systems. This tool is combined with a set of jscript
files to enable building of MySQL for Windows directly out of a bk clone. files to enable building of MySQL for Windows directly out of a bk clone.
The steps required are below. The steps required are below.
Step 1 Step 1:
-------
Install a Windows C++ compiler. If you don't have one, you can use
the free compiler "Visual C++ 2005 express edition", which from Cmake
point of view is same as Visual studio 8:
http://msdn.microsoft.com/vstudio/express/
Step 2
------ ------
Download and install CMake. It can be downloaded from http://www.cmake.org. Download and install CMake. It can be downloaded from http://www.cmake.org.
Once it is installed, modify your path to make sure you can execute Once it is installed, modify your path to make sure you can execute
the cmake binary. the cmake binary.
Step 2 Step 3
------ ------
Download and install bison for Windows. It can be downloaded from Download and install bison for Windows. It can be downloaded from
http://gnuwin32.sourceforge.net/packages/bison.htm. Please download using http://gnuwin32.sourceforge.net/packages/bison.htm. Please download using
...@@ -27,11 +35,15 @@ the link named "Complete package, excluding sources". This includes an ...@@ -27,11 +35,15 @@ the link named "Complete package, excluding sources". This includes an
installer that will install bison. After the installer finishes, modify installer that will install bison. After the installer finishes, modify
your path so that you can execute bison. your path so that you can execute bison.
Step 3 (Alternative you, can take the sql_yacc.yy and sql_yacc.h files from a
matching mysql tar distribution and drop them into the sql directory just
before you start the build)
Step 4
------ ------
Clone your bk tree to any location you like. Clone your bk tree to any location you like.
Step 4 Step 5
------ ------
From the root of your bk clone, execute the command: win\configure <options>. From the root of your bk clone, execute the command: win\configure <options>.
The options right now are The options right now are
...@@ -42,7 +54,6 @@ The options right now are ...@@ -42,7 +54,6 @@ The options right now are
WITH_BLACKHOLE_STORAGE_ENGINE WITH_BLACKHOLE_STORAGE_ENGINE
WITH_EXAMPLE_STORAGE_ENGINE WITH_EXAMPLE_STORAGE_ENGINE
WITH_FEDERATED_STORAGE_ENGINE WITH_FEDERATED_STORAGE_ENGINE
WITH_INNOBASE_STORAGE_ENGINE
__NT__ Enable named pipe support __NT__ Enable named pipe support
MYSQL_SERVER_SUFFIX=<suffix> Server suffix, default none MYSQL_SERVER_SUFFIX=<suffix> Server suffix, default none
COMPILATION_COMMENT=<comment> Server comment, default "Source distribution" COMPILATION_COMMENT=<comment> Server comment, default "Source distribution"
...@@ -53,17 +64,17 @@ So the command line could look like: ...@@ -53,17 +64,17 @@ So the command line could look like:
win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro win\configure WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
Step 5 Step 6
------ ------
From the root of your bk clone, execute one of the batch files to generate the type From the root of your bk clone, execute one of the batch files to generate the type
of project files you desire. of project files you desire.
For Visual Studio 8, do win\build-vs8. For Visual Studio 8 (or Visual C++ 2005 express edition), do win\build-vs8.
For Visual Studio 7.1, do win\build-vs71. For Visual Studio 7.1, do win\build-vs71.
We will support building with nmake in the near future. We will support building with nmake in the near future.
Step 6 Step 7
------ ------
From the root of your bk clone, start your build. From the root of your bk clone, start your build.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment