summaryrefslogtreecommitdiff
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.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(){
68 fi 68 fi
69} 69}
70 70
71# scan the $PATH for sdl-config - if crosscompiling, require that it is 71# scan the $PATH for sdl-config - check whether for a (cross-)win32
72# a mingw32 sdl-config 72# sdl as requested
73findsdl(){ 73findsdl(){
74 file="sdl-config" 74 file="sdl-config"
75 winbuild="$1"
75 76
76 IFS=":" 77 IFS=":"
77 for path in $PATH 78 for path in $PATH
78 do 79 do
79 #echo "checks for $file in $path" >&2 80 #echo "checks for $file in $path" >&2
80 if test -f "$path/$file"; then 81 if test -f "$path/$file"; then
81 if [ "yes" = "${crosscompile}" ]; then 82 if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then
82 if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then 83 if [ "yes" = "${winbuild}" ]; then
83 echo "$path/$file" 84 echo "$path/$file"
84 return 85 return
85 fi 86 fi
86 else 87 else
87 echo "$path/$file" 88 if [ "yes" != "${winbuild}" ]; then
88 return 89 echo "$path/$file"
90 return
91 fi
89 fi 92 fi
90 fi 93 fi
91 done 94 done
@@ -97,26 +100,13 @@ simcc () {
97 prefixtools "" 100 prefixtools ""
98 101
99 simver=sdl 102 simver=sdl
103 winbuild="$crosscompile"
100 GCCOPTS='-W -Wall -g -fno-builtin' 104 GCCOPTS='-W -Wall -g -fno-builtin'
101 GCCOPTIMIZE='' 105 GCCOPTIMIZE=''
106 LDOPTS=''
102 107
103 output="rockboxui" # use this as default output binary name 108 # default output binary name
104 sdl=`findsdl` 109 output="rockboxui"
105 sdl_cflags=""
106 sdl_libs=""
107
108 if [ $1 = "sdl" ]; then
109 if [ -z "$sdl" ]; then
110 echo "configure didn't find sdl-config, which indicates that you"
111 echo "don't have SDL (properly) installed. Please correct and"
112 echo "re-run configure!"
113 exit 1
114 else
115 # generic sdl-config checker
116 sdl_cflags=`$sdl --cflags`
117 sdl_libs=`$sdl --libs`
118 fi
119 fi
120 110
121 # default share option, override below if needed 111 # default share option, override below if needed
122 SHARED_FLAG="-shared" 112 SHARED_FLAG="-shared"
@@ -125,56 +115,58 @@ simcc () {
125 CYGWIN*) 115 CYGWIN*)
126 echo "Cygwin host detected" 116 echo "Cygwin host detected"
127 117
128 # sdl version 118 LDOPTS="-mconsole"
129 GCCOPTS="$GCCOPTS $sdl_cflags" 119 output="rockboxui.exe"
130 LDOPTS="-mconsole $sdl_libs" 120 winbuild="yes"
131
132 output="rockboxui.exe" # use this as output binary name
133 ;; 121 ;;
134 122
135 MINGW*) 123 MINGW*)
136 echo "MinGW host detected" 124 echo "MinGW host detected"
137 125
138 # sdl version 126 LDOPTS="-mconsole"
139 GCCOPTS="$GCCOPTS $sdl_cflags" 127 output="rockboxui.exe"
140 LDOPTS="-mconsole $sdl_libs" 128 winbuild="yes"
141
142 output="rockboxui.exe" # use this as output binary name
143 ;; 129 ;;
144 130
145 Linux) 131 Linux)
146 echo "Linux host detected" 132 echo "Linux host detected"
147 GCCOPTS="$GCCOPTS $sdl_cflags"
148 LDOPTS="$sdl_libs"
149 ;; 133 ;;
150 134
151 FreeBSD) 135 FreeBSD)
152 echo "FreeBSD host detected" 136 echo "FreeBSD host detected"
153 # sdl version
154 GCCOPTS="$GCCOPTS $sdl_cflags"
155 LDOPTS="$sdl_libs"
156 ;; 137 ;;
157 138
158 Darwin) 139 Darwin)
159 echo "Darwin host detected" 140 echo "Darwin host detected"
160 # sdl version 141
161 GCCOPTS="$GCCOPTS $sdl_cflags"
162 LDOPTS="$sdl_libs"
163 SHARED_FLAG="-dynamiclib -Wl\,-single_module" 142 SHARED_FLAG="-dynamiclib -Wl\,-single_module"
164 ;; 143 ;;
165 144
166 SunOS) 145 SunOS)
167 echo "*Solaris host detected" 146 echo "*Solaris host detected"
168 GCCOPTS="$GCCOPTS $sdl_cflags"
169 LDOPTS="$sdl_libs"
170 ;; 147 ;;
171 148
172 *) 149 *)
173 echo "[ERROR] Unsupported system: $uname, fix configure and retry" 150 echo "[ERROR] Unsupported system: $uname, fix configure and retry"
174 exit 2 151 exit 1
175 ;; 152 ;;
176 esac 153 esac
177 154
155 sdl=`findsdl $winbuild`
156
157 if [ $1 = "sdl" ]; then
158 if [ -z "$sdl" ]; then
159 echo "configure didn't find sdl-config, which indicates that you"
160 echo "don't have SDL (properly) installed. Please correct and"
161 echo "re-run configure!"
162 exit 2
163 else
164 # generic sdl-config checker
165 GCCOPTS="$GCCOPTS `$sdl --cflags`"
166 LDOPTS="$LDOPTS `$sdl --libs`"
167 fi
168 fi
169
178 GCCOPTS="$GCCOPTS -I\$(SIMDIR)" 170 GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
179 171
180 if test "X$crosscompile" != "Xyes"; then 172 if test "X$crosscompile" != "Xyes"; then
@@ -230,8 +222,8 @@ EOF
230 # We are crosscompiling 222 # We are crosscompiling
231 # add cross-compiler option(s) 223 # add cross-compiler option(s)
232 prefixtools i586-mingw32msvc- 224 prefixtools i586-mingw32msvc-
233 LDOPTS="-mconsole $sdl_libs" 225 LDOPTS="$LDOPTS -mconsole"
234 output="rockboxui.exe" # use this as output binary name 226 output="rockboxui.exe"
235 endian="little" # windows is little endian 227 endian="little" # windows is little endian
236 echo "Enabling MMX support" 228 echo "Enabling MMX support"
237 GCCOPTS="$GCCOPTS -mmmx" 229 GCCOPTS="$GCCOPTS -mmmx"