diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 420351cf94c..889d4b10fca 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -82,8 +82,8 @@ IF(CONNECT_WITH_LIBXML2) IF (LIBXML2_FOUND) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) SET(XML_LIBRARY ${LIBXML2_LIBRARIES}) - SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabxml.cpp plgxml.cpp libdoc.cpp) - add_definitions(-DXML_SUPPORT) + SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp) + add_definitions(-DLIBXML2_SUPPORT) ENDIF(LIBXML2_FOUND) ENDIF(CONNECT_WITH_LIBXML2) @@ -102,18 +102,22 @@ IF(WIN32) IF(MSXML_LIBRARY MATCHES .*msxml6[.].*) add_definitions(-DMSX6 -DDOMDOC_SUPPORT) message(STATUS "MSXML library version: msxml6") + SET(MSXML_FOUND 1) SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp) ELSEIF(MSXML_LIBRARY MATCHES .*msxml4[.].*) add_definitions(-DMSX4 -DDOMDOC_SUPPORT) message("MSXML library version: msxml4") + SET(MSXML_FOUND 1) SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp) ELSEIF(MSXML_LIBRARY MATCHES .*msxml3[.].*) message("MSXML library version: msxml3") add_definitions(-DMSX3 -DDOMDOC_SUPPORT) + SET(MSXML_FOUND 1) SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp) ELSEIF(MSXML_LIBRARY MATCHES .*msxml2[.].*) message("MSXML library version: msxml2") add_definitions(-DMXS2 -DDOMDOC_SUPPORT) + SET(MSXML_FOUND 1) SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp) ELSE() message(STATUS "msxml? library not found") @@ -121,6 +125,9 @@ IF(WIN32) ENDIF(CONNECT_WITH_MSXML) ENDIF(WIN32) +IF(LIBXML2_FOUND OR MSXML_FOUND) + SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabxml.cpp plgxml.cpp) +ENDIF() # # MySQL diff --git a/storage/connect/global.h b/storage/connect/global.h index 76c0fcb776f..9b48a7fb0c3 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -19,6 +19,10 @@ #define DllExport #endif // !WIN32 +#if defined(DOMDOC_SUPPORT) || defined(LIBXML2_SUPPORT) +#define XML_SUPPORT 1 +#endif + #if defined(XMSG) // Definition used to read messages from message file. #include "msgid.h" diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 14cf110f032..a167b47c475 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -146,10 +146,10 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all); bool CntInfo(PGLOBAL g, PTDB tdbp, PXF info); int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, bool *incl, key_part_map *kmap); -#if defined(XML_SUPPORT) && !defined(NOXML2) +#ifdef LIBXML2_SUPPORT void XmlInitParserLib(void); void XmlCleanupParserLib(void); -#endif // XML_SUPPORT && !NOXML2) +#endif // LIBXML2_SUPPORT /****************************************************************************/ /* Functions called externally by pre_parser. */ @@ -3692,14 +3692,14 @@ bool APIENTRY DllMain(HINSTANCE hInst, ULONG ulReason, PCONTEXT pctx) printf("version=%s\n", version); trace= xtrace; } // endif xtrace -#if defined(XML_SUPPORT) && !defined(NOXML2) +#ifdef LIBXML2_SUPPORT XmlInitParserLib(); -#endif // XML_SUPPORT && !NOXML2) +#endif // LIBXML2_SUPPORT break; case DLL_PROCESS_DETACH: -#if defined(XML_SUPPORT) && !defined(NOXML2) +#ifdef LIBXML2_SUPPORT XmlCleanupParserLib(); -#endif // XML_SUPPORT && !NOXML2) +#endif // LIBXML2_SUPPORT break; case DLL_THREAD_ATTACH: break; @@ -3732,9 +3732,9 @@ void __attribute__((constructor)) init() trace= xtrace; } // endif xtrace -#if defined(XML_SUPPORT) && !defined(NOXML2) +#ifdef LIBXML2_SUPPORT XmlInitParserLib(); -#endif // XML_SUPPORT && !NOXML2) +#endif // LIBXML2_SUPPORT } // end of init /**************************************************************************/ @@ -3742,9 +3742,9 @@ void __attribute__((constructor)) init() /**************************************************************************/ void __attribute__((destructor)) fini() { -#if defined(XML_SUPPORT) && !defined(NOXML2) +#ifdef LIBXML2_SUPPORT XmlCleanupParserLib(); -#endif // XML_SUPPORT && !NOXML2) +#endif // LIBXML2_SUPPORT } // end of fini #endif // !WIN32 diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index d61e4b656c2..6bbee84e348 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -119,14 +119,14 @@ MBLOCK Nmblk = {NULL, false, 0, false, NULL}; // Used to init MBLOCK's bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool); bool EvalLikePattern(LPCSTR, LPCSTR); void PlugConvertConstant(PGLOBAL, void* &, short&); -#if defined(XML_SUPPORT) -#if defined(WIN32) && defined(DOMDOC_SUPPORT) + +#ifdef DOMDOC_SUPPORT void CloseXMLFile(PGLOBAL, PFBLOCK, bool); -#endif // WIN32 -#if !defined(NOXML2) +#endif // DOMDOC_SUPPORT + +#ifdef LIBXML2_SUPPORT void CloseXML2File(PGLOBAL, PFBLOCK, bool); -#endif // !NOXML2 -#endif // XML_SUPPORT +#endif // LIBXML2_SUPPORT /**************************************************************************/ /* Utility for external callers (such as XDB) */ @@ -808,18 +808,16 @@ int PlugCloseFile(PGLOBAL g, PFBLOCK fp, bool all) fp->Mode = MODE_ANY; fp->Count = 0; break; -#if defined(XML_SUPPORT) -#if defined(WIN32) && defined(DOMDOC_SUPPORT) +#ifdef defined(DOMDOC_SUPPORT) case TYPE_FB_XML: CloseXMLFile(g, fp, all); break; -#endif // WIN32 -#if !defined(NOXML2) +#endif // DOMDOC_SUPPORT +#ifdef LIBXML2_SUPPORT case TYPE_FB_XML2: CloseXML2File(g, fp, all); break; -#endif // !NOXML2 -#endif // XML_SUPPORT +#endif // LIBXML2_SUPPORT default: rc = RC_FX; } // endswitch Type diff --git a/storage/connect/plgxml.cpp b/storage/connect/plgxml.cpp index 6f7173d73ab..2e03875eab7 100644 --- a/storage/connect/plgxml.cpp +++ b/storage/connect/plgxml.cpp @@ -17,14 +17,14 @@ PXDOC GetDomDoc(PGLOBAL g, char *nsl, char *nsdf, } // end of GetDomDoc #endif // !DOMDOC_SUPPORT -#if defined(NOXML2) +#ifndef LIBXML2_SUPPORT PXDOC GetLibxmlDoc(PGLOBAL g, char *nsl, char *nsdf, char *enc, PFBLOCK fp) { strcpy(g->Message, "libxml2 not supported"); return NULL; } // end of GetLibxmlDoc -#endif // NOXML2 +#endif // LIBXML2_SUPPORT /******************************************************************/ /* XMLDOCUMENT constructor. */