acinclude.m4 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  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 simulator library.
  350. AC_DEFUN([CYG_AC_PATH_SIM], [
  351. dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.."
  352. case "$target_cpu" in
  353. powerpc) target_dir=ppc ;;
  354. sparc*) target_dir=erc32 ;;
  355. mips*) target_dir=mips ;;
  356. *) target_dir=$target_cpu ;;
  357. esac
  358. dnl First look for the header file
  359. AC_MSG_CHECKING(for the simulator header file)
  360. AC_CACHE_VAL(ac_cv_c_simh,[
  361. for i in $dirlist; do
  362. if test -f "${srcdir}/$i/include/remote-sim.h" ; then
  363. ac_cv_c_simh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
  364. break
  365. fi
  366. done
  367. ])
  368. if test x"${ac_cv_c_simh}" != x; then
  369. SIMHDIR="-I${ac_cv_c_simh}"
  370. AC_MSG_RESULT(${ac_cv_c_simh})
  371. else
  372. AC_MSG_RESULT(none)
  373. fi
  374. AC_SUBST(SIMHDIR)
  375. dnl See whether it's a devo or Foundry branch simulator
  376. AC_MSG_CHECKING(Whether this is a devo simulator )
  377. AC_CACHE_VAL(ac_cv_c_simdevo,[
  378. CPPFLAGS="$CPPFLAGS $SIMHDIR"
  379. AC_EGREP_HEADER([SIM_DESC sim_open.*struct _bfd], remote-sim.h,
  380. ac_cv_c_simdevo=yes,
  381. ac_cv_c_simdevo=no)
  382. ])
  383. if test x"$ac_cv_c_simdevo" = x"yes" ; then
  384. AC_DEFINE(HAVE_DEVO_SIM)
  385. fi
  386. AC_MSG_RESULT(${ac_cv_c_simdevo})
  387. AC_SUBST(HAVE_DEVO_SIM)
  388. dnl Next look for the library
  389. AC_MSG_CHECKING(for the simulator library)
  390. AC_CACHE_VAL(ac_cv_c_simlib,[
  391. for i in $dirlist; do
  392. if test -f "$i/sim/$target_dir/Makefile" ; then
  393. ac_cv_c_simlib=`(cd $i/sim/$target_dir; ${PWDCMD-pwd})`
  394. fi
  395. done
  396. ])
  397. if test x"${ac_cv_c_simlib}" != x; then
  398. SIMLIB="-L${ac_cv_c_simlib}"
  399. else
  400. AC_MSG_RESULT(none)
  401. dnl FIXME: this is kinda bogus, cause umtimately the TM will build
  402. dnl all the libraries for several architectures. But for now, this
  403. dnl will work till then.
  404. dnl AC_MSG_CHECKING(for the simulator installed with the compiler libraries)
  405. dnl Transform the name of the compiler to it's cross variant, unless
  406. dnl CXX is set. This is also what CXX gets set to in the generated
  407. dnl Makefile.
  408. CROSS_GCC=`echo gcc | sed -e "s/^/$target/"`
  409. dnl Get G++'s full path to libgcc.a
  410. changequote(,)
  411. gccpath=`${CROSS_GCC} --print-libgcc | sed -e 's:[a-z0-9A-Z\.\-]*/libgcc.a::' -e 's:lib/gcc-lib/::'`lib
  412. changequote([,])
  413. if test -f $gccpath/libsim.a -o -f $gccpath/libsim.so ; then
  414. ac_cv_c_simlib="$gccpath/"
  415. SIMLIB="-L${ac_cv_c_simlib}"
  416. AC_MSG_RESULT(${ac_cv_c_simlib})
  417. else
  418. AM_CONDITIONAL(PSIM, test x$psim = xno)
  419. SIMLIB=""
  420. AC_MSG_RESULT(none)
  421. dnl ac_cv_c_simlib=none
  422. fi
  423. fi
  424. AC_SUBST(SIMLIB)
  425. ])
  426. dnl ====================================================================
  427. dnl Find the libiberty library.
  428. AC_DEFUN([CYG_AC_PATH_LIBIBERTY], [
  429. AC_MSG_CHECKING(for the libiberty library in the build tree)
  430. dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
  431. AC_CACHE_VAL(ac_cv_c_libib,[
  432. for i in $dirlist; do
  433. if test -f "$i/libiberty/Makefile" ; then
  434. ac_cv_c_libib=`(cd $i/libiberty/; ${PWDCMD-pwd})`
  435. fi
  436. done
  437. ])
  438. if test x"${ac_cv_c_libib}" != x; then
  439. LIBIBERTY="-L${ac_cv_c_libib}"
  440. AC_MSG_RESULT(${ac_cv_c_libib})
  441. else
  442. AC_MSG_RESULT(none)
  443. fi
  444. AC_SUBST(LIBIBERTY)
  445. ])
  446. dnl ====================================================================
  447. AC_DEFUN([CYG_AC_PATH_DEVO], [
  448. AC_MSG_CHECKING(for devo headers in the source tree)
  449. dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
  450. AC_CACHE_VAL(ac_cv_c_devoh,[
  451. for i in $dirlist; do
  452. if test -f "${srcdir}/$i/include/remote-sim.h" ; then
  453. ac_cv_c_devoh=`(cd ${srcdir}/$i/include; ${PWDCMD-pwd})`
  454. fi
  455. done
  456. ])
  457. if test x"${ac_cv_c_devoh}" != x; then
  458. DEVOHDIR="-I${ac_cv_c_devoh}"
  459. AC_MSG_RESULT(${ac_cv_c_devoh})
  460. else
  461. AC_MSG_RESULT(none)
  462. fi
  463. AC_SUBST(DEVOHDIR)
  464. ])
  465. dnl ====================================================================
  466. dnl Find all the ILU headers and libraries
  467. AC_DEFUN([CYG_AC_PATH_ILU], [
  468. AC_MSG_CHECKING(for ILU kernel headers in the source tree)
  469. dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
  470. AC_CACHE_VAL(ac_cv_c_iluh,[
  471. for i in $dirlist; do
  472. if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then
  473. ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; ${PWDCMD-pwd})`
  474. fi
  475. done
  476. ])
  477. if test x"${ac_cv_c_iluh}" != x; then
  478. ILUHDIR="-I${ac_cv_c_iluh}"
  479. AC_MSG_RESULT(${ac_cv_c_iluh})
  480. else
  481. AC_MSG_RESULT(none)
  482. fi
  483. AC_MSG_CHECKING(for ILU kernel headers in the build tree)
  484. dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
  485. AC_CACHE_VAL(ac_cv_c_iluh5,[
  486. for i in $dirlist; do
  487. if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then
  488. ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; ${PWDCMD-pwd})`
  489. fi
  490. done
  491. ])
  492. if test x"${ac_cv_c_iluh5}" != x; then
  493. ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh5}"
  494. AC_MSG_RESULT(${ac_cv_c_iluh5})
  495. else
  496. AC_MSG_RESULT(none)
  497. fi
  498. AC_MSG_CHECKING(for ILU C++ headers in the source tree)
  499. AC_CACHE_VAL(ac_cv_c_iluh2,[
  500. for i in $dirlist; do
  501. if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then
  502. ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; ${PWDCMD-pwd})`
  503. fi
  504. done
  505. ])
  506. if test x"${ac_cv_c_iluh2}" != x; then
  507. ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh2}"
  508. AC_MSG_RESULT(${ac_cv_c_iluh2})
  509. else
  510. AC_MSG_RESULT(none)
  511. fi
  512. AC_MSG_CHECKING(for ILU C headers)
  513. AC_CACHE_VAL(ac_cv_c_iluh3,[
  514. for i in $dirlist; do
  515. if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then
  516. ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c ; ${PWDCMD-pwd})`
  517. fi
  518. done
  519. ])
  520. if test x"${ac_cv_c_iluh3}" != x; then
  521. ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh3}"
  522. AC_MSG_RESULT(${ac_cv_c_iluh3})
  523. else
  524. AC_MSG_RESULT(none)
  525. fi
  526. AC_MSG_CHECKING(for ILU C runtime headers)
  527. AC_CACHE_VAL(ac_cv_c_iluh4,[
  528. for i in $dirlist; do
  529. if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then
  530. ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c ; ${PWDCMD-pwd})`
  531. fi
  532. done
  533. ])
  534. if test x"${ac_cv_c_iluh4}" != x; then
  535. ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh4}"
  536. AC_MSG_RESULT(${ac_cv_c_iluh4})
  537. else
  538. AC_MSG_RESULT(none)
  539. fi
  540. AC_CACHE_VAL(ac_cv_c_ilupath,[
  541. for i in $dirlist; do
  542. if test -f "$i/ilu/Makefile" ; then
  543. ac_cv_c_ilupath=`(cd $i/ilu; ${PWDCMD-pwd})`
  544. break
  545. fi
  546. done
  547. ])
  548. ILUTOP=${ac_cv_c_ilupath}
  549. AC_MSG_CHECKING(for the ILU library in the build tree)
  550. AC_CACHE_VAL(ac_cv_c_ilulib,[
  551. if test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then
  552. ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; ${PWDCMD-pwd})`
  553. AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a)
  554. else
  555. AC_MSG_RESULT(no)
  556. fi])
  557. AC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
  558. AC_CACHE_VAL(ac_cv_c_ilulib2,[
  559. if test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then
  560. ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; ${PWDCMD-pwd})`
  561. AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a)
  562. else
  563. AC_MSG_RESULT(no)
  564. fi])
  565. AC_MSG_CHECKING(for the ILU C bindings library in the build tree)
  566. AC_CACHE_VAL(ac_cv_c_ilulib3,[
  567. if test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then
  568. ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; ${PWDCMD-pwd})`
  569. AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a)
  570. else
  571. AC_MSG_RESULT(no)
  572. fi])
  573. AC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
  574. AC_CACHE_VAL(ac_cv_c_ilulib4,[
  575. if test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then
  576. ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; ${PWDCMD-pwd})`
  577. AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a)
  578. else
  579. AC_MSG_RESULT(no)
  580. fi])
  581. if test x"${ac_cv_c_ilulib}" = x -a x"${ac_cv_c_ilulib2}" = x; then
  582. ILUHDIR=""
  583. fi
  584. if test x"${ac_cv_c_ilulib}" != x -a x"${ac_cv_c_ilulib2}" != x; then
  585. ILULIB="-L${ac_cv_c_ilulib} -L${ac_cv_c_ilulib2} -L${ac_cv_c_ilulib3} -L${ac_cv_c_ilulib4}"
  586. else
  587. ILULIB=""
  588. fi
  589. if test x"${ILULIB}" = x; then
  590. AC_MSG_CHECKING(for ILU libraries installed with the compiler)
  591. AC_CACHE_VAL(ac_cv_c_ilulib5,[
  592. NATIVE_GCC=`echo gcc | sed -e "${program_transform_name}"`
  593. dnl Get G++'s full path to it's libraries
  594. ac_cv_c_ilulib5=`${NATIVE_GCC} --print-libgcc | sed -e 's:lib/gcc-lib/.*::'`lib
  595. if test -f $ac_cv_c_ilulib5/libilu-c.a -o -f $ac_cv_c_ilulib5/libilu-c.so ; then
  596. if test x"${ILUHDIR}" = x; then
  597. ILUHDIR="-I${ac_cv_c_ilulib5}/../include"
  598. fi
  599. ILULIB="-L${ac_cv_c_ilulib5}"
  600. AC_MSG_RESULT(${ac_cv_c_ilulib5})
  601. else
  602. ac_cv_c_ilulib=none
  603. AC_MSG_RESULT(none)
  604. fi
  605. fi])
  606. AC_SUBST(ILUHDIR)
  607. AC_SUBST(ILULIB)
  608. AC_SUBST(ILUTOP)
  609. ])
  610. dnl ====================================================================
  611. dnl This defines the byte order for the host. We can't use
  612. dnl AC_C_BIGENDIAN, cause we want to create a config file and
  613. dnl substitue the real value, so the header files work right
  614. AC_DEFUN([CYG_AC_C_ENDIAN], [
  615. AC_MSG_CHECKING(to see if this is a little endian host)
  616. AC_CACHE_VAL(ac_cv_c_little_endian, [
  617. ac_cv_c_little_endian=unknown
  618. # See if sys/param.h defines the BYTE_ORDER macro.
  619. AC_TRY_COMPILE([#include <sys/types.h>
  620. #include <sys/param.h>], [
  621. #if !BYTE_ORDER || !_BIG_ENDIAN || !_LITTLE_ENDIAN
  622. bogus endian macros
  623. #endif], [# It does; now see whether it defined to _LITTLE_ENDIAN or not.
  624. AC_TRY_COMPILE([#include <sys/types.h>
  625. #include <sys/param.h>], [
  626. #if BYTE_ORDER != _LITTLE_ENDIAN
  627. not big endian
  628. #endif], ac_cv_c_little_endian=yes, ac_cv_c_little_endian=no)
  629. ])
  630. if test ${ac_cv_c_little_endian} = unknown; then
  631. old_cflags=$CFLAGS
  632. CFLAGS=-g
  633. AC_TRY_RUN([
  634. main () {
  635. /* Are we little or big endian? From Harbison&Steele. */
  636. union
  637. {
  638. long l;
  639. char c[sizeof (long)];
  640. } u;
  641. u.l = 1;
  642. exit (u.c[0] == 1);
  643. }],
  644. ac_cv_c_little_endian=no,
  645. ac_cv_c_little_endian=yes,[
  646. dnl Yes, this is ugly, and only used for a canadian cross anyway. This
  647. dnl is just to keep configure from stopping here.
  648. case "${host}" in
  649. changequote(,)
  650. i[3456789]86-*-*) ac_cv_c_little_endian=yes ;;
  651. sparc*-*-*) ac_cv_c_little_endian=no ;;
  652. changequote([,])
  653. *) AC_MSG_WARN(Can't cross compile this test) ;;
  654. esac])
  655. CFLAGS=$old_cflags
  656. fi])
  657. if test x"${ac_cv_c_little_endian}" = xyes; then
  658. AC_DEFINE(LITTLE_ENDIAN_HOST)
  659. ENDIAN="CYG_LSBFIRST";
  660. else
  661. ENDIAN="CYG_MSBFIRST";
  662. fi
  663. AC_MSG_RESULT(${ac_cv_c_little_endian})
  664. AC_SUBST(ENDIAN)
  665. ])
  666. dnl ====================================================================
  667. dnl Look for the path to libgcc, so we can use it to directly link
  668. dnl in libgcc.a with LD.
  669. AC_DEFUN([CYG_AC_PATH_LIBGCC],
  670. [AC_MSG_CHECKING([Looking for the path to libgcc.a])
  671. AC_LANG_SAVE
  672. AC_LANG_C
  673. dnl Get Gcc's full path to libgcc.a
  674. libgccpath=`${CC} --print-libgcc`
  675. dnl If we don't have a path with libgcc.a on the end, this isn't G++.
  676. if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
  677. ac_cv_prog_gcc=yes
  678. else
  679. ac_cv_prog_gcc=no
  680. fi
  681. dnl
  682. if test x"${ac_cv_prog_gcc}" = xyes ; then
  683. gccpath=`echo $libgccpath | sed -e 's:/libgcc.a::'`
  684. LIBGCC="-L${gccpath}"
  685. AC_MSG_RESULT(${gccpath})
  686. else
  687. LIBGCC=""
  688. AC_MSG_ERROR(Not using gcc)
  689. fi
  690. AC_LANG_RESTORE
  691. AC_SUBST(LIBGCC)
  692. ])