1#!/bin/bash -norc
2dnl	This file is an input file used by the GNU "autoconf" program to
3dnl	generate the file "configure", which is run during Tcl installation
4dnl	to configure the system for the local environment.
5dnl 
6dnl This file contains code to generate "tls" using either the
7dnl OpenSSL libraries or libraries from the commercial BSAFE SSL-C
8dnl product from RSA Security.  In the United States, it is necessary
9dnl to use the RSA BSAFE libraries for any product developed for
10dnl commercial use. Licensing information for BSAFE SSL-C may be
11dnl obtained from RSA Data Scurity Inc., San Mateo, California, USA.
12dnl Their home page on the web is "www.rsasecurity.com". 
13#
14# RCS: @(#) $Id: configure.in,v 1.25 2010/08/12 01:30:44 hobbs2 Exp $
15
16
17#--------------------------------------------------------------------
18# macro used to verify that the configure script can find the sources
19#--------------------------------------------------------------------
20
21AC_INIT([tls], [1.6.1])
22
23TEA_INIT([3.9])
24
25AC_CONFIG_AUX_DIR(tclconfig)
26
27#--------------------------------------------------------------------
28# Load the tclConfig.sh file
29#--------------------------------------------------------------------
30
31TEA_PATH_TCLCONFIG
32TEA_LOAD_TCLCONFIG
33
34#-----------------------------------------------------------------------
35# Handle the --prefix=... option by defaulting to what Tcl gave.
36# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
37#-----------------------------------------------------------------------
38
39TEA_PREFIX
40
41#-----------------------------------------------------------------------
42# Standard compiler checks.
43# This sets up CC by using the CC env var, or looks for gcc otherwise.
44# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
45# the basic setup necessary to compile executables.
46#-----------------------------------------------------------------------
47
48TEA_SETUP_COMPILER
49
50#-----------------------------------------------------------------------
51# __CHANGE__
52# Specify the C source files to compile in TEA_ADD_SOURCES,
53# public headers that need to be installed in TEA_ADD_HEADERS,
54# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
55# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
56# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
57# and PKG_TCL_SOURCES.
58#-----------------------------------------------------------------------
59
60TEA_ADD_SOURCES([])
61TEA_ADD_HEADERS([])
62TEA_ADD_INCLUDES([])
63TEA_ADD_LIBS([])
64TEA_ADD_CFLAGS([])
65TEA_ADD_STUB_SOURCES([])
66TEA_ADD_TCL_SOURCES([])
67
68#--------------------------------------------------------------------
69# A few miscellaneous platform-specific items:
70#
71# Define a special symbol for Windows (BUILD_sample in this case) so
72# that we create the export library with the dll.  See sha1.h on how
73# to use this.
74#
75# Windows creates a few extra files that need to be cleaned up.
76# You can add more files to clean if your extension creates any extra
77# files.
78#
79# Define any extra compiler flags in the PACKAGE_CFLAGS variable.
80# These will be appended to the current set of compiler flags for
81# your system.
82#--------------------------------------------------------------------
83
84if test "${TEA_PLATFORM}" = "windows" ; then
85    AC_DEFINE(BUILD_tls)
86    AC_DEFINE(WINDOWS)
87    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
88else
89    CLEANFILES="pkgIndex.tcl"
90fi
91AC_SUBST(CLEANFILES)
92
93#--------------------------------------------------------------------
94# Choose which headers you need.  Extension authors should try very
95# hard to only rely on the Tcl public header files.  Internal headers
96# contain private data structures and are subject to change without
97# notice.
98# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
99#--------------------------------------------------------------------
100
101TEA_PUBLIC_TCL_HEADERS
102
103#--------------------------------------------------------------------
104# Check whether --enable-threads or --disable-threads was given.
105#--------------------------------------------------------------------
106
107TEA_ENABLE_THREADS
108
109#--------------------------------------------------------------------
110# The statement below defines a collection of symbols related to
111# building as a shared library instead of a static library.
112#--------------------------------------------------------------------
113
114TEA_ENABLE_SHARED
115
116#--------------------------------------------------------------------
117# This macro figures out what flags to use with the compiler/linker
118# when building shared/static debug/optimized objects.  This information
119# can be taken from the tclConfig.sh file, but this figures it all out.
120#--------------------------------------------------------------------
121
122TEA_CONFIG_CFLAGS
123
124#--------------------------------------------------------------------
125# Set the default compiler switches based on the --enable-symbols option.
126#--------------------------------------------------------------------
127
128TEA_ENABLE_SYMBOLS
129
130#--------------------------------------------------------------------
131# Everyone should be linking against the Tcl stub library.  If you
132# can't for some reason, remove this definition.  If you aren't using
133# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
134# link against the non-stubbed Tcl library.  Add Tk too if necessary.
135#--------------------------------------------------------------------
136
137AC_DEFINE(USE_TCL_STUBS)
138
139#--------------------------------------------------------------------
140# If the variable OPENSSL is set, we will build with the OpenSSL
141# libraries.  If it is not set, then we will use RSA BSAFE SSL-C
142# libraries instead of the default OpenSSL libaries.
143#--------------------------------------------------------------------
144
145OPENSSL="1"
146
147TLS_CHECK_SSL
148
149#--------------------------------------------------------------------
150# Determine if we should use the patented encryption code
151#--------------------------------------------------------------------
152
153AC_ARG_ENABLE(patents, [  --enable-patents        Use patented code.  Default is enabled], PATENTS=${enableval}, PATENTS=yes)  
154
155if test ${PATENTS} = no; then
156    AC_DEFINE([NO_PATENTS])
157fi
158
159#--------------------------------------------------------------------
160# This macro generates a line to use when building a library.  It
161# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
162# and TEA_LOAD_TCLCONFIG macros above.
163#--------------------------------------------------------------------
164
165TEA_MAKE_LIB
166
167#--------------------------------------------------------------------
168# Shared libraries and static libraries have different names.
169# Also, windows libraries and unix libraries have different names.
170# For the OpenSSL version, I chose to use the same library names that
171# OpenSSL uses as its default names.
172#--------------------------------------------------------------------
173
174if test "${TEA_PLATFORM}" = "windows" ; then
175    if test "$GCC" = "yes"; then
176	TEA_ADD_LIBS([-L${SSL_LIB_DIR_NATIVE}])
177    else
178	TEA_ADD_LIBS([-libpath:${SSL_LIB_DIR_NATIVE}])
179    fi
180    if test -n "${OPENSSL}"; then
181        TEA_ADD_LIBS([ssleay32.lib libeay32.lib])
182    else
183        TEA_ADD_LIBS([sslc32.lib])
184    fi
185else
186    # Subst runtime dir here, use -R and -L where necessary. [Bug 1742859]
187    LIB_RUNTIME_DIR=${SSL_LIB_DIR}
188    eval "LD_SEARCH_FLAGS=\"${LD_SEARCH_FLAGS}\""
189    if test -n "${OPENSSL}"; then
190	TEA_ADD_LIBS([${LD_SEARCH_FLAGS} -L${SSL_LIB_DIR} -lssl -lcrypto ${GCCPATH} ${GCCLIB}])
191    else
192	TEA_ADD_LIBS([${LD_SEARCH_FLAGS} -L${SSL_LIB_DIR} -lsslc])
193    fi
194fi
195
196#--------------------------------------------------------------------
197# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
198# file during the install process.  Don't run the TCLSH_PROG through
199# ${CYGPATH} because it's being used directly by make.
200# Require that we use a tclsh shell version 8.2 or later since earlier
201# versions have bugs in the pkg_mkIndex routine.
202# Add WISH as well if this is a Tk extension.
203#--------------------------------------------------------------------
204
205TEA_PROG_TCLSH
206
207#--------------------------------------------------------------------
208# Finally, substitute all of the various values into the Makefile.
209#--------------------------------------------------------------------
210
211AC_OUTPUT([Makefile])
212