TR I have an application using BLT that runs on Linux, Windows, and MacOS X (the X11 version of Tcl, since BLT is not ported to Aqua). That worked great ... until the time, when I decided to use Tile, because it was so beautiful and had some widgets I wanted to use. Then the problem came for MacOS X ...
Currently (Sept. 2006), only the ActiveTcl distribution comes with Tile. But it comes without BLT. The TclTkAquaBI comes with BLTlite only and without Tile. The preinstalled Tcl/Tk on MacOS X Tiger comes without both. So only the fink and DarwinPorts projects have Tcl/Tk and BLT that work together.
I never succeeded in compiling BLT for the Mac on any of these distributions on my own (i.e. from source). There are evidently some patches needed. So the only way to go, at least for me, was to get the distribution that supported BLT (without the need to compile it manually) and allowed Tile to be used additionally.
In order to use Tile, you need a fairly recent Tk, something newer that 8.4.6 or so. The fink project has stable versions of 8.4.1 so this would not work and I didn't want to try and get unstable versions. Further, fink's BLT package seems to have no maintainer. I therefore decided to use DarwinPorts (now called MacPorts) which comes with a very recent 8.4.12 version of Tcl/Tk. And it has a BLT package. An additional "advantage" of using MacPorts was that the complete MacPorts system is built using Tcl so there is hope that the Tcl package will always be a good one and actively maintained.
The obvious step was to just compile Tile (I used version 0.7.6 here) for the Mac and then be finished. But this turned out to be not so straightforward. But now, after some months of trying around and some hints from the Tcl chatroom (Thanks a lot, you guys!!), it all boiled down to the following advice:
Never mix distributions and/or versions
Compiling Tile requires a private Tk header file (tkInt.h). This is not included in MacPorts' distribution. It will not be very helpful to install ActiveTcl on the Mac and use it's headers, because you cannot really specify the location for private header files on the command line of the configure script (these are here for ActiveTcl: /Library/Frameworks/Tk.framework/PrivateHeaders/). The solution was to get the source distributions of Tcl and Tk off sourceforge (exactly same version as the installed one by MacPorts, i.e. 8.4.12) and do a standard configure on both of them:
This will produce the two files tclConfig.sh and tkConfig.sh that are required to compile Tile. These files will also contain the paths of the private header files contained in the sources which you need for comiling Tile. Be aware that you can just go into the unix directory of the Tcl and Tk sources and call configure there. There is no configure script in the macosx directory but only a Makefile. This is just a wrapper around the unix configure (says the provided REAMDE).
There is one more thing. In order to get a good result from configure, you should also fetch the XFree86 package that is shipped with MacPorts, because Tk's configure will look for X11.
Don't expect the Tile configure script to find these Tcl sources on it's own. Just doing
in the 'generic' folder of the Tile sources (using Joe's build system) will result in an odd folder named /Users/andreask and many subfolders where Tile will be installed into and it is likely that you can't build Tile at all. You need to specify exactly where you have the required files, and where you want to have Tile installed into, else you will not get what you want. Especially, do not rely on what './configure --help' is telling you about the locations of --prefix and --exec-prefix but specify both manually. You will need these options:
Here is what I did in my configuration:
./configure --prefix=/Users/Torsten/Tcl/packages/tile --exec-prefix=/Users/Torsten/Tcl/packages/tile --with-tcl=/Users/Torsten/Tcl/distrib/tcl8.4.12/unix/ --with-tk=/Users/Torsten/Tcl/distrib/tk8.4.12/unix/
After 'make' and 'sudo make install' I had a working Tile for MacPorts Tk package that could be used by adding the tile folder to 'auto_path':
lappend auto_path /Users/Torsten/Tcl/packages/tile/lib
Note, that the 'aqua' theme is not available here, perhaps because MacPorts' Tk is X11 only?
What is on my wish list?
It would have been simple if BLT shipped with ActiveTcl. Since the MacPort people can provide BLT and obviously successfully patched the BLT sources to compile happily, I would image that it must be simple enough to adapt the stuff to ActiveTcl's requirements. Here is the pointer:
hotfoot 24Sep12 I encountered the same problem with the private tkInt.h header file when attempting to build Tile, but solved the problem in a somewhat different way.
First of all, I should note a few differences between my situation and Torsten's:
So, in my environment, the preinstalled Tcl/Tk stuff lives under the /System/Library/Frameworks directory, in directories called Tcl.framework and Tk.framework, respectively. Each of these directories has a 'PrivateHeaders' directory, and the configure script knows about the "framework" arrangement and the PrivateHeaders directories.
However, the configure script is written to detect the framework arrangement by finding the strings TCL_FRAMEWORK and TK_FRAMEWORK embedded in the environment variables TCL_DEFS and TK_DEFS, which are defined by the tclConfig.sh and tkConfig.sh scripts, respectively. And on my system, for whatever reason, these flags were not defined in those variables.
So I put 'em in! In a different shell from the one in which I'm trying to build Tile:
% su Password: <my root password> # cd /System/Library/Frameworks/Tcl.framework/Versions/Current # mv tclConfig.sh tclConfig.sh.bak # cp tclConfig.sh.bak tclConfig.sh # vi tclConfig.sh
...and add the flag -DTCL_FRAMEWORK=1 to the flags in TCL_DEFS
# cd /System/Library/Frameworks/Tk.framework/Versions/Current # mv tkConfig.sh tkConfig.sh.bak # cp tkConfig.sh.bak tkConfig.sh # vi tkConfig.sh
...and add the flag -DTK_FRAMEWORK=1 to the flags in TK_DEFS
Now, back in the original shell, run: ./configure ; make ; make install, and the build completes!
So much less of a pain than trying to find and download the source to 8.4.7 -- which, if Apple's reputation for regularly having its way with Python is any hint, might not match the preinstalled source anyway!
I had originally intended to remove the modified .sh files and restore the backups (i.e., mv them back to their original names), but since these files exist specifically to inform the configure scripts of Tcl/Tk extensions, which likely use the same logic to detect the framework setup, I decided to leave them. (If this proves problematic down the line, I'll come back and post an update.)
Hope this helps someone, someday. Torsten's original post certainly helped me -- six years later!