iconv: detect and make curses depend on it

curses will use it for proper wide output support.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Message-Id: <20190311135127.2229-2-samuel.thibault@ens-lyon.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Samuel Thibault 2019-03-11 14:51:26 +01:00 committed by Gerd Hoffmann
parent 377b155bde
commit e08bb3010c
3 changed files with 58 additions and 3 deletions

55
configure vendored
View File

@ -1222,6 +1222,10 @@ for opt do
;;
--enable-curses) curses="yes"
;;
--disable-iconv) iconv="no"
;;
--enable-iconv) iconv="yes"
;;
--disable-curl) curl="no"
;;
--enable-curl) curl="yes"
@ -1711,6 +1715,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-sasl SASL encryption for VNC server
vnc-jpeg JPEG lossy compression for VNC server
@ -3432,8 +3437,52 @@ EOF
fi
fi
##########################################
# iconv probe
if test "$iconv" != "no" ; then
cat > $TMPC << EOF
#include <iconv.h>
int main(void) {
iconv_t conv = iconv_open("WCHAR_T", "UCS-2");
return conv != (iconv_t) -1;
}
EOF
iconv_prefix_list="/usr/local:/usr"
iconv_lib_list=":-liconv"
IFS=:
for iconv_prefix in $iconv_prefix_list; do
IFS=:
iconv_cflags="-I$iconv_prefix/include"
iconv_ldflags="-L$iconv_prefix/lib"
for iconv_link in $iconv_lib_list; do
unset IFS
iconv_lib="$iconv_ldflags $iconv_link"
echo "looking at iconv in '$iconv_cflags' '$iconv_lib'" >> config.log
if compile_prog "$iconv_cflags" "$iconv_lib" ; then
iconv_found=yes
break
fi
done
if test "$iconv_found" = yes ; then
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):"
@ -6217,6 +6266,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"
@ -6552,6 +6602,11 @@ 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
echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak
echo "ICONV_LIBS=$iconv_lib" >> $config_host_mak
fi
if test "$curses" = "yes" ; then
echo "CONFIG_CURSES=m" >> $config_host_mak
echo "CURSES_CFLAGS=$curses_inc" >> $config_host_mak

View File

@ -46,8 +46,8 @@ endif
common-obj-$(CONFIG_CURSES) += curses.mo
curses.mo-objs := curses.o
curses.mo-cflags := $(CURSES_CFLAGS)
curses.mo-libs := $(CURSES_LIBS)
curses.mo-cflags := $(CURSES_CFLAGS) $(ICONV_CFLAGS)
curses.mo-libs := $(CURSES_LIBS) $(ICONV_LIBS)
common-obj-$(call land,$(CONFIG_SPICE),$(CONFIG_GIO)) += spice-app.mo
spice-app.mo-objs := spice-app.o

2
vl.c
View File

@ -3170,7 +3170,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;