0000: 64 6e 6c 20 44 65 66 69 6e 65 20 6f 75 72 73 65 dnl Define ourse
0010: 6c 76 65 73 0a 41 43 5f 49 4e 49 54 28 74 63 6c lves.AC_INIT(tcl
0020: 74 6c 73 2c 20 31 2e 37 2e 33 29 0a 0a 64 6e 6c tls, 1.7.3)..dnl
0030: 20 43 68 65 63 6b 73 20 66 6f 72 20 70 72 6f 67 Checks for prog
0040: 72 61 6d 73 2e 0a 41 43 5f 50 52 4f 47 5f 43 43 rams..AC_PROG_CC
0050: 0a 41 43 5f 50 52 4f 47 5f 4d 41 4b 45 5f 53 45 .AC_PROG_MAKE_SE
0060: 54 0a 41 43 5f 50 52 4f 47 5f 49 4e 53 54 41 4c T.AC_PROG_INSTAL
0070: 4c 0a 41 43 5f 47 4e 55 5f 53 4f 55 52 43 45 0a L.AC_GNU_SOURCE.
0080: 0a 64 6e 6c 20 44 65 74 65 72 6d 69 6e 65 20 73 .dnl Determine s
0090: 79 73 74 65 6d 20 69 6e 66 6f 72 6d 61 74 69 6f ystem informatio
00a0: 6e 0a 44 43 5f 43 48 4b 5f 4f 53 5f 49 4e 46 4f n.DC_CHK_OS_INFO
00b0: 0a 0a 64 6e 6c 20 4c 6f 6f 6b 20 66 6f 72 20 61 ..dnl Look for a
00c0: 70 70 72 6f 70 72 69 61 74 65 20 68 65 61 64 65 ppropriate heade
00d0: 72 73 0a 41 43 5f 43 48 45 43 4b 5f 48 45 41 44 rs.AC_CHECK_HEAD
00e0: 45 52 53 28 75 6e 69 73 74 64 2e 68 20 73 74 64 ERS(unistd.h std
00f0: 6c 69 62 2e 68 20 73 74 72 69 6e 67 2e 68 20 73 lib.h string.h s
0100: 74 72 69 6e 67 73 2e 68 29 0a 0a 64 6e 6c 20 50 trings.h)..dnl P
0110: 65 72 66 6f 72 6d 20 54 63 6c 20 45 78 74 65 6e erform Tcl Exten
0120: 73 69 6f 6e 20 72 65 71 75 69 72 65 64 20 73 74 sion required st
0130: 75 66 66 0a 54 43 4c 45 58 54 5f 49 4e 49 54 0a uff.TCLEXT_INIT.
0140: 0a 69 66 20 74 65 73 74 20 22 24 54 43 4c 45 58 .if test "$TCLEX
0150: 54 5f 42 55 49 4c 44 22 20 21 3d 20 27 73 74 61 T_BUILD" != 'sta
0160: 74 69 63 27 3b 20 74 68 65 6e 0a 09 64 6e 6c 20 tic'; then..dnl
0170: 44 65 74 65 72 6d 69 6e 65 20 68 6f 77 20 74 6f Determine how to
0180: 20 6d 61 6b 65 20 73 68 61 72 65 64 20 6f 62 6a make shared obj
0190: 65 63 74 73 0a 09 44 43 5f 47 45 54 5f 53 48 4f ects..DC_GET_SHO
01a0: 42 4a 46 4c 41 47 53 0a 0a 09 45 58 54 45 4e 53 BJFLAGS...EXTENS
01b0: 49 4f 4e 5f 54 41 52 47 45 54 3d 22 74 63 6c 74 ION_TARGET="tclt
01c0: 6c 73 2e 24 7b 53 48 4f 42 4a 45 58 54 7d 22 0a ls.${SHOBJEXT}".
01d0: 65 6c 73 65 0a 09 41 43 5f 43 48 45 43 4b 5f 54 else..AC_CHECK_T
01e0: 4f 4f 4c 28 5b 41 52 5d 2c 20 5b 61 72 5d 2c 20 OOL([AR], [ar],
01f0: 5b 66 61 6c 73 65 5d 29 0a 09 41 43 5f 43 48 45 [false])..AC_CHE
0200: 43 4b 5f 54 4f 4f 4c 28 5b 52 41 4e 4c 49 42 5d CK_TOOL([RANLIB]
0210: 2c 20 5b 72 61 6e 6c 69 62 5d 2c 20 5b 3a 5d 29 , [ranlib], [:])
0220: 0a 09 45 58 54 45 4e 53 49 4f 4e 5f 54 41 52 47 ..EXTENSION_TARG
0230: 45 54 3d 22 74 63 6c 74 6c 73 2e 24 7b 41 52 45 ET="tcltls.${ARE
0240: 58 54 7d 22 0a 66 69 0a 41 43 5f 53 55 42 53 54 XT}".fi.AC_SUBST
0250: 28 45 58 54 45 4e 53 49 4f 4e 5f 54 41 52 47 45 (EXTENSION_TARGE
0260: 54 29 0a 41 43 5f 53 55 42 53 54 28 54 43 4c 45 T).AC_SUBST(TCLE
0270: 58 54 5f 42 55 49 4c 44 29 0a 0a 64 6e 6c 20 44 XT_BUILD)..dnl D
0280: 65 74 65 72 6d 69 6e 65 20 77 68 61 74 20 53 53 etermine what SS
0290: 4c 20 6c 69 62 72 61 72 79 20 74 6f 20 6c 69 6e L library to lin
02a0: 6b 20 77 69 74 68 0a 41 43 5f 41 52 47 5f 57 49 k with.AC_ARG_WI
02b0: 54 48 28 5b 73 73 6c 5d 2c 20 41 53 5f 48 45 4c TH([ssl], AS_HEL
02c0: 50 5f 53 54 52 49 4e 47 28 5b 2d 2d 77 69 74 68 P_STRING([--with
02d0: 2d 73 73 6c 3d 3c 6e 61 6d 65 3e 5d 2c 20 5b 6e -ssl=<name>], [n
02e0: 61 6d 65 20 6f 66 20 73 73 6c 20 6c 69 62 72 61 ame of ssl libra
02f0: 72 79 20 74 6f 20 62 75 69 6c 64 20 61 67 61 69 ry to build agai
0300: 6e 73 74 20 28 6f 70 65 6e 73 73 6c 2c 20 6c 69 nst (openssl, li
0310: 62 72 65 73 73 6c 2c 20 6e 73 73 2c 20 61 75 74 bressl, nss, aut
0320: 6f 29 5d 29 2c 20 5b 0a 09 69 66 20 74 65 73 74 o)]), [..if test
0330: 20 22 24 77 69 74 68 76 61 6c 22 20 3d 20 22 6e "$withval" = "n
0340: 6f 22 3b 20 74 68 65 6e 0a 09 09 41 43 5f 4d 53 o"; then...AC_MS
0350: 47 5f 45 52 52 4f 52 28 5b 59 6f 75 20 6d 61 79 G_ERROR([You may
0360: 20 6e 6f 74 20 73 70 65 63 69 66 79 20 2d 2d 77 not specify --w
0370: 69 74 68 6f 75 74 2d 73 73 6c 5d 29 0a 09 66 69 ithout-ssl])..fi
0380: 0a 0a 09 69 66 20 74 65 73 74 20 22 24 77 69 74 ...if test "$wit
0390: 68 76 61 6c 22 20 3d 20 22 79 65 73 22 3b 20 74 hval" = "yes"; t
03a0: 68 65 6e 0a 09 09 41 43 5f 4d 53 47 5f 45 52 52 hen...AC_MSG_ERR
03b0: 4f 52 28 5b 49 66 20 79 6f 75 20 73 70 65 63 69 OR([If you speci
03c0: 66 79 20 2d 2d 77 69 74 68 2d 73 73 6c 20 74 68 fy --with-ssl th
03d0: 65 6e 20 79 6f 75 20 6d 75 73 74 20 70 72 6f 76 en you must prov
03e0: 69 64 65 20 61 20 76 61 6c 75 65 5d 29 0a 09 66 ide a value])..f
03f0: 69 0a 0a 09 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c i...tcltls_ssl_l
0400: 69 62 3d 22 24 77 69 74 68 76 61 6c 22 0a 5d 2c ib="$withval".],
0410: 20 5b 0a 09 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c [..tcltls_ssl_l
0420: 69 62 3d 27 61 75 74 6f 27 0a 5d 29 0a 0a 64 6e ib='auto'.])..dn
0430: 6c 20 45 6e 61 62 6c 65 20 73 75 70 70 6f 72 74 l Enable support
0440: 20 66 6f 72 20 62 75 69 6c 64 69 6e 67 20 74 68 for building th
0450: 65 20 73 61 6d 65 20 6c 69 62 72 61 72 79 20 65 e same library e
0460: 76 65 72 79 20 74 69 6d 65 0a 74 63 6c 74 6c 73 very time.tcltls
0470: 5f 64 65 74 65 72 6d 69 6e 69 73 74 69 63 3d 27 _deterministic='
0480: 66 61 6c 73 65 27 0a 41 43 5f 41 52 47 5f 45 4e false'.AC_ARG_EN
0490: 41 42 4c 45 28 5b 64 65 74 65 72 6d 69 6e 69 73 ABLE([determinis
04a0: 74 69 63 5d 2c 20 41 53 5f 48 45 4c 50 5f 53 54 tic], AS_HELP_ST
04b0: 52 49 4e 47 28 5b 2d 2d 65 6e 61 62 6c 65 2d 64 RING([--enable-d
04c0: 65 74 65 72 6d 69 6e 69 73 74 69 63 5d 2c 20 5b eterministic], [
04d0: 65 6e 61 62 6c 65 20 64 65 74 65 72 6d 69 6e 69 enable determini
04e0: 73 74 69 63 20 70 61 72 61 6d 65 74 65 72 73 5d stic parameters]
04f0: 29 2c 20 5b 0a 09 69 66 20 74 65 73 74 20 22 24 ), [..if test "$
0500: 65 6e 61 62 6c 65 76 61 6c 22 20 3d 20 22 79 65 enableval" = "ye
0510: 73 22 3b 20 74 68 65 6e 0a 09 09 74 63 6c 74 6c s"; then...tcltl
0520: 73 5f 64 65 74 65 72 6d 69 6e 69 73 74 69 63 3d s_deterministic=
0530: 27 74 72 75 65 27 0a 09 66 69 0a 5d 29 0a 69 66 'true'..fi.]).if
0540: 20 74 65 73 74 20 22 24 74 63 6c 74 6c 73 5f 64 test "$tcltls_d
0550: 65 74 65 72 6d 69 6e 69 73 74 69 63 22 20 3d 20 eterministic" =
0560: 27 74 72 75 65 27 3b 20 74 68 65 6e 0a 09 47 45 'true'; then..GE
0570: 4e 5f 44 48 5f 50 41 52 41 4d 53 5f 41 52 47 53 N_DH_PARAMS_ARGS
0580: 3d 27 66 61 6c 6c 62 61 63 6b 27 0a 65 6c 73 65 ='fallback'.else
0590: 0a 09 47 45 4e 5f 44 48 5f 50 41 52 41 4d 53 5f ..GEN_DH_PARAMS_
05a0: 41 52 47 53 3d 27 27 0a 66 69 0a 41 43 5f 53 55 ARGS=''.fi.AC_SU
05b0: 42 53 54 28 47 45 4e 5f 44 48 5f 50 41 52 41 4d BST(GEN_DH_PARAM
05c0: 53 5f 41 52 47 53 29 0a 0a 64 6e 6c 20 41 6c 6c S_ARGS)..dnl All
05d0: 6f 77 20 74 68 65 20 75 73 65 72 20 74 6f 20 6d ow the user to m
05e0: 61 6e 75 61 6c 6c 79 20 64 69 73 61 62 6c 65 20 anually disable
05f0: 70 72 6f 74 6f 63 6f 6c 73 0a 64 6e 6c 20 23 23 protocols.dnl ##
0600: 20 53 53 4c 76 32 3a 20 44 69 73 61 62 6c 65 64 SSLv2: Disabled
0610: 20 62 79 20 64 65 66 61 75 6c 74 0a 74 63 6c 74 by default.tclt
0620: 6c 73 5f 73 73 6c 5f 73 73 6c 32 3d 27 66 61 6c ls_ssl_ssl2='fal
0630: 73 65 27 0a 41 43 5f 41 52 47 5f 45 4e 41 42 4c se'.AC_ARG_ENABL
0640: 45 28 5b 73 73 6c 76 32 5d 2c 20 41 53 5f 48 45 E([sslv2], AS_HE
0650: 4c 50 5f 53 54 52 49 4e 47 28 5b 2d 2d 65 6e 61 LP_STRING([--ena
0660: 62 6c 65 2d 73 73 6c 76 32 5d 2c 20 5b 65 6e 61 ble-sslv2], [ena
0670: 62 6c 65 20 53 53 4c 76 32 20 70 72 6f 74 6f 63 ble SSLv2 protoc
0680: 6f 6c 5d 29 2c 20 5b 0a 09 69 66 20 74 65 73 74 ol]), [..if test
0690: 20 22 24 65 6e 61 62 6c 65 76 61 6c 22 20 3d 20 "$enableval" =
06a0: 22 79 65 73 22 3b 20 74 68 65 6e 0a 09 09 74 63 "yes"; then...tc
06b0: 6c 74 6c 73 5f 73 73 6c 5f 73 73 6c 32 3d 27 66 ltls_ssl_ssl2='f
06c0: 6f 72 63 65 27 0a 09 66 69 0a 5d 29 0a 0a 64 6e orce'..fi.])..dn
06d0: 6c 20 23 23 20 53 53 4c 76 33 3a 20 44 69 73 61 l ## SSLv3: Disa
06e0: 62 6c 65 64 20 62 79 20 64 65 66 61 75 6c 74 0a bled by default.
06f0: 74 63 6c 74 6c 73 5f 73 73 6c 5f 73 73 6c 33 3d tcltls_ssl_ssl3=
0700: 27 66 61 6c 73 65 27 0a 41 43 5f 41 52 47 5f 45 'false'.AC_ARG_E
0710: 4e 41 42 4c 45 28 5b 73 73 6c 76 33 5d 2c 20 41 NABLE([sslv3], A
0720: 53 5f 48 45 4c 50 5f 53 54 52 49 4e 47 28 5b 2d S_HELP_STRING([-
0730: 2d 65 6e 61 62 6c 65 2d 73 73 6c 76 33 5d 2c 20 -enable-sslv3],
0740: 5b 65 6e 61 62 6c 65 20 53 53 4c 76 33 20 70 72 [enable SSLv3 pr
0750: 6f 74 6f 63 6f 6c 5d 29 2c 20 5b 0a 09 69 66 20 otocol]), [..if
0760: 74 65 73 74 20 22 24 65 6e 61 62 6c 65 76 61 6c test "$enableval
0770: 22 20 3d 20 22 79 65 73 22 3b 20 74 68 65 6e 0a " = "yes"; then.
0780: 09 09 74 63 6c 74 6c 73 5f 73 73 6c 5f 73 73 6c ..tcltls_ssl_ssl
0790: 33 3d 27 66 6f 72 63 65 27 0a 09 66 69 0a 5d 29 3='force'..fi.])
07a0: 0a 0a 64 6e 6c 20 23 23 20 54 4c 53 76 31 2e 30 ..dnl ## TLSv1.0
07b0: 3a 20 45 6e 61 62 6c 65 64 20 62 79 20 64 65 66 : Enabled by def
07c0: 61 75 6c 74 0a 74 63 6c 74 6c 73 5f 73 73 6c 5f ault.tcltls_ssl_
07d0: 74 6c 73 31 5f 30 3d 27 74 72 75 65 27 0a 41 43 tls1_0='true'.AC
07e0: 5f 41 52 47 5f 45 4e 41 42 4c 45 28 5b 74 6c 73 _ARG_ENABLE([tls
07f0: 76 31 2e 30 5d 2c 20 41 53 5f 48 45 4c 50 5f 53 v1.0], AS_HELP_S
0800: 54 52 49 4e 47 28 5b 2d 2d 64 69 73 61 62 6c 65 TRING([--disable
0810: 2d 74 6c 73 76 31 2e 30 5d 2c 20 5b 64 69 73 61 -tlsv1.0], [disa
0820: 62 6c 65 20 54 4c 53 76 31 2e 30 20 70 72 6f 74 ble TLSv1.0 prot
0830: 6f 63 6f 6c 5d 29 2c 20 5b 0a 09 69 66 20 74 65 ocol]), [..if te
0840: 73 74 20 22 24 65 6e 61 62 6c 65 76 61 6c 22 20 st "$enableval"
0850: 3d 20 22 6e 6f 22 3b 20 74 68 65 6e 0a 09 09 74 = "no"; then...t
0860: 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73 31 5f 30 cltls_ssl_tls1_0
0870: 3d 27 66 61 6c 73 65 27 0a 09 66 69 0a 5d 29 0a ='false'..fi.]).
0880: 0a 64 6e 6c 20 23 23 20 54 4c 53 76 31 2e 31 3a .dnl ## TLSv1.1:
0890: 20 45 6e 61 62 6c 65 64 20 62 79 20 64 65 66 61 Enabled by defa
08a0: 75 6c 74 0a 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 ult.tcltls_ssl_t
08b0: 6c 73 31 5f 31 3d 27 74 72 75 65 27 0a 41 43 5f ls1_1='true'.AC_
08c0: 41 52 47 5f 45 4e 41 42 4c 45 28 5b 74 6c 73 76 ARG_ENABLE([tlsv
08d0: 31 2e 31 5d 2c 20 41 53 5f 48 45 4c 50 5f 53 54 1.1], AS_HELP_ST
08e0: 52 49 4e 47 28 5b 2d 2d 64 69 73 61 62 6c 65 2d RING([--disable-
08f0: 74 6c 73 76 31 2e 31 5d 2c 20 5b 64 69 73 61 62 tlsv1.1], [disab
0900: 6c 65 20 54 4c 53 76 31 2e 31 20 70 72 6f 74 6f le TLSv1.1 proto
0910: 63 6f 6c 5d 29 2c 20 5b 0a 09 69 66 20 74 65 73 col]), [..if tes
0920: 74 20 22 24 65 6e 61 62 6c 65 76 61 6c 22 20 3d t "$enableval" =
0930: 20 22 6e 6f 22 3b 20 74 68 65 6e 0a 09 09 74 63 "no"; then...tc
0940: 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73 31 5f 31 3d ltls_ssl_tls1_1=
0950: 27 66 61 6c 73 65 27 0a 09 66 69 0a 5d 29 0a 0a 'false'..fi.])..
0960: 64 6e 6c 20 23 23 20 54 4c 53 76 31 2e 31 3a 20 dnl ## TLSv1.1:
0970: 45 6e 61 62 6c 65 64 20 62 79 20 64 65 66 61 75 Enabled by defau
0980: 6c 74 0a 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c lt.tcltls_ssl_tl
0990: 73 31 5f 32 3d 27 74 72 75 65 27 0a 41 43 5f 41 s1_2='true'.AC_A
09a0: 52 47 5f 45 4e 41 42 4c 45 28 5b 74 6c 73 76 31 RG_ENABLE([tlsv1
09b0: 2e 32 5d 2c 20 41 53 5f 48 45 4c 50 5f 53 54 52 .2], AS_HELP_STR
09c0: 49 4e 47 28 5b 2d 2d 64 69 73 61 62 6c 65 2d 74 ING([--disable-t
09d0: 6c 73 76 31 2e 32 5d 2c 20 5b 64 69 73 61 62 6c lsv1.2], [disabl
09e0: 65 20 54 4c 53 76 31 2e 32 20 70 72 6f 74 6f 63 e TLSv1.2 protoc
09f0: 6f 6c 5d 29 2c 20 5b 0a 09 69 66 20 74 65 73 74 ol]), [..if test
0a00: 20 22 24 65 6e 61 62 6c 65 76 61 6c 22 20 3d 20 "$enableval" =
0a10: 22 6e 6f 22 3b 20 74 68 65 6e 0a 09 09 74 63 6c "no"; then...tcl
0a20: 74 6c 73 5f 73 73 6c 5f 74 6c 73 31 5f 32 3d 27 tls_ssl_tls1_2='
0a30: 66 61 6c 73 65 27 0a 09 66 69 0a 5d 29 0a 0a 64 false'..fi.])..d
0a40: 6e 6c 20 45 6e 61 62 6c 65 20 73 75 70 70 6f 72 nl Enable suppor
0a50: 74 20 66 6f 72 20 61 20 64 65 62 75 67 67 69 6e t for a debuggin
0a60: 67 20 62 75 69 6c 64 0a 74 63 6c 74 6c 73 5f 64 g build.tcltls_d
0a70: 65 62 75 67 3d 27 66 61 6c 73 65 27 0a 41 43 5f ebug='false'.AC_
0a80: 41 52 47 5f 45 4e 41 42 4c 45 28 5b 64 65 62 75 ARG_ENABLE([debu
0a90: 67 5d 2c 20 41 53 5f 48 45 4c 50 5f 53 54 52 49 g], AS_HELP_STRI
0aa0: 4e 47 28 5b 2d 2d 65 6e 61 62 6c 65 2d 64 65 62 NG([--enable-deb
0ab0: 75 67 5d 2c 20 5b 65 6e 61 62 6c 65 20 64 65 62 ug], [enable deb
0ac0: 75 67 67 69 6e 67 20 70 61 72 61 6d 65 74 65 72 ugging parameter
0ad0: 73 5d 29 2c 20 5b 0a 09 69 66 20 74 65 73 74 20 s]), [..if test
0ae0: 22 24 65 6e 61 62 6c 65 76 61 6c 22 20 3d 20 22 "$enableval" = "
0af0: 79 65 73 22 3b 20 74 68 65 6e 0a 09 09 74 63 6c yes"; then...tcl
0b00: 74 6c 73 5f 64 65 62 75 67 3d 27 74 72 75 65 27 tls_debug='true'
0b10: 0a 09 66 69 0a 5d 29 0a 69 66 20 74 65 73 74 20 ..fi.]).if test
0b20: 22 24 74 63 6c 74 6c 73 5f 64 65 62 75 67 22 20 "$tcltls_debug"
0b30: 3d 20 27 74 72 75 65 27 3b 20 74 68 65 6e 0a 09 = 'true'; then..
0b40: 41 43 5f 44 45 46 49 4e 45 28 54 43 4c 45 58 54 AC_DEFINE(TCLEXT
0b50: 5f 54 43 4c 54 4c 53 5f 44 45 42 55 47 2c 20 5b _TCLTLS_DEBUG, [
0b60: 31 5d 2c 20 5b 45 6e 61 62 6c 65 20 64 65 62 75 1], [Enable debu
0b70: 67 67 69 6e 67 20 62 75 69 6c 64 5d 29 0a 09 41 gging build])..A
0b80: 58 5f 43 48 45 43 4b 5f 43 4f 4d 50 49 4c 45 5f X_CHECK_COMPILE_
0b90: 46 4c 41 47 28 5b 2d 66 63 68 65 63 6b 2d 70 6f FLAG([-fcheck-po
0ba0: 69 6e 74 65 72 2d 62 6f 75 6e 64 73 5d 2c 20 5b inter-bounds], [
0bb0: 43 46 4c 41 47 53 3d 22 24 43 46 4c 41 47 53 20 CFLAGS="$CFLAGS
0bc0: 2d 66 63 68 65 63 6b 2d 70 6f 69 6e 74 65 72 2d -fcheck-pointer-
0bd0: 62 6f 75 6e 64 73 22 5d 29 0a 09 41 58 5f 43 48 bounds"])..AX_CH
0be0: 45 43 4b 5f 43 4f 4d 50 49 4c 45 5f 46 4c 41 47 ECK_COMPILE_FLAG
0bf0: 28 5b 2d 66 73 61 6e 69 74 69 7a 65 3d 61 64 64 ([-fsanitize=add
0c00: 72 65 73 73 5d 2c 20 5b 43 46 4c 41 47 53 3d 22 ress], [CFLAGS="
0c10: 24 43 46 4c 41 47 53 20 2d 66 73 61 6e 69 74 69 $CFLAGS -fsaniti
0c20: 7a 65 3d 61 64 64 72 65 73 73 22 5d 29 0a 09 41 ze=address"])..A
0c30: 58 5f 43 48 45 43 4b 5f 43 4f 4d 50 49 4c 45 5f X_CHECK_COMPILE_
0c40: 46 4c 41 47 28 5b 2d 66 73 61 6e 69 74 69 7a 65 FLAG([-fsanitize
0c50: 3d 75 6e 64 65 66 69 6e 65 64 5d 2c 20 5b 43 46 =undefined], [CF
0c60: 4c 41 47 53 3d 22 24 43 46 4c 41 47 53 20 2d 66 LAGS="$CFLAGS -f
0c70: 73 61 6e 69 74 69 7a 65 3d 75 6e 64 65 66 69 6e sanitize=undefin
0c80: 65 64 22 5d 29 0a 66 69 0a 0a 64 6e 6c 20 46 69 ed"]).fi..dnl Fi
0c90: 6e 64 20 22 78 78 64 22 20 73 6f 20 77 65 20 63 nd "xxd" so we c
0ca0: 61 6e 20 62 75 69 6c 64 20 74 68 65 20 74 6c 73 an build the tls
0cb0: 2e 74 63 6c 2e 68 20 66 69 6c 65 0a 41 43 5f 43 .tcl.h file.AC_C
0cc0: 48 45 43 4b 5f 50 52 4f 47 28 5b 58 58 44 5d 2c HECK_PROG([XXD],
0cd0: 20 5b 78 78 64 5d 2c 20 5b 78 78 64 5d 2c 20 5b [xxd], [xxd], [
0ce0: 5f 5f 78 78 64 5f 5f 6e 6f 74 5f 5f 66 6f 75 6e __xxd__not__foun
0cf0: 64 5d 29 0a 0a 64 6e 6c 20 46 69 6e 64 20 22 70 d])..dnl Find "p
0d00: 6b 67 2d 63 6f 6e 66 69 67 22 20 73 69 6e 63 65 kg-config" since
0d10: 20 77 65 20 6e 65 65 64 20 74 6f 20 75 73 65 20 we need to use
0d20: 69 74 0a 41 43 5f 43 48 45 43 4b 5f 54 4f 4f 4c it.AC_CHECK_TOOL
0d30: 28 5b 50 4b 47 43 4f 4e 46 49 47 5d 2c 20 5b 70 ([PKGCONFIG], [p
0d40: 6b 67 2d 63 6f 6e 66 69 67 5d 2c 20 5b 66 61 6c kg-config], [fal
0d50: 73 65 5d 29 0a 0a 64 6e 6c 20 44 65 74 65 72 6d se])..dnl Determ
0d60: 69 6e 65 20 69 66 20 77 65 20 68 61 76 65 20 62 ine if we have b
0d70: 65 65 6e 20 61 73 6b 65 64 20 74 6f 20 73 74 61 een asked to sta
0d80: 74 69 63 61 6c 6c 79 20 6c 69 6e 6b 20 74 6f 20 tically link to
0d90: 74 68 65 20 53 53 4c 20 6c 69 62 72 61 72 79 0a the SSL library.
0da0: 54 43 4c 45 58 54 5f 54 4c 53 5f 53 54 41 54 49 TCLEXT_TLS_STATI
0db0: 43 5f 53 53 4c 3d 27 6e 6f 27 0a 41 43 5f 41 52 C_SSL='no'.AC_AR
0dc0: 47 5f 45 4e 41 42 4c 45 28 5b 73 74 61 74 69 63 G_ENABLE([static
0dd0: 2d 73 73 6c 5d 2c 20 41 53 5f 48 45 4c 50 5f 53 -ssl], AS_HELP_S
0de0: 54 52 49 4e 47 28 5b 2d 2d 65 6e 61 62 6c 65 2d TRING([--enable-
0df0: 73 74 61 74 69 63 2d 73 73 6c 5d 2c 20 5b 65 6e static-ssl], [en
0e00: 61 62 6c 65 20 73 74 61 74 69 63 61 6c 6c 79 20 able statically
0e10: 6c 69 6e 6b 69 6e 67 20 74 6f 20 74 68 65 20 73 linking to the s
0e20: 70 65 63 69 66 69 65 64 20 53 53 4c 20 6c 69 62 pecified SSL lib
0e30: 72 61 72 79 5d 29 2c 20 5b 0a 09 69 66 20 74 65 rary]), [..if te
0e40: 73 74 20 22 24 65 6e 61 62 6c 65 76 61 6c 22 20 st "$enableval"
0e50: 3d 20 27 79 65 73 27 3b 20 74 68 65 6e 0a 09 09 = 'yes'; then...
0e60: 54 43 4c 45 58 54 5f 54 4c 53 5f 53 54 41 54 49 TCLEXT_TLS_STATI
0e70: 43 5f 53 53 4c 3d 27 79 65 73 27 0a 09 66 69 0a C_SSL='yes'..fi.
0e80: 5d 29 0a 0a 64 6e 6c 20 45 6e 61 62 6c 65 20 68 ])..dnl Enable h
0e90: 61 72 64 65 6e 69 6e 67 0a 41 58 5f 43 48 45 43 ardening.AX_CHEC
0ea0: 4b 5f 43 4f 4d 50 49 4c 45 5f 46 4c 41 47 28 5b K_COMPILE_FLAG([
0eb0: 2d 66 73 74 61 63 6b 2d 70 72 6f 74 65 63 74 6f -fstack-protecto
0ec0: 72 2d 61 6c 6c 5d 2c 20 5b 43 46 4c 41 47 53 3d r-all], [CFLAGS=
0ed0: 22 24 43 46 4c 41 47 53 20 2d 66 73 74 61 63 6b "$CFLAGS -fstack
0ee0: 2d 70 72 6f 74 65 63 74 6f 72 2d 61 6c 6c 22 5d -protector-all"]
0ef0: 29 0a 41 58 5f 43 48 45 43 4b 5f 43 4f 4d 50 49 ).AX_CHECK_COMPI
0f00: 4c 45 5f 46 4c 41 47 28 5b 2d 66 6e 6f 2d 73 74 LE_FLAG([-fno-st
0f10: 72 69 63 74 2d 6f 76 65 72 66 6c 6f 77 5d 2c 20 rict-overflow],
0f20: 5b 43 46 4c 41 47 53 3d 22 24 43 46 4c 41 47 53 [CFLAGS="$CFLAGS
0f30: 20 2d 66 6e 6f 2d 73 74 72 69 63 74 2d 6f 76 65 -fno-strict-ove
0f40: 72 66 6c 6f 77 22 5d 29 0a 41 43 5f 44 45 46 49 rflow"]).AC_DEFI
0f50: 4e 45 28 5b 5f 46 4f 52 54 49 46 59 5f 53 4f 55 NE([_FORTIFY_SOU
0f60: 52 43 45 5d 2c 20 5b 32 5d 2c 20 5b 45 6e 61 62 RCE], [2], [Enab
0f70: 6c 65 20 66 6f 72 74 69 66 69 63 61 74 69 6f 6e le fortification
0f80: 5d 29 0a 0a 64 6e 6c 20 58 58 58 3a 54 4f 44 4f ])..dnl XXX:TODO
0f90: 3a 20 41 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 : Automatically
0fa0: 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 53 53 determine the SS
0fb0: 4c 20 6c 69 62 72 61 72 79 20 74 6f 20 75 73 65 L library to use
0fc0: 0a 64 6e 6c 20 20 20 20 20 20 20 20 20 20 20 64 .dnl d
0fd0: 65 66 61 75 6c 74 69 6e 67 20 74 6f 20 4f 70 65 efaulting to Ope
0fe0: 6e 53 53 4c 20 66 6f 72 20 63 6f 6d 70 61 74 69 nSSL for compati
0ff0: 62 69 6c 69 74 79 20 72 65 61 73 6f 6e 73 0a 69 bility reasons.i
1000: 66 20 74 65 73 74 20 22 24 74 63 6c 74 6c 73 5f f test "$tcltls_
1010: 73 73 6c 5f 6c 69 62 22 20 3d 20 27 61 75 74 6f ssl_lib" = 'auto
1020: 27 3b 20 74 68 65 6e 0a 09 74 63 6c 74 6c 73 5f '; then..tcltls_
1030: 73 73 6c 5f 6c 69 62 3d 27 6f 70 65 6e 73 73 6c ssl_lib='openssl
1040: 27 0a 66 69 0a 0a 41 43 5f 4d 53 47 5f 43 48 45 '.fi..AC_MSG_CHE
1050: 43 4b 49 4e 47 28 5b 77 68 69 63 68 20 54 4c 53 CKING([which TLS
1060: 20 6c 69 62 72 61 72 79 20 74 6f 20 75 73 65 5d library to use]
1070: 29 0a 41 43 5f 4d 53 47 5f 52 45 53 55 4c 54 28 ).AC_MSG_RESULT(
1080: 5b 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c 69 62 [$tcltls_ssl_lib
1090: 5d 29 0a 0a 64 6e 6c 20 4d 61 6e 75 61 6c 6c 79 ])..dnl Manually
10a0: 20 72 65 77 72 69 74 65 20 6c 69 62 72 65 73 73 rewrite libress
10b0: 6c 20 74 6f 20 4f 70 65 6e 53 53 4c 20 73 69 6e l to OpenSSL sin
10c0: 63 65 20 77 65 20 75 73 65 20 74 68 65 0a 64 6e ce we use the.dn
10d0: 6c 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 l compatibility
10e0: 69 6e 74 65 72 66 61 63 65 0a 69 66 20 74 65 73 interface.if tes
10f0: 74 20 22 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c t "$tcltls_ssl_l
1100: 69 62 22 20 3d 20 22 6c 69 62 72 65 73 73 6c 22 ib" = "libressl"
1110: 3b 20 74 68 65 6e 0a 09 74 63 6c 74 6c 73 5f 73 ; then..tcltls_s
1120: 73 6c 5f 6c 69 62 3d 27 6f 70 65 6e 73 73 6c 27 sl_lib='openssl'
1130: 0a 66 69 0a 0a 41 53 5f 43 41 53 45 28 5b 24 74 .fi..AS_CASE([$t
1140: 63 6c 74 6c 73 5f 73 73 6c 5f 6c 69 62 5d 2c 0a cltls_ssl_lib],.
1150: 09 5b 6f 70 65 6e 73 73 6c 5d 2c 20 5b 0a 09 09 .[openssl], [...
1160: 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f 50 45 4e 53 TCLTLS_SSL_OPENS
1170: 53 4c 0a 09 5d 2c 0a 09 5b 6e 73 73 5d 2c 20 5b SL..],..[nss], [
1180: 0a 09 20 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c .. .TCLTLS_SSL_L
1190: 49 42 53 3d 22 22 0a 09 09 54 43 4c 54 4c 53 5f IBS=""...TCLTLS_
11a0: 53 53 4c 5f 43 46 4c 41 47 53 3d 22 22 0a 09 09 SSL_CFLAGS=""...
11b0: 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 50 50 46 4c TCLTLS_SSL_CPPFL
11c0: 41 47 53 3d 22 22 0a 09 5d 2c 0a 09 5b 0a 09 09 AGS=""..],..[...
11d0: 41 43 5f 4d 53 47 5f 45 52 52 4f 52 28 5b 55 6e AC_MSG_ERROR([Un
11e0: 73 75 70 70 6f 72 74 65 64 20 53 53 4c 20 6c 69 supported SSL li
11f0: 62 72 61 72 79 3a 20 24 74 63 6c 74 6c 73 5f 73 brary: $tcltls_s
1200: 73 6c 5f 6c 69 62 5d 29 0a 09 5d 0a 29 0a 64 6e sl_lib])..].).dn
1210: 6c 20 44 65 74 65 72 6d 69 6e 65 20 68 6f 77 20 l Determine how
1220: 74 6f 20 75 73 65 20 74 68 69 73 20 53 53 4c 20 to use this SSL
1230: 6c 69 62 72 61 72 79 0a 41 43 5f 4d 53 47 5f 43 library.AC_MSG_C
1240: 48 45 43 4b 49 4e 47 28 5b 68 6f 77 20 74 6f 20 HECKING([how to
1250: 75 73 65 20 24 74 63 6c 74 6c 73 5f 73 73 6c 5f use $tcltls_ssl_
1260: 6c 69 62 5d 29 0a 4c 49 42 53 3d 22 24 7b 4c 49 lib]).LIBS="${LI
1270: 42 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53 53 4c BS} ${TCLTLS_SSL
1280: 5f 4c 49 42 53 7d 22 0a 43 46 4c 41 47 53 3d 22 _LIBS}".CFLAGS="
1290: 24 7b 43 46 4c 41 47 53 7d 20 24 7b 54 43 4c 54 ${CFLAGS} ${TCLT
12a0: 4c 53 5f 53 53 4c 5f 43 46 4c 41 47 53 7d 22 0a LS_SSL_CFLAGS}".
12b0: 43 50 50 46 4c 41 47 53 3d 22 24 7b 43 50 50 46 CPPFLAGS="${CPPF
12c0: 4c 41 47 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53 LAGS} ${TCLTLS_S
12d0: 53 4c 5f 43 50 50 46 4c 41 47 53 7d 22 0a 41 43 SL_CPPFLAGS}".AC
12e0: 5f 4d 53 47 5f 52 45 53 55 4c 54 28 5b 24 54 43 _MSG_RESULT([$TC
12f0: 4c 54 4c 53 5f 53 53 4c 5f 43 50 50 46 4c 41 47 LTLS_SSL_CPPFLAG
1300: 53 20 24 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 46 S $TCLTLS_SSL_CF
1310: 4c 41 47 53 20 24 54 43 4c 54 4c 53 5f 53 53 4c LAGS $TCLTLS_SSL
1320: 5f 4c 49 42 53 5d 29 0a 0a 64 6e 6c 20 53 79 6e _LIBS])..dnl Syn
1330: 63 20 74 68 65 20 52 50 41 54 48 20 69 66 20 72 c the RPATH if r
1340: 65 71 75 65 73 74 65 64 0a 69 66 20 74 65 73 74 equested.if test
1350: 20 22 24 54 43 4c 45 58 54 5f 42 55 49 4c 44 22 "$TCLEXT_BUILD"
1360: 20 21 3d 20 27 73 74 61 74 69 63 27 3b 20 74 68 != 'static'; th
1370: 65 6e 0a 09 69 66 20 74 65 73 74 20 22 24 54 43 en..if test "$TC
1380: 4c 45 58 54 5f 54 4c 53 5f 53 54 41 54 49 43 5f LEXT_TLS_STATIC_
1390: 53 53 4c 22 20 3d 20 27 79 65 73 27 3b 20 74 68 SSL" = 'yes'; th
13a0: 65 6e 0a 09 09 44 43 5f 53 59 4e 43 5f 52 50 41 en...DC_SYNC_RPA
13b0: 54 48 28 5b 6e 6f 5d 29 0a 09 65 6c 73 65 0a 09 TH([no])..else..
13c0: 09 44 43 5f 53 59 4e 43 5f 52 50 41 54 48 28 5b .DC_SYNC_RPATH([
13d0: 79 65 73 5d 29 0a 09 66 69 0a 66 69 0a 0a 64 6e yes])..fi.fi..dn
13e0: 6c 20 50 72 6f 64 75 63 65 20 6f 75 74 70 75 74 l Produce output
13f0: 0a 41 43 5f 4f 55 54 50 55 54 28 4d 61 6b 65 66 .AC_OUTPUT(Makef
1400: 69 6c 65 20 70 6b 67 49 6e 64 65 78 2e 74 63 6c ile pkgIndex.tcl
1410: 29 0a ).