source: trunk/libs/newlib/src/config/acinclude.m4 @ 572

Last change on this file since 572 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

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