Change PAGE_SIZE to TARGET_PAGE_SIZE
[platform/upstream/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 # start-sanitize-jaguar
112 jaguar-*-*)
113         multidirs="be"
114         ;;
115 # end-sanitize-jaguar
116 sh-*-*)
117         multidirs="ml"
118 # start-sanitize-sh3e
119         multidirs="ml m3e"
120 # end-sanitize-sh3e
121         ;;
122 mips*-*-*)
123         # Note that not all of these will be built for a particular
124         # target; what is build depends upon the output gcc
125         # --print-multi-lib.  We configure them all, to make our life
126         # simpler here.  If somebody cares about configuration
127         # efficiency, they will need to switch off on the various
128         # targets to configure just the directories needed for that
129         # target.
130         # 
131         # In the long run, it would be better to configure based on
132         # the output of gcc --print-multi-lib, but, to do that, we
133         # would have to build gcc before configuring newlib.
134         #
135         # Default to including the single-float directories.
136         if [ x$enable_single_float = x ]; then
137           enable_single_float=yes
138         fi
139         if [ x$enable_single_float = xyes ]; then
140           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"
141         else
142           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"
143         fi
144         if [ x$enable_biendian = xno ]
145         then
146           old_multidirs="${multidirs}"
147           multidirs=""
148           for x in ${old_multidirs}; do
149             case "$x" in
150               *endian* ) : ;;
151               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
152             esac
153           done
154         fi
155         if [ x$enable_softfloat = xno ]
156         then
157           old_multidirs="${multidirs}"
158           multidirs=""
159           for x in ${old_multidirs}; do
160             case "$x" in
161               *soft-float* ) : ;;
162               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
163             esac
164           done
165         fi
166         if [ x$enable_relocatable = xno ]
167         then
168           old_multidirs="${multidirs}"
169           multidirs=""
170           for x in ${old_multidirs}; do
171             case "$x" in
172               *relocatable* ) : ;;
173               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
174             esac
175           done
176         fi
177         if [ x$enable_sysv = xno ]
178         then
179           old_multidirs="${multidirs}"
180           multidirs=""
181           for x in ${old_multidirs}; do
182             case "$x" in
183               *sysv* ) : ;;
184               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
185             esac
186           done
187         fi
188         ;;
189 powerpc-ibm-aix* | rs6000-ibm-aix*)
190         multidirs="soft-float common soft-float/common"
191         if [ x$enable_softfloat = xno ]
192         then
193           old_multidirs="${multidirs}"
194           multidirs=""
195           for x in ${old_multidirs}; do
196             case "$x" in
197               *soft-float* ) : ;;
198               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
199             esac
200           done
201         fi
202         if [ x$enable_commoncpu = xno ]
203         then
204           old_multidirs="${multidirs}"
205           multidirs=""
206           for x in ${old_multidirs}; do
207             case "$x" in
208               *common* ) : ;;
209               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
210             esac
211           done
212         fi
213         ;;
214 powerpc-*-eabiaix*)
215         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"
216         if [ x$enable_biendian = xno ]
217         then
218           old_multidirs="${multidirs}"
219           multidirs=""
220           for x in ${old_multidirs}; do
221             case "$x" in
222               *endian* ) : ;;
223               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
224             esac
225           done
226         fi
227         if [ x$enable_softfloat = xno ]
228         then
229           old_multidirs="${multidirs}"
230           multidirs=""
231           for x in ${old_multidirs}; do
232             case "$x" in
233               *soft-float* ) : ;;
234               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
235             esac
236           done
237         fi
238         if [ x$enable_relocatable = xno ]
239         then
240           old_multidirs="${multidirs}"
241           multidirs=""
242           for x in ${old_multidirs}; do
243             case "$x" in
244               *relocatable* ) : ;;
245               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
246             esac
247           done
248         fi
249         if [ x$enable_sysv = xno ]
250         then
251           old_multidirs="${multidirs}"
252           multidirs=""
253           for x in ${old_multidirs}; do
254             case "$x" in
255               *sysv* ) : ;;
256               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
257             esac
258           done
259         fi
260         ;;
261 powerpc-*-eabi* | powerpc-*-elf* | powerpc-*-sysv4*)
262         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"
263         if [ x$enable_biendian = xno ]
264         then
265           old_multidirs="${multidirs}"
266           multidirs=""
267           for x in ${old_multidirs}; do
268             case "$x" in
269               *endian* ) : ;;
270               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
271             esac
272           done
273         fi
274         if [ x$enable_softfloat = xno ]
275         then
276           old_multidirs="${multidirs}"
277           multidirs=""
278           for x in ${old_multidirs}; do
279             case "$x" in
280               *soft-float* ) : ;;
281               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
282             esac
283           done
284         fi
285         if [ x$enable_relocatable = xno ]
286         then
287           old_multidirs="${multidirs}"
288           multidirs=""
289           for x in ${old_multidirs}; do
290             case "$x" in
291               *relocatable* ) : ;;
292               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
293             esac
294           done
295         fi
296         if [ x$enable_aix = xno ]
297         then
298           old_multidirs="${multidirs}"
299           multidirs=""
300           for x in ${old_multidirs}; do
301             case "$x" in
302               *aix* ) : ;;
303               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
304             esac
305           done
306         fi
307         ;;
308 powerpcle-*-eabi* | powerpcle-*-elf* | powerpcle-*-sysv4*)
309         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"
310         if [ x$enable_biendian = xno ]
311         then
312           old_multidirs="${multidirs}"
313           multidirs=""
314           for x in ${old_multidirs}; do
315             case "$x" in
316               *endian* ) : ;;
317               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
318             esac
319           done
320         fi
321         if [ x$enable_softfloat = xno ]
322         then
323           old_multidirs="${multidirs}"
324           multidirs=""
325           for x in ${old_multidirs}; do
326             case "$x" in
327               *soft-float* ) : ;;
328               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
329             esac
330           done
331         fi
332         if [ x$enable_relocatable = xno ]
333         then
334           old_multidirs="${multidirs}"
335           multidirs=""
336           for x in ${old_multidirs}; do
337             case "$x" in
338               *relocatable* ) : ;;
339               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
340             esac
341           done
342         fi
343         if [ x$enable_aix = xno ]
344         then
345           old_multidirs="${multidirs}"
346           multidirs=""
347           for x in ${old_multidirs}; do
348             case "$x" in
349               *aix* ) : ;;
350               *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
351             esac
352           done
353         fi
354         ;;
355 *)
356         multidirs=
357         ;;
358 esac
359
360 # We must freshly configure each subdirectory.  This bit of code is
361 # actually partially stolen from the main configure script.  FIXME.
362
363 if [ -n "${multidirs}" ] && [ -z "${norecursion}" ]; then
364   for dir in ${multidirs}; do
365
366     if [ -d ${dir} ]; then true; else mkdir ${dir}; fi
367
368     dotdot=../`echo ${dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
369
370     case ${srcdir} in
371     ".")
372       echo Building symlink tree in `pwd`/${dir}
373       rm -f tmpconfig
374       cat >tmpconfig <<\EOF
375 #!/bin/sh
376 for f in `ls -a $1`; do
377   if [ -d $1$f ]; then
378     found=
379     for i in $2; do
380       if [ "$f" = "$i" ]; then
381         found=yes
382       fi
383     done
384     if [ -z "${found}" ]; then
385       if [ -d $f ]; then true; else mkdir $f; fi
386       (cd $f; ../$0 ../$1$f/ "$2")
387     fi
388   else
389     rm -f $f
390     ln -s $1$f .
391   fi
392 done
393 EOF
394       chmod +x tmpconfig
395       (cd ${dir};
396        ${dotdot}tmpconfig ${dotdot} ". .. CVS tmpconfig ${multidirs}")
397       rm -f tmpconfig
398       srcdiroption=
399       multilib_top=${dotdot}
400       ;;
401     *)
402       case "${srcdir}" in
403       /*) # absolute path
404         newsrcdir=${srcdir}/${configdir}
405         ;;
406       *) # otherwise relative
407         newsrcdir=${dotdot}${srcdir}/${configdir}
408         ;;
409       esac
410       srcdiroption="-srcdir=${newsrcdir}"
411       multilib_top=${newsrcdir}
412       ;;
413     esac
414
415     case "${progname}" in
416     /*)     recprog=${progname} ;;
417     *)      recprog=${dotdot}${progname} ;;
418     esac
419
420     POPDIR=${PWD=`pwd`}
421     cd ${dir}
422     if eval ${config_shell} ${recprog} ${verbose} \
423         --with-multisubdir=${dir} --with-multilib-top=${multilib_top} \
424         ${buildopt} --host=${host_alias} --target=${target_alias} \
425         ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
426         ${srcdiroption} ${program_prefixoption} ${program_suffixoption} \
427         ${program_transform_nameoption} ${site_option} ${withoptions} \
428         ${withoutoptions} ${enableoptions} ${disableoptions} \
429         ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
430       true
431     else
432       exit 1
433     fi
434
435     cd ${POPDIR}
436
437   done
438 fi
439
440 fi # ${enable_multilib = yes -a -z ${with_multisubdir}