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