Changeset: 8093767580a7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8093767580a7
Modified Files:
        CMakeLists.txt
        clients/mapiclient/eventparser.c
        clients/mapiclient/mclient.c
        clients/mapiclient/msqldump.c
        clients/odbc/driver/ODBCConvert.c
        cmake/monetdb_config.h.in
        common/utils/msabaoth.c
        common/utils/revision.c
        gdk/gdk_utils.c
        geom/monetdb5/geom.c
        monetdb5/mal/mal_readline.c
        monetdb5/modules/kernel/alarm.c
        monetdb5/modules/mal/clients.c
        sql/server/rel_updates.c
Branch: cmake-fun
Log Message:

Merged monetdb_config.h.in for native Windows Compilation into CMakeLists file, 
so only one header file will be required in the codebase hopefully.


diffs (truncated from 1195 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,7 @@ include(FindIconv REQUIRED)
 include(TestLargeFiles REQUIRED)
 include(CheckCCompilerFlag REQUIRED)
 include(TestBigEndian REQUIRED)
+include(FindBZip2)
 
 cmake_policy(SET CMP0075 NEW)
 
@@ -67,6 +68,19 @@ set(PACKAGE_URL "https://www.monetdb.org
 set(PACKAGE_BUGREPORT "https://bugs.monetdb.org/";)
 set(PACKAGE_VERSION "${VERSION}")
 
+# Check current version control revision
+if(EXISTS "${CMAKE_SOURCE_DIR}/.hg")
+       exec_program("hg" "${CMAKE_SOURCE_DIR}" ARGS "id -i" OUTPUT_VARIABLE 
HG_OUPUT_RES RETURN_VALUE HG_RETURN_CODE)
+       if(HG_RETURN_CODE EQUAL 0 AND HG_OUPUT_RES)
+               set(MERCURIAL_ID "${HG_OUPUT_RES}")
+       endif()
+elseif(EXISTS "${CMAKE_SOURCE_DIR}/.git")
+       exec_program("git" "${CMAKE_SOURCE_DIR}" ARGS "rev-parse HEAD" 
OUTPUT_VARIABLE GIT_OUPUT_RES RETURN_VALUE GIT_RETURN_CODE)
+       if(GIT_RETURN_CODE EQUAL 0 AND GIT_OUPUT_RES)
+               set(MERCURIAL_ID "${GIT_OUPUT_RES}+")
+       endif()
+endif()
+
 if("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-gcc") # Intel compiler hack
 elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
@@ -181,7 +195,7 @@ opj_test_large_files(_LARGE_FILES)
 opj_test_large_files(_LARGEFILE_SOURCE)
 opj_test_large_files(_FILE_OFFSET_BITS)
 
-if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES 
"^GNU|Intel|Clang|MSVC|AppleClang|SunPro$")
+if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "^GNU|Intel|Clang|MSVC|AppleClang$")
        message(WARNING "Compiler potentially not (correctly) recognized")
 endif()
 
@@ -309,6 +323,9 @@ endif()
 if(MSVC OR ${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
        set(WIN32 ON)
 endif()
+if(MSVC)
+       set(__attribute__(a) ON)
+endif()
 
 if(${ENABLE_DEBUG} STREQUAL "YES" AND ${ENABLE_OPTIMIZE} STREQUAL "YES")
        message(FATAL_ERROR " Combining optimize and debug is not possible")
@@ -616,13 +633,12 @@ set(SO_PREFIX    ${OS_SOPREF})
 test_big_endian(WORDS_BIGENDIAN)
 if(APPLE)
        set(AC_APPLE_UNIVERSAL_BUILD ON)
+       set(_DARWIN_USE_64_BIT_INODE ON)
 endif()
 
 # checks for libraries
 set(WITH_BZ2 "AUTO" CACHE STRING "Include bz2 support (default=auto)") # Check 
with HAVE_BZLIB
 if(NOT ${WITH_BZ2} STREQUAL "NO")
-       include(FindBZip2)
-
        if(BZip2_FOUND)
                set(HAVE_BZLIB ON)
                message(STATUS "bz2 library found")
@@ -1560,6 +1576,7 @@ endif()
 
 # Header files
 check_include_file("dirent.h" HAVE_DIRENT_H)
+check_include_file("dispatch/dispatch.h" HAVE_DISPATCH_DISPATCH_H)
 check_include_file("dlfcn.h" HAVE_DLFCN_H)
 check_include_file("execinfo.h" HAVE_EXECINFO_H)
 check_include_file("fcntl.h" HAVE_FCNTL_H)
@@ -1701,8 +1718,12 @@ endif()
 check_type_size(ssize_t SIZEOF_SSIZE_T LANGUAGE C)
 if(HAVE_SIZEOF_SSIZE_T AND NOT "${SIZEOF_SSIZE_T}" STREQUAL "0")
        set(SIZEOF_SSIZE_T ${SIZEOF_SSIZE_T})
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC) # Windows 64 bit
+       set(ssize_t "int64_t")
+       set(SIZEOF_SSIZE_T 8)
 else()
        set(ssize_t "int")
+       set(SIZEOF_SSIZE_T 4)
 endif()
 
 check_type_size(pid_t SIZEOF_PID_T LANGUAGE C)
@@ -1741,13 +1762,6 @@ if(NOT ${ENABLE_INT128} STREQUAL "NO")
        endif()
 endif()
 
-check_type_size(ptrdiff_t PTRDIFF_T LANGUAGE C)
-if(HAVE_PTRDIFF_T AND NOT "${PTRDIFF_T}" STREQUAL "0")
-       set(SIZEOF_PTRDIFF_T ${PTRDIFF_T})
-endif()
-check_type_size(intptr_t INTPTR_T LANGUAGE C)
-check_type_size(uintptr_t UINTPTR_T LANGUAGE C)
-
 check_type_size(char CHAR LANGUAGE C)
 if(HAVE_CHAR AND NOT "${CHAR}" STREQUAL "0")
        set(SIZEOF_CHAR ${CHAR})
@@ -1829,9 +1843,12 @@ endif()
 
 check_symbol_exists("accept4" "sys/types.h;sys/socket.h" HAVE_ACCEPT4)
 check_symbol_exists("asctime_r" "time.h" HAVE_ASCTIME_R)
+check_symbol_exists("asctime_s" "time.h" HAVE_ASCTIME_S3)
 check_symbol_exists("backtrace" "execinfo.h" HAVE_BACKTRACE)
 check_symbol_exists("clock_gettime" "time.h" HAVE_CLOCK_GETTIME)
 check_symbol_exists("ctime_r" "time.h" HAVE_CTIME_R)
+check_symbol_exists("ctime_s" "time.h" HAVE_CTIME_S3)
+check_symbol_exists("dispatch_semaphore_create" "dispatch/dispatch.h" 
HAVE_DISPATCH_SEMAPHORE_CREATE)
 check_symbol_exists("fallocate" "fcntl.h" HAVE_FALLOCATE)
 check_symbol_exists("fcntl" "unistd.h;fcntl.h" HAVE_FCNTL)
 if(NOT(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND CMAKE_SYSTEM_VERSION 
VERSION_LESS_EQUAL 17))
@@ -1840,6 +1857,7 @@ endif()
 check_symbol_exists("fseeko" "stdio.h" HAVE_FSEEKO)
 check_symbol_exists("fsync" "unistd.h" HAVE_FSYNC)
 check_symbol_exists("ftime" "sys/timeb.h" HAVE_FTIME)
+check_symbol_exists("GetDynamicTimeZoneInformation" "Windows.h" 
HAVE_GETDYNAMICTIMEZONEINFORMATION)
 check_symbol_exists("getexecname" "stdlib.h" HAVE_GETEXECNAME)
 check_symbol_exists("getlogin" "unistd.h" HAVE_GETLOGIN)
 check_symbol_exists("getopt" "unistd.h" HAVE_GETOPT)
@@ -1847,7 +1865,9 @@ check_symbol_exists("getopt_long" "unist
 check_symbol_exists("gettimeofday" "sys/time.h" HAVE_GETTIMEOFDAY)
 check_symbol_exists("getuid" "unistd.h;sys/types.h" HAVE_GETUID)
 check_symbol_exists("localtime_r" "time.h" HAVE_LOCALTIME_R)
+check_symbol_exists("localtime_s" "time.h" HAVE_LOCALTIME_S)
 check_symbol_exists("lockf" "unistd.h" HAVE_LOCKF)
+check_symbol_exists("lstat" "sys/types.h;sys/stat.h;unistd.h" HAVE_LSTAT)
 check_symbol_exists("madvise" "sys/mman.h" HAVE_MADVISE)
 check_symbol_exists("mremap" "sys/mman.h" HAVE_MREMAP)
 check_symbol_exists("nl_langinfo" "langinfo.h" HAVE_NL_LANGINFO)
@@ -1866,10 +1886,15 @@ check_symbol_exists("stpcpy" "string.h" 
 check_symbol_exists("strcasestr" "string.h" HAVE_STRCASESTR)
 check_symbol_exists("strncasecmp" "strings.h" HAVE_STRNCASECMP)
 check_symbol_exists("strptime" "time.h" HAVE_STRPTIME) # TODO check 
_XOPEN_SOURCE ?
+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("task_info" "mach/task_info.h" HAVE_TASK_INFO)
 check_symbol_exists("times" "sys/times.h" HAVE_TIMES)
 check_symbol_exists("uname" "sys/utsname.h" HAVE_UNAME)
+check_symbol_exists("_wfopen" "stdio.h" HAVE__WFOPEN)
+check_symbol_exists("_mul128" "intrin.h" HAVE__MUL128)
+check_symbol_exists("_stat64" "sys/types.h;sys/stat.h" HAVE_STAT64)
 
 message(STATUS "Test for __builtin_add_overflow")
 check_c_source_compiles("
diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c
--- a/clients/mapiclient/eventparser.c
+++ b/clients/mapiclient/eventparser.c
@@ -220,8 +220,10 @@ keyvalueparser(char *txt, EventRecord *e
                }
 
                sec = atol(val);
-#ifdef HAVE_LOCALTIME_R
+#if defined(HAVE_LOCALTIME_R)
                (void)localtime_r(&sec, &curr_time);
+#elif defined(HAVE_LOCALTIME_S)
+               (void)localtime_s(&curr_time, &sec);
 #else
                curr_time = *localtime(&sec);
 #endif
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -53,12 +53,7 @@
 #endif
 #endif
 
-#ifndef S_ISCHR
-#define S_ISCHR(m)     (((m) & S_IFMT) == S_IFCHR)
-#endif
-#ifndef S_ISREG
-#define S_ISREG(m)     (((m) & S_IFMT) == S_IFREG)
-#endif
+
 
 enum modes {
        MAL,
diff --git a/clients/mapiclient/msqldump.c b/clients/mapiclient/msqldump.c
--- a/clients/mapiclient/msqldump.c
+++ b/clients/mapiclient/msqldump.c
@@ -199,15 +199,15 @@ main(int argc, char **argv)
                char *p;
                const char *rev = mercurial_revision();
 
-#ifdef HAVE_CTIME_R3
+#if defined(HAVE_CTIME_R3)
                ctime_r(&t, buf, sizeof(buf));
-#else
-#ifdef HAVE_CTIME_R
+#elif defined(HAVE_CTIME_R)
                ctime_r(&t, buf);
+#elif defined(HAVE_CTIME_S3)
+               ctime_s(buf, sizeof(buf), &t);
 #else
                strncpy(buf, ctime(&t), sizeof(buf));
 #endif
-#endif
                if ((p = strrchr(buf, '\n')) != NULL)
                        *p = 0;
 
diff --git a/clients/odbc/driver/ODBCConvert.c 
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -2473,8 +2473,10 @@ ODBCFetch(ODBCStmt *stmt,
 
                case SQL_TYPE_TIME:
                                        (void) time(&t);
-#ifdef HAVE_LOCALTIME_R
+#if defined(HAVE_LOCALTIME_R)
                                        (void) localtime_r(&t, &tm);
+#elif defined(HAVE_LOCALTIME_S)
+                                       (void) localtime_s(&tm, &t);
 #else
                                        tm = *localtime(&t);
 #endif
@@ -3499,8 +3501,10 @@ ODBCStore(ODBCStmt *stmt,
 
                case SQL_C_TYPE_TIME:
                                        (void) time(&t);
-#ifdef HAVE_LOCALTIME_R
+#if defined(HAVE_LOCALTIME_R)
                                        (void) localtime_r(&t, &tm);
+#elif defined(HAVE_LOCALTIME_S)
+                                       (void) localtime_s(&tm, &t);
 #else
                                        tm = *localtime(&t);
 #endif
diff --git a/cmake/monetdb_config.h.in b/cmake/monetdb_config.h.in
--- a/cmake/monetdb_config.h.in
+++ b/cmake/monetdb_config.h.in
@@ -1,9 +1,81 @@
-/* monetdb_config.h.in.  Generated from configure.ac by autoheader.  */
-
+/* monetdb_config.h.in.  Generated from CMakeLists.txt  */
 
 #ifndef _SEEN_MONETDB_CONFIG_H
 #define _SEEN_MONETDB_CONFIG_H 1
 
+/* Define if you do not want assertions */
+#cmakedefine NDEBUG
+
+/* Define if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+/* C99 standard includes */
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <inttypes.h>
+#include <stdbool.h>
+#include <assert.h>
+
+#ifdef _MSC_VER
+#if _MSC_VER < 1800
+#error old versions of Visual Studio are no longer supported
+#endif
+
+/* Prevent pollution through excessive inclusion of include files by 
Windows.h. */
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+
+/* Visual Studio 8 has deprecated lots of stuff: suppress warnings */
+#ifndef _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+
+/* indicate to sqltypes.h that windows.h has already been included and
+   that it doesn't have to define Windows constants */
+#define ALREADY_HAVE_WINDOWS_TYPE 1
+
+#ifndef NATIVE_WIN32
+#define NATIVE_WIN32 1
+#endif
+
+#define ftruncate(fd, sz) (-(_chsize_s((fd), (__int64) (sz)) != 0))
+#define strdup(s)         _strdup(s)
+#ifndef strcasecmp
+#define strcasecmp(x,y)   _stricmp(x,y)
+#endif
+#ifndef strncasecmp
+#define strncasecmp(x,y,z) _strnicmp(x,y,z)
+#endif
+
+#ifdef stat
+#undef stat
+#endif
+#define stat _stat64
+#ifdef fstat
+#undef fstat
+#endif
+#define fstat _fstat64
+
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to