Changeset: 820877bd1a15 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=820877bd1a15
Modified Files:
CMakeLists.txt
gdk/CMakeLists.txt
monetdb5/tools/CMakeLists.txt
monetdb_config.h.in
sql/backends/monet5/UDF/pyapi/undef.h
testing/CMakeLists.txt
tools/merovingian/daemon/CMakeLists.txt
tools/mserver/CMakeLists.txt
Branch: cmake-fun
Log Message:
Cleanup, remove code checks for Solaris compilation, malloc libraries, thread
libraries, unused include files.
diffs (truncated from 373 to 300 lines):
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,13 +32,6 @@ cmake_policy(SET CMP0075 NEW)
# Save default cmake options in the begining
set(PREV_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
-function(MT_clibsToCmake INPUT_INCS OUTPUT_INCS) # Remove -I before the
include path
- string(LENGTH "${INPUT_INCS}" INPUT_INCS_LENGTH)
- string(SUBSTRING "${INPUT_INCS}" 2 ${INPUT_INCS_LENGTH} INPUT_INCS)
- string(REPLACE "\ -I" ";" HELPER ${INPUT_INCS})
- set(${OUTPUT_INCS} "${HELPER}" PARENT_SCOPE)
-endfunction()
-
# set host data
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" CMAKE_SYSTEM_PROCESSOR_LOWER)
string(TOLOWER "${CMAKE_SYSTEM_NAME}" CMAKE_SYSTEM_NAME_LOWER)
@@ -678,71 +671,34 @@ if(PSAPI_LIBRARY)
set(PSAPI_LIBRARIES "${PSAPI_LIBRARY}")
endif()
-# Malloc libs
-set(MALLOC_LIBRARIES "")
-set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};umem")
-check_symbol_exists("malloc" "umem.h" HAVE_UMEM)
-set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
-if(HAVE_UMEM)
- set(MALLOC_LIBRARIES "umem")
-else()
- set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};mtmalloc")
- check_symbol_exists("malloc" "mtmalloc.h" HAVE_MT)
- set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
- if(HAVE_MT)
- set(MALLOC_LIBRARIES "mtmalloc")
- else()
- set(CMAKE_REQUIRED_LIBRARIES
"${CMAKE_REQUIRED_LIBRARIES};malloc")
- check_symbol_exists("malloc" "malloc.h" HAVE_MALLOC)
- set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
- if(HAVE_MALLOC)
- set(MALLOC_LIBRARIES "malloc")
- endif()
- endif()
-endif()
-
-# Pthread libs
-set(PTHREAD_INCLUDE_DIR "")
-set(PTHREAD_LIBRARIES "")
-set(PTHREAD_LIBRARY_DIR "")
+# Thread libraries
+set(THREAD_INCLUDE_DIR "")
+set(THREAD_LIBRARY_DIR "")
if(NOT WIN32)
- set(WITH_PTHREAD "AUTO" CACHE PATH "Pthread library is installed in
DIR") # Check with HAVE_PTHREAD_LIB (not needed on MacOSX)
- if(NOT ${WITH_PTHREAD} STREQUAL "NO")
- cmake_push_check_state()
- if(NOT ${WITH_PTHREAD} MATCHES "^AUTO|YES$")
- set(PTHREAD_INCLUDE_DIR "${WITH_PTHREAD}/include")
- set(PTHREAD_LIBRARY_DIR "${WITH_PTHREAD}/lib")
- set(CMAKE_REQUIRED_INCLUDES
"${CMAKE_REQUIRED_INCLUDES};${PTHREAD_INCLUDE_DIR}") # Set back again in the
end!
- set(CMAKE_REQUIRED_LIBRARIES
"${CMAKE_REQUIRED_LIBRARIES};${PTHREAD_LIBRARY_DIR}") # Set back again in the
end!
- endif()
-
- check_include_file("pthread.h" HAVE_PTHREAD_H)
- check_include_file("semaphore.h" HAVE_SEMAPHORE_H)
- check_include_file("sched.h" HAVE_SCHED_H)
-
- if(${WITH_PTHREAD} MATCHES "^AUTO|YES$")
- if("${CMAKE_C_COMPILER_ID}" MATCHES
"^Clang|AppleClang|GNU$")
- if(NOT APPLE)
- set(HAVE_PTHREAD_LIB ON)
- endif()
- elseif(${WITH_PTHREAD} STREQUAL "YES")
- message(FATAL_ERROR "pthread library not
supported by the platform")
- endif()
- endif()
-
- set(CMAKE_REQUIRED_LIBRARIES
"${CMAKE_REQUIRED_LIBRARIES};pthread")
- check_symbol_exists("pthread_kill" "signal.h" HAVE_PTHREAD_KILL)
- check_symbol_exists("pthread_sigmask" "signal.h"
HAVE_PTHREAD_SIGMASK)
- cmake_pop_check_state()
+ set(WITH_THREAD "AUTO" CACHE PATH "Thread library is installed in DIR")
+endif()
+cmake_push_check_state()
+if(NOT WIN32 AND NOT "${WITH_THREAD}" STREQUAL "AUTO")
+ set(THREAD_INCLUDE_DIR "${WITH_THREAD}/include")
+ set(THREAD_LIBRARY_DIR "${WITH_THREAD}/lib")
+ set(THREAD_LIBRARIES "pthread")
+ set(CMAKE_REQUIRED_INCLUDES
"${CMAKE_REQUIRED_INCLUDES};${THREAD_INCLUDE_DIR}") # Set back again in the end!
+ set(CMAKE_REQUIRED_LINK_OPTIONS
"${CMAKE_REQUIRED_LINK_OPTIONS};${THREAD_LIBRARY_DIR}") # Set back again in the
end!
+ check_symbol_exists("pthread_create" "pthread.h" HAVE_PTHREAD_CREATE)
+ if(NOT HAVE_PTHREAD_CREATE)
+ message(FATAL_ERROR "MonetDB requires a pthread library on UNIX
systems")
endif()
- if(HAVE_PTHREAD_H)
- set(PTHREAD_INCLUDE_DIR "${PTHREAD_INCLUDE_DIR}")
- set(PTHREAD_LIBRARIES "pthread")
- set(HAVE_LIBPTHREAD ON)
- else()
- message(FATAL_ERROR "MonetDB requires libpthread on UNIX
systems")
- endif()
+else()
+ set(THREADS_PREFER_PTHREAD_FLAG ON) # We do prefer pthreads
+ find_package(Threads REQUIRED)
+ set(THREAD_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
+ set(CMAKE_REQUIRED_LIBRARIES
"${CMAKE_REQUIRED_LIBRARIES};${THREAD_LIBRARIES}")
endif()
+check_include_file("pthread.h" HAVE_PTHREAD_H)
+check_include_file("semaphore.h" HAVE_SEMAPHORE_H)
+check_symbol_exists("pthread_kill" "signal.h" HAVE_PTHREAD_KILL)
+check_symbol_exists("pthread_sigmask" "signal.h" HAVE_PTHREAD_SIGMASK)
+cmake_pop_check_state()
# Readline libs
set(READLINE_INCLUDE_DIR "")
@@ -944,7 +900,6 @@ endif()
if(NOT HAVE_LIBPCRE)
set(PCRE_INCLUDE_DIR "")
set(PCRE_LIBRARIES "")
- message(STATUS "Checking for GNU regex library")
check_symbol_exists("regcomp" "regex.h" HAVE_POSIX_REGEX)
endif()
@@ -1061,10 +1016,9 @@ if(NOT ${ENABLE_RINTEGRATION} STREQUAL "
exec_program("${R_INTERPRETER}" ARGS "CMD config --cppflags"
OUTPUT_VARIABLE R_CPP_OUTPUT RETURN_VALUE R_CPP_RC)
exec_program("${R_INTERPRETER}" ARGS "CMD config --ldflags"
OUTPUT_VARIABLE R_LD_OUTPUT RETURN_VALUE R_LD_RC)
if(R_HOME_RC EQUAL 0 AND R_CPP_RC EQUAL 0 AND R_LD_RC EQUAL 0)
- MT_clibsToCmake(${R_CPP_OUTPUT} R_INCLUDE_DIR)
- string(REPLACE "-fopenmp" "" R_LD_OUTPUT
${R_LD_OUTPUT}) # We don't want to link to OpenMP
- string(REPLACE "-fopenmp=libgomp" "" R_LD_OUTPUT
${R_LD_OUTPUT})
- set(R_LIBRARIES "${R_LD_OUTPUT}")
+ string(REPLACE "-I" "" R_INCLUDE_DIR ${R_CPP_OUTPUT}) #
cmake will get confused
+ string(REPLACE "-fopenmp" "" R_LIBRARIES
${R_LD_OUTPUT}) # We don't want to link to OpenMP
+ string(REPLACE "-fopenmp=libgomp" "" R_LIBRARIES
${R_LIBRARIES})
set(HAVE_LIBR ON)
set(RHOME ${R_HOME_OUTPUT})
message(STATUS "R executable, library and include files
found")
@@ -1550,8 +1504,6 @@ check_include_file("sys/times.h" HAVE_SY
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("termios.h" HAVE_TERMIOS_H)
check_include_file("unistd.h" HAVE_UNISTD_H)
check_include_file("uuid/uuid.h" HAVE_UUID_UUID_H)
@@ -1574,70 +1526,7 @@ if(MSVC)
message(FATAL_ERROR "ws2_32 library is missing and required to
compile MonetDB on Windows")
endif()
else()
- check_symbol_exists("gethostbyname" "netdb.h;sys/socket.h"
HAVE_GETHOSTBYNAME)
- if(NOT HAVE_GETHOSTBYNAME)
- message(STATUS "Trying to find gethostbyname by linking to nsl")
- set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};nsl")
- check_symbol_exists("gethostbyname" "netdb.h;sys/socket.h"
HAVE_GETHOSTBYNAME)
- if(HAVE_GETHOSTBYNAME)
- list(APPEND SOCKET_LIBRARIES nsl)
- else()
- message(FATAL_ERROR "Could not find gethostbyname
symbol")
- endif()
- set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
- endif()
-
- check_symbol_exists("hstrerror" "netdb.h;sys/socket.h" HAVE_HSTERROR)
- if(NOT HAVE_HSTERROR)
- message(STATUS "Trying to find hstrerror by linking to resolv")
- set(CMAKE_REQUIRED_LIBRARIES
"${PREV_CMAKE_REQUIRED_LIBRARIES};resolv")
- check_symbol_exists("hstrerror" "netdb.h;sys/socket.h"
HAVE_HSTERROR)
- if(HAVE_HSTERROR)
- list(APPEND SOCKET_LIBRARIES resolv)
- else()
- message(FATAL_ERROR "Could not find hstrerror symbol")
- endif()
- set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
- endif()
-
- check_symbol_exists("setsockopt" "sys/types.h;sys/socket.h"
HAVE_SETSOCKOPT)
- if(NOT HAVE_SETSOCKOPT)
- message(STATUS "Trying to find setsockopt by linking to socket")
- set(CMAKE_REQUIRED_LIBRARIES
"${PREV_CMAKE_REQUIRED_LIBRARIES};socket")
- check_symbol_exists("setsockopt" "sys/types.h;sys/socket.h"
HAVE_SETSOCKOPT)
- if(HAVE_SETSOCKOPT)
- list(APPEND SOCKET_LIBRARIES socket)
- else()
- message(FATAL_ERROR "Could not find setsockopt symbol")
- endif()
- set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
- endif()
-
check_symbol_exists("getaddrinfo" "sys/types.h;sys/socket.h;netdb.h"
HAVE_GETADDRINFO)
- if(NOT HAVE_GETADDRINFO)
- message(STATUS "Trying to find getaddrinfo by linking to
socket")
- set(CMAKE_REQUIRED_LIBRARIES
"${PREV_CMAKE_REQUIRED_LIBRARIES};socket")
- check_symbol_exists("getaddrinfo"
"sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
- if(HAVE_GETADDRINFO)
- list(FIND ${SOCKET_LIBRARIES} socket LINKED_TO_SOCKET)
- if(NOT LINKED_TO_SOCKET)
- list(APPEND SOCKET_LIBRARIES socket)
- endif()
- else()
- message(STATUS "Trying to find getaddrinfo by linking
to nsl")
- set(CMAKE_REQUIRED_LIBRARIES
"${PREV_CMAKE_REQUIRED_LIBRARIES};nsl")
- check_symbol_exists("getaddrinfo"
"sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
- if(HAVE_GETADDRINFO)
- list(FIND ${SOCKET_LIBRARIES} nsl LINKED_TO_NSL)
- if(NOT LINKED_TO_NSL)
- list(APPEND SOCKET_LIBRARIES nsl)
- endif()
- else()
- message(FATAL_ERROR "Could not find getaddrinfo
symbol")
- endif()
- endif()
- set(CMAKE_REQUIRED_LIBRARIES "${PREV_CMAKE_REQUIRED_LIBRARIES}")
- endif()
endif()
cmake_push_check_state()
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -6,12 +6,12 @@
# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
#]]
-include_directories(../common/options ../common/stream ../common/utils
${VALGRIND_INCLUDE_DIR})
+include_directories(../common/options ../common/stream ../common/utils
${THREAD_INCLUDE_DIR} ${VALGRIND_INCLUDE_DIR})
set(GDK_LINK_LIBRARIES moptions mutils)
if(WIN32)
- list(APPEND GDK_LINK_LIBRARIES stream ${MATH_LIBRARIES}
${SOCKET_LIBRARIES} ${MALLOC_LIBRARIES} ${PTHREAD_LIBRARIES}
- ${DL_LIBRARIES} ${PSAPI_LIBRARIES})
+ list(APPEND GDK_LINK_LIBRARIES stream ${MATH_LIBRARIES}
${SOCKET_LIBRARIES} ${THREAD_LIBRARIES} ${DL_LIBRARIES}
+ ${PSAPI_LIBRARIES})
endif()
add_library(gdk SHARED
@@ -64,11 +64,8 @@ else()
if(NOT MATH_LIBRARIES STREQUAL "")
set(PKG_MATH_LIBRARIES "-l${MATH_LIBRARIES}")
endif()
- if(NOT MALLOC_LIBRARIES STREQUAL "")
- set(PKG_MALLOC_LIBRARIES "-l${MALLOC_LIBRARIES}")
- endif()
- if(NOT PTHREAD_LIBRARIES STREQUAL "")
- set(PKG_PTHREAD_LIBRARIES "-${PTHREAD_LIBRARIES}")
+ if(NOT THREAD_LIBRARIES STREQUAL "")
+ set(PKG_PTHREAD_LIBRARIES "-${THREAD_LIBRARIES}")
endif()
if(NOT DL_LIBRARIES STREQUAL "")
set(PKG_DL_LIBS "-l${DL_LIBRARIES}")
diff --git a/monetdb5/tools/CMakeLists.txt b/monetdb5/tools/CMakeLists.txt
--- a/monetdb5/tools/CMakeLists.txt
+++ b/monetdb5/tools/CMakeLists.txt
@@ -20,8 +20,7 @@ file(GLOB SCHEDULER_SRC "../scheduler/*.
set(MONETDB5_PRIVATE_LINK_LIBRARIES )
if(WIN32)
list(APPEND MONETDB5_PRIVATE_LINK_LIBRARIES ${UUID_LIBRARIES}
${MATH_LIBRARIES} ${SOCKET_LIBRARIES}
- ${MALLOC_LIBRARIES} ${PTHREAD_LIBRARIES} ${DL_LIBRARIES}
${CRYPTO_LIBRARIES} ${PCRE_LIBRARIES}
- ${LIBXML2_LIBRARIES} gdk stream)
+ ${THREAD_LIBRARIES} ${DL_LIBRARIES} ${CRYPTO_LIBRARIES}
${PCRE_LIBRARIES} ${LIBXML2_LIBRARIES} gdk stream)
if(HAVE_MAPI)
list(APPEND MONETDB5_PRIVATE_LINK_LIBRARIES mapi)
endif()
diff --git a/monetdb_config.h.in b/monetdb_config.h.in
--- a/monetdb_config.h.in
+++ b/monetdb_config.h.in
@@ -269,9 +269,6 @@
/* Define to 1 if you have the pcre library */
#cmakedefine HAVE_LIBPCRE 1
-/* Define to 1 if you have the pthread library */
-#cmakedefine HAVE_LIBPTHREAD 1
-
/* Define to 1 if we can link to python2 */
#cmakedefine HAVE_LIBPY 1
@@ -395,9 +392,6 @@
/* Define to 1 if you have the <samtools/sam.h> header file. */
#cmakedefine HAVE_SAMTOOLS_SAM_H 1
-/* Define to 1 if you have the <sched.h> header file. */
-#cmakedefine HAVE_SCHED_H 1
-
/* Define to 1 if you have the <semaphore.h> header file. */
#cmakedefine HAVE_SEMAPHORE_H 1
@@ -506,12 +500,6 @@
/* Define to 1 if you have the <sys/un.h> header file. */
#cmakedefine HAVE_SYS_UN_H 1
-/* Define to 1 if you have the <sys/utime.h> header file. */
-#cmakedefine HAVE_SYS_UTIME_H 1
-
-/* Define to 1 if you have the <sys/wait.h> header file. */
-#cmakedefine HAVE_SYS_WAIT_H 1
-
/* Define to 1 if you have the `task_info' function. */
#cmakedefine HAVE_TASK_INFO 1
@@ -578,9 +566,6 @@
/* modifiable single-machine data */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list