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