Commit | Line | Data |
---|---|---|
4e327047 TT |
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)]) | |
5436fc65 | 21 | # |
4e327047 TT |
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 | ]) | |
4e327047 TT |
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)` | |
5436fc65 | 59 | else |
4e327047 | 60 | AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers]) |
5436fc65 | 61 | fi |
4e327047 TT |
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}" | |
5436fc65 C |
118 | fi |
119 | fi | |
4e327047 TT |
120 | |
121 | AC_MSG_CHECKING([Tcl version]) | |
122 | rm -rf tclmajor tclminor | |
123 | orig_includes="$CPPFLAGS" | |
124 | ||
125 | if test x"${TCLHDIR}" != x ; then | |
126 | CPPFLAGS="$CPPFLAGS $TCLHDIR" | |
5436fc65 C |
127 | fi |
128 | ||
4e327047 TT |
129 | AC_TRY_RUN([ |
130 | #include <stdio.h> | |
131 | #include "tcl.h" | |
132 | main() { | |
133 | FILE *maj = fopen("tclmajor","w"); | |
134 | FILE *min = fopen("tclminor","w"); | |
135 | fprintf(maj,"%d",TCL_MAJOR_VERSION); | |
136 | fprintf(min,"%d",TCL_MINOR_VERSION); | |
137 | fclose(maj); | |
138 | fclose(min); | |
139 | return 0; | |
140 | }], | |
141 | tclmajor=`cat tclmajor` | |
142 | tclminor=`cat tclminor` | |
143 | tclversion=$tclmajor.$tclminor | |
144 | AC_MSG_RESULT($tclversion) | |
145 | rm -f tclmajor tclminor | |
146 | , | |
147 | AC_MSG_RESULT([can't happen]) | |
148 | , | |
149 | AC_MSG_ERROR([can't be cross compiled]) | |
150 | ) | |
151 | CPPFLAGS="${orig_includes}" | |
152 | ||
153 | AC_PROVIDE([$0]) | |
154 | AC_SUBST(TCLHDIR) | |
155 | ]) | |
156 | AC_DEFUN(CY_AC_PATH_TCLLIB, [ | |
5436fc65 | 157 | # |
4e327047 | 158 | # Ok, lets find the tcl library |
5436fc65 | 159 | # First, look for one uninstalled. |
4e327047 | 160 | # the alternative search directory is invoked by --with-tcllib |
5436fc65 | 161 | # |
4e327047 TT |
162 | |
163 | if test $tclmajor -ge 7 -a $tclminor -ge 4 ; then | |
164 | installedtcllibroot=tcl$tclversion | |
165 | else | |
166 | installedtcllibroot=tcl | |
167 | fi | |
168 | ||
169 | if test x"${no_tcl}" = x ; then | |
170 | # we reset no_tcl incase something fails here | |
171 | no_tcl=true | |
172 | AC_ARG_WITH(tcllib, [ --with-tcllib directory where the tcl library is], | |
173 | with_tcllib=${withval}) | |
174 | AC_MSG_CHECKING([for Tcl library]) | |
175 | AC_CACHE_VAL(ac_cv_c_tcllib,[ | |
176 | # First check to see if --with-tcllib was specified. | |
177 | # This requires checking for both the installed and uninstalled name-styles | |
178 | # since we have no idea if it's installed or not. | |
179 | if test x"${with_tcllib}" != x ; then | |
180 | if test -f "${with_tcllib}/lib$installedtcllibroot.so" ; then | |
181 | ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.so | |
182 | elif test -f "${with_tcllib}/libtcl.so" ; then | |
183 | ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.so | |
184 | # then look for a freshly built statically linked library | |
185 | # if Makefile exists we assume its configured and libtcl will be built first. | |
186 | elif test -f "${with_tcllib}/lib$installedtcllibroot.a" ; then | |
187 | ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.a | |
188 | elif test -f "${with_tcllib}/libtcl.a" ; then | |
189 | ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.a | |
190 | else | |
191 | AC_MSG_ERROR([${with_tcllib} directory doesn't contain libraries]) | |
192 | fi | |
5436fc65 | 193 | fi |
4e327047 TT |
194 | # then check for a private Tcl library |
195 | # Since these are uninstalled, use the simple lib name root. | |
196 | if test x"${ac_cv_c_tcllib}" = x ; then | |
197 | for i in \ | |
198 | ../tcl \ | |
199 | `ls -dr ../tcl[[0-9]]* 2>/dev/null` \ | |
200 | ../../tcl \ | |
201 | `ls -dr ../../tcl[[0-9]]* 2>/dev/null` \ | |
202 | ../../../tcl \ | |
203 | `ls -dr ../../../tcl[[0-9]]* 2>/dev/null` ; do | |
204 | # Tcl 7.5 and greater puts library in subdir. Look there first. | |
205 | if test -f "$i/unix/libtcl.so" ; then | |
206 | ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.so | |
207 | break | |
208 | elif test -f "$i/unix/libtcl.a" -o -f "$i/unix/Makefile"; then | |
209 | ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.a | |
210 | break | |
211 | # look for a freshly built dynamically linked library | |
212 | elif test -f "$i/libtcl.so" ; then | |
213 | ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so | |
214 | break | |
215 | ||
216 | # then look for a freshly built statically linked library | |
217 | # if Makefile exists we assume its configured and libtcl will be | |
218 | # built first. | |
219 | elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then | |
220 | ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a | |
221 | break | |
222 | fi | |
223 | done | |
5436fc65 | 224 | fi |
4e327047 TT |
225 | # check in a few common install locations |
226 | if test x"${ac_cv_c_tcllib}" = x ; then | |
227 | for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do | |
228 | # first look for a freshly built dynamically linked library | |
229 | if test -f "$i/lib$installedtcllibroot.so" ; then | |
230 | ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.so | |
231 | break | |
232 | # then look for a freshly built statically linked library | |
233 | # if Makefile exists we assume its configured and libtcl will be built first. | |
234 | elif test -f "$i/lib$installedtcllibroot.a" -o -f "$i/Makefile" ; then | |
235 | ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.a | |
236 | break | |
237 | fi | |
238 | done | |
5436fc65 | 239 | fi |
4e327047 TT |
240 | # check in a few other private locations |
241 | if test x"${ac_cv_c_tcllib}" = x ; then | |
242 | for i in \ | |
243 | ${srcdir}/../tcl \ | |
244 | `ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` ; do | |
245 | # Tcl 7.5 and greater puts library in subdir. Look there first. | |
246 | if test -f "$i/unix/libtcl.so" ; then | |
247 | ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.so | |
248 | break | |
249 | elif test -f "$i/unix/libtcl.a" -o -f "$i/unix/Makefile"; then | |
250 | ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.a | |
251 | break | |
252 | # look for a freshly built dynamically linked library | |
253 | elif test -f "$i/libtcl.so" ; then | |
254 | ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so | |
255 | break | |
5436fc65 | 256 | |
4e327047 TT |
257 | # then look for a freshly built statically linked library |
258 | # if Makefile exists we assume its configured and libtcl will be | |
259 | # built first. | |
260 | elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then | |
261 | ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a | |
262 | break | |
263 | fi | |
264 | done | |
5436fc65 | 265 | fi |
5436fc65 | 266 | |
4e327047 TT |
267 | # see if one is conveniently installed with the compiler |
268 | if test x"${ac_cv_c_tcllib}" = x ; then | |
269 | orig_libs="$LIBS" | |
270 | LIBS="$LIBS -l$installedtcllibroot -lm" | |
271 | AC_TRY_RUN([ | |
272 | Tcl_AppInit() | |
273 | { exit(0); }], ac_cv_c_tcllib="-l$installedtcllibroot", ac_cv_c_tcllib="" | |
274 | , ac_cv_c_tclib="-l$installedtcllibroot") | |
275 | LIBS="${orig_libs}" | |
276 | fi | |
277 | ]) | |
278 | if test x"${ac_cv_c_tcllib}" = x ; then | |
279 | TCLLIB="# no Tcl library found" | |
280 | AC_MSG_WARN(Can't find Tcl library) | |
281 | else | |
282 | TCLLIB=${ac_cv_c_tcllib} | |
283 | AC_MSG_RESULT(found $TCLLIB) | |
284 | no_tcl= | |
285 | fi | |
5436fc65 C |
286 | fi |
287 | ||
4e327047 TT |
288 | AC_PROVIDE([$0]) |
289 | AC_SUBST(TCLLIB) | |
5436fc65 | 290 | ]) |
4e327047 | 291 | AC_DEFUN(CY_AC_PATH_TKH, [ |
5436fc65 | 292 | # |
4e327047 TT |
293 | # Ok, lets find the tk source trees so we can use the headers |
294 | # If the directory (presumably symlink) named "tk" exists, use that one | |
295 | # in preference to any others. Same logic is used when choosing library | |
296 | # and again with Tcl. The search order is the best place to look first, then in | |
297 | # decreasing significance. The loop breaks if the trigger file is found. | |
298 | # Note the gross little conversion here of srcdir by cd'ing to the found | |
299 | # directory. This converts the path from a relative to an absolute, so | |
300 | # recursive cache variables for the path will work right. We check all | |
301 | # the possible paths in one loop rather than many seperate loops to speed | |
302 | # things up. | |
303 | # the alternative search directory is invoked by --with-tkinclude | |
5436fc65 | 304 | # |
4e327047 TT |
305 | AC_MSG_CHECKING(for Tk private headers) |
306 | AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where the tk private headers are], | |
307 | with_tkinclude=${withval}) | |
308 | no_tk=true | |
309 | AC_CACHE_VAL(ac_cv_c_tkh,[ | |
310 | # first check to see if --with-tkinclude was specified | |
311 | if test x"${with_tkinclude}" != x ; then | |
312 | if test -f ${with_tkinclude}/tk.h ; then | |
313 | ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)` | |
5436fc65 | 314 | else |
4e327047 | 315 | AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers]) |
5436fc65 | 316 | fi |
4e327047 TT |
317 | fi |
318 | # next check in private source directory | |
319 | # | |
320 | # since ls returns lowest version numbers first, reverse the entire list | |
321 | # and search for the worst fit, overwriting it with better fits as we find them | |
322 | if test x"${ac_cv_c_tkh}" = x ; then | |
323 | for i in \ | |
324 | ${srcdir}/../tk \ | |
325 | `ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` \ | |
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 ` ; do | |
330 | if test -f $i/tk.h ; then | |
331 | ac_cv_c_tkh=`(cd $i; pwd)` | |
332 | break | |
333 | fi | |
334 | # Tk 4.1 and greater puts this in a subdir. | |
335 | if test -f $i/generic/tk.h; then | |
336 | ac_cv_c_tkh=`(cd $i; pwd)`/generic | |
337 | fi | |
338 | done | |
339 | fi | |
340 | # finally check in a few common install locations | |
341 | # | |
342 | # since ls returns lowest version numbers first, reverse the entire list | |
343 | # and search for the worst fit, overwriting it with better fits as we find them | |
344 | if test x"${ac_cv_c_tkh}" = x ; then | |
345 | for i in \ | |
346 | `ls -dr /usr/local/src/tk[[0-9]]* 2>/dev/null` \ | |
347 | `ls -dr /usr/local/lib/tk[[0-9]]* 2>/dev/null` \ | |
348 | /usr/local/src/tk \ | |
349 | /usr/local/lib/tk \ | |
350 | ${prefix}/include ; do | |
351 | if test -f $i/tk.h ; then | |
352 | ac_cv_c_tkh=`(cd $i; pwd)` | |
353 | break | |
354 | fi | |
355 | done | |
356 | fi | |
357 | # see if one is installed | |
358 | if test x"${ac_cv_c_tkh}" = x ; then | |
359 | AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed) | |
360 | fi | |
361 | ]) | |
362 | if test x"${ac_cv_c_tkh}" != x ; then | |
363 | no_tk="" | |
364 | if test x"${ac_cv_c_tkh}" = x"installed" ; then | |
365 | AC_MSG_RESULT([is installed]) | |
366 | TKHDIR="" | |
367 | else | |
368 | AC_MSG_RESULT([found in $ac_cv_c_tkh]) | |
369 | # this hack is cause the TKHDIR won't print if there is a "-I" in it. | |
370 | TKHDIR="-I${ac_cv_c_tkh}" | |
5436fc65 C |
371 | fi |
372 | else | |
4e327047 TT |
373 | TKHDIR="# no Tk directory found" |
374 | AC_MSG_WARN([Can't find Tk private headers]) | |
375 | no_tk=true | |
5436fc65 C |
376 | fi |
377 | ||
4e327047 TT |
378 | # if Tk is installed, extract the major/minor version |
379 | if test x"${no_tk}" = x ; then | |
380 | AC_MSG_CHECKING([Tk version]) | |
381 | rm -rf tkmajor tkminor | |
382 | orig_includes="$CPPFLAGS" | |
383 | ||
384 | if test x"${TCLHDIR}" != x ; then | |
385 | CPPFLAGS="$CPPFLAGS $TCLHDIR" | |
386 | fi | |
387 | if test x"${TKHDIR}" != x ; then | |
388 | CPPFLAGS="$CPPFLAGS $TKHDIR" | |
389 | fi | |
390 | if test x"${x_includes}" != x -a x"${x_includes}" != xNONE ; then | |
391 | CPPFLAGS="$CPPFLAGS -I$x_includes" | |
392 | fi | |
393 | ||
394 | AC_TRY_RUN([ | |
395 | #include <stdio.h> | |
396 | #include "tk.h" | |
397 | main() { | |
398 | FILE *maj = fopen("tkmajor","w"); | |
399 | FILE *min = fopen("tkminor","w"); | |
400 | fprintf(maj,"%d",TK_MAJOR_VERSION); | |
401 | fprintf(min,"%d",TK_MINOR_VERSION); | |
402 | fclose(maj); | |
403 | fclose(min); | |
404 | return 0; | |
405 | }], | |
406 | tkmajor=`cat tkmajor` | |
407 | tkminor=`cat tkminor` | |
408 | tkversion=$tkmajor.$tkminor | |
409 | AC_MSG_RESULT($tkversion) | |
410 | rm -f tkmajor tkminor | |
411 | , | |
412 | AC_MSG_ERROR([ | |
413 | cannot compile a simple X program - suspect your xmkmf is | |
414 | misconfigured and is incorrectly reporting the location of your X | |
415 | include or libraries - report this to your system admin]) , | |
416 | AC_MSG_ERROR([can't be cross compiled]) | |
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]) | |
5436fc65 | 426 | # |
4e327047 TT |
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 | |
5436fc65 | 436 | # |
4e327047 TT |
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 | |
5436fc65 | 446 | fi |
4e327047 TT |
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 | |
5436fc65 | 473 | fi |
4e327047 TT |
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= | |
5436fc65 | 571 | fi |
5436fc65 | 572 | fi |
4e327047 TT |
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 | ]) |