diff -Nuar aterm-0.4.2.orig/Makefile.in aterm-0.4.2/Makefile.in
--- aterm-0.4.2.orig/Makefile.in	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/Makefile.in	Tue Sep 11 01:07:33 2001
@@ -72,7 +72,7 @@
 	(cd $(srcdir); $(RMF) *~ config.cache config.h config.log config.status)
 	@for I in $(subdirs); do (cd $$I; $(MAKE) $@ || exit 1); done
 	(cd $(srcdir); $(RMF) Makefile autoconf/Make.common)
-	$(RMF) autoconf/configure
+	$(RMF) autoconf/configure scripts/random_colors
 
 distdirs:
 	mkdir ../$(VERNAME);
diff -Nuar aterm-0.4.2.orig/autoconf/Make.common.in aterm-0.4.2/autoconf/Make.common.in
--- aterm-0.4.2.orig/autoconf/Make.common.in	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/autoconf/Make.common.in	Tue Sep 11 01:07:33 2001
@@ -59,7 +59,7 @@
 XINC = @X_CFLAGS@ @XPM_CFLAGS@
 
 # extra libraries needed by X on some systems, X library location
-XLIB = @AFTERSTEP_LIBS@ @X_LIBS@ @X_PRE_LIBS@ @X_EXTRA_LIBS@ @XPM_LIBS@ -lX11
+XLIB = @AFTERSTEP_LIBS@ @X_LIBS@ @X_PRE_LIBS@ @X_EXTRA_LIBS@ @XPM_LIBS@ @XMU_LIBS@ -lX11
 
 # End of common section of the Makefile
 #-------------------------------------------------------------------------
diff -Nuar aterm-0.4.2.orig/autoconf/acconfig.h aterm-0.4.2/autoconf/acconfig.h
--- aterm-0.4.2.orig/autoconf/acconfig.h	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/autoconf/acconfig.h	Tue Sep 11 01:07:33 2001
@@ -153,3 +153,15 @@
  * Input method should be handles by either xim, xkb, or xmodmap
  */
 #undef THAI
+
+/* what happen? */
+#undef _GNU_SOURCE
+
+/* Define if you use XIM */
+#undef USE_XIM
+
+/* Define if you use XIM */
+#undef USE_XIM_CALLBACK
+
+/* Define if you want to use line space support */
+#undef USE_LINESPACE
diff -Nuar aterm-0.4.2.orig/autoconf/config.h.in aterm-0.4.2/autoconf/config.h.in
--- aterm-0.4.2.orig/autoconf/config.h.in	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/autoconf/config.h.in	Tue Sep 11 01:07:33 2001
@@ -28,9 +28,6 @@
 /* Define if you need to in order for stat and other things to work.  */
 #undef _POSIX_SOURCE
 
-/* Define if you need to in order for some things to work.  */
-#undef _GNU_SOURCE
-
 /* Define as the return type of signal handlers (int or void).  */
 #undef RETSIGTYPE
 
@@ -40,8 +37,6 @@
 /* Define if you can safely include both <sys/time.h> and <time.h>.  */
 #undef TIME_WITH_SYS_TIME
 
-#undef HAVE_GETPT
-
 /* Define to `int' if <sys/types.h> doesn't define.  */
 #undef uid_t
 
@@ -204,6 +199,18 @@
  */
 #undef THAI
 
+/* what happen? */
+#undef _GNU_SOURCE
+
+/* Define if you use XIM */
+#undef USE_XIM
+
+/* Define if you use XIM */
+#undef USE_XIM_CALLBACK
+
+/* Define if you want to use line space support */
+#undef USE_LINESPACE
+
 /* The number of bytes in a char.  */
 #undef SIZEOF_CHAR
 
@@ -221,6 +228,9 @@
 
 /* Define if you have the atexit function.  */
 #undef HAVE_ATEXIT
+
+/* Define if you have the getpt function.  */
+#undef HAVE_GETPT
 
 /* Define if you have the seteuid function.  */
 #undef HAVE_SETEUID
diff -Nuar aterm-0.4.2.orig/autoconf/configure.in aterm-0.4.2/autoconf/configure.in
--- aterm-0.4.2.orig/autoconf/configure.in	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/autoconf/configure.in	Tue Sep 11 01:07:33 2001
@@ -94,12 +94,18 @@
     AC_DEFINE(HALFSHADOW)
   fi])
 
-AC_ARG_ENABLE(kanji,
-  [  --enable-kanji          enable kanji support],
+AC_ARG_ENABLE(linespace,
+  [  --enable-linespace      enable line space support],
   [if test x$enableval = xyes; then
-    AC_DEFINE(KANJI)
+    AC_DEFINE(USE_LINESPACE)
   fi])
 
+AC_ARG_ENABLE(kanji,
+  [  --enable-kanji          enable kanji support])
+
+AC_ARG_ENABLE(xim,
+  [  --enable-xim            enable XIM(X Input Method) support])
+
 AC_ARG_ENABLE(big5,
   [  --enable-big5           enable big5 support],
   [if test x$enableval = xyes; then
@@ -642,6 +648,16 @@
 dnl# this is a really hack test for some basic Xlocale stuff
 SAVETHELIBS=$LIBS
 LIBS="$LIBS $X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11"
+SAVECFLAGS=$CFLAGS
+CFLAGS="$CFLAGS $X_CFLAGS"
+if test x$enable_kanji = xyes -o x$enable_xim = xyes; then
+  AC_CHECK_LIB(Xmu, main,[XMU_LIBS=-lXmu
+    AC_SUBST(XMU_LIBS)
+    AC_DEFINE(KANJI)
+    if test x$enable_kanji != xyes; then
+      AC_MSG_WARN(kanji support automaticary enabled)
+    fi],AC_MSG_WARN(kanji support disabled))
+fi
 AC_CACHE_CHECK(for working Xlocale, rxvt_cv_func_xlocale,
 [AC_TRY_RUN(
 [#define X_LOCALE 1
@@ -654,12 +670,25 @@
 else
 exit (1);}
 ],rxvt_cv_func_xlocale=yes, rxvt_cv_func_xlocale=no,
-AC_MSG_WARN([Define NO_XLOCALE in config.h manually]))])
+AC_MSG_WARN([Define NO_XLOCALE and USE_XIM in config.h manually]))])
 
 if test "${rxvt_cv_func_xlocale}" = no; then
   AC_DEFINE(NO_XLOCALE)
+  if test x$enable_xim = xyes; then
+    AC_MSG_WARN(XIM support disabled)
+  fi
+else
+  if test x$enable_xim = xyes; then
+    AC_DEFINE(USE_XIM)
+    AC_CACHE_CHECK(for working XRegisterIMInstantiateCallback,
+		   rxvt_cv_func_xim_callback,
+      AC_TRY_COMPILE([#include <X11/Xlib.h>], XIDProc IMInstantiateCallback,
+	AC_DEFINE(USE_XIM_CALLBACK)
+	rxvt_cv_func_xim_callback=yes, rxvt_cv_func_xim_callback=no))
+  fi
 fi
 LIBS=$SAVETHELIBS
+CFLAGS=$SAVECFLAGS
 
 AC_CACHE_CHECK(for working setlocale, rxvt_cv_func_xsetlocale,
 [AC_TRY_LINK([#define X_LOCALE 1
diff -Nuar aterm-0.4.2.orig/configure aterm-0.4.2/configure
--- aterm-0.4.2.orig/configure	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/configure	Tue Sep 11 01:07:33 2001
@@ -32,8 +32,12 @@
 ac_help="$ac_help
   --enable-half-shadow    use half width/height shadows on non-Xterm scrollbar"
 ac_help="$ac_help
+  --enable-linespace      enable line space support"
+ac_help="$ac_help
   --enable-kanji          enable kanji support"
 ac_help="$ac_help
+  --enable-xim            enable XIM(X Input Method) support"
+ac_help="$ac_help
   --enable-big5           enable big5 support"
 ac_help="$ac_help
   --enable-greek          enable greek keyboard support"
@@ -763,18 +767,32 @@
 fi
 
 
-# Check whether --enable-kanji or --disable-kanji was given.
-if test "${enable_kanji+set}" = set; then
-  enableval="$enable_kanji"
+# Check whether --enable-linespace or --disable-linespace was given.
+if test "${enable_linespace+set}" = set; then
+  enableval="$enable_linespace"
   if test x$enableval = xyes; then
     cat >> confdefs.h <<\EOF
-#define KANJI 1
+#define USE_LINESPACE 1
 EOF
 
   fi
 fi
 
 
+# Check whether --enable-kanji or --disable-kanji was given.
+if test "${enable_kanji+set}" = set; then
+  enableval="$enable_kanji"
+  :
+fi
+
+
+# Check whether --enable-xim or --disable-xim was given.
+if test "${enable_xim+set}" = set; then
+  enableval="$enable_xim"
+  :
+fi
+
+
 # Check whether --enable-big5 or --disable-big5 was given.
 if test "${enable_big5+set}" = set; then
   enableval="$enable_big5"
@@ -1017,7 +1035,7 @@
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1021: checking for $ac_word" >&5
+echo "configure:1039: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1047,7 +1065,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1051: checking for $ac_word" >&5
+echo "configure:1069: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1098,7 +1116,7 @@
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1102: checking for $ac_word" >&5
+echo "configure:1120: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1130,7 +1148,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1134: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1152: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1141,12 +1159,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 1145 "configure"
+#line 1163 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:1150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1172,12 +1190,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1176: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1194: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1181: checking whether we are using GNU C" >&5
+echo "configure:1199: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1186,7 +1204,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1208: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1205,7 +1223,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1209: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1227: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1237,7 +1255,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1241: checking how to run the C preprocessor" >&5
+echo "configure:1259: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1252,13 +1270,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1256 "configure"
+#line 1274 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1269,13 +1287,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1273 "configure"
+#line 1291 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1286,13 +1304,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1290 "configure"
+#line 1308 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1328,7 +1346,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1332: checking for a BSD compatible install" >&5
+echo "configure:1350: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1384,7 +1402,7 @@
 # Extract the first word of "mv", so it can be a program name with args.
 set dummy mv; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1388: checking for $ac_word" >&5
+echo "configure:1406: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1420,7 +1438,7 @@
 # Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1424: checking for $ac_word" >&5
+echo "configure:1442: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1456,7 +1474,7 @@
 # Extract the first word of "cp", so it can be a program name with args.
 set dummy cp; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1460: checking for $ac_word" >&5
+echo "configure:1478: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1492,7 +1510,7 @@
 # Extract the first word of "sed", so it can be a program name with args.
 set dummy sed; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1496: checking for $ac_word" >&5
+echo "configure:1514: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SED'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1527,9 +1545,9 @@
 
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:1531: checking for AIX" >&5
+echo "configure:1549: checking for AIX" >&5
 cat > conftest.$ac_ext <<EOF
-#line 1533 "configure"
+#line 1551 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -1551,7 +1569,7 @@
 
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1555: checking for POSIXized ISC" >&5
+echo "configure:1573: checking for POSIXized ISC" >&5
 if test -d /etc/conf/kconfig.d &&
   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
 then
@@ -1579,7 +1597,7 @@
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1583: checking for X" >&5
+echo "configure:1601: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -1641,12 +1659,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 1645 "configure"
+#line 1663 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1650: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1668: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1715,14 +1733,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1719 "configure"
+#line 1737 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:1726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -1828,17 +1846,17 @@
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:1832: checking whether -R must be followed by a space" >&5
+echo "configure:1850: checking whether -R must be followed by a space" >&5
       ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 1835 "configure"
+#line 1853 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -1854,14 +1872,14 @@
       else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
 	cat > conftest.$ac_ext <<EOF
-#line 1858 "configure"
+#line 1876 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -1893,7 +1911,7 @@
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:1897: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:1915: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1901,7 +1919,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1905 "configure"
+#line 1923 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1912,7 +1930,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:1916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1934,7 +1952,7 @@
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:1938: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:1956: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1942,7 +1960,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1946 "configure"
+#line 1964 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1953,7 +1971,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:1957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1982,12 +2000,12 @@
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1986: checking for gethostbyname" >&5
+echo "configure:2004: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1991 "configure"
+#line 2009 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2010,7 +2028,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2031,7 +2049,7 @@
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2035: checking for gethostbyname in -lnsl" >&5
+echo "configure:2053: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2039,7 +2057,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2043 "configure"
+#line 2061 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2050,7 +2068,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2080,12 +2098,12 @@
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:2084: checking for connect" >&5
+echo "configure:2102: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2089 "configure"
+#line 2107 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -2108,7 +2126,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -2129,7 +2147,7 @@
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:2133: checking for connect in -lsocket" >&5
+echo "configure:2151: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2137,7 +2155,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2141 "configure"
+#line 2159 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2148,7 +2166,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:2152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2172,12 +2190,12 @@
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:2176: checking for remove" >&5
+echo "configure:2194: checking for remove" >&5
 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2181 "configure"
+#line 2199 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -2200,7 +2218,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -2221,7 +2239,7 @@
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:2225: checking for remove in -lposix" >&5
+echo "configure:2243: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2229,7 +2247,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2233 "configure"
+#line 2251 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2240,7 +2258,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:2244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2264,12 +2282,12 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:2268: checking for shmat" >&5
+echo "configure:2286: checking for shmat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2273 "configure"
+#line 2291 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -2292,7 +2310,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -2313,7 +2331,7 @@
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2317: checking for shmat in -lipc" >&5
+echo "configure:2335: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2321,7 +2339,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2325 "configure"
+#line 2343 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2332,7 +2350,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2365,7 +2383,7 @@
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2369: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2387: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2373,7 +2391,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2377 "configure"
+#line 2395 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2384,7 +2402,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:2388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2426,7 +2444,7 @@
 # paths, otherwise set no_xpm=yes.
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 echo $ac_n "checking for libXpm""... $ac_c" 1>&6
-echo "configure:2430: checking for libXpm" >&5
+echo "configure:2448: checking for libXpm" >&5
 
 # Check whether --with-xpm_includes or --without-xpm_includes was given.
 if test "${with_xpm_includes+set}" = set; then
@@ -2476,12 +2494,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 2480 "configure"
+#line 2498 "configure"
 #include "confdefs.h"
 #include <X11/xpm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2503: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2553,14 +2571,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-lXpm $LIBS -lX11"
 cat > conftest.$ac_ext <<EOF
-#line 2557 "configure"
+#line 2575 "configure"
 #include "confdefs.h"
 char XpmReadFileToPixmap();
 int main() {
 XpmReadFileToPixmap()
 ; return 0; }
 EOF
-if { (eval echo configure:2564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link libXpm with no special library path.
@@ -2611,14 +2629,14 @@
   ac_save_LIBS=$LIBS
   LIBS="-L$ac_dir -lXpm $LIBS -lX11"
   cat > conftest.$ac_ext <<EOF
-#line 2615 "configure"
+#line 2633 "configure"
 #include "confdefs.h"
 char XpmReadFileToPixmap();
 int main() {
 XpmReadFileToPixmap()
 ; return 0; }
 EOF
-if { (eval echo configure:2622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   vt_xpm_libraries=$ac_dir; break;
 else
@@ -2654,12 +2672,12 @@
       vt_xpm_include_X11=no
       if test -z "$xpm_includes"; then
 	cat > conftest.$ac_ext <<EOF
-#line 2658 "configure"
+#line 2676 "configure"
 #include "confdefs.h"
 #include <X11/xpm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2681: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2744,7 +2762,7 @@
 
 
 echo $ac_n "checking for libjpeg""... $ac_c" 1>&6
-echo "configure:2748: checking for libjpeg" >&5
+echo "configure:2766: checking for libjpeg" >&5
 
 # Check whether --with-jpeg_includes or --without-jpeg_includes was given.
 if test "${with_jpeg_includes+set}" = set; then
@@ -2793,12 +2811,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 2797 "configure"
+#line 2815 "configure"
 #include "confdefs.h"
 #include <jpeglib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2870,14 +2888,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-ljpeg $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2874 "configure"
+#line 2892 "configure"
 #include "confdefs.h"
 char jpeg_destroy_compress();
 int main() {
 jpeg_destroy_compress()
 ; return 0; }
 EOF
-if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link libjpeg with no special library path.
@@ -2929,14 +2947,14 @@
   ac_save_LIBS=$LIBS
   LIBS="-L$ac_dir -ljpeg $LIBS"
   cat > conftest.$ac_ext <<EOF
-#line 2933 "configure"
+#line 2951 "configure"
 #include "confdefs.h"
 char jpeg_destroy_compress();
 int main() {
 jpeg_destroy_compress()
 ; return 0; }
 EOF
-if { (eval echo configure:2940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   vt_jpeg_libraries=$ac_dir; break;
 else
@@ -2972,12 +2990,12 @@
       vt_jpeg_include_X11=no
       if test -z "$jpeg_includes"; then
 	cat > conftest.$ac_ext <<EOF
-#line 2976 "configure"
+#line 2994 "configure"
 #include "confdefs.h"
 #include <X11/jpeglib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2981: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3052,7 +3070,7 @@
 
 
 echo $ac_n "checking for libpng""... $ac_c" 1>&6
-echo "configure:3056: checking for libpng" >&5
+echo "configure:3074: checking for libpng" >&5
 
 # Check whether --with-png_includes or --without-png_includes was given.
 if test "${with_png_includes+set}" = set; then
@@ -3101,12 +3119,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 3105 "configure"
+#line 3123 "configure"
 #include "confdefs.h"
 #include <png.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3178,14 +3196,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-lz -lm -lpng $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3182 "configure"
+#line 3200 "configure"
 #include "confdefs.h"
 char png_get_sRGB();
 int main() {
 png_get_sRGB()
 ; return 0; }
 EOF
-if { (eval echo configure:3189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link libpng with no special library path.
@@ -3237,14 +3255,14 @@
   ac_save_LIBS=$LIBS
   LIBS="-L$ac_dir -lz -lm -lpng $LIBS"
   cat > conftest.$ac_ext <<EOF
-#line 3241 "configure"
+#line 3259 "configure"
 #include "confdefs.h"
 char png_get_sRGB();
 int main() {
 png_get_sRGB()
 ; return 0; }
 EOF
-if { (eval echo configure:3248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   vt_png_libraries=$ac_dir; break;
 else
@@ -3280,12 +3298,12 @@
       vt_png_include_X11=no
       if test -z "$png_includes"; then
 	cat > conftest.$ac_ext <<EOF
-#line 3284 "configure"
+#line 3302 "configure"
 #include "confdefs.h"
 #include <png.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3289: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3364,7 +3382,7 @@
 if test x$enable_aftersteplibs = xyes; then
 
 echo $ac_n "checking for AfterStep libraries""... $ac_c" 1>&6
-echo "configure:3368: checking for AfterStep libraries" >&5
+echo "configure:3386: checking for AfterStep libraries" >&5
 
 if eval "test \"`echo '$''{'ac_cv_afterstep_libs_found'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3373,25 +3391,25 @@
     vt_afterstep_is_here=no
     LIBS="-lafterstep $LIBS -lX11"
     cat > conftest.$ac_ext <<EOF
-#line 3377 "configure"
+#line 3395 "configure"
 #include "confdefs.h"
 int *dpy;int screen;char* MyName;int DeadPipe(int nonsens){return 0;}
 int main() {
 safemalloc()
 ; return 0; }
 EOF
-if { (eval echo configure:3384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="-lasimage $LIBS $XPM_LIBS $JPEG_LIBS $PNG_LIBS";
 		 cat > conftest.$ac_ext <<EOF
-#line 3388 "configure"
+#line 3406 "configure"
 #include "confdefs.h"
 int screen;int *dpy;char* MyName;int Scr;int DeadPipe(int nonsens){return 0;}
 int main() {
 LoadImageWithMask()
 ; return 0; }
 EOF
-if { (eval echo configure:3395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   vt_afterstep_is_here=yes
 else
@@ -3444,14 +3462,14 @@
     fi
 	LIBS="$AFTERSTEP_LIBS $LIBS"
     cat > conftest.$ac_ext <<EOF
-#line 3448 "configure"
+#line 3466 "configure"
 #include "confdefs.h"
 int screen;int *dpy;char* MyName;int Scr;int DeadPipe(int nonsens){return 0;}
 int main() {
 CopyXImageLine()
 ; return 0; }
 EOF
-if { (eval echo configure:3455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define LIBAFTERSTEP_HAS_XIMAGE_UTILS 1
@@ -3464,14 +3482,14 @@
 rm -f conftest*
 
     cat > conftest.$ac_ext <<EOF
-#line 3468 "configure"
+#line 3486 "configure"
 #include "confdefs.h"
 int screen;int *dpy;char* MyName;int Scr;int DeadPipe(int nonsens){return 0;}
 int main() {
 ScaleXImage()
 ; return 0; }
 EOF
-if { (eval echo configure:3475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define LIBAFTERSTEP_HAS_SCALEXIMAGE 1
@@ -3484,14 +3502,14 @@
 rm -f conftest*
 
     cat > conftest.$ac_ext <<EOF
-#line 3488 "configure"
+#line 3506 "configure"
 #include "confdefs.h"
 int screen;int *dpy;char* MyName;int Scr;int DeadPipe(int nonsens){return 0;}
 int main() {
 ShadeXImage()
 ; return 0; }
 EOF
-if { (eval echo configure:3495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define LIBAFTERSTEP_HAS_SHADEXIMAGE 1
@@ -3504,17 +3522,17 @@
 rm -f conftest*
     ac_safe=`echo "afterstep/afterstep.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for afterstep/afterstep.h""... $ac_c" 1>&6
-echo "configure:3508: checking for afterstep/afterstep.h" >&5
+echo "configure:3526: checking for afterstep/afterstep.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3513 "configure"
+#line 3531 "configure"
 #include "confdefs.h"
 #include <afterstep/afterstep.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3564,12 +3582,12 @@
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:3568: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:3586: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3573 "configure"
+#line 3591 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -3585,7 +3603,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:3589: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -3626,17 +3644,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3630: checking for $ac_hdr" >&5
+echo "configure:3648: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3635 "configure"
+#line 3653 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3658: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3664,12 +3682,12 @@
 
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3668: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3686: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3673 "configure"
+#line 3691 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3678,7 +3696,7 @@
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3682: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3702,12 +3720,12 @@
 for ac_func in getpt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3706: checking for $ac_func" >&5
+echo "configure:3724: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3711 "configure"
+#line 3729 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3730,7 +3748,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3756,12 +3774,12 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3760: checking for working const" >&5
+echo "configure:3778: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3765 "configure"
+#line 3783 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3810,7 +3828,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3831,21 +3849,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:3835: checking for inline" >&5
+echo "configure:3853: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 3842 "configure"
+#line 3860 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:3849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -3873,12 +3891,12 @@
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3877: checking for ANSI C header files" >&5
+echo "configure:3895: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3882 "configure"
+#line 3900 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3886,7 +3904,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3903,7 +3921,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3907 "configure"
+#line 3925 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3921,7 +3939,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 3925 "configure"
+#line 3943 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3942,7 +3960,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 3946 "configure"
+#line 3964 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3953,7 +3971,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:3957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3977,12 +3995,12 @@
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3981: checking for mode_t" >&5
+echo "configure:3999: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3986 "configure"
+#line 4004 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4010,12 +4028,12 @@
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:4014: checking for pid_t" >&5
+echo "configure:4032: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4019 "configure"
+#line 4037 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -4043,12 +4061,12 @@
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:4047: checking for uid_t in sys/types.h" >&5
+echo "configure:4065: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4052 "configure"
+#line 4070 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -4078,7 +4096,7 @@
 
 
 echo $ac_n "checking size of char""... $ac_c" 1>&6
-echo "configure:4082: checking size of char" >&5
+echo "configure:4100: checking size of char" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4086,7 +4104,7 @@
   ac_cv_sizeof_char=1
 else
   cat > conftest.$ac_ext <<EOF
-#line 4090 "configure"
+#line 4108 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4097,7 +4115,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:4101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_char=`cat conftestval`
 else
@@ -4117,7 +4135,7 @@
 
 
 echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:4121: checking size of short" >&5
+echo "configure:4139: checking size of short" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4125,7 +4143,7 @@
   ac_cv_sizeof_short=2
 else
   cat > conftest.$ac_ext <<EOF
-#line 4129 "configure"
+#line 4147 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4136,7 +4154,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:4140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_short=`cat conftestval`
 else
@@ -4156,7 +4174,7 @@
 
 
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:4160: checking size of int" >&5
+echo "configure:4178: checking size of int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4164,7 +4182,7 @@
   ac_cv_sizeof_int=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 4168 "configure"
+#line 4186 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4175,7 +4193,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:4179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -4195,7 +4213,7 @@
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:4199: checking size of long" >&5
+echo "configure:4217: checking size of long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4203,7 +4221,7 @@
   ac_cv_sizeof_long=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 4207 "configure"
+#line 4225 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4214,7 +4232,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:4218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -4234,7 +4252,7 @@
 
 
 echo $ac_n "checking size of int *""... $ac_c" 1>&6
-echo "configure:4238: checking size of int *" >&5
+echo "configure:4256: checking size of int *" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int_p'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4242,7 +4260,7 @@
   ac_cv_sizeof_int_p=4
 else
   cat > conftest.$ac_ext <<EOF
-#line 4246 "configure"
+#line 4264 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4253,7 +4271,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:4257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int_p=`cat conftestval`
 else
@@ -4409,12 +4427,12 @@
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:4413: checking return type of signal handlers" >&5
+echo "configure:4431: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4418 "configure"
+#line 4436 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -4431,7 +4449,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:4435: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -4457,12 +4475,12 @@
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4461: checking for $ac_func" >&5
+echo "configure:4479: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4466 "configure"
+#line 4484 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4485,7 +4503,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4512,12 +4530,12 @@
 
 
 echo $ac_n "checking for host in utmp struct""... $ac_c" 1>&6
-echo "configure:4516: checking for host in utmp struct" >&5
+echo "configure:4534: checking for host in utmp struct" >&5
 if eval "test \"`echo '$''{'rxvt_cv_struct_utmp_host'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4521 "configure"
+#line 4539 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #ifdef HAVE_UTMPX_H
@@ -4535,7 +4553,7 @@
 ut.ut_host;
 ; return 0; }
 EOF
-if { (eval echo configure:4539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   rxvt_cv_struct_utmp_host=yes
 else
@@ -4557,7 +4575,7 @@
 
 if test "$ac_cv_header_utmpx_h" = yes; then
   echo $ac_n "checking where utmp is located""... $ac_c" 1>&6
-echo "configure:4561: checking where utmp is located" >&5
+echo "configure:4579: checking where utmp is located" >&5
 if eval "test \"`echo '$''{'rxvt_cv_path_utmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4578,7 +4596,7 @@
 
 else
   echo $ac_n "checking where utmp is located""... $ac_c" 1>&6
-echo "configure:4582: checking where utmp is located" >&5
+echo "configure:4600: checking where utmp is located" >&5
 if eval "test \"`echo '$''{'rxvt_cv_path_utmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4602,7 +4620,7 @@
 fi
 
 echo $ac_n "checking where wtmp is located""... $ac_c" 1>&6
-echo "configure:4606: checking where wtmp is located" >&5
+echo "configure:4624: checking where wtmp is located" >&5
 if eval "test \"`echo '$''{'rxvt_cv_path_wtmp'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4625,7 +4643,7 @@
 fi
 
 echo $ac_n "checking where ttys/ttytab is located""... $ac_c" 1>&6
-echo "configure:4629: checking where ttys/ttytab is located" >&5
+echo "configure:4647: checking where ttys/ttytab is located" >&5
 if eval "test \"`echo '$''{'rxvt_cv_path_ttytab'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4649,16 +4667,65 @@
 
 SAVETHELIBS=$LIBS
 LIBS="$LIBS $X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11"
+SAVECFLAGS=$CFLAGS
+CFLAGS="$CFLAGS $X_CFLAGS"
+if test x$enable_kanji = xyes -o x$enable_xim = xyes; then
+  echo $ac_n "checking for main in -lXmu""... $ac_c" 1>&6
+echo "configure:4675: checking for main in -lXmu" >&5
+ac_lib_var=`echo Xmu'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lXmu  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4683 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:4690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  XMU_LIBS=-lXmu
+    
+    cat >> confdefs.h <<\EOF
+#define KANJI 1
+EOF
+
+    if test x$enable_kanji != xyes; then
+      echo "configure: warning: kanji support automaticary enabled" 1>&2
+    fi
+else
+  echo "$ac_t""no" 1>&6
+echo "configure: warning: kanji support disabled" 1>&2
+fi
+
+fi
 echo $ac_n "checking for working Xlocale""... $ac_c" 1>&6
-echo "configure:4654: checking for working Xlocale" >&5
+echo "configure:4721: checking for working Xlocale" >&5
 if eval "test \"`echo '$''{'rxvt_cv_func_xlocale'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
-  echo "configure: warning: Define NO_XLOCALE in config.h manually" 1>&2
+  echo "configure: warning: Define NO_XLOCALE and USE_XIM in config.h manually" 1>&2
 else
   cat > conftest.$ac_ext <<EOF
-#line 4662 "configure"
+#line 4729 "configure"
 #include "confdefs.h"
 #define X_LOCALE 1
 #include <X11/Xlocale.h>
@@ -4671,7 +4738,7 @@
 exit (1);}
 
 EOF
-if { (eval echo configure:4675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   rxvt_cv_func_xlocale=yes
 else
@@ -4692,16 +4759,57 @@
 #define NO_XLOCALE 1
 EOF
 
+  if test x$enable_xim = xyes; then
+    echo "configure: warning: XIM support disabled" 1>&2
+  fi
+else
+  if test x$enable_xim = xyes; then
+    cat >> confdefs.h <<\EOF
+#define USE_XIM 1
+EOF
+
+    echo $ac_n "checking for working XRegisterIMInstantiateCallback""... $ac_c" 1>&6
+echo "configure:4773: checking for working XRegisterIMInstantiateCallback" >&5
+if eval "test \"`echo '$''{'rxvt_cv_func_xim_callback'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 4778 "configure"
+#include "confdefs.h"
+#include <X11/Xlib.h>
+int main() {
+XIDProc IMInstantiateCallback
+; return 0; }
+EOF
+if { (eval echo configure:4785: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cat >> confdefs.h <<\EOF
+#define USE_XIM_CALLBACK 1
+EOF
+
+	rxvt_cv_func_xim_callback=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  rxvt_cv_func_xim_callback=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$rxvt_cv_func_xim_callback" 1>&6
+  fi
 fi
 LIBS=$SAVETHELIBS
+CFLAGS=$SAVECFLAGS
 
 echo $ac_n "checking for working setlocale""... $ac_c" 1>&6
-echo "configure:4700: checking for working setlocale" >&5
+echo "configure:4808: checking for working setlocale" >&5
 if eval "test \"`echo '$''{'rxvt_cv_func_xsetlocale'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4705 "configure"
+#line 4813 "configure"
 #include "confdefs.h"
 #define X_LOCALE 1
 #include <X11/Xlocale.h>
@@ -4709,7 +4817,7 @@
 setlocale(LC_CTYPE, "");
 ; return 0; }
 EOF
-if { (eval echo configure:4713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   rxvt_cv_func_xsetlocale=yes
 else
@@ -4911,6 +5019,7 @@
 s%@PNG_CFLAGS@%$PNG_CFLAGS%g
 s%@PNG_LIBS@%$PNG_LIBS%g
 s%@AFTERSTEP_LIBS@%$AFTERSTEP_LIBS%g
+s%@XMU_LIBS@%$XMU_LIBS%g
 s%@DEBUG@%$DEBUG%g
 s%@DLIB@%$DLIB%g
 s%@DINCLUDE@%$DINCLUDE%g
diff -Nuar aterm-0.4.2.orig/src/command.c aterm-0.4.2/src/command.c
--- aterm-0.4.2.orig/src/command.c	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/src/command.c	Tue Sep 11 01:07:33 2001
@@ -182,7 +182,11 @@
 
 /*{{{ defines: */
 
+#ifdef USE_XIM
+# define KBUFSZ		64	/* size of keyboard mapping buffer */
+#else
 #define KBUFSZ		8	/* size of keyboard mapping buffer */
+#endif
 #define STRING_MAX	512	/* max string size for process_xterm_seq() */
 #define ESC_ARGS	32	/* max # of args for esc sequences */
 
@@ -308,7 +312,9 @@
 static Atom     DndProtocol, DndSelection;
 #endif				/* OFFIX_DND */
 
-#ifndef NO_XLOCALE
+#ifdef USE_XIM
+static XIC      Input_Context;	/* input context */
+#elif !defined(NO_XLOCALE)
 static char    *rs_inputMethod = "";	/* XtNinputMethod */
 static char    *rs_preeditType = NULL;	/* XtNpreeditType */
 static XIC      Input_Context;	/* input context */
@@ -534,7 +540,7 @@
     ttydev = tty_name;
 
 # define PTYCHAR1	"pqrstuvwxyz"
-# define PTYCHAR2	"0123456789abcdef"
+# define PTYCHAR2	"0123456789abcdefghijklmnopqrstuvwxyz"
     for (c1 = PTYCHAR1; *c1; c1++) {
 	ptydev[len - 2] = ttydev[len - 2] = *c1;
 	for (c2 = PTYCHAR2; *c2; c2++) {
@@ -1137,7 +1143,18 @@
     DndSelection = XInternAtom(Xdisplay, "DndSelection", False);
 #endif				/* OFFIX_DND */
 
+#ifndef USE_XIM
     init_xlocale();
+#else
+    /* setlocale(LC_CTYPE, "");			/* moved to main.c:main() */
+    setTermFontSet();
+# ifdef USE_XIM_CALLBACK
+    XRegisterIMInstantiateCallback( Xdisplay, NULL, NULL, NULL,
+				    IMInstantiateCallback, NULL );
+# else
+    IMInstantiateCallback( Xdisplay, NULL, NULL );
+# endif
+#endif
 
 /* get number of available file descriptors */
 #ifdef _POSIX_VERSION
@@ -1194,6 +1211,7 @@
 }
 /*}}} */
 
+#ifndef USE_XIM
 /*{{{ Xlocale */
 /*
  * This is more or less stolen straight from XFree86 xterm.
@@ -1314,6 +1332,7 @@
 #endif				/* NO_XLOCALE */
 }
 /*}}} */
+#endif				/* USE_XIM */
 
 /*{{{ window resizing */
 /*
@@ -1379,7 +1398,15 @@
  	numlock_state = (ev->xkey.state & ModNumLockMask);	/* numlock toggle */
 	PrivMode((!numlock_state), PrivMode_aplKP);
     }
-#ifndef NO_XLOCALE
+#ifdef USE_XIM
+    {
+      Status          status_return;
+      len = Input_Context != NULL
+	? XmbLookupString( Input_Context, &ev->xkey, kbuf, sizeof(kbuf),
+			   &keysym, &status_return )
+	: XLookupString( &ev->xkey, kbuf, sizeof(kbuf), &keysym, &compose );
+    }
+#elif !defined(NO_XLOCALE)
     if (!XFilterEvent(ev, *(&ev->xkey.window))) {
 	if (Input_Context != NULL) {
 	    Status          status_return;
@@ -1977,8 +2004,12 @@
 	    XEvent          ev;
 
 	    refreshed = 0;
+#ifdef USE_XIM
+	    XProcessEvent(Xdisplay);
+#else
 	    XNextEvent(Xdisplay, &ev);
 	    process_x_event(&ev);
+#endif
 
 	/* in case button actions pushed chars to cmdbuf */
 	    if (cmdbuf_ptr < cmdbuf_endp)
@@ -2050,6 +2081,9 @@
 		refreshed = 1;
 		scr_refresh(refresh_type);
 		scrollbar_show(1);
+#ifdef USE_XIM
+		IMSendSpot();
+#endif
 	    }
 	}
     }
@@ -2225,7 +2259,7 @@
 		on_colors_changed(Color_bg);
 	    }
 #endif
-#ifndef NO_XLOCALE
+#if !defined(NO_XLOCALE) || defined(USE_XIM)
 	    if (Input_Context != NULL)
 		XSetICFocus(Input_Context);
 #endif
@@ -2242,7 +2276,7 @@
 		on_colors_changed(Color_bg);
 	    }
 #endif
-#ifndef NO_XLOCALE
+#if !defined(NO_XLOCALE) || defined(USE_XIM)
 	    if (Input_Context != NULL)
 		XUnsetICFocus(Input_Context);
 #endif
@@ -2720,6 +2754,9 @@
 	    scr_refresh(refresh_type);
 	    refresh_count = refresh_limit = 0;
 	    scrollbar_show(1);
+#ifdef USE_XIM
+	    IMSendSpot();
+#endif
 	}
 	break;
     }
@@ -3444,6 +3481,9 @@
 	}
     }
     Gr_do_graphics(cmd, nargs, args, text);
+#ifdef USE_XIM
+    IMSendSpot();
+#endif
 #endif
 }
 /*}}} */
@@ -3612,6 +3652,371 @@
 }
 
 
+#ifdef USE_XIM
+/* PROTO */
+void
+setSize( XRectangle *size )
+{
+  size->x = TermWin_internalBorder;
+  size->y = TermWin_internalBorder;
+  size->width  = Width2Pixel (TermWin.ncol);
+  size->height = Height2Pixel(TermWin.nrow);
+  return;
+}
+
+/* PROTO */
+void
+setColor( unsigned long *fg, unsigned long *bg )
+{
+  *fg = PixColors[Color_fg];
+  *bg = PixColors[Color_bg];
+  return;
+}
+
+/* PROTO */
+void
+IMSendSpot( void )
+{
+  XPoint              spot;
+  XVaNestedList       preedit_attr;
+  XIMStyle            input_style;
+
+  if( Input_Context == NULL ) 
+    return;
+  else {
+    XGetICValues(Input_Context,XNInputStyle,&input_style,NULL);
+    if (!(input_style & XIMPreeditPosition))
+      return;
+  }
+  setPosition( &spot );
+
+  preedit_attr = XVaCreateNestedList( 0, XNSpotLocation, &spot, NULL );
+  XSetICValues( Input_Context, XNPreeditAttributes, preedit_attr, NULL );
+  XFree( preedit_attr );
+  return;
+}
+
+/* PROTO */
+void
+setTermFontSet( void )
+{
+  char *string;
+  long length, i;
+
+  if( TermWin.fontset != NULL ){
+    XFreeFontSet( Xdisplay, TermWin.fontset );
+    TermWin.fontset = NULL;
+  }
+
+  length  = 0;
+  for( i = 0 ; i < NFONTS ; i ++){
+    if( rs_font[ i ] )
+      length += strlen( rs_font[ i ] ) + 1;
+# ifdef MULTICHAR_SET
+    if( rs_mfont[ i ] )
+      length += strlen( rs_mfont[ i ] ) + 1;
+# endif
+  }
+  if( length > 0 && ( string = malloc( length+1 ) ) != NULL ){
+    char **missing_charsetlist, *def_string;
+    int missing_charsetcount;
+
+    string[ 0 ] = '\0';
+    for( i = 0 ; i < NFONTS ; i ++){
+      if( rs_font[ i ] ){
+        strcat( string, rs_font[ i ] );
+        strcat( string, "," );
+      }
+# ifdef MULTICHAR_SET
+      if( rs_mfont[ i ] ){
+        strcat( string, rs_mfont[ i ] );
+        strcat( string, "," );
+      }
+# endif
+    }
+    if( string[length-1] == ',' )
+      string[length-1] = '\0';
+    TermWin.fontset = XCreateFontSet( Xdisplay, string, &missing_charsetlist,
+				      &missing_charsetcount, &def_string );
+    free( string );
+  } else {
+    TermWin.fontset = NULL;
+  }
+  return;
+}
+
+/* PROTO */
+void
+setPreeditArea(XRectangle *preedit_rect, XRectangle *status_rect, XRectangle *needed_rect)
+{
+    preedit_rect->x = needed_rect->width
+		      + (scrollbar_visible() && !(Options & Opt_scrollBar_right)
+			 ? (SB_WIDTH + sb_shadow * 2) : 0);
+    preedit_rect->y = Height2Pixel(TermWin.nrow - 1)
+		      + ((menuBar.state == 1) ? menuBar_TotalHeight() : 0);
+
+    preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width
+			  + (!(Options & Opt_scrollBar_right)
+			     ? (SB_WIDTH + sb_shadow * 2) : 0);
+    preedit_rect->height = Height2Pixel(1);
+  
+    status_rect->x = (scrollbar_visible() && !(Options & Opt_scrollBar_right))
+		     ? (SB_WIDTH + sb_shadow * 2) : 0;
+    status_rect->y = Height2Pixel(TermWin.nrow - 1)
+		     + ((menuBar.state == 1) ? menuBar_TotalHeight() : 0);
+
+    status_rect->width = needed_rect->width ? needed_rect->width
+					    : Width2Pixel(TermWin.ncol + 1);
+    status_rect->height = Height2Pixel(1);
+}
+
+#ifdef USE_XIM_CALLBACK
+void IMDestroyCallback( XIM xim, XPointer client_data, XPointer call_data ){
+  Input_Context = NULL;
+  XRegisterIMInstantiateCallback( Xdisplay, NULL, NULL, NULL,
+				  IMInstantiateCallback, NULL );
+}
+#endif
+
+/* PROTO */
+void
+IMInstantiateCallback(Display *display, XPointer client_data, XPointer call_data)
+{
+    char           *p, *s, buf[64], tmp[1024];
+    char           *end, *next_s;
+    XIM             xim = NULL;
+    XIMStyle        input_style = 0;
+    XIMStyles      *xim_styles = NULL;
+    int             found;
+    XPoint          spot;
+    XRectangle      rect, status_rect, needed_rect;
+    unsigned long   fg, bg;
+    XVaNestedList   preedit_attr = NULL;
+    XVaNestedList   status_attr = NULL;
+#ifdef USE_XIM_CALLBACK
+    XIMCallback     ximcallback;
+    ximcallback.callback = IMDestroyCallback;
+    ximcallback.client_data = NULL;
+#endif
+
+    Input_Context = NULL;
+
+    /* try with XMODIFIERS env. var. */
+    if( (p = XSetLocaleModifiers("")) != NULL && *p )
+      xim = XOpenIM(Xdisplay, NULL, NULL, NULL);
+
+    /* try with xresource */
+    if( xim == NULL && rs_inputMethod && *rs_inputMethod ){
+	STRNCPY(tmp, rs_inputMethod, sizeof(tmp) - 1);
+	for( s = tmp; *s; s = next_s ){
+	  while( isspace( *s ) || *s == ',' )
+	    s++;
+	  if( !*s )
+	    break;
+	  for( end = s; *end && !isspace( *end ) && *end != ','; end++ )
+	    ;
+	  if( *end ){
+	    *end = '\0';
+	    next_s = end + 1;
+	  }else
+	    next_s = end;
+
+	  STRCPY( buf, "@im=" );
+	  strncat( buf, s, sizeof(buf) - 4 - 1 );
+	  if ((p = XSetLocaleModifiers(buf)) != NULL && *p
+	      && (xim = XOpenIM(Xdisplay, NULL, NULL, NULL)) != NULL)
+	    break;
+	}
+    }
+
+    /* try with no modifiers base */
+    if (xim == NULL && (p = XSetLocaleModifiers("@im=none")) != NULL && *p)
+	xim = XOpenIM(Xdisplay, NULL, NULL, NULL);
+
+    if( xim == NULL ){
+      print_error( "can't open any input method" );
+      return;
+    }
+
+    if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL)
+	|| !xim_styles) {
+	print_error("input method doesn't support any style");
+	XCloseIM(xim);
+	return;
+    }
+    STRNCPY(tmp, (rs_preeditType ? rs_preeditType
+				     : "OverTheSpot,OffTheSpot,Root"),
+	    sizeof(tmp) - 1);
+    for( found = 0, s = tmp; *s && !found; s = next_s ){
+      int i;
+
+      while( isspace( *s ) || *s == ',' )
+	s++;
+      if( !*s )
+	break;
+      for( end = s; *end && !isspace( *end ) && *end != ','; end++ )
+	;
+      if( *end ){
+	*end = '\0';
+	next_s = end + 1;
+      }else
+	next_s = end;
+
+      if( !strcmp( s, "OverTheSpot" ) )
+	input_style = XIMPreeditPosition | XIMStatusNothing;
+      else if( !strcmp( s, "OffTheSpot" ) )
+	input_style = XIMPreeditArea | XIMStatusArea;
+      else if( !strcmp( s, "Root" ) )
+	input_style = XIMPreeditNothing | XIMStatusNothing;
+
+      for( i = 0; i < xim_styles->count_styles; i++ )
+	if( input_style == xim_styles->supported_styles[i] ){
+	  found = 1;
+	  break;
+	}
+    }
+    XFree(xim_styles);
+
+    if (found == 0) {
+	print_error("input method doesn't support my preedit type");
+	XCloseIM(xim);
+	return;
+    }
+    if ((input_style != (XIMPreeditNothing | XIMStatusNothing))
+	&& (input_style != (XIMPreeditArea | XIMStatusArea))
+	&& (input_style != (XIMPreeditPosition | XIMStatusNothing))) {
+	print_error("This program does not support the preedit type");
+	XCloseIM(xim);
+	return;
+    }
+#ifdef USE_XIM_CALLBACK
+    XSetIMValues( xim, XNDestroyCallback, &ximcallback, NULL );
+#endif
+
+    if (input_style & XIMPreeditPosition) {
+	setSize(&rect);
+	setPosition(&spot);
+	setColor(&fg, &bg);
+
+	preedit_attr = XVaCreateNestedList(0, XNArea, &rect, 
+					   XNSpotLocation, &spot,
+					   XNForeground, fg,
+					   XNBackground, bg,
+					   XNFontSet, TermWin.fontset,
+					   NULL);
+    } else if (input_style & XIMPreeditArea) {
+	setColor(&fg, &bg);
+
+	/* 
+	 * The necessary width of preedit area is unknown
+	 * until create input context.
+	 */
+	needed_rect.width = 0;
+
+	setPreeditArea(&rect, &status_rect, &needed_rect);
+
+	preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
+					   XNForeground, fg,
+					   XNBackground, bg,
+					   XNFontSet, TermWin.fontset,
+					   NULL);
+	status_attr = XVaCreateNestedList(0, XNArea, &status_rect,
+					  XNForeground, fg,
+					  XNBackground, bg,
+					  XNFontSet, TermWin.fontset,
+					  NULL);
+    }
+    Input_Context = XCreateIC(xim, XNInputStyle, input_style,
+			      XNClientWindow, TermWin.parent,
+			      XNFocusWindow, TermWin.parent,
+#ifdef USE_XIM_CALLBACK
+			      XNDestroyCallback, &ximcallback,
+#endif
+			      (preedit_attr ? XNPreeditAttributes : NULL),
+			      preedit_attr,
+			      (status_attr ? XNStatusAttributes : NULL),
+			      status_attr,
+			      NULL);
+    if( preedit_attr != NULL )
+      XFree( preedit_attr );
+    if( status_attr != NULL )
+      XFree( status_attr );
+    if (Input_Context == NULL) {
+	print_error("Failed to create input context");
+	XCloseIM(xim);
+    }
+    if (input_style & XIMPreeditArea)
+	IMSetStatusPosition();
+}
+
+/* PROTO */
+void
+IMSetStatusPosition(void)
+{
+  XIMStyle input_style;
+  XRectangle rect, status_rect, *needed_rect;
+  XVaNestedList preedit_attr, status_attr;
+
+  if (Input_Context == NULL)
+    return;
+
+  XGetICValues(Input_Context, XNInputStyle, &input_style, NULL);
+
+  if (input_style & XIMPreeditArea) {
+    status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL);
+    XGetICValues(Input_Context, XNStatusAttributes, status_attr, NULL);
+    XFree(status_attr);
 
+    rect.x = needed_rect->width;
+    if (menuBar.state == 1) {
+      rect.y = Height2Pixel(TermWin.nrow - 1) - menuBar_TotalHeight();
+    } else {
+      rect.y = Height2Pixel(TermWin.nrow - 1);
+    }
+    if (Options & Opt_scrollBar_right) {
+      rect.width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width;
+    } else {
+      rect.width = Width2Pixel(TermWin.ncol + 1) + SB_WIDTH + SHADOW * 2 - needed_rect->width;
+    }
+    rect.height = needed_rect->height;
+    preedit_attr = XVaCreateNestedList(0, XNArea, &rect, NULL);
+
+    if (scrollbar_visible()) {
+      if (Options & Opt_scrollBar_right) {
+	status_rect.x = 0;
+      } else {
+	status_rect.x = SB_WIDTH + SHADOW * 2;
+      }
+    } else {
+      status_rect.x = 0;
+    }
+    if (menuBar.state == 1) {
+      status_rect.y = Height2Pixel(TermWin.nrow - 1) + menuBar_TotalHeight();
+    } else {
+      status_rect.y = Height2Pixel(TermWin.nrow - 1);
+    }
+    status_rect.width = needed_rect->width;
+    status_rect.height = needed_rect->height;
+    status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL);
+    XSetICValues(Input_Context,
+		 XNPreeditAttributes, preedit_attr,
+		 XNStatusAttributes, status_attr, NULL);
+    XFree(preedit_attr);
+    XFree(status_attr);
+  }
+}
+
+/* PROTO */
+void
+XProcessEvent( Display *display )
+{
+  XEvent xev;
+  XNextEvent( display, &xev );
+  if( !XFilterEvent( &xev, xev.xany.window ) )
+    process_x_event( &xev );
+  return;
+}
+
+#endif
 /*}}} */
 /*----------------------- end-of-file (C source) -----------------------*/
diff -Nuar aterm-0.4.2.orig/src/feature.h aterm-0.4.2/src/feature.h
--- aterm-0.4.2.orig/src/feature.h	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/src/feature.h	Tue Sep 11 01:07:33 2001
@@ -306,6 +306,11 @@
  */
 #define SAVELINES	64
 
+/*
+ * Default line space
+ */
+#define LINESPACE 0
+
 /* (Hops) Set to choose a number of lines of context between pages 
  *      (rather than a proportion (1/5) of savedlines buffer) 
  *      when paging the savedlines with SHIFT-{Prior,Next} keys.
diff -Nuar aterm-0.4.2.orig/src/main.c aterm-0.4.2/src/main.c
--- aterm-0.4.2.orig/src/main.c	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/src/main.c	Tue Sep 11 01:07:33 2001
@@ -901,6 +901,9 @@
 
 	XResizeWindow(Xdisplay, TermWin.parent, width, height);
 	resize_window1(width, height);
+#ifdef USE_XIM
+	IMSetStatusPosition();
+#endif
 	scr_clear();
     }
 }
@@ -1357,7 +1360,11 @@
 	fw = TermWin.font->min_bounds.width; /* can be error !!!! */
 	if( fw > 1000 ) fw = 0 ;  /* added by suggestion from <suchness>*/
 
+#ifdef USE_LINESPACE
+	fh = TermWin.font->ascent + TermWin.font->descent + TermWin.lineSpace;
+#else
 	fh = TermWin.font->ascent + TermWin.font->descent;
+#endif
 
 	if (TermWin.font->min_bounds.width == TermWin.font->max_bounds.width)
 	    TermWin.fprop = 0;	/* Mono-spaced (fixed width) font */
@@ -1624,6 +1631,9 @@
     rs_geometry = NULL;		/* window geometry */
     rs_minBufferWidth = NULL;
     rs_saveLines = NULL;	/* scrollback buffer [lines] */
+#ifdef USE_LINESPACE
+    rs_lineSpace = NULL;
+#endif
     rs_borderWidth = NULL;
     rs_modifier = NULL;	/* modifier */
 #if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
@@ -1643,6 +1653,10 @@
      rs_shade = NULL;
      rs_tintType = NULL;
 #endif
+#ifdef USE_XIM
+     rs_inputMethod = NULL;
+     rs_preeditType = NULL;
+#endif
 
 
 #ifndef NO_BACKSPACE_KEY
@@ -1750,6 +1764,10 @@
 	TermWin.min_bcol = 1;
     if (!rs_saveLines || (TermWin.saveLines = atoi(rs_saveLines)) < 0)
 	TermWin.saveLines = SAVELINES;
+#ifdef USE_LINESPACE
+    if (!rs_lineSpace || (TermWin.lineSpace = atoi(rs_lineSpace)) < 0)
+	TermWin.lineSpace = LINESPACE;
+#endif
     if (!rs_borderWidth || (TermWin.borderWidth = atoi(rs_borderWidth)) < 0)
         TermWin.borderWidth = BORDERWIDTH;
 
@@ -1797,6 +1815,9 @@
 	    rs_mfont[i] = def_mfontName[i];
 #endif
     }
+#ifdef USE_XIM
+    TermWin.fontset = NULL;
+#endif
 
 #ifdef XTERM_REVERSE_VIDEO
 /* this is how xterm implements reverseVideo */
diff -Nuar aterm-0.4.2.orig/src/rxvt.h aterm-0.4.2/src/rxvt.h
--- aterm-0.4.2.orig/src/rxvt.h	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/src/rxvt.h	Tue Sep 11 01:07:33 2001
@@ -268,6 +268,9 @@
 		    min_bcol,	/* minimum horizontal columns in the buffer */
 		    focus,	/* window has focus                         */
 		    saveLines,	/* number of lines that fit in scrollback   */
+#ifdef USE_LINESPACE
+		    lineSpace,	/* linespace                                */
+#endif
 		    borderWidth,/* number of pixels in window border        */
 		    nscrolled,	/* number of line actually scrolled         */
 		    view_start;	/* scrollback view starts here              */
@@ -280,6 +283,9 @@
 #ifdef MULTICHAR_SET
     XFontStruct    *mfont;	/* Multichar font structure                 */
 #endif
+#ifdef USE_XIM
+    XFontSet fontset;
+#endif
 #if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT) || defined(_MYSTYLE_)
     BackgroundInfo background;
 #endif
@@ -928,6 +934,9 @@
 EXTERN const char      *rs_geometry;	/* window geometry */
 EXTERN const char      *rs_minBufferWidth; /* minimum buffer width - so we can scroll horizontally */
 EXTERN const char      *rs_saveLines;	/* scrollback buffer [lines] */
+#ifdef USE_LINESPACE
+EXTERN const char      *rs_lineSpace;	/* line space [pixels] */
+#endif
 EXTERN const char      *rs_borderWidth; /* border width [pixels] */
 EXTERN const char      *rs_cutchars;	/* chars for selection boundaries */
 #ifdef META8_OPTION
@@ -948,6 +957,10 @@
 #endif
 #ifdef PRINTPIPE
 EXTERN const char      *rs_print_pipe;
+#endif
+#ifdef USE_XIM
+EXTERN const char      *rs_preeditType;
+EXTERN const char      *rs_inputMethod;
 #endif
 #ifndef NO_BRIGHTCOLOR
 EXTERN unsigned int	colorfgbg;
diff -Nuar aterm-0.4.2.orig/src/screen.c aterm-0.4.2/src/screen.c
--- aterm-0.4.2.orig/src/screen.c	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/src/screen.c	Tue Sep 11 01:09:08 2001
@@ -44,6 +44,9 @@
 
 #include <X11/Xatom.h>
 #include <X11/Xmd.h>		/* get the typedef for CARD32 */
+#ifdef KANJI
+#include <X11/Xmu/Atoms.h>
+#endif
 
 
 static screen_t    screen;
@@ -2772,7 +2775,25 @@
 	    XFree(data);
 	    return;
 	}
-	PasteIt(data, nitems);
+#ifdef KANJI
+	if( actual_type == XA_COMPOUND_TEXT(Xdisplay) ){
+	  XTextProperty   xtextp;
+	  int             size, i;
+	  char          **cl;
+
+	  xtextp.value    = data;
+	  xtextp.encoding = actual_type;
+	  xtextp.format   = actual_fmt;
+	  xtextp.nitems   = nitems;
+	  XmbTextPropertyToTextList(Xdisplay, &xtextp, &cl, &size);
+
+	  for (i = 0 ; i < size ; i ++) {
+	    PasteIt(cl[i], strlen(cl[i]));
+	  }
+	  XFreeStringList(cl);
+	}else
+#endif
+	  PasteIt( data, nitems );
 	XFree(data);
     }
 }
@@ -2797,8 +2818,13 @@
 	selection_paste(Xroot, XA_CUT_BUFFER0, False);
     } else {
 	prop = XInternAtom(Xdisplay, "VT_SELECTION", False);
+#ifdef KANJI
+	XConvertSelection( Xdisplay, XA_PRIMARY, XA_COMPOUND_TEXT(Xdisplay),
+			   prop, TermWin.vt, tm );
+#else
 	XConvertSelection(Xdisplay, XA_PRIMARY, XA_STRING, prop, TermWin.vt,
 			  tm);
+#endif
     }
 }
 
@@ -3355,6 +3381,23 @@
 	XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
 			8, PropModeReplace, selection.text, selection.len);
 	ev.xselection.property = rq->property;
+#ifdef KANJI
+    }else if( rq->target == XA_TEXT(Xdisplay) ||
+	      rq->target == XA_COMPOUND_TEXT(Xdisplay) ){
+      XTextProperty xtextp;
+      xtextp.value  = NULL;
+      xtextp.nitems = 0;
+      if( XmbTextListToTextProperty( Xdisplay, (char**)&selection.text,
+				     1, XCompoundTextStyle, &xtextp )
+	  == Success ){
+	if( xtextp.nitems > 0 && xtextp.value != NULL ){
+	  XChangeProperty( Xdisplay, rq->requestor, rq->property,
+			   XA_COMPOUND_TEXT(Xdisplay), 8, PropModeReplace,
+			   xtextp.value, xtextp.nitems );
+	  ev.xselection.property = rq->property;
+	}
+      }
+#endif
     }
     XSendEvent(Xdisplay, rq->requestor, False, 0, &ev);
 }
@@ -3439,3 +3482,13 @@
 #endif
     fprintf(stderr, "%s\n", name[color]);
 }
+
+#ifdef USE_XIM
+void setPosition( XPoint *pos ){
+  XWindowAttributes xwa;
+
+  XGetWindowAttributes( Xdisplay, TermWin.vt, &xwa );
+  pos->x = Col2Pixel   ( screen.cur.col     ) + xwa.x;
+  pos->y = Height2Pixel( screen.cur.row + 1 ) + xwa.y;
+}
+#endif
diff -Nuar aterm-0.4.2.orig/src/xdefaults.c aterm-0.4.2/src/xdefaults.c
--- aterm-0.4.2.orig/src/xdefaults.c	Fri Sep  7 01:38:07 2001
+++ aterm-0.4.2/src/xdefaults.c	Tue Sep 11 01:07:33 2001
@@ -276,6 +276,11 @@
     STRG(rs_multichar_encoding, "multichar_encoding", "km", "mode",
          "multiple-character font encoding; mode = eucj | sjis | big5"),
 #endif				/* MULTICHAR_SET */
+#ifdef USE_XIM
+    STRG(rs_inputMethod, "inputMethod", "im", "name", "name of input method"),
+    STRG(rs_preeditType, "preeditType", "pt", "style",
+	 "input style of input method; style = OverTheSpot | OffTheSpot | Root"),
+#endif                         /* USE_XIM */
 #ifdef GREEK_SUPPORT
     STRG(rs_greek_keyboard, "greek_keyboard", "grk", "mode",
          "greek keyboard mapping; mode = iso | ibm"),
@@ -313,6 +318,10 @@
          "minimum number of columns stored in buffer"),
     STRG(rs_saveLines, "saveLines", "sl", "number",
          "number of scrolled lines to save"),
+#ifdef USE_LINESPACE
+    STRG(rs_lineSpace, "lineSpace", "lsp", "number",
+         "line space"),
+#endif
     BOOL(rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit,
          "utmp inhibit"),
     BOOL(rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"),
@@ -387,8 +396,15 @@
 #ifdef MENUBAR
     fprintf(stderr, "menubar,");
 #endif
+#ifdef USE_LINESPACE
+    fprintf(stderr, "line space,");
+#endif
 #ifdef KANJI
-    fprintf(stderr, "Kanji,");
+    fprintf(stderr, "Kanji");
+#ifdef USE_XIM
+    fprintf(stderr, "+XIM");
+#endif
+    fprintf(stderr, ",");
 #endif
 #ifdef ZH
     fprintf(stderr, "Chinese,");
