\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#203: Create tclConfig.sh-Equivalent in Tcl}
\date{June 17, 2004}
\author{Colin McCormack, Don Porter, Colin McCormack}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#203}&\textbf{Create tclConfig.sh-Equivalent in Tcl}\\\hline
Author&

Colin McCormack \tipmail{coldstore}{users.sourceforge.net}
\par
Don Porter \tipmail{dgp}{users.sf.net}
\par
Colin McCormack \tipmail{colin}{sharedtech.dyndns.org}
\\
Created&Thursday, \(\text{17}^{\text{th}}\) June 2004\\
Type&Project\\
Tcl Version&\(8.5\)\\
State&Withdrawn\\
Vote&Pending\\
Version&\tipversion$Revision: 1.11 $\\
Keywords&configuration, installation\\
Post History&\\
Discussions To&http://mini.net/tcl/tclConfig.sh\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This proposal requires the registration of information about the built process, currently stored in tclConfig.sh, by means of the Tcl\_RegisterConfig mechanism set out in [Tip 59].
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

Packages such as Critcl[\url{http://www.equi4.com/critcl.html}], and indeed anything written in pure tcl which tries to build extensions under Tcl need more introspection to discover the ground rules of construction in the installation in which they find themselves.

In order to facilitate such future build tools, the build information should be made available to Tcl scripts.

\section{Specification}

Every variable defined in the unix tclConfig.sh should be registered using \textbf{Tcl\_RegisterConfig}, with the following exceptions:
\begin{itemize}
\item{}
TCL\_VERSION and similar redundant version, patch level information.
\item{}
TCL\_THREADS --- redundant.
\item{}
TCL\_BUILD\_* --- nothing specifying the build directory.
\end{itemize}

Because Windows and other platforms don't have a tclConfig.sh, the following fields are desirable for hand construction: -{}-{}-{}- \textbf{Compilation:} * TCL\_CC \# C compiler to use for compilation.
\begin{itemize}
\item{}
TCL\_DEFS \# -D flags for use with the C compiler.
\item{}
TCL\_INCLUDE\_SPEC \# String to pass to the compiler so that an extension can find installed Tcl headers.
\item{}
TCL\_LIB\_FILE \# The name of the Tcl library
\item{}
TCL\_LIBS \# Additional libraries to use when linking Tcl.
\item{}
TCL\_SHLIB\_CFLAGS \# Flags to pass to cc when compiling the components of a shared library:
\item{}
TCL\_CFLAGS\_WARNING \# Flags to pass to cc to get warning messages
\end{itemize}
\begin{description}
\item[* TCL\_EXTRA\_CFLAGS \# Extra flags to pass to cc]
-{}-{}-{}- \textbf{Linking:}
\end{description}
\begin{itemize}
\item{}
TCL\_SHLIB\_LD \# Base command to use for combining object files into a shared library:
\item{}
TCL\_SHLIB\_LD\_LIBS \# dependent libraries should be included when linking shared libraries
\item{}
TCL\_SH LIB\_SUFFIX \# Suffix to use for the name of a shared library.
\item{}
TCL\_LD\_FLAGS \# Flags to pass to the compiler when linking object files into an executable tclsh or tcltest binary.
\item{}
TCL\_COMPAT\_OBJS \# Additional object files linked with Tcl to provide compatibility with standard facilities from ANSI C or POSIX.
\item{}
TCL\_LIB\_FLAG \# -l flag to pass to the linker to pick up the Tcl library
\item{}
TCL\_LIB\_SPEC \# String to pass to linker to pick up the Tcl library from its installed directory.
\end{itemize}

-{}-{}-{}- \textbf{Stub Support:}
\begin{itemize}
\item{}
TCL\_SUPPORTS\_STUBS \# Tcl supports stub.
\item{}
TCL\_STUB\_LIB\_FILE \# The name of the Tcl stub library (.a):
\item{}
TCL\_STUB\_LIB\_FLAG \# -l flag to pass to the linker to pick up the Tcl stub library * TCL\_STUB\_LIB\_SPEC \# String to pass to linker to pick up the Tcl stub library from its installed directory. * TCL\_STUB\_LIB\_PATH \# Path to the Tcl stub library in the install directory. -{}-{}-{}-
\end{itemize}

\section{Comments}

How about converting this proposal into a proposal listing the values found in \textit{tclConfig.sh} and proposing that Tcl should pass those values into \textbf{Tcl\_RegisterConfig} during initialization? That would make all the values available to scripts via the \textbf{::tcl::pkgconfig} command. -{}- Good idea. Done.

Several of the assigned values in tclConfig.sh contain references to other variables --- should these be reproduced verbatim, or evaluated prior to registration? I'm leaning toward verbatim storage: let the people who need the data construct an evaluation which serves their purposes because (a) the form is easy enough to evaluate, as in the parser I threw together [\url{http://mini.net/tcl/tclConfig.sh}], (b) there might be information in the verbatim form which needs to be preserved. Comments welcome.

\section{Withdrawal}

Joe English points out that those parts potentially useful to a pure-tcl builder are not necessarily applicable, since the build and installation machines may/will differ substantially, and that those parts universally applicable are available via some combination of info and ::tcl::pkgconfig. Given this insight, I withdraw this TIP.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
