Debian Codegraph @

config/acinclude.m4

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