[GRASS5] Re: [GRASS-CVS] CVS update: grass

Glynn Clements glynn.clements at virgin.net
Thu Aug 2 21:43:20 EDT 2001


Markus Neteler wrote:

> I tried the updated configure and ran into a few troubles:
> 
> My new system is Redhad 7.1 with tcl/tk 8.3 present. However, configure
> doesn't detect it:
> 
> ls /usr/include/tk.h
>  /usr/include/tk.h
> ls /usr/include/tcl.h
>  /usr/include/tcl.h
> (version 8.3)
> 
> The libs are also there:
> ls /usr/lib/libtcl
>  libtcl8.3.so     libtclstub8.3.a  libtclx8.2.so
>  libtcl.so        libtclx8.2.a     libtclx.so
> ls /usr/lib/libtk
>  libtk8.3.so     libtkstub8.3.a  libtkx8.2.so
>  libtk.so        libtkx8.2.a     libtkx.so
> 
> If running simply
>  configure
> on the same machine:
> checking for location of Tcl/Tk libraries...
> checking for Tcl_Init in -ltcl... yes
> checking for Tk_MainWindow in -ltk... no
> checking for Tk_MainWindow in -ltk8.3... no
> checking for Tk_MainWindow in -ltk... (cached) no
> checking for Tk_MainWindow in -ltk8.3... (cached) no
> checking for Tk_MainWindow in -ltk... (cached) no
> checking for Tk_MainWindow in -ltk8.3... (cached) no
> configure: warning: *** Unable to locate Tk library.

What does config.log say? 

The appearance of "(cached)" seems suspicious. The checks in question
are:

AC_CHECK_LIB(tk, Tk_MainWindow, TCLTKLIBS="$TCLTKLIBS -ltk", [
AC_CHECK_LIB(tk$tcltk_ver, Tk_MainWindow, TCLTKLIBS="$TCLTKLIBS -ltk$tcltk_ver", [
LDFLAGS="$LDFLAGS $X_LIBS"
AC_CHECK_LIB(tk, Tk_MainWindow, TCLTKLIBS="$TCLTKLIBS -ltk", [
AC_CHECK_LIB(tk$tcltk_ver, Tk_MainWindow, TCLTKLIBS="$TCLTKLIBS -ltk$tcltk_ver", [
LDFLAGS="$LDFLAGS $DLLIB"
AC_CHECK_LIB(tk, Tk_MainWindow, TCLTKLIBS="$TCLTKLIBS -ltk", [
AC_CHECK_LIB(tk$tcltk_ver, Tk_MainWindow, TCLTKLIBS="$TCLTKLIBS -ltk$tcltk_ver", [
    AC_MSG_WARN([*** Unable to locate Tk library.])
])])])])])])

It tries each of -ltk and -ltk<version> three times; once with no
additional libraries, once with the X libraries, and once with X
libraries and libdl.

However, it appears to be caching the fact that both -ltk and
-ltk<version> failed the first time, and not actually performing the
last two sets of checks.

I'll see if I can disable caching altogether (it seems that defining
AC_CACHE_{LOAD,SAVE} to null only prevents results from being cached
between configure runs, but not within a run).

If not, this can be worked around by only using the third case, but
this may complicate the link command unnecessarily.

> If running 
> configure --with-tcltk-includes=/usr/include
> 
> checking for location of Tcl/Tk includes... /usr/include
> configure: warning: *** Tcl/Tk includes directory /usr/include does not exist.
> checking for tcl.h... yes
> checking for tk.h... yes

OK, so configure appears to be finding tk.h without being told (which
it should, as it's in the compiler's default include path).

> checking for location of Tcl/Tk libraries...
> 
>  -> huh?

Bug in configure.in, line 496. A fix should have been committed by the
time you receive this message.

> -> the head file doesn't contain entries for TCLINCDIR, TKINCDIR and
> TCLTKLIBPATH.

Do you mean that the variables are set to an empty string? They should
be; the headers are in the compiler's default include path, so no -I
switch is required, and the libraries are in the linker's default
library path, so no -L switch is required.

> Generally I think the 5.0.0 should be released these days, but
> above (new) bug should be fixed as 5.1 won't be available for some
> time.
> 
> Testing on SUN I get:
> checking for location of Tcl/Tk includes... /usr/local/include
> configure: warning: *** Tcl/Tk includes directory /usr/local/include does
> not exist.

Same bug as mentioned above.

> checking for tcl.h... yes
> checking for tk.h... yes
> checking for location of Tcl/Tk libraries... /usr/lib
> checking for Tcl_Init in -ltcl... no
> checking for Tcl_Init in -ltcl8.0... yes
> checking for Tk_MainWindow in -ltk... no
> checking for Tk_MainWindow in -ltk8.0... yes

OK; this indicates that libtk doesn't need any -L switch or for any
additional libraries to be specified explicitly.

> Looks better but not perfect as the SUN head file finally contains:
> #tcl/tk stuff
> TCLINCDIR           =
> TKINCDIR            =
> TCLTKLIBPATH        = -L/usr/lib
> TCLTKLIBS           = -ltcl8.0 -ltk8.0

Note: a "perfect" result would be something like:

TCLINCDIR           =
TKINCDIR            =
TCLTKLIBPATH        = 
TCLTKLIBS           = -ltcl8.0 -ltk8.0

The presence of "-L/usr/lib" suggests you added an explicit
--with-tcltk-libs switch, which shouldn't be necessary.

If the compiler and/or linker searches a particular directory
automatically, that directory shouldn't appear in any -I or -L
switches.

On my RH6.2 system, everything except the PostgreSQL headers are in
the default search paths, so my configure command is:

./configure  --prefix=/opt --bindir=/usr/local/bin --with-postgres-includes=/usr/include/pgsql

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list