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 66 69  gging build]).fi
0b80: 0a 0a 64 6e 6c 20 46 69 6e 64 20 22 78 78 64 22  ..dnl Find "xxd"
0b90: 20 73 6f 20 77 65 20 63 61 6e 20 62 75 69 6c 64   so we can build
0ba0: 20 74 68 65 20 74 6c 73 2e 74 63 6c 2e 68 20 66   the tls.tcl.h f
0bb0: 69 6c 65 0a 41 43 5f 43 48 45 43 4b 5f 50 52 4f  ile.AC_CHECK_PRO
0bc0: 47 28 5b 58 58 44 5d 2c 20 5b 78 78 64 5d 2c 20  G([XXD], [xxd], 
0bd0: 5b 78 78 64 5d 2c 20 5b 5f 5f 78 78 64 5f 5f 6e  [xxd], [__xxd__n
0be0: 6f 74 5f 5f 66 6f 75 6e 64 5d 29 0a 0a 64 6e 6c  ot__found])..dnl
0bf0: 20 46 69 6e 64 20 22 70 6b 67 2d 63 6f 6e 66 69   Find "pkg-confi
0c00: 67 22 20 73 69 6e 63 65 20 77 65 20 6e 65 65 64  g" since we need
0c10: 20 74 6f 20 75 73 65 20 69 74 0a 41 43 5f 43 48   to use it.AC_CH
0c20: 45 43 4b 5f 54 4f 4f 4c 28 5b 50 4b 47 43 4f 4e  ECK_TOOL([PKGCON
0c30: 46 49 47 5d 2c 20 5b 70 6b 67 2d 63 6f 6e 66 69  FIG], [pkg-confi
0c40: 67 5d 2c 20 5b 66 61 6c 73 65 5d 29 0a 0a 64 6e  g], [false])..dn
0c50: 6c 20 44 65 74 65 72 6d 69 6e 65 20 69 66 20 77  l Determine if w
0c60: 65 20 68 61 76 65 20 62 65 65 6e 20 61 73 6b 65  e have been aske
0c70: 64 20 74 6f 20 73 74 61 74 69 63 61 6c 6c 79 20  d to statically 
0c80: 6c 69 6e 6b 20 74 6f 20 74 68 65 20 53 53 4c 20  link to the SSL 
0c90: 6c 69 62 72 61 72 79 0a 54 43 4c 45 58 54 5f 54  library.TCLEXT_T
0ca0: 4c 53 5f 53 54 41 54 49 43 5f 53 53 4c 3d 27 6e  LS_STATIC_SSL='n
0cb0: 6f 27 0a 41 43 5f 41 52 47 5f 45 4e 41 42 4c 45  o'.AC_ARG_ENABLE
0cc0: 28 5b 73 74 61 74 69 63 2d 73 73 6c 5d 2c 20 41  ([static-ssl], A
0cd0: 53 5f 48 45 4c 50 5f 53 54 52 49 4e 47 28 5b 2d  S_HELP_STRING([-
0ce0: 2d 65 6e 61 62 6c 65 2d 73 74 61 74 69 63 2d 73  -enable-static-s
0cf0: 73 6c 5d 2c 20 5b 65 6e 61 62 6c 65 20 73 74 61  sl], [enable sta
0d00: 74 69 63 61 6c 6c 79 20 6c 69 6e 6b 69 6e 67 20  tically linking 
0d10: 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 64  to the specified
0d20: 20 53 53 4c 20 6c 69 62 72 61 72 79 5d 29 2c 20   SSL library]), 
0d30: 5b 0a 09 69 66 20 74 65 73 74 20 22 24 65 6e 61  [..if test "$ena
0d40: 62 6c 65 76 61 6c 22 20 3d 20 27 79 65 73 27 3b  bleval" = 'yes';
0d50: 20 74 68 65 6e 0a 09 09 54 43 4c 45 58 54 5f 54   then...TCLEXT_T
0d60: 4c 53 5f 53 54 41 54 49 43 5f 53 53 4c 3d 27 79  LS_STATIC_SSL='y
0d70: 65 73 27 0a 09 66 69 0a 5d 29 0a 0a 64 6e 6c 20  es'..fi.])..dnl 
0d80: 58 58 58 3a 54 4f 44 4f 3a 20 41 75 74 6f 6d 61  XXX:TODO: Automa
0d90: 74 69 63 61 6c 6c 79 20 64 65 74 65 72 6d 69 6e  tically determin
0da0: 65 20 74 68 65 20 53 53 4c 20 6c 69 62 72 61 72  e the SSL librar
0db0: 79 20 74 6f 20 75 73 65 0a 64 6e 6c 20 20 20 20  y to use.dnl    
0dc0: 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 69 6e         defaultin
0dd0: 67 20 74 6f 20 4f 70 65 6e 53 53 4c 20 66 6f 72  g to OpenSSL for
0de0: 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 72   compatibility r
0df0: 65 61 73 6f 6e 73 0a 69 66 20 74 65 73 74 20 22  easons.if test "
0e00: 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c 69 62 22  $tcltls_ssl_lib"
0e10: 20 3d 20 27 61 75 74 6f 27 3b 20 74 68 65 6e 0a   = 'auto'; then.
0e20: 09 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c 69 62 3d  .tcltls_ssl_lib=
0e30: 27 6f 70 65 6e 73 73 6c 27 0a 66 69 0a 0a 41 43  'openssl'.fi..AC
0e40: 5f 4d 53 47 5f 43 48 45 43 4b 49 4e 47 28 5b 77  _MSG_CHECKING([w
0e50: 68 69 63 68 20 54 4c 53 20 6c 69 62 72 61 72 79  hich TLS library
0e60: 20 74 6f 20 75 73 65 5d 29 0a 54 43 4c 54 4c 53   to use]).TCLTLS
0e70: 5f 53 53 4c 5f 4c 49 42 3d 22 24 7b 74 63 6c 74  _SSL_LIB="${tclt
0e80: 6c 73 5f 73 73 6c 5f 6c 69 62 7d 22 0a 41 43 5f  ls_ssl_lib}".AC_
0e90: 53 55 42 53 54 28 54 43 4c 54 4c 53 5f 53 53 4c  SUBST(TCLTLS_SSL
0ea0: 5f 4c 49 42 29 0a 41 43 5f 4d 53 47 5f 52 45 53  _LIB).AC_MSG_RES
0eb0: 55 4c 54 28 5b 24 74 63 6c 74 6c 73 5f 73 73 6c  ULT([$tcltls_ssl
0ec0: 5f 6c 69 62 5d 29 0a 0a 64 6e 6c 20 4d 61 6e 75  _lib])..dnl Manu
0ed0: 61 6c 6c 79 20 72 65 77 72 69 74 65 20 6c 69 62  ally rewrite lib
0ee0: 72 65 73 73 6c 20 74 6f 20 4f 70 65 6e 53 53 4c  ressl to OpenSSL
0ef0: 20 73 69 6e 63 65 20 77 65 20 75 73 65 20 74 68   since we use th
0f00: 65 0a 64 6e 6c 20 63 6f 6d 70 61 74 69 62 69 6c  e.dnl compatibil
0f10: 69 74 79 20 69 6e 74 65 72 66 61 63 65 0a 69 66  ity interface.if
0f20: 20 74 65 73 74 20 22 24 74 63 6c 74 6c 73 5f 73   test "$tcltls_s
0f30: 73 6c 5f 6c 69 62 22 20 3d 20 22 6c 69 62 72 65  sl_lib" = "libre
0f40: 73 73 6c 22 3b 20 74 68 65 6e 0a 09 74 63 6c 74  ssl"; then..tclt
0f50: 6c 73 5f 73 73 6c 5f 6c 69 62 3d 27 6f 70 65 6e  ls_ssl_lib='open
0f60: 73 73 6c 27 0a 66 69 0a 0a 41 53 5f 43 41 53 45  ssl'.fi..AS_CASE
0f70: 28 5b 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c 69  ([$tcltls_ssl_li
0f80: 62 5d 2c 0a 09 5b 6f 70 65 6e 73 73 6c 5d 2c 20  b],..[openssl], 
0f90: 5b 0a 09 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f  [...TCLTLS_SSL_O
0fa0: 50 45 4e 53 53 4c 0a 09 09 41 43 5f 44 45 46 49  PENSSL...AC_DEFI
0fb0: 4e 45 28 5b 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f  NE([TCLTLS_SSL_O
0fc0: 50 45 4e 53 53 4c 5d 2c 20 5b 31 5d 2c 20 5b 44  PENSSL], [1], [D
0fd0: 65 66 69 6e 65 20 69 66 20 74 68 65 20 62 61 63  efine if the bac
0fe0: 6b 65 6e 64 20 62 65 69 6e 67 20 75 73 65 64 20  kend being used 
0ff0: 69 73 20 4f 70 65 6e 53 53 4c 20 28 6f 72 20 74  is OpenSSL (or t
1000: 68 65 20 4c 69 62 72 65 53 53 4c 20 4f 70 65 6e  he LibreSSL Open
1010: 53 53 4c 20 63 6f 6d 70 61 74 69 62 69 6c 69 74  SSL compatibilit
1020: 79 20 69 6e 74 65 72 66 61 63 65 29 5d 29 0a 09  y interface)])..
1030: 5d 2c 0a 09 5b 6e 73 73 5d 2c 20 5b 0a 09 20 09  ],..[nss], [.. .
1040: 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42 53 3d  TCLTLS_SSL_LIBS=
1050: 22 22 0a 09 09 54 43 4c 54 4c 53 5f 53 53 4c 5f  ""...TCLTLS_SSL_
1060: 43 46 4c 41 47 53 3d 22 22 0a 09 09 54 43 4c 54  CFLAGS=""...TCLT
1070: 4c 53 5f 53 53 4c 5f 43 50 50 46 4c 41 47 53 3d  LS_SSL_CPPFLAGS=
1080: 22 22 0a 09 5d 2c 0a 09 5b 0a 09 09 41 43 5f 4d  ""..],..[...AC_M
1090: 53 47 5f 45 52 52 4f 52 28 5b 55 6e 73 75 70 70  SG_ERROR([Unsupp
10a0: 6f 72 74 65 64 20 53 53 4c 20 6c 69 62 72 61 72  orted SSL librar
10b0: 79 3a 20 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c  y: $tcltls_ssl_l
10c0: 69 62 5d 29 0a 09 5d 0a 29 0a 64 6e 6c 20 44 65  ib])..].).dnl De
10d0: 74 65 72 6d 69 6e 65 20 68 6f 77 20 74 6f 20 75  termine how to u
10e0: 73 65 20 74 68 69 73 20 53 53 4c 20 6c 69 62 72  se this SSL libr
10f0: 61 72 79 0a 41 43 5f 4d 53 47 5f 43 48 45 43 4b  ary.AC_MSG_CHECK
1100: 49 4e 47 28 5b 68 6f 77 20 74 6f 20 75 73 65 20  ING([how to use 
1110: 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c 69 62 5d  $tcltls_ssl_lib]
1120: 29 0a 4c 49 42 53 3d 22 24 7b 4c 49 42 53 7d 20  ).LIBS="${LIBS} 
1130: 24 7b 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42  ${TCLTLS_SSL_LIB
1140: 53 7d 22 0a 43 46 4c 41 47 53 3d 22 24 7b 43 46  S}".CFLAGS="${CF
1150: 4c 41 47 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53  LAGS} ${TCLTLS_S
1160: 53 4c 5f 43 46 4c 41 47 53 7d 22 0a 43 50 50 46  SL_CFLAGS}".CPPF
1170: 4c 41 47 53 3d 22 24 7b 43 50 50 46 4c 41 47 53  LAGS="${CPPFLAGS
1180: 7d 20 24 7b 54 43 4c 54 4c 53 5f 53 53 4c 5f 43  } ${TCLTLS_SSL_C
1190: 50 50 46 4c 41 47 53 7d 22 0a 41 43 5f 4d 53 47  PPFLAGS}".AC_MSG
11a0: 5f 52 45 53 55 4c 54 28 5b 24 54 43 4c 54 4c 53  _RESULT([$TCLTLS
11b0: 5f 53 53 4c 5f 43 50 50 46 4c 41 47 53 20 24 54  _SSL_CPPFLAGS $T
11c0: 43 4c 54 4c 53 5f 53 53 4c 5f 43 46 4c 41 47 53  CLTLS_SSL_CFLAGS
11d0: 20 24 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42   $TCLTLS_SSL_LIB
11e0: 53 5d 29 0a 0a 64 6e 6c 20 53 79 6e 63 20 74 68  S])..dnl Sync th
11f0: 65 20 52 50 41 54 48 20 69 66 20 72 65 71 75 65  e RPATH if reque
1200: 73 74 65 64 0a 69 66 20 74 65 73 74 20 22 24 54  sted.if test "$T
1210: 43 4c 45 58 54 5f 42 55 49 4c 44 22 20 21 3d 20  CLEXT_BUILD" != 
1220: 27 73 74 61 74 69 63 27 3b 20 74 68 65 6e 0a 09  'static'; then..
1230: 69 66 20 74 65 73 74 20 22 24 54 43 4c 45 58 54  if test "$TCLEXT
1240: 5f 54 4c 53 5f 53 54 41 54 49 43 5f 53 53 4c 22  _TLS_STATIC_SSL"
1250: 20 3d 20 27 79 65 73 27 3b 20 74 68 65 6e 0a 09   = 'yes'; then..
1260: 09 44 43 5f 53 59 4e 43 5f 52 50 41 54 48 28 5b  .DC_SYNC_RPATH([
1270: 6e 6f 5d 29 0a 09 65 6c 73 65 0a 09 09 44 43 5f  no])..else...DC_
1280: 53 59 4e 43 5f 52 50 41 54 48 28 5b 79 65 73 5d  SYNC_RPATH([yes]
1290: 29 0a 09 66 69 0a 66 69 0a 0a 64 6e 6c 20 50 72  )..fi.fi..dnl Pr
12a0: 6f 64 75 63 65 20 6f 75 74 70 75 74 0a 41 43 5f  oduce output.AC_
12b0: 4f 55 54 50 55 54 28 4d 61 6b 65 66 69 6c 65 20  OUTPUT(Makefile 
12c0: 70 6b 67 49 6e 64 65 78 2e 74 63 6c 29 0a        pkgIndex.tcl).