summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2010-04-05 15:47:12 +0000
committerJens Arnold <amiconn@rockbox.org>2010-04-05 15:47:12 +0000
commitdb2f0edfa913d22d3f4f6ad184f1205966afae20 (patch)
treec2d62430bca508af460e2bf388f6605f4404424c /tools
parent59dbdabb717b3e1a16ab56eafb8178fd529b9d09 (diff)
downloadrockbox-db2f0edfa913d22d3f4f6ad184f1205966afae20.tar.gz
rockbox-db2f0edfa913d22d3f4f6ad184f1205966afae20.tar.bz2
rockbox-db2f0edfa913d22d3f4f6ad184f1205966afae20.zip
Improve SDL detection, so that path order doesn't matter if both native SDL and cross-mingw32 SDL are present. Reduce code duplication as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25486 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/configure84
1 files changed, 38 insertions, 46 deletions
diff --git a/tools/configure b/tools/configure
index e70963d601..033dedd35c 100755
--- a/tools/configure
+++ b/tools/configure
@@ -68,24 +68,27 @@ findtool(){
fi
}
-# scan the $PATH for sdl-config - if crosscompiling, require that it is
-# a mingw32 sdl-config
+# scan the $PATH for sdl-config - check whether for a (cross-)win32
+# sdl as requested
findsdl(){
file="sdl-config"
+ winbuild="$1"
IFS=":"
for path in $PATH
do
#echo "checks for $file in $path" >&2
if test -f "$path/$file"; then
- if [ "yes" = "${crosscompile}" ]; then
- if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then
+ if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then
+ if [ "yes" = "${winbuild}" ]; then
echo "$path/$file"
return
fi
else
- echo "$path/$file"
- return
+ if [ "yes" != "${winbuild}" ]; then
+ echo "$path/$file"
+ return
+ fi
fi
fi
done
@@ -97,26 +100,13 @@ simcc () {
prefixtools ""
simver=sdl
+ winbuild="$crosscompile"
GCCOPTS='-W -Wall -g -fno-builtin'
GCCOPTIMIZE=''
+ LDOPTS=''
- output="rockboxui" # use this as default output binary name
- sdl=`findsdl`
- sdl_cflags=""
- sdl_libs=""
-
- if [ $1 = "sdl" ]; then
- if [ -z "$sdl" ]; then
- echo "configure didn't find sdl-config, which indicates that you"
- echo "don't have SDL (properly) installed. Please correct and"
- echo "re-run configure!"
- exit 1
- else
- # generic sdl-config checker
- sdl_cflags=`$sdl --cflags`
- sdl_libs=`$sdl --libs`
- fi
- fi
+ # default output binary name
+ output="rockboxui"
# default share option, override below if needed
SHARED_FLAG="-shared"
@@ -125,56 +115,58 @@ simcc () {
CYGWIN*)
echo "Cygwin host detected"
- # sdl version
- GCCOPTS="$GCCOPTS $sdl_cflags"
- LDOPTS="-mconsole $sdl_libs"
-
- output="rockboxui.exe" # use this as output binary name
+ LDOPTS="-mconsole"
+ output="rockboxui.exe"
+ winbuild="yes"
;;
MINGW*)
echo "MinGW host detected"
- # sdl version
- GCCOPTS="$GCCOPTS $sdl_cflags"
- LDOPTS="-mconsole $sdl_libs"
-
- output="rockboxui.exe" # use this as output binary name
+ LDOPTS="-mconsole"
+ output="rockboxui.exe"
+ winbuild="yes"
;;
Linux)
echo "Linux host detected"
- GCCOPTS="$GCCOPTS $sdl_cflags"
- LDOPTS="$sdl_libs"
;;
FreeBSD)
echo "FreeBSD host detected"
- # sdl version
- GCCOPTS="$GCCOPTS $sdl_cflags"
- LDOPTS="$sdl_libs"
;;
Darwin)
echo "Darwin host detected"
- # sdl version
- GCCOPTS="$GCCOPTS $sdl_cflags"
- LDOPTS="$sdl_libs"
+
SHARED_FLAG="-dynamiclib -Wl\,-single_module"
;;
SunOS)
echo "*Solaris host detected"
- GCCOPTS="$GCCOPTS $sdl_cflags"
- LDOPTS="$sdl_libs"
;;
*)
echo "[ERROR] Unsupported system: $uname, fix configure and retry"
- exit 2
+ exit 1
;;
esac
+ sdl=`findsdl $winbuild`
+
+ if [ $1 = "sdl" ]; then
+ if [ -z "$sdl" ]; then
+ echo "configure didn't find sdl-config, which indicates that you"
+ echo "don't have SDL (properly) installed. Please correct and"
+ echo "re-run configure!"
+ exit 2
+ else
+ # generic sdl-config checker
+ GCCOPTS="$GCCOPTS `$sdl --cflags`"
+ LDOPTS="$LDOPTS `$sdl --libs`"
+ fi
+ fi
+
GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
if test "X$crosscompile" != "Xyes"; then
@@ -230,8 +222,8 @@ EOF
# We are crosscompiling
# add cross-compiler option(s)
prefixtools i586-mingw32msvc-
- LDOPTS="-mconsole $sdl_libs"
- output="rockboxui.exe" # use this as output binary name
+ LDOPTS="$LDOPTS -mconsole"
+ output="rockboxui.exe"
endian="little" # windows is little endian
echo "Enabling MMX support"
GCCOPTS="$GCCOPTS -mmmx"