160484Sobriendnl This file is included into all any other acinclude file that needs
260484Sobriendnl to use these macros.
360484Sobrien
460484Sobriendnl This is copied from autoconf 2.12, but does calls our own AC_PROG_CC_WORKS,
560484Sobriendnl and doesn't call AC_PROG_CXX_GNU, cause we test for that in  AC_PROG_CC_WORKS.
660484Sobriendnl We are probably using a cross compiler, which will not be able to fully
760484Sobriendnl link an executable.  This should really be fixed in autoconf itself.
860484Sobriendnl Find a working G++ cross compiler. This only works for the GNU C++ compiler.
9218822SdimAC_DEFUN([CYG_AC_PROG_CXX_CROSS],
1060484Sobrien[AC_BEFORE([$0], [AC_PROG_CXXCPP])
1160484SobrienAC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
1260484Sobrien
1360484SobrienCYG_AC_PROG_GXX_WORKS
1460484Sobrien
1560484Sobrienif test $ac_cv_prog_gxx = yes; then
1660484Sobrien  GXX=yes
1760484Sobriendnl Check whether -g works, even if CXXFLAGS is set, in case the package
1860484Sobriendnl plays around with CXXFLAGS (such as to build both debugging and
1960484Sobriendnl normal versions of a library), tasteless as that idea is.
2060484Sobrien  ac_test_CXXFLAGS="${CXXFLAGS+set}"
2160484Sobrien  ac_save_CXXFLAGS="$CXXFLAGS"
2260484Sobrien  CXXFLAGS=
2360484Sobrien  AC_PROG_CXX_G
2460484Sobrien  if test "$ac_test_CXXFLAGS" = set; then
2560484Sobrien    CXXFLAGS="$ac_save_CXXFLAGS"
2660484Sobrien  elif test $ac_cv_prog_cxx_g = yes; then
2760484Sobrien    CXXFLAGS="-g -O2"
2860484Sobrien  else
2960484Sobrien    CXXFLAGS="-O2"
3060484Sobrien  fi
3160484Sobrienelse
3260484Sobrien  GXX=
3360484Sobrien  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
3460484Sobrienfi
3560484Sobrien])
3660484Sobrien
3760484Sobriendnl See if the G++ compiler we found works.
38218822SdimAC_DEFUN([CYG_AC_PROG_GXX_WORKS],
3960484Sobrien[AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually works])
4060484SobrienAC_LANG_SAVE
4160484SobrienAC_LANG_CPLUSPLUS
4260484Sobriendnl Try a test case. We only compile, because it's close to impossible
4360484Sobriendnl to get a correct fully linked executable with a cross compiler. For
4460484Sobriendnl most cross compilers, this test is bogus. For G++, we can use various
4560484Sobriendnl other compile line options to get a decent idea that the cross compiler
4660484Sobriendnl actually does work, even though we can't produce an executable without
4760484Sobriendnl more info about the target it's being compiled for. This only works
4860484Sobriendnl for the GNU C++ compiler.
4960484Sobrien
5060484Sobriendnl Transform the name of the compiler to it's cross variant, unless
5160484Sobriendnl CXX is set. This is also what CXX gets set to in the generated
5260484Sobriendnl Makefile.
5360484Sobrienif test x"${CXX}" = xc++ ; then
5460484Sobrien    CXX=`echo gcc | sed -e "${program_transform_name}"`
5560484Sobrienfi
5660484Sobrien
5760484Sobriendnl Get G++'s full path to libgcc.a
5860484Sobrienlibgccpath=`${CXX} --print-libgcc`
5960484Sobrien
6060484Sobriendnl If we don't have a path with libgcc.a on the end, this isn't G++.
6160484Sobrienif test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
6260484Sobrien   ac_cv_prog_gxx=yes
6360484Sobrienelse
6460484Sobrien   ac_cv_prog_gxx=no
6560484Sobrienfi
6660484Sobrien
6760484Sobriendnl If we are using G++, look for the files that need to exist if this
6860484Sobriendnl compiler works.
6960484Sobrienif test x"${ac_cv_prog_gxx}" = xyes ; then
7060484Sobrien    gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
7160484Sobrien    if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
7260484Sobrien	gccfiles=yes
7360484Sobrien    else
7460484Sobrien	gccfiles=no
7560484Sobrien    fi
7660484Sobrien    gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
7760484Sobrien    if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
7860484Sobrien	gcclibs=yes
7960484Sobrien    else
8060484Sobrien	gcclibs=no
8160484Sobrien    fi
8260484Sobrienfi
8360484Sobrien
8460484Sobriendnl If everything is OK, then we can safely assume the compiler works.
8560484Sobrienif test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
8660484Sobrien    ac_cv_prog_cxx_works=no
8760484Sobrien    AC_MSG_ERROR(${CXX} is a non-working cross compiler)
8860484Sobrienelse
8960484Sobrien   ac_cv_prog_cxx_works=yes 
9060484Sobrienfi
9160484Sobrien
9260484SobrienAC_LANG_RESTORE
9360484SobrienAC_MSG_RESULT($ac_cv_prog_cxx_works)
9460484Sobrienif test x"$ac_cv_prog_cxx_works" = xno; then
9560484Sobrien  AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
9660484Sobrienfi
9760484SobrienAC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
9860484SobrienAC_MSG_RESULT($ac_cv_prog_cxx_cross)
9960484Sobriencross_compiling=$ac_cv_prog_cxx_cross
10060484SobrienAC_SUBST(CXX)
10160484Sobrien])
10260484Sobrien
10360484Sobriendnl ====================================================================
10460484Sobriendnl Find a working GCC cross compiler. This only works for the GNU gcc compiler.
10560484Sobriendnl This is based on the macros above for G++.
106218822SdimAC_DEFUN([CYG_AC_PROG_CC_CROSS],
10760484Sobrien[AC_BEFORE([$0], [AC_PROG_CCPP])
10860484SobrienAC_CHECK_PROGS(CC, cc, gcc)
10960484Sobrien
11060484SobrienCYG_AC_PROG_GCC_WORKS
11160484Sobrien
11260484Sobrienif test $ac_cv_prog_gcc = yes; then
11360484Sobrien  GCC=yes
11460484Sobriendnl Check whether -g works, even if CFLAGS is set, in case the package
11560484Sobriendnl plays around with CFLAGS (such as to build both debugging and
11660484Sobriendnl normal versions of a library), tasteless as that idea is.
11760484Sobrien  ac_test_CFLAGS="${CFLAGS+set}"
11860484Sobrien  ac_save_CFLAGS="$CFLAGS"
11960484Sobrien  CFLAGS=
12060484Sobrien  AC_PROG_CC_G
12160484Sobrien  if test "$ac_test_CFLAGS" = set; then
12260484Sobrien    CFLAGS="$ac_save_CFLAGS"
12360484Sobrien  elif test $ac_cv_prog_cc_g = yes; then
12460484Sobrien    CFLAGS="-g -O2"
12560484Sobrien  else
12660484Sobrien    CFLAGS="-O2"
12760484Sobrien  fi
12860484Sobrienelse
12960484Sobrien  GXX=
13060484Sobrien  test "${CFLAGS+set}" = set || CFLAGS="-g"
13160484Sobrienfi
13260484Sobrien])
13360484Sobrien
13460484Sobriendnl See if the GCC compiler we found works.
135218822SdimAC_DEFUN([CYG_AC_PROG_GCC_WORKS],
13660484Sobrien[AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) actually works])
13760484SobrienAC_LANG_SAVE
13860484SobrienAC_LANG_C
13960484Sobriendnl Try a test case. We only compile, because it's close to impossible
14060484Sobriendnl to get a correct fully linked executable with a cross
14160484Sobriendnl compiler. For most cross compilers, this test is bogus. For G++,
14260484Sobriendnl we can use various other compile line options to get a decent idea
14360484Sobriendnl that the cross compiler actually does work, even though we can't
14460484Sobriendnl produce an executable without more info about the target it's
14560484Sobriendnl being compiled for. This only works for the GNU C++ compiler.
14660484Sobrien
14760484Sobriendnl Transform the name of the compiler to it's cross variant, unless
14860484Sobriendnl CXX is set. This is also what CC gets set to in the generated Makefile.
14960484Sobrienif test x"${CC}" = xcc ; then
15060484Sobrien    CC=`echo gcc | sed -e "${program_transform_name}"`
15160484Sobrienfi
15260484Sobrien
15360484Sobriendnl Get Gcc's full path to libgcc.a
15460484Sobrienlibgccpath=`${CC} --print-libgcc`
15560484Sobrien
15660484Sobriendnl If we don't have a path with libgcc.a on the end, this isn't G++.
15760484Sobrienif test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
15860484Sobrien   ac_cv_prog_gcc=yes
15960484Sobrienelse
16060484Sobrien   ac_cv_prog_gcc=no
16160484Sobrienfi
16260484Sobrien
16360484Sobriendnl If we are using Gcc, look for the files that need to exist if this
16460484Sobriendnl compiler works.
16560484Sobrienif test x"${ac_cv_prog_gcc}" = xyes ; then
16660484Sobrien    gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
16760484Sobrien    if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
16860484Sobrien	gccfiles=yes
16960484Sobrien    else
17060484Sobrien	gccfiles=no
17160484Sobrien    fi
17260484Sobrien    gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
17360484Sobrien    if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
17460484Sobrien	gcclibs=yes
17560484Sobrien    else
17660484Sobrien	gcclibs=no
17760484Sobrien    fi
17860484Sobrienfi
17960484Sobrien
18060484Sobriendnl If everything is OK, then we can safely assume the compiler works.
18160484Sobrienif test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
18260484Sobrien    ac_cv_prog_cc_works=no
18360484Sobrien    AC_MSG_ERROR(${CC} is a non-working cross compiler)    
18460484Sobrienelse
18560484Sobrien    ac_cv_prog_cc_works=yes
18660484Sobrienfi
18760484Sobrien
18860484SobrienAC_LANG_RESTORE
18960484SobrienAC_MSG_RESULT($ac_cv_prog_cc_works)
19060484Sobrienif test x"$ac_cv_prog_cc_works" = xno; then
19160484Sobrien  AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
19260484Sobrienfi
19360484SobrienAC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
19460484SobrienAC_MSG_RESULT($ac_cv_prog_cc_cross)
19560484Sobriencross_compiling=$ac_cv_prog_cc_cross
19660484SobrienAC_SUBST(CC)
19760484Sobrien])
19860484Sobrien
19960484Sobriendnl ====================================================================
20060484Sobriendnl Find the BFD library in the build tree. This is used to access and
20160484Sobriendnl manipulate object or executable files.
202218822SdimAC_DEFUN([CYG_AC_PATH_BFD], [
20360484SobrienAC_MSG_CHECKING(for the bfd header in the build tree)
20460484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
20560484Sobriendnl Look for the header file
20660484SobrienAC_CACHE_VAL(ac_cv_c_bfdh,[
20760484Sobrienfor i in $dirlist; do
20860484Sobrien    if test -f "$i/bfd/bfd.h" ; then
209104834Sobrien	ac_cv_c_bfdh=`(cd $i/bfd; ${PWDCMD-pwd})`
21060484Sobrien	break
21160484Sobrien    fi
21260484Sobriendone
21360484Sobrien])
21460484Sobrienif test x"${ac_cv_c_bfdh}" != x; then
21560484Sobrien    BFDHDIR="-I${ac_cv_c_bfdh}"
21660484Sobrien    AC_MSG_RESULT(${ac_cv_c_bfdh})
21760484Sobrienelse
21860484Sobrien    AC_MSG_RESULT(none)
21960484Sobrienfi
22060484SobrienAC_SUBST(BFDHDIR)
22160484Sobrien
22260484Sobriendnl Look for the library
22360484SobrienAC_MSG_CHECKING(for the bfd library in the build tree)
22460484SobrienAC_CACHE_VAL(ac_cv_c_bfdlib,[
22560484Sobrienfor i in $dirlist; do
22660484Sobrien    if test -f "$i/bfd/Makefile" ; then
227104834Sobrien	ac_cv_c_bfdlib=`(cd $i/bfd; ${PWDCMD-pwd})`
22860484Sobrien    fi
22960484Sobriendone
23060484Sobrien])
23160484Sobriendnl We list two directories cause bfd now uses libtool
23260484Sobrienif test x"${ac_cv_c_bfdlib}" != x; then
23360484Sobrien    BFDLIB="-L${ac_cv_c_bfdlib} -L${ac_cv_c_bfdlib}/.libs"
23460484Sobrien    AC_MSG_RESULT(${ac_cv_c_bfdlib})
23560484Sobrienelse
23660484Sobrien    AC_MSG_RESULT(none)
23760484Sobrienfi
23860484SobrienAC_SUBST(BFDLIB)
23960484Sobrien])
24060484Sobrien
24160484Sobriendnl ====================================================================
24260484Sobriendnl Find the libiberty library. This defines many commonly used C
24360484Sobriendnl functions that exists in various states based on the underlying OS.
244218822SdimAC_DEFUN([CYG_AC_PATH_LIBERTY], [
24560484SobrienAC_MSG_CHECKING(for the liberty library in the build tree)
24660484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
24760484SobrienAC_CACHE_VAL(ac_cv_c_liberty,[
24860484Sobrienfor i in $dirlist; do
24960484Sobrien    if test -f "$i/libiberty/Makefile" ; then
250104834Sobrien	ac_cv_c_liberty=`(cd $i/libiberty; ${PWDCMD-pwd})`
25160484Sobrien    fi
25260484Sobriendone
25360484Sobrien])
25460484Sobrienif test x"${ac_cv_c_liberty}" != x; then
25560484Sobrien    LIBERTY="-L${ac_cv_c_liberty}"
25660484Sobrien    AC_MSG_RESULT(${ac_cv_c_liberty})
25760484Sobrienelse
25860484Sobrien    AC_MSG_RESULT(none)
25960484Sobrienfi
26060484SobrienAC_SUBST(LIBERTY)
26160484Sobrien])
26260484Sobrien
26360484Sobriendnl ====================================================================
26460484Sobriendnl Find the opcodes library. This is used to do dissasemblies.
265218822SdimAC_DEFUN([CYG_AC_PATH_OPCODES], [
26660484SobrienAC_MSG_CHECKING(for the opcodes library in the build tree)
26760484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
26860484SobrienAC_CACHE_VAL(ac_cv_c_opc,[
26960484Sobrienfor i in $dirlist; do
27060484Sobrien    if test -f "$i/opcodes/Makefile" ; then
271104834Sobrien	ac_cv_c_opc=`(cd $i/opcodes; ${PWDCMD-pwd})`
27260484Sobrien    fi
27360484Sobriendone
27460484Sobrien])
27560484Sobrienif test x"${ac_cv_c_opc}" != x; then
27660484Sobrien    OPCODESLIB="-L${ac_cv_c_opc}"
27760484Sobrien    AC_MSG_RESULT(${ac_cv_c_opc})
27860484Sobrienelse
27960484Sobrien    AC_MSG_RESULT(none)
28060484Sobrienfi
28160484SobrienAC_SUBST(OPCODESLIB)
28260484Sobrien])
28360484Sobrien
28460484Sobriendnl ====================================================================
28560484Sobriendnl Look for the DejaGnu header file in the source tree. This file
28660484Sobriendnl defines the functions used to testing support.
287218822SdimAC_DEFUN([CYG_AC_PATH_DEJAGNU], [
28860484SobrienAC_MSG_CHECKING(for the testing support files in the source tree)
28960484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
29060484SobrienAC_CACHE_VAL(ac_cv_c_dejagnu,[
29160484Sobrienfor i in $dirlist; do
29260484Sobrien    if test -f "$srcdir/$i/ecc/ecc/infra/testlib/current/include/dejagnu.h" ; then
293104834Sobrien	ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; ${PWDCMD-pwd})`
29460484Sobrien    fi
29560484Sobriendone
29660484Sobrien])
29760484Sobrienif test x"${ac_cv_c_dejagnu}" != x; then
29860484Sobrien    DEJAGNUHDIR="-I${ac_cv_c_dejagnu}"
29960484Sobrien    AC_MSG_RESULT(${ac_cv_c_dejagnu})
30060484Sobrienelse
30160484Sobrien    AC_MSG_RESULT(none)
30260484Sobrienfi
30360484SobrienAC_CACHE_VAL(ac_cv_c_dejagnulib,[
30460484Sobrienfor i in $dirlist; do
30560484Sobrien    if test -f "$srcdir/$i/infra/testlib/current/lib/hostutil.exp" ; then
306104834Sobrien	ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; ${PWDCMD-pwd})`
30760484Sobrien    fi
30860484Sobriendone
30960484Sobrien])
31060484Sobrienif test x"${ac_cv_c_dejagnulib}" != x; then
31160484Sobrien    DEJAGNULIB="${ac_cv_c_dejagnulib}"
31260484Sobrienelse
31360484Sobrien    DEJAGNULIB=""
31460484Sobrienfi
31560484SobrienAC_MSG_CHECKING(for runtest in the source tree)
31660484SobrienAC_CACHE_VAL(ac_cv_c_runtest,[
31760484Sobrienfor i in $dirlist; do
31860484Sobrien    if test -f "$srcdir/$i/dejagnu/runtest" ; then
319104834Sobrien	ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; ${PWDCMD-pwd})`
32060484Sobrien    fi
32160484Sobriendone
32260484Sobrien])
32360484Sobrienif test x"${ac_cv_c_runtest}" != x; then
32460484Sobrien    RUNTESTDIR="${ac_cv_c_runtest}"
32560484Sobrien   AC_MSG_RESULT(${ac_cv_c_runtest})
32660484Sobrienelse
32760484Sobrien    RUNTESTDIR=""
32860484Sobrien    AC_MSG_RESULT(none)
32960484Sobrienfi
33060484SobrienAC_SUBST(RUNTESTDIR)
33160484SobrienAC_SUBST(DEJAGNULIB)
33260484SobrienAC_SUBST(DEJAGNUHDIR)
33360484Sobrien])
33460484Sobrien
33560484Sobriendnl ====================================================================
33660484Sobriendnl Find the libintl library in the build tree. This is for
33760484Sobriendnl  internationalization support.
338218822SdimAC_DEFUN([CYG_AC_PATH_INTL], [
33960484SobrienAC_MSG_CHECKING(for the intl header in the build tree)
34060484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
34160484Sobriendnl Look for the header file
34260484SobrienAC_CACHE_VAL(ac_cv_c_intlh,[
34360484Sobrienfor i in $dirlist; do
34460484Sobrien    if test -f "$i/intl/libintl.h" ; then
345104834Sobrien	ac_cv_c_intlh=`(cd $i/intl; ${PWDCMD-pwd})`
34660484Sobrien	break
34760484Sobrien    fi
34860484Sobriendone
34960484Sobrien])
35060484Sobrienif test x"${ac_cv_c_intlh}" != x; then
35160484Sobrien    INTLHDIR="-I${ac_cv_c_intlh}"
35260484Sobrien    AC_MSG_RESULT(${ac_cv_c_intlh})
35360484Sobrienelse
35460484Sobrien    AC_MSG_RESULT(none)
35560484Sobrienfi
35660484SobrienAC_SUBST(INTLHDIR)
35760484Sobrien
35860484Sobriendnl Look for the library
35960484SobrienAC_MSG_CHECKING(for the libintl library in the build tree)
36060484SobrienAC_CACHE_VAL(ac_cv_c_intllib,[
36160484Sobrienfor i in $dirlist; do
36260484Sobrien    if test -f "$i/intl/Makefile" ; then
363104834Sobrien	ac_cv_c_intllib=`(cd $i/intl; ${PWDCMD-pwd})`
36460484Sobrien    fi
36560484Sobriendone
36660484Sobrien])
36760484Sobrienif test x"${ac_cv_c_intllib}" != x; then
36860484Sobrien    INTLLIB="-L${ac_cv_c_intllib} -lintl"
36960484Sobrien    AC_MSG_RESULT(${ac_cv_c_intllib})
37060484Sobrienelse
37160484Sobrien    AC_MSG_RESULT(none)
37260484Sobrienfi
37360484SobrienAC_SUBST(INTLLIB)
37460484Sobrien])
37560484Sobrien
37660484Sobriendnl ====================================================================
37760484Sobriendnl Find the simulator library.
378218822SdimAC_DEFUN([CYG_AC_PATH_SIM], [
37960484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.."
38060484Sobriencase "$target_cpu" in
38160484Sobrien    powerpc)	target_dir=ppc ;;
38260484Sobrien    sparc*)	target_dir=erc32 ;;
38360484Sobrien    mips*)	target_dir=mips ;;
38460484Sobrien    *)		target_dir=$target_cpu ;;
38560484Sobrienesac
38660484Sobriendnl First look for the header file
38760484SobrienAC_MSG_CHECKING(for the simulator header file)
38860484SobrienAC_CACHE_VAL(ac_cv_c_simh,[
38960484Sobrienfor i in $dirlist; do
39060484Sobrien    if test -f "${srcdir}/$i/include/remote-sim.h" ; then
391104834Sobrien	ac_cv_c_simh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
39260484Sobrien	break
39360484Sobrien    fi
39460484Sobriendone
39560484Sobrien])
39660484Sobrienif test x"${ac_cv_c_simh}" != x; then
39760484Sobrien    SIMHDIR="-I${ac_cv_c_simh}"
39860484Sobrien    AC_MSG_RESULT(${ac_cv_c_simh})
39960484Sobrienelse
40060484Sobrien    AC_MSG_RESULT(none)
40160484Sobrienfi
40260484SobrienAC_SUBST(SIMHDIR)
40360484Sobrien
40460484Sobriendnl See whether it's a devo or Foundry branch simulator
40560484SobrienAC_MSG_CHECKING(Whether this is a devo simulator )
40660484SobrienAC_CACHE_VAL(ac_cv_c_simdevo,[
40760484Sobrien    CPPFLAGS="$CPPFLAGS $SIMHDIR"
40860484Sobrien    AC_EGREP_HEADER([SIM_DESC sim_open.*struct _bfd], remote-sim.h,
40960484Sobrien        ac_cv_c_simdevo=yes,
41060484Sobrien        ac_cv_c_simdevo=no)
41160484Sobrien])
41260484Sobrienif test x"$ac_cv_c_simdevo" = x"yes" ; then
41360484Sobrien    AC_DEFINE(HAVE_DEVO_SIM)
41460484Sobrienfi
41560484SobrienAC_MSG_RESULT(${ac_cv_c_simdevo})
41660484SobrienAC_SUBST(HAVE_DEVO_SIM)
41760484Sobrien
41860484Sobriendnl Next look for the library
41960484SobrienAC_MSG_CHECKING(for the simulator library)
42060484SobrienAC_CACHE_VAL(ac_cv_c_simlib,[
42160484Sobrienfor i in $dirlist; do
42260484Sobrien    if test -f "$i/sim/$target_dir/Makefile" ; then
423104834Sobrien	ac_cv_c_simlib=`(cd $i/sim/$target_dir; ${PWDCMD-pwd})`
42460484Sobrien    fi
42560484Sobriendone
42660484Sobrien])
42760484Sobrienif test x"${ac_cv_c_simlib}" != x; then
42860484Sobrien    SIMLIB="-L${ac_cv_c_simlib}"
42960484Sobrienelse
43060484Sobrien    AC_MSG_RESULT(none)
43160484Sobrien    dnl FIXME: this is kinda bogus, cause umtimately the TM will build
43260484Sobrien    dnl all the libraries for several architectures. But for now, this
43360484Sobrien    dnl will work till then.
43460484Sobriendnl     AC_MSG_CHECKING(for the simulator installed with the compiler libraries)
43560484Sobrien    dnl Transform the name of the compiler to it's cross variant, unless
43660484Sobrien    dnl CXX is set. This is also what CXX gets set to in the generated
43760484Sobrien    dnl Makefile.
43860484Sobrien    CROSS_GCC=`echo gcc | sed -e "s/^/$target/"`
43960484Sobrien
44060484Sobrien    dnl Get G++'s full path to libgcc.a
44160484Sobrienchangequote(,)
44260484Sobrien    gccpath=`${CROSS_GCC} --print-libgcc | sed -e 's:[a-z0-9A-Z\.\-]*/libgcc.a::' -e 's:lib/gcc-lib/::'`lib
44360484Sobrienchangequote([,])
44460484Sobrien    if test -f $gccpath/libsim.a -o -f $gccpath/libsim.so ; then
44560484Sobrien        ac_cv_c_simlib="$gccpath/"
44660484Sobrien        SIMLIB="-L${ac_cv_c_simlib}"
44760484Sobrien	AC_MSG_RESULT(${ac_cv_c_simlib})
44860484Sobrien    else
44960484Sobrien        AM_CONDITIONAL(PSIM, test x$psim = xno)
45060484Sobrien	SIMLIB=""
45160484Sobrien	AC_MSG_RESULT(none)
45260484Sobriendnl         ac_cv_c_simlib=none
45360484Sobrien    fi
45460484Sobrienfi
45560484SobrienAC_SUBST(SIMLIB)
45660484Sobrien])
45760484Sobrien
45860484Sobriendnl ====================================================================
45960484Sobriendnl Find the libiberty library.
460218822SdimAC_DEFUN([CYG_AC_PATH_LIBIBERTY], [
46160484SobrienAC_MSG_CHECKING(for the libiberty library in the build tree)
46260484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
46360484SobrienAC_CACHE_VAL(ac_cv_c_libib,[
46460484Sobrienfor i in $dirlist; do
46560484Sobrien    if test -f "$i/libiberty/Makefile" ; then
466104834Sobrien	ac_cv_c_libib=`(cd $i/libiberty/; ${PWDCMD-pwd})`
46760484Sobrien    fi
46860484Sobriendone
46960484Sobrien])
47060484Sobrienif test x"${ac_cv_c_libib}" != x; then
47160484Sobrien    LIBIBERTY="-L${ac_cv_c_libib}"
47260484Sobrien    AC_MSG_RESULT(${ac_cv_c_libib})
47360484Sobrienelse
47460484Sobrien    AC_MSG_RESULT(none)
47560484Sobrienfi
47660484SobrienAC_SUBST(LIBIBERTY)
47760484Sobrien])
47860484Sobrien
47960484Sobriendnl ====================================================================
480218822SdimAC_DEFUN([CYG_AC_PATH_DEVO], [
48160484SobrienAC_MSG_CHECKING(for devo headers in the source tree)
48260484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
48360484SobrienAC_CACHE_VAL(ac_cv_c_devoh,[
48460484Sobrienfor i in $dirlist; do
48560484Sobrien    if test -f "${srcdir}/$i/include/remote-sim.h" ; then
486104834Sobrien	ac_cv_c_devoh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
48760484Sobrien    fi
48860484Sobriendone
48960484Sobrien])
49060484Sobrienif test x"${ac_cv_c_devoh}" != x; then
49160484Sobrien    DEVOHDIR="-I${ac_cv_c_devoh}"
49260484Sobrien    AC_MSG_RESULT(${ac_cv_c_devoh})
49360484Sobrienelse
49460484Sobrien    AC_MSG_RESULT(none)
49560484Sobrienfi
49660484SobrienAC_SUBST(DEVOHDIR)
49760484Sobrien])
49860484Sobrien
49960484Sobriendnl ====================================================================
50060484Sobriendnl find the IDE library and headers.
501218822SdimAC_DEFUN([CYG_AC_PATH_IDE], [
50260484SobrienAC_MSG_CHECKING(for IDE headers in the source tree)
50360484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
50460484SobrienIDEHDIR=
50560484SobrienIDELIB=
50660484SobrienAC_CACHE_VAL(ac_cv_c_ideh,[
50760484Sobrienfor i in $dirlist; do
50860484Sobrien    if test -f "${srcdir}/$i/libide/src/event.h" ; then
509104834Sobrien	ac_cv_c_ideh=`(cd ${srcdir}/$i/libide/src; ${PWDCMD-pwd})`;
51060484Sobrien    fi
51160484Sobriendone
51260484Sobrien])
51360484Sobrienif test x"${ac_cv_c_ideh}" != x; then
51460484Sobrien    IDEHDIR="-I${ac_cv_c_ideh}"
51560484Sobrien    AC_MSG_RESULT(${ac_cv_c_ideh})
51660484Sobrienelse
51760484Sobrien    AC_MSG_RESULT(none)
51860484Sobrienfi
51960484Sobrien
52060484SobrienAC_MSG_CHECKING(for LIBIDE TCL headers in the source tree)
52160484SobrienAC_CACHE_VAL(ac_cv_c_idetclh,[
52260484Sobrienfor i in $dirlist; do
52360484Sobrien    if test -f "${srcdir}/$i/libidetcl/src/idetcl.h" ; then
524104834Sobrien	ac_cv_c_idetclh=`(cd ${srcdir}/$i/libidetcl/src; ${PWDCMD-pwd})`;
52560484Sobrien    fi
52660484Sobriendone
52760484Sobrien])
52860484Sobrienif test x"${ac_cv_c_idetclh}" != x; then
52960484Sobrien    IDEHDIR="${IDEHDIR} -I${ac_cv_c_idetclh}"
53060484Sobrien    AC_MSG_RESULT(${ac_cv_c_idetclh})
53160484Sobrienelse
53260484Sobrien    AC_MSG_RESULT(none)
53360484Sobrienfi
53460484Sobrien
53560484SobrienAC_MSG_CHECKING(for IDE headers in the build tree)
53660484SobrienAC_CACHE_VAL(ac_cv_c_ideh2,[
53760484Sobrienfor i in $dirlist; do
53860484Sobrien    if test -f "$i/libide/src/Makefile" ; then
539104834Sobrien	ac_cv_c_ideh2=`(cd $i/libide/src; ${PWDCMD-pwd})`;
54060484Sobrien    fi
54160484Sobriendone
54260484Sobrien])
54360484Sobrienif test x"${ac_cv_c_ideh2}" != x; then
54460484Sobrien    IDEHDIR="${IDEHDIR} -I${ac_cv_c_ideh2}"
54560484Sobrien    AC_MSG_RESULT(${ac_cv_c_ideh2})
54660484Sobrienelse
54760484Sobrien    AC_MSG_RESULT(none)
54860484Sobrienfi
54960484Sobrien
55060484Sobriendnl look for the library
55160484SobrienAC_MSG_CHECKING(for IDE library)
55260484SobrienAC_CACHE_VAL(ac_cv_c_idelib,[
55360484Sobrienif test x"${ac_cv_c_idelib}" = x ; then
55460484Sobrien    for i in $dirlist; do
55560484Sobrien      if test -f "$i/libide/src/Makefile" ; then
556104834Sobrien        ac_cv_c_idelib=`(cd $i/libide/src; ${PWDCMD-pwd})`
55760484Sobrien        break
55860484Sobrien      fi
55960484Sobrien    done
56060484Sobrienfi]) 
56160484Sobrienif test x"${ac_cv_c_idelib}" != x ; then
56260484Sobrien     IDELIB="-L${ac_cv_c_idelib}"
56360484Sobrien     AC_MSG_RESULT(${ac_cv_c_idelib})
56460484Sobrienelse
56560484Sobrien     AC_MSG_RESULT(none)
56660484Sobrienfi
56760484Sobrien
56860484Sobriendnl find libiddetcl.a if it exists
56960484SobrienAC_MSG_CHECKING(for IDE TCL library)
57060484SobrienAC_CACHE_VAL(ac_cv_c_idetcllib,[
57160484Sobrienif test x"${ac_cv_c_idetcllib}" = x ; then
57260484Sobrien    for i in $dirlist; do
57360484Sobrien      if test -f "$i/libidetcl/src/Makefile" ; then
574104834Sobrien        ac_cv_c_idetcllib=`(cd $i/libidetcl/src; ${PWDCMD-pwd})`
57560484Sobrien        break
57660484Sobrien      fi
57760484Sobrien    done
57860484Sobrienfi
57960484Sobrien]) 
58060484Sobrienif test x"${ac_cv_c_idetcllib}" != x ; then
58160484Sobrien     IDELIB="${IDELIB} -L${ac_cv_c_idetcllib}"
58260484Sobrien     IDETCLLIB="-lidetcl"
58360484Sobrien     AC_MSG_RESULT(${ac_cv_c_idetcllib})
58460484Sobrienelse
58560484Sobrien     AC_MSG_RESULT(none)
58660484Sobrienfi
58760484SobrienAC_SUBST(IDEHDIR)
58860484SobrienAC_SUBST(IDELIB)
58960484SobrienAC_SUBST(IDETCLLIB)
59060484Sobrien])
59160484Sobrien
59260484Sobriendnl ====================================================================
59360484Sobriendnl Find all the ILU headers and libraries
594218822SdimAC_DEFUN([CYG_AC_PATH_ILU], [
59560484SobrienAC_MSG_CHECKING(for ILU kernel headers in the source tree)
59660484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
59760484SobrienAC_CACHE_VAL(ac_cv_c_iluh,[
59860484Sobrienfor i in $dirlist; do
59960484Sobrien    if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then
600104834Sobrien	ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; ${PWDCMD-pwd})`
60160484Sobrien    fi
60260484Sobriendone
60360484Sobrien])
60460484Sobrienif test x"${ac_cv_c_iluh}" != x; then
60560484Sobrien    ILUHDIR="-I${ac_cv_c_iluh}"
60660484Sobrien    AC_MSG_RESULT(${ac_cv_c_iluh})
60760484Sobrienelse
60860484Sobrien    AC_MSG_RESULT(none)
60960484Sobrienfi
61060484Sobrien
61160484SobrienAC_MSG_CHECKING(for ILU kernel headers in the build tree)
61260484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
61360484SobrienAC_CACHE_VAL(ac_cv_c_iluh5,[
61460484Sobrienfor i in $dirlist; do
61560484Sobrien    if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then
616104834Sobrien	ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; ${PWDCMD-pwd})`
61760484Sobrien    fi
61860484Sobriendone
61960484Sobrien])
62060484Sobrienif test x"${ac_cv_c_iluh5}" != x; then
62160484Sobrien    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh5}"
62260484Sobrien    AC_MSG_RESULT(${ac_cv_c_iluh5})
62360484Sobrienelse
62460484Sobrien    AC_MSG_RESULT(none)
62560484Sobrienfi
62660484Sobrien
62760484SobrienAC_MSG_CHECKING(for ILU C++ headers in the source tree)
62860484SobrienAC_CACHE_VAL(ac_cv_c_iluh2,[
62960484Sobrienfor i in $dirlist; do
63060484Sobrien    if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then
631104834Sobrien	ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; ${PWDCMD-pwd})`
63260484Sobrien    fi
63360484Sobriendone
63460484Sobrien])
63560484Sobrienif test x"${ac_cv_c_iluh2}" != x; then
63660484Sobrien    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh2}"
63760484Sobrien    AC_MSG_RESULT(${ac_cv_c_iluh2})
63860484Sobrienelse
63960484Sobrien    AC_MSG_RESULT(none)
64060484Sobrienfi
64160484Sobrien
64260484SobrienAC_MSG_CHECKING(for ILU C headers)
64360484SobrienAC_CACHE_VAL(ac_cv_c_iluh3,[
64460484Sobrienfor i in $dirlist; do
64560484Sobrien    if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then
646104834Sobrien	ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c  ; ${PWDCMD-pwd})`
64760484Sobrien    fi
64860484Sobriendone
64960484Sobrien])
65060484Sobrienif test x"${ac_cv_c_iluh3}" != x; then
65160484Sobrien    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh3}"
65260484Sobrien    AC_MSG_RESULT(${ac_cv_c_iluh3})
65360484Sobrienelse
65460484Sobrien    AC_MSG_RESULT(none)
65560484Sobrienfi
65660484Sobrien
65760484SobrienAC_MSG_CHECKING(for ILU C runtime headers)
65860484SobrienAC_CACHE_VAL(ac_cv_c_iluh4,[
65960484Sobrienfor i in $dirlist; do
66060484Sobrien    if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then
661104834Sobrien	ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c  ; ${PWDCMD-pwd})`
66260484Sobrien    fi
66360484Sobriendone
66460484Sobrien])
66560484Sobrienif test x"${ac_cv_c_iluh4}" != x; then
66660484Sobrien    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh4}"
66760484Sobrien    AC_MSG_RESULT(${ac_cv_c_iluh4})
66860484Sobrienelse
66960484Sobrien    AC_MSG_RESULT(none)
67060484Sobrienfi
67160484Sobrien
67260484SobrienAC_CACHE_VAL(ac_cv_c_ilupath,[
67360484Sobrienfor i in $dirlist; do
67460484Sobrien    if test -f "$i/ilu/Makefile" ; then
675104834Sobrien	ac_cv_c_ilupath=`(cd $i/ilu; ${PWDCMD-pwd})`
67660484Sobrien	break
67760484Sobrien    fi
67860484Sobriendone
67960484Sobrien])
68060484SobrienILUTOP=${ac_cv_c_ilupath}
68160484Sobrien
68260484SobrienAC_MSG_CHECKING(for the ILU library in the build tree)
68360484SobrienAC_CACHE_VAL(ac_cv_c_ilulib,[
68460484Sobrienif test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then
685104834Sobrien    ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; ${PWDCMD-pwd})`
68660484Sobrien    AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a)
68760484Sobrienelse
68860484Sobrien    AC_MSG_RESULT(no)
68960484Sobrienfi])
69060484Sobrien   
69160484SobrienAC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
69260484SobrienAC_CACHE_VAL(ac_cv_c_ilulib2,[
69360484Sobrienif test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then
694104834Sobrien    ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; ${PWDCMD-pwd})`
69560484Sobrien    AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a)
69660484Sobrienelse
69760484Sobrien    AC_MSG_RESULT(no)
69860484Sobrienfi])
69960484Sobrien
70060484SobrienAC_MSG_CHECKING(for the ILU C bindings library in the build tree)
70160484SobrienAC_CACHE_VAL(ac_cv_c_ilulib3,[
70260484Sobrienif test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then
703104834Sobrien    ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; ${PWDCMD-pwd})`
70460484Sobrien    AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a)
70560484Sobrienelse
70660484Sobrien    AC_MSG_RESULT(no)
70760484Sobrienfi])
70860484Sobrien
70960484SobrienAC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
71060484SobrienAC_CACHE_VAL(ac_cv_c_ilulib4,[
71160484Sobrienif test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then
712104834Sobrien    ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; ${PWDCMD-pwd})`
71360484Sobrien    AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a)
71460484Sobrienelse
71560484Sobrien    AC_MSG_RESULT(no)
71660484Sobrienfi])
71760484Sobrien
71860484Sobrienif test x"${ac_cv_c_ilulib}" = x -a x"${ac_cv_c_ilulib2}" = x; then
71960484Sobrien  ILUHDIR=""
72060484Sobrienfi
72160484Sobrien
72260484Sobrienif test x"${ac_cv_c_ilulib}" != x -a x"${ac_cv_c_ilulib2}" != x; then
72360484Sobrien    ILULIB="-L${ac_cv_c_ilulib} -L${ac_cv_c_ilulib2} -L${ac_cv_c_ilulib3} -L${ac_cv_c_ilulib4}"
72460484Sobrienelse
72560484Sobrien    ILULIB=""
72660484Sobrienfi
72760484Sobrien
72860484Sobrienif test x"${ILULIB}" = x; then
72960484Sobrien    AC_MSG_CHECKING(for ILU libraries installed with the compiler)
73060484Sobrien    AC_CACHE_VAL(ac_cv_c_ilulib5,[
73160484Sobrien    NATIVE_GCC=`echo gcc | sed -e "${program_transform_name}"`
73260484Sobrien
73360484Sobrien    dnl Get G++'s full path to it's libraries
73460484Sobrien    ac_cv_c_ilulib5=`${NATIVE_GCC} --print-libgcc | sed -e 's:lib/gcc-lib/.*::'`lib
73560484Sobrien    if test -f $ac_cv_c_ilulib5/libilu-c.a -o -f $ac_cv_c_ilulib5/libilu-c.so ; then
73660484Sobrien        if test x"${ILUHDIR}" = x; then
73760484Sobrien               ILUHDIR="-I${ac_cv_c_ilulib5}/../include"
73860484Sobrien        fi
73960484Sobrien        ILULIB="-L${ac_cv_c_ilulib5}"
74060484Sobrien        AC_MSG_RESULT(${ac_cv_c_ilulib5})
74160484Sobrien    else
74260484Sobrien        ac_cv_c_ilulib=none
74360484Sobrien        AC_MSG_RESULT(none)
74460484Sobrien    fi
74560484Sobrienfi])
74660484SobrienAC_SUBST(ILUHDIR)
74760484SobrienAC_SUBST(ILULIB)
74860484SobrienAC_SUBST(ILUTOP)
74960484Sobrien])
75060484Sobrien
75160484Sobriendnl ====================================================================
75260484Sobriendnl This defines the byte order for the host. We can't use
75360484Sobriendnl AC_C_BIGENDIAN, cause we want to create a config file and
75460484Sobriendnl substitue the real value, so the header files work right
755218822SdimAC_DEFUN([CYG_AC_C_ENDIAN], [
75660484SobrienAC_MSG_CHECKING(to see if this is a little endian host)
75760484SobrienAC_CACHE_VAL(ac_cv_c_little_endian, [
75860484Sobrienac_cv_c_little_endian=unknown
75960484Sobrien# See if sys/param.h defines the BYTE_ORDER macro.
76060484SobrienAC_TRY_COMPILE([#include <sys/types.h>
76160484Sobrien#include <sys/param.h>], [
76260484Sobrien#if !BYTE_ORDER || !_BIG_ENDIAN || !_LITTLE_ENDIAN
76360484Sobrien bogus endian macros
76460484Sobrien#endif], [# It does; now see whether it defined to _LITTLE_ENDIAN or not.
76560484SobrienAC_TRY_COMPILE([#include <sys/types.h>
76660484Sobrien#include <sys/param.h>], [
76760484Sobrien#if BYTE_ORDER != _LITTLE_ENDIAN
76860484Sobrien not big endian
76960484Sobrien#endif], ac_cv_c_little_endian=yes, ac_cv_c_little_endian=no)
77060484Sobrien])
77160484Sobrienif test ${ac_cv_c_little_endian} = unknown; then
77260484Sobrienold_cflags=$CFLAGS
77360484SobrienCFLAGS=-g
77460484SobrienAC_TRY_RUN([
77560484Sobrienmain () {
77660484Sobrien  /* Are we little or big endian?  From Harbison&Steele.  */
77760484Sobrien  union
77860484Sobrien  {
77960484Sobrien    long l;
78060484Sobrien    char c[sizeof (long)];
78160484Sobrien  } u;
78260484Sobrien  u.l = 1;
78360484Sobrien  exit (u.c[0] == 1);
78460484Sobrien}],
78560484Sobrienac_cv_c_little_endian=no,
78660484Sobrienac_cv_c_little_endian=yes,[
78760484Sobriendnl Yes, this is ugly, and only used for a canadian cross anyway. This
78860484Sobriendnl is just to keep configure from stopping here.
78960484Sobriencase "${host}" in
79060484Sobrienchangequote(,)
791218822Sdim   i[3456789]86-*-*) ac_cv_c_little_endian=yes ;;
79260484Sobrien   sparc*-*-*)    ac_cv_c_little_endian=no ;;
79360484Sobrienchangequote([,])
79460484Sobrien  *)    AC_MSG_WARN(Can't cross compile this test) ;;
79560484Sobrienesac])
79660484SobrienCFLAGS=$old_cflags
79760484Sobrienfi])
79860484Sobrien
79960484Sobrienif test x"${ac_cv_c_little_endian}" = xyes; then
80060484Sobrien    AC_DEFINE(LITTLE_ENDIAN_HOST)
80160484Sobrien    ENDIAN="CYG_LSBFIRST";
80260484Sobrienelse
80360484Sobrien    ENDIAN="CYG_MSBFIRST";
80460484Sobrienfi
80560484SobrienAC_MSG_RESULT(${ac_cv_c_little_endian})
80660484SobrienAC_SUBST(ENDIAN)
80760484Sobrien])
80860484Sobrien
80960484Sobriendnl ====================================================================
81060484Sobriendnl Look for the path to libgcc, so we can use it to directly link
81160484Sobriendnl in libgcc.a with LD.
812218822SdimAC_DEFUN([CYG_AC_PATH_LIBGCC],
81360484Sobrien[AC_MSG_CHECKING([Looking for the path to libgcc.a])
81460484SobrienAC_LANG_SAVE
81560484SobrienAC_LANG_C
81660484Sobrien
81760484Sobriendnl Get Gcc's full path to libgcc.a
81860484Sobrienlibgccpath=`${CC} --print-libgcc`
81960484Sobrien
82060484Sobriendnl If we don't have a path with libgcc.a on the end, this isn't G++.
82160484Sobrienif test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
82260484Sobrien   ac_cv_prog_gcc=yes
82360484Sobrienelse
82460484Sobrien   ac_cv_prog_gcc=no
82560484Sobrienfi
82660484Sobrien
82760484Sobriendnl 
82860484Sobrienif test x"${ac_cv_prog_gcc}" = xyes ; then
82960484Sobrien   gccpath=`echo $libgccpath | sed -e 's:/libgcc.a::'`
83060484Sobrien   LIBGCC="-L${gccpath}"
83160484Sobrien   AC_MSG_RESULT(${gccpath})
83260484Sobrienelse
83360484Sobrien   LIBGCC=""
83460484Sobrien   AC_MSG_ERROR(Not using gcc)
83560484Sobrienfi
83660484Sobrien
83760484SobrienAC_LANG_RESTORE
83860484SobrienAC_SUBST(LIBGCC)
83960484Sobrien])
84060484Sobrien
84160484Sobriendnl ====================================================================
84260484Sobriendnl Ok, lets find the tcl source trees so we can use the headers
84360484Sobriendnl Warning: transition of version 9 to 10 will break this algorithm
84460484Sobriendnl because 10 sorts before 9. We also look for just tcl. We have to
84560484Sobriendnl be careful that we don't match stuff like tclX by accident.
84660484Sobriendnl the alternative search directory is involked by --with-tclinclude
847218822SdimAC_DEFUN([CYG_AC_PATH_TCL], [
84860484Sobrien    CYG_AC_PATH_TCLH
84960484Sobrien    CYG_AC_PATH_TCLCONFIG
85060484Sobrien    CYG_AC_LOAD_TCLCONFIG
85160484Sobrien])
852218822SdimAC_DEFUN([CYG_AC_PATH_TCLH], [
85360484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
85460484Sobrienno_tcl=true
85560484SobrienAC_MSG_CHECKING(for Tcl headers in the source tree)
85660484SobrienAC_ARG_WITH(tclinclude, [  --with-tclinclude       directory where tcl headers are], with_tclinclude=${withval})
85760484SobrienAC_CACHE_VAL(ac_cv_c_tclh,[
85860484Sobriendnl first check to see if --with-tclinclude was specified
85960484Sobrienif test x"${with_tclinclude}" != x ; then
86060484Sobrien  if test -f ${with_tclinclude}/tcl.h ; then
861104834Sobrien    ac_cv_c_tclh=`(cd ${with_tclinclude}; ${PWDCMD-pwd})`
86260484Sobrien  elif test -f ${with_tclinclude}/generic/tcl.h ; then
863104834Sobrien    ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; ${PWDCMD-pwd})`
86460484Sobrien  else
86560484Sobrien    AC_MSG_ERROR([${with_tclinclude} directory doesn't contain headers])
86660484Sobrien  fi
86760484Sobrienfi
86860484Sobrien
86960484Sobriendnl next check if it came with Tcl configuration file
87060484Sobrienif test x"${ac_cv_c_tclconfig}" != x ; then
87160484Sobrien  for i in $dirlist; do
87260484Sobrien    if test -f $ac_cv_c_tclconfig/$i/generic/tcl.h ; then
873104834Sobrien      ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/$i/generic; ${PWDCMD-pwd})`
87460484Sobrien      break
87560484Sobrien    fi
87660484Sobrien  done
87760484Sobrienfi
87860484Sobrien
87960484Sobriendnl next check in private source directory
88060484Sobriendnl since ls returns lowest version numbers first, reverse its output
88160484Sobrienif test x"${ac_cv_c_tclh}" = x ; then
88260484Sobrien    dnl find the top level Tcl source directory
88360484Sobrien    for i in $dirlist; do
88460484Sobrien        if test -n "`ls -dr $srcdir/$i/tcl* 2>/dev/null`" ; then
88560484Sobrien	    tclpath=$srcdir/$i
88660484Sobrien	    break
88760484Sobrien	fi
88860484Sobrien    done
88960484Sobrien
89060484Sobrien    dnl find the exact Tcl source dir. We do it this way, cause there
89160484Sobrien    dnl might be multiple version of Tcl, and we want the most recent one.
89260484Sobrien    for i in `ls -dr $tclpath/tcl* 2>/dev/null ` ; do
89360484Sobrien        if test -f $i/generic/tcl.h ; then
894104834Sobrien          ac_cv_c_tclh=`(cd $i/generic; ${PWDCMD-pwd})`
89560484Sobrien          break
89660484Sobrien        fi
89760484Sobrien    done
89860484Sobrienfi
89960484Sobrien
90060484Sobriendnl check if its installed with the compiler
90160484Sobrienif test x"${ac_cv_c_tclh}" = x ; then
90260484Sobrien    dnl Get the path to the compiler
90360484Sobrien    ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/include
90460484Sobrien    if test -f $ccpath/tcl.h; then
90560484Sobrien        ac_cv_c_tclh=$ccpath
90660484Sobrien    fi
90760484Sobrienfi
90860484Sobrien
90960484Sobriendnl see if one is installed
91060484Sobrienif test x"${ac_cv_c_tclh}" = x ; then
91160484Sobrien   AC_MSG_RESULT(none)
91260484Sobrien   AC_CHECK_HEADER(tcl.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
91360484Sobrienelse
91460484Sobrien   AC_MSG_RESULT(${ac_cv_c_tclh})
91560484Sobrienfi
91660484Sobrien])
91760484Sobrien  TCLHDIR=""
91860484Sobrienif test x"${ac_cv_c_tclh}" = x ; then
91960484Sobrien    AC_MSG_ERROR([Can't find any Tcl headers])
92060484Sobrienfi
92160484Sobrienif test x"${ac_cv_c_tclh}" != x ; then
92260484Sobrien    no_tcl=""
92360484Sobrien    if test x"${ac_cv_c_tclh}" != x"installed" ; then
92460484Sobrien	if test x"${CC}" = xcl ; then
92560484Sobrien	    tmp="`cygpath --windows ${ac_cv_c_tclh}`"
92660484Sobrien	    ac_cv_c_tclh="`echo $tmp | sed -e s#\\\\\\\\#/#g`"
92760484Sobrien	fi
92860484Sobrien        AC_MSG_RESULT(${ac_cv_c_tclh})
92960484Sobrien        TCLHDIR="-I${ac_cv_c_tclh}"
93060484Sobrien    fi
93160484Sobrienfi
93260484Sobrien
93360484SobrienAC_SUBST(TCLHDIR)
93460484Sobrien])
93560484Sobrien
93660484Sobriendnl ====================================================================
93760484Sobriendnl Ok, lets find the tcl configuration
938218822SdimAC_DEFUN([CYG_AC_PATH_TCLCONFIG], [
93960484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
94060484Sobriendnl First, look for one uninstalled.  
94160484Sobriendnl the alternative search directory is invoked by --with-tclconfig
94260484Sobrienif test x"${no_tcl}" = x ; then
94360484Sobrien  dnl we reset no_tcl in case something fails here
94460484Sobrien    no_tcl=true
94560484Sobrien    AC_ARG_WITH(tclconfig, [  --with-tclconfig           directory containing tcl configuration (tclConfig.sh)],
94660484Sobrien         with_tclconfig=${withval})
94760484Sobrien    AC_MSG_CHECKING([for Tcl configuration script])
94860484Sobrien    AC_CACHE_VAL(ac_cv_c_tclconfig,[
94960484Sobrien
95060484Sobrien    dnl First check to see if --with-tclconfig was specified.
95160484Sobrien    if test x"${with_tclconfig}" != x ; then
95260484Sobrien        if test -f "${with_tclconfig}/tclConfig.sh" ; then
953104834Sobrien            ac_cv_c_tclconfig=`(cd ${with_tclconfig}; ${PWDCMD-pwd})`
95460484Sobrien        else
95560484Sobrien            AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
95660484Sobrien        fi
95760484Sobrien    fi
95860484Sobrien
95960484Sobrien    dnl next check if it came with Tcl configuration file in the source tree
96060484Sobrien    if test x"${ac_cv_c_tclconfig}" = x ; then
96160484Sobrien        for i in $dirlist; do
962104834Sobrien            dnl need to test both unix and win directories, since 
963104834Sobrien            dnl cygwin's tkConfig.sh could be in either directory depending
964104834Sobrien            dnl on the cygwin port of tcl.
96560484Sobrien            if test -f $srcdir/$i/unix/tclConfig.sh ; then
966104834Sobrien                ac_cv_c_tclconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
96760484Sobrien	        break
96860484Sobrien            fi
969104834Sobrien            if test -f $srcdir/$i/win/tclConfig.sh ; then
970104834Sobrien                ac_cv_c_tclconfig=`(cd $srcdir/$i/win; ${PWDCMD-pwd})`
971104834Sobrien	        break
972104834Sobrien            fi
97360484Sobrien        done
97460484Sobrien    fi
97560484Sobrien    dnl check in a few other locations
97660484Sobrien    if test x"${ac_cv_c_tclconfig}" = x ; then
97760484Sobrien        dnl find the top level Tcl source directory
97860484Sobrien        for i in $dirlist; do
97960484Sobrien            if test -n "`ls -dr $i/tcl* 2>/dev/null`" ; then
98060484Sobrien	        tclconfpath=$i
98160484Sobrien	        break
98260484Sobrien	    fi
98360484Sobrien        done
98460484Sobrien
98560484Sobrien        dnl find the exact Tcl dir. We do it this way, cause there
98660484Sobrien        dnl might be multiple version of Tcl, and we want the most recent one.
98760484Sobrien        for i in `ls -dr $tclconfpath/tcl* 2>/dev/null ` ; do
988104834Sobrien            dnl need to test both unix and win directories, since 
989104834Sobrien            dnl cygwin's tclConfig.sh could be in either directory depending
990104834Sobrien            dnl on the cygwin port of tcl.
99160484Sobrien            if test -f $i/unix/tclConfig.sh ; then
992104834Sobrien                ac_cv_c_tclconfig=`(cd $i/unix; ${PWDCMD-pwd})`
99360484Sobrien                break
99460484Sobrien            fi
995104834Sobrien            if test -f $i/win/tclConfig.sh ; then
996104834Sobrien                ac_cv_c_tclconfig=`(cd $i/win; ${PWDCMD-pwd})`
997104834Sobrien                break
998104834Sobrien            fi
99960484Sobrien        done
100060484Sobrien    fi
100160484Sobrien
100260484Sobrien    dnl Check to see if it's installed. We have to look in the $CC path
100360484Sobrien    dnl to find it, cause our $prefix may not match the compilers.
100460484Sobrien    if test x"${ac_cv_c_tclconfig}" = x ; then
100560484Sobrien        dnl Get the path to the compiler
100660484Sobrien	ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/lib
100760484Sobrien        if test -f $ccpath/tclConfig.sh; then
100860484Sobrien	    ac_cv_c_tclconfig=$ccpath
100960484Sobrien        fi
101060484Sobrien    fi
101160484Sobrien    ])	dnl end of cache_val
101260484Sobrien
101360484Sobrien    if test x"${ac_cv_c_tclconfig}" = x ; then
101460484Sobrien        TCLCONFIG=""
101560484Sobrien        AC_MSG_WARN(Can't find Tcl configuration definitions)
101660484Sobrien    else
101760484Sobrien        no_tcl=""
101860484Sobrien        TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
101960484Sobrien        AC_MSG_RESULT(${TCLCONFIG})
102060484Sobrien     fi
102160484Sobrienfi
102260484SobrienAC_SUBST(TCLCONFIG)
102360484Sobrien])
102460484Sobrien
102560484Sobriendnl Defined as a separate macro so we don't have to cache the values
102660484Sobriendnl from PATH_TCLCONFIG (because this can also be cached).
1027218822SdimAC_DEFUN([CYG_AC_LOAD_TCLCONFIG], [
102860484Sobrien    . $TCLCONFIG
102960484Sobrien
103060484Sobriendnl AC_SUBST(TCL_VERSION)
103160484Sobriendnl AC_SUBST(TCL_MAJOR_VERSION)
103260484Sobriendnl AC_SUBST(TCL_MINOR_VERSION)
103360484Sobriendnl AC_SUBST(TCL_CC)
103460484Sobrien    AC_SUBST(TCL_DEFS)
103560484Sobrien
103660484Sobriendnl not used, don't export to save symbols
103760484Sobrien    AC_SUBST(TCL_LIB_FILE)
103860484Sobrien    AC_SUBST(TCL_LIB_FULL_PATH)
103960484Sobrien    AC_SUBST(TCL_LIBS)
104060484Sobriendnl not used, don't export to save symbols
104160484Sobriendnl    AC_SUBST(TCL_PREFIX)
104260484Sobrien
104360484Sobrien    AC_SUBST(TCL_CFLAGS)
104460484Sobrien
104560484Sobriendnl not used, don't export to save symbols
104660484Sobriendnl    AC_SUBST(TCL_EXEC_PREFIX)
104760484Sobrien
104860484Sobrien    AC_SUBST(TCL_SHLIB_CFLAGS)
104960484Sobrien    AC_SUBST(TCL_SHLIB_LD)
105060484Sobriendnl don't export, not used outside of configure
105160484Sobriendnl AC_SUBST(TCL_SHLIB_LD_LIBS)
105260484Sobriendnl AC_SUBST(TCL_SHLIB_SUFFIX)
105360484Sobriendnl not used, don't export to save symbols
105460484Sobriendnl AC_SUBST(TCL_DL_LIBS)
105560484Sobrien    AC_SUBST(TCL_LD_FLAGS)
105660484Sobrien    AC_SUBST(TCL_LD_SEARCH_FLAGS)
105760484Sobriendnl don't export, not used outside of configure
105860484Sobriendnl AC_SUBST(TCL_COMPAT_OBJS)
105960484Sobrien    AC_SUBST(TCL_RANLIB)
106060484Sobrien    AC_SUBST(TCL_BUILD_LIB_SPEC)
106160484Sobrien    AC_SUBST(TCL_LIB_SPEC)
106277298Sobrien    AC_SUBST(TCL_BIN_DIR)
106360484Sobriendnl AC_SUBST(TCL_LIB_VERSIONS_OK)
106460484Sobrien
106560484Sobriendnl not used, don't export to save symbols
106660484Sobriendnl    AC_SUBST(TCL_SHARED_LIB_SUFFIX)
106760484Sobrien
106860484Sobriendnl not used, don't export to save symbols
106960484Sobriendnl    AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
107060484Sobrien])
107160484Sobrien
107260484Sobriendnl ====================================================================
1073218822SdimAC_DEFUN([CYG_AC_PATH_TK], [
107460484Sobrien    CYG_AC_PATH_TKH
107560484Sobrien    CYG_AC_PATH_TKCONFIG
107660484Sobrien    CYG_AC_LOAD_TKCONFIG
107760484Sobrien])
1078218822SdimAC_DEFUN([CYG_AC_PATH_TKH], [
107960484Sobrien#
108060484Sobrien# Ok, lets find the tk source trees so we can use the headers
108160484Sobrien# If the directory (presumably symlink) named "tk" exists, use that one
108260484Sobrien# in preference to any others.  Same logic is used when choosing library
108360484Sobrien# and again with Tcl. The search order is the best place to look first, then in
108460484Sobrien# decreasing significance. The loop breaks if the trigger file is found.
108560484Sobrien# Note the gross little conversion here of srcdir by cd'ing to the found
108660484Sobrien# directory. This converts the path from a relative to an absolute, so
108760484Sobrien# recursive cache variables for the path will work right. We check all
1088104834Sobrien# the possible paths in one loop rather than many separate loops to speed
108960484Sobrien# things up.
109060484Sobrien# the alternative search directory is involked by --with-tkinclude
109160484Sobrien#
109260484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
109360484Sobrienno_tk=true
109460484SobrienAC_MSG_CHECKING(for Tk headers in the source tree)
109560484SobrienAC_ARG_WITH(tkinclude, [  --with-tkinclude       directory where tk headers are], with_tkinclude=${withval})
109660484SobrienAC_CACHE_VAL(ac_cv_c_tkh,[
109760484Sobriendnl first check to see if --with-tkinclude was specified
109860484Sobrienif test x"${with_tkinclude}" != x ; then
109960484Sobrien  if test -f ${with_tkinclude}/tk.h ; then
1100104834Sobrien    ac_cv_c_tkh=`(cd ${with_tkinclude}; ${PWDCMD-pwd})`
110160484Sobrien  elif test -f ${with_tkinclude}/generic/tk.h ; then
1102104834Sobrien    ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; ${PWDCMD-pwd})`
110360484Sobrien  else
110460484Sobrien    AC_MSG_ERROR([${with_tkinclude} directory doesn't contain headers])
110560484Sobrien  fi
110660484Sobrienfi
110760484Sobrien
110860484Sobriendnl next check if it came with Tk configuration file
110960484Sobrienif test x"${ac_cv_c_tkconfig}" != x ; then
111060484Sobrien  for i in $dirlist; do
111160484Sobrien    if test -f $ac_cv_c_tkconfig/$i/generic/tk.h ; then
1112104834Sobrien      ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/$i/generic; ${PWDCMD-pwd})`
111360484Sobrien      break
111460484Sobrien    fi
111560484Sobrien  done
111660484Sobrienfi
111760484Sobrien
111860484Sobriendnl next check in private source directory
111960484Sobriendnl since ls returns lowest version numbers first, reverse its output
112060484Sobrienif test x"${ac_cv_c_tkh}" = x ; then
112160484Sobrien    dnl find the top level Tk source directory
112260484Sobrien    for i in $dirlist; do
112360484Sobrien        if test -n "`ls -dr $srcdir/$i/tk* 2>/dev/null`" ; then
112460484Sobrien	    tkpath=$srcdir/$i
112560484Sobrien	    break
112660484Sobrien	fi
112760484Sobrien    done
112860484Sobrien
112960484Sobrien    dnl find the exact Tk source dir. We do it this way, cause there
113060484Sobrien    dnl might be multiple version of Tk, and we want the most recent one.
113160484Sobrien    for i in `ls -dr $tkpath/tk* 2>/dev/null ` ; do
113260484Sobrien        if test -f $i/generic/tk.h ; then
1133104834Sobrien          ac_cv_c_tkh=`(cd $i/generic; ${PWDCMD-pwd})`
113460484Sobrien          break
113560484Sobrien        fi
113660484Sobrien    done
113760484Sobrienfi
113860484Sobrien
113960484Sobriendnl see if one is installed
114060484Sobrienif test x"${ac_cv_c_tkh}" = x ; then
114160484Sobrien    AC_MSG_RESULT(none)
114260484Sobrien    dnl Get the path to the compiler. We do it this way instead of using
114360484Sobrien    dnl AC_CHECK_HEADER, cause this doesn't depend in having X configured.
114460484Sobrien    ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/include
114560484Sobrien    if test -f $ccpath/tk.h; then
114660484Sobrien	ac_cv_c_tkh=$ccpath
114760484Sobrien    fi
114860484Sobrienelse
114960484Sobrien   AC_MSG_RESULT(${ac_cv_c_tkh})
115060484Sobrienfi
115160484Sobrien])
115260484Sobrien  TKHDIR=""
115360484Sobrienif test x"${ac_cv_c_tkh}" = x ; then
115460484Sobrien    AC_MSG_ERROR([Can't find any Tk headers])
115560484Sobrienfi
115660484Sobrienif test x"${ac_cv_c_tkh}" != x ; then
115760484Sobrien    no_tk=""
115860484Sobrien    if test x"${ac_cv_c_tkh}" != x"installed" ; then
115960484Sobrien	if test x"${CC}" = xcl ; then
116060484Sobrien	    tmp="`cygpath --windows ${ac_cv_c_tkh}`"
116160484Sobrien	    ac_cv_c_tkh="`echo $tmp | sed -e s#\\\\\\\\#/#g`"
116260484Sobrien	fi
116360484Sobrien        AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
116460484Sobrien        TKHDIR="-I${ac_cv_c_tkh}"
116560484Sobrien    fi
116660484Sobrienfi
116760484Sobrien
116860484SobrienAC_SUBST(TKHDIR)
116960484Sobrien])
117060484Sobrien
1171218822SdimAC_DEFUN([CYG_AC_PATH_TKCONFIG], [
117260484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
117360484Sobriendnl First, look for one uninstalled.  
117460484Sobriendnl the alternative search directory is invoked by --with-tkconfig
117560484Sobrienif test x"${no_tk}" = x ; then
117660484Sobrien  dnl we reset no_tk in case something fails here
117760484Sobrien    no_tk=true
117860484Sobrien    AC_ARG_WITH(tkconfig, [  --with-tkconfig           directory containing tk configuration (tkConfig.sh)],
117960484Sobrien         with_tkconfig=${withval})
118060484Sobrien    AC_MSG_CHECKING([for Tk configuration script])
118160484Sobrien    AC_CACHE_VAL(ac_cv_c_tkconfig,[
118260484Sobrien
118360484Sobrien    dnl First check to see if --with-tkconfig was specified.
118460484Sobrien    if test x"${with_tkconfig}" != x ; then
118560484Sobrien        if test -f "${with_tkconfig}/tkConfig.sh" ; then
1186104834Sobrien            ac_cv_c_tkconfig=`(cd ${with_tkconfig}; ${PWDCMD-pwd})`
118760484Sobrien        else
118860484Sobrien            AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
118960484Sobrien        fi
119060484Sobrien    fi
119160484Sobrien
119260484Sobrien    dnl next check if it came with Tk configuration file in the source tree
119360484Sobrien    if test x"${ac_cv_c_tkconfig}" = x ; then
119460484Sobrien        for i in $dirlist; do
1195104834Sobrien            dnl need to test both unix and win directories, since 
1196104834Sobrien            dnl cygwin's tkConfig.sh could be in either directory depending
1197104834Sobrien            dnl on the cygwin port of tk.
119860484Sobrien            if test -f $srcdir/$i/unix/tkConfig.sh ; then
1199104834Sobrien                ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
120060484Sobrien	        break
120160484Sobrien            fi
1202104834Sobrien            if test -f $srcdir/$i/win/tkConfig.sh ; then
1203104834Sobrien                ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; ${PWDCMD-pwd})`
1204104834Sobrien	        break
1205104834Sobrien            fi
120660484Sobrien        done
120760484Sobrien    fi
120860484Sobrien    dnl check in a few other locations
120960484Sobrien    if test x"${ac_cv_c_tkconfig}" = x ; then
121060484Sobrien        dnl find the top level Tk source directory
121160484Sobrien        for i in $dirlist; do
121260484Sobrien            if test -n "`ls -dr $i/tk* 2>/dev/null`" ; then
121360484Sobrien	        tkconfpath=$i
121460484Sobrien	        break
121560484Sobrien	    fi
121660484Sobrien        done
121760484Sobrien
121860484Sobrien        dnl find the exact Tk dir. We do it this way, cause there
121960484Sobrien        dnl might be multiple version of Tk, and we want the most recent one.
122060484Sobrien        for i in `ls -dr $tkconfpath/tk* 2>/dev/null ` ; do
1221104834Sobrien            dnl need to test both unix and win directories, since 
1222104834Sobrien            dnl cygwin's tkConfig.sh could be in either directory depending
1223104834Sobrien            dnl on the cygwin port of tk.
122460484Sobrien            if test -f $i/unix/tkConfig.sh ; then
1225104834Sobrien                ac_cv_c_tkconfig=`(cd $i/unix; ${PWDCMD-pwd})`
122660484Sobrien                break
122760484Sobrien            fi
1228104834Sobrien            if test -f $i/win/tkConfig.sh ; then
1229104834Sobrien                ac_cv_c_tkconfig=`(cd $i/win; ${PWDCMD-pwd})`
1230104834Sobrien                break
1231104834Sobrien            fi
123260484Sobrien        done
123360484Sobrien    fi
123460484Sobrien
123560484Sobrien    dnl Check to see if it's installed. We have to look in the $CC path
123660484Sobrien    dnl to find it, cause our $prefix may not match the compilers.
123760484Sobrien    if test x"${ac_cv_c_tkconfig}" = x ; then
123860484Sobrien        dnl Get the path to the compiler
123960484Sobrien	ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/lib
124060484Sobrien        if test -f $ccpath/tkConfig.sh; then
124160484Sobrien	    ac_cv_c_tkconfig=$ccpath
124260484Sobrien        fi
124360484Sobrien    fi
124460484Sobrien    ])	dnl end of cache_val
124560484Sobrien
124660484Sobrien    if test x"${ac_cv_c_tkconfig}" = x ; then
124760484Sobrien        TKCONFIG=""
124860484Sobrien        AC_MSG_WARN(Can't find Tk configuration definitions)
124960484Sobrien    else
125060484Sobrien        no_tk=""
125160484Sobrien        TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
125260484Sobrien        AC_MSG_RESULT(${TKCONFIG})
125360484Sobrien     fi
125460484Sobrienfi
125560484SobrienAC_SUBST(TKCONFIG)
125660484Sobrien])
125760484Sobrien
125860484Sobriendnl Defined as a separate macro so we don't have to cache the values
125960484Sobriendnl from PATH_TKCONFIG (because this can also be cached).
1260218822SdimAC_DEFUN([CYG_AC_LOAD_TKCONFIG], [
126160484Sobrien    if test -f "$TKCONFIG" ; then
126260484Sobrien      . $TKCONFIG
126360484Sobrien    fi
126460484Sobrien
126560484Sobrien    AC_SUBST(TK_VERSION)
126660484Sobriendnl not actually used, don't export to save symbols
126760484Sobriendnl    AC_SUBST(TK_MAJOR_VERSION)
126860484Sobriendnl    AC_SUBST(TK_MINOR_VERSION)
126960484Sobrien    AC_SUBST(TK_DEFS)
127060484Sobrien
127160484Sobriendnl not used, don't export to save symbols
127260484Sobrien    AC_SUBST(TK_LIB_FILE)
127360484Sobrien    AC_SUBST(TK_LIB_FULL_PATH)
127460484Sobrien    AC_SUBST(TK_LIBS)
127560484Sobriendnl not used, don't export to save symbols
127660484Sobriendnl    AC_SUBST(TK_PREFIX)
127760484Sobrien
127860484Sobriendnl not used, don't export to save symbols
127960484Sobriendnl    AC_SUBST(TK_EXEC_PREFIX)
128060484Sobrien    AC_SUBST(TK_BUILD_INCLUDES)
128160484Sobrien    AC_SUBST(TK_XINCLUDES)
128260484Sobrien    AC_SUBST(TK_XLIBSW)
128360484Sobrien    AC_SUBST(TK_BUILD_LIB_SPEC)
128460484Sobrien    AC_SUBST(TK_LIB_SPEC)
128560484Sobrien])
128660484Sobrien
128760484Sobriendnl ====================================================================
128860484Sobriendnl Ok, lets find the itcl source trees so we can use the headers
128960484Sobriendnl the alternative search directory is involked by --with-itclinclude
1290218822SdimAC_DEFUN([CYG_AC_PATH_ITCL], [
129160484Sobrien    CYG_AC_PATH_ITCLH
129260484Sobrien    CYG_AC_PATH_ITCLLIB
129360484Sobrien    CYG_AC_PATH_ITCLSH
129460484Sobrien    CYG_AC_PATH_ITCLMKIDX
129560484Sobrien])
1296218822SdimAC_DEFUN([CYG_AC_PATH_ITCLH], [
129760484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
129860484Sobrienno_itcl=true
129960484SobrienAC_MSG_CHECKING(for Itcl headers in the source tree)
130060484SobrienAC_ARG_WITH(itclinclude, [  --with-itclinclude       directory where itcl headers are], with_itclinclude=${withval})
130160484SobrienAC_CACHE_VAL(ac_cv_c_itclh,[
130260484Sobriendnl first check to see if --with-itclinclude was specified
130360484Sobrienif test x"${with_itclinclude}" != x ; then
130460484Sobrien  if test -f ${with_itclinclude}/itcl.h ; then
1305104834Sobrien    ac_cv_c_itclh=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
130660484Sobrien  elif test -f ${with_itclinclude}/src/itcl.h ; then
1307104834Sobrien    ac_cv_c_itclh=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
130860484Sobrien  else
130960484Sobrien    AC_MSG_ERROR([${with_itclinclude} directory doesn't contain headers])
131060484Sobrien  fi
131160484Sobrienfi
131260484Sobrien
131360484Sobriendnl next check if it came with Itcl configuration file
131460484Sobrienif test x"${ac_cv_c_itclconfig}" != x ; then
131560484Sobrien  for i in $dirlist; do
131660484Sobrien    if test -f $ac_cv_c_itclconfig/$i/src/itcl.h ; then
1317104834Sobrien      ac_cv_c_itclh=`(cd $ac_cv_c_itclconfig/$i/src; ${PWDCMD-pwd})`
131860484Sobrien      break
131960484Sobrien    fi
132060484Sobrien  done
132160484Sobrienfi
132260484Sobrien
132360484Sobriendnl next check in private source directory
132460484Sobriendnl since ls returns lowest version numbers first, reverse its output
132560484Sobrienif test x"${ac_cv_c_itclh}" = x ; then
132660484Sobrien    dnl find the top level Itcl source directory
132760484Sobrien    for i in $dirlist; do
132860484Sobrien        if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
132960484Sobrien	    itclpath=$srcdir/$i
133060484Sobrien	    break
133160484Sobrien	fi
133260484Sobrien    done
133360484Sobrien
133460484Sobrien    dnl find the exact Itcl source dir. We do it this way, cause there
133560484Sobrien    dnl might be multiple version of Itcl, and we want the most recent one.
133660484Sobrien    for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
133760484Sobrien        if test -f $i/src/itcl.h ; then
1338104834Sobrien          ac_cv_c_itclh=`(cd $i/src; ${PWDCMD-pwd})`
133960484Sobrien          break
134060484Sobrien        fi
134160484Sobrien    done
134260484Sobrienfi
134360484Sobrien
134460484Sobriendnl see if one is installed
134560484Sobrienif test x"${ac_cv_c_itclh}" = x ; then
134660484Sobrien   AC_MSG_RESULT(none)
134760484Sobrien   AC_CHECK_HEADER(itcl.h, ac_cv_c_itclh=installed, ac_cv_c_itclh="")
134860484Sobrienelse
134960484Sobrien   AC_MSG_RESULT(${ac_cv_c_itclh})
135060484Sobrienfi
135160484Sobrien])
135260484Sobrien  ITCLHDIR=""
135360484Sobrienif test x"${ac_cv_c_itclh}" = x ; then
135460484Sobrien    AC_MSG_ERROR([Can't find any Itcl headers])
135560484Sobrienfi
135660484Sobrienif test x"${ac_cv_c_itclh}" != x ; then
135760484Sobrien    no_itcl=""
135860484Sobrien    if test x"${ac_cv_c_itclh}" != x"installed" ; then
135960484Sobrien        AC_MSG_RESULT(${ac_cv_c_itclh})
136060484Sobrien        ITCLHDIR="-I${ac_cv_c_itclh}"
136160484Sobrien    fi
136260484Sobrienfi
136360484Sobrien
136460484SobrienAC_SUBST(ITCLHDIR)
136560484Sobrien])
136660484Sobrien
136760484Sobriendnl Ok, lets find the itcl library
136860484Sobriendnl First, look for one uninstalled.  
136960484Sobriendnl the alternative search directory is invoked by --with-itcllib
1370218822SdimAC_DEFUN([CYG_AC_PATH_ITCLLIB], [
137160484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
137260484Sobrienif test x"${no_itcl}" = x ; then
137360484Sobrien    dnl we reset no_itcl incase something fails here
137460484Sobrien    no_itcl=true
137560484Sobrien    AC_ARG_WITH(itcllib,
137660484Sobrien	[  --with-itcllib           directory where the itcl library is],
137760484Sobrien        with_itcllib=${withval})
137860484Sobrien    AC_MSG_CHECKING([for Itcl library])
137960484Sobrien    AC_CACHE_VAL(ac_cv_c_itcllib,[
138060484Sobrien    dnl First check to see if --with-itcllib was specified.
138160484Sobrien    if test x"${with_itcllib}" != x ; then
138260484Sobrien        if test -f "${with_itcllib}/libitcl$TCL_SHARED_LIB_SUFFIX" ; then
1383104834Sobrien            ac_cv_c_itcllib=`(cd ${with_itcllib}; ${PWDCMD-pwd})`/libitcl$TCL_SHARED_LIB_SUFFIX
138460484Sobrien	else
138560484Sobrien	    if test -f "${with_itcllib}/libitcl$TCL_UNSHARED_LIB_SUFFIX"; then
1386104834Sobrien	 	ac_cv_c_itcllib=`(cd ${with_itcllib}; ${PWDCMD-pwd})`/libitcl$TCL_UNSHARED_LIB_SUFFIX
138760484Sobrien	    fi
138860484Sobrien	fi
138960484Sobrien    fi
139060484Sobrien    dnl then check for a  Itcl library. Since these are uninstalled,
139160484Sobrien    dnl use the simple lib name root. 
139260484Sobrien    if test x"${ac_cv_c_itcllib}" = x ; then
139360484Sobrien        dnl find the top level Itcl build directory
139460484Sobrien        for i in $dirlist; do
139560484Sobrien            if test -n "`ls -dr $i/itcl* 2>/dev/null`" ; then
139660484Sobrien	        itclpath=$i/itcl
139760484Sobrien	        break
139860484Sobrien	    fi
139960484Sobrien        done
140060484Sobrien        dnl Itcl 7.5 and greater puts library in subdir.  Look there first.
140160484Sobrien        if test -f "$itclpath/src/libitcl.$TCL_SHLIB_SUFFIX" ; then
1402104834Sobrien	     ac_cv_c_itcllib=`(cd $itclpath/src; ${PWDCMD-pwd})`
140360484Sobrien        elif test -f "$itclpath/src/libitcl.a"; then
1404104834Sobrien	     ac_cv_c_itcllib=`(cd $itclpath/src; ${PWDCMD-pwd})`
140560484Sobrien	fi
140660484Sobrien    fi
140760484Sobrien    dnl check in a few other private locations
140860484Sobrien    if test x"${ac_cv_c_itcllib}" = x ; then
140960484Sobrien        for i in ${dirlist}; do
141060484Sobrien            if test -n "`ls -dr ${srcdir}/$i/itcl* 2>/dev/null`" ; then
141160484Sobrien	        itclpath=${srcdir}/$i
141260484Sobrien	        break
141360484Sobrien	    fi
141460484Sobrien        done
141560484Sobrien        for i in `ls -dr ${itclpath}/itcl* 2>/dev/null` ; do
141660484Sobrien            dnl Itcl 7.5 and greater puts library in subdir.  Look there first.
141760484Sobrien            if test -f "$i/src/libitcl$TCL_SHLIB_SUFFIX" ; then
1418104834Sobrien	        ac_cv_c_itcllib=`(cd $i/src; ${PWDCMD-pwd})`
141960484Sobrien	        break
142060484Sobrien            elif test -f "$i/src/libitcl.a"; then
1421104834Sobrien	        ac_cv_c_itcllib=`(cd $i/src; ${PWDCMD-pwd})`
142260484Sobrien	        break
142360484Sobrien	    fi	
142460484Sobrien        done
142560484Sobrien    fi
142660484Sobrien
142760484Sobrien    dnl see if one is conveniently installed with the compiler
142860484Sobrien    if test x"${ac_cv_c_itcllib}" = x ; then
142960484Sobrien        dnl Get the path to the compiler
143060484Sobrien	ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/lib
143160484Sobrien        dnl Itcl 7.5 and greater puts library in subdir.  Look there first.
143260484Sobrien        if test -f "${ccpath}/libitcl$TCL_SHLIB_SUFFIX" ; then
1433104834Sobrien	    ac_cv_c_itcllib=`(cd ${ccpath}; ${PWDCMD-pwd})`
143460484Sobrien        elif test -f "${ccpath}/libitcl.a"; then
1435104834Sobrien	    ac_cv_c_itcllib=`(cd ${ccpath}; ${PWDCMD-pwd})`
143660484Sobrien        fi
143760484Sobrien    fi
143860484Sobrien    ])
143960484Sobrien    if test x"${ac_cv_c_itcllib}" = x ; then
144060484Sobrien        ITCLLIB=""
144160484Sobrien        AC_MSG_WARN(Can't find Itcl library)
144260484Sobrien    else
144360484Sobrien        ITCLLIB="-L${ac_cv_c_itcllib}"
144460484Sobrien        AC_MSG_RESULT(${ac_cv_c_itcllib})
144560484Sobrien        no_itcl=""
144660484Sobrien    fi
144760484Sobrienfi
144860484Sobrien
144960484SobrienAC_PROVIDE([$0])
145060484SobrienAC_SUBST(ITCLLIB)
145160484Sobrien])
145260484Sobrien
145360484Sobrien
145460484Sobriendnl ====================================================================
145560484Sobriendnl Ok, lets find the itcl source trees so we can use the itcl_sh script
145660484Sobriendnl the alternative search directory is involked by --with-itclinclude
1457218822SdimAC_DEFUN([CYG_AC_PATH_ITCLSH], [
145860484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
145960484Sobrienno_itcl=true
146060484SobrienAC_MSG_CHECKING(for the itcl_sh script)
146160484SobrienAC_ARG_WITH(itclinclude, [  --with-itclinclude       directory where itcl headers are], with_itclinclude=${withval})
146260484SobrienAC_CACHE_VAL(ac_cv_c_itclsh,[
146360484Sobriendnl first check to see if --with-itclinclude was specified
146460484Sobrienif test x"${with_itclinclude}" != x ; then
146560484Sobrien  if test -f ${with_itclinclude}/itcl_sh ; then
1466104834Sobrien    ac_cv_c_itclsh=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
146760484Sobrien  elif test -f ${with_itclinclude}/src/itcl_sh ; then
1468104834Sobrien    ac_cv_c_itclsh=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
146960484Sobrien  else
147060484Sobrien    AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
147160484Sobrien  fi
147260484Sobrienfi
147360484Sobrien
147460484Sobriendnl next check in private source directory
147560484Sobriendnl since ls returns lowest version numbers first, reverse its output
147660484Sobrienif test x"${ac_cv_c_itclsh}" = x ; then
147760484Sobrien    dnl find the top level Itcl source directory
147860484Sobrien    for i in $dirlist; do
147960484Sobrien        if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
148060484Sobrien	    itclpath=$srcdir/$i
148160484Sobrien	    break
148260484Sobrien	fi
148360484Sobrien    done
148460484Sobrien
148560484Sobrien    dnl find the exact Itcl source dir. We do it this way, cause there
148660484Sobrien    dnl might be multiple version of Itcl, and we want the most recent one.
148760484Sobrien    for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
148860484Sobrien        if test -f $i/src/itcl_sh ; then
1489104834Sobrien          ac_cv_c_itclsh=`(cd $i/src; ${PWDCMD-pwd})`/itcl_sh
149060484Sobrien          break
149160484Sobrien        fi
149260484Sobrien    done
149360484Sobrienfi
149460484Sobrien
149560484Sobriendnl see if one is installed
149660484Sobrienif test x"${ac_cv_c_itclsh}" = x ; then
149760484Sobrien   AC_MSG_RESULT(none)
149860484Sobrien   AC_PATH_PROG(ac_cv_c_itclsh, itcl_sh)
149960484Sobrienelse
150060484Sobrien   AC_MSG_RESULT(${ac_cv_c_itclsh})
150160484Sobrienfi
150260484Sobrien])
150360484Sobrien
150460484Sobrienif test x"${ac_cv_c_itclsh}" = x ; then
150560484Sobrien    AC_MSG_ERROR([Can't find the itcl_sh script])
150660484Sobrienfi
150760484Sobrienif test x"${ac_cv_c_itclsh}" != x ; then
150860484Sobrien    no_itcl=""
150960484Sobrien    AC_MSG_RESULT(${ac_cv_c_itclsh})
151060484Sobrien    ITCLSH="${ac_cv_c_itclsh}"
151160484Sobrienfi
151260484SobrienAC_SUBST(ITCLSH)
151360484Sobrien])
151460484Sobrien
151560484Sobrien
151660484Sobriendnl ====================================================================
151760484Sobriendnl Ok, lets find the itcl source trees so we can use the itcl_sh script
151860484Sobriendnl the alternative search directory is involked by --with-itclinclude
1519218822SdimAC_DEFUN([CYG_AC_PATH_ITCLMKIDX], [
152060484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
152160484Sobrienno_itcl=true
152260484SobrienAC_MSG_CHECKING(for itcl_mkindex.tcl script)
152360484SobrienAC_ARG_WITH(itclinclude, [  --with-itclinclude       directory where itcl headers are], with_itclinclude=${withval})
152460484SobrienAC_CACHE_VAL(ac_cv_c_itclmkidx,[
152560484Sobriendnl first check to see if --with-itclinclude was specified
152660484Sobrienif test x"${with_itclinclude}" != x ; then
152760484Sobrien  if test -f ${with_itclinclude}/itcl_sh ; then
1528104834Sobrien    ac_cv_c_itclmkidx=`(cd ${with_itclinclude}; ${PWDCMD-pwd})`
152960484Sobrien  elif test -f ${with_itclinclude}/src/itcl_sh ; then
1530104834Sobrien    ac_cv_c_itclmkidx=`(cd ${with_itclinclude}/src; ${PWDCMD-pwd})`
153160484Sobrien  else
153260484Sobrien    AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
153360484Sobrien  fi
153460484Sobrienfi
153560484Sobrien
153660484Sobriendnl next check in private source directory
153760484Sobriendnl since ls returns lowest version numbers first, reverse its output
153860484Sobrienif test x"${ac_cv_c_itclmkidx}" = x ; then
153960484Sobrien    dnl find the top level Itcl source directory
154060484Sobrien    for i in $dirlist; do
154160484Sobrien        if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
154260484Sobrien	    itclpath=$srcdir/$i
154360484Sobrien	    break
154460484Sobrien	fi
154560484Sobrien    done
154660484Sobrien
154760484Sobrien    dnl find the exact Itcl source dir. We do it this way, cause there
154860484Sobrien    dnl might be multiple version of Itcl, and we want the most recent one.
154960484Sobrien    for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
155060484Sobrien        if test -f $i/library/itcl_mkindex.tcl ; then
1551104834Sobrien          ac_cv_c_itclmkidx=`(cd $i/library; ${PWDCMD-pwd})`/itcl_mkindex.tcl
155260484Sobrien          break
155360484Sobrien        fi
155460484Sobrien    done
155560484Sobrienfi
155660484Sobrienif test x"${ac_cv_c_itclmkidx}" = x ; then
155760484Sobrien    dnl Get the path to the compiler
155860484Sobrien    ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/share
155960484Sobrien    dnl Itcl 7.5 and greater puts library in subdir.  Look there first.
156060484Sobrien    for i in `ls -dr $ccpath/itcl* 2>/dev/null ` ; do
156160484Sobrien        if test -f $i/itcl_mkindex.tcl ; then
1562104834Sobrien            ac_cv_c_itclmkidx=`(cd $i; ${PWDCMD-pwd})`/itcl_mkindex.tcl
156360484Sobrien            break
156460484Sobrien        fi
156560484Sobrien    done
156660484Sobrienfi
156760484Sobrien])
156860484Sobrien
156960484Sobrienif test x"${ac_cv_c_itclmkidx}" = x ; then
157060484Sobrien    AC_MSG_ERROR([Can't find the itcl_mkindex.tcl script])
157160484Sobrienfi
157260484Sobrienif test x"${ac_cv_c_itclmkidx}" != x ; then
157360484Sobrien    no_itcl=""
157460484Sobrien    AC_MSG_RESULT(${ac_cv_c_itclmkidx})
157560484Sobrien    ITCLMKIDX="${ac_cv_c_itclmkidx}"
157660484Sobrienelse
157760484Sobrien   AC_MSG_RESULT(none)
157860484Sobrienfi
157960484SobrienAC_SUBST(ITCLMKIDX)
158060484Sobrien])
158160484Sobrien
158260484Sobriendnl ====================================================================
158360484Sobriendnl Ok, lets find the tix source trees so we can use the headers
158460484Sobriendnl the alternative search directory is involked by --with-tixinclude
1585218822SdimAC_DEFUN([CYG_AC_PATH_TIX], [
158660484Sobrien    CYG_AC_PATH_TIXH
158760484Sobrien    CYG_AC_PATH_TIXLIB
158860484Sobrien])
1589218822SdimAC_DEFUN([CYG_AC_PATH_TIXH], [
159060484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
159160484Sobrienno_tix=true
159260484SobrienAC_MSG_CHECKING(for Tix headers in the source tree)
159360484SobrienAC_ARG_WITH(tixinclude, [  --with-tixinclude       directory where tix headers are], with_tixinclude=${withval})
159460484SobrienAC_CACHE_VAL(ac_cv_c_tixh,[
159560484Sobriendnl first check to see if --with-tixinclude was specified
159660484Sobrienif test x"${with_tixinclude}" != x ; then
159760484Sobrien  if test -f ${with_tixinclude}/tix.h ; then
1598104834Sobrien    ac_cv_c_tixh=`(cd ${with_tixinclude}; ${PWDCMD-pwd})`
159960484Sobrien  elif test -f ${with_tixinclude}/generic/tix.h ; then
1600104834Sobrien    ac_cv_c_tixh=`(cd ${with_tixinclude}/generic; ${PWDCMD-pwd})`
160160484Sobrien  else
160260484Sobrien    AC_MSG_ERROR([${with_tixinclude} directory doesn't contain headers])
160360484Sobrien  fi
160460484Sobrienfi
160560484Sobrien
160660484Sobriendnl next check if it came with Tix configuration file
160760484Sobrienif test x"${ac_cv_c_tixconfig}" != x ; then
160860484Sobrien  for i in $dirlist; do
160960484Sobrien    if test -f $ac_cv_c_tixconfig/$i/generic/tix.h ; then
1610104834Sobrien      ac_cv_c_tixh=`(cd $ac_cv_c_tixconfig/$i/generic; ${PWDCMD-pwd})`
161160484Sobrien      break
161260484Sobrien    fi
161360484Sobrien  done
161460484Sobrienfi
161560484Sobrien
161660484Sobriendnl next check in private source directory
161760484Sobriendnl since ls returns lowest version numbers first, reverse its output
161860484Sobrienif test x"${ac_cv_c_tixh}" = x ; then
161960484Sobrien    dnl find the top level Tix source directory
162060484Sobrien    for i in $dirlist; do
162160484Sobrien        if test -n "`ls -dr $srcdir/$i/tix* 2>/dev/null`" ; then
162260484Sobrien	    tixpath=$srcdir/$i
162360484Sobrien	    break
162460484Sobrien	fi
162560484Sobrien    done
162660484Sobrien
162760484Sobrien    dnl find the exact Tix source dir. We do it this way, cause there
162860484Sobrien    dnl might be multiple version of Tix, and we want the most recent one.
162960484Sobrien    for i in `ls -dr $tixpath/tix* 2>/dev/null ` ; do
163060484Sobrien        if test -f $i/generic/tix.h ; then
1631104834Sobrien          ac_cv_c_tixh=`(cd $i/generic; ${PWDCMD-pwd})`
163260484Sobrien          break
163360484Sobrien        fi
163460484Sobrien    done
163560484Sobrienfi
163660484Sobrien
163760484Sobriendnl see if one is installed
163860484Sobrienif test x"${ac_cv_c_tixh}" = x ; then
163960484Sobrien    AC_MSG_RESULT(none)
164060484Sobrien    dnl Get the path to the compiler
164160484Sobrien
164260484Sobrien   dnl Get the path to the compiler. We do it this way instead of using
164360484Sobrien    dnl AC_CHECK_HEADER, cause this doesn't depend in having X configured.
164460484Sobrien    ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/include
164560484Sobrien    if test -f $ccpath/tix.h; then
164660484Sobrien	ac_cv_c_tixh=installed
164760484Sobrien    fi
164860484Sobrienelse
164960484Sobrien   AC_MSG_RESULT(${ac_cv_c_tixh})
165060484Sobrienfi
165160484Sobrien])
165260484Sobrienif test x"${ac_cv_c_tixh}" = x ; then
165360484Sobrien    AC_MSG_ERROR([Can't find any Tix headers])
165460484Sobrienfi
165560484Sobrienif test x"${ac_cv_c_tixh}" != x ; then
165660484Sobrien    no_tix=""
165760484Sobrien    AC_MSG_RESULT(${ac_cv_c_tixh})
165860484Sobrien    if test x"${ac_cv_c_tixh}" != x"installed" ; then
165960484Sobrien        TIXHDIR="-I${ac_cv_c_tixh}"
166060484Sobrien    fi
166160484Sobrienfi
166260484Sobrien
166360484SobrienAC_SUBST(TIXHDIR)
166460484Sobrien])
166560484Sobrien
1666218822SdimAC_DEFUN([CYG_AC_PATH_TIXCONFIG], [
166760484Sobrien#
166860484Sobrien# Ok, lets find the tix configuration
166960484Sobrien# First, look for one uninstalled.  
167060484Sobrien# the alternative search directory is invoked by --with-tixconfig
167160484Sobrien#
167260484Sobrien
167360484Sobrienif test x"${no_tix}" = x ; then
167460484Sobrien  # we reset no_tix in case something fails here
167560484Sobrien  no_tix=true
167660484Sobrien  AC_ARG_WITH(tixconfig, [  --with-tixconfig           directory containing tix configuration (tixConfig.sh)],
167760484Sobrien         with_tixconfig=${withval})
167860484Sobrien  AC_MSG_CHECKING([for Tix configuration])
167960484Sobrien  AC_CACHE_VAL(ac_cv_c_tixconfig,[
168060484Sobrien
168160484Sobrien  # First check to see if --with-tixconfig was specified.
168260484Sobrien  if test x"${with_tixconfig}" != x ; then
168360484Sobrien    if test -f "${with_tixconfig}/tixConfig.sh" ; then
1684104834Sobrien      ac_cv_c_tixconfig=`(cd ${with_tixconfig}; ${PWDCMD-pwd})`
168560484Sobrien    else
168660484Sobrien      AC_MSG_ERROR([${with_tixconfig} directory doesn't contain tixConfig.sh])
168760484Sobrien    fi
168860484Sobrien  fi
168960484Sobrien
169060484Sobrien  # then check for a private Tix library
169160484Sobrien  if test x"${ac_cv_c_tixconfig}" = x ; then
169260484Sobrien    for i in \
169360484Sobrien		../tix \
169460484Sobrien		`ls -dr ../tix[[4]]* 2>/dev/null` \
169560484Sobrien		../../tix \
169660484Sobrien		`ls -dr ../../tix[[4]]* 2>/dev/null` \
169760484Sobrien		../../../tix \
169860484Sobrien		`ls -dr ../../../tix[[4]]* 2>/dev/null` ; do
169960484Sobrien      if test -f "$i/tixConfig.sh" ; then
1700104834Sobrien        ac_cv_c_tixconfig=`(cd $i; ${PWDCMD-pwd})`
170160484Sobrien	break
170260484Sobrien      fi
170360484Sobrien    done
170460484Sobrien  fi
170560484Sobrien  # check in a few common install locations
170660484Sobrien  if test x"${ac_cv_c_tixconfig}" = x ; then
170760484Sobrien    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
170860484Sobrien      if test -f "$i/tixConfig.sh" ; then
1709104834Sobrien        ac_cv_c_tkconfig=`(cd $i; ${PWDCMD-pwd})`
171060484Sobrien	break
171160484Sobrien      fi
171260484Sobrien    done
171360484Sobrien  fi
171460484Sobrien  # check in a few other private locations
171560484Sobrien  if test x"${ac_cv_c_tixconfig}" = x ; then
171660484Sobrien    for i in \
171760484Sobrien		${srcdir}/../tix \
171860484Sobrien		`ls -dr ${srcdir}/../tix[[4-9]]* 2>/dev/null` ; do
171960484Sobrien      if test -f "$i/tixConfig.sh" ; then
1720104834Sobrien        ac_cv_c_tixconfig=`(cd $i; ${PWDCMD-pwd})`
172160484Sobrien	break
172260484Sobrien      fi
172360484Sobrien    done
172460484Sobrien  fi
172560484Sobrien  ])
172660484Sobrien  if test x"${ac_cv_c_tixconfig}" = x ; then
172760484Sobrien    TIXCONFIG="# no Tix configs found"
172860484Sobrien    AC_MSG_WARN(Can't find Tix configuration definitions)
172960484Sobrien  else
173060484Sobrien    no_tix=
173160484Sobrien    TIXCONFIG=${ac_cv_c_tixconfig}/tixConfig.sh
173260484Sobrien    AC_MSG_RESULT(found $TIXCONFIG)
173360484Sobrien  fi
173460484Sobrienfi
173560484Sobrien
173660484Sobrien])
173760484Sobrien
173860484Sobrien# Defined as a separate macro so we don't have to cache the values
173960484Sobrien# from PATH_TIXCONFIG (because this can also be cached).
1740218822SdimAC_DEFUN([CYG_AC_LOAD_TIXCONFIG], [
174160484Sobrien    if test -f "$TIXCONFIG" ; then
174260484Sobrien      . $TIXCONFIG
174360484Sobrien    fi
174460484Sobrien
174560484Sobrien    AC_SUBST(TIX_BUILD_LIB_SPEC)
174660484Sobrien    AC_SUBST(TIX_LIB_FULL_PATH)
174760484Sobrien])
174860484Sobrien
1749218822SdimAC_DEFUN([CYG_AC_PATH_ITCLCONFIG], [
175060484Sobrien#
175160484Sobrien# Ok, lets find the itcl configuration
175260484Sobrien# First, look for one uninstalled.  
175360484Sobrien# the alternative search directory is invoked by --with-itclconfig
175460484Sobrien#
175560484Sobrien
175660484Sobrienif test x"${no_itcl}" = x ; then
175760484Sobrien  # we reset no_itcl in case something fails here
175860484Sobrien  no_itcl=true
175960484Sobrien  AC_ARG_WITH(itclconfig, [  --with-itclconfig           directory containing itcl configuration (itclConfig.sh)],
176060484Sobrien         with_itclconfig=${withval})
176160484Sobrien  AC_MSG_CHECKING([for Itcl configuration])
176260484Sobrien  AC_CACHE_VAL(ac_cv_c_itclconfig,[
176360484Sobrien
176460484Sobrien  # First check to see if --with-itclconfig was specified.
176560484Sobrien  if test x"${with_itclconfig}" != x ; then
176660484Sobrien    if test -f "${with_itclconfig}/itclConfig.sh" ; then
1767104834Sobrien      ac_cv_c_itclconfig=`(cd ${with_itclconfig}; ${PWDCMD-pwd})`
176860484Sobrien    else
176960484Sobrien      AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
177060484Sobrien    fi
177160484Sobrien  fi
177260484Sobrien
177360484Sobrien  # then check for a private itcl library
177460484Sobrien  if test x"${ac_cv_c_itclconfig}" = x ; then
177560484Sobrien    for i in \
177660484Sobrien		../itcl/itcl \
177760484Sobrien		`ls -dr ../itcl/itcl[[3]]* 2>/dev/null` \
177860484Sobrien		../../itcl/itcl \
177960484Sobrien		`ls -dr ../../itcl/itcl[[3]]* 2>/dev/null` \
178060484Sobrien		../../../itcl/itcl \
178160484Sobrien		`ls -dr ../../../itcl/itcl[[3]]* 2>/dev/null` ; do
178260484Sobrien      if test -f "$i/itclConfig.sh" ; then
1783104834Sobrien        ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
178460484Sobrien	break
178560484Sobrien      fi
178660484Sobrien    done
178760484Sobrien  fi
178860484Sobrien  # check in a few common install locations
178960484Sobrien  if test x"${ac_cv_c_itclconfig}" = x ; then
179060484Sobrien    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
179160484Sobrien      if test -f "$i/itclConfig.sh" ; then
1792104834Sobrien        ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
179360484Sobrien	break
179460484Sobrien      fi
179560484Sobrien    done
179660484Sobrien  fi
179760484Sobrien  # check in a few other private locations
179860484Sobrien  if test x"${ac_cv_c_itclconfig}" = x ; then
179960484Sobrien    for i in \
180060484Sobrien		${srcdir}/../itcl/itcl \
180160484Sobrien		`ls -dr ${srcdir}/../itcl/itcl[[3]]* 2>/dev/null` ; do
180260484Sobrien      if test -f "$i/itcl/itclConfig.sh" ; then
1803104834Sobrien        ac_cv_c_itclconfig=`(cd $i; ${PWDCMD-pwd})`
180460484Sobrien	break
180560484Sobrien      fi
180660484Sobrien    done
180760484Sobrien  fi
180860484Sobrien  ])
180960484Sobrien  if test x"${ac_cv_c_itclconfig}" = x ; then
181060484Sobrien    ITCLCONFIG="# no itcl configs found"
181160484Sobrien    AC_MSG_WARN(Can't find itcl configuration definitions)
181260484Sobrien  else
181360484Sobrien    no_itcl=
181460484Sobrien    ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
181560484Sobrien    AC_MSG_RESULT(found $ITCLCONFIG)
181660484Sobrien  fi
181760484Sobrienfi
181860484Sobrien
181960484Sobrien])
182060484Sobrien
182160484Sobrien# Defined as a separate macro so we don't have to cache the values
182260484Sobrien# from PATH_ITCLCONFIG (because this can also be cached).
1823218822SdimAC_DEFUN([CYG_AC_LOAD_ITCLCONFIG], [
182460484Sobrien    if test -f "$ITCLCONFIG" ; then
182560484Sobrien      . $ITCLCONFIG
182660484Sobrien    fi
182760484Sobrien
182860484Sobrien    AC_SUBST(ITCL_BUILD_LIB_SPEC)
182960484Sobrien    AC_SUBST(ITCL_SH)
183060484Sobrien    AC_SUBST(ITCL_LIB_FILE)
183160484Sobrien    AC_SUBST(ITCL_LIB_FULL_PATH)
183260484Sobrien
183360484Sobrien])
183460484Sobrien
183560484Sobrien
1836218822SdimAC_DEFUN([CYG_AC_PATH_ITKCONFIG], [
183760484Sobrien#
183860484Sobrien# Ok, lets find the itk configuration
183960484Sobrien# First, look for one uninstalled.  
184060484Sobrien# the alternative search directory is invoked by --with-itkconfig
184160484Sobrien#
184260484Sobrien
184360484Sobrienif test x"${no_itk}" = x ; then
184460484Sobrien  # we reset no_itk in case something fails here
184560484Sobrien  no_itk=true
184660484Sobrien  AC_ARG_WITH(itkconfig, [  --with-itkconfig           directory containing itk configuration (itkConfig.sh)],
184760484Sobrien         with_itkconfig=${withval})
184860484Sobrien  AC_MSG_CHECKING([for Itk configuration])
184960484Sobrien  AC_CACHE_VAL(ac_cv_c_itkconfig,[
185060484Sobrien
185160484Sobrien  # First check to see if --with-itkconfig was specified.
185260484Sobrien  if test x"${with_itkconfig}" != x ; then
185360484Sobrien    if test -f "${with_itkconfig}/itkConfig.sh" ; then
1854104834Sobrien      ac_cv_c_itkconfig=`(cd ${with_itkconfig}; ${PWDCMD-pwd})`
185560484Sobrien    else
185660484Sobrien      AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
185760484Sobrien    fi
185860484Sobrien  fi
185960484Sobrien
186060484Sobrien  # then check for a private itk library
186160484Sobrien  if test x"${ac_cv_c_itkconfig}" = x ; then
186260484Sobrien    for i in \
186360484Sobrien		../itcl/itk \
186460484Sobrien		`ls -dr ../itcl/itk[[3]]* 2>/dev/null` \
186560484Sobrien		../../itcl/itk \
186660484Sobrien		`ls -dr ../../itcl/itk[[3]]* 2>/dev/null` \
186760484Sobrien		../../../itcl/itk \
186860484Sobrien		`ls -dr ../../../itcl/itk[[3]]* 2>/dev/null` ; do
186960484Sobrien      if test -f "$i/itkConfig.sh" ; then
1870104834Sobrien        ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
187160484Sobrien	break
187260484Sobrien      fi
187360484Sobrien    done
187460484Sobrien  fi
187560484Sobrien  # check in a few common install locations
187660484Sobrien  if test x"${ac_cv_c_itkconfig}" = x ; then
187760484Sobrien    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
187860484Sobrien      if test -f "$i/itcl/itkConfig.sh" ; then
1879104834Sobrien        ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
188060484Sobrien	break
188160484Sobrien      fi
188260484Sobrien    done
188360484Sobrien  fi
188460484Sobrien  # check in a few other private locations
188560484Sobrien  if test x"${ac_cv_c_itkconfig}" = x ; then
188660484Sobrien    for i in \
188760484Sobrien		${srcdir}/../itcl/itk \
188860484Sobrien		`ls -dr ${srcdir}/../itcl/itk[[3]]* 2>/dev/null` ; do
188960484Sobrien      if test -f "$i/itkConfig.sh" ; then
1890104834Sobrien        ac_cv_c_itkconfig=`(cd $i; ${PWDCMD-pwd})`
189160484Sobrien	break
189260484Sobrien      fi
189360484Sobrien    done
189460484Sobrien  fi
189560484Sobrien  ])
189660484Sobrien  if test x"${ac_cv_c_itkconfig}" = x ; then
189760484Sobrien    ITCLCONFIG="# no itk configs found"
189860484Sobrien    AC_MSG_WARN(Can't find itk configuration definitions)
189960484Sobrien  else
190060484Sobrien    no_itk=
190160484Sobrien    ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
190260484Sobrien    AC_MSG_RESULT(found $ITKCONFIG)
190360484Sobrien  fi
190460484Sobrienfi
190560484Sobrien
190660484Sobrien])
190760484Sobrien
190860484Sobrien# Defined as a separate macro so we don't have to cache the values
190960484Sobrien# from PATH_ITKCONFIG (because this can also be cached).
1910218822SdimAC_DEFUN([CYG_AC_LOAD_ITKCONFIG], [
191160484Sobrien    if test -f "$ITKCONFIG" ; then
191260484Sobrien      . $ITKCONFIG
191360484Sobrien    fi
191460484Sobrien
191560484Sobrien    AC_SUBST(ITK_BUILD_LIB_SPEC)
191660484Sobrien    AC_SUBST(ITK_LIB_FILE)
191760484Sobrien    AC_SUBST(ITK_LIB_FULL_PATH)
191860484Sobrien])
191960484Sobrien
192060484Sobrien
192160484Sobriendnl ====================================================================
192260484Sobriendnl Ok, lets find the libgui source trees so we can use the headers
192360484Sobriendnl the alternative search directory is involked by --with-libguiinclude
1924218822SdimAC_DEFUN([CYG_AC_PATH_LIBGUI], [
192560484Sobrien    CYG_AC_PATH_LIBGUIH
192660484Sobrien    CYG_AC_PATH_LIBGUILIB
192760484Sobrien])
1928218822SdimAC_DEFUN([CYG_AC_PATH_LIBGUIH], [
192960484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../..../../../../../../../../../../.."
193060484Sobrienno_libgui=true
193160484SobrienAC_MSG_CHECKING(for Libgui headers in the source tree)
193260484SobrienAC_ARG_WITH(libguiinclude, [  --with-libguiinclude       directory where libgui headers are], with_libguiinclude=${withval})
193360484SobrienAC_CACHE_VAL(ac_cv_c_libguih,[
193460484Sobriendnl first check to see if --with-libguiinclude was specified
193560484Sobrienif test x"${with_libguiinclude}" != x ; then
193660484Sobrien  if test -f ${with_libguiinclude}/guitcl.h ; then
1937104834Sobrien    ac_cv_c_libguih=`(cd ${with_libguiinclude}; ${PWDCMD-pwd})`
193860484Sobrien  elif test -f ${with_libguiinclude}/src/guitcl.h ; then
1939104834Sobrien    ac_cv_c_libguih=`(cd ${with_libguiinclude}/src; ${PWDCMD-pwd})`
194060484Sobrien  else
194160484Sobrien    AC_MSG_ERROR([${with_libguiinclude} directory doesn't contain headers])
194260484Sobrien  fi
194360484Sobrienfi
194460484Sobrien
194560484Sobriendnl next check if it came with Libgui configuration file
194660484Sobrienif test x"${ac_cv_c_libguiconfig}" != x ; then
194760484Sobrien  for i in $dirlist; do
194860484Sobrien    if test -f $ac_cv_c_libguiconfig/$i/src/guitcl.h ; then
1949104834Sobrien      ac_cv_c_libguih=`(cd $ac_cv_c_libguiconfig/$i/src; ${PWDCMD-pwd})`
195060484Sobrien      break
195160484Sobrien    fi
195260484Sobrien  done
195360484Sobrienfi
195460484Sobrien
195560484Sobriendnl next check in private source directory
195660484Sobriendnl since ls returns lowest version numbers first, reverse its output
195760484Sobrienif test x"${ac_cv_c_libguih}" = x ; then
195860484Sobrien    dnl find the top level Libgui source directory
195960484Sobrien    for i in $dirlist; do
196060484Sobrien        if test -n "`ls -dr $srcdir/$i/libgui* 2>/dev/null`" ; then
196160484Sobrien	    libguipath=$srcdir/$i
196260484Sobrien	    break
196360484Sobrien	fi
196460484Sobrien    done
196560484Sobrien
196660484Sobrien    dnl find the exact Libgui source dir. We do it this way, cause there
196760484Sobrien    dnl might be multiple version of Libgui, and we want the most recent one.
196860484Sobrien    for i in `ls -dr $libguipath/libgui* 2>/dev/null ` ; do
196960484Sobrien        if test -f $i/src/guitcl.h ; then
1970104834Sobrien          ac_cv_c_libguih=`(cd $i/src; ${PWDCMD-pwd})`
197160484Sobrien          break
197260484Sobrien        fi
197360484Sobrien    done
197460484Sobrienfi
197560484Sobrien
197660484Sobriendnl see if one is installed
197760484Sobrienif test x"${ac_cv_c_libguih}" = x ; then
197860484Sobrien   AC_MSG_RESULT(none)
197960484Sobrien   AC_CHECK_HEADER(guitcl.h, ac_cv_c_libguih=installed, ac_cv_c_libguih="")
198060484Sobrienfi
198160484Sobrien])
198260484SobrienLIBGUIHDIR=""
198360484Sobrienif test x"${ac_cv_c_libguih}" = x ; then
198460484Sobrien    AC_MSG_WARN([Can't find any Libgui headers])
198560484Sobrienfi
198660484Sobrienif test x"${ac_cv_c_libguih}" != x ; then
198760484Sobrien    no_libgui=""
198860484Sobrien    if test x"${ac_cv_c_libguih}" != x"installed" ; then
198960484Sobrien        LIBGUIHDIR="-I${ac_cv_c_libguih}"
199060484Sobrien    fi
199160484Sobrienfi
199260484SobrienAC_MSG_RESULT(${ac_cv_c_libguih})
199360484SobrienAC_SUBST(LIBGUIHDIR)
199460484Sobrien])
199560484Sobrien
199660484Sobriendnl ====================================================================
199760484Sobriendnl find the GUI library
1998218822SdimAC_DEFUN([CYG_AC_PATH_LIBGUILIB], [
199960484SobrienAC_MSG_CHECKING(for GUI library  in the build tree)
200060484Sobriendirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
200160484Sobriendnl look for the library
200260484SobrienAC_MSG_CHECKING(for GUI library)
200360484SobrienAC_CACHE_VAL(ac_cv_c_libguilib,[
200460484Sobrienif test x"${ac_cv_c_libguilib}" = x ; then
200560484Sobrien    for i in $dirlist; do
200660484Sobrien      if test -f "$i/libgui/src/Makefile" ; then
2007104834Sobrien        ac_cv_c_libguilib=`(cd $i/libgui/src; ${PWDCMD-pwd})`
200860484Sobrien        break
200960484Sobrien      fi
201060484Sobrien    done
201160484Sobrienfi
201260484Sobrien]) 
201360484Sobrienif test x"${ac_cv_c_libguilib}" != x ; then
201460484Sobrien     GUILIB="${GUILIB} -L${ac_cv_c_libguilib}"
201560484Sobrien     LIBGUILIB="-lgui"
201660484Sobrien     AC_MSG_RESULT(${ac_cv_c_libguilib})
201760484Sobrienelse
201860484Sobrien     AC_MSG_RESULT(none)
201960484Sobrienfi
202060484Sobrien
202160484SobrienAC_SUBST(GUILIB)
202260484SobrienAC_SUBST(LIBGUILIB)
202360484Sobrien])
2024