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