aboutsummaryrefslogtreecommitdiff
path: root/gdb/aclocal.m4
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>1996-08-02 02:43:27 +0000
committerTom Tromey <tromey@redhat.com>1996-08-02 02:43:27 +0000
commit047465fd1b79902bf20b24f220cc0cdde08746c4 (patch)
tree40349f944c99dee41a4571f0d8e0d205c0b6e1e8 /gdb/aclocal.m4
parent2934d1c9258c32d0eae590e686f13304429a759e (diff)
downloadgdb-047465fd1b79902bf20b24f220cc0cdde08746c4.zip
gdb-047465fd1b79902bf20b24f220cc0cdde08746c4.tar.gz
gdb-047465fd1b79902bf20b24f220cc0cdde08746c4.tar.bz2
changes for new tcl/tk:
* gdbtk.c (mainWindow): Deleted. (cleanup_init): Don't destroy main window. (gdbtk_init): Main window now created by Tk_Init. * configure.in: Most X checks now handled automatically by Tk. Use new macros to find Tcl/Tk. * aclocal.m4: New version for new Tcl/Tk; from Don Libes. * config.in, configure: Regenerated. * Makefile.in (TCL, TCL_CFLAGS, TK, TK_CFLAGS, X11_CFLAGS, X11_LDFLAGS, X11_LIBS): Changed for new Tcl and Tk.
Diffstat (limited to 'gdb/aclocal.m4')
-rw-r--r--gdb/aclocal.m4575
1 files changed, 235 insertions, 340 deletions
diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4
index c754fdc..5cfd7d4 100644
--- a/gdb/aclocal.m4
+++ b/gdb/aclocal.m4
@@ -1,14 +1,13 @@
-dnl This file is duplicated in four places:
-dnl * gdb/aclocal.m4
-dnl * gdb/testsuite/aclocal.m4
-dnl * expect/aclocal.m4
-dnl * dejagnu/aclocal.m4
-dnl Consider modifying all copies in parallel.
dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
+dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
+
+dnl CY_AC_PATH_TCLCONFIG and CY_AC_LOAD_TCLCONFIG should be invoked
+dnl (in that order) before any other TCL macros. Similarly for TK.
+
dnl CYGNUS LOCAL: This gets the right posix flag for gcc
AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
-AC_MSG_CHECKING([to see if this is LynxOS])
+AC_MSG_CHECKING([if running LynxOS])
AC_CACHE_VAL(ac_cv_os_lynx,
[AC_EGREP_CPP(yes,
[/*
@@ -41,6 +40,30 @@ if test "$ac_cv_os_lynx" = "yes" ; then
fi
])
+#
+# Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
+# makes configure think it's cross compiling. If --target wasn't used, then
+# we can't configure, so something is wrong. We don't use the cache
+# here cause if somebody fixes their compiler install, we want this to work.
+AC_DEFUN(CY_AC_C_WORKS,
+[# If we cannot compile and link a trivial program, we can't expect anything to work
+AC_MSG_CHECKING(whether the compiler ($CC) actually works)
+AC_TRY_COMPILE(, [/* don't need anything here */],
+ c_compiles=yes, c_compiles=no)
+
+AC_TRY_LINK(, [/* don't need anything here */],
+ c_links=yes, c_links=no)
+
+if test x"${c_compiles}" = x"no" ; then
+ AC_MSG_ERROR(the native compiler is broken and won't compile.)
+fi
+
+if test x"${c_links}" = x"no" ; then
+ AC_MSG_ERROR(the native compiler is broken and won't link.)
+fi
+AC_MSG_RESULT(yes)
+])
+
AC_DEFUN(CY_AC_PATH_TCLH, [
#
# Ok, lets find the tcl source trees so we can use the headers
@@ -57,28 +80,33 @@ AC_CACHE_VAL(ac_cv_c_tclh,[
if test x"${with_tclinclude}" != x ; then
if test -f ${with_tclinclude}/tclInt.h ; then
ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
+ elif test -f ${with_tclinclude}/generic/tclInt.h ; then
+ ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
else
AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
fi
fi
+
+# next check if it came with Tcl configuration file
+if test x"${ac_cv_c_tclconfig}" = x ; then
+ if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
+ ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
+ fi
+fi
+
# next check in private source directory
#
# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tclh}" = x ; then
for i in \
${srcdir}/../tcl \
- `ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` \
${srcdir}/../../tcl \
- `ls -dr ${srcdir}/../../tcl[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../../tcl[[7-9]]* 2>/dev/null` \
${srcdir}/../../../tcl \
- `ls -dr ${srcdir}/../../../tcl[[0-9]]* 2>/dev/null ` ; do
- if test -f $i/tclInt.h ; then
- ac_cv_c_tclh=`(cd $i; pwd)`
- break
- fi
- # Tcl 7.5 and greater puts headers in subdirectory.
+ `ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
if test -f $i/generic/tclInt.h ; then
- ac_cv_c_tclh=`(cd $i; pwd)`/generic
+ ac_cv_c_tclh=`(cd $i/generic; pwd)`
break
fi
done
@@ -88,13 +116,13 @@ fi
# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tclh}" = x ; then
for i in \
- `ls -dr /usr/local/src/tcl[[0-9]]* 2>/dev/null` \
- `ls -dr /usr/local/lib/tcl[[0-9]]* 2>/dev/null` \
+ `ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
+ `ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
/usr/local/src/tcl \
/usr/local/lib/tcl \
${prefix}/include ; do
- if test -f $i/tclInt.h ; then
- ac_cv_c_tclh=`(cd $i; pwd)`
+ if test -f $i/generic/tclInt.h ; then
+ ac_cv_c_tclh=`(cd $i/generic; pwd)`
break
fi
done
@@ -120,176 +148,138 @@ if test x"${ac_cv_c_tclh}" != x ; then
fi
fi
-AC_MSG_CHECKING([Tcl version])
-orig_includes="$CPPFLAGS"
-
-if test x"${TCLHDIR}" != x ; then
- CPPFLAGS="$CPPFLAGS $TCLHDIR"
-fi
-
-# Get major and minor versions of Tcl. Use funny names to avoid
-# clashes with eg SunOS.
-cat > conftest.c <<'EOF'
-#include "tcl.h"
-MaJor = TCL_MAJOR_VERSION
-MiNor = TCL_MINOR_VERSION
-EOF
-
-tclmajor=
-tclminor=
-if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then
- # Success.
- tclmajor=`egrep '^MaJor = ' conftest.out | sed -e 's/^MaJor = *//' -e 's/ *$//'`
- tclminor=`egrep '^MiNor = ' conftest.out | sed -e 's/^MiNor = *//' -e 's/ *$//'`
-fi
-rm -f conftest.c conftest.out
-
-if test -z "$tclmajor" || test -z "$tclminor"; then
- AC_MSG_RESULT([fatal error: could not find major or minor version number of Tcl])
- exit 1
-fi
-AC_MSG_RESULT(${tclmajor}.${tclminor})
-
-CPPFLAGS="${orig_includes}"
-
-AC_PROVIDE([$0])
AC_SUBST(TCLHDIR)
])
-AC_DEFUN(CY_AC_PATH_TCLLIB, [
+
+
+AC_DEFUN(CY_AC_PATH_TCLCONFIG, [
#
-# Ok, lets find the tcl library
+# Ok, lets find the tcl configuration
# First, look for one uninstalled.
-# the alternative search directory is invoked by --with-tcllib
+# the alternative search directory is invoked by --with-tclconfig
#
-if test $tclmajor -ge 7 -a $tclminor -ge 4 ; then
- installedtcllibroot=tcl$tclversion
-else
- installedtcllibroot=tcl
-fi
-
if test x"${no_tcl}" = x ; then
- # we reset no_tcl incase something fails here
+ # we reset no_tcl in case something fails here
no_tcl=true
- AC_ARG_WITH(tcllib, [ --with-tcllib directory where the tcl library is],
- with_tcllib=${withval})
- AC_MSG_CHECKING([for Tcl library])
- AC_CACHE_VAL(ac_cv_c_tcllib,[
- # First check to see if --with-tcllib was specified.
- # This requires checking for both the installed and uninstalled name-styles
- # since we have no idea if it's installed or not.
- if test x"${with_tcllib}" != x ; then
- if test -f "${with_tcllib}/lib$installedtcllibroot.so" ; then
- ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.so
- elif test -f "${with_tcllib}/libtcl.so" ; then
- ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.so
- # then look for a freshly built statically linked library
- # if Makefile exists we assume its configured and libtcl will be built first.
- elif test -f "${with_tcllib}/lib$installedtcllibroot.a" ; then
- ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.a
- elif test -f "${with_tcllib}/libtcl.a" ; then
- ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.a
+ AC_ARG_WITH(tclconfig, [ --with-tclconfig directory containing tcl configuration (tclConfig.sh)],
+ with_tclconfig=${withval})
+ AC_MSG_CHECKING([for Tcl configuration])
+ AC_CACHE_VAL(ac_cv_c_tclconfig,[
+
+ # First check to see if --with-tclconfig was specified.
+ if test x"${with_tclconfig}" != x ; then
+ if test -f "${with_tclconfig}/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
else
- AC_MSG_ERROR([${with_tcllib} directory doesn't contain libraries])
+ AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
fi
fi
- # then check for a private Tcl library
- # Since these are uninstalled, use the simple lib name root.
- if test x"${ac_cv_c_tcllib}" = x ; then
+
+ # then check for a private Tcl installation
+ if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
../tcl \
- `ls -dr ../tcl[[0-9]]* 2>/dev/null` \
+ `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
../../tcl \
- `ls -dr ../../tcl[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
../../../tcl \
- `ls -dr ../../../tcl[[0-9]]* 2>/dev/null` ; do
- # Tcl 7.5 and greater puts library in subdir. Look there first.
- if test -f "$i/unix/libtcl.so" ; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.so
- break
- elif test -f "$i/unix/libtcl.a" -o -f "$i/unix/Makefile"; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.a
- break
- # look for a freshly built dynamically linked library
- elif test -f "$i/libtcl.so" ; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so
- break
-
- # then look for a freshly built statically linked library
- # if Makefile exists we assume its configured and libtcl will be
- # built first.
- elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a
+ `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
break
fi
done
fi
# check in a few common install locations
- if test x"${ac_cv_c_tcllib}" = x ; then
+ if test x"${ac_cv_c_tclconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
- # first look for a freshly built dynamically linked library
- if test -f "$i/lib$installedtcllibroot.so" ; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.so
- break
- # then look for a freshly built statically linked library
- # if Makefile exists we assume its configured and libtcl will be built first.
- elif test -f "$i/lib$installedtcllibroot.a" -o -f "$i/Makefile" ; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.a
+ if test -f "$i/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i; pwd)`
break
fi
done
fi
# check in a few other private locations
- if test x"${ac_cv_c_tcllib}" = x ; then
+ if test x"${ac_cv_c_tclconfig}" = x ; then
for i in \
${srcdir}/../tcl \
- `ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` ; do
- # Tcl 7.5 and greater puts library in subdir. Look there first.
- if test -f "$i/unix/libtcl.so" ; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.so
- break
- elif test -f "$i/unix/libtcl.a" -o -f "$i/unix/Makefile"; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.a
- break
- # look for a freshly built dynamically linked library
- elif test -f "$i/libtcl.so" ; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so
- break
-
- # then look for a freshly built statically linked library
- # if Makefile exists we assume its configured and libtcl will be
- # built first.
- elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a
+ `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tclConfig.sh" ; then
+ ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
break
fi
done
fi
-
- # see if one is conveniently installed with the compiler
- if test x"${ac_cv_c_tcllib}" = x ; then
- orig_libs="$LIBS"
- LIBS="$LIBS -l$installedtcllibroot -lm"
- AC_TRY_RUN([
- Tcl_AppInit()
- { exit(0); }], ac_cv_c_tcllib="-l$installedtcllibroot", ac_cv_c_tcllib=""
- , ac_cv_c_tclib="-l$installedtcllibroot")
- LIBS="${orig_libs}"
- fi
])
- if test x"${ac_cv_c_tcllib}" = x ; then
- TCLLIB="# no Tcl library found"
- AC_MSG_WARN(Can't find Tcl library)
+ if test x"${ac_cv_c_tclconfig}" = x ; then
+ TCLCONFIG="# no Tcl configs found"
+ AC_MSG_WARN(Can't find Tcl configuration definitions)
else
- TCLLIB=${ac_cv_c_tcllib}
- AC_MSG_RESULT(found $TCLLIB)
no_tcl=
+ TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
+ AC_MSG_RESULT(found $TCLCONFIG)
fi
fi
+])
+
+# Defined as a separate macro so we don't have to cache the values
+# from PATH_TCLCONFIG (because this can also be cached).
+AC_DEFUN(CY_AC_LOAD_TCLCONFIG, [
+ . $TCLCONFIG
+
+ AC_SUBST(TCL_VERSION)
+ AC_SUBST(TCL_MAJOR_VERSION)
+ AC_SUBST(TCL_MINOR_VERSION)
+ AC_SUBST(TCL_CC)
+ AC_SUBST(TCL_DEFS)
+
+dnl not used, don't export to save symbols
+dnl AC_SUBST(TCL_LIB_FILE)
+
+dnl don't export, not used outside of configure
+dnl AC_SUBST(TCL_LIBS)
+dnl not used, don't export to save symbols
+dnl AC_SUBST(TCL_PREFIX)
+
+dnl not used, don't export to save symbols
+dnl AC_SUBST(TCL_EXEC_PREFIX)
-AC_PROVIDE([$0])
-AC_SUBST(TCLLIB)
+ AC_SUBST(TCL_SHLIB_CFLAGS)
+ AC_SUBST(TCL_SHLIB_LD)
+dnl don't export, not used outside of configure
+ AC_SUBST(TCL_SHLIB_LD_LIBS)
+ AC_SUBST(TCL_SHLIB_SUFFIX)
+dnl not used, don't export to save symbols
+ AC_SUBST(TCL_DL_LIBS)
+ AC_SUBST(TCL_LD_FLAGS)
+dnl don't export, not used outside of configure
+ AC_SUBST(TCL_LD_SEARCH_FLAGS)
+ AC_SUBST(TCL_COMPAT_OBJS)
+ AC_SUBST(TCL_RANLIB)
+ AC_SUBST(TCL_BUILD_LIB_SPEC)
+ AC_SUBST(TCL_LIB_SPEC)
+ AC_SUBST(TCL_LIB_VERSIONS_OK)
+
+dnl not used, don't export to save symbols
+dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
+
+dnl not used, don't export to save symbols
+dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
])
+
+# Warning: Tk definitions are very similar to Tcl definitions but
+# are not precisely the same. There are a couple of differences,
+# so don't do changes to Tcl thinking you can cut and paste it do
+# the Tk differences and later simply substitute "Tk" for "Tcl".
+# Known differences:
+# - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
+# - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
+# - Computing major/minor versions is different because Tk depends on
+# headers to Tcl, Tk, and X.
+# - Symbols in tkConfig.sh are different than tclConfig.sh
+# - Acceptable for Tk to be missing but not Tcl.
+
AC_DEFUN(CY_AC_PATH_TKH, [
#
# Ok, lets find the tk source trees so we can use the headers
@@ -302,63 +292,66 @@ AC_DEFUN(CY_AC_PATH_TKH, [
# recursive cache variables for the path will work right. We check all
# the possible paths in one loop rather than many seperate loops to speed
# things up.
-# the alternative search directory is invoked by --with-tkinclude
+# the alternative search directory is involked by --with-tkinclude
#
-AC_MSG_CHECKING(for Tk private headers)
-AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where the tk private headers are],
- with_tkinclude=${withval})
no_tk=true
+AC_MSG_CHECKING(for Tk private headers)
+AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where tk private headers are], with_tkinclude=${withval})
AC_CACHE_VAL(ac_cv_c_tkh,[
# first check to see if --with-tkinclude was specified
if test x"${with_tkinclude}" != x ; then
if test -f ${with_tkinclude}/tk.h ; then
ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
+ elif test -f ${with_tkinclude}/generic/tk.h ; then
+ ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
else
AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
fi
fi
+
+# next check if it came with Tk configuration file
+if test x"${ac_cv_c_tkconfig}" = x ; then
+ if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
+ ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
+ fi
+fi
+
# next check in private source directory
#
-# since ls returns lowest version numbers first, reverse the entire list
-# and search for the worst fit, overwriting it with better fits as we find them
+# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tkh}" = x ; then
for i in \
${srcdir}/../tk \
- `ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
${srcdir}/../../tk \
- `ls -dr ${srcdir}/../../tk[[0-9]]* 2>/dev/null` \
+ `ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
${srcdir}/../../../tk \
- `ls -dr ${srcdir}/../../../tk[[0-9]]* 2>/dev/null ` ; do
- if test -f $i/tk.h ; then
- ac_cv_c_tkh=`(cd $i; pwd)`
+ `ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
+ if test -f $i/generic/tk.h ; then
+ ac_cv_c_tkh=`(cd $i/generic; pwd)`
break
fi
- # Tk 4.1 and greater puts this in a subdir.
- if test -f $i/generic/tk.h; then
- ac_cv_c_tkh=`(cd $i; pwd)`/generic
- fi
done
fi
# finally check in a few common install locations
#
-# since ls returns lowest version numbers first, reverse the entire list
-# and search for the worst fit, overwriting it with better fits as we find them
+# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tkh}" = x ; then
for i in \
- `ls -dr /usr/local/src/tk[[0-9]]* 2>/dev/null` \
- `ls -dr /usr/local/lib/tk[[0-9]]* 2>/dev/null` \
+ `ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
+ `ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
/usr/local/src/tk \
/usr/local/lib/tk \
${prefix}/include ; do
- if test -f $i/tk.h ; then
- ac_cv_c_tkh=`(cd $i; pwd)`
+ if test -f $i/generic/tk.h ; then
+ ac_cv_c_tkh=`(cd $i/generic; pwd)`
break
fi
done
fi
# see if one is installed
if test x"${ac_cv_c_tkh}" = x ; then
- AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed)
+ AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
fi
])
if test x"${ac_cv_c_tkh}" != x ; then
@@ -367,7 +360,7 @@ if test x"${ac_cv_c_tkh}" != x ; then
AC_MSG_RESULT([is installed])
TKHDIR=""
else
- AC_MSG_RESULT([found in $ac_cv_c_tkh])
+ AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
# this hack is cause the TKHDIR won't print if there is a "-I" in it.
TKHDIR="-I${ac_cv_c_tkh}"
fi
@@ -377,207 +370,109 @@ else
no_tk=true
fi
-# if Tk is installed, extract the major/minor version
-if test x"${no_tk}" = x ; then
-AC_MSG_CHECKING([Tk version])
-orig_includes="$CPPFLAGS"
-
-if test x"${TCLHDIR}" != x ; then
- CPPFLAGS="$CPPFLAGS $TCLHDIR"
-fi
-if test x"${TKHDIR}" != x ; then
- CPPFLAGS="$CPPFLAGS $TKHDIR"
-fi
-if test x"${x_includes}" != x -a x"${x_includes}" != xNONE ; then
- CPPFLAGS="$CPPFLAGS -I$x_includes"
-fi
-
-# Get major and minor versions of Tk. Use funny names to avoid
-# clashes with eg SunOS.
-cat > conftest.c <<'EOF'
-#include "tk.h"
-MaJor = TK_MAJOR_VERSION
-MiNor = TK_MINOR_VERSION
-EOF
-
-tkmajor=
-tkminor=
-if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then
- # Success.
- tkmajor=`egrep '^MaJor = ' conftest.out | sed -e 's/^MaJor = *//' -e 's/ *$//'`
- tkminor=`egrep '^MiNor = ' conftest.out | sed -e 's/^MiNor = *//' -e 's/ *$//'`
-fi
-rm -f conftest.c conftest.out
-
-if test -z "$tkmajor" || test -z "$tkminor"; then
- AC_MSG_RESULT([fatal error: could not find major or minor version number of Tk])
- exit 1
-fi
-AC_MSG_RESULT(${tkmajor}.${tkminor})
-
-CPPFLAGS="${orig_includes}"
-fi
-
-AC_PROVIDE([$0])
AC_SUBST(TKHDIR)
])
-AC_DEFUN(CY_AC_PATH_TKLIB, [
-AC_REQUIRE([CY_AC_PATH_TCL])
+
+
+AC_DEFUN(CY_AC_PATH_TKCONFIG, [
#
-# Ok, lets find the tk library
-# First, look for the latest private (uninstalled) copy
-# Notice that the destinations in backwards priority since the tests have
-# no break.
-# Then we look for either .a, .so, or Makefile. A Makefile is acceptable
-# is it indicates the target has been configured and will (probably)
-# soon be built. This allows an entire tree of Tcl software to be
-# configured at once and then built.
-# the alternative search directory is invoked by --with-tklib
+# Ok, lets find the tk configuration
+# First, look for one uninstalled.
+# the alternative search directory is invoked by --with-tkconfig
#
if test x"${no_tk}" = x ; then
- # reset no_tk incase something fails here
- no_tk="true"
-
- if test $tkmajor -ge 4 ; then
- installedtklibroot=tk$tkversion
- else
- installedtkllibroot=tk
- fi
+ # we reset no_tk in case something fails here
+ no_tk=true
+ AC_ARG_WITH(tkconfig, [ --with-tkconfig directory containing tk configuration (tkConfig.sh)],
+ with_tkconfig=${withval})
+ AC_MSG_CHECKING([for Tk configuration])
+ AC_CACHE_VAL(ac_cv_c_tkconfig,[
- AC_ARG_WITH(tklib, [ --with-tklib directory where the tk library is],
- with_tklib=${withval})
- AC_MSG_CHECKING([for Tk library])
- AC_CACHE_VAL(ac_cv_c_tklib,[
- # first check to see if --with-tklib was specified
- # This requires checking for both the installed and uninstalled name-styles
- # since we have no idea if it's installed or not.
- if test x"${with_tklib}" != x ; then
- if test -f "${with_tklib}/lib$installedtklibroot.so" ; then
- ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.so
- no_tk=""
- elif test -f "${with_tklib}/libtk.so" ; then
- ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.so
- no_tk=""
- # then look for a freshly built statically linked library
- # if Makefile exists we assume its configured and libtk will be built
- elif test -f "${with_tklib}/lib$installedtklibroot.a" ; then
- ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.a
- no_tk=""
- elif test -f "${with_tklib}/libtk.a" ; then
- ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.a
- no_tk=""
+ # First check to see if --with-tkconfig was specified.
+ if test x"${with_tkconfig}" != x ; then
+ if test -f "${with_tkconfig}/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
else
- AC_MSG_ERROR([${with_tklib} directory doesn't contain libraries])
+ AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
fi
fi
+
# then check for a private Tk library
- # Since these are uninstalled, use the simple lib name root.
- if test x"${ac_cv_c_tklib}" = x ; then
+ if test x"${ac_cv_c_tkconfig}" = x ; then
for i in \
../tk \
- `ls -dr ../tk[[0-9]]* 2>/dev/null` \
+ `ls -dr ../tk[[4-9]]* 2>/dev/null` \
../../tk \
- `ls -dr ../../tk[[0-9]]* 2>/dev/null` \
+ `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
../../../tk \
- `ls -dr ../../../tk[[0-9]]* 2>/dev/null` ; do
- # Tk 4.1 and greater puts things in subdirs. Check these first.
- if test -f "$i/unix/libtk.so" ; then
- ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.so
- no_tk=
- break
- elif test -f "$i/unix/libtk.a" -o -f "$i/unix/Makefile"; then
- ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.a
- no_tk=
- break
- # look for a freshly built dynamically linked library
- elif test -f "$i/libtk.so" ; then
- ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so
- no_tk=
+ `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
break
- # then look for a freshly built statically linked library
- # if Makefile exists we assume its configured and libtk will be built
- elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then
- ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a
- no_tk=""
- break
fi
done
fi
- # finally check in a few common install locations
- if test x"${ac_cv_c_tklib}" = x ; then
+ # check in a few common install locations
+ if test x"${ac_cv_c_tkconfig}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
- # first look for a freshly built dynamically linked library
- if test -f "$i/lib$installedtklibroot.so" ; then
- ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.so
- no_tk=""
+ if test -f "$i/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i; pwd)`
break
- # then look for a freshly built statically linked library
- # if Makefile exists, we assume it's configured and libtcl will be built
- elif test -f "$i/lib$installedtklibroot.a" -o -f "$i/Makefile" ; then
- ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.a
- no_tk=""
- break
fi
done
fi
# check in a few other private locations
- if test x"${ac_cv_c_tklib}" = x ; then
+ if test x"${ac_cv_c_tkconfig}" = x ; then
for i in \
${srcdir}/../tk \
- `ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` ; do
- # Tk 4.1 and greater puts things in subdirs. Check these first.
- if test -f "$i/unix/libtk.so" ; then
- ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.so
- no_tk=
- break
- elif test -f "$i/unix/libtk.a" -o -f "$i/unix/Makefile"; then
- ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtk.a
- no_tk=
- break
- # look for a freshly built dynamically linked library
- elif test -f "$i/libtk.so" ; then
- ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so
- no_tk=""
+ `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
+ if test -f "$i/unix/tkConfig.sh" ; then
+ ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
break
- # then look for a freshly built statically linked library
- # if Makefile exists, we assume it's configured and libtcl will be built
- elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then
- ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a
- no_tk=""
- break
fi
done
fi
- # see if one is conveniently installed with the compiler
- if test x"${ac_cv_c_tklib}" = x ; then
- AC_REQUIRE([AC_PATH_X])
- orig_libs="$LIBS"
- LIBS="$LIBS -l$installedtklibroot $x_libraries $ac_cv_c_tcllib -lm"
- AC_TRY_RUN([
- Tcl_AppInit()
- { exit(0); }], ac_cv_c_tklib="-l$installedtklibroot", ac_cv_c_tklib=""
- , ac_cv_c_tklib="-l$installedtklibroot")
- LIBS="${orig_libs}"
- fi
])
- if test x"${ac_cv_c_tklib}" = x ; then
- TKLIB="# no Tk library found"
- AC_MSG_WARN(Can't find Tk library)
+ if test x"${ac_cv_c_tkconfig}" = x ; then
+ TKCONFIG="# no Tk configs found"
+ AC_MSG_WARN(Can't find Tk configuration definitions)
else
- TKLIB=$ac_cv_c_tklib
- AC_MSG_RESULT(found $TKLIB)
no_tk=
+ TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
+ AC_MSG_RESULT(found $TKCONFIG)
fi
fi
-AC_PROVIDE([$0])
-AC_SUBST(TKLIB)
-])
-AC_DEFUN(CY_AC_PATH_TK, [
- CY_AC_PATH_TKH
- CY_AC_PATH_TKLIB
+
])
-AC_DEFUN(CY_AC_PATH_TCL, [
- CY_AC_PATH_TCLH
- CY_AC_PATH_TCLLIB
+
+# Defined as a separate macro so we don't have to cache the values
+# from PATH_TKCONFIG (because this can also be cached).
+AC_DEFUN(CY_AC_LOAD_TKCONFIG, [
+ if test -f "$TKCONFIG" ; then
+ . $TKCONFIG
+ fi
+
+ AC_SUBST(TK_VERSION)
+dnl not actually used, don't export to save symbols
+dnl AC_SUBST(TK_MAJOR_VERSION)
+dnl AC_SUBST(TK_MINOR_VERSION)
+ AC_SUBST(TK_DEFS)
+
+dnl not used, don't export to save symbols
+ dnl AC_SUBST(TK_LIB_FILE)
+
+dnl not used outside of configure
+dnl AC_SUBST(TK_LIBS)
+dnl not used, don't export to save symbols
+dnl AC_SUBST(TK_PREFIX)
+
+dnl not used, don't export to save symbols
+dnl AC_SUBST(TK_EXEC_PREFIX)
+
+ AC_SUBST(TK_XINCLUDES)
+ AC_SUBST(TK_XLIBSW)
+ AC_SUBST(TK_BUILD_LIB_SPEC)
+ AC_SUBST(TK_LIB_SPEC)
])
+