xref: /netbsd-src/external/gpl3/gdb/dist/config-ml.in (revision 079139fb19b43ab2737358c774cc348c7601b6a4)
1597410b8Schristos# Configure fragment invoked in the post-target section for subdirs
2597410b8Schristos# wanting multilib support.
3597410b8Schristos#
4597410b8Schristos# Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
5212397c6Schristos# 2005, 2006, 2007, 2008, 2010, 2011, 2014 Free Software Foundation, Inc.
6597410b8Schristos#
7597410b8Schristos# This file is free software; you can redistribute it and/or modify
8597410b8Schristos# it under the terms of the GNU General Public License as published by
9597410b8Schristos# the Free Software Foundation; either version 2 of the License, or
10597410b8Schristos# (at your option) any later version.
11597410b8Schristos#
12597410b8Schristos# This program is distributed in the hope that it will be useful,
13597410b8Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of
14597410b8Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15597410b8Schristos# GNU General Public License for more details.
16597410b8Schristos#
17597410b8Schristos# You should have received a copy of the GNU General Public License
18597410b8Schristos# along with this program; if not, write to the Free Software
19597410b8Schristos# Foundation, Inc., 51 Franklin Street, Fifth Floor,
20597410b8Schristos# Boston, MA 02110-1301, USA.
21597410b8Schristos#
22597410b8Schristos# As a special exception to the GNU General Public License, if you
23597410b8Schristos# distribute this file as part of a program that contains a
24597410b8Schristos# configuration script generated by Autoconf, you may include it under
25597410b8Schristos# the same distribution terms that you use for the rest of that program.
26597410b8Schristos#
27597410b8Schristos# Please report bugs to <gcc-bugs@gnu.org>
28597410b8Schristos# and send patches to <gcc-patches@gnu.org>.
29597410b8Schristos
30597410b8Schristos# It is advisable to support a few --enable/--disable options to let the
31597410b8Schristos# user select which libraries s/he really wants.
32597410b8Schristos#
33597410b8Schristos# Subdirectories wishing to use multilib should put the following lines
34ba340e45Schristos# in the "post-target" section of configure.ac.
35597410b8Schristos#
36597410b8Schristos# if [ "${srcdir}" = "." ] ; then
37597410b8Schristos#   if [ "${with_target_subdir}" != "." ] ; then
38597410b8Schristos#     . ${with_multisrctop}../../config-ml.in
39597410b8Schristos#   else
40597410b8Schristos#     . ${with_multisrctop}../config-ml.in
41597410b8Schristos#   fi
42597410b8Schristos# else
43597410b8Schristos#   . ${srcdir}/../config-ml.in
44597410b8Schristos# fi
45597410b8Schristos#
46597410b8Schristos#
47597410b8Schristos# Things are complicated because 6 separate cases must be handled:
48597410b8Schristos# 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
49597410b8Schristos#
50597410b8Schristos# srcdir=. is special.  It must handle make programs that don't handle VPATH.
51597410b8Schristos# To implement this, a symlink tree is built for each library and for each
52597410b8Schristos# multilib subdir.
53597410b8Schristos#
54597410b8Schristos# The build tree is layed out as
55597410b8Schristos#
56597410b8Schristos# ./
57597410b8Schristos#   newlib
58597410b8Schristos#   m68020/
59597410b8Schristos#          newlib
60597410b8Schristos#          m68881/
61597410b8Schristos#                 newlib
62597410b8Schristos#
63597410b8Schristos# The nice feature about this arrangement is that inter-library references
64597410b8Schristos# in the build tree work without having to care where you are.  Note that
65597410b8Schristos# inter-library references also work in the source tree because symlink trees
66597410b8Schristos# are built when srcdir=.
67597410b8Schristos#
68597410b8Schristos# Unfortunately, trying to access the libraries in the build tree requires
69597410b8Schristos# the user to manually choose which library to use as GCC won't be able to
70597410b8Schristos# find the right one.  This is viewed as the lesser of two evils.
71597410b8Schristos#
72597410b8Schristos# Configure variables:
73597410b8Schristos# ${with_target_subdir} = "." for native, or ${target_alias} for cross.
74597410b8Schristos# Set by top level Makefile.
75597410b8Schristos# ${with_multisrctop} = how many levels of multilibs there are in the source
76597410b8Schristos# tree.  It exists to handle the case of configuring in the source tree:
77597410b8Schristos# ${srcdir} is not constant.
78597410b8Schristos# ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
79597410b8Schristos#
80597410b8Schristos# Makefile variables:
81597410b8Schristos# MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
82597410b8Schristos# (FIXME: note that this is different than ${with_multisrctop}.  Check out.).
83597410b8Schristos# MULTIBUILDTOP = number of multilib levels in build tree
84597410b8Schristos# MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
85597410b8Schristos# (only defined in each library's main Makefile).
86597410b8Schristos# MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000)
87597410b8Schristos# (only defined in each multilib subdir).
88597410b8Schristos
89597410b8Schristos# FIXME: Multilib is currently disabled by default for everything other than
90597410b8Schristos# newlib.  It is up to each target to turn on multilib support for the other
91597410b8Schristos# libraries as desired.
92597410b8Schristos
93597410b8Schristos# Autoconf incoming variables:
94597410b8Schristos# srcdir, host, ac_configure_args
95597410b8Schristos#
96597410b8Schristos# We *could* figure srcdir and host out, but we'd have to do work that
97597410b8Schristos# our caller has already done to figure them out and requiring these two
98597410b8Schristos# seems reasonable.
99597410b8Schristos# Note that `host' in this case is GCC's `target'.  Target libraries are
100597410b8Schristos# configured for a particular host.
101597410b8Schristos
102597410b8SchristosMakefile=${ac_file-Makefile}
103597410b8Schristosml_config_shell=${CONFIG_SHELL-/bin/sh}
104597410b8Schristosml_realsrcdir=${srcdir}
105597410b8Schristos
106597410b8Schristos# Scan all the arguments and set all the ones we need.
107597410b8Schristos
108212397c6Schristosscan_arguments ()
109212397c6Schristos{
110597410b8Schristos  ml_verbose=--verbose
111212397c6Schristos  for option
112597410b8Schristos  do
113212397c6Schristos    # Strip single quotes surrounding individual options, that is, remove one
114212397c6Schristos    # level of shell quoting for these.
115597410b8Schristos    case $option in
116597410b8Schristos      \'*\') eval option=$option ;;
117597410b8Schristos    esac
118597410b8Schristos
119597410b8Schristos    case $option in
120597410b8Schristos      --*) ;;
121597410b8Schristos      -*) option=-$option ;;
122597410b8Schristos    esac
123597410b8Schristos
124597410b8Schristos    case $option in
125597410b8Schristos      --*=*)
126597410b8Schristos	optarg=`echo $option | sed -e 's/^[^=]*=//'`
127597410b8Schristos	;;
128597410b8Schristos    esac
129597410b8Schristos
130597410b8Schristos    case $option in
131597410b8Schristos      --disable-*)
132597410b8Schristos	enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
133597410b8Schristos	eval $enableopt=no
134597410b8Schristos	;;
135597410b8Schristos      --enable-*)
136597410b8Schristos	case "$option" in
137597410b8Schristos	*=*)	;;
138597410b8Schristos	*)	optarg=yes ;;
139597410b8Schristos	esac
140597410b8Schristos	enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
141597410b8Schristos	# enable_shared and enable_static are handled by configure.
142597410b8Schristos	# Don't undo its work.
143597410b8Schristos	case $enableopt in
144597410b8Schristos	enable_shared | enable_static) ;;
145212397c6Schristos	*) eval $enableopt='$optarg' ;;
146597410b8Schristos	esac
147597410b8Schristos	;;
148597410b8Schristos      --norecursion | --no-recursion)
149597410b8Schristos	ml_norecursion=yes
150597410b8Schristos	;;
151597410b8Schristos      --silent | --sil* | --quiet | --q*)
152597410b8Schristos	ml_verbose=--silent
153597410b8Schristos	;;
154597410b8Schristos      --verbose | --v | --verb*)
155597410b8Schristos	ml_verbose=--verbose
156597410b8Schristos	;;
157597410b8Schristos      --with-*)
158597410b8Schristos	case "$option" in
159597410b8Schristos	*=*)	;;
160597410b8Schristos	*)	optarg=yes ;;
161597410b8Schristos	esac
162597410b8Schristos	withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
163212397c6Schristos	eval $withopt='$optarg'
164597410b8Schristos	;;
165597410b8Schristos      --without-*)
166597410b8Schristos	withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
167597410b8Schristos	eval $withopt=no
168597410b8Schristos	;;
169597410b8Schristos    esac
170597410b8Schristos  done
171212397c6Schristos}
172212397c6Schristos# Use eval to properly handle configure arguments such as
173212397c6Schristos# --enable-foo='--enable-a=1 --enable-b=2 --enable-c=3'.
174212397c6Schristoseval scan_arguments "${ac_configure_args}"
175212397c6Schristosunset scan_arguments
176597410b8Schristos
177597410b8Schristos# Only do this if --enable-multilib.
178597410b8Schristosif [ "${enable_multilib}" = yes ]; then
179597410b8Schristos
180597410b8Schristos# Compute whether this is the library's top level directory
181597410b8Schristos# (ie: not a multilib subdirectory, and not a subdirectory like newlib/src).
182597410b8Schristos# ${with_multisubdir} tells us we're in the right branch, but we could be
183597410b8Schristos# in a subdir of that.
184597410b8Schristos# ??? The previous version could void this test by separating the process into
185ba340e45Schristos# two files: one that only the library's toplevel configure.ac ran (to
186ba340e45Schristos# configure the multilib subdirs), and another that all configure.ac's ran to
187597410b8Schristos# update the Makefile.  It seemed reasonable to collapse all multilib support
188597410b8Schristos# into one file, but it does leave us with having to perform this test.
189597410b8Schristosml_toplevel_p=no
190597410b8Schristosif [ -z "${with_multisubdir}" ]; then
191597410b8Schristos  if [ "${srcdir}" = "." ]; then
192597410b8Schristos    # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
193597410b8Schristos    # ${with_target_subdir} = "." for native, otherwise target alias.
194597410b8Schristos    if [ "${with_target_subdir}" = "." ]; then
195597410b8Schristos      if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
196597410b8Schristos	ml_toplevel_p=yes
197597410b8Schristos      fi
198597410b8Schristos    else
199597410b8Schristos      if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
200597410b8Schristos	ml_toplevel_p=yes
201597410b8Schristos      fi
202597410b8Schristos    fi
203597410b8Schristos  else
204597410b8Schristos    # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
205597410b8Schristos    if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
206597410b8Schristos      ml_toplevel_p=yes
207597410b8Schristos    fi
208597410b8Schristos  fi
209597410b8Schristosfi
210597410b8Schristos
211597410b8Schristos# If this is the library's top level directory, set multidirs to the
212597410b8Schristos# multilib subdirs to support.  This lives at the top because we need
213597410b8Schristos# `multidirs' set right away.
214597410b8Schristos
215597410b8Schristosif [ "${ml_toplevel_p}" = yes ]; then
216597410b8Schristos
217597410b8Schristosmultidirs=
218597410b8Schristosfor i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
219597410b8Schristos  dir=`echo $i | sed -e 's/;.*$//'`
220597410b8Schristos  if [ "${dir}" = "." ]; then
221597410b8Schristos    true
222597410b8Schristos  else
223597410b8Schristos    if [ -z "${multidirs}" ]; then
224597410b8Schristos      multidirs="${dir}"
225597410b8Schristos    else
226597410b8Schristos      multidirs="${multidirs} ${dir}"
227597410b8Schristos    fi
228597410b8Schristos  fi
229597410b8Schristosdone
230597410b8Schristos
231597410b8Schristos# Target libraries are configured for the host they run on, so we check
232597410b8Schristos# $host here, not $target.
233597410b8Schristos
234597410b8Schristoscase "${host}" in
235597410b8Schristosarm-*-*)
236597410b8Schristos	if [ x"$enable_fpu" = xno ]
237597410b8Schristos	then
238597410b8Schristos	  old_multidirs=${multidirs}
239597410b8Schristos	  multidirs=""
240597410b8Schristos	  for x in ${old_multidirs}; do
241597410b8Schristos	    case "${x}" in
242597410b8Schristos	      *fpu*) : ;;
243597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
244597410b8Schristos	    esac
245597410b8Schristos	  done
246597410b8Schristos	fi
247597410b8Schristos	if [ x"$enable_26bit" = xno ]
248597410b8Schristos	then
249597410b8Schristos	  old_multidirs=${multidirs}
250597410b8Schristos	  multidirs=""
251597410b8Schristos	  for x in ${old_multidirs}; do
252597410b8Schristos	    case "${x}" in
253597410b8Schristos	      *26bit*) : ;;
254597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
255597410b8Schristos	    esac
256597410b8Schristos	  done
257597410b8Schristos	fi
258597410b8Schristos	if [ x"$enable_underscore" = xno ]
259597410b8Schristos	then
260597410b8Schristos	  old_multidirs=${multidirs}
261597410b8Schristos	  multidirs=""
262597410b8Schristos	  for x in ${old_multidirs}; do
263597410b8Schristos	    case "${x}" in
264597410b8Schristos	      *under*) : ;;
265597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
266597410b8Schristos	    esac
267597410b8Schristos	  done
268597410b8Schristos	fi
269597410b8Schristos	if [ x"$enable_interwork" = xno ]
270597410b8Schristos	then
271597410b8Schristos	  old_multidirs=${multidirs}
272597410b8Schristos	  multidirs=""
273597410b8Schristos	  for x in ${old_multidirs}; do
274597410b8Schristos	    case "${x}" in
275597410b8Schristos	      *interwork*) : ;;
276597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
277597410b8Schristos	    esac
278597410b8Schristos	  done
279597410b8Schristos	fi
280597410b8Schristos	if [ x$enable_biendian = xno ]
281597410b8Schristos	then
282597410b8Schristos	  old_multidirs="${multidirs}"
283597410b8Schristos	  multidirs=""
284597410b8Schristos	  for x in ${old_multidirs}; do
285597410b8Schristos	    case "$x" in
286597410b8Schristos	      *le* ) : ;;
287597410b8Schristos	      *be* ) : ;;
288597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
289597410b8Schristos	    esac
290597410b8Schristos	  done
291597410b8Schristos	fi
292597410b8Schristos	if [ x"$enable_nofmult" = xno ]
293597410b8Schristos	then
294597410b8Schristos	  old_multidirs="${multidirs}"
295597410b8Schristos	  multidirs=""
296597410b8Schristos	  for x in ${old_multidirs}; do
297597410b8Schristos	    case "$x" in
298597410b8Schristos	      *nofmult* ) : ;;
299597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
300597410b8Schristos	    esac
301597410b8Schristos	  done
302597410b8Schristos	fi
303597410b8Schristos	;;
304597410b8Schristosm68*-*-*)
305597410b8Schristos	if [ x$enable_softfloat = xno ]
306597410b8Schristos	then
307597410b8Schristos	  old_multidirs="${multidirs}"
308597410b8Schristos	  multidirs=""
309597410b8Schristos	  for x in ${old_multidirs}; do
310597410b8Schristos	    case "$x" in
311597410b8Schristos	      *soft-float* ) : ;;
312597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
313597410b8Schristos	    esac
314597410b8Schristos	  done
315597410b8Schristos	fi
316597410b8Schristos	if [ x$enable_m68881 = xno ]
317597410b8Schristos	then
318597410b8Schristos	  old_multidirs="${multidirs}"
319597410b8Schristos	  multidirs=""
320597410b8Schristos	  for x in ${old_multidirs}; do
321597410b8Schristos	    case "$x" in
322597410b8Schristos	      *m68881* ) : ;;
323597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
324597410b8Schristos	    esac
325597410b8Schristos	  done
326597410b8Schristos	fi
327597410b8Schristos	if [ x$enable_m68000 = xno ]
328597410b8Schristos	then
329597410b8Schristos	  old_multidirs="${multidirs}"
330597410b8Schristos	  multidirs=""
331597410b8Schristos	  for x in ${old_multidirs}; do
332597410b8Schristos	    case "$x" in
333597410b8Schristos	      *m68000* ) : ;;
334597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
335597410b8Schristos	    esac
336597410b8Schristos	  done
337597410b8Schristos	fi
338597410b8Schristos	if [ x$enable_m68020 = xno ]
339597410b8Schristos	then
340597410b8Schristos	  old_multidirs="${multidirs}"
341597410b8Schristos	  multidirs=""
342597410b8Schristos	  for x in ${old_multidirs}; do
343597410b8Schristos	    case "$x" in
344597410b8Schristos	      *m68020* ) : ;;
345597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
346597410b8Schristos	    esac
347597410b8Schristos	  done
348597410b8Schristos	fi
349597410b8Schristos	;;
350597410b8Schristosmips*-*-*)
351597410b8Schristos	if [ x$enable_single_float = xno ]
352597410b8Schristos	then
353597410b8Schristos	  old_multidirs="${multidirs}"
354597410b8Schristos	  multidirs=""
355597410b8Schristos	  for x in ${old_multidirs}; do
356597410b8Schristos	    case "$x" in
357597410b8Schristos	      *single* ) : ;;
358597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
359597410b8Schristos	    esac
360597410b8Schristos	  done
361597410b8Schristos	fi
362597410b8Schristos	if [ x$enable_biendian = xno ]
363597410b8Schristos	then
364597410b8Schristos	  old_multidirs="${multidirs}"
365597410b8Schristos	  multidirs=""
366597410b8Schristos	  for x in ${old_multidirs}; do
367597410b8Schristos	    case "$x" in
368597410b8Schristos	      *el* ) : ;;
369597410b8Schristos	      *eb* ) : ;;
370597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
371597410b8Schristos	    esac
372597410b8Schristos	  done
373597410b8Schristos	fi
374597410b8Schristos	if [ x$enable_softfloat = xno ]
375597410b8Schristos	then
376597410b8Schristos	  old_multidirs="${multidirs}"
377597410b8Schristos	  multidirs=""
378597410b8Schristos	  for x in ${old_multidirs}; do
379597410b8Schristos	    case "$x" in
380597410b8Schristos	      *soft-float* ) : ;;
381597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
382597410b8Schristos	    esac
383597410b8Schristos	  done
384597410b8Schristos	fi
385597410b8Schristos	;;
386*079139fbSchristosmsp430-*-*)
387*079139fbSchristos	if [ x$enable_no_exceptions = xno ]
388*079139fbSchristos	then
389*079139fbSchristos	  old_multidirs="${multidirs}"
390*079139fbSchristos	  multidirs=""
391*079139fbSchristos	  for x in ${old_multidirs}; do
392*079139fbSchristos	    case "$x" in
393*079139fbSchristos	      *no-exceptions* ) : ;;
394*079139fbSchristos	      *) multidirs="${multidirs} ${x}" ;;
395*079139fbSchristos	    esac
396*079139fbSchristos	  done
397*079139fbSchristos	fi
398*079139fbSchristos	;;
399597410b8Schristospowerpc*-*-* | rs6000*-*-*)
400597410b8Schristos	if [ x$enable_aix64 = xno ]
401597410b8Schristos	then
402597410b8Schristos	  old_multidirs="${multidirs}"
403597410b8Schristos	  multidirs=""
404597410b8Schristos	  for x in ${old_multidirs}; do
405597410b8Schristos	    case "$x" in
406597410b8Schristos	      *ppc64* ) : ;;
407597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
408597410b8Schristos	    esac
409597410b8Schristos	  done
410597410b8Schristos	fi
411597410b8Schristos	if [ x$enable_pthread = xno ]
412597410b8Schristos	then
413597410b8Schristos	  old_multidirs="${multidirs}"
414597410b8Schristos	  multidirs=""
415597410b8Schristos	  for x in ${old_multidirs}; do
416597410b8Schristos	    case "$x" in
417597410b8Schristos	      *pthread* ) : ;;
418597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
419597410b8Schristos	    esac
420597410b8Schristos	  done
421597410b8Schristos	fi
422597410b8Schristos	if [ x$enable_softfloat = xno ]
423597410b8Schristos	then
424597410b8Schristos	  old_multidirs="${multidirs}"
425597410b8Schristos	  multidirs=""
426597410b8Schristos	  for x in ${old_multidirs}; do
427597410b8Schristos	    case "$x" in
428597410b8Schristos	      *soft-float* ) : ;;
429597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
430597410b8Schristos	    esac
431597410b8Schristos	  done
432597410b8Schristos	fi
433597410b8Schristos	if [ x$enable_powercpu = xno ]
434597410b8Schristos	then
435597410b8Schristos	  old_multidirs="${multidirs}"
436597410b8Schristos	  multidirs=""
437597410b8Schristos	  for x in ${old_multidirs}; do
438597410b8Schristos	    case "$x" in
439597410b8Schristos	      power | */power | */power/* ) : ;;
440597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
441597410b8Schristos	    esac
442597410b8Schristos	  done
443597410b8Schristos	fi
444597410b8Schristos	if [ x$enable_powerpccpu = xno ]
445597410b8Schristos	then
446597410b8Schristos	  old_multidirs="${multidirs}"
447597410b8Schristos	  multidirs=""
448597410b8Schristos	  for x in ${old_multidirs}; do
449597410b8Schristos	    case "$x" in
450597410b8Schristos	      *powerpc* ) : ;;
451597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
452597410b8Schristos	    esac
453597410b8Schristos	  done
454597410b8Schristos	fi
455597410b8Schristos	if [ x$enable_powerpcos = xno ]
456597410b8Schristos	then
457597410b8Schristos	  old_multidirs="${multidirs}"
458597410b8Schristos	  multidirs=""
459597410b8Schristos	  for x in ${old_multidirs}; do
460597410b8Schristos	    case "$x" in
461597410b8Schristos	      *mcall-linux* | *mcall-solaris* ) : ;;
462597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
463597410b8Schristos	    esac
464597410b8Schristos	  done
465597410b8Schristos	fi
466597410b8Schristos	if [ x$enable_biendian = xno ]
467597410b8Schristos	then
468597410b8Schristos	  old_multidirs="${multidirs}"
469597410b8Schristos	  multidirs=""
470597410b8Schristos	  for x in ${old_multidirs}; do
471597410b8Schristos	    case "$x" in
472597410b8Schristos	      *mlittle* | *mbig* ) : ;;
473597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
474597410b8Schristos	    esac
475597410b8Schristos	  done
476597410b8Schristos	fi
477597410b8Schristos	if [ x$enable_sysv = xno ]
478597410b8Schristos	then
479597410b8Schristos	  old_multidirs="${multidirs}"
480597410b8Schristos	  multidirs=""
481597410b8Schristos	  for x in ${old_multidirs}; do
482597410b8Schristos	    case "$x" in
483597410b8Schristos	      *mcall-sysv* ) : ;;
484597410b8Schristos	      *) multidirs="${multidirs} ${x}" ;;
485597410b8Schristos	    esac
486597410b8Schristos	  done
487597410b8Schristos	fi
488597410b8Schristos	;;
489597410b8Schristosesac
490597410b8Schristos
491597410b8Schristos# Remove extraneous blanks from multidirs.
492597410b8Schristos# Tests like `if [ -n "$multidirs" ]' require it.
493597410b8Schristosmultidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'`
494597410b8Schristos
495597410b8Schristos# Add code to library's top level makefile to handle building the multilib
496597410b8Schristos# subdirs.
497597410b8Schristos
498597410b8Schristoscat > Multi.tem <<\EOF
499597410b8Schristos
500597410b8SchristosPWD_COMMAND=$${PWDCMD-pwd}
501597410b8Schristos
502597410b8Schristosmulti-do:
503*079139fbSchristos	@if [ -z "$(MULTIDIRS)" ]; then \
504597410b8Schristos	  true; \
505597410b8Schristos	else \
506597410b8Schristos	  rootpre=`${PWD_COMMAND}`/; export rootpre; \
507597410b8Schristos	  srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
508597410b8Schristos	  lib=`echo "$${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
509597410b8Schristos	  compiler="$(CC)"; \
510597410b8Schristos	  for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
511597410b8Schristos	    dir=`echo $$i | sed -e 's/;.*$$//'`; \
512597410b8Schristos	    if [ "$${dir}" = "." ]; then \
513597410b8Schristos	      true; \
514597410b8Schristos	    else \
515597410b8Schristos	      if [ -d ../$${dir}/$${lib} ]; then \
516597410b8Schristos		flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
517597410b8Schristos		if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
518597410b8Schristos				CFLAGS="$(CFLAGS) $${flags}" \
519597410b8Schristos				CCASFLAGS="$(CCASFLAGS) $${flags}" \
520597410b8Schristos				FCFLAGS="$(FCFLAGS) $${flags}" \
521597410b8Schristos				FFLAGS="$(FFLAGS) $${flags}" \
522597410b8Schristos				ADAFLAGS="$(ADAFLAGS) $${flags}" \
523597410b8Schristos				prefix="$(prefix)" \
524597410b8Schristos				exec_prefix="$(exec_prefix)" \
525597410b8Schristos				GOCFLAGS="$(GOCFLAGS) $${flags}" \
526*079139fbSchristos				GDCFLAGS="$(GDCFLAGS) $${flags}" \
527597410b8Schristos				CXXFLAGS="$(CXXFLAGS) $${flags}" \
528597410b8Schristos				LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
529597410b8Schristos				LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
530597410b8Schristos				LDFLAGS="$(LDFLAGS) $${flags}" \
531597410b8Schristos				MULTIFLAGS="$${flags}" \
532597410b8Schristos				DESTDIR="$(DESTDIR)" \
533597410b8Schristos				INSTALL="$(INSTALL)" \
534597410b8Schristos				INSTALL_DATA="$(INSTALL_DATA)" \
535597410b8Schristos				INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
536597410b8Schristos				INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \
537597410b8Schristos				$(DO)); then \
538597410b8Schristos		  true; \
539597410b8Schristos		else \
540597410b8Schristos		  exit 1; \
541597410b8Schristos		fi; \
542597410b8Schristos	      else true; \
543597410b8Schristos	      fi; \
544597410b8Schristos	    fi; \
545597410b8Schristos	  done; \
546597410b8Schristos	fi
547597410b8Schristos
548597410b8Schristosmulti-clean:
549*079139fbSchristos	@if [ -z "$(MULTIDIRS)" ]; then \
550597410b8Schristos	  true; \
551597410b8Schristos	else \
552597410b8Schristos	  lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
553597410b8Schristos	  for dir in : $(MULTIDIRS); do \
554597410b8Schristos	    test $$dir != : || continue; \
555597410b8SchristosEOF
556597410b8Schristoscat >>Multi.tem <<EOF
557597410b8Schristos	    if [ -f ../\$\${dir}/\$\${lib}/${Makefile} ]; then \\
558597410b8SchristosEOF
559597410b8Schristoscat >>Multi.tem <<\EOF
560597410b8Schristos	      if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
561597410b8Schristos	      then true; \
562597410b8Schristos	      else exit 1; \
563597410b8Schristos	      fi; \
564597410b8Schristos	    else true; \
565597410b8Schristos	    fi; \
566597410b8Schristos	  done; \
567597410b8Schristos	fi
568597410b8SchristosEOF
569597410b8Schristos
570597410b8Schristoscat ${Makefile} Multi.tem > Makefile.tem
571597410b8Schristosrm -f ${Makefile} Multi.tem
572597410b8Schristosmv Makefile.tem ${Makefile}
573597410b8Schristos
574597410b8Schristosfi # ${ml_toplevel_p} = yes
575597410b8Schristos
576597410b8Schristosif [ "${ml_verbose}" = --verbose ]; then
577597410b8Schristos  echo "Adding multilib support to ${Makefile} in ${ml_realsrcdir}"
578597410b8Schristos  if [ "${ml_toplevel_p}" = yes ]; then
579597410b8Schristos    echo "multidirs=${multidirs}"
580597410b8Schristos  fi
581597410b8Schristos  echo "with_multisubdir=${with_multisubdir}"
582597410b8Schristosfi
583597410b8Schristos
584597410b8Schristosif [ "${srcdir}" = "." ]; then
585597410b8Schristos  if [ "${with_target_subdir}" != "." ]; then
586597410b8Schristos    ml_srcdotdot="../"
587597410b8Schristos  else
588597410b8Schristos    ml_srcdotdot=""
589597410b8Schristos  fi
590597410b8Schristoselse
591597410b8Schristos  ml_srcdotdot=""
592597410b8Schristosfi
593597410b8Schristos
594597410b8Schristosif [ -z "${with_multisubdir}" ]; then
595597410b8Schristos  ml_subdir=
596597410b8Schristos  ml_builddotdot=
597597410b8Schristos  : # ml_srcdotdot= # already set
598597410b8Schristoselse
599597410b8Schristos  ml_subdir="/${with_multisubdir}"
600597410b8Schristos  # The '[^/][^/]*' appears that way to work around a SunOS sed bug.
601597410b8Schristos  ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/
602597410b8Schristos  if [ "$srcdir" = "." ]; then
603597410b8Schristos    ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot}
604597410b8Schristos  else
605597410b8Schristos    : # ml_srcdotdot= # already set
606597410b8Schristos  fi
607597410b8Schristosfi
608597410b8Schristos
609597410b8Schristosif [ "${ml_toplevel_p}" = yes ]; then
610597410b8Schristos  ml_do='$(MAKE)'
611597410b8Schristos  ml_clean='$(MAKE)'
612597410b8Schristoselse
613597410b8Schristos  ml_do=true
614597410b8Schristos  ml_clean=true
615597410b8Schristosfi
616597410b8Schristos
617597410b8Schristos# TOP is used by newlib and should not be used elsewhere for this purpose.
618597410b8Schristos# MULTI{SRC,BUILD}TOP are the proper ones to use.  MULTISRCTOP is empty
619597410b8Schristos# when srcdir != builddir.  MULTIBUILDTOP is always some number of ../'s.
620597410b8Schristos# FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can
621597410b8Schristos# delete TOP.  Newlib may wish to continue to use TOP for its own purposes
622597410b8Schristos# of course.
623597410b8Schristos# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
624597410b8Schristos# and lists the subdirectories to recurse into.
625597410b8Schristos# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
626597410b8Schristos# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
627597410b8Schristos# a leading '/'.
628597410b8Schristos# MULTIDO is used for targets like all, install, and check where
629597410b8Schristos# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
630597410b8Schristos# MULTICLEAN is used for the *clean targets.
631597410b8Schristos#
632597410b8Schristos# ??? It is possible to merge MULTIDO and MULTICLEAN into one.  They are
633597410b8Schristos# currently kept separate because we don't want the *clean targets to require
634597410b8Schristos# the existence of the compiler (which MULTIDO currently requires) and
635597410b8Schristos# therefore we'd have to record the directory options as well as names
636597410b8Schristos# (currently we just record the names and use --print-multi-lib to get the
637597410b8Schristos# options).
638597410b8Schristos
639597410b8Schristossed -e "s:^TOP[ 	]*=[ 	]*\([./]*\)[ 	]*$:TOP = ${ml_builddotdot}\1:" \
640597410b8Schristos    -e "s:^MULTISRCTOP[ 	]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \
641597410b8Schristos    -e "s:^MULTIBUILDTOP[ 	]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \
642597410b8Schristos    -e "s:^MULTIDIRS[ 	]*=.*$:MULTIDIRS = ${multidirs}:" \
643597410b8Schristos    -e "s:^MULTISUBDIR[ 	]*=.*$:MULTISUBDIR = ${ml_subdir}:" \
644597410b8Schristos    -e "s:^MULTIDO[ 	]*=.*$:MULTIDO = $ml_do:" \
645597410b8Schristos    -e "s:^MULTICLEAN[ 	]*=.*$:MULTICLEAN = $ml_clean:" \
646597410b8Schristos	${Makefile} > Makefile.tem
647597410b8Schristosrm -f ${Makefile}
648597410b8Schristosmv Makefile.tem ${Makefile}
649597410b8Schristos
650597410b8Schristos# If this is the library's top level, configure each multilib subdir.
651597410b8Schristos# This is done at the end because this is the loop that runs configure
652597410b8Schristos# in each multilib subdir and it seemed reasonable to finish updating the
653597410b8Schristos# Makefile before going on to configure the subdirs.
654597410b8Schristos
655597410b8Schristosif [ "${ml_toplevel_p}" = yes ]; then
656597410b8Schristos
657597410b8Schristos# We must freshly configure each subdirectory.  This bit of code is
658597410b8Schristos# actually partially stolen from the main configure script.  FIXME.
659597410b8Schristos
660597410b8Schristosif [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
661597410b8Schristos
662597410b8Schristos  if [ "${ml_verbose}" = --verbose ]; then
663597410b8Schristos    echo "Running configure in multilib subdirs ${multidirs}"
664597410b8Schristos    echo "pwd: `${PWDCMD-pwd}`"
665597410b8Schristos  fi
666597410b8Schristos
667597410b8Schristos  ml_origdir=`${PWDCMD-pwd}`
668597410b8Schristos  ml_libdir=`echo "$ml_origdir" | sed -e 's,^.*/,,'`
669597410b8Schristos  # cd to top-level-build-dir/${with_target_subdir}
670597410b8Schristos  cd ..
671597410b8Schristos
672597410b8Schristos  for ml_dir in ${multidirs}; do
673597410b8Schristos
674597410b8Schristos    if [ "${ml_verbose}" = --verbose ]; then
675597410b8Schristos      echo "Running configure in multilib subdir ${ml_dir}"
676597410b8Schristos      echo "pwd: `${PWDCMD-pwd}`"
677597410b8Schristos    fi
678597410b8Schristos
679597410b8Schristos    if [ -d ${ml_dir} ]; then true; else
680597410b8Schristos      # ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
681597410b8Schristos      pathcomp=""
682597410b8Schristos      for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
683597410b8Schristos        pathcomp="$pathcomp$d"
684597410b8Schristos        case "$pathcomp" in
685597410b8Schristos          -* ) pathcomp=./$pathcomp ;;
686597410b8Schristos        esac
687597410b8Schristos        if test ! -d "$pathcomp"; then
688597410b8Schristos           echo "mkdir $pathcomp" 1>&2
689597410b8Schristos           mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
690597410b8Schristos        fi
691597410b8Schristos        if test ! -d "$pathcomp"; then
692597410b8Schristos	   exit $lasterr
693597410b8Schristos        fi
694597410b8Schristos        pathcomp="$pathcomp/"
695597410b8Schristos      done
696597410b8Schristos    fi
697597410b8Schristos    if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
698597410b8Schristos
699597410b8Schristos    # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
700597410b8Schristos    dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
701597410b8Schristos
702597410b8Schristos    case ${srcdir} in
703597410b8Schristos    ".")
704597410b8Schristos      echo "Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}"
705597410b8Schristos      if [ "${with_target_subdir}" != "." ]; then
706597410b8Schristos	ml_unsubdir="../"
707597410b8Schristos      else
708597410b8Schristos	ml_unsubdir=""
709597410b8Schristos      fi
710597410b8Schristos      (cd ${ml_dir}/${ml_libdir};
711597410b8Schristos       ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
712597410b8Schristos      if [ -f ${ml_dir}/${ml_libdir}/${Makefile} ]; then
713597410b8Schristos	if [ x"${MAKE}" = x ]; then
714597410b8Schristos	  (cd ${ml_dir}/${ml_libdir}; make distclean)
715597410b8Schristos	else
716597410b8Schristos	  (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
717597410b8Schristos	fi
718597410b8Schristos      fi
719597410b8Schristos      ml_newsrcdir="."
720597410b8Schristos      ml_srcdiroption=
721597410b8Schristos      multisrctop=${dotdot}
722597410b8Schristos      ;;
723597410b8Schristos    *)
724597410b8Schristos      case "${srcdir}" in
725597410b8Schristos      /* | [A-Za-z]:[\\/]* ) # absolute path
726597410b8Schristos        ml_newsrcdir=${srcdir}
727597410b8Schristos        ;;
728597410b8Schristos      *) # otherwise relative
729597410b8Schristos        ml_newsrcdir=${dotdot}${srcdir}
730597410b8Schristos        ;;
731597410b8Schristos      esac
732597410b8Schristos      ml_srcdiroption="-srcdir=${ml_newsrcdir}"
733597410b8Schristos      multisrctop=
734597410b8Schristos      ;;
735597410b8Schristos    esac
736597410b8Schristos
737597410b8Schristos    case "${progname}" in
738597410b8Schristos    /* | [A-Za-z]:[\\/]* )     ml_recprog=${progname} ;;
739597410b8Schristos    *)      ml_recprog=${dotdot}${progname} ;;
740597410b8Schristos    esac
741597410b8Schristos
742597410b8Schristos    # FIXME: POPDIR=${PWD=`pwd`} doesn't work here.
743597410b8Schristos    ML_POPDIR=`${PWDCMD-pwd}`
744597410b8Schristos    cd ${ml_dir}/${ml_libdir}
745597410b8Schristos
746597410b8Schristos    if [ -f ${ml_newsrcdir}/configure ]; then
747597410b8Schristos      ml_recprog="${ml_newsrcdir}/configure"
748597410b8Schristos    fi
749597410b8Schristos
750597410b8Schristos    # find compiler flag corresponding to ${ml_dir}
751597410b8Schristos    for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
752597410b8Schristos      dir=`echo $i | sed -e 's/;.*$//'`
753597410b8Schristos      if [ "${dir}" = "${ml_dir}" ]; then
754597410b8Schristos        flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
755597410b8Schristos        break
756597410b8Schristos      fi
757597410b8Schristos    done
758*079139fbSchristos    ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GFORTRAN="${GFORTRAN_}$flags" GOC="${GOC_}$flags" GDC="${GDC_}$flags"'
759597410b8Schristos
760597410b8Schristos    if [ "${with_target_subdir}" = "." ]; then
761597410b8Schristos	CC_=$CC' '
762597410b8Schristos	CXX_=$CXX' '
763597410b8Schristos	F77_=$F77' '
764597410b8Schristos	GFORTRAN_=$GFORTRAN' '
765597410b8Schristos	GOC_=$GOC' '
766*079139fbSchristos	GDC_=$GDC' '
767597410b8Schristos    else
768597410b8Schristos	# Create a regular expression that matches any string as long
769597410b8Schristos	# as ML_POPDIR.
770597410b8Schristos	popdir_rx=`echo "${ML_POPDIR}" | sed 's,.,.,g'`
771597410b8Schristos	CC_=
772597410b8Schristos	for arg in ${CC}; do
773597410b8Schristos	  case $arg in
774597410b8Schristos	  -[BIL]"${ML_POPDIR}"/*)
775597410b8Schristos	    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"`' ' ;;
776597410b8Schristos	  "${ML_POPDIR}"/*)
777597410b8Schristos	    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"`' ' ;;
778597410b8Schristos	  *)
779597410b8Schristos	    CC_="${CC_}${arg} " ;;
780597410b8Schristos	  esac
781597410b8Schristos	done
782597410b8Schristos
783597410b8Schristos	CXX_=
784597410b8Schristos	for arg in ${CXX}; do
785597410b8Schristos	  case $arg in
786597410b8Schristos	  -[BIL]"${ML_POPDIR}"/*)
787597410b8Schristos	    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"`' ' ;;
788597410b8Schristos	  "${ML_POPDIR}"/*)
789597410b8Schristos	    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"`' ' ;;
790597410b8Schristos	  *)
791597410b8Schristos	    CXX_="${CXX_}${arg} " ;;
792597410b8Schristos	  esac
793597410b8Schristos	done
794597410b8Schristos
795597410b8Schristos	F77_=
796597410b8Schristos	for arg in ${F77}; do
797597410b8Schristos	  case $arg in
798597410b8Schristos	  -[BIL]"${ML_POPDIR}"/*)
799597410b8Schristos	    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"`' ' ;;
800597410b8Schristos	  "${ML_POPDIR}"/*)
801597410b8Schristos	    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"`' ' ;;
802597410b8Schristos	  *)
803597410b8Schristos	    F77_="${F77_}${arg} " ;;
804597410b8Schristos	  esac
805597410b8Schristos	done
806597410b8Schristos
807597410b8Schristos	GFORTRAN_=
808597410b8Schristos	for arg in ${GFORTRAN}; do
809597410b8Schristos	  case $arg in
810597410b8Schristos	  -[BIL]"${ML_POPDIR}"/*)
811597410b8Schristos	    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"`' ' ;;
812597410b8Schristos	  "${ML_POPDIR}"/*)
813597410b8Schristos	    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"`' ' ;;
814597410b8Schristos	  *)
815597410b8Schristos	    GFORTRAN_="${GFORTRAN_}${arg} " ;;
816597410b8Schristos	  esac
817597410b8Schristos	done
818597410b8Schristos
819597410b8Schristos	GOC_=
820597410b8Schristos	for arg in ${GOC}; do
821597410b8Schristos	  case $arg in
822597410b8Schristos	  -[BIL]"${ML_POPDIR}"/*)
823597410b8Schristos	    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"`' ' ;;
824597410b8Schristos	  "${ML_POPDIR}"/*)
825597410b8Schristos	    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"`' ' ;;
826597410b8Schristos	  *)
827597410b8Schristos	    GOC_="${GOC_}${arg} " ;;
828597410b8Schristos	  esac
829597410b8Schristos	done
830597410b8Schristos
831*079139fbSchristos	GDC_=
832*079139fbSchristos	for arg in ${GDC}; do
833*079139fbSchristos	  case $arg in
834*079139fbSchristos	  -[BIL]"${ML_POPDIR}"/*)
835*079139fbSchristos	    GDC_="${GDC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
836*079139fbSchristos	  "${ML_POPDIR}"/*)
837*079139fbSchristos	    GDC_="${GDC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
838*079139fbSchristos	  *)
839*079139fbSchristos	    GDC_="${GDC_}${arg} " ;;
840*079139fbSchristos	  esac
841*079139fbSchristos	done
842*079139fbSchristos
843597410b8Schristos	if test "x${LD_LIBRARY_PATH+set}" = xset; then
844597410b8Schristos	  LD_LIBRARY_PATH_=
845597410b8Schristos	  for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
846597410b8Schristos	    case "$arg" in
847597410b8Schristos	    "${ML_POPDIR}"/*)
848597410b8Schristos	      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"`
849597410b8Schristos	      ;;
850597410b8Schristos	    esac
851597410b8Schristos	    if test "x$LD_LIBRARY_PATH_" != x; then
852597410b8Schristos	      LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
853597410b8Schristos	    else
854597410b8Schristos	      LD_LIBRARY_PATH_=$arg
855597410b8Schristos	    fi
856597410b8Schristos          done
857597410b8Schristos	  ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
858597410b8Schristos	fi
859597410b8Schristos
860597410b8Schristos	if test "x${SHLIB_PATH+set}" = xset; then
861597410b8Schristos	  SHLIB_PATH_=
862597410b8Schristos	  for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
863597410b8Schristos	    case "$arg" in
864597410b8Schristos	    "${ML_POPDIR}"/*)
865597410b8Schristos	      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"`
866597410b8Schristos	      ;;
867597410b8Schristos	    esac
868597410b8Schristos	    if test "x$SHLIB_PATH_" != x; then
869597410b8Schristos	      SHLIB_PATH_=$SHLIB_PATH_:$arg
870597410b8Schristos	    else
871597410b8Schristos	      SHLIB_PATH_=$arg
872597410b8Schristos	    fi
873597410b8Schristos          done
874597410b8Schristos	  ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
875597410b8Schristos	fi
876597410b8Schristos    fi
877597410b8Schristos
878597410b8Schristos    if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
879597410b8Schristos	--with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
880212397c6Schristos	"${ac_configure_args}" ${ml_config_env} ${ml_srcdiroption} ; then
881597410b8Schristos      true
882597410b8Schristos    else
883597410b8Schristos      exit 1
884597410b8Schristos    fi
885597410b8Schristos
886597410b8Schristos    cd "${ML_POPDIR}"
887597410b8Schristos
888597410b8Schristos  done
889597410b8Schristos
890597410b8Schristos  cd "${ml_origdir}"
891597410b8Schristosfi
892597410b8Schristos
893597410b8Schristosfi # ${ml_toplevel_p} = yes
894597410b8Schristosfi # ${enable_multilib} = yes
895