2
0

config-ml.in 25 KB

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