]> sourceware.org Git - newlib-cygwin.git/blob - newlib/configure.host
2003-11-19 Nicholas Wourms <nwourms@netscape.net>
[newlib-cygwin.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
28 # It sets the following shell variables:
29 # newlib_cflags Special CFLAGS to use when building
30 # machine_dir Subdirectory of libc/machine to configure
31 # sys_dir Subdirectory of libc/sys to configure
32 # have_sys_mach_dir Is there a machine subdirectory in sys subdirectory
33 # posix_dir "posix" to build libc/posix, "" otherwise
34 # signal_dir "signal" to build libc/signal, "" otherwise
35 # stdio64_dir "stdio64" to build libc/stdio64, "" otherwise
36 # syscall_dir "syscalls" to build libc/syscalls, "" otherwise
37 # unix_dir "unix" to build libc/unix, "" otherwise
38 # use_libtool flag: use libtool to build newlib?
39 # aext library extension - needed for libtool support
40 # oext object file extension - needed for libtool support
41 # crt1 name of crt1 object if one is provided
42 # crt1_dir directory where crt1 object is found
43
44 newlib_cflags=
45 libm_machine_dir=
46 machine_dir=
47 sys_dir=
48 posix_dir=
49 signal_dir=signal
50 stdio64_dir=
51 syscall_dir=
52 unix_dir=
53 mach_add_setjmp=
54 crt1=
55 crt1_dir=
56 use_libtool=no
57 have_sys_mach_dir=no
58 aext=a
59 oext=o
60
61 case "${target_optspace}:${host}" in
62 yes:*)
63 newlib_cflags="${newlib_cflags} -Os"
64 ;;
65 :m32r-* | :d10v-* | :d30v-* | :avr-*)
66 newlib_cflags="${newlib_cflags} -Os"
67 ;;
68 no:* | :*)
69 newlib_cflags="${newlib_cflags} -O2"
70 ;;
71 esac
72
73 # Get the source directories to use for the CPU type.
74 # machine_dir should supply CPU dependent routines, such as setjmp.
75 # newlib_cflags is passed to gcc when compiling.
76 # THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
77
78 case "${host_cpu}" in
79 a29k)
80 machine_dir=a29k
81 ;;
82 arc)
83 machine_dir=
84 ;;
85 arm)
86 machine_dir=arm
87 ;;
88 avr*)
89 newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mcall-prologues"
90 ;;
91 d10v*)
92 machine_dir=d10v
93 ;;
94 d30v*)
95 machine_dir=d30v
96 ;;
97 ep9312)
98 machine_dir=arm
99 ;;
100 fr30)
101 machine_dir=fr30
102 ;;
103 frv)
104 machine_dir=frv
105 ;;
106 h8300)
107 machine_dir=h8300
108 ;;
109 h8500)
110 machine_dir=h8500
111 ;;
112 hppa*)
113 machine_dir=hppa
114 ;;
115 i960)
116 machine_dir=i960
117 ;;
118 i[34567]86)
119 # Don't use for these since they provide their own setjmp.
120 case ${host} in
121 *-*-sco* | *-*-cygwin*)
122 libm_machine_dir=i386
123 machine_dir=i386
124 ;;
125 *)
126 libm_machine_dir=i386
127 machine_dir=i386
128 mach_add_setjmp=true
129 ;;
130 esac
131 ;;
132 ia64*)
133 ;;
134 iq2000)
135 machine_dir=iq2000
136 ;;
137 m32r*)
138 machine_dir=m32r
139 ;;
140
141 m68hc11|m6811|m68hc12|m6812)
142 machine_dir=m68hc11
143 newlib_cflags="-DPREFER_SIZE_OVER_SPEED -Os -mrelax"
144 CFLAGS="-g -Os"
145 ;;
146
147 m68*)
148 machine_dir=m68k
149 newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
150 ;;
151 m88k)
152 machine_dir=m88k
153 newlib_cflags="${newlib_cflags} -m88000"
154 ;;
155 m88110)
156 machine_dir=m88k
157 newlib_cflags="${newlib_cflags} -m88110"
158 ;;
159 mcore)
160 ;;
161 mips*)
162 machine_dir=mips
163 ;;
164 mmix)
165 ;;
166 mn10200)
167 machine_dir=mn10200
168 ;;
169 mn10300)
170 machine_dir=mn10300
171 ;;
172 or16)
173 ;;
174 or32)
175 ;;
176 powerpc*)
177 machine_dir=powerpc
178 ;;
179 sh | sh64)
180 machine_dir=sh
181 ;;
182 sparc*)
183 machine_dir=sparc
184 # FIXME: Might wish to make MALLOC_ALIGNMENT more generic.
185 newlib_cflags="${newlib_cflags} -DMALLOC_ALIGNMENT=8"
186 ;;
187 strongarm)
188 machine_dir=arm
189 ;;
190 xscale)
191 machine_dir=xscale
192 ;;
193 thumb)
194 machine_dir=arm
195 ;;
196 tic80*)
197 machine_dir=tic80
198 ;;
199 v70)
200 ;;
201 v810)
202 ;;
203 v850)
204 machine_dir=v850
205 newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mv850 "
206 ;;
207 v850e)
208 machine_dir=v850
209 newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED "
210 ;;
211 w65*)
212 machine_dir=w65
213 ;;
214 xstormy16)
215 machine_dir=xstormy16
216 newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED"
217 ;;
218 z8k)
219 machine_dir=z8k
220 ;;
221 *)
222 echo '***' "Newlib does not support CPU ${host_cpu}" 1>&2
223 exit 1
224 ;;
225 esac
226
227 # Disable thread support if requested.
228
229 if [ "${newlib_multithread}" = "no" ] ; then
230 newlib_cflags="${newlib_cflags} -D__SINGLE_THREAD__"
231 fi
232
233 # Disable syscall support if requested.
234
235 if [ "${newlib_may_supply_syscalls}" = "no" ] ; then
236 newlib_cflags="${newlib_cflags} -D__NO_SYSCALLS__"
237 fi
238
239 # Enable multibyte support if requested or it is defaulted
240 # for target.
241
242 if [ "x${newlib_mb}" = "x" ]; then
243 case "${host}" in
244 i[34567]86-pc-linux-*|*-*-cygwin*)
245 newlib_mb=yes
246 ;;
247 esac
248 fi
249
250 if [ "x${newlib_mb}" = "xyes" ] ; then
251 newlib_cflags="${newlib_cflags} -DMB_CAPABLE"
252 fi
253
254 # Disable printf/scanf floating-point support if requested.
255
256 if [ "${newlib_io_float}" = "no" ] ; then
257 newlib_cflags="${newlib_cflags} -DNO_FLOATING_POINT"
258 fi
259
260 # Enable printf positional argument support if requested.
261
262 if [ "${newlib_io_pos_args}" = "yes" ] ; then
263 newlib_cflags="${newlib_cflags} -DWANT_IO_POS_ARGS"
264 fi
265
266 # Verify if shared newlib support is allowed and set appropriate variables
267 # We don't want to use libtool for platforms that we are not going to
268 # support shared libraries. This is because it adds executable tests which
269 # we don't want for most embedded platforms.
270 case "${host}" in
271 i[34567]86-pc-linux-*)
272 use_libtool=yes
273 have_sys_mach_dir=yes
274 stdio64_dir=stdio64
275 oext=lo
276 aext=la ;;
277 *) ;; #shared library not supported for ${host}
278 esac
279
280 # Get the source directories to use for the host. unix_dir is set
281 # to unix to get some standard Unix routines. posix_dir is set to get some
282 # standard Posix routines. sys_dir should supply system dependent routines
283 # including crt0.
284 # THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
285
286 case "${host}" in
287 *-*-cygwin*)
288 posix_dir=posix
289 stdio64_dir=stdio64
290 ;;
291 *-*-netware*)
292 signal_dir=
293 sys_dir=netware
294 ;;
295 *-*-rtems*) # generic RTEMS support
296 sys_dir=rtems
297 # RTEMS POSIX support is all inside RTEMS
298 ;;
299 a29k-*-*)
300 sys_dir=a29khif
301 signal_dir=
302 ;;
303 arc-*-*)
304 sys_dir=arc
305 ;;
306 arm-*-*)
307 sys_dir=arm
308 ;;
309 d10v*)
310 sys_dir=d10v
311 ;;
312 d30v*)
313 sys_dir=
314 ;;
315 ep9312-*-*)
316 sys_dir=arm
317 ;;
318 h8300-*-hms*)
319 sys_dir=h8300hms
320 ;;
321 h8300-*-elf*)
322 sys_dir=h8300hms
323 ;;
324 h8300-*-coff*)
325 sys_dir=h8300hms
326 ;;
327 h8300-*-xray*)
328 sys_dir=h8300xray
329 ;;
330 h8500-*-hms*)
331 sys_dir=h8500hms
332 ;;
333 h8500-*-elf*)
334 sys_dir=h8500hms
335 ;;
336 i[34567]86-*-sco*)
337 sys_dir=sysvi386
338 unix_dir=unix
339 ;;
340 i[34567]86-pc-linux-*)
341 sys_dir=linux
342 unix_dir=unix
343 posix_dir=posix
344 crt1=crt1.o
345 crt1_dir=libc/sys/${sys_dir}
346 gcc_dir=`gcc -print-search-dirs | awk '/^install:/{print $2}'`
347 #newlib_cflags="${newlib_cflags} -Werror" # DEBUGGING ONLY;BREAKS BUILD
348 newlib_cflags="${newlib_cflags} -Wall"
349 newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS"
350 newlib_cflags="${newlib_cflags} -DHAVE_FCNTL"
351 newlib_cflags="${newlib_cflags} -DWANT_IO_POS_ARGS -DWANT_IO_LONG_DBL"
352 # --- Required when building a shared library ------------------------
353 newlib_cflags="${newlib_cflags} -fPIC -D_I386MACH_NEED_SOTYPE_FUNCTION"
354 # --- The three lines below are optional ------------------------------
355 ##newlib_cflags="${newlib_cflags} -nostdinc"
356 ##newlib_cflags="${newlib_cflags} -I`newlib-flags --kernel-dir`/include"
357 ##newlib_cflags="${newlib_cflags} -idirafter ${gcc_dir}include"
358 ;;
359
360 m68hc11-*-*|m6811-*-*|m6812-*-*|m68hc12-*-*)
361 ;;
362
363 m68k-sun-sunos*)
364 unix_dir=unix
365 ;;
366 m8*-bug-*)
367 sys_dir=m88kbug
368 ;;
369 mips*-dec-*)
370 sys_dir=decstation
371 ;;
372 mmix-knuth-mmixware)
373 sys_dir=mmixware
374 ;;
375 powerpcle-*-pe)
376 posix_dir=posix
377 ;;
378 sh*-*)
379 sys_dir=sh
380 ;;
381 sparc-sun-sunos*)
382 sys_dir=sun4
383 unix_dir=unix
384 ;;
385 sparc64*)
386 sys_dir=sparc64
387 unix_dir=unix
388 ;;
389 strongarm-*-*)
390 sys_dir=arm
391 ;;
392 xscale-*-*)
393 sys_dir=arm
394 ;;
395 thumb-*-*)
396 sys_dir=arm
397 ;;
398 tic80*)
399 sys_dir=tic80
400 ;;
401 v70-nec-*)
402 sys_dir=sysvnecv70
403 ;;
404 v810-*-*)
405 sys_dir=sysnec810
406 ;;
407 v850-*-*)
408 sys_dir=sysnecv850
409 ;;
410 v850e-*-*)
411 sys_dir=sysnecv850
412 ;;
413 v850ea-*-*)
414 sys_dir=sysnecv850
415 ;;
416 frv*)
417 sys_dir=
418 ;;
419 w65-*-*)
420 sys_dir=w65
421 ;;
422 z8k-*-coff)
423 sys_dir=z8ksim
424 ;;
425 esac
426
427 # Host specific flag settings -- usually for features that are not
428 # general enough or broad enough to be handled above.
429 # THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
430
431 case "${host}" in
432 *-*-cygwin*)
433 test -z "$cygwin_srcdir" && cygwin_srcdir=`cd ${srcdir}/../winsup/cygwin; pwd`
434 export cygwin_srcdir
435 newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DSIGNAL_PROVIDED -DWANT_IO_POS_ARGS -DWANT_IO_LONG_DBL -DWANT_PRINTF_LONG_LONG -D_COMPILING_NEWLIB -DHAVE_FCNTL -DMALLOC_PROVIDED -I${cygwin_srcdir}/include"
436 syscall_dir=syscalls
437 ;;
438 # RTEMS supplies its own versions of some routines:
439 # malloc() (reentrant version)
440 # exit() RTEMS has a "global" reent to flush
441 # signal()/raise() RTEMS has its own including pthread signals
442 # _XYZ_r() RTEMS has its own reentrant routines
443 #
444 # NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that.
445 *-*-rtems*)
446 newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY -DMALLOC_PROVIDED -DEXIT_PROVIDED -DMISSING_SYSCALL_NAMES -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_OPENDIR -DNO_EXEC -DWANT_PRINTF_LONG_LONG -DHAVE_FCNTL"
447 ;;
448 # VxWorks supplies its own version of malloc, and the newlib one
449 # doesn't work because VxWorks does not have sbrk.
450 *-wrs-vxworks*)
451 newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DMISSING_SYSCALL_NAMES -DHAVE_FCNTL"
452 ;;
453 # UDI doesn't have exec, so system() should fail the right way
454 a29k-amd-udi)
455 newlib_cflags="${newlib_cflags} -DNO_EXEC"
456 syscall_dir=syscalls
457 ;;
458 arc-*-*)
459 syscall_dir=syscalls
460 ;;
461 arm-*-pe)
462 syscall_dir=syscalls
463 newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
464 # Don't use the debugging protocols just yet.
465 ;;
466 arm-*-*)
467 syscall_dir=syscalls
468 newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
469 # Select which debug protocol is being used.
470 # ARM_RDP_MONITOR selects the Demon monitor.
471 # ARM_RDI_MONITOR selects the Angel monitor.
472 # If neither are defined, then hard coded defaults will be used
473 # to create the program's environment.
474 # See also thumb below.
475 # newlib_cflags="${newlib_cflags} -DARM_RDP_MONITOR"
476 newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
477 ;;
478 avr*)
479 newlib_cflags="${newlib_cflags} -DNO_EXEC -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
480 ;;
481 d10v*)
482 newlib_cflags="${newlib_cflags} -DSMALL_MEMORY"
483 syscall_dir=syscalls
484 ;;
485 d30v*)
486 newlib_cflags="${newlib_cflags} -DABORT_MESSAGE -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
487 syscall_dir=
488 ;;
489 ep9312-*-*)
490 syscall_dir=syscalls
491 newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
492 newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
493 ;;
494 fr30-*-*)
495 newlib_cflags="${newlib_cflags}"
496 syscall_dir=syscalls
497 ;;
498 frv-*-*)
499 syscall_dir=syscalls
500 newlib_cflags="${newlib_cflags} -DWANT_PRINTF_LONG_LONG"
501 ;;
502 h8300*-*-*)
503 syscall_dir=syscalls
504 newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
505 # Simulator only extensions for H8300.
506 # Uncomment the next line to enable them.
507 # newlib_cflags="${newlib_cflags} -D__SIMULATOR__"
508 ;;
509 h8500-*-*)
510 syscall_dir=syscalls
511 newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
512 ;;
513 i[34567]86-*-sco*)
514 newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED -DHAVE_FCNTL"
515 ;;
516 i[34567]86-*-netware*)
517 newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DABORT_PROVIDED -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DHAVE_FCNTL"
518 ;;
519 iq2000*)
520 syscall_dir=syscalls
521 newlib_cflags="${newlib_cflags} -DWANT_PRINTF_LONG_LONG"
522 ;;
523 m32r-*-*)
524 # Pass -msdata=sdata so _impure_ptr goes in .sdata.
525 # We don't generate sda relocs however for upward compatibility.
526 # FIXME: This is necessary because the default multilib doesn't
527 # use --print-multi-lib.
528 newlib_cflags="${newlib_cflags} -msdata=sdata"
529 syscall_dir=syscalls
530 ;;
531 m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
532 newlib_cflags="${newlib_cflags} -DNO_EXEC -DABORT_PROVIDED -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
533 ;;
534 mcore-*-*)
535 newlib_cflags="${newlib_cflags}"
536 syscall_dir=syscalls
537 ;;
538 mips64vr*-*-*)
539 newlib_cflags="${newlib_cflags} -DWANT_PRINTF_LONG_LONG -DMISSING_SYSCALL_NAMES"
540 ;;
541 mmix-*)
542 syscall_dir=syscalls
543 # We need every symbol 32-bit aligned, so the invalid
544 # construct with attribute ((alias ("_ctype_b+127"))) breaks.
545 newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
546 ;;
547 mn10?00-*-*)
548 syscall_dir=syscalls
549 ;;
550 powerpc*-*-eabialtivec*)
551 newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DWANT_PRINTF_LONG_LONG"
552 ;;
553 powerpc*-*-eabispe*)
554 newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DWANT_PRINTF_LONG_LONG"
555 ;;
556 powerpc*-*-eabi* | \
557 powerpc*-*-elf* | \
558 powerpc*-*-linux* | \
559 powerpc*-*-rtem* | \
560 powerpc*-*-sysv* | \
561 powerpc*-*-solaris*)
562 newlib_cflags="${newlib_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES -DWANT_PRINTF_LONG_LONG"
563 ;;
564 powerpcle-*-pe)
565 newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DHAVE_FCNTL"
566 syscall_dir=syscalls
567 ;;
568 sh*-*-*)
569 newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY -DWANT_PRINTF_LONG_LONG"
570 syscall_dir=syscalls
571 ;;
572 sparc-sun-sunos*)
573 newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
574 ;;
575 sparc64-*-*)
576 newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_BLKSIZE -DHAVE_GETTIMEOFDAY -DHAVE_FCNTL"
577 # This either belongs elsewhere or nowhere. But I need *something*,
578 # so for now it's here ...
579 case "${host_os}" in
580 aoutv8 | *32p)
581 newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=32" ;;
582 *)
583 newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=64" ;;
584 esac
585 ;;
586 strongarm-*-*)
587 syscall_dir=syscalls
588 newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
589 newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
590 ;;
591 xscale-*-*)
592 syscall_dir=syscalls
593 newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
594 newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
595 newlib_cflags="${newlib_cflags} -DHAVE_SYSTEM -DHAVE_RENAME"
596 ;;
597 thumb-*-pe)
598 syscall_dir=syscalls
599 newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
600 # Don't use the debugging protocols just yet.
601 ;;
602 thumb-*-*)
603 syscall_dir=syscalls
604 newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
605 # Select which debug protocol is being used.
606 # ARM_RDP_MONITOR selects the Demon monitor.
607 # ARM_RDI_MONITOR selects the Angel monitor.
608 # If neither are defined, then hard coded defaults will be used
609 # to create the program's environment.
610 # See also arm and strongarm above.
611 # newlib_cflags="${newlib_cflags} -DARM_RDP_MONITOR"
612 newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
613 ;;
614 tic80*)
615 syscall_dir=syscalls
616 ;;
617 v850-*-*)
618 syscall_dir=syscalls
619 ;;
620 v850e-*-*)
621 syscall_dir=syscalls
622 ;;
623 v850ea-*-*)
624 syscall_dir=syscalls
625 ;;
626 w65-*-*)
627 syscall_dir=syscalls
628 newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
629 ;;
630 xstormy16-*-*)
631 newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY"
632 syscall_dir=syscalls
633 ;;
634 z8k-*-*)
635 syscall_dir=syscalls
636 ;;
637 *)
638 newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
639 syscall_dir=
640 ;;
641 esac
This page took 0.064184 seconds and 6 git commands to generate.