|
| 1 | +####################### |
| 2 | +# |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one or more contributor license |
| 4 | +# agreements. See the NOTICE file distributed with this work for additional information regarding |
| 5 | +# copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 |
| 6 | +# (the "License"); you may not use this file except in compliance with the License. You may obtain |
| 7 | +# a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software distributed under the License |
| 12 | +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 13 | +# or implied. See the License for the specific language governing permissions and limitations under |
| 14 | +# the License. |
| 15 | +# |
| 16 | +####################### |
| 17 | + |
| 18 | +function(CHECK_OPENSSL_HAS_NATIVE_QUIC OUT_VAR OPENSSL_INCLUDE_DIR) |
| 19 | + set(CHECK_PROGRAM |
| 20 | + " |
| 21 | + #include <openssl/ssl.h> |
| 22 | + #include <openssl/quic.h> |
| 23 | + #include <cstdint> |
| 24 | +
|
| 25 | + int main() { |
| 26 | + const SSL_METHOD *method = OSSL_QUIC_server_method(); |
| 27 | + SSL *ssl = nullptr; |
| 28 | + uint64_t value = 0; |
| 29 | + return method == nullptr || |
| 30 | + SSL_new_listener == nullptr || |
| 31 | + SSL_listen == nullptr || |
| 32 | + SSL_handle_events == nullptr || |
| 33 | + SSL_accept_connection == nullptr || |
| 34 | + SSL_accept_stream == nullptr || |
| 35 | + SSL_new_stream == nullptr || |
| 36 | + SSL_stream_conclude == nullptr || |
| 37 | + SSL_get_stream_id == nullptr || |
| 38 | + SSL_get_stream_type == nullptr || |
| 39 | + SSL_get_stream_read_state == nullptr || |
| 40 | + SSL_get_stream_write_buf_avail(ssl, &value) || |
| 41 | + SSL_get_conn_close_info == nullptr || |
| 42 | + SSL_shutdown_ex == nullptr || |
| 43 | + SSL_set_default_stream_mode == nullptr || |
| 44 | + SSL_set_blocking_mode == nullptr || |
| 45 | + SSL_set_event_handling_mode(ssl, SSL_VALUE_EVENT_HANDLING_MODE_EXPLICIT) || |
| 46 | + SSL_set_feature_request_uint(ssl, SSL_VALUE_QUIC_IDLE_TIMEOUT, value) || |
| 47 | + SSL_set_incoming_stream_policy == nullptr; |
| 48 | + } |
| 49 | + " |
| 50 | + ) |
| 51 | + set(CMAKE_REQUIRED_INCLUDES "${OPENSSL_INCLUDE_DIR}") |
| 52 | + set(CMAKE_REQUIRED_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) |
| 53 | + include(CheckCXXSourceCompiles) |
| 54 | + check_cxx_source_compiles("${CHECK_PROGRAM}" ${OUT_VAR}) |
| 55 | + set(${OUT_VAR} |
| 56 | + ${${OUT_VAR}} |
| 57 | + PARENT_SCOPE |
| 58 | + ) |
| 59 | +endfunction() |
0 commit comments