Find TCL headers and libraries in Debian and FreeBSD

Problem. You want to compile a software against TCL. You run ./configure, but it can’t find it. You so need to locate where are the headers and the libraries.

Solution.

Start with the TCL version.

On Debian:

  • headers are in a subdirectory in /usr/include, named tcl followed by the version
  • libraries are sorted by architecture, dpkg-architecture can give the right one.

On FreeBSD:

  • headers are also in a subdirectory in /usr/local/include, also named tcl followed by the version
  • libraries are in /usr/local/lib at expected place, but named by the version without any dot (e.g. libtcl86 for TCL 8.6).

Here a sample from a build script we use on Eglide:

TCL_VERSION=8.6

#   -------------------------------------------------------------
#   Configure step
#
#   This is the tricky part, as we need to provide path to TCL
#   header and library files, heavily OS/distro/arch dependant.
#   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

if [ -f /etc/debian_version ]; then
    ARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH`
    ./configure --with-tclinc=/usr/include/tcl${TCL_VERSION}/tcl.h --with-tcllib=/usr/lib/$ARCH/libtcl${TCL_VERSION}.so --with-tcl=/usr/lib/$ARCH/tcl${TCL_VERSION}
elif [ `uname` = "FreeBSD" ]; then
    TCL_VERSION_LIB=`echo $TCL_VERSION | tr -d .`
    ./configure --with-tclinc=/usr/local/include/tcl${TCL_VERSION}/tcl.h -with-tcllib=/usr/local/lib/libtcl${TCL_VERSION_LIB}.so --with-tcl=/usr/local/lib/tcl${TCL_VERSION}
else
    ./configure
fi

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.