summaryrefslogtreecommitdiff
path: root/tools/configure
diff options
context:
space:
mode:
Diffstat (limited to 'tools/configure')
-rwxr-xr-xtools/configure57
1 files changed, 52 insertions, 5 deletions
diff --git a/tools/configure b/tools/configure
index ffded7eb87..5181ce4a19 100755
--- a/tools/configure
+++ b/tools/configure
@@ -523,6 +523,8 @@ arm7ejscc () {
523} 523}
524 524
525mipselcc () { 525mipselcc () {
526 arch="mips"
527 arch_version=32 # FIXME: autodetect version (32 or 64)
526 prefixtools mipsel-elf- 528 prefixtools mipsel-elf-
527 # mips is predefined, but we want it for paths. use __mips instead 529 # mips is predefined, but we want it for paths. use __mips instead
528 GCCOPTS="$CCOPTS -march=mips32 -mtune=r4600 -mno-mips16 -mno-long-calls -Umips" 530 GCCOPTS="$CCOPTS -march=mips32 -mtune=r4600 -mno-mips16 -mno-long-calls -Umips"
@@ -3674,21 +3676,36 @@ if [ -z "$arch" ]; then
3674 arch="m68k" 3676 arch="m68k"
3675 elif [ -n "$(echo $cpp_defines | grep -w __arm__)" ]; then 3677 elif [ -n "$(echo $cpp_defines | grep -w __arm__)" ]; then
3676 arch="arm" 3678 arch="arm"
3679 # cpp defines like "#define __ARM_ARCH_4TE__ 1" (where we want to extract the 4)
3680 arch_version="$(echo $cpp_defines | sed s,\ ,\\n,g | grep __ARM_ARCH | sed -e 's,.*\([0-9]\).*,\1,')"
3677 elif [ -n "$(echo $cpp_defines | grep -w __mips__)" ]; then 3681 elif [ -n "$(echo $cpp_defines | grep -w __mips__)" ]; then
3678 arch="mips" 3682 arch="mips" # FIXME: autodetect version (32 or 64)
3679 elif [ -n "$(echo $cpp_defines | grep -w _X86_)" ]; then 3683 elif [ -n "$(echo $cpp_defines | grep -w _X86_)" ]; then
3680 arch="x86" 3684 arch="x86"
3681 elif [ -n "$(echo $cpp_defines | grep -w __x86_64__)" ]; then 3685 elif [ -n "$(echo $cpp_defines | grep -w __x86_64__)" ]; then
3682 arch="amd64" 3686 arch="amd64"
3683 else 3687 else
3684 arch="unknown" 3688 arch="none"
3685 echo "Warning: Could not determine target arch" 3689 echo "Warning: Could not determine target arch"
3686 fi 3690 fi
3687 if [ "$arch" != "unknown" ]; then 3691 if [ "$arch" != "none" ]; then
3688 echo "Automatically selected arch: $arch" 3692 if [ -n "$arch_version" ]; then
3693 echo "Automatically selected arch: $arch (ver $arch_version)"
3694 else
3695 echo "Automatically selected arch: $arch"
3696 fi
3689 fi; 3697 fi;
3690else 3698else
3691 echo "Manually selected arch: $arch" 3699 if [ -n "$arch_version" ]; then
3700 echo "Manually selected arch: $arch (ver $arch_version)"
3701 else
3702 echo "Manually selected arch: $arch"
3703 fi
3704fi
3705
3706arch="arch_$arch"
3707if [ -n "$arch_version" ]; then
3708 Darch_version="#define ARCH_VERSION $arch_version"
3692fi 3709fi
3693 3710
3694if test -n "$ccache"; then 3711if test -n "$ccache"; then
@@ -3720,6 +3737,35 @@ cat > autoconf.h <<EOF
3720#ifndef __BUILD_AUTOCONF_H 3737#ifndef __BUILD_AUTOCONF_H
3721#define __BUILD_AUTOCONF_H 3738#define __BUILD_AUTOCONF_H
3722 3739
3740/* lower case names match the what's exported in the Makefile
3741 * upper case name looks nicer in the code */
3742
3743#define arch_none 0
3744#define ARCH_NONE 0
3745
3746#define arch_sh 1
3747#define ARCH_SH 1
3748
3749#define arch_m68k 2
3750#define ARCH_M68K 2
3751
3752#define arch_arm 3
3753#define ARCH_ARM 3
3754
3755#define arch_mips 4
3756#define ARCH_MIPS 4
3757
3758#define arch_x86 5
3759#define ARCH_X86 5
3760
3761#define arch_amd64 6
3762#define ARCH_AMD64 6
3763
3764/* Define target machine architecture */
3765#define ARCH ${arch}
3766/* Optinally define architecture version */
3767${Darch_version}
3768
3723/* Define endianess for the target or simulator platform */ 3769/* Define endianess for the target or simulator platform */
3724#define ${defendian} 1 3770#define ${defendian} 1
3725 3771
@@ -3827,6 +3873,7 @@ export FLASHFILE=${flash}
3827export TARGET_ID=${target_id} 3873export TARGET_ID=${target_id}
3828export TARGET=-D${target} 3874export TARGET=-D${target}
3829export ARCH=${arch} 3875export ARCH=${arch}
3876export ARCH_VERSION=${arch_version}
3830export CPU=${t_cpu} 3877export CPU=${t_cpu}
3831export MANUFACTURER=${t_manufacturer} 3878export MANUFACTURER=${t_manufacturer}
3832export OBJDIR=${pwd} 3879export OBJDIR=${pwd}