xref: /netbsd-src/external/gpl3/gcc.old/dist/config/acinclude.m4 (revision 1debfc3d3fad8af6f31804271c18e67f77b4d718)
1*1debfc3dSmrgdnl This file is included into all any other acinclude file that needs
2*1debfc3dSmrgdnl to use these macros.
3*1debfc3dSmrg
4*1debfc3dSmrgdnl This is copied from autoconf 2.12, but does calls our own AC_PROG_CC_WORKS,
5*1debfc3dSmrgdnl and doesn't call AC_PROG_CXX_GNU, cause we test for that in  AC_PROG_CC_WORKS.
6*1debfc3dSmrgdnl We are probably using a cross compiler, which will not be able to fully
7*1debfc3dSmrgdnl link an executable.  This should really be fixed in autoconf itself.
8*1debfc3dSmrgdnl Find a working G++ cross compiler. This only works for the GNU C++ compiler.
9*1debfc3dSmrgAC_DEFUN([CYG_AC_PROG_CXX_CROSS],
10*1debfc3dSmrg[AC_BEFORE([$0], [AC_PROG_CXXCPP])
11*1debfc3dSmrgAC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
12*1debfc3dSmrg
13*1debfc3dSmrgCYG_AC_PROG_GXX_WORKS
14*1debfc3dSmrg
15*1debfc3dSmrgif test $ac_cv_prog_gxx = yes; then
16*1debfc3dSmrg  GXX=yes
17*1debfc3dSmrgdnl Check whether -g works, even if CXXFLAGS is set, in case the package
18*1debfc3dSmrgdnl plays around with CXXFLAGS (such as to build both debugging and
19*1debfc3dSmrgdnl normal versions of a library), tasteless as that idea is.
20*1debfc3dSmrg  ac_test_CXXFLAGS="${CXXFLAGS+set}"
21*1debfc3dSmrg  ac_save_CXXFLAGS="$CXXFLAGS"
22*1debfc3dSmrg  CXXFLAGS=
23*1debfc3dSmrg  AC_PROG_CXX_G
24*1debfc3dSmrg  if test "$ac_test_CXXFLAGS" = set; then
25*1debfc3dSmrg    CXXFLAGS="$ac_save_CXXFLAGS"
26*1debfc3dSmrg  elif test $ac_cv_prog_cxx_g = yes; then
27*1debfc3dSmrg    CXXFLAGS="-g -O2"
28*1debfc3dSmrg  else
29*1debfc3dSmrg    CXXFLAGS="-O2"
30*1debfc3dSmrg  fi
31*1debfc3dSmrgelse
32*1debfc3dSmrg  GXX=
33*1debfc3dSmrg  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
34*1debfc3dSmrgfi
35*1debfc3dSmrg])
36*1debfc3dSmrg
37*1debfc3dSmrgdnl See if the G++ compiler we found works.
38*1debfc3dSmrgAC_DEFUN([CYG_AC_PROG_GXX_WORKS],
39*1debfc3dSmrg[AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually works])
40*1debfc3dSmrgAC_LANG_SAVE
41*1debfc3dSmrgAC_LANG_CPLUSPLUS
42*1debfc3dSmrgdnl Try a test case. We only compile, because it's close to impossible
43*1debfc3dSmrgdnl to get a correct fully linked executable with a cross compiler. For
44*1debfc3dSmrgdnl most cross compilers, this test is bogus. For G++, we can use various
45*1debfc3dSmrgdnl other compile line options to get a decent idea that the cross compiler
46*1debfc3dSmrgdnl actually does work, even though we can't produce an executable without
47*1debfc3dSmrgdnl more info about the target it's being compiled for. This only works
48*1debfc3dSmrgdnl for the GNU C++ compiler.
49*1debfc3dSmrg
50*1debfc3dSmrgdnl Transform the name of the compiler to it's cross variant, unless
51*1debfc3dSmrgdnl CXX is set. This is also what CXX gets set to in the generated
52*1debfc3dSmrgdnl Makefile.
53*1debfc3dSmrgif test x"${CXX}" = xc++ ; then
54*1debfc3dSmrg    CXX=`echo gcc | sed -e "${program_transform_name}"`
55*1debfc3dSmrgfi
56*1debfc3dSmrg
57*1debfc3dSmrgdnl Get G++'s full path to libgcc.a
58*1debfc3dSmrglibgccpath=`${CXX} --print-libgcc`
59*1debfc3dSmrg
60*1debfc3dSmrgdnl If we don't have a path with libgcc.a on the end, this isn't G++.
61*1debfc3dSmrgif test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
62*1debfc3dSmrg   ac_cv_prog_gxx=yes
63*1debfc3dSmrgelse
64*1debfc3dSmrg   ac_cv_prog_gxx=no
65*1debfc3dSmrgfi
66*1debfc3dSmrg
67*1debfc3dSmrgdnl If we are using G++, look for the files that need to exist if this
68*1debfc3dSmrgdnl compiler works.
69*1debfc3dSmrgif test x"${ac_cv_prog_gxx}" = xyes ; then
70*1debfc3dSmrg    gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
71*1debfc3dSmrg    if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
72*1debfc3dSmrg	gccfiles=yes
73*1debfc3dSmrg    else
74*1debfc3dSmrg	gccfiles=no
75*1debfc3dSmrg    fi
76*1debfc3dSmrg    gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
77*1debfc3dSmrg    if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
78*1debfc3dSmrg	gcclibs=yes
79*1debfc3dSmrg    else
80*1debfc3dSmrg	gcclibs=no
81*1debfc3dSmrg    fi
82*1debfc3dSmrgfi
83*1debfc3dSmrg
84*1debfc3dSmrgdnl If everything is OK, then we can safely assume the compiler works.
85*1debfc3dSmrgif test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
86*1debfc3dSmrg    ac_cv_prog_cxx_works=no
87*1debfc3dSmrg    AC_MSG_ERROR(${CXX} is a non-working cross compiler)
88*1debfc3dSmrgelse
89*1debfc3dSmrg   ac_cv_prog_cxx_works=yes
90*1debfc3dSmrgfi
91*1debfc3dSmrg
92*1debfc3dSmrgAC_LANG_RESTORE
93*1debfc3dSmrgAC_MSG_RESULT($ac_cv_prog_cxx_works)
94*1debfc3dSmrgif test x"$ac_cv_prog_cxx_works" = xno; then
95*1debfc3dSmrg  AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
96*1debfc3dSmrgfi
97*1debfc3dSmrgAC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
98*1debfc3dSmrgAC_MSG_RESULT($ac_cv_prog_cxx_cross)
99*1debfc3dSmrgcross_compiling=$ac_cv_prog_cxx_cross
100*1debfc3dSmrgAC_SUBST(CXX)
101*1debfc3dSmrg])
102*1debfc3dSmrg
103*1debfc3dSmrgdnl ====================================================================
104*1debfc3dSmrgdnl Find a working GCC cross compiler. This only works for the GNU gcc compiler.
105*1debfc3dSmrgdnl This is based on the macros above for G++.
106*1debfc3dSmrgAC_DEFUN([CYG_AC_PROG_CC_CROSS],
107*1debfc3dSmrg[AC_BEFORE([$0], [AC_PROG_CCPP])
108*1debfc3dSmrgAC_CHECK_PROGS(CC, cc, gcc)
109*1debfc3dSmrg
110*1debfc3dSmrgCYG_AC_PROG_GCC_WORKS
111*1debfc3dSmrg
112*1debfc3dSmrgif test $ac_cv_prog_gcc = yes; then
113*1debfc3dSmrg  GCC=yes
114*1debfc3dSmrgdnl Check whether -g works, even if CFLAGS is set, in case the package
115*1debfc3dSmrgdnl plays around with CFLAGS (such as to build both debugging and
116*1debfc3dSmrgdnl normal versions of a library), tasteless as that idea is.
117*1debfc3dSmrg  ac_test_CFLAGS="${CFLAGS+set}"
118*1debfc3dSmrg  ac_save_CFLAGS="$CFLAGS"
119*1debfc3dSmrg  CFLAGS=
120*1debfc3dSmrg  AC_PROG_CC_G
121*1debfc3dSmrg  if test "$ac_test_CFLAGS" = set; then
122*1debfc3dSmrg    CFLAGS="$ac_save_CFLAGS"
123*1debfc3dSmrg  elif test $ac_cv_prog_cc_g = yes; then
124*1debfc3dSmrg    CFLAGS="-g -O2"
125*1debfc3dSmrg  else
126*1debfc3dSmrg    CFLAGS="-O2"
127*1debfc3dSmrg  fi
128*1debfc3dSmrgelse
129*1debfc3dSmrg  GXX=
130*1debfc3dSmrg  test "${CFLAGS+set}" = set || CFLAGS="-g"
131*1debfc3dSmrgfi
132*1debfc3dSmrg])
133*1debfc3dSmrg
134*1debfc3dSmrgdnl See if the GCC compiler we found works.
135*1debfc3dSmrgAC_DEFUN([CYG_AC_PROG_GCC_WORKS],
136*1debfc3dSmrg[AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) actually works])
137*1debfc3dSmrgAC_LANG_SAVE
138*1debfc3dSmrgAC_LANG_C
139*1debfc3dSmrgdnl Try a test case. We only compile, because it's close to impossible
140*1debfc3dSmrgdnl to get a correct fully linked executable with a cross
141*1debfc3dSmrgdnl compiler. For most cross compilers, this test is bogus. For G++,
142*1debfc3dSmrgdnl we can use various other compile line options to get a decent idea
143*1debfc3dSmrgdnl that the cross compiler actually does work, even though we can't
144*1debfc3dSmrgdnl produce an executable without more info about the target it's
145*1debfc3dSmrgdnl being compiled for. This only works for the GNU C++ compiler.
146*1debfc3dSmrg
147*1debfc3dSmrgdnl Transform the name of the compiler to it's cross variant, unless
148*1debfc3dSmrgdnl CXX is set. This is also what CC gets set to in the generated Makefile.
149*1debfc3dSmrgif test x"${CC}" = xcc ; then
150*1debfc3dSmrg    CC=`echo gcc | sed -e "${program_transform_name}"`
151*1debfc3dSmrgfi
152*1debfc3dSmrg
153*1debfc3dSmrgdnl Get Gcc's full path to libgcc.a
154*1debfc3dSmrglibgccpath=`${CC} --print-libgcc`
155*1debfc3dSmrg
156*1debfc3dSmrgdnl If we don't have a path with libgcc.a on the end, this isn't G++.
157*1debfc3dSmrgif test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
158*1debfc3dSmrg   ac_cv_prog_gcc=yes
159*1debfc3dSmrgelse
160*1debfc3dSmrg   ac_cv_prog_gcc=no
161*1debfc3dSmrgfi
162*1debfc3dSmrg
163*1debfc3dSmrgdnl If we are using Gcc, look for the files that need to exist if this
164*1debfc3dSmrgdnl compiler works.
165*1debfc3dSmrgif test x"${ac_cv_prog_gcc}" = xyes ; then
166*1debfc3dSmrg    gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
167*1debfc3dSmrg    if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
168*1debfc3dSmrg	gccfiles=yes
169*1debfc3dSmrg    else
170*1debfc3dSmrg	gccfiles=no
171*1debfc3dSmrg    fi
172*1debfc3dSmrg    gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
173*1debfc3dSmrg    if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
174*1debfc3dSmrg	gcclibs=yes
175*1debfc3dSmrg    else
176*1debfc3dSmrg	gcclibs=no
177*1debfc3dSmrg    fi
178*1debfc3dSmrgfi
179*1debfc3dSmrg
180*1debfc3dSmrgdnl If everything is OK, then we can safely assume the compiler works.
181*1debfc3dSmrgif test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
182*1debfc3dSmrg    ac_cv_prog_cc_works=no
183*1debfc3dSmrg    AC_MSG_ERROR(${CC} is a non-working cross compiler)
184*1debfc3dSmrgelse
185*1debfc3dSmrg    ac_cv_prog_cc_works=yes
186*1debfc3dSmrgfi
187*1debfc3dSmrg
188*1debfc3dSmrgAC_LANG_RESTORE
189*1debfc3dSmrgAC_MSG_RESULT($ac_cv_prog_cc_works)
190*1debfc3dSmrgif test x"$ac_cv_prog_cc_works" = xno; then
191*1debfc3dSmrg  AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
192*1debfc3dSmrgfi
193*1debfc3dSmrgAC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
194*1debfc3dSmrgAC_MSG_RESULT($ac_cv_prog_cc_cross)
195*1debfc3dSmrgcross_compiling=$ac_cv_prog_cc_cross
196*1debfc3dSmrgAC_SUBST(CC)
197*1debfc3dSmrg])
198*1debfc3dSmrg
199*1debfc3dSmrgdnl ====================================================================
200*1debfc3dSmrgdnl Find the BFD library in the build tree. This is used to access and
201*1debfc3dSmrgdnl manipulate object or executable files.
202*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_BFD], [
203*1debfc3dSmrgAC_MSG_CHECKING(for the bfd header in the build tree)
204*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
205*1debfc3dSmrgdnl Look for the header file
206*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_bfdh,[
207*1debfc3dSmrgfor i in $dirlist; do
208*1debfc3dSmrg    if test -f "$i/bfd/bfd.h" ; then
209*1debfc3dSmrg	ac_cv_c_bfdh=`(cd $i/bfd; ${PWDCMD-pwd})`
210*1debfc3dSmrg	break
211*1debfc3dSmrg    fi
212*1debfc3dSmrgdone
213*1debfc3dSmrg])
214*1debfc3dSmrgif test x"${ac_cv_c_bfdh}" != x; then
215*1debfc3dSmrg    BFDHDIR="-I${ac_cv_c_bfdh}"
216*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_bfdh})
217*1debfc3dSmrgelse
218*1debfc3dSmrg    AC_MSG_RESULT(none)
219*1debfc3dSmrgfi
220*1debfc3dSmrgAC_SUBST(BFDHDIR)
221*1debfc3dSmrg
222*1debfc3dSmrgdnl Look for the library
223*1debfc3dSmrgAC_MSG_CHECKING(for the bfd library in the build tree)
224*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_bfdlib,[
225*1debfc3dSmrgfor i in $dirlist; do
226*1debfc3dSmrg    if test -f "$i/bfd/Makefile" ; then
227*1debfc3dSmrg	ac_cv_c_bfdlib=`(cd $i/bfd; ${PWDCMD-pwd})`
228*1debfc3dSmrg    fi
229*1debfc3dSmrgdone
230*1debfc3dSmrg])
231*1debfc3dSmrgdnl We list two directories cause bfd now uses libtool
232*1debfc3dSmrgif test x"${ac_cv_c_bfdlib}" != x; then
233*1debfc3dSmrg    BFDLIB="-L${ac_cv_c_bfdlib} -L${ac_cv_c_bfdlib}/.libs"
234*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_bfdlib})
235*1debfc3dSmrgelse
236*1debfc3dSmrg    AC_MSG_RESULT(none)
237*1debfc3dSmrgfi
238*1debfc3dSmrgAC_SUBST(BFDLIB)
239*1debfc3dSmrg])
240*1debfc3dSmrg
241*1debfc3dSmrgdnl ====================================================================
242*1debfc3dSmrgdnl Find the libiberty library. This defines many commonly used C
243*1debfc3dSmrgdnl functions that exists in various states based on the underlying OS.
244*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_LIBERTY], [
245*1debfc3dSmrgAC_MSG_CHECKING(for the liberty library in the build tree)
246*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
247*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_liberty,[
248*1debfc3dSmrgfor i in $dirlist; do
249*1debfc3dSmrg    if test -f "$i/libiberty/Makefile" ; then
250*1debfc3dSmrg	ac_cv_c_liberty=`(cd $i/libiberty; ${PWDCMD-pwd})`
251*1debfc3dSmrg    fi
252*1debfc3dSmrgdone
253*1debfc3dSmrg])
254*1debfc3dSmrgif test x"${ac_cv_c_liberty}" != x; then
255*1debfc3dSmrg    LIBERTY="-L${ac_cv_c_liberty}"
256*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_liberty})
257*1debfc3dSmrgelse
258*1debfc3dSmrg    AC_MSG_RESULT(none)
259*1debfc3dSmrgfi
260*1debfc3dSmrgAC_SUBST(LIBERTY)
261*1debfc3dSmrg])
262*1debfc3dSmrg
263*1debfc3dSmrgdnl ====================================================================
264*1debfc3dSmrgdnl Find the opcodes library. This is used to do dissasemblies.
265*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_OPCODES], [
266*1debfc3dSmrgAC_MSG_CHECKING(for the opcodes library in the build tree)
267*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
268*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_opc,[
269*1debfc3dSmrgfor i in $dirlist; do
270*1debfc3dSmrg    if test -f "$i/opcodes/Makefile" ; then
271*1debfc3dSmrg	ac_cv_c_opc=`(cd $i/opcodes; ${PWDCMD-pwd})`
272*1debfc3dSmrg    fi
273*1debfc3dSmrgdone
274*1debfc3dSmrg])
275*1debfc3dSmrgif test x"${ac_cv_c_opc}" != x; then
276*1debfc3dSmrg    OPCODESLIB="-L${ac_cv_c_opc}"
277*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_opc})
278*1debfc3dSmrgelse
279*1debfc3dSmrg    AC_MSG_RESULT(none)
280*1debfc3dSmrgfi
281*1debfc3dSmrgAC_SUBST(OPCODESLIB)
282*1debfc3dSmrg])
283*1debfc3dSmrg
284*1debfc3dSmrgdnl ====================================================================
285*1debfc3dSmrgdnl Look for the DejaGnu header file in the source tree. This file
286*1debfc3dSmrgdnl defines the functions used to testing support.
287*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_DEJAGNU], [
288*1debfc3dSmrgAC_MSG_CHECKING(for the testing support files in the source tree)
289*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
290*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_dejagnu,[
291*1debfc3dSmrgfor i in $dirlist; do
292*1debfc3dSmrg    if test -f "$srcdir/$i/ecc/ecc/infra/testlib/current/include/dejagnu.h" ; then
293*1debfc3dSmrg	ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; ${PWDCMD-pwd})`
294*1debfc3dSmrg    fi
295*1debfc3dSmrgdone
296*1debfc3dSmrg])
297*1debfc3dSmrgif test x"${ac_cv_c_dejagnu}" != x; then
298*1debfc3dSmrg    DEJAGNUHDIR="-I${ac_cv_c_dejagnu}"
299*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_dejagnu})
300*1debfc3dSmrgelse
301*1debfc3dSmrg    AC_MSG_RESULT(none)
302*1debfc3dSmrgfi
303*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_dejagnulib,[
304*1debfc3dSmrgfor i in $dirlist; do
305*1debfc3dSmrg    if test -f "$srcdir/$i/infra/testlib/current/lib/hostutil.exp" ; then
306*1debfc3dSmrg	ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; ${PWDCMD-pwd})`
307*1debfc3dSmrg    fi
308*1debfc3dSmrgdone
309*1debfc3dSmrg])
310*1debfc3dSmrgif test x"${ac_cv_c_dejagnulib}" != x; then
311*1debfc3dSmrg    DEJAGNULIB="${ac_cv_c_dejagnulib}"
312*1debfc3dSmrgelse
313*1debfc3dSmrg    DEJAGNULIB=""
314*1debfc3dSmrgfi
315*1debfc3dSmrgAC_MSG_CHECKING(for runtest in the source tree)
316*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_runtest,[
317*1debfc3dSmrgfor i in $dirlist; do
318*1debfc3dSmrg    if test -f "$srcdir/$i/dejagnu/runtest" ; then
319*1debfc3dSmrg	ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; ${PWDCMD-pwd})`
320*1debfc3dSmrg    fi
321*1debfc3dSmrgdone
322*1debfc3dSmrg])
323*1debfc3dSmrgif test x"${ac_cv_c_runtest}" != x; then
324*1debfc3dSmrg    RUNTESTDIR="${ac_cv_c_runtest}"
325*1debfc3dSmrg   AC_MSG_RESULT(${ac_cv_c_runtest})
326*1debfc3dSmrgelse
327*1debfc3dSmrg    RUNTESTDIR=""
328*1debfc3dSmrg    AC_MSG_RESULT(none)
329*1debfc3dSmrgfi
330*1debfc3dSmrgAC_SUBST(RUNTESTDIR)
331*1debfc3dSmrgAC_SUBST(DEJAGNULIB)
332*1debfc3dSmrgAC_SUBST(DEJAGNUHDIR)
333*1debfc3dSmrg])
334*1debfc3dSmrg
335*1debfc3dSmrgdnl ====================================================================
336*1debfc3dSmrgdnl Find the libintl library in the build tree. This is for
337*1debfc3dSmrgdnl  internationalization support.
338*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_INTL], [
339*1debfc3dSmrgAC_MSG_CHECKING(for the intl header in the build tree)
340*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
341*1debfc3dSmrgdnl Look for the header file
342*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_intlh,[
343*1debfc3dSmrgfor i in $dirlist; do
344*1debfc3dSmrg    if test -f "$i/intl/libintl.h" ; then
345*1debfc3dSmrg	ac_cv_c_intlh=`(cd $i/intl; ${PWDCMD-pwd})`
346*1debfc3dSmrg	break
347*1debfc3dSmrg    fi
348*1debfc3dSmrgdone
349*1debfc3dSmrg])
350*1debfc3dSmrgif test x"${ac_cv_c_intlh}" != x; then
351*1debfc3dSmrg    INTLHDIR="-I${ac_cv_c_intlh}"
352*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_intlh})
353*1debfc3dSmrgelse
354*1debfc3dSmrg    AC_MSG_RESULT(none)
355*1debfc3dSmrgfi
356*1debfc3dSmrgAC_SUBST(INTLHDIR)
357*1debfc3dSmrg
358*1debfc3dSmrgdnl Look for the library
359*1debfc3dSmrgAC_MSG_CHECKING(for the libintl library in the build tree)
360*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_intllib,[
361*1debfc3dSmrgfor i in $dirlist; do
362*1debfc3dSmrg    if test -f "$i/intl/Makefile" ; then
363*1debfc3dSmrg	ac_cv_c_intllib=`(cd $i/intl; ${PWDCMD-pwd})`
364*1debfc3dSmrg    fi
365*1debfc3dSmrgdone
366*1debfc3dSmrg])
367*1debfc3dSmrgif test x"${ac_cv_c_intllib}" != x; then
368*1debfc3dSmrg    INTLLIB="-L${ac_cv_c_intllib} -lintl"
369*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_intllib})
370*1debfc3dSmrgelse
371*1debfc3dSmrg    AC_MSG_RESULT(none)
372*1debfc3dSmrgfi
373*1debfc3dSmrgAC_SUBST(INTLLIB)
374*1debfc3dSmrg])
375*1debfc3dSmrg
376*1debfc3dSmrgdnl ====================================================================
377*1debfc3dSmrgdnl Find the simulator library.
378*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_SIM], [
379*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.."
380*1debfc3dSmrgcase "$target_cpu" in
381*1debfc3dSmrg    powerpc)	target_dir=ppc ;;
382*1debfc3dSmrg    sparc*)	target_dir=erc32 ;;
383*1debfc3dSmrg    mips*)	target_dir=mips ;;
384*1debfc3dSmrg    *)		target_dir=$target_cpu ;;
385*1debfc3dSmrgesac
386*1debfc3dSmrgdnl First look for the header file
387*1debfc3dSmrgAC_MSG_CHECKING(for the simulator header file)
388*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_simh,[
389*1debfc3dSmrgfor i in $dirlist; do
390*1debfc3dSmrg    if test -f "${srcdir}/$i/include/remote-sim.h" ; then
391*1debfc3dSmrg	ac_cv_c_simh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
392*1debfc3dSmrg	break
393*1debfc3dSmrg    fi
394*1debfc3dSmrgdone
395*1debfc3dSmrg])
396*1debfc3dSmrgif test x"${ac_cv_c_simh}" != x; then
397*1debfc3dSmrg    SIMHDIR="-I${ac_cv_c_simh}"
398*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_simh})
399*1debfc3dSmrgelse
400*1debfc3dSmrg    AC_MSG_RESULT(none)
401*1debfc3dSmrgfi
402*1debfc3dSmrgAC_SUBST(SIMHDIR)
403*1debfc3dSmrg
404*1debfc3dSmrgdnl See whether it's a devo or Foundry branch simulator
405*1debfc3dSmrgAC_MSG_CHECKING(Whether this is a devo simulator )
406*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_simdevo,[
407*1debfc3dSmrg    CPPFLAGS="$CPPFLAGS $SIMHDIR"
408*1debfc3dSmrg    AC_EGREP_HEADER([SIM_DESC sim_open.*struct _bfd], remote-sim.h,
409*1debfc3dSmrg        ac_cv_c_simdevo=yes,
410*1debfc3dSmrg        ac_cv_c_simdevo=no)
411*1debfc3dSmrg])
412*1debfc3dSmrgif test x"$ac_cv_c_simdevo" = x"yes" ; then
413*1debfc3dSmrg    AC_DEFINE(HAVE_DEVO_SIM)
414*1debfc3dSmrgfi
415*1debfc3dSmrgAC_MSG_RESULT(${ac_cv_c_simdevo})
416*1debfc3dSmrgAC_SUBST(HAVE_DEVO_SIM)
417*1debfc3dSmrg
418*1debfc3dSmrgdnl Next look for the library
419*1debfc3dSmrgAC_MSG_CHECKING(for the simulator library)
420*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_simlib,[
421*1debfc3dSmrgfor i in $dirlist; do
422*1debfc3dSmrg    if test -f "$i/sim/$target_dir/Makefile" ; then
423*1debfc3dSmrg	ac_cv_c_simlib=`(cd $i/sim/$target_dir; ${PWDCMD-pwd})`
424*1debfc3dSmrg    fi
425*1debfc3dSmrgdone
426*1debfc3dSmrg])
427*1debfc3dSmrgif test x"${ac_cv_c_simlib}" != x; then
428*1debfc3dSmrg    SIMLIB="-L${ac_cv_c_simlib}"
429*1debfc3dSmrgelse
430*1debfc3dSmrg    AC_MSG_RESULT(none)
431*1debfc3dSmrg    dnl FIXME: this is kinda bogus, cause umtimately the TM will build
432*1debfc3dSmrg    dnl all the libraries for several architectures. But for now, this
433*1debfc3dSmrg    dnl will work till then.
434*1debfc3dSmrgdnl     AC_MSG_CHECKING(for the simulator installed with the compiler libraries)
435*1debfc3dSmrg    dnl Transform the name of the compiler to it's cross variant, unless
436*1debfc3dSmrg    dnl CXX is set. This is also what CXX gets set to in the generated
437*1debfc3dSmrg    dnl Makefile.
438*1debfc3dSmrg    CROSS_GCC=`echo gcc | sed -e "s/^/$target/"`
439*1debfc3dSmrg
440*1debfc3dSmrg    dnl Get G++'s full path to libgcc.a
441*1debfc3dSmrgchangequote(,)
442*1debfc3dSmrg    gccpath=`${CROSS_GCC} --print-libgcc | sed -e 's:[a-z0-9A-Z\.\-]*/libgcc.a::' -e 's:lib/gcc-lib/::'`lib
443*1debfc3dSmrgchangequote([,])
444*1debfc3dSmrg    if test -f $gccpath/libsim.a -o -f $gccpath/libsim.so ; then
445*1debfc3dSmrg        ac_cv_c_simlib="$gccpath/"
446*1debfc3dSmrg        SIMLIB="-L${ac_cv_c_simlib}"
447*1debfc3dSmrg	AC_MSG_RESULT(${ac_cv_c_simlib})
448*1debfc3dSmrg    else
449*1debfc3dSmrg        AM_CONDITIONAL(PSIM, test x$psim = xno)
450*1debfc3dSmrg	SIMLIB=""
451*1debfc3dSmrg	AC_MSG_RESULT(none)
452*1debfc3dSmrgdnl         ac_cv_c_simlib=none
453*1debfc3dSmrg    fi
454*1debfc3dSmrgfi
455*1debfc3dSmrgAC_SUBST(SIMLIB)
456*1debfc3dSmrg])
457*1debfc3dSmrg
458*1debfc3dSmrgdnl ====================================================================
459*1debfc3dSmrgdnl Find the libiberty library.
460*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_LIBIBERTY], [
461*1debfc3dSmrgAC_MSG_CHECKING(for the libiberty library in the build tree)
462*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
463*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_libib,[
464*1debfc3dSmrgfor i in $dirlist; do
465*1debfc3dSmrg    if test -f "$i/libiberty/Makefile" ; then
466*1debfc3dSmrg	ac_cv_c_libib=`(cd $i/libiberty/; ${PWDCMD-pwd})`
467*1debfc3dSmrg    fi
468*1debfc3dSmrgdone
469*1debfc3dSmrg])
470*1debfc3dSmrgif test x"${ac_cv_c_libib}" != x; then
471*1debfc3dSmrg    LIBIBERTY="-L${ac_cv_c_libib}"
472*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_libib})
473*1debfc3dSmrgelse
474*1debfc3dSmrg    AC_MSG_RESULT(none)
475*1debfc3dSmrgfi
476*1debfc3dSmrgAC_SUBST(LIBIBERTY)
477*1debfc3dSmrg])
478*1debfc3dSmrg
479*1debfc3dSmrgdnl ====================================================================
480*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_DEVO], [
481*1debfc3dSmrgAC_MSG_CHECKING(for devo headers in the source tree)
482*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
483*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_devoh,[
484*1debfc3dSmrgfor i in $dirlist; do
485*1debfc3dSmrg    if test -f "${srcdir}/$i/include/remote-sim.h" ; then
486*1debfc3dSmrg	ac_cv_c_devoh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
487*1debfc3dSmrg    fi
488*1debfc3dSmrgdone
489*1debfc3dSmrg])
490*1debfc3dSmrgif test x"${ac_cv_c_devoh}" != x; then
491*1debfc3dSmrg    DEVOHDIR="-I${ac_cv_c_devoh}"
492*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_devoh})
493*1debfc3dSmrgelse
494*1debfc3dSmrg    AC_MSG_RESULT(none)
495*1debfc3dSmrgfi
496*1debfc3dSmrgAC_SUBST(DEVOHDIR)
497*1debfc3dSmrg])
498*1debfc3dSmrg
499*1debfc3dSmrgdnl ====================================================================
500*1debfc3dSmrgdnl Find all the ILU headers and libraries
501*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_ILU], [
502*1debfc3dSmrgAC_MSG_CHECKING(for ILU kernel headers in the source tree)
503*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
504*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_iluh,[
505*1debfc3dSmrgfor i in $dirlist; do
506*1debfc3dSmrg    if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then
507*1debfc3dSmrg	ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; ${PWDCMD-pwd})`
508*1debfc3dSmrg    fi
509*1debfc3dSmrgdone
510*1debfc3dSmrg])
511*1debfc3dSmrgif test x"${ac_cv_c_iluh}" != x; then
512*1debfc3dSmrg    ILUHDIR="-I${ac_cv_c_iluh}"
513*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_iluh})
514*1debfc3dSmrgelse
515*1debfc3dSmrg    AC_MSG_RESULT(none)
516*1debfc3dSmrgfi
517*1debfc3dSmrg
518*1debfc3dSmrgAC_MSG_CHECKING(for ILU kernel headers in the build tree)
519*1debfc3dSmrgdirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
520*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_iluh5,[
521*1debfc3dSmrgfor i in $dirlist; do
522*1debfc3dSmrg    if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then
523*1debfc3dSmrg	ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; ${PWDCMD-pwd})`
524*1debfc3dSmrg    fi
525*1debfc3dSmrgdone
526*1debfc3dSmrg])
527*1debfc3dSmrgif test x"${ac_cv_c_iluh5}" != x; then
528*1debfc3dSmrg    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh5}"
529*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_iluh5})
530*1debfc3dSmrgelse
531*1debfc3dSmrg    AC_MSG_RESULT(none)
532*1debfc3dSmrgfi
533*1debfc3dSmrg
534*1debfc3dSmrgAC_MSG_CHECKING(for ILU C++ headers in the source tree)
535*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_iluh2,[
536*1debfc3dSmrgfor i in $dirlist; do
537*1debfc3dSmrg    if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then
538*1debfc3dSmrg	ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; ${PWDCMD-pwd})`
539*1debfc3dSmrg    fi
540*1debfc3dSmrgdone
541*1debfc3dSmrg])
542*1debfc3dSmrgif test x"${ac_cv_c_iluh2}" != x; then
543*1debfc3dSmrg    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh2}"
544*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_iluh2})
545*1debfc3dSmrgelse
546*1debfc3dSmrg    AC_MSG_RESULT(none)
547*1debfc3dSmrgfi
548*1debfc3dSmrg
549*1debfc3dSmrgAC_MSG_CHECKING(for ILU C headers)
550*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_iluh3,[
551*1debfc3dSmrgfor i in $dirlist; do
552*1debfc3dSmrg    if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then
553*1debfc3dSmrg	ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c  ; ${PWDCMD-pwd})`
554*1debfc3dSmrg    fi
555*1debfc3dSmrgdone
556*1debfc3dSmrg])
557*1debfc3dSmrgif test x"${ac_cv_c_iluh3}" != x; then
558*1debfc3dSmrg    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh3}"
559*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_iluh3})
560*1debfc3dSmrgelse
561*1debfc3dSmrg    AC_MSG_RESULT(none)
562*1debfc3dSmrgfi
563*1debfc3dSmrg
564*1debfc3dSmrgAC_MSG_CHECKING(for ILU C runtime headers)
565*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_iluh4,[
566*1debfc3dSmrgfor i in $dirlist; do
567*1debfc3dSmrg    if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then
568*1debfc3dSmrg	ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c  ; ${PWDCMD-pwd})`
569*1debfc3dSmrg    fi
570*1debfc3dSmrgdone
571*1debfc3dSmrg])
572*1debfc3dSmrgif test x"${ac_cv_c_iluh4}" != x; then
573*1debfc3dSmrg    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh4}"
574*1debfc3dSmrg    AC_MSG_RESULT(${ac_cv_c_iluh4})
575*1debfc3dSmrgelse
576*1debfc3dSmrg    AC_MSG_RESULT(none)
577*1debfc3dSmrgfi
578*1debfc3dSmrg
579*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_ilupath,[
580*1debfc3dSmrgfor i in $dirlist; do
581*1debfc3dSmrg    if test -f "$i/ilu/Makefile" ; then
582*1debfc3dSmrg	ac_cv_c_ilupath=`(cd $i/ilu; ${PWDCMD-pwd})`
583*1debfc3dSmrg	break
584*1debfc3dSmrg    fi
585*1debfc3dSmrgdone
586*1debfc3dSmrg])
587*1debfc3dSmrgILUTOP=${ac_cv_c_ilupath}
588*1debfc3dSmrg
589*1debfc3dSmrgAC_MSG_CHECKING(for the ILU library in the build tree)
590*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_ilulib,[
591*1debfc3dSmrgif test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then
592*1debfc3dSmrg    ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; ${PWDCMD-pwd})`
593*1debfc3dSmrg    AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a)
594*1debfc3dSmrgelse
595*1debfc3dSmrg    AC_MSG_RESULT(no)
596*1debfc3dSmrgfi])
597*1debfc3dSmrg
598*1debfc3dSmrgAC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
599*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_ilulib2,[
600*1debfc3dSmrgif test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then
601*1debfc3dSmrg    ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; ${PWDCMD-pwd})`
602*1debfc3dSmrg    AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a)
603*1debfc3dSmrgelse
604*1debfc3dSmrg    AC_MSG_RESULT(no)
605*1debfc3dSmrgfi])
606*1debfc3dSmrg
607*1debfc3dSmrgAC_MSG_CHECKING(for the ILU C bindings library in the build tree)
608*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_ilulib3,[
609*1debfc3dSmrgif test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then
610*1debfc3dSmrg    ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; ${PWDCMD-pwd})`
611*1debfc3dSmrg    AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a)
612*1debfc3dSmrgelse
613*1debfc3dSmrg    AC_MSG_RESULT(no)
614*1debfc3dSmrgfi])
615*1debfc3dSmrg
616*1debfc3dSmrgAC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
617*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_ilulib4,[
618*1debfc3dSmrgif test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then
619*1debfc3dSmrg    ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; ${PWDCMD-pwd})`
620*1debfc3dSmrg    AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a)
621*1debfc3dSmrgelse
622*1debfc3dSmrg    AC_MSG_RESULT(no)
623*1debfc3dSmrgfi])
624*1debfc3dSmrg
625*1debfc3dSmrgif test x"${ac_cv_c_ilulib}" = x -a x"${ac_cv_c_ilulib2}" = x; then
626*1debfc3dSmrg  ILUHDIR=""
627*1debfc3dSmrgfi
628*1debfc3dSmrg
629*1debfc3dSmrgif test x"${ac_cv_c_ilulib}" != x -a x"${ac_cv_c_ilulib2}" != x; then
630*1debfc3dSmrg    ILULIB="-L${ac_cv_c_ilulib} -L${ac_cv_c_ilulib2} -L${ac_cv_c_ilulib3} -L${ac_cv_c_ilulib4}"
631*1debfc3dSmrgelse
632*1debfc3dSmrg    ILULIB=""
633*1debfc3dSmrgfi
634*1debfc3dSmrg
635*1debfc3dSmrgif test x"${ILULIB}" = x; then
636*1debfc3dSmrg    AC_MSG_CHECKING(for ILU libraries installed with the compiler)
637*1debfc3dSmrg    AC_CACHE_VAL(ac_cv_c_ilulib5,[
638*1debfc3dSmrg    NATIVE_GCC=`echo gcc | sed -e "${program_transform_name}"`
639*1debfc3dSmrg
640*1debfc3dSmrg    dnl Get G++'s full path to it's libraries
641*1debfc3dSmrg    ac_cv_c_ilulib5=`${NATIVE_GCC} --print-libgcc | sed -e 's:lib/gcc-lib/.*::'`lib
642*1debfc3dSmrg    if test -f $ac_cv_c_ilulib5/libilu-c.a -o -f $ac_cv_c_ilulib5/libilu-c.so ; then
643*1debfc3dSmrg        if test x"${ILUHDIR}" = x; then
644*1debfc3dSmrg               ILUHDIR="-I${ac_cv_c_ilulib5}/../include"
645*1debfc3dSmrg        fi
646*1debfc3dSmrg        ILULIB="-L${ac_cv_c_ilulib5}"
647*1debfc3dSmrg        AC_MSG_RESULT(${ac_cv_c_ilulib5})
648*1debfc3dSmrg    else
649*1debfc3dSmrg        ac_cv_c_ilulib=none
650*1debfc3dSmrg        AC_MSG_RESULT(none)
651*1debfc3dSmrg    fi
652*1debfc3dSmrgfi])
653*1debfc3dSmrgAC_SUBST(ILUHDIR)
654*1debfc3dSmrgAC_SUBST(ILULIB)
655*1debfc3dSmrgAC_SUBST(ILUTOP)
656*1debfc3dSmrg])
657*1debfc3dSmrg
658*1debfc3dSmrgdnl ====================================================================
659*1debfc3dSmrgdnl This defines the byte order for the host. We can't use
660*1debfc3dSmrgdnl AC_C_BIGENDIAN, cause we want to create a config file and
661*1debfc3dSmrgdnl substitue the real value, so the header files work right
662*1debfc3dSmrgAC_DEFUN([CYG_AC_C_ENDIAN], [
663*1debfc3dSmrgAC_MSG_CHECKING(to see if this is a little endian host)
664*1debfc3dSmrgAC_CACHE_VAL(ac_cv_c_little_endian, [
665*1debfc3dSmrgac_cv_c_little_endian=unknown
666*1debfc3dSmrg# See if sys/param.h defines the BYTE_ORDER macro.
667*1debfc3dSmrgAC_TRY_COMPILE([#include <sys/types.h>
668*1debfc3dSmrg#include <sys/param.h>], [
669*1debfc3dSmrg#if !BYTE_ORDER || !_BIG_ENDIAN || !_LITTLE_ENDIAN
670*1debfc3dSmrg bogus endian macros
671*1debfc3dSmrg#endif], [# It does; now see whether it defined to _LITTLE_ENDIAN or not.
672*1debfc3dSmrgAC_TRY_COMPILE([#include <sys/types.h>
673*1debfc3dSmrg#include <sys/param.h>], [
674*1debfc3dSmrg#if BYTE_ORDER != _LITTLE_ENDIAN
675*1debfc3dSmrg not big endian
676*1debfc3dSmrg#endif], ac_cv_c_little_endian=yes, ac_cv_c_little_endian=no)
677*1debfc3dSmrg])
678*1debfc3dSmrgif test ${ac_cv_c_little_endian} = unknown; then
679*1debfc3dSmrgold_cflags=$CFLAGS
680*1debfc3dSmrgCFLAGS=-g
681*1debfc3dSmrgAC_TRY_RUN([
682*1debfc3dSmrgmain () {
683*1debfc3dSmrg  /* Are we little or big endian?  From Harbison&Steele.  */
684*1debfc3dSmrg  union
685*1debfc3dSmrg  {
686*1debfc3dSmrg    long l;
687*1debfc3dSmrg    char c[sizeof (long)];
688*1debfc3dSmrg  } u;
689*1debfc3dSmrg  u.l = 1;
690*1debfc3dSmrg  exit (u.c[0] == 1);
691*1debfc3dSmrg}],
692*1debfc3dSmrgac_cv_c_little_endian=no,
693*1debfc3dSmrgac_cv_c_little_endian=yes,[
694*1debfc3dSmrgdnl Yes, this is ugly, and only used for a canadian cross anyway. This
695*1debfc3dSmrgdnl is just to keep configure from stopping here.
696*1debfc3dSmrgcase "${host}" in
697*1debfc3dSmrgchangequote(,)
698*1debfc3dSmrg   i[3456789]86-*-*) ac_cv_c_little_endian=yes ;;
699*1debfc3dSmrg   sparc*-*-*)    ac_cv_c_little_endian=no ;;
700*1debfc3dSmrgchangequote([,])
701*1debfc3dSmrg  *)    AC_MSG_WARN(Can't cross compile this test) ;;
702*1debfc3dSmrgesac])
703*1debfc3dSmrgCFLAGS=$old_cflags
704*1debfc3dSmrgfi])
705*1debfc3dSmrg
706*1debfc3dSmrgif test x"${ac_cv_c_little_endian}" = xyes; then
707*1debfc3dSmrg    AC_DEFINE(LITTLE_ENDIAN_HOST)
708*1debfc3dSmrg    ENDIAN="CYG_LSBFIRST";
709*1debfc3dSmrgelse
710*1debfc3dSmrg    ENDIAN="CYG_MSBFIRST";
711*1debfc3dSmrgfi
712*1debfc3dSmrgAC_MSG_RESULT(${ac_cv_c_little_endian})
713*1debfc3dSmrgAC_SUBST(ENDIAN)
714*1debfc3dSmrg])
715*1debfc3dSmrg
716*1debfc3dSmrgdnl ====================================================================
717*1debfc3dSmrgdnl Look for the path to libgcc, so we can use it to directly link
718*1debfc3dSmrgdnl in libgcc.a with LD.
719*1debfc3dSmrgAC_DEFUN([CYG_AC_PATH_LIBGCC],
720*1debfc3dSmrg[AC_MSG_CHECKING([Looking for the path to libgcc.a])
721*1debfc3dSmrgAC_LANG_SAVE
722*1debfc3dSmrgAC_LANG_C
723*1debfc3dSmrg
724*1debfc3dSmrgdnl Get Gcc's full path to libgcc.a
725*1debfc3dSmrglibgccpath=`${CC} --print-libgcc`
726*1debfc3dSmrg
727*1debfc3dSmrgdnl If we don't have a path with libgcc.a on the end, this isn't G++.
728*1debfc3dSmrgif test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
729*1debfc3dSmrg   ac_cv_prog_gcc=yes
730*1debfc3dSmrgelse
731*1debfc3dSmrg   ac_cv_prog_gcc=no
732*1debfc3dSmrgfi
733*1debfc3dSmrg
734*1debfc3dSmrgdnl
735*1debfc3dSmrgif test x"${ac_cv_prog_gcc}" = xyes ; then
736*1debfc3dSmrg   gccpath=`echo $libgccpath | sed -e 's:/libgcc.a::'`
737*1debfc3dSmrg   LIBGCC="-L${gccpath}"
738*1debfc3dSmrg   AC_MSG_RESULT(${gccpath})
739*1debfc3dSmrgelse
740*1debfc3dSmrg   LIBGCC=""
741*1debfc3dSmrg   AC_MSG_ERROR(Not using gcc)
742*1debfc3dSmrgfi
743*1debfc3dSmrg
744*1debfc3dSmrgAC_LANG_RESTORE
745*1debfc3dSmrgAC_SUBST(LIBGCC)
746*1debfc3dSmrg])
747