Diff
Bounty program for improvements to Tcl and certain Tcl packages.

Differences From Artifact [8fe74b7f50]:

To Artifact [26a6a42e98]:


1
2
3
4
5
6








7
8
9
10
11
12
13
dnl "configure.in" for the "tls" Tcl extension.
dnl 
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl
dnl installation to configure the system for the local environment.










#--------------------------------------------------------------------
# macro used to verify that the configure script can find the sources
#--------------------------------------------------------------------

AC_INIT(tls.h)





>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
dnl "configure.in" for the "tls" Tcl extension.
dnl 
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl
dnl installation to configure the system for the local environment.
dnl 
dnl This file contains code to generate "tls" using either the
dnl OpenSSL libraries or libraries from the commercial BSAFE SSL-C
dnl product from RSA Security.  In the United States, it is necessary
dnl to use the RSA BSAFE libraries for any product developed for
dnl commercial use. Licensing information for BSAFE SSL-C may be
dnl obtained from RSA Data Scurity Inc., San Mateo, California, USA.
dnl Their home page on the web is "www.rsasecurity.com". 


#--------------------------------------------------------------------
# macro used to verify that the configure script can find the sources
#--------------------------------------------------------------------

AC_INIT(tls.h)
40
41
42
43
44
45
46









47
48
49




50
51

52





53




















54
55
56
57
58








59
60
61
62
63
64




65
66
67
68
69
70
71
72
73
74
75

76

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92



93
94


95
96
97
98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
# We put this here so that you can compile with -DVERSION="1.2" to
# encode the package version directly into the source files.
#--------------------------------------------------------------------

eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
eval AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE}")











#--------------------------------------------------------------------
# Establish the location of the root directory for OpenSSL.




#--------------------------------------------------------------------


SSL_DIR='/usr/local/openssl'


























AC_ARG_WITH(ssl-dir, [  --with-ssl-dir=DIR  SSL root directory], SSL_DIR=$withval)

if test -z "${SSL_DIR}"; then
    AC_ERROR(must specify SSL directory)
fi








if test ! -f "${SSL_DIR}/include/openssl/opensslv.h"; then
    AC_ERROR(bad ssl-dir: cant find opensslv.h under ${SSL_DIR})
fi

SSL_LIB_DIR=${SSL_DIR}/lib
SSL_INCLUDE_DIR=${SSL_DIR}/include





AC_SUBST(SSL_DIR)
AC_SUBST(SSL_LIB_DIR)
AC_SUBST(SSL_INCLUDE_DIR)

#--------------------------------------------------------------------
# Determine if we should use the patented encryption code
#--------------------------------------------------------------------

AC_ARG_WITH(patents, [  --with-patents=yes|no    Turn on/off the patented encryption code.  Default is no patents], SSL_CFLAGS="", SSL_CFLAGS="-DNO_PATENTS")


AC_SUBST(SSL_CFLAGS)


#--------------------------------------------------------------------
# Check whether --enable-gcc or --disable-gcc was given.  Do this 
# before AC_CYGWIN is called so the compiler can be fully tested by
# built-in autoconf tools.  This macro also calls AC_PROG_CC to set
# the compiler if --enable-gcc was not used.
#--------------------------------------------------------------------

SC_ENABLE_GCC
AC_PROG_INSTALL

#--------------------------------------------------------------------
# If openssl was built with gcc then there may be some symbols that need
# resolving before we can load it into tclsh (__udivd3i on solaris.  Let the
# user specify if we need to add libgcc to the link line to resolve these
# symbols.



#--------------------------------------------------------------------



AC_MSG_CHECKING(if libgcc is needed to resolve openssl symbols)

AC_ARG_WITH(gcclib, [  --with-gcclib         link with libgcc to resolve symbols in a gcc-built openssl library], GCCLIB="-lgcc", GCCLIB="")

if test "x${GCCLIB}" = "x" ; then
    AC_MSG_RESULT(no)
else
    AC_MSG_RESULT(yes)
    AC_MSG_CHECKING(for gcc library location)
    GCCPATH=`${CC} -print-libgcc-file-name | sed -e 's#[^/]*$##'`
    GCCPATH="-L${GCCPATH}"
    AC_MSG_RESULT(${GCCPATH})

fi

#--------------------------------------------------------------------
# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------

AC_PROG_MAKE_SET






>
>
>
>
>
>
>
>
>



>
>
>
>


>
|
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|
|

>
>
>
>
>
>
>
>
|
|
|
|
|
|
>
>
>
>









|

>
|
>












|



>
>
>


>
>
|

|

|
|
|
|
|
|
|
|
>







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# We put this here so that you can compile with -DVERSION="1.2" to
# encode the package version directly into the source files.
#--------------------------------------------------------------------

eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
eval AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE}")

#--------------------------------------------------------------------
# If the variable OPENSSL is set, we will build with the OpenSSL
# libraries.  If it is not set, then we will use RSA BSAFE SSL-C
# libraries instead of the default OpenSSL libaries.
#--------------------------------------------------------------------

OPENSSL="1"

AC_ARG_ENABLE(bsafe, [  --enable-bsafe  Use RSA BSAFE SSL-C libraries instead of the default OpenSSL libraries.], OPENSSL="", OPENSSL="1")

#--------------------------------------------------------------------
# Establish the location of the root directory for OpenSSL.
# If we're not using OpenSSL, set the root for BSAFE SSL-C.
# If we're using BSAFE, define the BSAFE compiler flag.
# The "FLAT_INC" flag is used in the BSAFE ssl.h header file and
# doesn't seem to be referenced anywhere else.
#--------------------------------------------------------------------

if test -n "${OPENSSL}"; then
    SSL_DIR='/usr/local/openssl'
else
    SSL_DIR='/use/local/sslc'
    AC_DEFINE(BSAFE)
    AC_DEFINE(FLAT_INC)
fi

#--------------------------------------------------------------------
# If we're using RSA BSAFE SSL-C, we need to establish what platform
# we're running on before we can figure out some paths.
# This step isn't necessary if we're using OpenSSL.
#--------------------------------------------------------------------

if test -z "${OPENSSL}"; then
    case "`uname -s`" in
	*win32* | *WIN32* | *CYGWIN_NT*|*CYGWIN_98*|*CYGWIN_95*)
	    PLATFORM=WIN32
	    ;;
	*SunOS*)
	    PLATFORM=SOLARIS
	    ;;
	*)
	    PLATFORM=LINUX
	    ;;
    esac
fi

AC_ARG_WITH(ssl-dir, [  --with-ssl-dir=DIR  SSL root directory], SSL_DIR=$withval)

if test ! -d "${SSL_DIR}"; then
    AC_ERROR(${SSL_DIR} is not a valid directory)
fi

#--------------------------------------------------------------------
# The OpenSSL and BSAFE SSL-C directory structures differ.
#--------------------------------------------------------------------

if test -n "${OPENSSL}"; then
    SSL_LIB_DIR=${SSL_DIR}/lib
    SSL_INCLUDE_DIR=${SSL_DIR}/include
    if test ! -f "${SSL_INCLUDE_DIR}/openssl/opensslv.h"; then
        AC_ERROR(bad ssl-dir: cannot find opensslv.h under ${SSL_INCLUDE_DIR})
    fi
else
    SSL_LIB_DIR=${SSL_DIR}/${PLATFORM}/library/lib
    SSL_INCLUDE_DIR=${SSL_DIR}/${PLATFORM}/library/include
    if test ! -f "${SSL_INCLUDE_DIR}/crypto.h"; then
        AC_ERROR(bad ssl-dir: cannot find crypto.h under ${SSL_INCLUDE_DIR})
    fi
fi

AC_SUBST(SSL_DIR)
AC_SUBST(SSL_LIB_DIR)
AC_SUBST(SSL_INCLUDE_DIR)

#--------------------------------------------------------------------
# Determine if we should use the patented encryption code
#--------------------------------------------------------------------

AC_ARG_ENABLE(patents, [  enable or disable patented code.  Default is patented code enabled.], PATENTS=${enableval}, PATENTS=yes)  

if test ${PATENTS} = no; then
    AC_DEFINE("NO_PATENTS")
fi

#--------------------------------------------------------------------
# Check whether --enable-gcc or --disable-gcc was given.  Do this 
# before AC_CYGWIN is called so the compiler can be fully tested by
# built-in autoconf tools.  This macro also calls AC_PROG_CC to set
# the compiler if --enable-gcc was not used.
#--------------------------------------------------------------------

SC_ENABLE_GCC
AC_PROG_INSTALL

#--------------------------------------------------------------------
# If OpenSSL was built with gcc then there may be some symbols that need
# resolving before we can load it into tclsh (__udivd3i on solaris.  Let the
# user specify if we need to add libgcc to the link line to resolve these
# symbols.
#
# This doesn't seem to be necessary if the RSA BSAFE SSL-C libraries
# are used instead of OpenSSL.
#--------------------------------------------------------------------

if test -n "${OPENSSL}"; then

    AC_MSG_CHECKING(if libgcc is needed to resolve openssl symbols)

    AC_ARG_WITH(gcclib, [  --with-gcclib         link with libgcc to resolve symbols in a gcc-built openssl library], GCCLIB="-lgcc", GCCLIB="")

    if test "x${GCCLIB}" = "x" ; then
        AC_MSG_RESULT(no)
    else
        AC_MSG_RESULT(yes)
        AC_MSG_CHECKING(for gcc library location)
        GCCPATH=`${CC} -print-libgcc-file-name | sed -e 's#[^/]*$##'`
        GCCPATH="-L${GCCPATH}"
        AC_MSG_RESULT(${GCCPATH})
    fi
fi

#--------------------------------------------------------------------
# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------

AC_PROG_MAKE_SET
266
267
268
269
270
271
272

273
274
275


276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296





















297
298
299
300
301
302
303
eval "SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
eval "UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"

#--------------------------------------------------------------------
# Shared libraries and static libraries have different names.
# Also, windows libraries and unix libraries have different names.

# (I chose to use the names that OpenSSL uses as its default names.)
#--------------------------------------------------------------------



case "`uname -s`" in
    *win32* | *WIN32* | *CYGWIN_NT*|*CYGWIN_98*|*CYGWIN_95*)
	if test "${SHARED_BUILD}" = "1" ; then
	    SHLIB_LD_LIBS="\"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" ${TCL_SHLIB_LD_LIBS} \"`${CYGPATH} ${SSL_LIB_DIR}/ssleay32.lib`\" \"`${CYGPATH} ${SSL_LIB_DIR}/libeay32.lib`\""
	    eval "${PACKAGE}_LIB_FILE=${PACKAGE}${SHARED_LIB_SUFFIX}"
	    RANLIB=:
	else
	    eval "${PACKAGE}_LIB_FILE=${PACKAGE}${UNSHARED_LIB_SUFFIX}"
	fi
	;;
    *)
	if test "${SHARED_BUILD}" = "1" ; then
	    SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC} -L${SSL_LIB_DIR} -lssl -L${SSL_LIB_DIR} -lcrypto ${GCCPATH} ${GCCLIB}"
	    eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${SHARED_LIB_SUFFIX}"
	    RANLIB=:
	else
	    eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${UNSHARED_LIB_SUFFIX}"
	fi
	;;
esac























AC_SUBST(tls_LIB_FILE)
AC_SUBST(SHLIB_LD_LIBS)

#--------------------------------------------------------------------
# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
# file during the install process.  Don't run the TCLSH_PROG through






>
|


>
>
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|

|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
eval "SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
eval "UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"

#--------------------------------------------------------------------
# Shared libraries and static libraries have different names.
# Also, windows libraries and unix libraries have different names.
# For the OpenSSL version, I chose to use the same library names that
# OpenSSL uses as its default names.
#--------------------------------------------------------------------

if test -n "${OPENSSL}"; then

    case "`uname -s`" in
	*win32* | *WIN32* | *CYGWIN_NT*|*CYGWIN_98*|*CYGWIN_95*)
	    if test "${SHARED_BUILD}" = "1" ; then
		SHLIB_LD_LIBS="\"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" ${TCL_SHLIB_LD_LIBS} \"`${CYGPATH} ${SSL_LIB_DIR}/ssleay32.lib`\" \"`${CYGPATH} ${SSL_LIB_DIR}/libeay32.lib`\""
		eval "${PACKAGE}_LIB_FILE=${PACKAGE}${SHARED_LIB_SUFFIX}"
		RANLIB=:
	    else
		eval "${PACKAGE}_LIB_FILE=${PACKAGE}${UNSHARED_LIB_SUFFIX}"
	    fi
	;;
	*)
	    if test "${SHARED_BUILD}" = "1" ; then
		SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC} -L${SSL_LIB_DIR} -lssl -L${SSL_LIB_DIR} -lcrypto ${GCCPATH} ${GCCLIB}"
		eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${SHARED_LIB_SUFFIX}"
		RANLIB=:
	    else
		eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${UNSHARED_LIB_SUFFIX}"
	    fi
	;;
    esac
else
    case "`uname -s`" in
        *win32* | *WIN32* | *CYGWIN_NT*|*CYGWIN_98*|*CYGWIN_95*)
	    if test "${SHARED_BUILD}" = "1" ; then
	        SHLIB_LD_LIBS="\"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" ${TCL_SHLIB_LD_LIBS} \"`${CYGPATH} ${SSL_LIB_DIR}/sslc.lib`\""
	        eval "${PACKAGE}_LIB_FILE=${PACKAGE}${SHARED_LIB_SUFFIX}"
	        RANLIB=:
	    else
	        eval "${PACKAGE}_LIB_FILE=${PACKAGE}${UNSHARED_LIB_SUFFIX}"
	    fi
	;;
        *)
	    if test "${SHARED_BUILD}" = "1" ; then
	        SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC} -L${SSL_LIB_DIR} -lsslc"
	        eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${SHARED_LIB_SUFFIX}"
	        RANLIB=:
	    else
	        eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}${UNSHARED_LIB_SUFFIX}"
	    fi
	;;
    esac
fi

AC_SUBST(tls_LIB_FILE)
AC_SUBST(SHLIB_LD_LIBS)

#--------------------------------------------------------------------
# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
# file during the install process.  Don't run the TCLSH_PROG through