source: rtems/c/src/config-ml.in @ 7273b6e

4.104.114.84.95
Last change on this file since 7273b6e was efcb89c, checked in by Joel Sherrill <joel.sherrill@…>, on 12/18/01 at 14:12:07

2001-12-18 Ralf Corsepius <corsepiu@…>

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