GCC with OpenMP stream-computing extension and BatchQueue algorithm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config-ml.in 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  1. # Configure fragment invoked in the post-target section for subdirs
  2. # wanting multilib support.
  3. #
  4. # Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
  5. # 2005, 2006, 2007 Free Software Foundation, Inc.
  6. #
  7. # This file is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20. # Boston, MA 02110-1301, USA.
  21. #
  22. # As a special exception to the GNU General Public License, if you
  23. # distribute this file as part of a program that contains a
  24. # configuration script generated by Autoconf, you may include it under
  25. # the same distribution terms that you use for the rest of that program.
  26. #
  27. # Please report bugs to <gcc-bugs@gnu.org>
  28. # and send patches to <gcc-patches@gnu.org>.
  29. # It is advisable to support a few --enable/--disable options to let the
  30. # user select which libraries s/he really wants.
  31. #
  32. # Subdirectories wishing to use multilib should put the following lines
  33. # in the "post-target" section of configure.in.
  34. #
  35. # if [ "${srcdir}" = "." ] ; then
  36. # if [ "${with_target_subdir}" != "." ] ; then
  37. # . ${with_multisrctop}../../config-ml.in
  38. # else
  39. # . ${with_multisrctop}../config-ml.in
  40. # fi
  41. # else
  42. # . ${srcdir}/../config-ml.in
  43. # fi
  44. #
  45. #
  46. # Things are complicated because 6 separate cases must be handled:
  47. # 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
  48. #
  49. # srcdir=. is special. It must handle make programs that don't handle VPATH.
  50. # To implement this, a symlink tree is built for each library and for each
  51. # multilib subdir.
  52. #
  53. # The build tree is layed out as
  54. #
  55. # ./
  56. # newlib
  57. # m68020/
  58. # newlib
  59. # m68881/
  60. # newlib
  61. #
  62. # The nice feature about this arrangement is that inter-library references
  63. # in the build tree work without having to care where you are. Note that
  64. # inter-library references also work in the source tree because symlink trees
  65. # are built when srcdir=.
  66. #
  67. # Unfortunately, trying to access the libraries in the build tree requires
  68. # the user to manually choose which library to use as GCC won't be able to
  69. # find the right one. This is viewed as the lesser of two evils.
  70. #
  71. # Configure variables:
  72. # ${with_target_subdir} = "." for native, or ${target_alias} for cross.
  73. # Set by top level Makefile.
  74. # ${with_multisrctop} = how many levels of multilibs there are in the source
  75. # tree. It exists to handle the case of configuring in the source tree:
  76. # ${srcdir} is not constant.
  77. # ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
  78. #
  79. # Makefile variables:
  80. # MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
  81. # (FIXME: note that this is different than ${with_multisrctop}. Check out.).
  82. # MULTIBUILDTOP = number of multilib levels in build tree
  83. # MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
  84. # (only defined in each library's main Makefile).
  85. # MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000)
  86. # (only defined in each multilib subdir).
  87. # FIXME: Multilib is currently disabled by default for everything other than
  88. # newlib. It is up to each target to turn on multilib support for the other
  89. # libraries as desired.
  90. # Autoconf incoming variables:
  91. # srcdir, host, ac_configure_args
  92. #
  93. # We *could* figure srcdir and host out, but we'd have to do work that
  94. # our caller has already done to figure them out and requiring these two
  95. # seems reasonable.
  96. # Note that `host' in this case is GCC's `target'. Target libraries are
  97. # configured for a particular host.
  98. Makefile=${ac_file-Makefile}
  99. ml_config_shell=${CONFIG_SHELL-/bin/sh}
  100. ml_realsrcdir=${srcdir}
  101. # Scan all the arguments and set all the ones we need.
  102. ml_verbose=--verbose
  103. for option in ${ac_configure_args}
  104. do
  105. # strip single quotes surrounding individual options
  106. case $option in
  107. \'*\') eval option=$option ;;
  108. esac
  109. case $option in
  110. --*) ;;
  111. -*) option=-$option ;;
  112. esac
  113. case $option in
  114. --*=*)
  115. optarg=`echo $option | sed -e 's/^[^=]*=//'`
  116. ;;
  117. esac
  118. case $option in
  119. --disable-*)
  120. enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
  121. eval $enableopt=no
  122. ;;
  123. --enable-*)
  124. case "$option" in
  125. *=*) ;;
  126. *) optarg=yes ;;
  127. esac
  128. enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  129. # enable_shared and enable_static are handled by configure.
  130. # Don't undo its work.
  131. case $enableopt in
  132. enable_shared | enable_static) ;;
  133. *) eval $enableopt="$optarg" ;;
  134. esac
  135. ;;
  136. --norecursion | --no-recursion)
  137. ml_norecursion=yes
  138. ;;
  139. --silent | --sil* | --quiet | --q*)
  140. ml_verbose=--silent
  141. ;;
  142. --verbose | --v | --verb*)
  143. ml_verbose=--verbose
  144. ;;
  145. --with-*)
  146. case "$option" in
  147. *=*) ;;
  148. *) optarg=yes ;;
  149. esac
  150. withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  151. eval $withopt="$optarg"
  152. ;;
  153. --without-*)
  154. withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
  155. eval $withopt=no
  156. ;;
  157. esac
  158. done
  159. # Only do this if --enable-multilib.
  160. if [ "${enable_multilib}" = yes ]; then
  161. # Compute whether this is the library's top level directory
  162. # (ie: not a multilib subdirectory, and not a subdirectory like newlib/src).
  163. # ${with_multisubdir} tells us we're in the right branch, but we could be
  164. # in a subdir of that.
  165. # ??? The previous version could void this test by separating the process into
  166. # two files: one that only the library's toplevel configure.in ran (to
  167. # configure the multilib subdirs), and another that all configure.in's ran to
  168. # update the Makefile. It seemed reasonable to collapse all multilib support
  169. # into one file, but it does leave us with having to perform this test.
  170. ml_toplevel_p=no
  171. if [ -z "${with_multisubdir}" ]; then
  172. if [ "${srcdir}" = "." ]; then
  173. # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
  174. # ${with_target_subdir} = "." for native, otherwise target alias.
  175. if [ "${with_target_subdir}" = "." ]; then
  176. if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
  177. ml_toplevel_p=yes
  178. fi
  179. else
  180. if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
  181. ml_toplevel_p=yes
  182. fi
  183. fi
  184. else
  185. # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
  186. if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
  187. ml_toplevel_p=yes
  188. fi
  189. fi
  190. fi
  191. # If this is the library's top level directory, set multidirs to the
  192. # multilib subdirs to support. This lives at the top because we need
  193. # `multidirs' set right away.
  194. if [ "${ml_toplevel_p}" = yes ]; then
  195. multidirs=
  196. for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
  197. dir=`echo $i | sed -e 's/;.*$//'`
  198. if [ "${dir}" = "." ]; then
  199. true
  200. else
  201. if [ -z "${multidirs}" ]; then
  202. multidirs="${dir}"
  203. else
  204. multidirs="${multidirs} ${dir}"
  205. fi
  206. fi
  207. done
  208. # Target libraries are configured for the host they run on, so we check
  209. # $host here, not $target.
  210. case "${host}" in
  211. arc-*-elf*)
  212. if [ x$enable_biendian != xyes ]
  213. then
  214. old_multidirs=${multidirs}
  215. multidirs=""
  216. for x in ${old_multidirs}; do
  217. case "${x}" in
  218. *be*) : ;;
  219. *) multidirs="${multidirs} ${x}" ;;
  220. esac
  221. done
  222. fi
  223. ;;
  224. arm-*-*)
  225. if [ x"$enable_fpu" = xno ]
  226. then
  227. old_multidirs=${multidirs}
  228. multidirs=""
  229. for x in ${old_multidirs}; do
  230. case "${x}" in
  231. *fpu*) : ;;
  232. *) multidirs="${multidirs} ${x}" ;;
  233. esac
  234. done
  235. fi
  236. if [ x"$enable_26bit" = xno ]
  237. then
  238. old_multidirs=${multidirs}
  239. multidirs=""
  240. for x in ${old_multidirs}; do
  241. case "${x}" in
  242. *26bit*) : ;;
  243. *) multidirs="${multidirs} ${x}" ;;
  244. esac
  245. done
  246. fi
  247. if [ x"$enable_underscore" = xno ]
  248. then
  249. old_multidirs=${multidirs}
  250. multidirs=""
  251. for x in ${old_multidirs}; do
  252. case "${x}" in
  253. *under*) : ;;
  254. *) multidirs="${multidirs} ${x}" ;;
  255. esac
  256. done
  257. fi
  258. if [ x"$enable_interwork" = xno ]
  259. then
  260. old_multidirs=${multidirs}
  261. multidirs=""
  262. for x in ${old_multidirs}; do
  263. case "${x}" in
  264. *interwork*) : ;;
  265. *) multidirs="${multidirs} ${x}" ;;
  266. esac
  267. done
  268. fi
  269. if [ x$enable_biendian = xno ]
  270. then
  271. old_multidirs="${multidirs}"
  272. multidirs=""
  273. for x in ${old_multidirs}; do
  274. case "$x" in
  275. *le* ) : ;;
  276. *be* ) : ;;
  277. *) multidirs="${multidirs} ${x}" ;;
  278. esac
  279. done
  280. fi
  281. if [ x"$enable_nofmult" = xno ]
  282. then
  283. old_multidirs="${multidirs}"
  284. multidirs=""
  285. for x in ${old_multidirs}; do
  286. case "$x" in
  287. *nofmult* ) : ;;
  288. *) multidirs="${multidirs} ${x}" ;;
  289. esac
  290. done
  291. fi
  292. ;;
  293. m68*-*-*)
  294. if [ x$enable_softfloat = xno ]
  295. then
  296. old_multidirs="${multidirs}"
  297. multidirs=""
  298. for x in ${old_multidirs}; do
  299. case "$x" in
  300. *soft-float* ) : ;;
  301. *) multidirs="${multidirs} ${x}" ;;
  302. esac
  303. done
  304. fi
  305. if [ x$enable_m68881 = xno ]
  306. then
  307. old_multidirs="${multidirs}"
  308. multidirs=""
  309. for x in ${old_multidirs}; do
  310. case "$x" in
  311. *m68881* ) : ;;
  312. *) multidirs="${multidirs} ${x}" ;;
  313. esac
  314. done
  315. fi
  316. if [ x$enable_m68000 = xno ]
  317. then
  318. old_multidirs="${multidirs}"
  319. multidirs=""
  320. for x in ${old_multidirs}; do
  321. case "$x" in
  322. *m68000* ) : ;;
  323. *) multidirs="${multidirs} ${x}" ;;
  324. esac
  325. done
  326. fi
  327. if [ x$enable_m68020 = xno ]
  328. then
  329. old_multidirs="${multidirs}"
  330. multidirs=""
  331. for x in ${old_multidirs}; do
  332. case "$x" in
  333. *m68020* ) : ;;
  334. *) multidirs="${multidirs} ${x}" ;;
  335. esac
  336. done
  337. fi
  338. ;;
  339. mips*-*-*)
  340. if [ x$enable_single_float = xno ]
  341. then
  342. old_multidirs="${multidirs}"
  343. multidirs=""
  344. for x in ${old_multidirs}; do
  345. case "$x" in
  346. *single* ) : ;;
  347. *) multidirs="${multidirs} ${x}" ;;
  348. esac
  349. done
  350. fi
  351. if [ x$enable_biendian = xno ]
  352. then
  353. old_multidirs="${multidirs}"
  354. multidirs=""
  355. for x in ${old_multidirs}; do
  356. case "$x" in
  357. *el* ) : ;;
  358. *eb* ) : ;;
  359. *) multidirs="${multidirs} ${x}" ;;
  360. esac
  361. done
  362. fi
  363. if [ x$enable_softfloat = xno ]
  364. then
  365. old_multidirs="${multidirs}"
  366. multidirs=""
  367. for x in ${old_multidirs}; do
  368. case "$x" in
  369. *soft-float* ) : ;;
  370. *) multidirs="${multidirs} ${x}" ;;
  371. esac
  372. done
  373. fi
  374. ;;
  375. powerpc*-*-* | rs6000*-*-*)
  376. if [ x$enable_aix64 = xno ]
  377. then
  378. old_multidirs="${multidirs}"
  379. multidirs=""
  380. for x in ${old_multidirs}; do
  381. case "$x" in
  382. *ppc64* ) : ;;
  383. *) multidirs="${multidirs} ${x}" ;;
  384. esac
  385. done
  386. fi
  387. if [ x$enable_pthread = xno ]
  388. then
  389. old_multidirs="${multidirs}"
  390. multidirs=""
  391. for x in ${old_multidirs}; do
  392. case "$x" in
  393. *pthread* ) : ;;
  394. *) multidirs="${multidirs} ${x}" ;;
  395. esac
  396. done
  397. fi
  398. if [ x$enable_softfloat = xno ]
  399. then
  400. old_multidirs="${multidirs}"
  401. multidirs=""
  402. for x in ${old_multidirs}; do
  403. case "$x" in
  404. *soft-float* ) : ;;
  405. *) multidirs="${multidirs} ${x}" ;;
  406. esac
  407. done
  408. fi
  409. if [ x$enable_powercpu = xno ]
  410. then
  411. old_multidirs="${multidirs}"
  412. multidirs=""
  413. for x in ${old_multidirs}; do
  414. case "$x" in
  415. power | */power | */power/* ) : ;;
  416. *) multidirs="${multidirs} ${x}" ;;
  417. esac
  418. done
  419. fi
  420. if [ x$enable_powerpccpu = xno ]
  421. then
  422. old_multidirs="${multidirs}"
  423. multidirs=""
  424. for x in ${old_multidirs}; do
  425. case "$x" in
  426. *powerpc* ) : ;;
  427. *) multidirs="${multidirs} ${x}" ;;
  428. esac
  429. done
  430. fi
  431. if [ x$enable_powerpcos = xno ]
  432. then
  433. old_multidirs="${multidirs}"
  434. multidirs=""
  435. for x in ${old_multidirs}; do
  436. case "$x" in
  437. *mcall-linux* | *mcall-solaris* ) : ;;
  438. *) multidirs="${multidirs} ${x}" ;;
  439. esac
  440. done
  441. fi
  442. if [ x$enable_biendian = xno ]
  443. then
  444. old_multidirs="${multidirs}"
  445. multidirs=""
  446. for x in ${old_multidirs}; do
  447. case "$x" in
  448. *mlittle* | *mbig* ) : ;;
  449. *) multidirs="${multidirs} ${x}" ;;
  450. esac
  451. done
  452. fi
  453. if [ x$enable_sysv = xno ]
  454. then
  455. old_multidirs="${multidirs}"
  456. multidirs=""
  457. for x in ${old_multidirs}; do
  458. case "$x" in
  459. *mcall-sysv* ) : ;;
  460. *) multidirs="${multidirs} ${x}" ;;
  461. esac
  462. done
  463. fi
  464. ;;
  465. esac
  466. # Remove extraneous blanks from multidirs.
  467. # Tests like `if [ -n "$multidirs" ]' require it.
  468. multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'`
  469. # Add code to library's top level makefile to handle building the multilib
  470. # subdirs.
  471. cat > Multi.tem <<\EOF
  472. PWD_COMMAND=$${PWDCMD-pwd}
  473. # FIXME: There should be an @-sign in front of the `if'.
  474. # Leave out until this is tested a bit more.
  475. multi-do:
  476. if [ -z "$(MULTIDIRS)" ]; then \
  477. true; \
  478. else \
  479. rootpre=`${PWD_COMMAND}`/; export rootpre; \
  480. srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
  481. lib=`echo "$${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
  482. compiler="$(CC)"; \
  483. for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
  484. dir=`echo $$i | sed -e 's/;.*$$//'`; \
  485. if [ "$${dir}" = "." ]; then \
  486. true; \
  487. else \
  488. if [ -d ../$${dir}/$${lib} ]; then \
  489. flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
  490. if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
  491. CFLAGS="$(CFLAGS) $${flags}" \
  492. CCASFLAGS="$(CCASFLAGS) $${flags}" \
  493. FCFLAGS="$(FCFLAGS) $${flags}" \
  494. FFLAGS="$(FFLAGS) $${flags}" \
  495. ADAFLAGS="$(ADAFLAGS) $${flags}" \
  496. prefix="$(prefix)" \
  497. exec_prefix="$(exec_prefix)" \
  498. GCJFLAGS="$(GCJFLAGS) $${flags}" \
  499. CXXFLAGS="$(CXXFLAGS) $${flags}" \
  500. LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
  501. LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
  502. LDFLAGS="$(LDFLAGS) $${flags}" \
  503. MULTIFLAGS="$${flags}" \
  504. DESTDIR="$(DESTDIR)" \
  505. INSTALL="$(INSTALL)" \
  506. INSTALL_DATA="$(INSTALL_DATA)" \
  507. INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
  508. INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \
  509. $(DO)); then \
  510. true; \
  511. else \
  512. exit 1; \
  513. fi; \
  514. else true; \
  515. fi; \
  516. fi; \
  517. done; \
  518. fi
  519. # FIXME: There should be an @-sign in front of the `if'.
  520. # Leave out until this is tested a bit more.
  521. multi-clean:
  522. if [ -z "$(MULTIDIRS)" ]; then \
  523. true; \
  524. else \
  525. lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
  526. for dir in : $(MULTIDIRS); do \
  527. test $$dir != : || continue; \
  528. EOF
  529. cat >>Multi.tem <<EOF
  530. if [ -f ../\$\${dir}/\$\${lib}/${Makefile} ]; then \\
  531. EOF
  532. cat >>Multi.tem <<\EOF
  533. if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
  534. then true; \
  535. else exit 1; \
  536. fi; \
  537. else true; \
  538. fi; \
  539. done; \
  540. fi
  541. EOF
  542. cat ${Makefile} Multi.tem > Makefile.tem
  543. rm -f ${Makefile} Multi.tem
  544. mv Makefile.tem ${Makefile}
  545. fi # ${ml_toplevel_p} = yes
  546. if [ "${ml_verbose}" = --verbose ]; then
  547. echo "Adding multilib support to ${Makefile} in ${ml_realsrcdir}"
  548. if [ "${ml_toplevel_p}" = yes ]; then
  549. echo "multidirs=${multidirs}"
  550. fi
  551. echo "with_multisubdir=${with_multisubdir}"
  552. fi
  553. if [ "${srcdir}" = "." ]; then
  554. if [ "${with_target_subdir}" != "." ]; then
  555. ml_srcdotdot="../"
  556. else
  557. ml_srcdotdot=""
  558. fi
  559. else
  560. ml_srcdotdot=""
  561. fi
  562. if [ -z "${with_multisubdir}" ]; then
  563. ml_subdir=
  564. ml_builddotdot=
  565. : # ml_srcdotdot= # already set
  566. else
  567. ml_subdir="/${with_multisubdir}"
  568. # The '[^/][^/]*' appears that way to work around a SunOS sed bug.
  569. ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/
  570. if [ "$srcdir" = "." ]; then
  571. ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot}
  572. else
  573. : # ml_srcdotdot= # already set
  574. fi
  575. fi
  576. if [ "${ml_toplevel_p}" = yes ]; then
  577. ml_do='$(MAKE)'
  578. ml_clean='$(MAKE)'
  579. else
  580. ml_do=true
  581. ml_clean=true
  582. fi
  583. # TOP is used by newlib and should not be used elsewhere for this purpose.
  584. # MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty
  585. # when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s.
  586. # FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can
  587. # delete TOP. Newlib may wish to continue to use TOP for its own purposes
  588. # of course.
  589. # MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
  590. # and lists the subdirectories to recurse into.
  591. # MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
  592. # (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
  593. # a leading '/'.
  594. # MULTIDO is used for targets like all, install, and check where
  595. # $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
  596. # MULTICLEAN is used for the *clean targets.
  597. #
  598. # ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are
  599. # currently kept separate because we don't want the *clean targets to require
  600. # the existence of the compiler (which MULTIDO currently requires) and
  601. # therefore we'd have to record the directory options as well as names
  602. # (currently we just record the names and use --print-multi-lib to get the
  603. # options).
  604. sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \
  605. -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \
  606. -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \
  607. -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \
  608. -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \
  609. -e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \
  610. -e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \
  611. ${Makefile} > Makefile.tem
  612. rm -f ${Makefile}
  613. mv Makefile.tem ${Makefile}
  614. # If this is the library's top level, configure each multilib subdir.
  615. # This is done at the end because this is the loop that runs configure
  616. # in each multilib subdir and it seemed reasonable to finish updating the
  617. # Makefile before going on to configure the subdirs.
  618. if [ "${ml_toplevel_p}" = yes ]; then
  619. # We must freshly configure each subdirectory. This bit of code is
  620. # actually partially stolen from the main configure script. FIXME.
  621. if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
  622. if [ "${ml_verbose}" = --verbose ]; then
  623. echo "Running configure in multilib subdirs ${multidirs}"
  624. echo "pwd: `${PWDCMD-pwd}`"
  625. fi
  626. ml_origdir=`${PWDCMD-pwd}`
  627. ml_libdir=`echo "$ml_origdir" | sed -e 's,^.*/,,'`
  628. # cd to top-level-build-dir/${with_target_subdir}
  629. cd ..
  630. for ml_dir in ${multidirs}; do
  631. if [ "${ml_verbose}" = --verbose ]; then
  632. echo "Running configure in multilib subdir ${ml_dir}"
  633. echo "pwd: `${PWDCMD-pwd}`"
  634. fi
  635. if [ -d ${ml_dir} ]; then true; else
  636. # ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
  637. pathcomp=""
  638. for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
  639. pathcomp="$pathcomp$d"
  640. case "$pathcomp" in
  641. -* ) pathcomp=./$pathcomp ;;
  642. esac
  643. if test ! -d "$pathcomp"; then
  644. echo "mkdir $pathcomp" 1>&2
  645. mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
  646. fi
  647. if test ! -d "$pathcomp"; then
  648. exit $lasterr
  649. fi
  650. pathcomp="$pathcomp/"
  651. done
  652. fi
  653. if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
  654. # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
  655. dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
  656. case ${srcdir} in
  657. ".")
  658. echo "Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}"
  659. if [ "${with_target_subdir}" != "." ]; then
  660. ml_unsubdir="../"
  661. else
  662. ml_unsubdir=""
  663. fi
  664. (cd ${ml_dir}/${ml_libdir};
  665. ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
  666. if [ -f ${ml_dir}/${ml_libdir}/${Makefile} ]; then
  667. if [ x"${MAKE}" = x ]; then
  668. (cd ${ml_dir}/${ml_libdir}; make distclean)
  669. else
  670. (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
  671. fi
  672. fi
  673. ml_newsrcdir="."
  674. ml_srcdiroption=
  675. multisrctop=${dotdot}
  676. ;;
  677. *)
  678. case "${srcdir}" in
  679. /* | [A-Za-z]:[\\/]* ) # absolute path
  680. ml_newsrcdir=${srcdir}
  681. ;;
  682. *) # otherwise relative
  683. ml_newsrcdir=${dotdot}${srcdir}
  684. ;;
  685. esac
  686. ml_srcdiroption="-srcdir=${ml_newsrcdir}"
  687. multisrctop=
  688. ;;
  689. esac
  690. case "${progname}" in
  691. /* | [A-Za-z]:[\\/]* ) ml_recprog=${progname} ;;
  692. *) ml_recprog=${dotdot}${progname} ;;
  693. esac
  694. # FIXME: POPDIR=${PWD=`pwd`} doesn't work here.
  695. ML_POPDIR=`${PWDCMD-pwd}`
  696. cd ${ml_dir}/${ml_libdir}
  697. if [ -f ${ml_newsrcdir}/configure ]; then
  698. ml_recprog="${ml_newsrcdir}/configure"
  699. fi
  700. # find compiler flag corresponding to ${ml_dir}
  701. for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
  702. dir=`echo $i | sed -e 's/;.*$//'`
  703. if [ "${dir}" = "${ml_dir}" ]; then
  704. flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
  705. break
  706. fi
  707. done
  708. ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags"'
  709. if [ "${with_target_subdir}" = "." ]; then
  710. CC_=$CC' '
  711. CXX_=$CXX' '
  712. F77_=$F77' '
  713. GCJ_=$GCJ' '
  714. GFORTRAN_=$GFORTRAN' '
  715. else
  716. # Create a regular expression that matches any string as long
  717. # as ML_POPDIR.
  718. popdir_rx=`echo "${ML_POPDIR}" | sed 's,.,.,g'`
  719. CC_=
  720. for arg in ${CC}; do
  721. case $arg in
  722. -[BIL]"${ML_POPDIR}"/*)
  723. CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;;
  724. "${ML_POPDIR}"/*)
  725. CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  726. *)
  727. CC_="${CC_}${arg} " ;;
  728. esac
  729. done
  730. CXX_=
  731. for arg in ${CXX}; do
  732. case $arg in
  733. -[BIL]"${ML_POPDIR}"/*)
  734. CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  735. "${ML_POPDIR}"/*)
  736. CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  737. *)
  738. CXX_="${CXX_}${arg} " ;;
  739. esac
  740. done
  741. F77_=
  742. for arg in ${F77}; do
  743. case $arg in
  744. -[BIL]"${ML_POPDIR}"/*)
  745. F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  746. "${ML_POPDIR}"/*)
  747. F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  748. *)
  749. F77_="${F77_}${arg} " ;;
  750. esac
  751. done
  752. GCJ_=
  753. for arg in ${GCJ}; do
  754. case $arg in
  755. -[BIL]"${ML_POPDIR}"/*)
  756. GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  757. "${ML_POPDIR}"/*)
  758. GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  759. *)
  760. GCJ_="${GCJ_}${arg} " ;;
  761. esac
  762. done
  763. GFORTRAN_=
  764. for arg in ${GFORTRAN}; do
  765. case $arg in
  766. -[BIL]"${ML_POPDIR}"/*)
  767. GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  768. "${ML_POPDIR}"/*)
  769. GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
  770. *)
  771. GFORTRAN_="${GFORTRAN_}${arg} " ;;
  772. esac
  773. done
  774. if test "x${LD_LIBRARY_PATH+set}" = xset; then
  775. LD_LIBRARY_PATH_=
  776. for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
  777. case "$arg" in
  778. "${ML_POPDIR}"/*)
  779. arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
  780. ;;
  781. esac
  782. if test "x$LD_LIBRARY_PATH_" != x; then
  783. LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
  784. else
  785. LD_LIBRARY_PATH_=$arg
  786. fi
  787. done
  788. ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
  789. fi
  790. if test "x${SHLIB_PATH+set}" = xset; then
  791. SHLIB_PATH_=
  792. for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
  793. case "$arg" in
  794. "${ML_POPDIR}"/*)
  795. arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`
  796. ;;
  797. esac
  798. if test "x$SHLIB_PATH_" != x; then
  799. SHLIB_PATH_=$SHLIB_PATH_:$arg
  800. else
  801. SHLIB_PATH_=$arg
  802. fi
  803. done
  804. ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
  805. fi
  806. fi
  807. if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
  808. --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
  809. ${ac_configure_args} ${ml_config_env} ${ml_srcdiroption} ; then
  810. true
  811. else
  812. exit 1
  813. fi
  814. cd "${ML_POPDIR}"
  815. done
  816. cd "${ml_origdir}"
  817. fi
  818. fi # ${ml_toplevel_p} = yes
  819. fi # ${enable_multilib} = yes