| 1 | AC_DEFUN(CYGNUS_PATH_TK, [ |
| 2 | # |
| 3 | # Ok, lets find the tk source trees so we can use the headers |
| 4 | # If the directory (presumably symlink) named "tk" exists, use that one |
| 5 | # in preference to any others. Same logic is used when choosing library |
| 6 | # and again with Tcl. |
| 7 | # |
| 8 | AC_CHECKING(for Tk source directory) |
| 9 | TKHDIR="" |
| 10 | for i in `ls -d ${srcdir}/../tk* 2>/dev/null` ${srcdir}/../tk ; do |
| 11 | if test -f $i/tk.h ; then |
| 12 | TKHDIR="-I$i" |
| 13 | fi |
| 14 | done |
| 15 | # if we can't find it, see if one is installed |
| 16 | if test x"$TKHDIR" = x ; then |
| 17 | installed=0 |
| 18 | if test -f $prefix/include/tk.h; then |
| 19 | installed=1 TKHDIR="-I$prefix/include" |
| 20 | else |
| 21 | AC_HEADER_CHECK(tk.h, installed=1) |
| 22 | fi |
| 23 | if test $installed -eq 0 ; then |
| 24 | TKHDIR="# no Tk directory found" |
| 25 | AC_MSG_WARN(Can't find Tk directory) |
| 26 | fi |
| 27 | fi |
| 28 | if test x"$TKHDIR" != x ; then |
| 29 | AC_MSG_RESULT(Setting TKHDIR to be $i) |
| 30 | fi |
| 31 | |
| 32 | # |
| 33 | # Ok, lets find the tk library |
| 34 | # First, look for one uninstalled. |
| 35 | # |
| 36 | TKLIB="" |
| 37 | AC_CHECKING(for Tk library) |
| 38 | for i in `ls -d ../tk* 2>/dev/null` ../tk ; do |
| 39 | if test -f "$i/Makefile" ; then |
| 40 | TKLIB=$i/libtk.a |
| 41 | fi |
| 42 | done |
| 43 | # If not found, look for installed version |
| 44 | if test x"$TKLIB" = x ; then |
| 45 | dnl This doesn't work because of unresolved symbols. |
| 46 | dnl AC_HAVE_LIBRARY(libtk.a, installed=1, installed=0) |
| 47 | if test -f $prefix/lib/libtk.a; then |
| 48 | installed=1 |
| 49 | else |
| 50 | installed=0 |
| 51 | fi |
| 52 | if test $installed -eq 1 ; then |
| 53 | TKLIB="-ltk" |
| 54 | fi |
| 55 | fi |
| 56 | |
| 57 | # If still not found, assume Tk simply hasn't been built yet |
| 58 | if test x"$TKLIB" = x ; then |
| 59 | for i in `ls -d ../tk* 2>/dev/null` ../tk ; do |
| 60 | if test -f "$i/tk.h" ; then |
| 61 | TKLIB=$i/libtk.a |
| 62 | fi |
| 63 | done |
| 64 | fi |
| 65 | |
| 66 | if test x"$TKLIB" = x ; then |
| 67 | TKLIB="# no Tk library found" |
| 68 | AC_MSG_WARN(Can't find Tk library) |
| 69 | else |
| 70 | AC_MSG_RESULT(setting TKLIB to be $TKLIB) |
| 71 | no_tk= |
| 72 | fi |
| 73 | |
| 74 | AC_SUBST(TKHDIR) |
| 75 | AC_SUBST(TKLIB) |
| 76 | ]) |
| 77 | |
| 78 | |
| 79 | AC_DEFUN(CYGNUS_PATH_TCL, [ |
| 80 | # |
| 81 | # Ok, lets find the tcl source trees so we can use the headers |
| 82 | # |
| 83 | # Warning: transition of version 9 to 10 will break this algorithm |
| 84 | # because 10 sorts before 9. |
| 85 | # |
| 86 | AC_CHECKING(for Tcl source directory) |
| 87 | TCLHDIR="" |
| 88 | for i in `ls -d ${srcdir}/../tcl* 2>/dev/null` ${srcdir}/../tcl ; do |
| 89 | if test -f $i/tclInt.h ; then |
| 90 | TCLHDIR="-I$i" |
| 91 | fi |
| 92 | done |
| 93 | # if we can't find it, see if one is installed |
| 94 | if test x"$TCLHDIR" = x ; then |
| 95 | installed=0 |
| 96 | if test -f $prefix/include/tclInt.h; then |
| 97 | installed=1 TCLHDIR="-I$prefix/include" |
| 98 | else |
| 99 | AC_HEADER_CHECK(tclInt.h, installed=1) |
| 100 | fi |
| 101 | if test $installed -eq 0 ; then |
| 102 | TCLHDIR="# no Tcl directory found" |
| 103 | AC_MSG_WARN(Can't find Tcl directory) |
| 104 | fi |
| 105 | else |
| 106 | AC_MSG_RESULT(setting TCLHDIR to be $i) |
| 107 | fi |
| 108 | |
| 109 | # |
| 110 | # Ok, lets find the tcl library |
| 111 | # First, look for the latest uninstalled |
| 112 | # |
| 113 | TCLLIB="" |
| 114 | AC_CHECKING(for Tcl library) |
| 115 | for i in `ls -d ../tcl* 2>/dev/null` ../tcl ; do |
| 116 | if test -f "$i/Makefile" ; then |
| 117 | TCLLIB=$i/libtcl.a |
| 118 | fi |
| 119 | done |
| 120 | # If not found, look for installed version |
| 121 | if test x"$TCLLIB" = x ; then |
| 122 | dnl Don't use this, since we can't use it for libtk.a. |
| 123 | dnl AC_HAVE_LIBRARY(libtcl.a, installed=1, installed=0) |
| 124 | if test -f $prefix/lib/libtcl.a; then installed=1; else installed=0; fi |
| 125 | if test $installed -eq 1 ; then |
| 126 | TCLLIB="-ltcl" |
| 127 | fi |
| 128 | fi |
| 129 | # If still not found, assume Tcl simply hasn't been built yet |
| 130 | if test x"$TCLLIB" = x ; then |
| 131 | for i in `ls -d ../tcl* 2>/dev/null` ../tcl ; do |
| 132 | if test -f "$i/tcl.h" ; then |
| 133 | TCLLIB=$i/libtcl.a |
| 134 | fi |
| 135 | done |
| 136 | fi |
| 137 | |
| 138 | if test x"$TCLLIB" = x ; then |
| 139 | TCLLIB="# no Tcl library found" |
| 140 | AC_MSG_WARN(Can't find Tcl library) |
| 141 | else |
| 142 | AC_MSG_RESULT(setting TCLLIB to be $TCLLIB) |
| 143 | fi |
| 144 | |
| 145 | AC_SUBST(TCLHDIR) |
| 146 | AC_SUBST(TCLLIB) |
| 147 | ]) |