newlib-cygwin/newlib/configure.host

466 lines
10 KiB
Plaintext
Raw Normal View History

2000-02-18 03:39:52 +08:00
# configure.host
# This shell script handles all host based configuration for newlib.
# It sets various shell variables based on the the host and the
# configuration options. You can modify this shell script without
# needing to rerun autoconf.
# This shell script should be invoked as
# . configure.host
# If it encounters an error, it will exit with a message.
# FIXME: This script is too complicated. It does things in too many
# different ways. This was taken from the old Cygnus configure script
# with only minor changes. It should be cleaned up.
# FIXME: The general approach of picking and choosing which
# directories to configure, other than machine_dir and sys_dir, is
# potentially confusing.
# It uses the following shell variables:
# host The configuration host
# host_cpu The configuration host CPU
# newlib_mb --enable-newlib-mb ("yes", "no")
# target_optspace --enable-target-optspace ("yes", "no", "")
# It sets the following shell variables:
# newlib_cflags Special CFLAGS to use when building
# machine_dir Subdirectory of libc/machine to configure
# sys_dir Subdirectory of libc/sys to configure
# posix_dir "posix" to build libc/posix, "" otherwise
# signal_dir "signal" to build libc/signal, "" otherwise
# syscall_dir "syscalls" to build libc/syscalls, "" otherwise
# unix_dir "unix" to build libc/unix, "" otherwise
newlib_cflags=
machine_dir=
sys_dir=
posix_dir=
signal_dir=signal
syscall_dir=
unix_dir=
mach_add_setjmp=
case "${target_optspace}:${host}" in
yes:*)
newlib_cflags="${newlib_cflags} -Os"
;;
:m32r-* | :d10v-* | :d30v-* | :avr-*)
2000-02-18 03:39:52 +08:00
newlib_cflags="${newlib_cflags} -Os"
;;
no:* | :*)
newlib_cflags="${newlib_cflags} -O2"
;;
esac
# Get the source directories to use for the CPU type.
# machine_dir should supply CPU dependent routines, such as setjmp.
# newlib_cflags is passed to gcc when compiling.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host_cpu}" in
a29k)
machine_dir=a29k
;;
arc)
machine_dir=
;;
arm)
machine_dir=arm
;;
avr*)
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mcall-prologues"
;;
2000-02-18 03:39:52 +08:00
d10v*)
machine_dir=d10v
;;
d30v*)
machine_dir=d30v
;;
fr30)
machine_dir=fr30
;;
h8300)
machine_dir=h8300
;;
h8500)
machine_dir=h8500
;;
hppa*)
machine_dir=hppa
;;
i960)
machine_dir=i960
;;
i[3456]86)
# Don't use for these since they provide their own setjmp.
case ${host} in
*-*-go32 | *-*-sco* | *-*-cygwin*)
machine_dir=i386
;;
*)
machine_dir=i386
mach_add_setjmp=true
;;
esac
;;
ia64*)
;;
2000-02-18 03:39:52 +08:00
m32r*)
machine_dir=m32r
;;
m68*)
machine_dir=m68k
;;
m88k)
machine_dir=m88k
newlib_cflags="${newlib_cflags} -m88000"
;;
m88110)
machine_dir=m88k
newlib_cflags="${newlib_cflags} -m88110"
;;
mcore)
;;
mips*)
machine_dir=mips
;;
mn10200)
machine_dir=mn10200
;;
mn10300)
machine_dir=mn10300
;;
powerpc*)
machine_dir=powerpc
;;
sh)
machine_dir=sh
;;
sparc*)
machine_dir=sparc
# FIXME: Might wish to make MALLOC_ALIGNMENT more generic.
newlib_cflags="${newlib_cflags} -DMALLOC_ALIGNMENT=8"
;;
strongarm)
machine_dir=arm
;;
thumb)
machine_dir=arm
;;
tic80*)
machine_dir=tic80
;;
v70)
;;
v810)
;;
v850)
machine_dir=v850
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mv850 -mno-app-regs -msmall-sld"
;;
v850e)
machine_dir=v850
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mv850 -mno-app-regs -msmall-sld"
;;
v850ea)
machine_dir=v850
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mv850 -mno-app-regs -msmall-sld"
;;
w65*)
machine_dir=w65
;;
z8k)
machine_dir=z8k
;;
*)
echo '***' "Newlib does not support CPU ${host_cpu}" 1>&2
exit 1
;;
esac
# Enable multibyte support if requested.
if [ "${newlib_mb}" = "yes" ] ; then
newlib_cflags="${newlib_cflags} -DMB_CAPABLE"
fi
# Get the source directories to use for the host. unix_dir is set
# to unix to get some standard Unix routines. posix_dir is set to get some
# standard Posix routines. sys_dir should supply system dependent routines
# including crt0.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
*-*-cygwin*)
sys_dir=cygwin
posix_dir=posix
;;
*-*-netware*)
signal_dir=
sys_dir=netware
;;
*-*-rtems*) # generic RTEMS support
sys_dir=rtems
# RTEMS POSIX support is all inside RTEMS
;;
a29k-*-*)
sys_dir=a29khif
signal_dir=
;;
arc-*-*)
sys_dir=arc
;;
arm-*-*)
sys_dir=arm
;;
d10v*)
sys_dir=d10v
;;
d30v*)
sys_dir=
;;
h8300-*-hms*)
sys_dir=h8300hms
;;
h8300-*-xray*)
sys_dir=h8300xray
;;
h8500-*-hms*)
sys_dir=h8500hms
;;
i[3456]86-*-go32)
sys_dir=go32
;;
i[3456]86-*-sco*)
sys_dir=sysvi386
unix_dir=unix
;;
m68k-sun-sunos*)
unix_dir=unix
;;
m8*-bug-*)
sys_dir=m88kbug
;;
mips*-dec-*)
sys_dir=decstation
;;
powerpcle-*-pe)
sys_dir=cygwin
posix_dir=posix
;;
sh*-*)
sys_dir=sh
;;
sparc-sun-sunos*)
sys_dir=sun4
unix_dir=unix
;;
sparc64*)
sys_dir=sparc64
unix_dir=unix
;;
strongarm-*-*)
sys_dir=arm
;;
thumb-*-*)
sys_dir=arm
;;
tic80*)
sys_dir=tic80
;;
v70-nec-*)
sys_dir=sysvnecv70
;;
v810-*-*)
sys_dir=sysnec810
;;
v850-*-*)
sys_dir=sysnecv850
;;
v850e-*-*)
sys_dir=sysnecv850
;;
v850ea-*-*)
sys_dir=sysnecv850
;;
w65-*-*)
sys_dir=w65
;;
z8k-*-coff)
sys_dir=z8ksim
;;
esac
# Host specific flag settings -- usually for features that are not
# general enough or broad enough to be handled above.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
*-*-cygwin*)
newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DSIGNAL_PROVIDED -DWANT_PRINTF_LONG_LONG -D_COMPILING_NEWLIB"
syscall_dir=syscalls
;;
# RTEMS supplies its own versions of some routines:
# malloc() (reentrant version)
# exit() RTEMS has a "global" reent to flush
# signal()/raise() RTEMS has its own including pthread signals
# _XYZ_r() RTEMS has its own reentrant routines
#
# NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that.
*-*-rtems*)
newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY -DMALLOC_PROVIDED -DEXIT_PROVIDED -DMISSING_SYSCALL_NAMES -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_OPENDIR"
;;
# VxWorks supplies its own version of malloc, and the newlib one
# doesn't work because VxWorks does not have sbrk.
*-wrs-vxworks*)
newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DMISSING_SYSCALL_NAMES"
;;
# UDI doesn't have exec, so system() should fail the right way
a29k-amd-udi)
newlib_cflags="${newlib_cflags} -DNO_EXEC"
syscall_dir=syscalls
;;
arc-*-*)
syscall_dir=syscalls
;;
arm-*-pe)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
# Don't use the debugging protocols just yet.
;;
arm-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
# Select which debug protocol is being used.
# ARM_RDP_MONITOR selects the Demon monitor.
# ARM_RDI_MONITOR selects the Angel monitor.
# If neither are defined, then hard coded defaults will be used
# to create the program's environment.
# See also thumb below.
# newlib_cflags="${newlib_cflags} -DARM_RDP_MONITOR"
newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
;;
avr*)
newlib_cflags="${newlib_cflags} -DNO_EXEC -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
;;
2000-02-18 03:39:52 +08:00
d10v*)
newlib_cflags="${newlib_cflags} -DSMALL_MEMORY"
syscall_dir=syscalls
;;
d30v*)
newlib_cflags="${newlib_cflags} -DABORT_MESSAGE -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
fr30-*-*)
newlib_cflags="${newlib_cflags}"
syscall_dir=syscalls
;;
h8300*-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;;
h8500-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;;
i[3456]86-*-sco*)
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
;;
i[3456]86-*-netware*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DABORT_PROVIDED -DCLOCK_PROVIDED -DMALLOC_PROVIDED"
;;
i[3456]86-*-go32)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC"
;;
m32r-*-*)
# Pass -msdata=sdata so _impure_ptr goes in .sdata.
# We don't generate sda relocs however for upward compatibility.
# FIXME: This is necessary because the default multilib doesn't
# use --print-multi-lib.
newlib_cflags="${newlib_cflags} -msdata=sdata"
syscall_dir=syscalls
;;
mcore-*-*)
newlib_cflags="${newlib_cflags}"
syscall_dir=syscalls
;;
mn10?00-*-*)
syscall_dir=syscalls
;;
powerpc*-*-eabi* | \
powerpc*-*-elf* | \
powerpc*-*-linux* | \
powerpc*-*-rtem* | \
powerpc*-*-sysv* | \
powerpc*-*-solaris*)
newlib_cflags="${newlib_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES"
;;
powerpcle-*-pe)
newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME"
syscall_dir=syscalls
;;
sh*-*-*)
syscall_dir=syscalls
;;
sparc-sun-sunos*)
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
;;
sparc64-*-*)
newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_BLKSIZE -DHAVE_GETTIMEOFDAY"
# This either belongs elsewhere or nowhere. But I need *something*,
# so for now it's here ...
case "${host_os}" in
aoutv8 | *32p)
newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=32" ;;
*)
newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=64" ;;
esac
;;
strongarm-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
;;
thumb-*-pe)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
# Don't use the debugging protocols just yet.
;;
thumb-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
# Select which debug protocol is being used.
# ARM_RDP_MONITOR selects the Demon monitor.
# ARM_RDI_MONITOR selects the Angel monitor.
# If neither are defined, then hard coded defaults will be used
# to create the program's environment.
# See also arm and strongarm above.
# newlib_cflags="${newlib_cflags} -DARM_RDP_MONITOR"
newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
;;
tic80*)
syscall_dir=syscalls
;;
v850-*-*)
syscall_dir=syscalls
;;
v850e-*-*)
syscall_dir=syscalls
;;
v850ea-*-*)
syscall_dir=syscalls
;;
w65-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;;
z8k-*-*)
syscall_dir=syscalls
;;
*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
esac