xref: /curl/m4/curl-amissl.m4 (revision dbf5fbd4)
1#***************************************************************************
2#                                  _   _ ____  _
3#  Project                     ___| | | |  _ \| |
4#                             / __| | | | |_) | |
5#                            | (__| |_| |  _ <| |___
6#                             \___|\___/|_| \_\_____|
7#
8# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
12# are also available at https://curl.se/docs/copyright.html.
13#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21# SPDX-License-Identifier: curl
22#
23#***************************************************************************
24
25AC_DEFUN([CURL_WITH_AMISSL], [
26AC_MSG_CHECKING([whether to enable Amiga native SSL/TLS (AmiSSL v5)])
27if test "$HAVE_PROTO_BSDSOCKET_H" = "1"; then
28  if test "x$OPT_AMISSL" != xno; then
29    ssl_msg=
30    AC_COMPILE_IFELSE([
31      AC_LANG_PROGRAM([[
32        #include <libraries/amisslmaster.h>
33        #include <openssl/opensslv.h>
34      ]],[[
35        #if defined(AMISSL_CURRENT_VERSION) && defined(AMISSL_V3xx) && \
36            (OPENSSL_VERSION_NUMBER >= 0x30000000L) && \
37            defined(PROTO_AMISSL_H)
38        return 0;
39        #else
40        #error not AmiSSL v5 / OpenSSL 3
41        #endif
42      ]])
43    ],[
44      AC_MSG_RESULT([yes])
45      ssl_msg="AmiSSL"
46      test amissl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
47      AMISSL_ENABLED=1
48      OPENSSL_ENABLED=1
49      # Use AmiSSL's built-in ca bundle
50      check_for_ca_bundle=1
51      with_ca_fallback=yes
52      LIBS="-lamisslstubs -lamisslauto $LIBS"
53      AC_DEFINE(USE_AMISSL, 1, [if AmiSSL is in use])
54      AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use])
55      AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
56                       openssl/pem.h openssl/ssl.h openssl/err.h)
57    ],[
58      AC_MSG_RESULT([no])
59    ])
60    test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
61  else
62    AC_MSG_RESULT(no)
63  fi
64else
65  AC_MSG_RESULT(no)
66fi
67
68])
69