diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-09-18 23:20:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-09-20 00:29:05 +0300 |
commit | 811d1c4b4097d87a6e69cad4915cb624020fd450 (patch) | |
tree | 126cb87b83641de8ebc6364df9065faf72b9277c | |
parent | 17fb2a9c9aab60e69040d5d8871bdcf9b4f2d592 (diff) | |
download | mv-811d1c4b4097d87a6e69cad4915cb624020fd450.tar.gz mv-811d1c4b4097d87a6e69cad4915cb624020fd450.tar.bz2 mv-811d1c4b4097d87a6e69cad4915cb624020fd450.tar.xz mv-811d1c4b4097d87a6e69cad4915cb624020fd450.zip |
Add check for compiled/linked libxml2 version.
-rw-r--r-- | src/unittests/utils/dumplibs.cc | 16 | ||||
-rw-r--r-- | src/utils/dumplibs.cpp | 18 |
2 files changed, 33 insertions, 1 deletions
diff --git a/src/unittests/utils/dumplibs.cc b/src/unittests/utils/dumplibs.cc index e7b68e470..5273f0b5e 100644 --- a/src/unittests/utils/dumplibs.cc +++ b/src/unittests/utils/dumplibs.cc @@ -38,6 +38,11 @@ PRAGMA48(GCC diagnostic pop) #include <zlib.h> +#ifdef ENABLE_LIBXML +#include <libxml/threads.h> +#include <libxml/xmlversion.h> +#endif // ENABLE_LIBXML + #include "debug.h" TEST_CASE("dumplibs tests", "") @@ -49,6 +54,17 @@ TEST_CASE("dumplibs tests", "") REQUIRE(build == link); } +#ifdef ENABLE_LIBXML + SECTION("libxml2") + { + const char **xmlVersion = __xmlParserVersion(); + REQUIRE(xmlVersion != nullptr); + REQUIRE(*xmlVersion != nullptr); + REQUIRE(std::string(*xmlVersion) == + std::string(LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA)); + } +#endif // ENABLE_LIBXML + SECTION("sdl") { const SDL_version *linkVersion = nullptr; diff --git a/src/utils/dumplibs.cpp b/src/utils/dumplibs.cpp index 57ce0c493..7132dd729 100644 --- a/src/utils/dumplibs.cpp +++ b/src/utils/dumplibs.cpp @@ -45,6 +45,7 @@ PRAGMA48(GCC diagnostic pop) #include <curl/curl.h> #ifdef ENABLE_LIBXML +#include <libxml/threads.h> #include <libxml/xmlversion.h> #endif // ENABLE_LIBXML @@ -117,7 +118,9 @@ void dumpLibs() logger->log("Compiled with:"); logger->log(" zLib: %s", ZLIB_VERSION); #ifdef ENABLE_LIBXML - logger->log(" libxml2: %s", LIBXML_DOTTED_VERSION); + logger->log(" libxml2: %s, %s", + LIBXML_DOTTED_VERSION, + LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA); #endif // ENABLE_LIBXML logger->log(" libcurl: %s", LIBCURL_VERSION); @@ -136,6 +139,11 @@ void dumpLibs() #ifdef LIBXML_TEST_VERSION LIBXML_TEST_VERSION #endif // LIBXML_TEST_VERSION +#ifdef ENABLE_LIBXML + const char **xmlVersion = __xmlParserVersion(); + if (xmlVersion != nullptr) + logger->log(" libxml2: %s", *xmlVersion); +#endif // ENABLE_LIBXML #ifdef USE_SDL2 SDL_version sdlVersion; sdlVersion.major = 0; @@ -152,6 +160,14 @@ void dumpLibs() dumpLinkedSdlVersion("SDL_ttf", TTF_Linked_Version()); compareVersions("zLib", ZLIB_VERSION, zlibVersion()); +#ifdef ENABLE_LIBXML + if (xmlVersion != nullptr) + { + compareVersions("libxml2", + LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA, + *xmlVersion); + } +#endif // ENABLE_LIBXML #ifdef USE_SDL2 compareSDLVersions("SDL", sdlVersionJoin(SDL), &sdlVersion); #else // USE_SDL2 |