]> git.ipfire.org Git - thirdparty/gcc.git/blob - config-ml.in
* config-ml.in: Pass ${ml_config_env} to configure calls.
[thirdparty/gcc.git] / config-ml.in
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 # 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
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
34 # in the "post-target" section of configure.in.
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 #
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 # ./
57 # newlib
58 # m68020/
59 # newlib
60 # m68881/
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
93 # Autoconf incoming variables:
94 # srcdir, host, ac_configure_args
95 #
96 # We *could* figure srcdir and host out, but we'd have to do work that
97 # our caller has already done to figure them out and requiring these two
98 # seems reasonable.
99 # Note that `host' in this case is GCC's `target'. Target libraries are
100 # configured for a particular host.
101
102 Makefile=${ac_file-Makefile}
103 ml_config_shell=${CONFIG_SHELL-/bin/sh}
104 ml_realsrcdir=${srcdir}
105
106 # Scan all the arguments and set all the ones we need.
107
108 ml_verbose=--verbose
109 for option in ${ac_configure_args}
110 do
111 # strip single quotes surrounding individual options
112 case $option in
113 \'*\') eval option=$option ;;
114 esac
115
116 case $option in
117 --*) ;;
118 -*) option=-$option ;;
119 esac
120
121 case $option in
122 --*=*)
123 optarg=`echo $option | sed -e 's/^[^=]*=//'`
124 ;;
125 esac
126
127 case $option in
128 --disable-*)
129 enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
130 eval $enableopt=no
131 ;;
132 --enable-*)
133 case "$option" in
134 *=*) ;;
135 *) optarg=yes ;;
136 esac
137 enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
138 eval $enableopt="$optarg"
139 ;;
140 --norecursion | --no-recursion)
141 ml_norecursion=yes
142 ;;
143 --silent | --sil* | --quiet | --q*)
144 ml_verbose=--silent
145 ;;
146 --verbose | --v | --verb*)
147 ml_verbose=--verbose
148 ;;
149 --with-*)
150 case "$option" in
151 *=*) ;;
152 *) optarg=yes ;;
153 esac
154 withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
155 eval $withopt="$optarg"
156 ;;
157 --without-*)
158 withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
159 eval $withopt=no
160 ;;
161 esac
162 done
163
164 # Only do this if --enable-multilib.
165 if [ "${enable_multilib}" = yes ]; then
166
167 # Compute whether this is the library's top level directory
168 # (ie: not a multilib subdirectory, and not a subdirectory like newlib/src).
169 # ${with_multisubdir} tells us we're in the right branch, but we could be
170 # in a subdir of that.
171 # ??? The previous version could void this test by separating the process into
172 # two files: one that only the library's toplevel configure.in ran (to
173 # configure the multilib subdirs), and another that all configure.in's ran to
174 # update the Makefile. It seemed reasonable to collapse all multilib support
175 # into one file, but it does leave us with having to perform this test.
176 ml_toplevel_p=no
177 if [ -z "${with_multisubdir}" ]; then
178 if [ "${srcdir}" = "." ]; then
179 # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
180 # ${with_target_subdir} = "." for native, otherwise target alias.
181 if [ "${with_target_subdir}" = "." ]; then
182 if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
183 ml_toplevel_p=yes
184 fi
185 else
186 if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
187 ml_toplevel_p=yes
188 fi
189 fi
190 else
191 # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
192 if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
193 ml_toplevel_p=yes
194 fi
195 fi
196 fi
197
198 # If this is the library's top level directory, set multidirs to the
199 # multilib subdirs to support. This lives at the top because we need
200 # `multidirs' set right away.
201
202 if [ "${ml_toplevel_p}" = yes ]; then
203
204 multidirs=
205 for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
206 dir=`echo $i | sed -e 's/;.*$//'`
207 if [ "${dir}" = "." ]; then
208 true
209 else
210 if [ -z "${multidirs}" ]; then
211 multidirs="${dir}"
212 else
213 multidirs="${multidirs} ${dir}"
214 fi
215 fi
216 done
217
218 # Target libraries are configured for the host they run on, so we check
219 # $host here, not $target.
220
221 case "${host}" in
222 arc-*-elf*)
223 if [ x$enable_biendian != xyes ]
224 then
225 old_multidirs=${multidirs}
226 multidirs=""
227 for x in ${old_multidirs}; do
228 case "${x}" in
229 *be*) : ;;
230 *) multidirs="${multidirs} ${x}" ;;
231 esac
232 done
233 fi
234 ;;
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 ;;
304 m68*-*-*)
305 if [ x$enable_softfloat = xno ]
306 then
307 old_multidirs="${multidirs}"
308 multidirs=""
309 for x in ${old_multidirs}; do
310 case "$x" in
311 *soft-float* ) : ;;
312 *) multidirs="${multidirs} ${x}" ;;
313 esac
314 done
315 fi
316 if [ x$enable_m68881 = xno ]
317 then
318 old_multidirs="${multidirs}"
319 multidirs=""
320 for x in ${old_multidirs}; do
321 case "$x" in
322 *m68881* ) : ;;
323 *) multidirs="${multidirs} ${x}" ;;
324 esac
325 done
326 fi
327 if [ x$enable_m68000 = xno ]
328 then
329 old_multidirs="${multidirs}"
330 multidirs=""
331 for x in ${old_multidirs}; do
332 case "$x" in
333 *m68000* ) : ;;
334 *) multidirs="${multidirs} ${x}" ;;
335 esac
336 done
337 fi
338 if [ x$enable_m68020 = xno ]
339 then
340 old_multidirs="${multidirs}"
341 multidirs=""
342 for x in ${old_multidirs}; do
343 case "$x" in
344 *m68020* ) : ;;
345 *) multidirs="${multidirs} ${x}" ;;
346 esac
347 done
348 fi
349 ;;
350 mips*-*-*)
351 if [ x$enable_single_float = xno ]
352 then
353 old_multidirs="${multidirs}"
354 multidirs=""
355 for x in ${old_multidirs}; do
356 case "$x" in
357 *single* ) : ;;
358 *) multidirs="${multidirs} ${x}" ;;
359 esac
360 done
361 fi
362 if [ x$enable_biendian = xno ]
363 then
364 old_multidirs="${multidirs}"
365 multidirs=""
366 for x in ${old_multidirs}; do
367 case "$x" in
368 *el* ) : ;;
369 *eb* ) : ;;
370 *) multidirs="${multidirs} ${x}" ;;
371 esac
372 done
373 fi
374 if [ x$enable_softfloat = xno ]
375 then
376 old_multidirs="${multidirs}"
377 multidirs=""
378 for x in ${old_multidirs}; do
379 case "$x" in
380 *soft-float* ) : ;;
381 *) multidirs="${multidirs} ${x}" ;;
382 esac
383 done
384 fi
385 case " $multidirs " in
386 *" mabi=64 "*)
387 # We will not be able to create libraries with -mabi=64 if
388 # we cannot even link a trivial program. It usually
389 # indicates the 64bit libraries are missing.
390 if echo 'main() {}' > conftest.c &&
391 ${CC-gcc} -mabi=64 conftest.c -o conftest; then
392 :
393 else
394 echo Could not link program with -mabi=64, disabling it.
395 old_multidirs="${multidirs}"
396 multidirs=""
397 for x in ${old_multidirs}; do
398 case "$x" in
399 *mabi=64* ) : ;;
400 *) multidirs="${multidirs} ${x}" ;;
401 esac
402 done
403 fi
404 rm -f conftest.c conftest
405 ;;
406 esac
407 ;;
408 powerpc*-*-* | rs6000*-*-*)
409 if [ x$enable_aix64 = xno ]
410 then
411 old_multidirs="${multidirs}"
412 multidirs=""
413 for x in ${old_multidirs}; do
414 case "$x" in
415 *ppc64* ) : ;;
416 *) multidirs="${multidirs} ${x}" ;;
417 esac
418 done
419 fi
420 if [ x$enable_pthread = xno ]
421 then
422 old_multidirs="${multidirs}"
423 multidirs=""
424 for x in ${old_multidirs}; do
425 case "$x" in
426 *pthread* ) : ;;
427 *) multidirs="${multidirs} ${x}" ;;
428 esac
429 done
430 fi
431 if [ x$enable_softfloat = xno ]
432 then
433 old_multidirs="${multidirs}"
434 multidirs=""
435 for x in ${old_multidirs}; do
436 case "$x" in
437 *soft-float* ) : ;;
438 *) multidirs="${multidirs} ${x}" ;;
439 esac
440 done
441 fi
442 if [ x$enable_powercpu = xno ]
443 then
444 old_multidirs="${multidirs}"
445 multidirs=""
446 for x in ${old_multidirs}; do
447 case "$x" in
448 power | */power | */power/* ) : ;;
449 *) multidirs="${multidirs} ${x}" ;;
450 esac
451 done
452 fi
453 if [ x$enable_powerpccpu = xno ]
454 then
455 old_multidirs="${multidirs}"
456 multidirs=""
457 for x in ${old_multidirs}; do
458 case "$x" in
459 *powerpc* ) : ;;
460 *) multidirs="${multidirs} ${x}" ;;
461 esac
462 done
463 fi
464 if [ x$enable_powerpcos = xno ]
465 then
466 old_multidirs="${multidirs}"
467 multidirs=""
468 for x in ${old_multidirs}; do
469 case "$x" in
470 *mcall-linux* | *mcall-solaris* ) : ;;
471 *) multidirs="${multidirs} ${x}" ;;
472 esac
473 done
474 fi
475 if [ x$enable_biendian = xno ]
476 then
477 old_multidirs="${multidirs}"
478 multidirs=""
479 for x in ${old_multidirs}; do
480 case "$x" in
481 *mlittle* | *mbig* ) : ;;
482 *) multidirs="${multidirs} ${x}" ;;
483 esac
484 done
485 fi
486 if [ x$enable_sysv = xno ]
487 then
488 old_multidirs="${multidirs}"
489 multidirs=""
490 for x in ${old_multidirs}; do
491 case "$x" in
492 *mcall-sysv* ) : ;;
493 *) multidirs="${multidirs} ${x}" ;;
494 esac
495 done
496 fi
497 ;;
498 sparc*-*-*)
499 case " $multidirs " in
500 *" m64 "*)
501 # We will not be able to create libraries with -m64 if
502 # we cannot even link a trivial program. It usually
503 # indicates the 64bit libraries are missing.
504 if echo 'main() {}' > conftest.c &&
505 ${CC-gcc} -m64 conftest.c -o conftest; then
506 :
507 else
508 echo Could not link program with -m64, disabling it.
509 old_multidirs="${multidirs}"
510 multidirs=""
511 for x in ${old_multidirs}; do
512 case "$x" in
513 *m64* ) : ;;
514 *) multidirs="${multidirs} ${x}" ;;
515 esac
516 done
517 fi
518 rm -f conftest.c conftest
519 ;;
520 esac
521 ;;
522 esac
523
524 # Remove extraneous blanks from multidirs.
525 # Tests like `if [ -n "$multidirs" ]' require it.
526 multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'`
527
528 # Add code to library's top level makefile to handle building the multilib
529 # subdirs.
530
531 cat > Multi.tem <<\EOF
532
533 PWD_COMMAND=$${PWDCMD-pwd}
534
535 # FIXME: There should be an @-sign in front of the `if'.
536 # Leave out until this is tested a bit more.
537 multi-do:
538 if [ -z "$(MULTIDIRS)" ]; then \
539 true; \
540 else \
541 rootpre=`${PWD_COMMAND}`/; export rootpre; \
542 srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
543 lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
544 compiler="$(CC)"; \
545 for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
546 dir=`echo $$i | sed -e 's/;.*$$//'`; \
547 if [ "$${dir}" = "." ]; then \
548 true; \
549 else \
550 if [ -d ../$${dir}/$${lib} ]; then \
551 flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
552 if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
553 CFLAGS="$(CFLAGS) $${flags}" \
554 CCASFLAGS="$(CCASFLAGS) $${flags}" \
555 FCFLAGS="$(FCFLAGS) $${flags}" \
556 FFLAGS="$(FFLAGS) $${flags}" \
557 ADAFLAGS="$(ADAFLAGS) $${flags}" \
558 prefix="$(prefix)" \
559 exec_prefix="$(exec_prefix)" \
560 GCJFLAGS="$(GCJFLAGS) $${flags}" \
561 CXXFLAGS="$(CXXFLAGS) $${flags}" \
562 LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
563 LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
564 LDFLAGS="$(LDFLAGS) $${flags}" \
565 MULTIFLAGS="$${flags}" \
566 DESTDIR="$(DESTDIR)" \
567 INSTALL="$(INSTALL)" \
568 INSTALL_DATA="$(INSTALL_DATA)" \
569 INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
570 INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \
571 $(DO)); then \
572 true; \
573 else \
574 exit 1; \
575 fi; \
576 else true; \
577 fi; \
578 fi; \
579 done; \
580 fi
581
582 # FIXME: There should be an @-sign in front of the `if'.
583 # Leave out until this is tested a bit more.
584 multi-clean:
585 if [ -z "$(MULTIDIRS)" ]; then \
586 true; \
587 else \
588 lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
589 for dir in Makefile $(MULTIDIRS); do \
590 if [ -f ../$${dir}/$${lib}/Makefile ]; then \
591 if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
592 then true; \
593 else exit 1; \
594 fi; \
595 else true; \
596 fi; \
597 done; \
598 fi
599 EOF
600
601 cat ${Makefile} Multi.tem > Makefile.tem
602 rm -f ${Makefile} Multi.tem
603 mv Makefile.tem ${Makefile}
604
605 fi # ${ml_toplevel_p} = yes
606
607 if [ "${ml_verbose}" = --verbose ]; then
608 echo "Adding multilib support to Makefile in ${ml_realsrcdir}"
609 if [ "${ml_toplevel_p}" = yes ]; then
610 echo "multidirs=${multidirs}"
611 fi
612 echo "with_multisubdir=${with_multisubdir}"
613 fi
614
615 if [ "${srcdir}" = "." ]; then
616 if [ "${with_target_subdir}" != "." ]; then
617 ml_srcdotdot="../"
618 else
619 ml_srcdotdot=""
620 fi
621 else
622 ml_srcdotdot=""
623 fi
624
625 if [ -z "${with_multisubdir}" ]; then
626 ml_subdir=
627 ml_builddotdot=
628 : # ml_srcdotdot= # already set
629 else
630 ml_subdir="/${with_multisubdir}"
631 # The '[^/][^/]*' appears that way to work around a SunOS sed bug.
632 ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/
633 if [ "$srcdir" = "." ]; then
634 ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot}
635 else
636 : # ml_srcdotdot= # already set
637 fi
638 fi
639
640 if [ "${ml_toplevel_p}" = yes ]; then
641 ml_do='$(MAKE)'
642 ml_clean='$(MAKE)'
643 else
644 ml_do=true
645 ml_clean=true
646 fi
647
648 # TOP is used by newlib and should not be used elsewhere for this purpose.
649 # MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty
650 # when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s.
651 # FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can
652 # delete TOP. Newlib may wish to continue to use TOP for its own purposes
653 # of course.
654 # MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
655 # and lists the subdirectories to recurse into.
656 # MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
657 # (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
658 # a leading '/'.
659 # MULTIDO is used for targets like all, install, and check where
660 # $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
661 # MULTICLEAN is used for the *clean targets.
662 #
663 # ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are
664 # currently kept separate because we don't want the *clean targets to require
665 # the existence of the compiler (which MULTIDO currently requires) and
666 # therefore we'd have to record the directory options as well as names
667 # (currently we just record the names and use --print-multi-lib to get the
668 # options).
669
670 sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \
671 -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \
672 -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \
673 -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \
674 -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \
675 -e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \
676 -e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \
677 ${Makefile} > Makefile.tem
678 rm -f ${Makefile}
679 mv Makefile.tem ${Makefile}
680
681 # If this is the library's top level, configure each multilib subdir.
682 # This is done at the end because this is the loop that runs configure
683 # in each multilib subdir and it seemed reasonable to finish updating the
684 # Makefile before going on to configure the subdirs.
685
686 if [ "${ml_toplevel_p}" = yes ]; then
687
688 # We must freshly configure each subdirectory. This bit of code is
689 # actually partially stolen from the main configure script. FIXME.
690
691 if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
692
693 if [ "${ml_verbose}" = --verbose ]; then
694 echo "Running configure in multilib subdirs ${multidirs}"
695 echo "pwd: `${PWDCMD-pwd}`"
696 fi
697
698 ml_origdir=`${PWDCMD-pwd}`
699 ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'`
700 # cd to top-level-build-dir/${with_target_subdir}
701 cd ..
702
703 for ml_dir in ${multidirs}; do
704
705 if [ "${ml_verbose}" = --verbose ]; then
706 echo "Running configure in multilib subdir ${ml_dir}"
707 echo "pwd: `${PWDCMD-pwd}`"
708 fi
709
710 if [ -d ${ml_dir} ]; then true; else
711 # ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
712 pathcomp=""
713 for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
714 pathcomp="$pathcomp$d"
715 case "$pathcomp" in
716 -* ) pathcomp=./$pathcomp ;;
717 esac
718 if test ! -d "$pathcomp"; then
719 echo "mkdir $pathcomp" 1>&2
720 mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
721 fi
722 if test ! -d "$pathcomp"; then
723 exit $lasterr
724 fi
725 pathcomp="$pathcomp/"
726 done
727 fi
728 if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
729
730 # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
731 dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
732
733 case ${srcdir} in
734 ".")
735 echo Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}
736 if [ "${with_target_subdir}" != "." ]; then
737 ml_unsubdir="../"
738 else
739 ml_unsubdir=""
740 fi
741 (cd ${ml_dir}/${ml_libdir};
742 ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
743 if [ -f ${ml_dir}/${ml_libdir}/Makefile ]; then
744 if [ x"${MAKE}" = x ]; then
745 (cd ${ml_dir}/${ml_libdir}; make distclean)
746 else
747 (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
748 fi
749 fi
750 ml_newsrcdir="."
751 ml_srcdiroption=
752 multisrctop=${dotdot}
753 ;;
754 *)
755 case "${srcdir}" in
756 /* | [A-Za-z]:[\\/]* ) # absolute path
757 ml_newsrcdir=${srcdir}
758 ;;
759 *) # otherwise relative
760 ml_newsrcdir=${dotdot}${srcdir}
761 ;;
762 esac
763 ml_srcdiroption="-srcdir=${ml_newsrcdir}"
764 multisrctop=
765 ;;
766 esac
767
768 case "${progname}" in
769 /* | [A-Za-z]:[\\/]* ) ml_recprog=${progname} ;;
770 *) ml_recprog=${dotdot}${progname} ;;
771 esac
772
773 # FIXME: POPDIR=${PWD=`pwd`} doesn't work here.
774 ML_POPDIR=`${PWDCMD-pwd}`
775 cd ${ml_dir}/${ml_libdir}
776
777 if [ -f ${ml_newsrcdir}/configure ]; then
778 ml_recprog="${ml_newsrcdir}/configure"
779 fi
780
781 # find compiler flag corresponding to ${ml_dir}
782 for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
783 dir=`echo $i | sed -e 's/;.*$//'`
784 if [ "${dir}" = "${ml_dir}" ]; then
785 flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
786 break
787 fi
788 done
789 ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags"'
790
791 if [ "${with_target_subdir}" = "." ]; then
792 CC_=$CC' '
793 CXX_=$CXX' '
794 F77_=$F77' '
795 GCJ_=$GCJ' '
796 GFORTRAN_=$GFORTRAN' '
797 else
798 # Create a regular expression that matches any string as long
799 # as ML_POPDIR.
800 popdir_rx=`echo ${ML_POPDIR} | sed 's,.,.,g'`
801 CC_=
802 for arg in ${CC}; do
803 case $arg in
804 -[BIL]"${ML_POPDIR}"/*)
805 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"`' ' ;;
806 "${ML_POPDIR}"/*)
807 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"`' ' ;;
808 *)
809 CC_="${CC_}${arg} " ;;
810 esac
811 done
812
813 CXX_=
814 for arg in ${CXX}; do
815 case $arg in
816 -[BIL]"${ML_POPDIR}"/*)
817 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"`' ' ;;
818 "${ML_POPDIR}"/*)
819 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"`' ' ;;
820 *)
821 CXX_="${CXX_}${arg} " ;;
822 esac
823 done
824
825 F77_=
826 for arg in ${F77}; do
827 case $arg in
828 -[BIL]"${ML_POPDIR}"/*)
829 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"`' ' ;;
830 "${ML_POPDIR}"/*)
831 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"`' ' ;;
832 *)
833 F77_="${F77_}${arg} " ;;
834 esac
835 done
836
837 GCJ_=
838 for arg in ${GCJ}; do
839 case $arg in
840 -[BIL]"${ML_POPDIR}"/*)
841 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"`' ' ;;
842 "${ML_POPDIR}"/*)
843 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"`' ' ;;
844 *)
845 GCJ_="${GCJ_}${arg} " ;;
846 esac
847 done
848
849 GFORTRAN_=
850 for arg in ${GFORTRAN}; do
851 case $arg in
852 -[BIL]"${ML_POPDIR}"/*)
853 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"`' ' ;;
854 "${ML_POPDIR}"/*)
855 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"`' ' ;;
856 *)
857 GFORTRAN_="${GFORTRAN_}${arg} " ;;
858 esac
859 done
860
861 if test "x${LD_LIBRARY_PATH+set}" = xset; then
862 LD_LIBRARY_PATH_=
863 for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
864 case "$arg" in
865 "${ML_POPDIR}"/*)
866 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"`
867 ;;
868 esac
869 if test "x$LD_LIBRARY_PATH_" != x; then
870 LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
871 else
872 LD_LIBRARY_PATH_=$arg
873 fi
874 done
875 ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
876 fi
877
878 if test "x${SHLIB_PATH+set}" = xset; then
879 SHLIB_PATH_=
880 for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
881 case "$arg" in
882 "${ML_POPDIR}"/*)
883 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"`
884 ;;
885 esac
886 if test "x$SHLIB_PATH_" != x; then
887 SHLIB_PATH_=$SHLIB_PATH_:$arg
888 else
889 SHLIB_PATH_=$arg
890 fi
891 done
892 ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
893 fi
894 fi
895
896 if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
897 --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
898 ${ac_configure_args} ${ml_config_env} ${ml_srcdiroption} ; then
899 true
900 else
901 exit 1
902 fi
903
904 cd ${ML_POPDIR}
905
906 done
907
908 cd ${ml_origdir}
909 fi
910
911 fi # ${ml_toplevel_p} = yes
912 fi # ${enable_multilib} = yes