Index: kit/configure
diff -u kit/configure:1.48 kit/configure:1.49
--- kit/configure:1.48	Thu Dec 17 13:58:28 1998
+++ kit/configure	Mon Dec 21 14:22:29 1998
@@ -1,8 +1,8 @@
-#!/bin/sh
+#! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.1 
-# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+# Generated automatically using autoconf version 2.12 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
@@ -45,9 +45,24 @@
 verbose=
 x_includes=NONE
 x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
 
 # Initialize some other variables.
 subdirs=
+MFLAGS= MAKEFLAGS=
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
 
 ac_prev=
 for ac_option
@@ -69,9 +84,14 @@
 
   case "$ac_option" in
 
-  -build | --build | --buil | --bui | --bu | --b)
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
     ac_prev=build ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
     build="$ac_optarg" ;;
 
   -cache-file | --cache-file | --cache-fil | --cache-fi \
@@ -81,6 +101,12 @@
   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
     cache_file="$ac_optarg" ;;
 
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
   -disable-* | --disable-*)
     ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
     # Reject names that are not valid shell variable names.
@@ -131,12 +157,29 @@
 Directory and file names:
   --prefix=PREFIX         install architecture-independent files in PREFIX
                           [$ac_default_prefix]
-  --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                           [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
   --srcdir=DIR            find the sources in DIR [configure dir or ..]
   --program-prefix=PREFIX prepend PREFIX to installed program names
   --program-suffix=SUFFIX append SUFFIX to installed program names
-  --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
 Host type:
   --build=BUILD           configure for building on BUILD [BUILD=HOST]
   --host=HOST             configure for HOST [guessed]
@@ -148,8 +191,10 @@
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --x-includes=DIR        X include files are in DIR
   --x-libraries=DIR       X library files are in DIR
---enable and --with options recognized:$ac_help
 EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
     exit 0 ;;
 
   -host | --host | --hos | --ho)
@@ -157,6 +202,44 @@
   -host=* | --host=* | --hos=* | --ho=*)
     host="$ac_optarg" ;;
 
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
   -nfp | --nfp | --nf)
     # Obsolete; use --without-fp.
     with_fp=no ;;
@@ -169,6 +252,15 @@
   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
     no_recursion=yes ;;
 
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
     ac_prev=prefix ;;
   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
@@ -209,6 +301,23 @@
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
   -site | --site | --sit)
     ac_prev=site ;;
   -site=* | --site=* | --sit=*)
@@ -219,6 +328,13 @@
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
     srcdir="$ac_optarg" ;;
 
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
   -target | --target | --targe | --targ | --tar | --ta | --t)
     ac_prev=target ;;
   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
@@ -228,7 +344,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.1"
+    echo "configure generated by autoconf version 2.12"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -274,7 +390,7 @@
   -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
     ;;
 
-  *) 
+  *)
     if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
       echo "configure: warning: $ac_option: invalid host type" 1>&2
     fi
@@ -291,19 +407,20 @@
   { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
 fi
 
-trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
 
 # File descriptor usage:
-# 0 unused; standard input
+# 0 standard input
 # 1 file creation
 # 2 errors and warnings
-# 3 unused; some systems may open it to /dev/tty
-# 4 checking for... messages and results
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
 # 5 compiler messages saved in config.log
 if test "$silent" = yes; then
-  exec 4>/dev/null
+  exec 6>/dev/null
 else
-  exec 4>&1
+  exec 6>&1
 fi
 exec 5>./config.log
 
@@ -329,11 +446,14 @@
 done
 
 # NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
 if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
 rm -rf conftest* confdefs.h
@@ -393,8 +513,9 @@
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} $CFLAGS $CPPFLAGS conftest.$ac_ext -c 1>&5 2>&5'
-ac_link='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext -o conftest $LIBS 1>&5 2>&5'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
 
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
@@ -410,10 +531,11 @@
 
 
 
-echo $ac_n "checking whether ${MAKE-make} sets \$MAKE""... $ac_c" 1>&4
-set dummy ${MAKE-make}; ac_make=$2
-if eval "test \"`echo '${'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:536: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftestmake <<\EOF
 all:
@@ -429,10 +551,10 @@
 rm -f conftestmake
 fi
 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$ac_t""yes" 1>&4
+  echo "$ac_t""yes" 1>&6
   SET_MAKE=
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
@@ -440,9 +562,10 @@
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_prog_AWK'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:567: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$AWK"; then
   ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -460,9 +583,9 @@
 fi
 AWK="$ac_cv_prog_AWK"
 if test -n "$AWK"; then
-  echo "$ac_t""$AWK" 1>&4
+  echo "$ac_t""$AWK" 1>&6
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 
 test -n "$AWK" && break
@@ -472,9 +595,10 @@
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_prog_YACC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:600: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$YACC"; then
   ac_cv_prog_YACC="$YACC" # Let the user override the test.
@@ -492,9 +616,9 @@
 fi
 YACC="$ac_cv_prog_YACC"
 if test -n "$YACC"; then
-  echo "$ac_t""$YACC" 1>&4
+  echo "$ac_t""$YACC" 1>&6
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 
 test -n "$YACC" && break
@@ -503,9 +627,10 @@
 
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_prog_LEX'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:632: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$LEX"; then
   ac_cv_prog_LEX="$LEX" # Let the user override the test.
@@ -524,9 +649,9 @@
 fi
 LEX="$ac_cv_prog_LEX"
 if test -n "$LEX"; then
-  echo "$ac_t""$LEX" 1>&4
+  echo "$ac_t""$LEX" 1>&6
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 
 if test -z "$LEXLIB"
@@ -535,37 +660,44 @@
   flex*) ac_lib=fl ;;
   *) ac_lib=l ;;
   esac
-  echo $ac_n "checking for -l$ac_lib""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_lib_$ac_lib'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+  echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
+echo "configure:665: checking for yywrap in -l$ac_lib" >&5
+ac_lib_var=`echo $ac_lib'_'yywrap | 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="$LIBS -l$ac_lib "
+LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 546 "configure"
+#line 673 "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
+    builtin and then its argument prototype would still apply.  */
+char yywrap();
 
-int main() { return 0; }
-int t() {
-main()
+int main() {
+yywrap()
 ; return 0; }
 EOF
-if eval $ac_link; then
+if { (eval echo configure:684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib=yes"
+  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=no"
+  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`\" = yes"; then
-  echo "$ac_t""yes" 1>&4
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
   LEXLIB="-l$ac_lib"
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 
 fi
@@ -574,9 +706,10 @@
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_path_mgp_cv_path_perl'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:711: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_mgp_cv_path_perl'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$mgp_cv_path_perl" in
   /*)
@@ -597,9 +730,9 @@
 fi
 mgp_cv_path_perl="$ac_cv_path_mgp_cv_path_perl"
 if test -n "$mgp_cv_path_perl"; then
-  echo "$ac_t""$mgp_cv_path_perl" 1>&4
+  echo "$ac_t""$mgp_cv_path_perl" 1>&6
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 
 test -n "$mgp_cv_path_perl" && break
@@ -611,9 +744,10 @@
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_path_mgp_cv_path_uuencode'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:749: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_mgp_cv_path_uuencode'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$mgp_cv_path_uuencode" in
   /*)
@@ -634,9 +768,9 @@
 fi
 mgp_cv_path_uuencode="$ac_cv_path_mgp_cv_path_uuencode"
 if test -n "$mgp_cv_path_uuencode"; then
-  echo "$ac_t""$mgp_cv_path_uuencode" 1>&4
+  echo "$ac_t""$mgp_cv_path_uuencode" 1>&6
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 
 test -n "$mgp_cv_path_uuencode" && break
@@ -648,9 +782,10 @@
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_path_mgp_cv_path_gzip'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:787: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_mgp_cv_path_gzip'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   case "$mgp_cv_path_gzip" in
   /*)
@@ -671,9 +806,9 @@
 fi
 mgp_cv_path_gzip="$ac_cv_path_mgp_cv_path_gzip"
 if test -n "$mgp_cv_path_gzip"; then
-  echo "$ac_t""$mgp_cv_path_gzip" 1>&4
+  echo "$ac_t""$mgp_cv_path_gzip" 1>&6
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 
 test -n "$mgp_cv_path_gzip" && break
@@ -687,43 +822,47 @@
 DEPLIBS=
 
 
-echo $ac_n "checking if --enable-debug option specified""... $ac_c" 1>&4
+echo $ac_n "checking if --enable-debug option specified""... $ac_c" 1>&6
+echo "configure:827: checking if --enable-debug option specified" >&5
 # Check whether --enable-debug or --disable-debug was given.
-enableval="$enable_debug"
-if test -n "$enableval"; then
+if test "${enable_debug+set}" = set; then
+  enableval="$enable_debug"
   mgp_debug="yes"; OPTFLAGS="$OPTFLAGS -g -DDEBUG -Wall"
 else
   mgp_debug="no"
 fi
 
-echo "$ac_t""$mgp_debug" 1>&4
+echo "$ac_t""$mgp_debug" 1>&6
 
-echo $ac_n "checking if --enable-locale option specified""... $ac_c" 1>&4
+echo $ac_n "checking if --enable-locale option specified""... $ac_c" 1>&6
+echo "configure:839: checking if --enable-locale option specified" >&5
 # Check whether --enable-locale or --disable-locale was given.
-enableval="$enable_locale"
-if test -n "$enableval"; then
+if test "${enable_locale+set}" = set; then
+  enableval="$enable_locale"
   mgp_locale="yes"; OPTFLAGS="$OPTFLAGS -DUSE_SETLOCALE"
 else
   mgp_locale="no"
 fi
 
-echo "$ac_t""$mgp_locale" 1>&4
+echo "$ac_t""$mgp_locale" 1>&6
 
 LIBS="-lm $LIBS"
 
-echo $ac_n "checking if --disable-freetype option specified""... $ac_c" 1>&4
+echo $ac_n "checking if --disable-freetype option specified""... $ac_c" 1>&6
+echo "configure:853: checking if --disable-freetype option specified" >&5
 # Check whether --enable-freetype or --disable-freetype was given.
-enableval="$enable_freetype"
-if test -n "$enableval"; then
+if test "${enable_freetype+set}" = set; then
+  enableval="$enable_freetype"
   mgp_skip_freetype="yes"; mgp_use_freetype="no"
 else
   mgp_skip_freetype="no"; mgp_use_freetype="yes"
 fi
 
-echo "$ac_t""$mgp_skip_freetype" 1>&4
+echo "$ac_t""$mgp_skip_freetype" 1>&6
  
 if test "$mgp_use_freetype" = "yes"; then
- 	echo $ac_n "checking for freetype library/header""... $ac_c" 1>&4
+ 	echo $ac_n "checking for freetype library/header""... $ac_c" 1>&6
+echo "configure:866: checking for freetype library/header" >&5
  	for dir in /usr/local/freetype /usr/local; do
  		ac_cv_ft_lib=no
  		ac_cv_ft_include=no
@@ -744,117 +883,128 @@
  		fi
  	done
  	if test "$ac_cv_ft_lib" = "no" -a "$ac_cv_ft_include" = "no"; then
- 		echo "$ac_t""no - not using freetype" 1>&4
+ 		echo "$ac_t""no - not using freetype" 1>&6
  		mgp_use_freetype=no
  	else
- 		echo "$ac_t""$ac_cv_ft_lib and $ac_cv_ft_include" 1>&4
+ 		echo "$ac_t""$ac_cv_ft_lib and $ac_cv_ft_include" 1>&6
  	fi
 fi
 if test "$mgp_use_freetype" = "yes"; then
 	LIBS="-L$ac_cv_ft_lib $LIBS"
 	OPTFLAGS="-I$ac_cv_ft_include $OPTFLAGS"
 	DEPLIBS="$ac_cv_ft_lib/$ac_cv_ft_libpath $DEPLIBS"
- 	echo $ac_n "checking for -lttf""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_lib_ttf'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+ 	echo $ac_n "checking for TT_Init_FreeType in -lttf""... $ac_c" 1>&6
+echo "configure:898: checking for TT_Init_FreeType in -lttf" >&5
+ac_lib_var=`echo ttf'_'TT_Init_FreeType | 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="$LIBS -lttf "
+LIBS="-lttf  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 765 "configure"
+#line 906 "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
+    builtin and then its argument prototype would still apply.  */
+char TT_Init_FreeType();
 
-int main() { return 0; }
-int t() {
+int main() {
 TT_Init_FreeType()
 ; return 0; }
 EOF
-if eval $ac_link; then
+if { (eval echo configure:917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  eval "ac_cv_lib_ttf=yes"
+  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_ttf=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'ttf`\" = yes"; then
-  echo "$ac_t""yes" 1>&4
-    ac_tr_lib=HAVE_LIB`echo ttf | tr '[a-z]' '[A-Z]'`
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo ttf | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_lib 1
 EOF
 
-  LIBS="$LIBS -lttf"
+  LIBS="-lttf $LIBS"
 
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 echo "Fatal: libttf.a not found"
 		exit 1
 fi
 
  	cat > conftest.$ac_ext <<EOF
-#line 800 "configure"
+#line 947 "configure"
 #include "confdefs.h"
 #include <freetype.h>
-int main() { return 0; }
-int t() {
+int main() {
 
 ; return 0; }
 EOF
-if eval $ac_compile; then
+if { (eval echo configure:954: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
    		echo "Fatal: freetype.h not found"
  		exit 1
 fi
 rm -f conftest*
-
  	cat >> confdefs.h <<\EOF
 #define FREETYPE 1
 EOF
 
-	echo $ac_n "checking for num_CharMaps field in TT_Face_Properties""... $ac_c" 1>&4
+	echo $ac_n "checking for num_CharMaps field in TT_Face_Properties""... $ac_c" 1>&6
+echo "configure:969: checking for num_CharMaps field in TT_Face_Properties" >&5
  	cat > conftest.$ac_ext <<EOF
-#line 823 "configure"
+#line 971 "configure"
 #include "confdefs.h"
 #include <freetype.h>
-int main() { return 0; }
-int t() {
+int main() {
 TT_Face_Properties x; return x.num_CharMaps;
 ; return 0; }
 EOF
-if eval $ac_compile; then
+if { (eval echo configure:978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   result=yes; cat >> confdefs.h <<\EOF
 #define HAVE_TT_FACE_PROPERTIES_CHARMAPS 1
 EOF
 
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   result=no
 fi
 rm -f conftest*
-
-	echo "$ac_t""$result" 1>&4
+	echo "$ac_t""$result" 1>&6
 fi
 
-echo $ac_n "checking if --disable-vflib option specified""... $ac_c" 1>&4
+echo $ac_n "checking if --disable-vflib option specified""... $ac_c" 1>&6
+echo "configure:995: checking if --disable-vflib option specified" >&5
 # Check whether --enable-vflib or --disable-vflib was given.
-enableval="$enable_vflib"
-if test -n "$enableval"; then
+if test "${enable_vflib+set}" = set; then
+  enableval="$enable_vflib"
   mgp_skip_vflib="yes"; mgp_use_vflib="no"
 else
   mgp_skip_vflib="no"; mgp_use_vflib="yes"
 fi
 
-echo "$ac_t""$mgp_skip_vflib" 1>&4
+echo "$ac_t""$mgp_skip_vflib" 1>&6
 
 if test "$mgp_use_vflib" = "yes"; then
-	echo $ac_n "checking for VFlib library/header""... $ac_c" 1>&4
+	echo $ac_n "checking for VFlib library/header""... $ac_c" 1>&6
+echo "configure:1008: checking for VFlib library/header" >&5
 	for dir in /usr/local/VFlib /usr/local/vflib /usr/local; do
 		ac_cv_vf_libname=VFlib
 		ac_cv_vf_libdir=no
@@ -884,78 +1034,86 @@
 		fi
 	done
 	if test "$ac_cv_vf_libdir" = "no" -a "$ac_cv_vf_hdrdir" = "no"; then
-		echo "$ac_t""no - not using VFlib" 1>&4
+		echo "$ac_t""no - not using VFlib" 1>&6
 		mgp_use_vflib=no
 	else
-		echo "$ac_t""$ac_cv_vf_libdir and $ac_cv_vf_hdrdir" 1>&4
+		echo "$ac_t""$ac_cv_vf_libdir and $ac_cv_vf_hdrdir" 1>&6
 	fi
 fi
 if test "$mgp_use_vflib" = "yes"; then
 	LIBS="-L$ac_cv_vf_libdir -l$ac_cv_vf_libname $LIBS"
 	OPTFLAGS="-I$ac_cv_vf_hdrdir $OPTFLAGS"
 	DEPLIBS="$ac_cv_vf_libdir/$ac_cv_vf_libpath $DEPLIBS"
-	echo $ac_n "checking for -l$ac_cv_vf_libname""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_lib_$ac_cv_vf_libname'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+	echo $ac_n "checking for VF_Init in -l$ac_cv_vf_libname""... $ac_c" 1>&6
+echo "configure:1049: checking for VF_Init in -l$ac_cv_vf_libname" >&5
+ac_lib_var=`echo $ac_cv_vf_libname'_'VF_Init | 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="$LIBS -l$ac_cv_vf_libname "
+LIBS="-l$ac_cv_vf_libname  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 905 "configure"
+#line 1057 "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
+    builtin and then its argument prototype would still apply.  */
+char VF_Init();
 
-int main() { return 0; }
-int t() {
+int main() {
 VF_Init()
 ; return 0; }
 EOF
-if eval $ac_link; then
+if { (eval echo configure:1068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_cv_vf_libname=yes"
+  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_cv_vf_libname=no"
+  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_cv_vf_libname`\" = yes"; then
-  echo "$ac_t""yes" 1>&4
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
   mgp_cv_vflib_a=$ac_cv_vf_libpath
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 echo "Fatal: $ac_cv_vf_libpath not found"
 		exit 1
 fi
 
 	cat > conftest.$ac_ext <<EOF
-#line 934 "configure"
+#line 1091 "configure"
 #include "confdefs.h"
 #include <VF.h>
-int main() { return 0; }
-int t() {
+int main() {
 
 ; return 0; }
 EOF
-if eval $ac_compile; then
+if { (eval echo configure:1098: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   		echo "Fatal: VF.h not found"
 		exit 1
 fi
 rm -f conftest*
-
 	cat >> confdefs.h <<\EOF
 #define VFLIB 1
 EOF
 
 
-	echo $ac_n "checking for VFlib configuration file""... $ac_c" 1>&4
+	echo $ac_n "checking for VFlib configuration file""... $ac_c" 1>&6
+echo "configure:1114: checking for VFlib configuration file" >&5
 	# Check whether --with-vfontcap or --without-vfontcap was given.
-withval="$with_vfontcap"
-if test -n "$withval"; then
+if test "${with_vfontcap+set}" = set; then
+  withval="$with_vfontcap"
   :
 fi
 
@@ -975,7 +1133,7 @@
 			fi
 		done
 	fi
-	echo "$ac_t""$ac_cv_vf_fontcap" 1>&4
+	echo "$ac_t""$ac_cv_vf_fontcap" 1>&6
 	if test "$ac_cv_vf_fontcap" = "no"; then
 		echo Fatal: no vfontcap file found.  cannot continue.
 		echo Please use the option --with-vfontcap=PATH to specify the path to vfontcap.
@@ -988,14 +1146,15 @@
 	
 fi
 
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&4
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1151: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-if eval "test \"`echo '${'ac_cv_prog_CPP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
     # This must be in double quotes, not single quotes, because CPP may get
   # substituted into the Makefile and "${CC-cc}" will confuse make.
@@ -1003,31 +1162,37 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1007 "configure"
+#line 1166 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
-eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
 else
   echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1021 "configure"
+#line 1183 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
-eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
 else
   echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   CPP=/lib/cpp
 fi
@@ -1036,33 +1201,39 @@
 rm -f conftest*
   ac_cv_prog_CPP="$CPP"
 fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
 fi
-CPP="$ac_cv_prog_CPP"
-echo "$ac_t""$CPP" 1>&4
+echo "$ac_t""$CPP" 1>&6
 
 # If we find X, set shell vars x_includes and x_libraries to the
 # paths, otherwise set no_x=yes.
 # 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>&4
+echo $ac_n "checking for X""... $ac_c" 1>&6
+echo "configure:1216: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
-withval="$with_x"
-if test -n "$withval"; then
+if test "${with_x+set}" = set; then
+  withval="$with_x"
   :
 fi
 
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
 if test "x$with_x" = xno; then
-  no_x=yes
+  # The user explicitly disabled X.
+  have_x=disabled
 else
   if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
-    no_x=
+    # Both variables are already set.
+    have_x=yes
   else
-if eval "test \"`echo '${'ac_cv_path_x'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   # One or both of the vars are not set, and there is no cached value.
-no_x=yes
+ac_x_includes=NO ac_x_libraries=NO
 rm -fr conftestdir
 if mkdir conftestdir; then
   cd conftestdir
@@ -1072,66 +1243,76 @@
 	@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
 EOF
   if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
-    no_x=
     # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-    eval `make acfindx 2>/dev/null | grep -v make`
+    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
     # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
-    if test ! -f $ac_im_usrlibdir/libX11.a && test -f $ac_im_libdir/libX11.a
-    then
-      ac_im_usrlibdir=$ac_im_libdir
-    fi
+    for ac_extension in a so sl; do
+      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+        test -f $ac_im_libdir/libX11.$ac_extension; then
+        ac_im_usrlibdir=$ac_im_libdir; break
+      fi
+    done
+    # Screen out bogus values from the imake configuration.  They are
+    # bogus both because they are the default anyway, and because
+    # using them would break gcc on systems where it needs fixed includes.
     case "$ac_im_incroot" in
 	/usr/include) ;;
-	*) ac_x_includes="$ac_im_incroot" ;;
+	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
     esac
     case "$ac_im_usrlibdir" in
 	/usr/lib | /lib) ;;
-	*) ac_x_libraries="$ac_im_usrlibdir" ;;
+	*) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
     esac
   fi
   cd ..
   rm -fr conftestdir
 fi
 
-if test "$no_x" = yes; then
-test -z "$x_direct_test_library" && x_direct_test_library=Xt
-test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
-test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
+if test "$ac_x_includes" = NO; then
+  # Guess where to find include files, by looking for this one X11 .h file.
+  test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
+
+  # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 1102 "configure"
+#line 1278 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
-eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
-  no_x= ac_x_includes=
+  # We can compile using X headers with no special include directory.
+ac_x_includes=
 else
   echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-    for ac_dir in               \
+  # Look for the header file in a standard set of common directories.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+  for ac_dir in               \
+    /usr/X11/include          \
     /usr/X11R6/include        \
     /usr/X11R5/include        \
     /usr/X11R4/include        \
                               \
+    /usr/include/X11          \
     /usr/include/X11R6        \
     /usr/include/X11R5        \
     /usr/include/X11R4        \
                               \
+    /usr/local/X11/include    \
     /usr/local/X11R6/include  \
     /usr/local/X11R5/include  \
     /usr/local/X11R4/include  \
                               \
+    /usr/local/include/X11    \
     /usr/local/include/X11R6  \
     /usr/local/include/X11R5  \
     /usr/local/include/X11R4  \
                               \
-    /usr/X11/include          \
-    /usr/include/X11          \
-    /usr/local/X11/include    \
-    /usr/local/include/X11    \
-                              \
     /usr/X386/include         \
     /usr/x386/include         \
     /usr/XFree86/include/X11  \
@@ -1148,56 +1329,65 @@
     ; \
   do
     if test -r "$ac_dir/$x_direct_test_include"; then
-      no_x= ac_x_includes=$ac_dir
+      ac_x_includes=$ac_dir
       break
     fi
   done
 fi
 rm -f conftest*
+fi # $ac_x_includes = NO
+
+if test "$ac_x_libraries" = NO; then
+  # Check for the libraries.
 
-# Check for the libraries.
-# See if we find them without any special options.
-# Don't add to $LIBS permanently.
-ac_save_LIBS="$LIBS"
-LIBS="$LIBS -l$x_direct_test_library"
+  test -z "$x_direct_test_library" && x_direct_test_library=Xt
+  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
+
+  # See if we find them without any special options.
+  # Don't add to $LIBS permanently.
+  ac_save_LIBS="$LIBS"
+  LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1165 "configure"
+#line 1352 "configure"
 #include "confdefs.h"
 
-int main() { return 0; }
-int t() {
+int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if eval $ac_link; then
+if { (eval echo configure:1359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
-  LIBS="$ac_save_LIBS" no_x= ac_x_libraries=
+  LIBS="$ac_save_LIBS"
+# We can link X programs with no special library path.
+ac_x_libraries=
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # First see if replacing the include by lib works.
+# Check X11 before X11Rn because it is often a symlink to the current release.
 for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
+    /usr/X11/lib          \
     /usr/X11R6/lib        \
     /usr/X11R5/lib        \
     /usr/X11R4/lib        \
                           \
+    /usr/lib/X11          \
     /usr/lib/X11R6        \
     /usr/lib/X11R5        \
     /usr/lib/X11R4        \
                           \
+    /usr/local/X11/lib    \
     /usr/local/X11R6/lib  \
     /usr/local/X11R5/lib  \
     /usr/local/X11R4/lib  \
                           \
+    /usr/local/lib/X11    \
     /usr/local/lib/X11R6  \
     /usr/local/lib/X11R5  \
     /usr/local/lib/X11R4  \
                           \
-    /usr/X11/lib          \
-    /usr/lib/X11          \
-    /usr/local/X11/lib    \
-    /usr/local/lib/X11    \
-                          \
     /usr/X386/lib         \
     /usr/x386/lib         \
     /usr/XFree86/lib/X11  \
@@ -1208,6 +1398,7 @@
     /usr/athena/lib       \
     /usr/local/x11r5/lib  \
     /usr/lpp/Xamples/lib  \
+    /lib/usr/lib/X11	  \
                           \
     /usr/openwin/lib      \
     /usr/openwin/share/lib \
@@ -1215,78 +1406,64 @@
 do
   for ac_extension in a so sl; do
     if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
-      no_x= ac_x_libraries=$ac_dir
+      ac_x_libraries=$ac_dir
       break 2
     fi
   done
 done
 fi
 rm -f conftest*
+fi # $ac_x_libraries = NO
 
-fi
-if test "$no_x" = yes; then
-  ac_cv_path_x="no_x=yes"
-else
-  ac_cv_path_x="no_x= ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
+  # Didn't find X anywhere.  Cache the known absence of X.
+  ac_cv_have_x="have_x=no"
+else
+  # Record where we found X for the cache.
+  ac_cv_have_x="have_x=yes \
+	        ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
 fi
 fi
   fi
-  eval "$ac_cv_path_x"
+  eval "$ac_cv_have_x"
 fi # $with_x != no
 
-if test "$no_x" = yes; then
-  echo "$ac_t""no" 1>&4
+if test "$have_x" != yes; then
+  echo "$ac_t""$have_x" 1>&6
+  no_x=yes
 else
+  # If each of the values was on the command line, it overrides each guess.
   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
-  ac_cv_path_x="no_x= ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-  echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&4
+  # Update the cache value to reflect the command line values.
+  ac_cv_have_x="have_x=yes \
+		ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+  echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
 fi
 
-# If we cannot run a trivial program, we must be cross compiling.
-echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_c_cross'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1446: 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
-  if test "$cross_compiling" = yes; then
-  ac_cv_cross=yes
-else
-cat > conftest.$ac_ext <<EOF
-#line 1256 "configure"
-#include "confdefs.h"
-main(){return(0);}
-EOF
-eval $ac_link
-if test -s conftest && (./conftest; exit) 2>/dev/null; then
-  ac_cv_c_cross=no
-else
-  ac_cv_c_cross=yes
-fi
-fi
-rm -fr conftest*
-fi
-cross_compiling=$ac_cv_c_cross
-echo "$ac_t""$ac_cv_c_cross" 1>&4
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_header_stdc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
-else
   cat > conftest.$ac_ext <<EOF
-#line 1277 "configure"
+#line 1451 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
 #include <float.h>
 EOF
-eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1459: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
   ac_cv_header_stdc=yes
 else
   echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   ac_cv_header_stdc=no
 fi
@@ -1295,7 +1472,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 1299 "configure"
+#line 1476 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1313,7 +1490,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 1317 "configure"
+#line 1494 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1331,10 +1508,10 @@
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
 if test "$cross_compiling" = yes; then
-  ac_cv_header_stdc=no
+  :
 else
-cat > conftest.$ac_ext <<EOF
-#line 1338 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1515 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1345,17 +1522,22 @@
 exit (0); }
 
 EOF
-eval $ac_link
-if test -s conftest && (./conftest; exit) 2>/dev/null; then
+if { (eval echo configure:1526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
   :
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
   ac_cv_header_stdc=no
 fi
-fi
 rm -fr conftest*
 fi
+
+fi
 fi
-echo "$ac_t""$ac_cv_header_stdc" 1>&4
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
 if test $ac_cv_header_stdc = yes; then
   cat >> confdefs.h <<\EOF
 #define STDC_HEADERS 1
@@ -1363,12 +1545,13 @@
 
 fi
 
-echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:1550: 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 1372 "configure"
+#line 1555 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -1378,24 +1561,25 @@
 #ifndef WIFEXITED
 #define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
 #endif
-int main() { return 0; }
-int t() {
+int main() {
 int s;
 wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if eval $ac_compile; then
+if { (eval echo configure:1571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   ac_cv_header_sys_wait_h=no
 fi
 rm -f conftest*
-
 fi
-echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&4
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
 if test $ac_cv_header_sys_wait_h = yes; then
   cat >> confdefs.h <<\EOF
 #define HAVE_SYS_WAIT_H 1
@@ -1405,51 +1589,55 @@
 
 for ac_hdr in fcntl.h strings.h sys/file.h unistd.h sys/time.h sys/select.h stdarg.h varargs.h termios.h locale.h
 do
-ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1595: 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 1415 "configure"
+#line 1600 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
-eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
 else
   echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
 fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&4
-    ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_hdr 1
 EOF
  
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 done
 
 
-echo $ac_n "checking for working const""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_c_const'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1633: 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 1449 "configure"
+#line 1638 "configure"
 #include "confdefs.h"
 
-int main() { return 0; }
-int t() {
+int main() {
 
 /* Ultrix mips cc rejects this.  */
 typedef int charset[2]; const charset x;
@@ -1458,7 +1646,7 @@
 char **p;
 /* NEC SVR4.0.2 mips cc rejects this.  */
 struct point {int x, y;};
-static struct point const zero;
+static struct point const zero = {0,0};
 /* AIX XL C 1.02.0.0 rejects this.
    It does not let you subtract one const X* pointer from another in an arm
    of an if-expression whose if-part is not a constant expression */
@@ -1495,17 +1683,19 @@
 
 ; return 0; }
 EOF
-if eval $ac_compile; then
+if { (eval echo configure:1687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   ac_cv_c_const=no
 fi
 rm -f conftest*
-
 fi
-echo "$ac_t""$ac_cv_c_const" 1>&4
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
 if test $ac_cv_c_const = no; then
   cat >> confdefs.h <<\EOF
 #define const 
@@ -1513,55 +1703,62 @@
 
 fi
 
-echo $ac_n "checking for inline""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_c_inline'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1708: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$GCC" = yes; then
-cat > conftest.$ac_ext <<EOF
-#line 1523 "configure"
+  ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+  cat > conftest.$ac_ext <<EOF
+#line 1715 "configure"
 #include "confdefs.h"
 
-int main() { return 0; }
-int t() {
-} inline foo() {
+int main() {
+} $ac_kw foo() {
 ; return 0; }
 EOF
-if eval $ac_compile; then
+if { (eval echo configure:1722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ac_cv_c_inline=yes
+  ac_cv_c_inline=$ac_kw; break
 else
-  rm -rf conftest*
-  ac_cv_c_inline=no
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
 fi
 rm -f conftest*
+done
 
-else
-  ac_cv_c_inline=no
-fi
 fi
-echo "$ac_t""$ac_cv_c_inline" 1>&4
-if test $ac_cv_c_inline = no; then
-  cat >> confdefs.h <<\EOF
-#define inline __inline
-EOF
 
-fi
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+  inline | yes) ;;
+  no) cat >> confdefs.h <<\EOF
+#define inline 
+EOF
+ ;;
+  *)  cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
 
-echo $ac_n "checking for pid_t""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_type_pid_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:1748: 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 1557 "configure"
+#line 1753 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
+#include <stddef.h>
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pid_t" >/dev/null 2>&1; then
+  egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_pid_t=yes
 else
@@ -1571,7 +1768,7 @@
 rm -f conftest*
 
 fi
-echo "$ac_t""$ac_cv_type_pid_t" 1>&4
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
 if test $ac_cv_type_pid_t = no; then
   cat >> confdefs.h <<\EOF
 #define pid_t int
@@ -1579,20 +1776,22 @@
 
 fi
 
-echo $ac_n "checking for size_t""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_type_size_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:1781: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1588 "configure"
+#line 1786 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
+#include <stddef.h>
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "size_t" >/dev/null 2>&1; then
+  egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_size_t=yes
 else
@@ -1602,7 +1801,7 @@
 rm -f conftest*
 
 fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&4
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
 if test $ac_cv_type_size_t = no; then
   cat >> confdefs.h <<\EOF
 #define size_t unsigned
@@ -1610,32 +1809,34 @@
 
 fi
 
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_header_time'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1814: 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 1619 "configure"
+#line 1819 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
 #include <time.h>
-int main() { return 0; }
-int t() {
+int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if eval $ac_compile; then
+if { (eval echo configure:1828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   ac_cv_header_time=no
 fi
 rm -f conftest*
-
 fi
-echo "$ac_t""$ac_cv_header_time" 1>&4
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
 if test $ac_cv_header_time = yes; then
   cat >> confdefs.h <<\EOF
 #define TIME_WITH_SYS_TIME 1
@@ -1643,20 +1844,22 @@
 
 fi
 
-echo $ac_n "checking for u_int""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_type_u_int'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for u_int""... $ac_c" 1>&6
+echo "configure:1849: checking for u_int" >&5
+if eval "test \"`echo '$''{'ac_cv_type_u_int'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1652 "configure"
+#line 1854 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
+#include <stddef.h>
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "u_int" >/dev/null 2>&1; then
+  egrep "u_int[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_u_int=yes
 else
@@ -1666,7 +1869,7 @@
 rm -f conftest*
 
 fi
-echo "$ac_t""$ac_cv_type_u_int" 1>&4
+echo "$ac_t""$ac_cv_type_u_int" 1>&6
 if test $ac_cv_type_u_int = no; then
   cat >> confdefs.h <<\EOF
 #define u_int unsigned int
@@ -1674,20 +1877,22 @@
 
 fi
 
-echo $ac_n "checking for u_char""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_type_u_char'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for u_char""... $ac_c" 1>&6
+echo "configure:1882: checking for u_char" >&5
+if eval "test \"`echo '$''{'ac_cv_type_u_char'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1683 "configure"
+#line 1887 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 #include <stdlib.h>
+#include <stddef.h>
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "u_char" >/dev/null 2>&1; then
+  egrep "u_char[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_u_char=yes
 else
@@ -1697,7 +1902,7 @@
 rm -f conftest*
 
 fi
-echo "$ac_t""$ac_cv_type_u_char" 1>&4
+echo "$ac_t""$ac_cv_type_u_char" 1>&6
 if test $ac_cv_type_u_char = no; then
   cat >> confdefs.h <<\EOF
 #define u_char unsigned char
@@ -1706,15 +1911,16 @@
 fi
 
 
-echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_func_memcmp'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:1916: checking for 8-bit clean memcmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$cross_compiling" = yes; then
-  ac_cv_func_memcmp=no
+  ac_cv_func_memcmp_clean=no
 else
-cat > conftest.$ac_ext <<EOF
-#line 1718 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1924 "configure"
 #include "confdefs.h"
 
 main()
@@ -1724,47 +1930,59 @@
 }
 
 EOF
-eval $ac_link
-if test -s conftest && (./conftest; exit) 2>/dev/null; then
-  ac_cv_func_memcmp=yes
+if { (eval echo configure:1934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_memcmp_clean=yes
 else
-  ac_cv_func_memcmp=no
-fi
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_memcmp_clean=no
 fi
 rm -fr conftest*
 fi
-echo "$ac_t""$ac_cv_func_memcmp" 1>&4
-test $ac_cv_func_memcmp = no && LIBOBJS="$LIBOBJS memcmp.o"
 
-echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_type_signal'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+fi
+
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o"
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:1952: 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 1745 "configure"
+#line 1957 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
 #ifdef signal
 #undef signal
 #endif
-extern void (*signal ()) ();
-int main() { return 0; }
-int t() {
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
 int i;
 ; return 0; }
 EOF
-if eval $ac_compile; then
+if { (eval echo configure:1974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   ac_cv_type_signal=int
 fi
 rm -f conftest*
-
 fi
-echo "$ac_t""$ac_cv_type_signal" 1>&4
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
 cat >> confdefs.h <<EOF
 #define RETSIGTYPE $ac_cv_type_signal
 EOF
@@ -1772,19 +1990,23 @@
 
 for ac_func in poll strstr _setbufend
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1995: 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 1781 "configure"
+#line 2000 "configure"
 #include "confdefs.h"
-#include <ctype.h> /* Arbitrary system header to define __stub macros. */
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
-char $ac_func(); 
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
 
-int main() { return 0; }
-int t() {
+int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
@@ -1797,43 +2019,49 @@
 
 ; return 0; }
 EOF
-if eval $ac_link; then
+if { (eval echo configure:2023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-
 fi
+
 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&4
-    ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_func 1
 EOF
  
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 fi
 done
 
 for ac_func in usleep strsep strdup mkstemp snprintf memcmp
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&4
-if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&4
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2050: 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 1830 "configure"
+#line 2055 "configure"
 #include "confdefs.h"
-#include <ctype.h> /* Arbitrary system header to define __stub macros. */
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
-char $ac_func(); 
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
 
-int main() { return 0; }
-int t() {
+int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
@@ -1846,31 +2074,35 @@
 
 ; return 0; }
 EOF
-if eval $ac_link; then
+if { (eval echo configure:2078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-
 fi
+
 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&4
-  :
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ 
 else
-  echo "$ac_t""no" 1>&4
+  echo "$ac_t""no" 1>&6
 LIBOBJS="$LIBOBJS ${ac_func}.o"
 fi
-
 done
 
 
+
 trap '' 1 2 15
-if test -w $cache_file; then
-echo "updating cache $cache_file"
-cat > $cache_file <<\EOF
+cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
 # scripts and configure runs.  It is not useful on other systems.
@@ -1886,15 +2118,38 @@
 # --recheck option to rerun configure.
 #
 EOF
-# Ultrix sh set writes to stderr and can't be redirected directly.
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
 (set) 2>&1 |
-  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p" \
-  >> $cache_file
+  case `(ac_space=' '; set) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
 else
-echo "not updating unwritable cache $cache_file"
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
 fi
+rm -f confcache
 
-trap 'rm -fr conftest* confdefs* core $ac_clean_files; exit 1' 1 2 15
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
 
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
@@ -1913,7 +2168,7 @@
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
 cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%-D\1=\2%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
 s%[ 	`~#$^&*(){}\\|;'"<>?]%\\&%g
 s%\[%\\&%g
 s%\]%\\&%g
@@ -1929,7 +2184,7 @@
 echo creating $CONFIG_STATUS
 rm -f $CONFIG_STATUS
 cat > $CONFIG_STATUS <<EOF
-#!/bin/sh
+#! /bin/sh
 # Generated automatically by configure.
 # Run this file to recreate the current configuration.
 # This directory was configured as follows,
@@ -1948,7 +2203,7 @@
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.1"
+    echo "$CONFIG_STATUS generated by autoconf version 2.12"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -1958,12 +2213,14 @@
 
 ac_given_srcdir=$srcdir
 
-trap 'rm -f Imakefile image/Imakefile sample/Imakefile
-	contrib/mgp2html.pl contrib/mgp2latex.pl contrib/mgpnet mgpembed.pl; exit 1' 1 2 15
+trap 'rm -fr `echo "Imakefile image/Imakefile sample/Imakefile
+	contrib/mgp2html.pl contrib/mgp2latex.pl contrib/mgpnet mgpembed.pl" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
 
-# Protect against being on the right side of a sed subst in config.status. 
-sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
- s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
 $ac_vpsub
 $extrasub
 s%@CFLAGS@%$CFLAGS%g
@@ -1975,6 +2232,18 @@
 s%@exec_prefix@%$exec_prefix%g
 s%@prefix@%$prefix%g
 s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
 s%@SET_MAKE@%$SET_MAKE%g
 s%@AWK@%$AWK%g
 s%@YACC@%$YACC%g
@@ -1991,6 +2260,42 @@
 
 CEOF
 EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+  fi
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
+  else
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  fi
+done
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
 cat >> $CONFIG_STATUS <<EOF
 
 CONFIG_FILES=\${CONFIG_FILES-"Imakefile image/Imakefile sample/Imakefile
@@ -1998,21 +2303,21 @@
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
-  # Support "outfile[:infile]", defaulting infile="outfile.in".
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
   case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
        ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
   *) ac_file_in="${ac_file}.in" ;;
   esac
 
-  # Adjust relative srcdir, etc. for subdirectories.
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
 
   # Remove last slash and all that follows it.  Not all systems have dirname.
   ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
   if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
     # The file is in a subdirectory.
     test ! -d "$ac_dir" && mkdir "$ac_dir"
-    ac_dir_suffix="/$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
     # A "../" for each directory in $ac_dir_suffix.
     ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
   else
@@ -2029,6 +2334,7 @@
     top_srcdir="$ac_dots$ac_given_srcdir" ;;
   esac
 
+
   echo creating "$ac_file"
   rm -f "$ac_file"
   configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
@@ -2037,21 +2343,27 @@
 # $configure_input" ;;
   *) ac_comsub= ;;
   esac
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
   sed -e "$ac_comsub
 s%@configure_input@%$configure_input%g
 s%@srcdir@%$srcdir%g
 s%@top_srcdir@%$top_srcdir%g
-" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
 fi; done
-rm -f conftest.subs
+rm -f conftest.s*
 
+EOF
+cat >> $CONFIG_STATUS <<EOF
 
+EOF
+cat >> $CONFIG_STATUS <<\EOF
 
 exit 0
 EOF
 chmod +x $CONFIG_STATUS
 rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
 
 /bin/rm -f Makefile image/Makefile
Index: kit/ctlwords.pl
diff -u kit/ctlwords.pl:1.2 kit/ctlwords.pl:removed
--- kit/ctlwords.pl:1.2	Sat Sep  5 06:05:08 1998
+++ kit/ctlwords.pl	Mon Dec 28 05:10:05 1998
@@ -1,12 +0,0 @@
-#! /usr/bin/perl
-$counter = 0;	# 0 origin
-print "/* generated by ctlwords.awk. do not edit by hand. */\n";
-
-while (<>) {
-	next if (!/^\/\*CTL\*\//);
-	next if ($_ !~ /(CTL_[A-Z0-9]+)/);
-
-	$word = $1;
-	print "#define $word\t$counter\n";
-	$counter++;
-}
Index: kit/font.c
diff -u kit/font.c:1.20 kit/font.c:1.21
--- kit/font.c:1.20	Thu Dec 17 13:32:36 1998
+++ kit/font.c	Mon Dec 21 15:31:52 1998
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: font.c,v 1.20 1998/12/17 04:32:36 onoe Exp $
+ * $Id: font.c,v 1.21 1998/12/21 06:31:52 onoe Exp $
  */
 
 #include "mgp.h"
@@ -307,7 +307,7 @@
 	if (code >= 0x2121 && code <= 0x2125 && max_x < width / 2)
 		max_x += width / 2;
 
-	xim = XCreateImage(display, DefaultVisual(display, screen), 1,
+	xim = XCreateImage(display, visual, 1,
 		XYBitmap, 0, NULL, width, height, 8, 0);
 	if (xim == NULL) {
 		fprintf(stderr, "vfc_alloc: XCreateImage failed\n");
Index: kit/keywords.pl
diff -u kit/keywords.pl:1.1 kit/keywords.pl:removed
--- kit/keywords.pl:1.1	Tue Nov 11 15:07:40 1997
+++ kit/keywords.pl	Mon Dec 28 05:10:08 1998
@@ -1,14 +0,0 @@
-@keywords = ();
-
-die if (@ARGV != 1);
-open(IN, "< $ARGV[0]") || die;
-while (<IN>) {
-	next if (! /^\/\*CTL\*\//);
-	next if (! /CTL_([A-Z0-9]+),/);
-	$t = $1;
-	$t =~ tr/A-Z/a-z/;
-	push(@keywords, $t);
-}
-close(IN);
-
-print join(' ', @keywords) . "\n";
Index: kit/postscript.c
diff -u kit/postscript.c:1.7 kit/postscript.c:1.8
--- kit/postscript.c:1.7	Thu Dec 17 14:09:22 1998
+++ kit/postscript.c	Wed Dec 23 14:23:59 1998
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: postscript.c,v 1.7 1998/12/17 05:09:22 onoe Exp $
+ * $Id: postscript.c,v 1.8 1998/12/23 05:23:59 itojun Exp $
  */
 
 #include "mgp.h"
@@ -208,6 +208,6 @@
 	if (mgp_flag & FL_VERBOSE) {
 		fprintf(stderr, "resulting zoom=(%f,%f)\n", x, y);
 	}
-	*xp = (int)x * 100;
-	*yp = (int)y * 100;
+	*xp = (int)(x * 100);
+	*yp = (int)(y * 100);
 }
Index: kit/x11.c
diff -u kit/x11.c:1.20 kit/x11.c:1.21
--- kit/x11.c:1.20	Thu Dec 17 13:32:42 1998
+++ kit/x11.c	Mon Dec 21 15:31:53 1998
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: x11.c,v 1.20 1998/12/17 04:32:42 onoe Exp $
+ * $Id: x11.c,v 1.21 1998/12/21 06:31:53 onoe Exp $
  */
 
 #include "mgp.h"
@@ -68,6 +68,48 @@
 int window_x;
 int window_y;
 
+static Visual *
+get_visual(display, screen, depthp)
+	Display *display;
+	int screen;
+	u_int *depthp;
+{
+	XVisualInfo *best, *vinfo, vinfo_template;
+	Visual *ret;
+	int vinfo_mask, i, ninfo;
+
+	vinfo_template.screen = screen;
+	vinfo_mask = VisualScreenMask;
+
+	vinfo = XGetVisualInfo(display, vinfo_mask, &vinfo_template, &ninfo);
+	best = NULL;
+	for (i = 0; i < ninfo; i++) {
+		switch (vinfo[i].class) {
+		case TrueColor:
+			if (vinfo[i].depth < 15)
+				break;
+			if (best == NULL ||
+			    best->class != TrueColor ||
+			    best->depth < vinfo[i].depth)
+				best = &vinfo[i];
+			break;
+		case PseudoColor:
+			if (best == NULL)
+				best = &vinfo[i];
+			break;
+		}
+	}
+	if (best) {
+		ret = best->visual;
+		*depthp = best->depth;
+	} else {
+		ret = DefaultVisual(display, screen);
+		*depthp = DefaultDepth(display, screen);
+	}
+	XFree(vinfo);
+	return ret;
+}
+
 void
 init_win1(geometry)
 	char *geometry;
@@ -82,13 +124,12 @@
 		exit(-1);
 	}
 	screen = DefaultScreen(display);
-	depth = DefaultDepth(display, screen);
+	visual = get_visual(display, screen, &depth);
 	depth_mask = 1;
 	for (i = depth; i; i--)
 		depth_mask *= 2;
 	depth_mask--;
 	/* depth_mask is the max value of pixel */
-	visual = DefaultVisual(display, screen);
 
 	XGetWindowAttributes(display, DefaultRootWindow(display), &xa);
 
@@ -146,7 +187,13 @@
 	if (window_y < 0)
 		window_y = 0;	/*XXX*/
 #endif
-	colormap = DefaultColormap(display, screen);
+	if (visual != DefaultVisual(display, screen))
+		colormap = XCreateColormap(display, RootWindow(display, screen), visual, AllocNone);
+	else {
+		colormap = DefaultColormap(display, screen);
+		if (mgp_flag & FL_PRIVATE)
+			colormap = XCopyColormapAndFree(display, colormap);
+	}
 
 	char_size = window_height * DEFAULT_CHARSIZE / 100;
 	(void)get_color(DEFAULT_FORE, &fore_color);
@@ -160,38 +207,31 @@
 {
 	XSetWindowAttributes xsa;
 	XSizeHints hints;
-	u_long mask = 0;
+	u_long mask;
 	struct gcconf *pc;
 	u_long color;
 	XClassHint res = { "MagicPoint", "MagicPoint" };
 
-	window = XCreateSimpleWindow(display, DefaultRootWindow(display),
+	xsa.border_pixel = fore_color;
+	xsa.background_pixel = back_color;
+	xsa.backing_store = Always;
+	xsa.colormap = colormap;
+	mask = CWBorderPixel | CWBackPixel | CWBackingStore | CWColormap;
+	if (!(mgp_flag & FL_OVER)) {
+		xsa.override_redirect = True;
+		mask |= CWOverrideRedirect;
+	}
+	window = XCreateWindow(display, RootWindow(display, screen),
 		(window_x < 0) ? 0 : window_x,
 		(window_y < 0) ? 0 : window_y,
 		(window_width < 0) ? 0 : window_width,
 		(window_height < 0) ? 0 : window_height,
-		0, fore_color, back_color);
+		0, depth, InputOutput, visual, mask, &xsa);
 	XStoreName(display, window, "MagicPoint");
 	XSetIconName(display, window, "MagicPoint");
 	XSetClassHint(display, window, &res);
 	pixmap = XCreatePixmap(display, window, xa.width, xa.height, depth);
 	maskpix = XCreatePixmap(display, window, xa.width, xa.height, depth);
-
-	if (mgp_flag & FL_PRIVATE){
-		colormap = XCopyColormapAndFree(display, colormap);
-		XSetWindowColormap(display, window, colormap);
-	}
-
-	if (!(mgp_flag & FL_OVER)) {
-		xsa.override_redirect = True;
-		mask |= CWOverrideRedirect;
-		XSetIconName(display, window, mgp_fname);
-	}
-
-	xsa.backing_store = Always;
-	mask |= CWBackingStore;
-
-	XChangeWindowAttributes(display, window, mask, &xsa);
 
 	for (pc = &gcconf[0]; pc->gc; pc++) {
 		*pc->gc = XCreateGC(display, window, 0, 0);
Index: kit/x11dummy.c
diff -u kit/x11dummy.c:1.10 kit/x11dummy.c:1.11
--- kit/x11dummy.c:1.10	Thu Dec 17 13:32:44 1998
+++ kit/x11dummy.c	Mon Dec 21 15:31:54 1998
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: x11dummy.c,v 1.10 1998/12/17 04:32:44 onoe Exp $
+ * $Id: x11dummy.c,v 1.11 1998/12/21 06:31:54 onoe Exp $
  */
 
 #include "mgp.h"
@@ -64,7 +64,7 @@
 		0, 0, 800, 600, 0, fore_color, back_color);
 
 	pixmap  = XCreatePixmap(display, window,
-		window_width, window_height, DefaultDepth(display, 0));
+		window_width, window_height, depth);
 	xsa.override_redirect = True;
 	mask |= CWOverrideRedirect;
 	xsa.backing_store = Always;
