-# if Tk is installed, extract the major/minor version
-if test x"${no_tk}" = x ; then
-echo $ac_n "checking Tk version""... $ac_c" 1>&6
-rm -rf tkmajor tkminor
-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
-
-if test "$cross_compiling" = yes; then
- { echo "configure: error: can't be cross compiled" 1>&2; exit 1; }
-
-else
-cat > conftest.$ac_ext <<EOF
-#line 2579 "configure"
-#include "confdefs.h"
-
-#include <stdio.h>
-#include "tk.h"
- main() {
- FILE *maj = fopen("tkmajor","w");
- FILE *min = fopen("tkminor","w");
- fprintf(maj,"%d",TK_MAJOR_VERSION);
- fprintf(min,"%d",TK_MINOR_VERSION);
- fclose(maj);
- fclose(min);
- return 0;
-}
-EOF
-{ (eval echo configure:2594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
-if test -s conftest && (./conftest; exit) 2>/dev/null; then
- tkmajor=`cat tkmajor`
- tkminor=`cat tkminor`
- tkversion=$tkmajor.$tkminor
- echo "$ac_t""$tkversion" 1>&6
- rm -f tkmajor tkminor
-
-else
- { echo "configure: error:
-cannot compile a simple X program - suspect your xmkmf is
-misconfigured and is incorrectly reporting the location of your X
-include or libraries - report this to your system admin" 1>&2; exit 1; }
-fi
-fi
-rm -fr conftest*
-CPPFLAGS="${orig_includes}"
-fi
-
-
-
-
-
-
-#
-# 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
-#
-
-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
-
- # Check whether --with-tklib or --without-tklib was given.
-if test "${with_tklib+set}" = set; then
- withval="$with_tklib"
- with_tklib=${withval}
-fi
-
- echo $ac_n "checking for Tk library""... $ac_c" 1>&6
- if eval "test \"`echo '$''{'ac_cv_c_tklib'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
-
- # 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=""
- else
- { echo "configure: error: ${with_tklib} directory doesn't contain libraries" 1>&2; exit 1; }
- 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
- for i in \
- ../tk \
- `ls -dr ../tk[0-9]* 2>/dev/null` \
- ../../tk \
- `ls -dr ../../tk[0-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=
- 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
- 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=""
- 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
- 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=""
- 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
-
- orig_libs="$LIBS"
- LIBS="$LIBS -l$installedtklibroot $x_libraries $ac_cv_c_tcllib -lm"
- if test "$cross_compiling" = yes; then
- ac_cv_c_tklib="-l$installedtklibroot"
-else
-cat > conftest.$ac_ext <<EOF
-#line 2760 "configure"
-#include "confdefs.h"
-
- Tcl_AppInit()
- { exit(0); }
-EOF
-{ (eval echo configure:2766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
-if test -s conftest && (./conftest; exit) 2>/dev/null; then
- ac_cv_c_tklib="-l$installedtklibroot"
-else
- ac_cv_c_tklib=""
-
-fi
-fi
-rm -fr conftest*
- LIBS="${orig_libs}"
- fi
-
-fi
-
- if test x"${ac_cv_c_tklib}" = x ; then
- TKLIB="# no Tk library found"
- echo "configure: warning: Can't find Tk library" 1>&2
- else
- TKLIB=$ac_cv_c_tklib
- echo "$ac_t""found $TKLIB" 1>&6
- no_tk=
- fi
-fi
-