cmake: add librtmp/rtmpdump option and detection
Add CMake option `USE_LIBRTMP`. Disabled by default.
This library requires OpenSSL TLS-backend when linked statically.
Follow-up to 6eb9e65781 #13364
Closes #13373
This commit is contained in:
parent
a362962b72
commit
edc2702a1f
@ -380,9 +380,6 @@ check_function_exists(gethostname HAVE_GETHOSTNAME)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND CURL_LIBS "ws2_32" "bcrypt")
|
||||
if(USE_LIBRTMP)
|
||||
list(APPEND CURL_LIBS "winmm")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# check SSL libraries
|
||||
@ -603,8 +600,8 @@ if(CURL_ZSTD)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Check symbol in OpenSSL-like TLS backends.
|
||||
macro(openssl_check_symbol_exists SYMBOL FILES VARIABLE)
|
||||
# Check symbol in an OpenSSL-like TLS backend, or in EXTRA_LIBS depending on it.
|
||||
macro(openssl_check_symbol_exists SYMBOL FILES VARIABLE EXTRA_LIBS)
|
||||
cmake_push_check_state()
|
||||
if(USE_OPENSSL)
|
||||
set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}")
|
||||
@ -628,6 +625,9 @@ macro(openssl_check_symbol_exists SYMBOL FILES VARIABLE)
|
||||
endif()
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_UINTPTR_T) # to pull in stdint.h (as of wolfSSL v5.5.4)
|
||||
endif()
|
||||
if(NOT "${EXTRA_LIBS}" STREQUAL "")
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES "${EXTRA_LIBS}")
|
||||
endif()
|
||||
check_symbol_exists("${SYMBOL}" "${FILES}" "${VARIABLE}")
|
||||
cmake_pop_check_state()
|
||||
endmacro()
|
||||
@ -636,9 +636,9 @@ endmacro()
|
||||
macro(openssl_check_quic)
|
||||
if(NOT DEFINED HAVE_SSL_CTX_SET_QUIC_METHOD)
|
||||
if(USE_OPENSSL)
|
||||
openssl_check_symbol_exists(SSL_CTX_set_quic_method "openssl/ssl.h" HAVE_SSL_CTX_SET_QUIC_METHOD)
|
||||
openssl_check_symbol_exists(SSL_CTX_set_quic_method "openssl/ssl.h" HAVE_SSL_CTX_SET_QUIC_METHOD "")
|
||||
elseif(USE_WOLFSSL)
|
||||
openssl_check_symbol_exists(wolfSSL_set_quic_method "wolfssl/options.h;wolfssl/openssl/ssl.h" HAVE_SSL_CTX_SET_QUIC_METHOD)
|
||||
openssl_check_symbol_exists(wolfSSL_set_quic_method "wolfssl/options.h;wolfssl/openssl/ssl.h" HAVE_SSL_CTX_SET_QUIC_METHOD "")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_SSL_CTX_SET_QUIC_METHOD)
|
||||
@ -648,10 +648,10 @@ endmacro()
|
||||
|
||||
if(USE_OPENSSL OR USE_WOLFSSL)
|
||||
if(NOT DEFINED HAVE_SSL_SET0_WBIO)
|
||||
openssl_check_symbol_exists(SSL_set0_wbio "openssl/ssl.h" HAVE_SSL_SET0_WBIO)
|
||||
openssl_check_symbol_exists(SSL_set0_wbio "openssl/ssl.h" HAVE_SSL_SET0_WBIO "")
|
||||
endif()
|
||||
if(NOT DEFINED HAVE_OPENSSL_SRP AND NOT CURL_DISABLE_SRP)
|
||||
openssl_check_symbol_exists(SSL_CTX_set_srp_username "openssl/ssl.h" HAVE_OPENSSL_SRP)
|
||||
openssl_check_symbol_exists(SSL_CTX_set_srp_username "openssl/ssl.h" HAVE_OPENSSL_SRP "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -1004,6 +1004,26 @@ if(CURL_USE_GSSAPI)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(USE_LIBRTMP "Enable librtmp from rtmpdump" OFF)
|
||||
if(USE_LIBRTMP)
|
||||
cmake_push_check_state()
|
||||
set(_extra_libs "rtmp")
|
||||
if(WIN32)
|
||||
list(APPEND _extra_libs "winmm")
|
||||
endif()
|
||||
openssl_check_symbol_exists("RTMP_Init" "librtmp/rtmp.h" HAVE_LIBRTMP "${_extra_libs}")
|
||||
cmake_pop_check_state()
|
||||
if(HAVE_LIBRTMP)
|
||||
list(APPEND CURL_LIBS "rtmp")
|
||||
if(WIN32)
|
||||
list(APPEND CURL_LIBS "winmm")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "librtmp requested, but not found or missing OpenSSL. Skipping.")
|
||||
set(USE_LIBRTMP OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(ENABLE_UNIX_SOCKETS "Define if you want Unix domain sockets support" ON)
|
||||
if(ENABLE_UNIX_SOCKETS)
|
||||
include(CheckStructHasMember)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user