OSDN Git Service

merge from gcc
[pf3gnuchains/sourceware.git] / newlib / configure.host
1 # configure.host
2
3 # This shell script handles all host based configuration for newlib.
4 # It sets various shell variables based on the the host and the
5 # configuration options.  You can modify this shell script without
6 # needing to rerun autoconf.
7
8 # This shell script should be invoked as
9 #   . configure.host
10 # If it encounters an error, it will exit with a message.
11
12 # FIXME: This script is too complicated.  It does things in too many
13 # different ways.  This was taken from the old Cygnus configure script
14 # with only minor changes.  It should be cleaned up.
15
16 # FIXME: The general approach of picking and choosing which
17 # directories to configure, other than machine_dir and sys_dir, is
18 # potentially confusing.
19
20 # It uses the following shell variables:
21 #   host                The configuration host
22 #   host_cpu            The configuration host CPU
23 #   newlib_mb           --enable-newlib-mb ("yes", "no")
24 #   target_optspace     --enable-target-optspace ("yes", "no", "")
25 #   newlib_multithread  --enable-newlib-multithread ("yes", "no", "yes")
26 #   newlib_elix_level   --enable-newlib-elix-level ("1","2","3","4") ("4")
27 #   newlib_io_c99_formats --enable-newlib-io-c99-formats ("yes", "no", "")
28 #   newlib_io_long_long --enable-newlib-io-long-long ("yes", "no", "")
29 #   newlib_io_long_double --enable-newlib-io-long-double ("yes", "no", "")
30
31 # It sets the following shell variables:
32 #   newlib_cflags       Special CFLAGS to use when building
33 #   machine_dir         Subdirectory of libc/machine to configure
34 #   sys_dir             Subdirectory of libc/sys to configure
35 #   have_sys_mach_dir   Is there a machine subdirectory in sys subdirectory
36 #   posix_dir           "posix" to build libc/posix, "" otherwise
37 #   signal_dir          "signal" to build libc/signal, "" otherwise
38 #   stdio64_dir         "stdio64" to build libc/stdio64, "" otherwise
39 #   syscall_dir         "syscalls" to build libc/syscalls, "" otherwise
40 #   unix_dir            "unix" to build libc/unix, "" otherwise
41 #   use_libtool         flag: use libtool to build newlib?
42 #   aext                library extension - needed for libtool support
43 #   oext                object file extension - needed for libtool support
44 #   lpfx                library object prefix - generated when no libtool
45 #   crt1                name of crt1 object if one is provided
46 #   crt1_dir            directory where crt1 object is found
47 #   have_crt0           "yes"/"no" if crt0 is/isn't provided.
48 #                       "" if crt0 is provided when sys_dir is set
49
50 newlib_cflags=
51 libm_machine_dir=
52 machine_dir=
53 sys_dir=
54 posix_dir=
55 signal_dir=signal
56 stdio_dir=stdio
57 stdio64_dir=
58 syscall_dir=
59 unix_dir=
60 mach_add_setjmp=
61 crt1=
62 crt1_dir=
63 have_crt0=
64 use_libtool=no
65 have_sys_mach_dir=no
66 default_newlib_io_c99_formats=no
67 default_newlib_io_long_long=no
68 default_newlib_io_long_double=no
69 default_newlib_io_pos_args=no
70 default_newlib_atexit_dynamic_alloc=yes
71 aext=a
72 oext=o
73 lpfx="lib_a-"
74
75 case "${target_optspace}:${host}" in
76   yes:*)
77     newlib_cflags="${newlib_cflags} -Os"
78     ;;
79   :m32r-* | :d10v-* | :d30v-* | :avr-* | :m32c-* )
80     newlib_cflags="${newlib_cflags} -Os"
81     ;;
82   no:* | :*)
83     ;;
84 esac
85
86 # Get the source directories to use for the CPU type.
87 # machine_dir should supply CPU dependent routines, such as setjmp.
88 # newlib_cflags is passed to gcc when compiling.
89 # THIS TABLE IS ALPHA SORTED.  KEEP IT THAT WAY.
90
91 case "${host_cpu}" in
92   a29k)
93         machine_dir=a29k
94         ;;
95   arc)
96         machine_dir=
97         ;;
98   arm)
99         machine_dir=arm
100         ;;
101   avr*)
102         newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mcall-prologues"
103         ;;
104   bfin)
105         machine_dir=bfin
106         ;;
107   cris | crisv32)
108         machine_dir=cris
109         ;;
110   crx*)
111         machine_dir=crx
112         ;;
113   d10v*)
114         machine_dir=d10v
115         ;;
116   d30v*)
117         machine_dir=d30v
118         ;;
119   ep9312)
120         machine_dir=arm
121         ;;
122   fido)
123         machine_dir=m68k
124         newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
125         ;;
126   fr30)
127         machine_dir=fr30
128         ;;
129   frv)
130         machine_dir=frv
131         ;;
132   h8300)
133         machine_dir=h8300
134         ;;
135   h8500)
136         machine_dir=h8500
137         ;;
138   hppa*)
139         machine_dir=hppa
140         ;;
141   i960)
142         machine_dir=i960
143         ;;
144   i[34567]86)
145         # Don't use for these since they provide their own setjmp.
146         case ${host} in
147         *-*-sco* | *-*-cygwin*) 
148                 libm_machine_dir=i386
149                 machine_dir=i386
150                 ;;
151         *) 
152                 libm_machine_dir=i386
153                 machine_dir=i386
154                 mach_add_setjmp=true
155                 ;;
156         esac
157         ;;
158   ia64*)
159         ;;
160   iq2000)
161         machine_dir=iq2000
162         ;;
163   lm32)
164         machine_dir=lm32
165         ;;
166   m32c)
167         machine_dir=m32c
168         newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
169         ;;
170
171   m32r*)
172         machine_dir=m32r
173         ;;
174
175   m68hc11|m6811|m68hc12|m6812)
176         machine_dir=m68hc11
177         newlib_cflags="-DPREFER_SIZE_OVER_SPEED -Os -mrelax"
178         CFLAGS="-g -Os"
179         ;;
180   
181   m68*)
182         machine_dir=m68k
183         newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
184         ;;
185   m88k)
186         machine_dir=m88k
187         newlib_cflags="${newlib_cflags} -m88000"
188         ;;
189   m88110)
190         machine_dir=m88k
191         newlib_cflags="${newlib_cflags} -m88110"
192         ;;
193   mcore)
194         ;;
195   microblaze)
196         machine_dir=microblaze
197         ;;
198   mep)
199         machine_dir=mep
200         ;;
201   mips*)
202         machine_dir=mips
203         ;;
204   mmix)
205         ;;
206   mn10200)
207         machine_dir=mn10200
208         ;;
209   mn10300)
210         default_newlib_io_long_long="yes"
211         machine_dir=mn10300
212         ;;
213   moxie)
214         machine_dir=moxie
215         ;;
216   mt*)
217         machine_dir=mt
218         ;;
219   or16)
220         ;;
221   or32)
222         ;;
223   powerpc*)
224         machine_dir=powerpc
225         ;;
226   rx)
227         machine_dir=rx
228         default_newlib_io_long_long="yes"
229         newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
230         ;;
231   sh | sh64)
232         machine_dir=sh
233         ;;
234   sparc*)
235         machine_dir=sparc
236         # FIXME: Might wish to make MALLOC_ALIGNMENT more generic.
237         newlib_cflags="${newlib_cflags} -DMALLOC_ALIGNMENT=8"
238         ;;
239   strongarm)
240         machine_dir=arm
241         ;;
242   xscale)
243         machine_dir=xscale
244         ;;
245   thumb)
246         machine_dir=arm
247         ;;
248   tic4x|c4x)
249         machine_dir=tic4x
250         ;;
251   tic80*)
252         machine_dir=tic80
253         ;;
254   v70)
255         ;;
256   v810)
257         ;;
258   v850)
259         machine_dir=v850
260         newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mv850 "
261         ;;
262   v850e)
263         machine_dir=v850
264         newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED "
265         ;;
266   w65*)
267         machine_dir=w65
268         ;;
269   x86_64)
270         machine_dir=x86_64
271         ;;
272   xc16x*)
273     machine_dir=xc16x
274     ;;
275   xstormy16)
276         machine_dir=xstormy16
277         newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED"
278         newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED"
279         ;;
280   z8k)
281         machine_dir=z8k
282         ;;
283   spu)
284         stdio_dir=
285         libm_machine_dir=spu
286         machine_dir=spu
287         newlib_cflags="${newlib_cflags} -D_POSIX_MODE"
288         newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED"
289         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
290         newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
291         ;;
292   *)
293         echo '***' "Newlib does not support CPU ${host_cpu}" 1>&2
294         exit 1
295         ;;
296 esac
297
298 # Disable thread support if requested.
299
300 if [ "${newlib_multithread}" = "no" ] ; then
301         newlib_cflags="${newlib_cflags} -D__SINGLE_THREAD__"
302 fi
303
304 # Disable syscall support if requested.
305
306 if [ "${newlib_may_supply_syscalls}" = "no" ] ; then
307         newlib_cflags="${newlib_cflags} -D__NO_SYSCALLS__"
308 fi
309
310 # Enable multibyte support if requested or it is defaulted
311 # for target.
312
313 if [ "x${newlib_mb}" = "x" ]; then
314         case "${host}" in
315           i[34567]86-pc-linux-*|*-*-cygwin*)
316                 newlib_mb=yes
317                 ;;
318         esac
319 fi
320
321 # Disable printf/scanf floating-point support if requested.
322
323 if [ "${newlib_io_float}" = "no" ] ; then
324         newlib_cflags="${newlib_cflags} -DNO_FLOATING_POINT"
325 fi
326
327 # Verify if shared newlib support is allowed and set appropriate variables
328 # We don't want to use libtool for platforms that we are not going to
329 # support shared libraries.  This is because it adds executable tests which
330 # we don't want for most embedded platforms.
331 case "${host}" in
332   i[34567]86-pc-linux-*)
333     use_libtool=yes
334     have_sys_mach_dir=yes
335     stdio64_dir=stdio64
336     oext=lo
337     lpfx=
338     aext=la ;;
339   *) ;; #shared library not supported for ${host}
340 esac
341
342 # Get the source directories to use for the host.  unix_dir is set
343 # to unix to get some standard Unix routines.  posix_dir is set to get some
344 # standard Posix routines.  sys_dir should supply system dependent routines
345 # including crt0.
346 # THIS TABLE IS ALPHA SORTED.  KEEP IT THAT WAY.
347
348 case "${host}" in
349   *-*-cygwin*)
350         posix_dir=posix
351         stdio64_dir=stdio64
352         ;;
353   *-*-netware*)
354         signal_dir=
355         sys_dir=netware
356         ;;
357   *-*-rtems*)                   # generic RTEMS support
358         sys_dir=rtems
359         posix_dir=posix
360         unix_dir=unix
361         ;;
362   a29k-*-*)
363         sys_dir=a29khif
364         signal_dir=
365         ;;
366   arc-*-*)
367         sys_dir=arc
368         ;;
369   arm-*-*)
370         sys_dir=arm
371         if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
372           have_crt0="no"
373         fi
374         ;;
375   bfin-*-*)
376         sys_dir=
377         ;;
378   crx*)
379         sys_dir=
380         ;;
381   d10v*)
382         sys_dir=d10v
383         ;;
384   d30v*)
385         sys_dir=
386         ;;
387   ep9312-*-*)
388         sys_dir=arm
389         if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
390           have_crt0="no"
391         fi
392         ;;
393   frv*)
394         sys_dir=
395         ;;
396   h8300-*-hms*)
397         sys_dir=h8300hms
398         ;;
399   h8300-*-elf*)
400         sys_dir=h8300hms
401         ;;
402   h8300-*-coff*)
403         sys_dir=h8300hms
404         ;;
405   h8300-*-xray*)
406         sys_dir=h8300xray
407         ;;
408   h8500-*-hms*)
409         sys_dir=h8500hms
410         ;;
411   h8500-*-elf*)
412         sys_dir=h8500hms
413         ;;
414   i[34567]86-*-rdos*)
415         sys_dir=rdos
416         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
417         ;;
418   i[34567]86-*-sco*)
419         sys_dir=sysvi386
420         unix_dir=unix
421         ;;
422   i[34567]86-pc-linux-*)
423         sys_dir=linux
424         unix_dir=unix
425         posix_dir=posix
426         crt1=crt1.o
427         crt1_dir=libc/sys/${sys_dir}    
428         gcc_dir=`gcc -print-search-dirs | awk '/^install:/{print $2}'`
429         default_newlib_io_c99_formats="yes"
430         default_newlib_io_long_double="yes"
431         default_newlib_io_long_long="yes"
432         default_newlib_io_pos_args="yes"
433         #newlib_cflags="${newlib_cflags} -Werror" # DEBUGGING ONLY;BREAKS BUILD
434         newlib_cflags="${newlib_cflags} -Wall"
435         newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS"
436         newlib_cflags="${newlib_cflags} -DHAVE_FCNTL"
437         newlib_cflags="${newlib_cflags} -DHAVE_GETOPT"
438         # --- Required when building a shared library ------------------------
439         newlib_cflags="${newlib_cflags} -fPIC -D_I386MACH_NEED_SOTYPE_FUNCTION"
440         # --- The three lines below are optional ------------------------------
441         ##newlib_cflags="${newlib_cflags} -nostdinc"
442         ##newlib_cflags="${newlib_cflags} -I`newlib-flags --kernel-dir`/include"
443         ##newlib_cflags="${newlib_cflags} -idirafter ${gcc_dir}include"
444         ;;
445
446   m68hc11-*-*|m6811-*-*|m6812-*-*|m68hc12-*-*)
447         ;;
448
449   m68k-sun-sunos*)
450         unix_dir=unix
451         ;;
452   m8*-bug-*)
453         sys_dir=m88kbug
454         ;;
455   mep-*-*)
456         default_newlib_io_long_long="yes"
457         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
458         ;;
459   microblaze-*-*)
460         machine_dir=microblaze
461         ;;
462   mips*-dec-*)
463         sys_dir=decstation
464         ;;
465   mmix-knuth-mmixware)
466         sys_dir=mmixware
467         ;;
468   moxie*)
469         sys_dir=
470         ;;
471   powerpcle-*-pe)
472         posix_dir=posix
473         ;;
474   sh*-*)
475         sys_dir=sh
476         ;;
477   sparc-sun-sunos*)
478         sys_dir=sun4
479         unix_dir=unix
480         ;;
481   sparc64*)
482         sys_dir=sparc64
483         unix_dir=unix
484         ;;
485   spu-*-*)
486         default_newlib_io_long_long="yes"
487         default_newlib_atexit_dynamic_alloc="no"
488         ;;
489   strongarm-*-*)
490         sys_dir=arm
491         if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
492           have_crt0="no"
493         fi
494         ;;
495   thumb-*-*)
496         sys_dir=arm
497         if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
498           have_crt0="no"
499         fi
500         ;;
501   tic80*)
502         sys_dir=tic80
503         ;;
504   v70-nec-*)
505         sys_dir=sysvnecv70
506         ;;
507   v810-*-*)
508         sys_dir=sysnec810
509         ;;
510   v850-*-*)
511         sys_dir=sysnecv850
512         ;;
513   v850e-*-*)
514         sys_dir=sysnecv850
515         ;;
516   v850ea-*-*)
517         sys_dir=sysnecv850
518         ;;
519   w65-*-*)
520         sys_dir=w65
521         ;;
522   xscale-*-*)
523         sys_dir=arm
524         if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
525           have_crt0="no"
526         fi
527         ;;
528   z8k-*-coff)
529         sys_dir=z8ksim
530         ;;
531 esac
532
533 # Host specific flag settings -- usually for features that are not
534 # general enough or broad enough to be handled above.
535 # THIS TABLE IS ALPHA SORTED.  KEEP IT THAT WAY.
536
537 case "${host}" in
538   *-*-cygwin*)
539         test -z "$cygwin_srcdir" && cygwin_srcdir=`cd ${srcdir}/../winsup/cygwin; pwd`
540         export cygwin_srcdir
541         default_newlib_io_c99_formats="yes"
542         default_newlib_io_long_long="yes"
543         default_newlib_io_long_double="yes"
544         default_newlib_io_pos_args="yes"
545         CC="${CC} -I${cygwin_srcdir}/include"
546         newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DSIGNAL_PROVIDED -D_COMPILING_NEWLIB -DHAVE_BLKSIZE -DHAVE_FCNTL -DMALLOC_PROVIDED"
547         syscall_dir=syscalls
548         ;;
549 # RTEMS supplies its own versions of some routines:
550 #       malloc()            (reentrant version)
551 #       exit()              RTEMS has a "global" reent to flush
552 #       signal()/raise()    RTEMS has its own including pthread signals
553 #       _XYZ_r()            RTEMS has its own reentrant routines
554 #
555 #  NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that.
556   *-*-rtems*)
557         default_newlib_io_long_long="yes"
558         default_newlib_io_c99_formats="yes"
559         newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
560         # turn off unsupported items in posix directory 
561         newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN"
562         ;;
563 # VxWorks supplies its own version of malloc, and the newlib one
564 # doesn't work because VxWorks does not have sbrk.
565   *-wrs-vxworks*)
566         newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DMISSING_SYSCALL_NAMES -DHAVE_FCNTL"
567         ;;
568 # UDI doesn't have exec, so system() should fail the right way
569   a29k-amd-udi)
570         newlib_cflags="${newlib_cflags} -DNO_EXEC"
571         syscall_dir=syscalls
572         ;;
573   arc-*-*)
574         syscall_dir=syscalls
575         ;;
576   arm-*-pe)
577         syscall_dir=syscalls
578         ;;
579   arm-*-*)
580         syscall_dir=syscalls
581 # If newlib is supplying syscalls, select which debug protocol is being used.
582 # ARM_RDP_MONITOR selects the Demon monitor.
583 # ARM_RDI_MONITOR selects the Angel monitor.
584 # If neither are defined, then hard coded defaults will be used
585 # to create the program's environment.
586 # If --disable-newlib-supplied-syscalls is specified, then the end-user
587 # may specify the protocol via gcc spec files supplied by libgloss.
588 # See also thumb below.
589         if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
590 #         newlib_cflags="${newlib_cflags} -DARM_RDP_MONITOR"
591           newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
592         fi
593         ;;
594   arc*)
595         newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED"
596         ;;
597   avr*)
598         newlib_cflags="${newlib_cflags} -DNO_EXEC -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
599         ;;
600   bfin*)
601         syscall_dir=syscalls
602         ;;
603   cris-*-* | crisv32-*-*)
604         default_newlib_io_long_long="yes"
605         newlib_cflags="${newlib_cflags} -DHAVE_RENAME -D_USE_WRITE -DCOMPACT_CTYPE"
606         syscall_dir=syscalls
607         ;;
608   crx-*-*)
609         newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DMISSING_SYSCALL_NAMES"
610         syscall_dir=
611         ;;
612   d10v*)
613         newlib_cflags="${newlib_cflags} -DSMALL_MEMORY"
614         syscall_dir=syscalls
615         ;;
616   d30v*)
617         newlib_cflags="${newlib_cflags} -DABORT_MESSAGE -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
618         syscall_dir=
619         ;;
620   ep9312-*-*)
621         syscall_dir=syscalls
622         if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
623           newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
624         fi
625         ;;
626   fido-*-elf)
627         newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
628         syscall_dir=
629         ;;
630   fr30-*-*)
631         syscall_dir=syscalls
632         ;;
633   frv-*-*)
634         syscall_dir=syscalls
635         default_newlib_io_long_long="yes"
636         ;;
637   h8300*-*-*)
638         syscall_dir=syscalls    
639         default_newlib_io_long_long="yes"
640         newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
641         # Simulator only extensions for H8300.
642         # Uncomment the next line to enable them.
643         # newlib_cflags="${newlib_cflags} -D__SIMULATOR__"
644         ;;      
645   h8500-*-*)
646         syscall_dir=syscalls    
647         newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
648         ;;      
649   i[34567]86-*-sco*)
650         newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED -DHAVE_FCNTL"
651         ;;
652   i[34567]86-*-netware*)
653         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DABORT_PROVIDED -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DHAVE_FCNTL"
654         ;;
655   iq2000*)
656         syscall_dir=syscalls
657         default_newlib_io_long_long="yes"
658         ;;
659   lm32-*-*)
660         syscall_dir=syscalls
661         ;;
662   m32c-*-*)
663         default_newlib_io_long_long="yes"
664         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DABORT_PROVIDED"
665         syscall_dir=
666         ;;
667   m32r-*-*)
668         # Pass -msdata=sdata so _impure_ptr goes in .sdata.
669         # We don't generate sda relocs however for upward compatibility.
670         # FIXME: This is necessary because the default multilib doesn't
671         # use --print-multi-lib.
672         newlib_cflags="${newlib_cflags} -msdata=sdata"
673         syscall_dir=syscalls
674         ;;
675   m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
676         newlib_cflags="${newlib_cflags} -DNO_EXEC -DABORT_PROVIDED -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
677         ;;
678   m68k-unknown-elf)
679         newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
680         syscall_dir=
681         ;;
682   mcore-*-*)
683         syscall_dir=syscalls
684         ;;
685   microblaze-*-*)
686         default_newlib_io_long_long="yes"
687         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DSMALL_MEMORY -D_REENT_SMALL"
688         ;;
689   mips64vr*-*-*)
690         default_newlib_io_long_long="yes"
691         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
692         ;;
693   mips*-*-elf*)
694         default_newlib_io_long_long="yes"
695         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
696         ;;
697   mmix-*)
698         syscall_dir=syscalls
699         # We need every symbol 32-bit aligned, so the invalid
700         # construct with attribute ((alias ("_ctype_b+127"))) breaks.
701         newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
702         ;;
703   mn10?00-*-*)
704         syscall_dir=syscalls
705         ;;
706   moxie-*-*)
707         syscall_dir=syscalls
708         default_newlib_io_long_long="yes"
709         ;;
710   powerpc*-*-eabialtivec*)
711         default_newlib_io_long_long="yes"
712         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
713         ;;
714   powerpc*-*-eabispe*)
715         default_newlib_io_long_long="yes"
716         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
717         ;;
718   powerpc*-*-eabi* | \
719   powerpc*-*-elf* | \
720   powerpc*-*-linux* | \
721   powerpc*-*-rtem* | \
722   powerpc*-*-sysv* | \
723   powerpc*-*-solaris*)
724         default_newlib_io_long_long="yes"
725         newlib_cflags="${newlib_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES"
726         ;;
727   powerpcle-*-pe)
728         newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DHAVE_FCNTL"
729         syscall_dir=syscalls
730         ;;
731   sh*-*-*)
732         default_newlib_io_long_long="yes"
733         syscall_dir=syscalls
734         ;;
735   sparc-sun-sunos*)
736         newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
737         ;;
738   sparc64-*-*)
739         newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_BLKSIZE -DHAVE_FCNTL"
740         # This either belongs elsewhere or nowhere. But I need *something*,
741         # so for now it's here ...
742         case "${host_os}" in
743           aoutv8 | *32p)
744                 newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=32" ;;
745           *)
746                 newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=64" ;;
747         esac
748         ;;
749   strongarm-*-*)
750         syscall_dir=syscalls
751         ;;
752   thumb-*-pe)
753         syscall_dir=syscalls
754 # Don't use the debugging protocols just yet.
755         ;;
756   thumb-*-*)
757         syscall_dir=syscalls
758 # If newlib is supplying syscalls, select which debug protocol is being used.
759 # ARM_RDP_MONITOR selects the Demon monitor.
760 # ARM_RDI_MONITOR selects the Angel monitor.
761 # If neither are defined, then hard coded defaults will be used
762 # to create the program's environment.
763 # If --disable-newlib-supplied-syscalls is specified, then the end-user
764 # may specify the protocol via gcc spec files supplied by libgloss.
765         if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
766 #         newlib_cflags="${newlib_cflags} -DARM_RDP_MONITOR"
767           newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
768         fi
769         ;;
770   tic80*)
771         syscall_dir=syscalls
772         ;;
773   v850-*-*)
774         syscall_dir=syscalls
775         ;;
776   v850e-*-*)
777         syscall_dir=syscalls
778         ;;
779   v850ea-*-*)
780         syscall_dir=syscalls
781         ;;
782   w65-*-*)
783         syscall_dir=syscalls    
784         newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
785         ;;
786   xc16x-*)
787           syscall_dir=syscalls
788         ;;
789   xscale-*-*)
790         syscall_dir=syscalls
791         newlib_cflags="${newlib_cflags} -DHAVE_SYSTEM -DHAVE_RENAME"
792         if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
793           newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
794         fi
795         ;;
796   xstormy16-*-*)
797         syscall_dir=syscalls
798         ;;
799   z8k-*-*)
800         syscall_dir=syscalls
801         ;;
802   *)
803         newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
804         syscall_dir=
805         ;;
806 esac
807
808 # Use defaults for certain settings if not specified by user
809
810 # Enable C99 format support in I/O routines if requested.
811 if [ "x${newlib_io_c99_formats}" = "x" ]; then
812         if [ ${default_newlib_io_c99_formats} = "yes" ]; then
813                 newlib_io_c99_formats="yes";
814         fi
815 fi
816
817 # Enable long long support in I/O routines if requested.
818 if [ "x${newlib_io_long_long}" = "x" ]; then
819         if [ ${default_newlib_io_long_long} = "yes" ]; then
820                 newlib_io_long_long="yes";
821         fi
822 fi
823
824 # Enable long double support in I/O routines if requested.
825 if [ "x${newlib_io_long_double}" = "x" ]; then
826         if [ ${default_newlib_io_long_double} = "yes" ]; then
827                 newlib_io_long_double="yes";
828         fi
829 fi
830
831 # Enable printf positional argument support if requested.
832 if [ "x${newlib_io_pos_args}" = "x" ]; then
833         if [ ${default_newlib_io_pos_args} = "yes" ]; then
834                 newlib_io_pos_args="yes";
835         fi
836 fi
837
838 # Disable atexit dynamic allocation if requested.
839 if [ "x${newlib_atexit_dynamic_alloc}" = "x" ]; then
840         if [ ${default_newlib_atexit_dynamic_alloc} = "yes" ]; then
841                 newlib_atexit_dynamic_alloc="yes"; 
842         fi
843 fi
844
845 if test -z "${have_crt0}" && test -n "${sys_dir}"; then
846   have_crt0="yes"
847 fi