summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/configure89
1 files changed, 76 insertions, 13 deletions
diff --git a/tools/configure b/tools/configure
index a9fe058cbd..11ff981fdb 100755
--- a/tools/configure
+++ b/tools/configure
@@ -160,16 +160,41 @@ findtool(){
160# scan the $PATH for sdl-config - check whether for a (cross-)win32 160# scan the $PATH for sdl-config - check whether for a (cross-)win32
161# sdl as requested 161# sdl as requested
162findsdl(){ 162findsdl(){
163 # sdl-config might (not) be prefixed for cross compiles so try both. 163 files=sdl-config
164 files="${CROSS_COMPILE}sdl-config:sdl-config" 164 if [ -n "$CROSS_COMPILE" ]; then
165 # sdl-config might (not) be prefixed for cross compiles so try both.
166 files="${CROSS_COMPILE}sdl-config:${files}"
167 fi
165 winbuild="$1" 168 winbuild="$1"
166 169
170 paths2check="$PATH"
171
172 if [ -n "$CROSS_COMPILE" ]; then
173 # add cross compile sys-root-directories to search in:
174 sysroot=$($CPP --print-sysroot 2>&1)
175 if [ $? -eq 0 ];
176 then
177 subdirs="bin:mingw/bin:sbin:mingw/sbin"
178 IFS=":"
179 for subdir in $subdirs
180 do
181 if [ -e "${sysroot}/${subdir}" ]; then
182 paths2check="${sysroot}/${subdir}:${paths2check}"
183 fi
184 done
185 else
186 echo "WARNING: unable to get sys-root directory from your cross-compiler" >&2
187 echo "WARNING: $CPP --print-sysroot returns" >&2
188 echo "WARNING: ${sysroot}" >&2
189 fi
190 fi
191
192 # search for the correct sdl-config
167 IFS=":" 193 IFS=":"
168 for file in $files 194 for path in $paths2check
169 do 195 do
170 for path in $PATH 196 for file in $files
171 do 197 do
172 #echo "checks for $file in $path" >&2
173 if test -f "$path/$file"; then 198 if test -f "$path/$file"; then
174 if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then 199 if [ "0" != `$path/$file --libs |grep -c mwindows` ]; then
175 if [ "yes" = "${winbuild}" ]; then 200 if [ "yes" = "${winbuild}" ]; then
@@ -258,10 +283,35 @@ simcc () {
258 if [ "$win32crosscompile" = "yes" ]; then 283 if [ "$win32crosscompile" = "yes" ]; then
259 # We are crosscompiling 284 # We are crosscompiling
260 # add cross-compiler option(s) 285 # add cross-compiler option(s)
286 GCCOPTS="$GCCOPTS -Wno-format"
261 LDOPTS="$LDOPTS -mconsole -static" 287 LDOPTS="$LDOPTS -mconsole -static"
262 output="$output.exe" 288 output="$output.exe"
263 winbuild="yes" 289 winbuild="yes"
264 CROSS_COMPILE=${CROSS_COMPILE:-"i586-mingw32msvc-"} 290
291 if [ -z "$CROSS_COMPILE" ]; then
292 if [ "$win64" = "yes" ]; then
293 CROSS_COMPILE=${CROSS_COMPILE:-"x86_64-w64-mingw32-"}
294 else
295 # different possible names; try to find the correct one:
296 names="i686-w64-mingw32 i686-pc-mingw32 i586-mingw32msvc"
297
298 for name in $names
299 do
300 if which "${name}-gcc" >/dev/null 2>&1 ; then
301 CROSS_COMPILE="${name}-"
302 break
303 fi
304 done
305
306 if [ -z "$CROSS_COMPILE" ]; then
307 echo "WARNING: unable to find cross-compiler for 32-bit Windows environment!"
308 echo "WARNING: it's none of \"$names\"."
309 echo "WARNING: set your compiler prefix with CROSS_COMPILE=\"your-prefix-\" and"
310 echo "WARNING: re-run configure again!"
311 exit 2
312 fi
313 fi
314 fi
265 SHARED_CFLAGS='' 315 SHARED_CFLAGS=''
266 prefixtools "$CROSS_COMPILE" 316 prefixtools "$CROSS_COMPILE"
267 fibers=`check_fiber` 317 fibers=`check_fiber`
@@ -343,14 +393,18 @@ simcc () {
343 echo "re-run configure!" 393 echo "re-run configure!"
344 exit 2 394 exit 2
345 else 395 else
396 echo Using $sdl
397
346 # generic sdl-config checker 398 # generic sdl-config checker
347 GCCOPTS="$GCCOPTS `$sdl --cflags`" 399 sdlccopts=$($sdl --cflags)
348 if sdl-config --static-libs > /dev/null 2>&1 ; then 400 if $sdl --static-libs > /dev/null 2>&1 ; then
349 LDOPTS="$LDOPTS `$sdl --static-libs`" 401 sdlldopts=$($sdl --static-libs)
350 else 402 else
351 echo "Your sdl-config does not know about static libs, falling back to shared library" 403 echo "Your sdl-config does not know about static libs, falling back to shared library"
352 LDOPTS="$LDOPTS `$sdl --libs`" 404 sdlldopts=$($sdl --libs)
353 fi 405 fi
406 GCCOPTS="$GCCOPTS ${sdlccopts}"
407 LDOPTS="$LDOPTS ${sdlldopts}"
354 fi 408 fi
355 fi 409 fi
356 410
@@ -812,7 +866,7 @@ whichadvanced () {
812 echo "" 866 echo ""
813 printf "Enter your developer options (press only enter when done)\n\ 867 printf "Enter your developer options (press only enter when done)\n\
814(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile,\n\ 868(D)EBUG, (L)ogf, Boot(c)hart, (S)imulator, (P)rofiling, (V)oice, (W)in32 crosscompile,\n\
815(T)est plugins, S(m)all C lib, Logf to Ser(i)al port:" 869Win(6)4 crosscompile, (T)est plugins, S(m)all C lib, Logf to Ser(i)al port:"
816 if [ "$modelname" = "archosplayer" ]; then 870 if [ "$modelname" = "archosplayer" ]; then
817 printf ", Use (A)TA poweroff" 871 printf ", Use (A)TA poweroff"
818 fi 872 fi
@@ -910,8 +964,14 @@ whichadvanced () {
910 fi 964 fi
911 ;; 965 ;;
912 [Ww]) 966 [Ww])
913 echo "Enabling Windows 32 cross-compiling" 967 echo "Enabling Windows cross-compiling (32-bit)"
968 win32crosscompile="yes"
969 win64=""
970 ;;
971 [6])
972 echo "Enabling Windows cross-compiling (64-bit)"
914 win32crosscompile="yes" 973 win32crosscompile="yes"
974 win64="yes"
915 ;; 975 ;;
916 "") # Match enter press when finished with advanced options 976 "") # Match enter press when finished with advanced options
917 cont=0 977 cont=0
@@ -4272,6 +4332,9 @@ DLLTOOL=`findtool ${DLLTOOL} --lit`
4272DLLWRAP=`findtool ${DLLWRAP} --lit` 4332DLLWRAP=`findtool ${DLLWRAP} --lit`
4273RANLIB=`findtool ${RANLIB} --lit` 4333RANLIB=`findtool ${RANLIB} --lit`
4274 4334
4335# in pure cross-compiler environments without own native compiler this helps:
4336HOSTCC=${HOSTCC:-${CC}}
4337HOSTAR=${HOSTAR:-${AR}}
4275 4338
4276if [ -z "$arch" ]; then 4339if [ -z "$arch" ]; then
4277 cpp_defines=$(echo "" | $CPP $GCCOPTS -dD) 4340 cpp_defines=$(echo "" | $CPP $GCCOPTS -dD)