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