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