Skip to content

Commit

Permalink
wolfssl: Add new function
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoftsm committed Jul 13, 2024
1 parent 4572b93 commit 930b5e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
10 changes: 3 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 151,7 @@ option(DEFAULT_FEATURE_STATE "Specify the default state for most optional featur
mark_as_advanced(DEFAULT_FEATURE_STATE)

# openssl/crypto
option(ENABLE_WOLFSSL "Compile netdata using WolfSSL." False)
option(ENABLE_WOLFSSL "Compile netdata using WolfSSL." True)
cmake_dependent_option(ENABLE_OPENSSL "Compile netdata using OpenSSL." True "NOT ENABLE_WOLFSSL" False)

# High-level features
Expand Down Expand Up @@ -214,13 214,9 @@ mark_as_advanced(FORCE_LEGACY_LIBBPF)
include(CheckFunctionExists)

if(ENABLE_WOLFSSL)
pkg_check_modules(TLS IMPORTED_TARGET wolfssl)
include(NetdataWolfSSL)

list(APPEND CMAKE_REQUIRED_LIBRARIES wolfssl)
check_function_exists(wolfSSL_set_alpn_protos HAVE_WOLFSSL_SET_ALPN_PROTOS)
if(NOT HAVE_WOLFSSL_SET_ALPN_PROTOS)
message(FATAL_ERROR "Your WolfSSL library has not been compiled with the OPENSSL_EXTRA flag, which is necessary to create symbols for the OpenSSL API that Netdata uses.")
endif()
netdata_is_there_wolfssl()
else()
pkg_check_modules(TLS IMPORTED_TARGET openssl)
endif()
Expand Down
15 changes: 15 additions & 0 deletions packaging/cmake/Modules/NetdataWolfSSL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 1,15 @@
# Macros and functions for handling of WolfSSL
#
# Copyright (c) 2024 Netdata Inc.
# SPDX-License-Identifier: GPL-3.0-or-later

function(netdata_is_there_wolfssl)
pkg_check_modules(TLS IMPORTED_TARGET wolfssl)

list(APPEND CMAKE_REQUIRED_LIBRARIES wolfssl)
check_function_exists(wolfSSL_set_alpn_protos HAVE_WOLFSSL_SET_ALPN_PROTOS)
if(NOT HAVE_WOLFSSL_SET_ALPN_PROTOS)
message(FATAL_ERROR "Your WolfSSL library has not been compiled with the OPENSSL_EXTRA flag, which is necessary to create symbols for the OpenSSL API that Netdata uses.")
endif()
endfunction()

0 comments on commit 930b5e1

Please sign in to comment.