From 52bac1876bacc88999ff0c171bcdc8001068d9f6 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Thu, 6 May 2010 15:06:15 +0000 Subject: utils/chktex build git-svn-id: svn://tug.org/texlive/trunk@18124 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/utils/chktex/Makefile.am | 19 ++ Build/source/utils/chktex/Makefile.in | 210 ++++++++++++++++++--- .../utils/chktex/chktex-1.6.4-PATCHES/ChangeLog | 5 + .../utils/chktex/chktex-1.6.4-PATCHES/patch-02-bug | 21 +++ .../chktex/chktex-1.6.4-PATCHES/patch-03-texlive | 76 ++++++++ Build/source/utils/chktex/chktex-1.6.4/ChkTeX.c | 2 +- Build/source/utils/chktex/chktex-1.6.4/OpSys.c | 24 ++- Build/source/utils/chktex/chktex-1.6.4/OpSys.h | 10 + Build/source/utils/chktex/chktex.test | 14 ++ Build/source/utils/chktex/config.h.in | 15 +- Build/source/utils/chktex/configure | 197 ++++++------------- Build/source/utils/chktex/configure.ac | 17 +- 12 files changed, 424 insertions(+), 186 deletions(-) create mode 100644 Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-02-bug create mode 100644 Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-03-texlive create mode 100755 Build/source/utils/chktex/chktex.test (limited to 'Build/source') diff --git a/Build/source/utils/chktex/Makefile.am b/Build/source/utils/chktex/Makefile.am index 6a5727d8f3a..ce5efdb938e 100644 --- a/Build/source/utils/chktex/Makefile.am +++ b/Build/source/utils/chktex/Makefile.am @@ -48,3 +48,22 @@ dist_man_MANS = \ $(CHKTEX_TREE)/chkweb.1 \ $(CHKTEX_TREE)/deweb.1 +# resource file +configdir = ${prefix}/texmf/chktex + +config_DATA = $(CHKTEX_TREE)/chktexrc + +# documentation +pdfdocdir = ${prefix}/texmf/doc/chktex + +pdfdoc_DATA = + +# chktex tests +TESTS = chktex.test + +TESTS_ENVIRONMENT = CHKTEX_TREE=$(CHKTEX_TREE) + +EXTRA_DIST += chktex.test + +CLEANFILES = chktest + diff --git a/Build/source/utils/chktex/Makefile.in b/Build/source/utils/chktex/Makefile.in index 46e9bec6ec2..a0e5d235dd3 100644 --- a/Build/source/utils/chktex/Makefile.in +++ b/Build/source/utils/chktex/Makefile.in @@ -15,6 +15,7 @@ @SET_MAKE@ + VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -39,11 +40,12 @@ DIST_COMMON = $(am__configure_deps) $(dist_man_MANS) \ $(srcdir)/../../build-aux/install-sh \ $(srcdir)/../../build-aux/missing $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure ../../build-aux/config.guess \ - ../../build-aux/config.sub ../../build-aux/depcomp \ - ../../build-aux/install-sh ../../build-aux/ltmain.sh \ - ../../build-aux/missing ../../build-aux/texinfo.tex \ - ../../build-aux/ylwrap + $(top_srcdir)/chktex-1.6.4/ChkTeX.tex.in \ + $(top_srcdir)/chktex-1.6.4/deweb.in $(top_srcdir)/configure \ + ../../build-aux/config.guess ../../build-aux/config.sub \ + ../../build-aux/depcomp ../../build-aux/install-sh \ + ../../build-aux/ltmain.sh ../../build-aux/missing \ + ../../build-aux/texinfo.tex ../../build-aux/ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-warnings.m4 \ $(top_srcdir)/configure.ac @@ -53,9 +55,10 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = ChkTeX.tex deweb.pl CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ + "$(DESTDIR)$(configdir)" "$(DESTDIR)$(pdfdocdir)" PROGRAMS = $(bin_PROGRAMS) am_chktex_OBJECTS = ChkTeX.$(OBJEXT) FindErrs.$(OBJEXT) \ OpSys.$(OBJEXT) Resource.$(OBJEXT) Utility.$(OBJEXT) @@ -95,8 +98,11 @@ am__base_list = \ man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man_MANS) +DATA = $(config_DATA) $(pdfdoc_DATA) ETAGS = etags CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -151,6 +157,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL5 = @PERL5@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -205,7 +212,7 @@ top_srcdir = @top_srcdir@ # #************************************************************************ ACLOCAL_AMFLAGS = -I ../../m4 -EXTRA_DIST = $(CHKTEX_TREE) $(CHKTEX_TREE)-PATCHES +EXTRA_DIST = $(CHKTEX_TREE) $(CHKTEX_TREE)-PATCHES chktex.test AM_CFLAGS = $(WARNING_CFLAGS) chktex_SOURCES = \ $(CHKTEX_TREE)/ChkTeX.c \ @@ -225,6 +232,19 @@ dist_man_MANS = \ $(CHKTEX_TREE)/chkweb.1 \ $(CHKTEX_TREE)/deweb.1 + +# resource file +configdir = ${prefix}/texmf/chktex +config_DATA = $(CHKTEX_TREE)/chktexrc + +# documentation +pdfdocdir = ${prefix}/texmf/doc/chktex +pdfdoc_DATA = + +# chktex tests +TESTS = chktex.test +TESTS_ENVIRONMENT = CHKTEX_TREE=$(CHKTEX_TREE) +CLEANFILES = chktest all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -281,6 +301,10 @@ $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) distclean-hdr: -rm -f config.h stamp-h1 +ChkTeX.tex: $(top_builddir)/config.status $(top_srcdir)/chktex-1.6.4/ChkTeX.tex.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +deweb.pl: $(top_builddir)/config.status $(top_srcdir)/chktex-1.6.4/deweb.in + cd $(top_builddir) && $(SHELL) ./config.status $@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @@ -455,6 +479,46 @@ uninstall-man1: test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } +install-configDATA: $(config_DATA) + @$(NORMAL_INSTALL) + test -z "$(configdir)" || $(MKDIR_P) "$(DESTDIR)$(configdir)" + @list='$(config_DATA)'; test -n "$(configdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(configdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(configdir)" || exit $$?; \ + done + +uninstall-configDATA: + @$(NORMAL_UNINSTALL) + @list='$(config_DATA)'; test -n "$(configdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(configdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(configdir)" && rm -f $$files +install-pdfdocDATA: $(pdfdoc_DATA) + @$(NORMAL_INSTALL) + test -z "$(pdfdocdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdocdir)" + @list='$(pdfdoc_DATA)'; test -n "$(pdfdocdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdocdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdocdir)" || exit $$?; \ + done + +uninstall-pdfdocDATA: + @$(NORMAL_UNINSTALL) + @list='$(pdfdoc_DATA)'; test -n "$(pdfdocdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pdfdocdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pdfdocdir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -508,6 +572,98 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ @@ -672,10 +828,11 @@ distcleancheck: distclean $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am -all-am: Makefile $(PROGRAMS) $(MANS) config.h +all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(pdfdocdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -695,6 +852,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -726,7 +884,7 @@ info: info-am info-am: -install-data-am: install-man +install-data-am: install-configDATA install-man install-pdfdocDATA install-dvi: install-dvi-am @@ -773,28 +931,30 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-man +uninstall-am: uninstall-binPROGRAMS uninstall-configDATA uninstall-man \ + uninstall-pdfdocDATA uninstall-man: uninstall-man1 -.MAKE: all install-am install-strip +.MAKE: all check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ - clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ - dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \ - dist-zip distcheck distclean distclean-compile \ +.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ + clean clean-binPROGRAMS clean-generic ctags dist dist-all \ + dist-bzip2 dist-gzip dist-hook dist-lzma dist-shar dist-tarZ \ + dist-xz dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck 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-man1 install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ + info-am install install-am install-binPROGRAMS \ + install-configDATA 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-man1 install-pdf install-pdf-am install-pdfdocDATA \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-man \ - uninstall-man1 + uninstall-am uninstall-binPROGRAMS uninstall-configDATA \ + uninstall-man uninstall-man1 uninstall-pdfdocDATA # in case of an SVN repository diff --git a/Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog index e2635a5f011..b8600569172 100644 --- a/Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog +++ b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/ChangeLog @@ -1,3 +1,8 @@ +2010-05-06 Peter Breitenlohner + + * patch-02-bug (new): Bug fix + * patch-03-texlive (new): Handle global rc file for TeX Live. + 2010-05-02 Peter Breitenlohner * patch-01-const (new): Avoid compiler warnings (const). diff --git a/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-02-bug b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-02-bug new file mode 100644 index 00000000000..9157d4f49fd --- /dev/null +++ b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-02-bug @@ -0,0 +1,21 @@ +diff -ur chktex-1.6.4.orig/OpSys.c chktex-1.6.4/OpSys.c +--- chktex-1.6.4.orig/OpSys.c 2010-05-02 22:18:12.000000000 +0200 ++++ chktex-1.6.4/OpSys.c 2010-05-06 13:21:05.886490205 +0200 +@@ -204,7 +204,6 @@ + tackon(ConfigFile, LOCALRCFILE); + } + else +- *ConfigFile = 0; + #elif defined(__MSDOS__) + + strcpy(ConfigFile, PrgName); +@@ -212,8 +211,8 @@ + (Ptr = strchr(ConfigFile, ':'))) + strcpy(++Ptr, RCBASENAME); + else +- *ConfigFile = 0; + #endif ++ *ConfigFile = 0; + + break; + case liSysDir: /* System dir for resource files */ diff --git a/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-03-texlive b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-03-texlive new file mode 100644 index 00000000000..cb34f06fda8 --- /dev/null +++ b/Build/source/utils/chktex/chktex-1.6.4-PATCHES/patch-03-texlive @@ -0,0 +1,76 @@ +diff -ur chktex-1.6.4.orig/ChkTeX.c chktex-1.6.4/ChkTeX.c +--- chktex-1.6.4.orig/ChkTeX.c 2010-05-02 22:03:42.000000000 +0200 ++++ chktex-1.6.4/ChkTeX.c 2010-05-05 21:46:44.000000000 +0200 +@@ -85,7 +85,7 @@ + "Type \"ChkTeX -h\" for help, \"ChkTeX -i\" for distribution info.\n" + "Author: Jens Berger, Spektrumvn. 4, N-0666 Oslo, Norway.\n" + "E-mail: \n" +- "Press " STDIN_BREAK " to abort stdin input.\n"; ++ "Press " STDIN_BREAK " to terminate stdin input.\n"; + + static const char *Distrib = + "\n" +diff -ur chktex-1.6.4.orig/OpSys.c chktex-1.6.4/OpSys.c +--- chktex-1.6.4.orig/OpSys.c 2010-05-06 13:21:05.000000000 +0200 ++++ chktex-1.6.4/OpSys.c 2010-05-06 13:59:06.701540401 +0200 +@@ -216,12 +216,33 @@ + + break; + case liSysDir: /* System dir for resource files */ ++#ifdef TEX_LIVE ++ if ((Env = getenv("CHKTEX_CONFIG"))) ++ { ++ strcpy(ConfigFile, Env); ++ } ++ else ++ { ++ FILE *f; ++ *ConfigFile = 0; ++ if ((f = popen("kpsewhich -expand-var='$TEXMFMAIN'", "r"))) ++ { ++ if (1 == fscanf(f, "%1024s", ConfigFile)) ++ { ++ tackon(ConfigFile, "chktex"); ++ tackon(ConfigFile, RCBASENAME); ++ } ++ (void)pclose(f); ++ } ++ } ++#else /* TEX_LIVE */ + #if defined(__unix__) || defined(__MSDOS__) + strcpy(ConfigFile, SYSCONFDIR); + tackon(ConfigFile, RCBASENAME); + #else + *ConfigFile = 0; + #endif ++#endif /* TEX_LIVE */ + + break; + case liNFound: +diff -ur chktex-1.6.4.orig/OpSys.h chktex-1.6.4/OpSys.h +--- chktex-1.6.4.orig/OpSys.h 2010-05-02 22:18:32.000000000 +0200 ++++ chktex-1.6.4/OpSys.h 2010-05-06 14:21:57.972021240 +0200 +@@ -101,6 +101,15 @@ + */ + + ++#ifdef TEX_LIVE ++#if defined(__MSDOS__) || defined(WIN32) ++# define SLASH '\\' ++# define DIRCHARS ":\\" ++#else ++# define SLASH '/' ++# define DIRCHARS "/" ++#endif ++#else /* TEX_LIVE */ + #if defined(__unix__) + # define SLASH '/' + #elif defined(__MSDOS__) +@@ -112,6 +121,7 @@ + #elif defined(__MSDOS__) + # define DIRCHARS ":\\" + #endif ++#endif /* TEX_LIVE */ + + /* -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- */ + diff --git a/Build/source/utils/chktex/chktex-1.6.4/ChkTeX.c b/Build/source/utils/chktex/chktex-1.6.4/ChkTeX.c index ed023b86283..276a579e7ec 100644 --- a/Build/source/utils/chktex/chktex-1.6.4/ChkTeX.c +++ b/Build/source/utils/chktex/chktex-1.6.4/ChkTeX.c @@ -85,7 +85,7 @@ static const char *BigBanner = "Type \"ChkTeX -h\" for help, \"ChkTeX -i\" for distribution info.\n" "Author: Jens Berger, Spektrumvn. 4, N-0666 Oslo, Norway.\n" "E-mail: \n" - "Press " STDIN_BREAK " to abort stdin input.\n"; + "Press " STDIN_BREAK " to terminate stdin input.\n"; static const char *Distrib = "\n" diff --git a/Build/source/utils/chktex/chktex-1.6.4/OpSys.c b/Build/source/utils/chktex/chktex-1.6.4/OpSys.c index 784fbec25d2..fcd8355e40a 100644 --- a/Build/source/utils/chktex/chktex-1.6.4/OpSys.c +++ b/Build/source/utils/chktex/chktex-1.6.4/OpSys.c @@ -204,7 +204,6 @@ int SetupVars(void) tackon(ConfigFile, LOCALRCFILE); } else - *ConfigFile = 0; #elif defined(__MSDOS__) strcpy(ConfigFile, PrgName); @@ -212,17 +211,38 @@ int SetupVars(void) (Ptr = strchr(ConfigFile, ':'))) strcpy(++Ptr, RCBASENAME); else - *ConfigFile = 0; #endif + *ConfigFile = 0; break; case liSysDir: /* System dir for resource files */ +#ifdef TEX_LIVE + if ((Env = getenv("CHKTEX_CONFIG"))) + { + strcpy(ConfigFile, Env); + } + else + { + FILE *f; + *ConfigFile = 0; + if ((f = popen("kpsewhich -expand-var='$TEXMFMAIN'", "r"))) + { + if (1 == fscanf(f, "%1024s", ConfigFile)) + { + tackon(ConfigFile, "chktex"); + tackon(ConfigFile, RCBASENAME); + } + (void)pclose(f); + } + } +#else /* TEX_LIVE */ #if defined(__unix__) || defined(__MSDOS__) strcpy(ConfigFile, SYSCONFDIR); tackon(ConfigFile, RCBASENAME); #else *ConfigFile = 0; #endif +#endif /* TEX_LIVE */ break; case liNFound: diff --git a/Build/source/utils/chktex/chktex-1.6.4/OpSys.h b/Build/source/utils/chktex/chktex-1.6.4/OpSys.h index 83e0b58712b..9e5a8cccf45 100644 --- a/Build/source/utils/chktex/chktex-1.6.4/OpSys.h +++ b/Build/source/utils/chktex/chktex-1.6.4/OpSys.h @@ -101,6 +101,15 @@ */ +#ifdef TEX_LIVE +#if defined(__MSDOS__) || defined(WIN32) +# define SLASH '\\' +# define DIRCHARS ":\\" +#else +# define SLASH '/' +# define DIRCHARS "/" +#endif +#else /* TEX_LIVE */ #if defined(__unix__) # define SLASH '/' #elif defined(__MSDOS__) @@ -112,6 +121,7 @@ #elif defined(__MSDOS__) # define DIRCHARS ":\\" #endif +#endif /* TEX_LIVE */ /* -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- -=><=- */ diff --git a/Build/source/utils/chktex/chktex.test b/Build/source/utils/chktex/chktex.test new file mode 100755 index 00000000000..3ae9c35e766 --- /dev/null +++ b/Build/source/utils/chktex/chktex.test @@ -0,0 +1,14 @@ +#! /bin/sh + +# Copyright (C) 2009 Peter Breitenlohner +# You may freely use, modify and/or distribute this file. + +rm -f chktest + +(bld=`pwd` + cd $srcdir/$CHKTEX_TREE || exit 1 + CHKTEX_CONFIG=chktexrc \ + $bld/chktex -mall -r -g0 -lchktexrc -v5 Test.tex || exit 1 +) >chktest || exit 1 + +diff $srcdir/$CHKTEX_TREE/Test.out chktest || exit 1 diff --git a/Build/source/utils/chktex/config.h.in b/Build/source/utils/chktex/config.h.in index bb109917129..143720f0561 100644 --- a/Build/source/utils/chktex/config.h.in +++ b/Build/source/utils/chktex/config.h.in @@ -22,12 +22,6 @@ /* Define to 1 if you have the `isatty' function. */ #undef HAVE_ISATTY -/* Define to 1 if you have the `termcap' library (-ltermcap). */ -#undef HAVE_LIBTERMCAP - -/* Define to 1 if you have the `termlib' library (-ltermlib). */ -#undef HAVE_LIBTERMLIB - /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H @@ -90,12 +84,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMCAP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMLIB_H - /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H @@ -126,6 +114,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define to 1 for a TeX Live build. */ +#undef TEX_LIVE + /* Version number of package */ #undef VERSION diff --git a/Build/source/utils/chktex/configure b/Build/source/utils/chktex/configure index ef19b992741..ba7c4762fbe 100755 --- a/Build/source/utils/chktex/configure +++ b/Build/source/utils/chktex/configure @@ -598,6 +598,7 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +PERL5 CHKTEX_TREE EGREP GREP @@ -1452,52 +1453,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -1577,6 +1532,52 @@ fi } # ac_fn_c_try_run +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -3763,96 +3764,6 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermlib" >&5 -$as_echo_n "checking for tgetent in -ltermlib... " >&6; } -if test "${ac_cv_lib_termlib_tgetent+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ltermlib $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char tgetent (); -int -main () -{ -return tgetent (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_termlib_tgetent=yes -else - ac_cv_lib_termlib_tgetent=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termlib_tgetent" >&5 -$as_echo "$ac_cv_lib_termlib_tgetent" >&6; } -if test "x$ac_cv_lib_termlib_tgetent" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBTERMLIB 1 -_ACEOF - - LIBS="-ltermlib $LIBS" - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5 -$as_echo_n "checking for tgetent in -ltermcap... " >&6; } -if test "${ac_cv_lib_termcap_tgetent+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ltermcap $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char tgetent (); -int -main () -{ -return tgetent (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_termcap_tgetent=yes -else - ac_cv_lib_termcap_tgetent=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5 -$as_echo "$ac_cv_lib_termcap_tgetent" >&6; } -if test "x$ac_cv_lib_termcap_tgetent" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBTERMCAP 1 -_ACEOF - - LIBS="-ltermcap $LIBS" - -fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4411,7 +4322,7 @@ fi done -for ac_header in limits.h stat.h strings.h stdarg.h sys/stat.h termcap.h termlib.h unistd.h +for ac_header in limits.h stat.h strings.h stdarg.h sys/stat.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -4596,11 +4507,20 @@ done ac_config_headers="$ac_config_headers config.h" +$as_echo "#define TEX_LIVE 1" >>confdefs.h + + CHKTEX_TREE=chktex-1.6.4 +PERL5='/usr/bin/env perl' + ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files ChkTeX.tex:chktex-1.6.4/ChkTeX.tex.in" + +ac_config_files="$ac_config_files deweb.pl:chktex-1.6.4/deweb.in" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5319,6 +5239,8 @@ do "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "ChkTeX.tex") CONFIG_FILES="$CONFIG_FILES ChkTeX.tex:chktex-1.6.4/ChkTeX.tex.in" ;; + "deweb.pl") CONFIG_FILES="$CONFIG_FILES deweb.pl:chktex-1.6.4/deweb.in" ;; *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -5998,6 +5920,7 @@ $as_echo X"$file" | done } ;; + "deweb.pl":F) chmod +x deweb.pl ;; esac done # for ac_tag diff --git a/Build/source/utils/chktex/configure.ac b/Build/source/utils/chktex/configure.ac index 0f43605aa76..bc039a8f9e6 100644 --- a/Build/source/utils/chktex/configure.ac +++ b/Build/source/utils/chktex/configure.ac @@ -31,15 +31,12 @@ dnl Checks for programs. AC_PROG_INSTALL AC_PROG_LN_S -dnl Checks for libraries. -AC_CHECK_LIB(termlib, tgetent) -AC_CHECK_LIB(termcap, tgetent) +dnl No termlib/termcap/ncurses library for TeX Live dnl Checks for header files. AC_HEADER_STDC AC_HEADER_DIRENT -AC_CHECK_HEADERS(limits.h stat.h strings.h stdarg.h dnl -sys/stat.h termcap.h termlib.h unistd.h) +AC_CHECK_HEADERS([limits.h stat.h strings.h stdarg.h sys/stat.h unistd.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -48,14 +45,16 @@ AC_TYPE_SIZE_T dnl Checks for library functions. AC_FUNC_VPRINTF -AC_CHECK_FUNCS(access closedir fileno isatty opendir readdir stat dnl -strcasecmp strdup strlwr strtol) +AC_CHECK_FUNCS([access closedir fileno isatty opendir readdir stat strcasecmp strdup strlwr strtol]) AC_CONFIG_HEADERS([config.h]) +AC_DEFINE([TEX_LIVE], 1, [Define to 1 for a TeX Live build.]) -CHKTEX_TREE=[chktex-]chktex_version -AC_SUBST([CHKTEX_TREE]) +AC_SUBST([CHKTEX_TREE], [chktex-]chktex_version) +AC_SUBST([PERL5], ['/usr/bin/env perl']) AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([ChkTeX.tex:chktex-]chktex_version[/ChkTeX.tex.in]) +AC_CONFIG_FILES([deweb.pl:chktex-]chktex_version[/deweb.in], [chmod +x deweb.pl]) AC_OUTPUT -- cgit v1.2.3