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 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" ;; 82 esac 83 tst_show="$tst_show - $curl_cv_def_OPENSSL_VERSION_NUMBER" 84 else 85 tst_show="unknown" 86 fi 87 AC_MSG_RESULT([$tst_show]) 88 # 89dnl if test "$tst_api" != "unknown"; then 90dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_HEADERS, $tst_api, 91dnl [OpenSSL headers configure time API. Defined only by configure script. 92dnl No matter what, do not ever define this manually or by any other means.]) 93dnl fi 94 curl_openssl_api_headers=$tst_api 95]) 96 97 98dnl CURL_CHECK_OPENSSL_API_LIBRARY 99dnl ------------------------------------------------- 100dnl Find out OpenSSL library API version, performing 101dnl only link tests in order to avoid getting fooled 102dnl by mismatched OpenSSL headers. No runtime checks 103dnl allowed here for cross-compilation support. 104dnl HAVE_OPENSSL_API_LIBRARY is defined as apprpriate 105dnl only for systems which actually run the configure 106dnl script. Config files generated manually or in any 107dnl other way shall not define this. 108dnl 109dnl Most probably we should not bother attempting to 110dnl detect OpenSSL library development API versions 111dnl 0.9.9 and 1.1.0. For our intended use, detecting 112dnl released versions should be good enough. 113dnl 114dnl Given that currently we are not using the result 115dnl of this check, except for informative purposes, 116dnl lets try to figure out everything. 117 118AC_DEFUN([CURL_CHECK_OPENSSL_API_LIBRARY], [ 119 # 120 tst_api="unknown" 121 # 122 AC_MSG_CHECKING([for OpenSSL library version]) 123 if test "$tst_api" = "unknown"; then 124 case $host in 125 *-*-vms*) 126 AC_LINK_IFELSE([ 127 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumbl_sess_cb]) 128 ],[ 129 tst_api="0x110" 130 ]) 131 ;; 132 *) 133 AC_LINK_IFELSE([ 134 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_not_resumable_session_callback]) 135 ],[ 136 tst_api="0x110" 137 ]) 138 ;; 139 esac 140 fi 141 if test "$tst_api" = "unknown"; then 142 AC_LINK_IFELSE([ 143 AC_LANG_FUNC_LINK_TRY([SSL_renegotiate_abbreviated]) 144 ],[ 145 tst_api="0x101" 146 ]) 147 fi 148 if test "$tst_api" = "unknown"; then 149 AC_LINK_IFELSE([ 150 AC_LANG_FUNC_LINK_TRY([OBJ_add_sigid]) 151 ],[ 152 tst_api="0x100" 153 ]) 154 fi 155 if test "$tst_api" = "unknown"; then 156 AC_LINK_IFELSE([ 157 AC_LANG_FUNC_LINK_TRY([ERR_set_mark]) 158 ],[ 159 tst_api="0x098" 160 ]) 161 fi 162 if test "$tst_api" = "unknown"; then 163 AC_LINK_IFELSE([ 164 AC_LANG_FUNC_LINK_TRY([ERR_peek_last_error]) 165 ],[ 166 tst_api="0x097" 167 ]) 168 fi 169 if test "$tst_api" = "unknown"; then 170 AC_LINK_IFELSE([ 171 AC_LANG_FUNC_LINK_TRY([c2i_ASN1_OBJECT]) 172 ],[ 173 tst_api="0x096" 174 ]) 175 fi 176 if test "$tst_api" = "unknown"; then 177 AC_LINK_IFELSE([ 178 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_purpose]) 179 ],[ 180 tst_api="0x095" 181 ]) 182 fi 183 if test "$tst_api" = "unknown"; then 184 AC_LINK_IFELSE([ 185 AC_LANG_FUNC_LINK_TRY([OBJ_obj2txt]) 186 ],[ 187 tst_api="0x094" 188 ]) 189 fi 190 if test "$tst_api" = "unknown"; then 191 AC_LINK_IFELSE([ 192 AC_LANG_FUNC_LINK_TRY([SSL_get_verify_depth]) 193 ],[ 194 tst_api="0x093" 195 ]) 196 fi 197 if test "$tst_api" = "unknown"; then 198 AC_LINK_IFELSE([ 199 AC_LANG_FUNC_LINK_TRY([SSL_library_init]) 200 ],[ 201 tst_api="0x092" 202 ]) 203 fi 204 if test "$tst_api" = "unknown"; then 205 AC_LINK_IFELSE([ 206 AC_LANG_FUNC_LINK_TRY([SSL_CTX_set_cipher_list]) 207 ],[ 208 tst_api="0x091" 209 ]) 210 fi 211 case $tst_api in 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" ;; 225 esac 226 AC_MSG_RESULT([$tst_show]) 227 # 228dnl if test "$tst_api" != "unknown"; then 229dnl AC_DEFINE_UNQUOTED(HAVE_OPENSSL_API_LIBRARY, $tst_api, 230dnl [OpenSSL library link time API. Defined only by configure script. 231dnl No matter what, do not ever define this manually or by any other means.]) 232dnl fi 233 curl_openssl_api_library=$tst_api 234]) 235 236 237dnl CURL_CHECK_OPENSSL_API 238dnl ------------------------------------------------- 239 240AC_DEFUN([CURL_CHECK_OPENSSL_API], [ 241 # 242 CURL_CHECK_OPENSSL_API_HEADERS 243 CURL_CHECK_OPENSSL_API_LIBRARY 244 # 245 tst_match="yes" 246 # 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 250 tst_match="fail" 251 tst_warns="Can not compare OpenSSL headers and library versions." 252 elif test "$curl_openssl_api_headers" != "$curl_openssl_api_library"; then 253 tst_match="no" 254 tst_warns="OpenSSL headers and library versions do not match." 255 fi 256 AC_MSG_RESULT([$tst_match]) 257 if test "$tst_match" != "yes"; then 258 AC_MSG_WARN([$tst_warns]) 259 fi 260]) 261