Changeset: 65a6800e31b7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65a6800e31b7
Modified Files:
        CMakeLists.txt
        clients/mapiclient/msqldump.c
        common/utils/msabaoth.c
        gdk/gdk_private.h
        gdk/gdk_system_private.h
        gdk/gdk_utils.c
        geom/lib/libgeom.h
        monetdb5/mal/mal.h
        monetdb5/mal/mal_private.h
        monetdb5/modules/atoms/blob.h
        monetdb5/modules/kernel/alarm.c
        monetdb5/modules/mal/clients.c
        monetdb5/optimizer/opt_reorder.c
        monetdb_config.h.in
        sql/backends/monet5/UDF/pyapi/undef.h
        sql/server/CMakeLists.txt
Branch: cmake-fun
Log Message:

Major cleanup: removed old compiler checks, Solaris compilation checks, C99 
checks, unused preprocessor macros.


diffs (truncated from 1438 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,12 +27,9 @@ include(CheckTypeSize REQUIRED)
 include(TestBigEndian REQUIRED)
 include(TestLargeFiles REQUIRED)
 
-cmake_policy(SET CMP0075 NEW)
+cmake_policy(SET CMP0075 NEW) # Include file check macros honor 
CMAKE_REQUIRED_LIBRARIES
 
-# Save default cmake options in the begining
-set(PREV_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
-
-# set host data
+# Set host information
 string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" CMAKE_SYSTEM_PROCESSOR_LOWER)
 string(TOLOWER "${CMAKE_SYSTEM_NAME}" CMAKE_SYSTEM_NAME_LOWER)
 string(TOLOWER "${CMAKE_C_COMPILER_ID}" CMAKE_C_COMPILER_ID_LOWER)
@@ -86,11 +83,11 @@ if(NOT CMAKE_BUILD_TYPE)
        message(STATUS "Setting build type to Debug as none was selected")
        set(CMAKE_BUILD_TYPE Debug CACHE STRING "The type of build" FORCE)
 endif()
-if(EXISTS "${CMAKE_SOURCE_DIR}/vertoo.data")
+if(MERCURIAL_ID) # Developers compiling from Mercurial
        set(DFT_STRICT "YES")
        set(DFT_ASSERT "YES")
        set(DFT_DEVELOPER "YES")
-else()
+else() # Users compiling from source tarball(s):
        set(DFT_STRICT "NO")
        set(DFT_ASSERT "NO")
        set(DFT_DEVELOPER "NO")
@@ -168,11 +165,8 @@ if(NOT ${ENABLE_STATIC_ANALYSIS} STREQUA
 endif()
 
 set(SOURCE "${CMAKE_SOURCE_DIR}")
-set(PREFIX "${CMAKE_INSTALL_PREFIX}")
-set(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}")
-
 if(WIN32)
-       string(REPLACE "/" "\\\\" TRIMMED_INSTALL_PREFIX 
"${CMAKE_INSTALL_PREFIX}")
+       string(REPLACE "/" "\\\\" TRIMMED_INSTALL_PREFIX 
"${CMAKE_INSTALL_PREFIX}") # Fix cmake conversions
        set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
        set(BIN_DIR "${TRIMMED_INSTALL_PREFIX}\\\\bin")
        set(DATADIR "${CMAKE_INSTALL_PREFIX}/share")
@@ -209,8 +203,8 @@ set(PROGRAM_PERMISSIONS_DEFAULT OWNER_WR
 # password hash algorithm
 set(PASSWORD_BACKEND "SHA512" CACHE STRING "Password hash algorithm, one of 
MD5, SHA1, RIPEMD160, SHA224, SHA256, SHA384, SHA512, defaults to SHA512")
 if(${PASSWORD_BACKEND} MATCHES 
"^MD5|SHA1|RIPEMD160|SHA224|SHA256|SHA384|SHA512$")
-       set("MONETDB5_PASSWDHASH" ${PASSWORD_BACKEND})
-       set("MONETDB5_PASSWDHASH_TOKEN" ${PASSWORD_BACKEND})
+       set(MONETDB5_PASSWDHASH ${PASSWORD_BACKEND})
+       set(MONETDB5_PASSWDHASH_TOKEN ${PASSWORD_BACKEND})
 else()
        message(FATAL_ERROR "PASSWORD_BACKEND invalid, choose one of MD5, SHA1, 
RIPEMD160, SHA224, SHA256, SHA384, SHA512")
 endif()
@@ -219,19 +213,22 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "Inte
        add_compile_options(-no-gcc) # Intel compiler hack
 elseif(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
        add_compile_definitions(_GNU_SOURCE _XOPEN_SOURCE)
-       set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} 
-D_GNU_SOURCE -D_XOPEN_SOURCE")
-endif()
-if(NOT MSVC)
-       add_compile_definitions(_REENTRANT)
-       set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} 
-D_REENTRANT")
+       set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} 
-D_GNU_SOURCE -D_XOPEN_SOURCE") # required for tests
+elseif(MSVC)
+       set(_Noreturn "__declspec(noreturn)")
+       set(__attribute__(a) ON)
+       set(restrict "__restrict")
+       add_compile_definitions(_CRT_SECURE_NO_WARNINGS 
_CRT_SECURE_NO_DEPRECATE _WINSOCK_DEPRECATED_NO_WARNINGS)
 endif()
 
+# Tests for large files support
 opj_test_large_files(_LARGE_FILES)
 opj_test_large_files(_LARGEFILE_SOURCE)
 opj_test_large_files(_FILE_OFFSET_BITS)
-
 #Test if struct tm has tm_zone field
 check_struct_has_member("struct tm" tm_zone "time.h" HAVE_STRUCT_TM_TM_ZONE 
LANGUAGE C)
+#Test CPU endianness
+test_big_endian(WORDS_BIGENDIAN)
 
 #Test for __builtin_add_overflow
 check_c_source_compiles("
@@ -246,47 +243,7 @@ check_c_source_compiles("
                return 0;
        }" HAVE___BUILTIN_ADD_OVERFLOW)
 
-set(FLEXIBLE_ARRAY_MEMBER ON) # We compile according to C99 standard
-if(MSVC)
-       set(__attribute__(a) ON)
-       set(restrict __restrict)
-       add_compile_definitions(_CRT_SECURE_NO_WARNINGS 
_CRT_SECURE_NO_DEPRECATE _WINSOCK_DEPRECATED_NO_WARNINGS)
-endif()
-
-# 
https://github.com/Unidata/netcdf-c/commit/b432a527c4a38af45498691a44c5a88961b9c751
-# Test if char type is unsigned or not
-check_c_source_compiles("
-       #include <stdlib.h>
-
-       int main(int argc, char **argv) {
-               char error_if_char_is_signed[((char)-1) < 0 ? -1 : 1];
-               (void) argc; (void) argv; (void) error_if_char_is_signed;
-               error_if_char_is_signed[0] = 0;
-               return 0;
-       }" __CHAR_UNSIGNED__)
-if(__CHAR_UNSIGNED__)
-       add_compile_definitions(__CHAR_UNSIGNED__)
-endif()
-
-# Test if __hidden macro is supported
-check_c_source_compiles("
-       #include <stdlib.h>
-
-       __hidden void test(int a);
-       void test(int a) { (void)a; }
-
-       int main(int argc, char **argv) {
-               (void) argc; (void) argv;
-               test(1);
-               return 0;
-       }" HAVE_HIDDEN)
-if(NOT HAVE_HIDDEN)
-       set(__hidden ON)
-endif()
-
-if(MSVC)
-       set(_Noreturn "__declspec(noreturn)")
-else()
+if(NOT MSVC)
        #Test if _Noreturn keyword is supported
        check_c_source_compiles("
                #include <stdlib.h>
@@ -300,9 +257,9 @@ else()
                        return 0;
                }" HAVE_NORETURN)
        if(HAVE_NORETURN)
-               set(_Noreturn _Noreturn)
+               set(_Noreturn "_Noreturn")
        else()
-               set(_Noreturn __attribute__((__noreturn__)))
+               set(_Noreturn "__attribute__((__noreturn__))")
        endif()
 endif()
 
@@ -425,10 +382,12 @@ if(WIN32)
        set(CMAKE_SHARED_LIBRARY_PREFIX "${SO_PREFIX}" CACHE STRING "Shared 
library name prefix" FORCE)
        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")
        set(OS_DIRSEP  "/")
        set(OS_PATHSEP ":")
        set(SO_PREFIX  "${CMAKE_SHARED_LIBRARY_PREFIX}")
+       set(COMPILER_OPTION "-") # Used for Intel compiler available on Windows 
and Linux
 else()
        message(FATAL_ERROR "Unknown target operating system")
 endif()
@@ -438,12 +397,7 @@ set(DIR_SEP_STR  ${OS_DIRSEP})
 set(PATH_SEP     "'${OS_PATHSEP}'")
 set(SO_EXT       "${CMAKE_SHARED_LIBRARY_SUFFIX}")
 
-test_big_endian(WORDS_BIGENDIAN)
-if(APPLE)
-       set(AC_APPLE_UNIVERSAL_BUILD ON)
-endif()
-
-# checks for libraries
+# Bison
 find_package(BISON)
 if(NOT BISON_FOUND)
        if(${ENABLE_SQL} STREQUAL "YES")
@@ -590,7 +544,9 @@ if(NOT ${WITH_READLINE} STREQUAL "NO")
                if(HAVE_LIBREADLINE)
                        list(APPEND READLINE_LIBRARIES termcap)
                else()
-                       set(CMAKE_REQUIRED_LIBRARIES 
"${PREV_CMAKE_REQUIRED_LIBRARIES};readline;ncurses")
+                       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)
                                list(APPEND READLINE_LIBRARIES ncurses)
@@ -654,7 +610,6 @@ if(APPLE)
                set(CMAKE_REQUIRED_INCLUDES 
"${CMAKE_REQUIRED_INCLUDES};${CRYPTO_INCLUDE_DIR}")
                set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};${CRYPTO_LIBRARIES}")
                check_symbol_exists("CC_MD5_Update" 
"CommonCrypto/CommonDigest.h" HAVE_MD5_UPDATE)
-               check_symbol_exists("CC_RIPEMD160_Update" 
"CommonCrypto/CommonDigest.h" HAVE_RIPEMD160_UPDATE)
                check_symbol_exists("CC_SHA1_Update" 
"CommonCrypto/CommonDigest.h" HAVE_SHA1_UPDATE)
                check_symbol_exists("CC_SHA224_Update" 
"CommonCrypto/CommonDigest.h" HAVE_SHA224_UPDATE)
                check_symbol_exists("CC_SHA256_Update" 
"CommonCrypto/CommonDigest.h" HAVE_SHA256_UPDATE)
@@ -725,27 +680,7 @@ if(NOT ${WITH_REGEX} STREQUAL "POSIX")
        include(FindPCRE)
 
        if(PCRE_FOUND)
-               if(MSVC)
-                       set(HAVE_LIBPCRE ON)
-               else()
-                       #Test for UTF-8 support on PCRE library
-                       cmake_push_check_state()
-                       set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};pcre")
-                       check_c_source_runs("
-                               #include <stdlib.h>
-                               #include <pcre.h>
-
-                               int main(int argc, char **argv) {
-                                       int rc;
-                                       (void) argc; (void) argv;
-                                       if (pcre_config(PCRE_CONFIG_UTF8, &rc) 
!= 0)
-                                               return 1;
-                                       exit(!rc);
-                                       return 0;
-                               }
-                       " HAVE_LIBPCRE)
-                       cmake_pop_check_state()
-               endif()
+               check_symbol_exists("PCRE_CONFIG_UTF8" "pcre.h" HAVE_LIBPCRE) 
#Test for UTF-8 support on PCRE library (PCRE_CONFIG_UTF8 is a macro)
                if(NOT HAVE_LIBPCRE)
                        if(${WITH_REGEX} STREQUAL "PCRE")
                                message(FATAL_ERROR "PCRE library found but no 
UTF-8 support")
@@ -767,13 +702,11 @@ if(NOT ${WITH_REGEX} STREQUAL "POSIX")
                endif()
        endif()
 endif()
-
 if(NOT HAVE_LIBPCRE)
        set(PCRE_INCLUDE_DIR "")
        set(PCRE_LIBRARIES "")
        check_symbol_exists("regcomp" "regex.h" HAVE_POSIX_REGEX)
 endif()
-
 if(NOT HAVE_LIBPCRE AND NOT HAVE_POSIX_REGEX)
        if(${ENABLE_MONETDB5} STREQUAL "YES")
                message(FATAL_ERROR "PCRE library or GNU regex library not 
found but required for MonetDB5")
@@ -1033,66 +966,22 @@ set(SAMTOOLS_LIBRARIES "")
 set(WITH_SAMTOOLS "AUTO" CACHE PATH "Include Samtools support (default=AUTO)") 
# Check with HAVE_SAMTOOLS
 if(NOT ${WITH_SAMTOOLS} STREQUAL "NO")
        cmake_push_check_state()
-
+       set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES};${MATH_LIBRARIES};${THREAD_LIBRARIES};${ZLIB_LIBRARIES};bam")
        check_include_file("samtools/bam.h" HAVE_SAMTOOLS_BAM_H)
-       if(NOT HAVE_SAMTOOLS_BAM_H)
-               set(SAMTOOLS_ERROR "bam.h header not found")
-               check_include_file("bam/bam.h" HAVE_BAM_BAM_H)
-               if(HAVE_BAM_BAM_H)
-                       unset(SAMTOOLS_ERROR)
-               else()
-                       set(SAMTOOLS_ERROR "Neither samtools/bam.h nor 
bam/bam.h header found")
-               endif()
-       endif()
-
-       if(NOT SAMTOOLS_ERROR)
-               check_include_file("samtools/sam.h" HAVE_SAMTOOLS_SAM_H)
-               if(NOT HAVE_SAMTOOLS_SAM_H)
-                       set(SAMTOOLS_ERROR "samtools/sam.h header not found")
-                       check_include_file("bam/sam.h" HAVE_BAM_SAM_H)
-                       if(HAVE_BAM_SAM_H)
-                               unset(SAMTOOLS_ERROR)
-                       else()
-                               set(SAMTOOLS_ERROR "Neither samtools/sam.h nor 
bam/sam.h header found")
-                       endif()
-               endif()
-       endif()
-
-       if(NOT SAMTOOLS_ERROR)
-               check_include_file("samtools/bgzf.h" HAVE_SAMTOOLS_BGZF_H)
-               if(NOT HAVE_SAMTOOLS_BGZF_H)
-                       set(SAMTOOLS_ERROR "samtools/bgzf.h header not found")
-                       check_include_file("bam/bgzf.h" HAVE_BAM_BGZF_H)
-                       if(HAVE_BAM_BGZF_H)
-                               unset(SAMTOOLS_ERROR)
-                       else()
-                               set(SAMTOOLS_ERROR "Neither samtool/bgzf.h nor 
bam/bgzf.h header found")
-                       endif()
-               endif()
-       endif()
-
-       if(NOT SAMTOOLS_ERROR)
-               set(CMAKE_REQUIRED_LIBRARIES 
"${CMAKE_REQUIRED_LIBRARIES}bam;m;pthread;z")
-               check_symbol_exists("bam_header_read" "samtools/bam.h" 
HAVE_SAMTOOLS)
-               if(HAVE_SAMTOOLS)
-                       set(SAMTOOLS_LIBRARIES bam)
-               else()
-                       set(SAMTOOLS_ERROR "bam library not found")
-               endif()
-       endif()
-
-       if(NOT SAMTOOLS_ERROR)
-               check_include_file("samtools/kstring.h" HAVE_SAMTOOLS_KSTRING_H)
-               check_include_file("bam/kstring.h" HAVE_BAM_KSTRING_H)
-       endif()
-
-       if(SAMTOOLS_ERROR)
-               if(${WITH_SAMTOOLS} STREQUAL "YES")
-                       message(FATAL_ERROR "${SAMTOOLS_ERROR}")
-               else()
-                       message(STATUS "${SAMTOOLS_ERROR}")
-               endif()
-               set(HAVE_SAMTOOLS NO)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to