Tim,
On 2004 Jul 9 , at 05.05, Tim Jenness wrote:
> 2. Why isn't TCL_CFLAGS added to CFLAGS automatically?
> I ended up having to use
>
> AM_CFLAGS = @TCL_CFLAGS@
>
> which seemed a bit redundant and not the normal autoconf
> way. Is the worry that not all files will want to include
> tcl.h path?
It's that way because AC_PATH_XTRA (checking for X libraries) is that
way, and I felt that consistency was more important than magic. I did
originally have these added toC FLAGS and LIBS automatically, but
changed it, partly for consistency, but also so that you could control
where in the library list the tcl libraries appeared.
Also I wouldn't underestimate the value of feeling in control. I find
autoconf/automake occasionally unsettling, because I'm not always
completely sure _why_ things are working (presuming that they are), and
therefore what I have to do to avoid breaking them. At least if I know
I've explicitly added TCL_CFLAGS and TCL_LIBS somewhere, I know why Tcl
is being found.
> 3. TCL_LIBS does not include the actual libtk library!!!
> So I have to add -ltk to the LDADD line. I can understand
> this since you don't always want to include libtk with a tcl
> build. Is there meant to be a TK_LIBS variable for the tk library?
> I suppose that is the reason why you don't add TCL_LIBS to the
> lib path automatically? AC_PATH_XTRA adds the -L path to the
> LDFLAGS
> automatically doesn't it?
Ooops. No, no reason other than me forgetting. Fixed now, so that
TCL_LIBS now includes
"$TCL_LIB_SPEC $TK_LIB_SPEC $TK_XLIBSW"
(which are "-L/opt/local/lib -ltk8.4 -L/usr/X11R6/lib -lX11" in
/opt/local/tclConfig.sh and /opt/local/tkConfig.sh on my machine).
There seem to be no Tk-specific include options in the tkConfig.sh --
ought I to be surprised? Is it correct to include the X link here, do
you think?
Incidentally, is there any occasion where we'd want just the Tcl
libraries and not the Tk ones (or indeed vice versa)? At present,
STAR_PATH_TCLTK won't accept a location which has Tcl present but not
Tk, which would be a pest if what you actually wanted was just Tcl.
> 4. It's still annoying that /sw/ is not in the default path on
> mac. Initially libjpeg could not be found. I still can't see how
> it would hurt anything if that path was on all the search paths.
> :-)
It should be on the path (I spotted that AC_PATH_XTRA includes a
smattering of platform-specific paths in its search list, so have taken
that as licence to do the same in STAR_PATH_TCLTK). The list of
locations searched for tclsh is: the path given on the --with-tcl
option, the paths in the $PATH, and then /usr/bin, /usr/local/bin,
/opt/local/bin, /sw/bin (are there any others I could add there?).
Ah, you mean generally? I really don't plan to add that to the
Starlink autoconf stuff, because there's simply no such path in there
already, so adding it would involve redesign of AC_CHECK_LIB. This
sort of thing is a compiler/linker detail, and its the linker's own
search path that the autoconf macro piggybacks on, so the linker's own
interface for changing this path is what should be used. For example,
I have /opt/local/lib/scsh/libscsh.a installed, and if I configure with
AC_INIT(try)
AC_CONFIG_SRCDIR(configure.ac)
AC_CHECK_LIB(scsh, s48_main)
AC_CONFIG_FILES(conftry)
AC_OUTPUT
and run ./configure, it can't find it. If, however, I do
% export LIBRARY_PATH=/opt/local/lib/scsh
% ./configure
then the test works, and -lscsh is added to @LIBS@ (but no -L option,
note). LIBRARY_PATH is documented within OSX gcc as holding a list of
library directories to be added to the search path, after -L libraries,
but presumably before the built-in detault path. This is just as
LD_LIBRARY_PATH is used on Linux. So I think what OSX folk should do
is simply define LIBRARY_PATH=/sw/lib or /opt/local/lib in .bashrc
scripts, and everything should work.
Norman
--
----------------------------------------------------------------------
Norman Gray / http://www.astro.gla.ac.uk/users/norman/
Physics & Astronomy, Glasgow University, UK /
http://www.starlink.ac.uk
|