From e6317d51e95c4ff9dc632085cac0445ca96f4d7a Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Thu, 8 Sep 2011 17:48:18 +0000 Subject: Improve sim win32 cross compiling. - Extend configure to allow setting the cross compiler prefix using the environment variable CROSS. This allows using a compiler that is prefixed differently than the prefix configure does assume. - When searching for sdl-config also check for a prefixed version. Some toolchains prefix sdl-config (like mingw-cross-env). This enables cross compiling the sim with at least the MinGW packages provided by Fedora (different prefix) and mingw-cross-env (different prefix and prefixes sdl-config. There's a non-prefixed version as well, but that folder also includes the non-prefixed compiler, so using the prefixed version is preferable.) starting git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30484 a1c6a512-1295-4272-9138-f99709370657 --- tools/configure | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/tools/configure b/tools/configure index d9324fdb82..755c04c159 100755 --- a/tools/configure +++ b/tools/configure @@ -147,26 +147,30 @@ findtool(){ # scan the $PATH for sdl-config - check whether for a (cross-)win32 # sdl as requested findsdl(){ - file="sdl-config" + # sdl-config might (not) be prefixed for cross compiles so try both. + files="sdl-config:${CROSS}sdl-config" winbuild="$1" IFS=":" - for path in $PATH + for file in $files do - #echo "checks for $file in $path" >&2 - if test -f "$path/$file"; then - if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then - if [ "yes" = "${winbuild}" ]; then - echo "$path/$file" - return - fi - else - if [ "yes" != "${winbuild}" ]; then - echo "$path/$file" - return + for path in $PATH + do + #echo "checks for $file in $path" >&2 + if test -f "$path/$file"; then + if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then + if [ "yes" = "${winbuild}" ]; then + echo "$path/$file" + return + fi + else + if [ "yes" != "${winbuild}" ]; then + echo "$path/$file" + return + fi fi fi - fi + done done } @@ -233,6 +237,7 @@ simcc () { LDOPTS="$LDOPTS -mconsole" output="$output.exe" winbuild="yes" + CROSS=${CROSS:-"i586-mingw32msvc-"} SHARED_CFLAGS='' else case $uname in @@ -360,7 +365,7 @@ EOF else # We are crosscompiling # add cross-compiler option(s) - prefixtools i586-mingw32msvc- + prefixtools $CROSS LDOPTS="$LDOPTS -mconsole" fibers=`check_fiber` output="rockboxui.exe" @@ -3445,7 +3450,7 @@ else ""|"$CROSS_COMPILE") # simulator ;; - i586-mingw32msvc-) + ${CROSS}) # cross-compile for win32 ;; *) -- cgit v1.2.3