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 http://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 apprpriate
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 0x110) tst_show="1.1.0" ;;
70 0x101) tst_show="1.0.1" ;;
71 0x100) tst_show="1.0.0" ;;
72 0x099) tst_show="0.9.9" ;;
73 0x098) tst_show="0.9.8" ;;
74 0x097) tst_show="0.9.7" ;;
75 0x096) tst_show="0.9.6" ;;
76 0x095) tst_show="0.9.5" ;;
77 0x094) tst_show="0.9.4" ;;
78 0x093) tst_show="0.9.3" ;;
79 0x092) tst_show="0.9.2" ;;
80 0x091) tst_show="0.9.1" ;;
81 *) tst_show="unknown" ;;
83 tst_show="$tst_show - $curl_cv_def_OPENSSL_VERSION_NUMBER"
87 AC_MSG_RESULT([$tst_show])
89 dnl if test "$tst_api" != "unknown"; then
90 dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_HEADERS, $tst_api,
91 dnl [OpenSSL headers configure time API. Defined only by configure script.
92 dnl No matter what, do not ever define this manually or by any other means.])
94 curl_openssl_api_headers=$tst_api
98 dnl CURL_CHECK_OPENSSL_API_LIBRARY
99 dnl -------------------------------------------------
100 dnl Find out OpenSSL library API version, performing
101 dnl only link tests in order to avoid getting fooled
102 dnl by mismatched OpenSSL headers. No runtime checks
103 dnl allowed here for cross-compilation support.
104 dnl HAVE_OPENSSL_API_LIBRARY is defined as apprpriate
105 dnl only for systems which actually run the configure
106 dnl script. Config files generated manually or in any
107 dnl other way shall not define this.
109 dnl Most probably we should not bother attempting to
110 dnl detect OpenSSL library development API versions
111 dnl 0.9.9 and 1.1.0. For our intended use, detecting
112 dnl released versions should be good enough.
114 dnl Given that currently we are not using the result
115 dnl of this check, except for informative purposes,
116 dnl lets try to figure out everything.
118 AC_DEFUN([CURL_CHECK_OPENSSL_API_LIBRARY], [
122 AC_MSG_CHECKING([for OpenSSL library version])
123 if test "$tst_api" = "unknown"; then
127 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumbl_sess_cb])
134 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumable_session_callback])
141 if test "$tst_api" = "unknown"; then
143 AC_LANG_FUNC_LINK_TRY([SSL_renegotiate_abbreviated])
148 if test "$tst_api" = "unknown"; then
150 AC_LANG_FUNC_LINK_TRY([OBJ_add_sigid])
155 if test "$tst_api" = "unknown"; then
157 AC_LANG_FUNC_LINK_TRY([ERR_set_mark])
162 if test "$tst_api" = "unknown"; then
164 AC_LANG_FUNC_LINK_TRY([ERR_peek_last_error])
169 if test "$tst_api" = "unknown"; then
171 AC_LANG_FUNC_LINK_TRY([c2i_ASN1_OBJECT])
176 if test "$tst_api" = "unknown"; then
178 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_purpose])
183 if test "$tst_api" = "unknown"; then
185 AC_LANG_FUNC_LINK_TRY([OBJ_obj2txt])
190 if test "$tst_api" = "unknown"; then
192 AC_LANG_FUNC_LINK_TRY([SSL_get_verify_depth])
197 if test "$tst_api" = "unknown"; then
199 AC_LANG_FUNC_LINK_TRY([SSL_library_init])
204 if test "$tst_api" = "unknown"; then
206 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_cipher_list])
212 0x110) tst_show="1.1.0" ;;
213 0x101) tst_show="1.0.1" ;;
214 0x100) tst_show="1.0.0" ;;
215 0x099) tst_show="0.9.9" ;;
216 0x098) tst_show="0.9.8" ;;
217 0x097) tst_show="0.9.7" ;;
218 0x096) tst_show="0.9.6" ;;
219 0x095) tst_show="0.9.5" ;;
220 0x094) tst_show="0.9.4" ;;
221 0x093) tst_show="0.9.3" ;;
222 0x092) tst_show="0.9.2" ;;
223 0x091) tst_show="0.9.1" ;;
224 *) tst_show="unknown" ;;
226 AC_MSG_RESULT([$tst_show])
228 dnl if test "$tst_api" != "unknown"; then
229 dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_LIBRARY, $tst_api,
230 dnl [OpenSSL library link time API. Defined only by configure script.
231 dnl No matter what, do not ever define this manually or by any other means.])
233 curl_openssl_api_library=$tst_api
237 dnl CURL_CHECK_OPENSSL_API
238 dnl -------------------------------------------------
240 AC_DEFUN([CURL_CHECK_OPENSSL_API], [
242 CURL_CHECK_OPENSSL_API_HEADERS
243 CURL_CHECK_OPENSSL_API_LIBRARY
247 AC_MSG_CHECKING([for OpenSSL headers and library versions matching])
248 if test "$curl_openssl_api_headers" = "unknown" ||
249 test "$curl_openssl_api_library" = "unknown"; then
251 tst_warns="Can not compare OpenSSL headers and library versions."
252 elif test "$curl_openssl_api_headers" != "$curl_openssl_api_library"; then
254 tst_warns="OpenSSL headers and library versions do not match."
256 AC_MSG_RESULT([$tst_match])
257 if test "$tst_match" != "yes"; then
258 AC_MSG_WARN([$tst_warns])