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 Mar 10 05:10:01 2003
@@ -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.87 kit/configure:1.88
--- kit/configure:1.87	Mon Feb 17 14:25:22 2003
+++ kit/configure	Tue Mar  4 08:22:59 2003
@@ -832,7 +832,7 @@
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-debug          compile debugging information in.
   --enable-locale         perform setlocale() on invocation.
-  --disable-freetype      DON'T use freetype routines.
+  --disable-freetype      DON'T use freetype1 routines.
   --disable-xft2           DON'T use xft2 libraries.
   --disable-vflib         DON'T use vflib routines.
   --enable-freetype-charset16         use freetype for chaset16.
@@ -2837,27 +2837,33 @@
 OPTFLAGS="$OPTFLAGS -DUUDECODE=\\\"$mgp_cv_path_uudecode\\\""
 OPTFLAGS="$OPTFLAGS -DGUNZIP=\\\"$mgp_cv_path_gunzip\\\""
 
-echo "$as_me:$LINENO: checking if --enable-debug option specified" >&5
-echo $ECHO_N "checking if --enable-debug option specified... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if debugging is enabled" >&5
+echo $ECHO_N "checking if debugging is enabled... $ECHO_C" >&6
 # Check whether --enable-debug or --disable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval="$enable_debug"
-  mgp_debug="yes"; OPTFLAGS="$OPTFLAGS -g -DDEBUG -Wall"
+  mgp_debug="$enableval"
 else
   mgp_debug="no"
 fi;
+if test "$mgp_debug" = "yes"; then
+  OPTFLAGS="$OPTFLAGS -g -DDEBUG -Wall"
+fi
 echo "$as_me:$LINENO: result: $mgp_debug" >&5
 echo "${ECHO_T}$mgp_debug" >&6
 
-echo "$as_me:$LINENO: checking if --enable-locale option specified" >&5
-echo $ECHO_N "checking if --enable-locale option specified... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if setlocale() should be used" >&5
+echo $ECHO_N "checking if setlocale() should be used... $ECHO_C" >&6
 # Check whether --enable-locale or --disable-locale was given.
 if test "${enable_locale+set}" = set; then
   enableval="$enable_locale"
-  mgp_locale="yes"; OPTFLAGS="$OPTFLAGS -DUSE_SETLOCALE"
+  mgp_locale="$enableval"
 else
   mgp_locale="no"
 fi;
+if test $mgp_locale = "yes"; then
+  OPTFLAGS="$OPTFLAGS -DUSE_SETLOCALE"
+fi
 echo "$as_me:$LINENO: result: $mgp_locale" >&5
 echo "${ECHO_T}$mgp_locale" >&6
 
@@ -4086,21 +4092,22 @@
 
 LIBS="-lm $LIBS"
 
-echo "$as_me:$LINENO: checking if --disable-freetype option specified" >&5
-echo $ECHO_N "checking if --disable-freetype option specified... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if freetype1 is used" >&5
+echo $ECHO_N "checking if freetype1 is used... $ECHO_C" >&6
 # 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"
+  mgp_use_freetype="$enableval"
 else
-  mgp_skip_freetype="no"; mgp_use_freetype="yes"
+  mgp_use_freetype="yes"
 fi;
-echo "$as_me:$LINENO: result: $mgp_skip_freetype" >&5
-echo "${ECHO_T}$mgp_skip_freetype" >&6
+echo "$as_me:$LINENO: result: $mgp_use_freetype" >&5
+echo "${ECHO_T}$mgp_use_freetype" >&6
 
 if test "$mgp_use_freetype" = "yes"; then
- 	echo "$as_me:$LINENO: checking for freetype library/header" >&5
-echo $ECHO_N "checking for freetype library/header... $ECHO_C" >&6
+  # XXX: freetype2 may use freetype-config
+ 	echo "$as_me:$LINENO: checking for freetype1 library/header" >&5
+echo $ECHO_N "checking for freetype1 library/header... $ECHO_C" >&6
  	for dir in /usr/local/freetype /usr/local /opt/freetype /usr/pkg /usr; do
  		ac_cv_ft_lib=no
  		ac_cv_ft_include=no
@@ -4134,11 +4141,10 @@
  		echo "$as_me:$LINENO: result: $ac_cv_ft_lib and $ac_cv_ft_include" >&5
 echo "${ECHO_T}$ac_cv_ft_lib and $ac_cv_ft_include" >&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"
+        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 "$as_me:$LINENO: checking for dgettext in -lintl" >&5
 echo $ECHO_N "checking for dgettext in -lintl... $ECHO_C" >&6
@@ -4272,7 +4278,7 @@
 		exit 1
 fi
 
- 	cat >conftest.$ac_ext <<_ACEOF
+ 	  cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
 #include <freetype.h>
@@ -4310,13 +4316,13 @@
  		exit 1
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
- 	cat >>confdefs.h <<\_ACEOF
+ 	  cat >>confdefs.h <<\_ACEOF
 #define FREETYPE 1
 _ACEOF
 
-	echo "$as_me:$LINENO: checking for num_CharMaps field in TT_Face_Properties" >&5
+	  echo "$as_me:$LINENO: checking for num_CharMaps field in TT_Face_Properties" >&5
 echo $ECHO_N "checking for num_CharMaps field in TT_Face_Properties... $ECHO_C" >&6
- 	cat >conftest.$ac_ext <<_ACEOF
+ 	  cat >conftest.$ac_ext <<_ACEOF
 #line $LINENO "configure"
 #include "confdefs.h"
 #include <freetype.h>
@@ -4356,22 +4362,33 @@
 result=no
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
-	echo "$as_me:$LINENO: result: $result" >&5
+	  echo "$as_me:$LINENO: result: $result" >&5
 echo "${ECHO_T}$result" >&6
+       fi
 fi
 
-echo "$as_me:$LINENO: checking if --disable-xft2 option specified" >&5
-echo $ECHO_N "checking if --disable-xft2 option specified... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if Xft2 is used" >&5
+echo $ECHO_N "checking if Xft2 is used... $ECHO_C" >&6
 # Check whether --enable-xft2 or --disable-xft2 was given.
 if test "${enable_xft2+set}" = set; then
   enableval="$enable_xft2"
-  mgp_skip_xft2="yes"; mgp_use_xft2="no"
+  mgp_use_xft2="$enableval"
 else
-  mgp_skip_xft2="no"; mgp_use_xft2="yes"
+  mgp_use_xft2="yes"
 fi;
-echo "$as_me:$LINENO: result: $mgp_skip_xft2" >&5
-echo "${ECHO_T}$mgp_skip_xft2" >&6
+echo "$as_me:$LINENO: result: $mgp_use_xft2" >&5
+echo "${ECHO_T}$mgp_use_xft2" >&6
 if test "$mgp_use_xft2" = "yes"; then
+  if type pkg-config > /dev/null 2>&1; then
+     if pkg-config xft; then
+        OPTFLAGS="`pkg-config --cflags xft` $OPTFLAGS"
+        LIBS="$LIBS `pkg-config --libs xft`"
+        cat >>confdefs.h <<\_ACEOF
+#define USE_XFT2 1
+_ACEOF
+
+     fi
+  else
 	echo "$as_me:$LINENO: checking for xft2 and ft2 and fc header.." >&5
 echo $ECHO_N "checking for xft2 and ft2 and fc header..... $ECHO_C" >&6
 	for dir in /usr/include /usr/include/Xft2 /usr/X11R6/include \
@@ -4403,11 +4420,10 @@
 			OPTFLAGS="-I$ac_cv_fc_hdrdir $OPTFLAGS"
 		fi
 	fi
-fi
-if test "$mgp_use_xft2" = "yes"; then
-	echo "$as_me:$LINENO: checking for xft2 library.." >&5
+        if test "$mgp_use_xft2" = "yes"; then
+  	  echo "$as_me:$LINENO: checking for xft2 library.." >&5
 echo $ECHO_N "checking for xft2 library..... $ECHO_C" >&6
-	echo "$as_me:$LINENO: checking for XftFontOpen in -lXft2" >&5
+	  echo "$as_me:$LINENO: checking for XftFontOpen in -lXft2" >&5
 echo $ECHO_N "checking for XftFontOpen in -lXft2... $ECHO_C" >&6
 if test "${ac_cv_lib_Xft2_XftFontOpen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4470,6 +4486,8 @@
 
 fi
 
+        fi
+  fi
 fi
 if test "$mgp_use_xft2" = "yes"; then
 	echo "$as_me:$LINENO: checking for iconv.." >&5
@@ -4610,17 +4628,17 @@
 
 fi
 
-echo "$as_me:$LINENO: checking if --disable-vflib option specified" >&5
-echo $ECHO_N "checking if --disable-vflib option specified... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if vflib is used" >&5
+echo $ECHO_N "checking if vflib is used... $ECHO_C" >&6
 # 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"
+  mgp_use_vflib="$enableval"
 else
-  mgp_skip_vflib="no"; mgp_use_vflib="yes"
+  mgp_use_vflib="yes"
 fi;
-echo "$as_me:$LINENO: result: $mgp_skip_vflib" >&5
-echo "${ECHO_T}$mgp_skip_vflib" >&6
+echo "$as_me:$LINENO: result: $mgp_use_vflib" >&5
+echo "${ECHO_T}$mgp_use_vflib" >&6
 
 if test "$mgp_use_vflib" = "yes"; then
 	echo "$as_me:$LINENO: checking for VFlib library/header" >&5
@@ -4819,12 +4837,12 @@
 fi
 
 if test "$mgp_use_freetype" = "yes"; then
-	echo "$as_me:$LINENO: checking if --enable-freetype-charset16 option specified" >&5
-echo $ECHO_N "checking if --enable-freetype-charset16 option specified... $ECHO_C" >&6
+	echo "$as_me:$LINENO: checking if freetype-charset16 is enabled" >&5
+echo $ECHO_N "checking if freetype-charset16 is enabled... $ECHO_C" >&6
 	# 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"
+  mgp_use_freetype_c16="$enableval"
 else
   mgp_use_freetype_c16="no"
 fi;
@@ -4839,7 +4857,17 @@
 	fi
 fi
 
-for i in /usr/pkg /usr/local /usr; do
+if type pkg-config > /dev/null 2>&1; then
+  if pkg-config libpng; then
+     LIBS="$LIBS `pkg-config --libs libpng`"
+     OPTFLAGS="$OPTFLAGS `pkg-config --cflags libpng`"
+     cat >>confdefs.h <<\_ACEOF
+#define USE_PNG 1
+_ACEOF
+
+  fi
+else
+  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"
@@ -4979,7 +5007,8 @@
 
 		break
 	fi
-done
+  done
+fi
 
 for i in /usr/pkg /usr/local /usr; do
 	if test -f $i/include/libmng.h; then
@@ -5343,12 +5372,12 @@
 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
 fi
 
-echo "$as_me:$LINENO: checking if --enable-gif option specified" >&5
-echo $ECHO_N "checking if --enable-gif option specified... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if gif handling is enabled" >&5
+echo $ECHO_N "checking if gif handling is enabled... $ECHO_C" >&6
 # Check whether --enable-gif or --disable-gif was given.
 if test "${enable_gif+set}" = set; then
   enableval="$enable_gif"
-  mgp_gif="yes"
+  mgp_gif="$enableval"
 else
   mgp_gif="no"
 fi;
@@ -5636,18 +5665,29 @@
 
 USE_IMLIB=0
 
-echo "$as_me:$LINENO: checking if --enable-imlib option specified" >&5
-echo $ECHO_N "checking if --enable-imlib option specified... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking if imlib is used" >&5
+echo $ECHO_N "checking if imlib is used... $ECHO_C" >&6
 # Check whether --enable-imlib or --disable-imlib was given.
 if test "${enable_imlib+set}" = set; then
   enableval="$enable_imlib"
-  mgp_imlib="yes"
+  mgp_imlib="$enableval"
 else
   mgp_imlib="no"
 fi;
 echo "$as_me:$LINENO: result: $mgp_imlib" >&5
 echo "${ECHO_T}$mgp_imlib" >&6
 if test $mgp_imlib = "yes"; then
+  if type pkg-config > /dev/null 2>&1; then
+     if pkg-config imlib; then
+        LIBS="$LIBS `pkg-config --libs imlib`"
+        OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`"
+	cat >>confdefs.h <<\_ACEOF
+#define USE_IMLIB 1
+_ACEOF
+
+	USE_IMLIB=1
+     fi
+  else
 	echo "$as_me:$LINENO: checking for Imlib_init in -lImlib" >&5
 echo $ECHO_N "checking for Imlib_init in -lImlib... $ECHO_C" >&6
 if test "${ac_cv_lib_Imlib_Imlib_init+set}" = set; then
@@ -5731,6 +5771,7 @@
 		echo 'FATAL: can not find Imlib.h.  pass proper CPPFLAGS to configure.'
 		exit 1
 	fi
+  fi
 fi
 
 if test -n "$GIFLIB"; then
Index: kit/configure.in
diff -u kit/configure.in:1.84 kit/configure.in:1.85
--- kit/configure.in:1.84	Mon Feb 17 14:25:22 2003
+++ kit/configure.in	Tue Mar  4 08:22:59 2003
@@ -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.84 2003/02/17 05:25:22 nishida Exp $
+dnl $Id: configure.in,v 1.85 2003/03/03 23:22:59 nishida Exp $
 AC_INIT(image/imagetypes.c)
 
 dnl Checks for programs.
@@ -39,19 +39,25 @@
 OPTFLAGS="$OPTFLAGS -DGUNZIP=\\\"$mgp_cv_path_gunzip\\\""
 
 dnl Checks for debugging option.
-AC_MSG_CHECKING(if --enable-debug option specified)
+AC_MSG_CHECKING(if debugging is enabled)
 AC_ARG_ENABLE(debug,
 	[  --enable-debug          compile debugging information in.],
-	[mgp_debug="yes"; OPTFLAGS="$OPTFLAGS -g -DDEBUG -Wall"],
+	[mgp_debug="$enableval"],
 	[mgp_debug="no"])
+if test "$mgp_debug" = "yes"; then
+  OPTFLAGS="$OPTFLAGS -g -DDEBUG -Wall"
+fi
 AC_MSG_RESULT($mgp_debug)
 
 dnl Checks for locale option.
-AC_MSG_CHECKING(if --enable-locale option specified)
+AC_MSG_CHECKING(if setlocale() should be used)
 AC_ARG_ENABLE(locale,
 	[  --enable-locale         perform setlocale() on invocation.],
-	[mgp_locale="yes"; OPTFLAGS="$OPTFLAGS -DUSE_SETLOCALE"],
+	[mgp_locale="$enableval"],
 	[mgp_locale="no"])
+if test $mgp_locale = "yes"; then
+  OPTFLAGS="$OPTFLAGS -DUSE_SETLOCALE"
+fi
 AC_MSG_RESULT($mgp_locale)
 
 AC_HEADER_STDC
@@ -76,15 +82,16 @@
 dnl Checks for libraries.
 LIBS="-lm $LIBS"
 
-AC_MSG_CHECKING(if --disable-freetype option specified)
+AC_MSG_CHECKING(if freetype1 is used)
 AC_ARG_ENABLE(freetype,
- 	[  --disable-freetype      DON'T use freetype routines.],
- 	[mgp_skip_freetype="yes"; mgp_use_freetype="no"],
- 	[mgp_skip_freetype="no"; mgp_use_freetype="yes"])
-AC_MSG_RESULT($mgp_skip_freetype)
+ 	[  --disable-freetype      DON'T use freetype1 routines.],
+ 	[mgp_use_freetype="$enableval"],
+ 	[mgp_use_freetype="yes"])
+AC_MSG_RESULT($mgp_use_freetype)
  
 if test "$mgp_use_freetype" = "yes"; then
- 	AC_MSG_CHECKING(for freetype library/header)
+  # XXX: freetype2 may use freetype-config
+ 	AC_MSG_CHECKING(for freetype1 library/header)
  	for dir in /usr/local/freetype /usr/local /opt/freetype /usr/pkg /usr; do
  		ac_cv_ft_lib=no
  		ac_cv_ft_include=no
@@ -116,34 +123,41 @@
  	else
  		AC_MSG_RESULT($ac_cv_ft_lib and $ac_cv_ft_include)
  	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"
-	AC_CHECK_LIB(intl, dgettext)
- 	AC_CHECK_LIB(ttf, TT_Init_FreeType, [],
+        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"
+	  AC_CHECK_LIB(intl, dgettext)
+ 	  AC_CHECK_LIB(ttf, TT_Init_FreeType, [],
 		[echo "Fatal: libttf.a not found"
 		exit 1])
- 	AC_TRY_COMPILE([#include <freetype.h>], [], [], [dnl
+ 	  AC_TRY_COMPILE([#include <freetype.h>], [], [], [dnl
  		echo "Fatal: freetype.h not found"
  		exit 1])
- 	AC_DEFINE(FREETYPE)
-	AC_MSG_CHECKING(for num_CharMaps field in TT_Face_Properties)
- 	AC_TRY_COMPILE([#include <freetype.h>],
+ 	  AC_DEFINE(FREETYPE)
+	  AC_MSG_CHECKING(for num_CharMaps field in TT_Face_Properties)
+ 	  AC_TRY_COMPILE([#include <freetype.h>],
 		[TT_Face_Properties x; return x.num_CharMaps;],
 		[result=yes; AC_DEFINE(HAVE_TT_FACE_PROPERTIES_CHARMAPS)],
 		[result=no])
-	AC_MSG_RESULT($result)
+	  AC_MSG_RESULT($result)
+       fi
 fi
 
-AC_MSG_CHECKING(if --disable-xft2 option specified)
+AC_MSG_CHECKING(if Xft2 is used)
 AC_ARG_ENABLE(xft2,
 	[  --disable-xft2           DON'T use xft2 libraries.],
-	[mgp_skip_xft2="yes"; mgp_use_xft2="no"],
-	[mgp_skip_xft2="no"; mgp_use_xft2="yes"])
-AC_MSG_RESULT($mgp_skip_xft2)
+	[mgp_use_xft2="$enableval"],
+	[mgp_use_xft2="yes"])
+AC_MSG_RESULT($mgp_use_xft2)
 if test "$mgp_use_xft2" = "yes"; then
+  if type pkg-config > /dev/null 2>&1; then
+     if pkg-config xft; then
+        OPTFLAGS="`pkg-config --cflags xft` $OPTFLAGS"
+        LIBS="$LIBS `pkg-config --libs xft`"
+        AC_DEFINE(USE_XFT2)
+     fi
+  else
 	AC_MSG_CHECKING(for xft2 and ft2 and fc header..)
 	for dir in /usr/include /usr/include/Xft2 /usr/X11R6/include \
 					/usr/local/include /usr/include/freetype2; do
@@ -172,12 +186,13 @@
 			OPTFLAGS="-I$ac_cv_fc_hdrdir $OPTFLAGS"
 		fi
 	fi
-fi
-if test "$mgp_use_xft2" = "yes"; then
-	AC_MSG_CHECKING(for xft2 library..)
-	AC_CHECK_LIB(Xft2, XftFontOpen, 
-		[LIBS="$LIBS -lXft2 -lfontconfig"
+        if test "$mgp_use_xft2" = "yes"; then
+  	  AC_MSG_CHECKING(for xft2 library..)
+	  AC_CHECK_LIB(Xft, XftFontOpen, 
+		[LIBS="$LIBS -lXft -lfontconfig"
 		 AC_DEFINE(USE_XFT2)], [], [-lfontconfig])
+        fi
+  fi
 fi
 if test "$mgp_use_xft2" = "yes"; then
 	AC_MSG_CHECKING(for iconv..)
@@ -185,12 +200,12 @@
 	[AC_CHECK_LIB(iconv, iconv_open, [AC_DEFINE(HAVE_ICONV)])])
 fi
 
-AC_MSG_CHECKING(if --disable-vflib option specified)
+AC_MSG_CHECKING(if vflib is used)
 AC_ARG_ENABLE(vflib,
 	[  --disable-vflib         DON'T use vflib routines.],
-	[mgp_skip_vflib="yes"; mgp_use_vflib="no"],
-	[mgp_skip_vflib="no"; mgp_use_vflib="yes"])
-AC_MSG_RESULT($mgp_skip_vflib)
+	[mgp_use_vflib="$enableval"],
+	[mgp_use_vflib="yes"])
+AC_MSG_RESULT($mgp_use_vflib)
 
 if test "$mgp_use_vflib" = "yes"; then
 	AC_MSG_CHECKING(for VFlib library/header)
@@ -279,10 +294,10 @@
 fi
 
 if test "$mgp_use_freetype" = "yes"; then
-	AC_MSG_CHECKING(if --enable-freetype-charset16 option specified)
+	AC_MSG_CHECKING(if freetype-charset16 is enabled)
 	AC_ARG_ENABLE(freetype-charset16,
 		[  --enable-freetype-charset16         use freetype for chaset16.],
-		[mgp_use_freetype_c16="yes"],
+		[mgp_use_freetype_c16="$enableval"],
 		[mgp_use_freetype_c16="no"])
 	AC_MSG_RESULT($mgp_use_freetype_c16)
 
@@ -291,7 +306,14 @@
 	fi
 fi
 
-for i in /usr/pkg /usr/local /usr; do
+if type pkg-config > /dev/null 2>&1; then
+  if pkg-config libpng; then
+     LIBS="$LIBS `pkg-config --libs libpng`"
+     OPTFLAGS="$OPTFLAGS `pkg-config --cflags libpng`"
+     AC_DEFINE(USE_PNG)
+  fi
+else
+  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"
@@ -311,7 +333,8 @@
 			[], [-lz])])
 		break
 	fi
-done
+  done
+fi
 
 for i in /usr/pkg /usr/local /usr; do
 	if test -f $i/include/libmng.h; then 
@@ -337,10 +360,10 @@
 
 dnl Checks for header files.
 AC_PATH_X
-AC_MSG_CHECKING(if --enable-gif option specified)
+AC_MSG_CHECKING(if gif handling is enabled)
 AC_ARG_ENABLE(gif,
 	[  --enable-gif            compile gif support in (need libungif).],
-	[mgp_gif="yes"],
+	[mgp_gif="$enableval"],
 	[mgp_gif="no"])
 AC_MSG_RESULT($mgp_gif)
 if test $mgp_gif = "yes"; then
@@ -383,13 +406,21 @@
 
 USE_IMLIB=0
 AC_SUBST(USE_IMLIB)
-AC_MSG_CHECKING(if --enable-imlib option specified)
+AC_MSG_CHECKING(if imlib is used)
 AC_ARG_ENABLE(imlib,
 	[  --enable-imlib          use imlib exclusively to load images.],
-	[mgp_imlib="yes"],
+	[mgp_imlib="$enableval"],
 	[mgp_imlib="no"])
 AC_MSG_RESULT($mgp_imlib)
 if test $mgp_imlib = "yes"; then
+  if type pkg-config > /dev/null 2>&1; then
+     if pkg-config imlib; then
+        LIBS="$LIBS `pkg-config --libs imlib`"
+        OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`"
+	AC_DEFINE(USE_IMLIB)
+	USE_IMLIB=1
+     fi
+  else
 	AC_CHECK_LIB(Imlib, Imlib_init,
 		[imlib_ok=yes
 		LIBS="$LIBS -lImlib"
@@ -414,6 +445,7 @@
 		echo 'FATAL: can not find Imlib.h.  pass proper CPPFLAGS to configure.'
 		exit 1
 	fi
+  fi
 fi
 
 dnl add GIFLIB to LIBS
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 Mar 10 05:10:01 2003
@@ -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/draw.c
diff -u kit/draw.c:1.199 kit/draw.c:1.200
--- kit/draw.c:1.199	Mon Feb 17 14:25:22 2003
+++ kit/draw.c	Wed Mar  5 05:00:52 2003
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: draw.c,v 1.199 2003/02/17 05:25:22 nishida Exp $
+ * $Id: draw.c,v 1.200 2003/03/04 20:00:52 nishida Exp $
  */
 
 #include "mgp.h"
@@ -1465,10 +1465,12 @@
 		if (obj->data.icon.xpoint)
 			free(obj->data.icon.xpoint);
 		break;
+#ifdef USE_XFT2
 	case O_XTFONT:
 		if (obj->data.xftfont.data)
 			free(obj->data.xftfont.data);
 		break;
+#endif
 #ifdef MNG
 	case O_ANIM:
 		break;
@@ -2092,6 +2094,7 @@
 		case O_IMAGE:
 			obj_draw_image(target, x, y, obj);
 			break;
+#ifdef USE_XFT2
 		case O_XTFONT:
 			set_xrender_color(obj->fore);
 			if (xft_font) XftFontClose(display, xft_font);
@@ -2104,6 +2107,7 @@
 				XftDrawString8(xft_getdraw(target), &xft_forecolor, xft_font, 
 						x, y, obj->data.xftfont.data, obj->data.xftfont.len);
 			break;
+#endif
 		case O_XFONT:
 			code = obj->data.xfont.code;
 			registry = obj->data.xfont.registry;
Index: kit/mgp.c
diff -u kit/mgp.c:1.123 kit/mgp.c:1.125
--- kit/mgp.c:1.123	Thu Dec  6 10:42:59 2001
+++ kit/mgp.c	Tue Mar  4 08:48:28 2003
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.c,v 1.123 2001/12/06 01:42:59 itojun Exp $
+ * $Id: mgp.c,v 1.125 2003/03/03 23:48:28 nishida Exp $
  */
 
 static char *mgp_version = "1.09a (20010927)";
@@ -452,7 +452,7 @@
 	FILE *txt;
 	int page;
 	char *childdebug;
-	char convdb[][3][16] = {{ "jpg", "cjpeg", "djpeg" },
+	char *convdb[][3] = {{ "jpg", "cjpeg", "djpeg" },
 				{ "png", "pnmtopng", "pngtopnm" },
 				{ NULL, NULL, NULL }};
 	int inum = 0;
@@ -465,6 +465,12 @@
 		}
 		if (*convdb[inum] == NULL) {
 			fprintf(stderr, "unknwon image type %s.\n", htmlimage);
+			/* print out valid image types */
+			fprintf(stderr, "Valid image types: ");
+			for (inum = 0; *convdb[inum] != 0; inum++) {
+				fprintf(stderr, "%s ", *convdb[inum] );
+			}
+			fprintf(stderr,"\n");
 			cleanup(-1);
 		}
 	}
@@ -669,6 +675,7 @@
 	fprintf(stderr, "\t-B: Ignore background image\n");
 	fprintf(stderr, "\t-C: Use private colormap\n");
 	fprintf(stderr, "\t-D <dir>: Generate html pages for the presentation\n");
+	fprintf(stderr, "\t-E <name>: Use this image format in html (jpg or png)\n");
 	fprintf(stderr, "\t-F<mode>,<effect>,<value>: Use forwarding caches\n");
 	fprintf(stderr, "\t-G: Page guide is on\n");
 	fprintf(stderr, "\t-O: Obey to the window manager\n");
@@ -677,6 +684,7 @@
 	fprintf(stderr, "\t-S: Do not process directives that forks process (default)\n");
 	fprintf(stderr, "\t-U: Do process directives that forks process (unsecure mode)\n");
 	fprintf(stderr, "\t-T <timestampfile>: Update timestampfile on page refresh\n");
+	fprintf(stderr, "\t-P: print stderr from image conversion tools (by default it's discarded)");
 	fprintf(stderr, "\t-V: Be verbose\n");
 	fprintf(stderr, "\t-X <gsdevice>: ghostscript device to use\n");
 
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 Mar 10 05:10:02 2003
@@ -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/sample/cloud.gif
Index: kit/sample/dad.gif
Index: kit/sample/dns-jp.mgp
diff -u kit/sample/dns-jp.mgp:1.5 kit/sample/dns-jp.mgp:removed
--- kit/sample/dns-jp.mgp:1.5	Fri Sep  4 21:33:18 1998
+++ kit/sample/dns-jp.mgp	Mon Mar 10 05:10:02 2003
@@ -1,130 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%%	This file is automatically created from the file
-%%	main.pre modified at Fri Jan 23 14:31:24 1998
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%include "default.mgp"
-%% "noop" cancels definitions in default.mgp
-%default 1 left, size 7, fore "light yellow", back "blue4", font "standard", ccolor "white", vgap 35
-%default 2 noop
-%default 3 fore "white", bar "gray70", vgap 10
-%default 4 noop
-%tab 1 noop
-%tab 2 noop
-%tab 3 noop
-%%%
-%page
-%nodefault
-%fore "red", back "blue4", size 9, vgap 15
-%center, fore "yellow", font "thick"
-%ccolor "white"
-
-
-
-Root DNS `M' $B$K$D$$$F(B
-
-%size 6, fore "red", font "thick"
-$B2CF#(B   $BO/(B
-
-%size 5, fore "white", font "standard"
-$BEl5~Bg3XBg7?7W;;5!%;%s%?!<(B
-
-
-%font "typewriter"
-kato@wide.ad.jp
-%font "standard"
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B7P0^(B (1)
-%fore "red", size 6, font "thick"
-   $B!y(B Root DNS
-%fore "white", size 5, font "standard"
-       $B!&(B $B#9Bf$G1?MQ(B
-%fore "white", size 5, font "standard"
-          $B!](B $B#8Bf$,(B US
-          $B!](B Stockholm $B$K#1Bf(B
-%fore "white", size 5, font "standard"
-       $B!&(B $B:GBg$G#1#3Bf(B
-%fore "white", size 5, font "standard"
-          $B!](B $B%Q%1%C%HD9$N@)Ls(B
-%fore "red", size 6, font "thick"
-   $B!y(B Root DNS $B$N1?MQ4p=`(B
-%fore "white", size 5, font "standard"
-       $B!&(B RFC 2010
-       $B!&(B gTLD $B$H$N4X78(B
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B7P0^(B (2)
-%fore "red", size 6, font "thick"
-   $B!y(B IEPG $B$G3HD%$r8!F$(B
-   $B!y(B $B%h!<%m%C%QCO0h(B
-%fore "white", size 5, font "standard"
-       $B!&(B LINX $B$K?7@_(B : 1997 $BG/(B 4 $B7n(B
-%fore "white", size 5, font "standard"
-          $B!](B RIPE/NCC $B$,4IM}(B
-          $B!](B `K'
-%fore "red", size 6, font "thick"
-   $B!y(B $B%"%8%"B@J?MNCO0h(B
-%fore "white", size 5, font "standard"
-       $B!&(B NSPIXP-2 $B!'(B 1997 $BG/(B 8 $B7n(B
-%fore "white", size 5, font "standard"
-          $B!](B WIDE $B$,4IM}(B
-          $B!](B `M'
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  `M'
-%fore "red", size 6, font "thick"
-   $B!y(B $B9=@.(B
-%fore "white", size 5, font "standard"
-       $B!&(B $B#2Bf$N(B PentiumPro 200MHz
-       $B!&(B Primary/Backup$B!"(B $B<+F0@Z$jBX$((B
-%fore "red", size 6, font "thick"
-   $B!y(B Root-only $B%5!<%P(B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-202.12.27.33
-%font "standard"
-       $B!&(B 400 $B!A(B 500 query/sec
-%fore "red", size 6, font "thick"
-   $B!y(B $B1?MQ4IM}(B
-%fore "white", size 5, font "standard"
-       $B!&(B WIDE $B$*$h$S(B ISP $BM-;V(B
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%page
-
-%back "blue4"
-  $B$*4j$$(B
-%fore "red", size 6, font "thick"
-   $B!y(B $B:G?7$N(B root.cache $B$NF~$l49$((B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-1997082200
-%fore "red", size 6, font "thick"
-   $B!y(B Named $B$N99?7(B
-%fore "white", size 5, font "standard"
-       $B!&(B 4.9.6/8.8.1
-%fore "red", size 6, font "thick"
-   $B!y(B $BM7$P$J$$$G!'(B
-%fore "white", size 5, font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-ping/traceroute
-%font "standard"
-       $B!&(B 
-%cont, font "typewriter"
-telnet/spray/...
-%fore "red", size 6, font "thick"
-   $B!y(B Thanks to
-%fore "white", size 5, font "standard"
-       $B!&(B $BF|K\(B Cisco/$BB?$/$N(B ISP
-       $B!&(B `M' $B4IM}%0%k!<%W(B
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
