[Qemu-devel] [PATCH 1/2] iconv: detect and make curses depend on it

2019-03-03 Thread Samuel Thibault
curses will use it for proper wide output support.

Signed-off-by: Samuel Thibault 
---
 configure | 40 
 vl.c  |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 540bee19ba..9979ca708d 100755
--- a/configure
+++ b/configure
@@ -1217,6 +1217,10 @@ for opt do
   ;;
   --enable-curses) curses="yes"
   ;;
+  --disable-iconv) iconv="no"
+  ;;
+  --enable-iconv) iconv="yes"
+  ;;
   --disable-curl) curl="no"
   ;;
   --enable-curl) curl="yes"
@@ -1718,6 +1722,7 @@ disabled with --disable-FEATURE, default is enabled if 
available:
   gtk gtk UI
   vte vte support for the gtk UI
   curses  curses UI
+  iconv   font glyph conversion support
   vnc VNC UI support
   vnc-saslSASL encryption for VNC server
   vnc-jpegJPEG lossy compression for VNC server
@@ -3398,8 +3403,39 @@ EOF
   fi
 fi
 
+##
+# iconv probe
+if test "$iconv" != "no" ; then
+  cat > $TMPC << EOF
+#include 
+int main(void) {
+  iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
+  return conv != (iconv_t) -1;
+}
+EOF
+  for iconv_lib in '' -liconv; do
+if compile_prog "" "$iconv_lib" ; then
+  iconv_found=yes
+  libs_softmmu="$iconv_lib $libs_softmmu"
+  break
+fi
+  done
+  if test "$iconv_found" = "yes" ; then
+iconv=yes
+  else
+if test "$iconv" = "yes" ; then
+  feature_not_found "iconv" "Install iconv devel"
+fi
+iconv=no
+  fi
+fi
+
 ##
 # curses probe
+if test "$iconv" = "no" ; then
+  # curses will need iconv
+  curses=no
+fi
 if test "$curses" != "no" ; then
   if test "$mingw32" = "yes" ; then
 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
@@ -6111,6 +6147,7 @@ echo "libgcrypt $gcrypt"
 echo "nettle$nettle $(echo_version $nettle $nettle_version)"
 echo "libtasn1  $tasn1"
 echo "PAM   $auth_pam"
+echo "iconv support $iconv"
 echo "curses support$curses"
 echo "virgl support $virglrenderer $(echo_version $virglrenderer 
$virgl_version)"
 echo "curl support  $curl"
@@ -6435,6 +6472,9 @@ fi
 if test "$cocoa" = "yes" ; then
   echo "CONFIG_COCOA=y" >> $config_host_mak
 fi
+if test "$iconv" = "yes" ; then
+  echo "CONFIG_ICONV=y" >> $config_host_mak
+fi
 if test "$curses" = "yes" ; then
   echo "CONFIG_CURSES=m" >> $config_host_mak
   echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak
diff --git a/vl.c b/vl.c
index 502857a176..c8594fc6d5 100644
--- a/vl.c
+++ b/vl.c
@@ -3171,7 +3171,7 @@ int main(int argc, char **argv, char **envp)
 #ifdef CONFIG_CURSES
 dpy.type = DISPLAY_TYPE_CURSES;
 #else
-error_report("curses support is disabled");
+error_report("curses or iconv support is disabled");
 exit(1);
 #endif
 break;
-- 
2.20.1




[Qemu-devel] [PATCH 1/2] iconv: detect and make curses depend on it

2016-10-30 Thread Samuel Thibault
curses will use it for proper wide output support.

Signed-off-by: Samuel Thibault 
---
 configure | 40 
 vl.c  |  2 +-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index f83cdf8..42af965 100755
--- a/configure
+++ b/configure
@@ -979,6 +979,10 @@ for opt do
   ;;
   --enable-curses) curses="yes"
   ;;
+  --disable-iconv) iconv="no"
+  ;;
+  --enable-iconv) iconv="yes"
+  ;;
   --disable-curl) curl="no"
   ;;
   --enable-curl) curl="yes"
@@ -1353,6 +1357,7 @@ disabled with --disable-FEATURE, default is enabled if 
available:
   --with-gtkabi select preferred GTK ABI 2.0 or 3.0
   vte vte support for the gtk UI
   curses  curses UI
+  iconv   font glyph conversion support
   vnc VNC UI support
   vnc-saslSASL encryption for VNC server
   vnc-jpegJPEG lossy compression for VNC server
@@ -2914,7 +2919,38 @@ EOF
 fi
 
 ##
+# iconv probe
+if test "$iconv" != "no" ; then
+  cat > $TMPC << EOF
+#include 
+int main(void) {
+  iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
+  return conv != (iconv_t) -1;
+}
+EOF
+  for iconv_lib in '' -liconv; do
+if compile_prog "" "$iconv_lib" ; then
+  iconv_found=yes
+  libs_softmmu="$iconv_lib $libs_softmmu"
+  break
+fi
+  done
+  if test "$iconv_found" = "yes" ; then
+iconv=yes
+  else
+if test "$iconv" = "yes" ; then
+  feature_not_found "iconv" "Install iconv devel"
+fi
+iconv=no
+  fi
+fi
+
+##
 # curses probe
+if test "$iconv" = "no" ; then
+  # curses will need iconv
+  curses=no
+fi
 if test "$curses" != "no" ; then
   if test "$mingw32" = "yes" ; then
 curses_inc_list="$($pkg_config --cflags ncurses 2>/dev/null):"
@@ -4972,6 +5008,7 @@ echo "libgcrypt kdf $gcrypt_kdf"
 echo "nettle$nettle $(echo_version $nettle $nettle_version)"
 echo "nettle kdf$nettle_kdf"
 echo "libtasn1  $tasn1"
+echo "iconv support $iconv"
 echo "curses support$curses"
 echo "virgl support $virglrenderer"
 echo "curl support  $curl"
@@ -5226,6 +5263,9 @@ fi
 if test "$cocoa" = "yes" ; then
   echo "CONFIG_COCOA=y" >> $config_host_mak
 fi
+if test "$iconv" = "yes" ; then
+  echo "CONFIG_ICONV=y" >> $config_host_mak
+fi
 if test "$curses" = "yes" ; then
   echo "CONFIG_CURSES=y" >> $config_host_mak
 fi
diff --git a/vl.c b/vl.c
index 74dfe4e..136f6f4 100644
--- a/vl.c
+++ b/vl.c
@@ -2185,7 +2185,7 @@ static DisplayType select_display(const char *p)
 #ifdef CONFIG_CURSES
 display = DT_CURSES;
 #else
-error_report("curses support is disabled");
+error_report("curses or iconv support is disabled");
 exit(1);
 #endif
 } else if (strstart(p, "gtk", &opts)) {
-- 
2.10.1