Hex Artifact Content

Artifact cc1042cb7252adc62f57665ae5133fd105987342:


0000: 64 6e 6c 20 24 31 20 3d 20 4e 61 6d 65 20 6f 66  dnl $1 = Name of
0010: 20 76 61 72 69 61 62 6c 65 0a 64 6e 6c 20 24 32   variable.dnl $2
0020: 20 3d 20 4e 61 6d 65 20 6f 66 20 66 75 6e 63 74   = Name of funct
0030: 69 6f 6e 20 74 6f 20 63 68 65 63 6b 20 66 6f 72  ion to check for
0040: 0a 64 6e 6c 20 24 33 20 3d 20 4e 61 6d 65 20 6f  .dnl $3 = Name o
0050: 66 20 70 72 6f 74 6f 63 6f 6c 0a 64 6e 6c 20 24  f protocol.dnl $
0060: 34 20 3d 20 4e 61 6d 65 20 6f 66 20 43 50 50 20  4 = Name of CPP 
0070: 6d 61 63 72 6f 20 74 6f 20 64 65 66 69 6e 65 0a  macro to define.
0080: 41 43 5f 44 45 46 55 4e 28 5b 54 43 4c 54 4c 53  AC_DEFUN([TCLTLS
0090: 5f 53 53 4c 5f 4f 50 45 4e 53 53 4c 5f 43 48 45  _SSL_OPENSSL_CHE
00a0: 43 4b 5f 50 52 4f 54 4f 5f 56 45 52 5d 2c 20 5b  CK_PROTO_VER], [
00b0: 0a 09 64 6e 6c 20 44 65 74 65 72 6d 69 6e 65 20  ..dnl Determine 
00c0: 69 66 20 70 61 72 74 69 63 75 6c 61 72 20 53 53  if particular SS
00d0: 4c 20 76 65 72 73 69 6f 6e 20 69 73 20 65 6e 61  L version is ena
00e0: 62 6c 65 64 0a 09 69 66 20 74 65 73 74 20 22 5b  bled..if test "[
00f0: 24 5d 24 31 22 20 3d 20 22 74 72 75 65 22 20 2d  $]$1" = "true" -
0100: 6f 20 22 5b 24 5d 24 31 22 20 3d 20 22 66 6f 72  o "[$]$1" = "for
0110: 63 65 22 3b 20 74 68 65 6e 0a 09 09 41 43 5f 43  ce"; then...AC_C
0120: 48 45 43 4b 5f 46 55 4e 43 28 24 32 2c 2c 20 5b  HECK_FUNC($2,, [
0130: 0a 09 09 09 69 66 20 74 65 73 74 20 22 5b 24 5d  ....if test "[$]
0140: 24 31 22 20 3d 20 22 66 6f 72 63 65 22 3b 20 74  $1" = "force"; t
0150: 68 65 6e 0a 09 09 09 09 41 43 5f 4d 53 47 5f 45  hen.....AC_MSG_E
0160: 52 52 4f 52 28 5b 55 6e 61 62 6c 65 20 74 6f 20  RROR([Unable to 
0170: 65 6e 61 62 6c 65 20 24 33 5d 29 0a 09 09 09 66  enable $3])....f
0180: 69 0a 0a 09 09 09 24 31 3d 27 66 61 6c 73 65 27  i.....$1='false'
0190: 0a 09 09 5d 29 0a 09 66 69 0a 0a 09 69 66 20 74  ...])..fi...if t
01a0: 65 73 74 20 22 5b 24 5d 24 31 22 20 3d 20 22 66  est "[$]$1" = "f
01b0: 61 6c 73 65 22 3b 20 74 68 65 6e 0a 09 09 41 43  alse"; then...AC
01c0: 5f 44 45 46 49 4e 45 28 24 34 2c 20 5b 31 5d 2c  _DEFINE($4, [1],
01d0: 20 5b 44 65 66 69 6e 65 20 74 68 69 73 20 74 6f   [Define this to
01e0: 20 64 69 73 61 62 6c 65 20 24 33 20 69 6e 20 4f   disable $3 in O
01f0: 70 65 6e 53 53 4c 20 73 75 70 70 6f 72 74 5d 29  penSSL support])
0200: 0a 09 66 69 0a 0a 5d 29 0a 0a 41 43 5f 44 45 46  ..fi..])..AC_DEF
0210: 55 4e 28 5b 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f  UN([TCLTLS_SSL_O
0220: 50 45 4e 53 53 4c 5d 2c 20 5b 0a 09 6f 70 65 6e  PENSSL], [..open
0230: 73 73 6c 64 69 72 3d 27 27 0a 09 41 43 5f 41 52  ssldir=''..AC_AR
0240: 47 5f 57 49 54 48 28 5b 73 73 6c 2d 64 69 72 5d  G_WITH([ssl-dir]
0250: 2c 0a 09 09 41 53 5f 48 45 4c 50 5f 53 54 52 49  ,...AS_HELP_STRI
0260: 4e 47 28 0a 09 09 09 5b 2d 2d 77 69 74 68 2d 73  NG(....[--with-s
0270: 73 6c 2d 64 69 72 3d 3c 64 69 72 3e 5d 2c 0a 09  sl-dir=<dir>],..
0280: 09 09 5b 64 65 70 72 65 63 61 74 65 64 2c 20 75  ..[deprecated, u
0290: 73 65 20 2d 2d 77 69 74 68 2d 6f 70 65 6e 73 73  se --with-openss
02a0: 6c 2d 64 69 72 20 2d 2d 20 63 75 72 72 65 6e 74  l-dir -- current
02b0: 6c 79 20 68 61 73 20 74 68 65 20 73 61 6d 65 20  ly has the same 
02c0: 6d 65 61 6e 69 6e 67 5d 0a 09 09 29 2c 20 5b 0a  meaning]...), [.
02d0: 09 09 09 6f 70 65 6e 73 73 6c 64 69 72 3d 22 24  ...openssldir="$
02e0: 77 69 74 68 76 61 6c 22 0a 09 09 5d 0a 09 29 0a  withval"...]..).
02f0: 09 41 43 5f 41 52 47 5f 57 49 54 48 28 5b 6f 70  .AC_ARG_WITH([op
0300: 65 6e 73 73 6c 2d 64 69 72 5d 2c 0a 09 09 41 53  enssl-dir],...AS
0310: 5f 48 45 4c 50 5f 53 54 52 49 4e 47 28 0a 09 09  _HELP_STRING(...
0320: 09 5b 2d 2d 77 69 74 68 2d 6f 70 65 6e 73 73 6c  .[--with-openssl
0330: 2d 64 69 72 3d 3c 64 69 72 3e 5d 2c 0a 09 09 09  -dir=<dir>],....
0340: 5b 70 61 74 68 20 74 6f 20 72 6f 6f 74 20 64 69  [path to root di
0350: 72 65 63 74 6f 72 79 20 6f 66 20 4f 70 65 6e 53  rectory of OpenS
0360: 53 4c 20 6f 72 20 4c 69 62 72 65 53 53 4c 20 69  SL or LibreSSL i
0370: 6e 73 74 61 6c 6c 61 74 69 6f 6e 5d 0a 09 09 29  nstallation]...)
0380: 2c 20 5b 0a 09 09 09 6f 70 65 6e 73 73 6c 64 69  , [....openssldi
0390: 72 3d 22 24 77 69 74 68 76 61 6c 22 0a 09 09 5d  r="$withval"...]
03a0: 0a 09 29 0a 0a 09 69 66 20 74 65 73 74 20 2d 6e  ..)...if test -n
03b0: 20 22 24 6f 70 65 6e 73 73 6c 64 69 72 22 3b 20   "$openssldir"; 
03c0: 74 68 65 6e 0a 09 09 69 66 20 74 65 73 74 20 2d  then...if test -
03d0: 65 20 22 24 6f 70 65 6e 73 73 6c 64 69 72 2f 6c  e "$openssldir/l
03e0: 69 62 73 73 6c 2e 24 53 48 4f 42 4a 45 58 54 22  ibssl.$SHOBJEXT"
03f0: 3b 20 74 68 65 6e 0a 09 09 09 54 43 4c 54 4c 53  ; then....TCLTLS
0400: 5f 53 53 4c 5f 4c 49 42 53 3d 22 2d 4c 24 6f 70  _SSL_LIBS="-L$op
0410: 65 6e 73 73 6c 64 69 72 20 2d 6c 73 73 6c 20 2d  enssldir -lssl -
0420: 6c 63 72 79 70 74 6f 22 0a 09 09 09 6f 70 65 6e  lcrypto"....open
0430: 73 73 6c 64 69 72 3d 22 60 41 53 5f 44 49 52 4e  ssldir="`AS_DIRN
0440: 41 4d 45 28 5b 22 24 6f 70 65 6e 73 73 6c 64 69  AME(["$openssldi
0450: 72 22 5d 29 60 22 0a 09 09 65 6c 73 65 0a 09 09  r"])`"...else...
0460: 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42 53  .TCLTLS_SSL_LIBS
0470: 3d 22 2d 4c 24 6f 70 65 6e 73 73 6c 64 69 72 2f  ="-L$openssldir/
0480: 6c 69 62 20 2d 6c 73 73 6c 20 2d 6c 63 72 79 70  lib -lssl -lcryp
0490: 74 6f 22 0a 09 09 66 69 0a 09 09 54 43 4c 54 4c  to"...fi...TCLTL
04a0: 53 5f 53 53 4c 5f 43 46 4c 41 47 53 3d 22 2d 49  S_SSL_CFLAGS="-I
04b0: 24 6f 70 65 6e 73 73 6c 64 69 72 2f 69 6e 63 6c  $openssldir/incl
04c0: 75 64 65 22 0a 09 09 54 43 4c 54 4c 53 5f 53 53  ude"...TCLTLS_SS
04d0: 4c 5f 43 50 50 46 4c 41 47 53 3d 22 2d 49 24 6f  L_CPPFLAGS="-I$o
04e0: 70 65 6e 73 73 6c 64 69 72 2f 69 6e 63 6c 75 64  penssldir/includ
04f0: 65 22 0a 09 66 69 0a 0a 09 70 6b 67 43 6f 6e 66  e"..fi...pkgConf
0500: 69 67 45 78 74 72 61 41 72 67 73 3d 27 27 0a 09  igExtraArgs=''..
0510: 69 66 20 74 65 73 74 20 22 24 54 43 4c 45 58 54  if test "$TCLEXT
0520: 5f 42 55 49 4c 44 22 20 3d 20 22 73 74 61 74 69  _BUILD" = "stati
0530: 63 22 20 2d 6f 20 22 24 54 43 4c 45 58 54 5f 54  c" -o "$TCLEXT_T
0540: 4c 53 5f 53 54 41 54 49 43 5f 53 53 4c 22 20 3d  LS_STATIC_SSL" =
0550: 20 27 79 65 73 27 3b 20 74 68 65 6e 0a 09 09 70   'yes'; then...p
0560: 6b 67 43 6f 6e 66 69 67 45 78 74 72 61 41 72 67  kgConfigExtraArg
0570: 73 3d 27 2d 2d 73 74 61 74 69 63 27 0a 09 66 69  s='--static'..fi
0580: 0a 0a 09 64 6e 6c 20 55 73 65 20 70 6b 67 2d 63  ...dnl Use pkg-c
0590: 6f 6e 66 69 67 20 74 6f 20 66 69 6e 64 20 74 68  onfig to find th
05a0: 65 20 6c 69 62 72 61 72 69 65 73 0a 09 41 43 5f  e libraries..AC_
05b0: 41 52 47 5f 56 41 52 28 5b 54 43 4c 54 4c 53 5f  ARG_VAR([TCLTLS_
05c0: 53 53 4c 5f 4c 49 42 53 5d 2c 20 5b 6c 69 62 72  SSL_LIBS], [libr
05d0: 61 72 69 65 73 20 74 6f 20 70 61 73 73 20 74 6f  aries to pass to
05e0: 20 74 68 65 20 6c 69 6e 6b 65 72 20 66 6f 72 20   the linker for 
05f0: 4f 70 65 6e 53 53 4c 20 6f 72 20 4c 69 62 72 65  OpenSSL or Libre
0600: 53 53 4c 5d 29 0a 09 41 43 5f 41 52 47 5f 56 41  SSL])..AC_ARG_VA
0610: 52 28 5b 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 46  R([TCLTLS_SSL_CF
0620: 4c 41 47 53 5d 2c 20 5b 43 20 63 6f 6d 70 69 6c  LAGS], [C compil
0630: 65 72 20 66 6c 61 67 73 20 66 6f 72 20 4f 70 65  er flags for Ope
0640: 6e 53 53 4c 20 6f 72 20 4c 69 62 72 65 53 53 4c  nSSL or LibreSSL
0650: 5d 29 0a 09 41 43 5f 41 52 47 5f 56 41 52 28 5b  ])..AC_ARG_VAR([
0660: 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 50 50 46 4c  TCLTLS_SSL_CPPFL
0670: 41 47 53 5d 2c 20 5b 43 20 70 72 65 70 72 6f 63  AGS], [C preproc
0680: 65 73 73 6f 72 20 66 6c 61 67 73 20 66 6f 72 20  essor flags for 
0690: 4f 70 65 6e 53 53 4c 20 6f 72 20 4c 69 62 72 65  OpenSSL or Libre
06a0: 53 53 4c 5d 29 0a 09 69 66 20 74 65 73 74 20 2d  SSL])..if test -
06b0: 7a 20 22 24 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c  z "$TCLTLS_SSL_L
06c0: 49 42 53 22 3b 20 74 68 65 6e 0a 09 09 54 43 4c  IBS"; then...TCL
06d0: 54 4c 53 5f 53 53 4c 5f 4c 49 42 53 3d 22 60 22  TLS_SSL_LIBS="`"
06e0: 24 7b 50 4b 47 43 4f 4e 46 49 47 7d 22 20 6f 70  ${PKGCONFIG}" op
06f0: 65 6e 73 73 6c 20 2d 2d 6c 69 62 73 20 24 70 6b  enssl --libs $pk
0700: 67 43 6f 6e 66 69 67 45 78 74 72 61 41 72 67 73  gConfigExtraArgs
0710: 60 22 20 7c 7c 20 41 43 5f 4d 53 47 5f 45 52 52  `" || AC_MSG_ERR
0720: 4f 52 28 5b 55 6e 61 62 6c 65 20 74 6f 20 67 65  OR([Unable to ge
0730: 74 20 4f 70 65 6e 53 53 4c 20 43 6f 6e 66 69 67  t OpenSSL Config
0740: 75 72 61 74 69 6f 6e 5d 29 0a 09 66 69 0a 09 69  uration])..fi..i
0750: 66 20 74 65 73 74 20 2d 7a 20 22 24 54 43 4c 54  f test -z "$TCLT
0760: 4c 53 5f 53 53 4c 5f 43 46 4c 41 47 53 22 3b 20  LS_SSL_CFLAGS"; 
0770: 74 68 65 6e 0a 09 09 54 43 4c 54 4c 53 5f 53 53  then...TCLTLS_SS
0780: 4c 5f 43 46 4c 41 47 53 3d 22 60 22 24 7b 50 4b  L_CFLAGS="`"${PK
0790: 47 43 4f 4e 46 49 47 7d 22 20 6f 70 65 6e 73 73  GCONFIG}" openss
07a0: 6c 20 2d 2d 63 66 6c 61 67 73 2d 6f 6e 6c 79 2d  l --cflags-only-
07b0: 6f 74 68 65 72 20 24 70 6b 67 43 6f 6e 66 69 67  other $pkgConfig
07c0: 45 78 74 72 61 41 72 67 73 60 22 20 7c 7c 20 41  ExtraArgs`" || A
07d0: 43 5f 4d 53 47 5f 45 52 52 4f 52 28 5b 55 6e 61  C_MSG_ERROR([Una
07e0: 62 6c 65 20 74 6f 20 67 65 74 20 4f 70 65 6e 53  ble to get OpenS
07f0: 53 4c 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e  SL Configuration
0800: 5d 29 0a 09 66 69 0a 09 69 66 20 74 65 73 74 20  ])..fi..if test 
0810: 2d 7a 20 22 24 54 43 4c 54 4c 53 5f 53 53 4c 5f  -z "$TCLTLS_SSL_
0820: 43 50 50 46 4c 41 47 53 22 3b 20 74 68 65 6e 0a  CPPFLAGS"; then.
0830: 09 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 50 50  ..TCLTLS_SSL_CPP
0840: 46 4c 41 47 53 3d 22 60 22 24 7b 50 4b 47 43 4f  FLAGS="`"${PKGCO
0850: 4e 46 49 47 7d 22 20 6f 70 65 6e 73 73 6c 20 2d  NFIG}" openssl -
0860: 2d 63 66 6c 61 67 73 2d 6f 6e 6c 79 2d 49 20 24  -cflags-only-I $
0870: 70 6b 67 43 6f 6e 66 69 67 45 78 74 72 61 41 72  pkgConfigExtraAr
0880: 67 73 60 22 20 7c 7c 20 41 43 5f 4d 53 47 5f 45  gs`" || AC_MSG_E
0890: 52 52 4f 52 28 5b 55 6e 61 62 6c 65 20 74 6f 20  RROR([Unable to 
08a0: 67 65 74 20 4f 70 65 6e 53 53 4c 20 43 6f 6e 66  get OpenSSL Conf
08b0: 69 67 75 72 61 74 69 6f 6e 5d 29 0a 09 66 69 0a  iguration])..fi.
08c0: 0a 09 69 66 20 74 65 73 74 20 22 24 54 43 4c 45  ..if test "$TCLE
08d0: 58 54 5f 42 55 49 4c 44 22 20 3d 20 22 73 74 61  XT_BUILD" = "sta
08e0: 74 69 63 22 3b 20 74 68 65 6e 0a 09 09 64 6e 6c  tic"; then...dnl
08f0: 20 49 66 20 77 65 20 61 72 65 20 64 6f 69 6e 67   If we are doing
0900: 20 61 20 73 74 61 74 69 63 20 62 75 69 6c 64 2c   a static build,
0910: 20 73 61 76 65 20 74 68 65 20 6c 69 6e 6b 65 72   save the linker
0920: 20 66 6c 61 67 73 20 66 6f 72 20 6f 74 68 65 72   flags for other
0930: 20 70 72 6f 67 72 61 6d 73 20 74 6f 20 63 6f 6e   programs to con
0940: 73 75 6d 65 0a 09 09 72 6d 20 2d 66 20 74 63 6c  sume...rm -f tcl
0950: 74 6c 73 2e 61 2e 6c 69 6e 6b 61 64 64 0a 09 09  tls.a.linkadd...
0960: 41 53 5f 45 43 48 4f 28 5b 22 24 54 43 4c 54 4c  AS_ECHO(["$TCLTL
0970: 53 5f 53 53 4c 5f 4c 49 42 53 22 5d 29 20 3e 20  S_SSL_LIBS"]) > 
0980: 74 63 6c 74 6c 73 2e 61 2e 6c 69 6e 6b 61 64 64  tcltls.a.linkadd
0990: 0a 09 66 69 0a 0a 09 64 6e 6c 20 49 66 20 77 65  ..fi...dnl If we
09a0: 20 68 61 76 65 20 62 65 65 6e 20 61 73 6b 65 64   have been asked
09b0: 20 74 6f 20 73 74 61 74 69 63 61 6c 6c 79 20 6c   to statically l
09c0: 69 6e 6b 20 74 6f 20 74 68 65 20 53 53 4c 20 6c  ink to the SSL l
09d0: 69 62 72 61 72 79 2c 20 73 70 65 63 69 66 69 63  ibrary, specific
09e0: 61 6c 6c 79 20 74 65 6c 6c 20 74 68 65 20 6c 69  ally tell the li
09f0: 6e 6b 65 72 20 74 6f 20 64 6f 20 73 6f 0a 09 69  nker to do so..i
0a00: 66 20 74 65 73 74 20 22 24 54 43 4c 45 58 54 5f  f test "$TCLEXT_
0a10: 54 4c 53 5f 53 54 41 54 49 43 5f 53 53 4c 22 20  TLS_STATIC_SSL" 
0a20: 3d 20 27 79 65 73 27 3b 20 74 68 65 6e 0a 09 09  = 'yes'; then...
0a30: 64 6e 6c 20 44 6f 6e 27 74 20 62 6f 74 68 65 72  dnl Don't bother
0a40: 20 64 6f 69 6e 67 20 74 68 69 73 20 69 66 20 77   doing this if w
0a50: 65 20 61 72 65 6e 27 74 20 61 63 74 75 61 6c 6c  e aren't actuall
0a60: 79 20 64 6f 69 6e 67 20 74 68 65 20 72 75 6e 74  y doing the runt
0a70: 69 6d 65 20 6c 69 6e 6b 69 6e 67 0a 09 09 69 66  ime linking...if
0a80: 20 74 65 73 74 20 22 24 54 43 4c 45 58 54 5f 42   test "$TCLEXT_B
0a90: 55 49 4c 44 22 20 21 3d 20 22 73 74 61 74 69 63  UILD" != "static
0aa0: 22 3b 20 74 68 65 6e 0a 09 09 09 64 6e 6c 20 53  "; then....dnl S
0ab0: 70 6c 69 74 20 74 68 65 20 6c 69 62 72 61 72 69  plit the librari
0ac0: 65 73 20 69 6e 74 6f 20 53 53 4c 20 61 6e 64 20  es into SSL and 
0ad0: 6e 6f 6e 2d 53 53 4c 20 6c 69 62 72 61 72 69 65  non-SSL librarie
0ae0: 73 0a 09 09 09 6e 65 77 5f 54 43 4c 54 4c 53 5f  s....new_TCLTLS_
0af0: 53 53 4c 5f 4c 49 42 53 5f 6e 6f 72 6d 61 6c 3d  SSL_LIBS_normal=
0b00: 27 27 0a 09 09 09 6e 65 77 5f 54 43 4c 54 4c 53  ''....new_TCLTLS
0b10: 5f 53 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63  _SSL_LIBS_static
0b20: 3d 27 27 0a 09 09 09 66 6f 72 20 61 72 67 20 69  =''....for arg i
0b30: 6e 20 24 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49  n $TCLTLS_SSL_LI
0b40: 42 53 3b 20 64 6f 0a 09 09 09 09 63 61 73 65 20  BS; do.....case 
0b50: 22 24 7b 61 72 67 7d 22 20 69 6e 0a 09 09 09 09  "${arg}" in.....
0b60: 09 2d 6c 64 6c 7c 2d 6c 72 74 7c 2d 6c 63 7c 2d  .-ldl|-lrt|-lc|-
0b70: 6c 70 74 68 72 65 61 64 7c 2d 6c 6d 7c 2d 6c 63  lpthread|-lm|-lc
0b80: 72 79 70 74 7c 2d 6c 69 64 6e 7c 2d 6c 72 65 73  rypt|-lidn|-lres
0b90: 6f 6c 76 7c 2d 6c 67 63 63 7c 2d 6c 67 63 63 5f  olv|-lgcc|-lgcc_
0ba0: 73 7c 2d 4c 2a 29 0a 09 09 09 09 09 09 6e 65 77  s|-L*).......new
0bb0: 5f 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42 53  _TCLTLS_SSL_LIBS
0bc0: 5f 6e 6f 72 6d 61 6c 3d 22 24 7b 6e 65 77 5f 54  _normal="${new_T
0bd0: 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42 53 5f 6e  CLTLS_SSL_LIBS_n
0be0: 6f 72 6d 61 6c 7d 20 24 7b 61 72 67 7d 22 0a 09  ormal} ${arg}"..
0bf0: 09 09 09 09 09 3b 3b 0a 09 09 09 09 09 2d 6c 2a  .....;;......-l*
0c00: 29 0a 09 09 09 09 09 09 6e 65 77 5f 54 43 4c 54  ).......new_TCLT
0c10: 4c 53 5f 53 53 4c 5f 4c 49 42 53 5f 73 74 61 74  LS_SSL_LIBS_stat
0c20: 69 63 3d 22 24 7b 6e 65 77 5f 54 43 4c 54 4c 53  ic="${new_TCLTLS
0c30: 5f 53 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63  _SSL_LIBS_static
0c40: 7d 20 24 7b 61 72 67 7d 22 0a 09 09 09 09 09 09  } ${arg}".......
0c50: 3b 3b 0a 09 09 09 09 09 2a 29 0a 09 09 09 09 09  ;;......*)......
0c60: 09 6e 65 77 5f 54 43 4c 54 4c 53 5f 53 53 4c 5f  .new_TCLTLS_SSL_
0c70: 4c 49 42 53 5f 6e 6f 72 6d 61 6c 3d 22 24 7b 6e  LIBS_normal="${n
0c80: 65 77 5f 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49  ew_TCLTLS_SSL_LI
0c90: 42 53 5f 6e 6f 72 6d 61 6c 7d 20 24 7b 61 72 67  BS_normal} ${arg
0ca0: 7d 22 0a 09 09 09 09 09 09 3b 3b 0a 09 09 09 09  }".......;;.....
0cb0: 65 73 61 63 0a 09 09 09 64 6f 6e 65 0a 09 09 09  esac....done....
0cc0: 53 48 4f 42 4a 5f 44 4f 5f 53 54 41 54 49 43 5f  SHOBJ_DO_STATIC_
0cd0: 4c 49 4e 4b 5f 4c 49 42 28 5b 4f 70 65 6e 53 53  LINK_LIB([OpenSS
0ce0: 4c 5d 2c 20 5b 24 6e 65 77 5f 54 43 4c 54 4c 53  L], [$new_TCLTLS
0cf0: 5f 53 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63  _SSL_LIBS_static
0d00: 5d 2c 20 5b 6e 65 77 5f 54 43 4c 54 4c 53 5f 53  ], [new_TCLTLS_S
0d10: 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63 5d 29  SL_LIBS_static])
0d20: 0a 09 09 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c  ....TCLTLS_SSL_L
0d30: 49 42 53 3d 22 24 7b 6e 65 77 5f 54 43 4c 54 4c  IBS="${new_TCLTL
0d40: 53 5f 53 53 4c 5f 4c 49 42 53 5f 6e 6f 72 6d 61  S_SSL_LIBS_norma
0d50: 6c 7d 20 24 7b 6e 65 77 5f 54 43 4c 54 4c 53 5f  l} ${new_TCLTLS_
0d60: 53 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63 7d  SSL_LIBS_static}
0d70: 22 0a 09 09 66 69 0a 09 66 69 0a 0a 09 64 6e 6c  "...fi..fi...dnl
0d80: 20 53 61 76 65 20 63 6f 6d 70 69 6c 65 2d 61 6c   Save compile-al
0d90: 74 65 72 69 6e 67 20 76 61 72 69 61 62 6c 65 73  tering variables
0da0: 20 77 65 20 61 72 65 20 63 68 61 6e 67 69 6e 67   we are changing
0db0: 0a 09 53 41 56 45 5f 4c 49 42 53 3d 22 24 7b 4c  ..SAVE_LIBS="${L
0dc0: 49 42 53 7d 22 0a 09 53 41 56 45 5f 43 46 4c 41  IBS}"..SAVE_CFLA
0dd0: 47 53 3d 22 24 7b 43 46 4c 41 47 53 7d 22 0a 09  GS="${CFLAGS}"..
0de0: 53 41 56 45 5f 43 50 50 46 4c 41 47 53 3d 22 24  SAVE_CPPFLAGS="$
0df0: 7b 43 50 50 46 4c 41 47 53 7d 22 0a 0a 09 64 6e  {CPPFLAGS}"...dn
0e00: 6c 20 55 70 64 61 74 65 20 63 6f 6d 70 69 6c 65  l Update compile
0e10: 2d 61 6c 74 65 72 69 6e 67 20 76 61 72 69 61 62  -altering variab
0e20: 6c 65 73 20 74 6f 20 69 6e 63 6c 75 64 65 20 74  les to include t
0e30: 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61  he OpenSSL libra
0e40: 72 69 65 73 0a 09 4c 49 42 53 3d 22 24 7b 53 41  ries..LIBS="${SA
0e50: 56 45 5f 4c 49 42 53 7d 20 24 7b 54 43 4c 54 4c  VE_LIBS} ${TCLTL
0e60: 53 5f 53 53 4c 5f 4c 49 42 53 7d 22 0a 09 43 46  S_SSL_LIBS}"..CF
0e70: 4c 41 47 53 3d 22 24 7b 53 41 56 45 5f 43 46 4c  LAGS="${SAVE_CFL
0e80: 41 47 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53 53  AGS} ${TCLTLS_SS
0e90: 4c 5f 43 46 4c 41 47 53 7d 22 0a 09 43 50 50 46  L_CFLAGS}"..CPPF
0ea0: 4c 41 47 53 3d 22 24 7b 53 41 56 45 5f 43 50 50  LAGS="${SAVE_CPP
0eb0: 46 4c 41 47 53 7d 20 24 7b 54 43 4c 54 4c 53 5f  FLAGS} ${TCLTLS_
0ec0: 53 53 4c 5f 43 50 50 46 4c 41 47 53 7d 22 0a 0a  SSL_CPPFLAGS}"..
0ed0: 09 64 6e 6c 20 56 65 72 69 66 79 20 74 68 61 74  .dnl Verify that
0ee0: 20 62 61 73 69 63 20 66 75 6e 63 74 69 6f 6e 61   basic functiona
0ef0: 6c 69 74 79 20 69 73 20 74 68 65 72 65 0a 09 41  lity is there..A
0f00: 43 5f 4c 41 4e 47 5f 50 55 53 48 28 43 29 0a 09  C_LANG_PUSH(C)..
0f10: 41 43 5f 4d 53 47 5f 43 48 45 43 4b 49 4e 47 28  AC_MSG_CHECKING(
0f20: 5b 69 66 20 61 20 62 61 73 69 63 20 4f 70 65 6e  [if a basic Open
0f30: 53 53 4c 20 70 72 6f 67 72 61 6d 20 77 6f 72 6b  SSL program work
0f40: 73 5d 29 0a 09 41 43 5f 4c 49 4e 4b 5f 49 46 45  s])..AC_LINK_IFE
0f50: 4c 53 45 28 5b 41 43 5f 4c 41 4e 47 5f 50 52 4f  LSE([AC_LANG_PRO
0f60: 47 52 41 4d 28 5b 0a 23 69 6e 63 6c 75 64 65 20  GRAM([.#include 
0f70: 3c 6f 70 65 6e 73 73 6c 2f 73 73 6c 2e 68 3e 0a  <openssl/ssl.h>.
0f80: 23 69 66 20 28 53 53 4c 45 41 59 5f 56 45 52 53  #if (SSLEAY_VERS
0f90: 49 4f 4e 5f 4e 55 4d 42 45 52 20 3e 3d 20 30 78  ION_NUMBER >= 0x
0fa0: 30 39 30 37 30 30 30 4c 29 0a 23 20 69 6e 63 6c  0907000L).# incl
0fb0: 75 64 65 20 3c 6f 70 65 6e 73 73 6c 2f 63 6f 6e  ude <openssl/con
0fc0: 66 2e 68 3e 0a 23 65 6e 64 69 66 0a 09 09 5d 2c  f.h>.#endif...],
0fd0: 20 5b 0a 20 20 28 76 6f 69 64 29 53 53 4c 5f 6c   [.  (void)SSL_l
0fe0: 69 62 72 61 72 79 5f 69 6e 69 74 28 29 3b 0a 20  ibrary_init();. 
0ff0: 20 53 53 4c 5f 6c 6f 61 64 5f 65 72 72 6f 72 5f   SSL_load_error_
1000: 73 74 72 69 6e 67 73 28 29 3b 0a 20 20 4f 50 45  strings();.  OPE
1010: 4e 53 53 4c 5f 63 6f 6e 66 69 67 28 4e 55 4c 4c  NSSL_config(NULL
1020: 29 3b 0a 09 09 5d 29 5d 2c 20 5b 0a 09 09 41 43  );...])], [...AC
1030: 5f 4d 53 47 5f 52 45 53 55 4c 54 28 5b 79 65 73  _MSG_RESULT([yes
1040: 5d 29 0a 09 5d 2c 20 5b 0a 09 09 41 43 5f 4d 53  ])..], [...AC_MS
1050: 47 5f 52 45 53 55 4c 54 28 5b 6e 6f 5d 29 0a 09  G_RESULT([no])..
1060: 09 41 43 5f 4d 53 47 5f 45 52 52 4f 52 28 5b 55  .AC_MSG_ERROR([U
1070: 6e 61 62 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65  nable to compile
1080: 20 61 20 62 61 73 69 63 20 70 72 6f 67 72 61 6d   a basic program
1090: 20 75 73 69 6e 67 20 4f 70 65 6e 53 53 4c 5d 29   using OpenSSL])
10a0: 0a 09 5d 29 0a 09 41 43 5f 4c 41 4e 47 5f 50 4f  ..])..AC_LANG_PO
10b0: 50 28 5b 43 5d 29 0a 0a 09 54 43 4c 54 4c 53 5f  P([C])...TCLTLS_
10c0: 53 53 4c 5f 4f 50 45 4e 53 53 4c 5f 43 48 45 43  SSL_OPENSSL_CHEC
10d0: 4b 5f 50 52 4f 54 4f 5f 56 45 52 28 5b 74 63 6c  K_PROTO_VER([tcl
10e0: 74 6c 73 5f 73 73 6c 5f 73 73 6c 32 5d 2c 20 5b  tls_ssl_ssl2], [
10f0: 53 53 4c 76 32 5f 6d 65 74 68 6f 64 5d 2c 20 5b  SSLv2_method], [
1100: 73 73 6c 76 32 5d 2c 20 5b 4e 4f 5f 53 53 4c 32  sslv2], [NO_SSL2
1110: 5d 29 0a 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f  ])..TCLTLS_SSL_O
1120: 50 45 4e 53 53 4c 5f 43 48 45 43 4b 5f 50 52 4f  PENSSL_CHECK_PRO
1130: 54 4f 5f 56 45 52 28 5b 74 63 6c 74 6c 73 5f 73  TO_VER([tcltls_s
1140: 73 6c 5f 73 73 6c 33 5d 2c 20 5b 53 53 4c 76 33  sl_ssl3], [SSLv3
1150: 5f 6d 65 74 68 6f 64 5d 2c 20 5b 73 73 6c 76 33  _method], [sslv3
1160: 5d 2c 20 5b 4e 4f 5f 53 53 4c 33 5d 29 0a 09 54  ], [NO_SSL3])..T
1170: 43 4c 54 4c 53 5f 53 53 4c 5f 4f 50 45 4e 53 53  CLTLS_SSL_OPENSS
1180: 4c 5f 43 48 45 43 4b 5f 50 52 4f 54 4f 5f 56 45  L_CHECK_PROTO_VE
1190: 52 28 5b 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c  R([tcltls_ssl_tl
11a0: 73 31 5f 30 5d 2c 20 5b 54 4c 53 76 31 5f 6d 65  s1_0], [TLSv1_me
11b0: 74 68 6f 64 5d 2c 20 5b 74 6c 73 76 31 2e 30 5d  thod], [tlsv1.0]
11c0: 2c 20 5b 4e 4f 5f 54 4c 53 31 5d 29 0a 09 54 43  , [NO_TLS1])..TC
11d0: 4c 54 4c 53 5f 53 53 4c 5f 4f 50 45 4e 53 53 4c  LTLS_SSL_OPENSSL
11e0: 5f 43 48 45 43 4b 5f 50 52 4f 54 4f 5f 56 45 52  _CHECK_PROTO_VER
11f0: 28 5b 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73  ([tcltls_ssl_tls
1200: 31 5f 31 5d 2c 20 5b 54 4c 53 76 31 5f 31 5f 6d  1_1], [TLSv1_1_m
1210: 65 74 68 6f 64 5d 2c 20 5b 74 6c 73 76 31 2e 31  ethod], [tlsv1.1
1220: 5d 2c 20 5b 4e 4f 5f 54 4c 53 31 5f 31 5d 29 0a  ], [NO_TLS1_1]).
1230: 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f 50 45 4e  .TCLTLS_SSL_OPEN
1240: 53 53 4c 5f 43 48 45 43 4b 5f 50 52 4f 54 4f 5f  SSL_CHECK_PROTO_
1250: 56 45 52 28 5b 74 63 6c 74 6c 73 5f 73 73 6c 5f  VER([tcltls_ssl_
1260: 74 6c 73 31 5f 32 5d 2c 20 5b 54 4c 53 76 31 5f  tls1_2], [TLSv1_
1270: 32 5f 6d 65 74 68 6f 64 5d 2c 20 5b 74 6c 73 76  2_method], [tlsv
1280: 31 2e 32 5d 2c 20 5b 4e 4f 5f 54 4c 53 31 5f 32  1.2], [NO_TLS1_2
1290: 5d 29 0a 0a 09 41 43 5f 43 41 43 48 45 5f 56 41  ])...AC_CACHE_VA
12a0: 4c 28 5b 74 63 6c 74 6c 73 5f 63 76 5f 66 75 6e  L([tcltls_cv_fun
12b0: 63 5f 74 6c 73 65 78 74 5f 68 6f 73 74 6e 61 6d  c_tlsext_hostnam
12c0: 65 5d 2c 20 5b 0a 09 09 41 43 5f 4c 41 4e 47 5f  e], [...AC_LANG_
12d0: 50 55 53 48 28 43 29 0a 09 09 41 43 5f 4d 53 47  PUSH(C)...AC_MSG
12e0: 5f 43 48 45 43 4b 49 4e 47 28 5b 66 6f 72 20 53  _CHECKING([for S
12f0: 53 4c 5f 73 65 74 5f 74 6c 73 65 78 74 5f 68 6f  SL_set_tlsext_ho
1300: 73 74 5f 6e 61 6d 65 5d 29 0a 09 09 41 43 5f 4c  st_name])...AC_L
1310: 49 4e 4b 5f 49 46 45 4c 53 45 28 5b 41 43 5f 4c  INK_IFELSE([AC_L
1320: 41 4e 47 5f 50 52 4f 47 52 41 4d 28 5b 0a 23 69  ANG_PROGRAM([.#i
1330: 6e 63 6c 75 64 65 20 3c 6f 70 65 6e 73 73 6c 2f  nclude <openssl/
1340: 73 73 6c 2e 68 3e 0a 23 69 66 20 28 53 53 4c 45  ssl.h>.#if (SSLE
1350: 41 59 5f 56 45 52 53 49 4f 4e 5f 4e 55 4d 42 45  AY_VERSION_NUMBE
1360: 52 20 3e 3d 20 30 78 30 39 30 37 30 30 30 4c 29  R >= 0x0907000L)
1370: 0a 23 20 69 6e 63 6c 75 64 65 20 3c 6f 70 65 6e  .# include <open
1380: 73 73 6c 2f 63 6f 6e 66 2e 68 3e 0a 23 65 6e 64  ssl/conf.h>.#end
1390: 69 66 0a 09 09 09 5d 2c 20 5b 0a 20 20 28 76 6f  if....], [.  (vo
13a0: 69 64 29 53 53 4c 5f 73 65 74 5f 74 6c 73 65 78  id)SSL_set_tlsex
13b0: 74 5f 68 6f 73 74 5f 6e 61 6d 65 28 28 76 6f 69  t_host_name((voi
13c0: 64 20 2a 29 20 30 2c 20 28 76 6f 69 64 20 2a 29  d *) 0, (void *)
13d0: 20 30 29 3b 0a 09 09 09 5d 29 5d 2c 20 5b 0a 09   0);....])], [..
13e0: 09 09 41 43 5f 4d 53 47 5f 52 45 53 55 4c 54 28  ..AC_MSG_RESULT(
13f0: 5b 79 65 73 5d 29 0a 09 09 09 74 63 6c 74 6c 73  [yes])....tcltls
1400: 5f 63 76 5f 66 75 6e 63 5f 74 6c 73 65 78 74 5f  _cv_func_tlsext_
1410: 68 6f 73 74 6e 61 6d 65 3d 27 79 65 73 27 0a 09  hostname='yes'..
1420: 09 5d 2c 20 5b 0a 09 09 09 41 43 5f 4d 53 47 5f  .], [....AC_MSG_
1430: 52 45 53 55 4c 54 28 5b 6e 6f 5d 29 0a 09 09 09  RESULT([no])....
1440: 74 63 6c 74 6c 73 5f 63 76 5f 66 75 6e 63 5f 74  tcltls_cv_func_t
1450: 6c 73 65 78 74 5f 68 6f 73 74 6e 61 6d 65 3d 27  lsext_hostname='
1460: 6e 6f 27 0a 09 09 5d 29 0a 09 09 41 43 5f 4c 41  no'...])...AC_LA
1470: 4e 47 5f 50 4f 50 28 5b 43 5d 29 0a 09 5d 29 0a  NG_POP([C])..]).
1480: 0a 09 69 66 20 74 65 73 74 20 22 24 74 63 6c 74  ..if test "$tclt
1490: 6c 73 5f 63 76 5f 66 75 6e 63 5f 74 6c 73 65 78  ls_cv_func_tlsex
14a0: 74 5f 68 6f 73 74 6e 61 6d 65 22 20 3d 20 27 6e  t_hostname" = 'n
14b0: 6f 27 3b 20 74 68 65 6e 0a 09 09 41 43 5f 44 45  o'; then...AC_DE
14c0: 46 49 4e 45 28 5b 4f 50 45 4e 53 53 4c 5f 4e 4f  FINE([OPENSSL_NO
14d0: 5f 54 4c 53 45 58 54 5d 2c 20 5b 31 5d 2c 20 5b  _TLSEXT], [1], [
14e0: 44 65 66 69 6e 65 20 74 68 69 73 20 69 66 20 79  Define this if y
14f0: 6f 75 72 20 4f 70 65 6e 53 53 4c 20 64 6f 65 73  our OpenSSL does
1500: 20 6e 6f 74 20 73 75 70 70 6f 72 74 20 74 68 65   not support the
1510: 20 54 4c 53 20 45 78 74 65 6e 73 69 6f 6e 20 66   TLS Extension f
1520: 6f 72 20 53 4e 49 5d 29 0a 09 66 69 0a 0a 09 64  or SNI])..fi...d
1530: 6e 6c 20 52 65 73 74 6f 72 65 20 63 6f 6d 70 69  nl Restore compi
1540: 6c 65 2d 61 6c 74 65 72 69 6e 67 20 76 61 72 69  le-altering vari
1550: 61 62 6c 65 73 0a 09 4c 49 42 53 3d 22 24 7b 53  ables..LIBS="${S
1560: 41 56 45 5f 4c 49 42 53 7d 22 0a 09 43 46 4c 41  AVE_LIBS}"..CFLA
1570: 47 53 3d 22 24 7b 53 41 56 45 5f 43 46 4c 41 47  GS="${SAVE_CFLAG
1580: 53 7d 22 0a 09 43 50 50 46 4c 41 47 53 3d 22 24  S}"..CPPFLAGS="$
1590: 7b 53 41 56 45 5f 43 50 50 46 4c 41 47 53 7d 22  {SAVE_CPPFLAGS}"
15a0: 0a 5d 29 0a                                      .]).