From: Viktor Szakats Date: Mon, 15 Apr 2024 10:35:07 +0000 (+0000) Subject: cmake: add librtmp/rtmpdump option and detection X-Git-Tag: curl-8_8_0~224 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edc2702a1fe3a4a5386ffd9aa4f240f0c0197fa2;p=thirdparty%2Fcurl.git 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 6eb9e65781fa1fd8a0bcfe0715187a3a35f09ae4 #13364 Closes #13373 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d5c778bb04..21a6a36541 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)