Patch #1821100: make cross-compiling sane out of the box; blackfin support

svn-id: r29285
This commit is contained in:
Max Horn 2007-10-28 13:14:23 +00:00
parent 3f958711a2
commit c664dbcca8
3 changed files with 1817 additions and 145 deletions

85
config.guess vendored
View File

@ -1,9 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
timestamp='2005-07-08'
timestamp='2007-07-22'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -106,7 +107,7 @@ set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
@ -160,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
@ -206,8 +208,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*)
echo powerppc-unknown-mirbsd${UNAME_RELEASE}
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
@ -325,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:SunOS:5.*:*)
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
@ -764,12 +769,19 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
case ${UNAME_MACHINE} in
pc98)
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
i*:MINGW*:*)
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:windows32*:*)
@ -779,9 +791,15 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
@ -794,7 +812,7 @@ EOF
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:*)
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
@ -817,6 +835,9 @@ EOF
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit ;;
@ -851,7 +872,11 @@ EOF
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
@ -870,9 +895,16 @@ EOF
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
@ -916,9 +948,15 @@ EOF
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit ;;
xtensa:Linux:*:*)
echo xtensa-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
@ -961,7 +999,7 @@ EOF
LIBC=gnulibc1
# endif
#else
#ifdef __INTEL_COMPILER
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
LIBC=gnu
#else
LIBC=gnuaout
@ -971,7 +1009,11 @@ EOF
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^LIBC/{
s: ::g
p
}'`"
test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit
@ -1173,6 +1215,15 @@ EOF
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@ -1182,7 +1233,6 @@ EOF
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
*86) UNAME_PROCESSOR=i686 ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@ -1261,6 +1311,9 @@ EOF
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2

1626
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

251
configure vendored
View File

@ -240,34 +240,25 @@ echo_n()
#
find_type_with_size ()
{
for datatype in int short char long unknown; do
cat <<EOF >tmp_find_type_with_size.cpp
#include <stdio.h>
int main(int argc, char **argv)
{
int size = argv[1][0] - '0';
if (size == sizeof(int))
printf("int\n");
else if (size == sizeof(short))
printf("short\n");
else if (size == sizeof(char))
printf("char\n");
else if (size == sizeof(long))
printf("long\n");
else {
printf("unknown\n");
return 1;
}
typedef $datatype ac__type_sizeof_;
int main() {
static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) == $1)];
test_array [0] = 0;
return 0;
}
EOF
if eval "$CXX $CXXFLAGS -o tmp_find_type_with_size$EXEEXT tmp_find_type_with_size.cpp"; then
datatype=`./tmp_find_type_with_size $1`
if ! $CXX $CXXFLAGS -o tmp_find_type_with_size$EXEEXT tmp_find_type_with_size.cpp 2>/dev/null; then
if test "$datatype" = "unknown"; then
echo "couldn't find data type with $1 bytes"
exit 1
fi
continue
else
break
fi
done
rm -f tmp_find_type_with_size$EXEEXT tmp_find_type_with_size.cpp
echo $datatype
}
@ -577,7 +568,11 @@ i586-mingw32msvc)
_host_cpu=i586
;;
*)
guessed_host=`$_srcdir/config.guess`
if test -z "$_host"; then
guessed_host=`$_srcdir/config.guess`
else
guessed_host=`$_srcdir/config.sub $_host`
fi
_host_cpu=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
_host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
_host_vendor=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
@ -619,7 +614,7 @@ esac
#
echo_n "Looking for C++ compiler... "
if test -n "$_host"; then
compilers="$CXX $_host_cpu-$_host_os-g++ $_host_cpu-$_host_os-c++"
compilers="$CXX $_host_cpu-$_host_os-g++ $_host_cpu-$_host_os-c++ $_host-g++ $_host-c++"
else
compilers="$CXX g++ c++"
fi
@ -737,6 +732,108 @@ add_to_config_mk_if_no $_build_touche 'DISABLE_TOUCHE = 1'
add_to_config_mk_if_no $_build_hq_scalers 'DISABLE_HQ_SCALERS = 1'
add_to_config_mk_if_no $_build_scalers 'DISABLE_SCALERS = 1'
#
# Check for endianness
#
echo_n "Checking endianness... "
cat <<EOF >tmp_endianness_check.cpp
short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
void _ascii() { char* s = (char*) ascii_mm; s = (char*) ascii_ii; }
short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; }
int main() { _ascii (); _ebcdic (); return 0; }
EOF
$CXX $CXXFLAGS -c -o tmp_endianness_check.o tmp_endianness_check.cpp
if grep BIGenDianSyS tmp_endianness_check.o >/dev/null; then
_endian=big
else
_endian=little
fi
echo $_endian;
rm -f tmp_endianness_check.o tmp_endianness_check.cpp
#
# Determine data type sizes
# TODO: proper error checking
# TODO: Actually, we should check individually for both signed & unsigned
# data types - there are systems on which the size of an unsigned int
# differs from that of a signed int!
# However, so far we haven't encountered one of those, so we can live with
# the limited check for now.
#
echo_n "Type with 1 byte... "
type_1_byte=`find_type_with_size 1`
echo "$type_1_byte"
echo_n "Type with 2 bytes... "
type_2_byte=`find_type_with_size 2`
echo "$type_2_byte"
echo_n "Type with 4 bytes... "
type_4_byte=`find_type_with_size 4`
echo "$type_4_byte"
#
# Check whether we can use x86 asm routines
#
echo_n "Running on x86... "
case $_host_cpu in
i386|i486|i586|i686)
_have_x86=yes
;;
*)
_have_x86=no
;;
esac
echo "$_have_x86"
#
# Determine build settings
#
# TODO - also add an command line option to override this?!?
echo_n "Checking hosttype... "
echo $_host_os
case $_host_os in
linux* | uclinux* | openbsd* | freebsd* | netbsd* | bsd* | sunos* | hpux* | beos*)
DEFINES="$DEFINES -DUNIX"
;;
solaris*)
DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
;;
irix*)
DEFINES="$DEFINES -DUNIX -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
LIBS="$LIBS -lmd "
_ranlib=:
;;
darwin*)
DEFINES="$DEFINES -DUNIX -DMACOSX"
LIBS="$LIBS -framework QuickTime -framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI"
;;
mingw*)
DEFINES="$DEFINES -DWIN32"
LIBS="$LIBS -lmingw32 -lwinmm"
OBJS="$OBJS scummvmico.o"
;;
cygwin*)
DEFINES="$DEFINES -mno-cygwin -DWIN32"
LIBS="$LIBS -mno-cygwin -lmingw32 -lwinmm"
OBJS="$OBJS scummvmico.o"
;;
os2-emx*)
DEFINES="$DEFINES -DUNIX"
;;
mint*)
DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
;;
# given this is a shell script assume some type of unix
*)
echo "WARNING: could not establish system type, assuming unix like"
DEFINES="$DEFINES -DUNIX"
;;
esac
if test -n "$_host"; then
# Cross-compiling mode - add your target here if needed
case "$_host" in
@ -762,6 +859,9 @@ if test -n "$_host"; then
add_line_to_config_mk 'USE_ARM_SOUND_ASM = 1'
add_line_to_config_mk 'USE_ARM_SMUSH_ASM = 1'
;;
bfin*)
_need_memalign=yes
;;
gp2x)
echo "Cross-compiling to $_host, forcing endianness, alignment and type sizes"
DEFINES="$DEFINES -DUNIX -DGP2X -DUSE_ARM_SOUND_ASM -DUSE_ARM_SMUSH_ASM"
@ -813,96 +913,11 @@ if test -n "$_host"; then
OBJS="$OBJS scummvmico.o"
;;
*)
echo "Cross-compiling to unknown target $_host, please add your target to configure."
exit 1
echo "Continuing with auto-detected values ... if you have problems, please add your target to configure."
;;
esac
else
#
# Determine build settings
#
# TODO - also add an command line option to override this?!?
echo_n "Checking hosttype... "
echo $_host_os
case $_host_os in
linux* | openbsd* | freebsd* | netbsd* | bsd* | sunos* | hpux* | beos*)
DEFINES="$DEFINES -DUNIX"
;;
solaris*)
DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
;;
irix*)
DEFINES="$DEFINES -DUNIX -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
LIBS="$LIBS -lmd "
_ranlib=:
;;
darwin*)
DEFINES="$DEFINES -DUNIX -DMACOSX"
LIBS="$LIBS -framework QuickTime -framework AudioUnit -framework AudioToolbox -framework Carbon -framework CoreMIDI"
;;
mingw*)
DEFINES="$DEFINES -DWIN32"
LIBS="$LIBS -lmingw32 -lwinmm"
OBJS="$OBJS scummvmico.o"
;;
cygwin*)
DEFINES="$DEFINES -mno-cygwin -DWIN32"
LIBS="$LIBS -mno-cygwin -lmingw32 -lwinmm"
OBJS="$OBJS scummvmico.o"
;;
os2-emx*)
DEFINES="$DEFINES -DUNIX"
;;
mint*)
DEFINES="$DEFINES -DUNIX -DSYSTEM_NOT_SUPPORTING_D_TYPE"
;;
# given this is a shell script assume some type of unix
*)
echo "WARNING: could not establish system type, assuming unix like"
DEFINES="$DEFINES -DUNIX"
;;
esac
#
# Check for endianness
#
echo_n "Checking endianness... "
cat <<EOF >tmp_endianness_check.cpp
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
unsigned int data = 0x01234567;
char *ptr = (char *)&data;
if (ptr[0] == 0x01 && ptr[1] == 0x23 && ptr[2] == 0x45 && ptr[3] == 0x67)
printf("big\n");
else if (ptr[3] == 0x01 && ptr[2] == 0x23 && ptr[1] == 0x45 && ptr[0] == 0x67)
printf("little\n");
else
printf("unknown\n");
return 0;
}
EOF
$CXX $CXXFLAGS -o tmp_endianness_check$EXEEXT tmp_endianness_check.cpp
_endian=`./tmp_endianness_check`
echo $_endian;
rm -f tmp_endianness_check$EXEEXT tmp_endianness_check.cpp
#
# Check whether we can use x86 asm routines
#
echo_n "Running on x86... "
case $_host_cpu in
i386|i486|i586|i686)
_have_x86=yes
;;
*)
_have_x86=no
;;
esac
echo "$_have_x86"
#
# Check whether memory alignment is required
#
@ -949,28 +964,6 @@ EOF
;;
esac
echo "$_need_memalign"
#
# Determine data type sizes
# TODO: proper error checking
# TODO: Actually, we should check individually for both signed & unsigned
# data types - there are systems on which the size of an unsigned int
# differs from that of a signed int!
# However, so far we haven't encountered one of those, so we can live with
# the limited check for now.
#
echo_n "Type with 1 byte... "
type_1_byte=`find_type_with_size 1`
echo "$type_1_byte"
echo_n "Type with 2 bytes... "
type_2_byte=`find_type_with_size 2`
echo "$type_2_byte"
echo_n "Type with 4 bytes... "
type_4_byte=`find_type_with_size 4`
echo "$type_4_byte"
fi
#