summaryrefslogtreecommitdiff
path: root/tools/configure
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-12-23 09:03:31 +0000
committerThomas Martitz <kugel@rockbox.org>2011-12-23 09:03:31 +0000
commit013cc9dedfa940588ae6a69e08d5be51f72c6b8e (patch)
treec0f6203a149a588262fe296831ab9df1c43948e3 /tools/configure
parent893666a734a79885ffb7f701225daf805e437bf5 (diff)
downloadrockbox-013cc9dedfa940588ae6a69e08d5be51f72c6b8e.tar.gz
rockbox-013cc9dedfa940588ae6a69e08d5be51f72c6b8e.zip
Resolve CROSS/CROSS_COMPILE dualism in configure to use only CROSS_COMPILE (only used for SDL builds so far), which should be the de facto environment variable for this.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31408 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/configure')
-rwxr-xr-xtools/configure108
1 files changed, 51 insertions, 57 deletions
diff --git a/tools/configure b/tools/configure
index 1b7eaa0b58..d1ed70a461 100755
--- a/tools/configure
+++ b/tools/configure
@@ -148,7 +148,7 @@ findtool(){
148# sdl as requested 148# sdl as requested
149findsdl(){ 149findsdl(){
150 # sdl-config might (not) be prefixed for cross compiles so try both. 150 # sdl-config might (not) be prefixed for cross compiles so try both.
151 files="sdl-config:${CROSS}sdl-config" 151 files="${CROSS_COMPILE}sdl-config:sdl-config"
152 winbuild="$1" 152 winbuild="$1"
153 153
154 IFS=":" 154 IFS=":"
@@ -234,11 +234,18 @@ simcc () {
234 SHARED_CFLAGS="-fPIC -fvisibility=hidden" 234 SHARED_CFLAGS="-fPIC -fvisibility=hidden"
235 235
236 if [ "$win32crosscompile" = "yes" ]; then 236 if [ "$win32crosscompile" = "yes" ]; then
237 # We are crosscompiling
238 # add cross-compiler option(s)
237 LDOPTS="$LDOPTS -mconsole" 239 LDOPTS="$LDOPTS -mconsole"
238 output="$output.exe" 240 output="$output.exe"
239 winbuild="yes" 241 winbuild="yes"
240 CROSS=${CROSS:-"i586-mingw32msvc-"} 242 CROSS_COMPILE=${CROSS_COMPILE:-"i586-mingw32msvc-"}
241 SHARED_CFLAGS='' 243 SHARED_CFLAGS=''
244 prefixtools "$CROSS_COMPILE"
245 fibers=`check_fiber`
246 endian="little" # windows is little endian
247 echo "Enabling MMX support"
248 GCCOPTS="$GCCOPTS -mmmx"
242 else 249 else
243 case $uname in 250 case $uname in
244 CYGWIN*) 251 CYGWIN*)
@@ -294,7 +301,14 @@ simcc () {
294 esac 301 esac
295 fi 302 fi
296 303
297 [ "$winbuild" != "yes" ] && GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs" 304 if [ "$winbuild" != "yes" ]; then
305 GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs"
306 if [ "`uname -m`" = "i686" ]; then
307 echo "Enabling MMX support"
308 GCCOPTS="$GCCOPTS -mmmx"
309 fi
310 fi
311
298 sdl=`findsdl $winbuild` 312 sdl=`findsdl $winbuild`
299 313
300 if [ -n `echo $app_type | grep "sdl"` ]; then 314 if [ -n `echo $app_type | grep "sdl"` ]; then
@@ -312,68 +326,51 @@ simcc () {
312 326
313 327
314 GCCOPTS="$GCCOPTS -I\$(SIMDIR)" 328 GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
329 # x86_64 supports MMX by default
315 330
316 if test "X$win32crosscompile" != "Xyes"; then 331 if [ "$endian" = "" ]; then
317 if test "`uname -m`" = "i686"; then 332 id=$$
318 echo "Enabling MMX support" 333 cat >$tmpdir/conftest-$id.c <<EOF
319 GCCOPTS="$GCCOPTS -mmmx"
320 fi
321 # x86_64 supports MMX by default
322
323 id=$$
324 cat >$tmpdir/conftest-$id.c <<EOF
325#include <stdio.h> 334#include <stdio.h>
326int main(int argc, char **argv) 335int main(int argc, char **argv)
327{ 336{
328 int var=0; 337int var=0;
329 char *varp = (char *)&var; 338char *varp = (char *)&var;
330 *varp=1; 339*varp=1;
331 340
332 printf("%d\n", var); 341printf("%d\n", var);
333 return 0; 342return 0;
334} 343}
335EOF 344EOF
345 $CC -o $tmpdir/conftest-$id $tmpdir/conftest-$id.c 2>/dev/null
346 # when cross compiling, the endianess cannot be detected because the above program doesn't run
347 # on the local machine. assume little endian but print a warning
348 endian=`$tmpdir/conftest-$id 2> /dev/null`
349 if [ "$endian" != "" ] && [ $endian -gt "1" ]; then
350 # big endian
351 endian="big"
352 else
353 # little endian
354 endian="little"
355 fi
356 fi
336 357
337 $CC -o $tmpdir/conftest-$id $tmpdir/conftest-$id.c 2>/dev/null 358 if [ "$CROSS_COMPILE" != "" ]; then
338 359 echo "WARNING: Cross Compiling, cannot detect endianess. Assuming $endian endian!"
339 # when cross compiling, the endianess cannot be detected because the above program doesn't run 360 fi
340 # on the local machine. assume little endian but print a warning
341 endian=`$tmpdir/conftest-$id 2> /dev/null`
342 if [ "$endian" != "" ] && [ $endian -gt "1" ]; then
343 # big endian
344 endian="big"
345 else
346 # little endian
347 endian="little"
348 fi
349
350 if [ "$CROSS_COMPILE" != "" ]; then
351 echo "WARNING: Cross Compiling, cannot detect endianess. Assuming little endian!"
352 fi
353
354 if [ "$app_type" = "sdl-sim" ]; then
355 echo "Simulator environment deemed $endian endian"
356 elif [ "$app_type" = "sdl-app" ]; then
357 echo "Application environment deemed $endian endian"
358 elif [ "$app_type" = "checkwps" ]; then
359 echo "CheckWPS environment deemed $endian endian"
360 fi
361 361
362 # use wildcard here to make it work even if it was named *.exe like 362 if [ "$app_type" = "sdl-sim" ]; then
363 # on cygwin 363 echo "Simulator environment deemed $endian endian"
364 rm -f $tmpdir/conftest-$id* 364 elif [ "$app_type" = "sdl-app" ]; then
365 else 365 echo "Application environment deemed $endian endian"
366 # We are crosscompiling 366 elif [ "$app_type" = "checkwps" ]; then
367 # add cross-compiler option(s) 367 echo "CheckWPS environment deemed $endian endian"
368 prefixtools $CROSS
369 LDOPTS="$LDOPTS -mconsole"
370 fibers=`check_fiber`
371 output="rockboxui.exe"
372 endian="little" # windows is little endian
373 echo "Enabling MMX support"
374 GCCOPTS="$GCCOPTS -mmmx"
375 fi 368 fi
376 369
370 # use wildcard here to make it work even if it was named *.exe like
371 # on cygwin
372 rm -f $tmpdir/conftest-$id*
373
377 thread_support= 374 thread_support=
378 if [ -z "$ARG_THREAD_SUPPORT" ] || [ "$ARG_THREAD_SUPPORT" = "0" ]; then 375 if [ -z "$ARG_THREAD_SUPPORT" ] || [ "$ARG_THREAD_SUPPORT" = "0" ]; then
379 if [ "$sigaltstack" = "0" ]; then 376 if [ "$sigaltstack" = "0" ]; then
@@ -3515,9 +3512,6 @@ else
3515 ""|"$CROSS_COMPILE") 3512 ""|"$CROSS_COMPILE")
3516 # simulator 3513 # simulator
3517 ;; 3514 ;;
3518 ${CROSS})
3519 # cross-compile for win32
3520 ;;
3521 *) 3515 *)
3522 # Verify that the cross-compiler is of a recommended version! 3516 # Verify that the cross-compiler is of a recommended version!
3523 if test "$gccver" != "$gccchoice"; then 3517 if test "$gccver" != "$gccchoice"; then