Changeset: 247c0a821571 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=247c0a821571
Modified Files:
        CMakeLists.txt
        clients/mapiclient/mclient.c
        clients/mapiclient/mnc.c
        common/stream/stream.c
        common/stream/stream_socket.h
        common/utils/prompt.c
        gdk/gdk_posix.c
        gdk/gdk_posix.h
        gdk/gdk_system.c
        gdk/gdk_system.h
        gdk/gdk_utils.c
        monetdb5/mal/mal_readline.c
        monetdb5/modules/kernel/status.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb_config.h.in
        testing/difflib.c
        testing/helpers.c
        tools/merovingian/client/monetdb.c
        tools/merovingian/daemon/merovingian.c
Branch: cmake-fun
Log Message:

Further cleanup, removed checks for Windows build vs all other builds.


diffs (truncated from 498 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -164,6 +164,14 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux"
 endif()
 if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
        add_compile_options(-no-gcc) # Intel compiler hack
+       if(EXISTS "${ROOT}/usr/include/math.h") # see 
https://software.intel.com/en-us/forums/intel-c-compiler/topic/760979
+               file(READ "${ROOT}/usr/include/math.h" TMPTXT)
+               string(FIND "${TMPTXT}" "_LIB_VERSION_TYPE" FOUND_VERSION)
+               if(NOT FOUND_VERSION)
+                       set(INTEL_MATH_H_HACK ON)
+               endif()
+       endif()
+       set(NAN_CANNOT_BE_USED_AS_INITIALIZER ON) # This hack is only required 
by the Intel compiler
 elseif(MSVC)
        set(_Noreturn "__declspec(noreturn)")
        set(__attribute__(a) ON)
@@ -214,31 +222,6 @@ if(NOT MSVC)
        endif()
 endif()
 
-#Test if compiler can use NAN as an initializer
-check_c_source_compiles("
-       #include <math.h>
-
-       extern const float f;
-       extern const double d;
-       const float f = NAN;
-       const double d = NAN;
-
-       int main(int argc, char **argv) {
-               (void) argc; (void) argv;
-               return 0;
-       }" NAN_CAN_BE_USED_AS_INITIALIZER)
-if(NOT NAN_CAN_BE_USED_AS_INITIALIZER)
-       set(NAN_CANNOT_BE_USED_AS_INITIALIZER ON)
-endif()
-
-if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel" AND EXISTS 
"${ROOT}/usr/include/math.h") # see 
https://software.intel.com/en-us/forums/intel-c-compiler/topic/760979
-       file(READ "${ROOT}/usr/include/math.h" TMPTXT)
-       string(FIND "${TMPTXT}" "_LIB_VERSION_TYPE" FOUND_VERSION)
-       if(NOT FOUND_VERSION)
-               set(INTEL_MATH_H_HACK ON)
-       endif()
-endif()
-
 include(FindPython3)
 find_package(Python3 COMPONENTS Interpreter Development)
 set(PY3_INCLUDE_DIR "")
@@ -412,7 +395,7 @@ set(PSAPI_LIBRARIES "")
 if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
        set(DL_LIBRARIES "${CMAKE_DL_LIBS}")
 endif()
-if(${CMAKE_SYSTEM_NAME} MATCHES "^FreeBSD|DragonFly|NetBSD$")
+if(${CMAKE_SYSTEM_NAME} MATCHES "^FreeBSD|DragonFly|NetBSD$") # Warning - I 
checked the man pages and only tested on FreeBSD yet
        set(KVM_LIBRARIES "kvm")
 endif()
 if(${CMAKE_SYSTEM_NAME} MATCHES "^Linux|FreeBSD|NetBSD$")
@@ -425,13 +408,13 @@ if(WIN32)
        endif()
        set(PSAPI_LIBRARIES "${PSAPI_LIBRARY}")
 
-       find_library(WSOCK32_LIBRARY NAMES Wsock32 wsock32)
+       find_library(WSOCK32_LIBRARY NAMES Wsock32 wsock32 DOC "wsock32 library 
to link on Windows")
        if(WSOCK32_LIBRARY)
                list(APPEND SOCKET_LIBRARIES "${WSOCK32_LIBRARY}")
        else()
                message(FATAL_ERROR "Wsock32 library is missing and required to 
compile MonetDB on Windows")
        endif()
-       find_library(WS2_32_LIBRARY NAMES Ws2_32 ws2_32)
+       find_library(WS2_32_LIBRARY NAMES Ws2_32 ws2_32 DOC "ws2_32 library to 
link on Windows")
        if(WS2_32_LIBRARY)
                list(APPEND SOCKET_LIBRARIES "${WS2_32_LIBRARY}")
        else()
@@ -582,7 +565,7 @@ if(NOT HAVE_${PASSWORD_BACKEND}_UPDATE)
                set(HAVE_COMMONCRYPTO NO)
                set(OPENSSL_FOUND NO)
                set(ENABLE_MONETDB5 "NO")
-               message(WARNING "A crypto library was found, but required 
checksum algorithm was not found, so not disabling MonetDB5")
+               message(WARNING "A crypto library was found, but required 
checksum algorithm was not found, so disabling MonetDB5")
        endif()
 endif()
 
@@ -980,11 +963,10 @@ check_include_file("kvm.h" HAVE_KVM_H)
 check_include_file("libintl.h" HAVE_LIBINTL_H)
 check_include_file("netdb.h" HAVE_NETDB_H)
 check_include_file("pthread.h" HAVE_PTHREAD_H)
-check_include_file("semaphore.h" HAVE_SEMAPHORE_H)
-check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
+check_include_file("stdatomic.h" HAVE_STDATOMIC_H) # C11 include file
 check_include_file("strings.h" HAVE_STRINGS_H)
 check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
-check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
+check_include_file("sys/mman.h" HAVE_SYS_MMAN_H) # For madvise and 
posix_madvise on BSD systems
 check_include_file("sys/param.h" HAVE_SYS_PARAM_H)
 check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
 check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
@@ -994,9 +976,7 @@ check_include_file("sys/time.h" HAVE_SYS
 check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
 check_include_file("sys/uio.h" HAVE_SYS_UIO_H)
 check_include_file("sys/un.h" HAVE_SYS_UN_H)
-check_include_file("termios.h" HAVE_TERMIOS_H)
 check_include_file("unistd.h" HAVE_UNISTD_H)
-check_include_file("winsock.h" HAVE_WINSOCK_H)
 
 cmake_push_check_state()
 if(MSVC)
@@ -1065,14 +1045,12 @@ check_symbol_exists("pipe2" "fcntl.h;uni
 check_symbol_exists("popen" "stdio.h" HAVE_POPEN)
 check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE)
 check_symbol_exists("posix_madvise" "sys/mman.h" HAVE_POSIX_MADVISE)
-check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" 
HAVE_SEMTIMEDOP)
+check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" 
HAVE_SEMTIMEDOP) # Some libc versions on Linux distributions don't have it
 check_symbol_exists("stpcpy" "string.h" HAVE_STPCPY)
 check_symbol_exists("strptime" "time.h" HAVE_STRPTIME)
 check_symbol_exists("strtok_r" "string.h" HAVE_STRTOK_R)
 check_symbol_exists("strtok_s" "string.h" HAVE_STRTOK_S)
-check_symbol_exists("sysconf" "unistd.h" HAVE_SYSCONF)
 check_symbol_exists("times" "sys/times.h" HAVE_TIMES)
-check_symbol_exists("_wfopen_s" "wchar.h" HAVE__WFOPEN) # Check for _wfopen_s 
to avoid warnings
 
 #Test for diff program existance
 find_program(DIFF NAMES gdiff diff DOC "Diff program")
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -156,7 +156,7 @@ static char *nullstring = default_nullst
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
-#ifdef HAVE_TERMIOS_H
+#ifndef NATIVE_WIN32
 #include <termios.h>           /* TIOCGWINSZ/TIOCSWINSZ */
 #endif
 
diff --git a/clients/mapiclient/mnc.c b/clients/mapiclient/mnc.c
--- a/clients/mapiclient/mnc.c
+++ b/clients/mapiclient/mnc.c
@@ -29,7 +29,7 @@
 #ifdef HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
-#ifdef HAVE_WINSOCK_H
+#ifdef NATIVE_WIN32
 # include <winsock.h>
 #endif
 #ifdef HAVE_NETDB_H
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -235,7 +235,7 @@ mnstr_init(void)
 /* #define STREAM_DEBUG 1  */
 /* #define BSTREAM_DEBUG 1 */
 
-#ifdef HAVE__WFOPEN
+#ifdef _MSC_VER
 /* convert a string from UTF-8 to wide characters; the return value is
  * freshly allocated */
 static wchar_t *
@@ -864,7 +864,7 @@ open_stream(const char *restrict filenam
 
        if ((s = create_stream(filename)) == NULL)
                return NULL;
-#ifdef HAVE__WFOPEN
+#ifdef _MSC_VER
        {
                wchar_t *wfname = utf8towchar(filename);
                wchar_t *wflags = utf8towchar(flags);
@@ -1039,7 +1039,7 @@ open_gzstream(const char *restrict filen
 
        if ((s = create_stream(filename)) == NULL)
                return NULL;
-#ifdef HAVE__WFOPEN
+#ifdef _MSC_VER
        {
                wchar_t *wfname = utf8towchar(filename);
                if (wfname != NULL) {
@@ -1255,7 +1255,7 @@ open_bzstream(const char *restrict filen
        fl[0] = flags[0];       /* 'r' or 'w' */
        fl[1] = 'b';            /* always binary */
        fl[2] = '\0';
-#ifdef HAVE__WFOPEN
+#ifdef _MSC_VER
        {
                wchar_t *wfname = utf8towchar(filename);
                wchar_t *wflags = utf8towchar(fl);
@@ -1553,7 +1553,7 @@ open_xzstream(const char *restrict filen
        fl[0] = flags[0];       /* 'r' or 'w' */
        fl[1] = 'b';            /* always binary */
        fl[2] = '\0';
-#ifdef HAVE__WFOPEN
+#ifdef _MSC_VER
        {
                wchar_t *wfname = utf8towchar(filename);
                wchar_t *wflags = utf8towchar(fl);
@@ -1911,7 +1911,7 @@ open_lz4stream(const char *restrict file
        fl[0] = flags[0];       /* 'r' or 'w' */
        fl[1] = 'b';            /* always binary */
        fl[2] = '\0';
-#ifdef HAVE__WFOPEN
+#ifdef _MSC_VER
        {
                wchar_t *wfname = utf8towchar(filename);
                wchar_t *wflags = utf8towchar(fl);
diff --git a/common/stream/stream_socket.h b/common/stream/stream_socket.h
--- a/common/stream/stream_socket.h
+++ b/common/stream/stream_socket.h
@@ -15,7 +15,7 @@
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
-#ifdef HAVE_WINSOCK_H
+#ifdef NATIVE_WIN32
 # include <winsock.h>
 #endif
 
diff --git a/common/utils/prompt.c b/common/utils/prompt.c
--- a/common/utils/prompt.c
+++ b/common/utils/prompt.c
@@ -11,11 +11,9 @@
 #include <unistd.h>
 #endif
 #include <string.h>
-#ifndef _MSC_VER
-#ifdef HAVE_TERMIOS_H
+#ifndef NATIVE_WIN32
 #include <termios.h>
 #endif
-#endif
 #include "mprompt.h"
 
 #ifdef _MSC_VER
@@ -81,7 +79,7 @@ simple_prompt(const char *prompt, int ma
        char *destination = NULL;
        FILE *termin = NULL, *termout = NULL;
 
-#ifdef HAVE_TERMIOS_H
+#ifndef NATIVE_WIN32
        struct termios t_orig, t;
 #else
        (void) echo;
@@ -103,7 +101,7 @@ simple_prompt(const char *prompt, int ma
                termout = stderr;
        }
 
-#ifdef HAVE_TERMIOS_H
+#ifndef NATIVE_WIN32
        if (!echo) {
                tcgetattr(fileno(termin), &t);
                t_orig = t;
@@ -135,7 +133,7 @@ simple_prompt(const char *prompt, int ma
 
        if (length > 0 && destination[length - 1] == '\n')
                destination[length - 1] = '\0';
-#ifdef HAVE_TERMIOS_H
+#ifndef NATIVE_WIN32
        if (!echo) {
                tcsetattr(fileno(termin), TCSAFLUSH, &t_orig);
                fputs("\n", termout);
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -233,8 +233,6 @@
 #ifdef HAVE_PTHREAD_H
 #include <sched.h>
 #include <pthread.h>
-#endif
-#ifdef HAVE_SEMAPHORE_H
 #include <semaphore.h>
 #endif
 
diff --git a/gdk/gdk_posix.h b/gdk/gdk_posix.h
--- a/gdk/gdk_posix.h
+++ b/gdk/gdk_posix.h
@@ -22,13 +22,10 @@
 #include <sys/time.h>          /* gettimeofday */
 #endif
 
-#ifdef HAVE_WINSOCK_H
-#include <winsock.h>           /* for timeval */
-#endif
-
 #include "gdk_system.h" /* gdk_export */
 
 #ifdef NATIVE_WIN32
+#include <winsock.h>           /* for timeval */
 #include <io.h>
 #include <direct.h>
 #endif
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -826,7 +826,7 @@ MT_check_nr_cores(void)
 {
        int ncpus = -1;
 
-#if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
+#if !defined(WIN32) && defined(_SC_NPROCESSORS_ONLN)
        /* this works on Linux, Solaris and AIX */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to