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