Home > Archive > Tcl > May 2006 > "preferred" way of detecting Tcl with autoconf
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
"preferred" way of detecting Tcl with autoconf
|
|
| tang@jtang.org 2006-05-18, 7:10 pm |
| I am using autoconf to write a configure script. The script needs to
detect the installed versions of Tcl and Tk header files. The solution
I have is to take tcl.m4 from tcl$(version)/unix/tcl.m4, copy it into my
source directory, and then within my configure.in have:
SC_PATH_TCLCONFIG
SC_LOAD_TCLCONFIG
AC_MSG_CHECKING([for a compatible version of Tcl])
if test \( "${TCL_MAJOR_VERSION}" -gt 8 \) -o \( "${TCL_MAJOR_VERSION}"
-eq 8 -a "${TCL_MINOR_VERSION}" -ge 4 \); then
AC_MSG_RESULT(yes)
else
AC_MSG_ERROR([foo requires Tcl 8.4 or greater])
fi
Question 0: Is this the preferred way for doing versioning checking?
Question 1: Are there plans to create a tcl.pc and tk.pc for use with
pkg-config?[0] pkg-config seems to be the configure system of choice
for many other libraries.
[0] http://pkgconfig.freedesktop.org/wiki/
--
Jason Tang / tang@jtang.org / http://www.jtang.org/~tang
| |
| Jeff Hobbs 2006-05-19, 4:10 am |
| tang@jtang.org wrote:
> I am using autoconf to write a configure script. The script needs to
> detect the installed versions of Tcl and Tk header files. The solution
> I have is to take tcl.m4 from tcl$(version)/unix/tcl.m4, copy it into my
> source directory, and then within my configure.in have:
>
> SC_PATH_TCLCONFIG
> SC_LOAD_TCLCONFIG
> AC_MSG_CHECKING([for a compatible version of Tcl])
> if test \( "${TCL_MAJOR_VERSION}" -gt 8 \) -o \( "${TCL_MAJOR_VERSION}"
> -eq 8 -a "${TCL_MINOR_VERSION}" -ge 4 \); then
> AC_MSG_RESULT(yes)
> else
> AC_MSG_ERROR([foo requires Tcl 8.4 or greater])
> fi
>
> Question 0: Is this the preferred way for doing versioning checking?
If you need to do this at the configure level, this is a good way.
> Question 1: Are there plans to create a tcl.pc and tk.pc for use with
> pkg-config?[0] pkg-config seems to be the configure system of choice
> for many other libraries.
>
> [0] http://pkgconfig.freedesktop.org/wiki/
Noone has mentioned it before, but it's not a bad idea to auto-generate
it when building on unix.
Jeff
| |
| tang@jtang.org 2006-05-19, 10:02 pm |
| On my particular system (Debian / testing), the tcl.m4 macro only
exports TCL_INC_DIR and not TCL_INCLUDE_SPEC. This presents a major
problem because regex.h is in both $(TCL_INC_DIR) and /usr/include, and
I definitely need the latter. Why is TCL_INCLUDE_SPEC not exported by
tcl.m4? That seems to be the one I really need.
--
Jason Tang / tang@jtang.org / http://www.jtang.org/~tang
| |
| tang@jtang.org 2006-05-23, 7:07 pm |
| Continuing this thread on autoconf with Tcl:
0. On a stock Fedora Core 4 system on a 64-bit x86 system, tclConfig.sh
is found in /usr/lib64/. The SC_PATH_TCLCONFIG and SC_PATH_TKCONFIG
macros within tcl.m4 should look in that directory as well.
1. I want to install a new Tcl package given a particular make target;
this package should be loadable via a [package require] command. To
determine where to install that package, I wrote this Tcl script:
foreach path [concat $auto_path $tcl_pkgPath] {
if {[string match *share* $path]} {
break
}
}
puts $path
Is there anything glaringly wrong with this approach? (Yes, I could
have used [lsearch] as well. I wanted $path the contain the last
entry if *share* was not found.)
2. Does anyone else use / has anyone else tried to integrate autoconf
with Tcl?
--
Jason Tang / tang@jtang.org / http://www.jtang.org/~tang
| |
| Jeff Hobbs 2006-05-24, 4:14 am |
| tang@jtang.org wrote:
> Continuing this thread on autoconf with Tcl:
>
> 0. On a stock Fedora Core 4 system on a 64-bit x86 system, tclConfig.sh
> is found in /usr/lib64/. The SC_PATH_TCLCONFIG and SC_PATH_TKCONFIG
> macros within tcl.m4 should look in that directory as well.
There is a bug about this at SF - please add your comments to that.
> 1. I want to install a new Tcl package given a particular make target;
> this package should be loadable via a [package require] command. To
> determine where to install that package, I wrote this Tcl script:
>
> foreach path [concat $auto_path $tcl_pkgPath] {
> if {[string match *share* $path]} {
> break
> }
> }
> puts $path
>
> Is there anything glaringly wrong with this approach? (Yes, I could
> have used [lsearch] as well. I wanted $path the contain the last
> entry if *share* was not found.)
The TEA system has something for this already, based on how Tcl was
configured. Why reinvent the wheel? I'd default to [file dirname
$tcl_library].
> 2. Does anyone else use / has anyone else tried to integrate autoconf
> with Tcl?
Er ... that doesn't make sense to me.
Jeff
| |
| Joe English 2006-05-26, 10:03 pm |
| Jason Tang wrote:
>
>0. On a stock Fedora Core 4 system on a 64-bit x86 system, tclConfig.sh
> is found in /usr/lib64/. The SC_PATH_TCLCONFIG and SC_PATH_TKCONFIG
> macros within tcl.m4 should look in that directory as well.
If you're building an extension, you should *not* be using
the autoconf macros from Tcl's tcl.m4 (SC_PATH_TCLCONFIG etc.) --
you should be using the "TEA" tcl.m4 instead. This is available
in SF CVS under the "tclconfig" module:
<URL: http://tcl.cvs.sourceforge.net/tcl/tclconfig/ >
Problem #0 (look for tclConfig.sh in /usr/lib64) has been fixed
in CVS.
>1. I want to install a new Tcl package given a particular make target;
> this package should be loadable via a [package require] command. To
> determine where to install that package, I wrote this Tcl script:
> [...]
> Is there anything glaringly wrong with this approach? (Yes, I could
> have used [lsearch] as well. I wanted $path the contain the last
> entry if *share* was not found.)
The conventional approach is to use:
libdir = @libdir@
PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION)
pkglibdir = $(libdir)/$(PKG_DIR)
(where @libdir@ is the standard autoconf libdir),
and install everything in ${pkglibdir}.
That usually installs the package in a place where
[package require] will find it.
--Joe English
|
|
|
|
|