Prerequisites
* perl5.000
* tk3.6 library
* tcl library
* X11 library

These installation instructions assume that you are building perl5.000
and want to build the Tk extension at the same time, either as a static
extension linked into the perl executable or as a dynamically loadable
shared object separate from the perl executable but automagically loaded
at run-time. Either way, the perl command "use Tk;" makes the Tk extension
available in perl. It is possible to build the Tk extension in its
dynamically loadable form at a completely different time from building
perl itself, but there are yet no firm conventions in place for how
perl5 extensions "ought" to do this. For (very) brief instructions on
how to build the Tk extension sometime after perl5 has been built but
while the perl5 distribution kit is still in place, see the section
towards the end of this file. If you have simply unpacked the perl5
distribution and unpacked this distribution kit for the Tk extension
in its ext subdirectory, then read on.

The "./Configure then make" build process for perl5 will automatically
notice when an extension distribution has unpacked itself underneath the
ext directory. Provided this Tk distribution lives underneath ext/Tk,
you will just have to follow the build process for perl itself. Before
running ./Configure, there are a couple of things that you may have to
configure in the Makefile.SH supplied with the Tk extension:
(1) The value of tclincludeflag defined at the top of it may need to be
    changed to point to the path(s) where your Tcl and Tk header files
    can be found.
(2) If Perl's Configure can't find the location of the library files for
    libX11, libtcl and libtk (or it fails to find the correct/shared/static
    ones) then you may need to alter the definition of potential_libs.
    The perl build process uses the list of library paths and libraries
    therein to find the right libraries. Irrelevant ones are chopped off
    before the options are passed to a compiler/linker so adding paths
    where libraries *might* be is valid. If your libtk has been patched
    to include pixmap extensions then you may also need to add -lXpm to
    potential_libs (and its associated -L path if necessary).

Then prepare to build perl in the usual way by following the instructions
in perl's own README, i.e. start by running ./Configure. During the
./Configure session, you will be prompted for the list of extensions you
want to build along with perl. If your platform supports dynamic loading,
then Configure will offer to build Tk as a dynamically loadable extension.
If not, then it wil offer to build it as a static extension. In some
environments, it's possible that smaller extensions work successfully
as dynamic extensions but Tk doesn't. This is probably because Tk is
more complex than most of the other currently distributed extensions:
it uses more than one object file and has to resolve symbols against
already-existing libtcl and libtk libraries which may or may not be
shared libraries themselves. If you have trouble building the extension
dynamically, you can include Tk in the list of static extensions when
Configure prompts you instead of accepting the default lists of
dynamic and static extensions.


Known platform-specific gotchas

SunOS 4.1.* (reported on 4.1.3_U1 but may be present elsewhere)
    If perl's config.sh does not have lddlflags='-assert nodefinitions'
    then you will get many *harmless* warnings while building the Tk
    extension about not finding lots of libc symbols.

Linux (with Chip Salzenberg's dld for dynamic loading)
    The filename conventions for sharable objects under Linux (which
    are actually just ordinary .o and .a files at the moment) haven't
    yet settled down. To prevent dynamic loading errors you may well
    have to rename lib/auto/Tk/Tk.sa to .o and edit lib/auto/Tk/Tk.bs
    to change the paths to libtk, libtcl and libX11 from .sa extensions
    to .a instead.


The subdirectory t contains some test scripts and the file GUIDE
makes a start at explaining a bit about TkPerl. It's not yet in
perl's pod format for documentation--sorry.


Platforms known to work with tkperl5alpha4/perl5b1 (either with Tk as
a static extension or as a dynamic one):
(This list needs updating for tkperl5alpha5/perl5.0).
    OSF/1, 2.0B and 3.0
    Ultrix 4.4
    NeXT
    Solaris 2.3
    Linux
    SunOS 4


Building the Tk dynamic extension separately from perl itself.

As mentioned at the top of this file, these are *very* brief instructions
because no conventions are in place yet for how to do this for perl5
extensions. Basically, provided this Tk distribution still lives underneath
ext/Tk in the standard perl distribution, you should be able to go to the
ext/Tk directory, generate the Makefile using
    sh Makefile.SH
(which makes use of ../../config.sh to do its configuration) and then
    make dynamic
The shared object (usually Tk.so) will get placed in lib/auto/Tk/Tk.so
and needs to be moved to your real PERL5LIB/lib/auto/Tk/Tk.so.
The support files ext/Tk/lib/* will also need copying into PERL5LIB.
If you build the extension this way make *sure* that libtk wasn't linked
in to the perl executable when perl was built. If it was, then you may
find that functions and symbols redefined by TkPerl are being picked up
at run-time by resolving against the symbols from the perl executable
instead of from TkPerl's sharable object. The symptoms will probably be
that widgets are insensitive since the orginal libtk bind event
functions/variables are being used instead of the TkPerl ones.

Malcolm Beattie
19 October 1994
