1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
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.haxx.se/docs/copyright.html.
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.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
21 #***************************************************************************
23 # File version for 'aclocal' use. Keep it a single number.
27 dnl CURL_CHECK_OPENSSL_API_HEADERS
28 dnl -------------------------------------------------
29 dnl Find out OpenSSL headers API version, as reported
30 dnl by OPENSSL_VERSION_NUMBER. No runtime checks
31 dnl allowed here for cross-compilation support.
32 dnl HAVE_OPENSSL_API_HEADERS is defined as appropriate
33 dnl only for systems which actually run the configure
34 dnl script. Config files generated manually or in any
35 dnl other way shall not define this.
37 AC_DEFUN([CURL_CHECK_OPENSSL_API_HEADERS], [
41 AC_MSG_CHECKING([for OpenSSL headers version])
42 CURL_CHECK_DEF([OPENSSL_VERSION_NUMBER], [
44 # include <openssl/crypto.h>
49 if test "$curl_cv_have_def_OPENSSL_VERSION_NUMBER" = "yes"; then
50 tst_verlen=`expr "$curl_cv_def_OPENSSL_VERSION_NUMBER" : '.*'`
51 case "x$tst_verlen" in
53 tst_vermaj=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 3`
54 tst_vermin=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 4`
55 tst_verfix=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 5`
56 tst_api=0x$tst_vermaj$tst_vermin$tst_verfix
59 tst_vermaj=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 3`
60 tst_vermin=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 5`
61 tst_verfix=`echo $curl_cv_def_OPENSSL_VERSION_NUMBER | cut -c 7`
62 tst_api=0x$tst_vermaj$tst_vermin$tst_verfix
69 0x111) tst_show="1.1.1" ;;
70 0x110) tst_show="1.1.0" ;;
71 0x102) tst_show="1.0.2" ;;
72 0x101) tst_show="1.0.1" ;;
73 0x100) tst_show="1.0.0" ;;
74 0x099) tst_show="0.9.9" ;;
75 0x098) tst_show="0.9.8" ;;
76 0x097) tst_show="0.9.7" ;;
77 0x096) tst_show="0.9.6" ;;
78 0x095) tst_show="0.9.5" ;;
79 0x094) tst_show="0.9.4" ;;
80 0x093) tst_show="0.9.3" ;;
81 0x092) tst_show="0.9.2" ;;
82 0x091) tst_show="0.9.1" ;;
83 *) tst_show="unknown" ;;
85 tst_show="$tst_show - $curl_cv_def_OPENSSL_VERSION_NUMBER"
89 AC_MSG_RESULT([$tst_show])
91 dnl if test "$tst_api" != "unknown"; then
92 dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_HEADERS, $tst_api,
93 dnl [OpenSSL headers configure time API. Defined only by configure script.
94 dnl No matter what, do not ever define this manually or by any other means.])
96 curl_openssl_api_headers=$tst_api
100 dnl CURL_CHECK_OPENSSL_API_LIBRARY
101 dnl -------------------------------------------------
102 dnl Find out OpenSSL library API version, performing
103 dnl only link tests in order to avoid getting fooled
104 dnl by mismatched OpenSSL headers. No runtime checks
105 dnl allowed here for cross-compilation support.
106 dnl HAVE_OPENSSL_API_LIBRARY is defined as appropriate
107 dnl only for systems which actually run the configure
108 dnl script. Config files generated manually or in any
109 dnl other way shall not define this.
111 dnl Most probably we should not bother attempting to
112 dnl detect OpenSSL library development API versions
113 dnl 0.9.9 and 1.1.0. For our intended use, detecting
114 dnl released versions should be good enough.
116 dnl Given that currently we are not using the result
117 dnl of this check, except for informative purposes,
118 dnl lets try to figure out everything.
120 AC_DEFUN([CURL_CHECK_OPENSSL_API_LIBRARY], [
124 AC_MSG_CHECKING([for OpenSSL library version])
125 if test "$tst_api" = "unknown"; then
127 AC_LANG_FUNC_LINK_TRY([ERR_clear_last_mark])
132 if test "$tst_api" = "unknown"; then
136 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumbl_sess_cb])
143 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumable_session_callback])
150 if test "$tst_api" = "unknown"; then
152 AC_LANG_FUNC_LINK_TRY([SSL_CONF_CTX_new])
157 if test "$tst_api" = "unknown"; then
159 AC_LANG_FUNC_LINK_TRY([SSL_renegotiate_abbreviated])
164 if test "$tst_api" = "unknown"; then
166 AC_LANG_FUNC_LINK_TRY([OBJ_add_sigid])
171 if test "$tst_api" = "unknown"; then
173 AC_LANG_FUNC_LINK_TRY([ERR_set_mark])
178 if test "$tst_api" = "unknown"; then
180 AC_LANG_FUNC_LINK_TRY([ERR_peek_last_error])
185 if test "$tst_api" = "unknown"; then
187 AC_LANG_FUNC_LINK_TRY([c2i_ASN1_OBJECT])
192 if test "$tst_api" = "unknown"; then
194 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_purpose])
199 if test "$tst_api" = "unknown"; then
201 AC_LANG_FUNC_LINK_TRY([OBJ_obj2txt])
206 if test "$tst_api" = "unknown"; then
208 AC_LANG_FUNC_LINK_TRY([SSL_get_verify_depth])
213 if test "$tst_api" = "unknown"; then
215 AC_LANG_FUNC_LINK_TRY([SSL_library_init])
220 if test "$tst_api" = "unknown"; then
222 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_cipher_list])
228 0x111) tst_show="1.1.1" ;;
229 0x110) tst_show="1.1.0" ;;
230 0x102) tst_show="1.0.2" ;;
231 0x101) tst_show="1.0.1" ;;
232 0x100) tst_show="1.0.0" ;;
233 0x099) tst_show="0.9.9" ;;
234 0x098) tst_show="0.9.8" ;;
235 0x097) tst_show="0.9.7" ;;
236 0x096) tst_show="0.9.6" ;;
237 0x095) tst_show="0.9.5" ;;
238 0x094) tst_show="0.9.4" ;;
239 0x093) tst_show="0.9.3" ;;
240 0x092) tst_show="0.9.2" ;;
241 0x091) tst_show="0.9.1" ;;
242 *) tst_show="unknown" ;;
244 AC_MSG_RESULT([$tst_show])
246 dnl if test "$tst_api" != "unknown"; then
247 dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_LIBRARY, $tst_api,
248 dnl [OpenSSL library link time API. Defined only by configure script.
249 dnl No matter what, do not ever define this manually or by any other means.])
251 curl_openssl_api_library=$tst_api
255 dnl CURL_CHECK_OPENSSL_API
256 dnl -------------------------------------------------
258 AC_DEFUN([CURL_CHECK_OPENSSL_API], [
260 CURL_CHECK_OPENSSL_API_HEADERS
261 CURL_CHECK_OPENSSL_API_LIBRARY
265 AC_MSG_CHECKING([for OpenSSL headers and library versions matching])
266 if test "$curl_openssl_api_headers" = "unknown" ||
267 test "$curl_openssl_api_library" = "unknown"; then
269 tst_warns="Can not compare OpenSSL headers and library versions."
270 elif test "$curl_openssl_api_headers" != "$curl_openssl_api_library"; then
272 tst_warns="OpenSSL headers and library versions do not match."
274 AC_MSG_RESULT([$tst_match])
275 if test "$tst_match" != "yes"; then
276 AC_MSG_WARN([$tst_warns])