Index: kit/CHANGELOG
diff -u kit/CHANGELOG:1.9 kit/CHANGELOG:removed
--- kit/CHANGELOG:1.9	Sat Sep  5 00:11:21 1998
+++ kit/CHANGELOG	Mon Jan 22 05:10:01 2001
@@ -1,51 +0,0 @@
-CHANGELOG for magicpoint
-$Id: CHANGELOG,v 1.9 1998/09/04 15:11:21 onoe Exp $
-
-Fri Sep  5 1998  onoe@sm.sony.co.jp
-	* handle key inputs from invoked terminal as pressed on Xserver,
-	  even if the Xserver is running on a remote host.
-
-Mon Aug 26 1998  itojun@iijlab.net
-	* new copyright. (BSDish copyright without clause 3)
-
-Mon Aug 25 1998  itojun@iijlab.net
-	* print.c: better x11/freetype/vflib -> postscript font mapping.
-
-Mon Aug 23 1998  kato@wide.ad.jp
-	* embedded image support (added mgpembed.pl and embed.c)
-
-Mon Aug 22 1998  itojun@iijlab.net
-	* added contrib/xmindpath, MindPath PocketPoint user-level driver.
-
-Fri Jul 10 11:57:59 JST 1998  itojun@iijlab.net
-	* cache gs-generated image file.
-	  Suggested by: luigi@FreeBSD.org
-
-Mon Jul  6 11:38:32 JST 1998  itojun@iijlab.net
-	* capable of handling GB2312 and KSC5601 encoding.
-	  they must be encoded by using iso-2022 like escape sequences.
-	  EUC-cn or EUC-kr does not work.
-	* -x option is added.
-
-Thu Jul  2 18:04:16 JST 1998  itojun@iijlab.net
-	* eliminate gsview.
-	* revamp "xfont" directive. (see SYNTAX for detail)
-
-Thu Jun 25 13:10:28 JST 1998  itojun@iijlab.net
-	* print.c: color postscript support by "mgp2ps -c".
-
-changes between 1.02a and 1.03a:
-	* To allow color name that has space inbetween ("dark blue"), 
-	  color name after directives SHOULD come with doublequote.
-	  Therefore,
-		%fore blue
-	  should be
-		%fore "blue"
-	  At this moment, doublequote can be ommitted for backward
-	  compatibility.  We may require to have doublequote in the future.
-	  Font names and other string parameter obeys the same rule.
-	* %image is now capable of rendering encapsulated postscript files
-	  (*.eps).
-		%image foo.eps
-	  should work fine.
-	  By using -X option, you can specify device name for ghostscript.
Index: kit/configure
diff -u kit/configure:1.80 kit/configure:1.81
--- kit/configure:1.80	Tue Dec  5 00:04:22 2000
+++ kit/configure	Thu Jan 18 18:07:14 2001
@@ -27,6 +27,8 @@
   --with-x                use the X Window System"
 ac_help="$ac_help
   --enable-gif            compile gif support in (need libungif)."
+ac_help="$ac_help
+  --enable-imlib          use imlib exclusively to load images."
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -539,7 +541,7 @@
 
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:543: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:545: 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
@@ -591,7 +593,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:595: checking host system type" >&5
+echo "configure:597: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -612,7 +614,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:616: checking how to run the C preprocessor" >&5
+echo "configure:618: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -627,13 +629,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 631 "configure"
+#line 633 "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:637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:639: \"$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
   :
@@ -644,13 +646,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 648 "configure"
+#line 650 "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:654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:656: \"$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
   :
@@ -661,13 +663,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 665 "configure"
+#line 667 "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:671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:673: \"$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
   :
@@ -696,7 +698,7 @@
 # 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>&6
-echo "configure:700: checking for $ac_word" >&5
+echo "configure:702: 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
@@ -730,7 +732,7 @@
 # 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>&6
-echo "configure:734: checking for $ac_word" >&5
+echo "configure:736: 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
@@ -763,7 +765,7 @@
 # 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>&6
-echo "configure:767: checking for $ac_word" >&5
+echo "configure:769: 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
@@ -797,7 +799,7 @@
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:801: checking for yywrap in -l$ac_lib" >&5
+echo "configure:803: 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
@@ -805,7 +807,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 809 "configure"
+#line 811 "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
@@ -816,7 +818,7 @@
 yywrap()
 ; return 0; }
 EOF
-if { (eval echo configure:820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:822: \"$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
@@ -843,7 +845,7 @@
 # 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>&6
-echo "configure:847: checking for $ac_word" >&5
+echo "configure:849: 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
@@ -885,7 +887,7 @@
 # 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>&6
-echo "configure:889: checking for $ac_word" >&5
+echo "configure:891: 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
@@ -927,7 +929,7 @@
 # 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>&6
-echo "configure:931: checking for $ac_word" >&5
+echo "configure:933: 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
@@ -969,7 +971,7 @@
 # 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>&6
-echo "configure:973: checking for $ac_word" >&5
+echo "configure:975: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_mgp_cv_path_uudecode'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1010,7 +1012,7 @@
 # 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>&6
-echo "configure:1014: checking for $ac_word" >&5
+echo "configure:1016: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_mgp_cv_path_gunzip'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1061,7 +1063,7 @@
 OPTFLAGS="$OPTFLAGS -DGUNZIP=\\\"$mgp_cv_path_gunzip\\\""
 
 echo $ac_n "checking if --enable-debug option specified""... $ac_c" 1>&6
-echo "configure:1065: checking if --enable-debug option specified" >&5
+echo "configure:1067: checking if --enable-debug option specified" >&5
 # Check whether --enable-debug or --disable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval="$enable_debug"
@@ -1073,7 +1075,7 @@
 echo "$ac_t""$mgp_debug" 1>&6
 
 echo $ac_n "checking if --enable-locale option specified""... $ac_c" 1>&6
-echo "configure:1077: checking if --enable-locale option specified" >&5
+echo "configure:1079: checking if --enable-locale option specified" >&5
 # Check whether --enable-locale or --disable-locale was given.
 if test "${enable_locale+set}" = set; then
   enableval="$enable_locale"
@@ -1084,887 +1086,740 @@
 
 echo "$ac_t""$mgp_locale" 1>&6
 
-LIBS="-lm $LIBS"
-
-echo $ac_n "checking if --disable-freetype option specified""... $ac_c" 1>&6
-echo "configure:1091: checking if --disable-freetype option specified" >&5
-# Check whether --enable-freetype or --disable-freetype was given.
-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>&6
- 
-if test "$mgp_use_freetype" = "yes"; then
- 	echo $ac_n "checking for freetype library/header""... $ac_c" 1>&6
-echo "configure:1104: checking for freetype library/header" >&5
- 	for dir in /usr/local/freetype /usr/local /opt/freetype /usr/pkg /usr; do
- 		ac_cv_ft_lib=no
- 		ac_cv_ft_include=no
-		shlib1=`echo $dir/lib/libttf.so* | head -1 | sed -e 's/.*\///'`
-		if test x$shlib1 = x; then
-			$shlib1=no
-		fi
- 		if test -d $dir/lib -a -f $dir/lib/$shlib1; then
- 			ac_cv_ft_lib="$dir/lib"
- 			ac_cv_ft_libpath="$shlib1"
- 		elif test -d $dir/lib -a -f $dir/lib/libttf.a; then
- 			ac_cv_ft_lib="$dir/lib"
- 			ac_cv_ft_libpath="libttf.a"
- 		fi
- 		if test -d $dir/include -a -f $dir/include/freetype.h; then
- 			ac_cv_ft_include="$dir/include"
- 		elif test -d $dir/include/freetype -a -f $dir/include/freetype/freetype.h; then
- 			ac_cv_ft_include="$dir/include/freetype"
-		fi
- 		if test "$ac_cv_ft_lib" != "no" -a "$ac_cv_ft_include" != "no"; then
- 			LIBS="-L$ac_cv_ft_lib $LIBS"
- 			CFLAGS="-I$ac_cv_ft_include $CFLAGS"
- 			break
- 		fi
- 	done
- 	if test "$ac_cv_ft_lib" = "no" -a "$ac_cv_ft_include" = "no"; then
- 		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>&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 dgettext in -lintl""... $ac_c" 1>&6
-echo "configure:1142: checking for dgettext in -lintl" >&5
-ac_lib_var=`echo intl'_'dgettext | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1091: 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
-  ac_save_LIBS="$LIBS"
-LIBS="-lintl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1150 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1096 "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 dgettext();
-
-int main() {
-dgettext()
-; return 0; }
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
 EOF
-if { (eval echo configure:1161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1104: \"$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*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ac_cv_header_stdc=yes
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_header_stdc=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
-    ac_tr_lib=HAVE_LIB`echo intl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
+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 1121 "configure"
+#include "confdefs.h"
+#include <string.h>
 EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
 
-  LIBS="-lintl $LIBS"
+fi
 
+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 1139 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
 else
-  echo "$ac_t""no" 1>&6
+  rm -rf conftest*
+  ac_cv_header_stdc=no
 fi
+rm -f conftest*
 
- 	echo $ac_n "checking for TT_Init_FreeType in -lttf""... $ac_c" 1>&6
-echo "configure:1189: 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
+fi
+
+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
+  :
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lttf  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1197 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1160 "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();
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
 
-int main() {
-TT_Init_FreeType()
-; return 0; }
 EOF
-if { (eval echo configure:1208: \"$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"
+if { (eval echo configure:1171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  rm -fr conftest*
+  ac_cv_header_stdc=no
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
+rm -fr conftest*
+fi
 
 fi
-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
+fi
 
-  LIBS="-lttf $LIBS"
+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
+EOF
 
-else
-  echo "$ac_t""no" 1>&6
-echo "Fatal: libttf.a not found"
-		exit 1
 fi
 
- 	cat > conftest.$ac_ext <<EOF
-#line 1238 "configure"
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:1195: 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 1200 "configure"
 #include "confdefs.h"
-#include <freetype.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
 int main() {
-
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:1245: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  :
+if { (eval echo configure:1216: \"$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*
-   		echo "Fatal: freetype.h not found"
- 		exit 1
+  ac_cv_header_sys_wait_h=no
 fi
 rm -f conftest*
- 	cat >> confdefs.h <<\EOF
-#define FREETYPE 1
+fi
+
+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
 EOF
 
-	echo $ac_n "checking for num_CharMaps field in TT_Face_Properties""... $ac_c" 1>&6
-echo "configure:1260: checking for num_CharMaps field in TT_Face_Properties" >&5
- 	cat > conftest.$ac_ext <<EOF
-#line 1262 "configure"
+fi
+
+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" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1240: 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 1245 "configure"
 #include "confdefs.h"
-#include <freetype.h>
-int main() {
-TT_Face_Properties x; return x.num_CharMaps;
-; return 0; }
+#include <$ac_hdr>
 EOF
-if { (eval echo configure:1269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1250: \"$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*
-  result=yes; cat >> confdefs.h <<\EOF
-#define HAVE_TT_FACE_PROPERTIES_CHARMAPS 1
-EOF
-
+  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*
-  result=no
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
-	echo "$ac_t""$result" 1>&6
 fi
-
-echo $ac_n "checking if --disable-vflib option specified""... $ac_c" 1>&6
-echo "configure:1286: checking if --disable-vflib option specified" >&5
-# Check whether --enable-vflib or --disable-vflib was given.
-if test "${enable_vflib+set}" = set; then
-  enableval="$enable_vflib"
-  mgp_skip_vflib="yes"; mgp_use_vflib="no"
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  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
-  mgp_skip_vflib="no"; mgp_use_vflib="yes"
+  echo "$ac_t""no" 1>&6
 fi
+done
 
-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>&6
-echo "configure:1299: checking for VFlib library/header" >&5
-	for dir in /usr/local/VFlib /usr/local/vflib /usr/local /usr/pkg /usr; do
-		ac_cv_vf_libname=VFlib
-		ac_cv_vf_libdir=no
-		ac_cv_vf_hdrdir=no
-		shlib1=`echo $dir/lib/libVFlib.so* | head -1 | sed -e 's/.*\///'`
-		shlib2=`echo $dir/lib/libVFlib2.so* | head -1 | sed -e 's/.*\///'`
-		if test x$shlib1 = x; then
-			$shlib1=no
-		fi
-		if test x$shlib2 = x; then
-			$shlib2=no
-		fi
-		if test -d $dir/lib -a -f $dir/lib/$shlib1; then
-			ac_cv_vf_libdir="$dir/lib"
- 			ac_cv_vf_libpath=$shlib1
-		elif test -d $dir/lib -a -f $dir/lib/libVFlib.a; then
-			ac_cv_vf_libdir="$dir/lib"
-			ac_cv_vf_libpath="libVFlib.a"
-		elif test -d $dir/lib -a -f $dir/lib/$shlib2; then
-			ac_cv_vf_libname=VFlib2
-			ac_cv_vf_libdir="$dir/lib"
- 			ac_cv_vf_libpath=$shlib2
-		elif test -d $dir/lib -a -f $dir/lib/libVFlib2.a; then
-			ac_cv_vf_libname=VFlib2
-			ac_cv_vf_libdir="$dir/lib"
-			ac_cv_vf_libpath="libVFlib2.a"
-		fi
-		if test -d $dir/include -a -f $dir/include/VF.h; then
-			ac_cv_vf_hdrdir="$dir/include"
-		fi
-		if test "$ac_cv_vf_libdir" != "no" -a "$ac_cv_vf_hdrdir" != "no"; then
-			LIBS="-L$ac_cv_vf_libdir $LIBS"
-			CFLAGS="-I$ac_cv_vf_hdrdir $CFLAGS"
-			break
-		fi
-	done
-	if test "$ac_cv_vf_libdir" = "no" -a "$ac_cv_vf_hdrdir" = "no"; then
-		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>&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 VF_Init in -l$ac_cv_vf_libname""... $ac_c" 1>&6
-echo "configure:1348: 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 "checking for working const""... $ac_c" 1>&6
+echo "configure:1278: 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
-  ac_save_LIBS="$LIBS"
-LIBS="-l$ac_cv_vf_libname  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1356 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1283 "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() {
-VF_Init()
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+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 */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
 ; return 0; }
 EOF
-if { (eval echo configure:1367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ac_cv_c_const=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_c_const=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
-  mgp_cv_vflib_a=$ac_cv_vf_libpath
-else
-  echo "$ac_t""no" 1>&6
-echo "Fatal: $ac_cv_vf_libpath not found"
-		exit 1
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
+
 fi
 
-	cat > conftest.$ac_ext <<EOF
-#line 1390 "configure"
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1353: 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 1360 "configure"
 #include "confdefs.h"
-#include <VF.h>
-int main() {
 
+int main() {
+} $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:1397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  :
+if { (eval echo configure:1367: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_inline=$ac_kw; break
 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
-
+done
 
-	echo $ac_n "checking for VFlib configuration file""... $ac_c" 1>&6
-echo "configure:1413: checking for VFlib configuration file" >&5
-	# Check whether --with-vfontcap or --without-vfontcap was given.
-if test "${with_vfontcap+set}" = set; then
-  withval="$with_vfontcap"
-  :
 fi
 
-	ac_cv_vf_fontcap="no"
-	if test -f "$with_vfontcap"; then
-		ac_cv_vf_fontcap=$with_vfontcap;
-	else
-		for ac_dir in /usr/local/lib /usr/local/lib/tex \
-		    /usr/local/lib/VFlib /usr/local/lib/fonts/vf \
-		    /usr/local/lib /usr/local/etc /etc \
-		    /usr/local/libdata/vflib /usr/local/share/VFlib \
-		    /usr/local/share/VFlib/* \
-		    ../../VFlib* ../VFlib* VFlib*; do
-			if test -d $ac_dir -a -f $ac_dir/vfontcap; then
-				ac_cv_vf_fontcap=$ac_dir/vfontcap;
-				break
-			fi
-		done
-	fi
-	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.
-		exit 1
-	fi
-	cat >> confdefs.h <<EOF
-#define VFCAP "$ac_cv_vf_fontcap"
+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
-
-	
-fi
-
-if test "$mgp_use_freetype" = "yes"; then
-	echo $ac_n "checking if --enable-freetype-charset16 option specified""... $ac_c" 1>&6
-echo "configure:1451: checking if --enable-freetype-charset16 option specified" >&5
-	# Check whether --enable-freetype-charset16 or --disable-freetype-charset16 was given.
-if test "${enable_freetype_charset16+set}" = set; then
-  enableval="$enable_freetype_charset16"
-  mgp_use_freetype_c16="yes"
-else
-  mgp_use_freetype_c16="no"
-fi
-
-	echo "$ac_t""$mgp_use_freetype_c16" 1>&6
-
-	if test "$mgp_use_freetype_c16" = "yes"; then
-		cat >> confdefs.h <<\EOF
-#define FREETYPE_CHARSET16 1
+ ;;
+  *)  cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
 EOF
-
-	fi
-fi
+ ;;
+esac
 
-for i in /usr/pkg /usr/local /usr; do
-	if test -f $i/include/png.h; then 
-		if test -f $i/lib/libpng.a ; then
-			DEPLIBS="$DEPLIBS $i/lib/libpng.a"
-		elif test -f $i/lib/libpng.so ; then
-			DEPLIBS="$DEPLIBS $i/lib/libpng.so"
-		else
-			break;
-		fi
-		LIBS="$LIBS -L$i/lib"
-		OPTFLAGS="$OPTFLAGS -I$i/include"
-		echo $ac_n "checking for png_set_tRNS_to_alpha in -lpng""... $ac_c" 1>&6
-echo "configure:1482: checking for png_set_tRNS_to_alpha in -lpng" >&5
-ac_lib_var=`echo png'_'png_set_tRNS_to_alpha | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:1393: 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
-  ac_save_LIBS="$LIBS"
-LIBS="-lpng  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1490 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1398 "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 png_set_tRNS_to_alpha();
-
-int main() {
-png_set_tRNS_to_alpha()
-; return 0; }
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
 EOF
-if { (eval echo configure:1501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ac_cv_type_pid_t=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_type_pid_t=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
-  LIBS="$LIBS -lpng"
-			 cat >> confdefs.h <<\EOF
-#define USE_PNG 1
-EOF
-
-else
-  echo "$ac_t""no" 1>&6
-echo $ac_n "checking for png_set_gray_1_2_4_to_8 in -lpng""... $ac_c" 1>&6
-echo "configure:1524: checking for png_set_gray_1_2_4_to_8 in -lpng" >&5
-ac_lib_var=`echo png'_'png_set_gray_1_2_4_to_8 | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+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
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:1426: 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
-  ac_save_LIBS="$LIBS"
-LIBS="-lpng -lz $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1532 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1431 "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 png_set_gray_1_2_4_to_8();
+#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 "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_size_t=yes
+else
+  rm -rf conftest*
+  ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+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
+EOF
+
+fi
 
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1459: 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 1464 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
 int main() {
-png_set_gray_1_2_4_to_8()
+struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:1543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ac_cv_header_time=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_header_time=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
-  LIBS="$LIBS -lpng -lz"
-			 cat >> confdefs.h <<\EOF
-#define USE_PNG 1
+
+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
 EOF
 
+fi
+
+echo $ac_n "checking for u_int""... $ac_c" 1>&6
+echo "configure:1494: 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
-  echo "$ac_t""no" 1>&6
+  cat > conftest.$ac_ext <<EOF
+#line 1499 "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 "(^|[^a-zA-Z_0-9])u_int[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_u_int=yes
+else
+  rm -rf conftest*
+  ac_cv_type_u_int=no
 fi
+rm -f conftest*
 
 fi
+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
+EOF
 
-		break
-	fi
-done
+fi
 
-# 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>&6
-echo "configure:1578: checking for X" >&5
+echo $ac_n "checking for u_char""... $ac_c" 1>&6
+echo "configure:1527: 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 1532 "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 "(^|[^a-zA-Z_0-9])u_char[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_type_u_char=yes
+else
+  rm -rf conftest*
+  ac_cv_type_u_char=no
+fi
+rm -f conftest*
 
-# Check whether --with-x or --without-x was given.
-if test "${with_x+set}" = set; then
-  withval="$with_x"
-  :
 fi
+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
+EOF
 
-# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
-if test "x$with_x" = xno; then
-  # The user explicitly disabled X.
-  have_x=disabled
-else
-  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
-    # Both variables are already set.
-    have_x=yes
-  else
-if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
+fi
+
+
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:1561: 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
-  # One or both of the vars are not set, and there is no cached value.
-ac_x_includes=NO ac_x_libraries=NO
-rm -fr conftestdir
-if mkdir conftestdir; then
-  cd conftestdir
-  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
-  cat > Imakefile <<'EOF'
-acfindx:
-	@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_memcmp_clean=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1569 "configure"
+#include "confdefs.h"
+
+main()
+{
+  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}
+
 EOF
-  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
-    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
-    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
-    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) ;;
-	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
-    esac
-    case "$ac_im_usrlibdir" in
-	/usr/lib | /lib) ;;
-	*) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
-    esac
-  fi
-  cd ..
-  rm -fr conftestdir
+if { (eval echo configure:1579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_memcmp_clean=yes
+else
+  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
 
-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
+fi
 
-  # First, try using that file with no special directory specified.
-cat > conftest.$ac_ext <<EOF
-#line 1640 "configure"
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:1597: 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 1602 "configure"
 #include "confdefs.h"
-#include <$x_direct_test_include>
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1645: \"$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
+if { (eval echo configure:1619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  # We can compile using X headers with no special include directory.
-ac_x_includes=
+  ac_cv_type_signal=void
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  # 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/X386/include         \
-    /usr/x386/include         \
-    /usr/XFree86/include/X11  \
-                              \
-    /usr/include              \
-    /usr/local/include        \
-    /usr/unsupported/include  \
-    /usr/athena/include       \
-    /usr/local/x11r5/include  \
-    /usr/lpp/Xamples/include  \
-                              \
-    /usr/openwin/include      \
-    /usr/openwin/share/include \
-    ; \
-  do
-    if test -r "$ac_dir/$x_direct_test_include"; then
-      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.
-
-  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 1714 "configure"
-#include "confdefs.h"
-
-int main() {
-${x_direct_test_function}()
-; return 0; }
-EOF
-if { (eval echo configure:1721: \"$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.
-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/X386/lib         \
-    /usr/x386/lib         \
-    /usr/XFree86/lib/X11  \
-                          \
-    /usr/lib              \
-    /usr/local/lib        \
-    /usr/unsupported/lib  \
-    /usr/athena/lib       \
-    /usr/local/x11r5/lib  \
-    /usr/lpp/Xamples/lib  \
-    /lib/usr/lib/X11	  \
-                          \
-    /usr/openwin/lib      \
-    /usr/openwin/share/lib \
-    ; \
-do
-  for ac_extension in a so sl; do
-    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
-      ac_x_libraries=$ac_dir
-      break 2
-    fi
-  done
-done
+  ac_cv_type_signal=int
 fi
 rm -f conftest*
-fi # $ac_x_libraries = NO
-
-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_have_x"
-fi # $with_x != no
 
-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
-  # 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
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
 
-echo $ac_n "checking if --enable-gif option specified""... $ac_c" 1>&6
-echo "configure:1808: checking if --enable-gif option specified" >&5
-# Check whether --enable-gif or --disable-gif was given.
-if test "${enable_gif+set}" = set; then
-  enableval="$enable_gif"
-  mgp_gif="yes"
-else
-  mgp_gif="no"
-fi
 
-echo "$ac_t""$mgp_gif" 1>&6
-if test $mgp_gif = "yes"; then
-	echo $ac_n "checking for DGifOpenFileHandle in -lungif""... $ac_c" 1>&6
-echo "configure:1820: checking for DGifOpenFileHandle in -lungif" >&5
-ac_lib_var=`echo ungif'_'DGifOpenFileHandle | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+for ac_func in poll strstr _setbufend
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1640: 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
-  ac_save_LIBS="$LIBS"
-LIBS="-lungif  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1828 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1645 "configure"
 #include "confdefs.h"
+/* 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.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char DGifOpenFileHandle();
+char $ac_func();
 
 int main() {
-DGifOpenFileHandle()
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:1839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1668: \"$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"
+  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_lib_$ac_lib_var=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  gif_ok=yes
-		GIFLIB="-lungif"
-		cat >> confdefs.h <<\EOF
-#define USE_GIF 1
+    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>&6
-echo $ac_n "checking for DGifOpenFileHandle in -lgif""... $ac_c" 1>&6
-echo "configure:1863: checking for DGifOpenFileHandle in -lgif" >&5
-ac_lib_var=`echo gif'_'DGifOpenFileHandle | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+fi
+done
+
+for ac_func in usleep strsep strdup mkstemp snprintf memcmp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1695: 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
-  ac_save_LIBS="$LIBS"
-LIBS="-lgif  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1871 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 1700 "configure"
 #include "confdefs.h"
+/* 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.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char DGifOpenFileHandle();
+char $ac_func();
 
 int main() {
-DGifOpenFileHandle()
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:1882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1723: \"$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"
+  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_lib_$ac_lib_var=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  gif_ok=yes
-		GIFLIB="-lgif"
-		cat >> confdefs.h <<\EOF
-#define USE_GIF 1
+    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>&6
-echo $ac_n "checking for DGifOpenFileName in -lungif""... $ac_c" 1>&6
-echo "configure:1906: checking for DGifOpenFileName in -lungif" >&5
-ac_lib_var=`echo ungif'_'DGifOpenFileName | 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="-lungif -L$x_libraries -lX11 $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1914 "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 DGifOpenFileName();
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
 
-int main() {
-DGifOpenFileName()
-; return 0; }
-EOF
-if { (eval echo configure:1925: \"$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"
+
+
+LIBS="-lm $LIBS"
+
+echo $ac_n "checking if --disable-freetype option specified""... $ac_c" 1>&6
+echo "configure:1753: checking if --disable-freetype option specified" >&5
+# Check whether --enable-freetype or --disable-freetype was given.
+if test "${enable_freetype+set}" = set; then
+  enableval="$enable_freetype"
+  mgp_skip_freetype="yes"; mgp_use_freetype="no"
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  mgp_skip_freetype="no"; mgp_use_freetype="yes"
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
 
+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>&6
+echo "configure:1766: checking for freetype library/header" >&5
+ 	for dir in /usr/local/freetype /usr/local /opt/freetype /usr/pkg /usr; do
+ 		ac_cv_ft_lib=no
+ 		ac_cv_ft_include=no
+		shlib1=`echo $dir/lib/libttf.so* | head -1 | sed -e 's/.*\///'`
+		if test x$shlib1 = x; then
+			$shlib1=no
+		fi
+ 		if test -d $dir/lib -a -f $dir/lib/$shlib1; then
+ 			ac_cv_ft_lib="$dir/lib"
+ 			ac_cv_ft_libpath="$shlib1"
+ 		elif test -d $dir/lib -a -f $dir/lib/libttf.a; then
+ 			ac_cv_ft_lib="$dir/lib"
+ 			ac_cv_ft_libpath="libttf.a"
+ 		fi
+ 		if test -d $dir/include -a -f $dir/include/freetype.h; then
+ 			ac_cv_ft_include="$dir/include"
+ 		elif test -d $dir/include/freetype -a -f $dir/include/freetype/freetype.h; then
+ 			ac_cv_ft_include="$dir/include/freetype"
+		fi
+ 		if test "$ac_cv_ft_lib" != "no" -a "$ac_cv_ft_include" != "no"; then
+ 			LIBS="-L$ac_cv_ft_lib $LIBS"
+ 			CFLAGS="-I$ac_cv_ft_include $CFLAGS"
+ 			break
+ 		fi
+ 	done
+ 	if test "$ac_cv_ft_lib" = "no" -a "$ac_cv_ft_include" = "no"; then
+ 		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>&6
+ 	fi
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  gif_ok=yes
-		GIFLIB="-lungif"
-		cat >> confdefs.h <<\EOF
-#define USE_GIF 1
-EOF
-
-else
-  echo "$ac_t""no" 1>&6
-echo $ac_n "checking for DGifOpenFilename in -lgif""... $ac_c" 1>&6
-echo "configure:1949: checking for DGifOpenFilename in -lgif" >&5
-ac_lib_var=`echo gif'_'DGifOpenFilename | sed 'y%./+-%__p_%'`
+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 dgettext in -lintl""... $ac_c" 1>&6
+echo "configure:1804: checking for dgettext in -lintl" >&5
+ac_lib_var=`echo intl'_'dgettext | 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="-lgif -L$x_libraries -lX11 $LIBS"
+LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1957 "configure"
+#line 1812 "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 DGifOpenFilename();
+char dgettext();
 
 int main() {
-DGifOpenFilename()
+dgettext()
 ; return 0; }
 EOF
-if { (eval echo configure:1968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1823: \"$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
@@ -1979,698 +1834,928 @@
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  gif_ok=yes
-		GIFLIB="-lgif"
-		cat >> confdefs.h <<\EOF
-#define USE_GIF 1
+    ac_tr_lib=HAVE_LIB`echo intl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
 EOF
 
+  LIBS="-lintl $LIBS"
+
 else
   echo "$ac_t""no" 1>&6
 fi
-
-fi
 
-fi
-
-fi
-
-	if test "x$gif_ok" != "xyes"; then
-		echo 'FATAL: You need libungif to use gif images.  pass proper LIBS to configure.'
-		exit 1
-	fi
-	for i in /usr/pkg /usr/local /usr; do
-		if test -f $i/include/gif_lib.h; then
-			gif_h_ok=yes
-			OPTFLAGS="$OPTFLAGS -I$i/include"
-			break
-		fi
-	done
-	if test "x$gif_h_ok" != "xyes"; then
-		echo 'FATAL: can not find gif_lib.h.  pass proper CPPFLAGS to configure.'
-		exit 1
-	fi
-fi
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2017: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ 	echo $ac_n "checking for TT_Init_FreeType in -lttf""... $ac_c" 1>&6
+echo "configure:1851: 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
-  cat > conftest.$ac_ext <<EOF
-#line 2022 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lttf  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1859 "configure"
 #include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.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() {
+TT_Init_FreeType()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2030: \"$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
+if { (eval echo configure:1870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_header_stdc=yes
+  eval "ac_cv_lib_$ac_lib_var=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
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
 
-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 2047 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "memchr" >/dev/null 2>&1; then
-  :
-else
-  rm -rf conftest*
-  ac_cv_header_stdc=no
 fi
-rm -f conftest*
+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
 
-fi
+  LIBS="-lttf $LIBS"
 
-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 2065 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "free" >/dev/null 2>&1; then
-  :
 else
-  rm -rf conftest*
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
+  echo "$ac_t""no" 1>&6
+echo "Fatal: libttf.a not found"
+		exit 1
 fi
 
-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
-  :
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2086 "configure"
+ 	cat > conftest.$ac_ext <<EOF
+#line 1900 "configure"
 #include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
+#include <freetype.h>
+int main() {
 
+; return 0; }
 EOF
-if { (eval echo configure:2097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+if { (eval echo configure:1907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   :
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
+  rm -rf conftest*
+   		echo "Fatal: freetype.h not found"
+ 		exit 1
 fi
-
-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
+rm -f conftest*
+ 	cat >> confdefs.h <<\EOF
+#define FREETYPE 1
 EOF
-
-fi
 
-echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:2121: 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 2126 "configure"
+	echo $ac_n "checking for num_CharMaps field in TT_Face_Properties""... $ac_c" 1>&6
+echo "configure:1922: checking for num_CharMaps field in TT_Face_Properties" >&5
+ 	cat > conftest.$ac_ext <<EOF
+#line 1924 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
+#include <freetype.h>
 int main() {
-int s;
-wait (&s);
-s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+TT_Face_Properties x; return x.num_CharMaps;
 ; return 0; }
 EOF
-if { (eval echo configure:2142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ac_cv_header_sys_wait_h=yes
+  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*
-  ac_cv_header_sys_wait_h=no
+  result=no
 fi
 rm -f conftest*
+	echo "$ac_t""$result" 1>&6
 fi
 
-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
-EOF
-
+echo $ac_n "checking if --disable-vflib option specified""... $ac_c" 1>&6
+echo "configure:1948: checking if --disable-vflib option specified" >&5
+# Check whether --enable-vflib or --disable-vflib was given.
+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
 
-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" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2166: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+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>&6
+echo "configure:1961: checking for VFlib library/header" >&5
+	for dir in /usr/local/VFlib /usr/local/vflib /usr/local /usr/pkg /usr; do
+		ac_cv_vf_libname=VFlib
+		ac_cv_vf_libdir=no
+		ac_cv_vf_hdrdir=no
+		shlib1=`echo $dir/lib/libVFlib.so* | head -1 | sed -e 's/.*\///'`
+		shlib2=`echo $dir/lib/libVFlib2.so* | head -1 | sed -e 's/.*\///'`
+		if test x$shlib1 = x; then
+			$shlib1=no
+		fi
+		if test x$shlib2 = x; then
+			$shlib2=no
+		fi
+		if test -d $dir/lib -a -f $dir/lib/$shlib1; then
+			ac_cv_vf_libdir="$dir/lib"
+ 			ac_cv_vf_libpath=$shlib1
+		elif test -d $dir/lib -a -f $dir/lib/libVFlib.a; then
+			ac_cv_vf_libdir="$dir/lib"
+			ac_cv_vf_libpath="libVFlib.a"
+		elif test -d $dir/lib -a -f $dir/lib/$shlib2; then
+			ac_cv_vf_libname=VFlib2
+			ac_cv_vf_libdir="$dir/lib"
+ 			ac_cv_vf_libpath=$shlib2
+		elif test -d $dir/lib -a -f $dir/lib/libVFlib2.a; then
+			ac_cv_vf_libname=VFlib2
+			ac_cv_vf_libdir="$dir/lib"
+			ac_cv_vf_libpath="libVFlib2.a"
+		fi
+		if test -d $dir/include -a -f $dir/include/VF.h; then
+			ac_cv_vf_hdrdir="$dir/include"
+		fi
+		if test "$ac_cv_vf_libdir" != "no" -a "$ac_cv_vf_hdrdir" != "no"; then
+			LIBS="-L$ac_cv_vf_libdir $LIBS"
+			CFLAGS="-I$ac_cv_vf_hdrdir $CFLAGS"
+			break
+		fi
+	done
+	if test "$ac_cv_vf_libdir" = "no" -a "$ac_cv_vf_hdrdir" = "no"; then
+		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>&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 VF_Init in -l$ac_cv_vf_libname""... $ac_c" 1>&6
+echo "configure:2010: 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
-  cat > conftest.$ac_ext <<EOF
-#line 2171 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-l$ac_cv_vf_libname  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2018 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
+/* 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() {
+VF_Init()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2176: \"$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
+if { (eval echo configure:2029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_lib_$ac_lib_var=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"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   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
- 
+  mgp_cv_vflib_a=$ac_cv_vf_libpath
 else
   echo "$ac_t""no" 1>&6
+echo "Fatal: $ac_cv_vf_libpath not found"
+		exit 1
 fi
-done
 
-
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2204: 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 2209 "configure"
+	cat > conftest.$ac_ext <<EOF
+#line 2052 "configure"
 #include "confdefs.h"
-
+#include <VF.h>
 int main() {
 
-/* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this.  */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this.  */
-struct point {int x, y;};
-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 */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this.  */
-  char *t;
-  char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-  *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-  int x[] = {25, 17};
-  const int *foo = &x[0];
-  ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-  typedef const int *iptr;
-  iptr p = 0;
-  ++p;
-}
-{ /* AIX XL C 1.02.0.0 rejects this saying
-     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-  struct s { int j; const int *ap[3]; };
-  struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-  const int foo = 10;
-}
-
 ; return 0; }
 EOF
-if { (eval echo configure:2258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_c_const=yes
+if { (eval echo configure:2059: \"$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*
-  ac_cv_c_const=no
+  		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>&6
+echo "configure:2075: checking for VFlib configuration file" >&5
+	# Check whether --with-vfontcap or --without-vfontcap was given.
+if test "${with_vfontcap+set}" = set; then
+  withval="$with_vfontcap"
+  :
 fi
 
-echo "$ac_t""$ac_cv_c_const" 1>&6
-if test $ac_cv_c_const = no; then
-  cat >> confdefs.h <<\EOF
-#define const 
+	ac_cv_vf_fontcap="no"
+	if test -f "$with_vfontcap"; then
+		ac_cv_vf_fontcap=$with_vfontcap;
+	else
+		for ac_dir in /usr/local/lib /usr/local/lib/tex \
+		    /usr/local/lib/VFlib /usr/local/lib/fonts/vf \
+		    /usr/local/lib /usr/local/etc /etc \
+		    /usr/local/libdata/vflib /usr/local/share/VFlib \
+		    /usr/local/share/VFlib/* \
+		    ../../VFlib* ../VFlib* VFlib*; do
+			if test -d $ac_dir -a -f $ac_dir/vfontcap; then
+				ac_cv_vf_fontcap=$ac_dir/vfontcap;
+				break
+			fi
+		done
+	fi
+	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.
+		exit 1
+	fi
+	cat >> confdefs.h <<EOF
+#define VFCAP "$ac_cv_vf_fontcap"
 EOF
 
+	
 fi
 
-echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:2279: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+if test "$mgp_use_freetype" = "yes"; then
+	echo $ac_n "checking if --enable-freetype-charset16 option specified""... $ac_c" 1>&6
+echo "configure:2113: checking if --enable-freetype-charset16 option specified" >&5
+	# Check whether --enable-freetype-charset16 or --disable-freetype-charset16 was given.
+if test "${enable_freetype_charset16+set}" = set; then
+  enableval="$enable_freetype_charset16"
+  mgp_use_freetype_c16="yes"
+else
+  mgp_use_freetype_c16="no"
+fi
+
+	echo "$ac_t""$mgp_use_freetype_c16" 1>&6
+
+	if test "$mgp_use_freetype_c16" = "yes"; then
+		cat >> confdefs.h <<\EOF
+#define FREETYPE_CHARSET16 1
+EOF
+
+	fi
+fi
+
+for i in /usr/pkg /usr/local /usr; do
+	if test -f $i/include/png.h; then 
+		if test -f $i/lib/libpng.a ; then
+			DEPLIBS="$DEPLIBS $i/lib/libpng.a"
+		elif test -f $i/lib/libpng.so ; then
+			DEPLIBS="$DEPLIBS $i/lib/libpng.so"
+		else
+			break;
+		fi
+		LIBS="$LIBS -L$i/lib"
+		OPTFLAGS="$OPTFLAGS -I$i/include"
+		echo $ac_n "checking for png_set_tRNS_to_alpha in -lpng""... $ac_c" 1>&6
+echo "configure:2144: checking for png_set_tRNS_to_alpha in -lpng" >&5
+ac_lib_var=`echo png'_'png_set_tRNS_to_alpha | 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_cv_c_inline=no
-for ac_kw in inline __inline__ __inline; do
-  cat > conftest.$ac_ext <<EOF
-#line 2286 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lpng  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2152 "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 png_set_tRNS_to_alpha();
 
 int main() {
-} $ac_kw foo() {
+png_set_tRNS_to_alpha()
 ; return 0; }
 EOF
-if { (eval echo configure:2293: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_c_inline=$ac_kw; break
+  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*
-done
+LIBS="$ac_save_LIBS"
 
 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
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -lpng"
+			 cat >> confdefs.h <<\EOF
+#define USE_PNG 1
 EOF
- ;;
-esac
 
-echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2319: checking for pid_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for png_set_gray_1_2_4_to_8 in -lpng""... $ac_c" 1>&6
+echo "configure:2186: checking for png_set_gray_1_2_4_to_8 in -lpng" >&5
+ac_lib_var=`echo png'_'png_set_gray_1_2_4_to_8 | 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
-  cat > conftest.$ac_ext <<EOF
-#line 2324 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lpng -lz $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2194 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
+/* 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 png_set_gray_1_2_4_to_8();
+
+int main() {
+png_set_gray_1_2_4_to_8()
+; return 0; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+if { (eval echo configure:2205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_type_pid_t=yes
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_type_pid_t=no
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 fi
-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
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -lpng -lz"
+			 cat >> confdefs.h <<\EOF
+#define USE_PNG 1
 EOF
 
-fi
-
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2352: 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 2357 "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 "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_size_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_size_t=no
+  echo "$ac_t""no" 1>&6
 fi
-rm -f conftest*
 
 fi
-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
-EOF
 
+		break
+	fi
+done
+
+# 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>&6
+echo "configure:2240: checking for X" >&5
+
+# Check whether --with-x or --without-x was given.
+if test "${with_x+set}" = set; then
+  withval="$with_x"
+  :
 fi
 
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2385: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+  # The user explicitly disabled X.
+  have_x=disabled
+else
+  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+    # Both variables are already set.
+    have_x=yes
+  else
+if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2390 "configure"
+  # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=NO ac_x_libraries=NO
+rm -fr conftestdir
+if mkdir conftestdir; then
+  cd conftestdir
+  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
+  cat > Imakefile <<'EOF'
+acfindx:
+	@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
+    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+    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) ;;
+	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
+    esac
+    case "$ac_im_usrlibdir" in
+	/usr/lib | /lib) ;;
+	*) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
+    esac
+  fi
+  cd ..
+  rm -fr conftestdir
+fi
+
+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 2302 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
+#include <$x_direct_test_include>
 EOF
-if { (eval echo configure:2399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2307: \"$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*
-  ac_cv_header_time=yes
+  # 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*
-  ac_cv_header_time=no
+  # 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/X386/include         \
+    /usr/x386/include         \
+    /usr/XFree86/include/X11  \
+                              \
+    /usr/include              \
+    /usr/local/include        \
+    /usr/unsupported/include  \
+    /usr/athena/include       \
+    /usr/local/x11r5/include  \
+    /usr/lpp/Xamples/include  \
+                              \
+    /usr/openwin/include      \
+    /usr/openwin/share/include \
+    ; \
+  do
+    if test -r "$ac_dir/$x_direct_test_include"; then
+      ac_x_includes=$ac_dir
+      break
+    fi
+  done
 fi
 rm -f conftest*
-fi
+fi # $ac_x_includes = NO
 
-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
-EOF
+if test "$ac_x_libraries" = NO; then
+  # Check for the libraries.
 
-fi
+  test -z "$x_direct_test_library" && x_direct_test_library=Xt
+  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
 
-echo $ac_n "checking for u_int""... $ac_c" 1>&6
-echo "configure:2420: 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 2425 "configure"
+  # 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 2376 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
+
+int main() {
+${x_direct_test_function}()
+; return 0; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])u_int[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_type_u_int=yes
+  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*
-  ac_cv_type_u_int=no
+  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/X386/lib         \
+    /usr/x386/lib         \
+    /usr/XFree86/lib/X11  \
+                          \
+    /usr/lib              \
+    /usr/local/lib        \
+    /usr/unsupported/lib  \
+    /usr/athena/lib       \
+    /usr/local/x11r5/lib  \
+    /usr/lpp/Xamples/lib  \
+    /lib/usr/lib/X11	  \
+                          \
+    /usr/openwin/lib      \
+    /usr/openwin/share/lib \
+    ; \
+do
+  for ac_extension in a so sl; do
+    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
+      ac_x_libraries=$ac_dir
+      break 2
+    fi
+  done
+done
 fi
 rm -f conftest*
+fi # $ac_x_libraries = NO
 
+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
-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
-EOF
+fi
+  fi
+  eval "$ac_cv_have_x"
+fi # $with_x != no
+
+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
+  # 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
 
+echo $ac_n "checking if --enable-gif option specified""... $ac_c" 1>&6
+echo "configure:2470: checking if --enable-gif option specified" >&5
+# Check whether --enable-gif or --disable-gif was given.
+if test "${enable_gif+set}" = set; then
+  enableval="$enable_gif"
+  mgp_gif="yes"
+else
+  mgp_gif="no"
 fi
 
-echo $ac_n "checking for u_char""... $ac_c" 1>&6
-echo "configure:2453: checking for u_char" >&5
-if eval "test \"`echo '$''{'ac_cv_type_u_char'+set}'`\" = set"; then
+echo "$ac_t""$mgp_gif" 1>&6
+if test $mgp_gif = "yes"; then
+	echo $ac_n "checking for DGifOpenFileHandle in -lungif""... $ac_c" 1>&6
+echo "configure:2482: checking for DGifOpenFileHandle in -lungif" >&5
+ac_lib_var=`echo ungif'_'DGifOpenFileHandle | 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
-  cat > conftest.$ac_ext <<EOF
-#line 2458 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lungif  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2490 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
+/* 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 DGifOpenFileHandle();
+
+int main() {
+DGifOpenFileHandle()
+; return 0; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])u_char[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+if { (eval echo configure:2501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_type_u_char=yes
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_type_u_char=no
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 fi
-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
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  gif_ok=yes
+		GIFLIB="-lungif"
+		cat >> confdefs.h <<\EOF
+#define USE_GIF 1
 EOF
 
-fi
-
-
-echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:2487: 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_clean=no
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for DGifOpenFileHandle in -lgif""... $ac_c" 1>&6
+echo "configure:2525: checking for DGifOpenFileHandle in -lgif" >&5
+ac_lib_var=`echo gif'_'DGifOpenFileHandle | 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
-  cat > conftest.$ac_ext <<EOF
-#line 2495 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lgif  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2533 "configure"
 #include "confdefs.h"
-
-main()
-{
-  char c0 = 0x40, c1 = 0x80, c2 = 0x81;
-  exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
-}
+/* 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 DGifOpenFileHandle();
 
+int main() {
+DGifOpenFileHandle()
+; return 0; }
 EOF
-if { (eval echo configure:2505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_func_memcmp_clean=yes
+if { (eval echo configure:2544: \"$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 -fr conftest*
-  ac_cv_func_memcmp_clean=no
-fi
-rm -fr conftest*
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 fi
-
-echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
-test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  gif_ok=yes
+		GIFLIB="-lgif"
+		cat >> confdefs.h <<\EOF
+#define USE_GIF 1
+EOF
 
-echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2523: checking return type of signal handlers" >&5
-if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for DGifOpenFileName in -lungif""... $ac_c" 1>&6
+echo "configure:2568: checking for DGifOpenFileName in -lungif" >&5
+ac_lib_var=`echo ungif'_'DGifOpenFileName | 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
-  cat > conftest.$ac_ext <<EOF
-#line 2528 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lungif -L$x_libraries -lX11 $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2576 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-#undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
+/* 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 DGifOpenFileName();
 
 int main() {
-int i;
+DGifOpenFileName()
 ; return 0; }
 EOF
-if { (eval echo configure:2545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_type_signal=void
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_type_signal=int
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-echo "$ac_t""$ac_cv_type_signal" 1>&6
-cat >> confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  gif_ok=yes
+		GIFLIB="-lungif"
+		cat >> confdefs.h <<\EOF
+#define USE_GIF 1
 EOF
 
-
-for ac_func in poll strstr _setbufend
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2566: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for DGifOpenFilename in -lgif""... $ac_c" 1>&6
+echo "configure:2611: checking for DGifOpenFilename in -lgif" >&5
+ac_lib_var=`echo gif'_'DGifOpenFilename | 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
-  cat > conftest.$ac_ext <<EOF
-#line 2571 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lgif -L$x_libraries -lX11 $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2619 "configure"
 #include "confdefs.h"
-/* 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.  */
 /* 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();
+char DGifOpenFilename();
 
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+DGifOpenFilename()
 ; return 0; }
 EOF
-if { (eval echo configure:2594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2630: \"$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"
+  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_func_$ac_func=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   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
+  gif_ok=yes
+		GIFLIB="-lgif"
+		cat >> confdefs.h <<\EOF
+#define USE_GIF 1
 EOF
- 
+
 else
   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>&6
-echo "configure:2621: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+fi
+
+fi
+
+fi
+
+	if test "x$gif_ok" != "xyes"; then
+		echo 'FATAL: You need libungif to use gif images.  pass proper LIBS to configure.'
+		exit 1
+	fi
+	for i in /usr/pkg /usr/local /usr; do
+		if test -f $i/include/gif_lib.h; then
+			gif_h_ok=yes
+			OPTFLAGS="$OPTFLAGS -I$i/include"
+			break
+		fi
+	done
+	if test -f /usr/include/gif_lib.h; then
+		gif_h_ok=yes
+	fi
+	if test "x$gif_h_ok" != "xyes"; then
+		echo 'FATAL: can not find gif_lib.h.  pass proper CPPFLAGS to configure.'
+		exit 1
+	fi
+fi
+
+USE_IMLIB=0
+
+echo $ac_n "checking if --enable-imlib option specified""... $ac_c" 1>&6
+echo "configure:2684: checking if --enable-imlib option specified" >&5
+# Check whether --enable-imlib or --disable-imlib was given.
+if test "${enable_imlib+set}" = set; then
+  enableval="$enable_imlib"
+  mgp_imlib="yes"
+else
+  mgp_imlib="no"
+fi
+
+echo "$ac_t""$mgp_imlib" 1>&6
+if test $mgp_imlib = "yes"; then
+	echo $ac_n "checking for Imlib_init in -lImlib""... $ac_c" 1>&6
+echo "configure:2696: checking for Imlib_init in -lImlib" >&5
+ac_lib_var=`echo Imlib'_'Imlib_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
-  cat > conftest.$ac_ext <<EOF
-#line 2626 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lImlib -L$x_libraries -lX11 -lXext $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2704 "configure"
 #include "confdefs.h"
-/* 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.  */
 /* 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();
+char Imlib_init();
 
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+Imlib_init()
 ; return 0; }
 EOF
-if { (eval echo configure:2649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2715: \"$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"
+  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_func_$ac_func=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   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
+  imlib_ok=yes
+		LIBS="$LIBS -lImlib"
+		cat >> confdefs.h <<\EOF
+#define USE_IMLIB 1
 EOF
- 
+
+		USE_IMLIB=1
 else
   echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
 fi
-done
-
 
+	if test "x$imlib_ok" != "xyes"; then
+		echo 'FATAL: You need libImlib to use Imlib loading.  pass proper LIBS to configure.'
+		exit 1
+	fi
+	for i in /usr/pkg /usr/local; do
+		if test -f $i/include/Imlib.h; then
+			imlib_h_ok=yes
+			OPTFLAGS="$OPTFLAGS -I$i/include"
+			break
+		fi
+	done
+	if test -f /usr/include/Imlib.h; then
+		imlib_h_ok=yes
+	fi
+	if test "x$imlib_h_ok" != "xyes"; then
+		echo 'FATAL: can not find Imlib.h.  pass proper CPPFLAGS to configure.'
+		exit 1
+	fi
+fi
 
 if test -n "$GIFLIB"; then
 	LIBS="$LIBS $GIFLIB"
@@ -2842,8 +2927,9 @@
 s%@mgp_cv_path_gunzip@%$mgp_cv_path_gunzip%g
 s%@OPTFLAGS@%$OPTFLAGS%g
 s%@DEPLIBS@%$DEPLIBS%g
-s%@mgp_cv_vflib_a@%$mgp_cv_vflib_a%g
 s%@LIBOBJS@%$LIBOBJS%g
+s%@mgp_cv_vflib_a@%$mgp_cv_vflib_a%g
+s%@USE_IMLIB@%$USE_IMLIB%g
 s%@mgp_keywords@%$mgp_keywords%g
 
 CEOF
Index: kit/configure.in
diff -u kit/configure.in:1.77 kit/configure.in:1.78
--- kit/configure.in:1.77	Tue Dec  5 00:04:22 2000
+++ kit/configure.in	Thu Jan 18 18:07:14 2001
@@ -3,7 +3,7 @@
 dnl independent (using srcdir), however, xmkmf and Imake.tmpl do not
 dnl allow us to switch compilation directory.
 dnl
-dnl $Id: configure.in,v 1.77 2000/12/04 15:04:22 nishida Exp $
+dnl $Id: configure.in,v 1.78 2001/01/18 09:07:14 nishida Exp $
 AC_INIT(image/imagetypes.c)
 
 dnl Checks for programs.
@@ -54,6 +54,25 @@
 	[mgp_locale="no"])
 AC_MSG_RESULT($mgp_locale)
 
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(fcntl.h strings.h sys/file.h unistd.h sys/time.h sys/select.h stdarg.h varargs.h termios.h locale.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+AC_CHECK_TYPE(u_int, unsigned int)
+AC_CHECK_TYPE(u_char, unsigned char)
+
+dnl Checks for library functions.
+AC_FUNC_MEMCMP
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS(poll strstr _setbufend)
+AC_REPLACE_FUNCS(usleep strsep strdup mkstemp snprintf memcmp)
+
 dnl Checks for libraries.
 LIBS="-lm $LIBS"
 
@@ -283,30 +302,49 @@
 			break
 		fi
 	done
+	if test -f /usr/include/gif_lib.h; then
+		gif_h_ok=yes
+	fi
 	if test "x$gif_h_ok" != "xyes"; then
 		echo 'FATAL: can not find gif_lib.h.  pass proper CPPFLAGS to configure.'
 		exit 1
 	fi
 fi
-
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h strings.h sys/file.h unistd.h sys/time.h sys/select.h stdarg.h varargs.h termios.h locale.h)
 
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_INLINE
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_CHECK_TYPE(u_int, unsigned int)
-AC_CHECK_TYPE(u_char, unsigned char)
-
-dnl Checks for library functions.
-AC_FUNC_MEMCMP
-AC_TYPE_SIGNAL
-AC_CHECK_FUNCS(poll strstr _setbufend)
-AC_REPLACE_FUNCS(usleep strsep strdup mkstemp snprintf memcmp)
+USE_IMLIB=0
+AC_SUBST(USE_IMLIB)
+AC_MSG_CHECKING(if --enable-imlib option specified)
+AC_ARG_ENABLE(imlib,
+	[  --enable-imlib          use imlib exclusively to load images.],
+	[mgp_imlib="yes"],
+	[mgp_imlib="no"])
+AC_MSG_RESULT($mgp_imlib)
+if test $mgp_imlib = "yes"; then
+	AC_CHECK_LIB(Imlib, Imlib_init,
+		[imlib_ok=yes
+		LIBS="$LIBS -lImlib"
+		AC_DEFINE(USE_IMLIB)
+		USE_IMLIB=1],
+		[], [-L$x_libraries -lX11 -lXext])
+	if test "x$imlib_ok" != "xyes"; then
+		echo 'FATAL: You need libImlib to use Imlib loading.  pass proper LIBS to configure.'
+		exit 1
+	fi
+	for i in /usr/pkg /usr/local; do
+		if test -f $i/include/Imlib.h; then
+			imlib_h_ok=yes
+			OPTFLAGS="$OPTFLAGS -I$i/include"
+			break
+		fi
+	done
+	if test -f /usr/include/Imlib.h; then
+		imlib_h_ok=yes
+	fi
+	if test "x$imlib_h_ok" != "xyes"; then
+		echo 'FATAL: can not find Imlib.h.  pass proper CPPFLAGS to configure.'
+		exit 1
+	fi
+fi
 
 dnl add GIFLIB to LIBS
 if test -n "$GIFLIB"; then
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 Jan 22 05:10:01 2001
@@ -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/image/Imakefile.in
diff -u kit/image/Imakefile.in:1.10 kit/image/Imakefile.in:1.11
--- kit/image/Imakefile.in:1.10	Thu Mar  2 01:01:49 2000
+++ kit/image/Imakefile.in	Thu Jan 18 18:07:14 2001
@@ -1,5 +1,14 @@
 TARGET0=	mgpimage
 TARGET=	lib$(TARGET0).a
+#if @USE_IMLIB@
+SRCS=	imagetypes.c send.c zio.c zoom.c new.c compress.c reduce.c\
+	value.c misc.c rotate.c rle.c rlelib.c smooth.c halftone.c clip.c\
+	dither.c path.c bright.c window.c imlib_loader.c
+
+OBJS=	imagetypes.o send.o zio.o zoom.o new.o compress.o reduce.o\
+	value.o misc.o rotate.o rle.o rlelib.o smooth.o halftone.o clip.o\
+	dither.o path.o bright.o window.o imlib_loader.o
+#else
 SRCS=	imagetypes.c gif.c send.c zio.c zoom.c new.c compress.c reduce.c\
 	value.c misc.c rotate.c rle.c rlelib.c smooth.c halftone.c clip.c\
 	dither.c xbitmap.c xpixmap.c pbm.c pcx.c xwd.c mac.c jpeg.c g3.c\
@@ -11,6 +20,7 @@
 	dither.o xbitmap.o xpixmap.o pbm.o pcx.o xwd.o mac.o jpeg.o g3.o\
 	path.o sunraster.o mcidas.o fbm.o faces.o cmuwmraster.o bright.o\
 	img.o mc_tables.o window.o png.o
+#endif
 
 DEFS=	@DEFS@
 OPTFLAGS=@OPTFLAGS@
@@ -21,6 +31,7 @@
 SpecialObjectRule(gif.o,gif.c,$(DEFS) $(OPTFLAGS))
 SpecialObjectRule(imagetypes.o,imagetypes.c,$(DEFS))
 #SpecialObjectRule(png.o,png.c,$(DEFS) $(OPTFLAGS))
+SpecialObjectRule(imlib_loader.o,imlib_loader.c,$(DEFS))
 
 #ifndef NullParameter
 #define  NullParameter 
Index: kit/image/gif.h
diff -u kit/image/gif.h:1.2 kit/image/gif.h:removed
--- kit/image/gif.h:1.2	Mon Dec 28 17:23:03 1998
+++ kit/image/gif.h	Mon Jan 22 05:10:02 2001
@@ -1,72 +0,0 @@
-/* gif.h:
- *
- * gifin.h
- * kirk johnson
- * november 1989
- * external interface to gifin.c
- *
- * Copyright 1989 Kirk L. Johnson (see the included file
- * "kljcpyrght.h" for complete copyright information)
- */
-
-/*
- * gifin return codes
- */
-#define GIFIN_SUCCESS       0   /* success */
-#define GIFIN_DONE          1   /* no more images */
-
-#define GIFIN_ERR_BAD_SD   -1   /* bad screen descriptor */
-#define GIFIN_ERR_BAD_SEP  -2   /* bad image separator */
-#define GIFIN_ERR_BAD_SIG  -3   /* bad signature */
-#define GIFIN_ERR_EOD      -4   /* unexpected end of raster data */
-#define GIFIN_ERR_EOF      -5   /* unexpected end of input stream */
-#define GIFIN_ERR_FAO      -6   /* file already open */
-#define GIFIN_ERR_IAO      -7   /* image already open */
-#define GIFIN_ERR_NFO      -8   /* no file open */
-#define GIFIN_ERR_NIO      -9   /* no image open */
-
-/*
- * colormap indices 
- */
-
-#define GIF_RED  0
-#define GIF_GRN  1
-#define GIF_BLU  2
-
-/*
- * typedef BYTE for convenience
- */
-
-typedef unsigned char BYTE;
-
-static int gifin_open_file();
-static int gifin_open_image();
-static int gifin_get_pixel();
-#if 0
-static int gifin_close_image();
-#endif
-static int gifin_close_file();
-static int gifin_load_cmap();
-static int gifin_skip_extension();
-static int gifin_read_data_block();
-static int gifin_push_string();
-static void gifin_add_string();
-static void gifin_fatal();
-
-/* #defines, typedefs, and such
- */
-
-#define GIF_SIG      "GIF87a"
-#define GIF_SIG_89   "GIF89a"
-#define GIF_SIG_LEN  6          /* GIF signature length */
-#define GIF_SD_SIZE  7          /* GIF screen descriptor size */
-#define GIF_ID_SIZE  9          /* GIF image descriptor size */
-
-#define GIF_SEPARATOR   ','     /* GIF image separator */
-#define GIF_EXTENSION   '!'     /* GIF extension block marker */
-#define GIF_TERMINATOR  ';'     /* GIF terminator */
-
-#define STAB_SIZE  4096         /* string table size */
-#define PSTK_SIZE  4096         /* pixel stack size */
-
-#define NULL_CODE  -1           /* string table null code */
Index: kit/image/imagetypes.c
diff -u kit/image/imagetypes.c:1.6 kit/image/imagetypes.c:1.7
--- kit/image/imagetypes.c:1.6	Thu Mar  2 01:01:50 2000
+++ kit/image/imagetypes.c	Thu Jan 18 18:07:14 2001
@@ -21,6 +21,9 @@
   Image *(*loader)();     /* load image if this kind of image */
   char  *name;            /* name of this image format */
 } ImageTypes[] = {
+#ifdef USE_IMLIB
+  { imIdent,        imLoad,        "Imlib" },
+#else
   { fbmIdent,       fbmLoad,       "FBM Image" },
   { sunRasterIdent, sunRasterLoad, "Sun Rasterfile" },
   { cmuwmIdent,     cmuwmLoad,     "CMU WM Raster" },
@@ -42,6 +45,7 @@
   { macIdent,       macLoad,       "MacPaint Image" },
   { xpixmapIdent,   xpixmapLoad,   "X Pixmap" },
   { xbitmapIdent,   xbitmapLoad,   "X Bitmap" },
+#endif
   { NULL,           NULL,          NULL }
 };
 /* SUPPRESS 560 */
Index: kit/image/imagetypes.h
diff -u kit/image/imagetypes.h:1.4 kit/image/imagetypes.h:1.5
--- kit/image/imagetypes.h:1.4	Thu Mar  2 01:01:51 2000
+++ kit/image/imagetypes.h	Thu Jan 18 18:07:14 2001
@@ -23,6 +23,7 @@
 Image *cmuwmLoad();
 Image *mcidasLoad();
 Image *jpegLoad();
+Image *imLoad();
 
 int facesIdent();
 int pbmIdent();
@@ -40,6 +41,7 @@
 int cmuwmIdent();
 int mcidasIdent();
 int jpegIdent();
+int imIdent();
 #ifdef USE_PNG
 int pngIdent();
 int pngLoad();
Index: kit/image/imlib_loader.c
diff -u /dev/null kit/image/imlib_loader.c:1.1
--- /dev/null	Mon Jan 22 05:10:02 2001
+++ kit/image/imlib_loader.c	Thu Jan 18 18:07:14 2001
@@ -0,0 +1,51 @@
+
+#ifdef USE_IMLIB
+
+#include "image.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/shape.h>
+#include <Imlib.h>
+
+int imIdent(char *fullname, char *name)
+{
+	return 1;
+}
+
+Image *imLoad(char *fullname, char *name, unsigned int verbose)
+{
+	static Display *disp = NULL;
+	Image *image;
+	ImlibData *id;
+	ImlibImage *im;
+	ImlibColor shape;
+	unsigned int w,h, size;
+
+	if (disp == NULL) {
+		disp=XOpenDisplay(NULL);
+	}
+	id=Imlib_init(disp);
+	im=Imlib_load_image(id, fullname);
+	if (im == NULL) {
+		return NULL;
+	}
+	w = im->rgb_width;
+	h = im->rgb_height;
+	size = w * h * 3;
+
+	image = newTrueImage(w, h);
+	memcpy(image->data, im->rgb_data, size);
+	
+	Imlib_get_image_shape(id, im, &shape);
+	image->trans = \
+		((shape.r & 0xff) << 16) |
+		((shape.g & 0xff) <<  8) |
+		((shape.b & 0xff) <<  0);
+
+	image->title = dupString(name);
+	
+	return image;
+}
+
+#endif
Index: kit/sample/cloud.gif
Index: kit/sample/dad.gif
Index: kit/sample/mgp-old1.gif
Index: kit/sample/mgp-old2.gif
Index: kit/sample/mgp-old3.gif
Index: kit/sample/mgp1.gif
Index: kit/sample/mgp2.gif
Index: kit/sample/mgp3.gif
Index: kit/sample/v6header.gif
