diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-01-19 16:08:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-01-19 16:39:11 +0300 |
commit | 623a64f2c96b71f8609eccb81cb04886ae390c7b (patch) | |
tree | 1d9c782f26e3e4a4dba2dfc53de5729f8c2684ff | |
parent | b7c9e3c0fd5b17c6964c81bb742c2cef1630d50e (diff) | |
download | manaplus-623a64f2c96b71f8609eccb81cb04886ae390c7b.tar.gz manaplus-623a64f2c96b71f8609eccb81cb04886ae390c7b.tar.bz2 manaplus-623a64f2c96b71f8609eccb81cb04886ae390c7b.tar.xz manaplus-623a64f2c96b71f8609eccb81cb04886ae390c7b.zip |
Dump on startup linked and loaded lib versions.
For now only zlib supported.
Also detect zlib by pkgconfig in configure.
-rwxr-xr-x | configure.ac | 15 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/client.cpp | 2 | ||||
-rw-r--r-- | src/localconsts.h | 2 | ||||
-rw-r--r-- | src/net/download.cpp | 4 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 6 | ||||
-rw-r--r-- | src/utils/dumplibs.cpp | 35 | ||||
-rw-r--r-- | src/utils/dumplibs.h | 28 |
9 files changed, 85 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index 0257e96cc..b6655bd6e 100755 --- a/configure.ac +++ b/configure.ac @@ -105,6 +105,13 @@ AC_TYPE_UINT32_T AC_TYPE_INT64_T AC_TYPE_SSIZE_T +# Search for *-config +AC_PATH_PROG(PKG_CONFIG, pkg-config) +AC_PATH_PROG(CURL_CONFIG, curl-config) + +LIBS="$LIBS `$PKG_CONFIG --libs zlib`" +CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags zlib`" + # Checks for internationalization support AM_GNU_GETTEXT([external],[need-ngettext]) AM_GNU_GETTEXT_VERSION([0.16.1]) @@ -192,10 +199,6 @@ if test "x$naclbuild_enabled" == "xfalse"; then AC_CHECK_SDL() fi -# Search for *-config -AC_PATH_PROG(PKG_CONFIG, pkg-config) -AC_PATH_PROG(CURL_CONFIG, curl-config) - # Checks for libraries AC_ARG_WITH(pthread,[ --without-pthread don't check for pthread ] ) if test "x$with_pthread" == "xno"; then @@ -545,5 +548,9 @@ AC_OUTPUT echo echo "Build with OpenGL: $with_opengl" echo +echo "LIBS: $LIBS" +echo "CPPFLAGS: $CPPFLAGS" + +echo echo "configure complete, now type \"make\"" echo diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f67fb94b3..4432d86e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -853,6 +853,8 @@ SET(SRCS utils/cpu.h utils/delete2.h utils/dtor.h + utils/dumplibs.cpp + utils/dumplibs.h utils/env.cpp utils/env.h utils/files.cpp diff --git a/src/Makefile.am b/src/Makefile.am index a1726b768..d3c664606 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -499,6 +499,8 @@ SRC += events/actionevent.h \ utils/cpu.h \ utils/delete2.h \ utils/dtor.h \ + utils/dumplibs.cpp \ + utils/dumplibs.h \ utils/env.cpp \ utils/env.h \ utils/files.cpp \ diff --git a/src/client.cpp b/src/client.cpp index be9143062..344d5d7a4 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -134,6 +134,7 @@ #include "utils/cpu.h" #include "utils/delete2.h" +#include "utils/dumplibs.h" #include "utils/env.h" #include "utils/fuzzer.h" #include "utils/gettext.h" @@ -351,6 +352,7 @@ void Client::gameInit() Dirs::initScreenshotDir(); updateEnv(); + dumpLibs(); // Initialize SDL logger->log1("Initializing SDL..."); diff --git a/src/localconsts.h b/src/localconsts.h index d5bd0ebc1..08623b2b5 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -87,8 +87,6 @@ #endif // GCC_VERSION < 40900 #endif // GCC_VERSION < 40700 -#undef Z_NULL -#define Z_NULL nullptr #define M_TCPOK #define A_DELETE(func) func = delete #define A_DELETE_COPY(name) name(const name &) = delete; \ diff --git a/src/net/download.cpp b/src/net/download.cpp index 7d7869001..ad66fa121 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -143,7 +143,7 @@ unsigned long Download::fadler32(FILE *const file) // Calculate Adler-32 checksum char *const buffer = new char[CAST_SIZE(fileSize)]; const uInt read = static_cast<uInt>(fread(buffer, 1, fileSize, file)); - unsigned long adler = adler32(0L, Z_NULL, 0); + unsigned long adler = adler32(0L, nullptr, 0); adler = adler32(static_cast<uInt>(adler), reinterpret_cast<Bytef*>(buffer), read); delete [] buffer; @@ -153,7 +153,7 @@ unsigned long Download::fadler32(FILE *const file) unsigned long Download::adlerBuffer(const char *const buffer, int size) { FUNC_BLOCK("Download::adlerBuffer", 1) - unsigned long adler = adler32(0L, Z_NULL, 0); + unsigned long adler = adler32(0L, nullptr, 0); return adler32(static_cast<uInt>(adler), reinterpret_cast<const Bytef*>(buffer), size); } diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 9156f334d..cfce7c397 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -128,9 +128,9 @@ int inflateMemory(unsigned char *restrict const in, out = static_cast<unsigned char*>(calloc(bufferSize, 1)); z_stream strm; - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; + strm.zalloc = nullptr; + strm.zfree = nullptr; + strm.opaque = nullptr; strm.next_in = in; strm.avail_in = inLength; strm.next_out = out; diff --git a/src/utils/dumplibs.cpp b/src/utils/dumplibs.cpp new file mode 100644 index 000000000..6a6e378ba --- /dev/null +++ b/src/utils/dumplibs.cpp @@ -0,0 +1,35 @@ +/* + * The ManaPlus Client + * Copyright (C) 2017 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "utils/dumplibs.h" + +#include "logger.h" + +#include <zlib.h> + +#include "debug.h" + +void dumpLibs() +{ + logger->log("Compiled with zLib: %s", ZLIB_VERSION); +#if ZLIB_VERNUM >= 0x1020 + logger->log("Linked with zLib: %s", zlibVersion()); +#endif // ZLIB_VERNUM >= 0x1020 +} diff --git a/src/utils/dumplibs.h b/src/utils/dumplibs.h new file mode 100644 index 000000000..1013026f1 --- /dev/null +++ b/src/utils/dumplibs.h @@ -0,0 +1,28 @@ +/* + * The ManaPlus Client + * Copyright (C) 2017 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef UTILS_DUMPLIBS_H +#define UTILS_DUMPLIBS_H + +#include "localconsts.h" + +void dumpLibs(); + +#endif // UTILS_DUMPLIBS_H |