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