Tea tcl2k
Tea tcl2k
ates a configure.in template that expresses to compile the sources. The configure script
the system dependencies of the source code. examines the current system and makes vari-
They use the autoconf program to process ous settings that are used during compilation.
this template into a configure script. The
3. When you run configure, you make some basic choices about how you will compile Tcl, such as
whether you will compile with debugging systems, or whether you will turn on threading support.
You also define the Tcl installation directory with configure. This step converts Makefile.in to a
Makefile suitable for the platform and configuration settings. .
4. Once configure is complete, you build your Any flag with disable or enable in its name can be
program with make. This steps checks your inverted. Table 3 lists the non-default setting, how-
source files against the compiled files and ever, so you can just leave the flag out to turn it off.
reruns the compiler on any files that have For example, when building Tcl on Solaris with the
changed since the last compilation. The gcc compiler, shared libraries, debugging symbols,
and threading support turned on, use this command:
results are binary libraries for extensions and
configure --prefix=/home/welch/install \
executable programs for applications. Make is --exec-pre-
used for testing and installation, too. Table 5 fix=/home/welch/install/solaris \
on page 8 shows the standard make targets. --enable-gcc --enable-threads --
enable-symbols
Your builds will go the most smoothly if you orga-
Standard configure Flags nize all your sources under a common directory. In
this case, you should be able to specify the same
Table 3 shows the standard options for Tcl config- configure flags for Tcl and all the other extensions
ure scripts. These are implemented by a configure
you will compile. In particular, you must use the
library file (tcl.m4) that you can use in your own same --prefix and --exec-prefix so everything
configure scripts. The facilities provided by
gets installed together.
tcl.m4 are described in more detail later. There are
also many other command line options that come If you use alternate build directories, like the
standard with configure. Some of these are meant unix/solaris example above, you must specify --
to give you control over where the different parts of with-tcl when building your extensions. This is
the installation go. However, because of the way Tcl the directory where the Tcl build occurred. It con-
automatically searches for scripts and binary librar- tains libraries and a tclConfig.sh file that is used by
ies, you can mess up the Tcl installation by install- the extensions configure process.
ing the libraries and the binaries in wildly different If your source tree is not adjacent to the Tcl source
locations. Because of this, the Tcl installation pro- tree, then you must use --with-tclinclude or --
cedures in the standard Makefile do not support the with-tcllib so the header files and runtime library
--libdir and --bindir options. In general, if the can be found during compilation. Typically this can
flags are not listed in Table 3, then they are not guar- happen if you build an extension under your home
anteed to be supported by the standard Makefile directory, but you are using a copy of Tcl that has
template. been installed by your system administrator. The --
with-x-includes and --with-x-libraries flags
are similar options necessary when building Tk if
Examples your X11 installation is in a non-standard location.
If you only have one platform, simply run config-
ure in the unix (or win) directory:
Finding a working compiler
% cd /usr/local/src/tcl8.2/unix
% ./configure flags As the configure script executes, it prints out mes-
Use ./configure to ensure you run the configure sages about the properties of the current platform.
script from the current directory. If you build for You can tell if you are in trouble if the output con-
multiple platforms, create subdirectories of unix tains either of these messages:
and run configure from there. You are free to cre- checking for cross compiler ... yes
ate the compilation directory anywhere (some pre- or
fer to keep all the generated files away from the checking if compiler works ... no
sources.) Here we just use a subdirectory of the unix Either of these means configure has failed to find
directory: a working compiler. In the first case, it assumes you
% cd /usr/local/src/tcl8.2/unix are configuring on the target system but will cross-
% mkdir solaris
% cd solaris
compile from a different system. Configure pro-
% ../configure flags ceeds bravely ahead, but the resulting Makefile is
useless. While cross-compiling is common on library will be installed in:
embedded processors, it is rarely necessary on /home/welch/install/bin/tclsh8.2
UNIX and Windows. The cross-compiling message /home/welch/install/lib/libtclsh8.2.so
typically occurs when your UNIX environment The script libraries and manual pages will be
isn’t set up right to find the compiler. installed in:
/home/welch/install/lib/tcl8.2/
On Windows there is a more explicit compiler
/home/welch/install/man/
check, and configure exits if it cannot find the
compiler. Currently, the Windows configure macros If you want to have installations for several differ-
knows only about the Visual C++ compiler. VC++ ent platforms, then specify an --exec-prefix that
ships with a batch file, vcvars32.bat, that sets up is different for each platform. For example, if you
the environment so you can run the compiler, cl, use --exec-pre-
fix=/home/welch/install/solaris, then the
from the command line. You must run
tclsh8.2 program and libtcl8.2.so shared
vcvars32.bat before running configure, or set up
your environment so you do not have to remember library will be installed in:
/home/welch/install/solaris/bin/tclsh8.2
to run the batch file all the time.
/home/welch/install/solaris/lib/libtclsh8
.2.so
Installation Directories The script libraries and manual pages will remain
where they are, so they are shared by all platforms.
The --prefix flag specifies the main installation Note that Windows has a slightly different installa-
directory (e.g., /home/welch/install). The direc- tion location for binary libraries (i.e., DLLs). They
tories listed in Table 2 are created under this direc- go into the exec_prefix/bin directory along with
tory. If you do not specify --exec-prefix, then the the main executable programs.:
platform-specific binary files are mixed into the
main bin and lib directories. For example, the
tclsh8.2 program and libtcl8.2.so shared
Future Directions
The short term goal of TEA is to provide a standard
way to build Tcl extensions. We have created a
sample extension for others to learn from, and we
have been converting the widely used [incr Tcl],
Expect, and TclX extensions to adhere to the stan-
dard.
The long term goal of TEA is to make distributing
and installing Tcl extensions easy for the end user.
We envision a system where open source extensions
can be hosted in a common CVS repository, built
automatically on a variety of platforms, and distrib-
uted to end users and installed automatically on
their system. For this goal to succeed, we need to