Changeset: 2c84f02f3687 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c84f02f3687 Added Files: ctest/cmake/detect-pthreadh.cmake ctest/cmake/detect-pthreadinit.cmake ctest/cmake/detect-pthreadkill.cmake ctest/cmake/detect-pthreadsig.cmake ctest/cmake/test_detect_pthreadh.c.in ctest/cmake/test_detect_pthreadinit.c.in ctest/cmake/test_detect_pthreadkill.c.in ctest/cmake/test_detect_pthreadsig.c.in Modified Files: CMakeLists.txt cmake/monetdb-defines.cmake ctest/cmake/CMakeLists.txt Branch: mbedded Log Message:
test pthread detection diffs (truncated from 434 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,10 +41,10 @@ include(CheckFunctionExists REQUIRED) include(CheckTypeSize REQUIRED) include(TestBigEndian REQUIRED) -# Include MonetDB specific functions if(WIN32) set(CMAKE_REQUIRED_LIBRARIES ws2_32.lib shell32.lib advapi32.lib) endif() +# Include MonetDB specific functions include(monetdb-functions) include(monetdb-findpackages) include(monetdb-defines) @@ -100,6 +100,8 @@ endif() include(GNUInstallDirs) +# Define the macro variables after configuring the install directories. +# Some variables define additional installation settings. monetdb_macro_variables() # Define custom target after the install directories variables. # Some custom target will need these setting. diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -112,10 +112,8 @@ function(monetdb_configure_defines) check_function_exists("uname" HAVE_UNAME) # Some libc versions on Linux distributions don't have it check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" HAVE_SEMTIMEDOP) - if(HAVE_PTHREAD_H) - check_function_exists("pthread_kill" HAVE_PTHREAD_KILL) - check_function_exists("pthread_sigmask" HAVE_PTHREAD_SIGMASK) - endif() + check_function_exists("pthread_kill" HAVE_PTHREAD_KILL) + check_function_exists("pthread_sigmask" HAVE_PTHREAD_SIGMASK) if(HAVE_GETOPT_H) set(HAVE_GETOPT 1 PARENT_SCOPE) endif() @@ -125,7 +123,7 @@ macro(monetdb_macro_variables) # Set variables to define C macro's # These are related to the detected packages # These names are legacy. When the code is changed to use the cmake - # variables, they can be removed. + # variables, then they can be removed. set(HAVE_ICONV ${Iconv_FOUND}) set(HAVE_PTHREAD_H ${CMAKE_USE_PTHREADS_INIT}) set(HAVE_LIBPCRE ${PCRE_FOUND}) diff --git a/ctest/cmake/CMakeLists.txt b/ctest/cmake/CMakeLists.txt --- a/ctest/cmake/CMakeLists.txt +++ b/ctest/cmake/CMakeLists.txt @@ -64,5 +64,9 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/dete include(${CMAKE_CURRENT_SOURCE_DIR}/detect-unixgetaddrinfo.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-wingetaddrinfo.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/detect-getaddrinfo.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadh.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadinit.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadkill.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/detect-pthreadsig.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/set-dir-vars.cmake) diff --git a/ctest/cmake/detect-pthreadh.cmake b/ctest/cmake/detect-pthreadh.cmake new file mode 100644 --- /dev/null +++ b/ctest/cmake/detect-pthreadh.cmake @@ -0,0 +1,64 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) +endif() + +if (${LINUX_DISTRO} STREQUAL "debian") + if(${LINUX_DISTRO_VERSION} STREQUAL "9") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "10") + set(DETECT "0") + set(UNDETECT "1") + endif() +elseif (${LINUX_DISTRO} STREQUAL "ubuntu") + if(${LINUX_DISTRO_VERSION} STREQUAL "18") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "19") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "20") + set(DETECT "0") + set(UNDETECT "1") + endif() +elseif(${LINUX_DISTRO} STREQUAL "fedora") + if(${LINUX_DISTRO_VERSION} STREQUAL "30") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "31") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "32") + set(DETECT "0") + set(UNDETECT "1") + endif() +else() + message(ERROR "Linux distro: ${LINUX_DISTRO} not known") + message(ERROR "Linux distro version: ${LINUX_DISTRO_VERSION} not known") +endif() + +configure_file(test_detect_pthreadh.c.in + ${CMAKE_CURRENT_BINARY_DIR}/test_detect_pthreadh.c + @ONLY) + +add_executable(test_detect_pthreadh) +target_sources(test_detect_pthreadh + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/test_detect_pthreadh.c) +target_link_libraries(test_detect_pthreadh + PRIVATE + monetdb_config_header) +add_test(testDetectPthreadh test_detect_pthreadh) diff --git a/ctest/cmake/detect-pthreadinit.cmake b/ctest/cmake/detect-pthreadinit.cmake new file mode 100644 --- /dev/null +++ b/ctest/cmake/detect-pthreadinit.cmake @@ -0,0 +1,64 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) +endif() + +if (${LINUX_DISTRO} STREQUAL "debian") + if(${LINUX_DISTRO_VERSION} STREQUAL "9") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "10") + set(DETECT "0") + set(UNDETECT "1") + endif() +elseif (${LINUX_DISTRO} STREQUAL "ubuntu") + if(${LINUX_DISTRO_VERSION} STREQUAL "18") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "19") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "20") + set(DETECT "0") + set(UNDETECT "1") + endif() +elseif(${LINUX_DISTRO} STREQUAL "fedora") + if(${LINUX_DISTRO_VERSION} STREQUAL "30") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "31") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "32") + set(DETECT "0") + set(UNDETECT "1") + endif() +else() + message(ERROR "Linux distro: ${LINUX_DISTRO} not known") + message(ERROR "Linux distro version: ${LINUX_DISTRO_VERSION} not known") +endif() + +configure_file(test_detect_pthreadinit.c.in + ${CMAKE_CURRENT_BINARY_DIR}/test_detect_pthreadinit.c + @ONLY) + +add_executable(test_detect_pthreadinit) +target_sources(test_detect_pthreadinit + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/test_detect_pthreadinit.c) +target_link_libraries(test_detect_pthreadinit + PRIVATE + monetdb_config_header) +add_test(testDetectPthreadinit test_detect_pthreadinit) diff --git a/ctest/cmake/detect-pthreadkill.cmake b/ctest/cmake/detect-pthreadkill.cmake new file mode 100644 --- /dev/null +++ b/ctest/cmake/detect-pthreadkill.cmake @@ -0,0 +1,64 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) +endif() + +if (${LINUX_DISTRO} STREQUAL "debian") + if(${LINUX_DISTRO_VERSION} STREQUAL "9") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "10") + set(DETECT "1") + set(UNDETECT "0") + endif() +elseif (${LINUX_DISTRO} STREQUAL "ubuntu") + if(${LINUX_DISTRO_VERSION} STREQUAL "18") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "19") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "20") + set(DETECT "0") + set(UNDETECT "1") + endif() +elseif(${LINUX_DISTRO} STREQUAL "fedora") + if(${LINUX_DISTRO_VERSION} STREQUAL "30") + set(DETECT "1") + set(UNDETECT "0") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "31") + set(DETECT "1") + set(UNDETECT "0") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "32") + set(DETECT "1") + set(UNDETECT "0") + endif() +else() + message(ERROR "Linux distro: ${LINUX_DISTRO} not known") + message(ERROR "Linux distro version: ${LINUX_DISTRO_VERSION} not known") +endif() + +configure_file(test_detect_pthreadkill.c.in + ${CMAKE_CURRENT_BINARY_DIR}/test_detect_pthreadkill.c + @ONLY) + +add_executable(test_detect_pthreadkill) +target_sources(test_detect_pthreadkill + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/test_detect_pthreadkill.c) +target_link_libraries(test_detect_pthreadkill + PRIVATE + monetdb_config_header) +add_test(testDetectPthreadkill test_detect_pthreadkill) diff --git a/ctest/cmake/detect-pthreadsig.cmake b/ctest/cmake/detect-pthreadsig.cmake new file mode 100644 --- /dev/null +++ b/ctest/cmake/detect-pthreadsig.cmake @@ -0,0 +1,64 @@ +#[[ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. +#]] + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + get_os_release_info(LINUX_DISTRO LINUX_DISTRO_VERSION) +endif() + +if (${LINUX_DISTRO} STREQUAL "debian") + if(${LINUX_DISTRO_VERSION} STREQUAL "9") + set(DETECT "0") + set(UNDETECT "1") + endif() + if(${LINUX_DISTRO_VERSION} STREQUAL "10") + set(DETECT "1") + set(UNDETECT "0") + endif() +elseif (${LINUX_DISTRO} STREQUAL "ubuntu") + if(${LINUX_DISTRO_VERSION} STREQUAL "18") + set(DETECT "0") + set(UNDETECT "1") + endif() _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list