summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-04-26 22:41:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-04-26 22:41:48 +0000
commit6c38d8513bb1ec87a682f28b5e9bd38475b05fd8 (patch)
tree772350c2ac1dc448332255adee60ec593931fc4e /tools
parent08dae4f66e66a2db9e3d5413182000f9153d8740 (diff)
downloadrockbox-6c38d8513bb1ec87a682f28b5e9bd38475b05fd8.tar.gz
rockbox-6c38d8513bb1ec87a682f28b5e9bd38475b05fd8.zip
First shot at autodetecting endianess, and storing the found results in the
brand new autoconf.h header file (not used anywhere yet - this is still a test). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6361 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/configure48
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/configure b/tools/configure
index 682fd9ccca..631589f5dd 100755
--- a/tools/configure
+++ b/tools/configure
@@ -43,6 +43,8 @@ crosswincc () {
GCCOPTS="$GCCOPTS -mno-cygwin"
output="rockboxui.exe" # use this as output binary name
+ crosscompile="yes"
+ endian="little" # windows is little endian
}
simcc () {
@@ -92,24 +94,56 @@ simcc () {
exit
;;
esac
+
+
+ if test "X$crosscompile" != "Xyes"; then
+ id=$$
+ cat >/tmp/conftest-$id.c <<EOF
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+ int var=0;
+ char *varp = (char *)&var;
+ *varp=1;
+
+ printf("%d\n", var);
+ return 0;
+}
+EOF
+
+ $CC -o /tmp/conftest-$id /tmp/conftest-$id.c 2>/dev/null
+
+ if test `/tmp/conftest-$id 2>/dev/null` -gt "1"; then
+ # big endian
+ endian="big"
+ else
+ # little endian
+ endian="little"
+ fi
+ echo "Simulator environment deemed $endian endian"
+ rm /tmp/conftest-$id /tmp/conftest-$id.c
+ fi
}
shcc () {
prefixtools sh-elf-
GCCOPTS="$CCOPTS -m1"
GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
+ endian="big"
}
calmrisccc () {
prefixtools calmrisc16-unknown-elf-
GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
GCCOPTIMIZE="-fomit-frame-pointer"
+ endian="big"
}
coldfirecc () {
prefixtools m68k-elf-
GCCOPTS="$CCOPTS -g -m5200 -Wa\,-m5249 -malign-int -mstrict-align"
GCCOPTIMIZE="-fomit-frame-pointer"
+ endian="big"
}
whichaddr () {
@@ -543,6 +577,19 @@ else
fi
+if test "X$endian" = "Xbig"; then
+ defendian="ROCKBOX_BIG_ENDIAN"
+else
+ defendian="ROCKBOX_LITTLE_ENDIAN"
+fi
+
+sed > autoconf.h \
+ -e "s,@ENDIAN@,${defendian},g" \
+<<EOF
+/* Define endianess for the target or simulator platform */
+#define @ENDIAN@ 1
+EOF
+
sed > Makefile \
-e "s,@ROOTDIR@,${rootdir},g" \
-e "s,@DEBUG@,${debug},g" \
@@ -576,6 +623,7 @@ sed > Makefile \
-e "s,@GCCVER@,${gccver},g" \
-e "s,@GCCNUM@,${gccnum},g" \
-e "s,@UNAME@,${uname},g" \
+ -e "s,@ENDIAN@,${defendian},g" \
<<EOF
## Automaticly generated. http://www.rockbox.org/