probe static SDL link
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 22 Apr 2004 00:02:08 +0000 (00:02 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 22 Apr 2004 00:02:08 +0000 (00:02 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@732 c046a42c-6fe2-441c-8c8c-71466251a162

Makefile.target
configure

index e9c0304..b68183b 100644 (file)
@@ -246,9 +246,13 @@ VL_OBJS+=gdbstub.o
 endif
 ifdef CONFIG_SDL
 VL_OBJS+=sdl.o
-ifdef CONFIG_STATIC
-SDL_LIBS:=$(SDL_STATIC_LIBS)
 endif
+ifdef CONFIG_SLIRP
+DEFINES+=-I$(SRC_PATH)/slirp
+SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
+slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \
+tcp_subr.o tcp_timer.o udp.o bootp.o debug.o
+VL_OBJS+=$(addprefix slirp/, $(SLIRP_OBJS))
 endif
 
 VL_LDFLAGS=
@@ -321,7 +325,7 @@ endif
        $(CC) $(DEFINES) -c -o $@ $<
 
 clean:
-       rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o
+       rm -f *.o  *.a *~ $(PROGS) gen-op.h opc.h op.h nwfpe/*.o slirp/*.o
 
 install: all 
 ifneq ($(PROGS),)
index b5f3e7a..ef519c8 100755 (executable)
--- a/configure
+++ b/configure
@@ -192,6 +192,7 @@ if test -z "$sdl" ; then
 
 sdl_config="sdl-config"
 sdl=no
+sdl_static=no
 
 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
 # win32 cross compilation case
@@ -212,8 +213,24 @@ sdl_too_old=yes
 else
 sdl=yes
 fi
+
+# static link with sdl ?
+if test "$sdl" = "yes" ; then
+aa="no"
+`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
+sdl_static_libs=`$sdl_config --static-libs`
+if [ "$aa" = "yes" ] ; then
+  sdl_static_libs="$sdl_static_libs `aalib-config --libs`"
+fi
+
+if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
+  sdl_static=yes
 fi
 
+fi # static link
+
+fi # sdl compile test
+
 fi # cross compilation
 fi # -z $sdl
 
@@ -275,16 +292,20 @@ echo "target list       $target_list"
 echo "gprof enabled     $gprof"
 echo "static build      $static"
 echo "SDL support       $sdl"
+echo "SDL static link   $sdl_static"
 echo "mingw32 support   $mingw32"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
 fi
+if test "$sdl_static" = "no"; then
+  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
+fi
 
 config_mak="config-host.mak"
 config_h="config-host.h"
 
-echo "Creating $config_mak and $config_h"
+#echo "Creating $config_mak and $config_h"
 
 echo "# Automatically generated by configure - do not modify" > $config_mak
 echo "/* Automatically generated by configure - do not modify */" > $config_h
@@ -364,23 +385,6 @@ if test "$static" = "yes" ; then
   echo "CONFIG_STATIC=yes" >> $config_mak
   echo "#define CONFIG_STATIC 1" >> $config_h
 fi
-if test "$sdl" = "yes" ; then
-  echo "CONFIG_SDL=yes" >> $config_mak
-  echo "#define CONFIG_SDL 1" >> $config_h
-  echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
-  aa="no"
-  `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
-  echo -n "SDL_STATIC_LIBS=`$sdl_config --static-libs`" >> $config_mak
-  if [ "${aa}" = "yes" ] ; then
-      echo -n " `aalib-config --libs`" >> $config_mak ;
-  fi
-  echo "" >> $config_mak
-  echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
-  if [ "${aa}" = "yes" ] ; then
-      echo -n " `aalib-config --cflags`" >> $config_mak ;
-  fi
-  echo "" >> $config_mak
-fi
 if test "$slirp" = "yes" ; then
   echo "CONFIG_SLIRP=yes" >> $config_mak
   echo "#define CONFIG_SLIRP 1" >> $config_h
@@ -413,7 +417,7 @@ if expr $target : '.*-user' > /dev/null ; then
   target_user_only="yes"
 fi
 
-echo "Creating $config_mak, $config_h and $target_dir/Makefile"
+#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
 
 mkdir -p $target_dir
 if test "$target" = "arm-user" ; then
@@ -465,6 +469,29 @@ if test "$target_user_only" = "yes" ; then
   echo "#define CONFIG_USER_ONLY 1" >> $config_h
 fi
 
+# sdl defines
+
+if test "$target_user_only" = "no"; then
+    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
+        if test "$sdl_static" = "yes" ; then
+            echo "#define CONFIG_SDL 1" >> $config_h
+            echo "CONFIG_SDL=yes" >> $config_mak
+            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
+        fi
+    else
+        if test "$sdl" = "yes" ; then
+            echo "#define CONFIG_SDL 1" >> $config_h
+            echo "CONFIG_SDL=yes" >> $config_mak
+            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
+        fi
+    fi
+    echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
+    if [ "${aa}" = "yes" ] ; then
+        echo -n " `aalib-config --cflags`" >> $config_mak ;
+    fi
+    echo "" >> $config_mak
+fi
+
 done # for target in $targets
 
 # build tree in object directory if source path is different from current one