From 7e8e8aba7cc49bd26393c8f2cb07d99df9fec8dd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 3 Sep 2010 16:21:31 +0200 Subject: Add support for MinGW build --- odb/mysql/Makefile.am | 5 +++-- odb/mysql/connection-factory.cxx | 11 ++++++----- odb/mysql/connection.hxx | 7 ++++--- odb/mysql/database.hxx | 7 ++++--- odb/mysql/details/config.h.in | 17 +++++++++++++++++ odb/mysql/details/config.hxx | 8 +++++++- odb/mysql/details/export.hxx | 20 +++++++++++++++++--- odb/mysql/exceptions.cxx | 7 ++++--- odb/mysql/exceptions.hxx | 7 ++++--- odb/mysql/makefile | 2 +- odb/mysql/query.hxx | 7 ++++--- odb/mysql/statement.cxx | 7 ++++--- odb/mysql/statement.hxx | 7 ++++--- odb/mysql/traits.hxx | 7 ++++--- odb/mysql/transaction-impl.cxx | 7 ++++--- 15 files changed, 87 insertions(+), 39 deletions(-) create mode 100644 odb/mysql/details/config.h.in (limited to 'odb/mysql') diff --git a/odb/mysql/Makefile.am b/odb/mysql/Makefile.am index 3d5c2b3..25059a9 100644 --- a/odb/mysql/Makefile.am +++ b/odb/mysql/Makefile.am @@ -8,8 +8,9 @@ libodb_mysql_la_SOURCES = __path__(sources) odbmysqlincludedir = $(includedir)/odb/mysql/ nobase_odbmysqlinclude_HEADERS = __path__(headers) +nobase_nodist_odbmysqlinclude_HEADERS = details/config.h EXTRA_DIST = __file__(extra_dist) -AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -libodb_mysql_la_LDFLAGS = -release __value__(interface_version) +libodb_mysql_la_CPPFLAGS= -I$(top_builddir) -I$(top_srcdir) -DLIBODB_MYSQL_DYNAMIC_LIB +libodb_mysql_la_LDFLAGS = -release __value__(interface_version) -no-undefined diff --git a/odb/mysql/connection-factory.cxx b/odb/mysql/connection-factory.cxx index c490048..2bfd566 100644 --- a/odb/mysql/connection-factory.cxx +++ b/odb/mysql/connection-factory.cxx @@ -5,10 +5,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include # include // CR_UNKNOWN_ERROR #else @@ -38,7 +39,7 @@ namespace odb #ifndef ODB_THREADS_NONE mysql_init () { - if (my_thread_init ()) + if (mysql_thread_init ()) { throw database_exception ( CR_UNKNOWN_ERROR, "?????", "thread initialization failed"); @@ -47,7 +48,7 @@ namespace odb ~mysql_init () { - my_thread_end (); + mysql_thread_end (); } #endif }; diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx index 9cbd5c5..b00be75 100644 --- a/odb/mysql/connection.hxx +++ b/odb/mysql/connection.hxx @@ -10,10 +10,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include #else # include diff --git a/odb/mysql/database.hxx b/odb/mysql/database.hxx index 0344f3c..b10b037 100644 --- a/odb/mysql/database.hxx +++ b/odb/mysql/database.hxx @@ -10,10 +10,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include #else # include diff --git a/odb/mysql/details/config.h.in b/odb/mysql/details/config.h.in new file mode 100644 index 0000000..81c308a --- /dev/null +++ b/odb/mysql/details/config.h.in @@ -0,0 +1,17 @@ +/* file : odb/mysql/details/config.h.in + * author : Boris Kolpackov + * copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +/* This file is automatically processed by configure. */ + +#ifndef ODB_MYSQL_DETAILS_CONFIG_H +#define ODB_MYSQL_DETAILS_CONFIG_H + +#undef LIBODB_MYSQL_STATIC_LIB + +#undef LIBODB_MYSQL_INCLUDE_SHORT +#undef LIBODB_MYSQL_INCLUDE_LONG + +#endif /* ODB_MYSQL_DETAILS_CONFIG_H */ diff --git a/odb/mysql/details/config.hxx b/odb/mysql/details/config.hxx index f8418c6..957f623 100644 --- a/odb/mysql/details/config.hxx +++ b/odb/mysql/details/config.hxx @@ -8,9 +8,15 @@ // no pre -#ifndef LIBODB_MYSQL_INCLUDE_SHORT +#ifdef HAVE_CONFIG_H +# include +#endif + +#if !defined(LIBODB_MYSQL_INCLUDE_SHORT) && !defined (LIBODB_MYSQL_INCLUDE_LONG) #ifdef _WIN32 #define LIBODB_MYSQL_INCLUDE_SHORT 1 + #else + #define LIBODB_MYSQL_INCLUDE_LONG 1 #endif #endif diff --git a/odb/mysql/details/export.hxx b/odb/mysql/details/export.hxx index bb3bac5..410f6d3 100644 --- a/odb/mysql/details/export.hxx +++ b/odb/mysql/details/export.hxx @@ -8,14 +8,28 @@ #include +#include + #ifdef LIBODB_MYSQL_STATIC_LIB # define LIBODB_MYSQL_EXPORT #else # ifdef _WIN32 -# ifdef LIBODB_MYSQL_DYNAMIC_LIB -# define LIBODB_MYSQL_EXPORT __declspec(dllexport) +# ifdef _MSC_VER +# ifdef LIBODB_MYSQL_DYNAMIC_LIB +# define LIBODB_MYSQL_EXPORT __declspec(dllexport) +# else +# define LIBODB_MYSQL_EXPORT __declspec(dllimport) +# endif # else -# define LIBODB_MYSQL_EXPORT __declspec(dllimport) +# ifdef LIBODB_MYSQL_DYNAMIC_LIB +# ifdef DLL_EXPORT +# define LIBODB_MYSQL_EXPORT __declspec(dllexport) +# else +# define LIBODB_MYSQL_EXPORT +# endif +# else +# define LIBODB_MYSQL_EXPORT __declspec(dllimport) +# endif # endif # else # define LIBODB_MYSQL_EXPORT diff --git a/odb/mysql/exceptions.cxx b/odb/mysql/exceptions.cxx index b857fb6..636c223 100644 --- a/odb/mysql/exceptions.cxx +++ b/odb/mysql/exceptions.cxx @@ -5,10 +5,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include // CR_OUT_OF_MEMORY #else # include diff --git a/odb/mysql/exceptions.hxx b/odb/mysql/exceptions.hxx index 6be2d80..834a4d6 100644 --- a/odb/mysql/exceptions.hxx +++ b/odb/mysql/exceptions.hxx @@ -10,10 +10,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include #else # include diff --git a/odb/mysql/makefile b/odb/mysql/makefile index 49d42a7..94495ac 100644 --- a/odb/mysql/makefile +++ b/odb/mysql/makefile @@ -66,7 +66,7 @@ $(dist): export interface_version = $(shell sed -e \ 's/^\([0-9]*\.[0-9]*\).*/\1/' $(src_root)/version) $(dist): - $(call dist-data,$(sources) $(headers)) + $(call dist-data,$(sources) $(headers) details/config.h.in) $(call meta-vc9proj,$(src_base)/libodb-mysql-vc9.vcproj) $(call meta-vc10proj,$(src_base)/libodb-mysql-vc10.vcxproj) $(call meta-automake) diff --git a/odb/mysql/query.hxx b/odb/mysql/query.hxx index 5dd4339..8e1d241 100644 --- a/odb/mysql/query.hxx +++ b/odb/mysql/query.hxx @@ -10,10 +10,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include #else # include diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx index 9cacc4f..95edbbd 100644 --- a/odb/mysql/statement.cxx +++ b/odb/mysql/statement.cxx @@ -5,10 +5,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include // ER_DUP_ENTRY, ER_LOCK_DEADLOCK #else # include diff --git a/odb/mysql/statement.hxx b/odb/mysql/statement.hxx index 7ac9c61..78681a2 100644 --- a/odb/mysql/statement.hxx +++ b/odb/mysql/statement.hxx @@ -10,10 +10,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include #else # include diff --git a/odb/mysql/traits.hxx b/odb/mysql/traits.hxx index bf52d78..a520d1b 100644 --- a/odb/mysql/traits.hxx +++ b/odb/mysql/traits.hxx @@ -10,10 +10,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include // MYSQL_TIME, used in custom specializations. #else # include diff --git a/odb/mysql/transaction-impl.cxx b/odb/mysql/transaction-impl.cxx index 946ea23..04493e6 100644 --- a/odb/mysql/transaction-impl.cxx +++ b/odb/mysql/transaction-impl.cxx @@ -5,10 +5,11 @@ #include +#ifdef _WIN32 +# include +#endif + #ifdef LIBODB_MYSQL_INCLUDE_SHORT -# ifdef _WIN32 -# include -# endif # include #else # include -- cgit v1.1