acinclude.m4 20 KB

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