Your IP : 216.73.216.1


Current Path : /home/fotouserdopd8j/agenciacrabli.com/
Upload File :
Current File : /home/fotouserdopd8j/agenciacrabli.com/automake-1.16.tar

am/mans.am000064400000014536150523165450006435 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1998-2018 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, see <https://www.gnu.org/licenses/>.

include inst-vars.am
man%SECTION%dir = $(mandir)/man%SECTION%

## ------------ ##
## Installing.  ##
## ------------ ##

## MANS primary are always installed in mandir, hence install-data
## is hard coded.

.PHONY: install-man
?INSTALL-MAN?install-data-am: install-man
?INSTALL-MAN?am__installdirs += "$(DESTDIR)$(man%SECTION%dir)"
.PHONY install-man: install-man%SECTION%
install-man%SECTION%: %DEPS%
	@$(NORMAL_INSTALL)
if %?NOTRANS_MANS%
## Handle MANS with notrans_ prefix
	@list1='%NOTRANS_SECT_LIST%'; \
?!HAVE_NOTRANS?	list2=''; \
?HAVE_NOTRANS?	list2='%NOTRANS_LIST%'; \
	test -n "$(man%SECTION%dir)" \
	  && test -n "`echo $$list1$$list2`" \
	  || exit 0; \
	echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
	$(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit 1; \
	{ for i in $$list1; do echo "$$i"; done;  \
## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
	if test -n "$$list2"; then \
	  for i in $$list2; do echo "$$i"; done \
## Accept for 'man1' files like 'foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
	    | sed -n '/\.%SECTION%[a-z]*$$/p'; \
	fi; \
## Extract basename of manpage, change the extension if needed.
	} | while read p; do \
## Find the file.
	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
	  echo "$$d$$p"; echo "$$p"; \
	done | \
## Extract the basename of the man page and change the extension if needed.
	sed 'n;s,.*/,,;p;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,' | \
	sed 'N;N;s,\n, ,g' | { \
## We now have a list "sourcefile basename installed-name".
	list=; while read file base inst; do \
	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst" || exit $$?; \
	  fi; \
	done; \
	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
	while read files; do \
	  test -z "$$files" || { \
	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man%SECTION%dir)'"; \
	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man%SECTION%dir)" || exit $$?; }; \
	done; }
endif %?NOTRANS_MANS%
if %?TRANS_MANS%
## Handle MANS without notrans_ prefix
	@list1='%TRANS_SECT_LIST%'; \
?!HAVE_TRANS?	list2=''; \
?HAVE_TRANS?	list2='%TRANS_LIST%'; \
	test -n "$(man%SECTION%dir)" \
	  && test -n "`echo $$list1$$list2`" \
	  || exit 0; \
	echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
	$(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit 1; \
	{ for i in $$list1; do echo "$$i"; done;  \
## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
	if test -n "$$list2"; then \
	  for i in $$list2; do echo "$$i"; done \
## Accept for 'man1' files like `foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
	    | sed -n '/\.%SECTION%[a-z]*$$/p'; \
	fi; \
## Extract basename of manpage, change the extension if needed.
	} | while read p; do \
## Find the file.
	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
	  echo "$$d$$p"; echo "$$p"; \
	done | \
## Extract the basename of the man page and change the extension if needed.
	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \
	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
	sed 'N;N;s,\n, ,g' | { \
## We now have a list "sourcefile basename installed-name".
	list=; while read file base inst; do \
	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst" || exit $$?; \
	  fi; \
	done; \
	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
	while read files; do \
	  test -z "$$files" || { \
	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man%SECTION%dir)'"; \
	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man%SECTION%dir)" || exit $$?; }; \
	done; }
endif %?TRANS_MANS%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

.PHONY: uninstall-man
?INSTALL-MAN?uninstall-am: uninstall-man
.PHONY uninstall-man: uninstall-man%SECTION%
uninstall-man%SECTION%:
	@$(NORMAL_UNINSTALL)
if %?NOTRANS_MANS%
## Handle MANS with notrans_ prefix
	@list='%NOTRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
	files=`{ for i in $$list; do echo "$$i"; done; \
## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
?HAVE_NOTRANS?	l2='%NOTRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
## Accept for 'man1' files like 'foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
?HAVE_NOTRANS?	  sed -n '/\.%SECTION%[a-z]*$$/p'; \
## Extract basename of manpage, change the extension if needed.
	} | sed 's,.*/,,;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,'`; \
	dir='$(DESTDIR)$(man%SECTION%dir)'; $(am__uninstall_files_from_dir)
endif %?NOTRANS_MANS%
if %?TRANS_MANS%
## Handle MANS without notrans_ prefix
	@list='%TRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
	files=`{ for i in $$list; do echo "$$i"; done; \
## Extract all items from man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
?HAVE_TRANS?	l2='%TRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
## Accept for 'man1' files like 'foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
?HAVE_TRANS?	  sed -n '/\.%SECTION%[a-z]*$$/p'; \
## Extract basename of manpage, run it through the program rename
## transform, and change the extension if needed.
	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \
	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
	dir='$(DESTDIR)$(man%SECTION%dir)'; $(am__uninstall_files_from_dir)
endif %?TRANS_MANS%
am/tags.am000064400000012052150523165450006424 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates.  Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
  BEGIN { nonempty = 0; } \
  { items[$$0] = 1; nonempty = 1; } \
  END { if (nonempty) { for (i in items) print i; }; } \
'

# Make sure the list of sources is unique.  This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
  list='$(am__tagged_files)'; \
  unique=`for i in $$list; do \
## Handle VPATH correctly.
    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
  done | $(am__uniquify_input)`

## ---- ##
## ID.  ##
## ---- ##

ID: $(am__tagged_files)
	$(am__define_uniq_tagged_files); mkid -fID $$unique


## ------ ##
## TAGS.  ##
## ------ ##

ETAGS = etags
.PHONY: TAGS tags
if %?SUBDIRS%
AM_RECURSIVE_TARGETS += TAGS
RECURSIVE_TARGETS += tags-recursive
tags: tags-recursive
else !%?SUBDIRS%
tags: tags-am
endif !%?SUBDIRS%
TAGS: tags

tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
## We use the positional parameters to build the subdir list with
## absolute names, without the need to worry about white space in `pwd`.
	set x; \
	here=`pwd`; \
## Exuberant Ctags wants --etags-include,
## GNU Etags             --include
## Furthermore Exuberant Ctags 5.5.4 fails to create TAGS files
## when no files are supplied, despite any --etags-include option.
## A workaround is to pass '.' as a file.  This is what $empty_fix is for.
?SUBDIRS?	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
?SUBDIRS?	  include_option=--etags-include; \
?SUBDIRS?	  empty_fix=.; \
?SUBDIRS?	else \
?SUBDIRS?	  include_option=--include; \
?SUBDIRS?	  empty_fix=; \
?SUBDIRS?	fi; \
?SUBDIRS?	list='$(SUBDIRS)'; for subdir in $$list; do \
## Do nothing if we're trying to look in '.'.
?SUBDIRS?	  if test "$$subdir" = .; then :; else \
?SUBDIRS?	    test ! -f $$subdir/TAGS || \
## Note that the = is mandatory for --etags-include.
?SUBDIRS?	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
?SUBDIRS?	  fi; \
?SUBDIRS?	done; \
	$(am__define_uniq_tagged_files); \
## Remove the 'x' we added first:
	shift; \
## Make sure we have something to run etags on.
	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


## --------------- ##
## vi-style tags.  ##
## --------------- ##

CTAGS = ctags
.PHONY: CTAGS ctags
if %?SUBDIRS%
AM_RECURSIVE_TARGETS += CTAGS
RECURSIVE_TARGETS += ctags-recursive
ctags: ctags-recursive
else !%?SUBDIRS%
ctags: ctags-am
endif !%?SUBDIRS%

CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
	$(am__define_uniq_tagged_files); \
## Make sure we have something to run ctags on.
	test -z "$(CTAGS_ARGS)$$unique" \
	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
	     $$unique


## --------------- ##
## "Global tags".  ##
## --------------- ##

.PHONY: GTAGS
GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && $(am__cd) $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) "$$here"


## ------- ##
## cscope  ##
## ------- ##

if %?TOPDIR_P%
CSCOPE = cscope
.PHONY: cscope clean-cscope
AM_RECURSIVE_TARGETS += cscope
cscope: cscope.files
	test ! -s cscope.files \
	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
	-rm -f cscope.files
cscope.files: clean-cscope cscopelist
endif %?TOPDIR_P%

if %?SUBDIRS%
RECURSIVE_TARGETS += cscopelist-recursive
cscopelist: cscopelist-recursive
else !%?SUBDIRS%
cscopelist: cscopelist-am
endif !%?SUBDIRS%

cscopelist-am: $(am__tagged_files)
	list='$(am__tagged_files)'; \
	case "$(srcdir)" in \
	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
	  *) sdir=$(subdir)/$(srcdir) ;; \
	esac; \
	for i in $$list; do \
	  if test -f "$$i"; then \
	    echo "$(subdir)/$$i"; \
	  else \
	    echo "$$sdir/$$i"; \
	  fi; \
	done >> $(top_builddir)/cscope.files


## ---------- ##
## Cleaning.  ##
## ---------- ##

.PHONY distclean-am: distclean-tags

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
if %?TOPDIR_P%
	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
endif %?TOPDIR_P%
am/distdir.am000064400000053420150523165450007134 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.

DIST_COMMON += $(am__DIST_COMMON)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

if %?TOPDIR_P%
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)

am__remove_distdir = \
  if test -d "$(distdir)"; then \
    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
      && rm -rf "$(distdir)" \
## On MSYS (1.0.17) it is not possible to remove a directory that is in
## use; so, if the first rm fails, we sleep some seconds and retry, to
## give pending processes some time to exit and "release" the directory
## before we remove it.  The value of "some seconds" is 5 for the moment,
## which is mostly an arbitrary value, but seems high enough in practice.
## See automake bug#10470.
      || { sleep 5 && rm -rf "$(distdir)"; }; \
  else :; fi
am__post_remove_distdir = $(am__remove_distdir)
endif %?TOPDIR_P%

if %?SUBDIRS%
## computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2.
## Input:
## - DIR1            relative pathname, relative to the current directory
## - DIR2            relative pathname, relative to the current directory
## Output:
## - reldir          relative pathname of DIR2, relative to DIR1
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"
endif %?SUBDIRS%

.PHONY: distdir
if %?SUBDIRS%
AM_RECURSIVE_TARGETS += distdir distdir-am
endif %?SUBDIRS%

distdir: $(BUILT_SOURCES)
	$(MAKE) $(AM_MAKEFLAGS) distdir-am

distdir-am: $(DISTFILES)
##
## For Gnits users, this is pretty handy.  Look at 15 lines
## in case some explanatory text is desirable.
##
if %?TOPDIR_P%
if  %?CK-NEWS%
	@case `sed 15q $(srcdir)/NEWS` in \
	*"$(VERSION)"*) : ;; \
	*) \
	  echo "NEWS not updated; not releasing" 1>&2; \
	  exit 1;; \
	esac
endif  %?CK-NEWS%
endif %?TOPDIR_P%
##
## Only for the top dir.
##
if %?TOPDIR_P%
	$(am__remove_distdir)
	test -d "$(distdir)" || mkdir "$(distdir)"
endif %?TOPDIR_P%
##
##
	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
##
## Yet another hack to support SUN make.
##
## Let's assume 'foo' appears in DISTFILES and is not a built file.
## When building with VPATH=$(srcdir), SUN make and OSF1/Tru64 will
## rewrite 'foo' as '$(srcdir)/foo'.  An attempt to install the file
## with
##    cp $file $(distdir)/$file
## will thus install $(srcdir)/foo as $(distdir)/$(srcdir)/foo
## instead of $(distdir)/foo.
##
## So let's strip this leading $(srcdir)/ when it exists.  (As far we
## know, only SUN make and OSF1/Tru64 make add it.)  Searching whether
## the file is to be found in the source or build directory will be
## done later.
##
## In case we are _not_ using SUN or OSF1/Tru64 make, how can we be sure
## we are not stripping a legitimate filename that starts with the
## same pattern as $(srcdir)?
## Well, it can't happen without the Makefile author distributing
## something out of the distribution (which is bad).  As an example,
## consider "EXTRA_DIST = ../bar".  This is an issue if $srcdir is
## '..', however getting this value for srcdir is impossible:
## "EXTRA_DIST = ../bar" implies we are in a subdirectory (so '../bar'
## is within the package), hence '$srcdir' is something like
## '../../subdir'.
##
## There is more to say about files which are above the current directory,
## like '../bar' in the previous example.  The OSF1/Tru64 make
## implementation can simplify filenames resulting from a VPATH lookup.
## For instance if "VPATH = ../../subdir" and '../bar' is found in that
## VPATH directory, then occurrences of '../bar' will be replaced by
## '../../bar' (instead of '../../subdir/../bar').  This obviously defeats
## any attempt to strip a leading $srcdir.  Presently we have no workaround
## for this.  We avoid this issue by writing "EXTRA_DIST = $(srcdir)/../bar"
## instead of "EXTRA_DIST = ../bar".  This prefixing is needed only for files
## above the current directory.  Fortunately, apart from auxdir files which
## can be located in .. or ../.., this situation hardly occurs in practice.
##
## Also rewrite $(top_srcdir) (which sometimes appears in DISTFILES, and can
## be absolute) by $(top_builddir) (which is always relative).  $(srcdir) will
## be prepended later.
	list='$(DISTFILES)'; \
	  dist_files=`for file in $$list; do echo $$file; done | \
	  sed -e "s|^$$srcdirstrip/||;t" \
	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
## (The second 't' command clears the flag for the next round.)
##
## Make the subdirectories for the files.
##
	case $$dist_files in \
	  */*) $(MKDIR_P) `echo "$$dist_files" | \
			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
			   sort -u` ;; \
	esac; \
##
##
	for file in $$dist_files; do \
##
## Always look for the file in the build directory first.  That way
## for something like yacc output we will correctly pick up the latest
## version.  Also check for directories in the build directory first,
## so one can ship generated directories.
##
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
##
## Use cp, not ln.  There are situations in which "ln" can fail.  For
## instance a file to distribute could actually be a cross-filesystem
## symlink -- this can easily happen if "gettextize" was run on the
## distribution.
##
	  if test -d $$d/$$file; then \
## Don't mention $$file in the destination argument, since this fails if
## the destination directory already exists.  Also, use '-R' and not '-r'.
## '-r' is almost always incorrect.
##
## If a directory exists both in '.' and $(srcdir), then we copy the
## files from $(srcdir) first and then install those from '.'.  This
## can help people who distribute directories made of source files
## *and* generated files.  It is also important when the directory
## exists only in $(srcdir), because some vendor Make (such as Tru64)
## will magically create an empty directory in '.'.
	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
## If the destination directory already exists, it may contain read-only
## files, e.g., during "make distcheck".
	    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 for file existence because sometimes a file gets included in
## DISTFILES twice.  For example this happens when a single source
## file is used in building more than one program.
## See also test 'dist-repeated.sh'.
	    test -f "$(distdir)/$$file" \
	    || cp -p $$d/$$file "$(distdir)/$$file" \
	    || exit 1; \
	  fi; \
	done
##
## Test for directory existence here because previous automake
## invocation might have created some directories.  Note that we
## explicitly set distdir for the subdir make; that lets us mix-n-match
## many automake-using packages into one large package, and have "dist"
## at the top level do the right thing.  If we're in the topmost
## directory, then we use 'distdir' instead of 'top_distdir'; this lets
## us work correctly with an enclosing package.
if %?SUBDIRS%
	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
	  if test "$$subdir" = .; then :; else \
	    $(am__make_dryrun) \
	      || test -d "$(distdir)/$$subdir" \
	      || $(MKDIR_P) "$(distdir)/$$subdir" \
	      || exit 1; \
	    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" \
## Disable am__remove_distdir so that sub-packages do not clear a
## directory we have already cleared and might even have populated
## (e.g. shared AUX dir in the sub-package).
		am__remove_distdir=: \
## Disable filename length check:
		am__skip_length_check=: \
## No need to fix modes more than once:
		am__skip_mode_fix=: \
	        distdir) \
	      || exit 1; \
	  fi; \
	done
endif %?SUBDIRS%
##
## We might have to perform some last second updates, such as updating
## info files.
## We must explicitly set distdir and top_distdir for these sub-makes.
##
if %?DIST-TARGETS%
	$(MAKE) $(AM_MAKEFLAGS) \
	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
	  %DIST-TARGETS%
endif %?DIST-TARGETS%
##
## This complex find command will try to avoid changing the modes of
## links into the source tree, in case they're hard-linked.
##
## Ignore return result from chmod, because it might give an error
## if we chmod a symlink.
##
## Another nastiness: if the file is unreadable by us, we make it
## readable regardless of the number of links to it.  This only
## happens in perverse cases.
##
## We use $(install_sh) because that is a known-portable way to modify
## the file in place in the source tree.
##
## If we are being invoked recursively, then there is no need to walk
## the whole subtree again.  This is a complexity reduction for a deep
## hierarchy of subpackages.
##
if %?TOPDIR_P%
	-test -n "$(am__skip_mode_fix)" \
	|| find "$(distdir)" -type d ! -perm -755 \
		-exec chmod u+rwx,go+rx {} \; -o \
	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
	|| chmod -R a+r "$(distdir)"
if %?FILENAME_FILTER%
	@if test -z "$(am__skip_length_check)" && find "$(distdir)" -type f -print | \
	  grep '^%FILENAME_FILTER%' 1>&2; then \
	  echo 'error: the above filenames are too long' 1>&2; \
	  exit 1; \
	else :; fi
endif %?FILENAME_FILTER%
endif %?TOPDIR_P%



## --------------------------------------- ##
## Building various distribution flavors.  ##
## --------------------------------------- ##

## Note that we don't use GNU tar's '-z' option.  One reason (but not
## the only reason) is that some versions of tar (e.g., OSF1)
## interpret '-z' differently.
##
## The -o option of GNU tar used to exclude empty directories.  This
## behavior was fixed in tar 1.12 (released on 1997-04-25).  But older
## versions of tar are still used (for instance NetBSD 1.6.1 ships
## with tar 1.11.2).  We do not do anything specific w.r.t. this
## incompatibility since packages where empty directories need to be
## present in the archive are really unusual.
##
## We order DIST_TARGETS by expected duration of the compressors,
## slowest first, for better parallelism in "make dist".  Do not
## reorder DIST_ARCHIVES, users may expect gzip to be first.
##
## Traditionally, gzip prepended the contents of the GZIP environment
## variable to its arguments, and the commands below formerly used
## this by invoking 'GZIP=$(GZIP_ENV) gzip'.  The GZIP environment
## variable is now considered to be obsolescent, so the commands below
## now use 'eval GZIP= gzip $(GZIP_ENV)' instead; this should work
## with both older and newer gzip implementations.  The 'eval' is to
## support makefile assignments like 'GZIP_ENV = "-9 -n"' that quote
## the GZIP_ENV right-hand side because that was needed with the
## former invocation pattern.

if %?TOPDIR_P%

?GZIP?DIST_ARCHIVES += $(distdir).tar.gz
GZIP_ENV = --best
.PHONY: dist-gzip
dist-gzip: distdir
	tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
	$(am__post_remove_distdir)

?BZIP2?DIST_ARCHIVES += $(distdir).tar.bz2
.PHONY: dist-bzip2
dist-bzip2: distdir
	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
	$(am__post_remove_distdir)

?LZIP?DIST_ARCHIVES += $(distdir).tar.lz
.PHONY: dist-lzip
dist-lzip: distdir
	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
	$(am__post_remove_distdir)

?XZ?DIST_ARCHIVES += $(distdir).tar.xz
.PHONY: dist-xz
dist-xz: distdir
	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
	$(am__post_remove_distdir)

?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z
.PHONY: dist-tarZ
dist-tarZ: distdir
	@echo WARNING: "Support for distribution archives compressed with" \
		       "legacy program 'compress' is deprecated." >&2
	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
	$(am__post_remove_distdir)

?SHAR?DIST_ARCHIVES += $(distdir).shar.gz
.PHONY: dist-shar
dist-shar: distdir
	@echo WARNING: "Support for shar distribution archives is" \
	               "deprecated." >&2
	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
	shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
	$(am__post_remove_distdir)

?ZIP?DIST_ARCHIVES += $(distdir).zip
.PHONY: dist-zip
dist-zip: distdir
	-rm -f $(distdir).zip
	zip -rq $(distdir).zip $(distdir)
	$(am__post_remove_distdir)

?LZIP?DIST_TARGETS += dist-lzip
?XZ?DIST_TARGETS += dist-xz
?SHAR?DIST_TARGETS += dist-shar
?BZIP2?DIST_TARGETS += dist-bzip2
?GZIP?DIST_TARGETS += dist-gzip
?ZIP?DIST_TARGETS += dist-zip
?COMPRESS?DIST_TARGETS += dist-tarZ

endif %?TOPDIR_P%



## ------------------------------------------------- ##
## Building all the requested distribution flavors.  ##
## ------------------------------------------------- ##

## Currently we cannot use if/endif inside a rule.  The file_contents
## parser needs work.

if %?TOPDIR_P%

.PHONY: dist dist-all
if %?SUBDIRS%
AM_RECURSIVE_TARGETS += dist dist-all
endif %?SUBDIRS%

dist dist-all:
	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
	$(am__post_remove_distdir)

endif %?TOPDIR_P%


## ------------------------- ##
## Checking a distribution.  ##
## ------------------------- ##


if %?TOPDIR_P%
if %?SUBDIRS%
AM_RECURSIVE_TARGETS += distcheck
endif %?SUBDIRS%

# This target untars the dist file and tries a VPATH configuration.  Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
.PHONY: distcheck
distcheck: dist
	case '$(DIST_ARCHIVES)' in \
	*.tar.gz*) \
	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
	*.tar.bz2*) \
	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
	*.tar.lz*) \
	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
	*.tar.xz*) \
	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
	*.tar.Z*) \
	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
	*.shar.gz*) \
	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
	*.zip*) \
	  unzip $(distdir).zip ;;\
	esac
## Make the new source tree read-only.  Distributions ought to work in
## this case.  However, make the top-level directory writable so we
## can make our new subdirs.
	chmod -R a-w $(distdir)
	chmod u+w $(distdir)
	mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
## Undo the write access.
	chmod a-w $(distdir)
## With GNU make, the following command will be executed even with "make -n",
## due to the presence of '$(MAKE)'.  That is normally all well (and '$(MAKE)'
## is necessary for things like parallel distcheck), but here we don't want
## execution.  To avoid MAKEFLAGS parsing hassles, use a witness file that a
## non-'-n' run would have just created.
	test -d $(distdir)/_build || exit 0; \
## Compute the absolute path of '_inst'.  Strip any leading DOS drive
## to allow DESTDIR installations.  Otherwise "$(DESTDIR)$(prefix)" would
## expand to "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst".
	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
## We will attempt a DESTDIR install in $dc_destdir.  We don't
## create this directory under $dc_install_base, because it would
## create very long directory names.
	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
?DISTCHECK-HOOK?	  && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
## Parallel BSD make may not start a new shell for each command in a recipe,
## so be sure to 'cd' back to the original directory after this.
	  && am__cwd=`pwd` \
## If we merely used '$(distdir)/_build' here, "make distcheck" could
## sometimes fail to detect missing files in the distribution tarball,
## especially in those cases where both the generated files and their
## dependencies are explicitly in $(srcdir).  See automake bug#18286.
	  && $(am__cd) $(distdir)/_build/sub \
	  && ../../configure \
?GETTEXT?	    --with-included-gettext \
## Additional flags for configure.
	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
	    $(DISTCHECK_CONFIGURE_FLAGS) \
## At the moment, the code doesn't actually support changes in these --srcdir
## and --prefix values, so don't allow them to be overridden by the user or
## the developer.  That used to be allowed, and caused issues in practice
## (in corner-case usages); see automake bug#14991.
	    --srcdir=../.. --prefix="$$dc_install_base" \
	  && $(MAKE) $(AM_MAKEFLAGS) \
	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
	  && $(MAKE) $(AM_MAKEFLAGS) check \
	  && $(MAKE) $(AM_MAKEFLAGS) install \
	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
	        distuninstallcheck \
## Make sure the package has proper DESTDIR support (we could not test this
## in the previous install/installcheck/uninstall test, because it's reasonable
## for installcheck to fail in a DESTDIR install).
## We make the '$dc_install_base' read-only because this is where files
## with missing DESTDIR support are likely to be installed.
	  && chmod -R a-w "$$dc_install_base" \
## The logic here is quite convoluted because we must clean $dc_destdir
## whatever happens (it won't be erased by the next run of distcheck like
## $(distdir) is).
	  && ({ \
## Build the directory, so we can cd into it even if "make install"
## didn't create it.  Use mkdir, not $(MKDIR_P) because we want to
## fail if the directory already exists (PR/413).
	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
	  && rm -rf "$$dc_destdir" \
	  && $(MAKE) $(AM_MAKEFLAGS) dist \
## Make sure to remove the dists we created in the test build directory.
	  && rm -rf $(DIST_ARCHIVES) \
	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
## Cater to parallel BSD make (see above).
	  && cd "$$am__cwd" \
	  || exit 1
	$(am__post_remove_distdir)
	@(echo "$(distdir) archives ready for distribution: "; \
	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'

## Define distuninstallcheck_listfiles and distuninstallcheck separately
## from distcheck, so that they can be overridden by the user.
.PHONY: distuninstallcheck
distuninstallcheck_listfiles = find . -type f -print
## The 'dir' file (created by install-info) might still exist after
## uninstall, so we must be prepared to account for it.  The following
## check is not 100% strict, but is definitely good enough, and even
## accounts for overridden $(infodir).
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distuninstallcheck:
	@test -n '$(distuninstallcheck_dir)' || { \
	  echo 'ERROR: trying to run $@ with an empty' \
	       '$$(distuninstallcheck_dir)' >&2; \
	  exit 1; \
	}; \
	$(am__cd) '$(distuninstallcheck_dir)' || { \
	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
	  exit 1; \
	}; \
	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
	   || { echo "ERROR: files left after uninstall:" ; \
	        if test -n "$(DESTDIR)"; then \
	          echo "  (check DESTDIR support)"; \
	        fi ; \
	        $(distuninstallcheck_listfiles) ; \
	        exit 1; } >&2

## Define distcleancheck_listfiles and distcleancheck separately
## from distcheck, so that they can be overridden by the user.
.PHONY: distcleancheck
distcleancheck_listfiles = find . -type f -print
distcleancheck: distclean
	@if test '$(srcdir)' = . ; then \
	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
	  exit 1 ; \
	fi
	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
	  || { echo "ERROR: files left in build directory after distclean:" ; \
	       $(distcleancheck_listfiles) ; \
	       exit 1; } >&2
endif %?TOPDIR_P%
am/lex.am000064400000002454150523165450006263 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.

## See the comment about am__skipyacc in yacc.am.
if %?MAINTAINER-MODE%
if %?FIRST%
@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ ||
endif %?FIRST%
endif %?MAINTAINER-MODE%

?GENERIC?%EXT%%DERIVED-EXT%:
?!GENERIC?%OBJ%: %SOURCE%
?GENERIC?	%VERBOSE%$(am__skiplex) $(SHELL) $(YLWRAP) %SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE%
?!GENERIC?	%VERBOSE% \
?!GENERIC??DIST_SOURCE?	$(am__skiplex) \
## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
?!GENERIC?	$(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE%
am/subdirs.am000064400000005464150523165450007152 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

RECURSIVE_TARGETS += all-recursive check-recursive installcheck-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
  distclean-recursive maintainer-clean-recursive

am__recursive_targets = \
  $(RECURSIVE_TARGETS) \
  $(RECURSIVE_CLEAN_TARGETS) \
  $(am__extra_recursive_targets)

## All documented targets which invoke 'make' recursively, or depend
## on targets that do so.  GNUmakefile from gnulib depends on this.
AM_RECURSIVE_TARGETS += $(am__recursive_targets:-recursive=)

.PHONY .MAKE: $(am__recursive_targets)

# 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.

$(am__recursive_targets):
## Using $failcom allows "-k" to keep its natural meaning when running a
## recursive rule.
	@fail=; \
	if $(am__make_keepgoing); then \
	  failcom='fail=yes'; \
	else \
	  failcom='exit 1'; \
	fi; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; \
## For distclean and maintainer-clean we make sure to use the full
## list of subdirectories.  We do this so that 'configure; make
## distclean' really is a no-op, even if SUBDIRS is conditional.
	case "$@" in \
	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
	  *) list='$(SUBDIRS)' ;; \
	esac; \
	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"

mostlyclean: mostlyclean-recursive
clean: clean-recursive
distclean: distclean-recursive
maintainer-clean: maintainer-clean-recursive
am/footer.am000064400000001562150523165450006770 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

# 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:
am/check2.am000064400000004224150523165450006627 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2008-2018 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, see <https://www.gnu.org/licenses/>.

if %?FIRST%
## When BSD make is run in parallel mode, it apparently strips any
## leading directory component from the automatic variable '$*' (of
## course, against what POSIX mandates).  Try to detect and work
## around this incompatibility.
am__set_b = \
  case '$@' in \
    */*) \
      case '$*' in \
        */*) b='$*';; \
          *) b=`echo '$@' | sed 's/\.log$$//'`; \
       esac;; \
    *) \
      b='$*';; \
  esac
endif %?FIRST%

## From a test file to a .log and .trs file.
?GENERIC?%EXT%.log:
?!GENERIC?%OBJ%: %SOURCE%
	@p='%SOURCE%'; \
## Another hack to support BSD make in parallel mode.
?!GENERIC?	b='%BASE%'; \
?GENERIC?	$(am__set_b); \
	$(am__check_pre) %DRIVER% --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) %DRIVER_FLAGS% -- %COMPILE% \
	"$$tst" $(AM_TESTS_FD_REDIRECT)

## If no programs are built in this package, then this rule is removed
## at automake time.  Otherwise, %am__EXEEXT% expands to a configure time
## conditional, true if $(EXEEXT) is nonempty, thus this rule does not
## conflict with the previous one.
if %am__EXEEXT%
?GENERIC?%EXT%$(EXEEXT).log:
	@p='%SOURCE%'; \
	## Another hack to support BSD make in parallel mode.
?!GENERIC?	b='%BASE%'; \
?GENERIC?	$(am__set_b); \
	$(am__check_pre) %DRIVER% --test-name "$$f" \
	--log-file $$b.log --trs-file $$b.trs \
	$(am__common_driver_flags) %DRIVER_FLAGS% -- %COMPILE% \
	"$$tst" $(AM_TESTS_FD_REDIRECT)
endif %am__EXEEXT%
am/library.am000064400000001721150523165450007133 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

%LIBRARY%: $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_DEPENDENCIES) $(EXTRA_%XLIBRARY%_DEPENDENCIES) %DIRSTAMP%
	%SILENT%-rm -f %LIBRARY%
	%VERBOSE%$(%XLIBRARY%_AR) %LIBRARY% $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_LIBADD)
	%SILENT%$(RANLIB) %LIBRARY%
am/progs.am000064400000014367150523165450006633 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

## ------------ ##
## Installing.  ##
## ------------ ##

if %?INSTALL%
am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
?EXEC?.PHONY install-exec-am: install-%DIR%PROGRAMS
?!EXEC?.PHONY install-data-am: install-%DIR%PROGRAMS
install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
	@$(NORMAL_INSTALL)
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
	@list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	fi; \
	for p in $$list; do echo "$$p $$p"; done | \
## On Cygwin with libtool test won't see 'foo.exe' but instead 'foo'.
## So we check for both.
	sed 's/$(EXEEXT)$$//' | \
	while read p p1; do if test -f $$p \
?LIBTOOL?	 || test -f $$p1 \
	  ; then echo "$$p"; echo "$$p"; else :; fi; \
	done | \
## We now have a list of sourcefile pairs, separated by newline.
## Turn that into "sourcefile source_base target_dir xformed_target_base",
## with newlines being turned into spaces in a second step.
	sed -e 'p;s,.*/,,;n;h' \
?BASE?	    -e 's|.*|.|' \
?!BASE?	    -e 's|[^/]*$$||; s|^$$|.|' \
	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
	sed 'N;N;N;s,\n, ,g' | \
## The following awk script turns that into one line containing directories
## and then lines of 'type target_name_or_directory sources ...', with type
## 'd' designating directories, and 'f' files.
	$(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 \
?!BASE?	  case $$type in \
?!BASE?	  d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
?!BASE?	     $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
?!BASE?	  f) \
	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
	    test -z "$$files" || { \
?!LIBTOOL?	      echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
?!LIBTOOL?	      $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
## Note that we explicitly set the libtool mode.  This avoids any
## lossage if the install program doesn't have a name that libtool
## expects.
?LIBTOOL?	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
?LIBTOOL?	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
	    } \
?!BASE?	  ;; esac \
	; done

endif %?INSTALL%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?INSTALL%
.PHONY uninstall-am: uninstall-%DIR%PROGRAMS
uninstall-%DIR%PROGRAMS:
	@$(NORMAL_UNINSTALL)
	@list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
	files=`for p in $$list; do echo "$$p"; done | \
## Remove any leading directory before applying $(transform),
## but keep the directory part in the hold buffer, in order to
## reapply it again afterwards in the nobase case.  Append $(EXEEXT).
	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
	      -e 's/$$/$(EXEEXT)/' \
?!BASE?	      -e 'x;s,[^/]*$$,,;G;s,\n,,' \
	`; \
	test -n "$$list" || exit 0; \
	echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$files ")"; \
	cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files
endif %?INSTALL%


## ---------- ##
## Cleaning.  ##
## ---------- ##

.PHONY clean-am: clean-%DIR%PROGRAMS
clean-%DIR%PROGRAMS:
?!LIBTOOL?	-test -z "$(%DIR%_PROGRAMS)" || rm -f $(%DIR%_PROGRAMS)
## Under Cygwin, we build 'program$(EXEEXT)'.  However, if this
## program uses a Libtool library, Libtool will move it in
## '_libs/program$(EXEEXT)' and create a 'program' wrapper (without
## '$(EXEEXT)').  Therefore, if Libtool is used, we must try to erase
## both 'program$(EXEEXT)' and 'program'.
## Cleaning the '_libs/' or '.libs/' directory is done from clean-libtool.
## FIXME: In the future (i.e., when it works) it would be nice to delegate
## this task to "libtool --mode=clean".
?LIBTOOL?	@list='$(%DIR%_PROGRAMS)'; test -n "$$list" || exit 0; \
?LIBTOOL?	echo " rm -f" $$list; \
?LIBTOOL?	rm -f $$list || exit $$?; \
?LIBTOOL?	test -n "$(EXEEXT)" || exit 0; \
?LIBTOOL?	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
?LIBTOOL?	echo " rm -f" $$list; \
?LIBTOOL?	rm -f $$list


## ---------- ##
## Checking.  ##
## ---------- ##

if %?CK-OPTS%
.PHONY installcheck-am: installcheck-%DIR%PROGRAMS
installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
	bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
	  case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
## Match $(srcdir)/$$p in addition to $$p because Sun make might rewrite
## filenames in AM_INSTALLCHECK_STD_OPTIONS_EXEMPT during VPATH builds.
	   *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
	  esac; \
## Strip the directory and $(EXEEXT) before applying $(transform).
	  f=`echo "$$p" | \
	     sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
## Insert the directory back if nobase_ is used.
?!BASE?	  f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
	  for opt in --help --version; do \
	    if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt >c$${pid}_.out \
	         2>c$${pid}_.err </dev/null \
		 && test -n "`cat c$${pid}_.out`" \
		 && test -z "`cat c$${pid}_.err`"; then :; \
	    else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
	  done; \
	done; rm -f c$${pid}_.???; exit $$bad
endif %?CK-OPTS%
am/header-vars.am000064400000014367150523165450007702 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

VPATH = @srcdir@

@SET_MAKE@

## We used to define this.  However, we don't because vendor makes
## (e.g., Solaris, Irix) won't correctly propagate variables that are
## defined in Makefile.  This particular variable can't be correctly
## defined by configure (at least, not the current configure), so we
## simply avoid defining it to allow the user to use this feature with
## a vendor make.
## DESTDIR =

## Shell code that determines whether we are running under GNU make.
##
## Why the this needs to be so convoluted?
##
## (1) We can't unconditionally use make functions or special variables
##     starting with a dot, as those cause non-GNU implmentations to
##     crash hard.
##
## (2) We can't use $(MAKE_VERSION) here, as it is also defined in some
##     non-GNU make implementations (e.g., FreeBSD make).  But at least
##     BSD make does *not* define the $(CURDIR) variable -- it uses
##     $(.CURDIR) instead.
##
## (3) We can't use $(MAKEFILE_LIST) here, as in some situations it
##     might cause the shell to die with "Arg list too long" (see
##     automake bug#18744).
##
## (4) We can't use $(MAKE_HOST) unconditionally, as it is only
##     defined in GNU make 4.0 or later.
##
am__is_gnu_make = { \
  if test -z '$(MAKELEVEL)'; then \
    false; \
  elif test -n '$(MAKE_HOST)'; then \
    true; \
  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
    true; \
  else \
    false; \
  fi; \
}

## Shell code that determines whether the current make instance is
## running with a given one-letter option (e.g., -k, -n) that takes
## no argument.
am__make_running_with_option = \
  case $${target_option-} in \
      ?) ;; \
      *) echo "am__make_running_with_option: internal error: invalid" \
              "target option '$${target_option-}' specified" >&2; \
         exit 1;; \
  esac; \
  has_opt=no; \
  sane_makeflags=$$MAKEFLAGS; \
  if $(am__is_gnu_make); then \
## The format of $(MAKEFLAGS) is quite tricky with GNU make; the
## variable $(MFLAGS) behaves much better in that regard.  So use it.
    sane_makeflags=$$MFLAGS; \
  else \
## Non-GNU make: we must rely on $(MAKEFLAGS).  This is tricker and more
## brittle, but is the best we can do.
    case $$MAKEFLAGS in \
## If we run "make TESTS='snooze nap'", FreeBSD make will export MAKEFLAGS
## to " TESTS=foo\ nap", so that the simpler loop below (on word-split
## $$MAKEFLAGS) would see a "make flag" equal to "nap", and would wrongly
## misinterpret that as and indication that make is running in dry mode.
## This has already happened in practice.  So we need this hack.
      *\\[\ \	]*) \
## Extra indirection with ${bs} required by FreeBSD 8.x make.
## Not sure why (so sorry for the cargo-cult programming here).
        bs=\\; \
        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
    esac; \
  fi; \
  skip_next=no; \
  strip_trailopt () \
  { \
    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
  }; \
  for flg in $$sane_makeflags; do \
    test $$skip_next = yes && { skip_next=no; continue; }; \
    case $$flg in \
      *=*|--*) continue;; \
##
## GNU make 4.0 has changed the format of $MFLAGS, and removed the space
## between an option and its argument (e.g., from "-I dir" to "-Idir").
## So we need to handle both formats, at least for options valid in GNU
## make.  OTOH, BSD make formats $(MAKEFLAGS) by separating all options,
## and separating any option from its argument, so things are easier
## there.
##
## For GNU make and BSD make.
        -*I) strip_trailopt 'I'; skip_next=yes;; \
      -*I?*) strip_trailopt 'I';; \
## For GNU make >= 4.0.
        -*O) strip_trailopt 'O'; skip_next=yes;; \
      -*O?*) strip_trailopt 'O';; \
## For GNU make (possibly overkill, this one).
        -*l) strip_trailopt 'l'; skip_next=yes;; \
      -*l?*) strip_trailopt 'l';; \
## For BSD make.
      -[dEDm]) skip_next=yes;; \
## For NetBSD make.
      -[JT]) skip_next=yes;; \
    esac; \
    case $$flg in \
      *$$target_option*) has_opt=yes; break;; \
    esac; \
  done; \
  test $$has_opt = yes

## Shell code that determines whether make is running in "dry mode"
## ("make -n") or not.  Useful in rules that invoke make recursively,
## and are thus executed also with "make -n" -- either because they
## are declared as dependencies to '.MAKE' (NetBSD make), or because
## their recipes contain the "$(MAKE)" string (GNU and Solaris make).
am__make_dryrun = (target_option=n; $(am__make_running_with_option))

## Shell code that determines whether make is running in "keep-going mode"
## ("make -k") or not.  Useful in rules that must recursively descend into
## subdirectories, and decide whether to stop at the first error or not.
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))

## Some derived variables that have been found to be useful.
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)

## These are defined because otherwise make on NetBSD V1.1 will print
## (eg): $(NORMAL_INSTALL) expands to empty string.
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :

## dejagnu.am uses these variables.  Some users might rely on them too.
?BUILD?build_triplet = @build@
?HOST?host_triplet = @host@
?TARGET?target_triplet = @target@
am/install.am000064400000007632150523165450007144 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.

## ----------------------------------------- ##
## installdirs -- Creating the installdirs.  ##
## ----------------------------------------- ##

## The reason we loop over %am__installdirs% (instead of simply running
## $(MKDIR_P) %am__installdirs%) is that directories variable such as
## "$(DESTDIR)$(mydir)" can potentially expand to "" if $(mydir) is
## conditionally defined.  BTW, those directories are quoted in order
## to support installation paths with spaces.

if %?SUBDIRS%
.PHONY: installdirs installdirs-am
RECURSIVE_TARGETS += installdirs-recursive
installdirs: installdirs-recursive
installdirs-am:%installdirs-local%
?am__installdirs?	for dir in %am__installdirs%; do \
?am__installdirs?	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
?am__installdirs?	done
else !%?SUBDIRS%
.PHONY: installdirs
installdirs:%installdirs-local%
?am__installdirs?	for dir in %am__installdirs%; do \
?am__installdirs?	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
?am__installdirs?	done
endif !%?SUBDIRS%


## ----------------- ##
## Install targets.  ##
## ----------------- ##

.PHONY: install install-exec install-data uninstall
.PHONY: install-exec-am install-data-am uninstall-am

if %?SUBDIRS%
RECURSIVE_TARGETS += install-data-recursive install-exec-recursive \
		     install-recursive uninstall-recursive
install:%maybe_BUILT_SOURCES% install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
else !%?SUBDIRS%
install:%maybe_BUILT_SOURCES% install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
endif !%?SUBDIRS%

if %?maybe_BUILT_SOURCES%
.MAKE: install
endif %?maybe_BUILT_SOURCES%

.MAKE .PHONY: install-am
install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am


.PHONY: installcheck
?SUBDIRS?installcheck: installcheck-recursive
?!SUBDIRS?installcheck: installcheck-am
?!SUBDIRS?.PHONY: installcheck-am
?!SUBDIRS?installcheck-am:

## If you ever modify this, keep in mind that INSTALL_PROGRAM is used
## in subdirectories, so never set it to a value relative to the top
## directory.
.MAKE .PHONY: install-strip
install-strip:
## Beware that there are two variables used to install programs:
##   INSTALL_PROGRAM is used for ordinary *_PROGRAMS
##   install_sh_PROGRAM is used for nobase_*_PROGRAMS (because install-sh
##                                                     creates directories)
## It's OK to override both with INSTALL_STRIP_PROGRAM, because
## INSTALL_STRIP_PROGRAM uses install-sh (see m4/strip.m4 for a rationale).
##
## Use double quotes for the *_PROGRAM settings because we might need to
## interpolate some backquotes at runtime.
##
## The case for empty $(STRIP) is separate so that it is quoted correctly for
## multiple words, but does not expand to an empty words if STRIP is empty.
	if test -z '$(STRIP)'; then \
	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	      install; \
	else \
	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
	fi
am/depend.am000064400000002246150523165450006731 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

am__mv = mv -f

$(am__depfiles_remade):
	@$(MKDIR_P) $(@D)
	@echo '# dummy' >$@-t && $(am__mv) $@-t $@

am--depfiles: $(am__depfiles_remade)
.PHONY: am--depfiles

## This Makefile depends on Depdirs' files, so we should never
## erase them in -am or -recursive rules; that would prevent any other
## rules from being recursive (for instance multilib clean rules are
## recursive).
if %?DISTRMS%
distclean:
	%DISTRMS%
maintainer-clean:
	%DISTRMS%
endif
am/texi-vers.am000064400000004651150523165450007422 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

DIST_COMMON += %VTEXI% %STAMPVTI%

## Don't give this rule a command (even '@:').
## %STAMPVTI% is always newer than %VTEXI%, so this rule is always
## triggered.  If you equip this rule with a command, GNU make will
## assume %VTEXI% has been rebuild in the current directory and
## discard any %VTEXI% file found in a VPATH search.
%VTEXI%: %MAINTAINER-MODE% %STAMPVTI%

## Depend on configure so that version number updates cause a rebuild.
## (Not configure.ac, because not all setups define the version number
## in this file.)
%STAMPVTI%: %TEXI% $(top_srcdir)/configure
## It is wrong to have %STAMPVTI% dependent on %DIRSTAMP%, because
## %STAMPVTI% is distributed and %DIRSTAMP% isn't: a distributed file
## should never be dependent upon a non-distributed built file.
## Therefore we ensure that %DIRSTAMP% exists in the rule.
## Use cp + mv so that the update of %VTEXI% is atomic even if
## the source directory is on a different file system.
?DIRSTAMP?	@test -f %DIRSTAMP% || $(MAKE) $(AM_MAKEFLAGS) %DIRSTAMP%
	@(dir=.; test -f ./%TEXI% || dir=$(srcdir); \
	set `$(SHELL) %MDDIR%mdate-sh $$dir/%TEXI%`; \
	echo "@set UPDATED $$1 $$2 $$3"; \
	echo "@set UPDATED-MONTH $$2 $$3"; \
	echo "@set EDITION $(VERSION)"; \
	echo "@set VERSION $(VERSION)") > %VTI%.tmp$$$$ && \
	(cmp -s %VTI%.tmp$$$$ %VTEXI% \
	  || (echo "Updating %VTEXI%" && \
	      cp %VTI%.tmp$$$$ %VTEXI%.tmp$$$$ && \
	      mv %VTEXI%.tmp$$$$ %VTEXI%)) && \
	rm -f %VTI%.tmp$$$$ %VTEXI%.$$$$
	@cp %VTEXI% $@

mostlyclean-am: mostlyclean-%VTI%
mostlyclean-%VTI%:
	-rm -f %VTI%.tmp* %VTEXI%.tmp*

maintainer-clean-am: maintainer-clean-%VTI%
maintainer-clean-%VTI%:
%MAINTAINER-MODE%	-rm -f %STAMPVTI% %VTEXI%

.PHONY: mostlyclean-%VTI% maintainer-clean-%VTI%
am/program.am000064400000002320150523165450007132 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

%PROGRAM%%EXEEXT%: $(%XPROGRAM%_OBJECTS) $(%XPROGRAM%_DEPENDENCIES) $(EXTRA_%XPROGRAM%_DEPENDENCIES) %DIRSTAMP%
## Remove program before linking.  Otherwise the link will fail if the
## program is running somewhere.  FIXME: this could be a loss if
## you're using an incremental linker.  Maybe we should think twice?
## Or maybe not... sadly, incremental linkers are rarer than losing
## systems.
	@rm -f %PROGRAM%%EXEEXT%
	%VERBOSE%$(%XLINK%) $(%XPROGRAM%_OBJECTS) $(%XPROGRAM%_LDADD) $(LIBS)
am/data.am000064400000006507150523165450006407 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

if %?INSTALL%
include inst-vars.am
endif %?INSTALL%

## ------------ ##
## Installing.  ##
## ------------ ##

if %?INSTALL%
am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
?EXEC?.PHONY install-exec-am: install-%DIR%%PRIMARY%
?!EXEC?.PHONY install-data-am: install-%DIR%%PRIMARY%
install-%DIR%%PRIMARY%: $(%DIR%_%PRIMARY%)
	@$(NORMAL_INSTALL)
if %?BASE%
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
	@list='$(%DIR%_%PRIMARY%)'; test -n "$(%NDIR%dir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	fi; \
	for p in $$list; do \
## A file can be in the source directory or the build directory.
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
## If the _%PRIMARY% variable has an entry like foo/bar, install it as
## $(destdir)/bar, not $(destdir)/foo/bar.  The user can make a
## new dir variable or use a nobase_ target for the latter case.
	  echo "$$d$$p"; \
	done | $(am__base_list) | \
	while read files; do \
	  echo " $(INSTALL_%ONE_PRIMARY%) $$files '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(INSTALL_%ONE_PRIMARY%) $$files "$(DESTDIR)$(%NDIR%dir)" || exit $$?; \
	done
else !%?BASE%
	@list='$(%DIR%_%PRIMARY%)'; test -n "$(%NDIR%dir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	fi; \
	$(am__nobase_list) | while read dir files; do \
	  xfiles=; for file in $$files; do \
	    if test -f "$$file"; then xfiles="$$xfiles $$file"; \
	    else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
	  test -z "$$xfiles" || { \
	    test "x$$dir" = x. || { \
	      echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
	      $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
	    echo " $(INSTALL_%ONE_PRIMARY%) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
	    $(INSTALL_%ONE_PRIMARY%) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; }; \
	done
endif !%?BASE%
endif %?INSTALL%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?INSTALL%
.PHONY uninstall-am: uninstall-%DIR%%PRIMARY%
uninstall-%DIR%%PRIMARY%:
	@$(NORMAL_UNINSTALL)
	@list='$(%DIR%_%PRIMARY%)'; test -n "$(%NDIR%dir)" || list=; \
?BASE?	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
?!BASE?	$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
	dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
endif %?INSTALL%


## ---------- ##
## Cleaning.  ##
## ---------- ##

## Nothing.


## -------------- ##
## Distributing.  ##
## -------------- ##

if %?DIST%
DIST_COMMON += %DISTVAR%
endif %?DIST%
am/scripts.am000064400000011152150523165450007155 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

if %?INSTALL%
include inst-vars.am
endif %?INSTALL%

## ------------ ##
## Installing.  ##
## ------------ ##

if %?INSTALL%
## if doesn't work properly for Automake variables yet.
am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
?EXEC?.PHONY install-exec-am: install-%DIR%SCRIPTS
?!EXEC?.PHONY install-data-am: install-%DIR%SCRIPTS
install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
	@$(NORMAL_INSTALL)
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
	@list='$(%DIR%_SCRIPTS)'; test -n "$(%NDIR%dir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	fi; \
?!BASE?	$(am__nobase_strip_setup); \
	for p in $$list; do \
## A file can be in the source directory or the build directory.
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
## A script may or may not exist.
	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
	done | \
## We now have a list of "sourcefile newline (nobase-)target" pairs.
## Turn that into "sourcefile source_base target_dir xformed_target_base",
## with newlines being turned into spaces in a second step.
	sed -e 'p;s,.*/,,;n' \
?BASE?	    -e 'h;s|.*|.|' \
?!BASE?	    -e "s|$$srcdirstrip/||" -e 'h;s|[^/]*$$||; s|^$$|.|' \
	    -e 'p;x;s,.*/,,;$(transform)' | 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; \
	      if (++n[d] == $(am__install_max)) { \
		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
	    else { print "f", d "/" $$4, $$1 } } \
	  END { for (d in files) print "f", d, files[d] }' | \
	while read type dir files; do \
?!BASE?	  case $$type in \
?!BASE?	  d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
?!BASE?	     $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
?!BASE?	  f) \
	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
	     test -z "$$files" || { \
	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
	     } \
?!BASE?	  ;; esac \
	; done
endif %?INSTALL%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?INSTALL%
.PHONY uninstall-am: uninstall-%DIR%SCRIPTS
uninstall-%DIR%SCRIPTS:
	@$(NORMAL_UNINSTALL)
	@list='$(%DIR%_SCRIPTS)'; test -n "$(%NDIR%dir)" || exit 0; \
?BASE?	files=`for p in $$list; do echo "$$p"; done | \
?BASE?	       sed -e 's,.*/,,;$(transform)'`; \
?!BASE?	$(am__nobase_strip_setup); \
?!BASE?	files=`$(am__nobase_strip) \
?!BASE?	       -e 'h;s,.*/,,;$(transform);x;s|[^/]*$$||;G;s,\n,,'`; \
	dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
endif %?INSTALL%


## -------------- ##
## Distributing.  ##
## -------------- ##

if %?DIST%
DIST_COMMON += %DISTVAR%
endif %?DIST%


## ---------- ##
## Checking.  ##
## ---------- ##

if %?CK-OPTS%
.PHONY installcheck-am: installcheck-%DIR%SCRIPTS
installcheck-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
	bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
	  case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
## Match $(srcdir)/$$p in addition to $$p because Sun make might rewrite
## filenames in AM_INSTALLCHECK_STD_OPTIONS_EXEMPT during VPATH builds.
	   *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
	  esac; \
## Strip any leading directory before applying $(transform).
	  f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \
## Insert the directory back if nobase_ is used.
?!BASE?	  f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
	  for opt in --help --version; do \
	    if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt >c$${pid}_.out \
	         2>c$${pid}_.err </dev/null \
		 && test -n "`cat c$${pid}_.out`" \
		 && test -z "`cat c$${pid}_.err`"; then :; \
	    else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
	  done; \
	done; rm -f c$${pid}_.???; exit $$bad
endif %?CK-OPTS%
am/header.am000064400000001423150523165450006716 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.


## Exactly the same as data.am.
include data.am
am/remake-hdr.am000064400000006223150523165450007510 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

%CONFIG_H%: %STAMP%
## Recover from removal of CONFIG_HEADER.
	@test -f $@ || rm -f %STAMP%
	@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %STAMP%


%STAMP%: %CONFIG_H_DEPS% $(top_builddir)/config.status
	@rm -f %STAMP%
	cd $(top_builddir) && $(SHELL) ./config.status %CONFIG_H_PATH%


## Only the first file of AC_CONFIG_HEADERS is assumed to be generated
## by autoheader.
if %?FIRST-HDR%
%CONFIG_HIN%: %MAINTAINER-MODE% $(am__configure_deps) %FILES%
## Cater to parallel BSD make.
	($(am__cd) $(top_srcdir) && $(AUTOHEADER))
## Whenever $(AUTOHEADER) has run, we must make sure that
## ./config.status will rebuild config.h.  The dependency from %STAMP%
## on %CONFIG_H_DEPS% (which contains config.hin) is not enough to
## express this.
##
## There are some tricky cases where this rule will build a
## config.hin which has the same timestamp as %STAMP%, in which case
## ./config.status will not be rerun (meaning that users will use an
## out-of-date config.h without knowing it).  One situation where this
## can occur is the following:
## 1. the user updates some configure dependency (let's say foo.m4)
##    and runs 'make';
## 2. the rebuild rules detect that a foo.m4 has changed,
##    run aclocal, autoconf, automake, and then run ./config.status.
##    (Note that autoheader hasn't been called yet, so ./config.status
##    outputs a config.h from an obsolete config.hin);
## 3. once Makefile has been regenerated, make continues, and
##    discovers that config.h is a dependency of the 'all' rule.
##    Because config.h depends on stamp-h1, stamp-h1 depends on
##    config.hin, and config.hin depends on aclocal.m4, make runs
##    autoheader to rebuild config.hin.
## Now make ought to call ./config.status once again to rebuild
## config.h from the new config.hin, but if you have a sufficiently
## fast box, steps 2 and 3 will occur within the same second: the
## config.h/stamp-h1 generated from the outdated config.hin will have
## the same mtime as the new config.hin.  Hence make will think that
## config.h is up to date.
##
## A solution is to erase %STAMP% here so that the %STAMP% rule
## is always triggered after the this one.
	rm -f %STAMP%
## Autoheader has the bad habit of not changing the timestamp if
## config.hin is unchanged, which breaks Make targets.  Since what
## must not changed gratuitously is config.h, which is already handled
## by config.status, there is no reason to make things complex for
## config.hin.
	touch $@
endif %?FIRST-HDR%
am/check.am000064400000053202150523165450006545 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.

am__tty_colors_dummy = \
  mgn= red= grn= lgn= blu= brg= std=; \
  am__color_tests=no

am__tty_colors = { \
  $(am__tty_colors_dummy); \
  if test "X$(AM_COLOR_TESTS)" = Xno; then \
    am__color_tests=no; \
  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
    am__color_tests=yes; \
## If stdout is a non-dumb tty, use colors.  If test -t is not supported,
## then this check fails; a conservative approach.  Of course do not
## redirect stdout here, just stderr.
  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
    am__color_tests=yes; \
  fi; \
  if test $$am__color_tests = yes; then \
    red=''; \
    grn=''; \
    lgn=''; \
    blu=''; \
    mgn=''; \
    brg=''; \
    std=''; \
  fi; \
}

.PHONY: check-TESTS

if !%?SERIAL_TESTS%

include inst-vars.am

## New parallel test driver.
##
## The first version of the code here was adapted from check.mk, which was
## originally written at EPITA/LRDE, further developed at Gostai, then made
## its way from GNU coreutils to end up, largely rewritten, in Automake.
## The current version is an heavy rewrite of that, to allow for support
## of more test metadata, and the use of custom test drivers and protocols
## (among them, TAP).

am__recheck_rx = ^[ 	]*:recheck:[ 	]*
am__global_test_result_rx = ^[ 	]*:global-test-result:[ 	]*
am__copy_in_global_log_rx = ^[ 	]*:copy-in-global-log:[ 	]*

# A command that, given a newline-separated list of test names on the
# standard input, print the name of the tests that are to be re-run
# upon "make recheck".
am__list_recheck_tests = $(AWK) '{ \
## By default, we assume the test is to be re-run.
  recheck = 1; \
  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
    { \
      if (rc < 0) \
        { \
## If we've encountered an I/O error here, there are three possibilities:
##
##  [1] The '.log' file exists, but the '.trs' does not; in this case,
##      we "gracefully" recover by assuming the corresponding test is
##      to be re-run (which will re-create the missing '.trs' file).
##
##  [2] Both the '.log' and '.trs' files are missing; this means that
##      the corresponding test has not been run, and is thus *not* to
##      be re-run.
##
##  [3] We have encountered some corner-case problem (e.g., a '.log' or
##      '.trs' files somehow made unreadable, or issues with a bad NFS
##      connection, or whatever); we don't handle such corner cases.
##
          if ((getline line2 < ($$0 ".log")) < 0) \
	    recheck = 0; \
          break; \
        } \
      else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
## A directive explicitly specifying the test is *not* to be re-run.
        { \
          recheck = 0; \
          break; \
        } \
      else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
        { \
## A directive explicitly specifying the test *is* to be re-run.
          break; \
        } \
## else continue with the next iteration.
    }; \
  if (recheck) \
    print $$0; \
## Don't leak open file descriptors, as this could cause serious
## problems when there are many tests (yes, even on Linux).
  close ($$0 ".trs"); \
  close ($$0 ".log"); \
}'

# A command that, given a newline-separated list of test names on the
# standard input, create the global log from their .trs and .log files.
am__create_global_log = $(AWK) ' \
function fatal(msg) \
{ \
  print "fatal: making $@: " msg | "cat >&2"; \
  exit 1; \
} \
function rst_section(header) \
{ \
  print header; \
  len = length(header); \
  for (i = 1; i <= len; i = i + 1) \
    printf "="; \
  printf "\n\n"; \
} \
{ \
## By default, we assume the test log is to be copied in the global log,
## and that its result is simply "RUN" (i.e., we still don't know what
## it outcome was, but we know that at least it has run).
  copy_in_global_log = 1; \
  global_test_result = "RUN"; \
  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
    { \
      if (rc < 0) \
         fatal("failed to read from " $$0 ".trs"); \
      if (line ~ /$(am__global_test_result_rx)/) \
        { \
          sub("$(am__global_test_result_rx)", "", line); \
          sub("[ 	]*$$", "", line); \
          global_test_result = line; \
        } \
      else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
        copy_in_global_log = 0; \
    }; \
  if (copy_in_global_log) \
    { \
      rst_section(global_test_result ": " $$0); \
      while ((rc = (getline line < ($$0 ".log"))) != 0) \
      { \
        if (rc < 0) \
          fatal("failed to read from " $$0 ".log"); \
        print line; \
      }; \
      printf "\n"; \
    }; \
## Don't leak open file descriptors, as this could cause serious
## problems when there are many tests (yes, even on Linux).
  close ($$0 ".trs"); \
  close ($$0 ".log"); \
}'

# Restructured Text title.
am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }

# Solaris 10 'make', and several other traditional 'make' implementations,
# pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
# by disabling -e (using the XSI extension "set +e") if it's set.
am__sh_e_setup = case $$- in *e*) set +e;; esac

# Default flags passed to test drivers.
am__common_driver_flags = \
  --color-tests "$$am__color_tests" \
  --enable-hard-errors "$$am__enable_hard_errors" \
  --expect-failure "$$am__expect_failure"

# To be inserted before the command running the test.  Creates the
# directory for the log if needed.  Stores in $dir the directory
# containing $f, in $tst the test, in $log the log.  Executes the
# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
# will run the test scripts (or their associated LOG_COMPILER, if
# thy have one).
am__check_pre =						\
$(am__sh_e_setup);					\
$(am__vpath_adj_setup) $(am__vpath_adj)			\
$(am__tty_colors);					\
srcdir=$(srcdir); export srcdir;			\
case "$@" in						\
  */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;	\
    *) am__odir=.;; 					\
esac;							\
test "x$$am__odir" = x"." || test -d "$$am__odir" 	\
  || $(MKDIR_P) "$$am__odir" || exit $$?;		\
if test -f "./$$f"; then dir=./;			\
elif test -f "$$f"; then dir=;				\
else dir="$(srcdir)/"; fi;				\
tst=$$dir$$f; log='$@'; 				\
if test -n '$(DISABLE_HARD_ERRORS)'; then		\
  am__enable_hard_errors=no; 				\
else							\
  am__enable_hard_errors=yes; 				\
fi; 							\
## The use of $dir below is required to account for VPATH
## rewriting done by Sun make.
case " $(XFAIL_TESTS) " in				\
  *[\ \	]$$f[\ \	]* | *[\ \	]$$dir$$f[\ \	]*) \
    am__expect_failure=yes;;				\
  *)							\
    am__expect_failure=no;;				\
esac; 							\
$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)

# A shell command to get the names of the tests scripts with any registered
# extension removed (i.e., equivalently, the names of the test logs, with
# the '.log' extension removed).  The result is saved in the shell variable
# '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
# since that might cause problem with VPATH rewrites for suffix-less tests.
# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
am__set_TESTS_bases = \
  bases='$(TEST_LOGS)'; \
  bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
## Trim away any extra whitespace.  This has already proved useful
## in avoiding weird bug on lesser make implementations.  It also
## works around the GNU make 3.80 bug where trailing whitespace in
## "TESTS = foo.test $(empty)" causes $(TESTS_LOGS)  to erroneously
## expand to "foo.log .log".
  bases=`echo $$bases`

# Recover from deleted '.trs' file; this should ensure that
# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
# both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
# to avoid problems with "make -n".
.log.trs:
	rm -f $< $@
	$(MAKE) $(AM_MAKEFLAGS) $<

# Leading 'am--fnord' is there to ensure the list of targets does not
# expand to empty, as could happen e.g. with make check TESTS=''.
am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
am--force-recheck:
	@:

$(TEST_SUITE_LOG): $(TEST_LOGS)
	@$(am__set_TESTS_bases); \
## Helper shell function, tells whether a path refers to an existing,
## regular, readable file.
	am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
## We need to ensures that all the required '.trs' and '.log' files will
## be present and readable.  The direct dependencies of $(TEST_SUITE_LOG)
## only ensure that all the '.log' files exists; they don't ensure that
## the '.log' files are readable, and worse, they don't ensure that the
## '.trs' files even exist.
	redo_bases=`for i in $$bases; do \
	              am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
	            done`; \
	if test -n "$$redo_bases"; then \
## Uh-oh, either some '.log' files were unreadable, or some '.trs' files
## were missing (or unreadable).  We need to re-run the corresponding
## tests in order to re-create them.
	  redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
	  redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
	  if $(am__make_dryrun); then :; else \
## Break "rm -f" into two calls to minimize the possibility of exceeding
## command line length limits.
	    rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
	  fi; \
	fi; \
## Use a trick to to ensure that we don't go into an infinite recursion
## in case a test log in $(TEST_LOGS) is the same as $(TEST_SUITE_LOG).
## Yes, this has already happened in practice.  Sigh!
	if test -n "$$am__remaking_logs"; then \
	  echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
	       "recursion detected" >&2; \
## Invoking this unconditionally could cause a useless "make all" to
## be invoked when '$redo_logs' expands to empty (automake bug#16302).
	elif test -n "$$redo_logs"; then \
	  am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
	fi; \
	if $(am__make_dryrun); then :; else \
## Sanity check: each unreadable or non-existent test result file should
## has been properly remade at this point, as should the corresponding log
## file.
	  st=0;  \
	  errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
	  for i in $$redo_bases; do \
	    test -f $$i.trs && test -r $$i.trs \
	      || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
	    test -f $$i.log && test -r $$i.log \
	      || { echo "$$errmsg $$i.log" >&2; st=1; }; \
	  done; \
	  test $$st -eq 0 || exit 1; \
	fi
## We need a new subshell to work portably with "make -n", since the
## previous part of the recipe contained a $(MAKE) invocation.
	@$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
	ws='[ 	]'; \
## List of test result files.
	results=`for b in $$bases; do echo $$b.trs; done`; \
	test -n "$$results" || results=/dev/null; \
## Prepare data for the test suite summary.  These do not take into account
## unreadable test results, but they'll be appropriately updated later if
## needed.
	all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
	pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
	fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
	skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
	xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
	xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
	error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
## Whether the testsuite was successful or not.
	if test `expr $$fail + $$xpass + $$error` -eq 0; then \
	  success=true; \
	else \
	  success=false; \
	fi; \
## Make $br a line of exactly 76 '=' characters, that will be used to
## enclose the testsuite summary report when displayed on the console.
	br='==================='; br=$$br$$br$$br$$br; \
## When writing the test summary to the console, we want to color a line
## reporting the count of some result *only* if at least one test
## experienced such a result.  This function is handy in this regard.
	result_count () \
	{ \
	    if test x"$$1" = x"--maybe-color"; then \
	      maybe_colorize=yes; \
	    elif test x"$$1" = x"--no-color"; then \
	      maybe_colorize=no; \
	    else \
	      echo "$@: invalid 'result_count' usage" >&2; exit 4; \
	    fi; \
	    shift; \
	    desc=$$1 count=$$2; \
	    if test $$maybe_colorize = yes && test $$count -gt 0; then \
	      color_start=$$3 color_end=$$std; \
	    else \
	      color_start= color_end=; \
	    fi; \
	    echo "$${color_start}# $$desc $$count$${color_end}"; \
	}; \
## A shell function that creates the testsuite summary.  We need it
## because we have to create *two* summaries, one for test-suite.log,
## and a possibly-colorized one for console output.
	create_testsuite_report () \
	{ \
	  result_count $$1 "TOTAL:" $$all   "$$brg"; \
	  result_count $$1 "PASS: " $$pass  "$$grn"; \
	  result_count $$1 "SKIP: " $$skip  "$$blu"; \
	  result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
	  result_count $$1 "FAIL: " $$fail  "$$red"; \
	  result_count $$1 "XPASS:" $$xpass "$$red"; \
	  result_count $$1 "ERROR:" $$error "$$mgn"; \
	}; \
## Write "global" testsuite log.
	{								\
	  echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |	\
	    $(am__rst_title);						\
	  create_testsuite_report --no-color;				\
	  echo;								\
	  echo ".. contents:: :depth: 2";				\
	  echo;								\
	  for b in $$bases; do echo $$b; done				\
	    | $(am__create_global_log);					\
	} >$(TEST_SUITE_LOG).tmp || exit 1;				\
	mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);			\
## Emit the test summary on the console.
	if $$success; then						\
	  col="$$grn";							\
	 else								\
	  col="$$red";							\
	  test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);		\
	fi;								\
## Multi line coloring is problematic with "less -R", so we really need
## to color each line individually.
	echo "$${col}$$br$${std}"; 					\
	echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";	\
	echo "$${col}$$br$${std}"; 					\
## This is expected to go to the console, so it might have to be colorized.
	create_testsuite_report --maybe-color;				\
	echo "$$col$$br$$std";						\
	if $$success; then :; else					\
	  echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";		\
	  if test -n "$(PACKAGE_BUGREPORT)"; then			\
	    echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}";	\
	  fi;								\
	  echo "$$col$$br$$std";					\
	fi;								\
## Be sure to exit with the proper exit status.  The use of "exit 1" below
## is required to work around a FreeBSD make bug (present only when running
## in concurrent mode).  See automake bug#9245:
##  <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9245>
## and FreeBSD PR bin/159730:
##  <http://www.freebsd.org/cgi/query-pr.cgi?pr=159730>.
	$$success || exit 1

RECHECK_LOGS = $(TEST_LOGS)

## ------------------------------------------ ##
## Running all tests, or rechecking failures. ##
## ------------------------------------------ ##

check-TESTS: %CHECK_DEPS%
	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
## We always have to remove $(TEST_SUITE_LOG), to ensure its rule is run
## in any case even in lazy mode: otherwise, if no test needs rerunning,
## or a prior run plus reruns all happen within the same timestamp (can
## happen with a prior "make TESTS=<subset>"), then we get no log output.
## OTOH, this means that, in the rule for '$(TEST_SUITE_LOG)', we
## cannot use '$?' to compute the set of lazily rerun tests, lest
## we rely on .PHONY to work portably.
	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
	@set +e; $(am__set_TESTS_bases); \
	log_list=`for i in $$bases; do echo $$i.log; done`; \
	trs_list=`for i in $$bases; do echo $$i.trs; done`; \
## Remove newlines and normalize whitespace.  Trailing (and possibly
## leading) whitespace is known to cause segmentation faults on
## Solaris 10 XPG4 make.
	log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
	$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
## Be sure to exit with the proper exit status (automake bug#9245).  See
## comments in the recipe of $(TEST_SUITE_LOG) above for more information.
	exit $$?;

## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
## It must also depend on the 'all' target.  See automake bug#11252.
recheck: all %CHECK_DEPS%
## See comments above in the check-TESTS recipe for why remove
## $(TEST_SUITE_LOG) here.
	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
	@set +e; $(am__set_TESTS_bases); \
## We must only consider tests that had an unexpected outcome (FAIL
## or XPASS) in the earlier run.
	bases=`for i in $$bases; do echo $$i; done \
	         | $(am__list_recheck_tests)` || exit 1; \
	log_list=`for i in $$bases; do echo $$i.log; done`; \
## Remove newlines and normalize whitespace.  Trailing (and possibly
## leading) whitespace is known to cause segmentation faults on
## Solaris 10 XPG4 make.
	log_list=`echo $$log_list`; \
## Move the '.log' and '.trs' files associated with the tests to be
## re-run out of the way, so that those tests will be re-run by the
## "make test-suite.log" recursive invocation below.
## Two tricky requirements:
##   - we must avoid extra files removal when running under "make -n";
##   - in case the test is a compiled program whose compilation fails,
##     we must ensure that any '.log' and '.trs' file referring to such
##     test are preserved, so that future "make recheck" invocations
##     will still try to re-compile and re-run it (automake bug#11791).
## The tricky recursive make invocation below should cater to such
## requirements.
	$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
	        am__force_recheck=am--force-recheck \
	        TEST_LOGS="$$log_list"; \
## Be sure to exit with the proper exit status (automake bug#9245).  See
## comments in the recipe of $(TEST_SUITE_LOG) above for more information.
	exit $$?

AM_RECURSIVE_TARGETS += check recheck

.PHONY: recheck

else %?SERIAL_TESTS%

## Obsolescent serial testsuite driver.

check-TESTS: $(TESTS)
	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
	srcdir=$(srcdir); export srcdir; \
## Make sure Solaris VPATH-expands all members of this list, even
## the first and the last one; thus the spaces around $(TESTS)
	list=' $(TESTS) '; \
	$(am__tty_colors); \
	if test -n "$$list"; then \
	  for tst in $$list; do \
	    if test -f ./$$tst; then dir=./; \
## Note: Solaris 2.7 seems to expand TESTS using VPATH.  That's
## why we also try 'dir='.
	    elif test -f $$tst; then dir=; \
	    else dir="$(srcdir)/"; fi; \
	    if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
## Success
	      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 \
## Failure
	      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 \
## Skipped
	      skip=`expr $$skip + 1`; \
	      col=$$blu; res=SKIP; \
	    fi; \
	    echo "$${col}$$res$${std}: $$tst"; \
	  done; \
## Prepare the banner
	  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 should contain the largest line of the banner.
	  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 \
	    col="$$grn"; \
	  else \
	    col="$$red"; \
	  fi; \
## Multi line coloring is problematic with "less -R", so we really need
## to color each line individually.
	  echo "$${col}$$dashes$${std}"; \
	  echo "$${col}$$banner$${std}"; \
	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
	  test -z "$$report" || echo "$${col}$$report$${std}"; \
	  echo "$${col}$$dashes$${std}"; \
	  test "$$failed" -eq 0; \
	else :; fi

endif %?SERIAL_TESTS%
am/yacc.am000064400000004545150523165450006415 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1998-2018 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, see <https://www.gnu.org/licenses/>.

## We want to disable the Yacc rebuild rule when
##   1. AM_MAINTAINER_MODE is used, and
##   2. --enable-maintainer-mode is not specified, and
##   3. parser.c already exist, and
##   4. parser.y and parser.c are distributed.
## Point #3 is because "make maintainer-clean" erases parser.c, yet
## the GNU Coding Standards require that ./configure; make works even
## after that.
## Point #4 is because parsers listed in nodist_*_SOURCES are always
## built on the user's side, so it makes no sense to disable them.
##
## Points #1, #2, #3 are solved by unconditionally prefixing the rule
## with $(am__skipyacc) defined below only when needed.
##
## Point #4 requires a condition on whether parser.y/parser.c are
## distributed or not.  We cannot have a generic rule that works in
## both cases, so we ensure in automake that nodist_ parsers always
## use non-generic rules.
if %?FIRST%
if %?MAINTAINER-MODE%
@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
endif %?MAINTAINER-MODE%
## The 's/c$/h/' substitution *must* be the last one.
am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
		   -e s/c++$$/h++/ -e s/c$$/h/
endif %?FIRST%

?GENERIC?%EXT%%DERIVED-EXT%:
?!GENERIC?%OBJ%: %SOURCE%
?GENERIC?	%VERBOSE%$(am__skipyacc) $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h `echo %OBJ% | $(am__yacc_c2h)` y.output %BASE%.output -- %COMPILE%
?!GENERIC?	%VERBOSE% \
?!GENERIC??DIST_SOURCE?	$(am__skipyacc) \
## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
?!GENERIC?	$(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% y.tab.c %OBJ% y.tab.h `echo %OBJ% | $(am__yacc_c2h)` y.output %BASE%.output -- %COMPILE%
am/depend2.am000064400000013714150523165450007015 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

## This file is read several times:
## - once per *extension* (not per language) for generic compilation rules
## - once for each file which requires specific flags.

## Note it is on purpose we wrote "if %AMDEP%", since:
##
## - if deps are turned off, %AMDEP% is mapped onto FALSE, and therefore
##   the "if FALSE" chunk is removed (automake-time conditionals).
##
## - if deps are on, %AMDEP% is mapped onto AMDEP,  and therefore
##   the "if AMDEP" chunk is prefix with @AMDEP_TRUE@ just like for any
##   other configure-time conditional.
##
## We do likewise for %FASTDEP%; this expands to an ordinary configure-time
## conditional.  %FASTDEP% is used to speed up the common case of building
## a package with gcc 3.x or later.  In this case we can skip the use of
## depcomp and easily inline the dependency tracking.

if %?NONLIBTOOL%
?GENERIC?%EXT%.o:
?!GENERIC?%OBJ%: %SOURCE%
if %FASTDEP%
## In fast-dep mode, we can always use -o.
## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
?!GENERIC?	%VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
?!GENERIC?	%SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
?GENERIC??!SUBDIROBJ?	%VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%%SOURCE%
?GENERIC??!SUBDIROBJ?	%SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
?GENERIC??SUBDIROBJ?	%VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
?GENERIC??SUBDIROBJ?	%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%%SOURCE% &&\
?GENERIC??SUBDIROBJ?	$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
else !%FASTDEP%
if %AMDEP%
	%VERBOSE%source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
	DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
if %?GENERIC%
?-o?	%VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJ% %SOURCEFLAG%%SOURCE%
?!-o?	%VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%%SOURCE%
else !%?GENERIC%
## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
?-o?	%VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
?!-o?	%VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
endif !%?GENERIC%
endif !%FASTDEP%

?GENERIC?%EXT%.obj:
?!GENERIC?%OBJOBJ%: %SOURCE%
if %FASTDEP%
## In fast-dep mode, we can always use -o.
## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
?!GENERIC?	%VERBOSE%%COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
?!GENERIC?	%SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
?GENERIC??!SUBDIROBJ?	%VERBOSE%%COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
?GENERIC??!SUBDIROBJ?	%SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
?GENERIC??SUBDIROBJ?	%VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
?GENERIC??SUBDIROBJ?	%COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'` &&\
?GENERIC??SUBDIROBJ?	$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
else !%FASTDEP%
if %AMDEP%
	%VERBOSE%source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
	DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
if %?GENERIC%
?-o?	%VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
?!-o?	%VERBOSE-NODEP%%COMPILE% %-c% `$(CYGPATH_W) %SOURCEFLAG%'%SOURCE%'`
else !%?GENERIC%
## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
?-o?	%VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJOBJ% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
?!-o?	%VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
endif !%?GENERIC%
endif !%FASTDEP%
endif %?NONLIBTOOL%

if %?LIBTOOL%
?GENERIC?%EXT%.lo:
?!GENERIC?%LTOBJ%: %SOURCE%
if %FASTDEP%
## In fast-dep mode, we can always use -o.
## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
?!GENERIC?	%VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
?!GENERIC?	%SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
?GENERIC??!SUBDIROBJ?	%VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE%
?GENERIC??!SUBDIROBJ?	%SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
?GENERIC??SUBDIROBJ?	%VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
?GENERIC??SUBDIROBJ?	%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE% &&\
?GENERIC??SUBDIROBJ?	$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
else !%FASTDEP%
if %AMDEP%
	%VERBOSE%source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
	DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
## We can always use '-o' with Libtool.
?GENERIC?	%VERBOSE-NODEP%%LTCOMPILE% %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE%
## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
?!GENERIC?	%VERBOSE-NODEP%%LTCOMPILE% %-c% -o %LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
endif !%FASTDEP%
endif %?LIBTOOL%
am/libtool.am000064400000002007150523165450007131 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

.PHONY: mostlyclean-libtool clean-libtool distclean-libtool
mostlyclean-am: mostlyclean-libtool
mostlyclean-libtool:
	-rm -f *.lo

clean-am: clean-libtool
clean-libtool:
?LTRMS?%LTRMS%

?TOPDIR_P?distclean-am: distclean-libtool
?TOPDIR_P?distclean-libtool:
?TOPDIR_P?	-rm -f libtool config.lt
am/lang-compile.am000064400000002256150523165450010042 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.

## This file is read once per *language*, not per extension.

## ------------------------- ##
## Preprocessed Fortran 77.  ##
## ------------------------- ##

## We also handle the case of preprocessing '.F' files into '.f' files.
if %?PPF77%
.F.f:
	$(F77COMPILE) -F $<
endif %?PPF77%



## -------- ##
## Ratfor.  ##
## -------- ##

## We also handle the case of preprocessing `.r' files into `.f' files.
if %?RATFOR%
.r.f:
	$(RCOMPILE) -F $<
endif %?RATFOR%
am/dejagnu.am000064400000007124150523165450007107 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

## Name of tool to use.  Default is the same as the package.
DEJATOOL = $(PACKAGE)

## Default flags to pass to dejagnu.  The user can override this.
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir

EXPECT = expect
RUNTEST = runtest


.PHONY: check-DEJAGNU
check-DEJAGNU: site.exp
## Life is easiest with an absolute srcdir, so do that.
	srcdir='$(srcdir)'; export srcdir; \
	EXPECT=$(EXPECT); export EXPECT; \
## If runtest can't be found, print a warning but don't die.  It is
## pointless to cause a failure if the tests cannot be run at all.
	if $(SHELL) -c "$(RUNTEST) --version" > /dev/null 2>&1; then \
	  exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
	    if $(RUNTEST) $(RUNTESTDEFAULTFLAGS) $(AM_RUNTESTFLAGS) $(RUNTESTFLAGS); \
	    then :; else exit_status=1; fi; \
	  done; \
	else echo "WARNING: could not find '$(RUNTEST)'" 1>&2; :;\
	fi; \
	exit $$exit_status


## ------------------- ##
## Building site.exp.  ##
## ------------------- ##

## Note that in the rule we don't directly generate site.exp to avoid
## the possibility of a corrupted site.exp if make is interrupted.
## Jim Meyering has some useful text on this topic.
site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
	@echo 'Making a new site.exp file ...'
	@echo '## these variables are automatically generated by make ##' >site.tmp
	@echo '# Do not edit here.  If you wish to override these values' >>site.tmp
	@echo '# edit the last section' >>site.tmp
	@echo 'set srcdir "$(srcdir)"' >>site.tmp
	@echo "set objdir `pwd`" >>site.tmp
## Quote the *_alias variables because they might be empty.
?BUILD?	@echo 'set build_alias "$(build_alias)"' >>site.tmp
?BUILD?	@echo 'set build_triplet $(build_triplet)' >>site.tmp
?HOST?	@echo 'set host_alias "$(host_alias)"' >>site.tmp
?HOST?	@echo 'set host_triplet $(host_triplet)' >>site.tmp
?TARGET?	@echo 'set target_alias "$(target_alias)"' >>site.tmp
?TARGET?	@echo 'set target_triplet $(target_triplet)' >>site.tmp
## Allow the package author to extend site.exp.
	@list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
	  echo "## Begin content included from file $$f.  Do not modify. ##" \
	   && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
	   && echo "## End content included from file $$f. ##" \
	   || exit 1; \
	 done >> site.tmp
	@echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
	@if test -f site.exp; then \
	   sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
	 fi
	@-rm -f site.bak
	@test ! -f site.exp || mv site.exp site.bak
	@mv site.tmp site.exp

## ---------- ##
## Cleaning.  ##
## ---------- ##

.PHONY distclean-am: distclean-DEJAGNU

distclean-DEJAGNU:
## Any other cleaning must be done by the user or by the test suite
## itself.  We can't predict what dejagnu or the test suite might
## generate.
	-rm -f site.exp site.bak
	-l='$(DEJATOOL)'; for tool in $$l; do \
	  rm -f $$tool.sum $$tool.log; \
	done
am/lisp.am000064400000010013150523165450006430 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1996-2018 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, see <https://www.gnu.org/licenses/>.

if %?INSTALL%
include inst-vars.am
endif %?INSTALL%

## ---------- ##
## Building.  ##
## ---------- ##

.el.elc:
## We add $(builddir) and $(srcdir) to load-path, so that any '.el' files
## that $< depends upon can be found (including generated ones).
## We prefer files from the build directory to those from the source
## directory, in true VPATH spirit.
## The destination file is normally determined by appending "c" to the
## input (which would erronously put it in $(srcdir) in VPATH builds),
## so we override that, too.
	if test '$(EMACS)' != no; then \
	  am__dir=. am__subdir_includes=''; \
	  case $@ in */*) \
	    am__dir=`echo '$@' | sed 's,/[^/]*$$,,'`; \
	    am__subdir_includes="-L $$am__dir -L $(srcdir)/$$am__dir"; \
	  esac; \
## Emacs byte-compilation won't create this automatically, sadly.
	  test -d "$$am__dir" || $(MKDIR_P) "$$am__dir" || exit 1; \
	  $(EMACS) --batch \
	    $(AM_ELCFLAGS) $(ELCFLAGS) \
	    $$am__subdir_includes -L $(builddir) -L $(srcdir) \
	    --eval '(setq byte-compile-dest-file-function (lambda (_) "$@"))' \
	    -f batch-byte-compile '$<'; \
	else :; fi


## ------------ ##
## Installing.  ##
## ------------ ##

if %?INSTALL%
am__installdirs += "$(DESTDIR)$(%NDIR%dir)"

?BASE?%DIR%LISP_INSTALL = $(INSTALL_DATA)
?!BASE?%DIR%LISP_INSTALL = $(install_sh_DATA)

?EXEC?.PHONY install-exec-am: install-%DIR%LISP
?!EXEC?.PHONY install-data-am: install-%DIR%LISP

install-%DIR%LISP: $(%DIR%_LISP) $(ELCFILES)
	@$(NORMAL_INSTALL)
## Do not install anything if EMACS was not found.
	@if test "$(EMACS)" != no && test -n "$(%NDIR%dir)"; then \
?!BASE?	  $(am__vpath_adj_setup) \
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
	  list='$(%DIR%_LISP)'; \
	  if test -n "$$list"; then \
	    echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	    $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	  fi; \
	  for p in $$list; do \
## A lisp file can be in the source directory or the build directory.
	    if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
?BASE?	    $(am__strip_dir) \
?!BASE?	    $(am__vpath_adj) \
	    echo " $(%DIR%LISP_INSTALL) '$$d$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
	    $(%DIR%LISP_INSTALL) "$$d$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
## Only install .elc file if it exists.
	    if test -f $${p}c; then \
	      echo " $(%DIR%LISP_INSTALL) '$${p}c' '$(DESTDIR)$(%NDIR%dir)/$${f}c'"; \
	      $(%DIR%LISP_INSTALL) "$${p}c" "$(DESTDIR)$(%NDIR%dir)/$${f}c" || exit $$?; \
	    else : ; fi; \
	  done; \
	else : ; fi
endif %?INSTALL%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?INSTALL%
.PHONY uninstall-am: uninstall-%DIR%LISP
uninstall-%DIR%LISP:
	@$(NORMAL_UNINSTALL)
## Do not uninstall anything if EMACS was not found.
	@test "$(EMACS)" != no && test -n "$(%NDIR%dir)" || exit 0; \
	list='$(%DIR%_LISP)'; \
?BASE?	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
?!BASE?	$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
	files="$$files "`echo "$$files" | sed 's|$$|c|'`; \
	dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
endif %?INSTALL%


## ---------- ##
## Cleaning.  ##
## ---------- ##

.PHONY clean-am: clean-lisp
clean-lisp:
	-rm -f $(ELCFILES)


## -------------- ##
## Distributing.  ##
## -------------- ##

if %?DIST%
DIST_COMMON += %DISTVAR%
endif %?DIST%
am/inst-vars.am000064400000006621150523165450007421 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2004-2018 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, see <https://www.gnu.org/licenses/>.

if %?FIRST%

## These variables help stripping any $(VPATH) that some
## Make implementations prepend before VPATH-found files.
## The issue is discussed at length in distdir.am.
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
## Strip all directories.
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
## Number of files to install concurrently.
am__install_max = 40
## Take a $list of nobase files, strip $(srcdir) from them.
## Split apart in setup variable and an action that can be used
## in backticks or in a pipe.
am__nobase_strip_setup = \
  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
## Take a $list of nobase files, collect them, indexed by their
## srcdir-stripped dirnames.  For up to am__install_max files, output
## a line containing the dirname and the files, space-separated.
## The arbitrary limit helps avoid the quadratic scaling exhibited by
## string concatenation in most shells, and should avoid line length
## limitations, while still offering only negligible performance impact
## through spawning more install commands than absolutely needed.
am__nobase_list = $(am__nobase_strip_setup); \
  for p in $$list; do echo "$$p $$p"; done | \
  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
    if (++n[$$2] == $(am__install_max)) \
      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
    END { for (dir in files) print dir, files[dir] }'
## Collect up to 40 files per line from stdin.
am__base_list = \
  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'

## A shell code fragment to uninstall files from a given directory.
## It expects the $dir and $files shell variables to be defined respectively
## to the directory where the files to be removed are, and to the list of
## such files.
am__uninstall_files_from_dir = { \
## Some rm implementations complain if 'rm -f' is used without arguments.
  test -z "$$files" \
## At least Solaris /bin/sh still lacks 'test -e', so we use the multiple
## tests below instead.  We expect $dir to be either non-existent or a
## directory, so the failure we'll experience if it is a regular file
## is indeed desired and welcome (better to fail loudly thasn silently).
    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
         $(am__cd) "$$dir" && rm -f $$files; }; \
  }

endif %?FIRST%
am/compile.am000064400000001763150523165450007125 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

DEFAULT_INCLUDES = %DEFAULT_INCLUDES%

mostlyclean-am: mostlyclean-compile
mostlyclean-compile:
	-rm -f *.$(OBJEXT)
?MOSTLYRMS?%MOSTLYRMS%

distclean-am: distclean-compile
distclean-compile:
	-rm -f *.tab.c
?DISTRMS?%DISTRMS%

.PHONY: mostlyclean-compile distclean-compile
am/texibuild.am000064400000014272150523165450007465 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.


?GENERIC_INFO?%SOURCE_SUFFIX%%DEST_SUFFIX%:
?!GENERIC_INFO?%DEST_INFO_PREFIX%%DEST_SUFFIX%: %SOURCE_INFO% %DEPS%
## It is wrong to have 'info' files dependent on %DIRSTAMP%, because
## 'info' files are distributed and %DIRSTAMP% isn't: a distributed file
## should never be dependent upon a non-distributed built file.
## Therefore we ensure that %DIRSTAMP% exists in the rule.
?!INSRC??DIRSTAMP?	@test -f %DIRSTAMP% || $(MAKE) $(AM_MAKEFLAGS) %DIRSTAMP%
## Back up the info files before running makeinfo. This is the cheapest
## way to ensure that
## 1) If the texinfo file shrinks (or if you start using --no-split),
##    you'll not be left with some dead info files lying around -- dead
##    files which would end up in the distribution.
## 2) If the texinfo file has some minor mistakes which cause makeinfo
##    to fail, the info files are not removed.  (They are needed by the
##    developer while he writes documentation.)
## *.iNN files are used on DJGPP.  See the comments in install-info-am
	%AM_V_MAKEINFO%restore=: && backupdir="$(am__leading_dot)am$$$$" && \
?INSRC?	am__cwd=`pwd` && $(am__cd) $(srcdir) && \
	rm -rf $$backupdir && mkdir $$backupdir && \
## If makeinfo is not installed we must not backup the files so
## 'missing' can do its job and touch $@ if it exists.
	if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
	  for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
	    if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
	  done; \
	else :; fi && \
?INSRC?	cd "$$am__cwd"; \
	if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
?!INSRC?	 -o $@ `test -f '%SOURCE_INFO%' || echo '$(srcdir)/'`%SOURCE_INFO%; \
?INSRC??!GENERIC_INFO?	 -o $@ $(srcdir)/%SOURCE_INFO%; \
?INSRC??GENERIC_INFO?	 -o $@ $<; \
	then \
	  rc=0; \
?INSRC?	  $(am__cd) $(srcdir); \
	else \
	  rc=$$?; \
## Beware that backup info files might come from a subdirectory.
?INSRC?	  $(am__cd) $(srcdir) && \
	  $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
	fi; \
	rm -rf $$backupdir; exit $$rc

INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%

?GENERIC?%SOURCE_SUFFIX%.dvi:
?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP%
	%AM_V_TEXI2DVI%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
## Must set MAKEINFO like this so that version.texi will be found even
## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
	MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
## texi2dvi doesn't silence everything with -q, redirect to /dev/null instead.
## We still want -q (%TEXIQUIET%) because it turns on batch mode.
## Use '--build-dir' so that TeX and Texinfo auxiliary files and build
## by-products are left in there, instead of cluttering the current
## directory (see automake bug#11146).  Use a different build-dir for
## each file (and distinct from that of the corresponding PDF file) to
## avoid hitting a Texinfop bug that could cause low-probability racy
## failure when doing parallel builds; see:
## https://lists.gnu.org/archive/html/automake-patches/2012-06/msg00073.html
	$(TEXI2DVI) %TEXIQUIET% --build-dir=$(@:.dvi=.t2d) -o $@ %TEXIDEVNULL% \
?GENERIC?	%SOURCE%
?!GENERIC?	`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%

?GENERIC?%SOURCE_SUFFIX%.pdf:
?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% %DIRSTAMP%
	%AM_V_TEXI2PDF%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
## Must set MAKEINFO like this so that version.texi will be found even
## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
	MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
## texi2pdf doesn't silence everything with -q, redirect to /dev/null instead.
## We still want -q (%TEXIQUIET%) because it turns on batch mode.
## Use '--build-dir' so that TeX and Texinfo auxiliary files and build
## by-products are left in there, instead of cluttering the current
## directory (see automake bug#11146).  Use a different build-dir for
## each file (and distinct from that of the corresponding DVI file) to
## avoid hitting a Texinfop bug that could cause low-probability racy
## failure when doing parallel builds; see:
## https://lists.gnu.org/archive/html/automake-patches/2012-06/msg00073.html
	$(TEXI2PDF) %TEXIQUIET% --build-dir=$(@:.pdf=.t2p) -o $@ %TEXIDEVNULL% \
?GENERIC?	%SOURCE%
?!GENERIC?	`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%

?GENERIC?%SOURCE_SUFFIX%.html:
?!GENERIC?%DEST_PREFIX%.html: %SOURCE% %DEPS% %DIRSTAMP%
## When --split (the default) is used, makeinfo will output a
## directory.  However it will not update the time stamp of a
## previously existing directory, and when the names of the nodes
## in the manual change, it may leave unused pages.  Our fix
## is to build under a temporary name, and replace the target on
## success.
	%AM_V_MAKEINFO%rm -rf $(@:.html=.htp)
	%SILENT%if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
?GENERIC?	 -o $(@:.html=.htp) %SOURCE%; \
?!GENERIC?	 -o $(@:.html=.htp) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
	then \
	  rm -rf $@ && mv $(@:.html=.htp) $@; \
	else \
	  rm -rf $(@:.html=.htp); exit 1; \
	fi

## If we are using the generic rules, we need separate dependencies.
## (Don't wonder about %DIRSTAMP% here, this is used only by non-generic
## rules.)
if %?GENERIC_INFO%
%DEST_INFO_PREFIX%%DEST_SUFFIX%: %SOURCE_REAL% %DEPS%
endif %?GENERIC_INFO%
if %?GENERIC%
%DEST_PREFIX%.dvi: %SOURCE_REAL% %DEPS%
%DEST_PREFIX%.pdf: %SOURCE_REAL% %DEPS%
%DEST_PREFIX%.html: %SOURCE_REAL% %DEPS%
endif %?GENERIC%
am/clean.am000064400000004434150523165450006555 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

## We must test each macro because it might be empty, and an empty "rm
## -rf" command looks disturbing.  Also, the Solaris 2.4 "rm" will
## return an error if there are no arguments other than "-f".
mostlyclean-am: mostlyclean-generic
mostlyclean-generic:
%MOSTLYCLEAN_RMS%

clean-am: clean-generic mostlyclean-am
clean-generic:
%CLEAN_RMS%

distclean-am: distclean-generic clean-am
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)
%DISTCLEAN_RMS%

## Makefiles and their dependencies cannot be cleaned by
## an -am dependency, because that would prevent other distclean
## dependencies from calling make recursively.  (The multilib
## cleaning rules do this.)
##
## If you change distclean here, you probably also want to change
## maintainer-clean below.
distclean:
	-rm -f %MAKEFILE%

maintainer-clean-am: maintainer-clean-generic distclean-am
maintainer-clean-generic:
## FIXME: shouldn't we really print these messages before running
## the dependencies?
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
%MAINTAINER_CLEAN_RMS%

## See comment for distclean.
maintainer-clean:
	-rm -f %MAKEFILE%

.PHONY: clean mostlyclean distclean maintainer-clean \
clean-generic mostlyclean-generic distclean-generic maintainer-clean-generic

?!SUBDIRS?clean: clean-am
?!SUBDIRS?distclean: distclean-am
?!SUBDIRS?mostlyclean: mostlyclean-am
?!SUBDIRS?maintainer-clean: maintainer-clean-am
am/texinfos.am000064400000032200150523165450007322 0ustar00## automake - create Makefile.in from Makefile.am

## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

## ----------- ##
## Variables.  ##
## ----------- ##

if %?LOCAL-TEXIS%
TEXI2DVI = texi2dvi
TEXI2PDF = $(TEXI2DVI) --pdf --batch
MAKEINFOHTML = $(MAKEINFO) --html
AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
endif %?LOCAL-TEXIS%


## ---------- ##
## Building.  ##
## ---------- ##

## The way to make PostScript, for those who want it.
if %?LOCAL-TEXIS%
DVIPS = dvips
.dvi.ps:
	%AM_V_DVIPS%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
	$(DVIPS) %TEXIQUIET% -o $@ $<
endif %?LOCAL-TEXIS%

.PHONY: dvi dvi-am html html-am info info-am pdf pdf-am ps ps-am
if %?SUBDIRS%
RECURSIVE_TARGETS += dvi-recursive html-recursive info-recursive
RECURSIVE_TARGETS += pdf-recursive ps-recursive
dvi: dvi-recursive
html: html-recursive
info: info-recursive
pdf: pdf-recursive
ps: ps-recursive
else !%?SUBDIRS%
dvi: dvi-am
html: html-am
info: info-am
pdf: pdf-am
ps: ps-am
endif !%?SUBDIRS%

if %?LOCAL-TEXIS%
dvi-am: $(DVIS)
html-am: $(HTMLS)
info-am: $(INFO_DEPS)
pdf-am: $(PDFS)
ps-am: $(PSS)
else ! %?LOCAL-TEXIS%
dvi-am:
html-am:
info-am:
pdf-am:
ps-am:
endif ! %?LOCAL-TEXIS%


## ------------ ##
## Installing.  ##
## ------------ ##

## Some code should be run only if install-info actually exists, and
## if the user doesn't request it not to be run (through the
## 'AM_UPDATE_INFO_DIR' environment variable).  See automake bug#9773
## and Debian Bug#543992.
am__can_run_installinfo = \
  case $$AM_UPDATE_INFO_DIR in \
    n|no|NO) false;; \
    *) (install-info --version) >/dev/null 2>&1;; \
  esac

## Look in both . and srcdir because the info pages might have been
## rebuilt in the build directory.  Can't cd to srcdir; that might
## break a possible install-sh reference.
##
## Funny name due to --cygnus influence; we want to reserve
## 'install-info' for the user.
##
## TEXINFOS primary are always installed in infodir, hence install-data
## is hard coded.
if %?INSTALL-INFO%
if %?LOCAL-TEXIS%
am__installdirs += "$(DESTDIR)$(infodir)"
install-data-am: install-info-am
endif %?LOCAL-TEXIS%
endif %?INSTALL-INFO%
.PHONY: \
  install-dvi  install-dvi-am \
  install-html install-html-am \
  install-info install-info-am \
  install-pdf  install-pdf-am \
  install-ps   install-ps-am

if %?SUBDIRS%
RECURSIVE_TARGETS += \
  install-dvi-recursive \
  install-html-recursive \
  install-info-recursive \
  install-pdf-recursive \
  install-ps-recursive
install-dvi: install-dvi-recursive
install-html: install-html-recursive
install-info: install-info-recursive
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
else !%?SUBDIRS%
install-dvi: install-dvi-am
install-html: install-html-am
install-info: install-info-am
install-pdf: install-pdf-am
install-ps: install-ps-am
endif !%?SUBDIRS%

if %?LOCAL-TEXIS%

include inst-vars.am

install-dvi-am: $(DVIS)
	@$(NORMAL_INSTALL)
	@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
	fi; \
	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)$(dvidir)'"; \
	  $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
	done

install-html-am: $(HTMLS)
	@$(NORMAL_INSTALL)
	@list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
	fi; \
	for p in $$list; do \
	  if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  $(am__strip_dir) \
## This indirection is required to work around a bug of the Solaris 10
## shell /usr/xpg4/bin/sh.  The description of the bug can be found at
## <https://lists.gnu.org/archive/html/bug-autoconf/2011-11/msg00005.html>
## and the report of the original failure can be found at automake
## bug#10026 <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=10026#23>
	  d2=$$d$$p; \
	  if test -d "$$d2"; then \
	    echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
	    $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
	    echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
	    $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
	  else \
	    list2="$$list2 $$d2"; \
	  fi; \
	done; \
	test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
	while read files; do \
	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
	  $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
	done; }

install-info-am: $(INFO_DEPS)
	@$(NORMAL_INSTALL)
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
	fi; \
	for file in $$list; do \
## Strip possible $(srcdir) prefix.
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	  esac; \
	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
## 8+3 filesystems cannot deal with foo.info-N filenames: they all
## conflict.  DJGPP comes with a tool, DJTAR, that will rename these
## files to foo.iNN while extracting the archive.  DJGPP's makeinfo
## is patched to grok these filenames.  However we have to account
## for the renaming when installing the info files.
##
## If $file == foo.info, then $file_i == foo.i.  The reason we use two
## shell commands instead of one ('s|\.info$$|.i|') is so that a suffix-less
## 'foo' becomes 'foo.i' too.
	  file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
	  for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
	               $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
	    if test -f $$ifile; then \
	      echo "$$ifile"; \
	    else : ; fi; \
	  done; \
	done | $(am__base_list) | \
	while read files; do \
	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
	  $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
	@$(POST_INSTALL)
	@if $(am__can_run_installinfo); then \
	  list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
	  for file in $$list; do \
## Strip directory
	    relfile=`echo "$$file" | sed 's|^.*/||'`; \
## Run ":" after install-info in case install-info fails.  We really
## don't care about failures here, because they can be spurious.  For
## instance if you don't have a dir file, install-info will fail.  I
## think instead it should create a new dir file for you.  This bug
## causes the "make distcheck" target to fail reliably.
	    echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
## Use "|| :" here because Sun make passes -e to sh; if install-info
## fails then we'd fail if we used ";".
	    install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
	  done; \
	else : ; fi

install-pdf-am: $(PDFS)
	@$(NORMAL_INSTALL)
	@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
	fi; \
	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)$(pdfdir)'"; \
	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done

install-ps-am: $(PSS)
	@$(NORMAL_INSTALL)
	@list='$(PSS)'; test -n "$(psdir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
	fi; \
	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)$(psdir)'"; \
	  $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done

else ! %?LOCAL-TEXIS%
install-dvi-am:
install-html-am:
install-info-am:
install-pdf-am:
install-ps-am:
endif ! %?LOCAL-TEXIS%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?LOCAL-TEXIS%
.PHONY uninstall-am: \
  uninstall-dvi-am \
  uninstall-html-am \
  uninstall-info-am \
  uninstall-ps-am \
  uninstall-pdf-am

uninstall-dvi-am:
	@$(NORMAL_UNINSTALL)
	@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
	for p in $$list; do \
	  $(am__strip_dir) \
	  echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
	  rm -f "$(DESTDIR)$(dvidir)/$$f"; \
	done

uninstall-html-am:
	@$(NORMAL_UNINSTALL)
	@list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
	for p in $$list; do \
	  $(am__strip_dir) \
## $f can be a directory, hence the -r.
	  echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
	  rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
	done

uninstall-info-am:
	@$(PRE_UNINSTALL)
## Run two loops here so that we can handle PRE_UNINSTALL and
## NORMAL_UNINSTALL correctly.
	@if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
	  list='$(INFO_DEPS)'; \
	  for file in $$list; do \
	    relfile=`echo "$$file" | sed 's|^.*/||'`; \
## install-info needs the actual info file.  We use the installed one,
## rather than relying on one still being in srcdir or builddir.
## However, "make uninstall && make uninstall" should not fail,
## so we ignore failure if the file did not exist.
	    echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
	    if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
	    then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
	  done; \
	else :; fi
	@$(NORMAL_UNINSTALL)
	@list='$(INFO_DEPS)'; \
	for file in $$list; do \
	  relfile=`echo "$$file" | sed 's|^.*/||'`; \
## DJGPP-style info files.  See comment in install-info-am.
	  relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
	  (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
	     echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
	     rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
	   else :; fi); \
	done

uninstall-pdf-am:
	@$(NORMAL_UNINSTALL)
	@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
	for p in $$list; do \
	  $(am__strip_dir) \
	  echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
	  rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
	done

uninstall-ps-am:
	@$(NORMAL_UNINSTALL)
	@list='$(PSS)'; test -n "$(psdir)" || list=; \
	for p in $$list; do \
	  $(am__strip_dir) \
	  echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
	  rm -f "$(DESTDIR)$(psdir)/$$f"; \
	done
endif %?LOCAL-TEXIS%

if %?LOCAL-TEXIS%
.PHONY: dist-info
dist-info: $(INFO_DEPS)
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	list='$(INFO_DEPS)'; \
	for base in $$list; do \
## Strip possible $(srcdir) prefix.
	  case $$base in \
	    $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
	  esac; \
	  if test -f $$base; then d=.; else d=$(srcdir); fi; \
	  base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
	  for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
	    if test -f $$file; then \
## Strip leading '$$d/'.
	      relfile=`expr "$$file" : "$$d/\(.*\)"`; \
	      test -f "$(distdir)/$$relfile" || \
		cp -p $$file "$(distdir)/$$relfile"; \
	    else :; fi; \
	  done; \
	done
endif %?LOCAL-TEXIS%


## ---------- ##
## Cleaning.  ##
## ---------- ##

## The funny name is due to --cygnus influence; in Cygnus mode,
## 'clean-info' is a target that users can use.

if %?LOCAL-TEXIS%
.PHONY mostlyclean-am: mostlyclean-aminfo
.PHONY: mostlyclean-aminfo
mostlyclean-aminfo:
## Use '-rf', not just '-f', because the %*CLEAN% substitutions can also
## contain any directory created by "makeinfo --html", as well as the
## '*.t2d' and '*.t2p' directories used by texi2dvi and texi2pdf.
	-rm -rf %MOSTLYCLEAN%

.PHONY clean-am: clean-aminfo
clean-aminfo:
## Use '-rf', not just '-f'; see comments in 'mostlyclean-aminfo'
## above for details.
?TEXICLEAN?	-test -z "%TEXICLEAN%" \
?TEXICLEAN?	|| rm -rf %TEXICLEAN%

.PHONY maintainer-clean-am: maintainer-clean-aminfo
maintainer-clean-aminfo:
	@list='$(INFO_DEPS)'; for i in $$list; do \
## .iNN files are DJGPP-style info files.
	  i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
	  echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
	  rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
	done
## Use '-rf', not just '-f'; see comments in 'mostlyclean-aminfo'
## above for details.
?MAINTCLEAN?	-test -z "%MAINTCLEAN%" \
?MAINTCLEAN?	|| rm -rf %MAINTCLEAN%

endif %?LOCAL-TEXIS%
am/python.am000064400000012137150523165450007013 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1999-2018 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, see <https://www.gnu.org/licenses/>.

if %?INSTALL%
include inst-vars.am
endif %?INSTALL%

?FIRST?am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)

## ------------ ##
## Installing.  ##
## ------------ ##

if %?INSTALL%
am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
?EXEC?.PHONY install-exec-am: install-%DIR%PYTHON
?!EXEC?.PHONY install-data-am: install-%DIR%PYTHON
install-%DIR%PYTHON: $(%DIR%_PYTHON)
	@$(NORMAL_INSTALL)
if %?BASE%
	@list='$(%DIR%_PYTHON)'; dlist=; list2=; test -n "$(%NDIR%dir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	fi; \
	for p in $$list; do \
## A file can be in the source directory or the build directory.
	  if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
	  if test -f $$b$$p; then \
## Compute basename of source file.  Unless this is a nobase_ target, we
## want to install 'python/foo.py' as '$(DESTDIR)$(%NDIR%dir)/foo.py',
## not '$(DESTDIR)$(%NDIR%dir)/python/foo.py'.
	    $(am__strip_dir) \
	    dlist="$$dlist $$f"; \
	    list2="$$list2 $$b$$p"; \
	  else :; fi; \
	done; \
	for file in $$list2; do echo $$file; done | $(am__base_list) | \
	while read files; do \
## Don't perform translation, since script name is important.
	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(INSTALL_DATA) $$files "$(DESTDIR)$(%NDIR%dir)" || exit $$?; \
	done || exit $$?; \
## Byte-compile must be done at install time, since file times are
## encoded in the actual files.
	if test -n "$$dlist"; then \
	  $(am__py_compile) --destdir "$(DESTDIR)" \
	                    --basedir "$(%NDIR%dir)" $$dlist; \
	else :; fi
else !%?BASE%
	@list='$(%DIR%_PYTHON)'; test -n "$(%NDIR%dir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	fi; \
	$(am__nobase_list) | { while read dir files; do \
	  xfiles=; for p in $$files; do \
## A file can be in the source directory or the build directory.
	    if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
	    if test -f "$$b$$p"; then xfiles="$$xfiles $$b$$p"; dlist="$$dlist $$p"; \
	    else :; fi; done; \
	  test -z "$$xfiles" || { \
	    test "x$$dir" = x. || { \
	      echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
	      $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
## Don't perform translation, since script name is important.
	    echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
	    $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; }; \
	done; \
## Byte-compile must be done at install time, since file times are
## encoded in the actual files.
	if test -n "$$dlist"; then \
	  $(am__py_compile) --destdir "$(DESTDIR)" \
	                    --basedir "$(%NDIR%dir)" $$dlist; \
	else :; fi; }
endif !%?BASE%
endif %?INSTALL%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?INSTALL%

?FIRST?am__pep3147_tweak = \
?FIRST?  sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|'

.PHONY uninstall-am: uninstall-%DIR%PYTHON
uninstall-%DIR%PYTHON:
	@$(NORMAL_UNINSTALL)
	@list='$(%DIR%_PYTHON)'; test -n "$(%NDIR%dir)" || list=; \
?BASE?	py_files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
?!BASE?	$(am__nobase_strip_setup); py_files=`$(am__nobase_strip)`; \
	test -n "$$py_files" || exit 0; \
	dir='$(DESTDIR)$(%NDIR%dir)'; \
## Also remove the .pyc and .pyo byte compiled versions.
## This is somewhat tricky, because for newer pythons we have to take
## PEP-3147 into account.
	pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \
	pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \
	py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \
	echo "$$py_files_pep3147";\
	pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \
	pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \
	st=0; \
	for files in \
	  "$$py_files" \
	  "$$pyc_files" \
	  "$$pyo_files" \
## Installation of '.py' files is not influenced by PEP-3147, so it
## is correct *not* to have $pyfiles_pep3147 here.
	  "$$pyc_files_pep3147" \
	  "$$pyo_files_pep3147" \
	; do \
	  $(am__uninstall_files_from_dir) || st=$$?; \
	done; \
	exit $$st
endif %?INSTALL%


## ---------- ##
## Cleaning.  ##
## ---------- ##

## There is nothing to clean here since files are
## byte-compiled when (and where) they are installed.

## -------------- ##
## Distributing.  ##
## -------------- ##

if %?DIST%
DIST_COMMON += %DISTVAR%
endif %?DIST%
am/vala.am000064400000001401150523165450006405 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2008-2018 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, see <https://www.gnu.org/licenses/>.

## There is no rule here.  :-)
am/clean-hdr.am000064400000001463150523165450007327 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

.PHONY: distclean-hdr
distclean-am: distclean-hdr
distclean-hdr:
	-rm -f %FILES%
am/libs.am000064400000007462150523165450006430 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

if %?INSTALL%
include inst-vars.am
endif %?INSTALL%

## ------------ ##
## Installing.  ##
## ------------ ##

if %?INSTALL%
am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
?EXEC?.PHONY install-exec-am: install-%DIR%LIBRARIES
?!EXEC?.PHONY install-data-am: install-%DIR%LIBRARIES
install-%DIR%LIBRARIES: $(%DIR%_LIBRARIES)
	@$(NORMAL_INSTALL)
if %?BASE%
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
	@list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
	list2=; for p in $$list; do \
	  if test -f $$p; then \
	    list2="$$list2 $$p"; \
	  else :; fi; \
	done; \
	test -z "$$list2" || { \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	  echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(INSTALL_DATA) $$list2 "$(DESTDIR)$(%NDIR%dir)" || exit $$?; }
else !%?BASE%
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
	@list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
	if test -n "$$list"; then \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	fi; \
	$(am__nobase_list) | while read dir files; do \
	  xfiles=; for p in $$files; do \
	    if test -f "$$p"; then xfiles="$$xfiles $$p"; else :; fi; done; \
	  test -z "$$xfiles" || { \
	    test "x$$dir" = x. || { \
	      echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
	      $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
	    echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
	    $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; }; \
	done
endif !%?BASE%
## We do two loops here so that $(POST_INSTALL) can be empty.  If we
## merge the two loops, we get a syntax error from sh.  Anyway, having
## $(POST_INSTALL) in the middle of the loop essentially renders it
## useless; sh never actually executes this command.  Read the GNU
## Standards for a little enlightenment on this.
	@$(POST_INSTALL)
	@list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
	for p in $$list; do \
	  if test -f $$p; then \
?BASE?	    $(am__strip_dir) \
?!BASE?	    f=$$p; \
## Must ranlib after installing because mod time changes.
## cd to target directory because AIX ranlib messes up with whitespace
## in the argument.
	    echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && $(RANLIB) $$f )"; \
	    ( cd "$(DESTDIR)$(%NDIR%dir)" && $(RANLIB) $$f ) || exit $$?; \
	  else :; fi; \
	done
endif %?INSTALL%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?INSTALL%
.PHONY uninstall-am: uninstall-%DIR%LIBRARIES
uninstall-%DIR%LIBRARIES:
	@$(NORMAL_UNINSTALL)
	@list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
?BASE?	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
?!BASE?	$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
	dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
endif %?INSTALL%


## ---------- ##
## Cleaning.  ##
## ---------- ##

.PHONY clean-am: clean-%DIR%LIBRARIES
clean-%DIR%LIBRARIES:
	-test -z "$(%DIR%_LIBRARIES)" || rm -f $(%DIR%_LIBRARIES)
am/ltlib.am000064400000011602150523165450006574 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

if %?INSTALL%
include inst-vars.am
endif %?INSTALL%

## ------------ ##
## Installing.  ##
## ------------ ##

if %?INSTALL%

am__installdirs += "$(DESTDIR)$(%NDIR%dir)"

?EXEC?.PHONY install-exec-am: install-%DIR%LTLIBRARIES
?!EXEC?.PHONY install-data-am: install-%DIR%LTLIBRARIES

install-%DIR%LTLIBRARIES: $(%DIR%_LTLIBRARIES)
	@$(NORMAL_INSTALL)
if %?BASE%
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
	@list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
	list2=; for p in $$list; do \
	  if test -f $$p; then \
	    list2="$$list2 $$p"; \
	  else :; fi; \
	done; \
	test -z "$$list2" || { \
	  echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	  $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
## Note that we explicitly set the libtool mode.  This avoids any lossage
## if the program doesn't have a name that libtool expects.
## Use INSTALL and not INSTALL_DATA because libtool knows the right
## permissions to use.
?LIBTOOL?	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
?LIBTOOL?	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(%NDIR%dir)"; \
?!LIBTOOL?	  echo " $(INSTALL) $(INSTALL_STRIP_FLAG) $$list '$(DESTDIR)$(%NDIR%dir)'"; \
?!LIBTOOL?	  $(INSTALL) $(INSTALL_STRIP_FLAG) $$list "$(DESTDIR)$(%NDIR%dir)"; \
	}
else !%?BASE%
	@list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)"  || list=; \
	if test -n "$$list"; then \
	    echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	    $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
	fi; \
	for p in $$list; do if test -f "$$p"; then echo "$$p $$p"; else :; fi; done | \
	sed '/ .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
	$(AWK) 'BEGIN { cur = "." } \
	  { if ($$2 == cur) { files = files " " $$1 } \
	    else { print cur, files; files = $$1; cur = $$2 } } \
	  END { print cur, files }' | \
	while read dir files; do \
	  test -z "$$files" || { \
	    test "x$$dir" = x. || { \
	      echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
	      $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
## Note that we explicitly set the libtool mode.  This avoids any lossage
## if the program doesn't have a name that libtool expects.
## Use INSTALL and not INSTALL_DATA because libtool knows the right
## permissions to use.
?LIBTOOL?	    echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$files '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
?LIBTOOL?	    $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$files "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
?!LIBTOOL?	    echo " $(INSTALL) $(INSTALL_STRIP_FLAG) $$files '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
?!LIBTOOL?	    $(INSTALL) $(INSTALL_STRIP_FLAG) $$files "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
	  }; \
	done
endif !%?BASE%
endif %?INSTALL%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?INSTALL%
.PHONY uninstall-am: uninstall-%DIR%LTLIBRARIES
uninstall-%DIR%LTLIBRARIES:
	@$(NORMAL_UNINSTALL)
	@list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
	for p in $$list; do \
?BASE?	  $(am__strip_dir) \
?!BASE?	  f=$$p; \
?LIBTOOL?	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
?LIBTOOL?	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \
?!LIBTOOL?	  echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
?!LIBTOOL?	  rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \
	done
endif %?INSTALL%


## ---------- ##
## Cleaning.  ##
## ---------- ##

.PHONY clean-am: clean-%DIR%LTLIBRARIES
clean-%DIR%LTLIBRARIES:
	-test -z "$(%DIR%_LTLIBRARIES)" || rm -f $(%DIR%_LTLIBRARIES)
## 'so_locations' files are created by some linkers (IRIX, OSF) when
## building a shared object.  Libtool places these files in the
## directory where the shared object is created.
	@list='$(%DIR%_LTLIBRARIES)'; \
	locs=`for p in $$list; do echo $$p; done | \
	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
	      sort -u`; \
	test -z "$$locs" || { \
	  echo rm -f $${locs}; \
	  rm -f $${locs}; \
	}
am/configure.am000064400000015335150523165450007456 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.


## This dummy rule is called from subdirectories whenever one of the
## top-level Makefile's dependencies must be updated.  It does depend
## on %MAKEFILE% for the benefit of non-GNU make implementations (GNU
## make will always make sure %MAKEFILE% is updated before considering
## the am--refresh target anyway).
if %?TOPDIR_P%
.PHONY: am--refresh
am--refresh: %MAKEFILE%
	@:
endif %?TOPDIR_P%

## --------------------- ##
## Building Makefile.*.  ##
## --------------------- ##

## This rule remakes the Makefile.in.
%MAKEFILE-IN%: %MAINTAINER-MODE% %MAKEFILE-AM% %MAKEFILE-IN-DEPS% $(am__configure_deps)
## If configure.ac or one of configure's dependencies has changed, all
## Makefile.in are to be updated; it is then more efficient to run
## automake on all the Makefiles at once.  It also allow Automake to be
## run for newly added directories.
	@for dep in $?; do \
	  case '$(am__configure_deps)' in \
	    *$$dep*) \
?TOPDIR_P?	      echo ' cd $(srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS%'; \
?TOPDIR_P?	      $(am__cd) $(srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS% \
?TOPDIR_P?		&& exit 0; \
?!TOPDIR_P?	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
## If on the other hand, subdir/Makefile.in has been removed, then toplevel
## am--refresh will not be aware of any need to run.  We still invoke it
## due to $? listing all prerequisites.  Fix up for it by running the rebuild
## rule for this file only, below.
?!TOPDIR_P?	        && { if test -f $@; then exit 0; else break; fi; }; \
	      exit 1;; \
	  esac; \
	done; \
## Otherwise, rebuild only this file.
	echo ' cd $(top_srcdir) && $(AUTOMAKE) %AUTOMAKE-OPTIONS% %MAKEFILE-AM-SOURCES%'; \
	$(am__cd) $(top_srcdir) && \
	  $(AUTOMAKE) %AUTOMAKE-OPTIONS% %MAKEFILE-AM-SOURCES%

## Ensure that GNU make doesn't remove Makefile if ./config.status (below)
## is interrupted.  Otherwise, the user would need to know to rerun
## ./config.status to recreate the lost Makefile.
.PRECIOUS: %MAKEFILE%
## This rule remakes the Makefile.
%MAKEFILE%: %MAKEFILE-DEPS% $(top_builddir)/config.status
## If Makefile is to be updated because of config.status, then run
## config.status without argument in order to (i) rerun all the
## AC_CONFIG_COMMANDS including those that are not visible to
## Automake, and (ii) to save time by running config.status all with
## all the files, instead of once per file (iii) generate Makefiles
## in newly added directories.
	@case '$?' in \
## Don't prefix $(top_builddir), because GNU make will strip it out
## when it's '.'.
	  *config.status*) \
?TOPDIR_P?	    echo ' $(SHELL) ./config.status'; \
?TOPDIR_P?	    $(SHELL) ./config.status;; \
?!TOPDIR_P?	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
	  *) \
## FIXME: $(am__maybe_remake_depfiles) lets us re-run the rule to create the
## .P files.  Ideally we wouldn't have to do this by hand.
	    echo ' cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__maybe_remake_depfiles)'; \
	    cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__maybe_remake_depfiles);; \
	esac;

## Avoid the "deleted header file" problem for the dependencies.
##  Add the trailing "$(am__empty)" to trick Automake into not spuriously
## complaining about "duplicated targets" in case the %MAKEFILE-IN-DEPS%
## list expands to a single target that is also declared in some
## user-defined rule.
?HAVE-MAKEFILE-IN-DEPS?%MAKEFILE-IN-DEPS% $(am__empty):

DIST_COMMON += %MAKEFILE-AM%


## --------------------------- ##
## config.status & configure.  ##
## --------------------------- ##

if %?TOPDIR_P%
## Always require configure.ac and configure at top level, even if they
## don't exist.  This is especially important for configure, since it
## won't be created until autoconf is run -- which might be after
## automake is run.
DIST_COMMON += $(top_srcdir)/configure $(am__configure_deps)
endif %?TOPDIR_P%

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
?TOPDIR_P?	$(SHELL) ./config.status --recheck
?!TOPDIR_P?	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

$(top_srcdir)/configure: %MAINTAINER-MODE% $(am__configure_deps)
?TOPDIR_P?	$(am__cd) $(srcdir) && $(AUTOCONF)
?!TOPDIR_P?	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh


## ------------ ##
## aclocal.m4.  ##
## ------------ ##

## Whenever a configure dependency changes we need to rebuild
## aclocal.m4 too.  Changing configure.ac, or any file included by
## aclocal.m4 might require adding more files to aclocal.m4.  Hence
## the $(am__configure_deps) dependency.
## We still need $(ACLOCAL_AMFLAGS) for sake of backward-compatibility;
## we should hopefully be able to get rid of it in a not-so-distant
## future.
if %?REGEN-ACLOCAL-M4%
$(ACLOCAL_M4): %MAINTAINER-MODE% $(am__aclocal_m4_deps)
?TOPDIR_P?	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
?!TOPDIR_P?	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh

## Avoid the "deleted header file" problem for the dependencies.
$(am__aclocal_m4_deps):
endif %?REGEN-ACLOCAL-M4%


## --------- ##
## cleanup.  ##
## --------- ##

## We special-case config.status here.  If we do it as part of the
## normal clean processing for this directory, then it might be
## removed before some subdir is cleaned.  However, that subdir's
## Makefile depends on config.status.

if %?TOPDIR_P%
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 configure.lineno config.status.lineno
distclean:
	-rm -f $(am__CONFIG_DISTCLEAN_FILES)

## Note: you might think we should remove Makefile.in, configure, or
## aclocal.m4 here in a maintainer-clean rule.  However, the GNU
## Coding Standards explicitly prohibit this.

maintainer-clean:
	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
## autom4te.cache is created by Autoconf; the only valid target to
## remove it is maintainer-clean, not distclean.
## If you have an autom4te.cache that cause distcheck to fail, then
## it is good news: you finally discovered that autoconf and/or
## autoheader is needed to use your tarball, which is wrong.
	-rm -rf $(top_srcdir)/autom4te.cache


endif %?TOPDIR_P%
am/ltlibrary.am000064400000001646150523165450007501 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

%LTLIBRARY%: $(%XLTLIBRARY%_OBJECTS) $(%XLTLIBRARY%_DEPENDENCIES) $(EXTRA_%XLTLIBRARY%_DEPENDENCIES) %DIRSTAMP%
	%VERBOSE%$(%XLINK%) %RPATH% $(%XLTLIBRARY%_OBJECTS) $(%XLTLIBRARY%_LIBADD) $(LIBS)
am/mans-vars.am000064400000001532150523165450007376 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1994-2018 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, see <https://www.gnu.org/licenses/>.

NROFF = nroff
## We don't really need this, but we use it in case we ever want to
## support noinst_MANS.
MANS = %MANS%
am/java.am000064400000005455150523165450006420 0ustar00## automake - create Makefile.in from Makefile.am
## Copyright (C) 1998-2018 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, see <https://www.gnu.org/licenses/>.


## ---------- ##
## Building.  ##
## ---------- ##

if %?FIRST%
JAVAC = javac
CLASSPATH_ENV = CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT)$${CLASSPATH:+":$$CLASSPATH"}
JAVAROOT = $(top_builddir)
endif %?FIRST%

class%NDIR%.stamp: $(am__java_sources)
	@list1='$?'; list2=; if test -n "$$list1"; then \
	  for p in $$list1; do \
	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
	    list2="$$list2 $$d$$p"; \
	  done; \
	  echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) '"$$list2"; \
	  $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) $$list2; \
	else :; fi
	echo timestamp > $@


## ------------ ##
## Installing.  ##
## ------------ ##

if %?INSTALL%
am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
?EXEC?.PHONY install-exec-am: install-%DIR%JAVA
?!EXEC?.PHONY install-data-am: install-%DIR%JAVA
install-%DIR%JAVA: class%NDIR%.stamp
	@$(NORMAL_INSTALL)
## A single .java file can be compiled into multiple .class files.  So
## we just install all the .class files that got built into this
## directory.  This is not optimal, but will have to do for now.
	@test -n "$(%DIR%_JAVA)" && test -n "$(%NDIR%dir)" || exit 0; \
	echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
	$(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"; \
	set x *.class; shift; test "$$1" != "*.class" || exit 0; \
	echo " $(INSTALL_DATA)" "$$@" "'$(DESTDIR)$(%NDIR%dir)/$$p'"; \
	$(INSTALL_DATA) "$$@" "$(DESTDIR)$(%NDIR%dir)"
endif %?INSTALL%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

if %?INSTALL%
.PHONY uninstall-am: uninstall-%DIR%JAVA
uninstall-%DIR%JAVA:
	@$(NORMAL_UNINSTALL)
	@test -n "$(%DIR%_JAVA)" && test -n "$(%NDIR%dir)" || exit 0; \
	set x *.class; shift; test "$$1" != "*.class" || exit 0; \
	echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" "$$@" ")"; \
	cd "$(DESTDIR)$(%NDIR%dir)" && rm -f "$$@"
endif %?INSTALL%


## ---------- ##
## Cleaning.  ##
## ---------- ##

.PHONY clean-am: clean-%NDIR%JAVA
clean-%NDIR%JAVA:
	-rm -f *.class class%NDIR%.stamp


## -------------- ##
## Distributing.  ##
## -------------- ##

if %?DIST%
DIST_COMMON += %DISTVAR%
endif %?DIST%
INSTALL000064400000036614150523165450005615 0ustar00Installation Instructions
*************************

   Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
Foundation, Inc.

   Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.  This file is offered as-is,
without warranty of any kind.

Basic Installation
==================

   Briefly, the shell command './configure && make && make install'
should configure, build, and install this package.  The following
more-detailed instructions are generic; see the 'README' file for
instructions specific to this package.  Some packages provide this
'INSTALL' file but do not implement all of the features documented
below.  The lack of an optional feature in a given package is not
necessarily a bug.  More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.

   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, and a
file 'config.log' containing compiler output (useful mainly for
debugging 'configure').

   It can also use an optional file (typically called 'config.cache' and
enabled with '--cache-file=config.cache' or simply '-C') that saves the
results of its tests to speed up reconfiguring.  Caching is disabled by
default to prevent problems with accidental use of stale cache files.

   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 you are using the cache, and at
some point 'config.cache' contains results you don't want to keep, you
may remove or edit it.

   The file 'configure.ac' (or 'configure.in') is used to create
'configure' by a program called 'autoconf'.  You need 'configure.ac' 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.

     Running 'configure' might take a while.  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, generally using the just-built uninstalled binaries.

  4. Type 'make install' to install the programs and any data files and
     documentation.  When installing into a prefix owned by root, it is
     recommended that the package be configured and built as a regular
     user, and only the 'make install' phase executed with root
     privileges.

  5. Optionally, type 'make installcheck' to repeat any self-tests, but
     this time using the binaries in their final installed location.
     This target does not install anything.  Running this target as a
     regular user, particularly if the prior 'make install' required
     root privileges, verifies that the installation completed
     correctly.

  6. 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.

  7. Often, you can also type 'make uninstall' to remove the installed
     files again.  In practice, not all packages have tested that
     uninstallation works correctly, even though it is required by the
     GNU Coding Standards.

  8. Some packages, particularly those that use Automake, provide 'make
     distcheck', which can by used by developers to test that all other
     targets like 'make install' and 'make uninstall' work correctly.
     This target is generally not run by end users.

Compilers and Options
=====================

   Some systems require unusual options for compilation or linking that
the 'configure' script does not know about.  Run './configure --help'
for details on some of the pertinent environment variables.

   You can give 'configure' initial values for configuration parameters
by setting variables in the command line or in the environment.  Here is
an example:

     ./configure CC=c99 CFLAGS=-g LIBS=-lposix

   *Note Defining Variables::, for more details.

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 can use 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 '..'.  This is known
as a "VPATH" build.

   With a non-GNU 'make', it is safer 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.

   On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple '-arch' options to the
compiler but only a single '-arch' option to the preprocessor.  Like
this:

     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
                 CPP="gcc -E" CXXCPP="g++ -E"

   This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the 'lipo' tool if you have problems.

Installation Names
==================

   By default, 'make install' installs the package's commands under
'/usr/local/bin', include files under '/usr/local/include', etc.  You
can specify an installation prefix other than '/usr/local' by giving
'configure' the option '--prefix=PREFIX', where PREFIX must be an
absolute file name.

   You can specify separate installation prefixes for
architecture-specific files and architecture-independent files.  If you
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.

   In addition, if you use an unusual directory layout you can give
options like '--bindir=DIR' 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.  In general, the default
for these options is expressed in terms of '${prefix}', so that
specifying just '--prefix' will affect all of the other directory
specifications that were not explicitly provided.

   The most portable way to affect installation locations is to pass the
correct locations to 'configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
'make install' command line to change installation locations without
having to reconfigure or recompile.

   The first method involves providing an override variable for each
affected directory.  For example, 'make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
'${prefix}'.  Any directories that were specified during 'configure',
but not in terms of '${prefix}', must each be overridden at install time
for the entire installation to be relocated.  The approach of makefile
variable overrides for each directory variable is required by the GNU
Coding Standards, and ideally causes no recompilation.  However, some
platforms have known limitations with the semantics of shared libraries
that end up requiring recompilation when using this method, particularly
noticeable in packages that use GNU Libtool.

   The second method involves providing the 'DESTDIR' variable.  For
example, 'make install DESTDIR=/alternate/directory' will prepend
'/alternate/directory' before all installation names.  The approach of
'DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters.  On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of '${prefix}'
at 'configure' time.

Optional Features
=================

   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'.

   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.

   Some packages offer the ability to configure how verbose the
execution of 'make' will be.  For these packages, running './configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with 'make V=1'; while running './configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with 'make V=0'.

Particular systems
==================

   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU CC
is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:

     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"

and if that doesn't work, install pre-built binaries of GCC for HP-UX.

   HP-UX 'make' updates targets which have the same time stamps as their
prerequisites, which makes it generally unusable when shipped generated
files such as 'configure' are involved.  Use GNU 'make' instead.

   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its '<wchar.h>' header file.  The option '-nodtk' can be used as a
workaround.  If GNU CC is not installed, it is therefore recommended to
try

     ./configure CC="cc"

and if that doesn't work, try

     ./configure CC="cc -nodtk"

   On Solaris, don't put '/usr/ucb' early in your 'PATH'.  This
directory contains several dysfunctional programs; working variants of
these programs are available in '/usr/bin'.  So, if you need '/usr/ucb'
in your 'PATH', put it _after_ '/usr/bin'.

   On Haiku, software installed for all users goes in '/boot/common',
not '/usr/local'.  It is recommended to use the following options:

     ./configure --prefix=/boot/common

Specifying the System Type
==========================

   There may be some features 'configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on.  Usually, assuming the package is built to be run on the
_same_ architectures, 'configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
'--build=TYPE' option.  TYPE can either be a short name for the system
type, such as 'sun4', or a canonical name which has the form:

     CPU-COMPANY-SYSTEM

where SYSTEM can have one of these forms:

     OS
     KERNEL-OS

   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 machine type.

   If you are _building_ compiler tools for cross-compiling, you should
use the option '--target=TYPE' to select the type of system they will
produce code for.

   If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with '--host=TYPE'.

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.

Defining Variables
==================

   Variables not defined in a site shell script can be set in the
environment passed to 'configure'.  However, some packages may run
configure again during the build, and the customized values of these
variables may be lost.  In order to avoid this problem, you should set
them in the 'configure' command line, using 'VAR=value'.  For example:

     ./configure CC=/usr/local2/bin/gcc

causes the specified 'gcc' to be used as the C compiler (unless it is
overridden in the site shell script).

Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
Autoconf limitation.  Until the limitation is lifted, you can use this
workaround:

     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash

'configure' Invocation
======================

   'configure' recognizes the following options to control how it
operates.

'--help'
'-h'
     Print a summary of all of the options to 'configure', and exit.

'--help=short'
'--help=recursive'
     Print a summary of the options unique to this package's
     'configure', and exit.  The 'short' variant lists options used only
     in the top level, while the 'recursive' variant lists options also
     present in any nested packages.

'--version'
'-V'
     Print the version of Autoconf used to generate the 'configure'
     script, and exit.

'--cache-file=FILE'
     Enable the cache: use and save the results of the tests in FILE,
     traditionally 'config.cache'.  FILE defaults to '/dev/null' to
     disable caching.

'--config-cache'
'-C'
     Alias for '--cache-file=config.cache'.

'--quiet'
'--silent'
'-q'
     Do not print messages saying which checks are being made.  To
     suppress all normal output, redirect it to '/dev/null' (any error
     messages will still be shown).

'--srcdir=DIR'
     Look for the package's source code in directory DIR.  Usually
     'configure' can determine that directory automatically.

'--prefix=DIR'
     Use DIR as the installation prefix.  *note Installation Names:: for
     more details, including other options available for fine-tuning the
     installation locations.

'--no-create'
'-n'
     Run the configure checks, but stop before creating any output
     files.

'configure' also accepts some other, not widely useful, options.  Run
'configure --help' for more details.
COPYING000064400000104513150523165450005611 0ustar00                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    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 3 of the License, 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, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
texinfo.tex000064400001352403150523165450006760 0ustar00% texinfo.tex -- TeX macros to handle Texinfo files.
% 
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{2018-02-12.17}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
% Free Software Foundation, Inc.
%
% This texinfo.tex file is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
% published by the Free Software Foundation, either version 3 of the
% License, or (at your option) any later version.
%
% This texinfo.tex file is distributed in the hope that it will be
% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <https://www.gnu.org/licenses/>.
%
% As a special exception, when this file is read by TeX when processing
% a Texinfo source document, you may use the result without
% restriction. This Exception is an additional permission under section 7
% of the GNU General Public License, version 3 ("GPLv3").
%
% Please try the latest version of texinfo.tex before submitting bug
% reports; you can get the latest version from:
%   https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
%   https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
%   https://www.gnu.org/software/texinfo/ (the Texinfo home page)
% The texinfo.tex in any given distribution could well be out
% of date, so if that's what you're using, please check.
%
% Send bug reports to bug-texinfo@gnu.org.  Please include including a
% complete document in each bug report with which we can reproduce the
% problem.  Patches are, of course, greatly appreciated.
%
% To process a Texinfo manual with TeX, it's most reliable to use the
% texi2dvi shell script that comes with the distribution.  For a simple
% manual foo.texi, however, you can get away with this:
%   tex foo.texi
%   texindex foo.??
%   tex foo.texi
%   tex foo.texi
%   dvips foo.dvi -o  # or whatever; this makes foo.ps.
% The extra TeX runs get the cross-reference information correct.
% Sometimes one run after texindex suffices, and sometimes you need more
% than two; texi2dvi does it as many times as necessary.
%
% It is possible to adapt texinfo.tex for other languages, to some
% extent.  You can get the existing language-specific files from the
% full Texinfo distribution.
%
% The GNU Texinfo home page is https://www.gnu.org/software/texinfo.


\message{Loading texinfo [version \texinfoversion]:}

% If in a .fmt file, print the version number
% and turn on active characters that we couldn't do earlier because
% they might have appeared in the input file name.
\everyjob{\message{[Texinfo version \texinfoversion]}%
  \catcode`+=\active \catcode`\_=\active}

% LaTeX's \typeout.  This ensures that the messages it is used for
% are identical in format to the corresponding ones from latex/pdflatex.
\def\typeout{\immediate\write17}%

\chardef\other=12

% We never want plain's \outer definition of \+ in Texinfo.
% For @tex, we can use \tabalign.
\let\+ = \relax

% Save some plain tex macros whose names we will redefine.
\let\ptexb=\b
\let\ptexbullet=\bullet
\let\ptexc=\c
\let\ptexcomma=\,
\let\ptexdot=\.
\let\ptexdots=\dots
\let\ptexend=\end
\let\ptexequiv=\equiv
\let\ptexexclam=\!
\let\ptexfootnote=\footnote
\let\ptexgtr=>
\let\ptexhat=^
\let\ptexi=\i
\let\ptexindent=\indent
\let\ptexinsert=\insert
\let\ptexlbrace=\{
\let\ptexless=<
\let\ptexnewwrite\newwrite
\let\ptexnoindent=\noindent
\let\ptexplus=+
\let\ptexraggedright=\raggedright
\let\ptexrbrace=\}
\let\ptexslash=\/
\let\ptexsp=\sp
\let\ptexstar=\*
\let\ptexsup=\sup
\let\ptext=\t
\let\ptextop=\top
{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode

% If this character appears in an error message or help string, it
% starts a new line in the output.
\newlinechar = `^^J

% Use TeX 3.0's \inputlineno to get the line number, for better error
% messages, but if we're using an old version of TeX, don't do anything.
%
\ifx\inputlineno\thisisundefined
  \let\linenumber = \empty % Pre-3.0.
\else
  \def\linenumber{l.\the\inputlineno:\space}
\fi

% Set up fixed words for English if not already set.
\ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
\ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
\ifx\putworderror\undefined     \gdef\putworderror{error}\fi
\ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
\ifx\putwordin\undefined        \gdef\putwordin{in}\fi
\ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
\ifx\putwordIndexNonexistent\undefined   \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
\ifx\putwordInfo\undefined      \gdef\putwordInfo{Info}\fi
\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
\ifx\putwordMethodon\undefined  \gdef\putwordMethodon{Method on}\fi
\ifx\putwordNoTitle\undefined   \gdef\putwordNoTitle{No Title}\fi
\ifx\putwordof\undefined        \gdef\putwordof{of}\fi
\ifx\putwordon\undefined        \gdef\putwordon{on}\fi
\ifx\putwordpage\undefined      \gdef\putwordpage{page}\fi
\ifx\putwordsection\undefined   \gdef\putwordsection{section}\fi
\ifx\putwordSection\undefined   \gdef\putwordSection{Section}\fi
\ifx\putwordsee\undefined       \gdef\putwordsee{see}\fi
\ifx\putwordSee\undefined       \gdef\putwordSee{See}\fi
\ifx\putwordShortTOC\undefined  \gdef\putwordShortTOC{Short Contents}\fi
\ifx\putwordTOC\undefined       \gdef\putwordTOC{Table of Contents}\fi
%
\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
%
\ifx\putwordDefmac\undefined    \gdef\putwordDefmac{Macro}\fi
\ifx\putwordDefspec\undefined   \gdef\putwordDefspec{Special Form}\fi
\ifx\putwordDefvar\undefined    \gdef\putwordDefvar{Variable}\fi
\ifx\putwordDefopt\undefined    \gdef\putwordDefopt{User Option}\fi
\ifx\putwordDeffunc\undefined   \gdef\putwordDeffunc{Function}\fi

% Give the space character the catcode for a space.
\def\spaceisspace{\catcode`\ =10\relax}

% Likewise for ^^M, the end of line character.
\def\endlineisspace{\catcode13=10\relax}

\chardef\dashChar  = `\-
\chardef\slashChar = `\/
\chardef\underChar = `\_

% Ignore a token.
%
\def\gobble#1{}

% The following is used inside several \edef's.
\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}

% Hyphenation fixes.
\hyphenation{
  Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
  auto-ma-ti-cal-ly ap-pen-dix bit-map bit-maps
  data-base data-bases eshell fall-ing half-way long-est man-u-script
  man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
  par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
  spell-ing spell-ings
  stand-alone strong-est time-stamp time-stamps which-ever white-space
  wide-spread wrap-around
}

% Sometimes it is convenient to have everything in the transcript file
% and nothing on the terminal.  We don't just call \tracingall here,
% since that produces some useless output on the terminal.  We also make
% some effort to order the tracing commands to reduce output in the log
% file; cf. trace.sty in LaTeX.
%
\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
\def\loggingall{%
  \tracingstats2
  \tracingpages1
  \tracinglostchars2  % 2 gives us more in etex
  \tracingparagraphs1
  \tracingoutput1
  \tracingmacros2
  \tracingrestores1
  \showboxbreadth\maxdimen \showboxdepth\maxdimen
  \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
    \tracingscantokens1
    \tracingifs1
    \tracinggroups1
    \tracingnesting2
    \tracingassigns1
  \fi
  \tracingcommands3  % 3 gives us more in etex
  \errorcontextlines16
}%

% @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
% aren't perfect, it's not the end of the world, being an error message,
% after all.
% 
\def\errormsg{\begingroup \indexnofonts \doerrormsg}
\def\doerrormsg#1{\errmessage{#1}}

% add check for \lastpenalty to plain's definitions.  If the last thing
% we did was a \nobreak, we don't want to insert more space.
%
\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  \removelastskip\penalty-50\smallskip\fi\fi}
\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  \removelastskip\penalty-100\medskip\fi\fi}
\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  \removelastskip\penalty-200\bigskip\fi\fi}

% Output routine
%

% For a final copy, take out the rectangles
% that mark overfull boxes (in case you have decided
% that the text looks ok even though it passes the margin).
%
\def\finalout{\overfullrule=0pt }

% Do @cropmarks to get crop marks.
%
\newif\ifcropmarks
\let\cropmarks = \cropmarkstrue
%
% Dimensions to add cropmarks at corners.
% Added by P. A. MacKay, 12 Nov. 1986
%
\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
\newdimen\cornerlong  \cornerlong=1pc
\newdimen\cornerthick \cornerthick=.3pt
\newdimen\topandbottommargin \topandbottommargin=.75in

% Output a mark which sets \thischapter, \thissection and \thiscolor.
% We dump everything together because we only have one kind of mark.
% This works because we only use \botmark / \topmark, not \firstmark.
%
% A mark contains a subexpression of the \ifcase ... \fi construct.
% \get*marks macros below extract the needed part using \ifcase.
%
% Another complication is to let the user choose whether \thischapter
% (\thissection) refers to the chapter (section) in effect at the top
% of a page, or that at the bottom of a page.

% \domark is called twice inside \chapmacro, to add one
% mark before the section break, and one after.
%   In the second call \prevchapterdefs is the same as \lastchapterdefs,
% and \prevsectiondefs is the same as \lastsectiondefs.
%   Then if the page is not broken at the mark, some of the previous
% section appears on the page, and we can get the name of this section
% from \firstmark for @everyheadingmarks top.
%   @everyheadingmarks bottom uses \botmark.
%
% See page 260 of The TeXbook.
\def\domark{%
  \toks0=\expandafter{\lastchapterdefs}%
  \toks2=\expandafter{\lastsectiondefs}%
  \toks4=\expandafter{\prevchapterdefs}%
  \toks6=\expandafter{\prevsectiondefs}%
  \toks8=\expandafter{\lastcolordefs}%
  \mark{%
                   \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
      \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
    \noexpand\else \the\toks8             % 2: color marks
  }%
}

% \gettopheadingmarks, \getbottomheadingmarks,
% \getcolormarks - extract needed part of mark.
%
% \topmark doesn't work for the very first chapter (after the title
% page or the contents), so we use \firstmark there -- this gets us
% the mark with the chapter defs, unless the user sneaks in, e.g.,
% @setcolor (or @url, or @link, etc.) between @contents and the very
% first @chapter.
\def\gettopheadingmarks{%
  \ifcase0\topmark\fi
  \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
}
\def\getbottomheadingmarks{\ifcase1\botmark\fi}
\def\getcolormarks{\ifcase2\topmark\fi}

% Avoid "undefined control sequence" errors.
\def\lastchapterdefs{}
\def\lastsectiondefs{}
\def\lastsection{}
\def\prevchapterdefs{}
\def\prevsectiondefs{}
\def\lastcolordefs{}

% Margin to add to right of even pages, to left of odd pages.
\newdimen\bindingoffset
\newdimen\normaloffset
\newdimen\txipagewidth \newdimen\txipageheight

% Main output routine.
%
\chardef\PAGE = 255
\output = {\onepageout{\pagecontents\PAGE}}

\newbox\headlinebox
\newbox\footlinebox

% \onepageout takes a vbox as an argument.
% \shipout a vbox for a single page, adding an optional header, footer,
% cropmarks, and footnote.  This also causes index entries for this page
% to be written to the auxiliary files.
%
\def\onepageout#1{%
  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  %
  \ifodd\pageno  \advance\hoffset by \bindingoffset
  \else \advance\hoffset by -\bindingoffset\fi
  %
  % Common context changes for both heading and footing.
  % Do this outside of the \shipout so @code etc. will be expanded in
  % the headline as they should be, not taken literally (outputting ''code).
  \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
  %
  % Retrieve the information for the headings from the marks in the page,
  % and call Plain TeX's \makeheadline and \makefootline, which use the
  % values in \headline and \footline.
  %
  % This is used to check if we are on the first page of a chapter.
  \ifcase1\topmark\fi
  \let\prevchaptername\thischaptername
  \ifcase0\firstmark\fi
  \let\curchaptername\thischaptername
  %
  \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
  \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
  %
  \ifx\curchaptername\prevchaptername
    \let\thischapterheading\thischapter
  \else
    % \thischapterheading is the same as \thischapter except it is blank
    % for the first page of a chapter.  This is to prevent the chapter name 
    % being shown twice.
    \def\thischapterheading{}%
  \fi
  %
  \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
  \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
  %
  {%
    % Set context for writing to auxiliary files like index files.
    % Have to do this stuff outside the \shipout because we want it to
    % take effect in \write's, yet the group defined by the \vbox ends
    % before the \shipout runs.
    %
    \indexdummies         % don't expand commands in the output.
    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
               % the page break happens to be in the middle of an example.
               % We don't want .vr (or whatever) entries like this:
               % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
               % "\acronym" won't work when it's read back in;
               % it needs to be
               % {\code {{\backslashcurfont }acronym}
    \shipout\vbox{%
      % Do this early so pdf references go to the beginning of the page.
      \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
      %
      \ifcropmarks \vbox to \outervsize\bgroup
        \hsize = \outerhsize
        \vskip-\topandbottommargin
        \vtop to0pt{%
          \line{\ewtop\hfil\ewtop}%
          \nointerlineskip
          \line{%
            \vbox{\moveleft\cornerthick\nstop}%
            \hfill
            \vbox{\moveright\cornerthick\nstop}%
          }%
          \vss}%
        \vskip\topandbottommargin
        \line\bgroup
          \hfil % center the page within the outer (page) hsize.
          \ifodd\pageno\hskip\bindingoffset\fi
          \vbox\bgroup
      \fi
      %
      \unvbox\headlinebox
      \pagebody{#1}%
      \ifdim\ht\footlinebox > 0pt
        % Only leave this space if the footline is nonempty.
        % (We lessened \vsize for it in \oddfootingyyy.)
        % The \baselineskip=24pt in plain's \makefootline has no effect.
        \vskip 24pt
        \unvbox\footlinebox
      \fi
      %
      \ifcropmarks
          \egroup % end of \vbox\bgroup
        \hfil\egroup % end of (centering) \line\bgroup
        \vskip\topandbottommargin plus1fill minus1fill
        \boxmaxdepth = \cornerthick
        \vbox to0pt{\vss
          \line{%
            \vbox{\moveleft\cornerthick\nsbot}%
            \hfill
            \vbox{\moveright\cornerthick\nsbot}%
          }%
          \nointerlineskip
          \line{\ewbot\hfil\ewbot}%
        }%
      \egroup % \vbox from first cropmarks clause
      \fi
    }% end of \shipout\vbox
  }% end of group with \indexdummies
  \advancepageno
  \ifnum\outputpenalty>-20000 \else\dosupereject\fi
}

\newinsert\margin \dimen\margin=\maxdimen

% Main part of page, including any footnotes
\def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
{\catcode`\@ =11
\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
% marginal hacks, juha@viisa.uucp (Juha Takala)
\ifvoid\margin\else % marginal info is present
  \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
\dimen@=\dp#1\relax \unvbox#1\relax
\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
}

% Here are the rules for the cropmarks.  Note that they are
% offset so that the space between them is truly \outerhsize or \outervsize
% (P. A. MacKay, 12 November, 1986)
%
\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
\def\nstop{\vbox
  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
\def\nsbot{\vbox
  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}


% Argument parsing

% Parse an argument, then pass it to #1.  The argument is the rest of
% the input line (except we remove a trailing comment).  #1 should be a
% macro which expects an ordinary undelimited TeX argument.
% For example, \def\foo{\parsearg\fooxxx}.
%
\def\parsearg{\parseargusing{}}
\def\parseargusing#1#2{%
  \def\argtorun{#2}%
  \begingroup
    \obeylines
    \spaceisspace
    #1%
    \parseargline\empty% Insert the \empty token, see \finishparsearg below.
}

{\obeylines %
  \gdef\parseargline#1^^M{%
    \endgroup % End of the group started in \parsearg.
    \argremovecomment #1\comment\ArgTerm%
  }%
}

% First remove any @comment, then any @c comment.  Also remove a @texinfoc
% comment (see \scanmacro for details).  Pass the result on to \argcheckspaces.
\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
\def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
\def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}

% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
%
% \argremovec might leave us with trailing space, e.g.,
%    @end itemize  @c foo
% This space token undergoes the same procedure and is eventually removed
% by \finishparsearg.
%
\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
  \def\temp{#3}%
  \ifx\temp\empty
    % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
    \let\temp\finishparsearg
  \else
    \let\temp\argcheckspaces
  \fi
  % Put the space token in:
  \temp#1 #3\ArgTerm
}

% If a _delimited_ argument is enclosed in braces, they get stripped; so
% to get _exactly_ the rest of the line, we had to prevent such situation.
% We prepended an \empty token at the very beginning and we expand it now,
% just before passing the control to \argtorun.
% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
% either the null string, or it ends with \^^M---thus there is no danger
% that a pair of braces would be stripped.
%
% But first, we have to remove the trailing space token.
%
\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}


% \parseargdef - define a command taking an argument on the line
%
% \parseargdef\foo{...}
%	is roughly equivalent to
% \def\foo{\parsearg\Xfoo}
% \def\Xfoo#1{...}
\def\parseargdef#1{%
  \expandafter \doparseargdef \csname\string#1\endcsname #1%
}
\def\doparseargdef#1#2{%
  \def#2{\parsearg#1}%
  \def#1##1%
}

% Several utility definitions with active space:
{
  \obeyspaces
  \gdef\obeyedspace{ }

  % Make each space character in the input produce a normal interword
  % space in the output.  Don't allow a line break at this space, as this
  % is used only in environments like @example, where each line of input
  % should produce a line of output anyway.
  %
  \gdef\sepspaces{\obeyspaces\let =\tie}

  % If an index command is used in an @example environment, any spaces
  % therein should become regular spaces in the raw index file, not the
  % expansion of \tie (\leavevmode \penalty \@M \ ).
  \gdef\unsepspaces{\let =\space}
}


\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}

% Define the framework for environments in texinfo.tex.  It's used like this:
%
%   \envdef\foo{...}
%   \def\Efoo{...}
%
% It's the responsibility of \envdef to insert \begingroup before the
% actual body; @end closes the group after calling \Efoo.  \envdef also
% defines \thisenv, so the current environment is known; @end checks
% whether the environment name matches.  The \checkenv macro can also be
% used to check whether the current environment is the one expected.
%
% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
% are not treated as environments; they don't open a group.  (The
% implementation of @end takes care not to call \endgroup in this
% special case.)


% At run-time, environments start with this:
\def\startenvironment#1{\begingroup\def\thisenv{#1}}
% initialize
\let\thisenv\empty

% ... but they get defined via ``\envdef\foo{...}'':
\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}

% Check whether we're in the right environment:
\def\checkenv#1{%
  \def\temp{#1}%
  \ifx\thisenv\temp
  \else
    \badenverr
  \fi
}

% Environment mismatch, #1 expected:
\def\badenverr{%
  \errhelp = \EMsimple
  \errmessage{This command can appear only \inenvironment\temp,
    not \inenvironment\thisenv}%
}
\def\inenvironment#1{%
  \ifx#1\empty
    outside of any environment%
  \else
    in environment \expandafter\string#1%
  \fi
}

% @end foo executes the definition of \Efoo.
% But first, it executes a specialized version of \checkenv
%
\parseargdef\end{%
  \if 1\csname iscond.#1\endcsname
  \else
    % The general wording of \badenverr may not be ideal.
    \expandafter\checkenv\csname#1\endcsname
    \csname E#1\endcsname
    \endgroup
  \fi
}

\newhelp\EMsimple{Press RETURN to continue.}


% Be sure we're in horizontal mode when doing a tie, since we make space
% equivalent to this in @example-like environments. Otherwise, a space
% at the beginning of a line will start with \penalty -- and
% since \penalty is valid in vertical mode, we'd end up putting the
% penalty on the vertical list instead of in the new paragraph.
{\catcode`@ = 11
 % Avoid using \@M directly, because that causes trouble
 % if the definition is written into an index file.
 \global\let\tiepenalty = \@M
 \gdef\tie{\leavevmode\penalty\tiepenalty\ }
}

% @: forces normal size whitespace following.
\def\:{\spacefactor=1000 }

% @* forces a line break.
\def\*{\unskip\hfil\break\hbox{}\ignorespaces}

% @/ allows a line break.
\let\/=\allowbreak

% @. is an end-of-sentence period.
\def\.{.\spacefactor=\endofsentencespacefactor\space}

% @! is an end-of-sentence bang.
\def\!{!\spacefactor=\endofsentencespacefactor\space}

% @? is an end-of-sentence query.
\def\?{?\spacefactor=\endofsentencespacefactor\space}

% @frenchspacing on|off  says whether to put extra space after punctuation.
%
\def\onword{on}
\def\offword{off}
%
\parseargdef\frenchspacing{%
  \def\temp{#1}%
  \ifx\temp\onword \plainfrenchspacing
  \else\ifx\temp\offword \plainnonfrenchspacing
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
  \fi\fi
}

% @w prevents a word break.  Without the \leavevmode, @w at the
% beginning of a paragraph, when TeX is still in vertical mode, would
% produce a whole line of output instead of starting the paragraph.
\def\w#1{\leavevmode\hbox{#1}}

% @group ... @end group forces ... to be all on one page, by enclosing
% it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
% to keep its height that of a normal line.  According to the rules for
% \topskip (p.114 of the TeXbook), the glue inserted is
% max (\topskip - \ht (first item), 0).  If that height is large,
% therefore, no glue is inserted, and the space between the headline and
% the text is small, which looks bad.
%
% Another complication is that the group might be very large.  This can
% cause the glue on the previous page to be unduly stretched, because it
% does not have much material.  In this case, it's better to add an
% explicit \vfill so that the extra space is at the bottom.  The
% threshold for doing this is if the group is more than \vfilllimit
% percent of a page (\vfilllimit can be changed inside of @tex).
%
\newbox\groupbox
\def\vfilllimit{0.7}
%
\envdef\group{%
  \ifnum\catcode`\^^M=\active \else
    \errhelp = \groupinvalidhelp
    \errmessage{@group invalid in context where filling is enabled}%
  \fi
  \startsavinginserts
  %
  \setbox\groupbox = \vtop\bgroup
    % Do @comment since we are called inside an environment such as
    % @example, where each end-of-line in the input causes an
    % end-of-line in the output.  We don't want the end-of-line after
    % the `@group' to put extra space in the output.  Since @group
    % should appear on a line by itself (according to the Texinfo
    % manual), we don't worry about eating any user text.
    \comment
}
%
% The \vtop produces a box with normal height and large depth; thus, TeX puts
% \baselineskip glue before it, and (when the next line of text is done)
% \lineskip glue after it.  Thus, space below is not quite equal to space
% above.  But it's pretty close.
\def\Egroup{%
    % To get correct interline space between the last line of the group
    % and the first line afterwards, we have to propagate \prevdepth.
    \endgraf % Not \par, as it may have been set to \lisppar.
    \global\dimen1 = \prevdepth
  \egroup           % End the \vtop.
  \addgroupbox
  \prevdepth = \dimen1
  \checkinserts
}

\def\addgroupbox{
  % \dimen0 is the vertical size of the group's box.
  \dimen0 = \ht\groupbox  \advance\dimen0 by \dp\groupbox
  % \dimen2 is how much space is left on the page (more or less).
  \dimen2 = \txipageheight   \advance\dimen2 by -\pagetotal
  % if the group doesn't fit on the current page, and it's a big big
  % group, force a page break.
  \ifdim \dimen0 > \dimen2
    \ifdim \pagetotal < \vfilllimit\txipageheight
      \page
    \fi
  \fi
  \box\groupbox
}

%
% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
% message, so this ends up printing `@group can only ...'.
%
\newhelp\groupinvalidhelp{%
group can only be used in environments such as @example,^^J%
where each line of input produces a line of output.}

% @need space-in-mils
% forces a page break if there is not space-in-mils remaining.

\newdimen\mil  \mil=0.001in

\parseargdef\need{%
  % Ensure vertical mode, so we don't make a big box in the middle of a
  % paragraph.
  \par
  %
  % If the @need value is less than one line space, it's useless.
  \dimen0 = #1\mil
  \dimen2 = \ht\strutbox
  \advance\dimen2 by \dp\strutbox
  \ifdim\dimen0 > \dimen2
    %
    % Do a \strut just to make the height of this box be normal, so the
    % normal leading is inserted relative to the preceding line.
    % And a page break here is fine.
    \vtop to #1\mil{\strut\vfil}%
    %
    % TeX does not even consider page breaks if a penalty added to the
    % main vertical list is 10000 or more.  But in order to see if the
    % empty box we just added fits on the page, we must make it consider
    % page breaks.  On the other hand, we don't want to actually break the
    % page after the empty box.  So we use a penalty of 9999.
    %
    % There is an extremely small chance that TeX will actually break the
    % page at this \penalty, if there are no other feasible breakpoints in
    % sight.  (If the user is using lots of big @group commands, which
    % almost-but-not-quite fill up a page, TeX will have a hard time doing
    % good page breaking, for example.)  However, I could not construct an
    % example where a page broke at this \penalty; if it happens in a real
    % document, then we can reconsider our strategy.
    \penalty9999
    %
    % Back up by the size of the box, whether we did a page break or not.
    \kern -#1\mil
    %
    % Do not allow a page break right after this kern.
    \nobreak
  \fi
}

% @br   forces paragraph break (and is undocumented).

\let\br = \par

% @page forces the start of a new page.
%
\def\page{\par\vfill\supereject}

% @exdent text....
% outputs text on separate line in roman font, starting at standard page margin

% This records the amount of indent in the innermost environment.
% That's how much \exdent should take out.
\newskip\exdentamount

% This defn is used inside fill environments such as @defun.
\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}

% This defn is used inside nofill environments such as @example.
\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
  \leftline{\hskip\leftskip{\rm#1}}}}

% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
% paragraph.  For more general purposes, use the \margin insertion
% class.  WHICH is `l' or `r'.  Not documented, written for gawk manual.
%
\newskip\inmarginspacing \inmarginspacing=1cm
\def\strutdepth{\dp\strutbox}
%
\def\doinmargin#1#2{\strut\vadjust{%
  \nobreak
  \kern-\strutdepth
  \vtop to \strutdepth{%
    \baselineskip=\strutdepth
    \vss
    % if you have multiple lines of stuff to put here, you'll need to
    % make the vbox yourself of the appropriate size.
    \ifx#1l%
      \llap{\ignorespaces #2\hskip\inmarginspacing}%
    \else
      \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
    \fi
    \null
  }%
}}
\def\inleftmargin{\doinmargin l}
\def\inrightmargin{\doinmargin r}
%
% @inmargin{TEXT [, RIGHT-TEXT]}
% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
% else use TEXT for both).
%
\def\inmargin#1{\parseinmargin #1,,\finish}
\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  \setbox0 = \hbox{\ignorespaces #2}%
  \ifdim\wd0 > 0pt
    \def\lefttext{#1}%  have both texts
    \def\righttext{#2}%
  \else
    \def\lefttext{#1}%  have only one text
    \def\righttext{#1}%
  \fi
  %
  \ifodd\pageno
    \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  \else
    \def\temp{\inleftmargin\lefttext}%
  \fi
  \temp
}

% @include FILE -- \input text of FILE.
%
\def\include{\parseargusing\filenamecatcodes\includezzz}
\def\includezzz#1{%
  \pushthisfilestack
  \def\thisfile{#1}%
  {%
    \makevalueexpandable  % we want to expand any @value in FILE.
    \turnoffactive        % and allow special characters in the expansion
    \indexnofonts         % Allow `@@' and other weird things in file names.
    \wlog{texinfo.tex: doing @include of #1^^J}%
    \edef\temp{\noexpand\input #1 }%
    %
    % This trickery is to read FILE outside of a group, in case it makes
    % definitions, etc.
    \expandafter
  }\temp
  \popthisfilestack
}
\def\filenamecatcodes{%
  \catcode`\\=\other
  \catcode`~=\other
  \catcode`^=\other
  \catcode`_=\other
  \catcode`|=\other
  \catcode`<=\other
  \catcode`>=\other
  \catcode`+=\other
  \catcode`-=\other
  \catcode`\`=\other
  \catcode`\'=\other
}

\def\pushthisfilestack{%
  \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
}
\def\pushthisfilestackX{%
  \expandafter\pushthisfilestackY\thisfile\StackTerm
}
\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
  \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
}

\def\popthisfilestack{\errthisfilestackempty}
\def\errthisfilestackempty{\errmessage{Internal error:
  the stack of filenames is empty.}}
%
\def\thisfile{}

% @center line
% outputs that line, centered.
%
\parseargdef\center{%
  \ifhmode
    \let\centersub\centerH
  \else
    \let\centersub\centerV
  \fi
  \centersub{\hfil \ignorespaces#1\unskip \hfil}%
  \let\centersub\relax % don't let the definition persist, just in case
}
\def\centerH#1{{%
  \hfil\break
  \advance\hsize by -\leftskip
  \advance\hsize by -\rightskip
  \line{#1}%
  \break
}}
%
\newcount\centerpenalty
\def\centerV#1{%
  % The idea here is the same as in \startdefun, \cartouche, etc.: if
  % @center is the first thing after a section heading, we need to wipe
  % out the negative parskip inserted by \sectionheading, but still
  % prevent a page break here.
  \centerpenalty = \lastpenalty
  \ifnum\centerpenalty>10000 \vskip\parskip \fi
  \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
  \line{\kern\leftskip #1\kern\rightskip}%
}

% @sp n   outputs n lines of vertical space
%
\parseargdef\sp{\vskip #1\baselineskip}

% @comment ...line which is ignored...
% @c is the same as @comment
% @ignore ... @end ignore  is another way to write a comment


\def\c{\begingroup \catcode`\^^M=\active%
\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
\cxxx}
{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
%
\let\comment\c

% @paragraphindent NCHARS
% We'll use ems for NCHARS, close enough.
% NCHARS can also be the word `asis' or `none'.
% We cannot feasibly implement @paragraphindent asis, though.
%
\def\asisword{asis} % no translation, these are keywords
\def\noneword{none}
%
\parseargdef\paragraphindent{%
  \def\temp{#1}%
  \ifx\temp\asisword
  \else
    \ifx\temp\noneword
      \defaultparindent = 0pt
    \else
      \defaultparindent = #1em
    \fi
  \fi
  \parindent = \defaultparindent
}

% @exampleindent NCHARS
% We'll use ems for NCHARS like @paragraphindent.
% It seems @exampleindent asis isn't necessary, but
% I preserve it to make it similar to @paragraphindent.
\parseargdef\exampleindent{%
  \def\temp{#1}%
  \ifx\temp\asisword
  \else
    \ifx\temp\noneword
      \lispnarrowing = 0pt
    \else
      \lispnarrowing = #1em
    \fi
  \fi
}

% @firstparagraphindent WORD
% If WORD is `none', then suppress indentation of the first paragraph
% after a section heading.  If WORD is `insert', then do indent at such
% paragraphs.
%
% The paragraph indentation is suppressed or not by calling
% \suppressfirstparagraphindent, which the sectioning commands do.
% We switch the definition of this back and forth according to WORD.
% By default, we suppress indentation.
%
\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
\def\insertword{insert}
%
\parseargdef\firstparagraphindent{%
  \def\temp{#1}%
  \ifx\temp\noneword
    \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
  \else\ifx\temp\insertword
    \let\suppressfirstparagraphindent = \relax
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @firstparagraphindent option `\temp'}%
  \fi\fi
}

% Here is how we actually suppress indentation.  Redefine \everypar to
% \kern backwards by \parindent, and then reset itself to empty.
%
% We also make \indent itself not actually do anything until the next
% paragraph.
%
\gdef\dosuppressfirstparagraphindent{%
  \gdef\indent  {\restorefirstparagraphindent \indent}%
  \gdef\noindent{\restorefirstparagraphindent \noindent}%
  \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
}
%
\gdef\restorefirstparagraphindent{%
  \global\let\indent = \ptexindent
  \global\let\noindent = \ptexnoindent
  \global\everypar = {}%
}


% @refill is a no-op.
\let\refill=\relax

% @setfilename INFO-FILENAME - ignored
\let\setfilename=\comment

% @bye.
\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}


\message{pdf,}
% adobe `portable' document format
\newcount\tempnum
\newcount\lnkcount
\newtoks\filename
\newcount\filenamelength
\newcount\pgn
\newtoks\toksA
\newtoks\toksB
\newtoks\toksC
\newtoks\toksD
\newbox\boxA
\newbox\boxB
\newcount\countA
\newif\ifpdf
\newif\ifpdfmakepagedest

%
% For LuaTeX
%

\newif\iftxiuseunicodedestname
\txiuseunicodedestnamefalse % For pdfTeX etc.

\ifx\luatexversion\thisisundefined
\else
  % Use Unicode destination names
  \txiuseunicodedestnametrue
  % Escape PDF strings with converting UTF-16 from UTF-8
  \begingroup
    \catcode`\%=12
    \directlua{
      function UTF16oct(str)
        tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
        for c in string.utfvalues(str) do
          if c < 0x10000 then
            tex.sprint(
              string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
                            string.char(0x5c) .. string.char(0x25) .. '03o',
                            (c / 256), (c % 256)))
          else
            c = c - 0x10000
            local c_hi = c / 1024 + 0xd800
            local c_lo = c % 1024 + 0xdc00
            tex.sprint(
              string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
                            string.char(0x5c) .. string.char(0x25) .. '03o' ..
                            string.char(0x5c) .. string.char(0x25) .. '03o' ..
                            string.char(0x5c) .. string.char(0x25) .. '03o',
                            (c_hi / 256), (c_hi % 256),
                            (c_lo / 256), (c_lo % 256)))
          end
        end
      end
    }
  \endgroup
  \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
  % Escape PDF strings without converting
  \begingroup
    \directlua{
      function PDFescstr(str)
        for c in string.bytes(str) do
          if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
            tex.sprint(
              string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
                            c))
          else
            tex.sprint(string.char(c))
          end
        end
      end
    }
  \endgroup
  \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
  \ifnum\luatexversion>84
    % For LuaTeX >= 0.85
    \def\pdfdest{\pdfextension dest}
    \let\pdfoutput\outputmode
    \def\pdfliteral{\pdfextension literal}
    \def\pdfcatalog{\pdfextension catalog}
    \def\pdftexversion{\numexpr\pdffeedback version\relax}
    \let\pdfximage\saveimageresource
    \let\pdfrefximage\useimageresource
    \let\pdflastximage\lastsavedimageresourceindex
    \def\pdfendlink{\pdfextension endlink\relax}
    \def\pdfoutline{\pdfextension outline}
    \def\pdfstartlink{\pdfextension startlink}
    \def\pdffontattr{\pdfextension fontattr}
    \def\pdfobj{\pdfextension obj}
    \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
    \let\pdfpagewidth\pagewidth
    \let\pdfpageheight\pageheight
    \edef\pdfhorigin{\pdfvariable horigin}
    \edef\pdfvorigin{\pdfvariable vorigin}
  \fi
\fi

% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
% can be set).  So we test for \relax and 0 as well as being undefined.
\ifx\pdfoutput\thisisundefined
\else
  \ifx\pdfoutput\relax
  \else
    \ifcase\pdfoutput
    \else
      \pdftrue
    \fi
  \fi
\fi

% PDF uses PostScript string constants for the names of xref targets,
% for display in the outlines, and in other places.  Thus, we have to
% double any backslashes.  Otherwise, a name like "\node" will be
% interpreted as a newline (\n), followed by o, d, e.  Not good.
% 
% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
% related messages.  The final outcome is that it is up to the TeX user
% to double the backslashes and otherwise make the string valid, so
% that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
% do this reliably, so we use it.

% #1 is a control sequence in which to do the replacements,
% which we \xdef.
\def\txiescapepdf#1{%
  \ifx\pdfescapestring\thisisundefined
    % No primitive available; should we give a warning or log?
    % Many times it won't matter.
    \xdef#1{#1}%
  \else
    % The expandable \pdfescapestring primitive escapes parentheses,
    % backslashes, and other special chars.
    \xdef#1{\pdfescapestring{#1}}%
  \fi
}
\def\txiescapepdfutfsixteen#1{%
  \ifx\pdfescapestrutfsixteen\thisisundefined
    % No UTF-16 converting macro available.
    \txiescapepdf{#1}%
  \else
    \xdef#1{\pdfescapestrutfsixteen{#1}}%
  \fi
}

\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
with PDF output, and none of those formats could be found.  (.eps cannot
be supported due to the design of the PDF format; use regular TeX (DVI
output) for that.)}

\ifpdf
  %
  % Color manipulation macros using ideas from pdfcolor.tex,
  % except using rgb instead of cmyk; the latter is said to render as a
  % very dark gray on-screen and a very dark halftone in print, instead
  % of actual black. The dark red here is dark enough to print on paper as
  % nearly black, but still distinguishable for online viewing.  We use
  % black by default, though.
  \def\rgbDarkRed{0.50 0.09 0.12}
  \def\rgbBlack{0 0 0}
  %
  % rg sets the color for filling (usual text, etc.);
  % RG sets the color for stroking (thin rules, e.g., normal _'s).
  \def\pdfsetcolor#1{\pdfliteral{#1 rg  #1 RG}}
  %
  % Set color, and create a mark which defines \thiscolor accordingly,
  % so that \makeheadline knows which color to restore.
  \def\setcolor#1{%
    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
    \domark
    \pdfsetcolor{#1}%
  }
  %
  \def\maincolor{\rgbBlack}
  \pdfsetcolor{\maincolor}
  \edef\thiscolor{\maincolor}
  \def\lastcolordefs{}
  %
  \def\makefootline{%
    \baselineskip24pt
    \line{\pdfsetcolor{\maincolor}\the\footline}%
  }
  %
  \def\makeheadline{%
    \vbox to 0pt{%
      \vskip-22.5pt
      \line{%
        \vbox to8.5pt{}%
        % Extract \thiscolor definition from the marks.
        \getcolormarks
        % Typeset the headline with \maincolor, then restore the color.
        \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
      }%
      \vss
    }%
    \nointerlineskip
  }
  %
  %
  \pdfcatalog{/PageMode /UseOutlines}
  %
  % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
  \def\dopdfimage#1#2#3{%
    \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
    \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
    %
    % pdftex (and the PDF format) support .pdf, .png, .jpg (among
    % others).  Let's try in that order, PDF first since if
    % someone has a scalable image, presumably better to use that than a
    % bitmap.
    \let\pdfimgext=\empty
    \begingroup
      \openin 1 #1.pdf \ifeof 1
        \openin 1 #1.PDF \ifeof 1
          \openin 1 #1.png \ifeof 1
            \openin 1 #1.jpg \ifeof 1
              \openin 1 #1.jpeg \ifeof 1
                \openin 1 #1.JPG \ifeof 1
                  \errhelp = \nopdfimagehelp
                  \errmessage{Could not find image file #1 for pdf}%
                \else \gdef\pdfimgext{JPG}%
                \fi
              \else \gdef\pdfimgext{jpeg}%
              \fi
            \else \gdef\pdfimgext{jpg}%
            \fi
          \else \gdef\pdfimgext{png}%
          \fi
        \else \gdef\pdfimgext{PDF}%
        \fi
      \else \gdef\pdfimgext{pdf}%
      \fi
      \closein 1
    \endgroup
    %
    % without \immediate, ancient pdftex seg faults when the same image is
    % included twice.  (Version 3.14159-pre-1.0-unofficial-20010704.)
    \ifnum\pdftexversion < 14
      \immediate\pdfimage
    \else
      \immediate\pdfximage
    \fi
      \ifdim \wd0 >0pt width \pdfimagewidth \fi
      \ifdim \wd2 >0pt height \pdfimageheight \fi
      \ifnum\pdftexversion<13
         #1.\pdfimgext
       \else
         {#1.\pdfimgext}%
       \fi
    \ifnum\pdftexversion < 14 \else
      \pdfrefximage \pdflastximage
    \fi}
  %
  \def\setpdfdestname#1{{%
    % We have to set dummies so commands such as @code, and characters
    % such as \, aren't expanded when present in a section title.
    \indexnofonts
    \makevalueexpandable
    \turnoffactive
    \iftxiuseunicodedestname
      \ifx \declaredencoding \latone
        % Pass through Latin-1 characters.
        % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
      \else
        \ifx \declaredencoding \utfeight
          % Pass through Unicode characters.
        \else
          % Use ASCII approximations in destination names.
          \passthroughcharsfalse
        \fi
      \fi
    \else
      % Use ASCII approximations in destination names.
      \passthroughcharsfalse
    \fi
    \def\pdfdestname{#1}%
    \txiescapepdf\pdfdestname
  }}
  %
  \def\setpdfoutlinetext#1{{%
    \indexnofonts
    \makevalueexpandable
    \turnoffactive
    \ifx \declaredencoding \latone
      % The PDF format can use an extended form of Latin-1 in bookmark
      % strings.  See Appendix D of the PDF Reference, Sixth Edition, for
      % the "PDFDocEncoding".
      \passthroughcharstrue
      % Pass through Latin-1 characters.
      %   LuaTeX: Convert to Unicode
      %   pdfTeX: Use Latin-1 as PDFDocEncoding
      \def\pdfoutlinetext{#1}%
    \else
      \ifx \declaredencoding \utfeight
        \ifx\luatexversion\thisisundefined
          % For pdfTeX  with UTF-8.
          % TODO: the PDF format can use UTF-16 in bookmark strings,
          % but the code for this isn't done yet.
          % Use ASCII approximations.
          \passthroughcharsfalse
          \def\pdfoutlinetext{#1}%
        \else
          % For LuaTeX with UTF-8.
          % Pass through Unicode characters for title texts.
          \passthroughcharstrue
          \def\pdfoutlinetext{#1}%
        \fi
      \else
        % For non-Latin-1 or non-UTF-8 encodings.
        % Use ASCII approximations.
        \passthroughcharsfalse
        \def\pdfoutlinetext{#1}%
      \fi
    \fi
    % LuaTeX: Convert to UTF-16
    % pdfTeX: Use Latin-1 as PDFDocEncoding
    \txiescapepdfutfsixteen\pdfoutlinetext
  }}
  %
  \def\pdfmkdest#1{%
    \setpdfdestname{#1}%
    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
  }
  %
  % used to mark target names; must be expandable.
  \def\pdfmkpgn#1{#1}
  %
  % by default, use black for everything.
  \def\urlcolor{\rgbBlack}
  \def\linkcolor{\rgbBlack}
  \def\endlink{\setcolor{\maincolor}\pdfendlink}
  %
  % Adding outlines to PDF; macros for calculating structure of outlines
  % come from Petr Olsak
  \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
    \else \csname#1\endcsname \fi}
  \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
    \advance\tempnum by 1
    \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  %
  % #1 is the section text, which is what will be displayed in the
  % outline by the pdf viewer.  #2 is the pdf expression for the number
  % of subentries (or empty, for subsubsections).  #3 is the node text,
  % which might be empty if this toc entry had no corresponding node.
  % #4 is the page number
  %
  \def\dopdfoutline#1#2#3#4{%
    % Generate a link to the node text if that exists; else, use the
    % page number.  We could generate a destination for the section
    % text in the case where a section has no node, but it doesn't
    % seem worth the trouble, since most documents are normally structured.
    \setpdfoutlinetext{#1}
    \setpdfdestname{#3}
    \ifx\pdfdestname\empty
      \def\pdfdestname{#4}%
    \fi
    %
    \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
  }
  %
  \def\pdfmakeoutlines{%
    \begingroup
      % Read toc silently, to get counts of subentries for \pdfoutline.
      \def\partentry##1##2##3##4{}% ignore parts in the outlines
      \def\numchapentry##1##2##3##4{%
	\def\thischapnum{##2}%
	\def\thissecnum{0}%
	\def\thissubsecnum{0}%
      }%
      \def\numsecentry##1##2##3##4{%
	\advancenumber{chap\thischapnum}%
	\def\thissecnum{##2}%
	\def\thissubsecnum{0}%
      }%
      \def\numsubsecentry##1##2##3##4{%
	\advancenumber{sec\thissecnum}%
	\def\thissubsecnum{##2}%
      }%
      \def\numsubsubsecentry##1##2##3##4{%
	\advancenumber{subsec\thissubsecnum}%
      }%
      \def\thischapnum{0}%
      \def\thissecnum{0}%
      \def\thissubsecnum{0}%
      %
      % use \def rather than \let here because we redefine \chapentry et
      % al. a second time, below.
      \def\appentry{\numchapentry}%
      \def\appsecentry{\numsecentry}%
      \def\appsubsecentry{\numsubsecentry}%
      \def\appsubsubsecentry{\numsubsubsecentry}%
      \def\unnchapentry{\numchapentry}%
      \def\unnsecentry{\numsecentry}%
      \def\unnsubsecentry{\numsubsecentry}%
      \def\unnsubsubsecentry{\numsubsubsecentry}%
      \readdatafile{toc}%
      %
      % Read toc second time, this time actually producing the outlines.
      % The `-' means take the \expnumber as the absolute number of
      % subentries, which we calculated on our first read of the .toc above.
      %
      % We use the node names as the destinations.
      \def\numchapentry##1##2##3##4{%
        \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
      \def\numsecentry##1##2##3##4{%
        \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
      \def\numsubsecentry##1##2##3##4{%
        \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
      \def\numsubsubsecentry##1##2##3##4{% count is always zero
        \dopdfoutline{##1}{}{##3}{##4}}%
      %
      % PDF outlines are displayed using system fonts, instead of
      % document fonts.  Therefore we cannot use special characters,
      % since the encoding is unknown.  For example, the eogonek from
      % Latin 2 (0xea) gets translated to a | character.  Info from
      % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
      %
      % TODO this right, we have to translate 8-bit characters to
      % their "best" equivalent, based on the @documentencoding.  Too
      % much work for too little return.  Just use the ASCII equivalents
      % we use for the index sort strings.
      % 
      \indexnofonts
      \setupdatafile
      % We can have normal brace characters in the PDF outlines, unlike
      % Texinfo index files.  So set that up.
      \def\{{\lbracecharliteral}%
      \def\}{\rbracecharliteral}%
      \catcode`\\=\active \otherbackslash
      \input \tocreadfilename
    \endgroup
  }
  {\catcode`[=1 \catcode`]=2
   \catcode`{=\other \catcode`}=\other
   \gdef\lbracecharliteral[{]%
   \gdef\rbracecharliteral[}]%
  ]
  %
  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
    \ifx\PP\D\let\nextsp\relax
    \else\let\nextsp\skipspaces
      \addtokens{\filename}{\PP}%
      \advance\filenamelength by 1
    \fi
    \nextsp}
  \def\getfilename#1{%
    \filenamelength=0
    % If we don't expand the argument now, \skipspaces will get
    % snagged on things like "@value{foo}".
    \edef\temp{#1}%
    \expandafter\skipspaces\temp|\relax
  }
  \ifnum\pdftexversion < 14
    \let \startlink \pdfannotlink
  \else
    \let \startlink \pdfstartlink
  \fi
  % make a live url in pdf output.
  \def\pdfurl#1{%
    \begingroup
      % it seems we really need yet another set of dummies; have not
      % tried to figure out what each command should do in the context
      % of @url.  for now, just make @/ a no-op, that's the only one
      % people have actually reported a problem with.
      %
      \normalturnoffactive
      \def\@{@}%
      \let\/=\empty
      \makevalueexpandable
      % do we want to go so far as to use \indexnofonts instead of just
      % special-casing \var here?
      \def\var##1{##1}%
      %
      \leavevmode\setcolor{\urlcolor}%
      \startlink attr{/Border [0 0 0]}%
        user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
    \endgroup}
  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  \def\maketoks{%
    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
    \ifx\first0\adn0
    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
    \else
      \ifnum0=\countA\else\makelink\fi
      \ifx\first.\let\next=\done\else
        \let\next=\maketoks
        \addtokens{\toksB}{\the\toksD}
        \ifx\first,\addtokens{\toksB}{\space}\fi
      \fi
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \next}
  \def\makelink{\addtokens{\toksB}%
    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  \def\pdflink#1{%
    \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
    \setcolor{\linkcolor}#1\endlink}
  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
\else
  % non-pdf mode
  \let\pdfmkdest = \gobble
  \let\pdfurl = \gobble
  \let\endlink = \relax
  \let\setcolor = \gobble
  \let\pdfsetcolor = \gobble
  \let\pdfmakeoutlines = \relax
\fi  % \ifx\pdfoutput

%
% For XeTeX
%
\ifx\XeTeXrevision\thisisundefined
\else
  %
  % XeTeX version check
  %
  \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
    % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
    % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
    % For avoiding PDF destination name replacement, we use this special
    % instead of xdvipdfmx's command line option `-C 0x0010'.
    \special{dvipdfmx:config C 0x0010}
    % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
    % It can handle Unicode destination names for PDF.
    \txiuseunicodedestnametrue
  \else
    % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
    % `dvipdfmx:config' special.
    % So for avoiding PDF destination name replacement,
    % xdvipdfmx's command line option `-C 0x0010' is necessary.
    %
    % XeTeX < 0.99995 can not handle Unicode destination names for PDF
    % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
    % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
    \txiuseunicodedestnamefalse
  \fi
  %
  % Color support
  %
  \def\rgbDarkRed{0.50 0.09 0.12}
  \def\rgbBlack{0 0 0}
  %
  \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
  %
  % Set color, and create a mark which defines \thiscolor accordingly,
  % so that \makeheadline knows which color to restore.
  \def\setcolor#1{%
    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
    \domark
    \pdfsetcolor{#1}%
  }
  %
  \def\maincolor{\rgbBlack}
  \pdfsetcolor{\maincolor}
  \edef\thiscolor{\maincolor}
  \def\lastcolordefs{}
  %
  \def\makefootline{%
    \baselineskip24pt
    \line{\pdfsetcolor{\maincolor}\the\footline}%
  }
  %
  \def\makeheadline{%
    \vbox to 0pt{%
      \vskip-22.5pt
      \line{%
        \vbox to8.5pt{}%
        % Extract \thiscolor definition from the marks.
        \getcolormarks
        % Typeset the headline with \maincolor, then restore the color.
        \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
      }%
      \vss
    }%
    \nointerlineskip
  }
  %
  % PDF outline support
  %
  % Emulate pdfTeX primitive
  \def\pdfdest name#1 xyz{%
    \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
  }
  %
  \def\setpdfdestname#1{{%
    % We have to set dummies so commands such as @code, and characters
    % such as \, aren't expanded when present in a section title.
    \indexnofonts
    \makevalueexpandable
    \turnoffactive
    \iftxiuseunicodedestname
      % Pass through Unicode characters.
    \else
      % Use ASCII approximations in destination names.
      \passthroughcharsfalse
    \fi
    \def\pdfdestname{#1}%
    \txiescapepdf\pdfdestname
  }}
  %
  \def\setpdfoutlinetext#1{{%
    \turnoffactive
    % Always use Unicode characters in title texts.
    \def\pdfoutlinetext{#1}%
    % For XeTeX, xdvipdfmx converts to UTF-16.
    % So we do not convert.
    \txiescapepdf\pdfoutlinetext
  }}
  %
  \def\pdfmkdest#1{%
    \setpdfdestname{#1}%
    \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
  }
  %
  % by default, use black for everything.
  \def\urlcolor{\rgbBlack}
  \def\linkcolor{\rgbBlack}
  \def\endlink{\setcolor{\maincolor}\pdfendlink}
  %
  \def\dopdfoutline#1#2#3#4{%
    \setpdfoutlinetext{#1}
    \setpdfdestname{#3}
    \ifx\pdfdestname\empty
      \def\pdfdestname{#4}%
    \fi
    %
    \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
      << /S /GoTo /D (\pdfdestname) >> >> }%
  }
  %
  \def\pdfmakeoutlines{%
    \begingroup
      %
      % For XeTeX, counts of subentries are not necessary.
      % Therefore, we read toc only once.
      %
      % We use node names as destinations.
      \def\partentry##1##2##3##4{}% ignore parts in the outlines
      \def\numchapentry##1##2##3##4{%
        \dopdfoutline{##1}{1}{##3}{##4}}%
      \def\numsecentry##1##2##3##4{%
        \dopdfoutline{##1}{2}{##3}{##4}}%
      \def\numsubsecentry##1##2##3##4{%
        \dopdfoutline{##1}{3}{##3}{##4}}%
      \def\numsubsubsecentry##1##2##3##4{%
        \dopdfoutline{##1}{4}{##3}{##4}}%
      %
      \let\appentry\numchapentry%
      \let\appsecentry\numsecentry%
      \let\appsubsecentry\numsubsecentry%
      \let\appsubsubsecentry\numsubsubsecentry%
      \let\unnchapentry\numchapentry%
      \let\unnsecentry\numsecentry%
      \let\unnsubsecentry\numsubsecentry%
      \let\unnsubsubsecentry\numsubsubsecentry%
      %
      % For XeTeX, xdvipdfmx converts strings to UTF-16.
      % Therefore, the encoding and the language may not be considered.
      %
      \indexnofonts
      \setupdatafile
      % We can have normal brace characters in the PDF outlines, unlike
      % Texinfo index files.  So set that up.
      \def\{{\lbracecharliteral}%
      \def\}{\rbracecharliteral}%
      \catcode`\\=\active \otherbackslash
      \input \tocreadfilename
    \endgroup
  }
  {\catcode`[=1 \catcode`]=2
   \catcode`{=\other \catcode`}=\other
   \gdef\lbracecharliteral[{]%
   \gdef\rbracecharliteral[}]%
  ]

  \special{pdf:docview << /PageMode /UseOutlines >> }
  % ``\special{pdf:tounicode ...}'' is not necessary
  % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
  % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
  % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
  % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
%
  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
    \ifx\PP\D\let\nextsp\relax
    \else\let\nextsp\skipspaces
      \addtokens{\filename}{\PP}%
      \advance\filenamelength by 1
    \fi
    \nextsp}
  \def\getfilename#1{%
    \filenamelength=0
    % If we don't expand the argument now, \skipspaces will get
    % snagged on things like "@value{foo}".
    \edef\temp{#1}%
    \expandafter\skipspaces\temp|\relax
  }
  % make a live url in pdf output.
  \def\pdfurl#1{%
    \begingroup
      % it seems we really need yet another set of dummies; have not
      % tried to figure out what each command should do in the context
      % of @url.  for now, just make @/ a no-op, that's the only one
      % people have actually reported a problem with.
      %
      \normalturnoffactive
      \def\@{@}%
      \let\/=\empty
      \makevalueexpandable
      % do we want to go so far as to use \indexnofonts instead of just
      % special-casing \var here?
      \def\var##1{##1}%
      %
      \leavevmode\setcolor{\urlcolor}%
      \special{pdf:bann << /Border [0 0 0]
        /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
    \endgroup}
  \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
  \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  \def\maketoks{%
    \expandafter\poptoks\the\toksA|ENDTOKS|\relax
    \ifx\first0\adn0
    \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
    \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
    \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
    \else
      \ifnum0=\countA\else\makelink\fi
      \ifx\first.\let\next=\done\else
        \let\next=\maketoks
        \addtokens{\toksB}{\the\toksD}
        \ifx\first,\addtokens{\toksB}{\space}\fi
      \fi
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \next}
  \def\makelink{\addtokens{\toksB}%
    {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  \def\pdflink#1{%
    \special{pdf:bann << /Border [0 0 0]
      /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
    \setcolor{\linkcolor}#1\endlink}
  \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
%
  %
  % @image support
  %
  % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
  \def\doxeteximage#1#2#3{%
    \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
    \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
    %
    % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
    % others).  Let's try in that order, PDF first since if
    % someone has a scalable image, presumably better to use that than a
    % bitmap.
    \let\xeteximgext=\empty
    \begingroup
      \openin 1 #1.pdf \ifeof 1
        \openin 1 #1.PDF \ifeof 1
          \openin 1 #1.png \ifeof 1
            \openin 1 #1.jpg \ifeof 1
              \openin 1 #1.jpeg \ifeof 1
                \openin 1 #1.JPG \ifeof 1
                  \errmessage{Could not find image file #1 for XeTeX}%
                \else \gdef\xeteximgext{JPG}%
                \fi
              \else \gdef\xeteximgext{jpeg}%
              \fi
            \else \gdef\xeteximgext{jpg}%
            \fi
          \else \gdef\xeteximgext{png}%
          \fi
        \else \gdef\xeteximgext{PDF}%
        \fi
      \else \gdef\xeteximgext{pdf}%
      \fi
      \closein 1
    \endgroup
    %
    \def\xetexpdfext{pdf}%
    \ifx\xeteximgext\xetexpdfext
      \XeTeXpdffile "#1".\xeteximgext ""
    \else
      \def\xetexpdfext{PDF}%
      \ifx\xeteximgext\xetexpdfext
        \XeTeXpdffile "#1".\xeteximgext ""
      \else
        \XeTeXpicfile "#1".\xeteximgext ""
      \fi
    \fi
    \ifdim \wd0 >0pt width \xeteximagewidth \fi
    \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
  }
\fi


%
\message{fonts,}

% Set the baselineskip to #1, and the lineskip and strut size
% correspondingly.  There is no deep meaning behind these magic numbers
% used as factors; they just match (closely enough) what Knuth defined.
%
\def\lineskipfactor{.08333}
\def\strutheightpercent{.70833}
\def\strutdepthpercent {.29167}
%
% can get a sort of poor man's double spacing by redefining this.
\def\baselinefactor{1}
%
\newdimen\textleading
\def\setleading#1{%
  \dimen0 = #1\relax
  \normalbaselineskip = \baselinefactor\dimen0
  \normallineskip = \lineskipfactor\normalbaselineskip
  \normalbaselines
  \setbox\strutbox =\hbox{%
    \vrule width0pt height\strutheightpercent\baselineskip
                    depth \strutdepthpercent \baselineskip
  }%
}

% PDF CMaps.  See also LaTeX's t1.cmap.
%
% do nothing with this by default.
\expandafter\let\csname cmapOT1\endcsname\gobble
\expandafter\let\csname cmapOT1IT\endcsname\gobble
\expandafter\let\csname cmapOT1TT\endcsname\gobble

% if we are producing pdf, and we have \pdffontattr, then define cmaps.
% (\pdffontattr was introduced many years ago, but people still run
% older pdftex's; it's easy to conditionalize, so we do.)
\ifpdf \ifx\pdffontattr\thisisundefined \else
  \begingroup
    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
%%DocumentNeededResources: ProcSet (CIDInit)
%%IncludeResource: ProcSet (CIDInit)
%%BeginResource: CMap (TeX-OT1-0)
%%Title: (TeX-OT1-0 TeX OT1 0)
%%Version: 1.000
%%EndComments
/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo
<< /Registry (TeX)
/Ordering (OT1)
/Supplement 0
>> def
/CMapName /TeX-OT1-0 def
/CMapType 2 def
1 begincodespacerange
<00> <7F>
endcodespacerange
8 beginbfrange
<00> <01> <0393>
<09> <0A> <03A8>
<23> <26> <0023>
<28> <3B> <0028>
<3F> <5B> <003F>
<5D> <5E> <005D>
<61> <7A> <0061>
<7B> <7C> <2013>
endbfrange
40 beginbfchar
<02> <0398>
<03> <039B>
<04> <039E>
<05> <03A0>
<06> <03A3>
<07> <03D2>
<08> <03A6>
<0B> <00660066>
<0C> <00660069>
<0D> <0066006C>
<0E> <006600660069>
<0F> <00660066006C>
<10> <0131>
<11> <0237>
<12> <0060>
<13> <00B4>
<14> <02C7>
<15> <02D8>
<16> <00AF>
<17> <02DA>
<18> <00B8>
<19> <00DF>
<1A> <00E6>
<1B> <0153>
<1C> <00F8>
<1D> <00C6>
<1E> <0152>
<1F> <00D8>
<21> <0021>
<22> <201D>
<27> <2019>
<3C> <00A1>
<3D> <003D>
<3E> <00BF>
<5C> <201C>
<5F> <02D9>
<60> <2018>
<7D> <02DD>
<7E> <007E>
<7F> <00A8>
endbfchar
endcmap
CMapName currentdict /CMap defineresource pop
end
end
%%EndResource
%%EOF
    }\endgroup
  \expandafter\edef\csname cmapOT1\endcsname#1{%
    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  }%
%
% \cmapOT1IT
  \begingroup
    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
%%DocumentNeededResources: ProcSet (CIDInit)
%%IncludeResource: ProcSet (CIDInit)
%%BeginResource: CMap (TeX-OT1IT-0)
%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
%%Version: 1.000
%%EndComments
/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo
<< /Registry (TeX)
/Ordering (OT1IT)
/Supplement 0
>> def
/CMapName /TeX-OT1IT-0 def
/CMapType 2 def
1 begincodespacerange
<00> <7F>
endcodespacerange
8 beginbfrange
<00> <01> <0393>
<09> <0A> <03A8>
<25> <26> <0025>
<28> <3B> <0028>
<3F> <5B> <003F>
<5D> <5E> <005D>
<61> <7A> <0061>
<7B> <7C> <2013>
endbfrange
42 beginbfchar
<02> <0398>
<03> <039B>
<04> <039E>
<05> <03A0>
<06> <03A3>
<07> <03D2>
<08> <03A6>
<0B> <00660066>
<0C> <00660069>
<0D> <0066006C>
<0E> <006600660069>
<0F> <00660066006C>
<10> <0131>
<11> <0237>
<12> <0060>
<13> <00B4>
<14> <02C7>
<15> <02D8>
<16> <00AF>
<17> <02DA>
<18> <00B8>
<19> <00DF>
<1A> <00E6>
<1B> <0153>
<1C> <00F8>
<1D> <00C6>
<1E> <0152>
<1F> <00D8>
<21> <0021>
<22> <201D>
<23> <0023>
<24> <00A3>
<27> <2019>
<3C> <00A1>
<3D> <003D>
<3E> <00BF>
<5C> <201C>
<5F> <02D9>
<60> <2018>
<7D> <02DD>
<7E> <007E>
<7F> <00A8>
endbfchar
endcmap
CMapName currentdict /CMap defineresource pop
end
end
%%EndResource
%%EOF
    }\endgroup
  \expandafter\edef\csname cmapOT1IT\endcsname#1{%
    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  }%
%
% \cmapOT1TT
  \begingroup
    \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
    \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
%%DocumentNeededResources: ProcSet (CIDInit)
%%IncludeResource: ProcSet (CIDInit)
%%BeginResource: CMap (TeX-OT1TT-0)
%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
%%Version: 1.000
%%EndComments
/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo
<< /Registry (TeX)
/Ordering (OT1TT)
/Supplement 0
>> def
/CMapName /TeX-OT1TT-0 def
/CMapType 2 def
1 begincodespacerange
<00> <7F>
endcodespacerange
5 beginbfrange
<00> <01> <0393>
<09> <0A> <03A8>
<21> <26> <0021>
<28> <5F> <0028>
<61> <7E> <0061>
endbfrange
32 beginbfchar
<02> <0398>
<03> <039B>
<04> <039E>
<05> <03A0>
<06> <03A3>
<07> <03D2>
<08> <03A6>
<0B> <2191>
<0C> <2193>
<0D> <0027>
<0E> <00A1>
<0F> <00BF>
<10> <0131>
<11> <0237>
<12> <0060>
<13> <00B4>
<14> <02C7>
<15> <02D8>
<16> <00AF>
<17> <02DA>
<18> <00B8>
<19> <00DF>
<1A> <00E6>
<1B> <0153>
<1C> <00F8>
<1D> <00C6>
<1E> <0152>
<1F> <00D8>
<20> <2423>
<27> <2019>
<60> <2018>
<7F> <00A8>
endbfchar
endcmap
CMapName currentdict /CMap defineresource pop
end
end
%%EndResource
%%EOF
    }\endgroup
  \expandafter\edef\csname cmapOT1TT\endcsname#1{%
    \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  }%
\fi\fi


% Set the font macro #1 to the font named \fontprefix#2.
% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
% Example:
% #1 = \textrm
% #2 = \rmshape
% #3 = 10
% #4 = \mainmagstep
% #5 = OT1
%
\def\setfont#1#2#3#4#5{%
  \font#1=\fontprefix#2#3 scaled #4
  \csname cmap#5\endcsname#1%
}
% This is what gets called when #5 of \setfont is empty.
\let\cmap\gobble
%
% (end of cmaps)

% Use cm as the default font prefix.
% To specify the font prefix, you must define \fontprefix
% before you read in texinfo.tex.
\ifx\fontprefix\thisisundefined
\def\fontprefix{cm}
\fi
% Support font families that don't use the same naming scheme as CM.
\def\rmshape{r}
\def\rmbshape{bx}               % where the normal face is bold
\def\bfshape{b}
\def\bxshape{bx}
\def\ttshape{tt}
\def\ttbshape{tt}
\def\ttslshape{sltt}
\def\itshape{ti}
\def\itbshape{bxti}
\def\slshape{sl}
\def\slbshape{bxsl}
\def\sfshape{ss}
\def\sfbshape{ss}
\def\scshape{csc}
\def\scbshape{csc}

% Definitions for a main text size of 11pt.  (The default in Texinfo.)
%
\def\definetextfontsizexi{%
% Text fonts (11.2pt, magstep1).
\def\textnominalsize{11pt}
\edef\mainmagstep{\magstephalf}
\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
\font\texti=cmmi10 scaled \mainmagstep
\font\textsy=cmsy10 scaled \mainmagstep
\def\textecsize{1095}

% A few fonts for @defun names and args.
\setfont\defbf\bfshape{10}{\magstep1}{OT1}
\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
\setfont\defsl\slshape{10}{\magstep1}{OT1TT}
\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
\def\df{\let\ttfont=\deftt \let\bffont = \defbf
\let\ttslfont=\defttsl \let\slfont=\defsl \bf}

% Fonts for indices, footnotes, small examples (9pt).
\def\smallnominalsize{9pt}
\setfont\smallrm\rmshape{9}{1000}{OT1}
\setfont\smalltt\ttshape{9}{1000}{OT1TT}
\setfont\smallbf\bfshape{10}{900}{OT1}
\setfont\smallit\itshape{9}{1000}{OT1IT}
\setfont\smallsl\slshape{9}{1000}{OT1}
\setfont\smallsf\sfshape{9}{1000}{OT1}
\setfont\smallsc\scshape{10}{900}{OT1}
\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
\font\smalli=cmmi9
\font\smallsy=cmsy9
\def\smallecsize{0900}

% Fonts for small examples (8pt).
\def\smallernominalsize{8pt}
\setfont\smallerrm\rmshape{8}{1000}{OT1}
\setfont\smallertt\ttshape{8}{1000}{OT1TT}
\setfont\smallerbf\bfshape{10}{800}{OT1}
\setfont\smallerit\itshape{8}{1000}{OT1IT}
\setfont\smallersl\slshape{8}{1000}{OT1}
\setfont\smallersf\sfshape{8}{1000}{OT1}
\setfont\smallersc\scshape{10}{800}{OT1}
\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
\font\smalleri=cmmi8
\font\smallersy=cmsy8
\def\smallerecsize{0800}

% Fonts for math mode superscripts (7pt).
\def\sevennominalsize{7pt}
\setfont\sevenrm\rmshape{7}{1000}{OT1}
\setfont\seventt\ttshape{10}{700}{OT1TT}
\setfont\sevenbf\bfshape{10}{700}{OT1}
\setfont\sevenit\itshape{7}{1000}{OT1IT}
\setfont\sevensl\slshape{10}{700}{OT1}
\setfont\sevensf\sfshape{10}{700}{OT1}
\setfont\sevensc\scshape{10}{700}{OT1}
\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
\font\seveni=cmmi7
\font\sevensy=cmsy7
\def\sevenecsize{0700}

% Fonts for title page (20.4pt):
\def\titlenominalsize{20pt}
\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
\let\titlebf=\titlerm
\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
\font\titlei=cmmi12 scaled \magstep3
\font\titlesy=cmsy10 scaled \magstep4
\def\titleecsize{2074}

% Chapter (and unnumbered) fonts (17.28pt).
\def\chapnominalsize{17pt}
\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
\setfont\chapsf\sfbshape{17}{1000}{OT1}
\let\chapbf=\chaprm
\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
\font\chapi=cmmi12 scaled \magstep2
\font\chapsy=cmsy10 scaled \magstep3
\def\chapecsize{1728}

% Section fonts (14.4pt).
\def\secnominalsize{14pt}
\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
\setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
\setfont\secsl\slbshape{10}{\magstep2}{OT1}
\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
\let\secbf\secrm
\setfont\secsc\scbshape{10}{\magstep2}{OT1}
\font\seci=cmmi12 scaled \magstep1
\font\secsy=cmsy10 scaled \magstep2
\def\sececsize{1440}

% Subsection fonts (13.15pt).
\def\ssecnominalsize{13pt}
\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
\setfont\ssecit\itbshape{10}{1315}{OT1IT}
\setfont\ssecsl\slbshape{10}{1315}{OT1}
\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
\let\ssecbf\ssecrm
\setfont\ssecsc\scbshape{10}{1315}{OT1}
\font\sseci=cmmi12 scaled \magstephalf
\font\ssecsy=cmsy10 scaled 1315
\def\ssececsize{1200}

% Reduced fonts for @acronym in text (10pt).
\def\reducednominalsize{10pt}
\setfont\reducedrm\rmshape{10}{1000}{OT1}
\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
\setfont\reducedbf\bfshape{10}{1000}{OT1}
\setfont\reducedit\itshape{10}{1000}{OT1IT}
\setfont\reducedsl\slshape{10}{1000}{OT1}
\setfont\reducedsf\sfshape{10}{1000}{OT1}
\setfont\reducedsc\scshape{10}{1000}{OT1}
\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
\font\reducedi=cmmi10
\font\reducedsy=cmsy10
\def\reducedecsize{1000}

\textleading = 13.2pt % line spacing for 11pt CM
\textfonts            % reset the current fonts
\rm
} % end of 11pt text font size definitions, \definetextfontsizexi


% Definitions to make the main text be 10pt Computer Modern, with
% section, chapter, etc., sizes following suit.  This is for the GNU
% Press printing of the Emacs 22 manual.  Maybe other manuals in the
% future.  Used with @smallbook, which sets the leading to 12pt.
%
\def\definetextfontsizex{%
% Text fonts (10pt).
\def\textnominalsize{10pt}
\edef\mainmagstep{1000}
\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
\font\texti=cmmi10 scaled \mainmagstep
\font\textsy=cmsy10 scaled \mainmagstep
\def\textecsize{1000}

% A few fonts for @defun names and args.
\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
\setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
\def\df{\let\ttfont=\deftt \let\bffont = \defbf
\let\slfont=\defsl \let\ttslfont=\defttsl \bf}

% Fonts for indices, footnotes, small examples (9pt).
\def\smallnominalsize{9pt}
\setfont\smallrm\rmshape{9}{1000}{OT1}
\setfont\smalltt\ttshape{9}{1000}{OT1TT}
\setfont\smallbf\bfshape{10}{900}{OT1}
\setfont\smallit\itshape{9}{1000}{OT1IT}
\setfont\smallsl\slshape{9}{1000}{OT1}
\setfont\smallsf\sfshape{9}{1000}{OT1}
\setfont\smallsc\scshape{10}{900}{OT1}
\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
\font\smalli=cmmi9
\font\smallsy=cmsy9
\def\smallecsize{0900}

% Fonts for small examples (8pt).
\def\smallernominalsize{8pt}
\setfont\smallerrm\rmshape{8}{1000}{OT1}
\setfont\smallertt\ttshape{8}{1000}{OT1TT}
\setfont\smallerbf\bfshape{10}{800}{OT1}
\setfont\smallerit\itshape{8}{1000}{OT1IT}
\setfont\smallersl\slshape{8}{1000}{OT1}
\setfont\smallersf\sfshape{8}{1000}{OT1}
\setfont\smallersc\scshape{10}{800}{OT1}
\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
\font\smalleri=cmmi8
\font\smallersy=cmsy8
\def\smallerecsize{0800}

% Fonts for math mode superscripts (7pt).
\def\sevennominalsize{7pt}
\setfont\sevenrm\rmshape{7}{1000}{OT1}
\setfont\seventt\ttshape{10}{700}{OT1TT}
\setfont\sevenbf\bfshape{10}{700}{OT1}
\setfont\sevenit\itshape{7}{1000}{OT1IT}
\setfont\sevensl\slshape{10}{700}{OT1}
\setfont\sevensf\sfshape{10}{700}{OT1}
\setfont\sevensc\scshape{10}{700}{OT1}
\setfont\seventtsl\ttslshape{10}{700}{OT1TT}
\font\seveni=cmmi7
\font\sevensy=cmsy7
\def\sevenecsize{0700}

% Fonts for title page (20.4pt):
\def\titlenominalsize{20pt}
\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
\let\titlebf=\titlerm
\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
\font\titlei=cmmi12 scaled \magstep3
\font\titlesy=cmsy10 scaled \magstep4
\def\titleecsize{2074}

% Chapter fonts (14.4pt).
\def\chapnominalsize{14pt}
\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
\let\chapbf\chaprm
\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
\font\chapi=cmmi12 scaled \magstep1
\font\chapsy=cmsy10 scaled \magstep2
\def\chapecsize{1440}

% Section fonts (12pt).
\def\secnominalsize{12pt}
\setfont\secrm\rmbshape{12}{1000}{OT1}
\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
\setfont\secsl\slbshape{10}{\magstep1}{OT1}
\setfont\sectt\ttbshape{12}{1000}{OT1TT}
\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
\setfont\secsf\sfbshape{12}{1000}{OT1}
\let\secbf\secrm
\setfont\secsc\scbshape{10}{\magstep1}{OT1}
\font\seci=cmmi12
\font\secsy=cmsy10 scaled \magstep1
\def\sececsize{1200}

% Subsection fonts (10pt).
\def\ssecnominalsize{10pt}
\setfont\ssecrm\rmbshape{10}{1000}{OT1}
\setfont\ssecit\itbshape{10}{1000}{OT1IT}
\setfont\ssecsl\slbshape{10}{1000}{OT1}
\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
\setfont\ssecsf\sfbshape{10}{1000}{OT1}
\let\ssecbf\ssecrm
\setfont\ssecsc\scbshape{10}{1000}{OT1}
\font\sseci=cmmi10
\font\ssecsy=cmsy10
\def\ssececsize{1000}

% Reduced fonts for @acronym in text (9pt).
\def\reducednominalsize{9pt}
\setfont\reducedrm\rmshape{9}{1000}{OT1}
\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
\setfont\reducedbf\bfshape{10}{900}{OT1}
\setfont\reducedit\itshape{9}{1000}{OT1IT}
\setfont\reducedsl\slshape{9}{1000}{OT1}
\setfont\reducedsf\sfshape{9}{1000}{OT1}
\setfont\reducedsc\scshape{10}{900}{OT1}
\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
\font\reducedi=cmmi9
\font\reducedsy=cmsy9
\def\reducedecsize{0900}

\divide\parskip by 2  % reduce space between paragraphs
\textleading = 12pt   % line spacing for 10pt CM
\textfonts            % reset the current fonts
\rm
} % end of 10pt text font size definitions, \definetextfontsizex

% Fonts for short table of contents.
\setfont\shortcontrm\rmshape{12}{1000}{OT1}
\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1}  % no cmb12
\setfont\shortcontsl\slshape{12}{1000}{OT1}
\setfont\shortconttt\ttshape{12}{1000}{OT1TT}


% We provide the user-level command
%   @fonttextsize 10
% (or 11) to redefine the text font size.  pt is assumed.
%
\def\xiword{11}
\def\xword{10}
\def\xwordpt{10pt}
%
\parseargdef\fonttextsize{%
  \def\textsizearg{#1}%
  %\wlog{doing @fonttextsize \textsizearg}%
  %
  % Set \globaldefs so that documents can use this inside @tex, since
  % makeinfo 4.8 does not support it, but we need it nonetheless.
  %
 \begingroup \globaldefs=1
  \ifx\textsizearg\xword \definetextfontsizex
  \else \ifx\textsizearg\xiword \definetextfontsizexi
  \else
    \errhelp=\EMsimple
    \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
  \fi\fi
 \endgroup
}

%
% Change the current font style to #1, remembering it in \curfontstyle.
% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
% italics, not bold italics.
%
\def\setfontstyle#1{%
  \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
  \csname #1font\endcsname  % change the current font
}

\def\rm{\fam=0 \setfontstyle{rm}}
\def\it{\fam=\itfam \setfontstyle{it}}
\def\sl{\fam=\slfam \setfontstyle{sl}}
\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
\def\tt{\fam=\ttfam \setfontstyle{tt}}

% Texinfo sort of supports the sans serif font style, which plain TeX does not.
% So we set up a \sf.
\newfam\sffam
\def\sf{\fam=\sffam \setfontstyle{sf}}

% We don't need math for this font style.
\def\ttsl{\setfontstyle{ttsl}}


% In order for the font changes to affect most math symbols and letters,
% we have to define the \textfont of the standard families.
% We don't bother to reset \scriptscriptfont; awaiting user need.
%
\def\resetmathfonts{%
  \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
  \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
  \textfont\ttfam=\ttfont \textfont\sffam=\sffont
  %
  % Fonts for superscript.  Note that the 7pt fonts are used regardless
  % of the current font size.
  \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
  \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
  \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
  \scriptfont\sffam=\sevensf
}

%

% The font-changing commands (all called \...fonts) redefine the meanings
% of \STYLEfont, instead of just \STYLE.  We do this because \STYLE needs
% to also set the current \fam for math mode.  Our \STYLE (e.g., \rm)
% commands hardwire \STYLEfont to set the current font.
%
% The fonts used for \ifont are for "math italics"  (\itfont is for italics
% in regular text).  \syfont is also used in math mode only.
%
% Each font-changing command also sets the names \lsize (one size lower)
% and \lllsize (three sizes lower).  These relative commands are used
% in, e.g., the LaTeX logo and acronyms.
%
% This all needs generalizing, badly.
%

\def\assignfonts#1{%
  \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
  \expandafter\let\expandafter\itfont\csname #1it\endcsname
  \expandafter\let\expandafter\slfont\csname #1sl\endcsname
  \expandafter\let\expandafter\bffont\csname #1bf\endcsname
  \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
  \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
  \expandafter\let\expandafter\sffont  \csname #1sf\endcsname
  \expandafter\let\expandafter\ifont   \csname #1i\endcsname
  \expandafter\let\expandafter\syfont  \csname #1sy\endcsname
  \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
}

\newif\ifrmisbold

% Select smaller font size with the current style.  Used to change font size
% in, e.g., the LaTeX logo and acronyms.  If we are using bold fonts for
% normal roman text, also use bold fonts for roman text in the smaller size.
\def\switchtolllsize{%
   \expandafter\assignfonts\expandafter{\lllsize}%
   \ifrmisbold
     \let\rmfont\bffont
   \fi
   \csname\curfontstyle\endcsname
}%

\def\switchtolsize{%
   \expandafter\assignfonts\expandafter{\lsize}%
   \ifrmisbold
     \let\rmfont\bffont
   \fi
   \csname\curfontstyle\endcsname
}%

\def\definefontsetatsize#1#2#3#4#5{%
\expandafter\def\csname #1fonts\endcsname{%
  \def\curfontsize{#1}%
  \def\lsize{#2}\def\lllsize{#3}%
  \csname rmisbold#5\endcsname
  \assignfonts{#1}%
  \resetmathfonts
  \setleading{#4}%
}}

\definefontsetatsize{text}   {reduced}{smaller}{\textleading}{false}
\definefontsetatsize{title}  {chap}   {subsec} {27pt}  {true}
\definefontsetatsize{chap}   {sec}    {text}   {19pt}  {true}
\definefontsetatsize{sec}    {subsec} {reduced}{17pt}  {true}
\definefontsetatsize{ssec}   {text}   {small}  {15pt}  {true}
\definefontsetatsize{reduced}{small}  {smaller}{10.5pt}{false}
\definefontsetatsize{small}  {smaller}{smaller}{10.5pt}{false}
\definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}

\def\titlefont#1{{\titlefonts\rm #1}}
\let\subsecfonts = \ssecfonts
\let\subsubsecfonts = \ssecfonts

% Define these just so they can be easily changed for other fonts.
\def\angleleft{$\langle$}
\def\angleright{$\rangle$}

% Set the fonts to use with the @small... environments.
\let\smallexamplefonts = \smallfonts

% About \smallexamplefonts.  If we use \smallfonts (9pt), @smallexample
% can fit this many characters:
%   8.5x11=86   smallbook=72  a4=90  a5=69
% If we use \scriptfonts (8pt), then we can fit this many characters:
%   8.5x11=90+  smallbook=80  a4=90+  a5=77
% For me, subjectively, the few extra characters that fit aren't worth
% the additional smallness of 8pt.  So I'm making the default 9pt.
%
% By the way, for comparison, here's what fits with @example (10pt):
%   8.5x11=71  smallbook=60  a4=75  a5=58
% --karl, 24jan03.

% Set up the default fonts, so we can use them for creating boxes.
%
\definetextfontsizexi


\message{markup,}

% Check if we are currently using a typewriter font.  Since all the
% Computer Modern typewriter fonts have zero interword stretch (and
% shrink), and it is reasonable to expect all typewriter fonts to have
% this property, we can check that font parameter.
%
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }

% Markup style infrastructure.  \defmarkupstylesetup\INITMACRO will
% define and register \INITMACRO to be called on markup style changes.
% \INITMACRO can check \currentmarkupstyle for the innermost
% style.

\let\currentmarkupstyle\empty

\def\setupmarkupstyle#1{%
  \def\currentmarkupstyle{#1}%
  \markupstylesetup
}

\let\markupstylesetup\empty

\def\defmarkupstylesetup#1{%
  \expandafter\def\expandafter\markupstylesetup
    \expandafter{\markupstylesetup #1}%
  \def#1%
}

% Markup style setup for left and right quotes.
\defmarkupstylesetup\markupsetuplq{%
  \expandafter\let\expandafter \temp
    \csname markupsetuplq\currentmarkupstyle\endcsname
  \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
}

\defmarkupstylesetup\markupsetuprq{%
  \expandafter\let\expandafter \temp
    \csname markupsetuprq\currentmarkupstyle\endcsname
  \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
}

{
\catcode`\'=\active
\catcode`\`=\active

\gdef\markupsetuplqdefault{\let`\lq}
\gdef\markupsetuprqdefault{\let'\rq}

\gdef\markupsetcodequoteleft{\let`\codequoteleft}
\gdef\markupsetcodequoteright{\let'\codequoteright}
}

\let\markupsetuplqcode \markupsetcodequoteleft
\let\markupsetuprqcode \markupsetcodequoteright
%
\let\markupsetuplqexample \markupsetcodequoteleft
\let\markupsetuprqexample \markupsetcodequoteright
%
\let\markupsetuplqkbd     \markupsetcodequoteleft
\let\markupsetuprqkbd     \markupsetcodequoteright
%
\let\markupsetuplqsamp \markupsetcodequoteleft
\let\markupsetuprqsamp \markupsetcodequoteright
%
\let\markupsetuplqverb \markupsetcodequoteleft
\let\markupsetuprqverb \markupsetcodequoteright
%
\let\markupsetuplqverbatim \markupsetcodequoteleft
\let\markupsetuprqverbatim \markupsetcodequoteright

% Allow an option to not use regular directed right quote/apostrophe
% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
% The undirected quote is ugly, so don't make it the default, but it
% works for pasting with more pdf viewers (at least evince), the
% lilypond developers report.  xpdf does work with the regular 0x27.
%
\def\codequoteright{%
  \ifmonospace
    \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
      \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
        '%
      \else \char'15 \fi
    \else \char'15 \fi
   \else
     '%
   \fi
}
%
% and a similar option for the left quote char vs. a grave accent.
% Modern fonts display ASCII 0x60 as a grave accent, so some people like
% the code environments to do likewise.
%
\def\codequoteleft{%
  \ifmonospace
    \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
      \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
        % [Knuth] pp. 380,381,391
        % \relax disables Spanish ligatures ?` and !` of \tt font.
        \relax`%
      \else \char'22 \fi
    \else \char'22 \fi
   \else
     \relax`%
   \fi
}

% Commands to set the quote options.
% 
\parseargdef\codequoteundirected{%
  \def\temp{#1}%
  \ifx\temp\onword
    \expandafter\let\csname SETtxicodequoteundirected\endcsname
      = t%
  \else\ifx\temp\offword
    \expandafter\let\csname SETtxicodequoteundirected\endcsname
      = \relax
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
  \fi\fi
}
%
\parseargdef\codequotebacktick{%
  \def\temp{#1}%
  \ifx\temp\onword
    \expandafter\let\csname SETtxicodequotebacktick\endcsname
      = t%
  \else\ifx\temp\offword
    \expandafter\let\csname SETtxicodequotebacktick\endcsname
      = \relax
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
  \fi\fi
}

% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
\def\noligaturesquoteleft{\relax\lq}

% Count depth in font-changes, for error checks
\newcount\fontdepth \fontdepth=0

% Font commands.

% #1 is the font command (\sl or \it), #2 is the text to slant.
% If we are in a monospaced environment, however, 1) always use \ttsl,
% and 2) do not add an italic correction.
\def\dosmartslant#1#2{%
  \ifusingtt 
    {{\ttsl #2}\let\next=\relax}%
    {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
  \next
}
\def\smartslanted{\dosmartslant\sl}
\def\smartitalic{\dosmartslant\it}

% Output an italic correction unless \next (presumed to be the following
% character) is such as not to need one.
\def\smartitaliccorrection{%
  \ifx\next,%
  \else\ifx\next-%
  \else\ifx\next.%
  \else\ifx\next\.%
  \else\ifx\next\comma%
  \else\ptexslash
  \fi\fi\fi\fi\fi
  \aftersmartic
}

% Unconditional use \ttsl, and no ic.  @var is set to this for defuns.
\def\ttslanted#1{{\ttsl #1}}

% @cite is like \smartslanted except unconditionally use \sl.  We never want
% ttsl for book titles, do we?
\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}

\def\aftersmartic{}
\def\var#1{%
  \let\saveaftersmartic = \aftersmartic
  \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
  \smartslanted{#1}%
}

\let\i=\smartitalic
\let\slanted=\smartslanted
\let\dfn=\smartslanted
\let\emph=\smartitalic

% Explicit font changes: @r, @sc, undocumented @ii.
\def\r#1{{\rm #1}}              % roman font
\def\sc#1{{\smallcaps#1}}       % smallcaps font
\def\ii#1{{\it #1}}             % italic font

% @b, explicit bold.  Also @strong.
\def\b#1{{\bf #1}}
\let\strong=\b

% @sansserif, explicit sans.
\def\sansserif#1{{\sf #1}}

% We can't just use \exhyphenpenalty, because that only has effect at
% the end of a paragraph.  Restore normal hyphenation at the end of the
% group within which \nohyphenation is presumably called.
%
\def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
\def\restorehyphenation{\hyphenchar\font = `- }

% Set sfcode to normal for the chars that usually have another value.
% Can't use plain's \frenchspacing because it uses the `\x notation, and
% sometimes \x has an active definition that messes things up.
%
\catcode`@=11
  \def\plainfrenchspacing{%
    \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
    \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
    \def\endofsentencespacefactor{1000}% for @. and friends
  }
  \def\plainnonfrenchspacing{%
    \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
    \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
    \def\endofsentencespacefactor{3000}% for @. and friends
  }
\catcode`@=\other
\def\endofsentencespacefactor{3000}% default

% @t, explicit typewriter.
\def\t#1{%
  {\tt \rawbackslash \plainfrenchspacing #1}%
  \null
}

% @samp.
\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}

% @indicateurl is \samp, that is, with quotes.
\let\indicateurl=\samp

% @code (and similar) prints in typewriter, but with spaces the same
% size as normal in the surrounding text, without hyphenation, etc.
% This is a subroutine for that.
\def\tclose#1{%
  {%
    % Change normal interword space to be same as for the current font.
    \spaceskip = \fontdimen2\font
    %
    % Switch to typewriter.
    \tt
    %
    % But `\ ' produces the large typewriter interword space.
    \def\ {{\spaceskip = 0pt{} }}%
    %
    % Turn off hyphenation.
    \nohyphenation
    %
    \rawbackslash
    \plainfrenchspacing
    #1%
  }%
  \null % reset spacefactor to 1000
}

% We *must* turn on hyphenation at `-' and `_' in @code.
% (But see \codedashfinish below.)
% Otherwise, it is too hard to avoid overfull hboxes
% in the Emacs manual, the Library manual, etc.
%
% Unfortunately, TeX uses one parameter (\hyphenchar) to control
% both hyphenation at - and hyphenation within words.
% We must therefore turn them both off (\tclose does that)
% and arrange explicitly to hyphenate at a dash. -- rms.
{
  \catcode`\-=\active \catcode`\_=\active
  \catcode`\'=\active \catcode`\`=\active
  \global\let'=\rq \global\let`=\lq  % default definitions
  %
  \global\def\code{\begingroup
    \setupmarkupstyle{code}%
    % The following should really be moved into \setupmarkupstyle handlers.
    \catcode\dashChar=\active  \catcode\underChar=\active
    \ifallowcodebreaks
     \let-\codedash
     \let_\codeunder
    \else
     \let-\normaldash
     \let_\realunder
    \fi
    % Given -foo (with a single dash), we do not want to allow a break
    % after the hyphen.
    \global\let\codedashprev=\codedash
    %
    \codex
  }
  %
  \gdef\codedash{\futurelet\next\codedashfinish}
  \gdef\codedashfinish{%
    \normaldash % always output the dash character itself.
    % 
    % Now, output a discretionary to allow a line break, unless
    % (a) the next character is a -, or
    % (b) the preceding character is a -.
    % E.g., given --posix, we do not want to allow a break after either -.
    % Given --foo-bar, we do want to allow a break between the - and the b.
    \ifx\next\codedash \else
      \ifx\codedashprev\codedash 
      \else \discretionary{}{}{}\fi
    \fi
    % we need the space after the = for the case when \next itself is a
    % space token; it would get swallowed otherwise.  As in @code{- a}.
    \global\let\codedashprev= \next
  }
}
\def\normaldash{-}
%
\def\codex #1{\tclose{#1}\endgroup}

\def\codeunder{%
  % this is all so @math{@code{var_name}+1} can work.  In math mode, _
  % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  % will therefore expand the active definition of _, which is us
  % (inside @code that is), therefore an endless loop.
  \ifusingtt{\ifmmode
               \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
             \else\normalunderscore \fi
             \discretionary{}{}{}}%
            {\_}%
}

% An additional complication: the above will allow breaks after, e.g.,
% each of the four underscores in __typeof__.  This is bad.
% @allowcodebreaks provides a document-level way to turn breaking at -
% and _ on and off.
%
\newif\ifallowcodebreaks  \allowcodebreakstrue

\def\keywordtrue{true}
\def\keywordfalse{false}

\parseargdef\allowcodebreaks{%
  \def\txiarg{#1}%
  \ifx\txiarg\keywordtrue
    \allowcodebreakstrue
  \else\ifx\txiarg\keywordfalse
    \allowcodebreaksfalse
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
  \fi\fi
}

% For @command, @env, @file, @option quotes seem unnecessary,
% so use \code rather than \samp.
\let\command=\code
\let\env=\code
\let\file=\code
\let\option=\code

% @uref (abbreviation for `urlref') aka @url takes an optional
% (comma-separated) second argument specifying the text to display and
% an optional third arg as text to display instead of (rather than in
% addition to) the url itself.  First (mandatory) arg is the url.

% TeX-only option to allow changing PDF output to show only the second
% arg (if given), and not the url (which is then just the link target).
\newif\ifurefurlonlylink

% The main macro is \urefbreak, which allows breaking at expected
% places within the url.  (There used to be another version, which
% didn't support automatic breaking.)
\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
\let\uref=\urefbreak
%
\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
  \unsepspaces
  \pdfurl{#1}%
  \setbox0 = \hbox{\ignorespaces #3}%
  \ifdim\wd0 > 0pt
    \unhbox0 % third arg given, show only that
  \else
    \setbox0 = \hbox{\ignorespaces #2}% look for second arg
    \ifdim\wd0 > 0pt
      \ifpdf
        % For pdfTeX and LuaTeX
        \ifurefurlonlylink
          % PDF plus option to not display url, show just arg
          \unhbox0             
        \else
          % PDF, normally display both arg and url for consistency,
          % visibility, if the pdf is eventually used to print, etc.
          \unhbox0\ (\urefcode{#1})%
        \fi
      \else
        \ifx\XeTeXrevision\thisisundefined
          \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
        \else
          % For XeTeX
          \ifurefurlonlylink
            % PDF plus option to not display url, show just arg
            \unhbox0             
          \else
            % PDF, normally display both arg and url for consistency,
            % visibility, if the pdf is eventually used to print, etc.
            \unhbox0\ (\urefcode{#1})%
          \fi
        \fi
      \fi
    \else
      \urefcode{#1}% only url given, so show it
    \fi
  \fi
  \endlink
\endgroup}

% Allow line breaks around only a few characters (only).
\def\urefcatcodes{%
  \catcode`\&=\active \catcode`\.=\active
  \catcode`\#=\active \catcode`\?=\active
  \catcode`\/=\active
}
{
  \urefcatcodes
  %
  \global\def\urefcode{\begingroup
    \setupmarkupstyle{code}%
    \urefcatcodes
    \let&\urefcodeamp
    \let.\urefcodedot
    \let#\urefcodehash
    \let?\urefcodequest
    \let/\urefcodeslash
    \codex
  }
  %
  % By default, they are just regular characters.
  \global\def&{\normalamp}
  \global\def.{\normaldot}
  \global\def#{\normalhash}
  \global\def?{\normalquest}
  \global\def/{\normalslash}
}

% we put a little stretch before and after the breakable chars, to help
% line breaking of long url's.  The unequal skips make look better in
% cmtt at least, especially for dots.
\def\urefprestretchamount{.13em}
\def\urefpoststretchamount{.1em}
\def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
\def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
%
\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
\def\urefcodedot{\urefprestretch .\urefpoststretch}
\def\urefcodehash{\urefprestretch \#\urefpoststretch}
\def\urefcodequest{\urefprestretch ?\urefpoststretch}
\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
{
  \catcode`\/=\active
  \global\def\urefcodeslashfinish{%
    \urefprestretch \slashChar
    % Allow line break only after the final / in a sequence of
    % slashes, to avoid line break between the slashes in http://.
    \ifx\next/\else \urefpoststretch \fi
  }
}

% One more complication: by default we'll break after the special
% characters, but some people like to break before the special chars, so
% allow that.  Also allow no breaking at all, for manual control.
% 
\parseargdef\urefbreakstyle{%
  \def\txiarg{#1}%
  \ifx\txiarg\wordnone
    \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
  \else\ifx\txiarg\wordbefore
    \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
  \else\ifx\txiarg\wordafter
    \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
  \fi\fi\fi
}
\def\wordafter{after}
\def\wordbefore{before}
\def\wordnone{none}

\urefbreakstyle after

% @url synonym for @uref, since that's how everyone uses it.
%
\let\url=\uref

% rms does not like angle brackets --karl, 17may97.
% So now @email is just like @uref, unless we are pdf.
%
%\def\email#1{\angleleft{\tt #1}\angleright}
\ifpdf
  \def\email#1{\doemail#1,,\finish}
  \def\doemail#1,#2,#3\finish{\begingroup
    \unsepspaces
    \pdfurl{mailto:#1}%
    \setbox0 = \hbox{\ignorespaces #2}%
    \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
    \endlink
  \endgroup}
\else
  \ifx\XeTeXrevision\thisisundefined
    \let\email=\uref
  \else
    \def\email#1{\doemail#1,,\finish}
    \def\doemail#1,#2,#3\finish{\begingroup
      \unsepspaces
      \pdfurl{mailto:#1}%
      \setbox0 = \hbox{\ignorespaces #2}%
      \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
      \endlink
    \endgroup}
  \fi
\fi

% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
%   `example' (@kbd uses ttsl only inside of @example and friends),
%   or `code' (@kbd uses normal tty font always).
\parseargdef\kbdinputstyle{%
  \def\txiarg{#1}%
  \ifx\txiarg\worddistinct
    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  \else\ifx\txiarg\wordexample
    \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  \else\ifx\txiarg\wordcode
    \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
  \fi\fi\fi
}
\def\worddistinct{distinct}
\def\wordexample{example}
\def\wordcode{code}

% Default is `distinct'.
\kbdinputstyle distinct

% @kbd is like @code, except that if the argument is just one @key command,
% then @kbd has no effect.
\def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}

\def\xkey{\key}
\def\kbdsub#1#2#3\par{%
  \def\one{#1}\def\three{#3}\def\threex{??}%
  \ifx\one\xkey\ifx\threex\three \key{#2}%
  \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
}

% definition of @key that produces a lozenge.  Doesn't adjust to text size.
%\setfont\keyrm\rmshape{8}{1000}{OT1}
%\font\keysy=cmsy9
%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
%  \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
%    \vbox{\hrule\kern-0.4pt
%     \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
%    \kern-0.4pt\hrule}%
%  \kern-.06em\raise0.4pt\hbox{\angleright}}}}

% definition of @key with no lozenge.  If the current font is already
% monospace, don't change it; that way, we respect @kbdinputstyle.  But
% if it isn't monospace, then use \tt.
%
\def\key#1{{\setupmarkupstyle{key}%
  \nohyphenation
  \ifmonospace\else\tt\fi
  #1}\null}

% @clicksequence{File @click{} Open ...}
\def\clicksequence#1{\begingroup #1\endgroup}

% @clickstyle @arrow   (by default)
\parseargdef\clickstyle{\def\click{#1}}
\def\click{\arrow}

% Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
%
\def\dmn#1{\thinspace #1}

% @acronym for "FBI", "NATO", and the like.
% We print this one point size smaller, since it's intended for
% all-uppercase.
%
\def\acronym#1{\doacronym #1,,\finish}
\def\doacronym#1,#2,#3\finish{%
  {\switchtolsize #1}%
  \def\temp{#2}%
  \ifx\temp\empty \else
    \space ({\unsepspaces \ignorespaces \temp \unskip})%
  \fi
  \null % reset \spacefactor=1000
}

% @abbr for "Comput. J." and the like.
% No font change, but don't do end-of-sentence spacing.
%
\def\abbr#1{\doabbr #1,,\finish}
\def\doabbr#1,#2,#3\finish{%
  {\plainfrenchspacing #1}%
  \def\temp{#2}%
  \ifx\temp\empty \else
    \space ({\unsepspaces \ignorespaces \temp \unskip})%
  \fi
  \null % reset \spacefactor=1000
}

% @asis just yields its argument.  Used with @table, for example.
%
\def\asis#1{#1}

% @math outputs its argument in math mode.
%
% One complication: _ usually means subscripts, but it could also mean
% an actual _ character, as in @math{@var{some_variable} + 1}.  So make
% _ active, and distinguish by seeing if the current family is \slfam,
% which is what @var uses.
{
  \catcode`\_ = \active
  \gdef\mathunderscore{%
    \catcode`\_=\active
    \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
  }
}
% Another complication: we want \\ (and @\) to output a math (or tt) \.
% FYI, plain.tex uses \\ as a temporary control sequence (for no
% particular reason), but this is not advertised and we don't care.
%
% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
%
\def\math{%
  \ifmmode\else % only go into math if not in math mode already
    \tex
    \mathunderscore
    \let\\ = \mathbackslash
    \mathactive
    % make the texinfo accent commands work in math mode
    \let\"=\ddot
    \let\'=\acute
    \let\==\bar
    \let\^=\hat
    \let\`=\grave
    \let\u=\breve
    \let\v=\check
    \let\~=\tilde
    \let\dotaccent=\dot
    % have to provide another name for sup operator
    \let\mathopsup=\sup
  $\expandafter\finishmath\fi
}
\def\finishmath#1{#1$\endgroup}  % Close the group opened by \tex.

% Some active characters (such as <) are spaced differently in math.
% We have to reset their definitions in case the @math was an argument
% to a command which sets the catcodes (such as @item or @section).
%
{
  \catcode`^ = \active
  \catcode`< = \active
  \catcode`> = \active
  \catcode`+ = \active
  \catcode`' = \active
  \gdef\mathactive{%
    \let^ = \ptexhat
    \let< = \ptexless
    \let> = \ptexgtr
    \let+ = \ptexplus
    \let' = \ptexquoteright
  }
}

% for @sub and @sup, if in math mode, just do a normal sub/superscript.
% If in text, use math to place as sub/superscript, but switch
% into text mode, with smaller fonts.  This is a different font than the
% one used for real math sub/superscripts (8pt vs. 7pt), but let's not
% fix it (significant additions to font machinery) until someone notices.
%
\def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
\def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
%
\def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
\def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%

% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
% except specified as a normal braced arg, so no newlines to worry about.
% 
\def\outfmtnametex{tex}
%
\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
\long\def\doinlinefmt#1,#2,\finish{%
  \def\inlinefmtname{#1}%
  \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
}
% 
% @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
% FMTNAME is tex, else ELSE-TEXT.
\long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
\long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
  \def\inlinefmtname{#1}%
  \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
}
%
% For raw, must switch into @tex before parsing the argument, to avoid
% setting catcodes prematurely.  Doing it this way means that, for
% example, @inlineraw{html, foo{bar} gets a parse error instead of being
% ignored.  But this isn't important because if people want a literal
% *right* brace they would have to use a command anyway, so they may as
% well use a command to get a left brace too.  We could re-use the
% delimiter character idea from \verb, but it seems like overkill.
% 
\long\def\inlineraw{\tex \doinlineraw}
\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
\def\doinlinerawtwo#1,#2,\finish{%
  \def\inlinerawname{#1}%
  \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
  \endgroup % close group opened by \tex.
}

% @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
%
\long\def\inlineifset#1{\doinlineifset #1,\finish}
\long\def\doinlineifset#1,#2,\finish{%
  \def\inlinevarname{#1}%
  \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
  \else\ignorespaces#2\fi
}

% @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
%
\long\def\inlineifclear#1{\doinlineifclear #1,\finish}
\long\def\doinlineifclear#1,#2,\finish{%
  \def\inlinevarname{#1}%
  \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
}


\message{glyphs,}
% and logos.

% @@ prints an @, as does @atchar{}.
\def\@{\char64 }
\let\atchar=\@

% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
\let\{=\lbracechar
\let\}=\rbracechar

% @comma{} to avoid , parsing problems.
\let\comma = ,

% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
\let\, = \ptexc
\let\dotaccent = \ptexdot
\def\ringaccent#1{{\accent23 #1}}
\let\tieaccent = \ptext
\let\ubaraccent = \ptexb
\let\udotaccent = \d

% Other special characters: @questiondown @exclamdown @ordf @ordm
% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
\def\questiondown{?`}
\def\exclamdown{!`}
\def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
\def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}

% Dotless i and dotless j, used for accents.
\def\imacro{i}
\def\jmacro{j}
\def\dotless#1{%
  \def\temp{#1}%
  \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
  \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
  \else \errmessage{@dotless can be used only with i or j}%
  \fi\fi
}

% The \TeX{} logo, as in plain, but resetting the spacing so that a
% period following counts as ending a sentence.  (Idea found in latex.)
%
\edef\TeX{\TeX \spacefactor=1000 }

% @LaTeX{} logo.  Not quite the same results as the definition in
% latex.ltx, since we use a different font for the raised A; it's most
% convenient for us to use an explicitly smaller font, rather than using
% the \scriptstyle font (since we don't reset \scriptstyle and
% \scriptscriptstyle).
%
\def\LaTeX{%
  L\kern-.36em
  {\setbox0=\hbox{T}%
   \vbox to \ht0{\hbox{%
     \ifx\textnominalsize\xwordpt
       % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
       % Revert to plain's \scriptsize, which is 7pt.
       \count255=\the\fam $\fam\count255 \scriptstyle A$%
     \else
       % For 11pt, we can use our lllsize.
       \switchtolllsize A%
     \fi
     }%
     \vss
  }}%
  \kern-.15em
  \TeX
}

% Some math mode symbols.  Define \ensuremath to switch into math mode
% unless we are already there.  Expansion tricks may not be needed here,
% but safer, and can't hurt.
\def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
\def\ensuredmath#1{$\relax#1$}
%
\def\bullet{\ensuremath\ptexbullet}
\def\geq{\ensuremath\ge}
\def\leq{\ensuremath\le}
\def\minus{\ensuremath-}

% @dots{} outputs an ellipsis using the current font.
% We do .5em per period so that it has the same spacing in the cm
% typewriter fonts as three actual period characters; on the other hand,
% in other typewriter fonts three periods are wider than 1.5em.  So do
% whichever is larger.
%
\def\dots{%
  \leavevmode
  \setbox0=\hbox{...}% get width of three periods
  \ifdim\wd0 > 1.5em
    \dimen0 = \wd0
  \else
    \dimen0 = 1.5em
  \fi
  \hbox to \dimen0{%
    \hskip 0pt plus.25fil
    .\hskip 0pt plus1fil
    .\hskip 0pt plus1fil
    .\hskip 0pt plus.5fil
  }%
}

% @enddots{} is an end-of-sentence ellipsis.
%
\def\enddots{%
  \dots
  \spacefactor=\endofsentencespacefactor
}

% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
%
% Since these characters are used in examples, they should be an even number of
% \tt widths. Each \tt character is 1en, so two makes it 1em.
%
\def\point{$\star$}
\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}

% The @error{} command.
% Adapted from the TeXbook's \boxit.
%
\newbox\errorbox
%
{\ttfont \global\dimen0 = 3em}% Width of the box.
\dimen2 = .55pt % Thickness of rules
% The text. (`r' is open on the right, `e' somewhat less so on the left.)
\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
%
\setbox\errorbox=\hbox to \dimen0{\hfil
   \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
   \advance\hsize by -2\dimen2 % Rules.
   \vbox{%
      \hrule height\dimen2
      \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
         \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
         \kern3pt\vrule width\dimen2}% Space to right.
      \hrule height\dimen2}
    \hfil}
%
\def\error{\leavevmode\lower.7ex\copy\errorbox}

% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
%
\def\pounds{{\it\$}}

% @euro{} comes from a separate font, depending on the current style.
% We use the free feym* fonts from the eurosym package by Henrik
% Theiling, which support regular, slanted, bold and bold slanted (and
% "outlined" (blackboard board, sort of) versions, which we don't need).
% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
%
% Although only regular is the truly official Euro symbol, we ignore
% that.  The Euro is designed to be slightly taller than the regular
% font height.
%
% feymr - regular
% feymo - slanted
% feybr - bold
% feybo - bold slanted
%
% There is no good (free) typewriter version, to my knowledge.
% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
% Hmm.
%
% Also doesn't work in math.  Do we need to do math with euro symbols?
% Hope not.
%
%
\def\euro{{\eurofont e}}
\def\eurofont{%
  % We set the font at each command, rather than predefining it in
  % \textfonts and the other font-switching commands, so that
  % installations which never need the symbol don't have to have the
  % font installed.
  %
  % There is only one designed size (nominal 10pt), so we always scale
  % that to the current nominal size.
  %
  % By the way, simply using "at 1em" works for cmr10 and the like, but
  % does not work for cmbx10 and other extended/shrunken fonts.
  %
  \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
  %
  \ifx\curfontstyle\bfstylename
    % bold:
    \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
  \else
    % regular:
    \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
  \fi
  \thiseurofont
}

% Glyphs from the EC fonts.  We don't use \let for the aliases, because
% sometimes we redefine the original macro, and the alias should reflect
% the redefinition.
%
% Use LaTeX names for the Icelandic letters.
\def\DH{{\ecfont \char"D0}} % Eth
\def\dh{{\ecfont \char"F0}} % eth
\def\TH{{\ecfont \char"DE}} % Thorn
\def\th{{\ecfont \char"FE}} % thorn
%
\def\guillemetleft{{\ecfont \char"13}}
\def\guillemotleft{\guillemetleft}
\def\guillemetright{{\ecfont \char"14}}
\def\guillemotright{\guillemetright}
\def\guilsinglleft{{\ecfont \char"0E}}
\def\guilsinglright{{\ecfont \char"0F}}
\def\quotedblbase{{\ecfont \char"12}}
\def\quotesinglbase{{\ecfont \char"0D}}
%
% This positioning is not perfect (see the ogonek LaTeX package), but
% we have the precomposed glyphs for the most common cases.  We put the
% tests to use those glyphs in the single \ogonek macro so we have fewer
% dummy definitions to worry about for index entries, etc.
%
% ogonek is also used with other letters in Lithuanian (IOU), but using
% the precomposed glyphs for those is not so easy since they aren't in
% the same EC font.
\def\ogonek#1{{%
  \def\temp{#1}%
  \ifx\temp\macrocharA\Aogonek
  \else\ifx\temp\macrochara\aogonek
  \else\ifx\temp\macrocharE\Eogonek
  \else\ifx\temp\macrochare\eogonek
  \else
    \ecfont \setbox0=\hbox{#1}%
    \ifdim\ht0=1ex\accent"0C #1%
    \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
    \fi
  \fi\fi\fi\fi
  }%
}
\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
%
% Use the European Computer Modern fonts (cm-super in outline format)
% for non-CM glyphs.  That is ec* for regular text and tc* for the text
% companion symbols (LaTeX TS1 encoding).  Both are part of the ec
% package and follow the same conventions.
% 
\def\ecfont{\etcfont{e}}
\def\tcfont{\etcfont{t}}
%
\def\etcfont#1{%
  % We can't distinguish serif/sans and italic/slanted, but this
  % is used for crude hacks anyway (like adding French and German
  % quotes to documents typeset with CM, where we lose kerning), so
  % hopefully nobody will notice/care.
  \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
  \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
  \ifmonospace
    % typewriter:
    \font\thisecfont = #1ctt\ecsize \space at \nominalsize
  \else
    \ifx\curfontstyle\bfstylename
      % bold:
      \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
    \else
      % regular:
      \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
    \fi
  \fi
  \thisecfont
}

% @registeredsymbol - R in a circle.  The font for the R should really
% be smaller yet, but lllsize is the best we can do for now.
% Adapted from the plain.tex definition of \copyright.
%
\def\registeredsymbol{%
  $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
               \hfil\crcr\Orb}}%
    }$%
}

% @textdegree - the normal degrees sign.
%
\def\textdegree{$^\circ$}

% Laurent Siebenmann reports \Orb undefined with:
%  Textures 1.7.7 (preloaded format=plain 93.10.14)  (68K)  16 APR 2004 02:38
% so we'll define it if necessary.
%
\ifx\Orb\thisisundefined
\def\Orb{\mathhexbox20D}
\fi

% Quotes.
\chardef\quotedblleft="5C
\chardef\quotedblright=`\"
\chardef\quoteleft=`\`
\chardef\quoteright=`\'


\message{page headings,}

\newskip\titlepagetopglue \titlepagetopglue = 1.5in
\newskip\titlepagebottomglue \titlepagebottomglue = 2pc

% First the title page.  Must do @settitle before @titlepage.
\newif\ifseenauthor
\newif\iffinishedtitlepage

% @setcontentsaftertitlepage used to do an implicit @contents or
% @shortcontents after @end titlepage, but it is now obsolete.
\def\setcontentsaftertitlepage{%
  \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
              command; move your @contents command if you want the contents
              after the title page.}}%
\def\setshortcontentsaftertitlepage{%
  \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
              command; move your @shortcontents and @contents commands if you 
              want the contents after the title page.}}%

\parseargdef\shorttitlepage{%
  \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  \endgroup\page\hbox{}\page}

\envdef\titlepage{%
  % Open one extra group, as we want to close it in the middle of \Etitlepage.
  \begingroup
    \parindent=0pt \textfonts
    % Leave some space at the very top of the page.
    \vglue\titlepagetopglue
    % No rule at page bottom unless we print one at the top with @title.
    \finishedtitlepagetrue
    %
    % Most title ``pages'' are actually two pages long, with space
    % at the top of the second.  We don't want the ragged left on the second.
    \let\oldpage = \page
    \def\page{%
      \iffinishedtitlepage\else
	 \finishtitlepage
      \fi
      \let\page = \oldpage
      \page
      \null
    }%
}

\def\Etitlepage{%
    \iffinishedtitlepage\else
	\finishtitlepage
    \fi
    % It is important to do the page break before ending the group,
    % because the headline and footline are only empty inside the group.
    % If we use the new definition of \page, we always get a blank page
    % after the title page, which we certainly don't want.
    \oldpage
  \endgroup
  %
  % Need this before the \...aftertitlepage checks so that if they are
  % in effect the toc pages will come out with page numbers.
  \HEADINGSon
}

\def\finishtitlepage{%
  \vskip4pt \hrule height 2pt width \hsize
  \vskip\titlepagebottomglue
  \finishedtitlepagetrue
}

% Settings used for typesetting titles: no hyphenation, no indentation,
% don't worry much about spacing, ragged right.  This should be used
% inside a \vbox, and fonts need to be set appropriately first. \par should
% be specified before the end of the \vbox, since a vbox is a group.
% 
\def\raggedtitlesettings{%
  \rm
  \hyphenpenalty=10000
  \parindent=0pt
  \tolerance=5000
  \ptexraggedright
}

% Macros to be used within @titlepage:

\let\subtitlerm=\rmfont
\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}

\parseargdef\title{%
  \checkenv\titlepage
  \vbox{\titlefonts \raggedtitlesettings #1\par}%
  % print a rule at the page bottom also.
  \finishedtitlepagefalse
  \vskip4pt \hrule height 4pt width \hsize \vskip4pt
}

\parseargdef\subtitle{%
  \checkenv\titlepage
  {\subtitlefont \rightline{#1}}%
}

% @author should come last, but may come many times.
% It can also be used inside @quotation.
%
\parseargdef\author{%
  \def\temp{\quotation}%
  \ifx\thisenv\temp
    \def\quotationauthor{#1}% printed in \Equotation.
  \else
    \checkenv\titlepage
    \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
    {\secfonts\rm \leftline{#1}}%
  \fi
}


% Set up page headings and footings.

\let\thispage=\folio

\newtoks\evenheadline    % headline on even pages
\newtoks\oddheadline     % headline on odd pages
\newtoks\evenfootline    % footline on even pages
\newtoks\oddfootline     % footline on odd pages

% Now make \makeheadline and \makefootline in Plain TeX use those variables
\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
                            \else \the\evenheadline \fi}}
\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
                            \else \the\evenfootline \fi}\HEADINGShook}
\let\HEADINGShook=\relax

% Commands to set those variables.
% For example, this is what  @headings on  does
% @evenheading @thistitle|@thispage|@thischapter
% @oddheading @thischapter|@thispage|@thistitle
% @evenfooting @thisfile||
% @oddfooting ||@thisfile


\def\evenheading{\parsearg\evenheadingxxx}
\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}

\def\oddheading{\parsearg\oddheadingxxx}
\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}

\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%

\def\evenfooting{\parsearg\evenfootingxxx}
\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}

\def\oddfooting{\parsearg\oddfootingxxx}
\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
  \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  %
  % Leave some space for the footline.  Hopefully ok to assume
  % @evenfooting will not be used by itself.
  \global\advance\txipageheight by -12pt
  \global\advance\vsize by -12pt
}

\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}

% @evenheadingmarks top     \thischapter <- chapter at the top of a page
% @evenheadingmarks bottom  \thischapter <- chapter at the bottom of a page
%
% The same set of arguments for:
%
% @oddheadingmarks
% @evenfootingmarks
% @oddfootingmarks
% @everyheadingmarks
% @everyfootingmarks

% These define \getoddheadingmarks, \getevenheadingmarks,
% \getoddfootingmarks, and \getevenfootingmarks, each to one of
% \gettopheadingmarks, \getbottomheadingmarks.
%
\def\evenheadingmarks{\headingmarks{even}{heading}}
\def\oddheadingmarks{\headingmarks{odd}{heading}}
\def\evenfootingmarks{\headingmarks{even}{footing}}
\def\oddfootingmarks{\headingmarks{odd}{footing}}
\parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
                          \headingmarks{odd}{heading}{#1} }
\parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
                          \headingmarks{odd}{footing}{#1} }
% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
\def\headingmarks#1#2#3 {%
  \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
  \global\expandafter\let\csname get#1#2marks\endcsname \temp
}

\everyheadingmarks bottom
\everyfootingmarks bottom

% @headings double      turns headings on for double-sided printing.
% @headings single      turns headings on for single-sided printing.
% @headings off         turns them off.
% @headings on          same as @headings double, retained for compatibility.
% @headings after       turns on double-sided headings after this page.
% @headings doubleafter turns on double-sided headings after this page.
% @headings singleafter turns on single-sided headings after this page.
% By default, they are off at the start of a document,
% and turned `on' after @end titlepage.

\parseargdef\headings{\csname HEADINGS#1\endcsname}

\def\headingsoff{% non-global headings elimination
  \evenheadline={\hfil}\evenfootline={\hfil}%
   \oddheadline={\hfil}\oddfootline={\hfil}%
}

\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
\HEADINGSoff  % it's the default

% When we turn headings on, set the page number to 1.
% For double-sided printing, put current file name in lower left corner,
% chapter name on inside top of right hand pages, document
% title on inside top of left hand pages, and page numbers on outside top
% edge of all pages.
\def\HEADINGSdouble{%
\global\pageno=1
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
\global\evenheadline={\line{\folio\hfil\thistitle}}
\global\oddheadline={\line{\thischapterheading\hfil\folio}}
\global\let\contentsalignmacro = \chapoddpage
}
\let\contentsalignmacro = \chappager

% For single-sided printing, chapter title goes across top left of page,
% page number on top right.
\def\HEADINGSsingle{%
\global\pageno=1
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
\global\evenheadline={\line{\thischapterheading\hfil\folio}}
\global\oddheadline={\line{\thischapterheading\hfil\folio}}
\global\let\contentsalignmacro = \chappager
}
\def\HEADINGSon{\HEADINGSdouble}

\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
\let\HEADINGSdoubleafter=\HEADINGSafter
\def\HEADINGSdoublex{%
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
\global\evenheadline={\line{\folio\hfil\thistitle}}
\global\oddheadline={\line{\thischapterheading\hfil\folio}}
\global\let\contentsalignmacro = \chapoddpage
}

\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
\def\HEADINGSsinglex{%
\global\evenfootline={\hfil}
\global\oddfootline={\hfil}
\global\evenheadline={\line{\thischapterheading\hfil\folio}}
\global\oddheadline={\line{\thischapterheading\hfil\folio}}
\global\let\contentsalignmacro = \chappager
}

% Subroutines used in generating headings
% This produces Day Month Year style of output.
% Only define if not already defined, in case a txi-??.tex file has set
% up a different format (e.g., txi-cs.tex does this).
\ifx\today\thisisundefined
\def\today{%
  \number\day\space
  \ifcase\month
  \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  \fi
  \space\number\year}
\fi

% @settitle line...  specifies the title of the document, for headings.
% It generates no output of its own.
\def\thistitle{\putwordNoTitle}
\def\settitle{\parsearg{\gdef\thistitle}}


\message{tables,}
% Tables -- @table, @ftable, @vtable, @item(x).

% default indentation of table text
\newdimen\tableindent \tableindent=.8in
% default indentation of @itemize and @enumerate text
\newdimen\itemindent  \itemindent=.3in
% margin between end of table item and start of table text.
\newdimen\itemmargin  \itemmargin=.1in

% used internally for \itemindent minus \itemmargin
\newdimen\itemmax

% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
% these defs.
% They also define \itemindex
% to index the item name in whatever manner is desired (perhaps none).

\newif\ifitemxneedsnegativevskip

\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}

\def\internalBitem{\smallbreak \parsearg\itemzzz}
\def\internalBitemx{\itemxpar \parsearg\itemzzz}

\def\itemzzz #1{\begingroup %
  \advance\hsize by -\rightskip
  \advance\hsize by -\tableindent
  \setbox0=\hbox{\itemindicate{#1}}%
  \itemindex{#1}%
  \nobreak % This prevents a break before @itemx.
  %
  % If the item text does not fit in the space we have, put it on a line
  % by itself, and do not allow a page break either before or after that
  % line.  We do not start a paragraph here because then if the next
  % command is, e.g., @kindex, the whatsit would get put into the
  % horizontal list on a line by itself, resulting in extra blank space.
  \ifdim \wd0>\itemmax
    %
    % Make this a paragraph so we get the \parskip glue and wrapping,
    % but leave it ragged-right.
    \begingroup
      \advance\leftskip by-\tableindent
      \advance\hsize by\tableindent
      \advance\rightskip by0pt plus1fil\relax
      \leavevmode\unhbox0\par
    \endgroup
    %
    % We're going to be starting a paragraph, but we don't want the
    % \parskip glue -- logically it's part of the @item we just started.
    \nobreak \vskip-\parskip
    %
    % Stop a page break at the \parskip glue coming up.  However, if
    % what follows is an environment such as @example, there will be no
    % \parskip glue; then the negative vskip we just inserted would
    % cause the example and the item to crash together.  So we use this
    % bizarre value of 10001 as a signal to \aboveenvbreak to insert
    % \parskip glue after all.  Section titles are handled this way also.
    %
    \penalty 10001
    \endgroup
    \itemxneedsnegativevskipfalse
  \else
    % The item text fits into the space.  Start a paragraph, so that the
    % following text (if any) will end up on the same line.
    \noindent
    % Do this with kerns and \unhbox so that if there is a footnote in
    % the item text, it can migrate to the main vertical list and
    % eventually be printed.
    \nobreak\kern-\tableindent
    \dimen0 = \itemmax  \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
    \unhbox0
    \nobreak\kern\dimen0
    \endgroup
    \itemxneedsnegativevskiptrue
  \fi
}

\def\item{\errmessage{@item while not in a list environment}}
\def\itemx{\errmessage{@itemx while not in a list environment}}

% @table, @ftable, @vtable.
\envdef\table{%
  \let\itemindex\gobble
  \tablecheck{table}%
}
\envdef\ftable{%
  \def\itemindex ##1{\doind {fn}{\code{##1}}}%
  \tablecheck{ftable}%
}
\envdef\vtable{%
  \def\itemindex ##1{\doind {vr}{\code{##1}}}%
  \tablecheck{vtable}%
}
\def\tablecheck#1{%
  \ifnum \the\catcode`\^^M=\active
    \endgroup
    \errmessage{This command won't work in this context; perhaps the problem is
      that we are \inenvironment\thisenv}%
    \def\next{\doignore{#1}}%
  \else
    \let\next\tablex
  \fi
  \next
}
\def\tablex#1{%
  \def\itemindicate{#1}%
  \parsearg\tabley
}
\def\tabley#1{%
  {%
    \makevalueexpandable
    \edef\temp{\noexpand\tablez #1\space\space\space}%
    \expandafter
  }\temp \endtablez
}
\def\tablez #1 #2 #3 #4\endtablez{%
  \aboveenvbreak
  \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
  \ifnum 0#2>0 \tableindent=#2\mil \fi
  \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
  \itemmax=\tableindent
  \advance \itemmax by -\itemmargin
  \advance \leftskip by \tableindent
  \exdentamount=\tableindent
  \parindent = 0pt
  \parskip = \smallskipamount
  \ifdim \parskip=0pt \parskip=2pt \fi
  \let\item = \internalBitem
  \let\itemx = \internalBitemx
}
\def\Etable{\endgraf\afterenvbreak}
\let\Eftable\Etable
\let\Evtable\Etable
\let\Eitemize\Etable
\let\Eenumerate\Etable

% This is the counter used by @enumerate, which is really @itemize

\newcount \itemno

\envdef\itemize{\parsearg\doitemize}

\def\doitemize#1{%
  \aboveenvbreak
  \itemmax=\itemindent
  \advance\itemmax by -\itemmargin
  \advance\leftskip by \itemindent
  \exdentamount=\itemindent
  \parindent=0pt
  \parskip=\smallskipamount
  \ifdim\parskip=0pt \parskip=2pt \fi
  %
  % Try typesetting the item mark so that if the document erroneously says
  % something like @itemize @samp (intending @table), there's an error
  % right away at the @itemize.  It's not the best error message in the
  % world, but it's better than leaving it to the @item.  This means if
  % the user wants an empty mark, they have to say @w{} not just @w.
  \def\itemcontents{#1}%
  \setbox0 = \hbox{\itemcontents}%
  %
  % @itemize with no arg is equivalent to @itemize @bullet.
  \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
  %
  \let\item=\itemizeitem
}

% Definition of @item while inside @itemize and @enumerate.
%
\def\itemizeitem{%
  \advance\itemno by 1  % for enumerations
  {\let\par=\endgraf \smallbreak}% reasonable place to break
  {%
   % If the document has an @itemize directly after a section title, a
   % \nobreak will be last on the list, and \sectionheading will have
   % done a \vskip-\parskip.  In that case, we don't want to zero
   % parskip, or the item text will crash with the heading.  On the
   % other hand, when there is normal text preceding the item (as there
   % usually is), we do want to zero parskip, or there would be too much
   % space.  In that case, we won't have a \nobreak before.  At least
   % that's the theory.
   \ifnum\lastpenalty<10000 \parskip=0in \fi
   \noindent
   \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
   %
   \ifinner\else
     \vadjust{\penalty 1200}% not good to break after first line of item.
   \fi
   % We can be in inner vertical mode in a footnote, although an
   % @itemize looks awful there.
  }%
  \flushcr
}

% \splitoff TOKENS\endmark defines \first to be the first token in
% TOKENS, and \rest to be the remainder.
%
\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%

% Allow an optional argument of an uppercase letter, lowercase letter,
% or number, to specify the first label in the enumerated list.  No
% argument is the same as `1'.
%
\envparseargdef\enumerate{\enumeratey #1  \endenumeratey}
\def\enumeratey #1 #2\endenumeratey{%
  % If we were given no argument, pretend we were given `1'.
  \def\thearg{#1}%
  \ifx\thearg\empty \def\thearg{1}\fi
  %
  % Detect if the argument is a single token.  If so, it might be a
  % letter.  Otherwise, the only valid thing it can be is a number.
  % (We will always have one token, because of the test we just made.
  % This is a good thing, since \splitoff doesn't work given nothing at
  % all -- the first parameter is undelimited.)
  \expandafter\splitoff\thearg\endmark
  \ifx\rest\empty
    % Only one token in the argument.  It could still be anything.
    % A ``lowercase letter'' is one whose \lccode is nonzero.
    % An ``uppercase letter'' is one whose \lccode is both nonzero, and
    %   not equal to itself.
    % Otherwise, we assume it's a number.
    %
    % We need the \relax at the end of the \ifnum lines to stop TeX from
    % continuing to look for a <number>.
    %
    \ifnum\lccode\expandafter`\thearg=0\relax
      \numericenumerate % a number (we hope)
    \else
      % It's a letter.
      \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
        \lowercaseenumerate % lowercase letter
      \else
        \uppercaseenumerate % uppercase letter
      \fi
    \fi
  \else
    % Multiple tokens in the argument.  We hope it's a number.
    \numericenumerate
  \fi
}

% An @enumerate whose labels are integers.  The starting integer is
% given in \thearg.
%
\def\numericenumerate{%
  \itemno = \thearg
  \startenumeration{\the\itemno}%
}

% The starting (lowercase) letter is in \thearg.
\def\lowercaseenumerate{%
  \itemno = \expandafter`\thearg
  \startenumeration{%
    % Be sure we're not beyond the end of the alphabet.
    \ifnum\itemno=0
      \errmessage{No more lowercase letters in @enumerate; get a bigger
                  alphabet}%
    \fi
    \char\lccode\itemno
  }%
}

% The starting (uppercase) letter is in \thearg.
\def\uppercaseenumerate{%
  \itemno = \expandafter`\thearg
  \startenumeration{%
    % Be sure we're not beyond the end of the alphabet.
    \ifnum\itemno=0
      \errmessage{No more uppercase letters in @enumerate; get a bigger
                  alphabet}
    \fi
    \char\uccode\itemno
  }%
}

% Call \doitemize, adding a period to the first argument and supplying the
% common last two arguments.  Also subtract one from the initial value in
% \itemno, since @item increments \itemno.
%
\def\startenumeration#1{%
  \advance\itemno by -1
  \doitemize{#1.}\flushcr
}

% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
% to @enumerate.
%
\def\alphaenumerate{\enumerate{a}}
\def\capsenumerate{\enumerate{A}}
\def\Ealphaenumerate{\Eenumerate}
\def\Ecapsenumerate{\Eenumerate}


% @multitable macros
% Amy Hendrickson, 8/18/94, 3/6/96
%
% @multitable ... @end multitable will make as many columns as desired.
% Contents of each column will wrap at width given in preamble.  Width
% can be specified either with sample text given in a template line,
% or in percent of \hsize, the current width of text on page.

% Table can continue over pages but will only break between lines.

% To make preamble:
%
% Either define widths of columns in terms of percent of \hsize:
%   @multitable @columnfractions .25 .3 .45
%   @item ...
%
%   Numbers following @columnfractions are the percent of the total
%   current hsize to be used for each column. You may use as many
%   columns as desired.


% Or use a template:
%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
%   @item ...
%   using the widest term desired in each column.

% Each new table line starts with @item, each subsequent new column
% starts with @tab. Empty columns may be produced by supplying @tab's
% with nothing between them for as many times as empty columns are needed,
% ie, @tab@tab@tab will produce two empty columns.

% @item, @tab do not need to be on their own lines, but it will not hurt
% if they are.

% Sample multitable:

%   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
%   @item first col stuff @tab second col stuff @tab third col
%   @item
%   first col stuff
%   @tab
%   second col stuff
%   @tab
%   third col
%   @item first col stuff @tab second col stuff
%   @tab Many paragraphs of text may be used in any column.
%
%         They will wrap at the width determined by the template.
%   @item@tab@tab This will be in third column.
%   @end multitable

% Default dimensions may be reset by user.
% @multitableparskip is vertical space between paragraphs in table.
% @multitableparindent is paragraph indent in table.
% @multitablecolmargin is horizontal space to be left between columns.
% @multitablelinespace is space to leave between table items, baseline
%                                                            to baseline.
%   0pt means it depends on current normal line spacing.
%
\newskip\multitableparskip
\newskip\multitableparindent
\newdimen\multitablecolspace
\newskip\multitablelinespace
\multitableparskip=0pt
\multitableparindent=6pt
\multitablecolspace=12pt
\multitablelinespace=0pt

% Macros used to set up halign preamble:
%
\let\endsetuptable\relax
\def\xendsetuptable{\endsetuptable}
\let\columnfractions\relax
\def\xcolumnfractions{\columnfractions}
\newif\ifsetpercent

% #1 is the @columnfraction, usually a decimal number like .5, but might
% be just 1.  We just use it, whatever it is.
%
\def\pickupwholefraction#1 {%
  \global\advance\colcount by 1
  \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
  \setuptable
}

\newcount\colcount
\def\setuptable#1{%
  \def\firstarg{#1}%
  \ifx\firstarg\xendsetuptable
    \let\go = \relax
  \else
    \ifx\firstarg\xcolumnfractions
      \global\setpercenttrue
    \else
      \ifsetpercent
         \let\go\pickupwholefraction
      \else
         \global\advance\colcount by 1
         \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
                   % separator; typically that is always in the input, anyway.
         \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
      \fi
    \fi
    \ifx\go\pickupwholefraction
      % Put the argument back for the \pickupwholefraction call, so
      % we'll always have a period there to be parsed.
      \def\go{\pickupwholefraction#1}%
    \else
      \let\go = \setuptable
    \fi%
  \fi
  \go
}

% multitable-only commands.
% 
% @headitem starts a heading row, which we typeset in bold.  Assignments
% have to be global since we are inside the implicit group of an
% alignment entry.  \everycr below resets \everytab so we don't have to
% undo it ourselves.
\def\headitemfont{\b}% for people to use in the template row; not changeable
\def\headitem{%
  \checkenv\multitable
  \crcr
  \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
  \global\everytab={\bf}% can't use \headitemfont since the parsing differs
  \the\everytab % for the first item
}%
%
% default for tables with no headings.
\let\headitemcrhook=\relax
%
% A \tab used to include \hskip1sp.  But then the space in a template
% line is not enough.  That is bad.  So let's go back to just `&' until
% we again encounter the problem the 1sp was intended to solve.
%					--karl, nathan@acm.org, 20apr99.
\def\tab{\checkenv\multitable &\the\everytab}%

% @multitable ... @end multitable definitions:
%
\newtoks\everytab  % insert after every tab.
%
\envdef\multitable{%
  \vskip\parskip
  \startsavinginserts
  %
  % @item within a multitable starts a normal row.
  % We use \def instead of \let so that if one of the multitable entries
  % contains an @itemize, we don't choke on the \item (seen as \crcr aka
  % \endtemplate) expanding \doitemize.
  \def\item{\crcr}%
  %
  \tolerance=9500
  \hbadness=9500
  \setmultitablespacing
  \parskip=\multitableparskip
  \parindent=\multitableparindent
  \overfullrule=0pt
  \global\colcount=0
  %
  \everycr = {%
    \noalign{%
      \global\everytab={}% Reset from possible headitem.
      \global\colcount=0 % Reset the column counter.
      %
      % Check for saved footnotes, etc.:
      \checkinserts
      %
      % Perhaps a \nobreak, then reset:
      \headitemcrhook
      \global\let\headitemcrhook=\relax
    }%
  }%
  %
  \parsearg\domultitable
}
\def\domultitable#1{%
  % To parse everything between @multitable and @item:
  \setuptable#1 \endsetuptable
  %
  % This preamble sets up a generic column definition, which will
  % be used as many times as user calls for columns.
  % \vtop will set a single line and will also let text wrap and
  % continue for many paragraphs if desired.
  \halign\bgroup &%
    \global\advance\colcount by 1
    \multistrut
    \vtop{%
      % Use the current \colcount to find the correct column width:
      \hsize=\expandafter\csname col\the\colcount\endcsname
      %
      % In order to keep entries from bumping into each other
      % we will add a \leftskip of \multitablecolspace to all columns after
      % the first one.
      %
      % If a template has been used, we will add \multitablecolspace
      % to the width of each template entry.
      %
      % If the user has set preamble in terms of percent of \hsize we will
      % use that dimension as the width of the column, and the \leftskip
      % will keep entries from bumping into each other.  Table will start at
      % left margin and final column will justify at right margin.
      %
      % Make sure we don't inherit \rightskip from the outer environment.
      \rightskip=0pt
      \ifnum\colcount=1
	% The first column will be indented with the surrounding text.
	\advance\hsize by\leftskip
      \else
	\ifsetpercent \else
	  % If user has not set preamble in terms of percent of \hsize
	  % we will advance \hsize by \multitablecolspace.
	  \advance\hsize by \multitablecolspace
	\fi
       % In either case we will make \leftskip=\multitablecolspace:
      \leftskip=\multitablecolspace
      \fi
      % Ignoring space at the beginning and end avoids an occasional spurious
      % blank line, when TeX decides to break the line at the space before the
      % box from the multistrut, so the strut ends up on a line by itself.
      % For example:
      % @multitable @columnfractions .11 .89
      % @item @code{#}
      % @tab Legal holiday which is valid in major parts of the whole country.
      % Is automatically provided with highlighting sequences respectively
      % marking characters.
      \noindent\ignorespaces##\unskip\multistrut
    }\cr
}
\def\Emultitable{%
  \crcr
  \egroup % end the \halign
  \global\setpercentfalse
}

\def\setmultitablespacing{%
  \def\multistrut{\strut}% just use the standard line spacing
  %
  % Compute \multitablelinespace (if not defined by user) for use in
  % \multitableparskip calculation.  We used define \multistrut based on
  % this, but (ironically) that caused the spacing to be off.
  % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
\ifdim\multitablelinespace=0pt
\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
\global\advance\multitablelinespace by-\ht0
\fi
% Test to see if parskip is larger than space between lines of
% table. If not, do nothing.
%        If so, set to same dimension as multitablelinespace.
\ifdim\multitableparskip>\multitablelinespace
\global\multitableparskip=\multitablelinespace
\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
                                      % than skip between lines in the table.
\fi%
\ifdim\multitableparskip=0pt
\global\multitableparskip=\multitablelinespace
\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
                                      % than skip between lines in the table.
\fi}


\message{conditionals,}

% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
% @ifnotxml always succeed.  They currently do nothing; we don't
% attempt to check whether the conditionals are properly nested.  But we
% have to remember that they are conditionals, so that @end doesn't
% attempt to close an environment group.
%
\def\makecond#1{%
  \expandafter\let\csname #1\endcsname = \relax
  \expandafter\let\csname iscond.#1\endcsname = 1
}
\makecond{iftex}
\makecond{ifnotdocbook}
\makecond{ifnothtml}
\makecond{ifnotinfo}
\makecond{ifnotplaintext}
\makecond{ifnotxml}

% Ignore @ignore, @ifhtml, @ifinfo, and the like.
%
\def\direntry{\doignore{direntry}}
\def\documentdescription{\doignore{documentdescription}}
\def\docbook{\doignore{docbook}}
\def\html{\doignore{html}}
\def\ifdocbook{\doignore{ifdocbook}}
\def\ifhtml{\doignore{ifhtml}}
\def\ifinfo{\doignore{ifinfo}}
\def\ifnottex{\doignore{ifnottex}}
\def\ifplaintext{\doignore{ifplaintext}}
\def\ifxml{\doignore{ifxml}}
\def\ignore{\doignore{ignore}}
\def\menu{\doignore{menu}}
\def\xml{\doignore{xml}}

% Ignore text until a line `@end #1', keeping track of nested conditionals.
%
% A count to remember the depth of nesting.
\newcount\doignorecount

\def\doignore#1{\begingroup
  % Scan in ``verbatim'' mode:
  \obeylines
  \catcode`\@ = \other
  \catcode`\{ = \other
  \catcode`\} = \other
  %
  % Make sure that spaces turn into tokens that match what \doignoretext wants.
  \spaceisspace
  %
  % Count number of #1's that we've seen.
  \doignorecount = 0
  %
  % Swallow text until we reach the matching `@end #1'.
  \dodoignore{#1}%
}

{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
  \obeylines %
  %
  \gdef\dodoignore#1{%
    % #1 contains the command name as a string, e.g., `ifinfo'.
    %
    % Define a command to find the next `@end #1'.
    \long\def\doignoretext##1^^M@end #1{%
      \doignoretextyyy##1^^M@#1\_STOP_}%
    %
    % And this command to find another #1 command, at the beginning of a
    % line.  (Otherwise, we would consider a line `@c @ifset', for
    % example, to count as an @ifset for nesting.)
    \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
    %
    % And now expand that command.
    \doignoretext ^^M%
  }%
}

\def\doignoreyyy#1{%
  \def\temp{#1}%
  \ifx\temp\empty			% Nothing found.
    \let\next\doignoretextzzz
  \else					% Found a nested condition, ...
    \advance\doignorecount by 1
    \let\next\doignoretextyyy		% ..., look for another.
    % If we're here, #1 ends with ^^M\ifinfo (for example).
  \fi
  \next #1% the token \_STOP_ is present just after this macro.
}

% We have to swallow the remaining "\_STOP_".
%
\def\doignoretextzzz#1{%
  \ifnum\doignorecount = 0	% We have just found the outermost @end.
    \let\next\enddoignore
  \else				% Still inside a nested condition.
    \advance\doignorecount by -1
    \let\next\doignoretext      % Look for the next @end.
  \fi
  \next
}

% Finish off ignored text.
{ \obeylines%
  % Ignore anything after the last `@end #1'; this matters in verbatim
  % environments, where otherwise the newline after an ignored conditional
  % would result in a blank line in the output.
  \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
}


% @set VAR sets the variable VAR to an empty value.
% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
%
% Since we want to separate VAR from REST-OF-LINE (which might be
% empty), we can't just use \parsearg; we have to insert a space of our
% own to delimit the rest of the line, and then take it out again if we
% didn't need it.
% We rely on the fact that \parsearg sets \catcode`\ =10.
%
\parseargdef\set{\setyyy#1 \endsetyyy}
\def\setyyy#1 #2\endsetyyy{%
  {%
    \makevalueexpandable
    \def\temp{#2}%
    \edef\next{\gdef\makecsname{SET#1}}%
    \ifx\temp\empty
      \next{}%
    \else
      \setzzz#2\endsetzzz
    \fi
  }%
}
% Remove the trailing space \setxxx inserted.
\def\setzzz#1 \endsetzzz{\next{#1}}

% @clear VAR clears (i.e., unsets) the variable VAR.
%
\parseargdef\clear{%
  {%
    \makevalueexpandable
    \global\expandafter\let\csname SET#1\endcsname=\relax
  }%
}

% @value{foo} gets the text saved in variable foo.
\def\value{\begingroup\makevalueexpandable\valuexxx}
\def\valuexxx#1{\expandablevalue{#1}\endgroup}
{
  \catcode`\-=\active \catcode`\_=\active
  %
  \gdef\makevalueexpandable{%
    \let\value = \expandablevalue
    % We don't want these characters active, ...
    \catcode`\-=\other \catcode`\_=\other
    % ..., but we might end up with active ones in the argument if
    % we're called from @code, as @code{@value{foo-bar_}}, though.
    % So \let them to their normal equivalents.
    \let-\normaldash \let_\normalunderscore
  }
}

% We have this subroutine so that we can handle at least some @value's
% properly in indexes (we call \makevalueexpandable in \indexdummies).
% The command has to be fully expandable (if the variable is set), since
% the result winds up in the index file.  This means that if the
% variable's value contains other Texinfo commands, it's almost certain
% it will fail (although perhaps we could fix that with sufficient work
% to do a one-level expansion on the result, instead of complete).
% 
% Unfortunately, this has the consequence that when _ is in the *value*
% of an @set, it does not print properly in the roman fonts (get the cmr
% dot accent at position 126 instead).  No fix comes to mind, and it's
% been this way since 2003 or earlier, so just ignore it.
% 
\def\expandablevalue#1{%
  \expandafter\ifx\csname SET#1\endcsname\relax
    {[No value for ``#1'']}%
    \message{Variable `#1', used in @value, is not set.}%
  \else
    \csname SET#1\endcsname
  \fi
}

% Like \expandablevalue, but completely expandable (the \message in the
% definition above operates at the execution level of TeX).  Used when
% writing to auxiliary files, due to the expansion that \write does.
% If flag is undefined, pass through an unexpanded @value command: maybe it 
% will be set by the time it is read back in.
%
% NB flag names containing - or _ may not work here.
\def\dummyvalue#1{%
  \expandafter\ifx\csname SET#1\endcsname\relax
    \noexpand\value{#1}%
  \else
    \csname SET#1\endcsname
  \fi
}

% Used for @value's in index entries to form the sort key: expand the @value
% if possible, otherwise sort late.
\def\indexnofontsvalue#1{%
  \expandafter\ifx\csname SET#1\endcsname\relax
    ZZZZZZZ
  \else
    \csname SET#1\endcsname
  \fi
}

% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
% with @set.
% 
% To get the special treatment we need for `@end ifset,' we call
% \makecond and then redefine.
%
\makecond{ifset}
\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
\def\doifset#1#2{%
  {%
    \makevalueexpandable
    \let\next=\empty
    \expandafter\ifx\csname SET#2\endcsname\relax
      #1% If not set, redefine \next.
    \fi
    \expandafter
  }\next
}
\def\ifsetfail{\doignore{ifset}}

% @ifclear VAR ... @end executes the `...' iff VAR has never been
% defined with @set, or has been undefined with @clear.
%
% The `\else' inside the `\doifset' parameter is a trick to reuse the
% above code: if the variable is not set, do nothing, if it is set,
% then redefine \next to \ifclearfail.
%
\makecond{ifclear}
\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
\def\ifclearfail{\doignore{ifclear}}

% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
% without the @) is in fact defined.  We can only feasibly check at the
% TeX level, so something like `mathcode' is going to considered
% defined even though it is not a Texinfo command.
% 
\makecond{ifcommanddefined}
\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
%
\def\doifcmddefined#1#2{{%
    \makevalueexpandable
    \let\next=\empty
    \expandafter\ifx\csname #2\endcsname\relax
      #1% If not defined, \let\next as above.
    \fi
    \expandafter
  }\next
}
\def\ifcmddefinedfail{\doignore{ifcommanddefined}}

% @ifcommandnotdefined CMD ... handled similar to @ifclear above.
\makecond{ifcommandnotdefined}
\def\ifcommandnotdefined{%
  \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}

% Set the `txicommandconditionals' variable, so documents have a way to
% test if the @ifcommand...defined conditionals are available.
\set txicommandconditionals

% @dircategory CATEGORY  -- specify a category of the dir file
% which this file should belong to.  Ignore this in TeX.
\let\dircategory=\comment

% @defininfoenclose.
\let\definfoenclose=\comment


\message{indexing,}
% Index generation facilities

% Define \newwrite to be identical to plain tex's \newwrite
% except not \outer, so it can be used within macros and \if's.
\edef\newwrite{\makecsname{ptexnewwrite}}

% \newindex {foo} defines an index named IX.
% It automatically defines \IXindex such that
% \IXindex ...rest of line... puts an entry in the index IX.
% It also defines \IXindfile to be the number of the output channel for
% the file that accumulates this index.  The file's extension is IX.
% The name of an index should be no more than 2 characters long
% for the sake of vms.
%
\def\newindex#1{%
  \expandafter\chardef\csname#1indfile\endcsname=0
  \expandafter\xdef\csname#1index\endcsname{%     % Define @#1index
    \noexpand\doindex{#1}}
}

% @defindex foo  ==  \newindex{foo}
%
\def\defindex{\parsearg\newindex}

% Define @defcodeindex, like @defindex except put all entries in @code.
%
\def\defcodeindex{\parsearg\newcodeindex}
%
\def\newcodeindex#1{%
  \expandafter\chardef\csname#1indfile\endcsname=0
  \expandafter\xdef\csname#1index\endcsname{%
    \noexpand\docodeindex{#1}}%
}

% The default indices:
\newindex{cp}%      concepts,
\newcodeindex{fn}%  functions,
\newcodeindex{vr}%  variables,
\newcodeindex{tp}%  types,
\newcodeindex{ky}%  keys
\newcodeindex{pg}%  and programs.


% @synindex foo bar    makes index foo feed into index bar.
% Do this instead of @defindex foo if you don't want it as a separate index.
%
% @syncodeindex foo bar   similar, but put all entries made for index foo
% inside @code.
%
\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}

% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
% #3 the target index (bar).
\def\dosynindex#1#2#3{%
  \requireopenindexfile{#3}%
  % redefine \fooindfile:
  \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  \expandafter\let\csname#2indfile\endcsname=\temp
  % redefine \fooindex:
  \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
}

% Define \doindex, the driver for all index macros.
% Argument #1 is generated by the calling \fooindex macro,
% and it is the two-letter name of the index.

\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
\def\doindexxxx #1{\doind{\indexname}{#1}}

% like the previous two, but they put @code around the argument.
\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}


% Used when writing an index entry out to an index file to prevent
% expansion of Texinfo commands that can appear in an index entry.
%
\def\indexdummies{%
  \escapechar = `\\     % use backslash in output files.
  \definedummyletter\@%
  \definedummyletter\ %
  %
  % For texindex which always views { and } as separators.
  \def\{{\lbracechar{}}%
  \def\}{\rbracechar{}}%
  %
  % Do the redefinitions.
  \definedummies
}

% Used for the aux and toc files, where @ is the escape character.
%
\def\atdummies{%
  \definedummyletter\@%
  \definedummyletter\ %
  \definedummyletter\{%
  \definedummyletter\}%
  %
  % Do the redefinitions.
  \definedummies
  \otherbackslash
}

% \definedummyword defines \#1 as \string\#1\space, thus effectively
% preventing its expansion.  This is used only for control words,
% not control letters, because the \space would be incorrect for
% control characters, but is needed to separate the control word
% from whatever follows.
%
% These can be used both for control words that take an argument and
% those that do not.  If it is followed by {arg} in the input, then
% that will dutifully get written to the index (or wherever).
%
% For control letters, we have \definedummyletter, which omits the
% space.
%
\def\definedummyword  #1{\def#1{\string#1\space}}%
\def\definedummyletter#1{\def#1{\string#1}}%
\let\definedummyaccent\definedummyletter

% Called from \indexdummies and \atdummies, to effectively prevent
% the expansion of commands.
%
\def\definedummies{%
  %
  \let\commondummyword\definedummyword
  \let\commondummyletter\definedummyletter
  \let\commondummyaccent\definedummyaccent
  \commondummiesnofonts
  %
  \definedummyletter\_%
  \definedummyletter\-%
  %
  % Non-English letters.
  \definedummyword\AA
  \definedummyword\AE
  \definedummyword\DH
  \definedummyword\L
  \definedummyword\O
  \definedummyword\OE
  \definedummyword\TH
  \definedummyword\aa
  \definedummyword\ae
  \definedummyword\dh
  \definedummyword\exclamdown
  \definedummyword\l
  \definedummyword\o
  \definedummyword\oe
  \definedummyword\ordf
  \definedummyword\ordm
  \definedummyword\questiondown
  \definedummyword\ss
  \definedummyword\th
  %
  % Although these internal commands shouldn't show up, sometimes they do.
  \definedummyword\bf
  \definedummyword\gtr
  \definedummyword\hat
  \definedummyword\less
  \definedummyword\sf
  \definedummyword\sl
  \definedummyword\tclose
  \definedummyword\tt
  %
  \definedummyword\LaTeX
  \definedummyword\TeX
  %
  % Assorted special characters.
  \definedummyword\atchar
  \definedummyword\arrow
  \definedummyword\bullet
  \definedummyword\comma
  \definedummyword\copyright
  \definedummyword\registeredsymbol
  \definedummyword\dots
  \definedummyword\enddots
  \definedummyword\entrybreak
  \definedummyword\equiv
  \definedummyword\error
  \definedummyword\euro
  \definedummyword\expansion
  \definedummyword\geq
  \definedummyword\guillemetleft
  \definedummyword\guillemetright
  \definedummyword\guilsinglleft
  \definedummyword\guilsinglright
  \definedummyword\lbracechar
  \definedummyword\leq
  \definedummyword\mathopsup
  \definedummyword\minus
  \definedummyword\ogonek
  \definedummyword\pounds
  \definedummyword\point
  \definedummyword\print
  \definedummyword\quotedblbase
  \definedummyword\quotedblleft
  \definedummyword\quotedblright
  \definedummyword\quoteleft
  \definedummyword\quoteright
  \definedummyword\quotesinglbase
  \definedummyword\rbracechar
  \definedummyword\result
  \definedummyword\sub
  \definedummyword\sup
  \definedummyword\textdegree
  %
  % We want to disable all macros so that they are not expanded by \write.
  \macrolist
  \let\value\dummyvalue
  %
  \normalturnoffactive
}

% \commondummiesnofonts: common to \definedummies and \indexnofonts.
% Define \commondummyletter, \commondummyaccent and \commondummyword before
% using.  Used for accents, font commands, and various control letters.
%
\def\commondummiesnofonts{%
  % Control letters and accents.
  \commondummyletter\!%
  \commondummyaccent\"%
  \commondummyaccent\'%
  \commondummyletter\*%
  \commondummyaccent\,%
  \commondummyletter\.%
  \commondummyletter\/%
  \commondummyletter\:%
  \commondummyaccent\=%
  \commondummyletter\?%
  \commondummyaccent\^%
  \commondummyaccent\`%
  \commondummyaccent\~%
  \commondummyword\u
  \commondummyword\v
  \commondummyword\H
  \commondummyword\dotaccent
  \commondummyword\ogonek
  \commondummyword\ringaccent
  \commondummyword\tieaccent
  \commondummyword\ubaraccent
  \commondummyword\udotaccent
  \commondummyword\dotless
  %
  % Texinfo font commands.
  \commondummyword\b
  \commondummyword\i
  \commondummyword\r
  \commondummyword\sansserif
  \commondummyword\sc
  \commondummyword\slanted
  \commondummyword\t
  %
  % Commands that take arguments.
  \commondummyword\abbr
  \commondummyword\acronym
  \commondummyword\anchor
  \commondummyword\cite
  \commondummyword\code
  \commondummyword\command
  \commondummyword\dfn
  \commondummyword\dmn
  \commondummyword\email
  \commondummyword\emph
  \commondummyword\env
  \commondummyword\file
  \commondummyword\image
  \commondummyword\indicateurl
  \commondummyword\inforef
  \commondummyword\kbd
  \commondummyword\key
  \commondummyword\math
  \commondummyword\option
  \commondummyword\pxref
  \commondummyword\ref
  \commondummyword\samp
  \commondummyword\strong
  \commondummyword\tie
  \commondummyword\U
  \commondummyword\uref
  \commondummyword\url
  \commondummyword\var
  \commondummyword\verb
  \commondummyword\w
  \commondummyword\xref
}

% For testing: output @{ and @} in index sort strings as \{ and \}.
\newif\ifusebracesinindexes

\let\indexlbrace\relax
\let\indexrbrace\relax

{\catcode`\@=0
\catcode`\\=13
  @gdef@backslashdisappear{@def\{}}
}

{
\catcode`\<=13
\catcode`\-=13
\catcode`\`=13
  \gdef\indexnonalnumdisappear{%
    \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
      % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
      % (Introduced for FSFS 2nd ed.)
      \let`=\empty
    \fi
    %
    \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
      \backslashdisappear
    \fi
    %
    \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
      \def-{}%
    \fi
    \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
      \def<{}%
    \fi
    \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
      \def\@{}%
    \fi
  }

  \gdef\indexnonalnumreappear{%
    \useindexbackslash
    \let-\normaldash
    \let<\normalless
    \def\@{@}%
  }
}


% \indexnofonts is used when outputting the strings to sort the index
% by, and when constructing control sequence names.  It eliminates all
% control sequences and just writes whatever the best ASCII sort string
% would be for a given command (usually its argument).
%
\def\indexnofonts{%
  % Accent commands should become @asis.
  \def\commondummyaccent##1{\let##1\asis}%
  % We can just ignore other control letters.
  \def\commondummyletter##1{\let##1\empty}%
  % All control words become @asis by default; overrides below.
  \let\commondummyword\commondummyaccent
  \commondummiesnofonts
  %
  % Don't no-op \tt, since it isn't a user-level command
  % and is used in the definitions of the active chars like <, >, |, etc.
  % Likewise with the other plain tex font commands.
  %\let\tt=\asis
  %
  \def\ { }%
  \def\@{@}%
  \def\_{\normalunderscore}%
  \def\-{}% @- shouldn't affect sorting
  %
  \uccode`\1=`\{ \uppercase{\def\{{1}}%
  \uccode`\1=`\} \uppercase{\def\}{1}}%
  \let\lbracechar\{%
  \let\rbracechar\}%
  %
  % Non-English letters.
  \def\AA{AA}%
  \def\AE{AE}%
  \def\DH{DZZ}%
  \def\L{L}%
  \def\OE{OE}%
  \def\O{O}%
  \def\TH{TH}%
  \def\aa{aa}%
  \def\ae{ae}%
  \def\dh{dzz}%
  \def\exclamdown{!}%
  \def\l{l}%
  \def\oe{oe}%
  \def\ordf{a}%
  \def\ordm{o}%
  \def\o{o}%
  \def\questiondown{?}%
  \def\ss{ss}%
  \def\th{th}%
  %
  \def\LaTeX{LaTeX}%
  \def\TeX{TeX}%
  %
  % Assorted special characters.  \defglyph gives the control sequence a
  % definition that removes the {} that follows its use.
  \defglyph\atchar{@}%
  \defglyph\arrow{->}%
  \defglyph\bullet{bullet}%
  \defglyph\comma{,}%
  \defglyph\copyright{copyright}%
  \defglyph\dots{...}%
  \defglyph\enddots{...}%
  \defglyph\equiv{==}%
  \defglyph\error{error}%
  \defglyph\euro{euro}%
  \defglyph\expansion{==>}%
  \defglyph\geq{>=}%
  \defglyph\guillemetleft{<<}%
  \defglyph\guillemetright{>>}%
  \defglyph\guilsinglleft{<}%
  \defglyph\guilsinglright{>}%
  \defglyph\leq{<=}%
  \defglyph\lbracechar{\{}%
  \defglyph\minus{-}%
  \defglyph\point{.}%
  \defglyph\pounds{pounds}%
  \defglyph\print{-|}%
  \defglyph\quotedblbase{"}%
  \defglyph\quotedblleft{"}%
  \defglyph\quotedblright{"}%
  \defglyph\quoteleft{`}%
  \defglyph\quoteright{'}%
  \defglyph\quotesinglbase{,}%
  \defglyph\rbracechar{\}}%
  \defglyph\registeredsymbol{R}%
  \defglyph\result{=>}%
  \defglyph\textdegree{o}%
  %
  % We need to get rid of all macros, leaving only the arguments (if present).
  % Of course this is not nearly correct, but it is the best we can do for now.
  % makeinfo does not expand macros in the argument to @deffn, which ends up
  % writing an index entry, and texindex isn't prepared for an index sort entry
  % that starts with \.
  %
  % Since macro invocations are followed by braces, we can just redefine them
  % to take a single TeX argument.  The case of a macro invocation that
  % goes to end-of-line is not handled.
  %
  \macrolist
  \let\value\indexnofontsvalue
}
\def\defglyph#1#2{\def#1##1{#2}} % see above




\let\SETmarginindex=\relax % put index entries in margin (undocumented)?

% Most index entries go through here, but \dosubind is the general case.
% #1 is the index name, #2 is the entry text.
\def\doind#1#2{\dosubind{#1}{#2}{}}

% There is also \dosubind {index}{topic}{subtopic}
% which makes an entry in a two-level index such as the operation index.
% TODO: Two-level index?  Operation index?

% Workhorse for all indexes.
% #1 is name of index, #2 is stuff to put there, #3 is subentry --
% empty if called from \doind, as we usually are (the main exception
% is with most defuns, which call us directly).
%
\def\dosubind#1#2#3{%
  \iflinks
  {%
    \requireopenindexfile{#1}%
    % Store the main index entry text (including the third arg).
    \toks0 = {#2}%
    % If third arg is present, precede it with a space.
    \def\thirdarg{#3}%
    \ifx\thirdarg\empty \else
      \toks0 = \expandafter{\the\toks0 \space #3}%
    \fi
    %
    \edef\writeto{\csname#1indfile\endcsname}%
    %
    \safewhatsit\dosubindwrite
  }%
  \fi
}

% Check if an index file has been opened, and if not, open it.
\def\requireopenindexfile#1{%
\ifnum\csname #1indfile\endcsname=0
  \expandafter\newwrite \csname#1indfile\endcsname
  \edef\suffix{#1}%
  % A .fls suffix would conflict with the file extension for the output
  % of -recorder, so use .f1s instead.
  \ifx\suffix\indexisfl\def\suffix{f1}\fi
  % Open the file
  \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
  % Using \immediate above here prevents an object entering into the current 
  % box, which could confound checks such as those in \safewhatsit for
  % preceding skips.
  \typeout{Writing index file \jobname.\suffix}%
\fi}
\def\indexisfl{fl}

% Output \ as {\indexbackslash}, because \ is an escape character in
% the index files.
\let\indexbackslash=\relax
{\catcode`\@=0 \catcode`\\=\active
  @gdef@useindexbackslash{@def\{{@indexbackslash}}}
}

% Definition for writing index entry text.
\def\sortas#1{\ignorespaces}%

% Definition for writing index entry sort key.  Should occur at the at
% the beginning of the index entry, like
%     @cindex @sortas{september} \september
% The \ignorespaces takes care of following space, but there's no way
% to remove space before it.
{
\catcode`\-=13
\gdef\indexwritesortas{%
  \begingroup
  \indexnonalnumreappear
  \indexwritesortasxxx}
\gdef\indexwritesortasxxx#1{%
  \xdef\indexsortkey{#1}\endgroup}
}


% Write the entry in \toks0 to the index file.
%
\def\dosubindwrite{%
  % Put the index entry in the margin if desired.
  \ifx\SETmarginindex\relax\else
    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
  \fi
  %
  % Remember, we are within a group.
  \indexdummies % Must do this here, since \bf, etc expand at this stage
  \useindexbackslash % \indexbackslash isn't defined now so it will be output 
                     % as is; and it will print as backslash.
  % The braces around \indexbrace are recognized by texindex.
  %
  % Get the string to sort by, by processing the index entry with all
  % font commands turned off.
  {\indexnofonts
   \def\lbracechar{{\indexlbrace}}%
   \def\rbracechar{{\indexrbrace}}%
   \let\{=\lbracechar
   \let\}=\rbracechar
   \indexnonalnumdisappear
   \xdef\indexsortkey{}%
   \let\sortas=\indexwritesortas
   \edef\temp{\the\toks0}%
   \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
   \ifx\indexsortkey\empty
     \xdef\indexsortkey{\temp}%
     \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
   \fi
  }%
  %
  % Set up the complete index entry, with both the sort key and
  % the original text, including any font commands.  We write
  % three arguments to \entry to the .?? file (four in the
  % subentry case), texindex reduces to two when writing the .??s
  % sorted result.
  \edef\temp{%
    \write\writeto{%
      \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
  }%
  \temp
}
\newbox\dummybox % used above

% Take care of unwanted page breaks/skips around a whatsit:
%
% If a skip is the last thing on the list now, preserve it
% by backing up by \lastskip, doing the \write, then inserting
% the skip again.  Otherwise, the whatsit generated by the
% \write or \pdfdest will make \lastskip zero.  The result is that
% sequences like this:
% @end defun
% @tindex whatever
% @defun ...
% will have extra space inserted, because the \medbreak in the
% start of the @defun won't see the skip inserted by the @end of
% the previous defun.
%
% But don't do any of this if we're not in vertical mode.  We
% don't want to do a \vskip and prematurely end a paragraph.
%
% Avoid page breaks due to these extra skips, too.
%
% But wait, there is a catch there:
% We'll have to check whether \lastskip is zero skip.  \ifdim is not
% sufficient for this purpose, as it ignores stretch and shrink parts
% of the skip.  The only way seems to be to check the textual
% representation of the skip.
%
% The following is almost like \def\zeroskipmacro{0.0pt} except that
% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
%
\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
%
\newskip\whatsitskip
\newcount\whatsitpenalty
%
% ..., ready, GO:
%
\def\safewhatsit#1{\ifhmode
  #1%
 \else
  % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
  \whatsitskip = \lastskip
  \edef\lastskipmacro{\the\lastskip}%
  \whatsitpenalty = \lastpenalty
  %
  % If \lastskip is nonzero, that means the last item was a
  % skip.  And since a skip is discardable, that means this
  % -\whatsitskip glue we're inserting is preceded by a
  % non-discardable item, therefore it is not a potential
  % breakpoint, therefore no \nobreak needed.
  \ifx\lastskipmacro\zeroskipmacro
  \else
    \vskip-\whatsitskip
  \fi
  %
  #1%
  %
  \ifx\lastskipmacro\zeroskipmacro
    % If \lastskip was zero, perhaps the last item was a penalty, and
    % perhaps it was >=10000, e.g., a \nobreak.  In that case, we want
    % to re-insert the same penalty (values >10000 are used for various
    % signals); since we just inserted a non-discardable item, any
    % following glue (such as a \parskip) would be a breakpoint.  For example:
    %   @deffn deffn-whatever
    %   @vindex index-whatever
    %   Description.
    % would allow a break between the index-whatever whatsit
    % and the "Description." paragraph.
    \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
  \else
    % On the other hand, if we had a nonzero \lastskip,
    % this make-up glue would be preceded by a non-discardable item
    % (the whatsit from the \write), so we must insert a \nobreak.
    \nobreak\vskip\whatsitskip
  \fi
\fi}

% The index entry written in the file actually looks like
%  \entry {sortstring}{page}{topic}
% or
%  \entry {sortstring}{page}{topic}{subtopic}
% The texindex program reads in these files and writes files
% containing these kinds of lines:
%  \initial {c}
%     before the first topic whose initial is c
%  \entry {topic}{pagelist}
%     for a topic that is used without subtopics
%  \primary {topic}
%     for the beginning of a topic that is used with subtopics
%  \secondary {subtopic}{pagelist}
%     for each subtopic.

% Define the user-accessible indexing commands
% @findex, @vindex, @kindex, @cindex.

\def\findex {\fnindex}
\def\kindex {\kyindex}
\def\cindex {\cpindex}
\def\vindex {\vrindex}
\def\tindex {\tpindex}
\def\pindex {\pgindex}

\def\cindexsub {\begingroup\obeylines\cindexsub}
{\obeylines %
\gdef\cindexsub "#1" #2^^M{\endgroup %
\dosubind{cp}{#2}{#1}}}

% Define the macros used in formatting output of the sorted index material.

% @printindex causes a particular index (the ??s file) to get printed.
% It does not print any chapter heading (usually an @unnumbered).
%
\parseargdef\printindex{\begingroup
  \dobreak \chapheadingskip{10000}%
  %
  \smallfonts \rm
  \tolerance = 9500
  \plainfrenchspacing
  \everypar = {}% don't want the \kern\-parindent from indentation suppression.
  %
  % See if the index file exists and is nonempty.
  % Change catcode of @ here so that if the index file contains
  % \initial {@}
  % as its first line, TeX doesn't complain about mismatched braces
  % (because it thinks @} is a control sequence).
  \catcode`\@ = 12
  % See comment in \requireopenindexfile.
  \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
  \openin 1 \jobname.\indexname s
  \ifeof 1
    % \enddoublecolumns gets confused if there is no text in the index,
    % and it loses the chapter title and the aux file entries for the
    % index.  The easiest way to prevent this problem is to make sure
    % there is some text.
    \putwordIndexNonexistent
    \typeout{No file \jobname.\indexname s.}%
  \else
    \catcode`\\ = 0
    %
    % If the index file exists but is empty, then \openin leaves \ifeof
    % false.  We have to make TeX try to read something from the file, so
    % it can discover if there is anything in it.
    \read 1 to \thisline
    \ifeof 1
      \putwordIndexIsEmpty
    \else
      % Index files are almost Texinfo source, but we use \ as the escape
      % character.  It would be better to use @, but that's too big a change
      % to make right now.
      \def\indexbackslash{\ttbackslash}%
      \let\indexlbrace\{   % Likewise, set these sequences for braces
      \let\indexrbrace\}   % used in the sort key.
      \begindoublecolumns
      \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
      %
      % Read input from the index file line by line.
      \loopdo
        \ifeof1 \else
          \read 1 to \nextline
        \fi
        %
        \indexinputprocessing
        \thisline
        %
        \ifeof1\else
        \let\thisline\nextline
      \repeat
      %%
      \enddoublecolumns
    \fi
  \fi
  \closein 1
\endgroup}
\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}

\def\indexinputprocessing{%
  \ifeof1
    \let\firsttoken\relax
  \else
    \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
    \act
  \fi
}
\def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
\long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}


% These macros are used by the sorted index file itself.
% Change them to control the appearance of the index.

{\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
\catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
\catcode`\$=3
\gdef\initialglyphs{%
  % Some changes for non-alphabetic characters.  Using the glyphs from the
  % math fonts looks more consistent than the typewriter font used elsewhere
  % for these characters.
  \def\indexbackslash{\math{\backslash}}%
  \let\\=\indexbackslash
  %
  % Can't get bold backslash so don't use bold forward slash
  \catcode`\/=13
  \def/{{\secrmnotbold \normalslash}}%
  \def-{{\normaldash\normaldash}}% en dash `--'
  \def^{{\chapbf \normalcaret}}%
  \def~{{\chapbf \normaltilde}}%
  \def\_{%
     \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
  \def|{$\vert$}%
  \def<{$\less$}%
  \def>{$\gtr$}%
  \def+{$\normalplus$}%
}}

\def\initial{%
  \bgroup
  \initialglyphs
  \initialx
}

\def\initialx#1{%
  % Remove any glue we may have, we'll be inserting our own.
  \removelastskip
  %
  % We like breaks before the index initials, so insert a bonus.
  % The glue before the bonus allows a little bit of space at the
  % bottom of a column to reduce an increase in inter-line spacing.
  \nobreak
  \vskip 0pt plus 5\baselineskip
  \penalty -300 
  \vskip 0pt plus -5\baselineskip
  %
  % Typeset the initial.  Making this add up to a whole number of
  % baselineskips increases the chance of the dots lining up from column
  % to column.  It still won't often be perfect, because of the stretch
  % we need before each entry, but it's better.
  %
  % No shrink because it confuses \balancecolumns.
  \vskip 1.67\baselineskip plus 1\baselineskip
  \leftline{\secfonts \kern-0.05em \secbf #1}%
  % \secfonts is inside the argument of \leftline so that the change of
  % \baselineskip will not affect any glue inserted before the vbox that
  % \leftline creates.
  % Do our best not to break after the initial.
  \nobreak
  \vskip .33\baselineskip plus .1\baselineskip
  \egroup % \initialglyphs
}

\newdimen\entryrightmargin
\entryrightmargin=0pt

% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
% then page number (#2) flushed to the right margin.  It is used for index
% and table of contents entries.  The paragraph is indented by \leftskip.
%
\def\entry{%
  \begingroup
    %
    % For pdfTeX and XeTeX.
    % The redefinition of \domark stops marks being added in \pdflink to 
    % preserve coloured links across page boundaries.  Otherwise the marks
    % would get in the way of \lastbox in \insertentrybox.
    \let\domark\relax
    %
    % Start a new paragraph if necessary, so our assignments below can't
    % affect previous text.
    \par
    %
    % No extra space above this paragraph.
    \parskip = 0in
    %
    % When reading the text of entry, convert explicit line breaks
    % from @* into spaces.  The user might give these in long section
    % titles, for instance.
    \def\*{\unskip\space\ignorespaces}%
    \def\entrybreak{\hfil\break}% An undocumented command
    %
    % Swallow the left brace of the text (first parameter):
    \afterassignment\doentry
    \let\temp =
}
\def\entrybreak{\unskip\space\ignorespaces}%
\def\doentry{%
    % Save the text of the entry
    \global\setbox\boxA=\hbox\bgroup
    \bgroup % Instead of the swallowed brace.
      \noindent
      \aftergroup\finishentry
      % And now comes the text of the entry.
      % Not absorbing as a macro argument reduces the chance of problems
      % with catcodes occurring.
}
{\catcode`\@=11
\gdef\finishentry#1{%
    \egroup % end box A
    \dimen@ = \wd\boxA % Length of text of entry
    \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
    % #1 is the page number.
    %
    % Get the width of the page numbers, and only use
    % leaders if they are present.
    \global\setbox\boxB = \hbox{#1}%
    \ifdim\wd\boxB = 0pt
      \null\nobreak\hfill\ %
    \else
      %
      \null\nobreak\indexdotfill % Have leaders before the page number.
      %
      \ifpdf
        \pdfgettoks#1.%
        \hskip\skip\thinshrinkable\the\toksA
      \else
        \ifx\XeTeXrevision\thisisundefined
          \hskip\skip\thinshrinkable #1%
        \else
          \pdfgettoks#1.%
          \hskip\skip\thinshrinkable\the\toksA
        \fi
      \fi
    \fi
    \egroup % end \boxA
    \ifdim\wd\boxB = 0pt
      \global\setbox\entrybox=\vbox{\unhbox\boxA}%
    \else
    \global\setbox\entrybox=\vbox\bgroup
      % We want the text of the entries to be aligned to the left, and the
      % page numbers to be aligned to the right.
      %
      \parindent = 0pt
      \advance\leftskip by 0pt plus 1fil
      \advance\leftskip by 0pt plus -1fill
      \rightskip = 0pt plus -1fil
      \advance\rightskip by 0pt plus 1fill
      % Cause last line, which could consist of page numbers on their own
      % if the list of page numbers is long, to be aligned to the right.
      \parfillskip=0pt plus -1fill
      %
      \advance\rightskip by \entryrightmargin
      % Determine how far we can stretch into the margin.
      % This allows, e.g., "Appendix H  GNU Free Documentation License" to
      % fit on one line in @letterpaper format.
      \ifdim\entryrightmargin>2.1em
        \dimen@i=2.1em
      \else
        \dimen@i=0em
      \fi
      \advance \parfillskip by 0pt minus 1\dimen@i
      %
      \dimen@ii = \hsize
      \advance\dimen@ii by -1\leftskip
      \advance\dimen@ii by -1\entryrightmargin
      \advance\dimen@ii by 1\dimen@i
      \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
      \ifdim\dimen@ > 0.8\dimen@ii   % due to long index text
        % Try to split the text roughly evenly.  \dimen@ will be the length of 
        % the first line.
        \dimen@ = 0.7\dimen@
        \dimen@ii = \hsize
        \ifnum\dimen@>\dimen@ii
          % If the entry is too long (for example, if it needs more than
          % two lines), use all the space in the first line.
          \dimen@ = \dimen@ii
        \fi
        \advance\leftskip by 0pt plus 1fill % ragged right
        \advance \dimen@ by 1\rightskip
        \parshape = 2 0pt \dimen@ 0em \dimen@ii
        % Ideally we'd add a finite glue at the end of the first line only,
        % instead of using \parshape with explicit line lengths, but TeX
        % doesn't seem to provide a way to do such a thing.
        %
        % Indent all lines but the first one.
        \advance\leftskip by 1em
        \advance\parindent by -1em
      \fi\fi
      \indent % start paragraph
      \unhbox\boxA
      %
      % Do not prefer a separate line ending with a hyphen to fewer lines.
      \finalhyphendemerits = 0
      %
      % Word spacing - no stretch
      \spaceskip=\fontdimen2\font minus \fontdimen4\font
      %
      \linepenalty=1000  % Discourage line breaks.
      \hyphenpenalty=5000  % Discourage hyphenation.
      %
      \par % format the paragraph
    \egroup % The \vbox
    \fi
  \endgroup
  \dotheinsertentrybox
}}

\newskip\thinshrinkable
\skip\thinshrinkable=.15em minus .15em

\newbox\entrybox
\def\insertentrybox{%
  \ourunvbox\entrybox
}

% default definition
\let\dotheinsertentrybox\insertentrybox

% Use \lastbox to take apart vbox box by box, and add each sub-box
% to the current vertical list.
\def\ourunvbox#1{%
\bgroup % for local binding of \delayedbox
  % Remove the last box from box #1
  \global\setbox#1=\vbox{%
    \unvbox#1%
    \unskip % remove any glue
    \unpenalty
    \global\setbox\interbox=\lastbox
  }%
  \setbox\delayedbox=\box\interbox
  \ifdim\ht#1=0pt\else
    \ourunvbox#1 % Repeat on what's left of the box
    \nobreak
  \fi
  \box\delayedbox
\egroup
}
\newbox\delayedbox
\newbox\interbox

% Used from \printindex.  \firsttoken should be the first token
% after the \entry.  If it's not another \entry, we are at the last
% line of a group of index entries, so insert a penalty to discourage
% widowed index entries.
\def\dotheinsertentryboxwithpenalty{%
  \ifx\firsttoken\isentry
  \else
    \penalty 9000
  \fi
  \insertentrybox
}
\def\isentry{\entry}%

% Like plain.tex's \dotfill, except uses up at least 1 em.
% The filll stretch here overpowers both the fil and fill stretch to push
% the page number to the right.
\def\indexdotfill{\cleaders
  \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}


\def\primary #1{\line{#1\hfil}}

\newskip\secondaryindent \secondaryindent=0.5cm
\def\secondary#1#2{{%
  \parfillskip=0in
  \parskip=0in
  \hangindent=1in
  \hangafter=1
  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  \ifpdf
    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  \else
    \ifx\XeTeXrevision\thisisundefined
      #2
    \else
      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
    \fi
  \fi
  \par
}}

% Define two-column mode, which we use to typeset indexes.
% Adapted from the TeXbook, page 416, which is to say,
% the manmac.tex format used to print the TeXbook itself.
\catcode`\@=11  % private names

\newbox\partialpage
\newdimen\doublecolumnhsize

% Use inside an output routine to save \topmark and \firstmark
\def\savemarks{%
  \global\savedtopmark=\expandafter{\topmark }%
  \global\savedfirstmark=\expandafter{\firstmark }%
}
\newtoks\savedtopmark
\newtoks\savedfirstmark

% Set \topmark and \firstmark for next time \output runs.
% Can't be run from withinside \output (because any material
% added while an output routine is active, including 
% penalties, is saved for after it finishes).  The page so far
% should be empty, otherwise what's on it will be thrown away.
\def\restoremarks{%
  \mark{\the\savedtopmark}%
  \bgroup\output = {%
    \setbox\dummybox=\box\PAGE
  }abc\eject\egroup
  % "abc" because output routine doesn't fire for a completely empty page.
  \mark{\the\savedfirstmark}%
}

\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  % If not much space left on page, start a new page.
  \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
  %
  % Grab any single-column material above us.
  \output = {%
    %
    % Here is a possibility not foreseen in manmac: if we accumulate a
    % whole lot of material, we might end up calling this \output
    % routine twice in a row (see the doublecol-lose test, which is
    % essentially a couple of indexes with @setchapternewpage off).  In
    % that case we just ship out what is in \partialpage with the normal
    % output routine.  Generally, \partialpage will be empty when this
    % runs and this will be a no-op.  See the indexspread.tex test case.
    \ifvoid\partialpage \else
      \onepageout{\pagecontents\partialpage}%
    \fi
    %
    \global\setbox\partialpage = \vbox{%
      % Unvbox the main output page.
      \unvbox\PAGE
      \kern-\topskip \kern\baselineskip
    }%
    \savemarks
  }%
  \eject % run that output routine to set \partialpage
  \restoremarks
  %
  % We recover the two marks that the last output routine saved in order
  % to propagate the information in marks added around a chapter heading,
  % which could be otherwise be lost by the time the final page is output.
  %
  %
  % Use the double-column output routine for subsequent pages.
  \output = {\doublecolumnout}%
  %
  % Change the page size parameters.  We could do this once outside this
  % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  % format, but then we repeat the same computation.  Repeating a couple
  % of assignments once per index is clearly meaningless for the
  % execution time, so we may as well do it in one place.
  %
  % First we halve the line length, less a little for the gutter between
  % the columns.  We compute the gutter based on the line length, so it
  % changes automatically with the paper format.  The magic constant
  % below is chosen so that the gutter has the same value (well, +-<1pt)
  % as it did when we hard-coded it.
  %
  % We put the result in a separate register, \doublecolumhsize, so we
  % can restore it in \pagesofar, after \hsize itself has (potentially)
  % been clobbered.
  %
  \doublecolumnhsize = \hsize
    \advance\doublecolumnhsize by -.04154\hsize
    \divide\doublecolumnhsize by 2
  \hsize = \doublecolumnhsize
  %
  % Double the \vsize as well.
  \advance\vsize by -\ht\partialpage
  \vsize = 2\vsize
  %
  % For the benefit of balancing columns
  \advance\baselineskip by 0pt plus 0.5pt
}

% The double-column output routine for all double-column pages except
% the last, which is done by \balancecolumns.
%
\def\doublecolumnout{%
  %
  \splittopskip=\topskip \splitmaxdepth=\maxdepth
  % Get the available space for the double columns -- the normal
  % (undoubled) page height minus any material left over from the
  % previous page.
  \dimen@ = \vsize
  \divide\dimen@ by 2
  %
  % box0 will be the left-hand column, box2 the right.
  \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
  \global\advance\vsize by 2\ht\partialpage
  \onepageout\pagesofar
  \unvbox\PAGE
  \penalty\outputpenalty
}
%
% Re-output the contents of the output page -- any previous material,
% followed by the two boxes we just split, in box0 and box2.
\def\pagesofar{%
  \unvbox\partialpage
  %
  \hsize = \doublecolumnhsize
  \wd0=\hsize \wd2=\hsize
  \hbox to\txipagewidth{\box0\hfil\box2}%
}


% Finished with with double columns.
\def\enddoublecolumns{%
  % The following penalty ensures that the page builder is exercised
  % _before_ we change the output routine.  This is necessary in the
  % following situation:
  %
  % The last section of the index consists only of a single entry.
  % Before this section, \pagetotal is less than \pagegoal, so no
  % break occurs before the last section starts.  However, the last
  % section, consisting of \initial and the single \entry, does not
  % fit on the page and has to be broken off.  Without the following
  % penalty the page builder will not be exercised until \eject
  % below, and by that time we'll already have changed the output
  % routine to the \balancecolumns version, so the next-to-last
  % double-column page will be processed with \balancecolumns, which
  % is wrong:  The two columns will go to the main vertical list, with
  % the broken-off section in the recent contributions.  As soon as
  % the output routine finishes, TeX starts reconsidering the page
  % break.  The two columns and the broken-off section both fit on the
  % page, because the two columns now take up only half of the page
  % goal.  When TeX sees \eject from below which follows the final
  % section, it invokes the new output routine that we've set after
  % \balancecolumns below; \onepageout will try to fit the two columns
  % and the final section into the vbox of \txipageheight (see
  % \pagebody), causing an overfull box.
  %
  % Note that glue won't work here, because glue does not exercise the
  % page builder, unlike penalties (see The TeXbook, pp. 280-281).
  \penalty0
  %
  \output = {%
    % Split the last of the double-column material.
    \savemarks
    \balancecolumns
  }%
  \eject % call the \output just set
  \ifdim\pagetotal=0pt
    % Having called \balancecolumns once, we do not
    % want to call it again.  Therefore, reset \output to its normal
    % definition right away.
    \global\output = {\onepageout{\pagecontents\PAGE}}%
    %
    \endgroup % started in \begindoublecolumns
    \restoremarks
    % Leave the double-column material on the current page, no automatic
    % page break.
    \box\balancedcolumns
    %
    % \pagegoal was set to the doubled \vsize above, since we restarted
    % the current page.  We're now back to normal single-column
    % typesetting, so reset \pagegoal to the normal \vsize.
    \global\vsize = \txipageheight %
    \pagegoal = \txipageheight %
  \else
    % We had some left-over material.  This might happen when \doublecolumnout
    % is called in \balancecolumns.  Try again.
    \expandafter\enddoublecolumns
  \fi
}
\newbox\balancedcolumns
\setbox\balancedcolumns=\vbox{shouldnt see this}%
%
% Only called for the last of the double column material.  \doublecolumnout 
% does the others.
\def\balancecolumns{%
  \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
  \dimen@ = \ht0
  \advance\dimen@ by \topskip
  \advance\dimen@ by-\baselineskip
  \ifdim\dimen@<5\baselineskip
    % Don't split a short final column in two.
    \setbox2=\vbox{}%
    \global\setbox\balancedcolumns=\vbox{\pagesofar}%
  \else
    \divide\dimen@ by 2 % target to split to
    \dimen@ii = \dimen@
    \splittopskip = \topskip
    % Loop until left column is at least as high as the right column.
    {%
      \vbadness = 10000
      \loop
        \global\setbox3 = \copy0
        \global\setbox1 = \vsplit3 to \dimen@
      \ifdim\ht1<\ht3
        \global\advance\dimen@ by 1pt
      \repeat
    }%
    % Now the left column is in box 1, and the right column in box 3.
    %
    % Check whether the left column has come out higher than the page itself.  
    % (Note that we have doubled \vsize for the double columns, so
    % the actual height of the page is 0.5\vsize).
    \ifdim2\ht1>\vsize
      % It appears that we have been called upon to balance too much material.
      % Output some of it with \doublecolumnout, leaving the rest on the page.
      \setbox\PAGE=\box0
      \doublecolumnout
    \else
      % Compare the heights of the two columns.
      \ifdim4\ht1>5\ht3
        % Column heights are too different, so don't make their bottoms
        % flush with each other.
        \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
        \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
      \else
        % Make column bottoms flush with each other.
        \setbox2=\vbox to\ht1{\unvbox3\unskip}%
        \setbox0=\vbox to\ht1{\unvbox1\unskip}%
      \fi
      \global\setbox\balancedcolumns=\vbox{\pagesofar}%
    \fi
  \fi
  %
}
\catcode`\@ = \other


\message{sectioning,}
% Chapters, sections, etc.

% Let's start with @part.
\outer\parseargdef\part{\partzzz{#1}}
\def\partzzz#1{%
  \chapoddpage
  \null
  \vskip.3\vsize  % move it down on the page a bit
  \begingroup
    \noindent \titlefonts\rm #1\par % the text
    \let\lastnode=\empty      % no node to associate with
    \writetocentry{part}{#1}{}% but put it in the toc
    \headingsoff              % no headline or footline on the part page
    % This outputs a mark at the end of the page that clears \thischapter
    % and \thissection, as is done in \startcontents.
    \let\pchapsepmacro\relax
    \chapmacro{}{Yomitfromtoc}{}%
    \chapoddpage
  \endgroup
}

% \unnumberedno is an oxymoron.  But we count the unnumbered
% sections so that we can refer to them unambiguously in the pdf
% outlines by their "section number".  We avoid collisions with chapter
% numbers by starting them at 10000.  (If a document ever has 10000
% chapters, we're in trouble anyway, I'm sure.)
\newcount\unnumberedno \unnumberedno = 10000
\newcount\chapno
\newcount\secno        \secno=0
\newcount\subsecno     \subsecno=0
\newcount\subsubsecno  \subsubsecno=0

% This counter is funny since it counts through charcodes of letters A, B, ...
\newcount\appendixno  \appendixno = `\@
%
% \def\appendixletter{\char\the\appendixno}
% We do the following ugly conditional instead of the above simple
% construct for the sake of pdftex, which needs the actual
% letter in the expansion, not just typeset.
%
\def\appendixletter{%
  \ifnum\appendixno=`A A%
  \else\ifnum\appendixno=`B B%
  \else\ifnum\appendixno=`C C%
  \else\ifnum\appendixno=`D D%
  \else\ifnum\appendixno=`E E%
  \else\ifnum\appendixno=`F F%
  \else\ifnum\appendixno=`G G%
  \else\ifnum\appendixno=`H H%
  \else\ifnum\appendixno=`I I%
  \else\ifnum\appendixno=`J J%
  \else\ifnum\appendixno=`K K%
  \else\ifnum\appendixno=`L L%
  \else\ifnum\appendixno=`M M%
  \else\ifnum\appendixno=`N N%
  \else\ifnum\appendixno=`O O%
  \else\ifnum\appendixno=`P P%
  \else\ifnum\appendixno=`Q Q%
  \else\ifnum\appendixno=`R R%
  \else\ifnum\appendixno=`S S%
  \else\ifnum\appendixno=`T T%
  \else\ifnum\appendixno=`U U%
  \else\ifnum\appendixno=`V V%
  \else\ifnum\appendixno=`W W%
  \else\ifnum\appendixno=`X X%
  \else\ifnum\appendixno=`Y Y%
  \else\ifnum\appendixno=`Z Z%
  % The \the is necessary, despite appearances, because \appendixletter is
  % expanded while writing the .toc file.  \char\appendixno is not
  % expandable, thus it is written literally, thus all appendixes come out
  % with the same letter (or @) in the toc without it.
  \else\char\the\appendixno
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}

% Each @chapter defines these (using marks) as the number+name, number
% and name of the chapter.  Page headings and footings can use
% these.  @section does likewise.
\def\thischapter{}
\def\thischapternum{}
\def\thischaptername{}
\def\thissection{}
\def\thissectionnum{}
\def\thissectionname{}

\newcount\absseclevel % used to calculate proper heading level
\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count

% @raisesections: treat @section as chapter, @subsection as section, etc.
\def\raisesections{\global\advance\secbase by -1}
\let\up=\raisesections % original BFox name

% @lowersections: treat @chapter as section, @section as subsection, etc.
\def\lowersections{\global\advance\secbase by 1}
\let\down=\lowersections % original BFox name

% we only have subsub.
\chardef\maxseclevel = 3
%
% A numbered section within an unnumbered changes to unnumbered too.
% To achieve this, remember the "biggest" unnum. sec. we are currently in:
\chardef\unnlevel = \maxseclevel
%
% Trace whether the current chapter is an appendix or not:
% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
\def\chapheadtype{N}

% Choose a heading macro
% #1 is heading type
% #2 is heading level
% #3 is text for heading
\def\genhead#1#2#3{%
  % Compute the abs. sec. level:
  \absseclevel=#2
  \advance\absseclevel by \secbase
  % Make sure \absseclevel doesn't fall outside the range:
  \ifnum \absseclevel < 0
    \absseclevel = 0
  \else
    \ifnum \absseclevel > 3
      \absseclevel = 3
    \fi
  \fi
  % The heading type:
  \def\headtype{#1}%
  \if \headtype U%
    \ifnum \absseclevel < \unnlevel
      \chardef\unnlevel = \absseclevel
    \fi
  \else
    % Check for appendix sections:
    \ifnum \absseclevel = 0
      \edef\chapheadtype{\headtype}%
    \else
      \if \headtype A\if \chapheadtype N%
	\errmessage{@appendix... within a non-appendix chapter}%
      \fi\fi
    \fi
    % Check for numbered within unnumbered:
    \ifnum \absseclevel > \unnlevel
      \def\headtype{U}%
    \else
      \chardef\unnlevel = 3
    \fi
  \fi
  % Now print the heading:
  \if \headtype U%
    \ifcase\absseclevel
	\unnumberedzzz{#3}%
    \or \unnumberedseczzz{#3}%
    \or \unnumberedsubseczzz{#3}%
    \or \unnumberedsubsubseczzz{#3}%
    \fi
  \else
    \if \headtype A%
      \ifcase\absseclevel
	  \appendixzzz{#3}%
      \or \appendixsectionzzz{#3}%
      \or \appendixsubseczzz{#3}%
      \or \appendixsubsubseczzz{#3}%
      \fi
    \else
      \ifcase\absseclevel
	  \chapterzzz{#3}%
      \or \seczzz{#3}%
      \or \numberedsubseczzz{#3}%
      \or \numberedsubsubseczzz{#3}%
      \fi
    \fi
  \fi
  \suppressfirstparagraphindent
}

% an interface:
\def\numhead{\genhead N}
\def\apphead{\genhead A}
\def\unnmhead{\genhead U}

% @chapter, @appendix, @unnumbered.  Increment top-level counter, reset
% all lower-level sectioning counters to zero.
%
% Also set \chaplevelprefix, which we prepend to @float sequence numbers
% (e.g., figures), q.v.  By default (before any chapter), that is empty.
\let\chaplevelprefix = \empty
%
\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
\def\chapterzzz#1{%
  % section resetting is \global in case the chapter is in a group, such
  % as an @include file.
  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
    \global\advance\chapno by 1
  %
  % Used for \float.
  \gdef\chaplevelprefix{\the\chapno.}%
  \resetallfloatnos
  %
  % \putwordChapter can contain complex things in translations.
  \toks0=\expandafter{\putwordChapter}%
  \message{\the\toks0 \space \the\chapno}%
  %
  % Write the actual heading.
  \chapmacro{#1}{Ynumbered}{\the\chapno}%
  %
  % So @section and the like are numbered underneath this chapter.
  \global\let\section = \numberedsec
  \global\let\subsection = \numberedsubsec
  \global\let\subsubsection = \numberedsubsubsec
}

\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
%
\def\appendixzzz#1{%
  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
    \global\advance\appendixno by 1
  \gdef\chaplevelprefix{\appendixletter.}%
  \resetallfloatnos
  %
  % \putwordAppendix can contain complex things in translations.
  \toks0=\expandafter{\putwordAppendix}%
  \message{\the\toks0 \space \appendixletter}%
  %
  \chapmacro{#1}{Yappendix}{\appendixletter}%
  %
  \global\let\section = \appendixsec
  \global\let\subsection = \appendixsubsec
  \global\let\subsubsection = \appendixsubsubsec
}

% normally unnmhead0 calls unnumberedzzz:
\outer\parseargdef\unnumbered{\unnmhead0{#1}}
\def\unnumberedzzz#1{%
  \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
    \global\advance\unnumberedno by 1
  %
  % Since an unnumbered has no number, no prefix for figures.
  \global\let\chaplevelprefix = \empty
  \resetallfloatnos
  %
  % This used to be simply \message{#1}, but TeX fully expands the
  % argument to \message.  Therefore, if #1 contained @-commands, TeX
  % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  % expanded @cite (which turns out to cause errors because \cite is meant
  % to be executed, not expanded).
  %
  % Anyway, we don't want the fully-expanded definition of @cite to appear
  % as a result of the \message, we just want `@cite' itself.  We use
  % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  % simply yielding the contents of <toks register>.  (We also do this for
  % the toc entries.)
  \toks0 = {#1}%
  \message{(\the\toks0)}%
  %
  \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
  %
  \global\let\section = \unnumberedsec
  \global\let\subsection = \unnumberedsubsec
  \global\let\subsubsection = \unnumberedsubsubsec
}

% @centerchap is like @unnumbered, but the heading is centered.
\outer\parseargdef\centerchap{%
  \let\centerparametersmaybe = \centerparameters
  \unnmhead0{#1}%
  \let\centerparametersmaybe = \relax
}

% @top is like @unnumbered.
\let\top\unnumbered

% Sections.
% 
\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
\def\seczzz#1{%
  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
  \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
}

% normally calls appendixsectionzzz:
\outer\parseargdef\appendixsection{\apphead1{#1}}
\def\appendixsectionzzz#1{%
  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
  \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
}
\let\appendixsec\appendixsection

% normally calls unnumberedseczzz:
\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
\def\unnumberedseczzz#1{%
  \global\subsecno=0 \global\subsubsecno=0  \global\advance\secno by 1
  \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
}

% Subsections.
% 
% normally calls numberedsubseczzz:
\outer\parseargdef\numberedsubsec{\numhead2{#1}}
\def\numberedsubseczzz#1{%
  \global\subsubsecno=0  \global\advance\subsecno by 1
  \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
}

% normally calls appendixsubseczzz:
\outer\parseargdef\appendixsubsec{\apphead2{#1}}
\def\appendixsubseczzz#1{%
  \global\subsubsecno=0  \global\advance\subsecno by 1
  \sectionheading{#1}{subsec}{Yappendix}%
                 {\appendixletter.\the\secno.\the\subsecno}%
}

% normally calls unnumberedsubseczzz:
\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
\def\unnumberedsubseczzz#1{%
  \global\subsubsecno=0  \global\advance\subsecno by 1
  \sectionheading{#1}{subsec}{Ynothing}%
                 {\the\unnumberedno.\the\secno.\the\subsecno}%
}

% Subsubsections.
% 
% normally numberedsubsubseczzz:
\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
\def\numberedsubsubseczzz#1{%
  \global\advance\subsubsecno by 1
  \sectionheading{#1}{subsubsec}{Ynumbered}%
                 {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
}

% normally appendixsubsubseczzz:
\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
\def\appendixsubsubseczzz#1{%
  \global\advance\subsubsecno by 1
  \sectionheading{#1}{subsubsec}{Yappendix}%
                 {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
}

% normally unnumberedsubsubseczzz:
\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
\def\unnumberedsubsubseczzz#1{%
  \global\advance\subsubsecno by 1
  \sectionheading{#1}{subsubsec}{Ynothing}%
                 {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
}

% These macros control what the section commands do, according
% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
% Define them by default for a numbered chapter.
\let\section = \numberedsec
\let\subsection = \numberedsubsec
\let\subsubsection = \numberedsubsubsec

% Define @majorheading, @heading and @subheading

\def\majorheading{%
  {\advance\chapheadingskip by 10pt \chapbreak }%
  \parsearg\chapheadingzzz
}

\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
\def\chapheadingzzz#1{%
  \vbox{\chapfonts \raggedtitlesettings #1\par}%
  \nobreak\bigskip \nobreak
  \suppressfirstparagraphindent
}

% @heading, @subheading, @subsubheading.
\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
  \suppressfirstparagraphindent}
\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
  \suppressfirstparagraphindent}
\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
  \suppressfirstparagraphindent}

% These macros generate a chapter, section, etc. heading only
% (including whitespace, linebreaking, etc. around it),
% given all the information in convenient, parsed form.

% Args are the skip and penalty (usually negative)
\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}

% Parameter controlling skip before chapter headings (if needed)
\newskip\chapheadingskip

% Define plain chapter starts, and page on/off switching for it.
\def\chapbreak{\dobreak \chapheadingskip {-4000}}

% Start a new page
\def\chappager{\par\vfill\supereject}

% \chapoddpage - start on an odd page for a new chapter
% Because \domark is called before \chapoddpage, the filler page will
% get the headings for the next chapter, which is wrong.  But we don't
% care -- we just disable all headings on the filler page.
\def\chapoddpage{%
  \chappager
  \ifodd\pageno \else
    \begingroup
      \headingsoff
      \null
      \chappager
    \endgroup
  \fi
}

\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}

\def\CHAPPAGoff{%
\global\let\contentsalignmacro = \chappager
\global\let\pchapsepmacro=\chapbreak
\global\let\pagealignmacro=\chappager}

\def\CHAPPAGon{%
\global\let\contentsalignmacro = \chappager
\global\let\pchapsepmacro=\chappager
\global\let\pagealignmacro=\chappager
\global\def\HEADINGSon{\HEADINGSsingle}}

\def\CHAPPAGodd{%
\global\let\contentsalignmacro = \chapoddpage
\global\let\pchapsepmacro=\chapoddpage
\global\let\pagealignmacro=\chapoddpage
\global\def\HEADINGSon{\HEADINGSdouble}}

\CHAPPAGon

% \chapmacro - Chapter opening.
%
% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
% Yappendix, Yomitfromtoc), #3 the chapter number.
% Not used for @heading series.
%
% To test against our argument.
\def\Ynothingkeyword{Ynothing}
\def\Yappendixkeyword{Yappendix}
\def\Yomitfromtockeyword{Yomitfromtoc}
%
\def\chapmacro#1#2#3{%
  \expandafter\ifx\thisenv\titlepage\else
    \checkenv{}% chapters, etc., should not start inside an environment.
  \fi
  % FIXME: \chapmacro is currently called from inside \titlepage when
  % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
  % this should probably be done by \sectionheading with an option to print
  % in chapter size.
  %
  % Insert the first mark before the heading break (see notes for \domark).
  \let\prevchapterdefs=\lastchapterdefs
  \let\prevsectiondefs=\lastsectiondefs
  \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
                        \gdef\thissection{}}%
  %
  \def\temptype{#2}%
  \ifx\temptype\Ynothingkeyword
    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
                          \gdef\thischapter{\thischaptername}}%
  \else\ifx\temptype\Yomitfromtockeyword
    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
                          \gdef\thischapter{}}%
  \else\ifx\temptype\Yappendixkeyword
    \toks0={#1}%
    \xdef\lastchapterdefs{%
      \gdef\noexpand\thischaptername{\the\toks0}%
      \gdef\noexpand\thischapternum{\appendixletter}%
      % \noexpand\putwordAppendix avoids expanding indigestible
      % commands in some of the translations.
      \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
                                 \noexpand\thischapternum:
                                 \noexpand\thischaptername}%
    }%
  \else
    \toks0={#1}%
    \xdef\lastchapterdefs{%
      \gdef\noexpand\thischaptername{\the\toks0}%
      \gdef\noexpand\thischapternum{\the\chapno}%
      % \noexpand\putwordChapter avoids expanding indigestible
      % commands in some of the translations.
      \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
                                 \noexpand\thischapternum:
                                 \noexpand\thischaptername}%
    }%
  \fi\fi\fi
  %
  % Output the mark.  Pass it through \safewhatsit, to take care of
  % the preceding space.
  \safewhatsit\domark
  %
  % Insert the chapter heading break.
  \pchapsepmacro
  %
  % Now the second mark, after the heading break.  No break points
  % between here and the heading.
  \let\prevchapterdefs=\lastchapterdefs
  \let\prevsectiondefs=\lastsectiondefs
  \domark
  %
  {%
    \chapfonts \rm
    \let\footnote=\errfootnoteheading % give better error message
    %
    % Have to define \lastsection before calling \donoderef, because the
    % xref code eventually uses it.  On the other hand, it has to be called
    % after \pchapsepmacro, or the headline will change too soon.
    \gdef\lastsection{#1}%
    %
    % Only insert the separating space if we have a chapter/appendix
    % number, and don't print the unnumbered ``number''.
    \ifx\temptype\Ynothingkeyword
      \setbox0 = \hbox{}%
      \def\toctype{unnchap}%
    \else\ifx\temptype\Yomitfromtockeyword
      \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
      \def\toctype{omit}%
    \else\ifx\temptype\Yappendixkeyword
      \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
      \def\toctype{app}%
    \else
      \setbox0 = \hbox{#3\enspace}%
      \def\toctype{numchap}%
    \fi\fi\fi
    %
    % Write the toc entry for this chapter.  Must come before the
    % \donoderef, because we include the current node name in the toc
    % entry, and \donoderef resets it to empty.
    \writetocentry{\toctype}{#1}{#3}%
    %
    % For pdftex, we have to write out the node definition (aka, make
    % the pdfdest) after any page break, but before the actual text has
    % been typeset.  If the destination for the pdf outline is after the
    % text, then jumping from the outline may wind up with the text not
    % being visible, for instance under high magnification.
    \donoderef{#2}%
    %
    % Typeset the actual heading.
    \nobreak % Avoid page breaks at the interline glue.
    \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
          \unhbox0 #1\par}%
  }%
  \nobreak\bigskip % no page break after a chapter title
  \nobreak
}

% @centerchap -- centered and unnumbered.
\let\centerparametersmaybe = \relax
\def\centerparameters{%
  \advance\rightskip by 3\rightskip
  \leftskip = \rightskip
  \parfillskip = 0pt
}


% Section titles.  These macros combine the section number parts and
% call the generic \sectionheading to do the printing.
%
\newskip\secheadingskip
\def\secheadingbreak{\dobreak \secheadingskip{-1000}}

% Subsection titles.
\newskip\subsecheadingskip
\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}

% Subsubsection titles.
\def\subsubsecheadingskip{\subsecheadingskip}
\def\subsubsecheadingbreak{\subsecheadingbreak}


% Print any size, any type, section title.
%
% #1 is the text of the title,
% #2 is the section level (sec/subsec/subsubsec),
% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
% #4 is the section number.
%
\def\seckeyword{sec}
%
\def\sectionheading#1#2#3#4{%
  {%
    \def\sectionlevel{#2}%
    \def\temptype{#3}%
    %
    % It is ok for the @heading series commands to appear inside an
    % environment (it's been historically allowed, though the logic is
    % dubious), but not the others.
    \ifx\temptype\Yomitfromtockeyword\else
      \checkenv{}% non-@*heading should not be in an environment.
    \fi
    \let\footnote=\errfootnoteheading
    %
    % Switch to the right set of fonts.
    \csname #2fonts\endcsname \rm
    %
    % Insert first mark before the heading break (see notes for \domark).
    \let\prevsectiondefs=\lastsectiondefs
    \ifx\temptype\Ynothingkeyword
      \ifx\sectionlevel\seckeyword
        \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
                              \gdef\thissection{\thissectionname}}%
      \fi
    \else\ifx\temptype\Yomitfromtockeyword
      % Don't redefine \thissection.
    \else\ifx\temptype\Yappendixkeyword
      \ifx\sectionlevel\seckeyword
        \toks0={#1}%
        \xdef\lastsectiondefs{%
          \gdef\noexpand\thissectionname{\the\toks0}%
          \gdef\noexpand\thissectionnum{#4}%
          % \noexpand\putwordSection avoids expanding indigestible
          % commands in some of the translations.
          \gdef\noexpand\thissection{\noexpand\putwordSection{}
                                     \noexpand\thissectionnum:
                                     \noexpand\thissectionname}%
        }%
      \fi
    \else
      \ifx\sectionlevel\seckeyword
        \toks0={#1}%
        \xdef\lastsectiondefs{%
          \gdef\noexpand\thissectionname{\the\toks0}%
          \gdef\noexpand\thissectionnum{#4}%
          % \noexpand\putwordSection avoids expanding indigestible
          % commands in some of the translations.
          \gdef\noexpand\thissection{\noexpand\putwordSection{}
                                     \noexpand\thissectionnum:
                                     \noexpand\thissectionname}%
        }%
      \fi
    \fi\fi\fi
    %
    % Go into vertical mode.  Usually we'll already be there, but we
    % don't want the following whatsit to end up in a preceding paragraph
    % if the document didn't happen to have a blank line.
    \par
    %
    % Output the mark.  Pass it through \safewhatsit, to take care of
    % the preceding space.
    \safewhatsit\domark
    %
    % Insert space above the heading.
    \csname #2headingbreak\endcsname
    %
    % Now the second mark, after the heading break.  No break points
    % between here and the heading.
    \global\let\prevsectiondefs=\lastsectiondefs
    \domark
    %
    % Only insert the space after the number if we have a section number.
    \ifx\temptype\Ynothingkeyword
      \setbox0 = \hbox{}%
      \def\toctype{unn}%
      \gdef\lastsection{#1}%
    \else\ifx\temptype\Yomitfromtockeyword
      % for @headings -- no section number, don't include in toc,
      % and don't redefine \lastsection.
      \setbox0 = \hbox{}%
      \def\toctype{omit}%
      \let\sectionlevel=\empty
    \else\ifx\temptype\Yappendixkeyword
      \setbox0 = \hbox{#4\enspace}%
      \def\toctype{app}%
      \gdef\lastsection{#1}%
    \else
      \setbox0 = \hbox{#4\enspace}%
      \def\toctype{num}%
      \gdef\lastsection{#1}%
    \fi\fi\fi
    %
    % Write the toc entry (before \donoderef).  See comments in \chapmacro.
    \writetocentry{\toctype\sectionlevel}{#1}{#4}%
    %
    % Write the node reference (= pdf destination for pdftex).
    % Again, see comments in \chapmacro.
    \donoderef{#3}%
    %
    % Interline glue will be inserted when the vbox is completed.
    % That glue will be a valid breakpoint for the page, since it'll be
    % preceded by a whatsit (usually from the \donoderef, or from the
    % \writetocentry if there was no node).  We don't want to allow that
    % break, since then the whatsits could end up on page n while the
    % section is on page n+1, thus toc/etc. are wrong.  Debian bug 276000.
    \nobreak
    %
    % Output the actual section heading.
    \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
          \hangindent=\wd0  % zero if no section number
          \unhbox0 #1}%
  }%
  % Add extra space after the heading -- half of whatever came above it.
  % Don't allow stretch, though.
  \kern .5 \csname #2headingskip\endcsname
  %
  % Do not let the kern be a potential breakpoint, as it would be if it
  % was followed by glue.
  \nobreak
  %
  % We'll almost certainly start a paragraph next, so don't let that
  % glue accumulate.  (Not a breakpoint because it's preceded by a
  % discardable item.)  However, when a paragraph is not started next
  % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
  % or the negative glue will cause weirdly wrong output, typically
  % obscuring the section heading with something else.
  \vskip-\parskip
  %
  % This is so the last item on the main vertical list is a known
  % \penalty > 10000, so \startdefun, etc., can recognize the situation
  % and do the needful.
  \penalty 10001
}


\message{toc,}
% Table of contents.
\newwrite\tocfile

% Write an entry to the toc file, opening it if necessary.
% Called from @chapter, etc.
%
% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
% We append the current node name (if any) and page number as additional
% arguments for the \{chap,sec,...}entry macros which will eventually
% read this.  The node name is used in the pdf outlines as the
% destination to jump to.
%
% We open the .toc file for writing here instead of at @setfilename (or
% any other fixed time) so that @contents can be anywhere in the document.
% But if #1 is `omit', then we don't do anything.  This is used for the
% table of contents chapter openings themselves.
%
\newif\iftocfileopened
\def\omitkeyword{omit}%
%
\def\writetocentry#1#2#3{%
  \edef\writetoctype{#1}%
  \ifx\writetoctype\omitkeyword \else
    \iftocfileopened\else
      \immediate\openout\tocfile = \jobname.toc
      \global\tocfileopenedtrue
    \fi
    %
    \iflinks
      {\atdummies
       \edef\temp{%
         \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
       \temp
      }%
    \fi
  \fi
  %
  % Tell \shipout to create a pdf destination on each page, if we're
  % writing pdf.  These are used in the table of contents.  We can't
  % just write one on every page because the title pages are numbered
  % 1 and 2 (the page numbers aren't printed), and so are the first
  % two pages of the document.  Thus, we'd have two destinations named
  % `1', and two named `2'.
  \ifpdf
    \global\pdfmakepagedesttrue
  \else
    \ifx\XeTeXrevision\thisisundefined
    \else
      \global\pdfmakepagedesttrue
    \fi
  \fi
}


% These characters do not print properly in the Computer Modern roman
% fonts, so we must take special care.  This is more or less redundant
% with the Texinfo input format setup at the end of this file.
%
\def\activecatcodes{%
  \catcode`\"=\active
  \catcode`\$=\active
  \catcode`\<=\active
  \catcode`\>=\active
  \catcode`\\=\active
  \catcode`\^=\active
  \catcode`\_=\active
  \catcode`\|=\active
  \catcode`\~=\active
}


% Read the toc file, which is essentially Texinfo input.
\def\readtocfile{%
  \setupdatafile
  \activecatcodes
  \input \tocreadfilename
}

\newskip\contentsrightmargin \contentsrightmargin=1in
\newcount\savepageno
\newcount\lastnegativepageno \lastnegativepageno = -1

% Prepare to read what we've written to \tocfile.
%
\def\startcontents#1{%
  % If @setchapternewpage on, and @headings double, the contents should
  % start on an odd page, unlike chapters.  Thus, we maintain
  % \contentsalignmacro in parallel with \pagealignmacro.
  % From: Torbjorn Granlund <tege@matematik.su.se>
  \contentsalignmacro
  \immediate\closeout\tocfile
  %
  % Don't need to put `Contents' or `Short Contents' in the headline.
  % It is abundantly clear what they are.
  \chapmacro{#1}{Yomitfromtoc}{}%
  %
  \savepageno = \pageno
  \begingroup                  % Set up to handle contents files properly.
    \raggedbottom              % Worry more about breakpoints than the bottom.
    \entryrightmargin=\contentsrightmargin % Don't use the full line length.
    %
    % Roman numerals for page numbers.
    \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
}

% redefined for the two-volume lispref.  We always output on
% \jobname.toc even if this is redefined.
%
\def\tocreadfilename{\jobname.toc}

% Normal (long) toc.
%
\def\contents{%
  \startcontents{\putwordTOC}%
    \openin 1 \tocreadfilename\space
    \ifeof 1 \else
      \readtocfile
    \fi
    \vfill \eject
    \contentsalignmacro % in case @setchapternewpage odd is in effect
    \ifeof 1 \else
      \pdfmakeoutlines
    \fi
    \closein 1
  \endgroup
  \lastnegativepageno = \pageno
  \global\pageno = \savepageno
}

% And just the chapters.
\def\summarycontents{%
  \startcontents{\putwordShortTOC}%
    %
    \let\partentry = \shortpartentry
    \let\numchapentry = \shortchapentry
    \let\appentry = \shortchapentry
    \let\unnchapentry = \shortunnchapentry
    % We want a true roman here for the page numbers.
    \secfonts
    \let\rm=\shortcontrm \let\bf=\shortcontbf
    \let\sl=\shortcontsl \let\tt=\shortconttt
    \rm
    \hyphenpenalty = 10000
    \advance\baselineskip by 1pt % Open it up a little.
    \def\numsecentry##1##2##3##4{}
    \let\appsecentry = \numsecentry
    \let\unnsecentry = \numsecentry
    \let\numsubsecentry = \numsecentry
    \let\appsubsecentry = \numsecentry
    \let\unnsubsecentry = \numsecentry
    \let\numsubsubsecentry = \numsecentry
    \let\appsubsubsecentry = \numsecentry
    \let\unnsubsubsecentry = \numsecentry
    \openin 1 \tocreadfilename\space
    \ifeof 1 \else
      \readtocfile
    \fi
    \closein 1
    \vfill \eject
    \contentsalignmacro % in case @setchapternewpage odd is in effect
  \endgroup
  \lastnegativepageno = \pageno
  \global\pageno = \savepageno
}
\let\shortcontents = \summarycontents

% Typeset the label for a chapter or appendix for the short contents.
% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
%
\def\shortchaplabel#1{%
  % This space should be enough, since a single number is .5em, and the
  % widest letter (M) is 1em, at least in the Computer Modern fonts.
  % But use \hss just in case.
  % (This space doesn't include the extra space that gets added after
  % the label; that gets put in by \shortchapentry above.)
  %
  % We'd like to right-justify chapter numbers, but that looks strange
  % with appendix letters.  And right-justifying numbers and
  % left-justifying letters looks strange when there is less than 10
  % chapters.  Have to read the whole toc once to know how many chapters
  % there are before deciding ...
  \hbox to 1em{#1\hss}%
}

% These macros generate individual entries in the table of contents.
% The first argument is the chapter or section name.
% The last argument is the page number.
% The arguments in between are the chapter number, section number, ...

% Parts, in the main contents.  Replace the part number, which doesn't
% exist, with an empty box.  Let's hope all the numbers have the same width.
% Also ignore the page number, which is conventionally not printed.
\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
\def\partentry#1#2#3#4{%
  % Add stretch and a bonus for breaking the page before the part heading.
  % This reduces the chance of the page being broken immediately after the
  % part heading, before a following chapter heading.
  \vskip 0pt plus 5\baselineskip
  \penalty-300
  \vskip 0pt plus -5\baselineskip
  \dochapentry{\numeralbox\labelspace#1}{}%
}
%
% Parts, in the short toc.
\def\shortpartentry#1#2#3#4{%
  \penalty-300
  \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
  \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
}

% Chapters, in the main contents.
\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}

% Chapters, in the short toc.
% See comments in \dochapentry re vbox and related settings.
\def\shortchapentry#1#2#3#4{%
  \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
}

% Appendices, in the main contents.
% Need the word Appendix, and a fixed-size box.
%
\def\appendixbox#1{%
  % We use M since it's probably the widest letter.
  \setbox0 = \hbox{\putwordAppendix{} M}%
  \hbox to \wd0{\putwordAppendix{} #1\hss}}
%
\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}

% Unnumbered chapters.
\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}

% Sections.
\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
\let\appsecentry=\numsecentry
\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}

% Subsections.
\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
\let\appsubsecentry=\numsubsecentry
\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}

% And subsubsections.
\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
\let\appsubsubsecentry=\numsubsubsecentry
\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}

% This parameter controls the indentation of the various levels.
% Same as \defaultparindent.
\newdimen\tocindent \tocindent = 15pt

% Now for the actual typesetting. In all these, #1 is the text and #2 is the
% page number.
%
% If the toc has to be broken over pages, we want it to be at chapters
% if at all possible; hence the \penalty.
\def\dochapentry#1#2{%
   \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
   \begingroup
     % Move the page numbers slightly to the right
     \advance\entryrightmargin by -0.05em
     \chapentryfonts
     \tocentry{#1}{\dopageno\bgroup#2\egroup}%
   \endgroup
   \nobreak\vskip .25\baselineskip plus.1\baselineskip
}

\def\dosecentry#1#2{\begingroup
  \secentryfonts \leftskip=\tocindent
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
\endgroup}

\def\dosubsecentry#1#2{\begingroup
  \subsecentryfonts \leftskip=2\tocindent
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
\endgroup}

\def\dosubsubsecentry#1#2{\begingroup
  \subsubsecentryfonts \leftskip=3\tocindent
  \tocentry{#1}{\dopageno\bgroup#2\egroup}%
\endgroup}

% We use the same \entry macro as for the index entries.
\let\tocentry = \entry

% Space between chapter (or whatever) number and the title.
\def\labelspace{\hskip1em \relax}

\def\dopageno#1{{\rm #1}}
\def\doshortpageno#1{{\rm #1}}

\def\chapentryfonts{\secfonts \rm}
\def\secentryfonts{\textfonts}
\def\subsecentryfonts{\textfonts}
\def\subsubsecentryfonts{\textfonts}


\message{environments,}
% @foo ... @end foo.

% @tex ... @end tex    escapes into raw TeX temporarily.
% One exception: @ is still an escape character, so that @end tex works.
% But \@ or @@ will get a plain @ character.

\envdef\tex{%
  \setupmarkupstyle{tex}%
  \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  \catcode `\%=14
  \catcode `\+=\other
  \catcode `\"=\other
  \catcode `\|=\other
  \catcode `\<=\other
  \catcode `\>=\other
  \catcode `\`=\other
  \catcode `\'=\other
  %
  % ' is active in math mode (mathcode"8000).  So reset it, and all our
  % other math active characters (just in case), to plain's definitions.
  \mathactive
  %
  % Inverse of the list at the beginning of the file.
  \let\b=\ptexb
  \let\bullet=\ptexbullet
  \let\c=\ptexc
  \let\,=\ptexcomma
  \let\.=\ptexdot
  \let\dots=\ptexdots
  \let\equiv=\ptexequiv
  \let\!=\ptexexclam
  \let\i=\ptexi
  \let\indent=\ptexindent
  \let\noindent=\ptexnoindent
  \let\{=\ptexlbrace
  \let\+=\tabalign
  \let\}=\ptexrbrace
  \let\/=\ptexslash
  \let\sp=\ptexsp
  \let\*=\ptexstar
  %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
  \let\t=\ptext
  \expandafter \let\csname top\endcsname=\ptextop  % we've made it outer
  \let\frenchspacing=\plainfrenchspacing
  %
  \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  \def\@{@}%
}
% There is no need to define \Etex.

% Define @lisp ... @end lisp.
% @lisp environment forms a group so it can rebind things,
% including the definition of @end lisp (which normally is erroneous).

% Amount to narrow the margins by for @lisp.
\newskip\lispnarrowing \lispnarrowing=0.4in

% This is the definition that ^^M gets inside @lisp, @example, and other
% such environments.  \null is better than a space, since it doesn't
% have any width.
\def\lisppar{\null\endgraf}

% This space is always present above and below environments.
\newskip\envskipamount \envskipamount = 0pt

% Make spacing and below environment symmetrical.  We use \parskip here
% to help in doing that, since in @example-like environments \parskip
% is reset to zero; thus the \afterenvbreak inserts no space -- but the
% start of the next paragraph will insert \parskip.
%
\def\aboveenvbreak{{%
  % =10000 instead of <10000 because of a special case in \itemzzz and
  % \sectionheading, q.v.
  \ifnum \lastpenalty=10000 \else
    \advance\envskipamount by \parskip
    \endgraf
    \ifdim\lastskip<\envskipamount
      \removelastskip
      \ifnum\lastpenalty<10000
        % Penalize breaking before the environment, because preceding text
        % often leads into it.
        \penalty100
      \fi
      \vskip\envskipamount
    \fi
  \fi
}}

\def\afterenvbreak{{%
  % =10000 instead of <10000 because of a special case in \itemzzz and
  % \sectionheading, q.v.
  \ifnum \lastpenalty=10000 \else
    \advance\envskipamount by \parskip
    \endgraf
    \ifdim\lastskip<\envskipamount
      \removelastskip
      % it's not a good place to break if the last penalty was \nobreak
      % or better ...
      \ifnum\lastpenalty<10000 \penalty-50 \fi
      \vskip\envskipamount
    \fi
  \fi
}}

% \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins; it will
% also clear it, so that its embedded environments do the narrowing again.
\let\nonarrowing=\relax

% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
% environment contents.
\font\circle=lcircle10
\newdimen\circthick
\newdimen\cartouter\newdimen\cartinner
\newskip\normbskip\newskip\normpskip\newskip\normlskip
\circthick=\fontdimen8\circle
%
\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
\def\ctr{{\hskip 6pt\circle\char'010}}
\def\cbl{{\circle\char'012\hskip -6pt}}
\def\cbr{{\hskip 6pt\circle\char'011}}
\def\carttop{\hbox to \cartouter{\hskip\lskip
        \ctl\leaders\hrule height\circthick\hfil\ctr
        \hskip\rskip}}
\def\cartbot{\hbox to \cartouter{\hskip\lskip
        \cbl\leaders\hrule height\circthick\hfil\cbr
        \hskip\rskip}}
%
\newskip\lskip\newskip\rskip

\envdef\cartouche{%
  \ifhmode\par\fi  % can't be in the midst of a paragraph.
  \startsavinginserts
  \lskip=\leftskip \rskip=\rightskip
  \leftskip=0pt\rightskip=0pt % we want these *outside*.
  \cartinner=\hsize \advance\cartinner by-\lskip
  \advance\cartinner by-\rskip
  \cartouter=\hsize
  \advance\cartouter by 18.4pt	% allow for 3pt kerns on either
				% side, and for 6pt waste from
				% each corner char, and rule thickness
  \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  %
  % If this cartouche directly follows a sectioning command, we need the
  % \parskip glue (backspaced over by default) or the cartouche can
  % collide with the section heading.
  \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
  %
  \setbox\groupbox=\vbox\bgroup
      \baselineskip=0pt\parskip=0pt\lineskip=0pt
      \carttop
      \hbox\bgroup
	  \hskip\lskip
	  \vrule\kern3pt
	  \vbox\bgroup
	      \kern3pt
	      \hsize=\cartinner
	      \baselineskip=\normbskip
	      \lineskip=\normlskip
	      \parskip=\normpskip
	      \vskip -\parskip
	      \comment % For explanation, see the end of def\group.
}
\def\Ecartouche{%
              \ifhmode\par\fi
	      \kern3pt
	  \egroup
	  \kern3pt\vrule
	  \hskip\rskip
      \egroup
      \cartbot
  \egroup
  \addgroupbox
  \checkinserts
}


% This macro is called at the beginning of all the @example variants,
% inside a group.
\newdimen\nonfillparindent
\def\nonfillstart{%
  \aboveenvbreak
  \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
  \sepspaces % Make spaces be word-separators rather than space tokens.
  \let\par = \lisppar % don't ignore blank lines
  \obeylines % each line of input is a line of output
  \parskip = 0pt
  % Turn off paragraph indentation but redefine \indent to emulate
  % the normal \indent.
  \nonfillparindent=\parindent
  \parindent = 0pt
  \let\indent\nonfillindent
  %
  \emergencystretch = 0pt % don't try to avoid overfull boxes
  \ifx\nonarrowing\relax
    \advance \leftskip by \lispnarrowing
    \exdentamount=\lispnarrowing
  \else
    \let\nonarrowing = \relax
  \fi
  \let\exdent=\nofillexdent
}

\begingroup
\obeyspaces
% We want to swallow spaces (but not other tokens) after the fake
% @indent in our nonfill-environments, where spaces are normally
% active and set to @tie, resulting in them not being ignored after
% @indent.
\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
\gdef\nonfillindentcheck{%
\ifx\temp %
\expandafter\nonfillindentgobble%
\else%
\leavevmode\nonfillindentbox%
\fi%
}%
\endgroup
\def\nonfillindentgobble#1{\nonfillindent}
\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}

% If you want all examples etc. small: @set dispenvsize small.
% If you want even small examples the full size: @set dispenvsize nosmall.
% This affects the following displayed environments:
%    @example, @display, @format, @lisp
%
\def\smallword{small}
\def\nosmallword{nosmall}
\let\SETdispenvsize\relax
\def\setnormaldispenv{%
  \ifx\SETdispenvsize\smallword
    % end paragraph for sake of leading, in case document has no blank
    % line.  This is redundant with what happens in \aboveenvbreak, but
    % we need to do it before changing the fonts, and it's inconvenient
    % to change the fonts afterward.
    \ifnum \lastpenalty=10000 \else \endgraf \fi
    \smallexamplefonts \rm
  \fi
}
\def\setsmalldispenv{%
  \ifx\SETdispenvsize\nosmallword
  \else
    \ifnum \lastpenalty=10000 \else \endgraf \fi
    \smallexamplefonts \rm
  \fi
}

% We often define two environments, @foo and @smallfoo.
% Let's do it in one command.  #1 is the env name, #2 the definition.
\def\makedispenvdef#1#2{%
  \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
  \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
  \expandafter\let\csname E#1\endcsname \afterenvbreak
  \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
}

% Define two environment synonyms (#1 and #2) for an environment.
\def\maketwodispenvdef#1#2#3{%
  \makedispenvdef{#1}{#3}%
  \makedispenvdef{#2}{#3}%
}
%
% @lisp: indented, narrowed, typewriter font;
% @example: same as @lisp.
%
% @smallexample and @smalllisp: use smaller fonts.
% Originally contributed by Pavel@xerox.
%
\maketwodispenvdef{lisp}{example}{%
  \nonfillstart
  \tt\setupmarkupstyle{example}%
  \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  \gobble % eat return
}
% @display/@smalldisplay: same as @lisp except keep current font.
%
\makedispenvdef{display}{%
  \nonfillstart
  \gobble
}

% @format/@smallformat: same as @display except don't narrow margins.
%
\makedispenvdef{format}{%
  \let\nonarrowing = t%
  \nonfillstart
  \gobble
}

% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
\envdef\flushleft{%
  \let\nonarrowing = t%
  \nonfillstart
  \gobble
}
\let\Eflushleft = \afterenvbreak

% @flushright.
%
\envdef\flushright{%
  \let\nonarrowing = t%
  \nonfillstart
  \advance\leftskip by 0pt plus 1fill\relax
  \gobble
}
\let\Eflushright = \afterenvbreak


% @raggedright does more-or-less normal line breaking but no right
% justification.  From plain.tex.  Don't stretch around special
% characters in urls in this environment, since the stretch at the right
% should be enough.
\envdef\raggedright{%
  \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
  \def\urefprestretchamount{0pt}%
  \def\urefpoststretchamount{0pt}%
}
\let\Eraggedright\par

\envdef\raggedleft{%
  \parindent=0pt \leftskip0pt plus2em
  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  \hbadness=10000 % Last line will usually be underfull, so turn off
                  % badness reporting.
}
\let\Eraggedleft\par

\envdef\raggedcenter{%
  \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
  \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  \hbadness=10000 % Last line will usually be underfull, so turn off
                  % badness reporting.
}
\let\Eraggedcenter\par


% @quotation does normal linebreaking (hence we can't use \nonfillstart)
% and narrows the margins.  We keep \parskip nonzero in general, since
% we're doing normal filling.  So, when using \aboveenvbreak and
% \afterenvbreak, temporarily make \parskip 0.
%
\makedispenvdef{quotation}{\quotationstart}
%
\def\quotationstart{%
  \indentedblockstart % same as \indentedblock, but increase right margin too.
  \ifx\nonarrowing\relax
    \advance\rightskip by \lispnarrowing
  \fi
  \parsearg\quotationlabel
}

% We have retained a nonzero parskip for the environment, since we're
% doing normal filling.
%
\def\Equotation{%
  \par
  \ifx\quotationauthor\thisisundefined\else
    % indent a bit.
    \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
  \fi
  {\parskip=0pt \afterenvbreak}%
}
\def\Esmallquotation{\Equotation}

% If we're given an argument, typeset it in bold with a colon after.
\def\quotationlabel#1{%
  \def\temp{#1}%
  \ifx\temp\empty \else
    {\bf #1: }%
  \fi
}

% @indentedblock is like @quotation, but indents only on the left and
% has no optional argument.
% 
\makedispenvdef{indentedblock}{\indentedblockstart}
%
\def\indentedblockstart{%
  {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  \parindent=0pt
  %
  % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  \ifx\nonarrowing\relax
    \advance\leftskip by \lispnarrowing
    \exdentamount = \lispnarrowing
  \else
    \let\nonarrowing = \relax
  \fi
}

% Keep a nonzero parskip for the environment, since we're doing normal filling.
%
\def\Eindentedblock{%
  \par
  {\parskip=0pt \afterenvbreak}%
}
\def\Esmallindentedblock{\Eindentedblock}


% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
% If we want to allow any <char> as delimiter,
% we need the curly braces so that makeinfo sees the @verb command, eg:
% `@verbx...x' would look like the '@verbx' command.  --janneke@gnu.org
%
% [Knuth]: Donald Ervin Knuth, 1996.  The TeXbook.
%
% [Knuth] p.344; only we need to do the other characters Texinfo sets
% active too.  Otherwise, they get lost as the first character on a
% verbatim line.
\def\dospecials{%
  \do\ \do\\\do\{\do\}\do\$\do\&%
  \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  \do\<\do\>\do\|\do\@\do+\do\"%
  % Don't do the quotes -- if we do, @set txicodequoteundirected and
  % @set txicodequotebacktick will not have effect on @verb and
  % @verbatim, and ?` and !` ligatures won't get disabled.
  %\do\`\do\'%
}
%
% [Knuth] p. 380
\def\uncatcodespecials{%
  \def\do##1{\catcode`##1=\other}\dospecials}
%
% Setup for the @verb command.
%
% Eight spaces for a tab
\begingroup
  \catcode`\^^I=\active
  \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
\endgroup
%
\def\setupverb{%
  \tt  % easiest (and conventionally used) font for verbatim
  \def\par{\leavevmode\endgraf}%
  \setupmarkupstyle{verb}%
  \tabeightspaces
  % Respect line breaks,
  % print special symbols as themselves, and
  % make each space count
  % must do in this order:
  \obeylines \uncatcodespecials \sepspaces
}

% Setup for the @verbatim environment
%
% Real tab expansion.
\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
%
% We typeset each line of the verbatim in an \hbox, so we can handle
% tabs.  The \global is in case the verbatim line starts with an accent,
% or some other command that starts with a begin-group.  Otherwise, the
% entire \verbbox would disappear at the corresponding end-group, before
% it is typeset.  Meanwhile, we can't have nested verbatim commands
% (can we?), so the \global won't be overwriting itself.
\newbox\verbbox
\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
%
\begingroup
  \catcode`\^^I=\active
  \gdef\tabexpand{%
    \catcode`\^^I=\active
    \def^^I{\leavevmode\egroup
      \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
      \divide\dimen\verbbox by\tabw
      \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
      \advance\dimen\verbbox by\tabw  % advance to next multiple of \tabw
      \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
    }%
  }
\endgroup

% start the verbatim environment.
\def\setupverbatim{%
  \let\nonarrowing = t%
  \nonfillstart
  \tt % easiest (and conventionally used) font for verbatim
  % The \leavevmode here is for blank lines.  Otherwise, we would
  % never \starttabox and the \egroup would end verbatim mode.
  \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
  \tabexpand
  \setupmarkupstyle{verbatim}%
  % Respect line breaks,
  % print special symbols as themselves, and
  % make each space count.
  % Must do in this order:
  \obeylines \uncatcodespecials \sepspaces
  \everypar{\starttabbox}%
}

% Do the @verb magic: verbatim text is quoted by unique
% delimiter characters.  Before first delimiter expect a
% right brace, after last delimiter expect closing brace:
%
%    \def\doverb'{'<char>#1<char>'}'{#1}
%
% [Knuth] p. 382; only eat outer {}
\begingroup
  \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
  \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
\endgroup
%
\def\verb{\begingroup\setupverb\doverb}
%
%
% Do the @verbatim magic: define the macro \doverbatim so that
% the (first) argument ends when '@end verbatim' is reached, ie:
%
%     \def\doverbatim#1@end verbatim{#1}
%
% For Texinfo it's a lot easier than for LaTeX,
% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
% we need not redefine '\', '{' and '}'.
%
% Inspired by LaTeX's verbatim command set [latex.ltx]
%
\begingroup
  \catcode`\ =\active
  \obeylines %
  % ignore everything up to the first ^^M, that's the newline at the end
  % of the @verbatim input line itself.  Otherwise we get an extra blank
  % line in the output.
  \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
  % We really want {...\end verbatim} in the body of the macro, but
  % without the active space; thus we have to use \xdef and \gobble.
\endgroup
%
\envdef\verbatim{%
    \setupverbatim\doverbatim
}
\let\Everbatim = \afterenvbreak


% @verbatiminclude FILE - insert text of file in verbatim environment.
%
\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
%
\def\doverbatiminclude#1{%
  {%
    \makevalueexpandable
    \setupverbatim
    \indexnofonts       % Allow `@@' and other weird things in file names.
    \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
    \input #1
    \afterenvbreak
  }%
}

% @copying ... @end copying.
% Save the text away for @insertcopying later.
%
% We save the uninterpreted tokens, rather than creating a box.
% Saving the text in a box would be much easier, but then all the
% typesetting commands (@smallbook, font changes, etc.) have to be done
% beforehand -- and a) we want @copying to be done first in the source
% file; b) letting users define the frontmatter in as flexible order as
% possible is desirable.
%
\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
%
\def\insertcopying{%
  \begingroup
    \parindent = 0pt  % paragraph indentation looks wrong on title page
    \scanexp\copyingtext
  \endgroup
}


\message{defuns,}
% @defun etc.

\newskip\defbodyindent \defbodyindent=.4in
\newskip\defargsindent \defargsindent=50pt
\newskip\deflastargmargin \deflastargmargin=18pt
\newcount\defunpenalty

% Start the processing of @deffn:
\def\startdefun{%
  \ifnum\lastpenalty<10000
    \medbreak
    \defunpenalty=10003 % Will keep this @deffn together with the
                        % following @def command, see below.
  \else
    % If there are two @def commands in a row, we'll have a \nobreak,
    % which is there to keep the function description together with its
    % header.  But if there's nothing but headers, we need to allow a
    % break somewhere.  Check specifically for penalty 10002, inserted
    % by \printdefunline, instead of 10000, since the sectioning
    % commands also insert a nobreak penalty, and we don't want to allow
    % a break between a section heading and a defun.
    %
    % As a further refinement, we avoid "club" headers by signalling
    % with penalty of 10003 after the very first @deffn in the
    % sequence (see above), and penalty of 10002 after any following
    % @def command.
    \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
    %
    % Similarly, after a section heading, do not allow a break.
    % But do insert the glue.
    \medskip  % preceded by discardable penalty, so not a breakpoint
  \fi
  %
  \parindent=0in
  \advance\leftskip by \defbodyindent
  \exdentamount=\defbodyindent
}

\def\dodefunx#1{%
  % First, check whether we are in the right environment:
  \checkenv#1%
  %
  % As above, allow line break if we have multiple x headers in a row.
  % It's not a great place, though.
  \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
  %
  % And now, it's time to reuse the body of the original defun:
  \expandafter\gobbledefun#1%
}
\def\gobbledefun#1\startdefun{}

% \printdefunline \deffnheader{text}
%
\def\printdefunline#1#2{%
  \begingroup
    % call \deffnheader:
    #1#2 \endheader
    % common ending:
    \interlinepenalty = 10000
    \advance\rightskip by 0pt plus 1fil\relax
    \endgraf
    \nobreak\vskip -\parskip
    \penalty\defunpenalty  % signal to \startdefun and \dodefunx
    % Some of the @defun-type tags do not enable magic parentheses,
    % rendering the following check redundant.  But we don't optimize.
    \checkparencounts
  \endgroup
}

\def\Edefun{\endgraf\medbreak}

% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
% the only thing remaining is to define \deffnheader.
%
\def\makedefun#1{%
  \expandafter\let\csname E#1\endcsname = \Edefun
  \edef\temp{\noexpand\domakedefun
    \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
  \temp
}

% \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
%
% Define \deffn and \deffnx, without parameters.
% \deffnheader has to be defined explicitly.
%
\def\domakedefun#1#2#3{%
  \envdef#1{%
    \startdefun
    \doingtypefnfalse    % distinguish typed functions from all else
    \parseargusing\activeparens{\printdefunline#3}%
  }%
  \def#2{\dodefunx#1}%
  \def#3%
}

\newif\ifdoingtypefn       % doing typed function?
\newif\ifrettypeownline    % typeset return type on its own line?

% @deftypefnnewline on|off says whether the return type of typed functions
% are printed on their own line.  This affects @deftypefn, @deftypefun,
% @deftypeop, and @deftypemethod.
% 
\parseargdef\deftypefnnewline{%
  \def\temp{#1}%
  \ifx\temp\onword
    \expandafter\let\csname SETtxideftypefnnl\endcsname
      = \empty
  \else\ifx\temp\offword
    \expandafter\let\csname SETtxideftypefnnl\endcsname
      = \relax
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @txideftypefnnl value `\temp',
                must be on|off}%
  \fi\fi
}

% Untyped functions:

% @deffn category name args
\makedefun{deffn}{\deffngeneral{}}

% @deffn category class name args
\makedefun{defop}#1 {\defopon{#1\ \putwordon}}

% \defopon {category on}class name args
\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }

% \deffngeneral {subind}category name args
%
\def\deffngeneral#1#2 #3 #4\endheader{%
  % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
  \dosubind{fn}{\code{#3}}{#1}%
  \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
}

% Typed functions:

% @deftypefn category type name args
\makedefun{deftypefn}{\deftypefngeneral{}}

% @deftypeop category class type name args
\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}

% \deftypeopon {category on}class type name args
\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }

% \deftypefngeneral {subind}category type name args
%
\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
  \dosubind{fn}{\code{#4}}{#1}%
  \doingtypefntrue
  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
}

% Typed variables:

% @deftypevr category type var args
\makedefun{deftypevr}{\deftypecvgeneral{}}

% @deftypecv category class type var args
\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}

% \deftypecvof {category of}class type var args
\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }

% \deftypecvgeneral {subind}category type var args
%
\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
  \dosubind{vr}{\code{#4}}{#1}%
  \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
}

% Untyped variables:

% @defvr category var args
\makedefun{defvr}#1 {\deftypevrheader{#1} {} }

% @defcv category class var args
\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}

% \defcvof {category of}class var args
\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }

% Types:

% @deftp category name args
\makedefun{deftp}#1 #2 #3\endheader{%
  \doind{tp}{\code{#2}}%
  \defname{#1}{}{#2}\defunargs{#3\unskip}%
}

% Remaining @defun-like shortcuts:
\makedefun{defun}{\deffnheader{\putwordDeffunc} }
\makedefun{defmac}{\deffnheader{\putwordDefmac} }
\makedefun{defspec}{\deffnheader{\putwordDefspec} }
\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
\makedefun{defvar}{\defvrheader{\putwordDefvar} }
\makedefun{defopt}{\defvrheader{\putwordDefopt} }
\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
\makedefun{defmethod}{\defopon\putwordMethodon}
\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}

% \defname, which formats the name of the @def (not the args).
% #1 is the category, such as "Function".
% #2 is the return type, if any.
% #3 is the function name.
%
% We are followed by (but not passed) the arguments, if any.
%
\def\defname#1#2#3{%
  \par
  % Get the values of \leftskip and \rightskip as they were outside the @def...
  \advance\leftskip by -\defbodyindent
  %
  % Determine if we are typesetting the return type of a typed function
  % on a line by itself.
  \rettypeownlinefalse
  \ifdoingtypefn  % doing a typed function specifically?
    % then check user option for putting return type on its own line:
    \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
      \rettypeownlinetrue
    \fi
  \fi
  %
  % How we'll format the category name.  Putting it in brackets helps
  % distinguish it from the body text that may end up on the next line
  % just below it.
  \def\temp{#1}%
  \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
  %
  % Figure out line sizes for the paragraph shape.  We'll always have at
  % least two.
  \tempnum = 2
  %
  % The first line needs space for \box0; but if \rightskip is nonzero,
  % we need only space for the part of \box0 which exceeds it:
  \dimen0=\hsize  \advance\dimen0 by -\wd0  \advance\dimen0 by \rightskip
  %
  % If doing a return type on its own line, we'll have another line.
  \ifrettypeownline
    \advance\tempnum by 1
    \def\maybeshapeline{0in \hsize}%
  \else
    \def\maybeshapeline{}%
  \fi
  %
  % The continuations:
  \dimen2=\hsize  \advance\dimen2 by -\defargsindent
  %
  % The final paragraph shape:
  \parshape \tempnum  0in \dimen0  \maybeshapeline  \defargsindent \dimen2
  %
  % Put the category name at the right margin.
  \noindent
  \hbox to 0pt{%
    \hfil\box0 \kern-\hsize
    % \hsize has to be shortened this way:
    \kern\leftskip
    % Intentionally do not respect \rightskip, since we need the space.
  }%
  %
  % Allow all lines to be underfull without complaint:
  \tolerance=10000 \hbadness=10000
  \exdentamount=\defbodyindent
  {%
    % defun fonts. We use typewriter by default (used to be bold) because:
    % . we're printing identifiers, they should be in tt in principle.
    % . in languages with many accents, such as Czech or French, it's
    %   common to leave accents off identifiers.  The result looks ok in
    %   tt, but exceedingly strange in rm.
    % . we don't want -- and --- to be treated as ligatures.
    % . this still does not fix the ?` and !` ligatures, but so far no
    %   one has made identifiers using them :).
    \df \tt
    \def\temp{#2}% text of the return type
    \ifx\temp\empty\else
      \tclose{\temp}% typeset the return type
      \ifrettypeownline
        % put return type on its own line; prohibit line break following:
        \hfil\vadjust{\nobreak}\break  
      \else
        \space  % type on same line, so just followed by a space
      \fi
    \fi           % no return type
    #3% output function name
  }%
  {\rm\enskip}% hskip 0.5 em of \rmfont
  %
  \boldbrax
  % arguments will be output next, if any.
}

% Print arguments in slanted roman (not ttsl), inconsistently with using
% tt for the name.  This is because literal text is sometimes needed in
% the argument list (groff manual), and ttsl and tt are not very
% distinguishable.  Prevent hyphenation at `-' chars.
%
\def\defunargs#1{%
  % use sl by default (not ttsl),
  % tt for the names.
  \df \sl \hyphenchar\font=0
  %
  % On the other hand, if an argument has two dashes (for instance), we
  % want a way to get ttsl.  We used to recommend @var for that, so
  % leave the code in, but it's strange for @var to lead to typewriter.
  % Nowadays we recommend @code, since the difference between a ttsl hyphen
  % and a tt hyphen is pretty tiny.  @code also disables ?` !`.
  \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
  #1%
  \sl\hyphenchar\font=45
}

% We want ()&[] to print specially on the defun line.
%
\def\activeparens{%
  \catcode`\(=\active \catcode`\)=\active
  \catcode`\[=\active \catcode`\]=\active
  \catcode`\&=\active
}

% Make control sequences which act like normal parenthesis chars.
\let\lparen = ( \let\rparen = )

% Be sure that we always have a definition for `(', etc.  For example,
% if the fn name has parens in it, \boldbrax will not be in effect yet,
% so TeX would otherwise complain about undefined control sequence.
{
  \activeparens
  \global\let(=\lparen \global\let)=\rparen
  \global\let[=\lbrack \global\let]=\rbrack
  \global\let& = \&

  \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  \gdef\magicamp{\let&=\amprm}
}

\newcount\parencount

% If we encounter &foo, then turn on ()-hacking afterwards
\newif\ifampseen
\def\amprm#1 {\ampseentrue{\bf\&#1 }}

\def\parenfont{%
  \ifampseen
    % At the first level, print parens in roman,
    % otherwise use the default font.
    \ifnum \parencount=1 \rm \fi
  \else
    % The \sf parens (in \boldbrax) actually are a little bolder than
    % the contained text.  This is especially needed for [ and ] .
    \sf
  \fi
}
\def\infirstlevel#1{%
  \ifampseen
    \ifnum\parencount=1
      #1%
    \fi
  \fi
}
\def\bfafterword#1 {#1 \bf}

\def\opnr{%
  \global\advance\parencount by 1
  {\parenfont(}%
  \infirstlevel \bfafterword
}
\def\clnr{%
  {\parenfont)}%
  \infirstlevel \sl
  \global\advance\parencount by -1
}

\newcount\brackcount
\def\lbrb{%
  \global\advance\brackcount by 1
  {\bf[}%
}
\def\rbrb{%
  {\bf]}%
  \global\advance\brackcount by -1
}

\def\checkparencounts{%
  \ifnum\parencount=0 \else \badparencount \fi
  \ifnum\brackcount=0 \else \badbrackcount \fi
}
% these should not use \errmessage; the glibc manual, at least, actually
% has such constructs (when documenting function pointers).
\def\badparencount{%
  \message{Warning: unbalanced parentheses in @def...}%
  \global\parencount=0
}
\def\badbrackcount{%
  \message{Warning: unbalanced square brackets in @def...}%
  \global\brackcount=0
}


\message{macros,}
% @macro.

% To do this right we need a feature of e-TeX, \scantokens,
% which we arrange to emulate with a temporary file in ordinary TeX.
\ifx\eTeXversion\thisisundefined
  \newwrite\macscribble
  \def\scantokens#1{%
    \toks0={#1}%
    \immediate\openout\macscribble=\jobname.tmp
    \immediate\write\macscribble{\the\toks0}%
    \immediate\closeout\macscribble
    \input \jobname.tmp
  }
\fi

% alias because \c means cedilla in @tex or @math
\let\texinfoc=\c

\newcount\savedcatcodeone
\newcount\savedcatcodetwo

% Used at the time of macro expansion.
% Argument is macro body with arguments substituted
\def\scanmacro#1{%
  \newlinechar`\^^M
  \def\xeatspaces{\eatspaces}%
  %
  % Temporarily undo catcode changes of \printindex.  Set catcode of @ to
  % 0 so that @-commands in macro expansions aren't printed literally when 
  % formatting an index file, where \ is used as the escape character.
  \savedcatcodeone=\catcode`\@
  \savedcatcodetwo=\catcode`\\
  \catcode`\@=0
  \catcode`\\=\active
  %
  % Process the macro body under the current catcode regime.
  \scantokens{#1@texinfoc}%
  %
  \catcode`\@=\savedcatcodeone
  \catcode`\\=\savedcatcodetwo
  %
  % The \texinfoc is to remove the \newlinechar added by \scantokens, and
  % can be noticed by \parsearg.
  %   We avoid surrounding the call to \scantokens with \bgroup and \egroup
  % to allow macros to open or close groups themselves.
}

% Used for copying and captions
\def\scanexp#1{%
  \expandafter\scanmacro\expandafter{#1}%
}

\newcount\paramno   % Count of parameters
\newtoks\macname    % Macro name
\newif\ifrecursive  % Is it recursive?

% List of all defined macros in the form
%    \commondummyword\macro1\commondummyword\macro2...
% Currently is also contains all @aliases; the list can be split
% if there is a need.
\def\macrolist{}

% Add the macro to \macrolist
\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
\def\addtomacrolistxxx#1{%
     \toks0 = \expandafter{\macrolist\commondummyword#1}%
     \xdef\macrolist{\the\toks0}%
}

% Utility routines.
% This does \let #1 = #2, with \csnames; that is,
%   \let \csname#1\endcsname = \csname#2\endcsname
% (except of course we have to play expansion games).
%
\def\cslet#1#2{%
  \expandafter\let
  \csname#1\expandafter\endcsname
  \csname#2\endcsname
}

% Trim leading and trailing spaces off a string.
% Concepts from aro-bend problem 15 (see CTAN).
{\catcode`\@=11
\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
\def\unbrace#1{#1}
\unbrace{\gdef\trim@@@ #1 } #2@{#1}
}

% Trim a single trailing ^^M off a string.
{\catcode`\^^M=\other \catcode`\Q=3%
\gdef\eatcr #1{\eatcra #1Q^^MQ}%
\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
\gdef\eatcrb#1Q#2Q{#1}%
}

% Macro bodies are absorbed as an argument in a context where
% all characters are catcode 10, 11 or 12, except \ which is active
% (as in normal texinfo). It is necessary to change the definition of \
% to recognize macro arguments; this is the job of \mbodybackslash.
%
% Non-ASCII encodings make 8-bit characters active, so un-activate
% them to avoid their expansion.  Must do this non-globally, to
% confine the change to the current group.
%
% It's necessary to have hard CRs when the macro is executed. This is
% done by making ^^M (\endlinechar) catcode 12 when reading the macro
% body, and then making it the \newlinechar in \scanmacro.
%
\def\scanctxt{% used as subroutine
  \catcode`\"=\other
  \catcode`\+=\other
  \catcode`\<=\other
  \catcode`\>=\other
  \catcode`\^=\other
  \catcode`\_=\other
  \catcode`\|=\other
  \catcode`\~=\other
  \passthroughcharstrue
}

\def\scanargctxt{% used for copying and captions, not macros.
  \scanctxt
  \catcode`\@=\other
  \catcode`\\=\other
  \catcode`\^^M=\other
}

\def\macrobodyctxt{% used for @macro definitions
  \scanctxt
  \catcode`\ =\other
  \catcode`\@=\other
  \catcode`\{=\other
  \catcode`\}=\other
  \catcode`\^^M=\other
  \usembodybackslash
}

% Used when scanning braced macro arguments.  Note, however, that catcode
% changes here are ineffectual if the macro invocation was nested inside
% an argument to another Texinfo command.
\def\macroargctxt{%
  \scanctxt
  \catcode`\ =\active
  \catcode`\^^M=\other
  \catcode`\\=\active
}

\def\macrolineargctxt{% used for whole-line arguments without braces
  \scanctxt
  \catcode`\{=\other
  \catcode`\}=\other
}

% \mbodybackslash is the definition of \ in @macro bodies.
% It maps \foo\ => \csname macarg.foo\endcsname => #N
% where N is the macro parameter number.
% We define \csname macarg.\endcsname to be \realbackslash, so
% \\ in macro replacement text gets you a backslash.
%
{\catcode`@=0 @catcode`@\=@active
 @gdef@usembodybackslash{@let\=@mbodybackslash}
 @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
}
\expandafter\def\csname macarg.\endcsname{\realbackslash}

\def\margbackslash#1{\char`\#1 }

\def\macro{\recursivefalse\parsearg\macroxxx}
\def\rmacro{\recursivetrue\parsearg\macroxxx}

\def\macroxxx#1{%
  \getargs{#1}% now \macname is the macname and \argl the arglist
  \ifx\argl\empty       % no arguments
     \paramno=0\relax
  \else
     \expandafter\parsemargdef \argl;%
     \if\paramno>256\relax
       \ifx\eTeXversion\thisisundefined
         \errhelp = \EMsimple
         \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
       \fi
     \fi
  \fi
  \if1\csname ismacro.\the\macname\endcsname
     \message{Warning: redefining \the\macname}%
  \else
     \expandafter\ifx\csname \the\macname\endcsname \relax
     \else \errmessage{Macro name \the\macname\space already defined}\fi
     \global\cslet{macsave.\the\macname}{\the\macname}%
     \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
     \addtomacrolist{\the\macname}%
  \fi
  \begingroup \macrobodyctxt
  \ifrecursive \expandafter\parsermacbody
  \else \expandafter\parsemacbody
  \fi}

\parseargdef\unmacro{%
  \if1\csname ismacro.#1\endcsname
    \global\cslet{#1}{macsave.#1}%
    \global\expandafter\let \csname ismacro.#1\endcsname=0%
    % Remove the macro name from \macrolist:
    \begingroup
      \expandafter\let\csname#1\endcsname \relax
      \let\commondummyword\unmacrodo
      \xdef\macrolist{\macrolist}%
    \endgroup
  \else
    \errmessage{Macro #1 not defined}%
  \fi
}

% Called by \do from \dounmacro on each macro.  The idea is to omit any
% macro definitions that have been changed to \relax.
%
\def\unmacrodo#1{%
  \ifx #1\relax
    % remove this
  \else
    \noexpand\commondummyword \noexpand#1%
  \fi
}

% \getargs -- Parse the arguments to a @macro line.  Set \macname to
% the name of the macro, and \argl to the braced argument list.
\def\getargs#1{\getargsxxx#1{}}
\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
\def\getmacname#1 #2\relax{\macname={#1}}
\def\getmacargs#1{\def\argl{#1}}
% This made use of the feature that if the last token of a
% <parameter list> is #, then the preceding argument is delimited by
% an opening brace, and that opening brace is not consumed.

% Parse the optional {params} list to @macro or @rmacro.
% Set \paramno to the number of arguments,
% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
% three-param macro.)  Define \macarg.BLAH for each BLAH in the params
% list to some hook where the argument is to be expanded.  If there are
% less than 10 arguments that hook is to be replaced by ##N where N
% is the position in that list, that is to say the macro arguments are to be
% defined `a la TeX in the macro body.  
%
% That gets used by \mbodybackslash (above).
%
% If there are 10 or more arguments, a different technique is used: see
% \parsemmanyargdef.
%
\def\parsemargdef#1;{%
  \paramno=0\def\paramlist{}%
  \let\hash\relax
  % \hash is redefined to `#' later to get it into definitions
  \let\xeatspaces\relax
  \parsemargdefxxx#1,;,%
  \ifnum\paramno<10\relax\else
    \paramno0\relax
    \parsemmanyargdef@@#1,;,% 10 or more arguments
  \fi
}
\def\parsemargdefxxx#1,{%
  \if#1;\let\next=\relax
  \else \let\next=\parsemargdefxxx
    \advance\paramno by 1
    \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
        {\xeatspaces{\hash\the\paramno}}%
    \edef\paramlist{\paramlist\hash\the\paramno,}%
  \fi\next}

% \parsemacbody, \parsermacbody
%
% Read recursive and nonrecursive macro bodies. (They're different since
% rec and nonrec macros end differently.)
% 
% We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro 
% body to be transformed.
% Set \macrobody to the body of the macro, and call \defmacro.
%
{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
\xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%

% Make @ a letter, so that we can make private-to-Texinfo macro names.
\edef\texiatcatcode{\the\catcode`\@}
\catcode `@=11\relax

%%%%%%%%%%%%%% Code for > 10 arguments only   %%%%%%%%%%%%%%%%%%

% If there are 10 or more arguments, a different technique is used, where the
% hook remains in the body, and when macro is to be expanded the body is
% processed again to replace the arguments.
%
% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
% argument N value and then \edef the body (nothing else will expand because of
% the catcode regime under which the body was input).
%
% If you compile with TeX (not eTeX), and you have macros with 10 or more
% arguments, no macro can have more than 256 arguments (else error).
%
% In case that there are 10 or more arguments we parse again the arguments
% list to set new definitions for the \macarg.BLAH macros corresponding to
% each BLAH argument. It was anyhow needed to parse already once this list
% in order to count the arguments, and as macros with at most 9 arguments
% are by far more frequent than macro with 10 or more arguments, defining
% twice the \macarg.BLAH macros does not cost too much processing power.
\def\parsemmanyargdef@@#1,{%
  \if#1;\let\next=\relax
  \else 
    \let\next=\parsemmanyargdef@@
    \edef\tempb{\eatspaces{#1}}%
    \expandafter\def\expandafter\tempa
       \expandafter{\csname macarg.\tempb\endcsname}%
    % Note that we need some extra \noexpand\noexpand, this is because we
    % don't want \the  to be expanded in the \parsermacbody  as it uses an
    % \xdef .
    \expandafter\edef\tempa
      {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
    \advance\paramno by 1\relax
  \fi\next}


\let\endargs@\relax
\let\nil@\relax
\def\nilm@{\nil@}%
\long\def\nillm@{\nil@}%

% This macro is expanded during the Texinfo macro expansion, not during its
% definition.  It gets all the arguments' values and assigns them to macros
% macarg.ARGNAME
%
% #1 is the macro name
% #2 is the list of argument names
% #3 is the list of argument values
\def\getargvals@#1#2#3{%
  \def\macargdeflist@{}%
  \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
  \def\paramlist{#2,\nil@}%
  \def\macroname{#1}%
  \begingroup
  \macroargctxt
  \def\argvaluelist{#3,\nil@}%
  \def\@tempa{#3}%
  \ifx\@tempa\empty
    \setemptyargvalues@
  \else
    \getargvals@@
  \fi
}
\def\getargvals@@{%
  \ifx\paramlist\nilm@
      % Some sanity check needed here that \argvaluelist is also empty.
      \ifx\argvaluelist\nillm@
      \else
        \errhelp = \EMsimple
        \errmessage{Too many arguments in macro `\macroname'!}%
      \fi
      \let\next\macargexpandinbody@
  \else
    \ifx\argvaluelist\nillm@
       % No more arguments values passed to macro.  Set remaining named-arg
       % macros to empty.
       \let\next\setemptyargvalues@
    \else
      % pop current arg name into \@tempb
      \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
      \expandafter\@tempa\expandafter{\paramlist}%
       % pop current argument value into \@tempc
      \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
      \expandafter\@tempa\expandafter{\argvaluelist}%
       % Here \@tempb is the current arg name and \@tempc is the current arg value.
       % First place the new argument macro definition into \@tempd
       \expandafter\macname\expandafter{\@tempc}%
       \expandafter\let\csname macarg.\@tempb\endcsname\relax
       \expandafter\def\expandafter\@tempe\expandafter{%
         \csname macarg.\@tempb\endcsname}%
       \edef\@tempd{\long\def\@tempe{\the\macname}}%
       \push@\@tempd\macargdeflist@
       \let\next\getargvals@@
    \fi
  \fi
  \next
}

\def\push@#1#2{%
  \expandafter\expandafter\expandafter\def
  \expandafter\expandafter\expandafter#2%
  \expandafter\expandafter\expandafter{%
  \expandafter#1#2}%
}

% Replace arguments by their values in the macro body, and place the result
% in macro \@tempa.
% 
\def\macvalstoargs@{%
  %  To do this we use the property that token registers that are \the'ed
  % within an \edef  expand only once. So we are going to place all argument
  % values into respective token registers.
  %
  % First we save the token context, and initialize argument numbering.
  \begingroup
    \paramno0\relax
    % Then, for each argument number #N, we place the corresponding argument
    % value into a new token list register \toks#N
    \expandafter\putargsintokens@\saveparamlist@,;,%
    % Then, we expand the body so that argument are replaced by their
    % values. The trick for values not to be expanded themselves is that they
    % are within tokens and that tokens expand only once in an \edef .
    \edef\@tempc{\csname mac.\macroname .body\endcsname}%
    % Now we restore the token stack pointer to free the token list registers
    % which we have used, but we make sure that expanded body is saved after
    % group.
    \expandafter
  \endgroup
  \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
  }

% Define the named-macro outside of this group and then close this group. 
% 
\def\macargexpandinbody@{% 
  \expandafter
  \endgroup
  \macargdeflist@
  % First the replace in body the macro arguments by their values, the result
  % is in \@tempa .
  \macvalstoargs@
  % Then we point at the \norecurse or \gobble (for recursive) macro value
  % with \@tempb .
  \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
  % Depending on whether it is recursive or not, we need some tailing
  % \egroup .
  \ifx\@tempb\gobble
     \let\@tempc\relax
  \else
     \let\@tempc\egroup
  \fi
  % And now we do the real job:
  \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
  \@tempd
}

\def\putargsintokens@#1,{%
  \if#1;\let\next\relax
  \else
    \let\next\putargsintokens@
    % First we allocate the new token list register, and give it a temporary
    % alias \@tempb .
    \toksdef\@tempb\the\paramno
    % Then we place the argument value into that token list register.
    \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
    \expandafter\@tempb\expandafter{\@tempa}%
    \advance\paramno by 1\relax
  \fi
  \next
}

% Trailing missing arguments are set to empty.
% 
\def\setemptyargvalues@{%
  \ifx\paramlist\nilm@
    \let\next\macargexpandinbody@
  \else
    \expandafter\setemptyargvaluesparser@\paramlist\endargs@
    \let\next\setemptyargvalues@
  \fi
  \next
}

\def\setemptyargvaluesparser@#1,#2\endargs@{%
  \expandafter\def\expandafter\@tempa\expandafter{%
    \expandafter\def\csname macarg.#1\endcsname{}}%
  \push@\@tempa\macargdeflist@
  \def\paramlist{#2}%
}

% #1 is the element target macro
% #2 is the list macro
% #3,#4\endargs@ is the list value
\def\pop@#1#2#3,#4\endargs@{%
   \def#1{#3}%
   \def#2{#4}%
}
\long\def\longpop@#1#2#3,#4\endargs@{%
   \long\def#1{#3}%
   \long\def#2{#4}%
}


%%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%


% This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
%    \macrobody has the body of the macro in it, with placeholders for
% its parameters, looking like "\xeatspaces{\hash 1}".
%    \paramno is the number of parameters
%    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
% There are four cases: macros of zero, one, up to nine, and many arguments.
% \xdef is used so that macro definitions will survive the file
% they're defined in: @include reads the file inside a group.
%
\def\defmacro{%
  \let\hash=##% convert placeholders to macro parameter chars
  \ifnum\paramno=1
    \def\xeatspaces##1{##1}%
    % This removes the pair of braces around the argument.  We don't
    % use \eatspaces, because this can cause ends of lines to be lost
    % when the argument to \eatspaces is read, leading to line-based
    % commands like "@itemize" not being read correctly.
  \else
    \let\xeatspaces\relax % suppress expansion
  \fi
  \ifcase\paramno
  % 0
    \expandafter\xdef\csname\the\macname\endcsname{%
      \bgroup
        \noexpand\spaceisspace
        \noexpand\endlineisspace
        \noexpand\expandafter % skip any whitespace after the macro name.
        \expandafter\noexpand\csname\the\macname @@@\endcsname}%
    \expandafter\xdef\csname\the\macname @@@\endcsname{%
      \egroup
      \noexpand\scanmacro{\macrobody}}%
  \or % 1
    \expandafter\xdef\csname\the\macname\endcsname{%
       \bgroup
       \noexpand\braceorline
       \expandafter\noexpand\csname\the\macname @@@\endcsname}%
    \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
      \egroup
      \noexpand\scanmacro{\macrobody}%
      }%
  \else % at most 9
    \ifnum\paramno<10\relax
      % @MACNAME sets the context for reading the macro argument
      % @MACNAME@@ gets the argument, processes backslashes and appends a 
      % comma.
      % @MACNAME@@@ removes braces surrounding the argument list.
      % @MACNAME@@@@ scans the macro body with arguments substituted.
      \expandafter\xdef\csname\the\macname\endcsname{%
        \bgroup
        \noexpand\expandafter  % This \expandafter skip any spaces after the
        \noexpand\macroargctxt % macro before we change the catcode of space.
        \noexpand\expandafter
        \expandafter\noexpand\csname\the\macname @@\endcsname}%
      \expandafter\xdef\csname\the\macname @@\endcsname##1{%
          \noexpand\passargtomacro
          \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
      \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
          \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
      \expandafter\expandafter
      \expandafter\xdef
      \expandafter\expandafter
        \csname\the\macname @@@@\endcsname\paramlist{%
          \egroup\noexpand\scanmacro{\macrobody}}%
    \else % 10 or more:
      \expandafter\xdef\csname\the\macname\endcsname{%
        \noexpand\getargvals@{\the\macname}{\argl}%
      }%
      \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
      \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
    \fi
  \fi}

\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes

\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
{\catcode`\@=0 \catcode`\\=13  % We need to manipulate \ so use @ as escape
@catcode`@_=11  % private names
@catcode`@!=11  % used as argument separator

% \passargtomacro#1#2 -
% Call #1 with a list of tokens #2, with any doubled backslashes in #2
% compressed to one.
%
% This implementation works by expansion, and not execution (so we cannot use 
% \def or similar).  This reduces the risk of this failing in contexts where 
% complete expansion is done with no execution (for example, in writing out to 
% an auxiliary file for an index entry).
% 
% State is kept in the input stream: the argument passed to
% @look_ahead, @gobble_and_check_finish and @add_segment is
%
% THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN  (... rest of input)
%
% where:
% THE_MACRO - name of the macro we want to call
% ARG_RESULT - argument list we build to pass to that macro
% PENDING_BS - either a backslash or nothing
% NEXT_TOKEN - used to look ahead in the input stream to see what's coming next

@gdef@passargtomacro#1#2{%
  @add_segment #1!{}@relax#2\@_finish\%
}
@gdef@_finish{@_finishx} @global@let@_finishx@relax

% #1 - THE_MACRO ARG_RESULT
% #2 - PENDING_BS
% #3 - NEXT_TOKEN
% #4 used to look ahead
%
% If the next token is not a backslash, process the rest of the argument; 
% otherwise, remove the next token.
@gdef@look_ahead#1!#2#3#4{%
  @ifx#4\%
   @expandafter@gobble_and_check_finish 
  @else
   @expandafter@add_segment
  @fi#1!{#2}#4#4%
}

% #1 - THE_MACRO ARG_RESULT
% #2 - PENDING_BS
% #3 - NEXT_TOKEN
% #4 should be a backslash, which is gobbled.
% #5 looks ahead
%
% Double backslash found.  Add a single backslash, and look ahead.
@gdef@gobble_and_check_finish#1!#2#3#4#5{%
  @add_segment#1\!{}#5#5%
}

@gdef@is_fi{@fi}

% #1 - THE_MACRO ARG_RESULT
% #2 - PENDING_BS
% #3 - NEXT_TOKEN
% #4 is input stream until next backslash
%
% Input stream is either at the start of the argument, or just after a 
% backslash sequence, either a lone backslash, or a doubled backslash.  
% NEXT_TOKEN contains the first token in the input stream: if it is \finish, 
% finish; otherwise, append to ARG_RESULT the segment of the argument up until
% the next backslash.  PENDING_BACKSLASH contains a backslash to represent
% a backslash just before the start of the input stream that has not been
% added to ARG_RESULT.
@gdef@add_segment#1!#2#3#4\{%
@ifx#3@_finish
  @call_the_macro#1!%
@else
  % append the pending backslash to the result, followed by the next segment
  @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
  % this @fi is discarded by @look_ahead.
  % we can't get rid of it with \expandafter because we don't know how 
  % long #4 is.
}

% #1 - THE_MACRO
% #2 - ARG_RESULT
% #3 discards the res of the conditional in @add_segment, and @is_fi ends the 
% conditional.
@gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}

}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% \braceorline MAC is used for a one-argument macro MAC.  It checks
% whether the next non-whitespace character is a {.  It sets the context
% for reading the argument (slightly different in the two cases).  Then,
% to read the argument, in the whole-line case, it then calls the regular
% \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
% 
\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
\def\braceorlinexxx{%
  \ifx\nchar\bgroup
    \macroargctxt
    \expandafter\passargtomacro
  \else
    \macrolineargctxt\expandafter\parsearg
  \fi \macnamexxx}


% @alias.
% We need some trickery to remove the optional spaces around the equal
% sign.  Make them active and then expand them all to nothing.
%
\def\alias{\parseargusing\obeyspaces\aliasxxx}
\def\aliasxxx #1{\aliasyyy#1\relax}
\def\aliasyyy #1=#2\relax{%
  {%
    \expandafter\let\obeyedspace=\empty
    \addtomacrolist{#1}%
    \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
  }%
  \next
}


\message{cross references,}

\newwrite\auxfile
\newif\ifhavexrefs    % True if xref values are known.
\newif\ifwarnedxrefs  % True if we warned once that they aren't known.

% @inforef is relatively simple.
\def\inforef #1{\inforefzzz #1,,,,**}
\def\inforefzzz #1,#2,#3,#4**{%
  \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  node \samp{\ignorespaces#1{}}}

% @node's only job in TeX is to define \lastnode, which is used in
% cross-references.  The @node line might or might not have commas, and
% might or might not have spaces before the first comma, like:
% @node foo , bar , ...
% We don't want such trailing spaces in the node name.
%
\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
%
% also remove a trailing comma, in case of something like this:
% @node Help-Cross,  ,  , Cross-refs
\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}

\let\nwnode=\node
\let\lastnode=\empty

% Write a cross-reference definition for the current node.  #1 is the
% type (Ynumbered, Yappendix, Ynothing).
%
\def\donoderef#1{%
  \ifx\lastnode\empty\else
    \setref{\lastnode}{#1}%
    \global\let\lastnode=\empty
  \fi
}

% @anchor{NAME} -- define xref target at arbitrary point.
%
\newcount\savesfregister
%
\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}

% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
% anchor), which consists of three parts:
% 1) NAME-title - the current sectioning name taken from \lastsection,
%                 or the anchor name.
% 2) NAME-snt   - section number and type, passed as the SNT arg, or
%                 empty for anchors.
% 3) NAME-pg    - the page number.
%
% This is called from \donoderef, \anchor, and \dofloat.  In the case of
% floats, there is an additional part, which is not written here:
% 4) NAME-lof   - the text as it should appear in a @listoffloats.
%
\def\setref#1#2{%
  \pdfmkdest{#1}%
  \iflinks
    {%
      \requireauxfile
      \atdummies  % preserve commands, but don't expand them
      % match definition in \xrdef, \refx, \xrefX.
      \def\value##1{##1}%
      \edef\writexrdef##1##2{%
	\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
	  ##1}{##2}}% these are parameters of \writexrdef
      }%
      \toks0 = \expandafter{\lastsection}%
      \immediate \writexrdef{title}{\the\toks0 }%
      \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
      \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
    }%
  \fi
}

% @xrefautosectiontitle on|off says whether @section(ing) names are used
% automatically in xrefs, if the third arg is not explicitly specified.
% This was provided as a "secret" @set xref-automatic-section-title
% variable, now it's official.
% 
\parseargdef\xrefautomaticsectiontitle{%
  \def\temp{#1}%
  \ifx\temp\onword
    \expandafter\let\csname SETxref-automatic-section-title\endcsname
      = \empty
  \else\ifx\temp\offword
    \expandafter\let\csname SETxref-automatic-section-title\endcsname
      = \relax
  \else
    \errhelp = \EMsimple
    \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
                must be on|off}%
  \fi\fi
}

% 
% @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
% the node name, #2 the name of the Info cross-reference, #3 the printed
% node name, #4 the name of the Info file, #5 the name of the printed
% manual.  All but the node name can be omitted.
%
\def\pxref{\putwordsee{} \xrefXX}
\def\xref{\putwordSee{} \xrefXX}
\def\ref{\xrefXX}

\def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
\def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
%
\newbox\toprefbox
\newbox\printedrefnamebox
\newbox\infofilenamebox
\newbox\printedmanualbox
%
\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  \unsepspaces
  %
  % Get args without leading/trailing spaces.
  \def\printedrefname{\ignorespaces #3}%
  \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
  %
  \def\infofilename{\ignorespaces #4}%
  \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
  %
  \def\printedmanual{\ignorespaces #5}%
  \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
  %
  % If the printed reference name (arg #3) was not explicitly given in
  % the @xref, figure out what we want to use.
  \ifdim \wd\printedrefnamebox = 0pt
    % No printed node name was explicitly given.
    \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
      % Not auto section-title: use node name inside the square brackets.
      \def\printedrefname{\ignorespaces #1}%
    \else
      % Auto section-title: use chapter/section title inside
      % the square brackets if we have it.
      \ifdim \wd\printedmanualbox > 0pt
        % It is in another manual, so we don't have it; use node name.
        \def\printedrefname{\ignorespaces #1}%
      \else
        \ifhavexrefs
          % We (should) know the real title if we have the xref values.
          \def\printedrefname{\refx{#1-title}{}}%
        \else
          % Otherwise just copy the Info node name.
          \def\printedrefname{\ignorespaces #1}%
        \fi%
      \fi
    \fi
  \fi
  %
  % Make link in pdf output.
  \ifpdf
    % For pdfTeX and LuaTeX
    {\indexnofonts
     \makevalueexpandable
     \turnoffactive
     % This expands tokens, so do it after making catcode changes, so _
     % etc. don't get their TeX definitions.  This ignores all spaces in
     % #4, including (wrongly) those in the middle of the filename.
     \getfilename{#4}%
     %
     % This (wrongly) does not take account of leading or trailing
     % spaces in #1, which should be ignored.
     \setpdfdestname{#1}%
     %
     \ifx\pdfdestname\empty
       \def\pdfdestname{Top}% no empty targets
     \fi
     %
     \leavevmode
     \startlink attr{/Border [0 0 0]}%
     \ifnum\filenamelength>0
       goto file{\the\filename.pdf} name{\pdfdestname}%
     \else
       goto name{\pdfmkpgn{\pdfdestname}}%
     \fi
    }%
    \setcolor{\linkcolor}%
  \else
    \ifx\XeTeXrevision\thisisundefined
    \else
      % For XeTeX
      {\indexnofonts
       \makevalueexpandable
       \turnoffactive
       % This expands tokens, so do it after making catcode changes, so _
       % etc. don't get their TeX definitions.  This ignores all spaces in
       % #4, including (wrongly) those in the middle of the filename.
       \getfilename{#4}%
       %
       % This (wrongly) does not take account of leading or trailing
       % spaces in #1, which should be ignored.
       \setpdfdestname{#1}%
       %
       \ifx\pdfdestname\empty
         \def\pdfdestname{Top}% no empty targets
       \fi
       %
       \leavevmode
       \ifnum\filenamelength>0
         % With default settings,
         % XeTeX (xdvipdfmx) replaces link destination names with integers.
         % In this case, the replaced destination names of
         % remote PDFs are no longer known.  In order to avoid a replacement,
         % you can use xdvipdfmx's command line option `-C 0x0010'.
         % If you use XeTeX 0.99996+ (TeX Live 2016+),
         % this command line option is no longer necessary
         % because we can use the `dvipdfmx:config' special.
         \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
           << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
       \else
         \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
           << /S /GoTo /D (\pdfdestname) >> >>}%
       \fi
      }%
      \setcolor{\linkcolor}%
    \fi
  \fi
  {%
    % Have to otherify everything special to allow the \csname to
    % include an _ in the xref name, etc.
    \indexnofonts
    \turnoffactive
    \def\value##1{##1}%
    \expandafter\global\expandafter\let\expandafter\Xthisreftitle
      \csname XR#1-title\endcsname
  }%
  %
  % Float references are printed completely differently: "Figure 1.2"
  % instead of "[somenode], p.3".  \iffloat distinguishes them by
  % \Xthisreftitle being set to a magic string.
  \iffloat\Xthisreftitle
    % If the user specified the print name (third arg) to the ref,
    % print it instead of our usual "Figure 1.2".
    \ifdim\wd\printedrefnamebox = 0pt
      \refx{#1-snt}{}%
    \else
      \printedrefname
    \fi
    %
    % If the user also gave the printed manual name (fifth arg), append
    % "in MANUALNAME".
    \ifdim \wd\printedmanualbox > 0pt
      \space \putwordin{} \cite{\printedmanual}%
    \fi
  \else
    % node/anchor (non-float) references.
    % 
    % If we use \unhbox to print the node names, TeX does not insert
    % empty discretionaries after hyphens, which means that it will not
    % find a line break at a hyphen in a node names.  Since some manuals
    % are best written with fairly long node names, containing hyphens,
    % this is a loss.  Therefore, we give the text of the node name
    % again, so it is as if TeX is seeing it for the first time.
    % 
    \ifdim \wd\printedmanualbox > 0pt
      % Cross-manual reference with a printed manual name.
      % 
      \crossmanualxref{\cite{\printedmanual\unskip}}%
    %
    \else\ifdim \wd\infofilenamebox > 0pt
      % Cross-manual reference with only an info filename (arg 4), no
      % printed manual name (arg 5).  This is essentially the same as
      % the case above; we output the filename, since we have nothing else.
      % 
      \crossmanualxref{\code{\infofilename\unskip}}%
    %
    \else
      % Reference within this manual.
      %
      % _ (for example) has to be the character _ for the purposes of the
      % control sequence corresponding to the node, but it has to expand
      % into the usual \leavevmode...\vrule stuff for purposes of
      % printing. So we \turnoffactive for the \refx-snt, back on for the
      % printing, back off for the \refx-pg.
      {\turnoffactive
       % Only output a following space if the -snt ref is nonempty; for
       % @unnumbered and @anchor, it won't be.
       \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
       \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
      }%
      % output the `[mynode]' via the macro below so it can be overridden.
      \xrefprintnodename\printedrefname
      %
      % But we always want a comma and a space:
      ,\space
      %
      % output the `page 3'.
      \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
      % Add a , if xref followed by a space
      \if\space\noexpand\tokenafterxref ,%
      \else\ifx\	\tokenafterxref ,% @TAB
      \else\ifx\*\tokenafterxref ,%   @*
      \else\ifx\ \tokenafterxref ,%   @SPACE
      \else\ifx\
                \tokenafterxref ,%    @NL
      \else\ifx\tie\tokenafterxref ,% @tie
      \fi\fi\fi\fi\fi\fi
    \fi\fi
  \fi
  \endlink
\endgroup}

% Output a cross-manual xref to #1.  Used just above (twice).
% 
% Only include the text "Section ``foo'' in" if the foo is neither
% missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
% "see The Foo Manual", the idea being to refer to the whole manual.
% 
% But, this being TeX, we can't easily compare our node name against the
% string "Top" while ignoring the possible spaces before and after in
% the input.  By adding the arbitrary 7sp below, we make it much less
% likely that a real node name would have the same width as "Top" (e.g.,
% in a monospaced font).  Hopefully it will never happen in practice.
% 
% For the same basic reason, we retypeset the "Top" at every
% reference, since the current font is indeterminate.
% 
\def\crossmanualxref#1{%
  \setbox\toprefbox = \hbox{Top\kern7sp}%
  \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
  \ifdim \wd2 > 7sp  % nonempty?
    \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
      \putwordSection{} ``\printedrefname'' \putwordin{}\space
    \fi
  \fi
  #1%
}

% This macro is called from \xrefX for the `[nodename]' part of xref
% output.  It's a separate macro only so it can be changed more easily,
% since square brackets don't work well in some documents.  Particularly
% one that Bob is working on :).
%
\def\xrefprintnodename#1{[#1]}

% Things referred to by \setref.
%
\def\Ynothing{}
\def\Yomitfromtoc{}
\def\Ynumbered{%
  \ifnum\secno=0
    \putwordChapter@tie \the\chapno
  \else \ifnum\subsecno=0
    \putwordSection@tie \the\chapno.\the\secno
  \else \ifnum\subsubsecno=0
    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  \else
    \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  \fi\fi\fi
}
\def\Yappendix{%
  \ifnum\secno=0
     \putwordAppendix@tie @char\the\appendixno{}%
  \else \ifnum\subsecno=0
     \putwordSection@tie @char\the\appendixno.\the\secno
  \else \ifnum\subsubsecno=0
    \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  \else
    \putwordSection@tie
      @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  \fi\fi\fi
}

% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME.  SUFFIX 
% is output afterwards if non-empty.
\def\refx#1#2{%
  \requireauxfile
  {%
    \indexnofonts
    \otherbackslash
    \def\value##1{##1}%
    \expandafter\global\expandafter\let\expandafter\thisrefX
      \csname XR#1\endcsname
  }%
  \ifx\thisrefX\relax
    % If not defined, say something at least.
    \angleleft un\-de\-fined\angleright
    \iflinks
      \ifhavexrefs
        {\toks0 = {#1}% avoid expansion of possibly-complex value
         \message{\linenumber Undefined cross reference `\the\toks0'.}}%
      \else
        \ifwarnedxrefs\else
          \global\warnedxrefstrue
          \message{Cross reference values unknown; you must run TeX again.}%
        \fi
      \fi
    \fi
  \else
    % It's defined, so just use it.
    \thisrefX
  \fi
  #2% Output the suffix in any case.
}

% This is the macro invoked by entries in the aux file.  Define a control 
% sequence for a cross-reference target (we prepend XR to the control sequence 
% name to avoid collisions).  The value is the page number.  If this is a float 
% type, we have more work to do.
%
\def\xrdef#1#2{%
  {% Expand the node or anchor name to remove control sequences.
   % \turnoffactive stops 8-bit characters being changed to commands
   % like @'e.  \refx does the same to retrieve the value in the definition.
    \indexnofonts
    \turnoffactive
    \def\value##1{##1}%
    \xdef\safexrefname{#1}%
  }%
  %
  \bgroup
    \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
  \egroup
  % We put the \gdef inside a group to avoid the definitions building up on 
  % TeX's save stack, which can cause it to run out of space for aux files with 
  % thousands of lines.  \gdef doesn't use the save stack, but \csname does
  % when it defines an unknown control sequence as \relax. 
  %
  % Was that xref control sequence that we just defined for a float?
  \expandafter\iffloat\csname XR\safexrefname\endcsname
    % it was a float, and we have the (safe) float type in \iffloattype.
    \expandafter\let\expandafter\floatlist
      \csname floatlist\iffloattype\endcsname
    %
    % Is this the first time we've seen this float type?
    \expandafter\ifx\floatlist\relax
      \toks0 = {\do}% yes, so just \do
    \else
      % had it before, so preserve previous elements in list.
      \toks0 = \expandafter{\floatlist\do}%
    \fi
    %
    % Remember this xref in the control sequence \floatlistFLOATTYPE,
    % for later use in \listoffloats.
    \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
      {\safexrefname}}%
  \fi
}

% If working on a large document in chapters, it is convenient to
% be able to disable indexing, cross-referencing, and contents, for test runs.
% This is done with @novalidate at the beginning of the file.
%
\newif\iflinks \linkstrue % by default we want the aux files.
\let\novalidate = \linksfalse

% Used when writing to the aux file, or when using data from it.
\def\requireauxfile{%
  \iflinks
    \tryauxfile
    % Open the new aux file.  TeX will close it automatically at exit.
    \immediate\openout\auxfile=\jobname.aux
  \fi
  \global\let\requireauxfile=\relax   % Only do this once.
}

% Read the last existing aux file, if any.  No error if none exists.
%
\def\tryauxfile{%
  \openin 1 \jobname.aux
  \ifeof 1 \else
    \readdatafile{aux}%
    \global\havexrefstrue
  \fi
  \closein 1
}

\def\setupdatafile{%
  \catcode`\^^@=\other
  \catcode`\^^A=\other
  \catcode`\^^B=\other
  \catcode`\^^C=\other
  \catcode`\^^D=\other
  \catcode`\^^E=\other
  \catcode`\^^F=\other
  \catcode`\^^G=\other
  \catcode`\^^H=\other
  \catcode`\^^K=\other
  \catcode`\^^L=\other
  \catcode`\^^N=\other
  \catcode`\^^P=\other
  \catcode`\^^Q=\other
  \catcode`\^^R=\other
  \catcode`\^^S=\other
  \catcode`\^^T=\other
  \catcode`\^^U=\other
  \catcode`\^^V=\other
  \catcode`\^^W=\other
  \catcode`\^^X=\other
  \catcode`\^^Z=\other
  \catcode`\^^[=\other
  \catcode`\^^\=\other
  \catcode`\^^]=\other
  \catcode`\^^^=\other
  \catcode`\^^_=\other
  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
  % supported in the main text, it doesn't seem desirable.  Furthermore,
  % that is not enough: for node names that actually contain a ^
  % character, we would end up writing a line like this: 'xrdef {'hat
  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  % argument, and \hat is not an expandable control sequence.  It could
  % all be worked out, but why?  Either we support ^^ or we don't.
  %
  % The other change necessary for this was to define \auxhat:
  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  % and then to call \auxhat in \setq.
  %
  \catcode`\^=\other
  %
  % Special characters.  Should be turned off anyway, but...
  \catcode`\~=\other
  \catcode`\[=\other
  \catcode`\]=\other
  \catcode`\"=\other
  \catcode`\_=\other
  \catcode`\|=\other
  \catcode`\<=\other
  \catcode`\>=\other
  \catcode`\$=\other
  \catcode`\#=\other
  \catcode`\&=\other
  \catcode`\%=\other
  \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  %
  % This is to support \ in node names and titles, since the \
  % characters end up in a \csname.  It's easier than
  % leaving it active and making its active definition an actual \
  % character.  What I don't understand is why it works in the *value*
  % of the xrdef.  Seems like it should be a catcode12 \, and that
  % should not typeset properly.  But it works, so I'm moving on for
  % now.  --karl, 15jan04.
  \catcode`\\=\other
  %
  % @ is our escape character in .aux files, and we need braces.
  \catcode`\{=1
  \catcode`\}=2
  \catcode`\@=0
}

\def\readdatafile#1{%
\begingroup
  \setupdatafile
  \input\jobname.#1
\endgroup}


\message{insertions,}
% including footnotes.

\newcount \footnoteno

% The trailing space in the following definition for supereject is
% vital for proper filling; pages come out unaligned when you do a
% pagealignmacro call if that space before the closing brace is
% removed. (Generally, numeric constants should always be followed by a
% space to prevent strange expansion errors.)
\def\supereject{\par\penalty -20000\footnoteno =0 }

% @footnotestyle is meaningful for Info output only.
\let\footnotestyle=\comment

{\catcode `\@=11
%
% Auto-number footnotes.  Otherwise like plain.
\gdef\footnote{%
  \global\advance\footnoteno by \@ne
  \edef\thisfootno{$^{\the\footnoteno}$}%
  %
  % In case the footnote comes at the end of a sentence, preserve the
  % extra spacing after we do the footnote number.
  \let\@sf\empty
  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
  %
  % Remove inadvertent blank space before typesetting the footnote number.
  \unskip
  \thisfootno\@sf
  \dofootnote
}%

% Don't bother with the trickery in plain.tex to not require the
% footnote text as a parameter.  Our footnotes don't need to be so general.
%
% Oh yes, they do; otherwise, @ifset (and anything else that uses
% \parseargline) fails inside footnotes because the tokens are fixed when
% the footnote is read.  --karl, 16nov96.
%
\gdef\dofootnote{%
  \insert\footins\bgroup
  %
  % Nested footnotes are not supported in TeX, that would take a lot
  % more work.  (\startsavinginserts does not suffice.)
  \let\footnote=\errfootnotenest
  %
  % We want to typeset this text as a normal paragraph, even if the
  % footnote reference occurs in (for example) a display environment.
  % So reset some parameters.
  \hsize=\txipagewidth
  \interlinepenalty\interfootnotelinepenalty
  \splittopskip\ht\strutbox % top baseline for broken footnotes
  \splitmaxdepth\dp\strutbox
  \floatingpenalty\@MM
  \leftskip\z@skip
  \rightskip\z@skip
  \spaceskip\z@skip
  \xspaceskip\z@skip
  \parindent\defaultparindent
  %
  \smallfonts \rm
  %
  % Because we use hanging indentation in footnotes, a @noindent appears
  % to exdent this text, so make it be a no-op.  makeinfo does not use
  % hanging indentation so @noindent can still be needed within footnote
  % text after an @example or the like (not that this is good style).
  \let\noindent = \relax
  %
  % Hang the footnote text off the number.  Use \everypar in case the
  % footnote extends for more than one paragraph.
  \everypar = {\hang}%
  \textindent{\thisfootno}%
  %
  % Don't crash into the line above the footnote text.  Since this
  % expands into a box, it must come within the paragraph, lest it
  % provide a place where TeX can split the footnote.
  \footstrut
  %
  % Invoke rest of plain TeX footnote routine.
  \futurelet\next\fo@t
}
}%end \catcode `\@=11

\def\errfootnotenest{%
  \errhelp=\EMsimple
  \errmessage{Nested footnotes not supported in texinfo.tex,
    even though they work in makeinfo; sorry}
}

\def\errfootnoteheading{%
  \errhelp=\EMsimple
  \errmessage{Footnotes in chapters, sections, etc., are not supported}
}

% In case a @footnote appears in a vbox, save the footnote text and create
% the real \insert just after the vbox finished.  Otherwise, the insertion
% would be lost.
% Similarly, if a @footnote appears inside an alignment, save the footnote
% text to a box and make the \insert when a row of the table is finished.
% And the same can be done for other insert classes.  --kasal, 16nov03.
%
% Replace the \insert primitive by a cheating macro.
% Deeper inside, just make sure that the saved insertions are not spilled
% out prematurely.
%
\def\startsavinginserts{%
  \ifx \insert\ptexinsert
    \let\insert\saveinsert
  \else
    \let\checkinserts\relax
  \fi
}

% This \insert replacement works for both \insert\footins{foo} and
% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
%
\def\saveinsert#1{%
  \edef\next{\noexpand\savetobox \makeSAVEname#1}%
  \afterassignment\next
  % swallow the left brace
  \let\temp =
}
\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}

\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}

\def\placesaveins#1{%
  \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
    {\box#1}%
}

% eat @SAVE -- beware, all of them have catcode \other:
{
  \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials  %  ;-)
  \gdef\gobblesave @SAVE{}
}

% initialization:
\def\newsaveins #1{%
  \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
  \next
}
\def\newsaveinsX #1{%
  \csname newbox\endcsname #1%
  \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
    \checksaveins #1}%
}

% initialize:
\let\checkinserts\empty
\newsaveins\footins
\newsaveins\margin


% @image.  We use the macros from epsf.tex to support this.
% If epsf.tex is not installed and @image is used, we complain.
%
% Check for and read epsf.tex up front.  If we read it only at @image
% time, we might be inside a group, and then its definitions would get
% undone and the next image would fail.
\openin 1 = epsf.tex
\ifeof 1 \else
  % Do not bother showing banner with epsf.tex v2.7k (available in
  % doc/epsf.tex and on ctan).
  \def\epsfannounce{\toks0 = }%
  \input epsf.tex
\fi
\closein 1
%
% We will only complain once about lack of epsf.tex.
\newif\ifwarnednoepsf
\newhelp\noepsfhelp{epsf.tex must be installed for images to
  work.  It is also included in the Texinfo distribution, or you can get
  it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
%
\def\image#1{%
  \ifx\epsfbox\thisisundefined
    \ifwarnednoepsf \else
      \errhelp = \noepsfhelp
      \errmessage{epsf.tex not found, images will be ignored}%
      \global\warnednoepsftrue
    \fi
  \else
    \imagexxx #1,,,,,\finish
  \fi
}
%
% Arguments to @image:
% #1 is (mandatory) image filename; we tack on .eps extension.
% #2 is (optional) width, #3 is (optional) height.
% #4 is (ignored optional) html alt text.
% #5 is (ignored optional) extension.
% #6 is just the usual extra ignored arg for parsing stuff.
\newif\ifimagevmode
\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  \catcode`\^^M = 5     % in case we're inside an example
  \normalturnoffactive  % allow _ et al. in names
  \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
  % If the image is by itself, center it.
  \ifvmode
    \imagevmodetrue
  \else \ifx\centersub\centerV
    % for @center @image, we need a vbox so we can have our vertical space
    \imagevmodetrue
    \vbox\bgroup % vbox has better behavior than vtop herev
  \fi\fi
  %
  \ifimagevmode
    \nobreak\medskip
    % Usually we'll have text after the image which will insert
    % \parskip glue, so insert it here too to equalize the space
    % above and below.
    \nobreak\vskip\parskip
    \nobreak
  \fi
  %
  % Leave vertical mode so that indentation from an enclosing
  %  environment such as @quotation is respected.
  % However, if we're at the top level, we don't want the
  %  normal paragraph indentation.
  % On the other hand, if we are in the case of @center @image, we don't
  %  want to start a paragraph, which will create a hsize-width box and
  %  eradicate the centering.
  \ifx\centersub\centerV\else \noindent \fi
  %
  % Output the image.
  \ifpdf
    % For pdfTeX and LuaTeX <= 0.80
    \dopdfimage{#1}{#2}{#3}%
  \else
    \ifx\XeTeXrevision\thisisundefined
      % For epsf.tex
      % \epsfbox itself resets \epsf?size at each figure.
      \setbox0 = \hbox{\ignorespaces #2}%
        \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
      \setbox0 = \hbox{\ignorespaces #3}%
        \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
      \epsfbox{#1.eps}%
    \else
      % For XeTeX
      \doxeteximage{#1}{#2}{#3}%
    \fi
  \fi
  %
  \ifimagevmode
    \medskip  % space after a standalone image
  \fi  
  \ifx\centersub\centerV \egroup \fi
\endgroup}


% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
% etc.  We don't actually implement floating yet, we always include the
% float "here".  But it seemed the best name for the future.
%
\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}

% There may be a space before second and/or third parameter; delete it.
\def\eatcommaspace#1, {#1,}

% #1 is the optional FLOATTYPE, the text label for this float, typically
% "Figure", "Table", "Example", etc.  Can't contain commas.  If omitted,
% this float will not be numbered and cannot be referred to.
%
% #2 is the optional xref label.  Also must be present for the float to
% be referable.
%
% #3 is the optional positioning argument; for now, it is ignored.  It
% will somehow specify the positions allowed to float to (here, top, bottom).
%
% We keep a separate counter for each FLOATTYPE, which we reset at each
% chapter-level command.
\let\resetallfloatnos=\empty
%
\def\dofloat#1,#2,#3,#4\finish{%
  \let\thiscaption=\empty
  \let\thisshortcaption=\empty
  %
  % don't lose footnotes inside @float.
  %
  % BEWARE: when the floats start float, we have to issue warning whenever an
  % insert appears inside a float which could possibly float. --kasal, 26may04
  %
  \startsavinginserts
  %
  % We can't be used inside a paragraph.
  \par
  %
  \vtop\bgroup
    \def\floattype{#1}%
    \def\floatlabel{#2}%
    \def\floatloc{#3}% we do nothing with this yet.
    %
    \ifx\floattype\empty
      \let\safefloattype=\empty
    \else
      {%
        % the floattype might have accents or other special characters,
        % but we need to use it in a control sequence name.
        \indexnofonts
        \turnoffactive
        \xdef\safefloattype{\floattype}%
      }%
    \fi
    %
    % If label is given but no type, we handle that as the empty type.
    \ifx\floatlabel\empty \else
      % We want each FLOATTYPE to be numbered separately (Figure 1,
      % Table 1, Figure 2, ...).  (And if no label, no number.)
      %
      \expandafter\getfloatno\csname\safefloattype floatno\endcsname
      \global\advance\floatno by 1
      %
      {%
        % This magic value for \lastsection is output by \setref as the
        % XREFLABEL-title value.  \xrefX uses it to distinguish float
        % labels (which have a completely different output format) from
        % node and anchor labels.  And \xrdef uses it to construct the
        % lists of floats.
        %
        \edef\lastsection{\floatmagic=\safefloattype}%
        \setref{\floatlabel}{Yfloat}%
      }%
    \fi
    %
    % start with \parskip glue, I guess.
    \vskip\parskip
    %
    % Don't suppress indentation if a float happens to start a section.
    \restorefirstparagraphindent
}

% we have these possibilities:
% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
% @float Foo,lbl & no caption:    Foo 1.1
% @float Foo & @caption{Cap}:     Foo: Cap
% @float Foo & no caption:        Foo
% @float ,lbl & Caption{Cap}:     1.1: Cap
% @float ,lbl & no caption:       1.1
% @float & @caption{Cap}:         Cap
% @float & no caption:
%
\def\Efloat{%
    \let\floatident = \empty
    %
    % In all cases, if we have a float type, it comes first.
    \ifx\floattype\empty \else \def\floatident{\floattype}\fi
    %
    % If we have an xref label, the number comes next.
    \ifx\floatlabel\empty \else
      \ifx\floattype\empty \else % if also had float type, need tie first.
        \appendtomacro\floatident{\tie}%
      \fi
      % the number.
      \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
    \fi
    %
    % Start the printed caption with what we've constructed in
    % \floatident, but keep it separate; we need \floatident again.
    \let\captionline = \floatident
    %
    \ifx\thiscaption\empty \else
      \ifx\floatident\empty \else
        \appendtomacro\captionline{: }% had ident, so need a colon between
      \fi
      %
      % caption text.
      \appendtomacro\captionline{\scanexp\thiscaption}%
    \fi
    %
    % If we have anything to print, print it, with space before.
    % Eventually this needs to become an \insert.
    \ifx\captionline\empty \else
      \vskip.5\parskip
      \captionline
      %
      % Space below caption.
      \vskip\parskip
    \fi
    %
    % If have an xref label, write the list of floats info.  Do this
    % after the caption, to avoid chance of it being a breakpoint.
    \ifx\floatlabel\empty \else
      % Write the text that goes in the lof to the aux file as
      % \floatlabel-lof.  Besides \floatident, we include the short
      % caption if specified, else the full caption if specified, else nothing.
      {%
        \requireauxfile
        \atdummies
        %
        \ifx\thisshortcaption\empty
          \def\gtemp{\thiscaption}%
        \else
          \def\gtemp{\thisshortcaption}%
        \fi
        \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
          \ifx\gtemp\empty \else : \gtemp \fi}}%
      }%
    \fi
  \egroup  % end of \vtop
  %
  \checkinserts
}

% Append the tokens #2 to the definition of macro #1, not expanding either.
%
\def\appendtomacro#1#2{%
  \expandafter\def\expandafter#1\expandafter{#1#2}%
}

% @caption, @shortcaption
%
\def\caption{\docaption\thiscaption}
\def\shortcaption{\docaption\thisshortcaption}
\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
\def\defcaption#1#2{\egroup \def#1{#2}}

% The parameter is the control sequence identifying the counter we are
% going to use.  Create it if it doesn't exist and assign it to \floatno.
\def\getfloatno#1{%
  \ifx#1\relax
      % Haven't seen this figure type before.
      \csname newcount\endcsname #1%
      %
      % Remember to reset this floatno at the next chap.
      \expandafter\gdef\expandafter\resetallfloatnos
        \expandafter{\resetallfloatnos #1=0 }%
  \fi
  \let\floatno#1%
}

% \setref calls this to get the XREFLABEL-snt value.  We want an @xref
% to the FLOATLABEL to expand to "Figure 3.1".  We call \setref when we
% first read the @float command.
%
\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%

% Magic string used for the XREFLABEL-title value, so \xrefX can
% distinguish floats from other xref types.
\def\floatmagic{!!float!!}

% #1 is the control sequence we are passed; we expand into a conditional
% which is true if #1 represents a float ref.  That is, the magic
% \lastsection value which we \setref above.
%
\def\iffloat#1{\expandafter\doiffloat#1==\finish}
%
% #1 is (maybe) the \floatmagic string.  If so, #2 will be the
% (safe) float type for this float.  We set \iffloattype to #2.
%
\def\doiffloat#1=#2=#3\finish{%
  \def\temp{#1}%
  \def\iffloattype{#2}%
  \ifx\temp\floatmagic
}

% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
%
\parseargdef\listoffloats{%
  \def\floattype{#1}% floattype
  {%
    % the floattype might have accents or other special characters,
    % but we need to use it in a control sequence name.
    \indexnofonts
    \turnoffactive
    \xdef\safefloattype{\floattype}%
  }%
  %
  % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
  \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
    \ifhavexrefs
      % if the user said @listoffloats foo but never @float foo.
      \message{\linenumber No `\safefloattype' floats to list.}%
    \fi
  \else
    \begingroup
      \leftskip=\tocindent  % indent these entries like a toc
      \let\do=\listoffloatsdo
      \csname floatlist\safefloattype\endcsname
    \endgroup
  \fi
}

% This is called on each entry in a list of floats.  We're passed the
% xref label, in the form LABEL-title, which is how we save it in the
% aux file.  We strip off the -title and look up \XRLABEL-lof, which
% has the text we're supposed to typeset here.
%
% Figures without xref labels will not be included in the list (since
% they won't appear in the aux file).
%
\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
\def\listoffloatsdoentry#1-title\finish{{%
  % Can't fully expand XR#1-lof because it can contain anything.  Just
  % pass the control sequence.  On the other hand, XR#1-pg is just the
  % page number, and we want to fully expand that so we can get a link
  % in pdf output.
  \toksA = \expandafter{\csname XR#1-lof\endcsname}%
  %
  % use the same \entry macro we use to generate the TOC and index.
  \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
  \writeentry
}}


\message{localization,}

% For single-language documents, @documentlanguage is usually given very
% early, just after @documentencoding.  Single argument is the language
% (de) or locale (de_DE) abbreviation.
%
{
  \catcode`\_ = \active
  \globaldefs=1
\parseargdef\documentlanguage{%
  \tex % read txi-??.tex file in plain TeX.
    % Read the file by the name they passed if it exists.
    \let_ = \normalunderscore  % normal _ character for filename test
    \openin 1 txi-#1.tex
    \ifeof 1
      \documentlanguagetrywithoutunderscore #1_\finish
    \else
      \globaldefs = 1  % everything in the txi-LL files needs to persist
      \input txi-#1.tex
    \fi
    \closein 1
  \endgroup % end raw TeX
}
%
% If they passed de_DE, and txi-de_DE.tex doesn't exist,
% try txi-de.tex.
%
\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
  \openin 1 txi-#1.tex
  \ifeof 1
    \errhelp = \nolanghelp
    \errmessage{Cannot read language file txi-#1.tex}%
  \else
    \globaldefs = 1  % everything in the txi-LL files needs to persist
    \input txi-#1.tex
  \fi
  \closein 1
}
}% end of special _ catcode
%
\newhelp\nolanghelp{The given language definition file cannot be found or
is empty.  Maybe you need to install it?  Putting it in the current
directory should work if nowhere else does.}

% This macro is called from txi-??.tex files; the first argument is the
% \language name to set (without the "\lang@" prefix), the second and
% third args are \{left,right}hyphenmin.
%
% The language names to pass are determined when the format is built.
% See the etex.log file created at that time, e.g.,
% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
%
% With TeX Live 2008, etex now includes hyphenation patterns for all
% available languages.  This means we can support hyphenation in
% Texinfo, at least to some extent.  (This still doesn't solve the
% accented characters problem.)
%
\catcode`@=11
\def\txisetlanguage#1#2#3{%
  % do not set the language if the name is undefined in the current TeX.
  \expandafter\ifx\csname lang@#1\endcsname \relax
    \message{no patterns for #1}%
  \else
    \global\language = \csname lang@#1\endcsname
  \fi
  % but there is no harm in adjusting the hyphenmin values regardless.
  \global\lefthyphenmin = #2\relax
  \global\righthyphenmin = #3\relax
}

% XeTeX and LuaTeX can handle Unicode natively.
% Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
% Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
%
\newif\iftxinativeunicodecapable
\newif\iftxiusebytewiseio

\ifx\XeTeXrevision\thisisundefined
  \ifx\luatexversion\thisisundefined
    \txinativeunicodecapablefalse
    \txiusebytewiseiotrue
  \else
    \txinativeunicodecapabletrue
    \txiusebytewiseiofalse
  \fi
\else
  \txinativeunicodecapabletrue
  \txiusebytewiseiofalse
\fi

% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
% for non-UTF-8 (byte-wise) encodings.
%
\def\setbytewiseio{%
  \ifx\XeTeXrevision\thisisundefined
  \else
    \XeTeXdefaultencoding "bytes"  % For subsequent files to be read
    \XeTeXinputencoding "bytes"  % For document root file
    % Unfortunately, there seems to be no corresponding XeTeX command for
    % output encoding.  This is a problem for auxiliary index and TOC files.
    % The only solution would be perhaps to write out @U{...} sequences in
    % place of non-ASCII characters.
  \fi

  \ifx\luatexversion\thisisundefined
  \else
    \directlua{
    local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
    local function convert_char (char)
      return utf8_char(byte(char))
    end

    local function convert_line (line)
      return gsub(line, ".", convert_char)
    end

    callback.register("process_input_buffer", convert_line)

    local function convert_line_out (line)
      local line_out = ""
      for c in string.utfvalues(line) do
         line_out = line_out .. string.char(c)
      end
      return line_out
    end

    callback.register("process_output_buffer", convert_line_out)
    }
  \fi

  \txiusebytewiseiotrue
}


% Helpers for encodings.
% Set the catcode of characters 128 through 255 to the specified number.
%
\def\setnonasciicharscatcode#1{%
   \count255=128
   \loop\ifnum\count255<256
      \global\catcode\count255=#1\relax
      \advance\count255 by 1
   \repeat
}

\def\setnonasciicharscatcodenonglobal#1{%
   \count255=128
   \loop\ifnum\count255<256
      \catcode\count255=#1\relax
      \advance\count255 by 1
   \repeat
}

% @documentencoding sets the definition of non-ASCII characters
% according to the specified encoding.
%
\def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
\def\documentencodingzzz#1{%
  %
  % Encoding being declared for the document.
  \def\declaredencoding{\csname #1.enc\endcsname}%
  %
  % Supported encodings: names converted to tokens in order to be able
  % to compare them with \ifx.
  \def\ascii{\csname US-ASCII.enc\endcsname}%
  \def\latnine{\csname ISO-8859-15.enc\endcsname}%
  \def\latone{\csname ISO-8859-1.enc\endcsname}%
  \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
  \def\utfeight{\csname UTF-8.enc\endcsname}%
  %
  \ifx \declaredencoding \ascii
     \asciichardefs
  %
  \else \ifx \declaredencoding \lattwo
     \iftxinativeunicodecapable
       \setbytewiseio
     \fi
     \setnonasciicharscatcode\active
     \lattwochardefs
  %
  \else \ifx \declaredencoding \latone
     \iftxinativeunicodecapable
       \setbytewiseio
     \fi
     \setnonasciicharscatcode\active
     \latonechardefs
  %
  \else \ifx \declaredencoding \latnine
     \iftxinativeunicodecapable
       \setbytewiseio
     \fi
     \setnonasciicharscatcode\active
     \latninechardefs
  %
  \else \ifx \declaredencoding \utfeight
     \iftxinativeunicodecapable
       % For native Unicode handling (XeTeX and LuaTeX)
       \nativeunicodechardefs
     \else
       % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
       \setnonasciicharscatcode\active
       % since we already invoked \utfeightchardefs at the top level
       % (below), do not re-invoke it, otherwise our check for duplicated
       % definitions gets triggered.  Making non-ascii chars active is
       % sufficient.
     \fi
  %
  \else
    \message{Ignoring unknown document encoding: #1.}%
  %
  \fi % utfeight
  \fi % latnine
  \fi % latone
  \fi % lattwo
  \fi % ascii
  %
  \ifx\XeTeXrevision\thisisundefined
  \else
    \ifx \declaredencoding \utfeight
    \else
      \ifx \declaredencoding \ascii
      \else
        \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
        non-ASCII characters in auxiliary files.}%
      \fi
    \fi
  \fi
}

% emacs-page
% A message to be logged when using a character that isn't available
% the default font encoding (OT1).
%
\def\missingcharmsg#1{\message{Character missing, sorry: #1.}}

% Take account of \c (plain) vs. \, (Texinfo) difference.
\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}

% First, make active non-ASCII characters in order for them to be
% correctly categorized when TeX reads the replacement text of
% macros containing the character definitions.
\setnonasciicharscatcode\active
%

\def\gdefchar#1#2{%
\gdef#1{%
   \ifpassthroughchars
     \string#1%
   \else
     #2%
   \fi
}}

% Latin1 (ISO-8859-1) character definitions.
\def\latonechardefs{%
  \gdefchar^^a0{\tie}
  \gdefchar^^a1{\exclamdown}
  \gdefchar^^a2{{\tcfont \char162}} % cent
  \gdefchar^^a3{\pounds{}}
  \gdefchar^^a4{{\tcfont \char164}} % currency
  \gdefchar^^a5{{\tcfont \char165}} % yen
  \gdefchar^^a6{{\tcfont \char166}} % broken bar
  \gdefchar^^a7{\S}
  \gdefchar^^a8{\"{}}
  \gdefchar^^a9{\copyright{}}
  \gdefchar^^aa{\ordf}
  \gdefchar^^ab{\guillemetleft{}}
  \gdefchar^^ac{\ensuremath\lnot}
  \gdefchar^^ad{\-}
  \gdefchar^^ae{\registeredsymbol{}}
  \gdefchar^^af{\={}}
  %
  \gdefchar^^b0{\textdegree}
  \gdefchar^^b1{$\pm$}
  \gdefchar^^b2{$^2$}
  \gdefchar^^b3{$^3$}
  \gdefchar^^b4{\'{}}
  \gdefchar^^b5{$\mu$}
  \gdefchar^^b6{\P}
  \gdefchar^^b7{\ensuremath\cdot}
  \gdefchar^^b8{\cedilla\ }
  \gdefchar^^b9{$^1$}
  \gdefchar^^ba{\ordm}
  \gdefchar^^bb{\guillemetright{}}
  \gdefchar^^bc{$1\over4$}
  \gdefchar^^bd{$1\over2$}
  \gdefchar^^be{$3\over4$}
  \gdefchar^^bf{\questiondown}
  %
  \gdefchar^^c0{\`A}
  \gdefchar^^c1{\'A}
  \gdefchar^^c2{\^A}
  \gdefchar^^c3{\~A}
  \gdefchar^^c4{\"A}
  \gdefchar^^c5{\ringaccent A}
  \gdefchar^^c6{\AE}
  \gdefchar^^c7{\cedilla C}
  \gdefchar^^c8{\`E}
  \gdefchar^^c9{\'E}
  \gdefchar^^ca{\^E}
  \gdefchar^^cb{\"E}
  \gdefchar^^cc{\`I}
  \gdefchar^^cd{\'I}
  \gdefchar^^ce{\^I}
  \gdefchar^^cf{\"I}
  %
  \gdefchar^^d0{\DH}
  \gdefchar^^d1{\~N}
  \gdefchar^^d2{\`O}
  \gdefchar^^d3{\'O}
  \gdefchar^^d4{\^O}
  \gdefchar^^d5{\~O}
  \gdefchar^^d6{\"O}
  \gdefchar^^d7{$\times$}
  \gdefchar^^d8{\O}
  \gdefchar^^d9{\`U}
  \gdefchar^^da{\'U}
  \gdefchar^^db{\^U}
  \gdefchar^^dc{\"U}
  \gdefchar^^dd{\'Y}
  \gdefchar^^de{\TH}
  \gdefchar^^df{\ss}
  %
  \gdefchar^^e0{\`a}
  \gdefchar^^e1{\'a}
  \gdefchar^^e2{\^a}
  \gdefchar^^e3{\~a}
  \gdefchar^^e4{\"a}
  \gdefchar^^e5{\ringaccent a}
  \gdefchar^^e6{\ae}
  \gdefchar^^e7{\cedilla c}
  \gdefchar^^e8{\`e}
  \gdefchar^^e9{\'e}
  \gdefchar^^ea{\^e}
  \gdefchar^^eb{\"e}
  \gdefchar^^ec{\`{\dotless i}}
  \gdefchar^^ed{\'{\dotless i}}
  \gdefchar^^ee{\^{\dotless i}}
  \gdefchar^^ef{\"{\dotless i}}
  %
  \gdefchar^^f0{\dh}
  \gdefchar^^f1{\~n}
  \gdefchar^^f2{\`o}
  \gdefchar^^f3{\'o}
  \gdefchar^^f4{\^o}
  \gdefchar^^f5{\~o}
  \gdefchar^^f6{\"o}
  \gdefchar^^f7{$\div$}
  \gdefchar^^f8{\o}
  \gdefchar^^f9{\`u}
  \gdefchar^^fa{\'u}
  \gdefchar^^fb{\^u}
  \gdefchar^^fc{\"u}
  \gdefchar^^fd{\'y}
  \gdefchar^^fe{\th}
  \gdefchar^^ff{\"y}
}

% Latin9 (ISO-8859-15) encoding character definitions.
\def\latninechardefs{%
  % Encoding is almost identical to Latin1.
  \latonechardefs
  %
  \gdefchar^^a4{\euro{}}
  \gdefchar^^a6{\v S}
  \gdefchar^^a8{\v s}
  \gdefchar^^b4{\v Z}
  \gdefchar^^b8{\v z}
  \gdefchar^^bc{\OE}
  \gdefchar^^bd{\oe}
  \gdefchar^^be{\"Y}
}

% Latin2 (ISO-8859-2) character definitions.
\def\lattwochardefs{%
  \gdefchar^^a0{\tie}
  \gdefchar^^a1{\ogonek{A}}
  \gdefchar^^a2{\u{}}
  \gdefchar^^a3{\L}
  \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
  \gdefchar^^a5{\v L}
  \gdefchar^^a6{\'S}
  \gdefchar^^a7{\S}
  \gdefchar^^a8{\"{}}
  \gdefchar^^a9{\v S}
  \gdefchar^^aa{\cedilla S}
  \gdefchar^^ab{\v T}
  \gdefchar^^ac{\'Z}
  \gdefchar^^ad{\-}
  \gdefchar^^ae{\v Z}
  \gdefchar^^af{\dotaccent Z}
  %
  \gdefchar^^b0{\textdegree{}}
  \gdefchar^^b1{\ogonek{a}}
  \gdefchar^^b2{\ogonek{ }}
  \gdefchar^^b3{\l}
  \gdefchar^^b4{\'{}}
  \gdefchar^^b5{\v l}
  \gdefchar^^b6{\'s}
  \gdefchar^^b7{\v{}}
  \gdefchar^^b8{\cedilla\ }
  \gdefchar^^b9{\v s}
  \gdefchar^^ba{\cedilla s}
  \gdefchar^^bb{\v t}
  \gdefchar^^bc{\'z}
  \gdefchar^^bd{\H{}}
  \gdefchar^^be{\v z}
  \gdefchar^^bf{\dotaccent z}
  %
  \gdefchar^^c0{\'R}
  \gdefchar^^c1{\'A}
  \gdefchar^^c2{\^A}
  \gdefchar^^c3{\u A}
  \gdefchar^^c4{\"A}
  \gdefchar^^c5{\'L}
  \gdefchar^^c6{\'C}
  \gdefchar^^c7{\cedilla C}
  \gdefchar^^c8{\v C}
  \gdefchar^^c9{\'E}
  \gdefchar^^ca{\ogonek{E}}
  \gdefchar^^cb{\"E}
  \gdefchar^^cc{\v E}
  \gdefchar^^cd{\'I}
  \gdefchar^^ce{\^I}
  \gdefchar^^cf{\v D}
  %
  \gdefchar^^d0{\DH}
  \gdefchar^^d1{\'N}
  \gdefchar^^d2{\v N}
  \gdefchar^^d3{\'O}
  \gdefchar^^d4{\^O}
  \gdefchar^^d5{\H O}
  \gdefchar^^d6{\"O}
  \gdefchar^^d7{$\times$}
  \gdefchar^^d8{\v R}
  \gdefchar^^d9{\ringaccent U}
  \gdefchar^^da{\'U}
  \gdefchar^^db{\H U}
  \gdefchar^^dc{\"U}
  \gdefchar^^dd{\'Y}
  \gdefchar^^de{\cedilla T}
  \gdefchar^^df{\ss}
  %
  \gdefchar^^e0{\'r}
  \gdefchar^^e1{\'a}
  \gdefchar^^e2{\^a}
  \gdefchar^^e3{\u a}
  \gdefchar^^e4{\"a}
  \gdefchar^^e5{\'l}
  \gdefchar^^e6{\'c}
  \gdefchar^^e7{\cedilla c}
  \gdefchar^^e8{\v c}
  \gdefchar^^e9{\'e}
  \gdefchar^^ea{\ogonek{e}}
  \gdefchar^^eb{\"e}
  \gdefchar^^ec{\v e}
  \gdefchar^^ed{\'{\dotless{i}}}
  \gdefchar^^ee{\^{\dotless{i}}}
  \gdefchar^^ef{\v d}
  %
  \gdefchar^^f0{\dh}
  \gdefchar^^f1{\'n}
  \gdefchar^^f2{\v n}
  \gdefchar^^f3{\'o}
  \gdefchar^^f4{\^o}
  \gdefchar^^f5{\H o}
  \gdefchar^^f6{\"o}
  \gdefchar^^f7{$\div$}
  \gdefchar^^f8{\v r}
  \gdefchar^^f9{\ringaccent u}
  \gdefchar^^fa{\'u}
  \gdefchar^^fb{\H u}
  \gdefchar^^fc{\"u}
  \gdefchar^^fd{\'y}
  \gdefchar^^fe{\cedilla t}
  \gdefchar^^ff{\dotaccent{}}
}

% UTF-8 character definitions.
%
% This code to support UTF-8 is based on LaTeX's utf8.def, with some
% changes for Texinfo conventions.  It is included here under the GPL by
% permission from Frank Mittelbach and the LaTeX team.
%
\newcount\countUTFx
\newcount\countUTFy
\newcount\countUTFz

\gdef\UTFviiiTwoOctets#1#2{\expandafter
   \UTFviiiDefined\csname u8:#1\string #2\endcsname}
%
\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
   \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
%
\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
   \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}

\gdef\UTFviiiDefined#1{%
  \ifx #1\relax
    \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
  \else
    \expandafter #1%
  \fi
}

% Give non-ASCII bytes the active definitions for processing UTF-8 sequences
\begingroup
  \catcode`\~13
  \catcode`\$12
  \catcode`\"12

  % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
  % substituting ~ and $ with a character token of that value.
  \def\UTFviiiLoop{%
    \global\catcode\countUTFx\active
    \uccode`\~\countUTFx
    \uccode`\$\countUTFx
    \uppercase\expandafter{\UTFviiiTmp}%
    \advance\countUTFx by 1
    \ifnum\countUTFx < \countUTFy
      \expandafter\UTFviiiLoop
    \fi}

  % For bytes other than the first in a UTF-8 sequence.  Not expected to
  % be expanded except when writing to auxiliary files.
  \countUTFx = "80
  \countUTFy = "C2
  \def\UTFviiiTmp{%
    \gdef~{%
        \ifpassthroughchars $\fi}}%
  \UTFviiiLoop

  \countUTFx = "C2
  \countUTFy = "E0
  \def\UTFviiiTmp{%
    \gdef~{%
        \ifpassthroughchars $%
        \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
  \UTFviiiLoop

  \countUTFx = "E0
  \countUTFy = "F0
  \def\UTFviiiTmp{%
    \gdef~{%
        \ifpassthroughchars $%
        \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
  \UTFviiiLoop

  \countUTFx = "F0
  \countUTFy = "F4
  \def\UTFviiiTmp{%
    \gdef~{%
        \ifpassthroughchars $%
        \else\expandafter\UTFviiiFourOctets\expandafter$\fi
        }}%
  \UTFviiiLoop
\endgroup

\def\globallet{\global\let} % save some \expandafter's below

% @U{xxxx} to produce U+xxxx, if we support it.
\def\U#1{%
  \expandafter\ifx\csname uni:#1\endcsname \relax
    \iftxinativeunicodecapable
      % All Unicode characters can be used if native Unicode handling is
      % active.  However, if the font does not have the glyph,
      % letters are missing.
      \begingroup
        \uccode`\.="#1\relax
        \uppercase{.}
      \endgroup
    \else
      \errhelp = \EMsimple	
      \errmessage{Unicode character U+#1 not supported, sorry}%
    \fi
  \else
    \csname uni:#1\endcsname
  \fi
}

% These macros are used here to construct the name of a control
% sequence to be defined.
\def\UTFviiiTwoOctetsName#1#2{%
  \csname u8:#1\string #2\endcsname}%
\def\UTFviiiThreeOctetsName#1#2#3{%
  \csname u8:#1\string #2\string #3\endcsname}%
\def\UTFviiiFourOctetsName#1#2#3#4{%
  \csname u8:#1\string #2\string #3\string #4\endcsname}%

% For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
% provide a definition macro to replace a Unicode character;
% this gets used by the @U command
%
\begingroup
  \catcode`\"=12
  \catcode`\<=12
  \catcode`\.=12
  \catcode`\,=12
  \catcode`\;=12
  \catcode`\!=12
  \catcode`\~=13
  \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
    \countUTFz = "#1\relax
    \begingroup
      \parseXMLCharref
    
      % Give \u8:... its definition.  The sequence of seven \expandafter's
      % expands after the \gdef three times, e.g.
      %
      % 1.  \UTFviiTwoOctetsName B1 B2
      % 2.  \csname u8:B1 \string B2 \endcsname
      % 3.  \u8: B1 B2  (a single control sequence token)
      %
      \expandafter\expandafter
      \expandafter\expandafter
      \expandafter\expandafter
      \expandafter\gdef       \UTFviiiTmp{#2}%
      % 
      \expandafter\ifx\csname uni:#1\endcsname \relax \else
       \message{Internal error, already defined: #1}%
      \fi
      %
      % define an additional control sequence for this code point.
      \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
    \endgroup}
  %
  % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
  % to the corresponding UTF-8 sequence.
  \gdef\parseXMLCharref{%
    \ifnum\countUTFz < "A0\relax
      \errhelp = \EMsimple
      \errmessage{Cannot define Unicode char value < 00A0}%
    \else\ifnum\countUTFz < "800\relax
      \parseUTFviiiA,%
      \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
    \else\ifnum\countUTFz < "10000\relax
      \parseUTFviiiA;%
      \parseUTFviiiA,%
      \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
    \else
      \parseUTFviiiA;%
      \parseUTFviiiA,%
      \parseUTFviiiA!%
      \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
    \fi\fi\fi
  }

  % Extract a byte from the end of the UTF-8 representation of \countUTFx.
  % It must be a non-initial byte in the sequence.
  % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
  % of the bytes.
  \gdef\parseUTFviiiA#1{%
    \countUTFx = \countUTFz
    \divide\countUTFz by 64
    \countUTFy = \countUTFz  % Save to be the future value of \countUTFz.
    \multiply\countUTFz by 64
    
    % \countUTFz is now \countUTFx with the last 5 bits cleared.  Subtract
    % in order to get the last five bits.
    \advance\countUTFx by -\countUTFz

    % Convert this to the byte in the UTF-8 sequence.
    \advance\countUTFx by 128
    \uccode `#1\countUTFx
    \countUTFz = \countUTFy}

  % Used to put a UTF-8 byte sequence into \UTFviiiTmp
  % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
  %    sequence.
  % #2 is one of the \UTFviii*OctetsName macros.
  % #3 is always a full stop (.)
  % #4 is a template for the other bytes in the sequence.  The values for these
  %    bytes is substituted in here with \uppercase using the \uccode's.
  \gdef\parseUTFviiiB#1#2#3#4{%
    \advance\countUTFz by "#10\relax
    \uccode `#3\countUTFz
    \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
\endgroup

% For native Unicode handling (XeTeX and LuaTeX),
% provide a definition macro that sets a catcode to `other' non-globally
%
\def\DeclareUnicodeCharacterNativeOther#1#2{%
  \catcode"#1=\other
}

% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
% U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
% U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
% U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
% U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
% 
% Many of our renditions are less than wonderful, and all the missing
% characters are available somewhere.  Loading the necessary fonts
% awaits user request.  We can't truly support Unicode without
% reimplementing everything that's been done in LaTeX for many years,
% plus probably using luatex or xetex, and who knows what else.
% We won't be doing that here in this simple file.  But we can try to at
% least make most of the characters not bomb out.
%
\def\unicodechardefs{%
  \DeclareUnicodeCharacter{00A0}{\tie}%
  \DeclareUnicodeCharacter{00A1}{\exclamdown}%
  \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
  \DeclareUnicodeCharacter{00A3}{\pounds{}}%
  \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
  \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
  \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
  \DeclareUnicodeCharacter{00A7}{\S}%
  \DeclareUnicodeCharacter{00A8}{\"{ }}%
  \DeclareUnicodeCharacter{00A9}{\copyright{}}%
  \DeclareUnicodeCharacter{00AA}{\ordf}%
  \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
  \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
  \DeclareUnicodeCharacter{00AD}{\-}%
  \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
  \DeclareUnicodeCharacter{00AF}{\={ }}%
  %
  \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
  \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
  \DeclareUnicodeCharacter{00B2}{$^2$}%
  \DeclareUnicodeCharacter{00B3}{$^3$}%
  \DeclareUnicodeCharacter{00B4}{\'{ }}%
  \DeclareUnicodeCharacter{00B5}{$\mu$}%
  \DeclareUnicodeCharacter{00B6}{\P}%
  \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
  \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
  \DeclareUnicodeCharacter{00B9}{$^1$}%
  \DeclareUnicodeCharacter{00BA}{\ordm}%
  \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
  \DeclareUnicodeCharacter{00BC}{$1\over4$}%
  \DeclareUnicodeCharacter{00BD}{$1\over2$}%
  \DeclareUnicodeCharacter{00BE}{$3\over4$}%
  \DeclareUnicodeCharacter{00BF}{\questiondown}%
  %
  \DeclareUnicodeCharacter{00C0}{\`A}%
  \DeclareUnicodeCharacter{00C1}{\'A}%
  \DeclareUnicodeCharacter{00C2}{\^A}%
  \DeclareUnicodeCharacter{00C3}{\~A}%
  \DeclareUnicodeCharacter{00C4}{\"A}%
  \DeclareUnicodeCharacter{00C5}{\AA}%
  \DeclareUnicodeCharacter{00C6}{\AE}%
  \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
  \DeclareUnicodeCharacter{00C8}{\`E}%
  \DeclareUnicodeCharacter{00C9}{\'E}%
  \DeclareUnicodeCharacter{00CA}{\^E}%
  \DeclareUnicodeCharacter{00CB}{\"E}%
  \DeclareUnicodeCharacter{00CC}{\`I}%
  \DeclareUnicodeCharacter{00CD}{\'I}%
  \DeclareUnicodeCharacter{00CE}{\^I}%
  \DeclareUnicodeCharacter{00CF}{\"I}%
  %
  \DeclareUnicodeCharacter{00D0}{\DH}%
  \DeclareUnicodeCharacter{00D1}{\~N}%
  \DeclareUnicodeCharacter{00D2}{\`O}%
  \DeclareUnicodeCharacter{00D3}{\'O}%
  \DeclareUnicodeCharacter{00D4}{\^O}%
  \DeclareUnicodeCharacter{00D5}{\~O}%
  \DeclareUnicodeCharacter{00D6}{\"O}%
  \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
  \DeclareUnicodeCharacter{00D8}{\O}%
  \DeclareUnicodeCharacter{00D9}{\`U}%
  \DeclareUnicodeCharacter{00DA}{\'U}%
  \DeclareUnicodeCharacter{00DB}{\^U}%
  \DeclareUnicodeCharacter{00DC}{\"U}%
  \DeclareUnicodeCharacter{00DD}{\'Y}%
  \DeclareUnicodeCharacter{00DE}{\TH}%
  \DeclareUnicodeCharacter{00DF}{\ss}%
  %
  \DeclareUnicodeCharacter{00E0}{\`a}%
  \DeclareUnicodeCharacter{00E1}{\'a}%
  \DeclareUnicodeCharacter{00E2}{\^a}%
  \DeclareUnicodeCharacter{00E3}{\~a}%
  \DeclareUnicodeCharacter{00E4}{\"a}%
  \DeclareUnicodeCharacter{00E5}{\aa}%
  \DeclareUnicodeCharacter{00E6}{\ae}%
  \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
  \DeclareUnicodeCharacter{00E8}{\`e}%
  \DeclareUnicodeCharacter{00E9}{\'e}%
  \DeclareUnicodeCharacter{00EA}{\^e}%
  \DeclareUnicodeCharacter{00EB}{\"e}%
  \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
  \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
  \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
  \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
  %
  \DeclareUnicodeCharacter{00F0}{\dh}%
  \DeclareUnicodeCharacter{00F1}{\~n}%
  \DeclareUnicodeCharacter{00F2}{\`o}%
  \DeclareUnicodeCharacter{00F3}{\'o}%
  \DeclareUnicodeCharacter{00F4}{\^o}%
  \DeclareUnicodeCharacter{00F5}{\~o}%
  \DeclareUnicodeCharacter{00F6}{\"o}%
  \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
  \DeclareUnicodeCharacter{00F8}{\o}%
  \DeclareUnicodeCharacter{00F9}{\`u}%
  \DeclareUnicodeCharacter{00FA}{\'u}%
  \DeclareUnicodeCharacter{00FB}{\^u}%
  \DeclareUnicodeCharacter{00FC}{\"u}%
  \DeclareUnicodeCharacter{00FD}{\'y}%
  \DeclareUnicodeCharacter{00FE}{\th}%
  \DeclareUnicodeCharacter{00FF}{\"y}%
  %
  \DeclareUnicodeCharacter{0100}{\=A}%
  \DeclareUnicodeCharacter{0101}{\=a}%
  \DeclareUnicodeCharacter{0102}{\u{A}}%
  \DeclareUnicodeCharacter{0103}{\u{a}}%
  \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
  \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
  \DeclareUnicodeCharacter{0106}{\'C}%
  \DeclareUnicodeCharacter{0107}{\'c}%
  \DeclareUnicodeCharacter{0108}{\^C}%
  \DeclareUnicodeCharacter{0109}{\^c}%
  \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
  \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
  \DeclareUnicodeCharacter{010C}{\v{C}}%
  \DeclareUnicodeCharacter{010D}{\v{c}}%
  \DeclareUnicodeCharacter{010E}{\v{D}}%
  \DeclareUnicodeCharacter{010F}{d'}%
  %
  \DeclareUnicodeCharacter{0110}{\DH}%
  \DeclareUnicodeCharacter{0111}{\dh}%
  \DeclareUnicodeCharacter{0112}{\=E}%
  \DeclareUnicodeCharacter{0113}{\=e}%
  \DeclareUnicodeCharacter{0114}{\u{E}}%
  \DeclareUnicodeCharacter{0115}{\u{e}}%
  \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
  \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
  \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
  \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
  \DeclareUnicodeCharacter{011A}{\v{E}}%
  \DeclareUnicodeCharacter{011B}{\v{e}}%
  \DeclareUnicodeCharacter{011C}{\^G}%
  \DeclareUnicodeCharacter{011D}{\^g}%
  \DeclareUnicodeCharacter{011E}{\u{G}}%
  \DeclareUnicodeCharacter{011F}{\u{g}}%
  %
  \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
  \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
  \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
  \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
  \DeclareUnicodeCharacter{0124}{\^H}%
  \DeclareUnicodeCharacter{0125}{\^h}%
  \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
  \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
  \DeclareUnicodeCharacter{0128}{\~I}%
  \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
  \DeclareUnicodeCharacter{012A}{\=I}%
  \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
  \DeclareUnicodeCharacter{012C}{\u{I}}%
  \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
  \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
  \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
  %
  \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
  \DeclareUnicodeCharacter{0131}{\dotless{i}}%
  \DeclareUnicodeCharacter{0132}{IJ}%
  \DeclareUnicodeCharacter{0133}{ij}%
  \DeclareUnicodeCharacter{0134}{\^J}%
  \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
  \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
  \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
  \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
  \DeclareUnicodeCharacter{0139}{\'L}%
  \DeclareUnicodeCharacter{013A}{\'l}%
  \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
  \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
  \DeclareUnicodeCharacter{013D}{L'}% should kern
  \DeclareUnicodeCharacter{013E}{l'}% should kern
  \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
  %
  \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
  \DeclareUnicodeCharacter{0141}{\L}%
  \DeclareUnicodeCharacter{0142}{\l}%
  \DeclareUnicodeCharacter{0143}{\'N}%
  \DeclareUnicodeCharacter{0144}{\'n}%
  \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
  \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
  \DeclareUnicodeCharacter{0147}{\v{N}}%
  \DeclareUnicodeCharacter{0148}{\v{n}}%
  \DeclareUnicodeCharacter{0149}{'n}%
  \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
  \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
  \DeclareUnicodeCharacter{014C}{\=O}%
  \DeclareUnicodeCharacter{014D}{\=o}%
  \DeclareUnicodeCharacter{014E}{\u{O}}%
  \DeclareUnicodeCharacter{014F}{\u{o}}%
  %
  \DeclareUnicodeCharacter{0150}{\H{O}}%
  \DeclareUnicodeCharacter{0151}{\H{o}}%
  \DeclareUnicodeCharacter{0152}{\OE}%
  \DeclareUnicodeCharacter{0153}{\oe}%
  \DeclareUnicodeCharacter{0154}{\'R}%
  \DeclareUnicodeCharacter{0155}{\'r}%
  \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
  \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
  \DeclareUnicodeCharacter{0158}{\v{R}}%
  \DeclareUnicodeCharacter{0159}{\v{r}}%
  \DeclareUnicodeCharacter{015A}{\'S}%
  \DeclareUnicodeCharacter{015B}{\'s}%
  \DeclareUnicodeCharacter{015C}{\^S}%
  \DeclareUnicodeCharacter{015D}{\^s}%
  \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
  \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
  %
  \DeclareUnicodeCharacter{0160}{\v{S}}%
  \DeclareUnicodeCharacter{0161}{\v{s}}%
  \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
  \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
  \DeclareUnicodeCharacter{0164}{\v{T}}%
  \DeclareUnicodeCharacter{0165}{\v{t}}%
  \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
  \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
  \DeclareUnicodeCharacter{0168}{\~U}%
  \DeclareUnicodeCharacter{0169}{\~u}%
  \DeclareUnicodeCharacter{016A}{\=U}%
  \DeclareUnicodeCharacter{016B}{\=u}%
  \DeclareUnicodeCharacter{016C}{\u{U}}%
  \DeclareUnicodeCharacter{016D}{\u{u}}%
  \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
  \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
  %
  \DeclareUnicodeCharacter{0170}{\H{U}}%
  \DeclareUnicodeCharacter{0171}{\H{u}}%
  \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
  \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
  \DeclareUnicodeCharacter{0174}{\^W}%
  \DeclareUnicodeCharacter{0175}{\^w}%
  \DeclareUnicodeCharacter{0176}{\^Y}%
  \DeclareUnicodeCharacter{0177}{\^y}%
  \DeclareUnicodeCharacter{0178}{\"Y}%
  \DeclareUnicodeCharacter{0179}{\'Z}%
  \DeclareUnicodeCharacter{017A}{\'z}%
  \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
  \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
  \DeclareUnicodeCharacter{017D}{\v{Z}}%
  \DeclareUnicodeCharacter{017E}{\v{z}}%
  \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
  %
  \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
  \DeclareUnicodeCharacter{01C5}{D\v{z}}%
  \DeclareUnicodeCharacter{01C6}{d\v{z}}%
  \DeclareUnicodeCharacter{01C7}{LJ}%
  \DeclareUnicodeCharacter{01C8}{Lj}%
  \DeclareUnicodeCharacter{01C9}{lj}%
  \DeclareUnicodeCharacter{01CA}{NJ}%
  \DeclareUnicodeCharacter{01CB}{Nj}%
  \DeclareUnicodeCharacter{01CC}{nj}%
  \DeclareUnicodeCharacter{01CD}{\v{A}}%
  \DeclareUnicodeCharacter{01CE}{\v{a}}%
  \DeclareUnicodeCharacter{01CF}{\v{I}}%
  %
  \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
  \DeclareUnicodeCharacter{01D1}{\v{O}}%
  \DeclareUnicodeCharacter{01D2}{\v{o}}%
  \DeclareUnicodeCharacter{01D3}{\v{U}}%
  \DeclareUnicodeCharacter{01D4}{\v{u}}%
  %
  \DeclareUnicodeCharacter{01E2}{\={\AE}}%
  \DeclareUnicodeCharacter{01E3}{\={\ae}}%
  \DeclareUnicodeCharacter{01E6}{\v{G}}%
  \DeclareUnicodeCharacter{01E7}{\v{g}}%
  \DeclareUnicodeCharacter{01E8}{\v{K}}%
  \DeclareUnicodeCharacter{01E9}{\v{k}}%
  %
  \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
  \DeclareUnicodeCharacter{01F1}{DZ}%
  \DeclareUnicodeCharacter{01F2}{Dz}%
  \DeclareUnicodeCharacter{01F3}{dz}%
  \DeclareUnicodeCharacter{01F4}{\'G}%
  \DeclareUnicodeCharacter{01F5}{\'g}%
  \DeclareUnicodeCharacter{01F8}{\`N}%
  \DeclareUnicodeCharacter{01F9}{\`n}%
  \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
  \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
  \DeclareUnicodeCharacter{01FE}{\'{\O}}%
  \DeclareUnicodeCharacter{01FF}{\'{\o}}%
  %
  \DeclareUnicodeCharacter{021E}{\v{H}}%
  \DeclareUnicodeCharacter{021F}{\v{h}}%
  %
  \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
  \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
  \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
  \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
  \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
  \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
  %
  \DeclareUnicodeCharacter{0232}{\=Y}%
  \DeclareUnicodeCharacter{0233}{\=y}%
  \DeclareUnicodeCharacter{0237}{\dotless{j}}%
  %
  \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
  %
  % Greek letters upper case
  \DeclareUnicodeCharacter{0391}{{\it A}}%
  \DeclareUnicodeCharacter{0392}{{\it B}}%
  \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
  \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
  \DeclareUnicodeCharacter{0395}{{\it E}}%
  \DeclareUnicodeCharacter{0396}{{\it Z}}%
  \DeclareUnicodeCharacter{0397}{{\it H}}%
  \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
  \DeclareUnicodeCharacter{0399}{{\it I}}%
  \DeclareUnicodeCharacter{039A}{{\it K}}%
  \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
  \DeclareUnicodeCharacter{039C}{{\it M}}%
  \DeclareUnicodeCharacter{039D}{{\it N}}%
  \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
  \DeclareUnicodeCharacter{039F}{{\it O}}%
  \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
  \DeclareUnicodeCharacter{03A1}{{\it P}}%
  %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
  \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
  \DeclareUnicodeCharacter{03A4}{{\it T}}%
  \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
  \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
  \DeclareUnicodeCharacter{03A7}{{\it X}}%
  \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
  \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
  %
  % Vowels with accents
  \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
  \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
  \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
  \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
  \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
  \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
  %
  % Standalone accent
  \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
  %
  % Greek letters lower case
  \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
  \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
  \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
  \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
  \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
  \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
  \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
  \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
  \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
  \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
  \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
  \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
  \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
  \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
  \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
  \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
  \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
  \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
  \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
  \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
  \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
  \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
  \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
  \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
  \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
  %
  % More Greek vowels with accents
  \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
  \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
  \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
  \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
  \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
  %
  % Variant Greek letters
  \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
  \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
  \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
  %
  \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
  \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
  \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
  \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
  \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
  \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
  \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
  \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
  \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
  \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
  \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
  \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
  %
  \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
  \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
  %
  \DeclareUnicodeCharacter{1E20}{\=G}%
  \DeclareUnicodeCharacter{1E21}{\=g}%
  \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
  \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
  \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
  \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
  \DeclareUnicodeCharacter{1E26}{\"H}%
  \DeclareUnicodeCharacter{1E27}{\"h}%
  %
  \DeclareUnicodeCharacter{1E30}{\'K}%
  \DeclareUnicodeCharacter{1E31}{\'k}%
  \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
  \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
  \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
  \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
  \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
  \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
  \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
  \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
  \DeclareUnicodeCharacter{1E3E}{\'M}%
  \DeclareUnicodeCharacter{1E3F}{\'m}%
  %
  \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
  \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
  \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
  \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
  \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
  \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
  \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
  \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
  \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
  \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
  %
  \DeclareUnicodeCharacter{1E54}{\'P}%
  \DeclareUnicodeCharacter{1E55}{\'p}%
  \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
  \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
  \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
  \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
  \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
  \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
  \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
  \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
  %
  \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
  \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
  \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
  \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
  \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
  \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
  \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
  \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
  \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
  \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
  %
  \DeclareUnicodeCharacter{1E7C}{\~V}%
  \DeclareUnicodeCharacter{1E7D}{\~v}%
  \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
  \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
  %
  \DeclareUnicodeCharacter{1E80}{\`W}%
  \DeclareUnicodeCharacter{1E81}{\`w}%
  \DeclareUnicodeCharacter{1E82}{\'W}%
  \DeclareUnicodeCharacter{1E83}{\'w}%
  \DeclareUnicodeCharacter{1E84}{\"W}%
  \DeclareUnicodeCharacter{1E85}{\"w}%
  \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
  \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
  \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
  \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
  \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
  \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
  \DeclareUnicodeCharacter{1E8C}{\"X}%
  \DeclareUnicodeCharacter{1E8D}{\"x}%
  \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
  \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
  %
  \DeclareUnicodeCharacter{1E90}{\^Z}%
  \DeclareUnicodeCharacter{1E91}{\^z}%
  \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
  \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
  \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
  \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
  \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
  \DeclareUnicodeCharacter{1E97}{\"t}%
  \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
  \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
  %
  \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
  \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
  %
  \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
  \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
  \DeclareUnicodeCharacter{1EBC}{\~E}%
  \DeclareUnicodeCharacter{1EBD}{\~e}%
  %
  \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
  \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
  \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
  \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
  %
  \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
  \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
  %
  \DeclareUnicodeCharacter{1EF2}{\`Y}%
  \DeclareUnicodeCharacter{1EF3}{\`y}%
  \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
  %
  \DeclareUnicodeCharacter{1EF8}{\~Y}%
  \DeclareUnicodeCharacter{1EF9}{\~y}%
  %
  % Punctuation
  \DeclareUnicodeCharacter{2013}{--}%
  \DeclareUnicodeCharacter{2014}{---}%
  \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
  \DeclareUnicodeCharacter{2019}{\quoteright{}}%
  \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
  \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
  \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
  \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
  \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
  \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
  \DeclareUnicodeCharacter{2022}{\bullet{}}%
  \DeclareUnicodeCharacter{202F}{\thinspace}%
  \DeclareUnicodeCharacter{2026}{\dots{}}%
  \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
  \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
  %
  \DeclareUnicodeCharacter{20AC}{\euro{}}%
  %
  \DeclareUnicodeCharacter{2192}{\expansion{}}%
  \DeclareUnicodeCharacter{21D2}{\result{}}%
  %
  % Mathematical symbols
  \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
  \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
  \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
  \DeclareUnicodeCharacter{2212}{\minus{}}%
  \DeclareUnicodeCharacter{2217}{\ast}%
  \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
  \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
  \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
  \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
  \DeclareUnicodeCharacter{2261}{\equiv{}}%
  \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
  \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
  \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
  \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
  %
  \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
  \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
  \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
  \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
  \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
  \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
  \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
  \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
  \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
  \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
  \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
  \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
  \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
  \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
  \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
  \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
  \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
  \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
  \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
  \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
  \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
  \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
  \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
  \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
  \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
  \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
  \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
  \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
  \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
  \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
  \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
  \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
  \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
  \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
  \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
  \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
  \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
  \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
  \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
  \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
  \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
  \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
  \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
  \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
  \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
  \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
  \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
  \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
  \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
  \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
  \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
  \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
  \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
  \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
  \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
  \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
  \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
  \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
  \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
  \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
  \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
  \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
  \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
  \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
  \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
  \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
  \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
  \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
  \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
  \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
  \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
  \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
  \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
  \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
  \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
  \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
  \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
  \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
  \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
  \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
  \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
  \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
  \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
  \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
  \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
  \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
  \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
  \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
  \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
  \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
  \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
  %
  \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
  \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
  \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
  \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
  \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
  \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
  \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
  \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
  \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
  \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
  \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
  \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
  \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
  \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
  \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
  \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
  \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
  \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
  \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
  \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
  \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
  \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
  \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
  \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
  \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
  \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
  \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
  \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
  \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
  %
  \global\mathchardef\checkmark="1370% actually the square root sign
  \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
}% end of \unicodechardefs

% UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
% It makes the setting that replace UTF-8 byte sequence.
\def\utfeightchardefs{%
  \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
  \unicodechardefs
}

% Whether the active definitions of non-ASCII characters expand to
% non-active tokens with the same character code.  This is used to
% write characters literally, instead of using active definitions for
% printing the correct glyphs.
\newif\ifpassthroughchars
\passthroughcharsfalse

% For native Unicode handling (XeTeX and LuaTeX),
% provide a definition macro to replace/pass-through a Unicode character
%
\def\DeclareUnicodeCharacterNative#1#2{%
  \catcode"#1=\active
  \def\dodeclareunicodecharacternative##1##2##3{%
    \begingroup
      \uccode`\~="##2\relax
      \uppercase{\gdef~}{%
        \ifpassthroughchars
          ##1%
        \else
          ##3%
        \fi
      }
    \endgroup
  }
  \begingroup
    \uccode`\.="#1\relax
    \uppercase{\def\UTFNativeTmp{.}}%
    \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
  \endgroup
}

% Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
% It activates the setting that replaces Unicode characters.
\def\nativeunicodechardefs{%
  \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
  \unicodechardefs
}

% For native Unicode handling (XeTeX and LuaTeX),
% make the character token expand
% to the sequences given in \unicodechardefs for printing.
\def\DeclareUnicodeCharacterNativeAtU#1#2{%
  \def\UTFAtUTmp{#2}
  \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
}

% @U command definitions for native Unicode handling (XeTeX and LuaTeX).
\def\nativeunicodechardefsatu{%
  \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
  \unicodechardefs
}

% US-ASCII character definitions.
\def\asciichardefs{% nothing need be done
   \relax
}

% define all Unicode characters we know about, for the sake of @U.
\iftxinativeunicodecapable
  \nativeunicodechardefsatu
\else
  \utfeightchardefs
\fi


% Make non-ASCII characters printable again for compatibility with
% existing Texinfo documents that may use them, even without declaring a
% document encoding.
%
\setnonasciicharscatcode \other


\message{formatting,}

\newdimen\defaultparindent \defaultparindent = 15pt

\chapheadingskip = 15pt plus 4pt minus 2pt
\secheadingskip = 12pt plus 3pt minus 2pt
\subsecheadingskip = 9pt plus 2pt minus 2pt

% Prevent underfull vbox error messages.
\vbadness = 10000

% Don't be very finicky about underfull hboxes, either.
\hbadness = 6666

% Following George Bush, get rid of widows and orphans.
\widowpenalty=10000
\clubpenalty=10000

% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
% using an old version of TeX, don't do anything.  We want the amount of
% stretch added to depend on the line length, hence the dependence on
% \hsize.  We call this whenever the paper size is set.
%
\def\setemergencystretch{%
  \ifx\emergencystretch\thisisundefined
    % Allow us to assign to \emergencystretch anyway.
    \def\emergencystretch{\dimen0}%
  \else
    \emergencystretch = .15\hsize
  \fi
}

% Parameters in order: 1) textheight; 2) textwidth;
% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
% 7) physical page height; 8) physical page width.
%
% We also call \setleading{\textleading}, so the caller should define
% \textleading.  The caller should also set \parskip.
%
\def\internalpagesizes#1#2#3#4#5#6#7#8{%
  \voffset = #3\relax
  \topskip = #6\relax
  \splittopskip = \topskip
  %
  \vsize = #1\relax
  \advance\vsize by \topskip
  \outervsize = \vsize
  \advance\outervsize by 2\topandbottommargin
  \txipageheight = \vsize
  %
  \hsize = #2\relax
  \outerhsize = \hsize
  \advance\outerhsize by 0.5in
  \txipagewidth = \hsize
  %
  \normaloffset = #4\relax
  \bindingoffset = #5\relax
  %
  \ifpdf
    \pdfpageheight #7\relax
    \pdfpagewidth #8\relax
    % if we don't reset these, they will remain at "1 true in" of
    % whatever layout pdftex was dumped with.
    \pdfhorigin = 1 true in
    \pdfvorigin = 1 true in
  \else
    \ifx\XeTeXrevision\thisisundefined
      \special{papersize=#8,#7}%
    \else
      \pdfpageheight #7\relax
      \pdfpagewidth #8\relax
      % XeTeX does not have \pdfhorigin and \pdfvorigin.
    \fi
  \fi
  %
  \setleading{\textleading}
  %
  \parindent = \defaultparindent
  \setemergencystretch
}

% @letterpaper (the default).
\def\letterpaper{{\globaldefs = 1
  \parskip = 3pt plus 2pt minus 1pt
  \textleading = 13.2pt
  %
  % If page is nothing but text, make it come out even.
  \internalpagesizes{607.2pt}{6in}% that's 46 lines
                    {\voffset}{.25in}%
                    {\bindingoffset}{36pt}%
                    {11in}{8.5in}%
}}

% Use @smallbook to reset parameters for 7x9.25 trim size.
\def\smallbook{{\globaldefs = 1
  \parskip = 2pt plus 1pt
  \textleading = 12pt
  %
  \internalpagesizes{7.5in}{5in}%
                    {-.2in}{0in}%
                    {\bindingoffset}{16pt}%
                    {9.25in}{7in}%
  %
  \lispnarrowing = 0.3in
  \tolerance = 700
  \contentsrightmargin = 0pt
  \defbodyindent = .5cm
}}

% Use @smallerbook to reset parameters for 6x9 trim size.
% (Just testing, parameters still in flux.)
\def\smallerbook{{\globaldefs = 1
  \parskip = 1.5pt plus 1pt
  \textleading = 12pt
  %
  \internalpagesizes{7.4in}{4.8in}%
                    {-.2in}{-.4in}%
                    {0pt}{14pt}%
                    {9in}{6in}%
  %
  \lispnarrowing = 0.25in
  \tolerance = 700
  \contentsrightmargin = 0pt
  \defbodyindent = .4cm
}}

% Use @afourpaper to print on European A4 paper.
\def\afourpaper{{\globaldefs = 1
  \parskip = 3pt plus 2pt minus 1pt
  \textleading = 13.2pt
  %
  % Double-side printing via postscript on Laserjet 4050
  % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  % To change the settings for a different printer or situation, adjust
  % \normaloffset until the front-side and back-side texts align.  Then
  % do the same for \bindingoffset.  You can set these for testing in
  % your texinfo source file like this:
  % @tex
  % \global\normaloffset = -6mm
  % \global\bindingoffset = 10mm
  % @end tex
  \internalpagesizes{673.2pt}{160mm}% that's 51 lines
                    {\voffset}{\hoffset}%
                    {\bindingoffset}{44pt}%
                    {297mm}{210mm}%
  %
  \tolerance = 700
  \contentsrightmargin = 0pt
  \defbodyindent = 5mm
}}

% Use @afivepaper to print on European A5 paper.
% From romildo@urano.iceb.ufop.br, 2 July 2000.
% He also recommends making @example and @lisp be small.
\def\afivepaper{{\globaldefs = 1
  \parskip = 2pt plus 1pt minus 0.1pt
  \textleading = 12.5pt
  %
  \internalpagesizes{160mm}{120mm}%
                    {\voffset}{\hoffset}%
                    {\bindingoffset}{8pt}%
                    {210mm}{148mm}%
  %
  \lispnarrowing = 0.2in
  \tolerance = 800
  \contentsrightmargin = 0pt
  \defbodyindent = 2mm
  \tableindent = 12mm
}}

% A specific text layout, 24x15cm overall, intended for A4 paper.
\def\afourlatex{{\globaldefs = 1
  \afourpaper
  \internalpagesizes{237mm}{150mm}%
                    {\voffset}{4.6mm}%
                    {\bindingoffset}{7mm}%
                    {297mm}{210mm}%
  %
  % Must explicitly reset to 0 because we call \afourpaper.
  \globaldefs = 0
}}

% Use @afourwide to print on A4 paper in landscape format.
\def\afourwide{{\globaldefs = 1
  \afourpaper
  \internalpagesizes{241mm}{165mm}%
                    {\voffset}{-2.95mm}%
                    {\bindingoffset}{7mm}%
                    {297mm}{210mm}%
  \globaldefs = 0
}}

% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
% Perhaps we should allow setting the margins, \topskip, \parskip,
% and/or leading, also. Or perhaps we should compute them somehow.
%
\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
\def\pagesizesyyy#1,#2,#3\finish{{%
  \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  \globaldefs = 1
  %
  \parskip = 3pt plus 2pt minus 1pt
  \setleading{\textleading}%
  %
  \dimen0 = #1\relax
  \advance\dimen0 by \voffset
  \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
  %
  \dimen2 = \hsize
  \advance\dimen2 by \normaloffset
  \advance\dimen2 by 1in % reference point is 1 inch from left edge of page
  %
  \internalpagesizes{#1}{\hsize}%
                    {\voffset}{\normaloffset}%
                    {\bindingoffset}{44pt}%
                    {\dimen0}{\dimen2}%
}}

% Set default to letter.
%
\letterpaper

% Default value of \hfuzz, for suppressing warnings about overfull hboxes.
\hfuzz = 1pt


\message{and turning on texinfo input format.}

\def^^L{\par} % remove \outer, so ^L can appear in an @comment

% DEL is a comment character, in case @c does not suffice.
\catcode`\^^? = 14

% Define macros to output various characters with catcode for normal text.
\catcode`\"=\other \def\normaldoublequote{"}
\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
\catcode`\+=\other \def\normalplus{+}
\catcode`\<=\other \def\normalless{<}
\catcode`\>=\other \def\normalgreater{>}
\catcode`\^=\other \def\normalcaret{^}
\catcode`\_=\other \def\normalunderscore{_}
\catcode`\|=\other \def\normalverticalbar{|}
\catcode`\~=\other \def\normaltilde{~}

% This macro is used to make a character print one way in \tt
% (where it can probably be output as-is), and another way in other fonts,
% where something hairier probably needs to be done.
%
% #1 is what to print if we are indeed using \tt; #2 is what to print
% otherwise.  Since all the Computer Modern typewriter fonts have zero
% interword stretch (and shrink), and it is reasonable to expect all
% typewriter fonts to have this, we can check that font parameter.
%
\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}

% Same as above, but check for italic font.  Actually this also catches
% non-italic slanted fonts since it is impossible to distinguish them from
% italic fonts.  But since this is only used by $ and it uses \sl anyway
% this is not a problem.
\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}

% Set catcodes for Texinfo file

% Active characters for printing the wanted glyph.
% Most of these we simply print from the \tt font, but for some, we can
% use math or other variants that look better in normal text.
%
\catcode`\"=\active
\def\activedoublequote{{\tt\char34}}
\let"=\activedoublequote
\catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
\chardef\hatchar=`\^
\catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat

\catcode`\_=\active
\def_{\ifusingtt\normalunderscore\_}
\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
\let\realunder=_

\catcode`\|=\active \def|{{\tt\char124}}

\chardef \less=`\<
\catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
\chardef \gtr=`\>
\catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
\catcode`\+=\active \def+{{\tt \char 43}}
\catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
\catcode`\-=\active \let-=\normaldash


% used for headline/footline in the output routine, in case the page
% breaks in the middle of an @tex block.
\def\texinfochars{%
  \let< = \activeless
  \let> = \activegtr
  \let~ = \activetilde 
  \let^ = \activehat
  \markupsetuplqdefault \markupsetuprqdefault 
  \let\b = \strong
  \let\i = \smartitalic
  % in principle, all other definitions in \tex have to be undone too.
}

% Used sometimes to turn off (effectively) the active characters even after
% parsing them.
\def\turnoffactive{%
  \normalturnoffactive
  \otherbackslash
}

\catcode`\@=0

% \backslashcurfont outputs one backslash character in current font,
% as in \char`\\.
\global\chardef\backslashcurfont=`\\
\global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work

% \realbackslash is an actual character `\' with catcode other, and
% \doublebackslash is two of them (for the pdf outlines).
{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}

% In Texinfo, backslash is an active character; it prints the backslash
% in fixed width font.
\catcode`\\=\active  % @ for escape char from now on.

% Print a typewriter backslash.  For math mode, we can't simply use
% \backslashcurfont: the story here is that in math mode, the \char
% of \backslashcurfont ends up printing the roman \ from the math symbol
% font (because \char in math mode uses the \mathcode, and plain.tex
% sets \mathcode`\\="026E).  Hence we use an explicit \mathchar,
% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
% ignored family value; char position "5C).  We can't use " for the
% usual hex value because it has already been made active.

@def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
@let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.

% \rawbackslash defines an active \ to do \backslashcurfont.
% \otherbackslash defines an active \ to be a literal `\' character with
% catcode other.  We switch back and forth between these.
@gdef@rawbackslash{@let\=@backslashcurfont}
@gdef@otherbackslash{@let\=@realbackslash}

% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
% the literal character `\'.
%
{@catcode`- = @active
 @gdef@normalturnoffactive{%
   @passthroughcharstrue
   @let-=@normaldash
   @let"=@normaldoublequote
   @let$=@normaldollar %$ font-lock fix
   @let+=@normalplus
   @let<=@normalless
   @let>=@normalgreater
   @let^=@normalcaret
   @let_=@normalunderscore
   @let|=@normalverticalbar
   @let~=@normaltilde
   @let\=@ttbackslash
   @markupsetuplqdefault
   @markupsetuprqdefault
   @unsepspaces
 }
}

% If a .fmt file is being used, characters that might appear in a file
% name cannot be active until we have parsed the command line.
% So turn them off again, and have @fixbackslash turn them back on.
@catcode`+=@other @catcode`@_=@other

% \enablebackslashhack - allow file to begin `\input texinfo'
%
% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
% That is what \eatinput is for; after that, the `\' should revert to printing
% a backslash.
% If the file did not have a `\input texinfo', then it is turned off after
% the first line; otherwise the first `\' in the file would cause an error.
% This is used on the very last line of this file, texinfo.tex.
% We also use @c to call @fixbackslash, in case ends of lines are hidden.
{
@catcode`@^=7
@catcode`@^^M=13@gdef@enablebackslashhack{%
  @global@let\ = @eatinput%
  @catcode`@^^M=13%
  @def@c{@fixbackslash@c}%
  % Definition for the newline at the end of this file.
  @def ^^M{@let^^M@secondlinenl}%
  % Definition for a newline in the main Texinfo file.
  @gdef @secondlinenl{@fixbackslash}%
  % In case the first line has a whole-line command on it
  @let@originalparsearg@parsearg
  @def@parsearg{@fixbackslash@originalparsearg}
}}

{@catcode`@^=7 @catcode`@^^M=13%
@gdef@eatinput input texinfo#1^^M{@fixbackslash}}

% Emergency active definition of newline, in case an active newline token
% appears by mistake.
{@catcode`@^=7 @catcode13=13%
@gdef@enableemergencynewline{%
  @gdef^^M{%
    @par%
    %<warning: active newline>@par%
}}}


@gdef@fixbackslash{%
  @ifx\@eatinput @let\ = @ttbackslash @fi
  @catcode13=5 % regular end of line
  @enableemergencynewline
  @let@c=@texinfoc
  @let@parsearg@originalparsearg
  % Also turn back on active characters that might appear in the input
  % file name, in case not using a pre-dumped format.
  @catcode`+=@active
  @catcode`@_=@active
  %
  % If texinfo.cnf is present on the system, read it.
  % Useful for site-wide @afourpaper, etc.  This macro, @fixbackslash, gets
  % called at the beginning of every Texinfo file.  Not opening texinfo.cnf
  % directly in this file, texinfo.tex, makes it possible to make a format
  % file for Texinfo.
  %
  @openin 1 texinfo.cnf
  @ifeof 1 @else @input texinfo.cnf @fi
  @closein 1
}


% Say @foo, not \foo, in error messages.
@escapechar = `@@

% These (along with & and #) are made active for url-breaking, so need
% active definitions as the normal characters.
@def@normaldot{.}
@def@normalquest{?}
@def@normalslash{/}

% These look ok in all fonts, so just make them not special.
% @hashchar{} gets its own user-level command, because of #line.
@catcode`@& = @other @def@normalamp{&}
@catcode`@# = @other @def@normalhash{#}
@catcode`@% = @other @def@normalpercent{%}

@let @hashchar = @normalhash

@c Finally, make ` and ' active, so that txicodequoteundirected and
@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
@c don't make ` and ' active, @code will not get them as active chars.
@c Do this last of all since we use ` in the previous @catcode assignments.
@catcode`@'=@active
@catcode`@`=@active
@markupsetuplqdefault
@markupsetuprqdefault

@c Local variables:
@c eval: (add-hook 'write-file-hooks 'time-stamp)
@c page-delimiter: "^\\\\message\\|emacs-page"
@c time-stamp-start: "def\\\\texinfoversion{"
@c time-stamp-format: "%:y-%02m-%02d.%02H"
@c time-stamp-end: "}"
@c End:

@c vim:sw=2:

@enablebackslashhack
ar-lib000075500000013303150523165450005646 0ustar00#! /bin/sh
# Wrapper for Microsoft lib.exe

me=ar-lib
scriptversion=2012-03-01.08; # UTC

# Copyright (C) 2010-2018 Free Software Foundation, Inc.
# Written by Peter Rosin <peda@lysator.liu.se>.
#
# 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.


# func_error message
func_error ()
{
  echo "$me: $1" 1>&2
  exit 1
}

file_conv=

# func_file_conv build_file
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts.
func_file_conv ()
{
  file=$1
  case $file in
    / | /[!/]*) # absolute file, and not a UNC file
      if test -z "$file_conv"; then
	# lazily determine how to convert abs files
	case `uname -s` in
	  MINGW*)
	    file_conv=mingw
	    ;;
	  CYGWIN*)
	    file_conv=cygwin
	    ;;
	  *)
	    file_conv=wine
	    ;;
	esac
      fi
      case $file_conv in
	mingw)
	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
	  ;;
	cygwin)
	  file=`cygpath -m "$file" || echo "$file"`
	  ;;
	wine)
	  file=`winepath -w "$file" || echo "$file"`
	  ;;
      esac
      ;;
  esac
}

# func_at_file at_file operation archive
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
# for each of them.
# When interpreting the content of the @FILE, do NOT use func_file_conv,
# since the user would need to supply preconverted file names to
# binutils ar, at least for MinGW.
func_at_file ()
{
  operation=$2
  archive=$3
  at_file_contents=`cat "$1"`
  eval set x "$at_file_contents"
  shift

  for member
  do
    $AR -NOLOGO $operation:"$member" "$archive" || exit $?
  done
}

case $1 in
  '')
     func_error "no command.  Try '$0 --help' for more information."
     ;;
  -h | --h*)
    cat <<EOF
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]

Members may be specified in a file named with @FILE.
EOF
    exit $?
    ;;
  -v | --v*)
    echo "$me, version $scriptversion"
    exit $?
    ;;
esac

if test $# -lt 3; then
  func_error "you must specify a program, an action and an archive"
fi

AR=$1
shift
while :
do
  if test $# -lt 2; then
    func_error "you must specify a program, an action and an archive"
  fi
  case $1 in
    -lib | -LIB \
    | -ltcg | -LTCG \
    | -machine* | -MACHINE* \
    | -subsystem* | -SUBSYSTEM* \
    | -verbose | -VERBOSE \
    | -wx* | -WX* )
      AR="$AR $1"
      shift
      ;;
    *)
      action=$1
      shift
      break
      ;;
  esac
done
orig_archive=$1
shift
func_file_conv "$orig_archive"
archive=$file

# strip leading dash in $action
action=${action#-}

delete=
extract=
list=
quick=
replace=
index=
create=

while test -n "$action"
do
  case $action in
    d*) delete=yes  ;;
    x*) extract=yes ;;
    t*) list=yes    ;;
    q*) quick=yes   ;;
    r*) replace=yes ;;
    s*) index=yes   ;;
    S*)             ;; # the index is always updated implicitly
    c*) create=yes  ;;
    u*)             ;; # TODO: don't ignore the update modifier
    v*)             ;; # TODO: don't ignore the verbose modifier
    *)
      func_error "unknown action specified"
      ;;
  esac
  action=${action#?}
done

case $delete$extract$list$quick$replace,$index in
  yes,* | ,yes)
    ;;
  yesyes*)
    func_error "more than one action specified"
    ;;
  *)
    func_error "no action specified"
    ;;
esac

if test -n "$delete"; then
  if test ! -f "$orig_archive"; then
    func_error "archive not found"
  fi
  for member
  do
    case $1 in
      @*)
        func_at_file "${1#@}" -REMOVE "$archive"
        ;;
      *)
        func_file_conv "$1"
        $AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
        ;;
    esac
  done

elif test -n "$extract"; then
  if test ! -f "$orig_archive"; then
    func_error "archive not found"
  fi
  if test $# -gt 0; then
    for member
    do
      case $1 in
        @*)
          func_at_file "${1#@}" -EXTRACT "$archive"
          ;;
        *)
          func_file_conv "$1"
          $AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
          ;;
      esac
    done
  else
    $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
    do
      $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
    done
  fi

elif test -n "$quick$replace"; then
  if test ! -f "$orig_archive"; then
    if test -z "$create"; then
      echo "$me: creating $orig_archive"
    fi
    orig_archive=
  else
    orig_archive=$archive
  fi

  for member
  do
    case $1 in
    @*)
      func_file_conv "${1#@}"
      set x "$@" "@$file"
      ;;
    *)
      func_file_conv "$1"
      set x "$@" "$file"
      ;;
    esac
    shift
    shift
  done

  if test -n "$orig_archive"; then
    $AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
  else
    $AR -NOLOGO -OUT:"$archive" "$@" || exit $?
  fi

elif test -n "$list"; then
  if test ! -f "$orig_archive"; then
    func_error "archive not found"
  fi
  $AR -NOLOGO -LIST "$archive" || exit $?
fi
mdate-sh000075500000013732150523165450006210 0ustar00#!/bin/sh
# Get modification time of a file or directory and pretty-print it.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1995-2018 Free Software Foundation, Inc.
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
#
# 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.

if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  emulate sh
  NULLCMD=:
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
  setopt NO_GLOB_SUBST
fi

case $1 in
  '')
     echo "$0: No file.  Try '$0 --help' for more information." 1>&2
     exit 1;
     ;;
  -h | --h*)
    cat <<\EOF
Usage: mdate-sh [--help] [--version] FILE

Pretty-print the modification day of FILE, in the format:
1 January 1970

Report bugs to <bug-automake@gnu.org>.
EOF
    exit $?
    ;;
  -v | --v*)
    echo "mdate-sh $scriptversion"
    exit $?
    ;;
esac

error ()
{
  echo "$0: $1" >&2
  exit 1
}


# Prevent date giving response in another language.
LANG=C
export LANG
LC_ALL=C
export LC_ALL
LC_TIME=C
export LC_TIME

# Use UTC to get reproducible result.
TZ=UTC0
export TZ

# GNU ls changes its time format in response to the TIME_STYLE
# variable.  Since we cannot assume 'unset' works, revert this
# variable to its documented default.
if test "${TIME_STYLE+set}" = set; then
  TIME_STYLE=posix-long-iso
  export TIME_STYLE
fi

save_arg1=$1

# Find out how to get the extended ls output of a file or directory.
if ls -L /dev/null 1>/dev/null 2>&1; then
  ls_command='ls -L -l -d'
else
  ls_command='ls -l -d'
fi
# Avoid user/group names that might have spaces, when possible.
if ls -n /dev/null 1>/dev/null 2>&1; then
  ls_command="$ls_command -n"
fi

# A 'ls -l' line looks as follows on OS/2.
#  drwxrwx---        0 Aug 11  2001 foo
# This differs from Unix, which adds ownership information.
#  drwxrwx---   2 root  root      4096 Aug 11  2001 foo
#
# To find the date, we split the line on spaces and iterate on words
# until we find a month.  This cannot work with files whose owner is a
# user named "Jan", or "Feb", etc.  However, it's unlikely that '/'
# will be owned by a user whose name is a month.  So we first look at
# the extended ls output of the root directory to decide how many
# words should be skipped to get the date.

# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
set x`$ls_command /`

# Find which argument is the month.
month=
command=
until test $month
do
  test $# -gt 0 || error "failed parsing '$ls_command /' output"
  shift
  # Add another shift to the command.
  command="$command shift;"
  case $1 in
    Jan) month=January; nummonth=1;;
    Feb) month=February; nummonth=2;;
    Mar) month=March; nummonth=3;;
    Apr) month=April; nummonth=4;;
    May) month=May; nummonth=5;;
    Jun) month=June; nummonth=6;;
    Jul) month=July; nummonth=7;;
    Aug) month=August; nummonth=8;;
    Sep) month=September; nummonth=9;;
    Oct) month=October; nummonth=10;;
    Nov) month=November; nummonth=11;;
    Dec) month=December; nummonth=12;;
  esac
done

test -n "$month" || error "failed parsing '$ls_command /' output"

# Get the extended ls output of the file or directory.
set dummy x`eval "$ls_command \"\\\$save_arg1\""`

# Remove all preceding arguments
eval $command

# Because of the dummy argument above, month is in $2.
#
# On a POSIX system, we should have
#
# $# = 5
# $1 = file size
# $2 = month
# $3 = day
# $4 = year or time
# $5 = filename
#
# On Darwin 7.7.0 and 7.6.0, we have
#
# $# = 4
# $1 = day
# $2 = month
# $3 = year or time
# $4 = filename

# Get the month.
case $2 in
  Jan) month=January; nummonth=1;;
  Feb) month=February; nummonth=2;;
  Mar) month=March; nummonth=3;;
  Apr) month=April; nummonth=4;;
  May) month=May; nummonth=5;;
  Jun) month=June; nummonth=6;;
  Jul) month=July; nummonth=7;;
  Aug) month=August; nummonth=8;;
  Sep) month=September; nummonth=9;;
  Oct) month=October; nummonth=10;;
  Nov) month=November; nummonth=11;;
  Dec) month=December; nummonth=12;;
esac

case $3 in
  ???*) day=$1;;
  *) day=$3; shift;;
esac

# Here we have to deal with the problem that the ls output gives either
# the time of day or the year.
case $3 in
  *:*) set `date`; eval year=\$$#
       case $2 in
	 Jan) nummonthtod=1;;
	 Feb) nummonthtod=2;;
	 Mar) nummonthtod=3;;
	 Apr) nummonthtod=4;;
	 May) nummonthtod=5;;
	 Jun) nummonthtod=6;;
	 Jul) nummonthtod=7;;
	 Aug) nummonthtod=8;;
	 Sep) nummonthtod=9;;
	 Oct) nummonthtod=10;;
	 Nov) nummonthtod=11;;
	 Dec) nummonthtod=12;;
       esac
       # For the first six month of the year the time notation can also
       # be used for files modified in the last year.
       if (expr $nummonth \> $nummonthtod) > /dev/null;
       then
	 year=`expr $year - 1`
       fi;;
  *) year=$3;;
esac

# The result.
echo $day $month $year

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
Automake/DisjConditions.pm000064400000033745150523165450011615 0ustar00# Copyright (C) 1997-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::DisjConditions;

use 5.006;
use strict;
use Carp;
use Automake::Condition qw/TRUE FALSE/;

=head1 NAME

Automake::DisjConditions - record a disjunction of Conditions

=head1 SYNOPSIS

  use Automake::Condition;
  use Automake::DisjConditions;

  # Create a Condition to represent "COND1 and not COND2".
  my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
  # Create a Condition to represent "not COND3".
  my $other = new Automake::Condition "COND3_FALSE";

  # Create a DisjConditions to represent
  #   "(COND1 and not COND2) or (not COND3)"
  my $set = new Automake::DisjConditions $cond, $other;

  # Return the list of Conditions involved in $set.
  my @conds = $set->conds;

  # Return one of the Condition involved in $set.
  my $cond = $set->one_cond;

  # Return true iff $set is always true (i.e. its subconditions
  # cover all cases).
  if ($set->true) { ... }

  # Return false iff $set is always false (i.e. is empty, or contains
  # only false conditions).
  if ($set->false) { ... }

  # Return a string representing the DisjConditions.
  #   "COND1_TRUE COND2_FALSE | COND3_FALSE"
  my $str = $set->string;

  # Return a human readable string representing the DisjConditions.
  #   "(COND1 and !COND2) or (!COND3)"
  my $str = $set->human;

  # Merge (OR) several DisjConditions.
  my $all = $set->merge($set2, $set3, ...)

  # Invert a DisjConditions, i.e., create a new DisjConditions
  # that complements $set.
  my $inv = $set->invert;

  # Multiply two DisjConditions.
  my $prod = $set1->multiply ($set2);

  # Return the subconditions of a DisjConditions with respect to
  # a Condition.  See the description for a real example.
  my $subconds = $set->sub_conditions ($cond);

  # Check whether a new definition in condition $cond would be
  # ambiguous w.r.t. existing definitions in $set.
  ($msg, $ambig_cond) = $set->ambiguous_p ($what, $cond);

=head1 DESCRIPTION

A C<DisjConditions> is a disjunction of C<Condition>s.  In Automake
they are used to represent the conditions into which Makefile
variables and Makefile rules are defined.

If the variable C<VAR> is defined as

  if COND1
    if COND2
      VAR = value1
    endif
  endif
  if !COND3
    if COND4
      VAR = value2
    endif
  endif

then it will be associated a C<DisjConditions> created with
the following statement.

  new Automake::DisjConditions
    (new Automake::Condition ("COND1_TRUE", "COND2_TRUE"),
     new Automake::Condition ("COND3_FALSE", "COND4_TRUE"));

As you can see, a C<DisjConditions> is made from a list of
C<Condition>s.  Since C<DisjConditions> is a disjunction, and
C<Condition> is a conjunction, the above can be read as
follows.

  (COND1 and COND2) or ((not COND3) and COND4)

That's indeed the condition in which C<VAR> has a value.

Like C<Condition> objects, a C<DisjConditions> object is unique
with respect to its conditions.  Two C<DisjConditions> objects created
for the same set of conditions will have the same address.  This makes
it easy to compare C<DisjConditions>s: just compare the references.

=head2 Methods

=over 4

=item C<$set = new Automake::DisjConditions [@conds]>

Create a C<DisjConditions> object from the list of C<Condition>
objects passed in arguments.

If the C<@conds> list is empty, the C<DisjConditions> is assumed to be
false.

As explained previously, the reference (object) returned is unique
with respect to C<@conds>.  For this purpose, duplicate elements are
ignored.

=cut

# Keys in this hash are DisjConditions strings. Values are the
# associated object DisjConditions.  This is used by 'new' to reuse
# DisjConditions objects with identical conditions.
use vars '%_disjcondition_singletons';

sub new ($;@)
{
  my ($class, @conds) = @_;
  my @filtered_conds = ();
  for my $cond (@conds)
    {
      confess "'$cond' isn't a reference" unless ref $cond;
      confess "'$cond' isn't an Automake::Condition"
	unless $cond->isa ("Automake::Condition");

      # This is a disjunction of conditions, so we drop
      # false conditions.  We'll always treat an "empty"
      # DisjConditions as false for this reason.
      next if $cond->false;

      push @filtered_conds, $cond;
    }

  my $string;
  if (@filtered_conds)
    {
      @filtered_conds = sort { $a->string cmp $b->string } @filtered_conds;
      $string = join (' | ', map { $_->string } @filtered_conds);
    }
  else
    {
      $string = 'FALSE';
    }

  # Return any existing identical DisjConditions.
  my $me = $_disjcondition_singletons{$string};
  return $me if $me;

  # Else, create a new DisjConditions.

  # Store conditions as keys AND as values, because blessed
  # objects are converted to strings when used as keys (so
  # at least we still have the value when we need to call
  # a method).
  my %h = map {$_ => $_} @filtered_conds;

  my $self = {
    hash => \%h,
    string => $string,
    conds => \@filtered_conds,
  };
  bless $self, $class;

  $_disjcondition_singletons{$string} = $self;
  return $self;
}


=item C<CLONE>

Internal special subroutine to fix up the self hashes in
C<%_disjcondition_singletons> upon thread creation.  C<CLONE> is invoked
automatically with ithreads from Perl 5.7.2 or later, so if you use this
module with earlier versions of Perl, it is not thread-safe.

=cut

sub CLONE
{
  foreach my $self (values %_disjcondition_singletons)
    {
      my %h = map { $_ => $_ } @{$self->{'conds'}};
      $self->{'hash'} = \%h;
    }
}


=item C<@conds = $set-E<gt>conds>

Return the list of C<Condition> objects involved in C<$set>.

=cut

sub conds ($ )
{
  my ($self) = @_;
  return @{$self->{'conds'}};
}

=item C<$cond = $set-E<gt>one_cond>

Return one C<Condition> object involved in C<$set>.

=cut

sub one_cond ($)
{
  my ($self) = @_;
  return (%{$self->{'hash'}},)[1];
}

=item C<$et = $set-E<gt>false>

Return 1 iff the C<DisjConditions> object is always false (i.e., if it
is empty, or if it contains only false C<Condition>s). Return 0
otherwise.

=cut

sub false ($ )
{
  my ($self) = @_;
  return 0 == keys %{$self->{'hash'}};
}

=item C<$et = $set-E<gt>true>

Return 1 iff the C<DisjConditions> object is always true (i.e. covers all
conditions). Return 0 otherwise.

=cut

sub true ($ )
{
  my ($self) = @_;
  return $self->invert->false;
}

=item C<$str = $set-E<gt>string>

Build a string which denotes the C<DisjConditions>.

=cut

sub string ($ )
{
  my ($self) = @_;
  return $self->{'string'};
}

=item C<$cond-E<gt>human>

Build a human readable string which denotes the C<DisjConditions>.

=cut

sub human ($ )
{
  my ($self) = @_;

  return $self->{'human'} if defined $self->{'human'};

  my $res = '';
  if ($self->false)
    {
      $res = 'FALSE';
    }
  else
    {
      my @c = $self->conds;
      if (1 == @c)
	{
	  $res = $c[0]->human;
	}
      else
	{
	  $res = '(' . join (') or (', map { $_->human } $self->conds) . ')';
	}
    }
  $self->{'human'} = $res;
  return $res;
}


=item C<$newcond = $cond-E<gt>merge (@otherconds)>

Return a new C<DisjConditions> which is the disjunction of
C<$cond> and C<@otherconds>.  Items in C<@otherconds> can be
@C<Condition>s or C<DisjConditions>.

=cut

sub merge ($@)
{
  my ($self, @otherconds) = @_;
  new Automake::DisjConditions (
    map { $_->isa ("Automake::DisjConditions") ? $_->conds : $_ }
        ($self, @otherconds));
}


=item C<$prod = $set1-E<gt>multiply ($set2)>

Multiply two conditional sets.

  my $set1 = new Automake::DisjConditions
    (new Automake::Condition ("A_TRUE"),
     new Automake::Condition ("B_TRUE"));
  my $set2 = new Automake::DisjConditions
    (new Automake::Condition ("C_FALSE"),
     new Automake::Condition ("D_FALSE"));

C<$set1-E<gt>multiply ($set2)> will return

  new Automake::DisjConditions
    (new Automake::Condition ("A_TRUE", "C_FALSE"),
     new Automake::Condition ("B_TRUE", "C_FALSE"),;
     new Automake::Condition ("A_TRUE", "D_FALSE"),
     new Automake::Condition ("B_TRUE", "D_FALSE"));

The argument can also be a C<Condition>.

=cut

# Same as multiply() but take a list of Conditionals as second argument.
# We use this in invert().
sub _multiply ($@)
{
  my ($self, @set) = @_;
  my @res = map { $_->multiply (@set) } $self->conds;
  return new Automake::DisjConditions (Automake::Condition::reduce_or @res);
}

sub multiply ($$)
{
  my ($self, $set) = @_;
  return $self->_multiply ($set) if $set->isa('Automake::Condition');
  return $self->_multiply ($set->conds);
}

=item C<$inv = $set-E<gt>invert>

Invert a C<DisjConditions>.  Return a C<DisjConditions> which is true
when C<$set> is false, and vice-versa.

  my $set = new Automake::DisjConditions
    (new Automake::Condition ("A_TRUE", "B_TRUE"),
     new Automake::Condition ("A_FALSE", "B_FALSE"));

Calling C<$set-E<gt>invert> will return the following C<DisjConditions>.

  new Automake::DisjConditions
    (new Automake::Condition ("A_TRUE", "B_FALSE"),
     new Automake::Condition ("A_FALSE", "B_TRUE"));

We implement the inversion by a product-of-sums to sum-of-products
conversion using repeated multiplications.  Because of the way we
implement multiplication, the result of inversion is in canonical
prime implicant form.

=cut

sub invert($ )
{
  my ($self) = @_;

  return $self->{'invert'} if defined $self->{'invert'};

  # The invert of an empty DisjConditions is TRUE.
  my $res = new Automake::DisjConditions TRUE;

  #   !((a.b)+(c.d)+(e.f))
  # = (!a+!b).(!c+!d).(!e+!f)
  # We develop this into a sum of product iteratively, starting from TRUE:
  # 1) TRUE
  # 2) TRUE.!a + TRUE.!b
  # 3) TRUE.!a.!c + TRUE.!b.!c + TRUE.!a.!d + TRUE.!b.!d
  # 4) TRUE.!a.!c.!e + TRUE.!b.!c.!e + TRUE.!a.!d.!e + TRUE.!b.!d.!e
  #    + TRUE.!a.!c.!f + TRUE.!b.!c.!f + TRUE.!a.!d.!f + TRUE.!b.!d.!f
  foreach my $cond ($self->conds)
    {
      $res = $res->_multiply ($cond->not);
    }

  # Cache result.
  $self->{'invert'} = $res;
  # It's tempting to also set $res->{'invert'} to $self, but that
  # is a bad idea as $self hasn't been normalized in any way.
  # (Different inputs can produce the same inverted set.)
  return $res;
}

=item C<$self-E<gt>simplify>

Return a C<Disjunction> which is a simplified canonical form of C<$self>.
This canonical form contains only prime implicants, but it can contain
non-essential prime implicants.

=cut

sub simplify ($)
{
  my ($self) = @_;
  return $self->invert->invert;
}

=item C<$self-E<gt>sub_conditions ($cond)>

Return the subconditions of C<$self> that contains C<$cond>, with
C<$cond> stripped.  More formally, return C<$res> such that
C<$res-E<gt>multiply ($cond) == $self-E<gt>multiply ($cond)> and
C<$res> does not mention any of the variables in C<$cond>.

For instance, consider:

  my $a = new Automake::DisjConditions
    (new Automake::Condition ("A_TRUE", "B_TRUE"),
     new Automake::Condition ("A_TRUE", "C_FALSE"),
     new Automake::Condition ("A_TRUE", "B_FALSE", "C_TRUE"),
     new Automake::Condition ("A_FALSE"));
  my $b = new Automake::DisjConditions
    (new Automake::Condition ("A_TRUE", "B_FALSE"));

Calling C<$a-E<gt>sub_conditions ($b)> will return the following
C<DisjConditions>.

  new Automake::DisjConditions
    (new Automake::Condition ("C_FALSE"), # From A_TRUE C_FALSE
     new Automake::Condition ("C_TRUE")); # From A_TRUE B_FALSE C_TRUE"

=cut

sub sub_conditions ($$)
{
  my ($self, $subcond) = @_;

  # Make $subcond blindingly apparent in the DisjConditions.
  # For instance '$b->multiply($a->conds)' (from the POD example) is:
  # 	(new Automake::Condition ("FALSE"),
  # 	 new Automake::Condition ("A_TRUE", "B_FALSE", "C_FALSE"),
  # 	 new Automake::Condition ("A_TRUE", "B_FALSE", "C_TRUE"),
  # 	 new Automake::Condition ("FALSE"))
  my @prodconds = $subcond->multiply ($self->conds);

  # Now, strip $subcond from the remaining (i.e., non-false) Conditions.
  my @res = map { $_->false ? () : $_->strip ($subcond) } @prodconds;

  return new Automake::DisjConditions @res;
}

=item C<($string, $ambig_cond) = $condset-E<gt>ambiguous_p ($what, $cond)>

Check for an ambiguous condition.  Return an error message and the
other condition involved if we have an ambiguity.  Return an empty
string and FALSE otherwise.

C<$what> is the name of the thing being defined, to use in the error
message.  C<$cond> is the C<Condition> under which it is being
defined.  C<$condset> is the C<DisjConditions> under which it had
already been defined.

=cut

sub ambiguous_p ($$$)
{
  my ($self, $var, $cond) = @_;

  # Note that these rules don't consider the following
  # example as ambiguous.
  #
  #   if COND1
  #     FOO = foo
  #   endif
  #   if COND2
  #     FOO = bar
  #   endif
  #
  # It's up to the user to not define COND1 and COND2
  # simultaneously.

  return ("$var multiply defined in condition " . $cond->human, $cond)
    if exists $self->{'hash'}{$cond};

  foreach my $vcond ($self->conds)
    {
      return ("$var was already defined in condition " . $vcond->human
	      . ", which includes condition ". $cond->human, $vcond)
	if $vcond->true_when ($cond);

      return ("$var was already defined in condition " . $vcond->human
	      . ", which is included in condition " . $cond->human, $vcond)
	if $cond->true_when ($vcond);
    }
  return ('', FALSE);
}

=head1 SEE ALSO

L<Automake::Condition>.

=head1 HISTORY

C<AM_CONDITIONAL>s and supporting code were added to Automake 1.1o by
Ian Lance Taylor <ian@cygnus.org> in 1997.  Since then it has been
improved by Tom Tromey <tromey@redhat.com>, Richard Boulton
<richard@tartarus.org>, Raja R Harinath <harinath@cs.umn.edu>, Akim
Demaille <akim@epita.fr>, Pavel Roskin <proski@gnu.org>, and
Alexandre Duret-Lutz <adl@gnu.org>.

=cut

1;
Automake/VarDef.pm000064400000020561150523165450010031 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::VarDef;

use 5.006;
use strict;
use Carp;
use Automake::ChannelDefs;
use Automake::ItemDef;

require Exporter;
use vars '@ISA', '@EXPORT';
@ISA = qw/Automake::ItemDef Exporter/;
@EXPORT = qw (&VAR_AUTOMAKE &VAR_CONFIGURE &VAR_MAKEFILE
	      &VAR_ASIS &VAR_PRETTY &VAR_SILENT &VAR_SORTED);

=head1 NAME

Automake::VarDef - a class for variable definitions

=head1 SYNOPSIS

  use Automake::VarDef;
  use Automake::Location;

  # Create a VarDef for a definition such as
  # | # any comment
  # | foo = bar # more comment
  # in Makefile.am
  my $loc = new Automake::Location 'Makefile.am:2';
  my $def = new Automake::VarDef ('foo', 'bar # more comment',
                                  '# any comment',
                                  $loc, '', VAR_MAKEFILE, VAR_ASIS);

  # Appending to a definition.
  $def->append ('value to append', 'comment to append');

  # Accessors.
  my $value    = $def->value;  # with trailing '#' comments and
                               # continuation ("\\\n") omitted.
  my $value    = $def->raw_value; # the real value, as passed to new().
  my $comment  = $def->comment;
  my $location = $def->location;
  my $type     = $def->type;
  my $owner    = $def->owner;
  my $pretty   = $def->pretty;

  # Changing owner.
  $def->set_owner (VAR_CONFIGURE,
                   new Automake::Location 'configure.ac:15');

  # Marking examined definitions.
  $def->set_seen;
  my $seen_p = $def->seen;

  # Printing a variable for debugging.
  print STDERR $def->dump;

=head1 DESCRIPTION

This class gathers data related to one Makefile-variable definition.

=head2 Constants

=over 4

=item C<VAR_AUTOMAKE>, C<VAR_CONFIGURE>, C<VAR_MAKEFILE>

Possible owners for variables.  A variable can be defined
by Automake, in F<configure.ac> (using C<AC_SUBST>), or in
the user's F<Makefile.am>.

=cut

# Defined so that the owner of a variable can only be increased (e.g
# Automake should not override a configure or Makefile variable).
use constant VAR_AUTOMAKE => 0; # Variable defined by Automake.
use constant VAR_CONFIGURE => 1;# Variable defined in configure.ac.
use constant VAR_MAKEFILE => 2; # Variable defined in Makefile.am.

=item C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, C<VAR_SORTED>

Possible print styles.  C<VAR_ASIS> variables should be output as-is.
C<VAR_PRETTY> variables are wrapped on multiple lines if they cannot
fit on one.  C<VAR_SILENT> variables are not output at all.  Finally,
C<VAR_SORTED> variables should be sorted and then handled as
C<VAR_PRETTY> variables.

C<VAR_SILENT> variables can also be overridden silently (unlike the
other kinds of variables whose overriding may sometimes produce
warnings).

=cut

# Possible values for pretty.
use constant VAR_ASIS => 0;	# Output as-is.
use constant VAR_PRETTY => 1;	# Pretty printed on output.
use constant VAR_SILENT => 2;	# Not output.  (Can also be
				# overridden silently.)
use constant VAR_SORTED => 3;	# Sorted and pretty-printed.

=back

=head2 Methods

C<VarDef> defines the following methods in addition to those inherited
from L<Automake::ItemDef>.

=over 4

=item C<my $def = new Automake::VarDef ($varname, $value, $comment, $location, $type, $owner, $pretty)>

Create a new Makefile-variable definition.  C<$varname> is the name of
the variable being defined and C<$value> its value.

C<$comment> is any comment preceding the definition.  (Because
Automake reorders variable definitions in the output, it also tries to
carry comments around.)

C<$location> is the place where the definition occurred, it should be
an instance of L<Automake::Location>.

C<$type> should be C<''> for definitions made with C<=>, and C<':'>
for those made with C<:=>.

C<$owner> specifies who owns the variables, it can be one of
C<VAR_AUTOMAKE>, C<VAR_CONFIGURE>, or C<VAR_MAKEFILE> (see these
definitions).

Finally, C<$pretty> tells how the variable should be output, and can
be one of C<VAR_ASIS>, C<VAR_PRETTY>, or C<VAR_SILENT>, or
C<VAR_SORTED> (see these definitions).

=cut

sub new ($$$$$$$$)
{
  my ($class, $var, $value, $comment, $location, $type, $owner, $pretty) = @_;

  # A user variable must be set by either '=' or ':=', and later
  # promoted to '+='.
  if ($owner != VAR_AUTOMAKE && $type eq '+')
    {
      error $location, "$var must be set with '=' before using '+='";
    }

  my $self = Automake::ItemDef::new ($class, $comment, $location, $owner);
  $self->{'value'} = $value;
  $self->{'type'} = $type;
  $self->{'pretty'} = $pretty;
  $self->{'seen'} = 0;
  return $self;
}

=item C<$def-E<gt>append ($value, $comment)>

Append C<$value> and <$comment> to the existing value and comment of
C<$def>.  This is normally called on C<+=> definitions.

=cut

sub append ($$$)
{
  my ($self, $value, $comment) = @_;
  $self->{'comment'} .= $comment;

  my $val = $self->{'value'};

  # Strip comments from augmented variables.  This is so that
  #   VAR = foo # com
  #   VAR += bar
  # does not become
  #   VAR = foo # com bar
  # Furthermore keeping '#' would not be portable if the variable is
  # output on multiple lines.
  $val =~ s/ ?#.*//;
  # Insert a separator, if required.
  $val .= ' ' if $val;
  $self->{'value'} = $val . $value;
  # Turn ASIS appended variables into PRETTY variables.  This is to
  # cope with 'make' implementation that cannot read very long lines.
  $self->{'pretty'} = VAR_PRETTY if $self->{'pretty'} == VAR_ASIS;
}

=item C<$def-E<gt>value>

=item C<$def-E<gt>raw_value>

=item C<$def-E<gt>type>

=item C<$def-E<gt>pretty>

Accessors to the various constituents of a C<VarDef>.  See the
documentation of C<new>'s arguments for a description of these.

=cut

sub value ($)
{
  my ($self) = @_;
  my $val = $self->raw_value;
  # Strip anything past '#'.  '#' characters cannot be escaped
  # in Makefiles, so we don't have to be smart.
  $val =~ s/#.*$//s;
  # Strip backslashes.
  $val =~ s/\\$/ /mg;
  return $val;
}

sub raw_value ($)
{
  my ($self) = @_;
  return $self->{'value'};
}

sub type ($)
{
  my ($self) = @_;
  return $self->{'type'};
}

sub pretty ($)
{
  my ($self) = @_;
  return $self->{'pretty'};
}

=item C<$def-E<gt>set_owner ($owner, $location)>

Change the owner of a definition.  This usually happens because
the user used C<+=> on an Automake variable, so (s)he now owns
the content.  C<$location> should be an instance of L<Automake::Location>
indicating where the change took place.

=cut

sub set_owner ($$$)
{
  my ($self, $owner, $location) = @_;
  # We always adjust the location when the owner changes (even for
  # '+=' statements).  The risk otherwise is to warn about
  # a VAR_MAKEFILE variable and locate it in configure.ac...
  $self->{'owner'} = $owner;
  $self->{'location'} = $location;
}

=item C<$def-E<gt>set_seen>

=item C<$bool = $def-E<gt>seen>

These function allows Automake to mark (C<set_seen>) variable that
it has examined in some way, and latter check (using C<seen>) for
unused variables.  Unused variables usually indicate typos.

=cut

sub set_seen ($)
{
  my ($self) = @_;
  $self->{'seen'} = 1;
}

sub seen ($)
{
  my ($self) = @_;
  return $self->{'seen'};
}

=item C<$str = $def-E<gt>dump>

Format the contents of C<$def> as a human-readable string,
for debugging.

=cut

sub dump ($)
{
  my ($self) = @_;
  my $owner = $self->owner;

  if ($owner == VAR_AUTOMAKE)
    {
      $owner = 'Automake';
    }
  elsif ($owner == VAR_CONFIGURE)
    {
      $owner = 'Configure';
    }
  elsif ($owner == VAR_MAKEFILE)
    {
      $owner = 'Makefile';
    }
  else
    {
      prog_error ("unexpected owner");
    }

  my $where = $self->location->dump;
  my $comment = $self->comment;
  my $value = $self->raw_value;
  my $type = $self->type;

  return "{
      type: $type=
      where: $where      comment: $comment
      value: $value
      owner: $owner
    }\n";
}

=back

=head1 SEE ALSO

L<Automake::Variable>, L<Automake::ItemDef>.

=cut

1;
Automake/Rule.pm000064400000057157150523165450007604 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Rule;

use 5.006;
use strict;
use Carp;

use Automake::Item;
use Automake::RuleDef;
use Automake::ChannelDefs;
use Automake::Channels;
use Automake::Options;
use Automake::Condition qw (TRUE FALSE);
use Automake::DisjConditions;
require Exporter;
use vars '@ISA', '@EXPORT', '@EXPORT_OK';
@ISA = qw/Automake::Item Exporter/;
@EXPORT = qw (reset register_suffix_rule next_in_suffix_chain
	      suffixes rules $KNOWN_EXTENSIONS_PATTERN
	      depend %dependencies %actions register_action
	      accept_extensions
	      reject_rule msg_rule msg_cond_rule err_rule err_cond_rule
	      rule rrule ruledef rruledef);

=head1 NAME

Automake::Rule - support for rules definitions

=head1 SYNOPSIS

  use Automake::Rule;
  use Automake::RuleDef;


=head1 DESCRIPTION

This package provides support for Makefile rule definitions.

An C<Automake::Rule> is a rule name associated to possibly
many conditional definitions.  These definitions are instances
of C<Automake::RuleDef>.

Therefore obtaining the value of a rule under a given
condition involves two lookups.  One to look up the rule,
and one to look up the conditional definition:

  my $rule = rule $name;
  if ($rule)
    {
      my $def = $rule->def ($cond);
      if ($def)
	{
	  return $def->location;
	}
      ...
    }
  ...

when it is known that the rule and the definition
being looked up exist, the above can be simplified to

  return rule ($name)->def ($cond)->location; # do not write this.

but is better written

  return rrule ($name)->rdef ($cond)->location;

or even

  return rruledef ($name, $cond)->location;

The I<r> variants of the C<rule>, C<def>, and C<ruledef> methods add
an extra test to ensure that the lookup succeeded, and will diagnose
failures as internal errors (with a message which is much more
informative than Perl's warning about calling a method on a
non-object).

=head2 Global variables

=over 4

=cut

my $_SUFFIX_RULE_PATTERN =
  '^(\.[a-zA-Z0-9_(){}$+@\-]+)(\.[a-zA-Z0-9_(){}$+@\-]+)' . "\$";

my @_suffixes = ();
my @_known_extensions_list = ();
my %_rule_dict = ();

# See comments in the implementation of the 'next_in_suffix_chain()'
# variable for details.
my %_suffix_rules;

# Same as $suffix_rules, but records only the default rules
# supplied by the languages Automake supports.
my %_suffix_rules_builtin;

=item C<%dependencies>

Holds the dependencies of targets which dependencies are factored.
Typically, C<.PHONY> will appear in plenty of F<*.am> files, but must
be output once.  Arguably all pure dependencies could be subject to
this factoring, but it is not unpleasant to have paragraphs in
Makefile: keeping related stuff altogether.

=cut

use vars '%dependencies';

=item <%actions>

Holds the factored actions.  Tied to C<%dependencies>, i.e., filled
only when keys exists in C<%dependencies>.

=cut

use vars '%actions';

=item C<$KNOWN_EXTENSIONS_PATTERN>

Pattern that matches all know input extensions (i.e. extensions used
by the languages supported by Automake).  Using this pattern (instead
of '\..*$') to match extensions allows Automake to support dot-less
extensions.

New extensions should be registered with C<accept_extensions>.

=cut

use vars qw ($KNOWN_EXTENSIONS_PATTERN);
$KNOWN_EXTENSIONS_PATTERN = "";

=back

=head2 Error reporting functions

In these functions, C<$rule> can be either a rule name, or
an instance of C<Automake::Rule>.

=over 4

=item C<err_rule ($rule, $message, [%options])>

Uncategorized errors about rules.

=cut

sub err_rule ($$;%)
{
  msg_rule ('error', @_);
}

=item C<err_cond_rule ($cond, $rule, $message, [%options])>

Uncategorized errors about conditional rules.

=cut

sub err_cond_rule ($$$;%)
{
  msg_cond_rule ('error', @_);
}

=item C<msg_cond_rule ($channel, $cond, $rule, $message, [%options])>

Messages about conditional rules.

=cut

sub msg_cond_rule ($$$$;%)
{
  my ($channel, $cond, $rule, $msg, %opts) = @_;
  my $r = ref ($rule) ? $rule : rrule ($rule);
  msg $channel, $r->rdef ($cond)->location, $msg, %opts;
}

=item C<msg_rule ($channel, $targetname, $message, [%options])>

Messages about rules.

=cut

sub msg_rule ($$$;%)
{
  my ($channel, $rule, $msg, %opts) = @_;
  my $r = ref ($rule) ? $rule : rrule ($rule);
  # Don't know which condition is concerned.  Pick any.
  my $cond = $r->conditions->one_cond;
  msg_cond_rule ($channel, $cond, $r, $msg, %opts);
}


=item C<$bool = reject_rule ($rule, $error_msg)>

Bail out with C<$error_msg> if a rule with name C<$rule> has been
defined.

Return true iff C<$rule> is defined.

=cut

sub reject_rule ($$)
{
  my ($rule, $msg) = @_;
  if (rule ($rule))
    {
      err_rule $rule, $msg;
      return 1;
    }
  return 0;
}

=back

=head2 Administrative functions

=over 4

=item C<accept_extensions (@exts)>

Update C<$KNOWN_EXTENSIONS_PATTERN> to recognize the extensions
listed in C<@exts>.  Extensions should contain a dot if needed.

=cut

sub accept_extensions (@)
{
    push @_known_extensions_list, @_;
    $KNOWN_EXTENSIONS_PATTERN =
	'(?:' . join ('|', map (quotemeta, @_known_extensions_list)) . ')';
}

=item C<rules>

Return the list of all L<Automake::Rule> instances.  (I.e., all
rules defined so far.)

=cut

sub rules ()
{
  return values %_rule_dict;
}


=item C<register_action($target, $action)>

Append the C<$action> to C<$actions{$target}> taking care of special
cases.

=cut

sub register_action ($$)
{
  my ($target, $action) = @_;
  if ($actions{$target})
    {
      $actions{$target} .= "\n$action" if $action;
    }
  else
    {
      $actions{$target} = $action;
    }
}


=item C<Automake::Rule::reset>

The I<forget all> function.  Clears all known rules and resets some
other internal data.

=cut

sub reset()
{
  %_rule_dict = ();
  @_suffixes = ();
  %_suffix_rules = %_suffix_rules_builtin;

  %dependencies =
    (
     # Texinfoing.
     'dvi'      => [],
     'dvi-am'   => [],
     'pdf'      => [],
     'pdf-am'   => [],
     'ps'       => [],
     'ps-am'    => [],
     'info'     => [],
     'info-am'  => [],
     'html'     => [],
     'html-am'  => [],

     # Installing/uninstalling.
     'install-data-am'      => [],
     'install-exec-am'      => [],
     'uninstall-am'         => [],

     'install-man'	    => [],
     'uninstall-man'	    => [],

     'install-dvi'          => [],
     'install-dvi-am'       => [],
     'install-html'         => [],
     'install-html-am'      => [],
     'install-info'         => [],
     'install-info-am'      => [],
     'install-pdf'          => [],
     'install-pdf-am'       => [],
     'install-ps'           => [],
     'install-ps-am'        => [],

     'installcheck-am'      => [],

     # Cleaning.
     'clean-am'             => [],
     'mostlyclean-am'       => [],
     'maintainer-clean-am'  => [],
     'distclean-am'         => [],
     'clean'                => [],
     'mostlyclean'          => [],
     'maintainer-clean'     => [],
     'distclean'            => [],

     # Tarballing.
     'dist-all'             => [],

     '.PHONY'               => [],
     '.PRECIOUS'            => [],
     # Recursive install targets (so "make -n install" works for BSD Make).
     '.MAKE'		    => [],
     );
  %actions = ();
}

=item C<next_in_suffix_chain ($ext1, $ext2)>

Return the target suffix for the next rule to use to reach C<$ext2>
from C<$ext1>, or C<undef> if no such rule exists.

=cut

sub next_in_suffix_chain ($$)
{
  my ($ext1, $ext2) = @_;
  return undef unless (exists $_suffix_rules{$ext1} and
                       exists $_suffix_rules{$ext1}{$ext2});
  return $_suffix_rules{$ext1}{$ext2}[0];
}

=item C<register_suffix_rule ($where, $src, $dest)>

Register a suffix rule defined on C<$where> that transforms
files ending in C<$src> into files ending in C<$dest>.

=cut

sub register_suffix_rule ($$$)
{
  my ($where, $src, $dest) = @_;
  my $suffix_rules = $where->{'position'} ? \%_suffix_rules
                                          : \%_suffix_rules_builtin;

  verb "Sources ending in $src become $dest";
  push @_suffixes, $src, $dest;

  # When transforming sources to objects, Automake uses the
  # %suffix_rules to move from each source extension to
  # '.$(OBJEXT)', not to '.o' or '.obj'.  However some people
  # define suffix rules for '.o' or '.obj', so internally we will
  # consider these extensions equivalent to '.$(OBJEXT)'.  We
  # CANNOT rewrite the target (i.e., automagically replace '.o'
  # and '.obj' by '.$(OBJEXT)' in the output), or warn the user
  # that (s)he'd better use '.$(OBJEXT)', because Automake itself
  # output suffix rules for '.o' or '.obj' ...
  $dest = '.$(OBJEXT)' if ($dest eq '.o' || $dest eq '.obj');

  # ----------------------------------------------------------------------
  # The $suffix_rules variable maps the source extension for all suffix
  # rules seen to a hash whose keys are the possible output extensions.
  #
  # Note that this is transitively closed by construction:
  # if we have
  #
  #       exists $suffix_rules{$ext1}{$ext2}
  #    && exists $suffix_rules{$ext2}{$ext3}
  #
  # then we also have
  #
  #       exists $suffix_rules{$ext1}{$ext3}
  #
  # So it's easy to check whether '.foo' can be transformed to
  # '.$(OBJEXT)' by checking whether $suffix_rules{'.foo'}{'.$(OBJEXT)'}
  # exists.  This will work even if transforming '.foo' to '.$(OBJEXT)'
  # involves a chain of several suffix rules.
  #
  # The value of $suffix_rules{$ext1}{$ext2} is a pair [$next_sfx, $dist]
  # where $next_sfx is target suffix for the next rule to use to reach
  # $ext2, and $dist the distance to $ext2.
  # ----------------------------------------------------------------------

  # Register $dest as a possible destination from $src.
  # We might have the create the \hash.
  if (exists $suffix_rules->{$src})
    {
      $suffix_rules->{$src}{$dest} = [ $dest, 1 ];
    }
  else
    {
      $suffix_rules->{$src} = { $dest => [ $dest, 1 ] };
    }

  # If we know how to transform $dest in something else, then
  # we know how to transform $src in that "something else".
  if (exists $suffix_rules->{$dest})
    {
      for my $dest2 (keys %{$suffix_rules->{$dest}})
	{
	  my $dist = $suffix_rules->{$dest}{$dest2}[1] + 1;
	  # Overwrite an existing $src->$dest2 path only if
	  # the path via $dest which is shorter.
	  if (! exists $suffix_rules->{$src}{$dest2}
	      || $suffix_rules->{$src}{$dest2}[1] > $dist)
	    {
	      $suffix_rules->{$src}{$dest2} = [ $dest, $dist ];
	    }
	}
    }

  # Similarly, any extension that can be derived into $src
  # can be derived into the same extensions as $src can.
  my @dest2 = keys %{$suffix_rules->{$src}};
  for my $src2 (keys %$suffix_rules)
    {
      if (exists $suffix_rules->{$src2}{$src})
	{
	  for my $dest2 (@dest2)
	    {
	      my $dist = $suffix_rules->{$src}{$dest2} + 1;
	      # Overwrite an existing $src2->$dest2 path only if
	      # the path via $src is shorter.
	      if (! exists $suffix_rules->{$src2}{$dest2}
		  || $suffix_rules->{$src2}{$dest2}[1] > $dist)
		{
		  $suffix_rules->{$src2}{$dest2} = [ $src, $dist ];
		}
	    }
	}
    }
}

=item C<@list = suffixes>

Return the list of known suffixes.

=cut

sub suffixes ()
{
  return @_suffixes;
}

=item C<rule ($rulename)>

Return the C<Automake::Rule> object for the rule
named C<$rulename> if defined.  Return 0 otherwise.

=cut

sub rule ($)
{
  my ($name) = @_;
  # Strip $(EXEEXT) from $name, so we can diagnose
  # a clash if 'ctags$(EXEEXT):' is redefined after 'ctags:'.
  $name =~ s,\$\(EXEEXT\)$,,;
  return $_rule_dict{$name} || 0;
}

=item C<ruledef ($rulename, $cond)>

Return the C<Automake::RuleDef> object for the rule named
C<$rulename> if defined in condition C<$cond>.  Return false
if the condition or the rule does not exist.

=cut

sub ruledef ($$)
{
  my ($name, $cond) = @_;
  my $rule = rule $name;
  return $rule && $rule->def ($cond);
}

=item C<rrule ($rulename)

Return the C<Automake::Rule> object for the variable named
C<$rulename>.  Abort with an internal error if the variable was not
defined.

The I<r> in front of C<var> stands for I<required>.  One
should call C<rvar> to assert the rule's existence.

=cut

sub rrule ($)
{
  my ($name) = @_;
  my $r = rule $name;
  prog_error ("undefined rule $name\n" . &rules_dump)
    unless $r;
  return $r;
}

=item C<rruledef ($varname, $cond)>

Return the C<Automake::RuleDef> object for the rule named
C<$rulename> if defined in condition C<$cond>.  Abort with an internal
error if the condition or the rule does not exist.

=cut

sub rruledef ($$)
{
  my ($name, $cond) = @_;
  return rrule ($name)->rdef ($cond);
}

# Create the variable if it does not exist.
# This is used only by other functions in this package.
sub _crule ($)
{
  my ($name) = @_;
  my $r = rule $name;
  return $r if $r;
  return _new Automake::Rule $name;
}

sub _new ($$)
{
  my ($class, $name) = @_;

  # Strip $(EXEEXT) from $name, so we can diagnose
  # a clash if 'ctags$(EXEEXT):' is redefined after 'ctags:'.
  (my $keyname = $name) =~ s,\$\(EXEEXT\)$,,;

  my $self = Automake::Item::new ($class, $name);
  $_rule_dict{$keyname} = $self;
  return $self;
}

sub _rule_defn_with_exeext_awareness ($$$)
{
  my ($target, $cond, $where) = @_;

  # For now 'foo:' will override 'foo$(EXEEXT):'.  This is temporary,
  # though, so we emit a warning.
  (my $noexe = $target) =~ s/\$\(EXEEXT\)$//;
  my $noexerule = rule $noexe;
  my $tdef = $noexerule ? $noexerule->def ($cond) : undef;

  if ($noexe ne $target
      && $tdef
      && $noexerule->name ne $target)
    {
      # The no-exeext option enables this feature.
      if (! option 'no-exeext')
	{
	  msg ('obsolete', $tdef->location,
	       "deprecated feature: target '$noexe' overrides "
	       . "'$noexe\$(EXEEXT)'\n"
	       . "change your target to read '$noexe\$(EXEEXT)'",
	       partial => 1);
	  msg ('obsolete', $where, "target '$target' was defined here");
	}
    }
    return $tdef;
}

sub _maybe_warn_about_duplicated_target ($$$$$$)
{
  my ($target, $tdef, $source, $owner, $cond, $where) = @_;

  my $oldowner  = $tdef->owner;
  # Ok, it's the name target, but the name maybe different because
  # 'foo$(EXEEXT)' and 'foo' have the same key in our table.
  my $oldname = $tdef->name;

  # Don't mention true conditions in diagnostics.
  my $condmsg =
    $cond == TRUE ? '' : (" in condition '" . $cond->human . "'");

  if ($owner == RULE_USER)
    {
      if ($oldowner == RULE_USER)
        {
          # Ignore '%'-style pattern rules.  We'd need the
          # dependencies to detect duplicates, and they are
          # already diagnosed as unportable by -Wportability.
          if ($target !~ /^[^%]*%[^%]*$/)
            {
              ## FIXME: Presently we can't diagnose duplicate user rules
              ## because we don't distinguish rules with commands
              ## from rules that only add dependencies.  E.g.,
              ##   .PHONY: foo
              ##   .PHONY: bar
              ## is legitimate.  This is checked in the 'phony.sh' test.

              # msg ('syntax', $where,
              #      "redefinition of '$target'$condmsg ...", partial => 1);
              # msg_cond_rule ('syntax', $cond, $target,
              #                "... '$target' previously defined here");
            }
        }
      else
        {
          # Since we parse the user Makefile.am before reading
          # the Automake fragments, this condition should never happen.
          prog_error ("user target '$target'$condmsg seen after Automake's"
                      . " definition\nfrom " . $tdef->source);
        }
    }
  else # $owner == RULE_AUTOMAKE
    {
      if ($oldowner == RULE_USER)
        {
          # -am targets listed in %dependencies support a -local
          # variant.  If the user tries to override TARGET or
          # TARGET-am for which there exists a -local variant,
          # just tell the user to use it.
          my $hint = 0;
          my $noam = $target;
          $noam =~ s/-am$//;
          if (exists $dependencies{"$noam-am"})
            {
              $hint = "consider using $noam-local instead of $target";
            }

          msg_cond_rule ('override', $cond, $target,
                         "user target '$target' defined here"
                         . "$condmsg ...", partial => 1);
          msg ('override', $where,
               "... overrides Automake target '$oldname' defined here",
               partial => $hint);
          msg_cond_rule ('override', $cond, $target, $hint)
            if $hint;
        }
      else # $oldowner == RULE_AUTOMAKE
        {
          # Automake should ignore redefinitions of its own
          # rules if they came from the same file.  This makes
          # it easier to process a Makefile fragment several times.
          # However it's an error if the target is defined in many
          # files.  E.g., the user might be using bin_PROGRAMS = ctags
          # which clashes with our 'ctags' rule.
          # (It would be more accurate if we had a way to compare
          # the *content* of both rules.  Then $targets_source would
          # be useless.)
          my $oldsource = $tdef->source;
          if (not ($source eq $oldsource && $target eq $oldname))
            {
               msg ('syntax',
                    $where, "redefinition of '$target'$condmsg ...",
                    partial => 1);
               msg_cond_rule ('syntax', $cond, $target,
                              "... '$oldname' previously defined here");
            }
        }
    }
}

# Return the list of conditionals in which the rule was defined.  In case
# an ambiguous conditional definition is detected, return the empty list.
sub _conditionals_for_rule ($$$$)
{
  my ($rule, $owner, $cond, $where) = @_;
  my $target = $rule->name;
  my @conds;
  my ($message, $ambig_cond) = $rule->conditions->ambiguous_p ($target, $cond);

  return $cond if !$message; # No ambiguity.

  if ($owner == RULE_USER)
    {
      # For user rules, just diagnose the ambiguity.
      msg 'syntax', $where, "$message ...", partial => 1;
      msg_cond_rule ('syntax', $ambig_cond, $target,
                     "... '$target' previously defined here");
      return ();
    }

  # FIXME: for Automake rules, we can't diagnose ambiguities yet.
  # The point is that Automake doesn't propagate conditions
  # everywhere.  For instance &handle_PROGRAMS doesn't care if
  # bin_PROGRAMS was defined conditionally or not.
  # On the following input
  #   if COND1
  #   foo:
  #           ...
  #   else
  #   bin_PROGRAMS = foo
  #   endif
  # &handle_PROGRAMS will attempt to define a 'foo:' rule
  # in condition TRUE (which conflicts with COND1).  Fixing
  # this in &handle_PROGRAMS and siblings seems hard: you'd
  # have to explain &file_contents what to do with a
  # condition.  So for now we do our best *here*.  If 'foo:'
  # was already defined in condition COND1 and we want to define
  # it in condition TRUE, then define it only in condition !COND1.
  # (See cond14.sh and cond15.sh for some test cases.)
  @conds = $rule->not_always_defined_in_cond ($cond)->conds;

  # No conditions left to define the rule.
  # Warn, because our workaround is meaningless in this case.
  if (scalar @conds == 0)
    {
      msg 'syntax', $where, "$message ...", partial => 1;
      msg_cond_rule ('syntax', $ambig_cond, $target,
                     "... '$target' previously defined here");
      return ();
    }
  return @conds;
}

=item C<@conds = define ($rulename, $source, $owner, $cond, $where)>

Define a new rule.  C<$rulename> is the list of targets.  C<$source>
is the filename the rule comes from.  C<$owner> is the owner of the
rule (C<RULE_AUTOMAKE> or C<RULE_USER>).  C<$cond> is the
C<Automake::Condition> under which the rule is defined.  C<$where> is
the C<Automake::Location> where the rule is defined.

Returns a (possibly empty) list of C<Automake::Condition>s where the
rule's definition should be output.

=cut

sub define ($$$$$)
{
  my ($target, $source, $owner, $cond, $where) = @_;

  prog_error "$where is not a reference"
    unless ref $where;
  prog_error "$cond is not a reference"
    unless ref $cond;

  # Don't even think about defining a rule in condition FALSE.
  return () if $cond == FALSE;

  my $tdef = _rule_defn_with_exeext_awareness ($target, $cond, $where);

  # A GNU make-style pattern rule has a single "%" in the target name.
  msg ('portability', $where,
       "'%'-style pattern rules are a GNU make extension")
    if $target =~ /^[^%]*%[^%]*$/;

  # See whether this is a duplicated target declaration.
  if ($tdef)
    {
      # Diagnose invalid target redefinitions, if any.  Note that some
      # target redefinitions are valid (e.g., for multiple-targets
      # pattern rules).
      _maybe_warn_about_duplicated_target ($target, $tdef, $source,
                                           $owner, $cond, $where);
      # Return so we don't redefine the rule in our tables, don't check
      # for ambiguous condition, etc.  The rule will be output anyway
      # because '&read_am_file' ignores the return code.
      return ();
    }

  my $rule = _crule $target;

  # Conditions for which the rule should be defined.  Due to some
  # complications in the automake internals, this aspect is not as
  # obvious as it might be, and in come cases this list must contain
  # other entries in addition to '$cond'.  See the comments in
  # '_conditionals_for_rule' for a rationale.
  my @conds = _conditionals_for_rule ($rule, $owner, $cond, $where);

  # Stop if we had ambiguous conditional definitions.
  return unless @conds;

  # Finally define this rule.
  for my $c (@conds)
    {
      my $def = new Automake::RuleDef ($target, '', $where->clone,
				       $owner, $source);
      $rule->set ($c, $def);
    }

  # We honor inference rules with multiple targets because many
  # makes support this and people use it.  However this is disallowed
  # by POSIX.  We'll print a warning later.
  my $target_count = 0;
  my $inference_rule_count = 0;

  for my $t (split (' ', $target))
    {
      ++$target_count;
      # Check if the rule is a suffix rule: either it's a rule for
      # two known extensions...
      if ($t =~ /^($KNOWN_EXTENSIONS_PATTERN)($KNOWN_EXTENSIONS_PATTERN)$/
	  # ...or it's a rule with unknown extensions (i.e., the rule
	  # looks like '.foo.bar:' but '.foo' or '.bar' are not
	  # declared in SUFFIXES and are not known language
	  # extensions).  Automake will complete SUFFIXES from
	  # @suffixes automatically (see handle_footer).
	  || ($t =~ /$_SUFFIX_RULE_PATTERN/o && accept_extensions($1)))
	{
	  ++$inference_rule_count;
	  register_suffix_rule ($where, $1, $2);
	}
    }

  # POSIX allows multiple targets before the colon, but disallows
  # definitions of multiple inference rules.  It's also
  # disallowed to mix plain targets with inference rules.
  msg ('portability', $where,
       "inference rules can have only one target before the colon (POSIX)")
    if $inference_rule_count > 0 && $target_count > 1;

  return @conds;
}

=item C<depend ($target, @deps)>

Adds C<@deps> to the dependencies of target C<$target>.  This should
be used only with factored targets (those appearing in
C<%dependees>).

=cut

sub depend ($@)
{
  my ($category, @dependees) = @_;
  push (@{$dependencies{$category}}, @dependees);
}

=back

=head1 SEE ALSO

L<Automake::RuleDef>, L<Automake::Condition>,
L<Automake::DisjConditions>, L<Automake::Location>.

=cut

1;
Automake/General.pm000064400000003755150523165450010245 0ustar00# Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::General;

use 5.006;
use strict;
use Exporter;
use File::Basename;

use vars qw (@ISA @EXPORT);

@ISA = qw (Exporter);
@EXPORT = qw (&uniq &none $me);

# Variable we share with the main package.  Be sure to have a single
# copy of them: using 'my' together with multiple inclusion of this
# package would introduce several copies.
use vars qw ($me);
$me = basename ($0);

# END
# ---
# Exit nonzero whenever closing STDOUT fails.
sub END
{
  # This is required if the code might send any output to stdout
  # E.g., even --version or --help.  So it's best to do it unconditionally.
  if (! close STDOUT)
    {
      print STDERR "$me: closing standard output: $!\n";
      $? = 74; # EX_IOERR
      return;
    }
}


# @RES
# uniq (@LIST)
# ------------
# Return LIST with no duplicates.
sub uniq (@)
{
   my @res = ();
   my %seen = ();
   foreach my $item (@_)
     {
       if (! exists $seen{$item})
	 {
	   $seen{$item} = 1;
	   push (@res, $item);
	 }
     }
   return wantarray ? @res : "@res";
}

# $RES
# none (&PRED, @LIST)
# ------------
# Return 1 when no element in LIST satisfies predicate PRED otherwise 0.
sub none (&@)
{
  my ($pred, @list) = @_;
  my $res = 1;
  foreach my $item (@list)
    {
      if ($pred->($item))
        {
          $res = 0;
          last;
        }
    }
  return $res;
}

1; # for require
Automake/Getopt.pm000064400000004371150523165450010125 0ustar00# Copyright (C) 2012-2018 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.

package Automake::Getopt;

=head1 NAME

Automake::Getopt - GCS conforming parser for command line options

=head1 SYNOPSIS

  use Automake::Getopt;

=head1 DESCRIPTION

Export a function C<parse_options>, performing parsing of command
line options in conformance to the GNU Coding standards.

=cut

use 5.006;
use strict;
use warnings FATAL => 'all';
use Exporter ();
use Getopt::Long ();
use Automake::ChannelDefs qw/fatal/;
use Carp qw/croak confess/;

use vars qw (@ISA @EXPORT);
@ISA = qw (Exporter);
@EXPORT= qw/getopt/;

=item C<parse_options (%option)>

Wrapper around C<Getopt::Long>, trying to conform to the GNU
Coding Standards for error messages.

=cut

sub parse_options (%)
{
  my %option = @_;

  Getopt::Long::Configure ("bundling", "pass_through");
  # Unrecognized options are passed through, so GetOption can only fail
  # due to internal errors or misuse of options specification.
  Getopt::Long::GetOptions (%option)
    or confess "error in options specification (likely)";

  if (@ARGV && $ARGV[0] =~ /^-./)
    {
      my %argopts;
      for my $k (keys %option)
	{
	  if ($k =~ /(.*)=s$/)
	    {
	      map { $argopts{(length ($_) == 1)
			     ? "-$_" : "--$_" } = 1; } (split (/\|/, $1));
	    }
	}
      if ($ARGV[0] eq '--')
	{
	  shift @ARGV;
	}
      elsif (exists $argopts{$ARGV[0]})
	{
	  fatal ("option '$ARGV[0]' requires an argument\n"
		 . "Try '$0 --help' for more information.");
	}
      else
	{
	  fatal ("unrecognized option '$ARGV[0]'.\n"
		 . "Try '$0 --help' for more information.");
	}
    }
}

=back

=head1 SEE ALSO

L<Getopt::Long>

=cut

1; # for require
Automake/FileUtils.pm000064400000021614150523165450010562 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

###############################################################
# The main copy of this file is in Automake's git repository. #
# Updates should be sent to automake-patches@gnu.org.         #
###############################################################

package Automake::FileUtils;

=head1 NAME

Automake::FileUtils - handling files

=head1 SYNOPSIS

  use Automake::FileUtils

=head1 DESCRIPTION

This perl module provides various general purpose file handling functions.

=cut

use 5.006;
use strict;
use Exporter;
use File::stat;
use IO::File;
use Automake::Channels;
use Automake::ChannelDefs;

use vars qw (@ISA @EXPORT);

@ISA = qw (Exporter);
@EXPORT = qw (&contents
	      &find_file &mtime
	      &update_file &up_to_date_p
	      &xsystem &xsystem_hint &xqx
	      &dir_has_case_matching_file &reset_dir_cache
	      &set_dir_cache_file);

=item C<find_file ($file_name, @include)>

Return the first path for a C<$file_name> in the C<include>s.

We match exactly the behavior of GNU M4: first look in the current
directory (which includes the case of absolute file names), and then,
if the file name is not absolute, look in C<@include>.

If the file is flagged as optional (ends with C<?>), then return undef
if absent, otherwise exit with error.

=cut

# $FILE_NAME
# find_file ($FILE_NAME, @INCLUDE)
# --------------------------------
sub find_file ($@)
{
  use File::Spec;

  my ($file_name, @include) = @_;
  my $optional = 0;

  $optional = 1
    if $file_name =~ s/\?$//;

  return File::Spec->canonpath ($file_name)
    if -e $file_name;

  if (!File::Spec->file_name_is_absolute ($file_name))
    {
      foreach my $path (@include)
	{
	  return File::Spec->canonpath (File::Spec->catfile ($path, $file_name))
	    if -e File::Spec->catfile ($path, $file_name)
	}
    }

  fatal "$file_name: no such file or directory"
    unless $optional;
  return undef;
}

=item C<mtime ($file)>

Return the mtime of C<$file>.  Missing files, or C<-> standing for
C<STDIN> or C<STDOUT> are "obsolete", i.e., as old as possible.

=cut

# $MTIME
# MTIME ($FILE)
# -------------
sub mtime ($)
{
  my ($file) = @_;

  return 0
    if $file eq '-' || ! -f $file;

  my $stat = stat ($file)
    or fatal "cannot stat $file: $!";

  return $stat->mtime;
}


=item C<update_file ($from, $to, [$force])>

Rename C<$from> as C<$to>, preserving C<$to> timestamp if it has not
changed, unless C<$force> is true (defaults to false).  Recognize
C<$to> = C<-> standing for C<STDIN>.  C<$from> is always
removed/renamed.

=cut

# &update_file ($FROM, $TO; $FORCE)
# ---------------------------------
sub update_file ($$;$)
{
  my ($from, $to, $force) = @_;
  $force = 0
    unless defined $force;
  my $SIMPLE_BACKUP_SUFFIX = $ENV{'SIMPLE_BACKUP_SUFFIX'} || '~';
  use File::Compare;
  use File::Copy;

  if ($to eq '-')
    {
      my $in = new IO::File $from, "<";
      my $out = new IO::File (">-");
      while ($_ = $in->getline)
	{
	  print $out $_;
	}
      $in->close;
      unlink ($from) || fatal "cannot remove $from: $!";
      return;
    }

  if (!$force && -f "$to" && compare ("$from", "$to") == 0)
    {
      # File didn't change, so don't update its mod time.
      msg 'note', "'$to' is unchanged";
      unlink ($from)
        or fatal "cannot remove $from: $!";
      return
    }

  if (-f "$to")
    {
      # Back up and install the new one.
      move ("$to",  "$to$SIMPLE_BACKUP_SUFFIX")
	or fatal "cannot backup $to: $!";
      move ("$from", "$to")
	or fatal "cannot rename $from as $to: $!";
      msg 'note', "'$to' is updated";
    }
  else
    {
      move ("$from", "$to")
	or fatal "cannot rename $from as $to: $!";
      msg 'note', "'$to' is created";
    }
}


=item C<up_to_date_p ($file, @dep)>

Is C<$file> more recent than C<@dep>?

=cut

# $BOOLEAN
# &up_to_date_p ($FILE, @DEP)
# ---------------------------
sub up_to_date_p ($@)
{
  my ($file, @dep) = @_;
  my $mtime = mtime ($file);

  foreach my $dep (@dep)
    {
      if ($mtime < mtime ($dep))
	{
	  verb "up_to_date ($file): outdated: $dep";
	  return 0;
	}
    }

  verb "up_to_date ($file): up to date";
  return 1;
}


=item C<handle_exec_errors ($command, [$expected_exit_code = 0], [$hint])>

Display an error message for C<$command>, based on the content of
C<$?> and C<$!>.  Be quiet if the command exited normally
with C<$expected_exit_code>.  If C<$hint> is given, display that as well
if the command failed to run at all.

=cut

sub handle_exec_errors ($;$$)
{
  my ($command, $expected, $hint) = @_;
  $expected = 0 unless defined $expected;
  if (defined $hint)
    {
      $hint = "\n" . $hint;
    }
  else
    {
      $hint = '';
    }

  $command = (split (' ', $command))[0];
  if ($!)
    {
      fatal "failed to run $command: $!" . $hint;
    }
  else
    {
      use POSIX qw (WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG);

      if (WIFEXITED ($?))
	{
	  my $status = WEXITSTATUS ($?);
	  # Propagate exit codes.
	  fatal ('',
		 "$command failed with exit status: $status",
		 exit_code => $status)
	    unless $status == $expected;
	}
      elsif (WIFSIGNALED ($?))
	{
	  my $signal = WTERMSIG ($?);
	  fatal "$command terminated by signal: $signal";
	}
      else
	{
	  fatal "$command exited abnormally";
	}
    }
}

=item C<xqx ($command)>

Same as C<qx> (but in scalar context), but fails on errors.

=cut

# xqx ($COMMAND)
# --------------
sub xqx ($)
{
  my ($command) = @_;

  verb "running: $command";

  $! = 0;
  my $res = `$command`;
  handle_exec_errors $command
    if $?;

  return $res;
}


=item C<xsystem (@argv)>

Same as C<system>, but fails on errors, and reports the C<@argv>
in verbose mode.

=cut

sub xsystem (@)
{
  my (@command) = @_;

  verb "running: @command";

  $! = 0;
  handle_exec_errors "@command"
    if system @command;
}


=item C<xsystem_hint ($msg, @argv)>

Same as C<xsystem>, but allows to pass a hint that will be displayed
in case the command failed to run at all.

=cut

sub xsystem_hint (@)
{
  my ($hint, @command) = @_;

  verb "running: @command";

  $! = 0;
  handle_exec_errors "@command", 0, $hint
    if system @command;
}


=item C<contents ($file_name)>

Return the contents of C<$file_name>.

=cut

# contents ($FILE_NAME)
# ---------------------
sub contents ($)
{
  my ($file) = @_;
  verb "reading $file";
  local $/;			# Turn on slurp-mode.
  my $f = new Automake::XFile $file, "<";
  my $contents = $f->getline;
  $f->close;
  return $contents;
}


=item C<dir_has_case_matching_file ($DIRNAME, $FILE_NAME)>

Return true iff $DIR contains a file name that matches $FILE_NAME case
insensitively.

We need to be cautious on case-insensitive case-preserving file
systems (e.g. Mac OS X's HFS+).  On such systems C<-f 'Foo'> and C<-f
'foO'> answer the same thing.  Hence if a package distributes its own
F<CHANGELOG> file, but has no F<ChangeLog> file, automake would still
try to distribute F<ChangeLog> (because it thinks it exists) in
addition to F<CHANGELOG>, although it is impossible for these two
files to be in the same directory (the two file names designate the
same file).

=cut

use vars '%_directory_cache';
sub dir_has_case_matching_file ($$)
{
  # Note that print File::Spec->case_tolerant returns 0 even on MacOS
  # X (with Perl v5.8.1-RC3 at least), so do not try to shortcut this
  # function using that.

  my ($dirname, $file_name) = @_;
  return 0 unless -f "$dirname/$file_name";

  # The file appears to exist, however it might be a mirage if the
  # system is case insensitive.  Let's browse the directory and check
  # whether the file is really in.  We maintain a cache of directories
  # so Automake doesn't spend all its time reading the same directory
  # again and again.
  if (!exists $_directory_cache{$dirname})
    {
      error "failed to open directory '$dirname'"
	unless opendir (DIR, $dirname);
      $_directory_cache{$dirname} = { map { $_ => 1 } readdir (DIR) };
      closedir (DIR);
    }
  return exists $_directory_cache{$dirname}{$file_name};
}

=item C<reset_dir_cache ($dirname)>

Clear C<dir_has_case_matching_file>'s cache for C<$dirname>.

=cut

sub reset_dir_cache ($)
{
  delete $_directory_cache{$_[0]};
}

=item C<set_dir_cache_file ($dirname, $file_name)>

State that C<$dirname> contains C<$file_name> now.

=cut

sub set_dir_cache_file ($$)
{
  my ($dirname, $file_name) = @_;
  $_directory_cache{$dirname}{$file_name} = 1
    if exists $_directory_cache{$dirname};
}

1; # for require
Automake/Item.pm000064400000010043150523165450007552 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Item;

use 5.006;
use strict;
use Carp;
use Automake::ChannelDefs;
use Automake::DisjConditions;

=head1 NAME

Automake::Item - base class for Automake::Variable and Automake::Rule

=head1 DESCRIPTION

=head2 Methods

=over 4

=item C<new Automake::Item $name>

Create and return an empty Item called C<$name>.

=cut

sub new ($$)
{
  my ($class, $name) = @_;
  my $self = {
    name => $name,
    defs => {},
    conds => {},
  };
  bless $self, $class;
  return $self;
}

=item C<$item-E<gt>name>

Return the name of C<$item>.

=cut

sub name ($)
{
  my ($self) = @_;
  return $self->{'name'};
}

=item C<$item-E<gt>def ($cond)>

Return the definition for this item in condition C<$cond>, if it
exists.  Return 0 otherwise.

=cut

sub def ($$)
{
  # This method is called very often, so keep it small and fast.  We
  # don't mind the extra undefined items introduced by lookup failure;
  # avoiding this with 'exists' means doing two hash lookup on
  # success, and proved worse on benchmark.
  my $def = $_[0]->{'defs'}{$_[1]};
  return defined $def && $def;
}

=item C<$item-E<gt>rdef ($cond)>

Return the definition for this item in condition C<$cond>.  Abort with
an internal error if the item was not defined under this condition.

The I<r> in front of C<def> stands for I<required>.  One
should call C<rdef> to assert the conditional definition's existence.

=cut

sub rdef ($$)
{
  my ($self, $cond) = @_;
  my $d = $self->def ($cond);
  prog_error ("undefined condition '" . $cond->human . "' for '"
	      . $self->name . "'\n" . $self->dump)
    unless $d;
  return $d;
}

=item C<$item-E<gt>set ($cond, $def)>

Add a new definition to an existing item.

=cut

sub set ($$$)
{
  my ($self, $cond, $def) = @_;
  $self->{'defs'}{$cond} = $def;
  $self->{'conds'}{$cond} = $cond;
}

=item C<$var-E<gt>conditions>

Return an L<Automake::DisjConditions> describing the conditions that
that an item is defined in.

These are all the conditions for which is would be safe to call
C<rdef>.

=cut

sub conditions ($)
{
  my ($self) = @_;
  prog_error ("self is not a reference")
    unless ref $self;
  return new Automake::DisjConditions (values %{$self->{'conds'}});
}

=item C<@missing_conds = $var-E<gt>not_always_defined_in_cond ($cond)>

Check whether C<$var> is always defined for condition C<$cond>.
Return a list of conditions where the definition is missing.

For instance, given

  if COND1
    if COND2
      A = foo
      D = d1
    else
      A = bar
      D = d2
    endif
  else
    D = d3
  endif
  if COND3
    A = baz
    B = mumble
  endif
  C = mumble

we should have (we display result as conditional strings in this
illustration, but we really return DisjConditions objects):

  var ('A')->not_always_defined_in_cond ('COND1_TRUE COND2_TRUE')
    => ()
  var ('A')->not_always_defined_in_cond ('COND1_TRUE')
    => ()
  var ('A')->not_always_defined_in_cond ('TRUE')
    => ("COND1_FALSE COND3_FALSE")
  var ('B')->not_always_defined_in_cond ('COND1_TRUE')
    => ("COND1_TRUE COND3_FALSE")
  var ('C')->not_always_defined_in_cond ('COND1_TRUE')
    => ()
  var ('D')->not_always_defined_in_cond ('TRUE')
    => ()
  var ('Z')->not_always_defined_in_cond ('TRUE')
    => ("TRUE")

=cut

sub not_always_defined_in_cond ($$)
{
  my ($self, $cond) = @_;

  # Compute the subconditions where $var isn't defined.
  return
    $self->conditions
      ->sub_conditions ($cond)
	->invert
	  ->multiply ($cond);
}


1;
Automake/Options.pm000064400000026312150523165450010315 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Options;

use 5.006;
use strict;
use Exporter;
use Automake::Config;
use Automake::ChannelDefs;
use Automake::Channels;
use Automake::Version;

use vars qw (@ISA @EXPORT);

@ISA = qw (Exporter);
@EXPORT = qw (option global_option
              set_option set_global_option
              unset_option unset_global_option
              process_option_list process_global_option_list
              set_strictness $strictness $strictness_name
              &FOREIGN &GNU &GNITS);

=head1 NAME

Automake::Options - keep track of Automake options

=head1 SYNOPSIS

  use Automake::Options;

  # Option lookup and setting.
  $opt = option 'name';
  $opt = global_option 'name';
  set_option 'name', 'value';
  set_global_option 'name', 'value';
  unset_option 'name';
  unset_global_option 'name';

  # Batch option setting.
  process_option_list $location, @names;
  process_global_option_list $location, @names;

  # Strictness lookup and setting.
  set_strictness 'foreign';
  set_strictness 'gnu';
  set_strictness 'gnits';
  if ($strictness >= GNU) { ... }
  print "$strictness_name\n";

=head1 DESCRIPTION

This packages manages Automake's options and strictness settings.
Options can be either local or global.  Local options are set using an
C<AUTOMAKE_OPTIONS> variable in a F<Makefile.am> and apply only to
this F<Makefile.am>.  Global options are set from the command line or
passed as an argument to C<AM_INIT_AUTOMAKE>, they apply to all
F<Makefile.am>s.

=cut

# Values are the Automake::Location of the definition.
use vars '%_options';        # From AUTOMAKE_OPTIONS
use vars '%_global_options'; # From AM_INIT_AUTOMAKE or the command line.

# Whether process_option_list has already been called for the current
# Makefile.am.
use vars '$_options_processed';
# Whether process_global_option_list has already been called.
use vars '$_global_options_processed';

=head2 Constants

=over 4

=item FOREIGN

=item GNU

=item GNITS

Strictness constants used as values for C<$strictness>.

=back

=cut

# Constants to define the "strictness" level.
use constant FOREIGN => 0;
use constant GNU     => 1;
use constant GNITS   => 2;

=head2 Variables

=over 4

=item C<$strictness>

The current strictness.  One of C<FOREIGN>, C<GNU>, or C<GNITS>.

=item C<$strictness_name>

The current strictness name.  One of C<'foreign'>, C<'gnu'>, or C<'gnits'>.

=back

=cut

# Strictness levels.
use vars qw ($strictness $strictness_name);

# Strictness level as set on command line.
use vars qw ($_default_strictness $_default_strictness_name);


=head2 Functions

=over 4

=item C<Automake::Options::reset>

Reset the options variables for the next F<Makefile.am>.

In other words, this gets rid of all local options in use by the
previous F<Makefile.am>.

=cut

sub reset ()
{
  $_options_processed = 0;
  %_options = %_global_options;
  # The first time we are run,
  # remember the current setting as the default.
  if (defined $_default_strictness)
    {
      $strictness = $_default_strictness;
      $strictness_name = $_default_strictness_name;
    }
  else
    {
      $_default_strictness = $strictness;
      $_default_strictness_name = $strictness_name;
    }
}

=item C<$value = option ($name)>

=item C<$value = global_option ($name)>

Query the state of an option.  If the option is unset, this
returns the empty list.  Otherwise it returns the option's value,
as set by C<set_option> or C<set_global_option>.

Note that C<global_option> should be used only when it is
important to make sure an option hasn't been set locally.
Otherwise C<option> should be the standard function to
check for options (be they global or local).

=cut

sub option ($)
{
  my ($name) = @_;
  return () unless defined $_options{$name};
  return $_options{$name};
}

sub global_option ($)
{
  my ($name) = @_;
  return () unless defined $_global_options{$name};
  return $_global_options{$name};
}

=item C<set_option ($name, $value)>

=item C<set_global_option ($name, $value)>

Set an option.  By convention, C<$value> is usually the location
of the option definition.

=cut

sub set_option ($$)
{
  my ($name, $value) = @_;
  $_options{$name} = $value;
}

sub set_global_option ($$)
{
  my ($name, $value) = @_;
  $_global_options{$name} = $value;
}


=item C<unset_option ($name)>

=item C<unset_global_option ($name)>

Unset an option.

=cut

sub unset_option ($)
{
  my ($name) = @_;
  delete $_options{$name};
}

sub unset_global_option ($)
{
  my ($name) = @_;
  delete $_global_options{$name};
}


=item C<process_option_list (@list)>

=item C<process_global_option_list (@list)>

Process Automake's option lists.  C<@list> should be a list of hash
references with keys C<option> and C<where>, where C<option> is an
option as they occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>,
and C<where> is the location where that option occurred.

These functions should be called at most once for each set of options
having the same precedence; i.e., do not call it twice for two options
from C<AM_INIT_AUTOMAKE>.

Return 0 on error, 1 otherwise.

=cut

# $BOOL
# _option_is_from_configure ($OPTION, $WHERE)
# ----------------------------------------------
# Check that the $OPTION given in location $WHERE is specified with
# AM_INIT_AUTOMAKE, not with AUTOMAKE_OPTIONS.
sub _option_is_from_configure ($$)
{
  my ($opt, $where)= @_;
  return 1
    if $where->get =~ /^configure\./;
  error $where,
        "option '$opt' can only be used as argument to AM_INIT_AUTOMAKE\n" .
        "but not in AUTOMAKE_OPTIONS makefile statements";
  return 0;
}

# $BOOL
# _is_valid_easy_option ($OPTION)
# -------------------------------
# Explicitly recognize valid automake options that require no
# special handling by '_process_option_list' below.
sub _is_valid_easy_option ($)
{
  my $opt = shift;
  return scalar grep { $opt eq $_ } qw(
    check-news
    color-tests
    dejagnu
    dist-bzip2
    dist-lzip
    dist-xz
    dist-zip
    info-in-builddir
    no-define
    no-dependencies
    no-dist
    no-dist-gzip
    no-exeext
    no-installinfo
    no-installman
    no-texinfo.tex
    nostdinc
    readme-alpha
    serial-tests
    parallel-tests
    silent-rules
    std-options
    subdir-objects
  );
}

# $BOOL
# _process_option_list (\%OPTIONS, @LIST)
# ------------------------------------------
# Process a list of options.  \%OPTIONS is the hash to fill with options
# data.  @LIST is a list of options as get passed to public subroutines
# process_option_list() and process_global_option_list() (see POD
# documentation above).
sub _process_option_list (\%@)
{
  my ($options, @list) = @_;
  my @warnings = ();
  my $ret = 1;

  foreach my $h (@list)
    {
      local $_ = $h->{'option'};
      my $where = $h->{'where'};
      $options->{$_} = $where;
      if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
        {
          set_strictness ($_);
        }
      # TODO: Remove this special check in Automake 3.0.
      elsif (/^(.*\/)?ansi2knr$/)
        {
          # Obsolete (and now removed) de-ANSI-fication support.
          error ($where,
                 "automatic de-ANSI-fication support has been removed");
          $ret = 0;
        }
      # TODO: Remove this special check in Automake 3.0.
      elsif ($_ eq 'cygnus')
        {
          error $where, "support for Cygnus-style trees has been removed";
          $ret = 0;
        }
      # TODO: Remove this special check in Automake 3.0.
      elsif ($_ eq 'dist-lzma')
        {
          error ($where, "support for lzma-compressed distribution " .
                         "archives has been removed");
          $ret = 0;
        }
      # TODO: Make this a fatal error in Automake 2.0.
      elsif ($_ eq 'dist-shar')
        {
          msg ('obsolete', $where,
               "support for shar distribution archives is deprecated.\n" .
               "  It will be removed in Automake 2.0");
        }
      # TODO: Make this a fatal error in Automake 2.0.
      elsif ($_ eq 'dist-tarZ')
        {
          msg ('obsolete', $where,
               "support for distribution archives compressed with " .
               "legacy program 'compress' is deprecated.\n" .
               "  It will be removed in Automake 2.0");
        }
      elsif (/^filename-length-max=(\d+)$/)
        {
          delete $options->{$_};
          $options->{'filename-length-max'} = [$_, $1];
        }
      elsif ($_ eq 'tar-v7' || $_ eq 'tar-ustar' || $_ eq 'tar-pax')
        {
          if (not _option_is_from_configure ($_, $where))
            {
              $ret = 0;
            }
          for my $opt ('tar-v7', 'tar-ustar', 'tar-pax')
            {
              next
                if $opt eq $_ or ! exists $options->{$opt};
              error ($where,
                     "options '$_' and '$opt' are mutually exclusive");
              $ret = 0;
            }
        }
      elsif (/^\d+\.\d+(?:\.\d+)?[a-z]?(?:-[A-Za-z0-9]+)?$/)
        {
          # Got a version number.
          if (Automake::Version::check ($VERSION, $&))
            {
              error ($where, "require Automake $_, but have $VERSION");
              $ret = 0;
            }
        }
      elsif (/^(?:--warnings=|-W)(.*)$/)
        {
          my @w = map { { cat => $_, loc => $where} } split (',', $1);
          push @warnings, @w;
        }
      elsif (! _is_valid_easy_option $_)
        {
          error ($where, "option '$_' not recognized");
          $ret = 0;
        }
    }

  # We process warnings here, so that any explicitly-given warning setting
  # will take precedence over warning settings defined implicitly by the
  # strictness.
  foreach my $w (@warnings)
    {
      msg 'unsupported', $w->{'loc'},
          "unknown warning category '$w->{'cat'}'"
        if switch_warning $w->{cat};
    }

  return $ret;
}

sub process_option_list (@)
{
  prog_error "local options already processed"
    if $_options_processed;
  $_options_processed = 1;
  _process_option_list (%_options, @_);
}

sub process_global_option_list (@)
{
  prog_error "global options already processed"
    if $_global_options_processed;
  $_global_options_processed = 1;
  _process_option_list (%_global_options, @_);
}

=item C<set_strictness ($name)>

Set the current strictness level.
C<$name> should be one of C<'foreign'>, C<'gnu'>, or C<'gnits'>.

=cut

# Set strictness.
sub set_strictness ($)
{
  $strictness_name = $_[0];

  Automake::ChannelDefs::set_strictness ($strictness_name);

  if ($strictness_name eq 'gnu')
    {
      $strictness = GNU;
    }
  elsif ($strictness_name eq 'gnits')
    {
      $strictness = GNITS;
    }
  elsif ($strictness_name eq 'foreign')
    {
      $strictness = FOREIGN;
    }
  else
    {
      prog_error "level '$strictness_name' not recognized";
    }
}

1;
Automake/XFile.pm000064400000016447150523165450007701 0ustar00# Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.

# Written by Akim Demaille <akim@freefriends.org>.

###############################################################
# The main copy of this file is in Automake's git repository. #
# Updates should be sent to automake-patches@gnu.org.         #
###############################################################

package Automake::XFile;

=head1 NAME

Automake::XFile - supply object methods for filehandles with error handling

=head1 SYNOPSIS

    use Automake::XFile;

    $fh = new Automake::XFile;
    $fh->open ("file", "<");
    # No need to check $FH: we died if open failed.
    print <$fh>;
    $fh->close;
    # No need to check the return value of close: we died if it failed.

    $fh = new Automake::XFile "file", ">";
    # No need to check $FH: we died if new failed.
    print $fh "bar\n";
    $fh->close;

    $fh = new Automake::XFile "file", "r";
    # No need to check $FH: we died if new failed.
    defined $fh
    print <$fh>;
    undef $fh;   # automatically closes the file and checks for errors.

    $fh = new Automake::XFile "file", O_WRONLY | O_APPEND;
    # No need to check $FH: we died if new failed.
    print $fh "corge\n";

    $pos = $fh->getpos;
    $fh->setpos ($pos);

    undef $fh;   # automatically closes the file and checks for errors.

    autoflush STDOUT 1;

=head1 DESCRIPTION

C<Automake::XFile> inherits from C<IO::File>.  It provides the method
C<name> returning the file name.  It provides dying versions of the
methods C<close>, C<lock> (corresponding to C<flock>), C<new>,
C<open>, C<seek>, and C<truncate>.  It also overrides the C<getline>
and C<getlines> methods to translate C<\r\n> to C<\n>.

=cut

use 5.006;
use strict;
use vars qw($VERSION @EXPORT @EXPORT_OK $AUTOLOAD @ISA);
use Carp;
use Errno;
use IO::File;
use File::Basename;
use Automake::ChannelDefs;
use Automake::Channels qw(msg);
use Automake::FileUtils;

require Exporter;
require DynaLoader;

@ISA = qw(IO::File Exporter DynaLoader);

$VERSION = "1.2";

@EXPORT = @IO::File::EXPORT;

eval {
  # Make all Fcntl O_XXX and LOCK_XXX constants available for importing
  require Fcntl;
  my @O = grep /^(LOCK|O)_/, @Fcntl::EXPORT, @Fcntl::EXPORT_OK;
  Fcntl->import (@O);  # first we import what we want to export
  push (@EXPORT, @O);
};

=head2 Methods

=over

=item C<$fh = new Automake::XFile ([$expr, ...]>

Constructor a new XFile object.  Additional arguments
are passed to C<open>, if any.

=cut

sub new
{
  my $type = shift;
  my $class = ref $type || $type || "Automake::XFile";
  my $fh = $class->SUPER::new ();
  if (@_)
    {
      $fh->open (@_);
    }
  $fh;
}

=item C<$fh-E<gt>open ([$file, ...])>

Open a file, passing C<$file> and further arguments to C<IO::File::open>.
Die if opening fails.  Store the name of the file.  Use binmode for writing.

=cut

sub open
{
  my $fh = shift;
  my ($file, $mode) = @_;

  # WARNING: Gross hack: $FH is a typeglob: use its hash slot to store
  # the 'name' of the file we are opening.  See the example with
  # io_socket_timeout in IO::Socket for more, and read Graham's
  # comment in IO::Handle.
  ${*$fh}{'autom4te_xfile_file'} = "$file";

  if (!$fh->SUPER::open (@_))
    {
      fatal "cannot open $file: $!";
    }

  # In case we're running under MSWindows, don't write with CRLF.
  # (This circumvents a bug in at least Cygwin bash where the shell
  # parsing fails on lines ending with the continuation character '\'
  # and CRLF).
  # Correctly recognize usages like:
  #  - open ($file, "w")
  #  - open ($file, "+<")
  #  - open (" >$file")
  binmode $fh
    if (defined $mode && $mode =~ /^[+>wa]/ or $file =~ /^\s*>/);
}

=item C<$fh-E<gt>close>

Close the file, handling errors.

=cut

sub close
{
  my $fh = shift;
  if (!$fh->SUPER::close (@_))
    {
      my $file = $fh->name;
      Automake::FileUtils::handle_exec_errors $file
	unless $!;
      fatal "cannot close $file: $!";
    }
}

=item C<$line = $fh-E<gt>getline>

Read and return a line from the file.  Ensure C<\r\n> is translated to
C<\n> on input files.

=cut

# Some native Windows/perl installations fail to translate \r\n to \n on
# input so we do that here.
sub getline
{
  local $_ = $_[0]->SUPER::getline;
  # Perform a _global_ replacement: $_ may can contains many lines
  # in slurp mode ($/ = undef).
  s/\015\012/\n/gs if defined $_;
  return $_;
}

=item C<@lines = $fh-E<gt>getlines>

Slurp lines from the files.

=cut

sub getlines
{
  my @res = ();
  my $line;
  push @res, $line while $line = $_[0]->getline;
  return @res;
}

=item C<$name = $fh-E<gt>name>

Return the name of the file.

=cut

sub name
{
  my $fh = shift;
  return ${*$fh}{'autom4te_xfile_file'};
}

=item C<$fh-E<gt>lock>

Lock the file using C<flock>.  If locking fails for reasons other than
C<flock> being unsupported, then error out if C<$ENV{'MAKEFLAGS'}> indicates
that we are spawned from a parallel C<make>.

=cut

sub lock
{
  my ($fh, $mode) = @_;
  # Cannot use @_ here.

  # Unless explicitly configured otherwise, Perl implements its 'flock' with the
  # first of flock(2), fcntl(2), or lockf(3) that works.  These can fail on
  # NFS-backed files, with ENOLCK (GNU/Linux) or EOPNOTSUPP (FreeBSD); we
  # usually ignore these errors.  If $ENV{MAKEFLAGS} suggests that a parallel
  # invocation of 'make' has invoked the tool we serve, report all locking
  # failures and abort.
  #
  # On Unicos, flock(2) and fcntl(2) over NFS hang indefinitely when 'lockd' is
  # not running.  NetBSD NFS clients silently grant all locks.  We do not
  # attempt to defend against these dangers.
  #
  # -j is for parallel BSD make, -P is for parallel HP-UX make.
  if (!flock ($fh, $mode))
    {
      my $make_j = (exists $ENV{'MAKEFLAGS'}
		    && " -$ENV{'MAKEFLAGS'}" =~ / (-[BdeikrRsSw]*[jP]|--[jP]|---?jobs)/);
      my $note = "\nforgo \"make -j\" or use a file system that supports locks";
      my $file = $fh->name;

      msg ($make_j ? 'fatal' : 'unsupported',
	   "cannot lock $file with mode $mode: $!" . ($make_j ? $note : ""))
	if $make_j || !($!{ENOLCK} || $!{EOPNOTSUPP});
    }
}

=item C<$fh-E<gt>seek ($position, [$whence])>

Seek file to C<$position>.  Die if seeking fails.

=cut

sub seek
{
  my $fh = shift;
  # Cannot use @_ here.
  if (!seek ($fh, $_[0], $_[1]))
    {
      my $file = $fh->name;
      fatal "cannot rewind $file with @_: $!";
    }
}

=item C<$fh-E<gt>truncate ($len)>

Truncate the file to length C<$len>.  Die on failure.

=cut

sub truncate
{
  my ($fh, $len) = @_;
  if (!truncate ($fh, $len))
    {
      my $file = $fh->name;
      fatal "cannot truncate $file at $len: $!";
    }
}

=back

=head1 SEE ALSO

L<perlfunc>,
L<perlop/"I/O Operators">,
L<IO::File>
L<IO::Handle>
L<IO::Seekable>

=head1 HISTORY

Derived from IO::File.pm by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.

=cut

1;
Automake/ChannelDefs.pm000064400000025007150523165450011034 0ustar00# Copyright (C) 2002-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::ChannelDefs;

use Automake::Config;
BEGIN
{
  if ($perl_threads)
    {
      require threads;
      import threads;
    }
}
use Automake::Channels;

=head1 NAME

Automake::ChannelDefs - channel definitions for Automake and helper functions

=head1 SYNOPSIS

  use Automake::ChannelDefs;

  Automake::ChannelDefs::usage ();
  prog_error ($MESSAGE, [%OPTIONS]);
  error ($WHERE, $MESSAGE, [%OPTIONS]);
  error ($MESSAGE);
  fatal ($WHERE, $MESSAGE, [%OPTIONS]);
  fatal ($MESSAGE);
  verb ($MESSAGE, [%OPTIONS]);
  switch_warning ($CATEGORY);
  parse_WARNINGS ();
  parse_warnings ($OPTION, $ARGUMENT);
  Automake::ChannelDefs::set_strictness ($STRICTNESS_NAME);

=head1 DESCRIPTION

This packages defines channels that can be used in Automake to
output diagnostics and other messages (via C<msg()>).  It also defines
some helper function to enable or disable these channels, and some
shorthand function to output on specific channels.

=cut

use 5.006;
use strict;
use Exporter;

use vars qw (@ISA @EXPORT);

@ISA = qw (Exporter);
@EXPORT = qw (&prog_error &error &fatal &verb
	      &switch_warning &parse_WARNINGS &parse_warnings);

=head2 CHANNELS

The following channels can be used as the first argument of
C<Automake::Channel::msg>.  For some of them we list a shorthand
function that makes the code more readable.

=over 4

=item C<fatal>

Fatal errors.  Use C<&fatal> to send messages over this channel.

=item C<error>

Common errors.  Use C<&error> to send messages over this channel.

=item C<error-gnu>

Errors related to GNU Standards.

=item C<error-gnu/warn>

Errors related to GNU Standards that should be warnings in 'foreign' mode.

=item C<error-gnits>

Errors related to GNITS Standards (silent by default).

=item C<automake>

Internal errors.  Use C<&prog_error> to send messages over this channel.

=item C<gnu>

Warnings related to GNU Coding Standards.

=item C<obsolete>

Warnings about obsolete features (silent by default).

=item C<override>

Warnings about user redefinitions of Automake rules or
variables (silent by default).

=item C<portability>

Warnings about non-portable constructs.

=item C<extra-portability>

Extra warnings about non-portable constructs covering obscure tools.

=item C<syntax>

Warnings about weird syntax, unused variables, typos...

=item C<unsupported>

Warnings about unsupported (or mis-supported) features.

=item C<verb>

Messages output in C<--verbose> mode.  Use C<&verb> to send such messages.

=item C<note>

Informative messages.

=back

=cut

# Initialize our list of error/warning channels.
# Do not forget to update &usage and the manual
# if you add or change a warning channel.

register_channel 'fatal', type => 'fatal', uniq_part => UP_NONE, ordered => 0;
register_channel 'error', type => 'error';
register_channel 'error-gnu', type => 'error';
register_channel 'error-gnu/warn', type => 'error';
register_channel 'error-gnits', type => 'error', silent => 1;
register_channel 'automake', type => 'fatal', backtrace => 1,
  header => ("####################\n" .
	     "## Internal Error ##\n" .
	     "####################\n"),
  footer => "\nPlease contact <$PACKAGE_BUGREPORT>.",
  uniq_part => UP_NONE, ordered => 0;

register_channel 'extra-portability', type => 'warning', silent => 1;
register_channel 'gnu', type => 'warning';
register_channel 'obsolete', type => 'warning';
register_channel 'override', type => 'warning', silent => 1;
register_channel 'portability', type => 'warning', silent => 1;
register_channel 'portability-recursive', type => 'warning', silent => 1;
register_channel 'syntax', type => 'warning';
register_channel 'unsupported', type => 'warning';

register_channel 'verb', type => 'debug', silent => 1, uniq_part => UP_NONE,
  ordered => 0;
register_channel 'note', type => 'debug', silent => 0;

setup_channel_type 'warning', header => 'warning: ';
setup_channel_type 'error', header => 'error: ';
setup_channel_type 'fatal', header => 'error: ';

=head2 FUNCTIONS

=over 4

=item C<usage ()>

Display warning categories.

=cut

sub usage ()
{
  print <<EOF;
Warning categories include:
  gnu                GNU coding standards (default in gnu and gnits modes)
  obsolete           obsolete features or constructions
  override           user redefinitions of Automake rules or variables
  portability        portability issues (default in gnu and gnits modes)
  extra-portability  extra portability issues related to obscure tools
  syntax             dubious syntactic constructs (default)
  unsupported        unsupported or incomplete features (default)
  all                all the warnings
  no-CATEGORY        turn off warnings in CATEGORY
  none               turn off all the warnings
  error              treat warnings as errors
EOF
}

=item C<prog_error ($MESSAGE, [%OPTIONS])>

Signal a programming error (on channel C<automake>),
display C<$MESSAGE>, and exit 1.

=cut

sub prog_error ($;%)
{
  my ($msg, %opts) = @_;
  msg 'automake', '', $msg, %opts;
}

=item C<error ($WHERE, $MESSAGE, [%OPTIONS])>

=item C<error ($MESSAGE)>

Uncategorized errors.

=cut

sub error ($;$%)
{
  my ($where, $msg, %opts) = @_;
  msg ('error', $where, $msg, %opts);
}

=item C<fatal ($WHERE, $MESSAGE, [%OPTIONS])>

=item C<fatal ($MESSAGE)>

Fatal errors.

=cut

sub fatal ($;$%)
{
  my ($where, $msg, %opts) = @_;
  msg ('fatal', $where, $msg, %opts);
}

=item C<verb ($MESSAGE, [%OPTIONS])>

C<--verbose> messages.

=cut

sub verb ($;%)
{
  my ($msg, %opts) = @_;
  $msg = "thread " . threads->tid . ": " . $msg
    if $perl_threads;
  msg 'verb', '', $msg, %opts;
}

=item C<switch_warning ($CATEGORY)>

If C<$CATEGORY> is C<mumble>, turn on channel C<mumble>.
If it's C<no-mumble>, turn C<mumble> off.
Else handle C<all> and C<none> for completeness.

=cut

sub switch_warning ($)
{
  my ($cat) = @_;
  my $has_no = 0;

  if ($cat =~ /^no-(.*)$/)
    {
      $cat = $1;
      $has_no = 1;
    }

  if ($cat eq 'all')
    {
      setup_channel_type 'warning', silent => $has_no;
    }
  elsif ($cat eq 'none')
    {
      setup_channel_type 'warning', silent => ! $has_no;
    }
  elsif ($cat eq 'error')
    {
      $warnings_are_errors = ! $has_no;
      # Set exit code if Perl warns about something
      # (like uninitialized variables).
      $SIG{"__WARN__"} =
	$has_no ? 'DEFAULT' : sub { print STDERR @_; $exit_code = 1; };
    }
  elsif (channel_type ($cat) eq 'warning')
    {
      setup_channel $cat, silent => $has_no;
      #
      # Handling of portability warnings is trickier.  For relevant tests,
      # see 'dollarvar2', 'extra-portability' and 'extra-portability3'.
      #
      # -Wportability-recursive and -Wno-portability-recursive should not
      # have any effect on other 'portability' or 'extra-portability'
      # warnings, so there's no need to handle them separately or ad-hoc.
      #
      if ($cat eq 'extra-portability' && ! $has_no) # -Wextra-portability
        {
          # -Wextra-portability must enable 'portability' and
          # 'portability-recursive' warnings.
          setup_channel 'portability', silent => 0;
          setup_channel 'portability-recursive', silent => 0;
        }
      if ($cat eq 'portability') # -Wportability or -Wno-portability
        {
          if ($has_no) # -Wno-portability
            {
              # -Wno-portability must disable 'extra-portability' and
              # 'portability-recursive' warnings.
              setup_channel 'portability-recursive', silent => 1;
              setup_channel 'extra-portability', silent => 1;
            }
          else # -Wportability
            {
              # -Wportability must enable 'portability-recursive'
              # warnings.  But it should have no influence over the
              # 'extra-portability' warnings.
              setup_channel 'portability-recursive', silent => 0;
            }
        }
    }
  else
    {
      return 1;
    }
  return 0;
}

=item C<parse_WARNINGS ()>

Parse the WARNINGS environment variable.

=cut

sub parse_WARNINGS ()
{
  if (exists $ENV{'WARNINGS'})
    {
      # Ignore unknown categories.  This is required because WARNINGS
      # should be honored by many tools.
      switch_warning $_ foreach (split (',', $ENV{'WARNINGS'}));
    }
}

=item C<parse_warnings ($OPTION, $ARGUMENT)>

Parse the argument of C<--warning=CATEGORY> or C<-WCATEGORY>.

C<$OPTIONS> is C<"--warning"> or C<"-W">, C<$ARGUMENT> is C<CATEGORY>.

This is meant to be used as an argument to C<Getopt>.

=cut

sub parse_warnings ($$)
{
  my ($opt, $categories) = @_;

  foreach my $cat (split (',', $categories))
    {
      msg 'unsupported', "unknown warning category '$cat'"
	if switch_warning $cat;
    }
}

=item C<set_strictness ($STRICTNESS_NAME)>

Configure channels for strictness C<$STRICTNESS_NAME>.

=cut

sub set_strictness ($)
{
  my ($name) = @_;

  if ($name eq 'gnu')
    {
      setup_channel 'error-gnu', silent => 0;
      setup_channel 'error-gnu/warn', silent => 0, type => 'error';
      setup_channel 'error-gnits', silent => 1;
      setup_channel 'portability', silent => 0;
      setup_channel 'extra-portability', silent => 1;
      setup_channel 'gnu', silent => 0;
    }
  elsif ($name eq 'gnits')
    {
      setup_channel 'error-gnu', silent => 0;
      setup_channel 'error-gnu/warn', silent => 0, type => 'error';
      setup_channel 'error-gnits', silent => 0;
      setup_channel 'portability', silent => 0;
      setup_channel 'extra-portability', silent => 1;
      setup_channel 'gnu', silent => 0;
    }
  elsif ($name eq 'foreign')
    {
      setup_channel 'error-gnu', silent => 1;
      setup_channel 'error-gnu/warn', silent => 0, type => 'warning';
      setup_channel 'error-gnits', silent => 1;
      setup_channel 'portability', silent => 1;
      setup_channel 'extra-portability', silent => 1;
      setup_channel 'gnu', silent => 1;
    }
  else
    {
      prog_error "level '$name' not recognized";
    }
}

=back

=head1 SEE ALSO

L<Automake::Channels>

=head1 HISTORY

Written by Alexandre Duret-Lutz E<lt>F<adl@gnu.org>E<gt>.

=cut

1;
Automake/Config.pm000064400000002730150523165450010065 0ustar00#  -*- Perl -*-
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
# Generated from Config.in; do not edit by hand.

# 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, see <https://www.gnu.org/licenses/>.

package Automake::Config;
use strict;

use 5.006;
require Exporter;

our @ISA = qw (Exporter);
our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION
                  $RELEASE_YEAR $libdir $perl_threads);

# Parameters set by configure.  Not to be changed.  NOTE: assign
# VERSION as string so that e.g. version 0.30 will print correctly.
our $APIVERSION = '1.16';
our $PACKAGE = 'automake';
our $PACKAGE_BUGREPORT = 'bug-automake@gnu.org';
our $VERSION = '1.16.1';
our $RELEASE_YEAR = '2018';
our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '/usr/share/automake-1.16';

our $perl_threads = 0;
# We need at least this version for CLONE support.
if (eval { require 5.007_002; })
  {
    use Config;
    $perl_threads = $Config{useithreads};
  }

1;
Automake/Configure_ac.pm000064400000005640150523165450011247 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

###############################################################
# The main copy of this file is in Automake's git repository. #
# Updates should be sent to automake-patches@gnu.org.         #
###############################################################

package Automake::Configure_ac;

use 5.006;
use strict;
use Exporter;
use Automake::Channels;
use Automake::ChannelDefs;

use vars qw (@ISA @EXPORT);

@ISA = qw (Exporter);
@EXPORT = qw (&find_configure_ac &require_configure_ac);

=head1 NAME

Automake::Configure_ac - Locate configure.ac or configure.in.

=head1 SYNOPSIS

  use Automake::Configure_ac;

  # Try to locate configure.in or configure.ac in the current
  # directory.  It may be absent.  Complain if both files exist.
  my $file_name = find_configure_ac;

  # Likewise, but bomb out if the file does not exist.
  my $file_name = require_configure_ac;

  # Likewise, but in $dir.
  my $file_name = find_configure_ac ($dir);
  my $file_name = require_configure_ac ($dir);

=over 4

=back

=head2 Functions

=over 4

=item C<$configure_ac = find_configure_ac ([$directory])>

Find a F<configure.ac> or F<configure.in> file in C<$directory>,
defaulting to the current directory.  Complain if both files are present.
Return the name of the file found, or the former if neither is present.

=cut

sub find_configure_ac (;@)
{
  my ($directory) = @_;
  $directory ||= '.';
  my $configure_ac =
    File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.ac'));
  my $configure_in =
    File::Spec->canonpath (File::Spec->catfile ($directory, 'configure.in'));

  if (-f $configure_in)
    {
      msg ('obsolete', "autoconf input should be named 'configure.ac'," .
                       " not 'configure.in'");
      if (-f $configure_ac)
	{
	  msg ('unsupported',
	       "'$configure_ac' and '$configure_in' both present.\n"
	       . "proceeding with '$configure_ac'");
          return $configure_ac
	}
      else
        {
          return $configure_in;
        }
    }
  return $configure_ac;
}


=item C<$configure_ac = require_configure_ac ([$directory])>

Like C<find_configure_ac>, but fail if neither is present.

=cut

sub require_configure_ac (;$)
{
  my $res = find_configure_ac (@_);
  fatal "'configure.ac' is required" unless -f $res;
  return $res
}

1;
Automake/Language.pm000064400000005373150523165450010411 0ustar00# Copyright (C) 2013-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Language;

use 5.006;
use strict;

use Class::Struct ();
Class::Struct::struct (
	# Short name of the language (c, f77...).
	'name' => "\$",
	# Nice name of the language (C, Fortran 77...).
	'Name' => "\$",

	# List of configure variables which must be defined.
	'config_vars' => '@',

	# 'pure' is '1' or ''.  A 'pure' language is one where, if
	# all the files in a directory are of that language, then we
	# do not require the C compiler or any code to call it.
	'pure'   => "\$",

	'autodep' => "\$",

	# Name of the compiling variable (COMPILE).
	'compiler'  => "\$",
	# Content of the compiling variable.
	'compile'  => "\$",
	# Flag to require compilation without linking (-c).
	'compile_flag' => "\$",
	'extensions' => '@',
	# A subroutine to compute a list of possible extensions of
	# the product given the input extensions.
	# (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
	'output_extensions' => "\$",
	# A list of flag variables used in 'compile'.
	# (defaults to [])
	'flags' => "@",

	# Any tag to pass to libtool while compiling.
	'libtool_tag' => "\$",

	# The file to use when generating rules for this language.
	# The default is 'depend2'.
	'rule_file' => "\$",

	# Name of the linking variable (LINK).
	'linker' => "\$",
	# Content of the linking variable.
	'link' => "\$",

	# Name of the compiler variable (CC).
	'ccer' => "\$",

	# Name of the linker variable (LD).
	'lder' => "\$",
	# Content of the linker variable ($(CC)).
	'ld' => "\$",

	# Flag to specify the output file (-o).
	'output_flag' => "\$",
	'_finish' => "\$",

	# This is a subroutine which is called whenever we finally
	# determine the context in which a source file will be
	# compiled.
	'_target_hook' => "\$",

	# If TRUE, nodist_ sources will be compiled using specific rules
	# (i.e. not inference rules).  The default is FALSE.
	'nodist_specific' => "\$");


sub finish ($)
{
  my ($self) = @_;
  if (defined $self->_finish)
    {
      &{$self->_finish} (@_);
    }
}

sub target_hook ($$$$%)
{
    my ($self) = @_;
    if (defined $self->_target_hook)
    {
	$self->_target_hook->(@_);
    }
}

1;
Automake/Variable.pm000064400000131627150523165450010415 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Variable;

use 5.006;
use strict;
use Carp;

use Automake::Channels;
use Automake::ChannelDefs;
use Automake::Configure_ac;
use Automake::Item;
use Automake::VarDef;
use Automake::Condition qw (TRUE FALSE);
use Automake::DisjConditions;
use Automake::General 'uniq';
use Automake::Wrap 'makefile_wrap';

require Exporter;
use vars '@ISA', '@EXPORT', '@EXPORT_OK';
@ISA = qw/Automake::Item Exporter/;
@EXPORT = qw (err_var msg_var msg_cond_var reject_var
	      var rvar vardef rvardef
	      variables
	      scan_variable_expansions check_variable_expansions
	      variable_delete
	      variables_dump
	      set_seen
	      require_variables
	      variable_value
	      output_variables
	      transform_variable_recursively);

=head1 NAME

Automake::Variable - support for variable definitions

=head1 SYNOPSIS

  use Automake::Variable;
  use Automake::VarDef;

  # Defining a variable.
  Automake::Variable::define($varname, $owner, $type,
                             $cond, $value, $comment,
                             $where, $pretty)

  # Looking up a variable.
  my $var = var $varname;
  if ($var)
    {
      ...
    }

  # Looking up a variable that is assumed to exist.
  my $var = rvar $varname;

  # The list of conditions where $var has been defined.
  # ($var->conditions is an Automake::DisjConditions,
  # $var->conditions->conds is a list of Automake::Condition.)
  my @conds = $var->conditions->conds

  # Access to the definition in Condition $cond.
  # $def is an Automake::VarDef.
  my $def = $var->def ($cond);
  if ($def)
    {
      ...
    }

  # When the conditional definition is assumed to exist, use
  my $def = $var->rdef ($cond);


=head1 DESCRIPTION

This package provides support for Makefile variable definitions.

An C<Automake::Variable> is a variable name associated to possibly
many conditional definitions.  These definitions are instances
of C<Automake::VarDef>.

Therefore obtaining the value of a variable under a given
condition involves two lookups.  One to look up the variable,
and one to look up the conditional definition:

  my $var = var $name;
  if ($var)
    {
      my $def = $var->def ($cond);
      if ($def)
        {
          return $def->value;
        }
      ...
    }
  ...

When it is known that the variable and the definition
being looked up exist, the above can be simplified to

  return var ($name)->def ($cond)->value; # Do not write this.

but is better written

  return rvar ($name)->rdef ($cond)->value;

or even

  return rvardef ($name, $cond)->value;

The I<r> variants of the C<var>, C<def>, and C<vardef> methods add an
extra test to ensure that the lookup succeeded, and will diagnose
failures as internal errors (with a message which is much more
informative than Perl's warning about calling a method on a
non-object).

=cut

my $_VARIABLE_CHARACTERS = '[.A-Za-z0-9_@]+';
my $_VARIABLE_PATTERN = '^' . $_VARIABLE_CHARACTERS . "\$";
my $_VARIABLE_RECURSIVE_PATTERN =
    '^([.A-Za-z0-9_@]|\$[({]' . $_VARIABLE_CHARACTERS . '[})]?)+' . "\$";

# The order in which variables should be output.  (May contain
# duplicates -- only the first occurrence matters.)
my @_var_order;

# This keeps track of all variables defined by &_gen_varname.
# $_gen_varname{$base} is a hash for all variables defined with
# prefix '$base'.  Values stored in this hash are the variable names.
# Keys have the form "(COND1)VAL1(COND2)VAL2..." where VAL1 and VAL2
# are the values of the variable for condition COND1 and COND2.
my %_gen_varname = ();
# $_gen_varname_n{$base} is the number of variables generated by
# _gen_varname() for $base.  This is not the same as keys
# %{$_gen_varname{$base}} because %_gen_varname may also contain
# variables not generated by _gen_varname.
my %_gen_varname_n = ();

# Declare the macros that define known variables, so we can
# hint the user if she try to use one of these variables.

# Macros accessible via aclocal.
my %_am_macro_for_var =
  (
   CCAS => 'AM_PROG_AS',
   CCASFLAGS => 'AM_PROG_AS',
   EMACS => 'AM_PATH_LISPDIR',
   GCJ => 'AM_PROG_GCJ',
   LEX => 'AM_PROG_LEX',
   LIBTOOL => 'LT_INIT',
   lispdir => 'AM_PATH_LISPDIR',
   pkgpyexecdir => 'AM_PATH_PYTHON',
   pkgpythondir => 'AM_PATH_PYTHON',
   pyexecdir => 'AM_PATH_PYTHON',
   PYTHON => 'AM_PATH_PYTHON',
   pythondir => 'AM_PATH_PYTHON',
   );

# Macros shipped with Autoconf.
my %_ac_macro_for_var =
  (
   ALLOCA => 'AC_FUNC_ALLOCA',
   CC => 'AC_PROG_CC',
   CFLAGS => 'AC_PROG_CC',
   CXX => 'AC_PROG_CXX',
   CXXFLAGS => 'AC_PROG_CXX',
   F77 => 'AC_PROG_F77',
   FFLAGS => 'AC_PROG_F77',
   FC => 'AC_PROG_FC',
   FCFLAGS => 'AC_PROG_FC',
   OBJC => 'AC_PROG_OBJC',
   OBJCFLAGS => 'AC_PROG_OBJC',
   OBJCXX => 'AC_PROG_OBJCXX',
   OBJCXXFLAGS => 'AC_PROG_OBJCXX',
   RANLIB => 'AC_PROG_RANLIB',
   UPC => 'AM_PROG_UPC',
   UPCFLAGS => 'AM_PROG_UPC',
   YACC => 'AC_PROG_YACC',
   );

# The name of the configure.ac file.
my $configure_ac;

# Variables that can be overridden without complaint from -Woverride
my %_silent_variable_override =
  (AM_MAKEINFOHTMLFLAGS => 1,
   AR => 1,
   ARFLAGS => 1,
   DEJATOOL => 1,
   JAVAC => 1,
   JAVAROOT => 1);

# Count of helper variables used to implement conditional '+='.
my $_appendvar;

# Each call to C<Automake::Variable::traverse_recursively> gets an
# unique label. This is used to detect recursively defined variables.
my $_traversal = 0;


=head2 Error reporting functions

In these functions, C<$var> can be either a variable name, or
an instance of C<Automake::Variable>.

=over 4

=item C<err_var ($var, $message, [%options])>

Uncategorized errors about variables.

=cut

sub err_var ($$;%)
{
  msg_var ('error', @_);
}

=item C<msg_cond_var ($channel, $cond, $var, $message, [%options])>

Messages about conditional variable.

=cut

sub msg_cond_var ($$$$;%)
{
  my ($channel, $cond, $var, $msg, %opts) = @_;
  my $v = ref ($var) ? $var : rvar ($var);
  msg $channel, $v->rdef ($cond)->location, $msg, %opts;
}

=item C<msg_var ($channel, $var, $message, [%options])>

Messages about variables.

=cut

sub msg_var ($$$;%)
{
  my ($channel, $var, $msg, %opts) = @_;
  my $v = ref ($var) ? $var : rvar ($var);
  # Don't know which condition is concerned.  Pick any.
  my $cond = $v->conditions->one_cond;
  msg_cond_var $channel, $cond, $v, $msg, %opts;
}

=item C<$bool = reject_var ($varname, $error_msg)>

Bail out with C<$error_msg> if a variable with name C<$varname> has
been defined.

Return true iff C<$varname> is defined.

=cut

sub reject_var ($$)
{
  my ($var, $msg) = @_;
  my $v = var ($var);
  if ($v)
    {
      err_var $v, $msg;
      return 1;
    }
  return 0;
}

=back

=head2 Administrative functions

=over 4

=item C<Automake::Variable::hook ($varname, $fun)>

Declare a function to be called whenever a variable
named C<$varname> is defined or redefined.

C<$fun> should take two arguments: C<$type> and C<$value>.
When type is C<''> or <':'>, C<$value> is the value being
assigned to C<$varname>.  When C<$type> is C<'+'>, C<$value>
is the value being appended to  C<$varname>.

=cut

use vars '%_hooks';
sub hook ($$)
{
  my ($var, $fun) = @_;
  $_hooks{$var} = $fun;
}

=item C<variables ([$suffix])>

Returns the list of all L<Automake::Variable> instances.  (I.e., all
variables defined so far.)  If C<$suffix> is supplied, return only
the L<Automake::Variable> instances that ends with C<_$suffix>.

=cut

use vars '%_variable_dict', '%_primary_dict';
sub variables (;$)
{
  my ($suffix) = @_;
  my @vars = ();
  if ($suffix)
    {
      if (exists $_primary_dict{$suffix})
	{
	  @vars = values %{$_primary_dict{$suffix}};
	}
    }
  else
    {
      @vars = values %_variable_dict;
    }
  # The behaviour of the 'sort' built-in is undefined in scalar
  # context, hence we need an ad-hoc handling for such context.
  return wantarray ? sort { $a->name cmp $b->name } @vars : scalar @vars;
}

=item C<Automake::Variable::reset>

The I<forget all> function.  Clears all know variables and reset some
other internal data.

=cut

sub reset ()
{
  %_variable_dict = ();
  %_primary_dict = ();
  $_appendvar = 0;
  @_var_order = ();
  %_gen_varname = ();
  %_gen_varname_n = ();
  $_traversal = 0;
}

=item C<var ($varname)>

Return the C<Automake::Variable> object for the variable
named C<$varname> if defined.  Return 0 otherwise.

=cut

sub var ($)
{
  my ($name) = @_;
  return $_variable_dict{$name} if exists $_variable_dict{$name};
  return 0;
}

=item C<vardef ($varname, $cond)>

Return the C<Automake::VarDef> object for the variable named
C<$varname> if defined in condition C<$cond>.  Return false
if the condition or the variable does not exist.

=cut

sub vardef ($$)
{
  my ($name, $cond) = @_;
  my $var = var $name;
  return $var && $var->def ($cond);
}

# Create the variable if it does not exist.
# This is used only by other functions in this package.
sub _cvar ($)
{
  my ($name) = @_;
  my $v = var $name;
  return $v if $v;
  return _new Automake::Variable $name;
}

=item C<rvar ($varname)>

Return the C<Automake::Variable> object for the variable named
C<$varname>.  Abort with an internal error if the variable was not
defined.

The I<r> in front of C<var> stands for I<required>.  One
should call C<rvar> to assert the variable's existence.

=cut

sub rvar ($)
{
  my ($name) = @_;
  my $v = var $name;
  prog_error ("undefined variable $name\n" . &variables_dump)
    unless $v;
  return $v;
}

=item C<rvardef ($varname, $cond)>

Return the C<Automake::VarDef> object for the variable named
C<$varname> if defined in condition C<$cond>.  Abort with an internal
error if the condition or the variable does not exist.

=cut

sub rvardef ($$)
{
  my ($name, $cond) = @_;
  return rvar ($name)->rdef ($cond);
}

=back

=head2 Methods

C<Automake::Variable> is a subclass of C<Automake::Item>.  See
that package for inherited methods.

Here are the methods specific to the C<Automake::Variable> instances.
Use the C<define> function, described latter, to create such objects.

=over 4

=cut

# Create Automake::Variable objects.  This is used
# only in this file.  Other users should use
# the "define" function.
sub _new ($$)
{
  my ($class, $name) = @_;
  my $self = Automake::Item::new ($class, $name);
  $self->{'scanned'} = 0;
  $self->{'last-append'} = []; # helper variable for last conditional append.
  $_variable_dict{$name} = $self;
  if ($name =~ /_([[:alnum:]]+)$/)
    {
      $_primary_dict{$1}{$name} = $self;
    }
  return $self;
}

# _check_ambiguous_condition ($SELF, $COND, $WHERE)
# -------------------------------------------------
# Check for an ambiguous conditional.  This is called when a variable
# is being defined conditionally.  If we already know about a
# definition that is true under the same conditions, then we have an
# ambiguity.
sub _check_ambiguous_condition ($$$)
{
  my ($self, $cond, $where) = @_;
  my $var = $self->name;
  my ($message, $ambig_cond) = $self->conditions->ambiguous_p ($var, $cond);

  # We allow silent variables to be overridden silently,
  # by either silent or non-silent variables.
  my $def = $self->def ($ambig_cond);
  if ($message && $def->pretty != VAR_SILENT)
    {
      msg 'syntax', $where, "$message ...", partial => 1;
      msg_var ('syntax', $var, "... '$var' previously defined here");
      verb ($self->dump);
    }
}

=item C<$bool = $var-E<gt>check_defined_unconditionally ([$parent, $parent_cond])>

Warn if the variable is conditionally defined.  C<$parent> is the name
of the parent variable, and C<$parent_cond> the condition of the parent
definition.  These two variables are used to display diagnostics.

=cut

sub check_defined_unconditionally ($;$$)
{
  my ($self, $parent, $parent_cond) = @_;

  if (!$self->conditions->true)
    {
      if ($parent)
	{
	  msg_cond_var ('unsupported', $parent_cond, $parent,
			"automake does not support conditional definition of "
			. $self->name . " in $parent");
	}
      else
	{
	  msg_var ('unsupported', $self,
		   "automake does not support " . $self->name
		   . " being defined conditionally");
	}
    }
}

=item C<$str = $var-E<gt>output ([@conds])>

Format all the definitions of C<$var> if C<@cond> is not specified,
else only that corresponding to C<@cond>.

=cut

sub output ($@)
{
  my ($self, @conds) = @_;

  @conds = $self->conditions->conds
    unless @conds;

  my $res = '';
  my $name = $self->name;

  foreach my $cond (@conds)
    {
      my $def = $self->def ($cond);
      prog_error ("unknown condition '" . $cond->human . "' for '"
		  . $self->name . "'")
	unless $def;

      next
	if $def->pretty == VAR_SILENT;

      $res .= $def->comment;

      my $val = $def->raw_value;
      my $equals = $def->type eq ':' ? ':=' : '=';
      my $str = $cond->subst_string;


      if ($def->pretty == VAR_ASIS)
	{
	  my $output_var = "$name $equals $val";
	  $output_var =~ s/^/$str/meg;
	  $res .= "$output_var\n";
	}
      elsif ($def->pretty == VAR_PRETTY)
	{
	  # Suppress escaped new lines.  &makefile_wrap will
	  # add them back, maybe at other places.
	  $val =~ s/\\$//mg;
	  my $wrap = makefile_wrap ("$str$name $equals", "$str\t",
				    split (' ', $val));

	  # If the last line of the definition is made only of
	  # @substitutions@, append an empty variable to make sure it
	  # cannot be substituted as a blank line (that would confuse
	  # HP-UX Make).
	  $wrap = makefile_wrap ("$str$name $equals", "$str\t",
				 split (' ', $val), '$(am__empty)')
	    if $wrap =~ /\n(\s*@\w+@)+\s*$/;

	  $res .= $wrap;
	}
      else # ($def->pretty == VAR_SORTED)
	{
	  # Suppress escaped new lines.  &makefile_wrap will
	  # add them back, maybe at other places.
	  $val =~ s/\\$//mg;
	  $res .= makefile_wrap ("$str$name $equals", "$str\t",
				 sort (split (' ' , $val)));
	}
    }
  return $res;
}

=item C<@values = $var-E<gt>value_as_list ($cond, [$parent, $parent_cond])>

Get the value of C<$var> as a list, given a specified condition,
without recursing through any subvariables.

C<$cond> is the condition of interest.  C<$var> does not need
to be defined for condition C<$cond> exactly, but it needs
to be defined for at most one condition implied by C<$cond>.

C<$parent> and C<$parent_cond> designate the name and the condition
of the parent variable, i.e., the variable in which C<$var> is
being expanded.  These are used in diagnostics.

For example, if C<A> is defined as "C<foo $(B) bar>" in condition
C<TRUE>, calling C<rvar ('A')->value_as_list (TRUE)> will return
C<("foo", "$(B)", "bar")>.

=cut

sub value_as_list ($$;$$)
{
  my ($self, $cond, $parent, $parent_cond) = @_;
  my @result;

  # Get value for given condition
  my $onceflag;
  foreach my $vcond ($self->conditions->conds)
    {
      if ($vcond->true_when ($cond))
	{
	  # If there is more than one definitions of $var matching
	  # $cond then we are in trouble: tell the user we need a
	  # paddle.  Continue by merging results from all conditions,
	  # although it doesn't make much sense.
	  $self->check_defined_unconditionally ($parent, $parent_cond)
	    if $onceflag;
	  $onceflag = 1;

	  my $val = $self->rdef ($vcond)->value;
	  push @result, split (' ', $val);
	}
    }
  return @result;
}

=item C<@values = $var-E<gt>value_as_list_recursive ([%options])>

Return the contents of C<$var> as a list, split on whitespace.  This
will recursively follow C<$(...)> and C<${...}> inclusions.  It
preserves C<@...@> substitutions.

C<%options> is a list of option for C<Variable::traverse_recursively>
(see this method).  The most useful is C<cond_filter>:

  $var->value_as_list_recursive (cond_filter => $cond)

will return the contents of C<$var> and any subvariable in all
conditions implied by C<$cond>.

C<%options> can also carry options specific to C<value_as_list_recursive>.
Presently, the only such option is C<location =E<gt> 1> which instructs
C<value_as_list_recursive> to return a list of C<[$location, @values]> pairs.

=cut

sub value_as_list_recursive ($;%)
{
  my ($var, %options) = @_;

  return $var->traverse_recursively
    (# Construct [$location, $value] pairs if requested.
     sub {
       my ($var, $val, $cond, $full_cond) = @_;
       return [$var->rdef ($cond)->location, $val] if $options{'location'};
       return $val;
     },
     # Collect results.
     sub {
       my ($var, $parent_cond, @allresults) = @_;
       return map { my ($cond, @vals) = @$_; @vals } @allresults;
     },
     %options);
}


=item C<$bool = $var-E<gt>has_conditional_contents>

Return 1 if C<$var> or one of its subvariable was conditionally
defined.  Return 0 otherwise.

=cut

sub has_conditional_contents ($)
{
  my ($self) = @_;

  # Traverse the variable recursively until we
  # find a variable defined conditionally.
  # Use 'die' to abort the traversal, and pass it '$full_cond'
  # to we can find easily whether the 'eval' block aborted
  # because we found a condition, or for some other error.
  eval
    {
      $self->traverse_recursively
	(sub
	 {
	   my ($subvar, $val, $cond, $full_cond) = @_;
	   die $full_cond if ! $full_cond->true;
	   return ();
	 },
	 sub { return (); });
    };
  if ($@)
    {
      return 1 if ref ($@) && $@->isa ("Automake::Condition");
      # Propagate other errors.
      die;
    }
  return 0;
}


=item C<$string = $var-E<gt>dump>

Return a string describing all we know about C<$var>.
For debugging.

=cut

sub dump ($)
{
  my ($self) = @_;

  my $text = $self->name . ": \n  {\n";
  foreach my $vcond ($self->conditions->conds)
    {
      $text .= "    " . $vcond->human . " => " . $self->rdef ($vcond)->dump;
    }
  $text .= "  }\n";
  return $text;
}


=back

=head2 Utility functions

=over 4

=item C<@list = scan_variable_expansions ($text)>

Return the list of variable names expanded in C<$text>.  Note that
unlike some other functions, C<$text> is not split on spaces before we
check for subvariables.

=cut

sub scan_variable_expansions ($)
{
  my ($text) = @_;
  my @result = ();

  # Strip comments.
  $text =~ s/#.*$//;

  # Record each use of ${stuff} or $(stuff) that does not follow a $.
  while ($text =~ /(?<!\$)\$(?:\{([^\}]*)\}|\(([^\)]*)\))/g)
    {
      my $var = $1 || $2;
      # The occurrence may look like $(string1[:subst1=[subst2]]) but
      # we want only 'string1'.
      $var =~ s/:[^:=]*=[^=]*$//;
      push @result, $var;
    }

  return @result;
}

=item C<check_variable_expansions ($text, $where)>

Check variable expansions in C<$text> and warn about any name that
does not conform to POSIX.  C<$where> is the location of C<$text>
for the error message.

=cut

sub check_variable_expansions ($$)
{
  my ($text, $where) = @_;
  # Catch expansion of variables whose name does not conform to POSIX.
  foreach my $var (scan_variable_expansions ($text))
    {
      if ($var !~ /$_VARIABLE_PATTERN/o)
	{
	  # If the variable name contains a space, it's likely
	  # to be a GNU make extension (such as $(addsuffix ...)).
	  # Mention this in the diagnostic.
	  my $gnuext = "";
	  $gnuext = "\n(probably a GNU make extension)" if $var =~ / /;
	  # Accept recursive variable expansions if so desired
	  # (we hope they are rather portable in practice).
	  if ($var =~ /$_VARIABLE_RECURSIVE_PATTERN/o)
	    {
	      msg ('portability-recursive', $where,
		   "$var: non-POSIX recursive variable expansion$gnuext");
	    }
	  else
	    {
	      msg ('portability', $where, "$var: non-POSIX variable name$gnuext");
	    }
	}
    }
}



=item C<Automake::Variable::define($varname, $owner, $type, $cond, $value, $comment, $where, $pretty)>

Define or append to a new variable.

C<$varname>: the name of the variable being defined.

C<$owner>: owner of the variable (one of C<VAR_MAKEFILE>,
C<VAR_CONFIGURE>, or C<VAR_AUTOMAKE>, defined by L<Automake::VarDef>).
Variables can be overridden, provided the new owner is not weaker
(C<VAR_AUTOMAKE> < C<VAR_CONFIGURE> < C<VAR_MAKEFILE>).

C<$type>: the type of the assignment (C<''> for C<FOO = bar>,
C<':'> for C<FOO := bar>, and C<'+'> for C<'FOO += bar'>).

C<$cond>: the C<Condition> in which C<$var> is being defined.

C<$value>: the value assigned to C<$var> in condition C<$cond>.

C<$comment>: any comment (C<'# bla.'>) associated with the assignment.
Comments from C<+=> assignments stack with comments from the last C<=>
assignment.

C<$where>: the C<Location> of the assignment.

C<$pretty>: whether C<$value> should be pretty printed (one of
C<VAR_ASIS>, C<VAR_PRETTY>, C<VAR_SILENT>, or C<VAR_SORTED>, defined
by by L<Automake::VarDef>).  C<$pretty> applies only to real
assignments.  I.e., it does not apply to a C<+=> assignment (except
when part of it is being done as a conditional C<=> assignment).

This function will all run any hook registered with the C<hook>
function.

=cut

sub define ($$$$$$$$)
{
  my ($var, $owner, $type, $cond, $value, $comment, $where, $pretty) = @_;

  prog_error "$cond is not a reference"
    unless ref $cond;

  prog_error "$where is not a reference"
    unless ref $where;

  prog_error "pretty argument missing"
    unless defined $pretty && ($pretty == VAR_ASIS
			       || $pretty == VAR_PRETTY
			       || $pretty == VAR_SILENT
			       || $pretty == VAR_SORTED);

  error $where, "bad characters in variable name '$var'"
    if $var !~ /$_VARIABLE_PATTERN/o;

  # ':='-style assignments are not acknowledged by POSIX.  Moreover it
  # has multiple meanings.  In GNU make or BSD make it means "assign
  # with immediate expansion", while in OSF make it is used for
  # conditional assignments.
  msg ('portability', $where, "':='-style assignments are not portable")
    if $type eq ':';

  check_variable_expansions ($value, $where);

  # If there's a comment, make sure it is \n-terminated.
  if ($comment)
    {
      chomp $comment;
      $comment .= "\n";
    }
  else
    {
      $comment = '';
    }

  my $self = _cvar $var;

  my $def = $self->def ($cond);
  my $new_var = $def ? 0 : 1;

  # Additional checks for Automake definitions.
  if ($owner == VAR_AUTOMAKE && ! $new_var)
    {
      # An Automake variable must be consistently defined with the same
      # sign by Automake.
      if ($def->type ne $type && $def->owner == VAR_AUTOMAKE)
	{
	  error ($def->location,
		 "Automake variable '$var' was set with '"
		 . $def->type . "=' here ...", partial => 1);
	  error ($where, "... and is now set with '$type=' here.");
	  prog_error ("Automake variable assignments should be consistently\n"
		      . "defined with the same sign");
	}

      # If Automake tries to override a value specified by the user,
      # just don't let it do.
      if ($def->owner != VAR_AUTOMAKE)
	{
	  if (! exists $_silent_variable_override{$var})
	    {
	      my $condmsg = ($cond == TRUE
			     ? '' : (" in condition '" . $cond->human . "'"));
	      msg_cond_var ('override', $cond, $var,
			    "user variable '$var' defined here$condmsg ...",
			    partial => 1);
	      msg ('override', $where,
		   "... overrides Automake variable '$var' defined here");
	    }
	  verb ("refusing to override the user definition of:\n"
		. $self->dump ."with '" . $cond->human . "' => '$value'");
	  return;
	}
    }

  # Differentiate assignment types.

  # 1. append (+=) to a variable defined for current condition
  if ($type eq '+' && ! $new_var)
    {
      $def->append ($value, $comment);
      $self->{'last-append'} = [];

      # Only increase owners.  A VAR_CONFIGURE variable augmented in a
      # Makefile.am becomes a VAR_MAKEFILE variable.
      $def->set_owner ($owner, $where->clone)
	if $owner > $def->owner;
    }
  # 2. append (+=) to a variable defined for *another* condition
  elsif ($type eq '+' && ! $self->conditions->false)
    {
      # * Generally, $cond is not TRUE.  For instance:
      #     FOO = foo
      #     if COND
      #       FOO += bar
      #     endif
      #   In this case, we declare an helper variable conditionally,
      #   and append it to FOO:
      #     FOO = foo $(am__append_1)
      #     @COND_TRUE@am__append_1 = bar
      #   Of course if FOO is defined under several conditions, we add
      #   $(am__append_1) to each definitions.
      #
      # * If $cond is TRUE, we don't need the helper variable.  E.g., in
      #     if COND1
      #       FOO = foo1
      #     else
      #       FOO = foo2
      #     endif
      #     FOO += bar
      #   we can add bar directly to all definition of FOO, and output
      #     @COND_TRUE@FOO = foo1 bar
      #     @COND_FALSE@FOO = foo2 bar

      my $lastappend = [];
      # Do we need an helper variable?
      if ($cond != TRUE)
        {
	  # Can we reuse the helper variable created for the previous
	  # append?  (We cannot reuse older helper variables because
	  # we must preserve the order of items appended to the
	  # variable.)
	  my $condstr = $cond->string;
	  my $key = "$var:$condstr";
	  my ($appendvar, $appendvarcond) = @{$self->{'last-append'}};
	  if ($appendvar && $condstr eq $appendvarcond)
	    {
	      # Yes, let's simply append to it.
	      $var = $appendvar;
	      $owner = VAR_AUTOMAKE;
	      $self = var ($var);
	      $def = $self->rdef ($cond);
	      $new_var = 0;
	    }
	  else
	    {
	      # No, create it.
	      my $num = ++$_appendvar;
	      my $hvar = "am__append_$num";
	      $lastappend = [$hvar, $condstr];
	      &define ($hvar, VAR_AUTOMAKE, '+',
		       $cond, $value, $comment, $where, $pretty);

	      # Now HVAR is to be added to VAR.
	      $comment = '';
	      $value = "\$($hvar)";
	    }
	}

      # Add VALUE to all definitions of SELF.
      foreach my $vcond ($self->conditions->conds)
        {
	  # We have a bit of error detection to do here.
	  # This:
	  #   if COND1
	  #     X = Y
	  #   endif
	  #   X += Z
	  # should be rejected because X is not defined for all conditions
	  # where '+=' applies.
	  my $undef_cond = $self->not_always_defined_in_cond ($cond);
	  if (! $undef_cond->false)
	    {
	      error ($where,
		     "cannot apply '+=' because '$var' is not defined "
		     . "in\nthe following conditions:\n  "
		     . join ("\n  ", map { $_->human } $undef_cond->conds)
		     . "\neither define '$var' in these conditions,"
		     . " or use\n'+=' in the same conditions as"
		     . " the definitions.");
	    }
	  else
	    {
	      &define ($var, $owner, '+', $vcond, $value, $comment,
		       $where, $pretty);
	    }
	}
      $self->{'last-append'} = $lastappend;
    }
  # 3. first assignment (=, :=, or +=)
  else
    {
      # There must be no previous value unless the user is redefining
      # an Automake variable or an AC_SUBST variable for an existing
      # condition.
      _check_ambiguous_condition ($self, $cond, $where)
	unless (!$new_var
		&& (($def->owner == VAR_AUTOMAKE && $owner != VAR_AUTOMAKE)
		    || $def->owner == VAR_CONFIGURE));

      # Never decrease an owner.
      $owner = $def->owner
	if ! $new_var && $owner < $def->owner;

      # Assignments to a macro set its location.  We don't adjust
      # locations for '+='.  Ideally I suppose we would associate
      # line numbers with random bits of text.
      $def = new Automake::VarDef ($var, $value, $comment, $where->clone,
				   $type, $owner, $pretty);
      $self->set ($cond, $def);
      push @_var_order, $var;
    }

  # Call any defined hook.  This helps to update some internal state
  # *while* parsing the file.  For instance the handling of SUFFIXES
  # requires this (see var_SUFFIXES_trigger).
  &{$_hooks{$var}}($type, $value) if exists $_hooks{$var};
}

=item C<variable_delete ($varname, [@conds])>

Forget about C<$varname> under the conditions C<@conds>, or completely
if C<@conds> is empty.

=cut

sub variable_delete ($@)
{
  my ($var, @conds) = @_;

  if (!@conds)
    {
      delete $_variable_dict{$var};
    }
  else
    {
      for my $cond (@conds)
	{
	  delete $_variable_dict{$var}{'defs'}{$cond};
	}
    }
  if ($var =~ /_([[:alnum:]]+)$/)
    {
      delete $_primary_dict{$1}{$var};
    }
}

=item C<$str = variables_dump>

Return a string describing all we know about all variables.
For debugging.

=cut

sub variables_dump ()
{
  my $text = "all variables:\n{\n";
  foreach my $var (variables())
    {
      $text .= $var->dump;
    }
  $text .= "}\n";
  return $text;
}


=item C<$var = set_seen ($varname)>

=item C<$var = $var-E<gt>set_seen>

Mark all definitions of this variable as examined, if the variable
exists.  See L<Automake::VarDef::set_seen>.

Return the C<Variable> object if the variable exists, or 0
otherwise (i.e., as the C<var> function).

=cut

sub set_seen ($)
{
  my ($self) = @_;
  $self = ref $self ? $self : var $self;

  return 0 unless $self;

  for my $c ($self->conditions->conds)
    {
      $self->rdef ($c)->set_seen;
    }

  return $self;
}


=item C<$count = require_variables ($where, $reason, $cond, @variables)>

Make sure that each supplied variable is defined in C<$cond>.
Otherwise, issue a warning showing C<$reason> (C<$reason> should be
the reason why these variables are required, for instance C<'option foo
used'>).  If we know which macro can define this variable, hint the
user.  Return the number of undefined variables.

=cut

sub require_variables ($$$@)
{
  my ($where, $reason, $cond, @vars) = @_;
  my $res = 0;
  $reason .= ' but ' unless $reason eq '';

  $configure_ac = find_configure_ac
    unless defined $configure_ac;

 VARIABLE:
  foreach my $var (@vars)
    {
      # Nothing to do if the variable exists.
      next VARIABLE
	if vardef ($var, $cond);

      my $text = "$reason'$var' is undefined\n";
      my $v = var $var;
      if ($v)
	{
	  my $undef_cond = $v->not_always_defined_in_cond ($cond);
	  next VARIABLE
	    if $undef_cond->false;
	  $text .= ("in the following conditions:\n  "
		    . join ("\n  ", map { $_->human } $undef_cond->conds)
		    . "\n");
	}

      ++$res;

      if (exists $_am_macro_for_var{$var})
	{
	  my $mac = $_am_macro_for_var{$var};
	  $text .= "  The usual way to define '$var' is to add "
	    . "'$mac'\n  to '$configure_ac' and run 'aclocal' and "
	    . "'autoconf' again.";
	  # aclocal will not warn about undefined macros unless it
	  # starts with AM_.
	  $text .= "\n  If '$mac' is in '$configure_ac', make sure\n"
	    . "  its definition is in aclocal's search path."
	    unless $mac =~ /^AM_/;
	}
      elsif (exists $_ac_macro_for_var{$var})
	{
	  $text .= "  The usual way to define '$var' is to add "
	    . "'$_ac_macro_for_var{$var}'\n  to '$configure_ac' and "
	    . "run 'autoconf' again.";
	}

      error $where, $text, uniq_scope => US_GLOBAL;
    }
  return $res;
}

=item C<$count = $var->requires_variables ($reason, @variables)>

Same as C<require_variables>, but a method of Automake::Variable.
C<@variables> should be defined in the same conditions as C<$var> is
defined.

=cut

sub requires_variables ($$@)
{
  my ($var, $reason, @args) = @_;
  my $res = 0;
  for my $cond ($var->conditions->conds)
    {
      $res += require_variables ($var->rdef ($cond)->location, $reason,
				 $cond, @args);
    }
  return $res;
}


=item C<variable_value ($var)>

Get the C<TRUE> value of a variable, warn if the variable is
conditionally defined.  C<$var> can be either a variable name
or a C<Automake::Variable> instance (this allows calls such
as C<$var-E<gt>variable_value>).

=cut

sub variable_value ($)
{
    my ($var) = @_;
    my $v = ref ($var) ? $var : var ($var);
    return () unless $v;
    $v->check_defined_unconditionally;
    my $d = $v->def (TRUE);
    return $d ? $d->value : "";
}

=item C<$str = output_variables>

Format definitions for all variables.

=cut

sub output_variables ()
{
  my $res = '';
  # We output variables it in the same order in which they were
  # defined (skipping duplicates).
  my @vars = uniq @_var_order;

  # Output all the Automake variables.  If the user changed one,
  # then it is now marked as VAR_CONFIGURE or VAR_MAKEFILE.
  foreach my $var (@vars)
    {
      my $v = rvar $var;
      foreach my $cond ($v->conditions->conds)
	{
	  $res .= $v->output ($cond)
	    if $v->rdef ($cond)->owner == VAR_AUTOMAKE;
	}
    }

  # Now dump the user variables that were defined.
  foreach my $var (@vars)
    {
      my $v = rvar $var;
      foreach my $cond ($v->conditions->conds)
	{
	  $res .= $v->output ($cond)
	    if $v->rdef ($cond)->owner != VAR_AUTOMAKE;
	}
    }
  return $res;
}

=item C<$var-E<gt>traverse_recursively (&fun_item, &fun_collect, [cond_filter =E<gt> $cond_filter], [inner_expand =E<gt> 1], [skip_ac_subst =E<gt> 1])>

Split the value of the Automake::Variable C<$var> on space, and
traverse its components recursively.

If C<$cond_filter> is an C<Automake::Condition>, process any
conditions which are true when C<$cond_filter> is true.  Otherwise,
process all conditions.

We distinguish two kinds of items in the content of C<$var>.
Terms that look like C<$(foo)> or C<${foo}> are subvariables
and cause recursion.  Other terms are assumed to be filenames.

Each time a filename is encountered, C<&fun_item> is called with the
following arguments:

  ($var,        -- the Automake::Variable we are currently
                   traversing
   $val,        -- the item (i.e., filename) to process
   $cond,       -- the Condition for the $var definition we are
                   examining (ignoring the recursion context)
   $full_cond)  -- the full Condition, taking into account
                   conditions inherited from parent variables
                   during recursion

If C<inner_expand> is set, variable references occurring in filename
(as in C<$(BASE).ext>) are expanded before the filename is passed to
C<&fun_item>.

If C<skip_ac_subst> is set, Autoconf @substitutions@ will be skipped,
i.e., C<&fun_item> will never be called for them.

C<&fun_item> may return a list of items, they will be passed to
C<&fun_store> later on.  Define C<&fun_item> or @<&fun_store> as
C<undef> when they serve no purpose.

Once all items of a variable have been processed, the result (of the
calls to C<&fun_items>, or of recursive traversals of subvariables)
are passed to C<&fun_collect>.  C<&fun_collect> receives three
arguments:

  ($var,         -- the variable being traversed
   $parent_cond, -- the Condition inherited from parent
                    variables during recursion
   @condlist)    -- a list of [$cond, @results] pairs
                    where each $cond appear only once, and @result
                    are all the results for this condition.

Typically you should do C<$cond->merge ($parent_cond)> to recompute
the C<$full_cond> associated to C<@result>.  C<&fun_collect> may
return a list of items, that will be used as the result of
C<Automake::Variable::traverse_recursively> (the top-level, or its
recursive calls).

=cut

# Contains a stack of 'from' and 'to' parts of variable
# substitutions currently in force.
my @_substfroms;
my @_substtos;
sub traverse_recursively ($&&;%)
{
  ++$_traversal;
  @_substfroms = ();
  @_substtos = ();
  my ($var, $fun_item, $fun_collect, %options) = @_;
  my $cond_filter = $options{'cond_filter'};
  my $inner_expand = $options{'inner_expand'};
  my $skip_ac_subst = $options{'skip_ac_subst'};
  return $var->_do_recursive_traversal ($var,
					$fun_item, $fun_collect,
					$cond_filter, TRUE, $inner_expand,
					$skip_ac_subst)
}

# The guts of Automake::Variable::traverse_recursively.
sub _do_recursive_traversal ($$&&$$$$)
{
  my ($var, $parent, $fun_item, $fun_collect, $cond_filter, $parent_cond,
      $inner_expand, $skip_ac_subst) = @_;

  $var->set_seen;

  if ($var->{'scanned'} == $_traversal)
    {
      err_var $var, "variable '" . $var->name() . "' recursively defined";
      return ();
    }
  $var->{'scanned'} = $_traversal;

  my @allresults = ();
  my $cond_once = 0;
  foreach my $cond ($var->conditions->conds)
    {
      if (ref $cond_filter)
	{
	  # Ignore conditions that don't match $cond_filter.
	  next if ! $cond->true_when ($cond_filter);
	  # If we found out several definitions of $var
	  # match $cond_filter then we are in trouble.
	  # Tell the user we don't support this.
	  $var->check_defined_unconditionally ($parent, $parent_cond)
	    if $cond_once;
	  $cond_once = 1;
	}
      my @result = ();
      my $full_cond = $cond->merge ($parent_cond);

      my @to_process = $var->value_as_list ($cond, $parent, $parent_cond);
      while (@to_process)
	{
	  my $val = shift @to_process;
	  # If $val is a variable (i.e. ${foo} or $(bar), not a filename),
	  # handle the sub variable recursively.
	  # (Backslashes before '}' and ')' within brackets are here to
	  # please Emacs's indentation.)
	  if ($val =~ /^\$\{([^\}]*)\}$/ || $val =~ /^\$\(([^\)]*)\)$/)
	    {
	      my $subvarname = $1;

	      # If the user uses a losing variable name, just ignore it.
	      # This isn't ideal, but people have requested it.
	      next if ($subvarname =~ /\@.*\@/);

	      # See if the variable is actually a substitution reference
	      my ($from, $to);
              # This handles substitution references like ${foo:.a=.b}.
	      if ($subvarname =~ /^([^:]*):([^=]*)=(.*)$/o)
		{
		  $subvarname = $1;
		  $to = $3;
		  $from = quotemeta $2;
		}

	      my $subvar = var ($subvarname);
	      # Don't recurse into undefined variables.
	      next unless $subvar;

	      push @_substfroms, $from;
	      push @_substtos, $to;

	      my @res = $subvar->_do_recursive_traversal ($parent,
							  $fun_item,
							  $fun_collect,
							  $cond_filter,
							  $full_cond,
							  $inner_expand,
							  $skip_ac_subst);
	      push (@result, @res);

	      pop @_substfroms;
	      pop @_substtos;

	      next;
	    }
	  # Try to expand variable references inside filenames such as
	  # '$(NAME).txt'.  We do not handle ':.foo=.bar'
	  # substitutions, but it would make little sense to use this
	  # here anyway.
	  elsif ($inner_expand
		 && ($val =~ /\$\{([^\}]*)\}/ || $val =~ /\$\(([^\)]*)\)/))
	    {
	      my $subvarname = $1;
	      my $subvar = var $subvarname;
	      if ($subvar)
		{
		  # Replace the reference by its value, and reschedule
		  # for expansion.
		  foreach my $c ($subvar->conditions->conds)
		    {
		      if (ref $cond_filter)
			{
			  # Ignore conditions that don't match $cond_filter.
			  next if ! $c->true_when ($cond_filter);
			  # If we found out several definitions of $var
			  # match $cond_filter then we are in trouble.
			  # Tell the user we don't support this.
			  $subvar->check_defined_unconditionally ($var,
								  $full_cond)
			    if $cond_once;
			  $cond_once = 1;
			}
		      my $subval = $subvar->rdef ($c)->value;
		      $val =~ s/\$\{$subvarname\}/$subval/g;
		      $val =~ s/\$\($subvarname\)/$subval/g;
		      unshift @to_process, split (' ', $val);
		    }
		  next;
		}
	      # We do not know any variable with this name.  Fall through
	      # to filename processing.
	    }
	  elsif ($skip_ac_subst && $val =~ /^\@.+\@$/)
	    {
	      next;
	    }

	  if ($fun_item) # $var is a filename we must process
	    {
	      my $substnum=$#_substfroms;
	      while ($substnum >= 0)
		{
		  $val =~ s/$_substfroms[$substnum]$/$_substtos[$substnum]/
		    if defined $_substfroms[$substnum];
		  $substnum -= 1;
		}

	      # Make sure you update the doc of
	      # Automake::Variable::traverse_recursively
	      # if you change the prototype of &fun_item.
	      my @transformed = &$fun_item ($var, $val, $cond, $full_cond);
	      push (@result, @transformed);
	    }
	}
      push (@allresults, [$cond, @result]) if @result;
    }

  # We only care about _recursive_ variable definitions.  The user
  # is free to use the same variable several times in the same definition.
  $var->{'scanned'} = -1;

  return ()
    unless $fun_collect;
  # Make sure you update the doc of Automake::Variable::traverse_recursively
  # if you change the prototype of &fun_collect.
  return &$fun_collect ($var, $parent_cond, @allresults);
}

# _hash_varname ($VAR)
# --------------------
# Compute the key associated $VAR in %_gen_varname.
# See _gen_varname() below.
sub _hash_varname ($)
{
  my ($var) = @_;
  my $key = '';
  foreach my $cond ($var->conditions->conds)
    {
      my @values = $var->value_as_list ($cond);
      $key .= "($cond)@values";
    }
  return $key;
}

# _hash_values (@VALUES)
# ----------------------
# Hash @VALUES for %_gen_varname.  @VALUES should be a list
# of pairs: ([$cond, @values], [$cond, @values], ...).
# See _gen_varname() below.
sub _hash_values (@)
{
  my $key = '';
  foreach my $pair (@_)
    {
      my ($cond, @values) = @$pair;
      $key .= "($cond)@values";
    }
  return $key;
}
# ($VARNAME, $GENERATED)
# _gen_varname ($BASE, @DEFINITIONS)
# ----------------------------------
# Return a variable name starting with $BASE, that will be
# used to store definitions @DEFINITIONS.
# @DEFINITIONS is a list of pair [$COND, @OBJECTS].
#
# If we already have a $BASE-variable containing @DEFINITIONS, reuse
# it and set $GENERATED to 0.  Otherwise construct a new name and set
# $GENERATED to 1.
#
# This way, we avoid combinatorial explosion of the generated
# variables.  Especially, in a Makefile such as:
#
# | if FOO1
# | A1=1
# | endif
# |
# | if FOO2
# | A2=2
# | endif
# |
# | ...
# |
# | if FOON
# | AN=N
# | endif
# |
# | B=$(A1) $(A2) ... $(AN)
# |
# | c_SOURCES=$(B)
# | d_SOURCES=$(B)
#
# The generated c_OBJECTS and d_OBJECTS will share the same variable
# definitions.
#
# This setup can be the case of a testsuite containing lots (>100) of
# small C programs, all testing the same set of source files.
sub _gen_varname ($@)
{
  my $base = shift;
  my $key = _hash_values @_;

  return ($_gen_varname{$base}{$key}, 0)
    if exists $_gen_varname{$base}{$key};

  my $num = 1 + ($_gen_varname_n{$base} || 0);
  $_gen_varname_n{$base} = $num;
  my $name = "${base}_${num}";
  $_gen_varname{$base}{$key} = $name;

  return ($name, 1);
}

=item C<$resvar = transform_variable_recursively ($var, $resvar, $base, $nodefine, $where, &fun_item, [%options])>

=item C<$resvar = $var-E<gt>transform_variable_recursively ($resvar, $base, $nodefine, $where, &fun_item, [%options])>

Traverse C<$var> recursively, and create a C<$resvar> variable in
which each filename in C<$var> have been transformed using
C<&fun_item>.  (C<$var> may be a variable name in the first syntax.
It must be an C<Automake::Variable> otherwise.)

Helper variables (corresponding to sub-variables of C<$var>) are
created as needed, using C<$base> as prefix.

Arguments are:
  $var       source variable to traverse
  $resvar    resulting variable to define
  $base      prefix to use when naming subvariables of $resvar
  $nodefine  if true, traverse $var but do not define any variable
             (this assumes &fun_item has some useful side-effect)
  $where     context into which variable definitions are done
  &fun_item  a transformation function -- see the documentation
             of &fun_item in Automake::Variable::traverse_recursively.

This returns the string C<"\$($RESVAR)">.

C<%options> is a list of options to pass to
C<Variable::traverse_recursively> (see this method).

=cut

sub transform_variable_recursively ($$$$$&;%)
{
  my ($var, $resvar, $base, $nodefine, $where, $fun_item, %options) = @_;

  $var = ref $var ? $var : rvar $var;

  my $res = $var->traverse_recursively
    ($fun_item,
     # The code that defines the variable holding the result
     # of the recursive transformation of a subvariable.
     sub {
       my ($subvar, $parent_cond, @allresults) = @_;
       # If no definition is required, return anything: the result is
       # not expected to be used, only the side effect of $fun_item
       # should matter.
       return 'report-me' if $nodefine;
       # Cache $subvar, so that we reuse it if @allresults is the same.
       my $key = _hash_varname $subvar;
       $_gen_varname{$base}{$key} = $subvar->name;

       # Find a name for the variable, unless this is the top-variable
       # for which we want to use $resvar.
       my ($varname, $generated) =
	 ($var != $subvar) ? _gen_varname ($base, @allresults) : ($resvar, 1);

       # Define the variable if we are not reusing a previously
       # defined variable.  At the top-level, we can also avoid redefining
       # the variable if it already contains the same values.
       if ($generated
	   && !($varname eq $var->name && $key eq _hash_values @allresults))
	 {
	   # If the new variable is the source variable, we assume
	   # we are trying to override a user variable.  Delete
	   # the old variable first.
	   variable_delete ($varname) if $varname eq $var->name;
	   # Define an empty variable in condition TRUE if there is no
	   # result.
	   @allresults = ([TRUE, '']) unless @allresults;
	   # Define the rewritten variable in all conditions not
	   # already covered by user definitions.
	   foreach my $pair (@allresults)
	     {
	       my ($cond, @result) = @$pair;
	       my $var = var $varname;
	       my @conds = ($var
			    ? $var->not_always_defined_in_cond ($cond)->conds
			    : $cond);

	       foreach (@conds)
		 {
		   define ($varname, VAR_AUTOMAKE, '', $_, "@result",
			   '', $where, VAR_PRETTY);
		 }
	     }
	 }
       set_seen $varname;
       return "\$($varname)";
     },
     %options);
  return $res;
}


=back

=head1 SEE ALSO

L<Automake::VarDef>, L<Automake::Condition>,
L<Automake::DisjConditions>, L<Automake::Location>.

=cut

1;
Automake/ItemDef.pm000064400000003670150523165450010201 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::ItemDef;

use 5.006;
use strict;
use Carp;

=head1 NAME

Automake::ItemDef - base class for Automake::VarDef and Automake::RuleDef

=head1 DESCRIPTION

=head2 Methods

=over 4

=item C<my $def = Automake::new ($comment, $location, $owner)>

Create a new Makefile-item definition.

C<$comment> is any comment preceding the definition.  (Because
Automake reorders items in the output, it also tries to carry comments
around.)

C<$location> is the place where the definition occurred, it should be
an instance of L<Automake::Location>.

C<$owner> specifies who owns the rule.

=cut

sub new ($$$$)
{
  my ($class, $comment, $location, $owner) = @_;

  my $self = {
    comment => $comment,
    location => $location,
    owner => $owner,
  };
  bless $self, $class;

  return $self;
}

=item C<$def-E<gt>comment>

=item C<$def-E<gt>location>

=item C<$def-E<gt>owner>

Accessors to the various constituents of an C<ItemDef>.  See the
documentation of C<new>'s arguments for a description of these.

=cut

sub comment ($)
{
  my ($self) = @_;
  return $self->{'comment'};
}

sub location ($)
{
  my ($self) = @_;
  return $self->{'location'};
}

sub owner ($)
{
  my ($self) = @_;
  return $self->{'owner'};
}

=head1 SEE ALSO

L<Automake::VarDef>, and L<Automake::RuleDef>.

=cut

1;
Automake/Location.pm000064400000012575150523165450010440 0ustar00# Copyright (C) 2002-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Location;

use 5.006;

=head1 NAME

Automake::Location - a class for location tracking, with a stack of contexts

=head1 SYNOPSIS

  use Automake::Location;

  # Create a new Location object
  my $where = new Automake::Location "foo.c:13";

  # Change the location
  $where->set ("foo.c:14");

  # Get the location (without context).
  # Here this should print "foo.c:14"
  print $where->get, "\n";

  # Push a context, and change the location
  $where->push_context ("included from here");
  $where->set ("bar.h:1");

  # Print the location and the stack of context (for debugging)
  print $where->dump;
  # This should display
  #   bar.h:1:
  #   foo.c:14:   included from here

  # Get the contexts (list of [$location_string, $description])
  for my $pair (reverse $where->contexts)
    {
      my ($loc, $descr) = @{$pair};
      ...
    }

  # Pop a context, and reset the location to the previous context.
  $where->pop_context;

  # Clone a Location.  Use this when storing the state of a location
  # that would otherwise be modified.
  my $where_copy = $where->clone;

  # Serialize a Location object (for passing through a thread queue,
  # for example)
  my @array = $where->serialize ();

  # De-serialize: recreate a Location object from a queue.
  my $where = new Automake::Location::deserialize ($queue);

=head1 DESCRIPTION

C<Location> objects are used to keep track of locations in Automake,
and used to produce diagnostics.

A C<Location> object is made of two parts: a location string, and
a stack of contexts.

For instance if C<VAR> is defined at line 1 in F<bar.h> which was
included at line 14 in F<foo.c>, then the location string should be
C<"bar.h:10"> and the context should be the pair (C<"foo.c:14">,
C<"included from here">).

Section I<SYNOPSIS> shows how to setup such a C<Location>, and access
the location string or the stack of contexts.

You can pass a C<Location> to C<Automake::Channels::msg>.

=cut

=head2 Methods

=over

=item C<$where = new Automake::Location ([$position])>

Create and return a new Location object.

=cut

sub new ($;$)
{
  my ($class, $position) = @_;
  my $self = {
    position => $position,
    contexts => [],
  };
  bless $self, $class;
  return $self;
}

=item C<$location-E<gt>set ($position)>

Change the location to be C<$position>.

=cut

sub set ($$)
{
  my ($self, $position) = @_;
  $self->{'position'} = $position;
}

=item C<$location-E<gt>get>

Get the location (without context).

=cut

sub get ($)
{
  my ($self) = @_;
  return $self->{'position'};
}

=item C<$location-E<gt>push_context ($context)>

Push a context to the location.

=cut

sub push_context ($$)
{
  my ($self, $context) = @_;
  push @{$self->{'contexts'}}, [$self->get, $context];
  $self->set (undef);
}

=item C<$where = $location-E<gt>pop_context ($context)>

Pop a context, and reset the location to the previous context.

=cut

sub pop_context ($)
{
  my ($self) = @_;
  my $pair = pop @{$self->{'contexts'}};
  $self->set ($pair->[0]);
  return @{$pair};
}

=item C<@contexts = $location-E<gt>get_contexts>

Return the array of contexts.

=cut

sub get_contexts ($)
{
  my ($self) = @_;
  return @{$self->{'contexts'}};
}

=item C<$location = $location-E<gt>clone>

Clone a Location.  Use this when storing the state of a location
that would otherwise be modified.

=cut

sub clone ($)
{
  my ($self) = @_;
  my $other = new Automake::Location ($self->get);
  my @contexts = $self->get_contexts;
  for my $pair (@contexts)
    {
      push @{$other->{'contexts'}}, [@{$pair}];
    }
  return $other;
}

=item C<$res = $location-E<gt>dump>

Print the location and the stack of context (for debugging).

=cut

sub dump ($)
{
  my ($self) = @_;
  my $res = ($self->get || 'INTERNAL') . ":\n";
  for my $pair (reverse $self->get_contexts)
    {
      $res .= $pair->[0] || 'INTERNAL';
      $res .= ": $pair->[1]\n";
    }
  return $res;
}

=item C<@array = $location-E<gt>serialize>

Serialize a Location object (for passing through a thread queue,
for example).

=cut

sub serialize ($)
{
  my ($self) = @_;
  my @serial = ();
  push @serial, $self->get;
  my @contexts = $self->get_contexts;
  for my $pair (@contexts)
    {
      push @serial, @{$pair};
    }
  push @serial, undef;
  return @serial;
}

=item C<new Automake::Location::deserialize ($queue)>

De-serialize: recreate a Location object from a queue.

=cut

sub deserialize ($)
{
  my ($queue) = @_;
  my $position = $queue->dequeue ();
  my $self = new Automake::Location $position;
  while (my $position = $queue->dequeue ())
    {
      my $context = $queue->dequeue ();
      push @{$self->{'contexts'}}, [$position, $context];
    }
  return $self;
}

=back

=head1 SEE ALSO

L<Automake::Channels>

=head1 HISTORY

Written by Alexandre Duret-Lutz E<lt>F<adl@gnu.org>E<gt>.

=cut

1;
Automake/Wrap.pm000064400000007225150523165450007575 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Wrap;

use 5.006;
use strict;

require Exporter;
use vars '@ISA', '@EXPORT_OK';
@ISA = qw/Exporter/;
@EXPORT_OK = qw/wrap makefile_wrap/;

=head1 NAME

Automake::Wrap - a paragraph formatter

=head1 SYNOPSIS

  use Automake::Wrap 'wrap', 'makefile_wrap';

  print wrap ($first_ident, $next_ident, $end_of_line, $max_length,
              @values);

  print makefile_wrap ("VARIABLE = ", "    ", @values);

=head1 DESCRIPTION

This modules provide facility to format list of strings.  It is
comparable to Perl's L<Text::Wrap>, however we can't use L<Text::Wrap>
because some versions will abort when some word to print exceeds the
maximum length allowed.  (Ticket #17141, fixed in Perl 5.8.0.)

=head2 Functions

=over 4

=cut

# _tab_length ($TXT)
# ------------------
# Compute the length of TXT, counting tab characters as 8 characters.
sub _tab_length($)
{
  my ($txt) = @_;
  my $len = length ($txt);
  $len += 7 * ($txt =~ tr/\t/\t/);
  return $len;
}

=item C<wrap ($head, $fill, $eol, $max_len, @values)>

Format C<@values> as a block of text that starts with C<$head>,
followed by the strings in C<@values> separated by spaces or by
C<"$eol\n$fill"> so that the length of each line never exceeds
C<$max_len>.

The C<$max_len> constraint is ignored for C<@values> items which
are too big to fit alone one a line.

The constructed paragraph is C<"\n">-terminated.

=cut

sub wrap($$$$@)
{
  my ($head, $fill, $eol, $max_len, @values) = @_;

  my $result = $head;
  my $column = _tab_length ($head);

  my $fill_len = _tab_length ($fill);
  my $eol_len = _tab_length ($eol);

  my $not_first_word = 0;

  foreach (@values)
    {
      my $len = _tab_length ($_);

      # See if the new variable fits on this line.
      # (The + 1 is for the space we add in front of the value.).
      if ($column + $len + $eol_len + 1 > $max_len
	  # Do not break before the first word if it does not fit on
	  # the next line anyway.
	  && ($not_first_word || $fill_len + $len + $eol_len + 1 <= $max_len))
	{
	  # Start a new line.
	  $result .= "$eol\n" . $fill;
	  $column = $fill_len;
	}
      elsif ($not_first_word)
	{
	  # Add a space only if result does not already end
	  # with a space.
	  $_ = " $_" if $result =~ /\S\z/;
	  ++$len;
	}
      $result .= $_;
      $column += $len;
      $not_first_word = 1;
    }

  $result .= "\n";
  return $result;
}


=item C<makefile_wrap ($head, $fill, @values)>

Format C<@values> in a way which is suitable for F<Makefile>s.
This is comparable to C<wrap>, except C<$eol> is known to
be C<" \\">, and the maximum length has been hardcoded to C<72>.

A space is appended to C<$head> when this is not already
the case.

This can be used to format variable definitions or dependency lines.

  makefile_wrap ('VARIABLE =', "\t", @values);
  makefile_wrap ('rule:', "\t", @dependencies);

=cut

sub makefile_wrap ($$@)
{
  my ($head, $fill, @values) = @_;
  if (@values)
    {
      $head .= ' ' if $head =~ /\S\z/;
      return wrap $head, $fill, " \\", 72, @values;
    }
  return "$head\n";
}


1;
Automake/Channels.pm000064400000047771150523165450010431 0ustar00# Copyright (C) 2002-2018 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, see <https://www.gnu.org/licenses/>.

###############################################################
# The main copy of this file is in Automake's git repository. #
# Updates should be sent to automake-patches@gnu.org.         #
###############################################################

package Automake::Channels;

=head1 NAME

Automake::Channels - support functions for error and warning management

=head1 SYNOPSIS

  use Automake::Channels;

  # Register a channel to output warnings about unused variables.
  register_channel 'unused', type => 'warning';

  # Register a channel for system errors.
  register_channel 'system', type => 'error', exit_code => 4;

  # Output a message on channel 'unused'.
  msg 'unused', "$file:$line", "unused variable '$var'";

  # Make the 'unused' channel silent.
  setup_channel 'unused', silent => 1;

  # Turn on all channels of type 'warning'.
  setup_channel_type 'warning', silent => 0;

  # Redirect all channels to push messages on a Thread::Queue using
  # the specified serialization key.
  setup_channel_queue $queue, $key;

  # Output a message pending in a Thread::Queue.
  pop_channel_queue $queue;

  # Treat all warnings as errors.
  $warnings_are_errors = 1;

  # Exit with the greatest exit code encountered so far.
  exit $exit_code;

=head1 DESCRIPTION

This perl module provides support functions for handling diagnostic
channels in programs.  Channels can be registered to convey fatal,
error, warning, or debug messages.  Each channel has various options
(e.g. is the channel silent, should duplicate messages be removed,
etc.) that can also be overridden on a per-message basis.

=cut

use 5.006;
use strict;
use Exporter;
use Carp;
use File::Basename;

use vars qw (@ISA @EXPORT %channels $me);

@ISA = qw (Exporter);
@EXPORT = qw ($exit_code $warnings_are_errors
	      &reset_local_duplicates &reset_global_duplicates
	      &register_channel &msg &exists_channel &channel_type
	      &setup_channel &setup_channel_type
	      &dup_channel_setup &drop_channel_setup
	      &buffer_messages &flush_messages
	      &setup_channel_queue &pop_channel_queue
	      US_GLOBAL US_LOCAL
	      UP_NONE UP_TEXT UP_LOC_TEXT);

$me = basename $0;

=head2 Global Variables

=over 4

=item C<$exit_code>

The greatest exit code seen so far. C<$exit_code> is updated from
the C<exit_code> options of C<fatal> and C<error> channels.

=cut

use vars qw ($exit_code);
$exit_code = 0;

=item C<$warnings_are_errors>

Set this variable to 1 if warning messages should be treated as
errors (i.e. if they should update C<$exit_code>).

=cut

use vars qw ($warnings_are_errors);
$warnings_are_errors = 0;

=back

=head2 Constants

=over 4

=item C<UP_NONE>, C<UP_TEXT>, C<UP_LOC_TEXT>

Possible values for the C<uniq_part> options.  This selects the part
of the message that should be considered when filtering out duplicates.
If C<UP_LOC_TEXT> is used, the location and the explanation message
are used for filtering.  If C<UP_TEXT> is used, only the explanation
message is used (so the same message will be filtered out if it appears
at different locations).  C<UP_NONE> means that duplicate messages
should be output.

=cut

use constant UP_NONE => 0;
use constant UP_TEXT => 1;
use constant UP_LOC_TEXT => 2;

=item C<US_LOCAL>, C<US_GLOBAL>

Possible values for the C<uniq_scope> options.
Use C<US_GLOBAL> for error messages that should be printed only
once during the execution of the program, C<US_LOCAL> for message that
should be printed only once per file.  (Actually, C<Channels> does not
do this now when files are changed, it relies on you calling
C<reset_local_duplicates> when this happens.)

=cut

# possible values for uniq_scope
use constant US_LOCAL => 0;
use constant US_GLOBAL => 1;

=back

=head2 Options

Channels accept the options described below.  These options can be
passed as a hash to the C<register_channel>, C<setup_channel>, and C<msg>
functions.  The possible keys, with their default value are:

=over

=item C<type =E<gt> 'warning'>

The type of the channel.  One of C<'debug'>, C<'warning'>, C<'error'>, or
C<'fatal'>.  Fatal messages abort the program when they are output.
Error messages update the exit status.  Debug and warning messages are
harmless, except that warnings are treated as errors if
C<$warnings_are_errors> is set.

=item C<exit_code =E<gt> 1>

The value to update C<$exit_code> with when a fatal or error message
is emitted.  C<$exit_code> is also updated for warnings output
when C<$warnings_are_errors> is set.

=item C<file =E<gt> \*STDERR>

The file where the error should be output.

=item C<silent =E<gt> 0>

Whether the channel should be silent.  Use this do disable a
category of warning, for instance.

=item C<ordered =E<gt> 1>

Whether, with multi-threaded execution, the message should be queued
for ordered output.

=item C<uniq_part =E<gt> UP_LOC_TEXT>

The part of the message subject to duplicate filtering.  See the
documentation for the C<UP_NONE>, C<UP_TEXT>, and C<UP_LOC_TEXT>
constants above.

C<uniq_part> can also be set to an arbitrary string that will be used
instead of the message when considering duplicates.

=item C<uniq_scope =E<gt> US_LOCAL>

The scope of duplicate filtering.  See the documentation for the
C<US_LOCAL>, and C<US_GLOBAL> constants above.

=item C<header =E<gt> ''>

A string to prepend to each message emitted through this channel.
With partial messages, only the first part will have C<header>
prepended.

=item C<footer =E<gt> ''>

A string to append to each message emitted through this channel.
With partial messages, only the final part will have C<footer>
appended.

=item C<backtrace =E<gt> 0>

Die with a stack backtrace after displaying the message.

=item C<partial =E<gt> 0>

When set, indicates a partial message that should
be output along with the next message with C<partial> unset.
Several partial messages can be stacked this way.

Duplicate filtering will apply to the I<global> message resulting from
all I<partial> messages, using the options from the last (non-partial)
message.  Linking associated messages is the main reason to use this
option.

For instance the following messages

  msg 'channel', 'foo:2', 'redefinition of A ...';
  msg 'channel', 'foo:1', '... A previously defined here';
  msg 'channel', 'foo:3', 'redefinition of A ...';
  msg 'channel', 'foo:1', '... A previously defined here';

will result in

 foo:2: redefinition of A ...
 foo:1: ... A previously defined here
 foo:3: redefinition of A ...

where the duplicate "I<... A previously defined here>" has been
filtered out.

Linking these messages using C<partial> as follows will prevent the
fourth message to disappear.

  msg 'channel', 'foo:2', 'redefinition of A ...', partial => 1;
  msg 'channel', 'foo:1', '... A previously defined here';
  msg 'channel', 'foo:3', 'redefinition of A ...', partial => 1;
  msg 'channel', 'foo:1', '... A previously defined here';

Note that because the stack of C<partial> messages is printed with the
first non-C<partial> message, most options of C<partial> messages will
be ignored.

=back

=cut

use vars qw (%_default_options %_global_duplicate_messages
	     %_local_duplicate_messages);

# Default options for a channel.
%_default_options =
  (
   type => 'warning',
   exit_code => 1,
   file => \*STDERR,
   silent => 0,
   ordered => 1,
   queue => 0,
   queue_key => undef,
   uniq_scope => US_LOCAL,
   uniq_part => UP_LOC_TEXT,
   header => '',
   footer => '',
   backtrace => 0,
   partial => 0,
   );

# Filled with output messages as keys, to detect duplicates.
# The value associated with each key is the number of occurrences
# filtered out.
%_local_duplicate_messages = ();
%_global_duplicate_messages = ();

sub _reset_duplicates (\%)
{
  my ($ref) = @_;
  my $dup = 0;
  foreach my $k (keys %$ref)
    {
      $dup += $ref->{$k};
    }
  %$ref = ();
  return $dup;
}


=head2 Functions

=over 4

=item C<reset_local_duplicates ()>

Reset local duplicate messages (see C<US_LOCAL>), and
return the number of messages that have been filtered out.

=cut

sub reset_local_duplicates ()
{
  return _reset_duplicates %_local_duplicate_messages;
}

=item C<reset_global_duplicates ()>

Reset local duplicate messages (see C<US_GLOBAL>), and
return the number of messages that have been filtered out.

=cut

sub reset_global_duplicates ()
{
  return _reset_duplicates %_global_duplicate_messages;
}

sub _merge_options (\%%)
{
  my ($hash, %options) = @_;
  local $_;

  foreach (keys %options)
    {
      if (exists $hash->{$_})
	{
	  $hash->{$_} = $options{$_}
	}
      else
	{
	  confess "unknown option '$_'";
	}
    }
  if ($hash->{'ordered'})
    {
      confess "fatal messages cannot be ordered"
	if $hash->{'type'} eq 'fatal';
      confess "backtrace cannot be output on ordered messages"
	if $hash->{'backtrace'};
    }
}

=item C<register_channel ($name, [%options])>

Declare channel C<$name>, and override the default options
with those listed in C<%options>.

=cut

sub register_channel ($;%)
{
  my ($name, %options) = @_;
  my %channel_opts = %_default_options;
  _merge_options %channel_opts, %options;
  $channels{$name} = \%channel_opts;
}

=item C<exists_channel ($name)>

Returns true iff channel C<$name> has been registered.

=cut

sub exists_channel ($)
{
  my ($name) = @_;
  return exists $channels{$name};
}

=item C<channel_type ($name)>

Returns the type of channel C<$name> if it has been registered.
Returns the empty string otherwise.

=cut

sub channel_type ($)
{
  my ($name) = @_;
  return $channels{$name}{'type'} if exists_channel $name;
  return '';
}

# _format_sub_message ($LEADER, $MESSAGE)
# ---------------------------------------
# Split $MESSAGE at new lines and add $LEADER to each line.
sub _format_sub_message ($$)
{
  my ($leader, $message) = @_;
  return $leader . join ("\n" . $leader, split ("\n", $message)) . "\n";
}

# Store partial messages here. (See the 'partial' option.)
use vars qw ($partial);
$partial = '';

# _format_message ($LOCATION, $MESSAGE, %OPTIONS)
# -----------------------------------------------
# Format the message.  Return a string ready to print.
sub _format_message ($$%)
{
  my ($location, $message, %opts) = @_;
  my $msg = ($partial eq '' ? $opts{'header'} : '') . $message
	    . ($opts{'partial'} ? '' : $opts{'footer'});
  if (ref $location)
    {
      # If $LOCATION is a reference, assume it's an instance of the
      # Automake::Location class and display contexts.
      my $loc = $location->get || $me;
      $msg = _format_sub_message ("$loc: ", $msg);
      for my $pair ($location->get_contexts)
	{
	  $msg .= _format_sub_message ($pair->[0] . ":   ", $pair->[1]);
	}
    }
  else
    {
      $location ||= $me;
      $msg = _format_sub_message ("$location: ", $msg);
    }
  return $msg;
}

# _enqueue ($QUEUE, $KEY, $UNIQ_SCOPE, $TO_FILTER, $MSG, $FILE)
# -------------------------------------------------------------
# Push message on a queue, to be processed by another thread.
sub _enqueue ($$$$$$)
{
  my ($queue, $key, $uniq_scope, $to_filter, $msg, $file) = @_;
  $queue->enqueue ($key, $msg, $to_filter, $uniq_scope);
  confess "message queuing works only for STDERR"
    if $file ne \*STDERR;
}

# _dequeue ($QUEUE)
# -----------------
# Pop a message from a queue, and print, similarly to how
# _print_message would do it.  Return 0 if the queue is
# empty.  Note that the key has already been dequeued.
sub _dequeue ($)
{
  my ($queue) = @_;
  my $msg = $queue->dequeue || return 0;
  my $to_filter = $queue->dequeue;
  my $uniq_scope = $queue->dequeue;
  my $file = \*STDERR;

  if ($to_filter ne '')
    {
      # Do we want local or global uniqueness?
      my $dups;
      if ($uniq_scope == US_LOCAL)
	{
	  $dups = \%_local_duplicate_messages;
	}
      elsif ($uniq_scope == US_GLOBAL)
	{
	  $dups = \%_global_duplicate_messages;
	}
      else
	{
	  confess "unknown value for uniq_scope: " . $uniq_scope;
	}

      # Update the hash of messages.
      if (exists $dups->{$to_filter})
	{
	  ++$dups->{$to_filter};
	  return 1;
	}
      else
	{
	  $dups->{$to_filter} = 0;
	}
    }
  print $file $msg;
  return 1;
}


# _print_message ($LOCATION, $MESSAGE, %OPTIONS)
# ----------------------------------------------
# Format the message, check duplicates, and print it.
sub _print_message ($$%)
{
  my ($location, $message, %opts) = @_;

  return 0 if ($opts{'silent'});

  my $msg = _format_message ($location, $message, %opts);
  if ($opts{'partial'})
    {
      # Incomplete message.  Store, don't print.
      $partial .= $msg;
      return;
    }
  else
    {
      # Prefix with any partial message send so far.
      $msg = $partial . $msg;
      $partial = '';
    }

  msg ('note', '', 'warnings are treated as errors', uniq_scope => US_GLOBAL)
    if ($opts{'type'} eq 'warning' && $warnings_are_errors);

  # Check for duplicate message if requested.
  my $to_filter;
  if ($opts{'uniq_part'} ne UP_NONE)
    {
      # Which part of the error should we match?
      if ($opts{'uniq_part'} eq UP_TEXT)
	{
	  $to_filter = $message;
	}
      elsif ($opts{'uniq_part'} eq UP_LOC_TEXT)
	{
	  $to_filter = $msg;
	}
      else
	{
	  $to_filter = $opts{'uniq_part'};
	}

      # Do we want local or global uniqueness?
      my $dups;
      if ($opts{'uniq_scope'} == US_LOCAL)
	{
	  $dups = \%_local_duplicate_messages;
	}
      elsif ($opts{'uniq_scope'} == US_GLOBAL)
	{
	  $dups = \%_global_duplicate_messages;
	}
      else
	{
	  confess "unknown value for uniq_scope: " . $opts{'uniq_scope'};
	}

      # Update the hash of messages.
      if (exists $dups->{$to_filter})
	{
	  ++$dups->{$to_filter};
	  return 0;
	}
      else
	{
	  $dups->{$to_filter} = 0;
	}
    }
  my $file = $opts{'file'};
  if ($opts{'ordered'} && $opts{'queue'})
    {
      _enqueue ($opts{'queue'}, $opts{'queue_key'}, $opts{'uniq_scope'},
		$to_filter, $msg, $file);
    }
  else
    {
      print $file $msg;
    }
  return 1;
}

=item C<msg ($channel, $location, $message, [%options])>

Emit a message on C<$channel>, overriding some options of the channel with
those specified in C<%options>.  Obviously C<$channel> must have been
registered with C<register_channel>.

C<$message> is the text of the message, and C<$location> is a location
associated to the message.

For instance to complain about some unused variable C<mumble>
declared at line 10 in F<foo.c>, one could do:

  msg 'unused', 'foo.c:10', "unused variable 'mumble'";

If channel C<unused> is not silent (and if this message is not a duplicate),
the following would be output:

  foo.c:10: unused variable 'mumble'

C<$location> can also be an instance of C<Automake::Location>.  In this
case, the stack of contexts will be displayed in addition.

If C<$message> contains newline characters, C<$location> is prepended
to each line.  For instance,

  msg 'error', 'somewhere', "1st line\n2nd line";

becomes

  somewhere: 1st line
  somewhere: 2nd line

If C<$location> is an empty string, it is replaced by the name of the
program.  Actually, if you don't use C<%options>, you can even
elide the empty C<$location>.  Thus

  msg 'fatal', '', 'fatal error';
  msg 'fatal', 'fatal error';

both print

  progname: fatal error

=cut


use vars qw (@backlog %buffering);

# See buffer_messages() and flush_messages() below.
%buffering = ();	# The map of channel types to buffer.
@backlog = ();		# The buffer of messages.

sub msg ($$;$%)
{
  my ($channel, $location, $message, %options) = @_;

  if (! defined $message)
    {
      $message = $location;
      $location = '';
    }

  confess "unknown channel $channel" unless exists $channels{$channel};

  my %opts = %{$channels{$channel}};
  _merge_options (%opts, %options);

  if (exists $buffering{$opts{'type'}})
    {
      push @backlog, [$channel, $location->clone, $message, %options];
      return;
    }

  # Print the message if needed.
  if (_print_message ($location, $message, %opts))
    {
      # Adjust exit status.
      if ($opts{'type'} eq 'error'
	  || $opts{'type'} eq 'fatal'
	  || ($opts{'type'} eq 'warning' && $warnings_are_errors))
	{
	  my $es = $opts{'exit_code'};
	  $exit_code = $es if $es > $exit_code;
	}

      # Die on fatal messages.
      confess if $opts{'backtrace'};
      if ($opts{'type'} eq 'fatal')
        {
	  # flush messages explicitly here, needed in worker threads.
	  STDERR->flush;
	  exit $exit_code;
	}
    }
}


=item C<setup_channel ($channel, %options)>

Override the options of C<$channel> with those specified by C<%options>.

=cut

sub setup_channel ($%)
{
  my ($name, %opts) = @_;
  confess "unknown channel $name" unless exists $channels{$name};
  _merge_options %{$channels{$name}}, %opts;
}

=item C<setup_channel_type ($type, %options)>

Override the options of any channel of type C<$type>
with those specified by C<%options>.

=cut

sub setup_channel_type ($%)
{
  my ($type, %opts) = @_;
  foreach my $channel (keys %channels)
    {
      setup_channel $channel, %opts
	if $channels{$channel}{'type'} eq $type;
    }
}

=item C<dup_channel_setup ()>, C<drop_channel_setup ()>

Sometimes it is necessary to make temporary modifications to channels.
For instance one may want to disable a warning while processing a
particular file, and then restore the initial setup.  These two
functions make it easy: C<dup_channel_setup ()> saves a copy of the
current configuration for later restoration by
C<drop_channel_setup ()>.

You can think of this as a stack of configurations whose first entry
is the active one.  C<dup_channel_setup ()> duplicates the first
entry, while C<drop_channel_setup ()> just deletes it.

=cut

use vars qw (@_saved_channels @_saved_werrors);
@_saved_channels = ();
@_saved_werrors = ();

sub dup_channel_setup ()
{
  my %channels_copy;
  foreach my $k1 (keys %channels)
    {
      $channels_copy{$k1} = {%{$channels{$k1}}};
    }
  push @_saved_channels, \%channels_copy;
  push @_saved_werrors, $warnings_are_errors;
}

sub drop_channel_setup ()
{
  my $saved = pop @_saved_channels;
  %channels = %$saved;
  $warnings_are_errors = pop @_saved_werrors;
}

=item C<buffer_messages (@types)>, C<flush_messages ()>

By default, when C<msg> is called, messages are processed immediately.

Sometimes it is necessary to delay the output of messages.
For instance you might want to make diagnostics before
channels have been completely configured.

After C<buffer_messages(@types)> has been called, messages sent with
C<msg> to a channel whose type is listed in C<@types> will be stored in a
list for later processing.

This backlog of messages is processed when C<flush_messages> is
called, with the current channel options (not the options in effect,
at the time of C<msg>).  So for instance, if some channel was silenced
in the meantime, messages to this channel will not be printed.

C<flush_messages> cancels the effect of C<buffer_messages>.  Following
calls to C<msg> are processed immediately as usual.

=cut

sub buffer_messages (@)
{
  foreach my $type (@_)
    {
      $buffering{$type} = 1;
    }
}

sub flush_messages ()
{
  %buffering = ();
  foreach my $args (@backlog)
    {
      &msg (@$args);
    }
  @backlog = ();
}

=item C<setup_channel_queue ($queue, $key)>

Set the queue to fill for each channel that is ordered,
and the key to use for serialization.

=cut
sub setup_channel_queue ($$)
{
  my ($queue, $key) = @_;
  foreach my $channel (keys %channels)
    {
      setup_channel $channel, queue => $queue, queue_key => $key
        if $channels{$channel}{'ordered'};
    }
}

=item C<pop_channel_queue ($queue)>

pop a message off the $queue; the key has already been popped.

=cut
sub pop_channel_queue ($)
{
  my ($queue) = @_;
  return _dequeue ($queue);
}

=back

=head1 SEE ALSO

L<Automake::Location>

=head1 HISTORY

Written by Alexandre Duret-Lutz E<lt>F<adl@gnu.org>E<gt>.

=cut

1;
Automake/Condition.pm000064400000035513150523165450010613 0ustar00# Copyright (C) 1997-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Condition;

use 5.006;
use strict;
use Carp;

require Exporter;
use vars '@ISA', '@EXPORT_OK';
@ISA = qw/Exporter/;
@EXPORT_OK = qw/TRUE FALSE reduce_and reduce_or/;

=head1 NAME

Automake::Condition - record a conjunction of conditionals

=head1 SYNOPSIS

  use Automake::Condition;

  # Create a condition to represent "COND1 and not COND2".
  my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
  # Create a condition to represent "not COND3".
  my $other = new Automake::Condition "COND3_FALSE";

  # Create a condition to represent
  #   "COND1 and not COND2 and not COND3".
  my $both = $cond->merge ($other);

  # Likewise, but using a list of conditional strings
  my $both2 = $cond->merge_conds ("COND3_FALSE");

  # Strip from $both any subconditions which are in $other.
  # This is the opposite of merge.
  $cond = $both->strip ($other);

  # Return the list of conditions ("COND1_TRUE", "COND2_FALSE"):
  my @conds = $cond->conds;

  # Is $cond always true?  (Not in this example)
  if ($cond->true) { ... }

  # Is $cond always false? (Not in this example)
  if ($cond->false) { ... }

  # Return the list of conditionals as a string:
  #  "COND1_TRUE COND2_FALSE"
  my $str = $cond->string;

  # Return the list of conditionals as a human readable string:
  #  "COND1 and !COND2"
  my $str = $cond->human;

  # Return the list of conditionals as a AC_SUBST-style string:
  #  "@COND1_TRUE@@COND2_FALSE@"
  my $subst = $cond->subst_string;

  # Is $cond true when $both is true?  (Yes in this example)
  if ($cond->true_when ($both)) { ... }

  # Is $cond redundant w.r.t. {$other, $both}?
  # (Yes in this example)
  if ($cond->redundant_wrt ($other, $both)) { ... }

  # Does $cond imply any of {$other, $both}?
  # (Not in this example)
  if ($cond->implies_any ($other, $both)) { ... }

  # Remove superfluous conditionals assuming they will eventually
  # be multiplied together.
  # (Returns @conds = ($both) in this example, because
  # $other and $cond are implied by $both.)
  @conds = Automake::Condition::reduce_and ($other, $both, $cond);

  # Remove superfluous conditionals assuming they will eventually
  # be summed together.
  # (Returns @conds = ($cond, $other) in this example, because
  # $both is a subset condition of $cond: $cond is true whenever $both
  # is true.)
  @conds = Automake::Condition::reduce_or ($other, $both, $cond);

  # Invert a Condition.  This returns a list of Conditions.
  @conds = $both->not;

=head1 DESCRIPTION

A C<Condition> is a conjunction of conditionals (i.e., atomic conditions
defined in F<configure.ac> by C<AM_CONDITIONAL>.  In Automake they
are used to represent the conditions into which F<Makefile> variables and
F<Makefile> rules are defined.

If the variable C<VAR> is defined as

  if COND1
    if COND2
      VAR = value
    endif
  endif

then it will be associated a C<Condition> created with
the following statement.

  new Automake::Condition "COND1_TRUE", "COND2_TRUE";

Remember that a C<Condition> is a I<conjunction> of conditionals, so
the above C<Condition> means C<VAR> is defined when C<COND1>
B<and> C<COND2> are true. There is no way to express disjunctions
(i.e., I<or>s) with this class (but see L<DisjConditions>).

Another point worth to mention is that each C<Condition> object is
unique with respect to its conditionals.  Two C<Condition> objects
created for the same set of conditionals will have the same address.
This makes it easy to compare C<Condition>s: just compare the
references.

  my $c1 = new Automake::Condition "COND1_TRUE", "COND2_TRUE";
  my $c2 = new Automake::Condition "COND1_TRUE", "COND2_TRUE";
  $c1 == $c2;  # True!

=head2 Methods

=over 4

=item C<$cond = new Automake::Condition [@conds]>

Return a C<Condition> objects for the conjunctions of conditionals
listed in C<@conds> as strings.

An item in C<@conds> should be either C<"FALSE">, C<"TRUE">, or have
the form C<"NAME_FALSE"> or C<"NAME_TRUE"> where C<NAME> can be
anything (in practice C<NAME> should be the name of a conditional
declared in F<configure.ac> with C<AM_CONDITIONAL>, but it's not
C<Automake::Condition>'s responsibility to ensure this).

An empty C<@conds> means C<"TRUE">.

As explained previously, the reference (object) returned is unique
with respect to C<@conds>.  For this purpose, duplicate elements are
ignored, and C<@conds> is rewritten as C<("FALSE")> if it contains
C<"FALSE"> or two contradictory conditionals (such as C<"NAME_FALSE">
and C<"NAME_TRUE">.)

Therefore the following two statements create the same object (they
both create the C<"FALSE"> condition).

  my $c3 = new Automake::Condition "COND1_TRUE", "COND1_FALSE";
  my $c4 = new Automake::Condition "COND2_TRUE", "FALSE";
  $c3 == $c4;   # True!
  $c3 == FALSE; # True!

=cut

# Keys in this hash are conditional strings. Values are the
# associated object conditions.  This is used by 'new' to reuse
# Condition objects with identical conditionals.
use vars '%_condition_singletons';
# Do NOT reset this hash here.  It's already empty by default,
# and any setting would otherwise occur AFTER the 'TRUE' and 'FALSE'
# constants definitions.
#   %_condition_singletons = ();

sub new ($;@)
{
  my ($class, @conds) = @_;
  my $self = {
    hash => {},
  };
  bless $self, $class;

  for my $cond (@conds)
    {
      # Catch some common programming errors:
      # - A Condition passed to new
      confess "'$cond' is a reference, expected a string" if ref $cond;
      # - A Condition passed as a string to new
      confess "'$cond' does not look like a condition" if $cond =~ /::/;
    }

  # Accept strings like "FOO BAR" as shorthand for ("FOO", "BAR").
  @conds = map { split (' ', $_) } @conds;

  for my $cond (@conds)
    {
      next if $cond eq 'TRUE';

      # Detect cases when @conds can be simplified to FALSE.
      if (($cond eq 'FALSE' && $#conds > 0)
	  || ($cond =~ /^(.*)_TRUE$/ && exists $self->{'hash'}{"${1}_FALSE"})
	  || ($cond =~ /^(.*)_FALSE$/ && exists $self->{'hash'}{"${1}_TRUE"}))
	{
	  return &FALSE;
	}

      $self->{'hash'}{$cond} = 1;
    }

  my $key = $self->string;
  if (exists $_condition_singletons{$key})
    {
      return $_condition_singletons{$key};
    }
  $_condition_singletons{$key} = $self;
  return $self;
}

=item C<$newcond = $cond-E<gt>merge (@otherconds)>

Return a new condition which is the conjunction of
C<$cond> and C<@otherconds>.

=cut

sub merge ($@)
{
  my ($self, @otherconds) = @_;
  new Automake::Condition (map { $_->conds } ($self, @otherconds));
}

=item C<$newcond = $cond-E<gt>merge_conds (@conds)>

Return a new condition which is the conjunction of C<$cond> and
C<@conds>, where C<@conds> is a list of conditional strings, as
passed to C<new>.

=cut

sub merge_conds ($@)
{
  my ($self, @conds) = @_;
  new Automake::Condition $self->conds, @conds;
}

=item C<$newcond = $cond-E<gt>strip ($minuscond)>

Return a new condition which has all the conditionals of C<$cond>
except those of C<$minuscond>.  This is the opposite of C<merge>.

=cut

sub strip ($$)
{
  my ($self, $minus) = @_;
  my @res = grep { not $minus->_has ($_) } $self->conds;
  return new Automake::Condition @res;
}

=item C<@list = $cond-E<gt>conds>

Return the set of conditionals defining C<$cond>, as strings.  Note that
this might not be exactly the list passed to C<new> (or a
concatenation of such lists if C<merge> was used), because of the
cleanup mentioned in C<new>'s description.

For instance C<$c3-E<gt>conds> will simply return C<("FALSE")>.

=cut

sub conds ($ )
{
  my ($self) = @_;
  my @conds = keys %{$self->{'hash'}};
  return ("TRUE") unless @conds;
  return sort @conds;
}

# Undocumented, shouldn't be needed outside of this class.
sub _has ($$)
{
  my ($self, $cond) = @_;
  return exists $self->{'hash'}{$cond};
}

=item C<$cond-E<gt>false>

Return 1 iff this condition is always false.

=cut

sub false ($ )
{
  my ($self) = @_;
  return $self->_has ('FALSE');
}

=item C<$cond-E<gt>true>

Return 1 iff this condition is always true.

=cut

sub true ($ )
{
  my ($self) = @_;
  return 0 == keys %{$self->{'hash'}};
}

=item C<$cond-E<gt>string>

Build a string which denotes the condition.

For instance using the C<$cond> definition from L<SYNOPSYS>,
C<$cond-E<gt>string> will return C<"COND1_TRUE COND2_FALSE">.

=cut

sub string ($ )
{
  my ($self) = @_;

  return $self->{'string'} if defined $self->{'string'};

  my $res = '';
  if ($self->false)
    {
      $res = 'FALSE';
    }
  else
    {
      $res = join (' ', $self->conds);
    }
  $self->{'string'} = $res;
  return $res;
}

=item C<$cond-E<gt>human>

Build a human readable string which denotes the condition.

For instance using the C<$cond> definition from L<SYNOPSYS>,
C<$cond-E<gt>string> will return C<"COND1 and !COND2">.

=cut

sub _to_human ($ )
{
  my ($s) = @_;
  if ($s =~ /^(.*)_(TRUE|FALSE)$/)
    {
      return (($2 eq 'FALSE') ? '!' : '') . $1;
    }
  else
    {
      return $s;
    }
}

sub human ($ )
{
  my ($self) = @_;

  return $self->{'human'} if defined $self->{'human'};

  my $res = '';
  if ($self->false)
    {
      $res = 'FALSE';
    }
  else
    {
      $res = join (' and ', map { _to_human $_ } $self->conds);
    }
  $self->{'human'} = $res;
  return $res;
}

=item C<$cond-E<gt>subst_string>

Build a C<AC_SUBST>-style string for output in F<Makefile.in>.

For instance using the C<$cond> definition from L<SYNOPSYS>,
C<$cond-E<gt>subst_string> will return C<"@COND1_TRUE@@COND2_FALSE@">.

=cut

sub subst_string ($ )
{
  my ($self) = @_;

  return $self->{'subst_string'} if defined $self->{'subst_string'};

  my $res = '';
  if ($self->false)
    {
      $res = '#';
    }
  elsif (! $self->true)
    {
      $res = '@' . join ('@@', sort $self->conds) . '@';
    }
  $self->{'subst_string'} = $res;
  return $res;
}

=item C<$cond-E<gt>true_when ($when)>

Return 1 iff C<$cond> is true when C<$when> is true.
Return 0 otherwise.

Using the definitions from L<SYNOPSYS>, C<$cond> is true
when C<$both> is true, but the converse is wrong.

=cut

sub true_when ($$)
{
  my ($self, $when) = @_;

  # Nothing is true when FALSE (not even FALSE itself, but it
  # shouldn't hurt if you decide to change that).
  return 0 if $self->false || $when->false;

  # If we are true, we stay true when $when is true :)
  return 1 if $self->true;

  # $SELF is true under $WHEN if each conditional component of $SELF
  # exists in $WHEN.
  foreach my $cond ($self->conds)
    {
      return 0 unless $when->_has ($cond);
    }
  return 1;
}

=item C<$cond-E<gt>redundant_wrt (@conds)>

Return 1 iff C<$cond> is true for any condition in C<@conds>.
If @conds is empty, return 1 iff C<$cond> is C<FALSE>.
Return 0 otherwise.

=cut

sub redundant_wrt ($@)
{
  my ($self, @conds) = @_;

  foreach my $cond (@conds)
    {
      return 1 if $self->true_when ($cond);
    }
  return $self->false;
}

=item C<$cond-E<gt>implies_any (@conds)>

Return 1 iff C<$cond> implies any of the conditions in C<@conds>.
Return 0 otherwise.

=cut

sub implies_any ($@)
{
  my ($self, @conds) = @_;

  foreach my $cond (@conds)
    {
      return 1 if $cond->true_when ($self);
    }
  return 0;
}

=item C<$cond-E<gt>not>

Return a negation of C<$cond> as a list of C<Condition>s.
This list should be used to construct a C<DisjConditions>
(we cannot return a C<DisjConditions> from C<Automake::Condition>,
because that would make these two packages interdependent).

=cut

sub not ($ )
{
  my ($self) = @_;
  return @{$self->{'not'}} if defined $self->{'not'};
  my @res =
    map { new Automake::Condition &conditional_negate ($_) } $self->conds;
  $self->{'not'} = [@res];
  return @res;
}

=item C<$cond-E<gt>multiply (@conds)>

Assumption: C<@conds> represent a disjunction of conditions.

Return the result of multiplying C<$cond> with that disjunction.
The result will be a list of conditions suitable to construct a
C<DisjConditions>.

=cut

sub multiply ($@)
{
  my ($self, @set) = @_;
  my %res = ();
  for my $cond (@set)
    {
      my $ans = $self->merge ($cond);
      $res{$ans} = $ans;
    }

  # FALSE can always be removed from a disjunction.
  delete $res{FALSE};

  # Now, $self is a common factor of the remaining conditions.
  # If one of the conditions is $self, we can discard the rest.
  return ($self, ())
    if exists $res{$self};

  return (values %res);
}

=back

=head2 Other helper functions

=over 4

=item C<TRUE>

The C<"TRUE"> conditional.

=item C<FALSE>

The C<"FALSE"> conditional.

=cut

use constant TRUE => new Automake::Condition "TRUE";
use constant FALSE => new Automake::Condition "FALSE";

=item C<reduce_and (@conds)>

Return a subset of @conds with the property that the conjunction of
the subset is the same as the conjunction of @conds.  For example, if
both C<COND1_TRUE COND2_TRUE> and C<COND1_TRUE> are in the list,
discard the latter.  If the input list is empty, return C<(TRUE)>.

=cut

sub reduce_and (@)
{
  my (@conds) = @_;
  my @ret = ();
  my $cond;
  while (@conds > 0)
    {
      $cond = shift @conds;

      # FALSE is absorbent.
      return FALSE
	if $cond == FALSE;

      if (! $cond->redundant_wrt (@ret, @conds))
	{
	  push (@ret, $cond);
	}
    }

  return TRUE if @ret == 0;
  return @ret;
}

=item C<reduce_or (@conds)>

Return a subset of @conds with the property that the disjunction of
the subset is equivalent to the disjunction of @conds.  For example,
if both C<COND1_TRUE COND2_TRUE> and C<COND1_TRUE> are in the list,
discard the former.  If the input list is empty, return C<(FALSE)>.

=cut

sub reduce_or (@)
{
  my (@conds) = @_;
  my @ret = ();
  my $cond;
  while (@conds > 0)
    {
      $cond = shift @conds;

      next
       if $cond == FALSE;
      return TRUE
       if $cond == TRUE;

      push (@ret, $cond)
       unless $cond->implies_any (@ret, @conds);
    }

  return FALSE if @ret == 0;
  return @ret;
}

=item C<conditional_negate ($condstr)>

Negate a conditional string.

=cut

sub conditional_negate ($)
{
  my ($cond) = @_;

  $cond =~ s/TRUE$/TRUEO/;
  $cond =~ s/FALSE$/TRUE/;
  $cond =~ s/TRUEO$/FALSE/;

  return $cond;
}

=back

=head1 SEE ALSO

L<Automake::DisjConditions>.

=head1 HISTORY

C<AM_CONDITIONAL>s and supporting code were added to Automake 1.1o by
Ian Lance Taylor <ian@cygnus.org> in 1997.  Since then it has been
improved by Tom Tromey <tromey@redhat.com>, Richard Boulton
<richard@tartarus.org>, Raja R Harinath <harinath@cs.umn.edu>,
Akim Demaille <akim@epita.fr>, and  Alexandre Duret-Lutz <adl@gnu.org>.

=cut

1;
Automake/Version.pm000064400000007437150523165450010316 0ustar00# Copyright (C) 2001-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::Version;

use 5.006;
use strict;
use Automake::ChannelDefs;

=head1 NAME

Automake::Version - version comparison

=head1 SYNOPSIS

  use Automake::Version;

  print "Version $version is older than required version $required\n"
    if Automake::Version::check ($version, $required);

=head1 DESCRIPTION

This module provides support for comparing versions string
as they are used in Automake.

A version is a string that looks like
C<MAJOR.MINOR[.MICRO][ALPHA][-FORK]> where C<MAJOR>, C<MINOR>, and
C<MICRO> are digits, C<ALPHA> is a character, and C<FORK> any
alphanumeric word.

Usually, C<ALPHA> is used to label alpha releases or intermediate
snapshots, C<FORK> is used for git branches or patched releases, and
C<MICRO> is used for bug fixes releases on the C<MAJOR.MINOR> branch.

For the purpose of ordering, C<1.4> is the same as C<1.4.0>, but
C<1.4g> is the same as C<1.4.99g>.  The C<FORK> identifier is ignored
in the ordering, except when it looks like C<-pMINOR[ALPHA]>: some
versions were labeled like C<1.4-p3a>, this is the same as an alpha
release labeled C<1.4.3a>.  Yes, it's horrible, but Automake did not
support two-dot versions in the past.

=head2 FUNCTIONS

=over 4

=item C<split ($version)>

Split the string C<$version> into the corresponding C<(MAJOR, MINOR,
MICRO, ALPHA, FORK)> tuple.  For instance C<'1.4g'> would be split
into C<(1, 4, 99, 'g', '')>.  Return C<()> on error.

=cut

sub split ($)
{
  my ($ver) = @_;

  # Special case for versions like 1.4-p2a.
  if ($ver =~ /^(\d+)\.(\d+)(?:-p(\d+)([a-z]+)?)$/)
  {
    return ($1, $2, $3, $4 || '', '');
  }
  # Common case.
  elsif ($ver =~ /^(\d+)\.(\d+)(?:\.(\d+))?([a-z])?(?:-([A-Za-z0-9]+))?$/)
  {
    return ($1, $2, $3 || (defined $4 ? 99 : 0), $4 || '', $5 || '');
  }
  return ();
}

=item C<compare (\@LVERSION, \@RVERSION)>

Compare two version tuples, as returned by C<split>.

Return 1, 0, or -1, if C<LVERSION> is found to be respectively
greater than, equal to, or less than C<RVERSION>.

=cut

sub compare (\@\@)
{
  my @l = @{$_[0]};
  my @r = @{$_[1]};

  for my $i (0, 1, 2)
  {
    return 1  if ($l[$i] > $r[$i]);
    return -1 if ($l[$i] < $r[$i]);
  }
  for my $i (3, 4)
  {
    return 1  if ($l[$i] gt $r[$i]);
    return -1 if ($l[$i] lt $r[$i]);
  }
  return 0;
}

=item C<check($VERSION, $REQUIRED)>

Handles the logic of requiring a version number in Automake.
C<$VERSION> should be Automake's version, while C<$REQUIRED>
is the version required by the user input.

Return 0 if the required version is satisfied, 1 otherwise.

=cut

sub check ($$)
{
  my ($version, $required) = @_;
  my @version = Automake::Version::split ($version);
  my @required = Automake::Version::split ($required);

  prog_error "version is incorrect: $version"
    if $#version == -1;

  # This should not happen, because process_option_list and split_version
  # use similar regexes.
  prog_error "required version is incorrect: $required"
    if $#required == -1;

  # If we require 3.4n-foo then we require something
  # >= 3.4n, with the 'foo' fork identifier.
  return 1
    if ($required[4] ne '' && $required[4] ne $version[4]);

  return 0 > compare (@version, @required);
}

1;
Automake/RuleDef.pm000064400000004350150523165450010206 0ustar00# Copyright (C) 2003-2018 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, see <https://www.gnu.org/licenses/>.

package Automake::RuleDef;

use 5.006;
use strict;
use Carp;
use Automake::ChannelDefs;
use Automake::ItemDef;

require Exporter;
use vars '@ISA', '@EXPORT';
@ISA = qw/Automake::ItemDef Exporter/;
@EXPORT = qw (&RULE_AUTOMAKE &RULE_USER);

=head1 NAME

Automake::RuleDef - a class for rule definitions

=head1 SYNOPSIS

  use Automake::RuleDef;
  use Automake::Location;

=head1 DESCRIPTION

This class gathers data related to one Makefile-rule definition.
It shouldn't be needed outside of F<Rule.pm>.

=head2 Constants

=over 4

=item C<RULE_AUTOMAKE>, C<RULE_USER>

Possible owners for rules.

=cut

use constant RULE_AUTOMAKE => 0; # Rule defined by Automake.
use constant RULE_USER => 1;     # Rule defined in the user's Makefile.am.

=back

=head2 Methods

=over 4

=item C<new Automake::RuleDef ($name, $comment, $location, $owner, $source)>

Create a new rule definition with target C<$name>, with associated comment
C<$comment>, Location C<$location> and owner C<$owner>, defined in file
C<$source>.

=cut

sub new ($$$$$)
{
  my ($class, $name, $comment, $location, $owner, $source) = @_;

  my $self = Automake::ItemDef::new ($class, $comment, $location, $owner);
  $self->{'source'} = $source;
  $self->{'name'} = $name;
  return $self;
}

=item C<$source = $rule-E<gt>source>

Return the source of the rule.

=cut

sub source ($)
{
  my ($self) = @_;
  return $self->{'source'};
}

=item C<$name = $rule-E<gt>name>

Return the name of the rule.

=cut

sub name ($)
{
  my ($self) = @_;
  return $self->{'name'};
}

=back

=head1 SEE ALSO

L<Automake::Rule>, L<Automake::ItemDef>.

=cut

1;
mkinstalldirs000075500000006723150523165450007370 0ustar00#! /bin/sh
# mkinstalldirs --- make directory hierarchy

scriptversion=2018-03-07.03; # UTC

# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.

nl='
'
IFS=" ""	$nl"
errstatus=0
dirmode=

usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...

Create each directory DIR (with mode MODE, if specified), including all
leading file name components.

Report bugs to <bug-automake@gnu.org>."

# process command line arguments
while test $# -gt 0 ; do
  case $1 in
    -h | --help | --h*)         # -h for help
      echo "$usage"
      exit $?
      ;;
    -m)                         # -m PERM arg
      shift
      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
      dirmode=$1
      shift
      ;;
    --version)
      echo "$0 $scriptversion"
      exit $?
      ;;
    --)                         # stop option processing
      shift
      break
      ;;
    -*)                         # unknown option
      echo "$usage" 1>&2
      exit 1
      ;;
    *)                          # first non-opt arg
      break
      ;;
  esac
done

for file
do
  if test -d "$file"; then
    shift
  else
    break
  fi
done

case $# in
  0) exit 0 ;;
esac

# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error.  This is a problem when calling mkinstalldirs
# from a parallel make.  We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
  '')
    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
      echo "mkdir -p -- $*"
      exec mkdir -p -- "$@"
    else
      # On NextStep and OpenStep, the 'mkdir' command does not
      # recognize any option.  It will interpret all options as
      # directories to create, and then abort because '.' already
      # exists.
      test -d ./-p && rmdir ./-p
      test -d ./--version && rmdir ./--version
    fi
    ;;
  *)
    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
       test ! -d ./--version; then
      echo "mkdir -m $dirmode -p -- $*"
      exec mkdir -m "$dirmode" -p -- "$@"
    else
      # Clean up after NextStep and OpenStep mkdir.
      for d in ./-m ./-p ./--version "./$dirmode";
      do
        test -d $d && rmdir $d
      done
    fi
    ;;
esac

for file
do
  case $file in
    /*) pathcomp=/ ;;
    *)  pathcomp= ;;
  esac
  oIFS=$IFS
  IFS=/
  set fnord $file
  shift
  IFS=$oIFS

  for d
  do
    test "x$d" = x && continue

    pathcomp=$pathcomp$d
    case $pathcomp in
      -*) pathcomp=./$pathcomp ;;
    esac

    if test ! -d "$pathcomp"; then
      echo "mkdir $pathcomp"

      mkdir "$pathcomp" || lasterr=$?

      if test ! -d "$pathcomp"; then
	errstatus=$lasterr
      else
	if test ! -z "$dirmode"; then
	  echo "chmod $dirmode $pathcomp"
	  lasterr=
	  chmod "$dirmode" "$pathcomp" || lasterr=$?

	  if test ! -z "$lasterr"; then
	    errstatus=$lasterr
	  fi
	fi
      fi
    fi

    pathcomp=$pathcomp/
  done
done

exit $errstatus

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
test-driver000075500000011042150523165450006746 0ustar00#! /bin/sh
# test-driver - basic testsuite driver script.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 2011-2018 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.

# Make unconditional expansion of undefined variables an error.  This
# helps a lot in preventing typo-related bugs.
set -u

usage_error ()
{
  echo "$0: $*" >&2
  print_usage >&2
  exit 2
}

print_usage ()
{
  cat <<END
Usage:
  test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
              [--expect-failure={yes|no}] [--color-tests={yes|no}]
              [--enable-hard-errors={yes|no}] [--]
              TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
END
}

test_name= # Used for reporting.
log_file=  # Where to save the output of the test script.
trs_file=  # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
  case $1 in
  --help) print_usage; exit $?;;
  --version) echo "test-driver $scriptversion"; exit $?;;
  --test-name) test_name=$2; shift;;
  --log-file) log_file=$2; shift;;
  --trs-file) trs_file=$2; shift;;
  --color-tests) color_tests=$2; shift;;
  --expect-failure) expect_failure=$2; shift;;
  --enable-hard-errors) enable_hard_errors=$2; shift;;
  --) shift; break;;
  -*) usage_error "invalid option: '$1'";;
   *) break;;
  esac
  shift
done

missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file"  = x && missing_opts="$missing_opts --log-file"
test x"$trs_file"  = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
  usage_error "the following mandatory options are missing:$missing_opts"
fi

if test $# -eq 0; then
  usage_error "missing argument"
fi

if test $color_tests = yes; then
  # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
  red='' # Red.
  grn='' # Green.
  lgn='' # Light green.
  blu='' # Blue.
  mgn='' # Magenta.
  std=''     # No color.
else
  red= grn= lgn= blu= mgn= std=
fi

do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15

# Test script is run here.
"$@" >$log_file 2>&1
estatus=$?

if test $enable_hard_errors = no && test $estatus -eq 99; then
  tweaked_estatus=1
else
  tweaked_estatus=$estatus
fi

case $tweaked_estatus:$expect_failure in
  0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
  0:*)   col=$grn res=PASS  recheck=no  gcopy=no;;
  77:*)  col=$blu res=SKIP  recheck=no  gcopy=yes;;
  99:*)  col=$mgn res=ERROR recheck=yes gcopy=yes;;
  *:yes) col=$lgn res=XFAIL recheck=no  gcopy=yes;;
  *:*)   col=$red res=FAIL  recheck=yes gcopy=yes;;
esac

# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file

# Report outcome to console.
echo "${col}${res}${std}: $test_name"

# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
missing000075500000015336150523165450006161 0ustar00#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.

# 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

if test $# -eq 0; then
  echo 1>&2 "Try '$0 --help' for more information"
  exit 1
fi

case $1 in

  --is-lightweight)
    # Used by our autoconf macros to check whether the available missing
    # script is modern enough.
    exit 0
    ;;

  --run)
    # Back-compat with the calling convention used by older automake.
    shift
    ;;

  -h|--h|--he|--hel|--help)
    echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...

Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.

Options:
  -h, --help      display this help and exit
  -v, --version   output version information and exit

Supported PROGRAM values:
  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
  bison     yacc      flex         lex       help2man

Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.

Send bug reports to <bug-automake@gnu.org>."
    exit $?
    ;;

  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
    echo "missing $scriptversion (GNU Automake)"
    exit $?
    ;;

  -*)
    echo 1>&2 "$0: unknown '$1' option"
    echo 1>&2 "Try '$0 --help' for more information"
    exit 1
    ;;

esac

# Run the given program, remember its exit status.
"$@"; st=$?

# If it succeeded, we are done.
test $st -eq 0 && exit 0

# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac

# Exit code 63 means version mismatch.  This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
  msg="probably too old"
elif test $st -eq 127; then
  # Program was missing.
  msg="missing on your system"
else
  # Program was found and executed, but failed.  Give up.
  exit $st
fi

perl_URL=https://www.perl.org/
flex_URL=https://github.com/westes/flex
gnu_software_URL=https://www.gnu.org/software

program_details ()
{
  case $1 in
    aclocal|automake)
      echo "The '$1' program is part of the GNU Automake package:"
      echo "<$gnu_software_URL/automake>"
      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
      echo "<$gnu_software_URL/autoconf>"
      echo "<$gnu_software_URL/m4/>"
      echo "<$perl_URL>"
      ;;
    autoconf|autom4te|autoheader)
      echo "The '$1' program is part of the GNU Autoconf package:"
      echo "<$gnu_software_URL/autoconf/>"
      echo "It also requires GNU m4 and Perl in order to run:"
      echo "<$gnu_software_URL/m4/>"
      echo "<$perl_URL>"
      ;;
  esac
}

give_advice ()
{
  # Normalize program name to check for.
  normalized_program=`echo "$1" | sed '
    s/^gnu-//; t
    s/^gnu//; t
    s/^g//; t'`

  printf '%s\n' "'$1' is $msg."

  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
  case $normalized_program in
    autoconf*)
      echo "You should only need it if you modified 'configure.ac',"
      echo "or m4 files included by it."
      program_details 'autoconf'
      ;;
    autoheader*)
      echo "You should only need it if you modified 'acconfig.h' or"
      echo "$configure_deps."
      program_details 'autoheader'
      ;;
    automake*)
      echo "You should only need it if you modified 'Makefile.am' or"
      echo "$configure_deps."
      program_details 'automake'
      ;;
    aclocal*)
      echo "You should only need it if you modified 'acinclude.m4' or"
      echo "$configure_deps."
      program_details 'aclocal'
      ;;
   autom4te*)
      echo "You might have modified some maintainer files that require"
      echo "the 'autom4te' program to be rebuilt."
      program_details 'autom4te'
      ;;
    bison*|yacc*)
      echo "You should only need it if you modified a '.y' file."
      echo "You may want to install the GNU Bison package:"
      echo "<$gnu_software_URL/bison/>"
      ;;
    lex*|flex*)
      echo "You should only need it if you modified a '.l' file."
      echo "You may want to install the Fast Lexical Analyzer package:"
      echo "<$flex_URL>"
      ;;
    help2man*)
      echo "You should only need it if you modified a dependency" \
           "of a man page."
      echo "You may want to install the GNU Help2man package:"
      echo "<$gnu_software_URL/help2man/>"
    ;;
    makeinfo*)
      echo "You should only need it if you modified a '.texi' file, or"
      echo "any other file indirectly affecting the aspect of the manual."
      echo "You might want to install the Texinfo package:"
      echo "<$gnu_software_URL/texinfo/>"
      echo "The spurious makeinfo call might also be the consequence of"
      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
      echo "want to install GNU make:"
      echo "<$gnu_software_URL/make/>"
      ;;
    *)
      echo "You might have modified some files without having the proper"
      echo "tools for further handling them.  Check the 'README' file, it"
      echo "often tells you about the needed prerequisites for installing"
      echo "this package.  You may also peek at any GNU archive site, in"
      echo "case some other package contains this missing '$1' program."
      ;;
  esac
}

give_advice "$1" | sed -e '1s/^/WARNING: /' \
                       -e '2,$s/^/         /' >&2

# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st

# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
compile000075500000016327150523165450006141 0ustar00#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.

nl='
'

# We need space, tab and new line, in precisely that order.  Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" ""	$nl"

file_conv=

# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
  file=$1
  case $file in
    / | /[!/]*) # absolute file, and not a UNC file
      if test -z "$file_conv"; then
	# lazily determine how to convert abs files
	case `uname -s` in
	  MINGW*)
	    file_conv=mingw
	    ;;
	  CYGWIN*)
	    file_conv=cygwin
	    ;;
	  *)
	    file_conv=wine
	    ;;
	esac
      fi
      case $file_conv/,$2, in
	*,$file_conv,*)
	  ;;
	mingw/*)
	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
	  ;;
	cygwin/*)
	  file=`cygpath -m "$file" || echo "$file"`
	  ;;
	wine/*)
	  file=`winepath -w "$file" || echo "$file"`
	  ;;
      esac
      ;;
  esac
}

# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
  func_file_conv "$1"
  if test -z "$lib_path"; then
    lib_path=$file
  else
    lib_path="$lib_path;$file"
  fi
  linker_opts="$linker_opts -LIBPATH:$file"
}

# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
  lib=$1
  found=no
  save_IFS=$IFS
  IFS=';'
  for dir in $lib_path $LIB
  do
    IFS=$save_IFS
    if $shared && test -f "$dir/$lib.dll.lib"; then
      found=yes
      lib=$dir/$lib.dll.lib
      break
    fi
    if test -f "$dir/$lib.lib"; then
      found=yes
      lib=$dir/$lib.lib
      break
    fi
    if test -f "$dir/lib$lib.a"; then
      found=yes
      lib=$dir/lib$lib.a
      break
    fi
  done
  IFS=$save_IFS

  if test "$found" != yes; then
    lib=$lib.lib
  fi
}

# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
  # Assume a capable shell
  lib_path=
  shared=:
  linker_opts=
  for arg
  do
    if test -n "$eat"; then
      eat=
    else
      case $1 in
	-o)
	  # configure might choose to run compile as 'compile cc -o foo foo.c'.
	  eat=1
	  case $2 in
	    *.o | *.[oO][bB][jJ])
	      func_file_conv "$2"
	      set x "$@" -Fo"$file"
	      shift
	      ;;
	    *)
	      func_file_conv "$2"
	      set x "$@" -Fe"$file"
	      shift
	      ;;
	  esac
	  ;;
	-I)
	  eat=1
	  func_file_conv "$2" mingw
	  set x "$@" -I"$file"
	  shift
	  ;;
	-I*)
	  func_file_conv "${1#-I}" mingw
	  set x "$@" -I"$file"
	  shift
	  ;;
	-l)
	  eat=1
	  func_cl_dashl "$2"
	  set x "$@" "$lib"
	  shift
	  ;;
	-l*)
	  func_cl_dashl "${1#-l}"
	  set x "$@" "$lib"
	  shift
	  ;;
	-L)
	  eat=1
	  func_cl_dashL "$2"
	  ;;
	-L*)
	  func_cl_dashL "${1#-L}"
	  ;;
	-static)
	  shared=false
	  ;;
	-Wl,*)
	  arg=${1#-Wl,}
	  save_ifs="$IFS"; IFS=','
	  for flag in $arg; do
	    IFS="$save_ifs"
	    linker_opts="$linker_opts $flag"
	  done
	  IFS="$save_ifs"
	  ;;
	-Xlinker)
	  eat=1
	  linker_opts="$linker_opts $2"
	  ;;
	-*)
	  set x "$@" "$1"
	  shift
	  ;;
	*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
	  func_file_conv "$1"
	  set x "$@" -Tp"$file"
	  shift
	  ;;
	*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
	  func_file_conv "$1" mingw
	  set x "$@" "$file"
	  shift
	  ;;
	*)
	  set x "$@" "$1"
	  shift
	  ;;
      esac
    fi
    shift
  done
  if test -n "$linker_opts"; then
    linker_opts="-link$linker_opts"
  fi
  exec "$@" $linker_opts
  exit 1
}

eat=

case $1 in
  '')
     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
     exit 1;
     ;;
  -h | --h*)
    cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]

Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.

If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.

Report bugs to <bug-automake@gnu.org>.
EOF
    exit $?
    ;;
  -v | --v*)
    echo "compile $scriptversion"
    exit $?
    ;;
  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
  icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
    func_cl_wrapper "$@"      # Doesn't return...
    ;;
esac

ofile=
cfile=

for arg
do
  if test -n "$eat"; then
    eat=
  else
    case $1 in
      -o)
	# configure might choose to run compile as 'compile cc -o foo foo.c'.
	# So we strip '-o arg' only if arg is an object.
	eat=1
	case $2 in
	  *.o | *.obj)
	    ofile=$2
	    ;;
	  *)
	    set x "$@" -o "$2"
	    shift
	    ;;
	esac
	;;
      *.c)
	cfile=$1
	set x "$@" "$1"
	shift
	;;
      *)
	set x "$@" "$1"
	shift
	;;
    esac
  fi
  shift
done

if test -z "$ofile" || test -z "$cfile"; then
  # If no '-o' option was seen then we might have been invoked from a
  # pattern rule where we don't need one.  That is ok -- this is a
  # normal compilation that the losing compiler can handle.  If no
  # '.c' file was seen then we are probably linking.  That is also
  # ok.
  exec "$@"
fi

# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`

# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file.  Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
  if mkdir "$lockdir" >/dev/null 2>&1; then
    break
  fi
  sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15

# Run the compile.
"$@"
ret=$?

if test -f "$cofile"; then
  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi

rmdir "$lockdir"
exit $ret

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
install-sh000075500000036010150523165450006556 0ustar00#!/bin/sh
# install - install a program, script, or datafile

scriptversion=2018-03-11.20; # UTC

# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.

tab='	'
nl='
'
IFS=" $tab$nl"

# Set DOITPROG to "echo" to test this script.

doit=${DOITPROG-}
doit_exec=${doit:-exec}

# Put in absolute file names if you don't have them in your path;
# or use environment vars.

chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}

posix_mkdir=

# Desired mode of installed file.
mode=0755

chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=

src=
dst=
dir_arg=
dst_arg=

copy_on_change=false
is_target_a_directory=possibly

usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
   or: $0 [OPTION]... SRCFILES... DIRECTORY
   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
   or: $0 [OPTION]... -d DIRECTORIES...

In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.

Options:
     --help     display this help and exit.
     --version  display version info and exit.

  -c            (ignored)
  -C            install only if different (preserve the last data modification time)
  -d            create directories instead of installing files.
  -g GROUP      $chgrpprog installed files to GROUP.
  -m MODE       $chmodprog installed files to MODE.
  -o USER       $chownprog installed files to USER.
  -s            $stripprog installed files.
  -t DIRECTORY  install into DIRECTORY.
  -T            report an error if DSTFILE is a directory.

Environment variables override the default commands:
  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
  RMPROG STRIPPROG
"

while test $# -ne 0; do
  case $1 in
    -c) ;;

    -C) copy_on_change=true;;

    -d) dir_arg=true;;

    -g) chgrpcmd="$chgrpprog $2"
        shift;;

    --help) echo "$usage"; exit $?;;

    -m) mode=$2
        case $mode in
          *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
            echo "$0: invalid mode: $mode" >&2
            exit 1;;
        esac
        shift;;

    -o) chowncmd="$chownprog $2"
        shift;;

    -s) stripcmd=$stripprog;;

    -t)
        is_target_a_directory=always
        dst_arg=$2
        # Protect names problematic for 'test' and other utilities.
        case $dst_arg in
          -* | [=\(\)!]) dst_arg=./$dst_arg;;
        esac
        shift;;

    -T) is_target_a_directory=never;;

    --version) echo "$0 $scriptversion"; exit $?;;

    --) shift
        break;;

    -*) echo "$0: invalid option: $1" >&2
        exit 1;;

    *)  break;;
  esac
  shift
done

# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.

if test -n "$dir_arg"; then
  if test -n "$dst_arg"; then
    echo "$0: target directory not allowed when installing a directory." >&2
    exit 1
  fi
fi

if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
  # When -d is used, all remaining arguments are directories to create.
  # When -t is used, the destination is already specified.
  # Otherwise, the last argument is the destination.  Remove it from $@.
  for arg
  do
    if test -n "$dst_arg"; then
      # $@ is not empty: it contains at least $arg.
      set fnord "$@" "$dst_arg"
      shift # fnord
    fi
    shift # arg
    dst_arg=$arg
    # Protect names problematic for 'test' and other utilities.
    case $dst_arg in
      -* | [=\(\)!]) dst_arg=./$dst_arg;;
    esac
  done
fi

if test $# -eq 0; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1
  fi
  # It's OK to call 'install-sh -d' without argument.
  # This can happen when creating conditional directories.
  exit 0
fi

if test -z "$dir_arg"; then
  if test $# -gt 1 || test "$is_target_a_directory" = always; then
    if test ! -d "$dst_arg"; then
      echo "$0: $dst_arg: Is not a directory." >&2
      exit 1
    fi
  fi
fi

if test -z "$dir_arg"; then
  do_exit='(exit $ret); exit $ret'
  trap "ret=129; $do_exit" 1
  trap "ret=130; $do_exit" 2
  trap "ret=141; $do_exit" 13
  trap "ret=143; $do_exit" 15

  # Set umask so as not to create temps with too-generous modes.
  # However, 'strip' requires both read and write access to temps.
  case $mode in
    # Optimize common cases.
    *644) cp_umask=133;;
    *755) cp_umask=22;;

    *[0-7])
      if test -z "$stripcmd"; then
        u_plus_rw=
      else
        u_plus_rw='% 200'
      fi
      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
    *)
      if test -z "$stripcmd"; then
        u_plus_rw=
      else
        u_plus_rw=,u+rw
      fi
      cp_umask=$mode$u_plus_rw;;
  esac
fi

for src
do
  # Protect names problematic for 'test' and other utilities.
  case $src in
    -* | [=\(\)!]) src=./$src;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    dstdir=$dst
    test -d "$dstdir"
    dstdir_status=$?
  else

    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
    # might cause directories to be created, which would be especially bad
    # if $src (and thus $dsttmp) contains '*'.
    if test ! -f "$src" && test ! -d "$src"; then
      echo "$0: $src does not exist." >&2
      exit 1
    fi

    if test -z "$dst_arg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi
    dst=$dst_arg

    # If destination is a directory, append the input filename.
    if test -d "$dst"; then
      if test "$is_target_a_directory" = never; then
        echo "$0: $dst_arg: Is a directory" >&2
        exit 1
      fi
      dstdir=$dst
      dstbase=`basename "$src"`
      case $dst in
	*/) dst=$dst$dstbase;;
	*)  dst=$dst/$dstbase;;
      esac
      dstdir_status=0
    else
      dstdir=`dirname "$dst"`
      test -d "$dstdir"
      dstdir_status=$?
    fi
  fi

  case $dstdir in
    */) dstdirslash=$dstdir;;
    *)  dstdirslash=$dstdir/;;
  esac

  obsolete_mkdir_used=false

  if test $dstdir_status != 0; then
    case $posix_mkdir in
      '')
        # Create intermediate dirs using mode 755 as modified by the umask.
        # This is like FreeBSD 'install' as of 1997-10-28.
        umask=`umask`
        case $stripcmd.$umask in
          # Optimize common cases.
          *[2367][2367]) mkdir_umask=$umask;;
          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;

          *[0-7])
            mkdir_umask=`expr $umask + 22 \
              - $umask % 100 % 40 + $umask % 20 \
              - $umask % 10 % 4 + $umask % 2
            `;;
          *) mkdir_umask=$umask,go-w;;
        esac

        # With -d, create the new directory with the user-specified mode.
        # Otherwise, rely on $mkdir_umask.
        if test -n "$dir_arg"; then
          mkdir_mode=-m$mode
        else
          mkdir_mode=
        fi

        posix_mkdir=false
        case $umask in
          *[123567][0-7][0-7])
            # POSIX mkdir -p sets u+wx bits regardless of umask, which
            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
            ;;
          *)
            # Note that $RANDOM variable is not portable (e.g. dash);  Use it
            # here however when possible just to lower collision chance.
            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$

            trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0

            # Because "mkdir -p" follows existing symlinks and we likely work
            # directly in world-writeable /tmp, make sure that the '$tmpdir'
            # directory is successfully created first before we actually test
            # 'mkdir -p' feature.
            if (umask $mkdir_umask &&
                $mkdirprog $mkdir_mode "$tmpdir" &&
                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
            then
              if test -z "$dir_arg" || {
                   # Check for POSIX incompatibilities with -m.
                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
                   # other-writable bit of parent directory when it shouldn't.
                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
                   test_tmpdir="$tmpdir/a"
                   ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
                   case $ls_ld_tmpdir in
                     d????-?r-*) different_mode=700;;
                     d????-?--*) different_mode=755;;
                     *) false;;
                   esac &&
                   $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
                     ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
                   }
                 }
              then posix_mkdir=:
              fi
              rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
            else
              # Remove any dirs left behind by ancient mkdir implementations.
              rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
            fi
            trap '' 0;;
        esac;;
    esac

    if
      $posix_mkdir && (
        umask $mkdir_umask &&
        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
      )
    then :
    else

      # The umask is ridiculous, or mkdir does not conform to POSIX,
      # or it failed possibly due to a race condition.  Create the
      # directory the slow way, step by step, checking for races as we go.

      case $dstdir in
        /*) prefix='/';;
        [-=\(\)!]*) prefix='./';;
        *)  prefix='';;
      esac

      oIFS=$IFS
      IFS=/
      set -f
      set fnord $dstdir
      shift
      set +f
      IFS=$oIFS

      prefixes=

      for d
      do
        test X"$d" = X && continue

        prefix=$prefix$d
        if test -d "$prefix"; then
          prefixes=
        else
          if $posix_mkdir; then
            (umask=$mkdir_umask &&
             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
            # Don't fail if two instances are running concurrently.
            test -d "$prefix" || exit 1
          else
            case $prefix in
              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
              *) qprefix=$prefix;;
            esac
            prefixes="$prefixes '$qprefix'"
          fi
        fi
        prefix=$prefix/
      done

      if test -n "$prefixes"; then
        # Don't fail if two instances are running concurrently.
        (umask $mkdir_umask &&
         eval "\$doit_exec \$mkdirprog $prefixes") ||
          test -d "$dstdir" || exit 1
        obsolete_mkdir_used=true
      fi
    fi
  fi

  if test -n "$dir_arg"; then
    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
  else

    # Make a couple of temp file names in the proper directory.
    dsttmp=${dstdirslash}_inst.$$_
    rmtmp=${dstdirslash}_rm.$$_

    # Trap to clean up those temp files at exit.
    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0

    # Copy the file name to the temp name.
    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&

    # and set any options; do chmod last to preserve setuid bits.
    #
    # If any of these fail, we abort the whole thing.  If we want to
    # ignore errors from any of these, just make sure not to ignore
    # errors from the above "$doit $cpprog $src $dsttmp" command.
    #
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&

    # If -C, don't bother to copy if it wouldn't change the file.
    if $copy_on_change &&
       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
       set -f &&
       set X $old && old=:$2:$4:$5:$6 &&
       set X $new && new=:$2:$4:$5:$6 &&
       set +f &&
       test "$old" = "$new" &&
       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
    then
      rm -f "$dsttmp"
    else
      # Rename the file to the real destination.
      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||

      # The rename failed, perhaps because mv can't rename something else
      # to itself, or perhaps because mv is so ancient that it does not
      # support -f.
      {
        # Now remove or move aside any old file at destination location.
        # We try this two ways since rm can't unlink itself on some
        # systems and the destination file might be busy for other
        # reasons.  In this case, the final cleanup might fail but the new
        # file should still install successfully.
        {
          test ! -f "$dst" ||
          $doit $rmcmd -f "$dst" 2>/dev/null ||
          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
          } ||
          { echo "$0: cannot unlink or rename $dst" >&2
            (exit 1); exit 1
          }
        } &&

        # Now rename the file to the real destination.
        $doit $mvcmd "$dsttmp" "$dst"
      }
    fi || exit 1

    trap '' 0
  fi
done

# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
ylwrap000075500000015314150523165450006022 0ustar00#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.

get_dirname ()
{
  case $1 in
    */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';;
    # Otherwise,  we want the empty string (not ".").
  esac
}

# guard FILE
# ----------
# The CPP macro used to guard inclusion of FILE.
guard ()
{
  printf '%s\n' "$1"                                                    \
    | sed                                                               \
        -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'   \
        -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'                        \
        -e 's/__*/_/g'
}

# quote_for_sed [STRING]
# ----------------------
# Return STRING (or stdin) quoted to be used as a sed pattern.
quote_for_sed ()
{
  case $# in
    0) cat;;
    1) printf '%s\n' "$1";;
  esac \
    | sed -e 's|[][\\.*]|\\&|g'
}

case "$1" in
  '')
    echo "$0: No files given.  Try '$0 --help' for more information." 1>&2
    exit 1
    ;;
  --basedir)
    basedir=$2
    shift 2
    ;;
  -h|--h*)
    cat <<\EOF
Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...

Wrapper for lex/yacc invocations, renaming files as desired.

  INPUT is the input file
  OUTPUT is one file PROG generates
  DESIRED is the file we actually want instead of OUTPUT
  PROGRAM is program to run
  ARGS are passed to PROG

Any number of OUTPUT,DESIRED pairs may be used.

Report bugs to <bug-automake@gnu.org>.
EOF
    exit $?
    ;;
  -v|--v*)
    echo "ylwrap $scriptversion"
    exit $?
    ;;
esac


# The input.
input=$1
shift
# We'll later need for a correct munging of "#line" directives.
input_sub_rx=`get_dirname "$input" | quote_for_sed`
case $input in
  [\\/]* | ?:[\\/]*)
    # Absolute path; do nothing.
    ;;
  *)
    # Relative path.  Make it absolute.
    input=`pwd`/$input
    ;;
esac
input_rx=`get_dirname "$input" | quote_for_sed`

# Since DOS filename conventions don't allow two dots,
# the DOS version of Bison writes out y_tab.c instead of y.tab.c
# and y_tab.h instead of y.tab.h. Test to see if this is the case.
y_tab_nodot=false
if test -f y_tab.c || test -f y_tab.h; then
  y_tab_nodot=true
fi

# The parser itself, the first file, is the destination of the .y.c
# rule in the Makefile.
parser=$1

# A sed program to s/FROM/TO/g for all the FROM/TO so that, for
# instance, we rename #include "y.tab.h" into #include "parse.h"
# during the conversion from y.tab.c to parse.c.
sed_fix_filenames=

# Also rename header guards, as Bison 2.7 for instance uses its header
# guard in its implementation file.
sed_fix_header_guards=

while test $# -ne 0; do
  if test x"$1" = x"--"; then
    shift
    break
  fi
  from=$1
  # Handle y_tab.c and y_tab.h output by DOS
  if $y_tab_nodot; then
    case $from in
      "y.tab.c") from=y_tab.c;;
      "y.tab.h") from=y_tab.h;;
    esac
  fi
  shift
  to=$1
  shift
  sed_fix_filenames="${sed_fix_filenames}s|"`quote_for_sed "$from"`"|$to|g;"
  sed_fix_header_guards="${sed_fix_header_guards}s|"`guard "$from"`"|"`guard "$to"`"|g;"
done

# The program to run.
prog=$1
shift
# Make any relative path in $prog absolute.
case $prog in
  [\\/]* | ?:[\\/]*) ;;
  *[\\/]*) prog=`pwd`/$prog ;;
esac

dirname=ylwrap$$
do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
mkdir $dirname || exit 1

cd $dirname

case $# in
  0) "$prog" "$input" ;;
  *) "$prog" "$@" "$input" ;;
esac
ret=$?

if test $ret -eq 0; then
  for from in *
  do
    to=`printf '%s\n' "$from" | sed "$sed_fix_filenames"`
    if test -f "$from"; then
      # If $2 is an absolute path name, then just use that,
      # otherwise prepend '../'.
      case $to in
        [\\/]* | ?:[\\/]*) target=$to;;
        *) target=../$to;;
      esac

      # Do not overwrite unchanged header files to avoid useless
      # recompilations.  Always update the parser itself: it is the
      # destination of the .y.c rule in the Makefile.  Divert the
      # output of all other files to a temporary file so we can
      # compare them to existing versions.
      if test $from != $parser; then
        realtarget=$target
        target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'`
      fi

      # Munge "#line" or "#" directives.  Don't let the resulting
      # debug information point at an absolute srcdir.  Use the real
      # output file name, not yy.lex.c for instance.  Adjust the
      # include guards too.
      sed -e "/^#/!b"                           \
          -e "s|$input_rx|$input_sub_rx|"       \
          -e "$sed_fix_filenames"               \
          -e "$sed_fix_header_guards"           \
        "$from" >"$target" || ret=$?

      # Check whether files must be updated.
      if test "$from" != "$parser"; then
        if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
          echo "$to is unchanged"
          rm -f "$target"
        else
          echo "updating $to"
          mv -f "$target" "$realtarget"
        fi
      fi
    else
      # A missing file is only an error for the parser.  This is a
      # blatant hack to let us support using "yacc -d".  If -d is not
      # specified, don't fail when the header file is "missing".
      if test "$from" = "$parser"; then
        ret=1
      fi
    fi
  done
fi

# Remove the directory.
cd ..
rm -rf $dirname

exit $ret

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
tap-driver.sh000075500000046013150523165450007172 0ustar00#! /bin/sh
# Copyright (C) 2011-2018 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.

scriptversion=2013-12-23.17; # UTC

# Make unconditional expansion of undefined variables an error.  This
# helps a lot in preventing typo-related bugs.
set -u

me=tap-driver.sh

fatal ()
{
  echo "$me: fatal: $*" >&2
  exit 1
}

usage_error ()
{
  echo "$me: $*" >&2
  print_usage >&2
  exit 2
}

print_usage ()
{
  cat <<END
Usage:
  tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH
                [--expect-failure={yes|no}] [--color-tests={yes|no}]
                [--enable-hard-errors={yes|no}] [--ignore-exit]
                [--diagnostic-string=STRING] [--merge|--no-merge]
                [--comments|--no-comments] [--] TEST-COMMAND
The '--test-name', '-log-file' and '--trs-file' options are mandatory.
END
}

# TODO: better error handling in option parsing (in particular, ensure
# TODO: $log_file, $trs_file and $test_name are defined).
test_name= # Used for reporting.
log_file=  # Where to save the result and output of the test script.
trs_file=  # Where to save the metadata of the test run.
expect_failure=0
color_tests=0
merge=0
ignore_exit=0
comments=0
diag_string='#'
while test $# -gt 0; do
  case $1 in
  --help) print_usage; exit $?;;
  --version) echo "$me $scriptversion"; exit $?;;
  --test-name) test_name=$2; shift;;
  --log-file) log_file=$2; shift;;
  --trs-file) trs_file=$2; shift;;
  --color-tests) color_tests=$2; shift;;
  --expect-failure) expect_failure=$2; shift;;
  --enable-hard-errors) shift;; # No-op.
  --merge) merge=1;;
  --no-merge) merge=0;;
  --ignore-exit) ignore_exit=1;;
  --comments) comments=1;;
  --no-comments) comments=0;;
  --diagnostic-string) diag_string=$2; shift;;
  --) shift; break;;
  -*) usage_error "invalid option: '$1'";;
  esac
  shift
done

test $# -gt 0 || usage_error "missing test command"

case $expect_failure in
  yes) expect_failure=1;;
    *) expect_failure=0;;
esac

if test $color_tests = yes; then
  init_colors='
    color_map["red"]="" # Red.
    color_map["grn"]="" # Green.
    color_map["lgn"]="" # Light green.
    color_map["blu"]="" # Blue.
    color_map["mgn"]="" # Magenta.
    color_map["std"]=""     # No color.
    color_for_result["ERROR"] = "mgn"
    color_for_result["PASS"]  = "grn"
    color_for_result["XPASS"] = "red"
    color_for_result["FAIL"]  = "red"
    color_for_result["XFAIL"] = "lgn"
    color_for_result["SKIP"]  = "blu"'
else
  init_colors=''
fi

# :; is there to work around a bug in bash 3.2 (and earlier) which
# does not always set '$?' properly on redirection failure.
# See the Autoconf manual for more details.
:;{
  (
    # Ignore common signals (in this subshell only!), to avoid potential
    # problems with Korn shells.  Some Korn shells are known to propagate
    # to themselves signals that have killed a child process they were
    # waiting for; this is done at least for SIGINT (and usually only for
    # it, in truth).  Without the `trap' below, such a behaviour could
    # cause a premature exit in the current subshell, e.g., in case the
    # test command it runs gets terminated by a SIGINT.  Thus, the awk
    # script we are piping into would never seen the exit status it
    # expects on its last input line (which is displayed below by the
    # last `echo $?' statement), and would thus die reporting an internal
    # error.
    # For more information, see the Autoconf manual and the threads:
    # <https://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
    # <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
    trap : 1 3 2 13 15
    if test $merge -gt 0; then
      exec 2>&1
    else
      exec 2>&3
    fi
    "$@"
    echo $?
  ) | LC_ALL=C ${AM_TAP_AWK-awk} \
        -v me="$me" \
        -v test_script_name="$test_name" \
        -v log_file="$log_file" \
        -v trs_file="$trs_file" \
        -v expect_failure="$expect_failure" \
        -v merge="$merge" \
        -v ignore_exit="$ignore_exit" \
        -v comments="$comments" \
        -v diag_string="$diag_string" \
'
# TODO: the usages of "cat >&3" below could be optimized when using
#       GNU awk, and/on on systems that supports /dev/fd/.

# Implementation note: in what follows, `result_obj` will be an
# associative array that (partly) simulates a TAP result object
# from the `TAP::Parser` perl module.

## ----------- ##
##  FUNCTIONS  ##
## ----------- ##

function fatal(msg)
{
  print me ": " msg | "cat >&2"
  exit 1
}

function abort(where)
{
  fatal("internal error " where)
}

# Convert a boolean to a "yes"/"no" string.
function yn(bool)
{
  return bool ? "yes" : "no";
}

function add_test_result(result)
{
  if (!test_results_index)
    test_results_index = 0
  test_results_list[test_results_index] = result
  test_results_index += 1
  test_results_seen[result] = 1;
}

# Whether the test script should be re-run by "make recheck".
function must_recheck()
{
  for (k in test_results_seen)
    if (k != "XFAIL" && k != "PASS" && k != "SKIP")
      return 1
  return 0
}

# Whether the content of the log file associated to this test should
# be copied into the "global" test-suite.log.
function copy_in_global_log()
{
  for (k in test_results_seen)
    if (k != "PASS")
      return 1
  return 0
}

function get_global_test_result()
{
    if ("ERROR" in test_results_seen)
      return "ERROR"
    if ("FAIL" in test_results_seen || "XPASS" in test_results_seen)
      return "FAIL"
    all_skipped = 1
    for (k in test_results_seen)
      if (k != "SKIP")
        all_skipped = 0
    if (all_skipped)
      return "SKIP"
    return "PASS";
}

function stringify_result_obj(result_obj)
{
  if (result_obj["is_unplanned"] || result_obj["number"] != testno)
    return "ERROR"

  if (plan_seen == LATE_PLAN)
    return "ERROR"

  if (result_obj["directive"] == "TODO")
    return result_obj["is_ok"] ? "XPASS" : "XFAIL"

  if (result_obj["directive"] == "SKIP")
    return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL;

  if (length(result_obj["directive"]))
      abort("in function stringify_result_obj()")

  return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL
}

function decorate_result(result)
{
  color_name = color_for_result[result]
  if (color_name)
    return color_map[color_name] "" result "" color_map["std"]
  # If we are not using colorized output, or if we do not know how
  # to colorize the given result, we should return it unchanged.
  return result
}

function report(result, details)
{
  if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/)
    {
      msg = ": " test_script_name
      add_test_result(result)
    }
  else if (result == "#")
    {
      msg = " " test_script_name ":"
    }
  else
    {
      abort("in function report()")
    }
  if (length(details))
    msg = msg " " details
  # Output on console might be colorized.
  print decorate_result(result) msg
  # Log the result in the log file too, to help debugging (this is
  # especially true when said result is a TAP error or "Bail out!").
  print result msg | "cat >&3";
}

function testsuite_error(error_message)
{
  report("ERROR", "- " error_message)
}

function handle_tap_result()
{
  details = result_obj["number"];
  if (length(result_obj["description"]))
    details = details " " result_obj["description"]

  if (plan_seen == LATE_PLAN)
    {
      details = details " # AFTER LATE PLAN";
    }
  else if (result_obj["is_unplanned"])
    {
       details = details " # UNPLANNED";
    }
  else if (result_obj["number"] != testno)
    {
       details = sprintf("%s # OUT-OF-ORDER (expecting %d)",
                         details, testno);
    }
  else if (result_obj["directive"])
    {
      details = details " # " result_obj["directive"];
      if (length(result_obj["explanation"]))
        details = details " " result_obj["explanation"]
    }

  report(stringify_result_obj(result_obj), details)
}

# `skip_reason` should be empty whenever planned > 0.
function handle_tap_plan(planned, skip_reason)
{
  planned += 0 # Avoid getting confused if, say, `planned` is "00"
  if (length(skip_reason) && planned > 0)
    abort("in function handle_tap_plan()")
  if (plan_seen)
    {
      # Error, only one plan per stream is acceptable.
      testsuite_error("multiple test plans")
      return;
    }
  planned_tests = planned
  # The TAP plan can come before or after *all* the TAP results; we speak
  # respectively of an "early" or a "late" plan.  If we see the plan line
  # after at least one TAP result has been seen, assume we have a late
  # plan; in this case, any further test result seen after the plan will
  # be flagged as an error.
  plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN)
  # If testno > 0, we have an error ("too many tests run") that will be
  # automatically dealt with later, so do not worry about it here.  If
  # $plan_seen is true, we have an error due to a repeated plan, and that
  # has already been dealt with above.  Otherwise, we have a valid "plan
  # with SKIP" specification, and should report it as a particular kind
  # of SKIP result.
  if (planned == 0 && testno == 0)
    {
      if (length(skip_reason))
        skip_reason = "- "  skip_reason;
      report("SKIP", skip_reason);
    }
}

function extract_tap_comment(line)
{
  if (index(line, diag_string) == 1)
    {
      # Strip leading `diag_string` from `line`.
      line = substr(line, length(diag_string) + 1)
      # And strip any leading and trailing whitespace left.
      sub("^[ \t]*", "", line)
      sub("[ \t]*$", "", line)
      # Return what is left (if any).
      return line;
    }
  return "";
}

# When this function is called, we know that line is a TAP result line,
# so that it matches the (perl) RE "^(not )?ok\b".
function setup_result_obj(line)
{
  # Get the result, and remove it from the line.
  result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0)
  sub("^(not )?ok[ \t]*", "", line)

  # If the result has an explicit number, get it and strip it; otherwise,
  # automatically assing the next progresive number to it.
  if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/)
    {
      match(line, "^[0-9]+")
      # The final `+ 0` is to normalize numbers with leading zeros.
      result_obj["number"] = substr(line, 1, RLENGTH) + 0
      line = substr(line, RLENGTH + 1)
    }
  else
    {
      result_obj["number"] = testno
    }

  if (plan_seen == LATE_PLAN)
    # No further test results are acceptable after a "late" TAP plan
    # has been seen.
    result_obj["is_unplanned"] = 1
  else if (plan_seen && testno > planned_tests)
    result_obj["is_unplanned"] = 1
  else
    result_obj["is_unplanned"] = 0

  # Strip trailing and leading whitespace.
  sub("^[ \t]*", "", line)
  sub("[ \t]*$", "", line)

  # This will have to be corrected if we have a "TODO"/"SKIP" directive.
  result_obj["description"] = line
  result_obj["directive"] = ""
  result_obj["explanation"] = ""

  if (index(line, "#") == 0)
    return # No possible directive, nothing more to do.

  # Directives are case-insensitive.
  rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*"

  # See whether we have the directive, and if yes, where.
  pos = match(line, rx "$")
  if (!pos)
    pos = match(line, rx "[^a-zA-Z0-9_]")

  # If there was no TAP directive, we have nothing more to do.
  if (!pos)
    return

  # Let`s now see if the TAP directive has been escaped.  For example:
  #  escaped:     ok \# SKIP
  #  not escaped: ok \\# SKIP
  #  escaped:     ok \\\\\# SKIP
  #  not escaped: ok \ # SKIP
  if (substr(line, pos, 1) == "#")
    {
      bslash_count = 0
      for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--)
        bslash_count += 1
      if (bslash_count % 2)
        return # Directive was escaped.
    }

  # Strip the directive and its explanation (if any) from the test
  # description.
  result_obj["description"] = substr(line, 1, pos - 1)
  # Now remove the test description from the line, that has been dealt
  # with already.
  line = substr(line, pos)
  # Strip the directive, and save its value (normalized to upper case).
  sub("^[ \t]*#[ \t]*", "", line)
  result_obj["directive"] = toupper(substr(line, 1, 4))
  line = substr(line, 5)
  # Now get the explanation for the directive (if any), with leading
  # and trailing whitespace removed.
  sub("^[ \t]*", "", line)
  sub("[ \t]*$", "", line)
  result_obj["explanation"] = line
}

function get_test_exit_message(status)
{
  if (status == 0)
    return ""
  if (status !~ /^[1-9][0-9]*$/)
    abort("getting exit status")
  if (status < 127)
    exit_details = ""
  else if (status == 127)
    exit_details = " (command not found?)"
  else if (status >= 128 && status <= 255)
    exit_details = sprintf(" (terminated by signal %d?)", status - 128)
  else if (status > 256 && status <= 384)
    # We used to report an "abnormal termination" here, but some Korn
    # shells, when a child process die due to signal number n, can leave
    # in $? an exit status of 256+n instead of the more standard 128+n.
    # Apparently, both behaviours are allowed by POSIX (2008), so be
    # prepared to handle them both.  See also Austing Group report ID
    # 0000051 <http://www.austingroupbugs.net/view.php?id=51>
    exit_details = sprintf(" (terminated by signal %d?)", status - 256)
  else
    # Never seen in practice.
    exit_details = " (abnormal termination)"
  return sprintf("exited with status %d%s", status, exit_details)
}

function write_test_results()
{
  print ":global-test-result: " get_global_test_result() > trs_file
  print ":recheck: "  yn(must_recheck()) > trs_file
  print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file
  for (i = 0; i < test_results_index; i += 1)
    print ":test-result: " test_results_list[i] > trs_file
  close(trs_file);
}

BEGIN {

## ------- ##
##  SETUP  ##
## ------- ##

'"$init_colors"'

# Properly initialized once the TAP plan is seen.
planned_tests = 0

COOKED_PASS = expect_failure ? "XPASS": "PASS";
COOKED_FAIL = expect_failure ? "XFAIL": "FAIL";

# Enumeration-like constants to remember which kind of plan (if any)
# has been seen.  It is important that NO_PLAN evaluates "false" as
# a boolean.
NO_PLAN = 0
EARLY_PLAN = 1
LATE_PLAN = 2

testno = 0     # Number of test results seen so far.
bailed_out = 0 # Whether a "Bail out!" directive has been seen.

# Whether the TAP plan has been seen or not, and if yes, which kind
# it is ("early" is seen before any test result, "late" otherwise).
plan_seen = NO_PLAN

## --------- ##
##  PARSING  ##
## --------- ##

is_first_read = 1

while (1)
  {
    # Involutions required so that we are able to read the exit status
    # from the last input line.
    st = getline
    if (st < 0) # I/O error.
      fatal("I/O error while reading from input stream")
    else if (st == 0) # End-of-input
      {
        if (is_first_read)
          abort("in input loop: only one input line")
        break
      }
    if (is_first_read)
      {
        is_first_read = 0
        nextline = $0
        continue
      }
    else
      {
        curline = nextline
        nextline = $0
        $0 = curline
      }
    # Copy any input line verbatim into the log file.
    print | "cat >&3"
    # Parsing of TAP input should stop after a "Bail out!" directive.
    if (bailed_out)
      continue

    # TAP test result.
    if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/)
      {
        testno += 1
        setup_result_obj($0)
        handle_tap_result()
      }
    # TAP plan (normal or "SKIP" without explanation).
    else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/)
      {
        # The next two lines will put the number of planned tests in $0.
        sub("^1\\.\\.", "")
        sub("[^0-9]*$", "")
        handle_tap_plan($0, "")
        continue
      }
    # TAP "SKIP" plan, with an explanation.
    else if ($0 ~ /^1\.\.0+[ \t]*#/)
      {
        # The next lines will put the skip explanation in $0, stripping
        # any leading and trailing whitespace.  This is a little more
        # tricky in truth, since we want to also strip a potential leading
        # "SKIP" string from the message.
        sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "")
        sub("[ \t]*$", "");
        handle_tap_plan(0, $0)
      }
    # "Bail out!" magic.
    # Older versions of prove and TAP::Harness (e.g., 3.17) did not
    # recognize a "Bail out!" directive when preceded by leading
    # whitespace, but more modern versions (e.g., 3.23) do.  So we
    # emulate the latter, "more modern" behaviour.
    else if ($0 ~ /^[ \t]*Bail out!/)
      {
        bailed_out = 1
        # Get the bailout message (if any), with leading and trailing
        # whitespace stripped.  The message remains stored in `$0`.
        sub("^[ \t]*Bail out![ \t]*", "");
        sub("[ \t]*$", "");
        # Format the error message for the
        bailout_message = "Bail out!"
        if (length($0))
          bailout_message = bailout_message " " $0
        testsuite_error(bailout_message)
      }
    # Maybe we have too look for dianogtic comments too.
    else if (comments != 0)
      {
        comment = extract_tap_comment($0);
        if (length(comment))
          report("#", comment);
      }
  }

## -------- ##
##  FINISH  ##
## -------- ##

# A "Bail out!" directive should cause us to ignore any following TAP
# error, as well as a non-zero exit status from the TAP producer.
if (!bailed_out)
  {
    if (!plan_seen)
      {
        testsuite_error("missing test plan")
      }
    else if (planned_tests != testno)
      {
        bad_amount = testno > planned_tests ? "many" : "few"
        testsuite_error(sprintf("too %s tests run (expected %d, got %d)",
                                bad_amount, planned_tests, testno))
      }
    if (!ignore_exit)
      {
        # Fetch exit status from the last line.
        exit_message = get_test_exit_message(nextline)
        if (exit_message)
          testsuite_error(exit_message)
      }
  }

write_test_results()

exit 0

} # End of "BEGIN" block.
'

# TODO: document that we consume the file descriptor 3 :-(
} 3>"$log_file"

test $? -eq 0 || fatal "I/O or internal error"

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
config.guess000075500000126206150523165450007101 0ustar00#! /bin/sh
# Attempt to guess a canonical system name.
#   Copyright 1992-2018 Free Software Foundation, Inc.

timestamp='2018-03-08'

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, 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, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program.  This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches to <config-patches@gnu.org>.


me=`echo "$0" | sed -e 's,.*/,,'`

usage="\
Usage: $0 [OPTION]

Output the configuration name of the system \`$me' is run on.

Options:
  -h, --help         print this help, then exit
  -t, --time-stamp   print date of last modification, then exit
  -v, --version      print version number, then exit

Report bugs and patches to <config-patches@gnu.org>."

version="\
GNU config.guess ($timestamp)

Originally written by Per Bothner.
Copyright 1992-2018 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

help="
Try \`$me --help' for more information."

# Parse command line
while test $# -gt 0 ; do
  case $1 in
    --time-stamp | --time* | -t )
       echo "$timestamp" ; exit ;;
    --version | -v )
       echo "$version" ; exit ;;
    --help | --h* | -h )
       echo "$usage"; exit ;;
    -- )     # Stop option processing
       shift; break ;;
    - )	# Use stdin as input.
       break ;;
    -* )
       echo "$me: invalid option $1$help" >&2
       exit 1 ;;
    * )
       break ;;
  esac
done

if test $# != 0; then
  echo "$me: too many arguments$help" >&2
  exit 1
fi

trap 'exit 1' 1 2 15

# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.

# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.

# Portable tmp directory creation inspired by the Autoconf team.

set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
: ${TMPDIR=/tmp} ;
 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
 ,,)    echo "int x;" > "$dummy.c" ;
	for c in cc gcc c89 c99 ; do
	  if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
	     CC_FOR_BUILD="$c"; break ;
	  fi ;
	done ;
	if test x"$CC_FOR_BUILD" = x ; then
	  CC_FOR_BUILD=no_compiler_found ;
	fi
	;;
 ,,*)   CC_FOR_BUILD=$CC ;;
 ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
esac ; set_cc_for_build= ;'

# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
	PATH=$PATH:/.attbin ; export PATH
fi

UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

case "$UNAME_SYSTEM" in
Linux|GNU|GNU/*)
	# If the system lacks a compiler, then just pick glibc.
	# We could probably try harder.
	LIBC=gnu

	eval "$set_cc_for_build"
	cat <<-EOF > "$dummy.c"
	#include <features.h>
	#if defined(__UCLIBC__)
	LIBC=uclibc
	#elif defined(__dietlibc__)
	LIBC=dietlibc
	#else
	LIBC=gnu
	#endif
	EOF
	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"

	# If ldd exists, use it to detect musl libc.
	if command -v ldd >/dev/null && \
		ldd --version 2>&1 | grep -q ^musl
	then
	    LIBC=musl
	fi
	;;
esac

# Note: order is significant - the case branches are not exclusive.

case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
    *:NetBSD:*:*)
	# NetBSD (nbsd) targets should (where applicable) match one or
	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
	# switched to ELF, *-*-netbsd* would select the old
	# object file format.  This provides both forward
	# compatibility and a consistent mechanism for selecting the
	# object file format.
	#
	# Note: NetBSD doesn't particularly care about the vendor
	# portion of the name.  We always set it to "unknown".
	sysctl="sysctl -n hw.machine_arch"
	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
	    "/sbin/$sysctl" 2>/dev/null || \
	    "/usr/sbin/$sysctl" 2>/dev/null || \
	    echo unknown)`
	case "$UNAME_MACHINE_ARCH" in
	    armeb) machine=armeb-unknown ;;
	    arm*) machine=arm-unknown ;;
	    sh3el) machine=shl-unknown ;;
	    sh3eb) machine=sh-unknown ;;
	    sh5el) machine=sh5le-unknown ;;
	    earmv*)
		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
		machine="${arch}${endian}"-unknown
		;;
	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
	esac
	# The Operating System including object format, if it has switched
	# to ELF recently (or will in the future) and ABI.
	case "$UNAME_MACHINE_ARCH" in
	    earm*)
		os=netbsdelf
		;;
	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
		eval "$set_cc_for_build"
		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
			| grep -q __ELF__
		then
		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
		    # Return netbsd for either.  FIX?
		    os=netbsd
		else
		    os=netbsdelf
		fi
		;;
	    *)
		os=netbsd
		;;
	esac
	# Determine ABI tags.
	case "$UNAME_MACHINE_ARCH" in
	    earm*)
		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
		;;
	esac
	# The OS release
	# Debian GNU/NetBSD machines have a different userland, and
	# thus, need a distinct triplet. However, they do not need
	# kernel version information, so it can be replaced with a
	# suitable tag, in the style of linux-gnu.
	case "$UNAME_VERSION" in
	    Debian*)
		release='-gnu'
		;;
	    *)
		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
		;;
	esac
	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
	# contains redundant information, the shorter form:
	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
	echo "$machine-${os}${release}${abi}"
	exit ;;
    *:Bitrig:*:*)
	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
	exit ;;
    *:OpenBSD:*:*)
	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
	exit ;;
    *:LibertyBSD:*:*)
	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
	exit ;;
    *:MidnightBSD:*:*)
	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
	exit ;;
    *:ekkoBSD:*:*)
	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
	exit ;;
    *:SolidBSD:*:*)
	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
	exit ;;
    macppc:MirBSD:*:*)
	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
	exit ;;
    *:MirBSD:*:*)
	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
	exit ;;
    *:Sortix:*:*)
	echo "$UNAME_MACHINE"-unknown-sortix
	exit ;;
    *:Redox:*:*)
	echo "$UNAME_MACHINE"-unknown-redox
	exit ;;
    mips:OSF1:*.*)
        echo mips-dec-osf1
        exit ;;
    alpha:OSF1:*:*)
	case $UNAME_RELEASE in
	*4.0)
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
		;;
	*5.*)
		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
		;;
	esac
	# According to Compaq, /usr/sbin/psrinfo has been available on
	# OSF/1 and Tru64 systems produced since 1995.  I hope that
	# covers most systems running today.  This code pipes the CPU
	# types through head -n 1, so we only detect the type of CPU 0.
	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
	case "$ALPHA_CPU_TYPE" in
	    "EV4 (21064)")
		UNAME_MACHINE=alpha ;;
	    "EV4.5 (21064)")
		UNAME_MACHINE=alpha ;;
	    "LCA4 (21066/21068)")
		UNAME_MACHINE=alpha ;;
	    "EV5 (21164)")
		UNAME_MACHINE=alphaev5 ;;
	    "EV5.6 (21164A)")
		UNAME_MACHINE=alphaev56 ;;
	    "EV5.6 (21164PC)")
		UNAME_MACHINE=alphapca56 ;;
	    "EV5.7 (21164PC)")
		UNAME_MACHINE=alphapca57 ;;
	    "EV6 (21264)")
		UNAME_MACHINE=alphaev6 ;;
	    "EV6.7 (21264A)")
		UNAME_MACHINE=alphaev67 ;;
	    "EV6.8CB (21264C)")
		UNAME_MACHINE=alphaev68 ;;
	    "EV6.8AL (21264B)")
		UNAME_MACHINE=alphaev68 ;;
	    "EV6.8CX (21264D)")
		UNAME_MACHINE=alphaev68 ;;
	    "EV6.9A (21264/EV69A)")
		UNAME_MACHINE=alphaev69 ;;
	    "EV7 (21364)")
		UNAME_MACHINE=alphaev7 ;;
	    "EV7.9 (21364A)")
		UNAME_MACHINE=alphaev79 ;;
	esac
	# A Pn.n version is a patched version.
	# A Vn.n version is a released version.
	# A Tn.n version is a released field test version.
	# A Xn.n version is an unreleased experimental baselevel.
	# 1.2 uses "1.2" for uname -r.
	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
	exitcode=$?
	trap '' 0
	exit $exitcode ;;
    Amiga*:UNIX_System_V:4.0:*)
	echo m68k-unknown-sysv4
	exit ;;
    *:[Aa]miga[Oo][Ss]:*:*)
	echo "$UNAME_MACHINE"-unknown-amigaos
	exit ;;
    *:[Mm]orph[Oo][Ss]:*:*)
	echo "$UNAME_MACHINE"-unknown-morphos
	exit ;;
    *:OS/390:*:*)
	echo i370-ibm-openedition
	exit ;;
    *:z/VM:*:*)
	echo s390-ibm-zvmoe
	exit ;;
    *:OS400:*:*)
	echo powerpc-ibm-os400
	exit ;;
    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
	echo arm-acorn-riscix"$UNAME_RELEASE"
	exit ;;
    arm*:riscos:*:*|arm*:RISCOS:*:*)
	echo arm-unknown-riscos
	exit ;;
    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
	echo hppa1.1-hitachi-hiuxmpp
	exit ;;
    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
	if test "`(/bin/universe) 2>/dev/null`" = att ; then
		echo pyramid-pyramid-sysv3
	else
		echo pyramid-pyramid-bsd
	fi
	exit ;;
    NILE*:*:*:dcosx)
	echo pyramid-pyramid-svr4
	exit ;;
    DRS?6000:unix:4.0:6*)
	echo sparc-icl-nx6
	exit ;;
    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
	case `/usr/bin/uname -p` in
	    sparc) echo sparc-icl-nx7; exit ;;
	esac ;;
    s390x:SunOS:*:*)
	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
	exit ;;
    sun4H:SunOS:5.*:*)
	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
	exit ;;
    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
	exit ;;
    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
	echo i386-pc-auroraux"$UNAME_RELEASE"
	exit ;;
    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
	eval "$set_cc_for_build"
	SUN_ARCH=i386
	# If there is a compiler, see if it is configured for 64-bit objects.
	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
	# This test works for both compilers.
	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
		grep IS_64BIT_ARCH >/dev/null
	    then
		SUN_ARCH=x86_64
	    fi
	fi
	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
	exit ;;
    sun4*:SunOS:6*:*)
	# According to config.sub, this is the proper way to canonicalize
	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
	# it's likely to be more like Solaris than SunOS4.
	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
	exit ;;
    sun4*:SunOS:*:*)
	case "`/usr/bin/arch -k`" in
	    Series*|S4*)
		UNAME_RELEASE=`uname -v`
		;;
	esac
	# Japanese Language versions have a version number like `4.1.3-JL'.
	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
	exit ;;
    sun3*:SunOS:*:*)
	echo m68k-sun-sunos"$UNAME_RELEASE"
	exit ;;
    sun*:*:4.2BSD:*)
	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
	case "`/bin/arch`" in
	    sun3)
		echo m68k-sun-sunos"$UNAME_RELEASE"
		;;
	    sun4)
		echo sparc-sun-sunos"$UNAME_RELEASE"
		;;
	esac
	exit ;;
    aushp:SunOS:*:*)
	echo sparc-auspex-sunos"$UNAME_RELEASE"
	exit ;;
    # The situation for MiNT is a little confusing.  The machine name
    # can be virtually everything (everything which is not
    # "atarist" or "atariste" at least should have a processor
    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
    # to the lowercase version "mint" (or "freemint").  Finally
    # the system name "TOS" denotes a system which is actually not
    # MiNT.  But MiNT is downward compatible to TOS, so this should
    # be no problem.
    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
	echo m68k-atari-mint"$UNAME_RELEASE"
	exit ;;
    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
	echo m68k-atari-mint"$UNAME_RELEASE"
	exit ;;
    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
	echo m68k-atari-mint"$UNAME_RELEASE"
	exit ;;
    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
	echo m68k-milan-mint"$UNAME_RELEASE"
	exit ;;
    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
	echo m68k-hades-mint"$UNAME_RELEASE"
	exit ;;
    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
	echo m68k-unknown-mint"$UNAME_RELEASE"
	exit ;;
    m68k:machten:*:*)
	echo m68k-apple-machten"$UNAME_RELEASE"
	exit ;;
    powerpc:machten:*:*)
	echo powerpc-apple-machten"$UNAME_RELEASE"
	exit ;;
    RISC*:Mach:*:*)
	echo mips-dec-mach_bsd4.3
	exit ;;
    RISC*:ULTRIX:*:*)
	echo mips-dec-ultrix"$UNAME_RELEASE"
	exit ;;
    VAX*:ULTRIX*:*:*)
	echo vax-dec-ultrix"$UNAME_RELEASE"
	exit ;;
    2020:CLIX:*:* | 2430:CLIX:*:*)
	echo clipper-intergraph-clix"$UNAME_RELEASE"
	exit ;;
    mips:*:*:UMIPS | mips:*:*:RISCos)
	eval "$set_cc_for_build"
	sed 's/^	//' << EOF > "$dummy.c"
#ifdef __cplusplus
#include <stdio.h>  /* for printf() prototype */
	int main (int argc, char *argv[]) {
#else
	int main (argc, argv) int argc; char *argv[]; {
#endif
	#if defined (host_mips) && defined (MIPSEB)
	#if defined (SYSTYPE_SYSV)
	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_SVR4)
	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
	#endif
	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
	#endif
	#endif
	  exit (-1);
	}
EOF
	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
	    { echo "$SYSTEM_NAME"; exit; }
	echo mips-mips-riscos"$UNAME_RELEASE"
	exit ;;
    Motorola:PowerMAX_OS:*:*)
	echo powerpc-motorola-powermax
	exit ;;
    Motorola:*:4.3:PL8-*)
	echo powerpc-harris-powermax
	exit ;;
    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
	echo powerpc-harris-powermax
	exit ;;
    Night_Hawk:Power_UNIX:*:*)
	echo powerpc-harris-powerunix
	exit ;;
    m88k:CX/UX:7*:*)
	echo m88k-harris-cxux7
	exit ;;
    m88k:*:4*:R4*)
	echo m88k-motorola-sysv4
	exit ;;
    m88k:*:3*:R3*)
	echo m88k-motorola-sysv3
	exit ;;
    AViiON:dgux:*:*)
	# DG/UX returns AViiON for all architectures
	UNAME_PROCESSOR=`/usr/bin/uname -p`
	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
	then
	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
	       [ "$TARGET_BINARY_INTERFACE"x = x ]
	    then
		echo m88k-dg-dgux"$UNAME_RELEASE"
	    else
		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
	    fi
	else
	    echo i586-dg-dgux"$UNAME_RELEASE"
	fi
	exit ;;
    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
	echo m88k-dolphin-sysv3
	exit ;;
    M88*:*:R3*:*)
	# Delta 88k system running SVR3
	echo m88k-motorola-sysv3
	exit ;;
    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
	echo m88k-tektronix-sysv3
	exit ;;
    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
	echo m68k-tektronix-bsd
	exit ;;
    *:IRIX*:*:*)
	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
	exit ;;
    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
    i*86:AIX:*:*)
	echo i386-ibm-aix
	exit ;;
    ia64:AIX:*:*)
	if [ -x /usr/bin/oslevel ] ; then
		IBM_REV=`/usr/bin/oslevel`
	else
		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
	fi
	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
	exit ;;
    *:AIX:2:3)
	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
		eval "$set_cc_for_build"
		sed 's/^		//' << EOF > "$dummy.c"
		#include <sys/systemcfg.h>

		main()
			{
			if (!__power_pc())
				exit(1);
			puts("powerpc-ibm-aix3.2.5");
			exit(0);
			}
EOF
		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
		then
			echo "$SYSTEM_NAME"
		else
			echo rs6000-ibm-aix3.2.5
		fi
	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
		echo rs6000-ibm-aix3.2.4
	else
		echo rs6000-ibm-aix3.2
	fi
	exit ;;
    *:AIX:*:[4567])
	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
		IBM_ARCH=rs6000
	else
		IBM_ARCH=powerpc
	fi
	if [ -x /usr/bin/lslpp ] ; then
		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
	else
		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
	fi
	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
	exit ;;
    *:AIX:*:*)
	echo rs6000-ibm-aix
	exit ;;
    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
	echo romp-ibm-bsd4.4
	exit ;;
    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
	exit ;;                             # report: romp-ibm BSD 4.3
    *:BOSX:*:*)
	echo rs6000-bull-bosx
	exit ;;
    DPX/2?00:B.O.S.:*:*)
	echo m68k-bull-sysv3
	exit ;;
    9000/[34]??:4.3bsd:1.*:*)
	echo m68k-hp-bsd
	exit ;;
    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
	echo m68k-hp-bsd4.4
	exit ;;
    9000/[34678]??:HP-UX:*:*)
	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
	case "$UNAME_MACHINE" in
	    9000/31?)            HP_ARCH=m68000 ;;
	    9000/[34]??)         HP_ARCH=m68k ;;
	    9000/[678][0-9][0-9])
		if [ -x /usr/bin/getconf ]; then
		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
		    case "$sc_cpu_version" in
		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
		      532)                      # CPU_PA_RISC2_0
			case "$sc_kernel_bits" in
			  32) HP_ARCH=hppa2.0n ;;
			  64) HP_ARCH=hppa2.0w ;;
			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
			esac ;;
		    esac
		fi
		if [ "$HP_ARCH" = "" ]; then
		    eval "$set_cc_for_build"
		    sed 's/^		//' << EOF > "$dummy.c"

		#define _HPUX_SOURCE
		#include <stdlib.h>
		#include <unistd.h>

		int main ()
		{
		#if defined(_SC_KERNEL_BITS)
		    long bits = sysconf(_SC_KERNEL_BITS);
		#endif
		    long cpu  = sysconf (_SC_CPU_VERSION);

		    switch (cpu)
			{
			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
			case CPU_PA_RISC2_0:
		#if defined(_SC_KERNEL_BITS)
			    switch (bits)
				{
				case 64: puts ("hppa2.0w"); break;
				case 32: puts ("hppa2.0n"); break;
				default: puts ("hppa2.0"); break;
				} break;
		#else  /* !defined(_SC_KERNEL_BITS) */
			    puts ("hppa2.0"); break;
		#endif
			default: puts ("hppa1.0"); break;
			}
		    exit (0);
		}
EOF
		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
		    test -z "$HP_ARCH" && HP_ARCH=hppa
		fi ;;
	esac
	if [ "$HP_ARCH" = hppa2.0w ]
	then
	    eval "$set_cc_for_build"

	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
	    # generating 64-bit code.  GNU and HP use different nomenclature:
	    #
	    # $ CC_FOR_BUILD=cc ./config.guess
	    # => hppa2.0w-hp-hpux11.23
	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
	    # => hppa64-hp-hpux11.23

	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
		grep -q __LP64__
	    then
		HP_ARCH=hppa2.0w
	    else
		HP_ARCH=hppa64
	    fi
	fi
	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
	exit ;;
    ia64:HP-UX:*:*)
	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
	echo ia64-hp-hpux"$HPUX_REV"
	exit ;;
    3050*:HI-UX:*:*)
	eval "$set_cc_for_build"
	sed 's/^	//' << EOF > "$dummy.c"
	#include <unistd.h>
	int
	main ()
	{
	  long cpu = sysconf (_SC_CPU_VERSION);
	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
	     results, however.  */
	  if (CPU_IS_PA_RISC (cpu))
	    {
	      switch (cpu)
		{
		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
		  default: puts ("hppa-hitachi-hiuxwe2"); break;
		}
	    }
	  else if (CPU_IS_HP_MC68K (cpu))
	    puts ("m68k-hitachi-hiuxwe2");
	  else puts ("unknown-hitachi-hiuxwe2");
	  exit (0);
	}
EOF
	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
		{ echo "$SYSTEM_NAME"; exit; }
	echo unknown-hitachi-hiuxwe2
	exit ;;
    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
	echo hppa1.1-hp-bsd
	exit ;;
    9000/8??:4.3bsd:*:*)
	echo hppa1.0-hp-bsd
	exit ;;
    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
	echo hppa1.0-hp-mpeix
	exit ;;
    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
	echo hppa1.1-hp-osf
	exit ;;
    hp8??:OSF1:*:*)
	echo hppa1.0-hp-osf
	exit ;;
    i*86:OSF1:*:*)
	if [ -x /usr/sbin/sysversion ] ; then
	    echo "$UNAME_MACHINE"-unknown-osf1mk
	else
	    echo "$UNAME_MACHINE"-unknown-osf1
	fi
	exit ;;
    parisc*:Lites*:*:*)
	echo hppa1.1-hp-lites
	exit ;;
    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
	echo c1-convex-bsd
	exit ;;
    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
	if getsysinfo -f scalar_acc
	then echo c32-convex-bsd
	else echo c2-convex-bsd
	fi
	exit ;;
    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
	echo c34-convex-bsd
	exit ;;
    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
	echo c38-convex-bsd
	exit ;;
    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
	echo c4-convex-bsd
	exit ;;
    CRAY*Y-MP:*:*:*)
	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
	exit ;;
    CRAY*[A-Z]90:*:*:*)
	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
	      -e 's/\.[^.]*$/.X/'
	exit ;;
    CRAY*TS:*:*:*)
	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
	exit ;;
    CRAY*T3E:*:*:*)
	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
	exit ;;
    CRAY*SV1:*:*:*)
	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
	exit ;;
    *:UNICOS/mp:*:*)
	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
	exit ;;
    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
	exit ;;
    5000:UNIX_System_V:4.*:*)
	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
	exit ;;
    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
	exit ;;
    sparc*:BSD/OS:*:*)
	echo sparc-unknown-bsdi"$UNAME_RELEASE"
	exit ;;
    *:BSD/OS:*:*)
	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
	exit ;;
    *:FreeBSD:*:*)
	UNAME_PROCESSOR=`/usr/bin/uname -p`
	case "$UNAME_PROCESSOR" in
	    amd64)
		UNAME_PROCESSOR=x86_64 ;;
	    i386)
		UNAME_PROCESSOR=i586 ;;
	esac
	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
	exit ;;
    i*:CYGWIN*:*)
	echo "$UNAME_MACHINE"-pc-cygwin
	exit ;;
    *:MINGW64*:*)
	echo "$UNAME_MACHINE"-pc-mingw64
	exit ;;
    *:MINGW*:*)
	echo "$UNAME_MACHINE"-pc-mingw32
	exit ;;
    *:MSYS*:*)
	echo "$UNAME_MACHINE"-pc-msys
	exit ;;
    i*:PW*:*)
	echo "$UNAME_MACHINE"-pc-pw32
	exit ;;
    *:Interix*:*)
	case "$UNAME_MACHINE" in
	    x86)
		echo i586-pc-interix"$UNAME_RELEASE"
		exit ;;
	    authenticamd | genuineintel | EM64T)
		echo x86_64-unknown-interix"$UNAME_RELEASE"
		exit ;;
	    IA64)
		echo ia64-unknown-interix"$UNAME_RELEASE"
		exit ;;
	esac ;;
    i*:UWIN*:*)
	echo "$UNAME_MACHINE"-pc-uwin
	exit ;;
    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
	echo x86_64-unknown-cygwin
	exit ;;
    prep*:SunOS:5.*:*)
	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
	exit ;;
    *:GNU:*:*)
	# the GNU system
	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
	exit ;;
    *:GNU/*:*:*)
	# other systems with GNU libc and userland
	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
	exit ;;
    i*86:Minix:*:*)
	echo "$UNAME_MACHINE"-pc-minix
	exit ;;
    aarch64:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    aarch64_be:Linux:*:*)
	UNAME_MACHINE=aarch64_be
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    alpha:Linux:*:*)
	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
	  EV5)   UNAME_MACHINE=alphaev5 ;;
	  EV56)  UNAME_MACHINE=alphaev56 ;;
	  PCA56) UNAME_MACHINE=alphapca56 ;;
	  PCA57) UNAME_MACHINE=alphapca56 ;;
	  EV6)   UNAME_MACHINE=alphaev6 ;;
	  EV67)  UNAME_MACHINE=alphaev67 ;;
	  EV68*) UNAME_MACHINE=alphaev68 ;;
	esac
	objdump --private-headers /bin/sh | grep -q ld.so.1
	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    arc:Linux:*:* | arceb:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    arm*:Linux:*:*)
	eval "$set_cc_for_build"
	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
	    | grep -q __ARM_EABI__
	then
	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	else
	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
		| grep -q __ARM_PCS_VFP
	    then
		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
	    else
		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
	    fi
	fi
	exit ;;
    avr32*:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    cris:Linux:*:*)
	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
	exit ;;
    crisv32:Linux:*:*)
	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
	exit ;;
    e2k:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    frv:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    hexagon:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    i*86:Linux:*:*)
	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
	exit ;;
    ia64:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    k1om:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    m32r*:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    m68*:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    mips:Linux:*:* | mips64:Linux:*:*)
	eval "$set_cc_for_build"
	sed 's/^	//' << EOF > "$dummy.c"
	#undef CPU
	#undef ${UNAME_MACHINE}
	#undef ${UNAME_MACHINE}el
	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
	CPU=${UNAME_MACHINE}el
	#else
	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
	CPU=${UNAME_MACHINE}
	#else
	CPU=
	#endif
	#endif
EOF
	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
	test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
	;;
    mips64el:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    openrisc*:Linux:*:*)
	echo or1k-unknown-linux-"$LIBC"
	exit ;;
    or32:Linux:*:* | or1k*:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    padre:Linux:*:*)
	echo sparc-unknown-linux-"$LIBC"
	exit ;;
    parisc64:Linux:*:* | hppa64:Linux:*:*)
	echo hppa64-unknown-linux-"$LIBC"
	exit ;;
    parisc:Linux:*:* | hppa:Linux:*:*)
	# Look for CPU level
	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
	  *)    echo hppa-unknown-linux-"$LIBC" ;;
	esac
	exit ;;
    ppc64:Linux:*:*)
	echo powerpc64-unknown-linux-"$LIBC"
	exit ;;
    ppc:Linux:*:*)
	echo powerpc-unknown-linux-"$LIBC"
	exit ;;
    ppc64le:Linux:*:*)
	echo powerpc64le-unknown-linux-"$LIBC"
	exit ;;
    ppcle:Linux:*:*)
	echo powerpcle-unknown-linux-"$LIBC"
	exit ;;
    riscv32:Linux:*:* | riscv64:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    s390:Linux:*:* | s390x:Linux:*:*)
	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
	exit ;;
    sh64*:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    sh*:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    sparc:Linux:*:* | sparc64:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    tile*:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    vax:Linux:*:*)
	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
	exit ;;
    x86_64:Linux:*:*)
	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
	exit ;;
    xtensa*:Linux:*:*)
	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
	exit ;;
    i*86:DYNIX/ptx:4*:*)
	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
	# earlier versions are messed up and put the nodename in both
	# sysname and nodename.
	echo i386-sequent-sysv4
	exit ;;
    i*86:UNIX_SV:4.2MP:2.*)
	# Unixware is an offshoot of SVR4, but it has its own version
	# number series starting with 2...
	# I am not positive that other SVR4 systems won't match this,
	# I just have to hope.  -- rms.
	# Use sysv4.2uw... so that sysv4* matches it.
	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
	exit ;;
    i*86:OS/2:*:*)
	# If we were able to find `uname', then EMX Unix compatibility
	# is probably installed.
	echo "$UNAME_MACHINE"-pc-os2-emx
	exit ;;
    i*86:XTS-300:*:STOP)
	echo "$UNAME_MACHINE"-unknown-stop
	exit ;;
    i*86:atheos:*:*)
	echo "$UNAME_MACHINE"-unknown-atheos
	exit ;;
    i*86:syllable:*:*)
	echo "$UNAME_MACHINE"-pc-syllable
	exit ;;
    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
	echo i386-unknown-lynxos"$UNAME_RELEASE"
	exit ;;
    i*86:*DOS:*:*)
	echo "$UNAME_MACHINE"-pc-msdosdjgpp
	exit ;;
    i*86:*:4.*:*)
	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
	else
		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
	fi
	exit ;;
    i*86:*:5:[678]*)
	# UnixWare 7.x, OpenUNIX and OpenServer 6.
	case `/bin/uname -X | grep "^Machine"` in
	    *486*)	     UNAME_MACHINE=i486 ;;
	    *Pentium)	     UNAME_MACHINE=i586 ;;
	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
	esac
	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
	exit ;;
    i*86:*:3.2:*)
	if test -f /usr/options/cb.name; then
		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
	elif /bin/uname -X 2>/dev/null >/dev/null ; then
		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
			&& UNAME_MACHINE=i586
		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
			&& UNAME_MACHINE=i686
		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
			&& UNAME_MACHINE=i686
		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
	else
		echo "$UNAME_MACHINE"-pc-sysv32
	fi
	exit ;;
    pc:*:*:*)
	# Left here for compatibility:
	# uname -m prints for DJGPP always 'pc', but it prints nothing about
	# the processor, so we play safe by assuming i586.
	# Note: whatever this is, it MUST be the same as what config.sub
	# prints for the "djgpp" host, or else GDB configure will decide that
	# this is a cross-build.
	echo i586-pc-msdosdjgpp
	exit ;;
    Intel:Mach:3*:*)
	echo i386-pc-mach3
	exit ;;
    paragon:*:*:*)
	echo i860-intel-osf1
	exit ;;
    i860:*:4.*:*) # i860-SVR4
	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
	else # Add other i860-SVR4 vendors below as they are discovered.
	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
	fi
	exit ;;
    mini*:CTIX:SYS*5:*)
	# "miniframe"
	echo m68010-convergent-sysv
	exit ;;
    mc68k:UNIX:SYSTEM5:3.51m)
	echo m68k-convergent-sysv
	exit ;;
    M680?0:D-NIX:5.3:*)
	echo m68k-diab-dnix
	exit ;;
    M68*:*:R3V[5678]*:*)
	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
	OS_REL=''
	test -r /etc/.relid \
	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
	  && { echo i486-ncr-sysv4; exit; } ;;
    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
	OS_REL='.3'
	test -r /etc/.relid \
	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
	echo m68k-unknown-lynxos"$UNAME_RELEASE"
	exit ;;
    mc68030:UNIX_System_V:4.*:*)
	echo m68k-atari-sysv4
	exit ;;
    TSUNAMI:LynxOS:2.*:*)
	echo sparc-unknown-lynxos"$UNAME_RELEASE"
	exit ;;
    rs6000:LynxOS:2.*:*)
	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
	exit ;;
    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
	exit ;;
    SM[BE]S:UNIX_SV:*:*)
	echo mips-dde-sysv"$UNAME_RELEASE"
	exit ;;
    RM*:ReliantUNIX-*:*:*)
	echo mips-sni-sysv4
	exit ;;
    RM*:SINIX-*:*:*)
	echo mips-sni-sysv4
	exit ;;
    *:SINIX-*:*:*)
	if uname -p 2>/dev/null >/dev/null ; then
		UNAME_MACHINE=`(uname -p) 2>/dev/null`
		echo "$UNAME_MACHINE"-sni-sysv4
	else
		echo ns32k-sni-sysv
	fi
	exit ;;
    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
			# says <Richard.M.Bartel@ccMail.Census.GOV>
	echo i586-unisys-sysv4
	exit ;;
    *:UNIX_System_V:4*:FTX*)
	# From Gerald Hewes <hewes@openmarket.com>.
	# How about differentiating between stratus architectures? -djm
	echo hppa1.1-stratus-sysv4
	exit ;;
    *:*:*:FTX*)
	# From seanf@swdc.stratus.com.
	echo i860-stratus-sysv4
	exit ;;
    i*86:VOS:*:*)
	# From Paul.Green@stratus.com.
	echo "$UNAME_MACHINE"-stratus-vos
	exit ;;
    *:VOS:*:*)
	# From Paul.Green@stratus.com.
	echo hppa1.1-stratus-vos
	exit ;;
    mc68*:A/UX:*:*)
	echo m68k-apple-aux"$UNAME_RELEASE"
	exit ;;
    news*:NEWS-OS:6*:*)
	echo mips-sony-newsos6
	exit ;;
    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
	if [ -d /usr/nec ]; then
		echo mips-nec-sysv"$UNAME_RELEASE"
	else
		echo mips-unknown-sysv"$UNAME_RELEASE"
	fi
	exit ;;
    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
	echo powerpc-be-beos
	exit ;;
    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
	echo powerpc-apple-beos
	exit ;;
    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
	echo i586-pc-beos
	exit ;;
    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
	echo i586-pc-haiku
	exit ;;
    x86_64:Haiku:*:*)
	echo x86_64-unknown-haiku
	exit ;;
    SX-4:SUPER-UX:*:*)
	echo sx4-nec-superux"$UNAME_RELEASE"
	exit ;;
    SX-5:SUPER-UX:*:*)
	echo sx5-nec-superux"$UNAME_RELEASE"
	exit ;;
    SX-6:SUPER-UX:*:*)
	echo sx6-nec-superux"$UNAME_RELEASE"
	exit ;;
    SX-7:SUPER-UX:*:*)
	echo sx7-nec-superux"$UNAME_RELEASE"
	exit ;;
    SX-8:SUPER-UX:*:*)
	echo sx8-nec-superux"$UNAME_RELEASE"
	exit ;;
    SX-8R:SUPER-UX:*:*)
	echo sx8r-nec-superux"$UNAME_RELEASE"
	exit ;;
    SX-ACE:SUPER-UX:*:*)
	echo sxace-nec-superux"$UNAME_RELEASE"
	exit ;;
    Power*:Rhapsody:*:*)
	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
	exit ;;
    *:Rhapsody:*:*)
	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
	exit ;;
    *:Darwin:*:*)
	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
	eval "$set_cc_for_build"
	if test "$UNAME_PROCESSOR" = unknown ; then
	    UNAME_PROCESSOR=powerpc
	fi
	if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
		       grep IS_64BIT_ARCH >/dev/null
		then
		    case $UNAME_PROCESSOR in
			i386) UNAME_PROCESSOR=x86_64 ;;
			powerpc) UNAME_PROCESSOR=powerpc64 ;;
		    esac
		fi
		# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
		if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
		       grep IS_PPC >/dev/null
		then
		    UNAME_PROCESSOR=powerpc
		fi
	    fi
	elif test "$UNAME_PROCESSOR" = i386 ; then
	    # Avoid executing cc on OS X 10.9, as it ships with a stub
	    # that puts up a graphical alert prompting to install
	    # developer tools.  Any system running Mac OS X 10.7 or
	    # later (Darwin 11 and later) is required to have a 64-bit
	    # processor. This is not true of the ARM version of Darwin
	    # that Apple uses in portable devices.
	    UNAME_PROCESSOR=x86_64
	fi
	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
	exit ;;
    *:procnto*:*:* | *:QNX:[0123456789]*:*)
	UNAME_PROCESSOR=`uname -p`
	if test "$UNAME_PROCESSOR" = x86; then
		UNAME_PROCESSOR=i386
		UNAME_MACHINE=pc
	fi
	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
	exit ;;
    *:QNX:*:4*)
	echo i386-pc-qnx
	exit ;;
    NEO-*:NONSTOP_KERNEL:*:*)
	echo neo-tandem-nsk"$UNAME_RELEASE"
	exit ;;
    NSE-*:NONSTOP_KERNEL:*:*)
	echo nse-tandem-nsk"$UNAME_RELEASE"
	exit ;;
    NSR-*:NONSTOP_KERNEL:*:*)
	echo nsr-tandem-nsk"$UNAME_RELEASE"
	exit ;;
    NSV-*:NONSTOP_KERNEL:*:*)
	echo nsv-tandem-nsk"$UNAME_RELEASE"
	exit ;;
    NSX-*:NONSTOP_KERNEL:*:*)
	echo nsx-tandem-nsk"$UNAME_RELEASE"
	exit ;;
    *:NonStop-UX:*:*)
	echo mips-compaq-nonstopux
	exit ;;
    BS2000:POSIX*:*:*)
	echo bs2000-siemens-sysv
	exit ;;
    DS/*:UNIX_System_V:*:*)
	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
	exit ;;
    *:Plan9:*:*)
	# "uname -m" is not consistent, so use $cputype instead. 386
	# is converted to i386 for consistency with other x86
	# operating systems.
	if test "$cputype" = 386; then
	    UNAME_MACHINE=i386
	else
	    UNAME_MACHINE="$cputype"
	fi
	echo "$UNAME_MACHINE"-unknown-plan9
	exit ;;
    *:TOPS-10:*:*)
	echo pdp10-unknown-tops10
	exit ;;
    *:TENEX:*:*)
	echo pdp10-unknown-tenex
	exit ;;
    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
	echo pdp10-dec-tops20
	exit ;;
    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
	echo pdp10-xkl-tops20
	exit ;;
    *:TOPS-20:*:*)
	echo pdp10-unknown-tops20
	exit ;;
    *:ITS:*:*)
	echo pdp10-unknown-its
	exit ;;
    SEI:*:*:SEIUX)
	echo mips-sei-seiux"$UNAME_RELEASE"
	exit ;;
    *:DragonFly:*:*)
	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
	exit ;;
    *:*VMS:*:*)
	UNAME_MACHINE=`(uname -p) 2>/dev/null`
	case "$UNAME_MACHINE" in
	    A*) echo alpha-dec-vms ; exit ;;
	    I*) echo ia64-dec-vms ; exit ;;
	    V*) echo vax-dec-vms ; exit ;;
	esac ;;
    *:XENIX:*:SysV)
	echo i386-pc-xenix
	exit ;;
    i*86:skyos:*:*)
	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
	exit ;;
    i*86:rdos:*:*)
	echo "$UNAME_MACHINE"-pc-rdos
	exit ;;
    i*86:AROS:*:*)
	echo "$UNAME_MACHINE"-pc-aros
	exit ;;
    x86_64:VMkernel:*:*)
	echo "$UNAME_MACHINE"-unknown-esx
	exit ;;
    amd64:Isilon\ OneFS:*:*)
	echo x86_64-unknown-onefs
	exit ;;
esac

echo "$0: unable to guess system type" >&2

case "$UNAME_MACHINE:$UNAME_SYSTEM" in
    mips:Linux | mips64:Linux)
	# If we got here on MIPS GNU/Linux, output extra information.
	cat >&2 <<EOF

NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
the system type. Please install a C compiler and try again.
EOF
	;;
esac

cat >&2 <<EOF

This script (version $timestamp), has failed to recognize the
operating system you are using. If your script is old, overwrite *all*
copies of config.guess and config.sub with the latest versions from:

  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub

If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
provide the necessary information to handle your system.

config.guess timestamp = $timestamp

uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`

/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`

hostinfo               = `(hostinfo) 2>/dev/null`
/bin/universe          = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch              = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`

UNAME_MACHINE = "$UNAME_MACHINE"
UNAME_RELEASE = "$UNAME_RELEASE"
UNAME_SYSTEM  = "$UNAME_SYSTEM"
UNAME_VERSION = "$UNAME_VERSION"
EOF

exit 1

# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
depcomp000075500000056020150523165460006133 0ustar00#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 1999-2018 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.

case $1 in
  '')
    echo "$0: No command.  Try '$0 --help' for more information." 1>&2
    exit 1;
    ;;
  -h | --h*)
    cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]

Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.

Environment variables:
  depmode     Dependency tracking mode.
  source      Source file read by 'PROGRAMS ARGS'.
  object      Object file output by 'PROGRAMS ARGS'.
  DEPDIR      directory where to store dependencies.
  depfile     Dependency file to output.
  tmpdepfile  Temporary file to use when outputting dependencies.
  libtool     Whether libtool is used (yes/no).

Report bugs to <bug-automake@gnu.org>.
EOF
    exit $?
    ;;
  -v | --v*)
    echo "depcomp $scriptversion"
    exit $?
    ;;
esac

# Get the directory component of the given path, and save it in the
# global variables '$dir'.  Note that this directory component will
# be either empty or ending with a '/' character.  This is deliberate.
set_dir_from ()
{
  case $1 in
    */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
      *) dir=;;
  esac
}

# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
  base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}

# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
  echo "#dummy" > "$depfile"
}

# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
  # If the compiler actually managed to produce a dependency file,
  # post-process it.
  if test -f "$tmpdepfile"; then
    # Each line is of the form 'foo.o: dependency.h'.
    # Do two passes, one to just change these to
    #   $object: dependency.h
    # and one to simply output
    #   dependency.h:
    # which is needed to avoid the deleted-header problem.
    { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
      sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
    } > "$depfile"
    rm -f "$tmpdepfile"
  else
    make_dummy_depfile
  fi
}

# A tabulation character.
tab='	'
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}

if test -z "$depmode" || test -z "$source" || test -z "$object"; then
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
  exit 1
fi

# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}

rm -f "$tmpdepfile"

# Avoid interferences from the environment.
gccflag= dashmflag=

# Some modes work just like other modes, but use different flags.  We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write.  Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
  # HP compiler uses -M and no extra arg.
  gccflag=-M
  depmode=gcc
fi

if test "$depmode" = dashXmstdout; then
  # This is just like dashmstdout with a different argument.
  dashmflag=-xM
  depmode=dashmstdout
fi

cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
  # This is just like msvisualcpp but w/o cygpath translation.
  # Just convert the backslash-escaped backslashes to single forward
  # slashes to satisfy depend.m4
  cygpath_u='sed s,\\\\,/,g'
  depmode=msvisualcpp
fi

if test "$depmode" = msvc7msys; then
  # This is just like msvc7 but w/o cygpath translation.
  # Just convert the backslash-escaped backslashes to single forward
  # slashes to satisfy depend.m4
  cygpath_u='sed s,\\\\,/,g'
  depmode=msvc7
fi

if test "$depmode" = xlc; then
  # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
  gccflag=-qmakedep=gcc,-MF
  depmode=gcc
fi

case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff.  Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am.  Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
  for arg
  do
    case $arg in
    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
    *)  set fnord "$@" "$arg" ;;
    esac
    shift # fnord
    shift # $arg
  done
  "$@"
  stat=$?
  if test $stat -ne 0; then
    rm -f "$tmpdepfile"
    exit $stat
  fi
  mv "$tmpdepfile" "$depfile"
  ;;

gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc.  Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
##   up in a subdir.  Having to rename by hand is ugly.
##   (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
##   -MM, not -M (despite what the docs say).  Also, it might not be
##   supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
##   than renaming).
  if test -z "$gccflag"; then
    gccflag=-MD,
  fi
  "$@" -Wp,"$gccflag$tmpdepfile"
  stat=$?
  if test $stat -ne 0; then
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  # The second -e expression handles DOS-style file names with drive
  # letters.
  sed -e 's/^[^:]*: / /' \
      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header).  We avoid this by adding
## dummy dependencies for each header file.  Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'.  On the theory
## that the space means something, we add a space to the output as
## well.  hp depmode also adds that space, but also prefixes the VPATH
## to the object.  Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly.  Breaking it into two sed invocations is a workaround.
  tr ' ' "$nl" < "$tmpdepfile" \
    | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
    | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

hp)
  # This case exists only to let depend.m4 do its work.  It works by
  # looking at the text of this script.  This case will never be run,
  # since it is checked for above.
  exit 1
  ;;

sgi)
  if test "$libtool" = yes; then
    "$@" "-Wp,-MDupdate,$tmpdepfile"
  else
    "$@" -MDupdate "$tmpdepfile"
  fi
  stat=$?
  if test $stat -ne 0; then
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"

  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
    echo "$object : \\" > "$depfile"
    # Clip off the initial element (the dependent).  Don't try to be
    # clever and replace this with sed code, as IRIX sed won't handle
    # lines with more than a fixed number of characters (4096 in
    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
    # the IRIX cc adds comments like '#:fec' to the end of the
    # dependency line.
    tr ' ' "$nl" < "$tmpdepfile" \
      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
      | tr "$nl" ' ' >> "$depfile"
    echo >> "$depfile"
    # The second pass generates a dummy entry for each header file.
    tr ' ' "$nl" < "$tmpdepfile" \
      | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
      >> "$depfile"
  else
    make_dummy_depfile
  fi
  rm -f "$tmpdepfile"
  ;;

xlc)
  # This case exists only to let depend.m4 do its work.  It works by
  # looking at the text of this script.  This case will never be run,
  # since it is checked for above.
  exit 1
  ;;

aix)
  # The C for AIX Compiler uses -M and outputs the dependencies
  # in a .u file.  In older versions, this file always lives in the
  # current directory.  Also, the AIX compiler puts '$object:' at the
  # start of each line; $object doesn't have directory information.
  # Version 6 uses the directory in both cases.
  set_dir_from "$object"
  set_base_from "$object"
  if test "$libtool" = yes; then
    tmpdepfile1=$dir$base.u
    tmpdepfile2=$base.u
    tmpdepfile3=$dir.libs/$base.u
    "$@" -Wc,-M
  else
    tmpdepfile1=$dir$base.u
    tmpdepfile2=$dir$base.u
    tmpdepfile3=$dir$base.u
    "$@" -M
  fi
  stat=$?
  if test $stat -ne 0; then
    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
    exit $stat
  fi

  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
  do
    test -f "$tmpdepfile" && break
  done
  aix_post_process_depfile
  ;;

tcc)
  # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
  # FIXME: That version still under development at the moment of writing.
  #        Make that this statement remains true also for stable, released
  #        versions.
  # It will wrap lines (doesn't matter whether long or short) with a
  # trailing '\', as in:
  #
  #   foo.o : \
  #    foo.c \
  #    foo.h \
  #
  # It will put a trailing '\' even on the last line, and will use leading
  # spaces rather than leading tabs (at least since its commit 0394caf7
  # "Emit spaces for -MD").
  "$@" -MD -MF "$tmpdepfile"
  stat=$?
  if test $stat -ne 0; then
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"
  # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
  # We have to change lines of the first kind to '$object: \'.
  sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
  # And for each line of the second kind, we have to emit a 'dep.h:'
  # dummy dependency, to avoid the deleted-header problem.
  sed -n -e 's|^  *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file.  A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
  # Portland's C compiler understands '-MD'.
  # Will always output deps to 'file.d' where file is the root name of the
  # source file under compilation, even if file resides in a subdirectory.
  # The object file name does not affect the name of the '.d' file.
  # pgcc 10.2 will output
  #    foo.o: sub/foo.c sub/foo.h
  # and will wrap long lines using '\' :
  #    foo.o: sub/foo.c ... \
  #     sub/foo.h ... \
  #     ...
  set_dir_from "$object"
  # Use the source, not the object, to determine the base name, since
  # that's sadly what pgcc will do too.
  set_base_from "$source"
  tmpdepfile=$base.d

  # For projects that build the same source file twice into different object
  # files, the pgcc approach of using the *source* file root name can cause
  # problems in parallel builds.  Use a locking strategy to avoid stomping on
  # the same $tmpdepfile.
  lockdir=$base.d-lock
  trap "
    echo '$0: caught signal, cleaning up...' >&2
    rmdir '$lockdir'
    exit 1
  " 1 2 13 15
  numtries=100
  i=$numtries
  while test $i -gt 0; do
    # mkdir is a portable test-and-set.
    if mkdir "$lockdir" 2>/dev/null; then
      # This process acquired the lock.
      "$@" -MD
      stat=$?
      # Release the lock.
      rmdir "$lockdir"
      break
    else
      # If the lock is being held by a different process, wait
      # until the winning process is done or we timeout.
      while test -d "$lockdir" && test $i -gt 0; do
        sleep 1
        i=`expr $i - 1`
      done
    fi
    i=`expr $i - 1`
  done
  trap - 1 2 13 15
  if test $i -le 0; then
    echo "$0: failed to acquire lock after $numtries attempts" >&2
    echo "$0: check lockdir '$lockdir'" >&2
    exit 1
  fi

  if test $stat -ne 0; then
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"
  # Each line is of the form `foo.o: dependent.h',
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
  # Do two passes, one to just change these to
  # `$object: dependent.h' and one to simply `dependent.h:'.
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
  # Some versions of the HPUX 10.20 sed can't process this invocation
  # correctly.  Breaking it into two sed invocations is a workaround.
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
    | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

hp2)
  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
  # compilers, which have integrated preprocessors.  The correct option
  # to use with these is +Maked; it writes dependencies to a file named
  # 'foo.d', which lands next to the object file, wherever that
  # happens to be.
  # Much of this is similar to the tru64 case; see comments there.
  set_dir_from  "$object"
  set_base_from "$object"
  if test "$libtool" = yes; then
    tmpdepfile1=$dir$base.d
    tmpdepfile2=$dir.libs/$base.d
    "$@" -Wc,+Maked
  else
    tmpdepfile1=$dir$base.d
    tmpdepfile2=$dir$base.d
    "$@" +Maked
  fi
  stat=$?
  if test $stat -ne 0; then
     rm -f "$tmpdepfile1" "$tmpdepfile2"
     exit $stat
  fi

  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
  do
    test -f "$tmpdepfile" && break
  done
  if test -f "$tmpdepfile"; then
    sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
    # Add 'dependent.h:' lines.
    sed -ne '2,${
               s/^ *//
               s/ \\*$//
               s/$/:/
               p
             }' "$tmpdepfile" >> "$depfile"
  else
    make_dummy_depfile
  fi
  rm -f "$tmpdepfile" "$tmpdepfile2"
  ;;

tru64)
  # The Tru64 compiler uses -MD to generate dependencies as a side
  # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
  # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
  # dependencies in 'foo.d' instead, so we check for that too.
  # Subdirectories are respected.
  set_dir_from  "$object"
  set_base_from "$object"

  if test "$libtool" = yes; then
    # Libtool generates 2 separate objects for the 2 libraries.  These
    # two compilations output dependencies in $dir.libs/$base.o.d and
    # in $dir$base.o.d.  We have to check for both files, because
    # one of the two compilations can be disabled.  We should prefer
    # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
    # automatically cleaned when .libs/ is deleted, while ignoring
    # the former would cause a distcleancheck panic.
    tmpdepfile1=$dir$base.o.d          # libtool 1.5
    tmpdepfile2=$dir.libs/$base.o.d    # Likewise.
    tmpdepfile3=$dir.libs/$base.d      # Compaq CCC V6.2-504
    "$@" -Wc,-MD
  else
    tmpdepfile1=$dir$base.d
    tmpdepfile2=$dir$base.d
    tmpdepfile3=$dir$base.d
    "$@" -MD
  fi

  stat=$?
  if test $stat -ne 0; then
    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
    exit $stat
  fi

  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
  do
    test -f "$tmpdepfile" && break
  done
  # Same post-processing that is required for AIX mode.
  aix_post_process_depfile
  ;;

msvc7)
  if test "$libtool" = yes; then
    showIncludes=-Wc,-showIncludes
  else
    showIncludes=-showIncludes
  fi
  "$@" $showIncludes > "$tmpdepfile"
  stat=$?
  grep -v '^Note: including file: ' "$tmpdepfile"
  if test $stat -ne 0; then
    rm -f "$tmpdepfile"
    exit $stat
  fi
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  # The first sed program below extracts the file names and escapes
  # backslashes for cygpath.  The second sed program outputs the file
  # name when reading, but also accumulates all include files in the
  # hold buffer in order to output them again at the end.  This only
  # works with sed implementations that can handle large buffers.
  sed < "$tmpdepfile" -n '
/^Note: including file:  *\(.*\)/ {
  s//\1/
  s/\\/\\\\/g
  p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
  s/.*/'"$tab"'/
  G
  p
}' >> "$depfile"
  echo >> "$depfile" # make sure the fragment doesn't end with a backslash
  rm -f "$tmpdepfile"
  ;;

msvc7msys)
  # This case exists only to let depend.m4 do its work.  It works by
  # looking at the text of this script.  This case will never be run,
  # since it is checked for above.
  exit 1
  ;;

#nosideeffect)
  # This comment above is used by automake to tell side-effect
  # dependency tracking mechanisms from slower ones.

dashmstdout)
  # Important note: in order to support this mode, a compiler *must*
  # always write the preprocessed file to stdout, regardless of -o.
  "$@" || exit $?

  # Remove the call to Libtool.
  if test "$libtool" = yes; then
    while test "X$1" != 'X--mode=compile'; do
      shift
    done
    shift
  fi

  # Remove '-o $object'.
  IFS=" "
  for arg
  do
    case $arg in
    -o)
      shift
      ;;
    $object)
      shift
      ;;
    *)
      set fnord "$@" "$arg"
      shift # fnord
      shift # $arg
      ;;
    esac
  done

  test -z "$dashmflag" && dashmflag=-M
  # Require at least two characters before searching for ':'
  # in the target name.  This is to cope with DOS-style filenames:
  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
  "$@" $dashmflag |
    sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
  rm -f "$depfile"
  cat < "$tmpdepfile" > "$depfile"
  # Some versions of the HPUX 10.20 sed can't process this sed invocation
  # correctly.  Breaking it into two sed invocations is a workaround.
  tr ' ' "$nl" < "$tmpdepfile" \
    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
    | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

dashXmstdout)
  # This case only exists to satisfy depend.m4.  It is never actually
  # run, as this mode is specially recognized in the preamble.
  exit 1
  ;;

makedepend)
  "$@" || exit $?
  # Remove any Libtool call
  if test "$libtool" = yes; then
    while test "X$1" != 'X--mode=compile'; do
      shift
    done
    shift
  fi
  # X makedepend
  shift
  cleared=no eat=no
  for arg
  do
    case $cleared in
    no)
      set ""; shift
      cleared=yes ;;
    esac
    if test $eat = yes; then
      eat=no
      continue
    fi
    case "$arg" in
    -D*|-I*)
      set fnord "$@" "$arg"; shift ;;
    # Strip any option that makedepend may not understand.  Remove
    # the object too, otherwise makedepend will parse it as a source file.
    -arch)
      eat=yes ;;
    -*|$object)
      ;;
    *)
      set fnord "$@" "$arg"; shift ;;
    esac
  done
  obj_suffix=`echo "$object" | sed 's/^.*\././'`
  touch "$tmpdepfile"
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
  rm -f "$depfile"
  # makedepend may prepend the VPATH from the source file name to the object.
  # No need to regex-escape $object, excess matching of '.' is harmless.
  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
  # Some versions of the HPUX 10.20 sed can't process the last invocation
  # correctly.  Breaking it into two sed invocations is a workaround.
  sed '1,2d' "$tmpdepfile" \
    | tr ' ' "$nl" \
    | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
    | sed -e 's/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile" "$tmpdepfile".bak
  ;;

cpp)
  # Important note: in order to support this mode, a compiler *must*
  # always write the preprocessed file to stdout.
  "$@" || exit $?

  # Remove the call to Libtool.
  if test "$libtool" = yes; then
    while test "X$1" != 'X--mode=compile'; do
      shift
    done
    shift
  fi

  # Remove '-o $object'.
  IFS=" "
  for arg
  do
    case $arg in
    -o)
      shift
      ;;
    $object)
      shift
      ;;
    *)
      set fnord "$@" "$arg"
      shift # fnord
      shift # $arg
      ;;
    esac
  done

  "$@" -E \
    | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
             -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
    | sed '$ s: \\$::' > "$tmpdepfile"
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  cat < "$tmpdepfile" >> "$depfile"
  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

msvisualcpp)
  # Important note: in order to support this mode, a compiler *must*
  # always write the preprocessed file to stdout.
  "$@" || exit $?

  # Remove the call to Libtool.
  if test "$libtool" = yes; then
    while test "X$1" != 'X--mode=compile'; do
      shift
    done
    shift
  fi

  IFS=" "
  for arg
  do
    case "$arg" in
    -o)
      shift
      ;;
    $object)
      shift
      ;;
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
        set fnord "$@"
        shift
        shift
        ;;
    *)
        set fnord "$@" "$arg"
        shift
        shift
        ;;
    esac
  done
  "$@" -E 2>/dev/null |
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
  rm -f "$depfile"
  echo "$object : \\" > "$depfile"
  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
  echo "$tab" >> "$depfile"
  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
  rm -f "$tmpdepfile"
  ;;

msvcmsys)
  # This case exists only to let depend.m4 do its work.  It works by
  # looking at the text of this script.  This case will never be run,
  # since it is checked for above.
  exit 1
  ;;

none)
  exec "$@"
  ;;

*)
  echo "Unknown depmode $depmode" 1>&2
  exit 1
  ;;
esac

exit 0

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
config.sub000075500000107070150523165460006543 0ustar00#! /bin/sh
# Configuration validation subroutine script.
#   Copyright 1992-2018 Free Software Foundation, Inc.

timestamp='2018-05-05'

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, 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, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program.  This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").


# Please send patches to <config-patches@gnu.org>.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.

# You can get the latest version of this script from:
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub

# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support.  The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.

# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.

me=`echo "$0" | sed -e 's,.*/,,'`

usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS

Canonicalize a configuration name.

Options:
  -h, --help         print this help, then exit
  -t, --time-stamp   print date of last modification, then exit
  -v, --version      print version number, then exit

Report bugs and patches to <config-patches@gnu.org>."

version="\
GNU config.sub ($timestamp)

Copyright 1992-2018 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."

help="
Try \`$me --help' for more information."

# Parse command line
while test $# -gt 0 ; do
  case $1 in
    --time-stamp | --time* | -t )
       echo "$timestamp" ; exit ;;
    --version | -v )
       echo "$version" ; exit ;;
    --help | --h* | -h )
       echo "$usage"; exit ;;
    -- )     # Stop option processing
       shift; break ;;
    - )	# Use stdin as input.
       break ;;
    -* )
       echo "$me: invalid option $1$help"
       exit 1 ;;

    *local*)
       # First pass through any local machine types.
       echo "$1"
       exit ;;

    * )
       break ;;
  esac
done

case $# in
 0) echo "$me: missing argument$help" >&2
    exit 1;;
 1) ;;
 *) echo "$me: too many arguments$help" >&2
    exit 1;;
esac

# Spilt fields of configuration type
IFS="-" read -r field1 field2 field3 field4 <<EOF
$1
EOF

# Separate into logical components for further validation
case $1 in
	*-*-*-*)
		basic_machine=$field1-$field2
		os=-$field3-$field4
		;;
	*-*-*)
		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
		# parts
		maybe_os=$field2-$field3
		case $maybe_os in
			nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
			| linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
			| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
			| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
			| storm-chaos* | os2-emx* | rtmk-nova*)
				basic_machine=$field1
				os=-$maybe_os
				;;
			android-linux)
				basic_machine=$field1-unknown
				os=-linux-android
				;;
			*)
				basic_machine=$field1-$field2
				os=-$field3
				;;
		esac
		;;
	*-*)
		basic_machine=$field1
		os=-$field2
		;;
	*)
		basic_machine=$1
		os=
		;;
esac

### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work.  We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
	-sun*os*)
		# Prevent following clause from handling this invalid input.
		;;
	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
	-apple | -axis | -knuth | -cray | -microblaze*)
		os=
		basic_machine=$1
		;;
	-bluegene*)
		os=-cnk
		;;
	-sim | -cisco | -oki | -wec | -winbond)
		os=
		basic_machine=$1
		;;
	-scout)
		;;
	-wrs)
		os=-vxworks
		basic_machine=$1
		;;
	-chorusos*)
		os=-chorusos
		basic_machine=$1
		;;
	-chorusrdb)
		os=-chorusrdb
		basic_machine=$1
		;;
	-hiux*)
		os=-hiuxwe2
		;;
	-sco6)
		os=-sco5v6
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-sco5)
		os=-sco3.2v5
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-sco4)
		os=-sco3.2v4
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-sco3.2.[4-9]*)
		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-sco3.2v[4-9]*)
		# Don't forget version if it is 3.2v4 or newer.
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-sco5v6*)
		# Don't forget version if it is 3.2v4 or newer.
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-sco*)
		os=-sco3.2v2
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-udk*)
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-isc)
		os=-isc2.2
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-clix*)
		basic_machine=clipper-intergraph
		;;
	-isc*)
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
		;;
	-lynx*178)
		os=-lynxos178
		;;
	-lynx*5)
		os=-lynxos5
		;;
	-lynx*)
		os=-lynxos
		;;
	-ptx*)
		basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
		;;
	-psos*)
		os=-psos
		;;
	-mint | -mint[0-9]*)
		basic_machine=m68k-atari
		os=-mint
		;;
esac

# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
	# Recognize the basic CPU types without company name.
	# Some are omitted here because they have special meanings below.
	1750a | 580 \
	| a29k \
	| aarch64 | aarch64_be \
	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
	| am33_2.0 \
	| arc | arceb \
	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv6m | armv[78][arm] \
	| avr | avr32 \
	| ba \
	| be32 | be64 \
	| bfin \
	| c4x | c8051 | clipper | csky \
	| d10v | d30v | dlx | dsp16xx \
	| e2k | epiphany \
	| fido | fr30 | frv | ft32 \
	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
	| hexagon \
	| i370 | i860 | i960 | ia16 | ia64 \
	| ip2k | iq2000 \
	| k1om \
	| le32 | le64 \
	| lm32 \
	| m32c | m32r | m32rle | m68000 | m68k | m88k \
	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
	| mips | mipsbe | mipseb | mipsel | mipsle \
	| mips16 \
	| mips64 | mips64el \
	| mips64octeon | mips64octeonel \
	| mips64orion | mips64orionel \
	| mips64r5900 | mips64r5900el \
	| mips64vr | mips64vrel \
	| mips64vr4100 | mips64vr4100el \
	| mips64vr4300 | mips64vr4300el \
	| mips64vr5000 | mips64vr5000el \
	| mips64vr5900 | mips64vr5900el \
	| mipsisa32 | mipsisa32el \
	| mipsisa32r2 | mipsisa32r2el \
	| mipsisa32r6 | mipsisa32r6el \
	| mipsisa64 | mipsisa64el \
	| mipsisa64r2 | mipsisa64r2el \
	| mipsisa64r6 | mipsisa64r6el \
	| mipsisa64sb1 | mipsisa64sb1el \
	| mipsisa64sr71k | mipsisa64sr71kel \
	| mipsr5900 | mipsr5900el \
	| mipstx39 | mipstx39el \
	| mn10200 | mn10300 \
	| moxie \
	| mt \
	| msp430 \
	| nds32 | nds32le | nds32be \
	| nfp \
	| nios | nios2 | nios2eb | nios2el \
	| ns16k | ns32k \
	| open8 | or1k | or1knd | or32 \
	| pdp10 | pj | pjl \
	| powerpc | powerpc64 | powerpc64le | powerpcle \
	| pru \
	| pyramid \
	| riscv32 | riscv64 \
	| rl78 | rx \
	| score \
	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
	| sh64 | sh64le \
	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
	| spu \
	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
	| ubicom32 \
	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
	| visium \
	| wasm32 \
	| x86 | xc16x | xstormy16 | xtensa \
	| z8k | z80)
		basic_machine=$basic_machine-unknown
		;;
	c54x)
		basic_machine=tic54x-unknown
		;;
	c55x)
		basic_machine=tic55x-unknown
		;;
	c6x)
		basic_machine=tic6x-unknown
		;;
	leon|leon[3-9])
		basic_machine=sparc-$basic_machine
		;;
	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
		basic_machine=$basic_machine-unknown
		os=-none
		;;
	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
		;;
	m9s12z | m68hcs12z | hcs12z | s12z)
		basic_machine=s12z-unknown
		os=-none
		;;
	ms1)
		basic_machine=mt-unknown
		;;

	strongarm | thumb | xscale)
		basic_machine=arm-unknown
		;;
	xgate)
		basic_machine=$basic_machine-unknown
		os=-none
		;;
	xscaleeb)
		basic_machine=armeb-unknown
		;;

	xscaleel)
		basic_machine=armel-unknown
		;;

	# We use `pc' rather than `unknown'
	# because (1) that's what they normally are, and
	# (2) the word "unknown" tends to confuse beginning users.
	i*86 | x86_64)
	  basic_machine=$basic_machine-pc
	  ;;
	# Object if more than one company name word.
	*-*-*)
		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
		exit 1
		;;
	# Recognize the basic CPU types with company name.
	580-* \
	| a29k-* \
	| aarch64-* | aarch64_be-* \
	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
	| avr-* | avr32-* \
	| ba-* \
	| be32-* | be64-* \
	| bfin-* | bs2000-* \
	| c[123]* | c30-* | [cjt]90-* | c4x-* \
	| c8051-* | clipper-* | craynv-* | csky-* | cydra-* \
	| d10v-* | d30v-* | dlx-* \
	| e2k-* | elxsi-* \
	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
	| h8300-* | h8500-* \
	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
	| hexagon-* \
	| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
	| ip2k-* | iq2000-* \
	| k1om-* \
	| le32-* | le64-* \
	| lm32-* \
	| m32c-* | m32r-* | m32rle-* \
	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
	| microblaze-* | microblazeel-* \
	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
	| mips16-* \
	| mips64-* | mips64el-* \
	| mips64octeon-* | mips64octeonel-* \
	| mips64orion-* | mips64orionel-* \
	| mips64r5900-* | mips64r5900el-* \
	| mips64vr-* | mips64vrel-* \
	| mips64vr4100-* | mips64vr4100el-* \
	| mips64vr4300-* | mips64vr4300el-* \
	| mips64vr5000-* | mips64vr5000el-* \
	| mips64vr5900-* | mips64vr5900el-* \
	| mipsisa32-* | mipsisa32el-* \
	| mipsisa32r2-* | mipsisa32r2el-* \
	| mipsisa32r6-* | mipsisa32r6el-* \
	| mipsisa64-* | mipsisa64el-* \
	| mipsisa64r2-* | mipsisa64r2el-* \
	| mipsisa64r6-* | mipsisa64r6el-* \
	| mipsisa64sb1-* | mipsisa64sb1el-* \
	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
	| mipsr5900-* | mipsr5900el-* \
	| mipstx39-* | mipstx39el-* \
	| mmix-* \
	| mt-* \
	| msp430-* \
	| nds32-* | nds32le-* | nds32be-* \
	| nfp-* \
	| nios-* | nios2-* | nios2eb-* | nios2el-* \
	| none-* | np1-* | ns16k-* | ns32k-* \
	| open8-* \
	| or1k*-* \
	| orion-* \
	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
	| pru-* \
	| pyramid-* \
	| riscv32-* | riscv64-* \
	| rl78-* | romp-* | rs6000-* | rx-* \
	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
	| sparclite-* \
	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
	| tahoe-* \
	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
	| tile*-* \
	| tron-* \
	| ubicom32-* \
	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
	| vax-* \
	| visium-* \
	| wasm32-* \
	| we32k-* \
	| x86-* | x86_64-* | xc16x-* | xps100-* \
	| xstormy16-* | xtensa*-* \
	| ymp-* \
	| z8k-* | z80-*)
		;;
	# Recognize the basic CPU types without company name, with glob match.
	xtensa*)
		basic_machine=$basic_machine-unknown
		;;
	# Recognize the various machine names and aliases which stand
	# for a CPU type and a company and sometimes even an OS.
	386bsd)
		basic_machine=i386-pc
		os=-bsd
		;;
	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
		basic_machine=m68000-att
		;;
	3b*)
		basic_machine=we32k-att
		;;
	a29khif)
		basic_machine=a29k-amd
		os=-udi
		;;
	abacus)
		basic_machine=abacus-unknown
		;;
	adobe68k)
		basic_machine=m68010-adobe
		os=-scout
		;;
	alliant | fx80)
		basic_machine=fx80-alliant
		;;
	altos | altos3068)
		basic_machine=m68k-altos
		;;
	am29k)
		basic_machine=a29k-none
		os=-bsd
		;;
	amd64)
		basic_machine=x86_64-pc
		;;
	amd64-*)
		basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	amdahl)
		basic_machine=580-amdahl
		os=-sysv
		;;
	amiga | amiga-*)
		basic_machine=m68k-unknown
		;;
	amigaos | amigados)
		basic_machine=m68k-unknown
		os=-amigaos
		;;
	amigaunix | amix)
		basic_machine=m68k-unknown
		os=-sysv4
		;;
	apollo68)
		basic_machine=m68k-apollo
		os=-sysv
		;;
	apollo68bsd)
		basic_machine=m68k-apollo
		os=-bsd
		;;
	aros)
		basic_machine=i386-pc
		os=-aros
		;;
	asmjs)
		basic_machine=asmjs-unknown
		;;
	aux)
		basic_machine=m68k-apple
		os=-aux
		;;
	balance)
		basic_machine=ns32k-sequent
		os=-dynix
		;;
	blackfin)
		basic_machine=bfin-unknown
		os=-linux
		;;
	blackfin-*)
		basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		os=-linux
		;;
	bluegene*)
		basic_machine=powerpc-ibm
		os=-cnk
		;;
	c54x-*)
		basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	c55x-*)
		basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	c6x-*)
		basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	c90)
		basic_machine=c90-cray
		os=-unicos
		;;
	cegcc)
		basic_machine=arm-unknown
		os=-cegcc
		;;
	convex-c1)
		basic_machine=c1-convex
		os=-bsd
		;;
	convex-c2)
		basic_machine=c2-convex
		os=-bsd
		;;
	convex-c32)
		basic_machine=c32-convex
		os=-bsd
		;;
	convex-c34)
		basic_machine=c34-convex
		os=-bsd
		;;
	convex-c38)
		basic_machine=c38-convex
		os=-bsd
		;;
	cray | j90)
		basic_machine=j90-cray
		os=-unicos
		;;
	craynv)
		basic_machine=craynv-cray
		os=-unicosmp
		;;
	cr16 | cr16-*)
		basic_machine=cr16-unknown
		os=-elf
		;;
	crds | unos)
		basic_machine=m68k-crds
		;;
	crisv32 | crisv32-* | etraxfs*)
		basic_machine=crisv32-axis
		;;
	cris | cris-* | etrax*)
		basic_machine=cris-axis
		;;
	crx)
		basic_machine=crx-unknown
		os=-elf
		;;
	da30 | da30-*)
		basic_machine=m68k-da30
		;;
	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
		basic_machine=mips-dec
		;;
	decsystem10* | dec10*)
		basic_machine=pdp10-dec
		os=-tops10
		;;
	decsystem20* | dec20*)
		basic_machine=pdp10-dec
		os=-tops20
		;;
	delta | 3300 | motorola-3300 | motorola-delta \
	      | 3300-motorola | delta-motorola)
		basic_machine=m68k-motorola
		;;
	delta88)
		basic_machine=m88k-motorola
		os=-sysv3
		;;
	dicos)
		basic_machine=i686-pc
		os=-dicos
		;;
	djgpp)
		basic_machine=i586-pc
		os=-msdosdjgpp
		;;
	dpx20 | dpx20-*)
		basic_machine=rs6000-bull
		os=-bosx
		;;
	dpx2*)
		basic_machine=m68k-bull
		os=-sysv3
		;;
	e500v[12])
		basic_machine=powerpc-unknown
		os=$os"spe"
		;;
	e500v[12]-*)
		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		os=$os"spe"
		;;
	ebmon29k)
		basic_machine=a29k-amd
		os=-ebmon
		;;
	elxsi)
		basic_machine=elxsi-elxsi
		os=-bsd
		;;
	encore | umax | mmax)
		basic_machine=ns32k-encore
		;;
	es1800 | OSE68k | ose68k | ose | OSE)
		basic_machine=m68k-ericsson
		os=-ose
		;;
	fx2800)
		basic_machine=i860-alliant
		;;
	genix)
		basic_machine=ns32k-ns
		;;
	gmicro)
		basic_machine=tron-gmicro
		os=-sysv
		;;
	go32)
		basic_machine=i386-pc
		os=-go32
		;;
	h3050r* | hiux*)
		basic_machine=hppa1.1-hitachi
		os=-hiuxwe2
		;;
	h8300hms)
		basic_machine=h8300-hitachi
		os=-hms
		;;
	h8300xray)
		basic_machine=h8300-hitachi
		os=-xray
		;;
	h8500hms)
		basic_machine=h8500-hitachi
		os=-hms
		;;
	harris)
		basic_machine=m88k-harris
		os=-sysv3
		;;
	hp300-*)
		basic_machine=m68k-hp
		;;
	hp300bsd)
		basic_machine=m68k-hp
		os=-bsd
		;;
	hp300hpux)
		basic_machine=m68k-hp
		os=-hpux
		;;
	hp3k9[0-9][0-9] | hp9[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hp9k2[0-9][0-9] | hp9k31[0-9])
		basic_machine=m68000-hp
		;;
	hp9k3[2-9][0-9])
		basic_machine=m68k-hp
		;;
	hp9k6[0-9][0-9] | hp6[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hp9k7[0-79][0-9] | hp7[0-79][0-9])
		basic_machine=hppa1.1-hp
		;;
	hp9k78[0-9] | hp78[0-9])
		# FIXME: really hppa2.0-hp
		basic_machine=hppa1.1-hp
		;;
	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
		# FIXME: really hppa2.0-hp
		basic_machine=hppa1.1-hp
		;;
	hp9k8[0-9][13679] | hp8[0-9][13679])
		basic_machine=hppa1.1-hp
		;;
	hp9k8[0-9][0-9] | hp8[0-9][0-9])
		basic_machine=hppa1.0-hp
		;;
	hppaosf)
		basic_machine=hppa1.1-hp
		os=-osf
		;;
	hppro)
		basic_machine=hppa1.1-hp
		os=-proelf
		;;
	i370-ibm* | ibm*)
		basic_machine=i370-ibm
		;;
	i*86v32)
		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
		os=-sysv32
		;;
	i*86v4*)
		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
		os=-sysv4
		;;
	i*86v)
		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
		os=-sysv
		;;
	i*86sol2)
		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
		os=-solaris2
		;;
	i386mach)
		basic_machine=i386-mach
		os=-mach
		;;
	vsta)
		basic_machine=i386-unknown
		os=-vsta
		;;
	iris | iris4d)
		basic_machine=mips-sgi
		case $os in
		    -irix*)
			;;
		    *)
			os=-irix4
			;;
		esac
		;;
	isi68 | isi)
		basic_machine=m68k-isi
		os=-sysv
		;;
	leon-*|leon[3-9]-*)
		basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
		;;
	m68knommu)
		basic_machine=m68k-unknown
		os=-linux
		;;
	m68knommu-*)
		basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		os=-linux
		;;
	magnum | m3230)
		basic_machine=mips-mips
		os=-sysv
		;;
	merlin)
		basic_machine=ns32k-utek
		os=-sysv
		;;
	microblaze*)
		basic_machine=microblaze-xilinx
		;;
	mingw64)
		basic_machine=x86_64-pc
		os=-mingw64
		;;
	mingw32)
		basic_machine=i686-pc
		os=-mingw32
		;;
	mingw32ce)
		basic_machine=arm-unknown
		os=-mingw32ce
		;;
	miniframe)
		basic_machine=m68000-convergent
		;;
	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
		basic_machine=m68k-atari
		os=-mint
		;;
	mips3*-*)
		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
		;;
	mips3*)
		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
		;;
	monitor)
		basic_machine=m68k-rom68k
		os=-coff
		;;
	morphos)
		basic_machine=powerpc-unknown
		os=-morphos
		;;
	moxiebox)
		basic_machine=moxie-unknown
		os=-moxiebox
		;;
	msdos)
		basic_machine=i386-pc
		os=-msdos
		;;
	ms1-*)
		basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
		;;
	msys)
		basic_machine=i686-pc
		os=-msys
		;;
	mvs)
		basic_machine=i370-ibm
		os=-mvs
		;;
	nacl)
		basic_machine=le32-unknown
		os=-nacl
		;;
	ncr3000)
		basic_machine=i486-ncr
		os=-sysv4
		;;
	netbsd386)
		basic_machine=i386-unknown
		os=-netbsd
		;;
	netwinder)
		basic_machine=armv4l-rebel
		os=-linux
		;;
	news | news700 | news800 | news900)
		basic_machine=m68k-sony
		os=-newsos
		;;
	news1000)
		basic_machine=m68030-sony
		os=-newsos
		;;
	news-3600 | risc-news)
		basic_machine=mips-sony
		os=-newsos
		;;
	necv70)
		basic_machine=v70-nec
		os=-sysv
		;;
	next | m*-next)
		basic_machine=m68k-next
		case $os in
		    -nextstep* )
			;;
		    -ns2*)
		      os=-nextstep2
			;;
		    *)
		      os=-nextstep3
			;;
		esac
		;;
	nh3000)
		basic_machine=m68k-harris
		os=-cxux
		;;
	nh[45]000)
		basic_machine=m88k-harris
		os=-cxux
		;;
	nindy960)
		basic_machine=i960-intel
		os=-nindy
		;;
	mon960)
		basic_machine=i960-intel
		os=-mon960
		;;
	nonstopux)
		basic_machine=mips-compaq
		os=-nonstopux
		;;
	np1)
		basic_machine=np1-gould
		;;
	neo-tandem)
		basic_machine=neo-tandem
		;;
	nse-tandem)
		basic_machine=nse-tandem
		;;
	nsr-tandem)
		basic_machine=nsr-tandem
		;;
	nsv-tandem)
		basic_machine=nsv-tandem
		;;
	nsx-tandem)
		basic_machine=nsx-tandem
		;;
	op50n-* | op60c-*)
		basic_machine=hppa1.1-oki
		os=-proelf
		;;
	openrisc | openrisc-*)
		basic_machine=or32-unknown
		;;
	os400)
		basic_machine=powerpc-ibm
		os=-os400
		;;
	OSE68000 | ose68000)
		basic_machine=m68000-ericsson
		os=-ose
		;;
	os68k)
		basic_machine=m68k-none
		os=-os68k
		;;
	pa-hitachi)
		basic_machine=hppa1.1-hitachi
		os=-hiuxwe2
		;;
	paragon)
		basic_machine=i860-intel
		os=-osf
		;;
	parisc)
		basic_machine=hppa-unknown
		os=-linux
		;;
	parisc-*)
		basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		os=-linux
		;;
	pbd)
		basic_machine=sparc-tti
		;;
	pbb)
		basic_machine=m68k-tti
		;;
	pc532 | pc532-*)
		basic_machine=ns32k-pc532
		;;
	pc98)
		basic_machine=i386-pc
		;;
	pc98-*)
		basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	pentium | p5 | k5 | k6 | nexgen | viac3)
		basic_machine=i586-pc
		;;
	pentiumpro | p6 | 6x86 | athlon | athlon_*)
		basic_machine=i686-pc
		;;
	pentiumii | pentium2 | pentiumiii | pentium3)
		basic_machine=i686-pc
		;;
	pentium4)
		basic_machine=i786-pc
		;;
	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
		basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	pentiumpro-* | p6-* | 6x86-* | athlon-*)
		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	pentium4-*)
		basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	pn)
		basic_machine=pn-gould
		;;
	power)	basic_machine=power-ibm
		;;
	ppc | ppcbe)	basic_machine=powerpc-unknown
		;;
	ppc-* | ppcbe-*)
		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	ppcle | powerpclittle)
		basic_machine=powerpcle-unknown
		;;
	ppcle-* | powerpclittle-*)
		basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	ppc64)	basic_machine=powerpc64-unknown
		;;
	ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	ppc64le | powerpc64little)
		basic_machine=powerpc64le-unknown
		;;
	ppc64le-* | powerpc64little-*)
		basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	ps2)
		basic_machine=i386-ibm
		;;
	pw32)
		basic_machine=i586-unknown
		os=-pw32
		;;
	rdos | rdos64)
		basic_machine=x86_64-pc
		os=-rdos
		;;
	rdos32)
		basic_machine=i386-pc
		os=-rdos
		;;
	rom68k)
		basic_machine=m68k-rom68k
		os=-coff
		;;
	rm[46]00)
		basic_machine=mips-siemens
		;;
	rtpc | rtpc-*)
		basic_machine=romp-ibm
		;;
	s390 | s390-*)
		basic_machine=s390-ibm
		;;
	s390x | s390x-*)
		basic_machine=s390x-ibm
		;;
	sa29200)
		basic_machine=a29k-amd
		os=-udi
		;;
	sb1)
		basic_machine=mipsisa64sb1-unknown
		;;
	sb1el)
		basic_machine=mipsisa64sb1el-unknown
		;;
	sde)
		basic_machine=mipsisa32-sde
		os=-elf
		;;
	sei)
		basic_machine=mips-sei
		os=-seiux
		;;
	sequent)
		basic_machine=i386-sequent
		;;
	sh5el)
		basic_machine=sh5le-unknown
		;;
	simso-wrs)
		basic_machine=sparclite-wrs
		os=-vxworks
		;;
	sps7)
		basic_machine=m68k-bull
		os=-sysv2
		;;
	spur)
		basic_machine=spur-unknown
		;;
	st2000)
		basic_machine=m68k-tandem
		;;
	stratus)
		basic_machine=i860-stratus
		os=-sysv4
		;;
	strongarm-* | thumb-*)
		basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
		;;
	sun2)
		basic_machine=m68000-sun
		;;
	sun2os3)
		basic_machine=m68000-sun
		os=-sunos3
		;;
	sun2os4)
		basic_machine=m68000-sun
		os=-sunos4
		;;
	sun3os3)
		basic_machine=m68k-sun
		os=-sunos3
		;;
	sun3os4)
		basic_machine=m68k-sun
		os=-sunos4
		;;
	sun4os3)
		basic_machine=sparc-sun
		os=-sunos3
		;;
	sun4os4)
		basic_machine=sparc-sun
		os=-sunos4
		;;
	sun4sol2)
		basic_machine=sparc-sun
		os=-solaris2
		;;
	sun3 | sun3-*)
		basic_machine=m68k-sun
		;;
	sun4)
		basic_machine=sparc-sun
		;;
	sun386 | sun386i | roadrunner)
		basic_machine=i386-sun
		;;
	sv1)
		basic_machine=sv1-cray
		os=-unicos
		;;
	symmetry)
		basic_machine=i386-sequent
		os=-dynix
		;;
	t3e)
		basic_machine=alphaev5-cray
		os=-unicos
		;;
	t90)
		basic_machine=t90-cray
		os=-unicos
		;;
	tile*)
		basic_machine=$basic_machine-unknown
		os=-linux-gnu
		;;
	tx39)
		basic_machine=mipstx39-unknown
		;;
	tx39el)
		basic_machine=mipstx39el-unknown
		;;
	toad1)
		basic_machine=pdp10-xkl
		os=-tops20
		;;
	tower | tower-32)
		basic_machine=m68k-ncr
		;;
	tpf)
		basic_machine=s390x-ibm
		os=-tpf
		;;
	udi29k)
		basic_machine=a29k-amd
		os=-udi
		;;
	ultra3)
		basic_machine=a29k-nyu
		os=-sym1
		;;
	v810 | necv810)
		basic_machine=v810-nec
		os=-none
		;;
	vaxv)
		basic_machine=vax-dec
		os=-sysv
		;;
	vms)
		basic_machine=vax-dec
		os=-vms
		;;
	vpp*|vx|vx-*)
		basic_machine=f301-fujitsu
		;;
	vxworks960)
		basic_machine=i960-wrs
		os=-vxworks
		;;
	vxworks68)
		basic_machine=m68k-wrs
		os=-vxworks
		;;
	vxworks29k)
		basic_machine=a29k-wrs
		os=-vxworks
		;;
	w65*)
		basic_machine=w65-wdc
		os=-none
		;;
	w89k-*)
		basic_machine=hppa1.1-winbond
		os=-proelf
		;;
	x64)
		basic_machine=x86_64-pc
		;;
	xbox)
		basic_machine=i686-pc
		os=-mingw32
		;;
	xps | xps100)
		basic_machine=xps100-honeywell
		;;
	xscale-* | xscalee[bl]-*)
		basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
		;;
	ymp)
		basic_machine=ymp-cray
		os=-unicos
		;;
	none)
		basic_machine=none-none
		os=-none
		;;

# Here we handle the default manufacturer of certain CPU types.  It is in
# some cases the only manufacturer, in others, it is the most popular.
	w89k)
		basic_machine=hppa1.1-winbond
		;;
	op50n)
		basic_machine=hppa1.1-oki
		;;
	op60c)
		basic_machine=hppa1.1-oki
		;;
	romp)
		basic_machine=romp-ibm
		;;
	mmix)
		basic_machine=mmix-knuth
		;;
	rs6000)
		basic_machine=rs6000-ibm
		;;
	vax)
		basic_machine=vax-dec
		;;
	pdp11)
		basic_machine=pdp11-dec
		;;
	we32k)
		basic_machine=we32k-att
		;;
	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
		basic_machine=sh-unknown
		;;
	cydra)
		basic_machine=cydra-cydrome
		;;
	orion)
		basic_machine=orion-highlevel
		;;
	orion105)
		basic_machine=clipper-highlevel
		;;
	mac | mpw | mac-mpw)
		basic_machine=m68k-apple
		;;
	pmac | pmac-mpw)
		basic_machine=powerpc-apple
		;;
	*-unknown)
		# Make sure to match an already-canonicalized machine name.
		;;
	*)
		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
		exit 1
		;;
esac

# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
	*-digital*)
		basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
		;;
	*-commodore*)
		basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
		;;
	*)
		;;
esac

# Decode manufacturer-specific aliases for certain operating systems.

if [ x$os != x ]
then
case $os in
	# First match some system type aliases that might get confused
	# with valid system types.
	# -solaris* is a basic system type, with this one exception.
	-auroraux)
		os=-auroraux
		;;
	-solaris1 | -solaris1.*)
		os=`echo $os | sed -e 's|solaris1|sunos4|'`
		;;
	-solaris)
		os=-solaris2
		;;
	-unixware*)
		os=-sysv4.2uw
		;;
	-gnu/linux*)
		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
		;;
	# es1800 is here to avoid being matched by es* (a different OS)
	-es1800*)
		os=-ose
		;;
	# Now accept the basic system types.
	# The portable systems comes first.
	# Each alternative MUST end in a * to match a version number.
	# -sysv* is not here because it comes later, after sysvr4.
	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
	      | -sym* | -kopensolaris* | -plan9* \
	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
	      | -aos* | -aros* | -cloudabi* | -sortix* \
	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
	      | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \
	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
	      | -morphos* | -superux* | -rtmk* | -windiss* \
	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
	      | -midnightbsd*)
	# Remember, each alternative MUST END IN *, to match a version number.
		;;
	-qnx*)
		case $basic_machine in
		    x86-* | i*86-*)
			;;
		    *)
			os=-nto$os
			;;
		esac
		;;
	-nto-qnx*)
		;;
	-nto*)
		os=`echo $os | sed -e 's|nto|nto-qnx|'`
		;;
	-sim | -xray | -os68k* | -v88r* \
	      | -windows* | -osx | -abug | -netware* | -os9* \
	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
		;;
	-mac*)
		os=`echo "$os" | sed -e 's|mac|macos|'`
		;;
	-linux-dietlibc)
		os=-linux-dietlibc
		;;
	-linux*)
		os=`echo $os | sed -e 's|linux|linux-gnu|'`
		;;
	-sunos5*)
		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
		;;
	-sunos6*)
		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
		;;
	-opened*)
		os=-openedition
		;;
	-os400*)
		os=-os400
		;;
	-wince*)
		os=-wince
		;;
	-utek*)
		os=-bsd
		;;
	-dynix*)
		os=-bsd
		;;
	-acis*)
		os=-aos
		;;
	-atheos*)
		os=-atheos
		;;
	-syllable*)
		os=-syllable
		;;
	-386bsd)
		os=-bsd
		;;
	-ctix* | -uts*)
		os=-sysv
		;;
	-nova*)
		os=-rtmk-nova
		;;
	-ns2)
		os=-nextstep2
		;;
	-nsk*)
		os=-nsk
		;;
	# Preserve the version number of sinix5.
	-sinix5.*)
		os=`echo $os | sed -e 's|sinix|sysv|'`
		;;
	-sinix*)
		os=-sysv4
		;;
	-tpf*)
		os=-tpf
		;;
	-triton*)
		os=-sysv3
		;;
	-oss*)
		os=-sysv3
		;;
	-svr4*)
		os=-sysv4
		;;
	-svr3)
		os=-sysv3
		;;
	-sysvr4)
		os=-sysv4
		;;
	# This must come after -sysvr4.
	-sysv*)
		;;
	-ose*)
		os=-ose
		;;
	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
		os=-mint
		;;
	-zvmoe)
		os=-zvmoe
		;;
	-dicos*)
		os=-dicos
		;;
	-pikeos*)
		# Until real need of OS specific support for
		# particular features comes up, bare metal
		# configurations are quite functional.
		case $basic_machine in
		    arm*)
			os=-eabi
			;;
		    *)
			os=-elf
			;;
		esac
		;;
	-nacl*)
		;;
	-ios)
		;;
	-none)
		;;
	-*-eabi)
		case $basic_machine in
		    arm*)
			;;
		esac
		;;
	*)
		# Get rid of the `-' at the beginning of $os.
		os=`echo $os | sed 's/[^-]*-//'`
		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
		exit 1
		;;
esac
else

# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.

# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system.  Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.

case $basic_machine in
	score-*)
		os=-elf
		;;
	spu-*)
		os=-elf
		;;
	*-acorn)
		os=-riscix1.2
		;;
	arm*-rebel)
		os=-linux
		;;
	arm*-semi)
		os=-aout
		;;
	c4x-* | tic4x-*)
		os=-coff
		;;
	c8051-*)
		os=-elf
		;;
	hexagon-*)
		os=-elf
		;;
	tic54x-*)
		os=-coff
		;;
	tic55x-*)
		os=-coff
		;;
	tic6x-*)
		os=-coff
		;;
	# This must come before the *-dec entry.
	pdp10-*)
		os=-tops20
		;;
	pdp11-*)
		os=-none
		;;
	*-dec | vax-*)
		os=-ultrix4.2
		;;
	m68*-apollo)
		os=-domain
		;;
	i386-sun)
		os=-sunos4.0.2
		;;
	m68000-sun)
		os=-sunos3
		;;
	m68*-cisco)
		os=-aout
		;;
	mep-*)
		os=-elf
		;;
	mips*-cisco)
		os=-elf
		;;
	mips*-*)
		os=-elf
		;;
	or32-*)
		os=-coff
		;;
	*-tti)	# must be before sparc entry or we get the wrong os.
		os=-sysv3
		;;
	sparc-* | *-sun)
		os=-sunos4.1.1
		;;
	pru-*)
		os=-elf
		;;
	*-be)
		os=-beos
		;;
	*-ibm)
		os=-aix
		;;
	*-knuth)
		os=-mmixware
		;;
	*-wec)
		os=-proelf
		;;
	*-winbond)
		os=-proelf
		;;
	*-oki)
		os=-proelf
		;;
	*-hp)
		os=-hpux
		;;
	*-hitachi)
		os=-hiux
		;;
	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
		os=-sysv
		;;
	*-cbm)
		os=-amigaos
		;;
	*-dg)
		os=-dgux
		;;
	*-dolphin)
		os=-sysv3
		;;
	m68k-ccur)
		os=-rtu
		;;
	m88k-omron*)
		os=-luna
		;;
	*-next)
		os=-nextstep
		;;
	*-sequent)
		os=-ptx
		;;
	*-crds)
		os=-unos
		;;
	*-ns)
		os=-genix
		;;
	i370-*)
		os=-mvs
		;;
	*-gould)
		os=-sysv
		;;
	*-highlevel)
		os=-bsd
		;;
	*-encore)
		os=-bsd
		;;
	*-sgi)
		os=-irix
		;;
	*-siemens)
		os=-sysv4
		;;
	*-masscomp)
		os=-rtu
		;;
	f30[01]-fujitsu | f700-fujitsu)
		os=-uxpv
		;;
	*-rom68k)
		os=-coff
		;;
	*-*bug)
		os=-coff
		;;
	*-apple)
		os=-macos
		;;
	*-atari*)
		os=-mint
		;;
	*)
		os=-none
		;;
esac
fi

# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer.  We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
	*-unknown)
		case $os in
			-riscix*)
				vendor=acorn
				;;
			-sunos*)
				vendor=sun
				;;
			-cnk*|-aix*)
				vendor=ibm
				;;
			-beos*)
				vendor=be
				;;
			-hpux*)
				vendor=hp
				;;
			-mpeix*)
				vendor=hp
				;;
			-hiux*)
				vendor=hitachi
				;;
			-unos*)
				vendor=crds
				;;
			-dgux*)
				vendor=dg
				;;
			-luna*)
				vendor=omron
				;;
			-genix*)
				vendor=ns
				;;
			-mvs* | -opened*)
				vendor=ibm
				;;
			-os400*)
				vendor=ibm
				;;
			-ptx*)
				vendor=sequent
				;;
			-tpf*)
				vendor=ibm
				;;
			-vxsim* | -vxworks* | -windiss*)
				vendor=wrs
				;;
			-aux*)
				vendor=apple
				;;
			-hms*)
				vendor=hitachi
				;;
			-mpw* | -macos*)
				vendor=apple
				;;
			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
				vendor=atari
				;;
			-vos*)
				vendor=stratus
				;;
		esac
		basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
		;;
esac

echo "$basic_machine$os"
exit

# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
py-compile000075500000011100150523165460006550 0ustar00#!/bin/sh
# py-compile - Compile a Python program

scriptversion=2018-03-07.03; # UTC

# Copyright (C) 2000-2018 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, see <https://www.gnu.org/licenses/>.

# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.

# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.

if [ -z "$PYTHON" ]; then
  PYTHON=python
fi

me=py-compile

usage_error ()
{
  echo "$me: $*" >&2
  echo "Try '$me --help' for more information." >&2
  exit 1
}

basedir=
destdir=
while test $# -ne 0; do
  case "$1" in
    --basedir)
      if test $# -lt 2; then
        usage_error "option '--basedir' requires an argument"
      else
        basedir=$2
      fi
      shift
      ;;
    --destdir)
      if test $# -lt 2; then
        usage_error "option '--destdir' requires an argument"
      else
        destdir=$2
      fi
      shift
      ;;
    -h|--help)
      cat <<\EOF
Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."

Byte compile some python scripts FILES.  Use --destdir to specify any
leading directory path to the FILES that you don't want to include in the
byte compiled file.  Specify --basedir for any additional path information you
do want to be shown in the byte compiled file.

Example:
  py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py

Report bugs to <bug-automake@gnu.org>.
EOF
      exit $?
      ;;
    -v|--version)
      echo "$me $scriptversion"
      exit $?
      ;;
    --)
      shift
      break
      ;;
    -*)
      usage_error "unrecognized option '$1'"
      ;;
    *)
      break
      ;;
  esac
  shift
done

files=$*
if test -z "$files"; then
    usage_error "no files given"
fi

# if basedir was given, then it should be prepended to filenames before
# byte compilation.
if [ -z "$basedir" ]; then
    pathtrans="path = file"
else
    pathtrans="path = os.path.join('$basedir', file)"
fi

# if destdir was given, then it needs to be prepended to the filename to
# byte compile but not go into the compiled file.
if [ -z "$destdir" ]; then
    filetrans="filepath = path"
else
    filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)"
fi

$PYTHON -c "
import sys, os, py_compile, imp

files = '''$files'''

sys.stdout.write('Byte-compiling python modules...\n')
for file in files.split():
    $pathtrans
    $filetrans
    if not os.path.exists(filepath) or not (len(filepath) >= 3
                                            and filepath[-3:] == '.py'):
	    continue
    sys.stdout.write(file)
    sys.stdout.flush()
    if hasattr(imp, 'get_tag'):
        py_compile.compile(filepath, imp.cache_from_source(filepath), path)
    else:
        py_compile.compile(filepath, filepath + 'c', path)
sys.stdout.write('\n')" || exit $?

# this will fail for python < 1.5, but that doesn't matter ...
$PYTHON -O -c "
import sys, os, py_compile, imp

# pypy does not use .pyo optimization
if hasattr(sys, 'pypy_translation_info'):
    sys.exit(0)

files = '''$files'''
sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
for file in files.split():
    $pathtrans
    $filetrans
    if not os.path.exists(filepath) or not (len(filepath) >= 3
                                            and filepath[-3:] == '.py'):
	    continue
    sys.stdout.write(file)
    sys.stdout.flush()
    if hasattr(imp, 'get_tag'):
        py_compile.compile(filepath, imp.cache_from_source(filepath, False), path)
    else:
        py_compile.compile(filepath, filepath + 'o', path)
sys.stdout.write('\n')" 2>/dev/null || :

# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End: