1#*************************************************************************** 2# _ _ ____ _ 3# Project ___| | | | _ \| | 4# / __| | | | |_) | | 5# | (__| |_| | _ <| |___ 6# \___|\___/|_| \_\_____| 7# 8# Copyright (C) 1998 - 2011, 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 http://curl.haxx.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#*************************************************************************** 22 23# File version for 'aclocal' use. Keep it a single number. 24# serial 5 25 26 27dnl CURL_CHECK_OPENSSL_API_HEADERS 28dnl ------------------------------------------------- 29dnl Find out OpenSSL headers API version, as reported 30dnl by OPENSSL_VERSION_NUMBER. No runtime checks 31dnl allowed here for cross-compilation support. 32dnl HAVE_OPENSSL_API_HEADERS is defined as apprpriate 33dnl only for systems which actually run the configure 34dnl script. Config files generated manually or in any 35dnl other way shall not define this. 36 37AC_DEFUN([CURL_CHECK_OPENSSL_API_HEADERS], [ 38 # 39 tst_api="unknown" 40 # 41 AC_MSG_CHECKING([for OpenSSL headers version]) 42 CURL_CHECK_DEF([OPENSSL_VERSION_NUMBER], [ 43# ifdef USE_OPENSSL 44# include <openssl/crypto.h> 45# else 46# include <crypto.h> 47# endif 48 ], [silent]) 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 52 x6) 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 57 ;; 58 x11|x10) 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 63 ;; 64 *) 65 tst_api="unknown" 66 ;; 67 esac 68 case $tst_api in 69 0x110) tst_show="1.1.0" ;; 70 0x102) tst_show="1.0.2" ;; 71 0x101) tst_show="1.0.1" ;; 72 0x100) tst_show="1.0.0" ;; 73 0x099) tst_show="0.9.9" ;; 74 0x098) tst_show="0.9.8" ;; 75 0x097) tst_show="0.9.7" ;; 76 0x096) tst_show="0.9.6" ;; 77 0x095) tst_show="0.9.5" ;; 78 0x094) tst_show="0.9.4" ;; 79 0x093) tst_show="0.9.3" ;; 80 0x092) tst_show="0.9.2" ;; 81 0x091) tst_show="0.9.1" ;; 82 *) tst_show="unknown" ;; 83 esac 84 tst_show="$tst_show - $curl_cv_def_OPENSSL_VERSION_NUMBER" 85 else 86 tst_show="unknown" 87 fi 88 AC_MSG_RESULT([$tst_show]) 89 # 90dnl if test "$tst_api" != "unknown"; then 91dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_HEADERS, $tst_api, 92dnl [OpenSSL headers configure time API. Defined only by configure script. 93dnl No matter what, do not ever define this manually or by any other means.]) 94dnl fi 95 curl_openssl_api_headers=$tst_api 96]) 97 98 99dnl CURL_CHECK_OPENSSL_API_LIBRARY 100dnl ------------------------------------------------- 101dnl Find out OpenSSL library API version, performing 102dnl only link tests in order to avoid getting fooled 103dnl by mismatched OpenSSL headers. No runtime checks 104dnl allowed here for cross-compilation support. 105dnl HAVE_OPENSSL_API_LIBRARY is defined as apprpriate 106dnl only for systems which actually run the configure 107dnl script. Config files generated manually or in any 108dnl other way shall not define this. 109dnl 110dnl Most probably we should not bother attempting to 111dnl detect OpenSSL library development API versions 112dnl 0.9.9 and 1.1.0. For our intended use, detecting 113dnl released versions should be good enough. 114dnl 115dnl Given that currently we are not using the result 116dnl of this check, except for informative purposes, 117dnl lets try to figure out everything. 118 119AC_DEFUN([CURL_CHECK_OPENSSL_API_LIBRARY], [ 120 # 121 tst_api="unknown" 122 # 123 AC_MSG_CHECKING([for OpenSSL library version]) 124 if test "$tst_api" = "unknown"; then 125 case $host in 126 *-*-vms*) 127 AC_LINK_IFELSE([ 128 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumbl_sess_cb]) 129 ],[ 130 tst_api="0x110" 131 ]) 132 ;; 133 *) 134 AC_LINK_IFELSE([ 135 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumable_session_callback]) 136 ],[ 137 tst_api="0x110" 138 ]) 139 ;; 140 esac 141 fi 142 if test "$tst_api" = "unknown"; then 143 AC_LINK_IFELSE([ 144 AC_LANG_FUNC_LINK_TRY([SSL_CONF_CTX_new]) 145 ],[ 146 tst_api="0x102" 147 ]) 148 fi 149 if test "$tst_api" = "unknown"; then 150 AC_LINK_IFELSE([ 151 AC_LANG_FUNC_LINK_TRY([SSL_renegotiate_abbreviated]) 152 ],[ 153 tst_api="0x101" 154 ]) 155 fi 156 if test "$tst_api" = "unknown"; then 157 AC_LINK_IFELSE([ 158 AC_LANG_FUNC_LINK_TRY([OBJ_add_sigid]) 159 ],[ 160 tst_api="0x100" 161 ]) 162 fi 163 if test "$tst_api" = "unknown"; then 164 AC_LINK_IFELSE([ 165 AC_LANG_FUNC_LINK_TRY([ERR_set_mark]) 166 ],[ 167 tst_api="0x098" 168 ]) 169 fi 170 if test "$tst_api" = "unknown"; then 171 AC_LINK_IFELSE([ 172 AC_LANG_FUNC_LINK_TRY([ERR_peek_last_error]) 173 ],[ 174 tst_api="0x097" 175 ]) 176 fi 177 if test "$tst_api" = "unknown"; then 178 AC_LINK_IFELSE([ 179 AC_LANG_FUNC_LINK_TRY([c2i_ASN1_OBJECT]) 180 ],[ 181 tst_api="0x096" 182 ]) 183 fi 184 if test "$tst_api" = "unknown"; then 185 AC_LINK_IFELSE([ 186 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_purpose]) 187 ],[ 188 tst_api="0x095" 189 ]) 190 fi 191 if test "$tst_api" = "unknown"; then 192 AC_LINK_IFELSE([ 193 AC_LANG_FUNC_LINK_TRY([OBJ_obj2txt]) 194 ],[ 195 tst_api="0x094" 196 ]) 197 fi 198 if test "$tst_api" = "unknown"; then 199 AC_LINK_IFELSE([ 200 AC_LANG_FUNC_LINK_TRY([SSL_get_verify_depth]) 201 ],[ 202 tst_api="0x093" 203 ]) 204 fi 205 if test "$tst_api" = "unknown"; then 206 AC_LINK_IFELSE([ 207 AC_LANG_FUNC_LINK_TRY([SSL_library_init]) 208 ],[ 209 tst_api="0x092" 210 ]) 211 fi 212 if test "$tst_api" = "unknown"; then 213 AC_LINK_IFELSE([ 214 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_cipher_list]) 215 ],[ 216 tst_api="0x091" 217 ]) 218 fi 219 case $tst_api in 220 0x110) tst_show="1.1.0" ;; 221 0x102) tst_show="1.0.2" ;; 222 0x101) tst_show="1.0.1" ;; 223 0x100) tst_show="1.0.0" ;; 224 0x099) tst_show="0.9.9" ;; 225 0x098) tst_show="0.9.8" ;; 226 0x097) tst_show="0.9.7" ;; 227 0x096) tst_show="0.9.6" ;; 228 0x095) tst_show="0.9.5" ;; 229 0x094) tst_show="0.9.4" ;; 230 0x093) tst_show="0.9.3" ;; 231 0x092) tst_show="0.9.2" ;; 232 0x091) tst_show="0.9.1" ;; 233 *) tst_show="unknown" ;; 234 esac 235 AC_MSG_RESULT([$tst_show]) 236 # 237dnl if test "$tst_api" != "unknown"; then 238dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_LIBRARY, $tst_api, 239dnl [OpenSSL library link time API. Defined only by configure script. 240dnl No matter what, do not ever define this manually or by any other means.]) 241dnl fi 242 curl_openssl_api_library=$tst_api 243]) 244 245 246dnl CURL_CHECK_OPENSSL_API 247dnl ------------------------------------------------- 248 249AC_DEFUN([CURL_CHECK_OPENSSL_API], [ 250 # 251 CURL_CHECK_OPENSSL_API_HEADERS 252 CURL_CHECK_OPENSSL_API_LIBRARY 253 # 254 tst_match="yes" 255 # 256 AC_MSG_CHECKING([for OpenSSL headers and library versions matching]) 257 if test "$curl_openssl_api_headers" = "unknown" || 258 test "$curl_openssl_api_library" = "unknown"; then 259 tst_match="fail" 260 tst_warns="Can not compare OpenSSL headers and library versions." 261 elif test "$curl_openssl_api_headers" != "$curl_openssl_api_library"; then 262 tst_match="no" 263 tst_warns="OpenSSL headers and library versions do not match." 264 fi 265 AC_MSG_RESULT([$tst_match]) 266 if test "$tst_match" != "yes"; then 267 AC_MSG_WARN([$tst_warns]) 268 fi 269]) 270