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