]> git.ipfire.org Git - thirdparty/gcc.git/blame - config/acinclude.m4
libstdc++: Add missing constexpr to __atomic_impl::__clear_padding
[thirdparty/gcc.git] / config / acinclude.m4
CommitLineData
117c9b1c
JM
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.
8076c0b6 9AC_DEFUN([CYG_AC_PROG_CXX_CROSS],
117c9b1c
JM
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.
8076c0b6 38AC_DEFUN([CYG_AC_PROG_GXX_WORKS],
117c9b1c
JM
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++.
8076c0b6 106AC_DEFUN([CYG_AC_PROG_CC_CROSS],
117c9b1c
JM
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.
8076c0b6 135AC_DEFUN([CYG_AC_PROG_GCC_WORKS],
117c9b1c
JM
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.
8076c0b6 202AC_DEFUN([CYG_AC_PATH_BFD], [
117c9b1c
JM
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
1e6347d8 209 ac_cv_c_bfdh=`(cd $i/bfd; ${PWDCMD-pwd})`
117c9b1c
JM
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
1e6347d8 227 ac_cv_c_bfdlib=`(cd $i/bfd; ${PWDCMD-pwd})`
117c9b1c
JM
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
117c9b1c
JM
241dnl ====================================================================
242dnl Find the opcodes library. This is used to do dissasemblies.
8076c0b6 243AC_DEFUN([CYG_AC_PATH_OPCODES], [
117c9b1c
JM
244AC_MSG_CHECKING(for the opcodes library in the build tree)
245dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
246AC_CACHE_VAL(ac_cv_c_opc,[
247for i in $dirlist; do
248 if test -f "$i/opcodes/Makefile" ; then
1e6347d8 249 ac_cv_c_opc=`(cd $i/opcodes; ${PWDCMD-pwd})`
117c9b1c
JM
250 fi
251done
252])
253if test x"${ac_cv_c_opc}" != x; then
254 OPCODESLIB="-L${ac_cv_c_opc}"
255 AC_MSG_RESULT(${ac_cv_c_opc})
256else
257 AC_MSG_RESULT(none)
258fi
259AC_SUBST(OPCODESLIB)
260])
261
262dnl ====================================================================
263dnl Look for the DejaGnu header file in the source tree. This file
264dnl defines the functions used to testing support.
8076c0b6 265AC_DEFUN([CYG_AC_PATH_DEJAGNU], [
117c9b1c
JM
266AC_MSG_CHECKING(for the testing support files in the source tree)
267dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
268AC_CACHE_VAL(ac_cv_c_dejagnu,[
269for i in $dirlist; do
270 if test -f "$srcdir/$i/ecc/ecc/infra/testlib/current/include/dejagnu.h" ; then
1e6347d8 271 ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; ${PWDCMD-pwd})`
117c9b1c
JM
272 fi
273done
274])
275if test x"${ac_cv_c_dejagnu}" != x; then
276 DEJAGNUHDIR="-I${ac_cv_c_dejagnu}"
277 AC_MSG_RESULT(${ac_cv_c_dejagnu})
278else
279 AC_MSG_RESULT(none)
280fi
281AC_CACHE_VAL(ac_cv_c_dejagnulib,[
282for i in $dirlist; do
283 if test -f "$srcdir/$i/infra/testlib/current/lib/hostutil.exp" ; then
1e6347d8 284 ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; ${PWDCMD-pwd})`
117c9b1c
JM
285 fi
286done
287])
288if test x"${ac_cv_c_dejagnulib}" != x; then
289 DEJAGNULIB="${ac_cv_c_dejagnulib}"
290else
291 DEJAGNULIB=""
292fi
293AC_MSG_CHECKING(for runtest in the source tree)
294AC_CACHE_VAL(ac_cv_c_runtest,[
295for i in $dirlist; do
296 if test -f "$srcdir/$i/dejagnu/runtest" ; then
1e6347d8 297 ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; ${PWDCMD-pwd})`
117c9b1c
JM
298 fi
299done
300])
301if test x"${ac_cv_c_runtest}" != x; then
302 RUNTESTDIR="${ac_cv_c_runtest}"
303 AC_MSG_RESULT(${ac_cv_c_runtest})
304else
305 RUNTESTDIR=""
306 AC_MSG_RESULT(none)
307fi
308AC_SUBST(RUNTESTDIR)
309AC_SUBST(DEJAGNULIB)
310AC_SUBST(DEJAGNUHDIR)
311])
312
313dnl ====================================================================
314dnl Find the libintl library in the build tree. This is for
315dnl internationalization support.
8076c0b6 316AC_DEFUN([CYG_AC_PATH_INTL], [
117c9b1c
JM
317AC_MSG_CHECKING(for the intl header in the build tree)
318dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
319dnl Look for the header file
320AC_CACHE_VAL(ac_cv_c_intlh,[
321for i in $dirlist; do
322 if test -f "$i/intl/libintl.h" ; then
1e6347d8 323 ac_cv_c_intlh=`(cd $i/intl; ${PWDCMD-pwd})`
117c9b1c
JM
324 break
325 fi
326done
327])
328if test x"${ac_cv_c_intlh}" != x; then
329 INTLHDIR="-I${ac_cv_c_intlh}"
330 AC_MSG_RESULT(${ac_cv_c_intlh})
331else
332 AC_MSG_RESULT(none)
333fi
334AC_SUBST(INTLHDIR)
335
336dnl Look for the library
337AC_MSG_CHECKING(for the libintl library in the build tree)
338AC_CACHE_VAL(ac_cv_c_intllib,[
339for i in $dirlist; do
340 if test -f "$i/intl/Makefile" ; then
1e6347d8 341 ac_cv_c_intllib=`(cd $i/intl; ${PWDCMD-pwd})`
117c9b1c
JM
342 fi
343done
344])
345if test x"${ac_cv_c_intllib}" != x; then
346 INTLLIB="-L${ac_cv_c_intllib} -lintl"
347 AC_MSG_RESULT(${ac_cv_c_intllib})
348else
349 AC_MSG_RESULT(none)
350fi
351AC_SUBST(INTLLIB)
352])
353
117c9b1c
JM
354dnl ====================================================================
355dnl Find the libiberty library.
8076c0b6 356AC_DEFUN([CYG_AC_PATH_LIBIBERTY], [
117c9b1c
JM
357AC_MSG_CHECKING(for the libiberty library in the build tree)
358dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
359AC_CACHE_VAL(ac_cv_c_libib,[
360for i in $dirlist; do
361 if test -f "$i/libiberty/Makefile" ; then
1e6347d8 362 ac_cv_c_libib=`(cd $i/libiberty/; ${PWDCMD-pwd})`
117c9b1c
JM
363 fi
364done
365])
366if test x"${ac_cv_c_libib}" != x; then
367 LIBIBERTY="-L${ac_cv_c_libib}"
368 AC_MSG_RESULT(${ac_cv_c_libib})
369else
370 AC_MSG_RESULT(none)
371fi
372AC_SUBST(LIBIBERTY)
373])
374
117c9b1c
JM
375dnl ====================================================================
376dnl Find all the ILU headers and libraries
8076c0b6 377AC_DEFUN([CYG_AC_PATH_ILU], [
117c9b1c
JM
378AC_MSG_CHECKING(for ILU kernel headers in the source tree)
379dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
380AC_CACHE_VAL(ac_cv_c_iluh,[
381for i in $dirlist; do
382 if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then
1e6347d8 383 ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; ${PWDCMD-pwd})`
117c9b1c
JM
384 fi
385done
386])
387if test x"${ac_cv_c_iluh}" != x; then
388 ILUHDIR="-I${ac_cv_c_iluh}"
389 AC_MSG_RESULT(${ac_cv_c_iluh})
390else
391 AC_MSG_RESULT(none)
392fi
393
394AC_MSG_CHECKING(for ILU kernel headers in the build tree)
395dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
396AC_CACHE_VAL(ac_cv_c_iluh5,[
397for i in $dirlist; do
398 if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then
1e6347d8 399 ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; ${PWDCMD-pwd})`
117c9b1c
JM
400 fi
401done
402])
403if test x"${ac_cv_c_iluh5}" != x; then
404 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh5}"
405 AC_MSG_RESULT(${ac_cv_c_iluh5})
406else
407 AC_MSG_RESULT(none)
408fi
409
410AC_MSG_CHECKING(for ILU C++ headers in the source tree)
411AC_CACHE_VAL(ac_cv_c_iluh2,[
412for i in $dirlist; do
413 if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then
1e6347d8 414 ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; ${PWDCMD-pwd})`
117c9b1c
JM
415 fi
416done
417])
418if test x"${ac_cv_c_iluh2}" != x; then
419 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh2}"
420 AC_MSG_RESULT(${ac_cv_c_iluh2})
421else
422 AC_MSG_RESULT(none)
423fi
424
425AC_MSG_CHECKING(for ILU C headers)
426AC_CACHE_VAL(ac_cv_c_iluh3,[
427for i in $dirlist; do
428 if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then
1e6347d8 429 ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c ; ${PWDCMD-pwd})`
117c9b1c
JM
430 fi
431done
432])
433if test x"${ac_cv_c_iluh3}" != x; then
434 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh3}"
435 AC_MSG_RESULT(${ac_cv_c_iluh3})
436else
437 AC_MSG_RESULT(none)
438fi
439
440AC_MSG_CHECKING(for ILU C runtime headers)
441AC_CACHE_VAL(ac_cv_c_iluh4,[
442for i in $dirlist; do
443 if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then
1e6347d8 444 ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c ; ${PWDCMD-pwd})`
117c9b1c
JM
445 fi
446done
447])
448if test x"${ac_cv_c_iluh4}" != x; then
449 ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh4}"
450 AC_MSG_RESULT(${ac_cv_c_iluh4})
451else
452 AC_MSG_RESULT(none)
453fi
454
455AC_CACHE_VAL(ac_cv_c_ilupath,[
456for i in $dirlist; do
457 if test -f "$i/ilu/Makefile" ; then
1e6347d8 458 ac_cv_c_ilupath=`(cd $i/ilu; ${PWDCMD-pwd})`
117c9b1c
JM
459 break
460 fi
461done
462])
463ILUTOP=${ac_cv_c_ilupath}
464
465AC_MSG_CHECKING(for the ILU library in the build tree)
466AC_CACHE_VAL(ac_cv_c_ilulib,[
467if test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then
1e6347d8 468 ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; ${PWDCMD-pwd})`
117c9b1c
JM
469 AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a)
470else
471 AC_MSG_RESULT(no)
472fi])
473
474AC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
475AC_CACHE_VAL(ac_cv_c_ilulib2,[
476if test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then
1e6347d8 477 ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; ${PWDCMD-pwd})`
117c9b1c
JM
478 AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a)
479else
480 AC_MSG_RESULT(no)
481fi])
482
483AC_MSG_CHECKING(for the ILU C bindings library in the build tree)
484AC_CACHE_VAL(ac_cv_c_ilulib3,[
485if test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then
1e6347d8 486 ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; ${PWDCMD-pwd})`
117c9b1c
JM
487 AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a)
488else
489 AC_MSG_RESULT(no)
490fi])
491
492AC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
493AC_CACHE_VAL(ac_cv_c_ilulib4,[
494if test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then
1e6347d8 495 ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; ${PWDCMD-pwd})`
117c9b1c
JM
496 AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a)
497else
498 AC_MSG_RESULT(no)
499fi])
500
501if test x"${ac_cv_c_ilulib}" = x -a x"${ac_cv_c_ilulib2}" = x; then
502 ILUHDIR=""
503fi
504
505if 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}"
507else
508 ILULIB=""
509fi
510
511if 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
528fi])
529AC_SUBST(ILUHDIR)
530AC_SUBST(ILULIB)
531AC_SUBST(ILUTOP)
532])
533
534dnl ====================================================================
535dnl This defines the byte order for the host. We can't use
536dnl AC_C_BIGENDIAN, cause we want to create a config file and
537dnl substitue the real value, so the header files work right
8076c0b6 538AC_DEFUN([CYG_AC_C_ENDIAN], [
117c9b1c
JM
539AC_MSG_CHECKING(to see if this is a little endian host)
540AC_CACHE_VAL(ac_cv_c_little_endian, [
541ac_cv_c_little_endian=unknown
542# See if sys/param.h defines the BYTE_ORDER macro.
543AC_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.
548AC_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])
554if test ${ac_cv_c_little_endian} = unknown; then
555old_cflags=$CFLAGS
556CFLAGS=-g
557AC_TRY_RUN([
558main () {
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}],
568ac_cv_c_little_endian=no,
569ac_cv_c_little_endian=yes,[
570dnl Yes, this is ugly, and only used for a canadian cross anyway. This
571dnl is just to keep configure from stopping here.
572case "${host}" in
573changequote(,)
39987976 574 i[3456789]86-*-*) ac_cv_c_little_endian=yes ;;
117c9b1c
JM
575 sparc*-*-*) ac_cv_c_little_endian=no ;;
576changequote([,])
577 *) AC_MSG_WARN(Can't cross compile this test) ;;
578esac])
579CFLAGS=$old_cflags
580fi])
581
582if test x"${ac_cv_c_little_endian}" = xyes; then
583 AC_DEFINE(LITTLE_ENDIAN_HOST)
584 ENDIAN="CYG_LSBFIRST";
585else
586 ENDIAN="CYG_MSBFIRST";
587fi
588AC_MSG_RESULT(${ac_cv_c_little_endian})
589AC_SUBST(ENDIAN)
590])
591
592dnl ====================================================================
593dnl Look for the path to libgcc, so we can use it to directly link
594dnl in libgcc.a with LD.
8076c0b6 595AC_DEFUN([CYG_AC_PATH_LIBGCC],
117c9b1c
JM
596[AC_MSG_CHECKING([Looking for the path to libgcc.a])
597AC_LANG_SAVE
598AC_LANG_C
599
600dnl Get Gcc's full path to libgcc.a
601libgccpath=`${CC} --print-libgcc`
602
603dnl If we don't have a path with libgcc.a on the end, this isn't G++.
604if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
605 ac_cv_prog_gcc=yes
606else
607 ac_cv_prog_gcc=no
608fi
609
610dnl
611if 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})
615else
616 LIBGCC=""
617 AC_MSG_ERROR(Not using gcc)
618fi
619
620AC_LANG_RESTORE
621AC_SUBST(LIBGCC)
622])