diff mbox

[PATCH/RFC,5/7] configure: split PNG support from vnc_png feature

Message ID 1331557893-30806-6-git-send-email-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau March 12, 2012, 1:11 p.m. UTC
---
 Makefile.target |    2 +-
 configure       |   42 ++++++++++++++++++++++++++++++++----------
 2 files changed, 33 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index 1bd25a8..e5273f2 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -215,7 +215,7 @@  obj-i386-$(CONFIG_KVM) += hyperv.o
 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
 QEMU_CFLAGS += $(VNC_JPEG_CFLAGS)
-QEMU_CFLAGS += $(VNC_PNG_CFLAGS)
+QEMU_CFLAGS += $(PNG_CFLAGS)
 
 # xen support
 obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o
diff --git a/configure b/configure
index 39d2b54..3abdf3f 100755
--- a/configure
+++ b/configure
@@ -123,6 +123,7 @@  curses=""
 docs=""
 fdt=""
 nptl=""
+png=""
 sdl=""
 virtfs=""
 vnc="yes"
@@ -602,6 +603,10 @@  for opt do
     # configure to be used by RPM and similar macros that set
     # lots of directory switches by default.
   ;;
+  --disable-png) png="no"
+  ;;
+  --enable-png) png="yes"
+  ;;
   --disable-sdl) sdl="no"
   ;;
   --enable-sdl) sdl="yes"
@@ -1043,6 +1048,8 @@  echo "  --disable-vnc-png        disable PNG compression for VNC server (default
 echo "  --enable-vnc-png         enable PNG compression for VNC server"
 echo "  --disable-vnc-thread     disable threaded VNC server"
 echo "  --enable-vnc-thread      enable threaded VNC server"
+echo "  --disable-png            disable PNG compression (default)"
+echo "  --enable-png             enable PNG compression"
 echo "  --disable-curses         disable curses output"
 echo "  --enable-curses          enable curses output"
 echo "  --disable-curl           disable curl connectivity"
@@ -1648,8 +1655,8 @@  EOF
 fi
 
 ##########################################
-# VNC PNG detection
-if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
+# PNG detection
+if test "$png" != "no"; then
 cat > $TMPC <<EOF
 //#include <stdio.h>
 #include <png.h>
@@ -1661,16 +1668,27 @@  int main(void) {
 }
 EOF
   if $pkg_config libpng --modversion >/dev/null 2>&1; then
-    vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
-    vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
+    png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
+    png_libs=`$pkg_config libpng --libs 2> /dev/null`
+  else
+    png_cflags=""
+    png_libs="-lpng"
+  fi
+  if compile_prog "$png_cflags" "$png_libs" ; then
+    png=yes
+    libs_softmmu="$png_libs $libs_softmmu"
+    QEMU_CFLAGS="$QEMU_CFLAGS $png_cflags"
   else
-    vnc_png_cflags=""
-    vnc_png_libs="-lpng"
+    if test "$png" = "yes" ; then
+      feature_not_found "png"
+    fi
+    png=no
   fi
-  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
+fi
+
+if test "$vnc" = "yes" -a "$vnc_png" != "no"; then
+  if test "$png" = "yes" ; then
     vnc_png=yes
-    libs_softmmu="$vnc_png_libs $libs_softmmu"
-    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
   else
     if test "$vnc_png" = "yes" ; then
       feature_not_found "vnc-png"
@@ -2879,6 +2897,7 @@  if test "$darwin" = "yes" ; then
     echo "Cocoa support     $cocoa"
 fi
 echo "SDL support       $sdl"
+echo "PNG support       $png"
 echo "curses support    $curses"
 echo "curl support      $curl"
 echo "mingw32 support   $mingw32"
@@ -3067,7 +3086,10 @@  if test "$vnc_jpeg" = "yes" ; then
 fi
 if test "$vnc_png" = "yes" ; then
   echo "CONFIG_VNC_PNG=y" >> $config_host_mak
-  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
+fi
+if test "$png" = "yes" ; then
+  echo "PNG_CFLAGS=$png_cflags" >> $config_host_mak
+  echo "CONFIG_PNG=y" >> $config_host_mak
 fi
 if test "$vnc_thread" = "yes" ; then
   echo "CONFIG_VNC_THREAD=y" >> $config_host_mak