summaryrefslogtreecommitdiff
path: root/gnu/lib/libg++/cfg-ml-com.in
blob: 4d9218f23cddf7128d2b26680b6f84f3ba94767c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# Configure fragment invoked in the common section for subdirs
# wanting multilib support.
#
# The common section was chosen because xiberty clobbers $srcdir in the
# common section of its configure.in.
#
# The intent is to keep as much of this in one place as possible (and out
# of each subdirectory, eg: newlib, libio, etc.) until the right way to do
# this (ha ha) is decided upon.
#
# This is where a target selects what multilib directories to build.
# It is advisable to support a few --enable/--disable options to let the
# user select which libraries s/he really wants.
#
# Subdirectories wishing to use multilib should put the following lines
# in the initial ("common") section of configure.in:
#
#if [ -n "${with_multilib_top}" ]; then
#	. ${with_multilib_top}/../cfg-ml-com.in
#else
#	. ${srcdir}/../cfg-ml-com.in
#fi
#
# `with_multilib_top' exists to handle the case of configuring in the source
# tree: ${srcdir} is not constant.
#
# The following should be added to the "post-target" section of configure.in:
#
#if [ -n "${with_multilib_top}" ]; then
#	. ${with_multilib_top}/../cfg-ml-pos.in
#else
#	. ${srcdir}/../cfg-ml-pos.in
#fi

# FIXME: Multilib is currently disabled by default for everything other than
# newlib.  It is up to each target to turn on multilib support for the other
# libraries as desired.
#
# FIXME: It would be better if we could use the --print-multi-lib switch to
# gcc to get the list of directories to build, but at this point the compiler
# has not been built.

# Only do this if --enable-multilib.
# And only if at the top level, not a multilib subdirectory.

if [ "${enable_multilib}" = yes -a -z "${with_multisubdir}" ]; then

# Doing this in the common section means ${target} isn't set yet, so compute
# a copy here.  This is a bit kludgey, but again the current (short term) goal
# is to be as unobtrusive (sp?) to the rest of the sources as possible.

if result=`${config_shell} ${configsub} ${target_alias}` ; then
    true
else
    echo "Unrecognized target system name ${target_alias}." 1>&2
    exit 1
fi
target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
target=${target_cpu}-${target_vendor}-${target_os}

# FIXME: Perhaps we can do something like the following instead.
# Fetch from gcc the multilib directories to use if we can.
# if [ -f ${srcdir}/../gcc/genmultilib -a -f ../gcc/Makefile ]; then
#   options=`grep "^MULTILIB_OPTIONS" ../gcc/Makefile | sed -e 's/^.*=//'`
#   multidirs=`${srcdir}/../gcc/genmultilib "$options" | \
#	sed -e 's/^#define.*//' -e 's/^[.].*//' -e 's/".*//' -e 's/ .*//'`
# else
#   multidirs=""
# fi

case "${target}" in
hppa*-*-*)
	multidirs="soft-float"
	;;
m68*-*-aout* | m68*-*-coff* | m68*-*-elf* | m68*-*-vxworks*)
	multidirs="m68000 m68020 m68881 msoft-float m68000/m68881 m68000/msoft-float m68020/m68881 m68020/msoft-float"
	;;
i960-*-*)
	multidirs=float
	;;
sparclite-*-* | sparclitefrw*-*-*)
	multidirs="mfpu msoft-float mflat mno-flat mfpu/mflat mfpu/mno-flat msoft-float/mflat msoft-float/mno-flat"
	;;
sparc-*-* | sparcfrw*-*-*)
	multidirs="soft v8 soft/v8"
	;;
z8k-*-coff)
	multidirs="z8001 std z8001/std"
	;;
h8300-*-*)
	multidirs=h8300h
	;;
h8500-*-*)
	multidirs="mbig msmall mcompact mmedium"
	;;
sh-*-*)
	multidirs="ml m2 ml/m2"
	;;
mips*-*-*)
	# Note that not all of these will be built for a particular
	# target; what is build depends upon the output gcc
	# --print-multi-lib.  We configure them all, to make our life
	# simpler here.  If somebody cares about configuration
	# efficiency, they will need to switch off on the various
	# targets to configure just the directories needed for that
	# target.
	# 
	# In the long run, it would be better to configure based on
	# the output of gcc --print-multi-lib, but, to do that, we
	# would have to build gcc before configuring newlib.
	#
	# Default to including the single-float directories.
	if [ x$enable_single_float = x ]; then
	  enable_single_float=yes
	fi
	if [ x$enable_single_float = xyes ]; then
	  multidirs="soft-float single el eb mips1 mips3 soft-float/el soft-float/eb soft-float/mips1 soft-float/mips3 soft-float/el/mips1 soft-float/el/mips3 soft-float/eb/mips1 soft-float/eb/mips3 single/el single/eb single/mips1 single/mips3 single/el/mips1 single/el/mips3 single/eb/mips1 single/eb/mips3 el/mips1 el/mips3 eb/mips1 eb/mips3"
	else
	  multidirs="soft-float el eb mips1 mips3 soft-float/el soft-float/eb soft-float/mips1 soft-float/mips3 soft-float/el/mips1 soft-float/el/mips3 soft-float/eb/mips1 soft-float/eb/mips3 el/mips1 el/mips3 eb/mips1 eb/mips3"
	fi
	if [ x$enable_biendian = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *endian* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_softfloat = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *soft-float* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_relocatable = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *relocatable* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_sysv = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *sysv* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	;;
powerpc-ibm-aix* | rs6000-ibm-aix*)
	multidirs="soft-float common soft-float/common"
	if [ x$enable_softfloat = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *soft-float* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_commoncpu = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *common* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	;;
powerpc-*-eabiaix*)
	multidirs="soft-float relocatable little sysv little/sysv relocatable/little relocatable/sysv relocatable/little/sysv soft-float/relocatable soft-float/little soft-float/sysv soft-float/little/sysv soft-float/relocatable/little soft-float/relocatable/sysv soft-float/relocatable/little/sysv"
	if [ x$enable_biendian = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *endian* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_softfloat = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *soft-float* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_relocatable = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *relocatable* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_sysv = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *sysv* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	;;
powerpc-*-eabi* | powerpc-*-elf* | powerpc-*-sysv4*)
	multidirs="soft-float relocatable little aix little/aix relocatable/little relocatable/aix relocatable/little/aix soft-float/relocatable soft-float/little soft-float/aix soft-float/little/aix soft-float/relocatable/little soft-float/relocatable/aix soft-float/relocatable/little/aix aixdesc soft-float/aixdesc"
	if [ x$enable_biendian = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *endian* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_softfloat = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *soft-float* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_relocatable = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *relocatable* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_aix = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *aix* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	;;
powerpcle-*-eabi* | powerpcle-*-elf* | powerpcle-*-sysv4*)
	multidirs="soft-float relocatable big aix big/aix relocatable/big relocatable/aix relocatable/big/aix soft-float/relocatable soft-float/big soft-float/aix soft-float/big/aix soft-float/relocatable/big soft-float/relocatable/aix soft-float/relocatable/big/aix"
	if [ x$enable_biendian = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *endian* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_softfloat = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *soft-float* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_relocatable = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *relocatable* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	if [ x$enable_aix = xno ]
	then
	  old_multidirs="${multidirs}"
	  multidirs=""
	  for x in ${old_multidirs}; do
	    case "$x" in
	      *aix* ) : ;;
	      *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
	    esac
	  done
	fi
	;;
*)
	multidirs=
	;;
esac

# We must freshly configure each subdirectory.  This bit of code is
# actually partially stolen from the main configure script.  FIXME.

if [ -n "${multidirs}" ] && [ -z "${norecursion}" ]; then
  for dir in ${multidirs}; do

    if [ -d ${dir} ]; then true; else mkdir ${dir}; fi

    dotdot=../`echo ${dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`

    case ${srcdir} in
    ".")
      echo Building symlink tree in `pwd`/${dir}
      rm -f tmpconfig
      cat >tmpconfig <<\EOF
#!/bin/sh
for f in `ls -a $1`; do
  if [ -d $1$f ]; then
    found=
    for i in $2; do
      if [ "$f" = "$i" ]; then
	found=yes
      fi
    done
    if [ -z "${found}" ]; then
      if [ -d $f ]; then true; else mkdir $f; fi
      (cd $f; ../$0 ../$1$f/ "$2")
    fi
  else
    rm -f $f
    ln -s $1$f .
  fi
done
EOF
      chmod +x tmpconfig
      (cd ${dir};
       ${dotdot}tmpconfig ${dotdot} ". .. CVS tmpconfig ${multidirs}")
      rm -f tmpconfig
      srcdiroption=
      multilib_top=${dotdot}
      ;;
    *)
      case "${srcdir}" in
      /*) # absolute path
        newsrcdir=${srcdir}/${configdir}
        ;;
      *) # otherwise relative
        newsrcdir=${dotdot}${srcdir}/${configdir}
        ;;
      esac
      srcdiroption="-srcdir=${newsrcdir}"
      multilib_top=${newsrcdir}
      ;;
    esac

    case "${progname}" in
    /*)     recprog=${progname} ;;
    *)      recprog=${dotdot}${progname} ;;
    esac

    POPDIR=${PWD=`pwd`}
    cd ${dir}
    if eval ${config_shell} ${recprog} ${verbose} \
	--with-multisubdir=${dir} --with-multilib-top=${multilib_top} \
	${buildopt} --host=${host_alias} --target=${target_alias} \
        ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
        ${srcdiroption} ${program_prefixoption} ${program_suffixoption} \
	${program_transform_nameoption} ${site_option} ${withoptions} \
	${withoutoptions} ${enableoptions} ${disableoptions} \
	${cache_file_option} ${removing} ${other_options} ${redirect} ; then
      true
    else
      exit 1
    fi

    cd ${POPDIR}

  done
fi

fi # ${enable_multilib = yes -a -z ${with_multisubdir}