Tcl-(of)-my-fancy Tom Poindexter tpoindex@nyx.net Version 3.0, March, 1998 Tcl-my-fancy is public domain. You can do anything with it, to it, or for it. **** NOTE: Tcl-my-fancy was formerly called Make-A-Wish. The Make-A-Wish Foundation of America holds a trademark to the name "Make-A-Wish", and have asked that I discontinue the use their trademark. My apologies for any confusion. **** Tcl-my-fancy is available at: http://www.neosoft.com/tcl/ftparchive/sorted/devel/tcl-my-fancy-3.0.tar.gz ftp://ftp.neosoft.com/pub/tcl/sorted/devel/tcl-my-fancy-3.0.tar.gz WHAT IS TCL-MY-FANCY? Tcl-my-fancy is a simple shell script and makefile that tries to aid in creating Tcl/Tk interpreters with various extensions. Interpreters made by Tcl-my-fancy are statically linked. If you want to make interpreters that use dynamically loadable libraries, you should configure and build your Tcl, Tk, TclX, and extensions with the configure option "--enable-shared". CHANGES 1.1 - Add option of specifing an alternate main(), or explicitly link the correct main() from source directories. Changed link order so that all extensions are searched first, followed by TclX/Tk/Tcl libraries. Two sed scripts are now created, one for tclMain.c, another for tkMain.c. 1.2 - Add "-follow" options to maw-configure "find" to chase sym links. Ensure that neither executable target is null. Add special case files to support Tcl-DP and TclX - Makefile.xdp, tkXDPmain.c, tkXDPAppInit.c. 1.3 - Don't "-follow" for 'find' if not supported. Check for Sys V.4 'nm' output. Support for Tcl7.4, TclX7.4a, and Tk4.0. Remove handling of tclMain.o, et.al., as main() is now part of the AppInit.c file. Remove special case handling of TclX w/ Tcl-DP. 2.0 - New name! Nothing else has changed. 3.0 - Fix to work with Tcl 8.0+ directory structures. Deal with two or more Init functions found. TclX directory structure searched according to TclX8.x. Make sure library list from find is sorted in reverse chronological order (ls -t). Make sure Init prompt gets something. USING TCL-MY-FANCY Tcl-my-fancy assumes that Tcl/Tk, and possibly Extended Tcl (TclX) has already been configured, built, and installed. Tcl-my-fancy looks for Tcl/Tk/TclX include files, libraries, and object files in the source directories. Don't "make clean" in those directories until after you've used Tcl-my-fancy. Tcl-my-fancy does not build each individual extension. You will have to build each extension following the instructions in each package. Tcl-my-fancy assumes that extensions build a libxxx.a file that contains the extension's code. Also, if a particular extension needs Tcl library code installed, you'll have to do that also. Tcl-my-fancy only looks for, and links in, libraries built as '.a' libraries. It won't find any shared libraries, '.so', '.sl', etc. Another important assumption is that all Tcl, Tk, TclX, and extensions are located in sibling directories to Tcl-my-fancy. For example: src/tcl/ tcl8.0/ tk8.0/ tclX8.0.2/ tcl-my-fancy-3.0/ oratcl-2.5/ sybtcl-2.5/ (etc) Run the shell script "tmf-configure" (or simply "make"). Tcl-my-fancy asks whether you want to build standard or Extended Tcl, and whether you want to build a tclsh/tcl (no Tk), wish/wishx (with Tk), or both. You will also be asked to supply names for the resulting interpreters. Tcl-my-fancy will then find every libxxx.a file in its parent directory and siblings. You will then be asked to identify the Tcl/Tk directories, and possibly the Extended Tcl directories and libs libtclx.a and libtkx.a For all other libraries found, Tcl-my-fancy will ask if the library contains a Tcl/Tk extension you want to add. When you select a library, Tcl-my-fancy tries to find the name of the extension's Init function. If an Init function can't be found, or is wrong, enter the name of the Init function. Most current extensions use "xxx_Init", where "xxx" is the name of the extension package. Tcl-my-fancy will ask for any additional libraries that might be needed by any extension. Again, check each extension you are adding for details. The main() function is supplied by the xxAppInit.c file. Finally, Tcl-my-fancy will build sed scripts to be used by the makefile, and two other make include files. You should review the files before trying make. If all looks reasonable, try "make". The Makefile will copy the appropriate tcl*AppInit.c file, apply the sed script to add the calls to Init functions, compiles, and then links tclMain.o and tcl*AppInit.o with all the Tcl, Tk, (TclX), and extensions. All extension libraries are searched before standard Tcl, Tk, and TclX libraries. If all goes well, you'll get the interpreters for which you asked. The Tcl-my-fancy Makefile doesn't have an "install" target (well it does, but it doesn't do anything useful.) You will have to copy or install into whatever directory you want, say /usr/local/bin. To clean up, "make clean" will delete the compiled main files (*.o), any interpreters you may have built, and resets the default make target to run tmf-configure. CAVEATS Tcl-my-fancy is not "rocket science" and is relatively stupid. If you try to add Tk extensions to a non-Tk interpreter, the make will likely fail. Neither does Tcl-my-fancy know which versions of extensions go with particular versions of Tcl/Tk. You will have to know those details in advance. You might have to run tmf-configure twice to get both tclsh and wish interpreters, first time building a wish with the Tk extensions, then again to build tclsh without Tk extensions. Extensions that want to use their own main() are likely to be problematic when trying to build an Extended Tcl interpreter, unless the extension developer includes a TclX compatible main(). Other things can go wrong; Murphy's Law applies. At worst you're no worse off than without Tcl-my-fancy ;-) Due to differences in 'find' and 'nm' programs between different platforms, Tcl-my-fancy might have difficulty finding extensions' Init function, or may just fail. You might have to tweak the 'nm | awk' pipeline at line 344 to get it to work right. Prior versions of Tcl-my-fancy tried to provide special handling when combing Extended Tcl and Tcl-DP. This version has dropped special support. "Now Tom, if Tcl-my-fancy is for Tcl, why did you write tmf-configure in /bin/sh?" Tom sez: "Well, it started as something very simple and didn't assume that tclsh or tcl was installed correctly. One can generally count on /bin/sh. Tcl-my-fancy began as the Makefiles for my Sybtcl and Oratcl extensions and borrow on how I did things there. And of course, conversion to a good shell language like Tcl is left as an exercise for the user :-)"