1998-10-20 Syd Polk <spolk@cygnus.com>
[deliverable/binutils-gdb.git] / config / acinclude.m4
1 dnl This file is included into all any other acinclude file that needs
2 dnl to use these macros.
3
4 dnl This is copied from autoconf 2.12, but does calls our own AC_PROG_CC_WORKS,
5 dnl and doesn't call AC_PROG_CXX_GNU, cause we test for that in AC_PROG_CC_WORKS.
6 dnl We are probably using a cross compiler, which will not be able to fully
7 dnl link an executable. This should really be fixed in autoconf itself.
8 dnl Find a working G++ cross compiler. This only works for the GNU C++ compiler.
9 AC_DEFUN(CYG_AC_PROG_CXX_CROSS,
10 [AC_BEFORE([$0], [AC_PROG_CXXCPP])
11 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
12
13 CYG_AC_PROG_GXX_WORKS
14
15 if test $ac_cv_prog_gxx = yes; then
16 GXX=yes
17 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
18 dnl plays around with CXXFLAGS (such as to build both debugging and
19 dnl normal versions of a library), tasteless as that idea is.
20 ac_test_CXXFLAGS="${CXXFLAGS+set}"
21 ac_save_CXXFLAGS="$CXXFLAGS"
22 CXXFLAGS=
23 AC_PROG_CXX_G
24 if test "$ac_test_CXXFLAGS" = set; then
25 CXXFLAGS="$ac_save_CXXFLAGS"
26 elif test $ac_cv_prog_cxx_g = yes; then
27 CXXFLAGS="-g -O2"
28 else
29 CXXFLAGS="-O2"
30 fi
31 else
32 GXX=
33 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
34 fi
35 ])
36
37 dnl See if the G++ compiler we found works.
38 AC_DEFUN(CYG_AC_PROG_GXX_WORKS,
39 [AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually works])
40 AC_LANG_SAVE
41 AC_LANG_CPLUSPLUS
42 dnl Try a test case. We only compile, because it's close to impossible
43 dnl to get a correct fully linked executable with a cross compiler. For
44 dnl most cross compilers, this test is bogus. For G++, we can use various
45 dnl other compile line options to get a decent idea that the cross compiler
46 dnl actually does work, even though we can't produce an executable without
47 dnl more info about the target it's being compiled for. This only works
48 dnl for the GNU C++ compiler.
49
50 dnl Transform the name of the compiler to it's cross variant, unless
51 dnl CXX is set. This is also what CXX gets set to in the generated
52 dnl Makefile.
53 if test x"${CXX}" = xc++ ; then
54 CXX=`echo gcc | sed -e "${program_transform_name}"`
55 fi
56
57 dnl Get G++'s full path to libgcc.a
58 libgccpath=`${CXX} --print-libgcc`
59
60 dnl If we don't have a path with libgcc.a on the end, this isn't G++.
61 if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
62 ac_cv_prog_gxx=yes
63 else
64 ac_cv_prog_gxx=no
65 fi
66
67 dnl If we are using G++, look for the files that need to exist if this
68 dnl compiler works.
69 if test x"${ac_cv_prog_gxx}" = xyes ; then
70 gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
71 if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
72 gccfiles=yes
73 else
74 gccfiles=no
75 fi
76 gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
77 if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
78 gcclibs=yes
79 else
80 gcclibs=no
81 fi
82 fi
83
84 dnl If everything is OK, then we can safely assume the compiler works.
85 if test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
86 ac_cv_prog_cxx_works=no
87 AC_MSG_ERROR(${CXX} is a non-working cross compiler)
88 else
89 ac_cv_prog_cxx_works=yes
90 fi
91
92 AC_LANG_RESTORE
93 AC_MSG_RESULT($ac_cv_prog_cxx_works)
94 if test x"$ac_cv_prog_cxx_works" = xno; then
95 AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
96 fi
97 AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
98 AC_MSG_RESULT($ac_cv_prog_cxx_cross)
99 cross_compiling=$ac_cv_prog_cxx_cross
100 AC_SUBST(CXX)
101 ])
102
103 dnl ====================================================================
104 dnl Find a working GCC cross compiler. This only works for the GNU gcc compiler.
105 dnl This is based on the macros above for G++.
106 AC_DEFUN(CYG_AC_PROG_CC_CROSS,
107 [AC_BEFORE([$0], [AC_PROG_CCPP])
108 AC_CHECK_PROGS(CC, cc, gcc)
109
110 CYG_AC_PROG_GCC_WORKS
111
112 if test $ac_cv_prog_gcc = yes; then
113 GCC=yes
114 dnl Check whether -g works, even if CFLAGS is set, in case the package
115 dnl plays around with CFLAGS (such as to build both debugging and
116 dnl normal versions of a library), tasteless as that idea is.
117 ac_test_CFLAGS="${CFLAGS+set}"
118 ac_save_CFLAGS="$CFLAGS"
119 CFLAGS=
120 AC_PROG_CC_G
121 if test "$ac_test_CFLAGS" = set; then
122 CFLAGS="$ac_save_CFLAGS"
123 elif test $ac_cv_prog_cc_g = yes; then
124 CFLAGS="-g -O2"
125 else
126 CFLAGS="-O2"
127 fi
128 else
129 GXX=
130 test "${CFLAGS+set}" = set || CFLAGS="-g"
131 fi
132 ])
133
134 dnl See if the GCC compiler we found works.
135 AC_DEFUN(CYG_AC_PROG_GCC_WORKS,
136 [AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) actually works])
137 AC_LANG_SAVE
138 AC_LANG_C
139 dnl Try a test case. We only compile, because it's close to impossible
140 dnl to get a correct fully linked executable with a cross
141 dnl compiler. For most cross compilers, this test is bogus. For G++,
142 dnl we can use various other compile line options to get a decent idea
143 dnl that the cross compiler actually does work, even though we can't
144 dnl produce an executable without more info about the target it's
145 dnl being compiled for. This only works for the GNU C++ compiler.
146
147 dnl Transform the name of the compiler to it's cross variant, unless
148 dnl CXX is set. This is also what CC gets set to in the generated Makefile.
149 if test x"${CC}" = xcc ; then
150 CC=`echo gcc | sed -e "${program_transform_name}"`
151 fi
152
153 dnl Get Gcc's full path to libgcc.a
154 libgccpath=`${CC} --print-libgcc`
155
156 dnl If we don't have a path with libgcc.a on the end, this isn't G++.
157 if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
158 ac_cv_prog_gcc=yes
159 else
160 ac_cv_prog_gcc=no
161 fi
162
163 dnl If we are using Gcc, look for the files that need to exist if this
164 dnl compiler works.
165 if test x"${ac_cv_prog_gcc}" = xyes ; then
166 gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
167 if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
168 gccfiles=yes
169 else
170 gccfiles=no
171 fi
172 gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
173 if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
174 gcclibs=yes
175 else
176 gcclibs=no
177 fi
178 fi
179
180 dnl If everything is OK, then we can safely assume the compiler works.
181 if test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
182 ac_cv_prog_cc_works=no
183 AC_MSG_ERROR(${CC} is a non-working cross compiler)
184 else
185 ac_cv_prog_cc_works=yes
186 fi
187
188 AC_LANG_RESTORE
189 AC_MSG_RESULT($ac_cv_prog_cc_works)
190 if test x"$ac_cv_prog_cc_works" = xno; then
191 AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
192 fi
193 AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
194 AC_MSG_RESULT($ac_cv_prog_cc_cross)
195 cross_compiling=$ac_cv_prog_cc_cross
196 AC_SUBST(CC)
197 ])
198
199 dnl ====================================================================
200 dnl Find the HAL library. HAL is the BSP for ECC.
201 AC_DEFUN(CYG_AC_PATH_HAL, [
202 AC_MSG_CHECKING(for the HAL source files)
203 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
204 AC_CACHE_VAL(ac_cv_c_haldir,[
205 dnl We have the translate the target triplet to the directory name
206 dnl cause they unfortunately don't match.
207 case ${target_cpu} in
208 powerpc*) cpudir=powerpc ;;
209 mn10300*) cpudir=panx ;;
210 mips*) cpudir=mips ;;
211 *) cpudir=none ;;
212 esac
213 for i in $dirlist; do
214 if test -f "$srcdir/$i/hal/${cpudir}/arch/current/include/basetype.h" ; then
215 ac_cv_c_haldir=`(cd $srcdir/$i/hal/${cpudir}/arch/current/; pwd)`
216 fi
217 done
218 ])
219 if test x"${ac_cv_c_haldir}" != x; then
220 HALDIR="${ac_cv_c_haldir}"
221 AC_MSG_RESULT(${ac_cv_c_haldir})
222 else
223 AC_MSG_RESULT(none)
224 fi
225 AC_SUBST(HALDIR)
226 ])
227
228 dnl ====================================================================
229 dnl Find the ECC kernel headers.
230 AC_DEFUN(CYG_AC_PATH_KERNEL, [
231 AC_MSG_CHECKING(for the kernel header files in the source tree)
232 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
233 AC_CACHE_VAL(ac_cv_c_kernel,[
234 for i in $dirlist; do
235 if test -f "$srcdir/$i/kernel/current/include/kernel.hxx" ; then
236 ac_cv_c_kernel=`(cd $srcdir/$i/kernel/current/include; pwd)`
237 fi
238 done
239 ])
240 if test x"${ac_cv_c_kernel}" != x; then
241 KERNELHDIR="-I${ac_cv_c_kernel}"
242 AC_MSG_RESULT(${ac_cv_c_kernel})
243 else
244 AC_MSG_RESULT(none)
245 fi
246 AC_MSG_CHECKING(for the kernel library in the build tree)
247 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
248 AC_CACHE_VAL(ac_cv_c_klib,[
249 for i in $dirlist; do
250 if test -f "$i/kernel/current/src/Makefile" ; then
251 ac_cv_c_klib=`(cd $i/kernel/current/src; pwd)`
252 fi
253 done
254 ])
255 if test x"${ac_cv_c_klib}" != x; then
256 KERNELLIB="-L${ac_cv_c_klib}"
257 AC_MSG_RESULT(${ac_cv_c_klib})
258 else
259 AC_MSG_RESULT(none)
260 fi
261 AC_SUBST(KERNELHDIR)
262 AC_SUBST(KERNELLIB)
263 ])
264
265 dnl ====================================================================
266 dnl Find the ECC kernel's config file. This config.h is not produced
267 dnl by autoconf, but is handcrafted.
268 AC_DEFUN(CYG_AC_PATH_CONFIG, [
269 AC_MSG_CHECKING(for the kernel's config.h header files in the source tree)
270 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
271 AC_CACHE_VAL(ac_cv_c_configh,[
272 for i in $dirlist; do
273 if test -f "$srcdir/$i/kernel/current/src/devo/config.h" ; then
274 ac_cv_c_configh=`(cd $srcdir/$i/kernel/current/src/devo; pwd)`
275 fi
276 done
277 ])
278 if test x"${ac_cv_c_configh}" != x; then
279 CONFIG_H="-I${ac_cv_c_configh}"
280 AC_MSG_RESULT(${ac_cv_c_configh})
281 else
282 AC_MSG_RESULT(none)
283 fi
284 AC_SUBST(CONFIG_H)
285 ])
286
287 dnl ====================================================================
288 dnl Find the BFD library in the build tree. This is used to access and
289 dnl manipulate object or executable files.
290 AC_DEFUN(CYG_AC_PATH_BFD, [
291 AC_MSG_CHECKING(for the bfd header in the build tree)
292 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
293 dnl Look for the header file
294 AC_CACHE_VAL(ac_cv_c_bfdh,[
295 for i in $dirlist; do
296 if test -f "$i/bfd/bfd.h" ; then
297 ac_cv_c_bfdh=`(cd $i/bfd; pwd)`
298 break
299 fi
300 done
301 ])
302 if test x"${ac_cv_c_bfdh}" != x; then
303 BFDHDIR="-I${ac_cv_c_bfdh}"
304 AC_MSG_RESULT(${ac_cv_c_bfdh})
305 else
306 AC_MSG_RESULT(none)
307 fi
308 AC_SUBST(BFDHDIR)
309
310 dnl Look for the library
311 AC_MSG_CHECKING(for the bfd library in the build tree)
312 AC_CACHE_VAL(ac_cv_c_bfdlib,[
313 for i in $dirlist; do
314 if test -f "$i/bfd/Makefile" ; then
315 ac_cv_c_bfdlib=`(cd $i/bfd; pwd)`
316 fi
317 done
318 ])
319 dnl We list two directories cause bfd now uses libtool
320 if test x"${ac_cv_c_bfdlib}" != x; then
321 BFDLIB="-L${ac_cv_c_bfdlib} -L${ac_cv_c_bfdlib}/.libs"
322 AC_MSG_RESULT(${ac_cv_c_bfdlib})
323 else
324 AC_MSG_RESULT(none)
325 fi
326 AC_SUBST(BFDLIB)
327 ])
328
329 dnl ====================================================================
330 dnl Find the libiberty library. This defines many commonly used C
331 dnl functions that exists in various states based on the underlying OS.
332 AC_DEFUN(CYG_AC_PATH_LIBERTY, [
333 AC_MSG_CHECKING(for the liberty library in the build tree)
334 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
335 AC_CACHE_VAL(ac_cv_c_liberty,[
336 for i in $dirlist; do
337 if test -f "$i/libiberty/Makefile" ; then
338 ac_cv_c_liberty=`(cd $i/libiberty; pwd)`
339 fi
340 done
341 ])
342 if test x"${ac_cv_c_liberty}" != x; then
343 LIBERTY="-L${ac_cv_c_liberty}"
344 AC_MSG_RESULT(${ac_cv_c_liberty})
345 else
346 AC_MSG_RESULT(none)
347 fi
348 AC_SUBST(LIBERTY)
349 ])
350
351 dnl ====================================================================
352 dnl Find the opcodes library. This is used to do dissasemblies.
353 AC_DEFUN(CYG_AC_PATH_OPCODES, [
354 AC_MSG_CHECKING(for the opcodes library in the build tree)
355 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
356 AC_CACHE_VAL(ac_cv_c_opc,[
357 for i in $dirlist; do
358 if test -f "$i/opcodes/Makefile" ; then
359 ac_cv_c_opc=`(cd $i/opcodes; pwd)`
360 fi
361 done
362 ])
363 if test x"${ac_cv_c_opc}" != x; then
364 OPCODESLIB="-L${ac_cv_c_opc}"
365 AC_MSG_RESULT(${ac_cv_c_opc})
366 else
367 AC_MSG_RESULT(none)
368 fi
369 AC_SUBST(OPCODESLIB)
370 ])
371
372 dnl ====================================================================
373 dnl Look for the DejaGnu header file in the source tree. This file
374 dnl defines the functions used to testing support.
375 AC_DEFUN(CYG_AC_PATH_DEJAGNU, [
376 AC_MSG_CHECKING(for the testing support files in the source tree)
377 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
378 AC_CACHE_VAL(ac_cv_c_dejagnu,[
379 for i in $dirlist; do
380 if test -f "$srcdir/$i/ecc/ecc/infra/testlib/current/include/dejagnu.h" ; then
381 ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; pwd)`
382 fi
383 done
384 ])
385 if test x"${ac_cv_c_dejagnu}" != x; then
386 DEJAGNUHDIR="-I${ac_cv_c_dejagnu}"
387 AC_MSG_RESULT(${ac_cv_c_dejagnu})
388 else
389 AC_MSG_RESULT(none)
390 fi
391 AC_CACHE_VAL(ac_cv_c_dejagnulib,[
392 for i in $dirlist; do
393 if test -f "$srcdir/$i/infra/testlib/current/lib/hostutil.exp" ; then
394 ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; pwd)`
395 fi
396 done
397 ])
398 if test x"${ac_cv_c_dejagnulib}" != x; then
399 DEJAGNULIB="${ac_cv_c_dejagnulib}"
400 else
401 DEJAGNULIB=""
402 fi
403 AC_MSG_CHECKING(for runtest in the source tree)
404 AC_CACHE_VAL(ac_cv_c_runtest,[
405 for i in $dirlist; do
406 if test -f "$srcdir/$i/dejagnu/runtest" ; then
407 ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; pwd)`
408 fi
409 done
410 ])
411 if test x"${ac_cv_c_runtest}" != x; then
412 RUNTESTDIR="${ac_cv_c_runtest}"
413 AC_MSG_RESULT(${ac_cv_c_runtest})
414 else
415 RUNTESTDIR=""
416 AC_MSG_RESULT(none)
417 fi
418 AC_SUBST(RUNTESTDIR)
419 AC_SUBST(DEJAGNULIB)
420 AC_SUBST(DEJAGNUHDIR)
421 ])
422
423 dnl ====================================================================
424 dnl Find the libintl library in the build tree. This is for
425 dnl internationalization support.
426 AC_DEFUN(CYG_AC_PATH_INTL, [
427 AC_MSG_CHECKING(for the intl header in the build tree)
428 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
429 dnl Look for the header file
430 AC_CACHE_VAL(ac_cv_c_intlh,[
431 for i in $dirlist; do
432 if test -f "$i/intl/libintl.h" ; then
433 ac_cv_c_intlh=`(cd $i/intl; pwd)`
434 break
435 fi
436 done
437 ])
438 if test x"${ac_cv_c_intlh}" != x; then
439 INTLHDIR="-I${ac_cv_c_intlh}"
440 AC_MSG_RESULT(${ac_cv_c_intlh})
441 else
442 AC_MSG_RESULT(none)
443 fi
444 AC_SUBST(INTLHDIR)
445
446 dnl Look for the library
447 AC_MSG_CHECKING(for the libintl library in the build tree)
448 AC_CACHE_VAL(ac_cv_c_intllib,[
449 for i in $dirlist; do
450 if test -f "$i/intl/Makefile" ; then
451 ac_cv_c_intllib=`(cd $i/intl; pwd)`
452 fi
453 done
454 ])
455 if test x"${ac_cv_c_intllib}" != x; then
456 INTLLIB="-L${ac_cv_c_intllib} -lintl"
457 AC_MSG_RESULT(${ac_cv_c_intllib})
458 else
459 AC_MSG_RESULT(none)
460 fi
461 AC_SUBST(INTLLIB)
462 ])
463
464 dnl ====================================================================
465 dnl Find the simulator library.
466 AC_DEFUN(CYG_AC_PATH_SIM, [
467 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.."
468 case "$target_cpu" in
469 powerpc) target_dir=ppc ;;
470 sparc*) target_dir=erc32 ;;
471 mips*) target_dir=mips ;;
472 *) target_dir=$target_cpu ;;
473 esac
474 dnl First look for the header file
475 AC_MSG_CHECKING(for the simulator header file)
476 AC_CACHE_VAL(ac_cv_c_simh,[
477 for i in $dirlist; do
478 if test -f "${srcdir}/$i/include/remote-sim.h" ; then
479 ac_cv_c_simh=`(cd ${srcdir}/$i/include; pwd)`
480 break
481 fi
482 done
483 ])
484 if test x"${ac_cv_c_simh}" != x; then
485 SIMHDIR="-I${ac_cv_c_simh}"
486 AC_MSG_RESULT(${ac_cv_c_simh})
487 else
488 AC_MSG_RESULT(none)
489 fi
490 AC_SUBST(SIMHDIR)
491
492 dnl See whether it's a devo or Foundry branch simulator
493 AC_MSG_CHECKING(Whether this is a devo simulator )
494 AC_CACHE_VAL(ac_cv_c_simdevo,[
495 CPPFLAGS="$CPPFLAGS $SIMHDIR"
496 AC_EGREP_HEADER([SIM_DESC sim_open.*struct _bfd], remote-sim.h,
497 ac_cv_c_simdevo=yes,
498 ac_cv_c_simdevo=no)
499 ])
500 if test x"$ac_cv_c_simdevo" = x"yes" ; then
501 AC_DEFINE(HAVE_DEVO_SIM)
502 fi
503 AC_MSG_RESULT(${ac_cv_c_simdevo})
504 AC_SUBST(HAVE_DEVO_SIM)
505
506 dnl Next look for the library
507 AC_MSG_CHECKING(for the simulator library)
508 AC_CACHE_VAL(ac_cv_c_simlib,[
509 for i in $dirlist; do
510 if test -f "$i/sim/$target_dir/Makefile" ; then
511 ac_cv_c_simlib=`(cd $i/sim/$target_dir; pwd)`
512 fi
513 done
514 ])
515 if test x"${ac_cv_c_simlib}" != x; then
516 SIMLIB="-L${ac_cv_c_simlib}"
517 else
518 AC_MSG_RESULT(none)
519 dnl FIXME: this is kinda bogus, cause umtimately the TM will build
520 dnl all the libraries for several architectures. But for now, this
521 dnl will work till then.
522 dnl AC_MSG_CHECKING(for the simulator installed with the compiler libraries)
523 dnl Transform the name of the compiler to it's cross variant, unless
524 dnl CXX is set. This is also what CXX gets set to in the generated
525 dnl Makefile.
526 CROSS_GCC=`echo gcc | sed -e "s/^/$target/"`
527
528 dnl Get G++'s full path to libgcc.a
529 changequote(,)
530 gccpath=`${CROSS_GCC} --print-libgcc | sed -e 's:[a-z0-9A-Z\.\-]*/libgcc.a::' -e 's:lib/gcc-lib/::'`lib
531 changequote([,])
532 if test -f $gccpath/libsim.a -o -f $gccpath/libsim.so ; then
533 ac_cv_c_simlib="$gccpath/"
534 SIMLIB="-L${ac_cv_c_simlib}"
535 AC_MSG_RESULT(${ac_cv_c_simlib})
536 else
537 AM_CONDITIONAL(PSIM, test x$psim = xno)
538 SIMLIB=""
539 AC_MSG_RESULT(none)
540 dnl ac_cv_c_simlib=none
541 fi
542 fi
543 AC_SUBST(SIMLIB)
544 ])
545
546 dnl ====================================================================
547 dnl Find the libiberty library.
548 AC_DEFUN(CYG_AC_PATH_LIBIBERTY, [
549 AC_MSG_CHECKING(for the libiberty library in the build tree)
550 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
551 AC_CACHE_VAL(ac_cv_c_libib,[
552 for i in $dirlist; do
553 if test -f "$i/libiberty/Makefile" ; then
554 ac_cv_c_libib=`(cd $i/libiberty/; pwd)`
555 fi
556 done
557 ])
558 if test x"${ac_cv_c_libib}" != x; then
559 LIBIBERTY="-L${ac_cv_c_libib}"
560 AC_MSG_RESULT(${ac_cv_c_libib})
561 else
562 AC_MSG_RESULT(none)
563 fi
564 AC_SUBST(LIBIBERTY)
565 ])
566
567 dnl ====================================================================
568 AC_DEFUN(CYG_AC_PATH_DEVO, [
569 AC_MSG_CHECKING(for devo headers in the source tree)
570 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
571 AC_CACHE_VAL(ac_cv_c_devoh,[
572 for i in $dirlist; do
573 if test -f "${srcdir}/$i/include/remote-sim.h" ; then
574 ac_cv_c_devoh=`(cd ${srcdir}/$i/include; pwd)`
575 fi
576 done
577 ])
578 if test x"${ac_cv_c_devoh}" != x; then
579 DEVOHDIR="-I${ac_cv_c_devoh}"
580 AC_MSG_RESULT(${ac_cv_c_devoh})
581 else
582 AC_MSG_RESULT(none)
583 fi
584 AC_SUBST(DEVOHDIR)
585 ])
586
587 dnl ====================================================================
588 dnl find the IDE library and headers.
589 AC_DEFUN(CYG_AC_PATH_IDE, [
590 AC_MSG_CHECKING(for IDE headers in the source tree)
591 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
592 IDEHDIR=
593 IDELIB=
594 AC_CACHE_VAL(ac_cv_c_ideh,[
595 for i in $dirlist; do
596 if test -f "${srcdir}/$i/libide/src/event.h" ; then
597 ac_cv_c_ideh=`(cd ${srcdir}/$i/libide/src; pwd)`;
598 fi
599 done
600 ])
601 if test x"${ac_cv_c_ideh}" != x; then
602 IDEHDIR="-I${ac_cv_c_ideh}"
603 AC_MSG_RESULT(${ac_cv_c_ideh})
604 else
605 AC_MSG_RESULT(none)
606 fi
607
608 AC_MSG_CHECKING(for LIBIDE TCL headers in the source tree)
609 AC_CACHE_VAL(ac_cv_c_idetclh,[
610 for i in $dirlist; do
611 if test -f "${srcdir}/$i/libidetcl/src/idetcl.h" ; then
612 ac_cv_c_idetclh=`(cd ${srcdir}/$i/libidetcl/src; pwd)`;
613 fi
614 done
615 ])
616 if test x"${ac_cv_c_idetclh}" != x; then
617 IDEHDIR="${IDEHDIR} -I${ac_cv_c_idetclh}"
618 AC_MSG_RESULT(${ac_cv_c_idetclh})
619 else
620 AC_MSG_RESULT(none)
621 fi
622
623 AC_MSG_CHECKING(for IDE headers in the build tree)
624 AC_CACHE_VAL(ac_cv_c_ideh2,[
625 for i in $dirlist; do
626 if test -f "$i/libide/src/Makefile" ; then
627 ac_cv_c_ideh2=`(cd $i/libide/src; pwd)`;
628 fi
629 done
630 ])
631 if test x"${ac_cv_c_ideh2}" != x; then
632 IDEHDIR="${IDEHDIR} -I${ac_cv_c_ideh2}"
633 AC_MSG_RESULT(${ac_cv_c_ideh2})
634 else
635 AC_MSG_RESULT(none)
636 fi
637
638 dnl look for the library
639 AC_MSG_CHECKING(for IDE library)
640 AC_CACHE_VAL(ac_cv_c_idelib,[
641 if test x"${ac_cv_c_idelib}" = x ; then
642 for i in $dirlist; do
643 if test -f "$i/libide/src/Makefile" ; then
644 ac_cv_c_idelib=`(cd $i/libide/src; pwd)`
645 break
646 fi
647 done
648 fi])
649 if test x"${ac_cv_c_idelib}" != x ; then
650 IDELIB="-L${ac_cv_c_idelib}"
651 AC_MSG_RESULT(${ac_cv_c_idelib})
652 else
653 AC_MSG_RESULT(none)
654 fi
655
656 dnl find libiddetcl.a if it exists
657 AC_MSG_CHECKING(for IDE TCL library)
658 AC_CACHE_VAL(ac_cv_c_idetcllib,[
659 if test x"${ac_cv_c_idetcllib}" = x ; then
660 for i in $dirlist; do
661 if test -f "$i/libidetcl/src/Makefile" ; then
662 ac_cv_c_idetcllib=`(cd $i/libidetcl/src; pwd)`
663 break
664 fi
665 done
666 fi
667 ])
668 if test x"${ac_cv_c_idetcllib}" != x ; then
669 IDELIB="${IDELIB} -L${ac_cv_c_idetcllib}"
670 IDETCLLIB="-lidetcl"
671 AC_MSG_RESULT(${ac_cv_c_idetcllib})
672 else
673 AC_MSG_RESULT(none)
674 fi
675 AC_SUBST(IDEHDIR)
676 AC_SUBST(IDELIB)
677 AC_SUBST(IDETCLLIB)
678 ])
679
680 dnl ====================================================================
681 dnl Find all the ILU headers and libraries
682 AC_DEFUN(CYG_AC_PATH_ILU, [
683 AC_MSG_CHECKING(for ILU kernel headers in the source tree)
684 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
685 AC_CACHE_VAL(ac_cv_c_iluh,[
686 for i in $dirlist; do
687 if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then
688 ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; pwd)`
689 fi
690 done
691 ])
692 if test x"${ac_cv_c_iluh}" != x; then
693 ILUHDIR="-I${ac_cv_c_iluh}"
694 AC_MSG_RESULT(${ac_cv_c_iluh})
695 else
696 AC_MSG_RESULT(none)
697 fi
698
699 AC_MSG_CHECKING(for ILU kernel headers in the build tree)
700 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
701 AC_CACHE_VAL(ac_cv_c_iluh5,[
702 for i in $dirlist; do
703 if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then
704 ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; pwd)`
705 fi
706 done
707 ])
708 if test x"${ac_cv_c_iluh5}" != x; then
709 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh5}"
710 AC_MSG_RESULT(${ac_cv_c_iluh5})
711 else
712 AC_MSG_RESULT(none)
713 fi
714
715 AC_MSG_CHECKING(for ILU C++ headers in the source tree)
716 AC_CACHE_VAL(ac_cv_c_iluh2,[
717 for i in $dirlist; do
718 if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then
719 ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; pwd)`
720 fi
721 done
722 ])
723 if test x"${ac_cv_c_iluh2}" != x; then
724 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh2}"
725 AC_MSG_RESULT(${ac_cv_c_iluh2})
726 else
727 AC_MSG_RESULT(none)
728 fi
729
730 AC_MSG_CHECKING(for ILU C headers)
731 AC_CACHE_VAL(ac_cv_c_iluh3,[
732 for i in $dirlist; do
733 if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then
734 ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c ; pwd)`
735 fi
736 done
737 ])
738 if test x"${ac_cv_c_iluh3}" != x; then
739 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh3}"
740 AC_MSG_RESULT(${ac_cv_c_iluh3})
741 else
742 AC_MSG_RESULT(none)
743 fi
744
745 AC_MSG_CHECKING(for ILU C runtime headers)
746 AC_CACHE_VAL(ac_cv_c_iluh4,[
747 for i in $dirlist; do
748 if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then
749 ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c ; pwd)`
750 fi
751 done
752 ])
753 if test x"${ac_cv_c_iluh4}" != x; then
754 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh4}"
755 AC_MSG_RESULT(${ac_cv_c_iluh4})
756 else
757 AC_MSG_RESULT(none)
758 fi
759
760 AC_CACHE_VAL(ac_cv_c_ilupath,[
761 for i in $dirlist; do
762 if test -f "$i/ilu/Makefile" ; then
763 ac_cv_c_ilupath=`(cd $i/ilu; pwd)`
764 break
765 fi
766 done
767 ])
768 ILUTOP=${ac_cv_c_ilupath}
769
770 AC_MSG_CHECKING(for the ILU library in the build tree)
771 AC_CACHE_VAL(ac_cv_c_ilulib,[
772 if test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then
773 ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; pwd)`
774 AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a)
775 else
776 AC_MSG_RESULT(no)
777 fi])
778
779 AC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
780 AC_CACHE_VAL(ac_cv_c_ilulib2,[
781 if test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then
782 ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; pwd)`
783 AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a)
784 else
785 AC_MSG_RESULT(no)
786 fi])
787
788 AC_MSG_CHECKING(for the ILU C bindings library in the build tree)
789 AC_CACHE_VAL(ac_cv_c_ilulib3,[
790 if test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then
791 ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; pwd)`
792 AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a)
793 else
794 AC_MSG_RESULT(no)
795 fi])
796
797 AC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
798 AC_CACHE_VAL(ac_cv_c_ilulib4,[
799 if test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then
800 ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; pwd)`
801 AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a)
802 else
803 AC_MSG_RESULT(no)
804 fi])
805
806 if test x"${ac_cv_c_ilulib}" = x -a x"${ac_cv_c_ilulib2}" = x; then
807 ILUHDIR=""
808 fi
809
810 if test x"${ac_cv_c_ilulib}" != x -a x"${ac_cv_c_ilulib2}" != x; then
811 ILULIB="-L${ac_cv_c_ilulib} -L${ac_cv_c_ilulib2} -L${ac_cv_c_ilulib3} -L${ac_cv_c_ilulib4}"
812 else
813 ILULIB=""
814 fi
815
816 if test x"${ILULIB}" = x; then
817 AC_MSG_CHECKING(for ILU libraries installed with the compiler)
818 AC_CACHE_VAL(ac_cv_c_ilulib5,[
819 NATIVE_GCC=`echo gcc | sed -e "${program_transform_name}"`
820
821 dnl Get G++'s full path to it's libraries
822 ac_cv_c_ilulib5=`${NATIVE_GCC} --print-libgcc | sed -e 's:lib/gcc-lib/.*::'`lib
823 if test -f $ac_cv_c_ilulib5/libilu-c.a -o -f $ac_cv_c_ilulib5/libilu-c.so ; then
824 if test x"${ILUHDIR}" = x; then
825 ILUHDIR="-I${ac_cv_c_ilulib5}/../include"
826 fi
827 ILULIB="-L${ac_cv_c_ilulib5}"
828 AC_MSG_RESULT(${ac_cv_c_ilulib5})
829 else
830 ac_cv_c_ilulib=none
831 AC_MSG_RESULT(none)
832 fi
833 fi])
834 AC_SUBST(ILUHDIR)
835 AC_SUBST(ILULIB)
836 AC_SUBST(ILUTOP)
837 ])
838
839 dnl ====================================================================
840 dnl Find the target manager client side headers and library.
841 AC_DEFUN(CYG_AC_PATH_TMGR, [
842 AC_MSG_CHECKING(for Target Manager client headers in the source tree)
843 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. "
844 TMGRHDIR=
845 TMGRLIB=
846 AC_CACHE_VAL(ac_cv_c_tmgrh,[
847 for i in $dirlist; do
848 if test -f "${srcdir}/$i/ecc/ecc/infra/targ_mgr/current/host/targ_mgr/src/targcli.h" ; then
849 ac_cv_c_tmgrh=`(cd ${srcdir}/$i/ecc/ecc/infra/targ_mgr/current/host/targ_mgr/src/; pwd)`;
850 fi
851 done
852 ])
853 if test x"${ac_cv_c_tmgrh}" != x; then
854 TMGRHDIR="-I${ac_cv_c_tmgrh}"
855 AC_MSG_RESULT(${ac_cv_c_tmgrh})
856 else
857 AC_MSG_RESULT(none)
858 fi
859
860 AC_MSG_CHECKING(for Target Manager client headers in the build tree)
861 AC_CACHE_VAL(ac_cv_c_tmgrh2,[
862 for i in $dirlist; do
863 if test -f "$i/ecc/ecc/infra/targ_mgr/current/host/targ_mgr/src/Makefile" ; then
864 ac_cv_c_tmgrh2=`(cd $i/ecc/ecc/infra/targ_mgr/current/host/targ_mgr/src/; pwd)`;
865 fi
866 done
867 ])
868 if test x"${ac_cv_c_tmgrh2}" != x; then
869 TMGRHDIR="${TMGRHDIR} -I${ac_cv_c_tmgrh2}"
870 AC_MSG_RESULT(${ac_cv_c_tmgrh2})
871 else
872 AC_MSG_RESULT(none)
873 fi
874
875 if test x"${ac_cv_c_tmgrh}" = x -a x"${ac_cv_c_tmgrh2}" = x; then
876 TMGRHDIR="# no Target Manager client headers found"
877 fi
878
879 AC_MSG_CHECKING(for Target Manager client library)
880 AC_CACHE_VAL(ac_cv_c_tmgrlib,[
881 if test x"${ac_cv_c_tmgrlib}" = x ; then
882 for i in $dirlist; do
883 if test -f "$i/ecc/ecc/infra/targ_mgr/current/host/targ_mgr/src/Makefile" ; then
884 # We have to add .libs on the end cause the tmgr uses libtool,
885 # and GDB doesn't.
886 ac_cv_c_tmgrlib=`(cd $i/ecc/ecc/infra/targ_mgr/current/host/targ_mgr/src/; pwd)`
887 # we have to do this, cause libtool hasn't built the lib
888 # library yet.
889 ac_cv_c_tmgrlib="${ac_cv_c_tmgrlib}/.libs"
890 break
891 fi
892 done
893 fi])
894
895 if test x"${ac_cv_c_tmgrlib}" != x ; then
896 TMGRLIB="-L${ac_cv_c_tmgrlib}"
897 AC_MSG_RESULT(${ac_cv_c_tmgrlib})
898 else
899 AC_MSG_RESULT(none)
900 fi
901 AC_SUBST(TMGRHDIR)
902 AC_SUBST(TMGRLIB)
903 ])
904
905 dnl ====================================================================
906 dnl This defines the byte order for the host. We can't use
907 dnl AC_C_BIGENDIAN, cause we want to create a config file and
908 dnl substitue the real value, so the header files work right
909 AC_DEFUN(CYG_AC_C_ENDIAN, [
910 AC_MSG_CHECKING(to see if this is a little endian host)
911 AC_CACHE_VAL(ac_cv_c_little_endian, [
912 ac_cv_c_little_endian=unknown
913 # See if sys/param.h defines the BYTE_ORDER macro.
914 AC_TRY_COMPILE([#include <sys/types.h>
915 #include <sys/param.h>], [
916 #if !BYTE_ORDER || !_BIG_ENDIAN || !_LITTLE_ENDIAN
917 bogus endian macros
918 #endif], [# It does; now see whether it defined to _LITTLE_ENDIAN or not.
919 AC_TRY_COMPILE([#include <sys/types.h>
920 #include <sys/param.h>], [
921 #if BYTE_ORDER != _LITTLE_ENDIAN
922 not big endian
923 #endif], ac_cv_c_little_endian=yes, ac_cv_c_little_endian=no)
924 ])
925 if test ${ac_cv_c_little_endian} = unknown; then
926 old_cflags=$CFLAGS
927 CFLAGS=-g
928 AC_TRY_RUN([
929 main () {
930 /* Are we little or big endian? From Harbison&Steele. */
931 union
932 {
933 long l;
934 char c[sizeof (long)];
935 } u;
936 u.l = 1;
937 exit (u.c[0] == 1);
938 }],
939 ac_cv_c_little_endian=no,
940 ac_cv_c_little_endian=yes,[
941 dnl Yes, this is ugly, and only used for a canadian cross anyway. This
942 dnl is just to keep configure from stopping here.
943 case "${host}" in
944 changequote(,)
945 i[3456]86-*-*) ac_cv_c_little_endian=yes ;;
946 sparc*-*-*) ac_cv_c_little_endian=no ;;
947 changequote([,])
948 *) AC_MSG_WARN(Can't cross compile this test) ;;
949 esac])
950 CFLAGS=$old_cflags
951 fi])
952
953 if test x"${ac_cv_c_little_endian}" = xyes; then
954 AC_DEFINE(LITTLE_ENDIAN_HOST)
955 ENDIAN="CYG_LSBFIRST";
956 else
957 ENDIAN="CYG_MSBFIRST";
958 fi
959 AC_MSG_RESULT(${ac_cv_c_little_endian})
960 AC_SUBST(ENDIAN)
961 ])
962
963 dnl ====================================================================
964 dnl Look for the path to libgcc, so we can use it to directly link
965 dnl in libgcc.a with LD.
966 AC_DEFUN(CYG_AC_PATH_LIBGCC,
967 [AC_MSG_CHECKING([Looking for the path to libgcc.a])
968 AC_LANG_SAVE
969 AC_LANG_C
970
971 dnl Get Gcc's full path to libgcc.a
972 libgccpath=`${CC} --print-libgcc`
973
974 dnl If we don't have a path with libgcc.a on the end, this isn't G++.
975 if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
976 ac_cv_prog_gcc=yes
977 else
978 ac_cv_prog_gcc=no
979 fi
980
981 dnl
982 if test x"${ac_cv_prog_gcc}" = xyes ; then
983 gccpath=`echo $libgccpath | sed -e 's:/libgcc.a::'`
984 LIBGCC="-L${gccpath}"
985 AC_MSG_RESULT(${gccpath})
986 else
987 LIBGCC=""
988 AC_MSG_ERROR(Not using gcc)
989 fi
990
991 AC_LANG_RESTORE
992 AC_SUBST(LIBGCC)
993 ])
994
995 dnl ====================================================================
996 dnl Ok, lets find the tcl source trees so we can use the headers
997 dnl Warning: transition of version 9 to 10 will break this algorithm
998 dnl because 10 sorts before 9. We also look for just tcl. We have to
999 dnl be careful that we don't match stuff like tclX by accident.
1000 dnl the alternative search directory is involked by --with-tclinclude
1001 AC_DEFUN(CYG_AC_PATH_TCL, [
1002 CYG_AC_PATH_TCLH
1003 CYG_AC_PATH_TCLCONFIG
1004 CYG_AC_LOAD_TCLCONFIG
1005 ])
1006 AC_DEFUN(CYG_AC_PATH_TCLH, [
1007 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1008 no_tcl=true
1009 AC_MSG_CHECKING(for Tcl headers in the source tree)
1010 AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl headers are], with_tclinclude=${withval})
1011 AC_CACHE_VAL(ac_cv_c_tclh,[
1012 dnl first check to see if --with-tclinclude was specified
1013 if test x"${with_tclinclude}" != x ; then
1014 if test -f ${with_tclinclude}/tcl.h ; then
1015 ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
1016 elif test -f ${with_tclinclude}/generic/tcl.h ; then
1017 ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
1018 else
1019 AC_MSG_ERROR([${with_tclinclude} directory doesn't contain headers])
1020 fi
1021 fi
1022
1023 dnl next check if it came with Tcl configuration file
1024 if test x"${ac_cv_c_tclconfig}" != x ; then
1025 for i in $dirlist; do
1026 if test -f $ac_cv_c_tclconfig/$i/generic/tcl.h ; then
1027 ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/$i/generic; pwd)`
1028 break
1029 fi
1030 done
1031 fi
1032
1033 dnl next check in private source directory
1034 dnl since ls returns lowest version numbers first, reverse its output
1035 if test x"${ac_cv_c_tclh}" = x ; then
1036 dnl find the top level Tcl source directory
1037 for i in $dirlist; do
1038 if test -n "`ls -dr $srcdir/$i/tcl* 2>/dev/null`" ; then
1039 tclpath=$srcdir/$i
1040 break
1041 fi
1042 done
1043
1044 dnl find the exact Tcl source dir. We do it this way, cause there
1045 dnl might be multiple version of Tcl, and we want the most recent one.
1046 for i in `ls -dr $tclpath/tcl* 2>/dev/null ` ; do
1047 if test -f $i/generic/tcl.h ; then
1048 ac_cv_c_tclh=`(cd $i/generic; pwd)`
1049 break
1050 fi
1051 done
1052 fi
1053
1054 dnl check if its installed with the compiler
1055 if test x"${ac_cv_c_tclh}" = x ; then
1056 dnl Get the path to the compiler
1057 ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/include
1058 if test -f $ccpath/tcl.h; then
1059 ac_cv_c_tclh=$ccpath
1060 fi
1061 fi
1062
1063 dnl see if one is installed
1064 if test x"${ac_cv_c_tclh}" = x ; then
1065 AC_MSG_RESULT(none)
1066 AC_CHECK_HEADER(tcl.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
1067 else
1068 AC_MSG_RESULT(${ac_cv_c_tclh})
1069 fi
1070 ])
1071 TCLHDIR=""
1072 if test x"${ac_cv_c_tclh}" = x ; then
1073 AC_MSG_ERROR([Can't find any Tcl headers])
1074 fi
1075 if test x"${ac_cv_c_tclh}" != x ; then
1076 no_tcl=""
1077 if test x"${ac_cv_c_tclh}" != x"installed" ; then
1078 AC_MSG_RESULT(${ac_cv_c_tclh})
1079 TCLHDIR="-I${ac_cv_c_tclh}"
1080 fi
1081 fi
1082
1083 AC_SUBST(TCLHDIR)
1084 ])
1085
1086 dnl ====================================================================
1087 dnl Ok, lets find the tcl configuration
1088 AC_DEFUN(CYG_AC_PATH_TCLCONFIG, [
1089 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1090 dnl First, look for one uninstalled.
1091 dnl the alternative search directory is invoked by --with-tclconfig
1092 if test x"${no_tcl}" = x ; then
1093 dnl we reset no_tcl in case something fails here
1094 no_tcl=true
1095 AC_ARG_WITH(tclconfig, [ --with-tclconfig directory containing tcl configuration (tclConfig.sh)],
1096 with_tclconfig=${withval})
1097 AC_MSG_CHECKING([for Tcl configuration script])
1098 AC_CACHE_VAL(ac_cv_c_tclconfig,[
1099
1100 dnl First check to see if --with-tclconfig was specified.
1101 if test x"${with_tclconfig}" != x ; then
1102 if test -f "${with_tclconfig}/tclConfig.sh" ; then
1103 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
1104 else
1105 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
1106 fi
1107 fi
1108
1109 dnl next check if it came with Tcl configuration file in the source tree
1110 if test x"${ac_cv_c_tclconfig}" = x ; then
1111 for i in $dirlist; do
1112 if test -f $srcdir/$i/unix/tclConfig.sh ; then
1113 ac_cv_c_tclconfig=`(cd $srcdir/$i/unix; pwd)`
1114 break
1115 fi
1116 done
1117 fi
1118 dnl check in a few other locations
1119 if test x"${ac_cv_c_tclconfig}" = x ; then
1120 dnl find the top level Tcl source directory
1121 for i in $dirlist; do
1122 if test -n "`ls -dr $i/tcl* 2>/dev/null`" ; then
1123 tclconfpath=$i
1124 break
1125 fi
1126 done
1127
1128 dnl find the exact Tcl dir. We do it this way, cause there
1129 dnl might be multiple version of Tcl, and we want the most recent one.
1130 for i in `ls -dr $tclconfpath/tcl* 2>/dev/null ` ; do
1131 if test -f $i/unix/tclConfig.sh ; then
1132 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
1133 break
1134 fi
1135 done
1136 fi
1137
1138 dnl Check to see if it's installed. We have to look in the $CC path
1139 dnl to find it, cause our $prefix may not match the compilers.
1140 if test x"${ac_cv_c_tclconfig}" = x ; then
1141 dnl Get the path to the compiler
1142 ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib
1143 if test -f $ccpath/tclConfig.sh; then
1144 ac_cv_c_tclconfig=$ccpath
1145 fi
1146 fi
1147 ]) dnl end of cache_val
1148
1149 if test x"${ac_cv_c_tclconfig}" = x ; then
1150 TCLCONFIG=""
1151 AC_MSG_WARN(Can't find Tcl configuration definitions)
1152 else
1153 no_tcl=""
1154 TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
1155 AC_MSG_RESULT(${TCLCONFIG})
1156 fi
1157 fi
1158 AC_SUBST(TCLCONFIG)
1159 ])
1160
1161 dnl Defined as a separate macro so we don't have to cache the values
1162 dnl from PATH_TCLCONFIG (because this can also be cached).
1163 AC_DEFUN(CYG_AC_LOAD_TCLCONFIG, [
1164 . $TCLCONFIG
1165
1166 dnl AC_SUBST(TCL_VERSION)
1167 dnl AC_SUBST(TCL_MAJOR_VERSION)
1168 dnl AC_SUBST(TCL_MINOR_VERSION)
1169 dnl AC_SUBST(TCL_CC)
1170 AC_SUBST(TCL_DEFS)
1171
1172 dnl not used, don't export to save symbols
1173 dnl AC_SUBST(TCL_LIB_FILE)
1174 AC_SUBST(TCL_LIBS)
1175 dnl not used, don't export to save symbols
1176 dnl AC_SUBST(TCL_PREFIX)
1177
1178 dnl not used, don't export to save symbols
1179 dnl AC_SUBST(TCL_EXEC_PREFIX)
1180
1181 AC_SUBST(TCL_SHLIB_CFLAGS)
1182 AC_SUBST(TCL_SHLIB_LD)
1183 dnl don't export, not used outside of configure
1184 dnl AC_SUBST(TCL_SHLIB_LD_LIBS)
1185 dnl AC_SUBST(TCL_SHLIB_SUFFIX)
1186 dnl not used, don't export to save symbols
1187 dnl AC_SUBST(TCL_DL_LIBS)
1188 AC_SUBST(TCL_LD_FLAGS)
1189 AC_SUBST(TCL_LD_SEARCH_FLAGS)
1190 dnl don't export, not used outside of configure
1191 dnl AC_SUBST(TCL_COMPAT_OBJS)
1192 AC_SUBST(TCL_RANLIB)
1193 AC_SUBST(TCL_BUILD_LIB_SPEC)
1194 AC_SUBST(TCL_LIB_SPEC)
1195 dnl AC_SUBST(TCL_LIB_VERSIONS_OK)
1196
1197 dnl not used, don't export to save symbols
1198 dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
1199
1200 dnl not used, don't export to save symbols
1201 dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
1202 ])
1203
1204 dnl ====================================================================
1205 AC_DEFUN(CYG_AC_PATH_TK, [
1206 CYG_AC_PATH_TKH
1207 CYG_AC_PATH_TKCONFIG
1208 CYG_AC_LOAD_TKCONFIG
1209 ])
1210 AC_DEFUN(CYG_AC_PATH_TKH, [
1211 #
1212 # Ok, lets find the tk source trees so we can use the headers
1213 # If the directory (presumably symlink) named "tk" exists, use that one
1214 # in preference to any others. Same logic is used when choosing library
1215 # and again with Tcl. The search order is the best place to look first, then in
1216 # decreasing significance. The loop breaks if the trigger file is found.
1217 # Note the gross little conversion here of srcdir by cd'ing to the found
1218 # directory. This converts the path from a relative to an absolute, so
1219 # recursive cache variables for the path will work right. We check all
1220 # the possible paths in one loop rather than many seperate loops to speed
1221 # things up.
1222 # the alternative search directory is involked by --with-tkinclude
1223 #
1224 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1225 no_tk=true
1226 AC_MSG_CHECKING(for Tk headers in the source tree)
1227 AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where tk headers are], with_tkinclude=${withval})
1228 AC_CACHE_VAL(ac_cv_c_tkh,[
1229 dnl first check to see if --with-tkinclude was specified
1230 if test x"${with_tkinclude}" != x ; then
1231 if test -f ${with_tkinclude}/tk.h ; then
1232 ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
1233 elif test -f ${with_tkinclude}/generic/tk.h ; then
1234 ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
1235 else
1236 AC_MSG_ERROR([${with_tkinclude} directory doesn't contain headers])
1237 fi
1238 fi
1239
1240 dnl next check if it came with Tk configuration file
1241 if test x"${ac_cv_c_tkconfig}" != x ; then
1242 for i in $dirlist; do
1243 if test -f $ac_cv_c_tkconfig/$i/generic/tk.h ; then
1244 ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/$i/generic; pwd)`
1245 break
1246 fi
1247 done
1248 fi
1249
1250 dnl next check in private source directory
1251 dnl since ls returns lowest version numbers first, reverse its output
1252 if test x"${ac_cv_c_tkh}" = x ; then
1253 dnl find the top level Tk source directory
1254 for i in $dirlist; do
1255 if test -n "`ls -dr $srcdir/$i/tk* 2>/dev/null`" ; then
1256 tkpath=$srcdir/$i
1257 break
1258 fi
1259 done
1260
1261 dnl find the exact Tk source dir. We do it this way, cause there
1262 dnl might be multiple version of Tk, and we want the most recent one.
1263 for i in `ls -dr $tkpath/tk* 2>/dev/null ` ; do
1264 if test -f $i/generic/tk.h ; then
1265 ac_cv_c_tkh=`(cd $i/generic; pwd)`
1266 break
1267 fi
1268 done
1269 fi
1270
1271 dnl see if one is installed
1272 if test x"${ac_cv_c_tkh}" = x ; then
1273 AC_MSG_RESULT(none)
1274 dnl Get the path to the compiler. We do it this way instead of using
1275 dnl AC_CHECK_HEADER, cause this doesn't depend in having X configured.
1276 ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/include
1277 if test -f $ccpath/tk.h; then
1278 ac_cv_c_tkh=$ccpath
1279 fi
1280 else
1281 AC_MSG_RESULT(${ac_cv_c_tkh})
1282 fi
1283 ])
1284 TKHDIR=""
1285 if test x"${ac_cv_c_tkh}" = x ; then
1286 AC_MSG_ERROR([Can't find any Tk headers])
1287 fi
1288 if test x"${ac_cv_c_tkh}" != x ; then
1289 no_tk=""
1290 if test x"${ac_cv_c_tkh}" != x"installed" ; then
1291 AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
1292 TKHDIR="-I${ac_cv_c_tkh}"
1293 fi
1294 fi
1295
1296 AC_SUBST(TKHDIR)
1297 ])
1298
1299 AC_DEFUN(CYG_AC_PATH_TKCONFIG, [
1300 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1301 dnl First, look for one uninstalled.
1302 dnl the alternative search directory is invoked by --with-tkconfig
1303 if test x"${no_tk}" = x ; then
1304 dnl we reset no_tk in case something fails here
1305 no_tk=true
1306 AC_ARG_WITH(tkconfig, [ --with-tkconfig directory containing tk configuration (tkConfig.sh)],
1307 with_tkconfig=${withval})
1308 AC_MSG_CHECKING([for Tk configuration script])
1309 AC_CACHE_VAL(ac_cv_c_tkconfig,[
1310
1311 dnl First check to see if --with-tkconfig was specified.
1312 if test x"${with_tkconfig}" != x ; then
1313 if test -f "${with_tkconfig}/tkConfig.sh" ; then
1314 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
1315 else
1316 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
1317 fi
1318 fi
1319
1320 dnl next check if it came with Tk configuration file in the source tree
1321 if test x"${ac_cv_c_tkconfig}" = x ; then
1322 for i in $dirlist; do
1323 if test -f $srcdir/$i/unix/tkConfig.sh ; then
1324 ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; pwd)`
1325 break
1326 fi
1327 done
1328 fi
1329 dnl check in a few other locations
1330 if test x"${ac_cv_c_tkconfig}" = x ; then
1331 dnl find the top level Tk source directory
1332 for i in $dirlist; do
1333 if test -n "`ls -dr $i/tk* 2>/dev/null`" ; then
1334 tkconfpath=$i
1335 break
1336 fi
1337 done
1338
1339 dnl find the exact Tk dir. We do it this way, cause there
1340 dnl might be multiple version of Tk, and we want the most recent one.
1341 for i in `ls -dr $tkconfpath/tk* 2>/dev/null ` ; do
1342 if test -f $i/unix/tkConfig.sh ; then
1343 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
1344 break
1345 fi
1346 done
1347 fi
1348
1349 dnl Check to see if it's installed. We have to look in the $CC path
1350 dnl to find it, cause our $prefix may not match the compilers.
1351 if test x"${ac_cv_c_tkconfig}" = x ; then
1352 dnl Get the path to the compiler
1353 ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib
1354 if test -f $ccpath/tkConfig.sh; then
1355 ac_cv_c_tkconfig=$ccpath
1356 fi
1357 fi
1358 ]) dnl end of cache_val
1359
1360 if test x"${ac_cv_c_tkconfig}" = x ; then
1361 TKCONFIG=""
1362 AC_MSG_WARN(Can't find Tk configuration definitions)
1363 else
1364 no_tk=""
1365 TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
1366 AC_MSG_RESULT(${TKCONFIG})
1367 fi
1368 fi
1369 AC_SUBST(TKCONFIG)
1370 ])
1371
1372 dnl Defined as a separate macro so we don't have to cache the values
1373 dnl from PATH_TKCONFIG (because this can also be cached).
1374 AC_DEFUN(CYG_AC_LOAD_TKCONFIG, [
1375 if test -f "$TKCONFIG" ; then
1376 . $TKCONFIG
1377 fi
1378
1379 AC_SUBST(TK_VERSION)
1380 dnl not actually used, don't export to save symbols
1381 dnl AC_SUBST(TK_MAJOR_VERSION)
1382 dnl AC_SUBST(TK_MINOR_VERSION)
1383 AC_SUBST(TK_DEFS)
1384
1385 dnl not used, don't export to save symbols
1386 dnl AC_SUBST(TK_LIB_FILE)
1387
1388 AC_SUBST(TK_LIBS)
1389 dnl not used, don't export to save symbols
1390 dnl AC_SUBST(TK_PREFIX)
1391
1392 dnl not used, don't export to save symbols
1393 dnl AC_SUBST(TK_EXEC_PREFIX)
1394 AC_SUBST(TK_BUILD_INCLUDES)
1395 AC_SUBST(TK_XINCLUDES)
1396 AC_SUBST(TK_XLIBSW)
1397 AC_SUBST(TK_BUILD_LIB_SPEC)
1398 AC_SUBST(TK_LIB_SPEC)
1399 ])
1400
1401 dnl ====================================================================
1402 dnl Ok, lets find the itcl source trees so we can use the headers
1403 dnl the alternative search directory is involked by --with-itclinclude
1404 AC_DEFUN(CYG_AC_PATH_ITCL, [
1405 CYG_AC_PATH_ITCLH
1406 CYG_AC_PATH_ITCLLIB
1407 CYG_AC_PATH_ITCLSH
1408 CYG_AC_PATH_ITCLMKIDX
1409 ])
1410 AC_DEFUN(CYG_AC_PATH_ITCLH, [
1411 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1412 no_itcl=true
1413 AC_MSG_CHECKING(for Itcl headers in the source tree)
1414 AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
1415 AC_CACHE_VAL(ac_cv_c_itclh,[
1416 dnl first check to see if --with-itclinclude was specified
1417 if test x"${with_itclinclude}" != x ; then
1418 if test -f ${with_itclinclude}/itcl.h ; then
1419 ac_cv_c_itclh=`(cd ${with_itclinclude}; pwd)`
1420 elif test -f ${with_itclinclude}/src/itcl.h ; then
1421 ac_cv_c_itclh=`(cd ${with_itclinclude}/src; pwd)`
1422 else
1423 AC_MSG_ERROR([${with_itclinclude} directory doesn't contain headers])
1424 fi
1425 fi
1426
1427 dnl next check if it came with Itcl configuration file
1428 if test x"${ac_cv_c_itclconfig}" != x ; then
1429 for i in $dirlist; do
1430 if test -f $ac_cv_c_itclconfig/$i/src/itcl.h ; then
1431 ac_cv_c_itclh=`(cd $ac_cv_c_itclconfig/$i/src; pwd)`
1432 break
1433 fi
1434 done
1435 fi
1436
1437 dnl next check in private source directory
1438 dnl since ls returns lowest version numbers first, reverse its output
1439 if test x"${ac_cv_c_itclh}" = x ; then
1440 dnl find the top level Itcl source directory
1441 for i in $dirlist; do
1442 if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
1443 itclpath=$srcdir/$i
1444 break
1445 fi
1446 done
1447
1448 dnl find the exact Itcl source dir. We do it this way, cause there
1449 dnl might be multiple version of Itcl, and we want the most recent one.
1450 for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
1451 if test -f $i/src/itcl.h ; then
1452 ac_cv_c_itclh=`(cd $i/src; pwd)`
1453 break
1454 fi
1455 done
1456 fi
1457
1458 dnl see if one is installed
1459 if test x"${ac_cv_c_itclh}" = x ; then
1460 AC_MSG_RESULT(none)
1461 AC_CHECK_HEADER(itcl.h, ac_cv_c_itclh=installed, ac_cv_c_itclh="")
1462 else
1463 AC_MSG_RESULT(${ac_cv_c_itclh})
1464 fi
1465 ])
1466 ITCLHDIR=""
1467 if test x"${ac_cv_c_itclh}" = x ; then
1468 AC_MSG_ERROR([Can't find any Itcl headers])
1469 fi
1470 if test x"${ac_cv_c_itclh}" != x ; then
1471 no_itcl=""
1472 if test x"${ac_cv_c_itclh}" != x"installed" ; then
1473 AC_MSG_RESULT(${ac_cv_c_itclh})
1474 ITCLHDIR="-I${ac_cv_c_itclh}"
1475 fi
1476 fi
1477
1478 AC_SUBST(ITCLHDIR)
1479 ])
1480
1481 dnl Ok, lets find the itcl library
1482 dnl First, look for one uninstalled.
1483 dnl the alternative search directory is invoked by --with-itcllib
1484 AC_DEFUN(CYG_AC_PATH_ITCLLIB, [
1485 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1486 if test x"${no_itcl}" = x ; then
1487 dnl we reset no_itcl incase something fails here
1488 no_itcl=true
1489 AC_ARG_WITH(itcllib,
1490 [ --with-itcllib directory where the itcl library is],
1491 with_itcllib=${withval})
1492 AC_MSG_CHECKING([for Itcl library])
1493 AC_CACHE_VAL(ac_cv_c_itcllib,[
1494 dnl First check to see if --with-itcllib was specified.
1495 if test x"${with_itcllib}" != x ; then
1496 if test -f "${with_itcllib}/libitcl$TCL_SHARED_LIB_SUFFIX" ; then
1497 ac_cv_c_itcllib=`(cd ${with_itcllib}; pwd)`/libitcl$TCL_SHARED_LIB_SUFFIX
1498 else
1499 if test -f "${with_itcllib}/libitcl$TCL_UNSHARED_LIB_SUFFIX"; then
1500 ac_cv_c_itcllib=`(cd ${with_itcllib}; pwd)`/libitcl$TCL_UNSHARED_LIB_SUFFIX
1501 fi
1502 fi
1503 fi
1504 dnl then check for a Itcl library. Since these are uninstalled,
1505 dnl use the simple lib name root.
1506 if test x"${ac_cv_c_itcllib}" = x ; then
1507 dnl find the top level Itcl build directory
1508 for i in $dirlist; do
1509 if test -n "`ls -dr $i/itcl* 2>/dev/null`" ; then
1510 itclpath=$i/itcl
1511 break
1512 fi
1513 done
1514 dnl Itcl 7.5 and greater puts library in subdir. Look there first.
1515 if test -f "$itclpath/src/libitcl.$TCL_SHLIB_SUFFIX" ; then
1516 ac_cv_c_itcllib=`(cd $itclpath/src; pwd)`
1517 elif test -f "$itclpath/src/libitcl.a"; then
1518 ac_cv_c_itcllib=`(cd $itclpath/src; pwd)`
1519 fi
1520 fi
1521 dnl check in a few other private locations
1522 if test x"${ac_cv_c_itcllib}" = x ; then
1523 for i in ${dirlist}; do
1524 if test -n "`ls -dr ${srcdir}/$i/itcl* 2>/dev/null`" ; then
1525 itclpath=${srcdir}/$i
1526 break
1527 fi
1528 done
1529 for i in `ls -dr ${itclpath}/itcl* 2>/dev/null` ; do
1530 dnl Itcl 7.5 and greater puts library in subdir. Look there first.
1531 if test -f "$i/src/libitcl$TCL_SHLIB_SUFFIX" ; then
1532 ac_cv_c_itcllib=`(cd $i/src; pwd)`
1533 break
1534 elif test -f "$i/src/libitcl.a"; then
1535 ac_cv_c_itcllib=`(cd $i/src; pwd)`
1536 break
1537 fi
1538 done
1539 fi
1540
1541 dnl see if one is conveniently installed with the compiler
1542 if test x"${ac_cv_c_itcllib}" = x ; then
1543 dnl Get the path to the compiler
1544 ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib
1545 dnl Itcl 7.5 and greater puts library in subdir. Look there first.
1546 if test -f "${ccpath}/libitcl$TCL_SHLIB_SUFFIX" ; then
1547 ac_cv_c_itcllib=`(cd ${ccpath}; pwd)`
1548 elif test -f "${ccpath}/libitcl.a"; then
1549 ac_cv_c_itcllib=`(cd ${ccpath}; pwd)`
1550 fi
1551 fi
1552 ])
1553 if test x"${ac_cv_c_itcllib}" = x ; then
1554 ITCLLIB=""
1555 AC_MSG_WARN(Can't find Itcl library)
1556 else
1557 ITCLLIB="-L${ac_cv_c_itcllib}"
1558 AC_MSG_RESULT(${ac_cv_c_itcllib})
1559 no_itcl=""
1560 fi
1561 fi
1562
1563 AC_PROVIDE([$0])
1564 AC_SUBST(ITCLLIB)
1565 ])
1566
1567
1568 dnl ====================================================================
1569 dnl Ok, lets find the itcl source trees so we can use the itcl_sh script
1570 dnl the alternative search directory is involked by --with-itclinclude
1571 AC_DEFUN(CYG_AC_PATH_ITCLSH, [
1572 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1573 no_itcl=true
1574 AC_MSG_CHECKING(for the itcl_sh script)
1575 AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
1576 AC_CACHE_VAL(ac_cv_c_itclsh,[
1577 dnl first check to see if --with-itclinclude was specified
1578 if test x"${with_itclinclude}" != x ; then
1579 if test -f ${with_itclinclude}/itcl_sh ; then
1580 ac_cv_c_itclsh=`(cd ${with_itclinclude}; pwd)`
1581 elif test -f ${with_itclinclude}/src/itcl_sh ; then
1582 ac_cv_c_itclsh=`(cd ${with_itclinclude}/src; pwd)`
1583 else
1584 AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
1585 fi
1586 fi
1587
1588 dnl next check in private source directory
1589 dnl since ls returns lowest version numbers first, reverse its output
1590 if test x"${ac_cv_c_itclsh}" = x ; then
1591 dnl find the top level Itcl source directory
1592 for i in $dirlist; do
1593 if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
1594 itclpath=$srcdir/$i
1595 break
1596 fi
1597 done
1598
1599 dnl find the exact Itcl source dir. We do it this way, cause there
1600 dnl might be multiple version of Itcl, and we want the most recent one.
1601 for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
1602 if test -f $i/src/itcl_sh ; then
1603 ac_cv_c_itclsh=`(cd $i/src; pwd)`/itcl_sh
1604 break
1605 fi
1606 done
1607 fi
1608
1609 dnl see if one is installed
1610 if test x"${ac_cv_c_itclsh}" = x ; then
1611 AC_MSG_RESULT(none)
1612 AC_PATH_PROG(ac_cv_c_itclsh, itcl_sh)
1613 else
1614 AC_MSG_RESULT(${ac_cv_c_itclsh})
1615 fi
1616 ])
1617
1618 if test x"${ac_cv_c_itclsh}" = x ; then
1619 AC_MSG_ERROR([Can't find the itcl_sh script])
1620 fi
1621 if test x"${ac_cv_c_itclsh}" != x ; then
1622 no_itcl=""
1623 AC_MSG_RESULT(${ac_cv_c_itclsh})
1624 ITCLSH="${ac_cv_c_itclsh}"
1625 fi
1626 AC_SUBST(ITCLSH)
1627 ])
1628
1629
1630 dnl ====================================================================
1631 dnl Ok, lets find the itcl source trees so we can use the itcl_sh script
1632 dnl the alternative search directory is involked by --with-itclinclude
1633 AC_DEFUN(CYG_AC_PATH_ITCLMKIDX, [
1634 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1635 no_itcl=true
1636 AC_MSG_CHECKING(for itcl_mkindex.tcl script)
1637 AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
1638 AC_CACHE_VAL(ac_cv_c_itclmkidx,[
1639 dnl first check to see if --with-itclinclude was specified
1640 if test x"${with_itclinclude}" != x ; then
1641 if test -f ${with_itclinclude}/itcl_sh ; then
1642 ac_cv_c_itclmkidx=`(cd ${with_itclinclude}; pwd)`
1643 elif test -f ${with_itclinclude}/src/itcl_sh ; then
1644 ac_cv_c_itclmkidx=`(cd ${with_itclinclude}/src; pwd)`
1645 else
1646 AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
1647 fi
1648 fi
1649
1650 dnl next check in private source directory
1651 dnl since ls returns lowest version numbers first, reverse its output
1652 if test x"${ac_cv_c_itclmkidx}" = x ; then
1653 dnl find the top level Itcl source directory
1654 for i in $dirlist; do
1655 if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
1656 itclpath=$srcdir/$i
1657 break
1658 fi
1659 done
1660
1661 dnl find the exact Itcl source dir. We do it this way, cause there
1662 dnl might be multiple version of Itcl, and we want the most recent one.
1663 for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
1664 if test -f $i/library/itcl_mkindex.tcl ; then
1665 ac_cv_c_itclmkidx=`(cd $i/library; pwd)`/itcl_mkindex.tcl
1666 break
1667 fi
1668 done
1669 fi
1670 if test x"${ac_cv_c_itclmkidx}" = x ; then
1671 dnl Get the path to the compiler
1672 ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/share
1673 dnl Itcl 7.5 and greater puts library in subdir. Look there first.
1674 for i in `ls -dr $ccpath/itcl* 2>/dev/null ` ; do
1675 if test -f $i/itcl_mkindex.tcl ; then
1676 ac_cv_c_itclmkidx=`(cd $i; pwd)`/itcl_mkindex.tcl
1677 break
1678 fi
1679 done
1680 fi
1681 ])
1682
1683 if test x"${ac_cv_c_itclmkidx}" = x ; then
1684 AC_MSG_ERROR([Can't find the itcl_mkindex.tcl script])
1685 fi
1686 if test x"${ac_cv_c_itclmkidx}" != x ; then
1687 no_itcl=""
1688 AC_MSG_RESULT(${ac_cv_c_itclmkidx})
1689 ITCLMKIDX="${ac_cv_c_itclmkidx}"
1690 else
1691 AC_MSG_RESULT(none)
1692 fi
1693 AC_SUBST(ITCLMKIDX)
1694 ])
1695
1696 dnl ====================================================================
1697 dnl Ok, lets find the tix source trees so we can use the headers
1698 dnl the alternative search directory is involked by --with-tixinclude
1699 AC_DEFUN(CYG_AC_PATH_TIX, [
1700 CYG_AC_PATH_TIXH
1701 CYG_AC_PATH_TIXLIB
1702 ])
1703 AC_DEFUN(CYG_AC_PATH_TIXH, [
1704 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1705 no_tix=true
1706 AC_MSG_CHECKING(for Tix headers in the source tree)
1707 AC_ARG_WITH(tixinclude, [ --with-tixinclude directory where tix headers are], with_tixinclude=${withval})
1708 AC_CACHE_VAL(ac_cv_c_tixh,[
1709 dnl first check to see if --with-tixinclude was specified
1710 if test x"${with_tixinclude}" != x ; then
1711 if test -f ${with_tixinclude}/tix.h ; then
1712 ac_cv_c_tixh=`(cd ${with_tixinclude}; pwd)`
1713 elif test -f ${with_tixinclude}/generic/tix.h ; then
1714 ac_cv_c_tixh=`(cd ${with_tixinclude}/generic; pwd)`
1715 else
1716 AC_MSG_ERROR([${with_tixinclude} directory doesn't contain headers])
1717 fi
1718 fi
1719
1720 dnl next check if it came with Tix configuration file
1721 if test x"${ac_cv_c_tixconfig}" != x ; then
1722 for i in $dirlist; do
1723 if test -f $ac_cv_c_tixconfig/$i/generic/tix.h ; then
1724 ac_cv_c_tixh=`(cd $ac_cv_c_tixconfig/$i/generic; pwd)`
1725 break
1726 fi
1727 done
1728 fi
1729
1730 dnl next check in private source directory
1731 dnl since ls returns lowest version numbers first, reverse its output
1732 if test x"${ac_cv_c_tixh}" = x ; then
1733 dnl find the top level Tix source directory
1734 for i in $dirlist; do
1735 if test -n "`ls -dr $srcdir/$i/tix* 2>/dev/null`" ; then
1736 tixpath=$srcdir/$i
1737 break
1738 fi
1739 done
1740
1741 dnl find the exact Tix source dir. We do it this way, cause there
1742 dnl might be multiple version of Tix, and we want the most recent one.
1743 for i in `ls -dr $tixpath/tix* 2>/dev/null ` ; do
1744 if test -f $i/generic/tix.h ; then
1745 ac_cv_c_tixh=`(cd $i/generic; pwd)`
1746 break
1747 fi
1748 done
1749 fi
1750
1751 dnl see if one is installed
1752 if test x"${ac_cv_c_tixh}" = x ; then
1753 AC_MSG_RESULT(none)
1754 dnl Get the path to the compiler
1755
1756 dnl Get the path to the compiler. We do it this way instead of using
1757 dnl AC_CHECK_HEADER, cause this doesn't depend in having X configured.
1758 ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/include
1759 if test -f $ccpath/tix.h; then
1760 ac_cv_c_tixh=installed
1761 fi
1762 else
1763 AC_MSG_RESULT(${ac_cv_c_tixh})
1764 fi
1765 ])
1766 if test x"${ac_cv_c_tixh}" = x ; then
1767 AC_MSG_ERROR([Can't find any Tix headers])
1768 fi
1769 if test x"${ac_cv_c_tixh}" != x ; then
1770 no_tix=""
1771 AC_MSG_RESULT(${ac_cv_c_tixh})
1772 if test x"${ac_cv_c_tixh}" != x"installed" ; then
1773 TIXHDIR="-I${ac_cv_c_tixh}"
1774 fi
1775 fi
1776
1777 AC_SUBST(TIXHDIR)
1778 ])
1779
1780
1781 dnl Ok, lets find the tix library
1782 dnl First, look for one uninstalled.
1783 dnl the alternative search directory is invoked by --with-tixlib
1784 AC_DEFUN(CYG_AC_PATH_TIXLIB, [
1785 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1786 if test x"${no_tcl}" = x; then
1787 dnl we reset no_tix incase something fails here
1788 no_tix=true
1789 AC_ARG_WITH(tixlib,
1790 [ --with-tixlib directory where the tix library is],
1791 with_tixlib=${withval})
1792 AC_MSG_CHECKING([for Tix library])
1793 AC_CACHE_VAL(ac_cv_c_tixlib,[
1794 dnl First check to see if --with-tixlib was specified.
1795 if test x"${with_tixlib}" != x ; then
1796 if test -f "${with_tixlib}/libtix${TCL_SHARED_LIB_SUFFIX}" ; then
1797 ac_cv_c_tixlib=`(cd ${with_tixlib}; pwd)`/libtix${TCL_SHARED_LIB_SUFFIX}
1798 else
1799 if test -f "${with_tixlib}/libtix${TCL_UNSHARED_LIB_SUFFIX}"; then
1800 ac_cv_c_tixlib=`(cd ${with_tixlib}; pwd)`/libtix${TCL_UNSHARED_LIB_SUFFIX}
1801 fi
1802 fi
1803 fi
1804
1805 dnl then check for a Tix library. Since these are uninstalled,
1806 if test x"${ac_cv_c_tixlib}" = x ; then
1807 dnl find the top level Tix build directory
1808 for i in ${dirlist}; do
1809 if test -n "`ls -dr $i/tix* 2>/dev/null`" ; then
1810 tixpath="$i/tix/unix/tk${TK_VERSION}"
1811 break
1812 fi
1813 done
1814 if test x"${tixpath}" != x; then
1815 tixversion=`grep "^TIX_VERSION" ${tixpath}/Makefile | sed -e 's:TIX_VERSION = ::'`
1816 if test -f "${tixpath}/libtix${tixversion}.${TCL_VERSION}${TCL_SHLIB_SUFFIX}" ; then
1817 ac_cv_c_tixlib=`(cd $tixpath; pwd)`/libtix${tixversion}.${TCL_VERSION}${TCL_SHLIB_SUFFIX}
1818 else
1819 if test -f "${tixpath}/libtix${tixversion}.${TCL_VERSION}.a" ; then
1820 ac_cv_c_tixlib=`(cd ${tixpath}; pwd)`/libtix${tixversion}.${TCL_VERSION}.a
1821 fi
1822 fi
1823 fi
1824 fi
1825
1826 dnl see if one is conveniently installed with the compiler
1827 if test x"${ac_cv_c_tixlib}" = x ; then
1828 dnl Get the path to the compiler
1829 ccpath=`which ${CC} | sed -e 's:/bin/.*::'`/lib
1830 changequote(,)
1831 for i in `ls -dr $ccpath/libtix[0-9]* 2>/dev/null ` ; do
1832 changequote([,])
1833 if test -f $i ; then
1834 ac_cv_c_tixlib=$i
1835 break
1836 fi
1837 done
1838 fi
1839 ])
1840 if test x"${ac_cv_c_tixlib}" = x ; then
1841 TK_BUILD_LIB_SPEC=""
1842 AC_MSG_WARN(Can't find Tix library)
1843 else
1844 changequote(,)
1845 libname=`echo "${ac_cv_c_tixlib}" | sed -e 's:.*tk[0-9\.]*/lib::' -e 's:.*lib/lib::' -e 's:\.a::'`
1846 changequote([,])
1847 if test x"${ccpath}" != x ; then
1848 TIX_BUILD_LIB_SPEC="-l${libname}"
1849 else
1850 libpath=`echo "${ac_cv_c_tixlib}" | sed -e 's:libtix.*::'`
1851 TIX_BUILD_LIB_SPEC="-L${libpath} -l${libname}"
1852 fi
1853 AC_MSG_RESULT(${ac_cv_c_tixlib})
1854 no_tix=""
1855 fi
1856 fi
1857
1858 AC_PROVIDE([$0])
1859 AC_SUBST(TIXLIB)
1860 AC_SUBST(TIX_VERSION)
1861 AC_SUBST(TIX_BUILD_LIB_SPEC)
1862 ])
1863
1864 dnl ====================================================================
1865 dnl Ok, lets find the libgui source trees so we can use the headers
1866 dnl the alternative search directory is involked by --with-libguiinclude
1867 AC_DEFUN(CYG_AC_PATH_LIBGUI, [
1868 CYG_AC_PATH_LIBGUIH
1869 CYG_AC_PATH_LIBGUILIB
1870 ])
1871 AC_DEFUN(CYG_AC_PATH_LIBGUIH, [
1872 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../..../../../../../../../../../../.."
1873 no_libgui=true
1874 AC_MSG_CHECKING(for Libgui headers in the source tree)
1875 AC_ARG_WITH(libguiinclude, [ --with-libguiinclude directory where libgui headers are], with_libguiinclude=${withval})
1876 AC_CACHE_VAL(ac_cv_c_libguih,[
1877 dnl first check to see if --with-libguiinclude was specified
1878 if test x"${with_libguiinclude}" != x ; then
1879 if test -f ${with_libguiinclude}/guitcl.h ; then
1880 ac_cv_c_libguih=`(cd ${with_libguiinclude}; pwd)`
1881 elif test -f ${with_libguiinclude}/src/guitcl.h ; then
1882 ac_cv_c_libguih=`(cd ${with_libguiinclude}/src; pwd)`
1883 else
1884 AC_MSG_ERROR([${with_libguiinclude} directory doesn't contain headers])
1885 fi
1886 fi
1887
1888 dnl next check if it came with Libgui configuration file
1889 if test x"${ac_cv_c_libguiconfig}" != x ; then
1890 for i in $dirlist; do
1891 if test -f $ac_cv_c_libguiconfig/$i/src/guitcl.h ; then
1892 ac_cv_c_libguih=`(cd $ac_cv_c_libguiconfig/$i/src; pwd)`
1893 break
1894 fi
1895 done
1896 fi
1897
1898 dnl next check in private source directory
1899 dnl since ls returns lowest version numbers first, reverse its output
1900 if test x"${ac_cv_c_libguih}" = x ; then
1901 dnl find the top level Libgui source directory
1902 for i in $dirlist; do
1903 if test -n "`ls -dr $srcdir/$i/libgui* 2>/dev/null`" ; then
1904 libguipath=$srcdir/$i
1905 break
1906 fi
1907 done
1908
1909 dnl find the exact Libgui source dir. We do it this way, cause there
1910 dnl might be multiple version of Libgui, and we want the most recent one.
1911 for i in `ls -dr $libguipath/libgui* 2>/dev/null ` ; do
1912 if test -f $i/src/guitcl.h ; then
1913 ac_cv_c_libguih=`(cd $i/src; pwd)`
1914 break
1915 fi
1916 done
1917 fi
1918
1919 dnl see if one is installed
1920 if test x"${ac_cv_c_libguih}" = x ; then
1921 AC_MSG_RESULT(none)
1922 AC_CHECK_HEADER(guitcl.h, ac_cv_c_libguih=installed, ac_cv_c_libguih="")
1923 fi
1924 ])
1925 LIBGUIHDIR=""
1926 if test x"${ac_cv_c_libguih}" = x ; then
1927 AC_MSG_WARN([Can't find any Libgui headers])
1928 fi
1929 if test x"${ac_cv_c_libguih}" != x ; then
1930 no_libgui=""
1931 if test x"${ac_cv_c_libguih}" != x"installed" ; then
1932 LIBGUIHDIR="-I${ac_cv_c_libguih}"
1933 fi
1934 fi
1935 AC_MSG_RESULT(${ac_cv_c_libguih})
1936 AC_SUBST(LIBGUIHDIR)
1937 ])
1938
1939 dnl ====================================================================
1940 dnl find the GUI library
1941 AC_DEFUN(CYG_AC_PATH_LIBGUILIB, [
1942 AC_MSG_CHECKING(for GUI library in the build tree)
1943 dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1944 dnl look for the library
1945 AC_MSG_CHECKING(for GUI library)
1946 AC_CACHE_VAL(ac_cv_c_libguilib,[
1947 if test x"${ac_cv_c_libguilib}" = x ; then
1948 for i in $dirlist; do
1949 if test -f "$i/libgui/src/Makefile" ; then
1950 ac_cv_c_libguilib=`(cd $i/libgui/src; pwd)`
1951 break
1952 fi
1953 done
1954 fi
1955 ])
1956 if test x"${ac_cv_c_libguilib}" != x ; then
1957 GUILIB="${GUILIB} -L${ac_cv_c_libguilib}"
1958 LIBGUILIB="-lgui"
1959 AC_MSG_RESULT(${ac_cv_c_libguilib})
1960 else
1961 AC_MSG_RESULT(none)
1962 fi
1963
1964 AC_SUBST(GUILIB)
1965 AC_SUBST(LIBGUILIB)
1966 ])
This page took 0.07337 seconds and 5 git commands to generate.