Changeset: d2820a8eb16f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d2820a8eb16f
Modified Files:
        clients/mapiclient/mclient.c
        clients/odbc/winsetup/CMakeLists.txt
        cmake/monetdb-defines.cmake
        cmake/monetdb-findpackages.cmake
        common/options/CMakeLists.txt
        common/stream/stream.c
        gdk/gdk_bbp.c
        monetdb_config.h.in
        monetdb_config_win32.h.in
        testing/CMakeLists.txt
        tools/merovingian/daemon/forkmserver.c
Branch: default
Log Message:

Some changes to cmake setup for Windows.

Changed calls to find_path to check_include_file because otherwise
fcntl.h is not found.

This also has the consequence that two Windows-specific blurbs using
HAVE_GETOPT_H and HAVE_AFXRES_H had to be removed: the include paths
are already found in the vcpkg include directory anyway.

Removed check for S_ISDIR in sys/stat.h and replaced that with a check
for the presence of sys/stat.h and ifdefs in the affected files.
sys/stat.h has to be included (if possible) whether S_ISDIR exists or
not.

Removed separate checks for iconv.h and langinfo.h.  If iconv and
nl_langinfo are available, then so are the include files.


diffs (255 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -44,15 +44,11 @@
 #include <locale.h>
 
 #ifdef HAVE_ICONV
-#ifdef HAVE_ICONV_H
 #include <iconv.h>
-#endif
 #ifdef HAVE_NL_LANGINFO
-#ifdef HAVE_LANGINFO_H
 #include <langinfo.h>
 #endif
 #endif
-#endif
 
 #ifndef S_ISCHR
 #define S_ISCHR(m)     (((m) & S_IFMT) == S_IFCHR)
diff --git a/clients/odbc/winsetup/CMakeLists.txt 
b/clients/odbc/winsetup/CMakeLists.txt
--- a/clients/odbc/winsetup/CMakeLists.txt
+++ b/clients/odbc/winsetup/CMakeLists.txt
@@ -17,8 +17,8 @@ target_sources(MonetODBCs
   resource.h)
 
 target_include_directories(MonetODBCs
-  PRIVATE
-  $<$<PLATFORM_ID:Windows>:${HAVE_AFXRES_H}>
+#  PRIVATE
+#  $<$<PLATFORM_ID:Windows>:${HAVE_AFXRES_H}>
   PUBLIC
   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monetdb>)
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -11,44 +11,43 @@
 # additional variables, for example for legacy defines, do this
 # in the "monetdb_macro_variables" macro.
 function(monetdb_configure_defines)
-  find_path(HAVE_SYS_TYPES_H "sys/types.h")
-  find_path(HAVE_DISPATCH_DISPATCH_H "dispatch/dispatch.h")
-  find_path(HAVE_DLFCN_H "dlfcn.h")
-  find_path(HAVE_FCNTL_H "fcntl.h")
-  find_path(HAVE_ICONV_H "iconv.h")
-  find_path(HAVE_IO_H "io.h")
-  find_path(HAVE_KVM_H "kvm.h")
-  find_path(HAVE_LANGINFO_H "langinfo.h")
-  find_path(HAVE_LIBGEN_H "libgen.h")
-  find_path(HAVE_LIBINTL_H "libintl.h")
-  find_path(HAVE_MACH_MACH_INIT_H "mach/mach_init.h")
-  find_path(HAVE_MACH_TASK_H "mach/task.h")
-  find_path(HAVE_MACH_O_DYLD_H "mach-o/dyld.h")
-  find_path(HAVE_NETINET_IN_H "netinet/in.h")
-  find_path(HAVE_POLL_H "poll.h")
-  find_path(HAVE_PROCFS_H "procfs.h")
-  find_path(HAVE_PWD_H "pwd.h")
-  find_path(HAVE_STRINGS_H "strings.h")
-  find_path(HAVE_STROPTS_H "stropts.h")
-  find_path(HAVE_SYS_FILE_H "sys/file.h")
-  find_path(HAVE_SYS_IOCTL_H "sys/ioctl.h")
-  find_path(HAVE_SYS_SYSCTL_H "sys/sysctl.h")
-  find_path(HAVE_SYS_MMAN_H "sys/mman.h")
-  find_path(HAVE_SYS_PARAM_H "sys/param.h")
-  find_path(HAVE_SYS_RESOURCE_H "sys/resource.h")
-  find_path(HAVE_SYS_TIMES_H "sys/times.h")
-  find_path(HAVE_SYS_UIO_H "sys/uio.h")
-  find_path(HAVE_SYS_UN_H "sys/un.h")
-  find_path(HAVE_SYS_UTIME_H "sys/utime.h")
-  find_path(HAVE_SYS_WAIT_H "sys/wait.h")
-  find_path(HAVE_TERMIOS_H "sys/termios.h")
-  find_path(HAVE_UNISTD_H "unistd.h")
-  find_path(HAVE_UUID_UUID_H "uuid/uuid.h")
-  find_path(HAVE_WINSOCK_H "winsock2.h")
-  find_path(HAVE_SEMAPHORE_H "semaphore.h")
-  find_path(HAVE_GETOPT_H "getopt.h")
+  check_include_file("dispatch/dispatch.h" HAVE_DISPATCH_DISPATCH_H)
+  check_include_file("dlfcn.h" HAVE_DLFCN_H)
+  check_include_file("fcntl.h" HAVE_FCNTL_H)
+  check_include_file("getopt.h" HAVE_GETOPT_H)
+  check_include_file("io.h" HAVE_IO_H)
+  check_include_file("kvm.h" HAVE_KVM_H)
+  check_include_file("libgen.h" HAVE_LIBGEN_H)
+  check_include_file("libintl.h" HAVE_LIBINTL_H)
+  check_include_file("mach/mach_init.h" HAVE_MACH_MACH_INIT_H)
+  check_include_file("mach/task.h" HAVE_MACH_TASK_H)
+  check_include_file("mach-o/dyld.h" HAVE_MACH_O_DYLD_H)
+  check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
+  check_include_file("poll.h" HAVE_POLL_H)
+  check_include_file("procfs.h" HAVE_PROCFS_H)
+  check_include_file("pwd.h" HAVE_PWD_H)
+  check_include_file("semaphore.h" HAVE_SEMAPHORE_H)
+  check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
+  check_include_file("strings.h" HAVE_STRINGS_H)
+  check_include_file("stropts.h" HAVE_STROPTS_H)
+  check_include_file("sys/file.h" HAVE_SYS_FILE_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/param.h" HAVE_SYS_PARAM_H)
+  check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
+  check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
+  check_include_file("sys/sysctl.h" HAVE_SYS_SYSCTL_H)
+  check_include_file("sys/termios.h" HAVE_TERMIOS_H)
+  check_include_file("sys/times.h" HAVE_SYS_TIMES_H)
+  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("sys/utime.h" HAVE_SYS_UTIME_H)
+  check_include_file("sys/wait.h" HAVE_SYS_WAIT_H)
+  check_include_file("unistd.h" HAVE_UNISTD_H)
+  check_include_file("uuid/uuid.h" HAVE_UUID_UUID_H)
+  check_include_file("winsock2.h" HAVE_WINSOCK_H)
 
-  check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
   find_library(GETOPT_LIB "getopt.lib")
 
   check_symbol_exists("opendir" "dirent.h" HAVE_DIRENT_H)
@@ -56,7 +55,6 @@ function(monetdb_configure_defines)
   check_symbol_exists("setsockopt" "sys/socket.h" HAVE_SYS_SOCKET_H)
   check_symbol_exists("gettimeofday" "sys/time.h" HAVE_SYS_TIME_H)
   # Linux specific, in the future, it might be ported to other platforms
-  check_symbol_exists("S_ISREG" "sys/stat.h" HAVE_SYS_STAT_H)
   check_symbol_exists("getaddrinfo" "sys/types.h;sys/socket.h;netdb.h" 
UNIX_GETADDRINFO)
   check_symbol_exists("getaddrinfo" "ws2tcpip.h" WIN_GETADDRINFO)
   #check_symbol_exists("WSADATA" "winsock2.h" HAVE_WINSOCK_H)
diff --git a/cmake/monetdb-findpackages.cmake b/cmake/monetdb-findpackages.cmake
--- a/cmake/monetdb-findpackages.cmake
+++ b/cmake/monetdb-findpackages.cmake
@@ -109,7 +109,7 @@ if(ODBC)
     set(CMAKE_REQUIRED_INCLUDES 
"${CMAKE_REQUIRED_INCLUDES};${ODBC_INCLUDE_DIR}")
     if(WIN32)
       set(CMAKE_EXTRA_INCLUDE_FILES 
"${CMAKE_EXTRA_INCLUDE_FILES};Windows.h;sqlext.h;sqltypes.h")
-      find_path(HAVE_AFXRES_H "afxres.h")
+      check_include_file("afxres.h" HAVE_AFXRES_H)
     else()
       set(CMAKE_EXTRA_INCLUDE_FILES 
"${CMAKE_EXTRA_INCLUDE_FILES};sql.h;sqltypes.h")
     endif()
diff --git a/common/options/CMakeLists.txt b/common/options/CMakeLists.txt
--- a/common/options/CMakeLists.txt
+++ b/common/options/CMakeLists.txt
@@ -20,8 +20,6 @@ target_sources(moptions
   ${moptions_public_headers})
 
 target_include_directories(moptions
-  PRIVATE
-  $<$<PLATFORM_ID:Windows>:${HAVE_GETOPT_H}>
   PUBLIC
   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
   $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/monetdb>)
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -101,10 +101,8 @@
 #endif
 
 #ifdef HAVE_ICONV
-#ifdef HAVE_ICONV_H
 #include <iconv.h>
-#endif
-#ifdef HAVE_LANGINFO_H
+#ifdef HAVE_NL_LANGINFO
 #include <langinfo.h>
 #endif
 #endif
@@ -132,6 +130,10 @@
 #define fileno(fd) _fileno(fd)
 #endif
 
+#ifndef S_ISREG
+#define S_ISREG(mode)  (((mode) & _S_IFMT) == _S_IFREG)
+#endif
+
 #define UTF8BOM                "\xEF\xBB\xBF"  /* UTF-8 encoding of Unicode 
BOM */
 #define UTF8BOMLENGTH  3               /* length of above */
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -82,6 +82,9 @@
 #ifdef _MSC_VER
 #define access(f, m)   _access(f, m)
 #endif
+#ifndef S_ISDIR
+#define S_ISDIR(mode)  (((mode) & _S_IFMT) == _S_IFDIR)
+#endif
 
 /*
  * The BBP has a fixed address, so re-allocation due to a growing BBP
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -30,10 +30,8 @@
 #cmakedefine HAVE_DISPATCH_DISPATCH_H 1
 #cmakedefine HAVE_DLFCN_H 1
 #cmakedefine HAVE_FCNTL_H 1
-#cmakedefine HAVE_ICONV_H 1
 #cmakedefine HAVE_IO_H 1
 #cmakedefine HAVE_KVM_H 1
-#cmakedefine HAVE_LANGINFO_H 1
 #cmakedefine HAVE_LIBGEN_H 1
 #cmakedefine HAVE_LIBINTL_H 1
 #cmakedefine HAVE_MACH_MACH_INIT_H 1
diff --git a/monetdb_config_win32.h.in b/monetdb_config_win32.h.in
--- a/monetdb_config_win32.h.in
+++ b/monetdb_config_win32.h.in
@@ -82,13 +82,6 @@
 #endif
 #define fstat _fstat64
 
-#ifndef S_ISREG
-#define S_ISREG(mode)   (((mode) & _S_IFMT) == _S_IFREG)
-#endif
-#ifndef S_ISDIR
-#define S_ISDIR(mode)  (((mode) & _S_IFMT) == _S_IFDIR)
-#endif
-
 /* Does your compiler support `restrict' keyword? (C99 feature) */
 #ifndef restrict
 #cmakedefine restrict @restrict@
@@ -126,7 +119,6 @@ stpcpy(char *restrict dst, const char *r
 // Section: monetdb configure defines
 #cmakedefine HAVE_DLFCN_H 1
 #cmakedefine HAVE_FCNTL_H 1
-#cmakedefine HAVE_ICONV_H 1
 #cmakedefine HAVE_STRINGS_H 1
 #cmakedefine HAVE_SYS_MMAN_H 1
 #cmakedefine HAVE_SYS_UN_H 1
diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt
--- a/testing/CMakeLists.txt
+++ b/testing/CMakeLists.txt
@@ -89,10 +89,6 @@ endif()
 
 add_executable(Mdiff)
 
-target_include_directories(Mdiff
-  PRIVATE
-  $<$<PLATFORM_ID:Windows>:${HAVE_GETOPT_H}>)
-
 target_sources(Mdiff
   PRIVATE
   difflib.c
diff --git a/tools/merovingian/daemon/forkmserver.c 
b/tools/merovingian/daemon/forkmserver.c
--- a/tools/merovingian/daemon/forkmserver.c
+++ b/tools/merovingian/daemon/forkmserver.c
@@ -26,6 +26,10 @@
 #include "multiplex-funnel.h" /* multiplexInit */
 #include "forkmserver.h"
 
+#ifndef S_ISDIR
+#define S_ISDIR(mode)  (((mode) & _S_IFMT) == _S_IFDIR)
+#endif
+
 /**
  * The terminateProcess function tries to let the given mserver process
  * shut down gracefully within a given time-out.  If that fails, it
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to