* interp.c (callback): Remove last change. It is initialized by
[external/binutils.git] / cfg-ml-com.in
1 # Configure fragment invoked in the common section for subdirs
2 # wanting multilib support.
3 #
4 # The common section was chosen because xiberty clobbers $srcdir in the
5 # common section of its configure.in.
6 #
7 # The intent is to keep as much of this in one place as possible (and out
8 # of each subdirectory, eg: newlib, libio, etc.) until the right way to do
9 # this (ha ha) is decided upon.
10 #
11 # This is where a target selects what multilib directories to build.
12 # It is advisable to support a few --enable/--disable options to let the
13 # user select which libraries s/he really wants.
14 #
15 # Subdirectories wishing to use multilib should put the following lines
16 # in the initial ("common") section of configure.in:
17 #
18 #if [ -n "${with_multilib_top}" ]; then
19 #       . ${with_multilib_top}/../cfg-ml-com.in
20 #else
21 #       . ${srcdir}/../cfg-ml-com.in
22 #fi
23 #
24 # `with_multilib_top' exists to handle the case of configuring in the source
25 # tree: ${srcdir} is not constant.
26 #
27 # The following should be added to the "post-target" section of configure.in:
28 #
29 #if [ -n "${with_multilib_top}" ]; then
30 #       . ${with_multilib_top}/../cfg-ml-pos.in
31 #else
32 #       . ${srcdir}/../cfg-ml-pos.in
33 #fi
34
35 # FIXME: Multilib is currently disabled by default for everything other than
36 # newlib.  It is up to each target to turn on multilib support for the other
37 # libraries as desired.
38 #
39 # FIXME: It would be better if we could use the --print-multi-lib switch to
40 # gcc to get the list of directories to build, but at this point the compiler
41 # has not been built.
42
43 # Only do this if --enable-multilib.
44 # And only if at the top level, not a multilib subdirectory.
45
46 if [ "${enable_multilib}" = yes -a -z "${with_multisubdir}" ]; then
47
48 # Doing this in the common section means ${target} isn't set yet, so compute
49 # a copy here.  This is a bit kludgey, but again the current (short term) goal
50 # is to be as unobtrusive (sp?) to the rest of the sources as possible.
51
52 if result=`${config_shell} ${configsub} ${target_alias}` ; then
53     true
54 else
55     echo "Unrecognized target system name ${target_alias}." 1>&2
56     exit 1
57 fi
58 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
59 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
60 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
61 target=${target_cpu}-${target_vendor}-${target_os}
62
63 # FIXME: Perhaps we can do something like the following instead.
64 # Fetch from gcc the multilib directories to use if we can.
65 # if [ -f ${srcdir}/../gcc/genmultilib -a -f ../gcc/Makefile ]; then
66 #   options=`grep "^MULTILIB_OPTIONS" ../gcc/Makefile | sed -e 's/^.*=//'`
67 #   multidirs=`${srcdir}/../gcc/genmultilib "$options" | \
68 #       sed -e 's/^#define.*//' -e 's/^[.].*//' -e 's/".*//' -e 's/ .*//'`
69 # else
70 #   multidirs=""
71 # fi
72
73 case "${target}" in
74 # start-sanitize-arc
75 arc-sbp-elf*)
76         if [ x$enable_biendian = xyes ]
77         then
78                 multidirs="be host graphics audio be/host be/graphics be/audio"
79         else
80                 multidirs="host graphics audio"
81         fi
82         ;;
83 arc-*-*)
84         multidirs="be"
85         ;;
86 # end-sanitize-arc
87 hppa*-*-*)
88         multidirs="soft-float"
89         ;;
90 m68*-*-aout* | m68*-*-coff* | m68*-*-elf* | m68*-*-vxworks*)
91         multidirs="m68000 m68020 m68881 msoft-float m68000/m68881 m68000/msoft-float m68020/m68881 m68020/msoft-float"
92         ;;
93 i960-*-*)
94         multidirs=float
95         ;;
96 sparclite-*-* | sparclitefrw*-*-*)
97         multidirs="mfpu msoft-float mflat mno-flat mfpu/mflat mfpu/mno-flat msoft-float/mflat msoft-float/mno-flat"
98         ;;
99 sparc-*-* | sparcfrw*-*-*)
100         multidirs="soft v8 soft/v8"
101         ;;
102 z8k-*-coff)
103         multidirs="z8001 std z8001/std"
104         ;;
105 h8300-*-*)
106         multidirs=h8300h
107         ;;
108 h8500-*-*)
109         multidirs="mbig msmall mcompact mmedium"
110         ;;
111 sh-*-*)
112         multidirs="ml"
113 # start-sanitize-sh3e
114         multidirs="ml m3e"
115 # end-sanitize-sh3e
116         ;;
117 mips*-*-*)
118         # Note that not all of these will be built for a particular
119         # target; what is build depends upon the output gcc
120         # --print-multi-lib.  We configure them all, to make our life
121         # simpler here.  If somebody cares about configuration
122         # efficiency, they will need to switch off on the various
123         # targets to configure just the directories needed for that
124         # target.
125         # 
126         # In the long run, it would be better to configure based on
127         # the output of gcc --print-multi-lib, but, to do that, we
128         # would have to build gcc before configuring newlib.
129         #
130         # Default to including the single-float directories.
131         if [ x$enable_single_float = x ]; then
132           enable_single_float=yes
133         fi
134         if [ x$enable_single_float = xyes ]; then
135           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"
136         else
137           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"
138         fi
139         if [ x$enable_biendian = xno ]
140         then
141           old_multidirs="${multidirs}"
142           multidirs=""
143           for x in ${old_multidirs}; do
144             case "$x" in
145               *endian* ) : ;;
146               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
147             esac
148           done
149         fi
150         if [ x$enable_softfloat = xno ]
151         then
152           old_multidirs="${multidirs}"
153           multidirs=""
154           for x in ${old_multidirs}; do
155             case "$x" in
156               *soft-float* ) : ;;
157               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
158             esac
159           done
160         fi
161         if [ x$enable_relocatable = xno ]
162         then
163           old_multidirs="${multidirs}"
164           multidirs=""
165           for x in ${old_multidirs}; do
166             case "$x" in
167               *relocatable* ) : ;;
168               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
169             esac
170           done
171         fi
172         if [ x$enable_sysv = xno ]
173         then
174           old_multidirs="${multidirs}"
175           multidirs=""
176           for x in ${old_multidirs}; do
177             case "$x" in
178               *sysv* ) : ;;
179               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
180             esac
181           done
182         fi
183         ;;
184 powerpc-ibm-aix* | rs6000-ibm-aix*)
185         multidirs="soft-float common soft-float/common"
186         if [ x$enable_softfloat = xno ]
187         then
188           old_multidirs="${multidirs}"
189           multidirs=""
190           for x in ${old_multidirs}; do
191             case "$x" in
192               *soft-float* ) : ;;
193               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
194             esac
195           done
196         fi
197         if [ x$enable_commoncpu = xno ]
198         then
199           old_multidirs="${multidirs}"
200           multidirs=""
201           for x in ${old_multidirs}; do
202             case "$x" in
203               *common* ) : ;;
204               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
205             esac
206           done
207         fi
208         ;;
209 powerpc-*-eabiaix*)
210         multidirs="soft-float relocatable little-endian call-sysv little-endian/call-sysv relocatable/little-endian relocatable/call-sysv relocatable/little-endian/call-sysv soft-float/relocatable soft-float/little-endian soft-float/call-sysv soft-float/little-endian/call-sysv soft-float/relocatable/little-endian soft-float/relocatable/call-sysv soft-float/relocatable/little-endian/call-sysv"
211         if [ x$enable_biendian = xno ]
212         then
213           old_multidirs="${multidirs}"
214           multidirs=""
215           for x in ${old_multidirs}; do
216             case "$x" in
217               *endian* ) : ;;
218               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
219             esac
220           done
221         fi
222         if [ x$enable_softfloat = xno ]
223         then
224           old_multidirs="${multidirs}"
225           multidirs=""
226           for x in ${old_multidirs}; do
227             case "$x" in
228               *soft-float* ) : ;;
229               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
230             esac
231           done
232         fi
233         if [ x$enable_relocatable = xno ]
234         then
235           old_multidirs="${multidirs}"
236           multidirs=""
237           for x in ${old_multidirs}; do
238             case "$x" in
239               *relocatable* ) : ;;
240               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
241             esac
242           done
243         fi
244         if [ x$enable_sysv = xno ]
245         then
246           old_multidirs="${multidirs}"
247           multidirs=""
248           for x in ${old_multidirs}; do
249             case "$x" in
250               *sysv* ) : ;;
251               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
252             esac
253           done
254         fi
255         ;;
256 powerpc*-*-eabisim*)    # don't both with {aix,aixdesc}/mrelocatable configurations
257         multidirs="little-endian big-endian aix aixdesc mrelocatable little-endian/mrelocatable big-endian/mrelocatable"
258         if [ x$enable_biendian = xno ]
259         then
260           old_multidirs="${multidirs}"
261           multidirs=""
262           for x in ${old_multidirs}; do
263             case "$x" in
264               *endian* ) : ;;
265               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
266             esac
267           done
268         fi
269         if [ x$enable_aix = xno ]
270         then
271           old_multidirs="${multidirs}"
272           multidirs=""
273           for x in ${old_multidirs}; do
274             case "$x" in
275               *aix* ) : ;;
276               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
277             esac
278           done
279         fi
280         if [ x$enable_relocatable = xno ]
281         then
282           old_multidirs="${multidirs}"
283           multidirs=""
284           for x in ${old_multidirs}; do
285             case "$x" in
286               *relocatable* ) : ;;
287               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
288             esac
289           done
290         fi
291         ;;
292 powerpc-*-eabi* | powerpc-*-elf* | powerpc-*-sysv4*)
293         multidirs="soft-float relocatable little-endian call-aix little-endian/call-aix relocatable/little-endian relocatable/call-aix relocatable/little-endian/call-aix soft-float/relocatable soft-float/little-endian soft-float/call-aix soft-float/little-endian/call-aix soft-float/relocatable/little-endian soft-float/relocatable/call-aix soft-float/relocatable/little-endian/call-aix"
294         if [ x$enable_biendian = xno ]
295         then
296           old_multidirs="${multidirs}"
297           multidirs=""
298           for x in ${old_multidirs}; do
299             case "$x" in
300               *endian* ) : ;;
301               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
302             esac
303           done
304         fi
305         if [ x$enable_softfloat = xno ]
306         then
307           old_multidirs="${multidirs}"
308           multidirs=""
309           for x in ${old_multidirs}; do
310             case "$x" in
311               *soft-float* ) : ;;
312               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
313             esac
314           done
315         fi
316         if [ x$enable_relocatable = xno ]
317         then
318           old_multidirs="${multidirs}"
319           multidirs=""
320           for x in ${old_multidirs}; do
321             case "$x" in
322               *relocatable* ) : ;;
323               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
324             esac
325           done
326         fi
327         if [ x$enable_aix = xno ]
328         then
329           old_multidirs="${multidirs}"
330           multidirs=""
331           for x in ${old_multidirs}; do
332             case "$x" in
333               *aix* ) : ;;
334               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
335             esac
336           done
337         fi
338         ;;
339 powerpcle-*-eabi* | powerpcle-*-elf* | powerpcle-*-sysv4*)
340         multidirs="soft-float relocatable big-endian call-aix big-endian/call-aix relocatable/big-endian relocatable/call-aix relocatable/big-endian/call-aix soft-float/relocatable soft-float/big-endian soft-float/call-aix soft-float/big-endian/call-aix soft-float/relocatable/big-endian soft-float/relocatable/call-aix soft-float/relocatable/big-endian/call-aix"
341         if [ x$enable_biendian = xno ]
342         then
343           old_multidirs="${multidirs}"
344           multidirs=""
345           for x in ${old_multidirs}; do
346             case "$x" in
347               *endian* ) : ;;
348               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
349             esac
350           done
351         fi
352         if [ x$enable_softfloat = xno ]
353         then
354           old_multidirs="${multidirs}"
355           multidirs=""
356           for x in ${old_multidirs}; do
357             case "$x" in
358               *soft-float* ) : ;;
359               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
360             esac
361           done
362         fi
363         if [ x$enable_relocatable = xno ]
364         then
365           old_multidirs="${multidirs}"
366           multidirs=""
367           for x in ${old_multidirs}; do
368             case "$x" in
369               *relocatable* ) : ;;
370               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
371             esac
372           done
373         fi
374         if [ x$enable_aix = xno ]
375         then
376           old_multidirs="${multidirs}"
377           multidirs=""
378           for x in ${old_multidirs}; do
379             case "$x" in
380               *aix* ) : ;;
381               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
382             esac
383           done
384         fi
385         ;;
386 *)
387         multidirs=
388         ;;
389 esac
390
391 # We must freshly configure each subdirectory.  This bit of code is
392 # actually partially stolen from the main configure script.  FIXME.
393
394 if [ -n "${multidirs}" ] && [ -z "${norecursion}" ]; then
395   for dir in ${multidirs}; do
396
397     if [ -d ${dir} ]; then true; else mkdir ${dir}; fi
398
399     dotdot=../`echo ${dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
400
401     case ${srcdir} in
402     ".")
403       echo Building symlink tree in `pwd`/${dir}
404       rm -f tmpconfig
405       cat >tmpconfig <<\EOF
406 #!/bin/sh
407 for f in `ls -a $1`; do
408   if [ -d $1$f ]; then
409     found=
410     for i in $2; do
411       if [ "$f" = "$i" ]; then
412         found=yes
413       fi
414     done
415     if [ -z "${found}" ]; then
416       if [ -d $f ]; then true; else mkdir $f; fi
417       (cd $f; ../$0 ../$1$f/ "$2")
418     fi
419   else
420     rm -f $f
421     ln -s $1$f .
422   fi
423 done
424 EOF
425       chmod +x tmpconfig
426       (cd ${dir};
427        ${dotdot}tmpconfig ${dotdot} ". .. CVS tmpconfig ${multidirs}")
428       rm -f tmpconfig
429       srcdiroption=
430       multilib_top=${dotdot}
431       ;;
432     *)
433       case "${srcdir}" in
434       /*) # absolute path
435         newsrcdir=${srcdir}/${configdir}
436         ;;
437       *) # otherwise relative
438         newsrcdir=${dotdot}${srcdir}/${configdir}
439         ;;
440       esac
441       srcdiroption="-srcdir=${newsrcdir}"
442       multilib_top=${newsrcdir}
443       ;;
444     esac
445
446     case "${progname}" in
447     /*)     recprog=${progname} ;;
448     *)      recprog=${dotdot}${progname} ;;
449     esac
450
451     POPDIR=${PWD=`pwd`}
452     cd ${dir}
453     if eval ${config_shell} ${recprog} ${verbose} \
454         --with-multisubdir=${dir} --with-multilib-top=${multilib_top} \
455         ${buildopt} --host=${host_alias} --target=${target_alias} \
456         ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
457         ${srcdiroption} ${program_prefixoption} ${program_suffixoption} \
458         ${program_transform_nameoption} ${site_option} ${withoptions} \
459         ${withoutoptions} ${enableoptions} ${disableoptions} \
460         ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
461       true
462     else
463       exit 1
464     fi
465
466     cd ${POPDIR}
467
468   done
469 fi
470
471 fi # ${enable_multilib = yes -a -z ${with_multisubdir}