changeset 2999:faa5d0421460

[project @ 1997-05-23 03:02:09 by jwe]
author jwe
date Fri, 23 May 1997 03:02:36 +0000
parents 692ba9d441ec
children 86d3a6fc4c84
files kpathsea/AUTHORS kpathsea/BUGS kpathsea/CONFIGURE kpathsea/ChangeLog kpathsea/HIER kpathsea/INSTALL kpathsea/MakeTeX.site kpathsea/MakeTeXMF kpathsea/MakeTeXPK kpathsea/MakeTeXTFM kpathsea/MakeTeXcommon kpathsea/MakeTeXls-R kpathsea/MakeTeXmkdir kpathsea/MakeTeXnames kpathsea/MakeTeXnames.cnf kpathsea/MakeTeXupdate kpathsea/Makefile kpathsea/Makefile.in kpathsea/NEWS kpathsea/PROJECTS kpathsea/README kpathsea/absolute.c kpathsea/absolute.h kpathsea/acconfig.h kpathsea/atou.c kpathsea/basename.c kpathsea/bugs.texi kpathsea/c-auto.h kpathsea/c-auto.h.in kpathsea/c-ctype.h kpathsea/c-dir.h kpathsea/c-errno.h kpathsea/c-fopen.h kpathsea/c-limits.h kpathsea/c-memstr.h kpathsea/c-minmax.h kpathsea/c-namemx.h kpathsea/c-pathch.h kpathsea/c-pathmx.h kpathsea/c-proto.h kpathsea/c-stat.h kpathsea/c-std.h kpathsea/c-unistd.h kpathsea/c-vararg.h kpathsea/cnf.c kpathsea/cnf.h kpathsea/common.ac kpathsea/concat.c kpathsea/concat3.c kpathsea/concatn.c kpathsea/concatn.h kpathsea/config.cache kpathsea/config.h kpathsea/config.log kpathsea/config.status kpathsea/configure kpathsea/configure.in kpathsea/db.c kpathsea/db.h kpathsea/debug.c kpathsea/debug.h kpathsea/default.h kpathsea/dir.c kpathsea/elt-dirs.c kpathsea/expand.c kpathsea/expand.h kpathsea/extend-fname.c kpathsea/file-p.c kpathsea/find-suffix.c kpathsea/fn.c kpathsea/fn.h kpathsea/fontmap.c kpathsea/fontmap.h kpathsea/getopt.c kpathsea/getopt.h kpathsea/getopt1.c kpathsea/hash.c kpathsea/hash.h kpathsea/hier.texi kpathsea/install.texi kpathsea/kdefault.c kpathsea/klibtool.version kpathsea/kpathsea.aux kpathsea/kpathsea.cps kpathsea/kpathsea.h kpathsea/kpathsea.info kpathsea/kpathsea.texi kpathsea/kpsewhich.c kpathsea/lib.h kpathsea/line.c kpathsea/line.h kpathsea/magstep.c kpathsea/magstep.h kpathsea/make-suffix.c kpathsea/make/ChangeLog kpathsea/make/README kpathsea/make/clean.make kpathsea/make/common.make kpathsea/make/config.make kpathsea/make/dist.make kpathsea/make/library.make kpathsea/make/makevars.make kpathsea/make/paths.make kpathsea/make/programs.make kpathsea/make/rdepend.make kpathsea/make/texi.make kpathsea/make/tkpathsea.make kpathsea/path-elt.c kpathsea/pathsearch.c kpathsea/pathsearch.h kpathsea/proginit.c kpathsea/proginit.h kpathsea/progname.c kpathsea/progname.h kpathsea/putenv.c kpathsea/readable.c kpathsea/readable.h kpathsea/rm-suffix.c kpathsea/stamp-auto kpathsea/stamp-auto.in kpathsea/str-list.c kpathsea/str-list.h kpathsea/str-llist.c kpathsea/str-llist.h kpathsea/strcasecmp.c kpathsea/strstr.c kpathsea/strtol.c kpathsea/systypes.h kpathsea/tex-file.c kpathsea/tex-file.h kpathsea/tex-glyph.c kpathsea/tex-glyph.h kpathsea/tex-hush.c kpathsea/tex-hush.h kpathsea/tex-make.c kpathsea/tex-make.h kpathsea/texmf.cnf.in kpathsea/tilde.c kpathsea/tilde.h kpathsea/truncate.c kpathsea/truncate.h kpathsea/types.h kpathsea/unixtex.texi kpathsea/uppercasify.c kpathsea/variable.c kpathsea/variable.h kpathsea/version.c kpathsea/withenable.ac kpathsea/xcalloc.c kpathsea/xfopen.c kpathsea/xfseek.c kpathsea/xftell.c kpathsea/xgetcwd.c kpathsea/xmalloc.c kpathsea/xopendir.c kpathsea/xopendir.h kpathsea/xputenv.c kpathsea/xrealloc.c kpathsea/xstat.c kpathsea/xstat.h kpathsea/xstrdup.c kpathsea/xt.ac
diffstat 162 files changed, 32612 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/kpathsea/AUTHORS
@@ -0,0 +1,10 @@
+Karl Berry wrote all files not otherwise marked, with help from Kathryn
+Hargreaves on some of the original versions.
+
+Thomas Esser originated most of the MakeTeX... scripts.
+
+The brace expansion code in expand.c was written by Brian Fox and Chet
+Ramey for Bash, the GNU shell.
+
+The implementation of the link trick in pathsearch.c is taken from GNU
+find, implemented by David MacKenzie from Matthew Farwell's suggestion.
new file mode 100644
--- /dev/null
+++ b/kpathsea/BUGS
@@ -0,0 +1,486 @@
+Contents:
+
+  Reporting bugs
+    Bug checklist
+    Mailing lists
+    Debugging
+    Logging
+    Common problems
+      Unable to find files
+      Slow path searching
+      Unable to generate fonts
+      TeX or Metafont failing
+      `XtStrings'
+      `dlopen'
+      `ShellWidgetClass'
+      Pointer combination warnings
+
+
+Reporting bugs
+==============
+
+  If you have problems or suggestions, please report them to
+<tex-k@mail.tug.org> using the bug checklist below.
+
+  Please report bugs in the documentation; not only factual errors or
+inconsistent behavior, but unclear or incomplete explanations, typos,
+wrong fonts, ...
+
+Bug checklist
+-------------
+
+  Before reporting a bug, please check below to be sure it isn't already
+known (*note Common problems::.).
+
+  Bug reports should be sent via electronic mail to
+<tex-k@mail.tug.org>, or by postal mail to 135 Center Hill Road /
+Plymouth, MA 02360 / USA.
+
+  The general principle is that a good bug report includes all the
+information necessary for reproduction.  Therefore, to enable
+investigation, your report should include the following:
+
+   * The version number(s) of the program(s) involved, and of Kpathsea
+     itself.  You can get the former by giving a sole option `--version'
+     to the program, and the latter by running `kpsewhich --version'.
+     The `NEWS' and `ChangeLog' files also contain the version number.
+
+   * The hardware, operating system (including version number),
+     compiler, and `make' program you are using (the output of `uname
+     -a' is a start on the first two, though often incomplete).  If the
+     bug involves the X window system, include X version and supplier
+     information as well (examples: X11R6 from MIT; X11R4 from HP;
+     OpenWindows 3.3 bundled with SunOS 4.1.4).
+
+   * Any options you gave to `configure'.  This is recorded in the
+     `config.status' files.
+
+     If you are reporting a bug in `configure' itself, it's probably
+     system-dependent, and it will be unlikely the maintainers can do
+     anything useful if you merely report that thus-and-such is broken.
+     Therefore, you need to do some additional work: for some bugs, you
+     can look in the file `config.log' where the test that failed should
+     appear, along with the compiler invocation and source program in
+     question.  You can then compile it yourself by hand, and discover
+     why the test failed.  Other `configure' bugs do not involve the
+     compiler; in that case, the only recourse is to inspect the
+     `configure' shell script itself, or the Autoconf macros that
+     generated `configure'.
+
+   * The log of all debugging output, if the bug is in path searching.
+     You can get this by setting the environment variable
+     `KPATHSEA_DEBUG' to `-1' before running the program.  Please look
+     at the log yourself to make sure the behavior is really a bug
+     before reporting it; perhaps "old" environment variable settings
+     are causing files not to be found, for example.
+
+   * The contents of any input files necessary to reproduce the bug.
+     For bugs in DVI-reading programs, for example, this generally
+     means a DVI file (and any EPS or other files it uses)--TeX source
+     files are helpful, but the DVI file is necessary, because that's
+     the actual program input.
+
+     GNU `shar', available from `ftp://prep.ai.mit.edu/pub/gnu' is a
+     convenient way of packaging multiple (possibly binary) files for
+     electronic mail.  If you feel your input files are too big to send
+     by email, you can ftp them to `ftp://ftp.tug.org/incoming' (that
+     directory is writable, but not readable).
+
+   * If you are sending a patch (do so if you can!), please do so in
+     the form of a context diff (`diff -c') against the original
+     distribution source.  Any other form of diff is either not as
+     complete or harder for me to understand.  Please also include a
+     `ChangeLog' entry.
+
+   * If the bug involved is an actual crash (i.e., core dump), it is
+     easy and useful to include a stack trace from a debugger (I
+     recommend the GNU debugger GDB, available from
+     `ftp://prep.ai.mit.edu/pub/gnu').  If the cause is apparent (a
+     `NULL' value being dereferenced, for example), please send the
+     details along.  If the program involved is TeX or Metafont, and
+     the crash is happening at apparently-sound code, however, the bug
+     may well be in the compiler, rather than in the program or the
+     library (*note TeX or Metafont failing: TeX or Metafont failing.).
+
+   * Any additional information that will be helpful in reproducing,
+     diagnosing, or fixing the bug.
+
+Mailing lists
+-------------
+
+  Web2c and Kpathsea in general are discussed on the mailing list
+<tex-k@mail.tug.org>.  To join, email <tex-k-request@mail.tug.org> with
+a line consisting of
+
+     subscribe YOU@YOUR.PREFERRED.EMAIL.ADDRESS
+
+in the body of the message.
+
+  You do not need to join to submit a report, nor will it affect whether
+you get a response.  There is no Usenet newsgroup equivalent (if you can
+be the one to set this up, email `tex-k-request').  Traffic on the list
+is fairly light, and is mainly bug reports and enhancement requests to
+the software.  The best way to decide if you want to join or not is
+read some of the archives from `ftp://ftp.tug.org/mail/archives/tex-k/'.
+
+  Be aware that large data files are sometimes included in bug reports.
+If this is a problem for you, do not join the list.
+
+  If you only want announcements of new releases, not bug reports and
+discussion, join <tex-archive@math.utah.edu> (via mail to
+<tex-archive-request@math.utah.edu>).
+
+  If you are looking for general TeX help, such as how to use LaTeX,
+please use the mailing list <info-tex@shsu.edu> mailing list, which is
+gatewayed to the `comp.text.tex' Usenet newsgroup (or post to the
+newsgroup; the gateway is bidirectional).
+
+Debugging
+---------
+
+  Kpathsea provides a number of runtime debugging options, detailed
+below by their names and corresponding numeric values.  When the files
+you expect aren't being found, the thing to do is enable these options
+and examine the output.
+
+  You can set these with some runtime argument (e.g., `-d') to the
+program; in that case, you should use the numeric values described in
+the program's documentation (which, for Dvipsk and Xdvik, are different
+than those below).  It's best to give the `-d' (or whatever) option
+first, for maximal output.  Dvipsk and Xdvik have additional
+program-specific debugging options as well.
+
+  You can also set the environment variable `KPATHSEA_DEBUG'; in this
+case, you should use the numbers below.  Also, if you run the program
+under a debugger and set the variable `kpathsea_debug', Also use the
+numbers below
+
+  In any case, by far the simplest value to use is `-1', which will
+turn on all debugging output.  This is usually better than guessing
+which particular values will yield the output you need.
+
+  Debugging output always goes to standard error, so you can redirect it
+easily.  For example, in Bourne-compatible shells:
+     dvips -d -1 ... 2>/tmp/debug
+
+  It is sometimes helpful to run the standalone Kpsewhich utility
+(*note Invoking kpsewhich::.), instead of the original program.
+
+  In any case, you can *not* use the *names* below; you must always use
+somebody's numbers.  (Sorry.)  To set more than one option, just sum
+the corresponding numbers.
+
+`KPSE_DEBUG_STAT (1)'
+     Report `stat'(2) calls. This is useful for verifying that your
+     directory structure is not forcing Kpathsea to do many additional
+     file tests (*note Slow path searching::., and *note Subdirectory
+     expansion::.). If you are using an up-to-date `ls-R' database
+     (*note Filename database::.), this should produce no output unless
+     a nonexistent file that must exist is searched for.
+
+`KPSE_DEBUG_HASH (2)'
+     Report lookups in all hash tables: `ls-R' and `aliases' (*note
+     Filename database::.); font aliases (*note Fontmap::.); and config
+     file values (*note Config files::.).  Useful when expected values
+     are not being found, e.g.., file searches are looking at the disk
+     instead of using `ls-R'.
+
+`KPSE_DEBUG_FOPEN (4)'
+     Report file openings and closings. Especially useful when your
+     system's file table is full, for seeing which files have been
+     opened but never closed. In case you want to set breakpoints in a
+     debugger: this works by redefining `fopen' (`fclose') to be
+     `kpse_fopen_trace' (`kpse_fclose_trace').
+
+`KPSE_DEBUG_PATHS (8)'
+     Report general path information for each file type Kpathsea is
+     asked to search. This is useful when you are trying to track down
+     how a particular path got defined--from `texmf.cnf', `config.ps',
+     an environment variable, the compile-time default, etc.  This is
+     the contents of the `kpse_format_info_type' structure defined in
+     `tex-file.h'.
+
+`KPSE_DEBUG_EXPAND (16)'
+     Report the directory list corresponding to each path element
+     Kpathsea searches. This is only relevant when Kpathsea searches
+     the disk, since `ls-R' searches don't look through directory lists
+     in this way.
+
+`KPSE_DEBUG_SEARCH (32)'
+     Report on each file search: the name of the file searched for, the
+     path searched in, whether or not the file must exist (when drivers
+     search for `cmr10.vf', it need not exist), and whether or not we
+     are collecting all occurrences of the file in the path (as with,
+     e.g., `texmf.cnf' and `texfonts.map'), or just the first (as with
+     most lookups).  This can help you correlate what Kpathsea is doing
+     with what is in your input file.
+
+  Debugging output from Kpathsea is always written to standard error,
+and begins with the string `kdebug:'. (Except for hash table buckets,
+which just start with the number, but you can only get that output
+running under a debugger. See comments at the `hash_summary_only'
+variable in `kpathsea/db.c'.)
+
+Logging
+-------
+
+  Kpathsea can record the time and filename found for each successful
+search.  This may be useful in finding good candidates for deletion when
+your filesystem is full, or in discovering usage patterns at your site.
+
+  To do this, define the environment or config file variable
+`TEXMFLOG'.  The value is the name of the file to append the
+information to.  The file is created if it doesn't exist, and appended
+to if it does.
+
+  Each successful search turns into one line in the log file: two words
+separated by a space. The first word is the time of the search, as the
+integer number of seconds since "the epoch", i.e., UTC midnight 1
+January 1970 (more precisely, the result of the `time' system call).
+The second word is the filename.
+
+  For example, after `setenv TEXMFLOG /tmp/log', running Dvips on
+`story.dvi' appends the following lines:
+
+     774455887 /usr/local/share/texmf/dvips/config.ps
+     774455887 /usr/local/share/texmf/dvips/psfonts.map
+     774455888 /usr/local/share/texmf/dvips/texc.pro
+     774455888 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmbx10.600pk
+     774455889 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmsl10.600pk
+     774455889 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmr10.600pk
+     774455889 /usr/local/share/texmf/dvips/texc.pro
+
+Only filenames that are absolute are recorded, to preserve some
+semblance of privacy.
+
+Common problems
+---------------
+
+  Here are some common problems with configuration, compilation,
+linking, execution, ...
+
+Unable to find files
+....................
+
+  If a program complains it cannot find fonts (or other input files),
+any of several things might be wrong.  In any case, you may find the
+debugging options helpful.  *Note Debugging::.
+
+   * Perhaps you simply haven't installed all the necessary files; the
+     basic fonts and input files are distributed separately from the
+     programs.  *Note unixtex.ftp::.
+
+   * You have (perhaps unknowingly) told Kpathsea to use search paths
+     that don't reflect where the files actually are.  One common cause
+     is having environment variables set from a previous installation,
+     thus overriding what you carefully set in `texmf.cnf' (*note
+     Supported file formats::.).  System `/etc/profile' or other files
+     such may be the culprit.
+
+   * Your files reside in a directory that is only pointed to via a
+     symbolic link, in a leaf directory and is not listed in `ls-R'.
+
+     Unfortunately, Kpathsea's subdirectory searching has an
+     irremediable deficiency: If a directory D being searched for
+     subdirectories contains plain files and symbolic links to other
+     directories, but no true subdirectories, D will be considered a
+     leaf directory, i.e., the symbolic links will not be followed.
+     *Note Subdirectory expansion::.
+
+     You can work around this problem by creating an empty dummy
+     subdirectory in D. Then D will no longer be a leaf, and the
+     symlinks will be followed.
+
+     The directory immediately followed by the `//' in the path
+     specification, however, is always searched for subdirectories,
+     even if it is a leaf.  Presumably you would not have asked for the
+     directory to be searched for subdirectories if you didn't want it
+     to be.
+
+   * If the fonts (or whatever) don't already exist, `MakeTeXPK' (or
+     `MakeTeXMF' or `MakeTeXTFM') will try to create them.  If these
+     rather complicated shell scripts fail, you'll eventually get an
+     error message saying something like `Can't find font FONTNAME'.
+     The best solution is to fix (or at least report) the bug in
+     `MakeTeXPK'; the workaround is to generate the necessary fonts by
+     hand with Metafont, or to grab them from a CTAN site (*note
+     unixtex.ftp::.).
+
+   * There is a bug in the library. *Note Reporting bugs::.
+
+Slow path searching
+...................
+
+  If your program takes an excessively long time to find fonts or other
+input files, but does eventually succeed, here are some possible
+culprits:
+
+   * Most likely, you just have a lot of directories to search, and that
+     takes a noticeable time. The solution is to create and maintain a
+     separate `ls-R' file that lists all the files in your main TeX
+     hierarchy.  *Note Filename database::.  Kpathsea always uses `ls-R'
+     if it's present; there's no need to recompile or reconfigure any
+     of the programs.
+
+   * Your recursively-searched directories (e.g.,
+     `/usr/local/share/texmf/fonts//'), contain a mixture of files and
+     directories. This prevents Kpathsea from using a useful
+     optimization (*note Subdirectory expansion::.).
+
+     It is best to have only directories (and perhaps a `README') in the
+     upper levels of the directory structure, and it's very important
+     to have *only* files, and no subdirectories, in the leaf
+     directories where the dozens of TFM, PK, or whatever files reside.
+
+  In any case, you may find the debugging options helpful in determining
+precisely when the disk or network is being pounded.  *Note Debugging::.
+
+Unable to generate fonts
+........................
+
+  This can happen if either `MakeTeXPK' hasn't been installed properly,
+or if the local installation of Metafont isn't correct.
+
+  If `mf' is a command not found by `MakeTeXPK', then you need to
+install Metafont (*note unixtex.ftp::.).
+
+  If Metafont runs, but generates fonts at the wrong resolution, you
+need to be sure the `M' and `D' lines in your Dvips configuration file
+match (*note Config files: (dvips)Config files.).  For example, if
+`MakeTeXPK' is generating 300dpi fonts, but you need 600dpi fonts, you
+should have:
+     M ljfour
+     D 600
+
+  If Metafont runs but generates fonts at a resolution of 2602dpi (and
+prints out the name of each character as well as just a character
+number, and maybe tries to display the characters), then your Metafont
+base file probably hasn't been made properly.  (It's using the default
+`proof' mode, instead of an actual device mode.)  To make a proper
+`plain.base', assuming the local mode definitions are contained in a
+file `modes.mf', run the following command (assuming Unix):
+
+     inimf "plain; input modes; dump"
+
+Then copy the `plain.base' file from the current directory to where the
+base files are stored on your system (`/usr/local/share/texmf/web2c' by
+default), and make a link (either hard or soft) from `plain.base' to
+`mf.base' in that directory.  *Note inimf invocation: (web2c)inimf
+invocation.
+
+TeX or Metafont failing
+.......................
+
+  If TeX or Metafont get a segmentation fault or otherwise fail while
+running a normal input file, the problem is usually a compiler bug
+(unlikely as that may sound).  Even if the trip and trap tests are
+passed, problems may lurk.  Optimization occasionally causes trouble in
+programs other than TeX and Metafont themselves, too.
+
+  Insufficient swap space may also cause core dumps or other erratic
+behavior.
+
+  For a workaround, if you enabled any optimization flags, it's best to
+omit optimization entirely.  In any case, the way to find the facts is
+to run the program under the debugger and see where it's failing.
+
+  Also, if you have trouble with a system C compiler, I advise trying
+the GNU C compiler. And vice versa, unfortunately; but in that case I
+also recommend reporting a bug to the GCC mailing list; *note Bugs:
+(gcc)Bugs..
+
+  To report compiler bugs effectively requires perseverance and
+perspicacity: you must find the miscompiled line, and that usually
+involves delving backwards in time from the point of error, checking
+through TeX's (or whatever program's) data structures.  Things are not
+helped by all-too-common bugs in the debugger itself.  Good luck.
+
+`XtStrings'
+...........
+
+  You may find that linking X programs results in an error from the
+linker that `XtStrings' is undefined, something like this:
+
+     gcc -o virmf ...
+     .../x11.c:130: undefined reference to `XtStrings'
+
+  This generally happens because of a mismatch between the X include
+files with which you compiled and the X libraries with which you linked;
+often, the include files are from MIT and the libraries from Sun.
+
+  The solution is to use the same X distribution for compilation and
+linking.  Probably `configure' was unable to guess the proper
+directories from your installation.  You can use the `configure'
+options `--x-includes=PATH' and `--x-libraries=PATH' to explicitly
+specify them.
+
+`dlopen'
+........
+
+  (This section adapted from the file `dlsym.c' in the X distribution.)
+
+  The `Xlib' library uses the standard C function `wcstombs'.  Under
+SunOS 4.1, `wcstombs' uses the `dlsym' interface defined in `libdl.so'.
+Unfortunately, the SunOS 4.1 distribution does not include a static
+`libdl.a' library.
+
+  As a result, if you try to link an X program statically under SunOS,
+you may get undefined references to `dlopen', `dlsym', and `dlclose'.
+One workaround is to include these definitions when you link:
+
+     void *dlopen() { return 0; }
+     void *dlsym()  { return 0; }
+     int dlclose()  { return -1; }
+
+These are contained in the `dlsym.c' file in the MIT X distribution.
+
+`ShellWidgetClass'
+..................
+
+  (This section adapted from the comp.sys.sun.admin FAQ.)
+
+  If you are linking with Sun's OpenWindows libraries in SunOS 4.1.x,
+you may get undefined symbols `_get_wmShellWidgetClass' and
+`_get_applicationShellWidgetClass' when linking. This problem does not
+arise using the standard MIT X libraries under SunOS.
+
+  The cause is bugs in the `Xmu' shared library as shipped from Sun.
+There are several fixes:
+
+   * Install the free MIT distribution from `ftp.x.org' and mirrors.
+
+   * Get the OpenWindows patches listed below.
+
+   * Statically link the `Xmu' library into the executable.
+
+   * Avoid using `Xmu' at all. If you are compiling Metafont, *note
+     Online Metafont graphics: (web2c)Online Metafont graphics.. If you
+     are compiling Xdvi, see the `-DNOTOOL' option in `xdvik/INSTALL'.
+
+   * Ignore the errors. The binary runs fine regardless.
+
+  Here is the information for getting the two patches:
+
+     Patch ID: 100512-02
+     Bug ID's: 1086793, 1086912, 1074766
+     Description: 4.1.x OpenWindows 3.0 `libXt' jumbo patch
+     
+     Patch ID: 100573-03
+     Bug ID: 1087332
+     Description: 4.1.x OpenWindows 3.0 undefined symbols when using shared `libXmu'.
+
+  The way to statically link with `libXmu' depends on whether you are
+using a Sun compiler (e.g., `cc') or `gcc'. If the latter, alter the
+`x_libs' Make variable to include
+
+     -static -lXmu -dynamic
+
+  If you are using the Sun compiler, use `-Bstatic' and `-Bdynamic'.
+
+Pointer combination warnings
+............................
+
+  When compiling with old C compilers, you may get some warnings about
+"illegal pointer combinations".  These are spurious; just ignore them.
+I decline to clutter up the source with casts to get rid of them.
+
new file mode 100644
--- /dev/null
+++ b/kpathsea/CONFIGURE
@@ -0,0 +1,193 @@
+Contents:
+
+  Basic Installation
+  Compilers and Options
+  Compiling For Multiple Architectures
+  Installation Names
+  Optional Features
+  Specifying the System Type
+  Sharing Defaults
+  Operation Controls
+
+
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
new file mode 100644
--- /dev/null
+++ b/kpathsea/ChangeLog
@@ -0,0 +1,3049 @@
+Fri Feb  7 11:53:09 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* Version 3.0.
+
+	* MakeTeXMF: Syntax problems with dc*.  Fix from Thomas.
+
+	* MakeTeX*: sed command to strip off all but the first of multiple
+	trees in $TEXMF was faulty.
+
+	* c-pathch.h (ENV_SEP, ENV_SEP_STRING) [AMIGA]: Change to ;
+	for Andreas.  Then Amiga binaries may be able to share
+	the same texmf.cnf with Unix and NT.
+
+	* texmf.cnf.in (main_memory): Decrease back to 263,000.
+	It's not worth allocating 7MB on everyone's machine just
+	to do xy-pic samples.  Add a comment about it.
+
+Thu Feb  6 10:27:50 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* db.c (kpse_db_search): If an alias exists on disk, and the
+	original entry in ls-R doesn't, use the alias.  Idea, sample code
+        from Fabrice.
+
+	* cnf.c (do_line): Add awful kludge to translate ; to :
+	when reading texmf.cnf values under Unix.  The idea is
+	to be able to write a single texmf.cnf that will work
+	under both NT and Unix.
+
+	* db.c: Doc fixes.
+
+	* MakeTeXcommon: Set ps_to_pk.
+	* MakeTeXPK: Use ps_to_pk instead of hardwiring gsftopk.
+	* MakeTeX.site: Include ps_to_pk comment.
+
+	* texmf.cnf.in (TEXMFCNF): Include SELFAUTOLOC (at the front).
+	* progname.c (kpse_set_progname): Include SELFAUTOLOC for the real
+	directory.  It may be useful.  Suggested by Andreas.
+
+	* MakeTeXcommon: Add case for fc.
+	* MakeTeX.site: Add comment for fc.
+	* MakeTeXMF: Add case for fc, generated like Sauter.
+	From Francois and Thomas.
+
+	* progname.c [WIN32]: SELFAUTODIR fix from Fabrice.
+
+	* kpathsea.h: Do not #include <kpathsea.h> (infinite loop).
+	From Fabrice and Richard.
+
+Tue Feb  4 13:20:09 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* tilde.c: xstrdup the result from getenv,
+	since we end up freeing it with a path element of `~'.
+
+	* MakeTeX.site: Include RCS id.
+
+	* MakeTeX.site: Replace sample dc assignment with ec.
+
+	* MakeTeXMF: Handle ec, use exbase for tc.
+
+	* MakeTeXcommon (ecfontdir,tcfontdir): New variables.
+
+Tue Feb 04 15:11:29 1997  Fabrice POPINEAU  <popineau@ese-metz.fr>
+
+	* progname.c: argv[0] under Win95 is set to the short
+	filename of the executable run. Changed the way
+	program_invocatio_name is retrieved : used the SearchPath() win32
+	call, next FindFirstFile() to get the long filename. The selfdir
+	stuff is not used any more for win32.
+
+Mon Feb  3 18:01:02 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* kpsewhich.c (read_command_line): Check for -1, not EOF,
+	per new getopt.
+
+Sun Feb  2 16:06:42 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* texmf.cnf.in (PKFONTS.xdvi): Replace `gsftopk,ps2pk' by `modeless'.
+	* MakeTeXPK (mode): Use `modeless' instead of `gsftopk'.
+
+	* tex-file.c: Look for TEXINDEXSTYLE before INDEXSTYLE.
+
+Sat Feb  1 16:31:39 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* texmf.cnf.in: Doc fix.
+
+	* progname.c (my_dirname): Check for device separators at the
+        beginning fo the string.  From Andreas.
+
+	* c-pathch.h (IS_DIR_SEP) [AMIGA]: New definition from Andreas.
+	(NAME_BEGINS_WITH_DEVICE): Remove.
+
+	* tex-make.c (maketex) [AMIGA]: Have to call system instead of popen
+	due to different interface.  From Andreas.
+
+	* progname.c (selfdir): Check self, not ret, for exiting the loop.
+	(remove_dots): Missing indirection on ret.
+	From Fabrice.
+
+Tue Jan 21 08:26:17 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* elt-dirs.c: Doc fixes.
+
+	* db.c (match): Don't return false just because the path element
+	ended in /.
+	Bug from: Richard Walker <Richard.Walker@cs.anu.edu.au>.        
+
+	* expand.c (kpse_path_expand): Do variable expansion before
+        splitting on path elements.
+	Bug from: Richard Walker <Richard.Walker@cs.anu.edu.au>.        
+
+	* tilde.c [TEST]: Function name changed.
+	From: Richard Walker <Richard.Walker@cs.anu.edu.au>.
+
+	* texmf.cnf.in (MAILCAPLIBDIR): Rename from MAILCAPDIR.
+	From Ulrik.
+
+Tue Jan 21 09:34:20 1997  Fabrice POPINEAU  <popineau@ese-metz.fr>
+
+	* c-pathch.h: NAME_BEGINS_WITH_DEVICE(string) new macro testing
+	for the presence of a device name in front of the string.
+
+	* progname.c (remove dots): stop before device name if
+	present. When building the filename, do not add leading DIR_SEP if
+	there is a device.
+
+	* pathsearch.c (path_search): avoid searching the whole disk
+		adapted for win32.
+
+	* db.c: support aliases file along with db files. An alias file is
+	named with ALIAS_NAME and the hashtable size is
+	ALIAS_HASH_SIZE. When a name looked for has an alias, the alias is
+	searched instead of the original name. The format of the aliases
+	file is "real_name alias_name", one pair per line. Currently only
+	for WIN32.
+
+Mon Jan 20 12:01:14 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* progname.c: Amiga patch from Andreas.
+
+Sun Jan 19 14:29:00 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* pathsearch.c (path_search): Strip off all but one of leading /'s.
+	We never want to search the whole disk.
+
+	* progname.c: Expand symlinks off the final filename, not the
+	directory name.
+
+Sat Jan 18 14:39:00 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* texmf.cnf.in (param_size): Increase to 500 for the chemical
+	formula macro package.  From Thomas.
+
+	* progname.c (expand_symlinks, ReadSymLink, CopyFirst, StripFirst,
+	StripLast): New functions to expand symbolic links for SELFAUTO*.
+	Noted by Thomas.
+
+	* texmf.cnf.in (PKFONTS.xdvi): Fix tpyo.
+	Document that memory changes
+	(trie_size): Increase to 64000.
+
+Fri Jan 17 13:08:08 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* progname.c (remove_dots): Don't free the constant null string.
+	From Andreas.
+
+	* texmf.cnf.in (dbfontdir): Change to dbfonts (the commented-out one).
+
+Thu Jan 16 10:13:19 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* cnf.c (kpse_cnf_get): Avoid recursive init, due to new
+	$TETEXDIR and other variables in default TEXMFCNF value.
+
+	* getopt*, strtol.c: New versions from /gd/gnu/lib.
+
+	* c-std.h (ALLOC_RETURN_TYPE): Only define if we're going to use it.
+
+	* acconfig.h (EDITOR): Oops, %s not +%s.
+	From: tim@maths.tcd.ie.
+
+	* progname.c (kpse_set_progname): One more my_dirname call
+	to get the parent and the grandparent in the environment variables.
+
+	* texmf.cnf.in (texdir): Rename from tex, to avoid clash with
+	TEX used by makempx -- win32 doesn't distinguish case on envvars.
+	From Fabrice.
+	(WEB2CDIR): Lowercase, so it doesn't end up in paths.h, just
+	for cleanliness.
+
+	* progname.c (kpse_set_progname): Pass program_invocation_name
+	to selfdir instead of progname, just in case we
+	HAVE_PROGRAM_INVOCATION_NAME and it's something different.
+	From Fabrice.
+
+	* tex-file.c (kpse_open_file): ocp, ofm and ovf should use
+	FOPEN_RBIN_MODE.  From Fabrice and John Plaice.
+
+	* progname.c [AMIGA]: Fix syntax errors, remove_dots not necessary.
+	From Andreas Scherer.
+
+	* MakeTeXupdate: MakeTeXls-R isn't in the conf dir anymore, just
+ 		in the regular path.
+ 	From Thomas.
+
+Sun Jan 12 17:22:35 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* cnf.c (read_all_cnf): Do not test unallocated memory on empty
+	lines; crashed on Alphas.
+
+	* progname.c (dirname): Rename to my_dirname to avoid clash on Alphas.
+
+Sat Jan 11 16:28:54 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* c-std.h (calloc, malloc, realloc) [!STDC_HEADERS]: Only declare
+	in this case.
+
+Tue Jan  7 17:44:01 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* MakeTeXPK: Doc fix.
+
+	* texmf.cnf.in (KPSE_DOT): Define.
+
+	* c-memstr.h: Doc fix.
+
+Wed Jan  1 16:58:02 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* pathsearch.h (kpse_filename_component): Declare this.
+	* path-elt.c: Define it.
+	* progname.c (remove_dots): New function to remove . and ..
+	filename components.  Subsumes slashify, it turns out.
+
+	* Makefile.in (install-exec): Install MakeTeXls-R in $(scriptdir).
+
+Mon Dec 30 16:22:42 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* progname.c (kpse_set_progname): Strip off .exe if present.
+
+	* cnf.c: Doc fix.
+
+	* progname.c (slashify): New function, to translate \ into / for WIN32.
+	(selfdir): Call it.
+
+	* lib.h (FILE{STR,CHAR}CASEEQ) [MONOCASE_FILENAMES]: Define these,
+	continuing yesterday's changes.
+	From Fabrice.
+
+Sun Dec 29 13:26:09 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* db.c (match, elt_in_db),
+	* elt-dirs.c (cached),
+	* hash.c (hash_lookup),
+	* kpsewhich.c (find_format, TRY_SUFFIX),
+	* tex-file.c,
+	* cnf.c (do_line): Compare filenames with FILESTRCASEEQ or
+	FILECHARCASEEQ to support monocase filesystems.
+	* hash.c (hash) [MONOCASE_FILENAMES]: Transform keys to uppercase.
+	From Fabrice.
+
+	* basename.c (basename):  Consider device separators;
+	if given 'e:foo.tex', should return 'foo.tex'.
+	From: Fabrice POPINEAU <popineau@esemetz.ese-metz.fr>.
+
+	* types.h (boolean): Protect with #ifndef HAVE_BOOLEAN, for NeXT.
+	From: Raf Schietekat <flexus!rfschtkt@colds.ruca.ua.ac.be>
+
+Sat Dec 28 07:18:48 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* progname.c [AMIGA]: Add code for this case from Andreas S.
+
+Fri Dec 27 17:38:43 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* progname.c (S_IX{USR,GRP,OTH}): Define if not defined, for the NeXT.
+        From: Gregor Hoffleit <flight@mathi.uni-heidelberg.de>.
+
+	* texmf.cnf.in (TEXMFCNF): Rewrite using /.'s etc.  From Thomas.
+
+Sun Dec 15 06:21:22 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* common.ac (AC_CHECK_FUNCS): Add getwd.
+
+	* lib.h (xgetcwd): Declare.
+	* Makefile.in (objects): Add xgetcwd.lo.
+	* xgetcwd.c: New file from xdvik.
+
+	* texmf.cnf.in (TEXMFCNF): Add $SELFAUTODIR:$SELFAUTOPARENT.
+	* progname.c (selfdir, dirname, etc.): New functions.
+	(kpse_set_progname): Set SELFAUTODIR and SELFAUTOPARENT.
+
+Sat Dec 14 14:41:39 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* tex-file.h (kpse_src_type): New types kpse_tex{doc,source}_format.
+	* tex-file.c (TEXDOC_ENVS, TEXSOURCE_ENVS): New envvars.
+	(kpse_init_format): Handle them.
+	* texmf.cnf.in (TEXDOCS, TEXSOURCES): New values.
+	* kpathsea.texi: Document them.
+
+Fri Dec 13 16:46:00 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* expand.h: Doc fix.
+
+Thu Dec 12 17:25:25 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* xputenv.c [WIN32]: Work around putenv ("FOO=") unsetting
+	FOO under NT.  From Fabrice.
+
+Mon Dec  9 23:27:45 MET 1996 Thomas Esser <te@informatik.uni-hannover.de>
+
+	* kpsewhich.c: add option -show-path to display the search path for a
+	given file type.
+
+Mon Dec  9 17:23:32 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* readable.c (READABLE): Check !S_ISDIR instead of S_ISREG,
+	to allow fifo's.
+	Suggestion from: Krzysio Leszczynski <chris@camk.edu.pl>.
+
+	* tex-file.c (kpse_open_file): Open VF files in binary mode.
+	From Fabrice.
+
+	* types.h (boolean) [WIN32]: Remove this case, Fabrice 
+	has found another solution.
+
+	* elt-dirs.c (expand_elt): Do not check for a device separator.
+	From Fabrice.
+
+	* texmf.cnf.in (OTPINPUTS, OCPINPUTS): These use a subdirectory omega/.
+	From John P.
+
+Sun Dec  8 17:15:43 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* c-proto.h (DllImport): Define here.
+	* config.h (DllImport): Instead of here.
+	* kpsewhich.c: Other DllImport changes.
+	* line.c [WIN32]: Include <malloc.h>.
+	* tex-file.c: Oops, had FOPEN_RBIN_MODE vs. R reversed.
+	* tex-make.c (kpse_make_tex_discard_errors): Add Dllimport.
+	* types.h (boolean): Bizarre WIN32 definition.
+	From: Fabrice POPINEAU <popineau@esemetz.ese-metz.fr>.
+
+Sat Dec  7 22:12:26 MET 1996 Thomas Esser <te@informatik.uni-hannover.de>
+
+	* MakeTeXnames: Ensure that cmr1234 will be mapped to
+	jknappen/sauter while cmr12 will still be mapped to public/cm.
+
+Fri Dec  6 15:08:35 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* texmf.cnf.in (OFMFONTS, etc.): New definitions for Omega.
+	* tex-file.h (kpse_file_format_type): Define kpse_ocp_format, etc.
+	* acconfig.h (MAKE_OMEGA_{OFM,OCP}_BY_DEFAULT): Include these.
+	* tex-file.c (kpse_init_format): New cases for the Omega types.
+	(OCP_ENVS, etc.): New environment variable lists.
+	From: John Plaice <plaice@iad.ift.ulaval.ca>.
+
+	* texmf.cnf.in: Use fonts//<format> consistently,
+	instead of fonts/<format>.
+
+	* lib.h (itoa): Remove, it seems we don't use this function any more.
+	* itoa.c: Remove.
+	* acconfig.h (HAVE_ITOA): Remove this.
+	* Makefile.in (objects): Remove.
+
+	* cnf.c (do_line): Oops, tested prog after freeing it,
+	should have tested prog2.
+	From: Fabrice POPINEAU <popineau@esemetz.ese-metz.fr>.
+
+Tue Dec  3 14:57:52 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (objects): Remove strtol.lo, that's generated by
+	configure.
+	From: Gregor Hoffleit <flight@mathi.uni-heidelberg.de>.
+
+Mon Dec  2 09:05:54 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* MakeTeXcommon: Set KPSE_DOT before the trap.  From Thomas.
+
+Tue Dec  3 18:02:08 1996  Ulrik Vieth  <vieth@thphy.uni-duesseldorf.de>
+
+	* texmf.cnf.in (TRFONTS): Set this to /usr/lib/font/devpost
+	indepent of $prefix.
+
+Mon Dec  9 00:28:58 1996  Ulrik Vieth  <vieth@thphy.uni-duesseldorf.de>
+
+	* MakeTeXcommon: Use `basename $0` in usage and version messages
+	for consistency with other programs and scripts. 
+	Also accept -help, -version in addition to --help, --version.
+
+	* MakeTeX{MF,PK,TFM,ls-R,mkdir,names,update}: 
+	Use `basename $0` in usage messages for consistency.
+	
+Tue Dec  3 18:02:08 1996  Ulrik Vieth  <vieth@thphy.uni-duesseldorf.de>
+
+	* texmf.cnf.in (TRFONTS): Set this to /usr/lib/font/devpost
+	indepent of $prefix.
+
+Thu Nov 28 16:33:35 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* common.ac (AC_ISC_POSIX): Remove this; it causes warnings from
+	Autoconf that make no sense, isn't cached, and is probably of
+	dubious value today.
+	* configure.in: Move the klibtool stuff to common.ac, so the
+        program configure.in's can find it.
+
+Wed Nov 27 14:43:41 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* configure.in: Doc fix.
+	* acconfig.h (HAVE_BASENAME, etc.): #undef these symbols so
+	Autoheader can replace them; we use a non-standard macro to test
+	for them, since they're part of the possibly-shared library.
+
+Mon Nov 25 14:04:42 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (texmf.sed): Replace all $(texmf) with `$TEXMF'
+        except on the TEXMF line itself.
+
+Sun Nov 24 10:06:35 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (texmf.sed): Insert missing quote.
+	(distdir): Use doc instead of listing all the targets (we were
+		missing unixtex.ftp).
+
+	* kpsewhich.c (read_command_line): Print the integer equivalent of
+	each format.
+
+Sat Nov 23 15:38:31 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* xt.ac (with_x): Remove spurious ;;.
+
+Fri Nov 22 18:00:41 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* cnf.c (do_line): Let var.prog lines work if we're running prog.exe.
+	This happens with --enable-shared.
+	From Ulrik.
+
+Mon Nov 18 16:10:48 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* tex-file.c (kpse_troff_font_format): Change to DEFAULT_TRFONTS
+        to make texmf.cnf.in change.
+
+Fri Nov 15 14:13:36 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (texmf.sed): Get $TEXMF back into the paths.
+	Noted by Andreas Scherer.
+	(distdir): Add klibtool.version to the distribution.
+	From Ulrik.
+	(install-exec): Use INSTALL_SCRIPT for scripts.
+
+Mon Nov 11 16:16:50 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* various .c: Print (nil) instead of (null) so we can possibly
+        detect printf of a null pointer.
+
+Sun Nov 10 16:22:43 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* xt.ac: New file so web2c and xdvi treat --with-x-toolkit uniformly.
+	From Ulrik.
+
+Thu Oct 31 15:38:48 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* expand.c (kpse_path_expand): Do brace expansion first.
+	(kpse_brace_expand): Expand each element of the brace expansion, so
+	{~a,~b} expands.  Suggested by Thomas.
+
+Fri Oct 25 16:51:14 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (install-data): Install an empty dir file if none exists.
+	(mostlyclean: Remove PROF etc. subdirs here.
+
+Tue Oct 22 13:56:20 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in ($(library).h): Make the modtime of the file the
+        same as the latest other .h; otherwise, we think kpathsea always
+        has to be remade.
+
+Sun Oct 20 18:06:36 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (distdir): No need to distribute copying.texi.
+
+Mon Oct 14 11:32:51 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Changes for NT from: Fabrice POPINEAU <popineau@esemetz.ese-metz.fr>.
+
+	* xputenv.c (putenv) [WIN32]: #include <stdlib.h> instead of declaring.
+
+	* tex-file.c (kpse_open_file): Use FOPEN_RBIN_MODE for tfm and gf
+	formats.
+
+	* xopendir.h [!WIN32]: Conditionalize whole file.
+	* xopendir.c (xopendir) [!WIN32]: Conditionalize defn.
+
+	* kpsewhich.c (DllImport) [_WIN32]: Define.
+	(path_sep): Use ENV_SEP_STRING.
+
+	* progname.h,
+	* lib.h,
+	* debug.h (kpathsea_debug),
+	* concatn.h (concatn): Give DllImport kludge.
+
+	* config.h (DOSISH) [WIN32]: #define.
+	Also include <windows.h>, etc.
+
+	* c-std.h (getenv, popen, pclose) [WIN32]: Conditionalize decls.
+	* c-fopen.h [WIN32]: Use rb and wb.
+	* c-limits.h [HAVE_SYS_PARAM_H]: Conditionalize #ifdef.
+	* common.ac: Check for <sys/param.h>
+	* c-stat.h [WIN32]: #include <io.h> and #define stat _stat.
+
+Sat Oct 12 11:10:45 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* tex-file.c (kpse_find_file): Include a suffix in what we pass to
+	kpse_fontmap_lookup.
+
+	* Makefile.in (paths.h): Remove extra $ when replacing $VARFONTS.
+
+Tue Oct  8 16:40:07 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* tex-glyph.c (try_fontmap): Do not return the first alias if it
+	itself is an alias.  Also, if a particular alias succeeds,
+	return that.
+
+Sun Oct  6 17:52:58 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* version.c: Doc fix.
+
+Sat Oct  5 17:06:54 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* kpsewhich.c (-must-exist): New option.
+	(must_exist): New global.
+
+	* Makefile.in (install-data): Call install-info.
+	* kpathsea.texi, *.texi: Use @url, @email, and @dircategory/@direntry.
+
+Sat Sep 21 19:02:17 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* MakeTeXnames.cnf: Doc fix.
+
+	* texmf.cnf.in (latex{2e,209}_inputs): Replace spurious `latex2e'.
+	(TEXINPUTS.fontinst): New definition, including AFM files.
+	(MFINPUTS, TFMFONTS, PKFONTS): Use $VARFONTS.
+	From Thomas.
+
+Sat Sep  7 16:00:53 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* MakeTeXupdate,
+	* MakeTeXnames,
+	* MakeTeXmkdir,
+	* MakeTeXls-R,
+	* MakeTeXTFM,
+	* MakeTeXPK,
+	* MakeTeXMF (version): Call kpsewhich in MakeTeXcommon, not here.
+
+	* version.c: Doc fix.
+
+	* kpsewhich.c (read_command_line): Improve formatting of --help
+	message.
+
+Fri Sep  6 19:16:20 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* kpsewhich.c (read_command_line): Print the bug reporting address.
+	* version.c (kpse_bug_address): New global.
+
+Thu Sep  5 19:08:04 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in: Doc fix.
+
+	* configure.in: Include ../acklibtool.m4 here.
+	* common.ac: Not here.  Move calls to kb_*LIBTOOL* functions, too.
+
+Sun Sep  1 17:34:17 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (.c.lo): Put filename right after $(CC), for Klibtool.
+	(KPATHSEA_CC): Do not include ALL_CFLAGS here.
+	(paths.h): Instead of deleting definitions with lowercase variable
+        names, don't include them in the first place.
+
+Sat Aug 31 16:15:33 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* common.ac: Call kb_KLIBTOOL_REPLACE_FUNCS and kb_PROG_LIBTOOL
+	instead of the AM_* versions.
+	Also, include acklibtool.m4 instead of aclibtool.m4.
+
+	* Makefile.in (liblobjs): Change to use @LTLIBOBJS@.
+
+Sat Aug 17 17:22:18 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* texmf.cnf.in (PKFONTS*, GFFONTS): Need another / to match TDS.
+
+Sat Aug 10 15:46:46 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* texmf.cnf.in (TFMFONTS, VFFONTS): Update with trailing // for TDS.
+
+	* MakeTeXupdate,
+	* MakeTeXnames.cnf,
+	* MakeTeXnames,
+	* MakeTeXTFM,
+	* MakeTeXMF,
+	* MakeTeXmkdir,
+	* MakeTeXls-R,
+	* MakeTeXPK: Change --expand to -expand-var.
+
+	* tex-glyph.c (try_fontmap): Return the real name of the first
+		alias as the font name.
+	(kpse_find_glyph): Change call, free string if necessary, etc.
+	Basic idea from a patch sent by wls@astro.umd.edu.
+
+Fri Aug  9 15:42:40 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (paths.h): Substitute for dbtex, dbfonts, and prefix.
+	Also, do not define lowercase variables.
+
+Thu Aug  8 14:50:29 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* texmf.cnf.in (TEXCONFIG, INDEXSTYLE): Use //, just in case there
+		are subdirectories. From Thomas.
+
+Tue Aug  6 13:59:03 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* kpsewhich.c (lookup): Handle user_path case.
+
+Mon Aug  5 17:23:56 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* kpsewhich.c: Rename -expand to -expand-var,
+	-path to -expand-path, and add new -path option to specify
+	explicit path for lookups.
+
+	* tex-file.h (kpse_ist_format): New format.
+	* tex-file.c (kpse_init_format): Initialize it.
+	(IST_ENVS): New #define.
+	* texmf.cnf.in (INDEXSTYLE): Set the default path.
+
+	* tilde.c (kpse_tilde_expand): If $HOME starts with //, only use
+	one of the slashes.
+
+Sat Aug  3 17:18:00 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* kpsewhich.c (read_command_line): Change Usage: line to conform.
+
+Fri Aug  2 11:57:23 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* db.c (db_build): Test len > 0 before evaluating len - 1.
+        From: "Peter Henderson, Syrinx Speech Systems P/L, Tel: (+61-2)
+	        956-6540" <peterh@syrinx.com.au>.
+
+Sat Jul 27 14:35:17 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (paths.h): Change target name to
+        $(kpathsea_dir)/paths.h, for rdepend.make dependency.
+
+	* Makefile.in (liblobjs): New variable, gets @LIBTOOL_LIBOBJS@.
+	* common.ac (kbAC_LIBTOOL_REPLACE_FUNCS): Use this new macro instead
+	of AC_REPLACE_FUNCS.
+
+Fri Jul 26 15:51:55 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* Makefile.in (KPATHSEA_CC): Include $(compile).
+	(.c.lo): Change suffix rule for libtool 0.5.
+	(install-exec): Use new variables INSTALL_LIBTOOL_*.
+
+Mon Jul  8 17:21:34 1996  Karl Berry  <karl@laurie>
+
+	* unixtex.texi: Rename from obtain.texi.
+
+Fri Jun  7 19:10:52 1996  K. Berry  <kb@cs.umb.edu>
+
+	* common.ac: Include ../kpathsea/withenable.ac.
+
+Thu Jun  6 16:34:43 1996  K. Berry  <kb@cs.umb.edu>
+
+	* Makefile.in (kpsewhich): Use libtool commands etc. instead of
+        our shared lib stuff.
+	* common.ac: Replace our shared lib stuff with gm_PROG_LIBTOOL.
+	* withenable.ac: Remove --enable-shared stuff.
+
+Sat Jun  1 15:05:42 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* MakeTeX*: Add RCS info for version strings.
+
+Thu May 30 13:46:46 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* MakeTeXPK: Doc fix; we're called with the base font name
+        (pplr8r), not the user font name (pplr).
+
+	* db.c (ignore_dir_p): Remove the dot_pos != dirname test,
+	since it's always true. It caused directory names containing .'s
+	(e.g., `dc-1.2') to be ignored.
+	From Thomas Esser and Frank Mittelbach.
+
+Sun May 26 16:06:41 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-make.c (kpse_make_tex): If called kpse_init_form, reassign
+        our local variable, too.
+
+Thu May 23 16:20:53 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXnames: Doc fix.
+
+Fri May  3 13:34:51 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * withenable.ac: Use AC_ARG_WITH instead of AC_ARG_ENABLE for
+        maketex*.
+
+        * tex-file.c (kpse_find_file): Oops, testing for kpse_pk_format
+        twice, when meant to test for kpse_gf_format.
+
+        * cnf.c (do_line): Allow whitespace in variable values.
+
+        * texmf.cnf.in: Finish adding easier support for !!. From Joachim.
+
+Wed May  1 16:30:56 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in (TEXCONFIG): Take $HOME back out again, we're going
+        to hardwire a seach for dvipsrc in $HOME.
+
+Mon Apr 29 14:02:03 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in (latex2e_inputs): Use just `latex', not `latex2e'.
+        From: David Carlisle <carlisle@cs.man.ac.uk>.
+        (TEXINPUTS, etc.): Also rewrite to make !! support easier to add.
+        From: Joachim Schrod <schrod@iti.informatik.th-darmstadt.de>.
+
+        * install.texi: Document ksh/ash/Ultrix sh lossage, in favor of
+        bash/bsh/sh5.
+
+Sun Apr 28 15:02:55 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (ASM_NEEDS_UNDERSCORE): New define.
+        From: Peter Breitenlohner <peb@MPPMU.MPG.DE>.
+
+        * Makefile.in (sharedlib_version): Remove unused variable.
+
+Sat Apr 27 17:15:14 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in (hyph_size): Add this.
+
+Tue Apr 23 07:34:05 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in (MIMELIBDIR, MAILCAPDIR): Add these.
+        (MPXCOMMAND): And these.
+
+        * MakeTeX.site: New file, just an example.
+
+Mon Apr 22 17:31:27 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXnames.conf: Rename to MakeTeXnames.cnf.
+        * MakeTeXnames: Change call.
+        * Makefile.in (install-exec): Change install.
+
+Sun Apr 21 12:09:06 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h (kpse_set_program_enabled, kpse_maketex_option):
+        Declare new functions.
+        (kpse_src_type): Define new type.
+        * tex-file.c (kpse_set_program_enabled): New function, so we can
+        set this at all the various levels and get the overrides right.
+        (kpse_maketex_option): Handle MakeTeX options in a common place.
+        * proginit.c (kpse_init_prog): Call it, and remove the make_tex_pk
+        argument.
+        * proginit.h (kpse_init_prog): Likewise.
+        * kpsewhich.c (parse_options): New options -maketex and -nomaketex,
+        just calls kpse_maketex_option.
+
+        * Makefile.in ($(library).h): New target, made at dist time.
+
+Sat Apr 20 17:21:24 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_find_file): Do not pound the disk on the first
+        search if we might be trying the second.
+
+Tue Mar 12 15:21:16 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXPK: Restore check for mismatched mode and bdpi.  From Thomas.
+
+Sun Mar 10 14:17:14 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXnames.conf: Rename VARFONTS to VARTEXFONTS.
+
+        * MakeTeXcommon (trap): Oops, cd $KPSE_DOT before testing $STDOUT.
+
+Sat Mar  9 17:57:02 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXcommon (trap): cd back to KPSE_DOT before removing
+        TEMPDIR, in case $TMPDIR is relative.  Reported by Thomas.
+
+Fri Mar  8 11:41:22 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * db.c (kpse_db_search): Add debug statement with the result of
+        the match.
+
+        * tex-make.c (kpse_make_tex): Don't look for the arg spec here.
+        * tex-file.c (init_maketex): Do it here. Check for disbaling in
+        the config file, too.
+
+        * tex-make.c (misstex): Look for TEXMFOUTPUT in texmf.cnf.
+        * texmf.cnf.in (TEXMFOUTPUT): Define this.
+
+        * kpathsea.texi (Suppressing warnings): New node to describe TEX_HUSH.
+
+        * tex-file.c (kpse_init_format): Include the numeric value of the
+        format for use with kpsewhich --format.
+
+        * tex-hush.c: Support `all' to suppress everything.
+
+Thu Mar  7 11:24:51 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * kpsewhich.c: Change --program to --progname, for compatibility
+        with TeX & co.
+
+        * texmf.cnf.in (TEXCONFIG): Remove ~ from default path, for
+        consistency with everything else.
+
+        * readable.c: Let's call it TEX_HUSH instead of KPSE_NOWARN_PERM,
+        so we can use it for checksum warnings, too. And for similarity
+        with xdvi.
+        * kpathsea.texi: Corresponding change.
+        * tex-hush.[ch]: New files.
+
+Wed Feb 28 15:16:32 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-make.c (misstex): Let the name missfont.log be configurable.
+        * texmf.cnf.in (MISSFONT_LOG): Add this definition.
+        * kpathsea.texi: Document this.
+
+Sun Feb 25 16:55:35 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c: Reverse order of alias & suffix searches, so we look
+        for the original TFM name before aliases.
+
+Sun Feb 18 16:24:50 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (xopenfile): Move this function to here and rename to
+        kpse_open_file.
+        * xopenfile.c: Remove this.
+        * Makefile.in (objects): Remove xopenfile.o.
+
+Thu Feb 15 12:57:56 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-make.c (maketex): Do not print the `kpathsea: Running ...'
+        message if we're discarding output.
+        (misstex): Do not log the missing file in missfont.log, either.
+
+Sat Feb 10 14:59:23 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (sharedlib): Add new command here $(shared_postlink)
+        so we can make the necessary symlink.
+        (shared_postlink): New variable
+
+Fri Feb  9 15:46:55 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * withenable.ac (maketex{mf,pk,tfm}-default): Move here from
+        web2c/withenable.ac.
+
+Wed Feb  7 16:52:08 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXnames.conf: Extract this new script from MakeTeXcommon, sigh.
+        * MakeTeX*: Other updates from Thomas --
+        - replace the exec 3>&1 1>&2 by trap/subshell construction. The
+                3>&1 may cause the 'open fd bug' with bash.
+        - ts is a typo. tc are the text companion fonts
+        - replace >&3 by >$STDOUT where $STDOUT is a filename. Its content is
+          displayed by the trap command in MTcommon.
+        - added missing ;; in case/esac  
+        - use : ${VAR=VAL} where possible
+        - added mt_min_args
+        - removed psfonts.map parsing (was only needed for ps2pk)
+        - removed >&2 where redirection stdout->stderr is active anyway
+        - removed </dev/null where redirection stdin<-/dev/null is active
+                anyway
+        - Oops: MakeTeXTFM still used old code:  >$TEMPDIR/mtout.$$
+        - add line
+           trap 'test -f $STDOUT && cat $STDOUT; cd /; rm -rf $TEMPDIR; exit 0' 0 1 2 15
+          to MakeTeXcommon
+        - MT_FEATURES now in MakeTeXnames.conf since we need to read it
+                later than MakeTeXcommon
+
+Tue Feb  6 17:04:25 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h (kpse_file_format_type): Add afm and type1 support.
+        * tex-file.c: Likewise.
+        (kpse_init_format): In tex_ps_header_format, no longer need to
+        recognize .pfa and .pfb.
+        * texmf.cnf.in (AFMFONTS, T1FONTS): Likewise.
+        * Makefile.in (paths.h): Include 0-9 in the regexp for the sake of
+        T1FONTS.
+
+Sat Feb  3 15:45:00 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (DEFS): Move to common.make.
+
+Mon Jan 29 17:01:44 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXls-R: Doc fix.
+
+Mon Jan  8 17:17:42 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c: Doc fix.
+
+        * fontmap.c (MAP_NAME, MAP_HASH_SIZE): Conditionalize these #defines.
+
+Sun Jan  7 17:38:00 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * db.c (DB_HASH_SIZE, DB_NAME): Conditionalize these.
+
+        * MakeTeXcommon (dcfontdir, tsfontdir): Use supplier `jknappen'.
+
+Mon Jan  1 15:14:42 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (distdir): Don't bother including freedom.texi.
+
+Fri Dec 29 17:17:08 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in: misc.make is now clean.make.
+
+Tue Dec 26 14:21:08 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * withenable.ac: New file with --enable option extracted from
+        common.ac, for the top level to include.
+
+        * acconfig.h (MAKE_TEX_PK_BY_DEFAULT): Add this.
+
+        * readable.c (kpse_readable_file): Omit warning if
+        KPSE_NOREAD_WARN is set to 1.
+
+Wed Dec 13 14:14:09 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * kpsewhich.c: Call kpse_init_format when necessary in the
+        --format case.
+
+Mon Dec 11 14:42:13 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.ac: --disable-shared should not act like --enable-shared.
+        From Ulrik.
+
+Sun Dec 10 15:35:15 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h (kpse_mft_format): New format.
+        * tex-file.c (MFT_ENVS): New variable.
+        (kpse_init_format): Initialize it.
+        * texmf.cnf.in (MFTINPUTS): New variable.
+
+Fri Dec  8 08:54:58 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * xopenfile.c: Doc fix.
+
+Mon Dec  4 17:23:34 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (check): Extra $ missing.
+
+Sun Dec  3 13:42:54 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (TEX_SUFFIXES): Add .dtx.
+
+Sun Nov 19 16:19:37 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeX*: Use MakeTeXupdate, mkdir, etc. in $TEXMFCNF_DIR, not
+        along PATH. From John I.
+
+Sat Nov 18 17:03:46 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (TEX_SUFFIXES): Add .txi.
+
+Fri Nov 17 15:12:03 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.ac (kb_AC_SYS_SHAREDLIB): Add the kb_ prefix.
+
+        * Makefile.in ({un,}install-exec): Use sharedlibname and
+        staticlibname instead of `basename`.
+        Also, pass no arguments to $(shared_postinstall); let the Autoconf
+        macro set this completely.
+
+        * expand.c: Bash code remains under the GPL, per rms.
+
+Thu Nov 16 16:14:14 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (uninstall-exec): Needs same `basename` treatment as
+        install-exec. From Ulrik.
+
+        * config.h [AMIGA] (pclose): Must be #defined as 0, not just
+        empty. From Andreas Scherer.
+
+Tue Nov 14 14:04:57 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h (kpse_fallback_resolutions_string): New global.
+        * tex-file.c: Define it.
+        (kpse_init_fallback_resolutions): Use it instead of
+        DEFAULT_FONT_SIZES, if set.
+
+Mon Nov 13 10:43:11 1995  Kathy Hargreaves  <karl@cs.umb.edu>
+
+        * find-suffix.c: Remove spurious + 1.
+
+Sun Nov 12 13:42:51 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c: Improve warning message if last resort sizes are not
+        sorted. Suggested by Kathy.
+
+        * texmf.cnf.in (trie_size, main_memory): Doc improvements from Wayne.
+
+Sat Nov 11 16:58:37 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXnames: Correct too many left quotes.
+
+        * tex-make.c (kpse_make_tex): Initialize the format if necessary.
+
+Mon Oct 30 16:49:05 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXPK (GFNAME): Do not assume $cmd produced $GFNAME. From Tim.
+
+        * texmf.cnf.in (trie_size): Increase to 32000 so common language
+        combinations will require no change. Suggested by Ulrik.
+
+        * MakeTeXls-R: Missing s in sed cmd.
+        * MakeTeXTFM (TFM_NAME): Should be TFMNAME.
+        * MakeTeXnames (FONTNAME): Missing `.
+        * MakeTeXcommon: If the caller requires no args (i.e.,
+        MakeTeXls-R), don't complain if given no.
+        Missing } in varfonts case.
+        All from Thomas.
+
+Sun Oct 22 17:02:25 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * c-std.h (hypot): Remove this declaration. It was only needed for
+        fontutils, and it conflicts under Linux 1.2.10. From Tim Murphy.
+
+Sat Oct 14 10:55:26 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (EDITOR): Missing %. From Tim Murphy.
+
+Sat Oct  7 17:44:41 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (install-exec): Use basename to get the real name so
+        we don't install in $(libdir)/../kpathsea/etc.
+        From Ulrik.
+
+Sat Sep 30 12:16:05 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXls-R (db_file_tmp): Replace double slashes with single,
+        for the sake of NetBSD/FreeBSD. From Thomas.
+
+Fri Sep 29 11:29:08 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (tex-file.o): CPPFLAGS is now ALL_CPPFLAGS.
+
+Mon Sep 25 15:05:32 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * lib.h (FATAL_PERROR): Avoid using the formal parameter `s' since
+        cc gets confused with %s.
+
+        * MakeTeXls-R: Include subtleties from Thomas.
+        * MakeTeXcommon: Rename stickydir to appendonlydir.
+
+Sun Sep 24 13:15:51 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * cnf.c (kpse_cnf_get): Call kpse_init_db here.
+        * pathsearch.c (search): Instead of here.
+
+        * tex-file.c (init_format): The override path may be null, so use
+        MAYBE to print it.
+
+        * MakeTeXPK: Don't use unset, as Ultrix sh doesn't support it.
+
+Sat Sep 23 15:07:12 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.ac (basename strstr putenv): Use AC_REPLACE_FUNCS instead
+        of AC_CHECK_FUNCS. Add strtol and strcasecmp from web2c/lib and xdvik.
+        * Makefile.in (objects): Use @LIBOBJS@ instead of corresponding .o's.
+
+Fri Sep 22 13:34:51 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (MAKE_TEX_*): #define as 0/1, instead of #undef,
+        since we now pass this as a default argument to init_maketex.
+
+        * tex-file.c (init_path): Look for environment variables PATH.prog
+        and PATH_prog before PATH.
+
+Thu Sep 21 13:53:38 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * kpsewhich.c (USAGE): Avoid bare newline.
+
+        * xfseek.c, xftell.c: Add unprototypification.
+
+        * common.ac (library_cflags): AC_SUBST for this depending on
+        --enable-shared.
+        * Makefile.in (shared_cflags, sharedlib_cflags): Rewrite
+        accordingly, so the shared flags aren't always used.
+
+Wed Sep 20 17:06:53 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c: Add .ltx, .texi, and .texinfo as alternate suffices
+        for kpse_tex_format.
+
+Tue Sep 19 17:12:10 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in: Changes for TDS.
+
+        * MakeTeX*: New scripts from Thomas.
+
+Sat Sep 16 17:30:46 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c: Do not print extra `kdebug:'s when printing the
+        alt_suffixes.
+
+        * expand.c: Incorporate brace expansion code from bash.
+        * texmf.cnf.in (PKFONTS.xdvi): Use it here, and document the
+        possibility for $TEXMF.
+
+Thu Sep 14 12:59:17 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_init_format): For any_glyph_format, do not
+        initialize a suffix.
+
+        * kpsewhich.c (main): Initialize all the formats.
+        (find_format): psfonts.map => dvips_config_format.
+
+Tue Sep 12 16:19:44 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeX{MF,TFM}: New scripts from te.
+        * Makefile.in (install-exec, distdir): Install and dist them.
+
+Sun Sep 10 15:11:07 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * pathsearch.c (search): Doc fix.
+
+        * tex-file.h (kpse_format_info_type): Add alt_suffix member.
+        * tex-file.c (init_format): Set it for PS headers and picts, and
+        print it if it exists.
+        * kpsewhich.c: Use the new alt suffixes and also the regular
+        suffixes to allow for -format names as well as numbers, and for
+        file format guessing.
+        
+Sat Sep  9 14:27:48 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXPK: If the MODE and BDPI don't match, ignore the mode.
+        Suggested by Thomas.
+
+        * tex-file.[ch] (kpse_font_override_path): Remove this.
+        (kpse_format_info_type): Replace the `override_p' member with a
+        general `override_path'.
+        * proginit.c: Set the override path for both fonts and headers.
+
+        * acconfig.h (NOTOOL): Add this.
+
+Fri Sep  8 14:52:42 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (HYPERXDVI): Don't need this after all, Autoconf's
+        default actions are better.
+
+Thu Sep  7 15:11:17 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (HYPERXDVI): Define this.
+
+Mon Sep  4 17:14:25 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * debug.h (KPSE_LAST_DEBUG): Define this, for use with gsftopk.
+
+        * Makefile.in (objects): Add xopenfile.o.
+        * xopenfile.c: New file.
+        * lib.h (xopenfile): Declare it.
+
+Sat Sep  2 13:49:53 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h (kpse_file_format): Rename kpse_ps_header_format to
+        tex_ps_header_format.
+        * tex-file.c (TEX_PS_HEADER_ENVS): Rename likewise, etc.
+        * kpsewhich.c (suffixes): Likewise.
+        * texmf.cnf: Likewise.
+        
+        * tex-file.c: Never set must_exist on the first search. Is this
+        really correct?
+
+Fri Sep  1 13:24:49 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-make.c (maketex): Give perror if the popen fails.
+
+        * db.c (db_dir_list): Keep track of the directories we found db's in.
+        (kpse_db_search): If no db directories are relevant to this path
+        elt, return NULL.
+        * db.h: Doc fix.
+        * pathsearch.c (path_search): Doc fix.
+
+        * Makefile.in (shared_ext, etc.): Move to common.make.
+
+Thu Aug 31 14:40:32 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * kpsewhich.c: Install suffix rewrite from Yves.
+
+        * common.ac: Move AC_SYS_SHAREDLIB etc. here.
+
+        * acconfig.h (ASM_SCALED_FRACTION): Add this.
+
+Wed Aug 30 17:02:58 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_find_file): Call kpse_make_tex.
+        * tex-make.c (kpse_make_tex): Only call set_maketex_mag if we are
+        doing MakeTeX-PK or GF-ing.
+        From Greg.
+
+Tue Aug 29 13:58:59 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (texmf.sed): Depend on paths.make. Should we avoid
+        creating a new file unless it changes, a la c-auto.h?
+
+        * configure.in: Check for --enable-shared.
+
+Mon Aug 28 17:50:06 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in: Add sharedlib variables.
+
+Sun Aug 27 13:27:01 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * hash.c (hash_print): New option summary_only, and always print
+        the summary.  Also, output to stderr, not stdout.
+        * hash.h: Change decl.
+
+        * db.c (kpse_init_db): Oops, have to make it external, so rename
+        again.
+        * db.h: Declare it.
+        * pathsearch.c (search): Call it.
+        
+        * cnf.c (read_all_cnf): Rename from read_files.
+        * db.c (read_all_lsR): Rename from read_all_dbs.
+        * fontmap.c (read_all_maps): Rename from map_create.
+
+        * tex-file.h (kpse_db_format): Another new type.
+        * tex-file.c (kpse_init_path): Case for it.
+        (DB_ENVS): Envvar list.
+        * texmf.cnf.in (TEXMFDBS): Default path.
+        * kpsewhich.c (suffix): Add new element.
+
+Sat Aug 26 14:49:28 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * cnf.c (CNF_NAME): #define this.
+        * tex-file.c (kpse_init_path): Instead of setting the .program
+        element to texmf.cnf here.
+ 
+        * db.c (db_insert): Rename to kpse_db_insert.
+        * db.h: Change decl.
+        * tex-make.c (maketex): Change call.
+
+        * cnf.c, cnf.h, db.c, db.h, pathsearch.c: Remove references to
+        kpse_db_dir.
+        * pathsearch.c (first_search): New static.
+        (path_search): Do not do ls-R search if first_search.
+        (search): Do not log if first_search.
+
+        * pathsearch.c (path_search): Don't bother calling elt_in_db --
+        the match function in db.c will catch the irrelevant hits.
+        Pointed out by te.
+
+Fri Aug 25 14:01:24 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * cnf.c (kpse_cnf_get): Look for NAME.PROGRAM before NAME.
+        (do_line): Save NAME.PROGRAM separately from NAME.
+        * texmf.cnf.in: Put the usual definitions of TEXINPUTS and PKFONTS
+        first now, before the .prog variants.
+
+        * fontmap.c: Use ISSPACE instead of just checking for space and tab.
+
+Thu Aug 24 13:46:19 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * lib.h (strstr) [!HAVE_STRSTR]: Declare this.
+        * Makefile.in (objects): Add strstr.o.
+        * common.ac (AC_CHECK_FUNCS): Remove memmove; we seem to never use
+        this. And add strstr.
+
+        * fontmap.c (map_file_parse): Comments at the last % or @c, not at
+        the first %. Also, implement the include feature.
+        And thus, don't give up if the map file can't be opened.
+        (token): New routine, since we can no longer use strtok.
+        
+        * tex-file.h (kpse_file_format_type): New format kpse_fontmap_format.
+        * tex-file.c (kpse_init_format): Initialize it.
+        (FONTMAP_ENVS): Define it.
+        * texmf.cnf.in (TEXFONTMAPS): Define the default.
+        * kpsewhich.c (suffix): Add .map.
+
+Tue Aug 22 13:28:46 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXPK.in: No >&/dev/null, source.map is now supplier.map.
+
+        * tex-file.c: Doc fix.
+
+Mon Aug 21 15:52:42 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * c-memstr.h (SYSV): OK, omit this definition in the never-ending
+        battle to appease the X headers.
+        From: neal@ctd.comsat.com (Neal Becker).
+
+Sun Aug 20 12:58:28 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * cnf.c (read_files): Concatenate consecutive lines that end in \.
+
+        * types.h (boolean) [__cplusplus]: Don't define true and false for C++.
+        From: Johannes Sixt <Johannes.Sixt@risc.uni-linz.ac.at>.
+
+        * db.c (db_build): Call absolute_p to determine if the possible
+        directory really is one.
+        Also, allow relative names in the ls-R file.
+
+        * kpsewhich.c: New options -path, -separator.
+        From: David Aspinall <da@dcs.ed.ac.uk>.
+
+        * MakeTeXPK.in: Unset DISPLAY and MFTERM.
+	From: Yves Arrouye <Yves.Arrouye@imag.fr>.
+	
+        * db.c (ignored_dir_p): New function to ignore . directories.
+        (db_build): Call it, and do the ignoring. Report on how many
+        directories were ignored.
+
+        * Makefile.in (MakeTeXPK): Remove dcfontdir substitution.
+        * MakeTeXPK.in: Play redirection games so regular echo's will work.
+        (dcfontdir): Remove this; it's unused.
+        From: te@informatik.uni-hannover.de (Thomas Esser).
+
+        * pathsearch.c (path_search): Free more garbage.
+        From: John Eaton <jwe@che.utexas.edu>.
+
+Sat Aug 19 12:57:54 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * kpsewhich.c (USAGE): Document -format and -program.
+
+        * tex-make.c (maketex): Give warning if MTPK output a string that
+        wasn't a filename. From Pierre.
+
+        * kpsewhich.c (read_command_line): Execute -expand right 
+
+        * tilde.c (kpse_tilde_expand): If HOME is /, don't start path with //.
+        From: Andreas Schott <andreas@mpa-garching.mpg.de>.
+
+        * db.c (match): Make /// (or more) like //.
+        * elt-dirs.c (do_subdir): Likewise. Also, skip over as many
+        slashes as we found.
+
+        * variable.c (expanding_p, expanding, expansions, expansion_type):
+        New functions, variables, type.
+        (expand): Check for recursively expanded variables.
+        Reported by Nicolai Langfeldt <janl@math.uio.no>.
+
+        * cnf.c (kpse_cnf_get): Free temporary list after extracting the
+        first element (the one we return).
+
+Fri Aug 18 17:39:29 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXPK.in (1270): The guess here should be linohi, not linolo.
+        From pwa.
+
+        * kpsewhich.c (suffix): Update for new MetaPost stuff.
+        * tex-file.h: Doc fix.
+
+Mon Aug 14 17:49:05 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * debug.h: Define KPSE_DEBUG, not DEBUG.
+        * hash.c, hash.h, tex-file.c, elt-dirs.c, dir.c, db.c: Change
+        #ifdef's accordingly. From John I.
+
+Sun Aug 13 16:03:51 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h (kpse_file_format_type): Rename kpse_dvips_headers to
+        just kpse_ps_headers. xdvik uses this too, now.
+        * tex-file.c (kpse_init_format, KPSE_DVIPS_HEADER_ENVS): Likewise.
+        Also, look for the PSHEADERS envvar, not DVIPSHEADERS.
+        * texmf.cnf.in: Likewise.
+
+Thu Aug 10 19:31:14 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_init_fallback_resolutions): Complain if sizes
+        aren't sorted, and ignore offending sizes.
+        From: Manuel Fahndrich <manuel@CS.Berkeley.EDU>.
+
+Tue Aug  1 13:53:53 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * variable.[ch] (kpse_var_value): Use const_string.
+
+        * texmf.cnf.in (string_vacancies): Decrease to 25000. From Bernd.
+        (font_max): Add this. From Wayne.
+
+Mon Jul 31 15:47:01 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * db.h (KPSE_DB_DIR): Remove $.
+        * cnf.c (read_files): Call kpse_var_value instead of kpse_var_expand.
+
+        * tex-file.[ch]: Add mpsupport and troff_font formats.
+        * texmf.cnf.in: Likewise.
+
+Sat Jul 29 09:21:44 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * variable.h (kpse_var_value): Declare this.
+        * variable.c (kpse_var_value): New routine.
+
+        * tex-file.c: Check TEXMFINI for pool/fmt/base/mem lookups
+
+Tue Jul 25 11:22:25 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * concatn.c (concatn): Free the intermediate result, not the final
+        version.
+
+        * texmf.cnf.in (TEXMFLOG): Don't mention this, as we need to log
+        the finding of the .cnf file itself, thus it must be an
+        environment variable.
+
+Sat Jul 22 17:09:58 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (KPSE_{MEM,MP,MPPOOL}_ENVS): Define envvars.
+        * tex-file.h (kpse_file_format_type): Add kpse_{mem,mp,mppool}_formats.
+        * texmf.cnf.in (MPPOOL, MPMEMS, MPINPUTS): New variables.
+        Adapted from: vieth@xerxes.thphy.uni-duesseldorf.de (Ulrik Vieth).
+
+Fri Jul 21 15:26:42 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * *.c, *.h: The FSF has a new address.
+
+        * kpsewhich.c: Give error if no args.
+
+Wed Jul 19 17:34:26 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in: Document limits on error_line et al.
+
+Mon Jul 17 13:09:05 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (NO_FMTBASE_SHARE): Rename to NO_DUMP_SHARE.
+
+Sun Jul 16 14:17:16 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (IPC, FUNNY_CORE_DUMP, NO_FMTBASE_SHARE): Include these.
+
+Sat Jul 15 12:45:51 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (HAVE_ITOA): Remove extraneous #define.
+
+        * texmf.cnf.in (hash_extra): New TeX array variable, 0 by default.
+
+        * tex-file.c (KPSE_BIB_ENVS): Include TEXBIB.
+
+Thu Jul 13 15:04:52 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in (TEXPOOL, MFPOOL): Include . after all, now that we
+        use TEXPOOL to search for tcx files.
+
+Sun Jul  9 15:30:59 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_find_file): Don't go through the
+        mapped_name_list if it's null.
+
+Wed Jun 21 19:47:33 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * lib.h (FATAL5): Define this.
+
+Sat Jun 10 15:52:41 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_find_file): Use texfonts.map aliases for TFM
+        searches.
+        * tex-file.h: Doc fix.
+        * fontmap.c (kpse_fontmap_lookup): New name. Fault in the map
+        table as needed, instead of initializing. Make map_create static.
+        * fontname.h: New name; remove map_create.
+        * tex-glyph.c (try_fontmap): Just call kpse_fontmap_lookup, no
+        need to create it.
+
+        * fontmap.c (map_lookup): Don't let return value fall off the end
+        in the suffix-appending case.
+        From: "Heading, Anthony" <heading_anthony@jpmorgan.com>.
+
+Fri Jun  9 19:11:34 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tilde.c: Only assume PWD_H for looking up ~user, not for ~ or ~/.
+        * make-suffix.c: Use IS_DIR_SEP instead of assuming /.
+        * concatn.c: Free the in-between concatenations to avoid garbage.
+        * absolute.c [OS2]: Use same conventions as for DOS.
+        * c-std.h, c-pathch.h, c-fopen.h: Likewise.
+        From: rs@purple.in-ulm.de (Ralph Schleicher).        
+
+Tue Jun  6 13:11:46 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * lib.h (itoa) [!HAVE_ITOA]: Define conditionally.
+        * itoa.c: Likewise.
+        * acconfig.h (HAVE_ITOA): Add this.
+
+        * c-pathch.h, c-fopen.h [DOS]: Changes from web2pc from Wayne.
+
+        * xputenv.c: Doc fix.
+
+        * truncate.c (kpse_truncate_filename): Check for a device separator.
+
+        * elt-dirs.c (main): Tests for Amiga.
+
+Mon Jun  5 13:12:10 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * absolute.c: Add Amiga support.  From Andreas Scherer.
+        * c-pathch.h: Ditto.
+        * elt-dirs.c (dir_list_add): Ditto. Check for device separators, too.
+
+Sun Jun  4 11:29:18 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * c-proto.h (AA): New macro to throw away (or keep) any number of
+        arguments, used with an extra set of parens.
+
+        * Makefile.in (distdir): Put PROJECTS in the distribution.
+
+Sat Jun  3 11:53:45 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in (main_memory): Add definitions for TeX array sizes.
+
+        * config.h (progname.h): Include this.
+        * prog{init,name}.c, kpsewhich.c: No longer need to include it.
+        * lib.h (START_FATAL, FATAL_PERROR): Use program_invocation_name
+        in the error message.
+
+        * variable.h: Doc fix.
+
+Fri Jun  2 13:41:29 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * config.h (DOSISH) [DOS || OS2]: Define this.
+
+Tue May 30 15:43:56 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_find_file): Don't look for foo.sty.tex before
+        foo.sty. Suggested by worsch@ira.uka.de.
+
+Mon May 29 15:24:38 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * db.c (db_insert): If DOS, don't check that first character on a
+        line IS_DIR_SEP.  From Sebastian.
+
+Sat May 27 13:51:47 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * pathsearch.c (log_search): Cast time_t arg to avoid printf warning.
+
+        * lib.h (atou): Declare it.
+        * Makefile.in (objects): Add atou.o.
+        * atou.c: New file.
+
+Sun May 21 10:58:31 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * xfopen.c: Assert non-null filenames.
+
+Mon May 15 17:40:27 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * kpsewhich.c (USAGE): Add one-line description to the help message.
+
+Sun Apr 16 14:25:06 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * line.c (BLOCK_SIZE): Increase to 56, to avoid realloc's.
+
+Fri Apr 14 15:56:13 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (objects): Add xfseek and xftell, from fontutils.
+
+Mon Mar 13 20:05:02 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXPK.in: Don't egrep in a file that doesn't exist.
+
+Fri Mar 10 10:49:28 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_find_file): Abort if the name passed in is null
+        or empty.
+
+Thu Mar  9 15:23:07 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_init_format): Only do suffix searches for GF files.
+
+        * acconfig.h: Warn that this is not the right thing to edit to fix
+        configuration problems.
+
+Thu Mar  2 15:58:11 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * texmf.cnf.in (TEXFORMATS): Doc fix.
+
+Fri Feb 24 16:40:23 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * MakeTeXPK.in: `generate rootname' with no trailing punctuation
+        for the dc fonts.
+
+Mon Feb 20 15:23:05 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h (kpse_find_mf): New abbreviation.
+
+Sat Feb 11 13:06:23 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * putenv.c: Include c-auto.h instead of kpathsea/c-auto.h, so the
+        sed commands don't transform it into
+        $(kpathsea_srcdir)/c-auto.h. From Andreas.
+
+        * tex-make.c (maketex): Don't make a bad return from pclose a
+        fatal error. Reported most recently by Wayne Sullivan, also by
+        Andy Piper in the past.
+
+        * MakeTeXPK.in (sauterdir): Only try this if we have the right
+        b-foo.mf file. And correct $DESTDIR=... mistake.
+        From Nick Cropper <nickc@dcs.st-andrews.ac.uk>.
+
+Fri Feb 10 15:49:49 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (INIT_MT): If the .program member has already been
+        set, don't reset it.
+
+Wed Jan 18 15:47:07 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * xopendir.c (xclosedir): Use CLOSEDIR_VOID, not VOID_CLOSEDIR.
+        From tim@maths.tcd.ie.
+
+        * db.c (db_insert): Don't assert db.size>0, since we may not have
+        called kpse_db_search. From te@informatik.uni-hannover.de.
+
+        * MakeTeXPK.in (dc fonts): Don't put a trailing period in the
+        filename. From Tor Lillqvist <tml@hemuli.tte.vtt.fi>.
+
+Sun Jan  8 12:14:47 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Version 2.6.
+
+Wed Jan  4 14:44:34 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (mostlyclean): Remove kpsewhich.
+
+Tue Jan  3 11:48:40 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * kpsewhich.c (long_options): Can't make this automatic.
+
+        * basename.c: Include <kpathsea/config.h> before testing
+        HAVE_BASENAME.
+
+        * Makefile.in (kpsewhich): Make the library before kpsewhich.o.
+        (paths.h): No need for the $(kpathsea_dir)/ any more, now make
+        depend gets rid of it.
+
+        * rm-suffix.c: Doc fix.
+        
+        * kpsewhich.c: Extract the dpi from the filename if possible.
+
+Mon Jan  2 09:45:17 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (kpsexpand): Replace with kpsewhich.
+
+        * proginit.h: Doc fix.
+
+        * texmf.cnf.in (TEXMFCNF): Rename from TEXMF_CNF.
+        * tex-file.c (kpse_init_format): Likewise.
+
+Sun Jan  1 14:04:41 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (MakeTeXPK): Substitute for web2cdir.
+        * MakeTeXPK.in: Use it for MakeTeXPK.site.
+        (install-data): Install texmf.cnf in web2cdir instead of texmf.
+        * texmf.cnf.in (TEXMF_CNF): Default path includes web2cdir.
+
+Sat Dec 31 14:26:48 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (objects): No more @LIBOBJS@.
+        * common.ac: Use AC_CHECK_FUNCS for basename, not REPLACE_FUNCS.
+        The latter doesn't define HAVE_BASENAME.
+        * basename.c [!HAVE_BASENAME]: Conditionalize whole file.
+
+        * Makefile.in (uninstall-exec): Remove kpsexpand.
+        (MakeTeXPK): New target.
+        (install-exec): Install MTPK.
+        (install-library): New target to replace install-headers.
+        (install): Don't install-library by default.
+
+Fri Dec 30 15:53:04 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (objects): Don't put @LIBOBJS@ on a line by itself.
+        From Joachim.
+
+Mon Dec 26 07:55:40 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * common.ac (AC_FUNC_CLOSEDIR_VOID): Call this. Reported by
+        Timothy Murphy <tim@maths.tcd.ie>.
+
+        * tex-file.c (init_path): If a variable is set to an empty value,
+        ignore it.  Suggested by Stephen Gildea <gildea@x.org>.
+
+        * proginit.c: If passed a NULL mode, put / in the environment here.
+        * tex-make.c (kpse_make_tex): Don't do STREQ on NULL (though it
+        should never be NULL in the first place), and properly restore
+        MAKETEX_MODE if it was /.
+
+Tue Dec 20 09:57:21 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * install.texi: Mention how to do optimization.
+
+Mon Dec 19 13:18:04 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h: Doc fix.
+
+Wed Dec 14 14:46:47 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * Version 2.5.
+
+        * pathsearch.c (log_search): Don't prepend the `kdebug:' to the
+        search result.
+
+Sat Dec 10 16:49:12 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-make.c (set_maketex_mag): Make case of magstep -1 work
+        properly.  From a bug report by
+        heiko@lotte.sax.de (Heiko Schlittermann).
+
+Mon Dec  5 11:58:08 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in (objects): Add @LIBOBJS@.
+        * common.ac: Check for basename.
+
+        * db.c (db_insert): Include trailing / in directory part, and pass
+        the key and the value in the right order.  From
+        te@informatik.uni-hannover.de.
+
+Sun Dec  4 14:26:44 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * kpsexpand.c: Add extra filename argument. From
+        ware@cis.ohio-state.edu.
+
+        * common.ac: Use AC_TRY_RUN to test for SMART_PUTENV, not
+        AC_TRY_LINK. From parkes@sierravista.com.
+
+        * acconfig.h: Use #undef instead of commented-out `/* #define'.
+
+Sun Nov 27 13:47:06 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * db.c (db_insert): Don't try to insert into an empty hash table.
+        From dc@cobi.gsfc.nasa.gov (and others).
+
+        * pathsearch.c (log_search): Call DEBUGF, not printf, for the
+        filenames.  From John I.
+
+        * tex-make.c (kpse_make_tex): If MAKETEX_MODE is /, unset it and
+        reset it around the command expansion.
+        (maketex): Back to calling db_insert.
+
+Sat Nov 26 11:44:09 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * cnf.c (read_file): If expansion of $TEXMF (KPSE_DB_DIR) fails,
+        expand DEFAULT_TEXMF.  From te@informatik.uni-hannover.de.
+
+Thu Nov 24 13:41:15 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (KPSE_BST_ENVS): Do not look at TEXINPUTS.
+
+        * tex-file.h: Doc fix.
+
+Tue Nov 15 14:06:56 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * progname.c (kpse_set_progname): Use basename.
+
+Fri Nov 11 19:12:23 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * acconfig.h (HAVE_SIGIO): Add this.
+
+Tue Nov  8 19:14:12 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-make.c (kpse_make_tex): Change argument name from
+        `basename', since now we have a fn by that name.
+        * magstep.c (kpse_magstep_fix): Initialize mdpi.
+        * basename.c (basename): Initalize base.
+
+Mon Nov  7 15:46:21 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * common.ac: Run autoupdate.
+        * c-dir.h: Change #if names and NLENGTH to new style.
+
+Fri Oct 28 21:28:02 1994  K. Berry  (karl@terminus.cs.umb.edu)
+
+        * Version 2.4.
+
+        * tex-make.c (maketex): Don't call db_insert, that routine is
+        buggy. I'll fix it later. In the meantime, trying to get a
+        semi-stable release.
+
+Tue Oct 25 16:43:31 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * Version 2.3.
+
+        * progname.c (kpse_set_progname): Initialize kpathsea_debug from
+        the KPATHSEA_DEBUG envvar.  From neal@ctd.comsat.com.
+
+Mon Oct 24 13:41:24 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * db.c (db_insert): New function.
+        * db.h: Declare it.
+        * tex-make.c (maketex): db_insert the result if we succeeded.
+
+        * basename.c: New file to define basename.
+        * lib.h (basename): Declare it.
+        * Makefile.in (objects): Include basename.o.
+
+        * tex-file.h (kpse_file_format_type): Add missing enum values for
+        base/fmt/pool files.
+        * tex-file.c (kpse_init_format): Add cases for these.
+        From te@informatik.uni-hannover.de.
+
+        * lib.h (WARNING, FATAL): Use fputs instead of fprintf.
+        * Many files: Use DEBUGF instead of printf ("kdebug".
+        * debug.h (DEBUGF) [DEBUG]: Define this.
+
+        * xputenv.c (xputenv): Initialize that static saved_env_items to
+        null, just for documentation's sake.
+
+Tue Oct 18 13:19:06 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (KPSE_*_ENVS): Move environment variable list here.
+        * tex-file.h: Move them from here.
+
+        * tex-glyph.h: Doc fix.
+
+        * tex-file.c (kpse_find_file): Correct off-by-one in suffix
+        comparison. From toy@rtp.ericsson.se.
+
+Mon Oct 17 14:01:02 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * elt-dirs.c (do_subdir): Find a top-level subdir if it matches
+        the POST.
+
+        * db.c (kpse_db_search): Allow for the passed name including a
+        directory part, as in dpi600/cmr10.pk.
+        * tex-glyph.c (try_format): First search all specs with
+        must_exist=false.
+
+        * kpsexpand.c: New file, from te@informatik.uni-hannover.de.
+        * Makefile.in (kpsexpand): New target (a program).
+        (install-exec): Depend on, and install, kpsexpand.
+        
+        * common.ac: Doc fix.
+
+        * cnf.c (do_line): Don't quit just because the variable is in the
+        environment.  From te@informatik.uni-hannover.de.
+
+        * tex-glyph.c (PXL_BITMAP_SPEC): Remove this, we're not going to
+        support pxl1500.
+
+Sun Oct 16 20:46:26 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * kpathsea.texi: Make it clear that names of debugging bits can
+        never be used.
+
+Fri Oct 14 10:31:35 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * Version 2.2.
+
+        * hash.c (hash_lookup) [DEBUG]: Cast to long, not int.
+
+Thu Oct 13 15:39:34 1994  Karl Berry  <karl@owl>
+
+        * db.c (db_build): Warn if ls-R contains nothing useful.
+
+        * debug.c (fopen, fclose) [DEBUG]: fflush stdout.
+        * dir.c (dir_links),
+        * hash.c (hash_lookup),
+        * tex-file.c (kpse_init_format),
+        * elt-dirs.c (kpse_element_dirs): Likewise.
+
+Thu Oct 13 09:02:56 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * hash.c (kpse_debug_hash_lookup_int) [DEBUG]: New global.
+        (hash_lookup): Use it.
+        * hash.h [DEBUG]: Declare it.
+        * dir.c (dir_links) [DEBUG]: Set it and reset it.
+
+        * tex-glyph.c (PXL_BITMAP_SPEC): Add this (pxlNNN/cmr10.pk) for
+        the Bitstream utilities. From abrahams@acm.org.
+        (try_format): Search for this.
+
+Tue Oct 11 15:15:49 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * db.c (db_build): Use kpse_db_dir instead of KPSE_DB_DIR.  This
+        avoids one variable expansion, and te@informatik.uni-hannover.de
+        says otherwise TeX sometimes can't find ls-R.
+
+Sun Oct  9 17:18:23 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * kdefault.c: Rename from default.c.
+        * Makefile.in (objects): Likewise.
+
+Fri Oct  7 12:58:33 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.c (kpse_init_format): Call INIT_MT for the any_glyph
+        case. From carson@lehman.com.
+
+Sun Oct  2 14:11:20 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * magstep.c: Doc fix.
+
+Sun Sep 25 17:11:40 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * Makefile.in: Include library.make.
+
+Thu Sep 22 15:34:40 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tex-file.h (kpse_file_format_type): Don't make equal to the last
+        element index, make one more.  From Eric Auborg.
+
+Thu Sep 15 19:24:30 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (distdir): Include install.texi in the distribution.
+
+Mon Sep 12 11:05:18 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Version 2.1.
+
+Sun Sep 11 15:03:18 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (install-data): Install texmf.cnf if it didn't exist.
+
+Sat Sep 10 13:28:29 1994  Karl Berry  (karl@cs.umb.edu)
+
+	* Makefile.in (texmf.sed, paths.h): Use tr 012 instead of \n.
+	From John Interrante.
+	
+        * Makefile.in (distdir): Include the .aux and .cps files in the
+        distribution.  Don't include paths.h (from John Interrante).
+        
+        * kpathsea.texi: Fix overfull boxes and other TeX errors.
+
+Wed Sep  7 16:28:37 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Version 2.0.
+
+Tue Sep  6 10:33:18 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * dir.c (dir_links): Use %ld for ret, since it's now a long.
+
+Sat Sep  3 09:01:25 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * dir.c (dir_links): Use long instead of int for the cast and the
+        variable, to avoid warnings on the Alpha.
+
+        * c-std.h (SYSV, X_NOT_STDC_ENV): Don't define these here.
+        * c-memstr.h (SYSV): Define this.
+        (_XFUNCS_H_): And this.
+
+        * Makefile.in (distclean): Add texmf.cnf and texmf.sed.
+
+Thu Sep  1 14:22:48 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * xputenv.c (putenv): Declare this to avoid a warning.
+        * xstat.c (lstat): And this.
+
+        * common.ac (SMART_PUTENV): Use program to test for this.  From
+        mike@cs.utah.edu.
+
+        * tex-glyph.c (try_fallback_resolutions): Quit early if there's no
+        resolutions in the list.  From sanjoy@dope.caltech.edu.
+
+Tue Aug 30 14:26:48 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * acconfig.h (FOIL_X_WCHAR_T): New definition.
+
+        * c-std.h (hypot) [!hypot]: Conditionalize declaration.
+
+Fri Aug 26 09:00:24 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (install-data): Install headers into
+        $(includedir)/kpathsea, not just $(includedir).  From john@wpi.edu.
+
+        * pathsearch.c (search): Show results of the search as well as the
+        start of it.
+
+Thu Aug 25 13:40:29 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * proginit.c (kpse_init_prog): Newline at end of fputs.
+
+        * pathsearch.c (search): Add debug statement.
+        * debug.h (KPSE_DEBUG_SEARCH): New bit.
+
+        * tex-file.h (kpse_format_info_type): Rename `font_override_p' from
+        `font_p'. Also `program_enabled' => `program_enabled_p'.
+        Also new member `suffix_search_only'.
+        * tex-file.c (kpse_find_file): Avoid searching for foo.tex.tex, etc.
+
+Tue Aug 16 09:29:59 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-make.c (maketex): Announce that we are running the script
+        before running it.
+
+Mon Aug 15 11:18:19 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * texmf.cnf.in (PKFONTS.xdvi): Write program-specific definition
+        to include gsftopk and ps2pk ``modes''.
+
+Sat Aug 13 16:34:43 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (lib): Rename to program to simplify rules.
+
+        * magstep.h: Doc fix.
+
+        * common.ac (AC_HAVE_FUNCS): Test for bcopy.
+
+Tue Aug  9 14:18:56 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-make.c (misstex): Prepend kpathsea: to the missfont.log
+        message.
+
+Mon Aug  8 17:53:58 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-make.c (set_maketex_mag): Rewrite to call kpse_magstep_fix.
+        * magstep.[ch]: New files.
+
+Fri Aug  5 14:07:51 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * db.c (match): Allow a trailing component in the filename.
+
+Tue Aug  2 08:55:21 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Change `debug:' to `kdebug:'.
+        * hash.c (hash_lookup): Print results of lookup if DEBUG_HASH.
+        * debug.h (KPSE_DEBUG_HASH): New bit, replacing DB_BUILD.
+        * db.c (db_build): Don't print the built hash table.
+
+        * db.c (match): Implement this. Petr Sojka and Zdenek Salvet(?)
+        supplied code for this, but I wound up writing my own.
+        * variable.c (expand): Do variable expansion on the value.
+
+        * texmf.cnf.in (TEXINPUTS): Put this after the .prog-specific entries.
+
+        * tex-file.c (kpse_pict_format): Remember to break after setting
+        the type.
+        (EXPAND_DEFAULT, init_path): Keep raw_path as pre-default expansion.
+
+Sun Jul 31 14:18:09 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * debug.c: Don't include debug.h, it's already in debug.h.
+
+        * Makefile.in (db.o,pathsearch.o): Don't need these special cases
+        since tossed db_dir from paths.make.
+        * db.h (DB_DIR): Change default to $TEXMF, rename to KPSE_DB_DIR.
+        (kpse_db_dir): New global variable (sigh).
+        * db.c (kpse_db_dir): Define.
+        * cnf.c: Include db.h for KPSE_DB_DIR.
+        (read_files): Set kpse_db_dir after all have been read.
+        * pathsearch.c (elt_in_db): Check if kpse_db_dir is null.
+        (path_search): Do not initialize db_dir.
+
+Sat Jul 30 06:12:12 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * c-dir.h [_POSIX_VERSION]: Remove this condition; just use DIRENT.
+
+Fri Jul 29 11:36:25 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.c (init_path): Look up cnf file value if no suffix.
+
+        * xstat.h (SAME_FILE_P): Move here.
+        * c-stat.h (SAME_FILE_P): From here.
+        * file-p.c: Change include.
+        * lib.h (dir_p, dir_links): Declare here.
+        * dir.h: Split into xopendir.h and c-dir.h; Sun 3 include files
+        get confused otherwise, according to john@minster.york.ac.uk.
+	* xopendir.c: Include xopendir.h.
+	* elt-dirs.c, dir.c: Change includes.
+	
+Sun Jul 17 10:21:16 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * hash.c (hash_insert): Put new elements in at the end of the
+        list, instead of the beginning.
+        * hash.h: Document this.
+
+        * texmf.cnf.in (TEXMFROOT): Change to TEXMF.
+        * kpathsea.texi: Likewise.
+
+        * cnf.c (do_line): assert program_invocation_short_name.
+        * progname.c: Doc fix.
+
+        * absolute.[ch] (kpse_absolute_p): Take additional arg relative_ok.
+        * pathsearch.c (log_search): Call it (with false).
+        * tex-glyph.c: Change call.
+
+        * pathsearch.c (path_search): Initialize db_dir here.
+        (elt_in_db): Not here.
+
+Fri Jul 15 11:44:15 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.h: Doc fix.
+
+        * pathsearch.c (log_search): Pass in the whole str_list; anything
+        else is unreliable.
+
+        * proginit.[ch] (kpse_init_prog): Don't pass in argv0; we need it
+        earlier.
+
+Tue Jul 12 11:56:54 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.c (init_path): Use the first envvar that's *set*, not
+        the first in the list.
+
+        * tex-file.h (kpse_format_info_type): New member `type'.
+        * tex-file.c (kpse_init_format): Initialize it.
+
+        * pathsearch.c (log_search): New fn.
+        (search): Call it.
+
+Fri Jul  1 11:54:29 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.c: Doc fix.
+
+Mon Jun 27 10:18:59 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * db.c (db_build): Call kpse_var_expand on the db filename.
+        * pathsearch.c (elt_in_db): Likewise.
+
+        * tex-glyph.h (kpse_find_gf): By analogy with kpse_find_pk.
+
+Sat Jun 25 16:09:05 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-glyph.c (try_format): Try both Unix and DOS bitmap specs,
+        instead of just one or the other.
+        (bitmap_name): No longer needed.
+
+Fri Jun 24 11:52:32 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.c (kpse_find_file): Don't try the suffix if it doesn't
+        exist.
+
+        * tex-file.h (kpse_find_{dvips_header,pict}): New definition.
+
+Thu Jun 23 16:57:58 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.h (kpse_{pict,dvips_header}_format): New consts.
+        (KPSE_{PICT,DVIPS_HEADER}_ENVS): Likewise.
+
+Tue Jun 21 11:53:09 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.c (kpse_find_file): Try the name as given if the name
+        concatenated with the suffix fails, for the sake of, e.g., EPS files.
+
+        * tex-file.h (kpse_find_tex): New definition.
+
+        * absolute.[ch]: Make arg const.
+
+        * tex-glyph.[ch]: (kpse_bitmap_tolerance): Move here from tex-make.
+
+        * c-proto.h (P6[CH]): New definitions.
+
+        * Makefile.in (objects): Add proginit.o.
+        * proginit.[ch]: New files.
+
+Mon Jun 20 14:55:57 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.c (kpse_init_format): Make override path not apply to
+        TFM and VF files.
+
+        * tex-glyph.c (kpse_find_glyph_format): Rename to kpse_find_glyph,
+        and don't call MakeTeXPK if the filename is absolute.
+        * tex-glyph.h: Likewise.
+
+Sun Jun 19 11:00:50 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * common.ac (HAVE_PROGRAM_INVOCATION_NAME): Test for this.
+        * acconfig.h: #undef this by default.
+        * progname.[ch]: New files.
+        * Makefile.in (objects): Add progname.o.
+        * cnf.c (do_line): Check for .<progname> qualification.
+
+Sat Jun 18 16:55:36 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * elt-dirs.c (kpse_element_dirs): Avoid stats in leaf directories
+        found via a non-null post.
+
+Fri Jun 17 14:25:08 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * elt-dirs.c (kpse_element_dirs) [DEBUG]: Print the directory
+        expansion of the path element.
+
+        * str-llist.h: Doc fix.
+
+        * elt-dirs.c (do_subdir): Ignore anything beginning with ., not
+        just `.' and `..'.
+
+Tue Jun 14 11:53:49 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * dir.c (dir_links): Cache the lookups.
+
+        * elt-dirs.c (kpse_element_dirs): Don't expand the argument.
+        * expand.h (kpse_path_expand): New routine.
+        * expand.c: Define it.
+        * pathsearch.h: Doc fix.
+
+        * db.c, tex-file.c [DEBUG]: Prefix output lines with `debug:'.
+
+        * tex-file.h (kpse_format_info_type): Add cnf_path to the struct.
+        * tex-file.c (kpse_init_path): Print the cnf_path.
+        (init_path): Set it, instead of a local variable.
+
+        * pathsearch.c (path_search): Use !! for no-disk-search instead of
+        %%, because now % is the comment char in cnf files.
+        * kpathsea.texi: Document this. Also change all `Kpathsearch' to
+        `kpathsea'.
+
+Mon Jun 13 10:15:49 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-make.h (kpse_set_maketex_mag): Remove.
+        * tex-make.c (kpse_set_maketex_mag): Make static, remove kpse_
+        prefix, and use KPATHSEA_DPI and MAKETEX_BASE_DPI instead of args.
+
+Sun Jun 12 13:49:15 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * db.c (db_build): Put a header on the hash table.
+
+        * tex-glyph.c (try_format): Set extension and path after
+        kpse_init_format, natch.
+
+Sat Jun 11 14:26:34 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (objects): Add cnf.o.
+        * variable.c (expand): Call kpse_cnf_get if no envvar value.
+
+Fri Jun 10 11:20:23 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-make.h: Remove spec type and variable.
+
+Thu Jun  9 13:42:21 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (objects): Remove init-path.o.
+        * tex-file.c (kpse_find_file): Rewrite to initialize the paths
+        only once, and keep all path info in a structure.
+        * tex-file.h: Vastly simplify.
+        * tex-glyph.h (kpse_font_file_type): Move here, since it's really
+        only for glyphs.
+        * tex-glyph.c: Corresponding changes.
+        * debug.h (KPSE_DEBUG_PATHS): New debug bit.
+
+        * default.h, str-list.h: Doc fix.
+
+Tue May 31 10:06:51 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * debug.c: Doc fix.
+
+Mon May 23 11:50:03 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * c-fopen.h (FOPEN_A_MODE): Define this.
+        * tex-make.c (misstex, maketex): Split up kpse_make_tex into
+        these, and create missfont.log if appropriate.
+
+Sun May 22 17:39:52 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-make.h: Doc fix.
+
+Wed May 11 13:25:58 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * configure.in (AC_OUTPUT): Use just `Makefile' instead of
+        `./Makefile', to avoid a bug in Autoconf (through 1.10).
+
+Sun Apr 17 16:18:00 1994  Karl Berry  (karl@ra.cs.umb.edu)
+
+        * debug.h: Prefix macros with KPSE_.
+        * db.c, dir.c: Change calls.
+
+        * common.ac: Remove :: VPATH stuff; that made it in to Autoconf 1.8.
+
+        * Makefile.in (top_srcdir): Define this for configure to substitute.
+
+Thu Apr  7 17:52:05 1994  Karl Berry  (karl@ra.cs.umb.edu)
+
+        * debug.[ch]: Implement fopen/fclose tracing.
+
+Thu Mar 31 07:25:49 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Version 1.8.
+
+Thu Mar 24 10:01:20 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-glyph.c: Doc fix.
+
+        * pathsearch.c (path_search): Don't search the disk if there is
+        magic in the path spec.
+
+        * db.c: Doc fix.
+
+Wed Mar 16 13:50:17 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * readable.c (kpse_readable_file): Complain if errno == EPERM.
+
+Sun Mar 13 11:14:19 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * pathsearch.h (kpse_path_search): Take an extra arg must_exist.
+        * pathsearch.c (kpse_path_search, search, path_search): Likewise.
+        * tex-file.c (kpse_find_file): Change call.
+        * tex-file.h (kpse_find_*): Change these calls, too.
+
+        * hash.c (hash_create): Don't use xcalloc to init pointers to null.
+
+        * db.c (kpse_db_search): Don't free the pointer after incrementing it.
+        From Frank Jensen.
+
+Sat Mar 12 17:55:36 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * db.h (kpse_db_search): Returns a pointer.
+        * db.c (kpse_db_search): If db can't be built, return NULL, else a
+        pointer to the (possibly empty) list.
+        (db_build): Return whether we found the file.
+        * pathsearch.c (path_search): Change call.
+
+Thu Mar 10 07:45:13 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (install-info): New target.
+
+Fri Mar  4 08:06:16 1994  Karl Berry  (karl@cs.umb.edu)
+
+	* hash.c (hash): Change hash function to spread out the values a
+	bit better.
+
+	* debug.h (DEBUG_DB_BUILD): New debug bit.
+	* db.c (db_build) [DEBUG]: If bit is set, print hash table.
+	* hash.h (hash_print): Declare.
+
+Thu Mar  3 08:52:01 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Version 1.7.
+
+Sun Feb 27 15:57:30 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (objects): Add db.o, hash.o.
+        * db.[ch]: New files.
+        * hash.[ch]: Also new files.
+        * pathsearch.c (path_search): Try db search.
+        * tex-glyph.c, fontmap.c: Use general hash functions.
+
+Sat Feb 26 13:15:53 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * fontmap.c: Doc fix.
+
+        * pathsearch.c (INIT_ALLOC): Increase to 75, what the heck.
+
+Fri Feb 25 08:30:50 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-file.[ch]: Decare args const.
+
+Thu Feb 24 07:55:43 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-make.h: Include tex-file.h, not init-path.h.
+
+        * init-path.h (KPSE_*_{ENVS,PATHS}, kpse_font_override_path): Move
+        to tex-font.h.
+        * tex-font.h (kpse_find_{file,tfm,vf}): Also declare these.
+        * tex-font.c (kpse_find_file): Define these.
+        (kpse_font_override_path): Move definition here.
+        
+        * tex-file.*: Rename from tex-font.*.
+        * GNUmakefile: Corresponding changes.
+
+        * elt-dirs.c (do_subdir): Only append the / once we know it's a
+        directory.
+
+Wed Feb 23 16:41:31 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * elt-dirs.c (do_subdir): Don't tack POST on if it is exactly the
+        d_name, so we can find a/b with a path of a//b.
+
+        * c-vararg.h (PVAR3[CH]): New defines.
+
+        * init-path.h: Include KPSE_*_{ENVS,PATHS} here.
+        (kpse_init_path): Take an additional arg font_p.
+        * init-path.c (kpse_override_path): Rename kpse_font_override_path.
+        (kpse_init_path): Only use kpse_font_override_font if font_p.
+
+Mon Feb 21 15:38:53 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * common.ac (extrasub): Define to remove VPATH lines if srcdir = `.'.
+
+Thu Feb  3 06:19:49 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Version 1.6.
+
+        * fn.c (fn_copy0): Remember to allocate space for the null.
+        Thanks, simon.
+
+Wed Feb  2 09:57:47 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * tex-make.h (KPSE_BITMAP_TOLERANCE): Move to here from tex-glyph.c
+        (kpse_check_bitmap_tolerance): Declare.
+        * tex-make.c (kpse_check_bitmap_tolerance): Define.
+
+Tue Feb  1 10:42:03 1994  Karl Berry  (karl@cs.umb.edu)
+
+	* c-std.h (*alloc) [! _MALLOC_INTERNAL]: Make decl conditional.
+
+        * c-std.h [HAVE_STDLIB_H]: Change #if for including <stdlib.h> to this.
+        * common.ac (AC_HAVE_HEADERS): Check for stdlib.h.
+
+        * Makefile.in (paths.h): Do all substitutions globally.
+
+        * absolute.c [DOS]: Include c-ctype.h.
+        * tex-glyph.c (KPATHSEA_BITMAP_NAME) [DOS]: Double the backslash.
+        * elt-dirs.c (do_subdir) [!UNIX_ST_LINK]: Avoid dangling else.
+        From Wayne.
+
+        * paths.h.in: Doc fix.
+
+        * xputenv.c (xputenv): Check entire variable name for being saved,
+        not just a prefix of it.
+
+Mon Jan 31 12:05:30 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * fn.c (fn_copy0): Allocate LEN if that's bigger than CHUNK_SIZE.
+        (CHUNK_SIZE): Increase to 75.
+
+Sat Jan 22 15:36:08 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * Version 1.5.
+
+        * common.ac (AC_HAVE_FUNCS): Check for memmove.
+
+        * paths.h.in (DEFAULT_MF_PATH): Don't search just public/, cause
+        we need ams/.
+
+Mon Jan 17 15:09:36 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.h.in (DEFAULT_{FMT,BASE}_PATH): Include `.'.
+
+Sun Jan 16 14:50:02 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.h.in (DEFAULT_PK_PATH): Search subdirs of pk.
+
+Mon Jan 10 16:40:35 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * xputenv.c (xputenv): Don't try to be smart about saving/freeing
+        stuff if SMART_PUTENV is defined.
+
+        * c-std.h (assert) [!HAVE_ASSERT_H]: Define as nothing, to avoid
+        undefined references to assert.
+
+Tue Dec 21 16:28:13 1993  Karl Berry  (karl@cs.umb.edu)
+
+        * c-std.h (SYSV) [STDC_HEADERS]: Define, to get around old X
+        include files under hpux.
+
+Sun Dec 19 13:06:15 1993  Karl Berry  (karl@cs.umb.edu)
+
+        * Makefile.in (objects): Put tex-font.o first.
+
+Sat Dec 18 15:03:57 1993  Karl Berry  (karl@cs.umb.edu)
+
+        * config.h (GCC_WCHAR_T, _GCC_WCHAR_T): Remove these; I have
+        another theory now for wchar_t, done in xdvi.h and x11.c.
+
+Sat Dec 18 14:41:15 1993  Karl Berry  (karl@owl.hq.ileaf.com)
+
+	* c-memstr.h ([r]index) [STDC_HEADERS]: Conditionalize #define.
+
+Tue Dec 14 17:43:30 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Makefile.in (paths.h): Change substitutions accordingly.
+	* paths.h.in (DEFAULT_FMT_PATH): Variable is now fmtdir.
+	(DEFAULT_{BIB,BST}_PATH): Variable is now texmf_prefix.
+
+Sat Dec 11 13:21:43 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-make.c (ABS): New macro.
+	(kpse_set_maketex_mag): Use it, instead of fabs.
+
+Fri Dec 10 15:31:16 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* xmalloc.c, xrealloc.c: Use exit instead of abort, remove abort
+	decls, and reword error messages to be less cryptic. From
+	john@minster.york.ac.uk.
+
+	* dir.h: use `defined' instead of just `DIRENT || _POSIX_VERSION'.
+	How annoying. From kretschm@aitxu3.ait.physik.uni-tuebingen.de.
+
+	* xputenv.c (putenv): Remove declaration, as different systems do
+	it differently. From kayvan@satyr.sylvan.com.
+
+Thu Dec  9 09:12:33 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-make.c (kpse_set_maketex_mag): Allow off-by-1 when deciding
+	if a dpi is a magstep.
+
+Tue Dec  7 11:03:51 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-make.c (kpse_set_maketex_mag): New routine from dvips,
+	called by dvipsk and xdvik to ensure consistency.
+	(magstep): Subroutine of above, also from dvips.
+	* tex-make.h: Declare it.
+
+	* tex-doc.texi: Correct menu item (from maechler@stat.math.ethz.ch).
+
+Fri Dec  3 12:53:38 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* c-pathmx.h: Doc fix.
+
+Sat Nov 27 14:36:11 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* default.h: Doc fix.
+
+	* paths.h.in (texfontdir): This has been renamed to fontdir.
+
+Sun Nov 21 08:28:41 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Makefile.in (distdir): Include HIER in the distribution, until
+	we merge it into the manual.
+
+Sun Nov  7 14:54:47 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* c-namemx.h (NAME_MAX): Avoid use of pathconf.
+	* c-pathmx.h: Doc fix.
+
+Thu Nov  4 14:50:45 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* config.h (_GCC_WCHAR_T) [!GCC_WCHAR]: Conditionalize.
+
+	* c-std.h (EXIT_SUCCESS) [!EXIT_SUCCESS]: Move these defines
+	outside of !STDC_HEADERS, for the sake of SunOS 4.1.1.  (From
+	vonbrand@inf.utfsm.cl.)
+
+Wed Nov  3 14:43:05 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Version 1.4.
+
+Wed Nov  3 07:05:48 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* paths.h.in (DEFAULT_{BASE,FMT}_PATH): Had these definitions reversed.
+
+Fri Oct 29 19:27:36 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-glyph.c (try_fallback_resolutions): Initialize ret in all cases.
+
+Thu Oct 28 14:32:34 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* lib.h: Doc fix.
+
+	* common.h (AC_UNISTD_H): Replace this with unistd.h in the list
+	of HAVE_HEADERS.
+
+Tue Oct 26 13:59:33 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* str-llist.[ch]: New files.
+	* Makefile.in (objects): Add str_llist.o.
+	* elt-dirs.[ch]: Use str_llist_type throughout.
+	* pathsearch.c (dir_list_search): Take a str_llist_type, and float
+	a successful dir towards the top.
+	(path_search): Change call of kpse_element_dirs.
+
+Sun Oct 24 19:41:49 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* elt-dirs.c (do_optional): Remove this stub.
+	(expand_elt): Don't call it.
+
+Fri Oct 22 14:46:44 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* xmalloc.c, xrealloc.c, line.c, pathsearch.c: Doc fix.
+
+Tue Oct 19 12:11:32 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-glyph.c (try_fallback_resolutions): New routine.
+	(kpse_find_glyph_format): Call it, instead of repeating (the now
+        pretty complicated) code.
+	* tex-font.c (kpse_init_fallback_resolutions): Pass the value of
+	any environment variable, not its name. From R.Kooijman@et.tudelft.nl.
+
+	* c-memstr.h (str[r]chr) [!str[r]chr]: Conditionalize. From
+	maarrrk@seidel.ece.ucsb.edu.
+
+Tue Oct 12 16:26:48 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-make.c: Doc fix.
+
+Thu Oct  7 13:13:57 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* xmalloc.c: Rewrite to not require <config.h>.
+	* xrealloc.c: Likewise.
+
+	* make-suffix.c (make_suffix): Declare variables const.
+	* remove-suffx.c (remove_suffix): Likewise.  Also rename to
+	rm-suffix.c.
+	* xputenv.c (putenv): Declare with correct prototype.
+	* fontmap.c (internal routines): Likewise.
+	* line.c (xmalloc, xrealloc): Declare as void *.
+	(From john@minster.york.ac.uk.)
+
+Wed Oct  6 06:49:53 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Version 1.3.
+
+	* tilde.c (kpse_tilde_expand): Always return a malloc-ed value.
+	(From ken@cs.toronto.edu.)
+
+Sun Oct  3 14:11:33 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* config.h (_GCC_WCHAR_T): Define.
+
+Sat Oct  2 17:17:32 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Makefile.in (install-*): Don't reassign PATH, just invoke
+	mkdirchain explicitly.
+
+	* tex-glyph.c (KPATHSEA_BITMAP_NAME) [DOS]: Define what I think
+	will work for this ...
+
+	* paths.h.in: Doc fix.
+
+	* Makefile.in: Doc fix.
+
+	* tex-glyph.c (kpse_find_glyph_format): Unconditionally initialize
+	glyph_paths[*], since we might use them both in try_size.  From
+	worsch@ira.uka.de.
+
+Fri Oct  1 12:02:11 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* expand.c: Doc fix.
+
+Wed Sep 29 15:21:49 1993    (karl@terminus.cs.umb.edu)
+
+	* Version 1.2.
+
+Sat Sep 25 14:12:00 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* pathsearch.c (path_search, absolute_search): Don't initialize
+	structs.
+
+Fri Sep 24 12:50:00 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-glyph.c (try_size): Skip the simultaneous stuff.
+	(try_format): Set the envvar here.
+	(bitmap_name): Not here.
+	* pathsearch.c (kpse_*_multi_search): Delete.
+	Change most other routines to take only a single name again,
+	instead of a name list.
+	* pathsearch.h: Delete decls.
+
+	* tex-glyph.c (init-path.h): Don't need to include this.
+
+	* tex-glyph.c (kpse_find_glyph_format): Try the fallback
+	resolutions for the fallback font.
+
+	* Makefile.in (warn_more, MAKEINFO_FLAGS) [hayley]: Define these
+	for development and distribution.
+
+	* Makefile.in (dvi): Make analogous to info (including use of new
+	suffix rule).
+
+	* tex-glyph.c (kpse_find_glyph_format): Set KPATHSEA_NAME to the
+	fallback font if we get that far.
+
+Wed Sep 15 19:29:56 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* filefmt.h (KPSE_*_PATH): Pass NULL as first arg.
+
+	* xputenv.c (xputenv): Rewrite again to save the variable names,
+	not the old items.
+
+Mon Sep 13 06:55:29 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* concatn.h: Doc fix.
+
+Sun Sep 12 15:54:55 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* lib.h (XTALLOC): Parenthesize the cast.
+
+	* xputenv.c (xputenv): Rewrite to collect some of the garbage.
+
+Fri Sep 10 14:00:35 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* lib.h (ENVVAR_SET_DEFAULT): No longer needed.
+
+	* xputenv.c (xputenv_int): New routine.
+
+Thu Sep  9 14:58:00 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-make.c (MAKE_TEX_PK_SPEC): Change MAKETEX_DPI to
+	KPATHSEA_DPI.
+
+	* tex-glyph.c (try_fontmap): Use KPSE_GLYPH_PATH.
+	* filefmt.c (KPSE_GLYPH_{PATH,ENVS}): New macros.
+	(KPSE_{GF,PK}_ENVS): Use GLYPH_ENVS.
+
+	* tex-glyph.c (bitmap_name): Rewrite to use a variable spec,
+	introducing KPATHSEA_{BITMAP_NAME,FORMAT,DPI,NAME}.
+	(kpse_find_glyph_format): Set KPATHSEA_DPI instead of MAKETEX_DPI;
+	also set KPATHSEA_NAME.
+	(try_fontmap): Also set KPATHSEA_NAME here.
+	(try_size): Set KPATHSEA_DPI here.
+
+	* tex-glyph.c (try_name): Delete this routine.
+	(kpse_find_glyph_format): Try fallback resolutions here, call
+	try_resolution directly.
+	(try_fontmap): Call try_resolution directly.
+
+	* init-path.h: Need not include c-proto.h.
+
+Sun Aug 29 13:34:25 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-make.c: Doc fix.
+
+	* filefmt.h: Don't need c-proto.h or types.h.
+
+Fri Aug 27 10:36:46 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* c-vararg.h (PVAR2C): Take AP as an arg.
+
+	* init-path.[ch] (kpse_init_path): Take the current value as an
+	additional argument, separate from the default path, and always
+	expand_default.
+
+	* uppercasify.c (uppercasify): Don't discard upcased result!
+
+Thu Aug 26 10:36:28 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Version 1.1.
+
+Sun Aug 22 19:18:35 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* install-data (install-data): Replace nonexistent
+	$(kpath_includedir) with $(includedir), and define it.  Also
+	remove c-auto.h.
+
+Thu Aug  5 09:03:22 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Version 1.0.
+
+Wed Aug  4 13:51:24 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-glyph.c (kpse_find_glyph_format): Fill in the font_file
+	struct in the maketex case.
+
+	* Makefile.in (info): Just depend on kpathsea.info, and rely on
+	new suffix rule to do the work.
+
+Tue Aug  3 17:50:40 1993  Karl Berry  (karl@fishbowl.hq.ileaf.com)
+
+	* tex-glyph.c (try_name): Don't free expanded_name if we're
+	returning it.
+
+Tue Aug  3 10:13:43 1993  Karl Berry  (karl@owl.hq.ileaf.com)
+
+	* version.c (kpathsea_version_string): Do not declare const.
+
+	* line.h (read_line): Protoize decl.
+
+Tue Aug  3 09:10:07 1993  Karl Berry  (karl@blood.hq.ileaf.com)
+
+	* c-memstr.h (bcmp, bcopy, bzero) [!HAVE_BCOPY]: Conditionalize.
+
+	* putenv.c: Include <kpathsea/c-auto.h>, and use const when
+	calling memcpy.
+
+Sun Aug  1 08:48:49 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Add new features to manual.
+
+	* Makefile.in (objects): Include putenv.o.
+	* putenv.c: New file from gdb.
+	* common.ac: Test for putenv.
+
+Sat Jul 31 11:54:31 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Makefile.in (distclean): Remove paths.h.
+
+	* Most files: changes for traditional C compatibility.
+
+	* filefmt.h: Add new KPSE_..._PATH's for the other formats.
+	* paths.h.in: Add defaults.
+	* Makefile.in (paths.h): sed the values in.
+
+Fri Jul 30 17:23:10 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* filefmt.h (KPSE_VF_PATH): Add empty parens.
+
+	* tex-paths.h*: Rename to just paths.h*.
+
+Tue Jul 27 09:00:58 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* filefmt.h: Include tex-paths.h, and use default paths in
+	KPSE_..._PATH macros.
+
+	* find-suffix.c: Correct logic.
+
+	* filefmt.h: Include init-path.h.
+
+Sat Jul 24 10:44:21 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-glyph.c (kpse_find_glyph_format): Assign to it.
+	* tex-font.h (kpse_font_file_type): New member `source'.
+	(KPSE_FONT_FILE_SOURCE): Accessor macro.
+	(kpse_source_type): New type.
+
+Wed Jul 21 19:45:45 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Makefile.in (configclean): New target.
+
+Sun Jul 18 13:53:38 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tilde.[ch] (kpse_expand_tilde): Rename to kpse_tilde_expand.
+
+	* elt-dirs.c, pathsearch.c, tex-glyph.c: Replace calls to
+	kpse_expand_tilde with kpse_expand.
+	* expand.[ch]: New files.
+	* Makefile.in (objects): Add it.
+
+	* fn.[ch]: New files.
+	* elt-dirs.c (fn*): Moved to fn.c.
+	* tex-make.c, variable.c: Use the new routines.
+	* *obstack*: No longer needed.
+	* Makefile.in (objects): Appropriate changes.
+
+Sat Jul 17 13:25:25 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* concat.c: Doc fix.
+
+	* pathsearch.c (search, path_search): Expand variable references.
+
+	* itoa.c: New file.
+	* lib.h (itoa): Declare it.
+	* Makefile.in (objects): Add it.
+
+	* lib.h (ENVVAR_SET_DEFAULT): New macro.
+	* tex-glyph.c (kpse_find_glyph_format): Call it to set the dpi.
+
+Fri Jul 16 09:10:52 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* xputenv.c: New file.
+	* Makefile.in (objects): Add it.
+	* lib.h (xputenv): Declare it.	
+
+	* c-obstack.h: New file.
+	* variable.[ch]: New files.
+	* Makefile.in (objects): Add it.
+
+	* uppercasify.c: New file.
+	* Makefile.in (objects): add it.
+	* lib.h (uppercasify): Declare it.
+
+Tue Jul 13 13:47:54 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-glyph.c (kpse_find_glyph_format): Simplify path initialization.
+	* filefmt.h: New file; add abbrevs for GF and PK inits.
+
+	* Makefile.in (objects): Add obstack.o and tex-make.o.
+	* obstack.[ch]: New files from GNU.
+	* concatn.[ch], tex-make.[ch]: New files.
+	* init-path.c: Doc fix.
+
+	* elt-dirs.c: Doc fix.
+	* readable.[ch]: Doc fixes.
+
+Sun Jul 11 13:37:02 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-font.h (kpse_font_format_type): Rename to kpse_file_format_type,
+	and include the other file formats.
+	* tex-glyph.c: Change uses.
+
+Tue Jul  6 08:09:10 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-font.c (kpse_fallback_font): Initialize to NULL.
+
+Mon Jul  5 08:23:09 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-glyph.c (try_size): Don't fill in FONT_FILE if it's null.
+
+	* tex-font.c (kpse_init_fallback_resolutions): Look for TEXSIZES
+	after the program-specific *SIZES var.
+
+	* tex-glyph.c (kpse_find_glyph_format): Use kpse_init_path.
+	* Makefile.in (objects): Add init_path.o.
+	* tex-font.[ch] (kpse_override_path): Move to init-path.[ch].
+	* init-path.[ch]: New files.
+	* c-vararg.h: New file.
+
+Sun Jul  4 11:26:17 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-font.c (kpse_init_fallback_resolutions): New routine.
+	* tex-font.h: Declare it, and companion return type.
+
+Fri Jul  2 10:43:11 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-glyph.c (kpse_find_glyph_format): Take first successful
+	fontmap entry.
+
+	* fontmap.c (map_file_parse): Take first % on line as starting the
+	comment, not the last.
+
+	* fontmap.c (map_insert): Always insert the new element.
+
+Thu Jul  1 19:21:35 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* fontmap.c (map_lookup): Return a list, not a single string.
+	(map_lookup_str): Likewise.
+	* fontmap.h (map_lookup): Change decl.
+	* tex-glyph.c (kpse_find_glyph_format): Change caller.
+
+Sat Jun 26 11:48:36 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* tex-font.h: Doc fix.
+
+Thu Jun 24 11:16:41 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* configure.in (MISSING_HEADERS): Toss in favor of HAVE_HEADERS.  Sigh.
+	Also, move all this to an include file.
+	Change uses in several files.
+
+	* stat.h: Rename to c-stat.h, and change includers.
+
+	* Makefile.in (objects): Add tex-glyph.o.
+	* pathsearch.[ch] (kpse_*_multi_search): New routines.
+
+Sat Jun 19 11:37:18 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* str-list.c (str_list_free): New routine.
+
+Fri Jun 18 13:54:08 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* fontmap.c (map_create): Rewrite to use kpse_all_path_search.
+	Include const in various subroutines.
+
+Tue Jun 15 15:58:18 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Change <kpathsea/pathsrch.h> to pathsearch.  Rename the files
+	themselves.
+
+	* elt-dirs.c (cache): Copy the key into our own storage, since it
+	comes from kpse_path_element and might get overwritten.  Should we
+	copy all the values, too?
+
+Sun Jun 13 16:49:09 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* pathsearch.c (dir_list_search): Don't need to append the null
+	here; in fact, it's wrong, since then the final list might have
+	nulls in the middle.
+
+	* elt-dirs.c (dir_list_add): Correct check for new directory
+	already ending in /.
+
+Fri Jun 11 10:45:33 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* str-list.[ch]: New files.
+	* pathsrch.c: Use it for the dir_list routines.
+	* Many changes and new files throughout for new implementation
+	including TeX-font-lookup routines.
+
+Tue Jun  8 14:00:54 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Most files: Change `const string' (constant pointer) to `const
+	char *' (pointer to constant data).  What a crock.
+
+Mon Jun  7 09:43:21 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* debug.[ch]: New files.
+	* config.h: Include debug.h.
+
+	* dir-p.c: Rename to dir.c.
+	(dir_links): New routine.
+
+	* c-std.h (assert.h) [!ASSERT_H_MISSING]: Include this.
+	* configure.in: Check for it with new macro AC_MISSING_HEADERS.
+
+Thu Jun  3 10:12:12 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* dirio.h (leaf_dir_p): No longer defined; rename to dir.h.
+	* xopendir.c, dir-p.c, pathsrch.c: Change include.
+
+Mon May 31 07:49:16 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* c-std.h (EXIT_{SUCCESS,FAILURE}): Define these if they're undefined.
+
+	* config.h: Use <kpathsea/...> instead "...".
+
+	* kpathlib.h: Had #ifndef protection messed up.  Rename to lib.h.
+
+	* c-memstr.h (index, rindex) [!index, !rindex]: Make definitions
+	conditional.
+
+Tue May 25 10:07:00 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* c-{namemx,pathmx,pathch,...}.h: Doc fixes.
+
+	* c-systypes.h: New file.
+	* c-std.h: Include it.
+
+	* stat.h: New file.
+	* xstat.h: Include it.
+
+	* configure.in (AC_HAVE_HEADERS): Test for `pwd.h'.
+
+Sun May 23 19:06:22 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* pathsrch.[ch]: Doc fixes.
+
+Fri May 21 11:27:54 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* line.c (free): Declare.
+
+	* pathsrch.c, find-suffix.c: Change caller.
+	* c-pathch.h ({IS_,}{DIR,ENV}_SEP): Rename existing confusing
+	definitions to these.  Suggested by rocky.
+
+Mon May 17 08:18:18 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Version 0.3.
+
+	* pathsrch.c (expand_default): Handle doubled colon and
+	nothing-but-colon cases.
+
+	* Write documentation, change Makefile accordingly.
+
+Thu May 13 16:32:34 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* c-std.h (popen) [VMS]: Make decl conditional, and include
+	<unixlib.h> and <unixio.h>.
+
+Mon May 10 07:12:50 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Version 0.2.
+
+	* version.c: Put in placeholder.
+
+Sun May  9 10:42:34 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* config.h (c-auto.h): Use <...> instead of "...".
+
+Tue May  4 14:54:41 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Makefile.in (info check dvi): New targets (that do nothing).
+
+Mon May  3 13:46:17 1993  Karl Berry  (karl@claude.cs.umb.edu)
+
+	* Version 0.1.
+
+	* Use KPATHSEARCH_ prefix for various headers' cpp protections.
+
+Sun May  2 10:28:25 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* Makefile.in (dist): Depend on TAGS, and put it in the dist.
+
+	* Makefile.in (c-auto.h.in): Remove extra $(srcdir).
+
+Sun Apr 25 11:22:12 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* pathsrch.h: Include c-proto.h.
+
+	* make-suffix.c: New file.
+	* Makefile.in (objects): Add the .o.
+
+	* file-p.c: Use the SAME_FILE_P macro.
+
+	* fontmap.h: Include c-proto.h and types.h.
+
+	* lib.h: Rename to kpathlib.h.
+	* config.h: Include changed.
+
+	* c-proto.h, c-std.h: Doc fix.
+
+	* c-limits.h [LIMITS_H_MISSING]: Conditionalize include of c-std.h.
+
+	* xstat.h: Include c-std.h.
+
+	* Makefile.in (c-auto.h.in): Add unused warning to top.
+
+	* dirio.h: Include c-proto.h and types.h.
+
+Fri Apr 23 16:11:13 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* line.c: Don't include config.h, just declare xmalloc and
+	xrealloc explicitly.
+
+	* pathsrch.c: paths.h need not be included.
+
+	* Created.
new file mode 100644
--- /dev/null
+++ b/kpathsea/HIER
@@ -0,0 +1,87 @@
+TeX directory structure
+=======================
+
+  This section describes the default installation hierarchy of the
+distribution.  It conforms to both the GNU coding standards and the TeX
+directory structure (TDS) standard.  For rationale and further
+explanation, please see those documents.  The GNU standard is available
+as `ftp://prep.ai.mit.edu/pub/gnu/standards/standards.texi' and
+mirrors.  The TDS document is available from `CTAN:/tex-archive/tds'
+(*note unixtex.ftp::.).
+
+  You can change the default paths in many ways (*note Changing search
+paths::.).  One common desire is to put everything (binaries and all)
+under a single top-level directory such as `/usr/local/texmf' or
+`/opt/texmf'--in the terms used below, make PREFIX and TEXMF the same.
+For specific instructions on doing that, *note configure scenarios::..
+
+  Here is a skeleton of the default directory structure, extracted from
+the TDS document:
+
+     PREFIX/      installation root (`/usr/local' by default)
+      bin/         executables
+      man/         man pages
+      include/     C header files
+      info/        GNU info files
+      lib/         libraries (`libkpathsea.*')
+      share/       architecture-independent files
+       texmf/      TDS root
+        bibtex/     BibTeX input files
+         bib/        BibTeX databases
+          base/       base distribution (e.g., `xampl.bib')
+          misc/       single-file databases
+          PKG/       name of a package
+         bst/        BibTeX style files
+          base/       base distribution (e.g., `plain.bst', `acm.bst')
+          misc/       single-file styles
+          PKG/       name of a package
+        doc/         additional documentation
+        dvips/       `.pro', `.ps', `psfonts.map'
+        fonts/       font-related files
+         TYPE/         file type (e.g., `tfm', `pk')
+          MODE/          type of output device (types `pk' and `gf' only)
+           SUPPLIER/       name of a font supplier (e.g., `public')
+            TYPEFACE/        name of a typeface (e.g., `cm')
+             dpiNNN/           font resolution (types `pk' and `gf' only)
+        metafont/    Metafont (non-font) input files
+         base/        base distribution (e.g., `plain.mf')
+         misc/        single-file packages (e.g., `modes.mf')
+         PKG/           name of a package (e.g., `mfpic')
+        metapost/    MetaPost input files
+         base/        base distribution (e.g., `plain.mp')
+         misc/        single-file packages
+         PKG/           name of a package
+         support/     support files for MetaPost-related utilities (e.g., `trfonts.map')
+        mft/         `MFT' inputs (e.g., `plain.mft')
+        tex/         TeX input files
+         FORMAT/         name of a format (e.g., `plain')
+          base/        base distribution for FORMAT (e.g., `plain.tex')
+          misc/        single-file packages (e.g., `webmac.tex')
+          local/       local additions to or local configuration files for FORMAT
+          PKG/           name of a package (e.g., `graphics', `mfnfss')
+         generic/     format-independent packages
+          hyphen/      hyphenation patterns (e.g., `hyphen.tex')
+          images/      image input files (e.g., Encapsulated PostScript)
+          misc/        single-file format-independent packages (e.g., `null.tex').
+          PKG/           name of a package (e.g., `babel')
+        web2c/        implementation-dependent files (`.pool', `.fmt', `texmf.cnf', etc.)
+
+  Some concrete examples for most file types:
+
+     /usr/local/bin/tex
+     /usr/local/man/man1/xdvi.1
+     /usr/local/info/kpathsea.info
+     /usr/local/lib/libkpathsea.a
+     /usr/local/share/texmf/bibtex/bst/base/plain.bst
+     /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmr10.600pk
+     /usr/local/share/texmf/fonts/source/public/pandora/pnr10.mf
+     /usr/local/share/texmf/fonts/tfm/public/cm/cmr10.tfm
+     /usr/local/share/texmf/fonts/type1/adobe/utopia/putr.pfa
+     /usr/local/share/texmf/metafont/base/plain.mf
+     /usr/local/share/texmf/metapost/base/plain.mp
+     /usr/local/share/texmf/tex/plain/base/plain.tex
+     /usr/local/share/texmf/tex/generic/hyphen/hyphen.tex
+     /usr/local/share/texmf/web2c/tex.pool
+     /usr/local/share/texmf/web2c/tex.fmt
+     /usr/local/share/texmf/web2c/texmf.cnf
+
new file mode 100644
--- /dev/null
+++ b/kpathsea/INSTALL
@@ -0,0 +1,790 @@
+Contents:
+
+Installation
+  Simple installation
+  Custom installation
+    Disk space
+    Kpathsea application distributions
+    Changing search paths
+      Default path features
+      Default path generation
+    Running `configure'
+      `configure' shells
+      `configure' options
+      `configure' environment
+      `configure' scenarios
+      Shared library
+    Running `make'
+    Installing files
+    Cleaning up
+    Filename database generation
+    `MakeTeX' scripts
+      `MakeTeX' configuration
+      `MakeTeX' script names
+      `MakeTeX' script arguments
+    Installation testing
+  Security
+
+
+Installation
+************
+
+  The procedure for Kpathsea (and Web2c, etc.) configuration and
+installation follows.  If trouble, *note Common problems::., a copy of
+which is in the file `kpathsea/BUGS'.
+
+Simple installation
+===================
+
+  Installing TeX and friends for the first time can be a daunting
+experience.  Thus, you may prefer to skip this whole thing and just get
+precompiled executables: *note unixtex.ftp::..
+
+  This section explains what to do if you wish to take the defaults for
+everything (installing under `/usr/local'), and generally to install in
+the simplest possible way.  Most steps here refer to corresponding
+subsection in the next section which explains how to override defaults
+and generally gives more details.
+
+  1. Be sure you have enough disk space: approximately 8 megabytes for
+     the compressed archives, 15MB for sources, 45MB for compilation,
+     40MB for the (initial) installed system (including library files).
+     *Note Disk space::.
+
+  2. Retrieve these two distribution archives:
+    `ftp://ftp.tug.org/tex/texk.tar.gz'
+          These are the sources, which you will be compiling.
+
+    `ftp://ftp.tug.org/tex/texmflib.tar.gz'
+          This is a basic set of input files.  You should unpack it in
+          the directory `/usr/local/share'; doing so will create a
+          `texmf' subdirectory there.
+
+     *Note Kpathsea application distributions::.
+
+  3. When using the default search paths, there is no need to edit any
+     distribution files. *Note Changing search paths::.
+
+  4. At the top level of the distribution, run `sh configure'.  (If you
+     have the GNU Bash shell installed, run `bash configure'.) *Note
+     Running configure::.
+
+  5. `make'. *Note Running make::.
+
+  6. `make install'. *Note Installing files::.
+
+  7. `make distclean'. *Note Cleaning up::.
+
+  8. Set up a cron job to rebuild the filename database that makes
+     searching faster.  This line will rebuild it every midnight:
+          0 0 * * * cd /usr/local/share/texmf && /BINDIR/MakeTeXls-R
+     *Note Filename database generation::, and *Note Filename
+     database::.
+
+  9. If you're installing Dvips, you also need to set up configuration
+     files for your printers and make any additional PostScript fonts
+     available.  *Note Installation: (dvips)Installation.  If you have
+     any color printers, *note Color device configuration: (dvips)Color
+     device configuration..
+
+ 10. The first time you run a DVI driver, a bunch of PK fonts will be
+     built by Metafont via `MakeTeXPK' (and added to the filename
+     database).  This will take some time.  Don't be alarmed; they will
+     created only this first time (unless something is wrong with your
+     path definitions).
+
+     By default, `MakeTeXPK' assumes `/usr/local/share/texmf/fonts' is
+     globally writable.  If you need a different arrangement, *note
+     MakeTeX configuration::..
+
+     *Note MakeTeX scripts::.
+
+ 11. For some simple tests, try `tex story \\bye' and `latex simple'.
+     Then run `xdvi story' or `dvips simple' on the resulting DVI files
+     to preview/print the documents.  *Note Installation testing::.
+
+Custom installation
+===================
+
+  Most sites need to modify the default installation procedure in some
+way, perhaps merely changing the prefix from `/usr/local', perhaps
+adding extra compiler or loader options to work around `configure'
+bugs.  This section explains how to override default choices.  For
+additional distribution-specific information:
+   * `dviljk/INSTALL'.
+
+   * *Note Installation: (dvips)Installation.
+
+   * *Note Installation: (web2c)Installation.
+
+   * `xdvik/INSTALL'.
+
+  These instructions are for Unix systems.  Other operating-system
+specific distributions have their own instructions.  The code base
+itself supports Amiga, DOS, OS/2, and VMS.
+
+  Following are the same steps as in the previous section (which
+describes the simplest installation), but with much more detail.
+
+Disk space
+----------
+
+  Here is a table showing the disk space needed for each distribution
+(described in the next section).  The `(totals)' line reflects the
+`texk' source distribution and `texmflib'; the individual distributions
+don't enter into it.  Sizes are in megabytes.  All numbers are
+approximate.
+
+dviljk        .9       3.8                            
+dvipsk        .9       3.2                            
+xdvik         .7       2.5                            
+web2c         1.3      5.0                            
+web           1.9      6.5       -         -          
+texk          3.8      14.1      43.1      23.5       
+texmflib      3.8      15.0      -         15.0       
+(totals)      7.6      29.1      43.1      38.5       
+
+Kpathsea application distributions
+----------------------------------
+
+  The archive `ftp://ftp.tug.org/tex/texk.tar.gz' contains all of the
+Kpathsea applications I maintain, and the library itself.  For example,
+since NeXT does not generally support X11, you'd probably want to skip
+`xdvik' (or simply remove it after unpacking `texk.tar.gz'.  If you are
+not interested in all of them, you can also retrieve them separately:
+
+`dviljk.tar.gz'
+     DVI to PCL, for LaserJet printers.
+
+`dvipsk.tar.gz'
+     DVI to PostScript, for previewers, printers, or PDF generation.
+
+`web2c.tar.gz'
+     The software needed to compile TeX and friends.
+
+`web.tar.gz'
+     The original WEB source files, also used in compilation.
+
+`xdvik.tar.gz'
+     DVI previewing under the X window system.
+
+  If you want to use the Babel LaTeX package for support of non-English
+typesetting, you may need to retrieve additional files.  See the file
+`install.txt' in the Babel distribution.
+
+Changing search paths
+---------------------
+
+  If the search paths for your installation differ from the standard
+TeX directory structure (*note Introduction: (tds)Top.), edit the file
+`kpathsea/texmf.cnf.in' as desired, before running `configure'.  For
+example, if you have all your fonts or macros in one big directory.
+
+  You may also wish to edit the file `MakeTeXnames.cnf', either before
+or after installation, to control various aspects of `MakeTeXPK' and
+friends.  *Note MakeTeX configuration::.
+
+  You do not need to edit `texmf.cnf.in' to change the default
+top-level or other installation *directories* (only the paths).  You
+can and should do that when you run `configure' (next step).
+
+  You also do not need to edit `texmf.cnf.in' if you are willing to
+rely on `texmf.cnf' at runtime to define the paths, and let the
+compile-time default paths be incorrect.  Usually there is no harm in
+doing this.
+
+  The section below explains default generation in more detail.
+
+Default path features
+.....................
+
+  The purpose of having all the different files described in the section
+above is to avoid having the same information in more than one place. If
+you change the installation directories or top-level prefix at
+`configure'-time, those changes will propagate through the whole
+sequence.  And if you change the default paths in `texmf.cnf.in', those
+changes are propagated to the compile-time defaults.
+
+  The Make definitions are all repeated in several Makefile's; but
+changing the top-level `Makefile' should suffice, as it passes down all
+the variable definitions, thus overriding the submakes.  (The
+definitions are repeated so you can run Make in the subdirectories, if
+you should have occasion to.)
+
+  By default, the bitmap font paths end with `/$MAKETEX_MODE', thus
+including the device name (usually a Metafont mode name such as
+`ljfour').  This distinguishes two different devices with the same
+resolution--a write/white from a write/black 300dpi printer, for
+example.
+
+  However, since most sites don't have this complication, Kpathsea
+(specifically, the `kpse_init_prog' function in `kpathsea/proginit.c')
+has a special case: if the mode has not been explicitly set by the user
+(or in a configuration file), it sets `MAKETEX_MODE' to `/'.  This
+makes the default PK path, for example, expand into `.../pk//', so
+fonts will be found even if there is no subdirectory for the mode (if
+you arranged things that way because your site has only one printer,
+for example) or if the program is mode-independent (e.g., `pktype').
+
+  To make the paths independent of the mode, simply edit `texmf.cnf.in'
+before installation, or the installed `texmf.cnf', and remove the
+`$MAKETEX_MODE'.
+
+  *Note MakeTeX script arguments::, for how this interacts with
+`MakeTeXPK'.
+
+  *Note TeX directory structure: TeX directory structure, for a
+description of the default arrangement of the input files that comprise
+the TeX system.  The file `kpathsea/HIER' is a copy of that section.
+
+Default path generation
+.......................
+
+  This section describes how the default paths are constructed.
+
+  You may wish to ignore the whole mess and simply edit `texmf.cnf'
+after it is installed, perhaps even copying it into place beforehand so
+you can complete the installation, if it seems necessary.
+
+  To summarize the chain of events that go into defining the default
+paths:
+
+  1. `configure' creates a `Makefile' from each `Makefile.in'.
+
+  2. When Make runs in the `kpathsea' directory, it creates a file
+     `texmf.sed' that substitutes the Make value of `$(var)' for a
+     string `@var@'.  The variables in question are the one that define
+     the installation directories.
+
+  3. `texmf.sed' (together with a little extra magic--see
+     `kpathsea/Makefile') is applied to `texmf.cnf.in' to generate
+     `texmf.cnf'.  This is the file that will eventually be installed
+     and used.
+
+  4. The definitions in `texmf.cnf' are recast as C `#define''s in
+     `paths.h'.  These values will be the compile-time defaults; they
+     are not used at runtime unless no `texmf.cnf' file can be found.
+
+     (That's a lie: the compile-time defaults are what any extra :'s in
+     `texmf.cnf' expand into; but the paths as distributed have no extra
+     :'s, and there's no particular reason for them to.)
+
+Running `configure'
+-------------------
+
+  Run `sh configure OPTIONS' (in the top-level directory, the one
+containing `kpathsea/'), possibly using a shell other than `sh' (*note
+configure shells::.).
+
+  `configure' adapts the source distribution to the present system via
+`#define''s in `*/c-auto.h', which are created from the corresponding
+`c-auto.h.in'.  It also creates a `Makefile' from the corresponding
+`Makefile.in', doing `@VAR@' and `ac_include' substitutions).
+
+  `configure' is the best place to control the configuration,
+compilation, and installed location of the software, either via
+command-line options, or by setting environment variables before
+invoking it.  For example, you can disable `MakeTeXPK' by default with
+the option `--disable-maketexpk'.  *Note configure options::.
+
+`configure' shells
+..................
+
+  If you have Bash, the GNU shell, use it if `sh' runs into trouble
+(*note Top: (features)Top.).
+
+  Most Bourne shell variants other than Bash cannot handle `configure'
+scripts as generated by GNU Autoconf (*note Introduction:
+(autoconf)Top.).  Specifically:
+`ksh'
+     The Korn shell may be installed as `/bin/sh' on AIX.  `/bin/bsh'
+     may serve instead.
+
+`ash'
+     Ash is sometimes installed as `/bin/sh' on NetBSD, FreeBSD, and
+     Linux systems.  `/bin/bash' should be available.
+
+`Ultrix /bin/sh'
+     `/bin/sh' under Ultrix is a DEC-grown shell that is notably
+     deficient in many ways.  `/bin/sh5' may be necessary.
+
+`configure' options
+...................
+
+  For a complete list of all `configure' options, run `configure
+--help' or *note Running `configure' scripts: (autoconf)Invoking
+configure. (a copy is in the file `kpathsea/CONFIGURE').  The generic
+options are listed first in the `--help' output, and the
+package-specific options come last.  The environment variables
+`configure' pays attention to are listed below.
+
+  Options particularly likely to be useful are `--prefix', `--datadir',
+and the like; *note configure scenarios::..
+
+  This section gives pointers to descriptions of the `--with' and
+`--enable' options to `configure' that Kpathsea-using programs accept.
+
+`--without-maketexmf-default'
+`--without-maketexpk-default'
+`--without-maketextfm-default'
+`--with-maketextex-default'
+     Enable or disable the dynamic generation programs.  *Note MakeTeX
+     configuration::.
+
+`--enable-shared'
+     Build Kpathsea as a shared library, and link against it.  Also
+     build the usual static library.  *Note Shared library::.
+
+`--disable-static'
+     Build only the shared library.
+
+`configure' environment
+.......................
+
+  `configure' uses the value of the following environment variables in
+determining your system's characteristics, and substitutes for them in
+Makefile's:
+
+`CC'
+     The compiler to use: default is `gcc' if it's installed, otherwise
+     `cc'.
+
+`CFLAGS'
+     Options to give the compiler: default is `-g -O2' for `gcc', `-g'
+     otherwise.  `CFLAGS' comes after any other options.  You may need
+     to include `-w' here if your compilations commonly have useless
+     warnings (e.g., `NULL redefined'), or `configure' may fail to
+     detect the presence of header files (it takes the messages on
+     standard error to mean the header file doesn't exist).
+
+`CPPFLAGS'
+     Options to pass to the compiler preprocessor; this matters most for
+     configuration, not the actual source compilation.  The `configure'
+     script often does only preprocessing (e.g., to check for the
+     existence of #include files), and `CFLAGS' is not used for this.
+     You may need to set this to something like
+     `-I/usr/local/include/wwwhatever' if you have the libwww library
+     installed for hyper-xdvik (see `xdvik/INSTALL').
+
+`DEFS'
+     Additional preprocessor options, but not used by `configure'.
+     Provided for enabling or disabling program features, as documented
+     in the various program-specific installation instructions.  `DEFS'
+     comes before any compiler options included by the distribution
+     `Makefile's or by `configure'.
+
+`LDFLAGS'
+     Additional options to give to the loader.  `LDFLAGS' comes before
+     any other linker options.
+
+`LIBS'
+     Additional libraries to link with.
+
+`configure' scenarios
+.....................
+
+  Here are some common installation scenarios:
+
+   * Including X support in Metafont.  This is disabled by default,
+     since many sites have no use for it, and it's a leading cause of
+     configuration problems.
+          configure --with-x-toolkit
+
+   * Putting the binaries, TeX files, GNU info files, etc. into a single
+     TeX hierarchy, say TEXMF, requires overriding defaults in both
+     `configure' and `make':
+          configure --prefix=TEXMF --datadir=TEXMF
+          make texmf=TEXMF
+
+   * You can compile on multiple architectures simultaneously either by
+     building symbolic link trees with the `lndir' script from the X11
+     distribution, or with the `--srcdir' option:
+          configure --srcdir=SRCDIR
+
+   * If you are installing binaries for multiple architectures into a
+     single hierarchy, you will probably want to override the default
+     `bin' and `lib' directories, something like this:
+          configure --prefix=TEXMF --datadir=TEXMF \
+            --bindir=TEXMF/ARCH/bin --libdir=TEXMF/ARCH/lib
+          make texmf=TEXMF
+      (Unless you make provisions for architecture-specific files in
+     other ways, e.g., with Depot or an automounter.)
+
+   * To compile with optimization (to compile without debugging, remove
+     the `-g'):
+          env CFLAGS="-g -O" sh configure ...
+      For a potential problem if you optimize, see *Note TeX or
+     Metafont failing: TeX or Metafont failing.
+
+Shared library
+..............
+
+  You can compile Kpathsea as a shared library on a few systems, by
+specifying the option `--enable-shared' when you run `configure'.
+
+  The main advantage in doing this is that the executables can then
+share the code, thus decreasing memory and disk space requirements.
+
+  On some systems, you can record the location of shared libraries in a
+binary, usually by giving certain options to the linker.  Then
+individual users do not need to set their system's environment variable
+(e.g., `LD_LIBRARY_PATH') to find shared libraries.  If you want to do
+this, you will need to add the necessary options to `LDFLAGS' yourself;
+for example, on Solaris, include something like `-R${prefix}/lib'.
+(Unfortunately, making this happen by default is very difficult,
+because of interactions with an existing installed shared library.)
+
+  Currently, shared library support is implemented only on SunOS 4
+(Solaris 1) and SunOS 5 (Solaris 2).  If you're interested and willing
+in adding support for other systems, please see the `configure' mode in
+the `klibtool' script, especially the host-specific case statement
+around line 250.
+
+Running `make'
+--------------
+
+  `make' (still in the top-level directory).  This also creates the
+`texmf.cnf' and `paths.h' files that define the default search paths,
+and (by default) the `plain' and `latex' TeX formats.
+
+  You can override directory names and other values at `make'-time.
+`make/paths.make' lists the variables most commonly reset.  For
+example, `make default_texsizes=600' changes the list of fallback
+resolutions.
+
+  You can also override each of `configure''s environment variables
+(*note configure environment::.).  The Make variables have the same
+names.
+
+  Finally, you can supply additional options via the following
+variables.  (`configure' does not use these.)
+
+`XCPPFLAGS'
+`XDEFS'
+     Preprocessor options.
+
+`XCFLAGS'
+     Compiler options.
+
+`XLDFLAGS'
+     Loader options (included at beginning of link commands).
+
+`XLOADLIBES'
+     More loader options (included at end of link commands).
+
+`XMAKEARGS'
+     Additional Make arguments passed to all sub-`make''s. You may need
+     to include assignments to the other variables here via `XMAKEARGS';
+     for example: `make XMAKEARGS="CFLAGS=-O XDEFS=-DA4"'.
+
+  It's generally a bad idea to use a different compiler (`CC') or
+libraries (`LIBS') for compilation than you did for configuration,
+since the values `configure' determined may then be incorrect.
+
+  Adding compiler options to change the "universe" you are using
+(typically BSD vs. system V) is generally a cause of trouble.  It's
+best to use the native environment, whatever that is; `configure' and
+the software usually adapt best to that.  In particular, under Solaris
+2.x, you should not use the BSD-compatibility library (`libucb') or
+include files (`ucbinclude').
+
+  If you want to use the Babel LaTeX package for support of non-English
+typesetting, you need to modify some files before making the LaTeX
+format.  See the file `install.txt' in the Babel distribution.
+
+Installing files
+----------------
+
+  The basic command is the usual `make install'.  For security issues,
+*note Security::..
+
+  The first time you install any manual in the GNU Info system, you
+should add a line (you choose where) to the file `dir' in your
+`$(infodir)' directory.  Sample text for this is given near the top of
+the Texinfo source files (`kpathsea/kpathsea.texi',
+`dvipsk/dvips.texi', and `web2c/doc/web2c.texi').  If you have a recent
+version of the GNU Texinfo distribution installed
+(`ftp://prep.ai.mit.edu/pub/gnu/texinfo-3.9.tar.gz' or later), this
+should happen automatically.
+
+  On the offchance that this is your first Info installation, the `dir'
+file I use is included in the distribution as `etc/dir-example'.
+
+  You may wish to use one of the following targets, especially if you
+are installing on multiple architectures:
+   * `make install-exec' to install in architecture-dependent
+     directories, i.e., ones that depend on the `$(exec_prefix)' Make
+     variable.  This includes links to binaries, libraries, etc., not
+     just "executables".
+
+   * `make install-data' to install in architecture-independent
+     directories, such as documentation, configuration files, pool
+     files, etc.
+
+  If you use the Andrew File System, the normal path (e.g., PREFIX/bin)
+only gets you to a read-only copy of the files, and you must specify a
+different path for installation.  The best way to do this is by setting
+the `prefix' variable on the `make' command line.  The sequence becomes
+something like this:
+     configure --prefix=/whatever
+     make
+     make install prefix=/afs/.SYSTEM.NAME/system/1.3/@sys/whatever
+   With AFS, you will definitely want to use relative filenames in
+`ls-R' (*note Filename database::.), not absolute filenames.  This is
+done by default, but check anyway.
+
+Cleaning up
+-----------
+
+The basic command is `make distclean'.  This removes all files created
+by the build.
+
+  Alternatively,
+   * `make mostlyclean' if you intend to compile on another
+     architecture.  For Web2c, since the generated C files are portable,
+     they are not removed.  If the `lex' vs. `flex' situation is going
+     to be different on the next machine, `rm web2c/lex.yy.c'.
+
+   * `make clean' to remove files created by compiling, but leave
+     configuration files and Makefiles.
+
+   * `make maintainer-clean' to remove everything that the Makefiles can
+     rebuild.  This is more than `distclean' removes, and you should
+     only use it if you are thoroughly conversant with (and have the
+     necessary versions of) Autoconf.
+
+   * `make extraclean' to remove other junk, e.g., core files, log
+     files, patch rejects.  This is independent of the other `clean'
+     targets.
+
+Filename database generation
+----------------------------
+
+  You will probably want to set up a `cron' entry on the appropriate
+machine(s) to rebuild the filename database nightly or so, as in:
+     0 0 * * * cd TEXMF && /BINDIR/MakeTeXls-R
+   *Note Filename database::.
+
+Although the `MakeTeX...' scripts make every effort to add
+newly-created files on the fly, it can't hurt to make sure you get a
+fresh version every so often.
+
+`MakeTeX' scripts
+-----------------
+
+  If Kpathsea cannot otherwise find a file, for some file types it is
+configured by default to invoke an external program to create it
+dynamically (*note MakeTeX configuration::.).  This is most useful for
+fonts (bitmaps, TFM's, and arbitrarily-sizable Metafont sources such as
+the Sauter and DC fonts), since any given document can use fonts never
+before referenced.  Trying to build all fonts in advance is therefore
+impractical, if not impossible.
+
+  The script is passed the name of the file to create and possibly other
+arguments, as explained below.  It must echo the full pathname of the
+file it created (and nothing else) to standard output; it can write
+diagnostics to standard error.
+
+`MakeTeX' configuration
+.......................
+
+  The following file types can run an external program to create missing
+files: `pk', `tfm', `mf', `tex'; the scripts are named `MakeTeXPK',
+`MakeTeXTFM', `MakeTeXMF', and `MakeTeXTeX'.
+
+  In the absence of `configure' options specifying otherwise,
+everything but `MakeTeXTeX' will be enabled by default. The `configure'
+options to change the defaults are:
+
+     --without-maketexmf-default
+     --without-maketexpk-default
+     --without-maketextfm-default
+     --with-maketextex-default
+
+  The `configure' setting is overridden if the environment variable or
+configuration file value named for the script is set; e.g., `MAKETEXPK'
+(*note MakeTeX script arguments::.).
+
+  As distributed, all the scripts source a file
+`texmf/web2c/MakeTeX.site' if it exists, so you can override various
+defaults.  See `MakeTeXcommon', for instance, which defines the default
+mode, resolution, directory permissions, some special directory names,
+etc.  If you prefer not to change the distributed scripts, you can
+simply create `MakeTeX.site' with the appropriate definitions (you do
+not need to create it if you have nothing to put in it).
+`MakeTeX.site' has no special syntax; it's an arbitrary Bourne shell
+script.  The distribution contains a sample `MakeTeX.site' for you to
+copy and modify as you please (it is not installed anywhere).
+
+  In addition, you can configure a number of features with the
+`MT_FEATURES' variable, which you can define:
+   * in `MakeTeX.site', as just mentioned;
+
+   * by editing the file `MakeTeXnames.cnf', either before `make
+     install' (in the source hierarchy) or after (in the installed
+     hierarchy);
+
+   * or in the environment.
+
+  By default, `MakeTeXPK' installs fonts into the standard TeX
+directory structure (*note TeX directory structure: TeX directory
+structure.).  It uses aliases and directory names from the Fontname
+distribution (*note Introduction: (fontname)Top.). Most of the options
+here change that.
+
+`appendonlydir'
+     Tell `MakeTeXmkdir' to create directories append-only, i.e., set
+     their sticky bit (*note Mode Structure: (fileutils)Mode
+     Structure.).
+
+`dosnames'
+     Use 8.3 names; e.g., `dpi600/cmr10.pk' instead of `cmr10.600pk'.
+
+`nomode'
+     Omit the directory level for the mode name; this is fine as long as
+     you generate fonts for only one mode.
+
+`strip'
+     Omit the font supplier and typeface name directory levels.
+
+`varfonts'
+     Put `MakeTeXPK'-generated fonts under the directory named by
+     `VARTEXFONTS'; the default value in `kpathsea/texmf.cnf.in' is
+     `/var/tex/fonts', as recommended by the `Linux File System
+     Standard' (but unless `varfonts' is enabled, nothing cares about
+     that value).
+
+     The `varfonts' setting in `MT_FEATURES' is overridden by the
+     `USE_VARTEXFONTS' environment variable: if set to `1', the feature
+     is enabled, and if set to `0', the feature is disabled.
+
+`MakeTeX' script names
+......................
+
+  The following table shows the default name of the script for each
+possible file types.  (The source is the variable `kpse_make_specs' in
+`kpathsea/tex-make.c'.)
+
+`MakeTeXPK'
+     Glyph fonts.
+
+`MakeTeXTeX'
+     TeX input files.
+
+`MakeTeXMF'
+     Metafont input files.
+
+`MakeTeXTFM'
+     TFM files.
+
+These names are overridden by an environment variable specific to the
+program--for example, `DVIPSMAKEPK' for Dvipsk.
+
+  If a `MakeTeX...' script fails, the invocation is appended to a file
+`missfont.log' (by default) in the current directory.  You can then
+execute the log file to create the missing files after fixing the
+problem.
+
+  If the current directory is not writable and the environment variable
+or configuration file value `TEXMFOUTPUT' is set, its value is used.
+Otherwise, nothing is written.  The name `missfont.log' is overridden
+by the `MISSFONT_LOG' environment variable or configuration file value.
+
+`MakeTeX' script arguments
+..........................
+
+  The first argument to a `MakeTeX' script is always the name of the
+file to be created.
+
+  In the default `MakeTeXPK' implementation, from three to five
+additional arguments may also passed, via environment variables:
+
+  1. The resolution to make the font at (`KPATHSEA_DPI').
+
+  2. The "base dpi" the program is operating at (`MAKETEX_BASE_DPI'),
+     i.e., the assumed resolution of the output device.
+
+  3. A "magstep" string suitable for the Metafont `mag' variable
+     (`MAKETEX_MAG').
+
+  4. Optionally, a Metafont mode name to assign to the Metafont `mode'
+     variable (`MAKETEX_MODE').  Otherwise, (the default) `MakeTeXPK'
+     guesses the mode from the resolution.  *Note TeX directory
+     structure: TeX directory structure.
+
+  5. Optionally, a directory name. If the directory is absolute, it is
+     used as-is. Otherwise, it is appended to the root destination
+     directory set in the script (from environment variables `DESTDIR'
+     or `MTP_DESTDIR' or a compile-time default). If this argument is
+     not supplied, the mode name is appended to the root destination
+     directory.
+
+Kpathsea sets `KPATHSEA_DPI' appropriately for each attempt at building
+a font.  It's up to the program using Kpathsea to set the others.
+(*Note Calling sequence::.)
+
+  You can change the specification for the arguments passed to the
+external script by setting the environment variable named as the script
+name, but all capitals--`MAKETEXPK', for example.  If you've changed
+the script name by setting (say) `DVIPSMAKEPK' to `foo', then the spec
+is taken from the environment variable `FOO'.
+
+  The spec can contain any variable references, to the above variables
+or any others.  As an example, the default spec for `MakeTeXPK' is:
+     $KPATHSEA_DPI $MAKETEX_BASE_DPI $MAKETEX_MAG $MAKETEX_MODE
+
+The convention of passing the name of the file to be created as the
+first argument cannot be changed.
+
+Installation testing
+--------------------
+
+  Besides the tests listed in *Note Simple installation::, you can try
+running `make check'.  This includes the torture tests (trip, trap, and
+mptrap) that come with Web2c (*note Torture tests: (web2c)Torture
+tests.).
+
+Security
+========
+
+  None of the programs in the TeX system require any special system
+privileges, so there's no first-level security concern of people gaining
+illegitimate root access.
+
+  A TeX document, however, can write to arbitrary files, e.g.,
+`~/.rhosts', and thus an unwitting user who runs TeX on a random
+document is vulnerable to a trojan horse attack.  This loophole is
+closed by default, but you can be permissive if you so desire in
+`texmf.cnf'.  *Note tex invocation: (web2c)tex invocation.  MetaPost has
+the same issue.
+
+  Dvips, Xdvi, and TeX can also execute shell commands under some
+circumstances.  To disable this, see the `-R' option in *Note Option
+details: (dvips)Option details, the xdvi man page, and *Note tex
+invocation: (web2c)tex invocation, respectively.
+
+  Another security issue arises because it's very useful--almost
+necessary--to make arbitrary fonts on user demand with `MakeTeXPK' and
+friends.  Where do these files get installed?  By default, the
+`MakeTeXPK' distributed with Kpathsea assumes a globally writable
+`texmf' tree; this is the simplest and most convenient approach, but it
+may not suit your situation.
+
+  The first restriction you can apply is to make newly-created
+directories under `texmf' be append-only with an option in
+`MakeTeXnames.cnf'.  *Note MakeTeX configuration::.
+
+  Another approach is to establish a group (or user) for TeX files,
+make the `texmf' tree writable only to that group (or user), and make
+`MakeTeXPK' et al. setgid to that group (or setuid to that user).  Then
+users must invoke the scripts to install things.  (If you're worried
+about the inevitable security holes in scripts, then you could write a
+C wrapper to exec the script.)
+
+  Finally, using a central writable `texmf' tree may be completely
+impossible, because it's on an NFS filesystem that you cannot export
+read/write, or AFS is in use, or simply because "it's policy".  Then
+you must resort to each user's machine having its own local directory of
+dynamically-created fonts; again, `MakeTeXnames.cnf' has an option to
+do this, and again, *note MakeTeX configuration::..
+
new file mode 100644
--- /dev/null
+++ b/kpathsea/MakeTeX.site
@@ -0,0 +1,34 @@
+#!/bin/sh
+# example MakeTeX.site.  This file is not installed.
+# $Id: MakeTeX.site,v 1.1 1997-05-23 03:02:10 jwe Exp $
+# 
+# The distributed MakeTeX* scripts source this file from /.../texmf/web2c,
+# if it exists. You can put anything you like here; it's an arbitrary
+# Bourne shell script.
+#
+# But the distributed scripts already support a number of features,
+# which you can enable here, if you prefer not to change the distribution.
+# 
+# For example, MakeTeXcommon sets the default umask, Metafont mode,
+# resolution, directory permissions, location of the DC, TS, and Sauter
+# fonts (which MakeTeXMF needs, since those fonts can be generated at
+# any point size).  You can override those defaults with commands here:
+# 
+#umask 002
+#MODE=ljfour
+#MT_DIR_PERMS=775 # must be three octal digits
+#MT_FILE_PERMS=664
+#ps_to_pk=gsftopk
+#ecfontdir="$TEXMFMAIN/fonts/source/jknappen/ec"
+#fcfontdir="$TEXMFMAIN/fonts/source/jknappen/fc"
+#tcfontdir="$TEXMFMAIN/fonts/source/jknappen/tc"
+#tsfontdir="$TEXMFMAIN/fonts/source/jknappen/ts"
+#sauterfontdir="$TEXMFMAIN/fonts/source/public/sauter"
+
+# Also, MakeTeXnames.cnf defines ways to control where generated files
+# are placed.  You can enable those by setting MT_FEATURES, e.g.:
+#MT_FEATURES="appendonlydir varfonts"
+
+
+# This script (MakeTeX.site) is also sourced *after* MakeTeXnames.cnf is
+# run, so you can override what it did if you like.
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXMF
@@ -0,0 +1,88 @@
+#!/bin/sh
+# original MakeTeXMF -- make a new MF file, because one wasn't found.
+# 
+# (If you change or delete the word `original' on the previous line,
+# installation won't write this script over yours.)
+# 
+# te@informatik.uni-hannover.de and kb@mail.tug.org. Public domain.
+
+version='$Id: MakeTeXMF,v 1.1 1997-05-23 03:02:10 jwe Exp $'
+usage="Usage: $0 FONT.
+  Makes the Metafont source file for FONT, if possible.
+  For example, \`ecr12' or \`cmr11'."
+
+: ${TEXMFMAIN=`kpsewhich -expand-var='$TEXMFMAIN'`}
+if test -z "$TEXMFMAIN"; then
+  echo "$0: No \$TEXMFMAIN; set the environment variable or in texmf.cnf." >&2
+  exit 1
+fi
+: ${TEXMFCNF_DIR=`kpsewhich -expand-var='$TEXMFCNF_DIR'`}
+test -n "$TEXMFCNF_DIR" || TEXMFCNF_DIR=$TEXMFMAIN/web2c
+. $TEXMFCNF_DIR/MakeTeXcommon
+
+# See comments in MakeTeXPK.
+(
+name="`basename $1 .mf`"
+rootname=`echo "$name" | sed 's/[0-9]*$//'`
+pointsize=`echo "$name" | sed "s/^$rootname//"`
+
+case "$name" in
+  dc*) fontdir=$dcfontdir;;
+  ec*) fontdir=$ecfontdir;;
+  fc*) fontdir=$fcfontdir;;
+  tc*) fontdir=$tcfontdir;;
+  ts*) fontdir=$tsfontdir;;
+    *) fontdir=$sauterfontdir; test -r $fontdir/b-$rootname.mf || exit 1;;
+esac
+cd $fontdir 2>/dev/null || exit 1
+
+case "$pointsize" in
+  "") echo "$0: No pointsize." >&2; exit 1;;
+  11) realsize=10.95444;;	# \magstephalf
+  14) realsize=14.4;;		# \magstep2
+  17) realsize=17.28;;		# \magstep3
+  20) realsize=20.74;;		# \magstep4
+  25) realsize=24.88;;		# \magstep5
+        # The new convention is to have three or four letters for the
+        # font name and four digits for the pointsize. The number is
+        # pointsize * 100. We effectively divide by 100 by ignoring the
+        # last two digits.
+????) realsize=`echo "$pointsize" | sed 's/\(..\)/\1./'`;;
+   *) realsize="$pointsize";;
+esac
+
+mfname="$name.mf"
+if test -r "$mfname"; then
+  echo "$0: $fontdir/$mfname already exists."
+  echo $fontdir/$mfname >$STDOUT
+  $TEXMFCNF_DIR/MakeTeXupdate "$fontdir" "$mfname"
+  exit 0
+fi
+
+base=
+case "$name" in
+  dc*) base=dxbase;;
+  ec*|tc*) base=exbase;;
+    *) cat >"$mfname.tmp$$" <<END-OF-SAUTER
+design_size := $realsize;
+input b-$rootname;
+END-OF-SAUTER
+       ;;
+esac
+
+test -n "$base" &&
+  echo "if unknown $base: input $base fi;" >"$mfname.tmp$$"
+
+cat >>"$mfname.tmp$$" <<END
+gensize := $realsize;
+generate $rootname;
+END
+
+chmod $MT_FILE_PERMS "$mfname.tmp$$"
+rm -f "$mfname"
+mv "$mfname.tmp$$" "$mfname"
+
+echo "$fontdir/$mfname" >$STDOUT
+$TEXMFCNF_DIR/MakeTeXupdate "$fontdir" "$mfname"
+exit 0
+) 1>&2 </dev/null
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXPK
@@ -0,0 +1,130 @@
+#!/bin/sh
+# original MakeTeXPK -- make a new PK font, because one wasn't found.
+# 
+# (If you change or delete the word `original' on the previous line,
+# installation won't write this script over yours.)
+# 
+# te@informatik.uni-hannover.de and kb@mail.tug.org. Public domain.
+
+version='$Id: MakeTeXPK,v 1.1 1997-05-23 03:02:10 jwe Exp $'
+usage="Usage: $0 NAME DPI BDPI MAG [MODE [DESTDIR]].
+  Try to create a PK file for NAME at resolution DPI,
+  with an assumed device base resolution of BDPI,
+  and a Metafont \`mag' of MAG.
+  Use MODE for the Metafont mode if supplied, unless MODE is \`default', in
+   which case guess as usual. (This is so you can specify DESTDIR without MODE.)
+  Use DESTDIR for the root of where to install into, either the absolute
+   directory name to use (if it starts with a /) or relative to the default
+   DESTDIR (if not)."
+mt_min_args=4
+mt_max_args=6
+
+: ${TEXMFMAIN=`kpsewhich -expand-var='$TEXMFMAIN'`}
+if test -z "$TEXMFMAIN"; then
+  echo "$0: No \$TEXMFMAIN; set the environment variable or in texmf.cnf." >&2
+  exit 1
+fi
+: ${TEXMFCNF_DIR=`kpsewhich -expand-var='$TEXMFCNF_DIR'`}
+test -n "$TEXMFCNF_DIR" || TEXMFCNF_DIR=$TEXMFMAIN/web2c
+. $TEXMFCNF_DIR/MakeTeXcommon
+
+# Since we want to pass the generated filename and only that filename
+# back to the caller on standard output, we do some redirections so
+# regular echo's will end up on stderr, and do an echo >$STDOUT at the end.
+# Then the contents of $STDOUT will be echoed to stdout by a trap.
+
+# start of redirection stdout -> stderr, stdin <- /dev/null
+(
+: ${PSMAPFILE=`kpsewhich psfonts.map`}
+
+NAME=$1
+DPI=$2
+BDPI=$3
+MAG=$4
+MODE=$5
+DEST=$6
+
+# grep for the font in $PSMAPFILE.  These are base font names, such as
+# rpplr (the original) or pplr0 (an interim step) or pplr8r (current).
+pattern="^r?$NAME"'(0|8r)?([ 	]|$)' 
+psline=`egrep "$pattern" $PSMAPFILE`
+if test -n "$psline"; then
+  MODE=modeless
+  # ps_to_pk set in MakeTeXcommon and/or MakeTeX.site.
+  cmd="$ps_to_pk $NAME $DPI" 
+else
+  # Check that $BDPI and $MODE are consistent; if not, ignore the mode and
+  # hope we can correctly guess it from bdpi.  (People like to specify the
+  # resolution on the command line, not the mode so much.)
+  if test -n "$MODE"; then
+    mf_bdpi=`mf \
+'\mode:='$MODE';mode_setup;message"BDPI= "&decimal round pixels_per_inch;end.'\
+             </dev/null \
+             | awk '/DPI=/ {print $2}'`
+    if test $mf_bdpi != $BDPI; then
+      echo "$0: Mismatched mode $MODE and resolution $BDPI; ignoring mode." >&2
+      MODE=
+    fi
+  fi
+
+  # If an explicit mode is not supplied, try to guess. You can get a
+  # list of extant modes from ftp://ftp.tug.org/tex/modes.mf.
+  if test -z "$MODE" || test "$MODE" = default; then
+    case "$BDPI" in
+     300) MODE=cx;;
+     600) MODE=ljfour;;
+       *) echo "$0: Can't guess mode for $BDPI dpi devices." >&2
+          echo "$0: Use a config file, or update me." >&2
+          exit 1
+    esac
+  fi
+
+  # Run Metafont. Always use plain Metafont, since reading cmbase.mf
+  # does not noticeably slow things down.
+  cmd="mf \mode:=$MODE; mag:=$MAG; scrollmode; input $NAME"
+fi
+
+set - `$TEXMFCNF_DIR/MakeTeXnames $NAME $DPI $MODE $DEST`
+PKDEST=$1
+PKDESTDIR=`echo $PKDEST | sed 's%/[^/][^/]*$%%'` # can't rely on dirname
+PKNAME=`basename $PKDEST`
+GFNAME=$NAME.${DPI}gf
+
+if test -r $PKDESTDIR/$PKNAME; then
+  echo "$0: $PKDESTDIR/$PKNAME already exists." >&2
+  echo $PKDESTDIR/$PKNAME >$STDOUT
+  $TEXMFCNF_DIR/MakeTeXupdate $PKDESTDIR $PKNAME
+  exit 0
+fi
+
+$TEXMFCNF_DIR/MakeTeXmkdir $PKDESTDIR
+if test ! -d $PKDESTDIR; then
+  echo "$0: MakeTeXmkdir $PKDESTDIR failed." >&2
+  exit 1
+fi
+
+echo "$0: Running $cmd"
+$cmd </dev/null || { echo "$0: \`$cmd' failed." >&2; exit 1; }
+
+test -r $GFNAME && { gftopk ./$GFNAME $PKNAME || exit 1; }
+test ! -f $PKNAME && test -f $NAME.${DPI}pk && mv $NAME.${DPI}pk $PKNAME
+if test ! -s $PKNAME; then
+  echo "$0: \`$cmd' failed to make $PKNAME." >&2
+  exit 1
+fi
+
+# Install the PK file carefully, since others may be working simultaneously.
+mv $PKNAME $PKDESTDIR/pktmp.$$ || exit 1
+cd $PKDESTDIR || exit 1
+test -r $PKNAME || mv pktmp.$$ $PKNAME || exit 1
+chmod $MT_FILE_PERMS $PKNAME
+
+# Update ls-R if necessary.
+$TEXMFCNF_DIR/MakeTeXupdate $PKDESTDIR $PKNAME
+
+# If this line (or an equivalent) is not present, dvipsk/xdvik/dviljk
+# will think MakeTeXPK failed.  Any other output to stdout will also lose.
+echo $PKDESTDIR/$PKNAME >$STDOUT
+
+) 1>&2 </dev/null
+# end of redirection stdout, stdin
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXTFM
@@ -0,0 +1,85 @@
+#!/bin/sh
+# original MakeTeXTFM -- make a new TFM file, because one wasn't found.
+# 
+# (If you change or delete the word `original' on the previous line,
+# installation won't write this script over yours.)
+# 
+# te@informatik.uni-hannover.de and kb@mail.tug.org. Public domain.
+
+version='$Id: MakeTeXTFM,v 1.1 1997-05-23 03:02:11 jwe Exp $'
+usage="Usage: $0 FONT.
+  Makes a TFM file for FONT, if possible."
+
+: ${TEXMFMAIN=`kpsewhich -expand-var='$TEXMFMAIN'`}
+if test -z "$TEXMFMAIN"; then
+  echo "$0: No \$TEXMFMAIN; set the environment variable or in texmf.cnf." >&2
+  exit 1
+fi
+: ${TEXMFCNF_DIR=`kpsewhich -expand-var='$TEXMFCNF_DIR'`}
+test -n "$TEXMFCNF_DIR" || TEXMFCNF_DIR=$TEXMFMAIN/web2c
+. $TEXMFCNF_DIR/MakeTeXcommon
+
+# See comments in MakeTeXPK.
+# start of redirection stdout -> stderr, stdin <- /dev/null
+(
+NAME=`basename $1 .tfm`
+MAG=1
+DEST=$2
+DPI=$BDPI
+
+set - `$TEXMFCNF_DIR/MakeTeXnames $NAME $DPI $MODE $DEST`
+PKDEST=$1
+TFMDEST=$2
+PKDESTDIR=`echo $PKDEST | sed 's%/[^/][^/]*$%%'` # can't rely on dirname
+TFMDESTDIR=`echo $TFMDEST | sed 's%/[^/][^/]*$%%'`
+PKNAME=`basename $PKDEST`
+TFMNAME=$NAME.tfm
+GFNAME=$NAME.$DPI'gf'
+
+if test -r $TFMDESTDIR/$TFMNAME; then
+  echo "$0: $TFMDESTDIR/$TFMNAME already exists." >&2
+  echo $TFMDESTDIR/$TFMNAME >$STDOUT
+  $TEXMFCNF_DIR/MakeTeXupdate $TFMDESTDIR $TFMNAME
+  exit
+fi
+
+# Try to create the destdir first. Do not create fonts, if this fails.
+$TEXMFCNF_DIR/MakeTeXmkdir "$TFMDESTDIR"
+if test ! -d "$TFMDESTDIR"; then
+  echo "$0: MakeTeXmkdir $TFMDESTDIR failed."
+  exit 1
+fi
+
+cmd="mf \mode:=$MODE; mag:=$MAG; scrollmode; input $NAME"
+echo "$0: Running $cmd"
+$cmd </dev/null
+test -r $TFMNAME || { echo "$0: \`$cmd' failed to make $TFMNAME."; exit 1; }
+
+# Install the TFM file carefully, since others may be working simultaneously.
+mv $TFMNAME $TFMDESTDIR/tfmtmp.$$ || exit 1
+cd $TFMDESTDIR || exit 1
+test -r $TFMNAME || mv tfmtmp.$$ $TFMNAME || exit 1
+chmod $MT_FILE_PERMS $TFMNAME
+
+# OK, success with the TFM.
+$TEXMFCNF_DIR/MakeTeXupdate $TFMDESTDIR $TFMNAME
+echo $TFMDESTDIR/$TFMNAME >$STDOUT
+
+# Since we probably made a GF(->PK) file, too, may as well install it if
+# it's needed.
+cd $TEMPDIR
+if test -r $GFNAME && test ! -f $PKDESTDIR/$PKNAME; then
+  gftopk ./$GFNAME $PKNAME || exit 1
+  $TEXMFCNF_DIR/MakeTeXmkdir "$PKDESTDIR"
+  mv $PKNAME $PKDESTDIR/pktmp.$$ || exit 1
+  cd $PKDESTDIR || exit 1
+  if test -f $PKNAME; then
+    rm -f pktmp.$$
+  else
+    mv pktmp.$$ $PKNAME
+    chmod $MT_FILE_PERMS $PKNAME
+    $TEXMFCNF_DIR/MakeTeXupdate $PKDESTDIR $PKNAME
+  fi
+fi
+) 1>&2 </dev/null
+# end of redirection stdout, stdin
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXcommon
@@ -0,0 +1,70 @@
+#!/bin/sh
+# MakeTeXcommon -- common MakeTeX* options, etc.
+# Meant to be sourced after $usage and $version and $TEXMF have been set.
+# 
+# te@informatik.uni-hannover.de and kb@mail.tug.org. Public domain.
+# $Id: MakeTeXcommon,v 1.1 1997-05-23 03:02:11 jwe Exp $
+ 
+if test x$1 = x--help -o x$1 = x-help; then
+  echo "$usage"
+  exit 0
+elif test x$1 = x--version -o x$1 = x-version; then
+  echo "`basename $0` $version"
+  kpsewhich --version
+  exit 0
+elif test $# -lt ${mt_min_args-1}; then
+  echo "$0: Missing argument(s)." >&2
+  echo "Try \``basename $0` --help' for more information." >&2
+  exit 1
+elif test $# -gt ${mt_max_args-1}; then
+  while test $# -gt ${mt_max_args-1}; do shift; done
+  echo "$0: Extra arguments $*." >&2
+  echo "Try \``basename $0` --help' for more information." >&2
+  exit 1
+fi
+
+# TEMPDIR needs to be unique to each process because of the possibility of two
+# people running dvips (or whatever) simultaneously.
+TEMPDIR=${TMPDIR-/tmp}/mt.$$
+
+# We want to output only filenames to standard output, but it's too
+# error-prone to write the scripts that way, so we direct stdout here.
+STDOUT=$TEMPDIR/stdout.$$
+
+# We will change search paths to include $KPSE_DOT. This is necessary
+# since we cd to $TEMPDIR.
+KPSE_DOT=`pwd`; export KPSE_DOT
+
+# Clean up on normal or abnormal exit.
+trap 'cd $KPSE_DOT; test -f $STDOUT && cat $STDOUT; rm -rf $TEMPDIR; exit 0' \
+  0 1 2 15
+
+
+mkdir $TEMPDIR
+cd $TEMPDIR || exit 1
+
+# Allow fonts to be read and written (especially in case we make
+# directories) by everyone.  
+umask 0
+
+: ${MODE=ljfour}
+: ${BDPI=600}
+: ${MT_DIR_PERMS=777} # keep to three digits or appendonlydir will fail
+: ${MT_FILE_PERMS=666}
+: ${ps_to_pk=gsftopk} # some prefer ps2pk
+
+# Fonts in these typefaces can be generated at arbitrary sizes, so
+# MakeTeXMF tries to take advantage of that.
+# These are the TDS-recommended directories.
+: ${dcfontdir="$TEXMFMAIN/fonts/source/jknappen/dc"}
+: ${ecfontdir="$TEXMFMAIN/fonts/source/jknappen/ec"}
+: ${fcfontdir="$TEXMFMAIN/fonts/source/jknappen/fc"}
+: ${tcfontdir="$TEXMFMAIN/fonts/source/jknappen/tc"}
+: ${tsfontdir="$TEXMFMAIN/fonts/source/jknappen/ts"}
+: ${sauterfontdir="$TEXMFMAIN/fonts/source/public/sauter"}
+
+# MakeTeXupdate and MakeTeXls-R make sure they're coordinated via this.
+ls_R_magic='% ls-R -- maintained by MakeTeXls-R; do not change this line.'
+
+# Source a site file, if it exists, to override any of the above.
+test -r $TEXMFCNF_DIR/MakeTeX.site && . $TEXMFCNF_DIR/MakeTeX.site
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXls-R
@@ -0,0 +1,67 @@
+#!/bin/sh
+# MakeTeXls-R -- create or rebuild ls-R.
+# Suitable for calling from cron, as in:
+# 0 * * * * cd /your/texmf/root && /usr/local/bin/MakeTeXls-R
+# 
+# Keeps ls-R world-writable, so anyone can update it (via MakeTeXPK etc.).
+# 
+# Originally written as `texhash' by Thomas Esser
+# <te@informatik.uni-hannover.de>, Okt., 1994.
+# Public domain.
+
+version='$Id: MakeTeXls-R,v 1.1 1997-05-23 03:02:11 jwe Exp $'
+usage="Usage: $0.
+  Rebuild the ls-R filename database completely."
+mt_min_args=0
+mt_max_args=0
+
+: ${TEXMFMAIN=`kpsewhich -expand-var='$TEXMFMAIN'`}
+if test -z "$TEXMFMAIN"; then
+  echo "$0: No \$TEXMFMAIN; set the environment variable or in texmf.cnf." >&2
+  exit 1
+fi
+: ${TEXMFLS_R=`kpsewhich -expand-var='$TEXMFLS_R'`}
+test -n "$TEXMFLS_R" || TEXMFLS_R=$TEXMFMAIN
+: ${TEXMFCNF_DIR=`kpsewhich -expand-var='$TEXMFCNF_DIR'`}
+test -n "$TEXMFCNF_DIR" || TEXMFCNF_DIR=$TEXMFMAIN/web2c
+. $TEXMFCNF_DIR/MakeTeXcommon
+
+trap 'cd / ; rm -f $db_file_tmp; exit' 1 2 15
+
+# Use ls -l to follow a possible symlink to get the right filesystem, 
+db_file=`\ls -l $TEXMFLS_R/ls-R 2>/dev/null | awk '{print $NF}'`
+test -z "$db_file" && db_file=$TEXMFLS_R/ls-R
+db_dir=`echo $db_file | sed 's%/[^/][^/]*$%%'` # can't rely on dirname
+db_file_tmp=$db_dir/ls-R-tmp$$
+
+test -w "$db_dir" || { echo "$0: Cannot write to $db_dir." >&2; exit 1; }
+
+if test ! -f $db_file; then
+    cp /dev/null $db_file
+    chmod 666 $db_file
+fi
+
+# Copy the file to preserve as much of the permissions as possible.
+rm -f $db_file_tmp
+cp -p $db_file $db_file_tmp 2>/dev/null
+
+# Make sure we can write the file:
+chmod +w $db_file_tmp
+
+tty -s && echo "$0: Updating $db_file... "
+# Some people set noclobber somewhere else, so make sure to unset it.
+unset noclobber
+echo "$ls_R_magic" >$db_file_tmp
+
+# The main task. We ls two things so the top-level directory name ends
+# up in the output, so top-level files can be found via ls-R. Probably
+# irrelevant in practice.
+# The sed command is because on new FreeBSD/NetBSD systems, ls -LAR ./
+# produces .//. Sigh.
+(cd $TEXMFLS_R && ls -LAR /dev/null ./ 2>/dev/null) \
+| sed 's@\.//@./@' \
+>>$db_file_tmp
+
+tty -s && echo "$0: Done."
+rm -f $db_file
+mv $db_file_tmp $db_file
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXmkdir
@@ -0,0 +1,45 @@
+#!/bin/sh
+# mkinstalldirs --- make directory hierarchy (now MakeTeXmkdir).
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>, created: 1993-05-16.
+# Public domain.
+# 
+# Modified for sticky directory creation, --help, --version.
+# te@informatik.uni-hannover.de and kb@mail.tug.org.
+
+version='$Id: MakeTeXmkdir,v 1.1 1997-05-23 03:02:11 jwe Exp $'
+usage="Usage: $0 DIRS...
+  Create each DIR, including any missing leading directories."
+
+: ${TEXMFMAIN=`kpsewhich -expand-var='$TEXMFMAIN'`}
+if test -z "$TEXMFMAIN"; then
+  echo "$0: No \$TEXMFMAIN; set the environment variable or in texmf.cnf." >&2
+  exit 1
+fi
+: ${TEXMFCNF_DIR=`kpsewhich -expand-var='$TEXMFCNF_DIR'`}
+test -n "$TEXMFCNF_DIR" || TEXMFCNF_DIR=$TEXMFMAIN/web2c
+. $TEXMFCNF_DIR/MakeTeXcommon
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d in ${1+"$@"} ; do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        mkdir "$pathcomp" || errstatus=$?
+        chmod $MT_DIR_PERMS $pathcomp
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXnames
@@ -0,0 +1,97 @@
+#!/bin/sh
+# MakeTeXnames -- find PK and TFM names.
+# Use alias files from the ftp://ftp.tug.org/tex/fontname.tar.gz distribution.
+# te@informatik.uni-hannover.de and kb@mail.tug.org. Public domain.
+
+version='$Id: MakeTeXnames,v 1.1 1997-05-23 03:02:11 jwe Exp $'
+usage="Usage: $0 NAME [DPI MODE] [DESTDIR].
+  Output the PK and TFM names for a font NAME."
+mt_max_args=4
+
+: ${TEXMFMAIN=`kpsewhich -expand-var='$TEXMFMAIN'`}
+if test -z "$TEXMFMAIN"; then
+  echo "$0: No \$TEXMFMAIN; set the environment variable or in texmf.cnf." >&2
+  exit 1
+fi
+: ${TEXMFCNF_DIR=`kpsewhich -expand-var='$TEXMFCNF_DIR'`}
+test -n "$TEXMFCNF_DIR" || TEXMFCNF_DIR=$TEXMFMAIN/web2c
+. $TEXMFCNF_DIR/MakeTeXcommon
+
+NAME=$1
+case $# in
+1|2) DPI=$BDPI; DEST=$2;;
+3|4) DPI=$2;  MODE=$3;    DEST=$4;;
+*)   help;;
+esac
+
+FONTNAME=`kpsewhich -expand-var='$FONTNAME'`
+test -z "$FONTNAME" && FONTNAME=$TEXMFMAIN/fontname
+
+: ${MT_PKDESTDIR='$MT_DESTROOT/$MT_PKPART/$MT_MODE/$MT_NAMEPART'}
+: ${MT_TFMDESTDIR='$MT_DESTROOT/$MT_TFMPART/$MT_NAMEPART'}
+: ${MT_DESTROOT='$TEXMFMAIN/fonts'}
+: ${MT_DEFAULT_NAMEPART=tmp}
+: ${MT_PKPART='pk'}
+: ${MT_TFMPART='tfm'}
+: ${MT_TFMNAME='$NAME.tfm'}
+: ${MT_PKNAME='$NAME.${DPI}pk'}
+
+# MT_NAMEPART is harder.
+if test -z "$MT_NAMEPART"; then
+  # Nothing specified, so try to intuit the directory from the
+  # fontname. First the special cases: either $NAME matches an entire
+  # name in special.map, or it matches the abbreviation in
+  # special.map and ends with a numeral (for the pointsize).
+  # We (painfully) use only the minimal features in original awk.
+  if test -r $FONTNAME/special.map; then
+    MT_NAMEPART=`awk \
+'{if ($1 == NAME || (substr (NAME, 1, length ($1)) == $1 \
+                  && substr (NAME, length (NAME), 1) ~ /[0-9]/ \
+                  && substr ($1, length ($1), 1) ~ /[^0-9]/)) \
+ { print $2 "/" $3; exit; }}' NAME=$NAME $FONTNAME/special.map`
+
+    if test -z "$MT_NAMEPART"; then
+      # Try the normal case. Source first.
+      s_abbrev=`echo $NAME | sed 's/^\(.\).*$/\1/'`
+      sourcedir=`awk '{ if ($1 == s_abbrev) { print $2; exit; }}' \
+                 s_abbrev=$s_abbrev $FONTNAME/supplier.map`
+
+      if test -n "$sourcedir"; then
+        # We found the source. Try for the typeface.
+        t_abbrev=`echo $NAME | cut -c 2-3`
+        typefacedir=`awk '{ if ($1 == t_abbrev) { print $2; exit; }}' \
+                     t_abbrev=$t_abbrev $FONTNAME/typeface.map`
+
+        if test -n "$typefacedir"; then
+          # Found everything.
+          MT_NAMEPART=$sourcedir/$typefacedir
+
+        else
+          echo "$0: Could not map typeface abbreviation $t_abbrev." >&2
+        fi
+      else
+        echo "$0: Could not map source abbreviation $s_abbrev." >&2
+      fi
+    fi
+  fi
+  if test -z "$MT_NAMEPART"; then
+    # If we failed for whatever reason, default to a generic subdir.
+    MT_NAMEPART=$MT_DEFAULT_NAMEPART
+  fi
+fi
+
+case "$DEST" in
+  "") ;;
+  /*) MT_PKDESTDIR=$DEST;; # Absolute, explicit destdir => use it.
+   *) MT_NAMEPART=$DEST;; # Relative destdir => append to the default.
+esac
+
+. $TEXMFCNF_DIR/MakeTeXnames.cnf
+
+eval MT_MODE=$MODE
+eval MT_PKPART=$MT_PKPART
+eval MT_DESTROOT=$MT_DESTROOT
+eval PKNAME=$MT_PKDESTDIR/$MT_PKNAME
+eval TFMNAME=$MT_TFMDESTDIR/$MT_TFMNAME
+
+echo $PKNAME $TFMNAME | sed 's@//*@/@g'
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXnames.cnf
@@ -0,0 +1,55 @@
+#!/bin/sh
+# MakeTeXnames.cnf to determine various manipulations of the filenames.
+# Sourced from MakeTeXnames.
+# 
+# te@informatik.uni-hannover.de and kb@mail.tug.org. Public domain.
+# $Id: MakeTeXnames.cnf,v 1.1 1997-05-23 03:02:11 jwe Exp $
+
+
+# Possible features: appendonlydir dosnames nomode strip varfonts.
+: ${MT_FEATURES=}
+
+# Set append-only bit on created directories.
+case "$MT_FEATURES" in
+  *appendonlydir*) MT_DIR_PERMS=1$MT_DIR_PERMS;;
+esac
+
+# Get 8.3 filenames like dpiNNN/NAME.pk.
+case "$MT_FEATURES" in
+  *dosnames*) MT_PKNAME='dpi$DPI/$NAME.pk';;
+esac
+
+# Omit the mode directory (e.g., ljfour):
+case "$MT_FEATURES" in
+  *nomode*) MODE="";;
+esac
+
+# Omit the supplier/typeface part (e.g., ams/euler).
+case "$MT_FEATURES" in
+  *strip*) MT_NAMEPART="";;
+esac
+
+# Put new fonts into the directory named by the VARTEXFONTS environment
+# variable or config file value.  (A default value for VARTEXFONTS is
+# already set in the default texmf.cnf, q.v.)
+# 
+# A user can override this setting in either direction by setting
+# USE_VARTEXFONTS to 1 or 0.
+case "$MT_FEATURES" in
+  *varfonts*) test "$USE_VARTEXFONTS" != 0 && USE_VARTEXFONTS=1;;
+esac
+
+if test "$USE_VARTEXFONTS" = 1; then
+  if test -n "${VARTEXFONTS=`kpsewhich -expand-var='$VARTEXFONTS'`}"; then
+    MT_DESTROOT=$VARTEXFONTS
+    MT_NAMEPART=""
+  else
+    echo "$0: You asked for varfonts in MT_FEATURES, but VARTEXFONTS" >&2
+    echo "$0: is not set as an environment variable or in texmf.cnf, etc." >&2
+  fi
+fi
+  
+
+# In case you want to override anything that got set above.
+# (MakeTeX.site also gets sourced before this is called, from MakeTeXcommon.)
+test -r $TEXMFCNF_DIR/MakeTeX.site && . $TEXMFCNF_DIR/MakeTeX.site
new file mode 100755
--- /dev/null
+++ b/kpathsea/MakeTeXupdate
@@ -0,0 +1,46 @@
+#!/bin/sh
+# MakeTeXupdate -- update ls-R with a new entry.
+# 
+# te@informatik.uni-hannover.de and kb@mail.tug.org. Public domain.
+
+version='$Id: MakeTeXupdate,v 1.1 1997-05-23 03:02:11 jwe Exp $'
+usage="Usage: $0 DIR FILE.
+  Update the ls-R file with an entry for FILE in DIR."
+mt_min_args=2
+mt_max_args=2
+
+: ${TEXMFMAIN=`kpsewhich -expand-var='$TEXMFMAIN'`}
+if test -z "$TEXMFMAIN"; then
+  echo "$0: No \$TEXMFMAIN; set the environment variable or in texmf.cnf." >&2
+  exit 1
+fi
+: ${TEXMFLS_R=`kpsewhich -expand-var='$TEXMFLS_R'`}
+test -n "$TEXMFLS_R" || TEXMFLS_R=$TEXMFMAIN
+: ${TEXMFCNF_DIR=`kpsewhich -expand-var='$TEXMFCNF_DIR'`}
+test -n "$TEXMFCNF_DIR" || TEXMFCNF_DIR=$TEXMFMAIN/web2c
+. $TEXMFCNF_DIR/MakeTeXcommon
+
+test $# -eq 2 || { echo "$usage" >&2; exit 1; }
+dir=$1
+file=$2
+test -d "$dir" || { echo "$0: $dir not a directory." >&2; exit 1; }
+test -f "$dir/$file" || { echo "$0: $dir/$file not a file." >&2; exit 1; }
+
+db_file=$TEXMFLS_R/ls-R
+
+test -f $db_file || MakeTeXls-R
+test -f $db_file || { echo "$0: $db_file does not exist." >&2; exit 1; }
+test -w "$db_file" || { echo "$0: $db_file unwritable." >&2; exit 1; }
+
+test "`sed 1q $db_file`" = "$ls_R_magic" \
+  || { echo "$0: $db_file lacks magic string \`$ls_R_magic'." >&2; exit 1; }
+
+# Change `$TEXMFLS_R/' to `./'.
+dir=`echo $dir | sed "s@^$TEXMFLS_R/@./@g"`
+
+# May as well always put in a new directory entry; presumably cron will
+# come along soon enough and clean things up.
+echo "$dir:" >>$db_file
+echo "$file" >>$db_file
+
+exit 0
new file mode 100644
--- /dev/null
+++ b/kpathsea/Makefile
@@ -0,0 +1,698 @@
+# Generated automatically from Makefile.in by configure.
+# Makefile for kpathsea --kb@mail.tug.org.  Public domain.
+version = 3.0
+
+# Add -DNO_DEBUG to disable debugging, for vanishingly better performance.
+
+
+##ifdef HOSTNAME
+##warn_more = -Wmissing-prototypes -Wwrite-strings -Wshadow
+##MAKEINFO_FLAGS := $(MAKEINFO_FLAGS) --no-split
+##malloc = /usr/local/src/malloc/onefile.o # gmalloc.o
+##endif
+
+# Install these header files (except c-auto.h).
+install_headers = *.h
+
+# Put tex-file.o first, because it's what depends on the paths, and may
+# reduce frustration if the paths are wrong by doing it first.
+
+objects = tex-file.lo absolute.lo atou.lo cnf.lo concat.lo concat3.lo \
+concatn.lo db.lo debug.lo dir.lo elt-dirs.lo expand.lo extend-fname.lo \
+file-p.lo find-suffix.lo fn.lo fontmap.lo getopt.lo getopt1.lo hash.lo \
+kdefault.lo line.lo magstep.lo make-suffix.lo path-elt.lo \
+pathsearch.lo proginit.lo progname.lo readable.lo rm-suffix.lo \
+str-list.lo str-llist.lo tex-glyph.lo tex-hush.lo tex-make.lo \
+tilde.lo truncate.lo uppercasify.lo variable.lo version.lo xcalloc.lo \
+xfopen.lo xfseek.lo xftell.lo xgetcwd.lo xmalloc.lo xopendir.lo xputenv.lo \
+xrealloc.lo xstat.lo xstrdup.lo $(liblobjs) $(malloc)
+liblobjs = 
+
+library = kpathsea
+
+# We want to compile almost everything with libtool ...
+KPATHSEA_CC = $(LIBTOOL) compile $(CC)
+.c.lo:
+	$(KPATHSEA_CC) $< $(ALL_CFLAGS)
+.SUFFIXES: .lo
+
+default all: kpsewhich $(library).info
+
+kpsewhich: $(kpathsea) kpsewhich.o
+	$(kpathsea_link) kpsewhich.o $(LOADLIBES)
+
+$(kpathsea): $(objects)
+	$(LIBTOOL) archive $(AR) $(ARFLAGS) $@ $(objects)
+
+# All the objects depend on the klibtool configuration file.
+$(objects): ../klibtool.config
+
+# Make variable substitutions from paths.h.
+texmf.cnf: texmf.cnf.in texmf.sed
+	sed -f texmf.sed $(srcdir)/texmf.cnf.in >$@
+
+# The idea is to turn each var=value into s%@var@%value%g. Seems simpler
+# to put the substitutions in a file than to play shell quoting games.
+texmf.sed: $(top_srcdir)/../make/makevars.make $(top_srcdir)/../make/paths.make
+	echo $(makevars) \
+	| tr ' ' '\012' \
+	| sed -e 's/^/s%@/' -e 's/=/@%/' -e 's/$$/%/' -e 's/$$/g/' \
+	>$@-t
+# Don't replace the rhs of the TEXMF assignment itself, then we'd
+# end up with TEXMF = $TEXMF.  We replace all the other hardwired paths
+# with $TEXMF, though, for ease of modification.
+	echo 's%$(texmf)%\$$TEXMF%g' >>$@-t
+	echo '/^ *TEXMF[ =]/s%\$$TEXMF%$(texmf)%' >>$@-t
+	mv $@-t $@
+
+# First null out comments and leading/trailing whitespace, then remove
+# lines that define invalid C identifiers, then remove blank lines and
+# lines that define lowercase values (those are never path values). Each
+# line remaining looks like
+# <name> = <value>
+# (but = and surrounding spaces are optional, hence can't remove all spaces).
+# Change this to #ifndef DEFAULT_name@#define DEFAULT_name "value"@#endif,
+# then change the @'s to newlines (sed isn't good at multiline replacements).
+# 
+# No backslash-newline escapes in the long sed replacement because that
+# will turn into a space in the output.
+# 
+# Without the $TEXMF/dbtex/etc. substitutions, if the cnf file was
+# not found, the compile-time paths would be of little use, since TEXMF
+# (etc.) wouldn't be defined. Alternatively, we could have a way to
+# specify compile-time default values for variables in general, but I
+# think it's better to keep the last-resort paths as simple as possible.
+# 
+# The definition of DEFAULT_TEXMF (and other variables)
+# that winds up in the final paths.h will not be used.
+$(kpathsea_dir)/paths.h: texmf.cnf
+	echo "/* paths.h: Generated from texmf.cnf `date`.  */" >$@
+	sed -e 's/%.*//' -e 's/^[ 	]*//' -e 's/[ 	]*$$//' texmf.cnf \
+	| grep '^[ 	]*[A-Z1_]*[ 	=]' \
+	| sed '/^$$/d' \
+	| sed 's/^\([^ 	=]*\)[ 	]*=*[ 	]*\(.*\)/#ifndef DEFAULT_\1@#define DEFAULT_\1 "\2"@#endif/' \
+	| tr @ '\012' \
+	| sed -e 's@\$$TEXMF@$(texmf)@g' \
+	      -e 's@\$$dbtex@$(texinputdir)@g' \
+	      -e 's@\$$dbfonts@$(fontdir)@g' \
+	      -e 's@\$$VARTEXFONTS@/var/tex/fonts@g' \
+	      -e 's@\$$prefix@$(prefix)@g' \
+	>>$@
+
+# Need an extra definition for this. Dependencies included below.
+tex-file.o:
+	$(KPATHSEA_CC) -DDEFAULT_FONT_SIZES='\"$(default_texsizes)\"' $(srcdir)/tex-file.c
+
+check: kpsewhich
+	./kpsewhich -expand-var '$$TEXMF'
+
+install: install-exec install-data
+uninstall: uninstall-exec uninstall-data
+
+install-exec: kpsewhich
+	$(SHELL) $(top_srcdir)/../mkdirchain $(bindir) $(scriptdir) \
+	  $(libdir) $(web2cdir)
+	if grep 'original MakeTeXPK --' $(scriptdir)/MakeTeXPK >/dev/null 2>&1\
+	   || test ! -r $(scriptdir)/MakeTeXPK; then \
+	  $(INSTALL_SCRIPT) $(srcdir)/MakeTeXPK $(scriptdir)/MakeTeXPK; \
+	else true; fi
+	if grep 'original MakeTeXMF --' $(scriptdir)/MakeTeXMF >/dev/null 2>&1\
+	   || test ! -r $(scriptdir)/MakeTeXMF; then \
+	  $(INSTALL_SCRIPT) $(srcdir)/MakeTeXMF $(scriptdir)/MakeTeXMF; \
+	else true; fi
+	if grep 'original MakeTeXTFM --' $(scriptdir)/MakeTeXTFM >/dev/null 2>&1\
+	   || test ! -r $(scriptdir)/MakeTeXTFM; then \
+	  $(INSTALL_SCRIPT) $(srcdir)/MakeTeXTFM $(scriptdir)/MakeTeXTFM; \
+	else true; fi
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXls-R $(scriptdir)/MakeTeXls-R
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXcommon $(web2cdir)/MakeTeXcommon
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXmkdir $(web2cdir)/MakeTeXmkdir
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXnames $(web2cdir)/MakeTeXnames
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXnames.cnf $(web2cdir)/MakeTeXnames.cnf
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXupdate $(web2cdir)/MakeTeXupdate
+	$(INSTALL_LIBTOOL_LIBS) $(libdir) lib$(library).la
+	$(INSTALL_LIBTOOL_PROG) $(bindir) kpsewhich
+uninstall-exec:
+	rm -f $(bindir)/kpsewhich
+
+install-data: texmf.cnf kpathsea.info
+	$(SHELL) $(top_srcdir)/../mkdirchain $(texmf) $(infodir) $(web2cdir)
+	if grep 'original texmf.cnf --' $(web2cdir)/texmf.cnf >/dev/null 2>&1 \
+	   || test ! -r $(web2cdir)/texmf.cnf; then \
+	  $(INSTALL_DATA) texmf.cnf $(web2cdir)/texmf.cnf; \
+	else true; fi
+	$(INSTALL_DATA) $(srcdir)/kpathsea.info $(infodir)/kpathsea.info
+	$(SHELL) $(top_srcdir)/../mkdirchain $(includedir)/kpathsea
+	for f in $(install_headers); do \
+	  $(INSTALL_DATA) $$f $(includedir)/kpathsea/$$f; done
+	rm -f $(includedir)/kpathsea/c-auto.h
+	$(POSTINSTALL)
+	test -r $(infodir)/dir || $(INSTALL_DATA) $(top_srcdir)/../dir $(infodir)
+	if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+	  install-info --info-dir=$(infodir) $(infodir)/kpathsea.info; \
+	else true; fi
+
+uninstall-data:
+	rm -f $(infodir)/kpathsea.info*
+	for f in $(install_headers); do rm -f $(includedir)/$$f; done
+
+# distdir is used by other distributions; they define $(distdir).
+distdir: doc $(library).dvi $(library).h
+	rm -rf $(distdir)
+	mkdir -p $(distdir)
+	ln $(ln_files) klibtool.version $(distdir)
+	touch *.info*
+	ln MakeTeX* *.info* *.texi $(library).aux $(library).cps $(distdir)
+	ln BUGS CONFIGURE HIER PROJECTS *.ac $(distdir)
+	touch kpathsea.h # to avoid .cps.h rule on Solaris
+	cd $(distdir) && rm -f paths.h
+	cd $(distdir) && add-version $(version) version.c
+
+# I don't use this, but other programmers want it.  acconfig.h is an
+# autoheader input file, not an includable C header. Bad name.
+$(library).h: always
+	rm -f $@
+	ls -1 *.h | grep -v acconfig.h \
+	  | sed -e 's,^,#include <kpathsea/,' -e s',$$,>,' >$@	  
+	touch -r `ls -1t *.h | tail +2 | head -1` $@ 
+always:
+.PHONY: always
+
+
+info: $(library).info
+dvi: $(library).dvi
+
+$(library).info: bugs.texi hier.texi install.texi unixtex.texi
+
+##ifdef HOSTNAME
+##INSTALL: install.texi
+##	$(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
+##	add-info-toc $@
+##BUGS: bugs.texi
+##	$(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
+##	add-info-toc $@
+##HIER: hier.texi
+##	$(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
+##unixtex.ftp: unixtex.texi
+##	$(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
+##doc: info HIER BUGS INSTALL unixtex.ftp
+##endif
+
+
+mostlyclean::
+	rm -f kpsewhich *.lo
+	rm -rf PROF PROF_SHARED SHARED STATIC
+distclean::
+	rm -f paths.h texmf.cnf texmf.sed
+
+absolute.lo: absolute.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/absolute.h \
+ ../kpathsea/c-pathch.h
+atou.lo: atou.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+basename.lo: basename.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h
+cnf.lo: cnf.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
+ ../kpathsea/c-ctype.h \
+ ../kpathsea/cnf.h ../kpathsea/db.h ../kpathsea/str-list.h \
+ ../kpathsea/hash.h ../kpathsea/line.h ../kpathsea/paths.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/tex-file.h ../kpathsea/variable.h
+concat.lo: concat.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+concat3.lo: concat3.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+concatn.lo: concatn.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/concatn.h \
+ ../kpathsea/c-vararg.h
+db.lo: db.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/absolute.h \
+ ../kpathsea/c-fopen.h ../kpathsea/c-pathch.h ../kpathsea/db.h \
+ ../kpathsea/str-list.h ../kpathsea/hash.h ../kpathsea/line.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/readable.h ../kpathsea/tex-file.h ../kpathsea/variable.h
+debug.lo: debug.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+dir.lo: dir.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-dir.h \
+ ../kpathsea/c-stat.h \
+ ../kpathsea/hash.h
+elt-dirs.lo: elt-dirs.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/expand.h ../kpathsea/fn.h ../kpathsea/pathsearch.h \
+ ../kpathsea/str-llist.h ../kpathsea/xopendir.h ../kpathsea/c-dir.h 
+expand.lo: expand.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/expand.h ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/tilde.h ../kpathsea/variable.h
+extend-fname.lo: extend-fname.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+file-p.lo: file-p.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/xstat.h \
+ ../kpathsea/c-stat.h 
+find-suffix.lo: find-suffix.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h
+fn.lo: fn.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/fn.h
+fontmap.lo: fontmap.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-ctype.h \
+ ../kpathsea/c-fopen.h ../kpathsea/fontmap.h ../kpathsea/hash.h \
+ ../kpathsea/line.h ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/str-list.h ../kpathsea/tex-file.h
+getopt.lo: getopt.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h getopt.h
+getopt1.lo: getopt1.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h getopt.h
+hash.lo: hash.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/hash.h \
+ ../kpathsea/str-list.h
+kdefault.lo: kdefault.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/default.h
+kpsewhich.o: kpsewhich.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-ctype.h \
+ ../kpathsea/c-pathch.h ../kpathsea/expand.h ../kpathsea/getopt.h \
+ ../kpathsea/line.h ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/proginit.h ../kpathsea/tex-file.h ../kpathsea/tex-glyph.h \
+ ../kpathsea/variable.h
+line.lo: line.c 
+magstep.lo: magstep.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/magstep.h
+make-suffix.lo: make-suffix.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h
+path-elt.lo: path-elt.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h
+pathsearch.lo: pathsearch.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
+ ../kpathsea/absolute.h ../kpathsea/expand.h ../kpathsea/db.h \
+ ../kpathsea/str-list.h ../kpathsea/pathsearch.h \
+ ../kpathsea/str-llist.h ../kpathsea/readable.h ../kpathsea/variable.h 
+proginit.lo: proginit.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/proginit.h ../kpathsea/tex-file.h
+progname.lo: progname.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/absolute.h \
+ ../kpathsea/c-pathch.h ../kpathsea/c-stat.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h
+putenv.lo: putenv.c
+readable.lo: readable.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-stat.h \
+ ../kpathsea/readable.h ../kpathsea/tex-hush.h ../kpathsea/truncate.h
+rm-suffix.lo: rm-suffix.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+str-list.lo: str-list.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/str-list.h
+str-llist.lo: str-llist.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/str-llist.h
+strcasecmp.lo: strcasecmp.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h 
+strstr.lo: strstr.c
+strtol.lo: strtol.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h 
+tex-file.lo: tex-file.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
+ ../kpathsea/c-vararg.h ../kpathsea/cnf.h ../kpathsea/default.h \
+ ../kpathsea/expand.h ../kpathsea/fontmap.h ../kpathsea/hash.h \
+ ../kpathsea/paths.h ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/tex-file.h ../kpathsea/tex-make.h ../kpathsea/variable.h
+tex-glyph.lo: tex-glyph.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/absolute.h \
+ ../kpathsea/expand.h ../kpathsea/fontmap.h ../kpathsea/hash.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/tex-glyph.h ../kpathsea/tex-file.h ../kpathsea/tex-make.h \
+ ../kpathsea/variable.h
+tex-hush.lo: tex-hush.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/pathsearch.h \
+ ../kpathsea/str-llist.h ../kpathsea/tex-hush.h ../kpathsea/variable.h
+tex-make.lo: tex-make.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
+ ../kpathsea/c-pathch.h ../kpathsea/concatn.h ../kpathsea/c-vararg.h \
+ ../kpathsea/db.h ../kpathsea/str-list.h ../kpathsea/fn.h \
+ ../kpathsea/magstep.h ../kpathsea/readable.h ../kpathsea/tex-make.h \
+ ../kpathsea/tex-file.h ../kpathsea/variable.h
+tilde.lo: tilde.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/tilde.h 
+truncate.lo: truncate.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-namemx.h \
+ ../kpathsea/c-pathch.h ../kpathsea/c-pathmx.h ../kpathsea/truncate.h
+uppercasify.lo: uppercasify.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-ctype.h 
+variable.lo: variable.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-ctype.h \
+ ../kpathsea/cnf.h ../kpathsea/fn.h ../kpathsea/variable.h
+version.lo: version.c
+xcalloc.lo: xcalloc.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xfopen.lo: xfopen.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xfseek.lo: xfseek.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xftell.lo: xftell.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xgetcwd.lo: xgetcwd.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathmx.h
+xmalloc.lo: xmalloc.c 
+xopendir.lo: xopendir.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/xopendir.h \
+ ../kpathsea/c-dir.h 
+xputenv.lo: xputenv.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xrealloc.lo: xrealloc.c 
+xstat.lo: xstat.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/xstat.h \
+ ../kpathsea/c-stat.h 
+xstrdup.lo: xstrdup.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
new file mode 100644
--- /dev/null
+++ b/kpathsea/Makefile.in
@@ -0,0 +1,706 @@
+# Makefile for kpathsea --kb@mail.tug.org.  Public domain.
+version = 3.0
+
+# Add -DNO_DEBUG to disable debugging, for vanishingly better performance.
+
+ac_include ../make/paths.make
+ac_include ../make/makevars.make
+ac_include ../make/common.make
+ac_include ../make/library.make
+ac_include ../make/programs.make
+ac_include ../make/texi.make
+
+##ifdef HOSTNAME
+##warn_more = -Wmissing-prototypes -Wwrite-strings -Wshadow
+##MAKEINFO_FLAGS := $(MAKEINFO_FLAGS) --no-split
+##malloc = /usr/local/src/malloc/onefile.o # gmalloc.o
+##endif
+
+# Install these header files (except c-auto.h).
+install_headers = *.h
+
+# Put tex-file.o first, because it's what depends on the paths, and may
+# reduce frustration if the paths are wrong by doing it first.
+
+objects = tex-file.lo absolute.lo atou.lo cnf.lo concat.lo concat3.lo \
+concatn.lo db.lo debug.lo dir.lo elt-dirs.lo expand.lo extend-fname.lo \
+file-p.lo find-suffix.lo fn.lo fontmap.lo getopt.lo getopt1.lo hash.lo \
+kdefault.lo line.lo magstep.lo make-suffix.lo path-elt.lo \
+pathsearch.lo proginit.lo progname.lo readable.lo rm-suffix.lo \
+str-list.lo str-llist.lo tex-glyph.lo tex-hush.lo tex-make.lo \
+tilde.lo truncate.lo uppercasify.lo variable.lo version.lo xcalloc.lo \
+xfopen.lo xfseek.lo xftell.lo xgetcwd.lo xmalloc.lo xopendir.lo xputenv.lo \
+xrealloc.lo xstat.lo xstrdup.lo $(liblobjs) $(malloc)
+liblobjs = @LTLIBOBJS@
+
+library = kpathsea
+
+# We want to compile almost everything with libtool ...
+KPATHSEA_CC = $(LIBTOOL) compile $(CC)
+.c.lo:
+	$(KPATHSEA_CC) $< $(ALL_CFLAGS)
+.SUFFIXES: .lo
+
+default all: kpsewhich $(library).info
+
+kpsewhich: $(kpathsea) kpsewhich.o
+	$(kpathsea_link) kpsewhich.o $(LOADLIBES)
+
+$(kpathsea): $(objects)
+	$(LIBTOOL) archive $(AR) $(ARFLAGS) $@ $(objects)
+
+# All the objects depend on the klibtool configuration file.
+$(objects): ../klibtool.config
+
+# Make variable substitutions from paths.h.
+texmf.cnf: texmf.cnf.in texmf.sed
+	sed -f texmf.sed $(srcdir)/texmf.cnf.in >$@
+
+# The idea is to turn each var=value into s%@var@%value%g. Seems simpler
+# to put the substitutions in a file than to play shell quoting games.
+texmf.sed: $(top_srcdir)/../make/makevars.make $(top_srcdir)/../make/paths.make
+	echo $(makevars) \
+	| tr ' ' '\012' \
+	| sed -e 's/^/s%@/' -e 's/=/@%/' -e 's/$$/%/' -e 's/$$/g/' \
+	>$@-t
+# Don't replace the rhs of the TEXMF assignment itself, then we'd
+# end up with TEXMF = $TEXMF.  We replace all the other hardwired paths
+# with $TEXMF, though, for ease of modification.
+	echo 's%$(texmf)%\$$TEXMF%g' >>$@-t
+	echo '/^ *TEXMF[ =]/s%\$$TEXMF%$(texmf)%' >>$@-t
+	mv $@-t $@
+
+# First null out comments and leading/trailing whitespace, then remove
+# lines that define invalid C identifiers, then remove blank lines and
+# lines that define lowercase values (those are never path values). Each
+# line remaining looks like
+# <name> = <value>
+# (but = and surrounding spaces are optional, hence can't remove all spaces).
+# Change this to #ifndef DEFAULT_name@#define DEFAULT_name "value"@#endif,
+# then change the @'s to newlines (sed isn't good at multiline replacements).
+# 
+# No backslash-newline escapes in the long sed replacement because that
+# will turn into a space in the output.
+# 
+# Without the $TEXMF/dbtex/etc. substitutions, if the cnf file was
+# not found, the compile-time paths would be of little use, since TEXMF
+# (etc.) wouldn't be defined. Alternatively, we could have a way to
+# specify compile-time default values for variables in general, but I
+# think it's better to keep the last-resort paths as simple as possible.
+# 
+# The definition of DEFAULT_TEXMF (and other variables)
+# that winds up in the final paths.h will not be used.
+$(kpathsea_dir)/paths.h: texmf.cnf
+	echo "/* paths.h: Generated from texmf.cnf `date`.  */" >$@
+	sed -e 's/%.*//' -e 's/^[ 	]*//' -e 's/[ 	]*$$//' texmf.cnf \
+	| grep '^[ 	]*[A-Z1_]*[ 	=]' \
+	| sed '/^$$/d' \
+	| sed 's/^\([^ 	=]*\)[ 	]*=*[ 	]*\(.*\)/#ifndef DEFAULT_\1@#define DEFAULT_\1 "\2"@#endif/' \
+	| tr @ '\012' \
+	| sed -e 's@\$$TEXMF@$(texmf)@g' \
+	      -e 's@\$$dbtex@$(texinputdir)@g' \
+	      -e 's@\$$dbfonts@$(fontdir)@g' \
+	      -e 's@\$$VARTEXFONTS@/var/tex/fonts@g' \
+	      -e 's@\$$prefix@$(prefix)@g' \
+	>>$@
+
+# Need an extra definition for this. Dependencies included below.
+tex-file.o:
+	$(KPATHSEA_CC) -DDEFAULT_FONT_SIZES='\"$(default_texsizes)\"' $(srcdir)/tex-file.c
+
+check: kpsewhich
+	./kpsewhich -expand-var '$$TEXMF'
+
+install: install-exec install-data
+uninstall: uninstall-exec uninstall-data
+
+install-exec: kpsewhich
+	$(SHELL) $(top_srcdir)/../mkdirchain $(bindir) $(scriptdir) \
+	  $(libdir) $(web2cdir)
+	if grep 'original MakeTeXPK --' $(scriptdir)/MakeTeXPK >/dev/null 2>&1\
+	   || test ! -r $(scriptdir)/MakeTeXPK; then \
+	  $(INSTALL_SCRIPT) $(srcdir)/MakeTeXPK $(scriptdir)/MakeTeXPK; \
+	else true; fi
+	if grep 'original MakeTeXMF --' $(scriptdir)/MakeTeXMF >/dev/null 2>&1\
+	   || test ! -r $(scriptdir)/MakeTeXMF; then \
+	  $(INSTALL_SCRIPT) $(srcdir)/MakeTeXMF $(scriptdir)/MakeTeXMF; \
+	else true; fi
+	if grep 'original MakeTeXTFM --' $(scriptdir)/MakeTeXTFM >/dev/null 2>&1\
+	   || test ! -r $(scriptdir)/MakeTeXTFM; then \
+	  $(INSTALL_SCRIPT) $(srcdir)/MakeTeXTFM $(scriptdir)/MakeTeXTFM; \
+	else true; fi
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXls-R $(scriptdir)/MakeTeXls-R
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXcommon $(web2cdir)/MakeTeXcommon
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXmkdir $(web2cdir)/MakeTeXmkdir
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXnames $(web2cdir)/MakeTeXnames
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXnames.cnf $(web2cdir)/MakeTeXnames.cnf
+	$(INSTALL_SCRIPT) $(srcdir)/MakeTeXupdate $(web2cdir)/MakeTeXupdate
+	$(INSTALL_LIBTOOL_LIBS) $(libdir) lib$(library).la
+	$(INSTALL_LIBTOOL_PROG) $(bindir) kpsewhich
+uninstall-exec:
+	rm -f $(bindir)/kpsewhich
+
+install-data: texmf.cnf kpathsea.info
+	$(SHELL) $(top_srcdir)/../mkdirchain $(texmf) $(infodir) $(web2cdir)
+	if grep 'original texmf.cnf --' $(web2cdir)/texmf.cnf >/dev/null 2>&1 \
+	   || test ! -r $(web2cdir)/texmf.cnf; then \
+	  $(INSTALL_DATA) texmf.cnf $(web2cdir)/texmf.cnf; \
+	else true; fi
+	$(INSTALL_DATA) $(srcdir)/kpathsea.info $(infodir)/kpathsea.info
+	$(SHELL) $(top_srcdir)/../mkdirchain $(includedir)/kpathsea
+	for f in $(install_headers); do \
+	  $(INSTALL_DATA) $$f $(includedir)/kpathsea/$$f; done
+	rm -f $(includedir)/kpathsea/c-auto.h
+	$(POSTINSTALL)
+	test -r $(infodir)/dir || $(INSTALL_DATA) $(top_srcdir)/../dir $(infodir)
+	if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+	  install-info --info-dir=$(infodir) $(infodir)/kpathsea.info; \
+	else true; fi
+
+uninstall-data:
+	rm -f $(infodir)/kpathsea.info*
+	for f in $(install_headers); do rm -f $(includedir)/$$f; done
+
+# distdir is used by other distributions; they define $(distdir).
+distdir: doc $(library).dvi $(library).h
+	rm -rf $(distdir)
+	mkdir -p $(distdir)
+	ln $(ln_files) klibtool.version $(distdir)
+	touch *.info*
+	ln MakeTeX* *.info* *.texi $(library).aux $(library).cps $(distdir)
+	ln BUGS CONFIGURE HIER PROJECTS *.ac $(distdir)
+	touch kpathsea.h # to avoid .cps.h rule on Solaris
+	cd $(distdir) && rm -f paths.h
+	cd $(distdir) && add-version $(version) version.c
+
+# I don't use this, but other programmers want it.  acconfig.h is an
+# autoheader input file, not an includable C header. Bad name.
+$(library).h: always
+	rm -f $@
+	ls -1 *.h | grep -v acconfig.h \
+	  | sed -e 's,^,#include <kpathsea/,' -e s',$$,>,' >$@	  
+	touch -r `ls -1t *.h | tail +2 | head -1` $@ 
+always:
+.PHONY: always
+
+ac_include ../make/config.make
+
+info: $(library).info
+dvi: $(library).dvi
+
+$(library).info: bugs.texi hier.texi install.texi unixtex.texi
+
+##ifdef HOSTNAME
+##INSTALL: install.texi
+##	$(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
+##	add-info-toc $@
+##BUGS: bugs.texi
+##	$(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
+##	add-info-toc $@
+##HIER: hier.texi
+##	$(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
+##unixtex.ftp: unixtex.texi
+##	$(MAKEINFO) $(one_info) $(MAKEINFO_FLAGS) $< -o $@
+##doc: info HIER BUGS INSTALL unixtex.ftp
+##endif
+
+ac_include ../make/clean.make
+
+mostlyclean::
+	rm -f kpsewhich *.lo
+	rm -rf PROF PROF_SHARED SHARED STATIC
+distclean::
+	rm -f paths.h texmf.cnf texmf.sed
+
+ac_include ../make/rdepend.make
+absolute.lo: absolute.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/absolute.h \
+ ../kpathsea/c-pathch.h
+atou.lo: atou.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+basename.lo: basename.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h
+cnf.lo: cnf.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
+ ../kpathsea/c-ctype.h \
+ ../kpathsea/cnf.h ../kpathsea/db.h ../kpathsea/str-list.h \
+ ../kpathsea/hash.h ../kpathsea/line.h ../kpathsea/paths.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/tex-file.h ../kpathsea/variable.h
+concat.lo: concat.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+concat3.lo: concat3.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+concatn.lo: concatn.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/concatn.h \
+ ../kpathsea/c-vararg.h
+db.lo: db.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/absolute.h \
+ ../kpathsea/c-fopen.h ../kpathsea/c-pathch.h ../kpathsea/db.h \
+ ../kpathsea/str-list.h ../kpathsea/hash.h ../kpathsea/line.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/readable.h ../kpathsea/tex-file.h ../kpathsea/variable.h
+debug.lo: debug.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+dir.lo: dir.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-dir.h \
+ ../kpathsea/c-stat.h \
+ ../kpathsea/hash.h
+elt-dirs.lo: elt-dirs.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/expand.h ../kpathsea/fn.h ../kpathsea/pathsearch.h \
+ ../kpathsea/str-llist.h ../kpathsea/xopendir.h ../kpathsea/c-dir.h 
+expand.lo: expand.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/expand.h ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/tilde.h ../kpathsea/variable.h
+extend-fname.lo: extend-fname.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+file-p.lo: file-p.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/xstat.h \
+ ../kpathsea/c-stat.h 
+find-suffix.lo: find-suffix.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h
+fn.lo: fn.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/fn.h
+fontmap.lo: fontmap.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-ctype.h \
+ ../kpathsea/c-fopen.h ../kpathsea/fontmap.h ../kpathsea/hash.h \
+ ../kpathsea/line.h ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/str-list.h ../kpathsea/tex-file.h
+getopt.lo: getopt.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h getopt.h
+getopt1.lo: getopt1.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h getopt.h
+hash.lo: hash.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/hash.h \
+ ../kpathsea/str-list.h
+kdefault.lo: kdefault.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/default.h
+kpsewhich.o: kpsewhich.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-ctype.h \
+ ../kpathsea/c-pathch.h ../kpathsea/expand.h ../kpathsea/getopt.h \
+ ../kpathsea/line.h ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/proginit.h ../kpathsea/tex-file.h ../kpathsea/tex-glyph.h \
+ ../kpathsea/variable.h
+line.lo: line.c 
+magstep.lo: magstep.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/magstep.h
+make-suffix.lo: make-suffix.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h
+path-elt.lo: path-elt.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h
+pathsearch.lo: pathsearch.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
+ ../kpathsea/absolute.h ../kpathsea/expand.h ../kpathsea/db.h \
+ ../kpathsea/str-list.h ../kpathsea/pathsearch.h \
+ ../kpathsea/str-llist.h ../kpathsea/readable.h ../kpathsea/variable.h 
+proginit.lo: proginit.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/proginit.h ../kpathsea/tex-file.h
+progname.lo: progname.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/absolute.h \
+ ../kpathsea/c-pathch.h ../kpathsea/c-stat.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h
+putenv.lo: putenv.c
+readable.lo: readable.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-stat.h \
+ ../kpathsea/readable.h ../kpathsea/tex-hush.h ../kpathsea/truncate.h
+rm-suffix.lo: rm-suffix.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+str-list.lo: str-list.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/str-list.h
+str-llist.lo: str-llist.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/str-llist.h
+strcasecmp.lo: strcasecmp.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h 
+strstr.lo: strstr.c
+strtol.lo: strtol.c config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h 
+tex-file.lo: tex-file.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
+ ../kpathsea/c-vararg.h ../kpathsea/cnf.h ../kpathsea/default.h \
+ ../kpathsea/expand.h ../kpathsea/fontmap.h ../kpathsea/hash.h \
+ ../kpathsea/paths.h ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/tex-file.h ../kpathsea/tex-make.h ../kpathsea/variable.h
+tex-glyph.lo: tex-glyph.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/absolute.h \
+ ../kpathsea/expand.h ../kpathsea/fontmap.h ../kpathsea/hash.h \
+ ../kpathsea/pathsearch.h ../kpathsea/str-llist.h \
+ ../kpathsea/tex-glyph.h ../kpathsea/tex-file.h ../kpathsea/tex-make.h \
+ ../kpathsea/variable.h
+tex-hush.lo: tex-hush.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/pathsearch.h \
+ ../kpathsea/str-llist.h ../kpathsea/tex-hush.h ../kpathsea/variable.h
+tex-make.lo: tex-make.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
+ ../kpathsea/c-pathch.h ../kpathsea/concatn.h ../kpathsea/c-vararg.h \
+ ../kpathsea/db.h ../kpathsea/str-list.h ../kpathsea/fn.h \
+ ../kpathsea/magstep.h ../kpathsea/readable.h ../kpathsea/tex-make.h \
+ ../kpathsea/tex-file.h ../kpathsea/variable.h
+tilde.lo: tilde.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathch.h \
+ ../kpathsea/tilde.h 
+truncate.lo: truncate.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-namemx.h \
+ ../kpathsea/c-pathch.h ../kpathsea/c-pathmx.h ../kpathsea/truncate.h
+uppercasify.lo: uppercasify.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-ctype.h 
+variable.lo: variable.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-ctype.h \
+ ../kpathsea/cnf.h ../kpathsea/fn.h ../kpathsea/variable.h
+version.lo: version.c
+xcalloc.lo: xcalloc.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xfopen.lo: xfopen.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xfseek.lo: xfseek.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xftell.lo: xftell.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xgetcwd.lo: xgetcwd.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-pathmx.h
+xmalloc.lo: xmalloc.c 
+xopendir.lo: xopendir.c ../kpathsea/config.h c-auto.h \
+ ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/xopendir.h \
+ ../kpathsea/c-dir.h 
+xputenv.lo: xputenv.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
+xrealloc.lo: xrealloc.c 
+xstat.lo: xstat.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/xstat.h \
+ ../kpathsea/c-stat.h 
+xstrdup.lo: xstrdup.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
+ ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
+ ../kpathsea/c-memstr.h \
+ ../kpathsea/c-errno.h \
+ ../kpathsea/c-minmax.h \
+ ../kpathsea/c-limits.h \
+ ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
+ ../kpathsea/lib.h ../kpathsea/progname.h
new file mode 100644
--- /dev/null
+++ b/kpathsea/NEWS
@@ -0,0 +1,162 @@
+This file records noteworthy changes.
+
+3.0 (7 February 1997)
+* Distribution terms changed to the GNU Library General Public License.
+* Default directory structure matches the TDS standard. The most
+  important change is in the fonts/ directory: the file type (tfm, pk)
+  is now directly underneath fonts/.  Also, mft/ is now at the top level.
+  `modeless' is used for gsftopk/ps2pk/etc.-generated fonts.
+* Change in searching algorithm: if the name already has a suffix
+  (foo.sty), search for it by itself first, before appending the default
+  suffix (foo.sty.tex).  This loses if you have an executable named
+  foo.bar, with documentation in foo.bar.tex (foo.bar will be found
+  first).  But this is unusual, and the other case is common.
+* Environment variables PATH_program (e.g., TEXINPUTS_latex) checked
+  for, as with configuration file values (TEXINPUTS.latex).
+* Multiple TEXMF trees supported, via the following new facility:
+* Shell brace expansion {foo,bar} implemented, thanks to Bash.
+* Multiple ls-R files supported via the TEXMFDBS path.
+* An ``alias'' database for files in ls-R supported, to handle 8.3 problems.
+* Directories in the ls-R file can be relative (./) as well as absolute (/).
+* New MakeTeX{PK,TFM,MF} scripts with more features, based on teTeX's.
+* DVIPSMAKEPK (etc.) actually overrides the name `MakeTeXPK', as documented.
+* MakeTeX* can be globally disabled via configure options.
+* Support for building as a shared library with configure --enable-shared.
+* Directories whose names begin with `.' are ignored.
+* Some warnings can be suppressed by TEX_HUSH cnf value or envvar.
+* kpsewhich has many new capabilities, documented via --help and in the manual.
+* texfonts.map parsing has an include directive, and @c is a comment.
+* Input lines in texmf.cnf can be continued with \.
+* TEXMFLOG can be set in texmf.cnf, as previously documented.
+* SELFAUTODIR and SELFAUTOPARENT are defined according to the location
+  of the binary, and used to search for texmf.cnf.
+* /// (or more) is equivalent to //.
+* If $HOME = / (as with root on some systems), avoid creating // in paths.
+* Support for AFM, PostScript Type 1 font, source, documentation, Omega,
+  and MetaPost-related file formats.
+* New header kpathsea.h with all #include files.
+* Under DOS, ls-R lines need not start with . or / or \ (e.g., c:).
+* Amiga support.
+
+2.6 (9 January 1995)
+* MakeTeXPK installed from kpathsea, instead of each driver.
+* MakeTeXPK.site looked for in texmf/web2c, instead of texmf/dvips.
+* texmf.cnf installed and looked for in texmf/web2c, instead of texmf.
+* If a mode is not explicitly specified, search all subdirectories (this
+  was actually in a previous release).
+* install-sh only looked for in the top-level directory.
+* kpsewhich replaces and generalizes kpsexpand.
+
+2.5 (15 December 1994)
+* Go back to calling db_insert after a successful MakeTeXPK, and check
+  for lack of an ls-R.
+* Handle case of magstep -.5 for MakeTeXPK properly.
+
+2.4 (28 October 1994)
+* Avoid calling db_insert, which caused a segmentation fault.
+
+2.3 (26 October 1994)
+* Extra :'s in an envvar value, referring to the texmf.cnf value, work.
+* Names like dpi600/cmr10.pk can be found in ls-R.
+* KPATHSEA_DEBUG environment variable checked.
+* Directories like pk/ljfour directly under $TEXMF/fonts are found.
+* New standalone program, kpsexpand, optionally compiled and installed,
+  to do variable expansion (not path searching).
+* Debugging output written to stderr instead of stdout.
+* pxlNNN support removed; I never intended to support `pxl1500', and
+  pxl300 is never used.
+
+2.2 (14 October 1994)
+* MakeTeXPK invoked for the any_glyph type; this is for xdvik.
+* MakeTeXPK sources $(psheaderdir)/MakeTeXPK.site if it exists.
+* pxlNNN/cmr10.pk searched for (as well as dpiNNN/cmr10.pk and cmr10.NNNpk)
+
+2.1 (12 September 1994)
+* Manual goes through TeX, and .cps/.aux files are in the distribution.
+* INSTALL* variables set at the top level.
+* Dependency on GNU tr making paths.h and texmf.sed (->texmf.cnf) removed.
+* texmf.cnf installed if it didn't previously exist.
+
+2.0 (8 September 1994)
+* Runtime configuration file support; see the manual.
+* Both dpi600/cmr10.pk and cmr10.600pk are searched for.
+* ls-R matches $TEXMF//latex2e vs. $TEXMF//latex209.
+* $TEXMFLOG, if set, specifies a filename for logging successful searches.
+* All directory entries beginning with `.' are ignored, not just `.' and `..'.
+* Default path for PK and GF fonts includes the mode name.
+* ls-R is in $TEXMFROOT instead of hardwired at compile time.
+* More debugging flags, and they can be set with client program options.
+* If MakeTeX{PK,TFM} fail, or aren't invoked, a file missfont.log is
+  written with the requisite commands, as in dvips.
+* More 328/329/330 fixes, maybe for the last time.
+* The override font paths (XDVIFONTS etc.) apply only to glyph (PK/GF)
+  searches, not TFM or VF.
+* -g is not the default when linking, to avoid unnecessarily large binaries
+  (due to static libraries) under Linux.
+* configure checks for a smart putenv.
+* Stat results are cached to speed up disk searches.
+
+1.8 (2 April 1994)
+* New target install-info, so the documentation can be installed without
+  the headers.
+* Existing but unreadable files are complained about, instead of just ignored.
+* A leading %% in a path element forbids searching the disk for that
+  element; only a db will be searched (if it exists).
+* The db is only used if it might be relevant to a given path element,
+  not searched first regardless.
+
+1.7 (1 March 1994)
+* Searches can use an externally-built ls-R ``database'', for speed.
+* `VPATH = .' lines removed from generated Makefile, for broken Sun make.
+* A path foo//tfm finds foo/tfm as well as foo/*/tfm.
+
+1.6 (3 February 1994)
+* Memory fault in copying long paths fixed.
+* More variables passed down from the top-level Makefile.
+* Mention SMART_PUTENV in the INSTALL file, and fix bug in xputenv.c
+  when one envvar is a proper prefix of another.
+* More attempts at eliminating magstephalf annoyances.
+* Directory name substitutions are done globally when creating paths.h.
+* Various changes for DOS.
+
+1.5 (24 January 1994)
+* Default paths changed.
+* Defining GCC_WCHAR lets GCC define wchar_t.
+* EXIT_FAILURE and EXIT_SUCCESS defined in all cases (if they're not already).
+* str[r]chr never redefined (I hope).
+
+1.4 (3 November 1993)
+* Check closest fallback font size.
+* All default paths (including dvips') in paths.h.in, not the Makefile.
+* Rearrange directory lists so that dirs in which a file is found
+  migrate to the top.
+* Update for Autoconf 1.7.
+
+1.3 (6 October 1993)
+* Fix free of non-malloced memory bug.
+* Fix uninitialized gf path bug.
+* mkdirchain invoked as an absolute filename.
+
+1.2 (27 September 1993)
+* Running MakeTeXPK is tried before the fallback resolutions.
+* The final bitmap name uses a variable spec, so DOS & OS/2 can get
+  dpi300/cmr10.pk.
+* Document TeX-specific features.
+* Dpi passed to MakeTeXPK via the envvar KPATHSEA_DPI instead of MAKETEX_DPI.
+
+1.1 (26 August 1993)
+* Installation fixes.
+
+1.0 (5 August 1993)
+* Routines to look up TeX font files, default path specifications, etc.
+* Sort-of pattern matching: /foo//bar matches subdirectories
+  /foo/a/bar, /foo/b/bar, /foo/a1/a2/bar, etc.
+* $var and ${var} expansion.
+* Support for MakeTeX... scripts.
+* Support for fallback resolutions and font.
+* Lazy evaluation of path elements.
+* Some runtime debugging support.
+
+0.2 (12 May 1993)
+
+First general release as a standalone library.
new file mode 100644
--- /dev/null
+++ b/kpathsea/PROJECTS
@@ -0,0 +1,23 @@
+Here are some ideas for improvements.  If you would like to contribute,
+please send mail to me (kb@mail.tug.org) first.
+
+
+If the library is built shared, it would be nice if the binaries did not
+have it as a dependency; as it is, all of Web2c gets rebuilt if the
+library changes, even though logically only relinking (maybe not even
+that) is necessary.  This is because if the Web2c programs themselves
+get relinked (as they do), we must reconvert the web programs.
+
+For multiple texmf.cnf files (or multiple dvips configuration files),
+replace extra :'s by the value from the next file in the path, rather
+than the value from the next level.
+
+Support runtime registration of file types to search for, not just
+compile-time. Either by a procedure call, or by reading a configuration
+file. Implies putting the envvar list into the kpse_format_info_type struct.
+
+cd during filesystem operations, to minimize the pathname
+length. Implies always using xgetwd.
+
+Separate the routines needed for path searching, and others that are here
+only because it's a common place -- i.e., a kutil library.
new file mode 100644
--- /dev/null
+++ b/kpathsea/README
@@ -0,0 +1,19 @@
+This directory contains the Kpathsea[rch] library, which implements
+generic path searching, configuration, and TeX-specific file searching.
+
+See `NEWS' for changes by release, `ChangeLog` for all changes.
+See `INSTALL' for installation instructions.
+See `BUGS' for bug reporting details.
+See `CONFIGURE' for details on running Autoconf-generated configure scripts.
+See `PROJECTS' for future improvements you might like to work on.
+
+Suggestions for improvements in either the library or the documentation,
+no matter how small, are welcome. But please read ./BUGS before sending
+a bug report.
+
+This is free software.  See the files COPYING* for copying permissions.
+The top-level headers are `pathsearch.h' for the generic path searching
+support, and `tex-{file,glyph}.h' for the TeX-specific support.
+
+kb@mail.tug.org
+Member of the League for Programming Freedom -- write lpf@uunet.uu.net.
new file mode 100644
--- /dev/null
+++ b/kpathsea/absolute.c
@@ -0,0 +1,61 @@
+/* absolute.c: Test if a filename is absolute or explicitly relative.
+
+Copyright (C) 1993, 94, 95 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/absolute.h>
+#include <kpathsea/c-pathch.h>
+
+#ifdef DOSISH
+#include <kpathsea/c-ctype.h> /* for ISALPHA */
+#endif /* DOS */
+
+
+/* Sorry this is such a system-dependent mess, but I can't see any way
+   to usefully generalize.  */
+
+boolean
+kpse_absolute_p P2C(const_string, filename,  boolean, relative_ok)
+{
+#ifdef VMS
+#include <string.h>
+  return strcspn (filename, "]>:") != strlen (filename);
+#else /* not VMS */
+  boolean absolute = IS_DIR_SEP (*filename)
+#ifdef DOSISH
+                     || ISALPHA (*filename) && IS_DEVICE_SEP (filename[1])
+#endif /* DOSISH */
+#ifdef AMIGA
+		     /* Colon anywhere means a device.  */
+		     || strchr (filename, ':')
+#endif /* AMIGA */
+		      ;
+  boolean explicit_relative
+    = relative_ok
+#ifdef AMIGA
+      /* Leading / is like `../' on Unix and DOS.  Allow Unix syntax,
+         too, though, because of possible patch programs like
+         `UnixDirsII' by Martin Scott.  */
+      && IS_DIR_SEP (*filename) || 0
+#endif /* AMIGA */
+      && (*filename == '.' && (IS_DIR_SEP (filename[1])
+                         || (filename[1] == '.' && IS_DIR_SEP (filename[2]))));
+
+  return absolute || explicit_relative;
+#endif /* not VMS */
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/absolute.h
@@ -0,0 +1,31 @@
+/* absolute.h: Declare absolute filename predicate.
+
+Copyright (C) 1993, 94 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_ABSOLUTE_H
+#define KPATHSEA_ABSOLUTE_H
+
+#include <kpathsea/types.h>
+#include <kpathsea/c-proto.h>
+
+
+/* True if FILENAME is absolute (/foo) or, if RELATIVE_OK is true,
+   explicitly relative (./foo, ../foo), else false (foo).  */
+
+extern boolean kpse_absolute_p P2H(const_string filename, boolean relative_ok);
+
+#endif /* not KPATHSEA_ABSOLUTE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/acconfig.h
@@ -0,0 +1,76 @@
+/* acconfig.h -- used by autoheader when generating c-auto.h.in.
+
+   If you're thinking of editing acconfig.h to fix a configuration
+   problem, don't. Edit the c-auto.h file created by configure,
+   instead.  Even better, fix configure to give the right answer.  */
+
+/* kpathsea/configure.in tests for these functions with
+   kb_AC_KLIBTOOL_REPLACE_FUNCS, and naturally Autoheader doesn't know
+   about that macro.  Since the shared library stuff is all preliminary
+   anyway, I decided not to change Autoheader, but rather to hack them
+   in here.  */
+#undef HAVE_BASENAME
+#undef HAVE_PUTENV
+#undef HAVE_STRCASECMP
+#undef HAVE_STRTOL
+#undef HAVE_STRSTR
+
+@TOP@
+
+/* Define if your putenv doesn't waste space when the same environment
+   variable is assigned more than once, with different (malloced)
+   values.  This is true only on NetBSD/FreeBSD, as far as I know. See
+   xputenv.c.  */
+#undef SMART_PUTENV
+
+/* Define if you are using GNU libc or otherwise have global variables
+   `program_invocation_name' and `program_invocation_short_name'.  */
+#undef HAVE_PROGRAM_INVOCATION_NAME
+
+/* Define if you get clashes concerning wchar_t, between X's include
+   files and system includes.  */
+#undef FOIL_X_WCHAR_T
+
+/* tex: Define to enable --ipc.  */
+#undef IPC
+
+/* all: Define to enable running scripts when missing input files.  */
+#define MAKE_TEX_MF_BY_DEFAULT 0
+#define MAKE_TEX_PK_BY_DEFAULT 0
+#define MAKE_TEX_TEX_BY_DEFAULT 0
+#define MAKE_TEX_TFM_BY_DEFAULT 0
+#define MAKE_OMEGA_OFM_BY_DEFAULT 0
+#define MAKE_OMEGA_OCP_BY_DEFAULT 0
+
+/* web2c: Define if gcc asm needs _ on external symbols.  */
+#undef ASM_NEEDS_UNDERSCORE
+
+/* web2c: Define when using system-specific files for arithmetic.  */
+#undef ASM_SCALED_FRACTION
+
+/* web2c: Define to enable HackyInputFileNameForCoreDump.tex.  */
+#undef FUNNY_CORE_DUMP
+
+/* web2c: Define to disable architecture-independent dump files.
+   Faster on LittleEndian architectures.  */
+#undef NO_DUMP_SHARE
+
+/* web2c: Default editor for interactive `e' option. */
+#define EDITOR "vi +%d %s"
+
+/* web2c: Window system support for Metafont. */
+#undef HP2627WIN
+#undef MFTALKWIN
+#undef NEXTWIN
+#undef REGISWIN
+#undef SUNWIN
+#undef TEKTRONIXWIN
+#undef UNITERMWIN
+#undef X11WIN
+
+/* xdvik: Define if you have SIGIO, F_SETOWN, and FASYNC.  */
+#undef HAVE_SIGIO
+
+/* xdvik: Define to avoid using any toolkit (and consequently omit lots
+   of features).  */
+#undef NOTOOL
new file mode 100644
--- /dev/null
+++ b/kpathsea/atou.c
@@ -0,0 +1,30 @@
+/* atou.c: like atoi, but if the number is negative, abort.
+
+Copyright (C) 1992, 95 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include "config.h"
+
+unsigned
+atou P1C(const_string, s)
+{
+  int i = atoi (s);
+  
+  if (i < 0)
+    FATAL1 ("I expected a positive number, not %d", i);
+  
+  return i;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/basename.c
@@ -0,0 +1,49 @@
+/* basename.c: return the last element in a path.
+
+Copyright (C) 1992, 94, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Have to include this first to get c-auto.h.  */
+#include <kpathsea/config.h>
+
+#ifndef HAVE_BASENAME /* rest of file */
+
+#include <kpathsea/c-pathch.h>
+
+/* Return NAME with any leading path stripped off.  This returns a
+   pointer into NAME.  For example, `basename ("/foo/bar.baz")'
+   returns "bar.baz".  */
+
+const_string
+basename P1C(const_string, name)
+{
+  const_string base = NULL;
+  unsigned len = strlen (name);
+  
+  for (len = strlen (name); len > 0; len--) {
+    if (IS_DIR_SEP (name[len - 1]) || IS_DEVICE_SEP (name[len - 1])) {
+      base = name + len;
+      break;
+    }
+  }
+
+  if (!base)
+    base = name;
+  
+  return base;
+}
+
+#endif /* not HAVE_BASENAME */
new file mode 100644
--- /dev/null
+++ b/kpathsea/bugs.texi
@@ -0,0 +1,836 @@
+@ifclear version
+@defcodeindex fl
+@defcodeindex op
+@end ifclear
+
+@node Reporting bugs
+@section Reporting bugs
+
+@cindex reporting bugs
+@cindex bugs, reporting
+
+@ifset version
+(A copy of this chapter is in the file @file{kpathsea/BUGS}.)
+@end ifset
+
+@flindex tex-k@@mail.tug.org @r{(bug address)}
+@cindex bug address
+If you have problems or suggestions, please report them to
+@email{tex-k@@mail.tug.org} using the bug checklist below.
+
+Please report bugs in the documentation; not only factual errors or
+inconsistent behavior, but unclear or incomplete explanations, typos,
+wrong fonts, @dots{}
+
+@menu
+* Bug checklist::       What to include in a good bug report.
+* Mailing lists::       Joining the bugs or announcements mailing lists.
+* Debugging::           Analyzing runtime problems.
+* Logging::             Recording searches.
+* Common problems::     When things go wrong.
+@end menu
+
+
+@node Bug checklist
+@subsection Bug checklist
+
+@cindex checklist for bug reports
+@cindex bug checklist
+
+Before reporting a bug, please check below to be sure it isn't already
+known (@pxref{Common problems}).
+
+Bug reports should be sent via electronic mail to
+@email{tex-k@@mail.tug.org}, or by postal mail to 135 Center Hill Road /
+Plymouth, MA 02360 / USA.
+
+The general principle is that a good bug report includes all the
+information necessary for reproduction.  Therefore, to enable
+investigation, your report should include the following:
+
+@itemize @bullet
+@item
+@cindex version numbers, determining
+The version number(s) of the program(s) involved, and of Kpathsea
+itself.  You can get the former by giving a sole option @samp{--version}
+to the program, and the latter by running @samp{kpsewhich --version}.
+The @file{NEWS} and @file{ChangeLog} files also contain the version
+number.
+
+@item
+@pindex uname
+The hardware, operating system (including version number), compiler, and
+@code{make} program you are using (the output of @code{uname -a} is a
+start on the first two, though often incomplete).  If the bug involves
+the X window system, include X version and supplier information as well
+(examples: X11R6 from MIT; X11R4 from HP; OpenWindows 3.3 bundled with
+SunOS 4.1.4).
+
+@item
+@flindex config.log
+Any options you gave to @code{configure}.  This is recorded in the
+@file{config.status} files.
+
+@cindex configuration bugs
+@flindex config.status
+If you are reporting a bug in @samp{configure} itself, it's probably
+system-dependent, and it will be unlikely the maintainers can do
+anything useful if you merely report that thus-and-such is broken.
+Therefore, you need to do some additional work: for some bugs, you can
+look in the file @file{config.log} where the test that failed should
+appear, along with the compiler invocation and source program in
+question.  You can then compile it yourself by hand, and discover why
+the test failed.  Other @samp{configure} bugs do not involve the
+compiler; in that case, the only recourse is to inspect the
+@code{configure} shell script itself, or the Autoconf macros that
+generated @code{configure}.
+
+@item
+The log of all debugging output, if the bug is in path searching.  You
+can get this by setting the environment variable @code{KPATHSEA_DEBUG}
+to @samp{-1} before running the program.  Please look at the log
+yourself to make sure the behavior is really a bug before reporting it;
+perhaps ``old'' environment variable settings are causing files not to
+be found, for example.
+
+@item
+The contents of any input files necessary to reproduce the bug.  For
+bugs in DVI-reading programs, for example, this generally means a DVI
+file (and any EPS or other files it uses)---@TeX{} source files are
+helpful, but the DVI file is necessary, because that's the actual
+program input.
+
+@cindex shar@r{, recommended}
+GNU @code{shar}, available from @url{ftp://prep.ai.mit.edu/pub/gnu} is
+a convenient way of packaging multiple (possibly binary) files for
+electronic mail.  If you feel your input files are too big to send by
+email, you can ftp them to @url{ftp://ftp.tug.org/incoming} (that
+directory is writable, but not readable).
+
+@item
+@cindex context diff
+@cindex sending patches
+@flindex ChangeLog @r{entry}
+If you are sending a patch (do so if you can!), please do so in the form
+of a context diff (@samp{diff -c}) against the original distribution
+source.  Any other form of diff is either not as complete or harder for
+me to understand.  Please also include a @file{ChangeLog} entry.
+
+@item
+@cindex stack trace
+@cindex debugger
+@cindex crashes, reporting
+@cindex core dumps, reporting
+@cindex null pointers, dereferencing
+@pindex gdb@r{, recommended}
+If the bug involved is an actual crash (i.e., core dump), it is easy and
+useful to include a stack trace from a debugger (I recommend the GNU
+debugger GDB, available from @url{ftp://prep.ai.mit.edu/pub/gnu}).  If
+the cause is apparent (a @code{NULL} value being dereferenced, for
+example), please send the details along.  If the program involved is
+@TeX{} or Metafont, and the crash is happening at apparently-sound code,
+however, the bug may well be in the compiler, rather than in the program
+or the library (@pxref{TeX or Metafont failing,, @TeX{} or Metafont
+failing}).
+
+@item
+Any additional information that will be helpful in reproducing,
+diagnosing, or fixing the bug.
+@end itemize
+
+
+@node Mailing lists
+@subsection Mailing lists
+
+@cindex mailing lists
+@cindex bug mailing list
+@cindex announcement mailing list
+
+Web2c and Kpathsea in general are discussed on the mailing list
+@email{tex-k@@mail.tug.org}.
+@flindex tex-k-request@@mail.tug.org
+To join, email @email{tex-k-request@@mail.tug.org} with a line
+consisting of
+
+@example
+subscribe @var{you}@@@var{your.preferred.email.address}
+@end example
+
+@noindent in the body of the message.
+
+You do not need to join to submit a report, nor will it affect whether
+you get a response.  There is no Usenet newsgroup equivalent (if you can
+be the one to set this up, email @samp{tex-k-request}).  Traffic on the
+list is fairly light, and is mainly bug reports and enhancement requests
+to the software.  The best way to decide if you want to join or not is
+read some of the archives from @url{ftp://ftp.tug.org/mail/archives/tex-k/}.
+
+Be aware that large data files are sometimes included in bug reports.
+If this is a problem for you, do not join the list.
+
+@flindex tex-archive@@math.utah.edu
+@cindex announcement mailing list
+If you only want announcements of new releases, not bug reports and
+discussion, join @email{tex-archive@@math.utah.edu} (via mail to
+@email{tex-archive-request@@math.utah.edu}).
+
+@cindex @TeX{} help mailing list
+@cindex La@TeX{} help mailing list
+@cindex Usenet @TeX{} newsgroup
+@cindex newsgroup for @TeX{}
+@cindex help, mailing list for general @TeX{}
+@flindex info-tex@@shsu.edu
+@flindex comp.text.tex
+If you are looking for general @TeX{} help, such as how to use La@TeX{},
+please use the mailing list @email{info-tex@@shsu.edu} mailing list,
+which is gatewayed to the @samp{comp.text.tex} Usenet newsgroup (or post
+to the newsgroup; the gateway is bidirectional).
+
+
+@node Debugging
+@subsection Debugging
+
+@cindex debugging
+@cindex runtime debugging
+@cindex options for debugging
+
+@vindex kpathsea_debug
+@flindex debug.h
+Kpathsea provides a number of runtime debugging options, detailed below
+by their names and corresponding numeric values.  When the files you
+expect aren't being found, the thing to do is enable these options and
+examine the output.
+
+You can set these with some runtime argument (e.g., @samp{-d}) to the
+program; in that case, you should use the numeric values described in
+the program's documentation (which, for Dvipsk and Xdvik, are different
+than those below).  It's best to give the @samp{-d} (or whatever) option
+first, for maximal output.  Dvipsk and Xdvik have additional
+program-specific debugging options as well.
+
+@vindex KPATHSEA_DEBUG
+@vindex kpathsea_debug
+You can also set the environment variable @code{KPATHSEA_DEBUG}; in this
+case, you should use the numbers below.  Also, if you run the program
+under a debugger and set the variable @code{kpathsea_debug}, Also use
+the numbers below
+
+@kindex -1 @r{debugging value}
+In any case, by far the simplest value to use is @samp{-1}, which will
+turn on all debugging output.  This is usually better than guessing
+which particular values will yield the output you need.
+
+@cindex debugging output
+@cindex standard error and debugging output
+Debugging output always goes to standard error, so you can redirect it
+easily.  For example, in Bourne-compatible shells:
+@example
+dvips -d -1 @dots{} 2>/tmp/debug
+@end example
+
+@cindex Kpsewhich, and debugging
+It is sometimes helpful to run the standalone Kpsewhich utility
+(@pxref{Invoking kpsewhich}), instead of the original program.
+
+@cindex numeric debugging values
+In any case, you can @emph{not} use the @emph{names} below; you must
+always use somebody's numbers.  (Sorry.)  To set more than one
+option, just sum the corresponding numbers.
+
+@vtable @code
+@item KPSE_DEBUG_STAT @r{(1)}
+Report @samp{stat}(2) calls. This is useful for verifying that your
+directory structure is not forcing Kpathsea to do many additional file
+tests (@pxref{Slow path searching}, and @pxref{Subdirectory
+expansion}). If you are using an up-to-date @file{ls-R} database
+(@pxref{Filename database}), this should produce no output unless a
+nonexistent file that must exist is searched for.
+
+@item KPSE_DEBUG_HASH @r{(2)}
+Report lookups in all hash tables: @file{ls-R} and @file{aliases}
+(@pxref{Filename database}); font aliases (@pxref{Fontmap}); and config
+file values (@pxref{Config files}).  Useful when expected values are not
+being found, e.g.., file searches are looking at the disk instead of
+using @file{ls-R}.
+
+@item KPSE_DEBUG_FOPEN @r{(4)}
+@findex fopen@r{, redefined}
+Report file openings and closings. Especially useful when your system's
+file table is full, for seeing which files have been opened but never
+closed. In case you want to set breakpoints in a debugger: this works by
+redefining @samp{fopen} (@samp{fclose}) to be @samp{kpse_fopen_trace}
+(@samp{kpse_fclose_trace}).
+
+@item KPSE_DEBUG_PATHS @r{(8)}
+@tindex kpse_format_info_type
+Report general path information for each file type Kpathsea is asked to
+search. This is useful when you are trying to track down how a
+particular path got defined---from @file{texmf.cnf}, @file{config.ps},
+an environment variable, the compile-time default, etc.  This is the
+contents of the @code{kpse_format_info_type} structure defined in
+@file{tex-file.h}.
+
+@item KPSE_DEBUG_EXPAND @r{(16)}
+Report the directory list corresponding to each path element Kpathsea
+searches. This is only relevant when Kpathsea searches the disk, since
+@file{ls-R} searches don't look through directory lists in this way.
+
+@item KPSE_DEBUG_SEARCH @r{(32)}
+Report on each file search: the name of the file searched for, the path
+searched in, whether or not the file must exist (when drivers search for
+@file{cmr10.vf}, it need not exist), and whether or not we are
+collecting all occurrences of the file in the path (as with, e.g.,
+@file{texmf.cnf} and @file{texfonts.map}), or just the first (as with
+most lookups).  This can help you correlate what Kpathsea is doing with
+what is in your input file.
+@end vtable
+
+@cindex @samp{kdebug:}
+@vindex hash_summary_only @r{variable for debugging}
+@cindex hash table buckets, printing
+Debugging output from Kpathsea is always written to standard error, and
+begins with the string @samp{kdebug:}. (Except for hash table buckets,
+which just start with the number, but you can only get that output
+running under a debugger. See comments at the @code{hash_summary_only}
+variable in @file{kpathsea/db.c}.)
+
+
+@node Logging
+@subsection Logging
+
+@cindex log file
+
+@cindex logging successful searches
+@cindex recording successful searches
+@cindex usage patterns, finding
+@cindex disk usage, reducing
+Kpathsea can record the time and filename found for each successful
+search.  This may be useful in finding good candidates for deletion when
+your filesystem is full, or in discovering usage patterns
+at your site.
+
+@vindex TEXMFLOG
+To do this, define the environment or config file variable
+@code{TEXMFLOG}.  The value is the name of the file to append the
+information to.  The file is created if it doesn't exist, and appended
+to if it does.
+
+@cindex epoch, seconds since
+@findex time @r{system call}
+Each successful search turns into one line in the log file: two words
+separated by a space. The first word is the time of the search, as the
+integer number of seconds since ``the epoch'', i.e., UTC midnight 1
+January 1970 (more precisely, the result of the @code{time} system
+call). The second word is the filename.
+
+For example, after @code{setenv TEXMFLOG /tmp/log}, running Dvips on
+@file{story.dvi} appends the following lines:
+
+@example
+774455887 /usr/local/share/texmf/dvips/config.ps
+774455887 /usr/local/share/texmf/dvips/psfonts.map
+774455888 /usr/local/share/texmf/dvips/texc.pro
+774455888 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmbx10.600pk
+774455889 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmsl10.600pk
+774455889 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmr10.600pk
+774455889 /usr/local/share/texmf/dvips/texc.pro
+@end example
+
+@cindex privacy, semblance of
+@noindent Only filenames that are absolute are recorded, to preserve
+some semblance of privacy.
+
+
+@node Common problems
+@subsection Common problems
+
+@cindex common problems
+@cindex problems, common
+@cindex FAQ, Kpathsea
+
+Here are some common problems with configuration, compilation, linking,
+execution, @dots{}
+
+@menu
+* Unable to find files::        If your program can't find fonts (or whatever).
+* Slow path searching::         If it takes forever to find anything.
+* Unable to generate fonts::    If MakeTeXPK fails.
+* TeX or Metafont failing::     Likely compiler bugs.
+
+* XtStrings::                   When _XtStrings is undefined.
+* dlopen::                      When dlopen is undefined.
+* ShellWidgetClass::            For dynamic linking troubles under OpenWindows.
+* Pointer combination warnings::  For old compilers that don't grok char *.
+@end menu
+
+@node Unable to find files
+@subsubsection Unable to find files
+
+@cindex unable to find files
+@cindex files, unable to find
+
+If a program complains it cannot find fonts (or other input files), any
+of several things might be wrong.  In any case, you may find the
+debugging options helpful.  @xref{Debugging}.
+
+@itemize @bullet
+@item
+Perhaps you simply haven't installed all the necessary files; the basic
+fonts and input files are distributed separately from the programs.
+@xref{unixtex.ftp}.
+
+@item
+@flindex /etc/profile
+@cindex environment variables, old
+You have (perhaps unknowingly) told Kpathsea to use search paths that
+don't reflect where the files actually are.  One common cause is having
+environment variables set from a previous installation, thus overriding
+what you carefully set in @file{texmf.cnf} (@pxref{Supported file
+formats}).  System @file{/etc/profile} or other files such may be the
+culprit.
+
+@item
+@cindex symbolic links not found
+@cindex leaf directories wrongly guessed
+Your files reside in a directory that is only pointed to via a symbolic
+link, in a leaf directory and is not listed in @file{ls-R}.
+
+Unfortunately, Kpathsea's subdirectory searching has an irremediable
+deficiency: If a directory @var{d} being searched for subdirectories
+contains plain files and symbolic links to other directories, but no
+true subdirectories, @var{d} will be considered a leaf directory, i.e.,
+the symbolic links will not be followed.  @xref{Subdirectory expansion}.
+
+You can work around this problem by creating an empty dummy subdirectory
+in @var{d}. Then @var{d} will no longer be a leaf, and the symlinks will
+be followed.
+
+The directory immediately followed by the @samp{//} in the path
+specification, however, is always searched for subdirectories, even if
+it is a leaf.  Presumably you would not have asked for the directory to
+be searched for subdirectories if you didn't want it to be.
+
+@item
+If the fonts (or whatever) don't already exist, @code{MakeTeXPK} (or
+@code{MakeTeXMF} or @code{MakeTeXTFM}) will try to create them.  If
+these rather complicated shell scripts fail, you'll eventually get an
+error message saying something like @samp{Can't find font
+@var{fontname}}. The best solution is to fix (or at least report) the
+bug in @code{MakeTeXPK}; the workaround is to generate the necessary
+fonts by hand with Metafont, or to grab them from a CTAN site
+(@pxref{unixtex.ftp}).
+
+@item
+There is a bug in the library. @xref{Reporting bugs}.
+@end itemize
+
+
+@node Slow path searching
+@subsubsection Slow path searching
+
+@cindex excessive startup time
+@cindex slow startup time
+@cindex startup time, excessive
+
+If your program takes an excessively long time to find fonts or other
+input files, but does eventually succeed, here are some possible culprits:
+
+@itemize @bullet
+@item
+Most likely, you just have a lot of directories to search, and that
+takes a noticeable time. The solution is to create and maintain a
+separate @file{ls-R} file that lists all the files in your main @TeX{}
+hierarchy.  @xref{Filename database}.  Kpathsea always uses @file{ls-R}
+if it's present; there's no need to recompile or reconfigure any of the
+programs.
+
+@item
+Your recursively-searched directories (e.g.,
+@file{/usr/local/share/texmf/fonts//}), contain a mixture of files and
+directories. This prevents Kpathsea from using a useful optimization
+(@pxref{Subdirectory expansion}).
+
+It is best to have only directories (and perhaps a @file{README}) in the
+upper levels of the directory structure, and it's very important to have
+@emph{only} files, and no subdirectories, in the leaf directories where
+the dozens of TFM, PK, or whatever files reside.
+@end itemize
+
+In any case, you may find the debugging options helpful in determining
+precisely when the disk or network is being pounded.  @xref{Debugging}.
+
+
+@node Unable to generate fonts
+@subsubsection Unable to generate fonts
+
+@cindex unable to generate fonts
+@cindex font generation failures
+
+This can happen if either @code{MakeTeXPK} hasn't been installed
+properly, or if the local installation of Metafont isn't correct.
+
+@cindex Metafont installation
+If @code{mf} is a command not found by @code{MakeTeXPK}, then you need
+to install Metafont (@pxref{unixtex.ftp}).
+
+@cindex Metafont using the wrong resolution
+@cindex resolution, wrong
+If Metafont runs, but generates fonts at the wrong resolution, you need
+to be sure the @samp{M} and @samp{D} lines in your Dvips configuration
+file match (@pxref{Config files,,, dvips, Dvips}).  For example, if
+@code{MakeTeXPK} is generating 300@dmn{dpi} fonts, but you need
+600@dmn{dpi} fonts, you should have:
+@example
+M ljfour
+D 600
+@end example
+
+@flindex .2602gf
+@flindex 2602gf
+@cindex Metafont making too-large fonts
+@cindex proof mode
+@cindex online Metafont display, spurious
+If Metafont runs but generates fonts at a resolution of 2602@dmn{dpi}
+(and prints out the name of each character as well as just a character
+number, and maybe tries to display the characters), then your Metafont
+base file probably hasn't been made properly.  (It's using the default
+@code{proof} mode, instead of an actual device mode.)  To make a proper
+@file{plain.base}, assuming the local mode definitions are contained in
+a file @file{modes.mf}, run the following command (assuming Unix):
+
+@example
+inimf "plain; input modes; dump"
+@end example
+
+@noindent
+@flindex plain.base
+Then copy the @file{plain.base} file from the current directory to where
+the base files are stored on your system
+(@file{/usr/local/share/texmf/web2c} by default), and make a link
+(either hard or soft) from @file{plain.base} to @file{mf.base} in that
+directory.
+@xref{inimf invocation,,, web2c, Web2c}.
+
+
+@node TeX or Metafont failing
+@subsubsection @TeX{} or Metafont failing
+
+@cindex @TeX{} failures
+@cindex Metafont failures
+@cindex compiler bugs
+If @TeX{} or Metafont get a segmentation fault or otherwise fail while
+running a normal input file, the problem is usually a compiler bug
+(unlikely as that may sound).  Even if the trip and trap tests are
+passed, problems may lurk.  Optimization occasionally causes trouble in
+programs other than @TeX{} and Metafont themselves, too.
+
+Insufficient swap space may also cause core dumps or other erratic
+behavior.
+
+@cindex optimization caveat
+For a workaround, if you enabled any optimization flags, it's best to
+omit optimization entirely.  In any case, the way to find the facts is
+to run the program under the debugger and see where it's failing.
+
+@cindex GNU C compiler bugs
+@cindex system C compiler bugs
+Also, if you have trouble with a system C compiler, I advise trying the
+GNU C compiler. And vice versa, unfortunately; but in that case I also
+recommend reporting a bug to the GCC mailing list; @pxref{Bugs,,, gcc,
+Using and Porting GNU CC}.
+
+@cindex compiler bugs, finding
+To report compiler bugs effectively requires perseverance and
+perspicacity: you must find the miscompiled line, and that usually
+involves delving backwards in time from the point of error, checking
+through @TeX{}'s (or whatever program's) data structures.  Things are
+not helped by all-too-common bugs in the debugger itself.  Good luck.
+
+
+@ignore
+@node Empty Makefiles
+@subsubsection Empty Makefiles
+
+@cindex Makefiles, empty
+@pindex sed @r{error from @code{configure}}
+@pindex configure @r{error from @code{sed}}
+@cindex NetBSD @code{configure} error
+@cindex FreeBSD @code{configure} error
+@cindex Mach10 @code{configure} error
+@cindex AIX 4.1 @code{configure} error
+
+On some systems (NetBSD, FreeBSD, AIX 4.1, and Mach10), @code{configure}
+cannot properly create the Makefiles. Instead, you get an error
+something like this:
+
+@example
+prompt$ ./configure
+@dots{}
+creating Makefile
+sed: 1: "\\@@^ac_include make/pat ...": \ can not be used as a string delimiter
+@end example
+
+So far as I know, the bug here is in @code{/bin/sh} on these systems. I
+don't have access to a machine running any of them, so if someone can
+find a workaround that avoids the quoting bug, I'd be most
+grateful. (Search for @code{ac_include} in the @code{configure} script
+to get to the problematic code.)
+
+It should work to run @code{bash configure}, instead of using
+@code{/bin/sh}. You can get Bash from
+@url{ftp://prep.ai.mit.edu/pub/gnu} and mirrors.
+
+
+@node wchar_t
+@subsubsection @code{wchar_t}
+
+@vindex FOIL_X_WCHAR_T
+@tindex wchar_t
+
+The upshot of all the following is that if you get error messages
+regarding @code{wchar_t}, try defining @code{NO_FOIL_X_WCHAR_T} (for
+Web2c) or @code{FOIL_X_WCHAR_T} (for everything else), as in:
+
+@example
+make XCFLAGS=-DNO_FOIL_X_WCHAR_T @var{other-make-options}
+@end example
+
+@flindex Xlib.h
+@flindex stddef.h
+@code{wchar_t} has caused infinite trouble. None of my code ever uses
+@code{wchar_t}; all I want to do is include X header files and various
+system header files, possibly compiling with GCC. This seems an
+impossible task! The basic problem is that the X11 header
+@file{<Xlib.h>} and GCC's @file{<stddef.h>} have conflicting definitions
+for @code{wchar_t}.
+
+The particulars: @file{<X11/Xlib.h>} from MIT X11R5 defines
+@code{wchar_t} if @code{X_WCHAR} is defined, which is defined if
+@code{X_NOT_STDC_ENV} is defined, and we define @emph{that} if
+@code{STDC_HEADERS} is not defined (@samp{configure} decides if
+@code{STDC_HEADERS} gets defined).  But when compiling with GCC on SunOS
+4.1.x, @code{STDC_HEADERS} is not defined (@file{string.h} doesn't
+declare the @samp{mem}* functions), so we do get X's
+@code{wchar_t}---and we also get GCC's @code{wchar_t} from its
+@file{<stddef.h>}.  Conflict.
+
+On the other hand, SunOS 4.1.1 with some other X configurations actually
+needs GCC to define @code{wchar_t}, and fails otherwise.
+
+My current theory is to define @code{wchar_t} to a nonsense symbol
+before the X include files are read; that way its definition (if any)
+will be ignored by other system include files.  Going along with that,
+define @code{X_WCHAR} to tell X not to use @file{<stddef.h>}, that we've
+already included, but instead to make its own definition.
+
+But this is not the end of the story. The X11 include files distributed
+with DG/UX 5.4.2 for the Aviion have been modified to include
+@file{<_int_wchar_t.h>} if @code{X_WCHAR}, so our @code{#define} will
+not have any typedef to change---but the uses of @code{wchar_t} in the X
+include files will be changed to reference this undefined symbol. So
+there's nothing to foil in this case. I don't know how to detect this
+automatically, so it's up to you to define @code{NO_FOIL_X_WCHAR_T}
+yourself.
+@end ignore
+
+@node XtStrings
+@subsubsection @code{XtStrings}
+
+@findex XtStrings
+You may find that linking X programs results in an error from the linker
+that @samp{XtStrings} is undefined, something like this:
+
+@example
+gcc -o virmf @dots{}
+@dots{}/x11.c:130: undefined reference to `XtStrings'
+@end example
+
+This generally happens because of a mismatch between the X include files
+with which you compiled and the X libraries with which you linked;
+often, the include files are from MIT and the libraries from Sun.
+
+The solution is to use the same X distribution for compilation and
+linking.  Probably @samp{configure} was unable to guess the proper
+directories from your installation.  You can use the @code{configure}
+options @samp{--x-includes=@var{path}} and
+@samp{--x-libraries=@var{path}} to explicitly specify them.
+
+
+@node dlopen
+@subsubsection @code{dlopen}
+
+@cindex static linking and @code{dlsym}
+@flindex dlopen
+@flindex dlsym
+@flindex dlclose
+@flindex wcstombs
+@flindex libdl.a
+(This section adapted from the file @file{dlsym.c} in the X distribution.)
+
+The @code{Xlib} library uses the standard C function @code{wcstombs}.
+Under SunOS 4.1, @code{wcstombs} uses the @samp{dlsym} interface defined
+in @file{libdl.so}.  Unfortunately, the SunOS 4.1 distribution does not
+include a static @samp{libdl.a} library.
+
+As a result, if you try to link an X program statically under SunOS, you
+may get undefined references to @code{dlopen}, @code{dlsym}, and
+@code{dlclose}.  One workaround is to include these definitions
+when you link:
+
+@example
+void *dlopen() @{ return 0; @}
+void *dlsym()  @{ return 0; @}
+int dlclose()  @{ return -1; @}
+@end example
+
+@flindex dlsym.c
+@noindent These are contained in the @file{dlsym.c} file in the MIT X
+distribution.
+
+
+@node ShellWidgetClass
+@subsubsection @code{ShellWidgetClass}
+
+@cindex dynamic linking problems with OpenWin libraries
+@cindex OpenWin libraries, dynamic linking problems
+@findex get_wmShellWidgetClass
+@findex get_applicationShellWidgetClass
+
+@flindex comp.sys.sun.admin @r{FAQ}
+@cindex FAQ, @t{comp.sys.sun.admin}
+(This section adapted from the @t{comp.sys.sun.admin} FAQ.)
+
+If you are linking with Sun's OpenWindows libraries in SunOS 4.1.x, you
+may get undefined symbols @code{_get_wmShellWidgetClass} and
+@code{_get_applicationShellWidgetClass} when linking. This problem does
+not arise using the standard MIT X libraries under SunOS.
+
+@findex Xmu @r{library problems}
+The cause is bugs in the @code{Xmu} shared library as shipped from Sun.
+There are several fixes:
+
+@itemize @bullet
+
+@item Install the free MIT distribution from @samp{ftp.x.org} and mirrors.
+
+@item Get the OpenWindows patches listed below.
+
+@item Statically link the @code{Xmu} library into the executable.
+
+@item Avoid using @code{Xmu} at all. If you are compiling
+Metafont, @pxref{Online Metafont graphics,,, web2c, Web2c}. If you are
+compiling Xdvi, see the @code{-DNOTOOL} option in @file{xdvik/INSTALL}.
+
+@item Ignore the errors. The binary runs fine regardless.
+
+@end itemize
+
+@cindex Sun OpenWin patches
+@cindex patches, Sun OpenWin
+Here is the information for getting the two patches:
+
+@display
+Patch ID: 100512-02
+Bug ID's: 1086793, 1086912, 1074766
+Description: 4.1.x OpenWindows 3.0 @code{libXt} jumbo patch
+
+Patch ID: 100573-03
+Bug ID: 1087332
+Description: 4.1.x OpenWindows 3.0 undefined symbols when using shared @code{libXmu}.
+@end display
+
+@cindex static linking
+The way to statically link with @code{libXmu} depends on whether you are
+using a Sun compiler (e.g., @code{cc}) or @code{gcc}. If the latter,
+alter the @code{x_libs} Make variable to include
+
+@opindex -static
+@opindex -dynamic
+@example
+-static -lXmu -dynamic
+@end example
+
+@opindex -Bstatic
+@opindex -Bdynamic
+If you are using the Sun compiler, use @samp{-Bstatic} and @samp{-Bdynamic}.
+
+
+@node Pointer combination warnings
+@subsubsection Pointer combination warnings
+
+@cindex warnings, pointer combinations
+@cindex pointer combination warnings
+@cindex illegal pointer combination warnings
+@pindex cc @r{warnings}
+When compiling with old C compilers, you may get some warnings about
+``illegal pointer combinations''.  These are spurious; just ignore them.
+I decline to clutter up the source with casts to get rid of them.
+
+@c This isn't worth including any more, OSF 1.x is too old.
+@c The other XtInherit problem (R4 Xlib on Suns) should never come up,
+@c but the answer from the X faq is included anyway.
+@c
+@c @node XtInherit
+@c @subsubsection @code{XtInherit}
+@c 
+@c @findex XtInherit @r{bug on OSF/1}
+@c @cindex OSF/1 loader bug and @code{XtInherit}
+@c @cindex Alpha OSF/1 loader bug and @code{XtInherit}
+@c 
+@c On DEC OSF/1 1.x systems, the loader has a bug that manifests itself in
+@c the following error (all on one line, but for the sake of the paper
+@c width it's broken here):
+@c 
+@c @example
+@c xdvik/xdvi: /sbin/loader: Fatal Error: search_for_undefineds: 
+@c      symbol _XtInherit should not have any relocation entry
+@c @end example
+@c 
+@c @noindent According to Michael Rickabaugh @code{<mjr@@quarry.enet.dec.com>}:
+@c 
+@c @quotation
+@c This is a bug fixed in DEC OSF/1 2.0.
+@c 
+@c If you know how, installing @file{/sbin/loader} from a 2.0 system onto a
+@c 1.3 system will work.  Make sure that @file{/usr} is @emph{not} mounted
+@c when you do this.  (If you forget about umounting @code{/usr}, it is
+@c possible most of your filesystems will become corrupted.)
+@c 
+@c Otherwise, I suggest getting a later CD and running
+@c @file{/usr/sbin/installupdate}.
+@c @end quotation
+@c 
+@c Alternatively, you may be able to use the freely available X11 libraries
+@c that come with the MIT distribution (on @file{ftp.x.org}, for example).
+@c 
+@c Linking statically, perhaps only with some of the X libraries, may also
+@c work.
+@c 
+@c The Sun XtInherit weirdness, from the comp.windows.x FAQ:
+@c Subject: 126)! What are these problems with "*_XtInherit* not found" on the Sun?
+@c When I link a X program that I wrote on a SunOS 4.0.3 or 4.1 machine I get the 
+@c error "ld.so: symbol not found *_XtInherit*".
+@c 
+@c      What you are seeing is a side-effect of a kludge in the R4 libXt.a to 
+@c get Sun shared libraries working.  Apparently, you can't share a function that 
+@c is both called and compared, as *_XtInherit* is. This was handled by putting 
+@c *_XtInherit* in the same file as a function that is always used, thereby 
+@c guaranteeing that it would be loaded -- that is, in Initialize.c, where 
+@c XtToolkitInitialize() and XtInitialize() reside. These routines would normally
+@c be called.
+@c 
+@c      You are probably seeing this error because your program is not a normal
+@c Xt-based program and does not call XtToolkitInitialize() anywhere. 
+@c      1) it may be a program that uses Xt functions but never opens a 
+@c connection to the X server.  [OSF/Motif's 1.1.0 UIL had this problem; it called
+@c XtMalloc() and other Xt functions.] The solution is to add the call to your 
+@c program; the function does not have to be executed, just linked in.
+@c      2) alternatively, your program doesn't need any Xt functions and is
+@c correct in not calling XtToolkitInitialize() -- it may be an Xlib or XView 
+@c program. In this case, you can remove -lXt from your link command. 
+@c 
+@c      It should not be necessary to link the shared libraries statically,
+@c although this will certainly solve the problem.
+
+@c * Empty Makefiles::             If configure gives you sed errors.
+@c * wchar_t::                     For wchar_t difficulties.
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-auto.h
@@ -0,0 +1,106 @@
+/* c-auto.h.  Generated automatically by configure.  */
+/* c-auto.h.in.  Generated automatically from configure.in by autoheader.  */
+/* acconfig.h -- used by autoheader when generating c-auto.h.in.
+
+   If you're thinking of editing acconfig.h to fix a configuration
+   problem, don't. Edit the c-auto.h file created by configure,
+   instead.  Even better, fix configure to give the right answer.  */
+
+/* kpathsea/configure.in tests for these functions with
+   kb_AC_KLIBTOOL_REPLACE_FUNCS, and naturally Autoheader doesn't know
+   about that macro.  Since the shared library stuff is all preliminary
+   anyway, I decided not to change Autoheader, but rather to hack them
+   in here.  */
+#define HAVE_BASENAME 1
+#define HAVE_PUTENV 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRTOL 1
+#define HAVE_STRSTR 1
+
+
+/* Define if the closedir function returns void instead of int.  */
+/* #undef CLOSEDIR_VOID */
+
+/* Define to empty if the keyword does not work.  */
+/* #undef const */
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if your putenv doesn't waste space when the same environment
+   variable is assigned more than once, with different (malloced)
+   values.  This is true only on NetBSD/FreeBSD, as far as I know. See
+   xputenv.c.  */
+/* #undef SMART_PUTENV */
+
+/* Define if you are using GNU libc or otherwise have global variables
+   `program_invocation_name' and `program_invocation_short_name'.  */
+/* #undef HAVE_PROGRAM_INVOCATION_NAME */
+
+/* all: Define to enable running scripts when missing input files.  */
+#define MAKE_TEX_MF_BY_DEFAULT 1
+#define MAKE_TEX_PK_BY_DEFAULT 1
+#define MAKE_TEX_TEX_BY_DEFAULT 0
+#define MAKE_TEX_TFM_BY_DEFAULT 1
+#define MAKE_OMEGA_OFM_BY_DEFAULT 0
+#define MAKE_OMEGA_OCP_BY_DEFAULT 0
+
+/* Define if you have the basename function.  */
+#define HAVE_BASENAME 1
+
+/* Define if you have the bcopy function.  */
+#define HAVE_BCOPY 1
+
+/* Define if you have the getwd function.  */
+#define HAVE_GETWD 1
+
+/* Define if you have the putenv function.  */
+#define HAVE_PUTENV 1
+
+/* Define if you have the strcasecmp function.  */
+#define HAVE_STRCASECMP 1
+
+/* Define if you have the strstr function.  */
+#define HAVE_STRSTR 1
+
+/* Define if you have the strtol function.  */
+#define HAVE_STRTOL 1
+
+/* Define if you have the <assert.h> header file.  */
+#define HAVE_ASSERT_H 1
+
+/* Define if you have the <dirent.h> header file.  */
+#define HAVE_DIRENT_H 1
+
+/* Define if you have the <float.h> header file.  */
+#define HAVE_FLOAT_H 1
+
+/* Define if you have the <limits.h> header file.  */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <memory.h> header file.  */
+#define HAVE_MEMORY_H 1
+
+/* Define if you have the <ndir.h> header file.  */
+/* #undef HAVE_NDIR_H */
+
+/* Define if you have the <pwd.h> header file.  */
+#define HAVE_PWD_H 1
+
+/* Define if you have the <stdlib.h> header file.  */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the <string.h> header file.  */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <sys/dir.h> header file.  */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/ndir.h> header file.  */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define if you have the <sys/param.h> header file.  */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define if you have the <unistd.h> header file.  */
+#define HAVE_UNISTD_H 1
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-auto.h.in
@@ -0,0 +1,105 @@
+/* c-auto.h.in.  Generated automatically from configure.in by autoheader.  */
+/* acconfig.h -- used by autoheader when generating c-auto.h.in.
+
+   If you're thinking of editing acconfig.h to fix a configuration
+   problem, don't. Edit the c-auto.h file created by configure,
+   instead.  Even better, fix configure to give the right answer.  */
+
+/* kpathsea/configure.in tests for these functions with
+   kb_AC_KLIBTOOL_REPLACE_FUNCS, and naturally Autoheader doesn't know
+   about that macro.  Since the shared library stuff is all preliminary
+   anyway, I decided not to change Autoheader, but rather to hack them
+   in here.  */
+#undef HAVE_BASENAME
+#undef HAVE_PUTENV
+#undef HAVE_STRCASECMP
+#undef HAVE_STRTOL
+#undef HAVE_STRSTR
+
+
+/* Define if the closedir function returns void instead of int.  */
+#undef CLOSEDIR_VOID
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define if your putenv doesn't waste space when the same environment
+   variable is assigned more than once, with different (malloced)
+   values.  This is true only on NetBSD/FreeBSD, as far as I know. See
+   xputenv.c.  */
+#undef SMART_PUTENV
+
+/* Define if you are using GNU libc or otherwise have global variables
+   `program_invocation_name' and `program_invocation_short_name'.  */
+#undef HAVE_PROGRAM_INVOCATION_NAME
+
+/* all: Define to enable running scripts when missing input files.  */
+#define MAKE_TEX_MF_BY_DEFAULT 0
+#define MAKE_TEX_PK_BY_DEFAULT 0
+#define MAKE_TEX_TEX_BY_DEFAULT 0
+#define MAKE_TEX_TFM_BY_DEFAULT 0
+#define MAKE_OMEGA_OFM_BY_DEFAULT 0
+#define MAKE_OMEGA_OCP_BY_DEFAULT 0
+
+/* Define if you have the basename function.  */
+#undef HAVE_BASENAME
+
+/* Define if you have the bcopy function.  */
+#undef HAVE_BCOPY
+
+/* Define if you have the getwd function.  */
+#undef HAVE_GETWD
+
+/* Define if you have the putenv function.  */
+#undef HAVE_PUTENV
+
+/* Define if you have the strcasecmp function.  */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the strstr function.  */
+#undef HAVE_STRSTR
+
+/* Define if you have the strtol function.  */
+#undef HAVE_STRTOL
+
+/* Define if you have the <assert.h> header file.  */
+#undef HAVE_ASSERT_H
+
+/* Define if you have the <dirent.h> header file.  */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <float.h> header file.  */
+#undef HAVE_FLOAT_H
+
+/* Define if you have the <limits.h> header file.  */
+#undef HAVE_LIMITS_H
+
+/* Define if you have the <memory.h> header file.  */
+#undef HAVE_MEMORY_H
+
+/* Define if you have the <ndir.h> header file.  */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <pwd.h> header file.  */
+#undef HAVE_PWD_H
+
+/* Define if you have the <stdlib.h> header file.  */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <sys/dir.h> header file.  */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/ndir.h> header file.  */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/param.h> header file.  */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-ctype.h
@@ -0,0 +1,81 @@
+/* c-ctype.h: ASCII-safe versions of the <ctype.h> macros.
+
+Copyright (C) 1992 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_CTYPE_H
+#define KPATHSEA_C_CTYPE_H
+
+#include <ctype.h>
+
+/* Be sure we have `isascii'.  */
+#ifndef isascii
+#define isascii(c) 1
+#endif
+
+#define ISALNUM(c) (isascii (c) && isalnum(c))
+#define ISALPHA(c) (isascii (c) && isalpha(c))
+#define ISASCII isascii
+#define ISCNTRL(c) (isascii (c) && iscntrl(c))
+#define ISDIGIT(c) (isascii (c) && isdigit (c))
+#define ISGRAPH(c) (isascii (c) && isgraph(c))
+#define ISLOWER(c) (isascii (c) && islower(c))
+#define ISPRINT(c) (isascii (c) && isprint(c))
+#define ISPUNCT(c) (isascii (c) && ispunct(c))
+#define ISSPACE(c) (isascii (c) && isspace(c))
+#define ISUPPER(c) (isascii (c) && isupper(c))
+#define ISXDIGIT(c) (isascii (c) && isxdigit(c))
+#define TOASCII toascii
+#define TOLOWER(c) (ISUPPER (c) ? tolower (c) : (c))
+#define TOUPPER(c) (ISLOWER (c) ? toupper (c) : (c))
+
+/* This isn't part of the usual <ctype.h>, but it's useful sometimes.  */
+#ifndef isblank
+#define isblank(c) ((c) == ' ' || (c) == '\t')
+#endif
+
+
+/* Here's why this mess is necessary:
+
+From: meyering@cs.utexas.edu (Jim Meyering)
+Date: Wed, 25 Nov 1992 09:52:33 -0600
+Subject: ss-921123: using isascii with <ctype.h> macros
+
+  Yesterday some cursory regression testing found that GNU od
+  (in an upcoming release of textutils) generated incorrect output
+  when run on an SGI indigo because isprint ('\377') returned true.
+  Of course, '\377' is not a printing character;  the problem lay
+  in using isprint without first making sure its integer argument
+  corresponded to an ascii code.
+
+  MORAL: always guard uses of ctype macros with isascii if it's available.
+  An obvious alternative is to avoid <ctype.h> and define and use your
+  own versions of the ctype macros.
+
+  A pretty clean approach to using <ctype.h> and isascii was
+  suggested by David MacKenzie:
+
+  #ifndef isascii
+  #define isascii(c) 1
+  #endif
+
+  #define ISDIGIT(c) (isascii (c) && isdigit (c))
+  #define ISPRINT(c) (isascii (c) && isprint (c))
+  ...
+
+  then, use ISDIGIT, etc. instead of isdigit, etc.  */
+  
+#endif /* not KPATHSEA_C_CTYPE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-dir.h
@@ -0,0 +1,44 @@
+/* c-dir.h: directory headers.
+
+Copyright (C) 1992, 93, 94 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_DIR_H
+#define KPATHSEA_C_DIR_H
+
+/* Use struct dirent instead of struct direct.  */
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#define NAMLEN(dirent) strlen ((dirent)->d_name)
+#else /* not DIRENT */
+#define dirent direct
+#define NAMLEN(dirent) ((dirent)->d_namlen)
+
+#ifdef HAVE_SYS_NDIR_H
+#include <sys/ndir.h>
+#endif
+
+#ifdef HAVE_SYS_DIR_H
+#include <sys/dir.h>
+#endif
+
+#ifdef HAVE_NDIR_H
+#include <ndir.h>
+#endif
+
+#endif /* not DIRENT */
+
+#endif /* not KPATHSEA_C_DIR_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-errno.h
@@ -0,0 +1,27 @@
+/* c-errno.h: <errno.h> and the errno variable.
+
+Copyright (C) 1992 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_ERRNO_H
+#define KPATHSEA_C_ERRNO_H
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#endif /* not KPATHSEA_C_ERRNO_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-fopen.h
@@ -0,0 +1,65 @@
+/* c-fopen.h: how to open files with fopen.
+
+Copyright (C) 1992, 94, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef C_FOPEN_H
+#define C_FOPEN_H
+
+/* How to open a text file:  */
+#ifndef FOPEN_A_MODE
+#define FOPEN_A_MODE "a"
+#endif
+
+#ifndef FOPEN_R_MODE
+#define FOPEN_R_MODE "r"
+#endif
+
+#ifndef FOPEN_W_MODE
+#define FOPEN_W_MODE "w"
+#endif
+
+/* How to open a binary file for reading:  */
+#ifndef FOPEN_RBIN_MODE
+#ifdef DOS
+#define FOPEN_RBIN_MODE "r+b"
+#else
+#if defined (VMS) || defined (VMCMS) || defined (OS2) || defined (WIN32)
+#define	FOPEN_RBIN_MODE	"rb"
+#else
+#define	FOPEN_RBIN_MODE	"r"
+#endif /* not (VM/CMS or VMS or OS2 or WIN32) */
+#endif /* not DOS */
+#endif /* not FOPEN_RBIN_MODE */
+
+/* How to open a binary file for writing:  */
+#ifndef FOPEN_WBIN_MODE
+#ifdef DOS
+#define FOPEN_WBIN_MODE "w+b"
+#else
+#if defined (OS2) || defined (WIN32)
+#define FOPEN_WBIN_MODE "wb"
+#else
+#ifdef VMCMS
+#define FOPEN_WBIN_MODE "wb, lrecl=1024, recfm=f"
+#else
+#define	FOPEN_WBIN_MODE	"w"
+#endif /* not VM/CMS */
+#endif /* not (OS2 or WIN32) */
+#endif /* not DOS */
+#endif /* not FOPEN_WBIN_MODE */
+
+#endif /* not C_FOPEN_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-limits.h
@@ -0,0 +1,36 @@
+/* c-limits.h: include the system parameter file.
+
+Copyright (C) 1992, 93, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef C_LIMITS_H
+#define C_LIMITS_H
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#else
+#include <kpathsea/systypes.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#endif /* not HAVE_LIMITS_H */
+
+/* Some systems may have the floating-point limits in the above.  */
+#if defined (HAVE_FLOAT_H) && !defined (FLT_MAX)
+#include <float.h>
+#endif
+
+#endif /* not C_LIMITS_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-memstr.h
@@ -0,0 +1,82 @@
+/* c-memstr.h: memcpy, strchr, etc.
+
+Copyright (C) 1992, 93, 94, 95, 97 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_MEMSTR_H
+#define KPATHSEA_C_MEMSTR_H
+
+/* <X11/Xfuncs.h> tries to declare bcopy etc., which can only conflict.  */
+#define _XFUNCS_H_
+
+/* Just to be complete, we make both the system V/ANSI and the BSD
+   versions of the string functions available.  */
+#if defined (STDC_HEADERS) || defined (HAVE_STRING_H)
+#if 0 /* OK, we'll try without; seems to be unnecessary now.  */
+#define SYSV /* so <X11/Xos.h> knows not to include <strings.h> */
+#endif /* 0 */
+#include <string.h>
+
+/* An ANSI string.h and pre-ANSI memory.h might conflict.  */
+#if !defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
+#include <memory.h>
+#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
+
+/* Do not define these if we are not STDC_HEADERS, because in that
+   case X11/Xos.h defines `strchr' to be `index'. */
+#ifdef STDC_HEADERS
+/* Let's hope that if index/rindex are defined, they're defined to the
+   right thing.  */
+#ifndef index
+#define index strchr
+#endif
+#ifndef rindex
+#define rindex strrchr
+#endif
+#endif /* STDC_HEADERS */
+
+#ifndef HAVE_BCOPY
+#ifndef bcmp
+#define bcmp(s1, s2, len) memcmp ((s1), (s2), (len))
+#endif
+#ifndef bcopy
+#define bcopy(from, to, len) memcpy ((to), (from), (len))
+#endif
+#ifndef bzero
+#define bzero(s, len) memset ((s), 0, (len))
+#endif
+#endif /* not HAVE_BCOPY */
+
+#else /* not (STDC_HEADERS or HAVE_STRING_H) */
+
+#include <strings.h>
+
+#ifndef strchr
+#define strchr index
+#endif
+#ifndef strrchr
+#define strrchr rindex
+#endif
+
+#define memcmp(s1, s2, n) bcmp ((s1), (s2), (n))
+#define memcpy(to, from, len) bcopy ((from), (to), (len))
+
+extern char *strtok ();
+extern char *strstr ();
+
+#endif /* not (STDC_HEADERS or HAVE_STRING_H) */
+
+#endif /* not KPATHSEA_C_MEMSTR_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-minmax.h
@@ -0,0 +1,84 @@
+/* c-minmax.h: define INT_MIN, etc.  Assume a 32-bit machine if the
+   values aren't defined.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_MINMAX_H
+#define KPATHSEA_C_MINMAX_H
+
+#include <kpathsea/c-limits.h>
+
+/* Declared in <limits.h> on ANSI C systems.  If the system doesn't
+   define it, we use the minimum ANSI values -- except for `int'; we
+   assume 32-bit integers.  */
+
+#ifndef SCHAR_MIN
+#define SCHAR_MIN (-127)
+#endif
+#ifndef SCHAR_MAX
+#define SCHAR_MAX 128
+#endif
+#ifndef UCHAR_MAX
+#define UCHAR_MAX 255
+#endif
+
+#ifndef SHRT_MIN
+#define SHRT_MIN (-32767)
+#endif
+#ifndef SHRT_MAX
+#define SHRT_MAX 32767
+#endif
+#ifndef USHRT_MAX
+#define USHRT_MAX 65535
+#endif
+
+#ifndef INT_MIN
+#define INT_MIN (-2147483647)
+#endif
+#ifndef INT_MAX
+#define INT_MAX 2147483647
+#endif
+#ifndef UINT_MAX
+#define UINT_MAX 4294967295
+#endif
+
+#ifndef LONG_MIN
+#define LONG_MIN INT_MIN
+#endif
+#ifndef LONG_MAX
+#define LONG_MAX INT_MAX
+#endif
+#ifndef ULONG_MAX
+#define ULONG_MAX UINT_MAX
+#endif
+
+/* Declared in <float.h> on ANSI C systems.  */
+#ifndef DBL_MIN
+#define DBL_MIN 1e-37
+#endif
+#ifndef DBL_MAX
+#define DBL_MAX 1e+37
+#endif
+
+#ifndef FLT_MIN
+#define FLT_MIN 1e-37
+#endif
+#ifndef FLT_MAX
+#define FLT_MAX 1e+37
+#endif
+
+#endif /* not KPATHSEA_C_MINMAX_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-namemx.h
@@ -0,0 +1,36 @@
+/* c-namemx.h: define NAME_MAX, the maximum length of a single
+   component in a filename.  No such limit may exist, or may vary
+   depending on the filesystem.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_NAME_MX_H
+#define KPATHSEA_C_NAME_MX_H
+
+#include <kpathsea/c-limits.h>
+
+/* Most likely the system will truncate filenames if it is not POSIX,
+   and so we can use the BSD value here.  */
+#ifndef _POSIX_NAME_MAX
+#define _POSIX_NAME_MAX 255
+#endif
+
+#ifndef NAME_MAX
+#define NAME_MAX _POSIX_NAME_MAX
+#endif
+
+#endif /* not KPATHSEA_C_NAME_MX_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-pathch.h
@@ -0,0 +1,101 @@
+/* c-pathch.h: define the characters which separate components of
+   filenames and environment variable paths.
+
+Copyright (C) 1992, 93, 95, 97 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef C_PATHCH_H
+#define C_PATHCH_H
+
+#include <kpathsea/c-ctype.h>
+
+/* What separates filename components?  */
+#ifndef DIR_SEP
+#ifdef VMS
+#define DIR_SEP ':'
+#define DIR_SEP_STRING ":"
+#else
+#ifdef DOSISH
+/* Either \'s or 's work.  Wayne Sullivan's web2pc prefers /, so we'll
+   go with that.  */
+#define DIR_SEP '/'
+#define DIR_SEP_STRING "/"
+#define IS_DEVICE_SEP(ch) ((ch) == ':')
+#define NAME_BEGINS_WITH_DEVICE(name) \
+  (ISALPHA(*(name)) && IS_DEVICE_SEP((name)[1]))
+/* On DOS, it's good to allow both \ and / between directories.  */
+#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
+#else
+#ifdef AMIGA
+#define DIR_SEP '/'
+#define DIR_SEP_STRING "/"
+#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == ':')
+#define IS_DEVICE_SEP(ch) ((ch) == ':')
+#else
+#ifdef VMCMS
+#define DIR_SEP ' '
+#define DIR_SEP_STRING " "
+#else
+#define DIR_SEP '/'
+#define DIR_SEP_STRING "/"
+#endif /* not VM/CMS */
+#endif /* not AMIGA */
+#endif /* not DOSISH */
+#endif /* not VMS */
+#endif /* not DIR_SEP */
+
+#ifndef IS_DIR_SEP
+#define IS_DIR_SEP(ch) ((ch) == DIR_SEP)
+#endif
+#ifndef IS_DEVICE_SEP /* No `devices' on, e.g., Unix.  */
+#define IS_DEVICE_SEP(ch) 0 
+#endif
+#ifndef NAME_BEGINS_WITH_DEVICE
+#define NAME_BEGINS_WITH_DEVICE(name) 0 
+#endif
+
+
+/* What separates elements in environment variable path lists?  */
+#ifndef ENV_SEP
+#ifdef VMS
+#define ENV_SEP ','
+#define ENV_SEP_STRING ","
+#else
+#ifdef DOSISH
+#define ENV_SEP ';'
+#define ENV_SEP_STRING ";"
+#else
+#ifdef AMIGA
+#define ENV_SEP ';'
+#define ENV_SEP_STRING ";"
+#else
+#ifdef VMCMS
+#define ENV_SEP ' '
+#define ENV_SEP_STRING " "
+#else
+#define ENV_SEP ':'
+#define ENV_SEP_STRING ":"
+#endif /* not VM/CMS */
+#endif /* not AMIGA */
+#endif /* not DOS */
+#endif /* not VMS */
+#endif /* not ENV_SEP */
+
+#ifndef IS_ENV_SEP
+#define IS_ENV_SEP(ch) ((ch) == ENV_SEP)
+#endif
+
+#endif /* not C_PATHCH_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-pathmx.h
@@ -0,0 +1,42 @@
+/* c-pathmx.h: define PATH_MAX, the maximum length of a filename.
+   Since no such limit may exist, it's preferable to dynamically grow
+   filenames as needed.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_PATH_MX_H
+#define KPATHSEA_C_PATH_MX_H
+
+#include <kpathsea/c-limits.h>
+
+/* Cheat and define this as a manifest constant no matter what, instead
+   of using pathconf.  I forget why we want to do this.  */
+
+#ifndef _POSIX_PATH_MAX
+#define _POSIX_PATH_MAX 255
+#endif
+
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX _POSIX_PATH_MAX
+#endif
+#endif /* not PATH_MAX */
+
+
+#endif /* not KPATHSEA_C_PATH_MAX_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-proto.h
@@ -0,0 +1,76 @@
+/* c-proto.h: macros to include or discard prototypes.
+
+Copyright (C) 1992, 93, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_PROTO_H
+#define KPATHSEA_C_PROTO_H
+
+#if !defined(WIN32) || (defined(_DLL) && !defined(_IMPORT))
+#define DllImport
+#else
+#define DllImport __declspec(dllimport)
+#endif
+
+/* 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 P2H(p1,p2) (p1, p2)
+#define P3H(p1,p2,p3) (p1, p2, p3)
+#define P4H(p1,p2,p3,p4) (p1, p2, p3, p4)
+#define P5H(p1,p2,p3,p4,p5) (p1, p2, p3, p4, p5)
+#define P6H(p1,p2,p3,p4,p5,p6) (p1, p2, p3, p4, p5, p6)
+
+#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)
+
+#else /* not __STDC__ */
+
+#define AA(args) ()
+
+#define P1H(p1) ()
+#define P2H(p1, p2) ()
+#define P3H(p1, p2, p3) ()
+#define P4H(p1, p2, p3, p4) ()
+#define P5H(p1, p2, p3, p4, p5) ()
+#define P6H(p1, p2, p3, p4, p5, p6) ()
+
+#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;
+
+#endif /* not __STDC__ */
+
+#endif /* not KPATHSEA_C_PROTO_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-stat.h
@@ -0,0 +1,61 @@
+/* c-stat.h: declarations for using stat(2).
+
+Copyright (C) 1993, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_STAT_H
+#define KPATHSEA_STAT_H
+
+#include <kpathsea/systypes.h>
+#include <sys/stat.h>
+
+#ifdef WIN32
+#include <io.h>
+#define stat _stat
+#endif /* WIN32 */
+
+/* POSIX predicates for testing file attributes.  */
+
+#if !defined (S_ISBLK) && defined (S_IFBLK)
+#define	S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#endif
+#if !defined (S_ISCHR) && defined (S_IFCHR)
+#define	S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#endif
+#if !defined (S_ISDIR) && defined (S_IFDIR)
+#define	S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+#if !defined (S_ISREG) && defined (S_IFREG)
+#define	S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#endif
+#if !defined (S_ISFIFO) && defined (S_IFIFO)
+#define	S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#endif
+#if !defined (S_ISLNK) && defined (S_IFLNK)
+#define	S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#endif
+#if !defined (S_ISSOCK) && defined (S_IFSOCK)
+#define	S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+#endif
+#if !defined (S_ISMPB) && defined (S_IFMPB) /* V7 */
+#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
+#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
+#endif
+#if !defined (S_ISNWK) && defined (S_IFNWK) /* HP/UX */
+#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
+#endif
+
+#endif /* not KPATHSEA_STAT_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-std.h
@@ -0,0 +1,98 @@
+/* c-std.h: the first header files.
+
+Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_STD_H
+#define KPATHSEA_C_STD_H
+
+/* Header files that essentially all of our sources need, and
+   that all implementations have.  We include these first, to help with
+   NULL being defined multiple times.  */
+#include <math.h>
+#include <stdio.h>
+
+/* Be sure we have constants from <unistd.h>.  */
+#include <kpathsea/c-unistd.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+/* Include <stdlib.h> before <stddef.h>, to help avoid NULL
+   redefinitions on some systems.  (We don't include <stddef.h>
+   ourselves any more, but FYI.)  */
+#else
+/* It's impossible to say for sure what the system will deign to put in
+   <stdlib.h>, but let's hope it's at least this.  */
+extern char *getenv ();
+#endif /* not HAVE_STDLIB_H */
+
+#ifdef WIN32
+#include <malloc.h>
+#else
+#ifndef STDC_HEADERS
+#ifndef ALLOC_RETURN_TYPE
+#ifdef DOSISH
+#define ALLOC_RETURN_TYPE void
+#else
+#define ALLOC_RETURN_TYPE char
+#endif /* not DOSISH */
+#endif /* not ALLOC_RETURN_TYPE */
+extern ALLOC_RETURN_TYPE *calloc (), *malloc (), *realloc ();
+#endif /* not STDC_HEADERS */
+#endif /* not WIN32 */
+
+/* SunOS 4.1.1 gets STDC_HEADERS defined, but it doesn't provide
+   EXIT_FAILURE.  So far no system has defined one of EXIT_FAILURE and
+   EXIT_SUCCESS without the other.  */
+#ifndef EXIT_SUCCESS
+#ifdef VMS
+#define EXIT_SUCCESS 1
+#define EXIT_FAILURE 0
+#else
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+#endif
+#endif /* not EXIT_SUCCESS */
+
+/* strchr vs. index, memcpy vs. bcopy, etc.  */
+#include <kpathsea/c-memstr.h>
+
+/* Error numbers and errno declaration.  */
+#include <kpathsea/c-errno.h>
+
+/* Numeric minima and maxima.  */
+#include <kpathsea/c-minmax.h>
+
+/* Assertions are too useful to not make generally available.  */
+#ifdef HAVE_ASSERT_H
+#include <assert.h>
+#else
+#define assert(expr) /* as nothing */
+#endif
+
+#ifdef VMS
+#include <unixlib.h>
+#include <unixio.h>
+#else
+#ifndef WIN32
+/* `popen' and `pclose' are part of POSIX.2, not POSIX.1.  So
+   STDC_HEADERS isn't enough.  */
+extern FILE *popen ();
+extern int pclose ();
+#endif /* not WIN32 */
+#endif /* not VMS */
+
+#endif /* not KPATHSEA_C_STD_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-unistd.h
@@ -0,0 +1,53 @@
+/* c-unistd.h: ensure we have constants from <unistd.h>.  Included from
+   c-std.h.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_C_UNISTD_H
+#define KPATHSEA_C_UNISTD_H
+
+/* <unistd.h> is allowed to depend on <sys/types.h>.  */
+#include <kpathsea/systypes.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <kpathsea/c-std.h>
+
+/* For fseek.  */
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+#endif /* not SEEK_SET */
+
+/* For access.  */
+#ifndef F_OK
+#define F_OK 0
+#define X_OK 1
+#define W_OK 2
+#define R_OK 4
+#endif /* not F_OK */
+
+#ifndef STDIN_FILENO
+#define STDIN_FILENO    0
+#define STDOUT_FILENO   1
+#define STDERR_FILENO   2
+#endif /* not STDIN_FILENO */
+
+#endif /* not KPATHSEA_C_UNISTD_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/c-vararg.h
@@ -0,0 +1,61 @@
+/* c-vararg.h: Top layer for stdarg and varargs.
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef C_VARARG_H
+#define C_VARARG_H
+
+/* See `kpathsea/init-path.c' for an example of use.  The idea is to say
+   PVAR1(type1, parameter1, ap) in the function header, and then end
+   the function with two }}'s.  We do this to avoid having to specify
+   the argument list (with types) twice -- once in the function header,
+   and once in a (hypothetical) VA_START1.  */
+
+#if __STDC__
+#include <stdarg.h>
+
+#define PVAR1H(p1) (p1, ...)
+#define PVAR2H(p1, p2) (p1, p2, ...)
+#define PVAR3H(p1, p2, p3) (p1, p2, p3, ...)
+
+#define PVAR1C(t1, n1,  ap) \
+  (t1 n1, ...) { va_list ap; va_start (ap, n1);
+#define PVAR2C(t1, n1,  t2, n2,  ap) \
+  (t1 n1, t2 n2, ...) { va_list ap; va_start (ap, n2);
+#define PVAR3C(t1, n1,  t2, n2,  t3, n3,  ap) \
+  (t1 n1, t2 n2, t3 n3, ...) { va_list ap; va_start (ap, n3);
+
+#else /* not __STDC__ */
+#include <varargs.h>
+
+#define PVAR1H(p1) ()
+#define PVAR2H(p1, p2) ()
+#define PVAR3H(p1, p2, p3) ()
+
+#define PVAR1C(t1, n1,  ap) \
+  (va_alist) va_dcl { t1 n1; va_list ap; va_start (ap); \
+                      n1 = va_arg (ap, t1);
+#define PVAR2C(t1, n1,  t2, n2,  ap) \
+  (va_alist) va_dcl { t1 n1; t2 n2; va_list ap; va_start (ap); \
+                      n1 = va_arg (ap, t1); n2 = va_arg (ap, t2);
+#define PVAR3C(t1, n1,  t2, n2,  t3, n3,  ap) \
+  (va_alist) va_dcl { t1 n1; t2 n2; t3 n3; va_list ap; va_start (ap); \
+                      n1 = va_arg (ap, t1); n2 = va_arg (ap, t2); \
+                      n3 = va_arg (ap, t3);
+#endif /* not __STDC__ */
+
+#endif /* not C_VARARG_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/cnf.c
@@ -0,0 +1,261 @@
+/* cnf.c: read config files.
+
+Copyright (C) 1994, 95, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/cnf.h>
+#include <kpathsea/db.h>
+#include <kpathsea/hash.h>
+#include <kpathsea/line.h>
+#include <kpathsea/paths.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/progname.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/variable.h>
+
+/* By using our own hash table, instead of the environment, we
+   complicate variable expansion (because we have to look in two
+   places), but we don't bang so much on the system.  DOS and System V
+   have very limited environment space.  Also, this way
+   `kpse_init_format' can distinguish between values originating from
+   the cnf file and ones from environment variables, which can be useful
+   for users trying to figure out what's going on.  */
+static hash_table_type cnf_hash;
+#define CNF_HASH_SIZE 751
+#define CNF_NAME "texmf.cnf"
+
+/* Do a single line in a cnf file: if it's blank or a comment, skip it.
+   Otherwise, parse <variable>[.<program>] [=] <value>.  Do
+   this even if the <variable> is already set in the environment, since
+   the envvalue might contain a trailing :, in which case we'll be
+   looking for the cnf value.  */
+
+static void
+do_line P1C(string, line)
+{
+  unsigned len;
+  string start;
+  string value, var;
+  string prog = NULL;
+  
+  /* Skip leading whitespace.  */
+  while (ISSPACE (*line))
+    line++;
+  
+  /* More to do only if we have non-comment material left.  */
+  if (*line == 0 || *line == '%' || *line == '#')
+    return;
+  
+  /* The variable name is everything up to the next space or = or `.'.  */
+  start = line;
+  while (!ISSPACE (*line) && *line != '=' && *line != '.')
+    line++;
+
+  /* `line' is now one character past the end of the variable name.  */
+  len = line - start;
+  var = xmalloc (len + 1);
+  strncpy (var, start, len);
+  var[len] = 0;
+  
+  /* If the variable is qualified with a program name, we might be
+     ignoring it.  */
+  while (ISSPACE (*line))
+    line++;
+  if (*line == '.') {
+    /* Skip spaces, then everything up to the next space or =.  */
+    line++;
+    while (ISSPACE (*line))
+      line++;
+    start = line;
+    while (!ISSPACE (*line) && *line != '=')
+      line++;
+
+    /* It's annoying to repeat all this, but making a tokenizing
+       subroutine would be just as long and annoying.  */
+    len = line - start;
+    prog = xmalloc (len + 1);
+    strncpy (prog, start, len);
+    prog[len] = 0;
+
+    /* If we are running `prog', fine; otherwise, we're done.  */
+    assert (program_invocation_short_name);
+    if (!FILESTRCASEEQ (prog, program_invocation_short_name)) {
+      free (prog);
+      free (var);
+      return;
+    }
+  }
+
+  /* Skip whitespace, an optional =, more whitespace.  */
+  while (ISSPACE (*line))
+    line++;
+  if (*line == '=') {
+    line++;
+    while (ISSPACE (*line))
+      line++;
+  }
+  
+  /* The value is whatever remains.  Remove trailing whitespace.  */
+  start = line;
+  len = strlen (start);
+  while (ISSPACE (start[len - 1]) && len > 0)
+    len--;
+  
+  value = xmalloc (len + 1);
+  strncpy (value, start, len);
+  value[len] = 0;
+
+  /* Suppose we want to write a single texmf.cnf that can be used under
+     both NT and Unix.  This is feasible except for the path separators
+     : on Unix, ; on NT.  We can't switch NT to allowing :'s, since :
+     is the drive separator.  So we switch Unix to allowing ;'s.  On the
+     other hand, we don't want to change IS_ENV_SEP and all the rest.
+     
+     So, simply translate all ;'s in the path
+     values to :'s if we are a Unix binary.  (Fortunately we don't use ;
+     in other kinds of texmf.cnf values.)
+     
+     If you really want to put ; in your filenames, add
+     -DALLOW_SEMICOLON_IN_FILENAMES.  (And there's no way to get :'s in
+     your filenames, sorry.)  */
+     
+/* gcc -ansi doesn't predefine `unix', since ANSI forbids it.  And AIX
+   generally doesn't predefine unix, who knows why.  */
+#ifndef unix
+#if defined (__unix__) || defined (_AIX)
+#define unix
+#endif
+#endif
+
+#if !defined (ALLOW_SEMICOLON_IN_FILENAMES) && defined (unix) 
+  {
+    string loc;
+    for (loc = value; *loc; loc++) {
+      if (*loc == ';')
+        *loc = ':';
+    }
+  }
+#endif
+
+  /* We want TEXINPUTS.prog to override plain TEXINPUTS.  The simplest
+     way is to put both in the hash table (so we don't have to write
+     hash_delete and hash_replace, and keep track of values' sources),
+     and then look up the .prog version first in `kpse_cnf_get'.  */
+  if (prog) {
+    string lhs = concat3 (var, ".", prog);
+    free (var);
+    free (prog);
+    var = lhs;
+  }
+  hash_insert (&cnf_hash, var, value);
+  
+  /* We could check that anything remaining is preceded by a comment
+     character, but let's not bother.  */
+}
+
+/* Read all the configuration files in the path.  */
+
+static void
+read_all_cnf P1H(void)
+{
+  string *cnf_files;
+  const_string cnf_path = kpse_init_format (kpse_cnf_format);
+
+  cnf_hash = hash_create (CNF_HASH_SIZE);
+
+  for (cnf_files = kpse_all_path_search (cnf_path, CNF_NAME);
+       cnf_files && *cnf_files; cnf_files++) {
+    string line;
+    string cnf_filename = *cnf_files;
+    FILE *cnf_file = xfopen (cnf_filename, FOPEN_R_MODE);
+
+    while ((line = read_line (cnf_file)) != NULL) {
+      unsigned len = strlen (line);
+      /* Concatenate consecutive lines that end with \.  */
+      while (len > 0 && line[len - 1] == '\\') {
+        string next_line = read_line (cnf_file);
+        line[len - 1] = 0;
+        if (!next_line) {
+          WARNING1 ("%s: Last line ends with \\", cnf_filename);
+        } else {
+          string new_line;
+          new_line = concat (line, next_line);
+          free (line);
+          line = new_line;
+          len = strlen (line);
+        }
+      }
+
+      do_line (line);
+      free (line);
+    }
+
+    xfclose (cnf_file, cnf_filename);
+  }
+}
+
+/* Read the cnf files on the first call.  Return the first value in the
+   returned list -- this will be from the last-read cnf file.  */
+
+string
+kpse_cnf_get P1C(const_string, name)
+{
+  string ret, try;
+  string *ret_list;
+  static boolean doing_cnf_init = false;
+
+  /* When we expand the compile-time value for DEFAULT_TEXMFCNF,
+     we end up needing the value for TETEXDIR and other variables,
+     so kpse_var_expand ends up calling us again.  No good.  */
+  if (doing_cnf_init)
+    return NULL;
+    
+  if (cnf_hash.size == 0) {
+    doing_cnf_init = true;
+    read_all_cnf ();
+    doing_cnf_init = false;
+    
+    /* Here's a pleasant kludge: Since `kpse_init_dbs' recursively calls
+       us, we must call it from outside a `kpse_path_element' loop
+       (namely, the one in `read_all_cnf' above): `kpse_path_element' is
+       not reentrant.  */
+    kpse_init_db ();
+  }
+  
+  /* First look up NAME.`program_invocation_short_name', then NAME.  */
+  assert (program_invocation_short_name);
+  try = concat3 (name, ".", program_invocation_short_name);
+  ret_list = hash_lookup (cnf_hash, try);
+  if (ret_list) {
+    ret = *ret_list;
+    free (ret_list);
+  } else {
+    free (try);
+    ret_list = hash_lookup (cnf_hash, name);
+    if (ret_list) {
+      ret = *ret_list;
+      free (ret_list);
+    } else {
+      ret = NULL;
+    }
+  }
+  
+  return ret;
+
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/cnf.h
@@ -0,0 +1,30 @@
+/* cnf.h: runtime config files.
+
+Copyright (C) 1994, 95 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_CNF_H
+#define KPATHSEA_CNF_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+/* Return the value in the last-read cnf file for VAR, or NULL if none.
+   On the first call, also read all the `texmf.cnf' files in the
+   path for kpse_cnf_format (and initialize the path).  */
+extern string kpse_cnf_get P1H(const_string var);
+
+#endif /* not KPATHSEA_CNF_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/common.ac
@@ -0,0 +1,108 @@
+dnl Common Autoconf sinclude file for kpathsea-using programs.  (Have to
+dnl use the m4 `sinclude' builtin instead of `include', since Autoconf
+dnl disables `include'.)
+
+dnl Write output here, instead of putting a zillion -D's on the command line.
+AC_CONFIG_HEADER(c-auto.h)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+
+AC_HEADER_DIRENT
+AC_HEADER_STDC
+AC_FUNC_CLOSEDIR_VOID
+AC_CHECK_HEADERS(assert.h float.h limits.h memory.h pwd.h stdlib.h \
+                 string.h sys/param.h unistd.h)
+
+
+dnl We would to do the klibtool stuff only in kpathsea (i.e., in
+dnl kpathsea/configure.in instead of here in common.ac), but then
+dnl HAVE_BASENAME etc. are not defined when compiling the programs,
+dnl because <kpathsea/config.h> includes <c-auto.h> (the programs'),
+dnl not <kpathsea/c-auto.h>.  Should it include both?  But then we will
+dnl have many benign redefinitions that some compilers may not consider
+dnl benign.  And it's a big change.
+sinclude(../acklibtool.m4)
+kb_AC_PROG_LIBTOOL
+dnl If the list of functions here changes, also change acconfig.h.  */
+kb_AC_KLIBTOOL_REPLACE_FUNCS(basename putenv strcasecmp strtol strstr)
+
+AC_CHECK_FUNCS(bcopy getwd)
+
+AC_C_CONST
+
+# This is a GNU libc invention.
+AC_MSG_CHECKING(whether program_invocation_name is predefined)
+AC_CACHE_VAL(kb_cv_var_program_inv_name,
+[AC_TRY_LINK(, [main() { program_invocation_name = "love"; }],
+  kb_cv_var_program_inv_name=yes, kb_cv_var_program_inv_name=no)])dnl
+AC_MSG_RESULT($kb_cv_var_program_inv_name)
+if test "$kb_cv_var_program_inv_name" = yes; then
+  AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME)
+fi
+
+# Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment.
+# This test program is due to Mike Hibler <mike@cs.utah.edu>.
+# We don't actually need to run this if we don't have putenv, but it
+# doesn't hurt.
+AC_MSG_CHECKING(whether putenv uses malloc)
+AC_CACHE_VAL(kb_cv_func_putenv_malloc,
+[AC_TRY_RUN([
+#define VAR	"YOW_VAR"
+#define STRING1 "GabbaGabbaHey"
+#define STRING2 "Yow!!"		/* should be shorter than STRING1 */
+extern char *getenv (); /* in case char* and int don't mix gracefully */
+main ()
+{
+  char *str1, *rstr1, *str2, *rstr2;
+  str1 = getenv (VAR);
+  if (str1)
+    exit (1);
+  str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1);
+  if (str1 == 0)
+    exit (2);
+  strcpy (str1, VAR);
+  strcat (str1, "=");
+  strcat (str1, STRING1);
+  if (putenv (str1) < 0)
+    exit (3);
+  rstr1 = getenv (VAR);
+  if (rstr1 == 0)
+    exit (4);
+  rstr1 -= strlen (VAR) + 1;
+  if (strncmp (rstr1, VAR, strlen (VAR)))
+    exit (5);
+  str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1);
+  if (str2 == 0 || str1 == str2)
+    exit (6);
+  strcpy (str2, VAR);
+  strcat (str2, "=");
+  strcat (str2, STRING2);
+  if (putenv (str2) < 0)
+    exit (7);
+  rstr2 = getenv (VAR);
+  if (rstr2 == 0)
+    exit (8);
+  rstr2 -= strlen (VAR) + 1;
+#if 0
+  printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2);
+  /*
+   * If string from first call was reused for the second call,
+   * you had better not do a free on the first string!
+   */
+  if (rstr1 == rstr2)
+          printf ("#define SMART_PUTENV\n");
+  else
+          printf ("#undef SMART_PUTENV\n");
+#endif
+  exit (rstr1 == rstr2 ? 0 : 1);
+}], kb_cv_func_putenv_malloc=yes, kb_cv_func_putenv_malloc=no,
+    kb_cv_func_putenv_malloc=no)])dnl
+AC_MSG_RESULT($kb_cv_func_putenv_malloc)
+if test $kb_cv_func_putenv_malloc = yes; then
+  AC_DEFINE(SMART_PUTENV)
+fi
+
+# Common --with and --enable options.
+sinclude(../kpathsea/withenable.ac)
new file mode 100644
--- /dev/null
+++ b/kpathsea/concat.c
@@ -0,0 +1,33 @@
+/* concat.c: dynamic string concatenation.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+/* Return the concatenation of S1 and S2.  See `concatn.c' for a
+   `concatn', which takes a variable number of arguments.  */
+
+string
+concat P2C(const_string, s1,  const_string, s2)
+{
+  string answer = (string) xmalloc (strlen (s1) + strlen (s2) + 1);
+  strcpy (answer, s1);
+  strcat (answer, s2);
+
+  return answer;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/concat3.c
@@ -0,0 +1,32 @@
+/* concat3.c: concatenate three strings.
+
+Copyright (C) 1992 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+string
+concat3 P3C(const_string, s1,  const_string, s2,  const_string, s3)
+{
+  string answer
+    = (string) xmalloc (strlen (s1) + strlen (s2) + strlen (s3) + 1);
+  strcpy (answer, s1);
+  strcat (answer, s2);
+  strcat (answer, s3);
+
+  return answer;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/concatn.c
@@ -0,0 +1,70 @@
+/* concatn.c: Concatenate an arbitrary number of strings.
+
+Copyright (C) 1993, 95 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/concatn.h>
+
+
+/* OK, it would be epsilon more efficient to compute the total length
+   and then do the copying ourselves, but I doubt it matters in reality.  */
+
+string
+concatn PVAR1C(const_string, str1,  ap)
+{
+  string arg;
+  string ret;
+
+  if (!str1)
+    return NULL;
+  
+  ret = xstrdup (str1);
+  
+  while ((arg = va_arg (ap, string)) != NULL)
+    {
+      string temp = concat (ret, arg);
+      free (ret);
+      ret = temp;
+    }
+  va_end (ap);
+  
+  return ret;
+}}
+
+#ifdef TEST
+int
+main ()
+{
+  printf ("null = \"%s\"\n", concatn (NULL));
+  printf ("\"a\" = \"%s\"\n", concatn ("a", NULL));
+  printf ("\"ab\" = \"%s\"\n", concatn ("a", "b", NULL));
+  printf ("\"abc\" = \"%s\"\n", concatn ("a", "b", "c", NULL));
+  printf ("\"abcd\" = \"%s\"\n", concatn ("ab", "cd", NULL));
+  printf ("\"abcde\" = \"%s\"\n", concatn ("ab", "c", "de", NULL));
+  printf ("\"abcdef\" = \"%s\"\n", concatn ("", "a", "", "bcd", "ef", NULL));
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+standalone-compile-command: "gcc -posix -g -I. -I.. -DTEST concatn.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/concatn.h
@@ -0,0 +1,33 @@
+/* concatn.h: concatenate a variable number of strings.
+   This is a separate include file only because I don't see the point of
+   having every source file include <c-vararg.h>.  The declarations for
+   the other concat routines are in lib.h.
+
+Copyright (C) 1993, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_CONCATN_H
+#define KPATHSEA_CONCATN_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/c-vararg.h>
+#include <kpathsea/types.h>
+
+/* Concatenate a null-terminated list of strings and return the result
+   in malloc-allocated memory.  */
+extern DllImport string concatn PVAR1H(const_string str1);
+
+#endif /* not KPATHSEA_CONCATN_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/config.cache
@@ -0,0 +1,46 @@
+# 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.
+#
+ac_cv_c_const=${ac_cv_c_const='yes'}
+ac_cv_func_basename=${ac_cv_func_basename='yes'}
+ac_cv_func_bcopy=${ac_cv_func_bcopy='yes'}
+ac_cv_func_closedir_void=${ac_cv_func_closedir_void='no'}
+ac_cv_func_getwd=${ac_cv_func_getwd='yes'}
+ac_cv_func_putenv=${ac_cv_func_putenv='yes'}
+ac_cv_func_strcasecmp=${ac_cv_func_strcasecmp='yes'}
+ac_cv_func_strstr=${ac_cv_func_strstr='yes'}
+ac_cv_func_strtol=${ac_cv_func_strtol='yes'}
+ac_cv_header_assert_h=${ac_cv_header_assert_h='yes'}
+ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h='yes'}
+ac_cv_header_float_h=${ac_cv_header_float_h='yes'}
+ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'}
+ac_cv_header_memory_h=${ac_cv_header_memory_h='yes'}
+ac_cv_header_pwd_h=${ac_cv_header_pwd_h='yes'}
+ac_cv_header_stdc=${ac_cv_header_stdc='yes'}
+ac_cv_header_stdlib_h=${ac_cv_header_stdlib_h='yes'}
+ac_cv_header_string_h=${ac_cv_header_string_h='yes'}
+ac_cv_header_sys_param_h=${ac_cv_header_sys_param_h='yes'}
+ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'}
+ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir='no'}
+ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
+ac_cv_prog_CC=${ac_cv_prog_CC='gcc'}
+ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
+ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB='ranlib'}
+ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross='no'}
+ac_cv_prog_cc_g=${ac_cv_prog_cc_g='yes'}
+ac_cv_prog_cc_works=${ac_cv_prog_cc_works='yes'}
+ac_cv_prog_gcc=${ac_cv_prog_gcc='yes'}
+ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'}
+kb_cv_func_putenv_malloc=${kb_cv_func_putenv_malloc='no'}
+kb_cv_var_program_inv_name=${kb_cv_var_program_inv_name='no'}
new file mode 100644
--- /dev/null
+++ b/kpathsea/config.h
@@ -0,0 +1,85 @@
+/* config.h: master configuration file, included first by all compilable
+   source files (not headers).
+
+Copyright (C) 1993, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_CONFIG_H
+#define KPATHSEA_CONFIG_H
+
+#ifdef WIN32
+#define __STDC__ 1
+#include "../win32/win32-compat.h"
+#endif /* not WIN32 */
+
+/* System dependencies that are figured out by `configure'.  If we are
+   compiling standalone, we get our c-auto.h.  Otherwise, the package
+   containing us must provide this (unless it can somehow generate ours
+   from c-auto.h.in).  We use <...> instead of "..." so that the current
+   cpp directory (i.e., kpathsea/) won't be searched. */
+#include <c-auto.h>
+
+#include <kpathsea/c-std.h>    /* <stdio.h>, <math.h>, etc.  */
+
+#include <kpathsea/c-proto.h>  /* Macros to discard or keep prototypes.  */
+
+#include <kpathsea/debug.h>    /* Runtime tracing.  */
+#include <kpathsea/lib.h>      /* STREQ, etc. */
+#include <kpathsea/types.h>    /* <sys/types.h>, boolean, string, etc. */
+#include <kpathsea/progname.h> /* for program_invocation_*name */
+
+/* System defines are for non-Unix systems only.  (Testing for all Unix
+   variations should be done in configure.)  Presently the defines used
+   are: AMIGA DOS OS2 VMCMS VMS WIN32.  I do not use any of these systems
+   myself; if you do, I'd be grateful for any changes. --kb@mail.tug.org */
+   
+/* If we have either DOS or OS2, we are DOSISH.  */
+#if defined (DOS) || defined (OS2) || defined (WIN32)
+#define DOSISH
+#endif
+
+/* If you want to find subdirectories in a directory with non-Unix
+   semantics (specifically, if a directory with no subdirectories does
+   not have exactly two links), define this.  */
+#if !defined (DOSISH) && !defined (VMS) && !defined (VMCMS)
+#define ST_NLINK_TRICK
+#endif /* not DOS and not VMS and not VMCMS */
+
+#ifdef AMIGA
+/* No popen/pclose on Amiga, but rather than put #ifdef's in tex-make.c,
+   let's get rid of the functions here.  (CallMF will automatically
+   generate fonts.)  pclose must not be simply empty, since it still
+   occurs in a comparison.  */
+#define popen(cmd, mode) NULL
+#define pclose(file) 0
+#endif /* AMIGA */
+
+#ifdef OS2
+#define access ln_access
+#define chmod ln_chmod
+#define creat ln_creat
+#define fopen ln_fopen
+#define freopen ln_freopen
+#define lstat ln_lstat
+#define open ln_open
+#define remove ln_remove
+#define rename ln_rename
+#define sopen ln_sopen
+#define stat ln_stat
+#define unlink ln_unlink
+#endif /* OS2 */
+
+#endif /* not KPATHSEA_CONFIG_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/config.log
@@ -0,0 +1,38 @@
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+configure:539: checking for gcc
+configure:616: checking whether the C compiler (gcc  ) works
+configure:630: gcc -o conftest    conftest.c  1>&5 && (ls -l conftest | grep x) >/dev/null 2>&1
+configure:650: checking whether the C compiler (gcc  ) is a cross-compiler
+configure:655: checking whether we are using GNU C
+configure:679: checking whether gcc accepts -g
+configure:736: checking for a BSD compatible install
+configure:786: checking whether make sets ${MAKE}
+configure:818: checking for dirent.h that defines DIR
+configure:856: checking for opendir in -ldir
+configure:939: checking how to run the C preprocessor
+configure:1000: checking for ANSI C header files
+configure:1104: checking whether closedir returns void
+configure:1145: checking for assert.h
+configure:1145: checking for float.h
+configure:1145: checking for limits.h
+configure:1145: checking for memory.h
+configure:1145: checking for pwd.h
+configure:1145: checking for stdlib.h
+configure:1145: checking for string.h
+configure:1145: checking for sys/param.h
+configure:1145: checking for unistd.h
+configure:1187: checking for ranlib
+configure:1220: checking host system type
+configure:1244: checking for libtool object types
+configure:1293: checking for basename
+configure:1293: checking for putenv
+configure:1293: checking for strcasecmp
+configure:1293: checking for strtol
+configure:1293: checking for strstr
+configure:1351: checking for bcopy
+configure:1351: checking for getwd
+configure:1405: checking for working const
+configure:1482: checking whether program_invocation_name is predefined
+configure:1518: checking whether putenv uses malloc
new file mode 100755
--- /dev/null
+++ b/kpathsea/config.status
@@ -0,0 +1,349 @@
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host tillamook-sharp:
+#
+# ./configure 
+#
+# 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} ./configure  --no-create --no-recursion"
+    exec ${CONFIG_SHELL-/bin/sh} ./configure  --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "./config.status generated by autoconf version 2.12"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "$ac_cs_usage"; exit 0 ;;
+  *) echo "$ac_cs_usage"; exit 1 ;;
+  esac
+done
+
+ac_given_srcdir=.
+ac_given_INSTALL="/usr/bin/install -c"
+
+trap 'rm -fr Makefile c-auto.h conftest*; exit 1' 1 2 15
+
+# 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
+/^[ 	]*VPATH[ 	]*=[^:]*$/d
+
+s%@CFLAGS@%-g -O2%g
+s%@CPPFLAGS@%%g
+s%@CXXFLAGS@%%g
+s%@DEFS@%-DHAVE_CONFIG_H%g
+s%@LDFLAGS@%%g
+s%@LIBS@%%g
+s%@exec_prefix@%${prefix}%g
+s%@prefix@%/usr/local%g
+s%@program_transform_name@%s,x,x,%g
+s%@bindir@%${exec_prefix}/bin%g
+s%@sbindir@%${exec_prefix}/sbin%g
+s%@libexecdir@%${exec_prefix}/libexec%g
+s%@datadir@%${prefix}/share%g
+s%@sysconfdir@%${prefix}/etc%g
+s%@sharedstatedir@%${prefix}/com%g
+s%@localstatedir@%${prefix}/var%g
+s%@libdir@%${exec_prefix}/lib%g
+s%@includedir@%${prefix}/include%g
+s%@oldincludedir@%/usr/include%g
+s%@infodir@%${prefix}/info%g
+s%@mandir@%${prefix}/man%g
+s%@CC@%gcc%g
+s%@INSTALL_PROGRAM@%${INSTALL}%g
+s%@INSTALL_DATA@%${INSTALL} -m 644%g
+s%@SET_MAKE@%%g
+s%@CPP@%gcc -E%g
+s%@RANLIB@%ranlib%g
+s%@host@%i586-pc-linux-gnu%g
+s%@host_alias@%i586-pc-linux-gnu%g
+s%@host_cpu@%i586%g
+s%@host_vendor@%pc%g
+s%@host_os@%linux-gnu%g
+s%@LIBTOOL@%/usr/home/jwe/src/other/xdvik-20a/kpathsea/./../klibtool%g
+s%@LTLIBOBJS@%%g
+
+CEOF
+
+# 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
+
+CONFIG_FILES=${CONFIG_FILES-"Makefile"}
+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 ;;
+  /*) 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
+  [/$]*) 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
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  # Replace lines of the form ac_include foo with the contents of foo:
+  # first, from the ac_include lines construct a list of sed
+  # commands to remove them, and include the files; then run sed.
+  # Have to use sed because old (Ultrix, SunOS) awk does not support
+  # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
+  # Use \@...@<cmd> form of sed address because the filename may contain /.
+  # Can't use only one -e and commands {dr foo} because foo has to be last.
+  # Use @e initially instead of -e because GNU echo has a -e option.
+  # Use `X' to mean a bunch of backslashes; this is for FreeBSD.
+  # 
+  # No support for the multiple-output file :-separated stuff.
+  # 
+  file_substs=`sed -n \
+"/^ac_include/s%ac_include[ 	]*\(.*\)%@e 'X@^&@r \1' -e 'X@^&@d'%p" \
+               $ac_given_srcdir/$ac_file_in`
+  if test -n "$file_substs"; then
+    # Change @e back to -e and X@^ to \@^.
+    file_subst_cmd="sed `echo $file_substs \
+                         | sed -e 's/@e/-e/g' -e 's/X@^/\\\@^/g'`"
+  else
+    # If no substitutions and hence no sed commands, don't choke.
+    file_subst_cmd=cat
+  fi
+  # cd into the srcdir because the files being included more or less
+  # must be part of the distribution. 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).
+  (cd $ac_given_srcdir && eval $file_subst_cmd $ac_file_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*
+
+# 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
+  CONFIG_HEADERS="c-auto.h"
+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/%" -e "s%:% $ac_given_srcdir/%g"`
+  cat $ac_file_inputs > conftest.in
+
+  cat > conftest.frag <<CEOF
+${ac_dA}HAVE_DIRENT_H${ac_dB}HAVE_DIRENT_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_DIRENT_H${ac_uB}HAVE_DIRENT_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_DIRENT_H${ac_eB}HAVE_DIRENT_H${ac_eC}1${ac_eD}
+${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD}
+${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD}
+${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD}
+${ac_dA}HAVE_ASSERT_H${ac_dB}HAVE_ASSERT_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_ASSERT_H${ac_uB}HAVE_ASSERT_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_ASSERT_H${ac_eB}HAVE_ASSERT_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_FLOAT_H${ac_dB}HAVE_FLOAT_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_FLOAT_H${ac_uB}HAVE_FLOAT_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_FLOAT_H${ac_eB}HAVE_FLOAT_H${ac_eC}1${ac_eD}
+CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+
+  cat > conftest.frag <<CEOF
+${ac_dA}HAVE_LIMITS_H${ac_dB}HAVE_LIMITS_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_LIMITS_H${ac_uB}HAVE_LIMITS_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_LIMITS_H${ac_eB}HAVE_LIMITS_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_MEMORY_H${ac_dB}HAVE_MEMORY_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_MEMORY_H${ac_uB}HAVE_MEMORY_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_MEMORY_H${ac_eB}HAVE_MEMORY_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_PWD_H${ac_dB}HAVE_PWD_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_PWD_H${ac_uB}HAVE_PWD_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_PWD_H${ac_eB}HAVE_PWD_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_STDLIB_H${ac_dB}HAVE_STDLIB_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STDLIB_H${ac_uB}HAVE_STDLIB_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STDLIB_H${ac_eB}HAVE_STDLIB_H${ac_eC}1${ac_eD}
+CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+
+  cat > conftest.frag <<CEOF
+${ac_dA}HAVE_STRING_H${ac_dB}HAVE_STRING_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STRING_H${ac_uB}HAVE_STRING_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STRING_H${ac_eB}HAVE_STRING_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_SYS_PARAM_H${ac_dB}HAVE_SYS_PARAM_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_SYS_PARAM_H${ac_uB}HAVE_SYS_PARAM_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_SYS_PARAM_H${ac_eB}HAVE_SYS_PARAM_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_UNISTD_H${ac_dB}HAVE_UNISTD_H${ac_dC}1${ac_dD}
+${ac_uA}HAVE_UNISTD_H${ac_uB}HAVE_UNISTD_H${ac_uC}1${ac_uD}
+${ac_eA}HAVE_UNISTD_H${ac_eB}HAVE_UNISTD_H${ac_eC}1${ac_eD}
+${ac_dA}HAVE_BASENAME${ac_dB}HAVE_BASENAME${ac_dC}1${ac_dD}
+${ac_uA}HAVE_BASENAME${ac_uB}HAVE_BASENAME${ac_uC}1${ac_uD}
+${ac_eA}HAVE_BASENAME${ac_eB}HAVE_BASENAME${ac_eC}1${ac_eD}
+CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+
+  cat > conftest.frag <<CEOF
+${ac_dA}HAVE_PUTENV${ac_dB}HAVE_PUTENV${ac_dC}1${ac_dD}
+${ac_uA}HAVE_PUTENV${ac_uB}HAVE_PUTENV${ac_uC}1${ac_uD}
+${ac_eA}HAVE_PUTENV${ac_eB}HAVE_PUTENV${ac_eC}1${ac_eD}
+${ac_dA}HAVE_STRCASECMP${ac_dB}HAVE_STRCASECMP${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STRCASECMP${ac_uB}HAVE_STRCASECMP${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STRCASECMP${ac_eB}HAVE_STRCASECMP${ac_eC}1${ac_eD}
+${ac_dA}HAVE_STRTOL${ac_dB}HAVE_STRTOL${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STRTOL${ac_uB}HAVE_STRTOL${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STRTOL${ac_eB}HAVE_STRTOL${ac_eC}1${ac_eD}
+${ac_dA}HAVE_STRSTR${ac_dB}HAVE_STRSTR${ac_dC}1${ac_dD}
+${ac_uA}HAVE_STRSTR${ac_uB}HAVE_STRSTR${ac_uC}1${ac_uD}
+${ac_eA}HAVE_STRSTR${ac_eB}HAVE_STRSTR${ac_eC}1${ac_eD}
+CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+
+  cat > conftest.frag <<CEOF
+${ac_dA}HAVE_BCOPY${ac_dB}HAVE_BCOPY${ac_dC}1${ac_dD}
+${ac_uA}HAVE_BCOPY${ac_uB}HAVE_BCOPY${ac_uC}1${ac_uD}
+${ac_eA}HAVE_BCOPY${ac_eB}HAVE_BCOPY${ac_eC}1${ac_eD}
+${ac_dA}HAVE_GETWD${ac_dB}HAVE_GETWD${ac_dC}1${ac_dD}
+${ac_uA}HAVE_GETWD${ac_uB}HAVE_GETWD${ac_uC}1${ac_uD}
+${ac_eA}HAVE_GETWD${ac_eB}HAVE_GETWD${ac_eC}1${ac_eD}
+${ac_dA}MAKE_TEX_MF_BY_DEFAULT${ac_dB}MAKE_TEX_MF_BY_DEFAULT${ac_dC}1${ac_dD}
+${ac_uA}MAKE_TEX_MF_BY_DEFAULT${ac_uB}MAKE_TEX_MF_BY_DEFAULT${ac_uC}1${ac_uD}
+${ac_eA}MAKE_TEX_MF_BY_DEFAULT${ac_eB}MAKE_TEX_MF_BY_DEFAULT${ac_eC}1${ac_eD}
+${ac_dA}MAKE_TEX_PK_BY_DEFAULT${ac_dB}MAKE_TEX_PK_BY_DEFAULT${ac_dC}1${ac_dD}
+${ac_uA}MAKE_TEX_PK_BY_DEFAULT${ac_uB}MAKE_TEX_PK_BY_DEFAULT${ac_uC}1${ac_uD}
+${ac_eA}MAKE_TEX_PK_BY_DEFAULT${ac_eB}MAKE_TEX_PK_BY_DEFAULT${ac_eC}1${ac_eD}
+CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+
+  cat > conftest.frag <<CEOF
+${ac_dA}MAKE_TEX_TFM_BY_DEFAULT${ac_dB}MAKE_TEX_TFM_BY_DEFAULT${ac_dC}1${ac_dD}
+${ac_uA}MAKE_TEX_TFM_BY_DEFAULT${ac_uB}MAKE_TEX_TFM_BY_DEFAULT${ac_uC}1${ac_uD}
+${ac_eA}MAKE_TEX_TFM_BY_DEFAULT${ac_eB}MAKE_TEX_TFM_BY_DEFAULT${ac_eC}1${ac_eD}
+s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+CEOF
+  sed -f conftest.frag conftest.in > conftest.out
+  rm -f conftest.in
+  mv conftest.out conftest.in
+
+  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
+
+
+
+exit 0
new file mode 100755
--- /dev/null
+++ b/kpathsea/configure
@@ -0,0 +1,2036 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+  --enable-shared              build shared libraries [default=no]"
+ac_help="$ac_help
+  --enable-static              build shared libraries [default=yes]"
+ac_help="$ac_help
+  --without-maketexmf-default  do not run MakeTeXMF if MF source missing"
+ac_help="$ac_help
+  --without-maketexpk-default  do not run MakeTeXPK if PK font missing"
+ac_help="$ac_help
+  --without-maketextfm-default do not run MakeTeXTFM if TFM file 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.
+subdirs=
+MFLAGS= MAKEFLAGS=
+# 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.12"
+    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; }
+    ;;
+
+  *)
+    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=pathsearch.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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 && (ls -l conftest | grep x) >/dev/null 2>&1'
+cross_compiling=$ac_cv_prog_cc_cross
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  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:539: 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="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $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:568: 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="${IFS}:"
+  ac_prog_rejected=no
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $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
+
+  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:616: 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 $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 && (ls -l conftest | grep x) >/dev/null 2>&1'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 626 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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*
+
+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:650: 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:655: 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:664: \"$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
+  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:679: 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
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-O2"
+  fi
+else
+  GCC=
+  test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=`pwd`/$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=`pwd`/$ac_dir
+    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
+# 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:736: 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="${IFS}:"
+  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.
+      for ac_prog in ginstall installbsd scoinst install; do
+        if test -f $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.
+	    # OSF/1 installbsd also uses dspmsg, but is usable.
+	    :
+	  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_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:786: 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
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:818: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 823 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_dirent_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_dirent_'$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
+ ac_header_dirent=$ac_hdr; break
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:856: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldir  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 864 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -ldir"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:897: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lx  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 905 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -lx"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:939: 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 954 "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:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 971 "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:977: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+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
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1000: 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 1005 "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:1013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  ac_cv_header_stdc=yes
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+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 1030 "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 1048 "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 1069 "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:1080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  :
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_header_stdc=no
+fi
+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 whether closedir returns void""... $ac_c" 1>&6
+echo "configure:1104: checking whether closedir returns void" >&5
+if eval "test \"`echo '$''{'ac_cv_func_closedir_void'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_closedir_void=yes
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1112 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_header_dirent>
+int closedir(); main() { exit(closedir(opendir(".")) != 0); }
+EOF
+if { (eval echo configure:1118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_func_closedir_void=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_func_closedir_void=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_closedir_void" 1>&6
+if test $ac_cv_func_closedir_void = yes; then
+  cat >> confdefs.h <<\EOF
+#define CLOSEDIR_VOID 1
+EOF
+
+fi
+
+for ac_hdr in assert.h float.h limits.h memory.h pwd.h stdlib.h \
+                 string.h sys/param.h unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1145: 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 1150 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&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
+
+
+
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1187: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_RANLIB="ranlib"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+  echo "$ac_t""$RANLIB" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+# Make sure we can run config.sub.
+if $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:1220: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`$ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
+  esac ;;
+esac
+
+host=`$ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+
+#
+echo $ac_n "checking for libtool object types""... $ac_c" 1>&6
+echo "configure:1244: checking for libtool object types" >&5
+#
+## Check that the klibtool script is in ac_aux_dir.  Don't bother to
+# scan PATH.  For one thing, if we found it somewhere there, we couldn't
+# use that directory to put the config file ... and that's what we need
+# to do, to avoid having to configure in every subdirectory.
+LIBTOOL=$ac_aux_dir/klibtool
+
+if test ! -r $LIBTOOL; then
+  { echo "configure: error: klibtool not in $ac_aux_dir, goodbye" 1>&2; exit 1; }
+  exit 1
+fi
+#
+## Argument parsing: we support --enable-shared and --enable-static.
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+  enableval="$enable_shared"
+  :
+else
+  enable_shared=no
+fi
+
+#
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+  enableval="$enable_static"
+  :
+else
+  enable_static=yes
+fi
+
+#
+# If they explicitly --enable-static, make that the link type.
+# More commonly, they will just --enable-shared; make that the link type.
+# In either case, prepend to any existing LIBTOOL_OBJTYPES.
+# If they really want to build both and link statically,
+# then they set LIBTOOL_OBJTYPES to SHARED and --enable-static.
+test "$enable_static" = yes && LIBTOOL_OBJTYPES=STATIC:$LIBTOOL_OBJTYPES
+test "$enable_shared" = yes && LIBTOOL_OBJTYPES=SHARED:$LIBTOOL_OBJTYPES
+# Don't bother to remove the trailing :, it'll be ignored.
+#
+## Finally: Run the klibtool configure command.
+LIBTOOL_OBJTYPES=$LIBTOOL_OBJTYPES RANLIB=$RANLIB \
+  $LIBTOOL --config-dir $ac_aux_dir configure "$host"
+echo "$ac_t""$LIBTOOL_OBJTYPES" 1>&6
+
+ for ac_func in basename putenv strcasecmp strtol strstr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1293: 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 1298 "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:1321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&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
+LTLIBOBJS="$LTLIBOBJS $ac_func.lo"
+fi
+done
+
+
+
+for ac_func in bcopy getwd
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1351: 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 1356 "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:1379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&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
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1405: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1410 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1459: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_const=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
+
+fi
+
+
+# This is a GNU libc invention.
+echo $ac_n "checking whether program_invocation_name is predefined""... $ac_c" 1>&6
+echo "configure:1482: checking whether program_invocation_name is predefined" >&5
+if eval "test \"`echo '$''{'kb_cv_var_program_inv_name'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1487 "configure"
+#include "confdefs.h"
+
+int main() {
+main() { program_invocation_name = "love"; }
+; return 0; }
+EOF
+if { (eval echo configure:1494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  kb_cv_var_program_inv_name=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  kb_cv_var_program_inv_name=no
+fi
+rm -f conftest*
+fi
+echo "$ac_t""$kb_cv_var_program_inv_name" 1>&6
+if test "$kb_cv_var_program_inv_name" = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_PROGRAM_INVOCATION_NAME 1
+EOF
+
+fi
+
+# Some BSD putenv's, e.g., FreeBSD, do malloc/free's on the environment.
+# This test program is due to Mike Hibler <mike@cs.utah.edu>.
+# We don't actually need to run this if we don't have putenv, but it
+# doesn't hurt.
+echo $ac_n "checking whether putenv uses malloc""... $ac_c" 1>&6
+echo "configure:1518: checking whether putenv uses malloc" >&5
+if eval "test \"`echo '$''{'kb_cv_func_putenv_malloc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+  kb_cv_func_putenv_malloc=no
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1526 "configure"
+#include "confdefs.h"
+
+#define VAR	"YOW_VAR"
+#define STRING1 "GabbaGabbaHey"
+#define STRING2 "Yow!!"		/* should be shorter than STRING1 */
+extern char *getenv (); /* in case char* and int don't mix gracefully */
+main ()
+{
+  char *str1, *rstr1, *str2, *rstr2;
+  str1 = getenv (VAR);
+  if (str1)
+    exit (1);
+  str1 = malloc (strlen (VAR) + 1 + strlen (STRING1) + 1);
+  if (str1 == 0)
+    exit (2);
+  strcpy (str1, VAR);
+  strcat (str1, "=");
+  strcat (str1, STRING1);
+  if (putenv (str1) < 0)
+    exit (3);
+  rstr1 = getenv (VAR);
+  if (rstr1 == 0)
+    exit (4);
+  rstr1 -= strlen (VAR) + 1;
+  if (strncmp (rstr1, VAR, strlen (VAR)))
+    exit (5);
+  str2 = malloc (strlen (VAR) + 1 + strlen (STRING2) + 1);
+  if (str2 == 0 || str1 == str2)
+    exit (6);
+  strcpy (str2, VAR);
+  strcat (str2, "=");
+  strcat (str2, STRING2);
+  if (putenv (str2) < 0)
+    exit (7);
+  rstr2 = getenv (VAR);
+  if (rstr2 == 0)
+    exit (8);
+  rstr2 -= strlen (VAR) + 1;
+#if 0
+  printf ("rstr1=0x%x, rstr2=0x%x\n", rstr1, rstr2);
+  /*
+   * If string from first call was reused for the second call,
+   * you had better not do a free on the first string!
+   */
+  if (rstr1 == rstr2)
+          printf ("#define SMART_PUTENV\n");
+  else
+          printf ("#undef SMART_PUTENV\n");
+#endif
+  exit (rstr1 == rstr2 ? 0 : 1);
+}
+EOF
+if { (eval echo configure:1579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+  kb_cv_func_putenv_malloc=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  kb_cv_func_putenv_malloc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$kb_cv_func_putenv_malloc" 1>&6
+if test $kb_cv_func_putenv_malloc = yes; then
+  cat >> confdefs.h <<\EOF
+#define SMART_PUTENV 1
+EOF
+
+fi
+
+# Common --with and --enable options.
+
+# Check whether --with-maketexmf-default or --without-maketexmf-default was given.
+if test "${with_maketexmf_default+set}" = set; then
+  withval="$with_maketexmf_default"
+  :
+else
+  enableval=yes
+fi
+
+if test $enableval = yes; then
+  cat >> confdefs.h <<\EOF
+#define MAKE_TEX_MF_BY_DEFAULT 1
+EOF
+
+fi
+# Check whether --with-maketexpk-default or --without-maketexpk-default was given.
+if test "${with_maketexpk_default+set}" = set; then
+  withval="$with_maketexpk_default"
+  :
+else
+  enableval=yes
+fi
+
+if test $enableval = yes; then
+  cat >> confdefs.h <<\EOF
+#define MAKE_TEX_PK_BY_DEFAULT 1
+EOF
+
+fi
+# Check whether --with-maketextfm-default or --without-maketextfm-default was given.
+if test "${with_maketextfm_default+set}" = set; then
+  withval="$with_maketextfm_default"
+  :
+else
+  enableval=yes
+fi
+
+if test $enableval = yes; then
+  cat >> confdefs.h <<\EOF
+#define MAKE_TEX_TFM_BY_DEFAULT 1
+EOF
+
+fi
+
+
+
+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) 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.12"
+    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 "Makefile c-auto.h" | 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%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%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_DATA@%$INSTALL_DATA%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CPP@%$CPP%g
+s%@RANLIB@%$RANLIB%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@LIBTOOL@%$LIBTOOL%g
+s%@LTLIBOBJS@%$LTLIBOBJS%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-"Makefile"}
+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 ;;
+  /*) 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
+  [/$]*) 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
+
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  # Replace lines of the form ac_include foo with the contents of foo:
+  # first, from the ac_include lines construct a list of sed
+  # commands to remove them, and include the files; then run sed.
+  # Have to use sed because old (Ultrix, SunOS) awk does not support
+  # getline or system. (Anyway, configure scripts aren't supposed to use awk.)
+  # Use \@...@<cmd> form of sed address because the filename may contain /.
+  # Can't use only one -e and commands {dr foo} because foo has to be last.
+  # Use @e initially instead of -e because GNU echo has a -e option.
+  # Use `X' to mean a bunch of backslashes; this is for FreeBSD.
+  # 
+  # No support for the multiple-output file :-separated stuff.
+  # 
+  file_substs=`sed -n \
+"/^ac_include/s%ac_include[ 	]*\(.*\)%@e 'X@^&@r \1' -e 'X@^&@d'%p" \
+               $ac_given_srcdir/$ac_file_in`
+  if test -n "$file_substs"; then
+    # Change @e back to -e and X@^ to \@^.
+    file_subst_cmd="sed `echo $file_substs \
+                         | sed -e 's/@e/-e/g' -e 's/X@^/\\\@^/g'`"
+  else
+    # If no substitutions and hence no sed commands, don't choke.
+    file_subst_cmd=cat
+  fi
+  # cd into the srcdir because the files being included more or less
+  # must be part of the distribution. 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).
+  (cd $ac_given_srcdir && eval $file_subst_cmd $ac_file_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*
+
+# 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"
+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/%" -e "s%:% $ac_given_srcdir/%g"`
+  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
+
+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
+
new file mode 100644
--- /dev/null
+++ b/kpathsea/configure.in
@@ -0,0 +1,6 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(pathsearch.c)
+
+sinclude(common.ac)
+
+AC_OUTPUT(Makefile)
new file mode 100644
--- /dev/null
+++ b/kpathsea/db.c
@@ -0,0 +1,519 @@
+/* db.c: an external database to avoid filesystem lookups.
+
+Copyright (C) 1994, 95, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+#include <kpathsea/absolute.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/db.h>
+#include <kpathsea/hash.h>
+#include <kpathsea/line.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/readable.h>
+#include <kpathsea/str-list.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/variable.h>
+
+static hash_table_type db; /* The hash table for all the ls-R's.  */
+#ifndef DB_HASH_SIZE
+#define DB_HASH_SIZE 7603  /* A minimal ls-R has about 3500 entries.  */
+#endif
+#ifndef DB_NAME
+#define DB_NAME "ls-R"
+#endif
+
+static hash_table_type alias_db;
+#ifndef ALIAS_NAME
+#define ALIAS_NAME "aliases"
+#endif
+#ifndef ALIAS_HASH_SIZE
+#define ALIAS_HASH_SIZE 1009
+#endif
+
+static str_list_type db_dir_list;
+
+/* If DIRNAME contains any element beginning with a `.' (that is more
+   than just `./'), return true.  This is to allow ``hidden''
+   directories -- ones that don't get searched.  */
+
+static boolean
+ignore_dir_p P1C(const_string, dirname)
+{
+  const_string dot_pos = dirname;
+  
+  while ((dot_pos = strchr (dot_pos + 1, '.'))) {
+    /* If / before and no / after, skip it. */
+    if (IS_DIR_SEP (dot_pos[-1]) && dot_pos[1] && !IS_DIR_SEP (dot_pos[1]))
+      return true;
+  }
+  
+  return false;
+}
+
+/* If no DB_FILENAME, return false (maybe they aren't using this feature).
+   Otherwise, add entries from DB_FILENAME to TABLE, and return true.  */
+
+static boolean
+db_build P2C(hash_table_type *, table,  const_string, db_filename)
+{
+  string line;
+  unsigned dir_count = 0, file_count = 0, ignore_dir_count = 0;
+  unsigned len = strlen (db_filename) - sizeof (DB_NAME) + 1; /* Keep the /. */
+  string top_dir = xmalloc (len + 1);
+  string cur_dir = NULL; /* First thing in ls-R might be a filename.  */
+  FILE *db_file = fopen (db_filename, FOPEN_R_MODE);
+  
+  strncpy (top_dir, db_filename, len);
+  top_dir[len] = 0;
+  
+  if (db_file) {
+    while ((line = read_line (db_file)) != NULL) {
+      len = strlen (line);
+
+      /* A line like `/foo:' = new dir foo.  Allow both absolute (/...)
+         and explicitly relative (./...) names here.  It's a kludge to
+         pass in the directory name with the trailing : still attached,
+         but it doesn't actually hurt.  */
+      if (len > 0 && line[len - 1] == ':' && kpse_absolute_p (line, true)) {
+        /* New directory line.  */
+        if (!ignore_dir_p (line)) {
+          /* If they gave a relative name, prepend full directory name now.  */
+          line[len - 1] = DIR_SEP;
+          /* Skip over leading `./', it confuses `match' and is just a
+             waste of space, anyway.  This will lose on `../', but `match'
+             won't work there, either, so it doesn't matter.  */
+          cur_dir = *line == '.' ? concat (top_dir, line + 2) : xstrdup (line);
+          dir_count++;
+        } else {
+          cur_dir = NULL;
+          ignore_dir_count++;
+        }
+
+      /* Ignore blank, `.' and `..' lines.  */
+      } else if (*line != 0 && cur_dir   /* a file line? */
+                 && !(*line == '.'
+                      && (line[1] == '0' || (line[1] == '.' && line[2] == 0))))
+       {/* Make a new hash table entry with a key of `line' and a data
+           of `cur_dir'.  An already-existing identical key is ok, since
+           a file named `foo' can be in more than one directory.  Share
+           `cur_dir' among all its files (and hence never free it). */
+        hash_insert (table, xstrdup (line), cur_dir);
+        file_count++;
+
+      } /* else ignore blank lines or top-level files
+           or files in ignored directories*/
+
+      free (line);
+    }
+
+    xfclose (db_file, db_filename);
+
+    if (file_count == 0) {
+      WARNING1 ("kpathsea: No usable entries in %s", db_filename);
+      WARNING ("kpathsea: See the manual for how to generate ls-R");
+      db_file = NULL;
+    } else {
+      str_list_add (&db_dir_list, xstrdup (top_dir));
+    }
+
+#ifdef KPSE_DEBUG
+    if (KPSE_DEBUG_P (KPSE_DEBUG_HASH)) {
+      /* Don't make this a debugging bit, since the output is so
+         voluminous, and being able to specify -1 is too useful.
+         Instead, let people who want it run the program under
+         a debugger and change the variable that way.  */
+      boolean hash_summary_only = true;
+
+      DEBUGF4 ("%s: %u entries in %d directories (%d hidden).\n",
+               db_filename, file_count, dir_count, ignore_dir_count);
+      DEBUGF ("ls-R hash table:");
+      hash_print (*table, hash_summary_only);
+      fflush (stderr);
+    }
+#endif /* KPSE_DEBUG */
+  }
+
+  free (top_dir);
+
+  return db_file != NULL;
+}
+
+
+/* Insert FNAME into the hash table.  This is for files that get built
+   during a run.  We wouldn't want to reread all of ls-R, even if it got
+   rebuilt.  */
+
+void
+kpse_db_insert P1C(const_string, passed_fname)
+{
+  /* We might not have found ls-R, or even had occasion to look for it
+     yet, so do nothing if we have no hash table.  */
+  if (db.buckets) {
+    const_string dir_part;
+    string fname = xstrdup (passed_fname);
+    string baseptr = (string) basename (fname);
+    const_string file_part = xstrdup (baseptr);
+
+    *baseptr = '\0';  /* Chop off the filename.  */
+    dir_part = fname; /* That leaves the dir, with the trailing /.  */
+
+    hash_insert (&db, file_part, dir_part);
+  }
+}
+
+/* Return true if FILENAME could be in PATH_ELT, i.e., if the directory
+   part of FILENAME matches PATH_ELT.  Have to consider // wildcards, but
+   $ and ~ expansion have already been done.  */
+     
+static boolean
+match P2C(const_string, filename,  const_string, path_elt)
+{
+  const_string original_filename = filename;
+  boolean matched = false;
+  boolean done = false;
+  
+  for (; !done && *filename && *path_elt; filename++, path_elt++) {
+    if (FILECHARCASEEQ (*filename, *path_elt)) /* normal character match */
+      ;
+
+    else if (IS_DIR_SEP (*path_elt)  /* at // */
+             && original_filename < filename && IS_DIR_SEP (path_elt[-1])) {
+      while (IS_DIR_SEP (*path_elt))
+        path_elt++; /* get past second and any subsequent /'s */
+      if (*path_elt == 0) {
+        /* Trailing //, matches anything. We could make this part of the
+           other case, but it seems pointless to do the extra work.  */
+        matched = true;
+        done = true;
+      } else {
+        /* Intermediate //, have to match rest of PATH_ELT.  */
+        for (; !matched && *filename; filename++) {
+          /* Try matching at each possible character.  */
+          if (IS_DIR_SEP (filename[-1])
+              && FILECHARCASEEQ (*filename, *path_elt))
+            matched = match (filename, path_elt);
+        }
+      }
+    }
+
+    else /* normal character nonmatch, quit */
+      done = true;
+  }
+  
+  /* If we've reached the end of PATH_ELT, check that we're at the last
+     component of FILENAME, we've matched.  */
+  if (!matched && *path_elt == 0) {
+    /* Probably PATH_ELT ended with `vf' or some such, and FILENAME ends
+       with `vf/ptmr.vf'.  In that case, we'll be at a directory
+       separator.  On the other hand, if PATH_ELT ended with a / (as in
+       `vf/'), FILENAME being the same `vf/ptmr.vf', we'll be at the
+       `p'.  Upshot: if we're at a dir separator in FILENAME, skip it.
+       But if not, that's ok, as long as there are no more dir separators.  */
+    if (IS_DIR_SEP (*filename))
+      filename++;
+      
+    while (*filename && !IS_DIR_SEP (*filename))
+      filename++;
+    matched = *filename == 0;
+  }
+  
+  return matched;
+}
+
+
+/* If DB_DIR is a prefix of PATH_ELT, return true; otherwise false.
+   That is, the question is whether to try the db for a file looked up
+   in PATH_ELT.  If PATH_ELT == ".", for example, the answer is no. If
+   PATH_ELT == "/usr/local/lib/texmf/fonts//tfm", the answer is yes.
+   
+   In practice, ls-R is only needed for lengthy subdirectory
+   comparisons, but there's no gain to checking PATH_ELT to see if it is
+   a subdir match, since the only way to do that is to do a string
+   search in it, which is all we do anyway.  */
+   
+static boolean
+elt_in_db P2C(const_string, db_dir,  const_string, path_elt)
+{
+  boolean found = false;
+
+  while (!found && FILECHARCASEEQ (*db_dir++, *path_elt++)) {
+    /* If we've matched the entire db directory, it's good.  */
+    if (*db_dir == 0)
+      found = true;
+ 
+    /* If we've reached the end of PATH_ELT, but not the end of the db
+       directory, it's no good.  */
+    else if (*path_elt == 0)
+      break;
+  }
+
+  return found;
+}
+
+/* If ALIAS_FILENAME exists, read it into TABLE.  */
+
+static boolean
+alias_build P2C(hash_table_type *, table,  const_string, alias_filename)
+{
+  string line, real, alias;
+  unsigned count = 0;
+  FILE *alias_file = fopen (alias_filename, FOPEN_R_MODE);
+
+  if (alias_file) {
+    while ((line = read_line (alias_file)) != NULL) {
+      /* comments or empty */
+      if (*line == 0 || *line == '%' || *line == '#') {
+        ;
+      } else {
+        /* Each line should have two fields: realname aliasname.  */
+        real = line;
+        while (*real && ISSPACE (*real))
+          real++;
+        alias = real;
+        while (*alias && !ISSPACE (*alias))
+          alias++;
+        *alias++ = 0;
+        while (*alias && ISSPACE (*alias)) 
+          alias++;
+        /* Is the check for errors strong enough?  Should we warn the user
+           for potential errors?  */
+        if (strlen (real) != 0 && strlen (alias) != 0) {
+          hash_insert (table, xstrdup (alias), xstrdup (real));
+          count++;
+        }
+      }
+      free (line);
+    }
+
+#ifdef KPSE_DEBUG
+    if (KPSE_DEBUG_P (KPSE_DEBUG_HASH)) {
+      /* As with ls-R above ... */
+      boolean hash_summary_only = true;
+      DEBUGF2 ("%s: %u aliases.\n", alias_filename, count);
+      DEBUGF ("alias hash table:");
+      hash_print (*table, hash_summary_only);
+      fflush (stderr);
+    }
+#endif /* KPSE_DEBUG */
+
+    xfclose (alias_file, alias_filename);
+  }
+
+  return alias_file != NULL;
+}
+
+/* Initialize the path for ls-R files, and read them all into the hash
+   table `db'.  If no usable ls-R's are found, set db.buckets to NULL.  */
+
+void
+kpse_init_db P1H(void)
+{
+  boolean ok = false;
+  const_string db_path = kpse_init_format (kpse_db_format);
+  string *db_files = kpse_all_path_search (db_path, DB_NAME);
+  string *orig_db_files = db_files;
+
+  /* Must do this after the path searching (which ends up calling
+    kpse_db_search recursively), so db.buckets stays NULL.  */
+  db = hash_create (DB_HASH_SIZE);
+
+  while (db_files && *db_files) {
+    if (db_build (&db, *db_files))
+      ok = true;
+    free (*db_files);
+    db_files++;
+  }
+  
+  if (!ok) {
+    /* If db can't be built, leave `size' nonzero (so we don't
+       rebuild it), but clear `buckets' (so we don't look in it).  */
+    free (db.buckets);
+    db.buckets = NULL;
+  }
+
+  free (orig_db_files);
+
+  /* Add the content of any alias databases.  There may exist more than
+     one alias file along DB_NAME files.  This duplicates the above code
+     -- should be a function.  */
+  ok = false;
+  db_files = kpse_all_path_search (db_path, ALIAS_NAME);
+  orig_db_files = db_files;
+
+  alias_db = hash_create (ALIAS_HASH_SIZE);
+
+  while (db_files && *db_files) {
+    if (alias_build (&alias_db, *db_files))
+      ok = true;
+    free (*db_files);
+    db_files++;
+  }
+
+  if (!ok) {
+    free (alias_db.buckets);
+    alias_db.buckets = NULL;
+  }
+
+  free (orig_db_files);
+}
+
+/* Avoid doing anything if this PATH_ELT is irrelevant to the databases. */
+
+str_list_type *
+kpse_db_search P3C(const_string, name,  const_string, orig_path_elt,
+                   boolean, all)
+{
+  string *db_dirs, *orig_dirs, *r;
+  const_string last_slash;
+  string path_elt;
+  boolean done;
+  str_list_type *ret;
+  unsigned e;
+  string *aliases = NULL;
+  boolean relevant = false;
+  
+  /* If we failed to build the database (or if this is the recursive
+     call to build the db path), quit.  */
+  if (db.buckets == NULL)
+    return NULL;
+  
+  /* When tex-glyph.c calls us looking for, e.g., dpi600/cmr10.pk, we
+     won't find it unless we change NAME to just `cmr10.pk' and append
+     `/dpi600' to PATH_ELT.  We are justified in using a literal `/'
+     here, since that's what tex-glyph.c unconditionally uses in
+     DPI_BITMAP_SPEC.  But don't do anything if the / begins NAME; that
+     should never happen.  */
+  last_slash = strrchr (name, '/');
+  if (last_slash && last_slash != name) {
+    unsigned len = last_slash - name + 1;
+    string dir_part = xmalloc (len);
+    strncpy (dir_part, name, len - 1);
+    dir_part[len - 1] = 0;
+    path_elt = concat3 (orig_path_elt, "/", dir_part);
+    name = last_slash + 1;
+  } else
+    path_elt = (string) orig_path_elt;
+
+  /* Don't bother doing any lookups if this `path_elt' isn't covered by
+     any of database directories.  We do this not so much because the
+     extra couple of hash lookups matter -- they don't -- but rather
+     because we want to return NULL in this case, so path_search can
+     know to do a disk search.  */
+  for (e = 0; !relevant && e < STR_LIST_LENGTH (db_dir_list); e++) {
+    relevant = elt_in_db (STR_LIST_ELT (db_dir_list, e), path_elt);
+  }
+  if (!relevant)
+    return NULL;
+
+  /* If we have aliases for this name, use them.  */
+  if (alias_db.buckets)
+    aliases = hash_lookup (alias_db, name);
+
+  if (!aliases) {
+    aliases = XTALLOC1 (string);
+    aliases[0] = NULL;
+  }
+  {  /* Push aliases up by one and insert the original name at the front.  */
+    unsigned i;
+    unsigned len = 1; /* Have NULL element already allocated.  */
+    for (r = aliases; *r; r++)
+      len++;
+    XRETALLOC (aliases, len + 1, string);
+    for (i = len; i > 0; i--) {
+      aliases[i] = aliases[i - 1];
+    }
+    aliases[0] = (string) name;
+  }
+
+  done = false;
+  for (r = aliases; !done && *r; r++) {
+    string try = *r;
+
+    /* We have an ls-R db.  Look up `try'.  */
+    orig_dirs = db_dirs = hash_lookup (db, try);
+
+    ret = XTALLOC1 (str_list_type);
+    *ret = str_list_init ();
+
+    /* For each filename found, see if it matches the path element.  For
+       example, if we have .../cx/cmr10.300pk and .../ricoh/cmr10.300pk,
+       and the path looks like .../cx, we don't want the ricoh file.  */
+    while (!done && db_dirs && *db_dirs) {
+      string db_file = concat (*db_dirs, try);
+      boolean matched = match (db_file, path_elt);
+
+  #ifdef KPSE_DEBUG
+      if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
+        DEBUGF3 ("db:match(%s,%s) = %d\n", db_file, path_elt, matched);
+  #endif
+
+      /* We got a hit in the database.  Now see if the file actually
+         exists, possibly under an alias.  */
+      if (matched) {
+        string found = NULL;
+        if (kpse_readable_file (db_file)) {
+          found = db_file;
+          
+        } else {
+          string *a;
+          
+          free (db_file); /* `db_file' wasn't on disk.  */
+          
+          /* The hit in the DB doesn't exist in disk.  Now try all its
+             aliases.  For example, suppose we have a hierarchy on CD,
+             thus `mf.bas', but ls-R contains `mf.base'.  Find it anyway.
+             Could probably work around this with aliases, but
+             this is pretty easy and shouldn't hurt.  The upshot is that
+             if one of the aliases actually exists, we use that.  */
+          for (a = aliases + 1; *a && !found; a++) {
+            string atry = concat (*db_dirs, *a);
+            if (kpse_readable_file (atry))
+              found = atry;
+            else
+              free (atry);
+          }
+        }
+          
+        /* If we have a real file, add it to the list, maybe done.  */
+        if (found) {
+          str_list_add (ret, found);
+          if (!all && found)
+            done = true;
+        }
+      } else { /* no match in the db */
+        free (db_file);
+      }
+      
+
+      /* On to the next directory, if any.  */
+      db_dirs++;
+    }
+
+    /* This is just the space for the pointers, not the strings.  */
+    if (orig_dirs && *orig_dirs)
+      free (orig_dirs);
+  }
+  
+  free (aliases);
+  
+  /* If we had to break up NAME, free the temporary PATH_ELT.  */
+  if (path_elt != orig_path_elt)
+    free (path_elt);
+
+  return ret;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/db.h
@@ -0,0 +1,42 @@
+/* db.h: lookups in an externally built db file.
+
+Copyright (C) 1994, 95 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_DB_H
+#define KPATHSEA_DB_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+#include <kpathsea/str-list.h>
+
+/* Initialize the database.  Until this is called, no ls-R matches will
+   be found.  */
+extern void kpse_init_db P1H(void);
+
+/* Return list of matches for NAME in the ls-R file matching PATH_ELT.  If
+   ALL is set, return (null-terminated list) of all matches, else just
+   the first.  If no matches, return a pointer to an empty list.  If no
+   databases can be read, or PATH_ELT is not in any of the databases,
+   return NULL.  */
+extern str_list_type *kpse_db_search P3H(const_string name, 
+                                         const_string path_elt, boolean all);
+
+/* Insert the filename FNAME into the database.
+   Called by MakeTeXPK et al.  */
+extern void kpse_db_insert P1H(const_string fname);
+
+#endif /* not KPATHSEA_DB_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/debug.c
@@ -0,0 +1,52 @@
+/* debug.c: Help the user discover what's going on.
+
+Copyright (C) 1993, 94 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#ifdef KPSE_DEBUG /* whole file */
+
+unsigned kpathsea_debug = 0;
+
+/* If the real definitions of fopen or fclose are macros, we lose -- the
+   #undef won't restore them. */
+
+FILE *
+fopen P2C(const_string, filename,  const_string, mode)
+{
+#undef fopen
+  FILE *ret = fopen (filename, mode);
+
+  if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN))
+    DEBUGF3 ("fopen(%s, %s) => 0x%lx\n", filename, mode, (unsigned long) ret);
+
+  return ret;
+}
+
+int
+fclose P1C(FILE *, f)
+{
+#undef fclose
+  int ret = fclose (f);
+  
+  if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN))
+    DEBUGF2 ("fclose(0x%lx) => %d\n", (unsigned long) f, ret);
+
+  return ret;
+}
+
+#endif /* KPSE DEBUG */
new file mode 100644
--- /dev/null
+++ b/kpathsea/debug.h
@@ -0,0 +1,73 @@
+/* debug.h: Runtime tracing.
+
+Copyright (C) 1993, 94, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_DEBUG_H
+#define KPATHSEA_DEBUG_H
+
+/* If NO_DEBUG is defined (not recommended), skip all this.  */
+#ifndef NO_DEBUG
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/c-std.h>
+#include <kpathsea/types.h>
+
+/* OK, we'll have tracing support.  */
+#define KPSE_DEBUG
+
+/* Bit vector defining what we should trace.  */
+extern DllImport unsigned kpathsea_debug;
+
+/* Set a bit.  */
+#define KPSE_DEBUG_SET(bit) kpathsea_debug |= 1 << (bit)
+
+/* Test if a bit is on.  */
+#define KPSE_DEBUG_P(bit) (kpathsea_debug & (1 << (bit)))
+
+#define KPSE_DEBUG_STAT 0		/* stat calls */
+#define KPSE_DEBUG_HASH 1		/* hash lookups */
+#define KPSE_DEBUG_FOPEN 2		/* fopen/fclose calls */
+#define KPSE_DEBUG_PATHS 3		/* search path initializations */
+#define KPSE_DEBUG_EXPAND 4		/* path element expansion */
+#define KPSE_DEBUG_SEARCH 5		/* searches */
+#define KPSE_LAST_DEBUG KPSE_DEBUG_SEARCH
+
+/* A printf for the debugging.  */
+#define DEBUGF_START() do { fputs ("kdebug:", stderr)
+#define DEBUGF_END()        fflush (stderr); } while (0)
+
+#define DEBUGF(str)							\
+  DEBUGF_START (); fputs (str, stderr); DEBUGF_END ()
+#define DEBUGF1(str, e1)						\
+  DEBUGF_START (); fprintf (stderr, str, e1); DEBUGF_END ()
+#define DEBUGF2(str, e1, e2)						\
+  DEBUGF_START (); fprintf (stderr, str, e1, e2); DEBUGF_END ()
+#define DEBUGF3(str, e1, e2, e3)					\
+  DEBUGF_START (); fprintf (stderr, str, e1, e2, e3); DEBUGF_END ()
+#define DEBUGF4(str, e1, e2, e3, e4)					\
+  DEBUGF_START (); fprintf (stderr, str, e1, e2, e3, e4); DEBUGF_END ()
+
+#undef fopen
+#define fopen kpse_fopen_trace
+extern FILE *fopen P2H(const_string filename, const_string mode);
+#undef fclose
+#define fclose kpse_fclose_trace
+extern int fclose P1H(FILE *);
+
+#endif /* not NO_DEBUG */
+
+#endif /* not KPATHSEA_DEBUG_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/default.h
@@ -0,0 +1,32 @@
+/* default.h: Declare default path expander.
+
+Copyright (C) 1993, 94 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_DEFAULT_H
+#define KPATHSEA_DEFAULT_H
+
+#include <kpathsea/types.h>
+#include <kpathsea/c-proto.h>
+
+
+/* Replace a leading or trailing or doubled : in PATH with DFLT.  If
+   no extra colons, return PATH.  Only one extra colon is replaced.
+   DFLT may not be NULL.  */
+
+extern string kpse_expand_default P2H(const_string path, const_string dflt);
+
+#endif /* not KPATHSEA_DEFAULT_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/dir.c
@@ -0,0 +1,85 @@
+/* dir.c: directory operations.
+
+Copyright (C) 1992, 93, 94, 95 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-dir.h>
+#include <kpathsea/c-stat.h>
+#include <kpathsea/hash.h>
+
+
+/* Return true if FN is a directory or a symlink to a directory,
+   false if not. */
+
+boolean
+dir_p P1C(const_string, fn)
+{
+  struct stat stats;
+  return stat (fn, &stats) == 0 && S_ISDIR (stats.st_mode);
+}
+
+
+/* Return -1 if FN isn't a directory, else its number of links.
+   Duplicate the call to stat; no need to incur overhead of a function
+   call for that little bit of cleanliness. */
+
+int
+dir_links P1C(const_string, fn)
+{
+  static hash_table_type link_table;
+  string *hash_ret;
+  long ret;
+  
+  if (link_table.size == 0)
+    link_table = hash_create (457);
+
+#ifdef KPSE_DEBUG
+  /* This is annoying, but since we're storing integers as pointers, we
+     can't print them as strings.  */
+  if (KPSE_DEBUG_P (KPSE_DEBUG_HASH))
+    kpse_debug_hash_lookup_int = true;
+#endif
+
+  hash_ret = hash_lookup (link_table, fn);
+  
+#ifdef KPSE_DEBUG
+  if (KPSE_DEBUG_P (KPSE_DEBUG_HASH))
+    kpse_debug_hash_lookup_int = false;
+#endif
+
+  /* Have to cast the int we need to/from the const_string that the hash
+     table stores for values. Let's hope an int fits in a pointer.  */
+  if (hash_ret)
+    ret = (long) *hash_ret;
+  else
+    {
+      struct stat stats;
+      ret = stat (fn, &stats) == 0 && S_ISDIR (stats.st_mode)
+            ? stats.st_nlink : -1;
+
+      /* It's up to us to copy the value.  */
+      hash_insert (&link_table, xstrdup (fn), (const_string) ret);
+      
+#ifdef KPSE_DEBUG
+      if (KPSE_DEBUG_P (KPSE_DEBUG_STAT))
+        DEBUGF2 ("dir_links(%s) => %ld\n", fn, ret);
+#endif
+    }
+
+  return ret;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/elt-dirs.c
@@ -0,0 +1,453 @@
+/* elt-dirs.c: Translate a path element to its corresponding director{y,ies}.
+
+Copyright (C) 1993, 94, 95, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/expand.h>
+#include <kpathsea/fn.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/xopendir.h>
+
+/* To avoid giving prototypes for all the routines and then their real
+   definitions, we give all the subroutines first.  The entry point is
+   the last routine in the file.  */
+
+/* Make a copy of DIR (unless it's null) and save it in L.  Ensure that
+   DIR ends with a DIR_SEP for the benefit of later searches.  */
+
+static void
+dir_list_add P2C(str_llist_type *, l,  const_string, dir)
+{
+  char last_char = dir[strlen (dir) - 1];
+  string saved_dir
+    = IS_DIR_SEP (last_char) || IS_DEVICE_SEP (last_char)
+      ? xstrdup (dir)
+      : concat (dir, DIR_SEP_STRING);
+  
+  str_llist_add (l, saved_dir);
+}
+
+
+/* If DIR is a directory, add it to the list L.  */
+
+static void
+checked_dir_list_add P2C(str_llist_type *, l,  const_string, dir)
+{
+  if (dir_p (dir))
+    dir_list_add (l, dir);
+}
+
+/* The cache.  Typically, several paths have the same element; for
+   example, /usr/local/lib/texmf/fonts//.  We don't want to compute the
+   expansion of such a thing more than once.  Even though we also cache
+   the dir_links call, that's not enough -- without this path element
+   caching as well, the execution time doubles.  */
+
+typedef struct
+{
+  const_string key;
+  str_llist_type *value;
+} cache_entry;
+
+static cache_entry *the_cache = NULL;
+static unsigned cache_length = 0;
+
+
+/* Associate KEY with VALUE.  We implement the cache as a simple linear
+   list, since it's unlikely to ever be more than a dozen or so elements
+   long.  We don't bother to check here if PATH has already been saved;
+   we always add it to our list.  We copy KEY but not VALUE; not sure
+   that's right, but it seems to be all that's needed.  */
+
+static void
+cache P2C(const_string, key,  str_llist_type *, value)
+{
+  cache_length++;
+  XRETALLOC (the_cache, cache_length, cache_entry);
+  the_cache[cache_length - 1].key = xstrdup (key);
+  the_cache[cache_length - 1].value = value;
+}
+
+
+/* To retrieve, just check the list in order.  */
+
+static str_llist_type *
+cached P1C(const_string, key)
+{
+  unsigned p;
+  
+  for (p = 0; p < cache_length; p++)
+    {
+      if (FILESTRCASEEQ (the_cache[p].key, key))
+        return the_cache[p].value;
+    }
+  
+  return NULL;
+}
+
+/* Handle the magic path constructs.  */
+
+/* Declare recursively called routine.  */
+static void expand_elt P3H(str_llist_type *, const_string, unsigned);
+
+
+/* POST is a pointer into the original element (which may no longer be
+   ELT) to just after the doubled DIR_SEP, perhaps to the null.  Append
+   subdirectories of ELT (up to ELT_LENGTH, which must be a /) to
+   STR_LIST_PTR.  */
+
+#ifdef WIN32
+/* Shared across recursive calls, it acts like a stack. */
+static char dirname[MAX_PATH];
+#endif
+
+static void
+do_subdir P4C(str_llist_type *, str_list_ptr,  const_string, elt,
+              unsigned, elt_length,  const_string, post)
+{
+#ifdef WIN32
+  WIN32_FIND_DATA find_file_data;
+  HANDLE hnd;
+  int proceed;
+#else
+  DIR *dir;
+  struct dirent *e;
+#endif /* not WIN32 */
+  fn_type name;
+  
+  /* Some old compilers don't allow aggregate initialization.  */
+  name = fn_copy0 (elt, elt_length);
+  
+  assert (IS_DIR_SEP (elt[elt_length - 1])
+          || IS_DEVICE_SEP (elt[elt_length - 1]));
+  
+#if defined (WIN32)
+  strcpy(dirname, FN_STRING(name));
+  strcat(dirname, "/*.*");         /* "*.*" or "*" -- seems equivalent. */
+  hnd = FindFirstFile(dirname, &find_file_data);
+
+  if (hnd == INVALID_HANDLE_VALUE) {
+    fn_free(&name);
+    return;
+  }
+
+  /* Include top level before subdirectories, if nothing to match.  */
+  if (*post == 0)
+    dir_list_add (str_list_ptr, FN_STRING (name));
+  else {
+    /* If we do have something to match, see if it exists.  For
+       example, POST might be `pk/ljfour', and they might have a
+       directory `$TEXMF/fonts/pk/ljfour' that we should find.  */
+    fn_str_grow (&name, post);
+    if (dir_p (FN_STRING (name)))
+      dir_list_add (str_list_ptr, FN_STRING (name));
+      fn_shrink_to (&name, elt_length);
+  }
+  proceed = 1;
+  while (proceed) {
+    if (find_file_data.cFileName[0] != '.') {
+      /* Construct the potential subdirectory name.  */
+      fn_str_grow (&name, find_file_data.cFileName);
+      if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+	unsigned potential_len = FN_LENGTH (name);
+	
+	/* It's a directory, so append the separator.  */
+	fn_str_grow (&name, DIR_SEP_STRING);
+
+	if (*post != 0) { 
+	  fn_str_grow (&name, post);
+	  /* Unfortunately we can't check if the new element is
+	     a leaf directory, because we don't have a directory
+	     name here, we just have a path spec. This means we
+	     may descend into a leaf directory cm/pk, if the
+	     spec is ...fonts//pk//.  */
+	  expand_elt (str_list_ptr, FN_STRING (name), potential_len);
+	  fn_shrink_to (&name, potential_len);
+	}
+	do_subdir (str_list_ptr, FN_STRING (name),
+		   potential_len, post);
+      }
+      fn_shrink_to (&name, elt_length);
+    }
+    proceed = FindNextFile (hnd, &find_file_data);
+  }
+  fn_free (&name);
+  FindClose(hnd);
+
+#else /* not WIN32 */
+
+  /* If we can't open it, quit.  */
+  dir = opendir (FN_STRING (name));
+  if (dir == NULL)
+    {
+      fn_free (&name);
+      return;
+    }
+  
+  /* Include top level before subdirectories, if nothing to match.  */
+  if (*post == 0)
+    dir_list_add (str_list_ptr, FN_STRING (name));
+  else
+    { /* If we do have something to match, see if it exists.  For
+         example, POST might be `pk/ljfour', and they might have a
+         directory `$TEXMF/fonts/pk/ljfour' that we should find.  */
+      fn_str_grow (&name, post);
+      if (dir_p (FN_STRING (name)))
+        dir_list_add (str_list_ptr, FN_STRING (name));
+      fn_shrink_to (&name, elt_length);
+    }
+
+  while ((e = readdir (dir)) != NULL)
+    { /* If it begins with a `.', never mind.  (This allows ``hidden''
+         directories that the algorithm won't find.)  */
+      if (e->d_name[0] != '.')
+        {
+          int links;
+          
+          /* Construct the potential subdirectory name.  */
+          fn_str_grow (&name, e->d_name);
+          
+          /* If we can't stat it, or if it isn't a directory, continue.  */
+          links = dir_links (FN_STRING (name));
+
+          if (links >= 0)
+            { 
+              unsigned potential_len = FN_LENGTH (name);
+              
+              /* It's a directory, so append the separator.  */
+              fn_str_grow (&name, DIR_SEP_STRING);
+              
+              if (*post != 0)
+                { 
+                  fn_str_grow (&name, post);
+                  /* Unfortunately we can't check if the new element is
+                     a leaf directory, because we don't have a directory
+                     name here, we just have a path spec. This means we
+                     may descend into a leaf directory cm/pk, if the
+                     spec is ...fonts//pk//.  */
+                  expand_elt (str_list_ptr, FN_STRING (name), potential_len);
+                  fn_shrink_to (&name, potential_len);
+                }
+              
+              /* Should we recurse?  To see if the subdirectory is a
+                 leaf, check if it has two links (one for . and one for
+                 ..).  This means that symbolic links to directories do
+                 not affect the leaf-ness.  This is arguably wrong, but
+                 the only alternative I know of is to stat every entry
+                 in the directory, and that is unacceptably slow.
+                 
+                 The #ifdef here makes all this configurable at
+                 compile-time, so that if we're using VMS directories or
+                 some such, we can still find subdirectories, even if it
+                 is much slower.  */
+#ifdef ST_NLINK_TRICK
+#ifdef AMIGA
+              /* With SAS/C++ 6.55 on the Amiga, `stat' sets the `st_nlink'
+                 field to -1 for a file, or to 1 for a directory.  */
+              if (links == 1)
+#else
+              if (links > 2)
+#endif /* not AMIGA */
+#endif /* not ST_NLINK_TRICK */
+                /* All criteria are met; find subdirectories.  */
+                do_subdir (str_list_ptr, FN_STRING (name),
+                           potential_len, post);
+#ifdef ST_NLINK_TRICK
+              else if (*post == 0)
+                /* Nothing to match, no recursive subdirectories to
+                   look for: we're done with this branch.  Add it.  */
+                dir_list_add (str_list_ptr, FN_STRING (name));
+#endif
+            }
+
+          /* Remove the directory entry we just checked from `name'.  */
+          fn_shrink_to (&name, elt_length);
+        }
+    }
+  
+  fn_free (&name);
+  xclosedir (dir);
+#endif /* not WIN32 */
+}
+
+
+/* Assume ELT is non-empty and non-NULL.  Return list of corresponding
+   directories (with no terminating NULL entry) in STR_LIST_PTR.  Start
+   looking for magic constructs at START.  */
+
+static void
+expand_elt P3C(str_llist_type *, str_list_ptr,  const_string, elt,
+               unsigned, start)
+{
+  boolean found_special = false;
+  const_string dir = elt + start;
+  
+  while (*dir != 0)
+    {
+      if (IS_DIR_SEP (*dir))
+        {
+          /* If two or more consecutive /'s, find subdirectories.  */
+          if (IS_DIR_SEP (dir[1]))
+            {
+              unsigned slash_count;
+              for (slash_count = 1; IS_DIR_SEP (dir[slash_count + 1]);
+                   slash_count++) ;
+              do_subdir (str_list_ptr, elt, dir - elt + 1,
+                         dir + 1 + slash_count);
+              found_special = true;
+              dir += slash_count; /* Don't find this // again.  */
+            }
+
+          /* No special stuff at this slash.  Keep going.  */
+        }
+      
+      dir++;
+    }
+  
+  if (!found_special)
+    /* When we reach the end of ELT, it will be a normal filename.  */
+    checked_dir_list_add (str_list_ptr, elt);
+}
+
+/* Here is the entry point.  Returns directory list for ELT.  */
+
+str_llist_type *
+kpse_element_dirs P1C(const_string, elt)
+{
+  str_llist_type *ret;
+
+  /* If given nothing, return nothing.  */
+  if (!elt)
+    return NULL;
+
+  /* If we've already cached the answer for ELT, return it.  */
+  ret = cached (elt);
+  if (ret)
+    return ret;
+
+  /* We're going to have a real directory list to return.  */
+  ret = XTALLOC1 (str_llist_type);
+  *ret = NULL;
+  
+  /* If ELT is the empty string, just return cwd.  */
+  if (*elt == 0)
+    { /* Some old compilers do not support aggregate initialization.  */
+      char cwd[3];
+      cwd[0] = '.';
+      cwd[1] = DIR_SEP;
+      cwd[2] = 0;
+      
+      checked_dir_list_add (ret, cwd);
+    }
+
+  /* OK, so much for the trivial cases.  We handle the hard case in
+     a subroutine.  */
+  else
+    expand_elt (ret, elt, 0);
+
+  /* Remember the directory list we just found, in case future calls are
+     made with the same ELT.  */
+  cache (elt, ret);
+
+#ifdef KPSE_DEBUG
+  if (KPSE_DEBUG_P (KPSE_DEBUG_EXPAND))
+    {
+      DEBUGF1 ("path element %s =>", elt);
+      if (ret)
+        {
+          str_llist_elt_type *e;
+          for (e = *ret; e; e = STR_LLIST_NEXT (*e))
+            fprintf (stderr, " %s", STR_LLIST (*e));
+        }
+      putc ('\n', stderr);
+      fflush (stderr);
+    }
+#endif /* KPSE_DEBUG */
+
+  return ret;
+}
+
+#ifdef TEST
+
+void
+print_element_dirs (const_string elt)
+{
+  str_llist_type *dirs;
+  
+  printf ("Directories of %s:\t", elt ? elt : "(nil)");
+  fflush (stdout);
+  
+  dirs = kpse_element_dirs (elt);
+  
+  if (!dirs)
+    printf ("(null)");
+  else
+    {
+      str_llist_elt_type *dir;
+      for (dir = *dirs; dir; dir = STR_LLIST_NEXT (*dir))
+        {
+          string d = STR_LLIST (*dir);
+          printf ("%s ", *d ? d : "`'");
+        }
+    }
+  
+  putchar ('\n');
+}
+
+int
+main ()
+{
+  /* DEBUG_SET (DEBUG_STAT); */
+#ifdef AMIGA
+  print_element_dirs (NULL);		/* */
+  print_element_dirs ("");		/* ./ */
+  print_element_dirs ("/kpathsea");	/* /kpathsea/ */
+  print_element_dirs (".//");		/* ./ */
+  print_element_dirs (":fonts//");	/* lots */
+  print_element_dirs (":fonts//public/ascii//"); /* several */
+  print_element_dirs (":fonts//");	/* lots again [cache] */
+  print_element_dirs ("texmf:");	/* texmf: */
+  print_element_dirs ("texmf:/");	/* texmf: and all subdirs */
+  print_element_dirs ("${LOGNAME}");	/* ??? */  
+#else /* not AMIGA */
+  /* All lists end with NULL.  */
+  print_element_dirs (NULL);	/* */
+  print_element_dirs ("");	/* ./ */
+  print_element_dirs ("/k");	/* */
+  print_element_dirs (".//");	/* ./ ./archive/ */
+  print_element_dirs (".//archive");	/* ./ ./archive/ */
+  print_element_dirs ("/tmp/fonts//");	/* no need to stat anything */
+  print_element_dirs ("/usr/local/lib/tex/fonts//");      /* lots */
+  print_element_dirs ("/usr/local/lib/tex/fonts//times"); /* just one */
+  print_element_dirs ("/usr/local/lib/tex/fonts//"); /* lots again [cache] */
+  print_element_dirs ("~karl");		/* tilde expansion */
+  print_element_dirs ("$karl");		/* variable expansion */  
+  print_element_dirs ("~${LOGNAME}");	/* both */  
+#endif /* not AMIGA */
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+test-compile-command: "gcc -g -I. -I.. -DTEST elt-dirs.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/expand.c
@@ -0,0 +1,463 @@
+/* expand.c: general expansion.  Some of this file (the brace-expansion
+   code from bash) is covered by the GPL; this is the only GPL-covered
+   code in kpathsea.  The part of the file that I wrote (the first
+   couple of functions) is covered by the LGPL.
+
+Copyright (C) 1993, 94, 95, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/expand.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/tilde.h>
+#include <kpathsea/variable.h>
+
+
+/* Do variable expansion first so ~${USER} works.  (Besides, it's what the
+   shells do.)  */
+
+string
+kpse_expand P1C(const_string, s)
+{
+  string var_expansion = kpse_var_expand (s);
+  string tilde_expansion = kpse_tilde_expand (var_expansion);
+  
+  /* `kpse_var_expand' always gives us new memory; `kpse_tilde_expand'
+     doesn't, necessarily.  So be careful that we don't free what we are
+     about to return.  */
+  if (tilde_expansion != var_expansion)
+    free (var_expansion);
+  
+  return tilde_expansion;
+}
+
+
+static char **brace_expand P1H(const_string);
+static void free_array P1H(char **);
+
+/* Do brace expansion on ELT; then do variable and ~ expansion on each
+   element of the result; then do brace expansion again, in case a
+   variable definition contained braces (e.g., $TEXMF).  Return a
+   string comprising all of the results separated by ENV_SEP_STRING.  */
+
+static string
+kpse_brace_expand P1C(const_string, elt)
+{
+  unsigned i;
+  string *expansions = brace_expand (elt);
+  string ret = xmalloc (1);
+  *ret = 0;
+  
+  for (i = 0; expansions[i]; i++) {
+    /* Do $ and ~ expansion on each element.  */
+    string x = kpse_expand (expansions[i]);
+    string save_ret = ret;
+    if (!STREQ (x, expansions[i])) {
+      /* If we did any expansions, do brace expansion again.  Since
+         recursive variable definitions are not allowed, this recursion
+         must terminate.  (In practice, it's unlikely there will ever be
+         more than one level of recursion.)  */
+      string save_x = x;
+      x = kpse_brace_expand (x);
+      free (save_x);
+    }
+    ret = concat3 (ret, x, ENV_SEP_STRING);
+    free (save_ret);
+    free (x);
+  }
+  
+  free_array (expansions);
+  ret[strlen (ret) - 1] = 0; /* waste the trailing null */
+  return ret;
+}
+
+
+/* Be careful to not waste all the memory we allocate for each element.  */
+
+string
+kpse_path_expand P1C(const_string, path)
+{
+  string elt;
+  /* Must do variable expansion first because if we have
+       foo = .:~
+       TEXINPUTS = $foo
+     we want to end up with TEXINPUTS = .:/home/karl.
+     Since kpse_path_element is not reentrant, we must get all
+     the path elements before we start the loop.  */
+  string xpath = kpse_var_expand (path);
+  string ret = xmalloc (1);
+  *ret = 0;
+  
+  for (elt = kpse_path_element (xpath); elt; elt = kpse_path_element (NULL)) {
+    string save_ret = ret;
+    /* Do brace expansion first, so tilde expansion happens in {~ka,~kb}.  */
+    string expansion = kpse_brace_expand (elt);
+    ret = concat3 (ret, expansion, ENV_SEP_STRING);
+    free (expansion);
+    free (save_ret);
+  }
+    
+  /* Waste the last byte by overwriting the trailing env_sep with a null.  */
+  ret[strlen (ret) - 1] = 0;
+  free (xpath);
+  
+  return ret;
+}
+
+/* braces.c -- code for doing word expansion in curly braces. Taken from
+   bash 1.14.5.
+
+   Copyright (C) 1987,1991 Free Software Foundation, Inc.
+
+   This program 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 1, or (at your option)
+   any later version.
+
+   This program 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 program; see the file COPYING.  If not, write to the
+   Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.  */
+
+
+#define brace_whitespace(c) (!(c) || (c) == ' ' || (c) == '\t' || (c) == '\n')
+#define savestring xstrdup
+
+/* Basic idea:
+
+   Segregate the text into 3 sections: preamble (stuff before an open brace),
+   postamble (stuff after the matching close brace) and amble (stuff after
+   preamble, and before postamble).  Expand amble, and then tack on the
+   expansions to preamble.  Expand postamble, and tack on the expansions to
+   the result so far.
+ */
+
+/* The character which is used to separate arguments. */
+static int brace_arg_separator = ',';
+
+static int brace_gobbler P3H(const_string, int *, int);
+static char **expand_amble P1H(const_string),
+            **array_concat P2H(string * , string *);
+
+/* Return the length of ARRAY, a NULL terminated array of char *. */
+static int
+array_len P1C(char **, array)
+{
+  register int i;
+  for (i = 0; array[i]; i++);
+  return (i);
+}
+
+/* Free the contents of ARRAY, a NULL terminated array of char *. */
+static void
+free_array P1C(char **, array)
+{
+  register int i = 0;
+
+  if (!array) return;
+
+  while (array[i])
+    free (array[i++]);
+  free (array);
+}
+
+/* Allocate and return a new copy of ARRAY and its contents. */
+static char **
+copy_array P1C(char **, array)
+{
+  register int i;
+  int len;
+  char **new_array;
+
+  len = array_len (array);
+
+  new_array = (char **)xmalloc ((len + 1) * sizeof (char *));
+  for (i = 0; array[i]; i++)
+    new_array[i] = savestring (array[i]);
+  new_array[i] = (char *)NULL;
+
+  return (new_array);
+}
+
+
+/* Return an array of strings; the brace expansion of TEXT. */
+static char **
+brace_expand P1C(const_string, text)
+{
+  register int start;
+  char *preamble, *amble;
+  const_string postamble;
+  char **tack, **result;
+  int i, c;
+
+  /* Find the text of the preamble. */
+  i = 0;
+  c = brace_gobbler (text, &i, '{');
+
+  preamble = xmalloc (i + 1);
+  strncpy (preamble, text, i);
+  preamble[i] = 0;
+
+  result = xmalloc (2 * sizeof (char *));
+  result[0] = preamble;
+  result[1] = NULL;
+  
+  /* Special case.  If we never found an exciting character, then
+     the preamble is all of the text, so just return that. */
+  if (c != '{')
+    return (result);
+
+  /* Find the amble.  This is the stuff inside this set of braces. */
+  start = ++i;
+  c = brace_gobbler (text, &i, '}');
+
+  /* What if there isn't a matching close brace? */
+  if (!c)
+    {
+      WARNING1 ("%s: Unmatched {", text);
+      free (preamble);		/* Same as result[0]; see initialization. */
+      result[0] = savestring (text);
+      return (result);
+    }
+
+  amble = xmalloc (1 + (i - start));
+  strncpy (amble, &text[start], (i - start));
+  amble[i - start] = 0;
+
+  postamble = &text[i + 1];
+
+  tack = expand_amble (amble);
+  result = array_concat (result, tack);
+  free (amble);
+  free_array (tack);
+
+  tack = brace_expand (postamble);
+  result = array_concat (result, tack);
+  free_array (tack);
+
+  return (result);
+}
+
+
+/* Expand the text found inside of braces.  We simply try to split the
+   text at BRACE_ARG_SEPARATORs into separate strings.  We then brace
+   expand each slot which needs it, until there are no more slots which
+   need it. */
+static char **
+expand_amble P1C(const_string, text)
+{
+  char **result, **partial;
+  char *tem;
+  int start, i, c;
+
+  result = NULL;
+
+  for (start = 0, i = 0, c = 1; c; start = ++i)
+    {
+      c = brace_gobbler (text, &i, brace_arg_separator);
+      tem = xmalloc (1 + (i - start));
+      strncpy (tem, &text[start], (i - start));
+      tem[i- start] = 0;
+
+      partial = brace_expand (tem);
+
+      if (!result)
+	result = partial;
+      else
+	{
+	  register int lr = array_len (result);
+	  register int lp = array_len (partial);
+	  register int j;
+
+	  result = xrealloc (result, (1 + lp + lr) * sizeof (char *));
+
+	  for (j = 0; j < lp; j++)
+	    result[lr + j] = partial[j];
+
+	  result[lr + j] = NULL;
+	  free (partial);
+	}
+      free (tem);
+    }
+  return (result);
+}
+
+/* Return a new array of strings which is the result of appending each
+   string in ARR2 to each string in ARR1.  The resultant array is
+   len (arr1) * len (arr2) long.  For convenience, ARR1 (and its contents)
+   are free ()'ed.  ARR1 can be NULL, in that case, a new version of ARR2
+   is returned. */
+static char **
+array_concat P2C(string *, arr1,  string *, arr2)
+{
+  register int i, j, len, len1, len2;
+  register char **result;
+
+  if (!arr1)
+    return (copy_array (arr2));
+
+  if (!arr2)
+    return (copy_array (arr1));
+
+  len1 = array_len (arr1);
+  len2 = array_len (arr2);
+
+  result = xmalloc ((1 + (len1 * len2)) * sizeof (char *));
+
+  len = 0;
+  for (i = 0; i < len1; i++)
+    {
+      int strlen_1 = strlen (arr1[i]);
+
+      for (j = 0; j < len2; j++)
+	{
+	  result[len] =
+	    xmalloc (1 + strlen_1 + strlen (arr2[j]));
+	  strcpy (result[len], arr1[i]);
+	  strcpy (result[len] + strlen_1, arr2[j]);
+	  len++;
+	}
+      free (arr1[i]);
+    }
+  free (arr1);
+
+  result[len] = NULL;
+  return (result);
+}
+
+/* Start at INDEX, and skip characters in TEXT. Set INDEX to the
+   index of the character matching SATISFY.  This understands about
+   quoting.  Return the character that caused us to stop searching;
+   this is either the same as SATISFY, or 0. */
+static int
+brace_gobbler P3C(const_string, text,  int *, indx,  int, satisfy)
+{
+  register int i, c, quoted, level, pass_next;
+
+  level = quoted = pass_next = 0;
+
+  for (i = *indx; (c = text[i]); i++)
+    {
+      if (pass_next)
+	{
+	  pass_next = 0;
+	  continue;
+	}
+
+      /* A backslash escapes the next character.  This allows backslash to
+	 escape the quote character in a double-quoted string. */
+      if (c == '\\' && (quoted == 0 || quoted == '"' || quoted == '`'))
+        {
+          pass_next = 1;
+          continue;
+        }
+
+      if (quoted)
+	{
+	  if (c == quoted)
+	    quoted = 0;
+	  continue;
+	}
+
+      if (c == '"' || c == '\'' || c == '`')
+	{
+	  quoted = c;
+	  continue;
+	}
+      
+      if (c == satisfy && !level && !quoted)
+	{
+	  /* We ignore an open brace surrounded by whitespace, and also
+	     an open brace followed immediately by a close brace, that
+	     was preceded with whitespace.  */
+	  if (c == '{' &&
+	      ((!i || brace_whitespace (text[i - 1])) &&
+	       (brace_whitespace (text[i + 1]) || text[i + 1] == '}')))
+	    continue;
+	  /* If this is being compiled as part of bash, ignore the `{'
+	     in a `${}' construct */
+	  if ((c != '{') || !i || (text[i - 1] != '$'))
+	    break;
+	}
+
+      if (c == '{')
+	level++;
+      else if (c == '}' && level)
+	level--;
+    }
+
+  *indx = i;
+  return (c);
+}
+
+#if defined (TEST)
+#include <stdio.h>
+
+fatal_error (format, arg1, arg2)
+     char *format, *arg1, *arg2;
+{
+  report_error (format, arg1, arg2);
+  exit (1);
+}
+
+report_error (format, arg1, arg2)
+     char *format, *arg1, *arg2;
+{
+  fprintf (stderr, format, arg1, arg2);
+  fprintf (stderr, "\n");
+}
+
+main ()
+{
+  char example[256];
+
+  for (;;)
+    {
+      char **result;
+      int i;
+
+      fprintf (stderr, "brace_expand> ");
+
+      if ((!fgets (example, 256, stdin)) ||
+	  (strncmp (example, "quit", 4) == 0))
+	break;
+
+      if (strlen (example))
+	example[strlen (example) - 1] = 0;
+
+      result = brace_expand (example);
+
+      for (i = 0; result[i]; i++)
+	printf ("%s\n", result[i]);
+
+      free_array (result);
+    }
+}
+
+/*
+ * Local variables:
+ * test-compile-command: "gcc -g -DTEST -I.. -I. -o brace_expand braces.c -L. -lkpathsea"
+ * end:
+ */
+
+#endif /* TEST */
new file mode 100644
--- /dev/null
+++ b/kpathsea/expand.h
@@ -0,0 +1,36 @@
+/* expand.h: general expansion.
+
+Copyright (C) 1993, 94, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_EXPAND_H
+#define KPATHSEA_EXPAND_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+/* Call kpse_var_expand and kpse_tilde_expand (in that order).  Result
+   is always in fresh memory, even if no expansions were done.  */
+extern string kpse_expand P1H(const_string s);
+
+/* Do brace expansion and call `kpse_expand' on each element of the
+   result; return the final expansion (always in fresh memory, even if
+   no expansions were done).  We don't call `kpse_expand_default'
+   because there is a whole sequence of defaults to run through; see
+   `kpse_init_format'.  */
+extern string kpse_path_expand P1H(const_string path);
+
+#endif /* not KPATHSEA_EXPAND_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/extend-fname.c
@@ -0,0 +1,34 @@
+/* extend-fname.c: give a filename a suffix, if necessary.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+/* We may or may not return NAME.  It's up to the caller not to assume
+   the return value is modifiable.  */
+
+string 
+extend_filename P2C(const_string, name, const_string, default_suffix)
+{
+  string new_s;
+  const_string suffix = find_suffix (name);
+
+  new_s = suffix == NULL ? concat3 (name, ".", default_suffix)
+                         : (string) name;
+  return new_s;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/file-p.c
@@ -0,0 +1,37 @@
+/* file-p.c: file predicates.
+
+Copyright (C) 1992, 93, 94 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/xstat.h>
+
+
+/* Test whether FILENAME1 and FILENAME2 are actually the same file.  If
+   stat fails on either of the names, we return false, without error.  */
+
+boolean
+same_file_p P2C(const_string, filename1,  const_string, filename2)
+{
+    struct stat sb1, sb2;
+    /* These are put in variables only so the results can be inspected
+       under gdb.  */
+    int r1 = stat (filename1, &sb1);
+    int r2 = stat (filename2, &sb2);
+
+    return r1 == 0 && r2 == 0 ? SAME_FILE_P (sb1, sb2) : false;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/find-suffix.c
@@ -0,0 +1,45 @@
+/* find-suffix.c: return the stuff after a dot.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-pathch.h>
+
+
+/* Return pointer to first character after `.' in last directory element
+   of NAME.  If the name is `foo' or `/foo.bar/baz', we have no extension.  */
+
+string
+find_suffix P1C(const_string, name)
+{
+  const_string slash_pos;
+  string dot_pos = strrchr (name, '.');
+  
+  if (dot_pos == NULL)
+    return NULL;
+  
+  for (slash_pos = name + strlen (name);
+       slash_pos > dot_pos && !IS_DIR_SEP (*slash_pos);
+       slash_pos--)
+    ;
+  
+  return slash_pos > dot_pos ? NULL : dot_pos + 1;
+}
+
+
+
new file mode 100644
--- /dev/null
+++ b/kpathsea/fn.c
@@ -0,0 +1,119 @@
+/* fn.c: arbitrarily long filenames (or just strings).
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/fn.h>
+
+
+/* /usr/local/lib/texmf/fonts/public/cm/pk/ljfour/cmr10.300pk is 58
+   chars, so ASCII `K' seems a good choice. */
+#define CHUNK_SIZE 75
+
+
+fn_type
+fn_init P1H(void)
+{
+  fn_type ret;
+  
+  FN_ALLOCATED (ret) = FN_LENGTH (ret) = 0;
+  FN_STRING (ret) = NULL;
+  
+  return ret;
+}
+
+
+fn_type
+fn_copy0 P2C(const_string, s,  unsigned, len)
+{
+  fn_type ret;
+  
+  FN_ALLOCATED (ret) = CHUNK_SIZE > len ? CHUNK_SIZE : len + 1;
+  FN_STRING (ret) = xmalloc (FN_ALLOCATED (ret));
+  
+  strncpy (FN_STRING (ret), s, len);
+  FN_STRING (ret)[len] = 0;
+  FN_LENGTH (ret) = len + 1;
+  
+  return ret;
+}
+
+/* Don't think we ever try to free something that might usefully be
+   empty, so give fatal error if nothing allocated.  */
+
+void
+fn_free P1C(fn_type *, f)
+{
+  assert (FN_STRING (*f) != NULL);
+  free (FN_STRING (*f));
+  FN_STRING (*f) = NULL;
+  FN_ALLOCATED (*f) = 0;
+  FN_LENGTH (*f) = 0;
+}
+
+/* An arithmetic increase seems more reasonable than geometric.  We
+   don't increase the length member since it may be more convenient for
+   the caller to add than subtract when appending the stuff that will
+   presumably follow.  */
+
+static void
+grow P2C(fn_type *, f,  unsigned, len)
+{
+  while (FN_LENGTH (*f) + len > FN_ALLOCATED (*f))
+    {
+      FN_ALLOCATED (*f) += CHUNK_SIZE;
+      XRETALLOC (FN_STRING (*f), FN_ALLOCATED (*f), char);
+    }
+}
+
+
+void
+fn_1grow P2C(fn_type *, f,  char, c)
+{
+  grow (f, 1);
+  FN_STRING (*f)[FN_LENGTH (*f)] = c;
+  FN_LENGTH (*f)++;
+}
+
+
+void
+fn_grow P3C(fn_type *, f,  address, source,  unsigned, len)
+{
+  grow (f, len);
+  strncpy (FN_STRING (*f) + FN_LENGTH (*f), source, len);
+  FN_LENGTH (*f) += len;
+}
+
+
+void
+fn_str_grow P2C(fn_type *, f,  const_string, s)
+{
+  unsigned more_len = strlen (s);
+  grow (f, more_len);
+  strcat (FN_STRING (*f), s);
+  FN_LENGTH (*f) += more_len;
+}
+
+
+void
+fn_shrink_to P2C(fn_type *, f,  unsigned, loc)
+{
+  assert (FN_LENGTH (*f) > loc);
+  FN_STRING (*f)[loc] = 0;
+  FN_LENGTH (*f) = loc + 1;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/fn.h
@@ -0,0 +1,67 @@
+/* fn.h: arbitrarily long filenames (or just strings).
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_FN_H
+#define KPATHSEA_FN_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+/* Arbitrarily long filenames; it's inconvenient to use obstacks here,
+   because we want to maintain a null terminator.  Also used for
+   dynamically growing strings even when the null byte isn't necessary,
+   e.g., in `variable.c', since I don't want to pass obstacks around
+   everywhere, and one can't free parts of an obstack arbitrarily.  */
+
+typedef struct
+{
+  string str;
+  unsigned allocated;
+  unsigned length; /* includes the terminating null byte, if any */
+} fn_type;
+
+#define FN_STRING(fn) ((fn).str)
+#define FN_ALLOCATED(fn) ((fn).allocated)
+#define FN_LENGTH(fn) ((fn).length)
+
+
+/* Create a new empty fn.  */
+extern fn_type fn_init P1H(void);
+
+/* Create a new fn from the first LEN characters from S and a null.  */
+extern fn_type fn_copy0 P2H(const_string s,  unsigned len);
+
+/* Free what's been allocated.  Can also just free the string if it's
+   been extracted out.  Fatal error if nothing allocated in F.  */
+extern void fn_free P1H(fn_type *f);
+
+/* Append the character C to the fn F.  Don't append trailing null.  */
+extern void fn_1grow P2H(fn_type *f, char c);
+
+/* Append LENGTH bytes from SOURCE to F.  */
+extern void fn_grow P3H(fn_type *f, address source, unsigned length);
+
+/* Concatenate the component S to the fn F.  Assumes string currently in
+   F is null terminated.  */
+extern void fn_str_grow P2H(fn_type *f, const_string s);
+
+/* Add a null to F's string at position LOC, and update its length.
+   Fatal error if LOC is past the end of the string.  */
+extern void fn_shrink_to P2H(fn_type *f, unsigned loc);
+
+#endif /* not KPATHSEA_FN_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/fontmap.c
@@ -0,0 +1,198 @@
+/* fontmap.c: read files for additional font names.
+
+Copyright (C) 1993, 94, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/fontmap.h>
+#include <kpathsea/hash.h>
+#include <kpathsea/line.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/str-list.h>
+#include <kpathsea/tex-file.h>
+
+/* We have one and only one fontmap, so may as well make it static
+   instead of passing it around.  */
+static hash_table_type map;
+#ifndef MAP_NAME
+#define MAP_NAME "texfonts.map"
+#endif
+#ifndef MAP_HASH_SIZE
+#define MAP_HASH_SIZE 4001
+#endif
+
+static const_string map_path; /* Only want to create this once. */
+
+/* Return next whitespace-delimited token in STR or NULL if none.  */
+
+static string
+token P1C(const_string, str)
+{
+  unsigned len;
+  const_string start;
+  string ret;
+  
+  while (*str && ISSPACE (*str))
+    str++;
+  
+  start = str;
+  while (*str && !ISSPACE (*str))
+    str++;
+  
+  len = str - start;
+  ret = xmalloc (len + 1);
+  strncpy (ret, start, len);
+  ret[len] = 0;
+  
+  return ret;
+}
+
+/* Open and read the mapping file MAP_FILENAME, putting its entries into
+   MAP. Comments begin with % and continue to the end of the line.  Each
+   line of the file defines an entry: the first word is the real
+   filename (e.g., `ptmr'), the second word is the alias (e.g.,
+   `Times-Roman'), and any subsequent words are ignored.  .tfm is added
+   if either the filename or the alias have no extension.  This is the
+   same order as in Dvips' psfonts.map; unfortunately, we can't have TeX
+   read that same file, since most of the real filenames start with an
+   `r', because of the virtual fonts Dvips uses.  */
+
+static void
+map_file_parse P1C(const_string, map_filename)
+{
+  char *orig_l;
+  unsigned map_lineno = 0;
+  FILE *f = xfopen (map_filename, FOPEN_R_MODE);
+  
+  while ((orig_l = read_line (f)) != NULL) {
+    string filename;
+    string l = orig_l;
+    string comment_loc = strrchr (l, '%');
+    if (!comment_loc) {
+      comment_loc = strstr (l, "@c");
+    }
+    
+    /* Ignore anything after a % or @c.  */
+    if (comment_loc)
+      *comment_loc = 0;
+
+    map_lineno++;
+
+    /* Skip leading whitespace so we can use strlen below.  Can't use
+       strtok since this routine is recursive.  */
+    while (*l && ISSPACE (*l))
+      l++;
+      
+    /* If we don't have any filename, that's ok, the line is blank.  */
+    filename = token (l);
+    if (filename) {
+      string alias = token (l + strlen (filename));
+
+      if (STREQ (filename, "include")) {
+        if (alias == NULL) {
+          WARNING2 ("%s:%u: Filename argument for include directive missing",
+                    map_filename, map_lineno);
+        } else {
+          string include_fname = kpse_path_search (map_path, alias, false);
+          if (include_fname) {
+            map_file_parse (include_fname);
+            if (include_fname != alias)
+              free (include_fname);
+          } else {
+            WARNING3 ("%s:%u: Can't find fontname include file `%s'",
+                      map_filename, map_lineno, alias);
+          }
+          free (alias);
+          free (filename);
+        }
+
+      /* But if we have a filename and no alias, something's wrong.  */
+      } else if (alias == NULL) {
+        WARNING3 ("%s:%u: Fontname alias missing for filename `%s'",
+                  map_filename, map_lineno, filename);
+        free (filename);
+
+      } else {
+        /* We've got everything.  Insert the new entry.  They were
+           already dynamically allocated, so don't bother with xstrdup.  */
+        hash_insert (&map, alias, filename);
+      }
+    }
+
+    free (l);
+  }
+  
+  xfclose (f, map_filename);
+}
+
+/* Parse the file MAP_NAME in each of the directories in PATH and
+   return the resulting structure.  Entries in earlier files override
+   later files.  */
+
+static void
+read_all_maps P1H(void)
+{
+  string *filenames;
+  
+  map_path = kpse_init_format (kpse_fontmap_format);
+  filenames = kpse_all_path_search (map_path, MAP_NAME);
+  
+  map = hash_create (MAP_HASH_SIZE);
+
+  while (*filenames) {
+    map_file_parse (*filenames);
+    filenames++;
+  }
+}
+
+/* Look up KEY in texfonts.map's; if it's not found, remove any suffix
+   from KEY and try again.  Create the map if necessary.  */
+
+string *
+kpse_fontmap_lookup P1C(const_string, key)
+{
+  string *ret;
+  string suffix = find_suffix (key);
+  
+  if (map.size == 0) {
+    read_all_maps ();
+  }
+
+  ret = hash_lookup (map, key);
+  if (!ret) {
+    /* OK, the original KEY didn't work.  Let's check for the KEY without
+       an extension -- perhaps they gave foobar.tfm, but the mapping only
+       defines `foobar'.  */
+    if (suffix) {
+      string base_key = remove_suffix (key);
+      ret = hash_lookup (map, base_key);
+      free (base_key);
+    }
+  }
+
+  /* Append any original suffix.  */
+  if (ret && suffix) {
+    string *elt;
+    for (elt = ret; *elt; elt++) {
+      *elt = extend_filename (*elt, suffix);
+    }
+  }
+
+  return ret;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/fontmap.h
@@ -0,0 +1,31 @@
+/* fontmap.h: declarations for reading a file to define additional font names.
+
+Copyright (C) 1993, 94, 95 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef FONTMAP_H
+#define FONTMAP_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/hash.h>
+#include <kpathsea/types.h>
+
+
+/* Look up KEY in all texfonts.map's in the glyph_format path, and
+   return a null-terminated list of all matching entries, or NULL.  */
+extern string *kpse_fontmap_lookup P1H(const_string key);
+
+#endif /* not FONTMAP_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/getopt.c
@@ -0,0 +1,1000 @@
+/* Getopt for GNU.
+   NOTE: getopt is now part of the C library, so if you don't know what
+   "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
+   before changing it!
+
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
+   	Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+   Ditto for AIX 3.2 and <stdlib.h>.  */
+#ifndef _NO_PROTO
+#define _NO_PROTO
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#if !defined (__STDC__) || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef	__GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+   contain conflicting prototypes for getopt.  */
+#include <stdlib.h>
+#include <unistd.h>
+#endif	/* GNU C library.  */
+
+#ifdef VMS
+#include <unixlib.h>
+#if HAVE_STRING_H - 0
+#include <string.h>
+#endif
+#endif
+
+#if defined (WIN32) && !defined (__CYGWIN32__)
+/* It's not Unix, really.  See?  Capital letters.  */
+#include <windows.h>
+#define getpid() GetCurrentProcessId()
+#endif
+
+#ifndef _
+/* This is for other GNU distributions with internationalized messages.
+   When compiling libc, the _ macro is predefined.  */
+#ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+# define _(msgid)	gettext (msgid)
+#else
+# define _(msgid)	(msgid)
+#endif
+#endif
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+   but it behaves differently for the user, since it allows the user
+   to intersperse the options with the other arguments.
+
+   As `getopt' works, it permutes the elements of ARGV so that,
+   when it is done, all the options precede everything else.  Thus
+   all application programs are extended to handle flexible argument order.
+
+   Setting the environment variable POSIXLY_CORRECT disables permutation.
+   Then the behavior is completely standard.
+
+   GNU application programs can use a third alternative mode in which
+   they can distinguish the relative order of options and other arguments.  */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+char *optarg = NULL;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+/* 1003.2 says this must be 1 before any call.  */
+int optind = 1;
+
+/* Formerly, initialization of getopt depended on optind==0, which
+   causes problems with re-calling getopt as programs generally don't
+   know that. */
+
+int __getopt_initialized = 0;
+
+/* The next char to be scanned in the option-element
+   in which the last option character we returned was found.
+   This allows us to pick up the scan where we left off.
+
+   If this is zero, or a null string, it means resume the scan
+   by advancing to the next ARGV-element.  */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+   for unrecognized options.  */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+   This must be initialized on some systems to avoid linking in the
+   system's own getopt implementation.  */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   If the caller did not specify anything,
+   the default is REQUIRE_ORDER if the environment variable
+   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+   REQUIRE_ORDER means don't recognize them as options;
+   stop option processing when the first non-option is seen.
+   This is what Unix does.
+   This mode of operation is selected by either setting the environment
+   variable POSIXLY_CORRECT, or using `+' as the first character
+   of the list of option characters.
+
+   PERMUTE is the default.  We permute the contents of ARGV as we scan,
+   so that eventually all the non-options are at the end.  This allows options
+   to be given in any order, even with programs that were not written to
+   expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were written
+   to expect options and other ARGV-elements in any order and that care about
+   the ordering of the two.  We describe each non-option ARGV-element
+   as if it were the argument of an option with character code 1.
+   Using `-' as the first character of the list of option characters
+   selects this mode of operation.
+
+   The special argument `--' forces an end of option-scanning regardless
+   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
+
+static enum
+{
+  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+/* Value of POSIXLY_CORRECT environment variable.  */
+static char *posixly_correct;
+
+#ifdef	__GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+   because there are many ways it can cause trouble.
+   On some systems, it contains special magic macros that don't work
+   in GCC.  */
+#include <string.h>
+#define	my_index	strchr
+#else
+
+/* Avoid depending on library functions or files
+   whose names are inconsistent.  */
+
+char *getenv ();
+
+static char *
+my_index (str, chr)
+     const char *str;
+     int chr;
+{
+  while (*str)
+    {
+      if (*str == chr)
+	return (char *) str;
+      str++;
+    }
+  return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+   If not using GCC, it is ok not to declare it.  */
+#ifdef __GNUC__
+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+   That was relevant to code that was here before.  */
+#if !defined (__STDC__) || !__STDC__
+/* gcc with -traditional declares the built-in strlen to return int,
+   and has done so at least since version 2.4.5. -- rms.  */
+extern int strlen (const char *);
+#endif /* not __STDC__ */
+#endif /* __GNUC__ */
+
+#endif /* not __GNU_LIBRARY__ */
+
+/* Handle permutation of arguments.  */
+
+/* Describe the part of ARGV that contains non-options that have
+   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
+   `last_nonopt' is the index after the last of them.  */
+
+static int first_nonopt;
+static int last_nonopt;
+
+#ifdef _LIBC
+/* Bash 2.0 gives us an environment variable containing flags
+   indicating ARGV elements that should not be considered arguments.  */
+
+static const char *nonoption_flags;
+static int nonoption_flags_len;
+
+static int original_argc;
+static char *const *original_argv;
+
+/* Make sure the environment variable bash 2.0 puts in the environment
+   is valid for the getopt call we must make sure that the ARGV passed
+   to getopt is that one passed to the process.  */
+static void store_args (int argc, char *const *argv) __attribute__ ((unused));
+static void
+store_args (int argc, char *const *argv)
+{
+  /* XXX This is no good solution.  We should rather copy the args so
+     that we can compare them later.  But we must not use malloc(3).  */
+  original_argc = argc;
+  original_argv = argv;
+}
+text_set_element (__libc_subinit, store_args);
+#endif
+
+/* Exchange two adjacent subsequences of ARGV.
+   One subsequence is elements [first_nonopt,last_nonopt)
+   which contains all the non-options that have been skipped so far.
+   The other is elements [last_nonopt,optind), which contains all
+   the options processed since those non-options were skipped.
+
+   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   the new indices of the non-options in ARGV after they are moved.  */
+
+#if defined (__STDC__) && __STDC__
+static void exchange (char **);
+#endif
+
+static void
+exchange (argv)
+     char **argv;
+{
+  int bottom = first_nonopt;
+  int middle = last_nonopt;
+  int top = optind;
+  char *tem;
+
+  /* Exchange the shorter segment with the far end of the longer segment.
+     That puts the shorter segment into the right place.
+     It leaves the longer segment in the right place overall,
+     but it consists of two parts that need to be swapped next.  */
+
+  while (top > middle && middle > bottom)
+    {
+      if (top - middle > middle - bottom)
+	{
+	  /* Bottom segment is the short one.  */
+	  int len = middle - bottom;
+	  register int i;
+
+	  /* Swap it with the top part of the top segment.  */
+	  for (i = 0; i < len; i++)
+	    {
+	      tem = argv[bottom + i];
+	      argv[bottom + i] = argv[top - (middle - bottom) + i];
+	      argv[top - (middle - bottom) + i] = tem;
+	    }
+	  /* Exclude the moved bottom segment from further swapping.  */
+	  top -= len;
+	}
+      else
+	{
+	  /* Top segment is the short one.  */
+	  int len = top - middle;
+	  register int i;
+
+	  /* Swap it with the bottom part of the bottom segment.  */
+	  for (i = 0; i < len; i++)
+	    {
+	      tem = argv[bottom + i];
+	      argv[bottom + i] = argv[middle + i];
+	      argv[middle + i] = tem;
+	    }
+	  /* Exclude the moved top segment from further swapping.  */
+	  bottom += len;
+	}
+    }
+
+  /* Update records for the slots the non-options now occupy.  */
+
+  first_nonopt += (optind - last_nonopt);
+  last_nonopt = optind;
+}
+
+/* Initialize the internal data when the first call is made.  */
+
+#if defined (__STDC__) && __STDC__
+static const char *_getopt_initialize (int, char *const *, const char *);
+#endif
+static const char *
+_getopt_initialize (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  /* Start processing options with ARGV-element 1 (since ARGV-element 0
+     is the program name); the sequence of previously skipped
+     non-option ARGV-elements is empty.  */
+
+  first_nonopt = last_nonopt = optind = 1;
+
+  nextchar = NULL;
+
+  posixly_correct = getenv ("POSIXLY_CORRECT");
+
+  /* Determine how to handle the ordering of options and nonoptions.  */
+
+  if (optstring[0] == '-')
+    {
+      ordering = RETURN_IN_ORDER;
+      ++optstring;
+    }
+  else if (optstring[0] == '+')
+    {
+      ordering = REQUIRE_ORDER;
+      ++optstring;
+    }
+  else if (posixly_correct != NULL)
+    ordering = REQUIRE_ORDER;
+  else
+    ordering = PERMUTE;
+
+#ifdef _LIBC
+  if (posixly_correct == NULL
+      && argc == original_argc && argv == original_argv)
+    {
+      /* Bash 2.0 puts a special variable in the environment for each
+	 command it runs, specifying which ARGV elements are the results of
+	 file name wildcard expansion and therefore should not be
+	 considered as options.  */
+      char var[100];
+      sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
+      nonoption_flags = getenv (var);
+      if (nonoption_flags == NULL)
+	nonoption_flags_len = 0;
+      else
+	nonoption_flags_len = strlen (nonoption_flags);
+    }
+  else
+    nonoption_flags_len = 0;
+#endif
+
+  return optstring;
+}
+
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+   given in OPTSTRING.
+
+   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+   then it is an option element.  The characters of this element
+   (aside from the initial '-') are option characters.  If `getopt'
+   is called repeatedly, it returns successively each of the option characters
+   from each of the option elements.
+
+   If `getopt' finds another option character, it returns that character,
+   updating `optind' and `nextchar' so that the next call to `getopt' can
+   resume the scan with the following option character or ARGV-element.
+
+   If there are no more option characters, `getopt' returns -1.
+   Then `optind' is the index in ARGV of the first ARGV-element
+   that is not an option.  (The ARGV-elements have been permuted
+   so that those that are not options now come last.)
+
+   OPTSTRING is a string containing the legitimate option characters.
+   If an option character is seen that is not listed in OPTSTRING,
+   return '?' after printing an error message.  If you set `opterr' to
+   zero, the error message is suppressed but we still return '?'.
+
+   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+   so the following text in the same ARGV-element, or the text of the following
+   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   wants an optional arg; if there is text in the current ARGV-element,
+   it is returned in `optarg', otherwise `optarg' is set to zero.
+
+   If OPTSTRING starts with `-' or `+', it requests different methods of
+   handling the non-option ARGV-elements.
+   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+   Long-named options begin with `--' instead of `-'.
+   Their names may be abbreviated as long as the abbreviation is unique
+   or is an exact match for some defined option.  If they have an
+   argument, it follows the option name in the same ARGV-element, separated
+   from the option name by a `=', or else the in next ARGV-element.
+   When `getopt' finds a long-named option, it returns 0 if that option's
+   `flag' field is nonzero, the value of the option's `val' field
+   if the `flag' field is zero.
+
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
+   LONGOPTS is a vector of `struct option' terminated by an
+   element containing a name which is zero.
+
+   LONGIND returns the index in LONGOPT of the long-named option found.
+   It is only valid when a long-named option has been found by the most
+   recent call.
+
+   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+   long-named options.  */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+     const struct option *longopts;
+     int *longind;
+     int long_only;
+{
+  optarg = NULL;
+
+  if (!__getopt_initialized || optind == 0)
+    {
+      optstring = _getopt_initialize (argc, argv, optstring);
+      optind = 1;		/* Don't scan ARGV[0], the program name.  */
+      __getopt_initialized = 1;
+    }
+
+  /* Test whether ARGV[optind] points to a non-option argument.
+     Either it does not have option syntax, or there is an environment flag
+     from the shell indicating it is not an option.  The later information
+     is only used when the used in the GNU libc.  */
+#ifdef _LIBC
+#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'	      \
+		     || (optind < nonoption_flags_len			      \
+			 && nonoption_flags[optind] == '1'))
+#else
+#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#endif
+
+  if (nextchar == NULL || *nextchar == '\0')
+    {
+      /* Advance to the next ARGV-element.  */
+
+      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+	 moved back by the user (who may also have changed the arguments).  */
+      if (last_nonopt > optind)
+	last_nonopt = optind;
+      if (first_nonopt > optind)
+	first_nonopt = optind;
+
+      if (ordering == PERMUTE)
+	{
+	  /* If we have just processed some options following some non-options,
+	     exchange them so that the options come first.  */
+
+	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+	    exchange ((char **) argv);
+	  else if (last_nonopt != optind)
+	    first_nonopt = optind;
+
+	  /* Skip any additional non-options
+	     and extend the range of non-options previously skipped.  */
+
+	  while (optind < argc && NONOPTION_P)
+	    optind++;
+	  last_nonopt = optind;
+	}
+
+      /* The special ARGV-element `--' means premature end of options.
+	 Skip it like a null option,
+	 then exchange with previous non-options as if it were an option,
+	 then skip everything else like a non-option.  */
+
+      if (optind != argc && !strcmp (argv[optind], "--"))
+	{
+	  optind++;
+
+	  if (first_nonopt != last_nonopt && last_nonopt != optind)
+	    exchange ((char **) argv);
+	  else if (first_nonopt == last_nonopt)
+	    first_nonopt = optind;
+	  last_nonopt = argc;
+
+	  optind = argc;
+	}
+
+      /* If we have done all the ARGV-elements, stop the scan
+	 and back over any non-options that we skipped and permuted.  */
+
+      if (optind == argc)
+	{
+	  /* Set the next-arg-index to point at the non-options
+	     that we previously skipped, so the caller will digest them.  */
+	  if (first_nonopt != last_nonopt)
+	    optind = first_nonopt;
+	  return -1;
+	}
+
+      /* If we have come to a non-option and did not permute it,
+	 either stop the scan or describe it to the caller and pass it by.  */
+
+      if (NONOPTION_P)
+	{
+	  if (ordering == REQUIRE_ORDER)
+	    return -1;
+	  optarg = argv[optind++];
+	  return 1;
+	}
+
+      /* We have found another option-ARGV-element.
+	 Skip the initial punctuation.  */
+
+      nextchar = (argv[optind] + 1
+		  + (longopts != NULL && argv[optind][1] == '-'));
+    }
+
+  /* Decode the current option-ARGV-element.  */
+
+  /* Check whether the ARGV-element is a long option.
+
+     If long_only and the ARGV-element has the form "-f", where f is
+     a valid short option, don't consider it an abbreviated form of
+     a long option that starts with f.  Otherwise there would be no
+     way to give the -f short option.
+
+     On the other hand, if there's a long option "fubar" and
+     the ARGV-element is "-fu", do consider that an abbreviation of
+     the long option, just like "--fu", and not "-f" with arg "u".
+
+     This distinction seems to be the most useful approach.  */
+
+  if (longopts != NULL
+      && (argv[optind][1] == '-'
+	  || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+    {
+      char *nameend;
+      const struct option *p;
+      const struct option *pfound = NULL;
+      int exact = 0;
+      int ambig = 0;
+      int indfound = -1;
+      int option_index;
+
+      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+	/* Do nothing.  */ ;
+
+      /* Test all long options for either exact match
+	 or abbreviated matches.  */
+      for (p = longopts, option_index = 0; p->name; p++, option_index++)
+	if (!strncmp (p->name, nextchar, nameend - nextchar))
+	  {
+	    if ((unsigned int) (nameend - nextchar)
+		== (unsigned int) strlen (p->name))
+	      {
+		/* Exact match found.  */
+		pfound = p;
+		indfound = option_index;
+		exact = 1;
+		break;
+	      }
+	    else if (pfound == NULL)
+	      {
+		/* First nonexact match found.  */
+		pfound = p;
+		indfound = option_index;
+	      }
+	    else
+	      /* Second or later nonexact match found.  */
+	      ambig = 1;
+	  }
+
+      if (ambig && !exact)
+	{
+	  if (opterr)
+	    fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+		     argv[0], argv[optind]);
+	  nextchar += strlen (nextchar);
+	  optind++;
+	  optopt = 0;
+	  return '?';
+	}
+
+      if (pfound != NULL)
+	{
+	  option_index = indfound;
+	  optind++;
+	  if (*nameend)
+	    {
+	      /* Don't test has_arg with >, because some C compilers don't
+		 allow it to be used on enums.  */
+	      if (pfound->has_arg)
+		optarg = nameend + 1;
+	      else
+		{
+		  if (opterr)
+		   if (argv[optind - 1][1] == '-')
+		    /* --option */
+		    fprintf (stderr,
+		     _("%s: option `--%s' doesn't allow an argument\n"),
+		     argv[0], pfound->name);
+		   else
+		    /* +option or -option */
+		    fprintf (stderr,
+		     _("%s: option `%c%s' doesn't allow an argument\n"),
+		     argv[0], argv[optind - 1][0], pfound->name);
+
+		  nextchar += strlen (nextchar);
+
+		  optopt = pfound->val;
+		  return '?';
+		}
+	    }
+	  else if (pfound->has_arg == 1)
+	    {
+	      if (optind < argc)
+		optarg = argv[optind++];
+	      else
+		{
+		  if (opterr)
+		    fprintf (stderr,
+			   _("%s: option `%s' requires an argument\n"),
+			   argv[0], argv[optind - 1]);
+		  nextchar += strlen (nextchar);
+		  optopt = pfound->val;
+		  return optstring[0] == ':' ? ':' : '?';
+		}
+	    }
+	  nextchar += strlen (nextchar);
+	  if (longind != NULL)
+	    *longind = option_index;
+	  if (pfound->flag)
+	    {
+	      *(pfound->flag) = pfound->val;
+	      return 0;
+	    }
+	  return pfound->val;
+	}
+
+      /* Can't find it as a long option.  If this is not getopt_long_only,
+	 or the option starts with '--' or is not a valid short
+	 option, then it's an error.
+	 Otherwise interpret it as a short option.  */
+      if (!long_only || argv[optind][1] == '-'
+	  || my_index (optstring, *nextchar) == NULL)
+	{
+	  if (opterr)
+	    {
+	      if (argv[optind][1] == '-')
+		/* --option */
+		fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+			 argv[0], nextchar);
+	      else
+		/* +option or -option */
+		fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+			 argv[0], argv[optind][0], nextchar);
+	    }
+	  nextchar = (char *) "";
+	  optind++;
+	  optopt = 0;
+	  return '?';
+	}
+    }
+
+  /* Look at and handle the next short option-character.  */
+
+  {
+    char c = *nextchar++;
+    char *temp = my_index (optstring, c);
+
+    /* Increment `optind' when we start to process its last character.  */
+    if (*nextchar == '\0')
+      ++optind;
+
+    if (temp == NULL || c == ':')
+      {
+	if (opterr)
+	  {
+	    if (posixly_correct)
+	      /* 1003.2 specifies the format of this message.  */
+	      fprintf (stderr, _("%s: illegal option -- %c\n"),
+		       argv[0], c);
+	    else
+	      fprintf (stderr, _("%s: invalid option -- %c\n"),
+		       argv[0], c);
+	  }
+	optopt = c;
+	return '?';
+      }
+    /* Convenience. Treat POSIX -W foo same as long option --foo */
+    if (temp[0] == 'W' && temp[1] == ';')
+      {
+	char *nameend;
+	const struct option *p;
+	const struct option *pfound = NULL;
+	int exact = 0;
+	int ambig = 0;
+	int indfound = 0;
+	int option_index;
+
+	/* This is an option that requires an argument.  */
+	if (*nextchar != '\0')
+	  {
+	    optarg = nextchar;
+	    /* If we end this ARGV-element by taking the rest as an arg,
+	       we must advance to the next element now.  */
+	    optind++;
+	  }
+	else if (optind == argc)
+	  {
+	    if (opterr)
+	      {
+		/* 1003.2 specifies the format of this message.  */
+		fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+			 argv[0], c);
+	      }
+	    optopt = c;
+	    if (optstring[0] == ':')
+	      c = ':';
+	    else
+	      c = '?';
+	    return c;
+	  }
+	else
+	  /* We already incremented `optind' once;
+	     increment it again when taking next ARGV-elt as argument.  */
+	  optarg = argv[optind++];
+
+	/* optarg is now the argument, see if it's in the
+	   table of longopts.  */
+
+	for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+	  /* Do nothing.  */ ;
+
+	/* Test all long options for either exact match
+	   or abbreviated matches.  */
+	for (p = longopts, option_index = 0; p->name; p++, option_index++)
+	  if (!strncmp (p->name, nextchar, nameend - nextchar))
+	    {
+	      if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+		{
+		  /* Exact match found.  */
+		  pfound = p;
+		  indfound = option_index;
+		  exact = 1;
+		  break;
+		}
+	      else if (pfound == NULL)
+		{
+		  /* First nonexact match found.  */
+		  pfound = p;
+		  indfound = option_index;
+		}
+	      else
+		/* Second or later nonexact match found.  */
+		ambig = 1;
+	    }
+	if (ambig && !exact)
+	  {
+	    if (opterr)
+	      fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+		       argv[0], argv[optind]);
+	    nextchar += strlen (nextchar);
+	    optind++;
+	    return '?';
+	  }
+	if (pfound != NULL)
+	  {
+	    option_index = indfound;
+	    if (*nameend)
+	      {
+		/* Don't test has_arg with >, because some C compilers don't
+		   allow it to be used on enums.  */
+		if (pfound->has_arg)
+		  optarg = nameend + 1;
+		else
+		  {
+		    if (opterr)
+		      fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+			       argv[0], pfound->name);
+
+		    nextchar += strlen (nextchar);
+		    return '?';
+		  }
+	      }
+	    else if (pfound->has_arg == 1)
+	      {
+		if (optind < argc)
+		  optarg = argv[optind++];
+		else
+		  {
+		    if (opterr)
+		      fprintf (stderr,
+			       _("%s: option `%s' requires an argument\n"),
+			       argv[0], argv[optind - 1]);
+		    nextchar += strlen (nextchar);
+		    return optstring[0] == ':' ? ':' : '?';
+		  }
+	      }
+	    nextchar += strlen (nextchar);
+	    if (longind != NULL)
+	      *longind = option_index;
+	    if (pfound->flag)
+	      {
+		*(pfound->flag) = pfound->val;
+		return 0;
+	      }
+	    return pfound->val;
+	  }
+	  nextchar = NULL;
+	  return 'W';	/* Let the application handle it.   */
+      }
+    if (temp[1] == ':')
+      {
+	if (temp[2] == ':')
+	  {
+	    /* This is an option that accepts an argument optionally.  */
+	    if (*nextchar != '\0')
+	      {
+		optarg = nextchar;
+		optind++;
+	      }
+	    else
+	      optarg = NULL;
+	    nextchar = NULL;
+	  }
+	else
+	  {
+	    /* This is an option that requires an argument.  */
+	    if (*nextchar != '\0')
+	      {
+		optarg = nextchar;
+		/* If we end this ARGV-element by taking the rest as an arg,
+		   we must advance to the next element now.  */
+		optind++;
+	      }
+	    else if (optind == argc)
+	      {
+		if (opterr)
+		  {
+		    /* 1003.2 specifies the format of this message.  */
+		    fprintf (stderr,
+			   _("%s: option requires an argument -- %c\n"),
+			   argv[0], c);
+		  }
+		optopt = c;
+		if (optstring[0] == ':')
+		  c = ':';
+		else
+		  c = '?';
+	      }
+	    else
+	      /* We already incremented `optind' once;
+		 increment it again when taking next ARGV-elt as argument.  */
+	      optarg = argv[optind++];
+	    nextchar = NULL;
+	  }
+      }
+    return c;
+  }
+}
+
+int
+getopt (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  return _getopt_internal (argc, argv, optstring,
+			   (const struct option *) 0,
+			   (int *) 0,
+			   0);
+}
+
+#endif	/* Not ELIDE_CODE.  */
+
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of `getopt'.  */
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == -1)
+	break;
+
+      switch (c)
+	{
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
new file mode 100644
--- /dev/null
+++ b/kpathsea/getopt.h
@@ -0,0 +1,133 @@
+/* Declarations for getopt.
+   Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _GETOPT_H
+#define _GETOPT_H 1
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+   for unrecognized options.  */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized.  */
+
+extern int optopt;
+
+/* Describe the long-named options requested by the application.
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+   of `struct option' terminated by an element containing a name which is
+   zero.
+
+   The field `has_arg' is:
+   no_argument		(or 0) if the option does not take an argument,
+   required_argument	(or 1) if the option requires an argument,
+   optional_argument 	(or 2) if the option takes an optional argument.
+
+   If the field `flag' is not NULL, it points to a variable that is set
+   to the value given in the field `val' when the option is found, but
+   left unchanged if the option is not found.
+
+   To have a long-named option do something other than set an `int' to
+   a compiled-in constant, such as set a value from `optarg', set the
+   option's `flag' field to zero and its `val' field to a nonzero
+   value (the equivalent single-letter option character, if there is
+   one).  For long options that have a zero `flag' field, `getopt'
+   returns the contents of the `val' field.  */
+
+struct option
+{
+#if defined (__STDC__) && __STDC__
+  const char *name;
+#else
+  char *name;
+#endif
+  /* has_arg can't be an enum because some compilers complain about
+     type mismatches in all the code that assumes it is an int.  */
+  int has_arg;
+  int *flag;
+  int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'.  */
+
+#define	no_argument		0
+#define required_argument	1
+#define optional_argument	2
+
+#if defined (__STDC__) && __STDC__
+#ifdef __GNU_LIBRARY__
+/* Many other libraries have conflicting prototypes for getopt, with
+   differences in the consts, in stdlib.h.  To avoid compilation
+   errors, only prototype getopt for the GNU C library.  */
+extern int getopt (int argc, char *const *argv, const char *shortopts);
+#else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+#endif /* __GNU_LIBRARY__ */
+extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+		        const struct option *longopts, int *longind);
+extern int getopt_long_only (int argc, char *const *argv,
+			     const char *shortopts,
+		             const struct option *longopts, int *longind);
+
+/* Internal only.  Users should not call this directly.  */
+extern int _getopt_internal (int argc, char *const *argv,
+			     const char *shortopts,
+		             const struct option *longopts, int *longind,
+			     int long_only);
+#else /* not __STDC__ */
+extern int getopt ();
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+#endif /* __STDC__ */
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif /* _GETOPT_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/getopt1.c
@@ -0,0 +1,189 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+   Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "getopt.h"
+
+#if !defined (__STDC__) || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#endif
+
+#ifndef	NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+   If an option that starts with '-' (not '--') doesn't match a long option,
+   but does match a short option, it is parsed as a short option
+   instead.  */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+
+#endif	/* Not ELIDE_CODE.  */
+
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+      int option_index = 0;
+      static struct option long_options[] =
+      {
+	{"add", 1, 0, 0},
+	{"append", 0, 0, 0},
+	{"delete", 1, 0, 0},
+	{"verbose", 0, 0, 0},
+	{"create", 0, 0, 0},
+	{"file", 1, 0, 0},
+	{0, 0, 0, 0}
+      };
+
+      c = getopt_long (argc, argv, "abc:d:0123456789",
+		       long_options, &option_index);
+      if (c == -1)
+	break;
+
+      switch (c)
+	{
+	case 0:
+	  printf ("option %s", long_options[option_index].name);
+	  if (optarg)
+	    printf (" with arg %s", optarg);
+	  printf ("\n");
+	  break;
+
+	case '0':
+	case '1':
+	case '2':
+	case '3':
+	case '4':
+	case '5':
+	case '6':
+	case '7':
+	case '8':
+	case '9':
+	  if (digit_optind != 0 && digit_optind != this_option_optind)
+	    printf ("digits occur in two different argv-elements.\n");
+	  digit_optind = this_option_optind;
+	  printf ("option %c\n", c);
+	  break;
+
+	case 'a':
+	  printf ("option a\n");
+	  break;
+
+	case 'b':
+	  printf ("option b\n");
+	  break;
+
+	case 'c':
+	  printf ("option c with value `%s'\n", optarg);
+	  break;
+
+	case 'd':
+	  printf ("option d with value `%s'\n", optarg);
+	  break;
+
+	case '?':
+	  break;
+
+	default:
+	  printf ("?? getopt returned character code 0%o ??\n", c);
+	}
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+	printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
new file mode 100644
--- /dev/null
+++ b/kpathsea/hash.c
@@ -0,0 +1,180 @@
+/* hash.c: hash table operations.
+
+Copyright (C) 1994, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/hash.h>
+#include <kpathsea/str-list.h>
+
+
+/* The hash function.  We go for simplicity here.  */
+
+/* All our hash tables are related to filenames.  */
+#ifdef MONOCASE_FILENAMES
+#define TRANSFORM(x) toupper (x)
+#else
+#define TRANSFORM(x) (x)
+#endif
+
+static unsigned
+hash P2C(hash_table_type, table,  const_string, key)
+{
+  unsigned n = 0;
+  
+  /* Our keys aren't often anagrams of each other, so no point in
+     weighting the characters.  */
+  while (*key != 0)
+    n = (n + n + TRANSFORM (*key++)) % table.size;
+  
+  return n;
+}
+
+hash_table_type
+hash_create P1C(unsigned, size) 
+{
+  unsigned b;
+  hash_table_type ret;
+  ret.buckets = XTALLOC (size, hash_element_type *);
+  ret.size = size;
+  
+  /* calloc's zeroes aren't necessarily NULL, according to ANSI, so be
+     safe.  (Not that I know of any exceptions in reality.)  */
+  for (b = 0; b <ret.size; b++)
+    ret.buckets[b] = NULL;
+    
+  return ret;
+}
+
+/* Whether or not KEY is already in MAP, insert it and VALUE.  Do not
+   duplicate the strings, in case they're being purposefully shared.  */
+
+void
+hash_insert P3C(hash_table_type *, table,  const_string, key,
+                const_string, value)
+{
+  unsigned n = hash (*table, key);
+  hash_element_type *new_elt = XTALLOC1 (hash_element_type);
+
+  new_elt->key = key;
+  new_elt->value = value;
+  new_elt->next = NULL;
+  
+  /* Insert the new element at the end of the list.  */
+  if (!table->buckets[n])
+    /* first element in bucket is a special case.  */
+    table->buckets[n] = new_elt;
+  else
+    {
+      hash_element_type *loc = table->buckets[n];
+      while (loc->next)		/* Find the last element.  */
+        loc = loc->next;
+      loc->next = new_elt;	/* Insert the new one after.  */
+    }
+}
+
+/* Look up STR in MAP.  Return a (dynamically-allocated) list of the
+   corresponding strings or NULL if no match.  */ 
+
+#ifdef KPSE_DEBUG
+/* Print the hash values as integers if this is nonzero.  */
+boolean kpse_debug_hash_lookup_int = false; 
+#endif
+
+string *
+hash_lookup P2C(hash_table_type, table,  const_string, key)
+{
+  hash_element_type *p;
+  str_list_type ret;
+  unsigned n = hash (table, key);
+  ret = str_list_init ();
+  
+  /* Look at everything in this bucket.  */
+  for (p = table.buckets[n]; p != NULL; p = p->next)
+    if (FILESTRCASEEQ (key, p->key))
+      /* Cast because the general str_list_type shouldn't force const data.  */
+      str_list_add (&ret, (string) p->value);
+  
+  /* If we found anything, mark end of list with null.  */
+  if (STR_LIST (ret))
+    str_list_add (&ret, NULL);
+
+#ifdef KPSE_DEBUG
+  if (KPSE_DEBUG_P (KPSE_DEBUG_HASH))
+    {
+      DEBUGF1 ("hash_lookup(%s) =>", key);
+      if (!STR_LIST (ret))
+        fputs (" (nil)\n", stderr);
+      else
+        {
+          string *r;
+          for (r = STR_LIST (ret); *r; r++)
+            {
+              putc (' ', stderr);
+              if (kpse_debug_hash_lookup_int)
+                fprintf (stderr, "%ld", (long) *r);
+              else
+                fputs (*r, stderr);
+            }
+          putc ('\n', stderr);
+        }
+      fflush (stderr);
+    }
+#endif
+
+  return STR_LIST (ret);
+}
+
+/* We only print nonempty buckets, to decrease output volume.  */
+
+void
+hash_print P2C(hash_table_type, table,  boolean, summary_only)
+{
+  unsigned b;
+  unsigned total_elements = 0, total_buckets = 0;
+  
+  for (b = 0; b < table.size; b++) {
+    hash_element_type *bucket = table.buckets[b];
+
+    if (bucket) {
+      unsigned len = 1;
+      hash_element_type *tb;
+
+      total_buckets++;
+      if (!summary_only) fprintf (stderr, "%4d ", b);
+
+      for (tb = bucket->next; tb != NULL; tb = tb->next)
+        len++;
+      if (!summary_only) fprintf (stderr, ":%-5d", len);
+      total_elements += len;
+
+      if (!summary_only) {
+        for (tb = bucket; tb != NULL; tb = tb->next)
+          fprintf (stderr, " %s=>%s", tb->key, tb->value);
+        putc ('\n', stderr);
+      }
+    }
+  }
+  
+  fprintf (stderr,
+          "%u buckets, %u nonempty (%u%%); %u entries, average chain %.1f.\n",
+          table.size,
+          total_buckets,
+          100 * total_buckets / table.size,
+          total_elements,
+          total_buckets ? total_elements / (double) total_buckets : 0.0);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/hash.h
@@ -0,0 +1,61 @@
+/* hash.h: declarations for a hash table.
+
+Copyright (C) 1994, 95 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef HASH_H
+#define HASH_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+
+/* A single (key,value) pair.  */
+typedef struct hash_element_struct
+{
+  const_string key;
+  const_string value;
+  struct hash_element_struct *next;
+} hash_element_type;
+
+/* The usual arrangement of buckets initialized to null.  */
+typedef struct
+{
+  hash_element_type **buckets;
+  unsigned size;
+} hash_table_type;
+
+#ifdef KPSE_DEBUG
+/* How to print the hash results when debugging.  */
+extern boolean kpse_debug_hash_lookup_int;
+#endif
+
+/* Create a hash table of size SIZE.  */
+extern hash_table_type hash_create P1H(unsigned size);
+
+/* Insert the (KEY,VALUE) association into TABLE.  KEY may have more
+   than one VALUE.  Neither KEY nor VALUE is copied.  */
+extern void hash_insert P3H(hash_table_type *table,  const_string key,
+                            const_string value);
+
+/* Look up KEY in MAP, and return NULL-terminated list of all matching
+   values (not copies), in insertion order.  If none, return NULL.  */
+extern string *hash_lookup P2H(hash_table_type table, const_string key);
+
+/* Print TABLE to stderr.  */
+extern void hash_print P2H(hash_table_type table, boolean summary_only);
+
+#endif /* not HASH_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/hier.texi
@@ -0,0 +1,102 @@
+@ifclear version
+@defcodeindex fl
+@defcodeindex op
+@end ifclear
+
+@node TeX directory structure
+@section @TeX{} directory structure
+
+@vindex TEXMF
+@cindex @TeX{} directory structure
+@cindex directory structure, for @TeX{} files
+@cindex skeleton @TeX{} directory
+@cindex TDS
+
+This section describes the default installation hierarchy of the
+distribution.  It conforms to both the GNU coding standards and the
+@TeX{} directory structure (TDS) standard.  For rationale and further
+explanation, please see those documents.  The GNU standard is available
+as @url{ftp://prep.ai.mit.edu/pub/gnu/standards/standards.texi} and
+mirrors.  The TDS document is available from
+@file{@var{CTAN:}/tex-archive/tds} (@pxref{unixtex.ftp}).
+
+You can change the default paths in many ways (@pxref{Changing search
+paths}).  One common desire is to put everything (binaries and all)
+under a single top-level directory such as @file{/usr/local/texmf} or
+@file{/opt/texmf}---in the terms used below, make @var{prefix} and
+@var{texmf} the same.  For specific instructions on doing that,
+@pxref{configure scenarios}.
+
+Here is a skeleton of the default directory structure, extracted from
+the TDS document:
+
+@example
+@var{prefix}/      @r{installation root (@file{/usr/local} by default)}
+ bin/         @r{executables}
+ man/         @r{man pages}
+ include/     @r{C header files}
+ info/        @r{GNU info files}
+ lib/         @r{libraries (@file{libkpathsea.*})}
+ share/       @r{architecture-independent files}
+  texmf/      @r{TDS root}
+   bibtex/     @r{Bib@TeX{} input files}
+    bib/        @r{Bib@TeX{} databases}
+     base/       @r{base distribution (e.g., @samp{xampl.bib})}
+     misc/       @r{single-file databases}
+     @var{pkg}/       @r{name of a package}
+    bst/        @r{Bib@TeX{} style files}
+     base/       @r{base distribution (e.g., @samp{plain.bst}, @samp{acm.bst})}
+     misc/       @r{single-file styles}
+     @var{pkg}/       @r{name of a package}
+   doc/         @r{additional documentation}
+   dvips/       @r{@samp{.pro}, @samp{.ps}, @samp{psfonts.map}}
+   fonts/       @r{font-related files}
+    @var{type}/         @r{file type (e.g., @samp{tfm}, @samp{pk})}
+     @var{mode}/          @r{type of output device (types @samp{pk} and @samp{gf} only)}
+      @var{supplier}/       @r{name of a font supplier (e.g., @samp{public})}
+       @var{typeface}/        @r{name of a typeface (e.g., @samp{cm})}
+        dpi@var{nnn}/           @r{font resolution (types @samp{pk} and @samp{gf} only)}
+   metafont/    @r{Metafont (non-font) input files}
+    base/        @r{base distribution (e.g., @samp{plain.mf})}
+    misc/        @r{single-file packages (e.g., @samp{modes.mf})}
+    @var{pkg}/           @r{name of a package (e.g., @samp{mfpic})}
+   metapost/    @r{MetaPost input files}
+    base/        @r{base distribution (e.g., @samp{plain.mp})}
+    misc/        @r{single-file packages}
+    @var{pkg}/           @r{name of a package}
+    support/     @r{support files for MetaPost-related utilities (e.g., @samp{trfonts.map})}
+   mft/         @r{@samp{MFT} inputs (e.g., @samp{plain.mft})}
+   tex/         @r{@TeX{} input files}
+    @var{format}/         @r{name of a format (e.g., @samp{plain})}
+     base/        @r{base distribution for @var{format} (e.g., @samp{plain.tex})}
+     misc/        @r{single-file packages (e.g., @samp{webmac.tex})}
+     local/       @r{local additions to or local configuration files for @var{format}}
+     @var{pkg}/           @r{name of a package (e.g., @samp{graphics}, @samp{mfnfss})}
+    generic/     @r{format-independent packages}
+     hyphen/      @r{hyphenation patterns (e.g., @samp{hyphen.tex})}
+     images/      @r{image input files (e.g., Encapsulated PostScript)}
+     misc/        @r{single-file format-independent packages (e.g., @samp{null.tex}).}
+     @var{pkg}/           @r{name of a package (e.g., @samp{babel})}
+   web2c/        @r{implementation-dependent files (@file{.pool}, @file{.fmt}, @file{texmf.cnf}, etc.)}
+@end example
+
+Some concrete examples for most file types:
+
+@example
+/usr/local/bin/tex
+/usr/local/man/man1/xdvi.1
+/usr/local/info/kpathsea.info
+/usr/local/lib/libkpathsea.a
+/usr/local/share/texmf/bibtex/bst/base/plain.bst
+/usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmr10.600pk
+/usr/local/share/texmf/fonts/source/public/pandora/pnr10.mf
+/usr/local/share/texmf/fonts/tfm/public/cm/cmr10.tfm
+/usr/local/share/texmf/fonts/type1/adobe/utopia/putr.pfa
+/usr/local/share/texmf/metafont/base/plain.mf
+/usr/local/share/texmf/metapost/base/plain.mp
+/usr/local/share/texmf/tex/plain/base/plain.tex
+/usr/local/share/texmf/tex/generic/hyphen/hyphen.tex
+/usr/local/share/texmf/web2c/tex.pool
+/usr/local/share/texmf/web2c/tex.fmt
+/usr/local/share/texmf/web2c/texmf.cnf
+@end example
new file mode 100644
--- /dev/null
+++ b/kpathsea/install.texi
@@ -0,0 +1,1162 @@
+@ifclear version
+@defcodeindex cm
+@defcodeindex fl
+@defcodeindex op
+@end ifclear
+
+@node Installation
+@chapter Installation
+
+@cindex installation
+@cindex configuration
+@cindex compilation
+
+@ifset version
+(A copy of this chapter is in the distribution file @file{kpathsea/INSTALL}.)
+@end ifset
+
+The procedure for Kpathsea (and Web2c, etc.) configuration and
+installation follows.  If trouble, @pxref{Common problems}, a copy of
+which is in the file @file{kpathsea/BUGS}.
+
+@menu
+* Simple installation::      If you just want to do it.
+* Custom installation::      If you want to change things around.
+* Security::                 Who can write what files, etc.
+* TeX directory structure::  Managing the horde of TeX input files.
+* unixtex.ftp::              Getting software via FTP, on CD-ROM, or on tape.
+* Reporting bugs::           Where and how to report bugs.
+@end menu
+
+
+@node Simple installation
+@section Simple installation
+
+@cindex simple installation
+@cindex installation, simple
+
+@cindex precompiled executables, instead of installation
+@cindex installation, getting executables instead of
+Installing @TeX{} and friends for the first time can be a daunting
+experience.  Thus, you may prefer to skip this whole thing and just get
+precompiled executables: @pxref{unixtex.ftp}.
+
+This section explains what to do if you wish to take the defaults for
+everything (installing under @file{/usr/local}), and generally to
+install in the simplest possible way.  Most steps here refer to
+corresponding subsection in the next section which explains how to
+override defaults and generally gives more details.
+
+@enumerate
+@item
+Be sure you have enough disk space: approximately 8 megabytes for the
+compressed archives, 15MB for sources, 45MB for compilation, 40MB for
+the (initial) installed system (including library files).  @xref{Disk
+space}.
+
+@item
+Retrieve these two distribution archives:
+@table @url
+@item ftp://ftp.tug.org/tex/texk.tar.gz
+These are the sources, which you will be compiling. 
+
+@item ftp://ftp.tug.org/tex/texmflib.tar.gz
+This is a basic set of input files.  You should unpack it in the
+directory @file{/usr/local/share}; doing so will create a @file{texmf}
+subdirectory there.
+@end table
+
+@noindent @xref{Kpathsea application distributions}.
+
+@item
+When using the default search paths, there is no need to edit any
+distribution files. @xref{Changing search paths}.
+
+@item
+At the top level of the distribution, run @samp{sh configure}.  (If you
+have the GNU Bash shell installed, run @samp{bash configure}.)
+@xref{Running configure}.
+
+@item
+@samp{make}. @xref{Running make}.
+
+@item 
+@samp{make install}. @xref{Installing files}.
+
+@item
+@samp{make distclean}. @xref{Cleaning up}.
+
+@item
+Set up a cron job to rebuild the filename database that makes searching
+faster.  This line will rebuild it every midnight:
+@example
+0 0 * * * cd /usr/local/share/texmf && @var{/bindir}/MakeTeXls-R
+@end example
+@xref{Filename database generation}, and @ref{Filename database}.
+
+@item
+@cindex printer configuration files
+@cindex PostScript fonts, additional
+@cindex color printers, configuring
+If you're installing Dvips, you also need to set up configuration files
+for your printers and make any additional PostScript fonts available.
+@xref{Installation,,, dvips, Dvips}.  If you have any color printers,
+@pxref{Color device configuration,,, dvips, Dvips}.
+
+@item
+The first time you run a DVI driver, a bunch of PK fonts will be built
+by Metafont via @code{MakeTeXPK} (and added to the filename database).
+This will take some time.  Don't be alarmed; they will created only this
+first time (unless something is wrong with your path definitions).
+
+By default, @code{MakeTeXPK} assumes @file{/usr/local/share/texmf/fonts}
+is globally writable.  If you need a different arrangement, 
+@pxref{MakeTeX configuration}.
+
+@xref{MakeTeX scripts}.
+
+@item
+@cindex fonts, being created
+@pindex MakeTeXPK @r{, initial runs}
+@cindex tests, simple
+For some simple tests, try @samp{tex story \\bye} and @samp{latex
+simple}.  Then run @file{xdvi story} or @file{dvips simple} on the
+resulting DVI files to preview/print the documents.  @xref{Installation
+testing}.
+@end enumerate
+
+
+@node Custom installation
+@section Custom installation
+
+@cindex custom installation
+@cindex installation, customized
+
+Most sites need to modify the default installation procedure in some
+way, perhaps merely changing the prefix from @samp{/usr/local}, perhaps
+adding extra compiler or loader options to work around @code{configure}
+bugs.  This section explains how to override default choices.  For
+additional distribution-specific information:
+@itemize @bullet
+@item @file{dviljk/INSTALL}.
+@item @xref{Installation,,,dvips,Dvips}.
+@item @xref{Installation,,,web2c,Web2c}.
+@item @file{xdvik/INSTALL}.
+@end itemize
+
+@cindex non-Unix operating systems
+@cindex Amiga support
+@cindex DOS support
+@cindex OS/2 support
+@cindex VMS support
+These instructions are for Unix systems.  Other operating-system
+specific distributions have their own instructions.  The code base
+itself supports Amiga, DOS, OS/2, and VMS.
+
+
+Following are the same steps as in the previous section (which describes
+the simplest installation), but with much more detail.
+
+@menu
+* Disk space::                          
+* Kpathsea application distributions::  
+* Changing search paths::               
+* Running configure::                   
+* Running make::                        
+* Installing files::                    
+* Cleaning up::                         
+* Filename database generation::        
+* MakeTeX scripts::                     
+* Installation testing::               
+@end menu
+
+
+@node Disk space
+@subsection Disk space
+
+@cindex disk space, needed
+@cindex total disk space
+@cindex size of distribution archives
+Here is a table showing the disk space needed for each distribution
+(described in the next section).  The `(totals)' line reflects the
+@samp{texk} source distribution and @samp{texmflib}; the individual
+distributions don't enter into it.  Sizes are in megabytes.  All numbers
+are approximate.
+
+@multitable {distribution} {.tar.gz} {unpacked} {compiled} {installed}
+@item dviljk   @tab   .9 @tab  3.8 @tab
+@item dvipsk   @tab   .9 @tab  3.2 @tab
+@item xdvik    @tab   .7 @tab  2.5 @tab
+@item web2c    @tab  1.3 @tab  5.0 @tab
+@item web      @tab  1.9 @tab  6.5 @tab    - @tab -
+@item texk     @tab  3.8 @tab 14.1 @tab 43.1 @tab 23.5
+@item texmflib @tab  3.8 @tab 15.0 @tab    - @tab 15.0
+@item (totals) @tab  7.6 @tab 29.1 @tab 43.1 @tab 38.5
+@end multitable
+
+
+@node Kpathsea application distributions
+@subsection Kpathsea application distributions
+
+@cindex distributions, compiling simultaneously
+@cindex version number, of Kpathsea
+@cindex Kpathsea version number
+
+@cindex distributions, not compiling
+@cindex NeXT, lacking X11
+@cindex X11, lacking on NeXT
+The archive @url{ftp://ftp.tug.org/tex/texk.tar.gz} contains all of the
+Kpathsea applications I maintain, and the library itself.  For example,
+since NeXT does not generally support X11, you'd probably want to skip
+@samp{xdvik} (or simply remove it after unpacking @file{texk.tar.gz}.
+If you are not interested in all of them, you can also retrieve them
+separately:
+
+@cindex DVI drivers
+@table @file
+@item dviljk.tar.gz
+@cindex PCL driver
+@cindex LaserJet drive
+DVI to PCL, for LaserJet printers.
+
+@item dvipsk.tar.gz
+@cindex PDF generation
+@cindex PostScript driver
+DVI to PostScript, for previewers, printers, or PDF generation.
+
+@item web2c.tar.gz
+The software needed to compile @TeX{} and friends.
+
+@item web.tar.gz
+The original WEB source files, also used in compilation.
+
+@item xdvik.tar.gz
+@cindex X11 previewer
+DVI previewing under the X window system.
+
+@end table
+
+@cindex Babel
+@cindex non-English typesetting
+If you want to use the Babel La@TeX{} package for support of non-English
+typesetting, you may need to retrieve additional files.  See the file
+@file{install.txt} in the Babel distribution.
+
+
+@node Changing search paths
+@subsection Changing search paths
+
+@cindex search paths, changing default
+@cindex paths, changing default
+@flindex texmf.cnf.in@r{, editing}
+If the search paths for your installation differ from the standard
+@TeX{} directory structure (@pxref{Top,, Introduction, tds, A Directory
+Structure for @TeX{} files}), edit the file @file{kpathsea/texmf.cnf.in}
+as desired, before running @code{configure}.  For example, if you have
+all your fonts or macros in one big directory.
+
+You may also wish to edit the file @file{MakeTeXnames.cnf}, either
+before or after installation, to control various aspects of
+@code{MakeTeXPK} and friends.  @xref{MakeTeX configuration}.
+
+You do not need to edit @file{texmf.cnf.in} to change the default
+top-level or other installation @emph{directories} (only the paths).
+You can and should do that when you run @code{configure} (next step).
+
+You also do not need to edit @file{texmf.cnf.in} if you are willing to
+rely on @file{texmf.cnf} at runtime to define the paths, and let the
+compile-time default paths be incorrect.  Usually there is no harm in
+doing this.
+
+The section below explains default generation in more detail.
+
+@menu
+* Default path features::       
+* Default path generation::     
+@end menu
+
+
+@node Default path features
+@subsubsection Default path features
+
+@cindex default path features
+@cindex features, of default paths
+
+The purpose of having all the different files described in the section
+above is to avoid having the same information in more than one place. If
+you change the installation directories or top-level prefix at
+@code{configure}-time, those changes will propagate through the whole
+sequence.  And if you change the default paths in @file{texmf.cnf.in},
+those changes are propagated to the compile-time defaults.
+
+The Make definitions are all repeated in several @t{Makefile}'s; but
+changing the top-level @file{Makefile} should suffice, as it passes down
+all the variable definitions, thus overriding the submakes.  (The
+definitions are repeated so you can run Make in the subdirectories, if
+you should have occasion to.)
+
+@vindex MAKETEX_MODE
+@cindex paths, device name included in
+By default, the bitmap font paths end with @samp{/$MAKETEX_MODE}, thus
+including the device name (usually a Metafont mode name such as
+@samp{ljfour}).  This distinguishes two different devices with the same
+resolution---a write/white from a write/black 300@dmn{dpi} printer, for
+example.
+
+@findex kpse_init_prog@r{, and @code{MAKETEX_MODE}}
+@flindex proginit.c
+However, since most sites don't have this complication, Kpathsea
+(specifically, the @code{kpse_init_prog} function in
+@file{kpathsea/proginit.c}) has a special case: if the mode has not been
+explicitly set by the user (or in a configuration file), it sets
+@code{MAKETEX_MODE} to @code{/}.  This makes the default PK path, for
+example, expand into @code{@dots{}/pk//}, so fonts will be found even if
+there is no subdirectory for the mode (if you arranged things that way
+because your site has only one printer, for example) or if the program
+is mode-independent (e.g., @code{pktype}).
+
+To make the paths independent of the mode, simply edit
+@file{texmf.cnf.in} before installation, or the installed
+@file{texmf.cnf}, and remove the @samp{$MAKETEX_MODE}.
+
+@xref{MakeTeX script arguments}, for how this interacts with @code{MakeTeXPK}.
+
+@flindex HIER
+@flindex kpathsea/HIER
+@xref{TeX directory structure,, @TeX{} directory structure}, for a
+description of the default arrangement of the input files that comprise
+the @TeX{} system.  The file @file{kpathsea/HIER} is a copy of that
+section.
+
+
+@node Default path generation
+@subsubsection Default path generation
+
+@cindex default paths, changing
+@cindex paths, changing default
+@cindex installation, changing default directories
+@cindex directories, changing default installation
+
+This section describes how the default paths are constructed.
+
+You may wish to ignore the whole mess and simply edit @file{texmf.cnf}
+after it is installed, perhaps even copying it into place beforehand so
+you can complete the installation, if it seems necessary.
+
+@cindex default paths, how they're made
+To summarize the chain of events that go into defining the default paths:
+
+@enumerate
+@item
+@samp{configure} creates a @file{Makefile} from each @file{Makefile.in}.
+
+@item
+@flindex texmf.sed
+When Make runs in the @file{kpathsea} directory, it creates a file
+@file{texmf.sed} that substitutes the Make value of @code{$(var)} for a
+string @code{@@var@@}.  The variables in question are the one that
+define the installation directories.
+
+@item
+@flindex texmf.cnf.in
+@flindex texmf.cnf@r{, generated}
+@file{texmf.sed} (together with a little extra magic---see
+@file{kpathsea/Makefile}) is applied to @file{texmf.cnf.in} to generate
+@file{texmf.cnf}.  This is the file that will eventually be installed
+and used.
+
+@item
+@flindex paths.h
+The definitions in @file{texmf.cnf} are recast as C @code{#define}'s in
+@file{paths.h}.  These values will be the compile-time defaults; they
+are not used at runtime unless no @file{texmf.cnf} file can be found.
+
+(That's a lie: the compile-time defaults are what any extra @t{:}'s in
+@file{texmf.cnf} expand into; but the paths as distributed have no extra
+@t{:}'s, and there's no particular reason for them to.)
+@end enumerate
+
+
+@node Running configure
+@subsection Running @code{configure}
+
+@flindex configure@r{, running}
+@flindex c-auto.h.in
+@flindex Makefile.in
+@findex ac_include@r{, Autoconf extension}
+@cindex @@@var{var}@@ substitutions
+@cindex system dependencies
+Run @code{sh configure @var{options}} (in the top-level directory, the
+one containing @file{kpathsea/}), possibly using a shell other than
+@code{sh} (@pxref{configure shells}).
+
+@code{configure} adapts the source distribution to the present system
+via @code{#define}'s in @file{*/c-auto.h}, which are created from the
+corresponding @file{c-auto.h.in}.  It also creates a @file{Makefile} from
+the corresponding @file{Makefile.in}, doing @samp{@@@var{var}@@} and
+@samp{ac_include} substitutions).
+
+@flindex CONFIGURE
+@flindex kpathsea/CONFIGURE
+@code{configure} is the best place to control the configuration,
+compilation, and installed location of the software, either via
+command-line options, or by setting environment variables before
+invoking it.  For example, you can disable @code{MakeTeXPK} by default
+with the option @samp{--disable-maketexpk}.
+@xref{configure options}.
+
+@menu
+* configure shells::            
+* configure options::           
+* configure environment::
+* configure scenarios::         
+* Shared library::
+@end menu
+
+
+@node configure shells
+@subsubsection @code{configure} shells
+
+@cindex shells and @code{configure}
+@pindex bash@r{, recommended for running @code{configure}}
+
+If you have Bash, the GNU shell, use it if @code{sh} runs into trouble
+(@pxref{Top,,,features,Bash Features}).
+
+Most Bourne shell variants other than Bash cannot handle
+@code{configure} scripts as generated by GNU Autoconf (@pxref{Top,
+Introduction,, autoconf, Autoconf}).  Specifically:
+@table @code
+@item ksh
+@pindex ksh@r{, losing with @code{configure}}
+@pindex bsh@r{, ok with @code{configure}}
+@cindex Korn shell@r{, losing with @code{configure}}
+@cindex AIX shells and @code{configure}
+The Korn shell may be installed as @file{/bin/sh} on AIX.
+@file{/bin/bsh} may serve instead.
+
+@item ash
+@pindex ash@r{, losing with @code{configure}}
+@cindex NetBSD shells and @code{configure}
+@cindex FreeBSD shells and @code{configure}
+@cindex Linux shells and @code{configure}
+Ash is sometimes installed as @file{/bin/sh} on NetBSD, FreeBSD, and
+Linux systems.  @file{/bin/bash} should be available.
+
+@item @r{Ultrix} /bin/sh
+@cindex DEC shells and @code{configure}
+@cindex Ultrix shells and @code{configure}
+@pindex sh5@r{, ok with @code{configure}}
+@file{/bin/sh} under Ultrix is a DEC-grown shell that is notably
+deficient in many ways.  @file{/bin/sh5} may be necessary.
+@end table
+
+
+@node configure options
+@subsubsection @code{configure} options
+
+@cindex @code{configure} options
+
+For a complete list of all @code{configure} options, run @samp{configure
+--help} or @pxref{Invoking configure,, Running @code{configure} scripts,
+autoconf, Autoconf} (a copy is in the file @file{kpathsea/CONFIGURE}).
+The generic options are listed first in the @samp{--help} output, and
+the package-specific options come last.  The environment variables
+@code{configure} pays attention to are listed below.
+
+Options particularly likely to be useful are @samp{--prefix},
+@samp{--datadir}, and the like; @pxref{configure scenarios}.
+
+@opindex --with @r{options}
+@opindex --enable @r{options}
+@cindex configuration of optional features
+@cindex options to @code{configure}
+This section gives pointers to descriptions of the @samp{--with} and
+@samp{--enable} options to @code{configure} that Kpathsea-using programs
+accept.
+
+@table @samp
+@item --without-maketexmf-default
+@itemx --without-maketexpk-default
+@itemx --without-maketextfm-default
+@itemx --with-maketextex-default
+Enable or disable the dynamic generation programs.  @xref{MakeTeX
+configuration}.
+
+@item --enable-shared
+Build Kpathsea as a shared library, and link against it.  Also build the
+usual static library.  @xref{Shared library}.
+
+@item --disable-static
+Build only the shared library.
+@end table
+
+
+@node configure environment                           
+@subsubsection @code{configure} environment
+
+@code{configure} uses the value of the following environment variables in
+determining your system's characteristics, and substitutes for them in
+@t{Makefile}'s:
+
+@vtable @samp
+@item CC
+@pindex gcc@r{, compiling with}
+@pindex cc@r{, compiling with}
+The compiler to use: default is @code{gcc} if it's installed, otherwise
+@code{cc}.
+
+@item CFLAGS
+@cindex compiler options, specifying
+Options to give the compiler: default is @samp{-g -O2} for @code{gcc},
+@samp{-g} otherwise.  @code{CFLAGS} comes after any other options.  You
+may need to include @code{-w} here if your compilations commonly have
+useless warnings (e.g., @code{NULL redefined}), or @code{configure} may
+fail to detect the presence of header files (it takes the messages on
+standard error to mean the header file doesn't exist).
+
+@item CPPFLAGS
+@cindex configuration compiler options
+Options to pass to the compiler preprocessor; this matters most for
+configuration, not the actual source compilation.  The @code{configure}
+script often does only preprocessing (e.g., to check for the existence
+of @t{#include} files), and @code{CFLAGS} is not used for this.  You may
+need to set this to something like
+@samp{-I/usr/local/include/wwwhatever} if you have the libwww library
+installed for hyper-xdvik (see @file{xdvik/INSTALL}).
+
+@item DEFS
+@cindex preprocessor options
+Additional preprocessor options, but not used by @code{configure}.
+Provided for enabling or disabling program features, as documented in
+the various program-specific installation instructions.  @code{DEFS}
+comes before any compiler options included by the distribution
+@file{Makefile}s or by @code{configure}.
+
+@item LDFLAGS
+@cindex loader options
+Additional options to give to the loader.  @code{LDFLAGS} comes before
+any other linker options.
+
+@item LIBS
+@cindex libraries, specifying additional
+Additional libraries to link with.
+@end vtable
+
+
+@node configure scenarios
+@subsubsection @code{configure} scenarios
+
+Here are some common installation scenarios:
+
+@itemize @bullet
+@item
+Including X support in Metafont.  This is disabled by default, since
+many sites have no use for it, and it's a leading cause of configuration
+problems.
+@example
+configure --with-x-toolkit
+@end example
+
+@item
+@cindex @TeX{} hierarchy, one
+Putting the binaries, @TeX{} files, GNU info files, etc.@: into a single
+@TeX{} hierarchy, say @var{texmf}, requires overriding defaults in both
+@code{configure} and @code{make}:
+@example
+configure --prefix=@var{texmf} --datadir=@var{texmf}
+make texmf=@var{texmf}
+@end example
+
+@item
+@cindex multiple architectures, compiling on
+@cindex architectures, compiling multiple
+@cindex symbolic link trees, for multiple architectures
+@opindex --srcdir@r{, for building multiple architectures}
+@pindex lndir @r{for building symlink trees}
+You can compile on multiple architectures simultaneously either by
+building symbolic link trees with the @code{lndir} script from the X11
+distribution, or with the @samp{--srcdir} option:
+@example
+configure --srcdir=@var{srcdir}
+@end example
+
+@item
+@cindex multiple architectures, directories for
+If you are installing binaries for multiple architectures into a single
+hierarchy, you will probably want to override the default @file{bin} and
+@file{lib} directories, something like this:
+@example
+configure --prefix=@var{texmf} --datadir=@var{texmf} \
+  --bindir=@var{texmf}/@var{arch}/bin --libdir=@var{texmf}/@var{arch}/lib
+make texmf=@var{texmf}
+@end example
+@pindex depot
+@cindex automounter, and configuration
+@noindent (Unless you make provisions for architecture-specific files in
+other ways, e.g., with Depot or an automounter.)
+
+@item
+@opindex -O@r{, compiling with}
+@opindex -g@r{, compiling without}
+@cindex optimization, enabling
+@cindex debugging with @samp{-g}, disabling
+To compile with optimization (to compile without debugging, remove the
+@samp{-g}):
+@example
+env CFLAGS="-g -O" sh configure @dots{}
+@end example
+@noindent For a potential problem if you optimize, see @ref{TeX or
+Metafont failing,, @TeX{} or Metafont failing}.
+@end itemize
+  
+
+@node Shared library
+@subsubsection Shared library
+
+@cindex shared library, making
+
+@opindex --enable-shared
+You can compile Kpathsea as a shared library on a few systems, by
+specifying the option @samp{--enable-shared} when you run
+@samp{configure}.
+
+@cindex code sharing
+The main advantage in doing this is that the executables can then share
+the code, thus decreasing memory and disk space requirements.
+
+On some systems, you can record the location of shared libraries in a
+binary, usually by giving certain options to the linker.  Then
+individual users do not need to set their system's environment variable
+(e.g., @code{LD_LIBRARY_PATH}) to find shared libraries.  If you want to
+do this, you will need to add the necessary options to @code{LDFLAGS}
+yourself; for example, on Solaris, include something like
+@samp{-R$@{prefix@}/lib}.  (Unfortunately, making this happen by default
+is very difficult, because of interactions with an existing installed
+shared library.)
+
+Currently, shared library support is implemented only on SunOS 4
+(Solaris 1) and SunOS 5 (Solaris 2).  If you're interested and willing
+in adding support for other systems, please see the @samp{configure}
+mode in the @file{klibtool} script, especially the host-specific case
+statement around line 250.
+
+
+@node Running make
+@subsection Running @code{make}
+
+@pindex make@r{, running}
+
+@flindex texmf.cnf@r{, creating}
+@flindex paths.h@r{, creating}
+@code{make} (still in the top-level directory).  This also creates the
+@file{texmf.cnf} and @file{paths.h} files that define the default search
+paths, and (by default) the @samp{plain} and @samp{latex} @TeX{} formats.
+
+@cindex fallback resolutions, overriding
+You can override directory names and other values at @code{make}-time.
+@file{make/paths.make} lists the variables most commonly reset.  For
+example, @samp{make default_texsizes=600} changes the list of fallback
+resolutions.
+
+You can also override each of @code{configure}'s environment variables
+(@pxref{configure environment}).  The Make variables have the same names.
+
+Finally, you can supply additional options via the following variables.
+(@code{configure} does not use these.)
+
+@vtable @samp
+@item XCPPFLAGS
+@itemx XDEFS
+@cindex preprocessor options, additional
+Preprocessor options.
+
+@item XCFLAGS
+@cindex compiler options, additional
+Compiler options.
+
+@item XLDFLAGS
+@cindex loader options, initial
+Loader options (included at beginning of link commands).
+
+@item XLOADLIBES
+@cindex loader options, final
+More loader options (included at end of link commands).
+
+@item XMAKEARGS
+@cindex Make arguments, additional
+Additional Make arguments passed to all sub-@code{make}'s. You may need
+to include assignments to the other variables here via @code{XMAKEARGS};
+for example: @samp{make XMAKEARGS="CFLAGS=-O XDEFS=-DA4"}.
+@end vtable
+
+@cindex compiler, changing
+@cindex libraries, changing
+It's generally a bad idea to use a different compiler (@samp{CC}) or
+libraries (@code{LIBS}) for compilation than you did for configuration,
+since the values @code{configure} determined may then be incorrect.
+
+@cindex universe, BSD vs.@: system V
+@cindex BSD universe
+@cindex system V universe
+@cindex Solaris BSD compatibility, not
+@flindex libucb@r{, avoiding}
+@flindex ucbinclude@r{, avoiding}
+Adding compiler options to change the ``universe'' you are using
+(typically BSD vs.@: system V) is generally a cause of trouble.  It's
+best to use the native environment, whatever that is; @code{configure}
+and the software usually adapt best to that.  In particular, under
+Solaris 2.x, you should not use the BSD-compatibility library
+(@file{libucb}) or include files (@file{ucbinclude}).
+
+@cindex Babel
+If you want to use the Babel La@TeX{} package for support of non-English
+typesetting, you need to modify some files before making the La@TeX{}
+format.  See the file @file{install.txt} in the Babel distribution.
+
+
+@node Installing files
+@subsection Installing files
+
+@cindex installing files
+
+The basic command is the usual @code{make install}.  For security
+issues, @pxref{Security}.
+
+The first time you install any manual in the GNU Info system, you should
+add a line (you choose where) to the file @file{dir} in your
+@samp{$(infodir)} directory.  Sample text for this is given near the top
+of the Texinfo source files (@file{kpathsea/kpathsea.texi},
+@file{dvipsk/dvips.texi}, and @file{web2c/doc/web2c.texi}).
+If you have a recent version of the GNU Texinfo distribution installed
+(@url{ftp://prep.ai.mit.edu/pub/gnu/texinfo-3.9.tar.gz} or later), this
+should happen automatically.
+
+On the offchance that this is your first Info installation, the
+@file{dir} file I use is included in the distribution as
+@file{etc/dir-example}.
+
+@cindex multiple architectures, installing on
+@cindex architecture-(in)dependent files, installing only
+@cindex installation, architecture-(in)dependent files only
+You may wish to use one of the following targets, especially if you are
+installing on multiple architectures:
+@itemize @bullet
+@item
+@findex install-exec @r{Make target}
+@code{make install-exec} to install in architecture-dependent
+directories, i.e., ones that depend on the @code{$(exec_prefix)} Make
+variable.  This includes links to binaries, libraries, etc., not just
+``executables''.
+
+@item
+@findex install-data @r{Make target}
+@code{make install-data} to install in architecture-independent
+directories, such as documentation, configuration files, pool files, etc.
+@end itemize
+
+@cindex AFS
+@cindex Andrew File System, installing with
+@flindex /afs/@dots{} @r{, installing into}
+If you use the Andrew File System, the normal path (e.g.,
+@var{prefix}/bin) only gets you to a read-only copy of the files, and
+you must specify a different path for installation.  The best way to do this
+is by setting the @samp{prefix} variable on the @code{make} command
+line.  The sequence becomes something like this:
+@example
+configure --prefix=/whatever
+make
+make install prefix=/afs/.@var{system.name}/system/1.3/@@sys/whatever
+@end example
+@flindex ls-R @r{and AFS}
+@cindex relative filenames in @file{ls-R}
+@noindent With AFS, you will definitely want to use relative filenames in 
+@file{ls-R} (@pxref{Filename database}), not absolute filenames.  This
+is done by default, but check anyway.
+
+
+@node Cleaning up
+@subsection Cleaning up
+
+@findex distclean @r{Make target}
+The basic command is @code{make distclean}.  This removes all files
+created by the build.
+
+Alternatively,
+@itemize @bullet
+@item
+@findex mostlyclean @r{Make target}
+@code{make mostlyclean} if you intend to compile on another
+architecture.  For Web2c, since the generated C files are portable,
+they are not removed.  If the @code{lex} vs.@: @code{flex} situation
+is going to be different on the next machine, @code{rm
+web2c/lex.yy.c}.
+
+@item
+@findex clean @r{Make target}
+@code{make clean} to remove files created by compiling, but leave
+configuration files and Makefiles.
+
+@item
+@findex maintainer-clean @r{Make target}
+@code{make maintainer-clean} to remove everything that the Makefiles can
+rebuild.  This is more than @samp{distclean} removes, and you should
+only use it if you are thoroughly conversant with (and have the necessary
+versions of) Autoconf.
+
+@item
+@findex extraclean @r{Make target}
+@code{make extraclean} to remove other junk, e.g., core files, log
+files, patch rejects.  This is independent of the other @samp{clean}
+targets.
+@end itemize
+
+
+@node Filename database generation
+@subsection Filename database generation
+
+@cindex filename database generation
+@cindex generation of filename database
+
+You will probably want to set up a @code{cron} entry on the appropriate
+machine(s) to rebuild the filename database nightly or so, as in:
+@example
+0 0 * * * cd @var{texmf} && @var{/bindir}/MakeTeXls-R
+@end example
+@noindent @xref{Filename database}.
+
+Although the @code{MakeTeX@dots{}} scripts make every effort to add
+newly-created files on the fly, it can't hurt to make sure you get a
+fresh version every so often.
+
+
+@node MakeTeX scripts
+@subsection @file{MakeTeX} scripts
+
+@cindex @file{MakeTeX} scripts
+@cindex scripts for file creation
+
+@cindex font set, infinite
+@cindex dynamic creation of files
+@cindex Sauter fonts, and dynamic source creation
+@cindex DC fonts, and dynamic source creation
+If Kpathsea cannot otherwise find a file, for some file types it is
+configured by default to invoke an external program to create it
+dynamically (@pxref{MakeTeX configuration}).  This is most useful for
+fonts (bitmaps, TFM's, and arbitrarily-sizable Metafont sources such as
+the Sauter and DC fonts), since any given document can use fonts never
+before referenced.  Trying to build all fonts in advance is therefore
+impractical, if not impossible.
+
+The script is passed the name of the file to create and possibly other
+arguments, as explained below.  It must echo the full pathname of the
+file it created (and nothing else) to standard output; it can write
+diagnostics to standard error.
+
+@menu
+* MakeTeX configuration::
+* MakeTeX script names::
+* MakeTeX script arguments::
+@end menu
+
+
+@node MakeTeX configuration
+@subsubsection @file{MakeTeX} configuration
+
+@cindex @file{MakeTeX} script configuration
+@cindex configuration of @file{MakeTeX} scripts
+@cindex enabling @file{MakeTeX} scripts
+@cindex disabling @file{MakeTeX} scripts
+
+The following file types can run an external program to create missing
+files: @file{pk}, @file{tfm}, @file{mf}, @file{tex}; the scripts are
+named @file{MakeTeXPK}, @file{MakeTeXTFM}, @file{MakeTeXMF}, and
+@file{MakeTeXTeX}.
+
+In the absence of @code{configure} options specifying otherwise,
+everything but @file{MakeTeXTeX} will be enabled by default. The
+@code{configure} options to change the defaults are:
+
+@cindex @code{configure} options for @file{MakeTeX} scripts
+@opindex --without-maketexmf-default
+@opindex --without-maketexpk-default
+@opindex --without-maketextfm-default
+@opindex --with-maketextex-default
+@example
+--without-maketexmf-default
+--without-maketexpk-default
+--without-maketextfm-default
+--with-maketextex-default
+@end example
+
+The @code{configure} setting is overridden if the environment variable
+or configuration file value named for the script is set; e.g.,
+@file{MAKETEXPK} (@pxref{MakeTeX script arguments}).
+
+@flindex MakeTeX.site
+@cindex site overrides for @code{MakeTeX@dots{}}
+As distributed, all the scripts source a file
+@file{texmf/web2c/MakeTeX.site} if it exists, so you can override
+various defaults.  See @file{MakeTeXcommon}, for instance, which defines
+the default mode, resolution, directory permissions, some special
+directory names, etc.  If you prefer not to change the distributed
+scripts, you can simply create @file{MakeTeX.site} with the appropriate
+definitions (you do not need to create it if you have nothing to put in
+it).  @file{MakeTeX.site} has no special syntax; it's an arbitrary
+Bourne shell script.  The distribution contains a sample
+@file{MakeTeX.site} for you to copy and modify as you please (it is not
+installed anywhere).
+
+@flindex MakeTeXnames.cnf
+@vindex MT_FEATURES
+In addition, you can configure a number of features with the
+@code{MT_FEATURES} variable, which you can define:
+@itemize @bullet
+@item
+in @file{MakeTeX.site}, as just mentioned;
+
+@item
+by editing the file @file{MakeTeXnames.cnf}, either before @samp{make
+install} (in the source hierarchy) or after (in the installed
+hierarchy);
+
+@item
+or in the environment.
+@end itemize
+
+By default, @code{MakeTeXPK} installs fonts into the standard @TeX{}
+directory structure (@pxref{TeX directory structure,, @TeX{} directory
+structure}).  It uses aliases and directory names from the Fontname
+distribution (@pxref{Top,, Introduction, fontname, Fontname}). Most of
+the options here change that.
+
+@vtable @samp
+@item appendonlydir
+@cindex directories, making append-only
+@flindex MakeTeXmkdir
+Tell @code{MakeTeXmkdir} to create directories append-only, i.e., set
+their sticky bit (@pxref{Mode Structure,,, fileutils, GNU File
+Utilities}).
+
+@item dosnames
+@cindex 8.3 filenames, using
+@cindex DOS compatible names
+@flindex dpi@var{nnn} directories
+Use 8.3 names; e.g., @file{dpi600/cmr10.pk} instead of
+@file{cmr10.600pk}.
+
+@item nomode
+@cindex mode directory, omitting
+Omit the directory level for the mode name; this is fine as long as
+you generate fonts for only one mode.
+
+@item strip
+@cindex supplier directory, omitting
+@cindex typeface directory, omitting
+Omit the font supplier and typeface name directory levels.
+
+@item varfonts
+@flindex /var/tex/fonts
+@vindex VARTEXFONTS
+@cindex Linux File System Standard
+Put @code{MakeTeXPK}-generated fonts under the directory named
+by @code{VARTEXFONTS}; the default value in @file{kpathsea/texmf.cnf.in}
+is @file{/var/tex/fonts}, as recommended by the @cite{Linux File System
+Standard} (but unless @samp{varfonts} is enabled, nothing cares about
+that value).
+
+@vindex USE_VARTEXFONTS
+The @samp{varfonts} setting in @code{MT_FEATURES} is overridden by the
+@code{USE_VARTEXFONTS} environment variable: if set to @samp{1}, the
+feature is enabled, and if set to @samp{0}, the feature is disabled.
+@end vtable
+
+
+@node MakeTeX script names
+@subsubsection @file{MakeTeX} script names
+
+@cindex @file{MakeTeX} script names
+@cindex names for @file{MakeTeX} scripts
+
+@flindex tex-make.c
+@vindex kpse_make_specs
+The following table shows the default name of the script for each
+possible file types.  (The source is the variable @code{kpse_make_specs}
+in @file{kpathsea/tex-make.c}.)
+
+@table @file
+@item MakeTeXPK
+@pindex MakeTeXPK
+Glyph fonts.
+
+@item MakeTeXTeX
+@pindex MakeTeXTeX
+@TeX{} input files.
+
+@item MakeTeXMF
+@pindex MakeTeXMF
+Metafont input files.
+
+@item MakeTeXTFM
+@pindex MakeTeXTFM
+TFM files.
+@end table
+
+@vindex DVIPSMAKEPK
+@vindex XDVIMAKEPK
+@vindex DVILJMAKEPK
+@noindent These names are overridden by an environment variable specific
+to the program---for example, @code{DVIPSMAKEPK} for Dvipsk.
+
+@comment next two paragraphs are repeated in dvips.texi
+@flindex missfont.log
+@cindex failed @code{MakeTeX@dots{}} script invocation
+If a @code{MakeTeX@dots{}} script fails, the invocation is appended to a
+file @file{missfont.log} (by default) in the current directory.  You can
+then execute the log file to create the missing files after fixing the
+problem.
+
+@vindex TEXMFOUTPUT
+@vindex MISSFONT_LOG
+If the current directory is not writable and the environment variable or
+configuration file value @code{TEXMFOUTPUT} is set, its value is
+used.  Otherwise, nothing is written.  The name @samp{missfont.log} is
+overridden by the @code{MISSFONT_LOG} environment variable or
+configuration file value.
+
+
+@node MakeTeX script arguments
+@subsubsection @file{MakeTeX} script arguments
+
+@cindex arguments to @file{MakeTeX}
+
+The first argument to a @file{MakeTeX} script is always the name
+of the file to be created.
+
+In the default @file{MakeTeXPK} implementation, from three to five
+additional arguments may also passed, via environment variables:
+
+@enumerate
+@item
+@vindex KPATHSEA_DPI
+The resolution to make the font at (@code{KPATHSEA_DPI}).
+
+@item
+@vindex MAKETEX_BASE_DPI
+@cindex base dpi
+The ``base dpi'' the program is operating at (@code{MAKETEX_BASE_DPI}),
+i.e., the assumed resolution of the output device.
+
+@item
+@vindex MAKETEX_MAG
+@vindex mag @r{Metafont variable}
+@cindex magstep for @code{MakeTeXPK}
+A ``magstep'' string suitable for the Metafont @code{mag} variable
+(@code{MAKETEX_MAG}).
+
+@item
+@vindex MAKETEX_MODE
+@vindex mode @r{Metafont variable}
+@cindex Metafont mode name for @code{MakeTeXPK}
+Optionally, a Metafont mode name to assign to the Metafont @code{mode}
+variable (@code{MAKETEX_MODE}).  Otherwise, (the default)
+@code{MakeTeXPK} guesses the mode from the resolution.  @xref{TeX
+directory structure,, @TeX{} directory structure}.
+
+@item
+@vindex mtp_destdir
+@cindex destination directory for @code{MakeTeXPK}
+Optionally, a directory name. If the directory is absolute, it is used
+as-is. Otherwise, it is appended to the root destination directory set
+in the script (from environment variables @code{DESTDIR} or
+@code{MTP_DESTDIR} or a compile-time default). If this argument is not
+supplied, the mode name is appended to the root destination directory.
+@end enumerate
+
+@noindent Kpathsea sets @code{KPATHSEA_DPI} appropriately for each
+attempt at building a font.  It's up to the program using Kpathsea to
+set the others. (@xref{Calling sequence}.)
+
+@vindex MAKETEXPK @r{environment variable}
+@cindex specification for @code{MakeTeXPK}
+You can change the specification for the arguments passed to the
+external script by setting the environment variable named as the script
+name, but all capitals---@code{MAKETEXPK}, for example.  If you've
+changed the script name by setting (say) @code{DVIPSMAKEPK} to
+@samp{foo}, then the spec is taken from the environment variable
+@code{FOO}.
+
+The spec can contain any variable references, to the above variables or
+any others.  As an example, the default spec for @code{MakeTeXPK} is:
+@example
+$KPATHSEA_DPI $MAKETEX_BASE_DPI $MAKETEX_MAG $MAKETEX_MODE
+@end example
+
+@noindent The convention of passing the name of the file to be created
+as the first argument cannot be changed.
+
+
+@node Installation testing 
+@subsection Installation testing
+
+@cindex testing, post-installation
+@cindex installation testing
+
+Besides the tests listed in @ref{Simple installation}, you can try
+running @samp{make check}.  This includes the torture tests (trip, trap,
+and mptrap) that come with Web2c (@pxref{Torture tests,,, web2c, Web2c}).
+
+
+@node Security
+@section Security
+
+@cindex security considerations
+
+None of the programs in the @TeX{} system require any special system
+privileges, so there's no first-level security concern of people gaining
+illegitimate root access.
+
+@cindex trojan horse attack
+@flindex .rhosts@r{, writable by @TeX{}}
+A @TeX{} document, however, can write to arbitrary files, e.g.,
+@file{~/.rhosts}, and thus an unwitting user who runs @TeX{} on a random
+document is vulnerable to a trojan horse attack.  This loophole is
+closed by default, but you can be permissive if you so desire in
+@file{texmf.cnf}.  @xref{tex invocation,,, web2c, Web2c}.  MetaPost has
+the same issue.
+
+Dvips, Xdvi, and @TeX{} can also execute shell commands under some
+circumstances.  To disable this, see the @samp{-R} option in @ref{Option
+details,,, dvips, Dvips}, the xdvi man page, and @ref{tex
+invocation,,, web2c, Web2c}, respectively.
+
+@cindex globally writable directories
+Another security issue arises because it's very useful---almost
+necessary---to make arbitrary fonts on user demand with @code{MakeTeXPK}
+and friends.  Where do these files get installed?  By default, the
+@code{MakeTeXPK} distributed with Kpathsea assumes a globally writable
+@file{texmf} tree; this is the simplest and most convenient approach,
+but it may not suit your situation.
+
+@cindex append-only directories and @code{MakeTeXPK}
+The first restriction you can apply is to make newly-created directories
+under @file{texmf} be append-only with an option in
+@file{MakeTeXnames.cnf}.  @xref{MakeTeX configuration}.
+
+@cindex group-writable directories
+@cindex setgid scripts
+Another approach is to establish a group (or user) for @TeX{} files,
+make the @file{texmf} tree writable only to that group (or user), and
+make @code{MakeTeXPK} et al.@: setgid to that group (or setuid to that
+user).  Then users must invoke the scripts to install things.  (If
+you're worried about the inevitable security holes in scripts, then you
+could write a C wrapper to exec the script.)
+
+@cindex local cache of fonts
+@cindex cache of fonts, loca
+Finally, using a central writable @file{texmf} tree may be completely
+impossible, because it's on an NFS filesystem that you cannot export
+read/write, or AFS is in use, or simply because ``it's policy''.  Then
+you must resort to each user's machine having its own local directory of
+dynamically-created fonts; again, @file{MakeTeXnames.cnf} has an option
+to do this, and again, @pxref{MakeTeX configuration}.
new file mode 100644
--- /dev/null
+++ b/kpathsea/kdefault.c
@@ -0,0 +1,120 @@
+/* kdefault.c: Expand extra colons.
+   (This is not named default.c because then the OSF/1 make tries to
+   make a program `default' from it, since we have a target `default';
+   and OSF/1 make doesn't understand .PHONY.)
+
+Copyright (C) 1993, 94, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/default.h>
+
+
+/* Check for leading colon first, then trailing, then doubled, since
+   that is fastest.  Usually it will be leading or trailing.  */
+
+string 
+kpse_expand_default P2C(const_string, path,  const_string, fallback)
+{
+  unsigned path_length;
+  string expansion;
+  
+  /* The default path better not be null.  */
+  assert (fallback);
+  
+  if (path == NULL)
+    expansion = (string) fallback;
+
+  /* Solitary or leading :?  */
+  else if (IS_ENV_SEP (*path))
+    {
+      expansion = path[1] == 0 ? (string) fallback : concat (fallback, path);
+    }
+
+  /* Sorry about the assignment in the middle of the expression, but
+     conventions were made to be flouted and all that.  I don't see the
+     point of calling strlen twice or complicating the logic just to
+     avoid the assignment (especially now that I've pointed it out at
+     such great length).  */
+  else if (path[(path_length = strlen (path)) - 1] == ENV_SEP)
+    expansion = concat (path, fallback);
+
+  /* OK, not leading or trailing.  Check for doubled.  */
+  else
+    {
+      const_string loc;
+
+      /* What we'll return if we find none.  */
+      expansion = (string) path;
+
+      for (loc = path; *loc && expansion == path; loc++)
+        {
+          if (IS_ENV_SEP (loc[0]) && IS_ENV_SEP (loc[1]))
+            { /* We have a doubled colon.  */
+              expansion = xmalloc (path_length + strlen (fallback) + 1);
+              
+              /* Copy stuff up to and including the first colon.  */
+              strncpy (expansion, path, loc - path + 1);
+              expansion[loc - path + 1] = 0;
+              
+              /* Copy in FALLBACK, and then the rest of PATH.  */
+              strcat (expansion, fallback);
+              strcat (expansion, loc + 1);
+            }
+        }
+    }
+  
+  return expansion;
+}
+
+#ifdef TEST
+
+void
+test_expand_default (const_string path, const_string def)
+{
+  string answer;
+  
+  printf ("Expansion of `%s':\t", path ? path : "(nil)");
+  answer = kpse_expand_default (path, def);
+  puts (answer);
+}
+
+int
+main ()
+{
+  string default_path = "default";
+
+  test_expand_default (NULL, default_path);
+  test_expand_default ("", default_path);
+  test_expand_default ("none", default_path);
+  test_expand_default (":", default_path);
+  test_expand_default (":first", default_path);
+  test_expand_default ("last:", default_path);
+  test_expand_default ("middle::elddim", default_path);
+  
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+standalone-compile-command: "gcc -g -I. -I.. -DTEST default.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/klibtool.version
@@ -0,0 +1,3 @@
+# Version information for Klibtool.
+# MAJOR MINOR DELTA
+kpathsea 3 0 0
new file mode 100644
--- /dev/null
+++ b/kpathsea/kpathsea.aux
@@ -0,0 +1,231 @@
+'xrdef {Introduction-title}{Introduction}
+'xrdef {Introduction-pg}{1}
+'xrdef {Introduction-snt}{Chapter'tie1}
+'xrdef {History-title}{History}
+'xrdef {History-pg}{1}
+'xrdef {History-snt}{Section'tie1.1}
+'xrdef {Installation-title}{Installation}
+'xrdef {Installation-pg}{3}
+'xrdef {Installation-snt}{Chapter'tie2}
+'xrdef {Simple installation-title}{Simple installation}
+'xrdef {Simple installation-pg}{3}
+'xrdef {Simple installation-snt}{Section'tie2.1}
+'xrdef {Custom installation-title}{Custom installation}
+'xrdef {Custom installation-pg}{4}
+'xrdef {Custom installation-snt}{Section'tie2.2}
+'xrdef {Disk space-title}{Disk space}
+'xrdef {Disk space-pg}{4}
+'xrdef {Disk space-snt}{Section'tie2.2.1}
+'xrdef {Kpathsea application distributions-title}{Kpathsea application distributions}
+'xrdef {Kpathsea application distributions-pg}{5}
+'xrdef {Kpathsea application distributions-snt}{Section'tie2.2.2}
+'xrdef {Changing search paths-title}{Changing search paths}
+'xrdef {Changing search paths-pg}{5}
+'xrdef {Changing search paths-snt}{Section'tie2.2.3}
+'xrdef {Default path features-title}{Default path features}
+'xrdef {Default path features-pg}{5}
+'xrdef {Default path features-snt}{Section'tie2.2.3.1}
+'xrdef {Default path generation-title}{Default path generation}
+'xrdef {Default path generation-pg}{6}
+'xrdef {Default path generation-snt}{Section'tie2.2.3.2}
+'xrdef {Running configure-title}{Running \code {configure}}
+'xrdef {Running configure-pg}{7}
+'xrdef {Running configure-snt}{Section'tie2.2.4}
+'xrdef {configure shells-title}{\code {configure} shells}
+'xrdef {configure shells-pg}{7}
+'xrdef {configure shells-snt}{Section'tie2.2.4.1}
+'xrdef {configure options-title}{\code {configure} options}
+'xrdef {configure options-pg}{7}
+'xrdef {configure options-snt}{Section'tie2.2.4.2}
+'xrdef {configure environment-title}{\code {configure} environment}
+'xrdef {configure environment-pg}{8}
+'xrdef {configure environment-snt}{Section'tie2.2.4.3}
+'xrdef {configure scenarios-title}{\code {configure} scenarios}
+'xrdef {configure scenarios-pg}{8}
+'xrdef {configure scenarios-snt}{Section'tie2.2.4.4}
+'xrdef {Shared library-title}{Shared library}
+'xrdef {Shared library-pg}{9}
+'xrdef {Shared library-snt}{Section'tie2.2.4.5}
+'xrdef {Running make-title}{Running \code {make}}
+'xrdef {Running make-pg}{9}
+'xrdef {Running make-snt}{Section'tie2.2.5}
+'xrdef {Installing files-title}{Installing files}
+'xrdef {Installing files-pg}{10}
+'xrdef {Installing files-snt}{Section'tie2.2.6}
+'xrdef {Cleaning up-title}{Cleaning up}
+'xrdef {Cleaning up-pg}{11}
+'xrdef {Cleaning up-snt}{Section'tie2.2.7}
+'xrdef {Filename database generation-title}{Filename database generation}
+'xrdef {Filename database generation-pg}{11}
+'xrdef {Filename database generation-snt}{Section'tie2.2.8}
+'xrdef {MakeTeX scripts-title}{\file {MakeTeX} scripts}
+'xrdef {MakeTeX scripts-pg}{11}
+'xrdef {MakeTeX scripts-snt}{Section'tie2.2.9}
+'xrdef {MakeTeX configuration-title}{\file {MakeTeX} configuration}
+'xrdef {MakeTeX configuration-pg}{12}
+'xrdef {MakeTeX configuration-snt}{Section'tie2.2.9.1}
+'xrdef {MakeTeX script names-title}{\file {MakeTeX} script names}
+'xrdef {MakeTeX script names-pg}{13}
+'xrdef {MakeTeX script names-snt}{Section'tie2.2.9.2}
+'xrdef {MakeTeX script arguments-title}{\file {MakeTeX} script arguments}
+'xrdef {MakeTeX script arguments-pg}{13}
+'xrdef {MakeTeX script arguments-snt}{Section'tie2.2.9.3}
+'xrdef {Installation testing-title}{Installation testing}
+'xrdef {Installation testing-pg}{14}
+'xrdef {Installation testing-snt}{Section'tie2.2.10}
+'xrdef {Security-title}{Security}
+'xrdef {Security-pg}{14}
+'xrdef {Security-snt}{Section'tie2.3}
+'xrdef {TeX directory structure-title}{\TeX{} directory structure}
+'xrdef {TeX directory structure-pg}{15}
+'xrdef {TeX directory structure-snt}{Section'tie2.4}
+'xrdef {unixtex.ftp-title}{\file {unixtex.ftp}: Obtaining \TeX{}}
+'xrdef {unixtex.ftp-pg}{16}
+'xrdef {unixtex.ftp-snt}{Section'tie2.5}
+'xrdef {Electronic distribution-title}{Electronic distribution}
+'xrdef {Electronic distribution-pg}{17}
+'xrdef {Electronic distribution-snt}{Section'tie2.5.1}
+'xrdef {CD-ROM distribution-title}{CD-ROM distribution}
+'xrdef {CD-ROM distribution-pg}{18}
+'xrdef {CD-ROM distribution-snt}{Section'tie2.5.2}
+'xrdef {Tape distribution-title}{Tape distribution}
+'xrdef {Tape distribution-pg}{18}
+'xrdef {Tape distribution-snt}{Section'tie2.5.3}
+'xrdef {Other TeX packages-title}{Other \TeX{} packages}
+'xrdef {Other TeX packages-pg}{18}
+'xrdef {Other TeX packages-snt}{Section'tie2.5.4}
+'xrdef {Reporting bugs-title}{Reporting bugs}
+'xrdef {Reporting bugs-pg}{19}
+'xrdef {Reporting bugs-snt}{Section'tie2.6}
+'xrdef {Bug checklist-title}{Bug checklist}
+'xrdef {Bug checklist-pg}{19}
+'xrdef {Bug checklist-snt}{Section'tie2.6.1}
+'xrdef {Mailing lists-title}{Mailing lists}
+'xrdef {Mailing lists-pg}{20}
+'xrdef {Mailing lists-snt}{Section'tie2.6.2}
+'xrdef {Debugging-title}{Debugging}
+'xrdef {Debugging-pg}{21}
+'xrdef {Debugging-snt}{Section'tie2.6.3}
+'xrdef {Logging-title}{Logging}
+'xrdef {Logging-pg}{22}
+'xrdef {Logging-snt}{Section'tie2.6.4}
+'xrdef {Common problems-title}{Common problems}
+'xrdef {Common problems-pg}{22}
+'xrdef {Common problems-snt}{Section'tie2.6.5}
+'xrdef {Unable to find files-title}{Unable to find files}
+'xrdef {Unable to find files-pg}{23}
+'xrdef {Unable to find files-snt}{Section'tie2.6.5.1}
+'xrdef {Slow path searching-title}{Slow path searching}
+'xrdef {Slow path searching-pg}{23}
+'xrdef {Slow path searching-snt}{Section'tie2.6.5.2}
+'xrdef {Unable to generate fonts-title}{Unable to generate fonts}
+'xrdef {Unable to generate fonts-pg}{24}
+'xrdef {Unable to generate fonts-snt}{Section'tie2.6.5.3}
+'xrdef {TeX or Metafont failing-title}{\TeX{} or Metafont failing}
+'xrdef {TeX or Metafont failing-pg}{24}
+'xrdef {TeX or Metafont failing-snt}{Section'tie2.6.5.4}
+'xrdef {XtStrings-title}{\code {XtStrings}}
+'xrdef {XtStrings-pg}{25}
+'xrdef {XtStrings-snt}{Section'tie2.6.5.5}
+'xrdef {dlopen-title}{\code {dlopen}}
+'xrdef {dlopen-pg}{25}
+'xrdef {dlopen-snt}{Section'tie2.6.5.6}
+'xrdef {ShellWidgetClass-title}{\code {ShellWidgetClass}}
+'xrdef {ShellWidgetClass-pg}{25}
+'xrdef {ShellWidgetClass-snt}{Section'tie2.6.5.7}
+'xrdef {Pointer combination warnings-title}{Pointer combination warnings}
+'xrdef {Pointer combination warnings-pg}{26}
+'xrdef {Pointer combination warnings-snt}{Section'tie2.6.5.8}
+'xrdef {Path searching-title}{Path searching}
+'xrdef {Path searching-pg}{27}
+'xrdef {Path searching-snt}{Chapter'tie3}
+'xrdef {Searching overview-title}{Searching overview}
+'xrdef {Searching overview-pg}{27}
+'xrdef {Searching overview-snt}{Section'tie3.1}
+'xrdef {Path sources-title}{Path sources}
+'xrdef {Path sources-pg}{28}
+'xrdef {Path sources-snt}{Section'tie3.2}
+'xrdef {Config files-title}{Config files}
+'xrdef {Config files-pg}{28}
+'xrdef {Config files-snt}{Section'tie3.2.1}
+'xrdef {Path expansion-title}{Path expansion}
+'xrdef {Path expansion-pg}{29}
+'xrdef {Path expansion-snt}{Section'tie3.3}
+'xrdef {Default expansion-title}{Default expansion}
+'xrdef {Default expansion-pg}{29}
+'xrdef {Default expansion-snt}{Section'tie3.3.1}
+'xrdef {Variable expansion-title}{Variable expansion}
+'xrdef {Variable expansion-pg}{30}
+'xrdef {Variable expansion-snt}{Section'tie3.3.2}
+'xrdef {Tilde expansion-title}{Tilde expansion}
+'xrdef {Tilde expansion-pg}{30}
+'xrdef {Tilde expansion-snt}{Section'tie3.3.3}
+'xrdef {Brace expansion-title}{Brace expansion}
+'xrdef {Brace expansion-pg}{31}
+'xrdef {Brace expansion-snt}{Section'tie3.3.4}
+'xrdef {Subdirectory expansion-title}{Subdirectory expansion}
+'xrdef {Subdirectory expansion-pg}{31}
+'xrdef {Subdirectory expansion-snt}{Section'tie3.3.5}
+'xrdef {Filename database-title}{Filename database (\code {ls-R})}
+'xrdef {Filename database-pg}{32}
+'xrdef {Filename database-snt}{Section'tie3.4}
+'xrdef {ls-R-title}{\file {ls-R}}
+'xrdef {ls-R-pg}{32}
+'xrdef {ls-R-snt}{Section'tie3.4.1}
+'xrdef {Filename aliases-title}{Filename aliases}
+'xrdef {Filename aliases-pg}{33}
+'xrdef {Filename aliases-snt}{Section'tie3.4.2}
+'xrdef {Database format-title}{Database format}
+'xrdef {Database format-pg}{33}
+'xrdef {Database format-snt}{Section'tie3.4.3}
+'xrdef {Invoking kpsewhich-title}{\code {kpsewhich}: Standalone path searching}
+'xrdef {Invoking kpsewhich-pg}{34}
+'xrdef {Invoking kpsewhich-snt}{Section'tie3.5}
+'xrdef {Path searching options-title}{Path searching options}
+'xrdef {Path searching options-pg}{34}
+'xrdef {Path searching options-snt}{Section'tie3.5.1}
+'xrdef {Auxiliary tasks-title}{Auxiliary tasks}
+'xrdef {Auxiliary tasks-pg}{36}
+'xrdef {Auxiliary tasks-snt}{Section'tie3.5.2}
+'xrdef {Standard options-title}{Standard options}
+'xrdef {Standard options-pg}{37}
+'xrdef {Standard options-snt}{Section'tie3.5.3}
+'xrdef {TeX support-title}{\TeX{} support}
+'xrdef {TeX support-pg}{38}
+'xrdef {TeX support-snt}{Chapter'tie4}
+'xrdef {Supported file formats-title}{Supported file formats}
+'xrdef {Supported file formats-pg}{38}
+'xrdef {Supported file formats-snt}{Section'tie4.1}
+'xrdef {File lookup-title}{File lookup}
+'xrdef {File lookup-pg}{40}
+'xrdef {File lookup-snt}{Section'tie4.2}
+'xrdef {Glyph lookup-title}{Glyph lookup}
+'xrdef {Glyph lookup-pg}{40}
+'xrdef {Glyph lookup-snt}{Section'tie4.3}
+'xrdef {Basic glyph lookup-title}{Basic glyph lookup}
+'xrdef {Basic glyph lookup-pg}{41}
+'xrdef {Basic glyph lookup-snt}{Section'tie4.3.1}
+'xrdef {Fontmap-title}{Fontmap}
+'xrdef {Fontmap-pg}{41}
+'xrdef {Fontmap-snt}{Section'tie4.3.2}
+'xrdef {Fallback font-title}{Fallback font}
+'xrdef {Fallback font-pg}{42}
+'xrdef {Fallback font-snt}{Section'tie4.3.3}
+'xrdef {Suppressing warnings-title}{Suppressing warnings}
+'xrdef {Suppressing warnings-pg}{42}
+'xrdef {Suppressing warnings-snt}{Section'tie4.4}
+'xrdef {Programming-title}{Programming}
+'xrdef {Programming-pg}{44}
+'xrdef {Programming-snt}{Chapter'tie5}
+'xrdef {Programming overview-title}{Programming overview}
+'xrdef {Programming overview-pg}{44}
+'xrdef {Programming overview-snt}{Section'tie5.1}
+'xrdef {Calling sequence-title}{Calling sequence}
+'xrdef {Calling sequence-pg}{44}
+'xrdef {Calling sequence-snt}{Section'tie5.2}
+'xrdef {Programming with config files-title}{Programming with config files}
+'xrdef {Programming with config files-pg}{45}
+'xrdef {Programming with config files-snt}{Section'tie5.3}
+'xrdef {Index-title}{Index}
+'xrdef {Index-pg}{47}
+'xrdef {Index-snt}{}
new file mode 100644
--- /dev/null
+++ b/kpathsea/kpathsea.cps
@@ -0,0 +1,788 @@
+\initial {!}
+\entry {\code {!! \r {in path specifications}}}{33}
+\initial {$}
+\entry {\code {$ \r {expansion}}}{30}
+\initial {-}
+\entry {\code {--color=tty}}{32}
+\entry {\code {--debug=\var {num}}}{36}
+\entry {\code {--dpi=\var {num}}}{34}
+\entry {\code {--enable \r {options}}}{7}
+\entry {\code {--enable-shared}}{9}
+\entry {\code {--expand-path=\var {string}}}{36}
+\entry {\code {--expand-var=\var {string}}}{36}
+\entry {\code {--format=\var {name}}}{35}
+\entry {\code {--help}}{37}
+\entry {\code {--interactive}}{36}
+\entry {\code {--mode=\var {string}}}{36}
+\entry {\code {--must-exist}}{36}
+\entry {\code {--path=\var {string}}}{36}
+\entry {\code {--progname=\var {name}}}{36}
+\entry {\code {--separator=\var {string}}}{36}
+\entry {\code {--show-path=\var {name}}}{36}
+\entry {\code {--srcdir\r {, for building multiple architectures}}}{8}
+\entry {\code {--version}}{37}
+\entry {\code {--with \r {options}}}{7}
+\entry {\code {--with-maketextex-default}}{12}
+\entry {\code {--without-maketexmf-default}}{12}
+\entry {\code {--without-maketexpk-default}}{12}
+\entry {\code {--without-maketextfm-default}}{12}
+\entry {\code {-1 \r {debugging value}}}{21}
+\entry {\code {-A \r {option to \code {ls}}}}{32}
+\entry {\code {-Bdynamic}}{26}
+\entry {\code {-Bstatic}}{26}
+\entry {\code {-D \var {num}}}{34}
+\entry {\code {-dynamic}}{26}
+\entry {\code {-g\r {, compiling without}}}{9}
+\entry {\code {-L \r {option to \code {ls}}}}{33}
+\entry {\code {-maketex=\var {filetype}}}{36}
+\entry {\code {-no-maketex=\var {filetype}}}{36}
+\entry {\code {-O\r {, compiling with}}}{9}
+\entry {\code {-static}}{26}
+\initial {.}
+\entry {\code {. \r {directories, ignored}}}{32}
+\entry {\code {. \r {files}}}{32}
+\entry {\code {.2602gf}}{24}
+\entry {\code {.afm}}{38}
+\entry {\code {.base}}{38}
+\entry {\code {.bib}}{38}
+\entry {\code {.bst}}{38}
+\entry {\code {.cnf}}{38}
+\entry {\code {.dtx}}{39}
+\entry {\code {.eps}}{39}
+\entry {\code {.epsi}}{39}
+\entry {\code {.fmt}}{38}
+\entry {\code {.gf}}{38}
+\entry {\code {.ist}}{38}
+\entry {\code {.ltx}}{39}
+\entry {\code {.map}}{38}
+\entry {\code {.mem}}{38}
+\entry {\code {.mf}}{39}
+\entry {\code {.mft}}{39}
+\entry {\code {.mp}}{39}
+\entry {\code {.ocp}}{39}
+\entry {\code {.ofm}}{39}
+\entry {\code {.opl}}{39}
+\entry {\code {.otp}}{39}
+\entry {\code {.ovf}}{39}
+\entry {\code {.ovp}}{39}
+\entry {\code {.pfa}}{39}
+\entry {\code {.pfb}}{39}
+\entry {\code {.pk}}{39}
+\entry {\code {.pool}}{39}
+\entry {\code {.pro}}{39}
+\entry {\code {.rhosts\r {, writable by \TeX{}}}}{14}
+\entry {\code {.tex}}{39}
+\entry {\code {.tex \r {file, included in \file {ls-R}}}}{32}
+\entry {\code {.texi}}{39}
+\entry {\code {.texinfo}}{39}
+\entry {\code {.tfm}}{39}
+\entry {\code {.txi}}{39}
+\entry {\code {.vf}}{40}
+\initial {/}
+\entry {\code {/ \r {may not be /}}}{27}
+\entry {\code {/\r {, trailing in home directory}}}{31}
+\entry {\code {//}}{31}
+\entry {\code {/afs/\dots {} \r {, installing into}}}{10}
+\entry {\code {/etc/profile}}{23}
+\entry {\code {/etc/profile \r {and aliases}}}{32}
+\entry {\code {/var/tex/fonts}}{12}
+\initial {:}
+\entry {\code {: \r {may not be :}}}{27}
+\entry {\code {:: \r {expansion}}}{29}
+\initial {@}
+\entry {@\var {var}@ substitutions}{7}
+\initial {{\tt\char '173}}
+\entry {\code {{\tt\char '173} \r {expansion}}}{31}
+\initial {{\tt\char '176}}
+\entry {\code {~ \r {expansion}}}{30}
+\initial {{\tt\indexbackslash }}
+\entry {\code {{\tt\rawbackslashxx }\r {, line continuation in \file {texmf.cnf}}}}{28}
+\entry {\code {{\tt\rawbackslashxx }openin}}{27}
+\entry {\code {{\tt\rawbackslashxx }special\r {, suppressing warnings about}}}{43}
+\initial {2}
+\entry {\code {2602gf}}{24}
+\initial {4}
+\entry {4all\TeX{} Live CD-ROM}{18}
+\initial {8}
+\entry {8.3 filenames, using}{12}
+\initial {A}
+\entry {absolute filenames}{27}
+\entry {\code {ac_include\r {, Autoconf extension}}}{7}
+\entry {access warnings}{27}
+\entry {Acorn \TeX{} implementations}{18}
+\entry {\code {AFMFONTS}}{38}
+\entry {AFS}{10}
+\entry {AIX shells and \code {configure}}{7}
+\entry {aliases for fonts}{41}
+\entry {aliases, for filenames}{33}
+\entry {\code {all}}{42}
+\entry {alphabetical order, not}{31}
+\entry {Amiga support}{4}
+\entry {Amiga \TeX{} implementations}{18}
+\entry {Andrew File System, installing with}{10}
+\entry {announcement mailing list}{20}
+\entry {append-only directories and \code {MakeTeXPK}}{14}
+\entry {\code {appendonlydir}}{12}
+\entry {architecture-(in)dependent files, installing only}{10}
+\entry {architectures, compiling multiple}{8}
+\entry {arguments to \file {MakeTeX}}{13}
+\entry {\code {argv[0]}}{44}
+\entry {\code {ash\r {, losing with \code {configure}}}}{7}
+\entry {\code {autoconf\r {, recommended}}}{45}
+\entry {automounter, and configuration}{9}
+\entry {automounter, and \file {ls-R}}{33}
+\entry {auxiliary tasks}{36}
+\initial {B}
+\entry {Babel}{5, 10}
+\entry {Bach, Johann Sebastian}{30}
+\entry {backbone of CTAN}{17}
+\entry {backslash-newline}{28}
+\entry {base dpi}{13}
+\entry {\code {bash\r {, recommended for running \code {configure}}}}{7}
+\entry {basic glyph lookup}{41}
+\entry {\code {BIBINPUTS}}{38}
+\entry {binary mode, for file transfers}{17}
+\entry {blank lines, in \file {texmf.cnf}}{28}
+\entry {brace expansion}{31}
+\entry {BSD universe}{10}
+\entry {\code {bsh\r {, ok with \code {configure}}}}{7}
+\entry {\code {BSTINPUTS}}{38}
+\entry {bug address}{19}
+\entry {bug checklist}{19}
+\entry {bug mailing list}{20}
+\entry {bugs, reporting}{19}
+\initial {C}
+\entry {\code {c-*.h}}{45}
+\entry {\code {c-auto.h.in}}{7}
+\entry {cache of fonts, loca}{14}
+\entry {calling sequence}{44}
+\entry {\code {CC}}{8}
+\entry {\code {cc \r {warnings}}}{26}
+\entry {\code {cc\r {, compiling with}}}{8}
+\entry {CD-ROM distributions}{18}
+\entry {\code {CFLAGS}}{8}
+\entry {\code {ChangeLog \r {entry}}}{20}
+\entry {checklist for bug reports}{19}
+\entry {\code {checksum}}{42}
+\entry {circle fonts}{41}
+\entry {\code {clean \r {Make target}}}{11}
+\entry {\code {client_path \r {in \code {kpse_format_info}}}}{45}
+\entry {\code {cmr10\r {, as fallback font}}}{42}
+\entry {\code {cmr10.vf}}{27}
+\entry {\code {cnf.c}}{29}
+\entry {\code {cnf.h}}{46}
+\entry {code sharing}{9}
+\entry {color printers, configuring}{3}
+\entry {comments, in fontmap files}{41}
+\entry {comments, in \file {texmf.cnf}}{28}
+\entry {comments, making}{1}
+\entry {common features in glyph lookup}{41}
+\entry {common problems}{22}
+\entry {\code {comp.sys.sun.admin \r {FAQ}}}{25}
+\entry {\code {comp.text.tex}}{20}
+\entry {compilation}{3}
+\entry {compilation value, source for path}{28}
+\entry {compiler bugs}{24}
+\entry {compiler bugs, finding}{24}
+\entry {compiler options, additional}{10}
+\entry {compiler options, specifying}{8}
+\entry {compiler, changing}{10}
+\entry {conditions for use}{1}
+\entry {config files}{28}
+\entry {config files, for Kpathsea-using programs}{45}
+\entry {config files, programming with}{45}
+\entry {\code {config.log}}{19}
+\entry {\code {config.ps\r {, search path for}}}{40}
+\entry {\code {config.status}}{19}
+\entry {configuration}{3}
+\entry {configuration bugs}{19}
+\entry {configuration compiler options}{8}
+\entry {configuration file, source for path}{28}
+\entry {configuration files as shell scripts.}{29}
+\entry {configuration of \file {MakeTeX} scripts}{12}
+\entry {configuration of optional features}{7}
+\entry {\code {CONFIGURE}}{7}
+\entry {\code {configure} options}{7}
+\entry {\code {configure} options for \file {MakeTeX} scripts}{12}
+\entry {\code {configure\r {, running}}}{7}
+\entry {context diff}{20}
+\entry {continuation character}{28}
+\entry {core dumps, reporting}{20}
+\entry {\code {CPPFLAGS}}{8}
+\entry {crashes, reporting}{20}
+\entry {CTAN, defined}{17}
+\entry {\code {CTAN.sites}}{17}
+\entry {custom installation}{4}
+\initial {D}
+\entry {database search}{27}
+\entry {database, for filenames}{32}
+\entry {database, format of}{33}
+\entry {DC fonts, and dynamic source creation}{11}
+\entry {\code {debug.h}}{21}
+\entry {debugger}{20}
+\entry {debugging}{21}
+\entry {debugging options, in Kpathsea-using program}{45}
+\entry {debugging output}{21}
+\entry {debugging with \samp {-g}, disabling}{9}
+\entry {DEC shells and \code {configure}}{7}
+\entry {default expansion}{29}
+\entry {default path features}{5}
+\entry {default paths, changing}{6}
+\entry {default paths, how they're made}{6}
+\entry {\code {default_texsizes}}{42}
+\entry {\code {DEFS}}{8}
+\entry {\code {depot}}{9}
+\entry {destination directory for \code {MakeTeXPK}}{13}
+\entry {directories, changing default installation}{6}
+\entry {directories, making append-only}{12}
+\entry {directory structure, for \TeX{} files}{15}
+\entry {disabling \file {MakeTeX} scripts}{12}
+\entry {disk search}{27}
+\entry {disk searching, avoiding}{33}
+\entry {disk space, needed}{4}
+\entry {disk usage, reducing}{22}
+\entry {\code {distclean \r {Make target}}}{11}
+\entry {distributions, compiling simultaneously}{5}
+\entry {distributions, not compiling}{5}
+\entry {distributions, on CD-ROM}{18}
+\entry {distributions, on tape}{18}
+\entry {distributions, via ftp}{17}
+\entry {\code {dlclose}}{25}
+\entry {\code {dlopen}}{25}
+\entry {\code {dlsym}}{25}
+\entry {\code {dlsym.c}}{25}
+\entry {\code {doc files}}{39}
+\entry {DOS compatible names}{12}
+\entry {DOS support}{4}
+\entry {DOS \TeX{} implementations}{18}
+\entry {\code {dosnames}}{12}
+\entry {dot files}{32}
+\entry {doubled colons}{29}
+\entry {\code {dpi\var {nnn} directories}}{12}
+\entry {DVI drivers}{5}
+\entry {\code {DVILJMAKEPK}}{13}
+\entry {\code {DVILJSIZES}}{42}
+\entry {\code {DVIPSFONTS}}{40}
+\entry {\code {DVIPSHEADERS}}{39}
+\entry {\code {DVIPSMAKEPK}}{13}
+\entry {\code {DVIPSSIZES}}{42}
+\entry {dynamic creation of files}{11}
+\entry {dynamic linking problems with OpenWin libraries}{25}
+\initial {E}
+\entry {\code {elt-dirs.c}}{32}
+\entry {email CTAN access}{17}
+\entry {enabling \file {MakeTeX} scripts}{12}
+\entry {environment variable, source for path}{28}
+\entry {environment variables for \TeX{}}{38}
+\entry {environment variables in paths}{30}
+\entry {environment variables, old}{23}
+\entry {epoch, seconds since}{22}
+\entry {error message macros}{44}
+\entry {excessive startup time}{23}
+\entry {\code {expand.c}}{31}
+\entry {expanding symlinks}{44}
+\entry {expansion, default}{29}
+\entry {expansion, path element}{27}
+\entry {expansion, search path}{29}
+\entry {expansion, subdirectory}{31}
+\entry {expansion, tilde}{30}
+\entry {expansion, variable}{30}
+\entry {explicitly relative filenames}{27}
+\entry {externally-built filename database}{32}
+\entry {extra colons}{29}
+\entry {\code {extraclean \r {Make target}}}{11}
+\initial {F}
+\entry {failed \code {MakeTeX\dots {}} script invocation}{13}
+\entry {fallback font}{42}
+\entry {fallback resolutions}{42}
+\entry {fallback resolutions, overriding}{9}
+\entry {FAQ, \t {comp.sys.sun.admin}}{25}
+\entry {FAQ, Kpathsea}{22}
+\entry {Farwell, Matthew}{31}
+\entry {features, of default paths}{5}
+\entry {file formats, supported}{38}
+\entry {file lookup}{40}
+\entry {file types, registering new}{44}
+\entry {filename aliases}{33}
+\entry {filename database}{32}
+\entry {filename database generation}{11}
+\entry {filenames, absolute or explicitly relative}{27}
+\entry {files, unable to find}{23}
+\entry {filesystem search}{27}
+\entry {floating directories}{27}
+\entry {font alias files}{41}
+\entry {font generation failures}{24}
+\entry {font of last resort}{42}
+\entry {font set, infinite}{11}
+\entry {fontmap files}{41}
+\entry {fontnames, arbitrary length}{41}
+\entry {fonts, being created}{4}
+\entry {\code {fopen\r {, redefined}}}{21}
+\entry {format of external database}{33}
+\entry {Free Software Foundation}{18}
+\entry {FreeBSD shells and \code {configure}}{7}
+\entry {FSF Source Code CD-ROM}{18}
+\entry {ftp retrieval}{17}
+\entry {\code {ftp.tug.org}}{16}
+\entry {fundamental purpose of Kpathsea}{1}
+\initial {G}
+\entry {\code {gcc\r {, compiling with}}}{8}
+\entry {\code {gdb\r {, recommended}}}{20}
+\entry {generation of filename database}{11}
+\entry {\code {get_applicationShellWidgetClass}}{25}
+\entry {\code {get_wmShellWidgetClass}}{25}
+\entry {\code {GFFONTS}}{38}
+\entry {globally writable directories}{14}
+\entry {glyph lookup}{40}
+\entry {glyph lookup bitmap tolerance}{41}
+\entry {\code {GLYPHFONTS}}{38, 39}
+\entry {GNU C compiler bugs}{24}
+\entry {GNU General Public License}{1}
+\entry {Gopher CTAN access}{17}
+\entry {group-writable directories}{14}
+\entry {GUTenberg}{18}
+\initial {H}
+\entry {hash table buckets, printing}{22}
+\entry {hash table routines}{45}
+\entry {\code {hash_summary_only \r {variable for debugging}}}{22}
+\entry {help, mailing list for general \TeX{}}{20}
+\entry {\code {HIER}}{6}
+\entry {history of Kpathsea}{1}
+\entry {home directories in paths}{30}
+\entry {\code {HOME\r {, as ~ expansion}}}{30}
+\initial {I}
+\entry {identifiers, characters valid in}{28}
+\entry {illegal pointer combination warnings}{26}
+\entry {\code {include \r {fontmap directive}}}{41}
+\entry {\code {INDEXSTYLE}}{38}
+\entry {\code {info-tex@shsu.edu}}{20}
+\entry {input lines, reading}{45}
+\entry {\code {install-data \r {Make target}}}{10}
+\entry {\code {install-exec \r {Make target}}}{10}
+\entry {installation}{3}
+\entry {installation testing}{14}
+\entry {installation, architecture-(in)dependent files only}{10}
+\entry {installation, changing default directories}{6}
+\entry {installation, customized}{4}
+\entry {installation, getting executables instead of}{3}
+\entry {installation, simple}{3}
+\entry {installing files}{10}
+\entry {interactive query}{36}
+\entry {interface, not frozen}{1}
+\entry {introduction}{1}
+\initial {K}
+\entry {\samp {kdebug:}}{22}
+\entry {\code {kdefault.c}}{30}
+\entry {Knuth, Donald E.}{1}
+\entry {Knuth, Donald E., archive of programs by}{19}
+\entry {Knuth, Donald E., original author}{17}
+\entry {Korn shell\r {, losing with \code {configure}}}{7}
+\entry {Kpathsea config file, source for path}{28}
+\entry {Kpathsea version number}{5}
+\entry {\code {kpathsea.h}}{44}
+\entry {\code {kpathsea/CONFIGURE}}{7}
+\entry {\code {kpathsea/HIER}}{6}
+\entry {\code {kpathsea_debug}}{21}
+\entry {\code {KPATHSEA_DEBUG}}{21, 44}
+\entry {\code {kpathsea_debug \r {variable}}}{45}
+\entry {\code {KPATHSEA_DPI}}{13}
+\entry {\code {KPSE_BITMAP_TOLERANCE}}{41}
+\entry {\code {kpse_cnf_get}}{46}
+\entry {\code {KPSE_DEBUG_EXPAND \r {(16)}}}{21, 22}
+\entry {\code {KPSE_DEBUG_FOPEN \r {(4)}}}{21}
+\entry {\code {KPSE_DEBUG_HASH \r {(2)}}}{21}
+\entry {\code {KPSE_DEBUG_PATHS \r {(8)}}}{21}
+\entry {\code {KPSE_DEBUG_SEARCH \r {(32)}}}{21, 22}
+\entry {\code {KPSE_DEBUG_STAT \r {(1)}}}{21}
+\entry {\code {kpse_fallback_font}}{42}
+\entry {\code {kpse_find_*}}{45}
+\entry {\code {kpse_find_file}}{40}
+\entry {\code {kpse_find_glyph_format}}{41}
+\entry {\code {kpse_format_info}}{45}
+\entry {\code {kpse_format_info_type}}{21}
+\entry {\code {kpse_init_prog}}{45}
+\entry {\code {kpse_init_prog\r {, and \code {MAKETEX_MODE}}}}{6}
+\entry {\code {kpse_make_specs}}{13}
+\entry {\code {kpse_open_file}}{45}
+\entry {\code {kpse_set_progname}}{44}
+\entry {\code {kpse_var_expand}}{45}
+\entry {\code {kpsewhich}}{34}
+\entry {Kpsewhich, and debugging}{21}
+\entry {\code {ksh\r {, losing with \code {configure}}}}{7}
+\initial {L}
+\entry {\code {labrea.stanford.edu}}{19}
+\entry {LaserJet drive}{5}
+\entry {last-resort font}{42}
+\entry {La\TeX{} help mailing list}{20}
+\entry {\code {lcircle10}}{41}
+\entry {\code {LDFLAGS}}{8}
+\entry {leading colons}{29}
+\entry {leaf directories wrongly guessed}{23}
+\entry {leaf directory trick}{31}
+\entry {\code {libdl.a}}{25}
+\entry {libraries, changing}{10}
+\entry {libraries, specifying additional}{8}
+\entry {\code {LIBS}}{8}
+\entry {\code {libucb\r {, avoiding}}}{10}
+\entry {license for using the library}{1}
+\entry {lines, reading arbitrary-length}{45}
+\entry {Linux File System Standard}{12}
+\entry {Linux shells and \code {configure}}{7}
+\entry {Linux, using Web2c}{18}
+\entry {\code {lndir \r {for building symlink trees}}}{8}
+\entry {loader options}{8}
+\entry {loader options, final}{10}
+\entry {loader options, initial}{10}
+\entry {local cache of fonts}{14}
+\entry {log file}{22}
+\entry {logging successful searches}{22}
+\entry {\code {lost+found \r {directory}}}{27}
+\entry {\code {lostchar}}{42, 43}
+\entry {\code {ls-R}}{38}
+\entry {\code {ls-R \r {and AFS}}}{11}
+\entry {\code {ls-R \r {database file}}}{32}
+\entry {\code {ls-R\r {, simplest build}}}{32}
+\initial {M}
+\entry {Macintosh \TeX{} implementations}{18}
+\entry {MacKenzie, David}{2, 31}
+\entry {\code {mag \r {Metafont variable}}}{13}
+\entry {magic characters}{27}
+\entry {magstep for \code {MakeTeXPK}}{13}
+\entry {mailing lists}{20}
+\entry {\code {maintainer-clean \r {Make target}}}{11}
+\entry {Make arguments, additional}{10}
+\entry {\code {make\r {, running}}}{9}
+\entry {\code {Makefile.in}}{7}
+\entry {\file {MakeTeX} script configuration}{12}
+\entry {\file {MakeTeX} script names}{13}
+\entry {\file {MakeTeX} scripts}{11}
+\entry {\code {MakeTeX.site}}{12}
+\entry {\code {MAKETEX_BASE_DPI}}{13}
+\entry {\code {MAKETEX_MAG}}{13}
+\entry {\code {MAKETEX_MODE}}{6, 13}
+\entry {\code {MakeTeXMF}}{13}
+\entry {\code {MakeTeXmkdir}}{12}
+\entry {\code {MakeTeXnames.cnf}}{12}
+\entry {\code {MakeTeXPK}}{13}
+\entry {\code {MakeTeXPK \r {, initial runs}}}{4}
+\entry {\code {MAKETEXPK \r {environment variable}}}{14}
+\entry {\code {MakeTeXTeX}}{13}
+\entry {\code {MakeTeXTFM}}{13}
+\entry {memory allocation routines}{45}
+\entry {Metafont failures}{24}
+\entry {Metafont installation}{24}
+\entry {Metafont making too-large fonts}{24}
+\entry {Metafont mode name for \code {MakeTeXPK}}{13}
+\entry {Metafont using the wrong resolution}{24}
+\entry {\code {MFBASES}}{38}
+\entry {\code {MFINPUTS}}{39}
+\entry {\code {MFPOOL}}{39}
+\entry {\code {MFTINPUTS}}{39}
+\entry {mirrors, FTP}{17}
+\entry {mismatched checksum warnings}{42}
+\entry {\code {missfont.log}}{13}
+\entry {\code {MISSFONT_LOG}}{13}
+\entry {missing character warnings}{43}
+\entry {mode directory, omitting}{12}
+\entry {\code {mode \r {Metafont variable}}}{13}
+\entry {Morgan, Tim}{1}
+\entry {\code {mostlyclean \r {Make target}}}{11}
+\entry {\code {MPINPUTS}}{39}
+\entry {\code {MPMEMS}}{38}
+\entry {\code {MPPOOL}}{39}
+\entry {\code {MPSUPPORT}}{39}
+\entry {\code {MT_FEATURES}}{12}
+\entry {\code {mtp_destdir}}{13}
+\entry {multiple architectures, compiling on}{8}
+\entry {multiple architectures, directories for}{9}
+\entry {multiple architectures, installing on}{10}
+\entry {multiple \TeX{} hierarchies}{31}
+\entry {must exist}{27}
+\initial {N}
+\entry {names for \file {MakeTeX} scripts}{13}
+\entry {NetBSD shells and \code {configure}}{7}
+\entry {Neumann, Gustaf}{2}
+\entry {newsgroup for \TeX{}}{20}
+\entry {NeXT, lacking X11}{5}
+\entry {NFS and \file {ls-R}}{33}
+\entry {NFS CTAN access}{17}
+\entry {\code {nomode}}{12}
+\entry {non-English typesetting}{5}
+\entry {non-Unix operating systems}{4}
+\entry {Northwest Computing Support Center}{18}
+\entry {NTG}{18}
+\entry {null pointers, dereferencing}{20}
+\entry {numeric debugging values}{21}
+\initial {O}
+\entry {obtaining \TeX{}}{16}
+\entry {obtaining \TeX{} on tape}{18}
+\entry {obtaining Web2c by ftp}{17}
+\entry {obtaining Web2c on CD-ROM}{18}
+\entry {\code {OCPINPUTS}}{39}
+\entry {\code {OFMFONTS}}{39}
+\entry {online Metafont display, spurious}{24}
+\entry {OpenWin libraries, dynamic linking problems}{25}
+\entry {optimization caveat}{24}
+\entry {optimization, enabling}{9}
+\entry {options for debugging}{21}
+\entry {options to \code {configure}}{7}
+\entry {OS/2 support}{4}
+\entry {other \TeX{} distributions}{18}
+\entry {\code {OTPINPUTS}}{39}
+\entry {overview of path searching}{27}
+\entry {overview of programming with Kpathsea}{44}
+\entry {\code {OVFFONTS}}{39}
+\entry {\code {OVPFONTS}}{39}
+\initial {P}
+\entry {patches, Sun OpenWin}{26}
+\entry {path expansion}{29}
+\entry {path searching}{27}
+\entry {path searching options}{34}
+\entry {path searching, overview}{27}
+\entry {path searching, standalone}{34}
+\entry {path sources}{28}
+\entry {paths, changing default}{5, 6}
+\entry {paths, device name included in}{6}
+\entry {\code {paths.h}}{6}
+\entry {\code {paths.h\r {, creating}}}{9}
+\entry {\code {pathsearch.h}}{44}
+\entry {\code {pc \r {Pascal compiler}}}{1}
+\entry {PCL driver}{5}
+\entry {PDF generation}{5}
+\entry {permission denied}{27}
+\entry {\code {PKFONTS}}{39}
+\entry {\code {plain.base}}{24}
+\entry {pointer combination warnings}{26}
+\entry {PostScript driver}{5}
+\entry {PostScript fonts, additional}{3}
+\entry {precompiled executables, instead of installation}{3}
+\entry {precompiled Unix binaries}{18}
+\entry {preprocessor options}{8}
+\entry {preprocessor options, additional}{9}
+\entry {Prime Time \TeX{}cetera CD-ROM}{18}
+\entry {printer configuration files}{3}
+\entry {privacy, semblance of}{22}
+\entry {problems, common}{22}
+\entry {\code {proginit.c}}{6}
+\entry {\code {proginit.h}}{45}
+\entry {program-varying paths}{38}
+\entry {\code {program_invocation_name}}{44}
+\entry {\code {program_invocation_short_name}}{44}
+\entry {programming overview}{44}
+\entry {programming with config files}{45}
+\entry {programming with Kpathsea}{44}
+\entry {programs using the library}{1}
+\entry {proof mode}{24}
+\entry {\code {PSHEADERS}}{39}
+\entry {\code {pxp \r {Pascal preprocessor}}}{1}
+\initial {Q}
+\entry {quoting variable values}{30}
+\initial {R}
+\entry {\code {readable}}{43}
+\entry {reading arbitrary-length lines}{45}
+\entry {\code {README.mirrors}}{17}
+\entry {recording successful searches}{22}
+\entry {relative filenames}{27}
+\entry {relative filenames in \file {ls-R}}{11}
+\entry {reporting bugs}{19}
+\entry {\code {resident.c}}{45}
+\entry {resolution, setting}{34}
+\entry {resolution, wrong}{24}
+\entry {resolutions, last-resort}{42}
+\entry {retrieving \TeX{}}{16}
+\entry {right-hand side of variable assignments}{29}
+\entry {Rokicki, Tom}{1}
+\entry {\t {root} user}{31}
+\entry {runtime configuration files}{28}
+\entry {runtime debugging}{21}
+\initial {S}
+\entry {Sauter fonts, and dynamic source creation}{11}
+\entry {scripts for file creation}{11}
+\entry {search path, defined}{27}
+\entry {search paths, changing default}{5}
+\entry {searching for files}{40}
+\entry {searching for glyphs}{40}
+\entry {searching overview}{27}
+\entry {searching the database}{27}
+\entry {searching the disk}{27}
+\entry {security considerations}{14}
+\entry {SELFAUTODIR}{44}
+\entry {SELFAUTOLOC}{44}
+\entry {SELFAUTOPARENT}{44}
+\entry {sending patches}{20}
+\entry {setgid scripts}{14}
+\entry {\code {sh5\r {, ok with \code {configure}}}}{7}
+\entry {shar\r {, recommended}}{20}
+\entry {shared library, making}{9}
+\entry {shell scripts as configuration files}{29}
+\entry {shell variables}{30}
+\entry {\code {shell_escape\r {, example for code}}}{45}
+\entry {shells and \code {configure}}{7}
+\entry {simple installation}{3}
+\entry {site overrides for \code {MakeTeX\dots {}}}{12}
+\entry {size of distribution archives}{4}
+\entry {skeleton \TeX{} directory}{15}
+\entry {slow startup time}{23}
+\entry {Solaris BSD compatibility, not}{10}
+\entry {\code {source files}}{39}
+\entry {sources for search paths}{28}
+\entry {\code {special}}{43}
+\entry {specification for \code {MakeTeXPK}}{14}
+\entry {\code {st_nlink}}{31}
+\entry {stack trace}{20}
+\entry {standalone path searching}{34}
+\entry {standard error and debugging output}{21}
+\entry {standard options}{37}
+\entry {startup time, excessive}{23}
+\entry {static linking}{26}
+\entry {static linking and \code {dlsym}}{25}
+\entry {string routines}{45}
+\entry {\code {strip}}{12}
+\entry {subdirectory searching}{31}
+\entry {suggestions, making}{1}
+\entry {Sun 2}{1}
+\entry {Sun OpenWin patches}{26}
+\entry {supplier directory, omitting}{12}
+\entry {support organization}{18}
+\entry {supported file formats}{38}
+\entry {suppressing warnings}{42}
+\entry {symbolic link trees, for multiple architectures}{8}
+\entry {symbolic links not found}{23}
+\entry {symbolic links, and \file {ls-R}}{33}
+\entry {symlinks, resolving}{44}
+\entry {system C compiler bugs}{24}
+\entry {system dependencies}{7}
+\entry {system V universe}{10}
+\initial {T}
+\entry {\code {T1FONTS}}{39}
+\entry {\code {T1INPUTS}}{39}
+\entry {tape distribution}{18}
+\entry {TDS}{15}
+\entry {testing, post-installation}{14}
+\entry {tests, simple}{4}
+\entry {te\TeX{}}{18}
+\entry {\code {tex-archive@math.utah.edu}}{20}
+\entry {\code {tex-file.c}}{40}
+\entry {\code {tex-file.h}}{44}
+\entry {\code {tex-glyph.c}}{41}
+\entry {\code {tex-glyph.h}}{44}
+\entry {\code {tex-k-request@mail.tug.org}}{20}
+\entry {\code {tex-k@mail.tug.org \r {(bug address)}}}{19}
+\entry {\code {tex-make.c}}{13}
+\entry {\code {TEX_HUSH}}{27, 42}
+\entry {\TeX{} directory structure}{15}
+\entry {\TeX{} distributions besides Web2c}{18}
+\entry {\TeX{} environment variables}{38}
+\entry {\TeX{} failures}{24}
+\entry {\TeX{} file lookup}{40}
+\entry {\TeX{} glyph lookup}{40}
+\entry {\TeX{} help mailing list}{20}
+\entry {\TeX{} hierarchy, one}{8}
+\entry {\TeX{} Live CD-ROM}{18}
+\entry {\TeX{} support}{38}
+\entry {\TeX{} Users Group}{1}
+\entry {\code {TEXBIB}}{38}
+\entry {\code {TEXCONFIG}}{40}
+\entry {\code {TEXDOCS}}{39}
+\entry {\code {TEXFONTMAPS}}{38}
+\entry {\code {TEXFONTS}}{38, 39, 40}
+\entry {\code {texfonts.map}}{41}
+\entry {\code {TEXFORMATS}}{38}
+\entry {\code {TEXINDEXSTYLE}}{38}
+\entry {\code {TEXINPUTS}}{39}
+\entry {\code {TEXMF}}{15}
+\entry {\code {texmf.cnf\r {, and variable expansion}}}{30}
+\entry {\code {texmf.cnf\r {, creating}}}{9}
+\entry {\code {texmf.cnf\r {, definition for}}}{28}
+\entry {\code {texmf.cnf\r {, generated}}}{6}
+\entry {\code {texmf.cnf\r {, source for path}}}{28}
+\entry {\code {texmf.cnf.in}}{6}
+\entry {\code {texmf.cnf.in\r {, editing}}}{5}
+\entry {\code {texmf.sed}}{6}
+\entry {\code {TEXMFCNF}}{28, 38}
+\entry {\code {TEXMFDBS}}{32, 38}
+\entry {\code {TEXMFINI}}{38}
+\entry {\code {TEXMFLOG}}{22}
+\entry {\code {TEXMFOUTPUT}}{13}
+\entry {\code {TEXPICTS}}{39}
+\entry {\code {TEXPKS}}{39}
+\entry {\code {TEXPOOL}}{39}
+\entry {\code {TEXPSHEADERS}}{39}
+\entry {\code {TEXSIZES}}{42}
+\entry {\code {TEXSOURCES}}{39}
+\entry {\code {TFMFONTS}}{39}
+\entry {tilde expansion}{30}
+\entry {\code {tilde.c}}{31}
+\entry {\code {time \r {system call}}}{22}
+\entry {tolerance for glyph lookup}{41}
+\entry {total disk space}{4}
+\entry {trailing \samp {/} in home directory}{31}
+\entry {trailing colons}{29}
+\entry {\code {TRFONTS}}{39}
+\entry {trick for detecting leaf directories}{31}
+\entry {trojan horse attack}{14}
+\entry {TUG}{18}
+\entry {\code {tug.cs.umb.edu}}{16}
+\entry {\code {tug@tug.org}}{1}
+\entry {typeface directory, omitting}{12}
+\initial {U}
+\entry {\code {ucbinclude\r {, avoiding}}}{10}
+\entry {UKTUG}{18}
+\entry {Ultrix shells and \code {configure}}{7}
+\entry {unable to find files}{23}
+\entry {unable to generate fonts}{24}
+\entry {\code {uname}}{19}
+\entry {universe, BSD vs.\spacefactor =1000  system V}{10}
+\entry {\code {UNIX_ST_LINK}}{31}
+\entry {\code {unixtex.ftp}}{16}
+\entry {\code {unixtex@u.washington.edu}}{18}
+\entry {unknown special warnings}{43}
+\entry {unreadable file warnings}{43}
+\entry {unreadable files}{27}
+\entry {unusable \file {ls-R} warning}{33}
+\entry {usage patterns, finding}{22}
+\entry {\code {USE_VARTEXFONTS}}{13}
+\entry {Usenet \TeX{} newsgroup}{20}
+\initial {V}
+\entry {\code {varfonts}}{12}
+\entry {variable expansion}{30}
+\entry {\code {variable.c}}{30}
+\entry {\code {variable.h}}{45}
+\entry {\code {VARTEXFONTS}}{12}
+\entry {VAX 11/750}{1}
+\entry {version number, of Kpathsea}{5}
+\entry {version numbers, determining}{19}
+\entry {VF files, not found}{27}
+\entry {\code {VFFONTS}}{40}
+\entry {VMS support}{4}
+\entry {VMS \TeX{} implementations}{18}
+\entry {Vojta, Paul}{2}
+\initial {W}
+\entry {Walnut Creek \TeX{} CD-ROM}{18}
+\entry {Walsh, Norman}{2}
+\entry {warning about unusable \file {ls-R}}{33}
+\entry {warnings, file access}{27}
+\entry {warnings, pointer combinations}{26}
+\entry {warnings, suppressing}{42}
+\entry {\code {wcstombs}}{25}
+\entry {whitespace, in fontmap files}{41}
+\entry {whitespace, not ignored on continuation lines}{28}
+\entry {Windows \TeX{} implementations}{18}
+\entry {World Wide Web CTAN access}{17}
+\entry {\code {www.tug.org}}{16}
+\initial {X}
+\entry {X11 previewer}{5}
+\entry {X11, lacking on NeXT}{5}
+\entry {\code {XCFLAGS}}{9, 10}
+\entry {\code {XCPPFLAGS}}{9}
+\entry {\code {XDEFS}}{9}
+\entry {\code {XDVIFONTS}}{40}
+\entry {\code {XDVIMAKEPK}}{13}
+\entry {\code {XDVISIZES}}{42}
+\entry {\code {XLDFLAGS}}{10}
+\entry {\code {XLOADLIBES}}{10}
+\entry {\code {XMAKEARGS}}{10}
+\entry {\code {Xmu \r {library problems}}}{25}
+\entry {\code {XtStrings}}{25}
+\initial {Z}
+\entry {zuhn, david}{2}
new file mode 100644
--- /dev/null
+++ b/kpathsea/kpathsea.h
@@ -0,0 +1,49 @@
+#include <kpathsea/absolute.h>
+#include <kpathsea/c-auto.h>
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/c-dir.h>
+#include <kpathsea/c-errno.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/c-limits.h>
+#include <kpathsea/c-memstr.h>
+#include <kpathsea/c-minmax.h>
+#include <kpathsea/c-namemx.h>
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/c-pathmx.h>
+#include <kpathsea/c-proto.h>
+#include <kpathsea/c-stat.h>
+#include <kpathsea/c-std.h>
+#include <kpathsea/c-unistd.h>
+#include <kpathsea/c-vararg.h>
+#include <kpathsea/cnf.h>
+#include <kpathsea/concatn.h>
+#include <kpathsea/config.h>
+#include <kpathsea/db.h>
+#include <kpathsea/debug.h>
+#include <kpathsea/default.h>
+#include <kpathsea/expand.h>
+#include <kpathsea/fn.h>
+#include <kpathsea/fontmap.h>
+#include <kpathsea/getopt.h>
+#include <kpathsea/hash.h>
+#include <kpathsea/lib.h>
+#include <kpathsea/line.h>
+#include <kpathsea/magstep.h>
+#include <kpathsea/paths.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/proginit.h>
+#include <kpathsea/progname.h>
+#include <kpathsea/readable.h>
+#include <kpathsea/str-list.h>
+#include <kpathsea/str-llist.h>
+#include <kpathsea/systypes.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/tex-glyph.h>
+#include <kpathsea/tex-hush.h>
+#include <kpathsea/tex-make.h>
+#include <kpathsea/tilde.h>
+#include <kpathsea/truncate.h>
+#include <kpathsea/types.h>
+#include <kpathsea/variable.h>
+#include <kpathsea/xopendir.h>
+#include <kpathsea/xstat.h>
new file mode 100644
--- /dev/null
+++ b/kpathsea/kpathsea.info
@@ -0,0 +1,4043 @@
+This is Info file kpathsea.info, produced by Makeinfo version 1.67 from
+the input file kpathsea.texi.
+
+INFO-DIR-SECTION TeX
+START-INFO-DIR-ENTRY
+* Kpathsea: (kpathsea).              File lookup along search paths.
+* kpsewhich: (kpathsea)Invoking kpsewhich.      TeX file searching.
+* MakeTeXMF: (kpathsea)MakeTeX scripts.         MF source generation.
+* MakeTeXPK: (kpathsea)MakeTeX scripts.         PK bitmap generation.
+* MakeTeXTeX: (kpathsea)MakeTeX scripts.        TeX source generation.
+* MakeTeXTFM: (kpathsea)MakeTeX scripts.        TeX font metric generation.
+* MakeTeXls-R: (kpathsea)Filename database.     Update ls-R.
+END-INFO-DIR-ENTRY
+
+  This file documents the Kpathsea library for path searching.
+
+  Copyright (C) 1993, 94, 95, 96, 97 K. Berry.
+
+  Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+  Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+  Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Free Software Foundation.
+
+
+File: kpathsea.info,  Node: Top,  Next: Introduction,  Up: (dir)
+
+Kpathsea library
+****************
+
+  This manual documents how to install and use the Kpathsea library for
+filename lookup.  It corresponds to version 3.0, released in February
+1997.
+
+* Menu:
+
+* Introduction::                Overview.
+* Installation::                Compilation, installation, and bug reporting.
+
+* Path searching::              How filename lookups work.
+* TeX support::                 Special support for TeX-related file lookups.
+
+* Programming::                 How to use Kpathsea features in your program.
+
+* Index::                       General index.
+
+
+File: kpathsea.info,  Node: Introduction,  Next: Installation,  Prev: Top,  Up: Top
+
+Introduction
+************
+
+  This manual corresponds to version 3.0 of the Kpathsea library,
+released in February 1997.
+
+  The library's fundamental purpose is to return a filename from a list
+of directories specified by the user, similar to what shells do when
+looking up program names to execute.
+
+  The following software, all of which I maintain, uses this library:
+
+   * Dviljk (see the `dvilj' man page)
+
+   * Dvipsk (*note Introduction: (dvips)Top.)
+
+   * GNU font utilities (*note Introduction: (fontu)Top.)
+
+   * Web2c (*note Introduction: (web2c)Top.)
+
+   * Xdvik (see the `xdvi' man page)
+
+Other software that I do not maintain also uses it.
+
+  I am still actively maintaining the library (and probably always will
+be, despite my hopes).  If you have comments or suggestions, please send
+them to me (*note Reporting bugs::.).
+
+  I distribute the library under the GNU Library General Public License
+(LGPL), with one exception (see below).  In short, this means if you
+write a program using the library, you must (offer to) distribute the
+source to the library, along with any changes you have made, and allow
+anyone to modify the library source and distribute their modifications.
+It does not mean you have to distribute the source to your program,
+although I hope you will.
+
+  The exception is the part of the file `expand.c' which implements
+brace expansion.  I took this from Bash, which is covered by the GNU
+General Public License (GPL).  Therefore, if you wish to redistribute
+the library under the LGPL, you must remove this code.  (If you write a
+replacement I can distribute, I hope you'll share it with me.)  See the
+files `COPYING' and `COPYING.LIB' for the text of the GNU licenses.
+
+  If you know enough about TeX to be reading this manual, then you (or
+your institution) should consider joining the TeX Users Group (if
+you're already a member, great!).  TUG produces the periodical
+`TUGboat', sponsors an annual meeting and publishes the proceedings,
+and arranges courses on TeX for all levels of users throughout the
+world.  Anyway, here is the address:
+
+     TeX Users Group
+     870 Market St. #801
+     San Francisco, CA 94102  USA
+     phone: +1 (415) 982-8449
+     fax:   +1 (415) 982-8559
+     email: <tug@tug.org>
+
+* Menu:
+
+* History::
+
+
+File: kpathsea.info,  Node: History,  Up: Introduction
+
+History
+=======
+
+  (This section is for those people who are curious about how the
+library came about.)  (If you like to read historical accounts of
+software, I urge you to seek out the GNU Autoconf manual and the
+"Errors of TeX" paper by Don Knuth, published in `Software--Practice and
+Experience' 19(7), July 1989.)
+
+  My first ChangeLog entry for Web2c seems to be February 1990, but I
+may have done some work before then.  In any case, Tim Morgan and I were
+jointly maintaining it for a time.  (I should mention here that Tim had
+made Web2c into a real distribution long before I had ever used it or
+even heard of it, and Tom Rokicki did the original implementation.  I
+was using `pxp' and `pc' on VAX 11/750's and the hot new Sun 2
+machines.)
+
+  It must have been later in 1990 and 1991 that I started working on
+`TeX for the Impatient'. Dvips, Xdvi, Web2c, and the GNU fontutils
+(which I was also writing at the time) all used different environment
+variables, and, more importantly, had different bugs in their path
+searching. This became extremely painful, as I was stressing everything
+to the limit working on the book.  I also desperately wanted to
+implement subdirectory searching, since I couldn't stand putting
+everything in one big directory, and also couldn't stand having to
+explicitly specify `cm', `pandora', ... in a path.
+
+  In the first incarnation, I just hacked separately on each
+program--that was the original subdirectory searching code in both Xdvi
+and Dvips, though I think Paul Vojta has completely rewritten Xdvi's
+support by now.  That is, I tried to go with the flow in each program,
+rather than changing the program's calling sequences to conform to
+common routines.
+
+  Then, as bugs inevitably appeared, I found I was fixing the same thing
+three times (Web2c and fontutils were always sharing code, since I
+maintained those--there was no Dvipsk or Xdvik or Dviljk at this
+point).  After a while, I finally started sharing source files.  They
+weren't yet a library, though.  I just kept things up to date with shell
+scripts.  (I was developing on a 386 running ISC 2.2 at the time, and so
+didn't have symbolic links.  An awful experience.)
+
+  The ChangeLogs for Xdvik and Dvipsk record initial releases of those
+distributions in May and June 1992.  I think it was because I was tired
+of the different configuration strategies of each program, not so much
+because of the path searching.  (Autoconf was being developed by David
+MacKenzie and others, and I was adapting it to TeX and friends.)
+
+  I started to make a separate library that other programs could link
+with on my birthday in April 1993, according to the ChangeLog.  I don't
+remember exactly why I finally took the time to make it a separate
+library; a conversation with david zuhn that initiated it.  Just seemed
+like it was time.
+
+  Dviljk got started in March 1994 after I bought a Laserjet 4.
+(Kpathsea work got suspended while Norm Walsh and I, with Gustaf
+Neumann's help, implemented a way for TeX to get at all those neat
+builtin LJ4 fonts ... such a treat to have something to typeset in
+besides Palatino!)
+
+  By spring of 1995, I had implemented just about all the path-searching
+features in Kpathsea that I plan to, driven beyond my initial goals by
+Thomas Esser and others.  I then started to integrate Web2c with
+Kpathsea. After the release of a stable Web2c, I hope to be able to stop
+development, and turn most of my attention back to making fonts for GNU.
+(Always assuming Micros**t hasn't completely obliterated Unix by then,
+or that software patents haven't stopped software development by anybody
+smaller than a company with a million-dollar-a-year legal budget.  Which
+is actually what I think is likely to happen, but that's another
+story...)
+
+
+File: kpathsea.info,  Node: Installation,  Next: Path searching,  Prev: Introduction,  Up: Top
+
+Installation
+************
+
+  (A copy of this chapter is in the distribution file
+`kpathsea/INSTALL'.)
+
+  The procedure for Kpathsea (and Web2c, etc.) configuration and
+installation follows.  If trouble, *note Common problems::., a copy of
+which is in the file `kpathsea/BUGS'.
+
+* Menu:
+
+* Simple installation::      If you just want to do it.
+* Custom installation::      If you want to change things around.
+* Security::                 Who can write what files, etc.
+* TeX directory structure::  Managing the horde of TeX input files.
+* unixtex.ftp::              Getting software via FTP, on CD-ROM, or on tape.
+* Reporting bugs::           Where and how to report bugs.
+
+
+File: kpathsea.info,  Node: Simple installation,  Next: Custom installation,  Up: Installation
+
+Simple installation
+===================
+
+  Installing TeX and friends for the first time can be a daunting
+experience.  Thus, you may prefer to skip this whole thing and just get
+precompiled executables: *note unixtex.ftp::..
+
+  This section explains what to do if you wish to take the defaults for
+everything (installing under `/usr/local'), and generally to install in
+the simplest possible way.  Most steps here refer to corresponding
+subsection in the next section which explains how to override defaults
+and generally gives more details.
+
+  1. Be sure you have enough disk space: approximately 8 megabytes for
+     the compressed archives, 15MB for sources, 45MB for compilation,
+     40MB for the (initial) installed system (including library files).
+     *Note Disk space::.
+
+  2. Retrieve these two distribution archives:
+    `ftp://ftp.tug.org/tex/texk.tar.gz'
+          These are the sources, which you will be compiling.
+
+    `ftp://ftp.tug.org/tex/texmflib.tar.gz'
+          This is a basic set of input files.  You should unpack it in
+          the directory `/usr/local/share'; doing so will create a
+          `texmf' subdirectory there.
+
+     *Note Kpathsea application distributions::.
+
+  3. When using the default search paths, there is no need to edit any
+     distribution files. *Note Changing search paths::.
+
+  4. At the top level of the distribution, run `sh configure'.  (If you
+     have the GNU Bash shell installed, run `bash configure'.) *Note
+     Running configure::.
+
+  5. `make'. *Note Running make::.
+
+  6. `make install'. *Note Installing files::.
+
+  7. `make distclean'. *Note Cleaning up::.
+
+  8. Set up a cron job to rebuild the filename database that makes
+     searching faster.  This line will rebuild it every midnight:
+          0 0 * * * cd /usr/local/share/texmf && /BINDIR/MakeTeXls-R
+     *Note Filename database generation::, and *Note Filename
+     database::.
+
+  9. If you're installing Dvips, you also need to set up configuration
+     files for your printers and make any additional PostScript fonts
+     available.  *Note Installation: (dvips)Installation.  If you have
+     any color printers, *note Color device configuration: (dvips)Color
+     device configuration..
+
+ 10. The first time you run a DVI driver, a bunch of PK fonts will be
+     built by Metafont via `MakeTeXPK' (and added to the filename
+     database).  This will take some time.  Don't be alarmed; they will
+     created only this first time (unless something is wrong with your
+     path definitions).
+
+     By default, `MakeTeXPK' assumes `/usr/local/share/texmf/fonts' is
+     globally writable.  If you need a different arrangement, *note
+     MakeTeX configuration::..
+
+     *Note MakeTeX scripts::.
+
+ 11. For some simple tests, try `tex story \\bye' and `latex simple'.
+     Then run `xdvi story' or `dvips simple' on the resulting DVI files
+     to preview/print the documents.  *Note Installation testing::.
+
+
+File: kpathsea.info,  Node: Custom installation,  Next: Security,  Prev: Simple installation,  Up: Installation
+
+Custom installation
+===================
+
+  Most sites need to modify the default installation procedure in some
+way, perhaps merely changing the prefix from `/usr/local', perhaps
+adding extra compiler or loader options to work around `configure'
+bugs.  This section explains how to override default choices.  For
+additional distribution-specific information:
+   * `dviljk/INSTALL'.
+
+   * *Note Installation: (dvips)Installation.
+
+   * *Note Installation: (web2c)Installation.
+
+   * `xdvik/INSTALL'.
+
+  These instructions are for Unix systems.  Other operating-system
+specific distributions have their own instructions.  The code base
+itself supports Amiga, DOS, OS/2, and VMS.
+
+  Following are the same steps as in the previous section (which
+describes the simplest installation), but with much more detail.
+
+* Menu:
+
+* Disk space::
+* Kpathsea application distributions::
+* Changing search paths::
+* Running configure::
+* Running make::
+* Installing files::
+* Cleaning up::
+* Filename database generation::
+* MakeTeX scripts::
+* Installation testing::
+
+
+File: kpathsea.info,  Node: Disk space,  Next: Kpathsea application distributions,  Up: Custom installation
+
+Disk space
+----------
+
+  Here is a table showing the disk space needed for each distribution
+(described in the next section).  The `(totals)' line reflects the
+`texk' source distribution and `texmflib'; the individual distributions
+don't enter into it.  Sizes are in megabytes.  All numbers are
+approximate.
+
+dviljk        .9       3.8                            
+dvipsk        .9       3.2                            
+xdvik         .7       2.5                            
+web2c         1.3      5.0                            
+web           1.9      6.5       -         -          
+texk          3.8      14.1      43.1      23.5       
+texmflib      3.8      15.0      -         15.0       
+(totals)      7.6      29.1      43.1      38.5       
+
+
+File: kpathsea.info,  Node: Kpathsea application distributions,  Next: Changing search paths,  Prev: Disk space,  Up: Custom installation
+
+Kpathsea application distributions
+----------------------------------
+
+  The archive `ftp://ftp.tug.org/tex/texk.tar.gz' contains all of the
+Kpathsea applications I maintain, and the library itself.  For example,
+since NeXT does not generally support X11, you'd probably want to skip
+`xdvik' (or simply remove it after unpacking `texk.tar.gz'.  If you are
+not interested in all of them, you can also retrieve them separately:
+
+`dviljk.tar.gz'
+     DVI to PCL, for LaserJet printers.
+
+`dvipsk.tar.gz'
+     DVI to PostScript, for previewers, printers, or PDF generation.
+
+`web2c.tar.gz'
+     The software needed to compile TeX and friends.
+
+`web.tar.gz'
+     The original WEB source files, also used in compilation.
+
+`xdvik.tar.gz'
+     DVI previewing under the X window system.
+
+  If you want to use the Babel LaTeX package for support of non-English
+typesetting, you may need to retrieve additional files.  See the file
+`install.txt' in the Babel distribution.
+
+
+File: kpathsea.info,  Node: Changing search paths,  Next: Running configure,  Prev: Kpathsea application distributions,  Up: Custom installation
+
+Changing search paths
+---------------------
+
+  If the search paths for your installation differ from the standard
+TeX directory structure (*note Introduction: (tds)Top.), edit the file
+`kpathsea/texmf.cnf.in' as desired, before running `configure'.  For
+example, if you have all your fonts or macros in one big directory.
+
+  You may also wish to edit the file `MakeTeXnames.cnf', either before
+or after installation, to control various aspects of `MakeTeXPK' and
+friends.  *Note MakeTeX configuration::.
+
+  You do not need to edit `texmf.cnf.in' to change the default
+top-level or other installation *directories* (only the paths).  You
+can and should do that when you run `configure' (next step).
+
+  You also do not need to edit `texmf.cnf.in' if you are willing to
+rely on `texmf.cnf' at runtime to define the paths, and let the
+compile-time default paths be incorrect.  Usually there is no harm in
+doing this.
+
+  The section below explains default generation in more detail.
+
+* Menu:
+
+* Default path features::
+* Default path generation::
+
+
+File: kpathsea.info,  Node: Default path features,  Next: Default path generation,  Up: Changing search paths
+
+Default path features
+.....................
+
+  The purpose of having all the different files described in the section
+above is to avoid having the same information in more than one place. If
+you change the installation directories or top-level prefix at
+`configure'-time, those changes will propagate through the whole
+sequence.  And if you change the default paths in `texmf.cnf.in', those
+changes are propagated to the compile-time defaults.
+
+  The Make definitions are all repeated in several Makefile's; but
+changing the top-level `Makefile' should suffice, as it passes down all
+the variable definitions, thus overriding the submakes.  (The
+definitions are repeated so you can run Make in the subdirectories, if
+you should have occasion to.)
+
+  By default, the bitmap font paths end with `/$MAKETEX_MODE', thus
+including the device name (usually a Metafont mode name such as
+`ljfour').  This distinguishes two different devices with the same
+resolution--a write/white from a write/black 300dpi printer, for
+example.
+
+  However, since most sites don't have this complication, Kpathsea
+(specifically, the `kpse_init_prog' function in `kpathsea/proginit.c')
+has a special case: if the mode has not been explicitly set by the user
+(or in a configuration file), it sets `MAKETEX_MODE' to `/'.  This
+makes the default PK path, for example, expand into `.../pk//', so
+fonts will be found even if there is no subdirectory for the mode (if
+you arranged things that way because your site has only one printer,
+for example) or if the program is mode-independent (e.g., `pktype').
+
+  To make the paths independent of the mode, simply edit `texmf.cnf.in'
+before installation, or the installed `texmf.cnf', and remove the
+`$MAKETEX_MODE'.
+
+  *Note MakeTeX script arguments::, for how this interacts with
+`MakeTeXPK'.
+
+  *Note TeX directory structure: TeX directory structure, for a
+description of the default arrangement of the input files that comprise
+the TeX system.  The file `kpathsea/HIER' is a copy of that section.
+
+
+File: kpathsea.info,  Node: Default path generation,  Prev: Default path features,  Up: Changing search paths
+
+Default path generation
+.......................
+
+  This section describes how the default paths are constructed.
+
+  You may wish to ignore the whole mess and simply edit `texmf.cnf'
+after it is installed, perhaps even copying it into place beforehand so
+you can complete the installation, if it seems necessary.
+
+  To summarize the chain of events that go into defining the default
+paths:
+
+  1. `configure' creates a `Makefile' from each `Makefile.in'.
+
+  2. When Make runs in the `kpathsea' directory, it creates a file
+     `texmf.sed' that substitutes the Make value of `$(var)' for a
+     string `@var@'.  The variables in question are the one that define
+     the installation directories.
+
+  3. `texmf.sed' (together with a little extra magic--see
+     `kpathsea/Makefile') is applied to `texmf.cnf.in' to generate
+     `texmf.cnf'.  This is the file that will eventually be installed
+     and used.
+
+  4. The definitions in `texmf.cnf' are recast as C `#define''s in
+     `paths.h'.  These values will be the compile-time defaults; they
+     are not used at runtime unless no `texmf.cnf' file can be found.
+
+     (That's a lie: the compile-time defaults are what any extra :'s in
+     `texmf.cnf' expand into; but the paths as distributed have no extra
+     :'s, and there's no particular reason for them to.)
+
+
+File: kpathsea.info,  Node: Running configure,  Next: Running make,  Prev: Changing search paths,  Up: Custom installation
+
+Running `configure'
+-------------------
+
+  Run `sh configure OPTIONS' (in the top-level directory, the one
+containing `kpathsea/'), possibly using a shell other than `sh' (*note
+configure shells::.).
+
+  `configure' adapts the source distribution to the present system via
+`#define''s in `*/c-auto.h', which are created from the corresponding
+`c-auto.h.in'.  It also creates a `Makefile' from the corresponding
+`Makefile.in', doing `@VAR@' and `ac_include' substitutions).
+
+  `configure' is the best place to control the configuration,
+compilation, and installed location of the software, either via
+command-line options, or by setting environment variables before
+invoking it.  For example, you can disable `MakeTeXPK' by default with
+the option `--disable-maketexpk'.  *Note configure options::.
+
+* Menu:
+
+* configure shells::
+* configure options::
+* configure environment::
+* configure scenarios::
+* Shared library::
+
+
+File: kpathsea.info,  Node: configure shells,  Next: configure options,  Up: Running configure
+
+`configure' shells
+..................
+
+  If you have Bash, the GNU shell, use it if `sh' runs into trouble
+(*note Top: (features)Top.).
+
+  Most Bourne shell variants other than Bash cannot handle `configure'
+scripts as generated by GNU Autoconf (*note Introduction:
+(autoconf)Top.).  Specifically:
+`ksh'
+     The Korn shell may be installed as `/bin/sh' on AIX.  `/bin/bsh'
+     may serve instead.
+
+`ash'
+     Ash is sometimes installed as `/bin/sh' on NetBSD, FreeBSD, and
+     Linux systems.  `/bin/bash' should be available.
+
+`Ultrix /bin/sh'
+     `/bin/sh' under Ultrix is a DEC-grown shell that is notably
+     deficient in many ways.  `/bin/sh5' may be necessary.
+
+
+File: kpathsea.info,  Node: configure options,  Next: configure environment,  Prev: configure shells,  Up: Running configure
+
+`configure' options
+...................
+
+  For a complete list of all `configure' options, run `configure
+--help' or *note Running `configure' scripts: (autoconf)Invoking
+configure. (a copy is in the file `kpathsea/CONFIGURE').  The generic
+options are listed first in the `--help' output, and the
+package-specific options come last.  The environment variables
+`configure' pays attention to are listed below.
+
+  Options particularly likely to be useful are `--prefix', `--datadir',
+and the like; *note configure scenarios::..
+
+  This section gives pointers to descriptions of the `--with' and
+`--enable' options to `configure' that Kpathsea-using programs accept.
+
+`--without-maketexmf-default'
+`--without-maketexpk-default'
+`--without-maketextfm-default'
+`--with-maketextex-default'
+     Enable or disable the dynamic generation programs.  *Note MakeTeX
+     configuration::.
+
+`--enable-shared'
+     Build Kpathsea as a shared library, and link against it.  Also
+     build the usual static library.  *Note Shared library::.
+
+`--disable-static'
+     Build only the shared library.
+
+
+File: kpathsea.info,  Node: configure environment,  Next: configure scenarios,  Prev: configure options,  Up: Running configure
+
+`configure' environment
+.......................
+
+  `configure' uses the value of the following environment variables in
+determining your system's characteristics, and substitutes for them in
+Makefile's:
+
+`CC'
+     The compiler to use: default is `gcc' if it's installed, otherwise
+     `cc'.
+
+`CFLAGS'
+     Options to give the compiler: default is `-g -O2' for `gcc', `-g'
+     otherwise.  `CFLAGS' comes after any other options.  You may need
+     to include `-w' here if your compilations commonly have useless
+     warnings (e.g., `NULL redefined'), or `configure' may fail to
+     detect the presence of header files (it takes the messages on
+     standard error to mean the header file doesn't exist).
+
+`CPPFLAGS'
+     Options to pass to the compiler preprocessor; this matters most for
+     configuration, not the actual source compilation.  The `configure'
+     script often does only preprocessing (e.g., to check for the
+     existence of #include files), and `CFLAGS' is not used for this.
+     You may need to set this to something like
+     `-I/usr/local/include/wwwhatever' if you have the libwww library
+     installed for hyper-xdvik (see `xdvik/INSTALL').
+
+`DEFS'
+     Additional preprocessor options, but not used by `configure'.
+     Provided for enabling or disabling program features, as documented
+     in the various program-specific installation instructions.  `DEFS'
+     comes before any compiler options included by the distribution
+     `Makefile's or by `configure'.
+
+`LDFLAGS'
+     Additional options to give to the loader.  `LDFLAGS' comes before
+     any other linker options.
+
+`LIBS'
+     Additional libraries to link with.
+
+
+File: kpathsea.info,  Node: configure scenarios,  Next: Shared library,  Prev: configure environment,  Up: Running configure
+
+`configure' scenarios
+.....................
+
+  Here are some common installation scenarios:
+
+   * Including X support in Metafont.  This is disabled by default,
+     since many sites have no use for it, and it's a leading cause of
+     configuration problems.
+          configure --with-x-toolkit
+
+   * Putting the binaries, TeX files, GNU info files, etc. into a single
+     TeX hierarchy, say TEXMF, requires overriding defaults in both
+     `configure' and `make':
+          configure --prefix=TEXMF --datadir=TEXMF
+          make texmf=TEXMF
+
+   * You can compile on multiple architectures simultaneously either by
+     building symbolic link trees with the `lndir' script from the X11
+     distribution, or with the `--srcdir' option:
+          configure --srcdir=SRCDIR
+
+   * If you are installing binaries for multiple architectures into a
+     single hierarchy, you will probably want to override the default
+     `bin' and `lib' directories, something like this:
+          configure --prefix=TEXMF --datadir=TEXMF \
+            --bindir=TEXMF/ARCH/bin --libdir=TEXMF/ARCH/lib
+          make texmf=TEXMF
+      (Unless you make provisions for architecture-specific files in
+     other ways, e.g., with Depot or an automounter.)
+
+   * To compile with optimization (to compile without debugging, remove
+     the `-g'):
+          env CFLAGS="-g -O" sh configure ...
+      For a potential problem if you optimize, see *Note TeX or
+     Metafont failing: TeX or Metafont failing.
+
+
+File: kpathsea.info,  Node: Shared library,  Prev: configure scenarios,  Up: Running configure
+
+Shared library
+..............
+
+  You can compile Kpathsea as a shared library on a few systems, by
+specifying the option `--enable-shared' when you run `configure'.
+
+  The main advantage in doing this is that the executables can then
+share the code, thus decreasing memory and disk space requirements.
+
+  On some systems, you can record the location of shared libraries in a
+binary, usually by giving certain options to the linker.  Then
+individual users do not need to set their system's environment variable
+(e.g., `LD_LIBRARY_PATH') to find shared libraries.  If you want to do
+this, you will need to add the necessary options to `LDFLAGS' yourself;
+for example, on Solaris, include something like `-R${prefix}/lib'.
+(Unfortunately, making this happen by default is very difficult,
+because of interactions with an existing installed shared library.)
+
+  Currently, shared library support is implemented only on SunOS 4
+(Solaris 1) and SunOS 5 (Solaris 2).  If you're interested and willing
+in adding support for other systems, please see the `configure' mode in
+the `klibtool' script, especially the host-specific case statement
+around line 250.
+
+
+File: kpathsea.info,  Node: Running make,  Next: Installing files,  Prev: Running configure,  Up: Custom installation
+
+Running `make'
+--------------
+
+  `make' (still in the top-level directory).  This also creates the
+`texmf.cnf' and `paths.h' files that define the default search paths,
+and (by default) the `plain' and `latex' TeX formats.
+
+  You can override directory names and other values at `make'-time.
+`make/paths.make' lists the variables most commonly reset.  For
+example, `make default_texsizes=600' changes the list of fallback
+resolutions.
+
+  You can also override each of `configure''s environment variables
+(*note configure environment::.).  The Make variables have the same
+names.
+
+  Finally, you can supply additional options via the following
+variables.  (`configure' does not use these.)
+
+`XCPPFLAGS'
+`XDEFS'
+     Preprocessor options.
+
+`XCFLAGS'
+     Compiler options.
+
+`XLDFLAGS'
+     Loader options (included at beginning of link commands).
+
+`XLOADLIBES'
+     More loader options (included at end of link commands).
+
+`XMAKEARGS'
+     Additional Make arguments passed to all sub-`make''s. You may need
+     to include assignments to the other variables here via `XMAKEARGS';
+     for example: `make XMAKEARGS="CFLAGS=-O XDEFS=-DA4"'.
+
+  It's generally a bad idea to use a different compiler (`CC') or
+libraries (`LIBS') for compilation than you did for configuration,
+since the values `configure' determined may then be incorrect.
+
+  Adding compiler options to change the "universe" you are using
+(typically BSD vs. system V) is generally a cause of trouble.  It's
+best to use the native environment, whatever that is; `configure' and
+the software usually adapt best to that.  In particular, under Solaris
+2.x, you should not use the BSD-compatibility library (`libucb') or
+include files (`ucbinclude').
+
+  If you want to use the Babel LaTeX package for support of non-English
+typesetting, you need to modify some files before making the LaTeX
+format.  See the file `install.txt' in the Babel distribution.
+
+
+File: kpathsea.info,  Node: Installing files,  Next: Cleaning up,  Prev: Running make,  Up: Custom installation
+
+Installing files
+----------------
+
+  The basic command is the usual `make install'.  For security issues,
+*note Security::..
+
+  The first time you install any manual in the GNU Info system, you
+should add a line (you choose where) to the file `dir' in your
+`$(infodir)' directory.  Sample text for this is given near the top of
+the Texinfo source files (`kpathsea/kpathsea.texi',
+`dvipsk/dvips.texi', and `web2c/doc/web2c.texi').  If you have a recent
+version of the GNU Texinfo distribution installed
+(`ftp://prep.ai.mit.edu/pub/gnu/texinfo-3.9.tar.gz' or later), this
+should happen automatically.
+
+  On the offchance that this is your first Info installation, the `dir'
+file I use is included in the distribution as `etc/dir-example'.
+
+  You may wish to use one of the following targets, especially if you
+are installing on multiple architectures:
+   * `make install-exec' to install in architecture-dependent
+     directories, i.e., ones that depend on the `$(exec_prefix)' Make
+     variable.  This includes links to binaries, libraries, etc., not
+     just "executables".
+
+   * `make install-data' to install in architecture-independent
+     directories, such as documentation, configuration files, pool
+     files, etc.
+
+  If you use the Andrew File System, the normal path (e.g., PREFIX/bin)
+only gets you to a read-only copy of the files, and you must specify a
+different path for installation.  The best way to do this is by setting
+the `prefix' variable on the `make' command line.  The sequence becomes
+something like this:
+     configure --prefix=/whatever
+     make
+     make install prefix=/afs/.SYSTEM.NAME/system/1.3/@sys/whatever
+   With AFS, you will definitely want to use relative filenames in
+`ls-R' (*note Filename database::.), not absolute filenames.  This is
+done by default, but check anyway.
+
+
+File: kpathsea.info,  Node: Cleaning up,  Next: Filename database generation,  Prev: Installing files,  Up: Custom installation
+
+Cleaning up
+-----------
+
+The basic command is `make distclean'.  This removes all files created
+by the build.
+
+  Alternatively,
+   * `make mostlyclean' if you intend to compile on another
+     architecture.  For Web2c, since the generated C files are portable,
+     they are not removed.  If the `lex' vs. `flex' situation is going
+     to be different on the next machine, `rm web2c/lex.yy.c'.
+
+   * `make clean' to remove files created by compiling, but leave
+     configuration files and Makefiles.
+
+   * `make maintainer-clean' to remove everything that the Makefiles can
+     rebuild.  This is more than `distclean' removes, and you should
+     only use it if you are thoroughly conversant with (and have the
+     necessary versions of) Autoconf.
+
+   * `make extraclean' to remove other junk, e.g., core files, log
+     files, patch rejects.  This is independent of the other `clean'
+     targets.
+
+
+File: kpathsea.info,  Node: Filename database generation,  Next: MakeTeX scripts,  Prev: Cleaning up,  Up: Custom installation
+
+Filename database generation
+----------------------------
+
+  You will probably want to set up a `cron' entry on the appropriate
+machine(s) to rebuild the filename database nightly or so, as in:
+     0 0 * * * cd TEXMF && /BINDIR/MakeTeXls-R
+   *Note Filename database::.
+
+Although the `MakeTeX...' scripts make every effort to add
+newly-created files on the fly, it can't hurt to make sure you get a
+fresh version every so often.
+
+
+File: kpathsea.info,  Node: MakeTeX scripts,  Next: Installation testing,  Prev: Filename database generation,  Up: Custom installation
+
+`MakeTeX' scripts
+-----------------
+
+  If Kpathsea cannot otherwise find a file, for some file types it is
+configured by default to invoke an external program to create it
+dynamically (*note MakeTeX configuration::.).  This is most useful for
+fonts (bitmaps, TFM's, and arbitrarily-sizable Metafont sources such as
+the Sauter and DC fonts), since any given document can use fonts never
+before referenced.  Trying to build all fonts in advance is therefore
+impractical, if not impossible.
+
+  The script is passed the name of the file to create and possibly other
+arguments, as explained below.  It must echo the full pathname of the
+file it created (and nothing else) to standard output; it can write
+diagnostics to standard error.
+
+* Menu:
+
+* MakeTeX configuration::
+* MakeTeX script names::
+* MakeTeX script arguments::
+
+
+File: kpathsea.info,  Node: MakeTeX configuration,  Next: MakeTeX script names,  Up: MakeTeX scripts
+
+`MakeTeX' configuration
+.......................
+
+  The following file types can run an external program to create missing
+files: `pk', `tfm', `mf', `tex'; the scripts are named `MakeTeXPK',
+`MakeTeXTFM', `MakeTeXMF', and `MakeTeXTeX'.
+
+  In the absence of `configure' options specifying otherwise,
+everything but `MakeTeXTeX' will be enabled by default. The `configure'
+options to change the defaults are:
+
+     --without-maketexmf-default
+     --without-maketexpk-default
+     --without-maketextfm-default
+     --with-maketextex-default
+
+  The `configure' setting is overridden if the environment variable or
+configuration file value named for the script is set; e.g., `MAKETEXPK'
+(*note MakeTeX script arguments::.).
+
+  As distributed, all the scripts source a file
+`texmf/web2c/MakeTeX.site' if it exists, so you can override various
+defaults.  See `MakeTeXcommon', for instance, which defines the default
+mode, resolution, directory permissions, some special directory names,
+etc.  If you prefer not to change the distributed scripts, you can
+simply create `MakeTeX.site' with the appropriate definitions (you do
+not need to create it if you have nothing to put in it).
+`MakeTeX.site' has no special syntax; it's an arbitrary Bourne shell
+script.  The distribution contains a sample `MakeTeX.site' for you to
+copy and modify as you please (it is not installed anywhere).
+
+  In addition, you can configure a number of features with the
+`MT_FEATURES' variable, which you can define:
+   * in `MakeTeX.site', as just mentioned;
+
+   * by editing the file `MakeTeXnames.cnf', either before `make
+     install' (in the source hierarchy) or after (in the installed
+     hierarchy);
+
+   * or in the environment.
+
+  By default, `MakeTeXPK' installs fonts into the standard TeX
+directory structure (*note TeX directory structure: TeX directory
+structure.).  It uses aliases and directory names from the Fontname
+distribution (*note Introduction: (fontname)Top.). Most of the options
+here change that.
+
+`appendonlydir'
+     Tell `MakeTeXmkdir' to create directories append-only, i.e., set
+     their sticky bit (*note Mode Structure: (fileutils)Mode
+     Structure.).
+
+`dosnames'
+     Use 8.3 names; e.g., `dpi600/cmr10.pk' instead of `cmr10.600pk'.
+
+`nomode'
+     Omit the directory level for the mode name; this is fine as long as
+     you generate fonts for only one mode.
+
+`strip'
+     Omit the font supplier and typeface name directory levels.
+
+`varfonts'
+     Put `MakeTeXPK'-generated fonts under the directory named by
+     `VARTEXFONTS'; the default value in `kpathsea/texmf.cnf.in' is
+     `/var/tex/fonts', as recommended by the `Linux File System
+     Standard' (but unless `varfonts' is enabled, nothing cares about
+     that value).
+
+     The `varfonts' setting in `MT_FEATURES' is overridden by the
+     `USE_VARTEXFONTS' environment variable: if set to `1', the feature
+     is enabled, and if set to `0', the feature is disabled.
+
+
+File: kpathsea.info,  Node: MakeTeX script names,  Next: MakeTeX script arguments,  Prev: MakeTeX configuration,  Up: MakeTeX scripts
+
+`MakeTeX' script names
+......................
+
+  The following table shows the default name of the script for each
+possible file types.  (The source is the variable `kpse_make_specs' in
+`kpathsea/tex-make.c'.)
+
+`MakeTeXPK'
+     Glyph fonts.
+
+`MakeTeXTeX'
+     TeX input files.
+
+`MakeTeXMF'
+     Metafont input files.
+
+`MakeTeXTFM'
+     TFM files.
+
+These names are overridden by an environment variable specific to the
+program--for example, `DVIPSMAKEPK' for Dvipsk.
+
+  If a `MakeTeX...' script fails, the invocation is appended to a file
+`missfont.log' (by default) in the current directory.  You can then
+execute the log file to create the missing files after fixing the
+problem.
+
+  If the current directory is not writable and the environment variable
+or configuration file value `TEXMFOUTPUT' is set, its value is used.
+Otherwise, nothing is written.  The name `missfont.log' is overridden
+by the `MISSFONT_LOG' environment variable or configuration file value.
+
+
+File: kpathsea.info,  Node: MakeTeX script arguments,  Prev: MakeTeX script names,  Up: MakeTeX scripts
+
+`MakeTeX' script arguments
+..........................
+
+  The first argument to a `MakeTeX' script is always the name of the
+file to be created.
+
+  In the default `MakeTeXPK' implementation, from three to five
+additional arguments may also passed, via environment variables:
+
+  1. The resolution to make the font at (`KPATHSEA_DPI').
+
+  2. The "base dpi" the program is operating at (`MAKETEX_BASE_DPI'),
+     i.e., the assumed resolution of the output device.
+
+  3. A "magstep" string suitable for the Metafont `mag' variable
+     (`MAKETEX_MAG').
+
+  4. Optionally, a Metafont mode name to assign to the Metafont `mode'
+     variable (`MAKETEX_MODE').  Otherwise, (the default) `MakeTeXPK'
+     guesses the mode from the resolution.  *Note TeX directory
+     structure: TeX directory structure.
+
+  5. Optionally, a directory name. If the directory is absolute, it is
+     used as-is. Otherwise, it is appended to the root destination
+     directory set in the script (from environment variables `DESTDIR'
+     or `MTP_DESTDIR' or a compile-time default). If this argument is
+     not supplied, the mode name is appended to the root destination
+     directory.
+
+Kpathsea sets `KPATHSEA_DPI' appropriately for each attempt at building
+a font.  It's up to the program using Kpathsea to set the others.
+(*Note Calling sequence::.)
+
+  You can change the specification for the arguments passed to the
+external script by setting the environment variable named as the script
+name, but all capitals--`MAKETEXPK', for example.  If you've changed
+the script name by setting (say) `DVIPSMAKEPK' to `foo', then the spec
+is taken from the environment variable `FOO'.
+
+  The spec can contain any variable references, to the above variables
+or any others.  As an example, the default spec for `MakeTeXPK' is:
+     $KPATHSEA_DPI $MAKETEX_BASE_DPI $MAKETEX_MAG $MAKETEX_MODE
+
+The convention of passing the name of the file to be created as the
+first argument cannot be changed.
+
+
+File: kpathsea.info,  Node: Installation testing,  Prev: MakeTeX scripts,  Up: Custom installation
+
+Installation testing
+--------------------
+
+  Besides the tests listed in *Note Simple installation::, you can try
+running `make check'.  This includes the torture tests (trip, trap, and
+mptrap) that come with Web2c (*note Torture tests: (web2c)Torture
+tests.).
+
+
+File: kpathsea.info,  Node: Security,  Next: TeX directory structure,  Prev: Custom installation,  Up: Installation
+
+Security
+========
+
+  None of the programs in the TeX system require any special system
+privileges, so there's no first-level security concern of people gaining
+illegitimate root access.
+
+  A TeX document, however, can write to arbitrary files, e.g.,
+`~/.rhosts', and thus an unwitting user who runs TeX on a random
+document is vulnerable to a trojan horse attack.  This loophole is
+closed by default, but you can be permissive if you so desire in
+`texmf.cnf'.  *Note tex invocation: (web2c)tex invocation.  MetaPost has
+the same issue.
+
+  Dvips, Xdvi, and TeX can also execute shell commands under some
+circumstances.  To disable this, see the `-R' option in *Note Option
+details: (dvips)Option details, the xdvi man page, and *Note tex
+invocation: (web2c)tex invocation, respectively.
+
+  Another security issue arises because it's very useful--almost
+necessary--to make arbitrary fonts on user demand with `MakeTeXPK' and
+friends.  Where do these files get installed?  By default, the
+`MakeTeXPK' distributed with Kpathsea assumes a globally writable
+`texmf' tree; this is the simplest and most convenient approach, but it
+may not suit your situation.
+
+  The first restriction you can apply is to make newly-created
+directories under `texmf' be append-only with an option in
+`MakeTeXnames.cnf'.  *Note MakeTeX configuration::.
+
+  Another approach is to establish a group (or user) for TeX files,
+make the `texmf' tree writable only to that group (or user), and make
+`MakeTeXPK' et al. setgid to that group (or setuid to that user).  Then
+users must invoke the scripts to install things.  (If you're worried
+about the inevitable security holes in scripts, then you could write a
+C wrapper to exec the script.)
+
+  Finally, using a central writable `texmf' tree may be completely
+impossible, because it's on an NFS filesystem that you cannot export
+read/write, or AFS is in use, or simply because "it's policy".  Then
+you must resort to each user's machine having its own local directory of
+dynamically-created fonts; again, `MakeTeXnames.cnf' has an option to
+do this, and again, *note MakeTeX configuration::..
+
+
+File: kpathsea.info,  Node: TeX directory structure,  Next: unixtex.ftp,  Prev: Security,  Up: Installation
+
+TeX directory structure
+=======================
+
+  This section describes the default installation hierarchy of the
+distribution.  It conforms to both the GNU coding standards and the TeX
+directory structure (TDS) standard.  For rationale and further
+explanation, please see those documents.  The GNU standard is available
+as `ftp://prep.ai.mit.edu/pub/gnu/standards/standards.texi' and
+mirrors.  The TDS document is available from `CTAN:/tex-archive/tds'
+(*note unixtex.ftp::.).
+
+  You can change the default paths in many ways (*note Changing search
+paths::.).  One common desire is to put everything (binaries and all)
+under a single top-level directory such as `/usr/local/texmf' or
+`/opt/texmf'--in the terms used below, make PREFIX and TEXMF the same.
+For specific instructions on doing that, *note configure scenarios::..
+
+  Here is a skeleton of the default directory structure, extracted from
+the TDS document:
+
+     PREFIX/      installation root (`/usr/local' by default)
+      bin/         executables
+      man/         man pages
+      include/     C header files
+      info/        GNU info files
+      lib/         libraries (`libkpathsea.*')
+      share/       architecture-independent files
+       texmf/      TDS root
+        bibtex/     BibTeX input files
+         bib/        BibTeX databases
+          base/       base distribution (e.g., `xampl.bib')
+          misc/       single-file databases
+          PKG/       name of a package
+         bst/        BibTeX style files
+          base/       base distribution (e.g., `plain.bst', `acm.bst')
+          misc/       single-file styles
+          PKG/       name of a package
+        doc/         additional documentation
+        dvips/       `.pro', `.ps', `psfonts.map'
+        fonts/       font-related files
+         TYPE/         file type (e.g., `tfm', `pk')
+          MODE/          type of output device (types `pk' and `gf' only)
+           SUPPLIER/       name of a font supplier (e.g., `public')
+            TYPEFACE/        name of a typeface (e.g., `cm')
+             dpiNNN/           font resolution (types `pk' and `gf' only)
+        metafont/    Metafont (non-font) input files
+         base/        base distribution (e.g., `plain.mf')
+         misc/        single-file packages (e.g., `modes.mf')
+         PKG/           name of a package (e.g., `mfpic')
+        metapost/    MetaPost input files
+         base/        base distribution (e.g., `plain.mp')
+         misc/        single-file packages
+         PKG/           name of a package
+         support/     support files for MetaPost-related utilities (e.g., `trfonts.map')
+        mft/         `MFT' inputs (e.g., `plain.mft')
+        tex/         TeX input files
+         FORMAT/         name of a format (e.g., `plain')
+          base/        base distribution for FORMAT (e.g., `plain.tex')
+          misc/        single-file packages (e.g., `webmac.tex')
+          local/       local additions to or local configuration files for FORMAT
+          PKG/           name of a package (e.g., `graphics', `mfnfss')
+         generic/     format-independent packages
+          hyphen/      hyphenation patterns (e.g., `hyphen.tex')
+          images/      image input files (e.g., Encapsulated PostScript)
+          misc/        single-file format-independent packages (e.g., `null.tex').
+          PKG/           name of a package (e.g., `babel')
+        web2c/        implementation-dependent files (`.pool', `.fmt', `texmf.cnf', etc.)
+
+  Some concrete examples for most file types:
+
+     /usr/local/bin/tex
+     /usr/local/man/man1/xdvi.1
+     /usr/local/info/kpathsea.info
+     /usr/local/lib/libkpathsea.a
+     /usr/local/share/texmf/bibtex/bst/base/plain.bst
+     /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmr10.600pk
+     /usr/local/share/texmf/fonts/source/public/pandora/pnr10.mf
+     /usr/local/share/texmf/fonts/tfm/public/cm/cmr10.tfm
+     /usr/local/share/texmf/fonts/type1/adobe/utopia/putr.pfa
+     /usr/local/share/texmf/metafont/base/plain.mf
+     /usr/local/share/texmf/metapost/base/plain.mp
+     /usr/local/share/texmf/tex/plain/base/plain.tex
+     /usr/local/share/texmf/tex/generic/hyphen/hyphen.tex
+     /usr/local/share/texmf/web2c/tex.pool
+     /usr/local/share/texmf/web2c/tex.fmt
+     /usr/local/share/texmf/web2c/texmf.cnf
+
+
+File: kpathsea.info,  Node: unixtex.ftp,  Next: Reporting bugs,  Prev: TeX directory structure,  Up: Installation
+
+`unixtex.ftp': Obtaining TeX
+============================
+
+  This is `ftp://ftp.tug.org/tex/unixtex.ftp', last updated 7 February
+1997.  Also available as `http://www.tug.org/unixtex.ftp'.  The IP
+address is currently [158.121.106.10], and the canonical host name is
+currently `tug.cs.umb.edu'.  It is also in Kpathsea source
+distributions as `etc/unixtex.ftp' (although the network version is
+usually newer).  Mail <kb@mail.tug.org> with comments or questions.
+
+  Following are general instructions for Unix or other sites who wish to
+acquire the Web2c distribution, (plain) TeX, LaTeX (2e), BibTeX,
+Metafont, MetaPost, DVI processors for the X window system, PostScript,
+the PCL language in the HP LaserJet, and related programs.  They are
+oriented towards building from the original sources, though some
+information on alternative packages is included in the last section.
+See also `http://www.tug.org/web2c', the Web2c and Kpathsea home page.
+
+  Please consider joining the TeX Users Group (TUG) to help support the
+maintenance and development of the programs you retrieve.  Email
+<tug@tug.org> or see `http://www.tug.org' for information and a
+membership form.
+
+  For actual installation instructions after obtaining the necessary
+sources, *note Installation::..  A copy is in the distribution file
+`kpathsea/INSTALL'.
+
+* Menu:
+
+* Electronic distribution::  CTAN and so forth.
+* CD-ROM distribution::
+* Tape distribution::
+* Other TeX packages::
+
+
+File: kpathsea.info,  Node: Electronic distribution,  Next: CD-ROM distribution,  Up: unixtex.ftp
+
+Electronic distribution
+-----------------------
+
+  In many places we refer to CTAN:.  This is *both* a host name and a
+directory name.  Here are some primary locations:
+
+     `ftp://ftp.cdrom.com/pub/tex/ctan'  (California, USA)
+     `ftp://ftp.dante.de/tex-archive'    (Germany)
+     `ftp://ftp.tex.ac.uk/tex-archive'   (England)
+
+CTAN has many mirrors worldwide; see the top-level file
+`README.mirrors' from one of the sites above, or finger
+<ctan@ftp.tug.org>, or see `http://www.tug.org/CTAN.sites'.  A list
+current as of the time of distribution is in the top-level file
+`./MIRROR'.
+
+  You can also access CTAN via the World Wide Web, Gopher, electronic
+mail, or NFS.  The same `README.mirrors' file explains how.
+
+  You will need to retrieve some or all of the following archives,
+depending on your needs (don't forget to set binary mode for file
+transfers):
+
+`CTAN:/systems/web2c/texmflib.tar.gz'
+     A basic collection of fonts (TFM files only) and macro packages
+     (including Texinfo and LaTeX 2e).  It unpacks into `texmf/'; if
+     you change the structure of this hierarchy, you will also have to
+     change the default search paths (*note Changing search paths::.).
+     It is required unless you already have these files, in which case
+     you should change the default paths as necessary to find them.
+
+`CTAN:/systems/web2c/web.tar.gz'
+     The original WEB source files, written mostly by Don Knuth.
+     Required unless you already have this `web' version.  (The WEB
+     sources change irregularly with respect to Web2c itself.)  Unpacks
+     into `web2c-VERSION'.
+
+`CTAN:/systems/web2c/web2c.tar.gz'
+     The Web2c system.  Required.  Also unpacks into `web2c-VERSION'.
+
+`CTAN:/dviware/dvipsk.tar.gz'
+     DVI-to-PostScript translator.  Unpacks into `dvipsk-VERSION'.
+     Optional.
+
+`CTAN:/dviware/xdvik.tar.gz'
+     X window system DVI previewer.  Unpacks into `xdvik-VERSION'.
+     Optional.
+
+`CTAN:/dviware/dviljk.tar.gz'
+     DVI-to-PCL (HP LaserJet) translator.  Unpacks into
+     `dviljk-VERSION'.  Optional.
+
+  All that said, the originating host for the software above is
+`ftp.tug.org'.  You can retrieve these distributions (but not much
+else) from the `tex/' directory on that host.
+
+
+File: kpathsea.info,  Node: CD-ROM distribution,  Next: Tape distribution,  Prev: Electronic distribution,  Up: unixtex.ftp
+
+CD-ROM distribution
+-------------------
+
+  Numerous organizations distribute various TeX CD-ROM's:
+
+   * TUG, UK TUG, and GUTenberg (French-speaking TeX user group)
+     collaborated to produce the `TeX Live' CD-ROM, based on teTeX,
+     which in turn is based on Web2c; email <tex-live@mail.tug.org> or
+     see `http://www.tug.org/tex-live.html'.
+
+   * NTG (Dutch-speaking TeX user group) produced the 4allTeX CD-ROM;
+     email <ntg@nic.surfnet.nl>, or see
+     `http://ei0.ei.ele.tue.nl/ntg/'.  This is a runnable system.
+
+   * The Free Software Foundation's `Source Code CD-ROM' contains the
+     minimal TeX source distribution described in the previous section
+     (i.e., enough to print GNU documentation); email
+     <gnu@prep.ai.mit.edu> or finger <fsf@prep.ai.mit.edu>.
+
+   * The Gateway! CD-ROM set contains a runnable NetBSD/Amiga
+     distribution and sources; see
+     `http://www.netbsd.org/Sites/cdroms.html'.
+
+   * The Prime Time TeXcetera CD-ROM is a copy of CTAN (see the previous
+     section); email <ptf@ctcl.com> or see `http://www.ptf.com/ptf/'.
+
+   * Walnut Creek's TeX CD-ROM is also a copy of CTAN; email
+     <info@cdrom.com> or see `http://www.cdrom.com:/titles/tex.html'.
+
+   * Most Linux distributions include some TeX package based on Web2c;
+     see the Linux documentation file `Distribution-HOWTO' for a
+     comparison of Linux distributions, available (for example) via
+     `http://www.linux.org'.
+
+  If you know of additional TeX CD-ROM distributions to add to this
+list, please inform <kb@mail.tug.org>.
+
+
+File: kpathsea.info,  Node: Tape distribution,  Next: Other TeX packages,  Prev: CD-ROM distribution,  Up: unixtex.ftp
+
+Tape distribution
+-----------------
+
+  You can obtain a complete TeX distribution, including Web2c, on tape.
+Contact:
+     Pierre MacKay / Denny Hall, Mail Stop DH-10 / Department of Classics
+     University of Washington / Seattle, WA 98195 / USA
+     phone: 206-543-2268; email: <unixtex@u.washington.edu>
+
+  At this writing, the distribution is available in `tar' format on 1/4
+inch 4-track QIC-24 cartridges and 4mm DAT cartridges, and the cost is
+US$210.  Make checks payable to the University of Washington, drawn on
+a U.S. bank.  Purchase orders are acceptable, but they carry an extra
+charge of $10 to pay for invoice processing.  Overseas sites, please
+add $20 for shipment via air parcel post, or $30 for shipment via
+courier.
+
+
+File: kpathsea.info,  Node: Other TeX packages,  Prev: Tape distribution,  Up: unixtex.ftp
+
+Other TeX packages
+------------------
+
+  Many other TeX implementations are available in `CTAN:/systems',
+including ready-to-run distributions for Unix, Amiga, Acorn, VMS,
+Macintosh, DOS, and Windows (in various forms).  Although Web2c has
+support in the source code for many operating systems, and in fact some
+of the other distributions are based on it, it's unlikely to work as
+distributed on anything but Unix.  (Please contribute improvements!)
+
+  The Unix distribution alluded to above is the teTeX distribution.
+This includes both complete sources and precompiled binaries for many
+popular Unix variants, including Linux. It is based on Web2c, and
+contains many other TeX-related programs as well.
+
+  The host labrea.stanford.edu is the original source for the files for
+which Donald Knuth is directly responsible: `tex.web', `plain.tex',
+etc. However, unless you want to build your TeX library tree ab initio,
+it is more reliable and less work to retrieve these files as part of
+the above packages. In any case, labrea is not the canonical source for
+anything except what was created by Stanford TeX project, so do not
+rely on all the files available at that ftp site being up-to-date.
+
+
+File: kpathsea.info,  Node: Reporting bugs,  Prev: unixtex.ftp,  Up: Installation
+
+Reporting bugs
+==============
+
+  (A copy of this chapter is in the file `kpathsea/BUGS'.)
+
+  If you have problems or suggestions, please report them to
+<tex-k@mail.tug.org> using the bug checklist below.
+
+  Please report bugs in the documentation; not only factual errors or
+inconsistent behavior, but unclear or incomplete explanations, typos,
+wrong fonts, ...
+
+* Menu:
+
+* Bug checklist::       What to include in a good bug report.
+* Mailing lists::       Joining the bugs or announcements mailing lists.
+* Debugging::           Analyzing runtime problems.
+* Logging::             Recording searches.
+* Common problems::     When things go wrong.
+
+
+File: kpathsea.info,  Node: Bug checklist,  Next: Mailing lists,  Up: Reporting bugs
+
+Bug checklist
+-------------
+
+  Before reporting a bug, please check below to be sure it isn't already
+known (*note Common problems::.).
+
+  Bug reports should be sent via electronic mail to
+<tex-k@mail.tug.org>, or by postal mail to 135 Center Hill Road /
+Plymouth, MA 02360 / USA.
+
+  The general principle is that a good bug report includes all the
+information necessary for reproduction.  Therefore, to enable
+investigation, your report should include the following:
+
+   * The version number(s) of the program(s) involved, and of Kpathsea
+     itself.  You can get the former by giving a sole option `--version'
+     to the program, and the latter by running `kpsewhich --version'.
+     The `NEWS' and `ChangeLog' files also contain the version number.
+
+   * The hardware, operating system (including version number),
+     compiler, and `make' program you are using (the output of `uname
+     -a' is a start on the first two, though often incomplete).  If the
+     bug involves the X window system, include X version and supplier
+     information as well (examples: X11R6 from MIT; X11R4 from HP;
+     OpenWindows 3.3 bundled with SunOS 4.1.4).
+
+   * Any options you gave to `configure'.  This is recorded in the
+     `config.status' files.
+
+     If you are reporting a bug in `configure' itself, it's probably
+     system-dependent, and it will be unlikely the maintainers can do
+     anything useful if you merely report that thus-and-such is broken.
+     Therefore, you need to do some additional work: for some bugs, you
+     can look in the file `config.log' where the test that failed should
+     appear, along with the compiler invocation and source program in
+     question.  You can then compile it yourself by hand, and discover
+     why the test failed.  Other `configure' bugs do not involve the
+     compiler; in that case, the only recourse is to inspect the
+     `configure' shell script itself, or the Autoconf macros that
+     generated `configure'.
+
+   * The log of all debugging output, if the bug is in path searching.
+     You can get this by setting the environment variable
+     `KPATHSEA_DEBUG' to `-1' before running the program.  Please look
+     at the log yourself to make sure the behavior is really a bug
+     before reporting it; perhaps "old" environment variable settings
+     are causing files not to be found, for example.
+
+   * The contents of any input files necessary to reproduce the bug.
+     For bugs in DVI-reading programs, for example, this generally
+     means a DVI file (and any EPS or other files it uses)--TeX source
+     files are helpful, but the DVI file is necessary, because that's
+     the actual program input.
+
+     GNU `shar', available from `ftp://prep.ai.mit.edu/pub/gnu' is a
+     convenient way of packaging multiple (possibly binary) files for
+     electronic mail.  If you feel your input files are too big to send
+     by email, you can ftp them to `ftp://ftp.tug.org/incoming' (that
+     directory is writable, but not readable).
+
+   * If you are sending a patch (do so if you can!), please do so in
+     the form of a context diff (`diff -c') against the original
+     distribution source.  Any other form of diff is either not as
+     complete or harder for me to understand.  Please also include a
+     `ChangeLog' entry.
+
+   * If the bug involved is an actual crash (i.e., core dump), it is
+     easy and useful to include a stack trace from a debugger (I
+     recommend the GNU debugger GDB, available from
+     `ftp://prep.ai.mit.edu/pub/gnu').  If the cause is apparent (a
+     `NULL' value being dereferenced, for example), please send the
+     details along.  If the program involved is TeX or Metafont, and
+     the crash is happening at apparently-sound code, however, the bug
+     may well be in the compiler, rather than in the program or the
+     library (*note TeX or Metafont failing: TeX or Metafont failing.).
+
+   * Any additional information that will be helpful in reproducing,
+     diagnosing, or fixing the bug.
+
+
+File: kpathsea.info,  Node: Mailing lists,  Next: Debugging,  Prev: Bug checklist,  Up: Reporting bugs
+
+Mailing lists
+-------------
+
+  Web2c and Kpathsea in general are discussed on the mailing list
+<tex-k@mail.tug.org>.  To join, email <tex-k-request@mail.tug.org> with
+a line consisting of
+
+     subscribe YOU@YOUR.PREFERRED.EMAIL.ADDRESS
+
+in the body of the message.
+
+  You do not need to join to submit a report, nor will it affect whether
+you get a response.  There is no Usenet newsgroup equivalent (if you can
+be the one to set this up, email `tex-k-request').  Traffic on the list
+is fairly light, and is mainly bug reports and enhancement requests to
+the software.  The best way to decide if you want to join or not is
+read some of the archives from `ftp://ftp.tug.org/mail/archives/tex-k/'.
+
+  Be aware that large data files are sometimes included in bug reports.
+If this is a problem for you, do not join the list.
+
+  If you only want announcements of new releases, not bug reports and
+discussion, join <tex-archive@math.utah.edu> (via mail to
+<tex-archive-request@math.utah.edu>).
+
+  If you are looking for general TeX help, such as how to use LaTeX,
+please use the mailing list <info-tex@shsu.edu> mailing list, which is
+gatewayed to the `comp.text.tex' Usenet newsgroup (or post to the
+newsgroup; the gateway is bidirectional).
+
+
+File: kpathsea.info,  Node: Debugging,  Next: Logging,  Prev: Mailing lists,  Up: Reporting bugs
+
+Debugging
+---------
+
+  Kpathsea provides a number of runtime debugging options, detailed
+below by their names and corresponding numeric values.  When the files
+you expect aren't being found, the thing to do is enable these options
+and examine the output.
+
+  You can set these with some runtime argument (e.g., `-d') to the
+program; in that case, you should use the numeric values described in
+the program's documentation (which, for Dvipsk and Xdvik, are different
+than those below).  It's best to give the `-d' (or whatever) option
+first, for maximal output.  Dvipsk and Xdvik have additional
+program-specific debugging options as well.
+
+  You can also set the environment variable `KPATHSEA_DEBUG'; in this
+case, you should use the numbers below.  Also, if you run the program
+under a debugger and set the variable `kpathsea_debug', Also use the
+numbers below
+
+  In any case, by far the simplest value to use is `-1', which will
+turn on all debugging output.  This is usually better than guessing
+which particular values will yield the output you need.
+
+  Debugging output always goes to standard error, so you can redirect it
+easily.  For example, in Bourne-compatible shells:
+     dvips -d -1 ... 2>/tmp/debug
+
+  It is sometimes helpful to run the standalone Kpsewhich utility
+(*note Invoking kpsewhich::.), instead of the original program.
+
+  In any case, you can *not* use the *names* below; you must always use
+somebody's numbers.  (Sorry.)  To set more than one option, just sum
+the corresponding numbers.
+
+`KPSE_DEBUG_STAT (1)'
+     Report `stat'(2) calls. This is useful for verifying that your
+     directory structure is not forcing Kpathsea to do many additional
+     file tests (*note Slow path searching::., and *note Subdirectory
+     expansion::.). If you are using an up-to-date `ls-R' database
+     (*note Filename database::.), this should produce no output unless
+     a nonexistent file that must exist is searched for.
+
+`KPSE_DEBUG_HASH (2)'
+     Report lookups in all hash tables: `ls-R' and `aliases' (*note
+     Filename database::.); font aliases (*note Fontmap::.); and config
+     file values (*note Config files::.).  Useful when expected values
+     are not being found, e.g.., file searches are looking at the disk
+     instead of using `ls-R'.
+
+`KPSE_DEBUG_FOPEN (4)'
+     Report file openings and closings. Especially useful when your
+     system's file table is full, for seeing which files have been
+     opened but never closed. In case you want to set breakpoints in a
+     debugger: this works by redefining `fopen' (`fclose') to be
+     `kpse_fopen_trace' (`kpse_fclose_trace').
+
+`KPSE_DEBUG_PATHS (8)'
+     Report general path information for each file type Kpathsea is
+     asked to search. This is useful when you are trying to track down
+     how a particular path got defined--from `texmf.cnf', `config.ps',
+     an environment variable, the compile-time default, etc.  This is
+     the contents of the `kpse_format_info_type' structure defined in
+     `tex-file.h'.
+
+`KPSE_DEBUG_EXPAND (16)'
+     Report the directory list corresponding to each path element
+     Kpathsea searches. This is only relevant when Kpathsea searches
+     the disk, since `ls-R' searches don't look through directory lists
+     in this way.
+
+`KPSE_DEBUG_SEARCH (32)'
+     Report on each file search: the name of the file searched for, the
+     path searched in, whether or not the file must exist (when drivers
+     search for `cmr10.vf', it need not exist), and whether or not we
+     are collecting all occurrences of the file in the path (as with,
+     e.g., `texmf.cnf' and `texfonts.map'), or just the first (as with
+     most lookups).  This can help you correlate what Kpathsea is doing
+     with what is in your input file.
+
+  Debugging output from Kpathsea is always written to standard error,
+and begins with the string `kdebug:'. (Except for hash table buckets,
+which just start with the number, but you can only get that output
+running under a debugger. See comments at the `hash_summary_only'
+variable in `kpathsea/db.c'.)
+
+
+File: kpathsea.info,  Node: Logging,  Next: Common problems,  Prev: Debugging,  Up: Reporting bugs
+
+Logging
+-------
+
+  Kpathsea can record the time and filename found for each successful
+search.  This may be useful in finding good candidates for deletion when
+your filesystem is full, or in discovering usage patterns at your site.
+
+  To do this, define the environment or config file variable
+`TEXMFLOG'.  The value is the name of the file to append the
+information to.  The file is created if it doesn't exist, and appended
+to if it does.
+
+  Each successful search turns into one line in the log file: two words
+separated by a space. The first word is the time of the search, as the
+integer number of seconds since "the epoch", i.e., UTC midnight 1
+January 1970 (more precisely, the result of the `time' system call).
+The second word is the filename.
+
+  For example, after `setenv TEXMFLOG /tmp/log', running Dvips on
+`story.dvi' appends the following lines:
+
+     774455887 /usr/local/share/texmf/dvips/config.ps
+     774455887 /usr/local/share/texmf/dvips/psfonts.map
+     774455888 /usr/local/share/texmf/dvips/texc.pro
+     774455888 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmbx10.600pk
+     774455889 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmsl10.600pk
+     774455889 /usr/local/share/texmf/fonts/pk/ljfour/public/cm/cmr10.600pk
+     774455889 /usr/local/share/texmf/dvips/texc.pro
+
+Only filenames that are absolute are recorded, to preserve some
+semblance of privacy.
+
+
+File: kpathsea.info,  Node: Common problems,  Prev: Logging,  Up: Reporting bugs
+
+Common problems
+---------------
+
+  Here are some common problems with configuration, compilation,
+linking, execution, ...
+
+* Menu:
+
+* Unable to find files::        If your program can't find fonts (or whatever).
+* Slow path searching::         If it takes forever to find anything.
+* Unable to generate fonts::    If MakeTeXPK fails.
+* TeX or Metafont failing::     Likely compiler bugs.
+
+* XtStrings::                   When _XtStrings is undefined.
+* dlopen::                      When dlopen is undefined.
+* ShellWidgetClass::            For dynamic linking troubles under OpenWindows.
+* Pointer combination warnings::  For old compilers that don't grok char *.
+
+
+File: kpathsea.info,  Node: Unable to find files,  Next: Slow path searching,  Up: Common problems
+
+Unable to find files
+....................
+
+  If a program complains it cannot find fonts (or other input files),
+any of several things might be wrong.  In any case, you may find the
+debugging options helpful.  *Note Debugging::.
+
+   * Perhaps you simply haven't installed all the necessary files; the
+     basic fonts and input files are distributed separately from the
+     programs.  *Note unixtex.ftp::.
+
+   * You have (perhaps unknowingly) told Kpathsea to use search paths
+     that don't reflect where the files actually are.  One common cause
+     is having environment variables set from a previous installation,
+     thus overriding what you carefully set in `texmf.cnf' (*note
+     Supported file formats::.).  System `/etc/profile' or other files
+     such may be the culprit.
+
+   * Your files reside in a directory that is only pointed to via a
+     symbolic link, in a leaf directory and is not listed in `ls-R'.
+
+     Unfortunately, Kpathsea's subdirectory searching has an
+     irremediable deficiency: If a directory D being searched for
+     subdirectories contains plain files and symbolic links to other
+     directories, but no true subdirectories, D will be considered a
+     leaf directory, i.e., the symbolic links will not be followed.
+     *Note Subdirectory expansion::.
+
+     You can work around this problem by creating an empty dummy
+     subdirectory in D. Then D will no longer be a leaf, and the
+     symlinks will be followed.
+
+     The directory immediately followed by the `//' in the path
+     specification, however, is always searched for subdirectories,
+     even if it is a leaf.  Presumably you would not have asked for the
+     directory to be searched for subdirectories if you didn't want it
+     to be.
+
+   * If the fonts (or whatever) don't already exist, `MakeTeXPK' (or
+     `MakeTeXMF' or `MakeTeXTFM') will try to create them.  If these
+     rather complicated shell scripts fail, you'll eventually get an
+     error message saying something like `Can't find font FONTNAME'.
+     The best solution is to fix (or at least report) the bug in
+     `MakeTeXPK'; the workaround is to generate the necessary fonts by
+     hand with Metafont, or to grab them from a CTAN site (*note
+     unixtex.ftp::.).
+
+   * There is a bug in the library. *Note Reporting bugs::.
+
+
+File: kpathsea.info,  Node: Slow path searching,  Next: Unable to generate fonts,  Prev: Unable to find files,  Up: Common problems
+
+Slow path searching
+...................
+
+  If your program takes an excessively long time to find fonts or other
+input files, but does eventually succeed, here are some possible
+culprits:
+
+   * Most likely, you just have a lot of directories to search, and that
+     takes a noticeable time. The solution is to create and maintain a
+     separate `ls-R' file that lists all the files in your main TeX
+     hierarchy.  *Note Filename database::.  Kpathsea always uses `ls-R'
+     if it's present; there's no need to recompile or reconfigure any
+     of the programs.
+
+   * Your recursively-searched directories (e.g.,
+     `/usr/local/share/texmf/fonts//'), contain a mixture of files and
+     directories. This prevents Kpathsea from using a useful
+     optimization (*note Subdirectory expansion::.).
+
+     It is best to have only directories (and perhaps a `README') in the
+     upper levels of the directory structure, and it's very important
+     to have *only* files, and no subdirectories, in the leaf
+     directories where the dozens of TFM, PK, or whatever files reside.
+
+  In any case, you may find the debugging options helpful in determining
+precisely when the disk or network is being pounded.  *Note Debugging::.
+
+
+File: kpathsea.info,  Node: Unable to generate fonts,  Next: TeX or Metafont failing,  Prev: Slow path searching,  Up: Common problems
+
+Unable to generate fonts
+........................
+
+  This can happen if either `MakeTeXPK' hasn't been installed properly,
+or if the local installation of Metafont isn't correct.
+
+  If `mf' is a command not found by `MakeTeXPK', then you need to
+install Metafont (*note unixtex.ftp::.).
+
+  If Metafont runs, but generates fonts at the wrong resolution, you
+need to be sure the `M' and `D' lines in your Dvips configuration file
+match (*note Config files: (dvips)Config files.).  For example, if
+`MakeTeXPK' is generating 300dpi fonts, but you need 600dpi fonts, you
+should have:
+     M ljfour
+     D 600
+
+  If Metafont runs but generates fonts at a resolution of 2602dpi (and
+prints out the name of each character as well as just a character
+number, and maybe tries to display the characters), then your Metafont
+base file probably hasn't been made properly.  (It's using the default
+`proof' mode, instead of an actual device mode.)  To make a proper
+`plain.base', assuming the local mode definitions are contained in a
+file `modes.mf', run the following command (assuming Unix):
+
+     inimf "plain; input modes; dump"
+
+Then copy the `plain.base' file from the current directory to where the
+base files are stored on your system (`/usr/local/share/texmf/web2c' by
+default), and make a link (either hard or soft) from `plain.base' to
+`mf.base' in that directory.  *Note inimf invocation: (web2c)inimf
+invocation.
+
+
+File: kpathsea.info,  Node: TeX or Metafont failing,  Next: XtStrings,  Prev: Unable to generate fonts,  Up: Common problems
+
+TeX or Metafont failing
+.......................
+
+  If TeX or Metafont get a segmentation fault or otherwise fail while
+running a normal input file, the problem is usually a compiler bug
+(unlikely as that may sound).  Even if the trip and trap tests are
+passed, problems may lurk.  Optimization occasionally causes trouble in
+programs other than TeX and Metafont themselves, too.
+
+  Insufficient swap space may also cause core dumps or other erratic
+behavior.
+
+  For a workaround, if you enabled any optimization flags, it's best to
+omit optimization entirely.  In any case, the way to find the facts is
+to run the program under the debugger and see where it's failing.
+
+  Also, if you have trouble with a system C compiler, I advise trying
+the GNU C compiler. And vice versa, unfortunately; but in that case I
+also recommend reporting a bug to the GCC mailing list; *note Bugs:
+(gcc)Bugs..
+
+  To report compiler bugs effectively requires perseverance and
+perspicacity: you must find the miscompiled line, and that usually
+involves delving backwards in time from the point of error, checking
+through TeX's (or whatever program's) data structures.  Things are not
+helped by all-too-common bugs in the debugger itself.  Good luck.
+
+
+File: kpathsea.info,  Node: XtStrings,  Next: dlopen,  Prev: TeX or Metafont failing,  Up: Common problems
+
+`XtStrings'
+...........
+
+  You may find that linking X programs results in an error from the
+linker that `XtStrings' is undefined, something like this:
+
+     gcc -o virmf ...
+     .../x11.c:130: undefined reference to `XtStrings'
+
+  This generally happens because of a mismatch between the X include
+files with which you compiled and the X libraries with which you linked;
+often, the include files are from MIT and the libraries from Sun.
+
+  The solution is to use the same X distribution for compilation and
+linking.  Probably `configure' was unable to guess the proper
+directories from your installation.  You can use the `configure'
+options `--x-includes=PATH' and `--x-libraries=PATH' to explicitly
+specify them.
+
+
+File: kpathsea.info,  Node: dlopen,  Next: ShellWidgetClass,  Prev: XtStrings,  Up: Common problems
+
+`dlopen'
+........
+
+  (This section adapted from the file `dlsym.c' in the X distribution.)
+
+  The `Xlib' library uses the standard C function `wcstombs'.  Under
+SunOS 4.1, `wcstombs' uses the `dlsym' interface defined in `libdl.so'.
+Unfortunately, the SunOS 4.1 distribution does not include a static
+`libdl.a' library.
+
+  As a result, if you try to link an X program statically under SunOS,
+you may get undefined references to `dlopen', `dlsym', and `dlclose'.
+One workaround is to include these definitions when you link:
+
+     void *dlopen() { return 0; }
+     void *dlsym()  { return 0; }
+     int dlclose()  { return -1; }
+
+These are contained in the `dlsym.c' file in the MIT X distribution.
+
+
+File: kpathsea.info,  Node: ShellWidgetClass,  Next: Pointer combination warnings,  Prev: dlopen,  Up: Common problems
+
+`ShellWidgetClass'
+..................
+
+  (This section adapted from the comp.sys.sun.admin FAQ.)
+
+  If you are linking with Sun's OpenWindows libraries in SunOS 4.1.x,
+you may get undefined symbols `_get_wmShellWidgetClass' and
+`_get_applicationShellWidgetClass' when linking. This problem does not
+arise using the standard MIT X libraries under SunOS.
+
+  The cause is bugs in the `Xmu' shared library as shipped from Sun.
+There are several fixes:
+
+   * Install the free MIT distribution from `ftp.x.org' and mirrors.
+
+   * Get the OpenWindows patches listed below.
+
+   * Statically link the `Xmu' library into the executable.
+
+   * Avoid using `Xmu' at all. If you are compiling Metafont, *note
+     Online Metafont graphics: (web2c)Online Metafont graphics.. If you
+     are compiling Xdvi, see the `-DNOTOOL' option in `xdvik/INSTALL'.
+
+   * Ignore the errors. The binary runs fine regardless.
+
+  Here is the information for getting the two patches:
+
+     Patch ID: 100512-02
+     Bug ID's: 1086793, 1086912, 1074766
+     Description: 4.1.x OpenWindows 3.0 `libXt' jumbo patch
+     
+     Patch ID: 100573-03
+     Bug ID: 1087332
+     Description: 4.1.x OpenWindows 3.0 undefined symbols when using shared `libXmu'.
+
+  The way to statically link with `libXmu' depends on whether you are
+using a Sun compiler (e.g., `cc') or `gcc'. If the latter, alter the
+`x_libs' Make variable to include
+
+     -static -lXmu -dynamic
+
+  If you are using the Sun compiler, use `-Bstatic' and `-Bdynamic'.
+
+
+File: kpathsea.info,  Node: Pointer combination warnings,  Prev: ShellWidgetClass,  Up: Common problems
+
+Pointer combination warnings
+............................
+
+  When compiling with old C compilers, you may get some warnings about
+"illegal pointer combinations".  These are spurious; just ignore them.
+I decline to clutter up the source with casts to get rid of them.
+
+
+File: kpathsea.info,  Node: Path searching,  Next: TeX support,  Prev: Installation,  Up: Top
+
+Path searching
+**************
+
+  This chapter describes the generic path searching mechanism Kpathsea
+provides.  For information about searching for particular file types
+(e.g., TeX fonts), see the next chapter.
+
+* Menu:
+
+* Searching overview::          Basic scheme for searching.
+* Path sources::                Where search paths can be defined.
+* Path expansion::              Special constructs in search paths.
+* Filename database::           Using an externally-built list to search.
+* Invoking kpsewhich::          Standalone path lookup.
+
+
+File: kpathsea.info,  Node: Searching overview,  Next: Path sources,  Up: Path searching
+
+Searching overview
+==================
+
+  A "search path" is a colon-separated list of "path elements", which
+are directory names with a few extra frills.  A search path can come
+from (a combination of) many sources; see below.  To look up a file
+`foo' along a path `.:/dir', Kpathsea checks each element of the path
+in turn: first `./foo', then `/dir/foo', returning the first match (or
+possibly all matches).
+
+  The "colon" and "slash" mentioned here aren't necessarily `:' and `/'
+on non-Unix systems.  Kpathsea tries to adapt to other operating
+systems' conventions.
+
+  To check a particular path element E, Kpathsea first sees if a
+prebuilt database (*note Filename database::.) applies to E, i.e., if
+the database is in a directory that is a prefix of E.  If so, the path
+specification is matched against the contents of the database.
+
+  If the database does not exist, or does not apply to this path
+element, or contains no matches, the filesystem is searched (if this
+was not forbidden by the specification with `!!' and if the file being
+searched for must exist).  Kpathsea constructs the list of directories
+that correspond to this path element, and then checks in each for the
+file being searched for.  (To help speed future lookups of files in the
+same directory, the directory in which a file is found is floated to the
+top of the directory list.)
+
+  The "file must exist" condition comes into play with VF files and
+input files read by the TeX `\openin' command.  These files may not
+exist (consider `cmr10.vf'), and so it would be wrong to search the
+disk for them.  Therefore, if you fail to update `ls-R' when you
+install a new VF file, it will never be found.
+
+  Each path element is checked in turn: first the database, then the
+disk.  If a match is found, the search stops and the result is
+returned.  This avoids possibly-expensive processing of path
+specifications that are never needed on a particular run.  (Unless the
+search explicitly requested all matches.)
+
+  Although the simplest and most common path element is a directory
+name, Kpathsea supports additional features in search paths: layered
+default values, environment variable names, config file values, users'
+home directories, and recursive subdirectory searching.  Thus, we say
+that Kpathsea "expands" a path element, meaning transforming all thel
+magic specifications into the basic directory name or names.  This
+process is described in the sections below.  It happens in the same
+order as the sections.
+
+  Exception to all of the above: If the filename being searched for is
+absolute or explicitly relative, i.e., starts with `/' or `./' or
+`../', Kpathsea simply checks if that file exists.
+
+  Ordinarily, if Kpathsea tries to access a file or directory that
+cannot be read, it gives a warning.  This is so you will be alerted to
+directories or files that accidentally lack read permission (for
+example, a `lost+found').  If you prefer not to see these warnings,
+include the value `readable' in the `TEX_HUSH' environment variable or
+config file value.
+
+  This generic path searching algorithm is implemented in
+`kpathsea/pathsearch.c'.  It is employed by a higher-level algorithm
+when searching for a file of a particular type (*note File lookup::.,
+and *Note Glyph lookup::).
+
+
+File: kpathsea.info,  Node: Path sources,  Next: Path expansion,  Prev: Searching overview,  Up: Path searching
+
+Path sources
+============
+
+  A search path can come from many sources.  In the order in which
+Kpathsea uses them:
+
+  1. A user-set environment variable, e.g., `TEXINPUTS'.  Environment
+     variables with an underscore and the program name appended
+     override; for example, `TEXINPUTS_latex' overrides `TEXINPUTS' if
+     the program being run is named `latex'.
+
+  2. A program-specific configuration file, e.g., an `S /a:/b' line in
+     Dvips' `config.ps' (*note Config files: (dvips)Config files.).
+
+  3. A line in a Kpathsea configuration file `texmf.cnf', e.g.,
+     `TEXINPUTS=/c:/d' (see below).
+
+  4. The compile-time default (specified in `kpathsea/paths.h').
+
+  You can see each of these values for a given search path by using the
+debugging options (*note Debugging::.).
+
+  These sources may be combined via default expansion (*note Default
+expansion::.).
+
+* Menu:
+
+* Config files::        Kpathsea's runtime config files (texmf.cnf).
+
+
+File: kpathsea.info,  Node: Config files,  Up: Path sources
+
+Config files
+------------
+
+  As mentioned above, Kpathsea reads "runtime configuration files"
+named `texmf.cnf' for search path and other definitions.  The search
+path used to look for these configuration files is named `TEXMFCNF',
+and is constructed in the usual way, as described above, except that
+configuration files cannot be used to define the path, naturally; also,
+an `ls-R' database is not used to search for them.
+
+  Kpathsea reads *all* `texmf.cnf' files in the search path, not just
+the first one found; definitions in earlier files override those in
+later files.  Thus, with the search path of `.:$TEXMF', values from
+`./texmf.cnf' override those from `$TEXMF/texmf.cnf'.
+
+  While (or instead of) reading this description, you may find it
+helpful to look at the distributed `texmf.cnf', which uses or at least
+mentions most features.  The format of `texmf.cnf' files follows:
+
+   * Comments start with `%' and continue to the end of the line.
+
+   * Blank lines are ignored.
+
+   * A `\' at the end of a line acts as a continuation character, i.e.,
+     the next line is appended.  Whitespace at the beginning of
+     continuation lines is not ignored.
+
+   * Each remaining line must look like
+
+          VARIABLE [. PROGNAME] [=] VALUE
+
+     where the `=' and surrounding whitespace is optional.
+
+   * The VARIABLE name may contain any character other than whitespace,
+     `=', or `.', but sticking to `A-Za-z_' is safest.
+
+   * If `.PROGNAME' is present, the definition only applies if the
+     program that is running is named (i.e., the last component of
+     `argv[0]' is) PROGNAME or `PROGNAME.exe'.  This allows different
+     flavors of TeX to have different search paths, for example.
+
+   * VALUE may contain any characters except `%' and `@'.  (These
+     restrictions are only necessary because of the processing done on
+     `texmf.cnf' at build time, so you can stick those characters in
+     after installation if you have to.)  The `$VAR.PROG' feature is
+     not available on the right-hand side; instead, you must use an
+     additional variable (see below for example).  A `;' in VALUE is
+     translated to `:' if running under Unix; this is useful to write a
+     single `texmf.cnf' which can be used under both Unix and NT.  (If
+     you really want `;''s in your filenames, add
+     `-DALLOW_SEMICOLON_IN_FILENAMES' to `CFLAGS'.)
+
+   * All definitions are read before anything is expanded, so you can
+     use variables before they are defined (like Make, unlike most other
+     programs).
+
+Here is a configuration file fragment illustrating most of these points:
+
+     % TeX input files -- i.e., anything to be found by \input or \openin ...
+     latex209_inputs = .:$TEXMF/tex/latex209//:$TEXMF/tex//
+     latex2e_inputs = .:$TEXMF/tex/latex//:$TEXMF/tex//
+     TEXINPUTS = .:$TEXMF/tex//
+     TEXINPUTS.latex209 = $latex209_inputs
+     TEXINPUTS.latex2e = $latex2e_inputs
+     TEXINPUTS.latex = $latex2e_inputs
+
+  Although this format has obvious similarities to Bourne shell
+scripts--change the comment character to `#', disallow spaces around
+the `=', and get rid of the `.NAME' convention, and it could be run
+through the shell.  But there seemed little advantage to doing this,
+since all the information would have to passed back to Kpathsea and
+parsed there anyway, since the `sh' process couldn't affect its
+parent's environment.
+
+  The implementation of all this is in `kpathsea/cnf.c'.
+
+
+File: kpathsea.info,  Node: Path expansion,  Next: Filename database,  Prev: Path sources,  Up: Path searching
+
+Path expansion
+==============
+
+  Kpathsea recognizes certain special characters and constructions in
+search paths, similar to that in shells.  As a general example:
+`~$USER/{foo,bar}//baz' expands to all subdirectories under directories
+`foo' and `bar' in $USER's home directory that contain a directory or
+file `baz'.  These expansions are explained in the sections below.
+
+* Menu:
+
+* Default expansion::           a: or :a or a::b expands to a default.
+* Variable expansion::          $foo and ${foo} expand to environment values.
+* Tilde expansion::             ~ and ~user expand to home directories.
+* Brace expansion::             a{foo,bar}b expands to afoob abarb.
+* Subdirectory expansion::      a// and a//b recursively expand to subdirs.
+
+
+File: kpathsea.info,  Node: Default expansion,  Next: Variable expansion,  Up: Path expansion
+
+Default expansion
+-----------------
+
+  If the highest-priority search path (*note Path sources::.) contains
+an "extra colon" (i.e., leading, trailing, or doubled), Kpathsea
+inserts at that point the next-highest-priority search path that is
+defined.  If that inserted path has an extra colon, the same happens
+with the next-highest.  (An extra colon in the compile-time default
+value has unpredictable results, so installers beware.)
+
+  For example, given an environment variable setting
+
+     setenv TEXINPUTS /home/karl:
+
+and a `TEXINPUTS' value from `texmf.cnf' of
+
+     .:$TEXMF//tex
+
+then the final value used for searching will be:
+
+     /home/karl:.:$TEXMF//tex
+
+  Since Kpathsea looks for multiple configuration files, it would be
+natural to expect that (for example) an extra colon in `./texmf.cnf'
+would expand to the path in `$TEXMF/texmf.cnf'.  Or, with Dvips'
+configuration files, that an extra colon in `config.$PRINTER' would
+expand to the path in `config.ps'.  This doesn't happen.  It's not
+clear this would be desirable in all cases, and trying to devise a way
+to specify the path to which the extra colon should expand seemed truly
+baroque.
+
+  Technicality: Since it would be useless to insert the default value in
+more than one place, Kpathsea changes only one extra `:' and leaves any
+others in place (where they will eventually be equivalent to `.', i.e.,
+the current directory).  Kpathsea checks first for a leading `:', then
+a trailing `:', then a doubled `:'.
+
+  You can trace this by debugging "paths" (*note Debugging::.).
+Default expansion is implemented in the source file
+`kpathsea/kdefault.c'.
+
+
+File: kpathsea.info,  Node: Variable expansion,  Next: Tilde expansion,  Prev: Default expansion,  Up: Path expansion
+
+Variable expansion
+------------------
+
+  `$foo' or `${foo}' in a path element is replaced by (1) the value of
+an environment variable `foo' (if defined); (2) the value of `foo' from
+`texmf.cnf' (if defined); (3) the empty string.
+
+  If the character after the `$' is alphanumeric or `_', the variable
+name consists of all consecutive such characters. If the character
+after the `$' is a `{', the variable name consists of everything up to
+the next `}' (braces may not be nested).  Otherwise, Kpathsea gives a
+warning and ignores the `$' and its following character.
+
+  You must quote the $'s and braces as necessary for your shell.
+*Shell* variable values cannot be seen by Kpathsea, i.e., ones defined
+by `set' in C shells and without `export' in Bourne shells.
+
+  For example, given
+     setenv tex /home/texmf
+     setenv TEXINPUTS .:$tex:${tex}prev
+   the final `TEXINPUTS' path is the three directories:
+     .:/home/texmf:/home/texmfprev
+
+  The `.PROGNAME' suffix on variables and `_PROGNAME' on environment
+variable names are not implemented for general variable expansions.
+These are only recognized when search paths are initialized (*note Path
+sources::.).
+
+  Variable expansion is implemented in the source file
+`kpathsea/variable.c'.
+
+
+File: kpathsea.info,  Node: Tilde expansion,  Next: Brace expansion,  Prev: Variable expansion,  Up: Path expansion
+
+Tilde expansion
+---------------
+
+  A leading `~' in a path element is replaced by the value of the
+environment variable `HOME', or `.' if `HOME' is not set.
+
+  A leading `~USER' in a path element is replaced by USER's home
+directory from the system `passwd' database.
+
+  For example,
+     setenv TEXINPUTS ~/mymacros:
+
+will prepend a directory `mymacros' in your home directory to the
+default path.
+
+  As a special case, if a home directory ends in `/', the trailing
+slash is dropped, to avoid inadvertently creating a `//' construct in
+the path.  For example, if the home directory of the user `root' is
+`/', the path element `~root/mymacros' expands to just `/mymacros', not
+`//mymacros'.
+
+  Tilde expansion is implemented in the source file `kpathsea/tilde.c'.
+
+
+File: kpathsea.info,  Node: Brace expansion,  Next: Subdirectory expansion,  Prev: Tilde expansion,  Up: Path expansion
+
+Brace expansion
+---------------
+
+  `x{A,B}y' expands to `xAy:xBy'.  For example:
+
+     foo/{1,2}/baz
+
+expands to `foo1baz:foo2baz'.  `:' is the path separator on the current
+system; e.g., on a DOS system, it's `;'.
+
+  Braces can be nested; for example, `x{a,b{1,2}}y' expands to
+`xay:xb1y:xb2y'.
+
+  This feature can be used to implement multiple TeX hierarchies, by
+assigning a brace list to `$TEXMF', as mentioned in `texmf.cnf.in'.
+
+  Brace expansion is implemented in the source file
+`kpathsea/expand.c'.  It is taken from Bash, and is thus covered by the
+GNU General Public License, rather than the Library General Public
+License that covers the rest of Kpathsea.
+
+
+File: kpathsea.info,  Node: Subdirectory expansion,  Prev: Brace expansion,  Up: Path expansion
+
+Subdirectory expansion
+----------------------
+
+  Two or more consecutive slashes in a path element following a
+directory D is replaced by all subdirectories of D: first those
+subdirectories directly under D, then the subsubdirectories under
+those, and so on.  At each level, the order in which the directories are
+searched is unspecified.  (It's "directory order", and definitely not
+alphabetical.)
+
+  If you specify any filename components after the `//', only
+subdirectories which match those components are included.  For example,
+`/a//b' would expand into directories `/a/1/b', `/a/2/b', `/a/1/1/b',
+and so on, but not `/a/b/c' or `/a/1'.
+
+  You can include multiple `//' constructs in the path.
+
+  `//' at the beginning of a path is ignored; you didn't really want to
+search every directory on the system, did you?
+
+  I should mention one related implementation trick, which I took from
+GNU find.  Matthew Farwell suggested it, and David MacKenzie
+implemented it.
+
+  The trick is that in every real Unix implementation (as opposed to the
+POSIX specification), a directory which contains no subdirectories will
+have exactly two links (namely, one for `.' and one for `..').  That is
+to say, the `st_nlink' field in the `stat' structure will be two.
+Thus, we don't have to stat everything in the bottom-level (leaf)
+directories--we can just check `st_nlink', notice it's two, and do no
+more work.
+
+  But if you have a directory that contains a single subdirectory and
+500 regular files, `st_nlink' will be 3, and Kpathsea has to stat every
+one of those 501 entries.  Therein lies slowness.
+
+  You can disable the trick by undefining `UNIX_ST_LINK' in
+`kpathsea/config.h'. (It is undefined by default except under Unix.)
+
+  Unfortunately, in some cases files in leaf directories are `stat''d:
+if the path specification is, say, `$TEXMF/fonts//pk//', then files in
+a subdirectory `.../pk', even if it is a leaf, are checked. The reason
+cannot be explained without reference to the implementation, so read
+`kpathsea/elt-dirs.c' (search for `may descend') if you are curious.
+And if you can find a way to *solve* the problem, please let me know.
+
+  Subdirectory expansion is implemented in the source file
+`kpathsea/elt-dirs.c'.
+
+
+File: kpathsea.info,  Node: Filename database,  Next: Invoking kpsewhich,  Prev: Path expansion,  Up: Path searching
+
+Filename database (`ls-R')
+==========================
+
+  Kpathsea goes to some lengths to minimize disk accesses for searches
+(*note Subdirectory expansion::.).  Nevertheless, at installations with
+enough directories, searching each possible directory for a given file
+can take an excessively long time (depending on the speed of the disk,
+whether it's NFS-mounted, how patient you are, etc.).
+
+  In practice, a font tree containing the standard PostScript and PCL
+fonts is large enough for searching to be noticeably slow on typical
+systems these days.  Therefore, Kpathsea can use an externally-built
+"database" file named `ls-R' that maps files to directories, thus
+avoiding the need to exhaustively search the disk.
+
+  A second database file `aliases' allows you to give additional names
+to the files listed in `ls-R'.  This can be helpful to adapt to "8.3"
+filename conventions in source files.
+
+  The `ls-R' and `aliases' features are implemented in the source file
+`kpathsea/db.c'.
+
+* Menu:
+
+* ls-R::                        The main filename database.
+* Filename aliases::            Aliases for those names.
+* Database format::             Syntax details of the database file.
+
+
+File: kpathsea.info,  Node: ls-R,  Next: Filename aliases,  Up: Filename database
+
+`ls-R'
+------
+
+  As mentioned above, you must name the main filename database `ls-R'.
+You can put one at the root of each TeX installation hierarchy you wish
+to search (`$TEXMF' by default); most sites have only one hierarchy.
+Kpathsea looks for `ls-R' files along the `TEXMFDBS' path, so that
+should presumably match the list of hierarchies.
+
+  The recommended way to create and maintain `ls-R' is to run the
+`MakeTeXls-R' script, which is installed in `$(bindir)'
+(`/usr/local/bin' by default).  That script goes to some trouble to
+follow symbolic links as necessary, etc.  It's also invoked by the
+distributed `MakeTeX...' scripts.
+
+  At its simplest, though, you can build `ls-R' with the command
+     cd /YOUR/TEXMF/ROOT && ls -LAR ./ >ls-R
+
+presuming your `ls' produces the right output format (see the section
+below).  GNU `ls', for example, outputs in this format.  Also presuming
+your `ls' hasn't been aliased in a system file (e.g., `/etc/profile')
+to something problematic, e.g., `ls --color=tty'.  In that case, you
+will have to disable the alias before generating `ls-R'.  For the
+precise definition of the file format, *note Database format::..
+
+  Regardless of whether you use the supplied script or your own, you
+will almost certainly want to invoke it via `cron', so when you make
+changes in the installed files (say if you install a new LaTeX
+package), `ls-R' will be automatically updated.
+
+  The `-A' option to `ls' includes files beginning with `.' (except for
+`.' and `..'), such as the file `.tex' included with the LaTeX tools
+package.  (On the other hand, *directories* whose names begin with `.'
+are always ignored.)
+
+  If your system does not support symbolic links, omit the `-L'.
+
+  `ls -LAR /YOUR/TEXMF/ROOT' will also work.  But using `./' avoids
+embedding absolute pathnames, so the hierarchy can be easily
+transported.  It also avoids possible trouble with automounters or
+other network filesystem conventions.
+
+  Kpathsea warns you if it finds an `ls-R' file, but the file does not
+contain any usable entries.  The usual culprit is running plain `ls -R'
+instead of `ls -LR ./' or `ls -R /YOUR/TEXMF/ROOT'.  Another
+possibility is some system directory name starting with a `.' (perhaps
+if you are using AFS); Kpathsea ignores everything under such
+directories.
+
+  Because the database may be out-of-date for a particular run, if a
+file is not found in the database, by default Kpathsea goes ahead and
+searches the disk. If a particular path element begins with `!!',
+however, *only* the database will be searched for that element, never
+the disk.  If the database does not exist, nothing will be searched.
+Because this can surprise users ("I see the font `foo.tfm' when I do an
+`ls'; why can't Dvips find it?"), it is not in any of the default
+search paths.
+
+
+File: kpathsea.info,  Node: Filename aliases,  Next: Database format,  Prev: ls-R,  Up: Filename database
+
+Filename aliases
+----------------
+
+  In some circumstances, you may wish to find a file under several
+names.  For example, suppose a TeX document was created using a DOS
+system and tries to read `longtabl.sty'.  But now it's being run on a
+Unix system, and the file has its original name, `longtable.sty'.  The
+file won't be found.  You need to give the actual file `longtable.sty'
+an alias `longtabl.sty'.
+
+  You can handle this by creating a file `aliases' as a companion to
+the `ls-R' for the hierarchy containing the file in question.  (You
+must have an `ls-R' for the alias feature to work.)
+
+  The format of `aliases' is simple: two whitespace-separated words per
+line; the first is the real name `longtable.sty', and second is the
+alias (`longtabl.sty').  These must be base filenames, with no
+directory components.  `longtable.sty' must be in the sibling `ls-R'.
+
+  Also, blank lines and lines starting with `%' or `#' are ignored in
+`aliases', to allow for comments.
+
+  If a real file `longtabl.sty' exists, it is used regardless of any
+aliases.
+
+
+File: kpathsea.info,  Node: Database format,  Prev: Filename aliases,  Up: Filename database
+
+Database format
+---------------
+
+  The "database" read by Kpathsea is a line-oriented file of plain
+text. The format is that generated by GNU (and most other) `ls'
+programs given the `-R' option, as follows.
+
+   * Blank lines are ignored.
+
+   * If a line begins with `/' or `./' or `../' and ends with a colon,
+     it's the name of a directory.  (`../' lines aren't useful,
+     however, and should not be generated.)
+
+   * All other lines define entries in the most recently seen directory.
+     /'s in such lines will produce possibly-strange results.
+
+   * Files with no preceding directory line are ignored.
+
+  For example, here's the first few lines of `ls-R' (which totals about
+30K bytes) on my system:
+
+     bibtex
+     dvips
+     fonts
+     ls-R
+     metafont
+     metapost
+     tex
+     web2c
+     
+     ./bibtex:
+     bib
+     bst
+     doc
+     
+     ./bibtex/bib:
+     asi.bib
+     btxdoc.bib
+     ...
+
+
+File: kpathsea.info,  Node: Invoking kpsewhich,  Prev: Filename database,  Up: Path searching
+
+`kpsewhich': Standalone path searching
+======================================
+
+  The Kpsewhich program exercises the path searching functionality
+independent of any particular application.  This can also be useful as a
+sort of `find' program to locate files in your TeX hierarchies, perhaps
+in administrative scripts.  It is used heavily in the distributed
+`MakeTeX...' scripts.
+
+  Synopsis:
+     kpsewhich OPTION... FILENAME...
+
+  The options and filename(s) to look up can be intermixed.  Options
+can start with either `-' or `--', and any unambiguous abbreviation is
+accepted.
+
+* Menu:
+
+* Path searching options::      Changing the mode, resolution, etc.
+* Auxiliary tasks::             Path and variable expansion.
+* Standard options::            -help and -version.
+
+
+File: kpathsea.info,  Node: Path searching options,  Next: Auxiliary tasks,  Up: Invoking kpsewhich
+
+Path searching options
+----------------------
+
+  Kpsewhich looks up each non-option argument on the command line as a
+filename, and returns the first file found.  There is no option to
+return all the files with a particular name (you can run the Unix
+`find' utility for that, *note Invoking find: (findutils)Invoking
+find.).
+
+  Various options alter the path searching behavior:
+
+`--dpi=NUM'
+     Set the resolution to NUM; this only affects `gf' and `pk'
+     lookups.  `-D' is a synonym, for compatibility with Dvips.
+     Default is 600.
+
+`--format=NAME'
+     Set the format for lookup to NAME.  By default, the format is
+     guessed from the filename.  In fact, the recognized filename
+     extensions and the allowable NAMEs (including any leading `.') are
+     the same.
+
+     You can also specify an integer for NAME; this is the only way to
+     specify formats that don't have an associated suffix, such as
+     MetaPost support files and Dvips configuration files.  It's also
+     somewhat faster, since no unused formats need to be initialized.
+     The integers appear in the output of `--help', and are of course
+     subject to change.
+
+     Here's the current list of recognized names and numbers.  *Note
+     Supported file formats::, for more information on each of these.
+          gf(0)
+          pk(1)
+          bitmap font (2)
+          .afm(3)
+          .base(4)
+          .bib(5)
+          .bst(6)
+          .cnf(7)
+          ls-R(8)
+          .fmt(9)
+          .map(10)
+          .mem(11)
+          .mf(12)
+          .pool(13)
+          .mft(14)
+          .mp(15)
+          .pool(16)
+          MetaPost support (17)
+          .ocp(18)
+          .ofm(19)
+          .opl(20)
+          .otp(21)
+          .ovf(22)
+          .ovp(23)
+          graphic/figure (24) .eps .epsi
+          .tex(25) .ltx .dtx .texi .texinfo .txi .eps .epsi
+          TeX documentation (26)
+          .pool(27)
+          TeX sources (28)
+          PostScript header/font (29) .pro
+          Troff fonts (30)
+          .tfm(31)
+          .pfa(32) .pfb
+          .vf(33)
+          dvips config (34)
+          .ist(35)
+
+     This option and `--path' are mutually exclusive.
+
+`--interactive'
+     After processing the command line, read additional filenames to
+     look up from standard input.
+
+`-maketex=FILETYPE'
+`-no-maketex=FILETYPE'
+     Turn on or off the `MakeTeX' script associated with FILETYPE.  The
+     only values that make sense for FILETYPE are `pk', `mf', `tex',
+     and `tfm'. By default, all are off in Kpsewhich.  *Note MakeTeX
+     scripts::.
+
+`--mode=STRING'
+     Set the mode name to STRING; this also only affects `gf' and `pk'
+     lookups.  No default: any mode will be found.  *Note MakeTeX
+     script arguments::.
+
+`--must-exist'
+     Do everything possible to find the files, notably including
+     searching the disk.  By default, only the `ls-R' database is
+     checked, in the interest of efficiency.
+
+`--path=STRING'
+     Search along the path STRING (colon-separated as usual), instead
+     of guessing the search path from the filename.  `//' and all the
+     usual expansions are supported (*note Path expansion::.).  This
+     option and `--format' are mutually exclusive.  To output the
+     complete directory expansion of a path, instead of doing a
+     one-shot lookup, see `--path-expand' in the following section.
+
+`--progname=NAME'
+     Set the program name to NAME; default is `kpsewhich'.  This can
+     affect the search paths via the `.PROGNAM' feature in
+     configuration files (*note Config files::.).
+
+
+File: kpathsea.info,  Node: Auxiliary tasks,  Next: Standard options,  Prev: Path searching options,  Up: Invoking kpsewhich
+
+Auxiliary tasks
+---------------
+
+  Kpsewhich provides some additional features not strictly related to
+path lookup:
+
+   * `--debug=NUM' sets the debugging options to NUM.  *Note
+     Debugging::.
+
+   * `--expand-var=STRING' outputs the variable expansion of STRING.
+     For example, the `MakeTeX...' scripts run `kpsewhich
+     --expand-var='$TEXMF'' to find the root of the TeX system
+     hierarchy.  *Note Path expansion::.
+
+   * `--expand-path=STRING' outputs the complete expansion of STRING as
+     a colon-separated path.  This is useful to construct a search path
+     for a program that doesn't accept recursive subdirectory
+     specifications.  The option `--separator=STRING' changes the
+     separator in the output from `:' to STRING.
+
+     For one-shot uses of an arbitrary (not built in to Kpathsea) path,
+     see `--path' in the previous section.
+
+   * `--show-path=NAME' shows the path that would be used for file
+     lookups of file type NAME.  Either a filename extension (`pk',
+     `.vf', etc.) or an integer can be used, just as with `--format',
+     described in the previous section.
+
+
+File: kpathsea.info,  Node: Standard options,  Prev: Auxiliary tasks,  Up: Invoking kpsewhich
+
+Standard options
+----------------
+
+  Kpsewhich accepts the standard GNU options:
+
+   * `--help' prints a help message on standard output and exits.
+
+   * `--version' prints the Kpathsea version number and exits.
+
+
+File: kpathsea.info,  Node: TeX support,  Next: Programming,  Prev: Path searching,  Up: Top
+
+TeX support
+***********
+
+  Although the basic features in Kpathsea can be used for any type of
+path searching, it came about (like all libraries) with a specific
+application in mind: I wrote Kpathsea specifically for TeX system
+programs.  I had been struggling with the programs I was using (Dvips,
+Xdvi, and TeX itself) having slightly different notions of how to
+specify paths; and debugging was painful, since no code was shared.
+
+  Therefore, Kpathsea provides some TeX-specific formats and features.
+Indeed, many of the supposedly generic path searching features were
+provided because they seemed useful in that conTeXt (font lookup,
+particularly).
+
+  Kpathsea provides a standard way to search for files of any of the
+supported file types; glyph fonts are a bit different than all the rest.
+Searches are based solely on filenames, not file contents--if a GF file
+is named `cmr10.600pk', it will be found as a PK file.
+
+* Menu:
+
+* Supported file formats::      File types Kpathsea knows about.
+* File lookup::                 Searching for most kinds of files.
+* Glyph lookup::                Searching for bitmap fonts.
+* Suppressing warnings::        Avoiding warnings via TEX_HUSH.
+
+
+File: kpathsea.info,  Node: Supported file formats,  Next: File lookup,  Up: TeX support
+
+Supported file formats
+======================
+
+  Kpathsea has support for a number of file types.  Each file type has a
+list of environment and config file variables that are checked to define
+the search path, and most have a default suffix that plays a role in
+finding files (see the next section).  Some also define additional
+suffixes, and/or a program to be run to create missing files on the fly.
+
+  Since environment variables containing periods, such as
+`TEXINPUTS.latex', are not allowed on some systems, Kpathsea looks for
+environment variables with an underscore, e.g., `TEXINPUTS_latex'
+(*note Config files::.).
+
+  The following table lists the above information.
+
+`.afm'
+     (Adobe font metrics, *note Metric files: (dvips)Metric files.)
+     `AFMFONTS'.
+
+`.base'
+     (Metafont memory dump, *note Memory dumps: (web2c)Memory dumps.)
+     `MFBASES', `TEXMFINI'.
+
+`.bib'
+     (BibTeX bibliography source, *note bibtex invocation:
+     (web2c)bibtex invocation.) `BIBINPUTS', `TEXBIB'.
+
+`.bst'
+     (BibTeX style file, *note Basic BibTeX style files: (web2c)Basic
+     BibTeX style files.) `BSTINPUTS'.
+
+`.cnf'
+     (Runtime configuration files, *note Config files::.) `TEXMFCNF'.
+
+`ls-R'
+     (Filename databases, *note Filename database::.) `TEXMFDBS'.
+
+`.fmt'
+     (TeX memory dump, *note Memory dumps: (web2c)Memory dumps.)
+     `TEXFORMATS', `TEXMFINI'.
+
+`gf'
+     (generic font bitmap, *note Glyph files: (dvips)Glyph files.)
+     `PROGRAMFONTS', `GFFONTS', `GLYPHFONTS', `TEXFONTS'.
+
+`.map'
+     (Fontmaps, *note Fontmap::.) `TEXFONTMAPS'.
+
+`.ist'
+     (makeindex style files) `TEXINDEXSTYLE', `INDEXSTYLE'.
+
+`.mem'
+     (MetaPost memory dump, *note Memory dumps: (web2c)Memory dumps.)
+     `MPMEMS', `TEXMFINI'.
+
+`.mf'
+     (Metafont source, *note mf invocation: (web2c)mf invocation.)
+     `MFINPUTS'; dynamic creation program: `MakeTeXMF'.
+
+`.mft'
+     (`MFT' style file, *note mft invocation: (web2c)mft invocation.)
+     `MFTINPUTS'.
+
+`mf.pool'
+     (Metafont program strings, *note pooltype invocation:
+     (web2c)pooltype invocation.) `MFPOOL', `TEXMFINI'.
+
+`.mp'
+     (MetaPost source, *note mpost invocation: (web2c)mpost invocation.)
+     `MPINPUTS'.
+
+`mp.pool'
+     (MetaPost program strings, *note pooltype invocation:
+     (web2c)pooltype invocation.) `MPPOOL', `TEXMFINI'.
+
+`(none)'
+     (MetaPost support files, used by DMP; *note dmp invocation:
+     (web2c)dmp invocation.) `MPSUPPORT'.
+
+`.ocp'
+     (Omega compiled process files) `OCPINPUTS';
+     dynamic creation program: `MakeOmegaOCP'.
+
+`.ofm'
+     (Omega font metrics) `OFMFONTS', `TEXFONTS';
+     dynamic creation program: `MakeOmegaOFM'.
+
+`.opl'
+     (Omega property lists) `OPLFONTS', `TEXFONTS'.
+
+`.otp'
+     (Omega translation process files) `OTPINPUTS'.
+
+`.ovf'
+     (Omega virtual fonts) `OVFFONTS', `TEXFONTS'.
+
+`.ovp'
+     (Omega virtual property lists) `OVPFONTS', `TEXFONTS'.
+
+`.eps'
+     (Encapsulated PostScript figures, *note PostScript figures:
+     (dvips)PostScript figures.) `TEXPICTS', `TEXINPUTS'; additional
+     suffixes: `.epsi'.
+
+`pk'
+     (packed bitmap fonts, *note Glyph files: (dvips)Glyph files.)
+     `PROGRAMFONTS' (PROGRAM being `XDVI', etc.), `PKFONTS', `TEXPKS',
+     `GLYPHFONTS', `TEXFONTS'; dynamic creation program: `MakeTeXPK'.
+
+`.pro'
+     (downloadable PostScript, *note Header files: (dvips)Header files.)
+     `TEXPSHEADERS', `PSHEADERS'.
+
+`.tex'
+     (TeX source, *note tex invocation: (web2c)tex invocation.)
+     `TEXINPUTS'; additional suffixes: `.ltx' `.dtx' `.texi' `.texinfo'
+     `.txi' `.eps' `.epsi'; dynamic creation program: `MakeTeXTeX'.
+
+`(none)'
+     (Documentation files for the TeX system) `TEXDOCS'.
+
+`tex.pool'
+     (TeX program strings, *note pooltype invocation: (web2c)pooltype
+     invocation.) `TEXPOOL', `TEXMFINI'.
+
+`(none)'
+     (Source files for the TeX system) `TEXSOURCES'.
+
+`.tfm'
+     (TeX font metrics, *note Metric files: (dvips)Metric files.)
+     `TFMFONTS', `TEXFONTS'; dynamic creation program: `MakeTeXTFM'.
+
+`(none)'
+     (Troff fonts, used by DMP; *note DMP invocation: (web2c)DMP
+     invocation.) `TRFONTS'.
+
+`.pfa'
+     (Type 1 PostScript outline fonts, *note Glyph files: (dvips)Glyph
+     files.) `T1FONTS', `T1INPUTS', `TEXPSHEADERS', `DVIPSHEADERS';
+     additional suffix: `.pfb'.
+
+`.vf'
+     (virtual fonts, *note Virtual fonts: (dvips)Virtual fonts.)
+     `VFFONTS', `TEXFONTS'.
+
+`(none)'
+     (Dvips `config.*' files, such as `config.ps', *note Config files:
+     (dvips)Config files.) `TEXCONFIG'.
+
+  If an environment variable by these names are set, the corresponding
+`texmf.cnf' definition won't be looked at (unless, as usual, the
+environment variable value has an extra `:').  *Note Default
+expansion::.
+
+  For the font variables, the intent is that:
+   * `TEXFONTS' is the default for everything.
+
+   * `GLYPHFONTS' is the default for bitmap (or, more precisely,
+     non-metric) files.
+
+   * Each font format has a variable of its own.
+
+   * Each program has its own font override path as well; e.g.,
+     `DVIPSFONTS' for Dvipsk.  Again, this is for bitmaps, not metrics.
+
+
+File: kpathsea.info,  Node: File lookup,  Next: Glyph lookup,  Prev: Supported file formats,  Up: TeX support
+
+File lookup
+===========
+
+  This section describes how Kpathsea searches for most files (bitmap
+font searches are the exception, as described in the next section).
+
+  Here is the search strategy for a file NAME:
+  1. If NAME has a suffix, search for exactly NAME along the
+     appropriate path.  Example: given `foo.sty', look for `foo.sty'
+     before `foo.sty.tex', even though it's a TeX input file.
+
+  2. If the file format defines a default suffix, and the suffix of
+     NAME is not already that default, try appending the default.
+     Example: given `foo.bar', search for `foo.bar.tex'.  But if given
+     `foo.tex', don't bother to search for `foo.tex.tex'.
+
+  3. If we're searching for a TFM, PK, or GF file, look for aliases of
+     NAME in `texfonts.map' files (*note Fontmap::.).  Example: given
+     `Times-Roman', find `ptmr'.
+
+  4. If the file format defines a program to invoke to create missing
+     files, run it (*note MakeTeX scripts::.).
+
+  5. Search for NAME itself, if we haven't done so already.  Example:
+     given `foo', search for `foo'.
+
+  This is implemented in the routine `kpse_find_file' in
+`kpathsea/tex-file.c'.  You can watch it in action with the debugging
+options (*note Debugging::.).
+
+
+File: kpathsea.info,  Node: Glyph lookup,  Next: Suppressing warnings,  Prev: File lookup,  Up: TeX support
+
+Glyph lookup
+============
+
+  This section describes how Kpathsea searches for a bitmap font in GF
+or PK format (or either) given a font name (e.g., `cmr10') and a
+resolution (e.g., 600).
+
+  Here is an outline of the search strategy (details in the sections
+below) for a file NAME at resolution DPI.  The search stops at the
+first successful lookup.
+
+  1. Look for an existing file NAME.DPIFORMAT in the specified
+     format(s).
+
+  2. If NAME is an alias for a file F in the fontmap file
+     `texfonts.map', look for F.DPI.
+
+  3. Run an external program (typically named `MakeTeXPK') to generate
+     the font (*note MakeTeX scripts::.)
+
+  4. Look for FALLBACK.DPI, where FALLBACK is some last-resort font
+     (typically `cmr10').
+
+  This is implemented in `kpse_find_glyph_format' in
+`kpathsea/tex-glyph.c'.
+
+* Menu:
+
+* Basic glyph lookup::          Features common to all glyph lookups.
+* Fontmap::                     Aliases for fonts.
+* Fallback font::               Resolutions and fonts of last resort.
+
+
+File: kpathsea.info,  Node: Basic glyph lookup,  Next: Fontmap,  Up: Glyph lookup
+
+Basic glyph lookup
+------------------
+
+  When Kpathsea looks for a bitmap font NAME at resolution DPI in a
+format FORMAT, it first checks each directory in the search path for a
+file `NAME.DPIFORMAT'; for example, `cmr10.600pk'.  Kpathsea looks for
+a PK file first, then a GF file.
+
+  If that fails, Kpathsea looks for `dpiDPI/NAME.FORMAT'; for example,
+`dpi600/cmr10.pk'. This is how fonts are typically stored on
+filesystems (such as DOS) that permit only three-character extensions.
+
+  If that fails, Kpathsea looks for a font with a close-enough DPI.
+"Close enough" is defined by the macro `KPSE_BITMAP_TOLERANCE' in
+`kpathsea/tex-glyph.h' to be `DPI / 500 + 1'.  This is slightly more
+than the 0.2% minimum allowed by the DVI standard
+(`CTAN:/dviware/driv-standard/level-0').
+
+
+File: kpathsea.info,  Node: Fontmap,  Next: Fallback font,  Prev: Basic glyph lookup,  Up: Glyph lookup
+
+Fontmap
+-------
+
+  If a bitmap font or metric file is not found with the original name
+(see the previous section), Kpathsea looks through any "fontmap" files
+for an "alias" for the original font name.  These files are named
+`texfonts.map' and searched for along the `TEXFONTMAPS'
+environment/config file variable.  All `texfonts.map' files that are
+found are read; earlier definitions override later ones.
+
+  This feature is intended to help in two respects:
+
+  1. An alias name is limited in length only by available memory, not
+     by your filesystem.  Therefore, if you want to ask for
+     `Times-Roman' instead of `ptmr', you can (you get `ptmr8r').
+
+  2. A few fonts have historically had multiple names: specifically,
+     LaTeX's "circle font" has variously been known as `circle10',
+     `lcircle10', and `lcirc10'.  Aliases can make all the names
+     equivalent, so that it no longer matters what the name of the
+     installed file is; TeX documents will find their favorite name.
+
+
+  The format of fontmap files is straightforward:
+
+   * Comments start with `%' and continue to the end of the line.
+
+   * Blank lines are ignored.
+
+   * Each nonblank line is broken up into a series of "words":   a
+     sequence of non-whitespace characters.
+
+   * If the first word is `include', the second word is used as   a
+     filename, and it is searched for and read.
+
+   * Otherwise, the first word on each line is the true filename;
+
+   * the second word is the alias;
+
+   * subsequent words are ignored.
+
+  If an alias has an extension, it matches only those files with that
+extension; otherwise, it matches anything with the same root, regardless
+of extension.  For example, an alias `foo.tfm' matches only when
+`foo.tfm' is being searched for; but an alias `foo' matches `foo.vf',
+`foo.600pk', etc.
+
+  As an example, here is an excerpt from the `texfonts.map' in the
+Web2c distribution.  It makes the circle fonts equivalent and includes
+automatically generated maps for most PostScript fonts available from
+various font suppliers.
+
+     circle10        lcircle10
+     circle10        lcirc10
+     lcircle10       circle10
+     lcircle10       lcirc10
+     lcirc10         circle10
+     lcirc10         lcircle10
+     ...
+     include adobe.map
+     include apple.map
+     include bitstrea.map
+     ...
+
+  Fontmaps are implemented in the file `kpathsea/fontmap.c'.  The
+Fontname distribution has much more information on font naming (*note
+Introduction: (fontname)Introduction.).
+
+
+File: kpathsea.info,  Node: Fallback font,  Prev: Fontmap,  Up: Glyph lookup
+
+Fallback font
+-------------
+
+  If a bitmap font cannot be found or created at the requested size,
+Kpathsea looks for the font at a set of "fallback resolutions".  You
+specify these resolutions as a colon-separated list (like search paths).
+Kpathsea looks first for a program-specific environment variable (e.g.,
+`DVIPSSIZES' for Dvipsk), then the environment variable `TEXSIZES',
+then a default specified at compilation time (the Make variable
+`default_texsizes').  You can set this list to be empty if you prefer
+to find fonts at their stated size or not at all.
+
+  Finally, if the font cannot be found even at the fallback resolutions,
+Kpathsea looks for a fallback font, typically `cmr10'.  Programs must
+enable this feature by assigning to the global variable
+`kpse_fallback_font' or calling `kpse_init_prog' (*note Calling
+sequence::.); the default is no fallback font.
+
+
+File: kpathsea.info,  Node: Suppressing warnings,  Prev: Glyph lookup,  Up: TeX support
+
+Suppressing warnings
+====================
+
+  Kpathsea provides a way to suppress selected usually-harmless
+warnings; this is useful at large sites where most users are not
+administrators, and thus the warnings are merely a source of confusion,
+not a help.  To do this, you set the environment variable or
+configuration file value `TEX_HUSH' to a colon-separated list of
+values.  Here are the possibilities:
+
+`all'
+     Suppress everything possible.
+
+`checksum'
+     Suppress mismatched font checksum warnings.
+
+`lostchar'
+     Suppress warnings when a character is missing from a font that a
+     DVI or VF file tries to typeset.
+
+`readable'
+     Suppress warnings about attempts to access a file whose permissions
+     render it unreadable.
+
+`special'
+     Suppresses warnings about an unimplemented or unparsable
+     `\special' command.
+
+`tex-hush.c' defines the function that checks the variable value.  Each
+driver implements its own checks where appropriate.
+
+
+File: kpathsea.info,  Node: Programming,  Next: Index,  Prev: TeX support,  Up: Top
+
+Programming
+***********
+
+  This chapter is for programmers who wish to use Kpathsea.  *Note
+Introduction::, for the conditions under which you may do so.
+
+* Menu:
+
+* Overview: Programming overview.         Introduction.
+* Calling sequence::                      Specifics of what to call.
+* Config: Programming with config files.  Getting info from texmf.cnf.
+
+
+File: kpathsea.info,  Node: Programming overview,  Next: Calling sequence,  Up: Programming
+
+Programming overview
+====================
+
+  Aside from this manual, your best source of information is the source
+to the programs I've modified to use Kpathsea (*note Introduction::.).
+Of those, Dviljk is probably the simplest, and hence a good place to
+start.  Xdvik adds VF support and the complication of X resources.
+Dvipsk adds the complication of its own config files.  Web2c is source
+code I also maintain, so it uses Kpathsea rather straightforwardly, but
+is of course complicated by the Web to C translation.  Finally,
+Kpsewhich is a small utility program whose sole purpose is to exercise
+the main path-searching functionality.
+
+  Beyond these examples, the `.h' files in the Kpathsea source describe
+the interfaces and functionality (and of course the `.c' files define
+the actual routines, which are the ultimate documentation).
+`pathsearch.h' declares the basic searching routine.  `tex-file.h' and
+`tex-glyph.h' define the interfaces for looking up particular kinds of
+files.  You may wish to use `#include <kpathsea/kpathsea.h>', which
+includes every Kpathsea header.
+
+  The library provides no way for an external program to register new
+file types: `tex-file.[ch]' must be modified to do this. For example,
+Kpathsea has support for looking up Dvips config files, even though no
+program other than Dvips will likely ever want to do so.  I felt this
+was acceptable, since along with new file types should also come new
+defaults in `texmf.cnf' (and its descendant `paths.h'), since it's
+simplest for users if they can modify one configuration file for all
+kinds of paths.
+
+  Kpathsea does not parse any formats itself; it barely opens any files.
+Its primary purpose is to return filenames.  The GNU font utilities does
+contain libraries to read TFM, GF, and PK files, as do the programs
+above, of course.
+
+
+File: kpathsea.info,  Node: Calling sequence,  Next: Programming with config files,  Prev: Programming overview,  Up: Programming
+
+Calling sequence
+================
+
+  The typical way to use Kpathsea in your program goes something like
+this:
+
+  1. Call `kpse_set_progname' with `argv[0]'; This is the only
+     initialization that is mandatory to take full advantage of
+     Kpathsea--specifically, for the `.PROGRAM' feature of config files
+     (*note Config files::.).
+
+     If necessary, `kpse_set_progname' sets the global variables
+     `program_invocation_name' and `program_invocation_short_name'.
+     These variables are used in the error message macros defined in
+     `kpathsea/lib.h'.  It also initializes debugging options based on
+     the environment variable `KPATHSEA_DEBUG' (if that is set).
+     Finally, it sets the variables `SELFAUTOLOC', `SELFAUTODIR' and
+     `SELFAUTOPARENT' to the location, parent and grandparent directory
+     of the executable, removing `.' and `..' path elements and
+     resolving symbolic links.  These are used in the default
+     configuration file to allow people to invoke TeX from anywhere,
+     specifically from a mounted CD-ROM.  (You can use
+     `--expand-var=\$SELFAUTOLOC', etc., to see the values finds.)
+
+  2. Set debugging options. *Note Debugging::.  If your program doesn't
+     have a debugging option already, you can define one and set
+     `kpathsea_debug' to the number that the user supplies (as in Dviljk
+     and Web2c), or you can just omit this altogether (people can
+     always set `KPATHSEA_DEBUG').  If you do have runtime debugging
+     already, you need to merge Kpathsea's options with yours (as in
+     Dvipsk and Xdvik).
+
+  3. If your program has its own configuration files that can define
+     search paths, you should assign those paths to the `client_path'
+     member in the appropriate element of the `kpse_format_info' array.
+     (This array is indexed by file type; see `tex-file.h'.)  See
+     `resident.c' in Dvipsk for an example.
+
+  4. Call `kpse_init_prog' (see `proginit.c'). It's useful for the DVI
+     drivers, at least, but for other programs it may be simpler to
+     extract the parts of it that actually apply.  This does not
+     initialize any paths, it just looks for (and sets) certain
+     environment variables and other random information.  (A search
+     path is always initialized at the first call to find a file of
+     that type; this eliminates much useless work, e.g., initializing
+     the BibTeX search paths in a DVI driver.)
+
+  5. The routine to actually find a file of type FORMAT is
+     `kpse_find_FORMAT', defined in `tex-file.h'. These are macros that
+     expand to a call to `kpse_find_file'.  You can call, say,
+     `kpse_find_tfm' after doing only the first of the initialization
+     steps above--Kpathsea automatically reads the `texmf.cnf' generic
+     config files, looks for environment variables, and does expansions
+     at the first lookup.
+
+  6. To find PK and/or GF bitmap fonts, the routines are `kpse_find_pk',
+     `kpse_find_gf' and `kpse_find_glyph', defined in `tex-glyph.h'.
+     These return a structure in addition to the resultant filename,
+     because fonts can be found in so many ways. See the documentation
+     in the source.
+
+  7. To actually open a file, not just return a filename, call
+     `kpse_open_file'.  This function takes the name to look up and a
+     Kpathsea file format as arguments, and returns the usual `FILE *'.
+     It always assumes the file must exist, and thus will search the
+     disk if necessary (unless the search path specified `!!', etc.).
+     In other words, if you are looking up a VF or some other file that
+     need not exist, don't use this.
+
+
+  Kpathsea also provides many utility routines. Some are generic: hash
+tables, memory allocation, string concatenation and copying, string
+lists, reading input lines of arbitrary length, etc. Others are
+filename-related: default path, tilde, and variable expansion, `stat'
+calls, etc. (Perhaps someday I'll move the former to a separate
+library.)
+
+  The `c-*.h' header files can also help your program adapt to many
+different systems.  You will almost certainly want to use Autoconf for
+configuring your software if you use Kpathsea; I strongly recommend
+using Autoconf regardless.  It is available from
+`ftp://prep.ai.mit.edu/pub/gnu/'.
+
+
+File: kpathsea.info,  Node: Programming with config files,  Prev: Calling sequence,  Up: Programming
+
+Programming with config files
+=============================
+
+  You can (and probably should) use the same `texmf.cnf' configuration
+file that Kpathsea uses for your program.  This helps installers by
+keeping all configuration in one place.
+
+  To retrieve a value VAR from config files, the best way is to call
+`kpse_var_value' on the string `VAR'.  This will look first for an
+environment variable VAR, then a config file value.  The result will be
+the value found or `NULL'.  This function is declared in
+`kpathsea/variable.h'.  For an example, see the `shell_escape' code in
+`web2c/lib/texmfmp.c'.
+
+  The routine to do variable expansion in the context of a search path
+(as opposed to simply retrieving a value) is `kpse_var_expand', also
+declared in `kpathsea/variable.h'.  It's generally only necessary to
+set the search path structure components as explained in the previous
+section, rather than using this yourself.
+
+  If for some reason you want to retrieve a value *only* from a config
+file, not automatically looking for a corresponding environment
+variable, call `kpse_cnf_get' (declared in `kpathsea/cnf.h') with the
+string VAR.
+
+  No initialization calls are needed.
+
+
+File: kpathsea.info,  Node: Index,  Prev: Programming,  Up: Top
+
+Index
+*****
+
+* Menu:
+
+* !! in path specifications:             ls-R.
+* $ expansion:                           Variable expansion.
+* -1 debugging value:                    Debugging.
+* -A option to ls:                       ls-R.
+* -Bdynamic:                             ShellWidgetClass.
+* -Bstatic:                              ShellWidgetClass.
+* -color=tty:                            ls-R.
+* -D NUM:                                Path searching options.
+* -debug=NUM:                            Auxiliary tasks.
+* -dpi=NUM:                              Path searching options.
+* -dynamic:                              ShellWidgetClass.
+* -enable options:                       configure options.
+* -enable-shared:                        Shared library.
+* -expand-path=STRING:                   Auxiliary tasks.
+* -expand-var=STRING:                    Auxiliary tasks.
+* -format=NAME:                          Path searching options.
+* -g, compiling without:                 configure scenarios.
+* -help:                                 Standard options.
+* -interactive:                          Path searching options.
+* -L option to ls:                       ls-R.
+* -maketex=FILETYPE:                     Path searching options.
+* -mode=STRING:                          Path searching options.
+* -must-exist:                           Path searching options.
+* -no-maketex=FILETYPE:                  Path searching options.
+* -O, compiling with:                    configure scenarios.
+* -path=STRING:                          Path searching options.
+* -progname=NAME:                        Path searching options.
+* -separator=STRING:                     Auxiliary tasks.
+* -show-path=NAME:                       Auxiliary tasks.
+* -srcdir, for building multiple architectures: configure scenarios.
+* -static:                               ShellWidgetClass.
+* -version:                              Standard options.
+* -with options:                         configure options.
+* -with-maketextex-default:              MakeTeX configuration.
+* -without-maketexmf-default:            MakeTeX configuration.
+* -without-maketexpk-default:            MakeTeX configuration.
+* -without-maketextfm-default:           MakeTeX configuration.
+* . directories, ignored:                ls-R.
+* . files:                               ls-R.
+* .2602gf:                               Unable to generate fonts.
+* .afm:                                  Supported file formats.
+* .base:                                 Supported file formats.
+* .bib:                                  Supported file formats.
+* .bst:                                  Supported file formats.
+* .cnf:                                  Supported file formats.
+* .dtx:                                  Supported file formats.
+* .eps:                                  Supported file formats.
+* .epsi:                                 Supported file formats.
+* .fmt:                                  Supported file formats.
+* .gf:                                   Supported file formats.
+* .ist:                                  Supported file formats.
+* .ltx:                                  Supported file formats.
+* .map:                                  Supported file formats.
+* .mem:                                  Supported file formats.
+* .mf:                                   Supported file formats.
+* .mft:                                  Supported file formats.
+* .mp:                                   Supported file formats.
+* .ocp:                                  Supported file formats.
+* .ofm:                                  Supported file formats.
+* .opl:                                  Supported file formats.
+* .otp:                                  Supported file formats.
+* .ovf:                                  Supported file formats.
+* .ovp:                                  Supported file formats.
+* .pfa:                                  Supported file formats.
+* .pfb:                                  Supported file formats.
+* .pk:                                   Supported file formats.
+* .pool:                                 Supported file formats.
+* .pro:                                  Supported file formats.
+* .rhosts, writable by TeX:              Security.
+* .tex:                                  Supported file formats.
+* .tex file, included in ls-R:           ls-R.
+* .texi:                                 Supported file formats.
+* .texinfo:                              Supported file formats.
+* .tfm:                                  Supported file formats.
+* .txi:                                  Supported file formats.
+* .vf:                                   Supported file formats.
+* / may not be /:                        Searching overview.
+* /, trailing in home directory:         Tilde expansion.
+* //:                                    Subdirectory expansion.
+* /afs/... , installing into:            Installing files.
+* /etc/profile:                          Unable to find files.
+* /etc/profile and aliases:              ls-R.
+* /var/tex/fonts:                        MakeTeX configuration.
+* 2602gf:                                Unable to generate fonts.
+* 4allTeX Live CD-ROM:                   CD-ROM distribution.
+* 8.3 filenames, using:                  MakeTeX configuration.
+* : may not be ::                        Searching overview.
+* :: expansion:                          Default expansion.
+* @VAR@ substitutions:                   Running configure.
+* \, line continuation in texmf.cnf:     Config files.
+* \openin:                               Searching overview.
+* \special, suppressing warnings about:  Suppressing warnings.
+* absolute filenames:                    Searching overview.
+* ac_include, Autoconf extension:        Running configure.
+* access warnings:                       Searching overview.
+* Acorn TeX implementations:             Other TeX packages.
+* AFMFONTS:                              Supported file formats.
+* AFS:                                   Installing files.
+* AIX shells and configure:              configure shells.
+* aliases for fonts:                     Fontmap.
+* aliases, for filenames:                Filename aliases.
+* all:                                   Suppressing warnings.
+* alphabetical order, not:               Subdirectory expansion.
+* Amiga support:                         Custom installation.
+* Amiga TeX implementations:             Other TeX packages.
+* Andrew File System, installing with:   Installing files.
+* announcement mailing list:             Mailing lists.
+* append-only directories and MakeTeXPK: Security.
+* appendonlydir:                         MakeTeX configuration.
+* architecture-(in)dependent files, installing only: Installing files.
+* architectures, compiling multiple:     configure scenarios.
+* arguments to MakeTeX:                  MakeTeX script arguments.
+* argv[0]:                               Calling sequence.
+* ash, losing with configure:            configure shells.
+* autoconf, recommended:                 Calling sequence.
+* automounter, and configuration:        configure scenarios.
+* automounter, and ls-R:                 ls-R.
+* auxiliary tasks:                       Auxiliary tasks.
+* Babel <1>:                             Running make.
+* Babel:                                 Kpathsea application distributions.
+* Bach, Johann Sebastian:                Default expansion.
+* backbone of CTAN:                      Electronic distribution.
+* backslash-newline:                     Config files.
+* base dpi:                              MakeTeX script arguments.
+* bash, recommended for running configure: configure shells.
+* basic glyph lookup:                    Basic glyph lookup.
+* BIBINPUTS:                             Supported file formats.
+* binary mode, for file transfers:       Electronic distribution.
+* blank lines, in texmf.cnf:             Config files.
+* brace expansion:                       Brace expansion.
+* BSD universe:                          Running make.
+* bsh, ok with configure:                configure shells.
+* BSTINPUTS:                             Supported file formats.
+* bug address:                           Reporting bugs.
+* bug checklist:                         Bug checklist.
+* bug mailing list:                      Mailing lists.
+* bugs, reporting:                       Reporting bugs.
+* c-*.h:                                 Calling sequence.
+* c-auto.h.in:                           Running configure.
+* cache of fonts, loca:                  Security.
+* calling sequence:                      Calling sequence.
+* CC:                                    configure environment.
+* cc warnings:                           Pointer combination warnings.
+* cc, compiling with:                    configure environment.
+* CD-ROM distributions:                  CD-ROM distribution.
+* CFLAGS:                                configure environment.
+* ChangeLog entry:                       Bug checklist.
+* checklist for bug reports:             Bug checklist.
+* checksum:                              Suppressing warnings.
+* circle fonts:                          Fontmap.
+* clean Make target:                     Cleaning up.
+* client_path in kpse_format_info:       Calling sequence.
+* cmr10, as fallback font:               Fallback font.
+* cmr10.vf:                              Searching overview.
+* cnf.c:                                 Config files.
+* cnf.h:                                 Programming with config files.
+* code sharing:                          Shared library.
+* color printers, configuring:           Simple installation.
+* comments, in fontmap files:            Fontmap.
+* comments, in texmf.cnf:                Config files.
+* comments, making:                      Introduction.
+* common features in glyph lookup:       Basic glyph lookup.
+* common problems:                       Common problems.
+* comp.sys.sun.admin FAQ:                ShellWidgetClass.
+* comp.text.tex:                         Mailing lists.
+* compilation:                           Installation.
+* compilation value, source for path:    Path sources.
+* compiler bugs:                         TeX or Metafont failing.
+* compiler bugs, finding:                TeX or Metafont failing.
+* compiler options, additional:          Running make.
+* compiler options, specifying:          configure environment.
+* compiler, changing:                    Running make.
+* conditions for use:                    Introduction.
+* config files:                          Config files.
+* config files, for Kpathsea-using programs: Calling sequence.
+* config files, programming with:        Programming with config files.
+* config.log:                            Bug checklist.
+* config.ps, search path for:            Supported file formats.
+* config.status:                         Bug checklist.
+* configuration:                         Installation.
+* configuration bugs:                    Bug checklist.
+* configuration compiler options:        configure environment.
+* configuration file, source for path:   Path sources.
+* configuration files as shell scripts.: Config files.
+* configuration of MakeTeX scripts:      MakeTeX configuration.
+* configuration of optional features:    configure options.
+* CONFIGURE:                             Running configure.
+* configure options:                     configure options.
+* configure options for MakeTeX scripts: MakeTeX configuration.
+* configure, running:                    Running configure.
+* context diff:                          Bug checklist.
+* continuation character:                Config files.
+* core dumps, reporting:                 Bug checklist.
+* CPPFLAGS:                              configure environment.
+* crashes, reporting:                    Bug checklist.
+* CTAN, defined:                         Electronic distribution.
+* CTAN.sites:                            Electronic distribution.
+* custom installation:                   Custom installation.
+* database search:                       Searching overview.
+* database, for filenames:               Filename database.
+* database, format of:                   Database format.
+* DC fonts, and dynamic source creation: MakeTeX scripts.
+* debug.h:                               Debugging.
+* debugger:                              Bug checklist.
+* debugging:                             Debugging.
+* debugging options, in Kpathsea-using program: Calling sequence.
+* debugging output:                      Debugging.
+* debugging with -g, disabling:          configure scenarios.
+* DEC shells and configure:              configure shells.
+* default expansion:                     Default expansion.
+* default path features:                 Default path features.
+* default paths, changing:               Default path generation.
+* default paths, how they're made:       Default path generation.
+* default_texsizes:                      Fallback font.
+* DEFS:                                  configure environment.
+* depot:                                 configure scenarios.
+* destination directory for MakeTeXPK:   MakeTeX script arguments.
+* directories, changing default installation: Default path generation.
+* directories, making append-only:       MakeTeX configuration.
+* directory structure, for TeX files:    TeX directory structure.
+* disabling MakeTeX scripts:             MakeTeX configuration.
+* disk search:                           Searching overview.
+* disk searching, avoiding:              ls-R.
+* disk space, needed:                    Disk space.
+* disk usage, reducing:                  Logging.
+* distclean Make target:                 Cleaning up.
+* distributions, compiling simultaneously: Kpathsea application distributions.
+* distributions, not compiling:          Kpathsea application distributions.
+* distributions, on CD-ROM:              CD-ROM distribution.
+* distributions, on tape:                Tape distribution.
+* distributions, via ftp:                Electronic distribution.
+* dlclose:                               dlopen.
+* dlopen:                                dlopen.
+* dlsym:                                 dlopen.
+* dlsym.c:                               dlopen.
+* doc files:                             Supported file formats.
+* DOS compatible names:                  MakeTeX configuration.
+* DOS support:                           Custom installation.
+* DOS TeX implementations:               Other TeX packages.
+* dosnames:                              MakeTeX configuration.
+* dot files:                             ls-R.
+* doubled colons:                        Default expansion.
+* dpiNNN directories:                    MakeTeX configuration.
+* DVI drivers:                           Kpathsea application distributions.
+* DVILJMAKEPK:                           MakeTeX script names.
+* DVILJSIZES:                            Fallback font.
+* DVIPSFONTS:                            Supported file formats.
+* DVIPSHEADERS:                          Supported file formats.
+* DVIPSMAKEPK:                           MakeTeX script names.
+* DVIPSSIZES:                            Fallback font.
+* dynamic creation of files:             MakeTeX scripts.
+* dynamic linking problems with OpenWin libraries: ShellWidgetClass.
+* elt-dirs.c:                            Subdirectory expansion.
+* email CTAN access:                     Electronic distribution.
+* enabling MakeTeX scripts:              MakeTeX configuration.
+* environment variable, source for path: Path sources.
+* environment variables for TeX:         Supported file formats.
+* environment variables in paths:        Variable expansion.
+* environment variables, old:            Unable to find files.
+* epoch, seconds since:                  Logging.
+* error message macros:                  Calling sequence.
+* excessive startup time:                Slow path searching.
+* expand.c:                              Brace expansion.
+* expanding symlinks:                    Calling sequence.
+* expansion, default:                    Default expansion.
+* expansion, path element:               Searching overview.
+* expansion, search path:                Path expansion.
+* expansion, subdirectory:               Subdirectory expansion.
+* expansion, tilde:                      Tilde expansion.
+* expansion, variable:                   Variable expansion.
+* explicitly relative filenames:         Searching overview.
+* externally-built filename database:    Filename database.
+* extra colons:                          Default expansion.
+* extraclean Make target:                Cleaning up.
+* failed MakeTeX... script invocation:   MakeTeX script names.
+* fallback font:                         Fallback font.
+* fallback resolutions:                  Fallback font.
+* fallback resolutions, overriding:      Running make.
+* FAQ, comp.sys.sun.admin:               ShellWidgetClass.
+* FAQ, Kpathsea:                         Common problems.
+* Farwell, Matthew:                      Subdirectory expansion.
+* features, of default paths:            Default path features.
+* file formats, supported:               Supported file formats.
+* file lookup:                           File lookup.
+* file types, registering new:           Programming overview.
+* filename aliases:                      Filename aliases.
+* filename database:                     Filename database.
+* filename database generation:          Filename database generation.
+* filenames, absolute or explicitly relative: Searching overview.
+* files, unable to find:                 Unable to find files.
+* filesystem search:                     Searching overview.
+* floating directories:                  Searching overview.
+* font alias files:                      Fontmap.
+* font generation failures:              Unable to generate fonts.
+* font of last resort:                   Fallback font.
+* font set, infinite:                    MakeTeX scripts.
+* fontmap files:                         Fontmap.
+* fontnames, arbitrary length:           Fontmap.
+* fonts, being created:                  Simple installation.
+* fopen, redefined:                      Debugging.
+* format of external database:           Database format.
+* Free Software Foundation:              CD-ROM distribution.
+* FreeBSD shells and configure:          configure shells.
+* FSF Source Code CD-ROM:                CD-ROM distribution.
+* ftp retrieval:                         Electronic distribution.
+* ftp.tug.org:                           unixtex.ftp.
+* fundamental purpose of Kpathsea:       Introduction.
+* gcc, compiling with:                   configure environment.
+* gdb, recommended:                      Bug checklist.
+* generation of filename database:       Filename database generation.
+* get_applicationShellWidgetClass:       ShellWidgetClass.
+* get_wmShellWidgetClass:                ShellWidgetClass.
+* GFFONTS:                               Supported file formats.
+* globally writable directories:         Security.
+* glyph lookup:                          Glyph lookup.
+* glyph lookup bitmap tolerance:         Basic glyph lookup.
+* GLYPHFONTS:                            Supported file formats.
+* GNU C compiler bugs:                   TeX or Metafont failing.
+* GNU General Public License:            Introduction.
+* Gopher CTAN access:                    Electronic distribution.
+* group-writable directories:            Security.
+* GUTenberg:                             CD-ROM distribution.
+* hash table buckets, printing:          Debugging.
+* hash table routines:                   Calling sequence.
+* hash_summary_only variable for debugging: Debugging.
+* help, mailing list for general TeX:    Mailing lists.
+* HIER:                                  Default path features.
+* history of Kpathsea:                   History.
+* home directories in paths:             Tilde expansion.
+* HOME, as ~ expansion:                  Tilde expansion.
+* identifiers, characters valid in:      Config files.
+* illegal pointer combination warnings:  Pointer combination warnings.
+* include fontmap directive:             Fontmap.
+* INDEXSTYLE:                            Supported file formats.
+* info-tex@shsu.edu:                     Mailing lists.
+* input lines, reading:                  Calling sequence.
+* install-data Make target:              Installing files.
+* install-exec Make target:              Installing files.
+* installation:                          Installation.
+* installation testing:                  Installation testing.
+* installation, architecture-(in)dependent files only: Installing files.
+* installation, changing default directories: Default path generation.
+* installation, customized:              Custom installation.
+* installation, getting executables instead of: Simple installation.
+* installation, simple:                  Simple installation.
+* installing files:                      Installing files.
+* interactive query:                     Path searching options.
+* interface, not frozen:                 Introduction.
+* introduction:                          Introduction.
+* kdebug::                               Debugging.
+* kdefault.c:                            Default expansion.
+* Knuth, Donald E.:                      History.
+* Knuth, Donald E., archive of programs by: Other TeX packages.
+* Knuth, Donald E., original author:     Electronic distribution.
+* Korn shell, losing with configure:     configure shells.
+* Kpathsea config file, source for path: Path sources.
+* Kpathsea version number:               Kpathsea application distributions.
+* kpathsea.h:                            Programming overview.
+* kpathsea/CONFIGURE:                    Running configure.
+* kpathsea/HIER:                         Default path features.
+* KPATHSEA_DEBUG:                        Debugging.
+* kpathsea_debug:                        Debugging.
+* KPATHSEA_DEBUG:                        Calling sequence.
+* kpathsea_debug variable:               Calling sequence.
+* KPATHSEA_DPI:                          MakeTeX script arguments.
+* KPSE_BITMAP_TOLERANCE:                 Basic glyph lookup.
+* kpse_cnf_get:                          Programming with config files.
+* KPSE_DEBUG_EXPAND (16):                Debugging.
+* KPSE_DEBUG_FOPEN (4):                  Debugging.
+* KPSE_DEBUG_HASH (2):                   Debugging.
+* KPSE_DEBUG_PATHS (8):                  Debugging.
+* KPSE_DEBUG_SEARCH (32):                Debugging.
+* KPSE_DEBUG_STAT (1):                   Debugging.
+* kpse_fallback_font:                    Fallback font.
+* kpse_find_*:                           Calling sequence.
+* kpse_find_file:                        File lookup.
+* kpse_find_glyph_format:                Glyph lookup.
+* kpse_format_info:                      Calling sequence.
+* kpse_format_info_type:                 Debugging.
+* kpse_init_prog:                        Calling sequence.
+* kpse_init_prog, and MAKETEX_MODE:      Default path features.
+* kpse_make_specs:                       MakeTeX script names.
+* kpse_open_file:                        Calling sequence.
+* kpse_set_progname:                     Calling sequence.
+* kpse_var_expand:                       Programming with config files.
+* kpsewhich:                             Invoking kpsewhich.
+* Kpsewhich, and debugging:              Debugging.
+* ksh, losing with configure:            configure shells.
+* labrea.stanford.edu:                   Other TeX packages.
+* LaserJet drive:                        Kpathsea application distributions.
+* last-resort font:                      Fallback font.
+* LaTeX help mailing list:               Mailing lists.
+* lcircle10:                             Fontmap.
+* LDFLAGS:                               configure environment.
+* leading colons:                        Default expansion.
+* leaf directories wrongly guessed:      Unable to find files.
+* leaf directory trick:                  Subdirectory expansion.
+* libdl.a:                               dlopen.
+* libraries, changing:                   Running make.
+* libraries, specifying additional:      configure environment.
+* LIBS:                                  configure environment.
+* libucb, avoiding:                      Running make.
+* license for using the library:         Introduction.
+* lines, reading arbitrary-length:       Calling sequence.
+* Linux File System Standard:            MakeTeX configuration.
+* Linux shells and configure:            configure shells.
+* Linux, using Web2c:                    CD-ROM distribution.
+* lndir for building symlink trees:      configure scenarios.
+* loader options:                        configure environment.
+* loader options, final:                 Running make.
+* loader options, initial:               Running make.
+* local cache of fonts:                  Security.
+* log file:                              Logging.
+* logging successful searches:           Logging.
+* lost+found directory:                  Searching overview.
+* lostchar:                              Suppressing warnings.
+* ls-R:                                  Supported file formats.
+* ls-R and AFS:                          Installing files.
+* ls-R database file:                    ls-R.
+* ls-R, simplest build:                  ls-R.
+* Macintosh TeX implementations:         Other TeX packages.
+* MacKenzie, David <1>:                  Subdirectory expansion.
+* MacKenzie, David:                      History.
+* mag Metafont variable:                 MakeTeX script arguments.
+* magic characters:                      Searching overview.
+* magstep for MakeTeXPK:                 MakeTeX script arguments.
+* mailing lists:                         Mailing lists.
+* maintainer-clean Make target:          Cleaning up.
+* Make arguments, additional:            Running make.
+* make, running:                         Running make.
+* Makefile.in:                           Running configure.
+* MakeTeX script configuration:          MakeTeX configuration.
+* MakeTeX script names:                  MakeTeX script names.
+* MakeTeX scripts:                       MakeTeX scripts.
+* MakeTeX.site:                          MakeTeX configuration.
+* MAKETEX_BASE_DPI:                      MakeTeX script arguments.
+* MAKETEX_MAG:                           MakeTeX script arguments.
+* MAKETEX_MODE <1>:                      Default path features.
+* MAKETEX_MODE:                          MakeTeX script arguments.
+* MakeTeXMF:                             MakeTeX script names.
+* MakeTeXmkdir:                          MakeTeX configuration.
+* MakeTeXnames.cnf:                      MakeTeX configuration.
+* MakeTeXPK:                             MakeTeX script names.
+* MakeTeXPK , initial runs:              Simple installation.
+* MAKETEXPK environment variable:        MakeTeX script arguments.
+* MakeTeXTeX:                            MakeTeX script names.
+* MakeTeXTFM:                            MakeTeX script names.
+* memory allocation routines:            Calling sequence.
+* Metafont failures:                     TeX or Metafont failing.
+* Metafont installation:                 Unable to generate fonts.
+* Metafont making too-large fonts:       Unable to generate fonts.
+* Metafont mode name for MakeTeXPK:      MakeTeX script arguments.
+* Metafont using the wrong resolution:   Unable to generate fonts.
+* MFBASES:                               Supported file formats.
+* MFINPUTS:                              Supported file formats.
+* MFPOOL:                                Supported file formats.
+* MFTINPUTS:                             Supported file formats.
+* mirrors, FTP:                          Electronic distribution.
+* mismatched checksum warnings:          Suppressing warnings.
+* missfont.log:                          MakeTeX script names.
+* MISSFONT_LOG:                          MakeTeX script names.
+* missing character warnings:            Suppressing warnings.
+* mode directory, omitting:              MakeTeX configuration.
+* mode Metafont variable:                MakeTeX script arguments.
+* Morgan, Tim:                           History.
+* mostlyclean Make target:               Cleaning up.
+* MPINPUTS:                              Supported file formats.
+* MPMEMS:                                Supported file formats.
+* MPPOOL:                                Supported file formats.
+* MPSUPPORT:                             Supported file formats.
+* MT_FEATURES:                           MakeTeX configuration.
+* mtp_destdir:                           MakeTeX script arguments.
+* multiple architectures, compiling on:  configure scenarios.
+* multiple architectures, directories for: configure scenarios.
+* multiple architectures, installing on: Installing files.
+* multiple TeX hierarchies:              Brace expansion.
+* must exist:                            Searching overview.
+* names for MakeTeX scripts:             MakeTeX script names.
+* NetBSD shells and configure:           configure shells.
+* Neumann, Gustaf:                       History.
+* newsgroup for TeX:                     Mailing lists.
+* NeXT, lacking X11:                     Kpathsea application distributions.
+* NFS and ls-R:                          ls-R.
+* NFS CTAN access:                       Electronic distribution.
+* nomode:                                MakeTeX configuration.
+* non-English typesetting:               Kpathsea application distributions.
+* non-Unix operating systems:            Custom installation.
+* Northwest Computing Support Center:    Tape distribution.
+* NTG:                                   CD-ROM distribution.
+* null pointers, dereferencing:          Bug checklist.
+* numeric debugging values:              Debugging.
+* obtaining TeX:                         unixtex.ftp.
+* obtaining TeX on tape:                 Tape distribution.
+* obtaining Web2c by ftp:                Electronic distribution.
+* obtaining Web2c on CD-ROM:             CD-ROM distribution.
+* OCPINPUTS:                             Supported file formats.
+* OFMFONTS:                              Supported file formats.
+* online Metafont display, spurious:     Unable to generate fonts.
+* OpenWin libraries, dynamic linking problems: ShellWidgetClass.
+* optimization caveat:                   TeX or Metafont failing.
+* optimization, enabling:                configure scenarios.
+* options for debugging:                 Debugging.
+* options to configure:                  configure options.
+* OS/2 support:                          Custom installation.
+* other TeX distributions:               Other TeX packages.
+* OTPINPUTS:                             Supported file formats.
+* overview of path searching:            Searching overview.
+* overview of programming with Kpathsea: Programming overview.
+* OVFFONTS:                              Supported file formats.
+* OVPFONTS:                              Supported file formats.
+* patches, Sun OpenWin:                  ShellWidgetClass.
+* path expansion:                        Path expansion.
+* path searching:                        Path searching.
+* path searching options:                Path searching options.
+* path searching, overview:              Searching overview.
+* path searching, standalone:            Invoking kpsewhich.
+* path sources:                          Path sources.
+* paths, changing default <1>:           Default path generation.
+* paths, changing default:               Changing search paths.
+* paths, device name included in:        Default path features.
+* paths.h:                               Default path generation.
+* paths.h, creating:                     Running make.
+* pathsearch.h:                          Programming overview.
+* pc Pascal compiler:                    History.
+* PCL driver:                            Kpathsea application distributions.
+* PDF generation:                        Kpathsea application distributions.
+* permission denied:                     Searching overview.
+* PKFONTS:                               Supported file formats.
+* plain.base:                            Unable to generate fonts.
+* pointer combination warnings:          Pointer combination warnings.
+* PostScript driver:                     Kpathsea application distributions.
+* PostScript fonts, additional:          Simple installation.
+* precompiled executables, instead of installation: Simple installation.
+* precompiled Unix binaries:             Other TeX packages.
+* preprocessor options:                  configure environment.
+* preprocessor options, additional:      Running make.
+* Prime Time TeXcetera CD-ROM:           CD-ROM distribution.
+* printer configuration files:           Simple installation.
+* privacy, semblance of:                 Logging.
+* problems, common:                      Common problems.
+* proginit.c:                            Default path features.
+* proginit.h:                            Calling sequence.
+* program-varying paths:                 Supported file formats.
+* program_invocation_name:               Calling sequence.
+* program_invocation_short_name:         Calling sequence.
+* programming overview:                  Programming overview.
+* programming with config files:         Programming with config files.
+* programming with Kpathsea:             Calling sequence.
+* programs using the library:            Introduction.
+* proof mode:                            Unable to generate fonts.
+* PSHEADERS:                             Supported file formats.
+* pxp Pascal preprocessor:               History.
+* quoting variable values:               Variable expansion.
+* readable:                              Suppressing warnings.
+* reading arbitrary-length lines:        Calling sequence.
+* README.mirrors:                        Electronic distribution.
+* recording successful searches:         Logging.
+* relative filenames:                    Searching overview.
+* relative filenames in ls-R:            Installing files.
+* reporting bugs:                        Reporting bugs.
+* resident.c:                            Calling sequence.
+* resolution, setting:                   Path searching options.
+* resolution, wrong:                     Unable to generate fonts.
+* resolutions, last-resort:              Fallback font.
+* retrieving TeX:                        unixtex.ftp.
+* right-hand side of variable assignments: Config files.
+* Rokicki, Tom:                          History.
+* root user:                             Tilde expansion.
+* runtime configuration files:           Config files.
+* runtime debugging:                     Debugging.
+* Sauter fonts, and dynamic source creation: MakeTeX scripts.
+* scripts for file creation:             MakeTeX scripts.
+* search path, defined:                  Searching overview.
+* search paths, changing default:        Changing search paths.
+* searching for files:                   File lookup.
+* searching for glyphs:                  Glyph lookup.
+* searching overview:                    Searching overview.
+* searching the database:                Searching overview.
+* searching the disk:                    Searching overview.
+* security considerations:               Security.
+* SELFAUTODIR:                           Calling sequence.
+* SELFAUTOLOC:                           Calling sequence.
+* SELFAUTOPARENT:                        Calling sequence.
+* sending patches:                       Bug checklist.
+* setgid scripts:                        Security.
+* sh5, ok with configure:                configure shells.
+* shar, recommended:                     Bug checklist.
+* shared library, making:                Shared library.
+* shell scripts as configuration files:  Config files.
+* shell variables:                       Variable expansion.
+* shell_escape, example for code:        Programming with config files.
+* shells and configure:                  configure shells.
+* simple installation:                   Simple installation.
+* site overrides for MakeTeX...:         MakeTeX configuration.
+* size of distribution archives:         Disk space.
+* skeleton TeX directory:                TeX directory structure.
+* slow startup time:                     Slow path searching.
+* Solaris BSD compatibility, not:        Running make.
+* source files:                          Supported file formats.
+* sources for search paths:              Path sources.
+* special:                               Suppressing warnings.
+* specification for MakeTeXPK:           MakeTeX script arguments.
+* st_nlink:                              Subdirectory expansion.
+* stack trace:                           Bug checklist.
+* standalone path searching:             Invoking kpsewhich.
+* standard error and debugging output:   Debugging.
+* standard options:                      Standard options.
+* startup time, excessive:               Slow path searching.
+* static linking:                        ShellWidgetClass.
+* static linking and dlsym:              dlopen.
+* string routines:                       Calling sequence.
+* strip:                                 MakeTeX configuration.
+* subdirectory searching:                Subdirectory expansion.
+* suggestions, making:                   Introduction.
+* Sun 2:                                 History.
+* Sun OpenWin patches:                   ShellWidgetClass.
+* supplier directory, omitting:          MakeTeX configuration.
+* support organization:                  Tape distribution.
+* supported file formats:                Supported file formats.
+* suppressing warnings:                  Suppressing warnings.
+* symbolic link trees, for multiple architectures: configure scenarios.
+* symbolic links not found:              Unable to find files.
+* symbolic links, and ls-R:              ls-R.
+* symlinks, resolving:                   Calling sequence.
+* system C compiler bugs:                TeX or Metafont failing.
+* system dependencies:                   Running configure.
+* system V universe:                     Running make.
+* T1FONTS:                               Supported file formats.
+* T1INPUTS:                              Supported file formats.
+* tape distribution:                     Tape distribution.
+* TDS:                                   TeX directory structure.
+* testing, post-installation:            Installation testing.
+* tests, simple:                         Simple installation.
+* teTeX:                                 Other TeX packages.
+* TeX directory structure:               TeX directory structure.
+* TeX distributions besides Web2c:       Other TeX packages.
+* TeX environment variables:             Supported file formats.
+* TeX failures:                          TeX or Metafont failing.
+* TeX file lookup:                       File lookup.
+* TeX glyph lookup:                      Glyph lookup.
+* TeX help mailing list:                 Mailing lists.
+* TeX hierarchy, one:                    configure scenarios.
+* TeX Live CD-ROM:                       CD-ROM distribution.
+* TeX support:                           TeX support.
+* TeX Users Group:                       Introduction.
+* tex-archive@math.utah.edu:             Mailing lists.
+* tex-file.c:                            File lookup.
+* tex-file.h:                            Programming overview.
+* tex-glyph.c:                           Glyph lookup.
+* tex-glyph.h:                           Programming overview.
+* tex-k-request@mail.tug.org:            Mailing lists.
+* tex-k@mail.tug.org (bug address):      Reporting bugs.
+* tex-make.c:                            MakeTeX script names.
+* TEX_HUSH <1>:                          Suppressing warnings.
+* TEX_HUSH:                              Searching overview.
+* TEXBIB:                                Supported file formats.
+* TEXCONFIG:                             Supported file formats.
+* TEXDOCS:                               Supported file formats.
+* TEXFONTMAPS:                           Supported file formats.
+* TEXFONTS:                              Supported file formats.
+* texfonts.map:                          Fontmap.
+* TEXFORMATS:                            Supported file formats.
+* TEXINDEXSTYLE:                         Supported file formats.
+* TEXINPUTS:                             Supported file formats.
+* TEXMF:                                 TeX directory structure.
+* texmf.cnf, and variable expansion:     Variable expansion.
+* texmf.cnf, creating:                   Running make.
+* texmf.cnf, definition for:             Config files.
+* texmf.cnf, generated:                  Default path generation.
+* texmf.cnf, source for path:            Path sources.
+* texmf.cnf.in:                          Default path generation.
+* texmf.cnf.in, editing:                 Changing search paths.
+* texmf.sed:                             Default path generation.
+* TEXMFCNF <1>:                          Supported file formats.
+* TEXMFCNF:                              Config files.
+* TEXMFDBS <1>:                          ls-R.
+* TEXMFDBS:                              Supported file formats.
+* TEXMFINI:                              Supported file formats.
+* TEXMFLOG:                              Logging.
+* TEXMFOUTPUT:                           MakeTeX script names.
+* TEXPICTS:                              Supported file formats.
+* TEXPKS:                                Supported file formats.
+* TEXPOOL:                               Supported file formats.
+* TEXPSHEADERS:                          Supported file formats.
+* TEXSIZES:                              Fallback font.
+* TEXSOURCES:                            Supported file formats.
+* TFMFONTS:                              Supported file formats.
+* tilde expansion:                       Tilde expansion.
+* tilde.c:                               Tilde expansion.
+* time system call:                      Logging.
+* tolerance for glyph lookup:            Basic glyph lookup.
+* total disk space:                      Disk space.
+* trailing / in home directory:          Tilde expansion.
+* trailing colons:                       Default expansion.
+* TRFONTS:                               Supported file formats.
+* trick for detecting leaf directories:  Subdirectory expansion.
+* trojan horse attack:                   Security.
+* TUG:                                   CD-ROM distribution.
+* tug.cs.umb.edu:                        unixtex.ftp.
+* tug@tug.org:                           Introduction.
+* typeface directory, omitting:          MakeTeX configuration.
+* ucbinclude, avoiding:                  Running make.
+* UKTUG:                                 CD-ROM distribution.
+* Ultrix shells and configure:           configure shells.
+* unable to find files:                  Unable to find files.
+* unable to generate fonts:              Unable to generate fonts.
+* uname:                                 Bug checklist.
+* universe, BSD vs. system V:            Running make.
+* UNIX_ST_LINK:                          Subdirectory expansion.
+* unixtex.ftp:                           unixtex.ftp.
+* unixtex@u.washington.edu:              Tape distribution.
+* unknown special warnings:              Suppressing warnings.
+* unreadable file warnings:              Suppressing warnings.
+* unreadable files:                      Searching overview.
+* unusable ls-R warning:                 ls-R.
+* usage patterns, finding:               Logging.
+* USE_VARTEXFONTS:                       MakeTeX configuration.
+* Usenet TeX newsgroup:                  Mailing lists.
+* varfonts:                              MakeTeX configuration.
+* variable expansion:                    Variable expansion.
+* variable.c:                            Variable expansion.
+* variable.h:                            Programming with config files.
+* VARTEXFONTS:                           MakeTeX configuration.
+* VAX 11/750:                            History.
+* version number, of Kpathsea:           Kpathsea application distributions.
+* version numbers, determining:          Bug checklist.
+* VF files, not found:                   Searching overview.
+* VFFONTS:                               Supported file formats.
+* VMS support:                           Custom installation.
+* VMS TeX implementations:               Other TeX packages.
+* Vojta, Paul:                           History.
+* Walnut Creek TeX CD-ROM:               CD-ROM distribution.
+* Walsh, Norman:                         History.
+* warning about unusable ls-R:           ls-R.
+* warnings, file access:                 Searching overview.
+* warnings, pointer combinations:        Pointer combination warnings.
+* warnings, suppressing:                 Suppressing warnings.
+* wcstombs:                              dlopen.
+* whitespace, in fontmap files:          Fontmap.
+* whitespace, not ignored on continuation lines: Config files.
+* Windows TeX implementations:           Other TeX packages.
+* World Wide Web CTAN access:            Electronic distribution.
+* www.tug.org:                           unixtex.ftp.
+* X11 previewer:                         Kpathsea application distributions.
+* X11, lacking on NeXT:                  Kpathsea application distributions.
+* XCFLAGS:                               Running make.
+* XCPPFLAGS:                             Running make.
+* XDEFS:                                 Running make.
+* XDVIFONTS:                             Supported file formats.
+* XDVIMAKEPK:                            MakeTeX script names.
+* XDVISIZES:                             Fallback font.
+* XLDFLAGS:                              Running make.
+* XLOADLIBES:                            Running make.
+* XMAKEARGS:                             Running make.
+* Xmu library problems:                  ShellWidgetClass.
+* XtStrings:                             XtStrings.
+* zuhn, david:                           History.
+* { expansion:                           Brace expansion.
+* ~ expansion:                           Tilde expansion.
+
+
+
+Tag Table:
+Node: Top1433
+Node: Introduction2080
+Node: History4437
+Node: Installation8250
+Node: Simple installation9023
+Node: Custom installation12062
+Node: Disk space13230
+Node: Kpathsea application distributions14090
+Node: Changing search paths15194
+Node: Default path features16385
+Node: Default path generation18513
+Node: Running configure19944
+Node: configure shells20990
+Node: configure options21759
+Node: configure environment22970
+Node: configure scenarios24758
+Node: Shared library26369
+Node: Running make27616
+Node: Installing files29648
+Node: Cleaning up31583
+Node: Filename database generation32618
+Node: MakeTeX scripts33179
+Node: MakeTeX configuration34140
+Node: MakeTeX script names37184
+Node: MakeTeX script arguments38287
+Node: Installation testing40355
+Node: Security40719
+Node: TeX directory structure42950
+Node: unixtex.ftp47362
+Node: Electronic distribution48931
+Node: CD-ROM distribution51252
+Node: Tape distribution52926
+Node: Other TeX packages53786
+Node: Reporting bugs55075
+Node: Bug checklist55810
+Node: Mailing lists59900
+Node: Debugging61245
+Node: Logging65404
+Node: Common problems66902
+Node: Unable to find files67652
+Node: Slow path searching70064
+Node: Unable to generate fonts71427
+Node: TeX or Metafont failing72978
+Node: XtStrings74335
+Node: dlopen75163
+Node: ShellWidgetClass75965
+Node: Pointer combination warnings77579
+Node: Path searching77954
+Node: Searching overview78599
+Node: Path sources81959
+Node: Config files83024
+Node: Path expansion86519
+Node: Default expansion87383
+Node: Variable expansion89106
+Node: Tilde expansion90474
+Node: Brace expansion91358
+Node: Subdirectory expansion92150
+Node: Filename database94478
+Node: ls-R95784
+Node: Filename aliases98662
+Node: Database format99827
+Node: Invoking kpsewhich100839
+Node: Path searching options101708
+Node: Auxiliary tasks105363
+Node: Standard options106604
+Node: TeX support106914
+Node: Supported file formats108201
+Node: File lookup113362
+Node: Glyph lookup114701
+Node: Basic glyph lookup115825
+Node: Fontmap116692
+Node: Fallback font119290
+Node: Suppressing warnings120246
+Node: Programming121303
+Node: Programming overview121751
+Node: Calling sequence123667
+Node: Programming with config files128053
+Node: Index129337
+
+End Tag Table
new file mode 100644
--- /dev/null
+++ b/kpathsea/kpathsea.texi
@@ -0,0 +1,2036 @@
+\input texinfo
+@setfilename kpathsea.info
+@settitle Kpathsea: A library for path searching
+
+@set version 3.0
+@set month-year February 1997
+
+@c Define new indices for commands, filenames, and options.
+@defcodeindex cm
+@defcodeindex fl
+@defcodeindex op
+
+@c Put everything in one index (arbitrarily chosen to be the concept index).
+@syncodeindex cm cp
+@syncodeindex fl cp
+@syncodeindex fn cp
+@syncodeindex ky cp
+@syncodeindex op cp
+@syncodeindex pg cp
+@syncodeindex tp cp
+@syncodeindex vr cp
+
+@dircategory TeX
+@direntry
+* Kpathsea: (kpathsea).              File lookup along search paths.
+* kpsewhich: (kpathsea)Invoking kpsewhich.      TeX file searching.
+* MakeTeXMF: (kpathsea)MakeTeX scripts.         MF source generation.
+* MakeTeXPK: (kpathsea)MakeTeX scripts.         PK bitmap generation.
+* MakeTeXTeX: (kpathsea)MakeTeX scripts.        TeX source generation.
+* MakeTeXTFM: (kpathsea)MakeTeX scripts.        TeX font metric generation.
+* MakeTeXls-R: (kpathsea)Filename database.     Update ls-R.
+@end direntry
+
+@ifinfo
+This file documents the Kpathsea library for path searching.
+
+Copyright (C) 1993, 94, 95, 96, 97 K. Berry.
+
+Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+@ignore
+Permission is granted to process this file through TeX and print the
+results, provided the printed document carries a copying permission
+notice identical to this one except for the removal of this paragraph
+(this paragraph not being relevant to the printed manual).
+@end ignore
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions,
+except that this permission notice may be stated in a translation
+approved by the Free Software Foundation.
+@end ifinfo
+
+
+@titlepage
+
+@title Kpathsea library
+@subtitle for version @value{version}
+@subtitle @value{month-year}
+@author K. Berry (@email{kb@@mail.tug.org})
+
+@page
+
+@vskip 0pt plus 1filll
+Copyright @copyright{} 1993, 94, 95, 96, 97 K. Berry.
+
+Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice are
+preserved on all copies.
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided that the
+entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions,
+except that this permission notice may be stated in a translation
+approved by the Free Software Foundation.
+@end titlepage
+
+
+@ifinfo
+@node Top
+@top Kpathsea library
+
+This manual documents how to install and use the Kpathsea library for
+filename lookup.  It corresponds to version @value{version},
+released in @value{month-year}.
+
+@menu
+* Introduction::                Overview.
+* Installation::                Compilation, installation, and bug reporting.
+
+* Path searching::              How filename lookups work.
+* TeX support::                 Special support for TeX-related file lookups.
+
+* Programming::                 How to use Kpathsea features in your program.
+
+* Index::                       General index.
+@end menu
+@end ifinfo
+
+
+@node Introduction
+@chapter Introduction
+
+@cindex introduction
+@cindex fundamental purpose of Kpathsea
+
+This manual corresponds to version @value{version} of the Kpathsea
+library, released in @value{month-year}.
+
+The library's fundamental purpose is to return a filename from a list of
+directories specified by the user, similar to what shells do when
+looking up program names to execute.
+
+@cindex programs using the library
+The following software, all of which I maintain, uses this library:
+
+@itemize @bullet
+@item Dviljk (see the @samp{dvilj} man page)
+@item Dvipsk (@pxref{Top, , Introduction, dvips, Dvips: A DVI driver})
+@item GNU font utilities (@pxref{Top, , Introduction, fontu, GNU font
+utilities})
+@item Web2c (@pxref{Top, , Introduction, web2c, Web2c: A @TeX{}
+implementation})
+@item Xdvik (see the @samp{xdvi} man page)
+@end itemize
+
+@noindent Other software that I do not maintain also uses it.
+
+@cindex interface, not frozen
+@cindex comments, making
+@cindex suggestions, making
+I am still actively maintaining the library (and probably always will
+be, despite my hopes).  If you have comments or suggestions, please send
+them to me (@pxref{Reporting bugs}).
+
+@cindex conditions for use
+@cindex license for using the library
+@cindex GNU General Public License
+I distribute the library under the GNU Library General Public License
+(LGPL), with one exception (see below).  In short, this means if you
+write a program using the library, you must (offer to) distribute the
+source to the library, along with any changes you have made, and allow
+anyone to modify the library source and distribute their modifications.
+It does not mean you have to distribute the source to your program,
+although I hope you will.
+
+The exception is the part of the file @file{expand.c} which implements
+brace expansion.  I took this from Bash, which is covered by the GNU
+General Public License (GPL).  Therefore, if you wish to redistribute
+the library under the LGPL, you must remove this code.  (If you write a
+replacement I can distribute, I hope you'll share it with me.)  See the
+files @file{COPYING} and @file{COPYING.LIB} for the text of the GNU licenses.
+
+@cindex @TeX{} Users Group
+If you know enough about @TeX{} to be reading this manual, then you (or
+your institution) should consider joining the @TeX{} Users Group (if
+you're already a member, great!).  TUG produces the periodical
+@cite{TUGboat}, sponsors an annual meeting and publishes the
+proceedings, and arranges courses on @TeX{} for all levels of users
+throughout the world.  Anyway, here is the address:
+
+@flindex tug@@tug.org
+@display
+@TeX{} Users Group
+870 Market St. #801
+San Francisco, CA 94102  USA
+phone: +1 (415) 982-8449
+fax:   +1 (415) 982-8559
+email: @email{tug@@tug.org}
+@end display
+
+@menu
+* History::
+@end menu
+
+
+@node History
+@section History
+
+@cindex history of Kpathsea
+
+@cindex Knuth, Donald E.
+(This section is for those people who are curious about how the library
+came about.)  (If you like to read historical accounts of software, I
+urge you to seek out the GNU Autoconf manual and the ``Errors of
+@TeX{}'' paper by Don Knuth, published in @cite{Software---Practice and
+Experience} 19(7), July 1989.)
+
+@cindex Morgan, Tim
+@cindex Rokicki, Tom
+@cindex VAX 11/750
+@cindex Sun 2
+@pindex pxp @r{Pascal preprocessor}
+@pindex pc @r{Pascal compiler}
+My first ChangeLog entry for Web2c seems to be February 1990, but I may
+have done some work before then.  In any case, Tim Morgan and I were
+jointly maintaining it for a time.  (I should mention here that Tim had
+made Web2c into a real distribution long before I had ever used it or
+even heard of it, and Tom Rokicki did the original implementation.  I
+was using @code{pxp} and @code{pc} on VAX 11/750's and the hot new Sun 2
+machines.)
+
+It must have been later in 1990 and 1991 that I started working on
+@cite{@TeX{} for the Impatient}. Dvips, Xdvi, Web2c, and the GNU
+fontutils (which I was also writing at the time) all used different
+environment variables, and, more importantly, had different bugs in
+their path searching. This became extremely painful, as I was stressing
+everything to the limit working on the book.  I also desperately wanted
+to implement subdirectory searching, since I couldn't stand putting
+everything in one big directory, and also couldn't stand having to
+explicitly specify @file{cm}, @file{pandora}, @dots{} in a path.
+
+@cindex Vojta, Paul
+In the first incarnation, I just hacked separately on each
+program---that was the original subdirectory searching code in both Xdvi
+and Dvips, though I think Paul Vojta has completely rewritten Xdvi's
+support by now.  That is, I tried to go with the flow in each program,
+rather than changing the program's calling sequences to conform to
+common routines.
+
+Then, as bugs inevitably appeared, I found I was fixing the same thing
+three times (Web2c and fontutils were always sharing code, since I
+maintained those---there was no Dvipsk or Xdvik or Dviljk at this
+point).  After a while, I finally started sharing source files.  They
+weren't yet a library, though.  I just kept things up to date with shell
+scripts.  (I was developing on a 386 running ISC 2.2 at the time, and so
+didn't have symbolic links.  An awful experience.)
+
+@cindex MacKenzie, David
+The ChangeLogs for Xdvik and Dvipsk record initial releases of those
+distributions in May and June 1992.  I think it was because I was tired
+of the different configuration strategies of each program, not so much
+because of the path searching.  (Autoconf was being developed by David
+MacKenzie and others, and I was adapting it to @TeX{} and friends.)
+
+@cindex zuhn, david
+I started to make a separate library that other programs could link with
+on my birthday in April 1993, according to the ChangeLog.  I don't
+remember exactly why I finally took the time to make it a separate
+library; a conversation with david zuhn that initiated it.  Just seemed
+like it was time.
+
+@cindex Walsh, Norman
+@cindex Neumann, Gustaf
+Dviljk got started in March 1994 after I bought a Laserjet 4.  (Kpathsea
+work got suspended while Norm Walsh and I, with Gustaf Neumann's help,
+implemented a way for @TeX{} to get at all those neat builtin LJ4 fonts
+@dots{} such a treat to have something to typeset in besides Palatino!)
+
+By spring of 1995, I had implemented just about all the path-searching
+features in Kpathsea that I plan to, driven beyond my initial goals by
+Thomas Esser and others.  I then started to integrate Web2c with
+Kpathsea. After the release of a stable Web2c, I hope to be able to stop
+development, and turn most of my attention back to making fonts for GNU.
+(Always assuming Micros**t hasn't completely obliterated Unix by then,
+or that software patents haven't stopped software development by anybody
+smaller than a company with a million-dollar-a-year legal budget.  Which
+is actually what I think is likely to happen, but that's another
+story@dots{})
+
+@include install.texi
+@include hier.texi
+@include unixtex.texi
+@include bugs.texi
+
+
+@node Path searching
+@chapter Path searching
+
+@cindex path searching
+
+This chapter describes the generic path searching mechanism Kpathsea
+provides.  For information about searching for particular file types
+(e.g., @TeX{} fonts), see the next chapter.
+
+@menu
+* Searching overview::          Basic scheme for searching.
+* Path sources::                Where search paths can be defined.
+* Path expansion::              Special constructs in search paths.
+* Filename database::           Using an externally-built list to search.
+* Invoking kpsewhich::          Standalone path lookup.
+@end menu
+
+
+@node Searching overview
+@section Searching overview
+
+@cindex searching overview
+@cindex path searching, overview
+@cindex overview of path searching
+
+@cindex search path, defined
+A @dfn{search path} is a colon-separated list of @dfn{path elements},
+which are directory names with a few extra frills.  A search path can
+come from (a combination of) many sources; see below.  To look up a file
+@samp{foo} along a path @samp{.:/dir}, Kpathsea checks each element of
+the path in turn: first @file{./foo}, then @file{/dir/foo}, returning
+the first match (or possibly all matches).
+
+@cindex magic characters
+@kindex : @r{may not be :}
+@kindex / @r{may not be /}
+The ``colon'' and ``slash'' mentioned here aren't necessarily @samp{:}
+and @samp{/} on non-Unix systems.  Kpathsea tries to adapt to other
+operating systems' conventions.
+
+@cindex database search
+@cindex searching the database
+To check a particular path element @var{e}, Kpathsea first sees if a
+prebuilt database (@pxref{Filename database}) applies to @var{e}, i.e.,
+if the database is in a directory that is a prefix of @var{e}.  If so,
+the path specification is matched against the contents of the database.
+
+@cindex floating directories
+@cindex filesystem search
+@cindex disk search
+@cindex searching the disk
+If the database does not exist, or does not apply to this path element,
+or contains no matches, the filesystem is searched (if this was not
+forbidden by the specification with @samp{!!} and if the file being
+searched for must exist).  Kpathsea constructs the list of directories
+that correspond to this path element, and then checks in each for the
+file being searched for.  (To help speed future lookups of files in the
+same directory, the directory in which a file is found is floated to the
+top of the directory list.)
+
+@cindex must exist
+@cindex VF files, not found
+@flindex cmr10.vf
+@findex \openin
+The ``file must exist'' condition comes into play with VF files and
+input files read by the @TeX{} @samp{\openin} command.  These files may
+not exist (consider @file{cmr10.vf}), and so it would be wrong to search
+the disk for them.  Therefore, if you fail to update @file{ls-R} when
+you install a new VF file, it will never be found.
+
+Each path element is checked in turn: first the database, then the disk.
+If a match is found, the search stops and the result is returned.  This
+avoids possibly-expensive processing of path specifications that are
+never needed on a particular run.  (Unless the search explicitly
+requested all matches.)
+
+@cindex expansion, path element
+Although the simplest and most common path element is a directory name,
+Kpathsea supports additional features in search paths: layered default
+values, environment variable names, config file values, users' home
+directories, and recursive subdirectory searching.  Thus, we say that
+Kpathsea @dfn{expands} a path element, meaning transforming all thel
+magic specifications into the basic directory name or names.  This
+process is described in the sections below.  It happens in the same
+order as the sections.
+
+@cindex absolute filenames
+@cindex relative filenames
+@cindex explicitly relative filenames
+@cindex filenames, absolute or explicitly relative
+Exception to all of the above: If the filename being searched for is
+absolute or explicitly relative, i.e., starts with @samp{/} or @samp{./}
+or @samp{../}, Kpathsea simply checks if that file exists.
+
+@cindex permission denied
+@cindex unreadable files
+@cindex access warnings
+@cindex warnings, file access
+@flindex lost+found @r{directory}
+@vindex TEX_HUSH
+Ordinarily, if Kpathsea tries to access a file or directory that cannot
+be read, it gives a warning.  This is so you will be alerted to
+directories or files that accidentally lack read permission (for
+example, a @file{lost+found}).  If you prefer not to see these warnings,
+include the value @samp{readable} in the @code{TEX_HUSH} environment
+variable or config file value.
+
+This generic path searching algorithm is implemented in
+@file{kpathsea/pathsearch.c}.  It is employed by a higher-level
+algorithm when searching for a file of a particular type (@pxref{File
+lookup}, and @ref{Glyph lookup}).
+
+
+@node Path sources
+@section Path sources
+
+@cindex path sources
+@cindex sources for search paths
+
+A search path can come from many sources.  In the order in which
+Kpathsea uses them:
+
+@enumerate
+@item
+@cindex environment variable, source for path
+A user-set environment variable, e.g., @code{TEXINPUTS}.
+Environment variables with an underscore and the program name appended
+override; for example, @code{TEXINPUTS_latex} overrides @code{TEXINPUTS}
+if the program being run is named @samp{latex}.
+
+@item
+A program-specific configuration file, e.g., an @samp{S /a:/b} line in
+Dvips' @file{config.ps} (@pxref{Config files,,, dvips, Dvips}).
+
+@item
+@cindex configuration file, source for path
+@cindex Kpathsea config file, source for path
+@flindex texmf.cnf@r{, source for path}
+A line in a Kpathsea configuration file @file{texmf.cnf}, e.g.,
+@samp{TEXINPUTS=/c:/d} (see below).
+
+@item
+@cindex compilation value, source for path
+The compile-time default (specified in @file{kpathsea/paths.h}).
+@end enumerate
+
+You can see each of these values for a given search path by using the
+debugging options (@pxref{Debugging}).
+
+These sources may be combined via default expansion (@pxref{Default
+expansion}).
+
+@menu
+* Config files::        Kpathsea's runtime config files (texmf.cnf).
+@end menu
+
+
+@node Config files
+@subsection Config files
+
+@cindex config files
+@flindex texmf.cnf@r{, definition for}
+
+@cindex runtime configuration files
+@vindex TEXMFCNF
+As mentioned above, Kpathsea reads @dfn{runtime configuration files}
+named @file{texmf.cnf} for search path and other definitions.  The
+search path used to look for these configuration files is named
+@code{TEXMFCNF}, and is constructed in the usual way, as described
+above, except that configuration files cannot be used to define the
+path, naturally; also, an @file{ls-R} database is not used to search for
+them.
+
+Kpathsea reads @emph{all} @file{texmf.cnf} files in the search path, not
+just the first one found; definitions in earlier files override those in
+later files.  Thus, with the search path of @samp{.:$TEXMF}, values from
+@file{./texmf.cnf} override those from @file{$TEXMF/texmf.cnf}.
+
+While (or instead of) reading this description, you may find it helpful
+to look at the distributed @file{texmf.cnf}, which uses or at least
+mentions most features.  The format of @file{texmf.cnf} files follows:
+
+@itemize @bullet
+@item
+@cindex comments, in @file{texmf.cnf}
+Comments start with @samp{%} and continue to the end of the line.
+
+@item
+@cindex blank lines, in @file{texmf.cnf}
+Blank lines are ignored.
+
+@item
+@cindex backslash-newline
+@cindex continuation character
+@cindex whitespace, not ignored on continuation lines
+@kindex \@r{, line continuation in @file{texmf.cnf}}
+A @samp{\} at the end of a line acts as a continuation character, i.e.,
+the next line is appended.  Whitespace at the beginning of continuation
+lines is not ignored.
+
+@item Each remaining line must look like
+
+@example
+@var{variable} @r{[}. @var{progname}@r{]} @r{[}=@r{]} @var{value}
+@end example
+
+@noindent where the @samp{=} and surrounding whitespace is optional.
+
+@item 
+@cindex identifiers, characters valid in
+The @var{variable} name may contain any character other than whitespace,
+@samp{=}, or @samp{.}, but sticking to @samp{A-Za-z_} is safest.
+
+@item If @samp{.@var{progname}} is present, the definition only
+applies if the program that is running is named (i.e., the last
+component of @code{argv[0]} is) @var{progname} or
+@file{@var{progname}.exe}.  This allows different flavors of @TeX{} to
+have different search paths, for example.
+
+@item 
+@cindex right-hand side of variable assignments
+@var{value} may contain any characters except @samp{%} and @samp{@@}.
+(These restrictions are only necessary because of the processing done on
+@file{texmf.cnf} at build time, so you can stick those characters in
+after installation if you have to.)  The @samp{$@var{var}.@var{prog}}
+feature is not available on the right-hand side; instead, you must use
+an additional variable (see below for example).  A @samp{;} in
+@var{value} is translated to @samp{:} if running under Unix; this is
+useful to write a single @file{texmf.cnf} which can be used under both
+Unix and NT.  (If you really want @samp{;}'s in your filenames, add
+@samp{-DALLOW_SEMICOLON_IN_FILENAMES} to @code{CFLAGS}.)
+
+@item All definitions are read before anything is expanded, so you can
+use variables before they are defined (like Make, unlike most other
+programs).
+@end itemize
+
+@noindent Here is a configuration file fragment illustrating most of
+these points:
+
+@example
+% TeX input files -- i.e., anything to be found by \input or \openin ...
+latex209_inputs = .:$TEXMF/tex/latex209//:$TEXMF/tex//
+latex2e_inputs = .:$TEXMF/tex/latex//:$TEXMF/tex//
+TEXINPUTS = .:$TEXMF/tex//
+TEXINPUTS.latex209 = $latex209_inputs
+TEXINPUTS.latex2e = $latex2e_inputs
+TEXINPUTS.latex = $latex2e_inputs
+@end example
+
+@cindex shell scripts as configuration files
+@cindex configuration files as shell scripts.
+Although this format has obvious similarities to Bourne shell
+scripts---change the comment character to @code{#}, disallow spaces
+around the @code{=}, and get rid of the @code{.@var{name}} convention,
+and it could be run through the shell.  But there seemed little
+advantage to doing this, since all the information would have to passed
+back to Kpathsea and parsed there anyway, since the @code{sh} process
+couldn't affect its parent's environment.
+
+@flindex cnf.c
+The implementation of all this is in @file{kpathsea/cnf.c}.
+
+
+@node Path expansion
+@section Path expansion
+
+@cindex path expansion
+@cindex expansion, search path
+
+Kpathsea recognizes certain special characters and constructions in
+search paths, similar to that in shells.  As a general example:
+@samp{~$USER/@{foo,bar@}//baz} expands to all subdirectories under
+directories @file{foo} and @file{bar} in @t{$USER}'s home directory that
+contain a directory or file @file{baz}.  These expansions are explained
+in the sections below.
+
+@menu
+* Default expansion::           a: or :a or a::b expands to a default.
+* Variable expansion::          $foo and $@{foo@} expand to environment values.
+* Tilde expansion::             ~ and ~user expand to home directories.
+* Brace expansion::             a@{foo,bar@}b expands to afoob abarb.
+* Subdirectory expansion::      a// and a//b recursively expand to subdirs.
+@end menu
+
+
+@node Default expansion
+@subsection Default expansion
+
+@kindex :: @r{expansion}
+@cindex doubled colons
+@cindex leading colons
+@cindex trailing colons
+@cindex extra colons
+@cindex default expansion
+@cindex expansion, default
+
+If the highest-priority search path (@pxref{Path sources}) contains an
+@dfn{extra colon} (i.e., leading, trailing, or doubled), Kpathsea
+inserts at that point the next-highest-priority search path that is
+defined.  If that inserted path has an extra colon, the same happens
+with the next-highest.  (An extra colon in the compile-time default
+value has unpredictable results, so installers beware.)
+
+For example, given an environment variable setting
+
+@example
+setenv TEXINPUTS /home/karl:
+@end example
+
+@noindent and a @code{TEXINPUTS} value from @file{texmf.cnf} of
+
+@example
+.:$TEXMF//tex
+@end example
+
+@noindent then the final value used for searching will be:
+
+@example
+/home/karl:.:$TEXMF//tex
+@end example
+
+Since Kpathsea looks for multiple configuration files, it would be
+natural to expect that (for example) an extra colon in
+@file{./texmf.cnf} would expand to the path in @file{$TEXMF/texmf.cnf}.
+Or, with Dvips' configuration files, that an extra colon in
+@file{config.$PRINTER} would expand to the path in @file{config.ps}.
+This doesn't happen.  It's not clear this would be desirable in all
+cases, and trying to devise a way to specify the path to which the extra
+colon should expand seemed truly baroque.
+@cindex Bach, Johann Sebastian
+
+Technicality: Since it would be useless to insert the default value in
+more than one place, Kpathsea changes only one extra @samp{:} and leaves
+any others in place (where they will eventually be equivalent to
+@samp{.}, i.e., the current directory).  Kpathsea checks first for a
+leading @samp{:}, then a trailing @samp{:}, then a doubled @samp{:}.
+
+@flindex kdefault.c
+You can trace this by debugging ``paths'' (@pxref{Debugging}).
+Default expansion is implemented in the source file
+@file{kpathsea/kdefault.c}.
+
+
+@node Variable expansion
+@subsection Variable expansion
+
+@kindex $ @r{expansion}
+@cindex environment variables in paths
+@cindex variable expansion
+@cindex expansion, variable
+@flindex texmf.cnf@r{, and variable expansion}
+
+@samp{$foo} or @samp{$@{foo@}} in a path element is replaced by (1) the
+value of an environment variable @samp{foo} (if defined); (2) the value
+of @samp{foo} from @file{texmf.cnf} (if defined); (3) the empty string.
+
+If the character after the @samp{$} is alphanumeric or @samp{_}, the
+variable name consists of all consecutive such characters. If the
+character after the @samp{$} is a @samp{@{}, the variable name consists
+of everything up to the next @samp{@}} (braces may not be nested).
+Otherwise, Kpathsea gives a warning and ignores the @samp{$} and its
+following character.
+
+@cindex quoting variable values
+@cindex shell variables
+You must quote the @t{$}'s and braces as necessary for your shell.
+@emph{Shell} variable values cannot be seen by Kpathsea, i.e., ones
+defined by @code{set} in C shells and without @code{export} in Bourne
+shells.
+
+For example, given
+@example
+setenv tex /home/texmf
+setenv TEXINPUTS .:$tex:$@{tex@}prev
+@end example
+@noindent the final @code{TEXINPUTS} path is the three directories:
+@example
+.:/home/texmf:/home/texmfprev
+@end example
+
+The @samp{.@var{progname}} suffix on variables and
+@samp{_@var{progname}} on environment variable names are not implemented
+for general variable expansions.  These are only recognized when search
+paths are initialized (@pxref{Path sources}).
+
+@flindex variable.c
+Variable expansion is implemented in the source file
+@file{kpathsea/variable.c}.
+
+
+@node Tilde expansion
+@subsection Tilde expansion
+
+@kindex ~ @r{expansion}
+@cindex home directories in paths
+@cindex tilde expansion
+@cindex expansion, tilde
+
+@vindex HOME@r{, as ~ expansion}
+A leading @samp{~} in a path element is replaced by the value of the
+environment variable @code{HOME}, or @file{.} if @code{HOME} is not set.
+
+A leading @samp{~@var{user}} in a path element is replaced by
+@var{user}'s home directory from the system @file{passwd} database.
+
+For example,
+@example
+setenv TEXINPUTS ~/mymacros:
+@end example
+
+@noindent will prepend a directory @file{mymacros} in your home
+directory to the default path.
+
+@cindex @t{root} user
+@cindex trailing @samp{/} in home directory
+@kindex /@r{, trailing in home directory}
+As a special case, if a home directory ends in @samp{/}, the trailing
+slash is dropped, to avoid inadvertently creating a @samp{//} construct
+in the path.  For example, if the home directory of the user @samp{root}
+is @samp{/}, the path element @samp{~root/mymacros} expands to just
+@samp{/mymacros}, not @samp{//mymacros}.
+
+@flindex tilde.c
+Tilde expansion is implemented in the source file @file{kpathsea/tilde.c}.
+
+
+@node Brace expansion
+@subsection Brace expansion
+
+@kindex @{ @r{expansion}
+@cindex brace expansion
+
+@samp{x@{@var{a},@var{b}@}y} expands to @samp{x@var{a}y:x@var{b}y}.
+For example:
+
+@example
+foo/@{1,2@}/baz
+@end example
+
+@noindent expands to @samp{foo1baz:foo2baz}.  @samp{:} is the path
+separator on the current system; e.g., on a DOS system, it's @samp{;}.
+
+Braces can be nested; for example, @samp{x@{a,b@{1,2@}@}y} expands to
+@samp{xay:xb1y:xb2y}.
+
+@cindex multiple @TeX{} hierarchies
+This feature can be used to implement multiple @TeX{} hierarchies, by
+assigning a brace list to @code{$TEXMF}, as mentioned in
+@file{texmf.cnf.in}.
+
+@flindex expand.c
+Brace expansion is implemented in the source file
+@file{kpathsea/expand.c}.  It is taken from Bash, and is thus covered
+by the GNU General Public License, rather than the Library General
+Public License that covers the rest of Kpathsea.
+
+
+@node Subdirectory expansion
+@subsection Subdirectory expansion
+
+@kindex //
+@cindex subdirectory searching
+@cindex expansion, subdirectory
+
+@cindex alphabetical order, not
+Two or more consecutive slashes in a path element following a directory
+@var{d} is replaced by all subdirectories of @var{d}: first those
+subdirectories directly under @var{d}, then the subsubdirectories under
+those, and so on.  At each level, the order in which the directories are
+searched is unspecified.  (It's ``directory order'', and definitely not
+alphabetical.)
+
+If you specify any filename components after the @samp{//}, only
+subdirectories which match those components are included.  For example,
+@samp{/a//b} would expand into directories @file{/a/1/b}, @file{/a/2/b},
+@file{/a/1/1/b}, and so on, but not @file{/a/b/c} or @file{/a/1}.
+
+You can include multiple @samp{//} constructs in the path.
+
+@samp{//} at the beginning of a path is ignored; you didn't really want
+to search every directory on the system, did you?
+
+@cindex trick for detecting leaf directories
+@cindex leaf directory trick
+@cindex Farwell, Matthew
+@cindex MacKenzie, David
+I should mention one related implementation trick, which I took from GNU
+find.  Matthew Farwell suggested it, and David MacKenzie implemented it.
+
+@vindex st_nlink
+The trick is that in every real Unix implementation (as opposed to the
+POSIX specification), a directory which contains no subdirectories will
+have exactly two links (namely, one for @file{.} and one for @file{..}).
+That is to say, the @code{st_nlink} field in the @samp{stat} structure
+will be two.  Thus, we don't have to stat everything in the bottom-level
+(leaf) directories---we can just check @code{st_nlink}, notice it's two,
+and do no more work.
+
+But if you have a directory that contains a single subdirectory and 500
+regular files, @code{st_nlink} will be 3, and Kpathsea has to stat every
+one of those 501 entries.  Therein lies slowness.
+
+@vindex UNIX_ST_LINK
+You can disable the trick by undefining @code{UNIX_ST_LINK} in
+@file{kpathsea/config.h}. (It is undefined by default except under Unix.)
+
+@flindex elt-dirs.c
+Unfortunately, in some cases files in leaf directories are
+@code{stat}'d: if the path specification is, say,
+@samp{$TEXMF/fonts//pk//}, then files in a subdirectory
+@samp{@dots{}/pk}, even if it is a leaf, are checked. The reason cannot
+be explained without reference to the implementation, so read
+@file{kpathsea/elt-dirs.c} (search for @samp{may descend}) if you are
+curious.  And if you can find a way to @emph{solve} the problem, please
+let me know.
+
+@flindex elt-dirs.c
+Subdirectory expansion is implemented in the source file
+@file{kpathsea/elt-dirs.c}.
+
+
+@node Filename database
+@section Filename database (@code{ls-R})
+
+@cindex filename database
+@cindex database, for filenames
+@cindex externally-built filename database
+
+Kpathsea goes to some lengths to minimize disk accesses for searches
+(@pxref{Subdirectory expansion}).  Nevertheless, at installations with
+enough directories, searching each possible directory for a given file
+can take an excessively long time (depending on the speed of the disk,
+whether it's NFS-mounted, how patient you are, etc.).
+
+In practice, a font tree containing the standard PostScript and PCL
+fonts is large enough for searching to be noticeably slow on typical
+systems these days.  Therefore, Kpathsea can use an externally-built
+``database'' file named @file{ls-R} that maps files to directories, thus
+avoiding the need to exhaustively search the disk.
+
+A second database file @file{aliases} allows you to give additional
+names to the files listed in @file{ls-R}.  This can be helpful to adapt
+to ``8.3'' filename conventions in source files.
+
+The @file{ls-R} and @file{aliases} features are implemented in the
+source file @file{kpathsea/db.c}.
+
+@menu
+* ls-R::                        The main filename database.
+* Filename aliases::            Aliases for those names.
+* Database format::             Syntax details of the database file.
+@end menu
+
+
+@node ls-R
+@subsection @file{ls-R}
+
+@flindex ls-R @r{database file}
+@vindex TEXMFDBS
+
+As mentioned above, you must name the main filename database
+@file{ls-R}.  You can put one at the root of each @TeX{} installation
+hierarchy you wish to search (@code{$TEXMF} by default); most sites have
+only one hierarchy.  Kpathsea looks for @file{ls-R} files along the
+@code{TEXMFDBS} path, so that should presumably match the list of
+hierarchies.
+
+The recommended way to create and maintain @samp{ls-R} is to run the
+@code{MakeTeXls-R} script, which is installed in @samp{$(bindir)}
+(@file{/usr/local/bin} by default).  That script goes to some trouble to
+follow symbolic links as necessary, etc.  It's also invoked by the
+distributed @samp{MakeTeX@dots{}} scripts.
+
+@flindex ls-R@r{, simplest build}
+At its simplest, though, you can build @file{ls-R} with the command
+@example
+cd @var{/your/texmf/root} && ls -LAR ./ >ls-R
+@end example
+
+@noindent
+@opindex --color=tty
+@flindex /etc/profile @r{and aliases}
+presuming your @code{ls} produces the right output format (see the
+section below).  GNU @code{ls}, for example, outputs in this format.
+Also presuming your @code{ls} hasn't been aliased in a system file
+(e.g., @file{/etc/profile}) to something problematic, e.g., @samp{ls
+--color=tty}.  In that case, you will have to disable the alias before
+generating @file{ls-R}.  For the precise definition of the file format,
+@pxref{Database format}.
+
+Regardless of whether you use the supplied script or your own, you will
+almost certainly want to invoke it via @code{cron}, so when you make
+changes in the installed files (say if you install a new La@TeX{}
+package), @file{ls-R} will be automatically updated.
+
+@opindex -A @r{option to @code{ls}}
+@cindex dot files
+@flindex . @r{files}
+@flindex . @r{directories, ignored}
+@flindex .tex @r{file, included in @file{ls-R}}
+The @samp{-A} option to @code{ls} includes files beginning with @samp{.}
+(except for @file{.} and @file{..}), such as the file @file{.tex}
+included with the La@TeX{} tools package.  (On the other hand,
+@emph{directories} whose names begin with @samp{.} are always ignored.)
+
+@cindex symbolic links, and @file{ls-R}
+@opindex -L @r{option to @code{ls}}
+If your system does not support symbolic links, omit the @samp{-L}.
+
+@cindex automounter, and @file{ls-R}
+@cindex NFS and @file{ls-R}
+@code{ls -LAR @var{/your/texmf/root}} will also work.  But using
+@samp{./} avoids embedding absolute pathnames, so the hierarchy can be
+easily transported.  It also avoids possible trouble with automounters
+or other network filesystem conventions.
+
+@cindex warning about unusable @file{ls-R}
+@cindex unusable @file{ls-R} warning
+Kpathsea warns you if it finds an @file{ls-R} file, but the file does
+not contain any usable entries.  The usual culprit is running plain
+@samp{ls -R} instead of @samp{ls -LR ./} or @samp{ls -R
+@var{/your/texmf/root}}.  Another possibility is some system directory
+name starting with a @samp{.} (perhaps if you are using AFS); Kpathsea
+ignores everything under such directories.
+
+@kindex !! @r{in path specifications}
+@cindex disk searching, avoiding
+Because the database may be out-of-date for a particular run, if a file
+is not found in the database, by default Kpathsea goes ahead and
+searches the disk. If a particular path element begins with @samp{!!},
+however, @emph{only} the database will be searched for that element,
+never the disk.  If the database does not exist, nothing will be
+searched.  Because this can surprise users (``I see the font
+@file{foo.tfm} when I do an @code{ls}; why can't Dvips find it?''), it
+is not in any of the default search paths.
+
+
+@node Filename aliases
+@subsection Filename aliases
+
+@cindex filename aliases
+@cindex aliases, for filenames
+
+In some circumstances, you may wish to find a file under several names.
+For example, suppose a @TeX{} document was created using a DOS system
+and tries to read @file{longtabl.sty}.  But now it's being run on a Unix
+system, and the file has its original name, @file{longtable.sty}.  The
+file won't be found.  You need to give the actual file
+@file{longtable.sty} an alias @samp{longtabl.sty}.
+
+@c As another example, suppose you are creating a @TeX{} distribution on a
+@c CD-ROM or a DOS system; then the file @file{mf.base} gets stored as
+@c @file{mf.bas}.  But Metafont on Unix wants to find @file{mf.base}.  Here
+@c you need to give the actual file @file{mf.bas} an alias @samp{mf.base}.
+
+You can handle this by creating a file @file{aliases} as a companion to
+the @file{ls-R} for the hierarchy containing the file in question.  (You
+must have an @file{ls-R} for the alias feature to work.)
+
+The format of @file{aliases} is simple: two whitespace-separated words
+per line; the first is the real name @file{longtable.sty}, and second is
+the alias (@file{longtabl.sty}).  These must be base filenames, with no
+directory components.  @file{longtable.sty} must be in the sibling
+@file{ls-R}.
+
+Also, blank lines and lines starting with @samp{%} or @samp{#} are
+ignored in @file{aliases}, to allow for comments.
+
+If a real file @file{longtabl.sty} exists, it is used regardless of any
+aliases.
+
+
+@node Database format
+@subsection Database format
+
+@cindex format of external database
+@cindex database, format of
+
+The ``database'' read by Kpathsea is a line-oriented file of plain
+text. The format is that generated by GNU (and most other) @code{ls}
+programs given the @samp{-R} option, as follows.
+
+@itemize @bullet
+@item
+Blank lines are ignored.
+
+@item
+If a line begins with @samp{/} or @samp{./} or @samp{../} and ends with
+a colon, it's the name of a directory.  (@samp{../} lines aren't useful,
+however, and should not be generated.)
+
+@item
+All other lines define entries in the most recently seen directory.
+@t{/}'s in such lines will produce possibly-strange results.
+
+@item
+Files with no preceding directory line are ignored.
+@end itemize
+
+For example, here's the first few lines of @file{ls-R} (which totals
+about 30K bytes) on my system:
+
+@example
+bibtex
+dvips
+fonts
+ls-R
+metafont
+metapost
+tex
+web2c
+
+./bibtex:
+bib
+bst
+doc
+
+./bibtex/bib:
+asi.bib
+btxdoc.bib
+@dots{}
+@end example
+
+
+@node Invoking kpsewhich
+@section @code{kpsewhich}: Standalone path searching
+
+@pindex kpsewhich
+@cindex path searching, standalone
+@cindex standalone path searching
+
+The Kpsewhich program exercises the path searching functionality
+independent of any particular application.  This can also be useful as a
+sort of @code{find} program to locate files in your @TeX{} hierarchies,
+perhaps in administrative scripts.  It is used heavily in the
+distributed @samp{MakeTeX@dots{}} scripts.
+
+Synopsis:
+@example
+kpsewhich @var{option}@dots{} @var{filename}@dots{}
+@end example
+
+The options and filename(s) to look up can be intermixed.
+Options can start with either @samp{-} or @samp{--}, and any unambiguous
+abbreviation is accepted.
+
+@menu
+* Path searching options::      Changing the mode, resolution, etc.
+* Auxiliary tasks::             Path and variable expansion.
+* Standard options::            --help and --version.
+@end menu
+
+
+@node Path searching options
+@subsection Path searching options
+
+@cindex path searching options
+
+Kpsewhich looks up each non-option argument on the command line as a
+filename, and returns the first file found.  There is no option to
+return all the files with a particular name (you can run the Unix
+@samp{find} utility for that, @pxref{Invoking find,,, findutils, GNU
+find utilities}).
+
+Various options alter the path searching behavior:
+
+@table @samp
+@item --dpi=@var{num}
+@opindex --dpi=@var{num}
+@opindex -D @var{num}
+@cindex resolution, setting
+Set the resolution to @var{num}; this only affects @samp{gf} and
+@samp{pk} lookups.  @samp{-D} is a synonym, for compatibility with
+Dvips.  Default is 600.
+
+@item --format=@var{name}
+@opindex --format=@var{name}
+Set the format for lookup to @var{name}.  By default, the format is
+guessed from the filename.  In fact, the recognized filename extensions
+and the allowable @var{name}s (including any leading @samp{.}) are the
+same.
+
+You can also specify an integer for @var{name}; this is the only way to
+specify formats that don't have an associated suffix, such as MetaPost
+support files and Dvips configuration files.  It's also somewhat faster,
+since no unused formats need to be initialized.  The integers appear in
+the output of @samp{--help}, and are of course subject to change.
+
+Here's the current list of recognized names and numbers.
+@xref{Supported file formats}, for more information on each of these.
+@example
+gf(0)
+pk(1)
+bitmap font (2)
+.afm(3)
+.base(4)
+.bib(5)
+.bst(6)
+.cnf(7)
+ls-R(8)
+.fmt(9)
+.map(10)
+.mem(11)
+.mf(12)
+.pool(13)
+.mft(14)
+.mp(15)
+.pool(16)
+MetaPost support (17)
+.ocp(18)
+.ofm(19)
+.opl(20)
+.otp(21)
+.ovf(22)
+.ovp(23)
+graphic/figure (24) .eps .epsi
+.tex(25) .ltx .dtx .texi .texinfo .txi .eps .epsi
+TeX documentation (26)
+.pool(27)
+TeX sources (28)
+PostScript header/font (29) .pro
+Troff fonts (30)
+.tfm(31)
+.pfa(32) .pfb
+.vf(33)
+dvips config (34)
+.ist(35)
+@end example
+
+This option and @samp{--path} are mutually exclusive.
+
+@item --interactive
+@opindex --interactive
+@cindex interactive query
+After processing the command line, read additional filenames to look up
+from standard input.
+
+@item -maketex=@var{filetype}
+@itemx -no-maketex=@var{filetype}
+@opindex -maketex=@var{filetype}
+@opindex -no-maketex=@var{filetype}
+Turn on or off the @samp{MakeTeX} script associated with @var{filetype}.
+The only values that make sense for @var{filetype} are @samp{pk},
+@samp{mf}, @samp{tex}, and @samp{tfm}. By default, all are off in
+Kpsewhich.  @xref{MakeTeX scripts}.
+
+@item --mode=@var{string}
+@opindex --mode=@var{string}
+Set the mode name to @var{string}; this also only affects @samp{gf} and
+@samp{pk} lookups.  No default: any mode will be found.  @xref{MakeTeX
+script arguments}.
+
+@item --must-exist
+@opindex --must-exist
+Do everything possible to find the files, notably including searching
+the disk.  By default, only the @file{ls-R} database is checked, in the
+interest of efficiency.
+
+@item --path=@var{string}
+@opindex --path=@var{string}
+Search along the path @var{string} (colon-separated as usual), instead
+of guessing the search path from the filename.  @samp{//} and all the
+usual expansions are supported (@pxref{Path expansion}).  This option
+and @samp{--format} are mutually exclusive.  To output the complete
+directory expansion of a path, instead of doing a one-shot lookup, see
+@samp{--path-expand} in the following section.
+
+@item --progname=@var{name}
+@opindex --progname=@var{name}
+Set the program name to @var{name}; default is @samp{kpsewhich}.  This
+can affect the search paths via the @samp{.@var{prognam}} feature in
+configuration files (@pxref{Config files}).
+@end table
+
+
+@node Auxiliary tasks
+@subsection Auxiliary tasks
+
+@cindex auxiliary tasks
+
+Kpsewhich provides some additional features not strictly related to path
+lookup:
+
+@itemize @bullet
+@item
+@opindex --debug=@var{num}
+@samp{--debug=@var{num}} sets the debugging options to @var{num}.
+@xref{Debugging}.
+
+@item
+@opindex --expand-var=@var{string}
+@samp{--expand-var=@var{string}} outputs the variable expansion of
+@var{string}.  For example, the @samp{MakeTeX@dots{}} scripts run
+@samp{kpsewhich --expand-var='$TEXMF'} to find the root of the @TeX{} system
+hierarchy.  @xref{Path expansion}.
+
+@item
+@opindex --expand-path=@var{string}
+@opindex --separator=@var{string}
+@samp{--expand-path=@var{string}} outputs the complete expansion of
+@var{string} as a colon-separated path.  This is useful to construct a
+search path for a program that doesn't accept recursive subdirectory
+specifications.  The option @samp{--separator=@var{string}} changes the
+separator in the output from @samp{:} to @var{string}.
+
+For one-shot uses of an arbitrary (not built in to Kpathsea) path, see
+@samp{--path} in the previous section.
+
+@item
+@opindex --show-path=@var{name}
+@samp{--show-path=@var{name}} shows the path that would be used for file
+lookups of file type @var{name}.  Either a filename extension
+(@samp{pk}, @samp{.vf}, etc.) or an integer can be used, just as with
+@samp{--format}, described in the previous section.
+@end itemize
+
+
+@node Standard options
+@subsection Standard options
+
+@cindex standard options
+
+Kpsewhich accepts the standard GNU options:
+
+@itemize @bullet
+@item
+@opindex --help
+@samp{--help} prints a help message on standard output and exits.
+
+@item
+@opindex --version
+@samp{--version} prints the Kpathsea version number and exits.
+@end itemize
+
+
+@node TeX support
+@chapter @TeX{} support
+
+@cindex @TeX{} support
+
+Although the basic features in Kpathsea can be used for any type of path
+searching, it came about (like all libraries) with a specific
+application in mind: I wrote Kpathsea specifically for @TeX{} system
+programs.  I had been struggling with the programs I was using (Dvips,
+Xdvi, and @TeX{} itself) having slightly different notions of how to
+specify paths; and debugging was painful, since no code was shared.
+
+Therefore, Kpathsea provides some @TeX{}-specific formats and features.
+Indeed, many of the supposedly generic path searching features were
+provided because they seemed useful in that con@TeX{}t (font lookup,
+particularly).
+
+Kpathsea provides a standard way to search for files of any of the
+supported file types; glyph fonts are a bit different than all the rest.
+Searches are based solely on filenames, not file contents---if a GF
+file is named @file{cmr10.600pk}, it will be found as a PK file.
+
+@menu
+* Supported file formats::      File types Kpathsea knows about.
+* File lookup::                 Searching for most kinds of files.
+* Glyph lookup::                Searching for bitmap fonts.
+* Suppressing warnings::        Avoiding warnings via TEX_HUSH.
+@end menu
+
+
+@node Supported file formats
+@section Supported file formats
+
+@cindex supported file formats
+@cindex file formats, supported
+
+@cindex environment variables for @TeX{}
+@cindex @TeX{} environment variables
+
+Kpathsea has support for a number of file types.  Each file type has a
+list of environment and config file variables that are checked to define
+the search path, and most have a default suffix that plays a role in
+finding files (see the next section).  Some also define additional
+suffixes, and/or a program to be run to create missing files on the fly.
+
+@cindex program-varying paths
+Since environment variables containing periods, such as
+@samp{TEXINPUTS.latex}, are not allowed on some systems, Kpathsea looks
+for environment variables with an underscore, e.g.,
+@samp{TEXINPUTS_latex} (@pxref{Config files}).
+
+The following table lists the above information.
+
+@table @samp
+@item .afm
+@flindex .afm
+@vindex AFMFONTS
+(Adobe font metrics, @pxref{Metric files,,, dvips, Dvips})
+@code{AFMFONTS}.
+
+@item .base
+@flindex .base
+@vindex MFBASES
+@vindex TEXMFINI
+(Metafont memory dump, @pxref{Memory dumps,,, web2c, Web2c})
+@code{MFBASES}, @code{TEXMFINI}.
+
+@item .bib
+@flindex .bib
+@vindex BIBINPUTS
+@vindex TEXBIB
+(Bib@TeX{} bibliography source, @pxref{bibtex invocation,,, web2c, Web2c})
+@code{BIBINPUTS}, @code{TEXBIB}.
+
+@item .bst
+@flindex .bst
+@vindex BSTINPUTS
+(Bib@TeX{} style file, @pxref{Basic BibTeX style files,, Basic Bib@TeX{}
+style files, web2c, Web2c})
+@code{BSTINPUTS}.
+
+@item .cnf
+@flindex .cnf
+@vindex TEXMFCNF
+(Runtime configuration files, @pxref{Config files})
+@code{TEXMFCNF}.
+
+@item ls-R
+@flindex ls-R
+@vindex TEXMFDBS
+(Filename databases, @pxref{Filename database})
+@code{TEXMFDBS}.
+
+@item .fmt
+@flindex .fmt
+@vindex TEXFORMATS
+@vindex TEXMFINI
+(@TeX{} memory dump, @pxref{Memory dumps,,, web2c, Web2c})
+@code{TEXFORMATS}, @code{TEXMFINI}.
+
+@item gf
+@flindex .gf
+@vindex GFFONTS
+@vindex GLYPHFONTS
+@vindex TEXFONTS
+(generic font bitmap, @pxref{Glyph files,,, dvips, Dvips})
+@code{@var{program}FONTS}, @code{GFFONTS}, @code{GLYPHFONTS}, @code{TEXFONTS}.
+
+@item .map
+@flindex .map
+@vindex TEXFONTMAPS
+(Fontmaps, @pxref{Fontmap})
+@code{TEXFONTMAPS}.
+
+@item .ist
+@flindex .ist
+@vindex TEXINDEXSTYLE
+@vindex INDEXSTYLE
+(makeindex style files)
+@code{TEXINDEXSTYLE}, @code{INDEXSTYLE}.
+
+@item .mem
+@flindex .mem
+@vindex MPMEMS
+@vindex TEXMFINI
+(MetaPost memory dump, @pxref{Memory dumps,,, web2c, Web2c})
+@code{MPMEMS}, @code{TEXMFINI}.
+
+@item .mf
+@flindex .mf
+@vindex MFINPUTS
+(Metafont source, @pxref{mf invocation,,, web2c, Web2c})
+@code{MFINPUTS};
+dynamic creation program: @code{MakeTeXMF}.
+
+@item .mft
+@flindex .mft
+@vindex MFTINPUTS
+(@code{MFT} style file, @pxref{mft invocation,,, web2c, Web2c})
+@code{MFTINPUTS}.
+
+@item mf.pool
+@flindex .pool
+@vindex MFPOOL
+(Metafont program strings, @pxref{pooltype invocation,,, web2c, Web2c})
+@code{MFPOOL}, @code{TEXMFINI}.
+
+@item .mp
+@flindex .mp
+@vindex MPINPUTS
+(MetaPost source, @pxref{mpost invocation,,, web2c, Web2c})
+@code{MPINPUTS}.
+
+@item mp.pool
+@flindex .pool
+@vindex MPPOOL
+(MetaPost program strings, @pxref{pooltype invocation,,, web2c, Web2c})
+@code{MPPOOL}, @code{TEXMFINI}.
+
+@item @r{(none)}
+@vindex MPSUPPORT
+(MetaPost support files, used by DMP; @pxref{dmp invocation,,, web2c, Web2c}) 
+@code{MPSUPPORT}.
+
+@item .ocp
+@flindex .ocp
+@vindex OCPINPUTS
+(Omega compiled process files)
+@code{OCPINPUTS}; @*
+dynamic creation program: @code{MakeOmegaOCP}.
+
+@item .ofm
+@flindex .ofm
+@vindex OFMFONTS
+(Omega font metrics)
+@code{OFMFONTS}, @code{TEXFONTS}; @*
+dynamic creation program: @code{MakeOmegaOFM}.
+
+@item .opl
+@flindex .opl
+(Omega property lists)
+@code{OPLFONTS}, @code{TEXFONTS}.
+
+@item .otp
+@flindex .otp
+@vindex OTPINPUTS
+(Omega translation process files)
+@code{OTPINPUTS}.
+
+@item .ovf
+@flindex .ovf
+@vindex OVFFONTS
+(Omega virtual fonts)
+@code{OVFFONTS}, @code{TEXFONTS}.
+
+@item .ovp
+@flindex .ovp
+@vindex OVPFONTS
+(Omega virtual property lists)
+@code{OVPFONTS}, @code{TEXFONTS}.
+
+@item .eps
+@flindex .eps
+@flindex .epsi
+@vindex TEXPICTS
+@vindex TEXINPUTS
+(Encapsulated PostScript figures, @pxref{PostScript figures,,, dvips, Dvips})
+@code{TEXPICTS}, @code{TEXINPUTS};
+additional suffixes: @samp{.epsi}.
+
+@item pk
+@flindex .pk
+@vindex PKFONTS
+@vindex TEXPKS
+@vindex GLYPHFONTS
+@vindex TEXFONTS
+(packed bitmap fonts, @pxref{Glyph files,,, dvips, Dvips})
+@code{@var{PROGRAM}FONTS} (@var{program} being @samp{XDVI}, etc.),
+@code{PKFONTS}, @code{TEXPKS}, @code{GLYPHFONTS}, @code{TEXFONTS};
+dynamic creation program: @code{MakeTeXPK}.
+
+@item .pro
+@flindex .pro
+@vindex TEXPSHEADERS
+@vindex PSHEADERS
+(downloadable PostScript, @pxref{Header files,,, dvips, Dvips})
+@code{TEXPSHEADERS}, @code{PSHEADERS}.
+
+@item .tex
+@flindex .tex
+@flindex .ltx
+@flindex .dtx
+@flindex .texi
+@flindex .texinfo
+@flindex .txi
+@flindex .eps
+@flindex .epsi
+@vindex TEXINPUTS
+(@TeX{} source, @pxref{tex invocation,,, web2c, Web2c})
+@code{TEXINPUTS};
+additional suffixes: @samp{.ltx} @samp{.dtx} @samp{.texi} @samp{.texinfo}
+@samp{.txi} @samp{.eps} @samp{.epsi};
+dynamic creation program: @code{MakeTeXTeX}.
+
+@item @r{(none)}
+@flindex doc files
+@vindex TEXDOCS
+(Documentation files for the @TeX{} system)
+@code{TEXDOCS}.
+
+@item tex.pool
+@flindex .pool
+@vindex TEXPOOL
+(@TeX{} program strings, @pxref{pooltype invocation,,, web2c, Web2c})
+@code{TEXPOOL}, @code{TEXMFINI}.
+
+@item @r{(none)}
+@flindex source files
+@vindex TEXSOURCES
+(Source files for the @TeX{} system)
+@code{TEXSOURCES}.
+
+@item .tfm
+@flindex .tfm
+@vindex TFMFONTS
+@vindex TEXFONTS
+(@TeX{} font metrics, @pxref{Metric files,,, dvips, Dvips})
+@code{TFMFONTS}, @code{TEXFONTS};
+dynamic creation program: @code{MakeTeXTFM}.
+
+@item @r{(none)}
+@vindex TRFONTS
+(Troff fonts, used by DMP; @pxref{DMP invocation,,, web2c, Web2c}) 
+@code{TRFONTS}.
+
+@item .pfa
+@flindex .pfa
+@flindex .pfb
+@vindex T1FONTS
+@vindex T1INPUTS
+@vindex TEXPSHEADERS
+@vindex DVIPSHEADERS
+(Type 1 PostScript outline fonts, @pxref{Glyph files,,, dvips, Dvips})
+@code{T1FONTS}, @code{T1INPUTS}, @code{TEXPSHEADERS}, @code{DVIPSHEADERS}; additional suffix:
+@samp{.pfb}.
+
+@item .vf
+@flindex .vf
+@vindex VFFONTS
+@vindex TEXFONTS
+(virtual fonts, @pxref{Virtual fonts,,, dvips, Dvips})
+@code{VFFONTS}, @code{TEXFONTS}.
+
+@item @r{(none)}
+@vindex TEXCONFIG
+@flindex config.ps@r{, search path for}
+(Dvips @samp{config.*} files, such as @file{config.ps}, @pxref{Config
+files,,, dvips, Dvips})
+@code{TEXCONFIG}.
+@end table
+
+If an environment variable by these names are set, the corresponding
+@file{texmf.cnf} definition won't be looked at (unless, as usual, the
+environment variable value has an extra @samp{:}).  @xref{Default
+expansion}.
+
+For the font variables, the intent is that:
+@itemize @bullet
+@item
+@code{TEXFONTS} is the default for everything.
+
+@item
+@code{GLYPHFONTS} is the default for bitmap (or, more precisely,
+non-metric) files.
+
+@item
+Each font format has a variable of its own.
+
+@item
+@vindex XDVIFONTS
+@vindex DVIPSFONTS
+Each program has its own font override path as well; e.g.,
+@code{DVIPSFONTS} for Dvipsk.  Again, this is for bitmaps, not metrics.
+
+@end itemize
+
+
+@node File lookup
+@section File lookup
+
+@cindex file lookup
+@cindex searching for files
+@cindex @TeX{} file lookup
+
+This section describes how Kpathsea searches for most files (bitmap font
+searches are the exception, as described in the next section).
+
+Here is the search strategy for a file @var{name}:
+@enumerate
+@item
+If @var{name} has a suffix, search for exactly @var{name} along the
+appropriate path.  Example: given @samp{foo.sty}, look for
+@samp{foo.sty} before @samp{foo.sty.tex}, even though it's a @TeX{}
+input file.
+
+@item
+If the file format defines a default suffix, and the suffix of
+@var{name} is not already that default, try appending the default.
+Example: given @samp{foo.bar}, search for @samp{foo.bar.tex}.  But if
+given @samp{foo.tex}, don't bother to search for @samp{foo.tex.tex}.
+
+@item
+If we're searching for a TFM, PK, or GF file, look for aliases of
+@var{name} in @file{texfonts.map} files (@pxref{Fontmap}).  Example:
+given @samp{Times-Roman}, find @samp{ptmr}.
+
+@item
+If the file format defines a program to invoke to create missing files,
+run it (@pxref{MakeTeX scripts}).
+
+@item
+Search for @var{name} itself, if we haven't done so already.  Example:
+given @samp{foo}, search for @samp{foo}.
+@end enumerate
+
+@flindex tex-file.c
+@findex kpse_find_file
+This is implemented in the routine @code{kpse_find_file} in
+@file{kpathsea/tex-file.c}.  You can watch it in action with the
+debugging options (@pxref{Debugging}).
+
+
+@node Glyph lookup
+@section Glyph lookup
+
+@cindex glyph lookup
+@cindex searching for glyphs
+@cindex @TeX{} glyph lookup
+
+This section describes how Kpathsea searches for a bitmap font in GF or
+PK format (or either) given a font name (e.g., @samp{cmr10}) and a
+resolution (e.g., 600).
+
+Here is an outline of the search strategy (details in the sections
+below) for a file @var{name} at resolution @var{dpi}.  The search stops
+at the first successful lookup.
+
+@enumerate
+@item
+Look for an existing file @var{name}.@var{dpi}@var{format} in the
+specified format(s).
+
+@item If @var{name} is an alias for a file @var{f} in the fontmap
+file @file{texfonts.map}, look for @var{f}.@var{dpi}.
+
+@item Run an external program (typically named @samp{MakeTeXPK}) to
+generate the font (@pxref{MakeTeX scripts})
+
+@item Look for @var{fallback}.@var{dpi}, where @var{fallback} is some
+last-resort font (typically @samp{cmr10}).
+@end enumerate
+
+@flindex tex-glyph.c
+@findex kpse_find_glyph_format
+This is implemented in @code{kpse_find_glyph_format} in
+@file{kpathsea/tex-glyph.c}.
+
+@menu
+* Basic glyph lookup::          Features common to all glyph lookups.
+* Fontmap::                     Aliases for fonts.
+* Fallback font::               Resolutions and fonts of last resort.
+@end menu
+
+
+@node Basic glyph lookup
+@subsection Basic glyph lookup
+
+@cindex basic glyph lookup
+@cindex common features in glyph lookup
+
+When Kpathsea looks for a bitmap font @var{name} at resolution @var{dpi}
+in a format @var{format}, it first checks each directory in the search
+path for a file @samp{@var{name}.@var{dpi}@var{format}}; for example,
+@samp{cmr10.600pk}.  Kpathsea looks for a PK file first, then a GF file.
+
+If that fails, Kpathsea looks for
+@samp{dpi@var{dpi}/@var{name}.@var{format}}; for example,
+@samp{dpi600/cmr10.pk}. This is how fonts are typically stored on
+filesystems (such as DOS) that permit only three-character extensions.
+
+@cindex tolerance for glyph lookup
+@cindex glyph lookup bitmap tolerance
+@findex KPSE_BITMAP_TOLERANCE
+If that fails, Kpathsea looks for a font with a close-enough @var{dpi}.
+``Close enough'' is defined by the macro @code{KPSE_BITMAP_TOLERANCE} in
+@file{kpathsea/tex-glyph.h} to be @code{@var{dpi} / 500 + 1}.  This is
+slightly more than the 0.2% minimum allowed by the DVI standard
+(@url{@var{CTAN:}/dviware/driv-standard/level-0}).
+
+
+@node Fontmap
+@subsection Fontmap
+
+@cindex fontmap files
+@cindex font alias files
+@cindex aliases for fonts
+
+@flindex texfonts.map
+If a bitmap font or metric file is not found with the original name (see
+the previous section), Kpathsea looks through any @dfn{fontmap} files
+for an @dfn{alias} for the original font name.  These files are named
+@file{texfonts.map} and searched for along the @code{TEXFONTMAPS}
+environment/config file variable.  All @file{texfonts.map} files that
+are found are read; earlier definitions override later ones.
+
+This feature is intended to help in two respects:
+
+@enumerate
+
+@item
+@cindex fontnames, arbitrary length
+An alias name is limited in length only by available memory, not by your
+filesystem.  Therefore, if you want to ask for @samp{Times-Roman}
+instead of @file{ptmr}, you can (you get @samp{ptmr8r}).
+
+@item
+@cindex circle fonts
+@flindex lcircle10
+A few fonts have historically had multiple names: specifically,
+La@TeX{}'s ``circle font'' has variously been known as @file{circle10},
+@file{lcircle10}, and @file{lcirc10}.  Aliases can make all the names
+equivalent, so that it no longer matters what the name of the installed
+file is; @TeX{} documents will find their favorite name.
+
+@end enumerate
+
+The format of fontmap files is straightforward:
+
+@itemize @bullet
+@cindex comments, in fontmap files
+@item Comments start with @samp{%} and continue to the end of the line.
+@cindex whitespace, in fontmap files
+@item Blank lines are ignored.
+@item Each nonblank line is broken up into a series of @dfn{words}:
+  a sequence of non-whitespace characters.
+@findex include @r{fontmap directive}
+@item If the first word is @samp{include}, the second word is used as
+  a filename, and it is searched for and read.
+@item Otherwise, the first word on each line is the true filename;
+@item the second word is the alias;
+@item subsequent words are ignored.
+@end itemize
+
+If an alias has an extension, it matches only those files with that
+extension; otherwise, it matches anything with the same root, regardless
+of extension.  For example, an alias @samp{foo.tfm} matches only when
+@file{foo.tfm} is being searched for; but an alias @samp{foo} matches
+@file{foo.vf}, @file{foo.600pk}, etc.
+
+As an example, here is an excerpt from the @file{texfonts.map} in the
+Web2c distribution.  It makes the circle fonts equivalent and includes
+automatically generated maps for most PostScript fonts available from
+various font suppliers.
+
+@example
+circle10        lcircle10
+circle10        lcirc10
+lcircle10       circle10
+lcircle10       lcirc10
+lcirc10         circle10
+lcirc10         lcircle10
+@dots{}
+include adobe.map
+include apple.map
+include bitstrea.map
+@dots{}
+@end example
+
+Fontmaps are implemented in the file @file{kpathsea/fontmap.c}.
+The Fontname distribution has much more information on font naming
+(@pxref{Introduction,,, fontname, Filenames for @TeX{} fonts}).
+
+
+@node Fallback font
+@subsection Fallback font
+
+@cindex fallback font
+@cindex fallback resolutions
+@cindex font of last resort
+@cindex resolutions, last-resort
+@cindex last-resort font
+
+@vindex DVIPSSIZES
+@vindex XDVISIZES
+@vindex DVILJSIZES
+@vindex TEXSIZES
+@vindex default_texsizes
+If a bitmap font cannot be found or created at the requested size,
+Kpathsea looks for the font at a set of @dfn{fallback resolutions}.  You
+specify these resolutions as a colon-separated list (like search paths).
+Kpathsea looks first for a program-specific environment variable (e.g.,
+@code{DVIPSSIZES} for Dvipsk), then the environment variable
+@code{TEXSIZES}, then a default specified at compilation time (the Make
+variable @code{default_texsizes}).  You can set this list to be empty if
+you prefer to find fonts at their stated size or not at all.
+
+@flindex cmr10@r{, as fallback font}
+@vindex kpse_fallback_font
+Finally, if the font cannot be found even at the fallback resolutions,
+Kpathsea looks for a fallback font, typically @file{cmr10}.  Programs
+must enable this feature by assigning to the global variable
+@code{kpse_fallback_font} or calling @code{kpse_init_prog}
+(@pxref{Calling sequence}); the default is no fallback font.
+
+
+@node Suppressing warnings
+@section Suppressing warnings
+
+@cindex warnings, suppressing
+@cindex suppressing warnings
+
+@vindex TEX_HUSH
+Kpathsea provides a way to suppress selected usually-harmless warnings;
+this is useful at large sites where most users are not administrators,
+and thus the warnings are merely a source of confusion, not a help.  To
+do this, you set the environment variable or configuration file value
+@code{TEX_HUSH} to a colon-separated list of values.  Here are the
+possibilities:
+
+@vtable @samp
+@item all
+Suppress everything possible.
+
+@item checksum
+@cindex mismatched checksum warnings
+Suppress mismatched font checksum warnings.
+
+@item lostchar
+@cindex missing character warnings
+Suppress warnings when a character is missing from a font that a DVI or
+VF file tries to typeset.
+
+@item readable
+@cindex unreadable file warnings
+Suppress warnings about attempts to access a file whose permissions
+render it unreadable.
+
+@item special
+@cindex unknown special warnings
+@findex \special@r{, suppressing warnings about}
+Suppresses warnings about an unimplemented or unparsable
+@samp{\special} command.
+@end vtable
+
+@noindent @file{tex-hush.c} defines the function that checks the
+variable value.  Each driver implements its own checks where
+appropriate.
+
+
+@node Programming
+@chapter Programming
+
+This chapter is for programmers who wish to use Kpathsea.
+@xref{Introduction}, for the conditions under which you may do so.
+
+@menu
+* Overview: Programming overview.         Introduction.
+* Calling sequence::                      Specifics of what to call.
+* Config: Programming with config files.  Getting info from texmf.cnf.
+@end menu
+
+
+@node Programming overview
+@section Programming overview
+
+@cindex programming overview
+@cindex overview of programming with Kpathsea
+
+Aside from this manual, your best source of information is the source to
+the programs I've modified to use Kpathsea (@pxref{Introduction}).  Of
+those, Dviljk is probably the simplest, and hence a good place to start.
+Xdvik adds VF support and the complication of X resources.  Dvipsk adds
+the complication of its own config files.  Web2c is source code I also
+maintain, so it uses Kpathsea rather straightforwardly, but is of course
+complicated by the Web to C translation.  Finally, Kpsewhich is a small
+utility program whose sole purpose is to exercise the main
+path-searching functionality.
+
+@flindex pathsearch.h
+@flindex tex-file.h
+@flindex tex-glyph.h
+@flindex kpathsea.h
+Beyond these examples, the @file{.h} files in the Kpathsea source
+describe the interfaces and functionality (and of course the @file{.c}
+files define the actual routines, which are the ultimate documentation).
+@file{pathsearch.h} declares the basic searching routine.
+@file{tex-file.h} and @file{tex-glyph.h} define the interfaces for
+looking up particular kinds of files.  You may wish to use
+@code{#include <kpathsea/kpathsea.h>}, which includes every Kpathsea header.
+
+@cindex file types, registering new
+The library provides no way for an external program to register new file
+types: @file{tex-file.[ch]} must be modified to do this. For example,
+Kpathsea has support for looking up Dvips config files, even though no
+program other than Dvips will likely ever want to do so.  I felt this
+was acceptable, since along with new file types should also come new
+defaults in @file{texmf.cnf} (and its descendant @file{paths.h}), since
+it's simplest for users if they can modify one configuration file for
+all kinds of paths.
+
+Kpathsea does not parse any formats itself; it barely opens any files.
+Its primary purpose is to return filenames.  The GNU font utilities does
+contain libraries to read TFM, GF, and PK files, as do the programs
+above, of course.
+
+
+@node Calling sequence
+@section Calling sequence
+
+@cindex programming with Kpathsea
+@cindex calling sequence
+
+The typical way to use Kpathsea in your program goes something like this:
+
+@enumerate
+
+@item
+@findex kpse_set_progname
+@vindex argv[0]
+Call @code{kpse_set_progname} with @code{argv[0]}; This is the only
+initialization that is mandatory to take full advantage of
+Kpathsea---specifically, for the @code{.@var{program}} feature of config
+files (@pxref{Config files}).
+
+@vindex program_invocation_name
+@vindex program_invocation_short_name
+@vindex KPATHSEA_DEBUG
+@cindex SELFAUTOLOC
+@cindex SELFAUTODIR
+@cindex SELFAUTOPARENT
+@cindex error message macros
+@cindex symlinks, resolving
+@cindex expanding symlinks
+If necessary, @code{kpse_set_progname} sets the global variables
+@code{program_invocation_name} and @code{program_invocation_short_name}.
+These variables are used in the error message macros defined in
+@file{kpathsea/lib.h}.  It also initializes debugging options based on
+the environment variable @code{KPATHSEA_DEBUG} (if that is set).
+Finally, it sets the variables @code{SELFAUTOLOC}, @code{SELFAUTODIR}
+and @code{SELFAUTOPARENT} to the location, parent and grandparent
+directory of the executable, removing @file{.} and @file{..} path
+elements and resolving symbolic links.  These are used in the default
+configuration file to allow people to invoke TeX from anywhere,
+specifically from a mounted CD-ROM.  (You can use
+@samp{--expand-var=\$SELFAUTOLOC}, etc., to see the values finds.)
+
+@item
+@vindex kpathsea_debug @r{variable}
+@cindex debugging options, in Kpathsea-using program
+Set debugging options. @xref{Debugging}.  If your program doesn't have a
+debugging option already, you can define one and set
+@code{kpathsea_debug} to the number that the user supplies (as in Dviljk
+and Web2c), or you can just omit this altogether (people can always set
+@code{KPATHSEA_DEBUG}).  If you do have runtime debugging already, you
+need to merge Kpathsea's options with yours (as in Dvipsk and Xdvik).
+
+@item
+@vindex client_path @r{in @code{kpse_format_info}}
+@vindex kpse_format_info
+@flindex resident.c
+@cindex config files, for Kpathsea-using programs
+If your program has its own configuration files that can define search
+paths, you should assign those paths to the @code{client_path} member in
+the appropriate element of the @code{kpse_format_info} array.  (This
+array is indexed by file type; see @file{tex-file.h}.)  See
+@file{resident.c} in Dvipsk for an example.
+
+@item
+@findex kpse_init_prog
+@flindex proginit.h
+Call @code{kpse_init_prog} (see @file{proginit.c}). It's useful for the
+DVI drivers, at least, but for other programs it may be simpler to
+extract the parts of it that actually apply.  This does not initialize
+any paths, it just looks for (and sets) certain environment variables
+and other random information.  (A search path is always initialized at
+the first call to find a file of that type; this eliminates much useless
+work, e.g., initializing the Bib@TeX{} search paths in a DVI driver.)
+
+@item
+@findex kpse_find_*
+The routine to actually find a file of type @var{format} is
+@code{kpse_find_@var{format}}, defined in @file{tex-file.h}. These are
+macros that expand to a call to @file{kpse_find_file}.  You can call,
+say, @code{kpse_find_tfm} after doing only the first of the
+initialization steps above---Kpathsea automatically reads the
+@file{texmf.cnf} generic config files, looks for environment variables,
+and does expansions at the first lookup.
+
+@item
+To find PK and/or GF bitmap fonts, the routines are @code{kpse_find_pk},
+@code{kpse_find_gf} and @code{kpse_find_glyph}, defined in
+@file{tex-glyph.h}. These return a structure in addition to the
+resultant filename, because fonts can be found in so many ways. See the
+documentation in the source.
+
+@item
+@findex kpse_open_file
+To actually open a file, not just return a filename, call
+@code{kpse_open_file}.  This function takes the name to look up and a
+Kpathsea file format as arguments, and returns the usual @code{FILE *}.
+It always assumes the file must exist, and thus will search the disk if
+necessary (unless the search path specified @samp{!!}, etc.).  In other
+words, if you are looking up a VF or some other file that need not
+exist, don't use this.
+
+@end enumerate
+
+@cindex hash table routines
+@cindex memory allocation routines
+@cindex string routines
+@cindex reading arbitrary-length lines
+@cindex input lines, reading
+@cindex lines, reading arbitrary-length
+Kpathsea also provides many utility routines. Some are generic: hash
+tables, memory allocation, string concatenation and copying, string
+lists, reading input lines of arbitrary length, etc. Others are
+filename-related: default path, tilde, and variable expansion,
+@code{stat} calls, etc. (Perhaps someday I'll move the former to a
+separate library.)
+
+@flindex c-*.h
+@pindex autoconf@r{, recommended}
+The @file{c-*.h} header files can also help your program adapt to many
+different systems.  You will almost certainly want to use Autoconf for
+configuring your software if you use Kpathsea; I strongly recommend
+using Autoconf regardless.  It is available from
+@url{ftp://prep.ai.mit.edu/pub/gnu/}.
+
+
+@node Programming with config files
+@section Programming with config files
+
+@cindex programming with config files
+@cindex config files, programming with
+
+You can (and probably should) use the same @code{texmf.cnf}
+configuration file that Kpathsea uses for your program.  This helps
+installers by keeping all configuration in one place.
+
+@findex kpse_var_expand
+@flindex variable.h
+@vindex shell_escape@r{, example for code}
+To retrieve a value @var{var} from config files, the best way is to call
+@code{kpse_var_value} on the string @code{@var{var}}.  This will look
+first for an environment variable @var{var}, then a config file value.
+The result will be the value found or @samp{NULL}.  This function is
+declared in @file{kpathsea/variable.h}.  For an example, see the
+@code{shell_escape} code in @file{web2c/lib/texmfmp.c}.
+
+The routine to do variable expansion in the context of a search path (as
+opposed to simply retrieving a value) is @code{kpse_var_expand}, also
+declared in @file{kpathsea/variable.h}.  It's generally only necessary
+to set the search path structure components as explained in the previous
+section, rather than using this yourself.
+
+@findex kpse_cnf_get
+@flindex cnf.h
+If for some reason you want to retrieve a value @emph{only} from a
+config file, not automatically looking for a corresponding environment
+variable, call @code{kpse_cnf_get} (declared in @file{kpathsea/cnf.h})
+with the string @var{var}.
+
+No initialization calls are needed.
+
+
+@node Index
+@unnumbered Index
+
+@printindex cp
+
+@contents
+
+@bye
new file mode 100644
--- /dev/null
+++ b/kpathsea/kpsewhich.c
@@ -0,0 +1,434 @@
+/* kpsewhich -- standalone path lookup and variable expansion for Kpathsea.
+   Ideas from Thomas Esser and Pierre MacKay.
+
+Copyright (C) 1995, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/expand.h>
+#include <kpathsea/getopt.h>
+#include <kpathsea/line.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/proginit.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/tex-glyph.h>
+#include <kpathsea/variable.h>
+
+
+/* Base resolution. (-D, -dpi) */
+unsigned dpi = 600;
+
+/* For variable and path expansion.  (-expand-var, -expand-path,
+   -show-path, -separator) */
+string var_to_expand = NULL;
+string path_to_expand = NULL;
+string path_to_show = NULL;
+const_string path_sep = ENV_SEP_STRING;
+
+/* The file type and path for lookups.  (-format, -path) */
+kpse_file_format_type user_format = kpse_last_format;
+string user_format_string;
+string user_path;
+
+/* Interactively ask for names to look up?  (-interactive) */
+boolean interactive = false;
+
+/* Search the disk as well as ls-R?  (-must-exist) */
+boolean must_exist = false;
+
+
+/* The device name, for $MAKETEX_MODE.  (-mode) */
+string mode = NULL;
+
+/* The program name, for `.PROG' construct in texmf.cnf.  (-program) */
+string progname = NULL;
+
+/* Return the <number> substring in `<name>.<number><stuff>', if S has
+   that form.  If it doesn't, return 0.  */
+
+static unsigned
+find_dpi P1C(string, s)
+{
+  unsigned dpi_number = 0;
+  string extension = find_suffix (s);
+  
+  if (extension != NULL)
+    sscanf (extension, "%u", &dpi_number);
+
+  return dpi_number;
+}
+
+/* Use the file type from -format if that was specified, else guess
+   dynamically from NAME.  Return kpse_last_format if undeterminable.  */
+
+static kpse_file_format_type
+find_format P1C(string, name)
+{
+  kpse_file_format_type ret;
+  
+  if (user_format != kpse_last_format) {
+    ret = user_format;
+  } else if (FILESTRCASEEQ (name, "psfonts.map")) {
+    ret = kpse_dvips_config_format;
+  } else {
+    kpse_file_format_type f;
+    boolean found = false;
+    unsigned name_len = strlen (name);
+
+/* Have to rely on `try_len' being declared here, since we can't assume
+   GNU C and statement expressions.  */
+#define TRY_SUFFIX(try) (\
+  try_len = (try) ? strlen (try) : 0, \
+  (try) && try_len <= name_len \
+     && FILESTRCASEEQ (try, name + name_len - try_len))
+
+    for (f = 0; !found && f < kpse_last_format; f++) {
+      unsigned try_len;
+      const_string *alt;
+      const_string try;
+      
+      if (!kpse_format_info[f].type)
+        kpse_init_format (f);
+
+      try = kpse_format_info[f].suffix;
+      found = TRY_SUFFIX (try);
+      for (alt = kpse_format_info[f].alt_suffix; !found && alt && *alt; alt++){
+        found = TRY_SUFFIX (*alt);
+      }
+    }
+
+    ret = f < kpse_last_format ? f - 1 : kpse_last_format;
+  }
+  
+  return ret;
+}
+
+/* Look up a single filename NAME.  Return 0 if success, 1 if failure.  */
+
+static unsigned
+lookup P1C(string, name)
+{
+  string ret;
+  unsigned local_dpi;
+  kpse_glyph_file_type glyph_ret;
+  
+  if (user_path) {
+    ret = kpse_path_search (user_path, name, must_exist);
+    
+  } else {
+    /* No user-specified search path, check user format or guess from NAME.  */
+    kpse_file_format_type fmt = find_format (name);
+
+    switch (fmt) {
+      case kpse_pk_format:
+      case kpse_gf_format:
+      case kpse_any_glyph_format:
+        /* Try to extract the resolution from the name.  */
+        local_dpi = find_dpi (name);
+        if (!local_dpi)
+          local_dpi = dpi;
+        ret = kpse_find_glyph (remove_suffix (name), local_dpi, fmt, &glyph_ret);
+        break;
+
+      case kpse_last_format:
+        WARNING1 ("kpsewhich: Can't guess file type of %s, using tex", name);
+        fmt = kpse_tex_format;
+        /* fall through */
+
+      default:
+        ret = kpse_find_file (name, fmt, must_exist);
+    }
+  }
+  
+  if (ret)
+    puts (ret);
+  
+  return ret == NULL;
+}
+
+/* Perform variable and path expansion on PATHVAR. This is useful for
+   building paths for other programs.  Path components sent to standard
+   output.  Returns `./' for the empty string.  This does disk searching
+   and may result in lots and lots of output. */
+
+static void
+path_expand P1C(const_string, pathvar)
+{
+  string path;
+  string pathelt;
+  boolean first = true;
+
+  /* Do variable expansion, too.  */
+  path = kpse_path_expand (pathvar);
+
+  /* Now expand each of the path elements, printing the results */
+  for (pathelt = kpse_path_element (path); pathelt;
+       pathelt = kpse_path_element (NULL)) {
+    str_llist_type *dirs;
+
+    /* Skip and ignore magic leading chars.  */
+    if (*pathelt == '!' && *(pathelt + 1) == '!')
+      pathelt += 2;
+
+    /* Search the disk for all dirs in the component specified.
+       Be faster to check the database, but this is more reliable.  */
+    dirs = kpse_element_dirs (pathelt); 
+    if (dirs && *dirs) {
+      str_llist_elt_type *dir;
+
+      if (!first) {
+        fputs (path_sep, stdout);
+      }
+      first = false;
+
+      for (dir = *dirs; dir; ) {
+        string thedir = STR_LLIST (*dir);
+        unsigned len = strlen (thedir);
+        if (len > 1) {
+          /* Discard trailing slash if that's not the entire element.  */
+          thedir[len - 1] = 0;
+        }
+        fputs (thedir, stdout);
+        dir = STR_LLIST_NEXT (*dir);
+        if (dir)
+          fputs (path_sep, stdout);
+      }
+    }
+  }
+
+  if (!first) 
+    putchar ('\n');
+}
+
+/* Reading the options.  */
+
+#define USAGE "\
+  Standalone path lookup and expansion for Kpathsea.\n\
+\n\
+-debug=NUM          set debugging flags.\n\
+-D, -dpi=NUM        use a base resolution of NUM; default 600.\n\
+-expand-path=STRING output complete path expansion of STRING.\n\
+-expand-var=STRING  output variable expansion of STRING.\n\
+-format=NAME        use file type NAME (see list below).\n\
+-help               print this message and exit.\n\
+-interactive        ask for additional filenames to look up.\n\
+[-no]-maketex=FMT   disable/enable MakeTeXFMT generation (FMT=pk/mf/tex/tfm)\n\
+-mode=STRING        set device name for $MAKETEX_MODE to STRING; no default.\n\
+-must-exist         search the disk as well as ls-R if necessary\n\
+-path=STRING        search in the path STRING.\n\
+-progname=STRING    set program name to STRING.\n\
+-separator=STRING   STRING separates components in -path output; default :.\n\
+-show-path=NAME     output search path for file type NAME (see list below).\n\
+-version            print version number and exit.\n\
+"
+
+/* Test whether getopt found an option ``A''.
+   Assumes the option index is in the variable `option_index', and the
+   option table in a variable `long_options'.  */
+#define ARGUMENT_IS(a) STREQ (long_options[option_index].name, a)
+
+/* SunOS cc can't initialize automatic structs.  */
+static struct option long_options[]
+  = { { "D",			1, 0, 0 },
+      { "debug",		1, 0, 0 },
+      { "dpi",			1, 0, 0 },
+      { "expand-path",		1, 0, 0 },
+      { "expand-var",		1, 0, 0 },
+      { "format",		1, 0, 0 },
+      { "help",                 0, 0, 0 },
+      { "interactive",		0, (int *) &interactive, 1 },
+      { "maketex",		1, 0, 0 },
+      { "mode",			1, 0, 0 },
+      { "must-exist",		0, (int *) &must_exist, 1 },
+      { "path",			1, 0, 0 },
+      { "no-maketex",		1, 0, 0 },
+      { "progname",		1, 0, 0 },
+      { "separator",		1, 0, 0 },
+      { "show-path",		1, 0, 0 },
+      { "version",              0, 0, 0 },
+      { 0, 0, 0, 0 } };
+
+static void
+read_command_line P2C(int, argc,  string *, argv)
+{
+  int g;   /* `getopt' return code.  */
+  int option_index;
+
+  for (;;) {
+    g = getopt_long_only (argc, argv, "", long_options, &option_index);
+
+    if (g == -1)
+      break;
+
+    if (g == '?')
+      exit (1);  /* Unknown option.  */
+
+    assert (g == 0); /* We have no short option names.  */
+
+    if (ARGUMENT_IS ("debug")) {
+      kpathsea_debug |= atoi (optarg);
+
+    } else if (ARGUMENT_IS ("dpi") || ARGUMENT_IS ("D")) {
+      dpi = atoi (optarg);
+
+    } else if (ARGUMENT_IS ("expand-path")) {
+      path_to_expand = optarg;
+
+    } else if (ARGUMENT_IS ("expand-var")) {
+      var_to_expand = optarg;
+
+    } else if (ARGUMENT_IS ("format")) {
+      user_format_string = optarg;
+
+    } else if (ARGUMENT_IS ("help")) {
+      kpse_file_format_type f;
+      extern DllImport char *kpse_bug_address; /* from version.c */
+      
+      printf ("Usage: %s [OPTION]... [FILENAME]...\n", argv[0]);
+      fputs (USAGE, stdout);
+      putchar ('\n');
+      fputs (kpse_bug_address, stdout);
+      
+      /* Have to set this for init_format to work.  */
+      if (!program_invocation_short_name) {
+        kpse_set_progname (progname ? progname : argv[0]);
+      }
+
+      fputs ("\nRecognized file suffixes/format names, and their", stdout);
+      puts (" integer equivalents:");
+      for (f = 0; f < kpse_last_format; f++) {
+        const_string *alt;
+        kpse_init_format (f);
+        if (kpse_format_info[f].suffix) {
+          printf ("%s(%d)", kpse_format_info[f].suffix, f);
+        } else {
+          printf ("%s (%d)", kpse_format_info[f].type, f);          
+        }
+        for (alt = kpse_format_info[f].alt_suffix; alt && *alt; alt++) {
+          putchar (' ');
+          fputs (*alt, stdout);
+        }
+        putchar ('\n');
+      }
+
+      exit (0);
+
+    } else if (ARGUMENT_IS ("maketex")) {
+      kpse_maketex_option (optarg, true);
+
+    } else if (ARGUMENT_IS ("mode")) {
+      mode = optarg;
+
+    } else if (ARGUMENT_IS ("no-maketex")) {
+      kpse_maketex_option (optarg, false);
+
+    } else if (ARGUMENT_IS ("path")) {
+      user_path = optarg;
+
+    } else if (ARGUMENT_IS ("progname")) {
+      progname = optarg;
+
+    } else if (ARGUMENT_IS ("separator")) {
+      path_sep = optarg;
+
+    } else if (ARGUMENT_IS ("show-path")) {
+      path_to_show = optarg;
+      user_format_string = optarg;
+
+    } else if (ARGUMENT_IS ("version")) {
+      extern DllImport char *kpathsea_version_string; /* from version.c */
+      puts (kpathsea_version_string);
+      puts ("Copyright (C) 1997 K. Berry.\n\
+There is NO warranty.  You may redistribute this software\n\
+under the terms of the GNU General Public License.\n\
+For more information about these matters, see the files named COPYING.");
+      exit (0);
+    }
+
+    /* Else it was just a flag; getopt has already done the assignment.  */
+  }
+  
+  if (user_path && user_format_string) {
+    fprintf (stderr, "-path (%s) and -format (%s) are mutually exclusive.\n",
+             user_path, user_format_string);
+    fputs ("Try `kpsewhich --help' for more information.\n", stderr);
+    exit (1);
+  }
+
+  if (optind == argc && !var_to_expand && !path_to_expand && !path_to_show) {
+    fputs ("Missing argument. Try `kpsewhich --help' for more information.\n",
+           stderr);
+    exit (1);
+  }
+}
+
+int
+main P2C(int, argc,  string *, argv)
+{
+  unsigned unfound = 0;
+
+  read_command_line (argc, argv);
+
+  if (!progname)
+    progname = argv[0];
+  kpse_set_progname (progname);
+  
+  /* NULL for no fallback font.  */
+  kpse_init_prog (uppercasify (progname), dpi, mode, NULL);
+  
+  /* Have to do this after setting the program name.  */
+  if (user_format_string) {
+    /* Support both a number and a name.  */
+    user_format = ISDIGIT (*user_format_string) ? atoi (user_format_string)
+                  : find_format (user_format_string);
+  }
+  
+  /* Variable expansion.  */
+  if (var_to_expand)
+    puts (kpse_var_expand (var_to_expand));
+
+  /* Path expansion. */
+  if (path_to_expand)
+    path_expand (path_to_expand);
+
+  /* Show a search path. */
+  if (path_to_show) {
+    if (user_format != kpse_last_format) {
+      if (!kpse_format_info[user_format].type) /* needed if arg was numeric */
+        kpse_init_format (user_format);
+      puts (kpse_format_info[user_format].path);
+    } else {
+      WARNING1 ("kpsewhich: Ignoring unknown file type `%s'", path_to_show);
+    }
+  }
+
+  for (; optind < argc; optind++) {
+    unfound += lookup (argv[optind]);
+  }
+
+  if (interactive) {
+    for (;;) {
+      string name = read_line (stdin);
+      if (!name || STREQ (name, "q") || STREQ (name, "quit")) break;
+      unfound += lookup (name);
+      free (name);
+    }
+  }
+  
+  exit (unfound > 255 ? 1 : unfound);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/lib.h
@@ -0,0 +1,176 @@
+/* lib.h: declarations for common, low-level routines in kpathsea.
+
+Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_LIB_H
+#define KPATHSEA_LIB_H
+
+#include <kpathsea/types.h>
+
+/* Define common sorts of messages.  */
+
+/* This should be called only after a system call fails.  Don't exit
+   with status `errno', because that might be 256, which would mean
+   success (exit statuses are truncated to eight bits).  */
+#define FATAL_PERROR(str) do { \
+  fprintf (stderr, "%s: ", program_invocation_name); \
+  perror (str); exit (EXIT_FAILURE); } while (0)
+
+#define START_FATAL() do { \
+  fprintf (stderr, "%s: fatal: ", program_invocation_name);
+#define END_FATAL() fputs (".\n", stderr); exit (1); } while (0)
+
+#define FATAL(str)							\
+  START_FATAL (); fputs (str, stderr); END_FATAL ()
+#define FATAL1(str, e1)							\
+  START_FATAL (); fprintf (stderr, str, e1); END_FATAL ()
+#define FATAL2(str, e1, e2)						\
+  START_FATAL (); fprintf (stderr, str, e1, e2); END_FATAL ()
+#define FATAL3(str, e1, e2, e3)						\
+  START_FATAL (); fprintf (stderr, str, e1, e2, e3); END_FATAL ()
+#define FATAL4(str, e1, e2, e3, e4)					\
+  START_FATAL (); fprintf (stderr, str, e1, e2, e3, e4); END_FATAL ()
+#define FATAL5(str, e1, e2, e3, e4, e5)					\
+  START_FATAL (); fprintf (stderr, str, e1, e2, e3, e4, e5); END_FATAL ()
+#define FATAL6(str, e1, e2, e3, e4, e5, e6)				\
+  START_FATAL (); fprintf (stderr, str, e1, e2, e3, e4, e5, e6); END_FATAL ()
+
+
+#define START_WARNING() do { fputs ("warning: ", stderr)
+#define END_WARNING() fputs (".\n", stderr); fflush (stderr); } while (0)
+
+#define WARNING(str)							\
+  START_WARNING (); fputs (str, stderr); END_WARNING ()
+#define WARNING1(str, e1)						\
+  START_WARNING (); fprintf (stderr, str, e1); END_WARNING ()
+#define WARNING2(str, e1, e2)						\
+  START_WARNING (); fprintf (stderr, str, e1, e2); END_WARNING ()
+#define WARNING3(str, e1, e2, e3)					\
+  START_WARNING (); fprintf (stderr, str, e1, e2, e3); END_WARNING ()
+#define WARNING4(str, e1, e2, e3, e4)					\
+  START_WARNING (); fprintf (stderr, str, e1, e2, e3, e4); END_WARNING ()
+
+
+/* I find this easier to read.  */
+#define STREQ(s1, s2) (strcmp (s1, s2) == 0)
+
+/* Support for FAT/ISO-9660 filesystems.  Theoretically this should be
+   done at runtime, per filesystem, but that's painful to program.  */
+#ifdef MONOCASE_FILENAMES
+#define FILESTRCASEEQ(s1, s2) (strcasecmp (s1, s2) == 0)
+#define FILECHARCASEEQ(c1, c2) (toupper (c1) == toupper (c2))
+#else
+#define FILESTRCASEEQ STREQ
+#define FILECHARCASEEQ(c1, c2) ((c1) == (c2))
+#endif
+
+/* This is the maximum number of numerals that result when a 64-bit
+   integer is converted to a string, plus one for a trailing null byte,
+   plus one for a sign.  */
+#define MAX_INT_LENGTH 21
+
+/* If the environment variable TEST is set, return it; otherwise,
+   DEFAULT.  This is useful for paths that use more than one envvar.  */
+#define ENVVAR(test, default) (getenv (test) ? (test) : (default))
+
+/* Return a fresh copy of S1 followed by S2, et al.  */
+extern DllImport string concat P2H(const_string s1, const_string s2);
+extern DllImport string concat3 P3H(const_string, const_string, const_string);
+/* `concatn' is declared in its own include file, to avoid pulling in
+   all the varargs stuff.  */
+
+/* A fresh copy of just S.  */
+extern DllImport string xstrdup P1H(const_string s);
+
+/* Convert all lowercase characters in S to uppercase.  */
+extern DllImport string uppercasify P1H(const_string s);
+
+/* Like `atoi', but disallow negative numbers.  */
+extern DllImport unsigned atou P1H(const_string);
+
+/* True if FILENAME1 and FILENAME2 are the same file.  If stat fails on
+   either name, return false, no error message.
+   Cf. `SAME_FILE_P' in xstat.h.  */
+extern DllImport boolean same_file_p P2H(const_string filename1,
+                                         const_string filename2);
+
+#ifndef HAVE_BASENAME
+/* Return NAME with any leading path stripped off.  This returns a
+   pointer into NAME.  */
+extern DllImport const_string basename P1H(const_string name);
+#endif /* not HAVE_BASENAME */
+
+#ifndef HAVE_STRSTR
+extern string strstr P2H(const_string haystack, const_string needle);
+#endif
+
+/* If NAME has a suffix, return a pointer to its first character (i.e.,
+   the one after the `.'); otherwise, return NULL.  */
+extern DllImport string find_suffix P1H(const_string name);
+
+/* Return NAME with any suffix removed.  */
+extern DllImport string remove_suffix P1H(const_string name);
+
+/* Return S with the suffix SUFFIX, removing any suffix already present.
+   For example, `make_suffix ("/foo/bar.baz", "quux")' returns
+   `/foo/bar.quux'.  Returns a string allocated with malloc.  */
+extern DllImport string make_suffix P2H(const_string s,  const_string suffix);
+
+/* Return NAME with STEM_PREFIX prepended to the stem. For example,
+   `make_prefix ("/foo/bar.baz", "x")' returns `/foo/xbar.baz'.
+   Returns a string allocated with malloc.  */
+extern DllImport string make_prefix P2H(string stem_prefix, string name);
+
+/* If NAME has a suffix, simply return it; otherwise, return
+   `NAME.SUFFIX'.  */
+extern DllImport string extend_filename P2H(const_string name,
+                                            const_string suffix);
+
+/* Call putenv with the string `VAR=VALUE' and abort on error.  */
+extern DllImport void xputenv P2H(const_string var, const_string value);
+extern DllImport void xputenv_int P2H(const_string var, int value);
+
+/* Return the current working directory.  */
+extern DllImport string xgetcwd P1H(void);
+
+/* Returns true if FN is a directory or a symlink to a directory.  */
+extern DllImport boolean dir_p P1H(const_string fn);
+
+/* If FN is a readable directory, return the number of links it has.
+   Otherwise, return -1.  */
+extern DllImport int dir_links P1H(const_string fn);
+
+/* Like their stdio counterparts, but abort on error, after calling
+   perror(3) with FILENAME as its argument.  */
+extern DllImport FILE *xfopen P2H(const_string filename, const_string mode);
+extern DllImport void xfclose P2H(FILE *, const_string filename);
+extern DllImport void xfseek P4H(FILE *, long, int, string filename);
+extern DllImport unsigned long xftell P2H(FILE *, string filename);
+
+/* These call the corresponding function in the standard library, and
+   abort if those routines fail.  Also, `xrealloc' calls `xmalloc' if
+   OLD_ADDRESS is null.  */
+extern DllImport address xmalloc P1H(unsigned size);
+extern DllImport address xrealloc P2H(address old_address, unsigned new_size);
+extern DllImport address xcalloc P2H(unsigned nelem, unsigned elsize);
+
+/* (Re)Allocate N items of type T using xmalloc/xrealloc.  */
+#define XTALLOC(n, t) ((t *) xmalloc ((n) * sizeof (t)))
+#define XTALLOC1(t) XTALLOC (1, t)
+#define XRETALLOC(addr, n, t) ((addr) = (t *) xrealloc (addr, (n) * sizeof(t)))
+
+#endif /* not KPATHSEA_LIB_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/line.c
@@ -0,0 +1,76 @@
+/* line.c: return the next line from a file, or NULL.
+
+Copyright (C) 1992, 93, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Don't include config.h or all our other usual includes, since
+   it's useful to just throw this file into other programs.  */
+
+#include <stdio.h>
+#ifdef WIN32
+#include <malloc.h>
+#else
+extern void free ();
+#endif
+
+/* From xmalloc.c and xrealloc.c.  This saves having to include config.h.  */
+extern void *xmalloc (), *xrealloc ();
+
+
+/* Allocate in increments of this size.  */
+#define BLOCK_SIZE 75
+
+char *
+read_line (f)
+    FILE *f;
+{
+  int c;
+  unsigned limit = BLOCK_SIZE;
+  unsigned loc = 0;
+  char *line = xmalloc (limit);
+  
+  while ((c = getc (f)) != EOF && c != '\n')
+    {
+      line[loc] = c;
+      loc++;
+      
+      /* By testing after the assignment, we guarantee that we'll always
+         have space for the null we append below.  We know we always
+         have room for the first char, since we start with BLOCK_SIZE.  */
+      if (loc == limit)
+        {
+          limit += BLOCK_SIZE;
+          line = xrealloc (line, limit);
+        }
+    }
+  
+  /* If we read anything, return it.  This can't represent a last
+     ``line'' which doesn't end in a newline, but so what.  */
+  if (c != EOF)
+    {
+      /* Terminate the string.  We can't represent nulls in the file,
+         either.  Again, it doesn't matter.  */
+      line[loc] = 0;
+    }
+  else /* At end of file.  */
+    {
+      free (line);
+      line = NULL;
+    }
+
+  return line;
+}
+
new file mode 100644
--- /dev/null
+++ b/kpathsea/line.h
@@ -0,0 +1,31 @@
+/* line.h: read an arbitrary-length input line.
+
+Copyright (C) 1992 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef LINE_H
+#define LINE_H
+
+#include <stdio.h>
+#include <kpathsea/types.h>
+
+
+/* Return NULL if we are at EOF, else the next line of F.  The newline
+   character at the end of string is removed.  The string is allocated
+   with malloc.  */
+extern string read_line P1H(FILE *f);
+
+#endif /* not LINE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/magstep.c
@@ -0,0 +1,100 @@
+/* magstep.c: fix up fixed-point vs. floating-point.
+
+Copyright (C) 1994, 95 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/magstep.h>
+
+
+/* Return true magstep N, where the lsb of N means ``half'' (see
+   magstep.h) for resolution BDPI.  From Tom Rokicki's dvips.  */
+
+static int
+magstep P2C(int, n,  int, bdpi)
+{
+   double t;
+   int step;
+   int neg = 0;
+
+   if (n < 0)
+     {
+       neg = 1;
+       n = -n;
+     }
+
+   if (n & 1)
+     {
+       n &= ~1;
+       t = 1.095445115;
+     }
+    else
+      t = 1.0;
+
+   while (n > 8)
+     {
+       n -= 8;
+       t = t * 2.0736;
+     }
+
+   while (n > 0)
+     {
+       n -= 2;
+       t = t * 1.2;
+     }
+
+   step = 0.5 + (neg ? bdpi / t : bdpi * t);
+   return step;
+}
+
+/* This is adapted from code written by Tom Rokicki for dvips.  It's
+   part of Kpathsea now so all the drivers can use it.  The idea is to
+   return the true dpi corresponding to DPI with a base resolution of
+   BDPI.  If M_RET is non-null, we also set that to the mag value.  */
+   
+/* Don't bother trying to use fabs or some other ``standard'' routine
+   which can only cause trouble; just roll our own simple-minded
+   absolute-value function that is all we need.  */
+#undef ABS /* be safe */
+#define ABS(expr) ((expr) < 0 ? -(expr) : (expr))
+
+#define MAGSTEP_MAX 40
+
+unsigned
+kpse_magstep_fix P3C(unsigned, dpi,  unsigned, bdpi,  int *, m_ret)
+{
+  int m;
+  int mdpi = -1;
+  unsigned real_dpi = 0;
+  int sign = dpi < bdpi ? -1 : 1; /* negative or positive magsteps? */
+  
+  for (m = 0; !real_dpi && m < MAGSTEP_MAX; m++) /* don't go forever */
+    {
+      mdpi = magstep (m * sign, bdpi);
+      if (ABS (mdpi - (int) dpi) <= 1) /* if this magstep matches, quit */
+        real_dpi = mdpi;
+      else if ((mdpi - (int) dpi) * sign > 0) /* if gone too far, quit */
+        real_dpi = dpi;
+    }
+  
+  /* If requested, return the encoded magstep (the loop went one too far).  */
+  if (m_ret)
+    *m_ret = real_dpi == mdpi ? (m - 1) * sign : 0;
+
+  /* Always return the true dpi found.  */
+  return real_dpi ? real_dpi : dpi;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/magstep.h
@@ -0,0 +1,45 @@
+/* magstep.h: declaration for magstep fixing.
+
+Copyright (C) 1994 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_MAGSTEP_H
+#define KPATHSEA_MAGSTEP_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+/* If DPI is close enough to some magstep of BDPI, return the true dpi
+   value, and the magstep found (or zero) in M_RET (if
+   non-null). ``Close enough'' means within one pixel.
+   
+   M_RET is slightly encoded: the least significant bit is on for a
+   half-magstep, off otherwise.  Thus, a returned M_RET of 1 means
+   \magstephalf, i.e., sqrt(1.2), i.e., 1.09544.  Put another way,
+   return twice the number of magsteps.
+   
+   In practice, this matters for magstephalf.  Floating-point computation
+   with the fixed-point DVI representation leads to 328 (for BDPI ==
+   300); specifying `at 11pt' yields 330; the true \magstephalf is 329
+   (that's what you get if you run Metafont with mag:=magstep(.5)).
+   
+   The time to call this is after you read the font spec from the DVI
+   file, but before you look up any files -- do the usual floating-point
+   computations, and then fix up the result.  */
+
+extern unsigned kpse_magstep_fix P3H(unsigned dpi, unsigned bdpi, int *m_ret);
+
+#endif /* not KPATHSEA_MAGSTEP_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/make-suffix.c
@@ -0,0 +1,50 @@
+/* make-suffix.c: unconditionally add a filename suffix.
+
+Copyright (C) 1992, 93, 95 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+#include <kpathsea/c-pathch.h>
+
+/* Return a new string: S suffixed with SUFFIX, regardless of what it
+   was before. This returns a newly allocated string.  */ 
+
+string
+make_suffix P2C(const_string, s,  const_string, suffix)
+{
+  string new_s;
+  const_string dot_pos = strrchr (s, '.');
+  const_string slash_pos;
+  
+  for (slash_pos = s + strlen (s) - 1; slash_pos > dot_pos && slash_pos > s;
+       slash_pos--) {
+    if (IS_DIR_SEP (*slash_pos))
+      break;
+  }
+
+  if (dot_pos == NULL || slash_pos > dot_pos )
+    new_s = concat3 (s, ".", suffix);
+  else
+    {
+      unsigned past_dot_index = dot_pos + 1 - s;
+      
+      new_s = xmalloc (past_dot_index + strlen (suffix) + 1);
+      strncpy (new_s, s, dot_pos + 1 - s);
+      strcpy (new_s + past_dot_index, suffix);
+    }
+
+  return new_s;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/ChangeLog
@@ -0,0 +1,657 @@
+Thu Feb  6 17:35:18 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* Kpathsea 3.0, Web2c 7.0, etc.
+
+Sat Feb  1 14:51:16 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* dist.make: Copy acsite.m4 to etc/autoconf instead of ./aclocal.m4.
+
+Sat Jan 18 17:07:22 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* dist.make (dist): Depend on depend, not depend.make, so we will
+	always make depend at dist time.
+
+	* rdepend.make (depend): Remove dependency on paths.h; why should
+	we remake depend.make then?
+
+Thu Jan 16 14:59:01 1997  Karl Berry  <karl@cs.umb.edu>
+
+	* dist.make (top_files): Add dir.
+
+Tue Dec 10 15:02:52 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* dist.make: Remove autoconf stuff, just create the necessary stuff
+	in etc/.
+
+Tue Dec  3 17:32:48 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* rdepend.make (depend): Include -I$(c_auto_h_dir) for web2c/window.
+
+Sun Nov 24 16:32:01 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* config.make (configure_in): Add xt.ac from Kpathsea.
+
+	* dist.make (dist): Copy new etc/ directory.
+	(top_files): Remove various informational files now in etc/.
+
+Fri Nov 15 16:20:58 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* common.make (INSTALL_SCRIPT): Define as $(INSTALL_PROGRAM).
+
+Fri Oct 25 16:52:00 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* clean.make (mostlyclean): Do not remove PROF etc. here,
+	they are only in kpathsea.
+
+	* dist.make (top_files): Include the empty dir file from the
+	Texinfo distribution.
+
+Tue Oct 15 17:45:28 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* dist.make (top_files): Add klibtool, config.guess, config.sub,
+	acklibtool.m4; unixtex.ftp.
+
+Sat Oct  5 17:21:08 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* rdepend.make (depend): Oops, need to parenthesize the extra
+	kpathsea stuff.
+
+Sun Sep 22 16:01:38 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* rdepend.make (depend): Generate dependencies for .lo instead of
+		.o in kpathsea (except for kpsewhich).
+
+Fri Sep  6 16:38:49 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* common.make (INSTALL_LIBTOOL_PROG): We will name this
+		install-prog, not install-progs.
+
+Tue Sep  3 19:10:57 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* config.make (configure_in): Add acklibtool.m4 as a dependency.
+
+Sun Sep  1 17:25:24 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* common.make (LIBTOOL): Define as @LIBTOOL@ for Autoconf expansion.
+
+Sat Jul 27 14:44:34 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* rdepend.make (depend: Depend on $(kpathsea_dir)/paths.h.
+
+Fri Jul 26 15:26:01 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* clean.make (clean): Move binary/library removal from
+	mostlyclean, and also remove *.bad (the libtool wrapper scripts).
+	(mostlyclean): Remove *.lo, PROF, PROF_SHARED, SHARED, and STATIC.
+
+	* programs.make (kpathsea_link): Use $(link_command) here, libtool 0.5.
+	* common.make (compile): New variable.
+	(kpathsea): Now $(kpathsea_dir)/libkpathsea.la.
+	(INSTALL_LIBTOOL_*): New install variables.
+	* co.make: Move .c.o rule back to common.make, remove this.
+
+Fri Jun  7 18:44:15 1996  K. Berry  <kb@cs.umb.edu>
+
+	* tkpathsea.make (.c.o): Move here.
+	* common.make: FRom here.
+
+Thu Jun  6 19:42:48 1996  K. Berry  <kb@cs.umb.edu>
+
+	* config.make (config.status): Remove --verbose.
+
+	* programs.make: Remove our sharedlib stuff.
+
+Sat Jun  1 13:47:17 1996  Karl Berry  <karl@cs.umb.edu>
+
+	* dist.make (dist): Check for ` ::' in Texinfo files.
+
+Sun Apr 28 14:58:27 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (ALL_CPPFLAGS): Move $(prog_cflags) to be before
+        -I$(kpathsea_srcdir_parent), so subdirs of web2c find the right
+	c-auto.h.
+        From: Peter Breitenlohner <peb@MPPMU.MPG.DE>.
+        
+Fri Apr 26 13:36:03 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * paths.make (dvi{ps,lj}_{plain,latex}_macrodir): Add these.
+        (install_fonts, install_macros): Remove these.
+        * common.make (CP_R): Remove this.
+        * makevars.make (makevars): Remove install_fonts and
+        install_macros, add dvi*_macrodir.
+
+Tue Feb 13 14:31:24 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * programs.make: Doc fix.
+
+Fri Feb  9 15:49:01 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * config.make (configure_in): Add dependency withenable.ac.
+
+Tue Feb  6 16:40:17 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * makevars.make (makevars): Include install_macros.
+
+Sat Feb  3 15:14:53 1996  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (DEFS): Add this.
+
+Fri Dec 29 17:07:02 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * clean.make: Rename from misc.make.
+
+        * rdepend.make (TAGS): Add rule for TAGS.
+
+        * dist.make (dist): Do not depend on TAGS.
+
+Sat Dec  9 19:42:18 1995  Ulrik Vieth  <vieth@thphy.uni-duesseldorf.de>
+
+	* paths.make (mftinputdir): Add search path for MFT style files
+        since they have a separate directory in the TDS.
+
+Sat Nov 18 17:13:07 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * misc.make (mostlyclean): Include $(library).a again, for web2c/lib.
+
+Fri Nov 17 13:33:46 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * paths.make (bindir, etc.): Use @bindir@, etc., since Autoconf
+        2.4.2 substitutes for these (and has options to set them).
+
+        * common.make (sharedlibname, staticlibname): New variables for
+        convenience.
+        (sharedlib, staticlib): Use them.
+
+        * dist.make (dist): Keep name of unixtex.ftp.
+
+        * misc.make (extraclean): Remove *.mpx and mpout.*.
+
+Sun Nov 12 17:18:34 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (shared_env): Oops, had @shared_envvar@ instead of
+        @sharedlib_envvar@.
+
+Sat Nov 11 16:39:35 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * rdepend.make (depend): Use ALL_CPPFLAGS rather than just CPPFLAGS.
+
+Sun Oct 22 16:54:18 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (shared_env): New variable to set LD_LIBRARY_PATH or
+        whatever.
+
+Mon Oct  2 16:18:23 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * misc.make (mostlyclean): Remove lib$(library).*, not $(library).a.
+
+Fri Sep 29 11:25:35 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (ALL_CPPFLAGS): Rename from CPPFLAGS, so users can
+        set the CPPFLAGS envvar a la CFLAGS.
+
+Thu Sep 21 16:34:50 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * (many files): Avoid unnecessary blank lines.
+
+Tue Sep 19 17:18:42 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * paths.make (datadir): Change to $(prefix)/share.
+        Change other variables for TDS compliance.
+
+Sat Sep  2 17:40:55 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * misc.make (distclean): Do not remove MakeTeXPK anymore.
+
+Fri Sep  1 13:24:19 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * programs.make (LOADLIBES): Put the -L/-l here.
+        * common.make (kpathsea): Define as the real filename.
+        (shared_ext, etc.): Move there.
+
+Thu Aug 31 17:39:10 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (kpathsea): Use -L and -l instead of giving the .a
+        file, for the shared case.
+
+Tue Aug 29 17:35:08 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * config.make: Use date instead of echo to update timestamps, for
+        ``some old BSD systems''.
+
+Mon Aug 28 17:54:44 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * programs.make: Add shared library variables.
+
+Fri Aug 25 12:07:45 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tkpathsea.make: Use && instead of ; after the cd.
+
+        * rdepend.make (depend): Replace all leading ../'s with
+        $(kpathsea_srcdir), not just one.
+
+Tue Aug 22 14:04:04 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * rdepend.make (c_auto_h_dir): New variable so subdirs of web2c
+        can use this.
+
+Sun Aug 20 14:49:46 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * misc.make (TAGS): Remove this.
+
+        * paths.make (dcfontdir): Remove this.
+
+Thu Aug 10 19:22:20 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * paths.make (default_texsizes): Note this list must be sorted in
+        ascending order.
+
+Thu Aug  3 11:26:10 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * dist.make (dist): Depend on all.
+
+Sat Jul 29 17:31:47 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (transform): Remove this. It's not worth it.
+
+Fri Jul 28 15:37:37 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * rdepend.make: Comment this out in the distribution.
+        From Greg.
+
+Sat Jul 22 17:13:57 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * paths.make (mppooldir, memdir, mpinputdir): Add these.
+        * makevars.make (makevars): Include mpinputdir, memdir, and
+        mppooldir.
+
+Tue Jul 18 14:32:55 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (transform): Include this, another configure
+        substitution.
+
+Mon Jul 17 15:58:40 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tkpathsea.make: Doc fix.
+
+Sun Jul 16 14:09:41 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * config.make (stamp-auto.in): acconfig.h is now always in kpathsea.
+
+Tue May 16 15:52:50 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tkpathsea.make: Mention that the dependencies are wrong :-(.
+
+        * common.make (XDEFS): Add -D__USE_FIXED_PROTOTYPES__ for
+        development use under SunOS 4.1.3.
+
+Tue Apr 25 13:49:38 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * misc.make (distclean): No need to remove .pool here, no one has
+        pool files but web2c.
+
+Fri Feb 24 15:11:39 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * dist.make (ln_files): Don't include TAGS in the distributions.
+
+Sun Jan  8 12:16:36 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * kpathsea 2.6/dviljk 2.5/dvipsk 5.58f/xdvik 18f.
+
+Wed Jan  4 12:41:25 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * tkpathsea.make (kpathsea): Don't depend on texmf.cnf, since it
+        doesn't exist at the first make.
+
+Tue Jan  3 13:43:12 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * rdepend.make (depend): paths.h is not in the srcdir.
+
+        * config.make (autoconf): Add acsite.m4.
+
+        * dist.make (top_files): FTP belongs here, not in ln_files.
+
+Sun Jan  1 14:02:42 1995  Karl Berry  <karl@cs.umb.edu>
+
+        * makevars.make (makevars): Include web2cdir.
+        * paths.make (web2cdir): New directory.  Suggested by Joachim.
+
+Sat Dec 31 14:35:29 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tmtpk.make: Just incorporate this in kpathsea/Makefile.in now.
+
+        * rdepend.make (depend): Depend on ourselves.
+
+Fri Dec 30 15:50:37 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * rdepend.make (depend): Use kpathsea_srcdir, not kpathsea_dir.
+        From Joachim.
+
+Wed Dec 28 14:16:50 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * dist.make (ln_files): Add FTP.
+
+Mon Dec 26 10:31:14 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * dist.make (dist): Copy aclocal.m4 from acsite.m4.
+        Suggested by interran@uluru.Stanford.EDU (John Interrante).
+
+Wed Dec 14 15:17:42 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * kpathsea 2.5/dviljk 2.4/dvipsk 5.58e/xdvik 18e.
+
+Sun Dec 11 13:23:12 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * rdepend.make (depend): Remove system include files that are
+        alone on a line.
+
+Fri Nov 25 09:21:02 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tmtpk.make (MakeTeXPK): Depend on the new filename.
+
+Tue Nov 15 15:28:14 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * tkpathsea.make (makeargs): Change MAKEARGS to XMAKEARGS.
+
+        * targets.make (makeargs): Don't bother to pass $(SHELL).
+
+Tue Nov  8 19:12:45 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (CFLAGS): Don't include -g, since now it's automatic.
+
+Sun Nov  6 15:53:36 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * paths.make (prefix, exec_prefix): These value are now @prefix@
+        and @exec_prefix@.
+
+        * common.make: Call @SET_MAKE@.
+
+        * misc.make (distclean): Remove config.log and config.cache.
+
+        * programs.make (LDFLAGS): Add @LDFLAGS@.
+        * common.make (CPPFLAGS): Add @CPPFLAGS@.
+        (CFLAGS): Add @CFLAGS@.
+
+        * dist.make (top_files): Distribute install-sh, not install.sh,
+        for Autoconf 2.0.
+
+Sun Oct 30 16:15:34 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * config.make (ac_dir): This is now $(gnu)/share.
+
+Tue Oct 25 17:48:02 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * kpathsea 2.3/dviljk 2.3/dvipsk 5.58c/xdvik 18d.
+
+Sun Oct 23 17:33:56 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * targets.make (MakeTeXPK): Make sed substitutions global.
+        Reported by wfranzki@hlrserv.hlrz.kfa-juelich.de.
+
+Mon Oct 17 13:28:41 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * paths.make (mfpooldir): Doc fix.
+
+Fri Oct 14 10:31:35 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * kpathsea 2.2/dviljk 2.2/dvipsk 5.58b/xdvik 18c.
+
+Mon Oct 10 15:31:06 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * common.make (.SUFFIXES): Declare .c.o.
+
+        * programs.make (LOADLIBES): Omit LEXLIB here.
+
+Sun Sep 25 15:54:36 1994  Karl Berry  <karl@cs.umb.edu>
+
+        * rdepend.make: Doc fix.
+
+        * library.make: New file.
+
+        * makevars.make (makevars): Remove MAKEARGS from here.
+
+        * programs.make (CCLD, link_command): New variables.
+        (LOADLIBES): Add proglib, LEXLIB.
+
+Mon Sep 12 11:06:14 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * kpathsea 2.1/dviljk 2.1/dvipsk 5.58a/xdvik 18b.
+
+Sun Sep 11 14:44:21 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * targets.make (install-MakeTeXPK): Install this if it didn't
+        exist, and mkdirchain $(scriptdir).
+
+        * dist.make (top_files): Include aclocal.m4.
+
+Sat Sep 10 13:40:10 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * texi.make (.texi.dvi): No -o option to texi2dvi.
+
+Thu Sep  8 14:31:59 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * kpathsea 2.0, dviljk 2.0, dvipsk 5.55b, xdvik 18a.
+
+Tue Sep  6 11:39:06 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * targets.make (MakeTeXPK): Use psheaderdir, not psconfigdir, and
+        depend on ourselves.
+
+Sat Sep  3 08:37:11 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.make (psconfigdir): Toss this.
+
+        * misc.make (distclean): Add MakeTeXPK.
+
+        * rdepend.make: Rename from depend.make.
+
+Fri Sep  2 13:29:14 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * targets.make (makeargs, installargs): Declare these here.
+
+        * makevars.make (makevars): No need for ??_fontdir or psmacrodir.
+
+        * misc.make (TAGS): Omit -t, use -i, for Emacs 19.25's etags.
+
+Thu Sep  1 17:51:10 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * dist.make (top_files): Add install.sh.
+
+Tue Aug 30 14:46:18 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * dist.make (dist): Touch *.info* if they exist.
+
+Mon Aug 29 16:28:19 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.make (dcfontdir, sauterdir): Move these here, since
+        everyone has MakeTeXPK now.
+
+Sun Aug 28 17:09:09 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * common.make (INSTALL_FONTS): New variable.
+
+Thu Aug 25 17:04:43 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * kpathsea.make (kpathsea): Also depend on texmf.cnf.in.
+
+        * paths.make (texmf_prefix): Rename to texmf; change uses.
+
+Sun Aug 21 11:03:48 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * programs.make: New file for driver-specific stuff.
+
+        * paths.make (fontnamedir): New definition.
+        (configdir, headerdir): Prepend with `ps'.
+
+Sat Aug 13 17:19:53 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * misc.make (mostlyclean): Don't remove $(lib), since we've tossed
+        that.
+
+Sun Jul 31 14:18:28 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.make (DB_DIR, DB_NAME): Remove from here.
+
+Fri Jul 29 14:56:47 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * depend.make (depend): Add dvilj4l.o to the special cases.
+
+Sun Jul 17 11:37:57 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.make (db_dir): Use $TEXMF.
+
+Mon Jun 27 17:32:47 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.make (db_dir): Use $TEXMFROOT.
+
+Tue Jun 14 12:41:33 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * depend.make (depend): No need for depend_encies, I think.
+
+Mon May 30 13:50:34 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * common.make (LDFLAGS): Don't include $(CFLAGS), for Linux's sake. 
+
+Tue May 24 13:26:05 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * config.make (stamp-auto, stamp-auto.in): New targets, to avoid
+        rerunning autoheader/autoconf even when they don't change the main
+        output files.
+
+Sun Apr 17 16:11:34 1994  Karl Berry  (karl@ra.cs.umb.edu)
+
+        * config.make (configure): Change ; to && in case the cd fails.
+
+Thu Mar 24 11:12:56 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * dist.make (dist): Don't append kutil/ChangeLog to the source
+        ChangeLog.
+
+        * misc.make (extraclean): Don't delete patch*, since that kills
+        patchlevel.h.
+
+Sat Mar  5 13:48:15 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * common.make (LOADLIBES): Include XLOADLIBES.
+
+Fri Feb 25 14:21:17 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * dist.make (dist): Append kutil/ChangeLog to the top level, not
+        the main program.
+
+Thu Feb 24 16:11:37 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * misc.make (clean): Remove *.lj here.
+
+        * paths.make ({bh,cg,mt}_fontdir, install_fonts): Add these.
+
+Mon Feb 21 14:04:26 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * misc.make (distclean): remove pool files here.
+
+Wed Feb 16 15:18:13 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.make: Doc fix.
+
+Sun Jan 23 17:17:37 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * dist.make (dist): Don't fake kpathsea/MACHINES any more, now we
+        have a real one.
+
+Fri Jan 14 14:53:12 1994  Karl Berry  (karl@cs.umb.edu)
+
+        * paths.make ({tex,mf}pooldir, fmtdir, basedir): Use
+        $(texmf_prefix)/ini for all these.
+
+Tue Dec 21 19:23:29 1993  Karl Berry  (karl@cs.umb.edu)
+
+        * common.make (LDFLAGS): Don't include $(x_lib_flags) here --
+        winds up getting included twice for virmf
+
+Tue Dec 14 17:40:23 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* dist.make (dist): Dist the top-level and kutil/ChangeLog.
+
+	* paths.make (formatdir): Rename to fmtdir.
+	(texprefix): Rename to texmf_prefix, change uses accordingly.
+
+Fri Dec 10 17:50:39 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* paths.make (dvipsprefix): Rename to dvips_prefix.
+
+Sun Nov 14 11:52:33 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* dist.make (dist): Do not depend on depend.make and TAGS, since
+	web2c doesn't have them.
+
+	* paths.make: Change defaults for new hierarchy.
+
+Thu Nov 11 11:07:22 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* common.make (CPPFLAGS, LDFLAGS): xincludedir, xlibdir, wlibs
+	names have changed.
+
+Sun Nov  7 15:22:32 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* paths.h: Give dire warning that editing Makefiles will not
+	rebuild paths.h.
+
+Fri Oct 29 14:01:57 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* dist.make (dist): chmod a+rw.
+
+Thu Oct 28 17:48:01 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* common.make (CPPFLAGS): Include -I. before -I$(srcdir).
+
+Fri Oct 22 13:08:19 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* paths.make: Remove the paths, and add the dvips directories.
+
+	* common.make (kpathsea_srcdir{,_parent}): Define. From
+	simon@lia.di.epfl.ch.
+
+Tue Oct 19 15:59:03 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* config.make (stamp-c-auto): New target.
+	(c-auto.h): Depend on it.
+
+Sat Oct  9 07:04:45 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* misc.make (mostlyclean): Remove programs.
+
+Sun Oct  3 12:44:04 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* misc.make (extraclean): Also remove .blg and .bbl, .vf and .vpl.
+	(clean): Remove *.pool.
+
+Tue Sep 28 13:11:01 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* common.make (CPPFLAGS): Add $(xincludedir) again; when did I
+	remove it?
+
+Fri Sep 24 07:53:45 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* common.make (warn_more) [kpathsea]: Move to kpathsea's Makefile.
+
+	* texi.make (.texi.dvi): New rule.
+
+	* common.make (warn_more): Had -pointer-arith twice.
+
+Thu Sep 23 17:42:42 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* common.make (autoconf): Toss aclocal.m4.
+	* dist.make (top_files): Ditto.
+	
+	* common.make (autoheader): New variable, split off from autoconf.
+
+Sun Aug 29 11:30:39 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* dist.make (dist): Remove MACHINES in kpathsea.
+
+	* common.make (CPPFLAGS): Remove the -I.  Why did I put it there?
+
+Sat Aug 28 07:01:52 1993  Karl Berry  (karl@cs.umb.edu)
+
+	* unbackslsh.awk: New file.
+
+	* common.make (CPPFLAGS): Add -I before $(xincludedir).
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/README
@@ -0,0 +1,6 @@
+make -- this subdirectory contains Makefile fragments.
+
+configure substitutes them for ac_include lines in Makefile.in.
+(This is an enhancement to standard Autoconf; see aclocal.m4.)
+
+kb@mail.tug.org
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/clean.make
@@ -0,0 +1,25 @@
+# clean.make -- cleaning.
+mostlyclean::
+	rm -f *.o
+
+clean:: mostlyclean
+	rm -f $(program) $(programs) squeeze lib$(library).* $(library).a *.bad
+	rm -f *.dvi *.lj
+
+distclean:: clean
+	rm -f Makefile
+	rm -f config.status config.log config.cache c-auto.h 
+
+# Although we can remake configure and c-auto.h.in, we don't remove
+# them, since many people may lack Autoconf.  Use configclean for that.
+maintainer-clean:: distclean
+	rm -f *.info*
+
+extraclean::
+	rm -f *.aux *.bak *.bbl *.blg *.dvi *.log *.pl *.tfm *.vf *.vpl *gf *pk
+	rm -f *.mpx *.i *.s *~ *.orig  *.rej *\#*
+	rm -f CONTENTS.tex a.out core mfput.* texput.* mpout.*
+
+configclean:
+	rm -f configure c-auto.h.in c-auto.h
+# End of clean.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/common.make
@@ -0,0 +1,47 @@
+# common.make -- used by all Makefiles.
+SHELL = /bin/sh
+@SET_MAKE@
+top_srcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC = @CC@
+CFLAGS = @CFLAGS@ $(XCFLAGS)
+CPPFLAGS = @CPPFLAGS@ $(XCPPFLAGS)
+DEFS = @DEFS@ $(XDEFS)
+
+# Kpathsea needs this for compiling, programs need it for linking.
+LIBTOOL = $(kpathsea_srcdir_parent)/klibtool
+
+# You can change [X]CPPFLAGS, [X]CFLAGS, or [X]DEFS, but
+# please don't change ALL_CPPFLAGS or ALL_CFLAGS.
+# prog_cflags is set by subdirectories of web2c.
+ALL_CPPFLAGS = $(DEFS) -I. -I$(srcdir) $(prog_cflags) \
+  -I$(kpathsea_parent) -I$(kpathsea_srcdir_parent) $(CPPFLAGS)
+ALL_CFLAGS = $(ALL_CPPFLAGS) $(CFLAGS) -c
+compile = $(CC) $(ALL_CFLAGS)
+
+.SUFFIXES: .c .o # in case the suffix list has been cleared, e.g., by web2c
+.c.o:
+	$(compile) $<
+
+# Installation.
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = $(INSTALL_PROGRAM)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_LIBTOOL_LIBS = INSTALL_DATA='$(INSTALL_DATA)' $(LIBTOOL) install-lib
+INSTALL_LIBTOOL_PROG = INSTALL_PROGRAM='$(INSTALL_PROGRAM)' $(LIBTOOL) install-prog
+
+# We use these for many things.
+kpathsea_parent = ..
+kpathsea_dir = $(kpathsea_parent)/kpathsea
+kpathsea_srcdir_parent = $(top_srcdir)/..
+kpathsea_srcdir = $(kpathsea_srcdir_parent)/kpathsea
+kpathsea = $(kpathsea_dir)/libkpathsea.la
+
+##ifeq ($(CC), gcc)
+##XDEFS = -D__USE_FIXED_PROTOTYPES__ -Wall -Wpointer-arith $(warn_more)
+##CFLAGS = -g $(XCFLAGS)
+##endif
+# End of common.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/config.make
@@ -0,0 +1,47 @@
+# config.make -- autoconf rules to remake the Makefile, c-auto.h, etc.
+##ifdef HOSTNAME
+##ac_dir = $(gnu)/share/autoconf
+##autoconf = $(ac_dir)/acspecific.m4 $(ac_dir)/acgeneral.m4 $(ac_dir)/acsite.m4
+##autoheader = $(ac_dir)/acconfig.h $(ac_dir)/autoheader.m4
+##
+### I define $(autoconf) to acgeneral.m4 and the other Autoconf files, so
+### configure automatically gets remade in the sources with a new Autoconf
+### release.  But it would be bad for installers with Autoconf to remake
+### configure (not to mention require Autoconf), so I take out the variable
+### $(autoconf) definition before release.
+### 
+### BTW, xt.ac isn't really required for dvipsk or dviljk, but it doesn't
+### seem worth the trouble.
+### 
+##configure_in = $(srcdir)/configure.in $(kpathsea_srcdir)/common.ac \
+##  $(kpathsea_srcdir)/withenable.ac $(kpathsea_srcdir)/xt.ac \
+##  $(kpathsea_srcdir_parent)/acklibtool.m4
+##$(srcdir)/configure: $(configure_in) $(autoconf)
+##	cd $(srcdir) && autoconf
+##endif
+
+config.status: $(srcdir)/configure
+	$(SHELL) $(srcdir)/configure --no-create
+
+Makefile: $(srcdir)/Makefile.in config.status $(top_srcdir)/../make/*.make
+	$(SHELL) config.status
+
+# This rule isn't used for the top-level Makefile, but it doesn't hurt.
+# We don't depend on config.status because configure always rewrites
+# config.status, even when it doesn't change. Thus it might be newer
+# than c-auto.h when we don't need to remake the latter.
+c-auto.h: stamp-auto
+stamp-auto: $(srcdir)/c-auto.h.in
+	$(SHELL) config.status
+	date >$(srcdir)/stamp-auto
+
+##ifdef HOSTNAME
+### autoheader reads acconfig.h (and c-auto.h.top) automatically.
+##$(srcdir)/c-auto.h.in: $(srcdir)/stamp-auto.in
+##$(srcdir)/stamp-auto.in: $(configure_in) $(autoheader) \
+##  $(kpathsea_srcdir)/acconfig.h
+##	cd $(srcdir) && autoheader --localdir=$(kpathsea_srcdir)
+##	date >$(srcdir)/stamp-auto.in
+##endif
+
+# End of config.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/dist.make
@@ -0,0 +1,36 @@
+# dist.make -- making distribution tar files.
+top_distdir = $(distname)-$(version)
+top_files = ChangeLog Makefile.in README configure.in configure install-sh \
+  acklibtool.m4 config.guess config.sub klibtool $(HOME)/bin/mkdirchain
+distdir = $(top_distdir)/$(distname)
+kpathsea_distdir = ../$(distname)/$(top_distdir)/kpathsea
+ln_files = AUTHORS ChangeLog INSTALL NEWS README *.in *.h *.c \
+  configure *.make .gdbinit stamp-auto
+
+dist_rm_predicate = -name depend.make -o -name Makefile
+dist: all depend pre-dist-$(distname)
+	rm -rf $(top_distdir)*
+	mkdir -p $(distdir)
+	cd .. && make Makefile ./configure
+	cd .. && ln $(top_files) $(distname)/$(top_distdir)
+	cp $(txinfo)/dir $(top_distdir)
+	-ln $(ln_files) $(distdir)
+	ln $(program_files) $(distdir)
+	cd $(kpathsea_dir); $(MAKE) distdir=$(kpathsea_distdir) \
+	  ln_files='$(ln_files)' distdir
+	cp -pr ../make ../etc $(top_distdir)
+	ln -s $(gnu)/share/autoconf/acsite.m4 $(top_distdir)/etc/autoconf
+	rm -rf $(top_distdir)/make/RCS
+	ungnumake `find $(top_distdir) -name Makefile.in -o -name \*.make`
+# Remove the extra files our patterns got us.
+	cd $(top_distdir); rm -f */c-auto.h
+	find $(top_distdir) \( $(dist_rm_predicate) \) -exec rm '{}' \;
+	find $(top_distdir) -name \.*texi -exec egrep -ni '	| ::|xx[^}]' \;
+	$(MAKE) post-dist-$(distname)
+	cd $(distdir); add-version $(version) $(version_files)
+	cd $(distdir); test ! -r *.info || touch *.info*
+	chmod -R a+rwX $(top_distdir)
+	GZIP=-9 tar chzf $(top_distdir).tar.gz $(top_distdir)
+	rm -rf $(top_distdir)
+
+# End of dist.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/library.make
@@ -0,0 +1,5 @@
+# library.make -- stuff only useful for libraries.
+AR = ar
+ARFLAGS = cq
+RANLIB = @RANLIB@
+# End of library.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/makevars.make
@@ -0,0 +1,16 @@
+# makevars.make -- the directory names we pass.
+# It's important that none of these values contain [ @%], for the sake
+# of kpathsea/texmf.sed.
+makevars = prefix=$(prefix) exec_prefix=$(exec_prefix) \
+  bindir=$(bindir) scriptdir=$(scriptdir) libdir=$(libdir) \
+  datadir=$(datadir) infodir=$(infodir) includedir=$(includedir) \
+  manext=$(manext) mandir=$(mandir) \
+  texmf=$(texmf) web2cdir=$(web2cdir) \
+  texinputdir=$(texinputdir) mfinputdir=$(mfinputdir) mpinputdir=$(mpinputdir)\
+  fontdir=$(fontdir) fmtdir=$(fmtdir) basedir=$(basedir) memdir=$(memdir) \
+  texpooldir=$(texpooldir) mfpooldir=$(mfpooldir) mppooldir=$(mppooldir) \
+  dvips_plain_macrodir=$(dvips_plain_macrodir) \
+  dvilj_latex2e_macrodir=$(dvilj_latex2e_macrodir) \
+  dvipsdir=$(dvipsdir) psheaderdir=$(psheaderdir) \
+  default_texsizes='$(default_texsizes)'
+# End of makevars.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/paths.make
@@ -0,0 +1,89 @@
+# paths.make -- installation directories.
+#
+# The compile-time paths are defined in kpathsea/paths.h, which is built
+# from kpathsea/paths.h.in and these definitions.  See kpathsea/INSTALL
+# for how the various path-related files are used and created.
+
+# Do not change prefix and exec_prefix in Makefile.in!
+# configure doesn't propagate the change to the other Makefiles.
+# Instead, give the -prefix/-exec-prefix options to configure.
+# (See kpathsea/INSTALL for more details.) This is arguably
+# a bug, but it's not likely to change soon.
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+# Architecture-dependent executables.
+bindir = @bindir@
+
+# Architecture-independent executables.
+scriptdir = $(bindir)
+
+# Architecture-dependent files, such as lib*.a files.
+libdir = @libdir@
+
+# Architecture-independent files.
+datadir = @datadir@
+
+# Header files.
+includedir = @includedir@
+
+# GNU .info* files.
+infodir = @infodir@
+
+# Unix man pages.
+manext = 1
+mandir = $(prefix)/man/man$(manext)
+
+# TeX system-specific directories. Not all of the following are relevant
+# for all programs, but it seems cleaner to collect everything in one place.
+
+# The default paths are now in kpathsea/paths.h.in. Passing all the
+# paths to sub-makes can make the arg list too long on system V.
+
+# The root of the main tree.
+texmf = $(datadir)/texmf
+
+# Regular input files.
+texinputdir = $(texmf)/tex
+mfinputdir = $(texmf)/metafont
+mpinputdir = $(texmf)/metapost
+mftinputdir = $(texmf)/mft
+
+# dvips's epsf.tex, rotate.tex, etc. get installed here;
+# ditto for dvilj's fonts support.
+dvips_plain_macrodir = $(texinputdir)/plain/dvips
+dvilj_latex2e_macrodir = $(texinputdir)/latex/dvilj
+
+# MakeTeXPK.site, texmf.cnf, etc.
+web2cdir = $(texmf)/web2c
+
+# The top-level font directory.
+fontdir = $(texmf)/fonts
+
+# Memory dumps (.fmt/.base/.mem).
+fmtdir = $(web2cdir)
+basedir = $(fmtdir)
+memdir = $(fmtdir)
+
+# Pool files.
+texpooldir = $(web2cdir)
+mfpooldir = $(texpooldir)
+mppooldir = $(texpooldir)
+
+# Where the .map files from fontname are installed.
+fontnamedir = $(texmf)/fontname
+
+# For dvips configuration files, psfonts.map, etc.
+dvipsdir = $(texmf)/dvips
+
+# For dvips .pro files, gsftopk's render.ps, etc.
+psheaderdir = $(dvipsdir)
+
+# If a font can't be found close enough to its stated size, we look for
+# each of these sizes in the order given.  This colon-separated list is
+# overridden by the envvar TEXSIZES, and by a program-specific variable
+# (e.g., XDVISIZES), and perhaps by a config file (e.g., in dvips).
+# This list must be sorted in ascending order.
+default_texsizes = 300:600
+
+# End of paths.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/programs.make
@@ -0,0 +1,19 @@
+# programs.make -- used by Makefiles for executables only.
+
+# Don't include $(CFLAGS), since ld -g under Linux forces
+# static libraries, e.g., libc.a and libX*.a.
+LDFLAGS = @LDFLAGS@ $(XLDFLAGS)
+
+# proglib is for web2c; 
+# XLOADLIBES is for the installer.
+LIBS = @LIBS@
+LOADLIBES = $(proglib) $(kpathsea) $(LIBS) -lm $(XLOADLIBES)
+
+# May as well separate linking from compiling, just in case.
+CCLD = $(CC)
+link_command = $(CCLD) -o $@ $(LDFLAGS) 
+
+# When we link with Kpathsea, have to take account that it might be a
+# shared library, etc.
+kpathsea_link = $(LIBTOOL) link $(link_command)
+# End of programs.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/rdepend.make
@@ -0,0 +1,42 @@
+# rdepend.make -- rules for remaking the dependencies.
+# 
+# Have to use -M, not -MM, since we use <kpathsea/...> instead of
+# "kpathsea/..." in the sources.  But that means we have to remove the
+# directory prefixes and all the system include files.
+# And <kpathsea/paths.h> is generated, not part of the distribution.
+# 
+# And, there's no need for any installer/user to ever run this, it can
+# only cause trouble. So comment it out in the distribution.
+# (It doesn't work when the source and build directories are different.)
+##ifndef c_auto_h_dir
+##c_auto_h_dir = .
+##endif
+##ifdef HOSTNAME
+##depend depend.make:: $(c_auto_h_dir)/c-auto.h \
+##  $(top_srcdir)/../make/rdepend.make 
+##	$(CC) -M $(ALL_CPPFLAGS) -I$(c_auto_h_dir) *.c \
+##	  | sed -e 's,\(\.\./\)\+kpathsea/,$$(kpathsea_srcdir)/,g' \
+##	        -e 's,$$(kpathsea_srcdir)/paths.h,$$(kpathsea_dir)/paths.h,g' \
+##	        -e 's,/usr[^ ]* ,,g' \
+##	        -e 's,/usr[^ ]*$$,,g' \
+##	        -e 's,dvi2xx.o,dvilj.o dvilj2p.o dvilj4.o dvilj4l.o,' \
+##	  | grep -v '^ *\\$$' \
+##	  >depend.make
+### If kpathsea, we're making .lo library objects instead of .o's.
+##	pwd | grep -v kpathsea >/dev/null \
+##	  || (sed -e 's/\.o:/.lo:/' -e 's/kpsewhich.lo:/kpsewhich.o:/' \
+##	      <depend.make >depend-tmp.make; mv depend-tmp.make depend.make)
+##.PHONY: depend
+##endif
+
+# Let's stick a rule for TAGS here, just in case someone wants them.
+# (We don't put them in the distributions, to keep them smaller.)
+TAGS: *.c *.h
+	pwd | grep kpathsea >/dev/null && append=../kpathsea/TAGS; \
+	  etags $$append *.[ch]
+	
+
+# Prevent GNU make 3.[59,63) from overflowing arg limit on system V.
+.NOEXPORT:
+
+# End of rdepend.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/texi.make
@@ -0,0 +1,23 @@
+# texi.make -- making .dvi and .info from .texi.
+MAKEINFO = makeinfo
+MAKEINFO_FLAGS = --paragraph-indent=2 -I$(HOME)/gnu/gnuorg
+# That -I is purely for my own benefit in doing `make dist'.  It won't
+# hurt anything for you (I hope).
+TEXI2DVI = texi2dvi
+
+TEXI2HTML = texi2html
+TEXI2HTML_FLAGS = -split_node -menu
+# If you prefer one big .html file instead of several, remove
+# -split-node or replace it by -split_chapter.
+
+# For making normal text files out of Texinfo source.
+one_info = --no-headers --no-split --no-validate
+
+.SUFFIXES: .info .dvi .html .texi
+.texi.info:
+	$(MAKEINFO) $(MAKEINFO_FLAGS) $< -o $@
+.texi.dvi:
+	$(TEXI2DVI) $(TEXI2DVI_FLAGS) $<
+.texi.html:
+	$(TEXI2HTML) $(TEXI2HTML_FLAGS) $< 
+# End of texi.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/make/tkpathsea.make
@@ -0,0 +1,9 @@
+# tkpathsea.make -- target for remaking kpathsea.
+makeargs = $(MFLAGS) CC='$(CC)' CFLAGS='$(CFLAGS)' $(XMAKEARGS)
+
+# This is wrong: the library doesn't depend on kpsewhich.c or
+# acconfig.h.  But what to do?
+$(kpathsea): $(kpathsea_srcdir)/*.c $(kpathsea_srcdir)/*.h \
+	     $(kpathsea_srcdir)/texmf.cnf.in $(top_srcdir)/../make/paths.make
+	cd $(kpathsea_dir) && $(MAKE) $(makeargs)
+# End of tkpathsea.make.
new file mode 100644
--- /dev/null
+++ b/kpathsea/path-elt.c
@@ -0,0 +1,146 @@
+/* path-elt.c: Return the stuff between colons.
+
+Copyright (C) 1993, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/pathsearch.h>
+
+
+/* The static (but dynamically allocated) area we return the answer in,
+   and how much we've currently allocated for it.  */
+static string elt = NULL;
+static unsigned elt_alloc = 0;
+
+/* The path we're currently working on.  */
+static const_string path = NULL;
+
+
+/* Upon entry, the static `path' is at the first (and perhaps last)
+   character of the return value, or else NULL if we're at the end (or
+   haven't been called).  I make no provision for caching the results;
+   thus, we parse the same path over and over, on every lookup.  If that
+   turns out to be a significant lose, it can be fixed, but I'm guessing
+   disk accesses overwhelm everything else.  If ENV_P is true, use
+   IS_ENV_SEP; else use IS_DIR_SEP.  */
+
+static string
+element P2C(const_string, passed_path,  boolean, env_p)
+{
+  const_string p;
+  string ret;
+  
+  if (passed_path)
+    path = passed_path;
+  
+  /* Check if called with NULL, and no previous path (perhaps we reached
+     the end).  */
+  else if (!path)
+    return NULL;
+  
+  /* OK, we have a non-null `path' if we get here.  */
+  assert (path);
+  p = path;
+  
+  /* Find the next colon (or the end of the path).  */
+  while (*p != 0 && (env_p ? !IS_ENV_SEP (*p) : !IS_DIR_SEP (*p)))
+    p++;
+  
+  /* If there were no separators, return the whole thing this time, and
+     return NULL next time.  */
+  if (*p == 0)
+    {
+      ret = (string) path;
+      path = NULL;
+    }
+  
+  /* Otherwise, return the substring starting at `path'.  */
+  else
+    {
+      unsigned len = p - path;
+      
+      /* Make sure we have enough space (including the null byte).  */
+      if (len + 1 > elt_alloc)
+        {
+          elt_alloc = len + 1;
+          elt = xrealloc (elt, elt_alloc);
+        }
+
+      strncpy (elt, path, len);
+      elt[len] = 0;
+      ret = elt;
+      
+      path += len + 1;
+    }
+
+  return ret;
+}
+
+string
+kpse_path_element P1C(const_string, p)
+{
+  return element (p, true);
+}
+
+string
+kpse_filename_component P1C(const_string, p)
+{
+  return element (p, false);
+}
+
+#ifdef TEST
+
+void
+print_path_elements (const_string path)
+{
+  string elt;
+  printf ("Elements of `%s':", path ? path : "(null)");
+  
+  for (elt = kpse_path_element (path); elt != NULL;
+       elt = kpse_path_element (NULL))
+    {
+      printf (" %s", *elt ? elt : "`'");
+    }
+  
+  puts (".");
+}
+
+int
+main ()
+{
+  /* All lists end with NULL.  */
+  print_path_elements (NULL);	/* */
+  print_path_elements ("");	/* "" */
+  print_path_elements ("a");	/* a */
+  print_path_elements (":");	/* "", "" */
+  print_path_elements ("::");	/* "", "", "" */
+  print_path_elements ("a:");	/* a, "" */ 
+  print_path_elements (":b");	/* "", b */ 
+  print_path_elements ("a:b");	/* a, b */ 
+  
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+standalone-compile-command: "gcc -g -I. -I.. -DTEST path-elt.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/pathsearch.c
@@ -0,0 +1,387 @@
+/* pathsearch.c: look up a filename in a path.
+
+Copyright (C) 1993, 94, 95, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/absolute.h>
+#include <kpathsea/expand.h>
+#include <kpathsea/db.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/readable.h>
+#include <kpathsea/str-list.h>
+#include <kpathsea/str-llist.h>
+#include <kpathsea/variable.h>
+
+#include <time.h> /* for `time' */
+
+/* The very first search is for texmf.cnf, called when someone tries to
+   initialize the TFM path or whatever.  init_path calls kpse_cnf_get
+   which calls kpse_all_path_search to find all the texmf.cnf's.  We
+   need to do various special things in this case, since we obviously
+   don't yet have the configuration files when we're searching for the
+   configuration files.  */
+static boolean first_search = true;
+
+
+
+/* This function is called after every search (except the first, since
+   we definitely want to allow enabling the logging in texmf.cnf) to
+   record the filename(s) found in $TEXMFLOG.  */
+
+static void
+log_search P1C(str_list_type, filenames)
+{
+  static FILE *log_file = NULL;
+  static boolean first_time = true; /* Need to open the log file?  */
+  
+  if (first_time) {
+    string log_name = kpse_var_value ("TEXMFLOG");
+    first_time = false;
+    /* Get name from either envvar or config file.  */
+    if (log_name) {
+      log_file = fopen (log_name, FOPEN_A_MODE);
+      if (!log_file)
+        perror (log_name);
+      free (log_name);
+    }
+  }
+
+  if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH) || log_file) {
+    unsigned e;
+
+    /* FILENAMES should never be null, but safety doesn't hurt.  */
+    for (e = 0; e < STR_LIST_LENGTH (filenames) && STR_LIST_ELT (filenames, e);
+         e++) {
+      string filename = STR_LIST_ELT (filenames, e);
+
+      /* Only record absolute filenames, for privacy.  */
+      if (log_file && kpse_absolute_p (filename, false))
+        fprintf (log_file, "%lu %s\n", (long unsigned) time (NULL),
+                 filename);
+
+      /* And show them online, if debugging.  We've already started
+         the debugging line in `search', where this is called, so
+         just print the filename here, don't use DEBUGF.  */
+      if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
+        fputs (filename, stderr);
+    }
+  }
+}
+
+/* Concatenate each element in DIRS with NAME (assume each ends with a
+   /, to save time).  If SEARCH_ALL is false, return the first readable
+   regular file.  Else continue to search for more.  In any case, if
+   none, return a list containing just NULL.
+
+   We keep a single buffer for the potential filenames and reallocate
+   only when necessary.  I'm not sure it's noticeably faster, but it
+   does seem cleaner.  (We do waste a bit of space in the return
+   value, though, since we don't shrink it to the final size returned.)  */
+
+#define INIT_ALLOC 75  /* Doesn't much matter what this number is.  */
+
+static str_list_type
+dir_list_search P3C(str_llist_type *, dirs,  const_string, name,
+                    boolean, search_all)
+{
+  str_llist_elt_type *elt;
+  str_list_type ret;
+  unsigned name_len = strlen (name);
+  unsigned allocated = INIT_ALLOC;
+  string potential = xmalloc (allocated);
+
+  ret = str_list_init ();
+  
+  for (elt = *dirs; elt; elt = STR_LLIST_NEXT (*elt))
+    {
+      const_string dir = STR_LLIST (*elt);
+      unsigned dir_len = strlen (dir);
+      
+      while (dir_len + name_len + 1 > allocated)
+        {
+          allocated += allocated;
+          XRETALLOC (potential, allocated, char);
+        }
+      
+      strcpy (potential, dir);
+      strcat (potential, name);
+      
+      if (kpse_readable_file (potential))
+        { 
+          str_list_add (&ret, potential);
+          
+          /* Move this element towards the top of the list.  */
+          str_llist_float (dirs, elt);
+          
+          /* If caller only wanted one file returned, no need to
+             terminate the list with NULL; the caller knows to only look
+             at the first element.  */
+          if (!search_all)
+            return ret;
+
+          /* Start new filename.  */
+          allocated = INIT_ALLOC;
+          potential = xmalloc (allocated);
+        }
+    }
+  
+  /* If we get here, either we didn't find any files, or we were finding
+     all the files.  But we're done with the last filename, anyway.  */
+  free (potential);
+  
+  return ret;
+}
+
+/* This is called when NAME is absolute or explicitly relative; if it's
+   readable, return (a list containing) it; otherwise, return NULL.  */
+
+static str_list_type
+absolute_search P1C(string, name)
+{
+  str_list_type ret_list;
+  string found = kpse_readable_file (name);
+  
+  /* Some old compilers can't initialize structs.  */
+  ret_list = str_list_init ();
+
+  /* If NAME wasn't found, free the expansion.  */
+  if (name != found)
+    free (name);
+
+  /* Add `found' to the return list even if it's null; that tells
+     the caller we didn't find anything.  */
+  str_list_add (&ret_list, found);
+  
+  return ret_list;
+}
+
+/* This is the hard case -- look for NAME in PATH.  If ALL is false,
+   return the first file found.  Otherwise, search all elements of PATH.  */
+
+static str_list_type
+path_search P4C(const_string, path,  string, name,
+                boolean, must_exist,  boolean, all)
+{
+  string elt;
+  str_list_type ret_list;
+  boolean done = false;
+  ret_list = str_list_init (); /* some compilers lack struct initialization */
+
+  for (elt = kpse_path_element (path); !done && elt;
+       elt = kpse_path_element (NULL)) {
+    str_list_type *found;
+    boolean allow_disk_search = true;
+
+    if (*elt == '!' && *(elt + 1) == '!') {
+      /* Those magic leading chars in a path element means don't search the
+         disk for this elt.  And move past the magic to get to the name.  */
+      allow_disk_search = false;
+      elt += 2;
+    }
+
+    /* Do not touch the device if present */
+    if (NAME_BEGINS_WITH_DEVICE (elt)) {
+      while (IS_DIR_SEP (*(elt + 2)) && IS_DIR_SEP (*(elt + 3))) {
+	*(elt + 2) = *(elt + 1);
+	*(elt + 1) = *elt;
+	elt++;
+      }
+    } else {
+      /* We never want to search the whole disk.  */
+      while (IS_DIR_SEP (*elt) && IS_DIR_SEP (*(elt + 1)))
+        elt++;
+    }
+    
+    /* Try ls-R, unless we're searching for texmf.cnf.  Our caller
+       (search), also tests first_search, and does the resetting.  */
+    found = first_search ? NULL : kpse_db_search (name, elt, all);
+
+    /* Search the filesystem if (1) the path spec allows it, and either
+         (2a) we are searching for texmf.cnf ; or
+         (2b) no db exists; or 
+         (2c) no db's are relevant to this elt; or
+         (3) MUST_EXIST && NAME was not in the db.
+       In (2*), `found' will be NULL.
+       In (3),  `found' will be an empty list. */
+    if (allow_disk_search && (!found || (must_exist && !STR_LIST (*found)))) {
+      str_llist_type *dirs = kpse_element_dirs (elt);
+      if (dirs && *dirs) {
+        if (!found)
+          found = XTALLOC1 (str_list_type);
+        *found = dir_list_search (dirs, name, all);
+      }
+    }
+
+    /* Did we find anything anywhere?  */
+    if (found && STR_LIST (*found))
+      if (all)
+        str_list_concat (&ret_list, *found);
+      else {
+        str_list_add (&ret_list, STR_LIST_ELT (*found, 0));
+        done = true;
+      }
+
+    /* Free the list space, if any (but not the elements).  */
+    if (found) {
+      str_list_free (found);
+      free (found);
+    }
+  }
+
+  /* Free the expanded name we were passed.  It can't be in the return
+     list, since the path directories got unconditionally prepended.  */
+  free (name);
+  
+  return ret_list;
+}      
+
+/* Search PATH for ORIGINAL_NAME.  If ALL is false, or ORIGINAL_NAME is
+   absolute_p, check ORIGINAL_NAME itself.  Otherwise, look at each
+   element of PATH for the first readable ORIGINAL_NAME.
+   
+   Always return a list; if no files are found, the list will
+   contain just NULL.  If ALL is true, the list will be
+   terminated with NULL.  */
+
+static string *
+search P4C(const_string, path,  const_string, original_name,
+           boolean, must_exist,  boolean, all)
+{
+  str_list_type ret_list;
+
+  /* Make a leading ~ count as an absolute filename, and expand $FOO's.  */
+  string name = kpse_expand (original_name);
+  
+  /* If the first name is absolute or explicitly relative, no need to
+     consider PATH at all.  */
+  boolean absolute_p = kpse_absolute_p (name, true);
+  
+  if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
+    DEBUGF4 ("start search(file=%s, must_exist=%d, find_all=%d, path=%s).\n",
+             name, must_exist, all, path);
+
+  /* Find the file(s). */
+  ret_list = absolute_p ? absolute_search (name)
+                        : path_search (path, name, must_exist, all);
+  
+  /* Append NULL terminator if we didn't find anything at all, or we're
+     supposed to find ALL and the list doesn't end in NULL now.  */
+  if (STR_LIST_LENGTH (ret_list) == 0
+      || (all && STR_LIST_LAST_ELT (ret_list) != NULL))
+    str_list_add (&ret_list, NULL);
+
+  /* The very first search is for texmf.cnf.  We can't log that, since
+     we want to allow setting TEXMFLOG in texmf.cnf.  */
+  if (first_search) {
+    first_search = false;
+  } else {
+    /* Record the filenames we found, if desired.  And wrap them in a
+       debugging line if we're doing that.  */
+    if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
+      DEBUGF1 ("search(%s) =>", original_name);
+    log_search (ret_list);
+    if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
+      putc ('\n', stderr);
+  }  
+  
+  return STR_LIST (ret_list);
+}
+
+/* Search PATH for the first NAME.  */
+
+string
+kpse_path_search P3C(const_string, path,  const_string, name,
+                     boolean, must_exist)
+{
+  string *ret_list = search (path, name, must_exist, false);
+  return *ret_list;
+}
+
+
+/* Search all elements of PATH for files named NAME.  Not sure if it's
+   right to assert `must_exist' here, but it suffices now.  */
+
+string *
+kpse_all_path_search P2C(const_string, path,  const_string, name)
+{
+  string *ret = search (path, name, true, true);
+  return ret;
+}
+
+#ifdef TEST
+
+void
+test_path_search (const_string path, const_string file)
+{
+  string answer;
+  string *answer_list;
+  
+  printf ("\nSearch %s for %s:\t", path, file);
+  answer = kpse_path_search (path, file);
+  puts (answer ? answer : "(nil)");
+
+  printf ("Search %s for all %s:\t", path, file);
+  answer_list = kpse_all_path_search (path, file);
+  putchar ('\n');
+  while (*answer_list)
+    {
+      putchar ('\t');
+      puts (*answer_list);
+      answer_list++;
+    }
+}
+
+#define TEXFONTS "/usr/local/lib/tex/fonts"
+
+int
+main ()
+{
+  /* All lists end with NULL.  */
+  test_path_search (".", "nonexistent");
+  test_path_search (".", "/nonexistent");
+  test_path_search ("/k:.", "kpathsea.texi");
+  test_path_search ("/k:.", "/etc/fstab");
+  test_path_search (".:" TEXFONTS "//", "cmr10.tfm");
+  test_path_search (".:" TEXFONTS "//", "logo10.tfm");
+  test_path_search (TEXFONTS "//times:.::", "ptmr.vf");
+  test_path_search (TEXFONTS "/adobe//:"
+                    "/usr/local/src/TeX+MF/typefaces//", "plcr.pfa");
+  
+  test_path_search ("~karl", ".bashrc");
+  test_path_search ("/k", "~karl/.bashrc");
+
+  xputenv ("NONEXIST", "nonexistent");
+  test_path_search (".", "$NONEXISTENT");
+  xputenv ("KPATHSEA", "kpathsea");
+  test_path_search ("/k:.", "$KPATHSEA.texi");  
+  test_path_search ("/k:.", "${KPATHSEA}.texi");  
+  test_path_search ("$KPATHSEA:.", "README");  
+  test_path_search (".:$KPATHSEA", "README");  
+  
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+test-compile-command: "gcc -posix -g -I. -I.. -DTEST pathsearch.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/pathsearch.h
@@ -0,0 +1,76 @@
+/* pathsearch.h: mostly-generic path searching.
+
+Copyright (C) 1993, 94, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_PATHSEARCH_H
+#define KPATHSEA_PATHSEARCH_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/str-llist.h>
+#include <kpathsea/types.h>
+
+/* If PATH is non-null, return its first element (as defined by
+   IS_ENV_SEP).  If it's NULL, return the next element in the previous
+   path, a la strtok.  Leading, trailing, or doubled colons result in
+   the empty string.  When at the end of PATH, return NULL.  In any
+   case, return a pointer to an area that may be overwritten on
+   subsequent calls.  */
+extern string kpse_path_element P1H(const_string path);
+
+/* Like `kpse_path_element', but for filename components (using
+   IS_DIR_SEP).  Uses same area as `kpse_path_element'.  */
+extern string kpse_filename_component P1H(const_string path);
+
+
+/* Given a path element ELT, return a pointer to a NULL-terminated list
+   of the corresponding (existing) directory or directories, with
+   trailing slashes, or NULL.  If ELT is the empty string, check the
+   current working directory.
+   
+   It's up to the caller to expand ELT.  This is because this routine is
+   most likely only useful to be called from `kpse_path_search', which
+   has already assumed expansion has been done.  */
+extern str_llist_type *kpse_element_dirs P1H(const_string elt);
+
+
+/* Call `kpse_expand' on NAME.  If the result is an absolute or
+   explicitly relative filename, check whether it is a readable
+   (regular) file.
+   
+   Otherwise, look in each of the directories specified in PATH (also do
+   tilde and variable expansion on elements in PATH), using a prebuilt
+   db (see db.h) if it's relevant for a given path element.
+   
+   If the prebuilt db doesn't exist, or if MUST_EXIST is true and NAME
+   isn't found in the prebuilt db, look on the filesystem.  (I.e., if
+   MUST_EXIST is false, and NAME isn't found in the db, do *not* look on
+   the filesystem.)
+   
+   The caller must expand PATH. This is because it makes more sense to
+   do this once, in advance, instead of for every search using it.
+   
+   In any case, return the complete filename if found, otherwise NULL.  */
+extern string kpse_path_search P3H(const_string path, const_string name,
+                                   boolean must_exist);
+
+
+/* Like `kpse_path_search' with MUST_EXIST true, but return a list of
+   all the filenames (or NULL if none), instead of taking the first.  */
+extern string *kpse_all_path_search P2H(const_string path, const_string name);
+
+#endif /* not KPATHSEA_PATHSEARCH_H */
+
new file mode 100644
--- /dev/null
+++ b/kpathsea/proginit.c
@@ -0,0 +1,76 @@
+/* proginit.c: useful initializations for DVI drivers.
+
+Copyright (C) 1994, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/proginit.h>
+#include <kpathsea/tex-file.h>
+
+
+/* These initializations were common to all the drivers modified for
+   kpathsea, so a single routine seemed in order.  Kind of a bollixed-up
+   mess, but still better than repeating the code.  */
+
+void
+kpse_init_prog P4C(const_string, prefix,  unsigned, dpi,  const_string, mode,
+                   const_string, fallback)
+{
+  string font_var = concat (prefix, "FONTS");
+  string header_var = concat (prefix, "HEADERS");
+  string makepk_var = concat (prefix, "MAKEPK");
+  string size_var = concat (prefix, "SIZES");
+  
+  /* Do both `pk_format' and `any_glyph_format' for the sake of xdvi; in
+     general, MakeTeXPK might apply to either, and the program will ask
+     for the one it wants.  */
+     
+  /* Might have a program-specific name for MakeTeXPK itself.  */
+  if (getenv (makepk_var)) {
+  /* If we did, we want to enable the program, I think.  */
+    kpse_set_program_enabled (kpse_pk_format, 1, kpse_src_env);
+    kpse_set_program_enabled (kpse_any_glyph_format, 1, kpse_src_env);
+
+    kpse_format_info[kpse_pk_format].program
+      = kpse_format_info[kpse_any_glyph_format].program
+      = getenv (makepk_var);
+  }
+
+  /* A couple font paths have traditionally had application-specific
+     environment variables to override all else; namely, XDVIFONTS and
+     DVIPSHEADERS.  So set those if we have them.  */
+  kpse_format_info[kpse_pk_format].override_path
+    = kpse_format_info[kpse_gf_format].override_path
+    = kpse_format_info[kpse_any_glyph_format].override_path
+    = kpse_format_info[kpse_tfm_format].override_path
+    = getenv (font_var);
+
+  kpse_format_info[kpse_tex_ps_header_format].override_path
+    = getenv (header_var);
+
+  kpse_init_fallback_resolutions (size_var);
+  xputenv_int ("MAKETEX_BASE_DPI", dpi);
+  kpse_fallback_font = fallback;
+  
+  /* Ugliness.  See comments in kpse_make_tex in kpathsea/tex-make.c.  */
+  xputenv ("MAKETEX_MODE", mode ? mode : DIR_SEP_STRING);
+  
+  free (font_var);
+  free (header_var);
+  free (makepk_var);
+  free (size_var);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/proginit.h
@@ -0,0 +1,34 @@
+/* proginit.h: declarations for DVI driver initializations.
+
+Copyright (C) 1994, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_PROGINIT_H
+#define KPATHSEA_PROGINIT_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+
+/* Common initializations for DVI drivers -- check for `PREFIX'SIZES and
+   `PREFIX'FONTS environment variables, setenv MAKETEX_MODE to MODE,
+   etc., etc.  See the source.  */
+
+extern void
+kpse_init_prog P4H(const_string prefix,  unsigned dpi,  const_string mode,
+                   const_string fallback);
+
+#endif /* not KPATHSEA_PROGINIT_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/progname.c
@@ -0,0 +1,507 @@
+/* progname.c: the executable name we were invoked as; general initialization.
+
+Copyright (C) 1994, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+#include <kpathsea/absolute.h>
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/c-stat.h>
+#include <kpathsea/pathsearch.h>
+
+#ifdef WIN32
+#include <kpathsea/c-pathmx.h>
+#endif
+
+/* NeXT does not define the standard macros, but has the equivalent.
+   WIN32 doesn't define them either, and doesn't have them.
+   From: Gregor Hoffleit <flight@mathi.uni-heidelberg.de>.  */
+#ifndef S_IXUSR
+#ifdef WIN32
+#define S_IXUSR 0
+#define S_IXGRP 0
+#define S_IXOTH 0
+#else /* not WIN32 */
+#define S_IXUSR 0100
+#endif /* not WIN32 */
+#endif /* not S_IXUSR */
+#ifndef S_IXGRP
+#define S_IXGRP 0010
+#endif
+#ifndef S_IXOTH
+#define S_IXOTH 0001
+#endif
+
+#ifndef HAVE_PROGRAM_INVOCATION_NAME
+/* Don't redefine the variables if glibc already has.  */
+string program_invocation_name;
+string program_invocation_short_name;
+#endif
+
+/* Return directory for NAME.  This is "." if NAME contains no directory
+   separators (should never happen for selfdir), else whatever precedes
+   the final directory separator, but with multiple separators stripped.
+   For example, `my_dirname ("/foo//bar.baz")' returns "/foo".  Always
+   return a new string.  */
+
+static string
+my_dirname P1C(const_string, name)
+{
+  string ret;
+  unsigned loc = strlen (name);
+  
+  for (loc = strlen (name); loc > 0 && !IS_DIR_SEP (name[loc-1]); loc--)
+    ;
+
+  if (loc) {
+    /* If have ///a, must return /, so don't strip off everything.  */
+    unsigned limit = NAME_BEGINS_WITH_DEVICE (name) ? 3 : 1;
+    while (loc > limit && IS_DIR_SEP (name[loc-1])
+           && !IS_DEVICE_SEP (name[loc-1])) {
+      loc--;
+    } 
+    ret = xmalloc (loc + 1);
+    strncpy (ret, name, loc);
+    ret[loc] = 0;
+  } else {
+    /* No directory separators at all, so return the current directory.
+       The way this is used in kpathsea, this should never happen.  */
+    ret = xstrdup (".");
+  }
+  
+  return ret;
+}
+
+#ifndef WIN32
+/* From a standalone program `ll' to expand symlinks written by Kimbo Mundy.
+   Don't bother to compile if we don't have symlinks; thus we can assume
+   / as the separator.  Also don't try to use basename, etc., or
+   handle arbitrary filename length.  Mixed case function names because
+   that's what kimbo liked.  */
+
+#ifdef S_ISLNK
+static int ll_verbose = 0;
+static int ll_loop = 0;
+
+#undef BSIZE
+#define BSIZE 2048 /* sorry */
+
+
+/* Read link FN into SYM.  */
+
+static void
+ReadSymLink (fn, sym)
+     char *fn, *sym;
+{
+  register int n = readlink (fn, sym, BSIZE);
+  if (n < 0) {
+    perror (fn);
+    exit (1);
+  }
+  sym[n] = 0;
+}
+
+
+/* Strip first component from S, and also return it in a static buffer.  */
+
+static char *
+StripFirst (s)
+     register char *s;
+{
+  static char buf[BSIZE];
+  register char *s1;
+
+  /* Find the end of the first path element */
+  for (s1 = s; *s1 && (*s1 != '/' || s1 == s); s1++)
+    ;
+
+  /* Copy it into buf and null-terminate it. */
+  strncpy (buf, s, s1 - s);
+  buf[s1 - s] = 0;
+
+  /* Skip over the leading / (if any) */
+  if (*s1 == '/')
+    ++s1;
+
+  /* Squeeze out the element */
+  while ((*s++ = *s1++) != 0)
+    ;
+
+  return buf;
+}
+
+
+/* Strip last component from S, and also return it in a static buffer.  */
+
+static char *
+StripLast (s)
+     register char *s;
+{
+  static char buf[BSIZE];
+  register char *s1;
+
+  for (s1 = s + strlen (s); s1 > s && *s1 != '/'; s1--)
+    ;
+  strcpy (buf, s1 + (*s1 == '/'));
+  *s1 = 0;
+
+  return buf;
+}
+
+
+/* Copy first path element from B to A, removing it from B.  */
+
+static void 
+CopyFirst (a, b)
+     register char *a;
+     char *b;
+{
+  register int length = strlen (a);
+
+   if (length > 0 && a[length - 1] != '/') {
+   a[length] = '/';
+    a[length + 1] = 0;
+  }
+  strcat (a, StripFirst (b));
+}
+
+/* Returns NULL on error.  Prints intermediate results if global
+   `ll_verbose' is nonzero.  */
+
+#define EX(s)		(strlen (s) && strcmp (s, "/") ? "/" : "")
+#define EXPOS		EX(post)
+#define EXPRE		EX(pre)
+
+static char *
+expand_symlinks (s)
+     char *s;
+{
+  static char pre[BSIZE];	/* return value */
+  char post[BSIZE], sym[BSIZE], tmp[BSIZE], before[BSIZE];
+  char *cp;
+  char a;
+  struct stat st;
+  int done;
+
+  /* Check for symlink loops.  It's difficult to check for all the
+     possibilities ourselves, so let the kernel do it.  And make it
+     conditional so that people can see where the infinite loop is
+     being caused (see engtools#1536).  */
+  if (!ll_loop) {
+    FILE *f = fopen (s, "r");
+    if (!f && errno == ELOOP) {
+      /* Not worried about other errors, we'll get to them in due course.  */
+      perror (s);
+      return NULL;
+    }
+    fclose (f);
+  }
+
+  strcpy (post, s);
+  strcpy (pre, "");
+
+  while (strlen (post) != 0) {
+    CopyFirst (pre, post);
+
+    if (lstat (pre, &st) != 0) {
+      fprintf (stderr, "lstat(%s) failed ...\n", pre);
+      perror (pre);
+      return NULL;
+    }
+
+    if (S_ISLNK (st.st_mode)) {
+      ReadSymLink (pre, sym);
+
+      if (!strncmp (sym, "/", 1)) {
+        if (ll_verbose)
+          printf ("[%s]%s%s -> [%s]%s%s\n", pre, EXPOS, post, sym, EXPOS,post);
+        strcpy (pre, "");
+
+      } else {
+        a = pre[0];	/* handle links through the root */
+        strcpy (tmp, StripLast (pre));
+        if (!strlen (pre) && a == '/')
+          strcpy (pre, "/");
+
+        if (ll_verbose) {
+          sprintf (before, "%s%s[%s]%s%s", pre, EXPRE, tmp, EXPOS, post);
+          printf ("%s -> %s%s[%s]%s%s\n", before, pre, EXPRE, sym, EXPOS,post);
+        }
+
+        /* Strip "../" path elements from the front of sym; print
+           new result if there were any such elements.  */
+        done = 0;
+        a = pre[0];	/* handle links through the root */
+        while (!strncmp (sym, "..", 2)
+               && (sym[2] == 0 || sym[2] == '/')
+               && strlen (pre) != 0
+               && strcmp (pre, ".")
+               && strcmp (pre, "..")
+               && (strlen (pre) < 3
+                   || strcmp (pre + strlen (pre) - 3, "/.."))) {
+          done = 1;
+          StripFirst (sym);
+          StripLast (pre);
+        }
+
+        if (done && ll_verbose) {
+          for (cp = before; *cp;)
+            *cp++ = ' ';
+          if (strlen (sym))
+            printf ("%s == %s%s%s%s%s\n", before, pre, EXPRE, sym, EXPOS,post);
+          else
+            printf ("%s == %s%s%s\n", before, pre, EXPOS, post);
+        }
+        if (!strlen (pre) && a == '/')
+          strcpy (pre, "/");
+      }
+
+      if (strlen (post) != 0 && strlen (sym) != 0)
+        strcat (sym, "/");
+
+      strcat (sym, post);
+      strcpy (post, sym);
+    }
+  }
+
+  return pre;
+}
+#else /* not S_ISLNK */
+#define expand_symlinks(s) (s)
+#endif /* not S_ISLNK */
+
+/* Remove .'s and ..'s in DIR, to avoid problems with relative symlinks
+   as the program name, etc.  This does not canonicalize symlinks.  */
+
+static string
+remove_dots P1C(string, dir)
+{
+#ifdef AMIGA
+  return dir;
+#else
+  string c;
+  unsigned len;
+  string ret = (string) ""; /* We always reassign.  */
+  
+  for (c = kpse_filename_component (dir); c;
+       c = kpse_filename_component (NULL)) {
+    if (STREQ (c, ".")) {
+      /* If leading ., replace with cwd.  Else ignore.  */
+      if (*ret == 0) {
+        ret = xgetcwd ();
+      }
+
+    } else if (STREQ (c, "..")) {
+      /* If leading .., start with my_dirname (cwd).  Else remove last
+         component from ret, if any.  */
+      if (*ret == 0) {
+        string dot = xgetcwd ();
+        ret = my_dirname (dot);
+        free (dot);
+      } else {
+        unsigned last;
+        for (last = strlen (ret);
+             last > (NAME_BEGINS_WITH_DEVICE (ret) ? 2 : 0);
+             last--) {
+          if (IS_DIR_SEP (ret[last - 1])) {
+            /* If we have `/../', that's the same as `/'.  */
+            if (last > 1) {
+              ret[last] = 0;
+            }
+            break;
+          }
+        }
+      }
+
+    } else {
+      /* Not . or ..; just append.  Include a directory separator unless
+         our string already ends with one.  This also changes all directory
+         separators into the canonical DIR_SEP_STRING.  */
+      string temp;
+      len = strlen (ret);
+      temp = concat3 (ret, ((len > 0 && ret[len - 1] == DIR_SEP)
+                            || (NAME_BEGINS_WITH_DEVICE (c) && *ret == 0))
+                           ? "" : DIR_SEP_STRING,
+                      c);
+      if (*ret)
+        free (ret);
+      ret = temp;
+    }
+  }
+  
+  /* Remove a trailing /, just in case it snuck in.  */
+  len = strlen (ret);
+  if (len > 0 && ret[len - 1] == DIR_SEP) {
+    ret[len - 1] = 0;
+  }
+
+  return ret;
+#endif /* not AMIGA */
+}
+
+/* Return directory ARGV0 comes from.  Check PATH if ARGV0 is not
+   absolute.  */
+
+static string
+selfdir P1C(const_string, argv0)
+{
+  string ret = NULL;
+  string self = NULL;
+  
+  if (kpse_absolute_p (argv0, true)) {
+    self = xstrdup (argv0);
+  } else {
+#ifdef AMIGA
+#include <dos.h>
+#include <proto/dos.h>
+#include <proto/exec.h>
+    BPTR lock;
+    struct DosLibrary *DOSBase
+      = (struct DosLibrary *) OpenLibrary ("dos.library", 0L);
+    assert (DOSBase);
+
+    self = xmalloc (BUFSIZ);
+    lock = findpath (argv0);
+    if (lock != ((BPTR) -1)) {
+      if (getpath (lock, self) == -1)
+        *self = '\0';
+      UnLock (lock);
+    }
+    CloseLibrary((struct Library *) DOSBase);
+#else /* not AMIGA */
+    string elt;
+    struct stat s;
+
+    /* Have to check PATH.  But don't call kpse_path_search since we don't
+       want to search any ls-R's or do anything special with //'s.  */
+    for (elt = kpse_path_element (getenv ("PATH")); !self && elt;
+         elt = kpse_path_element (NULL)) {
+      string name = concat3 (elt, DIR_SEP_STRING, argv0);
+
+      /* In order to do this perfectly, we'd have to check the owner bits only
+         if we are the file owner, and the group bits only if we belong
+         to the file group.  That's a lot of work, though, and it's not
+         likely that kpathsea will ever be used with a program that's
+         only executable by some classes and not others.  See the
+         `file_status' function in execute_cmd.c in bash for what's
+         necessary if we were to do it right.  */
+      if (stat (name, &s) == 0 && s.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) {
+        self = name;
+      }
+    }
+#endif /* not AMIGA */
+  }
+  ret = my_dirname (remove_dots (expand_symlinks (self)));
+
+  free (self);
+  
+  return ret;
+}
+#endif /* not WIN32 */
+
+void
+kpse_set_progname P1C(const_string, progname)
+{
+  string ext, sdir, sdir_parent, sdir_grandparent;
+  string s = getenv ("KPATHSEA_DEBUG");
+  
+  /* Set debugging stuff first, in case we end up doing debuggable stuff
+     during this initialization.  */
+  if (s) {
+    kpathsea_debug |= atoi (s);
+  }
+
+#ifdef WIN32
+  /* Win95 always gives the short filename for argv0, not the long one.
+     There is only this way to catch it. It makes all the selfdir stuff
+     useless for win32. */
+  char path[PATH_MAX], *fp;
+  HANDLE hnd;
+  WIN32_FIND_DATA ffd;
+
+  /* SearchPath() always give back an absolute directory */
+  if (SearchPath(NULL, progname, ".exe", PATH_MAX, path, 
+		 &fp) == 0)
+    FATAL1("Can't determine where is the executable %s.\n", progname);
+  if ((hnd = FindFirstFile(path, &ffd)) == NULL)
+    FATAL1("The following path points to an invalid file : %s\n", path);
+  progname = ffd.cFileName;
+  /* slashify the dirname */
+  assert(fp != NULL);
+  *fp = '\0';
+  for (fp = path; fp && *fp; fp++)
+    if (IS_DIR_SEP(*fp)) *fp = DIR_SEP;
+  /* sdir will be the directory where the executable resides, ie: c:/TeX/bin */
+  sdir = my_dirname(path);
+#endif /* WIN32 */
+
+#ifndef HAVE_PROGRAM_INVOCATION_NAME
+  program_invocation_name = xstrdup (progname);
+#endif
+
+  /* If configured --enable-shared and running from the build directory
+     with the wrapper scripts (e.g., for make check), the binaries will
+     be named foo.exe instead of foo.  Or possibly if we're running on a
+     DOSISH system.  Although it's theoretically wrong to make
+     `program_invocation_name' be anything but the real name, as a
+     practical matter it seems simpler to strip off the .exe here.  Both
+     cnf.c and texmfmp.c (and who knows what else in the future) would
+     have to check for it otherwise.  */
+  ext = find_suffix (program_invocation_name);
+  if (ext && FILESTRCASEEQ (ext, "exe")) {
+    program_invocation_name = remove_suffix (program_invocation_name);
+  }
+
+#ifndef HAVE_PROGRAM_INVOCATION_NAME
+  program_invocation_short_name = (string) basename (program_invocation_name);
+#endif
+
+  /* SELFAUTODIR is actually the parent of the invocation directory,
+     and SELFAUTOPARENT the grandparent.  This is how teTeX did it.  */
+#ifndef WIN32
+  sdir = selfdir (program_invocation_name);
+#endif
+  xputenv ("SELFAUTOLOC", sdir);
+  sdir_parent = my_dirname (sdir);
+  xputenv ("SELFAUTODIR", sdir_parent);
+  sdir_grandparent = my_dirname (sdir_parent);
+  xputenv ("SELFAUTOPARENT", sdir_grandparent);
+
+  free (sdir);
+  free (sdir_parent);
+  free (sdir_grandparent);
+}
+
+#ifdef TEST
+void
+main (int argc, char **argv)
+{
+  puts (remove_dots ("/w/kpathsea"));
+  puts (remove_dots ("/w//kpathsea"));
+  puts (remove_dots ("/w/./kpathsea"));
+  puts (remove_dots ("."));
+  puts (remove_dots ("./"));
+  puts (remove_dots ("./."));
+  puts (remove_dots ("../kpathsea"));
+  puts (remove_dots ("/../w/kpathsea"));
+  puts (remove_dots ("/../w/kpathsea/."));
+}
+/*
+Local variables:
+standalone-compile-command: "gcc -g -I. -I.. -DTEST progname.c STATIC/libkpathsea.a"
+End:
+*/
+#endif /* TEST */
new file mode 100644
--- /dev/null
+++ b/kpathsea/progname.h
@@ -0,0 +1,35 @@
+/* progname.h: Declarations for argv[0] equivalents.
+
+Copyright (C) 1994, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_PROGNAME_H
+#define KPATHSEA_PROGNAME_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+extern DllImport string program_invocation_name;
+extern DllImport string program_invocation_short_name;
+
+
+/* Set the two variables above (if they're not predefined) to a copy of
+   ARGV0 and everything in ARGV0 after the last directory separator,
+   respectively.  */
+
+extern void kpse_set_progname P1H(const_string argv0);
+
+#endif /* not KPATHSEA_PROGNAME_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/putenv.c
@@ -0,0 +1,110 @@
+/****************************************************************/
+/*								*/
+/*	putenv(3)						*/
+/*								*/
+/*		Change or add an environment entry		*/
+/*								*/
+/****************************************************************/
+/*   origination        1987-Oct-7               T. Holm	*/
+/****************************************************************/
+
+/*
+Path: hoptoad!pacbell!ames!ll-xn!mit-eddie!uw-beaver!ssc-vax!uvicctr!tholm
+From: tholm@uvicctr.UUCP (Terrence W. Holm)
+Newsgroups: comp.os.minix
+Subject: putenv(3)
+Message-ID: <395@uvicctr.UUCP>
+Date: 5 May 88 06:40:52 GMT
+Organization: University of Victoria, Victoria B.C. Canada
+
+EFTH Minix report #2  - May 1988 -  putenv(3)
+
+This is an implementation of putenv(3) that we
+wrote for Minix. Please consider this a public
+domain program.
+*/
+
+#define NULL 0
+#define  PSIZE  sizeof(char *)
+
+extern  char  **environ;
+
+char  *strchr();
+char  *malloc();
+
+/****************************************************************/
+/*								*/
+/*      int							*/
+/*	putenv( entry )						*/
+/*								*/
+/*		The "entry" should follow the form 		*/
+/*		"NAME=VALUE". This routine will search the 	*/
+/*		user environment for "NAME" and replace its 	*/
+/*		value with "VALUE".				*/
+/*								*/
+/*		Note that "entry" is not copied, it is used 	*/
+/*		as the environment entry. This means that it 	*/
+/*		must not be unallocated or otherwise modifed 	*/
+/*		by the caller, unless it is replaced by a 	*/
+/*		subsequent putenv().				*/
+/*								*/
+/*		If the name is not found in the environment, 	*/
+/*		then a new vector of pointers is allocated, 	*/
+/*		"entry" is put at the end and the global 	*/
+/*		variable "environ" is updated.			*/
+/*								*/
+/*		This function normally returns 0, but -1	*/
+/*		is returned if it can not allocate enough 	*/
+/*		space using malloc(3), or "entry" does not	*/
+/*		contain a '='.					*/
+/*								*/
+/****************************************************************/
+
+
+int
+putenv( entry )
+  char *entry;
+{
+  unsigned length;
+  unsigned size;
+  char     *temp;
+  char     **p;
+  char     **new_environ;
+
+  /*  Find the length of the "NAME="  */
+
+  temp = strchr(entry,'=');
+  if ( temp == 0 )
+    return( -1 );
+
+  length = (unsigned) (temp - entry + 1);
+
+
+  /*  Scan through the environment looking for "NAME="  */
+
+  for ( p=environ; *p != 0 ; p++ )
+    if ( strncmp( entry, *p, length ) == 0 )
+      {
+      *p = entry;
+      return( 0 );
+      }
+
+
+  /*  The name was not found, build a bigger environment  */
+
+  size = p - environ;
+
+  new_environ = (char **) malloc( (size+2)*PSIZE );
+
+  if ( new_environ == (char **) NULL )
+    return( -1 );
+
+  memcpy ((char *) new_environ, (char *) environ, size*PSIZE );
+
+  new_environ[size]   = entry;
+  new_environ[size+1] = NULL;
+
+  environ = new_environ;
+
+  return(0);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/readable.c
@@ -0,0 +1,73 @@
+/* readable.c: check if a filename is a readable non-directory file.
+
+Copyright (C) 1993, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+#include <kpathsea/c-stat.h>
+#include <kpathsea/readable.h>
+#include <kpathsea/tex-hush.h>
+#include <kpathsea/truncate.h>
+
+
+/* If access can read FN, run stat (assigning to stat buffer ST) and
+   check that fn is not a directory.  Don't check for just being a
+   regular file, as it is potentially useful to read fifo's or some
+   kinds of devices.  */
+
+#define READABLE(fn, st) \
+  (access (fn, R_OK) == 0 && stat (fn, &(st)) == 0 && !S_ISDIR (st.st_mode))
+
+
+/* POSIX invented the brain-damage of not necessarily truncating
+   filename components; the system's behavior is defined by the value of
+   the symbol _POSIX_NO_TRUNC, but you can't change it dynamically!
+   
+   Generic const return warning.  See extend-fname.c.  */
+
+string
+kpse_readable_file P1C(const_string, name)
+{
+  struct stat st;
+  string ret;
+  
+  if (READABLE (name, st)) {
+    ret = (string) name;
+
+#ifdef ENAMETOOLONG
+  } else if (errno == ENAMETOOLONG) {
+    ret = kpse_truncate_filename (name);
+
+    /* Perhaps some other error will occur with the truncated name, so
+       let's call access again.  */
+    if (!READABLE (ret, st))
+      { /* Failed.  */
+        if (ret != name) free (ret);
+        ret = NULL;
+      }
+#endif /* ENAMETOOLONG */
+
+  } else { /* Some other error.  */
+    if (errno == EACCES) { /* Maybe warn them if permissions are bad.  */
+      if (!kpse_tex_hush ("readable")) {
+        perror (name);
+      }
+    }
+    ret = NULL;
+  }
+  
+  return ret;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/readable.h
@@ -0,0 +1,31 @@
+/* readable.h: Is a file readable?
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_READABLE_H
+#define KPATHSEA_READABLE_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+/* If NAME is readable and is a regular file, return it.  If the error is
+   ENAMETOOLONG, truncate any too-long path components, and if the
+   result is a readable file, return that.  Otherwise return NULL.  */
+   
+extern string kpse_readable_file P1H(const_string name);
+
+#endif /* not KPATHSEA_READABLE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/rm-suffix.c
@@ -0,0 +1,42 @@
+/* rm-suffix.c: remove any suffix.
+
+Copyright (C) 1992, 93, 95 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+/* Generic const warning -- see extend-fname.c.  */
+
+string
+remove_suffix P1C(const_string, s)
+{
+  string ret;
+  const_string suffix = find_suffix (s);
+  
+  if (suffix)
+    {
+      /* Back up to before the dot.  */
+      suffix--;
+      ret = (string) xmalloc (suffix - s + 1);
+      strncpy (ret, s, suffix - s);
+      ret[suffix - s] = 0;
+    }
+  else
+    ret = (string) s;
+    
+  return ret;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/stamp-auto
@@ -0,0 +1,1 @@
+Sun Dec 15 15:40:18 EST 1996
new file mode 100644
--- /dev/null
+++ b/kpathsea/stamp-auto.in
@@ -0,0 +1,1 @@
+Mon Feb  3 14:27:12 EST 1997
new file mode 100644
--- /dev/null
+++ b/kpathsea/str-list.c
@@ -0,0 +1,75 @@
+/* str-list.c: define routines for string lists.
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/str-list.h>
+
+
+/* See the .h file for comments.  */
+
+
+str_list_type
+str_list_init P1H(void)
+{
+  str_list_type ret;
+  
+  STR_LIST_LENGTH (ret) = 0;
+  STR_LIST (ret) = NULL;
+  
+  return ret;
+}
+
+
+void
+str_list_add P2C(str_list_type *, l,  string, s)
+{
+  STR_LIST_LENGTH (*l)++;
+  XRETALLOC (STR_LIST (*l), STR_LIST_LENGTH (*l), string);
+  STR_LIST_LAST_ELT (*l) = s;
+}
+
+
+/* May as well save some reallocations and do everything in a chunk
+   instead of calling str_list_add on each element.  */
+   
+void
+str_list_concat P2C(str_list_type *, target,  str_list_type, more)
+{
+  unsigned e;
+  unsigned prev_len = STR_LIST_LENGTH (*target);
+
+  STR_LIST_LENGTH (*target) += STR_LIST_LENGTH (more);
+  XRETALLOC (STR_LIST (*target), STR_LIST_LENGTH (*target), string);
+  
+  for (e = 0; e < STR_LIST_LENGTH (more); e++)
+    STR_LIST_ELT (*target, prev_len + e) = STR_LIST_ELT (more, e);
+}
+
+
+/* Free the list (but not the elements within it).  */
+
+void
+str_list_free P1C(str_list_type *, l)
+{
+  if (STR_LIST (*l))
+    {
+      free (STR_LIST (*l));
+      STR_LIST (*l) = NULL;
+    }
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/str-list.h
@@ -0,0 +1,54 @@
+/* str-list.h: Declarations for string lists.
+
+Copyright (C) 1993, 94 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_STR_LIST_H
+#define KPATHSEA_STR_LIST_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+
+/* Lists of strings; used for, e.g., directory lists.  */
+
+typedef struct
+{
+  unsigned length;
+  string *list;
+} str_list_type;
+
+#define STR_LIST_LENGTH(l) ((l).length)
+#define STR_LIST(l) ((l).list)
+#define STR_LIST_ELT(l, n) STR_LIST (l)[n]
+#define STR_LIST_LAST_ELT(l) STR_LIST_ELT (l, STR_LIST_LENGTH (l) - 1)
+
+/* Return a new, empty, list.  */
+extern str_list_type str_list_init P1H(void);
+
+/* Append the string S to the list L.  It's up to the caller to not
+   deallocate S; we don't copy it.  Also up to the caller to terminate
+   the list with a null entry.  */
+extern void str_list_add P2H(str_list_type *l, string s);
+
+/* Append all the elements from MORE to TARGET.  */
+extern void str_list_concat P2H(str_list_type * target, str_list_type more);
+
+/* Free the space for the list elements (but not the list elements
+   themselves).  */
+extern void str_list_free P1H(str_list_type *l);
+
+#endif /* not KPATHSEA_STR_LIST_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/str-llist.c
@@ -0,0 +1,94 @@
+/* str-llist.c: Implementation of a linked list of strings.
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/str-llist.h>
+
+
+/* Add the new string STR to the end of the list L.  */
+
+void
+str_llist_add P2C(str_llist_type *, l,  string, str)
+{
+  str_llist_elt_type *e;
+  str_llist_elt_type *new_elt = XTALLOC1 (str_llist_elt_type);
+  
+  /* The new element will be at the end of the list.  */
+  STR_LLIST (*new_elt) = str;
+  STR_LLIST_MOVED (*new_elt) = false;
+  STR_LLIST_NEXT (*new_elt) = NULL;
+  
+  /* Find the current end of the list.  */
+  for (e = *l; e && STR_LLIST_NEXT (*e); e = STR_LLIST_NEXT (*e))
+    ;
+  
+  if (!e)
+    *l = new_elt;
+  else
+    STR_LLIST_NEXT (*e) = new_elt;
+}
+
+/* Move an element towards the top. The idea is that when a file is
+   found in a given directory, later files will likely be in that same
+   directory, and looking for the file in all the directories in between
+   is thus a waste.  */
+
+void
+str_llist_float P2C(str_llist_type *, l,  str_llist_elt_type *, mover)
+{
+  str_llist_elt_type *last_moved, *unmoved;
+  
+  /* If we've already moved this element, never mind.  */
+  if (STR_LLIST_MOVED (*mover))
+    return;
+  
+  /* Find the first unmoved element (to insert before).  We're
+     guaranteed this will terminate, since MOVER itself is currently
+     unmoved, and it must be in L (by hypothesis).  */
+  for (last_moved = NULL, unmoved = *l; STR_LLIST_MOVED (*unmoved);
+       last_moved = unmoved, unmoved = STR_LLIST_NEXT (*unmoved))
+    ;
+
+  /* If we are the first unmoved element, nothing to relink.  */
+  if (unmoved != mover)
+    { /* Remember `mover's current successor, so we can relink `mover's
+         predecessor to it.  */
+      str_llist_elt_type *before_mover;
+      str_llist_elt_type *after_mover = STR_LLIST_NEXT (*mover);
+      
+      /* Find `mover's predecessor.  */
+      for (before_mover = unmoved; STR_LLIST_NEXT (*before_mover) != mover;
+           before_mover = STR_LLIST_NEXT (*before_mover))
+        ;
+      
+      /* `before_mover' now links to `after_mover'.  */
+      STR_LLIST_NEXT (*before_mover) = after_mover;
+
+      /* Insert `mover' before `unmoved' and after `last_moved' (or at
+         the head of the list).  */
+      STR_LLIST_NEXT (*mover) = unmoved;
+      if (!last_moved)
+        *l = mover;
+      else
+        STR_LLIST_NEXT (*last_moved) = mover;
+    }
+
+  /* We've moved it.  */
+  STR_LLIST_MOVED (*mover) = true;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/str-llist.h
@@ -0,0 +1,56 @@
+/* str-llist.h: A linked list of strings,
+
+It's pretty disgusting that both this and str-list exist; the reason is
+that C cannot express iterators very well, and I don't want to change
+all the for loops right now.
+
+Copyright (C) 1993, 94 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef STR_LLIST_H
+#define STR_LLIST_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+
+/* It's a little bizarre to be using the same type for the list and the
+   elements of the list, but no reason not to in this case, I think --
+   we never need a NULL string in the middle of the list, and an extra
+   NULL/NULL element always at the end is inconsequential.  */
+
+struct str_llist_elt
+{
+  string str;
+  boolean moved;
+  struct str_llist_elt *next;
+};
+typedef struct str_llist_elt str_llist_elt_type;
+typedef struct str_llist_elt *str_llist_type;
+
+#define STR_LLIST(sl) ((sl).str)
+#define STR_LLIST_MOVED(sl) ((sl).moved)
+#define STR_LLIST_NEXT(sl) ((sl).next)
+
+
+/* Add the new string E to the end of the list L.  */
+extern void str_llist_add P2H(str_llist_type *l, string e);
+
+/* Reorganize L so that E is below only other elements that have already
+   been moved.  Set `moved' member for E.  */
+extern void str_llist_float P2H(str_llist_type *l, str_llist_elt_type *e);
+
+#endif /* not STR_LLIST_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/strcasecmp.c
@@ -0,0 +1,83 @@
+/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
+This file was part of the GNU C Library. Modified by kb@mail.tug.org to
+avoid glibc-isms.
+
+This file is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file COPYING.LIB.  If not, write
+to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#if !defined (__STDC__) || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <ctype.h>
+
+/* Compare S1 and S2, ignoring case, returning less than, equal to or
+   greater than zero if S1 is lexiographically less than,
+   equal to or greater than S2.  */
+int
+strcasecmp (s1, s2)
+    const char *s1;
+    const char *s2;
+{
+  register const unsigned char *p1 = (const unsigned char *) s1;
+  register const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if (p1 == p2)
+    return 0;
+
+  do
+    {
+      c1 = tolower (*p1++);
+      c2 = tolower (*p2++);
+      if (c1 == '\0')
+	break;
+    }
+  while (c1 == c2);
+
+  return c1 - c2;
+}
+
+int
+strncasecmp (s1, s2, n)
+    const char *s1;
+    const char *s2;
+    unsigned n;
+{
+  register const unsigned char *p1 = (const unsigned char *) s1;
+  register const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if (p1 == p2 || n == 0)
+    return 0;
+
+  do
+    {
+      c1 = tolower (*p1++);
+      c2 = tolower (*p2++);
+      if (c1 == '\0' || c1 != c2)
+	return c1 - c2;
+    } while (--n > 0);
+
+  return c1 - c2;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/strstr.c
@@ -0,0 +1,123 @@
+/* Copyright (C) 1994, 95 Free Software Foundation, Inc.
+This file was part of the GNU C Library. Modified by kb@mail.tug.org.
+
+This file is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file COPYING.LIB.  If not, write
+to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+/*
+ * My personal strstr() implementation that beats most other algorithms.
+ * Until someone tells me otherwise, I assume that this is the
+ * fastest implementation of strstr() in C.
+ * I deliberately chose not to comment it.  You should have at least
+ * as much fun trying to understand it, as I had to write it :-).
+ *
+ * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de	*/
+
+#if !defined (__STDC__) || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+typedef unsigned chartype;
+
+char *
+strstr (phaystack, pneedle)
+     const char *phaystack;
+     const char *pneedle;
+{
+  register const unsigned char *haystack, *needle;
+  register chartype b, c;
+
+  haystack = (const unsigned char *) phaystack;
+  needle = (const unsigned char *) pneedle;
+
+  b = *needle;
+  if (b != '\0')
+    {
+      haystack--;				/* possible ANSI violation */
+      do
+	{
+	  c = *++haystack;
+	  if (c == '\0')
+	    goto ret0;
+	}
+      while (c != b);
+
+      c = *++needle;
+      if (c == '\0')
+	goto foundneedle;
+      ++needle;
+      goto jin;
+
+      for (;;)
+        { 
+          register chartype a;
+	  register const unsigned char *rhaystack, *rneedle;
+
+	  do
+	    {
+	      a = *++haystack;
+	      if (a == '\0')
+		goto ret0;
+	      if (a == b)
+		break;
+	      a = *++haystack;
+	      if (a == '\0')
+		goto ret0;
+shloop:	    }
+          while (a != b);
+
+jin:	  a = *++haystack;
+	  if (a == '\0')
+	    goto ret0;
+
+	  if (a != c)
+	    goto shloop;
+
+	  rhaystack = haystack-- + 1;
+	  rneedle = needle;
+	  a = *rneedle;
+
+	  if (*rhaystack == a)
+	    do
+	      {
+		if (a == '\0')
+		  goto foundneedle;
+		++rhaystack;
+		a = *++needle;
+		if (*rhaystack != a)
+		  break;
+		if (a == '\0')
+		  goto foundneedle;
+		++rhaystack;
+		a = *++needle;
+	      }
+	    while (*rhaystack == a);
+
+	  needle = rneedle;		   /* took the register-poor aproach */
+
+	  if (a == '\0')
+	    break;
+        }
+    }
+foundneedle:
+  return (char*) haystack;
+ret0:
+  return 0;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/strtol.c
@@ -0,0 +1,291 @@
+/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
+
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define USE_NUMBER_GROUPING
+# define STDC_HEADERS
+# define HAVE_LIMITS_H
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#ifdef STDC_HEADERS
+# include <stddef.h>
+# include <stdlib.h>
+#else
+# ifndef NULL
+#  define NULL 0
+# endif
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+# include "../locale/localeinfo.h"
+#endif
+
+/* Nonzero if we are defining `strtoul' or `strtouq', operating on
+   unsigned integers.  */
+#ifndef UNSIGNED
+# define UNSIGNED 0
+# define INT LONG int
+#else
+# define strtol strtoul
+# define INT unsigned LONG int
+#endif
+
+/* If QUAD is defined, we are defining `strtoq' or `strtouq',
+   operating on `long long int's.  */
+#ifdef QUAD
+# if UNSIGNED
+#  define strtoul strtouq
+# else
+#  define strtol strtoq
+# endif
+# define LONG long long
+# undef LONG_MIN
+# define LONG_MIN LONG_LONG_MIN
+# undef LONG_MAX
+# define LONG_MAX LONG_LONG_MAX
+# undef ULONG_MAX
+# define ULONG_MAX ULONG_LONG_MAX
+# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
+   /* Work around gcc bug with using this constant.  */
+   static const unsigned long long int maxquad = ULONG_LONG_MAX;
+#  undef ULONG_MAX
+#  define ULONG_MAX maxquad
+# endif
+#else
+# define LONG long
+#endif
+
+#ifdef __STDC__
+# define INTERNAL(x) INTERNAL1(x)
+# define INTERNAL1(x) __##x##_internal
+#else
+# define INTERNAL(x) __/**/x/**/_internal
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+/* This file defines a function to check for correct grouping.  */
+# include "grouping.h"
+#endif
+
+
+/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
+   If BASE is 0 the base is determined by the presence of a leading
+   zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
+   If BASE is < 2 or > 36, it is reset to 10.
+   If ENDPTR is not NULL, a pointer to the character after the last
+   one converted is stored in *ENDPTR.  */
+
+INT
+INTERNAL (strtol) (nptr, endptr, base, group)
+     const char *nptr;
+     char **endptr;
+     int base;
+     int group;
+{
+  int negative;
+  register unsigned LONG int cutoff;
+  register unsigned int cutlim;
+  register unsigned LONG int i;
+  register const char *s;
+  register unsigned char c;
+  const char *save, *end;
+  int overflow;
+
+#ifdef USE_NUMBER_GROUPING
+  /* The thousands character of the current locale.  */
+  wchar_t thousands;
+  /* The numeric grouping specification of the current locale,
+     in the format described in <locale.h>.  */
+  const char *grouping;
+
+  if (group)
+    {
+      grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
+      if (*grouping <= 0 || *grouping == CHAR_MAX)
+	grouping = NULL;
+      else
+	{
+	  /* Figure out the thousands separator character.  */
+	  if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
+		      strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
+	    thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
+	  if (thousands == L'\0')
+	    grouping = NULL;
+	}
+    }
+  else
+    grouping = NULL;
+#endif
+
+  if (base < 0 || base == 1 || base > 36)
+    base = 10;
+
+  s = nptr;
+
+  /* Skip white space.  */
+  while (isspace (*s))
+    ++s;
+  if (*s == '\0')
+    goto noconv;
+
+  /* Check for a sign.  */
+  if (*s == '-')
+    {
+      negative = 1;
+      ++s;
+    }
+  else if (*s == '+')
+    {
+      negative = 0;
+      ++s;
+    }
+  else
+    negative = 0;
+
+  if (base == 16 && s[0] == '0' && toupper (s[1]) == 'X')
+    s += 2;
+
+  /* If BASE is zero, figure it out ourselves.  */
+  if (base == 0)
+    if (*s == '0')
+      {
+	if (toupper (s[1]) == 'X')
+	  {
+	    s += 2;
+	    base = 16;
+	  }
+	else
+	  base = 8;
+      }
+    else
+      base = 10;
+
+  /* Save the pointer so we can check later if anything happened.  */
+  save = s;
+
+#ifdef USE_NUMBER_GROUPING
+  if (group)
+    {
+      /* Find the end of the digit string and check its grouping.  */
+      end = s;
+      for (c = *end; c != '\0'; c = *++end)
+	if (c != thousands && !isdigit (c) &&
+	    (!isalpha (c) || toupper (c) - 'A' + 10 >= base))
+	  break;
+      if (*s == thousands)
+	end = s;
+      else
+	end = correctly_grouped_prefix (s, end, thousands, grouping);
+    }
+  else
+#endif
+    end = NULL;
+
+  cutoff = ULONG_MAX / (unsigned LONG int) base;
+  cutlim = ULONG_MAX % (unsigned LONG int) base;
+
+  overflow = 0;
+  i = 0;
+  for (c = *s; c != '\0'; c = *++s)
+    {
+      if (s == end)
+	break;
+      if (isdigit (c))
+	c -= '0';
+      else if (isalpha (c))
+	c = toupper (c) - 'A' + 10;
+      else
+	break;
+      if (c >= base)
+	break;
+      /* Check for overflow.  */
+      if (i > cutoff || (i == cutoff && c > cutlim))
+	overflow = 1;
+      else
+	{
+	  i *= (unsigned LONG int) base;
+	  i += c;
+	}
+    }
+
+  /* Check if anything actually happened.  */
+  if (s == save)
+    goto noconv;
+
+  /* Store in ENDPTR the address of one character
+     past the last character we converted.  */
+  if (endptr != NULL)
+    *endptr = (char *) s;
+
+#if !UNSIGNED
+  /* Check for a value that is within the range of
+     `unsigned LONG int', but outside the range of `LONG int'.  */
+  if (i > (negative ?
+	   -(unsigned LONG int) LONG_MIN : (unsigned LONG int) LONG_MAX))
+    overflow = 1;
+#endif
+
+  if (overflow)
+    {
+      errno = ERANGE;
+#if UNSIGNED
+      return ULONG_MAX;
+#else
+      return negative ? LONG_MIN : LONG_MAX;
+#endif
+    }
+
+  /* Return the result of the appropriate sign.  */
+  return (negative ? -i : i);
+
+noconv:
+  /* There was no number to convert.  */
+  if (endptr != NULL)
+    *endptr = (char *) nptr;
+  return 0L;
+}
+
+/* External user entry point.  */
+
+#ifdef weak_symbol
+weak_symbol (strtol)
+#endif
+
+INT
+strtol (nptr, endptr, base)
+     const char *nptr;
+     char **endptr;
+     int base;
+{
+  return INTERNAL (strtol) (nptr, endptr, base, 0);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/systypes.h
@@ -0,0 +1,30 @@
+/* c-systypes.h: include <sys/types.h>.  It's too bad we need this file,
+   but some systems don't protect <sys/types.h> from multiple
+   inclusions, and I'm not willing to put up with that.
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef C_SYSTYPES_H
+#define C_SYSTYPES_H
+
+#include <sys/types.h>
+
+/* This is the symbol that X uses to determine if <sys/types.h> has been
+   read, so we define it.  */
+#define __TYPES__
+
+#endif /* not C_SYSTYPES_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/tex-file.c
@@ -0,0 +1,642 @@
+/* tex-file.c: high-level file searching by format.
+
+Copyright (C) 1993, 94, 95, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/c-vararg.h>
+#include <kpathsea/cnf.h>
+#include <kpathsea/default.h>
+#include <kpathsea/expand.h>
+#include <kpathsea/fontmap.h>
+#include <kpathsea/paths.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/tex-make.h>
+#include <kpathsea/variable.h>
+
+
+/* See tex-file.h.  */
+const_string kpse_fallback_font = NULL;
+const_string kpse_fallback_resolutions_string = NULL;
+unsigned *kpse_fallback_resolutions = NULL;
+kpse_format_info_type kpse_format_info[kpse_last_format];
+
+/* These are not in the structure
+   because it's annoying to initialize lists in C.  */
+#define GF_ENVS "GFFONTS", GLYPH_ENVS
+#define PK_ENVS "PKFONTS", "TEXPKS", GLYPH_ENVS
+#define GLYPH_ENVS "GLYPHFONTS", "TEXFONTS"
+#define AFM_ENVS "AFMFONTS"
+#define BASE_ENVS "MFBASES", "TEXMFINI"
+#define BIB_ENVS "BIBINPUTS", "TEXBIB"
+#define BST_ENVS "BSTINPUTS"
+#define CNF_ENVS "TEXMFCNF"
+#define DB_ENVS "TEXMFDBS"
+#define FMT_ENVS "TEXFORMATS", "TEXMFINI"
+#define FONTMAP_ENVS "TEXFONTMAPS"
+#define MEM_ENVS "MPMEMS", "TEXMFINI"
+#define MF_ENVS "MFINPUTS"
+#define MFPOOL_ENVS "MFPOOL", "TEXMFINI"
+#define MFT_ENVS "MFTINPUTS"
+#define MP_ENVS "MPINPUTS"
+#define MPPOOL_ENVS "MPPOOL", "TEXMFINI" 
+#define MPSUPPORT_ENVS "MPSUPPORT"
+#define OCP_ENVS "OCPINPUTS"
+#define OFM_ENVS "OFMFONTS", "TEXFONTS"
+#define OPL_ENVS "OPLFONTS", "TEXFONTS"
+#define OTP_ENVS "OTPINPUTS"
+#define OVF_ENVS "OVFFONTS", "TEXFONTS"
+#define OVP_ENVS "OVPFONTS", "TEXFONTS"
+#define PICT_ENVS "TEXPICTS", TEX_ENVS
+#define TEX_ENVS "TEXINPUTS"
+#define TEXDOC_ENVS "TEXDOCS"
+#define TEXPOOL_ENVS "TEXPOOL", "TEXMFINI"
+#define TEXSOURCE_ENVS "TEXSOURCES"
+#define TEX_PS_HEADER_ENVS "TEXPSHEADERS", "PSHEADERS"
+#define TFM_ENVS "TFMFONTS", "TEXFONTS"
+#define TROFF_FONT_ENVS "TRFONTS"
+#define TYPE1_ENVS "T1FONTS", "T1INPUTS", TEX_PS_HEADER_ENVS
+#define VF_ENVS "VFFONTS", "TEXFONTS"
+#define DVIPS_CONFIG_ENVS "TEXCONFIG"
+#define IST_ENVS "TEXINDEXSTYLE", "INDEXSTYLE"
+
+/* The compiled-in default list, DEFAULT_FONT_SIZES, is intended to be
+   set from the command line (presumably via the Makefile).  */
+
+#ifndef DEFAULT_FONT_SIZES
+#define DEFAULT_FONT_SIZES ""
+#endif
+
+void
+kpse_init_fallback_resolutions P1C(string, envvar)
+{
+  string size, orig_size_list;
+  const_string size_var = ENVVAR (envvar, "TEXSIZES");
+  string size_str = getenv (size_var);
+  unsigned *last_resort_sizes = NULL;
+  unsigned size_count = 0;
+  const_string default_sizes = kpse_fallback_resolutions_string
+                         ? kpse_fallback_resolutions_string
+                         : DEFAULT_FONT_SIZES; 
+  string size_list = kpse_expand_default (size_str, default_sizes);
+  
+  orig_size_list = size_list; /* For error messages.  */
+
+  /* Initialize the list of last-resort sizes.  */
+  for (size = kpse_path_element (size_list); size != NULL;
+       size = kpse_path_element (NULL))
+    {
+      unsigned s;
+      if (! *size) /* Skip empty elements.  */
+        continue;
+      
+      s = atoi (size);
+      if (size_count && s < last_resort_sizes[size_count - 1]) {
+    WARNING1 ("kpathsea: last resort size %s not in ascending order, ignored",
+          size);
+      } else {
+        size_count++;
+        XRETALLOC (last_resort_sizes, size_count, unsigned);
+        last_resort_sizes[size_count - 1] = atoi (size);
+      }
+    }
+
+  /* Add a zero to mark the end of the list.  */
+  size_count++;
+  XRETALLOC (last_resort_sizes, size_count, unsigned);
+  last_resort_sizes[size_count - 1] = 0;
+
+  /* If we didn't expand anything, we won't have allocated anything.  */
+  if (size_str && size_list != size_str)
+    free (size_list);
+    
+  kpse_fallback_resolutions = last_resort_sizes;
+}
+
+/* We should be able to set the program arguments in the same way.  Not
+   to mention the path values themselves.  */
+
+void
+kpse_set_program_enabled P3C(kpse_file_format_type, fmt,  boolean, value,
+                             kpse_src_type, level)
+{
+  kpse_format_info_type *f = &kpse_format_info[fmt];
+  if (level >= f->program_enable_level) {
+    f->program_enabled_p = value;
+    f->program_enable_level = level;
+  }
+}
+
+
+/* Web2c and kpsewhich have command-line options to set this stuff.  May
+   as well have a common place.  */
+
+void
+kpse_maketex_option P2C(const_string, fmtname,  boolean, value)
+{
+  kpse_file_format_type fmt;
+  
+  /* Trying to match up with the suffix lists unfortunately doesn't work
+     well, since that would require initializing the formats.  */
+  if (FILESTRCASEEQ (fmtname, "pk")) {
+    fmt = kpse_pk_format;
+  } else if (FILESTRCASEEQ (fmtname, "mf")) {
+    fmt = kpse_tex_format;
+  } else if (FILESTRCASEEQ (fmtname, "tex")) {
+    fmt = kpse_tex_format;
+  } else if (FILESTRCASEEQ (fmtname, "tfm")) {
+    fmt = kpse_tex_format;
+  }
+  kpse_set_program_enabled (fmt, value, kpse_src_cmdline);
+}
+
+/* Macro subroutines for `init_path'.  TRY_ENV checks if an envvar ENAME
+   is set and non-null, and sets var to ENAME if so.  */
+#define TRY_ENV(ename) do { \
+  string evar = ename; \
+} while (0)
+
+/* And EXPAND_DEFAULT calls kpse_expand_default on try_path and the
+   present info->path.  */
+#define EXPAND_DEFAULT(try_path, source_string)			\
+  if (try_path) {						\
+      info->raw_path = try_path;				\
+      info->path = kpse_expand_default (try_path, info->path);	\
+      info->path_source = source_string;			\
+  }
+
+/* Find the final search path to use for the format entry INFO, given
+   the compile-time default (DEFAULT_PATH), and the environment
+   variables to check (the remaining arguments, terminated with NULL).
+   We set the `path' and `path_source' members of INFO.  The
+   `client_path' member must already be set upon entry.  */
+
+static void
+init_path PVAR2C(kpse_format_info_type *, info, const_string, default_path, ap)
+{
+  string env_name;
+  string var = NULL;
+  
+  info->default_path = default_path;
+
+  /* First envvar that's set to a nonempty value will exit the loop.  If
+     none are set, we want the first cnf entry that matches.  Find the
+     cnf entries simultaneously, to avoid having to go through envvar
+     list twice -- because of the PVAR?C macro, that would mean having
+     to create a str_list and then use it twice.  Yuck.  */
+  while ((env_name = va_arg (ap, string)) != NULL) {
+    /* Since sh doesn't like envvar names with `.', check PATH_prog
+       rather than PATH.prog.  */
+    if (!var) {
+      string evar = concat3 (env_name, "_", program_invocation_short_name);
+      string env_value = getenv (evar);
+      if (env_value && *env_value) {
+        var = evar;
+      } else {
+        free (evar);
+
+        /* Try simply PATH.  */
+        env_value = getenv (env_name);
+        if (env_value && *env_value) {
+          var = env_name;        
+        }
+      }
+    }
+    
+    /* If we are initializing the cnf path, don't try to get any
+       values from the cnf files; that's infinite loop time.  */
+    if (!info->cnf_path
+        && (!info->suffix || !FILESTRCASEEQ (info->suffix, ".cnf")))
+      info->cnf_path = kpse_cnf_get (env_name);
+      
+    if (var && info->cnf_path)
+      break;
+  }
+  va_end (ap);
+  
+  /* Expand any extra :'s.  For each level, we replace an extra : with
+     the path at the next lower level.  For example, an extra : in a
+     user-set envvar should be replaced with the path from the cnf file.
+     things are complicated because none of the levels above the very
+     bottom are guaranteed to exist.  */
+
+  /* Assume we can reliably start with the compile-time default.  */
+  info->path = info->raw_path = info->default_path;
+  info->path_source = "compile-time paths.h";
+
+  EXPAND_DEFAULT (info->cnf_path, "texmf.cnf");
+  EXPAND_DEFAULT (info->client_path, "program config file");
+  if (var)
+    EXPAND_DEFAULT (getenv (var), concat (var, " environment variable"));
+  EXPAND_DEFAULT (info->override_path, "application override variable");
+  info->path = kpse_path_expand (info->path);
+}}
+
+
+/* Some file types have more than one suffix.  (We don't actually need
+   the constant argument here, but ANSI requires it.)  */
+
+static void
+add_alt_suffixes PVAR1C(kpse_format_info_type *, info,  ap)
+{
+  const_string s;
+  unsigned count = 0;
+  
+  while ((s = va_arg (ap, string)) != NULL) {
+    count++;
+    XRETALLOC (info->alt_suffix, count + 1, const_string);
+    info->alt_suffix[count - 1] = s;
+  }
+  va_end (ap);
+  info->alt_suffix[count] = NULL;
+}}
+
+
+/* The path spec we are defining, one element of the global array.  */
+#define FMT_INFO kpse_format_info[format]
+
+
+/* Call add_alt_suffixes.  */
+#define ALT_SUFFIXES(args) add_alt_suffixes (&FMT_INFO, args, NULL)
+
+/* Call `init_path', including appending the trailing NULL to the envvar
+   list. Also initialize the fields not needed in setting the path.  */
+#define INIT_FORMAT(ext, default_path, envs) \
+  FMT_INFO.suffix = FMT_INFO.type = ext; \
+  init_path (&FMT_INFO, default_path, envs, NULL)
+
+
+/* A few file types allow for runtime generation by an external program.
+   kpse_init_prog may have already initialized it (the `program'
+   member).  Here we allow people to turn it off or on in the config
+   file, by setting the variable whose name is the uppercasified program
+   name to 0 or 1.  */
+
+static void
+init_maketex P3C(kpse_file_format_type, fmt,  const_string, dflt_prog,
+                 const_string, args)
+{
+  kpse_format_info_type *f = &kpse_format_info[fmt];
+  const_string prog = f->program ? f->program : dflt_prog; /* MakeTeXPK */
+  string PROG = uppercasify (prog);             /* MAKETEXPK */
+  string progval = kpse_var_value (PROG);       /* ENV/cnf{"MAKETEXPK"} */
+
+  /* Doesn't hurt to always set this info.  */
+  f->program = prog;
+  f->program_args = args;
+
+  if (progval && *progval) {
+    /* This might actually be from an environment variable value, but in
+       that case, we'll have previously set it from kpse_init_prog.  */
+    kpse_set_program_enabled (fmt, *progval == '1', kpse_src_client_cnf);
+  }
+  
+  free (PROG);
+}
+
+/* We need this twice, so ... */
+#define MAKETEXPK_ARGS \
+  "$KPATHSEA_DPI $MAKETEX_BASE_DPI $MAKETEX_MAG $MAKETEX_MODE"
+
+/* Initialize everything for FORMAT.  */
+
+const_string
+kpse_init_format P1C(kpse_file_format_type, format)
+{
+  /* If we get called twice, don't redo all the work.  */
+  if (FMT_INFO.path)
+    return FMT_INFO.path;
+    
+  switch (format)
+    { /* We might be able to avoid repeating `gf' or whatever so many
+         times with token pasting, but it doesn't seem worth it.  */
+    case kpse_gf_format:
+      INIT_FORMAT ("gf", DEFAULT_GFFONTS, GF_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_pk_format:
+      init_maketex (format, "MakeTeXPK", MAKETEXPK_ARGS);
+      INIT_FORMAT ("pk", DEFAULT_PKFONTS, PK_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_any_glyph_format:
+      init_maketex (format, "MakeTeXPK", MAKETEXPK_ARGS);
+      INIT_FORMAT (NULL, DEFAULT_GLYPHFONTS, GLYPH_ENVS);
+      FMT_INFO.type = "bitmap font";
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_afm_format:
+      INIT_FORMAT (".afm", DEFAULT_AFMFONTS, AFM_ENVS);
+      break;
+    case kpse_base_format:
+      INIT_FORMAT (".base", DEFAULT_MFBASES, BASE_ENVS);
+      break;
+    case kpse_bib_format:
+      INIT_FORMAT (".bib", DEFAULT_BIBINPUTS, BIB_ENVS);
+      break;
+    case kpse_bst_format:
+      INIT_FORMAT (".bst", DEFAULT_BSTINPUTS, BST_ENVS);
+      break;
+    case kpse_cnf_format:
+      INIT_FORMAT (".cnf", DEFAULT_TEXMFCNF, CNF_ENVS);
+      break;
+    case kpse_db_format:
+      INIT_FORMAT ("ls-R", DEFAULT_TEXMFDBS, DB_ENVS);
+      break;
+    case kpse_fmt_format:
+      INIT_FORMAT (".fmt", DEFAULT_TEXFORMATS, FMT_ENVS);
+      break;
+    case kpse_fontmap_format:
+      INIT_FORMAT (".map", DEFAULT_TEXFONTMAPS, FONTMAP_ENVS);
+      break;
+    case kpse_mem_format:
+      INIT_FORMAT (".mem", DEFAULT_MPMEMS, MEM_ENVS);
+      break;
+    case kpse_mf_format:
+      init_maketex (format, "MakeTeXMF", NULL);
+      INIT_FORMAT (".mf", DEFAULT_MFINPUTS, MF_ENVS);
+      break;
+    case kpse_mft_format:
+      INIT_FORMAT (".mft", DEFAULT_MFTINPUTS, MFT_ENVS);
+      break;
+    case kpse_mfpool_format:
+      INIT_FORMAT (".pool", DEFAULT_MFPOOL, MFPOOL_ENVS);
+      break;
+    case kpse_mp_format:
+      INIT_FORMAT (".mp", DEFAULT_MPINPUTS, MP_ENVS);
+      break;
+    case kpse_mppool_format:
+      INIT_FORMAT (".pool", DEFAULT_MPPOOL, MPPOOL_ENVS);
+      break;
+    case kpse_mpsupport_format:
+      INIT_FORMAT (NULL, DEFAULT_MPSUPPORT, MPSUPPORT_ENVS);
+      FMT_INFO.type = "MetaPost support";
+      break;
+    case kpse_ocp_format:
+      init_maketex (format, "MakeOmegaOCP", NULL);
+      INIT_FORMAT (".ocp", DEFAULT_OCPINPUTS, OCP_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_ofm_format:
+      init_maketex (format, "MakeOmegaOFM", NULL);
+      INIT_FORMAT (".ofm", DEFAULT_OFMFONTS, OFM_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_opl_format:
+      INIT_FORMAT (".opl", DEFAULT_OPLFONTS, OPL_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_otp_format:
+      INIT_FORMAT (".otp", DEFAULT_OTPINPUTS, OTP_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_ovf_format:
+      INIT_FORMAT (".ovf", DEFAULT_OVFFONTS, OVF_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_ovp_format:
+      INIT_FORMAT (".ovp", DEFAULT_OVPFONTS, OVP_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_pict_format:
+      INIT_FORMAT (NULL, DEFAULT_TEXINPUTS, PICT_ENVS);
+      FMT_INFO.type = "graphic/figure";
+      /* It is conveniently coincidental that this comes before
+         kpse_tex_format, since if the user runs kpsewhich --format=eps,
+         they'll get kpse_pict_format instead of tex_format.  */
+#define PICT_SUFFIXES ".eps", ".epsi"
+      ALT_SUFFIXES (PICT_SUFFIXES);
+      break;
+    case kpse_tex_format:
+      init_maketex (format, "MakeTeXTeX", NULL);
+      INIT_FORMAT (".tex", DEFAULT_TEXINPUTS, TEX_ENVS);
+/* If this list changes, also change tex.ch.  */
+#define TEX_SUFFIXES ".ltx", ".dtx", ".texi", ".texinfo", ".txi", PICT_SUFFIXES
+      ALT_SUFFIXES (TEX_SUFFIXES);
+      break;
+    case kpse_tex_ps_header_format:
+      INIT_FORMAT (NULL, DEFAULT_TEXPSHEADERS, TEX_PS_HEADER_ENVS);
+      FMT_INFO.type = "PostScript header/font";
+      ALT_SUFFIXES (".pro");
+      break;
+    case kpse_texdoc_format:
+      INIT_FORMAT (NULL, DEFAULT_TEXDOCS, TEXDOC_ENVS);
+      FMT_INFO.type = "TeX system documentation";
+      break;
+    case kpse_texpool_format:
+      INIT_FORMAT (".pool", DEFAULT_TEXPOOL, TEXPOOL_ENVS);
+      break;
+    case kpse_texsource_format:
+      INIT_FORMAT (NULL, DEFAULT_TEXSOURCES, TEXSOURCE_ENVS);
+      FMT_INFO.type = "TeX system sources";
+      break;
+    case kpse_tfm_format:
+      init_maketex (format, "MakeTeXTFM", NULL);
+      INIT_FORMAT (".tfm", DEFAULT_TFMFONTS, TFM_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_troff_font_format:
+      INIT_FORMAT (NULL, DEFAULT_TRFONTS, TROFF_FONT_ENVS);
+      FMT_INFO.type = "Troff fonts";
+      break;
+    case kpse_type1_format:
+      INIT_FORMAT (".pfa", DEFAULT_T1FONTS, TYPE1_ENVS);
+      FMT_INFO.type = "type1 fonts";
+      ALT_SUFFIXES (".pfb");
+      break;
+    case kpse_vf_format:
+      INIT_FORMAT (".vf", DEFAULT_VFFONTS, VF_ENVS);
+      FMT_INFO.suffix_search_only = true;
+      break;
+    case kpse_dvips_config_format:
+      INIT_FORMAT (NULL, DEFAULT_TEXCONFIG, DVIPS_CONFIG_ENVS);
+      FMT_INFO.type = "dvips config";
+      break;
+    case kpse_ist_format:
+      INIT_FORMAT (".ist", DEFAULT_INDEXSTYLE, IST_ENVS);
+      break;
+    default:
+      FATAL1 ("kpse_init_format: Unknown format %d", format);
+    }
+
+#ifdef KPSE_DEBUG
+#define MAYBE(member) (FMT_INFO.member ? FMT_INFO.member : "(none)")
+
+  /* Describe the monster we've created.  */
+  if (KPSE_DEBUG_P (KPSE_DEBUG_PATHS))
+    {
+      DEBUGF2 ("Search path for %s files (from %s)\n",
+              FMT_INFO.type, FMT_INFO.path_source);
+      DEBUGF1 ("  = %s\n", FMT_INFO.path);
+      DEBUGF1 ("  before expansion = %s\n", FMT_INFO.raw_path);
+      DEBUGF1 ("  application override path = %s\n", MAYBE (override_path));
+      DEBUGF1 ("  application config file path = %s\n", MAYBE (client_path));
+      DEBUGF1 ("  texmf.cnf path = %s\n", MAYBE (cnf_path));
+      DEBUGF1 ("  compile-time path = %s\n", MAYBE (default_path));
+      DEBUGF1 ("  default suffix = %s\n", MAYBE (suffix));
+      DEBUGF  ("  other suffixes =");
+      if (FMT_INFO.alt_suffix) {
+        const_string *alt;
+        for (alt = FMT_INFO.alt_suffix; alt && *alt; alt++) {
+          fprintf (stderr, " %s", *alt);
+        }
+        putc ('\n', stderr);
+      } else {
+        fputs (" (none)\n", stderr);
+      }
+      DEBUGF1 ("  search only with suffix = %d\n",FMT_INFO.suffix_search_only);
+      DEBUGF1 ("  numeric format value = %d\n", format);
+      DEBUGF1 ("  runtime generation program = %s\n", MAYBE (program));
+      DEBUGF1 ("  extra program args = %s\n", MAYBE (program_args));
+      DEBUGF1 ("  program enabled = %d\n", FMT_INFO.program_enabled_p);
+      DEBUGF1 ("  program enable level = %d\n", FMT_INFO.program_enable_level);
+    }
+#endif /* KPSE_DEBUG */
+
+  return FMT_INFO.path;
+}
+
+/* Look up a file NAME of type FORMAT, and the given MUST_EXIST.  This
+   initializes the path spec for FORMAT if it's the first lookup of that
+   type.  Return the filename found, or NULL.  This is the most likely
+   thing for clients to call.  */
+   
+string
+kpse_find_file P3C(const_string, name,  kpse_file_format_type, format,
+                   boolean, must_exist)
+{
+  const_string suffix;
+  const_string *alt;
+  unsigned name_len = 0;
+  boolean name_has_suffix_already = false;
+  string ret = NULL;
+
+  /* A null or empty NAME is surely a mistake.  */
+  assert (name && *name);
+  
+  if (FMT_INFO.path == NULL)
+    kpse_init_format (format);
+
+  /* Does NAME already end in a possible suffix?  */
+  suffix = FMT_INFO.suffix;
+  if (suffix) {
+    /* Avoid the strlen's entirely if no SUFFIX.  */
+    unsigned suffix_len = strlen (suffix);
+    name_len = strlen (name);
+    name_has_suffix_already = (name_len > suffix_len
+                      && FILESTRCASEEQ (suffix, name + name_len - suffix_len));
+  }
+  for (alt = FMT_INFO.alt_suffix; !name_has_suffix_already && alt && *alt;
+       alt++) {
+    unsigned suffix_len = strlen (*alt);
+    if (!name_len) name_len = strlen (name);
+    name_has_suffix_already = (name_len > suffix_len
+                        && FILESTRCASEEQ (*alt, name + name_len - suffix_len));
+  }
+  
+  /* Search #1: NAME has a suffix (any suffix). For example, foo.sty,
+     foo.eps, foo.tex.  Since multiple suffixes (foo.bar.tex) are
+     relatively rare, first try NAME.    (This loses
+     if given `Times-Roman.tfm', but is ok given `Times-Roman'.)  */
+  if (name_has_suffix_already || find_suffix (name)) {
+    /* Search for original NAME, since it has a suffix.
+    
+       If we will search again with `suffix', avoid pounding the disk.
+       Really should also avoid disk search until after we check the
+       fontmaps, but ... lazy.  Sorry.  */
+    boolean must = must_exist && FMT_INFO.suffix_search_only
+                   && (!suffix || name_has_suffix_already);
+    ret = kpse_path_search (FMT_INFO.path, name, must);
+  }
+
+  /* Search #2: If we have `foo' or `foo.bar', and the above search
+     failed, try `foo.tex' or `foo.bar.tex' now (but don't try
+     `foo.tex.tex'.  This is so we find the `foo.tex' before the
+     executable `foo'.  But, if we might search yet again, still don't
+     pound the disk.  */
+  if (!ret && suffix && !name_has_suffix_already) {
+    /* Append `.suffix' and search for it.  */
+    string name_with_suffix = concat (name, suffix);
+    ret = kpse_path_search (FMT_INFO.path, name_with_suffix,
+                            FMT_INFO.suffix_search_only ? must_exist : false);
+    free (name_with_suffix);
+  }
+
+  /* Search #3 (fonts only): Look for aliases for NAME.  I don't
+     think this is necessary for VF files, since only names people might
+     mention in TeX documents -- i.e., TFM's -- need be aliased.  */
+  if (!ret && (format == kpse_tfm_format || format == kpse_gf_format
+               || format == kpse_pk_format)) {
+    string mapped_name;
+    string *mapped_names;
+    /* Include a suffix in what we pass to `kpse_fontmap_lookup'; otherwise,
+       when we are searching for `circle10', for example, we'll just get
+       back `lcircle10', and that basename won't match anything in ls-R.  */
+    string name_with_suffix = name_has_suffix_already ? (string) name
+                              : concat (name, suffix);
+    mapped_names = kpse_fontmap_lookup (name_with_suffix);
+    while (mapped_names && (mapped_name = *mapped_names++) && !ret) {
+      ret = kpse_path_search (FMT_INFO.path, mapped_name, false);
+    }
+    if (!name_with_suffix)
+      free (name_with_suffix);
+  }
+
+  /* Search #4 (sort of): Call MakeTeXTFM or whatever to create a
+     missing file.  */
+  if (!ret && must_exist) {
+     ret = kpse_make_tex (format, name);
+  }
+
+  /* Search #5: If we have `foo', look for `foo' (if non-suffix searches
+     are enabled for this FORMAT).  This is the last-chance search, so
+     never disable the caller's MUST_EXIST.  */
+  if (!ret && (name_has_suffix_already || !FMT_INFO.suffix_search_only)) {
+    ret = kpse_path_search (FMT_INFO.path, name, must_exist);
+  }
+
+  return ret;
+}
+
+/* Open NAME along the search path for TYPE for reading and return the
+   resulting file, or exit with an error message.  */
+
+FILE *
+kpse_open_file P2C(const_string, name,  kpse_file_format_type, type)
+{
+  string fullname = kpse_find_file (name, type, true);
+  const_string mode = type == kpse_gf_format 
+                      || type == kpse_ocp_format
+                      || type == kpse_ofm_format
+                      || type == kpse_ovf_format
+                      || type == kpse_tfm_format
+                      || type == kpse_vf_format
+                      ? FOPEN_RBIN_MODE : FOPEN_R_MODE;
+  FILE *f = fullname ? fopen (fullname, mode) : NULL;
+  if (!f) {
+    if (fullname) {
+      perror (fullname);
+      exit (1);
+    } else {
+      FATAL2 ("%s file `%s' not found", kpse_format_info[type].type, name);
+    }
+  }
+  
+  return f;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/tex-file.h
@@ -0,0 +1,168 @@
+/* tex-file.h: find files in a particular format.
+
+Copyright (C) 1993, 94, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_TEX_FILE_H
+#define KPATHSEA_TEX_FILE_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+
+/* If non-NULL, try looking for this if can't find the real font.  */
+extern const_string kpse_fallback_font;
+
+
+/* If non-NULL, default list of fallback resolutions comes from this
+   instead of the compile-time value.  Set by dvipsk for the R config
+   cmd.  *SIZES environment variables override/use as default.  */
+extern DllImport const_string kpse_fallback_resolutions_string;
+
+/* If non-NULL, check these if can't find (within a few percent of) the
+   given resolution.  List must end with a zero element.  */
+extern unsigned *kpse_fallback_resolutions;
+
+/* This initializes the fallback resolution list.  If ENVVAR
+   is set, it is used; otherwise, the envvar `TEXSIZES' is looked at; if
+   that's not set either, a compile-time default is used.  */
+extern void kpse_init_fallback_resolutions P1H(string envvar);
+
+/* We put the glyphs first so we don't waste space in an array in
+   tex-glyph.c.  Accompany a new format here with appropriate changes in
+   tex-file.c and kpsewhich.c (the suffix variable).  */
+typedef enum
+{
+  kpse_gf_format,
+  kpse_pk_format,
+  kpse_any_glyph_format,	/* ``any'' meaning anything above */
+  kpse_afm_format, 
+  kpse_base_format, 
+  kpse_bib_format, 
+  kpse_bst_format, 
+  kpse_cnf_format,
+  kpse_db_format,
+  kpse_fmt_format,
+  kpse_fontmap_format,
+  kpse_mem_format,
+  kpse_mf_format, 
+  kpse_mfpool_format, 
+  kpse_mft_format, 
+  kpse_mp_format, 
+  kpse_mppool_format, 
+  kpse_mpsupport_format,
+  kpse_ocp_format,
+  kpse_ofm_format, 
+  kpse_opl_format,
+  kpse_otp_format,
+  kpse_ovf_format,
+  kpse_ovp_format,
+  kpse_pict_format,
+  kpse_tex_format,
+  kpse_texdoc_format,
+  kpse_texpool_format,
+  kpse_texsource_format,
+  kpse_tex_ps_header_format,
+  kpse_troff_font_format,
+  kpse_tfm_format, 
+  kpse_type1_format, 
+  kpse_vf_format,
+  kpse_dvips_config_format,
+  kpse_ist_format,
+  kpse_last_format /* one past last index */
+} kpse_file_format_type;
+
+
+/* Perhaps we could use this for path values themselves; for now, we use
+   it only for the program_enabled_p value.  */
+typedef enum
+{
+  kpse_src_implicit,   /* C initialization to zero */
+  kpse_src_compile,    /* configure/compile-time default */
+  kpse_src_texmf_cnf,  /* texmf.cnf, the kpathsea config file */
+  kpse_src_client_cnf, /* application config file, e.g., config.ps */
+  kpse_src_env,        /* environment variable */
+  kpse_src_x,          /* X Window System resource */
+  kpse_src_cmdline,    /* command-line option */
+} kpse_src_type;
+
+
+/* For each file format, we record the following information.  The main
+   thing that is not part of this structure is the environment variable
+   lists. They are used directly in tex-file.c. We could incorporate
+   them here, but it would complicate the code a bit. We could also do
+   it via variable expansion, but not now, maybe not ever:
+   ${PKFONTS-${TEXFONTS-/usr/local/lib/texmf/fonts//}}.  */
+
+typedef struct
+{
+  const_string type;		/* Human-readable description.  */
+  const_string path;		/* The search path to use.  */
+  const_string raw_path;	/* Pre-$~ (but post-default) expansion.  */
+  const_string path_source;	/* Where the path started from.  */
+  const_string override_path;	/* From client environment variable.  */
+  const_string client_path;	/* E.g., from dvips's config.ps.  */
+  const_string cnf_path;	/* From texmf.cnf.  */
+  const_string default_path;	/* If all else fails.  */
+  const_string suffix;		/* For kpse_find_file to check for/append.  */
+  const_string *alt_suffix;	/* More suffixes to check for.  */
+  boolean suffix_search_only;	/* Only search with a suffix?  */
+  const_string program;		/* ``MakeTeXPK'', etc.  */
+  const_string program_args;	/* Args to `program'.  */
+  boolean program_enabled_p;	/* Invoke `program'?  */
+  kpse_src_type program_enable_level; /* Who said to invoke `program'.  */
+} kpse_format_info_type;
+
+/* The sole variable of that type, indexed by `kpse_file_format_type'.
+   Initialized by calls to `kpse_find_file' for `kpse_init_format'.  */
+extern DllImport kpse_format_info_type kpse_format_info[];
+
+
+/* If LEVEL is higher than `program_enabled_level' for FMT, set
+   `program_enabled_p' to VALUE.  */
+extern void kpse_set_program_enabled P3H(kpse_file_format_type fmt,
+                                         boolean value, kpse_src_type level);
+/* Call kpse_set_program_enabled with VALUE and the format corresponding
+   to FMTNAME.  */
+extern void kpse_maketex_option P2H(const_string fmtname,  boolean value);
+
+/* Initialize the info for the given format.  This is called
+   automatically by `kpse_find_file', but the glyph searching (for
+   example) can't use that function, so make it available.  */
+extern const_string kpse_init_format P1H(kpse_file_format_type);
+
+/* If FORMAT has a non-null `suffix' member, append it to NAME "."
+   and call `kpse_path_search' with the result and the other arguments.
+   If that fails, try just NAME.  */
+extern string kpse_find_file P3H(const_string name,  
+                            kpse_file_format_type format,  boolean must_exist);
+
+/* Here are some abbreviations.  */
+#define kpse_find_mf(name)   kpse_find_file (name, kpse_mf_format, true)
+#define kpse_find_mft(name)  kpse_find_file (name, kpse_mft_format, true)
+#define kpse_find_pict(name) kpse_find_file (name, kpse_pict_format, true)
+#define kpse_find_tex(name)  kpse_find_file (name, kpse_tex_format, true)
+#define kpse_find_tfm(name)  kpse_find_file (name, kpse_tfm_format, true)
+
+/* The `false' is correct for DVI translators, which should clearly not
+   require vf files for every font (e.g., cmr10.vf).  But it's wrong for
+   VF translators, such as vftovp.  */
+#define kpse_find_vf(name) kpse_find_file (name, kpse_vf_format, false)
+
+/* Don't just look up the name, actually open the file.  */
+extern FILE *kpse_open_file P2H(const_string, kpse_file_format_type);
+
+#endif /* not KPATHSEA_TEX_FILE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/tex-glyph.c
@@ -0,0 +1,381 @@
+/* tex-glyph.c: Search for GF/PK files.
+
+Copyright (C) 1993, 94, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/absolute.h>
+#include <kpathsea/expand.h>
+#include <kpathsea/fontmap.h>
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/tex-glyph.h>
+#include <kpathsea/tex-make.h>
+#include <kpathsea/variable.h>
+
+/* Routines are in bottom-up order.  */
+
+/* Support both cmr10.300pk and dpi300/cmr10.pk.  (Use the latter
+   instead of dpi300\cmr10.pk since DOS supports /'s, but Unix doesn't
+   support \'s.  */
+#define UNIX_BITMAP_SPEC "$KPATHSEA_NAME.$KPATHSEA_DPI$KPATHSEA_FORMAT"
+#define DPI_BITMAP_SPEC  "dpi$KPATHSEA_DPI/$KPATHSEA_NAME.$KPATHSEA_FORMAT"
+
+/* Look up FONTNAME at resolution DPI in PATH, with filename suffix
+   EXTENSION.  Return file found or NULL.  */
+
+static string
+try_format P3C(const_string, fontname,  unsigned, dpi,
+               kpse_file_format_type,  format)
+{
+  static const_string bitmap_specs[]
+    = { UNIX_BITMAP_SPEC, DPI_BITMAP_SPEC, NULL };
+  const_string *spec;
+  boolean must_exist;
+  string ret = NULL;
+  const_string path = kpse_format_info[format].path;
+  if (!path)
+    path = kpse_init_format (format);
+  
+  /* Set the suffix on the name we'll be searching for.  */
+  xputenv ("KPATHSEA_FORMAT", kpse_format_info[format].suffix);
+
+  /* OK, the limits on this for loop are a little hokey, but it saves
+     having to repeat the body.  We want to do it once with `must_exist'
+     false to avoid looking on the disk for cmr10.600pk if
+     dpi600/cmr10.pk is in ls-R.  (The time spent in the extra variable
+     expansions and db searches is negligible.)  */
+  for (must_exist = false; !ret && must_exist <= true; must_exist++)
+    {
+      for (spec = bitmap_specs; !ret && *spec; spec++)
+        {
+          string name = kpse_var_expand (*spec);
+          ret = kpse_path_search (path, name, must_exist);
+          if (name != ret)
+            free (name);
+        }
+    }
+    
+  return ret;
+}
+
+/* Look for FONTNAME at resolution DPI in format FORMAT.  Search the
+   (entire) PK path first, then the GF path, if we're looking for both.
+   Return any filename found, and (if we succeeded) fill in GLYPH_FILE.  */
+
+static string
+try_size P4C(const_string, fontname,  unsigned, dpi,
+             kpse_file_format_type, format,
+             kpse_glyph_file_type *, glyph_file)
+{
+  kpse_file_format_type format_found;
+  string ret;
+  boolean try_gf = format == kpse_gf_format || format == kpse_any_glyph_format;
+  boolean try_pk = format == kpse_pk_format || format == kpse_any_glyph_format;
+
+  xputenv_int ("KPATHSEA_DPI", dpi);
+  
+  /* Look for PK first (since it's more likely to be found), then GF.  */
+  ret = try_pk ? try_format (fontname, dpi, kpse_pk_format) : NULL;
+
+  if (ret != NULL)
+    format_found = kpse_pk_format;
+  else
+    {
+      if (try_gf)
+        {
+          ret = try_format (fontname, dpi, kpse_gf_format);
+          format_found = kpse_gf_format;
+        }
+    }
+  
+  if (ret != NULL && glyph_file)
+    { /* Success.  Fill in the return info.  Discard const.  */
+      glyph_file->name = (string) fontname;
+      glyph_file->dpi = dpi;
+      glyph_file->format = format_found;
+    }
+    
+  return ret;
+}
+
+/* Look for FONTNAME at resolution DPI, then at the resolutions within
+   KPSE_BITMAP_TOLERANCE of DPI.  */
+
+static string
+try_resolution P4C(const_string, fontname,  unsigned, dpi,
+                   kpse_file_format_type, format,
+                   kpse_glyph_file_type *, glyph_file)
+{
+  string ret = try_size (fontname, dpi, format, glyph_file);
+  
+  if (!ret)
+    {
+      unsigned r;
+      unsigned tolerance = KPSE_BITMAP_TOLERANCE (dpi);
+      unsigned lower_bound = (int) (dpi - tolerance) < 0 ? 0 : dpi - tolerance;
+      unsigned upper_bound = dpi + tolerance;
+      
+      /* Prefer scaling up to scaling down, since scaling down can omit
+         character features (Tom did this in dvips).  */
+      for (r = lower_bound; !ret && r <= upper_bound; r++)
+        if (r != dpi)
+          ret = try_size (fontname, r, format, glyph_file);
+    }
+  
+  return ret;
+}
+
+/* Look up *FONTNAME_PTR in format FORMAT at DPI in the texfonts.map files
+   that we can find, returning the filename found and GLYPH_FILE.  Also
+   set *FONTNAME_PTR to the real name corresponding to the alias found
+   or the first alias, if that is not an alias itself.  (This allows
+   MakeTeXPK to only deal with real names.)  */
+
+static string
+try_fontmap P4C(string *, fontname_ptr,  unsigned, dpi,
+                kpse_file_format_type, format,
+                kpse_glyph_file_type *, glyph_file)
+{
+  string *mapped_names;
+  string fontname = *fontname_ptr;
+  string ret = NULL;
+
+  mapped_names = kpse_fontmap_lookup (fontname);
+  if (mapped_names) {
+    string mapped_name;
+    string first_name = *mapped_names;
+    while ((mapped_name = *mapped_names++) && !ret) {
+      xputenv ("KPATHSEA_NAME", mapped_name);
+      ret = try_resolution (mapped_name, dpi, format, glyph_file);
+    }
+    if (ret) {
+      /* If some alias succeeeded, return that alias.  */
+      *fontname_ptr = xstrdup (mapped_name);
+    /* Return first alias name, unless that itself is an alias,
+       in which case do nothing.  */
+    } else if (!kpse_fontmap_lookup (first_name)) {
+      *fontname_ptr = xstrdup (first_name);
+    }
+  } 
+
+  return ret;
+}
+
+/* Look for FONTNAME in `kpse_fallback_resolutions', omitting DPI if we
+   happen across it.  Return NULL if nothing found.  Pass GLYPH_FILE
+   along as usual.  Assume `kpse_fallback_resolutions' is sorted.  */
+
+static string
+try_fallback_resolutions P4C(const_string, fontname,  unsigned, dpi,
+                             kpse_file_format_type, format,
+                             kpse_glyph_file_type *, glyph_file)
+{
+  unsigned s;
+  int loc, max_loc;
+  int lower_loc, upper_loc;
+  unsigned lower_diff, upper_diff;
+  unsigned closest_diff = UINT_MAX;
+  string ret = NULL; /* In case the only fallback resolution is DPI.  */
+
+  /* First find the fallback size closest to DPI, even including DPI.  */
+  for (s = 0; kpse_fallback_resolutions[s] != 0; s++)
+    {
+      unsigned this_diff = abs (kpse_fallback_resolutions[s] - dpi);
+      if (this_diff < closest_diff)
+        {
+          closest_diff = this_diff;
+          loc = s;
+        }
+    }
+  if (s == 0)
+    return ret; /* If nothing in list, quit now.  */
+  
+  max_loc = s;
+  lower_loc = loc - 1;
+  upper_loc = loc + 1;
+  
+  for (;;)
+    {
+      unsigned fallback = kpse_fallback_resolutions[loc];
+      /* Don't bother to try DPI itself again.  */
+      if (fallback != dpi)
+        {
+          ret = try_resolution (fontname, fallback, format, glyph_file);
+          if (ret)
+            break;
+        }
+      
+      /* That didn't work. How far away are the locs above or below?  */
+      lower_diff = lower_loc > -1
+                   ? dpi - kpse_fallback_resolutions[lower_loc] : INT_MAX;
+      upper_diff = upper_loc < max_loc
+                   ? kpse_fallback_resolutions[upper_loc] - dpi : INT_MAX;
+      
+      /* But if we're at the end in both directions, quit.  */
+      if (lower_diff == INT_MAX && upper_diff == INT_MAX)
+        break;
+      
+      /* Go in whichever direction is closest.  */
+      if (lower_diff < upper_diff)
+        {
+          loc = lower_loc;
+          lower_loc--;
+        }
+      else
+        {
+          loc = upper_loc;
+          upper_loc++;
+        }
+    }
+
+  return ret;
+}
+
+/* See the .h file for description.  This is the entry point.  */
+
+string
+kpse_find_glyph P4C(const_string, passed_fontname,  unsigned, dpi,
+                    kpse_file_format_type, format,
+                    kpse_glyph_file_type *, glyph_file)
+{
+  string ret;
+  kpse_glyph_source_type source;
+  string fontname = (string) passed_fontname; /* discard const */
+  
+  /* Start the search: try the name we're given.  */
+  source = kpse_glyph_source_normal;
+  xputenv ("KPATHSEA_NAME", fontname);
+  ret = try_resolution (fontname, dpi, format, glyph_file);
+  
+  /* Try all the various possibilities in order of preference.  */
+  if (!ret) {
+    /* Maybe FONTNAME was an alias.  */
+    source = kpse_glyph_source_alias;
+    ret = try_fontmap (&fontname, dpi, format, glyph_file);
+
+    /* If not an alias, try creating it on the fly with MakeTeXPK,
+       unless FONTNAME is absolute or explicitly relative.  */
+    if (!ret && !kpse_absolute_p (fontname, true)) {
+      source = kpse_glyph_source_maketex;
+      /* `try_resolution' leaves the envvar set randomly.  */
+      xputenv_int ("KPATHSEA_DPI", dpi);
+      ret = kpse_make_tex (format, fontname);
+    }
+
+    /* If MakeTeX... succeeded, set return struct.  Doesn't make sense for
+       `kpse_make_tex' to set it, since it can only succeed or fail,
+       unlike the other routines.  */
+    if (ret) {
+      KPSE_GLYPH_FILE_DPI (*glyph_file) = dpi;
+      KPSE_GLYPH_FILE_NAME (*glyph_file) = fontname;
+    }
+
+    /* If MakeTeX... failed, try any fallback resolutions.  */
+    else {
+      if (kpse_fallback_resolutions)
+        ret = try_fallback_resolutions (fontname, dpi, format, glyph_file);
+
+      /* We're down to the font of last resort.  */
+      if (!ret && kpse_fallback_font) {
+        const_string name = kpse_fallback_font;
+        source = kpse_glyph_source_fallback;
+        xputenv ("KPATHSEA_NAME", name);
+
+        /* As before, first try it at the given size.  */
+        ret = try_resolution (name, dpi, format, glyph_file);
+
+        /* The fallback font at the fallback resolutions.  */
+        if (!ret && kpse_fallback_resolutions)
+          ret = try_fallback_resolutions (name, dpi, format, glyph_file);
+      }
+    }
+  }
+  
+  /* If RET is null, then the caller is not supposed to look at GLYPH_FILE,
+     so it doesn't matter if we assign something incorrect.  */
+  KPSE_GLYPH_FILE_SOURCE (*glyph_file) = source;
+  
+  if (fontname != passed_fontname)
+    free (fontname);
+
+  return ret;
+}
+
+/* The tolerances change whether we base things on DPI1 or DPI2.  */
+
+boolean
+kpse_bitmap_tolerance P2C(double, dpi1,  double, dpi2)
+{
+  unsigned tolerance = KPSE_BITMAP_TOLERANCE (dpi2);
+  unsigned lower_bound = (int) (dpi2 - tolerance) < 0 ? 0 : dpi2 - tolerance;
+  unsigned upper_bound = dpi2 + tolerance;
+
+  return lower_bound <= dpi1 && dpi1 <= upper_bound;
+}
+
+#ifdef TEST
+
+void
+test_find_glyph (const_string fontname, unsigned dpi)
+{
+  string answer;
+  kpse_glyph_file_type ret;
+  
+  printf ("\nSearch for %s@%u:\n\t", fontname, dpi);
+
+  answer = kpse_find_glyph_format (fontname, dpi,
+                                   kpse_any_glyph_format, &ret);
+  if (answer)
+    {
+      string format = ret.format == kpse_pk_format ? "pk" : "gf";
+      if (!ret.name)
+        ret.name = "(nil)";
+      printf ("%s\n\t(%s@%u, %s)\n", answer, ret.name, ret.dpi, format);
+    }
+  else
+    puts ("(nil)");
+}
+
+
+int
+main ()
+{
+  test_find_glyph ("/usr/local/lib/tex/fonts/cm/cmr10", 300); /* absolute */
+  test_find_glyph ("cmr10", 300);     /* normal */
+  test_find_glyph ("logo10", 300);    /* find gf */
+  test_find_glyph ("cmr10", 299);     /* find 300 */
+  test_find_glyph ("circle10", 300);  /* in fontmap */
+  test_find_glyph ("none", 300);      /* do not find */
+  kpse_fallback_font = "cmr10";
+  test_find_glyph ("fallback", 300);  /* find fallback font cmr10 */
+  kpse_init_fallback_resolutions ("KPATHSEA_TEST_SIZES");
+  test_find_glyph ("fallbackdpi", 759); /* find fallback font cmr10@300 */
+  
+  xputenv ("GFFONTS", ".");
+  test_find_glyph ("cmr10", 300);     /* different GFFONTS/TEXFONTS */
+  
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+test-compile-command: "gcc -g -I. -I.. -DTEST tex-glyph.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/tex-glyph.h
@@ -0,0 +1,78 @@
+/* tex-glyph.h: look for a TeX glyph font (GF or PK).
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_TEX_GLYPH_H
+#define KPATHSEA_TEX_GLYPH_H
+
+#include <kpathsea/tex-file.h>
+
+
+/* This type describes the origination of a glyph font.  */
+
+typedef enum
+{
+  kpse_glyph_source_normal,  /* the searched-for font: already existed */
+  kpse_glyph_source_alias,   /* : was an alias for an existing file */
+  kpse_glyph_source_maketex, /* : was created on the fly */
+  kpse_glyph_source_fallback /* : wasn't found, but the fallback font was */
+} kpse_glyph_source_type;
+
+
+typedef struct
+{
+  string name;			/* font name found */
+  unsigned dpi;			/* size found, for glyphs */
+  kpse_file_format_type format;	/* glyph format found */
+  kpse_glyph_source_type source;	/* where we found it */
+} kpse_glyph_file_type;		
+
+#define KPSE_GLYPH_FILE_NAME(f) ((f).name)
+#define KPSE_GLYPH_FILE_DPI(f) ((f).dpi)
+#define KPSE_GLYPH_FILE_FORMAT(f) ((f).format)
+#define KPSE_GLYPH_FILE_SOURCE(f) ((f).source)
+
+
+/* Search first for the font named FONT_NAME at resolution DPI in the
+   glyph format FORMAT (see `try_size' for details of format searching).
+   Then try resolutions within KPSE_BITMAP_TOLERANCE of DPI.  Then try
+   the resolutions in `kpse_fallback_sizes', then within the tolerance
+   of each of those.  Then if FONT_NAME is an alias defined in a
+   texfonts.map do all the above for its real name.  Then try the above
+   for kpse_fallback_name.  Then fail.  Return either the filename
+   found, or NULL.  Also return information about the file found in
+   *GLYPH_FILE.  */
+extern string kpse_find_glyph P4H(const_string font_name, unsigned dpi, 
+                                  kpse_file_format_type format,
+                                  kpse_glyph_file_type *glyph_file);
+
+/* Look for a specific format only.  */
+#define kpse_find_pk(font_name, dpi, glyph_file) \
+  kpse_find_glyph (font_name, dpi, kpse_pk_format, glyph_file)
+#define kpse_find_gf(font_name, dpi, glyph_file) \
+  kpse_find_glyph (font_name, dpi, kpse_gf_format, glyph_file)
+
+
+/* Defines how far away a pixel file can be found from its stated size.
+   The DVI standard says any resolution within 0.2% of the stated size
+   is ok, but we are more forgiving.  */
+#define KPSE_BITMAP_TOLERANCE(r) ((r) / 500.0 + 1)
+
+/* Check whether DPI1 is within KPSE_BITMAP_TOLERANCE of DPI2. */
+extern boolean kpse_bitmap_tolerance P2H(double dpi1, double dpi2);
+
+#endif /* not KPATHSEA_TEX_GLYPH_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/tex-hush.c
@@ -0,0 +1,37 @@
+/* tex-hush.c: are we suppressing warnings?
+
+Copyright (C) 1996 Karl Berry.
+
+This program 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 program 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 program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/pathsearch.h>
+#include <kpathsea/tex-hush.h>
+#include <kpathsea/variable.h>
+
+boolean
+kpse_tex_hush P1C(const_string, what)
+{
+  string h;
+  string hush = kpse_var_value ("TEX_HUSH");
+  for (h = kpse_path_element (hush); h; h = kpse_path_element (NULL)) {
+    /* Don't do anything special with empty elements.  */
+    if (STREQ (hush, what) || STREQ (hush, "all"))
+      return true;
+  }
+  
+  return false;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/tex-hush.h
@@ -0,0 +1,29 @@
+/* tex-hush.h: suppressing warnings?
+
+Copyright (C) 1996 Karl Berry.
+
+This program 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 program 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 program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_TEX_HUSH_H
+#define KPATHSEA_TEX_HUSH_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+/* Return true if WHAT is included in the TEX_HUSH environment
+   variable/config value.  */
+extern boolean kpse_tex_hush P1H(const_string what);
+
+#endif /* not KPATHSEA_TEX_HUSH_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/tex-make.c
@@ -0,0 +1,323 @@
+/* tex-make.c: Run external programs to make TeX-related files.
+
+Copyright (C) 1993, 94, 95, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-fopen.h>
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/concatn.h>
+#include <kpathsea/db.h>
+#include <kpathsea/fn.h>
+#include <kpathsea/magstep.h>
+#include <kpathsea/readable.h>
+#include <kpathsea/tex-make.h>
+#include <kpathsea/variable.h>
+
+
+/* We never throw away stdout, since that is supposed to be the filename
+   found, if all is successful.  This variable controls whether stderr
+   is thrown away.  */
+boolean kpse_make_tex_discard_errors = false;
+
+/* We set the envvar MAKETEX_MAG, which is part of the default spec for
+   MakeTeXPK above, based on KPATHSEA_DPI and MAKETEX_BASE_DPI.  */
+
+static void
+set_maketex_mag P1H(void)
+{
+  char q[MAX_INT_LENGTH * 3 + 3];
+  int m;
+  string dpi_str = getenv ("KPATHSEA_DPI");
+  string bdpi_str = getenv ("MAKETEX_BASE_DPI");
+  unsigned dpi = dpi_str ? atoi (dpi_str) : 0;
+  unsigned bdpi = bdpi_str ? atoi (bdpi_str) : 0;
+
+  /* If the environment variables aren't set, it's a bug.  */
+  assert (dpi != 0 && bdpi != 0);
+  
+  /* Fix up for roundoff error.  Hopefully the driver has already fixed
+     up DPI, but may as well be safe, and also get the magstep number.  */
+  (void) kpse_magstep_fix (dpi, bdpi, &m);
+  
+  /* Have to do something different for DOS?  */
+  if (m == 0)
+    sprintf (q, "%d+%d/%d", dpi / bdpi, dpi % bdpi, bdpi);
+  else
+    { /* m is encoded with LSB being a ``half'' bit (see magstep.h).  Are
+         we making an assumption here about two's complement?  Probably.
+         In any case, if m is negative, we have to put in the sign
+         explicitly, since m/2==0 if m==-1.  */
+      const_string sign = "";
+      if (m < 0)
+        {
+          m *= -1;
+          sign = "-";
+        }
+      sprintf (q, "magstep\\(%s%d.%d\\)", sign, m / 2, (m & 1) * 5);
+    }  
+  xputenv ("MAKETEX_MAG", q);
+}
+
+/* This MakeTeX... program was disabled, or the script failed.  If this
+   was a font creation (according to FORMAT), append CMD
+   to a file missfont.log in the current directory.  */
+
+static void
+misstex P2C(kpse_file_format_type, format,  const_string, cmd)
+{
+  static FILE *missfont = NULL;
+
+  /* If we weren't trying to make a font, do nothing.  Maybe should
+     allow people to specify what they want recorded?  */
+  if (format > kpse_any_glyph_format && format != kpse_tfm_format
+      && format != kpse_vf_format)
+    return;
+
+  /* If this is the first time, have to open the log file.  But don't
+     bother logging anything if they were discarding errors.  */
+  if (!missfont && !kpse_make_tex_discard_errors) {
+    const_string missfont_name = kpse_var_value ("MISSFONT_LOG");
+    if (!missfont_name || *missfont_name == '1') {
+      missfont_name = "missfont.log"; /* take default name */
+    } else if (missfont_name
+               && (*missfont_name == 0 || *missfont_name == '0')) {
+      missfont_name = NULL; /* user requested no missfont.log */
+    } /* else use user's name */
+
+    missfont = missfont_name ? fopen (missfont_name, FOPEN_A_MODE) : NULL;
+    if (!missfont && kpse_var_value ("TEXMFOUTPUT")) {
+      missfont_name = concat3 (kpse_var_value ("TEXMFOUTPUT"), DIR_SEP_STRING,
+                               missfont_name);
+      missfont = fopen (missfont_name, FOPEN_A_MODE);
+    }
+
+    if (missfont)
+      fprintf (stderr, "kpathsea: Appending font creation commands to %s.\n",
+               missfont_name);
+  }
+  
+  /* Write the command if we have a log file.  */
+  if (missfont) {
+    fputs (cmd, missfont);
+    putc ('\n', missfont);
+  }
+}  
+
+
+/* Assume the script outputs the filename it creates (and nothing
+   else) on standard output; hence, we run the script with `popen'.  */
+
+static string
+maketex P2C(kpse_file_format_type, format,  const_string, passed_cmd)
+{
+  string ret;
+  unsigned i;
+  FILE *f;
+  string cmd = xstrdup (passed_cmd);
+  
+  /* If the user snuck `backquotes` or $(command) substitutions into the
+     name, foil them.  */
+  for (i = 0; i < strlen (cmd); i++) {
+    if (cmd[i] == '`' || (cmd[i] == '$' && cmd[i+1] == '(')) {
+      cmd[i] = '#';
+    }
+  }
+
+  /* Tell the user we are running the script, so they have a clue as to
+     what's going on if something messes up.  But if they asked to
+     discard output, they probably don't want to see this, either.  */
+  if (!kpse_make_tex_discard_errors) {
+    fprintf (stderr, "kpathsea: Running %s\n", cmd);
+  }
+  
+  /* Run the script.  The Amiga has a different interface.  */
+#ifdef AMIGA
+  ret = system (cmd) == 0 ? getenv ("LAST_FONT_CREATED") : NULL;
+#else /* not AMIGA */
+  f = popen (cmd, FOPEN_R_MODE);
+
+  if (f) {
+    int c;
+    string fn;             /* The final filename.  */
+    unsigned len;          /* And its length.  */
+    fn_type output;
+    output = fn_init ();   /* Collect the script output.  */
+
+    /* Read all the output and terminate with a null.  */
+    while ((c = getc (f)) != EOF)
+      fn_1grow (&output, c);
+    fn_1grow (&output, 0);
+
+    /* Maybe should check for `EXIT_SUCCESS' status before even
+       looking at the output?  In some versions of Linux, pclose fails
+       with ECHILD (No child processes), maybe only if we're being run
+       by lpd.  So don't make this a fatal error.  */
+    if (pclose (f) == -1) {
+      perror ("pclose(MakeTeXPK)");
+      WARNING ("kpathsea: This is probably the Linux pclose bug; continuing");
+    }
+
+    len = FN_LENGTH (output);
+    fn = FN_STRING (output);
+
+    /* Remove trailing newlines and returns.  */
+    while (len > 1 && (fn[len - 2] == '\n' || fn[len - 2] == '\r')) {
+      fn[len - 2] = 0;
+      len--;
+    }
+
+    /* If no output from script, return NULL.  Otherwise check
+       what it output.  */
+    ret = len == 1 ? NULL : kpse_readable_file (fn);
+    if (!ret && len > 1) {
+      WARNING1 ("kpathsea: MakeTeXPK output `%s' instead of a filename", fn);
+    }
+
+    /* Free the name if we're not returning it.  */
+    if (fn != ret)
+      free (fn);
+  } else {
+    /* popen failed.  */
+    perror ("kpathsea");
+    ret = NULL;
+  }
+#endif /* not AMIGA */
+
+  if (ret == NULL)
+    misstex (format, cmd);
+  else
+    kpse_db_insert (ret);
+    
+  return ret;
+}
+
+
+/* Create BASE in FORMAT and return the generated filename, or
+   return NULL.  */
+
+string
+kpse_make_tex P2C(kpse_file_format_type, format,  const_string, base)
+{
+  kpse_format_info_type spec; /* some compilers lack struct initialization */
+  string ret = NULL;
+  
+  spec = kpse_format_info[format];
+  if (!spec.type) { /* Not initialized yet? */
+    kpse_init_format (format);
+    spec = kpse_format_info[format];
+  }
+  
+  if (spec.program && spec.program_enabled_p) {
+    /* See the documentation for the envvars we're dealing with here.  */
+    string args, cmd;
+    const_string prog = spec.program;
+    const_string arg_spec = spec.program_args;
+    string mode = getenv ("MAKETEX_MODE");
+    boolean unset_mode = false;
+
+    if (format <= kpse_any_glyph_format)
+      set_maketex_mag ();
+
+    /* Here's an awful kludge: if the mode is `/', unset it for the call
+       and then reset it.  We could ignore a mode of / in MakeTeXPK, but
+       then everyone's MakeTeXPK would have to handle that special case,
+       which seems too onerous.  `kpse_prog_init' sets it to this in the
+       first place when no mode is otherwise specified; this is so when
+       the user defines a resolution, they don't also have to specify a
+       mode; instead, MakeTeXPK's guesses will take over.  They use /
+       for the value because then when it is expanded as part of the
+       PKFONTS et al. path values, we'll wind up searching all the pk
+       directories.  We put $MAKETEX_MODE in the path values in the
+       first place so that sites with two different devices with the
+       same resolution can find the right fonts; but such sites are
+       uncommon, so they shouldn't make things harder for everyone else.  */
+    if (mode && STREQ (mode, DIR_SEP_STRING)) {
+      xputenv ("MAKETEX_MODE", "");
+      unset_mode = true;
+    }
+    args = arg_spec ? kpse_var_expand (arg_spec) : (string) "";
+    if (unset_mode)
+      xputenv ("MAKETEX_MODE", DIR_SEP_STRING);
+
+    /* The command is the program name plus the arguments.  */
+    cmd = concatn (prog, " ", base, " ", args, NULL);
+
+    /* Only way to discard errors is redirect stderr inside another
+       shell; otherwise, if the MakeTeX... script doesn't exist, we
+       will see the `sh: MakeTeX...: not found' error.  No point in
+       doing this if we're not actually going to run anything.  */
+    if (kpse_make_tex_discard_errors) {
+      string old_cmd = cmd;
+#ifdef OS2
+      cmd = concat3 ("cmd /c \"", cmd, "\" 2>/dev/nul");
+#else
+      cmd = concat3 ("sh -c \"", cmd, "\" 2>/dev/null");
+#endif
+      free (old_cmd);
+    }
+
+    ret = maketex (format, cmd);
+
+    free (cmd);
+    if (*args)
+      free (args);
+  }  
+
+  return ret;
+}
+
+#ifdef TEST
+
+void
+test_make_tex (kpse_file_format_type fmt, const_string base)
+{
+  string answer;
+  
+  printf ("\nAttempting %s in format %d:\n", base, fmt);
+
+  answer = kpse_make_tex (fmt, base);
+  puts (answer ? answer : "(nil)");
+}
+
+
+int
+main ()
+{
+  xputenv ("KPATHSEA_DPI", "781"); /* call MakeTeXPK */
+  xputenv ("MAKETEX_BASE_DPI", "300"); /* call MakeTeXPK */
+  KPSE_MAKE_SPEC_ENABLED (kpse_make_specs[kpse_pk_format]) = true;
+  test_make_tex (kpse_pk_format, "cmr10");
+
+  /* Fail with MakeTeXTFM.  */
+  KPSE_MAKE_SPEC_ENABLED (kpse_make_specs[kpse_tfm_format]) = true;
+  test_make_tex (kpse_tfm_format, "foozler99");
+  
+  /* Call something disabled.  */
+  test_make_tex (kpse_bst_format, "no-way");
+  
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+test-compile-command: "gcc -g -I. -I.. -DTEST tex-make.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/tex-make.h
@@ -0,0 +1,39 @@
+/* tex-make.h: declarations for executing external scripts.
+
+Copyright (C) 1993, 94 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_TEX_MAKE_H
+#define KPATHSEA_TEX_MAKE_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/tex-file.h>
+#include <kpathsea/types.h>
+
+
+/* If true, throw away standard error from the MakeTeX... scripts.
+   (Standard output is the filename, so we never throw that away.)  */
+extern DllImport boolean kpse_make_tex_discard_errors;
+
+
+/* Run a program to create a file named by BASE_FILE in format FORMAT.
+   Return the full filename to it, or NULL.  Any other information about
+   the file is passed through environment variables.  See the MakeTeXPK
+   stuff in `tex-make.c' for an example. */
+extern string kpse_make_tex P2H(kpse_file_format_type format,
+                                const_string base_file);
+
+#endif /* not KPATHSEA_TEX_MAKE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/texmf.cnf.in
@@ -0,0 +1,339 @@
+% original texmf.cnf -- runtime path configuration file for kpathsea.
+% (If you change or delete `original' on the previous line, the
+% distribution won't install its version over yours.)
+% Public domain.
+% 
+% What follows is a super-summary of what this .cnf file can
+% contain. Please read the Kpathsea manual for more information.
+% 
+% texmf.cnf is generated from texmf.cnf.in, by replacing @var@ with the
+% value of the Make variable `var', via a sed file texmf.sed, generated
+% (once) by kpathsea/Makefile (itself generated from kpathsea/Makefile.in
+% by configure).
+% 
+% Any identifier (sticking to A-Za-z_ for names is safest) can be assigned.
+% The `=' (and surrounding spaces) is optional.
+% No % or @ in texmf.cnf.in, for the sake of autogeneration.
+% (However, %'s and @'s can be edited into texmf.cnf or put in envvar values.)
+% $foo (or ${foo}) in a value expands to the envvar or cnf value of foo.
+% 
+% Earlier entries (in the same or another file) override later ones, and
+% an environment variable foo overrides any texmf.cnf definition of foo.
+% 
+% All definitions are read before anything is expanded, so you can use
+% variables before they are defined. 
+% 
+% If a variable assignment is qualified with `.PROGRAM', it is ignored
+% unless the current executable (last filename component of argv[0]) is
+% named PROGRAM.  This foo.PROGRAM construct is not recognized on the
+% right-hand side. For environment variables, use FOO_PROGRAM.
+% 
+% Which file formats use which paths for searches is described in the
+% various programs' and the kpathsea documentation.
+% 
+% // means to search subdirectories (recursively).
+% A leading !! means to look only in the ls-R db, never on the disk.
+% A leading/trailing/doubled : in the paths will be expanded into the
+%   compile-time default. Probably not what you want.
+
+
+%  Part 1: Search paths and directories.
+
+% The root of everything below.
+prefix = @prefix@
+
+% You can set an environment variable to override this if you're testing
+% a new TeX tree, without changing anything else.
+% 
+% You may wish to use one of the $SELFAUTO... variables here so TeX will
+% find where to look dynamically.  See the manual and the definition
+% below of TEXMFCNF.
+% 
+% If you have multiple trees, you can use shell brace notation, for example:
+% TEXMF = {/usr/local/mytex,/usr/local/othertex}
+% Also set TEXMFDBS to /usr/local/mytex:/usr/local/othertex,
+%  and set TEXMFMAIN to whichever is the main tree (with ./web2c, etc.),
+%  and set TEXMFLS_R to the tree where you want generated files to go
+% 
+TEXMF = @texmf@
+% Change this if you have multiple trees or MakeTeX* will fail:
+TEXMFMAIN = $TEXMF
+% (this is the default) TEXMFLS_R = $TEXMFMAIN
+% (this is the default) TEXMFCNF_DIR = $TEXMFMAIN
+
+% Where to look for ls-R files.  There need not be an ls-R in the
+% directories in this path, but if there is one, Kpathsea will use it.
+TEXMFDBS = $TEXMF
+
+% The TeX inputs and fonts directories.
+texdir = @texinputdir@
+fontdir = @fontdir@
+
+% To avoid searching the filesystem, use the commented-out definitions here.
+%dbtex = !!$texdir
+%dbfonts = !!$fontdir
+dbtex = $texdir
+dbfonts = $fontdir
+
+% TeX input files -- i.e., anything to be found by \input or \openin,
+% including .sty, .eps, etc. 
+TEXINPUTS = .:$dbtex//
+
+% LaTeX 2e specific macros are stored in latex/, macros that can only be
+% used with 2.09 in latex209/.  In addition, we look in the directory
+% latex2, useful for macros that were written for 2.09 and do not
+% mention 2e at all, but can be used with 2e.
+latex209_inputs = .:$dbtex/latex209//:$dbtex/latex//:$dbtex/generic//
+latex2e_inputs = .:$dbtex/latex//:$dbtex/latex209//:$dbtex/generic//
+TEXINPUTS.latex209 = $latex209_inputs
+TEXINPUTS.latex2e = $latex2e_inputs
+TEXINPUTS.latex = $latex2e_inputs
+
+% Fontinst needs to read afm files.
+TEXINPUTS.fontinst = .:$dbtex//:$dbfonts//afm//
+
+% Plain TeX.  Have the command tex check all directories as a last
+% resort, we may have plain-compatible stuff anywhere.
+plain_inputs = $dbtex/plain//:$dbtex/generic//
+TEXINPUTS.tex = .:$plain_inputs:$dbtex//
+% other plain-based formats
+TEXINPUTS.amstex = .:$dbtex/amstex//:$plain_inputs
+TEXINPUTS.ftex = .:$dbtex/formate//:$plain_inputs
+TEXINPUTS.texinfo = .:$dbtex/texinfo//:$plain_inputs
+
+% INITEX. May as well make this separate so it can search on disk;
+% initex is seldom run, and might be used directly after files have been
+% added, when ls-R may not up be to date.
+TEXINPUTS.initex = .:$texdir//
+
+% Earlier entries override later ones, so put this last.
+TEXINPUTS = .:$dbtex//
+
+% Metafont, MetaPost inputs.
+MFINPUTS = .:@mfinputdir@//:{$dbfonts,$VARTEXFONTS}//source//
+MPINPUTS = .:@mpinputdir@//
+
+% Dump files (fmt/base/mem) for vir{tex,mf,mp} to read (see
+% web2c/INSTALL), and string pools (.pool) for ini{tex,mf,mp}.  It is
+% silly that we have six paths and directories here (they all resolve to
+% a single place by default), but historically ...
+TEXFORMATS = .:@fmtdir@
+MFBASES = .:@basedir@
+MPMEMS = .:@memdir@
+TEXPOOL = .:@texpooldir@
+MFPOOL = .:@mfpooldir@
+MPPOOL = .:@mppooldir@
+
+% If you have a read-only central font directory and therefore need to
+% cache MakeTeXPK-created fonts locally, set this as appropriate and
+% also set the `vartexfonts' feature in MT_FEATURES in MakeTeXnames.cnf.
+VARTEXFONTS = /var/tex/fonts
+
+% Device-independent font metric files.
+VFFONTS = .:$dbfonts//vf//
+TFMFONTS = .:{$dbfonts,$VARTEXFONTS}//tfm//
+
+% The $MAKETEX_MODE below means the drivers will not use a cx font when
+% the mode is ricoh.  If no mode is explicitly specified, kpse_prog_init
+% sets MAKETEX_MODE to /, so all subdirectories are searched.  See the manual.
+PKFONTS = .:{$dbfonts,$VARTEXFONTS}//pk/$MAKETEX_MODE//
+
+% xdvi needs to find bitmaps for PostScript fonts, which can be
+% generated by the standalone program gsftopk, among others.
+PKFONTS.xdvi = .:{$dbfonts,$VARTEXFONTS}//pk/{$MAKETEX_MODE,modeless}//
+
+% Similarly for the GF format, which only remains in existence because
+% Metafont outputs it (and MF isn't going to change).
+GFFONTS = .:$dbfonts//gf/$MAKETEX_MODE//
+
+% A backup for PKFONTS and GFFONTS. Not used for anything.
+GLYPHFONTS = .:$dbfonts
+
+% For texfonts.map and included map files used by MakeTeXPK.
+% See ftp://ftp.tug.org/tex/fontname.tar.gz.
+TEXFONTMAPS = .:$TEXMF/fontname
+
+% BibTeX bibliographies and style files.
+BIBINPUTS = .:$TEXMF/bibtex/bib//
+BSTINPUTS = .:$TEXMF/bibtex/bst//
+
+% MFT style files.
+MFTINPUTS = .:$TEXMF/mft//
+
+% PostScript headers, prologues (.pro), encodings (.enc) and fonts.
+TEXPSHEADERS = .:@psheaderdir@//:$dbfonts//type1//
+
+% PostScript Type 1 outline fonts.
+T1FONTS = .:$dbfonts//type1//
+
+% PostScript AFM metric files.
+AFMFONTS = .:$dbfonts//afm//
+
+% Dvips' config.* files (this name should not start with `TEX'!).
+TEXCONFIG = .:@dvipsdir@//
+
+% Makeindex style (.ist) files.
+INDEXSTYLE = .:$TEXMF/makeindex//
+
+% Used by DMP (ditroff-to-mpx), called by makempx -troff.
+TRFONTS = /usr/lib/font/devpost
+MPSUPPORT = .:$TEXMF/metapost/support
+
+% For xdvi to find mime.types and .mailcap, if they do not exist in
+% $HOME.  These are single directories, not paths.
+% (But the default mime.types, at least, may well suffice.)
+MIMELIBDIR = $prefix/etc
+MAILCAPLIBDIR = $prefix/etc
+
+% TeX documentation and source files, for use with kpsewhich.
+TEXDOCS = .:$TEXMF/doc//
+TEXSOURCES = .:$TEXMF/source//
+
+% Omega-related fonts and other files.
+OFMFONTS = .:{$dbfonts,$VARTEXFONTS}//ofm//
+OPLFONTS = .:{$dbfonts,$VARTEXFONTS}//opl//
+OVFFONTS = .:{$dbfonts,$VARTEXFONTS}//ovf//
+OVPFONTS = .:{$dbfonts,$VARTEXFONTS}//ovp//
+OTPINPUTS = .:$TEXMF/omega/otp//
+OCPINPUTS = .:$TEXMF/omega/ocp//
+
+% The MakeTeX* scripts rely on KPSE_DOT. Do not change it.
+KPSE_DOT = .
+
+% This definition isn't used from this .cnf file itself (that would be
+% paradoxical), but the compile-time default in paths.h is built from it.
+% The SELFAUTO* variables are set automatically from the location of
+% argv[0], in kpse_set_progname.  
+% 
+% About the /. construction:
+% 1) if the variable is undefined, we'd otherwise have an empty path
+%    element in the compile-time path.  This is not meaningful.
+% 2) if we used /$VARIABLE, we'd end up with // if VARIABLE is defined,
+%    which would search the entire world.
+%    
+% The TETEXDIR stuff isn't likely to relevant unless you're using teTeX,
+% but it doesn't hurt.
+% 
+web2cdir = @web2cdir@
+TEXMFCNF = .:$SELFAUTOLOC:$SELFAUTODIR:$SELFAUTODIR/share/texmf/web2c:$SELFAUTOPARENT:$SELFAUTOPARENT/share/texmf/web2c:/.$TETEXDIR:/.$TEXMF/web2c:$web2cdir
+
+
+%  Part 2: Non-path options.
+ 
+% Write .log/.dvi/etc. files here, if the current directory is unwritable.
+% TEXMFOUTPUT = /tmp
+
+% If a dynamic file creation fails, log the command to this file, in
+% either the current directory or TEXMFOUTPUT.  Set to the
+% empty string or  0  to avoid logging.
+MISSFONT_LOG = missfont.log
+
+% Set to a colon-separated list of words specifying warnings to suppress.
+% To suppress everything, use TEX_HUSH = all; this is equivalent to
+% TEX_HUSH = checksum:lostchar:readable:special
+TEX_HUSH = 0
+
+% Enable system commands via \write18{...}?
+shell_escape = 0
+
+% Allow TeX \openout on filenames starting with `.' (e.g., .rhosts)?
+openout_any = 0
+
+% Enable the MakeTeX... scripts by default?  These must be set to 0 or 1.
+% Particular programs can and do override these settings, for example
+% dvips's -M option.  Your first chance to specify whether the scripts
+% are invoked by default is at configure time.
+% 
+% These values are ignored if the script names are changed; e.g., if you
+% set DVIPSMAKEPK to `foo', what counts is the value of the environment
+% variable/config value `FOO', not the `MAKETEXPK' value.
+% 
+% MAKETEXTEX = 0
+% MAKETEXPK = 0
+% MAKETEXMF = 0
+% MAKETEXTFM = 0
+
+% What MetaPost runs to make MPX files.  This is passed an option -troff
+% if MP is in troff mode.  Set to `0' to disable this feature.
+MPXCOMMAND = makempx
+
+
+%  Part 3: Array and other sizes for TeX (and Metafont and MetaPost).
+% 
+% If you want to change some of these sizes only for a certain TeX
+% variant, the usual dot notation works, e.g.,
+% main_memory.hugetex = 20000000
+% 
+% If a change here appears to be ignored, try redumping the format file.
+
+% Memory. Must be less than 8,000,000 total.
+% 
+% main_memory is relevant only to initex, extra_mem_* only to non-ini.
+% Thus, have to redump the .fmt file after changing main_memory; to add
+% to existing fmt files, increase extra_mem_*.  (To get an idea of how
+% much, try \tracingstats=2 in your TeX source file;
+% web2c/tests/memtest.tex might also be interesting.)
+% 
+% To increase space for boxes (as might be needed by, e.g., PiCTeX),
+% increase extra_mem_bot.
+% 
+% For some xy-pic samples, you may need as much as 700000 words of memory.
+% For the vast majority of documents, 60000 or less will do.
+% 
+main_memory = 263000 % words of inimemory available; also applies to inimf&mp
+extra_mem_top = 0    % extra high memory for chars, tokens, etc.
+extra_mem_bot = 0    % extra low memory for boxes, glue, breakpoints, etc.
+
+% Words of font info for TeX (total size of all TFM files, approximately). 
+font_mem_size = 100000
+
+% Total number of fonts. Must be >= 50 and <= 2000 (without tex.ch changes).
+font_max = 500
+
+% Extra space for the hash table of control sequences (which allows 10K
+% names as distributed).
+hash_extra = 0
+
+% Max number of characters in all strings, including all error messages,
+% help texts, font names, control sequences.  These values apply to TeX and MP.
+pool_size = 125000		
+% Minimum pool space after TeX/MP's own strings; must be at least
+% 25000 less than pool_size, but doesn't need to be nearly that large.
+string_vacancies = 25000
+max_strings = 15000		% max number of strings
+pool_free = 5000		% min pool space left after loading .fmt
+
+% Hyphenation trie. As distributed, the maximum is 65535; this should
+% work unless `unsigned short' is not supported or is smaller than 16
+% bits.  This value should suffice for UK English, US English, French,
+% and German (for example).  To increase, you must change
+% `ssup_trie_opcode' and `ssup_trie_size' in tex.ch (and rebuild TeX);
+% the trie will then consume four bytes per entry, instead of two.
+% 
+% US English, German, and Portuguese: 30000.
+% German: 14000.
+% US English: 10000.
+% 
+trie_size = 64000
+
+hyph_size = 1000        % number of hyphenation exceptions, >610 and <32767.
+buf_size = 3000		% max length of input lines or control sequence names
+nest_size = 100		% simultaneous semantic levels (e.g., groups)
+max_in_open = 15	% simultaneous input files and error insertions
+param_size = 500	% simultaneous macro parameters
+save_size = 4000	% for saving values outside current group
+stack_size = 300	% simultaneous input sources
+
+% These work best if they are the same as the I/O buffer size, but it
+% doesn't matter much.  Must be a multiple of 8.
+dvi_buf_size = 16384 % TeX
+gf_buf_size = 16384  % MF
+
+% It's probably inadvisable to change these. At any rate, we must have:
+% 45 < error_line      < 255;
+% 30 < half_error_line < error_line - 15;
+%      max_print_line  < 60 ;
+% These apply to Metafont and MetaPost as well.
+error_line = 79
+half_error_line = 50
+max_print_line = 79
new file mode 100644
--- /dev/null
+++ b/kpathsea/tilde.c
@@ -0,0 +1,141 @@
+/* tilde.c: Expand user's home directories.
+
+Copyright (C) 1993, 95, 96, 97 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/tilde.h>
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+
+/* If NAME has a leading ~ or ~user, Unix-style, expand it to the user's
+   home directory, and return a new malloced string.  If no ~, or no
+   <pwd.h>, just return NAME.  */
+
+string
+kpse_tilde_expand P1C(const_string, name)
+{
+  const_string expansion;
+  const_string home;
+  
+  assert (name);
+  
+  /* If no leading tilde, do nothing.  */
+  if (*name != '~') {
+    expansion = name;
+  
+  /* If a bare tilde, return the home directory or `.'.  (Very unlikely
+     that the directory name will do anyone any good, but ...  */
+  } else if (name[1] == 0) {
+    expansion = xstrdup (getenv ("HOME"));
+    if (!expansion) {
+      expansion = xstrdup (".");
+    }
+  
+  /* If `~/', remove any trailing / or replace leading // in $HOME.
+     Should really check for doubled intermediate slashes, too.  */
+  } else if (IS_DIR_SEP (name[1])) {
+    unsigned c = 1;
+    home = getenv ("HOME");
+    if (!home) {
+      home = ".";
+    }
+    if (IS_DIR_SEP (*home) && IS_DIR_SEP (home[1])) {  /* handle leading // */
+      home++;
+    }
+    if (IS_DIR_SEP (home[strlen (home) - 1])) {        /* omit / after ~ */
+      c++;
+    }
+    expansion = concat (home, name + c);
+  
+  /* If `~user' or `~user/', look up user in the passwd database (but
+     OS/2 doesn't have this concept.  */
+  } else
+#ifdef HAVE_PWD_H
+    {
+      struct passwd *p;
+      string user;
+      unsigned c = 2;
+      while (!IS_DIR_SEP (name[c]) && name[c] != 0) /* find user name */
+        c++;
+      
+      user = (string) xmalloc (c);
+      strncpy (user, name + 1, c - 1);
+      user[c - 1] = 0;
+      
+      /* We only need the cast here for (deficient) systems
+         which do not declare `getpwnam' in <pwd.h>.  */
+      p = (struct passwd *) getpwnam (user);
+      free (user);
+
+      /* If no such user, just use `.'.  */
+      home = p ? p->pw_dir : ".";
+      if (IS_DIR_SEP (*home) && IS_DIR_SEP (home[1])) { /* handle leading // */
+        home++;
+      }
+      if (IS_DIR_SEP (home[strlen (home) - 1]) && name[c] != 0)
+        c++; /* If HOME ends in /, omit the / after ~user. */
+
+      expansion = name[c] == 0 ? xstrdup (home) : concat (home, name + c);
+    }
+#else /* not HAVE_PWD_H */
+    expansion = name;
+#endif /* not HAVE_PWD_H */
+
+  /* We may return the same thing as the original, and then we might not
+     be returning a malloc-ed string.  Callers beware.  Sorry.  */
+  return (string) expansion;
+}
+
+#ifdef TEST
+
+void
+test_expand_tilde (const_string filename)
+{
+  string answer;
+  
+  printf ("Tilde expansion of `%s':\t", filename ? filename : "(null)");
+  answer = kpse_tilde_expand (filename);
+  puts (answer);
+}
+
+int
+main ()
+{
+  string tilde_path = "tilde";
+
+  test_expand_tilde ("");
+  test_expand_tilde ("none");
+  test_expand_tilde ("~root");
+  test_expand_tilde ("~");
+  test_expand_tilde ("foo~bar");
+  
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+standalone-compile-command: "gcc -g -I. -I.. -DTEST tilde.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/tilde.h
@@ -0,0 +1,31 @@
+/* tilde.h: Declare tilde expander.
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_TILDE_H
+#define KPATHSEA_TILDE_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+
+/* Replace a leading ~ or ~name in FILENAME with getenv ("HOME") or
+   name's home directory, respectively.  FILENAME may not be null.  */
+
+extern string kpse_tilde_expand P1H(const_string filename);
+
+#endif /* not KPATHSEA_TILDE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/truncate.c
@@ -0,0 +1,57 @@
+/* truncate.c: truncate too-long components in a filename.
+
+Copyright (C) 1993, 95 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-namemx.h>
+#include <kpathsea/c-pathch.h>
+#include <kpathsea/c-pathmx.h>
+#include <kpathsea/truncate.h>
+
+
+/* Truncate any too-long components in NAME, returning the result.  It's
+   too bad this is necessary.  See comments in readable.c for why.  */
+
+string
+kpse_truncate_filename P1C(const_string, name)
+{
+  unsigned c_len = 0;        /* Length of current component.  */
+  unsigned ret_len = 0;      /* Length of constructed result.  */
+  
+  /* Allocate enough space.  */
+  string ret = (string) xmalloc (strlen (name) + 1);
+
+  for (; *name; name++)
+    {
+      if (IS_DIR_SEP (*name) || IS_DEVICE_SEP (*name))
+        { /* At a directory delimiter, reset component length.  */
+          c_len = 0;
+        }
+      else if (c_len > NAME_MAX)
+        { /* If past the max for a component, ignore this character.  */
+          continue;
+        }
+
+      /* Copy this character.  */
+      ret[ret_len++] = *name;
+      c_len++;
+    }
+  ret[ret_len] = 0;
+
+  return ret;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/truncate.h
@@ -0,0 +1,30 @@
+/* truncate.h: truncate too-long components in a filename.
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_TRUNCATE_H
+#define KPATHSEA_TRUNCATE_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+/* Truncate any component in NAME longer than the system NAME_MAX, and
+   return the result as a malloced string.  If none, return a copy of
+   NAME.  */
+extern string kpse_truncate_filename P1H(const_string name);
+
+#endif /* not KPATHSEA_TRUNCATE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/types.h
@@ -0,0 +1,53 @@
+/* types.h: general types.
+
+Copyright (C) 1993, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_TYPES_H
+#define KPATHSEA_TYPES_H
+
+/* Booleans.  */
+#ifdef __cplusplus
+/* `true' and `false' are reserved words in C++.  Sigh.  Although sizeof
+   (bool) may not equal sizeof (boolean), so this isn't completely
+   correct, we never rely on the size of the type.  */
+#define boolean bool
+#else
+/* NeXT wants to define their own boolean type.  */
+#ifndef HAVE_BOOLEAN
+#define HAVE_BOOLEAN
+typedef enum { false = 0, true = 1 } boolean;
+#endif /* not HAVE_BOOLEAN */
+#endif /* not C++ */
+
+/* The X library (among other things) defines `FALSE' and `TRUE', and so
+   we only want to define them if necessary, for use by application code.  */
+#ifndef FALSE
+#define FALSE false
+#define TRUE true
+#endif /* FALSE */
+
+/* The usual null-terminated string.  */
+typedef char *string;
+
+/* A pointer to constant data.  (ANSI says `const string' is
+   `char * const', which is a constant pointer to non-constant data.)  */
+typedef const char *const_string;
+
+/* A generic pointer.  */
+typedef void *address;
+
+#endif /* not KPATHSEA_TYPES_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/unixtex.texi
@@ -0,0 +1,267 @@
+@ifclear version
+@defcodeindex fl
+@defcodeindex op
+@end ifclear
+
+@node unixtex.ftp
+@section @file{unixtex.ftp}: Obtaining @TeX{}
+
+@cindex obtaining @TeX{}
+@cindex retrieving @TeX{}
+
+@flindex unixtex.ftp
+@flindex tug.cs.umb.edu
+@flindex www.tug.org
+@flindex ftp.tug.org
+This
+@iftex
+chapter
+@end iftex
+is @url{ftp://ftp.tug.org/tex/unixtex.ftp}, last updated 1 February
+1997.  Also available as @url{http://www.tug.org/unixtex.ftp}.  The IP
+address is currently [158.121.106.10], and the canonical host name is
+currently @samp{tug.cs.umb.edu}.  It is also in Kpathsea source
+distributions as @file{etc/unixtex.ftp} (although the network version is
+usually newer).  Mail @email{kb@@mail.tug.org} with comments or
+questions.
+
+Following are general instructions for Unix or other sites who wish to
+acquire the Web2c distribution, (plain) @TeX{}, La@TeX{} (2e),
+Bib@TeX{}, Metafont, MetaPost, DVI processors for the X window system,
+PostScript, the PCL language in the HP LaserJet, and related programs.
+They are oriented towards building from the original sources, though
+some information on alternative packages is included in the last
+section.  See also @url{http://www.tug.org/web2c}, the Web2c and
+Kpathsea home page.
+
+Please consider joining the @TeX{} Users Group (TUG) to help support the
+maintenance and development of the programs you retrieve.  Email
+@email{tug@@tug.org} or see @url{http://www.tug.org} for information and
+a membership form.
+
+For actual installation instructions after obtaining the necessary
+sources, @pxref{Installation}.  A copy is in the distribution file
+@file{kpathsea/INSTALL}.
+
+@menu
+* Electronic distribution::  CTAN and so forth.
+* CD-ROM distribution::
+* Tape distribution::
+* Other TeX packages::
+@end menu
+
+
+@node Electronic distribution
+@subsection Electronic distribution
+
+@cindex ftp retrieval
+@cindex obtaining Web2c by ftp
+@cindex distributions, via ftp
+
+@cindex CTAN, defined
+@cindex backbone of CTAN
+In many places we refer to @var{CTAN:}.  This is @emph{both} a host name
+and a directory name.  Here are some primary locations:
+
+@example
+@url{ftp://ftp.cdrom.com/pub/tex/ctan}  @r{(California, USA)}
+@url{ftp://ftp.dante.de/tex-archive}    @r{(Germany)}
+@url{ftp://ftp.tex.ac.uk/tex-archive}   @r{(England)}
+@end example
+
+@noindent
+@flindex README.mirrors
+@flindex CTAN.sites
+@cindex mirrors, FTP
+CTAN has many mirrors worldwide; see the top-level file
+@file{README.mirrors} from one of the sites above, or finger
+@email{ctan@@ftp.tug.org}, or see @url{http://www.tug.org/CTAN.sites}.
+A list current as of the time of distribution is in the top-level file
+@file{./MIRROR}.
+
+@cindex World Wide Web CTAN access
+@cindex Gopher CTAN access
+@cindex email CTAN access
+@cindex NFS CTAN access
+You can also access CTAN via the World Wide Web, Gopher, electronic
+mail, or NFS.  The same @file{README.mirrors} file explains how.
+
+@cindex binary mode, for file transfers
+You will need to retrieve some or all of the following archives,
+depending on your needs (don't forget to set binary mode for file
+transfers):
+
+@table @asis
+@item @file{@var{CTAN:}/systems/web2c/lib.tar.gz}
+A basic collection of fonts (TFM files only) and macro packages
+(including Texinfo and La@TeX{} 2e).  It unpacks into @file{texmf/}; if
+you change the structure of this hierarchy, you will also have to change
+the default search paths (@pxref{Changing search paths}).  It is
+required unless you already have these files, in which case you should
+change the default paths as necessary to find them.
+
+@item @file{@var{CTAN:}/systems/web2c/web.tar.gz}
+@cindex Knuth, Donald E., original author
+The original WEB source files, written mostly by Don Knuth.  Required
+unless you already have this @file{web} version.  (The WEB sources
+change irregularly with respect to Web2c itself.)  Unpacks into
+@file{web2c-@var{version}}.
+
+@item @file{@var{CTAN:}/systems/web2c/web2c.tar.gz}
+The Web2c system.  Required.  Also unpacks into
+@file{web2c-@var{version}}.
+
+@c @item @file{@var{CTAN:}/systems/web2c/psfonts.tar.gz}
+@c Metrics, outlines, and bitmaps (for previewing) for the 35 de facto
+@c standard fonts donated by URW and the additional high-quality freely
+@c available PostScript fonts donated by Adobe, Bitstream, and URW,
+@c including geometrically-created variants such as oblique and small
+@c caps.  Unpacks into @file{texmf}.  Necessary for PostScript printing or
+@c previewing support.
+
+@item @file{@var{CTAN:}/dviware/dvipsk.tar.gz}
+DVI-to-PostScript translator.  Unpacks into @file{dvipsk-@var{version}}.
+Optional.
+
+@item @file{@var{CTAN:}/dviware/xdvik.tar.gz}
+X window system DVI previewer.  Unpacks into @file{xdvik-@var{version}}.
+Optional.
+
+@item @file{@var{CTAN:}/dviware/dviljk.tar.gz}
+DVI-to-PCL (HP LaserJet) translator.  Unpacks into
+@file{dviljk-@var{version}}.  Optional.
+@end table
+
+All that said, the originating host for the software above is
+@file{ftp.tug.org}.  You can retrieve these distributions (but not much
+else) from the @file{tex/} directory on that host.
+
+
+@node CD-ROM distribution
+@subsection CD-ROM distribution
+
+@cindex CD-ROM distributions
+@cindex obtaining Web2c on CD-ROM
+@cindex distributions, on CD-ROM
+
+Numerous organizations distribute various @TeX{} CD-ROM's:
+
+@itemize @bullet
+@item
+@cindex @TeX{} Live CD-ROM
+@cindex TUG
+@cindex UKTUG
+@cindex GUTenberg
+TUG, UK TUG, and GUTenberg (French-speaking @TeX{} user group)
+collaborated to produce the @cite{@TeX{} Live} CD-ROM, based on
+te@TeX{}, which in turn is based on Web2c; email
+@email{tex-live@@mail.tug.org} or see
+@url{http://www.tug.org/tex-live.html}.
+
+@item
+@cindex 4all@TeX{} Live CD-ROM
+@cindex NTG
+NTG (Dutch-speaking @TeX{} user group) produced the 4all@TeX{} CD-ROM;
+email @email{ntg@@nic.surfnet.nl}, or see
+@url{http://ei0.ei.ele.tue.nl/ntg/}.  This is a runnable system.
+
+@item
+@cindex Free Software Foundation
+@cindex FSF Source Code CD-ROM
+The Free Software Foundation's @cite{Source Code CD-ROM} contains the
+minimal @TeX{} source distribution described in the previous section
+(i.e., enough to print GNU documentation); email
+@email{gnu@@prep.ai.mit.edu} or finger @email{fsf@@prep.ai.mit.edu}.
+
+@item
+The Gateway@! CD-ROM set contains a runnable NetBSD/Amiga distribution
+and sources; see @url{http://www.netbsd.org/Sites/cdroms.html}.
+
+@item
+@cindex Prime Time @TeX{}cetera CD-ROM
+The Prime Time @TeX{}cetera CD-ROM is a copy of CTAN (see the previous
+section); email @email{ptf@@ctcl.com} or see
+@url{http://www.ptf.com/ptf/}.
+
+@item
+@cindex Walnut Creek @TeX{} CD-ROM
+Walnut Creek's @TeX{} CD-ROM is also a copy of CTAN; email
+@email{info@@cdrom.com} or see
+@url{http://www.cdrom.com:/titles/tex.html}.
+
+@item
+@cindex Linux, using Web2c
+Most Linux distributions include some @TeX{} package based on
+Web2c; see the Linux documentation file @samp{Distribution-HOWTO} for a
+comparison of Linux distributions, available (for example) via
+@url{http://www.linux.org}.
+@end itemize
+
+If you know of additional @TeX{} CD-ROM distributions to add to this
+list, please inform @email{kb@@mail.tug.org}.
+
+
+@node Tape distribution
+@subsection Tape distribution
+
+@cindex tape distribution
+@cindex obtaining @TeX{} on tape
+@cindex distributions, on tape
+
+@cindex Northwest Computing Support Center
+@flindex unixtex@@u.washington.edu
+@cindex support organization
+You can obtain a complete @TeX{} distribution, including Web2c, on tape.
+Contact:
+@display
+Pierre MacKay / Denny Hall, Mail Stop DH-10 / Department of Classics
+University of Washington / Seattle, WA 98195 / USA
+phone: 206-543-2268; email: @email{unixtex@@u.washington.edu}
+@end display
+
+At this writing, the distribution is available in @code{tar} format on
+1/4 inch 4-track QIC-24 cartridges and 4@dmn{mm} DAT cartridges, and the
+cost is US$210.  Make checks payable to the University of Washington,
+drawn on a U.S. bank.  Purchase orders are acceptable, but they carry an
+extra charge of $10 to pay for invoice processing.  Overseas sites,
+please add $20 for shipment via air parcel post, or $30 for shipment via
+courier.
+
+
+@node Other TeX packages
+@subsection Other @TeX{} packages
+
+@cindex other @TeX{} distributions
+@cindex @TeX{} distributions besides Web2c
+
+@cindex Amiga @TeX{} implementations
+@cindex Acorn @TeX{} implementations
+@cindex VMS @TeX{} implementations
+@cindex Macintosh @TeX{} implementations
+@cindex DOS @TeX{} implementations
+@cindex Windows @TeX{} implementations
+Many other @TeX{} implementations are available in
+@file{@var{CTAN:}/systems}, including ready-to-run distributions for
+Unix, Amiga, Acorn, VMS, Macintosh, DOS, and Windows (in various forms).
+Although Web2c has support in the source code for many operating
+systems, and in fact some of the other distributions are based on it,
+it's unlikely to work as distributed on anything but Unix.  (Please
+contribute improvements!)
+
+@cindex te@TeX{}
+@cindex precompiled Unix binaries
+The Unix distribution alluded to above is the te@TeX{} distribution.
+This includes both complete sources and precompiled binaries for many
+popular Unix variants, including Linux. It is based on Web2c, and
+contains many other @TeX{}-related programs as well.
+
+@flindex labrea.stanford.edu
+@cindex Knuth, Donald E., archive of programs by
+The host @t{labrea.stanford.edu} is the original source for the files
+for which Donald Knuth is directly responsible: @file{tex.web},
+@file{plain.tex}, etc. However, unless you want to build your @TeX{}
+library tree ab initio, it is more reliable and less work to retrieve
+these files as part of the above packages. In any case, @t{labrea} is
+not the canonical source for anything except what was created by
+Stanford @TeX{} project, so do not rely on all the files available at
+that ftp site being up-to-date.
new file mode 100644
--- /dev/null
+++ b/kpathsea/uppercasify.c
@@ -0,0 +1,36 @@
+/* uppercasify.c: change all lowercase letters to uppercase.
+
+Copyright (C) 1993 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-ctype.h>
+
+
+string
+uppercasify P1C(const_string, s)
+{
+  string target;
+  string ret = xstrdup (s);
+  
+  for (target = ret; *target; target++)
+    {
+      *target = TOUPPER (*target);
+    }
+  
+  return ret;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/variable.c
@@ -0,0 +1,243 @@
+/* variable.c: variable expansion.
+
+Copyright (C) 1993, 94, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/c-ctype.h>
+#include <kpathsea/cnf.h>
+#include <kpathsea/fn.h>
+#include <kpathsea/variable.h>
+
+
+/* Here's the simple one, when a program just wants a value.  */
+
+string
+kpse_var_value P1C(const_string, var)
+{
+  string ret = getenv (var);
+
+  if (!ret)
+    ret = kpse_cnf_get (var);
+  
+  if (ret)
+    ret = kpse_var_expand (ret);
+
+  return ret;
+}
+
+/* We have to keep track of variables being expanded, otherwise
+   constructs like TEXINPUTS = $TEXINPUTS result in an infinite loop.
+   (Or indirectly recursive variables, etc.)  Our simple solution is to
+   add to a list each time an expansion is started, and check the list
+   before expanding.  */
+
+typedef struct {
+  const_string var;
+  boolean expanding;
+} expansion_type;
+static expansion_type *expansions; /* The sole variable of this type.  */
+static unsigned expansion_len = 0;
+
+static void
+expanding P2C(const_string, var,  boolean, xp)
+{
+  unsigned e;
+  for (e = 0; e < expansion_len; e++) {
+    if (STREQ (expansions[e].var, var)) {
+      expansions[e].expanding = xp;
+      return;
+    }
+  }
+
+  /* New variable, add it to the list.  */
+  expansion_len++;
+  XRETALLOC (expansions, expansion_len, expansion_type);
+  expansions[expansion_len - 1].var = xstrdup (var);
+  expansions[expansion_len - 1].expanding = xp;
+}
+
+
+/* Return whether VAR is currently being expanding.  */
+
+static boolean
+expanding_p P1C(const_string, var)
+{
+  unsigned e;
+  for (e = 0; e < expansion_len; e++) {
+    if (STREQ (expansions[e].var, var))
+      return expansions[e].expanding;
+  }
+  
+  return false;
+}
+
+/* Append the result of value of `var' to EXPANSION, where `var' begins
+   at START and ends at END.  If `var' is not set, do not complain.
+   This is a subroutine for the more complicated expansion function.  */
+
+static void
+expand P3C(fn_type *, expansion,  const_string, start,  const_string, end)
+{
+  string value;
+  unsigned len = end - start + 1;
+  string var = xmalloc (len + 1);
+  strncpy (var, start, len);
+  var[len] = 0;
+  
+  if (expanding_p (var)) {
+    WARNING1 ("kpathsea: variable `%s' references itself (eventually)", var);
+  } else {
+    /* Check for an environment variable.  */
+    value = getenv (var);
+
+    /* If no envvar, check the config files.  */
+    if (!value)
+      value = kpse_cnf_get (var);
+
+    if (value) {
+      expanding (var, true);
+      value = kpse_var_expand (value);
+      expanding (var, false);
+      fn_grow (expansion, value, strlen (value));
+      free (value);
+    }
+
+    free (var);
+  }
+}
+
+/* Can't think of when it would be useful to change these (and the
+   diagnostic messages assume them), but ... */
+#ifndef IS_VAR_START /* starts all variable references */
+#define IS_VAR_START(c) ((c) == '$')
+#endif
+#ifndef IS_VAR_CHAR  /* variable name constituent */
+#define IS_VAR_CHAR(c) (ISALNUM (c) || (c) == '_')
+#endif
+#ifndef IS_VAR_BEGIN_DELIMITER /* start delimited variable name (after $) */
+#define IS_VAR_BEGIN_DELIMITER(c) ((c) == '{')
+#endif
+#ifndef IS_VAR_END_DELIMITER
+#define IS_VAR_END_DELIMITER(c) ((c) == '}')
+#endif
+
+
+/* Maybe we should support some or all of the various shell ${...}
+   constructs, especially ${var-value}.  */
+
+string
+kpse_var_expand P1C(const_string, src)
+{
+  const_string s;
+  string ret;
+  fn_type expansion;
+  expansion = fn_init ();
+  
+  /* Copy everything but variable constructs.  */
+  for (s = src; *s; s++) {
+    if (IS_VAR_START (*s)) {
+      s++;
+
+      /* Three cases: `$VAR', `${VAR}', `$<anything-else>'.  */
+      if (IS_VAR_CHAR (*s)) {
+        /* $V: collect name constituents, then expand.  */
+        const_string var_end = s;
+
+        do {
+          var_end++;
+        } while (IS_VAR_CHAR (*var_end));
+
+        var_end--; /* had to go one past */
+        expand (&expansion, s, var_end);
+        s = var_end;
+
+      } else if (IS_VAR_BEGIN_DELIMITER (*s)) {
+        /* ${: scan ahead for matching delimiter, then expand.  */
+        const_string var_end = ++s;
+
+        while (*var_end && !IS_VAR_END_DELIMITER (*var_end))
+          var_end++;
+
+        if (! *var_end) {
+          WARNING1 ("%s: No matching } for ${", src);
+          s = var_end - 1; /* will incr to null at top of loop */
+        } else {
+          expand (&expansion, s, var_end - 1);
+          s = var_end; /* will incr past } at top of loop*/
+        }
+
+      } else {
+        /* $<something-else>: error.  */
+        WARNING2 ("%s: Unrecognized variable construct `$%c'", src, *s);
+        /* Just ignore those chars and keep going.  */
+      }
+    } else
+     fn_1grow (&expansion, *s);
+  }
+  fn_1grow (&expansion, 0);
+          
+  ret = FN_STRING (expansion);
+  return ret;
+}
+
+#ifdef TEST
+
+static void
+test_var (string test, string right_answer)
+{
+  string result = kpse_var_expand (test);
+  
+  printf ("expansion of `%s'\t=> %s", test, result);
+  if (!STREQ (result, right_answer))
+    printf (" [should be `%s']", right_answer);
+  putchar ('\n');
+}
+
+
+int
+main ()
+{
+  test_var ("a", "a");
+  test_var ("$foo", "");
+  test_var ("a$foo", "a");
+  test_var ("$foo a", " a");
+  test_var ("a$foo b", "a b");
+
+  xputenv ("FOO", "foo value");
+  test_var ("a$FOO", "afoo value");
+
+  xputenv ("Dollar", "$");
+  test_var ("$Dollar a", "$ a");
+
+  test_var ("a${FOO}b", "afoo valueb");
+  test_var ("a${}b", "ab");
+
+  test_var ("$$", ""); /* and error */
+  test_var ("a${oops", "a"); /* and error */
+
+  return 0;
+}
+
+#endif /* TEST */
+
+
+/*
+Local variables:
+standalone-compile-command: "gcc -g -I. -I.. -DTEST variable.c kpathsea.a"
+End:
+*/
new file mode 100644
--- /dev/null
+++ b/kpathsea/variable.h
@@ -0,0 +1,42 @@
+/* variable.h: Declare variable expander.
+
+Copyright (C) 1993, 95 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_VARIABLE_H
+#define KPATHSEA_VARIABLE_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+
+/* Return the (variable-expanded) environment variable value or config
+   file value, or NULL.  */
+extern string kpse_var_value P1H(const_string var);
+
+/* Expand $VAR and ${VAR} references in SRC, returning the (always newly
+   dynamically-allocated) result.  An unterminated ${ or any other
+   character following $ produce error messages, and that part of SRC is
+   ignored.  In the $VAR form, the variable name consists of consecutive
+   letters, digits, and underscores.  In the ${VAR} form, the variable
+   name consists of whatever is between the braces.
+   
+   In any case, ``expansion'' means calling `getenv'; if the variable is not
+   set, look in texmf.cnf files for a definition.  If not set there, either,
+   the expansion is the empty string (no error).  */
+extern string kpse_var_expand P1H(const_string src);
+
+#endif /* not KPATHSEA_VARIABLE_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/version.c
@@ -0,0 +1,12 @@
+char *kpathsea_version_string = (char *) "kpathsea version 3.0";
+
+/* If you are redistributing a modified version of my original
+   distribution, please change this address.
+
+   Also change the address in makempx.in, mpto.c, and newer.c in
+   web2c/mpware/, and in dvilj/dvihp.
+
+   Thanks.  --kb@cs.umb.edu  */
+
+char *kpse_bug_address = (char *) 
+  "Email bug reports to tex-k@mail.tug.org.\n";
new file mode 100644
--- /dev/null
+++ b/kpathsea/withenable.ac
@@ -0,0 +1,20 @@
+dnl withenable.ac: --with and --enable options.
+
+AC_ARG_WITH(maketexmf-default,
+[  --without-maketexmf-default  do not run MakeTeXMF if MF source missing],
+  , enableval=yes)
+if test $enableval = yes; then
+  AC_DEFINE(MAKE_TEX_MF_BY_DEFAULT)
+fi
+AC_ARG_WITH(maketexpk-default,
+[  --without-maketexpk-default  do not run MakeTeXPK if PK font missing],
+  , enableval=yes)
+if test $enableval = yes; then
+  AC_DEFINE(MAKE_TEX_PK_BY_DEFAULT)
+fi
+AC_ARG_WITH(maketextfm-default,
+[  --without-maketextfm-default do not run MakeTeXTFM if TFM file missing],
+   , enableval=yes)
+if test $enableval = yes; then
+  AC_DEFINE(MAKE_TEX_TFM_BY_DEFAULT)
+fi
new file mode 100644
--- /dev/null
+++ b/kpathsea/xcalloc.c
@@ -0,0 +1,35 @@
+/* xcalloc.c: calloc with error checking.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+address
+xcalloc P2C(unsigned, nelem,  unsigned, elsize)
+{
+  address new_mem = (address) calloc (nelem, elsize);
+  
+  if (new_mem == NULL)
+    {
+      fprintf (stderr, "xcalloc: request for %u elements of size %u failed.\n",
+               nelem, elsize);
+      abort ();
+    }
+  
+  return new_mem;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xfopen.c
@@ -0,0 +1,47 @@
+/* xfopen.c: fopen and fclose with error checking.
+
+Copyright (C) 1992, 93, 95 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+/* These routines just check the return status from standard library
+   routines and abort if an error happens.  */
+
+FILE *
+xfopen P2C(const_string, filename,  const_string, mode)
+{
+  FILE *f;
+  
+  assert (filename && mode);
+  
+  f = fopen (filename, mode);
+  if (f == NULL)
+    FATAL_PERROR (filename);
+
+  return f;
+}
+
+
+void
+xfclose P2C(FILE *, f,  const_string, filename)
+{
+  assert (f);
+  
+  if (fclose (f) == EOF)
+    FATAL_PERROR (filename);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xfseek.c
@@ -0,0 +1,27 @@
+/* xfseek.c: fseek with error checking.
+
+Copyright (C) 1992, 95 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+void
+xfseek P4C(FILE *, f,  long, offset,  int, wherefrom,  string, filename)
+{
+  if (fseek (f, offset, wherefrom) < 0)
+    FATAL_PERROR (filename);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xftell.c
@@ -0,0 +1,31 @@
+/* xftell.c: ftell with error checking.
+
+Copyright (C) 1992, 93, 95 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+unsigned long
+xftell P2C(FILE *, f,  string, filename)
+{
+  long where = ftell (f);
+
+  if (where < 0)
+    FATAL_PERROR (filename);
+
+  return where;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xgetcwd.c
@@ -0,0 +1,117 @@
+/* xgetcwd.c: a from-scratch version of getwd.  Ideas from the tcsh 5.20
+   source, apparently uncopyrighted.
+
+Copyright (C) 1992, 94, 96 Free Software Foundation, Inc.
+
+This program 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 program 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 program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#ifdef HAVE_GETWD
+#include <kpathsea/c-pathmx.h>
+#else /* not HAVE_GETWD */
+#include <kpathsea/c-dir.h>
+#include <kpathsea/xopendir.h>
+#include <kpathsea/xstat.h>
+
+
+static void
+xchdir P1C(string, dirname)
+{
+  if (chdir (dirname) != 0)
+    FATAL_PERROR (dirname);
+}
+
+#endif /* not HAVE_GETWD */
+
+
+/* Return the pathname of the current directory, or give a fatal error.  */
+
+string
+xgetcwd P1H(void)
+{
+  /* If the system provides getwd, use it.  But don't use getcwd; that
+     forks a process on some systems, which is far more expensive than
+     all the stat calls we make figuring out the cwd.  */
+#ifdef HAVE_GETWD
+  string path = xmalloc (PATH_MAX + 1);
+  
+  if (getwd (path) == 0)
+    {
+      fprintf (stderr, "getwd: %s", path);
+      exit (1);
+    }
+  
+  return path;
+#else /* not HAVE_GETWD */
+  struct stat root_stat, cwd_stat;
+  string cwd_path = xmalloc (2); /* In case we assign "/" below.  */
+  
+  *cwd_path = 0;
+  
+  /* Find the inodes of the root and current directories.  */
+  root_stat = xstat ("/");
+  cwd_stat = xstat (".");
+
+  /* Go up the directory hierarchy until we get to root, prepending each
+     directory we pass through to `cwd_path'.  */
+  while (!SAME_FILE_P (root_stat, cwd_stat))
+    {
+      struct dirent *e;
+      DIR *parent_dir;
+      boolean found = false;
+      
+      xchdir ("..");
+      parent_dir = xopendir (".");
+
+      /* Look through the parent directory for the entry with the same
+         inode, so we can get its name.  */
+      while ((e = readdir (parent_dir)) != NULL && !found)
+        {
+          struct stat test_stat;
+          test_stat = xlstat (e->d_name);
+          
+          if (SAME_FILE_P (test_stat, cwd_stat))
+            {
+              /* We've found it.  Prepend the pathname.  */
+              string temp = cwd_path;
+              cwd_path = concat3 ("/", e->d_name, cwd_path);
+              free (temp);
+              
+              /* Set up to test the next parent.  */
+              cwd_stat = xstat (".");
+              
+              /* Stop reading this directory.  */
+              found = true;
+            }
+        }
+      if (!found)
+        FATAL2 ("No inode %d/device %d in parent directory",
+                cwd_stat.st_ino, cwd_stat.st_dev);
+      
+      xclosedir (parent_dir);
+    }
+  
+  /* If the current directory is the root, cwd_path will be the empty
+     string, and we will have not gone through the loop.  */
+  if (*cwd_path == 0)
+    strcpy (cwd_path, "/");
+  else
+    /* Go back to where we were.  */
+    xchdir (cwd_path);
+
+  return cwd_path;
+#endif /* not HAVE_GETWD */
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xmalloc.c
@@ -0,0 +1,41 @@
+/* xmalloc.c: malloc with error checking.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Don't include config.h or all our other usual includes, since
+   it's useful to just throw this file into other programs.  */
+
+#include <stdio.h>
+extern char *malloc ();
+
+
+void *
+xmalloc (size)
+    unsigned size;
+{
+  void *new_mem = (void *) malloc (size);
+
+  if (new_mem == NULL)
+    {
+      fprintf (stderr, "fatal: memory exhausted (xmalloc of %u bytes).\n",
+               size);
+      /* 1 means success on VMS, so pick a random number (ASCII `K').  */
+      exit (75);
+    }
+
+  return new_mem;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xopendir.c
@@ -0,0 +1,48 @@
+/* xopendir.c: opendir and closedir with error checking.
+
+Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/xopendir.h>
+
+
+#ifndef WIN32
+DIR *
+xopendir P1C(string, dirname)
+{
+  DIR *d = opendir (dirname);
+
+  if (d == NULL)
+    FATAL_PERROR (dirname);
+
+  return d;
+}
+#endif /* not WIN32 */
+
+void
+xclosedir P1C(DIR *, d)
+{
+#ifdef CLOSEDIR_VOID
+  closedir (d);
+#else
+  int ret = closedir (d);
+  
+  if (ret != 0)
+    FATAL ("closedir failed");
+#endif
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xopendir.h
@@ -0,0 +1,30 @@
+/* xopendir.h: Checked directory operations.
+
+Copyright (C) 1994, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#if !defined (KPATHSEA_XOPENDIR_H) && !defined (WIN32)
+#define KPATHSEA_XOPENDIR_H
+
+#include <kpathsea/c-dir.h>
+#include <kpathsea/c-proto.h>
+#include <kpathsea/types.h>
+
+/* Like opendir and closedir, but abort on error.  */
+extern DIR *xopendir P1H(string dirname);
+extern void xclosedir P1H(DIR *);
+
+#endif /* not (KPATHSEA_XOPENDIR_H or WIN32) */
new file mode 100644
--- /dev/null
+++ b/kpathsea/xputenv.c
@@ -0,0 +1,122 @@
+/* xputenv.c: set an environment variable without return.
+
+Copyright (C) 1993, 94, 95, 96 Karl Berry.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#ifdef WIN32
+#include <stdlib.h>
+#else
+/* Avoid implicit declaration warning.  But since some systems do
+   declare it, don't use a prototype, for fear of conflicts.  */
+extern int putenv ();
+#endif /* not WIN32 */
+
+/* This `x' function is different from the others in that it takes
+   different parameters than the standard function; but I find it much
+   more convenient to pass the variable and the value separately.  Also,
+   this way we can guarantee that the environment value won't become
+   garbage.  Also, putenv just overwrites old entries with
+   the new, and we want to reclaim that space -- this may be called
+   hundreds of times on a run.
+   
+   But naturally, some systems do it differently. In this case, it's
+   net2 that is smart and does its own saving/freeing.  configure tries
+   to determine this.  */
+
+void
+xputenv P2C(const_string, var_name,  const_string, value)
+{
+  static const_string *saved_env_items = NULL;
+  static unsigned saved_len;
+  string old_item = NULL;
+  string new_item = concat3 (var_name, "=", value);
+  boolean found = false;
+
+#ifndef SMART_PUTENV
+  /* Check if we have saved anything yet.  */
+  if (!saved_env_items)
+    {
+      saved_env_items = XTALLOC1 (const_string);
+      saved_env_items[0] = var_name;
+      saved_len = 1;
+    }
+  else
+    {
+      /* Check if we've assigned VAR_NAME before.  */
+      unsigned i;
+      unsigned len = strlen (var_name);
+      for (i = 0; i < saved_len && !found; i++)
+        {
+          if (STREQ (saved_env_items[i], var_name))
+            {
+              found = true;
+              old_item = getenv (var_name);
+#ifdef WIN32
+	      /* win32 putenv() removes the variable if called with
+		 "VAR=". So we have to cope with this case. Distinction
+		 is not made between the value being "" or the variable
+		 not set. */
+	      if (old_item)
+		old_item -= (len + 1);
+#else
+              assert (old_item);
+              /* Back up to the `NAME=' in the environment before the
+                 value that getenv returns.  */
+              old_item -= (len + 1);
+#endif
+            }
+        }
+      
+      if (!found)
+        {
+          /* If we haven't seen VAR_NAME before, save it.  Assume it is
+             in safe storage.  */
+          saved_len++;
+          XRETALLOC (saved_env_items, saved_len, const_string);
+          saved_env_items[saved_len - 1] = var_name;
+        }
+    }
+#endif /* not SMART_PUTENV */
+
+  /* As far as I can see there's no way to distinguish between the
+     various errors; putenv doesn't have errno values.  */
+  if (putenv (new_item) < 0)
+    FATAL1 ("putenv (%s) failed", new_item);
+  
+#ifndef SMART_PUTENV
+  /* Can't free `new_item' because its contained value is now in
+     `environ', but we can free `old_item', since it's been replaced.  */
+  if (old_item)
+    free (old_item);
+#endif /* not SMART_PUTENV */
+}
+
+
+/* A special case for setting a variable to a numeric value
+   (specifically, KPATHSEA_DPI).  We don't need to dynamically allocate
+   and free the string for the number, since it's saved as part of the
+   environment value.  */
+
+void
+xputenv_int P2C(const_string, var_name,  int, num)
+{
+  char str[MAX_INT_LENGTH];
+  sprintf (str, "%d", num);
+  
+  xputenv (var_name, str);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xrealloc.c
@@ -0,0 +1,54 @@
+/* xrealloc.c: realloc with error checking.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* Don't include config.h or all our other usual includes, since
+   it's useful to just throw this file into other programs.  */
+
+#include <stdio.h>
+extern char *realloc ();
+
+
+extern void *xmalloc ();
+
+void *
+xrealloc (old_ptr, size)
+    void *old_ptr;
+    unsigned size;
+{
+  void *new_mem;
+
+  if (old_ptr == NULL)
+    new_mem = xmalloc (size);
+  else
+    {
+      new_mem = (void *) realloc (old_ptr, size);
+      if (new_mem == NULL)
+        {
+          /* We used to print OLD_PTR here using %x, and casting its
+             value to unsigned, but that lost on the Alpha, where
+             pointers and unsigned had different sizes.  Since the info
+             is of little or no value anyway, just don't print it.  */
+          fprintf (stderr, "fatal: memory exhausted (realloc of %u bytes).\n",
+                   size);
+          /* 1 means success on VMS, so pick a random number (ASCII `B').  */
+          exit (66);
+        }
+    }
+
+  return new_mem;
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xstat.c
@@ -0,0 +1,52 @@
+/* xstat.c: stat and (maybe) lstat with error checking.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+#include <kpathsea/xstat.h>
+
+
+struct stat
+xstat P1C(const_string, path)
+{
+  struct stat s;
+  
+  if (stat (path, &s) != 0)
+    FATAL_PERROR (path);
+  
+  return s;
+}
+
+
+/* If we don't have symbolic links, lstat is the same as stat, and
+   a #define is made in the include file.  We declare lstat to avoid an
+   implicit declaration warning for development; sigh.  */
+
+#ifdef S_ISLNK
+extern int lstat ();
+struct stat
+xlstat P1C(const_string, path)
+{
+  struct stat s;
+  
+  if (lstat (path, &s) != 0)
+    FATAL_PERROR (path);
+  
+  return s;
+}
+#endif
new file mode 100644
--- /dev/null
+++ b/kpathsea/xstat.h
@@ -0,0 +1,42 @@
+/* xstat.h: stat with error checking.
+
+Copyright (C) 1992, 93, 94 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#ifndef KPATHSEA_XSTAT_H
+#define KPATHSEA_XSTAT_H
+
+#include <kpathsea/c-proto.h>
+#include <kpathsea/c-stat.h>
+#include <kpathsea/types.h>
+
+/* Two files are indistinguishable if they are on the same device
+   and have the same inode.  This checks two stat buffers for that.  Cf.
+   the `same_file_p' routine in file-p.c, declared in kpathlib.h.  */
+#define SAME_FILE_P(s1, s2) \
+  ((s1).st_ino == (s2).st_ino && (s1).st_dev == (s2).st_dev)
+
+/* Does stat(2) on PATH, and aborts if the stat fails.  */
+extern struct stat xstat P1H(const_string path);
+
+/* Ditto, for lstat(2) (except that lstat might not exist).  */
+#ifdef S_ISLNK
+extern struct stat xlstat P1H(const_string path);
+#else
+#define xlstat xstat
+#endif
+
+#endif /* not KPATHSEA_XSTAT_H */
new file mode 100644
--- /dev/null
+++ b/kpathsea/xstrdup.c
@@ -0,0 +1,29 @@
+/* xstrdup.c: strdup with error checking.
+
+Copyright (C) 1992, 93 Free Software Foundation, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <kpathsea/config.h>
+
+
+/* Return a copy of S in new storage.  */
+
+string
+xstrdup P1C(const_string, s)
+{
+  string new_string = (string) xmalloc (strlen (s) + 1);
+  return strcpy (new_string, s);
+}
new file mode 100644
--- /dev/null
+++ b/kpathsea/xt.ac
@@ -0,0 +1,20 @@
+dnl Included by web2c and xdvik to handle --with-x-toolkit.
+
+# This defines --with-x implicitly (which is why we use that package
+# name below), so put it here, so it comes first in the --help output.
+# This reads best.
+AC_PATH_XTRA
+AC_ARG_WITH(x-toolkit,
+  [  --with-x-toolkit=KIT    use a toolkit (KIT=no/yes/xt/athena)],
+[	  case "${withval}" in
+	    y | ye | yes )	val=yes ;;
+	    x | xt )		val=xt  ;;
+	    n | no )		val=no  ;;
+	    a | at | ath | athe | athena ) val=athena ;;
+	    * )
+AC_MSG_WARN([unknown --with-x-toolkit argument \`$withval'; using yes.])
+              val=yes;;
+	  esac
+	  with_x_toolkit=$val
+])
+