summaryrefslogtreecommitdiff
path: root/tools/configure
diff options
context:
space:
mode:
Diffstat (limited to 'tools/configure')
-rwxr-xr-xtools/configure78
1 files changed, 77 insertions, 1 deletions
diff --git a/tools/configure b/tools/configure
index bcb7d0a864..889012ab78 100755
--- a/tools/configure
+++ b/tools/configure
@@ -25,6 +25,7 @@ bindir=
25libdir= 25libdir=
26sharedir= 26sharedir=
27 27
28thread_support="ASSEMBLER_THREADS"
28app_modelname= 29app_modelname=
29app_lcd_width= 30app_lcd_width=
30app_lcd_height= 31app_lcd_height=
@@ -163,6 +164,39 @@ findsdl(){
163 done 164 done
164} 165}
165 166
167# check for availability of sigaltstack to support our thread engine
168check_sigaltstack() {
169 cat >$tmpdir/check_threads.c <<EOF
170#include <signal.h>
171int main(int argc, char **argv)
172{
173 #define NULL (void*)0
174 sigaltstack(NULL, NULL);
175 return 0;
176}
177EOF
178 $CC -o $tmpdir/check_threads $tmpdir/check_threads.c 1> /dev/null
179 result=$?
180 rm -rf $tmpdir/check_threads*
181 echo $result
182}
183
184# check for availability of Fiber on Win32 to support our thread engine
185check_fiber() {
186 cat >$tmpdir/check_threads.c <<EOF
187#include <windows.h>
188int main(int argc, char **argv)
189{
190 ConvertThreadToFiber(NULL);
191 return 0;
192}
193EOF
194 $CC -o $tmpdir/check_threads $tmpdir/check_threads.c 2>/dev/null
195 result=$?
196 rm -rf $tmpdir/check_threads*
197 echo $result
198}
199
166simcc () { 200simcc () {
167 201
168 # default tool setup for native building 202 # default tool setup for native building
@@ -175,6 +209,8 @@ simcc () {
175 GCCOPTS="$GCCOPTS -fno-builtin -g" 209 GCCOPTS="$GCCOPTS -fno-builtin -g"
176 GCCOPTIMIZE='' 210 GCCOPTIMIZE=''
177 LDOPTS='-lm' # button-sdl.c uses sqrt() 211 LDOPTS='-lm' # button-sdl.c uses sqrt()
212 sigaltstack=""
213 fibers=""
178 214
179 # default output binary name, don't override app_get_platform() 215 # default output binary name, don't override app_get_platform()
180 if [ "$app_type" != "sdl-app" ]; then 216 if [ "$app_type" != "sdl-app" ]; then
@@ -193,6 +229,7 @@ simcc () {
193 CYGWIN*) 229 CYGWIN*)
194 echo "Cygwin host detected" 230 echo "Cygwin host detected"
195 231
232 fibers=`check_fiber`
196 LDOPTS="$LDOPTS -mconsole" 233 LDOPTS="$LDOPTS -mconsole"
197 output="$output.exe" 234 output="$output.exe"
198 winbuild="yes" 235 winbuild="yes"
@@ -201,29 +238,33 @@ simcc () {
201 MINGW*) 238 MINGW*)
202 echo "MinGW host detected" 239 echo "MinGW host detected"
203 240
241 fibers=`check_fiber`
204 LDOPTS="$LDOPTS -mconsole" 242 LDOPTS="$LDOPTS -mconsole"
205 output="$output.exe" 243 output="$output.exe"
206 winbuild="yes" 244 winbuild="yes"
207 ;; 245 ;;
208 246
209 Linux) 247 Linux)
248 sigaltstack=`check_sigaltstack`
210 echo "Linux host detected" 249 echo "Linux host detected"
211 LDOPTS="$LDOPTS -ldl" 250 LDOPTS="$LDOPTS -ldl"
212 ;; 251 ;;
213 252
214 FreeBSD) 253 FreeBSD)
254 sigaltstack=`check_sigaltstack`
215 echo "FreeBSD host detected" 255 echo "FreeBSD host detected"
216 LDOPTS="$LDOPTS -ldl" 256 LDOPTS="$LDOPTS -ldl"
217 ;; 257 ;;
218 258
219 Darwin) 259 Darwin)
260 sigaltstack=`check_sigaltstack`
220 echo "Darwin host detected" 261 echo "Darwin host detected"
221 LDOPTS="$LDOPTS -ldl" 262 LDOPTS="$LDOPTS -ldl"
222
223 SHARED_FLAG="-dynamiclib -Wl\,-single_module" 263 SHARED_FLAG="-dynamiclib -Wl\,-single_module"
224 ;; 264 ;;
225 265
226 SunOS) 266 SunOS)
267 sigaltstack=`check_sigaltstack`
227 echo "*Solaris host detected" 268 echo "*Solaris host detected"
228 269
229 GCCOPTS="$GCCOPTS -fPIC" 270 GCCOPTS="$GCCOPTS -fPIC"
@@ -319,11 +360,33 @@ EOF
319 # add cross-compiler option(s) 360 # add cross-compiler option(s)
320 prefixtools i586-mingw32msvc- 361 prefixtools i586-mingw32msvc-
321 LDOPTS="$LDOPTS -mconsole" 362 LDOPTS="$LDOPTS -mconsole"
363 fibers=`check_fiber`
322 output="rockboxui.exe" 364 output="rockboxui.exe"
323 endian="little" # windows is little endian 365 endian="little" # windows is little endian
324 echo "Enabling MMX support" 366 echo "Enabling MMX support"
325 GCCOPTS="$GCCOPTS -mmmx" 367 GCCOPTS="$GCCOPTS -mmmx"
326 fi 368 fi
369
370 thread_support=
371 if [ -z "$ARG_THREAD_SUPPORT" ] || [ "$ARG_THREAD_SUPPORT" = "0" ]; then
372 if [ "$sigaltstack" = "0" ]; then
373 thread_support="HAVE_SIGALTSTACK_THREADS"
374 echo "Selected sigaltstack threads"
375 elif [ "$fibers" = "0" ]; then
376 thread_support="HAVE_WIN32_FIBER_THREADS"
377 echo "Selected Win32 Fiber threads"
378 fi
379 fi
380
381 if [ -n `echo $app_type | grep "sdl"` ] && [ -z "$thread_support" ] \
382 && [ "$ARG_THREAD_SUPPORT" != "0" ]; then
383 thread_support="HAVE_SDL_THREADS"
384 if [ "$ARG_THREAD_SUPPORT" = "1" ]; then
385 echo "Selected SDL threads"
386 else
387 echo "WARNING: Falling back to SDL threads"
388 fi
389 fi
327} 390}
328 391
329# 392#
@@ -994,6 +1057,11 @@ help() {
994 --thumb Build with -mthumb (for ARM builds) 1057 --thumb Build with -mthumb (for ARM builds)
995 --no-thumb The opposite of --thumb (don't use thumb even for targets 1058 --no-thumb The opposite of --thumb (don't use thumb even for targets
996 where this is the default 1059 where this is the default
1060 --sdl-threads Force use of SDL threads. They have inferior performance,
1061 but are better debuggable with GDB
1062 --no-sdl-threads Disallow use of SDL threads. This prevents the default
1063 behavior of falling back to them if no native thread
1064 support was found.
997 --prefix Target installation directory 1065 --prefix Target installation directory
998 --help Shows this message (must not be used with other options) 1066 --help Shows this message (must not be used with other options)
999 1067
@@ -1015,6 +1083,7 @@ ARG_VOICE=
1015ARG_ARM_EABI= 1083ARG_ARM_EABI=
1016ARG_ARM_THUMB= 1084ARG_ARM_THUMB=
1017ARG_PREFIX="$PREFIX" 1085ARG_PREFIX="$PREFIX"
1086ARG_THREAD_SUPPORT=
1018err= 1087err=
1019for arg in "$@"; do 1088for arg in "$@"; do
1020 case "$arg" in 1089 case "$arg" in
@@ -1035,6 +1104,9 @@ for arg in "$@"; do
1035 --no-eabi) ARG_ARM_EABI=0;; 1104 --no-eabi) ARG_ARM_EABI=0;;
1036 --thumb) ARG_ARM_THUMB=1;; 1105 --thumb) ARG_ARM_THUMB=1;;
1037 --no-thumb) ARG_ARM_THUMB=0;; 1106 --no-thumb) ARG_ARM_THUMB=0;;
1107 --sdl-threads)ARG_THREAD_SUPPORT=1;;
1108 --no-sdl-threads)
1109 ARG_THREAD_SUPPORT=0;;
1038 --prefix=*) ARG_PREFIX=`echo "$arg" | cut -d = -f 2`;; 1110 --prefix=*) ARG_PREFIX=`echo "$arg" | cut -d = -f 2`;;
1039 --help) help;; 1111 --help) help;;
1040 *) err=1; echo "[ERROR] Option '$arg' unsupported";; 1112 *) err=1; echo "[ERROR] Option '$arg' unsupported";;
@@ -3326,6 +3398,7 @@ sed > autoconf.h \
3326 -e "s<^#undef DO_BOOTCHART<$use_bootchart<g" \ 3398 -e "s<^#undef DO_BOOTCHART<$use_bootchart<g" \
3327 -e "s<@config_rtc@<$config_rtc<g" \ 3399 -e "s<@config_rtc@<$config_rtc<g" \
3328 -e "s<@have_rtc_alarm@<$have_rtc_alarm<g" \ 3400 -e "s<@have_rtc_alarm@<$have_rtc_alarm<g" \
3401 -e "s<@thread_support@<$thread_support<g" \
3329 -e "s<@RBDIR@<${rbdir}<g" \ 3402 -e "s<@RBDIR@<${rbdir}<g" \
3330 -e "s<@sharepath@<${sharedir}<g" \ 3403 -e "s<@sharepath@<${sharedir}<g" \
3331 -e "s<@binpath@<${bindir}<g" \ 3404 -e "s<@binpath@<${bindir}<g" \
@@ -3362,6 +3435,9 @@ sed > autoconf.h \
3362@config_rtc@ 3435@config_rtc@
3363@have_rtc_alarm@ 3436@have_rtc_alarm@
3364 3437
3438/* the threading backend we use */
3439#define @thread_support@
3440
3365/* lcd dimensions for application builds from configure */ 3441/* lcd dimensions for application builds from configure */
3366@lcd_width@ 3442@lcd_width@
3367@lcd_height@ 3443@lcd_height@