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