]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - config/acinclude.m4
* config/sh/tm-sh.h (BELIEVE_PCC_PROMOTION): Define, so that
[thirdparty/binutils-gdb.git] / config / acinclude.m4
CommitLineData
33ab98f3
SP
1dnl This file is included into all any other acinclude file that needs
2dnl to use these macros.
3
4dnl This is copied from autoconf 2.12, but does calls our own AC_PROG_CC_WORKS,
5dnl and doesn't call AC_PROG_CXX_GNU, cause we test for that in AC_PROG_CC_WORKS.
6dnl We are probably using a cross compiler, which will not be able to fully
7dnl link an executable. This should really be fixed in autoconf itself.
8dnl Find a working G++ cross compiler. This only works for the GNU C++ compiler.
9AC_DEFUN(CYG_AC_PROG_CXX_CROSS,
10[AC_BEFORE([$0], [AC_PROG_CXXCPP])
11AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
12
13CYG_AC_PROG_GXX_WORKS
14
15if test $ac_cv_prog_gxx = yes; then
16 GXX=yes
17dnl Check whether -g works, even if CXXFLAGS is set, in case the package
18dnl plays around with CXXFLAGS (such as to build both debugging and
19dnl 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
31else
32 GXX=
33 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
34fi
35])
36
37dnl See if the G++ compiler we found works.
38AC_DEFUN(CYG_AC_PROG_GXX_WORKS,
39[AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually works])
40AC_LANG_SAVE
41AC_LANG_CPLUSPLUS
42dnl Try a test case. We only compile, because it's close to impossible
43dnl to get a correct fully linked executable with a cross compiler. For
44dnl most cross compilers, this test is bogus. For G++, we can use various
45dnl other compile line options to get a decent idea that the cross compiler
46dnl actually does work, even though we can't produce an executable without
47dnl more info about the target it's being compiled for. This only works
48dnl for the GNU C++ compiler.
49
50dnl Transform the name of the compiler to it's cross variant, unless
51dnl CXX is set. This is also what CXX gets set to in the generated
52dnl Makefile.
53if test x"${CXX}" = xc++ ; then
54 CXX=`echo gcc | sed -e "${program_transform_name}"`
55fi
56
57dnl Get G++'s full path to libgcc.a
58libgccpath=`${CXX} --print-libgcc`
59
60dnl If we don't have a path with libgcc.a on the end, this isn't G++.
61if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
62 ac_cv_prog_gxx=yes
63else
64 ac_cv_prog_gxx=no
65fi
66
67dnl If we are using G++, look for the files that need to exist if this
68dnl compiler works.
69if 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
82fi
83
84dnl If everything is OK, then we can safely assume the compiler works.
85if 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)
88else
89 ac_cv_prog_cxx_works=yes
90fi
91
92AC_LANG_RESTORE
93AC_MSG_RESULT($ac_cv_prog_cxx_works)
94if test x"$ac_cv_prog_cxx_works" = xno; then
95 AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
96fi
97AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
98AC_MSG_RESULT($ac_cv_prog_cxx_cross)
99cross_compiling=$ac_cv_prog_cxx_cross
100AC_SUBST(CXX)
101])
102
103dnl ====================================================================
104dnl Find a working GCC cross compiler. This only works for the GNU gcc compiler.
105dnl This is based on the macros above for G++.
106AC_DEFUN(CYG_AC_PROG_CC_CROSS,
107[AC_BEFORE([$0], [AC_PROG_CCPP])
108AC_CHECK_PROGS(CC, cc, gcc)
109
110CYG_AC_PROG_GCC_WORKS
111
112if test $ac_cv_prog_gcc = yes; then
113 GCC=yes
114dnl Check whether -g works, even if CFLAGS is set, in case the package
115dnl plays around with CFLAGS (such as to build both debugging and
116dnl 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
128else
129 GXX=
130 test "${CFLAGS+set}" = set || CFLAGS="-g"
131fi
132])
133
134dnl See if the GCC compiler we found works.
135AC_DEFUN(CYG_AC_PROG_GCC_WORKS,
136[AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) actually works])
137AC_LANG_SAVE
138AC_LANG_C
139dnl Try a test case. We only compile, because it's close to impossible
140dnl to get a correct fully linked executable with a cross
141dnl compiler. For most cross compilers, this test is bogus. For G++,
142dnl we can use various other compile line options to get a decent idea
143dnl that the cross compiler actually does work, even though we can't
144dnl produce an executable without more info about the target it's
145dnl being compiled for. This only works for the GNU C++ compiler.
146
147dnl Transform the name of the compiler to it's cross variant, unless
148dnl CXX is set. This is also what CC gets set to in the generated Makefile.
149if test x"${CC}" = xcc ; then
150 CC=`echo gcc | sed -e "${program_transform_name}"`
151fi
152
153dnl Get Gcc's full path to libgcc.a
154libgccpath=`${CC} --print-libgcc`
155
156dnl If we don't have a path with libgcc.a on the end, this isn't G++.
157if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
158 ac_cv_prog_gcc=yes
159else
160 ac_cv_prog_gcc=no
161fi
162
163dnl If we are using Gcc, look for the files that need to exist if this
164dnl compiler works.
165if 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
178fi
179
180dnl If everything is OK, then we can safely assume the compiler works.
181if 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)
184else
185 ac_cv_prog_cc_works=yes
186fi
187
188AC_LANG_RESTORE
189AC_MSG_RESULT($ac_cv_prog_cc_works)
190if test x"$ac_cv_prog_cc_works" = xno; then
191 AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
192fi
193AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
194AC_MSG_RESULT($ac_cv_prog_cc_cross)
195cross_compiling=$ac_cv_prog_cc_cross
196AC_SUBST(CC)
197])
198
199dnl ====================================================================
200dnl Find the HAL library. HAL is the BSP for ECC.
201AC_DEFUN(CYG_AC_PATH_HAL, [
202AC_MSG_CHECKING(for the HAL source files)
203dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
204AC_CACHE_VAL(ac_cv_c_haldir,[
205dnl We have the translate the target triplet to the directory name
206dnl cause they unfortunately don't match.
207case ${target_cpu} in
208 powerpc*) cpudir=powerpc ;;
209 mn10300*) cpudir=panx ;;
210 mips*) cpudir=mips ;;
211 *) cpudir=none ;;
212esac
213for 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
217done
218])
219if test x"${ac_cv_c_haldir}" != x; then
220 HALDIR="${ac_cv_c_haldir}"
221 AC_MSG_RESULT(${ac_cv_c_haldir})
222else
223 AC_MSG_RESULT(none)
224fi
225AC_SUBST(HALDIR)
226])
227
228dnl ====================================================================
229dnl Find the ECC kernel headers.
230AC_DEFUN(CYG_AC_PATH_KERNEL, [
231AC_MSG_CHECKING(for the kernel header files in the source tree)
232dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
233AC_CACHE_VAL(ac_cv_c_kernel,[
234for 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
238done
239])
240if test x"${ac_cv_c_kernel}" != x; then
241 KERNELHDIR="-I${ac_cv_c_kernel}"
242 AC_MSG_RESULT(${ac_cv_c_kernel})
243else
244 AC_MSG_RESULT(none)
245fi
246AC_MSG_CHECKING(for the kernel library in the build tree)
247dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
248AC_CACHE_VAL(ac_cv_c_klib,[
249for 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
253done
254])
255if test x"${ac_cv_c_klib}" != x; then
256 KERNELLIB="-L${ac_cv_c_klib}"
257 AC_MSG_RESULT(${ac_cv_c_klib})
258else
259 AC_MSG_RESULT(none)
260fi
261AC_SUBST(KERNELHDIR)
262AC_SUBST(KERNELLIB)
263])
264
265dnl ====================================================================
266dnl Find the ECC kernel's config file. This config.h is not produced
267dnl by autoconf, but is handcrafted.
268AC_DEFUN(CYG_AC_PATH_CONFIG, [
269AC_MSG_CHECKING(for the kernel's config.h header files in the source tree)
270dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
271AC_CACHE_VAL(ac_cv_c_configh,[
272for 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
276done
277])
278if test x"${ac_cv_c_configh}" != x; then
279 CONFIG_H="-I${ac_cv_c_configh}"
280 AC_MSG_RESULT(${ac_cv_c_configh})
281else
282 AC_MSG_RESULT(none)
283fi
284AC_SUBST(CONFIG_H)
285])
286
287dnl ====================================================================
288dnl Find the BFD library in the build tree. This is used to access and
289dnl manipulate object or executable files.
290AC_DEFUN(CYG_AC_PATH_BFD, [
291AC_MSG_CHECKING(for the bfd header in the build tree)
292dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
293dnl Look for the header file
294AC_CACHE_VAL(ac_cv_c_bfdh,[
295for 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
300done
301])
302if test x"${ac_cv_c_bfdh}" != x; then
303 BFDHDIR="-I${ac_cv_c_bfdh}"
304 AC_MSG_RESULT(${ac_cv_c_bfdh})
305else
306 AC_MSG_RESULT(none)
307fi
308AC_SUBST(BFDHDIR)
309
310dnl Look for the library
311AC_MSG_CHECKING(for the bfd library in the build tree)
312AC_CACHE_VAL(ac_cv_c_bfdlib,[
313for i in $dirlist; do
314 if test -f "$i/bfd/Makefile" ; then
315 ac_cv_c_bfdlib=`(cd $i/bfd; pwd)`
316 fi
317done
318])
319dnl We list two directories cause bfd now uses libtool
320if 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})
323else
324 AC_MSG_RESULT(none)
325fi
326AC_SUBST(BFDLIB)
327])
328
329dnl ====================================================================
330dnl Find the libiberty library. This defines many commonly used C
331dnl functions that exists in various states based on the underlying OS.
332AC_DEFUN(CYG_AC_PATH_LIBERTY, [
333AC_MSG_CHECKING(for the liberty library in the build tree)
334dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
335AC_CACHE_VAL(ac_cv_c_liberty,[
336for i in $dirlist; do
337 if test -f "$i/libiberty/Makefile" ; then
338 ac_cv_c_liberty=`(cd $i/libiberty; pwd)`
339 fi
340done
341])
342if test x"${ac_cv_c_liberty}" != x; then
343 LIBERTY="-L${ac_cv_c_liberty}"
344 AC_MSG_RESULT(${ac_cv_c_liberty})
345else
346 AC_MSG_RESULT(none)
347fi
348AC_SUBST(LIBERTY)
349])
350
351dnl ====================================================================
352dnl Find the opcodes library. This is used to do dissasemblies.
353AC_DEFUN(CYG_AC_PATH_OPCODES, [
354AC_MSG_CHECKING(for the opcodes library in the build tree)
355dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
356AC_CACHE_VAL(ac_cv_c_opc,[
357for i in $dirlist; do
358 if test -f "$i/opcodes/Makefile" ; then
359 ac_cv_c_opc=`(cd $i/opcodes; pwd)`
360 fi
361done
362])
363if test x"${ac_cv_c_opc}" != x; then
364 OPCODESLIB="-L${ac_cv_c_opc}"
365 AC_MSG_RESULT(${ac_cv_c_opc})
366else
367 AC_MSG_RESULT(none)
368fi
369AC_SUBST(OPCODESLIB)
370])
371
372dnl ====================================================================
373dnl Look for the DejaGnu header file in the source tree. This file
374dnl defines the functions used to testing support.
375AC_DEFUN(CYG_AC_PATH_DEJAGNU, [
376AC_MSG_CHECKING(for the testing support files in the source tree)
377dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
378AC_CACHE_VAL(ac_cv_c_dejagnu,[
379for 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
383done
384])
385if test x"${ac_cv_c_dejagnu}" != x; then
386 DEJAGNUHDIR="-I${ac_cv_c_dejagnu}"
387 AC_MSG_RESULT(${ac_cv_c_dejagnu})
388else
389 AC_MSG_RESULT(none)
390fi
391AC_CACHE_VAL(ac_cv_c_dejagnulib,[
392for 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
396done
397])
398if test x"${ac_cv_c_dejagnulib}" != x; then
399 DEJAGNULIB="${ac_cv_c_dejagnulib}"
400else
401 DEJAGNULIB=""
402fi
403AC_MSG_CHECKING(for runtest in the source tree)
404AC_CACHE_VAL(ac_cv_c_runtest,[
405for 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
409done
410])
411if test x"${ac_cv_c_runtest}" != x; then
412 RUNTESTDIR="${ac_cv_c_runtest}"
413 AC_MSG_RESULT(${ac_cv_c_runtest})
414else
415 RUNTESTDIR=""
416 AC_MSG_RESULT(none)
417fi
418AC_SUBST(RUNTESTDIR)
419AC_SUBST(DEJAGNULIB)
420AC_SUBST(DEJAGNUHDIR)
421])
422
423dnl ====================================================================
424dnl Find the libintl library in the build tree. This is for
425dnl internationalization support.
426AC_DEFUN(CYG_AC_PATH_INTL, [
427AC_MSG_CHECKING(for the intl header in the build tree)
428dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
429dnl Look for the header file
430AC_CACHE_VAL(ac_cv_c_intlh,[
431for 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
436done
437])
438if test x"${ac_cv_c_intlh}" != x; then
439 INTLHDIR="-I${ac_cv_c_intlh}"
440 AC_MSG_RESULT(${ac_cv_c_intlh})
441else
442 AC_MSG_RESULT(none)
443fi
444AC_SUBST(INTLHDIR)
445
446dnl Look for the library
447AC_MSG_CHECKING(for the libintl library in the build tree)
448AC_CACHE_VAL(ac_cv_c_intllib,[
449for i in $dirlist; do
450 if test -f "$i/intl/Makefile" ; then
451 ac_cv_c_intllib=`(cd $i/intl; pwd)`
452 fi
453done
454])
455if test x"${ac_cv_c_intllib}" != x; then
456 INTLLIB="-L${ac_cv_c_intllib} -lintl"
457 AC_MSG_RESULT(${ac_cv_c_intllib})
458else
459 AC_MSG_RESULT(none)
460fi
461AC_SUBST(INTLLIB)
462])
463
464dnl ====================================================================
465dnl Find the simulator library.
466AC_DEFUN(CYG_AC_PATH_SIM, [
467dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.."
468case "$target_cpu" in
469 powerpc) target_dir=ppc ;;
470 sparc*) target_dir=erc32 ;;
471 mips*) target_dir=mips ;;
472 *) target_dir=$target_cpu ;;
473esac
474dnl First look for the header file
475AC_MSG_CHECKING(for the simulator header file)
476AC_CACHE_VAL(ac_cv_c_simh,[
477for 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
482done
483])
484if test x"${ac_cv_c_simh}" != x; then
485 SIMHDIR="-I${ac_cv_c_simh}"
486 AC_MSG_RESULT(${ac_cv_c_simh})
487else
488 AC_MSG_RESULT(none)
489fi
490AC_SUBST(SIMHDIR)
491
492dnl See whether it's a devo or Foundry branch simulator
493AC_MSG_CHECKING(Whether this is a devo simulator )
494AC_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])
500if test x"$ac_cv_c_simdevo" = x"yes" ; then
501 AC_DEFINE(HAVE_DEVO_SIM)
502fi
503AC_MSG_RESULT(${ac_cv_c_simdevo})
504AC_SUBST(HAVE_DEVO_SIM)
505
506dnl Next look for the library
507AC_MSG_CHECKING(for the simulator library)
508AC_CACHE_VAL(ac_cv_c_simlib,[
509for 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
513done
514])
515if test x"${ac_cv_c_simlib}" != x; then
516 SIMLIB="-L${ac_cv_c_simlib}"
517else
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.
522dnl 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
529changequote(,)
530 gccpath=`${CROSS_GCC} --print-libgcc | sed -e 's:[a-z0-9A-Z\.\-]*/libgcc.a::' -e 's:lib/gcc-lib/::'`lib
531changequote([,])
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)
540dnl ac_cv_c_simlib=none
541 fi
542fi
543AC_SUBST(SIMLIB)
544])
545
546dnl ====================================================================
547dnl Find the libiberty library.
548AC_DEFUN(CYG_AC_PATH_LIBIBERTY, [
549AC_MSG_CHECKING(for the libiberty library in the build tree)
550dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
551AC_CACHE_VAL(ac_cv_c_libib,[
552for i in $dirlist; do
553 if test -f "$i/libiberty/Makefile" ; then
554 ac_cv_c_libib=`(cd $i/libiberty/; pwd)`
555 fi
556done
557])
558if test x"${ac_cv_c_libib}" != x; then
559 LIBIBERTY="-L${ac_cv_c_libib}"
560 AC_MSG_RESULT(${ac_cv_c_libib})
561else
562 AC_MSG_RESULT(none)
563fi
564AC_SUBST(LIBIBERTY)
565])
566
567dnl ====================================================================
568AC_DEFUN(CYG_AC_PATH_DEVO, [
569AC_MSG_CHECKING(for devo headers in the source tree)
570dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
571AC_CACHE_VAL(ac_cv_c_devoh,[
572for 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
576done
577])
578if test x"${ac_cv_c_devoh}" != x; then
579 DEVOHDIR="-I${ac_cv_c_devoh}"
580 AC_MSG_RESULT(${ac_cv_c_devoh})
581else
582 AC_MSG_RESULT(none)
583fi
584AC_SUBST(DEVOHDIR)
585])
586
587dnl ====================================================================
588dnl find the IDE library and headers.
589AC_DEFUN(CYG_AC_PATH_IDE, [
590AC_MSG_CHECKING(for IDE headers in the source tree)
591dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
592IDEHDIR=
593IDELIB=
594AC_CACHE_VAL(ac_cv_c_ideh,[
595for 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
599done
600])
601if test x"${ac_cv_c_ideh}" != x; then
602 IDEHDIR="-I${ac_cv_c_ideh}"
603 AC_MSG_RESULT(${ac_cv_c_ideh})
604else
605 AC_MSG_RESULT(none)
606fi
607
608AC_MSG_CHECKING(for LIBIDE TCL headers in the source tree)
609AC_CACHE_VAL(ac_cv_c_idetclh,[
610for 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
614done
615])
616if test x"${ac_cv_c_idetclh}" != x; then
617 IDEHDIR="${IDEHDIR} -I${ac_cv_c_idetclh}"
618 AC_MSG_RESULT(${ac_cv_c_idetclh})
619else
620 AC_MSG_RESULT(none)
621fi
622
623AC_MSG_CHECKING(for IDE headers in the build tree)
624AC_CACHE_VAL(ac_cv_c_ideh2,[
625for 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
629done
630])
631if test x"${ac_cv_c_ideh2}" != x; then
632 IDEHDIR="${IDEHDIR} -I${ac_cv_c_ideh2}"
633 AC_MSG_RESULT(${ac_cv_c_ideh2})
634else
635 AC_MSG_RESULT(none)
636fi
637
638dnl look for the library
639AC_MSG_CHECKING(for IDE library)
640AC_CACHE_VAL(ac_cv_c_idelib,[
641if 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
648fi])
649if test x"${ac_cv_c_idelib}" != x ; then
650 IDELIB="-L${ac_cv_c_idelib}"
651 AC_MSG_RESULT(${ac_cv_c_idelib})
652else
653 AC_MSG_RESULT(none)
654fi
655
656dnl find libiddetcl.a if it exists
657AC_MSG_CHECKING(for IDE TCL library)
658AC_CACHE_VAL(ac_cv_c_idetcllib,[
659if 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
666fi
667])
668if 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})
672else
673 AC_MSG_RESULT(none)
674fi
675AC_SUBST(IDEHDIR)
676AC_SUBST(IDELIB)
677AC_SUBST(IDETCLLIB)
678])
679
680dnl ====================================================================
681dnl Find all the ILU headers and libraries
682AC_DEFUN(CYG_AC_PATH_ILU, [
683AC_MSG_CHECKING(for ILU kernel headers in the source tree)
684dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
685AC_CACHE_VAL(ac_cv_c_iluh,[
686for 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
690done
691])
692if test x"${ac_cv_c_iluh}" != x; then
693 ILUHDIR="-I${ac_cv_c_iluh}"
694 AC_MSG_RESULT(${ac_cv_c_iluh})
695else
696 AC_MSG_RESULT(none)
697fi
698
699AC_MSG_CHECKING(for ILU kernel headers in the build tree)
700dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
701AC_CACHE_VAL(ac_cv_c_iluh5,[
702for 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
706done
707])
708if test x"${ac_cv_c_iluh5}" != x; then
709 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh5}"
710 AC_MSG_RESULT(${ac_cv_c_iluh5})
711else
712 AC_MSG_RESULT(none)
713fi
714
715AC_MSG_CHECKING(for ILU C++ headers in the source tree)
716AC_CACHE_VAL(ac_cv_c_iluh2,[
717for 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
721done
722])
723if test x"${ac_cv_c_iluh2}" != x; then
724 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh2}"
725 AC_MSG_RESULT(${ac_cv_c_iluh2})
726else
727 AC_MSG_RESULT(none)
728fi
729
730AC_MSG_CHECKING(for ILU C headers)
731AC_CACHE_VAL(ac_cv_c_iluh3,[
732for 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
736done
737])
738if test x"${ac_cv_c_iluh3}" != x; then
739 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh3}"
740 AC_MSG_RESULT(${ac_cv_c_iluh3})
741else
742 AC_MSG_RESULT(none)
743fi
744
745AC_MSG_CHECKING(for ILU C runtime headers)
746AC_CACHE_VAL(ac_cv_c_iluh4,[
747for 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
751done
752])
753if test x"${ac_cv_c_iluh4}" != x; then
754 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh4}"
755 AC_MSG_RESULT(${ac_cv_c_iluh4})
756else
757 AC_MSG_RESULT(none)
758fi
759
760AC_CACHE_VAL(ac_cv_c_ilupath,[
761for 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
766done
767])
768ILUTOP=${ac_cv_c_ilupath}
769
770AC_MSG_CHECKING(for the ILU library in the build tree)
771AC_CACHE_VAL(ac_cv_c_ilulib,[
772if 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)
775else
776 AC_MSG_RESULT(no)
777fi])
778
779AC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
780AC_CACHE_VAL(ac_cv_c_ilulib2,[
781if 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)
784else
785 AC_MSG_RESULT(no)
786fi])
787
788AC_MSG_CHECKING(for the ILU C bindings library in the build tree)
789AC_CACHE_VAL(ac_cv_c_ilulib3,[
790if 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)
793else
794 AC_MSG_RESULT(no)
795fi])
796
797AC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
798AC_CACHE_VAL(ac_cv_c_ilulib4,[
799if 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)
802else
803 AC_MSG_RESULT(no)
804fi])
805
806if test x"${ac_cv_c_ilulib}" = x -a x"${ac_cv_c_ilulib2}" = x; then
807 ILUHDIR=""
808fi
809
810if 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}"
812else
813 ILULIB=""
814fi
815
816if 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
833fi])
834AC_SUBST(ILUHDIR)
835AC_SUBST(ILULIB)
836AC_SUBST(ILUTOP)
837])
838
839dnl ====================================================================
840dnl Find the target manager client side headers and library.
841AC_DEFUN(CYG_AC_PATH_TMGR, [
842AC_MSG_CHECKING(for Target Manager client headers in the source tree)
843dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. "
844TMGRHDIR=
845TMGRLIB=
846AC_CACHE_VAL(ac_cv_c_tmgrh,[
847for 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
851done
852])
853if test x"${ac_cv_c_tmgrh}" != x; then
854 TMGRHDIR="-I${ac_cv_c_tmgrh}"
855 AC_MSG_RESULT(${ac_cv_c_tmgrh})
856else
857 AC_MSG_RESULT(none)
858fi
859
860AC_MSG_CHECKING(for Target Manager client headers in the build tree)
861AC_CACHE_VAL(ac_cv_c_tmgrh2,[
862for 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
866done
867])
868if test x"${ac_cv_c_tmgrh2}" != x; then
869 TMGRHDIR="${TMGRHDIR} -I${ac_cv_c_tmgrh2}"
870 AC_MSG_RESULT(${ac_cv_c_tmgrh2})
871else
872 AC_MSG_RESULT(none)
873fi
874
875if test x"${ac_cv_c_tmgrh}" = x -a x"${ac_cv_c_tmgrh2}" = x; then
876 TMGRHDIR="# no Target Manager client headers found"
877fi
878
879AC_MSG_CHECKING(for Target Manager client library)
880AC_CACHE_VAL(ac_cv_c_tmgrlib,[
881if 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
893fi])
894
895if test x"${ac_cv_c_tmgrlib}" != x ; then
896 TMGRLIB="-L${ac_cv_c_tmgrlib}"
897 AC_MSG_RESULT(${ac_cv_c_tmgrlib})
898else
899 AC_MSG_RESULT(none)
900fi
901AC_SUBST(TMGRHDIR)
902AC_SUBST(TMGRLIB)
903])
904
905dnl ====================================================================
906dnl This defines the byte order for the host. We can't use
907dnl AC_C_BIGENDIAN, cause we want to create a config file and
908dnl substitue the real value, so the header files work right
909AC_DEFUN(CYG_AC_C_ENDIAN, [
910AC_MSG_CHECKING(to see if this is a little endian host)
911AC_CACHE_VAL(ac_cv_c_little_endian, [
912ac_cv_c_little_endian=unknown
913# See if sys/param.h defines the BYTE_ORDER macro.
914AC_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.
919AC_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])
925if test ${ac_cv_c_little_endian} = unknown; then
926old_cflags=$CFLAGS
927CFLAGS=-g
928AC_TRY_RUN([
929main () {
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}],
939ac_cv_c_little_endian=no,
940ac_cv_c_little_endian=yes,[
941dnl Yes, this is ugly, and only used for a canadian cross anyway. This
942dnl is just to keep configure from stopping here.
943case "${host}" in
944changequote(,)
945 i[3456]86-*-*) ac_cv_c_little_endian=yes ;;
946 sparc*-*-*) ac_cv_c_little_endian=no ;;
947changequote([,])
948 *) AC_MSG_WARN(Can't cross compile this test) ;;
949esac])
950CFLAGS=$old_cflags
951fi])
952
953if test x"${ac_cv_c_little_endian}" = xyes; then
954 AC_DEFINE(LITTLE_ENDIAN_HOST)
955 ENDIAN="CYG_LSBFIRST";
956else
957 ENDIAN="CYG_MSBFIRST";
958fi
959AC_MSG_RESULT(${ac_cv_c_little_endian})
960AC_SUBST(ENDIAN)
961])
962
963dnl ====================================================================
964dnl Look for the path to libgcc, so we can use it to directly link
965dnl in libgcc.a with LD.
966AC_DEFUN(CYG_AC_PATH_LIBGCC,
967[AC_MSG_CHECKING([Looking for the path to libgcc.a])
968AC_LANG_SAVE
969AC_LANG_C
970
971dnl Get Gcc's full path to libgcc.a
972libgccpath=`${CC} --print-libgcc`
973
974dnl If we don't have a path with libgcc.a on the end, this isn't G++.
975if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
976 ac_cv_prog_gcc=yes
977else
978 ac_cv_prog_gcc=no
979fi
980
981dnl
982if 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})
986else
987 LIBGCC=""
988 AC_MSG_ERROR(Not using gcc)
989fi
990
991AC_LANG_RESTORE
992AC_SUBST(LIBGCC)
993])
994
995dnl ====================================================================
996dnl Ok, lets find the tcl source trees so we can use the headers
997dnl Warning: transition of version 9 to 10 will break this algorithm
998dnl because 10 sorts before 9. We also look for just tcl. We have to
999dnl be careful that we don't match stuff like tclX by accident.
1000dnl the alternative search directory is involked by --with-tclinclude
1001AC_DEFUN(CYG_AC_PATH_TCL, [
1002 CYG_AC_PATH_TCLH
1003 CYG_AC_PATH_TCLCONFIG
1004 CYG_AC_LOAD_TCLCONFIG
1005])
1006AC_DEFUN(CYG_AC_PATH_TCLH, [
1007dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1008no_tcl=true
1009AC_MSG_CHECKING(for Tcl headers in the source tree)
1010AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl headers are], with_tclinclude=${withval})
1011AC_CACHE_VAL(ac_cv_c_tclh,[
1012dnl first check to see if --with-tclinclude was specified
1013if 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
1021fi
1022
1023dnl next check if it came with Tcl configuration file
1024if 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
1031fi
1032
1033dnl next check in private source directory
1034dnl since ls returns lowest version numbers first, reverse its output
1035if 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
1052fi
1053
1054dnl check if its installed with the compiler
1055if 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
1061fi
1062
1063dnl see if one is installed
1064if 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="")
1067else
1068 AC_MSG_RESULT(${ac_cv_c_tclh})
1069fi
1070])
1071 TCLHDIR=""
1072if test x"${ac_cv_c_tclh}" = x ; then
1073 AC_MSG_ERROR([Can't find any Tcl headers])
1074fi
1075if 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
1081fi
1082
1083AC_SUBST(TCLHDIR)
1084])
1085
1086dnl ====================================================================
1087dnl Ok, lets find the tcl configuration
1088AC_DEFUN(CYG_AC_PATH_TCLCONFIG, [
1089dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1090dnl First, look for one uninstalled.
1091dnl the alternative search directory is invoked by --with-tclconfig
1092if 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
1157fi
1158AC_SUBST(TCLCONFIG)
1159])
1160
1161dnl Defined as a separate macro so we don't have to cache the values
1162dnl from PATH_TCLCONFIG (because this can also be cached).
1163AC_DEFUN(CYG_AC_LOAD_TCLCONFIG, [
1164 . $TCLCONFIG
1165
1166dnl AC_SUBST(TCL_VERSION)
1167dnl AC_SUBST(TCL_MAJOR_VERSION)
1168dnl AC_SUBST(TCL_MINOR_VERSION)
1169dnl AC_SUBST(TCL_CC)
1170 AC_SUBST(TCL_DEFS)
1171
1172dnl not used, don't export to save symbols
1173dnl AC_SUBST(TCL_LIB_FILE)
1174 AC_SUBST(TCL_LIBS)
1175dnl not used, don't export to save symbols
1176dnl AC_SUBST(TCL_PREFIX)
1177
1178dnl not used, don't export to save symbols
1179dnl AC_SUBST(TCL_EXEC_PREFIX)
1180
1181 AC_SUBST(TCL_SHLIB_CFLAGS)
1182 AC_SUBST(TCL_SHLIB_LD)
1183dnl don't export, not used outside of configure
1184dnl AC_SUBST(TCL_SHLIB_LD_LIBS)
1185dnl AC_SUBST(TCL_SHLIB_SUFFIX)
1186dnl not used, don't export to save symbols
1187dnl AC_SUBST(TCL_DL_LIBS)
1188 AC_SUBST(TCL_LD_FLAGS)
1189 AC_SUBST(TCL_LD_SEARCH_FLAGS)
1190dnl don't export, not used outside of configure
1191dnl AC_SUBST(TCL_COMPAT_OBJS)
1192 AC_SUBST(TCL_RANLIB)
1193 AC_SUBST(TCL_BUILD_LIB_SPEC)
1194 AC_SUBST(TCL_LIB_SPEC)
1195dnl AC_SUBST(TCL_LIB_VERSIONS_OK)
1196
1197dnl not used, don't export to save symbols
1198dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
1199
1200dnl not used, don't export to save symbols
1201dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
1202])
1203
1204dnl ====================================================================
1205AC_DEFUN(CYG_AC_PATH_TK, [
1206 CYG_AC_PATH_TKH
1207 CYG_AC_PATH_TKCONFIG
1208 CYG_AC_LOAD_TKCONFIG
1209])
1210AC_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#
1224dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1225no_tk=true
1226AC_MSG_CHECKING(for Tk headers in the source tree)
1227AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where tk headers are], with_tkinclude=${withval})
1228AC_CACHE_VAL(ac_cv_c_tkh,[
1229dnl first check to see if --with-tkinclude was specified
1230if 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
1238fi
1239
1240dnl next check if it came with Tk configuration file
1241if 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
1248fi
1249
1250dnl next check in private source directory
1251dnl since ls returns lowest version numbers first, reverse its output
1252if 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
1269fi
1270
1271dnl see if one is installed
1272if 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
1280else
1281 AC_MSG_RESULT(${ac_cv_c_tkh})
1282fi
1283])
1284 TKHDIR=""
1285if test x"${ac_cv_c_tkh}" = x ; then
1286 AC_MSG_ERROR([Can't find any Tk headers])
1287fi
1288if 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
1294fi
1295
1296AC_SUBST(TKHDIR)
1297])
1298
1299AC_DEFUN(CYG_AC_PATH_TKCONFIG, [
1300dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1301dnl First, look for one uninstalled.
1302dnl the alternative search directory is invoked by --with-tkconfig
1303if 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
1368fi
1369AC_SUBST(TKCONFIG)
1370])
1371
1372dnl Defined as a separate macro so we don't have to cache the values
1373dnl from PATH_TKCONFIG (because this can also be cached).
1374AC_DEFUN(CYG_AC_LOAD_TKCONFIG, [
1375 if test -f "$TKCONFIG" ; then
1376 . $TKCONFIG
1377 fi
1378
1379 AC_SUBST(TK_VERSION)
1380dnl not actually used, don't export to save symbols
1381dnl AC_SUBST(TK_MAJOR_VERSION)
1382dnl AC_SUBST(TK_MINOR_VERSION)
1383 AC_SUBST(TK_DEFS)
1384
1385dnl not used, don't export to save symbols
1386dnl AC_SUBST(TK_LIB_FILE)
1387
1388 AC_SUBST(TK_LIBS)
1389dnl not used, don't export to save symbols
1390dnl AC_SUBST(TK_PREFIX)
1391
1392dnl not used, don't export to save symbols
1393dnl 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
1401dnl ====================================================================
1402dnl Ok, lets find the itcl source trees so we can use the headers
1403dnl the alternative search directory is involked by --with-itclinclude
1404AC_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])
1410AC_DEFUN(CYG_AC_PATH_ITCLH, [
1411dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1412no_itcl=true
1413AC_MSG_CHECKING(for Itcl headers in the source tree)
1414AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
1415AC_CACHE_VAL(ac_cv_c_itclh,[
1416dnl first check to see if --with-itclinclude was specified
1417if 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
1425fi
1426
1427dnl next check if it came with Itcl configuration file
1428if 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
1435fi
1436
1437dnl next check in private source directory
1438dnl since ls returns lowest version numbers first, reverse its output
1439if 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
1456fi
1457
1458dnl see if one is installed
1459if 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="")
1462else
1463 AC_MSG_RESULT(${ac_cv_c_itclh})
1464fi
1465])
1466 ITCLHDIR=""
1467if test x"${ac_cv_c_itclh}" = x ; then
1468 AC_MSG_ERROR([Can't find any Itcl headers])
1469fi
1470if 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
1476fi
1477
1478AC_SUBST(ITCLHDIR)
1479])
1480
1481dnl Ok, lets find the itcl library
1482dnl First, look for one uninstalled.
1483dnl the alternative search directory is invoked by --with-itcllib
1484AC_DEFUN(CYG_AC_PATH_ITCLLIB, [
1485dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1486if 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
1561fi
1562
1563AC_PROVIDE([$0])
1564AC_SUBST(ITCLLIB)
1565])
1566
1567
1568dnl ====================================================================
1569dnl Ok, lets find the itcl source trees so we can use the itcl_sh script
1570dnl the alternative search directory is involked by --with-itclinclude
1571AC_DEFUN(CYG_AC_PATH_ITCLSH, [
1572dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1573no_itcl=true
1574AC_MSG_CHECKING(for the itcl_sh script)
1575AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
1576AC_CACHE_VAL(ac_cv_c_itclsh,[
1577dnl first check to see if --with-itclinclude was specified
1578if 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
1586fi
1587
1588dnl next check in private source directory
1589dnl since ls returns lowest version numbers first, reverse its output
1590if 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
1607fi
1608
1609dnl see if one is installed
1610if test x"${ac_cv_c_itclsh}" = x ; then
1611 AC_MSG_RESULT(none)
1612 AC_PATH_PROG(ac_cv_c_itclsh, itcl_sh)
1613else
1614 AC_MSG_RESULT(${ac_cv_c_itclsh})
1615fi
1616])
1617
1618if test x"${ac_cv_c_itclsh}" = x ; then
1619 AC_MSG_ERROR([Can't find the itcl_sh script])
1620fi
1621if 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}"
1625fi
1626AC_SUBST(ITCLSH)
1627])
1628
1629
1630dnl ====================================================================
1631dnl Ok, lets find the itcl source trees so we can use the itcl_sh script
1632dnl the alternative search directory is involked by --with-itclinclude
1633AC_DEFUN(CYG_AC_PATH_ITCLMKIDX, [
1634dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1635no_itcl=true
1636AC_MSG_CHECKING(for itcl_mkindex.tcl script)
1637AC_ARG_WITH(itclinclude, [ --with-itclinclude directory where itcl headers are], with_itclinclude=${withval})
1638AC_CACHE_VAL(ac_cv_c_itclmkidx,[
1639dnl first check to see if --with-itclinclude was specified
1640if 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
1648fi
1649
1650dnl next check in private source directory
1651dnl since ls returns lowest version numbers first, reverse its output
1652if 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
1669fi
1670if 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
1680fi
1681])
1682
1683if test x"${ac_cv_c_itclmkidx}" = x ; then
1684 AC_MSG_ERROR([Can't find the itcl_mkindex.tcl script])
1685fi
1686if 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}"
1690else
1691 AC_MSG_RESULT(none)
1692fi
1693AC_SUBST(ITCLMKIDX)
1694])
1695
1696dnl ====================================================================
1697dnl Ok, lets find the tix source trees so we can use the headers
1698dnl the alternative search directory is involked by --with-tixinclude
1699AC_DEFUN(CYG_AC_PATH_TIX, [
1700 CYG_AC_PATH_TIXH
1701 CYG_AC_PATH_TIXLIB
1702])
1703AC_DEFUN(CYG_AC_PATH_TIXH, [
1704dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1705no_tix=true
1706AC_MSG_CHECKING(for Tix headers in the source tree)
1707AC_ARG_WITH(tixinclude, [ --with-tixinclude directory where tix headers are], with_tixinclude=${withval})
1708AC_CACHE_VAL(ac_cv_c_tixh,[
1709dnl first check to see if --with-tixinclude was specified
1710if 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
1718fi
1719
1720dnl next check if it came with Tix configuration file
1721if 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
1728fi
1729
1730dnl next check in private source directory
1731dnl since ls returns lowest version numbers first, reverse its output
1732if 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
1749fi
1750
1751dnl see if one is installed
1752if 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
1762else
1763 AC_MSG_RESULT(${ac_cv_c_tixh})
1764fi
1765])
1766if test x"${ac_cv_c_tixh}" = x ; then
1767 AC_MSG_ERROR([Can't find any Tix headers])
1768fi
1769if 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
1775fi
1776
1777AC_SUBST(TIXHDIR)
1778])
1779
1780
1781dnl Ok, lets find the tix library
1782dnl First, look for one uninstalled.
1783dnl the alternative search directory is invoked by --with-tixlib
1784AC_DEFUN(CYG_AC_PATH_TIXLIB, [
1785dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1786if 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
1830changequote(,)
1831 for i in `ls -dr $ccpath/libtix[0-9]* 2>/dev/null ` ; do
1832changequote([,])
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
1844changequote(,)
1845 libname=`echo "${ac_cv_c_tixlib}" | sed -e 's:.*tk[0-9\.]*/lib::' -e 's:.*lib/lib::' -e 's:\.a::'`
1846changequote([,])
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
1856fi
1857
1858AC_PROVIDE([$0])
1859AC_SUBST(TIXLIB)
1860AC_SUBST(TIX_VERSION)
1861AC_SUBST(TIX_BUILD_LIB_SPEC)
1862])
1863
1864dnl ====================================================================
1865dnl Ok, lets find the libgui source trees so we can use the headers
1866dnl the alternative search directory is involked by --with-libguiinclude
1867AC_DEFUN(CYG_AC_PATH_LIBGUI, [
1868 CYG_AC_PATH_LIBGUIH
1869 CYG_AC_PATH_LIBGUILIB
1870])
1871AC_DEFUN(CYG_AC_PATH_LIBGUIH, [
1872dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../..../../../../../../../../../../.."
1873no_libgui=true
1874AC_MSG_CHECKING(for Libgui headers in the source tree)
1875AC_ARG_WITH(libguiinclude, [ --with-libguiinclude directory where libgui headers are], with_libguiinclude=${withval})
1876AC_CACHE_VAL(ac_cv_c_libguih,[
1877dnl first check to see if --with-libguiinclude was specified
1878if 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
1886fi
1887
1888dnl next check if it came with Libgui configuration file
1889if 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
1896fi
1897
1898dnl next check in private source directory
1899dnl since ls returns lowest version numbers first, reverse its output
1900if 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
1917fi
1918
1919dnl see if one is installed
1920if 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="")
1923fi
1924])
1925LIBGUIHDIR=""
1926if test x"${ac_cv_c_libguih}" = x ; then
1927 AC_MSG_WARN([Can't find any Libgui headers])
1928fi
1929if 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
1934fi
1935AC_MSG_RESULT(${ac_cv_c_libguih})
1936AC_SUBST(LIBGUIHDIR)
1937])
1938
1939dnl ====================================================================
1940dnl find the GUI library
1941AC_DEFUN(CYG_AC_PATH_LIBGUILIB, [
1942AC_MSG_CHECKING(for GUI library in the build tree)
1943dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1944dnl look for the library
1945AC_MSG_CHECKING(for GUI library)
1946AC_CACHE_VAL(ac_cv_c_libguilib,[
1947if 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
1954fi
1955])
1956if 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})
1960else
1961 AC_MSG_RESULT(none)
1962fi
1963
1964AC_SUBST(GUILIB)
1965AC_SUBST(LIBGUILIB)
1966])