Changeset: ec8e384abd46 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ec8e384abd46 Removed Files: sql/backends/monet5/UDF/capi/capi.h Modified Files: CMakeLists.txt clients/mapilib/CMakeLists.txt common/stream/CMakeLists.txt common/stream/socket_stream.c common/stream/stream_internal.h common/stream/stream_socket.h common/utils/CMakeLists.txt gdk/gdk_posix.h monetdb5/modules/atoms/strptime.c monetdb5/modules/kernel/CMakeLists.txt monetdb5/modules/kernel/microbenchmark.c monetdb5/modules/mal/mal_mapi.c monetdb5/scheduler/run_adder.c monetdb5/scheduler/run_isolate.c monetdb5/scheduler/run_memo.c monetdb_config.h.in sql/backends/monet5/CMakeLists.txt sql/backends/monet5/UDF/capi/CMakeLists.txt sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/sql.c tools/CMakeLists.txt Branch: default Log Message:
Ported to Cygwin. It compiled once. Otherwise untested. diffs (truncated from 492 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,8 +69,10 @@ monetdb_configure_defines() if(HAVE_NETDB_H) set(CMAKE_EXTRA_INCLUDE_FILES "netdb.h" "unistd.h") endif() -if(HAVE_WINSOCK_H) - set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h") +if(NOT HAVE_SYS_SOCKET_H) + if(HAVE_WINSOCK_H) + set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h") + endif() endif() set(CMAKE_REQUIRED_INCLUDES "/usr/include") diff --git a/clients/mapilib/CMakeLists.txt b/clients/mapilib/CMakeLists.txt --- a/clients/mapilib/CMakeLists.txt +++ b/clients/mapilib/CMakeLists.txt @@ -37,11 +37,9 @@ target_link_libraries(mapi stream $<$<PLATFORM_ID:Windows>:ws2_32>) -if(WIN32) - target_compile_definitions(mapi - PRIVATE - LIBMAPI) -endif() +target_compile_definitions(mapi + PRIVATE + LIBMAPI) set_target_properties(mapi PROPERTIES diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt --- a/common/stream/CMakeLists.txt +++ b/common/stream/CMakeLists.txt @@ -52,11 +52,9 @@ target_include_directories(stream $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monetdb>) -if(WIN32) - target_compile_definitions(stream - PRIVATE - LIBSTREAM) -endif() +target_compile_definitions(stream + PRIVATE + LIBSTREAM) target_link_libraries(stream PRIVATE diff --git a/common/stream/socket_stream.c b/common/stream/socket_stream.c --- a/common/stream/socket_stream.c +++ b/common/stream/socket_stream.c @@ -11,6 +11,7 @@ #include "monetdb_config.h" #include "stream.h" #include "stream_internal.h" +#include <sys/time.h> /* ------------------------------------------------------------------ */ diff --git a/common/stream/stream_internal.h b/common/stream/stream_internal.h --- a/common/stream/stream_internal.h +++ b/common/stream/stream_internal.h @@ -174,6 +174,10 @@ struct stream { char errmsg[1024]; // avoid allocation on error. We don't have THAT many streams.. }; +#ifdef __CYGWIN__ +#define __visibility__(a) +#endif + void mnstr_va_set_error(stream *s, mnstr_error_kind kind, const char *fmt, va_list ap) __attribute__((__visibility__("hidden"))); 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 @@ -14,10 +14,11 @@ #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> -#endif +#else #ifdef HAVE_WINSOCK_H # include <winsock.h> #endif +#endif #ifndef INVALID_SOCKET #define INVALID_SOCKET (-1) diff --git a/common/utils/CMakeLists.txt b/common/utils/CMakeLists.txt --- a/common/utils/CMakeLists.txt +++ b/common/utils/CMakeLists.txt @@ -29,12 +29,10 @@ target_link_libraries(mutils PRIVATE monetdb_config_header) -if(WIN32) - target_compile_definitions(mutils PRIVATE - LIBMUTILS - LIBGDK - LIBMEROUTIL) -endif() +target_compile_definitions(mutils PRIVATE + LIBMUTILS + LIBGDK + LIBMEROUTIL) set_target_properties(mutils PROPERTIES @@ -59,13 +57,11 @@ target_link_libraries(mcrypt $<$<BOOL:${OPENSSL_FOUND}>:OpenSSL::Crypto> monetdb_config_header) -if(WIN32) - target_compile_definitions(mcrypt - PRIVATE - LIBMONETDB5 - LIBMAPI - LIBMCRYPT) -endif() +target_compile_definitions(mcrypt + PRIVATE + LIBMONETDB5 + LIBMAPI + LIBMCRYPT) set_target_properties(mcrypt PROPERTIES @@ -97,12 +93,10 @@ target_link_libraries(msabaoth mutils monetdb_config_header) -if(WIN32) - target_compile_definitions(msabaoth - PRIVATE - LIBMSABAOTH - LIBMONETDB5) -endif() +target_compile_definitions(msabaoth + PRIVATE + LIBMSABAOTH + LIBMONETDB5) set_target_properties(msabaoth PROPERTIES diff --git a/gdk/gdk_posix.h b/gdk/gdk_posix.h --- a/gdk/gdk_posix.h +++ b/gdk/gdk_posix.h @@ -20,9 +20,11 @@ #include <sys/time.h> /* gettimeofday */ #endif +#ifndef HAVE_SYS_SOCKET_H #ifdef HAVE_WINSOCK_H #include <winsock.h> /* for timeval */ #endif +#endif #include "gdk_system.h" /* gdk_export */ diff --git a/monetdb5/modules/atoms/strptime.c b/monetdb5/modules/atoms/strptime.c --- a/monetdb5/modules/atoms/strptime.c +++ b/monetdb5/modules/atoms/strptime.c @@ -309,7 +309,7 @@ literal: } while (*bp >= '0' && *bp <= '9'); /* convert the number of seconds to tm structure */ - if (localtime_s(tm, &secs)) + if (localtime_r(&secs, tm) == NULL) return NULL; } break; case 'U': /* The week of year, beginning on sunday. */ diff --git a/monetdb5/modules/kernel/CMakeLists.txt b/monetdb5/modules/kernel/CMakeLists.txt --- a/monetdb5/modules/kernel/CMakeLists.txt +++ b/monetdb5/modules/kernel/CMakeLists.txt @@ -40,11 +40,9 @@ target_include_directories(microbenchmar $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:${INCLUDEDIR}/monetdb>) -if(WIN32) - target_compile_definitions(kernel - PRIVATE - LIBMONETDB5) -endif() +target_compile_definitions(kernel + PRIVATE + LIBMONETDB5) target_link_libraries(kernel PRIVATE @@ -67,7 +65,7 @@ set_target_properties(microbenchmark PROPERTIES OUTPUT_NAME _microbenchmark) -install(TARGETS +install(TARGETS microbenchmark DESTINATION ${CMAKE_INSTALL_LIBDIR}/monetdb5 COMPONENT microbenchmark) diff --git a/monetdb5/modules/kernel/microbenchmark.c b/monetdb5/modules/kernel/microbenchmark.c --- a/monetdb5/modules/kernel/microbenchmark.c +++ b/monetdb5/modules/kernel/microbenchmark.c @@ -20,7 +20,7 @@ #include "mal_exception.h" #include "mal.h" -#ifndef _MSC_VER +#ifndef WIN32 #define __declspec(x) #endif diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c --- a/monetdb5/modules/mal/mal_mapi.c +++ b/monetdb5/modules/mal/mal_mapi.c @@ -44,14 +44,16 @@ # include <CommonCrypto/CommonRandom.h> #endif #endif -#ifdef HAVE_WINSOCK_H /* Windows specific */ -# include <winsock.h> -#else /* UNIX specific */ +#ifdef HAVE_SYS_SOCKET_H # include <sys/select.h> # include <sys/socket.h> # include <unistd.h> /* gethostname() */ # include <netinet/in.h> /* hton and ntoh */ # include <arpa/inet.h> /* addr_in */ +#else /* UNIX specific */ +#ifdef HAVE_WINSOCK_H /* Windows specific */ +# include <winsock.h> +#endif #endif #ifdef HAVE_SYS_UN_H # include <sys/un.h> diff --git a/monetdb5/scheduler/run_adder.c b/monetdb5/scheduler/run_adder.c --- a/monetdb5/scheduler/run_adder.c +++ b/monetdb5/scheduler/run_adder.c @@ -49,7 +49,7 @@ #include "mal_linker.h" #include "mal_client.h" -#ifndef _MSC_VER +#ifndef WIN32 #define __declspec(x) #endif diff --git a/monetdb5/scheduler/run_isolate.c b/monetdb5/scheduler/run_isolate.c --- a/monetdb5/scheduler/run_isolate.c +++ b/monetdb5/scheduler/run_isolate.c @@ -35,7 +35,7 @@ #include "mal_instruction.h" #include "mal_client.h" -#ifndef _MSC_VER +#ifndef WIN32 #define __declspec(x) #endif diff --git a/monetdb5/scheduler/run_memo.c b/monetdb5/scheduler/run_memo.c --- a/monetdb5/scheduler/run_memo.c +++ b/monetdb5/scheduler/run_memo.c @@ -100,7 +100,7 @@ #include "mal_client.h" #include "mal_runtime.h" -#ifndef _MSC_VER +#ifndef WIN32 #define __declspec(x) #endif diff --git a/monetdb_config.h.in b/monetdb_config.h.in --- a/monetdb_config.h.in +++ b/monetdb_config.h.in @@ -28,6 +28,8 @@ #endif +#define _XOPEN_SOURCE 700 + #include <stdlib.h> #if defined(_MSC_VER) && defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC) /* In this case, malloc and friends are redefined in crtdbg.h to debug @@ -66,6 +68,10 @@ #endif /* _MSC_VER */ +#if !defined(WIN32) && defined(__CYGWIN__) +#define WIN32 1 +#endif + // Section: monetdb configure defines #cmakedefine HAVE_DISPATCH_DISPATCH_H 1 #cmakedefine HAVE_DLFCN_H 1 @@ -323,6 +329,10 @@ typedef __uint128_t uhge; #define static_assert(expr, mesg) ((void) 0) #endif _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list