Changeset: 407de2967e0a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=407de2967e0a
Modified Files:
        CMakeLists.txt
        clients/mapiclient/ReadlineTools.c
        clients/mapiclient/mclient.c
        clients/mapiclient/mhelp.c
        clients/mapiclient/mnc.c
        clients/mapilib/mapi.c
        clients/odbc/driver/ODBCConvert.c
        cmake/FindCfitsio.cmake
        cmake/FindLiblas.cmake
        cmake/FindUUID.cmake
        common/stream/stream.c
        common/stream/stream.h
        common/utils/matomic.h
        common/utils/mutils.c
        common/utils/muuid.c
        common/utils/prompt.c
        gdk/CMakeLists.txt
        gdk/gdk.h
        gdk/gdk_hash.c
        gdk/gdk_imprints.c
        gdk/gdk_join.c
        gdk/gdk_posix.c
        gdk/gdk_storage.c
        gdk/gdk_system.h
        gdk/gdk_utils.c
        geom/monetdb5/geom.c
        monetdb5/mal/mal.h
        monetdb5/mal/mal_instruction.h
        monetdb5/mal/mal_profiler.h
        monetdb5/mal/mal_scenario.c
        monetdb5/modules/atoms/strptime.c
        monetdb5/modules/atoms/uuid.c
        monetdb5/modules/kernel/status.c
        monetdb5/scheduler/run_pipeline.h
        monetdb_config.h.in
        sql/backends/monet5/vaults/fits/fits.c
        sql/server/CMakeLists.txt
        tools/merovingian/daemon/CMakeLists.txt
        tools/mserver/CMakeLists.txt
        tools/mserver/mserver5.c
Branch: cmake-fun
Log Message:

Continuing cleanup:

- Removed check for header files that are required for a single existence of a 
symbol.
- Fixed readline library tests (used the same cmake cache variable for all 
tests).
- getaddrinfo and shutdown symbols are available on all platforms we compile 
for.
- Other symbols are not available just on Windows, then a NATIVE_WIN32 macro 
check should suffice.
- strncasecmp is available on all platforms but Windows where we use _strnicmp.
- Brought back KVM libraries code, because I thought it was for a deprecated 
virtualization project, but actually is a library on BSD systems.


diffs (truncated from 1792 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,9 +15,7 @@ set(CMAKE_C_STANDARD 99)
 set(PACKAGE "MonetDB" CACHE STRING "MonetDB, SQL queries at light speed")
 
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" CACHE INTERNAL "Location of 
custom CMake modules.")
-include(CheckCCompilerFlag REQUIRED)
 include(CheckCSourceCompiles REQUIRED)
-include(CheckCSourceRuns REQUIRED)
 include(CheckIncludeFile REQUIRED)
 include(CheckIncludeFiles REQUIRED)
 include(CMakePushCheckState REQUIRED)
@@ -219,6 +217,9 @@ elseif(MSVC)
        set(__attribute__(a) ON)
        set(restrict "__restrict")
        add_compile_definitions(_CRT_SECURE_NO_WARNINGS 
_CRT_SECURE_NO_DEPRECATE _WINSOCK_DEPRECATED_NO_WARNINGS)
+       if(CMAKE_SIZEOF_VOID_P EQUAL 8)  # Windows 64 bit
+               set(HAVE__MUL128 ON)
+       endif()
 endif()
 
 # Tests for large files support
@@ -300,7 +301,7 @@ include(FindPython3)
 find_package(Python2 COMPONENTS Interpreter Development)
 find_package(Python3 COMPONENTS Interpreter Development)
 if(Python2_FOUND)
-       if(Python2_VERSION_MINOR LESS 6)
+       if(${Python2_VERSION_MINOR} VERSION_LESS 6)
                message(WARNING "Python 2 executable is too old (<2.6)")
        else()
                set(HAVE_PYTHON2 YES)
@@ -310,7 +311,7 @@ if(Python2_FOUND)
        endif()
 endif()
 if(Python3_FOUND)
-       if(Python3_VERSION_MINOR LESS 5)
+       if(${Python3_VERSION_MINOR} VERSION_LESS 5)
                message(WARNING "Python 3 executable is too old (<3.5)")
        else()
                set(HAVE_PYTHON3 YES)
@@ -319,7 +320,7 @@ if(Python3_FOUND)
                set(PYTHON3 "${Python3_EXECUTABLE}")
        endif()
 endif()
-if(HAVE_PYTHON2 OR HAVE_PYTHON2)
+if(HAVE_PYTHON2 OR HAVE_PYTHON3)
        set(HAVE_PYTHON YES)
        if(HAVE_PYTHON2) # Prioritize python 2 over python 3
                exec_program("${PYTHON2}" ARGS "-c \"import 
distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib(1,0,'${LIBDIR}'))\"" OUTPUT_VARIABLE 
PYTHON2_LIBDIR RETURN_VALUE PYTHON2_LIBDIR_CODE)
@@ -383,7 +384,7 @@ if(WIN32)
        set(CMAKE_SHARED_MODULE_PREFIX "${SO_PREFIX}" CACHE STRING "Library 
module name prefix" FORCE)
        set(CMAKE_STATIC_LIBRARY_PREFIX "${SO_PREFIX}" CACHE STRING "Static 
Library name prefix" FORCE)
        set(COMPILER_OPTION "/") # Used for Intel compiler available on Windows 
and Linux
-elseif(UNIX OR APPLE OR ${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
+elseif(UNIX)
        set(OS_DIRSEP  "/")
        set(OS_PATHSEP ":")
        set(SO_PREFIX  "${CMAKE_SHARED_LIBRARY_PREFIX}")
@@ -413,37 +414,10 @@ set(ICONV_LIBRARIES "")
 include(FindIconv)
 if(Iconv_FOUND)
        set(HAVE_ICONV ON)
-       set(HAVE_ICONV_H ON)
-       cmake_push_check_state()
        if(NOT Iconv_IS_BUILT_IN)
                set(ICONV_INCLUDE_DIR "${Iconv_INCLUDE_DIR}")
                set(ICONV_LIBRARIES "${Iconv_LIBRARY}")
-               set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};${ICONV_LIBRARIES}")
        endif()
-
-       if(MSVC)
-               set(ICONV_CONST " ")
-       else()
-               #Test if second iconv argument requires const
-               check_c_source_compiles("
-                       #include <iconv.h>
-
-                       int main(int argc, char **argv) {
-                               iconv_t conv = 0;
-                               char* in, *out = 0;
-                               size_t ilen = 0, olen = 0;
-                               (void) argc; (void) argv;
-                               iconv(conv, &in, &ilen, &out, &olen);
-                               return 0;
-                       }
-               " ICONV_NOT_REQUIRES_CONST)
-               if(ICONV_NOT_REQUIRES_CONST)
-                       set(ICONV_CONST " ")
-               else()
-                       set(ICONV_CONST const)
-               endif()
-       endif()
-       cmake_pop_check_state()
 endif()
 
 set(WITH_BZ2 "AUTO" CACHE STRING "Include bz2 support (default=AUTO)") # Check 
with BZip2_FOUND
@@ -500,21 +474,40 @@ if(NOT HAVE_LIBLZ4)
        set(LZ4_LIBRARIES "")
 endif()
 
+# Extra libraries
 set(DL_LIBRARIES "")
+set(KVM_LIBRARIES "")
 set(MATH_LIBRARIES "")
+set(SOCKET_LIBRARIES )
 set(PSAPI_LIBRARIES "")
-if(UNIX)
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
        set(DL_LIBRARIES "${CMAKE_DL_LIBS}")
+endif()
+if(${CMAKE_SYSTEM_NAME} MATCHES "^FreeBSD|DragonFly|NetBSD$")
+       set(KVM_LIBRARIES "kvm")
+endif()
+if(${CMAKE_SYSTEM_NAME} MATCHES "^Linux|FreeBSD|NetBSD$")
        set(MATH_LIBRARIES "m")
 endif()
 if(WIN32)
-       find_library(PSAPI_LIBRARY NAMES Psapi psapi DOC "psapi library to 
link")
-       if("${PSAPI_LIBRARY}" STREQUAL "")
+       find_library(PSAPI_LIBRARY NAMES Psapi psapi DOC "psapi library to link 
on Windows")
+       if(NOT PSAPI_LIBRARY)
                message(FATAL_ERROR "Psapi library is required to compile 
MonetDB on Windows")
        endif()
-endif()
-if(PSAPI_LIBRARY)
        set(PSAPI_LIBRARIES "${PSAPI_LIBRARY}")
+
+       find_library(WSOCK32_LIBRARY NAMES Wsock32 wsock32)
+       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)
+       if(WS2_32_LIBRARY)
+               list(APPEND SOCKET_LIBRARIES "${WS2_32_LIBRARY}")
+       else()
+               message(FATAL_ERROR "ws2_32 library is missing and required to 
compile MonetDB on Windows")
+       endif()
 endif()
 
 # Thread libraries
@@ -529,26 +522,26 @@ check_symbol_exists("pthread_kill" "sign
 check_symbol_exists("pthread_sigmask" "signal.h" HAVE_PTHREAD_SIGMASK)
 cmake_pop_check_state()
 
-# Readline libs
+# Readline libraries
 set(READLINE_LIBRARIES "")
 set(WITH_READLINE "AUTO" CACHE PATH "Include readline support (default=AUTO)") 
# Check with HAVE_LIBREADLINE
 if(NOT ${WITH_READLINE} STREQUAL "NO")
        cmake_push_check_state()
        set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};readline")
-       check_symbol_exists("readline" 
"stdio.h;readline/readline.h;readline/history.h" HAVE_LIBREADLINE)
-       if(HAVE_LIBREADLINE)
+       check_symbol_exists("readline" 
"stdio.h;readline/readline.h;readline/history.h" HAVE_READLINE)
+       if(HAVE_READLINE)
                list(APPEND READLINE_LIBRARIES readline)
        else()
                set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};termcap")
-               check_symbol_exists("rl_history_search_forward" 
"stdio.h;readline/readline.h;readline/history.h" HAVE_LIBREADLINE)
-               if(HAVE_LIBREADLINE)
+               check_symbol_exists("rl_history_search_forward" 
"stdio.h;readline/readline.h;readline/history.h" HAVE_RL_HISTORY_SEARCH_FORWARD)
+               if(HAVE_RL_HISTORY_SEARCH_FORWARD)
                        list(APPEND READLINE_LIBRARIES termcap)
                else()
                        cmake_pop_check_state()
                        cmake_push_check_state()
                        set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};readline;ncurses")
-                       check_symbol_exists("rl_reverse_search_history" 
"stdio.h;readline/readline.h;readline/history.h" HAVE_LIBREADLINE)
-                       if(HAVE_LIBREADLINE)
+                       check_symbol_exists("rl_reverse_search_history" 
"stdio.h;readline/readline.h;readline/history.h" HAVE_RL_REVERSE_SEARCH_HISTORY)
+                       if(HAVE_RL_REVERSE_SEARCH_HISTORY)
                                list(APPEND READLINE_LIBRARIES ncurses)
                        elseif(${WITH_READLINE} STREQUAL "YES")
                                message(FATAL_ERROR "Readline library not 
found")
@@ -557,18 +550,24 @@ if(NOT ${WITH_READLINE} STREQUAL "NO")
                        endif()
                endif()
        endif()
+       if(HAVE_READLINE OR HAVE_RL_HISTORY_SEARCH_FORWARD OR 
HAVE_RL_REVERSE_SEARCH_HISTORY)
+               check_symbol_exists("rl_completion_matches" 
"stdio.h;readline/readline.h" HAVE_RL_COMPLETION_MATCHES)
+               if(HAVE_RL_COMPLETION_MATCHES)
+                       check_c_source_compiles("
+                               #include <stdio.h>
+                               #include <readline/readline.h>
 
-       if(HAVE_LIBREADLINE)
-               check_symbol_exists("rl_completion_matches" 
"stdio.h;readline/readline.h" HAVE_LIBREADLINE)
-               if(HAVE_LIBREADLINE)
-                       #Checking whether rl_completion_func_t exists
-                       check_symbol_exists("rl_completion_func_t" 
"stdio.h;readline/readline.h" HAVE_LIBREADLINE)
-                       if(NOT HAVE_LIBREADLINE)
-                               if(${WITH_READLINE} STREQUAL "YES")
-                                       message(FATAL_ERROR 
"readline/readline.h does not contain rl_completion_func_t, is it GNU 
readline?")
-                               else()
-                                       message(WARNING "readline/readline.h 
does not contain rl_completion_func_t, is it GNU readline?")
-                               endif()
+                               int main(int argc, char **argv) {
+                                       rl_completion_func_t *func = NULL;
+                                       (void) argc;(void) argv;
+                                       return 0;
+                               }" HAVE_RL_COMPLETION_FUNC_T)
+                       if(HAVE_RL_COMPLETION_FUNC_T)
+                               set(HAVE_LIBREADLINE ON)
+                       elseif(${WITH_READLINE} STREQUAL "YES")
+                               message(FATAL_ERROR "readline/readline.h does 
not contain rl_completion_func_t, is it GNU readline?")
+                       else()
+                               message(WARNING "readline/readline.h does not 
contain rl_completion_func_t, is it GNU readline?")
                        endif()
                elseif(${WITH_READLINE} STREQUAL "YES")
                        message(FATAL_ERROR "Readline library does not contain 
rl_completion_matches")
@@ -599,7 +598,7 @@ endif()
 
 # OpenSSL or CommonCrypto library
 cmake_push_check_state()
-if(APPLE)
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
        set(CRYPTO_LIBRARY_NAME "CommonCrypto")
        include(FindCommonCrypto)
 
@@ -833,10 +832,8 @@ set(ODBCINST_LIBRARIES "")
 set(ODBC_LIBRARIES "")
 set(WITH_ODBC "AUTO" CACHE STRING "Compile the MonetDB ODBC driver 
(default=AUTO)") # Check with HAVE_ODBC
 if(NOT ${WITH_ODBC} STREQUAL "NO")
-       find_path(ODBCINST_INCLUDE odbcinst.h)
-       if(ODBCINST_INCLUDE)
-               set(HAVE_ODBCINST_H YES)
-
+       find_path(HAVE_ODBCINST_H odbcinst.h)
+       if(HAVE_ODBCINST_H)
                if(MSVC)
                        set(HAVE_SQLGETPRIVATEPROFILESTRING ON)
                        if(CMAKE_SIZEOF_VOID_P EQUAL 8) # Windows 64 bit
@@ -902,7 +899,7 @@ if(NOT ${WITH_ODBC} STREQUAL "NO")
                        endif()
 
                        message(STATUS "Checking SQLColAttribute uses SQLLEN * 
or SQLPOINTER")
-                       check_c_source_runs("
+                       check_c_source_compiles("
                                #include <sql.h>
 
                                SQLRETURN SQL_API
@@ -910,7 +907,6 @@ if(NOT ${WITH_ODBC} STREQUAL "NO")
                                        (void) hStmt; (void) nCol; (void) 
nFieldIdentifier; (void) pszValue; (void) nValueLengthMax; (void) 
pnValueLength; (void) pnValue;
                                        return SQL_SUCCESS;
                                }
-
                                int main(int argc, char **argv) {
                                        (void) argc; (void) argv;
                                        return SQLColAttribute(0,0,0,0,0,0,0);
@@ -924,13 +920,10 @@ if(NOT ${WITH_ODBC} STREQUAL "NO")
                                set(LENP_OR_POINTER_T "SQLPOINTER")
                        endif()
 
+                       cmake_push_check_state()
                        set(CMAKE_EXTRA_INCLUDE_FILES 
"${CMAKE_EXTRA_INCLUDE_FILES};sql.h")
                        check_type_size(SQLWCHAR SIZEOF_SQLWCHAR LANGUAGE C)
-                       if(NOT HAVE_SIZEOF_SQLWCHAR OR "${SIZEOF_SQLWCHAR}" 
STREQUAL "0")
-                               message(STATUS "could not determine the size of 
SQLWCHAR")
-                       else()
-                               set(SIZEOF_SQLWCHAR ${SIZEOF_SQLWCHAR})
-                       endif()
+                       cmake_pop_check_state()
 
                        if(ODBCINST_LIBRARY AND ODBC_LIBRARY)
                                set(HAVE_ODBC YES)
@@ -1112,23 +1105,17 @@ 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)
 check_include_file("getopt.h" HAVE_GETOPT_H)
 check_include_file("io.h" HAVE_IO_H)
-check_include_file("langinfo.h" HAVE_LANGINFO_H)
-check_include_file("libgen.h" HAVE_LIBGEN_H)
+check_include_file("kvm.h" HAVE_KVM_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("netdb.h" HAVE_NETDB_H)
-check_include_file("pwd.h" HAVE_PWD_H)
 check_include_file("stdatomic.h" HAVE_STDATOMIC_H)
 check_include_file("strings.h" HAVE_STRINGS_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)
@@ -1137,101 +1124,48 @@ check_include_file("sys/socket.h" HAVE_S
 check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
 check_include_files("sys/param.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H) # on 
OpenBSD, sys/sysctl.h requires sys/param.h to be included beforehand
 check_include_file("sys/time.h" HAVE_SYS_TIME_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)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to