forked from len0rd/rockbox
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
This commit is contained in:
parent
08dae4f66e
commit
6c38d8513b
1 changed files with 48 additions and 0 deletions
48
tools/configure
vendored
48
tools/configure
vendored
|
@ -43,6 +43,8 @@ crosswincc () {
|
||||||
GCCOPTS="$GCCOPTS -mno-cygwin"
|
GCCOPTS="$GCCOPTS -mno-cygwin"
|
||||||
|
|
||||||
output="rockboxui.exe" # use this as output binary name
|
output="rockboxui.exe" # use this as output binary name
|
||||||
|
crosscompile="yes"
|
||||||
|
endian="little" # windows is little endian
|
||||||
}
|
}
|
||||||
|
|
||||||
simcc () {
|
simcc () {
|
||||||
|
@ -92,24 +94,56 @@ simcc () {
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
esac
|
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 () {
|
shcc () {
|
||||||
prefixtools sh-elf-
|
prefixtools sh-elf-
|
||||||
GCCOPTS="$CCOPTS -m1"
|
GCCOPTS="$CCOPTS -m1"
|
||||||
GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
|
GCCOPTIMIZE="-fomit-frame-pointer -fschedule-insns"
|
||||||
|
endian="big"
|
||||||
}
|
}
|
||||||
|
|
||||||
calmrisccc () {
|
calmrisccc () {
|
||||||
prefixtools calmrisc16-unknown-elf-
|
prefixtools calmrisc16-unknown-elf-
|
||||||
GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
|
GCCOPTS="-Wl\,--no-check-sections $CCOPTS"
|
||||||
GCCOPTIMIZE="-fomit-frame-pointer"
|
GCCOPTIMIZE="-fomit-frame-pointer"
|
||||||
|
endian="big"
|
||||||
}
|
}
|
||||||
|
|
||||||
coldfirecc () {
|
coldfirecc () {
|
||||||
prefixtools m68k-elf-
|
prefixtools m68k-elf-
|
||||||
GCCOPTS="$CCOPTS -g -m5200 -Wa\,-m5249 -malign-int -mstrict-align"
|
GCCOPTS="$CCOPTS -g -m5200 -Wa\,-m5249 -malign-int -mstrict-align"
|
||||||
GCCOPTIMIZE="-fomit-frame-pointer"
|
GCCOPTIMIZE="-fomit-frame-pointer"
|
||||||
|
endian="big"
|
||||||
}
|
}
|
||||||
|
|
||||||
whichaddr () {
|
whichaddr () {
|
||||||
|
@ -543,6 +577,19 @@ else
|
||||||
|
|
||||||
fi
|
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 \
|
sed > Makefile \
|
||||||
-e "s,@ROOTDIR@,${rootdir},g" \
|
-e "s,@ROOTDIR@,${rootdir},g" \
|
||||||
-e "s,@DEBUG@,${debug},g" \
|
-e "s,@DEBUG@,${debug},g" \
|
||||||
|
@ -576,6 +623,7 @@ sed > Makefile \
|
||||||
-e "s,@GCCVER@,${gccver},g" \
|
-e "s,@GCCVER@,${gccver},g" \
|
||||||
-e "s,@GCCNUM@,${gccnum},g" \
|
-e "s,@GCCNUM@,${gccnum},g" \
|
||||||
-e "s,@UNAME@,${uname},g" \
|
-e "s,@UNAME@,${uname},g" \
|
||||||
|
-e "s,@ENDIAN@,${defendian},g" \
|
||||||
<<EOF
|
<<EOF
|
||||||
## Automaticly generated. http://www.rockbox.org/
|
## Automaticly generated. http://www.rockbox.org/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue