[libxml2] Update config.h.cmake.in



commit 5ddf02f2a50ea8b702f28a42203a96e2302aa70d
Author: Markus Rickert <rickert fortiss org>
Date:   Sun Jun 7 16:06:17 2020 +0200

    Update config.h.cmake.in

 CMakeLists.txt    | 26 ++++++++++++++++++++------
 config.h.cmake.in | 34 ++++++----------------------------
 2 files changed, 26 insertions(+), 34 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d7d86e86..fc163f02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -139,12 +139,17 @@ endif()
 if(MSVC)
        configure_file(include/win32config.h config.h COPYONLY)
 else()
+       check_c_source_compiles("
+               void __attribute__((destructor))
+               f(void) {}
+               int main(void) { return 0; }
+       " ATTRIBUTE_DESTRUCTOR)
        check_c_source_compiles("
                #include <netdb.h>
                int main() { (void) gethostbyname((const char*) \"\"); return 0; }
        " GETHOSTBYNAME_ARG_CAST_CONST)
        if(NOT GETHOSTBYNAME_ARG_CAST_CONST)
-               set(GETHOSTBYNAME_ARG_CAST "(char*)")
+               set(GETHOSTBYNAME_ARG_CAST "(char *)")
        else()
                set(GETHOSTBYNAME_ARG_CAST "/**/")
        endif()
@@ -247,16 +252,18 @@ else()
        if(NOT ICONV_CONST_TEST)
                set(ICONV_CONST "const")
        endif()
+       set(LT_OBJDIR ".libs/")
        check_c_source_compiles("
                #include <sys/socket.h>
                #include <sys/types.h>
                int main() { (void) send(1, (const char*) \"\", 1, 1); return 0; }
        " SEND_ARG2_CAST_CONST)
        if(NOT SEND_ARG2_CAST_CONST)
-               set(SEND_ARG2_CAST "(char*)")
+               set(SEND_ARG2_CAST "(char *)")
        else()
                set(SEND_ARG2_CAST "/**/")
        endif()
+       check_include_files("float.h;stdarg.h;stdlib.h;string.h" STDC_HEADERS)
        check_c_source_compiles("
                #include <stdarg.h>
                void a(va_list* ap) {};
@@ -294,9 +301,6 @@ else()
                        set(XML_SOCKLEN_T int)
                endif()
        endif()
-       if(LIBXML2_WITH_THREADS)
-               add_definitions(-D_REENTRANT)
-       endif()
        configure_file(config.h.cmake.in config.h)
 endif()
 
@@ -406,7 +410,7 @@ if(WIN32)
                "#define LIBXML_MAJOR_VERSION ${LIBXML_MAJOR_VERSION}\n"
                "#define LIBXML_MINOR_VERSION ${LIBXML_MINOR_VERSION}\n"
                "#define LIBXML_MICRO_VERSION ${LIBXML_MICRO_VERSION}\n"
-               "#define LIBXML_DOTTED_VERSION ${VERSION}\n"
+               "#define LIBXML_DOTTED_VERSION \"${VERSION}\"\n"
        )
 endif()
 
@@ -420,6 +424,13 @@ endif()
 
 add_library(LibXml2 ${LIBXML2_HDRS} ${LIBXML2_SRCS})
 
+if(LIBXML2_WITH_THREADS)
+       target_compile_definitions(LibXml2 PRIVATE _REENTRANT)
+       if(WIN32)
+               target_compile_definitions(LibXml2 PRIVATE HAVE_WIN32_THREADS)
+       endif()
+endif()
+
 target_include_directories(
        LibXml2
        PUBLIC
@@ -578,6 +589,9 @@ if(LIBXML2_WITH_TESTS)
                )
                foreach(TEST ${TESTS_THREADS})
                        add_executable(${TEST} ${TEST}.c)
+                       if(WIN32)
+                               target_compile_definitions(${TEST} PRIVATE HAVE_WIN32_THREADS)
+                       endif()
                        target_link_libraries(${TEST} LibXml2 Threads::Threads)
                endforeach()
                add_test(NAME runtest COMMAND runtest --out ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY 
${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 19272c3f..22b3c920 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -1,5 +1,9 @@
+/* config.h.  Generated from config.h.in by configure.  */
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if __attribute__((destructor)) is accepted */
+#cmakedefine ATTRIBUTE_DESTRUCTOR 1
+
 /* Type cast for the gethostbyname() argument */
 #cmakedefine GETHOSTBYNAME_ARG_CAST @GETHOSTBYNAME_ARG_CAST@
 
@@ -230,7 +234,7 @@
 #define ICONV_CONST @ICONV_CONST@
 
 /* Define to the sub-directory where libtool stores uninstalled libraries. */
-#cmakedefine LT_OBJDIR @LT_OBJDIR@
+#cmakedefine LT_OBJDIR "@LT_OBJDIR@"
 
 /* Name of package */
 #define PACKAGE "@PACKAGE@"
@@ -266,7 +270,7 @@
 #cmakedefine VA_LIST_IS_ARRAY 1
 
 /* Version number of package */
-#cmakedefine VERSION @VERSION@
+#cmakedefine VERSION "@VERSION@"
 
 /* Determine what socket length (socklen_t) data type is */
 #cmakedefine XML_SOCKLEN_T @XML_SOCKLEN_T@
@@ -282,29 +286,3 @@
 /* Define to the type of an unsigned integer type of width exactly 32 bits if
    such a type exists and the standard includes do not define it. */
 #cmakedefine uint32_t @uint32_t@
-
-#if defined(_MSC_VER)
-#ifdef NEED_SOCKETS
-#include <wsockcompat.h>
-#endif
-#endif
-
-#if defined(_MSC_VER)
-#define mkdir(p,m) _mkdir(p)
-#if _MSC_VER < 1900
-#define snprintf _snprintf
-#endif
-#if _MSC_VER < 1500
-#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
-#endif
-#elif defined(__MINGW32__)
-#define mkdir(p,m) _mkdir(p)
-#endif
-
-#if defined(_MSC_VER)
-#if defined(LIBXML_THREAD_ENABLED)
-#if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE)
-#define HAVE_WIN32_THREADS
-#endif
-#endif
-#endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]