Hex Artifact Content

Artifact 1d5f994f6e65813ceb33b83ebc2931876fc82ccb:


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 4c 2a 29 0a 09 09 09 09 09 09 6e 65 77 5f  .-L*).......new_
0b70: 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42 53 5f  TCLTLS_SSL_LIBS_
0b80: 6e 6f 72 6d 61 6c 3d 22 24 7b 6e 65 77 5f 54 43  normal="${new_TC
0b90: 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42 53 5f 6e 6f  LTLS_SSL_LIBS_no
0ba0: 72 6d 61 6c 7d 20 24 7b 61 72 67 7d 22 0a 09 09  rmal} ${arg}"...
0bb0: 09 09 09 09 6e 65 77 5f 54 43 4c 54 4c 53 5f 53  ....new_TCLTLS_S
0bc0: 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63 3d 22  SL_LIBS_static="
0bd0: 24 7b 6e 65 77 5f 54 43 4c 54 4c 53 5f 53 53 4c  ${new_TCLTLS_SSL
0be0: 5f 4c 49 42 53 5f 73 74 61 74 69 63 7d 20 24 7b  _LIBS_static} ${
0bf0: 61 72 67 7d 22 0a 09 09 09 09 09 09 3b 3b 0a 09  arg}".......;;..
0c00: 09 09 09 09 2d 6c 64 6c 7c 2d 6c 72 74 7c 2d 6c  ....-ldl|-lrt|-l
0c10: 63 7c 2d 6c 70 74 68 72 65 61 64 7c 2d 6c 6d 7c  c|-lpthread|-lm|
0c20: 2d 6c 63 72 79 70 74 7c 2d 6c 69 64 6e 7c 2d 6c  -lcrypt|-lidn|-l
0c30: 72 65 73 6f 6c 76 7c 2d 6c 67 63 63 7c 2d 6c 67  resolv|-lgcc|-lg
0c40: 63 63 5f 73 29 0a 09 09 09 09 09 09 6e 65 77 5f  cc_s).......new_
0c50: 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42 53 5f  TCLTLS_SSL_LIBS_
0c60: 6e 6f 72 6d 61 6c 3d 22 24 7b 6e 65 77 5f 54 43  normal="${new_TC
0c70: 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42 53 5f 6e 6f  LTLS_SSL_LIBS_no
0c80: 72 6d 61 6c 7d 20 24 7b 61 72 67 7d 22 0a 09 09  rmal} ${arg}"...
0c90: 09 09 09 09 3b 3b 0a 09 09 09 09 09 2d 6c 2a 29  ....;;......-l*)
0ca0: 0a 09 09 09 09 09 09 6e 65 77 5f 54 43 4c 54 4c  .......new_TCLTL
0cb0: 53 5f 53 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69  S_SSL_LIBS_stati
0cc0: 63 3d 22 24 7b 6e 65 77 5f 54 43 4c 54 4c 53 5f  c="${new_TCLTLS_
0cd0: 53 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63 7d  SSL_LIBS_static}
0ce0: 20 24 7b 61 72 67 7d 22 0a 09 09 09 09 09 09 3b   ${arg}".......;
0cf0: 3b 0a 09 09 09 09 09 2a 29 0a 09 09 09 09 09 09  ;......*).......
0d00: 6e 65 77 5f 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c  new_TCLTLS_SSL_L
0d10: 49 42 53 5f 6e 6f 72 6d 61 6c 3d 22 24 7b 6e 65  IBS_normal="${ne
0d20: 77 5f 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49 42  w_TCLTLS_SSL_LIB
0d30: 53 5f 6e 6f 72 6d 61 6c 7d 20 24 7b 61 72 67 7d  S_normal} ${arg}
0d40: 22 0a 09 09 09 09 09 09 3b 3b 0a 09 09 09 09 65  ".......;;.....e
0d50: 73 61 63 0a 09 09 09 64 6f 6e 65 0a 09 09 09 53  sac....done....S
0d60: 48 4f 42 4a 5f 44 4f 5f 53 54 41 54 49 43 5f 4c  HOBJ_DO_STATIC_L
0d70: 49 4e 4b 5f 4c 49 42 28 5b 4f 70 65 6e 53 53 4c  INK_LIB([OpenSSL
0d80: 5d 2c 20 5b 24 6e 65 77 5f 54 43 4c 54 4c 53 5f  ], [$new_TCLTLS_
0d90: 53 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63 5d  SSL_LIBS_static]
0da0: 2c 20 5b 6e 65 77 5f 54 43 4c 54 4c 53 5f 53 53  , [new_TCLTLS_SS
0db0: 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63 5d 29 0a  L_LIBS_static]).
0dc0: 09 09 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c 49  ...TCLTLS_SSL_LI
0dd0: 42 53 3d 22 24 7b 6e 65 77 5f 54 43 4c 54 4c 53  BS="${new_TCLTLS
0de0: 5f 53 53 4c 5f 4c 49 42 53 5f 6e 6f 72 6d 61 6c  _SSL_LIBS_normal
0df0: 7d 20 24 7b 6e 65 77 5f 54 43 4c 54 4c 53 5f 53  } ${new_TCLTLS_S
0e00: 53 4c 5f 4c 49 42 53 5f 73 74 61 74 69 63 7d 22  SL_LIBS_static}"
0e10: 0a 09 09 66 69 0a 09 66 69 0a 0a 09 64 6e 6c 20  ...fi..fi...dnl 
0e20: 53 61 76 65 20 63 6f 6d 70 69 6c 65 2d 61 6c 74  Save compile-alt
0e30: 65 72 69 6e 67 20 76 61 72 69 61 62 6c 65 73 20  ering variables 
0e40: 77 65 20 61 72 65 20 63 68 61 6e 67 69 6e 67 0a  we are changing.
0e50: 09 53 41 56 45 5f 4c 49 42 53 3d 22 24 7b 4c 49  .SAVE_LIBS="${LI
0e60: 42 53 7d 22 0a 09 53 41 56 45 5f 43 46 4c 41 47  BS}"..SAVE_CFLAG
0e70: 53 3d 22 24 7b 43 46 4c 41 47 53 7d 22 0a 09 53  S="${CFLAGS}"..S
0e80: 41 56 45 5f 43 50 50 46 4c 41 47 53 3d 22 24 7b  AVE_CPPFLAGS="${
0e90: 43 50 50 46 4c 41 47 53 7d 22 0a 0a 09 64 6e 6c  CPPFLAGS}"...dnl
0ea0: 20 55 70 64 61 74 65 20 63 6f 6d 70 69 6c 65 2d   Update compile-
0eb0: 61 6c 74 65 72 69 6e 67 20 76 61 72 69 61 62 6c  altering variabl
0ec0: 65 73 20 74 6f 20 69 6e 63 6c 75 64 65 20 74 68  es to include th
0ed0: 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72  e OpenSSL librar
0ee0: 69 65 73 0a 09 4c 49 42 53 3d 22 24 7b 53 41 56  ies..LIBS="${SAV
0ef0: 45 5f 4c 49 42 53 7d 20 24 7b 54 43 4c 54 4c 53  E_LIBS} ${TCLTLS
0f00: 5f 53 53 4c 5f 4c 49 42 53 7d 22 0a 09 43 46 4c  _SSL_LIBS}"..CFL
0f10: 41 47 53 3d 22 24 7b 53 41 56 45 5f 43 46 4c 41  AGS="${SAVE_CFLA
0f20: 47 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53 53 4c  GS} ${TCLTLS_SSL
0f30: 5f 43 46 4c 41 47 53 7d 22 0a 09 43 50 50 46 4c  _CFLAGS}"..CPPFL
0f40: 41 47 53 3d 22 24 7b 53 41 56 45 5f 43 50 50 46  AGS="${SAVE_CPPF
0f50: 4c 41 47 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53  LAGS} ${TCLTLS_S
0f60: 53 4c 5f 43 50 50 46 4c 41 47 53 7d 22 0a 0a 09  SL_CPPFLAGS}"...
0f70: 64 6e 6c 20 56 65 72 69 66 79 20 74 68 61 74 20  dnl Verify that 
0f80: 62 61 73 69 63 20 66 75 6e 63 74 69 6f 6e 61 6c  basic functional
0f90: 69 74 79 20 69 73 20 74 68 65 72 65 0a 09 41 43  ity is there..AC
0fa0: 5f 4c 41 4e 47 5f 50 55 53 48 28 43 29 0a 09 41  _LANG_PUSH(C)..A
0fb0: 43 5f 4d 53 47 5f 43 48 45 43 4b 49 4e 47 28 5b  C_MSG_CHECKING([
0fc0: 69 66 20 61 20 62 61 73 69 63 20 4f 70 65 6e 53  if a basic OpenS
0fd0: 53 4c 20 70 72 6f 67 72 61 6d 20 77 6f 72 6b 73  SL program works
0fe0: 5d 29 0a 09 41 43 5f 4c 49 4e 4b 5f 49 46 45 4c  ])..AC_LINK_IFEL
0ff0: 53 45 28 5b 41 43 5f 4c 41 4e 47 5f 50 52 4f 47  SE([AC_LANG_PROG
1000: 52 41 4d 28 5b 0a 23 69 6e 63 6c 75 64 65 20 3c  RAM([.#include <
1010: 6f 70 65 6e 73 73 6c 2f 73 73 6c 2e 68 3e 0a 23  openssl/ssl.h>.#
1020: 69 66 20 28 53 53 4c 45 41 59 5f 56 45 52 53 49  if (SSLEAY_VERSI
1030: 4f 4e 5f 4e 55 4d 42 45 52 20 3e 3d 20 30 78 30  ON_NUMBER >= 0x0
1040: 39 30 37 30 30 30 4c 29 0a 23 20 69 6e 63 6c 75  907000L).# inclu
1050: 64 65 20 3c 6f 70 65 6e 73 73 6c 2f 63 6f 6e 66  de <openssl/conf
1060: 2e 68 3e 0a 23 65 6e 64 69 66 0a 09 09 5d 2c 20  .h>.#endif...], 
1070: 5b 0a 20 20 28 76 6f 69 64 29 53 53 4c 5f 6c 69  [.  (void)SSL_li
1080: 62 72 61 72 79 5f 69 6e 69 74 28 29 3b 0a 20 20  brary_init();.  
1090: 53 53 4c 5f 6c 6f 61 64 5f 65 72 72 6f 72 5f 73  SSL_load_error_s
10a0: 74 72 69 6e 67 73 28 29 3b 0a 20 20 4f 50 45 4e  trings();.  OPEN
10b0: 53 53 4c 5f 63 6f 6e 66 69 67 28 4e 55 4c 4c 29  SSL_config(NULL)
10c0: 3b 0a 09 09 5d 29 5d 2c 20 5b 0a 09 09 41 43 5f  ;...])], [...AC_
10d0: 4d 53 47 5f 52 45 53 55 4c 54 28 5b 79 65 73 5d  MSG_RESULT([yes]
10e0: 29 0a 09 5d 2c 20 5b 0a 09 09 41 43 5f 4d 53 47  )..], [...AC_MSG
10f0: 5f 52 45 53 55 4c 54 28 5b 6e 6f 5d 29 0a 09 09  _RESULT([no])...
1100: 41 43 5f 4d 53 47 5f 45 52 52 4f 52 28 5b 55 6e  AC_MSG_ERROR([Un
1110: 61 62 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65 20  able to compile 
1120: 61 20 62 61 73 69 63 20 70 72 6f 67 72 61 6d 20  a basic program 
1130: 75 73 69 6e 67 20 4f 70 65 6e 53 53 4c 5d 29 0a  using OpenSSL]).
1140: 09 5d 29 0a 09 41 43 5f 4c 41 4e 47 5f 50 4f 50  .])..AC_LANG_POP
1150: 28 5b 43 5d 29 0a 0a 09 54 43 4c 54 4c 53 5f 53  ([C])...TCLTLS_S
1160: 53 4c 5f 4f 50 45 4e 53 53 4c 5f 43 48 45 43 4b  SL_OPENSSL_CHECK
1170: 5f 50 52 4f 54 4f 5f 56 45 52 28 5b 74 63 6c 74  _PROTO_VER([tclt
1180: 6c 73 5f 73 73 6c 5f 73 73 6c 32 5d 2c 20 5b 53  ls_ssl_ssl2], [S
1190: 53 4c 76 32 5f 6d 65 74 68 6f 64 5d 2c 20 5b 73  SLv2_method], [s
11a0: 73 6c 76 32 5d 2c 20 5b 4e 4f 5f 53 53 4c 32 5d  slv2], [NO_SSL2]
11b0: 29 0a 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f 50  )..TCLTLS_SSL_OP
11c0: 45 4e 53 53 4c 5f 43 48 45 43 4b 5f 50 52 4f 54  ENSSL_CHECK_PROT
11d0: 4f 5f 56 45 52 28 5b 74 63 6c 74 6c 73 5f 73 73  O_VER([tcltls_ss
11e0: 6c 5f 73 73 6c 33 5d 2c 20 5b 53 53 4c 76 33 5f  l_ssl3], [SSLv3_
11f0: 6d 65 74 68 6f 64 5d 2c 20 5b 73 73 6c 76 33 5d  method], [sslv3]
1200: 2c 20 5b 4e 4f 5f 53 53 4c 33 5d 29 0a 09 54 43  , [NO_SSL3])..TC
1210: 4c 54 4c 53 5f 53 53 4c 5f 4f 50 45 4e 53 53 4c  LTLS_SSL_OPENSSL
1220: 5f 43 48 45 43 4b 5f 50 52 4f 54 4f 5f 56 45 52  _CHECK_PROTO_VER
1230: 28 5b 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73  ([tcltls_ssl_tls
1240: 31 5f 30 5d 2c 20 5b 54 4c 53 76 31 5f 6d 65 74  1_0], [TLSv1_met
1250: 68 6f 64 5d 2c 20 5b 74 6c 73 76 31 2e 30 5d 2c  hod], [tlsv1.0],
1260: 20 5b 4e 4f 5f 54 4c 53 31 5d 29 0a 09 54 43 4c   [NO_TLS1])..TCL
1270: 54 4c 53 5f 53 53 4c 5f 4f 50 45 4e 53 53 4c 5f  TLS_SSL_OPENSSL_
1280: 43 48 45 43 4b 5f 50 52 4f 54 4f 5f 56 45 52 28  CHECK_PROTO_VER(
1290: 5b 74 63 6c 74 6c 73 5f 73 73 6c 5f 74 6c 73 31  [tcltls_ssl_tls1
12a0: 5f 31 5d 2c 20 5b 54 4c 53 76 31 5f 31 5f 6d 65  _1], [TLSv1_1_me
12b0: 74 68 6f 64 5d 2c 20 5b 74 6c 73 76 31 2e 31 5d  thod], [tlsv1.1]
12c0: 2c 20 5b 4e 4f 5f 54 4c 53 31 5f 31 5d 29 0a 09  , [NO_TLS1_1])..
12d0: 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f 50 45 4e 53  TCLTLS_SSL_OPENS
12e0: 53 4c 5f 43 48 45 43 4b 5f 50 52 4f 54 4f 5f 56  SL_CHECK_PROTO_V
12f0: 45 52 28 5b 74 63 6c 74 6c 73 5f 73 73 6c 5f 74  ER([tcltls_ssl_t
1300: 6c 73 31 5f 32 5d 2c 20 5b 54 4c 53 76 31 5f 32  ls1_2], [TLSv1_2
1310: 5f 6d 65 74 68 6f 64 5d 2c 20 5b 74 6c 73 76 31  _method], [tlsv1
1320: 2e 32 5d 2c 20 5b 4e 4f 5f 54 4c 53 31 5f 32 5d  .2], [NO_TLS1_2]
1330: 29 0a 0a 09 41 43 5f 43 41 43 48 45 5f 56 41 4c  )...AC_CACHE_VAL
1340: 28 5b 74 63 6c 74 6c 73 5f 63 76 5f 66 75 6e 63  ([tcltls_cv_func
1350: 5f 74 6c 73 65 78 74 5f 68 6f 73 74 6e 61 6d 65  _tlsext_hostname
1360: 5d 2c 20 5b 0a 09 09 41 43 5f 4c 41 4e 47 5f 50  ], [...AC_LANG_P
1370: 55 53 48 28 43 29 0a 09 09 41 43 5f 4d 53 47 5f  USH(C)...AC_MSG_
1380: 43 48 45 43 4b 49 4e 47 28 5b 66 6f 72 20 53 53  CHECKING([for SS
1390: 4c 5f 73 65 74 5f 74 6c 73 65 78 74 5f 68 6f 73  L_set_tlsext_hos
13a0: 74 5f 6e 61 6d 65 5d 29 0a 09 09 41 43 5f 4c 49  t_name])...AC_LI
13b0: 4e 4b 5f 49 46 45 4c 53 45 28 5b 41 43 5f 4c 41  NK_IFELSE([AC_LA
13c0: 4e 47 5f 50 52 4f 47 52 41 4d 28 5b 0a 23 69 6e  NG_PROGRAM([.#in
13d0: 63 6c 75 64 65 20 3c 6f 70 65 6e 73 73 6c 2f 73  clude <openssl/s
13e0: 73 6c 2e 68 3e 0a 23 69 66 20 28 53 53 4c 45 41  sl.h>.#if (SSLEA
13f0: 59 5f 56 45 52 53 49 4f 4e 5f 4e 55 4d 42 45 52  Y_VERSION_NUMBER
1400: 20 3e 3d 20 30 78 30 39 30 37 30 30 30 4c 29 0a   >= 0x0907000L).
1410: 23 20 69 6e 63 6c 75 64 65 20 3c 6f 70 65 6e 73  # include <opens
1420: 73 6c 2f 63 6f 6e 66 2e 68 3e 0a 23 65 6e 64 69  sl/conf.h>.#endi
1430: 66 0a 09 09 09 5d 2c 20 5b 0a 20 20 28 76 6f 69  f....], [.  (voi
1440: 64 29 53 53 4c 5f 73 65 74 5f 74 6c 73 65 78 74  d)SSL_set_tlsext
1450: 5f 68 6f 73 74 5f 6e 61 6d 65 28 28 76 6f 69 64  _host_name((void
1460: 20 2a 29 20 30 2c 20 28 76 6f 69 64 20 2a 29 20   *) 0, (void *) 
1470: 30 29 3b 0a 09 09 09 5d 29 5d 2c 20 5b 0a 09 09  0);....])], [...
1480: 09 41 43 5f 4d 53 47 5f 52 45 53 55 4c 54 28 5b  .AC_MSG_RESULT([
1490: 79 65 73 5d 29 0a 09 09 09 74 63 6c 74 6c 73 5f  yes])....tcltls_
14a0: 63 76 5f 66 75 6e 63 5f 74 6c 73 65 78 74 5f 68  cv_func_tlsext_h
14b0: 6f 73 74 6e 61 6d 65 3d 27 79 65 73 27 0a 09 09  ostname='yes'...
14c0: 5d 2c 20 5b 0a 09 09 09 41 43 5f 4d 53 47 5f 52  ], [....AC_MSG_R
14d0: 45 53 55 4c 54 28 5b 6e 6f 5d 29 0a 09 09 09 74  ESULT([no])....t
14e0: 63 6c 74 6c 73 5f 63 76 5f 66 75 6e 63 5f 74 6c  cltls_cv_func_tl
14f0: 73 65 78 74 5f 68 6f 73 74 6e 61 6d 65 3d 27 6e  sext_hostname='n
1500: 6f 27 0a 09 09 5d 29 0a 09 09 41 43 5f 4c 41 4e  o'...])...AC_LAN
1510: 47 5f 50 4f 50 28 5b 43 5d 29 0a 09 5d 29 0a 0a  G_POP([C])..])..
1520: 09 69 66 20 74 65 73 74 20 22 24 74 63 6c 74 6c  .if test "$tcltl
1530: 73 5f 63 76 5f 66 75 6e 63 5f 74 6c 73 65 78 74  s_cv_func_tlsext
1540: 5f 68 6f 73 74 6e 61 6d 65 22 20 3d 20 27 6e 6f  _hostname" = 'no
1550: 27 3b 20 74 68 65 6e 0a 09 09 41 43 5f 44 45 46  '; then...AC_DEF
1560: 49 4e 45 28 5b 4f 50 45 4e 53 53 4c 5f 4e 4f 5f  INE([OPENSSL_NO_
1570: 54 4c 53 45 58 54 5d 2c 20 5b 31 5d 2c 20 5b 44  TLSEXT], [1], [D
1580: 65 66 69 6e 65 20 74 68 69 73 20 69 66 20 79 6f  efine this if yo
1590: 75 72 20 4f 70 65 6e 53 53 4c 20 64 6f 65 73 20  ur OpenSSL does 
15a0: 6e 6f 74 20 73 75 70 70 6f 72 74 20 74 68 65 20  not support the 
15b0: 54 4c 53 20 45 78 74 65 6e 73 69 6f 6e 20 66 6f  TLS Extension fo
15c0: 72 20 53 4e 49 5d 29 0a 09 66 69 0a 0a 09 64 6e  r SNI])..fi...dn
15d0: 6c 20 52 65 73 74 6f 72 65 20 63 6f 6d 70 69 6c  l Restore compil
15e0: 65 2d 61 6c 74 65 72 69 6e 67 20 76 61 72 69 61  e-altering varia
15f0: 62 6c 65 73 0a 09 4c 49 42 53 3d 22 24 7b 53 41  bles..LIBS="${SA
1600: 56 45 5f 4c 49 42 53 7d 22 0a 09 43 46 4c 41 47  VE_LIBS}"..CFLAG
1610: 53 3d 22 24 7b 53 41 56 45 5f 43 46 4c 41 47 53  S="${SAVE_CFLAGS
1620: 7d 22 0a 09 43 50 50 46 4c 41 47 53 3d 22 24 7b  }"..CPPFLAGS="${
1630: 53 41 56 45 5f 43 50 50 46 4c 41 47 53 7d 22 0a  SAVE_CPPFLAGS}".
1640: 5d 29 0a                                         ]).