summaryrefslogtreecommitdiff
path: root/Build/source/texk/gsftopk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/gsftopk
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/gsftopk')
-rw-r--r--Build/source/texk/gsftopk/INSTALL83
-rw-r--r--Build/source/texk/gsftopk/Makefile.in63
-rw-r--r--Build/source/texk/gsftopk/acconfig.h0
-rw-r--r--Build/source/texk/gsftopk/c-auto.in40
-rwxr-xr-xBuild/source/texk/gsftopk/configure2298
-rw-r--r--Build/source/texk/gsftopk/configure.in28
-rw-r--r--Build/source/texk/gsftopk/depend.mak28
-rw-r--r--Build/source/texk/gsftopk/depend.mk12
-rw-r--r--Build/source/texk/gsftopk/gsftopk.c2848
-rw-r--r--Build/source/texk/gsftopk/gsftopk.rc34
-rw-r--r--Build/source/texk/gsftopk/gsftopk1.sed314
-rwxr-xr-xBuild/source/texk/gsftopk/mksedscript22
-rw-r--r--Build/source/texk/gsftopk/render.ps346
-rw-r--r--Build/source/texk/gsftopk/stamp-auto.in1
-rw-r--r--Build/source/texk/gsftopk/version.h1
-rw-r--r--Build/source/texk/gsftopk/win32.mak72
16 files changed, 6190 insertions, 0 deletions
diff --git a/Build/source/texk/gsftopk/INSTALL b/Build/source/texk/gsftopk/INSTALL
new file mode 100644
index 00000000000..389139227cf
--- /dev/null
+++ b/Build/source/texk/gsftopk/INSTALL
@@ -0,0 +1,83 @@
+ INSTALLATION INSTRUCTIONS
+
+gsftopk is primarily intended for sites using xdvi and dvips; it allows them
+to use PostScript fonts with xdvi. While there is nothing to prevent this
+program from being used in other contexts, doing so would be difficult for
+non-expert users.
+
+To install gsftopk, use the following steps.
+
+1. You _must_ have ghostscript 2.5.2 (or higher) installed on your system.
+
+2. It is recommended that you also have dvips installed; however, expert
+ users can read the more detailed instructions at the end of this file
+ to find out how to run without dvips.
+
+3. Make sure that the gsftopk directory is installed in the kpathsea
+ tools hierarchy: we assume that there is a ../kpathsea directory (as is
+ distributed in the xdvi, dvips, or web2c distributions from Karl Berry).
+ (If this is the case, then you can modify the installation in the top-level
+ build directory to automatically build in the gsftopk directory when
+ building the tools.)
+
+4. Run ./configure in this directory. This will generate a Makefile.
+ You may want to set some options when calling this script; see the
+ file ../kpathsea/INSTALL for details. There are no options specific
+ to gsftopk.
+
+5. Type 'make install' to install the program, its manual page, and the
+ render.ps file.
+
+You should now be able to use PostScript fonts with xdvi.
+
+--Paul Vojta, vojta@math.berkeley.edu
+
+
+ NOTES FOR THE EXPERT
+
+With a little extra work it is possible to install gsftopk without having
+installed dvips. All that is needed is to explain some of the makefile
+variables and to describe the format of the file psfonts.map.
+
+The CONFIGPATH is the directory where psfonts.map is to be stored. It may
+actually be a colon-separated list of paths, although only the first one
+containing a file named ``psfonts.map'' is useful.
+
+The HEADERDIR is the directory where the ``render.ps'' driver file is to
+be stored; also it is a component of the HEADERPATH. The HEADERPATH is a
+colon-separated list of directories which are searched for files referenced
+in the ``psfonts.map'' file.
+
+Finally, the file ``psfonts.map'' should provide a information on how to access
+each and every file gsftopk is to be expected to create. Each line of that
+file describes one font. Each line consists of one or more fields, separated
+by one or more tabs or spaces. The first field is mandatory; it gives the
+name by which TeX refers to the file. Other fields are optional and are
+order independent. They are:
+
+ o The PS-name of the font. If absent, it is the same as the TeX name.
+
+ o The file where the font is located. This field is identified by
+ preceding the file name with the character `<'. If absent, it is
+ assumed that the font is built-in to ghostscript.
+
+ o Special instructions for scaling the font. This field is identified
+ by enclosing it in quotes; it may therefore contains spaces.
+ The field consists of PostScript instructions for modifying the font.
+ Possibilities include "1.2 ExtendFont" to stretch the font horizontally
+ by 20%, and ".3 SlantFont" to cause the letters to be slanted at a
+ slope of .3.
+
+The file may also contain comment lines. These are blank lines, or lines
+beginning with `;', `#', or `*'.
+
+The following is a very abbreviated sample psfonts.map:
+
+# Comment and blank lines are ignored.
+
+Times-Roman
+rptmr Times-Roman
+Optima <Optima.pfb
+Optima-Slanted Optima <Optima.pfb ".1944 SlantFont"
+Optima-Condensed Optima <Optima.pfb ".82 ExtendFont"
+Optima-Extended Optima <Optima.pfb "1.2 ExtendFont"
diff --git a/Build/source/texk/gsftopk/Makefile.in b/Build/source/texk/gsftopk/Makefile.in
new file mode 100644
index 00000000000..599a0e075c1
--- /dev/null
+++ b/Build/source/texk/gsftopk/Makefile.in
@@ -0,0 +1,63 @@
+# Makefile for gsftopkk --kb@cs.umb.edu. Modified Yves.Arrouye@imag.fr
+version = 1.19
+
+program = gsftopk
+default all: $(program) gsftopk.1
+
+kpse_include ../make/paths.mk
+kpse_include ../make/common.mk
+kpse_include ../make/programs.mk
+
+gsftopkpsheaderdir = $(psheaderdir)/gsftopk
+
+# (Optional) The fully-qualified path of Ghostscript.
+# GSPATH=-DGS=\"/usr/local/gnu/bin/gs\"
+
+# See INSTALL for compilation options.
+DEFS = @DEFS@ $(XDEFS) $(GSPATH) -DKPATHSEA
+
+objects = gsftopk.o
+
+
+$(program): $(kpathsea) $(objects)
+ $(kpathsea_link) $(objects) $(LOADLIBES)
+
+kpse_include ../make/tkpathsea.mk
+
+gsftopk.1: gsftopk1.sed sedscript
+ sed -f sedscript <$(srcdir)/gsftopk1.sed >$@
+
+sedscript: mksedscript Makefile
+ $(SHELL) $(srcdir)/mksedscript $(DEFS) >$@
+
+install: install-exec install-data
+uninstall: uninstall-exec uninstall-data
+
+install-exec: $(program)
+ $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir)
+ $(INSTALL_LIBTOOL_PROG) $(program) $(bindir)
+uninstall-exec:
+ rm -f $(bindir)/$(program)
+
+install-data: gsftopk.1
+ $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir) $(gsftopkpsheaderdir)
+ $(INSTALL_DATA) gsftopk.1 $(man1dir)/gsftopk.$(manext)
+ $(INSTALL_DATA) $(srcdir)/render.ps $(gsftopkpsheaderdir)/render.ps
+uninstall-data:
+ rm -f $(man1dir)/gsftopk.$(manext)
+ rm -f $(gsftopkpsheaderdir)/render.ps
+
+kpse_include ../make/clean.mk
+
+clean::
+ rm -f sedscript
+
+distclean::
+ rm -f gsftopk.1
+
+kpse_include ../make/config.mk
+
+info dvi check:
+
+kpse_include ../make/rdepend.mk
+kpse_include depend.mk
diff --git a/Build/source/texk/gsftopk/acconfig.h b/Build/source/texk/gsftopk/acconfig.h
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Build/source/texk/gsftopk/acconfig.h
diff --git a/Build/source/texk/gsftopk/c-auto.in b/Build/source/texk/gsftopk/c-auto.in
new file mode 100644
index 00000000000..8860af89b38
--- /dev/null
+++ b/Build/source/texk/gsftopk/c-auto.in
@@ -0,0 +1,40 @@
+/* c-auto.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define if you have <vfork.h>. */
+#undef HAVE_VFORK_H
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef pid_t
+
+/* Define as the return type of signal handlers (int or void). */
+#undef RETSIGTYPE
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define vfork as fork if vfork does not work. */
+#undef vfork
+
+/* Define if you have the poll function. */
+#undef HAVE_POLL
+
+/* Define if you have the sigaction function. */
+#undef HAVE_SIGACTION
+
+/* Define if you have the <poll.h> header file. */
+#undef HAVE_POLL_H
+
+/* Define if you have the <select.h> header file. */
+#undef HAVE_SELECT_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
diff --git a/Build/source/texk/gsftopk/configure b/Build/source/texk/gsftopk/configure
new file mode 100755
index 00000000000..3f9fef7a551
--- /dev/null
+++ b/Build/source/texk/gsftopk/configure
@@ -0,0 +1,2298 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --enable-maintainer-mode enable make rules and dependencies not useful
+ (and sometimes confusing) to the casual installer"
+ac_help="$ac_help
+ --without-mktexmf-default do not run mktexmf if MF source missing"
+ac_help="$ac_help
+ --without-mktexpk-default do not run mktexpk if PK font missing"
+ac_help="$ac_help
+ --without-mktextfm-default do not run mktextfm if TFM file missing"
+ac_help="$ac_help
+ --without-mkocp-default do not run mkocp if OCP file missing"
+ac_help="$ac_help
+ --without-mkofm-default do not run mkofm if OFM file missing"
+ac_help="$ac_help
+ --with-mktexfmt-default run mktexfmt if format file missing"
+ac_help="$ac_help
+ --with-mktextex-default run mktextex if TeX source missing"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+ac_config_files=
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: invalid variable name: $ac_envvar" 1>&2; exit 1; }
+ fi
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=gsftopk.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:559: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:590: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:642: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test $ac_x $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:675: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 686 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:717: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:722: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:750: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ case $ac_dir in
+ /*|[A-z]:/*) ac_aux_dir=$ac_dir;;
+ *) ac_aux_dir=`pwd`/$ac_dir;;
+ esac
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:818: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ # Hack for MSDOS and descendants.
+ if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test $ac_x $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:873: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
+echo "configure:900: checking whether ln -s works" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ rm -f conftestdata
+# MS-DOS is a special case, because it sort of pretends that ln -s
+# works for executables.
+if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null
+then
+ rm -f conftestdata
+ ac_cv_prog_LN_S="ln -s"
+else
+ ac_cv_prog_LN_S=ln
+fi
+fi
+LN_S="$ac_cv_prog_LN_S"
+if test "$ac_cv_prog_LN_S" = "ln -s"; then
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
+echo "configure:925: checking whether to enable maintainer-specific portions of Makefiles" >&5
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
+else
+ USE_MAINTAINER_MODE=no
+fi
+
+ echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
+ if test "x$USE_MAINTAINER_MODE" = xyes; then
+ MAINT=
+ else
+ MAINT='#M#'
+ fi
+
+
+
+echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6
+echo "configure:944: checking for loader (symbol LD)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$LD" && LD=ld
+cf_cv_subst_LD=$LD
+fi
+
+LD=${cf_cv_subst_LD}
+echo "$ac_t""$LD" 1>&6
+
+
+echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6
+echo "configure:958: checking for archiver (symbol AR)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$AR" && AR=ar
+cf_cv_subst_AR=$AR
+fi
+
+AR=${cf_cv_subst_AR}
+echo "$ac_t""$AR" 1>&6
+
+
+echo $ac_n "checking for archiver options (symbol ARFLAGS)""... $ac_c" 1>&6
+echo "configure:972: checking for archiver options (symbol ARFLAGS)" >&5
+if eval "test \"`echo '$''{'cf_cv_subst_ARFLAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+test -z "$ARFLAGS" && ARFLAGS=rc
+cf_cv_subst_ARFLAGS=$ARFLAGS
+fi
+
+ARFLAGS=${cf_cv_subst_ARFLAGS}
+echo "$ac_t""$ARFLAGS" 1>&6
+
+
+
+# Check whether --with-mktexmf-default or --without-mktexmf-default was given.
+if test "${with_mktexmf_default+set}" = set; then
+ withval="$with_mktexmf_default"
+ :
+else
+ with_mktexmf_default=yes
+fi
+
+# Check whether --with-mktexpk-default or --without-mktexpk-default was given.
+if test "${with_mktexpk_default+set}" = set; then
+ withval="$with_mktexpk_default"
+ :
+else
+ with_mktexpk_default=yes
+fi
+
+# Check whether --with-mktextfm-default or --without-mktextfm-default was given.
+if test "${with_mktextfm_default+set}" = set; then
+ withval="$with_mktextfm_default"
+ :
+else
+ with_mktextfm_default=yes
+fi
+
+# Check whether --with-mkocp-default or --without-mkocp-default was given.
+if test "${with_mkocp_default+set}" = set; then
+ withval="$with_mkocp_default"
+ :
+else
+ with_mkocp_default=yes
+fi
+
+# Check whether --with-mkofm-default or --without-mkofm-default was given.
+if test "${with_mkofm_default+set}" = set; then
+ withval="$with_mkofm_default"
+ :
+else
+ with_mkofm_default=yes
+fi
+
+# Check whether --with-mktexfmt-default or --without-mktexfmt-default was given.
+if test "${with_mktexfmt_default+set}" = set; then
+ withval="$with_mktexfmt_default"
+ :
+fi
+
+# Check whether --with-mktextex-default or --without-mktextex-default was given.
+if test "${with_mktextex_default+set}" = set; then
+ withval="$with_mktextex_default"
+ with_mktextex_default=yes
+else
+ with_mktextex_default=no
+fi
+
+
+echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6
+echo "configure:1042: checking where the main texmf tree is located" >&5
+texmfmain=
+if test "x$datadir" != 'x${prefix}/share'; then
+ # First case, datadir is defined...
+ eval p=\"$datadir\"
+ # Unconditionally set the directory, but...
+ texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'`
+ # ... do complain if it wasn't found.
+ if test -d "$texmfmain"; then
+ echo "$ac_t"""$texmfmain"" 1>&6
+ else
+ echo "$ac_t""not found" 1>&6
+ echo "configure: warning: No texmf tree found at $texmfmain.
+ *****************************************************************
+ * Error: The main texmf tree was not found. *
+ * If you do not have the files, you should be able to them from *
+ * the same place you got these sources from, or from one of the *
+ * CTAN hosts. *
+ *****************************************************************
+ Winging it." 1>&2
+ fi
+else
+ # Second case, datadir is default...
+ if test "x$prefix" = "xNONE"; then
+ p="$ac_default_prefix"
+ else
+ eval p=\"$prefix\"
+ fi
+ for e in share/texmf lib/texmf texmf; do
+ if test -d "$p/$e"; then
+ texmfmain='${prefix}'/"$e"
+ break
+ fi
+ done
+ if test -z "$texmfmain" && test "x$prefix" = "xNONE"; then
+ # Still no texmfmain found, no prefix set, perhaps kpsewhich is
+ # installed and can help us out.
+ texmfmain=`kpsewhich --expand-path='$TEXMFMAIN'` 2>/dev/null
+ fi
+ texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'`
+ if test -n "$texmfmain"; then
+ echo "$ac_t"""$texmfmain"" 1>&6
+ else
+ eval texmfmain="$datadir/texmf"
+ echo "$ac_t""not found" 1>&6
+ echo "configure: warning: The main texmf tree was not found at $texmfmain.
+ *****************************************************************
+ * Error: The main texmf tree was not found. *
+ * Use the --datadir option to specify its parent directory. *
+ * If you do not have the files, you should be able to them from *
+ * the same place you got these sources from, or from one of the *
+ * CTAN hosts. *
+ *****************************************************************
+ Winging it by pretending $texmfmain is correct." 1>&2
+ fi
+fi
+
+
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:1102: 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 1107 "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
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+if { (eval echo configure:1123: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_sys_wait_h=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1144: 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 1149 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:1158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&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 how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1179: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1194 "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:1200: \"$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
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1211 "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:1217: \"$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
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1228 "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:1234: \"$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
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+for ac_hdr in poll.h sys/time.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1262: 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 1267 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1272: \"$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_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1300: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1305 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1313: \"$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_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+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 1330 "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*
+
+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 1348 "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*
+
+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 1369 "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); }
+
+EOF
+if { (eval echo configure:1380: \"$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 -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+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
+EOF
+
+fi
+
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:1404: checking for pid_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1409 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+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
+ rm -rf conftest*
+ ac_cv_type_pid_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_pid_t=no
+fi
+rm -f conftest*
+
+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
+EOF
+
+fi
+
+ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
+echo "configure:1441: checking for vfork.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1446 "configure"
+#include "confdefs.h"
+#include <vfork.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1451: \"$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_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_VFORK_H 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for working vfork""... $ac_c" 1>&6
+echo "configure:1476: checking for working vfork" >&5
+if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ echo $ac_n "checking for vfork""... $ac_c" 1>&6
+echo "configure:1482: checking for vfork" >&5
+if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1487 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vfork(); 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 vfork();
+
+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_vfork) || defined (__stub___vfork)
+choke me
+#else
+vfork();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_vfork=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_vfork=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1532 "configure"
+#include "confdefs.h"
+/* Thanks to Paul Eggert for this test. */
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_VFORK_H
+#include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent.
+ The compiler is told about this with #include <vfork.h>,
+ but some compilers (e.g. gcc -O) don't grok <vfork.h>.
+ Test for this by using a static variable whose address
+ is put into a register that is clobbered by the vfork. */
+static
+#ifdef __cplusplus
+sparc_address_test (int arg)
+#else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+main() {
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test ();
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems.
+ This test uses lots of local variables, at least
+ as many local variables as main has allocated so far
+ including compiler temporaries. 4 locals are enough for
+ gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
+ A buggy compiler should reuse the register of parent
+ for one of the local variables, since it will think that
+ parent can't possibly be used any more in this routine.
+ Assigning to the local variable will thus munge parent
+ in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3),
+ vfork doesn't separate parent from child file descriptors.
+ If the child closes a descriptor before it execs or exits,
+ this munges the parent's descriptor as well.
+ Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ exit(
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+EOF
+if { (eval echo configure:1627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_vfork_works=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_vfork_works=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
+if test $ac_cv_func_vfork_works = no; then
+ cat >> confdefs.h <<\EOF
+#define vfork fork
+EOF
+
+fi
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:1650: 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 1655 "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
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:1672: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+for ac_func in poll sigaction
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1693: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1698 "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();
+
+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
+
+; 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*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+if test "$ac_cv_header_poll_h" = no || test "$ac_cv_func_poll" = no; then
+ for ac_hdr in sys/select.h select.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1751: 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 1756 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1761: \"$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_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+ac_config_files="$ac_config_files Makefile"
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+
+trap 'rm -fr `echo "$ac_config_files c-auto.h:c-auto.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@LN_S@%$LN_S%g
+s%@MAINT@%$MAINT%g
+s%@LD@%$LD%g
+s%@AR@%$AR%g
+s%@ARFLAGS@%$ARFLAGS%g
+s%@texmfmain@%$texmfmain%g
+s%@CPP@%$CPP%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"$ac_config_files"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*|[A-z]:/*) # Absolute path.
+ srcdir="$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ rm -f conftest.in
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+ #
+ # Replace lines of the form ac_include foo with the contents of foo:
+ # first, from the ac_include lines construct a list of file names.
+ # From that list, we construct a second list of those files that exist.
+ # Then we construct lists of sed commands for including those files,
+ # and a sed command that removes the ac_include lines. We don't attempt
+ # to read non-existent files because some (buggy) versions of sed choke
+ # on this. Have to use sed because old (Ultrix, SunOS) awk does not support
+ # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
+ # Can't use only one -e and commands {dr foo} because foo has to be last.
+ # Be careful, because the filename may contain /. Be careful with
+ # whitespace; we need to use echo.
+ #
+ file_substs=`sed -n '/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' conftest.in`
+ # Create the sed command line ...
+ if test -n "$file_substs"; then
+ echo "configure: warning: ac_include is obsolete; instead use kpse_include" 1>&2
+ file_subst_cmd="sed -e 's/^ac_include/kpse_include/'"
+ else
+ file_subst_cmd='sed'
+ fi
+ kpse_substs=`sed -n '/^kpse_include/s%kpse_include[ ]*\(.*\)%\1%p' conftest.in`
+ for ac_inc in $file_substs $kpse_substs; do
+ if test -f "$ac_given_srcdir/$ac_inc"; then
+ ac_mung=`echo $ac_inc | sed 's,/,%,g'`
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include $ac_mung$/r $ac_given_srcdir/$ac_inc'"
+ fi
+ done
+ file_subst_cmd="$file_subst_cmd -e '/^kpse_include/d'"
+ # ... and fix the whitespace and escaped slashes.
+ file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \
+-e 's/kpse_include /kpse_include[ ]*/g'`
+ # I can't find any way to do variable substitution in the sed commands
+ # (so the user could have, e.g., $top_srcdir in their ac_include line).
+ (eval $file_subst_cmd conftest.in) \
+ | sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s* conftest.in
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS=" c-auto.h:c-auto.in"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+date >stamp-auto
+
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+if test "$no_recursion" != yes; then
+
+ # Remove --cache-file and --srcdir arguments so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ for ac_arg in $ac_configure_args; do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case "$ac_arg" in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ esac
+ done
+
+ for ac_config_dir in : $subdirs; do
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ if test ! -d $srcdir/$ac_config_dir; then
+ continue
+ fi
+
+ echo configuring in $ac_config_dir
+
+ case "$srcdir" in
+ .) ;;
+ *)
+ if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :;
+ else
+ { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; }
+ fi
+ ;;
+ esac
+
+ ac_popdir=`pwd`
+ cd $ac_config_dir
+
+ # A "../" for each directory in /$ac_config_dir.
+ ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
+
+ case "$srcdir" in
+ .) # No --srcdir option. We are building in place.
+ ac_sub_srcdir=$srcdir ;;
+ /*|[A-z]:/*) # Absolute path.
+ ac_sub_srcdir=$srcdir/$ac_config_dir ;;
+ *) # Relative path.
+ ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
+ esac
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f ./configure; then
+ ac_sub_configure=./configure
+ elif test -f $ac_sub_srcdir/configure; then
+ ac_sub_configure=$ac_sub_srcdir/configure
+ elif test -f $ac_sub_srcdir/configure.in; then
+ ac_sub_configure=$ac_configure
+ else
+ echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+
+ # Make the cache file name correct relative to the subdirectory.
+ case "$cache_file" in
+ /*|[A-z]:/*) ac_sub_cache_file=$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file="$ac_dots$cache_file" ;;
+ esac
+ case "$ac_given_INSTALL" in
+ "") ;;
+ [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir"
+ # The eval makes quoting arguments work.
+ if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir
+ then :
+ else
+ { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; }
+ fi
+ fi
+
+ cd $ac_popdir
+ done
+fi
+
diff --git a/Build/source/texk/gsftopk/configure.in b/Build/source/texk/gsftopk/configure.in
new file mode 100644
index 00000000000..585c190c80c
--- /dev/null
+++ b/Build/source/texk/gsftopk/configure.in
@@ -0,0 +1,28 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(gsftopk.c)
+
+AC_CONFIG_HEADERS([c-auto.h:c-auto.in], [date >stamp-auto])
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_PROG_LN_S
+
+sinclude(../kpathsea/withenable.ac)
+
+dnl Checks for header files.
+AC_HEADER_SYS_WAIT
+AC_HEADER_TIME
+AC_CHECK_HEADERS(poll.h sys/time.h)
+
+dnl Checks for library functions.
+AC_FUNC_VFORK
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS(poll sigaction)
+
+if test "$ac_cv_header_poll_h" = no || test "$ac_cv_func_poll" = no; then
+ AC_CHECK_HEADERS(sys/select.h select.h)
+fi
+
+KPSE_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/Build/source/texk/gsftopk/depend.mak b/Build/source/texk/gsftopk/depend.mak
new file mode 100644
index 00000000000..624898e6327
--- /dev/null
+++ b/Build/source/texk/gsftopk/depend.mak
@@ -0,0 +1,28 @@
+$(objdir)/gsftopk.obj: \
+ version.h \
+ $(kpathseadir)/config.h \
+ $(kpathseadir)/c-auto.h \
+ $(kpathseadir)/c-std.h \
+ $(kpathseadir)/c-unistd.h \
+ $(kpathseadir)/systypes.h \
+ $(kpathseadir)/c-memstr.h \
+ $(kpathseadir)/c-errno.h \
+ $(kpathseadir)/c-minmax.h \
+ $(kpathseadir)/c-limits.h \
+ $(kpathseadir)/c-proto.h \
+ $(gnuw32dir)/win32lib.h \
+ $(kpathseadir)/debug.h \
+ $(kpathseadir)/types.h \
+ $(kpathseadir)/lib.h \
+ $(kpathseadir)/progname.h \
+ $(kpathseadir)/c-ctype.h \
+ $(gnuw32dir)/oldnames.h \
+ $(kpathseadir)/c-fopen.h \
+ $(kpathseadir)/c-pathmx.h \
+ $(kpathseadir)/proginit.h \
+ $(kpathseadir)/tex-file.h \
+ $(kpathseadir)/c-vararg.h \
+ $(kpathseadir)/tex-make.h \
+ $(kpathseadir)/variable.h \
+ c-auto.h
+
diff --git a/Build/source/texk/gsftopk/depend.mk b/Build/source/texk/gsftopk/depend.mk
new file mode 100644
index 00000000000..654909c4dc5
--- /dev/null
+++ b/Build/source/texk/gsftopk/depend.mk
@@ -0,0 +1,12 @@
+gsftopk.o: gsftopk.c version.h $(kpathsea_srcdir)/config.h $(kpathsea_dir)/c-auto.h \
+ $(kpathsea_srcdir)/c-std.h \
+ $(kpathsea_srcdir)/c-unistd.h $(kpathsea_srcdir)/systypes.h \
+ $(kpathsea_srcdir)/c-memstr.h \
+ $(kpathsea_srcdir)/c-errno.h \
+ $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
+ $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
+ $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
+ $(kpathsea_srcdir)/c-ctype.h $(kpathsea_srcdir)/c-fopen.h \
+ $(kpathsea_srcdir)/c-pathmx.h \
+ $(kpathsea_srcdir)/proginit.h $(kpathsea_srcdir)/tex-file.h $(kpathsea_srcdir)/c-vararg.h \
+ $(kpathsea_srcdir)/tex-make.h $(kpathsea_srcdir)/variable.h c-auto.h
diff --git a/Build/source/texk/gsftopk/gsftopk.c b/Build/source/texk/gsftopk/gsftopk.c
new file mode 100644
index 00000000000..233ad6eff90
--- /dev/null
+++ b/Build/source/texk/gsftopk/gsftopk.c
@@ -0,0 +1,2848 @@
+/*========================================================================*\
+
+Copyright (c) 1993-2000 Paul Vojta
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+PAUL VOJTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+\*========================================================================*/
+
+#if !lint
+static char copyright[] =
+"@(#) Copyright (c) 1993-1998 Paul Vojta.\n";
+#endif
+
+/*
+ * Reference for PK file format:
+ *
+ * Tomas Rokicki, Packed (PK) font file format, TUGBoat 6 (1985) 115-120.
+ */
+
+/*
+ * Kpathsea version by Thomas Esser, John Interrante, Yves Arrouye, Karl Berry.
+ */
+
+#include "version.h"
+
+#ifndef KPATHSEA
+
+#include "config.h"
+
+/* Some O/S dependent kludges. */
+#if _AIX
+#define _ALL_SOURCE 1
+#endif
+
+#if __hpux
+#define _HPUX_SOURCE 1
+#endif
+
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+# if !HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+# endif
+char *strchr(), *strrchr();
+# if !HAVE_MEMCPY
+# define memcpy(d, s, n) bcopy((s), (d), (n))
+# define memmove(d, s, n) bcopy((s), (d), (n))
+# define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
+# endif
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+#include <memory.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <fcntl.h>
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#ifndef atof
+double atof();
+#endif
+char *getenv();
+
+/* <sys/types.h> is already included. */
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifndef WIFSTOPPED
+#define WIFSTOPPED(stat_val) (((stat_val) & 0377) == 0177)
+#endif
+
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(stat_val) (((stat_val) & 0377) != 0)
+#endif
+
+#ifndef WTERMSIG
+#define WTERMSIG(stat_val) ((stat_val) & 0177)
+#endif
+
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+
+#ifndef SIGCHLD
+#define SIGCHLD SIGCLD
+#endif
+
+/* How to open a text file for reading: */
+#ifndef FOPEN_R_MODE
+#define FOPEN_R_MODE "r"
+#endif
+
+/* How to open a binary file for reading: */
+#ifndef FOPEN_RBIN_MODE
+#if DOS
+#define FOPEN_RBIN_MODE "r+b"
+#elif VMS || VMCMS || OS2 || WIN32
+#define FOPEN_RBIN_MODE "rb"
+#else
+#define FOPEN_RBIN_MODE "r"
+#endif
+#endif /* undef FOPEN_RBIN_MODE */
+
+/* How to open a binary file for writing: */
+#ifndef FOPEN_WBIN_MODE
+#if DOS
+#define FOPEN_WBIN_MODE "w+b"
+#elif OS2 || WIN32
+#define FOPEN_WBIN_MODE "wb"
+#elif VMCMS
+#define FOPEN_WBIN_MODE "wb, lrecl=1024, recfm=f"
+#else
+#define FOPEN_WBIN_MODE "w"
+#endif
+#endif /* undef FOPEN_WBIN_MODE */
+
+
+/* These macros munge function declarations to make them work in both
+ cases. The P?H macros are used for declarations, the P?C for
+ definitions. Cf. <ansidecl.h> from the GNU C library. P1H(void)
+ also works for definitions of routines which take no args. */
+
+#if __STDC__
+
+#define AA(args) args /* For an arbitrary number; ARGS must be in parens. */
+
+#define P1H(p1) (p1)
+
+#define P1C(t1,n1)(t1 n1)
+#define P2C(t1,n1, t2,n2)(t1 n1, t2 n2)
+#define P3C(t1,n1, t2,n2, t3,n3)(t1 n1, t2 n2, t3 n3)
+#define P4C(t1,n1, t2,n2, t3,n3, t4,n4)(t1 n1, t2 n2, t3 n3, t4 n4)
+#define P5C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5) \
+ (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5)
+#define P6C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6) \
+ (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5, t6 n6)
+#define P7C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6, t7,n7) \
+ (t1 n1, t2 n2, t3 n3, t4 n4, t5 n5, t6 n6, t7 n7)
+
+#else /* not __STDC__ */
+
+#define AA(args) ()
+
+#define P1H(p1) ()
+
+#define P1C(t1,n1) (n1) t1 n1;
+#define P2C(t1,n1, t2,n2) (n1,n2) t1 n1; t2 n2;
+#define P3C(t1,n1, t2,n2, t3,n3) (n1,n2,n3) t1 n1; t2 n2; t3 n3;
+#define P4C(t1,n1, t2,n2, t3,n3, t4,n4) (n1,n2,n3,n4) \
+ t1 n1; t2 n2; t3 n3; t4 n4;
+#define P5C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5) (n1,n2,n3,n4,n5) \
+ t1 n1; t2 n2; t3 n3; t4 n4; t5 n5;
+#define P6C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6) (n1,n2,n3,n4,n5,n6) \
+ t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6;
+#define P7C(t1,n1, t2,n2, t3,n3, t4,n4, t5,n5, t6,n6, t7,n7) \
+ (n1,n2,n3,n4,n5,n6,n7) \
+ t1 n1; t2 n2; t3 n3; t4 n4; t5 n5; t6 n6; t7 n7;
+#define const /* nothing */
+
+#endif /* not __STDC__ */
+
+#else /* KPATHSEA */
+
+#include <kpathsea/config.h>
+#include <kpathsea/c-errno.h>
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/c-pathmx.h>
+#include <kpathsea/proginit.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/tex-make.h>
+#include <kpathsea/variable.h>
+#include <c-auto.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <setjmp.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if !HAVE_STRCHR
+#define strchr index
+#endif
+
+#if !HAVE_STRRCHR
+#define strrchr rindex
+#endif
+
+#if HAVE_POLL && !HAVE_POLL_H
+#undef HAVE_POLL
+#endif
+
+/* Add two new flags to kpathsea_debug for debugging gsftopk */
+#define GSPK_DEBUG_BITMAP (KPSE_LAST_DEBUG + 1)
+#define GSPK_DEBUG_PK (KPSE_LAST_DEBUG + 2)
+
+/* <sys/types.h> is already included: <kpathsea/config.h>
+ --> <kpathsea/c-std.h> --> <kpathsea/c-unistd.h>
+ --> <kpathsea/systypes.h> --> <sys/types.h>. */
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+
+#if WIN32
+
+#include <win32lib.h>
+#include <gs32lib.h>
+#include <gsdll.h>
+HANDLE hGsThread = NULL;
+HANDLE hGsDataIn = 0, hGsDataOut = 0; /* Events to synchronize threads */
+/* Arguments to gs dll */
+char *gs_argv[] = { "gswin32c.exe", /* 0, */
+ "-dNOGC", /* 1, */
+ "-dNODISPLAY", /* 2, */
+ NULL, /* 3, substarg */
+ "-q", /* 4, */
+ "--", /* 5, */
+ NULL, /* 6, searchpath */
+ NULL, /* 7, PSname */
+ NULL, /* 8, dlstring != NULL ? dlstring : "" */
+ NULL, /* 9, specinfo */
+ NULL, /* 10, dpistr */
+ NULL /* 11, NULL terminator */
+ };
+int gs_argc = 11;
+
+char *buffer_stdin; /* This is the buffer from where data are taken. */
+
+#else /* not WIN32 */
+
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+
+#ifndef WIFSTOPPED
+#define WIFSTOPPED(stat_val) (((stat_val) & 0377) == 0177)
+#endif
+
+#ifndef WIFSIGNALED
+#define WIFSIGNALED(stat_val) (((stat_val) & 0377) != 0)
+#endif
+
+#ifndef WTERMSIG
+#define WTERMSIG(stat_val) ((stat_val) & 0177)
+#endif
+
+#endif /* not WIN32 */
+
+#endif /* KPATHSEA */
+
+#if HAVE_POLL
+# include <poll.h>
+#else
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# else
+# if HAVE_SELECT_H
+# include <select.h>
+# endif
+# endif
+#endif
+
+#if HAVE_VFORK_H
+#include <vfork.h>
+#endif
+
+#if _AMIGA
+#include <proto/dos.h>
+#include <dos/dostags.h>
+#endif
+
+#define NUMBER(x) (sizeof (x) / sizeof *(x))
+
+/* if POSIX O_NONBLOCK is not available, use O_NDELAY */
+#if !defined(O_NONBLOCK) && defined(O_NDELAY)
+#define O_NONBLOCK O_NDELAY
+#endif
+
+#ifndef S_ISDIR
+#if defined(S_IFMT) && defined(S_IFDIR)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+#endif
+
+#ifndef GS_PATH
+#define GS_PATH "gs"
+#endif
+
+#if __GNUC__
+#define NORETURN volatile
+#else
+#define NORETURN /* nothing */
+#endif
+
+#if STDC_HEADERS && __STDC__
+#define NeedVarargsPrototypes 1
+#include <stdarg.h>
+#else /* no prototypes */
+#define NeedVarargsPrototypes 0
+#include <varargs.h>
+#endif /* no prototypes */
+
+typedef char Boolean;
+#define True 1
+#define False 0
+
+#ifndef NeedWidePrototypes
+#if __STDC__
+#define NeedWidePrototypes 1
+#else
+#define NeedWidePrototypes 0
+#endif
+#endif /* NeedWidePrototypes */
+
+#if NeedWidePrototypes
+typedef int wide_bool;
+#else
+typedef Boolean wide_bool;
+#endif
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 256
+#endif
+
+#define PK_PRE (char) 247
+#define PK_ID (char) 89
+#define PK_SPC (char) 240
+#define PK_POST (char) 245
+#define PK_NOP (char) 246
+
+#ifndef KPATHSEA
+char progname[] = "gsftopk ";
+#else
+char progname[] = "gsftopk(k) ";
+#endif
+
+char version[] = VERSION;
+
+/*
+ * Command line arguments
+ */
+
+#define OPT_DBG 0x101
+
+Boolean test = False;
+char *fontname;
+int fontlen;
+char *mapline = NULL;
+const char *mapfile = NULL;
+const char *gspath = GS_PATH; /* gs interpreter path */
+Boolean dosnames = False;
+Boolean quiet = False;
+
+struct option {
+ const char *longname;
+ short shortname;
+ Boolean has_arg;
+ void *addr;
+ int value;
+};
+
+static const struct option options[] = {
+ {"test", 't', False, &test, True},
+ {"mapline", 0, True, &mapline, 0},
+ {"mapfile", 0, True, &mapfile, 0},
+ {"interpreter", 'i', True, &gspath, 0},
+ {"dosnames", 0, False, &dosnames, True},
+ {"quiet", 'q', False, &quiet, True},
+#ifdef KPATHSEA
+ {"debug", OPT_DBG,True, NULL, 0},
+#endif
+ {"version", 'v', False, NULL, 0},
+ {"help", 'h', False, NULL, 0}};
+
+FILE *pk_file = NULL;
+char *xfilename;
+int col = 0; /* current column number */
+const char *specinfo = "";
+pid_t gs_pid = 0;
+
+/*
+ * Config file options
+ */
+
+#ifndef KPATHSEA /* 'H' option */
+const char *config_file_header_path = HEADERPATH;
+#else
+const char *config_file_header_path = NULL;
+#endif
+
+struct p_list { /* list of 'p' options */
+ struct p_list *next;
+ const char *value;
+};
+
+ /* Initialize this list to "psfonts.map". */
+
+struct p_list psfonts_map = {NULL, "psfonts.map"};
+
+struct p_list *p_head = &psfonts_map;
+struct p_list **p_tail = &psfonts_map.next;
+
+/*
+ * Reading from the pipe from ghostscript
+ */
+
+Boolean data_eof = False;
+
+#if !_AMIGA
+
+#define BUFSIZE 512
+
+typedef unsigned char byte;
+
+int data_fd;
+byte buffer[BUFSIZE];
+byte *data_out = buffer;
+byte *data_end = buffer;
+
+#else /* _AMIGA */
+
+FILE *data_file;
+
+/* This string will be used to open pipes in and out */
+char tmpname[] = "gsftopkXXXXXX";
+
+#endif /* _AMIGA */
+
+/*
+ * Information from the .tfm file.
+ */
+
+int tfm_lengths[12];
+#define lh tfm_lengths[1]
+#define bc tfm_lengths[2]
+#define ec tfm_lengths[3]
+#define nw tfm_lengths[4]
+
+long checksum;
+long design;
+byte width_index[256];
+long tfm_widths[256];
+
+/*
+ * Information on the bitmap currently being worked on.
+ */
+
+byte *bitmap;
+int width;
+int skip;
+int height;
+int hoff;
+int voff;
+int bytes_wide;
+unsigned int bm_size;
+byte *bitmap_end;
+int pk_len;
+
+
+#if !_AMIGA
+
+/*
+ * Exit, and kill the child process, too.
+ */
+
+NORETURN void
+exit_toto_too P1H(void)
+{
+#if !WIN32
+ if (gs_pid != 0)
+ kill(gs_pid, SIGKILL);
+#else
+ if (hGsThread) {
+ switch (WaitForSingleObject(hGsThread, 2000)) {
+ case WAIT_OBJECT_0:
+ CloseHandle(hGsThread);
+ hGsThread = NULL;
+ break;
+ case WAIT_TIMEOUT:
+ fprintf(stderr, "Timeout waiting for Gs thread.\n");
+ break;
+ case WAIT_FAILED:
+ fprintf(stderr, "WaitForSingleObject failed on Gs thread (Error code %d).\n",
+ GetLastError());
+ break;
+ default:
+ break;
+ }
+
+ if (hGsThread) {
+ if (TerminateThread(hGsThread, 1) == 0) {
+ fprintf(stderr, "... couldn't terminate gs thread\n");
+ }
+ CloseHandle(hGsThread);
+ /* FIXME : is it right to call this ? */
+ gs_dll_release();
+ }
+ }
+
+ if (hGsDataIn)
+ CloseHandle(hGsDataIn);
+ if (hGsDataOut)
+ CloseHandle(hGsDataOut);
+
+#endif
+ if (pk_file != NULL) {
+ fclose(pk_file);
+ if (unlink(xfilename) != 0) perror("unlink");
+ }
+
+ _exit(1);
+}
+
+#else /* _AMIGA */
+
+#define exit_toto_too() exit(1)
+
+#endif /* _AMIGA */
+
+/*
+ * Print error message and quit.
+ */
+
+#if NeedVarargsPrototypes
+NORETURN void
+oops(const char *message, ...)
+#else
+/* VARARGS */
+NORETURN void
+oops(va_alist)
+ va_dcl
+#endif
+{
+#if !NeedVarargsPrototypes
+ const char *message;
+#endif
+ va_list args;
+
+#if NeedVarargsPrototypes
+ va_start(args, message);
+#else
+ va_start(args);
+ message = va_arg(args, const char *);
+#endif
+ if (col != 0) putchar('\n');
+ vfprintf(stderr, message, args);
+ va_end(args);
+ putc('\n', stderr);
+ exit_toto_too();
+}
+
+
+/*
+ * Same as oops, but with arguments.
+ */
+#if NeedVarargsPrototypes
+NORETURN void
+opt_oops(const char *message, ...)
+#else
+/* VARARGS */
+NORETURN void
+opt_oops(va_alist)
+ va_dcl
+#endif
+{
+#if !NeedVarargsPrototypes
+ const char *message;
+#endif
+ va_list args;
+
+#if NeedVarargsPrototypes
+ va_start(args, message);
+#else
+ va_start(args);
+ message = va_arg(args, const char *);
+#endif
+ fputs("gsftopk: ", stderr);
+ vfprintf(stderr, message, args);
+ va_end(args);
+ fputs("\nTry `gsftopk --help' for more information.\n", stderr);
+ exit(1);
+}
+
+
+#ifndef KPATHSEA
+
+/*
+ * Either allocate storage or fail.
+ */
+
+static void *
+xmalloc P1C(unsigned, size)
+{
+ void *mem = (void *) malloc(size);
+
+ if (mem == NULL)
+ oops("gsftopk: Cannot allocate %u bytes.\n", size);
+ return mem;
+}
+
+
+/*
+ * Either reallocate storage or fail.
+ */
+
+static void *
+xrealloc P2C(char *, oldp, unsigned, size)
+{
+ void *mem;
+
+ mem = oldp == NULL ? (void *) malloc(size)
+ : (void *) realloc(oldp, size);
+ if (mem == NULL)
+ oops("gsftopk: Cannot reallocate %u bytes.\n", size);
+ return mem;
+}
+
+#endif /* not KPATHSEA */
+
+
+/*
+ * Get a single white-space-delimited argument (or fail).
+ */
+
+char *
+get_one_arg P1C(const char *, src)
+{
+ char *dest;
+ const char *p;
+ unsigned int len;
+
+ len = strlen(src);
+ p = memchr(src, ' ', len);
+ if (p != NULL) len = p - src;
+ p = memchr(src, '\t', len);
+ if (p != NULL) len = p - src;
+
+ dest = xmalloc(len + 1);
+ memcpy(dest, src, len);
+ dest[len] = '\0';
+
+ return dest;
+}
+
+#if !_AMIGA
+
+/*
+ * Signal handlers.
+ */
+
+static Boolean got_sigchld = False;
+
+#if WIN32
+
+BOOL WINAPI
+handle_sigterm(DWORD dwCtrlType)
+{
+
+ /*
+ * Fix me: There is a problem if a system() command is running.
+ * We should wait for the child process to be interrupted.
+ * Only way I can think of to do that : rewrite system() based on
+ * spawn() with parsing of the command line and set a global pid
+ * Next cwait(pid) in the HandlerRoutine.
+ */
+
+ switch (dwCtrlType) {
+ case CTRL_C_EVENT:
+ case CTRL_BREAK_EVENT:
+ fprintf(stderr, "...exiting\n");
+ exit_toto_too();
+ return FALSE;
+ default:
+ fprintf(stderr, "... not exiting\n");
+ return TRUE;
+ }
+}
+
+#else /* not WIN32 */
+
+/* ARGSUSED */
+static RETSIGTYPE
+handle_sigchild P1C(int, signo)
+{
+ got_sigchld = True;
+}
+
+/* ARGSUSED */
+static RETSIGTYPE
+handle_sigterm P1C(int, signo)
+{
+ exit_toto_too();
+}
+
+#endif /* WIN32 */
+
+#define gs_is_done (gs_pid == 0)
+
+typedef int gsf_wait_t;
+
+#if WIN32
+
+/* This is the callback function for gs. It is mainly used to read and
+ write data on gs stdin/stdout. Data exchanges happen through
+ buffers. */
+int __cdecl
+gsdll_callback(int message, char *str, unsigned long count)
+{
+ int n;
+ static char **pin = &buffer_stdin; /* not yet allocated, so used a pointer on it. */
+
+ switch (message) {
+
+ case GSDLL_STDIN:
+ /* Put count chars on gs stdin */
+#if DEBUG
+ fprintf(stderr, "gs wants %d chars\n", count);
+#endif
+ strncpy(str, *pin, count);
+ *pin += count;
+ return strlen(str);
+
+ case GSDLL_STDOUT:
+ /* Fill the buffer in, wait for gsftopk to ask for data. */
+ WaitForSingleObject(hGsDataOut, INFINITE);
+#if DEBUG
+ fprintf(stderr, "gs gives %d chars\n", count);
+#endif
+ data_out = buffer;
+
+ n = (count >= BUFSIZE ? BUFSIZE : count);
+ memcpy(data_out, str, n);
+ data_end = data_out + n;
+ /* Tell data_fillbuf() that data are available */
+ if (SetEvent(hGsDataIn) == FALSE)
+ Win32Error("gsdll_callback/SetEvent");
+ /* return the number of chars read */
+ return n;
+
+ case GSDLL_DEVICE:
+#if DEBUG
+ fprintf(stdout,"Callback: DEVICE %p %s\n", str,
+ count ? "open" : "close");
+#endif
+ break;
+
+ case GSDLL_SYNC:
+#if DEBUG
+ fprintf(stdout,"Callback: SYNC %p\n", str);
+#endif
+ break;
+
+ case GSDLL_PAGE:
+ fprintf(stdout,"Callback: PAGE %p\n", str);
+ break;
+
+ case GSDLL_SIZE:
+#if DEBUG
+ fprintf(stdout,"Callback: SIZE %p width=%d height=%d\n", str,
+ (int)(count & 0xffff), (int)((count>>16) & 0xffff) );
+#endif
+ break;
+
+ case GSDLL_POLL:
+#if 0
+ fprintf(stderr, "GS: Poll sent (%d)!\n", 0);
+#endif
+ return 0; /* no error ? */
+ default:
+ fprintf(stdout,"%s: gs callback: unknown message=%d\n",progname, message);
+ break;
+ }
+ return 0;
+}
+
+/*
+ This is the thread function that will load the gs dll and
+ send it the data.
+*/
+DWORD WINAPI Win32GsSendData(LPVOID lpParam)
+{
+ int ret;
+
+ gs_dll_initialize();
+
+ ret = (*pgsdll_init)(gsdll_callback,
+ NULL,
+ gs_argc,
+ gs_argv);
+
+ switch (ret) {
+ case 0:
+ /* Should not happen : gs should quit
+ right after being initialized. */
+ (*pgsdll_exit)();
+ /* FIXME: this is working, but we could expect something cleaner ! */
+ /* GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0); */
+ break;
+ case GSDLL_INIT_QUIT:
+ break;
+ default:
+ (*pgsdll_exit)();
+ break;
+ }
+#if DEBUG
+ fprintf(stderr, "%s: gsdll_init returned %d\n", progname, ret);
+#endif
+ WaitForSingleObject(hGsDataOut, INFINITE);
+ data_eof = True;
+ data_end = data_out;
+ /* Tell data_fillbuf() */
+ SetEvent(hGsDataIn);
+
+ gs_dll_release();
+
+ return 0;
+}
+
+#else /* not WIN32 */
+
+static void
+wait_for_gs P1H(void)
+{
+ gsf_wait_t status;
+
+#if _AMIGA
+
+ /* Do nothing */
+
+#else /* not _AMIGA */
+
+ got_sigchld = False;
+
+ for (;;) {
+ if (wait(&status) != -1) break;
+ /* if (errno == EINTR) continue; */
+ if (errno != EINTR) {
+ perror("wait");
+ exit_toto_too();
+ }
+ }
+
+ if (WIFSTOPPED(status))
+ return;
+
+ gs_pid = 0;
+
+ if (WIFSIGNALED(status))
+ oops("gs died due to signal %d\n", WTERMSIG(status));
+
+ /* otherwise, it exited */
+ if (WEXITSTATUS(status) != 0)
+ oops("gs terminated abnormally with status %d\n",
+ WEXITSTATUS(status));
+
+#endif /* not _AMIGA */
+
+}
+
+#endif /* not WIN32 */
+
+#endif /* not _AMIGA */
+
+/*
+ * Routines to read from the data file.
+ */
+
+#if _AMIGA
+
+#define data_getc() getc(data_file)
+#define data_ungetc(c) ungetc(c, data_file)
+#define data_read(p, l) fread(p, 1, l, data_file)
+
+#else /* not _AMIGA */
+
+#if WIN32
+
+static void
+data_fillbuf P1H(void)
+{
+ if (data_eof)
+ return;
+
+ /* wait until data are available. First tell gs it can fill the buffer in. */
+ SetEvent(hGsDataOut);
+ /* wait for the data. */
+ switch (WaitForSingleObject(hGsDataIn, INFINITE)) {
+ case WAIT_OBJECT_0:
+ /* normal case */
+ break;
+ case WAIT_TIMEOUT:
+ /* should not happen */
+ fprintf(stderr, "Gs did not return on time from callback.\n");
+ break;
+ case WAIT_FAILED:
+ break;
+ default:
+ fprintf(stderr, "WaitForSingleObject failed for unknown reason.\n");
+ }
+}
+
+#else /* not WIN32 */
+
+#if HAVE_POLL
+#define ISSET(a, b) (poll_fd.revents & POLLIN != 0)
+#else
+#define ISSET(a, b) FD_ISSET(a, b)
+#endif
+
+static void
+data_fillbuf P1H(void)
+{
+ int n;
+
+#if HAVE_POLL
+ static struct pollfd poll_fd = {0, POLLIN, 0};
+#else
+ fd_set read_fds;
+ struct timeval timeout;
+#endif
+
+ if (data_eof)
+ return;
+
+ /* wait for readable data */
+ if (!gs_is_done) {
+ for (;;) {
+ if (!got_sigchld) {
+#if HAVE_POLL
+ poll_fd.fd = data_fd;
+ poll_fd.revents = 0;
+ if (poll(&poll_fd, 1, 5000) == -1) {
+ if (errno != EINTR) {
+ perror("poll");
+ sleep(4);
+ }
+ continue;
+ }
+#else
+ FD_ZERO(&read_fds);
+ FD_SET(data_fd, &read_fds);
+ timeout.tv_sec = 5;
+ timeout.tv_usec = 0;
+ if (select(data_fd + 1, &read_fds, (fd_set *) NULL,
+ (fd_set *) NULL, &timeout) == -1) {
+ if (errno != EINTR) {
+ perror("select");
+ sleep(4);
+ }
+ continue;
+ }
+#endif
+ }
+ if (got_sigchld) {
+ wait_for_gs();
+ break;
+ }
+ if (ISSET(data_fd, &read_fds))
+ break;
+ }
+ }
+
+ /* read the data */
+ for (;;) {
+ n = read(data_fd, (void *) (data_out = buffer), BUFSIZE);
+ if (n >= 0)
+ break;
+ if (errno == EINTR)
+ continue;
+ if (gs_is_done && errno == EAGAIN) {
+ n = 0;
+ break;
+ }
+ perror("read from gs");
+ sleep(4);
+ }
+
+ data_end = data_out + n;
+ if (n == 0)
+ data_eof = True;
+}
+
+#endif /* not WIN32 */
+
+static byte
+data_fgetc P1H(void)
+{
+ if (data_out >= data_end)
+ data_fillbuf();
+
+ return data_eof ? EOF : *data_out++;
+}
+
+#define data_getc() (data_out < data_end ? *data_out++ : data_fgetc())
+
+static void
+data_ungetc P1C(byte, c)
+{
+ if (data_out <= buffer)
+ oops("Too many calls to data_ungetc()");
+
+ *--data_out = c;
+}
+
+static int
+data_read P2C(byte *, buf, int, n)
+{
+ byte *buf1 = buf;
+ byte *buf_end = buf + n;
+ int n1;
+
+ if (buf1 >= buf_end)
+ return 0;
+
+ while (!data_eof) {
+ n1 = buf_end - buf1;
+ if (n1 > data_end - data_out)
+ n1 = data_end - data_out;
+ memcpy(buf1, data_out, n1);
+ buf1 += n1;
+ data_out += n1;
+ if (buf1 >= buf_end) break;
+ data_fillbuf();
+ }
+
+ return buf1 - buf;
+}
+
+static void
+data_gets P2C(byte *, buf, int, n)
+{
+ byte *buf1 = buf;
+ byte *buf_end = buf + n - 1;
+ int n1;
+ byte *p1;
+
+ if (n <= 0)
+ return;
+
+ for (;;) {
+ if (data_eof)
+ oops("Premature end of file");
+ n1 = buf_end - buf1;
+ if (n1 > data_end - data_out)
+ n1 = data_end - data_out;
+ p1 = (byte *) memchr((char *) data_out, '\n', n1);
+ if (p1 != NULL)
+ n1 = p1 + 1 - data_out;
+ memcpy((char *) buf1, (char *) data_out, n1);
+ buf1 += n1;
+ data_out += n1;
+ if (p1 != NULL || buf1 >= buf_end) break;
+ data_fillbuf();
+ }
+
+ *buf1 = '\0';
+
+ return;
+}
+
+#endif /* not _AMIGA */
+
+/*
+ * Here's the patch searching stuff. First the typedefs and variables.
+ */
+
+#ifndef KPATHSEA
+static char searchpath[MAXPATHLEN + 1];
+#else
+static char *searchpath;
+#endif
+
+#define HUNKSIZE (MAXPATHLEN + 2)
+
+struct spacenode { /* used for storage of directory names */
+ struct spacenode *next;
+ char *sp_end; /* end of data for this chunk */
+ char sp[HUNKSIZE];
+}
+ firstnode;
+
+#ifndef KPATHSEA
+
+static jmp_buf found_env;
+static FILE *searchfile;
+static const char *searchname;
+static int searchnamelen;
+
+static const char *
+find_dbl_slash P2C(const char *, sp_bgn, const char *, sp_end)
+{
+ const char *p;
+
+ for (;;) {
+ p = memchr(sp_bgn, '/', sp_end - sp_bgn);
+ if (p == NULL) return sp_end;
+ if (p[1] == '/') return p;
+ sp_bgn = p + 1;
+ }
+}
+
+static void
+main_search_proc P7C(char *, matpos, const char *, sp_pos,
+ const char *, sp_slash, const char *, sp_end,
+ wide_bool, skip_subdirs, struct spacenode *, space, char *, spacenext)
+{
+ char *mp;
+ struct stat statbuf;
+ DIR *dir;
+ struct dirent *entry;
+ int lenleft;
+ int len;
+ struct spacenode *space1;
+ char *spacenext1;
+
+ mp = matpos + (sp_slash - sp_pos);
+ /* check length */
+ if (mp + searchnamelen >= searchpath + sizeof(searchpath) - 2) return;
+ memcpy(matpos, sp_pos, sp_slash - sp_pos);
+ if (sp_slash == sp_end) { /* try for a file */
+ *mp = '/';
+ strcpy(mp + (mp == searchpath || mp[-1] != '/'), searchname);
+ searchfile = fopen(searchpath, "r");
+ if (searchfile != NULL) longjmp(found_env, True);
+ }
+ else {/* try for a subdirectory */
+ *mp = '\0';
+ if (stat(searchpath, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) {
+ *mp++ = '/';
+ main_search_proc(mp, sp_slash + 2,
+ find_dbl_slash(sp_slash + 2, sp_end), sp_end,
+ statbuf.st_nlink <= 2, space, spacenext);
+ }
+ }
+ if (skip_subdirs) return;
+ *matpos = '\0';
+ dir = opendir(searchpath);
+ if (dir == NULL) return;
+ lenleft = searchpath + sizeof(searchpath) - matpos;
+ space1 = space;
+ spacenext1 = spacenext;
+ for (;;) {
+ entry = readdir(dir);
+ if (entry == NULL) break;
+ len = NAMLEN(entry) + 1;
+ if (len > lenleft) continue; /* too long */
+ strcpy(matpos, entry->d_name);
+ if (*matpos == '.' && (matpos[1] == '\0' || (matpos[1] == '.'
+ && matpos[2] == '\0')))
+ continue; /* ignore . and .. */
+ if (stat(searchpath, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode))
+ continue; /* if not a directory */
+ if (statbuf.st_nlink > 2) ++len;
+ if (spacenext1 + len > space1->sp + HUNKSIZE) {
+ space1->sp_end = spacenext1;
+ if (space1->next == NULL) {
+ space1->next = xmalloc(sizeof(struct spacenode));
+ space1->next->next = NULL;
+ }
+ space1 = space1->next;
+ spacenext1 = space1->sp;
+ }
+ if (statbuf.st_nlink > 2) {
+ *spacenext1++ = '/';
+ --len;
+ }
+ memcpy(spacenext1, entry->d_name, len - 1);
+ spacenext1[len - 1] = '\0';
+ spacenext1 += len;
+ }
+ closedir(dir);
+ for (;;) {
+ space1->sp_end = spacenext1;
+ if (spacenext == space->sp_end) {
+ if (space == space1) break;
+ space = space->next;
+ spacenext = space->sp;
+ }
+ skip_subdirs = True;
+ if (*spacenext == '/') {
+ ++spacenext;
+ skip_subdirs = False;
+ }
+ len = strlen(spacenext);
+ memcpy(matpos, spacenext, len);
+ matpos[len] = '/';
+ main_search_proc(matpos + len + 1, sp_pos, sp_slash, sp_end,
+ skip_subdirs, space1, spacenext1);
+ spacenext += len + 1;
+ }
+}
+
+static FILE *
+search P3C(const char *, path, const char *, path_var, const char *, name)
+{
+ const char *env_path = NULL;
+ FILE *f;
+
+ if (path_var != NULL) {
+ if (*name == '/') {
+ strcpy(searchpath, name);
+ return fopen(searchpath, "r");
+ }
+ env_path = getenv(path_var);
+ }
+ if (env_path == NULL) {
+ env_path = path;
+ path = NULL;
+ }
+ searchname = name;
+ searchnamelen = strlen(name);
+ for (;;) {
+ const char *p;
+
+ p = strchr(env_path, ':');
+ if (p == NULL) p = env_path + strlen(env_path);
+ if (p == env_path) {
+ if (path != NULL) {
+ f = search(path, (char *) NULL, name);
+ if (f != NULL) return f;
+ }
+ }
+ else {
+ if (setjmp(found_env))
+ return searchfile;
+ main_search_proc(searchpath,
+ env_path, find_dbl_slash(env_path, p), p,
+ True, &firstnode, firstnode.sp);
+ }
+ if (*p == '\0') return NULL;
+ env_path = p + 1;
+ }
+}
+
+#endif /* not KPATHSEA */
+
+/*
+ * Reading configuration and map files.
+ */
+
+char *long_line = NULL; /* for reading config and map files */
+int long_line_len = 82; /* allocated length of the above */
+
+Boolean
+fgets_long P1C(FILE *, f)
+{
+ int len;
+
+ if (fgets(long_line, long_line_len, f) == NULL)
+ return False;
+
+ len = 0;
+ for (;;) {
+ len += strlen(long_line + len);
+ if (len > 0 && long_line[len - 1] == '\n') {
+ long_line[--len] = '\0';
+ break;
+ }
+ if (len < long_line_len - 1)
+ break;
+ long_line_len += 80;
+ long_line = xrealloc(long_line, long_line_len);
+ fgets(long_line + len, long_line_len - len, f);
+ }
+
+ return True;
+}
+
+
+void
+#ifndef KPATHSEA
+getdefaults P1C(FILE *, f)
+#else
+getdefaults P1C(const char *, name)
+#endif
+{
+#ifdef KPATHSEA
+ FILE *f;
+#endif
+ char *p;
+ char c;
+ struct p_list *p_node;
+
+#ifdef KPATHSEA
+ p = kpse_find_file(name, kpse_dvips_config_format, false);
+ if (p == NULL)
+ return;
+
+ f = fopen(p, FOPEN_R_MODE);
+ if (f == NULL)
+ return;
+#endif
+
+ while (fgets_long(f)) {
+ p = long_line;
+ while (*p == ' ' || *p == '\t') ++p;
+ c = *p;
+ if (c == '\0')
+ continue;
+ do ++p;
+ while (*p == ' ' || *p == '\t');
+ switch (c) {
+ case 'H':
+ config_file_header_path = get_one_arg(p);
+ break;
+
+ case 'p':
+ if (*p == '+')
+ do ++p;
+ while (*p == ' ' || *p == '\t');
+ else
+ p_tail = &p_head; /* discard old list */
+
+ p_node = xmalloc(sizeof *p_node);
+ p_node->value = get_one_arg(p);
+ *p_tail = p_node;
+ p_tail = &p_node->next;
+ break;
+ }
+ }
+
+ fclose(f);
+}
+
+
+Boolean
+scan_map_file P1C(FILE *, f)
+{
+ while (fgets_long(f))
+ if (memcmp(long_line, fontname, fontlen) == 0
+ && (long_line[fontlen] == '\0' || isspace(long_line[fontlen]))) {
+ fclose(f);
+ return True;
+ }
+
+ fclose(f);
+ return False;
+}
+
+
+/*
+ * Add to dlstring
+ */
+
+char *dlstring = NULL;
+unsigned int dls_len = 0;
+unsigned int dls_max = 0;
+
+void
+addtodls P1C(const char *, s)
+{
+ int len = strlen(s);
+
+ if (dls_len + len >= dls_max) {
+ unsigned int newsize = dls_max + 80;
+
+ if (newsize <= dls_len + len) newsize = dls_len + len + 1;
+ dlstring = xrealloc(dlstring, dls_max = newsize);
+ }
+ strcpy(dlstring + dls_len, s);
+ dls_len += len;
+}
+
+
+
+long
+getlong P1C(FILE *, f)
+{
+ int value;
+
+ value = (int) ((byte) getc(f)) << 24;
+ value |= (int) ((byte) getc(f)) << 16;
+ value |= (int) ((byte) getc(f)) << 8;
+ value |= (int) ((byte) getc(f));
+ return value;
+}
+
+
+char line[82];
+
+void
+expect P1C(const char *, waitingfor)
+{
+ for (;;) {
+#if !_AMIGA
+ data_gets((byte *) line, sizeof(line));
+#else
+ if (fgets(line, sizeof(line), data_file) == NULL)
+ oops("Premature end of file");
+#endif
+ if (memcmp(line, waitingfor, strlen(waitingfor)) == 0) return;
+ fputs("gs: ", stdout);
+ for (;;) {
+ fputs(line, stdout);
+ if (*line == '\0' || line[strlen(line) - 1] == '\n') break;
+#if !_AMIGA
+ data_gets((byte *) line, sizeof(line));
+#else
+ if (fgets(line, sizeof(line), data_file) == NULL)
+ oops("Premature end of file");
+#endif
+ }
+ }
+}
+
+void
+whitespace P1H(void)
+{
+ char c;
+
+ for (;;) {
+ c = data_getc();
+ if (c == '#')
+ do c = data_getc(); while (!data_eof && c != '\n');
+ else if (!isspace(c)) {
+ data_ungetc(c);
+ break;
+ }
+ }
+}
+
+int
+getint P1H(void)
+{
+ char c;
+ int i = 0;
+
+ do c = data_getc(); while (isspace(c));
+ if (c < '0' || c > '9') oops("digit expected");
+ do {
+ i = i * 10 + (c - '0');
+ c = data_getc();
+ } while (c >= '0' && c <= '9');
+ if (!data_eof) data_ungetc(c);
+ return i;
+}
+
+static byte masks[] = {0, 1, 3, 7, 017, 037, 077, 0177, 0377};
+
+byte flag;
+int pk_dyn_f;
+int pk_dyn_g;
+int base; /* cost of this character if pk_dyn_f = 0 */
+int deltas[13]; /* cost of increasing pk_dyn_f from i to i+1 */
+
+/*
+ * Add up statistics for putting out the given shift count
+ */
+
+static void
+tallyup P1C(int, n)
+{
+ int m;
+
+ if (n > 208) {
+ ++base;
+ n -= 192;
+ for (m = 0x100; m != 0 && m < n; m <<= 4) base += 2;
+ if (m != 0 && (m = (m - n) / 15) < 13) deltas[m] += 2;
+ }
+ else if (n > 13) ++deltas[(208 - n) / 15];
+ else --deltas[n - 1];
+}
+
+/*
+ * Routines for storing the shift counts
+ */
+
+static Boolean odd = False;
+static byte part;
+
+static void
+pk_put_nyb P1C(int, n)
+{
+ if (odd) {
+ *bitmap_end++ = (part << 4) | n;
+ odd = False;
+ }
+ else {
+ part = n;
+ odd = True;
+ }
+}
+
+static void
+pk_put_long P1C(int, n)
+{
+ if (n >= 16) {
+ pk_put_nyb(0);
+ pk_put_long(n / 16);
+ }
+ pk_put_nyb(n % 16);
+}
+
+static void
+pk_put_count P1C(int, n)
+{
+ if (n > pk_dyn_f) {
+ if (n > pk_dyn_g)
+ pk_put_long(n - pk_dyn_g + 15);
+ else {
+ pk_put_nyb(pk_dyn_f + (n - pk_dyn_f + 15) / 16);
+ pk_put_nyb((n - pk_dyn_f - 1) % 16);
+ }
+ }
+ else pk_put_nyb(n);
+}
+
+static void
+trim_bitmap P1H(void)
+{
+ byte *p;
+ byte mask;
+
+ /* clear out garbage bits in bitmap */
+ if (width % 8 != 0) {
+ mask = ~masks[8 - width % 8];
+ for (p = bitmap + bytes_wide - 1; p < bitmap_end; p += bytes_wide)
+ *p &= mask;
+ }
+
+ /*
+ * Find the bounding box of the bitmap.
+ */
+
+ /* trim top */
+ skip = 0;
+ mask = 0;
+ for (;;) {
+ if (bitmap >= bitmap_end) { /* if bitmap is empty */
+ width = height = hoff = voff = 0;
+ return;
+ }
+ p = bitmap + bytes_wide;
+ while (p > bitmap) mask |= *--p;
+ if (mask) break;
+ ++skip;
+ bitmap += bytes_wide;
+ }
+ height -= skip;
+ voff -= skip;
+#if DEBUG
+#ifdef KPATHSEA
+ if (KPSE_DEBUG_P (GSPK_DEBUG_PK))
+#endif
+ if (skip < 2 || skip > 3)
+ printf("Character has %d empty rows at top\n", skip);
+#endif /* DEBUG */
+
+ /* trim bottom */
+ skip = 0;
+ mask = 0;
+ for (;;) {
+ p = bitmap_end - bytes_wide;
+ while (p < bitmap_end) mask |= *p++;
+ if (mask) break;
+ ++skip;
+ bitmap_end -= bytes_wide;
+ }
+ height -= skip;
+#if DEBUG
+#ifdef KPATHSEA
+ if (KPSE_DEBUG_P (GSPK_DEBUG_PK))
+#endif
+ if (skip < 2 || skip > 3)
+ printf("Character has %d empty rows at bottom\n", skip);
+#endif /* DEBUG */
+
+ /* trim right */
+ skip = 0;
+ --width;
+ for (;;) {
+ mask = 0;
+ for (p = bitmap + width / 8; p < bitmap_end; p += bytes_wide)
+ mask |= *p;
+ if (mask & (0x80 >> (width % 8))) break;
+ --width;
+ ++skip;
+ }
+ ++width;
+#if DEBUG
+#ifdef KPATHSEA
+ if (KPSE_DEBUG_P (GSPK_DEBUG_PK))
+#endif
+ if (skip < 2 || skip > 3)
+ printf("Character has %d empty columns at right\n", skip);
+#endif /* DEBUG */
+
+ /* trim left */
+ skip = 0;
+ for (;;) {
+ mask = 0;
+ for (p = bitmap + skip / 8; p < bitmap_end; p += bytes_wide)
+ mask |= *p;
+ if (mask & (0x80 >> (skip % 8))) break;
+ ++skip;
+ }
+ width -= skip;
+ hoff -= skip;
+#if DEBUG
+#ifdef KPATHSEA
+ if (KPSE_DEBUG_P (GSPK_DEBUG_PK))
+#endif
+ if (skip < 2 || skip > 3)
+ printf("Character has %d empty columns at left\n", skip);
+#endif /* DEBUG */
+ bitmap += skip / 8;
+ skip = skip % 8;
+}
+
+/*
+ * Pack the bitmap using the rll method. (Return false if it's better
+ * to just pack the bits.)
+ */
+
+static Boolean
+pk_rll_cvt P1H(void)
+{
+ static int *counts = NULL; /* area for saving bit counts */
+ static int maxcounts = 0; /* size of this area */
+ unsigned int ncounts; /* max to allow this time */
+ int *nextcount; /* next count value */
+ int *counts_end; /* pointer to end */
+ byte *rowptr;
+ byte *p;
+ byte mask;
+ byte *rowdup; /* last row checked for dup */
+ byte paint_switch; /* 0 or 0xff */
+ int bits_left; /* bits left in row */
+ int cost;
+ int i;
+
+ /*
+ * Allocate space for bit counts.
+ */
+
+ ncounts = (width * height + 3) / 4;
+ if (ncounts > maxcounts) {
+ if (counts != NULL) free(counts);
+ counts = xmalloc((ncounts + 2) * sizeof(int));
+ maxcounts = ncounts;
+ }
+ counts_end = counts + ncounts;
+
+ /*
+ * Form bit counts and collect statistics
+ */
+ base = 0;
+ bzero(deltas, sizeof(deltas));
+ rowdup = NULL; /* last row checked for duplicates */
+ p = rowptr = bitmap;
+ mask = 0x80 >> skip;
+ flag = 0;
+ paint_switch = 0;
+ if (*p & mask) {
+ flag = 8;
+ paint_switch = 0xff;
+ }
+ bits_left = width;
+ nextcount = counts;
+ while (rowptr < bitmap_end) { /* loop over shift counts */
+ int shift_count = bits_left;
+
+ for (;;) {
+ if (bits_left == 0) {
+ if ((p = rowptr += bytes_wide) >= bitmap_end) break;
+ mask = 0x80 >> skip;
+ bits_left = width;
+ shift_count += width;
+ }
+ if (((*p ^ paint_switch) & mask) != 0) break;
+ --bits_left;
+ mask >>= 1;
+ if (mask == 0) {
+ ++p;
+ while (*p == paint_switch && bits_left >= 8) {
+ ++p;
+ bits_left -= 8;
+ }
+ mask = 0x80;
+ }
+ }
+ if (nextcount >= counts_end) return False;
+ shift_count -= bits_left;
+ *nextcount++ = shift_count;
+ tallyup(shift_count);
+ /* check for duplicate rows */
+ if (rowptr != rowdup && bits_left != width) {
+ byte *p1 = rowptr;
+ byte *q = rowptr + bytes_wide;
+ int repeat_count;
+
+ while (q < bitmap_end && *p1 == *q) ++p1, ++q;
+ repeat_count = (p1 - rowptr) / bytes_wide;
+ if (repeat_count > 0) {
+ *nextcount++ = -repeat_count;
+ if (repeat_count == 1) --base;
+ else {
+ ++base;
+ tallyup(repeat_count);
+ }
+ rowptr += repeat_count * bytes_wide;
+ }
+ rowdup = rowptr;
+ }
+ paint_switch = ~paint_switch;
+ }
+
+#if DEBUG
+#ifdef KPATHSEA
+ if (KPSE_DEBUG_P (GSPK_DEBUG_BITMAP))
+#endif
+ {
+ /*
+ * Dump the bitmap
+ */
+
+ for (p = bitmap; p < bitmap_end; p += bytes_wide) {
+ byte *p1 = p;
+ int j;
+
+ mask = 0x80 >> skip;
+ for (j = 0; j < width; ++j) {
+ putchar(*p1 & mask ? '@' : '.');
+ if ((mask >>= 1) == 0) mask = 0x80, ++p1;
+ }
+ putchar('\n');
+ }
+ putchar('\n');
+ }
+#endif /* DEBUG */
+
+ /*
+ * Determine the best pk_dyn_f
+ */
+
+ pk_dyn_f = 0;
+ cost = base += 2 * (nextcount - counts);
+ for (i = 1; i < 14; ++i) {
+ base += deltas[i - 1];
+ if (base < cost) {
+ pk_dyn_f = i;
+ cost = base;
+ }
+ }
+ /* last chance to bail out */
+ if (cost * 4 > width * height) return False;
+
+ /*
+ * Pack the bit counts
+ */
+
+ pk_dyn_g = 208 - 15 * pk_dyn_f;
+ flag |= pk_dyn_f << 4;
+ bitmap_end = bitmap;
+ *nextcount = 0;
+ nextcount = counts;
+ while (*nextcount != 0) {
+ if (*nextcount > 0) pk_put_count(*nextcount);
+ else
+ if (*nextcount == -1) pk_put_nyb(15);
+ else {
+ pk_put_nyb(14);
+ pk_put_count(-*nextcount);
+ }
+ ++nextcount;
+ }
+ if (odd) {
+ pk_put_nyb(0);
+ ++cost;
+ }
+ if (cost != 2 * (bitmap_end - bitmap))
+ printf("Cost miscalculation: expected %d, got %d\n", cost,
+ 2 * (bitmap_end - bitmap));
+ pk_len = bitmap_end - bitmap;
+ return True;
+}
+
+static void
+pk_bm_cvt P1H(void)
+{
+ byte *rowptr;
+ byte *p;
+ int blib1; /* bits left in byte */
+ int bits_left; /* bits left in row */
+ byte *q;
+ int blib2;
+ byte nextbyte;
+
+ flag = 14 << 4;
+ q = bitmap;
+ blib2 = 8;
+ nextbyte = 0;
+ for (rowptr = bitmap; rowptr < bitmap_end; rowptr += bytes_wide) {
+ p = rowptr;
+ blib1 = 8 - skip;
+ bits_left = width;
+ if (blib2 != 8) {
+ int n;
+
+ if (blib1 < blib2) {
+ nextbyte |= *p << (blib2 - blib1);
+ n = blib1;
+ }
+ else {
+ nextbyte |= *p >> (blib1 - blib2);
+ n = blib2;
+ }
+ blib2 -= n;
+ if ((bits_left -= n) < 0) {
+ blib2 -= bits_left;
+ continue;
+ }
+ if ((blib1 -= n) == 0) {
+ blib1 = 8;
+ ++p;
+ if (blib2 > 0) {
+ nextbyte |= *p >> (8 - blib2);
+ blib1 -= blib2;
+ bits_left -= blib2;
+ if (bits_left < 0) {
+ blib2 = -bits_left;
+ continue;
+ }
+ }
+ }
+ *q++ = nextbyte;
+ }
+ /* fill up whole (destination) bytes */
+ while (bits_left >= 8) {
+ nextbyte = *p++ << (8 - blib1);
+ *q++ = nextbyte | (*p >> blib1);
+ bits_left -= 8;
+ }
+ /* now do the remainder */
+ nextbyte = *p << (8 - blib1);
+ if (bits_left > blib1) nextbyte |= p[1] >> blib1;
+ blib2 = 8 - bits_left;
+ }
+ if (blib2 != 8) *q++ = nextbyte;
+ pk_len = q - bitmap;
+}
+
+static void
+putshort P1C(short, w)
+{
+ putc(w >> 8, pk_file);
+ putc(w, pk_file);
+}
+
+static void
+putmed P1C(long, w)
+{
+ putc(w >> 16, pk_file);
+ putc(w >> 8, pk_file);
+ putc(w, pk_file);
+}
+
+static void
+putlong P1C(long, w)
+{
+ putc(w >> 24, pk_file);
+ putc(w >> 16, pk_file);
+ putc(w >> 8, pk_file);
+ putc(w, pk_file);
+}
+
+static void
+putglyph P1C(int, cc)
+{
+ static Boolean have_first_line = False;
+ static int llx, lly, urx, ury;
+ static float char_width;
+ static byte *area1 = NULL;
+ static unsigned int size1 = 0;
+ static int i;
+ long dm;
+ long tfm_wid;
+ byte *p;
+
+ if (!quiet) {
+ int wid;
+ static const char *s = "";
+
+ wid = (cc >= 100) + (cc >= 10) + 4;
+ if (col + wid > 80) {
+ s = "\n";
+ col = 0;
+ }
+ printf("%s[%d", s, cc);
+ fflush(stdout);
+ col += wid;
+ s = " ";
+ }
+ if (!have_first_line) {
+ expect("#^");
+ if (sscanf(line, "#^ %d %d %d %d %d %f\n", &i,
+ &llx, &lly, &urx, &ury, &char_width) != 6)
+ oops("Cannot scanf first line");
+ }
+ if (i < cc) oops("Character %d received, %d expected", i, cc);
+ if (i > cc) {
+ fprintf(stderr, "Character %d is missing.\n", cc);
+ have_first_line = True;
+ return;
+ }
+ have_first_line = False;
+ hoff = -llx + 2;
+ voff = ury + 2 - 1;
+ expect("P4\n");
+ whitespace();
+ width = getint();
+ whitespace();
+ height = getint();
+ (void) data_getc();
+ if (width != urx - llx + 4 || height != ury - lly + 4)
+ oops("Dimensions do not match: %d %d %d %d %d %d",
+ llx, lly, urx, ury, width, height);
+ bytes_wide = (width + 7) / 8;
+ bm_size = bytes_wide * height;
+ if (size1 < bm_size) {
+ if (area1 != NULL) free(area1);
+ area1 = xmalloc(bm_size);
+ size1 = bm_size;
+ }
+ for (p = area1 + (height - 1) * bytes_wide; p >= area1; p -= bytes_wide)
+ if (data_read(p, bytes_wide) != bytes_wide)
+ oops("Cannot read bitmap of size %u", bm_size);
+ bitmap = area1;
+ bitmap_end = bitmap + bm_size;
+ trim_bitmap();
+ if (height == 0 || !pk_rll_cvt()) pk_bm_cvt();
+ tfm_wid = tfm_widths[width_index[cc]];
+ dm = (long) (char_width + 0.5) - (char_width < -0.5);
+ if (pk_len + 8 < 4 * 256 && tfm_wid < (1<<24) &&
+ dm >= 0 && dm < 256 && width < 256 && height < 256 &&
+ hoff >= -128 && hoff < 128 && voff >= -128 && voff < 128) {
+ putc(flag | ((pk_len + 8) >> 8), pk_file);
+ putc(pk_len + 8, pk_file);
+ putc(cc, pk_file);
+ putmed(tfm_wid);
+ putc(dm, pk_file);
+ putc(width, pk_file);
+ putc(height, pk_file);
+ putc(hoff, pk_file);
+ putc(voff, pk_file);
+ } else
+ if (pk_len + 13 < 3 * 65536L && tfm_wid < (1<<24) &&
+ dm >= 0 && dm < 65536L && width < 65536L && height < 65536L &&
+ hoff >= -65536L && hoff < 65536L &&
+ voff >= -65536L && voff < 65536L) {
+ putc(flag | 4 | ((pk_len + 13) >> 16), pk_file);
+ putshort(pk_len + 13);
+ putc(cc, pk_file);
+ putmed(tfm_wid);
+ putshort(dm);
+ putshort(width);
+ putshort(height);
+ putshort(hoff);
+ putshort(voff);
+ }
+ else {
+ putc(flag | 7, pk_file);
+ putlong(pk_len + 28);
+ putlong(cc);
+ putlong(tfm_wid);
+ putlong((long) (char_width * 65536.0 + 0.5) - (char_width < -0.5));
+ putlong(0);
+ putlong(width);
+ putlong(height);
+ putlong(hoff);
+ putlong(voff);
+ }
+ fwrite(bitmap, 1, pk_len, pk_file);
+ if (!quiet) {
+ putchar(']');
+ fflush(stdout);
+ }
+}
+
+static void
+putspecl P2C(const char *, str1, const char *, str2)
+{
+ int len1 = strlen(str1);
+ int len2 = 0;
+
+ if (str2 != NULL) len2 = strlen(str2);
+ if (len1 + len2 > 255) return;
+ putc(PK_SPC, pk_file);
+ putc(len1 + len2, pk_file);
+ fwrite(str1, 1, len1, pk_file);
+ if (len2 != 0) fwrite(str2, 1, len2, pk_file);
+}
+
+int
+main P2C(int, argc, char **, argv)
+{
+ FILE *config_file;
+ FILE *render_ps;
+ FILE *tfm_file;
+ char **argp;
+ float dpi;
+ const char *dvipsrc;
+ char *p;
+ char *PSname = NULL;
+ char *specinf = NULL;
+ char *specp = NULL; /* NULL pacifies lint */
+ char charlist[10*2 + 90*3 + 156*4 + 1];
+ char designstr[20];
+ char dpistr[20];
+#if HAVE_SIGACTION
+ struct sigaction sigact;
+#endif
+#if _AMIGA
+ char fngs[50];
+ char fngsf[50];
+ char tfm_path[256];
+ BPTR in, out;
+#else
+ char *substarg;
+#endif
+#if WIN32
+ DWORD idGsThread;
+#else /* not WIN32 */
+#if !_AMIGA
+ int std_out[2];
+#endif
+ int std_in[2];
+#endif /* not WIN32 */
+ int cc;
+ int ppp;
+ int i;
+
+ argp = argv;
+ while (++argp < argv + argc && (*argp)[0] == '-') {
+ const struct option *opt_ptr;
+ const struct option *opt;
+ char *arg = *argp + 1;
+
+ if (*arg == '\0') --arg; /* this will flag an error later */
+ if (*arg != '-') { /* if short argument */
+ opt = options;
+ for (;;) {
+ if (*arg == opt->shortname)
+ break;
+ if (++opt >= options + NUMBER(options))
+ opt_oops("invalid option -- %c", *arg);
+ }
+ if (opt->has_arg) {
+ ++arg;
+ if (*arg == '\0') {
+ if (++argp >= argv + argc)
+ opt_oops("option requires an argument -- %c",
+ arg[-1]);
+ arg = *argp;
+ }
+ }
+ else {
+ if (arg[1] != '\0')
+ opt_oops("invalid number of bytes in option `%s'",
+ arg - 1);
+ }
+ }
+ else { /* long argument */
+ int len;
+ char *arg1;
+
+ ++arg;
+ if (*arg == '\0') { /* if -- */
+ ++argp;
+ break;
+ }
+ len = strlen(arg);
+ arg1 = memchr(arg, '=', len);
+ if (arg1 != NULL) {
+ len = arg1 - arg;
+ ++arg1;
+ }
+ opt = NULL;
+ for (opt_ptr = options; opt_ptr < options + NUMBER(options);
+ ++opt_ptr)
+ if (memcmp(arg, opt_ptr->longname, len) == 0) {
+ if (opt != NULL)
+ opt_oops("option `%s' is ambiguous.", arg - 2);
+ opt = opt_ptr;
+ }
+ if (opt == NULL)
+ opt_oops("unrecognized option `%s'", arg - 2);
+ if (opt->has_arg) {
+ if (arg1 == NULL) {
+ if (++argp >= argv + argc)
+ opt_oops("option `--%s' requires an argument.",
+ opt->longname);
+ arg1 = *argp;
+ }
+ }
+ else {
+ if (arg1 != NULL)
+ opt_oops("option `--%s' doesn't allow an argument.",
+ opt->longname);
+ }
+ arg = arg1;
+ } /* end long argument */
+
+ if (opt->addr != NULL)
+ if (opt->has_arg)
+ *((char **) opt->addr) = arg;
+ else
+ *((Boolean *) opt->addr) = opt->value;
+
+ switch (opt->shortname) {
+#ifdef KPATHSEA
+ case OPT_DBG:
+ kpathsea_debug |= atoi(arg);
+ break;
+#endif
+ case 'h':
+#ifndef KPATHSEA
+ puts("\
+Usage: gsftopk [OPTION] FONT DPI\n\
+Translate the PostScript Type 1 font FONT to PK bitmap format at DPI dpi.\n\
+\n\
+ -t, --test check for presence of font in .map file.\n\
+ --mapline=LINE use LINE as the line from the .map file.\n\
+ --mapfile=FILE use FILE as a .map file; default psfonts.map.\n\
+ -i GS, --interpreter=GS use GS as Ghostscript interpreter.\n\
+ --dosnames short pk filename (cmr10.pk instead of cmr10.600pk).\n\
+ -q, --quiet don't print progress information to standard output.\n\
+ -h, --help print this message and exit.\n\
+ -v, --version print version number and exit.\n");
+#else
+ puts("\
+Usage: gsftopk [OPTION] FONT DPI\n\
+Translate the PostScript Type 1 font FONT to PK bitmap format at DPI dpi.\n\
+\n\
+ -t, --test check for presence of font in .map file.\n\
+ --mapline=LINE use LINE as the line from the .map file.\n\
+ --mapfile=FILE use FILE as a .map file; default psfonts.map.\n\
+ -i GS, --interpreter=GS use GS as Ghostscript interpreter.\n\
+ --dosnames short pk filename (cmr10.pk instead of cmr10.600pk).\n\
+ -q, --quiet don't print progress information to standard output.\n\
+ --debug=NUM set debugging flags.\n\
+ -h, --help print this message and exit.\n\
+ -v, --version print version number and exit.\n");
+#endif
+ return 0;
+ case 'v':
+#ifndef KPATHSEA
+ printf("gsftopk %s\n", version);
+#else
+ {
+ extern KPSEDLL char *kpathsea_version_string;
+
+ printf("gsftopk(k) %s\n", version);
+ puts(kpathsea_version_string);
+ puts("Copyright (C) 1993-1998 Paul Vojta.\n\
+There is NO warranty. You may redistribute this software\n\
+under the terms of the GNU General Public License\n\
+and the standard X consortium copyright notice.\n\
+For more information about these matters, see the files\n\
+named COPYING and gsftopk.c.\n\
+Author of gsftopk: Paul Vojta.");
+ }
+#endif
+ return 0;
+ }
+ }
+
+ if (mapfile != NULL && mapline != NULL)
+ opt_oops("cannot specify both `--mapline' and `--mapfile'");
+
+ if (argp >= argv + argc)
+ opt_oops(test ? "must provide a font name"
+ : "must provide a font name and resolution");
+
+ fontname = *argp++;
+ fontlen = strlen(fontname);
+
+ if (argp >= argv + argc) {
+ if (!test)
+ opt_oops("must provide rendering resolution");
+ dpi = 0.0;
+ }
+ else {
+ dpi = atof(*argp++);
+ if (dpi <= 0.0)
+ opt_oops("DPI argument `%s' must be a positive number", *argp);
+ }
+
+ if (argp < argv + argc)
+ opt_oops("no more than two arguments are allowed");
+
+#ifdef KPATHSEA
+ kpse_set_progname(argv[0]);
+ kpse_init_prog("GSFTOPK", (int) (dpi + 0.5), NULL, "cmr10");
+ if (!test)
+ xputenv_int("KPATHSEA_DPI", (int) (dpi + 0.5));
+#endif
+
+#if _AMIGA
+ /* [CL] 21-Jun-97
+ This is quite silly but it really helps things when determining the
+ font supplier and family.
+ */
+ putenv("GSFTOPKTFM=");
+#endif
+
+ /*
+ * Read the dvips-style config file(s).
+ */
+
+ long_line = xmalloc(long_line_len); /* initialize fgets_long */
+
+#ifndef KPATHSEA
+ config_file = search(CONFIGPATH, "TEXCONFIG", "config.ps");
+ if (config_file != NULL)
+ getdefaults(config_file);
+
+ dvipsrc = getenv("DVIPSRC");
+ if (dvipsrc == NULL) {
+ dvipsrc = getenv("HOME");
+ if (dvipsrc != NULL) {
+ i = strlen(dvipsrc);
+ p = xmalloc(i + 10);
+ memcpy(p, dvipsrc, i);
+ memcpy(p + i, "/.dvipsrc", 10);
+ }
+ }
+ if (dvipsrc != NULL) {
+ config_file = fopen(dvipsrc, "r");
+ if (config_file != NULL)
+ getdefaults(config_file);
+ }
+
+ config_file = search(CONFIGPATH, "TEXCONFIG", "config.gsftopk");
+ if (config_file != NULL)
+ getdefaults(config_file);
+#else
+ getdefaults("config.ps");
+
+ dvipsrc = kpse_var_value("DVIPSRC");
+ getdefaults(dvipsrc != NULL ? dvipsrc : "$HOME/.dvipsrc");
+
+ getdefaults("config.gsftopk");
+
+ /* Set HEADERPATH from config file. */
+
+ if (config_file_header_path != NULL)
+ kpse_format_info[kpse_tex_ps_header_format].client_path
+ = config_file_header_path;
+#endif
+
+ /*
+ * Get the map line.
+ */
+
+ if (mapline != NULL) {
+ if (memcmp(mapline, fontname, fontlen) != 0
+ || (mapline[fontlen] != '\0' && !isspace(mapline[fontlen])))
+ oops("font name does not match --mapline argument");
+ }
+ else {
+ Boolean font_found;
+
+ if (mapfile != NULL) {
+#ifndef KPATHSEA
+ config_file = search(CONFIGPATH, "TEXCONFIG",
+ mapfile);
+#else
+ config_file = kpse_open_file(mapfile,
+ kpse_fontmap_format);
+#endif
+
+ if (config_file == NULL) {
+ perror(mapfile);
+ exit(1);
+ }
+ font_found = scan_map_file(config_file);
+ }
+ else {
+ struct p_list *p_node;
+
+ font_found = False;
+ *p_tail = NULL;
+ for (p_node = p_head; p_node != NULL; p_node = p_node->next) {
+#ifndef KPATHSEA
+ config_file = search(CONFIGPATH, "TEXCONFIG",
+ p_node->value);
+#else
+ config_file = kpse_open_file(p_node->value,
+ kpse_fontmap_format);
+#endif
+ if (config_file != NULL)
+ if (scan_map_file(config_file)) {
+ font_found = True;
+ break;
+ }
+ }
+ }
+
+ if (!font_found)
+ if (test)
+ exit(1);
+ else
+ oops("Cannot find font %s in map file(s).", fontname);
+
+ mapline = long_line;
+ }
+
+ if (test)
+ exit(0);
+
+ if (!quiet) {
+ printf("%sversion %s", progname, version);
+ fflush(stdout);
+ col = 1; /* any nonzero value will do */
+ }
+
+ /*
+ * Parse the line from the map file.
+ */
+ for (p = mapline + fontlen; *p != '\0'; ++p) {
+ if (isspace(*p)) continue;
+ if (*p == '<') {
+ char *q;
+ char endc;
+ char c;
+ FILE *f;
+
+ ++p;
+ /* There may be two '<'s in front of the filename. */
+ if (*p == '<') ++p;
+ /* ... and maybe a '[' */
+ if (*p == '[') ++p;
+ q = p;
+ while (*p != '\0' && !isspace(*p)) ++p;
+ endc = *p;
+ *p = '\0';
+#ifdef KPATHSEA
+ searchpath = kpse_find_file(q, kpse_tex_ps_header_format,true);
+#ifdef WIN32
+ /* Be safe for Ghostscript's sake */
+ dostounix_filename(searchpath);
+#endif /* WIN32 */
+ f = searchpath ? fopen(searchpath, FOPEN_R_MODE) : NULL;
+#else
+ f = search(config_file_header_path, "DVIPSHEADERS", q);
+#endif
+ if (f == NULL) oops("Cannot find font file %s", q);
+ /* search() also sets searchpath */
+ addtodls(" (");
+ addtodls(searchpath);
+ c = getc(f);
+ addtodls(c == '\0' ? ") ttload"
+ : c == '\200' ? ") brun"
+ : ") run");
+ fclose(f);
+ if (endc == '\0') break;
+ continue;
+ }
+ else if (*p == '"') {
+ char *q;
+
+ if (specinf != NULL)
+ *specp++ = ' ';
+ else
+ specinf = specp = xmalloc(strlen(p));
+ ++p;
+ q = strchr(p, '"');
+ if (q == NULL) q = p + strlen(p);
+ memcpy(specp, p, q - p);
+ specp += q - p;
+ p = q;
+ if (*p == '\0') break;
+ else continue;
+ }
+ else {
+ PSname = p;
+ while (*p != '\0' && !isspace(*p)) ++p;
+ if (*p == '\0') break;
+ }
+ *p = '\0';
+ }
+
+#if OLD_DVIPS
+ /* Parse lines like `Symbol-Slanted "/Symbol .167 SlantFont"'. */
+ if (*(p = specinf) == '/') {
+ PSname = ++p;
+ while (*p && !isspace(*p)) ++p;
+ if (*p) *p++ = '\0';
+ specinf = p;
+ }
+#endif /* OLD_DVIPS */
+
+ if (specinf != NULL) {
+ *specp = '\0';
+ specinfo = specinf;
+ }
+
+ if (PSname == NULL)
+ PSname = fontname;
+
+ /*
+ * Start up Ghostscript.
+ */
+
+#ifdef KPATHSEA
+ searchpath = kpse_find_file("render.ps", kpse_tex_ps_header_format,
+ true);
+ render_ps = searchpath ? fopen (searchpath, FOPEN_R_MODE) : NULL;
+#else
+ render_ps = search(config_file_header_path, "DVIPSHEADERS",
+ "render.ps");
+#endif
+ if (render_ps == NULL)
+ oops("Cannot find PS driver file \"render.ps\".");
+ fclose(render_ps);
+
+#if !_AMIGA
+ substarg = xmalloc(strlen(PSname) + 13);
+ sprintf(substarg, "-sSUBSTFONT=%s", PSname);
+#endif
+
+ sprintf(dpistr, "%f", dpi);
+
+#if _AMIGA
+
+ mktemp(tmpname);
+
+ sprintf(fngs, "fifo:%s/rweK", tmpname);
+ sprintf(fngsf, "fifo:%s/rweKm", tmpname);
+
+ std_in[1] = open(fngsf, O_WRONLY|O_TRUNC|O_CREAT, 511);
+
+ if (std_in[1] == -1) {
+ perror("pipe");
+ return 1;
+ }
+
+ in = Open(fngs, MODE_OLDFILE);
+ out = Open(fngs, MODE_NEWFILE);
+
+ if (in && out) {
+ int error;
+ char *cmd;
+ char formatstr[] = "%s -dNODISPLAY -dNOGC -sSUBSTFONT=\"%s\" -q -- \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"";
+ unsigned int len;
+
+ len = sizeof formatstr + strlen(gspath) + strlen(searchpath)
+ + 2 * strlen(PSname) + (dlstring != NULL ? strlen(dlstring) : 0)
+ + strlen(specinfo) + strlen(dpistr);
+
+ cmd = xmalloc(len);
+
+ sprintf(cmd, formatstr, PSname, gspath, searchpath, PSname,
+ dlstring != NULL ? dlstring : "", specinfo, dpistr);
+
+ error = SystemTags(cmd, SYS_Input, in,
+ SYS_Output, out,
+ SYS_Asynch, TRUE,
+ /* NP_StackSize, 50000, */
+ TAG_DONE, TAG_DONE);
+ free(cmd);
+
+ if (error == -1) {
+ Close(in);
+ Close(out);
+ PrintFault(error, "System(gs)");
+ exit(1);
+ }
+ }
+ else {
+ perror("pipes");
+ if (in) Close(in);
+ if (out) Close(out);
+ exit(1);
+ }
+
+#elif WIN32
+
+ /* (later) */
+
+#else /* neither _AMIGA nor WIN32 */
+
+ if (pipe(std_in) != 0 || pipe(std_out) != 0) {
+ perror("pipe");
+ return 1;
+ }
+
+ /* Catch the signal for death of the child process. */
+
+#if HAVE_SIGACTION
+ sigact.sa_handler = handle_sigchild;
+ (void) sigemptyset(&sigact.sa_mask);
+ sigact.sa_flags = SA_NOCLDSTOP;
+ (void) sigaction(SIGCHLD, &sigact, (struct sigaction *) NULL);
+#else
+ (void) signal(SIGCHLD, handle_sigchild);
+#endif
+
+ /*
+ * Also catch various termination signals, so that we can kill the
+ * gs process before terminating.
+ */
+
+ (void) signal(SIGHUP, handle_sigterm);
+ (void) signal(SIGINT, handle_sigterm);
+ (void) signal(SIGQUIT, handle_sigterm);
+ (void) signal(SIGTERM, handle_sigterm);
+
+ fflush(stderr); /* to avoid double flushing */
+ gs_pid = vfork();
+ if (gs_pid == 0) {
+ close(std_in[1]);
+ dup2(std_in[0], 0);
+ close(std_in[0]);
+ close(std_out[0]);
+ dup2(std_out[1], 1);
+ close(std_out[1]);
+ execlp(gspath, "gs", "-dNODISPLAY", "-dNOGC", substarg, "-q", "--",
+ /* render.ps */ searchpath,
+ PSname,
+ dlstring != NULL ? dlstring : "", specinfo, dpistr, NULL);
+ if (col != 0) {
+ putc('\n', stderr);
+ col = 0;
+ }
+ perror(gspath);
+ exit(1);
+ }
+ if (gs_pid == -1) {
+ perror("fork");
+ exit(1);
+ }
+
+#endif /* neither _AMIGA nor WIN32 */
+
+ /*
+ * Open and read the tfm file. If this takes a while, at least
+ * it can overlap with the startup of Ghostscript.
+ */
+
+ xfilename = xmalloc(fontlen + 10);
+ strcpy(xfilename, fontname);
+#ifdef KPATHSEA
+#if _AMIGA
+ strcpy(tfm_path, kpse_find_file(xfilename, kpse_tfm_format, true));
+ tfm_file = fopen(tfm_path, "r");
+#else
+ tfm_file = kpse_open_file(xfilename, kpse_tfm_format);
+#endif /* _AMIGA */
+#else /* not KPATHSEA */
+ strcpy(xfilename + fontlen, ".tfm");
+ tfm_file = search(TFMPATH, "TEXFONTS", xfilename);
+#endif /* not KPATHSEA */
+ if (tfm_file == NULL) oops("Cannot find tfm file.");
+
+ for (i = 0; i < 12; ++i) {
+ int j;
+
+ j = (int) ((byte) getc(tfm_file)) << 8;
+ tfm_lengths[i] = j | (int) ((byte) getc(tfm_file));
+ }
+ checksum = getlong(tfm_file);
+ design = getlong(tfm_file);
+ fseek(tfm_file, 4 * (lh + 6), 0);
+ p = charlist;
+ for (cc = bc; cc <= ec; ++cc) {
+ width_index[cc] = (byte) getc(tfm_file);
+ if (width_index[cc] != 0) {
+ sprintf(p, "%d ", cc);
+ p += strlen(p);
+ }
+ (void) getc(tfm_file);
+ (void) getc(tfm_file);
+ (void) getc(tfm_file);
+ }
+ for (i = 0; i < nw; ++i) tfm_widths[i] = getlong(tfm_file);
+ fclose(tfm_file);
+ p[-1] = '\n';
+
+ sprintf(designstr, "%f\n", (float) design / (1 << 20));
+
+#if !WIN32
+
+ /* write the design size and character list to the file */
+ write(std_in[1], designstr, strlen(designstr));
+ write(std_in[1], charlist, p - charlist);
+
+ close(std_in[1]);
+
+#else /* WIN32 */
+
+ if (gs_locate() == NULL) {
+ fprintf(stderr, "\nCan't locate Ghostscript ! Exiting ...\n");
+ return EXIT_FAILURE;
+ }
+
+ SetConsoleCtrlHandler(handle_sigterm, TRUE);
+
+ hGsDataIn = CreateEvent(NULL, FALSE, FALSE, "gsDataIn");
+ hGsDataOut = CreateEvent(NULL, FALSE, FALSE, "gsDataOut");
+
+ gs_argv[3] = substarg;
+ gs_argv[6] = searchpath;
+ gs_argv[7] = PSname;
+ gs_argv[8] = dlstring != NULL ? dlstring : "";
+ gs_argv[9] = specinfo;
+ gs_argv[10] = dpistr;
+
+ buffer_stdin = concat(designstr, charlist);
+
+ if ((hGsThread = CreateThread(NULL, /* security attributes */
+ 0, /* default stack size */
+ Win32GsSendData, /* start address of thread */
+ 0, /* parameter */
+ 0, /* creation flags */
+ &idGsThread /* thread id */
+ )) == NULL)
+ Win32Error("CreateThread");
+
+#endif /* WIN32 */
+
+/*
+ * Read the output from Ghostscript.
+ */
+
+#if _AMIGA
+
+ if ((data_file = fopen(fngsf, "r")) == NULL) {
+ perror("GS_out");
+ exit(1);
+ }
+
+#elif WIN32
+
+ /* Nothing */
+
+#else /* neither _AMIGA nor WIN32 */
+
+ data_fd = std_out[0];
+
+ /* Set data_fd for non-blocking I/O */
+ if (fcntl(data_fd, F_SETFL, fcntl(data_fd, F_GETFL, 0) | O_NONBLOCK)
+ == -1)
+ perror("fcntl");
+
+#endif /* neither _AMIGA nor WIN32 */
+
+/*
+ * Create pk file and write preamble.
+ */
+
+ if (dosnames)
+ strcpy(xfilename + fontlen, ".pk");
+ else
+ sprintf(xfilename + fontlen, ".%dpk", (int) (dpi + 0.5));
+
+ if ((pk_file = fopen(xfilename, FOPEN_WBIN_MODE)) == NULL) {
+ perror(xfilename);
+ exit_toto_too();
+ }
+ putc(PK_PRE, pk_file);
+ putc(PK_ID, pk_file);
+ expect("V"); /* get GS version */
+ i = strlen(line) - 2;
+ if (i < 0 || i > 10) i = 0;
+ line[1] = '/';
+ if (!quiet) {
+ if (i > 0) fwrite(line + 1, 1, i, stdout);
+ putchar('\n');
+ col = 0;
+ }
+ putc(sizeof(progname) + sizeof(version) + i - 2, pk_file);
+ fwrite(progname, 1, sizeof(progname) - 1, pk_file);
+ fwrite(version, 1, sizeof(version) - 1, pk_file);
+ if (i >= 0) {
+ fwrite(line + 1, 1, i, pk_file);
+ }
+ putlong(design);
+ putlong(checksum);
+ ppp = dpi / 72.27 * 65536.0 + 0.5;
+ putlong(ppp); /* hppp */
+ putlong(ppp); /* vppp */
+
+/*
+ * Write the actual characters.
+ */
+
+ for (cc = bc; cc <= ec; ++cc)
+ if (width_index[cc] != 0)
+ putglyph(cc);
+
+#if _AMIGA
+
+ fclose(data_file);
+
+#elif WIN32
+
+ /* Release data buffer, enable thread to terminate */
+ SetEvent(hGsDataOut);
+
+#ifdef DEBUG
+ fprintf(stderr, "Waiting for thread ... \n");
+#endif
+ if (hGsThread) {
+ switch (WaitForSingleObject(hGsThread, 2000)) {
+ case WAIT_OBJECT_0:
+ CloseHandle(hGsThread);
+ hGsThread = NULL;
+ break;
+ case WAIT_TIMEOUT:
+ fprintf(stderr, "Timeout waiting for Gs thread.\n");
+ break;
+ case WAIT_FAILED:
+ fprintf(stderr, "WaitForSingleObject failed on Gs thread (Error code %d).\n",
+ GetLastError());
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (hGsThread) {
+ if (TerminateThread(hGsThread, 1) == 0) {
+ fprintf(stderr, "... couldn't terminate gs thread\n");
+ }
+ CloseHandle(hGsThread);
+ /* FIXME : is it right to call this ? */
+ gs_dll_release();
+ }
+ if (hGsDataIn)
+ CloseHandle(hGsDataIn);
+ if (hGsDataOut)
+ CloseHandle(hGsDataOut);
+
+#else /* neither _AMIGA nor WIN32 */
+
+ close(data_fd);
+ if (!gs_is_done)
+ wait_for_gs();
+
+#endif /* neither _AMIGA nor WIN32 */
+
+/*
+ * Write out identifying specials:
+ * jobname=(font)
+ * mag=1
+ * mode=modeless
+ * pixels_per_inch=(dpi)
+ */
+
+ putspecl("jobname=", fontname);
+ putspecl("mag=1", NULL);
+ putspecl("mode=modeless", NULL);
+ sprintf(dpistr, "%d", (int) dpi);
+ putspecl("pixels_per_inch=", dpistr);
+
+/*
+ * Postamble
+ */
+
+ putc(PK_POST, pk_file);
+ while (ftell(pk_file) % 4 != 0) putc(PK_NOP, pk_file);
+ fclose(pk_file);
+ if (!quiet) putchar('\n');
+ col = 0;
+
+#if _AMIGA
+ /* [CL] 21-Jun-97
+ The same silly thing to indicate the path of the tfm file
+ */
+ {
+ char tmpstr[80];
+
+ sprintf(tmpstr, "GSFTOPKTFM=%s", tfm_path);
+ putenv(tmpstr);
+ }
+#endif
+
+ return 0;
+}
diff --git a/Build/source/texk/gsftopk/gsftopk.rc b/Build/source/texk/gsftopk/gsftopk.rc
new file mode 100644
index 00000000000..018d762c080
--- /dev/null
+++ b/Build/source/texk/gsftopk/gsftopk.rc
@@ -0,0 +1,34 @@
+/* afm2tfm.rc: afm2tfm resources -*- C++ -*-
+
+ Copyright (C) 1996-2003 Fabrice Popineau <fabrice.popineau@supelec.fr>
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ This file is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this file; if not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#include <texlive-version.h>
+
+#define VER_FILEVERSION TEXLIVE_MAJOR_VERSION,TEXLIVE_MINOR_VERSION,TEXLIVE_BETA_NUMBER,TEXLIVE_ALPHA_NUMBER
+#define VER_FILEVERSION_STR TEXLIVE_PRODUCTVERSION_STR "gsftopk(k) 1.19.2"
+
+#define VER_INTERNALNAME_STR "gsftopk"
+#define VER_ORIGINALFILENAME_STR "gsftopk.exe"
+
+#define VER_FILEDESCRIPTION_STR "Translates PostScript Type 1 fonts to PK bitmap fonts"
+
+#define VER_LEGALCOPYRIGHT_STR "Copyright 1993-1999 Paul Vojta"
+
+#include <texlive.version>
+
+/* gsftopk.rc ends here */
diff --git a/Build/source/texk/gsftopk/gsftopk1.sed b/Build/source/texk/gsftopk/gsftopk1.sed
new file mode 100644
index 00000000000..1f3d9497596
--- /dev/null
+++ b/Build/source/texk/gsftopk/gsftopk1.sed
@@ -0,0 +1,314 @@
+.\" Copyright (c) 1993-1998 Paul Vojta
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a copy
+.\" of this software and associated documentation files (the "Software"), to
+.\" deal in the Software without restriction, including without limitation the
+.\" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+.\" sell copies of the Software, and to permit persons to whom the Software is
+.\" furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice shall be included in
+.\" all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+.\" PAUL VOJTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+.\" IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+.\"
+
+.\" small and boldface (not all -man's provide it)
+.de SB
+\&\fB\s-1\&\\$1 \\$2\s0\fR
+..
+.TH GSFTOPK 1 "28 November 1998"
+.SH NAME
+gsftopk \- render a ghostscript font in TeX pk form
+.SH SYNOPSIS
+.B gsftopk
+[\-i \fIpath\fP]
+[\-q]
+[\-t]
+#ifkpathsea
+[\-\-debug=\fIn\fP]
+#endif
+[\-\-dosnames]
+[\-\-interpreter=\fIpath\fP]
+[\-\-mapline=\fIline\fP]
+[\-\-mapfile=\fIfile\fP]
+[\-\-quiet]
+[\-\-test]
+[\-\-help]
+[\-\-version]
+.I font
+.I dpi
+.SH ARGUMENTS
+.IP \fIfont\fP \w'\fIfont\fP'u+2m
+Name of the font to be created.
+.IP \fIdpi\fP
+Desired resolution of the font to be created, in dots per inch. This may
+be a real number.
+.SH DESCRIPTION
+.B gsftopk
+is a program which calls up the ghostscript program
+.BR gs (1)
+to render a given font at a given resolution. It packs the resulting
+characters into the
+.B pk
+file format and writes them to a file whose name is formed from the font
+name and the resolution (rounded to the nearest integer). The font may
+be in any format acceptable to Ghostscript, including
+.RI . pfa ,
+.RI . pfb ,
+.RI . gsf ,
+and
+.RI . ttf
+files.
+.PP
+This program should normally be called by a script, such as
+.BR mktexpk ,
+to create fonts on demand.
+.PP
+.B gsftopk
+obtains the character widths from the
+.RI . tfm
+file, which must exist in the standard search path. It also must be
+able to find the font in a map file (such as
+.BR psfonts.map ),
+formatted as in
+.BR dvips (1)),
+unless the
+.B \-\-mapline
+option is used. The set of map files is given by the
+.B \-\-mapfile
+option, or in the files
+.BR config.ps ,
+.BR $HOME/.dvipsrc ,
+and
+.B config.gsftopk
+(as would be used by
+.BR "dvips -Pgsftopk" ).
+.PP
+The following
+.B pk
+"specials" are added at the end of the output file, to provide an internal
+check on the contents of the file:
+"\fBjobname=\fP\fIfont\fP",
+"\fBmag=1\fP",
+"\fBmode=modeless\fP", and
+"\fBpixels_per_inch=\fP\fIdpi\fP".
+This is in accordance with the TeX Directory Standard (TDS).
+.SH OPTIONS
+#ifkpathsea
+.TP
+.B \-\-debug=\fIn\fP
+Set the
+.B Kpathsea
+debug flags according to the integer
+.IR n .
+#endif
+.TP
+.B \-\-dosnames
+Use a name of the form
+.IB font .pk
+instead of
+.IB font . dpi pk\fR.\fP
+.TP
+.B \-h\fR,\fP \-\-help
+Print a brief help synopsis and exit.
+.TP
+.B \-i \fIpath\fP\fR,\fP \-\-interpreter=\fIpath\fP
+Use
+.I path
+as the Ghostscript interpreter.
+.TP
+.B \-\-mapfile=\fIfile\fP
+Use
+.I file
+to look for the map information for
+.IR font .
+This should be the full name of the file (in other words, no path searching
+algorithms are applied).
+.TP
+.B \-\-mapline=\fIline\fP
+Use
+.I line
+instead of looking for an entry in a map file.
+The first word of
+.I line
+must match
+.IR font .
+.TP
+.B \-q\fR,\fP \-\-quiet
+Operate quietly; i.e., without writing any messages to the standard output.
+.TP
+.B \-t\fR,\fP \-\-test
+Test run: return zero status if the font can be found in the map file(s),
+and nonzero status if it cannot. If this option is specified, then the
+.I dpi
+argument is optional (since the font will not be generated).
+.TP
+.B \-v\fR,\fP \-\-version
+Print the version number and exit.
+.SH ENVIRONMENT VARIABLES
+.IP \fBDVIPSRC\fP \w'\fBGSFTOPKHEADERS\fP'u+2m
+Name of file to read instead of
+.BR $HOME/.dvipsrc .
+This should be the full name of the file (in other words, no path searching
+algorithms are applied).
+.IP \fBGSFTOPKFONTS\fP
+See
+.SB TEXFONTS.
+.IP \fBGSFTOPKHEADERS\fP
+See
+.SB TEXPSHEADERS.
+.IP \fBPSHEADERS\fP
+See
+.SB TEXPSHEADERS.
+.IP \fBTEXCONFIG\fP
+Colon-separated list of paths to search for map files.
+An extra colon in the list will include the
+compiled-in default paths at that point. A double slash will enable recursive
+subdirectory searching at that point in the path.
+.IP \fBTEXFONTS\fP
+Colon-separated list of paths to search for the
+.RI . tfm
+file associated with the font. Double slashes and extra colons behave as with
+.SB TEXCONFIG.
+This information may also be supplied by using the environment variables
+.SB TFMFONTS
+or
+.SB GSFTOPKFONTS.
+These environment variables are checked in the order
+.SB GSFTOPKFONTS,
+.SB TFMFONTS,
+.SB TEXFONTS;
+the first one (if any) having a value is used.
+.IP \fBTEXPSHEADERS\fP
+Colon-separated list of paths to search for the Ghostscript driver file
+.B render.ps
+and for any PostScript header or font files
+.RI (. enc ,
+.RI . pfa ,
+.RI . pfb ,
+.RI . gsf ,
+or
+.RI . ttf
+files). Double slashes and extra colons behave as with
+.SB TEXCONFIG.
+This information may also be supplied by using the environment variables
+.SB PSHEADERS
+or
+.SB GSFTOPKHEADERS.
+These environment variables are checked in the order
+.SB GSFTOPKHEADERS,
+.SB TEXPSHEADERS,
+.SB PSHEADERS;
+the first one (if any) having a value is used.
+.IP \fBTFMFONTS\fP
+See
+.SB TEXFONTS.
+.SH CONFIGURATION
+In order to determine the set of map files to be used and the path for
+finding PostScript files,
+.B gsftopk
+reads, in order, the files
+.BR config.ps ,
+.BR .dvipsrc ,
+and
+.BR config.gsftopk .
+The files
+.B config.ps
+and
+.B config.gsftopk
+are searched for using the environment variable
+#ifnokpathsea
+.SB TEXCONFIG
+#endif
+#ifkpathsea
+.SB TEXCONFIG,
+the
+.B Kpathsea
+configuration file,
+#endif
+or the compiled-in default paths. The file
+.B .dvipsrc
+is searched for in the user's home directory.
+.PP
+These files are in the same format as for
+.B dvips
+(as well as being in the same locations). The entries used by
+.B gsftopk
+are as follows.
+.TP
+.RI "H " path
+Indicates that the Ghostscript driver file
+.B render.ps
+and the PostScript header and font files are to be searched for using
+.IR path .
+.TP
+.RI "p " file
+Indicates that the list of map files is to be erased and replaced by
+.IR file .
+.TP
+.RI "p +" file
+Indicates that
+.I file
+is to be added to the list of map files.
+.PP
+All other entries are ignored.
+.PP
+This is similar to the handling of these options when running
+.BR "dvips -Pgsftopk" .
+#ifkpathsea
+For more details, see the
+.B Kpathsea
+manual.
+#endif
+.SH BUGS
+.B gsftopk
+sometimes has trouble with fonts with very complicated characters
+(such as the Seal of the University of California). This is because
+.B gsftopk
+uses the
+.B charpath
+operator to determine the bounding box of each character. If the character
+is too complicated, then old versions of Ghostscript fail, causing
+.B gsftopk
+to terminate with an error message
+.IP
+.B "Call to gs stopped by signal 10"
+.LP
+(The number may vary from system to system; it corresponds to a bus error
+or a segmentation fault.) The best way to fix this bug is to install a
+current version of ghostscript. As an alternative,
+.B gsftopk
+can be instructed to use the bounding box provided with the font (if one
+exists) instead of finding a bounding box for each character. To do this,
+include the string
+.IP
+.B /usefontbbox true def
+.LP
+in the font map file;
+.IR e.g. ,
+.IP
+.B ucseal """/usefontbbox true def"""
+.LP
+This will not affect use of the font by
+.BR dvips .
+.SH SEE ALSO
+.BR gs (1),
+.BR gftopk (1),
+.BR tex (1),
+.BR xdvi (1),
+.BR dvips (1)
+.SH AUTHOR
+Written by Paul Vojta. This program was inspired by Karl Berry's
+.BR gsrenderfont .
+#ifkpathsea
+.SH MODIFICATIONS
+Modified by Yves Arrouye to use Karl Berry's
+.B Kpathsea
+library.
+#endif
diff --git a/Build/source/texk/gsftopk/mksedscript b/Build/source/texk/gsftopk/mksedscript
new file mode 100755
index 00000000000..0c81636457b
--- /dev/null
+++ b/Build/source/texk/gsftopk/mksedscript
@@ -0,0 +1,22 @@
+#!/bin/sh
+KPATHSEA=''
+
+while test $# -gt 0
+do
+ case $1 in
+ -DKPATHSEA) KPATHSEA=y;;
+ esac
+ shift
+done
+
+if test -z "$KPATHSEA"
+then
+ echo '/^#ifkpathsea/,/^#/d'
+else
+ echo '/^#ifnokpathsea/,/^#/d'
+ echo 's/TEXFONTS/TFMFONTS/g'
+fi
+
+echo '/^#/d'
+
+exit 0
diff --git a/Build/source/texk/gsftopk/render.ps b/Build/source/texk/gsftopk/render.ps
new file mode 100644
index 00000000000..2c067451b97
--- /dev/null
+++ b/Build/source/texk/gsftopk/render.ps
@@ -0,0 +1,346 @@
+% render.ps - write font bitmaps and metric information to standard output.
+% Version 1.18.
+
+% ========================================================================
+%
+% Copyright (c) 1993-1998 Paul Vojta
+%
+% Permission is hereby granted, free of charge, to any person obtaining a copy
+% of this software and associated documentation files (the "Software"), to
+% deal in the Software without restriction, including without limitation the
+% rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+% sell copies of the Software, and to permit persons to whom the Software is
+% furnished to do so, subject to the following conditions:
+%
+% The above copyright notice and this permission notice shall be included in
+% all copies or substantial portions of the Software.
+%
+% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+% PAUL VOJTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+% IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+%
+% ========================================================================
+
+%%%
+% Usage: gs -DNODISPLAY -q -- render.ps fontname dlstring specinfo dpi
+% Then, it will read standard input to get:
+% pointsize
+% charset
+
+% Example:
+% % gs -DNODISPLAY -q -- render.ps Helvetica "(phvr.gsf) run" \
+% > ".5 ExtendFont" 300
+% GS> 10
+% GS> 97 98 99
+
+/TeXDict currentdict def % needed by dotlessj.pro
+
+%%
+%
+% Standard file definitions
+
+/.stdin where { pop } { /.stdin (%stdin) (r) file def } ifelse
+
+/bad-stdout false def
+/.stdout where
+ { pop }
+ { { /.stdout (%stdout) (w) file def } stopped
+ { /bad-stdout true def }
+ if
+ } ifelse
+
+/bad-stderr false def
+/.stderr where
+ { pop }
+ { { /.stderr (%stderr) (w) file def } stopped
+ { /bad-stderr true def }
+ if
+ } ifelse
+
+%%
+%
+% Define some routines first
+
+% (string) fatal -
+% Print string to stderr and quit.
+
+/fatal
+ bad-stderr
+ {{
+ (\nrender.ps: ) exch concatstrings
+ print flush 1 .quit
+ }}
+ {{
+ (\nrender.ps: ) exch concatstrings
+ .stderr exch writestring .stderr flushfile 1 .quit
+ }}
+ ifelse
+bind def
+
+% (string) brun -
+% Load a font in .pfb format.
+
+/brun
+ {
+ (r) file false /PFBDecode filter cvx exec
+ }
+bind def
+
+% (string) ttload font
+% Load a TrueType font (and leave it on the stack).
+
+/ttload
+ {
+ FontOnStack
+ {
+ (Cannot load more than one TrueType font!\n) fatal
+ } if
+ (r) file .loadttfont
+ /FontOnStack true def
+ }
+bind def
+
+/FontOnStack false def
+
+% (exec) getbbox -
+% Get bounding box of the executable object and save it in char-urx,
+% char-ury, etc.
+
+/getbbox
+ {
+ gsave
+ nulldevice
+ erasepage
+ newpath
+ exec
+ pathbbox % returns llx lly urx ury
+ /char-ury exch ceiling cvi def
+ /char-urx exch ceiling cvi def
+ /char-lly exch floor cvi def
+ /char-llx exch floor cvi def
+ grestore
+ }
+bind def
+
+% - drawfontbbox -
+% Draw the font's bbox.
+
+/drawfontbbox
+ {
+ currentfont /FontBBox get
+ dup dup 0 get exch 1 get currentfont /FontMatrix get transform moveto
+ dup dup 0 get exch 3 get currentfont /FontMatrix get transform lineto
+ dup dup 2 get exch 1 get currentfont /FontMatrix get transform lineto
+ dup 2 get exch 3 get currentfont /FontMatrix get transform lineto
+ }
+bind def
+
+% (exec) mkbboxdev -
+% Get bounding box of the executable object and make a device a few
+% pixels larger on each side. If pathbbox fails for the object,
+% then use the font's bbox.
+
+/mkbboxdev
+ {
+ getbbox
+
+ char-llx char-urx sub round 0 eq char-lly char-ury sub round 0 eq or
+ {
+ {drawfontbbox} getbbox
+ }
+ if
+
+ matrix
+ char-urx char-llx sub 4 add % width
+ dup /width exch def
+ char-ury char-lly sub 4 add % height
+ dup /height exch def
+ <ff 00>
+ makeimagedevice setdevice
+ 2 char-llx sub 2 char-lly sub translate
+ }
+bind def
+
+%%
+%
+% These may be called by the "specinfo" string.
+
+/usefontbbox false def
+
+% These do things to a transformation array; called by entries in psfonts.map.
+%
+/ObliqueSlant {dup sin exch cos div neg} bind def
+/SlantFont {font-size mul add} def
+/ExtendFont {3 -1 roll mul exch} def
+/ReEncodeFont {/Encoding exch def} def
+
+% Define writeppmfile, if it's not provided, or if the symbol .stdout is not
+% available.
+
+/our-writeppmfile
+
+ bad-stdout
+ systemdict /writeppmfile known not
+ or
+ {{
+ (P4\n) print
+ width =string cvs print
+ ( ) print
+ height =string cvs print
+ (\n) print
+
+ width 7 add 8 div cvi string
+ 0 1 height 1 sub
+ {
+ currentdevice exch 2 index copyscanlines
+ print
+ }
+ for
+ pop % discard string
+ }}
+ {{
+ .stdout currentdevice writeppmfile
+ }}
+ ifelse
+def
+
+
+%%
+%
+% Main program begins now. Just interpret it.
+
+% Get arguments.
+
+shellarguments not
+ {
+ (You must provide arguments to the shell!\n) fatal
+ }
+if
+
+/dpi exch cvr def
+/specinfo exch def
+/dlstring exch def
+/fontname exch def
+
+% Return the gs version number to the calling program.
+
+(V ) print revision =
+
+% Open the font.
+
+dlstring () ne
+ {
+ dlstring cvx exec
+ }
+if
+
+FontOnStack not
+ {
+ Fontmap fontname cvn known % Or: fontname cvn /Font resourcestatus?
+ {
+ fontname cvlit findfont
+ }
+ {
+ FontDirectory fontname cvn known
+ {
+ fontname cvlit findfont
+ }
+ {
+ revision 341 lt
+ {
+ /defaultfontname fontname cvlit def
+ }
+ if
+
+ { fontname cvlit findfont } stopped
+ {
+ (font ) fontname concatstrings
+ ( is not defined.\n) concatstrings
+ fatal
+ }
+ if
+ }
+ ifelse
+ }
+ ifelse
+ }
+if
+
+% Get arguments from stdin. Just leave the character list on the stack.
+
+/font-size
+ .stdin 20 string readline pop cvr % get pointsize
+ 72.27 div dpi mul % let's work in (TeX) points
+def
+[ .stdin 1024 string readline pop cvx exec ] % character list
+
+% Define the font, and make it current.
+
+ % Get the font.
+ exch
+ % Copy over the font dictionary to make it writable;
+ % this makes ReEncodeFont easier, and is needed for dotless j processing.
+ dup length 1 add dict begin
+ {1 index /FID ne {def}{pop pop} ifelse} forall
+ % Now do the transformations specified in psfonts.map.
+ [ font-size 0 specinfo cvx exec 0 exch font-size 0 0 ]
+ % End the current dictionary, and make it a font.
+ /TargetFont currentdict end definefont
+ % Apply the tranformation matrix and make the font current.
+exch makefont dup /TargetFont exch def setfont
+
+% If the font's bounding box is zero, then do not use it.
+
+usefontbbox
+ { currentfont /FontBBox get
+ true exch {0 eq and} forall
+ {/usefontbbox false def}if
+ }
+if
+
+% If we are to use the font's bounding box, then get it and transform it.
+
+usefontbbox
+ {
+ {drawfontbbox} mkbboxdev
+ }
+if
+
+% Begin loop over characters.
+
+ {
+ /charno exch def
+ /charstring 1 string dup 0 charno put def
+ /charwidth charstring stringwidth pop def
+
+ % Get the character's bounding box. This also makes the device.
+ usefontbbox not
+ {
+ { 0 0 moveto charstring true charpath } mkbboxdev
+ }
+ if
+
+ % Print the metric info.
+ (#^ ) print
+ charno =string cvs print
+ ( ) print
+ char-llx =string cvs print
+ ( ) print
+ char-lly =string cvs print
+ ( ) print
+ char-urx =string cvs print
+ ( ) print
+ char-ury =string cvs print
+ ( ) print
+ charwidth =string cvs print
+ (\n) print
+
+ % Now write the bitmap.
+ erasepage 0 0 moveto
+ charstring show
+ our-writeppmfile
+ }
+forall
diff --git a/Build/source/texk/gsftopk/stamp-auto.in b/Build/source/texk/gsftopk/stamp-auto.in
new file mode 100644
index 00000000000..0f1ac0fbc85
--- /dev/null
+++ b/Build/source/texk/gsftopk/stamp-auto.in
@@ -0,0 +1 @@
+Mo Aug 22 08:28:54 CEST 2005
diff --git a/Build/source/texk/gsftopk/version.h b/Build/source/texk/gsftopk/version.h
new file mode 100644
index 00000000000..c81cf8bff6e
--- /dev/null
+++ b/Build/source/texk/gsftopk/version.h
@@ -0,0 +1 @@
+#define VERSION "1.19.2"
diff --git a/Build/source/texk/gsftopk/win32.mak b/Build/source/texk/gsftopk/win32.mak
new file mode 100644
index 00000000000..24cac7375ad
--- /dev/null
+++ b/Build/source/texk/gsftopk/win32.mak
@@ -0,0 +1,72 @@
+################################################################################
+#
+# Makefile : Gsftopk
+# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr>
+# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources
+# Time-stamp: <02/02/28 21:06:26 popineau>
+#
+################################################################################
+root_srcdir = ..\..
+!ifdef DEVELOPMENT
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development
+!else
+INCLUDE=$(INCLUDE);$(root_srcdir)\texk
+!endif
+
+version = 1.19.2
+
+USE_GNUW32 = 1
+USE_GSW32 = 1
+USE_KPATHSEA = 1
+USE_ADVAPI = 1
+
+!include <msvc/common.mak>
+
+# See INSTALL for compilation options.
+DEFS = $(DEFS) -DHAVE_CONFIG_H
+
+objects = $(objdir)\gsftopk.obj
+
+programs = $(objdir)\gsftopk.exe
+
+etcdir = $(psheaderdir)\gsftopk
+etcfiles = render.ps
+
+manfiles = gsftopk.1
+
+default: all
+
+all: $(objdir) $(programs)
+
+$(objdir)\gsftopk.exe: $(objects) $(kpathsealib) $(gsw32lib)
+ $(link) $(**) $(conlibs)
+
+gsftopk.1: gsftopk1.sed sedscript.win32
+ $(sed) -f $(srcdir)/sedscript.win32 <$(srcdir)/gsftopk1.sed >$@
+
+sedscript.win32:
+ @echo <<$@
+/^#ifnokpathsea/,/^#/d
+s/TEXFONTS/TFMFONTS/g
+/^#/d
+<<KEEP
+
+!include <msvc/config.mak>
+!include <msvc/install.mak>
+
+install:: install-exec install-data
+
+install-exec:: $(programs)
+
+!include <msvc/clean.mak>
+
+extraclean::
+ -@$(del) -f sedscript.win32 gsftopk.1
+
+!include <msvc/rdepend.mak>
+!include "./depend.mak"
+
+#
+# Local Variables:
+# mode: makefile
+# End: