Commit 7c1f25b46a7c9c4b953976631ae94a07e4ba531a

Authored by bellard
1 parent ee9dbb29

probe static SDL link


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@732 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 53 additions and 22 deletions
Makefile.target
@@ -246,9 +246,13 @@ VL_OBJS+=gdbstub.o @@ -246,9 +246,13 @@ VL_OBJS+=gdbstub.o
246 endif 246 endif
247 ifdef CONFIG_SDL 247 ifdef CONFIG_SDL
248 VL_OBJS+=sdl.o 248 VL_OBJS+=sdl.o
249 -ifdef CONFIG_STATIC  
250 -SDL_LIBS:=$(SDL_STATIC_LIBS)  
251 endif 249 endif
  250 +ifdef CONFIG_SLIRP
  251 +DEFINES+=-I$(SRC_PATH)/slirp
  252 +SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
  253 +slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
  254 +tcp_subr.o tcp_timer.o udp.o bootp.o debug.o
  255 +VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
252 endif 256 endif
253 257
254 VL_LDFLAGS= 258 VL_LDFLAGS=
@@ -321,7 +325,7 @@ endif @@ -321,7 +325,7 @@ endif
321 $(CC) $(DEFINES) -c -o $@ $< 325 $(CC) $(DEFINES) -c -o $@ $<
322 326
323 clean: 327 clean:
324 - rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o 328 + rm -f *.o *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o
325 329
326 install: all 330 install: all
327 ifneq ($(PROGS),) 331 ifneq ($(PROGS),)
configure
@@ -192,6 +192,7 @@ if test -z &quot;$sdl&quot; ; then @@ -192,6 +192,7 @@ if test -z &quot;$sdl&quot; ; then
192 192
193 sdl_config="sdl-config" 193 sdl_config="sdl-config"
194 sdl=no 194 sdl=no
  195 +sdl_static=no
195 196
196 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then 197 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
197 # win32 cross compilation case 198 # win32 cross compilation case
@@ -212,8 +213,24 @@ sdl_too_old=yes @@ -212,8 +213,24 @@ sdl_too_old=yes
212 else 213 else
213 sdl=yes 214 sdl=yes
214 fi 215 fi
  216 +
  217 +# static link with sdl ?
  218 +if test "$sdl" = "yes" ; then
  219 +aa="no"
  220 +`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
  221 +sdl_static_libs=`$sdl_config --static-libs`
  222 +if [ "$aa" = "yes" ] ; then
  223 + sdl_static_libs="$sdl_static_libs `aalib-config --libs`"
  224 +fi
  225 +
  226 +if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
  227 + sdl_static=yes
215 fi 228 fi
216 229
  230 +fi # static link
  231 +
  232 +fi # sdl compile test
  233 +
217 fi # cross compilation 234 fi # cross compilation
218 fi # -z $sdl 235 fi # -z $sdl
219 236
@@ -275,16 +292,20 @@ echo &quot;target list $target_list&quot; @@ -275,16 +292,20 @@ echo &quot;target list $target_list&quot;
275 echo "gprof enabled $gprof" 292 echo "gprof enabled $gprof"
276 echo "static build $static" 293 echo "static build $static"
277 echo "SDL support $sdl" 294 echo "SDL support $sdl"
  295 +echo "SDL static link $sdl_static"
278 echo "mingw32 support $mingw32" 296 echo "mingw32 support $mingw32"
279 297
280 if test $sdl_too_old = "yes"; then 298 if test $sdl_too_old = "yes"; then
281 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support" 299 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
282 fi 300 fi
  301 +if test "$sdl_static" = "no"; then
  302 + echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
  303 +fi
283 304
284 config_mak="config-host.mak" 305 config_mak="config-host.mak"
285 config_h="config-host.h" 306 config_h="config-host.h"
286 307
287 -echo "Creating $config_mak and $config_h" 308 +#echo "Creating $config_mak and $config_h"
288 309
289 echo "# Automatically generated by configure - do not modify" > $config_mak 310 echo "# Automatically generated by configure - do not modify" > $config_mak
290 echo "/* Automatically generated by configure - do not modify */" > $config_h 311 echo "/* Automatically generated by configure - do not modify */" > $config_h
@@ -364,23 +385,6 @@ if test &quot;$static&quot; = &quot;yes&quot; ; then @@ -364,23 +385,6 @@ if test &quot;$static&quot; = &quot;yes&quot; ; then
364 echo "CONFIG_STATIC=yes" >> $config_mak 385 echo "CONFIG_STATIC=yes" >> $config_mak
365 echo "#define CONFIG_STATIC 1" >> $config_h 386 echo "#define CONFIG_STATIC 1" >> $config_h
366 fi 387 fi
367 -if test "$sdl" = "yes" ; then  
368 - echo "CONFIG_SDL=yes" >> $config_mak  
369 - echo "#define CONFIG_SDL 1" >> $config_h  
370 - echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak  
371 - aa="no"  
372 - `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"  
373 - echo -n "SDL_STATIC_LIBS=`$sdl_config --static-libs`" >> $config_mak  
374 - if [ "${aa}" = "yes" ] ; then  
375 - echo -n " `aalib-config --libs`" >> $config_mak ;  
376 - fi  
377 - echo "" >> $config_mak  
378 - echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak  
379 - if [ "${aa}" = "yes" ] ; then  
380 - echo -n " `aalib-config --cflags`" >> $config_mak ;  
381 - fi  
382 - echo "" >> $config_mak  
383 -fi  
384 if test "$slirp" = "yes" ; then 388 if test "$slirp" = "yes" ; then
385 echo "CONFIG_SLIRP=yes" >> $config_mak 389 echo "CONFIG_SLIRP=yes" >> $config_mak
386 echo "#define CONFIG_SLIRP 1" >> $config_h 390 echo "#define CONFIG_SLIRP 1" >> $config_h
@@ -413,7 +417,7 @@ if expr $target : &#39;.*-user&#39; &gt; /dev/null ; then @@ -413,7 +417,7 @@ if expr $target : &#39;.*-user&#39; &gt; /dev/null ; then
413 target_user_only="yes" 417 target_user_only="yes"
414 fi 418 fi
415 419
416 -echo "Creating $config_mak, $config_h and $target_dir/Makefile" 420 +#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
417 421
418 mkdir -p $target_dir 422 mkdir -p $target_dir
419 if test "$target" = "arm-user" ; then 423 if test "$target" = "arm-user" ; then
@@ -465,6 +469,29 @@ if test &quot;$target_user_only&quot; = &quot;yes&quot; ; then @@ -465,6 +469,29 @@ if test &quot;$target_user_only&quot; = &quot;yes&quot; ; then
465 echo "#define CONFIG_USER_ONLY 1" >> $config_h 469 echo "#define CONFIG_USER_ONLY 1" >> $config_h
466 fi 470 fi
467 471
  472 +# sdl defines
  473 +
  474 +if test "$target_user_only" = "no"; then
  475 + if test "$target_softmmu" = "no" -o "$static" = "yes"; then
  476 + if test "$sdl_static" = "yes" ; then
  477 + echo "#define CONFIG_SDL 1" >> $config_h
  478 + echo "CONFIG_SDL=yes" >> $config_mak
  479 + echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
  480 + fi
  481 + else
  482 + if test "$sdl" = "yes" ; then
  483 + echo "#define CONFIG_SDL 1" >> $config_h
  484 + echo "CONFIG_SDL=yes" >> $config_mak
  485 + echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
  486 + fi
  487 + fi
  488 + echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
  489 + if [ "${aa}" = "yes" ] ; then
  490 + echo -n " `aalib-config --cflags`" >> $config_mak ;
  491 + fi
  492 + echo "" >> $config_mak
  493 +fi
  494 +
468 done # for target in $targets 495 done # for target in $targets
469 496
470 # build tree in object directory if source path is different from current one 497 # build tree in object directory if source path is different from current one