Converting your Tcl extension to TEA2


Provide a developer with tips, suggestions and warnings regarding implementing a Tcl extension using the TEA 2000 guidelines. Note that TEA is actually at TEA 3.2 as of this writing, but as noted below, TEA versioning is not like standard Tcl versioning.

Why bother?

See the TEA philosophy [L1 ].

Where is TEA2 documented?

See link above. (Note: The link above describes TEA 1 -- barely.)

TEA2 isn't really documented in the conventional sense of the term. There are extensive comments in tcl.m4, and the sampleextension gives a mostly-accurate blow-by-blow of what's going on, but other than that it's mostly folklore and bits gleaned from the Wiki.

What needs to be done to move a TEA1 extension to TEA2?

The easiest thing to do is compare your current extension with the sampleextension, as the differences are not major. SC_ macros are now all TEA_, and you should actually be able to remove code from your and

What needs to be done to move a TEA2 extension to TEA3?

Again, compare with the latest sampleextension, which is the reference TEA extension. There was a simplification of autoconf macros used, and autoconf 2.5x is now required. The biggest change that affects is the ${pkgName}_* convention was dropped in favor of the simpler PKG_*. As these variables are not exposed in 99% of extensions, this simplifies the Makefile while also making it more robust.

What needs to be done to move a non-TEA extension to TEA2?

That really depends on what you start with, but TEA2 isn't so complex that looking at the sample shouldn't be mostly (if not fully) self-explanatory. There is a wealth of TEA2 extensions out there (SampleExtension, Tktable, itcl, TkDND, TclX, Expect, ...) which handle just about every possible build case.

What tools are available to help with TEA2?

In a c.l.t. posting [L2 ] Donal Fellows mentioned teapot [L3 ], the TEA extension help mate a script helping to create the , aclocal.m4 and for a TEA2 compliant extension.

DKF - Good. Someone noticed... :^)

What do you do when TEA2 changes or is fixed? Can you update your extension automatically?

Usually all that is required is simply copying the updated tclconfig/tcl.m4 (which is really all the macros in TEA2) and rerunning autoconf for your project.

Vince Why not bundle tclconfig/tcl.m4 with Tcl (and have Tcl install it too), then, so all this copying isn't necessary?... How does one find out if changes have been made? What is the definitive source of the correct 'tclconfig/tcl.m4'?

JH An extension writer can always track the sampleextension if they are interested in keeping up with the latest. A better mechanism is required, but simply tossing some checkpoint of tcl.m4 into the core may not be useful.

On what platforms can one use TEA2 - does it work on MacOS, MacOS X, VMS, Unix, Microsoft Windows, etc.?

All platforms Tcl builds for out-of-the-box are supported. This does not include VMS or MacOS 8/9, but TEA2+ correctly supports OS X, Unix/Linux, and Windows (including 64-bit and CE).

Can it build/install into paths containing spaces?

Yes it can, but the paths have to be quoted correctly and some peculiarities may happen. To install in C:/Program Files one has to invoke configure like this:

 ./configure --prefix="C:/Program\ Files"

Configure seems to look for a site script in C:/Program\ which is obviously incorrect, but has no negative consequences if no site script is used.

On Microsoft Windows, does the Mingw 3.x based compilers work with TEA2?

The latest mingw compiler should work with TEA2 on Windows for "regular" Windows platforms. The proper SDKs and Microsoft compilers are required for Windows 64-bit and Windows/CE.

Other TEA pages on this Wiki list dozens of bugs in TEA (on all platforms). Is it really worth using?

Until there is a working, accepted, usable alternative, TEA is the framework available for this type of thing. Many have verbally described possible alternatives - to date, none of the alteratives appear to be in use in major extensions.

JH The comments about TEA bugs that I have seen have often pointed to an incorrect use of TEA or a basic misunderstanding of TEA's purpose. The fact that TEA is used by all major Tcl extensions is evidence that it does indeed work correctly.