* configure: Regenerated.
[external/binutils.git] / gdb / aclocal.m4
1 dnl This file is duplicated in four places:
2 dnl * gdb/aclocal.m4
3 dnl * gdb/testsuite/aclocal.m4
4 dnl * expect/aclocal.m4
5 dnl * dejagnu/aclocal.m4
6 dnl Consider modifying all copies in parallel.
7 dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
8 dnl CYGNUS LOCAL: This gets the right posix flag for gcc
9 AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
10 [AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
11 AC_MSG_CHECKING([to see if this is LynxOS])
12 AC_CACHE_VAL(ac_cv_os_lynx,
13 [AC_EGREP_CPP(yes,
14 [/*
15  * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
16  */
17 #if defined(__Lynx__) || defined(Lynx)
18 yes
19 #endif
20 ], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
21 #
22 if test "$ac_cv_os_lynx" = "yes" ; then
23   AC_MSG_RESULT(yes)
24   AC_DEFINE(LYNX)
25   AC_MSG_CHECKING([whether -mposix or -X is available])
26   AC_CACHE_VAL(ac_cv_c_posix_flag,
27   [AC_TRY_COMPILE(,[
28   /*
29    * This flag varies depending on how old the compiler is.
30    * -X is for the old "cc" and "gcc" (based on 1.42).
31    * -mposix is for the new gcc (at least 2.5.8).
32    */
33   #if defined(__GNUC__) && __GNUC__ >= 2
34   choke me
35   #endif
36   ], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
37   CC="$CC $ac_cv_c_posix_flag"
38   AC_MSG_RESULT($ac_cv_c_posix_flag)
39   else
40   AC_MSG_RESULT(no)
41 fi
42 ])
43 AC_DEFUN(CY_AC_PATH_TCLH, [
44 #
45 # Ok, lets find the tcl source trees so we can use the headers
46 # Warning: transition of version 9 to 10 will break this algorithm
47 # because 10 sorts before 9. We also look for just tcl. We have to
48 # be careful that we don't match stuff like tclX by accident.
49 # the alternative search directory is involked by --with-tclinclude
50 #
51 no_tcl=true
52 AC_MSG_CHECKING(for Tcl private headers)
53 AC_ARG_WITH(tclinclude, [  --with-tclinclude       directory where tcl private headers are], with_tclinclude=${withval})
54 AC_CACHE_VAL(ac_cv_c_tclh,[
55 # first check to see if --with-tclinclude was specified
56 if test x"${with_tclinclude}" != x ; then
57   if test -f ${with_tclinclude}/tclInt.h ; then
58     ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
59   else
60     AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
61   fi
62 fi
63 # next check in private source directory
64 #
65 # since ls returns lowest version numbers first, reverse its output
66 if test x"${ac_cv_c_tclh}" = x ; then
67   for i in \
68                 ${srcdir}/../tcl \
69                 `ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` \
70                 ${srcdir}/../../tcl \
71                 `ls -dr ${srcdir}/../../tcl[[0-9]]* 2>/dev/null` \
72                 ${srcdir}/../../../tcl \
73                 `ls -dr ${srcdir}/../../../tcl[[0-9]]* 2>/dev/null ` ; do
74     if test -f $i/tclInt.h ; then
75       ac_cv_c_tclh=`(cd $i; pwd)`
76       break
77     fi
78     # Tcl 7.5 and greater puts headers in subdirectory.
79     if test -f $i/generic/tclInt.h ; then
80        ac_cv_c_tclh=`(cd $i; pwd)`/generic
81     fi
82   done
83 fi
84 # finally check in a few common install locations
85 #
86 # since ls returns lowest version numbers first, reverse its output
87 if test x"${ac_cv_c_tclh}" = x ; then
88   for i in \
89                 `ls -dr /usr/local/src/tcl[[0-9]]* 2>/dev/null` \
90                 `ls -dr /usr/local/lib/tcl[[0-9]]* 2>/dev/null` \
91                 /usr/local/src/tcl \
92                 /usr/local/lib/tcl \
93                 ${prefix}/include ; do
94     if test -f $i/tclInt.h ; then
95       ac_cv_c_tclh=`(cd $i; pwd)`
96       break
97     fi
98   done
99 fi
100 # see if one is installed
101 if test x"${ac_cv_c_tclh}" = x ; then
102    AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
103 fi
104 ])
105 if test x"${ac_cv_c_tclh}" = x ; then
106   TCLHDIR="# no Tcl private headers found"
107   AC_MSG_ERROR([Can't find Tcl private headers])
108 fi
109 if test x"${ac_cv_c_tclh}" != x ; then
110   no_tcl=""
111   if test x"${ac_cv_c_tkh}" = x"installed" ; then
112     AC_MSG_RESULT([is installed])
113     TCLHDIR=""
114   else
115     AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
116     # this hack is cause the TCLHDIR won't print if there is a "-I" in it.
117     TCLHDIR="-I${ac_cv_c_tclh}"
118   fi
119 fi
120
121 AC_MSG_CHECKING([Tcl version])
122 orig_includes="$CPPFLAGS"
123
124 if test x"${TCLHDIR}" != x ; then
125   CPPFLAGS="$CPPFLAGS $TCLHDIR"
126 fi
127
128 # Get major and minor versions of Tcl.
129 cat > conftest.c <<'EOF'
130 #include "tcl.h"
131 major = TCL_MAJOR_VERSION
132 minor = TCL_MINOR_VERSION
133 EOF
134
135 tclmajor=
136 tclminor=
137 if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then
138    # Success.
139    tclmajor=`egrep '^major = ' conftest.out | sed -e 's/^major = *//' -e 's/ *$//'`
140    tclminor=`egrep '^minor = ' conftest.out | sed -e 's/^minor = *//' -e 's/ *$//'`
141 fi
142 rm -f conftest.c conftest.out
143
144 if test -z "$tclmajor" || test -z "$tclminor"; then
145    AC_MSG_RESULT([fatal error: could not find major or minor version number of Tcl])
146    exit 1
147 fi
148 AC_MSG_RESULT(${tclmajor}.${tclminor})
149
150 CPPFLAGS="${orig_includes}"
151
152 AC_PROVIDE([$0])
153 AC_SUBST(TCLHDIR)
154 ])
155 AC_DEFUN(CY_AC_PATH_TCLLIB, [
156 #
157 # Ok, lets find the tcl library
158 # First, look for one uninstalled.  
159 # the alternative search directory is invoked by --with-tcllib
160 #
161
162 if test $tclmajor -ge 7 -a $tclminor -ge 4 ; then
163   installedtcllibroot=tcl$tclversion
164 else
165   installedtcllibroot=tcl
166 fi
167
168 if test x"${no_tcl}" = x ; then
169   # we reset no_tcl incase something fails here
170   no_tcl=true
171   AC_ARG_WITH(tcllib, [  --with-tcllib           directory where the tcl library is],
172          with_tcllib=${withval})
173   AC_MSG_CHECKING([for Tcl library])
174   AC_CACHE_VAL(ac_cv_c_tcllib,[
175   # First check to see if --with-tcllib was specified.
176   # This requires checking for both the installed and uninstalled name-styles
177   # since we have no idea if it's installed or not.
178   if test x"${with_tcllib}" != x ; then
179     if test -f "${with_tcllib}/lib$installedtcllibroot.so" ; then
180       ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.so
181     elif test -f "${with_tcllib}/libtcl.so" ; then
182       ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.so
183     # then look for a freshly built statically linked library
184     # if Makefile exists we assume its configured and libtcl will be built first.
185     elif test -f "${with_tcllib}/lib$installedtcllibroot.a" ; then
186       ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.a
187     elif test -f "${with_tcllib}/libtcl.a" ; then
188       ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.a
189     else
190       AC_MSG_ERROR([${with_tcllib} directory doesn't contain libraries])
191     fi
192   fi
193   # then check for a private Tcl library
194   # Since these are uninstalled, use the simple lib name root.
195   if test x"${ac_cv_c_tcllib}" = x ; then
196     for i in \
197                 ../tcl \
198                 `ls -dr ../tcl[[0-9]]* 2>/dev/null` \
199                 ../../tcl \
200                 `ls -dr ../../tcl[[0-9]]* 2>/dev/null` \
201                 ../../../tcl \
202                 `ls -dr ../../../tcl[[0-9]]* 2>/dev/null` ; do
203       # Tcl 7.5 and greater puts library in subdir.  Look there first.
204       if test -f "$i/unix/libtcl.so" ; then
205          ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.so
206          break
207       elif test -f "$i/unix/libtcl.a" -o -f "$i/unix/Makefile"; then
208          ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.a
209          break
210       # look for a freshly built dynamically linked library
211       elif test -f "$i/libtcl.so" ; then
212         ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so
213         break
214
215       # then look for a freshly built statically linked library
216       # if Makefile exists we assume its configured and libtcl will be
217       # built first.
218       elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then
219         ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a
220         break
221       fi
222     done
223   fi
224   # check in a few common install locations
225   if test x"${ac_cv_c_tcllib}" = x ; then
226     for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
227       # first look for a freshly built dynamically linked library
228       if test -f "$i/lib$installedtcllibroot.so" ; then
229         ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.so
230         break
231       # then look for a freshly built statically linked library
232       # if Makefile exists we assume its configured and libtcl will be built first.
233       elif test -f "$i/lib$installedtcllibroot.a" -o -f "$i/Makefile" ; then
234         ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.a
235         break
236       fi
237     done
238   fi
239   # check in a few other private locations
240   if test x"${ac_cv_c_tcllib}" = x ; then
241     for i in \
242                 ${srcdir}/../tcl \
243                 `ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` ; do
244       # Tcl 7.5 and greater puts library in subdir.  Look there first.
245       if test -f "$i/unix/libtcl.so" ; then
246          ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.so
247          break
248       elif test -f "$i/unix/libtcl.a" -o -f "$i/unix/Makefile"; then
249          ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.a
250          break
251       # look for a freshly built dynamically linked library
252       elif test -f "$i/libtcl.so" ; then
253         ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so
254         break
255
256       # then look for a freshly built statically linked library
257       # if Makefile exists we assume its configured and libtcl will be
258       # built first.
259       elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then
260         ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a
261         break
262       fi
263     done
264   fi
265
266   # see if one is conveniently installed with the compiler
267   if test x"${ac_cv_c_tcllib}" = x ; then       
268     orig_libs="$LIBS"
269     LIBS="$LIBS -l$installedtcllibroot -lm"    
270     AC_TRY_RUN([
271     Tcl_AppInit()
272     { exit(0); }], ac_cv_c_tcllib="-l$installedtcllibroot", ac_cv_c_tcllib=""
273     , ac_cv_c_tclib="-l$installedtcllibroot")
274     LIBS="${orig_libs}"
275    fi
276   ])
277   if test x"${ac_cv_c_tcllib}" = x ; then
278     TCLLIB="# no Tcl library found"
279     AC_MSG_WARN(Can't find Tcl library)
280   else
281     TCLLIB=${ac_cv_c_tcllib}
282     AC_MSG_RESULT(found $TCLLIB)
283     no_tcl=
284   fi
285 fi
286
287 AC_PROVIDE([$0])
288 AC_SUBST(TCLLIB)
289 ])
290 AC_DEFUN(CY_AC_PATH_TKH, [
291 #
292 # Ok, lets find the tk source trees so we can use the headers
293 # If the directory (presumably symlink) named "tk" exists, use that one
294 # in preference to any others.  Same logic is used when choosing library
295 # and again with Tcl. The search order is the best place to look first, then in
296 # decreasing significance. The loop breaks if the trigger file is found.
297 # Note the gross little conversion here of srcdir by cd'ing to the found
298 # directory. This converts the path from a relative to an absolute, so
299 # recursive cache variables for the path will work right. We check all
300 # the possible paths in one loop rather than many seperate loops to speed
301 # things up.
302 # the alternative search directory is invoked by --with-tkinclude
303 #
304 AC_MSG_CHECKING(for Tk private headers)
305 AC_ARG_WITH(tkinclude, [  --with-tkinclude        directory where the tk private headers are],
306             with_tkinclude=${withval})
307 no_tk=true
308 AC_CACHE_VAL(ac_cv_c_tkh,[
309 # first check to see if --with-tkinclude was specified
310 if test x"${with_tkinclude}" != x ; then
311   if test -f ${with_tkinclude}/tk.h ; then
312     ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
313   else
314     AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
315   fi
316 fi
317 # next check in private source directory
318 #
319 # since ls returns lowest version numbers first, reverse the entire list
320 # and search for the worst fit, overwriting it with better fits as we find them
321 if test x"${ac_cv_c_tkh}" = x ; then
322   for i in \
323                 ${srcdir}/../tk \
324                 `ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` \
325                 ${srcdir}/../../tk \
326                 `ls -dr ${srcdir}/../../tk[[0-9]]* 2>/dev/null` \
327                 ${srcdir}/../../../tk \
328                 `ls -dr ${srcdir}/../../../tk[[0-9]]* 2>/dev/null ` ; do
329     if test -f $i/tk.h ; then
330       ac_cv_c_tkh=`(cd $i; pwd)`
331       break
332     fi
333     # Tk 4.1 and greater puts this in a subdir.
334     if test -f $i/generic/tk.h; then
335        ac_cv_c_tkh=`(cd $i; pwd)`/generic
336     fi
337   done
338 fi
339 # finally check in a few common install locations
340 #
341 # since ls returns lowest version numbers first, reverse the entire list
342 # and search for the worst fit, overwriting it with better fits as we find them
343 if test x"${ac_cv_c_tkh}" = x ; then
344   for i in \
345                 `ls -dr /usr/local/src/tk[[0-9]]* 2>/dev/null` \
346                 `ls -dr /usr/local/lib/tk[[0-9]]* 2>/dev/null` \
347                 /usr/local/src/tk \
348                 /usr/local/lib/tk \
349                 ${prefix}/include ; do
350     if test -f $i/tk.h ; then
351       ac_cv_c_tkh=`(cd $i; pwd)`
352       break
353     fi
354   done
355 fi
356 # see if one is installed
357 if test x"${ac_cv_c_tkh}" = x ; then
358   AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed)
359 fi
360 ])
361 if test x"${ac_cv_c_tkh}" != x ; then
362   no_tk=""
363   if test x"${ac_cv_c_tkh}" = x"installed" ; then
364     AC_MSG_RESULT([is installed])
365     TKHDIR=""
366   else
367     AC_MSG_RESULT([found in $ac_cv_c_tkh])
368     # this hack is cause the TKHDIR won't print if there is a "-I" in it.
369     TKHDIR="-I${ac_cv_c_tkh}"
370   fi
371 else
372   TKHDIR="# no Tk directory found"
373   AC_MSG_WARN([Can't find Tk private headers])
374   no_tk=true
375 fi
376
377 # if Tk is installed, extract the major/minor version
378 if test x"${no_tk}" = x ; then
379 AC_MSG_CHECKING([Tk version])
380 orig_includes="$CPPFLAGS"
381
382 if test x"${TCLHDIR}" != x ; then
383   CPPFLAGS="$CPPFLAGS $TCLHDIR"
384 fi
385 if test x"${TKHDIR}" != x ; then
386   CPPFLAGS="$CPPFLAGS $TKHDIR"
387 fi
388 if test x"${x_includes}" != x -a x"${x_includes}" != xNONE ; then
389   CPPFLAGS="$CPPFLAGS -I$x_includes"
390 fi
391
392 # Get major and minor versions of Tk.
393 cat > conftest.c <<'EOF'
394 #include "tk.h"
395 major = TK_MAJOR_VERSION
396 minor = TK_MINOR_VERSION
397 EOF
398
399 tkmajor=
400 tkminor=
401 if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then
402    # Success.
403    tkmajor=`egrep '^major = ' conftest.out | sed -e 's/^major = *//' -e 's/ *$//'`
404    tkminor=`egrep '^minor = ' conftest.out | sed -e 's/^minor = *//' -e 's/ *$//'`
405 fi
406 rm -f conftest.c conftest.out
407
408 if test -z "$tkmajor" || test -z "$tkminor"; then
409    AC_MSG_RESULT([fatal error: could not find major or minor version number of Tk])
410    exit 1
411 fi
412 AC_MSG_RESULT(${tkmajor}.${tkminor})
413
414 CPPFLAGS="${orig_includes}"
415 fi
416
417 AC_PROVIDE([$0])
418 AC_SUBST(TKHDIR)
419 ])
420 AC_DEFUN(CY_AC_PATH_TKLIB, [
421 AC_REQUIRE([CY_AC_PATH_TCL])
422 #
423 # Ok, lets find the tk library
424 # First, look for the latest private (uninstalled) copy
425 # Notice that the destinations in backwards priority since the tests have
426 # no break.
427 # Then we look for either .a, .so, or Makefile.  A Makefile is acceptable
428 # is it indicates the target has been configured and will (probably)
429 # soon be built.  This allows an entire tree of Tcl software to be
430 # configured at once and then built.
431 # the alternative search directory is invoked by --with-tklib
432 #
433
434 if test x"${no_tk}" = x ; then
435   # reset no_tk incase something fails here
436   no_tk="true"
437
438   if test $tkmajor -ge 4 ; then
439     installedtklibroot=tk$tkversion
440   else
441     installedtkllibroot=tk
442   fi
443
444   AC_ARG_WITH(tklib, [  --with-tklib            directory where the tk library is],
445               with_tklib=${withval})
446   AC_MSG_CHECKING([for Tk library])
447   AC_CACHE_VAL(ac_cv_c_tklib,[
448   # first check to see if --with-tklib was specified
449   # This requires checking for both the installed and uninstalled name-styles
450   # since we have no idea if it's installed or not.
451   if test x"${with_tklib}" != x ; then
452     if test -f "${with_tklib}/lib$installedtklibroot.so" ; then
453       ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.so
454       no_tk=""
455     elif test -f "${with_tklib}/libtk.so" ; then
456       ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.so
457       no_tk=""
458     # then look for a freshly built statically linked library
459     # if Makefile exists we assume its configured and libtk will be built
460     elif test -f "${with_tklib}/lib$installedtklibroot.a" ; then
461       ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.a
462       no_tk=""
463     elif test -f "${with_tklib}/libtk.a" ; then
464       ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.a
465       no_tk=""
466     else
467       AC_MSG_ERROR([${with_tklib} directory doesn't contain libraries])
468     fi
469   fi
470   # then check for a private Tk library
471   # Since these are uninstalled, use the simple lib name root.
472   if test x"${ac_cv_c_tklib}" = x ; then
473     for i in \
474                 ../tk \
475                 `ls -dr ../tk[[0-9]]* 2>/dev/null` \
476                 ../../tk \
477                 `ls -dr ../../tk[[0-9]]* 2>/dev/null` \
478                 ../../../tk \
479                 `ls -dr ../../../tk[[0-9]]* 2>/dev/null` ; do
480       # Tk 4.1 and greater puts things in subdirs.  Check these first.
481       if test -f "$i/unix/libtk.so" ; then
482          ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.so
483          no_tk=
484          break
485       elif test -f "$i/unix/libtk.a" -o -f "$i/unix/Makefile"; then
486          ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.a
487          no_tk=
488          break
489       # look for a freshly built dynamically linked library
490       elif test -f "$i/libtk.so" ; then
491         ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so
492         no_tk=
493         break
494       # then look for a freshly built statically linked library
495       # if Makefile exists we assume its configured and libtk will be built 
496       elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then
497         ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a
498         no_tk=""
499         break
500       fi
501     done
502   fi
503   # finally check in a few common install locations
504   if test x"${ac_cv_c_tklib}" = x ; then
505     for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
506       # first look for a freshly built dynamically linked library
507       if test -f "$i/lib$installedtklibroot.so" ; then
508         ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.so
509         no_tk=""
510         break
511       # then look for a freshly built statically linked library
512       # if Makefile exists, we assume it's configured and libtcl will be built 
513       elif test -f "$i/lib$installedtklibroot.a" -o -f "$i/Makefile" ; then
514         ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.a
515         no_tk=""
516         break
517       fi
518     done
519   fi
520   # check in a few other private locations
521   if test x"${ac_cv_c_tklib}" = x ; then
522     for i in \
523                 ${srcdir}/../tk \
524                 `ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` ; do
525       # Tk 4.1 and greater puts things in subdirs.  Check these first.
526       if test -f "$i/unix/libtk.so" ; then
527          ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.so
528          no_tk=
529          break
530       elif test -f "$i/unix/libtk.a" -o -f "$i/unix/Makefile"; then
531          ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtk.a
532          no_tk=
533          break
534       # look for a freshly built dynamically linked library
535       elif test -f "$i/libtk.so" ; then
536         ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so
537         no_tk=""
538         break
539       # then look for a freshly built statically linked library
540       # if Makefile exists, we assume it's configured and libtcl will be built 
541       elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then
542         ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a
543         no_tk=""
544         break
545       fi
546     done
547   fi
548   # see if one is conveniently installed with the compiler
549   if test x"${ac_cv_c_tklib}" = x ; then
550        AC_REQUIRE([AC_PATH_X])
551        orig_libs="$LIBS"
552        LIBS="$LIBS -l$installedtklibroot $x_libraries $ac_cv_c_tcllib -lm"    
553        AC_TRY_RUN([
554        Tcl_AppInit()
555        { exit(0); }], ac_cv_c_tklib="-l$installedtklibroot", ac_cv_c_tklib=""
556        , ac_cv_c_tklib="-l$installedtklibroot")
557        LIBS="${orig_libs}"
558    fi
559   ])
560   if test x"${ac_cv_c_tklib}" = x ; then
561     TKLIB="# no Tk library found"
562     AC_MSG_WARN(Can't find Tk library)
563   else
564     TKLIB=$ac_cv_c_tklib
565     AC_MSG_RESULT(found $TKLIB)
566     no_tk=
567   fi
568 fi
569 AC_PROVIDE([$0])
570 AC_SUBST(TKLIB)
571 ])
572 AC_DEFUN(CY_AC_PATH_TK, [
573   CY_AC_PATH_TKH
574   CY_AC_PATH_TKLIB
575 ])
576 AC_DEFUN(CY_AC_PATH_TCL, [
577   CY_AC_PATH_TCLH
578   CY_AC_PATH_TCLLIB
579 ])