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
|
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
|
-
+
-
+
-
+
-
+
-
+
|
AC_DEFUN([TCLTLS_SSL_OPENSSL], [
dnl Determine if pkg-config tool is available
AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
dnl Enable support for SSL 3.0 protocol
AC_ARG_ENABLE([ssl3], AS_HELP_STRING([--disable-ssl3], [disable SSL3 protocol]), [
if test "${enableval}" == "no"; then
if test "$enableval" == "no"; then
AC_DEFINE([NO_SSL3], [1], [Disable SSL3 protocol])
AC_MSG_CHECKING([for disable SSL3 protocol])
AC_MSG_RESULT([yes])
fi
], AC_DEFINE([NO_SSL3], [1], [Disable SSL3 protocol]))
dnl Disable support for TLS 1.0 protocol
AC_ARG_ENABLE([tls1], AS_HELP_STRING([--disable-tls1], [disable TLS1 protocol]), [
if test "${enableval}" == "no"; then
if test "$enableval" == "no"; then
AC_DEFINE([NO_TLS1], [1], [Disable TLS1 protocol])
AC_MSG_CHECKING([for disable TLS1 protocol])
AC_MSG_RESULT([yes])
fi
])
dnl Disable support for TLS 1.1 protocol
AC_ARG_ENABLE([tls1_1], AS_HELP_STRING([--disable-tls1_1], [disable TLS1.1 protocol]), [
if test "${enableval}" == "no"; then
if test "$enableval" == "no"; then
AC_DEFINE([NO_TLS1_1], [1], [Disable TLS1.1 protocol])
AC_MSG_CHECKING([for disable TLS1.1 protocol])
AC_MSG_RESULT([yes])
fi
])
dnl Disable support for TLS 1.2 protocol
AC_ARG_ENABLE([tls1_2], AS_HELP_STRING([--disable-tls1_2], [disable TLS1.2 protocol]), [
if test "${enableval}" == "no"; then
if test "$enableval" == "no"; then
AC_DEFINE([NO_TLS1_2], [1], [Disable TLS1.2 protocol])
AC_MSG_CHECKING([for disable TLS1.2 protocol])
AC_MSG_RESULT([yes])
fi
])
dnl Disable support for TLS 1.3 protocol
AC_ARG_ENABLE([tls1_3], AS_HELP_STRING([--disable-tls1_3], [disable TLS1.3 protocol]), [
if test "${enableval}" == "no"; then
if test "$enableval" == "no"; then
AC_DEFINE([NO_TLS1_3], [1], [Disable TLS1.3 protocol])
AC_MSG_CHECKING([for disable TLS1.3 protocol])
AC_MSG_RESULT([yes])
fi
])
|
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
|
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
|
-
+
-
+
-
+
-
+
|
)
AC_MSG_CHECKING([for OpenSSL include directory])
AC_MSG_RESULT($opensslincludedir)
dnl Set SSL include variables
if test -n "$opensslincludedir"; then
AC_MSG_CHECKING([for ssl.h])
if test -f "$opensslincludedir/openssl/ssl.h"; then
if test -f "${opensslincludedir}/openssl/ssl.h"; then
TCLTLS_SSL_CFLAGS="-I$opensslincludedir"
TCLTLS_SSL_INCLUDES="-I$opensslincludedir"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([Unable to locate ssl.h])
fi
fi
dnl Set SSL lib files path
AC_ARG_WITH([openssl-libdir],
AS_HELP_STRING([--with-openssl-libdir=<dir>],
[path to lib directory of OpenSSL or LibreSSL installation]
), [
openssllibdir="$withval"
], [
if test -n "$openssldir"; then
if test "$do64bit" == 'yes' -a -d $openssldir/lib64; then
if test "$do64bit" == 'yes' -a -d ${openssldir}/lib64; then
openssllibdir="$openssldir/lib64"
else
openssllibdir="$openssldir/lib"
fi
else
openssllibdir=''
fi
]
)
AC_MSG_CHECKING([for OpenSSL lib directory])
AC_MSG_RESULT($openssllibdir)
dnl Set SSL lib variables
SSL_LIBS_PATH=''
if test -n "$openssllibdir"; then
if test "${TCLEXT_TLS_STATIC_SSL}" == 'no'; then
if test "$TCLEXT_TLS_STATIC_SSL" == 'no'; then
LIBEXT=${SHLIB_SUFFIX}
else
LIBEXT='.a'
fi
if test -f "$openssllibdir/libssl${LIBEXT}"; then
if test -f "${openssllibdir}/libssl${LIBEXT}"; then
SSL_LIBS_PATH="-L$openssllibdir"
else
AC_MSG_ERROR([Unable to locate libssl${LIBEXT}])
fi
fi
dnl Set location of pkgconfig files
|
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
|
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
|
-
-
+
+
+
-
-
+
+
-
+
-
+
+
-
+
|
opensslpkgconfigdir=''
fi
]
)
AC_MSG_CHECKING([for OpenSSL pkgconfig])
AC_MSG_RESULT($opensslpkgconfigdir)
dnl Check if OpenSSL is available
USE_PKG_CONFIG=`"${PKG_CONFIG}" --list-package-names | grep openssl`
dnl Use pkg-config to find OpenSSL if not already found
if test -n "$PKG_CONFIG" -a -z "$openssldir" -a -z "$opensslincludedir" -a -z "$openssllibdir"; then
USE_PKG_CONFIG=`"${PKG_CONFIG}" --list-all | grep openssl`
dnl Use pkg-config to find the library names
if test -n "${PKG_CONFIG}" -a -n "${USE_PKG_CONFIG}"; then
dnl Use pkg-config to find the library names
if test -n "$USE_PKG_CONFIG"; then
dnl Temporarily update PKG_CONFIG_PATH
PKG_CONFIG_PATH_SAVE="${PKG_CONFIG_PATH}"
if test -n "${opensslpkgconfigdir}"; then
if test -n "$opensslpkgconfigdir"; then
if ! test -f "${opensslpkgconfigdir}/openssl.pc"; then
AC_MSG_ERROR([Unable to locate ${opensslpkgconfigdir}/openssl.pc])
fi
PKG_CONFIG_PATH="${opensslpkgconfigdir}:${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH
fi
pkgConfigExtraArgs=''
if test "${SHARED_BUILD}" == "0" -o "$TCLEXT_TLS_STATIC_SSL" == 'yes'; then
if test "$SHARED_BUILD" == "0" -o "$TCLEXT_TLS_STATIC_SSL" == 'yes'; then
pkgConfigExtraArgs='--static'
fi
if test -z "$TCLTLS_SSL_LIBS"; then
TCLTLS_SSL_LIBS="$SSL_LIBS_PATH `${PKG_CONFIG} openssl --libs $pkgConfigExtraArgs`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration])
if test "${TCLEXT_TLS_STATIC_SSL}" == 'yes'; then
TCLTLS_SSL_LIBS="-Wl,-Bstatic $TCLTLS_SSL_LIBS -Wl,-Bdynamic"
fi
fi
if test -z "$TCLTLS_SSL_CFLAGS"; then
TCLTLS_SSL_CFLAGS="`"${PKG_CONFIG}" openssl --cflags-only-other $pkgConfigExtraArgs`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration])
fi
if test -z "$TCLTLS_SSL_INCLUDES"; then
TCLTLS_SSL_INCLUDES="`"${PKG_CONFIG}" openssl --cflags-only-I $pkgConfigExtraArgs`" || AC_MSG_ERROR([Unable to get OpenSSL Configuration])
fi
PKG_CONFIG_PATH="${PKG_CONFIG_PATH_SAVE}"
fi
fi
dnl Use fall-back settings for OpenSSL include and library paths
if test -z "$TCLTLS_SSL_CFLAGS"; then
TCLTLS_SSL_CFLAGS=""
fi
if test -z "$TCLTLS_SSL_INCLUDES"; then
if test -f /usr/include/openssl/ssl.h; then
TCLTLS_SSL_INCLUDES="-I/usr/include"
fi
fi
if test -z "$TCLTLS_SSL_LIBS"; then
if test "${TCLEXT_TLS_STATIC_SSL}" == 'no'; then
if test "$TCLEXT_TLS_STATIC_SSL" == 'no'; then
TCLTLS_SSL_LIBS="$SSL_LIBS_PATH -lssl -lcrypto"
else
# Linux and Solaris
TCLTLS_SSL_LIBS="$SSL_LIBS_PATH -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic"
# HPUX: -Wl,-a,archive ... -Wl,-a,shared_archive
fi
fi
dnl Include config variables in --help list and make available to be substituted via AC_SUBST.
AC_ARG_VAR([TCLTLS_SSL_CFLAGS], [C compiler flags for OpenSSL or LibreSSL])
AC_ARG_VAR([TCLTLS_SSL_INCLUDES], [C compiler include paths for OpenSSL or LibreSSL])
AC_ARG_VAR([TCLTLS_SSL_LIBS], [libraries to pass to the linker for OpenSSL or LibreSSL])
])
|