summaryrefslogtreecommitdiff
path: root/Build/source/texk/dviljk
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-05-25 12:21:39 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-05-25 12:21:39 +0000
commit53c9cf4361d7d247851dec37a7f9a11a03a25d39 (patch)
tree81a50f1dd0abf14d4a6dd02ee8a08d676014eca4 /Build/source/texk/dviljk
parent3759f97952769186fe30e7b4589c8c90de79120a (diff)
WIN32: build C program replacement for Unix shell script (from Akira's W32TeX)
git-svn-id: svn://tug.org/texlive/trunk@22609 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dviljk')
-rw-r--r--Build/source/texk/dviljk/ChangeLog5
-rw-r--r--Build/source/texk/dviljk/Makefile.am3
-rw-r--r--Build/source/texk/dviljk/Makefile.in227
-rwxr-xr-xBuild/source/texk/dviljk/configure6
-rw-r--r--Build/source/texk/dviljk/configure.ac4
-rw-r--r--Build/source/texk/dviljk/win32/ChangeLog10
-rw-r--r--Build/source/texk/dviljk/win32/Makefile.am27
-rw-r--r--Build/source/texk/dviljk/win32/Makefile.in535
-rw-r--r--Build/source/texk/dviljk/win32/dvihp.c443
-rw-r--r--Build/source/texk/dviljk/win32/mktex.h58
-rw-r--r--Build/source/texk/dviljk/win32/mktexlib.h59
-rw-r--r--Build/source/texk/dviljk/win32/stackenv.c349
-rw-r--r--Build/source/texk/dviljk/win32/stackenv.h46
-rw-r--r--Build/source/texk/dviljk/win32/variables.h23
14 files changed, 1752 insertions, 43 deletions
diff --git a/Build/source/texk/dviljk/ChangeLog b/Build/source/texk/dviljk/ChangeLog
index 94db9765151..18d70bb522d 100644
--- a/Build/source/texk/dviljk/ChangeLog
+++ b/Build/source/texk/dviljk/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-25 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * Makefile.am (SUBDIRS): Add win32 to build C program dvihp
+ from Akira's W32TeX as WIN32 replacements for the shell script.
+
2011-02-15 Peter Breitenlohner <peb@mppmu.mpg.de>
* Makefile.am [WIN32]: Add dvilj6.exe wrapper.
diff --git a/Build/source/texk/dviljk/Makefile.am b/Build/source/texk/dviljk/Makefile.am
index 5db79bef48a..2ae8e49c8a3 100644
--- a/Build/source/texk/dviljk/Makefile.am
+++ b/Build/source/texk/dviljk/Makefile.am
@@ -1,6 +1,6 @@
## Makefile.am for the TeX Live subdirectory texk/dviljk/
##
-## Copyright (C) 2009 - 2011 Peter Breitenlohner <tex-live@tug.org>
+## Copyright (C) 2009-2011 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
ACLOCAL_AMFLAGS = -I ../../m4
@@ -20,6 +20,7 @@ $(libdvilj_a_OBJECTS): $(KPATHSEA_DEPEND)
bin_PROGRAMS = dvilj dvilj2p dvilj4 dvilj4l
if WIN32
+SUBDIRS = win32
bin_PROGRAMS += dvilj6
else !WIN32
dist_bin_SCRIPTS = dvihp
diff --git a/Build/source/texk/dviljk/Makefile.in b/Build/source/texk/dviljk/Makefile.in
index ca5075eadb9..119fad0d1f0 100644
--- a/Build/source/texk/dviljk/Makefile.in
+++ b/Build/source/texk/dviljk/Makefile.in
@@ -145,11 +145,24 @@ SOURCES = $(libdvilj_a_SOURCES) $(dvilj_SOURCES) $(dvilj2p_SOURCES) \
DIST_SOURCES = $(libdvilj_a_SOURCES) $(dvilj_SOURCES) \
$(dvilj2p_SOURCES) $(dvilj4_SOURCES) $(dvilj4l_SOURCES) \
$(dvilj6_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(dist_man1_MANS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
+DIST_SUBDIRS = win32
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -157,6 +170,31 @@ am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
@@ -289,6 +327,7 @@ libdvilj_a_SOURCES = \
tfm.c \
tfm.h
+@WIN32_TRUE@SUBDIRS = win32
@WIN32_FALSE@dist_bin_SCRIPTS = dvihp
dvilj_CPPFLAGS = -DKPATHSEA -DLJ
dvilj_SOURCES = \
@@ -334,7 +373,7 @@ man1_links = \
EXTRA_DIST = dvilj.pod
DISTCLEANFILES = dvilj.ps
all: c-auto.h
- $(MAKE) $(AM_MAKEFLAGS) all-am
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
@@ -636,6 +675,76 @@ uninstall-man1:
echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -646,10 +755,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
-TAGS: $(HEADERS) $(SOURCES) c-auto.in $(TAGS_DEPENDENCIES) \
+TAGS: tags-recursive $(HEADERS) $(SOURCES) c-auto.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
list='$(SOURCES) $(HEADERS) c-auto.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -668,7 +790,7 @@ TAGS: $(HEADERS) $(SOURCES) c-auto.in $(TAGS_DEPENDENCIES) \
fi; \
fi
ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) c-auto.in $(TAGS_DEPENDENCIES) \
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) c-auto.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) c-auto.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -733,6 +855,34 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
@@ -849,21 +999,22 @@ distcleancheck: distclean
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
-check: check-am
+check: check-recursive
all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) c-auto.h
-installdirs:
+installdirs: installdirs-recursive
+installdirs-am:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-installcheck: installcheck-am
+installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -881,77 +1032,77 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
clean-am: clean-binPROGRAMS clean-generic clean-libtool \
clean-noinstLIBRARIES mostlyclean-am
-distclean: distclean-am
+distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-tags
-dvi: dvi-am
+dvi: dvi-recursive
dvi-am:
-html: html-am
+html: html-recursive
html-am:
-info: info-am
+info: info-recursive
info-am:
install-data-am: install-man
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-binPROGRAMS install-dist_binSCRIPTS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-install-html: install-html-am
+install-html: install-html-recursive
install-html-am:
-install-info: install-info-am
+install-info: install-info-recursive
install-info-am:
install-man: install-man1
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
install-pdf-am:
-install-ps: install-ps-am
+install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
-pdf: pdf-am
+pdf: pdf-recursive
pdf-am:
-ps: ps-am
+ps: ps-recursive
ps-am:
@@ -961,14 +1112,16 @@ uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
uninstall-man: uninstall-man1
-.MAKE: all install-am install-data-am install-exec-am install-strip \
- uninstall-am
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ ctags-recursive install-am install-data-am install-exec-am \
+ install-strip tags-recursive uninstall-am
-.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
- clean-binPROGRAMS clean-generic clean-libtool \
- clean-noinstLIBRARIES ctags dist dist-all dist-bzip2 dist-gzip \
- dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
- distclean distclean-compile distclean-generic distclean-hdr \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am am--refresh check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-noinstLIBRARIES ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-lzma \
+ dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \
+ distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
@@ -977,12 +1130,12 @@ uninstall-man: uninstall-man1
install-exec-hook install-html install-html-am install-info \
install-info-am install-man install-man1 install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-binPROGRAMS \
- uninstall-dist_binSCRIPTS uninstall-hook uninstall-man \
- uninstall-man1
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-dist_binSCRIPTS uninstall-hook \
+ uninstall-man uninstall-man1
$(libdvilj_a_OBJECTS): $(KPATHSEA_DEPEND)
diff --git a/Build/source/texk/dviljk/configure b/Build/source/texk/dviljk/configure
index 7d360e40338..3f2adfbf7ea 100755
--- a/Build/source/texk/dviljk/configure
+++ b/Build/source/texk/dviljk/configure
@@ -760,8 +760,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
-CPP
-CPPFLAGS'
+CPP'
# Initialize some variables set by options.
@@ -14289,7 +14288,7 @@ else
fi
-ac_config_files="$ac_config_files Makefile"
+ac_config_files="$ac_config_files Makefile win32/Makefile"
cat >confcache <<\_ACEOF
@@ -15313,6 +15312,7 @@ do
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"c-auto.h") CONFIG_HEADERS="$CONFIG_HEADERS c-auto.h:c-auto.in" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "win32/Makefile") CONFIG_FILES="$CONFIG_FILES win32/Makefile" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
diff --git a/Build/source/texk/dviljk/configure.ac b/Build/source/texk/dviljk/configure.ac
index b66404381ea..1c2fb6f730a 100644
--- a/Build/source/texk/dviljk/configure.ac
+++ b/Build/source/texk/dviljk/configure.ac
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
dnl
-dnl Copyright (C) 2009, 2010 Peter Breitenlohner <tex-live@tug.org>
+dnl Copyright (C) 2009-2011 Peter Breitenlohner <tex-live@tug.org>
dnl
dnl This file is free software; the copyright holder
dnl gives unlimited permission to copy and/or distribute it,
@@ -26,6 +26,6 @@ KPSE_KPATHSEA_FLAGS
KPSE_CHECK_WIN32
AM_CONDITIONAL([WIN32], [test "x$kpse_cv_have_win32" != xno])
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile win32/Makefile])
AC_OUTPUT
diff --git a/Build/source/texk/dviljk/win32/ChangeLog b/Build/source/texk/dviljk/win32/ChangeLog
new file mode 100644
index 00000000000..4d478c3d3f3
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/ChangeLog
@@ -0,0 +1,10 @@
+2011-05-25 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * dvihp.c, mktex.h, mktexlib.h, stackenv.[ch], variables.h:
+ New files from Akira's W32TeX.
+
+ * dvihp.c, stackenv.c: #include <kpathsea/config.h>.
+ * dvihp.c (main): Drop use of getlongname() for 8+3 names.
+ Remove unused variables `dvicopy_log' and `dvilj_log'.
+ Declare almost all strings as const.
+ * mktexlib.h, stackenv.c: Declare mktex_version_string as const. \ No newline at end of file
diff --git a/Build/source/texk/dviljk/win32/Makefile.am b/Build/source/texk/dviljk/win32/Makefile.am
new file mode 100644
index 00000000000..31dd4c58a05
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/Makefile.am
@@ -0,0 +1,27 @@
+## Makefile.am for the TeX Live subdirectory texk/dviljk/win32/
+##
+## Copyright (C) 2011 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+AM_CPPFLAGS = $(KPATHSEA_INCLUDES)
+AM_CFLAGS = $(WARNING_CFLAGS)
+
+# Build WIN32 replacement for Unix shell script.
+bin_PROGRAMS = dvihp
+
+dvihp_SOURCES = \
+ dvihp.c \
+ mktex.h \
+ mktexlib.h \
+ stackenv.c \
+ stackenv.h \
+ variables.h
+
+LDADD = $(KPATHSEA_LIBS)
+dvihp_DEPENDENCIES = $(KPATHSEA_DEPEND)
+
+## Rebuild libkpathsea
+@KPATHSEA_RULE@
+
+EXTRA_DIST = ChangeLog
+
diff --git a/Build/source/texk/dviljk/win32/Makefile.in b/Build/source/texk/dviljk/win32/Makefile.in
new file mode 100644
index 00000000000..d6f133391c8
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/Makefile.in
@@ -0,0 +1,535 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = dvihp$(EXEEXT)
+subdir = win32
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-common.m4 \
+ $(top_srcdir)/../../m4/kpse-kpathsea-flags.m4 \
+ $(top_srcdir)/../../m4/kpse-warnings.m4 \
+ $(top_srcdir)/../../m4/kpse-win32.m4 \
+ $(top_srcdir)/../../m4/libtool.m4 \
+ $(top_srcdir)/../../m4/ltoptions.m4 \
+ $(top_srcdir)/../../m4/ltsugar.m4 \
+ $(top_srcdir)/../../m4/ltversion.m4 \
+ $(top_srcdir)/../../m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/c-auto.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_dvihp_OBJECTS = dvihp.$(OBJEXT) stackenv.$(OBJEXT)
+dvihp_OBJECTS = $(am_dvihp_OBJECTS)
+dvihp_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(dvihp_SOURCES)
+DIST_SOURCES = $(dvihp_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KPATHSEA_DEPEND = @KPATHSEA_DEPEND@
+KPATHSEA_INCLUDES = @KPATHSEA_INCLUDES@
+KPATHSEA_LIBS = @KPATHSEA_LIBS@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AM_CPPFLAGS = $(KPATHSEA_INCLUDES)
+AM_CFLAGS = $(WARNING_CFLAGS)
+dvihp_SOURCES = \
+ dvihp.c \
+ mktex.h \
+ mktexlib.h \
+ stackenv.c \
+ stackenv.h \
+ variables.h
+
+LDADD = $(KPATHSEA_LIBS)
+dvihp_DEPENDENCIES = $(KPATHSEA_DEPEND)
+EXTRA_DIST = ChangeLog
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign win32/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign win32/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+dvihp$(EXEEXT): $(dvihp_OBJECTS) $(dvihp_DEPENDENCIES)
+ @rm -f dvihp$(EXEEXT)
+ $(LINK) $(dvihp_OBJECTS) $(dvihp_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvihp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stackenv.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+
+@KPATHSEA_RULE@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Build/source/texk/dviljk/win32/dvihp.c b/Build/source/texk/dviljk/win32/dvihp.c
new file mode 100644
index 00000000000..ec9ecbfb5dd
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/dvihp.c
@@ -0,0 +1,443 @@
+/* dvihp.c: emulate the dvihp shell script
+
+ Converted to C by Eli Zaretskii <eliz@is.elta.co.il>
+ Adapted to Win32 by Fabrice POPINEAU
+
+ 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 <fcntl.h>
+#ifdef _WIN32
+#include <io.h>
+#endif
+
+#include <kpathsea/kpathsea.h>
+#include "mktex.h"
+#include "stackenv.h"
+
+static const char rcs_id[] =
+ "$Id: dvihp.c,v 1.7 2002/10/06 14:02:09 olaf Exp $";
+static char rcs_revision[] = "$Revision: 1.7 $";
+
+static void usage (void)
+{
+ printf ("Usage: %s [OPTIONS] [DVIFILE[.dvi]].\n\
+ Translate the given DVIFILE to Hewlett-Packard PCL by calling dvicopy\n\
+ and then $DVILJ (dvilj4 by default).\n\
+ In the absence of other options, pipe the PCL to $SPOOL (lpr by default).\n\
+\n\
+ Options are recognized from dvips where possible:\n\
+-A print odd pages\n\
+-B print even pages\n\
+-d # set debug bits to # (see documentation)\n\
+-D # set resolution to #\n\
+-f run as filter\n\
+-l # don't print pages after #\n\
+-m manual feed\n\
+-n # print # pages\n\
+-O #,# set/change paper offset to #,# mm\n\
+-o s output to s instead of spooling\n\
+-p # don't print pages before #\n\
+-Ps pass directly to lpr\n\
+-v verbose operation\n\
+-x # set magnification to #\n\
+\n\
+Other options are passed to the dvilj program.\n\
+\n\
+Email bug reports to tex-k@mail.tug.org.\n", kpse_invocation_name);
+ fflush (stdout);
+}
+
+/* Emulate `rm -f prefix*' */
+
+
+static void rmfiles (char *prefix)
+{
+#ifdef _WIN32
+ /* Win32 doesn't have POSIX dirent functions. */
+ WIN32_FIND_DATA ffd;
+ HANDLE hnd;
+ int go_on;
+ string temp = concat (prefix, "*");
+ string directory = xdirname (prefix);
+
+ pushd (directory);
+ hnd = FindFirstFile(temp, &ffd);
+ go_on = (hnd != INVALID_HANDLE_VALUE);
+ while (go_on) {
+ /* FIXME: can this remove read-only files also, like rm -f does? */
+ DeleteFile(ffd.cFileName);
+ go_on = (FindNextFile(hnd, &ffd) == TRUE);
+ }
+ FindClose(hnd);
+ free(temp);
+ popd ();
+#else /* not _WIN32 */
+ DIR *dp;
+ struct dirent *de;
+ int temp_len = strlen (prefix);
+ string directory = "./";
+ const_string base = xbasename (prefix);
+
+ /* Copy the directory part of PREFIX with the trailing slash, if any. */
+ if (base != prefix)
+ {
+ directory = (string) xmalloc (base - prefix + 1);
+ directory[0] = '\0';
+ strncat (directory, prefix, base - prefix);
+ }
+
+ /* Find matching files and delete them. */
+ if ((dp = opendir (directory)) != 0) {
+ while ((de = readdir (dp)) != 0)
+ {
+ string found = concat (directory, de->d_name);
+
+ if (FILESTRNCASEEQ (found, prefix, temp_len))
+ /* On POSIX-compliant systems, including DJGPP, this will also
+ remove read-only files and empty directories, like rm -f does. */
+ if (remove (found))
+ perror (found);
+ free (found);
+ }
+ }
+#endif /* not _WIN32 */
+}
+
+static void __cdecl output_and_cleanup(int code)
+{
+ /* FIXME : what cleanup should be done ? */
+}
+
+char *progname;
+
+int
+main (int argc, char *argv[])
+{
+ string opt = (string) xmalloc (1);
+ const_string output = "", infile = "";
+ const_string output_opt = " -e";
+ const_string dvilj;
+ const_string spool;
+ const_string tmpdir;
+ const_string spool_opt = "";
+ char template[PATH_MAX];
+ const_string vfless_dvi;
+ int verbose = 0;
+ string cmdline;
+ const_string maybe_spool_cmd = "";
+ const_string space = " ";
+
+ output_and_cleanup_function = output_and_cleanup;
+
+ progname = argv[0];
+ kpse_set_program_name (progname, NULL);
+#ifdef _WIN32
+ setmode(fileno(stdin), _O_BINARY);
+ setmode(fileno(stdout), _O_BINARY);
+ SetConsoleCtrlHandler((PHANDLER_ROUTINE)mt_exit, TRUE);
+#else
+# ifdef SIGINT
+ signal (SIGINT, sigint_handler);
+# endif
+# ifdef SIGQUIT
+ signal (SIGQUIT, sigint_handler);
+# endif
+# ifdef SIGHUP
+ signal (SIGHUP, sigint_handler);
+# endif
+# ifdef SIGTERM
+ signal (SIGTERM, sigint_handler);
+# endif
+#endif
+
+ dvilj = kpse_var_value ("DVILJ");
+ spool = kpse_var_value ("SPOOL");
+ tmpdir = kpse_var_value ("TMPDIR");
+ opt[0] = '\0';
+
+ if(!tmpdir)
+ tmpdir = kpse_var_value ("TMP");
+ if(!tmpdir)
+ tmpdir = kpse_var_value ("TEMP");
+
+ /* Set default values for variables:
+
+ ${DVILJ=dvilj4} the dvilj variant to run
+ ${SPOOL=lpr} used to print an LJ file
+ ${TMPDIR=/tmp} for the dvicopy output */
+ if (!dvilj || !*dvilj)
+ dvilj = "dvilj4";
+ if (!spool || !*spool)
+ {
+#ifdef __DJGPP__
+ /* Feature: if they don't have LPR installed, make the
+ default be to print to the local printer device. */
+ char lpr_path[PATH_MAX];
+ extern char *__dosexec_find_on_path (const char *, char **, char *);
+ extern char **environ;
+
+ if (!__dosexec_find_on_path ("lpr", (char **)0, lpr_path)
+ && !__dosexec_find_on_path ("lpr", environ, lpr_path))
+ spool = "> PRN";
+ else
+#endif
+ spool = "| lpr";
+ }
+
+ if (!tmpdir || !*tmpdir)
+ {
+#ifdef _WIN32
+ tmpdir = "c:/tmp";
+#else
+ tmpdir = "/tmp";
+#endif
+ if (access (tmpdir, R_OK|W_OK) != 0)
+ {
+ mkdir (tmpdir, S_IRWXU);
+ }
+ }
+
+ if (argc <= 1)
+ {
+ fprintf (stderr, "%s: Missing argument(s).\nTry `%s --help' for more information.\n",
+ kpse_invocation_name, kpse_invocation_name);
+ return 0;
+ }
+
+ while (--argc)
+ {
+ char *arg = *++argv;
+
+ if (STREQ (arg, "-help") || STREQ (arg, "--help"))
+ {
+ usage ();
+ return 0;
+ }
+ else if (STREQ (arg, "-version") || STREQ (arg, "--version"))
+ {
+ printf ("%s: (Dviljk 2.6) %s\nThere is NO warranty. This program is public domain.\n",
+ kpse_invocation_name, rcs_revision);
+ return 0;
+ }
+ else if (arg[0] == '-')
+ {
+ string newopt = NULL;
+
+ switch (arg[1])
+ {
+ case 'A': /* -A => -D1 (odd pages) */
+ newopt = concat (opt, " -D1");
+ break;
+ case 'B': /* -B -> -D2 (even pages) */
+ newopt = concat (opt, " -D2");
+ break;
+ case 'd': /* -d => --D (debug) */
+ if (arg[2] == '\0')
+ {
+ argc--;
+ newopt = concat3 (opt, " --D", *++argv);
+ }
+ else
+ newopt = concat3 (opt, " --D", arg + 2);
+ break;
+ case 'D': /* -D => -R (resolution) */
+ argc--;
+ newopt = concat3 (opt, " -R", *++argv);
+ break;
+ case 'f': /* -f (run as filter) */
+ infile = "";
+ output = "-";
+ break;
+ case 'l': /* -l => -t (ending page) */
+ if (arg[2] == '\0')
+ {
+ argc--;
+ newopt = concat3 (opt, " -t", *++argv);
+ }
+ else
+ newopt = concat3 (opt, " -t", arg + 2);
+ break;
+ case 'm': /* -m => -A (manual feed) */
+ newopt = concat (opt, " -A");
+ break;
+ case 'n': /* -n => -p (page count) */
+ if (arg[2] == '\0')
+ {
+ argc--;
+ newopt = concat3 (opt, " -t", *++argv);
+ }
+ else
+ newopt = concat3 (opt, " -t", arg + 2);
+ break;
+ case 'o': /* -o (output file) */
+ {
+ string inbase = xstrdup (xbasename (infile));
+ if (argc == 1 && *inbase)
+ {
+ /* No remaining args, output to foo.lj. */
+ int inbaselen = strlen (inbase);
+
+ if (FILESTRCASEEQ (inbase + inbaselen - 4, ".dvi"))
+ output = strcpy (inbase + inbaselen - 4, ".lj");
+ else
+ {
+#if defined (MSDOS) && defined _PC_NAME_MAX
+ if (pathconf (infile, _PC_NAME_MAX) <= 12)
+ {
+ /* Plain MS-DOS (not Windows 95), can't have
+ more than a single dot in a filename. */
+ char *dot = strchr (inbase, '.');
+
+ if (dot)
+ *dot = '\0';
+ }
+#endif
+ output = concat (inbase, ".lj");
+ free (inbase);
+ }
+ }
+ else if (arg[2] == '\0')
+ {
+ argc--;
+ output = *++argv;
+ }
+ else
+ output = arg + 2;
+ break;
+ }
+ case 'O': /* -O => -x, -y (page offsets) */
+ {
+ int x_len;
+ char *params = arg + 2;
+ char *x;
+
+ if (arg[2] == '\0')
+ {
+ argc--;
+ params = *++argv;
+ }
+
+ x_len = strcspn (params, ",");
+ x = (char *)xmalloc (x_len + 1);
+ x[0] = '\0';
+ strncat (x, params, x_len);
+ if (params[x_len] == ',')
+ x_len++; /* get past the comma, if any */
+ newopt = concatn (opt, " -x", x, " y", params + x_len, NULL);
+ break;
+ }
+ case 'p': /* -p => -f (starting page) */
+ if (arg[2] == '\0')
+ {
+ argc--;
+ newopt = concat3 (opt, " -f", *++argv);
+ }
+ else
+ newopt = concat3 (opt, " -f", arg + 2);
+ break;
+ case 'P': /* -Pprinter */
+ output = "";
+ if (spool[0] == '>') /* direct printing: replace device */
+ spool = concat ("> ", arg[2] ? arg + 2 : *++argv);
+ else
+ spool_opt = concat ("-P", arg[2] ? arg + 2 : *++argv);
+ if (arg[2] == '\0')
+ argc--;
+ break;
+ case 'v': /* verbose */
+ verbose = 1;
+ newopt = concat (opt, " -v");
+ break;
+ case 'x': /* -x => -m (magnification) */
+ if (arg[2] == '\0')
+ {
+ argc--;
+ newopt = concat3 (opt, " -m", *++argv);
+ }
+ else
+ newopt = concat3 (opt, " -m", arg + 2);
+ break;
+ case '-': /* -- => end of options */
+ argc--;
+ infile = *++argv;
+ break;
+ default: /* pass other options through */
+ newopt = concat3 (opt, space, arg);
+ break;
+ }
+
+ if (newopt)
+ {
+ free (opt);
+ opt = newopt;
+ }
+ }
+ else
+ infile = arg;
+ }
+
+ /* Generate temporary filenames. Assumes PID is 5 digits. */
+ sprintf (template, "%s/dvi%5.5d.", tmpdir, getpid ());
+ vfless_dvi = concat (template, "-vf");
+
+ /* Expand VF references.
+ If INFILE is null, this will read standard input.
+ dvilj can't read from a pipe, so always write to a file. */
+ if (verbose)
+ fprintf (stderr, "Running dvicopy %s >%s\n", infile, vfless_dvi);
+
+ /* FIXME: special characters in filenames aren't protected from the shell. */
+ cmdline = concatn ("dvicopy ", infile, " >", vfless_dvi, NULL);
+ if (system (cmdline))
+ {
+ fprintf (stderr, "%s: dvicopy %s failed.\n", progname, infile);
+ return 1;
+ }
+ free (cmdline);
+
+ if (verbose)
+ {
+ struct stat st_buf;
+
+ if (stat (vfless_dvi, &st_buf))
+ perror (vfless_dvi);
+ else /* assume they only want to see the size and timestamp */
+ fprintf (stderr, " %ld %s %s\n",
+ (long)st_buf.st_size, ctime (&st_buf.st_mtime), vfless_dvi);
+ }
+ if (!*output)
+ {
+ output = "-"; /* output to stdout */
+ maybe_spool_cmd = concat (spool, spool_opt);
+ }
+
+ /* Translate DVI to LJ. */
+ cmdline = concatn (dvilj, space, opt, output_opt, output,
+ space, vfless_dvi, space, maybe_spool_cmd, NULL);
+ if (verbose)
+ fprintf (stderr, "Running %s\n", cmdline);
+ if (system (cmdline))
+ {
+ fprintf (stderr, "%s: %s failed.\n", progname, dvilj);
+ return 2;
+ }
+
+ /* rm -f $TMPDIR/dvi$$.* */
+ rmfiles (template);
+
+ return 0;
+}
diff --git a/Build/source/texk/dviljk/win32/mktex.h b/Build/source/texk/dviljk/win32/mktex.h
new file mode 100644
index 00000000000..153598086fe
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/mktex.h
@@ -0,0 +1,58 @@
+/* mktex.h: definitions for mktex lib exports.
+
+Copyright (C) 1997 Fabrice POPINEAU.
+Adapted to MS-DOS/DJGPP by Eli Zaretskii <eliz@is.elta.co.il>.
+
+Time-stamp: <02/12/23 00:33:08 popineau>
+
+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 _MKTEX_H_
+#define _MKTEX_H_
+
+#include "mktexlib.h"
+
+/* Pointer to functions that accept argc and argv[] */
+typedef int (*fp)(int, string*);
+
+typedef struct _program_description {
+ string name;
+ int arg_min;
+ int arg_max;
+ fp prog;
+} program_description;
+
+extern MKTEXDLL int program_number;
+extern MKTEXDLL string progname;
+extern MKTEXDLL char empty_str[];
+extern MKTEXDLL FILE *fout;
+extern MKTEXDLL FILE *fnul;
+extern MKTEXDLL string output;
+extern MKTEXDLL string progname;
+extern MKTEXDLL char tmpdir[];
+extern MKTEXDLL void mktexinit(int, char**);
+extern MKTEXDLL int mktexpk(int, char**);
+extern MKTEXDLL int mktextfm(int, char**);
+extern MKTEXDLL int mktextex(int, char**);
+extern MKTEXDLL int mktexmf(int, char**);
+extern MKTEXDLL int mktexlsr(int, char**);
+extern MKTEXDLL int mktexupdate(int, char**);
+extern MKTEXDLL int mktexmkdir(int, char**);
+extern MKTEXDLL int mktexrmdir(int, char**);
+extern MKTEXDLL int mktexnames(int, char**);
+extern MKTEXDLL int mktex_opt(int, char**, program_description *);
+extern MKTEXDLL program_description makedesc[];
+#endif /* _MKTEX_H_ */
+
diff --git a/Build/source/texk/dviljk/win32/mktexlib.h b/Build/source/texk/dviljk/win32/mktexlib.h
new file mode 100644
index 00000000000..a7ed0741126
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/mktexlib.h
@@ -0,0 +1,59 @@
+#ifndef _MKTEXLIB_H_
+#define _MKTEXLIB_H_
+
+#if defined(WIN32)
+# ifdef MKTEX_DLL
+# ifdef MAKE_MKTEX_DLL
+# define MKTEXDLL __declspec( dllexport)
+# else
+# define MKTEXDLL __declspec( dllimport)
+# endif
+# else
+# define MKTEXDLL
+# endif
+#else /* ! WIN32 */
+# define MKTEXDLL
+# define __cdecl
+#endif
+
+#include <assert.h>
+#ifdef _WIN32
+#include <direct.h>
+#else
+#include <unistd.h>
+#include <signal.h>
+#endif
+#include <stdio.h>
+#include <signal.h>
+#include <errno.h>
+#include <time.h>
+#include <sys/stat.h>
+
+#include <kpathsea/config.h>
+#include <kpathsea/kpathsea.h>
+#include <kpathsea/version.h>
+
+#ifndef _WIN32
+#include <sys/param.h>
+#endif
+
+#ifdef WIN32
+# ifdef mkdir
+# undef mkdir
+# endif
+# define mkdir(p,m) _mkdir(p)
+#else
+//# define FS_CASE_SENSITIVE _FILESYS_CASE_SENSITIVE
+typedef unsigned int DWORD;
+#endif
+
+/* gsftopk defines KPSE_LAST_DEBUG+2, so avoid clashes */
+#define MKTEX_DEBUG (KPSE_LAST_DEBUG + 3)
+#define MKTEX_FINE_DEBUG (KPSE_LAST_DEBUG + 4)
+
+
+#define LAST_CHAR(s) (*((s)+strlen(s)-1))
+
+extern MKTEXDLL const_string mktex_version_string;
+
+#endif /* _MKTEXLIB_H_ */
diff --git a/Build/source/texk/dviljk/win32/stackenv.c b/Build/source/texk/dviljk/win32/stackenv.c
new file mode 100644
index 00000000000..e91a72a63fd
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/stackenv.c
@@ -0,0 +1,349 @@
+/* stackenv.c: routines that help to mimic shell scripts.
+
+Copyright (C) 1997 Fabrice POPINEAU.
+
+Adapted to DJGPP by Eli Zaretskii.
+
+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 __MINGW32__
+#define fcloseall _fcloseall
+#define flushall _flushall
+#endif
+#include <kpathsea/kpathsea.h>
+#include "stackenv.h"
+#include "variables.h"
+const_string mktex_version_string = "2.0";
+
+extern char *output;
+extern char tmpdir[];
+extern char *progname;
+
+/* The global stack. */
+static mod_env stack_env[256];
+static int index_env = 0;
+
+void mt_exit(int);
+
+static FILE *fnul = NULL;
+
+pfnOutputAndCleanup output_and_cleanup_function;
+
+#ifndef _WIN32
+#include <unistd.h>
+
+static void flushall (void)
+{
+ /* Simulate `flushall' by only flushing standard streams.
+ This should be enough, since the non-standard are going
+ to be closed in a moment, and will be flushed then. */
+ fflush (stdout);
+ fsync (fileno (stdout));
+ fflush (stderr);
+ fsync (fileno (stderr));
+}
+#endif
+
+#ifndef _WIN32
+#ifdef __DJGPP__
+
+/* DJGPP-specific emulation of functions which aren't in the library
+ and aren't ANSI/POSIX. */
+
+#include <errno.h>
+#include <libc/file.h>
+
+static void fcloseall_func (FILE *f)
+{
+ fflush (f);
+ if (fileno (f) > 2)
+ fclose(f);
+ else
+ fsync (fileno (f));
+}
+
+void fcloseall (void)
+{
+ _fwalk (fcloseall_func);
+}
+
+#else /* not __DJGPP__ */
+
+/* FIXME: is this enough on Unix? */
+static void fcloseall (void)
+{
+ flushall ();
+}
+
+#endif /* not __DJGPP__ */
+#endif /* not _WIN32 */
+
+void
+oops(const char *message, ...)
+{
+ va_list args;
+
+ va_start(args, message);
+ vfprintf(stderr, message, args);
+ va_end(args);
+ fputc('\n', stderr);
+ mt_exit(1);
+}
+
+/* pushd */
+void pushd(char *p)
+{
+ if (index_env >= sizeof(stack_env)/sizeof(stack_env[0])) {
+ fprintf(stderr, "%s: stack overflow in pushd\n", progname);
+ mt_exit(1);
+ }
+ if ((stack_env[index_env].data.path = malloc(MAXPATHLEN)) == NULL
+ || getcwd(stack_env[index_env].data.path, MAXPATHLEN) == NULL) {
+ fprintf(stderr, "pushd error!\n");
+ mt_exit(1);
+ }
+ stack_env[index_env].op = CHDIR;
+ if (KPSE_DEBUG_P(MKTEX_FINE_DEBUG)) {
+ fprintf(stderr, "At %d, pushing from %s to %s\n", index_env,
+ stack_env[index_env].data.path, p);
+ }
+
+ index_env++;
+ if (chdir(p) == -1) {
+ perror(p);
+ mt_exit(1);
+ }
+}
+/* popd */
+void popd(void)
+{
+ if (index_env == 0)
+ return;
+ index_env--;
+ if (KPSE_DEBUG_P(MKTEX_FINE_DEBUG)) {
+ fprintf(stderr, "At %d, popping %s\n", index_env, stack_env[index_env].data.path);
+ }
+ assert(stack_env[index_env].op == CHDIR);
+ if (chdir(stack_env[index_env].data.path) == -1) {
+ perror(stack_env[index_env].data.path);
+ mt_exit(1);
+ }
+ free(stack_env[index_env].data.path);
+ return;
+}
+
+/* random access to directories' stack */
+char *peek_dir(int n)
+{
+ int i;
+ int level = n;
+
+ /* The stack holds both directories pushed by `pushd' and file
+ handles pushed by `push_fd'. When they say "peek_dir(n)", they
+ mean the n'th DIRECTORY entry, not the n'th entry counting from
+ the stack bottom.
+
+ For example, if the stack looks like this:
+
+ idx type
+
+ 0 handles
+ 1 handles
+ 2 directory
+ 3 handles <--- top of the stack
+ 4 <empty> <--- index_env
+
+ then "peek_dir(0)" should return the entry with the index 2, not
+ the one with the index 0.
+
+ The following loop looks for the index i of a stack slot which
+ holds the n'th directory pushed on to the stack. */
+
+ do {
+ for (i = 0; i < index_env && stack_env[i].op != CHDIR; i++)
+ ;
+ } while (i < index_env && n--);
+
+ if (i < index_env)
+ return stack_env[i].data.path;
+ else {
+ fprintf (stderr, "%s: attempt to peek at invalid stack level %d\n",
+ progname, level);
+ mt_exit(1);
+ }
+}
+
+/* redirect */
+void push_fd(int newfd[3])
+{
+ int i;
+
+ if (KPSE_DEBUG_P(MKTEX_FINE_DEBUG)) {
+ fprintf(stderr, "At %d, pushing fds %d %d %d\n", index_env, newfd[0],
+ newfd[1], newfd[2]);
+ }
+ flushall();
+ if (index_env >= sizeof(stack_env)/sizeof(stack_env[0])) {
+ fprintf(stderr, "%s: stack overflow in push_fd\n", progname);
+ mt_exit(1);
+ }
+ stack_env[index_env].op = REDIRECT;
+ for(i = 0; i < 3; i++) {
+ if (i == newfd[i])
+ stack_env[index_env].data.oldfd[i] = i;
+ else {
+ if ((stack_env[index_env].data.oldfd[i] = dup(i)) == -1) {
+ perror("push_fd: dup");
+ mt_exit(1);
+ }
+ if (dup2(newfd[i], i) == -1) {
+ perror("push_fd : dup2");
+ mt_exit(1);
+ }
+ }
+ }
+ index_env++;
+}
+
+void pop_fd(void)
+{
+ int i;
+ index_env--;
+ assert(stack_env[index_env].op == REDIRECT);
+ if (KPSE_DEBUG_P(MKTEX_FINE_DEBUG)) {
+ fprintf(stderr, "At %d; popping fds %d %d %d\n",
+ index_env,
+ stack_env[index_env].data.oldfd[0],
+ stack_env[index_env].data.oldfd[1],
+ stack_env[index_env].data.oldfd[2]);
+ }
+ flushall();
+ for(i = 0; i < 3; i++)
+ if (i != stack_env[index_env].data.oldfd[i]) {
+ if (fnul && i != fileno(fnul)) close(i);
+ if (dup2(stack_env[index_env].data.oldfd[i], i) == -1) {
+ perror("pop_fd : dup2");
+ mt_exit(1);
+ }
+ if (fnul && stack_env[index_env].data.oldfd[i] != fileno(fnul))
+ close(stack_env[index_env].data.oldfd[i]);
+ }
+}
+
+/* popenv */
+void popenv(void)
+{
+ if (index_env <= 0) {
+ if (KPSE_DEBUG_P(MKTEX_FINE_DEBUG))
+ fprintf(stderr, "Trying to popenv() from empty stack!\n");
+ return;
+ }
+
+ switch(stack_env[index_env-1].op) {
+ case CHDIR:
+ popd();
+ break;
+ case REDIRECT:
+ pop_fd();
+ break;
+ default:
+ fprintf(stderr, "popenv : unknown op %d.\n", stack_env[index_env-1].op);
+ break;
+ }
+}
+
+#ifdef _WIN32
+int sigint_handler(DWORD dwCtrlType)
+{
+ /* Fix me : there is a problem if a system() command is running.
+ We should wait for the son process to be interrupted.
+ Only way I can think of to do that : rewrite system() based on
+ spawn() with parsing of the command line and set a global pid
+ Next cwait(pid) in the HandlerRoutine.
+ */
+
+ /* This is not that good, but else we would need to wait for
+ the child processes to finish ! */
+ Sleep(250);
+
+ mt_exit(3);
+ return FALSE; /* return value obligatory */
+}
+#else
+void sigint_handler (int sig)
+{
+ mt_exit(3);
+}
+#endif
+
+void mt_exit(int code)
+{
+ /* rétablir les 0, 1 et 2 d'origine avant de tenter quoi que ce soit ! */
+ fcloseall();
+
+ /* unstack all env from main) */
+ for( ; index_env > 0; popenv());
+
+ /* output the result and rm any unneeded file */
+ if (output_and_cleanup_function != 0)
+ (*output_and_cleanup_function)(code);
+
+ exit(code);
+}
+
+#if 0 /* unused */
+static void
+dump_stack(void)
+{
+ int i;
+ for (i = 0; i < index_env; i++)
+ switch (stack_env[i].op) {
+ case CHDIR:
+ fprintf(stderr, "Env %d : chdir %s\n", i, stack_env[i].data.path);
+ break;
+ case REDIRECT:
+ fprintf(stderr, "Env %d : redirect %d %d %d\n", i,
+ stack_env[i].data.oldfd[0],
+ stack_env[i].data.oldfd[1],
+ stack_env[i].data.oldfd[2]);
+ break;
+ }
+
+}
+#endif
+
+/*
+ This is used by mktex{mf,tfm,pk}
+ if the argument is true, stdout is redirected to fnul
+ else to stderr.
+ */
+void start_redirection(int discard_stdout)
+{
+ int newfd[3];
+ if (fnul == NULL)
+#ifdef _WIN32
+ fnul = fopen("nul", "r"); /* fopen /dev/null */
+#else
+ fnul = fopen("/dev/null", "r");
+#endif
+
+ newfd[0] = fileno(fnul);
+ newfd[1] = (discard_stdout ? fileno(fnul) : fileno(stderr));
+ newfd[2] = fileno(stderr);
+
+ push_fd(newfd);
+}
diff --git a/Build/source/texk/dviljk/win32/stackenv.h b/Build/source/texk/dviljk/win32/stackenv.h
new file mode 100644
index 00000000000..63a0a04411c
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/stackenv.h
@@ -0,0 +1,46 @@
+#ifndef _STACKENV_H_
+
+#define _STACKENV_H_
+
+#include "mktexlib.h"
+
+/*
+ We are keeping trace of the environment (ie: cwd, file redirections)
+ with the help of these ops and structures. There is a global stack
+ inidcating wich actions have been taken.
+ */
+typedef enum { CHDIR = 1, REDIRECT } op_env;
+typedef struct mod_env {
+ op_env op;
+ union {
+ char *path;
+ int oldfd[3];
+ } data;
+} mod_env;
+
+/* from stackenv.c */
+extern void oops(const char *, ...);
+#ifdef __GNUC__
+extern void mt_exit(int) __attribute__((noreturn));
+#else
+extern MKTEXDLL void mt_exit(int);
+#endif
+extern MKTEXDLL void pushd(char *);
+extern MKTEXDLL void popd(void);
+extern MKTEXDLL void popenv(void);
+extern char *peek_dir(int);
+extern MKTEXDLL void push_fd(int [3]);
+extern MKTEXDLL void pop_fd(void);
+extern MKTEXDLL void start_redirection(int);
+#ifdef _WIN32
+/* extern void mt_exit(int); */
+extern MKTEXDLL int sigint_handler(DWORD);
+#else
+extern void sigint_handler(int);
+#endif
+
+typedef void (__cdecl * pfnOutputAndCleanup)(int);
+extern MKTEXDLL pfnOutputAndCleanup output_and_cleanup_function;
+
+extern MKTEXDLL int redirect_stdout;
+#endif /* _STACKENV_H_ */
diff --git a/Build/source/texk/dviljk/win32/variables.h b/Build/source/texk/dviljk/win32/variables.h
new file mode 100644
index 00000000000..06f79ddb132
--- /dev/null
+++ b/Build/source/texk/dviljk/win32/variables.h
@@ -0,0 +1,23 @@
+#ifndef _MKTEX_VARIABLES_H_
+
+#define _MKTEX_VARIABLES_H_
+
+#include <kpathsea/cnf.h>
+#include <kpathsea/db.h>
+#include <kpathsea/fn.h>
+#include <kpathsea/hash.h>
+
+extern MKTEXDLL void init_vars(void);
+extern MKTEXDLL char *getval(char *name);
+extern MKTEXDLL char *setval(char *name,char *value);
+extern MKTEXDLL char *setval_default(char *name,char *value);
+extern MKTEXDLL char **grep(char *regexp,char *line,int num_vars) ;
+
+extern MKTEXDLL int parse_variable(char *line);
+
+extern char *strcasestr(char *s1,char *s2);
+
+extern char *subst(char *line, char *from, char *to);
+extern MKTEXDLL string expand_var(const_string);
+extern MKTEXDLL string mktex_var_expand (const_string src);
+#endif /* _MKTEX_VARIABLES_H_ */