133965Sjdp# Configure fragment invoked in the post-target section for subdirs
233965Sjdp# wanting multilib support.
333965Sjdp#
4218822Sdim# Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
5130561Sobrien#   Free Software Foundation, Inc.
6130561Sobrien#
7130561Sobrien# This file is free software; you can redistribute it and/or modify
8130561Sobrien# it under the terms of the GNU General Public License as published by
9130561Sobrien# the Free Software Foundation; either version 2 of the License, or
10130561Sobrien# (at your option) any later version.
11130561Sobrien#
12130561Sobrien# This program is distributed in the hope that it will be useful,
13130561Sobrien# but WITHOUT ANY WARRANTY; without even the implied warranty of
14130561Sobrien# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15130561Sobrien# GNU General Public License for more details.
16130561Sobrien#
17130561Sobrien# You should have received a copy of the GNU General Public License
18130561Sobrien# along with this program; if not, write to the Free Software
19218822Sdim# Foundation, Inc., 51 Franklin Street, Fifth Floor,
20218822Sdim# Boston, MA 02110-1301, USA.
21130561Sobrien#
22130561Sobrien# As a special exception to the GNU General Public License, if you
23130561Sobrien# distribute this file as part of a program that contains a
24130561Sobrien# configuration script generated by Autoconf, you may include it under
25130561Sobrien# the same distribution terms that you use for the rest of that program.
26130561Sobrien#
27130561Sobrien# Please report bugs to <gcc-bugs@gnu.org>
28130561Sobrien# and send patches to <gcc-patches@gnu.org>.
29130561Sobrien
3033965Sjdp# It is advisable to support a few --enable/--disable options to let the
3133965Sjdp# user select which libraries s/he really wants.
3233965Sjdp#
3333965Sjdp# Subdirectories wishing to use multilib should put the following lines
3433965Sjdp# in the "post-target" section of configure.in.
3533965Sjdp#
3633965Sjdp# if [ "${srcdir}" = "." ] ; then
3733965Sjdp#   if [ "${with_target_subdir}" != "." ] ; then
3833965Sjdp#     . ${with_multisrctop}../../config-ml.in
3933965Sjdp#   else
4033965Sjdp#     . ${with_multisrctop}../config-ml.in
4133965Sjdp#   fi
4233965Sjdp# else
4333965Sjdp#   . ${srcdir}/../config-ml.in
4433965Sjdp# fi
4533965Sjdp#
4633965Sjdp#
4733965Sjdp# Things are complicated because 6 separate cases must be handled:
4833965Sjdp# 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
4933965Sjdp#
5033965Sjdp# srcdir=. is special.  It must handle make programs that don't handle VPATH.
5133965Sjdp# To implement this, a symlink tree is built for each library and for each
5233965Sjdp# multilib subdir.
5333965Sjdp#
5433965Sjdp# The build tree is layed out as
5533965Sjdp#
5633965Sjdp# ./
5733965Sjdp#   newlib
5833965Sjdp#   m68020/
5933965Sjdp#          newlib
6033965Sjdp#          m68881/
6133965Sjdp#                 newlib
6233965Sjdp#
6333965Sjdp# The nice feature about this arrangement is that inter-library references
6433965Sjdp# in the build tree work without having to care where you are.  Note that
6533965Sjdp# inter-library references also work in the source tree because symlink trees
6633965Sjdp# are built when srcdir=.
6733965Sjdp#
6833965Sjdp# Unfortunately, trying to access the libraries in the build tree requires
6933965Sjdp# the user to manually choose which library to use as GCC won't be able to
7033965Sjdp# find the right one.  This is viewed as the lesser of two evils.
7133965Sjdp#
7233965Sjdp# Configure variables:
7333965Sjdp# ${with_target_subdir} = "." for native, or ${target_alias} for cross.
7433965Sjdp# Set by top level Makefile.
7533965Sjdp# ${with_multisrctop} = how many levels of multilibs there are in the source
7633965Sjdp# tree.  It exists to handle the case of configuring in the source tree:
7733965Sjdp# ${srcdir} is not constant.
7833965Sjdp# ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
7933965Sjdp#
8033965Sjdp# Makefile variables:
8133965Sjdp# MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
8233965Sjdp# (FIXME: note that this is different than ${with_multisrctop}.  Check out.).
8333965Sjdp# MULTIBUILDTOP = number of multilib levels in build tree
8433965Sjdp# MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
8533965Sjdp# (only defined in each library's main Makefile).
8633965Sjdp# MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000)
8733965Sjdp# (only defined in each multilib subdir).
8833965Sjdp
8933965Sjdp# FIXME: Multilib is currently disabled by default for everything other than
9033965Sjdp# newlib.  It is up to each target to turn on multilib support for the other
9133965Sjdp# libraries as desired.
9233965Sjdp
9333965Sjdp# Autoconf incoming variables:
9460484Sobrien# srcdir, host, ac_configure_args
9533965Sjdp#
9660484Sobrien# We *could* figure srcdir and host out, but we'd have to do work that
9733965Sjdp# our caller has already done to figure them out and requiring these two
9833965Sjdp# seems reasonable.
9960484Sobrien# Note that `host' in this case is GCC's `target'.  Target libraries are
10060484Sobrien# configured for a particular host.
10133965Sjdp
102130561SobrienMakefile=${ac_file-Makefile}
103130561Sobrienml_config_shell=${CONFIG_SHELL-/bin/sh}
104130561Sobrienml_realsrcdir=${srcdir}
10533965Sjdp
10633965Sjdp# Scan all the arguments and set all the ones we need.
10733965Sjdp
10860484Sobrienml_verbose=--verbose
109130561Sobrienfor option in ${ac_configure_args}
11033965Sjdpdo
111218822Sdim  # strip single quotes surrounding individual options
11233965Sjdp  case $option in
113218822Sdim  \'*\') eval option=$option ;;
114218822Sdim  esac
115218822Sdim
116218822Sdim  case $option in
11733965Sjdp  --*) ;;
11833965Sjdp  -*) option=-$option ;;
11933965Sjdp  esac
12033965Sjdp
12133965Sjdp  case $option in
12233965Sjdp  --*=*)
12333965Sjdp	optarg=`echo $option | sed -e 's/^[^=]*=//'`
12433965Sjdp	;;
12533965Sjdp  esac
12633965Sjdp
12733965Sjdp  case $option in
12833965Sjdp  --disable-*)
12933965Sjdp	enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
13033965Sjdp	eval $enableopt=no
13133965Sjdp	;;
13233965Sjdp  --enable-*)
13333965Sjdp	case "$option" in
13433965Sjdp	*=*)	;;
13533965Sjdp	*)	optarg=yes ;;
13633965Sjdp	esac
13733965Sjdp	enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
13833965Sjdp	eval $enableopt="$optarg"
13933965Sjdp	;;
140130561Sobrien  --norecursion | --no-recursion)
14133965Sjdp	ml_norecursion=yes
14233965Sjdp	;;
14360484Sobrien  --silent | --sil* | --quiet | --q*)
14460484Sobrien	ml_verbose=--silent
14560484Sobrien	;;
14633965Sjdp  --verbose | --v | --verb*)
14733965Sjdp	ml_verbose=--verbose
14833965Sjdp	;;
14933965Sjdp  --with-*)
15033965Sjdp	case "$option" in
15133965Sjdp	*=*)	;;
15233965Sjdp	*)	optarg=yes ;;
15333965Sjdp	esac
15433965Sjdp	withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
15533965Sjdp	eval $withopt="$optarg"
15633965Sjdp	;;
15733965Sjdp  --without-*)
15833965Sjdp	withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
15933965Sjdp	eval $withopt=no
16033965Sjdp	;;
16133965Sjdp  esac
16233965Sjdpdone
16333965Sjdp
16433965Sjdp# Only do this if --enable-multilib.
16533965Sjdpif [ "${enable_multilib}" = yes ]; then
16633965Sjdp
16733965Sjdp# Compute whether this is the library's top level directory
168130561Sobrien# (ie: not a multilib subdirectory, and not a subdirectory like newlib/src).
16933965Sjdp# ${with_multisubdir} tells us we're in the right branch, but we could be
17033965Sjdp# in a subdir of that.
17133965Sjdp# ??? The previous version could void this test by separating the process into
17233965Sjdp# two files: one that only the library's toplevel configure.in ran (to
17333965Sjdp# configure the multilib subdirs), and another that all configure.in's ran to
17433965Sjdp# update the Makefile.  It seemed reasonable to collapse all multilib support
17533965Sjdp# into one file, but it does leave us with having to perform this test.
17633965Sjdpml_toplevel_p=no
17733965Sjdpif [ -z "${with_multisubdir}" ]; then
17833965Sjdp  if [ "${srcdir}" = "." ]; then
17933965Sjdp    # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
18033965Sjdp    # ${with_target_subdir} = "." for native, otherwise target alias.
18133965Sjdp    if [ "${with_target_subdir}" = "." ]; then
18233965Sjdp      if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
18333965Sjdp	ml_toplevel_p=yes
18433965Sjdp      fi
18533965Sjdp    else
18633965Sjdp      if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
18733965Sjdp	ml_toplevel_p=yes
18833965Sjdp      fi
18933965Sjdp    fi
19033965Sjdp  else
19133965Sjdp    # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
19233965Sjdp    if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
19333965Sjdp      ml_toplevel_p=yes
19433965Sjdp    fi
19533965Sjdp  fi
19633965Sjdpfi
19733965Sjdp
19833965Sjdp# If this is the library's top level directory, set multidirs to the
19933965Sjdp# multilib subdirs to support.  This lives at the top because we need
20033965Sjdp# `multidirs' set right away.
20133965Sjdp
20233965Sjdpif [ "${ml_toplevel_p}" = yes ]; then
20333965Sjdp
20433965Sjdpmultidirs=
20533965Sjdpfor i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
20633965Sjdp  dir=`echo $i | sed -e 's/;.*$//'`
20733965Sjdp  if [ "${dir}" = "." ]; then
20833965Sjdp    true
20933965Sjdp  else
21033965Sjdp    if [ -z "${multidirs}" ]; then
21133965Sjdp      multidirs="${dir}"
21233965Sjdp    else
21333965Sjdp      multidirs="${multidirs} ${dir}"
21433965Sjdp    fi
21533965Sjdp  fi
21633965Sjdpdone
21733965Sjdp
21860484Sobrien# Target libraries are configured for the host they run on, so we check
21960484Sobrien# $host here, not $target.
22060484Sobrien
22160484Sobriencase "${host}" in
22238889Sjdparc-*-elf*)
22338889Sjdp	if [ x$enable_biendian != xyes ]
22438889Sjdp	then
22538889Sjdp	  old_multidirs=${multidirs}
22638889Sjdp	  multidirs=""
22738889Sjdp	  for x in ${old_multidirs}; do
22838889Sjdp	    case "${x}" in
22938889Sjdp	      *be*) : ;;
23038889Sjdp	      *) multidirs="${multidirs} ${x}" ;;
23138889Sjdp	    esac
23238889Sjdp	  done
23338889Sjdp	fi
23438889Sjdp	;;
23560484Sobrienarm-*-*)
23660484Sobrien	if [ x"$enable_fpu" = xno ]
23760484Sobrien	then
23860484Sobrien	  old_multidirs=${multidirs}
23960484Sobrien	  multidirs=""
24060484Sobrien	  for x in ${old_multidirs}; do
24160484Sobrien	    case "${x}" in
24260484Sobrien	      *fpu*) : ;;
24360484Sobrien	      *) multidirs="${multidirs} ${x}" ;;
24460484Sobrien	    esac
24560484Sobrien	  done
24660484Sobrien	fi
24760484Sobrien	if [ x"$enable_26bit" = xno ]
24860484Sobrien	then
24960484Sobrien	  old_multidirs=${multidirs}
25060484Sobrien	  multidirs=""
25160484Sobrien	  for x in ${old_multidirs}; do
25260484Sobrien	    case "${x}" in
25360484Sobrien	      *26bit*) : ;;
25460484Sobrien	      *) multidirs="${multidirs} ${x}" ;;
25560484Sobrien	    esac
25660484Sobrien	  done
25760484Sobrien	fi
25860484Sobrien	if [ x"$enable_underscore" = xno ]
25960484Sobrien	then
26060484Sobrien	  old_multidirs=${multidirs}
26160484Sobrien	  multidirs=""
26260484Sobrien	  for x in ${old_multidirs}; do
26360484Sobrien	    case "${x}" in
26460484Sobrien	      *under*) : ;;
26560484Sobrien	      *) multidirs="${multidirs} ${x}" ;;
26660484Sobrien	    esac
26760484Sobrien	  done
26860484Sobrien	fi
26960484Sobrien	if [ x"$enable_interwork" = xno ]
27060484Sobrien	then
27160484Sobrien	  old_multidirs=${multidirs}
27260484Sobrien	  multidirs=""
27360484Sobrien	  for x in ${old_multidirs}; do
27460484Sobrien	    case "${x}" in
27560484Sobrien	      *interwork*) : ;;
27660484Sobrien	      *) multidirs="${multidirs} ${x}" ;;
27760484Sobrien	    esac
27860484Sobrien	  done
27960484Sobrien	fi
28060484Sobrien	if [ x$enable_biendian = xno ]
28160484Sobrien	then
28260484Sobrien	  old_multidirs="${multidirs}"
28360484Sobrien	  multidirs=""
28460484Sobrien	  for x in ${old_multidirs}; do
28560484Sobrien	    case "$x" in
28660484Sobrien	      *le* ) : ;;
28760484Sobrien	      *be* ) : ;;
28860484Sobrien	      *) multidirs="${multidirs} ${x}" ;;
28960484Sobrien	    esac
29060484Sobrien	  done
29160484Sobrien	fi
29277298Sobrien	if [ x"$enable_nofmult" = xno ]
29377298Sobrien	then
29477298Sobrien	  old_multidirs="${multidirs}"
29577298Sobrien	  multidirs=""
29677298Sobrien	  for x in ${old_multidirs}; do
29777298Sobrien	    case "$x" in
29877298Sobrien	      *nofmult* ) : ;;
29977298Sobrien	      *) multidirs="${multidirs} ${x}" ;;
30077298Sobrien	    esac
30177298Sobrien	  done
30277298Sobrien	fi
30360484Sobrien	;;
30433965Sjdpm68*-*-*)
30533965Sjdp	if [ x$enable_softfloat = xno ]
30633965Sjdp	then
30733965Sjdp	  old_multidirs="${multidirs}"
30833965Sjdp	  multidirs=""
30933965Sjdp	  for x in ${old_multidirs}; do
31033965Sjdp	    case "$x" in
31133965Sjdp	      *soft-float* ) : ;;
31233965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
31333965Sjdp	    esac
31433965Sjdp	  done
31533965Sjdp	fi
31633965Sjdp	if [ x$enable_m68881 = xno ]
31733965Sjdp	then
31833965Sjdp	  old_multidirs="${multidirs}"
31933965Sjdp	  multidirs=""
32033965Sjdp	  for x in ${old_multidirs}; do
32133965Sjdp	    case "$x" in
32233965Sjdp	      *m68881* ) : ;;
32333965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
32433965Sjdp	    esac
32533965Sjdp	  done
32633965Sjdp	fi
32733965Sjdp	if [ x$enable_m68000 = xno ]
32833965Sjdp	then
32933965Sjdp	  old_multidirs="${multidirs}"
33033965Sjdp	  multidirs=""
33133965Sjdp	  for x in ${old_multidirs}; do
33233965Sjdp	    case "$x" in
33333965Sjdp	      *m68000* ) : ;;
33433965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
33533965Sjdp	    esac
33633965Sjdp	  done
33733965Sjdp	fi
33833965Sjdp	if [ x$enable_m68020 = xno ]
33933965Sjdp	then
34033965Sjdp	  old_multidirs="${multidirs}"
34133965Sjdp	  multidirs=""
34233965Sjdp	  for x in ${old_multidirs}; do
34333965Sjdp	    case "$x" in
34433965Sjdp	      *m68020* ) : ;;
34533965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
34633965Sjdp	    esac
34733965Sjdp	  done
34833965Sjdp	fi
34933965Sjdp	;;
35033965Sjdpmips*-*-*)
35133965Sjdp	if [ x$enable_single_float = xno ]
35233965Sjdp	then
35333965Sjdp	  old_multidirs="${multidirs}"
35433965Sjdp	  multidirs=""
35533965Sjdp	  for x in ${old_multidirs}; do
35633965Sjdp	    case "$x" in
35733965Sjdp	      *single* ) : ;;
35833965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
35933965Sjdp	    esac
36033965Sjdp	  done
36133965Sjdp	fi
36233965Sjdp	if [ x$enable_biendian = xno ]
36333965Sjdp	then
36433965Sjdp	  old_multidirs="${multidirs}"
36533965Sjdp	  multidirs=""
36633965Sjdp	  for x in ${old_multidirs}; do
36733965Sjdp	    case "$x" in
36833965Sjdp	      *el* ) : ;;
36933965Sjdp	      *eb* ) : ;;
37033965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
37133965Sjdp	    esac
37233965Sjdp	  done
37333965Sjdp	fi
37433965Sjdp	if [ x$enable_softfloat = xno ]
37533965Sjdp	then
37633965Sjdp	  old_multidirs="${multidirs}"
37733965Sjdp	  multidirs=""
37833965Sjdp	  for x in ${old_multidirs}; do
37933965Sjdp	    case "$x" in
38033965Sjdp	      *soft-float* ) : ;;
38133965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
38233965Sjdp	    esac
38333965Sjdp	  done
38433965Sjdp	fi
38577298Sobrien	case " $multidirs " in
38677298Sobrien	*" mabi=64 "*)
38777298Sobrien	  # We will not be able to create libraries with -mabi=64 if
38877298Sobrien	  # we cannot even link a trivial program.  It usually
38977298Sobrien	  # indicates the 64bit libraries are missing.
39077298Sobrien	  if echo 'main() {}' > conftest.c &&
39177298Sobrien	     ${CC-gcc} -mabi=64 conftest.c -o conftest; then
39277298Sobrien	    :
39377298Sobrien	  else
39477298Sobrien	    echo Could not link program with -mabi=64, disabling it.
39577298Sobrien	    old_multidirs="${multidirs}"
39677298Sobrien	    multidirs=""
39777298Sobrien	    for x in ${old_multidirs}; do
39877298Sobrien	      case "$x" in
39977298Sobrien	      *mabi=64* ) : ;;
40077298Sobrien	      *) multidirs="${multidirs} ${x}" ;;
40177298Sobrien	      esac
40277298Sobrien	    done
40377298Sobrien	  fi
40477298Sobrien	  rm -f conftest.c conftest
40577298Sobrien	  ;;
40677298Sobrien	esac
40733965Sjdp	;;
40833965Sjdppowerpc*-*-* | rs6000*-*-*)
409130561Sobrien	if [ x$enable_aix64 = xno ]
410130561Sobrien	then
411130561Sobrien	  old_multidirs="${multidirs}"
412130561Sobrien	  multidirs=""
413130561Sobrien	  for x in ${old_multidirs}; do
414130561Sobrien	    case "$x" in
415130561Sobrien	      *ppc64* ) : ;;
416130561Sobrien	      *) multidirs="${multidirs} ${x}" ;;
417130561Sobrien	    esac
418130561Sobrien	  done
419130561Sobrien	fi
420130561Sobrien	if [ x$enable_pthread = xno ]
421130561Sobrien	then
422130561Sobrien	  old_multidirs="${multidirs}"
423130561Sobrien	  multidirs=""
424130561Sobrien	  for x in ${old_multidirs}; do
425130561Sobrien	    case "$x" in
426130561Sobrien	      *pthread* ) : ;;
427130561Sobrien	      *) multidirs="${multidirs} ${x}" ;;
428130561Sobrien	    esac
429130561Sobrien	  done
430130561Sobrien	fi
43133965Sjdp	if [ x$enable_softfloat = xno ]
43233965Sjdp	then
43333965Sjdp	  old_multidirs="${multidirs}"
43433965Sjdp	  multidirs=""
43533965Sjdp	  for x in ${old_multidirs}; do
43633965Sjdp	    case "$x" in
43733965Sjdp	      *soft-float* ) : ;;
43833965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
43933965Sjdp	    esac
44033965Sjdp	  done
44133965Sjdp	fi
44233965Sjdp	if [ x$enable_powercpu = xno ]
44333965Sjdp	then
44433965Sjdp	  old_multidirs="${multidirs}"
44533965Sjdp	  multidirs=""
44633965Sjdp	  for x in ${old_multidirs}; do
44733965Sjdp	    case "$x" in
44833965Sjdp	      power | */power | */power/* ) : ;;
44933965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
45033965Sjdp	    esac
45133965Sjdp	  done
45233965Sjdp	fi
45333965Sjdp	if [ x$enable_powerpccpu = xno ]
45433965Sjdp	then
45533965Sjdp	  old_multidirs="${multidirs}"
45633965Sjdp	  multidirs=""
45733965Sjdp	  for x in ${old_multidirs}; do
45833965Sjdp	    case "$x" in
45933965Sjdp	      *powerpc* ) : ;;
46033965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
46133965Sjdp	    esac
46233965Sjdp	  done
46333965Sjdp	fi
46438889Sjdp	if [ x$enable_powerpcos = xno ]
46533965Sjdp	then
46633965Sjdp	  old_multidirs="${multidirs}"
46733965Sjdp	  multidirs=""
46833965Sjdp	  for x in ${old_multidirs}; do
46933965Sjdp	    case "$x" in
47038889Sjdp	      *mcall-linux* | *mcall-solaris* ) : ;;
47133965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
47233965Sjdp	    esac
47333965Sjdp	  done
47433965Sjdp	fi
47533965Sjdp	if [ x$enable_biendian = xno ]
47633965Sjdp	then
47733965Sjdp	  old_multidirs="${multidirs}"
47833965Sjdp	  multidirs=""
47933965Sjdp	  for x in ${old_multidirs}; do
48033965Sjdp	    case "$x" in
48138889Sjdp	      *mlittle* | *mbig* ) : ;;
48233965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
48333965Sjdp	    esac
48433965Sjdp	  done
48533965Sjdp	fi
48633965Sjdp	if [ x$enable_sysv = xno ]
48733965Sjdp	then
48833965Sjdp	  old_multidirs="${multidirs}"
48933965Sjdp	  multidirs=""
49033965Sjdp	  for x in ${old_multidirs}; do
49133965Sjdp	    case "$x" in
49238889Sjdp	      *mcall-sysv* ) : ;;
49333965Sjdp	      *) multidirs="${multidirs} ${x}" ;;
49433965Sjdp	    esac
49533965Sjdp	  done
49633965Sjdp	fi
49733965Sjdp	;;
49877298Sobriensparc*-*-*)
49977298Sobrien	case " $multidirs " in
50077298Sobrien	*" m64 "*)
50177298Sobrien	  # We will not be able to create libraries with -m64 if
50277298Sobrien	  # we cannot even link a trivial program.  It usually
50377298Sobrien	  # indicates the 64bit libraries are missing.
50477298Sobrien	  if echo 'main() {}' > conftest.c &&
50577298Sobrien	     ${CC-gcc} -m64 conftest.c -o conftest; then
50677298Sobrien	    :
50777298Sobrien	  else
50877298Sobrien	    echo Could not link program with -m64, disabling it.
50977298Sobrien	    old_multidirs="${multidirs}"
51077298Sobrien	    multidirs=""
51177298Sobrien	    for x in ${old_multidirs}; do
51277298Sobrien	      case "$x" in
51377298Sobrien	      *m64* ) : ;;
51477298Sobrien	      *) multidirs="${multidirs} ${x}" ;;
51577298Sobrien	      esac
51677298Sobrien	    done
51777298Sobrien	  fi
51877298Sobrien	  rm -f conftest.c conftest
51977298Sobrien	  ;;
52077298Sobrien	esac
52177298Sobrien	;;
52233965Sjdpesac
52333965Sjdp
52433965Sjdp# Remove extraneous blanks from multidirs.
52533965Sjdp# Tests like `if [ -n "$multidirs" ]' require it.
52633965Sjdpmultidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'`
52733965Sjdp
52833965Sjdp# Add code to library's top level makefile to handle building the multilib
52933965Sjdp# subdirs.
53033965Sjdp
53133965Sjdpcat > Multi.tem <<\EOF
53233965Sjdp
533130561SobrienPWD_COMMAND=$${PWDCMD-pwd}
534104834Sobrien
53533965Sjdp# FIXME: There should be an @-sign in front of the `if'.
53633965Sjdp# Leave out until this is tested a bit more.
53733965Sjdpmulti-do:
53833965Sjdp	if [ -z "$(MULTIDIRS)" ]; then \
53933965Sjdp	  true; \
54033965Sjdp	else \
541130561Sobrien	  rootpre=`${PWD_COMMAND}`/; export rootpre; \
542130561Sobrien	  srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
54333965Sjdp	  lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
54433965Sjdp	  compiler="$(CC)"; \
54533965Sjdp	  for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
54633965Sjdp	    dir=`echo $$i | sed -e 's/;.*$$//'`; \
54733965Sjdp	    if [ "$${dir}" = "." ]; then \
54833965Sjdp	      true; \
54933965Sjdp	    else \
55033965Sjdp	      if [ -d ../$${dir}/$${lib} ]; then \
55133965Sjdp		flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
55233965Sjdp		if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
55333965Sjdp				CFLAGS="$(CFLAGS) $${flags}" \
554218822Sdim				CCASFLAGS="$(CCASFLAGS) $${flags}" \
555218822Sdim				FCFLAGS="$(FCFLAGS) $${flags}" \
556218822Sdim				FFLAGS="$(FFLAGS) $${flags}" \
557218822Sdim				ADAFLAGS="$(ADAFLAGS) $${flags}" \
55877298Sobrien				prefix="$(prefix)" \
55977298Sobrien				exec_prefix="$(exec_prefix)" \
560130561Sobrien				GCJFLAGS="$(GCJFLAGS) $${flags}" \
56133965Sjdp				CXXFLAGS="$(CXXFLAGS) $${flags}" \
56233965Sjdp				LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
56333965Sjdp				LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
56438889Sjdp				LDFLAGS="$(LDFLAGS) $${flags}" \
565130561Sobrien				MULTIFLAGS="$${flags}" \
566104834Sobrien				DESTDIR="$(DESTDIR)" \
567130561Sobrien				INSTALL="$(INSTALL)" \
568130561Sobrien				INSTALL_DATA="$(INSTALL_DATA)" \
569130561Sobrien				INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
570130561Sobrien				INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \
57133965Sjdp				$(DO)); then \
57233965Sjdp		  true; \
57333965Sjdp		else \
57433965Sjdp		  exit 1; \
57533965Sjdp		fi; \
57633965Sjdp	      else true; \
57733965Sjdp	      fi; \
57833965Sjdp	    fi; \
57933965Sjdp	  done; \
58033965Sjdp	fi
58133965Sjdp
58233965Sjdp# FIXME: There should be an @-sign in front of the `if'.
58333965Sjdp# Leave out until this is tested a bit more.
58433965Sjdpmulti-clean:
58533965Sjdp	if [ -z "$(MULTIDIRS)" ]; then \
58633965Sjdp	  true; \
58733965Sjdp	else \
588130561Sobrien	  lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
58933965Sjdp	  for dir in Makefile $(MULTIDIRS); do \
59033965Sjdp	    if [ -f ../$${dir}/$${lib}/Makefile ]; then \
59133965Sjdp	      if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
59233965Sjdp	      then true; \
59333965Sjdp	      else exit 1; \
59433965Sjdp	      fi; \
59533965Sjdp	    else true; \
59633965Sjdp	    fi; \
59733965Sjdp	  done; \
59833965Sjdp	fi
59933965SjdpEOF
60033965Sjdp
60133965Sjdpcat ${Makefile} Multi.tem > Makefile.tem
60233965Sjdprm -f ${Makefile} Multi.tem
60333965Sjdpmv Makefile.tem ${Makefile}
60433965Sjdp
60533965Sjdpfi # ${ml_toplevel_p} = yes
60633965Sjdp
60733965Sjdpif [ "${ml_verbose}" = --verbose ]; then
60833965Sjdp  echo "Adding multilib support to Makefile in ${ml_realsrcdir}"
60933965Sjdp  if [ "${ml_toplevel_p}" = yes ]; then
61033965Sjdp    echo "multidirs=${multidirs}"
61133965Sjdp  fi
61233965Sjdp  echo "with_multisubdir=${with_multisubdir}"
61333965Sjdpfi
61433965Sjdp
61533965Sjdpif [ "${srcdir}" = "." ]; then
61633965Sjdp  if [ "${with_target_subdir}" != "." ]; then
61733965Sjdp    ml_srcdotdot="../"
61833965Sjdp  else
61933965Sjdp    ml_srcdotdot=""
62033965Sjdp  fi
62133965Sjdpelse
62233965Sjdp  ml_srcdotdot=""
62333965Sjdpfi
62433965Sjdp
62533965Sjdpif [ -z "${with_multisubdir}" ]; then
62633965Sjdp  ml_subdir=
62733965Sjdp  ml_builddotdot=
62833965Sjdp  : # ml_srcdotdot= # already set
62933965Sjdpelse
63033965Sjdp  ml_subdir="/${with_multisubdir}"
63133965Sjdp  # The '[^/][^/]*' appears that way to work around a SunOS sed bug.
63233965Sjdp  ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/
63333965Sjdp  if [ "$srcdir" = "." ]; then
63433965Sjdp    ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot}
63533965Sjdp  else
63633965Sjdp    : # ml_srcdotdot= # already set
63733965Sjdp  fi
63833965Sjdpfi
63933965Sjdp
64033965Sjdpif [ "${ml_toplevel_p}" = yes ]; then
64133965Sjdp  ml_do='$(MAKE)'
64233965Sjdp  ml_clean='$(MAKE)'
64333965Sjdpelse
64433965Sjdp  ml_do=true
64533965Sjdp  ml_clean=true
64633965Sjdpfi
64733965Sjdp
64833965Sjdp# TOP is used by newlib and should not be used elsewhere for this purpose.
64933965Sjdp# MULTI{SRC,BUILD}TOP are the proper ones to use.  MULTISRCTOP is empty
65033965Sjdp# when srcdir != builddir.  MULTIBUILDTOP is always some number of ../'s.
65133965Sjdp# FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can
65233965Sjdp# delete TOP.  Newlib may wish to continue to use TOP for its own purposes
65333965Sjdp# of course.
65433965Sjdp# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
65533965Sjdp# and lists the subdirectories to recurse into.
65633965Sjdp# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
65733965Sjdp# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
65833965Sjdp# a leading '/'.
65933965Sjdp# MULTIDO is used for targets like all, install, and check where
66033965Sjdp# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
66133965Sjdp# MULTICLEAN is used for the *clean targets.
66233965Sjdp#
66333965Sjdp# ??? It is possible to merge MULTIDO and MULTICLEAN into one.  They are
66433965Sjdp# currently kept separate because we don't want the *clean targets to require
66533965Sjdp# the existence of the compiler (which MULTIDO currently requires) and
66633965Sjdp# therefore we'd have to record the directory options as well as names
66733965Sjdp# (currently we just record the names and use --print-multi-lib to get the
66833965Sjdp# options).
66933965Sjdp
67033965Sjdpsed -e "s:^TOP[ 	]*=[ 	]*\([./]*\)[ 	]*$:TOP = ${ml_builddotdot}\1:" \
67133965Sjdp    -e "s:^MULTISRCTOP[ 	]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \
67233965Sjdp    -e "s:^MULTIBUILDTOP[ 	]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \
67333965Sjdp    -e "s:^MULTIDIRS[ 	]*=.*$:MULTIDIRS = ${multidirs}:" \
67433965Sjdp    -e "s:^MULTISUBDIR[ 	]*=.*$:MULTISUBDIR = ${ml_subdir}:" \
67533965Sjdp    -e "s:^MULTIDO[ 	]*=.*$:MULTIDO = $ml_do:" \
67633965Sjdp    -e "s:^MULTICLEAN[ 	]*=.*$:MULTICLEAN = $ml_clean:" \
67733965Sjdp	${Makefile} > Makefile.tem
67833965Sjdprm -f ${Makefile}
67933965Sjdpmv Makefile.tem ${Makefile}
68033965Sjdp
68133965Sjdp# If this is the library's top level, configure each multilib subdir.
68233965Sjdp# This is done at the end because this is the loop that runs configure
68333965Sjdp# in each multilib subdir and it seemed reasonable to finish updating the
68433965Sjdp# Makefile before going on to configure the subdirs.
68533965Sjdp
68633965Sjdpif [ "${ml_toplevel_p}" = yes ]; then
68733965Sjdp
68833965Sjdp# We must freshly configure each subdirectory.  This bit of code is
68933965Sjdp# actually partially stolen from the main configure script.  FIXME.
69033965Sjdp
69133965Sjdpif [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
69233965Sjdp
69333965Sjdp  if [ "${ml_verbose}" = --verbose ]; then
69433965Sjdp    echo "Running configure in multilib subdirs ${multidirs}"
695104834Sobrien    echo "pwd: `${PWDCMD-pwd}`"
69633965Sjdp  fi
69733965Sjdp
698104834Sobrien  ml_origdir=`${PWDCMD-pwd}`
69933965Sjdp  ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'`
70033965Sjdp  # cd to top-level-build-dir/${with_target_subdir}
70133965Sjdp  cd ..
70233965Sjdp
70333965Sjdp  for ml_dir in ${multidirs}; do
70433965Sjdp
70533965Sjdp    if [ "${ml_verbose}" = --verbose ]; then
70633965Sjdp      echo "Running configure in multilib subdir ${ml_dir}"
707104834Sobrien      echo "pwd: `${PWDCMD-pwd}`"
70833965Sjdp    fi
70933965Sjdp
71077298Sobrien    if [ -d ${ml_dir} ]; then true; else
71177298Sobrien      # ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
71277298Sobrien      pathcomp=""
71377298Sobrien      for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
71477298Sobrien        pathcomp="$pathcomp$d"
71577298Sobrien        case "$pathcomp" in
71677298Sobrien          -* ) pathcomp=./$pathcomp ;;
71777298Sobrien        esac
71877298Sobrien        if test ! -d "$pathcomp"; then
71977298Sobrien           echo "mkdir $pathcomp" 1>&2
72077298Sobrien           mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
72177298Sobrien        fi
72277298Sobrien        if test ! -d "$pathcomp"; then
72377298Sobrien	   exit $lasterr
72477298Sobrien        fi
72577298Sobrien        pathcomp="$pathcomp/"
72677298Sobrien      done
72777298Sobrien    fi
72833965Sjdp    if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
72933965Sjdp
73033965Sjdp    # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
73133965Sjdp    dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
73233965Sjdp
73333965Sjdp    case ${srcdir} in
73433965Sjdp    ".")
735104834Sobrien      echo Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}
73633965Sjdp      if [ "${with_target_subdir}" != "." ]; then
73733965Sjdp	ml_unsubdir="../"
73833965Sjdp      else
73933965Sjdp	ml_unsubdir=""
74033965Sjdp      fi
74133965Sjdp      (cd ${ml_dir}/${ml_libdir};
74233965Sjdp       ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
74360484Sobrien      if [ -f ${ml_dir}/${ml_libdir}/Makefile ]; then
74460484Sobrien	if [ x"${MAKE}" = x ]; then
74560484Sobrien	  (cd ${ml_dir}/${ml_libdir}; make distclean)
74660484Sobrien	else
74760484Sobrien	  (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
74860484Sobrien	fi
74960484Sobrien      fi
75033965Sjdp      ml_newsrcdir="."
75133965Sjdp      ml_srcdiroption=
75233965Sjdp      multisrctop=${dotdot}
75333965Sjdp      ;;
75433965Sjdp    *)
75533965Sjdp      case "${srcdir}" in
756130561Sobrien      /* | [A-Za-z]:[\\/]* ) # absolute path
75733965Sjdp        ml_newsrcdir=${srcdir}
75833965Sjdp        ;;
75933965Sjdp      *) # otherwise relative
76033965Sjdp        ml_newsrcdir=${dotdot}${srcdir}
76133965Sjdp        ;;
76233965Sjdp      esac
76333965Sjdp      ml_srcdiroption="-srcdir=${ml_newsrcdir}"
76433965Sjdp      multisrctop=
76533965Sjdp      ;;
76633965Sjdp    esac
76733965Sjdp
76833965Sjdp    case "${progname}" in
769130561Sobrien    /* | [A-Za-z]:[\\/]* )     ml_recprog=${progname} ;;
77033965Sjdp    *)      ml_recprog=${dotdot}${progname} ;;
77133965Sjdp    esac
77233965Sjdp
77333965Sjdp    # FIXME: POPDIR=${PWD=`pwd`} doesn't work here.
774130561Sobrien    ML_POPDIR=`${PWDCMD-pwd}`
77533965Sjdp    cd ${ml_dir}/${ml_libdir}
77633965Sjdp
77733965Sjdp    if [ -f ${ml_newsrcdir}/configure ]; then
778130561Sobrien      ml_recprog="${ml_newsrcdir}/configure"
77933965Sjdp    fi
78077298Sobrien
78177298Sobrien    # find compiler flag corresponding to ${ml_dir}
782130561Sobrien    for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
78377298Sobrien      dir=`echo $i | sed -e 's/;.*$//'`
78477298Sobrien      if [ "${dir}" = "${ml_dir}" ]; then
78577298Sobrien        flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
78677298Sobrien        break
78777298Sobrien      fi
78877298Sobrien    done
789218822Sdim    ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags"'
79077298Sobrien
79177298Sobrien    if [ "${with_target_subdir}" = "." ]; then
79277298Sobrien	CC_=$CC' '
79377298Sobrien	CXX_=$CXX' '
794218822Sdim	F77_=$F77' '
795130561Sobrien	GCJ_=$GCJ' '
796218822Sdim	GFORTRAN_=$GFORTRAN' '
79777298Sobrien    else
79877298Sobrien	# Create a regular expression that matches any string as long
79977298Sobrien	# as ML_POPDIR.
80077298Sobrien	popdir_rx=`echo ${ML_POPDIR} | sed 's,.,.,g'`
80177298Sobrien	CC_=
80277298Sobrien	for arg in ${CC}; do
80377298Sobrien	  case $arg in
80477298Sobrien	  -[BIL]"${ML_POPDIR}"/*)
80577298Sobrien	    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"`' ' ;;
80677298Sobrien	  "${ML_POPDIR}"/*)
80777298Sobrien	    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"`' ' ;;
80877298Sobrien	  *)
80977298Sobrien	    CC_="${CC_}${arg} " ;;
81077298Sobrien	  esac
81177298Sobrien	done
81277298Sobrien
81377298Sobrien	CXX_=
81477298Sobrien	for arg in ${CXX}; do
81577298Sobrien	  case $arg in
81677298Sobrien	  -[BIL]"${ML_POPDIR}"/*)
81777298Sobrien	    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"`' ' ;;
81877298Sobrien	  "${ML_POPDIR}"/*)
81977298Sobrien	    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"`' ' ;;
82077298Sobrien	  *)
82177298Sobrien	    CXX_="${CXX_}${arg} " ;;
82277298Sobrien	  esac
82377298Sobrien	done
82477298Sobrien
825218822Sdim	F77_=
826218822Sdim	for arg in ${F77}; do
827218822Sdim	  case $arg in
828218822Sdim	  -[BIL]"${ML_POPDIR}"/*)
829218822Sdim	    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"`' ' ;;
830218822Sdim	  "${ML_POPDIR}"/*)
831218822Sdim	    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"`' ' ;;
832218822Sdim	  *)
833218822Sdim	    F77_="${F77_}${arg} " ;;
834218822Sdim	  esac
835218822Sdim	done
836218822Sdim
837130561Sobrien	GCJ_=
838130561Sobrien	for arg in ${GCJ}; do
839130561Sobrien	  case $arg in
840130561Sobrien	  -[BIL]"${ML_POPDIR}"/*)
841130561Sobrien	    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"`' ' ;;
842130561Sobrien	  "${ML_POPDIR}"/*)
843130561Sobrien	    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"`' ' ;;
844130561Sobrien	  *)
845130561Sobrien	    GCJ_="${GCJ_}${arg} " ;;
846130561Sobrien	  esac
847130561Sobrien	done
848130561Sobrien
849218822Sdim	GFORTRAN_=
850218822Sdim	for arg in ${GFORTRAN}; do
851218822Sdim	  case $arg in
852218822Sdim	  -[BIL]"${ML_POPDIR}"/*)
853218822Sdim	    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"`' ' ;;
854218822Sdim	  "${ML_POPDIR}"/*)
855218822Sdim	    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"`' ' ;;
856218822Sdim	  *)
857218822Sdim	    GFORTRAN_="${GFORTRAN_}${arg} " ;;
858218822Sdim	  esac
859218822Sdim	done
860218822Sdim
86177298Sobrien	if test "x${LD_LIBRARY_PATH+set}" = xset; then
86277298Sobrien	  LD_LIBRARY_PATH_=
86377298Sobrien	  for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
86477298Sobrien	    case "$arg" in
86577298Sobrien	    "${ML_POPDIR}"/*)
86677298Sobrien	      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"`
86777298Sobrien	      ;;
86877298Sobrien	    esac
86977298Sobrien	    if test "x$LD_LIBRARY_PATH_" != x; then
87077298Sobrien	      LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
87177298Sobrien	    else
87277298Sobrien	      LD_LIBRARY_PATH_=$arg
87377298Sobrien	    fi
87477298Sobrien          done
87577298Sobrien	  ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
87677298Sobrien	fi
87777298Sobrien
87877298Sobrien	if test "x${SHLIB_PATH+set}" = xset; then
87977298Sobrien	  SHLIB_PATH_=
88077298Sobrien	  for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
88177298Sobrien	    case "$arg" in
88277298Sobrien	    "${ML_POPDIR}"/*)
88377298Sobrien	      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"`
88477298Sobrien	      ;;
88577298Sobrien	    esac
88677298Sobrien	    if test "x$SHLIB_PATH_" != x; then
88777298Sobrien	      SHLIB_PATH_=$SHLIB_PATH_:$arg
88877298Sobrien	    else
88977298Sobrien	      SHLIB_PATH_=$arg
89077298Sobrien	    fi
89177298Sobrien          done
89277298Sobrien	  ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
89377298Sobrien	fi
89477298Sobrien    fi
89577298Sobrien
89677298Sobrien    if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
89733965Sjdp	--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
898218822Sdim	${ac_configure_args} ${ml_config_env} ${ml_srcdiroption} ; then
89933965Sjdp      true
90033965Sjdp    else
90133965Sjdp      exit 1
90233965Sjdp    fi
90333965Sjdp
90433965Sjdp    cd ${ML_POPDIR}
90533965Sjdp
90633965Sjdp  done
90733965Sjdp
90833965Sjdp  cd ${ml_origdir}
90933965Sjdpfi
91033965Sjdp
91133965Sjdpfi # ${ml_toplevel_p} = yes
91233965Sjdpfi # ${enable_multilib} = yes
913