Artifact
dc9bb37a5d291f3826c075a8da2553d23ea888bc:
0000: 41 43 5f 44 45 46 55 4e 28 5b 54 43 4c 54 4c 53 AC_DEFUN([TCLTLS
0010: 5f 53 53 4c 5f 4f 50 45 4e 53 53 4c 5d 2c 20 5b _SSL_OPENSSL], [
0020: 0a 09 64 6e 6c 20 55 73 65 20 70 6b 67 2d 63 6f ..dnl Use pkg-co
0030: 6e 66 69 67 20 74 6f 20 66 69 6e 64 20 74 68 65 nfig to find the
0040: 20 6c 69 62 72 61 72 69 65 73 0a 09 54 43 4c 54 libraries..TCLT
0050: 4c 53 5f 53 53 4c 5f 4c 49 42 53 3d 22 60 22 24 LS_SSL_LIBS="`"$
0060: 7b 50 4b 47 43 4f 4e 46 49 47 7d 22 20 6f 70 65 {PKGCONFIG}" ope
0070: 6e 73 73 6c 20 2d 2d 6c 69 62 73 60 22 20 7c 7c nssl --libs`" ||
0080: 20 41 43 5f 4d 53 47 5f 45 52 52 4f 52 28 5b 55 AC_MSG_ERROR([U
0090: 6e 61 62 6c 65 20 74 6f 20 67 65 74 20 4f 70 65 nable to get Ope
00a0: 6e 53 53 4c 20 43 6f 6e 66 69 67 75 72 61 74 69 nSSL Configurati
00b0: 6f 6e 5d 29 0a 09 54 43 4c 54 4c 53 5f 53 53 4c on])..TCLTLS_SSL
00c0: 5f 43 46 4c 41 47 53 3d 22 60 22 24 7b 50 4b 47 _CFLAGS="`"${PKG
00d0: 43 4f 4e 46 49 47 7d 22 20 6f 70 65 6e 73 73 6c CONFIG}" openssl
00e0: 20 2d 2d 63 66 6c 61 67 73 2d 6f 6e 6c 79 2d 6f --cflags-only-o
00f0: 74 68 65 72 60 22 20 7c 7c 20 41 43 5f 4d 53 47 ther`" || AC_MSG
0100: 5f 45 52 52 4f 52 28 5b 55 6e 61 62 6c 65 20 74 _ERROR([Unable t
0110: 6f 20 67 65 74 20 4f 70 65 6e 53 53 4c 20 43 6f o get OpenSSL Co
0120: 6e 66 69 67 75 72 61 74 69 6f 6e 5d 29 0a 09 54 nfiguration])..T
0130: 43 4c 54 4c 53 5f 53 53 4c 5f 43 50 50 46 4c 41 CLTLS_SSL_CPPFLA
0140: 47 53 3d 22 60 22 24 7b 50 4b 47 43 4f 4e 46 49 GS="`"${PKGCONFI
0150: 47 7d 22 20 6f 70 65 6e 73 73 6c 20 2d 2d 63 66 G}" openssl --cf
0160: 6c 61 67 73 2d 6f 6e 6c 79 2d 49 60 22 20 7c 7c lags-only-I`" ||
0170: 20 41 43 5f 4d 53 47 5f 45 52 52 4f 52 28 5b 55 AC_MSG_ERROR([U
0180: 6e 61 62 6c 65 20 74 6f 20 67 65 74 20 4f 70 65 nable to get Ope
0190: 6e 53 53 4c 20 43 6f 6e 66 69 67 75 72 61 74 69 nSSL Configurati
01a0: 6f 6e 5d 29 0a 0a 09 64 6e 6c 20 53 61 76 65 20 on])...dnl Save
01b0: 63 6f 6d 70 69 6c 65 2d 61 6c 74 65 72 69 6e 67 compile-altering
01c0: 20 76 61 72 69 61 62 6c 65 73 20 77 65 20 61 72 variables we ar
01d0: 65 20 63 68 61 6e 67 69 6e 67 0a 09 53 41 56 45 e changing..SAVE
01e0: 5f 4c 49 42 53 3d 22 24 7b 4c 49 42 53 7d 22 0a _LIBS="${LIBS}".
01f0: 09 53 41 56 45 5f 43 46 4c 41 47 53 3d 22 24 7b .SAVE_CFLAGS="${
0200: 43 46 4c 41 47 53 7d 22 0a 09 53 41 56 45 5f 43 CFLAGS}"..SAVE_C
0210: 50 50 46 4c 41 47 53 3d 22 24 7b 43 50 50 46 4c PPFLAGS="${CPPFL
0220: 41 47 53 7d 22 0a 0a 09 64 6e 6c 20 55 70 64 61 AGS}"...dnl Upda
0230: 74 65 20 63 6f 6d 70 69 6c 65 2d 61 6c 74 65 72 te compile-alter
0240: 69 6e 67 20 76 61 72 69 61 62 6c 65 73 20 74 6f ing variables to
0250: 20 69 6e 63 6c 75 64 65 20 74 68 65 20 4f 70 65 include the Ope
0260: 6e 53 53 4c 20 6c 69 62 72 61 72 69 65 73 0a 09 nSSL libraries..
0270: 4c 49 42 53 3d 22 24 7b 53 41 56 45 5f 4c 49 42 LIBS="${SAVE_LIB
0280: 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53 53 4c 5f S} ${TCLTLS_SSL_
0290: 4c 49 42 53 7d 22 0a 09 43 46 4c 41 47 53 3d 22 LIBS}"..CFLAGS="
02a0: 24 7b 53 41 56 45 5f 43 46 4c 41 47 53 7d 20 24 ${SAVE_CFLAGS} $
02b0: 7b 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 46 4c 41 {TCLTLS_SSL_CFLA
02c0: 47 53 7d 22 0a 09 43 50 50 46 4c 41 47 53 3d 22 GS}"..CPPFLAGS="
02d0: 24 7b 53 41 56 45 5f 43 50 50 46 4c 41 47 53 7d ${SAVE_CPPFLAGS}
02e0: 20 24 7b 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 50 ${TCLTLS_SSL_CP
02f0: 50 46 4c 41 47 53 7d 22 0a 0a 09 64 6e 6c 20 56 PFLAGS}"...dnl V
0300: 65 72 69 66 79 20 74 68 61 74 20 62 61 73 69 63 erify that basic
0310: 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 69 functionality i
0320: 73 20 74 68 65 72 65 0a 09 41 43 5f 4c 41 4e 47 s there..AC_LANG
0330: 5f 50 55 53 48 28 43 29 0a 09 41 43 5f 4d 53 47 _PUSH(C)..AC_MSG
0340: 5f 43 48 45 43 4b 49 4e 47 28 5b 69 66 20 61 20 _CHECKING([if a
0350: 62 61 73 69 63 20 4f 70 65 6e 53 53 4c 20 70 72 basic OpenSSL pr
0360: 6f 67 72 61 6d 20 77 6f 72 6b 73 5d 29 0a 09 41 ogram works])..A
0370: 43 5f 4c 49 4e 4b 5f 49 46 45 4c 53 45 28 5b 41 C_LINK_IFELSE([A
0380: 43 5f 4c 41 4e 47 5f 50 52 4f 47 52 41 4d 28 5b C_LANG_PROGRAM([
0390: 0a 23 69 6e 63 6c 75 64 65 20 3c 6f 70 65 6e 73 .#include <opens
03a0: 73 6c 2f 73 73 6c 2e 68 3e 0a 23 69 66 20 28 53 sl/ssl.h>.#if (S
03b0: 53 4c 45 41 59 5f 56 45 52 53 49 4f 4e 5f 4e 55 SLEAY_VERSION_NU
03c0: 4d 42 45 52 20 3e 3d 20 30 78 30 39 30 37 30 30 MBER >= 0x090700
03d0: 30 4c 29 0a 23 20 69 6e 63 6c 75 64 65 20 3c 6f 0L).# include <o
03e0: 70 65 6e 73 73 6c 2f 63 6f 6e 66 2e 68 3e 0a 23 penssl/conf.h>.#
03f0: 65 6e 64 69 66 0a 09 09 5d 2c 20 5b 0a 20 20 28 endif...], [. (
0400: 76 6f 69 64 29 53 53 4c 5f 6c 69 62 72 61 72 79 void)SSL_library
0410: 5f 69 6e 69 74 28 29 3b 0a 20 20 53 53 4c 5f 6c _init();. SSL_l
0420: 6f 61 64 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67 oad_error_string
0430: 73 28 29 3b 0a 20 20 4f 50 45 4e 53 53 4c 5f 63 s();. OPENSSL_c
0440: 6f 6e 66 69 67 28 4e 55 4c 4c 29 3b 0a 09 09 5d onfig(NULL);...]
0450: 29 5d 2c 20 5b 0a 09 09 41 43 5f 4d 53 47 5f 52 )], [...AC_MSG_R
0460: 45 53 55 4c 54 28 5b 79 65 73 5d 29 0a 09 5d 2c ESULT([yes])..],
0470: 20 5b 0a 09 09 41 43 5f 4d 53 47 5f 52 45 53 55 [...AC_MSG_RESU
0480: 4c 54 28 5b 6e 6f 5d 29 0a 09 09 41 43 5f 4d 53 LT([no])...AC_MS
0490: 47 5f 45 52 52 4f 52 28 5b 55 6e 61 62 6c 65 20 G_ERROR([Unable
04a0: 74 6f 20 63 6f 6d 70 69 6c 65 20 61 20 62 61 73 to compile a bas
04b0: 69 63 20 70 72 6f 67 72 61 6d 20 75 73 69 6e 67 ic program using
04c0: 20 4f 70 65 6e 53 53 4c 5d 29 0a 09 5d 29 0a 09 OpenSSL])..])..
04d0: 41 43 5f 4c 41 4e 47 5f 50 4f 50 28 5b 43 5d 29 AC_LANG_POP([C])
04e0: 0a 0a 09 64 6e 6c 20 44 65 74 65 72 6d 69 6e 65 ...dnl Determine
04f0: 20 69 66 20 53 53 4c 76 32 20 69 73 20 73 75 70 if SSLv2 is sup
0500: 70 6f 72 74 65 64 0a 09 69 66 20 74 65 73 74 20 ported..if test
0510: 22 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 73 73 6c "$tcltls_ssl_ssl
0520: 32 22 20 3d 20 22 74 72 75 65 22 3b 20 74 68 65 2" = "true"; the
0530: 6e 0a 09 09 41 43 5f 43 48 45 43 4b 5f 46 55 4e n...AC_CHECK_FUN
0540: 43 28 53 53 4c 76 32 5f 6d 65 74 68 6f 64 2c 2c C(SSLv2_method,,
0550: 20 5b 0a 09 09 09 74 63 6c 74 6c 73 5f 73 73 6c [....tcltls_ssl
0560: 5f 73 73 6c 32 3d 27 66 61 6c 73 65 27 0a 09 09 _ssl2='false'...
0570: 5d 29 0a 09 66 69 0a 0a 09 69 66 20 74 65 73 74 ])..fi...if test
0580: 20 22 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 73 73 "$tcltls_ssl_ss
0590: 6c 32 22 20 3d 20 22 66 61 6c 73 65 22 3b 20 74 l2" = "false"; t
05a0: 68 65 6e 0a 09 09 41 43 5f 44 45 46 49 4e 45 28 hen...AC_DEFINE(
05b0: 4e 4f 5f 53 53 4c 32 2c 20 5b 31 5d 2c 20 5b 44 NO_SSL2, [1], [D
05c0: 65 66 69 6e 65 20 74 68 69 73 20 74 6f 20 64 69 efine this to di
05d0: 73 61 62 6c 65 20 53 53 4c 76 32 20 69 6e 20 4f sable SSLv2 in O
05e0: 70 65 6e 53 53 4c 20 73 75 70 70 6f 72 74 5d 29 penSSL support])
05f0: 0a 09 66 69 0a 0a 09 64 6e 6c 20 44 65 74 65 72 ..fi...dnl Deter
0600: 6d 69 6e 65 20 69 66 20 53 53 4c 76 33 20 69 73 mine if SSLv3 is
0610: 20 73 75 70 70 6f 72 74 65 64 0a 09 69 66 20 74 supported..if t
0620: 65 73 74 20 22 24 74 63 6c 74 6c 73 5f 73 73 6c est "$tcltls_ssl
0630: 5f 73 73 6c 33 22 20 3d 20 22 74 72 75 65 22 3b _ssl3" = "true";
0640: 20 74 68 65 6e 0a 09 09 41 43 5f 43 48 45 43 4b then...AC_CHECK
0650: 5f 46 55 4e 43 28 53 53 4c 76 33 5f 6d 65 74 68 _FUNC(SSLv3_meth
0660: 6f 64 2c 2c 20 5b 0a 09 09 09 74 63 6c 74 6c 73 od,, [....tcltls
0670: 5f 73 73 6c 5f 73 73 6c 33 3d 27 66 61 6c 73 65 _ssl_ssl3='false
0680: 27 0a 09 09 5d 29 0a 09 66 69 0a 0a 09 69 66 20 '...])..fi...if
0690: 74 65 73 74 20 22 24 74 63 6c 74 6c 73 5f 73 73 test "$tcltls_ss
06a0: 6c 5f 73 73 6c 33 22 20 3d 20 22 66 61 6c 73 65 l_ssl3" = "false
06b0: 22 3b 20 74 68 65 6e 0a 09 09 41 43 5f 44 45 46 "; then...AC_DEF
06c0: 49 4e 45 28 4e 4f 5f 53 53 4c 33 2c 20 5b 31 5d INE(NO_SSL3, [1]
06d0: 2c 20 5b 44 65 66 69 6e 65 20 74 68 69 73 20 74 , [Define this t
06e0: 6f 20 64 69 73 61 62 6c 65 20 53 53 4c 76 33 20 o disable SSLv3
06f0: 69 6e 20 4f 70 65 6e 53 53 4c 20 73 75 70 70 6f in OpenSSL suppo
0700: 72 74 5d 29 0a 09 66 69 0a 0a 09 64 6e 6c 20 44 rt])..fi...dnl D
0710: 65 74 65 72 6d 69 6e 65 20 69 66 20 54 4c 53 76 etermine if TLSv
0720: 31 2e 30 20 69 73 20 73 75 70 70 6f 72 74 65 64 1.0 is supported
0730: 0a 09 69 66 20 74 65 73 74 20 22 24 74 63 6c 74 ..if test "$tclt
0740: 6c 73 5f 73 73 6c 5f 74 6c 73 31 5f 30 22 20 3d ls_ssl_tls1_0" =
0750: 20 22 74 72 75 65 22 3b 20 74 68 65 6e 0a 09 09 "true"; then...
0760: 41 43 5f 43 48 45 43 4b 5f 46 55 4e 43 28 54 4c AC_CHECK_FUNC(TL
0770: 53 76 31 5f 6d 65 74 68 6f 64 2c 2c 20 5b 0a 09 Sv1_method,, [..
0780: 09 09 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73 ..tcltls_ssl_tls
0790: 31 5f 30 3d 27 66 61 6c 73 65 27 0a 09 09 5d 29 1_0='false'...])
07a0: 0a 09 66 69 0a 0a 09 69 66 20 74 65 73 74 20 22 ..fi...if test "
07b0: 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73 31 $tcltls_ssl_tls1
07c0: 5f 30 22 20 3d 20 22 66 61 6c 73 65 22 3b 20 74 _0" = "false"; t
07d0: 68 65 6e 0a 09 09 41 43 5f 44 45 46 49 4e 45 28 hen...AC_DEFINE(
07e0: 4e 4f 5f 54 4c 53 31 2c 20 5b 31 5d 2c 20 5b 44 NO_TLS1, [1], [D
07f0: 65 66 69 6e 65 20 74 68 69 73 20 74 6f 20 64 69 efine this to di
0800: 73 61 62 6c 65 20 54 4c 53 76 31 2e 30 20 69 6e sable TLSv1.0 in
0810: 20 4f 70 65 6e 53 53 4c 20 73 75 70 70 6f 72 74 OpenSSL support
0820: 5d 29 0a 09 66 69 0a 0a 09 64 6e 6c 20 44 65 74 ])..fi...dnl Det
0830: 65 72 6d 69 6e 65 20 69 66 20 54 4c 53 76 31 2e ermine if TLSv1.
0840: 31 20 69 73 20 73 75 70 70 6f 72 74 65 64 0a 09 1 is supported..
0850: 69 66 20 74 65 73 74 20 22 24 74 63 6c 74 6c 73 if test "$tcltls
0860: 5f 73 73 6c 5f 74 6c 73 31 5f 31 22 20 3d 20 22 _ssl_tls1_1" = "
0870: 74 72 75 65 22 3b 20 74 68 65 6e 0a 09 09 41 43 true"; then...AC
0880: 5f 43 48 45 43 4b 5f 46 55 4e 43 28 54 4c 53 76 _CHECK_FUNC(TLSv
0890: 31 5f 31 5f 6d 65 74 68 6f 64 2c 2c 20 5b 0a 09 1_1_method,, [..
08a0: 09 09 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73 ..tcltls_ssl_tls
08b0: 31 5f 31 3d 27 66 61 6c 73 65 27 0a 09 09 5d 29 1_1='false'...])
08c0: 0a 09 66 69 0a 0a 09 69 66 20 74 65 73 74 20 22 ..fi...if test "
08d0: 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73 31 $tcltls_ssl_tls1
08e0: 5f 31 22 20 3d 20 22 66 61 6c 73 65 22 3b 20 74 _1" = "false"; t
08f0: 68 65 6e 0a 09 09 41 43 5f 44 45 46 49 4e 45 28 hen...AC_DEFINE(
0900: 4e 4f 5f 54 4c 53 31 5f 31 2c 20 5b 31 5d 2c 20 NO_TLS1_1, [1],
0910: 5b 44 65 66 69 6e 65 20 74 68 69 73 20 74 6f 20 [Define this to
0920: 64 69 73 61 62 6c 65 20 54 4c 53 76 31 2e 31 20 disable TLSv1.1
0930: 69 6e 20 4f 70 65 6e 53 53 4c 20 73 75 70 70 6f in OpenSSL suppo
0940: 72 74 5d 29 0a 09 66 69 0a 0a 09 64 6e 6c 20 44 rt])..fi...dnl D
0950: 65 74 65 72 6d 69 6e 65 20 69 66 20 54 4c 53 76 etermine if TLSv
0960: 31 2e 32 20 69 73 20 73 75 70 70 6f 72 74 65 64 1.2 is supported
0970: 0a 09 69 66 20 74 65 73 74 20 22 24 74 63 6c 74 ..if test "$tclt
0980: 6c 73 5f 73 73 6c 5f 74 6c 73 31 5f 32 22 20 3d ls_ssl_tls1_2" =
0990: 20 22 74 72 75 65 22 3b 20 74 68 65 6e 0a 09 09 "true"; then...
09a0: 41 43 5f 43 48 45 43 4b 5f 46 55 4e 43 28 54 4c AC_CHECK_FUNC(TL
09b0: 53 76 31 5f 32 5f 6d 65 74 68 6f 64 2c 2c 20 5b Sv1_2_method,, [
09c0: 0a 09 09 09 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 ....tcltls_ssl_t
09d0: 6c 73 31 5f 32 3d 27 66 61 6c 73 65 27 0a 09 09 ls1_2='false'...
09e0: 5d 29 0a 09 66 69 0a 0a 09 69 66 20 74 65 73 74 ])..fi...if test
09f0: 20 22 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c "$tcltls_ssl_tl
0a00: 73 31 5f 32 22 20 3d 20 22 66 61 6c 73 65 22 3b s1_2" = "false";
0a10: 20 74 68 65 6e 0a 09 09 41 43 5f 44 45 46 49 4e then...AC_DEFIN
0a20: 45 28 4e 4f 5f 54 4c 53 31 5f 32 2c 20 5b 31 5d E(NO_TLS1_2, [1]
0a30: 2c 20 5b 44 65 66 69 6e 65 20 74 68 69 73 20 74 , [Define this t
0a40: 6f 20 64 69 73 61 62 6c 65 20 54 4c 53 76 31 2e o disable TLSv1.
0a50: 32 20 69 6e 20 4f 70 65 6e 53 53 4c 20 73 75 70 2 in OpenSSL sup
0a60: 70 6f 72 74 5d 29 0a 09 66 69 0a 0a 09 64 6e 6c port])..fi...dnl
0a70: 20 52 65 73 74 6f 72 65 20 63 6f 6d 70 69 6c 65 Restore compile
0a80: 2d 61 6c 74 65 72 69 6e 67 20 76 61 72 69 61 62 -altering variab
0a90: 6c 65 73 0a 09 4c 49 42 53 3d 22 24 7b 53 41 56 les..LIBS="${SAV
0aa0: 45 5f 4c 49 42 53 7d 22 0a 09 43 46 4c 41 47 53 E_LIBS}"..CFLAGS
0ab0: 3d 22 24 7b 53 41 56 45 5f 43 46 4c 41 47 53 7d ="${SAVE_CFLAGS}
0ac0: 22 0a 09 43 50 50 46 4c 41 47 53 3d 22 24 7b 53 "..CPPFLAGS="${S
0ad0: 41 56 45 5f 43 50 50 46 4c 41 47 53 7d 22 0a 5d AVE_CPPFLAGS}".]
0ae0: 29 0a ).