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