Hex Artifact Content

Artifact 4546434d3f66cd75b593e9b01e8732f5f095e42b:


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 30 29 0a 0a 64 6e 6c  tls, 1.7.0)..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 61 22 0a 66 69  ET="tcltls.a".fi
0240: 0a 41 43 5f 53 55 42 53 54 28 45 58 54 45 4e 53  .AC_SUBST(EXTENS
0250: 49 4f 4e 5f 54 41 52 47 45 54 29 0a 41 43 5f 53  ION_TARGET).AC_S
0260: 55 42 53 54 28 54 43 4c 45 58 54 5f 42 55 49 4c  UBST(TCLEXT_BUIL
0270: 44 29 0a 0a 64 6e 6c 20 44 65 74 65 72 6d 69 6e  D)..dnl Determin
0280: 65 20 77 68 61 74 20 53 53 4c 20 6c 69 62 72 61  e what SSL libra
0290: 72 79 20 74 6f 20 6c 69 6e 6b 20 77 69 74 68 0a  ry to link with.
02a0: 41 43 5f 41 52 47 5f 57 49 54 48 28 5b 73 73 6c  AC_ARG_WITH([ssl
02b0: 5d 2c 20 41 53 5f 48 45 4c 50 5f 53 54 52 49 4e  ], AS_HELP_STRIN
02c0: 47 28 5b 2d 2d 77 69 74 68 2d 73 73 6c 5d 2c 20  G([--with-ssl], 
02d0: 5b 6e 61 6d 65 20 6f 66 20 73 73 6c 20 6c 69 62  [name of ssl lib
02e0: 72 61 72 79 20 74 6f 20 62 75 69 6c 64 20 61 67  rary to build ag
02f0: 61 69 6e 73 74 20 28 6f 70 65 6e 73 73 6c 2c 20  ainst (openssl, 
0300: 6c 69 62 72 65 73 73 6c 2c 20 6e 73 73 2c 20 61  libressl, nss, a
0310: 75 74 6f 29 5d 29 2c 20 5b 0a 09 69 66 20 74 65  uto)]), [..if te
0320: 73 74 20 22 24 77 69 74 68 76 61 6c 22 20 3d 20  st "$withval" = 
0330: 22 6e 6f 22 3b 20 74 68 65 6e 0a 09 09 41 43 5f  "no"; then...AC_
0340: 4d 53 47 5f 45 52 52 4f 52 28 5b 59 6f 75 20 6d  MSG_ERROR([You m
0350: 61 79 20 6e 6f 74 20 73 70 65 63 69 66 79 20 2d  ay not specify -
0360: 2d 77 69 74 68 6f 75 74 2d 73 73 6c 5d 29 0a 09  -without-ssl])..
0370: 66 69 0a 0a 09 69 66 20 74 65 73 74 20 22 24 77  fi...if test "$w
0380: 69 74 68 76 61 6c 22 20 3d 20 22 79 65 73 22 3b  ithval" = "yes";
0390: 20 74 68 65 6e 0a 09 09 41 43 5f 4d 53 47 5f 45   then...AC_MSG_E
03a0: 52 52 4f 52 28 5b 49 66 20 79 6f 75 20 73 70 65  RROR([If you spe
03b0: 63 69 66 79 20 2d 2d 77 69 74 68 2d 73 73 6c 20  cify --with-ssl 
03c0: 74 68 65 6e 20 79 6f 75 20 6d 75 73 74 20 70 72  then you must pr
03d0: 6f 76 69 64 65 20 61 20 76 61 6c 75 65 5d 29 0a  ovide a value]).
03e0: 09 66 69 0a 0a 09 74 63 6c 74 6c 73 5f 73 73 6c  .fi...tcltls_ssl
03f0: 5f 6c 69 62 3d 22 24 77 69 74 68 76 61 6c 22 0a  _lib="$withval".
0400: 5d 2c 20 5b 0a 09 74 63 6c 74 6c 73 5f 73 73 6c  ], [..tcltls_ssl
0410: 5f 6c 69 62 3d 27 61 75 74 6f 27 0a 5d 29 0a 0a  _lib='auto'.])..
0420: 64 6e 6c 20 45 6e 61 62 6c 65 20 73 75 70 70 6f  dnl Enable suppo
0430: 72 74 20 66 6f 72 20 62 75 69 6c 64 69 6e 67 20  rt for building 
0440: 74 68 65 20 73 61 6d 65 20 6c 69 62 72 61 72 79  the same library
0450: 20 65 76 65 72 79 20 74 69 6d 65 0a 74 63 6c 74   every time.tclt
0460: 6c 73 5f 64 65 74 65 72 6d 69 6e 69 73 74 69 63  ls_deterministic
0470: 3d 27 66 61 6c 73 65 27 0a 41 43 5f 41 52 47 5f  ='false'.AC_ARG_
0480: 45 4e 41 42 4c 45 28 5b 64 65 74 65 72 6d 69 6e  ENABLE([determin
0490: 69 73 74 69 63 5d 2c 20 41 53 5f 48 45 4c 50 5f  istic], AS_HELP_
04a0: 53 54 52 49 4e 47 28 5b 2d 2d 65 6e 61 62 6c 65  STRING([--enable
04b0: 2d 64 65 74 65 72 6d 69 6e 69 73 74 69 63 5d 2c  -deterministic],
04c0: 20 5b 65 6e 61 62 6c 65 20 64 65 74 65 72 6d 69   [enable determi
04d0: 6e 69 73 74 69 63 20 70 61 72 61 6d 65 74 65 72  nistic parameter
04e0: 73 5d 29 2c 20 5b 0a 09 69 66 20 74 65 73 74 20  s]), [..if test 
04f0: 22 24 65 6e 61 62 6c 65 76 61 6c 22 20 3d 20 22  "$enableval" = "
0500: 79 65 73 22 3b 20 74 68 65 6e 0a 09 09 74 63 6c  yes"; then...tcl
0510: 74 6c 73 5f 64 65 74 65 72 6d 69 6e 69 73 74 69  tls_deterministi
0520: 63 3d 27 74 72 75 65 27 0a 09 66 69 0a 5d 29 0a  c='true'..fi.]).
0530: 69 66 20 74 65 73 74 20 22 24 74 63 6c 74 6c 73  if test "$tcltls
0540: 5f 64 65 74 65 72 6d 69 6e 69 73 74 69 63 22 20  _deterministic" 
0550: 3d 20 27 74 72 75 65 27 3b 20 74 68 65 6e 0a 09  = 'true'; then..
0560: 47 45 4e 5f 44 48 5f 50 41 52 41 4d 53 5f 41 52  GEN_DH_PARAMS_AR
0570: 47 53 3d 27 66 61 6c 6c 62 61 63 6b 27 0a 65 6c  GS='fallback'.el
0580: 73 65 0a 09 47 45 4e 5f 44 48 5f 50 41 52 41 4d  se..GEN_DH_PARAM
0590: 53 5f 41 52 47 53 3d 27 27 0a 66 69 0a 41 43 5f  S_ARGS=''.fi.AC_
05a0: 53 55 42 53 54 28 47 45 4e 5f 44 48 5f 50 41 52  SUBST(GEN_DH_PAR
05b0: 41 4d 53 5f 41 52 47 53 29 0a 0a 64 6e 6c 20 45  AMS_ARGS)..dnl E
05c0: 6e 61 62 6c 65 20 73 75 70 70 6f 72 74 20 66 6f  nable support fo
05d0: 72 20 61 20 64 65 62 75 67 67 69 6e 67 20 62 75  r a debugging bu
05e0: 69 6c 64 0a 74 63 6c 74 6c 73 5f 64 65 62 75 67  ild.tcltls_debug
05f0: 3d 27 66 61 6c 73 65 27 0a 41 43 5f 41 52 47 5f  ='false'.AC_ARG_
0600: 45 4e 41 42 4c 45 28 5b 64 65 62 75 67 5d 2c 20  ENABLE([debug], 
0610: 41 53 5f 48 45 4c 50 5f 53 54 52 49 4e 47 28 5b  AS_HELP_STRING([
0620: 2d 2d 65 6e 61 62 6c 65 2d 64 65 62 75 67 5d 2c  --enable-debug],
0630: 20 5b 65 6e 61 62 6c 65 20 64 65 62 75 67 67 69   [enable debuggi
0640: 6e 67 20 70 61 72 61 6d 65 74 65 72 73 5d 29 2c  ng parameters]),
0650: 20 5b 0a 09 69 66 20 74 65 73 74 20 22 24 65 6e   [..if test "$en
0660: 61 62 6c 65 76 61 6c 22 20 3d 20 22 79 65 73 22  ableval" = "yes"
0670: 3b 20 74 68 65 6e 0a 09 09 74 63 6c 74 6c 73 5f  ; then...tcltls_
0680: 64 65 62 75 67 3d 27 74 72 75 65 27 0a 09 66 69  debug='true'..fi
0690: 0a 5d 29 0a 69 66 20 74 65 73 74 20 22 24 74 63  .]).if test "$tc
06a0: 6c 74 6c 73 5f 64 65 62 75 67 22 20 3d 20 27 74  ltls_debug" = 't
06b0: 72 75 65 27 3b 20 74 68 65 6e 0a 09 41 43 5f 44  rue'; then..AC_D
06c0: 45 46 49 4e 45 28 54 43 4c 45 58 54 5f 54 43 4c  EFINE(TCLEXT_TCL
06d0: 54 4c 53 5f 44 45 42 55 47 2c 20 5b 31 5d 2c 20  TLS_DEBUG, [1], 
06e0: 5b 45 6e 61 62 6c 65 20 64 65 62 75 67 67 69 6e  [Enable debuggin
06f0: 67 20 62 75 69 6c 64 5d 29 0a 66 69 0a 0a 64 6e  g build]).fi..dn
0700: 6c 20 46 69 6e 64 20 22 78 78 64 22 20 73 6f 20  l Find "xxd" so 
0710: 77 65 20 63 61 6e 20 62 75 69 6c 64 20 74 68 65  we can build the
0720: 20 74 6c 73 2e 74 63 6c 2e 68 20 66 69 6c 65 0a   tls.tcl.h file.
0730: 41 43 5f 43 48 45 43 4b 5f 54 4f 4f 4c 28 5b 58  AC_CHECK_TOOL([X
0740: 58 44 5d 2c 20 5b 78 78 64 5d 2c 20 5b 5f 5f 78  XD], [xxd], [__x
0750: 78 64 5f 5f 6e 6f 74 5f 5f 66 6f 75 6e 64 5d 29  xd__not__found])
0760: 0a 0a 64 6e 6c 20 46 69 6e 64 20 22 70 6b 67 2d  ..dnl Find "pkg-
0770: 63 6f 6e 66 69 67 22 20 73 69 6e 63 65 20 77 65  config" since we
0780: 20 6e 65 65 64 20 74 6f 20 75 73 65 20 69 74 0a   need to use it.
0790: 41 43 5f 43 48 45 43 4b 5f 54 4f 4f 4c 28 5b 50  AC_CHECK_TOOL([P
07a0: 4b 47 43 4f 4e 46 49 47 5d 2c 20 5b 70 6b 67 2d  KGCONFIG], [pkg-
07b0: 63 6f 6e 66 69 67 5d 2c 20 5b 66 61 6c 73 65 5d  config], [false]
07c0: 29 0a 0a 64 6e 6c 20 58 58 58 3a 54 4f 44 4f 3a  )..dnl XXX:TODO:
07d0: 20 41 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 64   Automatically d
07e0: 65 74 65 72 6d 69 6e 65 20 74 68 65 20 53 53 4c  etermine the SSL
07f0: 20 6c 69 62 72 61 72 79 20 74 6f 20 75 73 65 0a   library to use.
0800: 64 6e 6c 20 20 20 20 20 20 20 20 20 20 20 64 65  dnl           de
0810: 66 61 75 6c 74 69 6e 67 20 74 6f 20 4f 70 65 6e  faulting to Open
0820: 53 53 4c 20 66 6f 72 20 63 6f 6d 70 61 74 69 62  SSL for compatib
0830: 69 6c 69 74 79 20 72 65 61 73 6f 6e 73 0a 69 66  ility reasons.if
0840: 20 74 65 73 74 20 22 24 74 63 6c 74 6c 73 5f 73   test "$tcltls_s
0850: 73 6c 5f 6c 69 62 22 20 3d 20 27 61 75 74 6f 27  sl_lib" = 'auto'
0860: 3b 20 74 68 65 6e 0a 09 74 63 6c 74 6c 73 5f 73  ; then..tcltls_s
0870: 73 6c 5f 6c 69 62 3d 27 6f 70 65 6e 73 73 6c 27  sl_lib='openssl'
0880: 0a 66 69 0a 0a 41 43 5f 4d 53 47 5f 43 48 45 43  .fi..AC_MSG_CHEC
0890: 4b 49 4e 47 28 5b 77 68 69 63 68 20 54 4c 53 20  KING([which TLS 
08a0: 6c 69 62 72 61 72 79 20 74 6f 20 75 73 65 5d 29  library to use])
08b0: 0a 41 43 5f 4d 53 47 5f 52 45 53 55 4c 54 28 5b  .AC_MSG_RESULT([
08c0: 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c 69 62 5d  $tcltls_ssl_lib]
08d0: 29 0a 0a 0a 64 6e 6c 20 4d 61 6e 75 61 6c 6c 79  )...dnl Manually
08e0: 20 72 65 77 72 69 74 65 20 6c 69 62 72 65 73 73   rewrite libress
08f0: 6c 20 74 6f 20 4f 70 65 6e 53 53 4c 20 73 69 6e  l to OpenSSL sin
0900: 63 65 20 77 65 20 75 73 65 20 74 68 65 0a 64 6e  ce we use the.dn
0910: 6c 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20  l compatibility 
0920: 69 6e 74 65 72 66 61 63 65 0a 69 66 20 74 65 73  interface.if tes
0930: 74 20 22 24 74 63 6c 74 6c 73 5f 73 73 6c 5f 6c  t "$tcltls_ssl_l
0940: 69 62 22 20 3d 20 22 6c 69 62 72 65 73 73 6c 22  ib" = "libressl"
0950: 3b 20 74 68 65 6e 0a 09 74 63 6c 74 6c 73 5f 73  ; then..tcltls_s
0960: 73 6c 5f 6c 69 62 3d 27 6f 70 65 6e 73 73 6c 27  sl_lib='openssl'
0970: 0a 66 69 0a 0a 41 53 5f 43 41 53 45 28 5b 24 74  .fi..AS_CASE([$t
0980: 63 6c 74 6c 73 5f 73 73 6c 5f 6c 69 62 5d 2c 0a  cltls_ssl_lib],.
0990: 09 5b 6f 70 65 6e 73 73 6c 5d 2c 20 5b 0a 09 09  .[openssl], [...
09a0: 54 43 4c 54 4c 53 5f 53 53 4c 5f 4f 50 45 4e 53  TCLTLS_SSL_OPENS
09b0: 53 4c 0a 09 5d 2c 0a 09 5b 6e 73 73 5d 2c 20 5b  SL..],..[nss], [
09c0: 0a 09 20 09 54 43 4c 54 4c 53 5f 53 53 4c 5f 4c  .. .TCLTLS_SSL_L
09d0: 49 42 53 3d 22 22 0a 09 09 54 43 4c 54 4c 53 5f  IBS=""...TCLTLS_
09e0: 53 53 4c 5f 43 46 4c 41 47 53 3d 22 22 0a 09 09  SSL_CFLAGS=""...
09f0: 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 50 50 46 4c  TCLTLS_SSL_CPPFL
0a00: 41 47 53 3d 22 22 0a 09 5d 2c 0a 09 5b 0a 09 09  AGS=""..],..[...
0a10: 41 43 5f 4d 53 47 5f 45 52 52 4f 52 28 5b 55 6e  AC_MSG_ERROR([Un
0a20: 73 75 70 70 6f 72 74 65 64 20 53 53 4c 20 6c 69  supported SSL li
0a30: 62 72 61 72 79 3a 20 24 74 63 6c 74 6c 73 5f 73  brary: $tcltls_s
0a40: 73 6c 5f 6c 69 62 5d 29 0a 09 5d 0a 29 0a 64 6e  sl_lib])..].).dn
0a50: 6c 20 44 65 74 65 72 6d 69 6e 65 20 68 6f 77 20  l Determine how 
0a60: 74 6f 20 75 73 65 20 74 68 69 73 20 53 53 4c 20  to use this SSL 
0a70: 6c 69 62 72 61 72 79 0a 41 43 5f 4d 53 47 5f 43  library.AC_MSG_C
0a80: 48 45 43 4b 49 4e 47 28 5b 68 6f 77 20 74 6f 20  HECKING([how to 
0a90: 75 73 65 20 24 74 63 6c 74 6c 73 5f 73 73 6c 5f  use $tcltls_ssl_
0aa0: 6c 69 62 5d 29 0a 4c 49 42 53 3d 22 24 7b 4c 49  lib]).LIBS="${LI
0ab0: 42 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53 53 4c  BS} ${TCLTLS_SSL
0ac0: 5f 4c 49 42 53 7d 22 0a 43 46 4c 41 47 53 3d 22  _LIBS}".CFLAGS="
0ad0: 24 7b 43 46 4c 41 47 53 7d 20 24 7b 54 43 4c 54  ${CFLAGS} ${TCLT
0ae0: 4c 53 5f 53 53 4c 5f 43 46 4c 41 47 53 7d 22 0a  LS_SSL_CFLAGS}".
0af0: 43 50 50 46 4c 41 47 53 3d 22 24 7b 43 50 50 46  CPPFLAGS="${CPPF
0b00: 4c 41 47 53 7d 20 24 7b 54 43 4c 54 4c 53 5f 53  LAGS} ${TCLTLS_S
0b10: 53 4c 5f 43 50 50 46 4c 41 47 53 7d 22 0a 41 43  SL_CPPFLAGS}".AC
0b20: 5f 4d 53 47 5f 52 45 53 55 4c 54 28 5b 24 54 43  _MSG_RESULT([$TC
0b30: 4c 54 4c 53 5f 53 53 4c 5f 43 50 50 46 4c 41 47  LTLS_SSL_CPPFLAG
0b40: 53 20 24 54 43 4c 54 4c 53 5f 53 53 4c 5f 43 46  S $TCLTLS_SSL_CF
0b50: 4c 41 47 53 20 24 54 43 4c 54 4c 53 5f 53 53 4c  LAGS $TCLTLS_SSL
0b60: 5f 4c 49 42 53 5d 29 0a 0a 64 6e 6c 20 50 72 6f  _LIBS])..dnl Pro
0b70: 64 75 63 65 20 6f 75 74 70 75 74 0a 41 43 5f 4f  duce output.AC_O
0b80: 55 54 50 55 54 28 4d 61 6b 65 66 69 6c 65 20 70  UTPUT(Makefile p
0b90: 6b 67 49 6e 64 65 78 2e 74 63 6c 29 0a           kgIndex.tcl).