# HG changeset patch # User Sebastien Jodogne # Date 1600680008 -7200 # Node ID 7b14ddf795c5226b666955af5ffb0a4378402aff # Parent c3fc0b884442b3cccc8302ea11296fd9399071eb auto-detection of mg_disable_keep_alive() in CMake diff -r c3fc0b884442 -r 7b14ddf795c5 OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake --- a/OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake Fri Sep 18 16:23:07 2020 +0200 +++ b/OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake Mon Sep 21 11:20:08 2020 +0200 @@ -93,20 +93,29 @@ else() CHECK_INCLUDE_FILE_CXX(civetweb.h HAVE_CIVETWEB_H) if (NOT HAVE_CIVETWEB_H) - message(FATAL_ERROR "Please install the libcivetweb-devel package") + message(FATAL_ERROR "Please install the libcivetweb-dev package") endif() cmake_reset_check_state() set(CMAKE_REQUIRED_LIBRARIES dl pthread) CHECK_LIBRARY_EXISTS(civetweb mg_start "" HAVE_CIVETWEB_LIB) if (NOT HAVE_CIVETWEB_LIB) - message(FATAL_ERROR "Please install the libcivetweb-devel package") + message(FATAL_ERROR "Please install the libcivetweb-dev package") endif() link_libraries(civetweb) unset(CMAKE_REQUIRED_LIBRARIES) - add_definitions( - -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0 - ) + # Check whether the system distribution of civetweb contains the + # patch "../Patches/civetweb-1.12.patch" that allows to disable + # keep-alive on selected HTTP connections. This is useful to speed + # up multipart transfers, as encountered in DICOMweb. + CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE) + if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE) + add_definitions(-DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1) + message("Performance: Your system-wide distribution of civetweb is configured for best performance") + else() + message(WARNING "Performance: Your system-wide distribution of civetweb does not feature the mg_disable_keep_alive() function") + add_definitions(-DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0) + endif() endif()