itkwish
:
This page discusses the mechanism behind building and installing Tcl
extensions.
To build and install all the Tcl extensions, set the PTARCH
environment
variable. This variable is used to differentiate between different
architectures. To set the PTARCH
variable,
under /bin/csh
, do:
setenv PTARCH `$TYCHO/bin/ptarch`To do the build:
cd $TYCHO make tclexts
Tycho uses GNU autoconf to configure the Tcl extensions.
$TYCHO/makefile
has a rule that calls configure
and builds the proper directories.
configure
has a number of options, type
$TYCHO/src/configure -help
to see them. To pass options to
configure
, set the CONFIGURE_ARGS
option.
The tclexts
makefile rule configures, builds and installs
all the tcl extensions. Below we discuss each step in turn:
config_tclexts
$TYCHO/obj.$PTARCH
and then runs
configure
, which creates the makefiles
below
$TYCHO/obj.$PTARCH
.
all_tclexts
$TYCHO/obj.$PTARCH
and builds
all the binaries.
install_tclexts
$TYCHO/obj.$PTARCH
and installs
the shared libraries into $TYCHO/lib.$PTARCH
$TYCHO/makefile
is setup to support multiple architectures
by creating separate lib.$PTARCH
and obj.$PTARCH
directories. It is possible to
call configure
directly and create binaries in
$TYCHO/src
, but there are the following problems:
$TYCHO/lib.$PTARCH
directory is not
built automatically, you would need to do something like:
cd $TYCHO/src configure mkdir ../lib.$PTARCH make install
$TYCHO/src/tcl.mk
was configured for our local installation and are unlikely to work
for you. To rebuild these files, run configure
.
$TYCHO/obj.$PTARCH/tcl.mk
to be present.
configure.in
which autoconf
converts to a configure
script.
The user runs configure
which examines the operating
systems for idiosyncrasies and then reads in the makefile.in
template file and produces
a makefile
. The user can then run make
and
compile and install the package.
The user need not have autoconf
installed to run
configure
. The autoconf
package need only
be present if the user wishes to modify configure.in
and
produce a new configure
file. If autoconf
is not available, then it is possible to edit the configure
file directly; it is merely a /bin/sh
script.
In Tcl7.5 and later it is fairly easy to load shared objects that
add new Tcl commands. The Tcl load
and
package
command man pages cover the details.
The general overview is that C code is compiled with special flags
to build a shared object. The special flags are compiler and
architecture dependent, configure
determines these flags
by reading the tclConfig.sh
file located in the
architecture dependent Tcl library directory.
The shared object has an architecture-dependent file extension,
such as .so
under Solaris 2, and .sl
under
HPUX. To see what the extension is on your system, start up
tclsh
or itkwish
and run info sharedlibextension
.
When the file is loaded by Tcl, a C initialization procedure is
called by Tcl. The name of the procedure depends on the name of the
package or file that is being loaded, see the Tcl load
command documentation. Usually, this procedure is used to create new
Tcl commands that call user-supplied C procedures.
If you use Tycho to open a file with the sharedlibextension
then Tycho passes that file to the Tcl load
command.
$TYCHO/makefile
tclexts
rule which
configures, builds and installs the extensions. This file is
described above in more detail.
$TYCHO/src
$TYCHO/obj.$PTARCH
$TYCHO/lib.$PTARCH
src/configure.in
autoconf
uses to
create src/configure
.
src/configure
src/makefile.in
makefile
is generated.
mk/tcl.mk.in
obj.$PTARCH/tcl.mk
.
$TYCHO/src
for your extension.
$TYCHO/src/configure.in
and add the makefile to the AC_OUTPUT()
macro.
$TYCHO/makefile
rules should automatically run
autoconf
and update src/configure
.
$TYCHO/src/makefile.in
and add your extension directory to the DIRS
macro.
makefile.in
from another directory, such as
src/tytimer/makefile.in
to the directory for your extension.
makefile.in
appropriately.
makefile.in
of your extension to $TYCHO/makefile
so that when
others run make sources
, your makefile will be retrieved
from version control.
cd $TYCHO make tclexts