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
This commit is contained in:
Jens Arnold 2010-04-05 15:47:12 +00:00
parent 59dbdabb71
commit db2f0edfa9

84
tools/configure vendored
View file

@ -68,24 +68,27 @@ findtool(){
fi fi
} }
# scan the $PATH for sdl-config - if crosscompiling, require that it is # scan the $PATH for sdl-config - check whether for a (cross-)win32
# a mingw32 sdl-config # sdl as requested
findsdl(){ findsdl(){
file="sdl-config" file="sdl-config"
winbuild="$1"
IFS=":" IFS=":"
for path in $PATH for path in $PATH
do do
#echo "checks for $file in $path" >&2 #echo "checks for $file in $path" >&2
if test -f "$path/$file"; then 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" echo "$path/$file"
return return
fi fi
else else
echo "$path/$file" if [ "yes" != "${winbuild}" ]; then
return echo "$path/$file"
return
fi
fi fi
fi fi
done done
@ -97,26 +100,13 @@ simcc () {
prefixtools "" prefixtools ""
simver=sdl simver=sdl
winbuild="$crosscompile"
GCCOPTS='-W -Wall -g -fno-builtin' GCCOPTS='-W -Wall -g -fno-builtin'
GCCOPTIMIZE='' GCCOPTIMIZE=''
LDOPTS=''
output="rockboxui" # use this as default output binary name # default output binary name
sdl=`findsdl` output="rockboxui"
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 share option, override below if needed # default share option, override below if needed
SHARED_FLAG="-shared" SHARED_FLAG="-shared"
@ -125,56 +115,58 @@ simcc () {
CYGWIN*) CYGWIN*)
echo "Cygwin host detected" echo "Cygwin host detected"
# sdl version LDOPTS="-mconsole"
GCCOPTS="$GCCOPTS $sdl_cflags" output="rockboxui.exe"
LDOPTS="-mconsole $sdl_libs" winbuild="yes"
output="rockboxui.exe" # use this as output binary name
;; ;;
MINGW*) MINGW*)
echo "MinGW host detected" echo "MinGW host detected"
# sdl version LDOPTS="-mconsole"
GCCOPTS="$GCCOPTS $sdl_cflags" output="rockboxui.exe"
LDOPTS="-mconsole $sdl_libs" winbuild="yes"
output="rockboxui.exe" # use this as output binary name
;; ;;
Linux) Linux)
echo "Linux host detected" echo "Linux host detected"
GCCOPTS="$GCCOPTS $sdl_cflags"
LDOPTS="$sdl_libs"
;; ;;
FreeBSD) FreeBSD)
echo "FreeBSD host detected" echo "FreeBSD host detected"
# sdl version
GCCOPTS="$GCCOPTS $sdl_cflags"
LDOPTS="$sdl_libs"
;; ;;
Darwin) Darwin)
echo "Darwin host detected" echo "Darwin host detected"
# sdl version
GCCOPTS="$GCCOPTS $sdl_cflags"
LDOPTS="$sdl_libs"
SHARED_FLAG="-dynamiclib -Wl\,-single_module" SHARED_FLAG="-dynamiclib -Wl\,-single_module"
;; ;;
SunOS) SunOS)
echo "*Solaris host detected" echo "*Solaris host detected"
GCCOPTS="$GCCOPTS $sdl_cflags"
LDOPTS="$sdl_libs"
;; ;;
*) *)
echo "[ERROR] Unsupported system: $uname, fix configure and retry" echo "[ERROR] Unsupported system: $uname, fix configure and retry"
exit 2 exit 1
;; ;;
esac 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)" GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
if test "X$crosscompile" != "Xyes"; then if test "X$crosscompile" != "Xyes"; then
@ -230,8 +222,8 @@ EOF
# We are crosscompiling # We are crosscompiling
# add cross-compiler option(s) # add cross-compiler option(s)
prefixtools i586-mingw32msvc- prefixtools i586-mingw32msvc-
LDOPTS="-mconsole $sdl_libs" LDOPTS="$LDOPTS -mconsole"
output="rockboxui.exe" # use this as output binary name output="rockboxui.exe"
endian="little" # windows is little endian endian="little" # windows is little endian
echo "Enabling MMX support" echo "Enabling MMX support"
GCCOPTS="$GCCOPTS -mmmx" GCCOPTS="$GCCOPTS -mmmx"