[med-svn] [ffp] 02/04: New upstream version 3.19
Andreas Tille
tille at debian.org
Wed Dec 6 21:46:38 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository ffp.
commit 9aeea64c8c298ceca54d3f086662e142c6c2ca49
Author: Andreas Tille <tille at debian.org>
Date: Wed Dec 6 22:44:36 2017 +0100
New upstream version 3.19
---
AUTHORS | 2 +
COPYING | 6 +
INSTALL | 134 +
Makefile.am | 7 +
Makefile.in | 699 ++++
NEWS | 279 ++
README | 619 ++++
aclocal.m4 | 951 ++++++
config.h.in | 141 +
config/config.guess | 1463 +++++++++
config/config.sub | 1579 +++++++++
config/depcomp | 630 ++++
config/install-sh | 520 +++
config/missing | 376 +++
configure | 7079 ++++++++++++++++++++++++++++++++++++++++
configure.ac | 94 +
debian/changelog | 5 -
debian/compat | 1 -
debian/control | 25 -
debian/copyright | 20 -
debian/docs | 2 -
debian/links | 1 -
debian/rules | 11 -
debian/source/format | 1 -
debian/upstream/metadata | 12 -
debian/watch | 3 -
doc/Makefile.am | 49 +
doc/Makefile.in | 420 +++
doc/tutorial.in | 1415 ++++++++
examples/Figure_1a_consensus | 10 +
examples/Figure_1a_tree | 14 +
examples/Figure_1b_consensus | 9 +
examples/Figure_1b_tree | 15 +
examples/Makefile.am | 3 +
examples/Makefile.in | 378 +++
examples/README | 96 +
man/Makefile.am | 137 +
man/Makefile.in | 539 +++
man/ffpaa.1.in | 168 +
man/ffpboot.1.in | 101 +
man/ffpcol.1.in | 143 +
man/ffpcomplex.1.in | 129 +
man/ffpdf.1.in | 139 +
man/ffpfilt.1.in | 132 +
man/ffpjsd.1.in | 222 ++
man/ffpmerge.1.in | 77 +
man/ffpre.1.in | 113 +
man/ffpreprof.1.in | 82 +
man/ffprwn.1.in | 73 +
man/ffpry.1.in | 204 ++
man/ffpsubnam.1.in | 42 +
man/ffptree.1.in | 176 +
man/ffptxt.1.in | 88 +
man/ffpvocab.1.in | 53 +
man/ffpvprof.1.in | 93 +
scripts/Makefile.am | 60 +
scripts/Makefile.in | 440 +++
scripts/ffpdf.in | 244 ++
scripts/ffpgui.in | 824 +++++
scripts/ffpreprof.in | 224 ++
scripts/ffpsubnam.in | 167 +
scripts/ffpvprof.in | 238 ++
src/Makefile.am | 31 +
src/Makefile.in | 604 ++++
src/cdfmacros.h | 28 +
src/codon.h | 22 +
src/ffpaa.c | 349 ++
src/ffpboot.c | 288 ++
src/ffpcol.c | 285 ++
src/ffpcomplex.c | 368 +++
src/ffpfilt.c | 347 ++
src/ffpjsd.c | 1518 +++++++++
src/ffpmerge.c | 266 ++
src/ffpre.c | 267 ++
src/ffprwn.c | 260 ++
src/ffpry.c | 378 +++
src/ffpry.h | 24 +
src/ffptree.c | 1212 +++++++
src/ffptxt.c | 234 ++
src/ffpvocab.c | 189 ++
src/hash.c | 910 ++++++
src/hash.h | 236 ++
src/hashroll.c | 2049 ++++++++++++
src/hashroll.h | 260 ++
src/mask.c | 53 +
src/mask.h | 23 +
src/parse_features.c | 82 +
src/parse_features.h | 24 +
src/sighandle.c | 98 +
src/sighandle.h | 23 +
src/utils.c | 533 +++
src/utils.h | 240 ++
src/vstring.h | 27 +
tests/Makefile.am | 84 +
tests/Makefile.in | 505 +++
tests/ecoli | 50 +
tests/ecoli.2 | 30 +
tests/ecolitest.sh | 227 ++
tests/faalist.txt | 7 +
tests/ffpaa_test_basic.sh | 22 +
tests/ffpaa_test_d.sh | 20 +
tests/ffpaa_test_f.sh | 20 +
tests/ffpaa_test_m.sh | 15 +
tests/ffpaa_test_stdin.sh | 15 +
tests/ffpaa_test_w.sh | 12 +
tests/ffpboot_test_stdin.sh | 16 +
tests/ffpcol_test_stdin.sh | 15 +
tests/ffpcomplex_test_stdin.sh | 16 +
tests/ffpjsd_test.sh | 9 +
tests/ffpmerge_test.sh | 14 +
tests/ffpre_test.sh | 18 +
tests/ffpreprof_test_basic.sh | 9 +
tests/ffprwn_test.sh | 18 +
tests/ffprwn_test_stdin.sh | 15 +
tests/ffprwn_test_stdin2.sh | 15 +
tests/ffpry_test_basic.sh | 14 +
tests/ffpry_test_d.sh | 13 +
tests/ffpry_test_f.sh | 11 +
tests/ffpry_test_fidelity.sh | 9 +
tests/ffpry_test_fidelity2.sh | 9 +
tests/ffpry_test_l.sh | 14 +
tests/ffpry_test_m.sh | 14 +
tests/ffpry_test_r.sh | 13 +
tests/ffpry_test_stdin.sh | 20 +
tests/ffpry_test_w.sh | 11 +
tests/ffptxt_test.sh | 18 +
tests/ffpvocab_test.sh | 26 +
tests/ffpvprof_test_basic.sh | 26 +
tests/fnalist.txt | 4 +
tests/test1.faa | 3 +
tests/test1.fna | 3 +
tests/test2.faa | 3 +
tests/test2.fna | 4 +
tests/test3.faa | 3 +
tests/test3.fna | 2 +
tests/test4.faa | 4 +
tests/test4.fna | 2 +
tests/test5.fna | 2 +
138 files changed, 34504 insertions(+), 81 deletions(-)
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..ce2b207
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Gregory E. Sims
+gsims1997 at yahoo.com
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..02b7d34
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,6 @@
+Copies of this software may be made without modification provided those
+copies are in agreement with the license included in this distribution.
+The terms of the license describing this software distribution expressly
+prohibits commercial usage. For details see the file LICENSE included
+in this directory of the distribution. For commercial licensing terms,
+please contact the authors.
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..1ff1c04
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,134 @@
+FFP 3.18 - Feature Frequency Profile Phylogenetics Package
+Feb 20, 2012
+
+Author: Gregory E. Sims
+
+This is a collection of programs for implementing the FFP
+(Feature Frequency Profiles) method of phylogenetic comparison.
+
+
+The FFP utilities can be installed using the tradition syntax
+
+./configure
+
+
+By default the executables will be installed in /usr/bin.
+To change this location or if you are not the superuser
+(i.e. do not have root access), you can do this by specifying
+the install directory:
+
+./configure --prefix=/home/yourname/dir
+
+Make sure to add the /home/yourname/dir/bin to your PATH
+variable.
+
+To compile:
+
+make
+
+
+To check the installation:
+
+make check
+
+All tests should pass. If they do not please contact gesims at lbl.gov,
+and report which tests have failed with information about your
+system such as the operating system and CPU type.
+
+To install:
+
+make install
+
+
+
+To use the ffpgui interface you will need to have the perl/tk
+module installed. The most efficient way to do this on a linux
+machine is to use the perl CPAN shell.
+
+
+perl -MCPAN -e 'shell'
+cpan> install Tk
+
+
+Use --disable-gui to bypass installation of the ffpgui interface.
+The ffpgui system is still in beta form (i.e. experimental). It will
+not function properly in Cygwin IF you install the perl/Tk package
+automatically via the cygwin setup.exe. You must compile from source
+using 804.029 which can be checked out using svn (aka. subversion):
+
+svn checkout https://svn.perl.org/modules/Tk/trunk
+
+cd trunk
+
+perl Makefile.PL x # Don't forget the x!
+make
+make install
+
+Hopefully sometime soon 804.029 will be placed on CPAN, and replace
+804.027.
+
+You will also need to install the X11 X windows libraries for
+Cygwin via setup.exe. Before running ffpgui, You will need to
+start an x-windows session, via 'startxwin'.
+
+However any native linux X-windowing system will be able to use
+ffpgui without issue, provided you are using a system with X11
+enabled. If running on your local machine there should be no
+issue, but if running on a remote host then you will need to have
+your DISPLAY variable set (in your shell's rc file, for example
+.bashrc), and you should log in to the remote system with the -Y
+option (enable X11 forwarding).
+
+#Enable X11
+export DISPLAY=:0.0
+
+#Enable X11 forwarding
+ssh -Y user at remotehost.com
+
+To see examples of how to use the FFP programs see the README
+file, or the doc/tutorial.pdf file.
+
+There is a full collection of man files which are placed in
+your system's man directories upon install. If you have used
+the --prefix option you will need to update $MANDIR to specify
+the proper path for man to search for the manual files.
+
+In the doc/ subdirectory the manuals have been compiled into
+PDF form for quick reference. There is also a quick start tutorial
+located in the doc/ subdirectory. Upon install these are placed
+in /usr/local/shared/doc/ffp or PREFIX/shared/doc/ffp (if you have
+used --prefix during configuration).
+
+Finally there are some examples of trees used in publications
+supplied in the examples/ directory. Upon install these are
+placed in /usr/local/shared/examples/ffp or PREFIX/shared/doc/ffp.
+
+**** Common Error messages during compilation:
+
+troff: fatal error: can't find macro file s
+
+ You likely do not have a full install of the groff package.
+ To build the tutorial files using the Manuscript macro set,
+ you'll need to update your install of groff. We have seen
+ this error on the Ubuntu 11.10 system. You will need to install
+ groff. Try:
+
+ sudo apt-get install groff
+
+ which will give you access to full set of macros.
+
+Perl module Tk missing. Install using: perl -MCPAN -e 'install Tk'.
+Or use configure with '--disable-gui' to disable ffpgui build.
+
+ There are two solutions. Install the required perl module.
+ Or disable gui compilations during the install. Add the
+ --disable-gui flag to the configure invocation:
+
+ ./configure --disable-gui
+
+ and then compile as normal.
+
+
+(C) 2009-2012
+gsims1997 at yahoo.com
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..3e73b3d
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,7 @@
+AUTOMAKE_OPTIONS = foreign
+SUBDIRS = src scripts tests man doc examples
+
+dist-hook:
+ cd admin && ./add_license.sh
+ cd admin && ./fixDate.sh
+ cd admin && ./fixversion.sh
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..fa44a7a
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,699 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(top_srcdir)/configure AUTHORS COPYING INSTALL NEWS \
+ config/config.guess config/config.sub config/depcomp \
+ config/install-sh config/missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d "$(distdir)" \
+ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr "$(distdir)"; }; }
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT = @GETOPT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ISOSX = @ISOSX@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKTEMP = @MKTEMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign
+SUBDIRS = src scripts tests man doc examples
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -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)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(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 \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (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 \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__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'
+distuninstallcheck:
+ @$(am__cd) '$(distuninstallcheck_dir)' \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+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
+check-am: all-am
+check: check-recursive
+all-am: Makefile config.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ ctags-recursive install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am am--refresh check check-am clean clean-generic \
+ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+ dist-hook dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
+ distcheck distclean distclean-generic distclean-hdr \
+ distclean-tags distcleancheck distdir distuninstallcheck dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am
+
+
+dist-hook:
+ cd admin && ./add_license.sh
+ cd admin && ./fixDate.sh
+ cd admin && ./fixversion.sh
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..aa77eea
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,279 @@
+Version 3.19
+ Thanks to Joemar Taggana, some incompatible utilities
+ were discovered in Mac OSX -- including incompatible
+ getopt and mktemp. Corrected confusion in tutorial
+ p. 3 regarding -m (Thanks to Erin Shellman). Corrected
+ spelling of ffpjsd option --hamann to --hamman.
+
+Version 3.18
+ Rearranged ungetc character tests to come after
+ conversion of pipe to file. Fixed memory leak in
+ hash init(). Added support for large files (> 2GB) on 32
+ bit machines.
+
+Version 3.17
+ Fixed bug in tempfile creation in function
+ convertPipeToFile().
+
+Version 3.16
+ Fixed bug in ffpry with multiple headers parsed as a
+ single genome entry.
+
+Version 3.15
+ Fixed bug in ffprwn.
+
+Version 3.14
+ Added --disable-gui options to ./configure script. This
+ disables the perl based gui, so that the Perl/Tk module
+ isn't required for installation.
+
+Version 3.13
+ Changed row terminal output for all programs from '\t\n'
+ (tab newline) to '\n' (newline) only. This makes output
+ from previous version incompatible with 3.13 but the
+ ffps can be easily converted using:
+
+ sed 's/\t$//' ffp > ffp.tmp ; mv ffp.tmp ffp
+
+Version 3.12
+ Small bug fix for ffprwn for GNU compiler on 64 bit machines
+ where promotion of unsigned int to long unsigned int is
+ different. Thanks to Adrienne Breland at the University
+ of Nevada, Reno for finding this.
+
+Version 3.10
+ Fixed minor bug in ffpry for fasta records pseudomolecule
+ input ENDING in NNNNNNNN, or other invalid characters.
+
+Version 3.09
+ Fixed bug in ffpdf, related to initialized GROUP variable.
+
+ Updated license
+
+Version 3.08
+
+ ffpgui
+
+ Added instructions to install a functional version of the
+ perl/tk module for using cygwin, in INSTALL.
+
+ Added error messages in ffpgui for running a vocab or
+ relative entropy profile without loading a file first.
+
+ Added additional sections to tutorial.pdf
+
+
+
+Version 3.07
+ Added signal handling to all executables.
+ Broken pipes will cause a termination error in a pipeline
+ and will output 'PROGRAM: Broken pipe'
+
+ Expanded ./doc/tutorial.in.
+ Updated license.
+ Fixed inappropriate default -f setting (changed from 1 to
+ 2) for ffpvprof.
+
+Version 3.06
+ Added ffptree utility, which creates neighbor joining and
+ upgma trees. Date and version automatically updated
+ during build process.
+
+ Improved seeding of random generator when no seed is
+ provide via command line option: ffpry, ffpboot, ffpaa
+
+ Added processing via ffptree to ffpgui. The human
+ readable tree is displayed in the message window.
+
+ Started tutorial file in ./doc directory.
+
+ Added tutorial.pdf to doc directory
+
+Version 3.05
+ Added length test since MAX_WORD_SIZE is 40: ffpry, ffpaa
+ ffpre.
+
+Version 3.04
+ Added script ffpgui which is a Perl/Tk based GUI wrapper of
+ the various utilities.
+
+ Added --keys flag to ffpfilt to force keys to be output
+ instead of values only.
+
+Version 3.03
+ Fixed overflow error with non-rabin karp hash used in ffpcol.
+
+Version 3.02
+ The ffpaat utility has been removed from this package. The
+ purpose of this utility was to count amino acid features in
+ all nine frames from DNA fasta input. However obtaining
+ a proper translation of gene regions and using ffpaa is
+ generally more informative. This utility can still be
+ compiled and used from previous versions, but will not longer
+ be part of future releases.
+
+ Updated ffpre to Rabin-Karp hash, also fixed float overflow
+ errors and cases of nan, or inf in output. Text mode is now
+ implemented in ffpre.
+
+ Updated ffptxt to Rabin-Karp hash.
+
+
+Version 3.01
+ Implementation of Rabin-Karp hash in ffpaa utility.
+ Similar speed gains as in ffpry obtained
+
+
+ ffpaa -l 20 NC_008253.faa
+
+ ffpaa (v.3.0) ----------- 9.35 s
+ ffpaa (v.3.01) ----------- 0.15 s
+
+ Input buffering options removed from both ffpaa and ffpry. The
+ optimal buffering size for the system is determined automatically
+ by using the stat.st_block size attribute of fstat or the compiler
+ default, whichever is greater. This is an effort to use the
+ filesystem's most efficient block size.
+
+ Upcoming v3.02 will include Rabin-Karp implementation of ffpre.
+
+Version 3.0
+ Thanks to Nick Loman of University of Birmingham for pointing out
+ the cryptic nature of the "key-value" error messages when both
+ ffpfilt and ffpcol are used together in a pipeline successively.
+
+ All error messages from the utilities state the program issuing
+ the error.
+
+ Revamped tmpfile creation for non-seekable piped input, to use
+ most efficient buffering.
+
+ Added extra unit tests to confirm piped vs file argument output
+ is identical.
+
+ ffpry changes:
+
+ Beginning initial development of Rabin Karp Rolling hash function
+ implementations which has replaced the hashing function used
+ in version 2 in the ffpry executable. This has provided a
+ significant speedup in k-mer counting.
+ Here is a speed comparison:
+
+ ffpry -l 10 -d NC_008253.fna ------ 9.7s (v.3.0)
+ ffpry -l 10 -d NC_008253.fna ------ 1m28.2s (v.2.30
+
+ Removed all-possible/-a flag from ffpry. The only way to generate
+ columnar output from ffpry is via the -f flag and specify a specific
+ feature set.
+
+ -f specified features are now reverse complemented and classed as
+ is the input sequence by default.
+
+ Added -r option which disables reverse complementing of the input
+ sequence as well as operates on the feature list.
+
+ Fixed ffpry -f long option to correct value as per man file.
+
+ Other:
+
+ Fixed segmentation error in ffpboot
+
+ Future directions:
+
+ Rabin-Karp hash function will be implemented in ffpaa, ffptxt and
+ ffpre, ffpaat
+
+
+
+Version 2.30
+ Fixed bug when encountering IUPAC codes in input files to ffpry.
+
+Version 2.29
+ Fixed bug when piping input into ffpmerge.
+
+Version 2.28
+ Addition of examples directory with trees from
+ Sims & Kim(2011) PNAS,108,8329-8334
+
+ BUGS: ffpre doesn't report errors for trying to open
+ non-existing second file arguments.
+
+ ffpre -l 5 loadfile -d
+
+Version 2.27
+ ffpjsd: Added checks for overly long taxa names using the -p,
+ phylip 'infile' output option. Taxa names are now truncated to 10.
+
+Version 2.26
+ Inclusion of ffpdf utility which finds clade 'distinguishing
+ features' as implemented in the paper Sims & Kim (2011), PNAS
+
+Version 2.25
+ Major rewrite of ffpreprof and ffpvprof to support
+ piping in of files and TTY detection. Added
+ option for tmpfile directory specification in
+ ffpreprof and ffpvprof. Added -a,--amino option
+ to ffpvprof.
+
+ Added license header to the scripts
+
+Version 2.23
+ Added LICENSE file
+
+ Added abilitity for C utilities to detect whether
+ the program is being run interactively or as part of
+ a pipeline. If a utility is run interactively with no
+ arguments then an errror message is spit out.
+
+ Made parsing of FNA and FAA files more robust, especially
+ when the files are formated strangely or there are many
+ characters which must be ignored because they are not
+ part of the alphabet set used by the utility.
+
+ In ffpaa and ffpry:
+ Added a non-fatal warning message that indicates that a
+ particular fna file has zero keys stored in output.
+ This usually indicates that the file is empty or contains
+ only characters which are not part of the alphabet set.
+
+Version 2.22
+ Fixed ffpjsd -r bug. Previous output duplicated the diagonal.
+Version 2.21
+ Fixed non-one diagonals in similarity matrix -s option
+ Added test of columnar/key-value input to ffpboot command
+Version 2.20
+ Added Many new distance measures to ffpjsd
+Version 2.19
+ Added manhattan distance and pearson correlation(R) similarity and 1-R-squared
+ distance calculation to ffpjsd.
+Version 2.18
+ Updated manual files to include a few undocumented options and implemented
+ cosine distance calculation in ffpjsd.
+Version 2.17
+ Added ffpcomplex to package. This is used to filter out high/low complexity features.
+Version 2.16
+ Fixed -p bug in ffpjsd when specifying input file in argument list
+Version 2.15
+ Completed ffpfilt utility.
+Version 2.14
+ Added (key,value) test to ffprwn utility.
+Version 2.11
+ Added the ffptxt utility which performs the ffp on 26 letter texts after removing non alphabetic
+ characters.
+Version 2.10
+ Added ffpaat utility which translates nucleic acid sequence first into amino acid sequence and then
+ hashes the amino acid based features.
+Version 2.09
+ Added -Multiple option to ffpry and ffpaa for processing of multiple sequences in one FNA/FAA file
+Version 2.05
+ Enable long options in script files ffpvprof, ffpreprof and updated man files
+Version 2.04
+ Enabled long options and updated all man files.
+Version 2.03
+ ffpry option -d bug fixed. Now works with ATGC coding.
+Version 2.02
+ ffpcol now read input properly from stdin
+ Added -a switch for amino acid sequences
+ ffpaa no longer seg faults on Red-hat Linux system
+ Added manpage for ffpcol, ffpcol.1
+
diff --git a/README b/README
new file mode 100644
index 0000000..6eb6e67
--- /dev/null
+++ b/README
@@ -0,0 +1,619 @@
+FFP 3.18 - Feature Frequency Profile Phylogenetics Package
+Feb 20, 2012
+
+Author: Gregory E. Sims
+
+
+This is a collection of programs / utilities for implementing
+the FFP (Feature Frequency Profile) method of phylogenetic
+comparison. FFP is a class of alignment-free methods suitable
+for (whole genome) comparisons from viral to mammalian scale
+genomes.
+
+This method has been used to perform various phylogenetic
+analyses:
+
+
+Sims GE and Kim SH (2011) Whole-genome phylogeny of Escherichia
+coli/Shigella group by feature frequency profiles (FFPs). PNAS, 108,
+8329-34.
+
+Jun SR, Sims GE, Wu GA, Kim SH. (2010) Whole-proteome phylogeny of
+prokaryotes by feature frequency profiles: An alignment-free method
+with optimal feature resolution. PNAS, 107,133-8.
+
+Sims GE, Jun SR, Wu GA, Kim SH. (2009) Alignment-free genome comparison
+with feature frequency profiles (FFP) and optimal resolutions.
+PNAS, 106,2677-82.
+
+Sims GE, Jun SR, Wu GA, Kim SH (2009) Whole-genome phylogeny
+of mammals: evolutionary information in genic and nongenic regions.
+PNAS. 106,17077-82.
+
+
+
+The utilities are designed to be implemented using unix
+command pipes. In other words the output of programs
+can be linked to the input of other programs. Therefore
+many of the scripts are acceptable as filters to be used
+in intermediate steps.
+
+
+This package contains the following programs/scripts:
+
+
+ffpgui [Experimental] A perl/Tk based GUI
+ interface for performing some of the
+ basic FFP operations. This utility
+ doesn't support grid-based/
+ multiprocessor job flow. Also ffpgui is
+ in the beta stage, but it should give an
+ example of what can be done with the
+ utilities listed below. Note, currently
+ ffpgui will only work properly in Cygwin
+ if you download and compile v804.029
+ perl/Tk module from CPAN. Automatic installation
+ of perl/Tk by Cygwin setup.exe will not
+ provide proper functionality (It uses a
+ much older version version of perl/Tk).
+ See INSTALL for further instructions.
+ Use --disable-gui to bypass installation.
+
+ffpry Constructs an FFP profile from nucleic acid
+ sequences in FASTA format (.fna).
+
+ffpaa Constructs an FFP profile from amino acid
+ sequences in FASTA format (.faa).
+
+ffprwn This performs row normalization of the raw
+ FFP matrix.
+
+ffpjsd This calculates the Jensen Shannon Divergence
+ between FFPs and outputs a Divergence
+ (Distance) matrix. A variety of other
+ distances/similarity metrics are available as
+ well.
+
+ffpboot This performs bootstrapping or jacknifing
+ permutation of a raw FFP profile produced
+ by ffpry or ffpaa
+
+ffpvocab This utility counts the number of words which
+ are used more than a paritcular threshold
+ in the FFP profile. This utility is used
+ to determine what is the best range of word
+ lengths to use for a genome collection
+
+ffpre This utility calculates the Relative entropy
+ between the expected and observed frequencies
+ of features of length l (specified on the
+ command line) using an L-2 Markov Model.
+
+ffpvprof Script which calculates the word usage
+ for a range of l. Runs ffpvocab
+
+ffpreprof Script which calculates the Relative entropy
+ between observed and predicted frequencies for
+ a range of l. Runs ffpre.
+
+ffpmerge This utility merges all rows of an FFP into
+ a single row. Use this for merging segments
+ of an FFP, for example different chromosomes
+ of a larger genome.
+
+ffpcol This utility converts a FFP which has been
+ written out in key/value format to a columnar
+ format, so that each column corresponds to
+ the same feature in each row of the FFP.
+
+ffptxt This utility creates a key/value FFP of text
+ data. This is useful for performing an FFP
+ analysis of human language texts. All non-
+ alphanumeric characters are ignored.
+
+ffpfilt Eliminate high/low frequency features using
+ frequency cutoffs or probability based cutoffs
+ assuming a normal or extreme value distributions.
+
+ffpcomplex Eliminate high/low complexity features using
+ a complexity cutoff or probability based cutoff
+ assuming a normal distribution.
+
+ffpdf Finds clade distinguishing (diagnostic) features.
+ See Sims GE and Kim SH (2011) PNAS 108.
+
+ffptree Build neighbor joining and UPGMA trees from ffpjsd
+ output.
+
+
+OTHER REQUISITE PROGRAMS
+
+We suggest that you obtain a copy of PHYLIP
+(http://evolution.genetics.washington.edu/phylip.html)
+for building trees, however you can use any tree building program
+which will accept distance matrix input. The utility ffpjsd
+will produce Phylip style 'infile's as well as raw distance
+matrices. As of version 3.06, a tree building utility, ffptree
+is included, which will allow you build Newick style tree output
+directly as part of a ffp pipeline, which is compatible with the
+Phylip (3.69) utilities.
+
+
+QUICK START
+
+The best way to get a quick start is to read through the
+simple tutorial PDF file located in the ./doc dir of this
+distribution. It is also installed during the make install
+process in the /usr/local/share/doc/ffp directory (unless
+you have specified a different base directory using
+./configure --prefix during the build process).
+
+
+EXAMPLES
+
+***** How do I perform FFP comparison on a collection of nucleic
+ acid sequences, using a particular length of feature?
+
+
+Assuming your nucleic acid .fna files are all in the current
+working directory and are named with the .fna extension:
+
+ffpry -l 5 *.fna | ffpcol | ffprwn | ffpjsd > matrix
+
+for just two files (test1.fna and test2.fna):
+
+ffpry -l 5 test1.fna test2.fna | ffpcol | ffprwn | ffpjsd > matrix
+
+
+The above example uses all features of length
+5. The output of ffpry will be in key-value form,
+i.e. pairs of feature sequence followed by the raw
+count. Each row corresponds to the features from
+that sequence, in the order of input.The output of
+ffpry is piped to ffpcol, which converts the key value
+form into a column form, so that the raw counts
+corresponds to the same feature across rows. The
+utility ffprwn row normalizes each row of the ffp
+feature matrix (output by ffpry), so that each
+element of that row is a relative frequency.
+The output is now piped to ffpjsd which calculates a
+Jensen Shannon Divergence Matrix.
+
+Alternatively you can save the output at each step in
+intermediate files in the following form:
+
+ffpry -l 5 *.fna > vectors
+ffpcol vectors > vectors.col
+ffprwn vectors.col > vectors.row
+ffpjsd vectors.row > matrix
+
+This may be useful if you want to perform multiple analyses
+on some intermediate file (For example bootstrapping -- see
+below).
+
+
+
+**** How do I script and run commands?
+
+
+All of these commands can be completed
+programmatically in a shell script file
+for example:
+
+In a file named, for instance ffptest.sh
+
+
+#!/bin/sh
+
+ffpry -l 5 *.fna > vectors
+ffpcol vectors > vectors.col
+ffprwn vectors.col > vectors.row
+ffpjsd vectors.row > matrix
+
+Save the script and make it executable using:
+
+chmod +x ffptest.sh
+
+then run the script from the command line
+
+./ffptest.sh
+
+
+**** How do I perform bootstraping?
+
+You can use the utility ffpboot to perform bootstrapping on
+the output of ffpry or ffpaa.
+
+
+ffpry -l 5 *.fna | ffpcol > vectors
+ffpboot vectors | ffprwn | ffpjsd > matrix
+
+
+
+**** How do I create multiple bootsrap sets?
+
+The example below creates 100 bootstrap pseudoreplicate
+JSD matrices.
+
+ffpry -l 5 *.fna | ffpcol > vectors
+for i in $(seq 1 1 20)
+ do
+ ffpboot vectors | ffprwn | ffpjsd > matrix.$i
+ done
+
+
+**** How do I create phylip format infiles?
+
+
+To create phylip format infiles to use with programs
+such as NEIGHBOR, Use the command ffpjsd -p [FILE] which
+will generate a phylip format infile. FILE specifies
+the names of the taxa in the fna files you are using
+
+This file should whitespace or newline delimit the
+different taxa names.
+
+
+i.e.
+
+Taxa_1
+Taxa_2
+...
+Taxa_N
+
+
+Note the taxa should be in the order that they
+are read into ffpry (use ls *.fna to get that
+ordering).
+
+For example:
+
+ffpry -l 5 *.fna | ffpcol | ffprwn | ffpjsd -p names.txt > infile
+
+Or without the wildcards (*.fna)
+
+ffpry -l 5 1.fna 2.fna 3.fna | ffpcol | ffprwn | ffpjsd -p names.txt > infile
+
+The file names.txt should contain the taxa names of 1.fna, 2.fna and 3.fna
+in that order.
+
+**** How do I build a neighbor joining tree? ****
+
+In the sprit of the pipeline concept you can pipe output directly from
+ffpjsd into ffptree, provide it is in phylip infile format. Continuing
+the example from above:
+
+ffpry -l 5 *.fna | ffpcol | ffprwn | ffpjsd -p names.txt | ffptree -q > tree
+
+This produces a tree in Newick format. If you want to see the
+human readable tree to, remove the -q switch. Note, lots of
+output will be produces, but written to standard error so you will
+need should redirect standard error to a file to save for later.
+
+ffpry -l 5 *.fna | ffpcol | ffprwn | ffpjsd -p names.txt | ffptree 2> progress > tree
+
+
+**** How do I do bootstrapping for use with Phylip?
+
+
+ffpry -l 5 *.fna | ffpcol > vectors
+for i in $(seq 1 1 20)
+ do
+ ffpboot vectors | ffprwn | ffpjsd -p species.txt >> infile
+ done
+
+This will create a multiple dataset file for use with phylip.
+Use the 'multiple datasets' option in the neighbor program.
+
+
+**** How do I perform FFP on large genomes?
+
+
+The most effective way to do this to calculate FFP's of
+segments or units of the genome, for instance by chromosome
+or by contig, the ffp's of individual units can be
+merged together using the ffpmerge utility.
+
+Say you have 10 chromosomes. Calculate the FFP of
+each as a separate process and merge at the end of
+calculations.
+
+This is especially effective for multiprocess machines.
+
+
+For example:
+
+for fna_file in $(ls *.fna)
+ do
+ ffpry -l 10 $fna_file > $fna_file.vector &
+ done
+
+ffpmerge *.vector > merged.vector
+
+
+If your cluster machine uses a qeueing system (i.e. Grid
+engine) then you can create individual shell scripts to
+give to the scheduler and then merge unit vector files after
+all scheduled jobs have completed. A simple example using
+grid engine employs the $SGE_TASK_ID variable.
+
+Save a file containing the paths to your sequences
+There are 10 files total
+$ cat > sequences.txt
+seq.fna
+seq2.fna
+seq3.fna
+....
+Ctrl-D
+
+$ cat > submit.sh
+#!/bin/bash
+#submit.sh
+
+FILE=`head -n $SGE_TASK_ID < $1 | tail -n 1`
+ffpry -l 10 $FILE > $FILE.vector &
+
+In your shell:
+chmod +x submit.sh
+
+qsub -a 1-10 submit.sh sequences.txt
+
+Ctrl-d
+
+**** What if the ffp I get from ffprwn is very large and
+ ffpjsd take a long time?
+
+In this case you may want to break up the calculation of
+the JSD matrix, by assigning specific rows to different
+CPUs using the -r option.
+
+Starting with a normalized ffp with 10 rows:
+
+ffpjsd -r 1 vector.row > row.1
+
+The other 9 rows can be calculated by other CPUs, once
+again using a cluster machine and the SGE_TASK_ID variable.
+The results can be merged again using shell scripting:
+
+
+for i in $(seq 1 1 10)
+ do
+ cat row.$i >> matrix
+ done
+
+
+
+**** What is the difference between key/value FFPs and
+columnar FFPs?
+
+A key/value FFP is an FFP form which is generated by
+default from the programs FFPry and FFPaa. For instance
+the following command will generate a FFP of this form:
+
+ffpry -l 5 test*.fna
+
+
+The format will resemble:
+
+RYRRR 2 RRRRY 3 RRRRR 0 ....
+YRRRR 1 YYYRR 1 YRRRY 2 ...
+...
+
+
+Each row of the file is a FFP derived from a different
+sequence file.
+
+Columnar formats are required for input to ffprwn and
+ffpboot.
+
+
+In this format no feature keys are printed and the columns
+in the file correspond to the counts of that feature in
+each of the sequence files. For very sparse FFPs the key/
+value FFP can generate smaller files. For example this
+command will generate a key-value FFP:
+
+ffpry -l 5 test*.fna
+
+
+To convert a key/value FFP into a columnar format for input
+to the other utilities the ffpcol utility should be used
+as a filter.
+
+ffpry -l 5 test*.fna | ffpcol
+
+
+The output from ffpcol can be used in ffprwn and ffpjsd
+
+
+ffpry -l 5 test*.fna | ffpcol | ffprwn | ffpjsd
+
+
+**** How do I use a full 4 letter Nucleotide or 20 letter
+ amino acid alphabet?
+
+By default character classing is used in both ffpry and
+for amino acids in ffpaa. To disable this classing specify
+option -d for ffpry, ffpaa and ffpcol. Please also take
+note that when you disable RY coding with the -d option
+you may need to add the -d option to subsequent filters
+such as ffpcol and ffpmerge.
+
+For example:
+
+ffpry -l 5 -d test*.fna | ffpcol -d | ffprwn | ffpjsd
+
+For amino acids:
+
+ffpaa -l 5 -d test*.faa | ffpcol -d -a | ffprwn | ffpjsd
+
+**** How do I use a spaced seed hash with FFP?
+
+FFP refers to spaced seeds as masks - from the
+manner in which masks are used in computer programming
+to 'mask out' certain bit positions in low level bit
+manipulations of numbers stored in binary format.
+A spaced seed or mask of '01110' will allow both
+CAAAG and TAAAA to match each other, as well as to
+match any 5 letter word with AAA in the middle.
+
+A mask can be specified using -w, for example:
+
+ffpaa -l 5 -d -w "01110" test*.faa | ffpcol -d -a | ffprwn | ffpjsd
+
+If you don't want explicitly supply a mask string
+but want to allow a certain number of mismatches, use
+-z. Here for example is how to create a random mask
+with two mismatches allowed.
+
+ffpaa -l 5 -d -z 2 test*.faa | ffpcol -d -a | ffprwn | ffpjsd
+
+**** How do I compare text files with FFP?
+
+FFP has the ability to compare text files with the utility
+ffptxt. The procedure is much the same as with nucleic acid
+and amino acid sequences. Specify text with the -t option
+when using ffpcol.
+
+ffptxt -l 4 file*.txt | ffpcol -t | ffprwn | ffpjsd
+
+**** How do I get help?
+
+All the utilities come with their own manual page which is installed
+by default when using 'make install'.
+
+man ffpry
+
+will retrieve the manual for the ffpry utility.
+
+If you have installed ffp in some alternate location (i.e.
+by using ./configure --prefix), then the locations of the
+ffp manuals may not be in your MANPATH environmental variable.
+You can add the manual directory to MANPATH, or simply
+read the manuals directly using
+
+man /pathtomanual/ffpry.1
+
+(Note the manual section extension '1').
+
+
+**** Example trees
+
+Some published examples are shown in the distribution
+'examples' directory.
+
+**** How do I run FFP in Windows?
+
+Use Cygwin (www.cygwin.com). This package has been developed
+and tested to perform in both Linux and Cygwin.
+Cygwin is designed as an emulated Linux/Unix
+environment which runs on the Windows operating
+system -- it includes the majority of the GNU compilers
+and utilities that are part of a standard Linux
+distribution and performs superbly (albeit with
+a small performace loss because of emulation).
+
+
+**** Multiple fastas in a single file
+
+By default the ffpry and ffpaa programs assume that a single
+file, regardless of the number of fasta records contained in
+that file, represents a single species/genome/proteome. Therefore
+the l-mer frequencies represent the counts for all fasta records.
+If you specify multiple files on the command line i.e.
+
+ffpry *.fna
+
+Which might expand (the expanding of which is done by your shell of
+course) to:
+
+ffpry test1.fna test2.fna test3.fna
+
+then 3 separate ffp lines will be printed in the output. If in fact
+you want all of these results to be merged together into one FFP you
+can use the ffpmerge utility, or simply use the cat command, both
+of which should produce equivalent results.
+
+cat *.fna | ffpry
+
+or
+
+ffpry *.fna | ffpmerge --keys
+
+If however you have a single (or multiple fasta files) with multiple
+records which you want to be individual FFPs then you must specify
+the -m option.
+
+ffpry -m *.fna
+
+
+**** How do I implement the alternate Hamming based distance refered to
+as the Evolutionary FFP distance in Sims and Kim (2011), PNAS, 108
+8329-34?
+
+Trees presented in this paper are included in the examples subdirectory.
+To implement this type of analysis on your own use the following
+snippet of shell script code (assuming you are using the bash shell).
+
+From your working directory containing all your genome fasta files
+(assuming small single fasta genomes).
+
+
+ffpry -l 20 *.fasta | ffpcol | ffpfilt -l 0.05 -u 0.95 -e > ffp.filtered
+
+for i in {1..100} ; do
+ ffpboot -j -p 0.1 ffp.filtered | ffpjsd -H -p species.txt
+done > infile
+
+
+The features are filtered to remove high and low frequency features.
+Then 100 pseudoreplicates are created using 10% jackknife sampling.
+The output is a PHYLIP style infile which can be used directly as
+input to the PHYLIP tool NEIGHBOR. The option argument to -p is a
+tab or newline delimited file containing the names of the taxa in the
+original order which was specified on the command line to the original
+ffpry invocation. To confirm you have taxa named in the right order
+in your 'species.txt' taxa name file, execute this shell expansion.
+
+echo *.fasta
+
+This will show you the order (which will be identical to the ordering
+observed using ls *.fasta), in which you need to specify the names in
+species.txt.
+
+Rather than relying on the order from shell expansion you can specify
+the genome file arguments explicitly
+
+ffpry -l 20 genome1.fasta genome2.fasta genome3.fasta ...
+
+See the examples subdirectory for more information, including sample
+trees generated using FFP and Phylip.
+
+**** How do I implement the block-FFP method mentioned in
+Sims GE, Jun SR, Wu GA, Kim SH. (2009) Alignment-free genome comparison
+with feature frequency profiles (FFP) and optimal resolutions.
+PNAS, 106,2677-82.
+
+There is currently no script included in this distribution which will
+implement this method of genome comparison. Future releases will
+contain executables which implement Block-FFP.
+
+The main point to keep in mind is that FFP works best when you
+are comparing genomes/sequences of similar length -- and a good
+guideline is to make sure that your genomes are within A-fold
+the size of each other where A is the number of symbols in your
+alphabet.
+
+
+********
+
+
+
+
+
+Copyright (C) 2009-2012
+Author: Gregory E. Sims
+
+Report Bugs to gsims1997 at yahoo.com
+
+
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..1bc55f4
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,951 @@
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.11.1], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 10
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], UPC, [depcc="$UPC" am_compiler_list=],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES(OBJC)],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+ [[\\/$]]* | ?:[[\\/]]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..7858019
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,141 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Copyright year. */
+#undef COPY_YEAR
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#undef HAVE_CTYPE_H
+
+/* Define to 1 if you have the <float.h> header file. */
+#undef HAVE_FLOAT_H
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <math.h> header file. */
+#undef HAVE_MATH_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#undef HAVE_REALLOC
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdio.h> header file. */
+#undef HAVE_STDIO_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BLKSIZE
+
+/* Define to 1 if you have the `strupr' function. */
+#undef HAVE_STRUPR
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Name of package */
+#undef PACKAGE
+
+/* Authors of this package. */
+#undef PACKAGE_AUTHORS
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef ssize_t
diff --git a/config/config.guess b/config/config.guess
new file mode 100755
index 0000000..917bbc5
--- /dev/null
+++ b/config/config.guess
@@ -0,0 +1,1463 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# 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 Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -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 at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+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 -q "$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 at 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
+
+# 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 tupples: *-*-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=`(/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 ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ 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
+ # 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/[-_].*/\./'`
+ ;;
+ 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}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ 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'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ 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 at 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 ;;
+ 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:SunOS:5.*:*)
+ echo i386-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:*:[45])
+ 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/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ 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:BSD:*)
+ 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 __LP64__ >/dev/null
+ 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:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ x86:Interix*:[34]*)
+ echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+ exit ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-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-gnu`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 '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #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-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #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-gnu"; exit; }
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ 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 ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${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-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; 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.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V: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 i386.
+ echo i386-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; } ;;
+ 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.0*:*)
+ 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 at ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes at openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf at swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green at stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green at 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 ;;
+ 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 ;;
+ 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
+ case $UNAME_PROCESSOR in
+ *86) UNAME_PROCESSOR=i686 ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ 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 ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-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 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+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 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/config.sub b/config/config.sub
new file mode 100755
index 0000000..1c366df
--- /dev/null
+++ b/config/config.sub
@@ -0,0 +1,1579 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# 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.
+
+
+# Please send patches to <config-patches at gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# 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.
+
+# 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
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -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 at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+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
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+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)
+ os=
+ basic_machine=$1
+ ;;
+ -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
+ ;;
+ -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/'`
+ ;;
+ -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*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -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 \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | ms1 \
+ | msp430 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m32c)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # 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-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | ms1-* \
+ | msp430-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ m32c-*)
+ ;;
+ # 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-unknown
+ 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
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ 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
+ ;;
+ cr16c)
+ basic_machine=cr16c-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
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ 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
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ 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
+ ;;
+ i386-vsta | 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
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ 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
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ 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
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-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
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ 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) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ 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 | ppc64-le | powerpc64-little)
+ 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
+ ;;
+ 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
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | 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
+ ;;
+ 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
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ 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
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ 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
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ 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.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First 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* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku*)
+ # 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 | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -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
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -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
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -none)
+ ;;
+ *)
+ # 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
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ 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
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ 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
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-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
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-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
+ ;;
+ -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 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/depcomp b/config/depcomp
new file mode 100755
index 0000000..df8eea7
--- /dev/null
+++ b/config/depcomp
@@ -0,0 +1,630 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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 <http://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 at 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 outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+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"
+
+# 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
+
+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 -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## 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).
+## - 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 -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## 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.
+ tr ' ' '
+' < "$tmpdepfile" |
+## 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.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -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 -eq 0; then :
+ else
+ 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 ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> "$depfile"
+ echo >> "$depfile"
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+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.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ 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 -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ 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.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ 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 -eq 0; then :
+ else
+ 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,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add `dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#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.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # 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.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ 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"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ 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:: \1 \\:p' >> "$depfile"
+ echo " " >> "$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 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/config/install-sh b/config/install-sh
new file mode 100755
index 0000000..6781b98
--- /dev/null
+++ b/config/install-sh
@@ -0,0 +1,520 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # 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.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# 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_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+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
+no_target_directory=
+
+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
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+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
+ 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
+ trap '(exit $?); exit' 1 2 13 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 starting with `-'.
+ 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
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ 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.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/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-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 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
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && 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=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_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` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob 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 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/config/missing b/config/missing
new file mode 100755
index 0000000..28055d2
--- /dev/null
+++ b/config/missing
@@ -0,0 +1,376 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard at 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 <http://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
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+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 at 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
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar*)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar*)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case $firstarg in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case $firstarg in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/configure b/configure
new file mode 100755
index 0000000..0270ef0
--- /dev/null
+++ b/configure
@@ -0,0 +1,7079 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.68 for ffp 3.19.
+#
+# Report bugs to <gsims1997 at yahoo.com>.
+#
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+#
+#
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+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
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="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
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ # We cannot yet assume a decent shell, so we have to provide a
+ # neutralization value for shells without unset; and this also
+ # works around shells that cannot unset nonexistent variables.
+ # Preserve -v and -x to the replacement shell.
+ BASH_ENV=/dev/null
+ ENV=/dev/null
+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+ export CONFIG_SHELL
+ case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+ esac
+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf at gnu.org and
+$0: gsims1997 at yahoo.com about your system, including any
+$0: error possibly output before this message. Then install
+$0: a modern shell, or manually run the script under such a
+$0: shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='ffp'
+PACKAGE_TARNAME='ffp'
+PACKAGE_VERSION='3.19'
+PACKAGE_STRING='ffp 3.19'
+PACKAGE_BUGREPORT='gsims1997 at yahoo.com'
+PACKAGE_URL='http://sourceforge/projects/ffp-phylogeny'
+
+ac_unique_file="config.h.in"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+EGREP
+GREP
+CPP
+GETOPT
+MKTEMP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+WITH_GUI_FALSE
+WITH_GUI_TRUE
+ISOSX
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_gui
+enable_largefile
+enable_dependency_tracking
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used" >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures ffp 3.19 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/ffp]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of ffp 3.19:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-gui Disable compilation of ffpgui, requires the perl Tk module
+ --disable-largefile omit support for large files
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <gsims1997 at yahoo.com>.
+ffp home page: <http://sourceforge/projects/ffp-phylogeny>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+ffp configure 3.19
+generated by GNU Autoconf 2.68
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+
+
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ---------------------------------- ##
+## Report this to gsims1997 at yahoo.com ##
+## ---------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval \${$4+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$4=yes"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$4=yes"
+else
+ eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_member
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by ffp $as_me 3.19, which was
+generated by GNU Autoconf 2.68. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+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 || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Define authors of the package
+
+$as_echo "#define PACKAGE_AUTHORS \"Gregory E. Sims\"" >>confdefs.h
+
+
+$as_echo "#define COPY_YEAR \"2009-2012\"" >>confdefs.h
+
+# Insert copyright notice in configure script
+
+ac_aux_dir=
+for ac_dir in config "$srcdir"/config; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+am__api_version='1.11'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE=ffp
+ VERSION=3.19
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+case $host_os in
+ mac*)
+ ISOSX=yes
+
+ ;;
+ *)
+ ;;
+esac
+
+# Enable additional argument to configure
+# Check whether --enable-gui was given.
+if test "${enable_gui+set}" = set; then :
+ enableval=$enable_gui; case "${enableval}" in
+ yes | no ) WITH_GUI="${enableval}" ;;
+ *) as_fn_error $? "Bad value ${enableval} for --disable-gui" "$LINENO" 5 ;;
+ esac
+else
+ WITH_GUI="yes"
+
+fi
+
+
+ if test "x$WITH_GUI" = "xyes"; then
+ WITH_GUI_TRUE=
+ WITH_GUI_FALSE='#'
+else
+ WITH_GUI_TRUE='#'
+ WITH_GUI_FALSE=
+fi
+
+# Check if 32-bit -- then enable large file support
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+ enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ if ac_fn_c_try_compile "$LINENO"; then :
+ break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_file_offset_bits=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_large_files=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ fi
+fi
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+# Extract the first word of "mktemp", so it can be a program name with args.
+set dummy mktemp; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MKTEMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MKTEMP in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MKTEMP="$MKTEMP" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_MKTEMP="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_MKTEMP" && ac_cv_path_MKTEMP="no"
+ ;;
+esac
+fi
+MKTEMP=$ac_cv_path_MKTEMP
+if test -n "$MKTEMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKTEMP" >&5
+$as_echo "$MKTEMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test "$MKTEMP" = "no" ; then
+ as_fn_error or add to path. "'mktemp' missing from path. Please install" "$LINENO" 5
+fi
+# Extract the first word of "getopt", so it can be a program name with args.
+set dummy getopt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GETOPT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $GETOPT in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GETOPT="$GETOPT" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_GETOPT="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_GETOPT" && ac_cv_path_GETOPT="no"
+ ;;
+esac
+fi
+GETOPT=$ac_cv_path_GETOPT
+if test -n "$GETOPT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GETOPT" >&5
+$as_echo "$GETOPT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test "$GETOPT" = "no" ; then
+ as_fn_error or add to path. "'getopt' missing from path. Please install" "$LINENO" 5
+fi
+
+if test "x$WITH_GUI" = "xyes" ; then
+ # Checks for perl module DBI
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module Tk" >&5
+$as_echo_n "checking for perl module Tk... " >&6; }
+ if `/usr/bin/env perl -MTk -e 1 2> /dev/null`
+ then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ # May need alternate instructions for cygwin.
+ as_fn_error $? "Perl module Tk missing. Install using: perl -MCPAN -e 'install Tk'. Or use configure with '--disable-gui' to disable ffpgui build. " "$LINENO" 5
+ fi
+fi
+
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-lm':
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lm" >&5
+$as_echo_n "checking for main in -lm... " >&6; }
+if ${ac_cv_lib_m_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_main=yes
+else
+ ac_cv_lib_m_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_main" >&5
+$as_echo "$ac_cv_lib_m_main" >&6; }
+if test "x$ac_cv_lib_m_main" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+
+
+# Checks for header files.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in limits.h stdio.h time.h stdlib.h string.h ctype.h float.h getopt.h math.h stdbool.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+# Check for struct members
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+_ACEOF
+
+
+fi
+
+# check for size types
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
+if test "x$ac_cv_type_ssize_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define ssize_t int
+_ACEOF
+
+fi
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if ${ac_cv_header_stdbool_h+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdbool.h>
+#ifndef bool
+ "error: bool is not defined"
+#endif
+#ifndef false
+ "error: false is not defined"
+#endif
+#if false
+ "error: false is not 0"
+#endif
+#ifndef true
+ "error: true is not defined"
+#endif
+#if true != 1
+ "error: true is not 1"
+#endif
+#ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+#endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ /* See body of main program for 'e'. */
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ /* The following fails for
+ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+ _Bool n[m];
+ char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+
+int
+main ()
+{
+
+ bool e = &s;
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdbool_h=yes
+else
+ ac_cv_header_stdbool_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+
+# Zero out CFLAGS -- use the params in src/Makefile.am
+CFLAGS=
+
+
+# Checks for library functions.
+for ac_header in stdlib.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
+$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
+if ${ac_cv_func_malloc_0_nonnull+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_malloc_0_nonnull=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+return ! malloc (0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_malloc_0_nonnull=yes
+else
+ ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
+$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
+if test $ac_cv_func_malloc_0_nonnull = yes; then :
+
+$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
+
+else
+ $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
+
+ case " $LIBOBJS " in
+ *" malloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ ;;
+esac
+
+
+$as_echo "#define malloc rpl_malloc" >>confdefs.h
+
+fi
+
+
+for ac_header in stdlib.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5
+$as_echo_n "checking for GNU libc compatible realloc... " >&6; }
+if ${ac_cv_func_realloc_0_nonnull+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_realloc_0_nonnull=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *realloc ();
+#endif
+
+int
+main ()
+{
+return ! realloc (0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_realloc_0_nonnull=yes
+else
+ ac_cv_func_realloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5
+$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; }
+if test $ac_cv_func_realloc_0_nonnull = yes; then :
+
+$as_echo "#define HAVE_REALLOC 1" >>confdefs.h
+
+else
+ $as_echo "#define HAVE_REALLOC 0" >>confdefs.h
+
+ case " $LIBOBJS " in
+ *" realloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS realloc.$ac_objext"
+ ;;
+esac
+
+
+$as_echo "#define realloc rpl_realloc" >>confdefs.h
+
+fi
+
+
+for ac_func in memmove pow sqrt memset strupr
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile man/Makefile scripts/Makefile src/Makefile tests/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${WITH_GUI_TRUE}" && test -z "${WITH_GUI_FALSE}"; then
+ as_fn_error $? "conditional \"WITH_GUI\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+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
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in #(
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by ffp $as_me 3.19, which was
+generated by GNU Autoconf 2.68. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <gsims1997 at yahoo.com>.
+ffp home page: <http://sourceforge/projects/ffp-phylogeny>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+ffp config.status 3.19
+configured by $0, generated by GNU Autoconf 2.68,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+ "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
+ "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
+ "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..cc512ec
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,94 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.56])
+AC_INIT([ffp], [3.19], [gsims1997 at yahoo.com],[ffp],[http://sourceforge/projects/ffp-phylogeny])
+# Define authors of the package
+AC_DEFINE([PACKAGE_AUTHORS], ["Gregory E. Sims"], [Authors of this package.])
+AC_DEFINE([COPY_YEAR], ["2009-2012"], [Copyright year.])
+# Insert copyright notice in configure script
+AC_COPYRIGHT
+AC_CONFIG_AUX_DIR(config)
+AM_INIT_AUTOMAKE(ffp, 3.19)
+AC_CONFIG_SRCDIR([config.h.in])
+AC_CONFIG_HEADERS([config.h])
+AC_CANONICAL_HOST
+
+case $host_os in
+ mac*)
+ AC_SUBST(ISOSX,[yes])
+ ;;
+ *)
+ ;;
+esac
+
+# Enable additional argument to configure
+AC_ARG_ENABLE(gui,[ --disable-gui Disable compilation of ffpgui, requires the perl Tk module ],
+ [case "${enableval}" in
+ yes | no ) WITH_GUI="${enableval}" ;;
+ *) AC_MSG_ERROR(Bad value ${enableval} for --disable-gui) ;;
+ esac], [WITH_GUI="yes"]
+)
+
+AM_CONDITIONAL([WITH_GUI], [test "x$WITH_GUI" = "xyes"])
+# Check if 32-bit -- then enable large file support
+AC_SYS_LARGEFILE
+
+# Checks for programs.
+AC_PROG_CC
+AC_PATH_PROG([MKTEMP], [mktemp],[no])
+if test "$MKTEMP" = "no" ; then
+ AC_MSG_ERROR('mktemp' missing from path. Please install, or add to path.)
+fi
+AC_PATH_PROG([GETOPT], [getopt],[no])
+if test "$GETOPT" = "no" ; then
+ AC_MSG_ERROR('getopt' missing from path. Please install, or add to path.)
+fi
+
+if test "x$WITH_GUI" = "xyes" ; then
+ # Checks for perl module DBI
+ AC_MSG_CHECKING(for perl module Tk)
+ if `/usr/bin/env perl -MTk -e 1 2> /dev/null`
+ then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ # May need alternate instructions for cygwin.
+ AC_MSG_ERROR(Perl module Tk missing. Install using: perl -MCPAN -e 'install Tk'. Or use configure with '--disable-gui' to disable ffpgui build. )
+ fi
+fi
+
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-lm':
+AC_CHECK_LIB([m], [main])
+
+# Checks for header files.
+AC_CHECK_HEADERS([limits.h stdio.h time.h stdlib.h string.h ctype.h float.h getopt.h math.h stdbool.h])
+# Check for struct members
+AC_CHECK_MEMBERS([struct stat.st_blksize])
+# check for size types
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_INLINE
+
+# Zero out CFLAGS -- use the params in src/Makefile.am
+CFLAGS=
+
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([memmove pow sqrt memset strupr])
+
+AC_CONFIG_FILES([Makefile
+ doc/Makefile
+ examples/Makefile
+ man/Makefile
+ scripts/Makefile
+ src/Makefile
+ tests/Makefile])
+AC_OUTPUT
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644
index ed4d0d2..0000000
--- a/debian/changelog
+++ /dev/null
@@ -1,5 +0,0 @@
-ffp (3.19-1) UNRELEASED; urgency=low
-
- * Initial release (Closes: #<bug>)
-
- -- Andreas Tille <tille at debian.org> Thu, 26 Nov 2015 17:09:45 +0100
diff --git a/debian/compat b/debian/compat
deleted file mode 100644
index ec63514..0000000
--- a/debian/compat
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/debian/control b/debian/control
deleted file mode 100644
index de40d44..0000000
--- a/debian/control
+++ /dev/null
@@ -1,25 +0,0 @@
-Source: ffp
-Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
-Section: non-free/science
-Priority: optional
-Build-Depends: debhelper (>= 9),
- dh-autoreconf,
- perl-tk,
- ghostscript,
- groff
-Standards-Version: 3.9.6
-Vcs-Browser: http://anonscm.debian.org/viewvc/debian-med/trunk/packages/ffp/trunk/
-Vcs-Svn: svn://anonscm.debian.org/debian-med/trunk/packages/ffp/trunk/
-Homepage: http://sourceforge.net/projects/ffp-phylogeny/
-
-Package: ffp
-Architecture: any
-Depends: ${shlibs:Depends},
- ${misc:Depends},
- perl-tk
-Description: Feature Frequency Profile Phylogeny
- FFP (Feature frequency profile) is an alignment free comparison tool for
- phylogenetic analysis and text comparison. It can be applied to
- nucleotide sequences, complete genomes, proteomes and even used for text
- comparison.
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644
index 2dcb493..0000000
--- a/debian/copyright
+++ /dev/null
@@ -1,20 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: FFP
-Upstream-Contact: Gregory E. Sims <gsims1997 at yahoo.com>
-Source: http://sourceforge.net/projects/ffp-phylogeny/files/
-
-Files: *
-Copyright: 2009-2012 gsims1997 at yahoo.com
-License: non-free
- Copies of this software may be made without modification provided those
- copies are in agreement with the license included in this distribution.
- The terms of the license describing this software distribution expressly
- prohibits commercial usage. For details see the file LICENSE included
- in this directory of the distribution. For commercial licensing terms,
- please contact the authors.
-
-Files: debian/*
-Copyright: 2015 Andreas Tille <tille at debian.org>
-License: GPL-3+
- On Debian systems you can find the full text of GPL at
- /usr/share/common-licenses/GPL.
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index 9eafbe1..0000000
--- a/debian/docs
+++ /dev/null
@@ -1,2 +0,0 @@
-README
-NEWS
diff --git a/debian/links b/debian/links
deleted file mode 100644
index afbf213..0000000
--- a/debian/links
+++ /dev/null
@@ -1 +0,0 @@
-/usr/share/examples/ffp /usr/share/doc/ffp/examples
diff --git a/debian/rules b/debian/rules
deleted file mode 100755
index 934dc7b..0000000
--- a/debian/rules
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/make -f
-
-# DH_VERBOSE := 1
-
-DEBPKGNAME := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
-
-%:
- dh $@ --with autoreconf
-
-override_dh_compress:
- dh_compress --exclude=README
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/debian/upstream/metadata b/debian/upstream/metadata
deleted file mode 100644
index 5c03d56..0000000
--- a/debian/upstream/metadata
+++ /dev/null
@@ -1,12 +0,0 @@
-Reference:
- Author: Gregory E. Sims and Sung-Hou Kim
- Title: "Whole-genome phylogeny of Escherichia coli/Shigella group by feature frequency profiles (FFPs)"
- Journal: Proc Natl Acad Sci U S A.
- Year: 2011
- Volume: 108
- Number: 20
- Pages: 8329-34
- DOI: 10.1073/pnas.1105168108
- PMID: 21536867
- URL: http://www.pnas.org/content/108/20/8329
- eprint: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3100984/pdf/pnas.201105168.pdf
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index db8f932..0000000
--- a/debian/watch
+++ /dev/null
@@ -1,3 +0,0 @@
-version=3
-
-http://sf.net/ffp-phylogeny/ffp-(\d[\d\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..41b6caa
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,49 @@
+docdir = $(datadir)/doc/@PACKAGE@
+doc_DATA = manual.pdf tutorial.pdf
+
+do_subst = sed -e 's,\[@\]VERSION\[@\],$(PACKAGE_VERSION),g' \
+ -e "s|\[@\]DATE\[@\]|$(DATE)|g" \
+ -e "s|\[@\]COPY\[@\]|$(COPY)|g"
+
+TUTORIAL_FILES = \
+ tutorial.in
+
+MANUAL_FILES = \
+ ../man/ffpry.1 \
+ ../man/ffpaa.1 \
+ ../man/ffptxt.1 \
+ ../man/ffpcol.1 \
+ ../man/ffprwn.1 \
+ ../man/ffpboot.1 \
+ ../man/ffpjsd.1 \
+ ../man/ffpdf.1 \
+ ../man/ffpre.1 \
+ ../man/ffpsubnam.1 \
+ ../man/ffpvocab.1 \
+ ../man/ffpcomplex.1 \
+ ../man/ffpfilt.1 \
+ ../man/ffpmerge.1 \
+ ../man/ffpreprof.1 \
+ ../man/ffptree.1 \
+ ../man/ffpvprof.1
+
+
+manual.pdf: $(MANUAL_FILES) Makefile
+
+ groff -t -e -mandoc -Tps $(MANUAL_FILES) > manual.tmp
+ ps2pdf14 manual.tmp manual.pdf
+ rm -fr manual.tmp
+
+
+tutorial.pdf: $(TUTORIAL_FILES) Makefile
+
+ $(do_subst) < $(TUTORIAL_FILES) > tutorial.tmp1
+ eqn -d'&&' tutorial.tmp1 | groff -t -ms -Tps > tutorial.tmp2
+ ps2pdf14 tutorial.tmp2 tutorial.pdf
+ rm -fr tutorial.tmp*
+
+CLEANFILES = \
+ manual.pdf \
+ tutorial.pdf
+
+EXTRA_DIST = tutorial.in
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644
index 0000000..73811dc
--- /dev/null
+++ b/doc/Makefile.in
@@ -0,0 +1,420 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+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;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+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/||"
+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] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(docdir)"
+DATA = $(doc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT = @GETOPT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ISOSX = @ISOSX@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKTEMP = @MKTEMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = $(datadir)/doc/@PACKAGE@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+doc_DATA = manual.pdf tutorial.pdf
+do_subst = sed -e 's,\[@\]VERSION\[@\],$(PACKAGE_VERSION),g' \
+ -e "s|\[@\]DATE\[@\]|$(DATE)|g" \
+ -e "s|\[@\]COPY\[@\]|$(COPY)|g"
+
+TUTORIAL_FILES = \
+ tutorial.in
+
+MANUAL_FILES = \
+ ../man/ffpry.1 \
+ ../man/ffpaa.1 \
+ ../man/ffptxt.1 \
+ ../man/ffpcol.1 \
+ ../man/ffprwn.1 \
+ ../man/ffpboot.1 \
+ ../man/ffpjsd.1 \
+ ../man/ffpdf.1 \
+ ../man/ffpre.1 \
+ ../man/ffpsubnam.1 \
+ ../man/ffpvocab.1 \
+ ../man/ffpcomplex.1 \
+ ../man/ffpfilt.1 \
+ ../man/ffpmerge.1 \
+ ../man/ffpreprof.1 \
+ ../man/ffptree.1 \
+ ../man/ffpvprof.1
+
+CLEANFILES = \
+ manual.pdf \
+ tutorial.pdf
+
+EXTRA_DIST = tutorial.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-docDATA: $(doc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
+ @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+ done
+
+uninstall-docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(docdir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(docdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-docDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-docDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-docDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am uninstall uninstall-am uninstall-docDATA
+
+
+manual.pdf: $(MANUAL_FILES) Makefile
+
+ groff -t -e -mandoc -Tps $(MANUAL_FILES) > manual.tmp
+ ps2pdf14 manual.tmp manual.pdf
+ rm -fr manual.tmp
+
+tutorial.pdf: $(TUTORIAL_FILES) Makefile
+
+ $(do_subst) < $(TUTORIAL_FILES) > tutorial.tmp1
+ eqn -d'&&' tutorial.tmp1 | groff -t -ms -Tps > tutorial.tmp2
+ ps2pdf14 tutorial.tmp2 tutorial.pdf
+ rm -fr tutorial.tmp*
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/tutorial.in b/doc/tutorial.in
new file mode 100644
index 0000000..b6a0145
--- /dev/null
+++ b/doc/tutorial.in
@@ -0,0 +1,1415 @@
+.de CW
+. nop \\$3\s-2\f[C]\\$1\f[]\s+2\\$2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TL
+FFP [@]VERSION[@] - Feature Frequency Profile Phylogenetics Package
+.AU
+Gregory E. Sims
+.AI
+Lawrence Berkeley National Lab
+.DA
+.SH
+Preface
+.PP
+This is a collection of programs / utilities for implementing
+the FFP (Feature Frequency Profile) method of phylogenetic
+comparison. FFP is a class of alignment-free methods suitable
+for (whole genome) comparisons from viral to mammalian scale
+genomes. The fundamental unit of comparison is the
+.IR "l-" "mer"
+based feature. Thus, when we speak of features and the feature profile
+we are referening to a vector of features which describes the
+frequencies of those features within the underlying sequences.
+.PP
+This method has been used to perform various phylogenetic
+analyses:
+.IP \[bu] 2
+Sims GE and Kim SH (2011) Whole-genome phylogeny of Escherichia
+coli/Shigella group by feature frequency profiles (FFPs). PNAS, 108,
+8329-34.
+.IP \[bu]
+Jun SR, Sims GE, Wu GA, Kim SH. (2010) Whole-proteome phylogeny of
+prokaryotes by feature frequency profiles: An alignment-free method
+with optimal feature resolution. PNAS, 107,133-8.
+.IP \[bu]
+Sims GE, Jun SR, Wu GA, Kim SH. (2009) Alignment-free genome comparison
+with feature frequency profiles (FFP) and optimal resolutions.
+PNAS, 106,2677-82.
+.IP \[bu]
+Sims GE, Jun SR, Wu GA, Kim SH (2009) Whole-genome phylogeny
+of mammals: evolutionary information in genic and nongenic regions.
+PNAS. 106,17077-82.
+.SH
+OTHER REQUISITE PROGRAMS
+.PP
+We suggest that you obtain a copy of PHYLIP
+(http://evolution.genetics.washington.edu/phylip.html)
+for building trees, however you can use any tree building program
+which will accept distance matrix input. The utility ffpjsd
+will produce Phylip style 'infile's as well as raw distance
+matrices. As of FFP v3.06, a tree building utility, ffptree
+is included, which will allow you build Newick style tree output
+directly as part of a ffp pipeline, which is compatible with the
+Phylip (3.69) utilities.
+.PP
+.SH
+The FFP Utilities
+.PP
+The utilities are designed to be implemented using unix
+command pipes. In other words the output of programs
+can be linked to the input of other programs. Therefore
+many of the scripts are acceptable as filters to be used
+in intermediate steps.
+.PP
+This package contains the following programs/scripts:
+.PP
+.IP \fCffpgui\fR 1i
+.I Experimental.
+A perl/Tk based (graphical interface) GUI
+interface for performing some of the
+basic FFP operations. This utility
+doesn't support grid-based/
+multiprocessor job flow. Also
+.CW ffpgui
+is in the beta stage, but it should give an
+example of what can be done with the
+utilities listed below. Note: Will not
+work properly in Cygwin. The Cygwin
+implementation of perl/Tk appears to have
+some serious deficiencies.
+.IP \fCffpry\fR
+Constructs an FFP profile from nucleic acid
+sequences in FASTA format (.fna).
+.IP \fCffpaa\fR
+Constructs an FFP profile from amino acid
+sequences in FASTA format (.faa).
+.IP \fCffprwn\fR
+This performs row normalization of the raw
+FFP matrix.
+.IP \fCffpjsd\fR
+This calculates the Jensen Shannon Divergence
+between FFPs and outputs a Divergence
+(Distance) matrix. A variety of other
+distances/similarity metrics are available as
+well.
+.IP \fCffpboot\fR
+This performs bootstrapping or jacknifing
+permutation of a raw FFP profile produced
+by
+.CW ffpry
+or
+.CW ffpaa
+.IP \fCffpvocab\fR
+This utility counts the number of words which
+are used more than a paritcular threshold
+in the FFP profile. This utility is used
+to determine what is the best range of word
+lengths to use for a genome collection
+.IP \fCffpre\fR
+This utility calculates the Relative entropy
+between the expected and observed frequencies
+of features of length
+.I l
+(specified on the command line) using an
+.I "l -"
+2 Markov Model.
+.IP \fCffpvprof\fR
+Shell Script which calculates the word usage for a range of
+.I l.
+It executes the compiled executable
+.CW ffpvocab .
+Use this to determine the lower limit for word lengths.
+.IP \fCffpreprof\fR
+Shell script which calculates the Relative entropy
+between observed and predicted frequencies for
+a range of
+.I l .
+Use this script to determine the upper limit for
+word length.
+It runs the underlying executable
+.CW ffpre .
+.IP \fCffpmerge\fR
+This utility merges all rows of an FFP into
+a single row. Use this for merging segments
+of an FFP, for example different chromosomes
+of a larger genome.
+.IP \fCffpcol\fR
+This utility converts a FFP which has been
+written out in key/value format to a columnar
+format, so that each column corresponds to
+the same feature in each row of the FFP.
+.IP \fCffptxt\fR
+This utility creates a key/value FFP of text
+data. This is useful for performing an FFP
+analysis of human language texts. All non-
+alphanumeric characters are ignored.
+.IP \fCffpfilt\fR
+Eliminate high/low frequency features using
+frequency cutoffs or probability based cutoffs
+assuming a normal or extreme value distributions.
+.IP \fCffpcomplex\fR
+Eliminate high/low complexity features using
+a complexity cutoff or probability based cutoff
+assuming a normal distribution.
+.IP \fCffpdf\fR
+Finds clade distinguishing (diagnostic) features.
+See Sims GE and Kim SH (2011) PNAS, 108, 8329-34.
+.IP \fCffptree\fR
+Build neighbor joining and UPGMA trees from ffpjsd
+output.
+
+.SH
+FFP comparison of a collection of nucleic acid sequences
+.PP
+Assuming your nucleic acid
+.CW .fna
+files
+(nucleotide sequences in fasta format)
+are all in the current working directory and (for the purposes of this
+example) are named with the
+.CW .fna
+extension:
+.LP
+.CODE ffpry -l 3 *.fna | ffpcol | ffprwn | ffpjsd -p species.txt | ffptree > tree
+.LP
+To break down the terse syntax of the above examples,
+lets get an overview of the various utilities used in
+the commands above. First of all the
+.CW |
+symbol is known as the pipe symbol, it is used in the
+construction of pipelines. It indicates that the output
+(the standard output) of the program should be read into
+the standard input of the next program. This piping mechanism
+is extremely powerful and is widely applicable to all areas
+of linux/unix scripting and programming. As you can see,
+several programs can be connected together in a chain
+creating a pipeline of programs of arbitrary length. The
+first command in the above pipelines is
+.CW ffpry,
+which is a
+.I l- mer
+feature counting tool. You have likely seen
+what we refer to as an
+.I l- mer
+by various other names, such as a
+.I k- mer,
+.I n- gram,
+or
+.I k- tuple.
+All of these terms are synonymous, and
+imply that we are sliding a window of
+a specific length of letters along an
+arbitrarly long sequence and observing
+the frequencies of feature in those
+windows.
+.CW ffpry
+reads in fasta file nucleotide
+sequences and counts the number of
+times each
+.I l- mer
+appears. By fasta input we mean a file of the
+form:
+.LP
+.CODE >gi|5835107|ref|NC_001640.1| Equus caballus mitochondrion, complete genome
+.CODE GTTAATGTAGCTTAATAATATAAAGCAAGGCACTGAAAATGCCTAGATGAGTATTCTTACTCCATAAACA
+.CODE CATAGGCTTGGTCCTAGCCTTTTTATTAGTTATTAATAGAATTACACATGCAAGTATCCGCACCCCAGTG
+.CODE AGAATGCCCTCTAAATCACGTCTCTACGATTAAAAGGAGCAGGTATCAAGCACACTAGAAAGTAGCTCAT
+.CODE AACACCTTGCTCAGCCACACCCCCACGGGACACAGCAGTGATAAAAATTAAGCTATGAACGAAAGTTCGA
+.CODE CTAAGTCATATTAAATAAGGGTTGGTAAATTTCGTGCCAGCCACCGCGGTCATACGATTAACCCAAATTA
+.CODE ATAAATCTCCGGCGTAAAGCGTGTCAAAGACTAATACCAAAATAAAGTTAAAACCCAGTTAAGCCGTAAA
+.CODE AAGCTACAACCAAAGTAAAATAGACTACGAAAGTGACTTTAATACCTCTGACTACACGATAGCTAAGACC
+.CODE CAAACTGGGATTAGATACCCCACTATGCTTAGCCCTAAACTAAAATAGCTTACCACAACAAAGCTATTCG
+.CODE CCAGAGTACTACTAGCAACAGCCTAAAACTCAAAGGACTTGGCGGTGCTTTACATCCCTCTAGAGGAGCC
+.CODE TGTTCCATAATCGATAAACCCCGATAAACCCCACCATCCCTTGCTAATTCAGCCTATATACCGCCATCTT
+.CODE CAGCAAACCCTAAACAAGGTACCGAAGTAAGCACAAATATCCAACATAAAAACGTTAGGTCAAGGTGTAG
+.CODE ....
+.LP
+where the line begining with a
+.CW >
+character is refered to as the sequence defline (Definition Line).
+.CW ffpry
+uses the occurrences of these deflines to determine
+whether a new FFP is beginning. If your fasta file constains
+several deflines, i.e. it is a multi-fasta file, then each
+fasta file will be built into one feature profile. This feature
+can be disabled with the
+.CW \-m
+option if it is not what you intended (see the detailed section on ffpry for
+more information) and your file will be treated as multiple chunk of DNA.
+This might be useful if your file contains fastas, which are
+representative of more than one organism.
+.PP
+Our first example uses features of length
+3, specified with the
+.CW \-l
+option. Lets just see what the output of
+.CW ffpry
+might
+look like for the above fasta file for the horse (Equus) mitchondrion
+sequence, which I have saved as
+.CW equus_caballus.fasta.
+.LP
+.CODE $ ffpry -l 3 equus_caballus.fasta
+.LP
+.CODE RRR 4582 RRY 4186 YRR 4185 YRY 3705
+.LP
+The output of ffpry is in key-value form,
+i.e. pairs of feature sequence followed by the raw
+count. But something is odd, why are the features printed out
+with
+.CW R
+and
+.CW Y
+characters?
+.PP
+The default behavior of
+.CW ffpry
+it to count features in RY coded format where R stands for the purine
+bases A and G and the Y stands for the pyrimidine bases C and T. This
+transformation can be thought of compressing the alphabet size. We
+create two classes and recode the sequence using this two class compressed
+alphabet. In the case of R and Y the in-class members are biochemically related and
+it has been observed that the probability of mutation between two purines
+and likewise for the pyrimidines is more likely than a pyrimidine to
+purine mutation.This classing or coding of nucleotides can be disabled with
+.CW -d
+if desired. To illustrate this point lets repeat the above example with
+the
+.CW -d
+switch enabled.
+.LP
+.CODE $ ffpry -d -l 3 equus_caballus.fasta
+.LP
+.CODE TAA 790 TAC 512 TAG 803 TAT 803 \\\\
+.CODE GCA 349 GCC 351 GCG 141 GCT 459 \\\\
+.CODE CGA 240 CGG 194 CGT 221 ATC 589 \\\\
+.CODE ATG 634 ATT 860 TCA 658 TCC 546 \\\\
+.CODE TCT 501 GGG 500 GGT 495 CTC 498 \\\\
+.CODE CTG 389 CTT 517 AAA 770 AAC 577 \\\\
+.CODE TGG 528 TGT 558 GTC 277 GTG 487 \\\\
+.CODE CAA 583 ACT 578 TTC 581 CCT 669
+.LP
+There are a lot more features! Note that the
+.CW \\\\
+is our convention to indicate that the string is all printed out
+as one line, but we have inserted a newline to indicate that
+the line has been artificially wrapped to fit on the page. Lets
+take a closer look and examine how the features are actually counted.
+So lets just count the features in the first 10 characters of the sequence
+(to avoid the huge chore of manually counting
+.I l-
+mers in a long string).
+Lets save a truncated version of
+.CW equus_caballus.fasta
+as
+.CW eq_ca_short.fasta.
+.LP
+.CODE $ cat eq_ca_short.fasta
+.LP
+.CODE >gi|5835107|ref|NC_001640.1| Equus caballus mitochondrion, complete genome
+.CODE GTTAATGTAG
+.LP
+We can manually count the 3-mers which will appear by visually scanning a window 3
+characters wide, starting from
+.CW GTT
+and scanning down the sequence, the next 3-mer will be
+.CW TTA .
+After counting the entire string the set of 3-mers should be:
+.LP
+.CODE GTT 1 TTA 1 TAA 1 AAT 1 \\\\
+.CODE ATG 1 TGT 1 GTA 1 TAG 1
+.LP
+Lets see if ffpry gives us what we predicted.
+.LP
+.CODE $ ffpry -d -l eq_ca_short.fasta
+.LP
+.CODE TAA 2 TAC 1 TAG 1 ATG 1 \\\\
+.CODE ATT 1 AAC 1 TGT 1
+.LP
+The features reported don't appear to be the same as those produced by
+our manual counting:
+.IP 1. 1i
+The features appear different.
+.IP 2.
+The ordering isn't the same
+.IP 3.
+The feature frequencies are different.
+.PP
+So what's going on? Lets tackle them one by one. Well first of all the
+ordering of the features is different than the order as we encountered
+them in the truncated mitochondrial sequences. This is easy
+to explain, the features are printed out in
+.I hash-order .
+Features are stored internally in the hash table and printed out sequentially
+in the order they are encountered within the table -- that order will
+differ from the ordering in which they were counted.
+.PP
+However that still doesn't explain why there are some features in the output that
+we never even counted in the sequence, for example the feature
+.CW TAC,
+is not in the sequence!
+The simple explanation is that ffpry counts features in both the
+forward and reverse complement directions. The feature
+.CW TAC
+is actually the reverse complement of the feature
+.CW GTA,
+which is in the sequence. So the features reported are printed in a
+mixture of both the forward and reverse complements. The choice
+of whether a feature is stored and printed in the forward or reverse
+direction is decided internally -- but is determined by hash-precedence.
+Where a feature is placed in the hash table is determined using
+a numerical
+.I "hash index" .
+As a fasta file is scanned for features, both the hash
+index of the forward and reverse complement of the word are calculated,
+which usually are different from each other, except in the case of reverse
+palindromes. To save space and for efficiency, the word and the associated
+features are only stored once using the smaller
+of the two hash indices. Therefore
+.CW GTA
+is stored as
+.CW TAC
+because its hash index is smaller.
+.PP
+The final puzzle which seems odd is that
+the feature
+.CW TAA
+has a frequency of 2.
+But it only appears once in the mitochondrial sequence. You must
+remember to think in terms of the reverse complement
+word too!
+.CW TAA
+also occurs on the reverse complement strand, but you
+see the feature in the mitochondrial sequence as
+.CW TTA.
+.PP
+In the case of multiple input sequences or a fasta
+file with multiple fasta records, each row corresponds to the features from
+that sequence. The rows are ordered in the corresponding order of input.
+Therefore if we build an ffp with both horse and dog mitochondria, we might
+execute this command:
+.LP
+.CODE $ ffpry -l 3 equus_caballus.fasta canis_lupus.fasta
+.LP
+.CODE RRR 4582 RRY 4186 YRR 4185 YRY 3705
+.CODE RRR 4496 RRY 4113 YRR 4113 YRY 3999
+.LP
+The first row corresponds to the features from Equus and the second to
+Canis. Names indicating species are currently not attached to the FFP
+rows at this point -- but are attached at a later stage (ultimately the
+tree building stage). So you should be aware of the ordering in which
+the fasta sequences were supplied to the command line. The method that
+seems easiest is to let your shell expand a wildcard (i.e.
+.CW *.fasta )
+for you. For example lets say I have several fasta files in my current
+working directory. To see them I can use:
+.LP
+.CODE $ echo *.fasta
+.LP
+.CODE Bos_taurus.fasta Bubalus_bubalis.fasta Canis_lupus_laniger.fasta \\\\
+.CODE Colobus_guereza.fasta Equus_asinus.fasta Equus_caballus.fasta \\\\
+.CODE Eulemur_monogoz.fasta Lemur_catta.fasta Myotis_formosus.fasta \\\\
+.CODE Nycticebus_coucang.fasta Ovis_aries.fasta Ovis_canadensis.fasta \\\\
+.CODE Pan_troglodytes.fasta Pongo_abelii.fasta Rangifer_tarandus.fasta \\\\
+.CODE Rattus_lutreolus.fasta Rattus_tunneyi.fasta Tarsius_bancanus.fasta
+.LP
+I can take this listing and save it to a file for later, perhaps changing
+each name to a shorter name for a label in a phylogenetic tree.
+.LP
+.CODE $ \\\\ls *.fasta > species.txt
+.LP
+This will create a nice newline delimited file containing a list of all
+the fasta files in your current directory in the same order as your
+shell might expand
+.CW *.fasta .
+Note that the \\ in this case indicates we want to unalias any commands
+which may have been aliased to
+.CW ls .
+This is useful if for example you are using
+.CW ls
+with the
+.CW --color
+option enabled, and have it aliased to
+.CW ls .
+If you don't your
+.CW species.txt
+file will contain ANSI escape codes (e.g. nonsense like:
+.CW ^[[0m )
+which indicate color markup, used to
+display your
+.CW ls
+output in fancy file-type specific colors.
+If I want to build an FFP using all of the fasta files in my current directory
+we can just issue this command:
+.LP
+.CODE $ ffpry -l 3 *.fasta > vector
+.LP
+Take special note that the order in which
+.CW *.fasta
+is expanded should be identical to the ordering of fasta files
+we see above. We have a record of the ordering of genomes in
+.CW species.txt .
+Therefore the ordering of rows in the output ffp file
+.CW vector
+will have the same ordering as the shell expansion of
+.CW *.fasta .
+.PP
+Now we're ready to take another look at this pipeline.
+.LP
+.CODE ffpry -l 3 *.fna | ffpcol | ffprwn | ffpjsd -p species.txt | ffptree > tree
+.LP
+The output of
+.CW ffpry
+is piped to a utility called
+.CW ffpcol,
+which converts the key value form into a columnar form.
+This form discards the key labels, and retains the frequency
+values. In addition the values are transformed in such
+a manner that the frequency for a given feature across
+all FFP rows is in the same tabular column -- even if
+that feature is absent from that FFP row. As an example,
+given these to FFP rows
+.LP
+.CODE $ cat vector
+.LP
+.CODE RRR 4582 RRY 4186 YRR 4185
+.CODE RRR 4496 YRR 4113 YRY 3999
+.LP
+The
+.CW ffpcol
+transformation will produce a columnar representation which looks like
+this:
+.LP
+.CODE $ ffpcol vector > vector.col
+.LP
+.CODE $ cat vector.col
+.LP
+.CODE 4582 4186 4185 0
+.CODE 4496 0 4113 3999
+.LP
+Notice that the the feature
+.CW YRY
+is absent from row 1 and the feature
+.CW RRY
+is absent from row 2, therefore zero
+frequencies are printed in column 2 and 4.
+Notice that the raw counts corresponds to the
+same features in every column across both rows.
+Also, we'll point out here that if you
+choose to disable the compressed alphabet
+at the feature counting stage you must ALSO
+include the ffpcol call, for example:
+.LP
+ffpry -l 3 -d ffp | ffpcol -d > vector.col
+.LP
+.PP
+The next utility in the pipeline,
+.CW ffprwn ,
+row normalizes each row of the ffp
+feature matrix so that each
+element of that row is a relative frequency.
+Row normalization is simple; add
+up all the raw frequencies for a row, then
+divide each element by the row sum.
+This type of normalization isn't necessary
+in all cases, but it is necessary to make
+FFP comparisons using the default distance,
+the Jensen Shannon divergence, which
+is calculated with the
+.CW ffpjsd
+utility. For example the above columnar FFP
+will appear like so after normalization:
+.LP
+.CODE $ ffprwn vector.col > vectors.row
+.LP
+.CODE $ cat vectors.row
+.LP
+.CODE 3.54e-01 3.23e-01 3.23e-01 0.00e+00
+.CODE 3.57e-01 0.00e+00 3.26e-01 3.17e-01
+.LP
+The row normalized FFP output is now piped to
+.CW ffpjsd .
+which will produce a divergence (distance) matrix in
+Phylip style format. It is at this point where we
+specify the species names of each of the taxon rows by
+using the
+.CW species.txt
+file (note however you can name it whatever you want).
+You should create unique 10 character names in
+.CW species.txt
+-- that is characters which are unique within the first
+10 characters. This is for compatibility with the Phylip
+tools itself. If you do specify a taxon name longer than
+10 characters it will be automatically truncated to 10
+characters (with a warning printed to standard error), but Phylip tools
+or
+.CW ffptree
+will still generate an error if your names are not
+unique. The
+.CW \-p
+option is used to point to your
+.CW species
+file. Note once again, that the names of the species assigned
+in
+.CW species.txt
+must match the ordering the original fasta files
+were given in the call to
+.CW ffpry .
+The resulting output which is a Phylip style 'infile'
+is then piped into ffptree, which prints a tree to standard
+output in Newick format. Additionally tree build progress
+and a human readable tree are printed to standard error. If
+you want to save the human readable tree make sure to redirect
+it via standard error.
+.PP
+The above pipeline mechanism is quite powerful. Of course
+you can save the output at each step in
+intermediate files in the following form:
+.LP
+.CODE ffpry -l 3 *.fna > vectors
+.CODE ffpcol vectors > vectors.col
+.CODE ffprwn vectors.col > vectors.row
+.CODE ffpjsd -p species.txt vectors.row > infile
+.CODE ffptree infile > tree
+.LP
+As you can see, the pipeline form avoids the creation
+and subsequent cleanup of several intermediate files.
+However there are legitimate uses for creating and keeping around some of
+these intermediate files -- in particular performing multiple analyses
+using an intermediate step as a branching point. For example if you want to perform
+bootstrapping on the
+.CW vectors.col
+file using the
+.CW ffpboot
+utility or if you wanted to try out a few of the different
+distance measures offered by
+.CW ffpjsd
+using the same
+.CW vectors.row
+file.
+.SH
+FFP comparison of a collection of amino acid sequences
+.PP
+The FFP tools can also be used to build phylogenies
+from amino acid sequences or proteomes. The pipeline
+is very similar to that used for building a nucleic
+acid phylogeny. You need only to substitute the initial
+.I k -mer
+counter
+.CW ffpaa .
+However there are some subtleties to keep in mind when
+using
+.CW ffpaa .
+Foremost is the method of amino acid classing. By default
+the 20 amino acids are divided into 11 classes:
+.LP
+.IP \fCS,T\fR 1i
+The polar hydrophillic amino acids
+.IP \fCD,E\fR
+The negatively charged hydrophillic amino acids
+.IP \fCK,Q,R\fR
+The positively charged hydrophillic amino acids
+.IP \fCI,V,L,M\fR
+The non-polar hydrophobic amino acids
+.IP \fCF,W,Y\fR
+The large non-polary hydrophobic amino acids
+.IP \fCC\fR
+Cysteine - a singleton class
+.IP \fCG\fR
+Glycine - a singleton class
+.IP \fCA\fR
+Alanine - a singleton class
+.IP \fCN\fR
+Asparagine - a singleton class
+.IP \fCH\fR
+Histidine - a singleton class
+.IP \fCP\fR
+Proline - a singleton class
+.LP
+When an amino acid fasta file is scanned for
+.I l -mer
+amino acid, those symbols which are members of a
+multi-character class are substituted for
+the first symbol of the class. For example,
+if
+.CW Q
+or
+.CW R
+is encountered in an amino acid
+sequence either is substituted for the character
+.CW K ,
+because
+.CW Q
+and
+.CW R
+are part of the
+.CW K,Q,R ) (
+class. This classing can be disabled by using the
+.CW \-d
+option.
+.PP
+The next matter to consider is how your proteome
+file is parsed and processed. Lets say we have a multi-fasta
+file, with two records.
+.LP
+.CODE $ cat fastafile
+.LP
+.CODE >tr|C7NM83|C7NM83_HALUD Endo-1,4-beta-xylanase
+.CODE MSSDKTLRELADKNDLTLGASITADAFRTYPDDPAVAQTLTREFNAVTTGNALKMGPLRP
+.CODE ERYTYNFEDADAIVNLGVKNDLLVRGHALVWHNQTPGWFYPWEYTDDQLREFLRDHIHTV
+.CODE AGRYRGKVDVWDVVNEAVADDGTMRETAWYDAMGEEYIDLAFQWANEVAPEADLFYNDYG
+.CODE IDEINEKADGVYALLERLLDRGVPIDGVGLQMHAFRAQEYVTPEALGENIRRFKDLGLDV
+.CODE HVTEMDVAYDRENVPEDHLEHQAQYYRDILEACLDNGCDTLVTWGVHDTASWLRNYDQTI
+.CODE TDDPLLFDEDFDPKPAYFAIKDLLANKD
+.CODE
+.CODE >tr|C7NP66|C7NP66_HALUD Endo-1,4-beta-xylanase
+.CODE MSDTLRDVADDNDIKIGAAAAADPIRGDFQYRDALREFNAVTAENAMKMGPLRPDEHTYD
+.CODE FTDGDLIAEFAREHDMYFRGHVLVWHNQLPEWLLPFQYTDRELRRLLEDHVRTVAARYAG
+.CODE DVDTWDVVNEAVADDGG*RETPWLRAFGEEYLDKAFEWAHQSAPEADLFYNDYGADGIND
+.CODE KSDEIYEMVSGMLDRGVPIDGVGLQLHALHDPVDPDSVAENIERFKDLGLAVEITEMDVA
+.CODE YTAEDPPEDHQEVQADYYREVVEKAMAAGCDTFVIWGVADHHSWIPHFDDTLTDDPLLLD
+.CODE DGYDRKPAYDAIVDLLS
+.LP
+Lets say we execute the following command:
+.LP
+.CODE $ ffpaa -d -l 4 fastafile
+.LP
+Note that the second sequence has a intervening stop codon.
+The features are counted from the first sequences up until
+the end of the sequence. The blank space between the fasta records
+and the header is ignored. However features do not extend from
+one sequence to the next. For example the last 4-mer in
+.CW C7NM83
+is
+.CW ANRD .
+and the first feature in
+.CW C7NP66
+is
+.CW MSDT .
+To make this explict features never span two fasta records.
+Therefore you will
+.I not
+see feature
+.CW KDMS
+(the first two features from
+.CW C7NM83
+and the last two from
+.CW C7NP66 ).
+.PP
+Now what about that
+.CW *
+character, the stop codon?
+Features are counted in the sliding windows
+which do not contain the stop codon.
+Therefore
+.CW DDGG
+and
+.CW RETP
+are counted but
+.CW DGG* ,
+.CW GG*R ,
+.CW G*RE
+and
+.CW *RET
+are completely ignored. In fact all
+characters which are not the canonical 20 amino acid
+single letter symbols are completely ignored.
+.SH
+Text comparison
+.PP
+The text data analog of
+.CW ffpry
+and
+.CW ffpaa
+is
+.CW ffptxt .
+Its capabilities are highly simplified relative to these other
+two utilities.
+.CW ffptxt
+will take text input, strip out all characters which are not
+alphabetical and count
+.I l -mers.
+The behavior when encountering invalid characters (i.e. non alphabetic
+characters) is similar to the method used for invalid characters in nucleotide
+and amino acid sequences. The entire feature window must contain valid characters.
+Lets look at an example:
+.LP
+.CODE $ cat README
+.LP
+.CODE FFP 3.06 - Feature Frequency Profile Phylogenetics Package
+.CODE August 24, 2011
+.LP
+.CODE $ ffptxt -l 3 README
+.LP
+.CODE AGE 1 LEP 1 CYP 1 UEN 1 \\\\
+.CODE ILE 1 OGE 1 HYL 1 EPH 1 \\\\
+.CODE ETI 1 QUE 1 PRO 1 ATU 1 \\\\
+.CODE EAT 1 EAU 1 REF 1 REQ 1 \\\\
+.CODE URE 1 SPA 1 NET 1 EQU 1 \\\\
+.CODE CKA 1 CSP 1 LOG 1 AUG 1 \\\\
+.CODE UGU 1 FEA 1 FIL 1 EFR 1 \\\\
+.CODE UST 1 PHY 1 ENC 1 ENE 1 \\\\
+.CODE KAG 1 YLO 1 ICS 1 YPR 1 \\\\
+.CODE GEA 1 GEN 1 TIC 1 FFP 1 \\\\
+.CODE PAC 1 TUR 1 ROF 1 OFI 1 \\\\
+.CODE NCY 1 GUS 1 FRE 1 ACK 1
+.LP
+Notice that the punctuation, spaces, and numbers have not been counted in
+any features.
+.CW ffptxt
+only counts alphabetic features. Also notice that there is no concept of
+records in a text file, therefore the entire text file is always
+interpretted as one piece of data. There is no
+.CW \-m
+option.
+.PP
+.SH
+Bootstrapping your data
+.PP
+First of all, what is bootstrapping? It is a statistical concept introduced
+to phylogenetics by Joseph Felsenstein. It involves resampling the data
+one has at hand to create a pseudo-replicate of the data. The point of
+such an operation is to determine the robustness of conclusions one has made from
+the phylogenetic tree. An FFP based tree which depends heavily on the presence of a specific feature or
+small set of features may not be very robust (ultimately the tree may still
+be correct, even though it lacks robustness). Generally we assign higher certainty to trees which are more
+robust -- i.e. they are less likely a statistical fluke. The FFP utility
+used for resampling is
+.CW ffpboot .
+It will perform two main kinds of resampling: bootstrapping and jackknifing.
+Lets show the difference between the two using an example. Lets say we have
+a columnar FFP matrix:
+.LP
+.CODE $ cat ffp.col
+.LP
+.CODE 2 1 3 0 4
+.CODE 1 4 0 2 3
+.CODE 3 3 1 3 4
+.LP
+Bootstrapping involves creating a new FFP matrix from this original matrix.
+The new matrix will also contain 6 columns, but we will randomly select
+columns from the original matrix to choose in the new matrix. This new
+matrix is called a
+.I pseudo-replicate .
+Note that some columns may be sampled more than once, or sometimes not
+at all. We can produce a pseudo-replicate of the above matrix using
+the default mode of
+.CW ffpboot
+.LP
+.CODE $ ffpboot ffp.col
+.LP
+.CODE 3 3 2 4 1
+.CODE 0 0 1 3 4
+.CODE 1 1 3 4 3
+.LP
+Notice that column 3 was sampled twice, columns 1,2, and 5
+were sampled once, and column 4 was sampled zero times.
+.PP
+The other form of resampling is jackknifing, which is implemented
+with the
+.CW \-j
+option. In this case each of the n columns in the matrix
+have a fixed probability of deletion. The deletion probability
+is by default 1-1/e (which works out to about 0.367, for those of you
+who can't take powers of e in your head), but can be set with the
+.CW \-p option. Lets see what happens with our test input data.
+.LP
+.CODE $ ffpboot -j ffp.col
+.LP
+.CODE 1 3 0 4
+.CODE 4 0 2 3
+.CODE 3 1 3 4
+.LP
+You will notice that column 1 of the matrix was selectively
+deleted. Typically, I will use jackknife runs which remove
+a large fraction of the features typically with a deletion
+probability of 60-70%.
+.PP
+Lets see how we can incorporate this bootstrapping concept
+into an FFP pipeline. We first need to decide how many
+pseudoreplicates to make -- there is no firm number on this,
+but lets say 100 replicates is enough. Lets create our
+replicates using a bash shell loop:
+.LP
+.CODE for i in {1..100} ; do
+.CODE ffpboot ffp.col | ffprwn | ffpjsd -p species.txt | ffptree -q
+.CODE done > intree
+.LP
+The statement on the third line,
+.CW done
+.CW >
+.CW tree ,
+indicates to redirect the output of all the commands within the do-while
+loop to the file
+.CW intree ,
+which will contain 100 trees produced from the pseudo-replicates.
+This collection of trees can be passed to a consensus tree finder,
+such as the Phylip program
+.CW consense .
+The kind of output you might get from consense from a consensus tree
+might look like the eaxample below (Note this is from the Phylip documentation).
+Given the following input data (note there are no branch lengths, typically
+FFP trees will have branch lengths), which represent 9 replicates:
+.LP
+.CODE $ cat intree
+.LP
+.CODE (A,(B,(H,(D,(J,(((G,E),(F,I)),C))))));
+.CODE (A,(B,(D,((J,H),(((G,E),(F,I)),C)))));
+.CODE (A,(B,(D,(H,(J,(((G,E),(F,I)),C))))));
+.CODE (A,(B,(E,(G,((F,I),((J,(H,D)),C))))));
+.CODE (A,(B,(E,(G,((F,I),(((J,H),D),C))))));
+.CODE (A,(B,(E,((F,I),(G,((J,(H,D)),C))))));
+.CODE (A,(B,(E,((F,I),(G,(((J,H),D),C))))));
+.CODE (A,(B,(E,((G,(F,I)),((J,(H,D)),C)))));
+.CODE (A,(B,(E,((G,(F,I)),(((J,H),D),C)))));
+.LP
+.CODE $ consense
+.LP
+.CODE "+---------------------------------------A"
+.CODE "!"
+.CODE "! +-----------------------------E"
+.CODE "! !"
+.CODE "! ! +----I"
+.CODE "! ! +------------9.0"
+.CODE "! ! ! +----F"
+.CODE "! +--9.0 !"
+.CODE "! ! ! +--2.0 +---------D"
+.CODE "! ! ! ! ! +--6.0"
+.CODE "! ! ! ! ! ! ! +----J"
+.CODE "! ! ! ! +--6.0 +--4.0"
+.CODE "+--9.0 +--6.0 ! +----H"
+.CODE " ! ! !"
+.CODE " ! ! +--------------C"
+.CODE " ! !"
+.CODE " ! +------------------------G"
+.CODE " !"
+.CODE " +----------------------------------B"
+.LP
+The numbers displayed on the internal nodes represent
+how many trees in which that particular clading (to the right of the
+node) was observed. You can see that the clade I,F,D,J,H and
+C has relatively low support among the replicate trees. This
+grouping is only observed in 2 of the 9 trees. In this way we
+can identify the strong and weak clades in our phylogenetic tree.
+.LP
+.SH
+Finding the right length.
+.PP
+We've used a lot of different examples of running ffp pipelines
+with different lengths of
+.I l -mers,
+but which one if the best to use? Well it turns out to be a
+difficult question to answer, but the package has a number of
+tools included to help you narrow down the right range of lengths
+to use. There are ultimately two main tools:
+.CW ffpvocab
+and
+.CW ffpre
+(in addition to a couple of wrapper scripts) which help you zoom
+in on the right lengths. First lets illustrate the identification
+of the lower limit using the
+.CW ffpvocab
+wrapper script
+.CW ffpvprof
+which creates a
+.I "vocabulary feature profile"
+over a range of feature lengths. We define a
+.I "vocabulary feature"
+to be a feature which occurs more than once in the genome. Hence
+this feature is part of the genome's regular
+.I vocabulary.
+Think of this in terms of a human's vocabulary. You have several
+words you use on a daily basis and there are certain words you
+.I overuse .
+These are words that are part of your repoitore. Sure there are
+other lofty really long words that you've diligently commited to
+memory and you look for opportunities to use, but the occasion only
+happens rarely. If we plot those words by their length, only recording
+the number of words that you used at least twice in the day, you will observe a
+distribution of frequencies which has a pronounced peak in the distribution
+at a particular length. This states that the words which you use most commonly
+have this particular length.
+This is a phenomenon observable in all forms of data -- including sequence
+information. Lets see how it works with a real genome sequence (in this case
+an
+.I "E. coli"
+strain):
+.LP
+.CODE $ ffpvprof -f 2 -d -r NC_008253.fna
+.CODE 1 4.000000e+00
+.CODE 2 1.600000e+01
+.CODE 3 6.400000e+01
+.CODE 4 2.560000e+02
+.CODE 5 1.024000e+03
+.CODE 6 4.096000e+03
+.CODE 7 1.533500e+04
+.CODE 8 4.001100e+04
+.CODE 9 6.263300e+04
+.CODE 10 6.327900e+04
+.CODE 11 5.089400e+04
+.CODE 12 2.813500e+04
+.CODE 13 1.139600e+04
+.CODE 14 4.127000e+03
+.CODE 15 1.672000e+03
+.CODE 16 8.110000e+02
+.CODE 17 5.980000e+02
+.CODE 18 4.540000e+02
+.CODE 19 4.050000e+02
+.CODE 20 3.830000e+02
+.LP
+The first column is the feature length and the second column is the number of
+features which occur at least 2 times at that length. Notice that the peak
+in the distribution occurs at length 10. This means that this
+.I "E. coli"
+genome reuses words that have a length of 10 most frequently. We demark this
+peak at 10 as the lower limit for phylogenetic analysis. Words at this length
+are very commonly used in many different context and have very little information
+content.
+.PP
+To find the upper limit you can use the utility
+.CW ffpre
+and the wrapper script
+.CW ffpreprof .
+Lets investigate what
+.CW ffpre
+does. It calculates the relative entropy error between the observed frequency of
+an
+.I l -mer
+and an
+.I l -2
+Markov model. To illustrate lets say we are reading the children's book Peter Pan and
+we are curious about the different contexts in which we observer the word "watch".
+and lets pull out an extra letter to the left and right of watch:
+.LP
+.CODE to watch her owatchh
+.CODE were watching them ewatchi
+.CODE and watch them dwatcht
+.CODE Michael watched them lwatche
+.CODE was watching from swatchi
+.CODE kept watch outside twatcho
+.CODE keep watching that pwatchi
+.CODE your watch. Peter rwatchp
+.LP
+You can see that watch occurs in many different contexts. We want to extend the letters
+around watch until we can predict the context of the those letters or they are unique
+in the sequence. By extending the length of the word by just two letters the context
+becomes unique. Therefore if I encounter the word 'owatchh', I know it is part of the larger phrase 'towatchher'.
+.PP
+The
+.I l -2
+Markov model says that I can predict the frequency of a word
+of length
+.I l
+using the frequencies of its
+.I l -1
+and
+.I l -2
+subwords.
+The formula for doing this is:
+.LP
+&f sub l = f sub { 2..n } f sub { 1 .. n-1} over f sub {2..n-1}&
+.LP
+or put another way, using the feature GGCC as an example,
+.LP
+&f sub GGCC = f sub {GGC} f sub { GCC} over f sub {GC}&
+.LP
+The relative entropy measure that is calculated by
+.CW ffpre
+makes use of this equation to arrive at an estimate of frequencies
+for all words in a sequence found at length
+.I l ,
+then compares that estimate to the actual frequency. The smaller the
+relative entropy then the closer the estimate is to reality. When the
+relative entropy is very small then generally this means that we can
+predict the frequencies of all words from smaller sub-words. We have
+defined this as the upper limit.
+.CW ffpre
+will read a sequence and calculate the relative entropy measure for
+specific values of
+.I l .
+If you want to calculate this value for a range of
+.I l ,
+then you should use
+.CW ffpreprof ,
+which works in an analogous way as does
+.CW ffpvprof .
+In this case instead of looking for the peak, you should
+be looking for an elbow point, for
+.I l
+when the relative entropy approaches
+zero (i.e. when it is very close to zero).
+Here is an example from the
+.I E. coli
+genome:
+.LP
+.CODE $ ffpreprof -e 30 NC_008253.fna
+.CODE 3 -0.379976
+.CODE 4 2.677588
+.CODE 5 -0.204627
+.CODE 6 1.299080
+.CODE 7 -0.060150
+.CODE 8 0.797391
+.CODE 9 0.060862
+.CODE 10 0.594577
+.CODE 11 0.175684
+.CODE 12 0.490803
+.CODE 13 0.272426
+.CODE 14 0.424031
+.CODE 15 0.263974
+.CODE 16 0.348154
+.CODE 17 0.226826
+.CODE 18 0.187225
+.CODE 19 0.133277
+.CODE 20 0.120039
+.CODE 21 0.081689
+.CODE 22 0.181143
+.CODE 23 0.414640
+.CODE 24 0.015185
+.CODE 25 0.172817
+.CODE 26 0.001127
+.CODE 27 0.000283
+.CODE 28 0.000207
+.LP
+We approach zero above
+.I l =26.
+Therefore this is the upper limit for this genome.
+.SH
+Feature filtering
+.PP
+Under some conditions you may want to remove some features from your key-value
+form FFP. The package contains two utilties,
+.CW ffpfilt
+and
+.CW ffpcomplex ,
+which implement two separate filtration methods.
+.PP
+The utility
+.CW ffpfilt
+will perform filtration of features by their frequency -- specifically filtration
+of features which have either unusually low or unusually high frequencies. How
+high or low that frequency needs to be can be determined in a number of ways -- the
+simplest being a defined frequency threshold. Lets assume I have my key-valued ffp stored
+in the file,
+.CW keyvalue.ffp
+and I want to remove all features which occur more that 20 times.
+.LP
+.CODE ffpfilt < keyvalue.ffp | ffpfilt -u 20 > ffp.filt
+.LP
+In addition we can specify a lower threshold if for example we wanted to remove
+features which occur less than 2 times.
+.LP
+.CODE ffpfilt < keyvalue.ffp | ffpfilt -l 2 -u 20 > ffp.filt
+.LP
+In this case the
+.CW -l
+indicates a
+.I lower
+threshold, don't confuse it with the switch representing length in
+the various other utilities. To avoid the confusion you can use the
+long format options:
+.LP
+.CODE ffpfilt < keyvalue.ffp | ffpfilt --lower 2 --upper 20 > ffp.filt
+.LP
+The other mode of
+.CW ffpfilt
+allows you to identify and remove features which have frequencies lie that outside a
+given probability range assuming a specific underlying cummulative distribution
+function. The two distributions which can be used are the normal distribution
+.CW -n ) ( and the
+extreme value distribution
+.CW -e ) (.
+In either of these modes the arguments to
+.CW --lower
+and
+.CW --upper
+are floating point values which represent a probability threshold in the
+cummulative distribution threshold. Here is a concrete example, Lets say I
+want to remove features which have frequencies which are in the lower 10% of
+the extreme value distribution (i.e. rare features):
+.LP
+.CODE ffpfilt < keyvalue.ffp | ffpfilt -e --lower 0.10 > ffp.filt
+.LP
+We can also combine this with an upper limit.
+.LP
+.CODE ffpfilt < keyvalue.ffp | ffpfilt -e --lower 0.10 --upper 0.90 > ffp.filt
+.LP
+which removes features which are both common and rare. Filtering with the normal
+distribution works in a similar fashion.
+.PP
+The utility
+.CW ffpcomplex
+is used to filter out features by their sequence complexity. To give a simple example
+.CW ATATATATATAT ,
+is a low complexity feature, but
+.CW ATGAATGAGACC
+is a higher complexity feature. Numerically,
+the complexity of a feature is determined by finding the total entropy of all
+individual sub features for all
+.I k
+less than
+.I l,
+which is the length of the feature. For example given the feature
+.LP
+.CODE GCGCGCGC
+.LP
+determine the entropy of
+.I k =1,
+which which is
+&H sub {k=1} = f sub G log {f sub G} + f sub C log {f sub C}&,
+where &f sub G& for example is the relative frequency of
+.CW G
+in the original feature of length
+.I l
+above. Also note for simplicity &log& is actually &log sub 2&.
+Next determine the entropy of all
+.I k =2,
+sub-mers,
+&H sub {k=2} = f sub {GC} log { f sub GC } + f sub CG log { f sub CG }&.
+Repeat for all
+.I k
+less than
+.I l .
+The total complexity of the
+.I l -mer
+is
+&H sub l = H sub 1 + H sub 2 + ... + H sub {l-1}&.
+So lets see what the complexity of
+.GCGCGC is ...
+.LP
+.CODE $ cat feature.ffp
+.CODE GCGCGCGC 1
+.LP
+.CODE $ ffpcomplex -d --stats feature.ffp
+.CODE 3.671582 0.000000
+.LP
+The first value indicates that
+.CW GCGCGCGC
+has a complexity of 3.67. Ignore the second value for now.
+Likewise a more complex feature,
+.CW GTAGGTGA has a complexity of 4.729283.
+Lets look at a real
+sequence to see how these complexity numbers really work. Lets print out
+some statistics:
+.LP
+.CODE $ ffpry -l 10 Bos_taurus.fasta | ffpcomplex --stats
+.CODE 4.900724 0.212182
+.LP
+This tells us that the average complexity of the features in
+.CW Bos_taurus.fasta
+with a length of 10 is
+.CW 4.900724
+and the standard deviation is
+.CW 0.212182 .
+We can use these numerical values to filter out sequences based upon
+the raw complexity or we can use probabilities from an assumed normal
+distribution.
+.LP
+Here we use a raw probability threshold.
+.LP
+.CODE ffpcomplex -l 4.0
+.LP
+Here we assume a cummulative normal distribution and upper and lower limits.
+.LP
+.CODE ffpcomplex -n -l 0.1 -u 0.95
+.SH
+Finding clade distinguishing features
+.PP
+Okay so I've got a tree. Now you'd like to backtrack and figure out what
+features make the tree have this specific topology. What features are
+indicative of the pattern of clading (grouping) which you see in the tree?
+A distinguishing feature (DF) is a feature which is present in all FFPs of a
+given group, but absent in all other groups. Given these example rows
+from an FFP matrix,
+.LP
+.CODE Taxon 1 ... ATG 3 CAC 2 TGA 3 ...
+.CODE Taxon 2 ... ATG 2 CAC 1 TTG 1 ...
+.CODE Taxon 3 ... ATG 4 TGC 3 GGA 2 ...
+.LP
+and the additional information that taxa 1 and 2 belong to group A and
+taxon 3 belongs to group B, we can give an example of a DF. The feature,
+ATG, is not a DF for either group A or B, since it is present in all
+groups. However feature CAC is a DF for group A, since it is present
+in only group A and not group B. Likewise feature TGA and TTG are not
+DFs of group A because neither is present in all members of that group.
+.PP
+To find distinguishing features in an FFP, first you must
+create an FFP, using one of the feature counting utilities, ffpry, ffpaa,
+or ffptxt. The example below illustrates the method for RY-coded nucleotide
+sequences, where we want to find features which are universally shared
+among all taxa specified in the FFP input file.
+.LP
+.CODE ffpry -l 6 test*.fna > vector
+.CODE ffpdf vector > dfs
+.LP
+or alternatively, combining the separate commands as one pipeline:
+.LP
+.CODE ffpry -l 6 test*.fna | ffpdf > dfs
+.LP
+The above example assumes every row (genome, species, or sequences)
+is a member of the same group (clade). For multiple clades, use the
+--group-file option to specify the clade structure. This is defined
+by building a newline delimited group-file definition. Lets say there
+are 5 genomes and there are two clades, the 2nd and 3rd rows of the FFP,
+belong to clade A and the remainder belong to clade B, then the group
+file should have the format below
+.LP
+.CODE $ cat groupfile
+.CODE B
+.CODE A
+.CODE A
+.CODE B
+.CODE B
+.LP
+Now that clades have been defined we can extract out the DFs for clade A
+or B separately (A in this case below).
+.LP
+.CODE ffpry -l 6 test*.fna | ffpdf --group-file="groups.txt" --group="A" > dfs.A
+.LP
+Multi-character alphanumeric symbols can also be specified for group names.
+Note however, any whitespace will be stripped from group names.
+Also, note that by default a DF is defined as a feature which is present in
+all members of a group. This defintion can be relaxed slightly by using the
+-p option to specify the percentage of taxa within a given group which must
+have a feature in order for it to be considered a DF. For example if we wanted
+to find out which features are present in 2 out of 3 taxa in group B we can use
+this syntax:
+.LP
+.CODE ffpry -l 6 test*.fna | ffpdf -p 0.66 --group-file="groups.txt" --group="A" > dfs.B
+.LP
+.SH
+FFP with large genomes
+.PP
+So far we haven't mentioned how to apply FFP with large genomes. Typically a
+large genome, such as a Eukaryote, might already divided up into into individual
+files a the chromosome level -- or perhaps into individual contig assemblies.
+You might even be interested in comparing chromosomes from the same species or
+cross comparing chromosomes across species. Typically though, you'll probably
+want to merge the individual chromosome based FFPs into a single species
+level FFP. Lets say we're interested in the human genome, and we've downloaded
+individual chromosomes and named them conveniently as chr1.fna, chr2.fna, ...
+chrY.fna. We can use some bash shell magic (You'll find an equivalent in any
+other shell variant as well):
+.LP
+.CODE for i in {1..22} X Y ; do
+.CODE ffpry -l 15 chr${i}.fna > chr${i}.ffp
+.CODE done
+.LP
+The above code snippet is a bash shell loop that iterates iterates over the
+22 numbered chromosomes and the sex chromosomes. Lets neglect the fact that
+each one of these steps may take some time for now -- we'll discuss
+setting FFP up to run on a multiprocessor grid as well. If we want a Human
+species level ffp we should merge the individual chromosome ffps. This can
+be done using
+.CW ffpmerge .
+.LP
+.CODE ffpmerge -k chr*.ffp > human.ffp
+.CODE # Or more explicitly using shell substitutions
+.CODE ffpmerge -k chr{1..22}.fna chr{X,Y}.fna > human.ffp
+.LP
+This produces a merged FFP file consisting of the entire set of features from
+the files specified as arguments. Note that the default mode of ffpmerge
+creates columnar output, therefore if you plan on comparing several
+species which are the result of mergings you should use the
+.CW -k
+option. So, lets say we have several species FFPs which we have calculated
+and saved, in the manner as above, say human, chimp, gorilla, etc. We can
+concatenate them into a single ffp file if we choose, or specify them all
+as file arguments:
+.LP
+.CODE $ cat > species.txt
+.CODE human
+.CODE chimp
+.CODE gorilla
+.CODE ctrl-d
+.CODE # Here are 2 options for doing the same procedure
+.CODE $ cat human.ffp chimp.ffp gorilla.ffp | ffpcol | ffprwn | ffpjsd -p species.txt | ffptree
+.CODE $ ffpcol human.ffp chimp.ffp gorilla.ffp | ffprwn ffpjsd -p species.txt | ffptree
+.LP
+Of ccourse, we've been gently introducing you to the idea
+that the operations above can be considered as atomic processes.
+The most effective way to exploit atomic processes and get the
+job done quickly is to use a multi-processor architecture. The
+examples below assume you are using a grid architecture like
+Sun Grid Engine.
+
+We calculate the FFP of
+each chromosome on a different processor.
+If your cluster machine uses a qeueing system (i.e. Grid
+engine) then you can create individual shell scripts to
+give to the scheduler and then merge unit vector files after
+all scheduled jobs have completed. A simple example using
+grid engine employs the $SGE_TASK_ID variable.
+
+Save a file containing the paths to your sequences
+There are 10 files total:
+.LP
+.CODE $ cat > sequences.txt
+.CODE seq.fna
+.CODE seq2.fna
+.CODE seq3.fna
+.CODE ...
+.CODE Ctrl-D
+.LP
+.CODE $ cat > submit.sh
+.CODE #!/bin/bash
+.CODE #submit.sh
+.LP
+.CODE FILE=`head -n $SGE_TASK_ID < $1 | tail -n 1`
+.CODE ffpry -l 10 $FILE > $FILE.vector
+.CODE Ctrl-d
+.LP
+.CODE $ chmod +x submit.sh
+.CODE $ qsub -a 1-10 submit.sh sequences.txt
+.LP
+This creates a shell script which can be used in
+a SGE Job Array. The way a job array works is
+essentially identical code is submitted to the grid
+with the exception of the value of
+.CW SGE_TASK_ID
+"which is set by SGE." The qsub line option
+.CW -a
+specifies that we want a job array consisting
+of 10 jobs. When a job is run on the grid
+.CW SGE_TASK_ID
+will contain a value between 1 and 10.
+The script we've created,
+.CW submit.sh ,
+uses the
+.CW SGE_TASK_ID
+to extract the ith (or more properly the
+.CW SGE_TASK_IDth
+which is truly a mouthful) line from the file
+.CW sequences.txt .
+It should be fairly easy to extend this to all
+the other utilities used in the previous pipelines
+in this tutorial. One additional option to be aware
+of for especially large FFPs is the
+.CW -r
+option to
+.CW ffpjsd .
+It allows you to calculate the nth row of a ffp matrix.
+In this way you can allow one processor to calculate
+a single row of a matrix, later "assembling the matrix"
+by concatenation into a single matrix. For
+example a submit script might look like this:
+.LP
+.CODE #!/bin/bash
+.CODE #mat_submit.sh
+.CODE
+.CODE ffpjsd -r $SGE_TASK_ID file.ffprwn > row.$SGE_TASK_ID
+.LP
+We can then submit this script as a job array.
+Now the matrix can be assembled via a simple concatenation
+.LP
+.CODE #Lets say the matrix had ten rows
+.CODE cat row.{1..10} > matrix
+.LP
+
+
+
+
diff --git a/examples/Figure_1a_consensus b/examples/Figure_1a_consensus
new file mode 100644
index 0000000..2d03687
--- /dev/null
+++ b/examples/Figure_1a_consensus
@@ -0,0 +1,10 @@
+(((((((((((((S_F5:100.0,(S_F2a301:100.0,S_F2a245:100.0):100.0):100.0,(S_BCDC:100.0,
+S_BSb:100.0):100.0):100.0,S_S:100.0):92.0,S_D:100.0):100.0,(((E_0127H6:100.0,
+(((E_536:100.0,E_CFT:100.0):100.0,(E_UTI89:100.0,(E_APEC01:100.0,E_S88:100.0):100.0):100.0):100.0,
+E_ED1a:100.0):100.0):100.0,(Sal_EA:100.0,EF:100.0):100.0):100.0,((E_IAI39:100.0,
+E_SMS:100.0):100.0,E_UMN:100.0):100.0):100.0):100.0,(((E_0157:100.0,E_Sakai:100.0):100.0,
+(E_O157H7:100.0,E_O157H:100.0):100.0):100.0,((E_O26H11:100.0,E_O111:100.0):100.0,
+E_O103:100.0):100.0):100.0):100.0,(((E_SE11:100.0,E_IAI1:100.0):100.0,E_243:100.0):100.0,
+E_55989:100.0):100.0):100.0,(E_ATCC:100.0,E_HS:100.0):100.0):100.0,(E_Bstr:100.0,
+E_BL21:100.0):100.0):100.0,E_BW29:100.0):100.0,E_K12DH:100.0):100.0,E_K12W3:100.0):100.0,
+E_K12MG:100.0);
diff --git a/examples/Figure_1a_tree b/examples/Figure_1a_tree
new file mode 100644
index 0000000..a757cc0
--- /dev/null
+++ b/examples/Figure_1a_tree
@@ -0,0 +1,14 @@
+(((E_O157H:0.00116,E_O157H7:-0.00061):0.00780,((E_O103:0.03917,
+(E_O26H11:0.03324,E_O111:0.02986):0.01173):0.00807,(((((((S_F2a301:0.00523,
+S_F2a245:0.00341):0.00985,S_F5:0.01433):0.05214,(S_BSb:0.02815,
+S_BCDC:0.04065):0.04158):0.00452,S_S:0.06204):0.00114,S_D:0.11686):0.02620,
+((((((E_CFT:0.04133,E_536:0.03767):0.00517,(E_UTI89:0.02144,
+(E_APEC01:0.01609,E_S88:0.01221):0.00721):0.01867):0.01265,
+E_ED1a:0.06224):0.01239,E_0127H6:0.06936):0.02406,(EF:0.17317,
+Sal_EA:0.31083):0.07270):0.00747,((E_SMS:0.05738,E_IAI39:0.06462):0.01753,
+E_UMN:0.06847):0.00513):0.01588):0.00937,(((E_243:0.03940,
+(E_SE11:0.03174,E_IAI1:0.02776):0.00405):0.00331,E_55989:0.04669):0.00850,
+(((((E_K12W3:0.00057,E_K12MG:0.00020):0.00279,E_K12DH:0.01047):0.00158,
+E_BW29:0.00637):0.02951,(E_BL21:0.00819,E_Bstr:0.01001):0.02534):0.00687,
+(E_HS:0.03754,E_ATCC:0.03686):0.00388):0.01567):0.00720):0.01264):0.07246):0.00289,
+E_0157:0.00524,E_Sakai:0.00277);
diff --git a/examples/Figure_1b_consensus b/examples/Figure_1b_consensus
new file mode 100644
index 0000000..fef4c94
--- /dev/null
+++ b/examples/Figure_1b_consensus
@@ -0,0 +1,9 @@
+(((((((CFT083:100.0,536:100.0):100.0,((APEC01:100.0,S88:100.0):100.0,UTI89:100.0):100.0):100.0,
+ED1a:100.0):100.0,E2348/69:100.0):100.0,((((((((SE11:100.0,E24337A:100.0):100.0,
+IAI1:100.0):100.0,55989:100.0):83.0,((11128:100.0,11368:100.0):100.0,12009:100.0):100.0):100.0,
+(((((K12MG165:100.0,K12W3110:100.0):100.0,BW2952:100.0):100.0,K12DH10B:100.0):100.0,
+(REL606:100.0,BL21_DE3:100.0):100.0):100.0,(ATCC8739:100.0,HS:100.0):100.0):100.0):100.0,
+(((F5b801:100.0,(F2a301:100.0,F2a245:100.0):100.0):100.0,(Sb512:100.0,Sb227:100.0):100.0):100.0,
+SSonei:100.0):97.0):100.0,(((EDL933:100.0,Sakai:100.0):100.0,(EC4115:100.0,
+TW14359:100.0):100.0):100.0,Sd197:100.0):55.0):73.0,(UMN026:100.0,(IAI39:100.0,
+SMS-3-5:100.0):100.0):79.0):73.0):100.0,S_EnterA:100.0):100.0,E_Fergus:100.0);
diff --git a/examples/Figure_1b_tree b/examples/Figure_1b_tree
new file mode 100644
index 0000000..6eb4f23
--- /dev/null
+++ b/examples/Figure_1b_tree
@@ -0,0 +1,15 @@
+(K12MG1665:368.75000,(BW2952:5958.66477,(K12DH10B:21749.76562,
+((BL21_DE3:6739.58333,REL606:9660.41667):24731.06283,((HS:32583.84233,
+ATCC8739:35116.15767):4655.45410,((((((EDL933:5085.71429,
+Sakai:5714.28571):2444.11765,(EC4115:275.16667,TW14359:191.83333):7522.38235):60860.15625,
+Sd197:69839.84375):2428.63582,((((((CFT083:42017.67241,536:35782.32759):3047.76786,
+(UTI89:22391.40625,(APEC01:16166.66667,S88:13133.33333):5108.59375):19689.73214):9034.97596,
+ED1a:52858.77404):11818.43750,E2348/69:58869.06250):21716.30859,
+(E_Fergus:116779.16667,S_EnterA:148220.83333):43783.69141):4811.19792,
+((SMS-3-5:57072.36842,IAI39:56927.63158):14194.85294,UMN026:70305.14706):5907.55208):7415.11418):10169.34291,
+((((F2a301:4299.83871,F2a245:3740.16129):8975.13889,F5b801:13404.86111):43291.72092,
+(Sb227:21663.15104,Sb512:25336.84896):28258.27908):2670.12329,
+SSonei:44654.87671):3851.01842):5438.01676,((((E24337A:36271.50879,
+SE11:30428.49121):1850.60221,IAI1:26149.39779):1955.92041,
+55989:43969.07959):675.47607,(12009:38639.85352,(11368:28041.14583,
+11128:24558.85417):16710.14648):6424.52393):11221.77734):9846.21175):4863.29590):24681.43717):3075.23438):4291.33523,K12W3110:131.25000);
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..841142f
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,3 @@
+docdir = $(datadir)/examples/@PACKAGE@
+dist_doc_DATA = Figure_1a_consensus Figure_1a_tree Figure_1b_consensus \
+ Figure_1b_tree README
diff --git a/examples/Makefile.in b/examples/Makefile.in
new file mode 100644
index 0000000..6175de1
--- /dev/null
+++ b/examples/Makefile.in
@@ -0,0 +1,378 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = examples
+DIST_COMMON = README $(dist_doc_DATA) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+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;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+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/||"
+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] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(docdir)"
+DATA = $(dist_doc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT = @GETOPT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ISOSX = @ISOSX@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKTEMP = @MKTEMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = $(datadir)/examples/@PACKAGE@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_doc_DATA = Figure_1a_consensus Figure_1a_tree Figure_1b_consensus \
+ Figure_1b_tree README
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign examples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-dist_docDATA: $(dist_doc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+ done
+
+uninstall-dist_docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(docdir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(docdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_docDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_docDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am uninstall uninstall-am uninstall-dist_docDATA
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/examples/README b/examples/README
new file mode 100644
index 0000000..c8baf99
--- /dev/null
+++ b/examples/README
@@ -0,0 +1,96 @@
+#Trees constructed with FFP software version 2.0 and Phylip
+#Obtain FFP software from: http://sourceforge.net/projects/ffp-phylogeny/
+#
+#Gregory E. Sims, Phd
+#Contact gesims at lbl.gov or gsims at jcvi.org
+#
+
+These examples are from:
+
+Sims GE and Kim SH (2011) Whole-genome phylogeny of Escherichia
+coli/Shigella group by feature frequency profiles (FFPs). PNAS, 108,
+8329-34.
+
+# Constructed from L=24 features and Jensen Shannon Divergence
+Figure_1a_tree # Tree using all features from L=24
+Figure_1a_consensus # 10% Jackknife consensus tree using above tree and
+ # 100 pseudoreplicates
+
+Figure_1b_tree # Tree using all commonly shared features with frequency
+ # Less than or equal to 3.
+Figure_1b_consensus # Consensus from 10% jacknife of above features
+
+#
+
+You can effectively regenerate the trees by following the steps below.
+You will need to obtain a copy of (Phylip http://evolution.genetics.washington.edu/phylip.html)
+or substitute another tree generation program which accepts input similar
+to Phylip.
+
+1. To download the genomes, use examples/GetEcoliGenomes
+
+./GetEcoliGenomes
+
+You should now have 39 subdirectories containing genomes in FASTA format.
+Plasmids associated with each genome are placed in a subdirectory, 'plasmid'
+
+2. To produce a standard FFP tree as in Figure 1a. Assuming you are in
+the directory below the genome subdirectories
+
+ffpry -l 24 */*.fna | ffpcol | ffprwn | ffpjsd -p taxa_names.txt > infile
+
+3. Use the Phylip utility neighbor to produce a neighbor joining tree.
+
+rm -f outtree
+rm -f outfile
+
+neighbor <<EOF
+y
+EOF
+
+4. You can get a quick view of the tree produced from the 'outfile'
+generated by neighbor. The Newick style tree file 'outtree' can be
+viewed in a number of tree viewers.
+
+5. To generate a consensus tree, using the Phylip utility consense.
+
+ffpry -l 24 */*.fna | ffpcol > ffpjack.in
+
+for i in {1..100} ; do
+ ffpboot -j -p 0.1 ffpjack.in | ffprwn | ffpjsd -p taxa_names.txt
+done > infile
+
+#Infile will contain multiple distance matrices which can be processed
+#in batch form by neighbor using the 'm' menu option
+
+rm -f outtree
+rm -f outfile
+
+neighbor <<EOF
+m
+y
+EOF
+
+mv outtree intree
+
+consense <<EOF
+EOF
+
+6. To generate tree 1b, using feature filtering and the Evolutionary distance:
+
+ffpry -l 24 */*.fna | ffpfilt -l 1 -u 3 | ffpcol | ffpjsd -L -p taxa_names.txt > infile
+
+Use neighbor as in 3.
+
+
+7. To generate tree 1b in jacknife consensus form:
+
+
+ffpry -l 24 */*.fna | ffpfilt -l 1 -u 3 | ffpcol > ffpjack.in
+
+for i in {1..100} ; do
+ ffpjsd -H -p taxa_names.txt
+done > infile
+
+
+Repeat neighbor and consense steps as in step 5.
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..c52c2d1
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,137 @@
+man_MANS = \
+ ffpaa.1 \
+ ffptree.1 \
+ ffpboot.1 \
+ ffpjsd.1 \
+ ffpmerge.1 \
+ ffpre.1 \
+ ffpreprof.1 \
+ ffprwn.1 \
+ ffpry.1 \
+ ffpvocab.1 \
+ ffpvprof.1 \
+ ffpcol.1 \
+ ffptxt.1 \
+ ffpfilt.1 \
+ ffpcomplex.1 \
+ ffpsubnam.1 \
+ ffpdf.1
+
+COPY=$$(date +'%Y')
+DATE=$$(date +'%B %-d, %Y')
+do_subst = sed -e 's,\[@\]VERSION\[@\],$(PACKAGE_VERSION),g' \
+ -e "s|\[@\]DATE\[@\]|$(DATE)|g" \
+ -e "s|\[@\]COPY\[@\]|$(COPY)|g"
+
+ffpaa.1 : ffpaa.1.in Makefile
+ $(do_subst) < $(srcdir)/ffpaa.1.in > ffpaa.1
+
+
+ffptree.1 : ffptree.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffptree.1.in > ffptree.1
+
+ffpboot.1 : ffpboot.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpboot.1.in > ffpboot.1
+
+
+ffpjsd.1 : ffpjsd.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpjsd.1.in > ffpjsd.1
+
+
+ffpmerge.1 : ffpmerge.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpmerge.1.in > ffpmerge.1
+
+
+ffpre.1 : ffpre.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpre.1.in > ffpre.1
+
+ffpreprof.1 : ffpreprof.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpreprof.1.in > ffpreprof.1
+
+
+ffprwn.1 : ffprwn.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffprwn.1.in > ffprwn.1
+
+ffpry.1 : ffpry.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpry.1.in > ffpry.1
+
+ffpvocab.1 : ffpvocab.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpvocab.1.in > ffpvocab.1
+
+ffpvprof.1 : ffpvprof.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpvprof.1.in > ffpvprof.1
+
+ffpcol.1 : ffpcol.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpcol.1.in > ffpcol.1
+
+ffptxt.1 : ffptxt.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffptxt.1.in > ffptxt.1
+
+
+ffpfilt.1 : ffpfilt.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpfilt.1.in > ffpfilt.1
+
+ffpcomplex.1 : ffpcomplex.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpcomplex.1.in > ffpcomplex.1
+
+ffpdf.1 : ffpdf.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpdf.1.in > ffpdf.1
+
+ffpsubnam.1 : ffpsubnam.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpsubnam.1.in > ffpsubnam.1
+
+EXTRA_DIST = \
+ ffpaa.1.in \
+ ffptree.1.in \
+ ffpboot.1.in \
+ ffpjsd.1.in \
+ ffpmerge.1.in \
+ ffpre.1.in \
+ ffpreprof.1.in \
+ ffprwn.1.in \
+ ffpry.1.in \
+ ffpvocab.1.in \
+ ffpvprof.1.in \
+ ffpcol.1.in \
+ ffptxt.1.in \
+ ffpfilt.1.in \
+ ffpcomplex.1.in \
+ ffpsubnam.1.in \
+ ffpdf.1.in
+
+CLEANFILES = \
+ ffpaa.1 \
+ ffptree.1 \
+ ffpboot.1 \
+ ffpjsd.1 \
+ ffpmerge.1 \
+ ffpre.1 \
+ ffpreprof.1 \
+ ffprwn.1 \
+ ffpry.1 \
+ ffpvocab.1 \
+ ffpvprof.1 \
+ ffpcol.1 \
+ ffptxt.1 \
+ ffpfilt.1 \
+ ffpcomplex.1 \
+ ffpsubnam.1 \
+ ffpdf.1
+
+
diff --git a/man/Makefile.in b/man/Makefile.in
new file mode 100644
index 0000000..f99aa16
--- /dev/null
+++ b/man/Makefile.in
@@ -0,0 +1,539 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = man
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+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;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+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/||"
+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] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)"
+NROFF = nroff
+MANS = $(man_MANS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT = @GETOPT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ISOSX = @ISOSX@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKTEMP = @MKTEMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+man_MANS = \
+ ffpaa.1 \
+ ffptree.1 \
+ ffpboot.1 \
+ ffpjsd.1 \
+ ffpmerge.1 \
+ ffpre.1 \
+ ffpreprof.1 \
+ ffprwn.1 \
+ ffpry.1 \
+ ffpvocab.1 \
+ ffpvprof.1 \
+ ffpcol.1 \
+ ffptxt.1 \
+ ffpfilt.1 \
+ ffpcomplex.1 \
+ ffpsubnam.1 \
+ ffpdf.1
+
+COPY = $$(date +'%Y')
+DATE = $$(date +'%B %-d, %Y')
+do_subst = sed -e 's,\[@\]VERSION\[@\],$(PACKAGE_VERSION),g' \
+ -e "s|\[@\]DATE\[@\]|$(DATE)|g" \
+ -e "s|\[@\]COPY\[@\]|$(COPY)|g"
+
+EXTRA_DIST = \
+ ffpaa.1.in \
+ ffptree.1.in \
+ ffpboot.1.in \
+ ffpjsd.1.in \
+ ffpmerge.1.in \
+ ffpre.1.in \
+ ffpreprof.1.in \
+ ffprwn.1.in \
+ ffpry.1.in \
+ ffpvocab.1.in \
+ ffpvprof.1.in \
+ ffpcol.1.in \
+ ffptxt.1.in \
+ ffpfilt.1.in \
+ ffpcomplex.1.in \
+ ffpsubnam.1.in \
+ ffpdf.1.in
+
+CLEANFILES = \
+ ffpaa.1 \
+ ffptree.1 \
+ ffpboot.1 \
+ ffpjsd.1 \
+ ffpmerge.1 \
+ ffpre.1 \
+ ffpreprof.1 \
+ ffprwn.1 \
+ ffpry.1 \
+ ffpvocab.1 \
+ ffpvprof.1 \
+ ffpcol.1 \
+ ffptxt.1 \
+ ffpfilt.1 \
+ ffpcomplex.1 \
+ ffpsubnam.1 \
+ ffpdf.1
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-man1: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ { for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$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)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ test -z "$$files" || { \
+ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically \`make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+ uninstall-am uninstall-man uninstall-man1
+
+
+ffpaa.1 : ffpaa.1.in Makefile
+ $(do_subst) < $(srcdir)/ffpaa.1.in > ffpaa.1
+
+ffptree.1 : ffptree.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffptree.1.in > ffptree.1
+
+ffpboot.1 : ffpboot.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpboot.1.in > ffpboot.1
+
+ffpjsd.1 : ffpjsd.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpjsd.1.in > ffpjsd.1
+
+ffpmerge.1 : ffpmerge.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpmerge.1.in > ffpmerge.1
+
+ffpre.1 : ffpre.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpre.1.in > ffpre.1
+
+ffpreprof.1 : ffpreprof.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpreprof.1.in > ffpreprof.1
+
+ffprwn.1 : ffprwn.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffprwn.1.in > ffprwn.1
+
+ffpry.1 : ffpry.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpry.1.in > ffpry.1
+
+ffpvocab.1 : ffpvocab.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpvocab.1.in > ffpvocab.1
+
+ffpvprof.1 : ffpvprof.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpvprof.1.in > ffpvprof.1
+
+ffpcol.1 : ffpcol.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpcol.1.in > ffpcol.1
+
+ffptxt.1 : ffptxt.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffptxt.1.in > ffptxt.1
+
+ffpfilt.1 : ffpfilt.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpfilt.1.in > ffpfilt.1
+
+ffpcomplex.1 : ffpcomplex.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpcomplex.1.in > ffpcomplex.1
+
+ffpdf.1 : ffpdf.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpdf.1.in > ffpdf.1
+
+ffpsubnam.1 : ffpsubnam.1.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpsubnam.1.in > ffpsubnam.1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/man/ffpaa.1.in b/man/ffpaa.1.in
new file mode 100644
index 0000000..ac6a87a
--- /dev/null
+++ b/man/ffpaa.1.in
@@ -0,0 +1,168 @@
+.de CW
+. nop \f[C]\\$*\f[]
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpaa 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpaa \- This program generates an FFP vector of amino acid features.
+.SH SYNOPSIS
+.BI "ffpaa [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options the default behavior of the program is to
+generate a Feature Frequency Profile (FFP) using features of length
+4. By default amino acids are divided and counted using 11 equivalent
+classes: (ST),(DE),(KQR),(IVLM),(FWY),C,G,A,N,H,P [Li et al. (2003) Peds, 16. 323].
+For multicharacter classes the amino acid is reported in the ffp output by the first character
+in the series. For example, (IVLM) is represented by I.
+.SH OPTIONS
+.TP
+.BI "\-l " "LEN" ", --length=" "LEN"
+.RI "Changes the default length of features to " "LEN" ". The default length is 4,"
+with a maximum length allowed of 40.
+You may overide this maximum length by setting (and exporting)
+the environmental variable MAX_WORD_SIZE to a different value.
+.TP
+.BI "\-f " "FILE" ", --feature-list=" "FILE"
+Changes the behavior of the program to read
+.RI "a list of features from " "FILE" ". Features can"
+be space or newline delimited.
+.TP
+.BI "\-w " "STR" ", --mask=" "STR"
+.RI "Use character " "STR" " of length " "LEN" " which specifies"
+a character mask for the features. For example "1111101111" means to ignore the 6th character of a feature.
+.TP
+.BI "\-z " "INT" ", --rand-mask=" "INT"
+Create a random character mask which allows up to
+.IR "INT" " mismatches. No greater than " "LEN"
+in mismatches is allowed. The character mask is
+printed to standard error at the beginning of
+execution.
+.TP
+.BI "\-s " "INT" ", --rand-seed=" "INT"
+Seed the random number generator. Randomization
+.RB "operations like " "-z" " are fixed and predictable across different runs."
+By default the seed is (system time) * (process ID).
+.TP
+.BI "\-q, --quiet"
+Run in quiet mode. Suppresses printing to standard error. This effects option
+.BR "\-z" "."
+.TP
+.BI "\-d, --disable-classes"
+Disable classing of amino acids. Use 20 symbol amino acid coding.
+.TP
+.B "\-m, --multiple"
+.IR "FILE " "contains multiple FASTA sequences and an FFP is desired for each sequence."
+.TP
+.B "\-h, --help"
+Display help message.
+.TP
+.B "\-v, --version"
+Display version.
+.PP
+.SH EXAMPLES
+The command:
+.PP
+ffpaa -l 3 file*.faa
+.PP
+Will produce a output of this form, using features of length 3:
+.PP
+.CODE AGK 2 ASS 3 AKF 4 ...
+.br
+.CODE AKK 3 AKS 2 AKF 5 ...
+.PP
+There will be one FFP line for each
+.CW .faa
+file supplied in the argument list and each will be printed in the order
+specified on the command line. Note, the above uses the order in which the
+shell (i.e. bash, cshell, etc.) expands the file argument wildcard,
+.C *.faa.
+In the even this is undesired, the format format below can also be used
+to explicitly control the ordering:
+.PP
+.CODE ffpaa -l 4 file1.faa file2.faa file3.faa
+.PP
+A mask can be applied to feature counting to allow mismatches using the
+.B \-w
+command. For example if a mismatch is to be allowed
+at the second and fourth positions of a feature with length
+.IR "l" "=6, " "this can be done via:"
+.PP
+.CODE ffpaa -l 6 -w "101011" file*.fna
+.PP
+If mismatches are desired but no specific pattern is necessary
+then one can use the
+.B -z
+option.
+.PP
+.CODE ffpaa -z 2 file1.faa file2.faa.
+.PP
+This will produce a random mask of at least two mismatches (within a feature with
+a default length of 4). The mask
+is printed to standard error. To save the mask for
+later reference, you can direct standard error to a file.
+For example:
+.PP
+.CODE ffpaa -z 3 file*.fna > vector 2> mask
+.PP
+The redirection
+.CW >2
+sends standard error to the file
+.CW mask.
+.PP
+.PP
+To disable classing of amino acids, (i.e. make FFP consider
+.RB "R and K different -- and therefore count each symbol separately) use the " "-d" " option"
+.PP
+.PP
+The utilities in the FFP package can be used as fully
+qualified filters and can be used to build pipelines.
+The pipeline below will create a Phylip infile format distance
+matrix, using the Jensen Shannon divergence:
+.PP
+.CODE ffpaa -l 7 file*.fna | ffpcol -a | ffprwn | ffpjsd -p taxa.txt > infile
+.PP
+Note, the desired taxa names must be specified in the argument to
+.BR "\-p" ","
+see
+.BR ffpjsd(1)
+.
+.PP
+To disable classing of animo acids you should incorporate the
+.B \-d
+option into the above pipeline -- both in the call to
+.B ffpaa
+and
+.B ffpcol.
+.PP
+.CODE ffpaa -l 7 -d file*.fna | ffpcol -a -d | ffprwn ...
+.PP
+Bootstrap and jacknife resampling can be done with the
+ffpboot program, see
+.BR ffpboot(1).
+.PP
+.SH FURTHER DIRECTIONS
+Command line definable character classes.
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpry(1),
+.BR ffprwn(1),
+.BR ffpjsd(1),
+.BR ffpcol(1),
+.BR ffpmerge(1),
+.BR ffpboot(1),
+.BR ffpvprof(1),
+.BR ffpreprof(1),
+.BR ffptree(1)
diff --git a/man/ffpboot.1.in b/man/ffpboot.1.in
new file mode 100644
index 0000000..78f2ce7
--- /dev/null
+++ b/man/ffpboot.1.in
@@ -0,0 +1,101 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpboot 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpboot \- This program performs bootstrap permutations of the FFP vector.
+.SH SYNOPSIS
+.BI "ffpboot [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options, the default behavior of the program is to
+calculate a bootstrap permutation.
+This utility should be used
+as a filter before using
+.B ffprwn.
+FFPs will be read from standard input if no options are supplied and
+.B ffpboot
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list.
+.SH OPTIONS
+.TP
+.BI "\-j, --jackknife"
+Perform deletion jacknife instead of bootstrap. Default
+deletion percentage is 1/e.
+.TP
+.BI "\-p " "FLOAT" ", --delete-prob=" "FLOAT"
+.RI "Specify jacknife deletion Probabilitiy, " "FLOAT" ", ranging between 0 and 1."
+.TP
+.BI "\-s " "INT" ", --rand-seed=" "INT"
+.RI "Specify random seed, " "INT" "."
+The default is (system time) * (process ID).
+.TP
+.B "\-h, --help"
+Display help message.
+.PP
+.SH EXAMPLES
+To create bootstrap pseudoreplicate:
+.PP
+.CODE ffpry -l 6 test*.fna | ffpcol > vector
+.CODE ffpboot vector > boot
+.PP
+To create many pseudoreplicates use the shell's looping
+facilities. This example below creates 100 psuedoreplicates,
+using a small snippet of Bash shell scripting -- the equivalent
+should be possible using all other shell variants (c-shell, zsh, etc.)
+.PP
+.CODE for i in $(seq 1 1 100) ; do
+.CODE \tffpboot vector > boot.$i
+.CODE done
+.PP
+.RB "The bootstrap pseudoreplicates can be used as input to " "ffprwn" ":"
+.PP
+.CODE ffpboot vector | ffprwn | ffpjsd
+.PP
+.RB "To perform a deletion jackknife instead use the " "-j" " option."
+.PP
+.CODE ffpboot -j -p 0.10 vector > jack
+.PP
+The above example sets the probability of feature deletion
+in the jackknifing process to 10%.
+.PP
+As of version 3.06, there is a streamlined method of generating
+pseudo-replicate trees, which can be used in the phylip program
+.CW consense
+to build a consensus tree.
+.PP
+.CODE for i in {1..100} ; do
+.CODE \tffpboot vector | ffprwn | ffpjsd -p species.txt | ffptree -q
+.CODE done > intree
+.PP
+The final output
+.CW intree
+contains multiple sets of Newick format tree files which can be
+used directly in
+.CW consense.
+.PP
+.SH FURTHER DIRECTIONS
+Option to create multiple replicates in a single exection.
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1),
+.BR ffpry(1),
+.BR ffprwn(1),
+.BR ffpjsd(1),
+.BR ffpcol(1),
+.BR ffpmerge(1),
+.BR ffpvprof(1),
+.BR ffptree(1),
+.BR ffpreprof(1)
diff --git a/man/ffpcol.1.in b/man/ffpcol.1.in
new file mode 100644
index 0000000..0cdf76f
--- /dev/null
+++ b/man/ffpcol.1.in
@@ -0,0 +1,143 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpcol 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpcol - This program creates columnar FFPs from key-value output of ffpry.
+.SH SYNOPSIS
+.BI "ffpcol [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options, the default behavior of the program is to
+convert key-value FFPs to columnar format. This utility is used to convert the output of
+.BR "ffpry" ","
+.BR "ffpaa" ","
+or
+.BR "ffptxt"
+.RB " to the format required for " ffprwn " if the FFP"
+has been saved in key-value format.
+FFPs will be read from standard input if no options are supplied and
+.B ffpcol
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the file
+argument list. The default input type is a key-value nucleotide FFP.
+When input is directed from a pipe a temporary file is created in the environmentally
+defined TMP directory or /tmp if this variable is undefined.
+
+.SH OPTIONS
+.TP
+.B \-h, --help
+Display help command.
+.TP
+.B \-a, --amino
+Input is an amino acid FFP. Default is nucleotide.
+.TP
+.B \-t, --text
+Input is 26 letter text. Default is nucleotide.
+.TP
+.B \-d, --disable
+Disable classing of either nucleotide or amino acid sequence.
+.TP
+.B \-V, --verbose
+Be more verbose.
+.TP
+.B \-v, --version
+Print version information
+.TP
+.B \-h, --help
+This help message
+.PP
+.SH EXAMPLES
+.PP
+A columnar format file produced by
+.B ffpcol
+is the main interchange format to pass
+FFPs to a number of other utilities. Sample input from
+a feature counter such as
+.B ffpry
+may resemble something like this:
+.PP
+.CODE ATG 2 TGC 3 GGA 4 ...
+.CODE TGC 1 CAC 2 GGA 1 ...
+.PP
+From the key-value input format,
+.B ffpcol
+will find all the features contained in all the FFPs
+and align the feature frequency in the same tab delimited column,
+printing out zeros if a feature is missing in a particular
+row. The actual sequence of the feature is discarded at
+this point. The columnar format files produced from input like that above
+will look like:
+.PP
+.CODE 2 3 0 4
+.CODE 0 1 2 1
+.PP
+.RB "To convert a (key,value) FFP for use in " ffprwn,
+simply arrange the conversion process
+as a pipeline, whereby the standard output of one utility is sent to the standard input of
+another:
+.PP
+.CODE ffpry -l 2 *.fna | ffpcol | ffprwn
+.PP
+To disable classing use this format
+(take special node of the
+.B \-d
+switch in both of the calls to
+.B ffpry
+and
+.BR "ffpcol" "):"
+.PP
+.CODE ffpry -l 4 -d *.fna | ffpcol -d | ffprwn
+.PP
+For amino acids, use the
+.B \-a
+option:
+.PP
+.CODE ffpaa -l 4 *.faa | ffpcol -a | ffprwn
+.PP
+To disable classing for amino acids use
+the options
+.B \-a
+and
+.BR "\-d" ","
+or in stacked form,
+.BR "\-ad" ":"
+.PP
+.CODE ffpaa -l 4 -d *.faa | ffpcol -ad | ffprwn
+.PP
+Likewise for text input use
+.BR "\-t" ":"
+.PP
+.CODE ffptxt -l 6 *.txt | ffpcol -t | ffprwn
+.PP
+Note when piping output from a utility into
+.B ffpcol
+via a pipe that a temp file is created ( from the output of
+preceding command ), whereas input from file
+arguments or via input redirection (i.e.
+.CW ffpcol < file
+) doesn't require temp files. Temporary files are written
+to
+.CW /tmp
+-- upon creation they are immediately unlinked
+so they are effectively 'hidden' temp files.
+.SH FUTURE DIRECTIONS
+Conversion to Rabin-Karp Hash function.
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpry(1),
+.BR ffpaa(1)
+.BR ffptxt(1)
+.BR ffprwn(1),
+.BR ffpjsd(1)
diff --git a/man/ffpcomplex.1.in b/man/ffpcomplex.1.in
new file mode 100644
index 0000000..7bfb0c3
--- /dev/null
+++ b/man/ffpcomplex.1.in
@@ -0,0 +1,129 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpcomplex 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpcomplex - This program filters FFP profiles based on the complexity of features.
+.SH SYNOPSIS
+.BI "ffpcomplex [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+This utility can be used to filter high or low complexity features
+from the FFP matrix. The upper and/or lower limits can be set
+using a complexity cuttoff (the default) or a probability cutoff can be used
+assuming a normal distribution. Probability limits are
+the cummulative probability values from the normal distribution
+found from the calculated mean and stdev of the input FFP.
+Requires key-valued FFP input.
+FFPs will be read from standard input if no options are supplied and
+.B ffpcomplex
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list. The default input type is assumed to be nucleotide sequence.
+.SH OPTIONS
+.TP
+.B -s, --stats
+.PP
+Print statistics describing the FFP complexity distribution to
+standard error.
+.TP
+.BI "-u " "FLOAT, " "--upper=" "FLOAT"
+.PP
+.RI "The upper threshold limit for feature complexity where " "FLOAT" " can be "
+.RI "any complexity value or for probability distributions, in which case" " FLOAT "
+can range from 0 to 1 -- representing the probability in a cummulative distribution
+function.
+.RB "This can be used in conjunction with " "-l" " or by itself."
+.TP
+.BI "-l " "FLOAT, " "--lower=" "FLOAT"
+.PP
+.RB "The lower threshold limit. This can be used in conjuntion with " "-u" " or by itself."
+.TP
+.B -n, --norm
+.PP
+Use a normal distribution for filtering. Default is the raw complexity values.
+.TP
+.B -d, --disable
+.PP
+Disable classing of amino acid and nucleotide sequences.
+.TP
+.B -a, --amino
+.PP
+Input FFPs are animo acid sequences.
+.TP
+.B -t, --text
+.PP
+Input FFPs are text.
+.TP
+.B -h, --help
+.PP
+Display short help message.
+.TP
+.B -v, --version
+.PP
+Display version information.
+.PP
+.SH EXAMPLES
+The main usage of this progam is for filtering out low complexity
+features, for example features which primarily represent repetitive
+DNA might be need to be filtered out -- since they don't provide much
+useful phylogenetic signal. To get an idea about what the complexity
+of the words in your FFPs are you can use the
+.B \-s
+option to get a statistical report, which includes the mean, range
+and standard deviation of complexity. The complexity of a feature
+is determined by finding the total entropy of all individual sub features
+for all
+.I k
+less than
+.I l,
+which is the length of the feature. For example given the feature
+.PP
+.CODE GCGCGCGC
+.PP
+determine the entropy of
+.IR "k" "=1,"
+which which is H(1) = f(G)log f(G) + f(C)log f(C). Next determine the entropy
+of all
+.iR "k" "=2,"
+sub-mers, H(2) = f(GC)log f(GC) + f(CG)log f(CG). Repeat for all
+.I k
+less than
+.IR "l" "."
+The total complexity of the
+.IR "l" "-mer"
+is H(l) = H(1) + H(2) + ... + H(l-1).
+Here we filter out all features with complexity less than 1.0:
+.PP
+.CODE ffpry -l 5 *.fna > vectors
+.CODE ffpcomplex -l 1.0 vectors > vectors.filt
+.PP
+Features with high and low complexities can
+be removed simultaneously. This example excludes all features which
+with complexity greater than 10 and less than 2.
+.PP
+.CODE ffpcomplex -u 10.0 -l 2.0
+.PP
+Finally we can assume that the complexities of the features used follow a specific
+distribution (usually the normal distribution is the appropriate choice).
+We can exclude features that lie outside a certain range of the cummulative
+probability distribution. Here we exclude all features which lie below
+10% and above 95% of the normal CDF.
+.PP
+.CODE ffpcomplex -n -l 0.1 -u 0.95
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpry(1),
+.BR ffpfilt(1)
diff --git a/man/ffpdf.1.in b/man/ffpdf.1.in
new file mode 100644
index 0000000..78c7848
--- /dev/null
+++ b/man/ffpdf.1.in
@@ -0,0 +1,139 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpdf 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpdf \- Outputs clade distinguishing features for specified clades.
+.SH SYNOPSIS
+.BI "ffpdf [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+This is used to discover distinguishing (or diagnostic) features (DFs)
+that are present in a specific clade and no other clades. This
+technique was used in the paper: Sims GE, and Kim SH (2010), PNAS, 108,
+8329-34. This ultility should be used as a filter for the output of
+.BR "ffpry" ","
+.BR "ffpaa" ","
+or
+.B ffptxt
+using key-valued FFPs input. Given no file arguments, the FFP input can
+be piped into STDIN. If a group (i.e. clade) file is specified but no group is
+specified then, the group file is ignored. You must query individual
+groups separately. Output is a tab delimited list of the features.
+.SH OPTIONS
+.TP
+.BI "\-f " "FILE" ", --group-file=" "FILE"
+Specify clades/groups.
+FILE is a newline delimited file which indicates which row of the FFP file
+belongs to which clade. FILE has a format specifying one newline delimited symbol per
+row. See
+.B EXAMPLES
+below. If not specified then all rows are assumed to be
+in the same clade. Use in conjunction with option
+.BR "\-g" "."
+.TP
+.BI "\-g " "STR" ", --group=" "STR"
+Select the clade where the DF search will be performed. If not specifed all rows of
+the FFP are assumed part of one clade.
+.TP
+.BI "\-p " "FLT" ", --percent=" "FLT"
+Specify a fractional cutoff for the percentage ( i.e. 50% = 0.5) of
+a group members which which need to have a feature for it to be considered a DF. The
+default is all group members or 1.0.
+.TP
+.B "\-v, --version"
+Display version information.
+.TP
+.B "\-h, --help"
+Display help message.
+.PP
+.SH EXAMPLES
+A distinguishing feature is a feature which is present in all FFPs of a
+given group, but absent in all other groups. Given these example rows from
+an FFP matrix,
+.PP
+.CODE Taxon 1 ... ATG 3 CAC 2 TGA 3 ...
+.CODE Taxon 2 ... ATG 2 CAC 1 TTG 1 ...
+.CODE Taxon 3 ... ATG 4 TGC 3 GGA 2 ...
+.PP
+and the additional information that taxa 1 and 2 belong to group A and
+taxon 3 belongs to group B, we can give an example of a DF.
+The feature,
+.CW ATG
+,is not a DF for either group A or B, since it is
+present in all groups. However feature
+.CW CAC
+is a DF for group A, since it is present in only group A and not group B. Likewise feature
+.CW TGA
+and
+.CW TTG
+are not DFs of group A because neither is present in all
+members of that group.
+.PP
+To find distinguishing features in an FFP, first you must create an FFP,
+using one of the feature counting utilities,
+.BR "ffpry" ","
+.BR "ffpaa" ","
+or
+.BR "ffptxt" "."
+The example below illustrates the method for RY-coded nucleotide sequences,
+where we want to find features which are universally shared among all taxa
+specified in the FFP input file.
+.PP
+.CODE ffpry -l 6 test*.fna > vector
+.CODE ffpdf vector > dfs
+.PP
+or alternatively, combining the separate commands as one pipeline:
+.PP
+.CODE ffpry -l 6 test*.fna | ffpdf > dfs
+.PP
+The above example assumes every row (genome, species, or sequences) is
+a member of the same group (clade). For multiple clades, use the
+.B --group-file
+option to specify the clade structure. This is defined
+by building a newline delimited group-file definition.
+Lets say there are 5 genomes and there are two
+clades, the 2nd and 3rd rows of the FFP, belong to clade A and the
+remainder belong to clade B., then the group file should have the
+format below
+.PP
+.CODE $ cat groupfile
+.CODE B
+.CODE A
+.CODE A
+.CODE B
+.CODE B
+.PP
+Now that clades have been defined we can extract out the DFs for
+clade A or B separately (A in this case below).
+.PP
+.CODE ffpry -l 6 test*.fna | ffpdf --group-file="groups.txt" --group="A" > dfs.A
+.PP
+Multi-character alphanumeric symbols can also be specified for group names.
+Note however, any whitespace will be stripped from group names.
+.PP
+Also, note that by default a DF is defined as a feature which is present in
+all members of a group. This defintion can be relaxed slightly by using the
+.B \-p
+option to specify the percentage of taxa within a given group which must have a feature
+in order for it to be considered a DF. For example if we wanted to find out which
+features are present in 2 out of 3 taxa in group B we can use this syntax:
+.PP
+.CODE ffpry -l 6 test*.fna | ffpdf -p 0.66 --group-file="groups.txt" --group="A" > dfs.B
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1),
+.BR ffpry(1)
diff --git a/man/ffpfilt.1.in b/man/ffpfilt.1.in
new file mode 100644
index 0000000..ab06260
--- /dev/null
+++ b/man/ffpfilt.1.in
@@ -0,0 +1,132 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpfilt 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpfilt - This program filters FFP profiles based on numeric/statistical properties.
+.SH SYNOPSIS
+.BI "ffpfilt [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+This utility can be used to filter high or low frequency features
+from the FFP matrix. The upper and/or lower limits can be set
+using a raw frequency cutoff or a probability cutoff which
+assumes either a normal or an extreme value distribution.
+Requires key-valued FFP input. Note you should use this as a replacement for
+.B ffpcol
+in any pipelines (rather than in addition to) as
+.B ffpfilt
+produces columnar output. Columnar output can be disabled with the
+.B --keys
+option. FFPs will be read from standard input if no options are supplied and
+.B ffpfilt
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list. The default input is assumed to be nucleotide sequence.
+
+
+.SH OPTIONS
+.TP
+.B -s, --stats
+.PP
+Print statistics describing the FFP frequency distribution to
+standard error.
+.TP
+.B -z, --zeros
+.PP
+Include zeros is calculation of statistical parameters. When few
+features are observed, but a long feature length is used this
+has the effect of skewing the feature distribution towards zero.
+.TP
+.BI "-u " "FLOAT, " "--upper=" "FLOAT"
+.PP
+.RI "The upper threshold limit for raw frequencies where " "FLOAT" " can be "
+.RI "any frequency value or for probability distributions, in which case" " FLOAT "
+can range from 0 to 1.
+.TP
+.BI "-l " "FLOAT, " "--lower=" "FLOAT"
+.PP
+The lower threshold limit.
+.TP
+.B -f, --freq
+.PP
+Use raw frequencies for filtering
+.TP
+.B -n, --norm
+.PP
+Use a normal distribution for filtering
+.TP
+.B -e, --evd
+.PP
+Use an extreme value (Gumbel) distribution for filtering
+.TP
+.B -d, --disable
+.PP
+Disable classing of amino acid and nucleotide sequences.
+.TP
+.B -a, --amino
+.PP
+Input FFPs are animo acid sequences.
+.TP
+.B -t, --text
+.PP
+Input FFPs are text.
+.TP
+.B -k, --keys
+.PP
+Force key,value output. Default it columnar output.
+.TP
+.B -h, --help
+.PP
+Display short help message.
+.TP
+.B -v, --version
+.PP
+Display version information.
+.PP
+.SH EXAMPLES
+The main usage of this progam is for filtering out high frequency
+features, for example large numbers of prophage copies in a genome
+might be need to be filtered out -- since they don't provide much
+useful phylogenetic signal. Here we filter out all features which
+occur more than 5 times using the
+.B \-u
+option.
+.PP
+.CODE ffpry -l 5 *.fna > vectors
+.CODE ffpfilt -f -u 5 vectors > vectors.filt
+.PP
+Features which occur rarely and features which occur frequently can
+be removed simultaneously. This example excludes all features which
+occur more than 10 times and less than 2 times.
+.PP
+.CODE ffpfilt -f -u 10 -u 2
+.PP
+Finally we can assume that the feature frequencies follow a specific
+distribution. Usually the extreme value distribution [EVD] is the appropriate choice,
+however you should confirm what the distribution of your feature frequencies are
+yourself. We can exclude features that lie outside a certain range of the cummulative
+probability distribution. Here we exclude all features which lie below
+10% and above 95% of the EVD cummulative distribution function.
+.PP
+.CODE ffpfilt -e -l 0.1 -u 0.95
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1),
+.BR ffpry(1),
+.BR ffprwn(1),
+.BR ffpjsd(1),
+.BR ffpcol(1)
+
diff --git a/man/ffpjsd.1.in b/man/ffpjsd.1.in
new file mode 100644
index 0000000..d2ee804
--- /dev/null
+++ b/man/ffpjsd.1.in
@@ -0,0 +1,222 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpjsd 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpjsd \- Calculates a Jensen Shannon divergence matrix from a row
+normalized vector FFP.
+.SH SYNOPSIS
+.BI "ffpjsd [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options, the default behavior of the program is to
+generate a symmetric Jensen Shannon divergence matrix. Rather
+than this divergence, other metrics can be used with the
+appropriate options.
+FFPs will be read from standard input if no options are supplied and
+.B ffpjsd
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list. Row normalization with
+.B ffprwn
+is required to use the default metric, the Jensen Shannon divergence. Other
+distance metrics such as the continuous distance measures can be used with
+or without row normalization with different effects. Row normalization is
+not necessary with binary distances and has no effect.
+.SH OPTIONS
+.TP
+.BI "\-p " "FILE" ", --phylip=" "FILE"
+Creates a phylip format 'infile'. FILE
+specifies the taxon names to use. Must be equal to the number of FFP vectors rows.
+Note the taxon names should be unique. Names over 10 characters in length will be
+truncated to exactly 10 -- truncation is enforced to maintain compatiblility
+witht Phylip package.
+.TP
+.BI "\-d " "INT" ", --precision=" "INT"
+Specify INT digits of decimal precision, the default is 2.
+.TP
+.BI "\-r " "ROW" ", --row=" "ROW"
+Specify a single row of the distance matrix to calculate. This option
+is useful for especially large matrices where the different rows can be
+calculated in a multi-processor environment. Currently only works with
+the Jensen Shannon divergence metric.
+.TP
+.B -s, --similarity
+Print a similarity matrix rather than a distance matrix. This option effects
+the output of distances metrics which have a value normalized from 0 to 1 or
+-1 to 1, which includes the metrics specified by the options:
+.B \-RcmjtdNSaPBguyok.
+.TP
+.B -h, --help
+Display help message.
+.TP
+.B -v, --version
+Display version information.
+.PP
+.SS CONTINUOUS DISTANCE MEASURES
+.TP
+.B -e, --euclid
+Calculate a Euclidean distance matrix rather than the default JSD matrix.
+Node, that the norm of the distance can by changed with the
+.B \-n
+option, however the default norm is 2.
+.TP
+.B -E, --euclid2
+Calculate a Euclidean squared distance matrix.
+.TP
+.BI "\-n " "FLOAT" ", --normval=" "FLOAT"
+.RB "For option " "-e" ", change the n-norm distance (Default is n=2) to"
+any other value where n > 1
+.TP
+.B -c, --cosine
+Calculate a Cosine distance matrix rather than default JSD matrix. With option
+.BR "-s" " this is the similarity matrix."
+.TP
+.B -m, --manhattan
+Calculate a Manhattan distance matrix rather than default JSD matrix.
+.TP
+.B -R, --pearson
+.RB "Use the pearson correlation coefficient. With the " "-s" " option a similarity"
+matrix will be printed out. Note this is R not, R_squared.
+Otherwise a distance will be printed, which is 1-R_squared.
+.TP
+.B -C, --chebyshev
+Compute the Chebyshev distance, which is the maximum difference between
+a pair of features.
+.TP
+.B -b, --canberra
+Compute the Canberra distance matrix.
+.TP
+.B -H, --hamming
+Compute the hamming distance.
+.TP
+.B -L, --evol
+Compute the Evolutionary Distance used in E.coli Publications.
+.TP
+.PP
+.SS BINARY DISTANCE MEASURES
+.PP
+With these options the input FFPs are treated as binary data.
+When two FFPs (i and j) are compared each
+distance measure uses a cross tabulation for pairwise feature
+comparison with sums A, B, C and D. A is the number of features
+which are present in both vectors while D is the number of features
+that are absent in both vectors. B means the feature is present in
+i and absent in j. C means the feature is absent in i but present in j.
+N is the sum of A+B+C+D. All of the binary distance options can
+.RB "be used together with the " "-s" " option to print a similarity matrix."
+THe binary distance do not need to be normalized with
+.B ffprwn.
+.TP
+.B -M, --matching
+Compute the matching distance matrix, which is 1-(A+D)/N. With
+.RB "the additional option " "-s" " this is the matching similarity: (A+D)/N."
+.TP
+.B -j, --jaccard
+Compute the Jaccard distance matrix, which is 1-A/(N-D). With the
+.RB "additional option " "-s" " this is the Jaccard similarity: A/(N-D)"
+.TP
+.B -t, --tanimoto
+Compute the Rogers-Tanimoto distance matrix, which is 1-(A+D)/((A+D)+2(B+C)).
+.RB "With option " "-s" " this is the Tanimoto similarity matrix: (A+D)/((A+D)+2(B+C))."
+.TP
+.B -D, --dice
+Compute the Dice distance matrix, which is 1-2A/(2A+B+C). With option
+.BR "-s" " this is the Dice similarity: 2A/(2A+B+C)."
+.TP
+.B -N, --antidice
+Compute the anti-Dice distance matrix, which is 1-A/(A+2(B+C)). With option
+.BR "-s" " this is the anti-Dice similarity: A/(A+2(B+C))."
+.TP
+.B -S, --sneath
+Compute the Sneath-Sokal distance matrix, which is 1-2(A+D)/(2(A+D)+(B+C)). With
+.RB "option " "-s" " this is the similarity matrix: 2(A+D)/(2(A+D)+(B+C))."
+.TP
+.B -a, --hamman
+Compute the Hamman distance matrix, which is 1-[((A+D)-(B+C))/N]^2. With
+.RB "option " "-s" " this is the similarity matrix: ((A+D)-(B+C))/N, which ranges from"
+-1 to 1.
+.TP
+.B -P, --phi
+Compute the Pearson Phi distance matrix, which is 1-[(AD-BC)/sqrt((A+B)(A+C)(D+B)(D+C))]^2.
+.RB " With option " "-s" " this is the similarity matrix: (AD-BC)/sqrt((A+B)(A+C)(D+B)(D+C)), which"
+ranges from -1 to 1.
+.TP
+.B -B, --anderberg
+Compute the Anderberg distance matrix, which is 1-(A/(A+B)+A/(A+C)+D/(C+D)+D/(B+D))/4.
+.RB "With option " "-s" " this is the similarity matrix: (A/(A+B)+A/(A+C)+D/(C+D)+D/(B+D))/4."
+.TP
+.B -g, --gower
+Compute the Gower distance matrix, which is 1-AD/sqrt((A+B)(A+C)(D+B(D+C)). With option
+.BR "-s" " this is the similarity matrix: AD/sqrt((A+B)(A+C)(D+B(D+C))."
+.TP
+.B -u, --russel
+.RB "Compute the Russel-Rao distance matrix, which is 1-A/N. With option " "-s" " this is the similarity"
+matrix: A/N.
+.TP
+.B -y, --yule
+.RB "Compute the Yule distance matrix, which is 1-[(AD-BC)/(AD+BC)]^2. With option " "-s"
+this is the similarity matrix: (AD-BC)/(AD+BC) which ranges from -1 to 1.
+.TP
+.B -o, --ochiai
+Compute the Ochiai distance matrix, which is 1-A/sqrt((A+B)(A+C)). With option
+.BR "-s" " this is the similarity matrix: A/sqrt((A+B)(A+C))."
+.TP
+.B -k, --kulczynski
+Compute the Kulczynski distance matrix, which is 1-(A/(A+B)+A/(A+C))/2. With
+.RB "option " "-s" " this is the similarity matrix: (A/(A+B)+A/(A+C))/2."
+.PP
+.SH EXAMPLES
+.P
+This utility is used as the final filter and can
+produce a final distance matrix representing FFP based
+sequence similarity.
+.PP
+.CODE ffpry -l 5 test*.fna | ffpcol | ffprwn | ffpjsd > matrix
+.PP
+Using the
+.B -p
+option,
+.B ffpjsd
+can be used to create Phylip format infile output.
+.PP
+.CODE ffpaa -l 4 test*.faa | ffpcol -a | ffprwn | ffpjsd -p species.txt > infile
+.PP
+The Phylip package's distance based tree methods can be used to produce
+phylogenetic trees. Note that
+.CW species.txt
+should contain the names of the taxa that correspond to the rows of the matrix.
+As of version 3.06,
+.B ffptree
+is included in the FFP package which will create neighbor joining or UPGMA trees.
+It can also be included in the general ffp pipeline to produce final tree
+output in Newick format. The pipeline below produces a neighbor joining tree:
+.PP
+.CODE ffpaa -l 4 test*.faa | ffpcol -a | ffprwn |
+.CODE ffpjsd -p species.txt | ffptree -q > tree
+.PP
+.SH FURTHER DIRECTIONS
+Extend row based -r option to distance measures other than
+JSD.
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+opyright (C) [@]COPY[@] Gregory E. Sims
+.BR
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1),
+.BR ffpry(1),
+.BR ffprwn(1),
+.BR ffpboot(1),
+.BR ffpcol(1),
+.BR ffpmerge(1),
+.BR ffpvprof(1),
+.BR ffptree(1),
+.BR ffpreprof(1)
diff --git a/man/ffpmerge.1.in b/man/ffpmerge.1.in
new file mode 100644
index 0000000..b39a3f2
--- /dev/null
+++ b/man/ffpmerge.1.in
@@ -0,0 +1,77 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpmerge 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpmerge - This program merges the rows of an FFP into a single row.
+.SH SYNOPSIS
+.BI "ffpmerge [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+The behavior of the program is to merge all rows of the FFP. The
+FFP can be a columnar or key-valued FFP.
+FFPs will be read from standard input if no options are supplied and
+.B ffpmerge
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list.
+
+.SH OPTIONS
+.TP
+.B -d, --disable
+Disable classing of amino acid and nucleotide sequences.
+.TP
+.B -k, --keys
+Print key value pairs. Default is output in columnar format.
+.TP
+.B -a, --amino
+Input FFPs are animo acid sequences.
+.TP
+.B -t, --text
+Input FFPs are text.
+.TP
+.B -v, --version
+Display version.
+.TP
+.B -h, --help
+Display help message.
+.PP
+.SH EXAMPLES
+The main usage of this program is to merge separately calculated
+FFPs from different parts of a large genome. For example consider
+a multi-chromosome genome.
+.PP
+.CODE ffpry -l 5 chr1.fna > chr1.vector
+.CODE ffpry -l 5 chr2.fna > chr2.vector
+.CODE ffpmerge chr*.vector > chrall.vector
+.PP
+The primary advantage of computing the vectors in this way
+is that separate chromosome vectors can be calculated on
+different processes and the process of
+.I "l" "-mer"
+counting can be distributed across a multi-processor
+architecture. If you have many small fasta files which
+you need to merge there is no clear advantages to using the
+count and merge process shown above. In this case, concatenating
+the files together on the fly is more effective:
+.PP
+.CODE cat *.fna | ffpry -l 5 > merged.vector
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1),
+.BR ffpry(1),
+.BR ffprwn(1),
+.BR ffpjsd(1),
+.BR ffpcol(1)
diff --git a/man/ffpre.1.in b/man/ffpre.1.in
new file mode 100644
index 0000000..b2a51cd
--- /dev/null
+++ b/man/ffpre.1.in
@@ -0,0 +1,113 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpre 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpre \- This program calculates the relative entropy between an
+.IR "l" "\-2"
+Markov model estimation of frequency and the observed frequency
+of features. This is used to calculate an upper limit of
+.I l
+to use for phylogenetic inference.
+
+.SH SYNOPSIS
+.BI "ffpre [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options the default behavior of
+.B ffpre
+the progam is to generate the relative entropy value (RE) (also known as the Kullbach-Leibler divergence)
+of feature frequencies using
+.IR "l" "=10"
+and estimates of the frequencies using
+.IR "l" "=9"
+and
+.IR "l" "=8"
+to provide the estimate. To calculate the
+relative entropies for a range of
+.IR "l" ","
+use the shell script supplied
+.B ffpreprof
+with the FFP package, which calculates a relative entopry profile.
+This utility is used to help determine
+the proper feature length range to use for phylogenetic inference.
+When the relative entropy approaches zero, this indicates that the
+frequency of all features can be determined by using the frequencies
+of the
+.IR "l-" "1"
+and
+.IR "l-" "2"
+feature frequencies (i.e. features have the
+same frequency as slightly shorter words). This indicates that each
+.IR "l" ","
+.IR "l-" "1,"
+and
+.IR "l-" "2"
+feature occurs in the same context within the
+sequence. Therefore using lengths longer than when the RE is zero
+provide no additional information. The default assumes nucleic acid
+sequence input.
+.SH OPTIONS
+.TP
+.BI "\-l " "LEN" ", --length=" "LEN"
+.RI "Changes the default length of features to " "LEN" ". The
+default length is 10.
+Maximum length allowed in 40.
+.TP
+.B \-d, --disable-ry
+Disable RY coding to use ATGC coding.
+.TP
+.B \-r, --no-reverse
+Disable reverse complement matching. Applicable to
+nucleotide sequence only.
+.TP
+.B \-a, --amino
+Input is amino acid sequence.
+.TP
+.B \-t, --text
+Input is a text file.
+.TP
+.B \-v, --version
+Print program version.
+.TP
+.B \-h, --help
+Help message.
+.PP
+.SH EXAMPLES
+To calculate the relative entropy between the estimate
+and observed feature frequencies:
+.PP
+.CODE ffpre -l 4 test*.fna
+.PP
+To calculate the RE for a range of lengths use
+.BR "ffpreprof" "."
+Note that the RE may oscillate above or below zero - but
+given long enough
+.I l
+it will eventually approach zero. In mathematical terms
+the limit of
+.IR "KL" "(" "l" ")"
+as
+.I l
+approaches infinity is zero.
+.PP
+.SH FUTURE DIRECTIONS
+None.
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpvprof(1),
+.BR ffpvocab(1),
+.BR ffpreprof(1)
diff --git a/man/ffpreprof.1.in b/man/ffpreprof.1.in
new file mode 100644
index 0000000..d2b980a
--- /dev/null
+++ b/man/ffpreprof.1.in
@@ -0,0 +1,82 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpreprof 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpreprof \- Constructs a relative entropy profile.
+.SH SYNOPSIS
+.BI "ffpreprof [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+.RB "This shell script is a wrapper for the utility " "ffpre" .
+Using it you can calculate the relative entropy over
+a range of feature lengths. Results are displayed
+in columnar format, where the length is the first
+column and the relative entropy is the second column. This
+script should be used to give an indication of the
+upper limit of
+.I l
+that is appropriate for phylogenic inference.
+.SH OPTIONS
+.TP
+.B \-d, --disable-ry
+Use ATGC coding, default is RY.
+.TP
+.B \-a, --amino
+Input is amino acids.
+.TP
+.B \-t, --text
+Input is text.
+.TP
+.B \-r, --no-reverse
+Disable reverse complement matching.
+.TP
+.BI "\-s " "INT" ", --start=" "INT"
+Specify start length range, default 3.
+.TP
+.BI "\-e " "INT" ", --end=" "INT"
+Specify end length range, default 20. The maximum
+word length is 40.
+You may overide this maximum length by setting (and exporting)
+the environmental variable MAX_WORD_SIZE to a different value.
+.
+.TP
+.BI "\-T " "DIR" ", --tmpdir=" "DIR"
+Specify location for temporary files.
+Only applies for reading from standard in.
+.TP
+.BI "\-p " "DIR" ", --path=" "DIR"
+Path to ffpre executable, if not in
+your path.
+.TP
+.B \-v, --version
+Print version information.
+.TP
+.B \-h, --help
+Print brief help message.
+.PP
+.SH EXAMPLES
+To calculate a relative entropy profile using lengths between 4 and 12:
+.PP
+.CODE ffpreprof -s 4 -e 12 test*.fna
+.CODE ffpreprof < test1.fna
+.PP
+For more information about the relative entropy measure, see
+.BR ffpre(1).
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpvocab(1),
+.BR ffpvprof(1),
+.BR ffpre(1)
diff --git a/man/ffprwn.1.in b/man/ffprwn.1.in
new file mode 100644
index 0000000..81beb3c
--- /dev/null
+++ b/man/ffprwn.1.in
@@ -0,0 +1,73 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffprwn 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffprwn \- This program performs row normalization of an FFP vector file.
+.SH SYNOPSIS
+.BI "ffprwn [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options, the default behavior of the program is to
+generate row normalized relative frequency vectors. Input
+should be a columnar (not a key,value) FFP. Use
+.B ffpcol
+to convert to columnar format beforehand.
+FFPs will be read from standard input if no options are supplied and
+.B ffprwn
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list.
+.
+.SH OPTIONS
+.TP
+.B \-n, --largest-row
+Alternate form of row normalization that normalizes by the FFP
+row with the largest sum. Note this will only normalize within
+individual files specified on the command line, not all FFPs in
+all files.
+If all elements of a row are zero, then each element will have
+a relative frequency of zero after normalization.
+.TP
+.BI "\-d " "INT" ", --precision=" "INT"
+.RI "Specify " "INT" " digits of decimal precision. The default is 2
+.TP
+.B "\-h, --help"
+Display help message.
+.PP
+.SH EXAMPLES
+Here is an example of how to use
+.B ffprwn
+in a pipeline with
+.BR "ffpry" "."
+To handle key-value paired FFP input use the
+.B ffpcol
+utility as a filter.
+.PP
+.CODE ffpry -l 5 test*.fna | ffpcol | ffprwn | ffpjsd > matrix
+.PP
+Likewise amino acid sequences can be handled in a similar fashion.
+.PP
+.CODE ffpaa test*.fna | ffpcol -a | ffprwn | ffpjsd > matrix
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1)
+.BR ffpry(1),
+.BR ffpboot(1),
+.BR ffpjsd(1),
+.BR ffpcol(1),
+.BR ffpmerge(1),
+.BR ffpvprof(1),
+.BR ffpreprof(1)
diff --git a/man/ffpry.1.in b/man/ffpry.1.in
new file mode 100644
index 0000000..cafb0c3
--- /dev/null
+++ b/man/ffpry.1.in
@@ -0,0 +1,204 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpry 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpry \- This program generates an FFP vector of nucleic acid RY-coded features.
+.SH SYNOPSIS
+.BI "ffpry [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options the default behavior of the program is to
+generate a Feature Frequency Profile (FFP) using features of length
+10 from FASTA input. The FFP will contain the counts of nucleic acid features coded
+in purine(R)/pyrmidine(Y) format. By default the feature keys will
+be printed alongside the feature counts. FASTA sequences will be read
+from standard input if no options are supplied and
+.B ffpry
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list. In default mode features are stored in either the forward or
+reverse complement direction based upon alphabetical preference.
+.SH OPTIONS
+.TP
+.BI "\-l " LEN ", --length=" LEN
+Changes the default length of features to
+.IR "LEN" "."
+The default length is 10. Maximum length allowed in 40.
+You may overide this maximum length by setting (and exporting)
+the environmental variable MAX_WORD_SIZE to a different value.
+.TP
+.BI "\-f " FILE ", --feature-list=" FILE
+.pp
+Changes the behavior of the program to read a list of features from
+.IR "FILE" "."
+Features can be space or newline delimited.
+As of v3.00 features are now matched,coded and reported in both the forward and reverse strand. To disable this behaviour use the
+.B -r
+option. By default the feature list is RY coded.
+.TP
+.BI "\-w " STR ", --mask=" STR
+.pp
+Use character
+.I STR
+of length
+.I LEN
+which specifies a character mask for the features. For example "1111101111" means to ignore the 6th character
+ of a character feature. Feature maskings functions in combination with both
+.B -d
+and
+.BR "-r" "."
+.TP
+.BI "\-z " K ", --rand-mask=" K
+.pp
+Create a random weight mask which allows up to K mismatches. No greater than the word length in mismatches is allowed. The weight mask is printed to standard error at the beginning of execution. This option is cummulative with both options -d and -r.
+.TP
+.BI "\-s " INT ", --rand-seed=" INT
+.pp
+Seed the random number generator, to make randomization operations like
+.B \-z
+predictable across different runs. This option is cummulative with both
+options
+.B -d
+and
+.BR "-r" "."
+The defaul seeed to the random number generator is (system time) * (process ID).
+.TP
+.B \-q, --quiet
+.pp
+Run in quiet mode. Suppresses printing to standard error.
+.TP
+.B \-d, --disable
+.pp
+Disable RY coding to use ATGC coding.
+.TP
+.B -m, --multiple
+Calculate FFPs for multiple sequences in the input file. Sequences must have their own FASTA '>' header.
+.TP
+.B -r, --disable-rev
+Disable counting of reverse complement features.
+.PP
+.SH EXAMPLES
+.PP
+The FFP phylogeny tools are designed to be used as filters in a pipeline.
+To create a key-form FFP use this syntax:
+.PP
+.CODE ffpry -l 3 test1.fna
+.PP
+This will generate an FFP of the form
+.PP
+.CODE RRY 4 RRR 5 YYR ...
+.PP
+To generate a profile of several nucleic acid sequences
+.PP
+.CODE ffpry -l 3 test1.fna test2.fna test3.fna
+.PP
+Or more succinctly
+.PP
+.CODE ffpry -l 3 test*.fna
+.PP
+The profile for each fna file will be produced on a newline delimited row.
+in the following format:
+.PP
+.CODE AAATGA 2 ATAGTA 4 ATGGGG 1 ...
+.CODE AAACGA 2 ATAGCA 1 CTGAGG 3 ...
+.PP
+This format is a key-value FFP.
+.PP
+The utility
+.B ffprwn
+which row normalizes data must be presented with columnar data -- This
+data format contains only the count values and no keys.
+The columns represent a feature and each row of the FFP input corresponds
+to the counts of that feature in the individual FASTA files.
+This data format is recognized by several utilities, therefore you
+must convert a key valued FFP into a columnar format using
+.B ffpcol
+.PP
+For example several commands can be piped together to produce a
+divergence matrix representing FFP similarity
+.PP
+.CODE ffpry -l 4 test*.fna | ffpcol | ffprwn | ffpjsd
+.PP
+If mismatches are desired at specific positions within a feature
+a mask can be applied by using the
+.B \-w
+option. The format of the mask is a string of 1's and 0's which
+specify whether a match is required at that postion or whether
+mismatches are allowed. For example:
+.PP
+.CODE ffpry -l 5 -w "10110" test*.fna
+.PP
+This specifies that mismatches are allowed at the 2nd and 5th postions
+in every feature.
+.PP
+The
+.B \-z
+option can be used to randomly create a mask with
+.B n
+number of mismatches. The mask is printed to stderr by
+default. The example below redirects the output of standard
+error to a file.
+.PP
+.CODE ffpry -l 5 -z 2 test*.fna 2> mask
+.PP
+To disable the default RY coding use the
+.B \-d
+option which will use 4 base ATGC coding.
+.PP
+If the frequencies for a small set of features is desired then the
+.BI "\-f " "FILE"
+option can be used.
+.I FILE
+specifies the name of a file containing a list of features (RY or ATGC coded).
+The list of features can be tab, space or newline delimited.
+Note the length of the features must also be specified using the
+.B \-l
+option as well.
+.PP
+By default all of the sequence data in a particular file is merged into one
+FFP. Multiple fasta records (multiple fasta sequences in a single file) are parsed as one single sequence (for example, consider
+the case of multiple contigs in a single genomes).
+If your fasta files contain multiple sequences separated by '>' style records headers
+.RB "and you wish to produce FFPs for each record then specify the " "-m" " option."
+.SH L\-MER FEATURES
+Features are stored in a mixture of the forward and reverse complement direction. For
+example, if the feature:
+.PP
+.CODE GTGTAGT
+.PP
+is encountered in the forward direction in the sequence it will be stored by
+default in the hash table and reported in the output in the reverse complement direction, which is:
+.PP
+.CODE ACTACAC
+.PP
+This decision is based upon hash function precedence, whichever direction has the
+smallest hash index will be used. This form of hashing allows for homology detection,
+independent of gene strandedness. The behavior can be disabled with the
+.B \-r
+option, which will force all features to be stored in the forward direction.
+Also, by default features are stored in RY coded form. This has been shown to
+improve phylogenetic signal in a number of studies especially if highly varying
+rate of mutation are suspected among different taxa. Additionally RY coding
+is much faster, but is a compromise between speed and sensitivity. Likewise
+this feature can be disabled with the
+.B \-d
+option.
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1),
+.BR ffprwn(1),
+.BR ffpmerge(1),
+.BR ffpjsd(1),
+.BR ffpcol(1)
diff --git a/man/ffpsubnam.1.in b/man/ffpsubnam.1.in
new file mode 100644
index 0000000..4b51c27
--- /dev/null
+++ b/man/ffpsubnam.1.in
@@ -0,0 +1,42 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpsubnam 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpsubnam \- Substitute taxa names in Phylip format infile.
+.SH SYNOPSIS
+.BI "ffpsubnam [" "OPTIONS" "] [" "NAMES" "] [" "INFILE" "]"
+.SH DESCRIPTION
+.PP
+This is a simple utility to change the names in a phylip format
+infile for those supplied by an input file.
+.SH OPTIONS
+.TP
+.BI "\-o " "FILE" ", --outfile=" "FILE"
+Specify output file. Default is standard out.
+.TP
+.B "\-v, --version"
+Display version information.
+.TP
+.B "\-h, --help"
+Display help message.
+.PP
+.SH EXAMPLES
+None.
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1),
+.BR ffpry(1)
diff --git a/man/ffptree.1.in b/man/ffptree.1.in
new file mode 100644
index 0000000..8d0bf23
--- /dev/null
+++ b/man/ffptree.1.in
@@ -0,0 +1,176 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffptree 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffptree \- Build Neighbor Joining or UPGMA trees from distance matrix input.
+.SH SYNOPSIS
+.BI "ffpdf [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Calculate a Neighbor Joining tree or UPGMA tree. This program is
+compatible with phylip style distance matrix infiles and the output
+produced by
+.B ffpjsd
+with option
+.B -p.
+The NEWICK style tree is written to standard out, while progress reports
+and a human readable tree are written to standard error.
+Input matrices can be read from standard input, a pipe or a file. The
+input file can contain multiple sets of matrices.
+FASTA sequences will be read
+from standard input if no file arguments are supplied and
+.B ffptree
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list.
+.SH OPTIONS
+.TP
+.B \-n, --upgma
+Build a UPGMA tree. The default is to build a neighbor joining tree.
+.TP
+.B \-l, --lower
+Use lower input triangle. Use only the lower half of the input matrix
+and assume symmetry.
+.TP
+.B \-u, --upper
+Use upper input triangle. Use only the upper half of the input matrix
+and assume symmetry.
+.TP
+.B \-t, --print-tree
+Disable printing of a human readable tree to standard error.
+.TP
+.B \-p, --progress
+Disable printing of tree build progress to standard error.
+.TP
+.B \-d, --print-data
+Enable printing of the input data before tree build standard error.
+.TP
+.B \-y, --symmetrize
+Symmetrize input data matrix, by averaging upper and lower triangles.
+By default, the input matrix is checked for symmetry, but is disabled
+with
+.B \-y.
+.TP
+.B \-q, --quiet
+Disable printing of human readable tree, tree build progress and warnings to
+standard error.
+.TP
+.BI "\-o " "TAXAN" ", --outgroup=" "TAXAN"
+Rearrange tree to place taxon
+.I TAXAN
+at the outgroup position of the tree.
+.I TAXAN
+is an integer ranging from 1 to the number of
+input taxa.
+.TP
+.BI "\-O " "OUT" ", --out=" "OUT"
+Write Newick format tree to file
+.I OUT.
+By default, the tree is printed to
+standard out.
+.TP
+.BI "\-P " "OUT" ", --out-prg=" "OUT"
+Redirect tree build progress to a file
+.I OUT.
+By default, progress is printed to
+standard error.
+.TP
+.BI "\-w " "WDTH" ", --precision=" "WDTH"
+Specify the decimal precision used in reporting
+branch lengths in the Newick format tree. The
+default precision is 8 digits.
+.TP
+.BI "\-j[" "S" "], --jumble[=" "S" "]"
+Jumble input order or species in matrix.
+Optional argument
+.I S
+can be used to provide a fixed random seed
+value to the random number generator, but the
+default value is the (system time) * (process ID).
+.TP
+.BI "\-m[" "N" "], --multiple[=" "N" "]"
+Limit tree building to the first
+.I N
+sets.
+Without option
+.I N
+use all input sets, which
+is the default behavior. With
+option
+.IR "N" ","
+use up to 1 to the
+.IR "N" "th set."
+The default is to use all input sets from
+the input file without using option
+.B \-m.
+.TP
+.B "\-v, --version"
+Display version information.
+.TP
+.B "\-h, --help"
+Display help message.
+.PP
+.SH EXAMPLES
+.PP
+This utility can be placed at the end of a pipeline of FFP utilities
+to directly generate tree output. The example below supressed printing
+of the build progress and the human-readable to standard error with the
+.B \-q option.
+.PP
+.CODE ffpry -l 4 *.fasta | ffpcol | ffprwn |
+.CODE ffpjsd -p species.txt | ffptree -q > treefile
+.PP
+Note, you must have defined a taxa name file
+with option
+.B \-p
+in the call to
+.B ffpjsd
+to pipe input to
+.B ffptree.
+For additonal information see,
+.BR ffpjsd(1).
+If you wish to view and save the build progress for later review, then
+redirect standard error to a file.
+.PP
+.CODE ffpry -l 4 *.fasta | ffpcol | ffprwn |
+.CODE ffpjsd -p species.txt | ffptree > treefile 2> progress
+.PP
+Multiple input sets can be created and supplied in the same
+input file. Typically these will be pseudo-replicates generated
+via the
+.B ffpboot
+utility. If the file
+.CW input
+contains 100 pseudo-replicates or input sets then by default
+.B ffptree
+will read all the input sets and generate trees for each.
+The
+.B \-m
+option can be used to control how many input sets are processed.
+.PP
+.CODE ffptree < input # Generate all 100 trees
+.CODE ffptree -m < input # Generate all 100 trees
+.CODE ffptree -m50 < input # Generate first 50 trees.
+.PP
+Note the absence of an intervening space between
+.b \-m
+and
+50. This is the format for all options which take an
+optional argument.
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpaa(1),
+.BR ffpry(1),
diff --git a/man/ffptxt.1.in b/man/ffptxt.1.in
new file mode 100644
index 0000000..b1657f9
--- /dev/null
+++ b/man/ffptxt.1.in
@@ -0,0 +1,88 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffptxt 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffptxt \- This program generates an FFP vector of text data.
+.SH SYNOPSIS
+.BI "ffpaa [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options at all the default behavior of the program is to
+generate a Feature Frequency Profile (FFP) of text data, using 26
+alphabet letters, removing all non-alphabetic characters. The
+default feature length is 6.
+Text will be read from standard input if no options are supplied and
+.B ffptxt
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list.
+.
+.SH OPTIONS
+.TP
+.BI "\-l " "LEN" ", --length=" "LEN"
+.RI "Changes the default length of features to " "LEN" ". The default length is 6."
+The maximum word size is 40.
+You may overide this maximum length by setting (and exporting)
+the environmental variable MAX_WORD_SIZE to a different value.
+.TP
+.BI "\-f " "FILE" ", --feature-list=" "FILE"
+Changes the behavior of the program to read
+.RI "a list of features from " "FILE" ". Features can"
+be space or newline delimited.
+.TP
+.B "\-h, --help"
+Display help message.
+.PP
+.SH EXAMPLES
+The command:
+.PP
+.CODE ffptxt -l 3 file*.txt
+.PP
+Will produce a output of this form, using features of length 3:
+.PP
+.CODE hel 2 elo 3 low 4 ...
+.CODE thi 3 ism 2 sme 5 ...
+.PP
+There will be one FFP line for each .txt file
+.PP
+This format can also be used:
+.PP
+.CODE ffptxt -l 4 file1.txt file2.txt file3.txt
+.PP
+The utilities in the FFP package can be used as fully
+qualified filters and can be used to build pipelines.
+This pipeline will create a phylip infile format distance
+matrix, using the Jensen Shannon Divergence:
+.PP
+.CODE ffptxt -l 7 file*.txt | ffpcol -t | ffprwn | ffpjsd -p > infile
+.PP
+.RB "Please note the use of the" " -t " "option in ffpcol to specify text."
+.PP
+Bootstrap and jacknife resampling can be done with the
+ffpboot program.
+.PP
+.SH FUTURE DIRECTIONS
+None.
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpry(1),
+.BR ffprwn(1),
+.BR ffpjsd(1),
+.BR ffpcol(1),
+.BR ffpmerge(1),
+.BR ffpboot(1),
+.BR ffpvprof(1),
+.BR ffpreprof(1)
diff --git a/man/ffpvocab.1.in b/man/ffpvocab.1.in
new file mode 100644
index 0000000..6e348df
--- /dev/null
+++ b/man/ffpvocab.1.in
@@ -0,0 +1,53 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpvocab 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpvocab \- This program determines the number of features which have frequencies above a threshold value.
+.SH SYNOPSIS
+.BI "ffpvocab [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+Given no options, the default behavior of the program is to
+print out the average number of features with frequencies greater than
+two in all rows. This value is defined as the number of vocabulary features.
+FFPs will be read from standard input if no options are supplied and
+.B ffpvocab
+is called non-interactively (i.e. as part of a pipeline) or with a "-" in the
+argument list. If a multi-row FFP is supplied then the default behavior is to
+average the number of vocabulary features across all rows.
+.SH OPTIONS
+.TP
+.BI "\-f " "INT" ", --freq-thresh=" "INT"
+Threshold to count a feature. The default value is 2, which means a feature
+must have a frequency greater than or equal to 2, in order to be counted.
+.TP
+.B \-h, --help
+.PP
+.SH EXAMPLES
+To count the number of features that occur 3 or more times
+in the ffp:
+.PP
+.CODE ffpry -l 5 file.fna | ffpvocab -f 3
+.PP
+To calculate word usage for a range of lengths
+use
+.B ffpvprof.
+.PP
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpvprof(1),
+.BR ffpre(1),
+.BR ffpreprof(1)
diff --git a/man/ffpvprof.1.in b/man/ffpvprof.1.in
new file mode 100644
index 0000000..eadac42
--- /dev/null
+++ b/man/ffpvprof.1.in
@@ -0,0 +1,93 @@
+.de CW
+. nop \s-2\f[C]\\$*\f[]\s+2
+..
+.de CODE
+.in +0.5i
+. nop \s-2\f[C]\\$*\f[R]\s+2
+.in -0.5i
+..
+.TH ffpvprof 1 "[@]DATE[@]" "Version [@]VERSION[@]" "FFP PHYLOGENY"
+.SH NAME
+ffpvprof \- Constructs a word usage (vocabulary) profile.
+.SH SYNOPSIS
+.BI "ffpvprof [" "OPTION" "] ... [" "FILE" "] ..."
+.SH DESCRIPTION
+.PP
+.RB "This shell script is a wrapper for the utility " "ffpvocab" "."
+Using it you can calculate the word usage over
+a range of feature lengths. Results are displayed
+in columnar format, where the length is the first
+column and the word usage is the second column.
+.SH OPTIONS
+.TP
+.B \-a, --amino
+Specify amino acid input. Default
+is nucleic acid (ATGC) input.
+.TP
+.B \-d, --disable-class
+Use ATGC coding. default is RY Coding.
+For Amino acid input this disables amino
+acid classes.
+.TP
+.B \-r, --no-reverse
+Disable reverse complement matching of nucleotide FASTA input.
+Does not apply for protein input.
+.TP
+.BI "\-z " "INT" ", --rand-mask=" "INT"
+Specify a random mask string. INT is the number
+of mismatches. The number of mismatches must be less
+than the default start value or less than the argument
+supplied to -s.
+.TP
+.BI "\-s " "INT" ", --start=" "INT"
+Specify start length range, default 1.
+.TP
+.BI "\-e " "INT" ", --end=" "INT"
+Specify end length range, default 20. The maximum word size
+is 40.
+You may overide this maximum length by setting (and exporting)
+the environmental variable MAX_WORD_SIZE to a different value.
+.TP
+.BI "\-f " "INT" ", --freq-thresh=" "INT"
+Specify word frequency threshold to count. Count words which occur only
+INT or more times. Default is 2.
+.TP
+.BI "\-T " "DIR" ", --tmpdir=" "DIR"
+Specify location for temporary files.
+Only applies for reading FASTA input from standard in.
+.TP
+.BI "\-p " "DIR" ", --path=" "DIR"
+Path to ffpry,ffpaa,ffpvocab executables, if not in
+path.
+.TP
+.B \-v, --version
+Print version information.
+.TP
+.B \-h, --help
+Print brief help message.
+.PP
+.SH EXAMPLES
+To calculate a word usage profile using a frequency
+threshold of 3 for lengths between 4 and 12:
+.PP
+.CODE ffpvprof -s 4 -e 12 -f 3 vector
+.PP
+Using piping syntax, or as part of a pipeline of
+commands. The example below pipes input from standard in.
+.PP
+.CODE ffpvprof -s 4 -e 12 -f 3 < vector
+.PP
+.SH FURTHER DIRECTIONS
+None.
+.SH AUTHOR
+This program was written by Gregory E. Sims.
+.SH "REPORTING BUGS"
+Report bugs to <gesims at lbl.gov>.
+.SH COPYRIGHT
+Copyright (C) [@]COPY[@] Gregory E. Sims
+.br
+There is NO WARRANTY, to the extent permitted by law.
+.SH "SEE ALSO"
+.BR ffpvocab(1),
+.BR ffpre(1),
+.BR ffpreprof(1)
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
new file mode 100644
index 0000000..dc719f6
--- /dev/null
+++ b/scripts/Makefile.am
@@ -0,0 +1,60 @@
+if WITH_GUI
+ MAYBE_GUI = ffpgui
+endif
+
+bin_SCRIPTS = ffpvprof ffpreprof ffpdf ffpsubnam $(MAYBE_GUI)
+
+do_subst = sed -e 's,\[@\]VERSION\[@\],$(PACKAGE_VERSION),g' \
+ -e 's,\[@\]DOC\[@\],$(datadir)/doc/@PACKAGE@,g' \
+ -e 's,\[@\]EMAIL\[@\],$(PACKAGE_BUGREPORT),g' \
+ -e 's,\[@\]ISOSX\[@\],$(ISOSX),g'
+
+
+if WITH_GUI
+ffpgui : ffpgui.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpgui.in > ffpgui.tmp
+ chmod +x ffpgui.tmp
+ mv ffpgui.tmp ffpgui
+endif
+
+ffpdf : ffpdf.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpdf.in > ffpdf.tmp
+ chmod +x ffpdf.tmp
+ mv ffpdf.tmp ffpdf
+
+ffpreprof : ffpreprof.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpreprof.in > ffpreprof.tmp
+ chmod +x ffpreprof.tmp
+ mv ffpreprof.tmp ffpreprof
+
+ffpsubnam : ffpsubnam.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpsubnam.in > ffpsubnam.tmp
+ chmod +x ffpsubnam.tmp
+ mv ffpsubnam.tmp ffpsubnam
+
+ffpvprof : ffpvprof.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpvprof.in > ffpvprof.tmp
+ chmod +x ffpvprof.tmp
+ mv ffpvprof.tmp ffpvprof
+
+
+
+CLEANFILES=\
+ $(MAYBE_GUI) \
+ ffpdf \
+ ffpreprof \
+ ffpsubnam \
+ ffpvprof
+
+EXTRA_DIST= \
+ ffpgui.in \
+ ffpdf.in \
+ ffpreprof.in \
+ ffpsubnam.in \
+ ffpvprof.in
+
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
new file mode 100644
index 0000000..7e82e5b
--- /dev/null
+++ b/scripts/Makefile.in
@@ -0,0 +1,440 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = scripts
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+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;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+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/||"
+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] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(bindir)"
+SCRIPTS = $(bin_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT = @GETOPT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ISOSX = @ISOSX@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKTEMP = @MKTEMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+ at WITH_GUI_TRUE@MAYBE_GUI = ffpgui
+bin_SCRIPTS = ffpvprof ffpreprof ffpdf ffpsubnam $(MAYBE_GUI)
+do_subst = sed -e 's,\[@\]VERSION\[@\],$(PACKAGE_VERSION),g' \
+ -e 's,\[@\]DOC\[@\],$(datadir)/doc/@PACKAGE@,g' \
+ -e 's,\[@\]EMAIL\[@\],$(PACKAGE_BUGREPORT),g' \
+ -e 's,\[@\]ISOSX\[@\],$(ISOSX),g'
+
+CLEANFILES = \
+ $(MAYBE_GUI) \
+ ffpdf \
+ ffpreprof \
+ ffpsubnam \
+ ffpvprof
+
+EXTRA_DIST = \
+ ffpgui.in \
+ ffpdf.in \
+ ffpreprof.in \
+ ffpsubnam.in \
+ ffpvprof.in
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign scripts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binSCRIPTS: $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;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 \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binSCRIPTS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binSCRIPTS
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-binSCRIPTS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am uninstall uninstall-am uninstall-binSCRIPTS
+
+
+ at WITH_GUI_TRUE@ffpgui : ffpgui.in Makefile
+
+ at WITH_GUI_TRUE@ $(do_subst) < $(srcdir)/ffpgui.in > ffpgui.tmp
+ at WITH_GUI_TRUE@ chmod +x ffpgui.tmp
+ at WITH_GUI_TRUE@ mv ffpgui.tmp ffpgui
+
+ffpdf : ffpdf.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpdf.in > ffpdf.tmp
+ chmod +x ffpdf.tmp
+ mv ffpdf.tmp ffpdf
+
+ffpreprof : ffpreprof.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpreprof.in > ffpreprof.tmp
+ chmod +x ffpreprof.tmp
+ mv ffpreprof.tmp ffpreprof
+
+ffpsubnam : ffpsubnam.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpsubnam.in > ffpsubnam.tmp
+ chmod +x ffpsubnam.tmp
+ mv ffpsubnam.tmp ffpsubnam
+
+ffpvprof : ffpvprof.in Makefile
+
+ $(do_subst) < $(srcdir)/ffpvprof.in > ffpvprof.tmp
+ chmod +x ffpvprof.tmp
+ mv ffpvprof.tmp ffpvprof
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/scripts/ffpdf.in b/scripts/ffpdf.in
new file mode 100644
index 0000000..0e0b212
--- /dev/null
+++ b/scripts/ffpdf.in
@@ -0,0 +1,244 @@
+#!/usr/bin/env perl
+# This code is distributed under a Non-commerical use
+# License. See LICENSE for more details. Use of this
+# code must be properly attributed to its author
+# Gregory E. Sims provided that its use or derivative
+# use is non-commercial in nature. Proper attribution
+# can be made by citing:
+#
+# Sims GE, et al (2009) Alignment-free genome
+# comparison with feature frequency profiles (FFP) and
+# optimal resolutions. Proc. Natl. Acad. Sci. USA.
+# 106, 2677-82.
+#
+# Gregory E. Sims (C) 2010-2012
+#
+#####################################################
+use strict;
+use Getopt::Long;
+use Pod::Usage;
+use constant VERSION=> '[@]VERSION[@]';
+use constant EMAIL=> '[@]EMAIL[@]';
+use constant AUTHORS=> "Gregory E. Sims";
+use constant PACKAGE=> "FFP";
+use constant YEAR=> "2011";
+
+
+
+my $SCRIPT = $0; # Script name
+$SCRIPT =~ s/.*\///;
+
+my $GROUP_FILE="";
+my %GROUPS;
+my $GROUP="";
+my %GROUPSIZE;
+my $PFLAG=1.0;
+
+my $result=GetOptions("f|group-file=s" => \$GROUP_FILE,
+ "g|group=s" => \$GROUP,
+ "p|percent=f" => \$PFLAG,
+ "v|version" => sub { print_version(); exit(0); },
+ "h|help" => sub { print_usage(); exit(0); } );
+
+
+if ($GROUP_FILE) {
+ parse_group_file($GROUP_FILE);
+}
+
+
+# Group sanity check.
+if ($GROUP) {
+ if (!$GROUP_FILE) {
+ print STDERR "$SCRIPT: --group-file required.\n";
+ exit(1);
+ }
+
+ if (!$GROUPSIZE{$GROUP}) {
+ print STDERR "$SCRIPT: --group $GROUP, is not a valid group.\n";
+ exit(1);
+ }
+}
+
+
+if ( !isatty() && !@ARGV ) {
+ print STDERR "$SCRIPT: FFP file argument required\n";
+ print STDERR "Try \`$SCRIPT --help\' for more information.";
+ exit(1);
+}
+
+my $fh;
+if (@ARGV) {
+ while (my $file=shift @ARGV) {
+ open($fh,$file);
+ get_dfs($fh);
+ close($fh);
+ }
+} else {
+ get_dfs(\*STDIN);
+}
+
+
+# Set up groups/clades
+# Stores results in global variables GROUP and GROUPSIZE
+sub parse_group_file() {
+ my ($file)=@_;
+ open(FILE,"$file") || die "$SCRIPT: Couldn't open $file.\n";
+ my $i=0;
+ my $line;
+ while ($line=<FILE>) {
+ chomp $line;
+ if ($line !~ /^\#/ ) {
+ $line =~ s/[\s]//g;
+ $GROUPS{$i}=$line;
+ $GROUPSIZE{$line}++;
+ $i++;
+ }
+ }
+ close(FILE);
+
+}
+
+
+
+#@todo default behavior, unless a clade file is specified, is to assume
+# that all rows of the FPP matrix are in the same clade.
+# If --clade-file is given then this is a file with the following format
+# # Three clades A,B and C. The 1st and 2nd row of the FFP belong to
+# clade A, 3rd row clade C and the remaining rows clade B. Any symbols
+# can be used for the clade names, (however whitespace is stripped from the
+# name).
+# A
+# A
+# C
+# B
+# B
+
+#@todo Ignore all groups with less than one member.
+
+# Test whether input is either key-value pairs
+# ie. ATGC 3 TGAT 2 GTGA 1 ...
+# or Columnar
+# 3 2 1
+
+sub isKeyValued {
+ my ($fh)=@_;
+ my $line=<$fh>;
+ seek($fh,0,0);
+ if ($line =~ /^[^0-9]/ ) {
+ return 1;
+ }
+ return 0;
+}
+
+
+#@todo test whether key valued or columnar input
+# Assuming columnar below
+# Given the default only, we search for the df's in
+# the first alpha numeric group only.
+# If an option is specifed, then we search for
+# all groups specified/ this takes more time however.
+# and requires creation of a tempfile if input is from
+# stdin.
+
+sub get_dfs {
+ my ($fh)=@_;
+ my $i=0;
+ my $j;
+ my @a;
+ my %df;
+
+ if (isKeyValued($fh)) {
+ while(@a=split(" ",<$fh>)) {
+ if ( $GROUP_FILE eq "" || $GROUP eq "" || $GROUPS{$i} eq $GROUP) {
+ foreach ($j=0; $j <@a; $j+=2) {
+ $df{$a[$j]}++;
+ }
+ } else {
+ foreach ($j=0; $j <@a; $j+=2) {
+ $df{$a[$j]}--;
+ }
+ }
+ $i++;
+ }
+ } else {
+ print STDERR "$SCRIPT: Columnar input not supported, Use Key-value input\n";
+ exit(1);
+ }
+
+ close($fh);
+
+ if (!$GROUP_FILE) {
+ foreach my $key (keys %df) {
+ if ( $df{$key} < $i*$PFLAG ) {
+ delete $df{$key};
+ }
+ }
+ } else {
+ foreach my $key (keys %df) {
+ if ( $df{$key} < $GROUPSIZE{$GROUP}*$PFLAG ) {
+ delete $df{$key};
+ }
+ }
+ }
+
+ print join("\t",keys %df),"\n";
+ exit(0);
+}
+
+
+# Test if script is being redirected stdin
+# via a pipe or < redirection.
+
+sub isatty() {
+ return system("tty -s");
+}
+
+sub print_version() {
+ print "$SCRIPT (",VERSION,")\n";
+ print PACKAGE, " package\n";
+ print AUTHORS, " (C) ", YEAR,"\n";
+ print "Contact ",EMAIL,"\n";
+}
+
+
+
+
+
+sub print_usage() {
+my $EMAIL=EMAIL;
+print <<"EOF";
+Usage: ffpdf [OPTIONS] ... [FILE] ...
+ffpdf - Outputs clade distinguishing features for specified clades.
+
+OPTIONS
+ -f STR, --group-file=STR Indicates which row of the ffp file
+ Input belongs to which clade. The
+ STR file has the format of one new
+ line delimited symbol per row. See
+ ffpdf(1) for more information. Def
+ assumes all rows are the same clade
+
+ -g STR, --group=STR Which clade to report DFs for. Default
+ behavior assumes all rows are one clade.
+
+ -p FLT, --percent=FLT Specify a fractional cutoff for the
+ percentage ( i.e. 50% = 0.5) of of
+ a group which need to have a feature.
+ Default is 1.0.
+
+ -v, --version Display version information.
+
+ -h, --help Brief help message.
+
+DESCRIPTION
+
+This utility performs the analysis described in Sims and Kim (2011),
+PNAS, 108. It finds features in the ffp which are present ONLY in a
+specified clade and no other clades. Given no file arguments, the FFP
+input can be piped into STDIN. If a group file is specified but no
+group is specified then, the group file is ignored. You must query
+individual groups separately.
+
+Contact $EMAIL
+EOF
+}
diff --git a/scripts/ffpgui.in b/scripts/ffpgui.in
new file mode 100644
index 0000000..97c4920
--- /dev/null
+++ b/scripts/ffpgui.in
@@ -0,0 +1,824 @@
+#!/usr/bin/env perl
+# This code is distributed under a Non-commerical use
+# License. See LICENSE for more details. Use of this
+# code must be properly attributed to its author
+# Gregory E. Sims provided that its use or derivative
+# use is non-commercial in nature. Proper attribution
+# can be made by citing:
+#
+# Sims GE, et al (2009) Alignment-free genome
+# comparison with feature frequency profiles (FFP) and
+# optimal resolutions. Proc. Natl. Acad. Sci. USA.
+# 106, 2677-82.
+#
+# Gregory E. Sims (C) 2010-2012
+#
+#####################################################
+
+use strict;
+use Tk;
+use Tk::Dialog;
+use Tk::Text;
+use Tk::LabEntry;
+use File::Temp qw /tempfile tempdir/;
+use File::Path qw( remove_tree );
+
+use constant MAX_LENGTH => 40;
+use constant MAX_FILES => 1000;
+my $VERSION=[@]VERSION[@];
+
+# Consider placing all in switches
+my %distances= ('Jensen-Shannon' => '',
+ 'Euclidean' => '-e',
+ 'Squared Euclidean' => '-E',
+ 'Cosine' => '-c',
+ 'Manhattan' => '-m',
+ 'Canberra' => '-b',
+ 'Matching' => '-M',
+ 'Pearoson Correlation' => '-R',
+ 'Chebyshev' => '-C',
+ 'Jaccard' => '-j',
+ 'Rogers-Tanimoto' => '-t',
+ 'Dice' => '-D',
+ 'Anti-dice' => '-N',
+ 'Sneath-Sokal' => '-S',
+ 'Hamming' => '-H',
+ 'hamman' => '-a',
+ 'Pearson Phi' => '-P',
+ 'Anderberg' => '-B',
+ 'Gower' => '-g',
+ 'Russel-Rao' => '-u',
+ 'Yule' => '-y',
+ 'Ochiai' => '-o',
+ 'Kulczynski' => '-k');
+my %normMethods= ('Row Normalize' => '| ffprwn ',
+ 'Largest Row' => '| ffprwn -n ',
+ 'None' => '');
+my %complexMethods=('Range' =>'',
+ 'Normal' =>'-n');
+
+my %freqMethods=('Range' =>'-f',
+ 'Extreme Value' =>'-e',
+ 'Normal' =>'-n');
+my @modes=('Nucleotide Sequence','Amino Acid Sequence','Text');
+my $modeIdx='Nucleotide Sequence'; #Default mode
+my $length=4;
+my $input_files=''; # Reference to a file array
+my $feature_file=''; # Reference to a file array
+my $mask='';
+my $precision=2;
+# Flags
+my $disable=0;
+my $reverse=0;
+my $similarity=0;
+my $multiple=0;
+my $distance='Jensen-Shannon';
+my $phylipfmt=0;
+my $normalize='Row Normalize';
+my $resample='None';
+my $complexFilter='None';
+my $freqFilter='None';
+my $treeMethod='None';
+my $delProb=0.28;
+my $replicates=100;
+my $complexUpper=0.95;
+my $complexLower=0.05;
+my $freqUpper=0.95;
+my $freqLower=0.05;
+my $lmerUpper=20;
+my $lmerLower=3;
+my $freqThresh=1;
+my $num_taxa=1;
+my $tmp = File::Temp->newdir(TEMPLATE => 'tempXXXXXX',
+ );
+
+#Signal handlers
+$SIG{'INT'}='clean_up';
+$SIG{'QUIT'}='clean_up';
+$SIG{'ABRT'}='clean_up';
+$SIG{'KILL'}='clean_up';
+$SIG{'EXIT'}='clean_up';
+
+
+
+my $mw = MainWindow->new;
+$mw->title("FFP gui Interface - $VERSION [Beta]");
+
+
+# Set up menu bar
+
+my $f_MenuBar = $mw->Menu;
+my $MenuFile =$f_MenuBar->cascade(-label=>'File',
+ -accelerator => 'Alt-f',
+ -underline => 0,
+ -tearoff=>0 );
+
+
+ $MenuFile->command(-label=>'~Open File(s)', -command => sub { &fileDialog($mw,\$input_files) });
+ $MenuFile->command(-label=>'Load ~Feature List', -command => sub { &featureFileDialog($mw,\$feature_file) });
+ $MenuFile->command(-label=>'~Save Matrix Output', -command => sub { &saveMatrix() });
+ $MenuFile->command(-label=>'Save ~Tree Output', -command => sub { &saveTree() });
+ $MenuFile->command(-label=>'E~xit', -command => sub { &clean_up}); #Should be cleanup
+
+my $MenuOptions=$f_MenuBar->cascade(-label=>'Options',
+ -accelerator => 'Alt-o',
+ -underline => 0,
+ -tearoff => 0 );
+ my $seqType=$MenuOptions->cascade(-label=>'~Input Sequence Type',
+ -accelerator => 'i');
+ foreach(@modes) {
+ $seqType->radiobutton(
+ -label => $_,
+ -variable => \$modeIdx
+ );
+ }
+ my $lengthSel=$MenuOptions->cascade(-label=>'~L-mer Length',
+ -accelerator => 'l');
+ foreach(1..40) {
+ $lengthSel->radiobutton(
+ -label => $_,
+ -variable => \$length
+ );
+ }
+
+$MenuOptions->checkbutton(-label=>'~Disable Coding',
+ -accelerator => 'd',
+ -variable =>\$disable );
+
+$MenuOptions->checkbutton(-label=>'Disable ~Reverse Comp',
+ -accelerator => 'r',
+ -variable =>\$reverse );
+
+my $distSel=$MenuOptions->cascade(-label=>'D~istance Measure',
+ -accelerator => 'i');
+ foreach(keys %distances) {
+ $distSel->radiobutton(
+ -label => $_,
+ -variable => \$distance
+ );
+ }
+
+
+$MenuOptions->checkbutton(-label=>'~Force similarity',
+ -accelerator => 'f',
+ -variable =>\$similarity );
+
+$MenuOptions->checkbutton(-label=>'~Phylip output',
+ -accelerator => 'p',
+ -variable =>\$phylipfmt );
+
+$MenuOptions->checkbutton(-label=>'~Multiple FASTA headers',
+ -accelerator => 'm',
+ -variable =>\$multiple );
+my $mismatch_dialog = $mw->DialogBox(-title => 'Mismatch Mask',
+ -default_button=>'OK',
+ -buttons=>['OK','Cancel']);
+
+ $mismatch_dialog->add('Label',
+ -text => "Input a mismatch mask\n".
+ "equal to the feature length\n".
+ "e.g. 11011\n".
+ "1 - Match\n0 - Mismatch\n"
+ )->pack;
+ $mismatch_dialog->add('LabEntry',-textvariable=> \$mask,
+ -width=>MAX_LENGTH,
+ -label=>'Mask',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+
+my $mismatchSel=$MenuOptions->command(-label=>'Mi~smatch Mask',
+ -accelerator => 's',
+ -command => [$mismatch_dialog => 'Show']);
+
+my $precision_dialog = $mw->DialogBox(-title => 'Input Decimal Precision',
+ -default_button=>'OK',
+ -buttons=>['OK','Cancel']);
+
+ $precision_dialog->add('LabEntry',-textvariable=> \$precision,
+ -width=>4,
+ -label=>'Number of Digits',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+
+my $precisionSel=$MenuOptions->command(-label=>'~Decimal precision',
+ -accelerator => 'd',
+ -command => [$precision_dialog => 'Show']);
+
+
+my $normType=$MenuOptions->cascade(-label=>'~Normalization',
+ -accelerator => 'N');
+ foreach( keys %normMethods ) {
+ $normType->radiobutton(
+ -label => $_,
+ -variable => \$normalize
+ );
+ }
+
+my $jackknife_dialog = $mw->DialogBox(-title => 'Jackknife Resampling',
+ -default_button=>'OK',
+ -buttons=>['OK','Cancel']);
+
+$jackknife_dialog->add('LabEntry',-textvariable=> \$delProb,
+ -width=>5,
+ -label=>'Deletion Probability',
+ -labelPack => [-side => 'left']
+ )->pack;
+$jackknife_dialog->add('LabEntry',-textvariable=> \$replicates,
+ -width=>5,
+ -label=>'Pseudoreplicate Num',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+my $bootstrap_dialog = $mw->DialogBox(-title => 'Bootsrap Resampling',
+ -default_button=>'OK',
+ -buttons=>['OK','Cancel']);
+
+$bootstrap_dialog->add('LabEntry',-textvariable=> \$replicates,
+ -width=>5,
+ -label=>'Pseudoreplicate Num',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+
+my $resampleType=$MenuOptions->cascade(-label=>'R~esample',
+ -accelerator => 'e');
+ # These should be cleaned up
+ foreach( ('None')) {
+ $resampleType->radiobutton(
+ -label => $_,
+ -variable => \$resample
+ );
+ }
+
+ $resampleType->radiobutton(
+ -label => 'Bootstrap',
+ -variable => \$resample,
+ -command => [$bootstrap_dialog=> 'Show']
+ );
+
+ $resampleType->radiobutton(
+ -label => 'Jackknife',
+ -variable => \$resample,
+ -command => [$jackknife_dialog=> 'Show']
+ );
+
+
+my $complexFilter_dialog = $mw->DialogBox(-title => 'Complexity Filter',
+ -default_button=>'OK',
+ -buttons=>['OK','Cancel']);
+
+$complexFilter_dialog->add('LabEntry',-textvariable=> \$complexUpper,
+ -width=>5,
+ -label=>'Upper Limit',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+$complexFilter_dialog->add('LabEntry',-textvariable=> \$complexLower,
+ -width=>5,
+ -label=>'Lower Limit',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+my $freqFilter_dialog = $mw->DialogBox(-title => 'Complexity Filter',
+ -default_button=>'OK',
+ -buttons=>['OK','Cancel']);
+
+$freqFilter_dialog->add('LabEntry',-textvariable=> \$freqUpper,
+ -width=>5,
+ -label=>'Upper Limit',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+$freqFilter_dialog->add('LabEntry',-textvariable=> \$freqLower,
+ -width=>5,
+ -label=>'Lower Limit',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+
+
+
+
+
+my $complexFilterType=$MenuOptions->cascade(-label=>'~Complexity Filter',
+ -accelerator => 'c');
+ # These should be cleaned up
+ foreach( ('None','Normal','Range')) {
+ $complexFilterType->radiobutton(
+ -label => $_,
+ -variable => \$complexFilter,
+ -command => [ $complexFilter_dialog, 'Show']
+ );
+ }
+
+my $freqFilterType=$MenuOptions->cascade(-label=>'~Frequency Filter',
+ -accelerator => 'f');
+ # These should be cleaned up
+ foreach( ('None','Normal','Extreme Value','Range')) {
+ $freqFilterType->radiobutton(
+ -label => $_,
+ -variable => \$freqFilter,
+ -command => [ $freqFilter_dialog, 'Show']
+ );
+ }
+
+my $treeType=$MenuOptions->cascade(-label=>'~Tree output',
+ -accelerator => 't');
+ # These should be cleaned up
+ foreach( ('None','Neighbor Joining','UPGMA')) {
+ $treeType->radiobutton(
+ -label => $_,
+ -variable => \$treeMethod
+ );
+ }
+
+# Tool Menu
+
+my $MenuTools =$f_MenuBar->cascade(-label=>'Tools',
+ -accelerator => 'Alt-t',
+ -tearoff => 0,
+ -underline => 0 );
+
+
+my $re_dialog = $mw->DialogBox(-title => 'Relative Entropy Profile',
+ -default_button=>'OK',
+ -buttons=> ['OK','Cancel']);
+
+$re_dialog->add('LabEntry',-textvariable=> \$lmerLower,
+ -width=>3,
+ -label=>'Beginning L-mer Length',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+$re_dialog->add('LabEntry',-textvariable=> \$lmerUpper,
+ -width=>3,
+ -label=>'Upper L-mer Length',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+
+
+
+
+$MenuTools->command(-label=>'~Relative Entropy Profile',
+ -accelerator => 'r',
+ -command => sub { &runReProf() }
+ );
+
+
+my $vocab_dialog = $mw->DialogBox(-title => 'Vocabulary Profile',
+ -default_button=>'OK',
+ -buttons=> ['OK','Cancel']);
+
+$vocab_dialog->add('LabEntry',-textvariable=> \$lmerLower,
+ -width=>3,
+ -label=>'Beginning L-mer Length',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+$vocab_dialog->add('LabEntry',-textvariable=> \$lmerUpper,
+ -width=>3,
+ -label=>'Upper L-mer Length',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+$vocab_dialog->add('LabEntry',-textvariable=> \$freqThresh,
+ -width=>3,
+ -label=>'Frequency Threshold',
+ -labelPack => [-side => 'left']
+ )->pack;
+
+
+$MenuTools->command(-label=>'~Vocabulary Profile',
+ -accelerator => 'v',
+ -command => sub { &runVocabProf() }
+ );
+
+
+my $MenuHelp =$f_MenuBar->cascade(-label=>'Help',
+ -accelerator => 'Alt-h',
+ -tearoff => 0,
+ -underline => 0 );
+
+my $ver_dialog = $mw->Dialog(-title => 'FFP Phylogeny',
+ -text => "FFP Phylogeny\nVersion $VERSION",
+ -buttons => ['OK'],
+ -bitmap => 'info');
+
+my $about_dialog = $mw->Dialog(-title => 'About FFP Phylogeny',
+ -text => 'About FFP Phylogeny',
+ -buttons=>['OK']);
+
+ $MenuHelp->command(-label=>'Help', -command => sub {&help_window($mw)} );
+ $MenuHelp->command(-label=>'Version', -command =>
+ [$ver_dialog => 'Show']);
+ $MenuHelp->separator;
+ $MenuHelp->command(-label=>'About', -command =>
+ [$about_dialog => 'Show']);
+
+
+my $MenuRun =$f_MenuBar->command(-label=>'Run',
+ -accelerator => 'Alt-R',
+ -command => sub { &runFFP() },
+ );
+$mw->configure(-menu=>$f_MenuBar, -takefocus=>1 );
+
+
+my $textBox = $mw->Scrolled('Text',
+ -height=>'40',
+ -width=>'100',
+ -scrollbars => 'osoe'
+ # -state=>'disabled',
+ )->pack;
+
+
+MainLoop;
+
+
+# depends on global variables
+
+sub runVocabProf() {
+ my $response=$vocab_dialog->Show();
+ my $type='';
+
+ if ($input_files eq "") {
+ $textBox->insert("end","Warning: You must open FASTA files first!\n");
+ return;
+ }
+ if ($reverse) { $reverse="-r" } else {$reverse='' }
+ if ($disable) { $disable="-d" } else {$disable='' }
+
+ if ($modeIdx eq 'Amino Acid Sequence') {$type='-a'}
+ if ($modeIdx eq 'Text') {$type='-t'}
+ if ($response eq 'OK' ) {
+ $textBox->insert("end","Running profile. Please wait.");
+ open(FILE,"ffpvprof $reverse $disable -f $freqThresh $type -s $lmerLower -e $lmerUpper @$input_files|");
+ while (my $line=<FILE>) {
+ $textBox->insert("end","$line");
+ }
+ close(FILE);
+ }
+
+}
+
+
+
+sub runReProf() {
+ my $response=$re_dialog->Show();
+ my $type='';
+
+ if ($input_files eq "") {
+ $textBox->insert("end","Warning: You must open FASTA files first!\n");
+ return;
+ }
+ if ($reverse) { $reverse="-r" } else {$reverse='' }
+ if ($disable) { $disable="-d" } else {$disable='' }
+
+ if ($modeIdx eq 'Amino Acid Sequence') {$type='-a'}
+ if ($modeIdx eq 'Text') {$type='-t'}
+ if ($response eq 'OK' ) {
+ $textBox->insert("end","Running profile. Please wait.");
+ open(FILE,"ffpreprof $reverse $disable $type -s $lmerLower -e $lmerUpper @$input_files|");
+ while (my $line=<FILE>) {
+ $textBox->insert("end","$line");
+ }
+ close(FILE);
+ }
+
+}
+
+
+sub saveMatrix {
+my $tmpdir=$tmp->dirname;
+my @types= (["Matrix files",[qw/.mat/]]);
+
+my $file = $mw->getSaveFile(-filetypes => \@types,
+ -defaultextension => ".mat"
+ );
+
+if (-e "$tmpdir/ffp.jsd.0") {
+ system("cat tmpdir/ffp.jsd.* > $file")
+} else {
+ system("mv $tmpdir/ffp.jsd $file");
+}
+}
+
+
+sub saveTree {
+my $tmpdir=$tmp->dirname;
+my @types= (["Newick tree files",[qw/.nwk/]]);
+
+my $file = $mw->getSaveFile(-filetypes => \@types,
+ -defaultextension => ".nwk"
+ );
+
+if (-e "$tmpdir/ffp.jsd.0") {
+ system("cat tmpdir/ffp.jsd.* > $file")
+} else {
+ system("mv $tmpdir/ffp.jsd $file");
+}
+}
+
+
+
+
+
+
+sub fileDialog {
+my ($w,$file) = @_;
+
+my @types= (["FASTA Files",[qw/.fasta .fna .faa/]]);
+
+$$file = $w->getOpenFile(-filetypes => \@types,
+ -multiple => MAX_FILES );
+if ($$file) {
+ foreach (@$$file) {
+ $textBox->insert("end","Opening $_.\n");
+ }
+}
+}
+
+
+sub featureFileDialog {
+ my ($w,$file) = @_;
+ my @types= (["Text File",[qw/.csv .txt/]]);
+ $$file = $w->getOpenFile(-filetypes => \@types);
+ if ($$file) {
+ $textBox->insert("end","Opening Feature @$$file.\n");
+ }
+}
+
+
+
+
+sub runFFP {
+ # make temp files
+ my $feature;
+ my $maskOpt='';
+ my $precisionOpt='';
+ my $columnar = 0;
+ if ($reverse) { $reverse="-r" } else {$reverse='' }
+ if ($disable) { $disable="-d" } else {$disable='' }
+ if ($similarity) { $similarity="-s" } else {$similarity='' }
+ if ($multiple) { $similarity="-m" } else {$multiple='' }
+ if ($mask) { $maskOpt="-w $mask" } else {$maskOpt=''}
+ if ($feature_file) {$feature= "-f @$feature_file"} else {$feature=''}
+ if (!$input_files) {
+ $textBox->insert("end","Warning: No input file(s) opened.\n");
+ return;
+ }
+
+
+ # It should be possible to merge dna aa and text into one group of comands
+
+ my $tmpdir=$tmp->dirname;
+
+ $textBox->insert("end","Running FFP $modeIdx.\n");
+ if ( $modeIdx eq "Nucleotide Sequence" ) {
+ $textBox->insert("end","Counting l-mers from input.\n");
+ system("ffpry -q $maskOpt $multiple $reverse $disable -l $length $feature @$input_files > $tmpdir/ffp ");
+ $textBox->insert("end","Done. Writing to $tmpdir/ffp.\n");
+ if ($complexFilter ne "None") {
+ $textBox->insert("end","Filtering features by complexity.\n");
+ system("ffpcomplex $disable $complexMethods{$complexFilter} $tmpdir/ffp > $tmpdir/ffpcomplex");
+ system("mv $tmpdir/ffp $tmpdir/ffp.prefilter ; mv $tmpdir/ffpcomplex $tmpdir/ffp");
+ }
+ if ($freqFilter ne "None" ) {
+ $textBox->insert("end","Filtering Features by frequency.\n");
+ system("ffpfilt -k $disable $freqMethods{$freqFilter} -u $freqUpper -l $freqLower $tmpdir/ffp > $tmpdir/ffpcomplex");
+ system("mv $tmpdir/ffp $tmpdir/ffp.prefilter2 ; mv $tmpdir/ffpcomplex $tmpdir/ffp");
+ $columnar=1;
+ }
+
+
+
+ if ($resample eq "None") {
+ if ($normMethods{$normalize}) {
+ $precisionOpt="-d $precision";
+ }
+ #Filter it by complexity
+ $textBox->insert("end","Converting $tmpdir/ffp to Columnar form.\n");
+ system("ffpcol $disable $tmpdir/ffp $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.col ");
+ $textBox->insert("end","Done. Writing to $tmpdir/ffp.col.\n");
+ $textBox->insert("end","Constructing Distance/Similarity Matrix.\n");
+ $num_taxa=`wc -l < $tmpdir/ffp.col`;
+ chomp $num_taxa;
+ system("seq 1 1 $num_taxa > $tmpdir/species.txt");
+ system("ffpjsd $precisionOpt $distances{$distance} $similarity -p $tmpdir/species.txt $tmpdir/ffp.col > $tmpdir/ffp.jsd");
+ $textBox->insert("end","Done writing to $tmpdir/ffp.jsd.\n");
+ } else {
+ $textBox->insert("end","Done. Beginning Bootstrap/Jackknife resampling.\n");
+ $textBox->insert("end","Converting $tmpdir/ffp to Columnar form.\n");
+ system("ffpcol $disable $tmpdir/ffp > $tmpdir/ffp.col");
+ $num_taxa=`wc -l < $tmpdir/ffp.col`;
+ chomp $num_taxa;
+ system("seq 1 1 $num_taxa > $tmpdir/species.txt");
+ for (my $i=0; $i < $replicates; $i++) {
+ $textBox->insert("end","Generating replicate $i.\n");
+ if ($resample eq "Jackknife") {
+ system("ffpboot -j -p $delProb -s $i $tmpdir/ffp.col $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.boot.$i ");
+ } else {
+ system("ffpboot -s $i $tmpdir/ffp.col $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.boot.$i ");
+ }
+ $textBox->insert("end","Done. Writing to file $tmpdir/ffp.boot.$i\n");
+ $textBox->insert("end","Computing Pseudo replicate matrix\n");
+ system("ffpjsd $precisionOpt $distances{$distance} $similarity -p $tmpdir/species.txt $tmpdir/ffp.boot.$i > $tmpdir/ffp.jsd.$i");
+ $textBox->insert("end","Done. Writing matrix to $tmpdir/ffp.jsd.$i\n");
+ }
+ }
+ } elsif ( $modeIdx eq "Amino Acid Sequence") {
+ $textBox->insert("end","Counting l-mers from input.\n");
+ system("ffpaa -q $maskOpt $multiple $disable -l $length $feature @$input_files > $tmpdir/ffp ");
+ $textBox->insert("end","Done. Writing to $tmpdir/ffp.\n");
+ if ($complexFilter ne "None") {
+ $textBox->insert("end","Filtering features by complexity.\n");
+ system("ffpcomplex -a $disable $complexMethods{$complexFilter} $tmpdir/ffp > $tmpdir/ffpcomplex");
+ system("mv $tmpdir/ffp $tmpdir/ffp.prefilter ; mv $tmpdir/ffpcomplex $tmpdir/ffp");
+ }
+ if ($freqFilter ne "None" ) {
+ $textBox->insert("end","Filtering Features by frequency.\n");
+ system("ffpfilt -a -k $disable $freqMethods{$freqFilter} -u $freqUpper -l $freqLower $tmpdir/ffp > $tmpdir/ffpcomplex");
+ system("mv $tmpdir/ffp $tmpdir/ffp.prefilter2 ; mv $tmpdir/ffpcomplex $tmpdir/ffp");
+ $columnar=1;
+ }
+
+
+
+ if ($resample eq "None") {
+ if ($normMethods{$normalize}) {
+ $precisionOpt="-d $precision";
+ }
+ #Filter it by complexity
+ $textBox->insert("end","Converting $tmpdir/ffp to Columnar form.\n");
+ system("ffpcol -a $disable $tmpdir/ffp $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.col ");
+ $num_taxa=`wc -l < $tmpdir/ffp.col`;
+ chomp $num_taxa;
+ system("seq 1 1 $num_taxa > $tmpdir/species.txt");
+ $textBox->insert("end","Done. Writing to $tmpdir/ffp.col.\n");
+ $textBox->insert("end","Constructing Distance/Similarity Matrix.\n");
+ system("ffpjsd $precisionOpt $distances{$distance} $similarity -p $tmpdir/species.txt $tmpdir/ffp.col > $tmpdir/ffp.jsd");
+ $textBox->insert("end","Done writing to $tmpdir/ffp.jsd.\n");
+ } else {
+ $textBox->insert("end","Done. Beginning Bootstrap/Jackknife resampling.\n");
+ $textBox->insert("end","Converting $tmpdir/ffp to Columnar form.\n");
+ system("ffpcol -a $disable $tmpdir/ffp > $tmpdir/ffp.col");
+ $num_taxa=`wc -l < $tmpdir/ffp.col`;
+ chomp $num_taxa;
+ system("seq 1 1 $num_taxa > $tmpdir/species.txt");
+ for (my $i=0; $i < $replicates; $i++) {
+ $textBox->insert("end","Generating replicate $i.\n");
+ if ($resample eq "Jackknife") {
+ system("ffpboot -j -p $delProb -s $i $tmpdir/ffp.col $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.boot.$i ");
+ } else {
+ system("ffpboot -s $i $tmpdir/ffp.col $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.boot.$i ");
+ }
+ $textBox->insert("end","Done. Writing to file $tmpdir/ffp.boot.$i\n");
+ $textBox->insert("end","Computing Pseudo replicate matrix\n");
+ system("ffpjsd $precisionOpt $distances{$distance} $similarity -p $tmpdir/species.txt $tmpdir/ffp.boot.$i > $tmpdir/ffp.jsd.$i");
+ $textBox->insert("end","Done. Writing matrix to $tmpdir/ffp.jsd.$i\n");
+ }
+
+ }
+ } elsif ( $modeIdx eq "Text") {
+ $textBox->insert("end","Counting l-mers from input.\n");
+ system("ffptxt -l $length $feature @$input_files > $tmpdir/ffp ");
+ $textBox->insert("end","Done. Writing to $tmpdir/ffp.\n");
+ if ($complexFilter ne "None") {
+ $textBox->insert("end","Filtering features by complexity.\n");
+ system("ffpcomplex -t $disable $complexMethods{$complexFilter} $tmpdir/ffp > $tmpdir/ffpcomplex");
+ system("mv $tmpdir/ffp $tmpdir/ffp.prefilter ; mv $tmpdir/ffpcomplex $tmpdir/ffp");
+ }
+ if ($freqFilter ne "None" ) {
+ $textBox->insert("end","Filtering Features by frequency.\n");
+ system("ffpfilt -t -k $disable $freqMethods{$freqFilter} -u $freqUpper -l $freqLower $tmpdir/ffp > $tmpdir/ffpcomplex");
+ system("mv $tmpdir/ffp $tmpdir/ffp.prefilter2 ; mv $tmpdir/ffpcomplex $tmpdir/ffp");
+ $columnar=1;
+ }
+
+
+
+ if ($resample eq "None") {
+ if ($normMethods{$normalize}) {
+ $precisionOpt="-d $precision";
+ }
+ #Filter it by complexity
+ $textBox->insert("end","Converting $tmpdir/ffp to Columnar form.\n");
+ system("ffpcol -t $disable $tmpdir/ffp $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.col ");
+ $textBox->insert("end","Done. Writing to $tmpdir/ffp.col.\n");
+ $textBox->insert("end","Constructing Distance/Similarity Matrix.\n");
+ $num_taxa=`wc -l < $tmpdir/ffp.col`;
+ chomp $num_taxa;
+ system("seq 1 1 $num_taxa > $tmpdir/species.txt");
+ system("ffpjsd $precisionOpt $distances{$distance} $similarity -p $tmpdir/species.txt $tmpdir/ffp.col > $tmpdir/ffp.jsd");
+ $textBox->insert("end","Done writing to $tmpdir/ffp.jsd.\n");
+ } else {
+ $textBox->insert("end","Done. Beginning Bootstrap/Jackknife resampling.\n");
+ $textBox->insert("end","Converting $tmpdir/ffp to Columnar form.\n");
+ system("ffpcol -t $disable $tmpdir/ffp > $tmpdir/ffp.col");
+ $num_taxa=`wc -l < $tmpdir/ffp.col`;
+ chomp $num_taxa;
+ system("seq 1 1 $num_taxa > $tmpdir/species.txt");
+ for (my $i=0; $i < $replicates; $i++) {
+ $textBox->insert("end","Generating replicate $i.\n");
+ if ($resample eq "Jackknife") {
+ system("ffpboot -j -p $delProb -s $i $tmpdir/ffp.col $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.boot.$i ");
+ } else {
+ system("ffpboot -s $i $tmpdir/ffp.col $normMethods{$normalize} $precisionOpt > $tmpdir/ffp.boot.$i ");
+ }
+ $textBox->insert("end","Done. Writing to file $tmpdir/ffp.boot.$i\n");
+ $textBox->insert("end","Computing Pseudo replicate matrix\n");
+ system("ffpjsd $precisionOpt $distances{$distance} $similarity -p $tmpdir/species.txt $tmpdir/ffp.boot.$i > $tmpdir/ffp.jsd.$i");
+ $textBox->insert("end","Done. Writing matrix to $tmpdir/ffp.jsd.$i\n");
+ }
+ }
+
+
+ } else {
+ # Should never see
+ }
+
+ # Build trees
+
+ if ($treeMethod eq "Neighbor Joining") {
+ # add error checking for not using phylip output
+ $textBox->insert("end","Computing Neighbor Joining tree.\n");
+ if ($resample eq "None") {
+ system("ffptree $tmpdir/ffp.jsd > $tmpdir/tree 2> $tmpdir/progress ");
+ printFileToTextBox($textBox,"$tmpdir/progress");
+ } else {
+ for (my $i=0; $i < $replicates; $i++) {
+ system("ffptree $tmpdir/ffp.boot.$i > $tmpdir/tree.$i 2> $tmpdir/progress ");
+ printFileToTextBox($textBox,"$tmpdir/progress");
+ }
+ }
+ } elsif ($treeMethod eq "UPGMA" ) {
+ $textBox->insert("end","Computing UPGMA tree.\n");
+ if ($resample eq "None") {
+ system("ffptree -n $tmpdir/ffp.jsd > $tmpdir/tree 2> $tmpdir/progress");
+ printFileToTextBox($textBox,"$tmpdir/progress");
+ } else {
+ for (my $i=0; $i < $replicates; $i++) {
+ system("ffptree -n $tmpdir/ffp.boot.$i > $tmpdir/tree.$i 2> $tmpdir/progress ");
+ printFileToTextBox($textBox,"$tmpdir/progress");
+ }
+ }
+
+
+ } else {
+ }
+
+
+ $textBox->insert("end","Complete.\n");
+ $textBox->see("end");
+}
+
+sub printFileToTextBox() {
+ my ($textBox,$file)=@_;
+
+ open(FILE,$file);
+ while (my $line=<FILE>) {
+ $textBox->insert("end",$line);
+ }
+ close(FILE);
+}
+
+
+
+sub help_window() {
+my ($parent)=@_;
+my $help_win=$parent->Toplevel(-title => "FFP Phylogeny Help"
+
+ );
+my $t=$help_win->Scrolled('Text',
+ -width => 80,
+ -height => 25,
+ -wrap => "none",
+ -scrollbars => "osoe")->pack;
+$help_win->Button(-text=> "Done",
+ -command => [$help_win=>'destroy'])->pack;
+
+fill_textbox($t);
+
+
+}
+
+
+
+sub fill_textbox() {
+my ($t) =@_;
+# set this with config
+open(FILE,"[@]DOC[@]/README");
+while (my $line=<FILE>) {
+ $t->insert('end',$line);
+}
+close(FILE);
+
+}
+
+sub clean_up() {
+ remove_tree($tmp);
+ exit 0;
+}
+
diff --git a/scripts/ffpreprof.in b/scripts/ffpreprof.in
new file mode 100755
index 0000000..d9eb74d
--- /dev/null
+++ b/scripts/ffpreprof.in
@@ -0,0 +1,224 @@
+#!/usr/bin/env bash
+# This code is distributed under a Non-commerical use
+# License. See LICENSE for more details. Use of this
+# code must be properly attributed to its author
+# Gregory E. Sims provided that its use or derivative
+# use is non-commercial in nature. Proper attribution
+# can be made by citing:
+#
+# Sims GE, et al (2009) Alignment-free genome
+# comparison with feature frequency profiles (FFP) and
+# optimal resolutions. Proc. Natl. Acad. Sci. USA.
+# 106, 2677-82.
+#
+# Gregory E. Sims (C) 2010-2012
+#
+#####################################################
+
+# See man page ffpreprof(1) for full manual.
+# See man page ffpre(1) for further reference.
+
+#Set shell options
+shopt -s -o nounset # All variables must be declared
+
+#Read only variables
+declare -r SCRIPT=${0##*/}
+declare -r VERSION='[@]VERSION[@]'
+declare -r PACKAGE='FFP PHYLOGENY'
+declare -r AUTHOR='Gregory E. Sims'
+declare -r YEAR='2011'
+declare -r EMAIL='[@]EMAIL[@]'
+declare -r MAXWORD=${MAX_WORD_SIZE-40}
+declare -r MACOSX='[@]ISOSX[@]'
+
+#Is the terminal connected to stdin?
+tty -s
+declare -r ISTTY=$?
+
+TMP=/tmp
+TMPDIR=
+TMPFILE=
+LONGOPTSDIS=
+
+function print_usage() {
+ cat <<-EOF
+ $SCRIPT - Constructs a relative entropy profile
+ Usage: $SCRIPT [OPTIONS] ... [FILE] ...
+ $LONGOPTSDIS
+ -d, --disable-ry Use ATGC coding, default is RY
+ -s LEN, --start=LEN Specify start length range, default 1
+ -e LEN, --end=LEN Specify end length range, default 20
+ -a, --amino Files contains amino acids
+ -t, --text Files contain text
+ -r, --no-reverse Disable reverse complement matching
+ -T, --tmpdir Directory for temporary files, default is /tmp
+ -p, --path Path to ffpre executable if not in path
+ -v, --version Version Information
+ -h, --help This help message
+
+ $AUTHOR, $YEAR
+ $EMAIL
+ EOF
+}
+
+
+function print_version() {
+ cat <<-EOF
+ $SCRIPT ($VERSION) $PACKAGE
+ $AUTHOR (c) $YEAR
+ $EMAIL
+ EOF
+}
+
+# Perform program exit housekeeping
+# Optionally accepts an exit status
+
+function clean_up() {
+ rm -rf $TMPFILE
+ exit $1
+}
+
+
+function die() {
+ echo "$*" >&2
+ clean_up 1
+}
+
+function fatal() {
+ die "$SCRIPT: $*"
+}
+
+function warn() {
+ echo "$SCRIPT: $*" 1>&2
+}
+
+# SETUP actions for early termination
+trap "clean_up 1" ABRT HUP INT QUIT PIPE
+
+#Getopt flags
+DFLAG= # Disable RY coding
+AFLAG= # Amino acid Input
+TFLAG= # Text Input
+RFLAG= # Disable Reverse complement
+EXE_DIR=
+
+declare -i START=3
+declare -i END=20
+OPTSTRING="adhe:s:tT:vrp:"
+LOPTSTRING="amino,disable-ry,help,start:,end:,text,tmpdir:,version,no-reverse,path:"
+RESULT=
+
+
+# Check which version of getopt is being used.
+# If enhanced return value is 4.
+getopt -T &> /dev/null
+COMPATIBLE=$?
+if [ "$COMPATIBLE" = "4" ] ; then
+ RESULT=$(getopt -s "bash" -n "$SCRIPT" -o "$OPTSTRING" -l "$LOPTSTRING" -- "$@")
+ STATUS=$?
+else
+ LONGOPTSDIS="LONG OPTIONS DISABLED"
+ warn "Long options disabled: Install enhanced 'getopt'"
+ RESULT=$(getopt $OPTSTRING $*)
+ STATUS=$?
+fi
+
+# Error in command line options
+[ $STATUS -eq 0 ] || die "Try '$SCRIPT --help' for more information."
+
+#double substitute RESULT with eval
+#and place options in the script parameter list
+
+eval set -- "$RESULT"
+
+while [ true ] ; do
+ case "$1" in
+ -d|--disable-ry)
+ DFLAG="-d"
+ ;;
+ -a|--amino)
+ AFLAG="-a"
+ ;;
+ -t|--text)
+ TFLAG="-t"
+ ;;
+ -r|--no-reverse)
+ RFLAG="-r"
+ ;;
+ -T|--tmpdir)
+ shift
+ TMP="$1"
+ ;;
+ -p|--path)
+ shift
+ EXE_DIR="$1"
+ ;;
+ -s|--start)
+ shift
+ [[ "$1" =~ ^[0-9]+$ ]] \
+ || die "SCRIPT: -s $1: Integer expected"
+ START="$1"
+ ;;
+ -e|--end)
+ shift
+ [[ "$1" =~ ^[0-9]+$ ]] \
+ || die "SCRIPT: -e $1: Integer expected"
+ END="$1"
+ ;;
+ -v|--version)
+ print_version
+ exit 0
+ ;;
+ -h|--help)
+ print_usage
+ exit 0
+ ;;
+ --)
+ shift
+ break
+ ;;
+ esac
+ shift
+
+done
+
+ARGV=$*
+export PATH=$EXE_DIR:$PATH
+
+# If stdin connected to tty
+# issue an error with zero arguments
+if [ $ISTTY = 0 -a $# = 0 ] ; then
+ echo "$SCRIPT: Missing FILE argument(s)." >&2
+ die "Try '$SCRIPT --help' for more information."
+elif [ $# = 0 ] ; then
+
+ if [ ! -d $TMP ] ; then
+ mkdir -p -m a+rwt $TMP || die "$SCRIPT: Failed to create '$TMP' temp dir."
+ fi
+
+ if [ -n "$MACOSX" ] ; then
+ TMPFILE=$(mktemp -t $TMP)
+ else
+ TMPFILE=$(mktemp -p $TMP)
+ fi
+
+ ARGV=$TMPFILE
+
+ # Create a tempfile from stdin
+ cat <&0 > $TMPFILE || fatal "Failed to create '$TMPFILE' tempfile."
+fi
+
+
+[ $START -ge 3 ] || fatal "-s $START: Argument must be >= 3"
+[ $END -ge $START ] || fatal "-e $END must be >= -s $START"
+[ $END -le $MAXWORD ] || fatal "-e $END must be less than $MAXWORD"
+[ $START -le $MAXWORD ] || fatal "-s $START must be less than $MAXWORD"
+
+for (( LEN=START; LEN<=END; LEN++ )) ; do
+ RELENTROPY=$( ffpre -l $LEN $DFLAG $AFLAG $TFLAG $RFLAG $ARGV )
+ echo $LEN $RELENTROPY
+done
+
+clean_up 0
+
+
diff --git a/scripts/ffpsubnam.in b/scripts/ffpsubnam.in
new file mode 100644
index 0000000..fa4cf9d
--- /dev/null
+++ b/scripts/ffpsubnam.in
@@ -0,0 +1,167 @@
+#!/usr/bin/env bash
+# This code is distributed under a Non-commerical use
+# License. See LICENSE for more details. Use of this
+# code must be properly attributed to its author
+# Gregory E. Sims provided that its use or derivative
+# use is non-commercial in nature. Proper attribution
+# can be made by citing:
+#
+# Sims GE, et al (2009) Alignment-free genome
+# comparison with feature frequency profiles (FFP) and
+# optimal resolutions. Proc. Natl. Acad. Sci. USA.
+# 106, 2677-82.
+#
+# Gregory E. Sims (C) 2010-2012
+#
+#####################################################
+
+
+
+#Set shell options
+shopt -s -o nounset # All variables must be declared
+
+#Read only variables
+declare -r SCRIPT=${0##*/}
+declare -r VERSION='[@]VERSION[@]'
+declare -r PACKAGE='FFP PHYLOGENY'
+declare -r AUTHOR='Gregory E. Sims'
+declare -r YEAR='2011'
+declare -r EMAIL='[@]EMAIL[@]'
+
+#Is the terminal connected to stdin?
+tty -s
+declare -r ISTTY=$?
+
+TMP=/tmp
+TMPDIR=
+TMPFILE=
+
+function print_usage() {
+ cat <<-EOF
+ $SCRIPT - Replaces taxa names in phylip 'infile'
+ Usage: $SCRIPT [OPTIONS] [NAMES] [INFILE]
+
+ -o, --outfile Specify output file, def STDOUT
+ -v, --version Version Information
+ -h, --help This help message
+
+ $AUTHOR, $YEAR
+ $EMAIL
+ EOF
+}
+
+
+function print_version() {
+ cat <<-EOF
+ $SCRIPT ($VERSION) $PACKAGE
+ $AUTHOR (c) $YEAR
+ $EMAIL
+ EOF
+}
+
+# Perform program exit housekeeping
+# Optionally accepts an exit status
+
+function clean_up() {
+ rm -rf $TMPDIR
+ exit $1
+}
+
+
+function die() {
+ echo "$*" >&2
+ clean_up 1
+}
+
+
+# SETUP actions for early termination
+trap "clean_up 1" ABRT HUP INT QUIT
+
+
+
+STDOUT=/dev/stdout
+
+OPTSTRING="o:hv"
+LOPTSTRING="out:,help,version"
+RESULT=
+
+# Check which version of getopt is being used.
+# If enhanced return value is 4.
+getopt -T &> /dev/null
+COMPATIBLE=$?
+if [ "$COMPATIBLE" = "4" ] ; then
+ RESULT=$(getopt -s "bash" -n "$SCRIPT" -o "$OPTSTRING" -l "$LOPTSTRING" -- "$@")
+ STATUS=$?
+else
+ LONGOPTSDIS="LONG OPTIONS DISABLED"
+ warn "Long options disabled: Install enhanced 'getopt'"
+ RESULT=$(getopt $OPTSTRING $*)
+ STATUS=$?
+fi
+
+[ $STATUS -eq 0 ] || die "Try '$SCRIPT --help' for more information."
+
+eval set -- "$RESULT"
+
+while [ true ] ; do
+ case "$1" in
+ -o|--out)
+ shift
+ [ -w "$1" ] || die "$SCRIPT: $1: Write permission denied"
+ STDOUT="$1"
+ ;;
+ -v|--version)
+ print_version
+ exit 0
+ ;;
+ -h|--help)
+ print_usage
+ exit 0
+ ;;
+ --)
+ shift
+ break
+ ;;
+ esac
+ shift
+
+done
+
+
+# If stdin connected to tty
+# issue an error if not exactly 2 argumentus
+# If infile piped in then expect a NAMES file argument
+if [ $ISTTY = 0 -a $# != 2 ] ; then
+ echo "$SCRIPT: Expected 2 arguments" >&2
+ die "Try '$SCRIPT --help' for more information."
+elif [ $ISTTY = 1 -a $# != 1 ]; then
+ echo "$SCRIPT: Expected NAME argument" >&2
+ die "Try '$SCRIPT --help' for more information."
+elif [ $ISTTY = 1 -a $# = 1 ] ; then
+ $TAXA=$1
+ $INFILE=/dev/stdin
+else
+ $TAXA=$1
+ $INFILE=$2
+fi
+
+
+[ -e $TAXA ] || die "$SCRIPT: $TAXA: No such file"
+[ -e $INFILE ] || die "$SCRIPT: $INFILE: No such file"
+
+NTAXA=$(wc -l < $TAXA)
+if [ "$NTAXA" != $(tail -n +2 $INFILE | wc -l) ] ; then
+ die "$SCRIPT: Number of taxa in $TAXA and $INFILE not equal."
+fi
+
+
+# substitute the first 10 single byte columns for
+# input from file 1.
+
+cat <(head -n 1 $INFILE) > $STDOUT
+paste -d "" <(sed 's/ /_/g;s/\t/_/g' $TAXA|awk '{printf("%-10.10s\n",$1);}') \
+ <(tail -n +2 $INFILE | cut -c11- ) >> $STDOUT
+
+
+clean_up 0
+
diff --git a/scripts/ffpvprof.in b/scripts/ffpvprof.in
new file mode 100755
index 0000000..c82f9c8
--- /dev/null
+++ b/scripts/ffpvprof.in
@@ -0,0 +1,238 @@
+#!/usr/bin/env bash
+# This code is distributed under a Non-commerical use
+# License. See LICENSE for more details. Use of this
+# code must be properly attributed to its author
+# Gregory E. Sims provided that its use or derivative
+# use is non-commercial in nature. Proper attribution
+# can be made by citing:
+#
+# Sims GE, et al (2009) Alignment-free genome
+# comparison with feature frequency profiles (FFP) and
+# optimal resolutions. Proc. Natl. Acad. Sci. USA.
+# 106, 2677-82.
+#
+# Gregory E. Sims (C) 2010-2012
+#
+#####################################################
+
+# See man page ffpvprof(1) for full manual.
+# Also see ffpvocab(1) for further reference.
+
+#Set shell options
+shopt -s -o nounset # All variables must be declared
+
+#Read only variables
+declare -r AUTHOR='Gregory E. Sims'
+declare -r YEAR='2011'
+declare -r EMAIL='[@]EMAIL[@]'
+declare -r SCRIPT=${0##*/}
+declare -r VERSION='[@]VERSION[@]'
+declare -r PACKAGE='FFP PHYLOGENY'
+declare -r MAXWORD=${MAX_WORD_SIZE-40} # This should possibly be set by make
+declare -r MACOSX='[@]ISOSX[@]'
+
+#Is the terminal connected to stdin or a pipe
+tty -s
+declare -r ISTTY=$?
+
+TMP=/tmp
+TMPFILE=
+
+#Option flags and default values
+DFLAG=
+AFLAG=
+RFLAG=
+ZFLAG=
+MISMATCH=
+EXE_DIR=
+EXECUTABLE='ffpry'
+LONGOPTSDIS=
+declare -i START=1
+declare -i END=20
+declare -i THRESHOLD=2
+
+
+function die() {
+ echo "$*" >&2
+ clean_up 1
+}
+
+function fatal() {
+ die "$SCRIPT: $*"
+}
+
+
+function print_usage() {
+ cat <<-EOF
+ $SCRIPT - Constructs a word usage (vocabulary) profile
+ Usage: $SCRIPT [OPTIONS] ... [FILE] ...
+ $LONGOPTSDIS
+ -d, --disable-class Disable classing (use full alphabet)
+ -a, --amino Amino acid input, default DNA input
+ -r, --no-reverse Disable reverse complement matching
+ -z N, --rand-mask=N Random weight mask, N mismatches
+ -s N, --start=N Specify START length range, default 3
+ -e N, --end=N Specify END length range, default 20
+ -f N, --freq-thresh=N Specify word frequency THRESHOLD [Def. 1]
+ -p STR, --path=STR Path to executables, if not in path
+ -T STR, --tmpdir=STR Directory for temporary files
+ -v, --version Version Information
+ -h, --help This Message
+
+ $AUTHOR, (C) $YEAR
+ $EMAIL
+ EOF
+}
+
+function print_version() {
+ cat <<-EOF
+ $SCRIPT ($VERSION) $PACKAGE
+ $AUTHOR (c) $YEAR
+ $EMAIL
+ EOF
+}
+
+
+# Perform program exit housekeeping
+# Optionally accepts an exit status
+
+function clean_up() {
+ rm -fr $TMPFILE;
+ exit $1
+}
+
+# SETUP actions for early termination
+trap "clean_up 1" ABRT HUP INT QUIT PIPE
+
+OPTSTRING="ade:f:hs:T:vrz:p:"
+LOPTSTRING="amino, disable-class,end:,freq-thresh:,help,start:,tmpdir:,version,no-reverse,rand-mask:path"
+
+# Check which version of getopt is being used.
+# If enhanced return value is 4.
+getopt -T &> /dev/null
+COMPATIBLE=$?
+if [ "$COMPATIBLE" = "4" ] ; then
+ RESULT=$(getopt -s "bash" -n "$SCRIPT" -o "$OPTSTRING" -l "$LOPTSTRING" -- "$@")
+ STATUS=$?
+else
+ LONGOPTSDIS="LONG OPTIONS DISABLED"
+ warn "Long options disabled: Install enhanced 'getopt'"
+ RESULT=$(getopt $OPTSTRING $*)
+ STATUS=$?
+fi
+
+[ $STATUS -eq 0 ] || die "Try '$SCRIPT --help' for more information."
+
+#double substitute RESULT with eval
+#and place options in the script parameter list
+
+eval set -- "$RESULT"
+
+
+while [ true ] ; do
+ case "$1" in
+ -d|--disable-class)
+ DFLAG="-d"
+ ;;
+ -a|--amino)
+ AFLAG="-a"
+ EXECUTABLE="ffpaa"
+ ;;
+ -r|--no-reverse)
+ RFLAG="-r"
+ ;;
+ -z|--rand-mask)
+ shift
+ [[ "$1" =~ ^[0-9]+$ ]] \
+ || fatal "-s $1: Integer expected"
+ ZFLAG="-z"
+ MISMATCH=$1
+ ;;
+ -s|--start)
+ shift
+ [[ "$1" =~ ^[0-9]+$ ]] \
+ || fatal "-s $1: Integer expected"
+ START=$1
+ ;;
+ -e|--end)
+ shift
+ [[ "$1" =~ ^[0-9]+$ ]] \
+ || fatal "-e $1: Integer expected"
+ END=$1
+ ;;
+ -f|--freq-thresh)
+ shift
+ [[ "$1" =~ ^[0-9]+$ ]] \
+ || fatal "-f $1: Integer expected"
+ THRESHOLD=$1
+ ;;
+ -p|--path)
+ shift
+ EXE_DIR="$1"
+ ;;
+ -h|--help)
+ print_usage
+ exit 0
+ ;;
+ -v|--version)
+ print_version
+ exit 0
+ ;;
+ -T|--tmpdir)
+ shift
+ TMP="$1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ esac
+ shift
+done
+
+ARGV=$*
+export PATH=$EXE_DIR:$PATH
+# If stdin connected to tty
+# issue an error with zero arguments
+if [ $ISTTY = 0 -a $# = 0 ] ; then
+ echo "$SCRIPT: Missing FILE argument(s)." >&2
+ die "Try '$SCRIPT --help' for more information."
+elif [ $# = 0 ] ; then
+ if [ ! -e $TMP ] ; then
+ mkdir -p -m a+rwt $TMP || fatal "Failed to create '$TMP' temp dir."
+ fi
+
+ if [ -n "$MACOSX" ] ; then
+ TMPFILE=$(mktemp -t $TMP)
+ else
+ TMPFILE=$(mktemp -p $TMP)
+ fi
+
+ ARGV=$TMPFILE
+ # Create a tempfile from stdin
+ cat <&0 > $TMPFILE || fatal "Failed to create '$TMPFILE' tempfile."
+fi
+
+if [ -n "$MISMATCH" ] ; then
+ [ "$MISMATCH" -lt "$START" ] || fatal "-z $MISMATCH must be less than -s $START."
+fi
+
+[ -n "$AFLAG" -a -n "$RFLAG" ] && fatal "-r not applicable to protein sequence."
+[ $START -ge 1 ] || fatal "-s $START: must be >= 1."
+[ $END -ge $START ] || fatal "-e $END: must be >= -s $START."
+[ $THRESHOLD -ge 1 ] || fatal "-f $THRESHOLD: must be > 0."
+[ $END -le $MAXWORD ] || fatal "-e $END must be less than $MAXWORD."
+[ $START -le $MAXWORD ] || fatal "-s $START must be less than $MAXWORD."
+
+# Iterate through feature lengths
+
+
+for (( LEN=START; LEN<=END; LEN++ )) ; do
+ NUMFEATURES=$( $EXECUTABLE -l $LEN $DFLAG $RFLAG $ZFLAG $MISMATCH $ARGV | ffpvocab -f $THRESHOLD )
+ echo $LEN $NUMFEATURES
+done
+
+clean_up 0
+
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..b4b9e28
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,31 @@
+# what flags you want to pass to the C compiler & linker
+#AM_CFLAGS = --pedantic -Wall -std=c99 -O3 -pg
+AM_CPPFLAGS = --pedantic -Wall -std=c99 -O3 #-pg
+AM_LDFLAGS = #-pg
+#
+# this lists the binaries to produce, the (non-PHONY, binary) targets in
+# the previous manual Makefile
+bin_PROGRAMS = ffpry ffpaa ffprwn ffpjsd ffpboot ffpvocab ffpre ffpmerge ffpcol ffptxt ffpfilt ffpcomplex ffptree #ffpgui2
+ffpry_SOURCES = ffpry.c ffpry.h hashroll.c hashroll.h mask.c mask.h utils.c utils.h vstring.h sighandle.c sighandle.h parse_features.c parse_features.h
+ffpaa_SOURCES = ffpaa.c hashroll.c hashroll.h mask.c mask.h utils.h utils.c vstring.h sighandle.c sighandle.h parse_features.h parse_features.c
+ffprwn_SOURCES = ffprwn.c utils.c utils.h vstring.h sighandle.c sighandle.h
+ffpjsd_SOURCES = ffpjsd.c utils.c utils.h vstring.h vstring.h sighandle.c sighandle.h
+ffpboot_SOURCES = ffpboot.c utils.c utils.h vstring.h sighandle.c sighandle.h
+ffpvocab_SOURCES = ffpvocab.c vstring.h utils.c utils.h sighandle.c sighandle.h
+ffpre_SOURCES = ffpre.c hashroll.c hashroll.h utils.c utils.h vstring.h sighandle.c sighandle.h
+ffpmerge_SOURCES = ffpmerge.c hash.c hash.h utils.c utils.h vstring.h sighandle.c sighandle.h
+ffpcol_SOURCES = ffpcol.c hash.c hash.h utils.c utils.h vstring.h sighandle.c sighandle.h
+ffptxt_SOURCES = ffptxt.c hashroll.c hashroll.h utils.c utils.h vstring.h sighandle.c sighandle.h parse_features.c parse_features.h
+ffpfilt_SOURCES = ffpfilt.c hash.c hash.h utils.c utils.h vstring.h cdfmacros.h sighandle.c sighandle.h
+ffpcomplex_SOURCES = ffpcomplex.c hash.c hash.h utils.c utils.h vstring.h cdfmacros.h sighandle.c sighandle.h
+ffptree_SOURCES = ffptree.c utils.c utils.h sighandle.c sighandle.h
+#ffpgui2_SOURCES = tcl.c
+
+
+# Binary specific libraries
+# ffpgui2_LDADD = -ltk8.5 -ltcl8.5
+
+
+# added this line otherwise received errors using 'make dist'
+noinst_HEADERS = ffpry.h hash.h mask.h parse_features.h utils.h codon.h vstring.h sighandle.h
+
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..e530301
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,604 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = ffpry$(EXEEXT) ffpaa$(EXEEXT) ffprwn$(EXEEXT) \
+ ffpjsd$(EXEEXT) ffpboot$(EXEEXT) ffpvocab$(EXEEXT) \
+ ffpre$(EXEEXT) ffpmerge$(EXEEXT) ffpcol$(EXEEXT) \
+ ffptxt$(EXEEXT) ffpfilt$(EXEEXT) ffpcomplex$(EXEEXT) \
+ ffptree$(EXEEXT)
+subdir = src
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_ffpaa_OBJECTS = ffpaa.$(OBJEXT) hashroll.$(OBJEXT) mask.$(OBJEXT) \
+ utils.$(OBJEXT) sighandle.$(OBJEXT) parse_features.$(OBJEXT)
+ffpaa_OBJECTS = $(am_ffpaa_OBJECTS)
+ffpaa_LDADD = $(LDADD)
+am_ffpboot_OBJECTS = ffpboot.$(OBJEXT) utils.$(OBJEXT) \
+ sighandle.$(OBJEXT)
+ffpboot_OBJECTS = $(am_ffpboot_OBJECTS)
+ffpboot_LDADD = $(LDADD)
+am_ffpcol_OBJECTS = ffpcol.$(OBJEXT) hash.$(OBJEXT) utils.$(OBJEXT) \
+ sighandle.$(OBJEXT)
+ffpcol_OBJECTS = $(am_ffpcol_OBJECTS)
+ffpcol_LDADD = $(LDADD)
+am_ffpcomplex_OBJECTS = ffpcomplex.$(OBJEXT) hash.$(OBJEXT) \
+ utils.$(OBJEXT) sighandle.$(OBJEXT)
+ffpcomplex_OBJECTS = $(am_ffpcomplex_OBJECTS)
+ffpcomplex_LDADD = $(LDADD)
+am_ffpfilt_OBJECTS = ffpfilt.$(OBJEXT) hash.$(OBJEXT) utils.$(OBJEXT) \
+ sighandle.$(OBJEXT)
+ffpfilt_OBJECTS = $(am_ffpfilt_OBJECTS)
+ffpfilt_LDADD = $(LDADD)
+am_ffpjsd_OBJECTS = ffpjsd.$(OBJEXT) utils.$(OBJEXT) \
+ sighandle.$(OBJEXT)
+ffpjsd_OBJECTS = $(am_ffpjsd_OBJECTS)
+ffpjsd_LDADD = $(LDADD)
+am_ffpmerge_OBJECTS = ffpmerge.$(OBJEXT) hash.$(OBJEXT) \
+ utils.$(OBJEXT) sighandle.$(OBJEXT)
+ffpmerge_OBJECTS = $(am_ffpmerge_OBJECTS)
+ffpmerge_LDADD = $(LDADD)
+am_ffpre_OBJECTS = ffpre.$(OBJEXT) hashroll.$(OBJEXT) utils.$(OBJEXT) \
+ sighandle.$(OBJEXT)
+ffpre_OBJECTS = $(am_ffpre_OBJECTS)
+ffpre_LDADD = $(LDADD)
+am_ffprwn_OBJECTS = ffprwn.$(OBJEXT) utils.$(OBJEXT) \
+ sighandle.$(OBJEXT)
+ffprwn_OBJECTS = $(am_ffprwn_OBJECTS)
+ffprwn_LDADD = $(LDADD)
+am_ffpry_OBJECTS = ffpry.$(OBJEXT) hashroll.$(OBJEXT) mask.$(OBJEXT) \
+ utils.$(OBJEXT) sighandle.$(OBJEXT) parse_features.$(OBJEXT)
+ffpry_OBJECTS = $(am_ffpry_OBJECTS)
+ffpry_LDADD = $(LDADD)
+am_ffptree_OBJECTS = ffptree.$(OBJEXT) utils.$(OBJEXT) \
+ sighandle.$(OBJEXT)
+ffptree_OBJECTS = $(am_ffptree_OBJECTS)
+ffptree_LDADD = $(LDADD)
+am_ffptxt_OBJECTS = ffptxt.$(OBJEXT) hashroll.$(OBJEXT) \
+ utils.$(OBJEXT) sighandle.$(OBJEXT) parse_features.$(OBJEXT)
+ffptxt_OBJECTS = $(am_ffptxt_OBJECTS)
+ffptxt_LDADD = $(LDADD)
+am_ffpvocab_OBJECTS = ffpvocab.$(OBJEXT) utils.$(OBJEXT) \
+ sighandle.$(OBJEXT)
+ffpvocab_OBJECTS = $(am_ffpvocab_OBJECTS)
+ffpvocab_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(ffpaa_SOURCES) $(ffpboot_SOURCES) $(ffpcol_SOURCES) \
+ $(ffpcomplex_SOURCES) $(ffpfilt_SOURCES) $(ffpjsd_SOURCES) \
+ $(ffpmerge_SOURCES) $(ffpre_SOURCES) $(ffprwn_SOURCES) \
+ $(ffpry_SOURCES) $(ffptree_SOURCES) $(ffptxt_SOURCES) \
+ $(ffpvocab_SOURCES)
+DIST_SOURCES = $(ffpaa_SOURCES) $(ffpboot_SOURCES) $(ffpcol_SOURCES) \
+ $(ffpcomplex_SOURCES) $(ffpfilt_SOURCES) $(ffpjsd_SOURCES) \
+ $(ffpmerge_SOURCES) $(ffpre_SOURCES) $(ffprwn_SOURCES) \
+ $(ffpry_SOURCES) $(ffptree_SOURCES) $(ffptxt_SOURCES) \
+ $(ffpvocab_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT = @GETOPT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ISOSX = @ISOSX@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKTEMP = @MKTEMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# what flags you want to pass to the C compiler & linker
+#AM_CFLAGS = --pedantic -Wall -std=c99 -O3 -pg
+AM_CPPFLAGS = --pedantic -Wall -std=c99 -O3 #-pg
+AM_LDFLAGS = #-pg
+ffpry_SOURCES = ffpry.c ffpry.h hashroll.c hashroll.h mask.c mask.h utils.c utils.h vstring.h sighandle.c sighandle.h parse_features.c parse_features.h
+ffpaa_SOURCES = ffpaa.c hashroll.c hashroll.h mask.c mask.h utils.h utils.c vstring.h sighandle.c sighandle.h parse_features.h parse_features.c
+ffprwn_SOURCES = ffprwn.c utils.c utils.h vstring.h sighandle.c sighandle.h
+ffpjsd_SOURCES = ffpjsd.c utils.c utils.h vstring.h vstring.h sighandle.c sighandle.h
+ffpboot_SOURCES = ffpboot.c utils.c utils.h vstring.h sighandle.c sighandle.h
+ffpvocab_SOURCES = ffpvocab.c vstring.h utils.c utils.h sighandle.c sighandle.h
+ffpre_SOURCES = ffpre.c hashroll.c hashroll.h utils.c utils.h vstring.h sighandle.c sighandle.h
+ffpmerge_SOURCES = ffpmerge.c hash.c hash.h utils.c utils.h vstring.h sighandle.c sighandle.h
+ffpcol_SOURCES = ffpcol.c hash.c hash.h utils.c utils.h vstring.h sighandle.c sighandle.h
+ffptxt_SOURCES = ffptxt.c hashroll.c hashroll.h utils.c utils.h vstring.h sighandle.c sighandle.h parse_features.c parse_features.h
+ffpfilt_SOURCES = ffpfilt.c hash.c hash.h utils.c utils.h vstring.h cdfmacros.h sighandle.c sighandle.h
+ffpcomplex_SOURCES = ffpcomplex.c hash.c hash.h utils.c utils.h vstring.h cdfmacros.h sighandle.c sighandle.h
+ffptree_SOURCES = ffptree.c utils.c utils.h sighandle.c sighandle.h
+#ffpgui2_SOURCES = tcl.c
+
+# Binary specific libraries
+# ffpgui2_LDADD = -ltk8.5 -ltcl8.5
+
+# added this line otherwise received errors using 'make dist'
+noinst_HEADERS = ffpry.h hash.h mask.h parse_features.h utils.h codon.h vstring.h sighandle.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+ffpaa$(EXEEXT): $(ffpaa_OBJECTS) $(ffpaa_DEPENDENCIES)
+ @rm -f ffpaa$(EXEEXT)
+ $(LINK) $(ffpaa_OBJECTS) $(ffpaa_LDADD) $(LIBS)
+ffpboot$(EXEEXT): $(ffpboot_OBJECTS) $(ffpboot_DEPENDENCIES)
+ @rm -f ffpboot$(EXEEXT)
+ $(LINK) $(ffpboot_OBJECTS) $(ffpboot_LDADD) $(LIBS)
+ffpcol$(EXEEXT): $(ffpcol_OBJECTS) $(ffpcol_DEPENDENCIES)
+ @rm -f ffpcol$(EXEEXT)
+ $(LINK) $(ffpcol_OBJECTS) $(ffpcol_LDADD) $(LIBS)
+ffpcomplex$(EXEEXT): $(ffpcomplex_OBJECTS) $(ffpcomplex_DEPENDENCIES)
+ @rm -f ffpcomplex$(EXEEXT)
+ $(LINK) $(ffpcomplex_OBJECTS) $(ffpcomplex_LDADD) $(LIBS)
+ffpfilt$(EXEEXT): $(ffpfilt_OBJECTS) $(ffpfilt_DEPENDENCIES)
+ @rm -f ffpfilt$(EXEEXT)
+ $(LINK) $(ffpfilt_OBJECTS) $(ffpfilt_LDADD) $(LIBS)
+ffpjsd$(EXEEXT): $(ffpjsd_OBJECTS) $(ffpjsd_DEPENDENCIES)
+ @rm -f ffpjsd$(EXEEXT)
+ $(LINK) $(ffpjsd_OBJECTS) $(ffpjsd_LDADD) $(LIBS)
+ffpmerge$(EXEEXT): $(ffpmerge_OBJECTS) $(ffpmerge_DEPENDENCIES)
+ @rm -f ffpmerge$(EXEEXT)
+ $(LINK) $(ffpmerge_OBJECTS) $(ffpmerge_LDADD) $(LIBS)
+ffpre$(EXEEXT): $(ffpre_OBJECTS) $(ffpre_DEPENDENCIES)
+ @rm -f ffpre$(EXEEXT)
+ $(LINK) $(ffpre_OBJECTS) $(ffpre_LDADD) $(LIBS)
+ffprwn$(EXEEXT): $(ffprwn_OBJECTS) $(ffprwn_DEPENDENCIES)
+ @rm -f ffprwn$(EXEEXT)
+ $(LINK) $(ffprwn_OBJECTS) $(ffprwn_LDADD) $(LIBS)
+ffpry$(EXEEXT): $(ffpry_OBJECTS) $(ffpry_DEPENDENCIES)
+ @rm -f ffpry$(EXEEXT)
+ $(LINK) $(ffpry_OBJECTS) $(ffpry_LDADD) $(LIBS)
+ffptree$(EXEEXT): $(ffptree_OBJECTS) $(ffptree_DEPENDENCIES)
+ @rm -f ffptree$(EXEEXT)
+ $(LINK) $(ffptree_OBJECTS) $(ffptree_LDADD) $(LIBS)
+ffptxt$(EXEEXT): $(ffptxt_OBJECTS) $(ffptxt_DEPENDENCIES)
+ @rm -f ffptxt$(EXEEXT)
+ $(LINK) $(ffptxt_OBJECTS) $(ffptxt_LDADD) $(LIBS)
+ffpvocab$(EXEEXT): $(ffpvocab_OBJECTS) $(ffpvocab_DEPENDENCIES)
+ @rm -f ffpvocab$(EXEEXT)
+ $(LINK) $(ffpvocab_OBJECTS) $(ffpvocab_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpaa.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpboot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpcol.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpcomplex.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpfilt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpjsd.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpmerge.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpre.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffprwn.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpry.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffptree.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffptxt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ffpvocab.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hash.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hashroll.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mask.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parse_features.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sighandle.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/utils.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/cdfmacros.h b/src/cdfmacros.h
new file mode 100644
index 0000000..7eb398d
--- /dev/null
+++ b/src/cdfmacros.h
@@ -0,0 +1,28 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#ifndef _CDFMACROS_H_
+#define _CDFMACROS_H_
+
+#define EULER_MASCHERONI 0.5772156649015328606
+#define PI_SQRT_6 1.282555555
+#define SQRT_2 1.41421
+#define evd_cdf(a,b,c) exp(-exp(-((c)-(a))/(b)))
+#define norm_cdf(a) 0.5*(1+erf(a/sqrt(SQRT_2)))
+
+/**< @todo Create a separate constants .h file */
+
+#endif /* _CDFMACROS_H_ */
diff --git a/src/codon.h b/src/codon.h
new file mode 100644
index 0000000..99b6112
--- /dev/null
+++ b/src/codon.h
@@ -0,0 +1,22 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#ifndef _CODON_H_
+#define _CODON_H_
+
+char codon2aa(register const char *str);
+
+#endif /* _CODON_H_ */
diff --git a/src/ffpaa.c b/src/ffpaa.c
new file mode 100644
index 0000000..44a0b05
--- /dev/null
+++ b/src/ffpaa.c
@@ -0,0 +1,349 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <getopt.h>
+#include <math.h>
+#include <ctype.h>
+#include <limits.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include "hashroll.h"
+#include "mask.h"
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "parse_features.h"
+#include "../config.h"
+#define DEFAULT_WORD_LENGTH 4 /**< Default Feature length if not given by opt -l */
+#define CHAR_BUFFER_SIZE 10000 /**< Default buffer size for reading sequence files */
+
+
+/** @Todo implement a variety of character classes
+ SE-B(14) A, C, D, EQ, FY, G, H, IV, KR, LM, N, P, ST, W
+ SE-B(10) AST, C, DN, EQ, FY, G, HW, ILMV, KR, P
+ SE-V(10) AST, C, DEN, FY, G, H, ILMV, KQR, P, W
+ Li-A(10) AC, DE, FWY, G, HN, IV, KQR, LM, P, ST
+ Li-B(10) AST, C, DEQ, FWY, G, HN, IV, KR, LM, P
+ Solis-D(10) AM, C, DNS, EKQR, F, GP, HT, IV, LY, W
+ Solis-G(10) AEFIKLMQRVW, C, D, G, H, N, P, S, T, Y
+ Murphy(10) A, C, DENQ, FWY, G, H, ILMV, KR, P, ST
+ SE-B(8) AST, C, DHN, EKQR, FWY, G, ILMV, P
+ SE-B(6) AST, CP, DEHKNQR, FWY, G, ILMV
+ Dayhoff(6) AGPST, C, DENQ, FWY, HKR, ILMV
+
+ These are from Edgar, R (2004, NAR, 32:380-385
+
+ */
+
+
+char PROG_NAME[FILENAME_MAX];
+
+static void parseFile(HASH *, FILE *);
+static void loopFeatureList(HASH * h, FILE * fp);
+static void loopRaw(HASH * h, FILE * fp);
+
+char *weightVector; /**< A mask to allow mismatches in features */
+int Length = DEFAULT_WORD_LENGTH;
+ /**< Feature length to use if not specified by opt -l */
+int Buffsize = CHAR_BUFFER_SIZE;/**< File input buffer, increase value for larger genomes. opt -b can be used to change this value */
+int maxWordSize = MAX_WORD_SIZE;
+
+
+bool wflag = false; /**<-w Supply a mismatch character mask */
+char *wvalue = NULL; /**<-w ptr to mismatch character mask str */
+bool zflag = false; /**<-z Create random mismatch character mask */
+int zflagN = 0; /**<-z Maximum number of mismatches to allow */
+bool sflag = false; /**<-s Fix random seed */
+int sflagN = 0; /**<-s Random seed value */
+bool qflag = false; /**<-q Force quiet operation */
+bool fflag = false; /**<-f Restrict counting to a list of features*/
+char *fvalue = NULL; /**<-f ptr to name of featmer mask file */
+bool dflag = false; /**<-d disable classing of amino acids */
+bool mflag = false; /**<-m option, FNA file contains multiple sequences */
+
+char usage_str[] = "Usage: %s [OPTION] ... [FILE] ... \n\
+This program generates an FFP vector of amino acid features\n\n\
+Given no options the default behavior of the program is to\n\
+generate a Feature Frequency Profile (FFP) using features of\n\
+length 4.\n\
+\t-l LEN, --length\n\
+\t-f FILE, --feature-list\n\
+\t-w STR, --mask\n\
+\t-z INT, --rand-mask=INT\n\
+\t-s INT, --rand-seed\n\
+\t-q, --quiet\n\
+\t-d, --disable-classes\n\
+\t-m, --multiple\n\
+\t-h, --help\n\
+\t-v, --version\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+int main(int argc, char **argv)
+{
+ int opt;
+ FILE *fp;
+ HASH h;
+
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"length", required_argument, 0, 'l'},
+ {"disable-classes", no_argument, 0, 'd'},
+ {"feature-list", required_argument, 0, 'f'},
+ {"mask", required_argument, 0, 'w'},
+ {"rand-mask", required_argument, 0, 'z'},
+ {"rand-seed", required_argument, 0, 's'},
+ {"quiet", no_argument, 0, 'q'},
+ {"help", no_argument, 0, 'h'},
+ {"multiple", no_argument, 0, 'm'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ while ((opt = getopt_long(argc, argv, "l:dw:z:s:qf:h?mv",
+ long_options, &option_index)) != -1)
+
+ switch (opt) {
+ case 'l':
+ Length = atoi(optarg);
+ break;
+ case 'w':
+ wflag = !wflag;
+ wvalue = optarg;
+ break;
+ case 'z':
+ zflag = !zflag;
+ zflagN = atoi(optarg);
+ break;
+ case 's':
+ sflag = !sflag;
+ sflagN = atoi(optarg);
+ break;
+ case 'q':
+ qflag = !qflag;
+ break;
+ case 'd':
+ dflag = !dflag;
+ break;
+ case 'f':
+ fflag = !fflag;
+ fvalue = optarg;
+ break;
+ case 'm':
+ mflag = !mflag;
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ exit(EXIT_FAILURE);
+ break;
+ }
+
+
+ if ( getenv("MAX_WORD_SIZE") ) {
+ maxWordSize=atoi(getenv("MAX_WORD_SIZE"));
+ }
+
+ if (Length > maxWordSize)
+ fatal_msg("%d: Max Word size is : %d",Length,maxWordSize);
+
+ if (sflag)
+ srand((unsigned) sflagN);
+ else
+ srand((unsigned) time(NULL)*getpid());
+
+
+ if (wflag) {
+ weightVector = (char *) malloc(sizeof(char) * (Length + 1));
+ strcpy(weightVector, wvalue);
+ if (!qflag)
+ warn_msg("USING FEATURE MASK: %s\n", weightVector);
+
+ }
+
+
+ if (zflag) {
+ while (zflagN > Length - 1)
+ zflagN--;
+ weightVector = (char *) malloc(sizeof(char) * (Length + 1));
+ randweight(weightVector, Length, zflagN);
+ if (!qflag)
+ warn_msg("USING FEATURE MASK: %s\n", weightVector);
+ }
+ // Initialize the rolling hash
+ // reverse is not applicable, therefore 0
+ init(&h, (zflag || wflag), amino, !dflag, 0, Length);
+
+
+ // If provided a feature list read it and store in hash
+
+ if (fflag)
+ parseFeatureList(&h,fvalue,Length,amino);
+
+// Must now process file arguments
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s\n", *argv, strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ parseFile(&h, fp);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+
+ //freeHash(&h);
+
+ return EXIT_SUCCESS;
+}
+
+
+
+
+/**
+ *
+ * Parses FASTA format FNA file
+ *
+ * This function can read from stdin or from files.
+ * The speed of the function is affected by the size
+ * of the input buffer. Multiple FFPs are printed
+ * out with the -m option for each >header
+ * in the file. Another flag which affects this function
+ * is -f
+ *
+ * @param h The hash table to use.
+ * @param fp The FNA file to parse
+ * @return none
+ *
+ */
+
+
+static void parseFile(HASH * h, FILE * fp)
+{
+
+// to eliminate a test w/n a tight loop
+// First test here.
+ if (fflag)
+ loopFeatureList(h, fp);
+ else
+ loopRaw(h, fp);
+
+}
+
+
+// For finding only features w/n a feature list
+static void loopFeatureList(HASH * h, FILE * fp)
+{
+ struct stat fattr;
+ static size_t optimal_size;
+ ssize_t nr;
+ char *buf;
+ bool firstRecord=true;
+
+ //Determine optimal buffer size for file
+ if (fstat(fileno(fp), &fattr))
+ fatal_msg("fd %s: File stat error.\n",fileno(fp));
+
+ //Find optimal size for Disk IO
+ optimal_size = (fattr.st_blksize >= BUFSIZ) ? fattr.st_blksize : BUFSIZ;
+
+ if ((buf = (char *) malloc(optimal_size))==NULL)
+ fatal_at_line("%s\n",strerror(errno));
+
+ // replace w/ function pointers
+ while ((nr = fread(buf, sizeof(char), optimal_size, fp)) != -1 && nr != 0) {
+
+ if (zflag || wflag)
+ chkpushaaw(h, buf, nr,firstRecord);
+ else
+ chkpushaa(h, buf, nr,firstRecord);
+
+ firstRecord=false;
+ }
+
+ printFeatures(h);
+ free(buf);
+ freeHash(h);
+}
+
+
+
+// For finding all features
+
+static void loopRaw(HASH * h, FILE * fp)
+{
+ struct stat fattr;
+ static size_t optimal_size;
+ ssize_t nr;
+ char *buf;
+ bool firstRecord=true;
+
+
+ //Determine optimal buffer size for file
+ if (fstat(fileno(fp), &fattr))
+ fatal_msg("fd %s: File stat error.\n",fileno(fp));
+
+ //Find optimal size for Disk IO
+ optimal_size = (fattr.st_blksize >= BUFSIZ) ? fattr.st_blksize : BUFSIZ;
+
+ if ((buf = (char *) malloc(optimal_size))==NULL)
+ fatal_at_line("%s\n",strerror(errno));
+
+ // replace w/ function pointers
+ while ((nr = fread(buf, sizeof(char), optimal_size, fp)) != -1 && nr != 0) {
+
+ if (zflag || wflag)
+ pushaaw(h, buf, nr,firstRecord);
+ else
+ pushaa(h, buf, nr,firstRecord);
+
+ firstRecord=false;
+ }
+
+ printFeatures(h);
+ freeHash(h);
+ free(buf);
+}
+
diff --git a/src/ffpboot.c b/src/ffpboot.c
new file mode 100644
index 0000000..ceec405
--- /dev/null
+++ b/src/ffpboot.c
@@ -0,0 +1,288 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <math.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+#include <errno.h>
+#include <limits.h>
+#include <unistd.h>
+#include <string.h>
+#include "vstring.h"
+#include "utils.h"
+#include "sighandle.h"
+#include "../config.h"
+
+char PROG_NAME[] = "ffpboot";
+#define COL_SIZE 1000 /**< Initial guess for columns in FFP */
+#define DEFAULT_JACK 0.36787944117144232159 /**< Default Jackknife probability of deletion: 1/exp(1) */
+#define INIT_ROWSIZE 10
+
+void bootstrap(FILE * fp);
+void jacknife(FILE * fp, float);
+
+char usage_str[] = "Usage: %s [OPTIONS] ... [FILE] ...\n\
+This program performs bootstrap permutations of the FFP vector\n\n\
+Given no options, the defeault behavior of the program is to\n\
+calculate a bootstrap permutation.\n\
+\t-j, --jackknife\n\
+\t-p PROB, --delete-prob=PROB\n\
+\t-s INT, --rand-seed=INT\n\
+\t-v, --version\n\
+\t-h, --help\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+int main(int argc, char **argv)
+{
+ FILE *fp;
+ int opt;
+ char jflag = 0;
+ char sflag = 0;
+ unsigned svalue = 0;
+ float pvalue = DEFAULT_JACK;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"delete-prob", required_argument, 0, 'p'},
+ {"jackknife", no_argument, 0, 'j'},
+ {"rand-seed", required_argument, 0, 's'},
+ {"version", no_argument, 0, 's'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ while ((opt = getopt_long(argc, argv, "jp:s:vh",
+ long_options, &option_index)) != -1)
+
+ switch (opt) {
+ case 'p':
+ pvalue = atof(optarg);
+ break;
+ case 'j':
+ jflag = 1;
+ break;
+ case 's':
+ sflag = 1;
+ svalue = atoi(optarg);
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ exit(EXIT_FAILURE);
+ break;
+ }
+
+ if (sflag)
+ srand((unsigned) svalue);
+ else
+ srand((unsigned) time(NULL) * getpid());
+
+
+ if (pvalue > 1 || pvalue < 0) {
+ fatal_msg("Jacknife deletion probability must be betwen 0 and 1\n");
+ }
+
+
+
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s\n", *argv, strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ if (!isRegularFile(fp))
+ fp = convertPipeToFile(fp);
+
+ if (isKeyBased(fp))
+ fatal_msg("Input is not columnar format\n");
+
+ if (jflag)
+ jacknife(fp, pvalue);
+ else
+ bootstrap(fp);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+
+ return EXIT_SUCCESS;
+}
+
+
+
+/**
+ *
+ * Performs a bootsrap permutation of a columnar FFP.
+ *
+ * Column numbers are sampled with replacement up to the
+ * number of columns in the original matrix and
+ * the chosen columns are printed to stdout.
+ *
+ * @param fp A file pointer to an FFP.
+ * @return void
+ *
+ */
+
+
+
+void bootstrap(FILE * fp)
+{
+ long unsigned i, j;
+ unsigned *randCols;
+ int rows;
+ unsigned *vals;
+ unsigned cols;
+ unsigned size = COL_SIZE; /* Inital guess */
+ int rowsize = INIT_ROWSIZE; /* initial guess */
+ char s[2];
+ int d;
+
+
+ vals = (unsigned *) malloc(sizeof(unsigned) * size);
+
+ i = 0;
+ rows = 0;
+ while (!feof(fp)) {
+ if (i < size) {
+ d = fscanf(fp, "%u%[\n\r]", &vals[i++], s);
+ if (d == 2) {
+ rows++;
+ if (rows > rowsize) {
+ rowsize += INIT_ROWSIZE;
+ }
+ }
+ } else {
+ size += COL_SIZE;
+ vals = (unsigned *) realloc(vals, sizeof(unsigned) * size);
+ }
+ }
+
+ cols = (unsigned) i / rows;
+
+ //Now we know the number of columns
+
+ randCols = (unsigned *) malloc(sizeof(unsigned) * cols);
+
+ for (i = 0; i < cols; i++)
+ randCols[i] = rand() % cols;
+
+ for (i = 0; i < rows; i++) {
+ for (j = 0; j < cols-1; j++)
+ printf("%u\t", vals[i * cols + randCols[j]]);
+ printf("%u\n", vals[i * cols + randCols[j]]);
+ }
+
+ free(vals);
+}
+
+
+
+/**
+ *
+ * Performs a jackknife resampling of a columnar FFP.
+ *
+ * Column numbers are sampled without replacement using
+ * a deletion jackknife. Each column has a fixed probability
+ * of being deleted equal to the second argument del.
+ * The remainin columns are printed to stdout.
+ *
+ * @param fp A file pointer to an FFP.
+ * @param del The deletion probability.
+ * @return void
+ *
+ */
+
+void jacknife(FILE * fp, float del)
+{
+ long unsigned i, j;
+ char *randCols;
+ int rows;
+ unsigned *vals;
+ unsigned cols;
+ unsigned size = COL_SIZE; /* Inital guess of column number */
+ int rowsize = INIT_ROWSIZE;
+ char s[2];
+ int d;
+
+
+ vals = (unsigned *) malloc(sizeof(unsigned) * size);
+
+ i = 0;
+ rows = 0;
+ while (!feof(fp)) {
+ if (i < size) {
+ d = fscanf(fp, "%u%[\n\r]", &vals[i++], s);
+ if (d == 2) {
+
+ rows++;
+ if (rows > rowsize) {
+ rowsize += INIT_ROWSIZE;
+ }
+ }
+ } else {
+ size += COL_SIZE;
+ vals = (unsigned *) realloc(vals, sizeof(unsigned) * size);
+ }
+ }
+
+ cols = (unsigned) i / rows;
+
+ //Now we know the number of columns
+
+ randCols = (char *) malloc(sizeof(char) * cols);
+
+ for (i = 0; i < cols; i++) {
+ randCols[i] = ((float) rand() / INT_MAX > del);
+ }
+
+ for (i = 0; i < rows; i++) {
+ for (j = 0; j < cols; j++)
+ if (randCols[j])
+ printf("%u\t", vals[i * cols + j]);
+ printf("%u\n", vals[i * cols + j]);
+ }
+
+ free(vals);
+}
diff --git a/src/ffpcol.c b/src/ffpcol.c
new file mode 100644
index 0000000..50c1e96
--- /dev/null
+++ b/src/ffpcol.c
@@ -0,0 +1,285 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include "hash.h"
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "../config.h"
+
+#define MAX_WORD_LENGTH 40 /**< Maximum feature length */
+
+char PROG_NAME[FILENAME_MAX];
+
+void hashCol(FILE * fp);
+int isKeyBased(FILE * fp);
+int getKeyLength(FILE * fp);
+
+char *weightVector;
+int Length = MAX_WORD_LENGTH;
+ /**< Feature length */
+
+
+
+char usage_str[] = "Usage: %s [OPTIONS]... [FILE]...\n\
+This program creates columnar FFPs from key val output of ffpry,\n\
+ffpaa, or ffptxt.\n\n\
+Given no options, the defeault behavior of the program is to\n\
+generate columnar FFPs for Nucleic acids.\n\
+\t-a, --amino\tInput is Amino acid\n\
+\t-t, --text\tInput is text\n\
+\t-d, --disable\tDisable classing of AAs and Nuc.\n\
+\t-V, --verbose\tBe more verbose.\n\
+\t-h, --help\tThis text.\n\
+\t-v, --version\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+bool flagV = false;
+
+
+int main(int argc, char **argv)
+{
+ FILE *fp = NULL;
+ int opt;
+ bool flagA = false;
+ bool flagT = false;
+ bool flagD = false;
+
+ int mode = nucleotide;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"amino", no_argument, 0, 'a'},
+ {"text", no_argument, 0, 't'},
+ {"disable", no_argument, 0, 'd'},
+ {"version", no_argument, 0, 'v'},
+ {"verbose", no_argument, 0, 'V'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy( PROG_NAME, basename(argv[0]) );
+
+ while ((opt = getopt_long(argc, argv, "hatdvV",
+ long_options, &option_index)) != -1)
+ switch (opt) {
+ case 'a':
+ flagA = !flagA;
+ break;
+ case 't':
+ flagT = !flagT;
+ break;
+ case 'd':
+ flagD = !flagD;
+ break;
+ case 'V':
+ flagV = !flagV;
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ break;
+ }
+
+
+ if (flagA && flagT)
+ fatal_msg("Option -a or -t not both\n");
+
+
+ if (flagA)
+ mode = amino;
+ else if (flagT)
+ mode = text;
+ else {
+ }
+
+ initHash(0, mode, !flagD);
+
+
+ if ((argc - optind) > 1)
+ fatal_msg("Specify only one file argument.\n");
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL){
+ fatal_msg("%s: %s.\n", *argv,strerror(errno));
+
+ }
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO)) {
+ printErrorUsageStr();
+ }
+
+ if (!isRegularFile(fp))
+ fp = convertPipeToFile(fp);
+
+ if (!isKeyBased(fp))
+ fatal_msg("%s: Not a key valued FFP.\n", *argv);
+
+
+
+
+ Length = getKeyLength(fp);
+ hashCol(fp);
+
+ fclose(fp);
+
+ } while (*argv);
+
+ return EXIT_SUCCESS;
+}
+
+
+/**
+ * Convert a (key,value) FFP to a columnar FFP
+ *
+ * FFP in fp must be columnar FFP.
+ *
+ * @param fp A file pointer to a (key,value) FFP
+ * @return none
+ */
+
+
+
+void hashCol(FILE * fp)
+{
+ //for accepting input via pipe
+ // Used in all cases
+ unsigned val;
+ char * s;
+ char **keys;
+ unsigned i;
+ char c[3];
+ int items;
+ unsigned lineno=1;
+ off_t line_offset=0;
+
+
+
+ s=(char *) chkmalloc(sizeof(char),(Length+1));
+
+//@TODO move this comment to description of convertFilePtr
+
+// cut here
+// If file is stdin we need to create a tmp file
+// This is equivalent to to:
+// stdin | cat > /tmp/tmp.1a321asf
+// However we don't want a file passed to the
+// program via ffpcol < infile, to undergo this
+// process, since a file opened in this manner
+// is seekable and doesn't need to be copied.
+// File opened this way ffpcol <(ffpry *.fna)
+// i.e. via process substitution is not seekable
+
+ // Find all keys in the file.
+
+ errno=0;
+
+
+
+ //@TODO see if this can be sped up by using %*u to skip reading and conversion of val.
+ while ( (items=fscanf(fp, "%s %u%[\r\n]", s, &val,c)) != EOF ) {
+ //if (errno)
+ // fatal_msg("Parse error at line %u char %ld: %s. %d\n",
+ // lineno,ftell(fp)-line_offset, strerror(errno),errno );
+
+ switch (items) {
+ case 3:
+ if (flagV)
+ fprintf(stderr,"Processed Line: %d\n",lineno);
+ line_offset=ftell(fp);
+ lineno++;
+ case 2:
+ hashInc(s); // increments hash by value;
+ break;
+ default:
+ fatal_msg("Parse error at line %u char %ld.\n",
+ lineno,ftell(fp)-line_offset);
+ break;
+ }
+ }
+
+ if (ferror(fp))
+ fatal_msg("Read Error: %s",strerror(errno));
+
+ hashKeys(&keys);
+
+ rewind(fp);
+
+ fflush(fp); // Flush last character read
+
+
+ //zero out the hash
+
+ for (i = 0; i < numKeys(); i++) {
+ hashAssign(keys[i], 0);
+ }
+
+
+ while ((items = fscanf(fp, "%s %u%[\r\n]", s, &val, c)) != EOF) {
+
+ switch (items) {
+ case 2:
+ hashAssign(s, val);
+ break;
+ case 3:
+ hashAssign(s, val);
+ for (i = 0; i < numKeys()-1; i++) {
+ printf("%u\t", hashval(keys[i]));
+ hashAssign(keys[i], 0);
+ }
+ printf("%u\n",hashval(keys[i]));
+ hashAssign(keys[i], 0);
+ break;
+ }
+ }
+
+ free(s);
+ // No need to free keys, since program terminates
+}
+
+
diff --git a/src/ffpcomplex.c b/src/ffpcomplex.c
new file mode 100644
index 0000000..003c2f2
--- /dev/null
+++ b/src/ffpcomplex.c
@@ -0,0 +1,368 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <float.h>
+#include <math.h>
+#include <string.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include "hash.h"
+#include "utils.h"
+#include "vstring.h"
+#include "cdfmacros.h"
+#include "sighandle.h"
+#include "../config.h"
+
+char PROG_NAME[FILENAME_MAX];
+#define MAX_WORD_LENGTH 40 /**< Maximum feature length */
+
+void hashCol(FILE * fp);
+int isKeyBased(FILE * fp);
+int getKeyLength(FILE * fp);
+float complexity(char *key);
+
+char usage_str[] = "Usage: %s [OPTIONS]... [FILE]...\n\
+This program filters words by complexity\n\n\
+Given no options, the default behavior of the program is to\n\
+assume Nucleic acids FFP input\n\
+\t-a, --amino\tInput is amino acids\n\
+\t-t, --text\tInput is text\n\
+\t-d, --disable\tDisable classing of AAs and Nuc.\n\
+\t-n, --normal\tAssume normal CDF distribution of complexity.\n\
+\t-l, --lower\tLower limit for filtration, with -n this is a\n\
+\t\t\tprobability.\n\
+\t-u, --upper\tUpper limit for filtration, with -n this is a\n\
+\t\t\tprobability.\n\
+\t-s, --stats\tPrint complexity stats to stderr\n\
+\t-h, --help\tThis text.\n\
+\t-v, --version\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+char *weightVector;
+int Length = MAX_WORD_LENGTH;
+ /**< Feature length */
+
+bool flagK = false;
+bool flagA = false;
+bool flagT = false;
+bool flagD = false;
+bool flagF = true;
+bool flagU = false;
+bool flagL = false;
+bool flagN = false;
+bool flagS = false;
+
+float lower = -FLT_MAX;
+float upper = FLT_MAX;
+
+int main(int argc, char **argv)
+{
+ FILE *fp = NULL;
+ struct stat input;
+ int opt;
+
+ int mode = nucleotide;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"amino", no_argument, 0, 'a'},
+ {"text", no_argument, 0, 't'},
+ {"disable", no_argument, 0, 'd'},
+ {"lower", required_argument, 0, 'l'},
+ {"upper", required_argument, 0, 'u'},
+ {"version", no_argument, 0, 'v'},
+ {"normal", no_argument, 0, 'n'},
+ {"stats", no_argument, 0, 's'},
+ {0, 0, 0, 0}
+ };
+
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "hatdvu:l:ns",
+ long_options, &option_index)) != -1)
+ switch (opt) {
+ case 'a':
+ flagA = !flagA;
+ break;
+ case 't':
+ flagT = !flagT;
+ break;
+ case 'd':
+ flagD = !flagD;
+ break;
+ case 'n':
+ flagN = !flagN;
+ flagF = !flagF;
+ break;
+ case 'l':
+ flagL = !flagL;
+ lower = atof(optarg);
+ break;
+ case 'u':
+ flagU = !flagU;
+ upper = atof(optarg);
+ break;
+ case 's':
+ flagS = !flagS;
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ break;
+ }
+
+
+ if (flagA && flagT)
+ fatal_msg("Option -a or -t not both\n");
+
+
+ if (flagA)
+ mode = amino;
+ else if (flagT)
+ mode = text;
+
+ initHash(0, mode, !flagD);
+
+ if ((argc - optind) > 1)
+ fatal_msg("Specify only one File argument\n");
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s.\n", *argv,strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ // process if its a pipe
+
+ if (!isRegularFile(fp)) {
+ fp = convertPipeToFile(fp);
+ }
+ // gather complexity stats.
+
+ if (!isKeyBased(fp))
+ fatal_msg("%s: Not a key valued FFP.\n", *argv);
+
+ Length = getKeyLength(fp);
+ hashCol(fp);
+
+ fclose(fp);
+
+ } while (*argv);
+
+ return EXIT_SUCCESS;
+}
+
+/**
+ * Calculate the complexity of a feature, with length n.
+ * The frequencies are calcualted for all k-mers from
+ * length 1 to n-1 which are sub-words of the feature.
+ * From this the log2 based Shannon Entropy is calculated.
+ * Lower values indicate lower complexity.
+ *
+ * @param key an amino acid, nucleotide or text feature
+ * @return float Value indicates the Shannon entropy
+ * @todo It would simplify the use of complexity for filtration if this function had its own
+ * Internal hash variable
+ */
+
+
+float complexity(char *key)
+{
+ int L, i, N;
+ char s[Length];
+ float entropy = 0;
+ char **keys;
+ N = 0;
+ L = 1;
+
+ while (L < Length) {
+ for (i = 0; i < Length - L + 1; i++) {
+ strncpy(s, &key[i], L);
+ s[L] = '\0';
+ hashInc(s);
+ }
+ L++;
+ N += L;
+ }
+
+ hashKeys(&keys);
+
+ for (i = 0; i < numKeys(); i++)
+ entropy -=
+ (float) hashval(keys[i]) / N * log2((float) hashval(keys[i]) / N);
+
+ freeHash();
+
+ return entropy;
+}
+
+
+
+
+
+/**
+ * Convert a (key,value) FFP to a columnar FFP
+ *
+ * FFP in fp must be columnar FFP.
+ *
+ * @param fp A file pointer to a (key,value) FFP
+ * @return none
+ */
+
+
+
+void hashCol(FILE * fp)
+{
+ unsigned val;
+ char s[Length];
+ char c[2];
+ bool deleteKey;
+ float cval;
+ float cvalMin=FLT_MAX;
+ float cvalMax=0;
+ double x1 = 0;
+ double x2 = 0;
+ double sigma;
+ double zscore;
+ unsigned ctr = 0;
+ unsigned items;
+ unsigned lineno=0;
+ unsigned line_offset=0;
+
+ errno=0;
+ while ( (items=fscanf(fp, "%s %u%[\r\n]", s, &val,c)) != EOF ) {
+ //fprintf(stderr,"%s %d\n",strerror(errno),items);
+ if (errno)
+ fatal_msg("Parse error at line %u char %ld: %s.\n",
+ lineno,ftell(fp)-line_offset, strerror(errno) );
+
+ switch (items) {
+ case 3:
+ line_offset=ftell(fp);
+ lineno++;
+ case 2:
+ cval = complexity(s);
+ x1 += cval;
+ x2 += cval * cval;
+ ctr++;
+ break;
+ default:
+ fatal_msg("Parse error at line %u char %ld.\n",
+ lineno,ftell(fp)-line_offset);
+ break;
+ }
+
+
+ if (flagS) {
+ if (cval < cvalMin)
+ cvalMin=cval;
+ if (cval > cvalMax)
+ cvalMax=cval;
+ }
+
+ }
+
+
+ x1 /= ctr;
+ x2 /= ctr;
+
+ sigma = sqrt(x2 - x1 * x1);
+
+ if (flagS){
+ fprintf(stderr, "Avg\tstddev\tmin\tmax\n");
+ fprintf(stderr, "%lf\t%lf\t%f\t%f\n", x1, sigma,cvalMin,cvalMax);
+ }
+
+ rewind(fp);
+
+ // perform tests here to decide whether to keep ffp.
+
+ errno=0;
+ while ( (items=fscanf(fp, "%s %u%[\r\n]", s, &val,c)) != EOF ) {
+ //fprintf(stderr,"%s %d\n",strerror(errno),items);
+ if (errno)
+ fatal_msg("Parse error at line %u char %ld: %s.\n",
+ lineno,ftell(fp)-line_offset, strerror(errno) );
+
+ cval = complexity(s);
+ zscore = ((float) cval - x1) / sigma;
+
+ deleteKey = false;
+
+ if (flagU) {
+ if (flagF && cval > upper)
+ deleteKey = true;
+ if (flagN && norm_cdf(zscore) > upper)
+ deleteKey = true;
+ }
+
+ if (flagL) {
+ if (flagF && cval < lower)
+ deleteKey = true;
+ if (flagN && norm_cdf(zscore) < lower)
+ deleteKey = true;
+ }
+
+ if (!deleteKey)
+ printf("%s %u", s, val);
+
+
+ switch (items) {
+ case 3:
+ printf("\n");
+ line_offset=ftell(fp);
+ lineno++;
+ break;
+ case 2:
+ printf("\t");
+ break;
+ default:
+ fatal_msg("Parse error at line %u char %ld.\n",
+ lineno,ftell(fp)-line_offset);
+ break;
+ }
+ }
+
+}
diff --git a/src/ffpfilt.c b/src/ffpfilt.c
new file mode 100644
index 0000000..7bd73cd
--- /dev/null
+++ b/src/ffpfilt.c
@@ -0,0 +1,347 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <math.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <limits.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include "hash.h"
+#include "utils.h"
+#include "vstring.h"
+#include "string.h"
+#include "cdfmacros.h"
+#include "sighandle.h"
+#include "../config.h"
+
+char PROG_NAME[FILENAME_MAX];
+#define MAX_WORD_LENGTH 40 /**< Maximum feature length */
+#define DEFAULT_PRECISION 2
+
+void hashCol(FILE * fp);
+int isKeyBased(FILE * fp);
+int getKeyLength(FILE * fp);
+
+
+char usage_str[] = "Usage: %s [OPTIONS]... [FILE]...\n\
+This program filters FFP profiles based on numeric properties\n\n\
+\t-s, --stats\tPrint stats to stderr\n\
+\t-z, --zeros\tInclude zeros in statistics calculations\n\
+\t-u FLOAT, --upper=FLOAT\tupper threshold limit\n\
+\t-l FLOAT, --lower=FLOAT\tlower threshold limit\n\
+\t-f, --freq\tExclude raw frequencies outside of -u and -l limits\n\
+\t-n, --norm\tUse Normal CDF to exclude features out -u and -l probabilities\n\
+\t-e, --evd\tUse Extreme value CDF to exclude features out -u and -l probabilities\n\
+\t-d, --disable\tDisable classing of AAs and NAs\n\
+\t-a, --amino\tInput is an amino acid sequence\n\
+\t-t, --text\tInput is a text file\n\
+\t-k, --key\tForce key output.\n\
+\t-v, --version\tPrint version information\n\
+\t-h, --help\tThis text.\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+char *weightVector;
+
+int Length = MAX_WORD_LENGTH;
+ /**< Feature length */
+/**< It might be clearer if a distribution mode enum were used */
+
+bool sflag = false;
+bool zflag = false;
+bool fflag = false;
+bool nflag = false;
+bool dflag = false;
+bool aflag = false;
+bool cflag = false;
+bool tflag = false;
+bool eflag = false;
+bool lflag = false;
+bool uflag = false;
+bool kflag = false;
+
+int pvalue = DEFAULT_PRECISION;
+float upper = INT_MAX;
+float lower = INT_MIN;
+int main(int argc, char **argv)
+{
+ FILE *fp = NULL;
+ int opt;
+ int mode = nucleotide;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"print-stats", no_argument, 0, 's'},
+ {"version", no_argument, 0, 'v'},
+ {"precision", required_argument, 0, 'p'},
+ {"upper", required_argument, 0, 'u'},
+ {"lower", required_argument, 0, 'l'},
+ {"freq", no_argument, 0, 'f'},
+ {"normal", no_argument, 0, 'n'},
+ {"evd", no_argument, 0, 'e'},
+ {"zeros", no_argument, 0, 'z'},
+ {"disable", no_argument, 0, 'd'},
+ {"keys", no_argument, 0, 'k'},
+ {"amino", no_argument, 0, 'a'},
+ {"text", no_argument, 0, 't'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "svfnu:dhl:etak",
+ long_options, &option_index)) != -1)
+ switch (opt) {
+ case 's': // print stats to stderr
+ sflag = !sflag;
+ break;
+ case 'z': // include zeros in stat calc
+ zflag = !zflag;
+ break;
+ case 'l':
+ lflag = !lflag;
+ lower = atof(optarg);
+ break;
+ case 'u':
+ uflag = !uflag;
+ upper = atof(optarg);
+ break;
+ case 'e': // evd filtering two args lower upper
+ eflag = !eflag;
+ break;
+ case 'n': // norm filtering two args lower upper
+ nflag = !nflag;
+ break;
+ case 'f': // freq filtering two args lower upper
+ fflag = !fflag;
+ break;
+ case 't':
+ tflag = !tflag;
+ case 'a':
+ aflag = !aflag;
+ break;
+ case 'd':
+ dflag = !dflag;
+ break;
+ case 'k':
+ kflag = !kflag;
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ break;
+ }
+
+ if ((argc - optind) > 1)
+ fatal_msg("Specify only one File argument\n");
+
+ if (eflag + nflag + fflag > 1)
+ fatal_msg("Specify -f, -n or -e, but not more than 1\n");
+
+
+ if (aflag)
+ mode = amino;
+
+ if (tflag)
+ mode = text;
+
+
+ initHash(0, mode, !dflag);
+ struct stat input;
+
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s.\n", *argv,strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ if (!isRegularFile(fp))
+ fp = convertPipeToFile(fp);
+
+ if (!isKeyBased(fp))
+ fatal_msg("%s: Not a key valued FFP.", *argv);
+
+ Length = getKeyLength(fp);
+ hashCol(fp);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+
+
+ return EXIT_SUCCESS;
+}
+
+
+/**
+ * Convert a (key,value) FFP to a columnar FFP
+ *
+ * FFP in fp must be columnar FFP.
+ *
+ * @param fp A file pointer to a (key,value) FFP
+ * @return none
+ */
+
+
+
+void hashCol(FILE * fp)
+{
+ unsigned val;
+ char s[Length];
+ char **keys;
+ unsigned i;
+ char c[2];
+ int d;
+ double x1 = 0;
+ double x2 = 0;
+ double sigma;
+ long unsigned int ctr = 0;
+ float alpha, beta;
+ float zscore;
+ int num;
+ int row = 0;
+ bool deleteKey;
+
+ // Find all keys in the file.
+
+ while (!feof(fp)) {
+ d = fscanf(fp, "%s %u%*[\t]%[\n]", s, &val, c);
+ s[Length] = '\0';
+ //calc stats here.
+ x1 += val;
+ x2 += val * val;
+ hashMax(s, val); // Add to hash if greater than existing val
+ ctr++;
+ if (d == 3) {
+ row++;
+ }
+ }
+
+ if (zflag)
+ ctr = pow(2, Length) * row; // if RY coded
+
+ x1 /= ctr;
+ x2 /= ctr;
+
+ sigma = sqrt(x2 - x1 * x1);
+
+ beta = sigma / PI_SQRT_6;
+ alpha = x1 - beta * EULER_MASCHERONI;
+
+
+ if (sflag)
+ fprintf(stderr, "%.*e\t%.*e%.*e%.*e\n", pvalue, x1, pvalue, sigma,
+ pvalue, alpha, pvalue, beta);
+
+
+ hashKeys(&keys);
+
+ num = numKeys();
+ // delete any keys outside the range
+ for (i = 0; i < num; i++) {
+ val = hashval(keys[i]);
+ deleteKey = false;
+ zscore = ((float) val - x1) / sigma;
+
+ if (uflag) {
+ if (fflag && val > upper)
+ deleteKey = true;
+ if (nflag && norm_cdf(zscore) > upper)
+ deleteKey = true;
+ if (eflag && evd_cdf(alpha, beta, val) > upper)
+ deleteKey = true;
+ }
+ if (lflag) {
+ if (fflag && val < lower)
+ deleteKey = true;
+ if (nflag && norm_cdf(zscore) < lower)
+ deleteKey = true;
+ if (eflag && evd_cdf(alpha, beta, val) < lower)
+ deleteKey = true;
+ }
+
+ if (!deleteKey)
+ hashAssign(keys[i], 1);
+ else
+ hashDel(keys[i]);
+
+ }
+
+ // grab updated set of keys
+ hashKeys(&keys);
+ rewind(fp);
+ d = 0;
+ while (d != EOF) {
+ while ((d = fscanf(fp, "%s %u%[\r\n]", s, &val, c)) != EOF) {
+ s[Length] = '\0';
+ if (hashval(s)) {
+ hashAssign(s, val);
+ }
+
+ if (d == 3)
+ break;
+ }
+ if (d == 3) {
+ if (kflag) {
+ for (i = 0; i < numKeys()-1; i++) {
+ printf("%s\t%u\t",keys[i], hashval(keys[i]));
+ hashAssign(keys[i], 1);
+ }
+ printf("%s\t%u\n",keys[i], hashval(keys[i]));
+ hashAssign(keys[i], 1);
+
+ } else {
+ for (i = 0; i < numKeys()-1; i++) {
+ printf("%u\t", hashval(keys[i]));
+ hashAssign(keys[i], 1);
+ }
+ printf("%u\n", hashval(keys[i]));
+ hashAssign(keys[i], 1);
+ }
+ }
+ }
+}
+
+
+// Add maximum word length given base function
diff --git a/src/ffpjsd.c b/src/ffpjsd.c
new file mode 100644
index 0000000..5e9410d
--- /dev/null
+++ b/src/ffpjsd.c
@@ -0,0 +1,1518 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <math.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "../config.h"
+
+
+char PROG_NAME[FILENAME_MAX];/**< Program name */
+#define TAXANAMELEN 10 /**< Maximum length string that can be used in a phylip format taxa name*/
+#define DEFAULT_PRECISION 2 /**< Default precision for floating point output */
+#define DEFAULT_NORM 2 /**< Default Norm for the Euclidean Distance Function */
+#define STR_BUFF 255
+
+int jsd(FILE * fp, double **D);
+int jsdr(FILE * fp, double **D);
+int euclidean_dist(FILE * fp, double **D);
+int cosine_dist(FILE * fp, double **D);
+int manhattan_dist(FILE * fp, double **D);
+int chebyshev_dist(FILE * fp, double **D);
+int jaccard_dist(FILE * fp, double **D);
+int tanimoto_dist(FILE * fp, double **D);
+int dice_dist(FILE * fp, double **D);
+int antidice_dist(FILE * fp, double **D);
+int hamming_dist(FILE * fp, double **D);
+int evolution_dist(FILE * fp, double **D);
+int yule_dist(FILE * fp, double **D);
+int hamann_dist(FILE * fp, double **D);
+int russel_dist(FILE * fp, double **D);
+int sneath_dist(FILE * fp, double **D);
+int matching_dist(FILE * fp, double **D);
+int euclidean2_dist(FILE * fp, double **D);
+int ochiai_dist(FILE * fp, double **D);
+int canberra_dist(FILE * fp, double **D);
+int anderberg_dist(FILE * fp, double **D);
+int phi_dist(FILE * fp, double **D);
+int gower_dist(FILE * fp, double **D);
+int kulczynski_dist(FILE * fp, double **D);
+float pearsons(double *x, double *y, int length);
+int pearson_matrix(FILE * fp, double **D);
+void printMatrix(double *D, int n);
+void printInfile(double *D, int n);
+void printLine(double *D, int n);
+
+char usage_str[] = "Usage: %s [OPTION] vector ... \n\
+Calculates a distance/divergence matrix from a columnar FFP.\n\n\
+Given no options, the defeault behavior of the program is to\n\
+generate a symmetric distance matrix. The default distance used\n\
+is the Jensen Shannon Divergence (JSD)\n\
+\t-p FILE, --phylip=FILE\tPrint phylip output\n\
+\t-d INT, --precision=INT\tSpecify decimal precision of matrix\n\
+\t-r INT, --row=INT\tCalculate the INTth row of a JSD matrix\n\
+\t-e, --euclid\t\tEuclidean Distance\n\
+\t-E, --euclid2\t\tSquared Euclidean distance\n\
+\t-n, --normval\t\tNorm val for -e, Default is 2\n\
+\t-c, --cosine\t\tCosine distance [-s]\n\
+\t-m, --manhattan\t\tManhattan distance\n\
+\t-b, --canberra\t\tCanberra distance\n\
+\t-M, --matching\t\tMatching distance [-s]\n\
+\t-R, --pearson\t\tPearson Correlation distance [-s]\n\
+\t-C, --chebyshev\t\tChebyshev distnace\n\
+\t-j, --jaccard\t\tJaccard distance [-s]\n\
+\t-t, --tanimoto\t\tRogers-Tanimoto distance [-s]\n\
+\t-D, --dice\t\tDice distance [-s]\n\
+\t-N, --antidice\t\tAnti-dice distance [-s]\n\
+\t-S, --sneath\t\tSneath-Sokal distance [-s]\n\
+\t-H, --hamming\t\tHamming distance\n\
+\t-L, --evol\t\tEvolutionary distance\n\
+\t-a, --hamman\t\tHamman distance [-s]\n\
+\t-P, --phi\t\tPearson Phi distance [-s]\n\
+\t-B, --anderberg\t\tAnderberg distance [-s]\n\
+\t-g, --gower\t\tGower distance[-s]\n\
+\t-u, --russel\t\tRussel-rao distance [-s]\n\
+\t-y, --yule\t\tYule distance [-s]\n\
+\t-o, --ochiai\t\tOchiai distance [-s]\n\
+\t-k, --kulczynski\tKulczynski distance [-s]\n\
+\t-s, --similarity\tForce similarity matrix (-koyrgapaSNDTjM)\n\
+\t-q, --quiet\tSuppress warning messages\n\
+\t-h, --help\t\tThis message\n\
+\t-v, --version\t\tPrint version\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+enum dist_modes { jensen_shannon, euclidean, cosine, manhattan, pearson_r,
+ chebyshev, jaccard, tanimoto, dice, hamming, yule,
+ russel, matching, hamann, antidice, sneath, ochiai,
+ euclidean2, canberra, anderberg, phi, gower, kulczynski,evolution
+};
+enum matrix_modes { similarity, distance };
+
+char matrix_mode = distance;
+int precision = DEFAULT_PRECISION;
+float euclidean_norm = DEFAULT_NORM;
+ /**< Precision for floating point output */
+char **taxaNames; /**< Array to store Taxa names for phylip infile output */
+
+
+char rflag = 0;
+ /**< -l Option for calculating specific line in JSD */
+int rflagN = 0;
+char qFlag = 0;
+
+int main(int argc, char **argv)
+{
+ FILE *fp;
+ FILE *pp;
+ int opt;
+ unsigned rows = 0;
+ char dist_mode = jensen_shannon;
+ char pflag = 0;
+ char dflag = 0;
+ int dvalue = 0;
+ char *pvalue = NULL;
+ int i;
+ double *D = NULL;
+ int option_index = 0;
+ char buffer[STR_BUFF];
+
+ static struct option long_options[] = {
+ {"phylip", required_argument, 0, 'p'},
+ {"precision", required_argument, 0, 'd'},
+ {"euclid", no_argument, 0, 'e'},
+ {"euclid2", no_argument, 0, 'E'},
+ {"canberra", no_argument, 0, 'b'},
+ {"normval", required_argument, 0, 'n'},
+ {"cosine", no_argument, 0, 'c'},
+ {"manhattan", no_argument, 0, 'm'},
+ {"pearson", no_argument, 0, 'R'},
+ {"chebyshev", no_argument, 0, 'C'},
+ {"jaccard", no_argument, 0, 'j'},
+ {"tanimoto", no_argument, 0, 't'},
+ {"dice", no_argument, 0, 'D'},
+ {"hamming", no_argument, 0, 'H'},
+ {"evol", no_argument, 0, 'L'},
+ {"yule", no_argument, 0, 'y'},
+ {"russel", no_argument, 0, 'u'},
+ {"matching", no_argument, 0, 'M'},
+ {"hamman", no_argument, 0, 'a'},
+ {"antidice", no_argument, 0, 'N'},
+ {"sneath", no_argument, 0, 'S'},
+ {"ochiai", no_argument, 0, 'o'},
+ {"version", no_argument, 0, 'v'},
+ {"row", required_argument, 0, 'r'},
+ {"anderberg", no_argument, 0, 'B'},
+ {"phi", no_argument, 0, 'P'},
+ {"gower", no_argument, 0, 'g'},
+ {"kulczynski", no_argument, 0, 'k'},
+ {"similarity", no_argument, 0, 's'},
+ {"help", no_argument, 0, 'h'},
+ {"quiet", no_argument, 0, 'q'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "abp:d:ghkevr:cmBERCDHMNSPsn:ojtyuqL",
+ long_options, &option_index)) != -1)
+ switch (opt) {
+ case 'p':
+ pflag = 1;
+ pvalue = optarg;
+ break;
+ case 'd':
+ dflag = 1;
+ dvalue = atoi(optarg);
+ break;
+ case 'q':
+ qFlag = 1;
+ break;
+ case 'c':
+ dist_mode = cosine;
+ break;
+ case 'e':
+ dist_mode = euclidean;
+ break;
+ case 'E':
+ dist_mode = euclidean2;
+ break;
+ case 'b':
+ dist_mode = canberra;
+ break;
+ case 'n':
+ euclidean_norm = atof(optarg);
+ if (euclidean_norm <= 1)
+ fatal_msg("Norm value must be greater than 1\n");
+ break;
+ case 'm':
+ dist_mode = manhattan;
+ break;
+ case 'R':
+ dist_mode = pearson_r;
+ break;
+ case 'C':
+ dist_mode = chebyshev;
+ break;
+ case 'j':
+ dist_mode = jaccard;
+ break;
+ case 't':
+ dist_mode = tanimoto;
+ break;
+ case 'D':
+ dist_mode = dice;
+ break;
+ case 'a':
+ dist_mode = hamann;
+ break;
+ case 'H':
+ dist_mode = hamming;
+ break;
+ case 'L':
+ dist_mode = evolution;
+ break;
+ case 'S':
+ dist_mode = sneath;
+ break;
+ case 'N':
+ dist_mode = antidice;
+ break;
+ case 'y':
+ dist_mode = yule;
+ break;
+ case 'u':
+ dist_mode = russel;
+ break;
+ case 'M':
+ dist_mode = matching;
+ break;
+ case 'o':
+ dist_mode = ochiai;
+ break;
+ case 'B':
+ dist_mode = anderberg;
+ break;
+ case 'P':
+ dist_mode = phi;
+ break;
+ case 'g':
+ dist_mode = gower;
+ break;
+ case 'k':
+ dist_mode = kulczynski;
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'r':
+ rflag = 1;
+ rflagN = atoi(optarg) - 1;
+ break;
+ case 's':
+ matrix_mode = similarity;
+ break;
+ default:
+ printErrorUsageStr();
+ break;
+ }
+
+
+ if (dflag)
+ precision = dvalue;
+
+// process file arguments
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s.\n", *argv,strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ // must confirm seekabilitiy
+
+ if (!isRegularFile(fp)) {
+ fp = convertPipeToFile(fp);
+ }
+
+
+ switch (dist_mode) {
+ case euclidean:
+ rows = euclidean_dist(fp, &D);
+ break;
+ case euclidean2:
+ rows = euclidean2_dist(fp, &D);
+ break;
+ case cosine:
+ rows = cosine_dist(fp, &D);
+ break;
+ case manhattan:
+ rows = manhattan_dist(fp, &D);
+ break;
+ case pearson_r:
+ rows = pearson_matrix(fp, &D);
+ break;
+ case chebyshev:
+ rows = chebyshev_dist(fp, &D);
+ break;
+ case jaccard:
+ rows = jaccard_dist(fp, &D);
+ break;
+ case tanimoto:
+ rows = tanimoto_dist(fp, &D);
+ break;
+ case dice:
+ rows = dice_dist(fp, &D);
+ break;
+ case hamming:
+ rows = hamming_dist(fp, &D);
+ break;
+ case evolution:
+ rows = evolution_dist(fp, &D);
+ break;
+ case yule:
+ rows = yule_dist(fp, &D);
+ break;
+ case russel:
+ rows = russel_dist(fp, &D);
+ break;
+ case hamann:
+ rows = hamann_dist(fp, &D);
+ break;
+ case antidice:
+ rows = antidice_dist(fp, &D);
+ break;
+ case sneath:
+ rows = sneath_dist(fp, &D);
+ break;
+ case ochiai:
+ rows = ochiai_dist(fp, &D);
+ break;
+ case canberra:
+ rows = canberra_dist(fp, &D);
+ break;
+ case anderberg:
+ rows = anderberg_dist(fp, &D);
+ break;
+ case phi:
+ rows = phi_dist(fp, &D);
+ break;
+ case gower:
+ rows = gower_dist(fp, &D);
+ break;
+ case kulczynski:
+ rows = kulczynski_dist(fp, &D);
+ break;
+ case matching:
+ rows = matching_dist(fp, &D);
+ break;
+ case jensen_shannon:
+ if (rflag)
+ rows = jsdr(fp, &D);
+ else
+ rows = jsd(fp, &D);
+ break;
+ }
+
+
+ if (pflag) // if phylip format requested
+ {
+ if ((pp = fopen(pvalue, "r")) == NULL) {
+ fprintf(stderr, "Error opening file %s", pvalue);
+ exit(1);
+ }
+
+ taxaNames = (char **) malloc(sizeof(char *) * rows);
+ for (i = 0; i < rows; i++) {
+ taxaNames[i] =
+ (char *) malloc(sizeof(char) * (TAXANAMELEN + 1));
+ if (!fscanf(pp, "%s", buffer))
+ fatal_msg("%: Read zero items.",pvalue);
+ if (strlen(buffer) > TAXANAMELEN) {
+ if (!qFlag)
+ warn_msg("Taxaname: %s greater than %d. Truncating.\n",
+ buffer, TAXANAMELEN);
+ buffer[10] = '\0';
+ }
+ strcpy(taxaNames[i], buffer);
+ }
+ }
+
+ if (rflag)
+ printLine(D, rows);
+ else if (pflag)
+ printInfile(D, rows);
+ else
+ printMatrix(D, rows);
+
+ free(D);
+
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+
+ return EXIT_SUCCESS;
+}
+
+
+/**
+ * Calculates a Jensen Shannon Divergence of an FFP matrix
+ * using a single line.
+ *
+ * The FFP is read from fp, and the JSD calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be columnar row normalized data.
+ *
+ * @param fp A file pointer to a row normalized columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+
+
+int jsdr(FILE * fp, double **D)
+{
+ double *a;
+ double val;
+ double m;
+ char ch[2];
+ int tst = 0;
+ long pos;
+ int i;
+ double ha;
+ double hb;
+ unsigned cols = 0;
+ int row;
+ unsigned colsize = 10000;
+ int rowsize = 10;
+
+ a = (double *) malloc(sizeof(double) * colsize);
+ *D = (double *) malloc(sizeof(double) * rowsize);
+
+
+
+ // Read length of first line
+
+ while (tst != 2) {
+ if (cols >= colsize) // if vector is too large reallocate
+ {
+ colsize += 10000;
+ if ((a = (double *) realloc(a, sizeof(double) * colsize)) == NULL) {
+ fprintf(stderr, "Out of memory!\n");
+ exit(ENOMEM);
+ }
+ }
+ tst = fscanf(fp, "%lf%[\n\r]", &a[cols++], ch);
+ }
+
+ pos = ftell(fp);
+
+ // If line = 0 then good to go. else jump forward to the right line and re-read
+ if (rflagN > 0) {
+ fseek(fp, pos * rflagN, SEEK_SET);
+ //Now read that line;
+ //check for EOF in case an invalid line was specified
+ for (i = 0; i < cols; i++)
+ tst = fscanf(fp, "%lf\n", &a[i]);
+ // Possibly check for fscanf errors.
+ }
+
+ clearerr(fp);
+ fseek(fp, 0, SEEK_SET);
+ row = 0;
+
+ while (!feof(fp)) {
+
+/*
+ if (row == rflagN) {
+ // last line
+ (*D)[row++] = 0;
+ fseek(fp,pos,SEEK_CUR);
+ continue;
+ }*/
+
+ while (row + 1 > rowsize) {
+ rowsize *= 2;
+ if ((*D = (double *) realloc(*D, sizeof(double) * rowsize)) == NULL) {
+ fprintf(stderr, "Out of memory!\n");
+ exit(ENOMEM);
+ }
+ }
+
+
+ ha = hb = 0;
+ for (i = 0; i < cols; i++) {
+ if (!fscanf(fp, "%lf\n", &val))
+ fatal_msg("Read zero items.");
+ m = (val + a[i]) / 2.0;
+ if (!a[i] && !val) {
+ continue;
+ } else if (!a[i]) {
+ hb -= val;
+ continue;
+ } else if (!val) {
+ hb -= a[i];
+ continue;
+ } else {
+ ha += -a[i] * log2(m / a[i]);
+ hb += -val * log2(m / val);
+ }
+ }
+ (*D)[row++] = fabs(0.5 * ha + 0.5 * hb);
+ }
+ free(a);
+ return (row);
+}
+
+
+
+
+
+/**
+ * Print out a distance matrix
+ *
+ * Prints out the distance matrix
+ * stored in D with the precision specified
+ *
+ * @param n Dimensions of the distance matrix
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return None
+ * @see precision
+ */
+
+
+void printMatrix(double *D, int n)
+{
+ int i, j, k = 0, l = 0;
+
+ for (i = 0; i < n; i++) {
+ k += i;
+ for (j = 0, l = 0; j < n; j++, l += j)
+ printf("%.*e ", precision,
+ (i > j ? D[j * n + i - l] : D[i * n + j - k]));
+ printf("\n");
+
+ }
+}
+
+
+
+/**
+ * Print out a distance matrix
+ *
+ * Prints out the distance matrix
+ * stored in D with the precision specified
+ *
+ * @param n Dimensions of the distance matrix
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return None
+ * @see precision
+ */
+
+
+void printLine(double *D, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ printf("%.*e ", precision, D[i]);
+ printf("\n");
+
+}
+
+
+
+/**
+ * Print a phylip format infile
+ *
+ * Prints out the distance matrix
+ * stored in D, along with the taxa
+ * names stored in the global variable
+ * taxaNames. The precision used will
+ * be as specified in the precision variable.
+ *
+ * @param n Dimensions of the distance matrix
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return None
+ * @see taxaNames
+ * @see precision
+ */
+
+
+
+
+void printInfile(double *D, int n)
+{
+ int i, j, k, l;
+ printf("%d\n", n);
+
+ for (i = 0, k = 0; i < n; i++, k += i) {
+ printf("%-*s", TAXANAMELEN, taxaNames[i]);
+ for (j = 0, l = 0; j < n; j++, l += j)
+ printf("%.*e ", precision,
+ (i > j ? D[j * n + i - l] : D[i * n + j - k]));
+ printf("\n");
+
+ }
+
+
+
+}
+
+
+
+/**
+ * Calculates pearson correlation coeficient
+ *
+ * This function calculates a pairwise correlation
+ * This is a generic function, and hasn't been optimized
+ * to calculate correlations with FFPs quickly.
+ *
+ * @param x A double array
+ * @param y A double array
+ * @param length The length of the array
+ * @retrun Returns the correlation coefficient
+ * @todo Incorporate code into pearson_dist so that the stdev
+ * of x isn't continually recalculated
+ */
+
+float pearsons(double *x, double *y, int length)
+{
+ int i;
+ double N = (double) length;
+ double sum_sq_x = 0.0;
+ double sum_sq_y = 0.0;
+ double sum_coproduct = 0.0;
+ double mean_x = x[0];
+ double mean_y = y[0];
+ double sweep, delta_x, delta_y, index;
+ for (i = 1; i < N; i++) {
+ index = (double) i;
+ sweep = (index - 1.0) / index;
+ delta_x = x[i] - mean_x;
+ delta_y = y[i] - mean_y;
+ sum_sq_x += delta_x * delta_x * sweep;
+ sum_sq_y += delta_y * delta_y * sweep;
+ sum_coproduct += delta_x * delta_y * sweep;
+ mean_x += delta_x / index;
+ mean_y += delta_y / index;
+ }
+
+ if (sum_sq_x <= 0 || isnan(sum_sq_x) || isinf(sum_sq_x))
+ return 0.0;
+
+ double pop_sd_x = sqrt(sum_sq_x / N);
+ double pop_sd_y = sqrt(sum_sq_y / N);
+ double cov_x_y = sum_coproduct / N;
+
+ return (float) cov_x_y / (pop_sd_x * pop_sd_y);
+}
+
+/**
+ * This definition below is a macro that eliminates some repetitive code
+ * below. I chose the option of lazy coding, rather than find the best
+ * way to implement the distance metrics with a smaller binary file.
+ * The template is used to generate actual functions which follow the
+ * template format
+ */
+
+
+
+#define DISTANCE_TEMPLATE(FUNC_NAME,DEFS,ALLOC, DIAGONAL,CALC_1,CALC_2,REALLOC) \
+ \
+int FUNC_NAME (FILE * fp, double **D) \
+{ \
+ double *a; \
+ DEFS; \
+ double dist; \
+ char ch[2]; \
+ int tst; \
+ long pos; \
+ int i, k; \
+ int kMax; \
+ int rMax; \
+ unsigned cols; \
+ int row; \
+ unsigned colsize = 10000; \
+ int rowsize = 10; \
+ \
+ ALLOC; \
+ a = (double *) malloc(sizeof(double) * colsize); \
+ *D = (double *) malloc(sizeof(double) * rowsize); \
+ \
+ k = 0; \
+ kMax = 1; \
+ rMax = 0; \
+ while (k < kMax) { \
+ tst = 0; \
+ row = 0; \
+ cols = 0; \
+ while (tst != 2) { \
+ if (cols >= colsize) \
+ { \
+ colsize += 10000; \
+ if ((a = \
+ (double *) realloc(a, sizeof(double) * colsize)) == NULL) { \
+ fprintf(stderr, "Out of memory!\n"); \
+ exit(ENOMEM); \
+ } \
+ REALLOC \
+ \
+ } \
+ \
+ tst = fscanf(fp, "%lf%[\n\r]", &a[cols++], ch); \
+ } \
+ row++; \
+ pos = ftell(fp); \
+ (*D)[k++] = DIAGONAL; \
+ while (!feof(fp)) { \
+ while (k + cols > rowsize ) \
+ { \
+ rowsize *= 2; \
+ if ((*D = \
+ (double *) realloc(*D, sizeof(double) * rowsize)) ==NULL) { \
+ fprintf(stderr,"Out of memory!\n"); \
+ exit(ENOMEM); \
+ } \
+ } \
+ dist=0; \
+ for (i = 0; i < cols; i++) { \
+ CALC_1; \
+ } \
+ row++; \
+ CALC_2; \
+ } \
+ \
+ if (row > rMax) { \
+ rMax = row; \
+ kMax = (row * row - row + 2 * row) / 2; \
+ } \
+ \
+ clearerr(fp); \
+ fseek(fp, pos, SEEK_SET); \
+ } \
+ \
+ free(a); \
+ return (rMax); \
+}
+
+
+
+
+
+/**
+ * Calculates a Jensen Shannon Divergence of an FFP matrix
+ *
+ * The FFP is read from fp, and the JSD calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be columnar row normalized data.
+ *
+ * @param fp A file pointer to a row normalized columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+DISTANCE_TEMPLATE(jsd, double val;
+ double m;
+ double ha = 0;
+ double hb = 0,,
+ 0,
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ m = (val + a[i]) / 2.0; if (!a[i] && !val) {
+ continue;}
+
+ else
+ if (!a[i]) {
+ hb -= val; continue;}
+
+ else
+ if (!val) {
+ hb -= a[i]; continue;}
+
+ else {
+ ha += -a[i] * log2(m / a[i]); hb += -val * log2(m / val);}
+
+ , (*D)[k++] = fabs(0.5 * ha + 0.5 * hb); ha = 0; hb = 0;,)
+
+
+/**
+ * Calculates a Jaccard Distance matrix of an FFP matrix
+ *
+ * The FFP is read from fp, and the Jaccard distance metric is
+ * calculated for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * Each row is considered as a bit string.
+ * This distance represents the number of features shared in
+ * common divided by the number of columns.
+ * The -s option affects the output, producing a Jaccard similarity
+ * marix rather than a distance matrix.
+ * @todo If both measures are all zeros, this is undefined. All zero vectors
+ * will have a similarity of 1, and zero to non-zero a similarity of 0.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+DISTANCE_TEMPLATE(jaccard_dist,
+ double val,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]) ? 1 : 0, if (matrix_mode == similarity)
+ (*D)[k++] = dist / cols;
+ else
+ (*D)[k++] = 1 - dist / cols;,)
+
+
+
+/**
+ * Calculates a Tanimoto Distance matrix of an FFP matrix
+ *
+ * The FFP is read from fp, and the Jaccard distance metric is
+ * calculated for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * Each row is considered as a bit string.
+ * This distance represents the number of features shared in
+ * common divided by the number of columns.
+ * The -s option affects the output, producing a Jaccard similarity
+ * marix rather than a distance matrix.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+DISTANCE_TEMPLATE(tanimoto_dist, double val;
+ double amag = 0;
+ double bmag = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ bmag += (val != 0);
+ amag += (a[i] != 0);
+ dist += (val && a[i]), if (matrix_mode == similarity)
+ (*D)[k++] = dist / (bmag + amag - dist);
+ else
+ (*D)[k++] = 1 - dist / (bmag + amag - dist); amag = bmag = 0;,)
+
+
+/**
+ * Calculates a Chebyshev distance matrix of an FFP matrix
+ *
+ * The FFP is read from fp, and the Chebyshev distance metric is
+ * calculated for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * This distance represented the the greatest difference among
+ * vectors along any coordinate dimension.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+DISTANCE_TEMPLATE(chebyshev_dist,
+ double val,,
+ 0,
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ if (fabs(val - a[i]) > dist)
+ dist = fabs(val - a[i]), (*D)[k++] = dist;,)
+
+
+
+/**
+ * Calculates a pearson correlation matrix of an FFP matrix
+ *
+ * The FFP is read from fp, and the correlation calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol. If the -s option is specified
+ * Matrix D will a similarity matrix otherwise it will be calculated
+ * as 1-R_squared.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+ DISTANCE_TEMPLATE(pearson_matrix,
+ double *b,
+ b = (double *) malloc(sizeof(double) * colsize),
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &b[i])) { fatal_msg("Read zero items"); },
+ if (matrix_mode == similarity)
+ (*D)[k++] = pearsons(a, b, cols);
+ else
+ (*D)[k++] = 1 - pow(pearsons(a, b, cols), 2);,
+ if ((b = (double *) realloc(b, sizeof(double) * colsize)) == NULL) {
+ fprintf(stderr, "Out of memory!\n");
+ exit(ENOMEM);
+ })
+
+
+/**
+ * Calculates a Manhattan Distance of an FFP matrix
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * Distance Calculation is: sum(abs(ai - bi))
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+ DISTANCE_TEMPLATE(manhattan_dist,
+ double val,,
+ 0,
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += fabs(val - a[i]), (*D)[k++] = dist;,)
+
+
+
+/**
+ * Calculates a Cosine Distance of an FFP matrix
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be columnar data. Row normalization is not required.
+ *
+ * D(A,B)=1-A.B/|A|/|B|
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+ DISTANCE_TEMPLATE(cosine_dist, double val;
+ double amag = 0;
+ double bmag = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ bmag += val * val;
+ amag += a[i] * a[i];
+ dist += val * a[i],
+ bmag = sqrt(bmag);
+ amag = sqrt(amag); if (matrix_mode == similarity)
+ (*D)[k++] = dist / bmag / amag;
+ else
+ (*D)[k++] = 1 - dist / bmag / amag; amag = bmag = 0;,)
+
+
+/**
+ * Calculates a Euclidean Distance of an FFP matrix
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(euclidean_dist,
+ double val,,
+ 0,
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += pow((val - a[i]), euclidean_norm),
+ (*D)[k++] = pow(dist, 1 / euclidean_norm);,)
+
+
+/**
+ * Calculates a Euclidean-squared Distance of an FFP matrix
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+DISTANCE_TEMPLATE(euclidean2_dist,
+ double val,,
+ 0,
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val - a[i]) * (val - a[i]);
+ , (*D)[k++] = dist;,)
+
+/**
+ * Calculates a canberra Distance of an FFP matrix
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @todo if either amag or bmag is zero then undefined, 0 to 0 is 0; 0 to 1 is 1
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+ DISTANCE_TEMPLATE(canberra_dist, double val;
+ double amag = 0;
+ double bmag = 0;
+ ,,
+ 0,
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ amag += val * val;
+ bmag += a[i] * a[i]; dist += fabs(val - a[i]);
+ ,
+ amag = sqrt(amag);
+ bmag = sqrt(bmag);
+ (*D)[k++] = dist / amag / bmag; amag = 0;
+ bmag = 0;,)
+
+
+/**
+ * Calculates a Dice Distance of an FFP matrix
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+ DISTANCE_TEMPLATE(dice_dist, double val;
+ double amag = 0;
+ double bmag = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ bmag += (val != 0);
+ amag += (a[i] != 0);
+ dist += (val && a[i]), if (matrix_mode == similarity)
+ (*D)[k++] = 2 * dist / (bmag + amag);
+ else
+ (*D)[k++] = 1 - 2 * dist / (bmag + amag);
+ amag = bmag = 0;,)
+
+/**
+ * Calculates a bitwise hamming distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(hamming_dist,
+ double val,,
+ 0,
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += !(val && a[i]), (*D)[k++] = dist;,)
+
+
+/**
+ * Calculates the Evolutionary distance used in Ecoli paper.
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(evolution_dist,
+ double val,,
+ 0,
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += !(val == a[i]), (*D)[k++] = dist;,)
+
+
+
+/**
+ * Calculates a bitwise yule distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+ DISTANCE_TEMPLATE(yule_dist, double val;
+ double b = 0;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ b += (!val && !a[i]);
+ c += (!val && a[i]); d += (val && !a[i]);
+ , if (matrix_mode == similarity)
+ (*D)[k++] = (dist * b - c * d) / (dist * b + c * d);
+ else
+ (*D)[k++] =
+ 1 - pow((dist * b - c * d) / (dist * b + c * d), 2);
+ b = 0; c = 0; d = 0;,)
+
+
+
+/**
+ * Calculates a bitwise Russel/Rao distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(russel_dist, double val;
+ double b = 0;
+ ,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]); b++, if (matrix_mode == similarity)
+ (*D)[k++] = dist / (b);
+ else
+ (*D)[k++] = 1 - dist / (b); b = 0;,)
+
+
+/**
+ * Calculates a bitwise matching distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(matching_dist, double val;
+ double b = 0;
+ double c = 0;
+ ,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ b += (!val && !a[i]); c++, if (matrix_mode == similarity)
+ (*D)[k++] = (dist + b) / c;
+ else
+ (*D)[k++] = 1 - pow((dist + b) / c, 2); b = 0; c = 0;,)
+
+
+/**
+ * Calculates a bitwise Hamann distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(hamann_dist, double val;
+ double b = 0;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ b += (!val && !a[i]);
+ c += (!val && a[i]);
+ d += (val && !a[i]), if (matrix_mode == similarity)
+ (*D)[k++] = ((dist + b) - (c + d)) / (dist + b + c + d);
+ else
+ (*D)[k++] =
+ 1 - pow(((dist + b) - (c + d)) / (dist + b + c + d), 2);
+ b = 0; c = 0; d = 0;,)
+
+
+/**
+ * Calculates a bitwise antidice distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @todo comparing two zero vectors is undefined and equals zero.
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(antidice_dist, double val;
+ double b = 0;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ b += (!val && !a[i]);
+ c += (!val && a[i]);
+ d += (val && !a[i]), if (matrix_mode == similarity)
+ (*D)[k++] = dist / (dist + 2 * (c + d));
+ else
+ (*D)[k++] = 1 - dist / (dist + 2 * (c + d));
+ b = 0; c = 0; d = 0;,)
+
+
+/**
+ * Calculates a bitwise sneath distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(sneath_dist, double val;
+ double b = 0;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ b += (!val && !a[i]);
+ c += (!val && a[i]);
+ d += (val && !a[i]), if (matrix_mode == similarity)
+ (*D)[k++] = 2 * (dist + b) / (2 * (dist + b) + (c + d));
+ else
+ (*D)[k++] =
+ 1 - 2 * (dist + b) / (2 * (dist + b) + (c + d)); b = 0;
+ c = 0; d = 0;,)
+
+
+
+/**
+ * Calculates a bitwise ochiai distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @todo similarity of zero to zero is one, zero to non-zero is zero
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(ochiai_dist, double val;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ c += (!val && a[i]);
+ d += (val && !a[i]), if (matrix_mode == similarity)
+ (*D)[k++] = dist / sqrt((dist + c) * (dist + d));
+ else
+ (*D)[k++] = 1 - dist / sqrt((dist + c) * (dist + d));
+ c = 0; d = 0;,)
+
+
+
+
+/**
+ * Calculates a bitwise anderberg distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @todo all zero or all 1 then 1; a+b, a+c,c+d, b+d is zero then 0.
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(anderberg_dist, double val;
+ double b = 0;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ d += (!val && !a[i]);
+ b += (!val && a[i]);
+ c += (val && !a[i]), if (matrix_mode == similarity)
+ (*D)[k++] =
+ (dist / (dist + b) + dist / (dist + c) + d / (c + d) +
+ d / (b + d)) / 4;
+ else
+ (*D)[k++] =
+ 1 -
+ ((dist / (dist + b) + dist / (dist + c) + d / (c + d) +
+ d / (b + d)) / 4); b = 0; c = 0; d = 0;,)
+
+
+
+
+
+/**
+ * Calculates a bitwise pearson phi distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @todo b+c=0 then 1 a+d=0 then -1, ad-bc=0 then 0
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(phi_dist, double val;
+ double b = 0;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ d += (!val && !a[i]);
+ b += (!val && a[i]);
+ c += (val && !a[i]), if (matrix_mode == similarity)
+ (*D)[k++] =
+ (dist * d -
+ b * c) / sqrt((dist + b) * (dist + c) * (d + b) * (d +
+ c));
+ else
+ (*D)[k++] =
+ 1 -
+ pow((dist * d -
+ b * c) / sqrt((dist + b) * (dist + c) * (d +
+ b) * (d +
+ c)),
+ 2); b = 0; c = 0; d = 0;,)
+
+
+/**
+ * Calculates a bitwise gower distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @todo ad=0 then 0, all zero or all 1 then 1
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(gower_dist, double val;
+ double b = 0;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ d += (!val && !a[i]);
+ b += (!val && a[i]);
+ c += (val && !a[i]), if (matrix_mode == similarity)
+ (*D)[k++] =
+ dist * d / sqrt((dist + b) * (dist + c) * (d + b) *
+ (d + c));
+ else
+ (*D)[k++] =
+ 1 -
+ dist * d / sqrt((dist + b) * (dist + c) * (d + b) *
+ (d + c)); b = 0; c = 0; d = 0;,)
+
+
+/**
+ * Calculates a bitwise gower distance of an FFP matrix
+ *
+ *
+ * The FFP is read from fp, and the distance calculation is
+ * perfomed for all pairs of FFP. The form of the FFP
+ * must be a columnar matrix, but not necessarily row normalized.
+ * In other words, raw frequencies can be used, for example
+ * output directly from ffpcol.
+ *
+ * @todo zero to zero 1 , zero to nonzero=0
+ * @param fp A file pointer to a columnar FFP
+ * @param D Points to a dynamically allocated array of double precision floats.
+ * @return Returns the number of rows read.
+ */
+
+
+ DISTANCE_TEMPLATE(kulczynski_dist, double val;
+ double b = 0;
+ double c = 0;
+ double d = 0,,
+ (matrix_mode == similarity),
+ if (!fscanf(fp, "%lf\n", &val)) { fatal_msg("Read zero items"); }
+ dist += (val && a[i]);
+ d += (!val && !a[i]);
+ b += (!val && a[i]);
+ c += (val && !a[i]), if (matrix_mode == similarity)
+ (*D)[k++] = (dist / (dist + b) + dist / (dist + c)) / 2;
+ else
+ (*D)[k++] =
+ 1 - (dist / (dist + b) + dist / (dist + c)) / 2; b = 0;
+ c = 0; d = 0;,)
+
+
+
+// gower
+// mixed continuous/ binary
+//
+// Renkonen
+// percentage similarity
+// sum all i min(fi1,fi2)
+// bray curtis dissimilarity
+// S10+S11 + S01S11 - 2*C
+// ~~~~~~~~~~~~~~~~~~~~~
+// S10+S11 + S01S11
+//
+// C=sum all i min(fi1,fi2);
diff --git a/src/ffpmerge.c b/src/ffpmerge.c
new file mode 100644
index 0000000..a9cdd7e
--- /dev/null
+++ b/src/ffpmerge.c
@@ -0,0 +1,266 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include "hash.h"
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "../config.h"
+
+char PROG_NAME[FILENAME_MAX];
+#define COL_SIZE 1000 /**< Intial guess of column number in the FP */
+#define MAX_WORD_LENGTH 40 /**< Maximum feature length */
+
+unsigned merge(FILE * fp, unsigned **vals, unsigned size);
+void mergeHash(FILE * fp);
+int isKeyBased(FILE * fp);
+int getKeyLength(FILE * fp);
+
+
+char usage_str[] = "Usage: %s [OPTIONS] ... [FILE]\n\
+This program merges multiple rows of an FFP into a single row\n\n\
+The behavior of the program is to merge all rows of the FFP.\n\
+The FFP can be a columnar or key-valued FFP.\n\
+\t-t, --text\tInput is text\n\
+\t-a, --amino\tInput is amino acid\n\
+\t-d, --disable\tDisable classing of input\n\
+\t-k, --keys\tPrint key-value pairs.\n\
+\t-v, --vesion\tDisplay version\n\
+\t-h, --help\tThis messsage\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+char *weightVector;
+int Length = MAX_WORD_LENGTH;
+ /**< Feature Length */
+
+int main(int argc, char **argv)
+{
+ FILE *fp;
+ int opt;
+ unsigned cols;
+ unsigned i;
+ unsigned *vals;
+ char **keys;
+ bool isKey = false;
+ bool dflag = false;
+ bool aflag = false;
+ bool tflag = false;
+ bool kflag = false;
+ int option_index = 0;
+
+
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"disable", no_argument, 0, 'd'},
+ {"keys", no_argument, 0, 'k'},
+ {"amino", no_argument, 0, 'a'},
+ {"text", no_argument, 0, 't'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "khdatv",
+ long_options, &option_index)) != -1)
+ switch (opt) {
+ case 'd':
+ dflag = !dflag;
+ break;
+ case 'a':
+ aflag = !aflag;
+ break;
+ case 't':
+ tflag = !tflag;
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'k':
+ kflag = !kflag;
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ break;
+ }
+
+ if (aflag && dflag)
+ fatal_msg("Error -a or -t, not both\n");
+
+
+ if (aflag)
+ initHash(0, amino, !dflag);
+ else if (tflag)
+ initHash(0, text, !dflag);
+ else
+ initHash(0, nucleotide, !dflag);
+
+// init to zero
+ vals = (unsigned *) calloc(sizeof(unsigned), COL_SIZE);
+
+
+// IT may be necessary to determine what kind of data is
+// being merged, add additional switches -disable-classes?
+
+// masking should also be used in this function
+
+ cols = COL_SIZE;
+
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s\n", *argv, strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ isKey = isKeyBased(fp);
+
+ if (!isKey)
+ cols = merge(fp, &vals, cols);
+ else {
+ Length = getKeyLength(fp);
+ mergeHash(fp);
+ }
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+
+ if (!isKey) {
+ for (i = 0; i < cols-1; i++)
+ printf("%u\t", vals[i]);
+ printf("%u\n", vals[i]);
+ } else {
+ hashKeys(&keys);
+ if (kflag) {
+ for (i = 0; i < numKeys()-1; i++)
+ printf("%s %u\t", keys[i], hashval(keys[i]));
+ printf("%s %u\n", keys[i], hashval(keys[i]));
+ } else {
+ for (i = 0; i < numKeys()-1; i++)
+ printf("%u\t", hashval(keys[i]));
+ printf("%u\n", hashval(keys[i]));
+ }
+ printf("\n");
+ freeHash();
+ //@todo Free keys?
+ }
+
+ free(vals);
+ return EXIT_SUCCESS;
+}
+
+/**
+ * Merges all the rows in a single column together
+ *
+ * All the frequencies in a column are added together
+ * to the vector in vals. The FFP in the file fp
+ * must be stored in columnar format. Space in vals
+ * is dynamically reallocated as needed to accomodate
+ * the size of the FFP.
+ *
+ * @param fp A file pointer to an FFP
+ * @param vals A ptr to an array of unsigned integers
+ * @param size An initial guess as to the size of vals.
+ * @return The number of columns read.
+ */
+
+
+unsigned merge(FILE * fp, unsigned **vals, unsigned size)
+{
+ long unsigned i;
+ int rows;
+ unsigned val;
+ unsigned cols = 0;
+ char ch[2];
+ int d;
+
+
+ i = 0;
+ rows = 0;
+ while (!feof(fp)) {
+ if (i < size) {
+ d = fscanf(fp, "%u%[\n\r]", &val, ch);
+ (*vals)[i++] += val;
+ if (d == 2) {
+ cols = i;
+ rows++;
+ i = 0;
+ }
+ } else {
+ size += COL_SIZE;
+ *vals = (unsigned *) realloc(*vals, sizeof(unsigned) * size);
+ }
+ }
+ return cols;
+
+}
+
+
+/**
+ * Merges all the rows in a (key,value) FFP
+ *
+ * All the frequencies in a (key,value) FFP row are added together
+ * in a new hash. The FFP in the file fp
+ * must be a (Key,value) FFP.
+ *
+ * @param fp A file pointer to an FFP
+ * @return None
+ */
+
+
+void mergeHash(FILE * fp)
+{
+ unsigned val;
+ char ch[2];
+ char s[Length];
+
+
+ while (!feof(fp)) {
+ fscanf(fp, "%s%[\t]%u%[\n\r]", s, ch, &val, ch);
+ s[Length] = '\0'; /**<This line may be unnecessary**/
+ hashAdd(s, val); // increments hash by value;
+ }
+}
diff --git a/src/ffpre.c b/src/ffpre.c
new file mode 100644
index 0000000..3360893
--- /dev/null
+++ b/src/ffpre.c
@@ -0,0 +1,267 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <getopt.h>
+#include <math.h>
+#include <ctype.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include "hashroll.h"
+#include "ffpry.h"
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "../config.h"
+
+char PROG_NAME[FILENAME_MAX];
+#define DEFAULT_WORD_LENGTH 10
+#define MAX_LENGTH 30
+#define CHAR_BUFFER_SIZE 2000
+
+/**< @todo this needs to be check thoroughly to make sure it produces the correct output
+*/
+void reNuc(FILE * fp);
+void reAA(FILE * fp);
+void reText(FILE * fp);
+void loopRawRe(HASH * h, HASH * h1, HASH * h2, FILE * fp);
+
+char usage_str[] = "Usage: %s [OPTION] ... [FILE]...\n\
+This program prints out the relative entropy between an\n\
+l-2 Markov model estimation of frequency and the observed\n\
+frequency of features\n\n\
+Given no options the default behavior of the program is to\n\
+generate the relative entropy value (Kullbach-Leibler Divergence)\n\
+of feature frequencies using l=10 and estimates of the frequencies\n\
+using l=9 and l=8 to provide the estimate\n\
+\t-l LEN, --length=LEN\n\
+\t-d, --disable\n\
+\t-a, --amino\n\
+\t-t, --text\n\
+\t-v, --version\n\
+\t-v, --help\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+char *weightVector;
+int Length = DEFAULT_WORD_LENGTH;
+int maxWordSize = MAX_WORD_SIZE;
+int Buffsize = CHAR_BUFFER_SIZE;
+unsigned int lcount; /**< Number of features counted of length l */
+unsigned int l1count; /**< Number of features counted of length l-1 */
+unsigned int l2count; /**< Number of featurs counted of length l-2 */
+
+char aflag = 0;
+char dflag = 0;
+char tflag = 0;
+char rflag = 1;
+char fflag = 0; // not used but needed to link with hashroll.c fix
+char mflag = 0; // not used currently, same as fflag
+
+int main(int argc, char **argv)
+{
+ char **keys;
+ int mode = nucleotide;
+ int i;
+ int opt;
+ FILE *fp;
+ double Ef;
+ double N;
+ double kld;
+ HASH h, h1, h2;
+ int option_index = 0;
+ char *r;
+ char *s;
+ char *t;
+
+ static struct option long_options[] = {
+ {"length", required_argument, 0, 'l'},
+ {"disable", no_argument, 0, 'd'},
+ {"help", no_argument, 0, 'h'},
+ {"amino", no_argument, 0, 'a'},
+ {"text", no_argument, 0, 't'},
+ {"no-reverse", no_argument, 0, 'r'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "l:dhatvr",
+ long_options, &option_index)) != -1)
+
+ switch (opt) {
+ case 'l':
+ Length = atoi(optarg);
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'r':
+ rflag = !rflag;
+ break;
+ case 'a':
+ aflag = 1;
+ mode = amino;
+ break;
+ case 't':
+ tflag = 1;
+ mode = text;
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ exit(EXIT_FAILURE);
+ break;
+
+ }
+
+ if ( getenv("MAX_WORD_SIZE") ) {
+ maxWordSize=atoi(getenv("MAX_WORD_SIZE"));
+ }
+
+ if (Length > maxWordSize)
+ fatal_msg("%d: Max Word size is : %d",Length,maxWordSize);
+
+
+// check -l length to make sure it is valid
+
+ if (Length < 3)
+ fatal_msg("Feature Length must be 3 or greater\n");
+
+ init(&h, 0, mode, !dflag, rflag, Length);
+ init(&h1, 0, mode, !dflag, rflag, Length - 1);
+ init(&h2, 0, mode, !dflag, rflag, Length - 2);
+// Must now process file arguments
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: No Such file", *argv);
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ loopRawRe(&h, &h1, &h2, fp);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+
+
+ r = (char *) malloc(sizeof(char) * Length);
+ s = (char *) malloc(sizeof(char) * Length);
+ t = (char *) malloc(sizeof(char) * Length);
+
+//@todo fix to work with amino acids and text
+
+ lcount = sumValues(&h);
+ l1count = sumValues(&h1);
+ l2count = sumValues(&h2);
+
+ hashKeys(&h, &keys);
+
+ N = (double) l2count / l1count / l1count;
+
+
+ kld = 0.0;
+ for (i = 0; i < h.keyN; i++) {
+ r = strncpy(r, keys[i] + 1, Length - 1);
+ r[Length - 1] = '\0';
+ s = strncpy(s, keys[i], Length - 1);
+ s[Length - 1] = '\0';
+ t = strncpy(t, keys[i] + 1, Length - 1);
+ t[Length - 2] = '\0';
+ Ef = (double) hashValNuc(&h1, r) * hashValNuc(&h1, s) / hashValNuc(&h2,
+ t) *
+ N;
+ if (isnormal(Ef)) {
+ kld -= (double) Ef *log2(hashValNuc(&h, keys[i]) / Ef / lcount);
+ }
+ }
+ printf("%lf\n", kld);
+ // printf("\n");
+ // should free keys too;
+
+ // (a+b)/An
+
+
+
+ freeHash(&h);
+ freeHash(&h1);
+ freeHash(&h2);
+ return EXIT_SUCCESS;
+}
+
+// Could change this to an array of hashes
+void loopRawRe(HASH * h, HASH * h1, HASH * h2, FILE * fp)
+{
+ struct stat fattr;
+ static size_t optimal_size;
+ ssize_t nr;
+ static char *buf = NULL;
+
+ //Determine optimal buffer size for file
+ if (fstat(fileno(fp), &fattr))
+ fatal_msg("fstat error.\n");
+
+ //Find optimal size for Disk IO
+ optimal_size = (fattr.st_blksize >= BUFSIZ) ? fattr.st_blksize : BUFSIZ;
+
+ buf = (char *) malloc(optimal_size);
+
+
+ // Make hash aware of its own mode amino, nucleotide or text
+ // replace w/ function pointers
+ while ((nr = fread(buf, sizeof(char), optimal_size, fp)) != -1 && nr != 0) {
+ if (aflag) {
+ pushaa(h, buf, nr,false);
+ pushaa(h1, buf, nr,false);
+ pushaa(h2, buf, nr,false);
+ } else if (tflag) {
+ pushtxt(h, buf, nr);
+ pushtxt(h1, buf, nr);
+ pushtxt(h2, buf, nr);
+ } else {
+ pushatgc(h, buf, nr,false);
+ pushatgc(h1, buf, nr,false);
+ pushatgc(h2, buf, nr,false);
+ }
+
+
+ }
+}
diff --git a/src/ffprwn.c b/src/ffprwn.c
new file mode 100644
index 0000000..ad8016d
--- /dev/null
+++ b/src/ffprwn.c
@@ -0,0 +1,260 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "../config.h"
+
+char PROG_NAME[FILENAME_MAX];
+#define COL_SIZE 1000 /**< Initial guess for number of columns in FFP */
+#define ROW_SIZE 10 /**< Initial guess for number of rows in FFP */
+#define DEFAULT_PRECISION 2 /**< Default precision for formated printing of normalized FFP */
+
+void rownorm(FILE * fp);
+void rownorml(FILE * fp);
+
+char usage_str[] = "usage: %s [OPTION] ... [FILE] ...\n\
+This program performs row normalization of an FFP vector file\n\n\
+Given no options, the defeault behavior of the program is to\n\
+generate row normalized relative frequency vectors\n\
+\t-n, --largest-row\tNormalized by largest row sum\n\
+\t-d=INT, --precision=INT\tSpecify n digits of decimal precision\n\
+\t-v, --version\n\
+\t-h, --help\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+int precision = DEFAULT_PRECISION;
+ /**< Precision in Decimal places for normalized FFP */
+
+
+
+int main(int argc, char **argv)
+{
+ FILE *fp;
+ int opt;
+ char nflag = 0;
+ char dflag = 0;
+ int dvalue = 0;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"largest-row", no_argument, 0, 'n'},
+ {"precision", no_argument, 0, 'd'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "nd:hv",
+ long_options, &option_index)) != -1)
+ switch (opt) {
+ case 'n':
+ nflag = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ dvalue = atoi(optarg);
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ break;
+ }
+
+
+ if (dflag)
+ precision = dvalue;
+
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s.\n", *argv,strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ // check if not a seekable pipe
+ if (!isRegularFile(fp))
+ fp = convertPipeToFile(fp);
+
+ if (isKeyBased(fp))
+ fatal_msg("%s: Not a columnar FFP - see ffpcol.\n", *argv);
+
+
+ if (nflag)
+ rownorml(fp);
+ else
+ rownorm(fp);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+
+ return EXIT_SUCCESS;
+}
+
+
+
+/**
+ *
+ * Performs standard row normalization
+ *
+ * Each row is converted into a relative
+ * frequency vector.
+ *
+ * @param fp A file pointer
+ * @return void
+ *
+ */
+
+
+
+/* Reconsider the design of this function -- It may be faster to do a double scan
+ * of the file as in rownorml */
+
+void rownorm(FILE * fp)
+{
+ long unsigned *sum;
+ long unsigned val;
+ int rowsize = ROW_SIZE; /* initial guess */
+ char s[3];
+ int d=0;
+ int row=0;
+
+ sum = (long unsigned *) calloc(rowsize, sizeof(long unsigned));
+
+ sum[row]=0;
+ while ( (d = fscanf(fp, "%lu%[\n\r]", &val, s)) != EOF ) {
+ sum[row] += val;
+ if (d == 2) {
+ row++;
+ if (row == rowsize) {
+ rowsize += ROW_SIZE;
+ sum = (long unsigned *) realloc(sum,
+ sizeof(long unsigned) *
+ rowsize);
+ }
+ sum[row]=0;
+ }
+ }
+
+
+ row=0;
+ rewind(fp);
+ while ( (d = fscanf(fp, "%lu%[\n\r]", &val, s)) != EOF ) {
+ if (sum[row] == 0) {
+ if (d==2) {
+ printf("%.*e\n", precision, 0.0);
+ warn_msg("Row %ld has row sum of 0.0\n", row + 1);
+ row++;
+ } else {
+ printf("%.*e\t", precision, 0.0);
+ }
+ } else {
+ if (d == 2) {
+ printf("%.*e\n", precision, (float) val / sum[row]);
+ row++;
+ } else {
+ printf("%.*e\t", precision, (float) val / sum[row]);
+ }
+
+ }
+ }
+
+ free(sum);
+}
+
+
+
+
+/**
+ *
+ * Performs row normalization by largest row
+ *
+ * Each row is converted into a relative
+ * frequency vector.
+ *
+ * @param fp A file pointer
+ * @return void
+ *
+ */
+
+
+
+void rownorml(FILE * fp)
+{
+ long unsigned sum;
+ long unsigned val;
+ char s[3];
+ int d;
+ long unsigned maxsum = 0;
+
+ sum = 0;
+ while ( (d=fscanf(fp, "%lu%[\r\n]", &val,s)) != EOF ) {
+ sum += val;
+ if ( d == 2 ) {
+ if (sum > maxsum) {
+ maxsum = sum;
+ }
+ sum=0;
+ }
+ }
+
+ rewind(fp);
+
+ while ( (d=fscanf(fp, "%lu%[\r\n]", &val,s)) != EOF ) {
+ sum += val;
+ if ( d == 1)
+ printf("%.*e\t", precision, (float) val / maxsum);
+ else
+ printf("%.*e\n", precision, (float) val / maxsum);
+
+
+ }
+}
diff --git a/src/ffpry.c b/src/ffpry.c
new file mode 100644
index 0000000..e73ef6b
--- /dev/null
+++ b/src/ffpry.c
@@ -0,0 +1,378 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+
+/* Current revision: $Revision: 1.37 $
+ * On Tag name: $Name: $
+ * Date commited: $Date: 2012-02-26 01:57:45 $
+ * Author: $Author: gsims $
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <getopt.h>
+#include <math.h>
+#include <ctype.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include "hashroll.h"
+#include "mask.h"
+#include "ffpry.h"
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "parse_features.h"
+#include "../config.h"
+
+
+#define DEFAULT_WORD_LENGTH 10 /**< Default Feature length if not given by opt -l */
+#define CHAR_BUFFER_SIZE 10000 /**< Default buffer size for reading sequence files */
+
+
+/* Function prototypes */
+
+static void parseFile(HASH *, FILE *);
+static void loopFeatureList(HASH * h, FILE * fp);
+static void loopRaw(HASH * h, FILE * fp);
+
+
+/* Global variables */
+
+char PROG_NAME[FILENAME_MAX];
+char *weightVector; /**< A mask to allow mismatches in features */
+int Length = DEFAULT_WORD_LENGTH; /**< Feature length to use if not specified by opt -l */
+int maxWordSize = MAX_WORD_SIZE; /**< Maximum allowed length for opt -l */
+long Buffsize = CHAR_BUFFER_SIZE; /**< File input buffer, increase value for larger genomes. opt -b can be used to change this value */
+
+
+/* Option flags and option arguments */
+char *cvalue = NULL; /**< Option argument string specifying character mask, should change to w */
+char *fvalue = NULL; /**< Option argument file name specifying a file of containing features */
+bool zflag = false; /**< Create a random character mask, -z */
+int zflagN = 0; /**< Option argument to -z */
+bool sflag = false; /**< Specify a random seed, -s */
+int sflagN = 0; /**< Option argument to -s */
+bool qflag = false; /**< Use quiet option */
+bool wflag = false; /**< Use a character mask, -w */
+bool fflag = false; /**< Use a list of features specified in a file, -f */
+bool dflag = false; /**< Disable RY coding, -d */
+bool mflag = false; /**< Multiple sequences in one file, -m */
+bool rflag = true; /**< Do reverse complement */
+
+
+char usage_str[] = "Usage: %s [OPTIONS]... [FILE]... \n\
+This program generates an FFP vector of RY-coded features\n\n\
+Given no options the default behavior of the program is to\n\
+generate a Feature Frequency Profile (FFP) using features of length\n\
+10.\n\
+\t-l LEN, --length=LEN\n\
+\t-f FILE, --feature-list=FILE\n\
+\t-w STR, --mask=STR\n\
+\t-z K, --random-mask=K\n\
+\t-s INT, --rand-seed=INT\n\
+\t-q, --quiet\n\
+\t-d, --disable\n\
+\t-r, --disable-rev\n\
+\t-m, --multiple\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+
+int main(int argc, char **argv)
+{
+ int opt;
+ FILE *fp;
+ HASH h;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"length", required_argument, 0, 'l'},
+ {"mask", required_argument, 0, 'w'},
+ {"disable", no_argument, 0, 'd'},
+ {"random-mask", required_argument, 0, 'z'},
+ {"quiet", no_argument, 0, 'q'},
+ {"random-seed", required_argument, 0, 's'},
+ {"help", no_argument, 0, 'h'},
+ {"feature-list", required_argument, 0, 'f'},
+ {"multiple", no_argument, 0, 'm'},
+ {"disable-rev", no_argument, 0, 'r'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "l:dw:z:s:qf:hmvr",
+ long_options, &option_index)) != -1)
+ switch (opt) {
+ case 'l':
+ Length = atoi(optarg);
+ break;
+ case 'w':
+ if ((weightVector = (char *) malloc(sizeof(char) * strlen(optarg)))==NULL)
+ fatal_at_line("%s\n",strerror(errno));
+ strcpy(weightVector, optarg);
+ wflag = !wflag;
+ break;
+ case 'z':
+ zflag = !zflag;
+ zflagN = atoi(optarg);
+ break;
+ case 's':
+ sflag = !sflag;
+ sflagN = atoi(optarg);
+ break;
+ case 'q':
+ qflag = !qflag;
+ break;
+ case 'd':
+ dflag = !dflag;
+ break;
+ case 'm':
+ mflag = !mflag;
+ break;
+ case 'f':
+ fflag = !fflag;
+ fvalue = optarg;
+ break;
+ case 'r':
+ rflag = !rflag;
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ exit(EXIT_FAILURE);
+ break;
+ }
+
+ if ( getenv("MAX_WORD_SIZE") )
+ maxWordSize=atoi(getenv("MAX_WORD_SIZE"));
+
+ if (Length > maxWordSize)
+ fatal_msg("%d: Max Word size is: %d",Length,maxWordSize);
+
+ if (sflag)
+ srand((unsigned) sflagN);
+ else
+ srand((unsigned) time(NULL) * getpid());
+
+
+ if (wflag) {
+ if (strlen(weightVector) != Length)
+ fatal_msg("length of mask not equal to feature length.\n");
+ if (!qflag)
+ warn_msg("Using feature mask: %s\n", weightVector);
+ }
+
+
+
+ if (zflag) {
+ while (zflagN > Length - 1)
+ zflagN--;
+ if ((weightVector = (char *) malloc(sizeof(char) * (Length + 1))) == NULL)
+ fatal_at_line("%s\n",strerror(errno));
+ randweight(weightVector, Length, zflagN);
+ if (!qflag)
+ warn_msg("Using feature mask: %s\n", weightVector);
+
+ }
+
+ //Initialize a hash
+ init(&h, (zflag || wflag), nucleotide, !dflag, rflag, Length);
+
+ //Fill with keys if restricting to a feature list
+ if (fflag)
+ parseFeatureList(&h,fvalue,Length,nucleotide);
+
+ // Must now process file arguments
+
+
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s\n", *argv, strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ parseFile(&h, fp);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ }
+ while (*argv);
+
+ //freeHash(&h);
+
+ return EXIT_SUCCESS;
+}
+
+
+/**
+ *
+ * Parses FASTA format FNA file
+ *
+ * This function can read from stdin or from fasta files.
+ * The hash h, is populated with features differently
+ * if there is a feature list passed via the -f option.
+ *
+ *
+ * @param h The hash table to use.
+ * @param fp A file pointer to the nucleotide fasta file to parse.
+ * @return none
+ *
+ */
+
+
+static void parseFile(HASH * h, FILE * fp)
+{
+ if (fflag)
+ loopFeatureList(h, fp);
+ else
+ loopRaw(h, fp);
+
+}
+
+
+/**
+ *
+ * Populates a hash with feature counts from a Nucleotide fasta FILE
+ * ptr restricting the search to features defined in the feature list
+ *
+ * This function can read from fp which points to stdin or a fasta file.
+ * Function behaves differently if a spaced seed (or mask) is defined with
+ * -z or -w.
+ *
+ *
+ * @param h The hash table to use.
+ * @param fp A file pointer to the nucleotide fasta file to parse.
+ * @return none
+ *
+ */
+
+static void loopFeatureList(HASH * h, FILE * fp)
+{
+ struct stat fattr;
+ size_t optimal_size;
+ ssize_t nr;
+ char *buf;
+ bool firstRecord=true;
+
+ //Determine optimal buffer size for file
+ if (fstat(fileno(fp), &fattr))
+ fatal_msg("fd %s: File stat error.\n",fileno(fp));
+
+ //Find optimal size for Disk IO
+ optimal_size = (fattr.st_blksize >= BUFSIZ) ? fattr.st_blksize : BUFSIZ;
+
+ if ((buf = (char *) malloc(optimal_size))==NULL)
+ fatal_at_line("%s\n",strerror(errno));
+
+ // replace w/ function pointers
+ while ((nr = fread(buf, sizeof(char), optimal_size, fp)) != -1 && nr != 0) {
+
+ if (zflag || wflag)
+ chkpushatgcw(h, buf, nr,firstRecord);
+ else
+ chkpushatgc(h, buf, nr,firstRecord);
+
+ firstRecord=false;
+ }
+ printFeatures(h);
+ free(buf);
+ freeHash(h);
+}
+
+
+/**
+ *
+ * Populates a hash with feature counts from a Nucleotide fasta FILE
+ * ptr.
+ *
+ * This function can read from fp which points to stdin or a fasta file.
+ * Function behaves differently if a spaced seed (or mask) is defined with
+ * -z or -w.
+ *
+ * @param h The hash table to use.
+ * @param fp A file pointer to the nucleotide fasta file to parse.
+ * @return none
+ *
+ */
+
+static void loopRaw(HASH * h, FILE * fp)
+{
+ struct stat fattr;
+ size_t optimal_size;
+ ssize_t nr;
+ char *buf;
+ bool firstRecord=true;
+
+
+ //Determine optimal buffer size for file
+ if (fstat(fileno(fp), &fattr))
+ fatal_msg("fd %s : File stat error.\n",fileno(fp));
+
+ //Find optimal size for Disk IO
+ optimal_size = (fattr.st_blksize >= BUFSIZ) ? fattr.st_blksize : BUFSIZ;
+
+ if ((buf = (char *) malloc(optimal_size))==NULL)
+ fatal_at_line("%s\n",strerror(errno));
+
+ // replace w/ function pointers
+ while ((nr = fread(buf, sizeof(char), optimal_size, fp)) != -1 && nr != 0) {
+
+ if (zflag || wflag)
+ pushatgcw(h, buf, nr,firstRecord);
+ else
+ pushatgc(h, buf, nr,firstRecord);
+
+ firstRecord=false;
+
+ }
+
+
+ printFeatures(h);
+ free(buf);
+ freeHash(h);
+}
+
+
diff --git a/src/ffpry.h b/src/ffpry.h
new file mode 100644
index 0000000..a7256ba
--- /dev/null
+++ b/src/ffpry.h
@@ -0,0 +1,24 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+/* _FFPRY_H_ */
+#ifndef _FFPRY_H_
+#define _FFPRY_H_
+
+void hashFill(int len);
+void hashFillry(int len);
+
+#endif /* _FFPRY_H_ */
diff --git a/src/ffptree.c b/src/ffptree.c
new file mode 100644
index 0000000..c366c74
--- /dev/null
+++ b/src/ffptree.c
@@ -0,0 +1,1212 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+
+#include <stdio.h>
+#include <time.h>
+#include <stdlib.h>
+#include <float.h>
+#include <stdbool.h>
+#include <getopt.h>
+#include <string.h>
+#include <math.h>
+#include <unistd.h>
+#include <limits.h>
+#include <regex.h>
+#include <errno.h>
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "../config.h"
+
+#define FNMLNGTH 200 /* length of array to store a file name */
+#define NMLNGTH 10 /* number of characters in species name */
+#define MAXNCH 20 /* must be greater than or equal to NMLNGTH */
+#define MAX_COL_NEWICK 55 /* Maximum characters output per line in outtree */
+ /* The last line seems to ignore this limit */
+#define SMALL_TREE_TH 10 /* Threshold for drawing tree with -- vs - or " " vs " " */
+#define MAX_COL_TREE 55 /* Maximum number of chracters per line for screen */
+#define TREE_SCALE 0.43429448222 // Float width for Newick tree
+#define NON_ZERO 0.000000001 /* Maximum allowable difference between upper and
+ lower triangle to allow for matrix symmetricity */
+#define DOWN 2 /* For drawing trees: vertical distance between branches */
+#define OVER 60 /* maximum width all branches of tree on screen */
+#define LEFT_MARGIN 0.5 /* Margin for setting */
+#define SHORT_DASH "-"
+#define LONG_DASH "--"
+#define SHORT_SPACE " "
+#define LONG_SPACE " "
+
+
+typedef double * DBLVECTOR; // Move to a .h file
+typedef int * INTVECTOR;
+
+/* NODE data structure */
+
+typedef struct node {
+ struct node *next, *back;
+ int index;
+ double xcoord, ycoord;
+ int ymin, ymax; /* used by printree() */
+ double v;
+ bool tip;
+} NODE;
+
+typedef NODE **pointarray;
+
+/* TREE data structure */
+
+typedef struct tree {
+
+ /* An array of pointers to nodes. Each tip node and ring of nodes has a
+ * unique index starting from one. The nodep array contains pointers to each
+ * one, starting from 0. In the case of internal nodes, the entries in nodep
+ * point to the rootward node in the group. Since the trees are otherwise
+ * entirely symmetrical, except at the root, this is the only way to resolve
+ * parent, child, and sibling relationships.
+ *
+ * Indices in range [0, txn) point to tips, while indices [txn, nonodes)
+ * point to internal nodes
+ */
+ NODE ** nodep;
+ NODE * root; // For rooted trees. Points to internal node w/o back ptr.
+ NODE * start; // For unrooted trees. Points to outgroup node.
+
+} TREE;
+
+
+
+
+/* function prototypes */
+void allocrest(void);
+void doinit(void);
+void getinput(void);
+void describe(NODE *, double);
+void summarize(void);
+void jointree(void);
+void maketree(void);
+void freerest(void);
+int readNumTaxa( void );
+NODE ** allocTree(int nonodes);
+void chkTxnNumEq(int ith);
+void setupTree(TREE *a, int nonodes);
+void freetree(NODE **treenode, int nonodes);
+void connect(NODE *p, NODE *q);
+void inputdata(bool, bool, bool,bool, DBLVECTOR *, INTVECTOR *);
+void printree(NODE *);
+void treeout(NODE *, int *, NODE *);
+void treeoutr(NODE *, int *, TREE *);
+void readName(int );
+double randum(INTVECTOR);
+void coordinates(NODE *, double, int *, double *,NODE *);
+void drawline(int i, double scale, NODE *start);
+ssize_t getline(char **lineptr, size_t *n, FILE *stream);
+void shuffle(int * a,int n);
+
+char PROG_NAME[FILENAME_MAX];
+
+
+
+char usage_str[] = "Usage: %s [OPTIONS]... [FILE]... \n\
+This program generates trees in NEWICK format using either the\n\
+neighbor joining or UPGMA methods. Given no options the default\n\
+behavior is to generate a neighbor joining tree.\n\n\
+\t-n, --upgma\t\tBuild a UPGMA tree.\n\
+\t-j[N], --jumble=[N]\tJumble input order. Optional seed, N\n\
+\t-m[N], --multiple=[N]\tUse up to N sets in input. Optional arg, N\n\
+\t-l, --lower\t\tUse lower input matrix triangle.\n\
+\t-l, --upper\t\tUse upper input matrix triangle. [Non functional]\n\
+\t-t, --print-tree\tDisable human readable tree (stderr)\n\
+\t-p, --progress\t\tDisable tree-build progress (stderr)\n\
+\t-d, --print-data\tEnable input summary (stderr)\n\
+\t-y, --symmetrize\tSymmetrize assymetric distance matrix\n\
+\t-o I, --outgroup=I\tSet outgroup. Required species num, I\n\
+\t-O FILE, --out=FILE\tWrite newick tree to file. (stdout).\n\
+\t-P FILE, --out-prg=FILE\tRedirect stderr to file. (stderr).\n\
+\t-w W, --precision=W\tSpecify float precision in tree [W=8].\n\
+\t-q, --quiet\t\tSuppress output to stderr\n\
+\t-h, --help\t\tThis message.\n\
+\t-v, --version\t\tVersion Info.\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+bool njoin = true; //Option -n
+bool jumble = false; //Option -j
+unsigned seed=1;
+int outgrno = 0; //Option -o Arg
+bool outgropt = false; //Option -o
+bool lower = false; //Option -l
+bool replicates = false; //Option -s
+bool symmetrize = false; //option -y
+bool trout = true; //Option -w
+bool upper = false; //option -u
+bool treeprint = true; //option -t
+bool progress = true; //option -p
+bool printdata = false; //option -d
+bool mulsets = false; //Option -m
+int datasets = INT_MAX; //Option -m Arg
+bool quiet = false;
+int precision = 8; //Option -w arg
+
+
+FILE * infile;
+FILE * outfile;
+FILE * outtree;
+int txn; // Number of taxa
+char * buffer=NULL;
+
+/**@todo eliminate some of these globals or at least package them
+ * in a passable structure */
+
+char infilename[FNMLNGTH], outfilename[FNMLNGTH], outtreename[FNMLNGTH];
+int numnodes, col, datasets, ith;
+DBLVECTOR *x;
+INTVECTOR *reps;
+TREE curtree;
+int *taxaorder;
+char ** name; /* taxa names */
+
+NODE **cluster; //used in maketree
+
+
+int main(int argc, char *argv[])
+{ /* main program */
+ int opt;
+ int option_index = 0;
+ // FILE * infile;
+
+ static struct option long_options[] = {
+ {"multiple", optional_argument, 0, 'm'},
+ {"upgma", no_argument, 0, 'n'},
+ {"jumble", optional_argument, 0, 'j'},
+ {"outgroup", required_argument, 0, 'o'},
+ {"lower", no_argument, 0, 'l'},
+ {"upper", no_argument, 0, 'u'},
+ {"print-tree", no_argument, 0, 't'},
+ {"progress", no_argument, 0, 'p'},
+ {"print-data", no_argument, 0, 'd'},
+ {"symmetrize", no_argument, 0, 'y'},
+ {"out", required_argument, 0, 'O'},
+ {"out-prg", required_argument, 0, 'P'},
+ {"precision", required_argument, 0, 'w'},
+ {"quiet", no_argument, 0, 'q'},
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ outfile=stderr;
+ outtree=stdout;
+ strcpy(outfilename,"stderr");
+ strcpy(outtreename,"stdout");
+ // add option for user readable tree.
+
+ while ((opt = getopt_long(argc, argv, "m::nj::o:lutpdi:O:P:qhvw:y",
+ long_options, &option_index)) != -1)
+ switch (opt) {
+ case 'm':
+ if (optarg)
+ datasets=atoi(optarg);
+ break;
+ case 'n':
+ njoin=!njoin; // Toggle
+ break;
+ case 'o':
+ outgropt=!outgropt;
+ outgrno=atoi(optarg)-1;
+ break;
+ case 'j':
+ jumble=!jumble;
+ if (optarg)
+ seed=(unsigned)atoi(optarg);
+ else
+ seed=(unsigned)time(NULL) * getpid();
+ break;
+ case 'l':
+ lower=!lower;
+ break;
+ case 'u':
+ upper=!upper;
+ break;
+ case 't':
+ treeprint=!treeprint;
+ break;
+ //case 'w': // could change to O
+ // trout=!trout;
+ // break;
+ case 'd':
+ printdata=!printdata;
+ break;
+ case 'p':
+ progress=!progress;
+ break;
+ case 'q':
+ progress=!progress;
+ treeprint=!treeprint;
+ break;
+ case 'O':
+ strcpy(outtreename,optarg);
+ if ((outtree=fopen(optarg,"w")) == NULL)
+ fatal_msg("%s: Failed to open.",optarg);
+ break;
+ case 'P':
+ strcpy(outfilename,optarg);
+ if ((outfile=fopen(optarg,"w")) == NULL)
+ fatal_msg("%s: Failed to open.",optarg);
+ break;
+ case 'y':
+ symmetrize=!symmetrize;
+ break;
+ case 'w':
+ precision=atoi(optarg);
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ exit(EXIT_FAILURE);
+ break;
+ }
+
+ if (outgrno < 0 ) //must check again to make sure less than txn
+ fatal_msg("%ld: Outgroup number must be at least 1\n",outgrno);
+
+
+ if (mulsets && datasets < 2)
+ fatal_msg("%ld: Number of sets must be greater than 1\n",datasets);
+
+ if (jumble)
+ srand(seed);
+
+
+ argv+=optind;
+
+
+ do {
+ infile = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ infile = stdin;
+ else if ((infile = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s.\n", *argv,strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ doinit(); // This allocates memory for the tree.
+
+ ith = 1;
+ do {
+ if (progress && mulsets )
+ fprintf(outfile,"Data set # %d:\n",ith);
+ if (ith != 1)
+ chkTxnNumEq(ith); // Confirm # of taxa is the same as txn
+ maketree();
+ ith++;
+ ungetc(fgetc(infile),infile);
+ } while ( !feof(infile) && ith <= datasets );
+ freerest();
+ freetree(curtree.nodep, numnodes+1);
+
+
+
+ if (infile != stdin)
+ fclose(infile);
+
+ }
+ while (*argv);
+
+
+ free(buffer);
+
+ fclose(outfile);
+ fclose(outtree);
+ return EXIT_SUCCESS;
+}
+
+
+
+void allocrest()
+{
+ int i;
+
+ x = (DBLVECTOR *)chkcalloc(sizeof(DBLVECTOR),txn);
+ reps = (INTVECTOR *)chkcalloc(sizeof(INTVECTOR),txn);
+ name = (char **)chkcalloc(sizeof(char*),txn);
+ for (i = 0; i < txn; i++) {
+ x[i] = (DBLVECTOR)chkcalloc(sizeof(double),txn);
+ reps[i] = (INTVECTOR)chkcalloc(sizeof(int),txn);
+ name[i]=(char *)chkcalloc(sizeof(char),MAXNCH);
+ }
+
+ taxaorder = (int *)chkcalloc(sizeof(int),txn);
+ cluster = (NODE **)chkcalloc(sizeof(NODE *),txn);
+}
+
+
+void freerest()
+{
+ int i;
+
+ for (i = 0; i < txn; i++) {
+ free(x[i]);
+ free(reps[i]);
+ }
+
+ free(x);
+ free(reps);
+ free(name);
+ free(taxaorder);
+ free(cluster);
+}
+
+
+void doinit()
+{
+ /* initializes variables */
+ //NODE *p;
+ txn=readNumTaxa();
+ if (progress)
+ fprintf(outfile, "%d Taxa\n", txn);
+ numnodes = 2 * txn - 2; // number of nodes in an unrooted bifurcating tree is always 2n-2
+ numnodes += (njoin ? 0 : 1); // Add 1 node (for root) if the upgma method
+ curtree.nodep = allocTree(numnodes+1);
+ //This code is unnecessary. It is deallocating memory which just got allocated.
+ //Why not just not allocate in the first place.
+ //This makes no sense....
+ //create a circular connected list
+ //p = curtree.nodep[numnodes]->next; // Assign p the address pointed to by the Nth element next potr
+ // curtree.nodep[numnodes]->next = curtree.nodep[numnodes]; //Make the Nth element point to itself
+ // free(p->next); // Free curtree.nodep[numnodes]->next->next
+ // free(p); // Free curtree.nodep[numnodes]->next
+ allocrest();
+
+}
+
+
+//nice use of recursion.
+
+/* print out information for one branch */
+void describe(NODE *p, double height)
+{
+ NODE *q;
+
+ q = p->back;
+ if (njoin)
+ fprintf(outfile, "%d\t", q->index - txn);
+ else
+ fprintf(outfile, "%d\t", q->index - txn);
+ if (p->tip) {
+ fprintf(outfile,"%10s\t",name[p->index]);
+ } else {
+ fprintf(outfile, "%10d\t", p->index - txn);
+ }
+ if (njoin)
+ fprintf(outfile, "%.4e\n", q->v);
+ else
+ fprintf(outfile, "%6.4e\t%6.4e\n", q->v, q->v+height);
+ if (!p->tip) {
+ describe(p->next->back, height+q->v);
+ describe(p->next->next->back, height+q->v);
+ }
+}
+
+
+/* print out branch lengths etc. */
+void summarize()
+{
+ putc('\n', outfile);
+ if (njoin) {
+ if (outgropt)
+ fprintf(outfile, "Rearranged with outgroup at root.\n");
+ fprintf(outfile, "Neighbor joining is an unrooted method.\n");
+ }
+
+ fprintf(outfile, "\n\tNodes\n");
+ fprintf(outfile, "------------------\n");
+ if (njoin) {
+ fprintf(outfile, "i\t\t j\tLength\n");
+ fprintf(outfile, "-----------------------------------\n");
+ } else {
+ fprintf(outfile, "i\t\tj\tLength\t\tRoot_Length\n");
+ fprintf(outfile, "--------------------------------------------------\n");
+ }
+ describe(curtree.start->next->back, 0.0);
+ describe(curtree.start->next->next->back, 0.0);
+ if (njoin)
+ describe(curtree.start->back, 0.0);
+ fprintf(outfile, "\n\n");
+} /* summarize */
+
+
+
+#define printNodeLabel(a) fputc( (a) ? 'N':'T',outfile)
+
+ /* calculate the tree */
+void jointree()
+{
+ int c, nextnode, mini=0, minj=0, i, j, ia, ja, ii, jj, nude, cycles;
+ double otu, q, qmin, dio, djo, bi, bj, bk, dmin=0, da;
+ int el[3];
+ DBLVECTOR av;
+ INTVECTOR oc;
+
+ double *R;
+ R = (double *)chkmalloc(sizeof(double),txn);
+
+ if (symmetrize)
+ for (i = 0; i < txn - 1; i++)
+ for (j = i + 1; j < txn; j++) {
+ da = (x[i][j] + x[j][i]) / 2.0;
+ x[i][j] = da;
+ x[j][i] = da;
+ }
+
+ if (progress) {
+ fprintf(outfile,"Cycle\tType\ti\tLength\t Type\tj\tLength\n");
+ } fprintf(outfile,"----------------------------------------------------------------\n");
+
+ // First initialization
+ otu = txn - 2.0;
+ nextnode = txn;
+ av = (DBLVECTOR)chkmalloc(sizeof(double),txn);
+ oc = (INTVECTOR)chkmalloc(sizeof(int),txn);
+
+ for (i = 0; i < txn; i++) {
+ av[i] = 0.0;
+ oc[i] = 1;
+ }
+
+ // Enter the main cycle
+ if (njoin)
+ cycles = txn - 3;
+ else
+ cycles = txn - 1;
+ for (c = 0; c < cycles; c++) {
+ for (j = 1; j < txn; j++) {
+ for (i = 0; i < j; i++)
+ x[j][i] = x[i][j];
+ }
+ qmin = DBL_MAX;
+
+ // Compute Row sum of observable taxonomic units (otu)
+ // If group has been joined use the aggregate cluster.
+
+ if (njoin) {
+ for (i = 0; i < txn; i++)
+ R[i] = 0.0;
+
+ for (ja = 0; ja < txn; ja++) {
+ jj = taxaorder[ja];
+ if (cluster[jj] != NULL)
+ for (ia = 0; ia < ja; ia++) {
+ ii = taxaorder[ia];
+ if (cluster[ii] != NULL) {
+ R[ii] += x[ii][jj];
+ R[jj] += x[ii][jj];
+ }
+ }
+ }
+ }
+
+ // Compute Q matrix
+ for (ja = 0; ja < txn; ja++) {
+ jj = taxaorder[ja];
+ if (cluster[jj] != NULL) {
+ for (ia = 0; ia < ja; ia++) {
+ ii = taxaorder[ia];
+ if (cluster[ii] != NULL) {
+ if (njoin) {
+ q = otu * x[ii][jj] - R[ii] - R[jj];
+ } else
+ q = x[ii][jj];
+ if (q < qmin) {
+ qmin = q;
+ mini = ii;
+ minj = jj;
+ }
+ }
+ }
+ }
+ }
+
+ // compute lengths and print
+ if (njoin) {
+ dio = 0.0;
+ djo = 0.0;
+ for (i = 0; i < txn; i++) {
+ dio += x[i][mini];
+ djo += x[i][minj];
+ }
+ dmin = x[mini][minj];
+ dio = (dio - dmin) / otu;
+ djo = (djo - dmin) / otu;
+ bi = (dmin + dio - djo) * 0.5;
+ bj = dmin - bi;
+ bi -= av[mini];
+ bj -= av[minj];
+ } else {
+ bi = x[mini][minj] / 2.0 - av[mini];
+ bj = x[mini][minj] / 2.0 - av[minj];
+ av[mini] += bi;
+ }
+ if (progress) {
+ fprintf(outfile,"%d\t", cycles - c );
+ if (njoin)
+ printNodeLabel(av[mini] > 0.0 );
+ else
+ printNodeLabel(oc[mini] > 1.0);
+ fprintf(outfile,"\t%d\t%.2e\t", mini+1, bi);
+ if (njoin)
+ printNodeLabel(av[minj] > 0.0);
+ else
+ printNodeLabel(oc[minj] > 1.0);
+ fprintf(outfile,"\t%d\t%.2e\n", minj+1, bj);
+ }
+ connect(curtree.nodep[nextnode]->next, cluster[mini]);
+ connect(curtree.nodep[nextnode]->next->next, cluster[minj]);
+ cluster[mini]->v = bi;
+ cluster[minj]->v = bj;
+ cluster[mini]->back->v = bi;
+ cluster[minj]->back->v = bj;
+ cluster[mini] = curtree.nodep[nextnode];
+ cluster[minj] = NULL;
+ nextnode++;
+ if (njoin)
+ av[mini] = dmin * 0.5;
+
+ // re-initialization
+ otu -= 1.0;
+ for (j = 0; j < txn; j++) {
+ if (cluster[j] != NULL) {
+ if (njoin) {
+ da = (x[mini][j] + x[minj][j]) * 0.5;
+ if (mini - j < 0)
+ x[mini][j] = da;
+ if (mini - j > 0)
+ x[j][mini] = da;
+ } else {
+ da = x[mini][j] * oc[mini] + x[minj][j] * oc[minj];
+ da /= oc[mini] + oc[minj];
+ x[mini][j] = da;
+ x[j][mini] = da;
+ }
+ }
+ }
+ for (j = 0; j < txn; j++) {
+ x[minj][j] = 0.0;
+ x[j][minj] = 0.0;
+ }
+ oc[mini] += oc[minj];
+ }
+ // Final cycle
+ nude = 0;
+ for (i = 0; i < txn; i++) {
+ if (cluster[i] != NULL) {
+ el[nude] = i;
+ nude++;
+ }
+ }
+ if (!njoin) {
+ curtree.start = cluster[el[0]];
+ curtree.start->back = NULL;
+ free(av);
+ free(oc);
+ return;
+ }
+ bi = (x[el[0]][el[1]] + x[el[0]][el[2]] - x[el[1]]
+ [el[2]]) * 0.5;
+ bj = x[el[0]][el[1]] - bi;
+ bk = x[el[0]][el[2]] - bi;
+ bi -= av[el[0]];
+ bj -= av[el[1]];
+ bk -= av[el[2]];
+ if (progress) {
+ fprintf(outfile,"0\t");
+ printNodeLabel(av[el[0]] > 0.0);
+ fprintf(outfile,"\t%d\t%.2e\t", el[0]+1, bi);
+ printNodeLabel(av[el[1]] > 0.0);
+ fprintf(outfile,"\t%d\t%.2e\t", el[1]+1, bj);
+ printNodeLabel(av[el[2]] > 0.0);
+ fprintf(outfile,"\t%d\t%.2e\n", el[2]+1, bk);
+ }
+ connect(curtree.nodep[nextnode], cluster[el[0]]);
+ connect(curtree.nodep[nextnode]->next, cluster[el[1]]);
+ connect(curtree.nodep[nextnode]->next->next, cluster[el[2]]);
+ cluster[el[0]]->v = bi;
+ cluster[el[1]]->v = bj;
+ cluster[el[2]]->v = bk;
+ cluster[el[0]]->back->v = bi;
+ cluster[el[1]]->back->v = bj;
+ cluster[el[2]]->back->v = bk;
+ curtree.start = cluster[el[0]]->back;
+ free(av);
+ free(oc);
+ free(R);
+}
+
+
+
+
+ /* Build the tree */
+void maketree()
+{
+ int i;
+
+ inputdata(replicates, printdata, lower, upper, x, reps);
+ if (njoin && (txn < 3))
+ fatal_msg("\nMust have at least 3 taxa.\n");
+
+ if (progress)
+ fprintf(outfile,"\n");
+
+ if (ith == 1)
+ setupTree(&curtree, numnodes + 1);
+
+ for (i = 0; i < txn; i++)
+ taxaorder[i] = i;
+
+ if (jumble)
+ shuffle(taxaorder,txn);
+
+ for (i = 0; i < txn; i++)
+ cluster[i] = curtree.nodep[i];
+ jointree();
+ if (njoin)
+ curtree.start = curtree.nodep[outgrno]->back;
+ if (treeprint)
+ printree(curtree.start);
+ if (treeprint)
+ summarize();
+ if (trout) {
+ col = 0;
+ if (njoin)
+ treeout(curtree.start, &col, curtree.start);
+ else
+ curtree.root = curtree.start,
+ treeoutr(curtree.start,&col,&curtree);
+ }
+}
+
+
+int readNumTaxa( void )
+{
+ int numTaxa;
+ char newline[2];
+ /* read species number */
+ if (fscanf(infile, "%d%[\n\r]", &numTaxa,newline) != 2 || numTaxa <= 0)
+ fatal_msg("Can not read the number of species in input\n");
+ return numTaxa;
+}
+
+
+
+
+/* Allocate taxa nodes and internal nodes
+* treenode is an array of pointers to nodes
+* Taxa nodes are stored from 0 to txn-1 and
+* internal nodes stored from txn to nonodes-1
+*
+* structure looks like this:
+*
+* [0] -> Node
+* [1]
+*
+* Each pointer points to a connected list of three
+* nodes.
+*/
+
+
+
+NODE ** allocTree(int n)
+{
+ NODE ** treenode;
+ int i, j;
+ NODE *p, *q;
+
+ treenode = (NODE **)chkmalloc(sizeof(NODE *),n);
+ for (i = 0; i < txn; i++)
+ treenode[i] = (NODE *)chkmalloc(sizeof(NODE),1);
+
+ // For each internal tree node create a circular
+ // connected list or 'ring' of three nodes.
+ for (i = txn; i < n; i++) {
+ q = NULL;
+ for (j = 0; j < 3; j++) {
+ p = (NODE *)chkmalloc(sizeof(NODE),1);
+ p->next = q;
+ q = p;
+ }
+ p->next->next->next = p;
+ treenode[i] = p;
+ }
+return treenode;
+}
+
+
+
+void chkTxnNumEq(int ith)
+{
+ /* check if txn is same as the first set in other data sets */
+ int curtxn;
+ char c[3];
+
+ if (fscanf(infile, "%d%[\n]", &curtxn,c) != 2)
+ fatal_msg("Set: %d: Unable to read taxa number.\n",ith);
+ if (curtxn != txn)
+ fatal_msg("Set: %d: Inconsist taxa number.\n",ith);
+}
+
+/* initialize a tree */
+void setupTree(TREE *a, int n)
+{
+ int i=0;
+ NODE *p;
+
+ for (i = 0; i < n; i++) {
+ a->nodep[i]->back = NULL;
+ a->nodep[i]->tip = (i < txn);
+ a->nodep[i]->index = i;
+ a->nodep[i]->v = 0.0;
+ if (i >= txn) {
+ p = a->nodep[i]->next;
+ while (p != a->nodep[i]) {
+ p->back = NULL;
+ p->tip = false;
+ p->index = i;
+ p = p->next;
+ }
+ }
+ }
+ a->start = a->nodep[0];
+ a->root = NULL;
+}
+
+void freetree(NODE **treenode, int n)
+{
+ int i;
+ NODE *p, *q;
+
+ for (i = 0; i < txn; i++)
+ free(treenode[i]);
+ for (i = txn; i < n; i++) {
+ p = treenode[i];
+ q = p->next;
+ while(q != p) {
+ NODE * r = q;
+ q = q->next;
+ free(r);
+ }
+ free(p);
+ }
+ free(treenode);
+}
+
+
+ /* connect two nodes */
+void connect(NODE *p, NODE *q)
+{
+ p->back = q;
+ q->back = p;
+}
+
+
+
+ /* read in distance matrix */
+
+void inputdata(bool replicates, bool printdata, bool lower,
+ bool upper, DBLVECTOR *x, INTVECTOR *reps)
+{
+ int i=0, j=0, k=0, columns=0;
+ bool skipit=false, skipother=false;
+ char c[3];
+
+ if (replicates)
+ columns = 4;
+ else
+ columns = 6;
+ if (printdata) {
+ fprintf(outfile, "\nName Distances");
+ if (replicates)
+ fprintf(outfile, " (replicates)");
+ fprintf(outfile, "\n---- ---------");
+ if (replicates)
+ fprintf(outfile, "-------------");
+ fprintf(outfile, "\n\n");
+ }
+ for (i = 0; i < txn; i++) {
+ x[i][i] = 0.0;
+ readName(i);
+ for (j = 0; j < txn; j++) {
+ skipit = ((lower && j + 1 >= i + 1) || (upper && j + 1 <= i + 1));
+ skipother = ((lower && i + 1 >= j + 1) || (upper && i + 1 <= j + 1));
+ if (!skipit) {
+ if (fscanf(infile, "%lf%*[ ]%[\n]", &x[i][j],c) < 1)
+ fatal_msg("The infile is of the wrong type\n");
+ if (replicates) { // decide how replicates are handled.
+ if (fscanf(infile, "%d", &reps[i][j]) != 1)
+ fatal_msg("The infile is of the wrong type\n");
+ } else
+ reps[i][j] = 1;
+ }
+ if (!skipit && skipother) {
+ x[j][i] = x[i][j];
+ reps[j][i] = reps[i][j];
+ }
+ if ((i == j) && (fabs(x[i][j]) > NON_ZERO))
+ fatal_msg("Diagonal of row %d from input matrix is not zero.", i+1);
+
+ if (!symmetrize)
+ if ((j < i) && (fabs(x[i][j]-x[j][i]) > NON_ZERO))
+ fatal_msg("Matrix is assymetric: (%d,%d) not equal to (%d,%d).\n",
+ i+1, j+1, j+1, i+1);
+ }
+ }
+ if (!printdata)
+ return;
+ for (i = 0; i < txn; i++) {
+ for (j = 0; j < NMLNGTH; j++)
+ putc(name[i][j], outfile);
+ putc(' ', outfile);
+ for (j = 0; j < txn; j++) {
+ fprintf(outfile, "%10.5f", x[i][j]);
+ if (replicates)
+ fprintf(outfile, " (%3d)", reps[i][j]);
+ if (j % columns == 0 && j < txn) {
+ putc('\n', outfile);
+ for (k = 0; k < NMLNGTH + 1; k++)
+ putc(' ', outfile);
+ }
+ }
+ putc('\n', outfile);
+ }
+ putc('\n', outfile);
+}
+
+
+/***********************************
+*
+* shuffle()
+* Performs a Fischer-Yates shuffle
+* Durstenfeld, Richard (July 1964).
+* Algorithm 235: Random permutation.
+* Communications of the ACM 7, 420.
+*
+*************************************/
+
+void shuffle(int * a,int n) {
+ int k,tmp;
+ while (n > 1) {
+ n--;
+ k = rand() % n;
+ tmp=a[k];
+ a[k]=a[n];
+ a[n]=tmp;
+ }
+}
+
+
+
+
+ /* prints out diagram of the tree */
+void printree(NODE *start)
+{
+ int i,tipy;
+ double scale,tipmax;
+
+ putc('\n', outfile);
+ tipy = 1;
+ tipmax = 0.0;
+ coordinates(start, 0.0, &tipy, &tipmax, start);
+ scale = 1.0 / (int)(tipmax + 1.0);
+ for (i = 0; i <= (tipy - DOWN); i++)
+ drawline(i, scale, start );
+ putc('\n', outfile);
+}
+
+
+
+/*UPGMA write out file with representation of final tree. */
+
+void treeoutr(NODE *p, int *col, TREE *curtree)
+{
+ char * cptr;
+
+
+ if (p->tip) {
+ //replace spaces in name with underscores.
+ while ((cptr=strchr(name[p->index],' ')) != NULL )
+ *cptr='_';
+
+ fprintf(outtree,"%s",name[p->index]);
+
+ (*col) += strlen(name[p->index]);
+ } else {
+ putc('(', outtree);
+ (*col)++;
+ treeoutr(p->next->back,col,curtree);
+ putc(',', outtree);
+ (*col)++;
+ if ((*col) > MAX_COL_TREE ) {
+ putc('\n', outtree);
+ (*col) = 0;
+ }
+ treeoutr(p->next->next->back,col,curtree);
+ putc(')', outtree);
+ (*col)++;
+ }
+ if (p == curtree->root)
+ fprintf(outtree, ";\n");
+ else {
+ fprintf(outtree, ":%.*e", precision,p->v);
+ *col += precision+5;
+ }
+}
+
+
+/*Neighbor joining: write out rerpesentation of tree */
+void treeout(NODE *p, int *col, NODE *start)
+{
+ char * cptr;
+
+ if (p->tip) {
+ //replace spaces in name with underscores.
+ while ((cptr=strchr(name[p->index],' ')) != NULL )
+ *cptr='_';
+ fprintf(outtree,"%s",name[p->index]);
+
+ *col += strlen(name[p->index]);
+ } else {
+ putc('(', outtree);
+ (*col)++;
+ treeout(p->next->back, col, start);
+ putc(',', outtree);
+ (*col)++;
+ if (*col > MAX_COL_NEWICK) {
+ putc('\n', outtree);
+ *col = 0;
+ }
+ treeout(p->next->next->back, col, start);
+ if (p == start && njoin) {
+ putc(',', outtree);
+ if (*col > MAX_COL_NEWICK) {
+ putc('\n', outtree);
+ *col = 0;
+ }
+ treeout(p->back, col, start);
+ }
+ putc(')', outtree);
+ (*col)++;
+ }
+ if (p == start)
+ fprintf(outtree, ";\n");
+ else {
+ fprintf(outtree, ":%.*e", precision,p->v);
+ *col += precision+5;
+ }
+}
+
+/* read in taxa name */
+void readName(int i)
+{
+ regex_t re;
+ regmatch_t pm;
+ char * c;
+
+ if (regcomp(&re, "[]:;(),\n[]", 0) != 0)
+ fatal_msg("Failed to compile regular expression");
+
+ if (!fread(name[i],sizeof(char),NMLNGTH,infile))
+ fatal_msg("Read zero items.");
+
+ if (regexec(&re, name[i], (size_t) 1, &pm, 0) == 0 )
+ fatal_msg("Unexpected character: %c in taxa %s\n",name[i][pm.rm_so],name[i]);
+
+ //trim terminating whitespace
+ while ((c=strrchr(name[i],' ')) != NULL)
+ *c='\0';
+
+ regfree(&re);
+
+}
+
+
+/* establishes coordinates of nodes */
+//Uses recursion
+void coordinates(NODE *p, double lengthsum, int *tipy, double *tipmax,
+ NODE *start )
+{
+ NODE *q, *first, *last;
+
+ if (p->tip) {
+ p->xcoord = (int)(OVER * lengthsum + LEFT_MARGIN);
+ p->ycoord = *tipy;
+ p->ymin = *tipy;
+ p->ymax = *tipy;
+ (*tipy) += DOWN;
+ if (lengthsum > *tipmax)
+ *tipmax = lengthsum;
+ return;
+ }
+ q = p->next;
+ do {
+ if (q->back)
+ coordinates(q->back, lengthsum + q->v, tipy,tipmax, start);
+ q = q->next;
+ } while ((p == start || p != q) && (p != start || p->next != q));
+ first = p->next->back;
+ q = p;
+ while (q->next != p && q->next->back) /* is this right ? */
+ q = q->next;
+ last = q->back;
+ p->xcoord = (int)(OVER * lengthsum + LEFT_MARGIN);
+ if (p == start && p->back)
+ p->ycoord = p->next->next->back->ycoord;
+ else
+ p->ycoord = (first->ycoord + last->ycoord) / 2;
+ p->ymin = first->ymin;
+ p->ymax = last->ymax;
+}
+
+
+
+
+ /* draws one row of the tree diagram by moving up tree */
+void drawline(int i, double scale, NODE *start)
+{
+ NODE *p, *q;
+ int n=0, j=0;
+ bool extra=false, trif=false;
+ NODE *r, *first =NULL, *last =NULL;
+ bool done=false;
+
+ p = start;
+ q = start;
+ extra = false;
+ trif = false;
+ if (i == (int)p->ycoord && p == start) { /* display the root */
+ if (!njoin) {
+ if (p->index - txn >= SMALL_TREE_TH)
+ fprintf(outfile, SHORT_DASH);
+ else
+ fprintf(outfile, LONG_DASH);
+ }
+ else {
+ if (p->index - txn >= SMALL_TREE_TH)
+ fprintf(outfile, SHORT_SPACE);
+ else
+ fprintf(outfile, LONG_SPACE);
+ }
+ if (p->index - txn >= SMALL_TREE_TH)
+ fprintf(outfile, "%2d", p->index - txn + 1);
+ else
+ fprintf(outfile, "%d", p->index - txn + 1);
+ extra = true;
+ trif = true;
+ } else
+ fprintf(outfile, LONG_SPACE);
+ do {
+ if (!p->tip) { /* internal nodes */
+ r = p->next;
+ /* r->back here is going to the same node. */
+ do {
+ if (!r->back) {
+ r = r->next;
+ continue;
+ }
+ if (i >= r->back->ymin && i <= r->back->ymax) {
+ q = r->back;
+ break;
+ }
+ r = r->next;
+ } while (!((p != start && r == p) || (p == start && r == p->next)));
+ first = p->next->back;
+ r = p;
+ while (r->next != p)
+ r = r->next;
+ last = r->back;
+ if (njoin && (p == start))
+ last = p->back;
+ } /* end internal node case... */
+ /* draw the line: */
+ done = (p->tip || p == q);
+ n = (int)(scale * (q->xcoord - p->xcoord) + LEFT_MARGIN);
+ if (!q->tip) {
+ if ((n < 3) && (q->index - txn >= SMALL_TREE_TH))
+ n = 3;
+ if ((n < 2) && (q->index - txn < SMALL_TREE_TH))
+ n = 2;
+ }
+ if (extra) {
+ n--;
+ extra = false;
+ }
+ if ((int)q->ycoord == i && !done) {
+ if (p->ycoord != q->ycoord)
+ putc('+', outfile);
+ if (trif) {
+ n++;
+ trif = false;
+ }
+ if (!q->tip) {
+ for (j = 2; j < n; j++)
+ putc('-', outfile);
+ if (q->index - txn >= SMALL_TREE_TH)
+ fprintf(outfile, "%2d", q->index - txn + 1);
+ else
+ fprintf(outfile, "-%d", q->index - txn + 1);
+ extra = true;
+ } else {
+ for (j = 1; j < n; j++)
+ putc('-', outfile);
+ }
+ } else if (!p->tip) {
+ if ((int)last->ycoord > i && (int)first->ycoord < i
+ && i != (int)p->ycoord) {
+ putc('|', outfile);
+ for (j = 1; j < n; j++)
+ putc(' ', outfile);
+ } else {
+ for (j = 0; j < n; j++)
+ putc(' ', outfile);
+ trif = false;
+ }
+ }
+ if (q != p)
+ p = q;
+ } while (!done);
+ if ((int)p->ycoord == i && p->tip) {
+ fprintf(outfile,"%s",name[p->index]);
+ }
+ putc('\n', outfile);
+}
+
+
diff --git a/src/ffptxt.c b/src/ffptxt.c
new file mode 100644
index 0000000..b8efb3c
--- /dev/null
+++ b/src/ffptxt.c
@@ -0,0 +1,234 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <getopt.h>
+#include <math.h>
+#include <ctype.h>
+#include <limits.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include "hashroll.h"
+#include "mask.h"
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "parse_features.h"
+#include "../config.h"
+
+/** @todo Need to implement stop word removal i.e. 'the' 'a' 'and' */
+
+char PROG_NAME[FILENAME_MAX];
+#define DEFAULT_WORD_LENGTH 6 /**< Default Feature length if not given by opt -l */
+
+void parseFile(HASH *, FILE *);
+void loopFeatureList(HASH * h, FILE * fp);
+void loopRaw(HASH * h, FILE * fp);
+
+char usage_str[] = "Usage: %s [OPTION] ... [FILE] ...\n\
+This program generates an FFP vector from text data\n\n\
+Given no options the default behavior of the program is to\n\
+generate a Feature Frequency Profile (FFP) using features of\n\
+length\n\
+\t-l LEN, --length\n\
+\t-f FILE, --feature-list\n\
+\t-v, --version\n\
+\t-h, --help\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+int Length = DEFAULT_WORD_LENGTH;
+ /**< Feature length to use if not specified by opt -l */
+int maxWordSize = MAX_WORD_SIZE;
+char *weightVector;
+
+
+
+char *fvalue = NULL; /**< -f File name to load features from */
+char fflag = 0; /**< -f Option to only count features listed in a file */
+char mflag = 0; /**< unused but needed to link with hashroll.c */
+bool zflag = false;
+bool wflag = false;
+
+int main(int argc, char **argv)
+{
+ int opt;
+ HASH h;
+ FILE *fp;
+
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"length", required_argument, 0, 'l'},
+ {"feature-list", required_argument, 0, 'f'},
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "l:f:hv",
+ long_options, &option_index)) != -1)
+
+ switch (opt) {
+ case 'l':
+ Length = atoi(optarg);
+ break;
+ case 'f':
+ fflag = 1;
+ fvalue = optarg;
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ break;
+ }
+
+ if ( getenv("MAX_WORD_SIZE") )
+ maxWordSize=atoi(getenv("MAX_WORD_SIZE"));
+
+ if (Length > maxWordSize)
+ fatal_msg("%d: Max Word size is : %d",Length,maxWordSize);
+
+
+ init(&h, 0, text, 0, 0, Length);
+
+
+ // If provided a feature list read it and store in hash
+
+ if (fflag)
+ parseFeatureList(&h,fvalue,Length,text);
+
+
+// Must now process file arguments
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s.\n", *argv,strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ parseFile(&h, fp);
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+
+ freeHash(&h);
+
+ return EXIT_SUCCESS;
+}
+
+
+
+void parseFile(HASH * h, FILE * fp)
+{
+
+// to eliminate a test w/n a tight loop
+// First test here.
+ if (fflag)
+ loopFeatureList(h, fp);
+ else
+ loopRaw(h, fp);
+
+}
+
+
+// For finding only features w/n a feature list
+void loopFeatureList(HASH * h, FILE * fp)
+{
+ struct stat fattr;
+ static size_t optimal_size;
+ ssize_t nr;
+ static char *buf = NULL;
+
+ //Determine optimal buffer size for file
+ if (fstat(fileno(fp), &fattr))
+ fatal_msg("fstat error.\n");
+
+ //Find optimal size for Disk IO
+ optimal_size = (fattr.st_blksize >= BUFSIZ) ? fattr.st_blksize : BUFSIZ;
+
+ buf = (char *) malloc(optimal_size);
+
+
+ // replace w/ function pointers
+ while ((nr = fread(buf, sizeof(char), optimal_size, fp)) != -1 && nr != 0) {
+
+ chkpushtxt(h, buf, nr);
+ }
+
+ printFeatures(h);
+ freeHash(h);
+}
+
+
+
+// For finding all features
+
+void loopRaw(HASH * h, FILE * fp)
+{
+ struct stat fattr;
+ static size_t optimal_size;
+ ssize_t nr;
+ static char *buf = NULL;
+
+ //Determine optimal buffer size for file
+ if (fstat(fileno(fp), &fattr))
+ fatal_msg("fstat error.\n");
+
+ //Find optimal size for Disk IO
+ optimal_size = (fattr.st_blksize >= BUFSIZ) ? fattr.st_blksize : BUFSIZ;
+
+ buf = (char *) malloc(optimal_size);
+
+
+ // replace w/ function pointers
+ while ((nr = fread(buf, sizeof(char), optimal_size, fp)) != -1 && nr != 0) {
+
+ pushtxt(h, buf, nr);
+ }
+
+ printFeatures(h);
+ freeHash(h);
+}
diff --git a/src/ffpvocab.c b/src/ffpvocab.c
new file mode 100644
index 0000000..5095848
--- /dev/null
+++ b/src/ffpvocab.c
@@ -0,0 +1,189 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include "utils.h"
+#include "vstring.h"
+#include "sighandle.h"
+#include "../config.h"
+
+char PROG_NAME[FILENAME_MAX];
+#define VECTOR_SIZE 1000 /**< Initial guess for the number of columns in the FFP */
+#define DEFAULT_THRESH 2 /**< The default frequency threshold for counting vocab features */
+
+float vocab(FILE * fp, int threshold);
+
+char usage_str[] = "Usage: %s [OPTION] ... [FILE] ...\n\
+This program determines the number of features used in a vector\n\n\
+Given no options, the defeault behavior of the program is to\n\
+print out the number of features with frequencies greater than\n\
+two in all rows.\n\
+\t-f INT, --freq-thresh=INT\n\
+\t-v, --version\n\
+\t-h, --help\n\n\
+Copyright (c) %s\n\
+%s\n\
+Contact %s\n";
+
+
+int main(int argc, char **argv)
+{
+ FILE *fp;
+ int opt;
+ char fflag = 0;
+ int threshold = DEFAULT_THRESH;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {"freq-thresh", required_argument, 0, 'f'},
+ {"amino", no_argument, 0, 'a'},
+ {"text", no_argument, 0, 't'},
+ {0, 0, 0, 0}
+ };
+
+ initSignalHandlers();
+
+ strcpy(PROG_NAME,basename( argv[0] ));
+
+ while ((opt = getopt_long(argc, argv, "hf:atv",
+ long_options, &option_index)) != -1)
+
+ switch (opt) {
+ case 'f':
+ fflag = 1;
+ threshold = atoi(optarg);
+ break;
+ case 'v':
+ printVersion();
+ exit(EXIT_SUCCESS);
+ break;
+ case 'h':
+ printUsageStr();
+ exit(EXIT_SUCCESS);
+ break;
+ default:
+ printErrorUsageStr();
+ exit(EXIT_FAILURE);
+ break;
+ }
+
+//add code to detect what kind of ffp is being given as input.
+
+
+ if (threshold < 1)
+ fatal_msg("Feature threshold must be greater than or equal to 1\n");
+
+
+ argv += optind;
+
+ do {
+ fp = stdin;
+ if (*argv) {
+ if (!strcmp(*argv, "-"))
+ fp = stdin;
+ else if ((fp = fopen(*argv, "r")) == NULL)
+ fatal_msg("%s: %s.\n", *argv,strerror(errno));
+
+ if ( isDirectory(*argv) )
+ fatal_msg("%s: %s\n",*argv, strerror(EISDIR));
+
+ argv++;
+ } else if (isatty(STDIN_FILENO))
+ printErrorUsageStr();
+
+ // check if not a seekable pipe
+ if (!isRegularFile(fp))
+ fp = convertPipeToFile(fp);
+
+ if (!isKeyBased(fp))
+ fatal_msg("%s: Not a key valued FFP.\n", *argv);
+
+ printf("%e\t\n", vocab(fp, threshold));
+
+ if (fp != stdin)
+ fclose(fp);
+
+ } while (*argv);
+ return EXIT_SUCCESS;
+}
+
+
+
+/**
+ *
+ * Determine the number of features in the FFP which
+ * occur more than threshold number of times
+ *
+ * Determine the feature usage (vocabulary usage) of
+ * the FFP stored in the File pointed to by fp.
+ *
+ * @param fp A file pointer
+ * @param threshold A frequency threshold
+ * @return The number of features above the frequency threshold
+ *
+ */
+
+
+
+float vocab(FILE * fp, int threshold)
+{
+ int rows = 0;
+ rows = 0;
+ char ch[2];
+ unsigned numFeature = 0;
+ unsigned val;
+ unsigned lineno=0;
+ unsigned line_offset=0;
+ int items;
+
+ errno=0;
+ while ( (items=fscanf(fp, "%*s %u%[\r\n]", &val,ch)) != EOF ) {
+ //fprintf(stderr,"%s %d\n",strerror(errno),items);
+ if (errno)
+ fatal_msg("Parse error at line %u char %ld: %s.\n",
+ lineno,ftell(fp)-line_offset, strerror(errno) );
+
+ if (val >= threshold)
+ numFeature++;
+
+ switch (items) {
+ case 2:
+ line_offset=ftell(fp);
+ lineno++;
+ rows++;
+ case 1:
+ break;
+ default:
+ fatal_msg("Parse error at line %u char %ld.\n",
+ lineno,ftell(fp)-line_offset);
+ break;
+ }
+ }
+
+
+ if (ferror(fp))
+ fatal_msg("Read Error: %s",strerror(errno));
+
+ return ((float) numFeature / rows);
+}
diff --git a/src/hash.c b/src/hash.c
new file mode 100644
index 0000000..bf8d772
--- /dev/null
+++ b/src/hash.c
@@ -0,0 +1,910 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include "hash.h"
+#include "../config.h"
+
+
+
+extern char *weightVector;
+extern int Length;
+
+
+/** @todo Mysteries to solve, why is abs() necessary in the hash functions?
+ * Using unsigned int types should remove the need for this.
+*/
+
+/* Functions private to this file and therefore not part of hash.h */
+/* This prevents anyone from accessing the hash improperly */
+
+
+static int hashrywi(register const char *s);
+static int hashryi(register const char *s);
+static int hashatgcwi(register const char *s);
+static int hashatgci(register const char *s);
+static int new_strcmp(register const char *s, register const char *t);
+static int new_strcmpw(register const char *s, register const char *t);
+static int hashaawi(register const char *s);
+static int hashaai(register const char *s);
+static int hashaacwi(register const char *s);
+static int hashaaci(register const char *s);
+static int hashtxti(register const char *s);
+
+
+/**
+ *
+ * Initializing feature that creates an empty hash table.
+ *
+ * This function initializes the hash table array by setting all
+ * pointers in the the table array to NULL, setting the number of keys
+ * keyN to zero and setting up the function pointer to the
+ * appropriate hash and string comparison functions. The
+ * function pointer is necessary to provide polymorphic
+ * behavior depending on whether we are using a feature mask, RY
+ * coded, ATGC coded or amino acid sequence
+ *
+ * Note however it does not free any memory, so freeHash should
+ * be called before reinitializing the hash.
+ *
+ *
+ * @param isMasked true if a mask is used
+ * @param isNt true if using nucleic acid features
+ * @param isClass true if using amino acid classes
+ * @return None
+ * @todo Since, everytime as hash is used it is first intialized, there may not be a need for a BUCKET variable instead the size of the hash can be dynamically allocated.
+ */
+
+
+
+
+void initHash(int isMasked, int mode, int isClass)
+{
+
+ // assign function pointers depending
+ // on whether we are using feature
+ // character masks or not
+ if (mode == nucleotide) {
+ if (isMasked) // is a NA hash
+ {
+ if (isClass)
+ hashf = &hashrywi;
+ else
+ hashf = &hashatgcwi;
+ strcmpf = &new_strcmpw;
+
+ } else {
+ if (isClass)
+ hashf = &hashryi;
+ else
+ hashf = &hashatgci;
+ strcmpf = &new_strcmp;
+
+ }
+ }
+
+ else if (mode == amino) {
+ if (isMasked) {
+ if (isClass)
+ hashf = &hashaacwi;
+ else
+ hashf = &hashaawi;
+ strcmpf = &new_strcmpw;
+ } else {
+ if (isClass)
+ hashf = &hashaaci;
+ else
+ hashf = &hashaai;
+
+ strcmpf = &new_strcmp;
+ }
+ } else // is for text
+ {
+ hashf = &hashtxti;
+ strcmpf = &new_strcmp;
+ }
+
+ int i;
+ for (i = 0; i < BUCKETS; i++)
+ table[i] = NULL;
+ keyN = 0;
+}
+
+
+
+
+
+
+
+/**
+ *
+ * Returns an unmasked hash value for an RY coded feature
+ *
+ * This is the hashing function used to store
+ * features in the hash table. The hashing function
+ * has a direct affect on the collision rate of
+ * hash stores. The more hash collisions the less
+ * effective the hash lookups are.
+ *
+ *
+ * @param s An RY-coded character string.
+ * @retval >= 0 A valid hash index
+ * @retval -1 s contains an invalid character
+ */
+
+
+
+inline static int hashryi(register const char *s)
+{
+ long unsigned hash = 0;
+ register int index;
+
+ while ( *s != '\0') {
+ hash *= 3;
+ index = base_ry_hash_values[(unsigned char) (*s)];
+ s++;
+ if (!index)
+ return -1;
+ hash += index;
+ hash %= BUCKETS;
+ }
+ return (int) hash;
+}
+
+
+
+/**
+ *
+ * Returns a masked hash value for an RY coded feature
+ *
+ * This is the hashing function used to store
+ * features in the hash table. The hashing function
+ * has a direct affect on the collision rate of
+ * hash stores. The more hash collisions the less
+ * effective the hash lookups are. Uses a feature
+ * mask, ignoring masked out features
+ *
+ *
+ * @param s An RY-coded character string
+ * @retval >= 0 A valid hash index
+ * @retval -1 s contains an invalid character
+ */
+
+
+
+static int hashrywi(register const char *s)
+{
+ long unsigned hash = 0;
+ int i = 0;
+ register int index;
+
+ while (s[i] != '\0') {
+ if (weightVector[i] == '1') {
+ hash *= 3;
+ index = base_ry_hash_values[(unsigned char) s[i]];
+ if (!index)
+ return -1;
+ hash += index;
+ hash %= BUCKETS;
+ }
+ i++;
+ }
+ return (int) hash;
+}
+
+
+static const int base_hash_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 2,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
+
+static int hashatgci(register const char *s)
+{
+ long unsigned hash = 0;
+ int i = 0;
+ register int index;
+
+ while (s[i] != '\0') {
+ hash *= 5;
+ index = base_hash_values[(unsigned char) s[i]];
+ if (!index)
+ return -1;
+ hash += index;
+ hash %= BUCKETS;
+ i++;
+ }
+ return (int) hash;
+}
+
+
+static int hashatgcwi(register const char *s)
+{
+ long unsigned hash = 0;
+ int i = 0;
+ register int index;
+
+ while (s[i] != '\0') {
+ if (weightVector[i] == '1') {
+ hash *= 5;
+ index = base_hash_values[(unsigned char) s[i]];
+ if (!index)
+ return -1;
+ hash += index;
+ hash %= BUCKETS;
+ }
+ i++;
+ }
+ return (int) hash;
+}
+
+
+/**
+ *
+ * Masked String comparison method used internally by the hash table functions.
+ *
+ * This function differs slightly from the library version of strcmp
+ * It short circuits when it finds the first difference in strings
+ * It is also declared inline so that the compiler has the option of
+ * substituting this code in directly. It is declared static so that
+ * it can only be used by the hash functions.
+ * Uses a feature mask, ignoring masked out features
+ *
+ * @param s a null terminated string
+ * @param t a null terminated string
+ * @retval 1 if s and t are equal
+ * @retval 0 if s and t are different
+ *
+ */
+
+
+static int new_strcmpw(register const char *s, register const char *t)
+{
+ int i = 0;
+ while (s[i] != '\0') {
+ if (weightVector[i] == '1')
+ if (s[i] != t[i])
+ return 1;
+ i++;
+ }
+ return 0;
+}
+
+
+/**
+ *
+ * String comparison method used internally by the hash table functions.
+ *
+ * This function differs slightly from the library version of strcmp
+ * It short circuits when it finds the first difference in strings
+ * It is also declared inline so that the compiler has the option of
+ * substituting this code in directly. It is declared static so that
+ * it can only be used by the hash functions.
+ *
+ * @param s a null terminated string
+ * @param t a null terminated string
+ * @retval 1 if s and t are equal
+ * @ret val 0 if s and t are different
+ *
+ */
+
+
+
+inline static int new_strcmp(const char *s, const char *t)
+{
+ while (*s != '\0') {
+ if (*(s++) != *(t++))
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ *
+ * Adds a key-value pairs to the hash table
+ *
+ *
+ * Checks to see if s exists in the hash table, if it
+ * doesn't add s to the hash table and store a value
+ * of val. If feature s exists in the hash table then
+ * increment the frequency. The function has the
+ * following return values:
+ * 0 or -1 if the feature isn't in the table
+ * 1 if the feature is in the table
+ * -1 more precisely indicates a hash collision has
+ * occurred. i.e. two features hashed to the same
+ * key value, but are not the same.
+ *
+ * Note that this function uses function pointers
+ * to a hashing function and a string comparison
+ * function. This is to create polymorphic behavior
+ * depending upon whether we are hashing nucleotides
+ * or hashing proteins or using feature masking.
+ *
+ * @param s a pointer to a string
+ * @param val the integer value to add to the current value
+ * @retval 0 For feature not in hash
+ * @retval -1 For feature not in hash but hash collision,
+ * @retval 1 For feature in hash
+ * @see hashInc
+ * @see strcmpf
+ * @see hashf
+ *
+ *
+ */
+
+
+/*
+int hashAdd(char *s, unsigned val)
+{
+ NODE *ptr;
+ NODE *r;
+ int index;
+
+ if ((index = (*hashf) (s)) < 0)
+ return 0;
+
+
+ ptr = table[index];
+
+ while (ptr != NULL) {
+ if ((*strcmpf) (ptr->key, s) == 0) {
+ ptr->value += val;
+ return 1;
+ }
+
+ ptr = ptr->next;
+ }
+
+ r = (NODE *) malloc(sizeof(NODE));
+ r->key = (char *) malloc(sizeof(char) * (Length + 1));
+ strcpy(r->key, s);
+ r->value = val;
+ r->next = table[index];
+ table[index] = r;
+ keyN++;
+ return -1;
+
+}
+*/
+
+
+
+
+
+/**
+ *
+ * The hash value associated with key s
+ *
+ * Returns the frequency stored in the hash which is associated with
+ * feature s.
+ *
+ * @param s A pointer to a Key value s which is a string
+ * @return an integer value associated the frequency of s
+ * @retval >=0 if s is in hash
+ * @retval 0 if s is not in hash
+ */
+
+int hashval(register char *s)
+{
+ NODE *ptr;
+
+ ptr = table[(*hashf) (s)];
+
+
+ while (ptr != NULL) {
+ if ((*strcmpf) (ptr->key, s) == 0)
+ return ptr->value;
+ ptr = ptr->next;
+ }
+
+ return 0;
+}
+
+
+
+
+/**
+ *
+ * Assign a new value to the key value s
+ *
+ * Returns the frequency stored in the hash which is associated with
+ * feature s.
+ *
+ * Note: need to add checking for whether has key is stored at all!
+ *
+ * @param s A pointer to a Key value s which is a string
+ * @param n An integer which is the new value
+ * @return true or false
+ * @retval 1 if found
+ * @retval 0 if not found
+ *
+ */
+
+/* Moved to Macro definition */
+
+/*
+void hashAssign(char *s, int n)
+{
+ NODE *ptr;
+
+ ptr = table[(*hashf) (s)];
+
+ while (ptr != NULL) {
+ if ((*strcmpf) (ptr->key, s) == 0) {
+ ptr->value = n;
+ return;
+ }
+ ptr = ptr->next;
+ }
+
+ return;
+}
+*/
+
+
+/**
+ *
+ * returns a list of keys stored in the hash table
+ *
+ * This is function is used to return the values of the
+ * keys hashed into the table. No error checking is
+ * provided to make sure that enough memory has been
+ * allocated to store all the keys into the array of
+ * strings.
+ *
+ * @param s a pointer to an array of character arrays.
+ * @return None
+ *
+ */
+
+
+void hashKeys(char ***s)
+{
+ int i, j;
+ NODE *ptr;
+ char ** sp;
+ sp = (char **) malloc(sizeof(char *) * keyN);
+ for (i = 0; i < keyN; i++)
+ sp[i] = (char *) malloc(sizeof(char) * (Length + 1));
+ i = 0;
+ for (j = 0; j < BUCKETS; j++)
+ if (table[j] != NULL) {
+ ptr = table[j];
+ while (ptr != NULL) {
+ strcpy(sp[i++], ptr->key);
+ ptr = ptr->next;
+ }
+ }
+ *s=sp;
+}
+
+
+/**
+ *
+ * Returns the stored hash values
+ *
+ * This function is used to return the values
+ * stored in the hash table. The ordering is
+ * not orderd by key in any way, but is retrieved
+ * by increasing hash index. This function can
+ * be used to save the time involved in retrieving
+ * all the keys and then looking up the value associated
+ * with a key - one at a time. This is especially useful
+ * if the keys remain in the hash throughout and
+ * ordering isn't essential.
+ *
+ * @param values
+ * @return none
+ *
+ */
+
+
+
+
+void hashValues(unsigned **values)
+{
+ int i, j;
+ NODE *ptr;
+ *values = (unsigned *) malloc(sizeof(unsigned *) * keyN);
+ i = 0;
+ for (j = 0; j < BUCKETS; j++)
+ if (table[j] != NULL) {
+ ptr = table[j];
+ while (ptr != NULL) {
+ *values[i++] = ptr->value;
+ ptr = ptr->next;
+ }
+ }
+
+}
+
+
+
+
+/**
+ *
+ * Frees the memory allocated to store the hash
+ *
+ * All memory allocated with malloc is freed from the
+ * hash. All values are deleted. returns 0 on success.
+ * The number of hash keys is also returned to zero.
+ *
+ * @param None
+ * @retval 1 on success
+ *
+ *
+ */
+
+
+int freeHash(void)
+{
+ int i;
+ NODE *ptr;
+ NODE *last;
+ for (i = 0; i < BUCKETS; i++) {
+ ptr = table[i];
+ while (ptr != NULL) {
+ last = ptr;
+ ptr = ptr->next;
+ free(last->key);
+ free(last);
+ }
+ table[i] = NULL;
+ }
+ keyN = 0;
+ return 1;
+}
+
+/**
+ *
+ * Hash function for masked classed amino acid sequences
+ *
+ * Returns a hash index, for char string s
+ * Positions which are masked out in w are
+ * not used to calculate index.
+ * String s must contain a valid character,
+ * one of the Amino acid classes specified in
+ * _class(), otherwise a hash of -1 is returned.
+ *
+ * Depends on global variable string weightVector
+ *
+ * @param s hash key
+ * @return returns the hash index
+ * @retval -1 invalid class character
+ * @retval >0 a valid hash index
+ * @see _class()
+ * @todo Consider the possibility that classing be built into the hash functions, so that conversion to classes is unnecessary. This eliminates a step.
+ *
+ ************************************************/
+
+
+
+static int hashaacwi(register const char *s)
+{
+ long unsigned hash = 0;
+ int i = 0;
+ register int index;
+
+ while (s[i] != '\0') {
+ if (weightVector[i] == '1') {
+ hash *= 12;
+ index = aac_values[(unsigned char) s[i]];
+ if (!index) {
+ return -1;
+ }
+ hash += index;
+ }
+ i++;
+ }
+ return (int) abs(hash) % BUCKETS;
+}
+
+
+
+/**
+ *
+ * Hash function for amino acid sequences
+ *
+ * Returns a hash index, for char string s
+ * Positions which are masked out in weightVector are
+ * not used to calculate index.
+ * String s must contain a valid character,
+ * one of the Amino acids.
+ *
+ *
+ * @param s hash key
+ * @return returns the hash index
+ * @retval -1 Invalid Amino acid class character
+ * @retval >0 A valid hash index
+ *
+ ************************************************/
+
+
+
+
+static int hashaaci(register const char *s)
+{
+ long unsigned hash = 0;
+ int i = 0;
+ register int index;
+
+ while (s[i] != '\0') {
+ hash *= 12;
+ index = aac_values[(unsigned char) s[i]];
+ if (!index) {
+ return -1;
+ }
+ hash += index;
+ i++;
+ }
+ return (int) abs(hash) % BUCKETS;
+}
+
+
+/**
+ *
+ * Hash function for amino acid sequences
+ *
+ * Returns a hash index, for char string s
+ * Positions which are masked out in weightVector are
+ * not used to calculate index.
+ * String s must contain a valid character,
+ * one of the Amino acids.
+ *
+ *
+ * @param s hash key
+ * @return returns the hash index
+ * @retval -1 Invalid Amino acid class character
+ * @retval >0 A valid hash index
+ *
+ ************************************************/
+
+
+
+
+static int hashaawi(register const char *s)
+{
+ long unsigned hash = 0;
+ int i = 0;
+ register int index;
+
+ while (s[i] != '\0') {
+ if (weightVector[i] == '1') {
+ hash *= 21;
+ index = aa_hash_values[(unsigned char) s[i]];
+ if (!index) {
+ return -1;
+ }
+ hash += index;
+ }
+ i++;
+ }
+ return (int) abs(hash) % BUCKETS;
+}
+
+
+
+/**
+ *
+ * Hash function for amino acid sequences
+ *
+ * Returns a hash index, for char string s
+ * String s must contain a valid amino acid character,
+ * otherwise a hash of -1 is returned.
+ *
+ * @param s hash key
+ * @retval -1 invalid amino acid character
+ * @retval >0 a valid hash index
+ * @return returns the hash index
+ *
+ **************************************************/
+
+
+
+
+static int hashaai(register const char *s)
+{
+ long unsigned hash = 0;
+ int i = 0;
+ register int index;
+
+ while (s[i] != '\0') {
+ hash *= 21;
+ index = aa_hash_values[(unsigned char) s[i]];
+ if (!index) {
+ return -1;
+ }
+ hash += index;
+ i++;
+ }
+ return (int) abs(hash) % BUCKETS;
+}
+
+
+
+
+
+
+
+
+
+
+
+/**
+ *
+ * Hash function for text sequences
+ *
+ * String s must contain a valid text character,
+ *
+ * @param s hash key
+ * @retval -1 invalid text character
+ * @retval >0 a valid hash index
+ * @return returns the hash index
+ *
+ **************************************************/
+
+
+
+static int hashtxti(register const char *s)
+{
+ long unsigned hash = 0;
+ int i = 0;
+ register int index;
+
+ while (s[i] != '\0') {
+ hash *= 27;
+ index = txt_hash_values[(unsigned char) s[i]];
+ if (!index) {
+ return -1;
+ }
+ hash += index;
+ i++;
+ }
+ return (int) abs(hash) % BUCKETS;
+}
+
+
+/**
+ *
+ * Adds a key-value pair to the hash table if greate than
+ * current value
+ *
+ *
+ * Checks to see if s exists in the hash table, if it
+ * doesn't add s to the hash table and store a value
+ * of val. If feature s exists in the hash table then
+ * increment the frequency. The function has the
+ * following return values:
+ * 0 or -1 if the feature isn't in the table
+ * 1 if the feature is in the table
+ * -1 more precisely indicates a hash collision has
+ * occurred. i.e. two features hashed to the same
+ * key value, but are not the same.
+ *
+ * Note that this function uses function pointers
+ * to a hashing function and a string comparison
+ * function. This is to create polymorphic behavior
+ * depending upon whether we are hashing nucleotides
+ * or hashing proteins or using feature masking.
+ *
+ * @param s a pointer to a string
+ * @param val the integer value to add to the current value
+ * @retval 0 For feature not in hash
+ * @retval -1 For feature not in hash but hash collision,
+ * @retval 1 For feature in hash
+ * @see hashInc
+ * @see strcmpf
+ * @see hashf
+ *
+ *
+ */
+
+
+int hashMax(char *s, unsigned val)
+{
+ NODE *ptr;
+ NODE *r;
+ int index;
+
+ if ((index = (*hashf) (s)) < 0) /* If an invalid hash */
+ return 0;
+
+
+ ptr = table[index];
+
+ while (ptr != NULL) {
+ if ((*strcmpf) (ptr->key, s) == 0) {
+ ptr->value = ((val > ptr->value) ? val : ptr->value);
+ return 1;
+ }
+
+ ptr = ptr->next;
+ }
+
+
+ r = (NODE *) malloc(sizeof(NODE));
+ r->key = (char *) malloc(sizeof(char) * (Length + 1));
+ strcpy(r->key, s);
+ r->value = val;
+ r->next = table[index];
+ table[index] = r;
+ keyN++;
+ return -1;
+
+}
+
+
+
+
+int hashDel(char *s)
+{
+ NODE *ptr;
+ NODE *r;
+ int index;
+
+ if ((index = (*hashf) (s)) < 0) /* If an invalid hash */
+ return 0;
+
+
+ ptr = table[index];
+ r = table[index];
+
+ while (ptr != NULL) {
+ if ((*strcmpf) (ptr->key, s) == 0) {
+ if (r == table[index]) {
+ table[index] = ptr->next;
+ } else
+ r->next = ptr->next;
+ free(ptr);
+ keyN--;
+
+ break;
+ }
+ r = ptr;
+ ptr = ptr->next;
+ }
+
+
+ return 0;
+}
diff --git a/src/hash.h b/src/hash.h
new file mode 100644
index 0000000..81c41e9
--- /dev/null
+++ b/src/hash.h
@@ -0,0 +1,236 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+/* _ HASH_H_ */
+#ifndef _HASH_H_
+#define _HASH_H_
+
+#define BUCKETS 20013 /**< The Total number of buckets in feature hash table */
+#define hashInc(X) hashAdd((X),(1)) /**< Macro for incrementing a key-value sotred in the hash */
+#define numKeys(void) keyN /**< Macro for number of keys in hash */
+
+
+/** Linked list for storing values in the hash */
+
+typedef struct node {
+ char *key; /**< Key value for storing features */
+ unsigned value; /**< Positive integer value for hash */
+ struct node *next; /**< Pointer to next node in linked list */
+} NODE;
+
+
+NODE *table[BUCKETS]; /**< The hash table consisting of an Array of NODES */
+
+
+int keyN; /**< The number of elements in the hash table */
+
+
+/* function pointers */
+
+int (*hashf) (register const char *);/**< A function ptr to a hashing function, set by initHash() */
+int (*strcmpf) (register const char *, register const char *);/**< A ptr to a comparison function, set by initHash() */
+
+
+/* prototypes */
+
+void initHash(int bool, int bool2, int bool3);
+int hashval(register char *s);
+void hashKeys(char ***s);
+int numKeys(void);
+int freeHash(void);
+//void hashAssign(char *s, int n);
+//int hashAdd(char *s, unsigned val);
+void hashValues(unsigned **values);
+int hashDel(char *s);
+int hashMax(char *s, unsigned val);
+
+
+enum hash_modes { nucleotide, amino, text }; /**< Type of hash to initialize */
+
+
+
+
+static const int base_ry_hash_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< Character values for ry hash function */
+
+
+
+static const int aac_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 2, 3, 3,
+ 4, 5, 6, 7, 0, 8, 7, 7, 9, 0,
+ 10, 8, 8, 11, 11, 0, 7, 4, 0, 4,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 2,
+ 3, 3, 4, 5, 6, 7, 0, 8, 7, 7,
+ 9, 0, 10, 8, 8, 11, 11, 0, 7, 4,
+ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< Character values for classed amino acids */
+
+
+
+static const int aa_hash_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 2, 3, 4,
+ 5, 6, 7, 8, 0, 9, 10, 11, 12, 0,
+ 13, 14, 15, 16, 17, 0, 18, 19, 0, 20,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 2,
+ 3, 4, 5, 6, 7, 8, 0, 9, 10, 11,
+ 12, 0, 13, 14, 15, 16, 17, 0, 18, 19,
+ 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< Character values for amino acids */
+
+
+static const int txt_hash_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 0, 0, 0, 0, 0, 0, 1, 2, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
+
+
+#define hashAdd(S, VAL) \
+do { \
+ NODE * __ptrx; \
+ NODE * __rx; \
+ int __indexx; \
+ \
+ if ((__indexx = (*hashf) ((S))) >= 0) { \
+ \
+ __ptrx = table[__indexx]; \
+ \
+ while (__ptrx != NULL) { \
+ if ((*strcmpf) (__ptrx->key, (S)) == 0) { \
+ __ptrx->value += (VAL); \
+ break; \
+ } \
+ __ptrx = __ptrx->next; \
+ } \
+ if (__ptrx == NULL ) { \
+ __rx = (NODE *) malloc(sizeof(NODE)); \
+ __rx->key = (char *) malloc(sizeof(char) * (Length + 1)); \
+ strcpy(__rx->key, (S)); \
+ __rx->value = (VAL); \
+ __rx->next = table[__indexx]; \
+ table[__indexx] = __rx; \
+ keyN++; \
+ } \
+ } \
+} while(0)
+
+
+
+
+
+#define hashAssign(S,N) \
+ do { \
+ NODE *__ptr; \
+ __ptr = table[(*hashf)(S)]; \
+ while (__ptr != NULL) { \
+ if ((*strcmpf) (__ptr->key, (S) ) == 0) { \
+ __ptr->value = (N); \
+ break; \
+ } \
+ __ptr = __ptr->next; \
+ } \
+ } while(0)
+
+
+
+#endif /* _HASH_H_ */
diff --git a/src/hashroll.c b/src/hashroll.c
new file mode 100644
index 0000000..0d39654
--- /dev/null
+++ b/src/hashroll.c
@@ -0,0 +1,2049 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include "hashroll.h"
+#include "utils.h"
+#include "../config.h"
+
+#define A 16807
+#define IAMOD2P16 22039
+#define MOD2P16 0x0000ffff
+extern char *weightVector;
+
+
+/**
+ *
+ * Returns an unmasked rolling hash value for an RY coded feature
+ * using a pre-existing hash value.
+ *
+ * This is the hashing function used to calculate
+ * a rolling hash. Given a pre-calculated hash
+ * of length l, we can quickly compute what the
+ * new hash value would be by shifting the characters
+ * to the left and adding a new character to the right
+ *
+ * Example:
+ * ATATAT has a precaclucated hash value
+ * TATATG What is the hash of this?
+ *
+ *
+ * We use the Rabin-Karp rolling hash
+ * Karb RM Rabin MO (1987) Efficient randomized pattern-matching
+ * algorithms. IBM Journal of R&D. 31:2,249-260.
+ *
+ * H=s1a^k-1 + s2a^k-2 + ... ska^0
+ *
+ * In this case a=3
+ *
+ * To find hash of TATATG multiply H
+ * by a and subtract out s1a^k and add
+ * sk
+ *
+ * @param s An RY-coded character string.
+ * @param hash Pre-existing hash value
+ * @param length of string
+ */
+
+// make this a macro
+
+void resetHash(HASH * h)
+{
+ h->st_hash = h->rt_hash = 0;
+ h->numChar = 0;
+}
+
+
+void init(HASH * h, int isMasked, int mode, bool isClass, bool reverse, int k)
+{
+ h->k = k;
+ h->s = (char *)chkmalloc(sizeof(char),k+1);
+ h->r = (char *)chkmalloc(sizeof(char),k+1);
+ h->s[h->k] = '\0';
+ h->r[h->k] = '\0';
+ h->st_hash = h->rt_hash = 0;
+ h->numChar = 0;
+ h->isClass = isClass;
+ h->mode=mode;
+ h->reverse = reverse;
+ memset(h->table, 0, sizeof(NODE *) * BUCKETS);
+ h->keyN = 0;
+
+ if (mode == nucleotide) {
+ if (isClass)
+ h->hashi = base_ry_hash_values;
+ else
+ h->hashi = base_hash_values;
+ } else if (mode == amino) {
+ if (isClass)
+ h->hashi = aac_values;
+ else
+ h->hashi = aa_hash_values;
+ } else if (mode == text) {
+ h->hashi = txt_hash_values;
+ }
+
+
+}
+
+
+
+/* This is a static table of hash increments
+ * Eeach term to be subtracted or
+ * added to the hash has been pre-calculated
+ * in mod form.
+ *
+ * ci*a^k
+ *
+ * ci= the new position index value = {1..4}
+ * a= 16807
+ * k= the position of the new character in
+ * the k-mer.
+ *
+ * All possibilities have been precalculated
+ * and then mod 2^16, using the bc language
+ * arbitrary precision calculator.
+ *
+ * Element apnmod[1][3] for example contains
+ * the results of 1*16807^3%2^16 which gives
+ * 42039. This should save plenty of
+ * calculation time.
+ *
+ */
+
+static const unsigned apnmod[5][41] = { {0},
+{1, 16807, 15089, 42039, 5857, 3527, 33745, 3671, 29121, 13799, 53425, 5239,
+ 37025, 14855, 41361, 13975, 62337, 39463, 30321, 62647, 6753, 54855, 53073,
+ 52951, 34113, 28263, 11313, 17655, 46113, 57991, 3345, 55063, 9985, 45735,
+ 61937, 1335, 24033, 24263, 23249, 20311, 55489},
+{2, 33614, 30178, 18542, 11714, 7054, 1954, 7342, 58242, 27598, 41314, 10478,
+ 8514, 29710, 17186, 27950, 59138, 13390, 60642, 59758, 13506, 44174, 40610,
+ 40366, 2690, 56526, 22626, 35310, 26690, 50446, 6690, 44590, 19970, 25934,
+ 58338, 2670, 48066, 48526, 46498, 40622, 45442},
+{3, 50421, 45267, 60581, 17571, 10581, 35699, 11013, 21827, 41397, 29203, 15717,
+ 45539, 44565, 58547, 41925, 55939, 52853, 25427, 56869, 20259, 33493, 28147,
+ 27781, 36803, 19253, 33939, 52965, 7267, 42901, 10035, 34117, 29955, 6133,
+ 54739,
+ 4005, 6563, 7253, 4211, 60933, 35395},
+{4, 1692, 60356, 37084, 23428, 14108, 3908, 14684, 50948, 55196, 17092, 20956,
+ 17028, 59420, 34372, 55900, 52740, 26780, 55748, 53980, 27012, 22812, 15684,
+ 15196, 5380, 47516, 45252, 5084, 53380, 35356, 13380, 23644, 39940, 51868,
+ 51140, 5340, 30596, 31516, 27460, 15708, 25348}
+};
+
+
+static const unsigned apnmodaa[21][41] = { {0},
+{1, 16807, 15089, 42039, 5857, 3527, 33745, 3671, 29121, 13799, 53425, 5239,
+ 37025, 14855, 41361, 13975, 62337, 39463, 30321, 62647, 6753, 54855, 53073,
+ 52951, 34113, 28263, 11313, 17655, 46113, 57991, 3345, 55063, 9985, 45735,
+ 61937, 1335, 24033, 24263, 23249, 20311, 55489},
+{2, 33614, 30178, 18542, 11714, 7054, 1954, 7342, 58242, 27598, 41314, 10478,
+ 8514, 29710, 17186, 27950, 59138, 13390, 60642, 59758, 13506, 44174, 40610,
+ 40366, 2690, 56526, 22626, 35310, 26690, 50446, 6690, 44590, 19970, 25934,
+ 58338, 2670, 48066, 48526, 46498, 40622, 45442},
+{3, 50421, 45267, 60581, 17571, 10581, 35699, 11013, 21827, 41397, 29203, 15717,
+ 45539, 44565, 58547, 41925, 55939, 52853, 25427, 56869, 20259, 33493, 28147,
+ 27781, 36803, 19253, 33939, 52965, 7267, 42901, 10035, 34117, 29955, 6133,
+ 54739,
+ 4005, 6563, 7253, 4211, 60933, 35395},
+{4, 1692, 60356, 37084, 23428, 14108, 3908, 14684, 50948, 55196, 17092, 20956,
+ 17028, 59420, 34372, 55900, 52740, 26780, 55748, 53980, 27012, 22812, 15684,
+ 15196, 5380, 47516, 45252, 5084, 53380, 35356, 13380, 23644, 39940, 51868,
+ 51140, 5340, 30596, 31516, 27460, 15708, 25348},
+{5, 18499, 9909, 13587, 29285, 17635, 37653, 18355, 14533,
+ 3459, 4981, 26195, 54053, 8739, 10197, 4339, 49541, 707,
+ 20533, 51091, 33765, 12131, 3221, 2611, 39493, 10243,
+ 56565, 22739, 33957, 27811, 16725, 13171, 49925, 32067,
+ 47541, 6675, 54629, 55779, 50709, 36019},
+{6, 35306, 24998, 55626, 35142, 21162, 5862, 22026, 43654,
+ 17258, 58406, 31434, 25542, 23594, 51558, 18314, 46342,
+ 40170, 50854, 48202, 40518, 1450, 56294, 55562, 8070,
+ 38506, 2342, 40394, 14534, 20266, 20070, 2698, 59910,
+ 12266, 43942, 8010, 13126, 14506, 8422, 56330},
+{7, 52113, 40087, 32129, 40999, 24689, 39607, 25697, 7239,
+ 31057, 46295, 36673, 62567, 38449, 27383, 32289, 43143,
+ 14097, 15639, 45313, 47271, 56305, 43831, 42977, 42183,
+ 1233, 13655, 58049, 60647, 12721, 23415, 57761, 4359,
+ 58001, 40343, 9345, 37159, 38769, 31671, 11105},
+{8, 3384, 55176, 8632, 46856, 28216, 7816, 29368, 36360,
+ 44856, 34184, 41912, 34056, 53304, 3208, 46264, 39944,
+ 53560, 45960, 42424, 54024, 45624, 31368, 30392, 10760,
+ 29496, 24968, 10168, 41224, 5176, 26760, 47288, 14344,
+ 38200, 36744, 10680, 61192, 63032, 54920, 31416},
+{9, 20191, 4729, 50671, 52713, 31743, 41561, 33039, 65481,
+ 58655, 22073, 47151, 5545, 2623, 44569, 60239, 36745,
+ 27487, 10745, 39535, 60777, 34943, 18905, 17807, 44873,
+ 57759, 36281, 27823, 21801, 63167, 30105, 36815, 24329,
+ 18399, 33145, 12015, 19689, 21759, 12633, 51727},
+{10, 36998, 19818, 27174, 58570, 35270, 9770, 36710,
+ 29066, 6918, 9962, 52390, 42570, 17478, 20394, 8678,
+ 33546, 1414, 41066, 36646, 1994, 24262, 6442, 5222,
+ 13450, 20486, 47594, 45478, 2378, 55622, 33450, 26342,
+ 34314, 64134, 29546, 13350, 43722, 46022, 35882, 6502},
+{11, 53805, 34907, 3677, 64427, 38797, 43515, 40381, 58187,
+ 20717, 63387, 57629, 14059, 32333, 61755, 22653, 30347,
+ 40877, 5851, 33757, 8747, 13581, 59515, 58173, 47563,
+ 48749, 58907, 63133, 48491, 48077, 36795, 15869, 44299,
+ 44333, 25947, 14685, 2219, 4749, 59131, 26813},
+{12, 5076, 49996, 45716, 4748, 42324, 11724, 44052, 21772,
+ 34516, 51276, 62868, 51084, 47188, 37580, 36628, 27148,
+ 14804, 36172, 30868, 15500, 2900, 47052, 45588, 16140,
+ 11476, 4684, 15252, 29068, 40532, 40140, 5396, 54284,
+ 24532, 22348, 16020, 26252, 29012, 16844, 47124},
+{13, 21883, 65085, 22219, 10605, 45851, 45469, 47723,
+ 50893, 48315, 39165, 2571, 22573, 62043, 13405, 50603,
+ 23949, 54267, 957, 27979, 22253, 57755, 34589, 33003,
+ 50253, 39739, 15997, 32907, 9645, 32987, 43485, 60459,
+ 64269, 4731, 18749, 17355, 50285, 53275, 40093, 1899},
+{14, 38690, 14638, 64258, 16462, 49378, 13678, 51394,
+ 14478, 62114, 27054, 7810, 59598, 11362, 54766, 64578,
+ 20750, 28194, 31278, 25090, 29006, 47074, 22126, 20418,
+ 18830, 2466, 27310, 50562, 55758, 25442, 46830, 49986,
+ 8718, 50466, 15150, 18690, 8782, 12002, 63342, 22210},
+{15, 55497, 29727, 40761, 22319, 52905, 47423, 55065,
+ 43599, 10377, 14943, 13049, 31087, 26217, 30591, 13017,
+ 17551, 2121, 61599, 22201, 35759, 36393, 9663, 7833,
+ 52943, 30729, 38623, 2681, 36335, 17897, 50175, 39513,
+ 18703, 30665, 11551, 20025, 32815, 36265, 21055, 42521},
+{16, 6768, 44816, 17264, 28176, 56432, 15632, 58736, 7184,
+ 24176, 2832, 18288, 2576, 41072, 6416, 26992, 14352, 41584,
+ 26384, 19312, 42512, 25712, 62736, 60784, 21520, 58992,
+ 49936, 20336, 16912, 10352, 53520, 29040, 28688, 10864,
+ 7952, 21360, 56848, 60528, 44304, 62832},
+{17, 23575, 59905, 59303, 34033, 59959, 49377, 62407, 36305,
+ 37975, 56257, 23527, 39601, 55927, 47777, 40967, 11153,
+ 15511, 56705, 16423, 49265, 15031, 50273, 48199, 55633,
+ 21719, 61249, 37991, 63025, 2807, 56865, 18567, 38673, 56599,
+ 4353, 22695, 15345, 19255, 2017, 17607},
+{18, 40382, 9458, 35806, 39890, 63486, 17586, 542, 65426, 51774,
+ 44146, 28766, 11090, 5246, 23602, 54942, 7954, 54974, 21490,
+ 13534, 56018, 4350, 37810, 35614, 24210, 49982, 7026, 55646,
+ 43602, 60798, 60210, 8094, 48658, 36798, 754, 24030, 39378,
+ 43518, 25266, 37918},
+{19, 57189, 24547, 12309, 45747, 1477,
+ 51331, 4213, 29011, 37, 32035, 34005, 48115, 20101, 64963, 3381,
+ 4755, 28901, 51811, 10645, 62771, 59205, 25347, 23029, 58323,
+ 12709, 18339, 7765, 24179, 53253, 63555, 63157, 58643, 16997,
+ 62691, 25365, 63411, 2245, 48515, 58229},
+{20, 8460, 39636, 54348, 51604, 5004, 19540, 7884, 58132, 13836,
+ 19924, 39244, 19604, 34956, 40788, 17356, 1556, 2828, 16596,
+ 7756, 3988, 48524, 12884, 10444, 26900, 40972, 29652, 25420,
+ 4756, 45708, 1364, 52684, 3092, 62732, 59092, 26700, 21908,
+ 26508, 6228, 13004}
+};
+
+
+// can replace aa and nuc table with this master table.
+
+static const unsigned apnmodtxt[27][41] = { {0},
+{1,16807,15089,42039,5857,3527,33745,3671,
+ 29121,13799,53425,5239,37025,14855,41361,
+ 13975,62337,39463,30321,62647,6753,54855,
+ 53073,52951,34113,28263,11313,17655,46113,
+ 57991,3345,55063,9985,45735,61937,1335,
+ 24033,24263,23249,20311,55489},
+{2,33614,30178,18542,11714,7054,1954,7342,
+ 58242,27598,41314,10478,8514,29710,17186,
+ 27950,59138,13390,60642,59758,13506,44174,
+ 40610,40366,2690,56526,22626,35310,26690,
+ 50446,6690,44590,19970,25934,58338,2670,
+ 48066,48526,46498,40622,45442},
+{3,50421,45267,60581,17571,10581,35699,11013,
+ 21827,41397,29203,15717,45539,44565,58547,
+ 41925,55939,52853,25427,56869,20259,33493,
+ 28147,27781,36803,19253,33939,52965,7267,
+ 42901,10035,34117,29955,6133,54739,4005,
+ 6563,7253,4211,60933,35395},
+{4,1692,60356,37084,23428,14108,3908,14684,
+ 50948,55196,17092,20956,17028,59420,34372,
+55900,52740,26780,55748,53980,27012,22812,
+15684,15196,5380,47516,45252,5084,53380,
+35356,13380,23644,39940,51868,51140,5340,
+30596,31516,27460,15708,25348},
+{5,18499,9909,13587,29285,17635,37653,18355,
+14533,3459,4981,26195,54053,8739,10197,4339,
+49541,707,20533,51091,33765,12131,3221,2611,
+39493,10243,56565,22739,33957,27811,16725,
+13171,49925,32067,47541,6675,54629,55779,
+50709,36019,15301},
+{6,35306,24998,55626,35142,21162,5862,22026,
+43654,17258,58406,31434,25542,23594,51558,
+18314,46342,40170,50854,48202,40518,1450,
+56294,55562,8070,38506,2342,40394,14534,
+20266,20070,2698,59910,12266,43942,8010,
+13126,14506,8422,56330,5254},
+{7,52113,40087,32129,40999,24689,39607,25697,
+7239,31057,46295,36673,62567,38449,27383,32289,
+43143,14097,15639,45313,47271,56305,43831,42977,
+42183,1233,13655,58049,60647,12721,23415,57761,
+4359,58001,40343,9345,37159,38769,31671,11105,
+60743},
+{8,3384,55176,8632,46856,28216,7816,29368,36360,
+44856,34184,41912,34056,53304,3208,46264,39944,
+53560,45960,42424,54024,45624,31368,30392,10760,
+29496,24968,10168,41224,5176,26760,47288,14344,
+38200,36744,10680,61192,63032,54920,31416,50696},
+{9,20191,4729,50671,52713,31743,41561,33039,65481,
+58655,22073,47151,5545,2623,44569,60239,36745,
+27487,10745,39535,60777,34943,18905,17807,44873,
+57759,36281,27823,21801,63167,30105,36815,24329,
+18399,33145,12015,19689,21759,12633,51727,40649},
+{10,36998,19818,27174,58570,35270,9770,36710,
+29066,6918,9962,52390,42570,17478,20394,8678,
+33546,1414,41066,36646,1994,24262,6442,5222,
+13450,20486,47594,45478,2378,55622,33450,26342,
+34314,64134,29546,13350,43722,46022,35882,6502,
+30602},
+{11,53805,34907,3677,64427,38797,43515,40381,
+58187,20717,63387,57629,14059,32333,61755,22653,
+30347,40877,5851,33757,8747,13581,59515,58173,
+47563,48749,58907,63133,48491,48077,36795,15869,
+44299,44333,25947,14685,2219,4749,59131,26813,
+20555},
+{12,5076,49996,45716,4748,42324,11724,44052,21772,
+34516,51276,62868,51084,47188,37580,36628,27148,
+14804,36172,30868,15500,2900,47052,45588,16140,
+11476,4684,15252,29068,40532,40140,5396,54284,
+24532,22348,16020,26252,29012,16844,47124,10508},
+{13,21883,65085,22219,10605,45851,45469,47723,
+50893,48315,39165,2571,22573,62043,13405,50603,
+23949,54267,957,27979,22253,57755,34589,33003,
+50253,39739,15997,32907,9645,32987,43485,60459,
+64269,4731,18749,17355,50285,53275,40093,1899,461},
+{14,38690,14638,64258,16462,49378,13678,51394,
+14478,62114,27054,7810,59598,11362,54766,64578,
+20750,28194,31278,25090,29006,47074,22126,20418,
+18830,2466,27310,50562,55758,25442,46830,49986,
+8718,50466,15150,18690,8782,12002,63342,22210,55950},
+{15,55497,29727,40761,22319,52905,47423,55065,
+43599,10377,14943,13049,31087,26217,30591,13017,
+17551,2121,61599,22201,35759,36393,9663,7833,
+52943,30729,38623,2681,36335,17897,50175,39513,
+18703,30665,11551,20025,32815,36265,21055,42521,
+45903},
+{16,6768,44816,17264,28176,56432,15632,58736,
+7184,24176,2832,18288,2576,41072,6416,26992,
+14352,41584,26384,19312,42512,25712,62736,60784,
+21520,58992,49936,20336,16912,10352,53520,29040,
+28688,10864,7952,21360,56848,60528,44304,62832,
+35856},
+{17,23575,59905,59303,34033,59959,49377,62407,
+36305,37975,56257,23527,39601,55927,47777,40967,
+11153,15511,56705,16423,49265,15031,50273,48199,
+55633,21719,61249,37991,63025,2807,56865,18567,
+38673,56599,4353,22695,15345,19255,2017,17607,
+25809},
+{18,40382,9458,35806,39890,63486,17586,542,
+65426,51774,44146,28766,11090,5246,23602,54942,
+7954,54974,21490,13534,56018,4350,37810,35614,
+24210,49982,7026,55646,43602,60798,60210,8094,
+48658,36798,754,24030,39378,43518,25266,37918,
+15762},
+{19,57189,24547,12309,45747,1477,51331,4213,
+29011,37,32035,34005,48115,20101,64963,3381,
+4755,28901,51811,10645,62771,59205,25347,
+23029,58323,12709,18339,7765,24179,53253,
+63555,63157,58643,16997,62691,25365,63411,
+2245,48515,58229,5715},
+{20,8460,39636,54348,51604,5004,19540,7884,
+58132,13836,19924,39244,19604,34956,40788,
+17356,1556,2828,16596,7756,3988,48524,12884,
+10444,26900,40972,29652,25420,4756,45708,
+1364,52684,3092,62732,59092,26700,21908,
+26508,6228,13004,61204},
+{21,25267,54725,30851,57461,8531,53285,11555,
+21717,27635,7813,44483,56629,49811,16613,31331,
+63893,42291,46917,4867,10741,37843,421,63395,
+61013,3699,40965,43075,50869,38163,4709,42211,
+13077,42931,55493,28035,45941,50771,29477,
+33315,51157},
+{22,42074,4278,7354,63318,12058,21494,15226,
+50838,41434,61238,49722,28118,64666,57974,
+45306,60694,16218,11702,1978,17494,27162,
+53494,50810,29590,31962,52278,60730,31446,
+30618,8054,31738,23062,23130,51894,29370,
+4438,9498,52726,53626,41110},
+{23,58881,19367,49393,3639,15585,55239,18897,
+14423,55233,49127,54961,65143,13985,33799,
+59281,57495,55681,42023,64625,24247,16481,
+41031,38225,63703,60225,63591,12849,12023,
+23073,11399,21265,33047,3329,48295,30705,
+28471,33761,10439,8401,31063},
+{24,10152,34456,25896,9496,19112,23448,22568,
+43544,3496,37016,60200,36632,28840,9624,7720,
+54296,29608,6808,61736,31000,5800,28568,25640,
+32280,22952,9368,30504,58136,15528,14744,10792,
+43032,49064,44696,32040,52504,58024,33688,28712,
+21016},
+{25,26959,49545,2399,15353,22639,57193,26239,7129,
+17295,24905,65439,8121,43695,50985,21695,51097,3535,
+37129,58847,37753,60655,16105,13055,857,51215,20681,
+48159,38713,7983,18089,319,53017,29263,41097,33375,
+11001,16751,56937,49023,10969},
+{26,43766,64634,44438,21210,26166,25402,29910,36250,
+31094,12794,5142,45146,58550,26810,35670,47898,42998,
+1914,55958,44506,49974,3642,470,34970,13942,31994,278,
+19290,438,21434,55382,63002,9462,37498,34710,35034,
+41014,14650,3798,922}
+};
+
+//use config.h and configure to take care of these define statements
+//On Cygwin GNU this is part of the library
+char *strupr(char *);
+
+#ifndef HAVE_STRUPR
+//On Linux 2.6.18-194.11.3.el5 this is not part of the library
+char *strupr(char *s)
+{
+ char *t = (char *)chkmalloc(sizeof(char),strlen(s));
+ char *r;
+ strcpy(t, s);
+ r = t;
+ while (*t != '\0') {
+ *t = toupper((int) *t);
+ t++;
+ }
+ return r;
+}
+#endif
+
+
+
+// buckets is 20013
+// inverse of 5 mod buckets is 12008 mod buckets
+
+// It seems possible to implement the building of
+// the hash value in the reverse direction so that
+// we don't need to know the length of the string.
+
+int hashAdd(HASH * h, char *s, unsigned val)
+{
+ int i = 0;
+ int k = h->k;
+ NODE *ptr;
+ NODE *r;
+ unsigned int idx = 0;
+
+ h->st_hash = h->rt_hash = 0;
+ // isolate in its own hash function.
+
+ if (h->isClass)
+ ry(s, h->k);
+
+ while (k > 0) {
+ k--;
+ idx += apnmod[h->hashi[(unsigned char) s[i]]][k];
+ idx &= MOD2P16;
+ i++;
+ }
+
+
+ if (h->reverse) {
+ strcpy(h->r, s);
+ rev(h->r, h->k);
+ complement(h->r, h->k);
+ k = h->k;
+ i = 0;
+ while (k > 0) {
+ k--;
+ h->rt_hash += apnmod[h->hashi[(unsigned char) h->r[i]]][k];
+ h->rt_hash &= MOD2P16;
+ i++;
+ }
+ if (h->rt_hash < idx) {
+ idx = h->rt_hash;
+ s = h->r;
+ }
+ }
+
+ ptr = h->table[idx];
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, s) == 0) {
+ ptr->value += val;
+ return 1;
+ }
+ ptr = ptr->next;
+ }
+
+ r = (NODE *)chkmalloc(sizeof(NODE),1);
+ r->key = (char *)chkmalloc(sizeof(char), h->k + 1);
+ strcpy(r->key, strupr(s));
+ r->value = val;
+ r->next = h->table[idx];
+ h->table[idx] = r;
+ h->keyN++;
+ return -1;
+}
+
+//@todo test that string reversal w/ mask is working properly
+
+int hashAddw(HASH * h, char *s, unsigned val)
+{
+ int i = 0;
+ int k = h->k;
+ NODE *ptr;
+ NODE *r;
+ unsigned int idx = 0;
+ int j;
+
+ // reseting the hash might be unnecessary.
+ // aslo using the hash types internal values
+ // might not be needed, that way pushes and lookups can be mixed.
+ if (h->isClass)
+ ry(s, h->k);
+
+ while (k > 0) {
+ k--;
+ idx += apnmod[h->hashi[(unsigned char) s[i]]][k];
+ idx &= MOD2P16;
+ i++;
+ }
+ if (h->reverse) {
+ h->rt_hash = 0;
+ strcpy(h->r, s);
+ rev(h->r, h->k);
+ complement(h->r, h->k);
+ k = h->k;
+ i = 0;
+ while (k > 0) {
+ k--;
+ h->rt_hash += apnmod[h->hashi[(unsigned char) h->r[i]]][k];
+ h->rt_hash &= MOD2P16;
+ i++;
+ }
+ if (h->rt_hash < idx) {
+ idx = h->rt_hash;
+ s = h->r;
+ }
+ }
+
+
+ ptr = h->table[idx];
+
+ for (j = 0; j < h->k; j++)
+ if (weightVector[j] == '0') {
+ idx -= apnmod[h->hashi[(unsigned char) s[j]]][h->k - j - 1];
+ idx &= MOD2P16;
+ }
+
+
+ while (ptr != NULL) {
+ if (new_strcmpw(ptr->key, s) == 0) {
+ ptr->value += val;
+ return 1;
+ }
+ ptr = ptr->next;
+ }
+
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char), h->k + 1);
+ strcpy(r->key, strupr(s));
+ r->value = val;
+ r->next = h->table[idx];
+ h->table[idx] = r;
+ h->keyN++;
+ return -1;
+
+}
+
+
+int hashAddaa(HASH * h, char *s, unsigned val)
+{
+ int i = 0;
+ int k = h->k;
+ NODE *ptr;
+ NODE *r;
+ unsigned int idx = 0;
+
+ h->st_hash = 0;
+ // isolate in its own hash function.
+
+ if (h->isClass)
+ _class(s, h->k);
+
+ while (k > 0) {
+ k--;
+ idx += apnmodaa[h->hashi[(unsigned char) s[i]]][k];
+ idx &= MOD2P16;
+ i++;
+ }
+
+
+ ptr = h->table[idx];
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, s) == 0) {
+ ptr->value += val;
+ return 1;
+ }
+ ptr = ptr->next;
+ }
+
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char),h->k + 1);
+ strcpy(r->key, strupr(s));
+ r->value = val;
+ r->next = h->table[idx];
+ h->table[idx] = r;
+ h->keyN++;
+ return -1;
+}
+
+
+
+
+int hashAddtxt(HASH * h, char *s, unsigned val)
+{
+ int i = 0;
+ int k = h->k;
+ NODE *ptr;
+ NODE *r;
+ unsigned int idx = 0;
+
+ h->st_hash = 0;
+
+ while (k > 0) {
+ k--;
+ idx += apnmodtxt[h->hashi[(unsigned char) s[i]]][k];
+ idx &= MOD2P16;
+ i++;
+ }
+
+
+ ptr = h->table[idx];
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, s) == 0) {
+ ptr->value += val;
+ return 1;
+ }
+ ptr = ptr->next;
+ }
+
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char),h->k + 1);
+ strcpy(r->key, strupr(s));
+ r->value = val;
+ r->next = h->table[idx];
+ h->table[idx] = r;
+ h->keyN++;
+ return -1;
+}
+
+
+
+
+
+//Note these should be changed to Assign val.
+int hashAddwaa(HASH * h, char *s, unsigned val)
+{
+ int i = 0;
+ int k = h->k;
+ NODE *ptr;
+ NODE *r;
+ unsigned int idx = 0;
+ int j;
+
+ if (h->isClass)
+ _class(s, h->k);
+
+ while (k > 0) {
+ k--;
+ idx += apnmodaa[h->hashi[(unsigned char) s[i]]][k];
+ idx &= MOD2P16;
+ i++;
+ }
+
+
+ for (j = 0; j < h->k; j++)
+ if (weightVector[j] == '0') {
+ idx -= apnmodaa[h->hashi[(unsigned char) s[j]]][h->k - j - 1];
+ idx &= MOD2P16;
+ }
+
+ ptr = h->table[idx];
+ while (ptr != NULL) {
+ if (new_strcmpw(ptr->key, s) == 0) {
+ ptr->value += val;
+ return 1;
+ }
+ ptr = ptr->next;
+ }
+
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char),h->k + 1);
+ strcpy(r->key, strupr(s));
+ r->value = val;
+ r->next = h->table[idx];
+ h->table[idx] = r;
+ h->keyN++;
+ return 0;
+}
+
+
+unsigned int hashValNuc(HASH * h, register char *s)
+{
+ int i = 0;
+ int k = h->k;
+ NODE *ptr;
+ h->st_hash = h->rt_hash = 0;
+ unsigned int idx;
+ // isolate in its own hash function.
+
+ while (k > 0) {
+ k--;
+ h->st_hash += apnmod[h->hashi[(unsigned char) s[i]]][k];
+ h->st_hash &= MOD2P16;
+ i++;
+ }
+ idx = h->st_hash;
+
+ //only applies to Nucleotides.
+ if (h->reverse) {
+ strcpy(h->r, s);
+ rev(h->r, h->k);
+ complement(h->r, h->k);
+ k = h->k;
+ i = 0;
+ while (k > 0) {
+ k--;
+ h->rt_hash += apnmod[h->hashi[(unsigned char) h->r[i]]][k];
+ h->rt_hash &= MOD2P16;
+ i++;
+ }
+ if (h->rt_hash < idx) {
+ idx = h->rt_hash;
+ s = h->r;
+ }
+ }
+ ptr = h->table[idx];
+
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, s) == 0)
+ return ptr->value;
+ ptr = ptr->next;
+ }
+
+ return 0;
+}
+
+
+int hashAssign(HASH * h, register char *s, unsigned int val)
+{
+ int i = 0;
+ int k = h->k;
+ NODE *ptr;
+ h->st_hash = 0;
+ static const unsigned mask = 0x0000ffff;
+
+ // isolate in its own hash function.
+
+ while (k > 0) {
+ k--;
+ h->st_hash += apnmod[h->hashi[(unsigned char) s[i]]][k];
+ h->st_hash &= mask;
+ i++;
+ }
+
+ ptr = h->table[h->st_hash];
+
+ while (ptr != NULL) {
+ if ((*(h->strcmpf)) (ptr->key, s) == 0) {
+ ptr->value = val;
+ return 1;
+ }
+ ptr = ptr->next;
+ }
+
+ return 0;
+}
+
+
+
+
+
+/* Established a new convention: We no longer make lookups to check whether
+ * the reverse complement feature is stored in
+ * the hash, we simply do this: Scanning and hashing of the sequence is done
+ * in the forward direction.
+ * We make the decision to physically store a key as in the reverse or forward direction
+ * within the hash table: using this criterion:
+ * Whichever word would come first if alphabetically sorted is placed in the hash.
+ * Therefore ATG is printed instead of its reverse complement word CAT. With a reverse complement
+ * palindrome of course both are equivalent. By doing this we can half the number
+ * of lookups. */
+
+// Use define templates to reduce the overall code size
+
+void pushatgc(HASH * h, char *c, int n,bool firstRecord)
+{
+ //calculate hash
+ NODE *ptr;
+ NODE *r;
+ static int inHeader = 0;
+ unsigned char index;
+ char *s;
+ unsigned *idx;
+ extern bool mflag; // global value indicating process multiple headers
+ int i;
+
+ for (i = 0; i < n; i++) {
+ // Buffer and process several bases at once.
+ // Skip over header defline.
+ //
+ if (c[i] == '>' || inHeader) {
+ inHeader = 1;
+ // gulp up header
+ while (c[i] != '\n' && i < n)
+ i++;
+
+ // check to see if we're done processing header
+ if (i < n)
+ inHeader = 0;
+ else
+ return;
+
+ //@todo add warning for not finding any keys.
+ // In this case no warnings will be produced when
+ // no keys are found.
+ if (mflag && !firstRecord)
+ printFeatures(h);
+
+ if (firstRecord)
+ firstRecord=false;
+
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+
+ }
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (h->isClass)
+ c[i] = atgc_to_ry(c[i]);
+ //invalid character reset hash
+
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+ }
+
+
+ c[i] = toupper((int) c[i]);
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmod[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ if (h->reverse)
+ h->rt_hash -=
+ apnmod[h->hashi[(unsigned char) h->r[h->k - 1]]][0];
+ } else
+ h->numChar++;
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+ if (h->reverse) { //save time by using function w/o test
+
+ memmove(&h->r[1], h->r, h->k - 1);
+ h->r[0] = flip(c[i]);
+
+ h->rt_hash *= IAMOD2P16;
+ h->rt_hash &= MOD2P16;
+ h->rt_hash += apnmod[h->hashi[(unsigned char) c[i]]][h->k - 1];
+ h->rt_hash &= MOD2P16;
+ }
+
+
+ if (h->numChar == h->k) {
+
+ s = h->s;
+ idx = &h->st_hash;
+
+ if (h->reverse) {
+ if (h->st_hash > h->rt_hash) {
+ s = h->r;
+ idx = &h->rt_hash;
+ }
+ }
+
+
+ ptr = h->table[*idx];
+
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+
+ //correct this error in all instances.
+
+ if (ptr == NULL) { // Possibly redesign
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char),h->k + 1);
+ strcpy(r->key, s);
+ r->value = 1;
+ r->next = h->table[*idx];
+ h->table[*idx] = r;
+ h->keyN++;
+ }
+
+ }
+ }
+ //should never see
+ return;
+}
+
+
+void chkpushatgc(HASH * h, char *c, int n,bool firstRecord)
+{
+ //calculate hash
+ NODE *ptr;
+ static int inHeader = 0;
+ unsigned char index;
+ char *s;
+ unsigned *idx;
+ extern bool mflag;
+ int i;
+ for (i = 0; i < n; i++) {
+ if (c[i] == '>' || inHeader) {
+ inHeader = 1;
+ // gulp up header
+ while (c[i] != '\n' && i < n) {
+ i++;
+ }
+
+ if (i < n)
+ inHeader = 0;
+ else
+ return;
+
+ if (mflag && !firstRecord)
+ printFeatures(h);
+
+ if (firstRecord)
+ firstRecord=false;
+
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+
+ }
+
+
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (h->isClass)
+ c[i] = atgc_to_ry(c[i]);
+ //invalid character reset hash
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+ }
+
+
+ if (h->numChar == h->k) {
+ if (h->reverse)
+ h->rt_hash -=
+ apnmod[h->hashi[(unsigned char) h->r[h->k - 1]]][0];
+ h->st_hash -= apnmod[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ } else
+ h->numChar++;
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+
+ if (h->reverse) {
+ memmove(&h->r[1], h->r, h->k - 1);
+ h->r[0] = flip(c[i]);
+ h->rt_hash *= IAMOD2P16;
+ h->rt_hash &= MOD2P16;
+ h->rt_hash += apnmod[h->hashi[(unsigned char) c[i]]][h->k - 1];
+ h->rt_hash &= MOD2P16;
+ }
+
+
+ if (h->numChar == h->k) {
+ s = h->s;
+ idx = &h->st_hash;
+
+
+ if (h->reverse) {
+ if (h->st_hash > h->rt_hash) {
+ s = h->r;
+ idx = &h->rt_hash;
+ }
+ }
+
+ ptr = h->table[*idx];
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+ }
+ }
+ //should never see
+ return;
+}
+
+
+
+void chkpushatgcw(HASH * h, char *c, int n,bool firstRecord)
+{
+ //calculate hash
+ NODE *ptr;
+ static int inHeader = 0;
+ unsigned char index;
+ char *s;
+ unsigned int idx;
+ extern bool mflag;
+ int i, j;
+ for (i = 0; i < n; i++) {
+ // It might be possible to buffer this so that we process several bases at once.
+ // w/o the expense of a function call every base.
+ // avoid the unsigned char casts, just declare as unsigned char
+ if (c[i] == '>' || inHeader) {
+ inHeader = 1;
+ // gulp up header
+ while (c[i] != '\n' && i < n) {
+ i++;
+ }
+
+ if (i < n)
+ inHeader = 0;
+ else
+ return;
+
+ if (mflag && !firstRecord)
+ printFeatures(h);
+
+ if (firstRecord)
+ firstRecord=false;
+
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+
+ }
+
+
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (h->isClass)
+ c[i] = atgc_to_ry(c[i]);
+ //invalid character reset hash
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+ }
+
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmod[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ if (h->reverse)
+ h->rt_hash -=
+ apnmod[h->hashi[(unsigned char) h->r[h->k - 1]]][0];
+ } else
+ h->numChar++;
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+ if (h->reverse) {
+ memmove(&h->r[1], h->r, h->k - 1);
+ h->r[0] = flip(c[i]);
+ h->rt_hash *= IAMOD2P16;
+ h->rt_hash &= MOD2P16;
+ h->rt_hash += apnmod[h->hashi[(unsigned char) c[i]]][h->k - 1];
+ h->rt_hash &= MOD2P16;
+ }
+
+
+ if (h->numChar == h->k) {
+ s = h->s;
+ idx = h->st_hash;
+
+ if (h->reverse) {
+ if (h->st_hash > h->rt_hash) {
+ s = h->r;
+ idx = h->rt_hash;
+ }
+ }
+
+ for (j = 0; j < h->k; j++)
+ if (weightVector[j] == '0') {
+ idx -= apnmod[h->hashi[(unsigned char) s[j]]][h->k - j - 1];
+ idx &= MOD2P16;
+ }
+
+
+ ptr = h->table[idx];
+ while (ptr != NULL) {
+ if (new_strcmpw(ptr->key, s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+ }
+ }
+ //should never see
+ return;
+}
+
+
+
+
+
+void pushatgcw(HASH * h, char *c, int n,bool firstRecord)
+{
+ //calculate hash
+ NODE *ptr;
+ NODE *r;
+ static int inHeader = 0;
+ unsigned char index;
+ char *s;
+ unsigned idx;
+ extern bool mflag;
+ int i, j;
+
+
+ for (i = 0; i < n; i++) {
+
+
+ // It might be possible to buffer this so that we process several bases at once.
+ // w/o the expense of a function call every base.
+ // avoid the unsigned char casts, just declare as unsigned char
+ if (c[i] == '>' || inHeader) {
+ inHeader = 1;
+ // gulp up header
+ while (c[i] != '\n' && i < n) {
+ i++;
+ }
+
+ if (i < n)
+ inHeader = 0;
+ else
+ return;
+
+ if (mflag && !firstRecord)
+ printFeatures(h);
+
+ if (firstRecord)
+ firstRecord=false;
+
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+ }
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (h->isClass)
+ c[i] = atgc_to_ry(c[i]);
+
+ //invalid character reset hash
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+ }
+
+
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmod[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ if (h->reverse)
+ h->rt_hash -=
+ apnmod[h->hashi[(unsigned char) h->r[h->k - 1]]][0];
+ } else
+ h->numChar++;
+
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+
+
+ if (h->reverse) {
+ memmove(&h->r[1], h->r, h->k - 1);
+ h->r[0] = flip(c[i]);
+ h->rt_hash *= IAMOD2P16;
+ h->rt_hash &= MOD2P16;
+ h->rt_hash += apnmod[h->hashi[(unsigned char) c[i]]][h->k - 1];
+ h->rt_hash &= MOD2P16;
+ }
+ // now perform mask transformation
+ if (h->numChar == h->k) {
+ s = h->s;
+ idx = h->st_hash;
+
+
+
+
+ if (h->reverse) {
+ if (h->st_hash > h->rt_hash) {
+ s = h->r;
+ idx = h->rt_hash;
+ }
+ }
+ //apply weight mask
+ for (j = 0; j < h->k; j++)
+ if (weightVector[j] == '0') {
+ idx -= apnmod[h->hashi[(unsigned char) s[j]]][h->k - j - 1];
+ idx &= MOD2P16;
+ }
+
+
+ ptr = h->table[idx];
+
+ while (ptr != NULL) {
+ if (new_strcmpw(ptr->key, s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+
+ if (ptr == NULL) {
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char),h->k + 1);
+ strcpy(r->key, s);
+ r->value = 1;
+ r->next = h->table[idx];
+ h->table[idx] = r;
+ h->keyN++;
+ }
+ }
+ }
+ return;
+}
+
+
+/* Established a new convention: We no longer make lookups to check whether
+ * the reverse complement feature is stored in
+ * the hash, we simply do this: Scanning and hashing of the sequence is done
+ * in the forward direction.
+ * We make the decision to physically store a key as in the reverse or forward direction
+ * within the hash table: using this criterion:
+ * Whichever word would come first if alphabetically sorted is placed in the hash.
+ * Therefore ATG is printed instead of its reverse complement word CAT. With a reverse complement
+ * palindrome of course both are equivalent. By doing this we can half the number
+ * of lookups. */
+
+// Use define templates to reduce the overall code size
+
+
+
+void pushaa(HASH * h, char *c, int n,bool firstRecord)
+{
+ //calculate hash
+ NODE *ptr;
+ NODE *r;
+ static int inHeader = 0;
+ unsigned char index;
+ char *s;
+ unsigned *idx;
+ extern bool mflag;
+ int i;
+ for (i = 0; i < n; i++) {
+ // It might be possible to buffer this so that we process several bases at once.
+ // w/o the expense of a function call every base.
+ // avoid the unsigned char casts, just declare as unsigned char
+ if (c[i] == '>' || inHeader) {
+ inHeader = 1;
+ // gulp up header
+ while (c[i] != '\n' && i < n) {
+ i++;
+ }
+
+ if (i < n)
+ inHeader = 0;
+ else
+ return;
+
+ if (mflag && !firstRecord)
+ printFeatures(h);
+
+ if (firstRecord)
+ firstRecord=false;
+
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+
+ }
+
+
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (h->isClass)
+ c[i] = aa_to_class(c[i]);
+ //invalid character reset hash
+
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = 0;
+ continue;
+ }
+
+ c[i] = toupper((int) c[i]);
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmodaa[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ } else
+ h->numChar++;
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+
+ if (h->numChar == h->k) {
+ s = h->s; //no longer needed
+ idx = &h->st_hash; //ditto
+
+ ptr = h->table[*idx];
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+
+ if (ptr == NULL) {
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char),h->k + 1);
+ strcpy(r->key, s);
+ r->value = 1;
+ r->next = h->table[*idx];
+ h->table[*idx] = r;
+ h->keyN++;
+ }
+ }
+ }
+ return;
+}
+
+
+
+void chkpushaa(HASH * h, char *c, int n,bool firstRecord)
+{
+ //calculate hash
+ NODE *ptr;
+ static int inHeader = 0;
+ unsigned char index;
+ char *s;
+ unsigned *idx;
+ extern bool mflag;
+ int i;
+ for (i = 0; i < n; i++) {
+ if (c[i] == '>' || inHeader) {
+ inHeader = 1;
+ // gulp up header
+ while (c[i] != '\n' && i < n) {
+ i++;
+ }
+
+ if (i < n)
+ inHeader = 0;
+ else
+ return;
+
+ if (mflag && !firstRecord)
+ printFeatures(h);
+
+ if (firstRecord)
+ firstRecord=false;
+
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+
+ }
+
+
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (h->isClass)
+ c[i] = aa_to_class(c[i]);
+ //invalid character reset hash
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = 0;
+ continue;
+ }
+
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmodaa[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ } else
+ h->numChar++;
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+ if (h->numChar == h->k) {
+ s = h->s; // remove
+ idx = &h->st_hash; //ditto
+
+ ptr = h->table[*idx];
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+ }
+ }
+ //should never see
+ return;
+}
+
+
+
+void chkpushaaw(HASH * h, char *c, int n, bool firstRecord)
+{
+ //calculate hash
+ NODE *ptr;
+ static int inHeader = 0;
+ unsigned char index;
+ unsigned int idx;
+ extern bool mflag;
+
+ int i, j;
+ for (i = 0; i < n; i++) {
+ // It might be possible to buffer this so that we process several bases at once.
+ // w/o the expense of a function call every base.
+ // avoid the unsigned char casts, just declare as unsigned char
+ if (c[i] == '>' || inHeader) {
+ inHeader = 1;
+ // gulp up header
+ while (c[i] != '\n' && i < n) {
+ i++;
+ }
+
+ if (i < n)
+ inHeader = 0;
+ else
+ return;
+
+ if (mflag && !firstRecord)
+ printFeatures(h);
+
+ if (firstRecord)
+ firstRecord=false;
+
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+
+ }
+
+
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (h->isClass)
+ c[i] = aa_to_class(c[i]);
+
+ //invalid character reset hash
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = 0;
+ continue;
+ }
+
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmodaa[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ } else
+ h->numChar++;
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+ if (h->numChar == h->k) {
+ idx = h->st_hash;
+ for (j = 0; j < h->k; j++)
+ if (weightVector[j] == '0') {
+ idx -=
+ apnmodaa[h->hashi[(unsigned char) h->s[j]]][h->k - j -
+ 1];
+ idx &= MOD2P16;
+ }
+
+ ptr = h->table[idx];
+ while (ptr != NULL) {
+ if (new_strcmpw(ptr->key, h->s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+ }
+ }
+ return;
+}
+
+
+void chkpushtxt(HASH * h, char *c, int n)
+{
+ //calculate hash
+ NODE *ptr;
+ unsigned char index;
+ int i;
+ for (i = 0; i < n; i++) {
+
+
+
+ if (isspace((int) c[i]))
+ continue;
+
+ //invalid character reset hash
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = 0;
+ continue;
+ }
+
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmodtxt[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ } else
+ h->numChar++;
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+ if (h->numChar == h->k) {
+ ptr = h->table[h->st_hash];
+ while (ptr != NULL) {
+ if (strcmp(ptr->key, h->s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+ }
+ }
+ //should never see
+ return;
+}
+
+
+
+
+
+void pushaaw(HASH * h, char *c, int n,bool firstRecord)
+{
+ //calculate hash
+ NODE *ptr;
+ NODE *r;
+ static int inHeader = 0;
+ unsigned char index;
+ char *s;
+ unsigned idx;
+ extern bool mflag;
+ int i, j;
+
+
+ for (i = 0; i < n; i++) {
+
+ if (c[i] == '>' || inHeader) {
+ inHeader = 1;
+ // gulp up header
+ while (c[i] != '\n' && i < n) {
+ i++;
+ }
+
+ if (i < n)
+ inHeader = 0;
+ else
+ return;
+
+ if (mflag && !firstRecord)
+ printFeatures(h);
+
+ if (firstRecord)
+ firstRecord=false;
+
+ h->numChar = h->st_hash = h->rt_hash = 0;
+ continue;
+
+ }
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (h->isClass)
+ c[i] = aa_to_class(c[i]);
+
+ //invalid character reset hash
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash;
+ continue;
+ }
+
+
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmodaa[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ } else
+ h->numChar++;
+
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+ // now perform mask transformation
+ if (h->numChar == h->k) {
+ s = h->s;
+ idx = h->st_hash;
+
+
+ //apply weight mask
+ for (j = 0; j < h->k; j++)
+ if (weightVector[j] == '0') {
+ idx -=
+ apnmodaa[h->hashi[(unsigned char) s[j]]][h->k - j - 1];
+ idx &= MOD2P16;
+ }
+
+
+ ptr = h->table[idx];
+
+ while (ptr != NULL) {
+ if (new_strcmpw(ptr->key, s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+
+ if (ptr == NULL) {
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char),h->k + 1);
+ strcpy(r->key, s);
+ r->value = 1;
+ r->next = h->table[idx];
+ h->table[idx] = r;
+ h->keyN++;
+ }
+ }
+ }
+ return;
+}
+
+
+void pushtxt(HASH * h, char *c, int n)
+{
+ //calculate hash
+ NODE *ptr;
+ NODE *r;
+ unsigned char index;
+ int i;
+ for (i = 0; i < n; i++) {
+
+ if (isspace((int) c[i]))
+ continue;
+
+ if (!(index = h->hashi[(unsigned char) c[i]])) {
+ h->numChar = h->st_hash = 0;
+ continue;
+ }
+
+ c[i] = toupper((int) c[i]);
+
+ if (h->numChar == h->k) {
+ h->st_hash -= apnmodtxt[h->hashi[(unsigned char) h->s[0]]][h->k - 1];
+ } else
+ h->numChar++;
+
+ //push character
+ memmove(h->s, &h->s[1], h->k - 1);
+ h->s[h->k - 1] = c[i];
+
+
+
+ h->st_hash *= A;
+ h->st_hash &= MOD2P16;
+ h->st_hash += index;
+ h->st_hash &= MOD2P16;
+
+
+ if (h->numChar == h->k) {
+
+ ptr = h->table[h->st_hash];
+ while (ptr != NULL) {
+ if (strcmp(ptr->key,h->s) == 0) {
+ ptr->value++; // to make generic.
+ break;
+ }
+ ptr = ptr->next;
+ }
+
+ if (ptr == NULL) {
+ r = (NODE *) chkmalloc(sizeof(NODE),1);
+ r->key = (char *) chkmalloc(sizeof(char),h->k + 1);
+ strcpy(r->key, h->s);
+ r->value = 1;
+ r->next = h->table[h->st_hash];
+ h->table[h->st_hash] = r;
+ h->keyN++;
+ }
+ }
+ }
+ return;
+}
+
+
+
+
+/**
+ *
+ * Frees the memory allocated to store the hash
+ *
+ * All memory allocated with malloc is freed from the
+ * hash. All values are deleted. returns 0 on success.
+ * The number of hash keys is also returned to zero.
+ *
+ * @param None
+ * @retval 1 on success
+ *
+ *
+ */
+
+
+int freeHash(HASH * h)
+{
+ int i;
+ NODE *ptr;
+ NODE *last;
+ for (i = 0; i < BUCKETS; i++) {
+ ptr = h->table[i];
+ while (ptr != NULL) {
+ last = ptr;
+ ptr = ptr->next;
+ free(last->key);
+ free(last);
+ }
+ h->table[i] = NULL;
+ }
+ h->keyN = 0;
+ return 1;
+}
+
+
+/**
+ *
+ * Masked String comparison method used internally by the hash table functions.
+ *
+ * This function differs slightly from the library version of strcmp
+ * It short circuits when it finds the first difference in strings
+ * It is also declared inline so that the compiler has the option of
+ * substituting this code in directly. It is declared static so that
+ * it can only be used by the hash functions.
+ * Uses a feature mask, ignoring masked out features
+ *
+ * @param s a null terminated string
+ * @param t a null terminated string
+ * @retval 1 if s and t are equal
+ * @retval 0 if s and t are different
+ *
+ */
+
+//make static again.
+int new_strcmpw(register const char *s, register const char *t)
+{
+ char *w = weightVector;
+ while (*s != '\0')
+ if ((*w++) == '1') {
+ if ((*s++) != (*t++))
+ return 1;
+ } else {
+ s++;
+ t++;
+ }
+ return 0;
+}
+
+
+/**
+ *
+ * String comparison method used internally by the hash table functions.
+ *
+ * This function differs slightly from the library version of strcmp
+ * It short circuits when it finds the first difference in strings
+ * It is also declared inline so that the compiler has the option of
+ * substituting this code in directly. It is declared static so that
+ * it can only be used by the hash functions.
+ *
+ * @param s a null terminated string
+ * @param t a null terminated string
+ * @retval 1 if s and t are equal
+ * @ret val 0 if s and t are different
+ *
+ */
+
+
+
+
+
+//make static again
+int new_strcmp(const char *s, const char *t)
+{
+ while (*s != '\0') {
+ if ((*s++) != (*t++))
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ *
+ * returns a list of keys stored in the hash table
+ *
+ * This is function is used to return the values of the
+ * keys hashed into the table. No error checking is
+ * provided to make sure that enough memory has been
+ * allocated to store all the keys into the array of
+ * strings.
+ *
+ * @param s a pointer to an array of character arrays.
+ * @return None
+ *
+ */
+
+
+void hashKeys(HASH * h, char ***s)
+{
+ int i, j;
+ NODE *ptr;
+ *s = (char **) chkmalloc(sizeof(char *),h->keyN);
+ for (i = 0; i < h->keyN; i++)
+ (*s)[i] = (char *) chkmalloc(sizeof(char),h->k + 1);
+
+
+ i = 0;
+ for (j = 0; j < BUCKETS; j++)
+ if (h->table[j] != NULL) {
+ ptr = h->table[j];
+ while (ptr != NULL) {
+ strcpy((*s)[i++], ptr->key);
+ //printf("%s\n",ptr->key);
+ ptr = ptr->next;
+ }
+ }
+}
+
+
+/**
+ *
+ * returns a list of values stored in the hash table
+ *
+ * This is function is used to return the values of the
+ * keys hashed into the table. No error checking is
+ * provided to make sure that enough memory has been
+ * allocated to store all the values into an array
+ *
+ * @param s a pointer to an array of character arrays.
+ * @return None
+ * @todo implement error checking.
+ */
+
+
+void hashKeysAndValues(HASH * h, char ***s, unsigned **d)
+{
+ unsigned i, j;
+ NODE *ptr;
+ char **sp;
+ unsigned * dd;
+
+ dd = (unsigned *) chkmalloc(sizeof(unsigned),h->keyN);
+ sp = (char **) chkmalloc(sizeof(char *), h->keyN);
+ for (i = 0; i < h->keyN; i++) {
+ sp[i] = (char *) malloc(sizeof(char)*(h->k + 1));
+ }
+ i = 0;
+ for (j = 0; j < BUCKETS; j++)
+ if (h->table[j] != NULL) {
+ ptr = h->table[j];
+ while (ptr != NULL) {
+ strcpy(sp[i], ptr->key);
+ dd[i++] = ptr->value;
+ ptr = ptr->next;
+ }
+ }
+ *s=sp;
+ *d=dd;
+}
+
+
+// Returns sum of all values stored in hash
+
+
+unsigned int sumValues(HASH * h)
+{
+ int j;
+ NODE *ptr;
+ unsigned sum = 0;
+
+ for (j = 0; j < BUCKETS; j++)
+ if (h->table[j] != NULL) {
+ ptr = h->table[j];
+ while (ptr != NULL) {
+ sum += ptr->value;
+ ptr = ptr->next;
+ }
+ }
+ return sum;
+}
+
+
+
+
+/** Extract hash values to an array and i
+ * set hash values to zero.
+ */
+
+
+void hashValuesAndSet(HASH * h, unsigned **d)
+{
+ int i, j;
+ NODE *ptr;
+ *d = (unsigned *) chkmalloc(sizeof(unsigned),h->keyN);
+
+ i = 0;
+ for (j = 0; j < BUCKETS; j++)
+ if (h->table[j] != NULL) {
+ ptr = h->table[j];
+ while (ptr != NULL) {
+ (*d)[i++] = ptr->value;
+ ptr->value = 0;
+ ptr = ptr->next;
+ }
+ }
+}
+
+
+
+
+/* Prints featuers, resets and frees hash memory */
+
+
+void printFeatures(HASH * h)
+{
+ int i;
+ char **keys;
+ unsigned *values;
+ extern char fflag;
+
+ if (h->keyN == 0)
+ warn_msg("Warning: No keys of length %d found.\n", h->k);
+
+ if (fflag)
+ hashValuesAndSet(h, &values);
+ else
+ hashKeysAndValues(h, &keys, &values);
+
+
+ for (i = 0; i < h->keyN-1; i++) {
+ if (fflag)
+ printf("%d\t", values[i]);
+ else {
+ printf("%s\t%d\t", keys[i], values[i]);
+ free(keys[i]);
+ }
+ }
+ if (fflag)
+ printf("%d\n", values[i]);
+ else {
+ printf("%s\t%d\n", keys[i], values[i]);
+ free(keys[i]);
+ }
+
+ resetHash(h);
+ if (!fflag)
+ freeHash(h);
+ free(values);
+}
diff --git a/src/hashroll.h b/src/hashroll.h
new file mode 100644
index 0000000..4f4297f
--- /dev/null
+++ b/src/hashroll.h
@@ -0,0 +1,260 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+/* _ HASHROLL_H_ */
+#ifndef _HASHROLL_H_
+#define _HASHROLL_H_
+
+#define BUCKETS 65536 /**< The Total number of buckets in feature hash table */
+#define hashInc(X) hashAdd((X),(1)) /**< Macro for incrementing a key-value stored in the hash */
+#define numKeys(void) keyN /**< Macro for number of keys in hash */
+#define MAX_WORD_SIZE 40
+#include <stdbool.h>
+
+/** Linked list for storing values in the hash */
+
+typedef struct node {
+ char *key; /**< Key value for storing features */
+ unsigned value; /**< Positive integer value for hash */
+ struct node *next; /**< Pointer to next node in linked list */
+} NODE;
+
+
+typedef struct hash {
+ NODE *table[BUCKETS]; /**< The hash table consisting of an Array of NODES */
+ unsigned int st_hash; /**< A persistent hash value */
+ unsigned int rt_hash; /**< A persistent hash value */
+ const unsigned char *hashi;
+ bool isClass;
+ bool reverse;
+ int mode;
+ char * r; /**< last key stored in hash reverse complement*/
+ char * s; /**< last key stored in hash forward direction*/
+ int k; /**< Length of the previous k-mer */
+ int numChar; /**< state: Was the last hash key valid?*/
+ /**<@todo we can achieve some object orientedness by performing the inithash on this variable and
+ * leaving the function pointers to various kinds of hashes here */
+ int keyN; /**< The number of elements in the hash table */
+ int (*strcmpf) (register const char *, register const char *);
+} HASH;
+
+
+
+
+
+/* prototypes */
+
+
+void chkpushtxt(HASH * h, char *c, int n);
+void pushtxt(HASH * h, char *c, int n);
+int hashAddtxt(HASH * h, char *s, unsigned val);
+
+unsigned int sumValues(HASH * h);
+void pushaaw(HASH * h, char *c, int n,bool);
+void chkpushaaw(HASH * h, char *c, int n,bool);
+void chkpushaa(HASH * h, char *c, int n,bool);
+void pushaa(HASH * h, char *c, int n,bool);
+int hashAddwaa(HASH * h, char *s, unsigned val);
+int hashAddaa(HASH * h, char *s, unsigned val);
+
+void printFeatures(HASH * h);
+int hashAdd(HASH * h, char *s, unsigned val);
+int hashAddw(HASH * h, char *s, unsigned val);
+void resetHash(HASH * h);
+void init(HASH * h, int isMasked, int mode, bool isClass, bool reverse, int k);
+void pushatgc(HASH *, char *, int,bool);
+void pushatgcw(HASH *, char *, int,bool);
+void chkpushatgc(HASH * h, char *c, int,bool);
+void chkpushatgcw(HASH * h, char *c, int n,bool);
+int new_strcmpw(register const char *s, register const char *t);
+int new_strcmp(const char *s, const char *t);
+unsigned int hashValNuc(HASH * h, register char *s);
+void hashKeys(HASH *, char ***s);
+void hashKeysAndValues(HASH * h, char ***s, unsigned **d);
+int numKeys(void);
+int freeHash(HASH *);
+int hashAssign(HASH * h, register char *s, unsigned int val);
+void hashValues(unsigned **values);
+int hashDel(char *s);
+int hashMax(char *s, unsigned val);
+void hashValuesAndSet(HASH * h, unsigned **d);
+
+enum hash_modes { nucleotide, amino, text }; /**< Type of hash to initialize */
+
+
+
+// Base characters are mapped so that
+// A is the complement of T
+// G = 10111100
+// C = 01000011
+
+// consider adding RY and ry to here.
+
+
+static const unsigned char base_hash_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A C G T
+ 0, 0, 0, 0, 0, 1, 0, 2, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 4, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 2,
+ 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
+
+
+
+
+static const unsigned char base_ry_hash_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 2,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< Character values for ry hash function */
+
+
+
+static const unsigned char aac_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 2, 3, 3,
+ 4, 5, 6, 7, 0, 8, 7, 7, 9, 0,
+ 10, 8, 8, 11, 11, 0, 7, 4, 0, 4,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 2,
+ 3, 3, 4, 5, 6, 7, 0, 8, 7, 7,
+ 9, 0, 10, 8, 8, 11, 11, 0, 7, 4,
+ 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< Character values for classed amino acids */
+
+
+
+static const unsigned char aa_hash_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 2, 3, 4,
+ 5, 6, 7, 8, 0, 9, 10, 11, 12, 0,
+ 13, 14, 15, 16, 17, 0, 18, 19, 0, 20,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 2,
+ 3, 4, 5, 6, 7, 8, 0, 9, 10, 11,
+ 12, 0, 13, 14, 15, 16, 17, 0, 18, 19,
+ 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< Character values for amino acids */
+
+
+static const unsigned char txt_hash_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 0, 0, 0, 0, 0, 0, 1, 2, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+};
+
+#endif /* _HASHROLL_H_ */
diff --git a/src/mask.c b/src/mask.c
new file mode 100644
index 0000000..c858c79
--- /dev/null
+++ b/src/mask.c
@@ -0,0 +1,53 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdlib.h>
+#include "mask.h"
+#include "../config.h"
+
+extern char *weightVector;
+
+
+/**
+ * Create a random mismatch mask
+ *
+ * Creates a mismatch mask for allowing
+ * mismatches in feature comparison. A 1
+ * at position i means that that feature must
+ * match; a 0 at position i means that mismatch
+ * is allowd.
+ *
+ * @param s a string representing the mismatch mask
+ * @param n the length of the mask
+ * @param mismatch the number of mismatches
+ * @return none
+ */
+
+
+void randweight(char *s, int n, int mismatch)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ weightVector[i] = '1';
+
+ while (mismatch > 0) {
+ weightVector[rand() % n] = '0';
+ mismatch--;
+ }
+
+ weightVector[n] = '\0';
+}
diff --git a/src/mask.h b/src/mask.h
new file mode 100644
index 0000000..94735db
--- /dev/null
+++ b/src/mask.h
@@ -0,0 +1,23 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+/* _MASK_H_ */
+#ifndef _MASK_H_
+#define _MASK_H_
+
+void randweight(char *s, int n, int mismatch);
+
+#endif /* _MASK_H_ */
diff --git a/src/parse_features.c b/src/parse_features.c
new file mode 100644
index 0000000..3e17d29
--- /dev/null
+++ b/src/parse_features.c
@@ -0,0 +1,82 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include "hashroll.h"
+#include "utils.h"
+#include "../config.h"
+
+
+extern bool zflag;
+extern bool wflag;
+
+void parseFeatureList(HASH *h, char * filename,int len,int mode) {
+ char * s;
+ FILE * fp;
+ int items;
+ unsigned lineno=1;
+ long line_offset=0;
+ int (*hashAddPtr) (HASH *, char *, unsigned) =NULL;
+
+ if ( (s = (char *) malloc(sizeof(char) * (len + 1))) == NULL)
+ fatal_at_line("%s\n",strerror(errno));
+ if ((fp = fopen(filename, "r")) == NULL)
+ fatal_msg("%s: %s\n", filename, strerror(errno));
+
+
+ switch (mode) {
+ case nucleotide:
+ if (zflag || wflag)
+ hashAddPtr=hashAddw;
+ else
+ hashAddPtr=hashAdd;
+ break;
+ case amino:
+ if (zflag || wflag)
+ hashAddPtr=hashAddwaa;
+ else
+ hashAddPtr=hashAddaa;
+ break;
+ case text:
+ hashAddPtr=hashAddtxt;
+ break;
+ }
+
+ errno=0;
+ while ( (items=fscanf(fp, "%s", s)) != EOF ) {
+ //fprintf(stderr,"%s %d\n",strerror(errno),items);
+ if (errno)
+ fatal_msg("Parse error at line %u char %ld: %s.\n",
+ lineno,ftell(fp)-line_offset, strerror(errno) );
+
+ switch (items) {
+ case 1:
+ if (strlen(s) != len)
+ fatal_msg("Feature lengths of %s differs from -l\n",
+ filename);
+ hashAddPtr(h,s,0);
+ break;
+ default:
+ fatal_msg("Parse error at line %u char %ld.\n",
+ lineno,ftell(fp)-line_offset);
+ break;
+ }
+ }
+ resetHash(h);
+}
diff --git a/src/parse_features.h b/src/parse_features.h
new file mode 100644
index 0000000..70f2091
--- /dev/null
+++ b/src/parse_features.h
@@ -0,0 +1,24 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+/* _UTILS_H_ */
+#ifndef _PARSE_FEATURES_H_
+#define _PARSE_FEATURES_H_
+
+/* prototypes */
+void parseFeatureList(HASH *h, char * filename,int len,int mode);
+
+#endif /* _UTILS_H_ */
diff --git a/src/sighandle.c b/src/sighandle.c
new file mode 100644
index 0000000..cc75982
--- /dev/null
+++ b/src/sighandle.c
@@ -0,0 +1,98 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <unistd.h>
+#include "utils.h"
+#include "sighandle.h"
+#include "../config.h"
+
+static void crash_handler(int sig_num);
+static void cleanup();
+
+/* Handle interrupt signals if they are defined
+ * segfault, floating point exception, illegal instruction, bad pipe, bus error*/
+
+void initSignalHandlers()
+{
+//tempfile cleanup
+atexit(cleanup);
+
+#ifdef SIGSEGV
+ signal(SIGSEGV, crash_handler);
+#endif /* SIGSEGV */
+#ifdef SIGFPE
+ signal(SIGFPE, crash_handler);
+#endif /* SIGFPE */
+#ifdef SIGILL
+ signal(SIGILL, crash_handler);
+#endif /* SIGILL */
+#ifdef SIGPIPE
+ signal(SIGPIPE, crash_handler);
+#endif /* SIGPIPE */
+#ifdef SIGBUS
+ signal(SIGBUS, crash_handler);
+#endif /* SIGBUS */
+}
+
+/* Error messages on receiving signal */
+extern char * tempfile;
+
+static void cleanup() {
+ if (tempfile != NULL)
+ unlink(tempfile);
+}
+
+
+
+static void crash_handler(int sig_num)
+{
+ cleanup();
+
+ switch(sig_num) {
+#ifdef SIGSEGV
+ case SIGSEGV:
+ fatal_msg("Segmentation fault.\n");
+ break;
+#endif /* SIGSEGV */
+#ifdef SIGFPE
+ case SIGFPE:
+ fatal_msg("Floating Point Exception.\n");
+ break;
+#endif /* SIGFPE */
+#ifdef SIGILL
+ case SIGILL:
+ fatal_msg("Attempted an illegal instruction.\n");
+ break;
+#endif /* SIGILL */
+#ifdef SIGPIPE
+ case SIGPIPE:
+ fatal_msg("Broken pipe.\n");
+ break;
+#endif /* SIGPIPE */
+#ifdef SIGBUS
+ case SIGBUS:
+ fatal_msg("Bus error.\n");
+ break;
+#endif /* SIGBUS */
+ }
+ abort();
+}
+
+
+
diff --git a/src/sighandle.h b/src/sighandle.h
new file mode 100644
index 0000000..fe05a88
--- /dev/null
+++ b/src/sighandle.h
@@ -0,0 +1,23 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+/* _SIGHANDLE_H_ */
+#ifndef _SIGHANDLE_H_
+#define _SIGHANDLE_H_
+
+void initSignalHandlers();
+
+#endif /* _SIGHANDLE_H_ */
diff --git a/src/utils.c b/src/utils.c
new file mode 100644
index 0000000..7961728
--- /dev/null
+++ b/src/utils.c
@@ -0,0 +1,533 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+/* UTILS.C */
+
+#define _POSIX_C_SOURCE 200112L // To use fdopen
+#define _XOPEN_SOURCE 600 // to use mkstemp
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <math.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+#include <sys/stat.h>
+#include <limits.h>
+#include "utils.h"
+
+extern char PROG_NAME[];
+
+/**@todo Error functions placed in their own object file */
+
+char error_usage_str[] = "Usage: %s [OPTION]... [FILE]... \n\
+Try `%s --help' for more information\n";
+
+
+void printErrorUsageStr()
+{
+ fprintf(stderr, error_usage_str, PROG_NAME, PROG_NAME);
+ exit(EXIT_FAILURE);
+}
+
+
+void fatal_msg(char *fmt, ...)
+{
+ va_list args;
+ fprintf(stderr, "%s: ", PROG_NAME);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ exit(EXIT_FAILURE);
+}
+
+void fatal_at_line(char *fmt, ...)
+{
+ va_list args;
+ fprintf(stderr,"%s: %s:%d in function \'%s\': ",
+ PROG_NAME,__FILE__,__LINE__,__func__);
+ va_start(args, fmt);
+ vfprintf(stderr,fmt,args);
+ va_end(args);
+ exit(EXIT_FAILURE);
+}
+
+
+void warn_msg(char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ fprintf(stderr, "%s: ", PROG_NAME);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+
+
+#define DIR_SEPARATOR '/'
+#define IS_DIR_SEPARATOR(ch) ( (ch) == DIR_SEPARATOR )
+
+
+char * basename (const char *name)
+{
+ const char *base;
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+
+ return (char *) base;
+}
+
+
+
+
+bool isDirectory(char * fname) {
+ struct stat input;
+ stat(fname,&input);
+ return (S_ISDIR( input.st_mode) );
+}
+
+
+
+/**@todo possibly place isRegularFile and convertPipeToFile in a special file utilities object file */
+
+/**
+ *
+ * Test whether a file is a regular file or FIFO/pipe
+ *
+ * fstats the descriptor number of the file pointed to
+ * by fp and returns result. Exits fatally if the fstat
+ * doesn't succeed.
+ *
+ * @param fp File pointer to be tested.
+ * @return True or False
+ * @retval 1 Is a regular file
+ * @retval 0 Is not a regular file - a pipe or FIFO
+ *
+ */
+
+int isRegularFile(FILE * fp)
+{
+ struct stat fattr;
+ if (fstat(fileno(fp), &fattr))
+ fatal_msg("fstat error.\n");
+ return (S_ISREG(fattr.st_mode));
+}
+
+
+int dirExists(char * name)
+{
+ struct stat fattr;
+ if ((stat(name, &fattr))==0)
+ return (S_ISDIR(fattr.st_mode));
+ return 0;
+}
+
+
+
+
+/**
+ *
+ * Test whether a file is a regular file or FIFO/pipe
+ *
+ * Streams the contents of the FIFO/PIPE to a temporary
+ * file. The temp file is usually saved in /tmp. It is
+ * immediately unlinked after creation so you will not
+ * be able to see it in the file system. See tempfile()
+ * for specifics. The file pointer of the
+ * temporary file is returned.
+ *
+ * @param fp File pointer to be tested.
+ * @return FILE*
+ * @retval FILE* Pointer to temporary file structure.
+ *
+ *
+ */
+
+/**@TODO Could fork and run this so file could be parsed immediately */
+
+char * tempfile=NULL;
+
+FILE *convertPipeToFile(FILE * fp)
+{
+ FILE *tmp;
+ struct stat fattr;
+ static size_t optimal_size;
+ ssize_t nr, nw;
+ static char *buf = NULL;
+ char tmpdir[FILENAME_MAX];
+ int fd;
+
+ strcpy(tmpdir,"/tmp");
+
+ if ( getenv("TMP") )
+ strcpy(tmpdir,getenv("TMP"));
+
+ if ( ! dirExists(tmpdir) )
+ fatal_msg("%s: Directory not found.\n",tmpdir);
+
+ if ((tempfile=(char*)malloc(FILENAME_MAX*sizeof(char)) ) == NULL )
+ fatal_at_line("%s\n",strerror(errno));
+
+ sprintf(tempfile,"%s/ffp.XXXXXX",tmpdir);
+
+ //For some reason tempfile is not rewindable.
+ if ((fd=mkstemp(tempfile)) == -1 )
+ fatal_msg("%s: %s\n",tempfile,strerror(errno));
+
+
+ if ((tmp=fdopen(fd, "w+")) == NULL )
+ fatal_msg("%s: %s\n",tempfile,strerror(errno));
+
+ if (fstat(fd, &fattr))
+ fatal_msg("%s: %s\n",tempfile,strerror(errno));
+
+ //Find optimal size for Disk IO
+ optimal_size = (fattr.st_blksize >= BUFSIZ) ? fattr.st_blksize : BUFSIZ;
+
+ if ((buf = (char *) malloc(optimal_size)) == NULL)
+ fatal_at_line("%s\n",strerror(errno));
+
+ while ((nr = fread(buf, sizeof(char), optimal_size, fp)) != -1 && nr != 0)
+ if ((nw = fwrite(buf, sizeof(char), nr, tmp)) == 0 || nw == -1)
+ fatal_msg("%s: %s\n",tempfile,strerror(errno));
+
+ free(buf);
+ rewind(tmp);
+ return tmp;
+}
+
+
+unsigned long numFeatures(int l)
+{
+ if (l % 2 == 1)
+ return pow(2, l - 1);
+ else
+ return (pow(2, l) + pow(2, l / 2)) / 2;
+}
+
+
+/**
+ *
+ * Tests whether the string is a valid nucleotide sequence
+ *
+ * Valid nucleotide base characters: AaTtGgCcYyRr. The
+ * paramter s is converted to upper case if any lowercase
+ * characters are encountered. Calls macro isBase.
+ *
+ * @param s a string representing a sequence
+ * @param len the string length
+ * @return True or False
+ * @retval 1 Is a valid nucleotide sequence
+ * @retval 0 Is an invalid nucleotide sequence
+ *
+ */
+
+
+char isValid(register const char *s, int len)
+{
+ int i = 0;
+ while (i < len) {
+ if (!isBase(s[i++]))
+ return 0;
+ }
+ return 1;
+}
+
+
+
+/**
+ *
+ * Tests whether the string is a valid Amino Acid sequence
+ *
+ * Valid amino acid characters: AaCcDdEeFfGgHhIiJjKkLlMmNn
+ * PpQqRrSsTTVvWxYyZz. The paramter s is converted to
+ * upper case if any lowercase characters are encountered.
+ * Calls macro isBase.
+ *
+ * @param s a string representing a sequence
+ * @param len the string length
+ * @return True or False
+ * @retval 1 Is a valid AA sequence
+ * @retval 0 Is an invalid AA sequence
+ *
+ */
+
+
+char isValidAA(register const char *s, int len)
+{
+ int i = 0;
+ while (i < len) {
+ if (!isAA(s[i++]))
+ return 0;
+ }
+ return 1;
+}
+
+
+/**
+ *
+ * Find the number of columns in a columnar FFP
+ *
+ * @param fp a file pointer to an FFP
+ * @return The number of columns
+ *
+ */
+
+unsigned int numCols(FILE * fp)
+{
+
+ int ch;
+ unsigned int cols = 0;
+
+ do {
+ ch = fgetc(fp);
+ if (isspace(ch)) {
+ cols++;
+ }
+ }
+ while (ch != '\n' && ch != '\r');
+ rewind(fp);
+ return (cols);
+}
+
+
+/**
+ *
+ * Find the number of rows in an FFP
+ *
+ * @param fp a file poitner to an FFP
+ * @return The number of rows
+ *
+ */
+
+
+unsigned numRows(FILE * fp)
+{
+ unsigned int rows = 0;
+ char ch;
+
+ while ((ch = getc(fp)) != EOF) {
+ if ((ch) == '\n')
+ rows++;
+ }
+ rewind(fp);
+ return rows;
+}
+
+
+/**
+ *
+ * Test whether this is a (key,value) FFP
+ *
+ * Perform file test to determine what kind of ffp this
+ * is. Either a columnar or key based FFP.
+ *
+ * @param fp a file pointer to an FFP file
+ * @return true or false
+ * @retval 1 Is a (key,value) based FFP
+ * @retval 0 Is not (key,value) FFP
+ * @todo this could be defined as a macro.
+ *
+ */
+
+
+int isKeyBased(FILE * fp)
+{
+ int ch;
+ if (isalpha(ch = fgetc(fp))) {
+ ungetc(ch, fp);
+ return 1;
+ }
+ ungetc(ch, fp);
+
+ return 0;
+
+}
+
+/**
+ *
+ * Determines the key length (feature length) stored
+ * in a (key,value) FFP
+ *
+ * @param fp A file pointer to an FFP file
+ * @return Length of the key in nonwhitespace characters
+ *
+ */
+
+
+int getKeyLength(FILE * fp)
+{
+ char s[40]; //@TODO change to a define.
+ fscanf(fp,"%s",s);
+ rewind(fp);
+ return(strlen(s));
+}
+
+
+
+/**
+ *
+ * Test whether string contains valid text characters
+ *
+ * @param s string to test
+ * @param len Length of string
+ * @retval 0 if invalid text string
+ * @retval 1 if a valid text string
+ */
+
+
+
+char isValidTxt(register const char *s, int len)
+{
+ int i = 0;
+ while (i < len) {
+ if (!isalpha((int) s[i++]))
+ return 0;
+ }
+ return 1;
+}
+
+
+/**
+*
+* Creates a random amino acid word of length n
+*
+* Creates a random amino acid word in s
+* with length n. Amino acid frequencies
+* are the observed frequencies from
+* vertebrate proteins (Dyer KF, 1971 J. Biol. Edu. 5, 15-24.)
+*
+*
+* The new word is
+* stored in s, space for which must already
+* be allocated with enough space to store an
+* array of length n.
+*
+*
+*
+* @param s a string representing an amino acid sequence
+* @param n the length of the string
+* @return none
+* @todo Edit this function to use the new static hash arays and move into utils.h
+*
+***************************************/
+
+
+void randaaword(char *s, int n)
+{
+ int i, j;
+ float chance;
+ float freq[] = { .074, .116, .160, .219,
+ .252, .310, .347, .421,
+ .450, .488, .564, .636,
+ .654, .694, .744, .825,
+ .887, .900, .933, 1.0001
+ };
+
+
+ s[n] = '\0';
+ for (i = 0; i < n; i++) {
+ chance = (float) rand() / INT_MAX;
+ j = 0;
+ while (chance > freq[j])
+ j++;
+ switch (j) {
+ case 0:
+ s[i] = 'A';
+ break;
+ case 1:
+ s[i] = 'R';
+ break;
+ case 2:
+ s[i] = 'N';
+ break;
+ case 3:
+ s[i] = 'D';
+ break;
+ case 4:
+ s[i] = 'C';
+ break;
+ case 5:
+ s[i] = 'E';
+ break;
+ case 6:
+ s[i] = 'Q';
+ break;
+ case 7:
+ s[i] = 'G';
+ break;
+ case 8:
+ s[i] = 'H';
+ break;
+ case 9:
+ s[i] = 'I';
+ break;
+ case 10:
+ s[i] = 'L';
+ break;
+ case 11:
+ s[i] = 'K';
+ break;
+ case 12:
+ s[i] = 'M';
+ break;
+ case 13:
+ s[i] = 'F';
+ break;
+ case 14:
+ s[i] = 'P';
+ break;
+ case 15:
+ s[i] = 'S';
+ break;
+ case 16:
+ s[i] = 'T';
+ break;
+ case 17:
+ s[i] = 'W';
+ break;
+ case 18:
+ s[i] = 'Y';
+ break;
+ case 19:
+ s[i] = 'V';
+ break;
+ }
+ }
+}
+
+
+//allocates memory and clears to 0
+void * chkcalloc(size_t size, size_t n) {
+ void * new_block;
+ if ((new_block = (void *) calloc(size,n)) == NULL )
+ fatal_msg(" %d bytes: Error allocating memory.",size*n);
+ return new_block;
+}
+
+//allocates memory w/o clearing.
+void * chkmalloc(size_t size, size_t n) {
+ void * new_block;
+ if ((new_block = (void *)malloc(size*n)) == NULL )
+ fatal_msg(" %d bytes: Error allocating memory.",size*n);
+ return new_block;
+}
+
+
+
+/* UTILS.C */
diff --git a/src/utils.h b/src/utils.h
new file mode 100644
index 0000000..ca3480f
--- /dev/null
+++ b/src/utils.h
@@ -0,0 +1,240 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+/* _UTILS_H_ */
+#ifndef _UTILS_H_
+#define _UTILS_H_
+#include <stdbool.h>
+
+/* prototypes */
+unsigned int numCols(FILE * fp);
+unsigned int numRows(FILE * fp);
+int getKeyLength(FILE * fp);
+int isKeyBased(FILE * fp);
+char isValid(register const char *s, int len);
+char isValidAA(register const char *s, int len);
+char isValidTxt(register const char *s, int len);
+unsigned long numFeatures(int l);
+void fatal_msg(char *fmt, ...);
+void fatal_at_line(char *fmt, ...);
+void warn_msg(char *fmt, ...);
+void printErrorUsageStr();
+int isRegularFile(FILE * fp);
+FILE *convertPipeToFile(FILE * fp);
+int fileno(FILE * fp);
+void randaaword(char *s, int n);
+void * chkcalloc(size_t size, size_t n);
+void * chkmalloc(size_t size, size_t n);
+char * basename (const char *name);
+int dirExists(char * name);
+bool isDirectory(char * fname);
+
+// For some reason this isn't recognized in the header file
+// even though I can clearly see it in stdio.h
+//int fileno(const FILE *stream);
+
+/* Perform a check of the return value of malloc */
+
+/*
+#define smalloc(A) ({\
+ void * __SAFEMALLOCPTR; \
+ if ( (__SAFEMALLOCPTR=malloc((A)))==NULL) \
+ fatal_msg("%s:%s: In function \'%s\':%s\n",__FILE__,__LINE__,__func__,strerror(errno)); \
+ __SAFEMALLOCPTR ; \
+ });
+*/
+
+#define printUsageStr() printf(usage_str,PROG_NAME, YEAR, AUTHORS, EMAIL);
+
+#define isBase(c) base_values[(unsigned char)(c)] /**<Macro: Tests if valid nucleotide character */
+#define atgc_to_ry(c) base_rycoded_values[(unsigned char)(c)] /**<Macro: Returns RY class of Nucleotide */
+#define ry(s,n) for(int i=0; i < (n); i++) s[i]=atgc_to_ry(s[i]) /**<Macro: Converts a str to ry in place */
+#define randword(s,n) for(int i=0; i < n; i++){s[i]=bases[rand()%4]} /**<Macro: Creates random base sequence */
+#define complement(s,n) for (int i=0; i < (n); i++ ) flip((s)[i]) /**<Macro: Converts to complement of Nuct. seq */
+#define flip(c) (c)=base_flip_values[(unsigned char)(c)] /**<Performs base flip for complement. */
+#define rev(s, n) \
+ { \
+ for (int i=0; i < (n)/2; i++) \
+ { \
+ s[(n)]=s[i]; \
+ s[i]=s[(n)-i-1]; \
+ s[(n)-i-1]=s[(n)]; \
+ } \
+ s[(n)]='\0'; \
+ } /**<Reverses a sequence in place */
+
+
+#define aa_to_class(c) aa_classcoded_values[(unsigned char)(c)] /**<Macro: Converts AA to proper class character */
+#define _class(s,n) for(int i=0; i < n; i++) s[i]=aa_to_class(s[i]) /**<Converts string to AA classes */
+#define isAA(c) aa_values[(unsigned char)(c)] /**<Test whether character is an AA */
+
+static const unsigned char bases[] = { 84, 67, 71, 84 };
+
+static const unsigned char base_flip_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 84, 0, 71, 0, 0, //A=65 C=67
+ 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, //G=71
+ 0, 0, 89, 0, 65, 65, 0, 0, 0, 82, //R=82 T=84 U=85 Y=89
+ 0, 0, 0, 0, 0, 0, 0, 84, 0, 71,
+ 0, 0, 0, 67, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 89, 0, 65, 65, 0, 0,
+ 0, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< ASCII values for base flips, equiv. to: tr [AaTtGgCcRrYy] [TTAACCGGYYRR] */
+
+
+static const bool base_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 1, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 1, 1, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 1, 1, 0, 0,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< True if ASCII numeric subscript value is a base */
+
+
+static const unsigned char base_rycoded_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 82, 0, 89, 0, 0, //A=65 C=67
+ 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, //G=71
+ 0, 0, 82, 0, 89, 89, 0, 0, 0, 89, //R=82 T=84 U=85 Y=89
+ 0, 0, 0, 0, 0, 0, 0, 82, 0, 89,
+ 0, 0, 0, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 82, 0, 89, 89, 0, 0,
+ 0, 89, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< Supplies proper ascii values for RY conversions */
+
+//(TS),(DE),(QKR),(VILM),(WFY),C,G,A,N,H,P
+
+static const unsigned char aa_classcoded_values[] = {
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 65, 0, 67, 68, 68,
+ 70, 71, 72, 73, 0, 75, 73, 73, 78, 0,
+ 80, 75, 75, 83, 83, 0, 73, 70, 0, 70,
+ 0, 0, 0, 0, 0, 0, 0, 65, 0, 67,
+ 68, 68, 70, 71, 72, 73, 0, 75, 73, 73,
+ 78, 0, 80, 75, 75, 83, 83, 0, 73, 70,
+ 0, 70, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< Supplie proper ascii values for AA class conversions */
+
+
+static const bool aa_values[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, //A=65 C=67
+ 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, //G=71
+ 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, //R=82 T=84 U=85 Y=89
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1,
+ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
+ 1, 0, 1, 1, 1, 1, 1, 0, 1, 1,
+ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+}; /**< True if array subscript is a valid AA character */
+
+
+
+
+#endif /* _UTILS_H_ */
diff --git a/src/vstring.h b/src/vstring.h
new file mode 100644
index 0000000..f56a4f6
--- /dev/null
+++ b/src/vstring.h
@@ -0,0 +1,27 @@
+/*****************************************************
+* This code is distributed under a Non-commercial use
+* license. For details see LICENSE. Use of this
+* code must be properly attributed to its author
+* Gregory E. Sims provided that its use or derivative
+* use is non-commercial in nature. Proper attribution
+* can be made by citing:
+*
+* Sims GE, et al (2009) Alignment-free genome
+* comparison with feature frequency profiles (FFP) and
+* optimal resolutions. Proc. Natl. Acad. Sci. USA.
+* 106, 2677-82.
+*
+* Gregory E. Sims (C) 2010-2012
+*
+*****************************************************/
+#ifndef _VSTRING_H_
+#define _VSTRING_H_
+#include "../config.h"
+#define VSTRING PACKAGE_VERSION
+#define AUTHORS PACKAGE_AUTHORS
+#define YEAR COPY_YEAR
+#define URL PACKAGE_URL
+#define EMAIL PACKAGE_BUGREPORT
+#define printVersion() printf("%s %s\nCopyright (C) %s.\n%s\nWritten by %s.\n%s\n",PROG_NAME,VSTRING,YEAR,URL,AUTHORS,EMAIL);
+
+#endif /*_VSTRING_H_*/
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..f5b15ec
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,84 @@
+TESTS = ffpaa_test_basic.sh \
+ ffpaa_test_stdin.sh \
+ ffpaa_test_d.sh \
+ ffpaa_test_f.sh \
+ ffpaa_test_m.sh \
+ ffpaa_test_w.sh \
+ ffpjsd_test.sh \
+ ffpmerge_test.sh \
+ ffpre_test.sh \
+ ffprwn_test.sh \
+ ffpry_test_basic.sh \
+ ffpry_test_stdin.sh \
+ ffpry_test_l.sh \
+ ffpry_test_d.sh \
+ ffpry_test_f.sh \
+ ffpry_test_m.sh \
+ ffpry_test_r.sh \
+ ffpry_test_w.sh \
+ ffpvocab_test.sh \
+ ffpvprof_test_basic.sh \
+ ffpreprof_test_basic.sh \
+ ffpboot_test_stdin.sh \
+ ffpcol_test_stdin.sh \
+ ffpcomplex_test_stdin.sh \
+ ffprwn_test_stdin.sh \
+ ffprwn_test_stdin2.sh \
+ ffptxt_test.sh \
+ ffpry_test_fidelity.sh \
+ ffpry_test_fidelity2.sh
+
+dist_check_SCRIPTS = ffpaa_test_basic.sh \
+ ffpaa_test_stdin.sh \
+ ffpaa_test_d.sh \
+ ffpaa_test_f.sh \
+ ffpaa_test_m.sh \
+ ffpaa_test_w.sh \
+ ffpjsd_test.sh \
+ ffpmerge_test.sh \
+ ffpre_test.sh \
+ ffprwn_test.sh \
+ ffpry_test_basic.sh \
+ ffpry_test_stdin.sh \
+ ffpry_test_l.sh \
+ ffpry_test_d.sh \
+ ffpry_test_f.sh \
+ ffpry_test_m.sh \
+ ffpry_test_r.sh \
+ ffpry_test_w.sh \
+ ffpvocab_test.sh \
+ ffpvprof_test_basic.sh \
+ ffpreprof_test_basic.sh \
+ ffpboot_test_stdin.sh \
+ ffpcol_test_stdin.sh \
+ ffpcomplex_test_stdin.sh \
+ ffprwn_test_stdin.sh \
+ ffprwn_test_stdin2.sh \
+ ffptxt_test.sh \
+ ffpry_test_fidelity.sh \
+ ffpry_test_fidelity2.sh
+
+EXTRA_DIST = test1.fna test2.fna test3.fna test4.fna \
+ test5.fna test1.faa test2.faa test3.faa \
+ test4.faa faalist.txt fnalist.txt ecoli \
+ ecoli.2 ecolitest.sh
+
+
+#do_subst = sed -e 's,\[@\]VERSION\[@\],$(PACKAGE_VERSION),g'
+
+# Must also 'compile' two shell scripts
+
+#ffpreprof_test_basic.sh : Makefile
+
+# $(do_subst) < ../scripts/ffpreprof.in > ffpreprof.tmp
+# chmod +x ffpreprof.tmp
+# mv ffpreprof.tmp ../scripts/ffpreprof
+
+#ffpvprof_test_basic.sh : Makefile
+
+# $(do_subst) < ../scripts/ffpvprof.in > ffpvprof.tmp
+# chmod +x ffpvprof.tmp
+# mv ffpvprof.tmp ../scripts/ffpvprof
+
+
+
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..fec4dd0
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,505 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = tests
+DIST_COMMON = $(dist_check_SCRIPTS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETOPT = @GETOPT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ISOSX = @ISOSX@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKTEMP = @MKTEMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+TESTS = ffpaa_test_basic.sh \
+ ffpaa_test_stdin.sh \
+ ffpaa_test_d.sh \
+ ffpaa_test_f.sh \
+ ffpaa_test_m.sh \
+ ffpaa_test_w.sh \
+ ffpjsd_test.sh \
+ ffpmerge_test.sh \
+ ffpre_test.sh \
+ ffprwn_test.sh \
+ ffpry_test_basic.sh \
+ ffpry_test_stdin.sh \
+ ffpry_test_l.sh \
+ ffpry_test_d.sh \
+ ffpry_test_f.sh \
+ ffpry_test_m.sh \
+ ffpry_test_r.sh \
+ ffpry_test_w.sh \
+ ffpvocab_test.sh \
+ ffpvprof_test_basic.sh \
+ ffpreprof_test_basic.sh \
+ ffpboot_test_stdin.sh \
+ ffpcol_test_stdin.sh \
+ ffpcomplex_test_stdin.sh \
+ ffprwn_test_stdin.sh \
+ ffprwn_test_stdin2.sh \
+ ffptxt_test.sh \
+ ffpry_test_fidelity.sh \
+ ffpry_test_fidelity2.sh
+
+dist_check_SCRIPTS = ffpaa_test_basic.sh \
+ ffpaa_test_stdin.sh \
+ ffpaa_test_d.sh \
+ ffpaa_test_f.sh \
+ ffpaa_test_m.sh \
+ ffpaa_test_w.sh \
+ ffpjsd_test.sh \
+ ffpmerge_test.sh \
+ ffpre_test.sh \
+ ffprwn_test.sh \
+ ffpry_test_basic.sh \
+ ffpry_test_stdin.sh \
+ ffpry_test_l.sh \
+ ffpry_test_d.sh \
+ ffpry_test_f.sh \
+ ffpry_test_m.sh \
+ ffpry_test_r.sh \
+ ffpry_test_w.sh \
+ ffpvocab_test.sh \
+ ffpvprof_test_basic.sh \
+ ffpreprof_test_basic.sh \
+ ffpboot_test_stdin.sh \
+ ffpcol_test_stdin.sh \
+ ffpcomplex_test_stdin.sh \
+ ffprwn_test_stdin.sh \
+ ffprwn_test_stdin2.sh \
+ ffptxt_test.sh \
+ ffpry_test_fidelity.sh \
+ ffpry_test_fidelity2.sh
+
+EXTRA_DIST = test1.fna test2.fna test3.fna test4.fna \
+ test5.fna test1.faa test2.faa test3.faa \
+ test4.faa faalist.txt fnalist.txt ecoli \
+ ecoli.2 ecolitest.sh
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ echo "$$grn$$dashes"; \
+ else \
+ echo "$$red$$dashes"; \
+ fi; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes$$std"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(dist_check_SCRIPTS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+ distclean distclean-generic distdir dvi dvi-am html html-am \
+ info info-am install install-am install-data install-data-am \
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-info install-info-am \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+ uninstall-am
+
+
+#do_subst = sed -e 's,\[@\]VERSION\[@\],$(PACKAGE_VERSION),g'
+
+# Must also 'compile' two shell scripts
+
+#ffpreprof_test_basic.sh : Makefile
+
+# $(do_subst) < ../scripts/ffpreprof.in > ffpreprof.tmp
+# chmod +x ffpreprof.tmp
+# mv ffpreprof.tmp ../scripts/ffpreprof
+
+#ffpvprof_test_basic.sh : Makefile
+
+# $(do_subst) < ../scripts/ffpvprof.in > ffpvprof.tmp
+# chmod +x ffpvprof.tmp
+# mv ffpvprof.tmp ../scripts/ffpvprof
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/ecoli b/tests/ecoli
new file mode 100644
index 0000000..f7074f0
--- /dev/null
+++ b/tests/ecoli
@@ -0,0 +1,50 @@
+>gi|49175990|ref|NC_000913.2| Escherichia coli str. K-12 substr. MG1655 chromosome, complete genome
+AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC
+TTCTGAACTGGTTACCTGCCGTGAGTAAATTAAAATTTTATTGACTTAGGTCACTAAATACTTTAACCAA
+TATAGGCATAGCGCACAGACAGATAAAAATTACAGAGTACACAACATCCATGAAACGCATTAGCACCACC
+ATTACCACCACCATCACCATTACCACAGGTAACGGTGCGGGCTGACGCGTACAGGAAACACAGAAAAAAG
+CCCGCACCTGACAGTGCGGGCTTTTTTTTTCGACCAAAGGTAACGAGGTAACAACCATGCGAGTGTTGAA
+GTTCGGCGGTACATCAGTGGCAAATGCAGAACGTTTTCTGCGTGTTGCCGATATTCTGGAAAGCAATGCC
+AGGCAGGGGCAGGTGGCCACCGTCCTCTCTGCCCCCGCCAAAATCACCAACCACCTGGTGGCGATGATTG
+AAAAAACCATTAGCGGCCAGGATGCTTTACCCAATATCAGCGATGCCGAACGTATTTTTGCCGAACTTTT
+GACGGGACTCGCCGCCGCCCAGCCGGGGTTCCCGCTGGCGCAATTGAAAACTTTCGTCGATCAGGAATTT
+GCCCAAATAAAACATGTCCTGCATGGCATTAGTTTGTTGGGGCAGTGCCCGGATAGCATCAACGCTGCGC
+TGATTTGCCGTGGCGAGAAAATGTCGATCGCCATTATGGCCGGCGTATTAGAAGCGCGCGGTCACAACGT
+TACTGTTATCGATCCGGTCGAAAAACTGCTGGCAGTGGGGCATTACCTCGAATCTACCGTCGATATTGCT
+GAGTCCACCCGCCGTATTGCGGCAAGCCGCATTCCGGCTGATCACATGGTGCTGATGGCAGGTTTCACCG
+CCGGTAATGAAAAAGGCGAACTGGTGGTGCTTGGACGCAACGGTTCCGACTACTCTGCTGCGGTGCTGGC
+TGCCTGTTTACGCGCCGATTGTTGCGAGATTTGGACGGACGTTGACGGGGTCTATACCTGCGACCCGCGT
+CAGGTGCCCGATGCGAGGTTGTTGAAGTCGATGTCCTACCAGGAAGCGATGGAGCTTTCCTACTTCGGCG
+CTAAAGTTCTTCACCCCCGCACCATTACCCCCATCGCCCAGTTCCAGATCCCTTGCCTGATTAAAAATAC
+CGGAAATCCTCAAGCACCAGGTACGCTCATTGGTGCCAGCCGTGATGAAGACGAATTACCGGTCAAGGGC
+ATTTCCAATCTGAATAACATGGCAATGTTCAGCGTTTCTGGTCCGGGGATGAAAGGGATGGTCGGCATGG
+CGGCGCGCGTCTTTGCAGCGATGTCACGCGCCCGTATTTCCGTGGTGCTGATTACGCAATCATCTTCCGA
+ATACAGCATCAGTTTCTGCGTTCCACAAAGCGACTGTGTGCGAGCTGAACGGGCAATGCAGGAAGAGTTC
+TACCTGGAACTGAAAGAAGGCTTACTGGAGCCGCTGGCAGTGACGGAACGGCTGGCCATTATCTCGGTGG
+TAGGTGATGGTATGCGCACCTTGCGTGGGATCTCGGCGAAATTCTTTGCCGCACTGGCCCGCGCCAATAT
+CAACATTGTCGCCATTGCTCAGGGATCTTCTGAACGCTCAATCTCTGTCGTGGTAAATAACGATGATGCG
+ACCACTGGCGTGCGCGTTACTCATCAGATGCTGTTCAATACCGATCAGGTTATCGAAGTGTTTGTGATTG
+GCGTCGGTGGCGTTGGCGGTGCGCTGCTGGAGCAACTGAAGCGTCAGCAAAGCTGGCTGAAGAATAAACA
+TATCGACTTACGTGTCTGCGGTGTTGCCAACTCGAAGGCTCTGCTCACCAATGTACATGGCCTTAATCTG
+GAAAACTGGCAGGAAGAACTGGCGCAAGCCAAAGAGCCGTTTAATCTCGGGCGCTTAATTCGCCTCGTGA
+AAGAATATCATCTGCTGAACCCGGTCATTGTTGACTGCACTTCCAGCCAGGCAGTGGCGGATCAATATGC
+CGACTTCCTGCGCGAAGGTTTCCACGTTGTCACGCCGAACAAAAAGGCCAACACCTCGTCGATGGATTAC
+TACCATCAGTTGCGTTATGCGGCGGAAAAATCGCGGCGTAAATTCCTCTATGACACCAACGTTGGGGCTG
+GATTACCGGTTATTGAGAACCTGCAAAATCTGCTCAATGCAGGTGATGAATTGATGAAGTTCTCCGGCAT
+TCTTTCTGGTTCGCTTTCTTATATCTTCGGCAAGTTAGACGAAGGCATGAGTTTCTCCGAGGCGACCACG
+CTGGCGCGGGAAATGGGTTATACCGAACCGGACCCGCGAGATGATCTTTCTGGTATGGATGTGGCGCGTA
+AACTATTGATTCTCGCTCGTGAAACGGGACGTGAACTGGAGCTGGCGGATATTGAAATTGAACCTGTGCT
+GCCCGCAGAGTTTAACGCCGAGGGTGATGTTGCCGCTTTTATGGCGAATCTGTCACAACTCGACGATCTC
+TTTGCCGCGCGCGTGGCGAAGGCCCGTGATGAAGGAAAAGTTTTGCGCTATGTTGGCAATATTGATGAAG
+ATGGCGTCTGCCGCGTGAAGATTGCCGAAGTGGATGGTAATGATCCGCTGTTCAAAGTGAAAAATGGCGA
+AAACGCCCTGGCCTTCTATAGCCACTATTATCAGCCGCTGCCGTTGGTACTGCGCGGATATGGTGCGGGC
+AATGACGTTACAGCTGCCGGTGTCTTTGCTGATCTGCTACGTACCCTCTCATGGAAGTTAGGAGTCTGAC
+ATGGTTAAAGTTTATGCCCCGGCTTCCAGTGCCAATATGAGCGTCGGGTTTGATGTGCTCGGGGCGGCGG
+TGACACCTGTTGATGGTGCATTGCTCGGAGATGTAGTCACGGTTGAGGCGGCAGAGACATTCAGTCTCAA
+CAACCTCGGACGCTTTGCCGATAAGCTGCCGTCAGAACCACGGGAAAATATCGTTTATCAGTGCTGGGAG
+CGTTTTTGCCAGGAACTGGGTAAGCAAATTCCAGTGGCGATGACCCTGGAAAAGAATATGCCGATCGGTT
+CGGGCTTAGGCTCCAGTGCCTGTTCGGTGGTCGCGGCGCTGATGGCGATGAATGAACACTGCGGCAAGCC
+GCTTAATGACACTCGTTTGCTGGCTTTGATGGGCGAGCTGGAAGGCCGTATCTCCGGCAGCATTCATTAC
+GACAACGTGGCACCGTGTTTTCTCGGTGGTATGCAGTTGATGATCGAAGAAAACGACATCATCAGCCAGC
+AAGTGCCAGGGTTTGATGAGTGGCTGTGGGTGCTGGCGTATCCGGGGATTAAAGTCTCGACGGCAGAAGC
+CAGGGCTATTTTACCGGCGCAGTATCGCCGCCAGGATTGCATTGCGCACGGGCGACATCTGGCAGGCTTC
diff --git a/tests/ecoli.2 b/tests/ecoli.2
new file mode 100644
index 0000000..1683b63
--- /dev/null
+++ b/tests/ecoli.2
@@ -0,0 +1,30 @@
+>gi|49175990|ref|NC_000913.2| Escherichia coli str. K-12 substr. MG1655 chromosome, complete genome
+AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC
+TTCTGAACTGGTTACCTGCCGTGAGTAAATTAAAATTTTATTGACTTAGGTCACTAAATACTTTAACCAA
+TATAGGCATAGCGCACAGACAGATAAAAATTACAGAGTACACAACATCCATGAAACGCATTAGCACCACC
+ATTACCACCACCATCACCATTACCACAGGTAACGGTGCGGGCTGACGCGTACAGGAAACACAGAAAAAAG
+CCCGCACCTGACAGTGCGGGCTTTTTTTTTCGACCAAAGGTAACGAGGTAACAACCATGCGAGTGTTGAA
+GTTCGGCGGTACATCAGTGGCAAATGCAGAACGTTTTCTGCGTGTTGCCGATATTCTGGAAAGCAATGCC
+AGGCAGGGGCAGGTGGCCACCGTCCTCTCTGCCCCCGCCAAAATCACCAACCACCTGGTGGCGATGATTG
+AAAAAACCATTAGCGGCCAGGATGCTTTACCCAATATCAGCGATGCCGAACGTATTTTTGCCGAACTTTT
+GACGGGACTCGCCGCCGCCCAGCCGGGGTTCCCGCTGGCGCAATTGAAAACTTTCGTCGATCAGGAATTT
+GCCCAAATAAAACATGTCCTGCATGGCATTAGTTTGTTGGGGCAGTGCCCGGATAGCATCAACGCTGCGC
+TGATTTGCCGTGGCGAGAAAATGTCGATCGCCATTATGGCCGGCGTATTAGAAGCGCGCGGTCACAACGT
+TACTGTTATCGATCCGGTCGAAAAACTGCTGGCAGTGGGGCATTACCTCGAATCTACCGTCGATATTGCT
+GAGTCCACCCGCCGTATTGCGGCAAGCCGCATTCCGGCTGATCACATGGTGCTGATGGCAGGTTTCACCG
+CCGGTAATGAAAAAGGCGAACTGGTGGTGCTTGGACGCAACGGTTCCGACTACTCTGCTGCGGTGCTGGC
+TGCCTGTTTACGCGCCGATTGTTGCGAGATTTGGACGGACGTTGACGGGGTCTATACCTGCGACCCGCGT
+CAGGTGCCCGATGCGAGGTTGTTGAAGTCGATGTCCTACCAGGAAGCGATGGAGCTTTCCTACTTCGGCG
+CTAAAGTTCTTCACCCCCGCACCATTACCCCCATCGCCCAGTTCCAGATCCCTTGCCTGATTAAAAATAC
+CGGAAATCCTCAAGCACCAGGTACGCTCATTGGTGCCAGCCGTGATGAAGACGAATTACCGGTCAAGGGC
+ATTTCCAATCTGAATAACATGGCAATGTTCAGCGTTTCTGGTCCGGGGATGAAAGGGATGGTCGGCATGG
+CGGCGCGCGTCTTTGCAGCGATGTCACGCGCCCGTATTTCCGTGGTGCTGATTACGCAATCATCTTCCGA
+ATACAGCATCAGTTTCTGCGTTCCACAAAGCGACTGTGTGCGAGCTGAACGGGCAATGCAGGAAGAGTTC
+TACCTGGAACTGAAAGAAGGCTTACTGGAGCCGCTGGCAGTGACGGAACGGCTGGCCATTATCTCGGTGG
+TAGGTGATGGTATGCGCACCTTGCGTGGGATCTCGGCGAAATTCTTTGCCGCACTGGCCCGCGCCAATAT
+CAACATTGTCGCCATTGCTCAGGGATCTTCTGAACGCTCAATCTCTGTCGTGGTAAATAACGATGATGCG
+ACCACTGGCGTGCGCGTTACTCATCAGATGCTGTTCAATACCGATCAGGTTATCGAAGTGTTTGTGATTG
+GCGTCGGTGGCGTTGGCGGTGCGCTGCTGGAGCAACTGAAGCGTCAGCAAAGCTGGCTGAAGAATAAACA
+TATCGACTTACGTGTCTGCGGTGTTGCCAACTCGAAGGCTCTGCTCACCAATGTACATGGCCTTAATCTG
+GAAAACTGGCAGGAAGAACTGGCGCAAGCCAAAGAGCCGTTTAATCTCGGGCGCTTAATTCGCCTCGTGA
+AAGAATATCATCTGCTGAACCCGGTCATTGTTGACTGCACTTCCAGCCAGGCAGTGGCGGATCAATATGC
diff --git a/tests/ecolitest.sh b/tests/ecolitest.sh
new file mode 100755
index 0000000..656fb23
--- /dev/null
+++ b/tests/ecolitest.sh
@@ -0,0 +1,227 @@
+#!/usr/bin/env bash
+set -x
+
+# This script exhaustively tests every aspect of $SRC/ffpjsd
+# including all distance measures, and different methods
+# of row normalization.
+
+TEST_DIR=$(dirname $(readlink -f $0) )
+SRC="${TEST_DIR%/*}/src"
+
+function clean_up() {
+ echo "Encountered unexpected output"
+ rm -fr $TMPDIR;
+ exit $1
+}
+
+# SETUP actions for early termination
+trap "clean_up 1" ABRT HUP INT QUIT PIPE
+
+
+
+function getFtpFiles() {
+ local FTP=ftp://ftp.ncbi.nlm.nih.gov
+ local DIR=genomes/Bacteria
+ echo "Grabbing files..." 1>&2
+ while read FILE ; do
+ echo "$FILE" 1>&2
+ wget "$FTP/$DIR/$FILE" --quiet
+ done <<-EOF
+ Escherichia_coli_536_uid58531/NC_008253.fna
+ Escherichia_coli_55989_uid59383/NC_011748.fna
+ Escherichia_coli_APEC_O1_uid58623/NC_008563.fna
+ Escherichia_coli_ATCC_8739_uid58783/NC_010468.fna
+ Escherichia_coli_BW2952_uid59391/NC_012759.fna
+ Escherichia_coli_B_REL606_uid58803/NC_012967.fna
+ Escherichia_coli_CFT073_uid57915/NC_004431.fna
+ Escherichia_coli_E24377A_uid58395/NC_009801.fna
+ Escherichia_coli_ED1a_uid59379/NC_011745.fna
+ Escherichia_coli_HS_uid58393/NC_009800.fna
+ Escherichia_coli_IAI1_uid59377/NC_011741.fna
+ Escherichia_coli_IAI39_uid59381/NC_011750.fna
+ Escherichia_coli_K_12_substr__DH10B_uid58979/NC_010473.fna
+ Escherichia_coli_K_12_substr__MG1655_uid57779/NC_000913.fna
+ Escherichia_coli_O103_H2_12009_uid41013/NC_013353.fna
+ Escherichia_coli_O111_H__11128_uid41023/NC_013364.fna
+ Escherichia_coli_O127_H6_E2348_69_uid59343/NC_011601.fna
+ Escherichia_coli_O157_H7_EC4115_uid59091/NC_011353.fna
+ Escherichia_coli_O157_H7_EDL933_uid57831/NC_002655.fna
+ Escherichia_coli_O157_H7_Sakai_uid57781/NC_002695.fna
+ Escherichia_coli_O157_H7_TW14359_uid59235/NC_013008.fna
+ Escherichia_coli_O26_H11_11368_uid41021/NC_013361.fna
+ Escherichia_coli_O55_H7_CB9615_uid46655/NC_013941.fna
+ Escherichia_coli_S88_uid62979/NC_011742.fna
+ Escherichia_coli_SE11_uid59425/NC_011415.fna
+ Escherichia_coli_SMS_3_5_uid58919/NC_010498.fna
+ Escherichia_coli_UMN026_uid62981/NC_011751.fna
+ Escherichia_coli_UTI89_uid58541/NC_007946.fna
+ Escherichia_coli__BL21_Gold_DE3_pLysS_AG__uid59245/NC_012947.fna
+ Escherichia_fergusonii_ATCC_35469_uid59375/NC_011740.fna
+ Shigella_boydii_CDC_3083_94_uid58415/NC_010658.fna
+ Shigella_boydii_Sb227_uid58215/NC_007613.fna
+ Shigella_dysenteriae_Sd197_uid58213/NC_007606.fna
+ Shigella_flexneri_2a_2457T_uid57991/NC_004741.fna
+ Shigella_flexneri_2a_301_uid62907/NC_004337.fna
+ Shigella_flexneri_5_8401_uid58583/NC_008258.fna
+ Shigella_sonnei_Ss046_uid58217/NC_007384.fna
+ EOF
+}
+
+TMPDIR=$(mktemp -d)
+cd $TMPDIR
+getFtpFiles
+
+echo "Building FFP distance matrix and trees" 1>&2
+
+\ls *.fna | cut -f1 -d"." > species.txt
+$SRC/ffpry -l 17 *.fna | $SRC/ffpcol | tee ffp.col | $SRC/ffprwn | tee ffp.row | $SRC/ffpjsd -p species.txt | tee ffp.jsd | $SRC/ffptree > trees 2> progress
+
+#Todo tee and save all trees -- then compare the trees produced with treedist
+
+echo "Comparing JSD matrix to expected output" 1>&2
+[ $(sum ffp.jsd | cut -f1 -d" ") != 56601 ] && clean_up 1
+
+echo "Comparing tree to expected output" 1>&2
+[ $(sum trees | cut -f1 -d" ") != 32573 ] && clean_up 1
+
+echo "Comparing tree build progress to expected output" 1>&2
+[ $(sum progress | cut -f1 -d" ") != 19202 ] && clean_up 1
+
+echo "Building Euclidean tree"
+[ $($SRC/ffpjsd --euclid -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 53921 ] && clean_up 1
+
+echo "Building Euclidean-squared tree"
+[ $($SRC/ffpjsd --euclid2 -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 51531 ] && clean_up 1
+
+echo "Building Euclidean-Norm=4 tree"
+[ $($SRC/ffpjsd --euclid -n 4 -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 19301 ] && clean_up 1
+
+echo "Building Cosine distance tree"
+[ $($SRC/ffpjsd --cosine -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 27746 ] && clean_up 1
+
+echo "Building Manhattan distance tree"
+[ $($SRC/ffpjsd --manhattan -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 03569 ] && clean_up 1
+
+echo "Building Pearson distance tree"
+[ $($SRC/ffpjsd --pearson -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 20523 ] && clean_up 1
+
+echo "*** Repeating with row normalized ffp"
+
+echo "Building Euclidean tree"
+[ $($SRC/ffpjsd --euclid -p species.txt ffp.row | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 52475 ] && clean_up 1
+
+echo "Building Euclidean-squared tree"
+[ $($SRC/ffpjsd --euclid2 -p species.txt ffp.row | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 49538 ] && clean_up 1
+
+echo "Building Euclidean-Norm=4 tree"
+[ $($SRC/ffpjsd --euclid -n 4 -p species.txt ffp.row | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 15520 ] && clean_up 1
+
+echo "Building Cosine distance tree"
+[ $($SRC/ffpjsd --cosine -p species.txt ffp.row | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 38883 ] && clean_up 1
+
+echo "Building Manhattan distance tree"
+[ $($SRC/ffpjsd --manhattan -p species.txt ffp.row | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 00574 ] && clean_up 1
+
+echo "Building Pearson distance tree"
+[ $($SRC/ffpjsd --pearson -p species.txt ffp.row | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 44745 ] && clean_up 1
+
+echo "*** Repeating with normalization by largest row"
+
+$SRC/ffprwn --largest-row ffp.col > ffp.rwn
+
+echo "Building JSD tree"
+[ $($SRC/ffpjsd -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 24892 ] && clean_up 1
+
+echo "Building Euclidean tree"
+[ $($SRC/ffpjsd --euclid -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 32620 ] && clean_up 1
+
+echo "Building Euclidean-squared tree"
+[ $($SRC/ffpjsd --euclid2 -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 01496 ] && clean_up 1
+
+echo "Building Euclidean-Norm=4 tree"
+[ $($SRC/ffpjsd --euclid -n 4 -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 06552 ] && clean_up 1
+
+echo "Building Cosine distance tree"
+[ $($SRC/ffpjsd --cosine -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 37382 ] && clean_up 1
+
+echo "Building Manhattan distance tree"
+[ $($SRC/ffpjsd --manhattan -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 36128 ] && clean_up 1
+
+echo "Building Pearson distance tree"
+[ $($SRC/ffpjsd --pearson -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 48476 ] && clean_up 1
+
+echo "Building Chebyshev distance tree"
+[ $($SRC/ffpjsd --chebyshev -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 26851 ] && clean_up 1
+
+echo "Building Canberra distance tree"
+[ $($SRC/ffpjsd --canberra -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 11965 ] && clean_up 1
+
+echo "Building Evolutionary distance tree"
+[ $($SRC/ffpjsd --evol -p species.txt ffp.rwn | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 00231 ] && clean_up 1
+
+$SRC/ffpry -d -l 10 *.fna | $SRC/ffpcol -d > ffp.col
+
+echo "Building Hamming distance tree"
+[ $($SRC/ffpjsd --hamming -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 57877 ] && clean_up 1
+
+echo "Building Matching distance tree"
+[ $($SRC/ffpjsd --matching -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 06947 ] && clean_up 1
+
+
+echo "Building Jaccard distance tree"
+[ $($SRC/ffpjsd --jaccard -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 16975 ] && clean_up 1
+
+
+echo "Building Tanimoto distance tree"
+[ $($SRC/ffpjsd --tanimoto -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 62002 ] && clean_up 1
+
+
+echo "Building Dice distance tree"
+[ $($SRC/ffpjsd --dice -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 54897 ] && clean_up 1
+
+
+echo "Building AntiDice distance tree"
+[ $($SRC/ffpjsd --antidice -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 13413 ] && clean_up 1
+
+
+echo "Building Sneath-Sokal distance tree"
+[ $($SRC/ffpjsd --sneath -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 40524 ] && clean_up 1
+
+
+echo "Building Hamman distance tree"
+[ $($SRC/ffpjsd --hamman -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 14768 ] && clean_up 1
+
+
+echo "Building Pearson Phi distance tree"
+[ $($SRC/ffpjsd --phi -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 10865 ] && clean_up 1
+
+
+echo "Building Anderberg distance tree"
+[ $($SRC/ffpjsd --anderberg -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 03720 ] && clean_up 1
+
+
+echo "Building Gower distance tree"
+[ $($SRC/ffpjsd --gower -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 65378 ] && clean_up 1
+
+
+echo "Building Russel-Rao distance tree"
+[ $($SRC/ffpjsd --russel -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 16975 ] && clean_up 1
+
+
+echo "Building Yule distance tree"
+[ $($SRC/ffpjsd --yule -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 04408 ] && clean_up 1
+
+
+echo "Building Ochiai distance tree"
+[ $($SRC/ffpjsd --ochiai -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 07115 ] && clean_up 1
+
+
+echo "Building Kulczynski distance tree"
+[ $($SRC/ffpjsd --kulczynski -p species.txt ffp.col | $SRC/ffptree 2> /dev/null | sum | cut -f1 -d" ") != 33072 ] && clean_up 1
+
+cd ..
+
+
+clean_up 0
+
+
diff --git a/tests/faalist.txt b/tests/faalist.txt
new file mode 100644
index 0000000..4a81588
--- /dev/null
+++ b/tests/faalist.txt
@@ -0,0 +1,7 @@
+ATATTWRAT
+GHHHIKYTN
+PIKQKAAAA
+AAAAAAAAA
+AAATYPAAA
+AAAAAAAAA
+AAAAAAAAA
diff --git a/tests/ffpaa_test_basic.sh b/tests/ffpaa_test_basic.sh
new file mode 100755
index 0000000..137c1ce
--- /dev/null
+++ b/tests/ffpaa_test_basic.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# Use checksum comparison to perform unit tests
+echo "ffpaa: Testing basic functionality" 2>&1
+# Output should look like:
+#KKKA 1 HHIK 1 SFKA 1 PIKK 1 SASS 1 GHHH 1 AAAA 39 AAAG 1 AAGK 1 KASG 1 KKAA 1 IKFS 1 IKKK 1 FSNP 1 ASAS 1 ASGH 1 HIKF 1 SSFK 1 KAAA 1 KDSC 1 FKAS 1 SNPI 1 SGHH 1 HHHI 1 GKDS 1 AGKD 1 NPIK 1 KFSN 1 ASSF 1
+[ $(../src/ffpaa test1.faa | sum | cut -f1 -d" ") != 19101 ] && exit 1
+
+
+# Output should look like:
+#KKKA 1 HHIK 1 SFKA 1 PIKK 1 SASS 1 FPAA 1 GHHH 1 AAAA 32 AAAG 1 AAAS 1 AAGK 1 KASG 1 ASFP 1 KKAA 1 IKFS 1 IKKK 1 FSNP 1 ASAS 1 ASGH 1 HIKF 1 SFPA 1 SSFK 1 KAAA 1 KDSC 1 FKAS 1 AASF 1 SNPI 1 SGHH 1 HHHI 1 GKDS 1 AGKD 1 NPIK 1 KFSN 1 PAAA 1 ASSF 1
+[ $(../src/ffpaa test2.faa | sum | cut -f1 -d" ") != 35837 ] && exit 1
+
+# Output should look like:
+#KKKA 1 HHIK 1 SFKA 1 PIKK 1 SASS 1 GHHH 1 AAAA 39 AAAG 1 AAGK 1 KASG 1 KKAA 1 IKFS 1 IKKK 1 FSNP 1 ASAS 1 ASGH 1 HIKF 1 SSFK 1 KAAA 1 KDSC 1 FKAS 1 SNPI 1 SGHH 1 HHHI 1 GKDS 1 AGKD 1 NPIK 1 KFSN 1 ASSF 1
+#KKKA 1 HHIK 1 SFKA 1 PIKK 1 SASS 1 FPAA 1 GHHH 1 AAAA 32 AAAG 1 AAAS 1 AAGK 1 KASG 1 ASFP 1 KKAA 1 IKFS 1 IKKK 1 FSNP 1 ASAS 1 ASGH 1 HIKF 1 SFPA 1 SSFK 1 KAAA 1 KDSC 1 FKAS 1 AASF 1 SNPI 1 SGHH 1 HHHI 1 GKDS 1 AGKD 1 NPIK 1 KFSN 1 PAAA 1 ASSF 1
+
+[ $(../src/ffpaa test{1,2}.faa | sum | cut -f1 -d" ") != 00296 ] && exit 1
+
+
+
+exit 0
+
diff --git a/tests/ffpaa_test_d.sh b/tests/ffpaa_test_d.sh
new file mode 100755
index 0000000..3540757
--- /dev/null
+++ b/tests/ffpaa_test_d.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# Use checksum comparison to perform unit tests
+
+echo "ffpaa: Testing option -d, --disable-classes" 2>&1
+# Test -d option
+#Output should look like
+#TNPI 1 GRDS 1 TGHH 1 ATGH 1 TWRA 1 AAAA 39 AAAG 1 HHIK 1 RATG 1 GHHH 1 KAAA 1 KQKA 1 QKAA 1 IKYT 1 AAGR 1 RDSC 1 PIKQ 1 TATT 1 HIKY 1 TTWR 1 KYTN 1 NPIK 1 IKQK 1 ATAT 1 YTNP 1 AGRD 1 HHHI 1 WRAT 1 ATTW 1
+
+[ $(../src/ffpaa -l 4 -d test1.faa | sum | cut -f1 -d" ") != 25432 ] && exit 1
+
+#Output should look like:
+#TNPI 1 GRDS 1 YPAA 1 TGHH 1 ATGH 1 TWRA 1 AAAA 32 AAAG 1 AAAT 1 HHIK 1 RATG 1 AATY 1 GHHH 1 KAAA 1 KQKA 1 QKAA 1 IKYT 1 AAGR 1 RDSC 1 PIKQ 1 TATT 1 HIKY 1 ATYP 1 TTWR 1 KYTN 1 NPIK 1 IKQK 1 ATAT 1 YTNP 1 PAAA 1 TYPA 1 AGRD [...]
+[ $(../src/ffpaa -l 4 -d test2.faa | sum | cut -f1 -d" ") != 65022 ] && exit 1
+#Output should look like:
+#TNPI 1 GRDS 1 TGHH 1 ATGH 1 TWRA 1 AAAA 39 AAAG 1 HHIK 1 RATG 1 GHHH 1 KAAA 1 KQKA 1 QKAA 1 IKYT 1 AAGR 1 RDSC 1 PIKQ 1 TATT 1 HIKY 1 TTWR 1 KYTN 1 NPIK 1 IKQK 1 ATAT 1 YTNP 1 AGRD 1 HHHI 1 WRAT 1 ATTW 1
+#TNPI 1 GRDS 1 YPAA 1 TGHH 1 ATGH 1 TWRA 1 AAAA 32 AAAG 1 AAAT 1 HHIK 1 RATG 1 AATY 1 GHHH 1 KAAA 1 KQKA 1 QKAA 1 IKYT 1 AAGR 1 RDSC 1 PIKQ 1 TATT 1 HIKY 1 ATYP 1 TTWR 1 KYTN 1 NPIK 1 IKQK 1 ATAT 1 YTNP 1 PAAA 1 TYPA 1 AGRD 1 HHHI 1 WRAT 1 ATTW 1
+[ $(../src/ffpaa -l 4 -d test{1,2}.faa | sum | cut -f1 -d" ") != 24460 ] && exit 1
+
+exit 0
+
diff --git a/tests/ffpaa_test_f.sh b/tests/ffpaa_test_f.sh
new file mode 100755
index 0000000..d8c8f24
--- /dev/null
+++ b/tests/ffpaa_test_f.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env sh
+
+# Use checksum comparison to perform unit tests
+
+echo "ffpaa: Testing option -f, --feature-list" 2>&1
+# Test -f option
+
+#output should be:
+#1 34 1 1 0
+
+[ $(../src/ffpaa -l 9 -f faalist.txt test1.faa | sum | cut -f1 -d" ") != 18413 ] && exit 1
+
+#In combination with -w
+#1 1 34 1
+# Notice that b/c of the redundancy in features (after masking) that
+# one of the features is elimininated.
+
+[ $(../src/ffpaa -l 9 -w 111000111 -f faalist.txt -q test1.faa | sum | cut -f1 -d" ") != 48943 ] && exit 1
+exit 0
+
diff --git a/tests/ffpaa_test_m.sh b/tests/ffpaa_test_m.sh
new file mode 100755
index 0000000..2f308f4
--- /dev/null
+++ b/tests/ffpaa_test_m.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+# Use checksum comparison to perform unit tests
+
+echo "ffpaa: Testing -m,--multiple option " 2>&1
+# Test -l option
+# Output should look like:
+#ASA 1 ASG 1 ASS 1 PIK 1 KAA 1 KAS 1 HIK 1 GKD 1 SSF 1 AAA 40 AAG 1 DSC 1 AGK 1 SFK 1 KDS 1 NPI 1 IKF 1 IKK 1 GHH 1 FSN 1 SAS 1 SGH 1 SNP 1 KFS 1 KKA 1 KKK 1 HHH 1 HHI 1 FKA 1
+#ASA 1 ASF 1 ASG 1 ASS 1 PIK 1 KAA 1 KAS 1 HIK 1 GKD 1 SSF 1 FPA 1 AAA 34 AAG 1 AAS 1 DSC 1 AGK 1 SFK 1 SFP 1 PAA 1 KDS 1 NPI 1 IKF 1 IKK 1 GHH 1 FSN 1 SAS 1 SGH 1 SNP 1 KFS 1 KKA 1 KKK 1 HHH 1 HHI 1 FKA 1
+
+[ $(../src/ffpaa -l 3 -m test{1,2}.faa | sum | cut -f1 -d" ") != 31357 ] && exit 1
+
+exit 0
+
+ 1
diff --git a/tests/ffpaa_test_stdin.sh b/tests/ffpaa_test_stdin.sh
new file mode 100755
index 0000000..cc77274
--- /dev/null
+++ b/tests/ffpaa_test_stdin.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+function cleanup() {
+rm -fr $TMP_FILE
+exit $1
+}
+
+echo "ffpaa: Comparing stdin vs file arg input" 2>&1
+TMP_FILE=$(mktemp)
+BIN=../src
+cat test*.faa > $TMP_FILE
+diff <( $BIN/ffpaa <(cat test*.faa) ) <( cat test*.faa | $BIN/ffpaa ) &> /dev/null || cleanup 1
+diff <( $BIN/ffpaa $TMP_FILE ) <( cat test*.faa | $BIN/ffpaa ) &> /dev/null || cleanup 1
+cleanup 0
+
diff --git a/tests/ffpaa_test_w.sh b/tests/ffpaa_test_w.sh
new file mode 100755
index 0000000..28ac6e8
--- /dev/null
+++ b/tests/ffpaa_test_w.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env sh
+
+# Use checksum comparison to perform unit tests
+
+echo "ffpaa: Testing -w,--mask and -q,--quiet" 2>&1
+# Test -w option and option -q
+#Output should look like:
+#SNPI 1 AGKD 1 SGHH 1 KAAA 40 KASG 2 AAGK 1 SASS 1 NPIK 1 GHHH 1 HHHI 1 HHIK 1 ASSF 1 ASGH 1 SSFK 1 FSNP 1 ASAS 1 HIKF 1 PIKK 1 KDSC 1 KKKA 2 IKKK 1 FKAS 3 SFKA 1 KFSN 1
+
+[ $(../src/ffpaa -l 4 -w "0101" -q test1.faa | sum | cut -f1 -d" ") != 53937 ] && exit 1
+exit 0
+
diff --git a/tests/ffpboot_test_stdin.sh b/tests/ffpboot_test_stdin.sh
new file mode 100755
index 0000000..790c56a
--- /dev/null
+++ b/tests/ffpboot_test_stdin.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+function cleanup() {
+rm -fr $TMP_FILE
+exit $1
+}
+
+echo "ffpboot: Comparing stdin vs file arg input" 2>&1
+TMP_FILE=$(mktemp)
+BIN=../src
+$BIN/ffpry -l 3 *.fna | $BIN/ffpcol > $TMP_FILE
+diff <( cat $TMP_FILE | $BIN/ffpboot -s 2 ) <( $BIN/ffpboot -s 2 $TMP_FILE ) &> /dev/null || cleanup 1
+diff <( $BIN/ffpboot -s 1 $TMP_FILE ) <( cat $TMP_FILE | $BIN/ffpboot -s 1 ) &> /dev/null || cleanup 1
+cleanup 0
+
+
diff --git a/tests/ffpcol_test_stdin.sh b/tests/ffpcol_test_stdin.sh
new file mode 100755
index 0000000..5a1482c
--- /dev/null
+++ b/tests/ffpcol_test_stdin.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+function cleanup() {
+rm -fr $TMP_FILE
+exit $1
+}
+
+
+echo "ffpcol: Comparing stdin vs file arg input" 2>&1
+TMP_FILE=$(mktemp)
+BIN=../src
+$BIN/ffpry -l 3 *.fna > $TMP_FILE
+diff <( cat $TMP_FILE | $BIN/ffpcol ) <( $BIN/ffpcol $TMP_FILE ) &> /dev/null || cleanup 1
+
+cleanup 0
diff --git a/tests/ffpcomplex_test_stdin.sh b/tests/ffpcomplex_test_stdin.sh
new file mode 100755
index 0000000..804d1dc
--- /dev/null
+++ b/tests/ffpcomplex_test_stdin.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+function cleanup() {
+rm -fr $TMP_FILE
+exit $1
+}
+
+
+echo "ffpcomplex: Comparing stdin vs file arg input" 2>&1
+TMP_FILE=$(mktemp)
+BIN=../src
+$BIN/ffpry -l 3 *.fna > $TMP_FILE
+diff <( cat $TMP_FILE | $BIN/ffpcomplex ) <( $BIN/ffpcomplex $TMP_FILE ) &> /dev/null || cleanup 1
+
+
+cleanup 0
diff --git a/tests/ffpjsd_test.sh b/tests/ffpjsd_test.sh
new file mode 100755
index 0000000..be8a2fd
--- /dev/null
+++ b/tests/ffpjsd_test.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+if [ $(../src/ffpry -l 5 test{1..3}.fna | ../src/ffpcol | ../src/ffprwn| ../src/ffpjsd | sum | cut -f1 -d" ") = 08044 ]
+ then
+ exit 0
+else
+ exit 1
+ fi
+
diff --git a/tests/ffpmerge_test.sh b/tests/ffpmerge_test.sh
new file mode 100755
index 0000000..c2f97a4
--- /dev/null
+++ b/tests/ffpmerge_test.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+#20 2 1 16 1 14
+
+if [ $( ../src/ffpry -l 4 test{1,2,3}.fna | ../src/ffpcol | ../src/ffpmerge | sum | cut -f1 -d" ") != 07986 ]
+ then
+ exit 1
+ fi
+
+exit 0
+
+
+
+
diff --git a/tests/ffpre_test.sh b/tests/ffpre_test.sh
new file mode 100755
index 0000000..ea3e4fb
--- /dev/null
+++ b/tests/ffpre_test.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env sh
+
+src="../src"
+# Output should be:
+#-0.431630
+
+# have also gotten on linux AMD 32 bit
+#-0.430877 chksum = 19136
+
+if [ $($src/ffpre -l 3 test*.fna | sum | cut -f1 -d" ") = 19136 ]
+ then
+ exit 0
+else
+ exit 1
+ fi
+
+
+
diff --git a/tests/ffpreprof_test_basic.sh b/tests/ffpreprof_test_basic.sh
new file mode 100755
index 0000000..336c713
--- /dev/null
+++ b/tests/ffpreprof_test_basic.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env sh
+
+echo "ffpreprof: Testing basic functionality" 2>&1
+if [ $( ../scripts/ffpreprof -s 3 -e 8 -p ../src test5.fna | sum | cut -f1 -d" ") = 61901 ]
+ then
+ exit 0
+else
+ exit 1
+ fi
diff --git a/tests/ffprwn_test.sh b/tests/ffprwn_test.sh
new file mode 100755
index 0000000..7cc17df
--- /dev/null
+++ b/tests/ffprwn_test.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+SRC="../src"
+
+#Should look like:
+#0.00e+00 0.00e+00 1.00e+00 0.00e+00 0.00e+00
+#6.43e-01 7.14e-02 2.86e-01 0.00e+00 0.00e+00
+#0.00e+00 0.00e+00 0.00e+00 5.00e-01 5.00e-01
+
+echo "Testing ffprwn normalization" 2>&1
+
+if [ $($SRC/ffpry -l 5 test{1,2,3}.fna | $SRC/ffpcol | $SRC/ffprwn | sum | cut -f1 -d" ") = 25409 ]
+ then
+ exit 0
+else
+ exit 1
+ fi
+
diff --git a/tests/ffprwn_test_stdin.sh b/tests/ffprwn_test_stdin.sh
new file mode 100755
index 0000000..b6902dc
--- /dev/null
+++ b/tests/ffprwn_test_stdin.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+function cleanup() {
+rm -fr $TMP_FILE
+exit $1
+}
+
+
+echo "ffprwn: Comparing stdin vs file arg input" 2>&1
+TMP_FILE=$(mktemp)
+BIN=../src
+$BIN/ffpry -l 3 *.fna | $BIN/ffpcol > $TMP_FILE
+diff <( cat $TMP_FILE | $BIN/ffprwn ) <( $BIN/ffprwn $TMP_FILE ) &> /dev/null || cleanup 1
+
+cleanup 0
diff --git a/tests/ffprwn_test_stdin2.sh b/tests/ffprwn_test_stdin2.sh
new file mode 100755
index 0000000..f7df711
--- /dev/null
+++ b/tests/ffprwn_test_stdin2.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+function cleanup() {
+rm -fr $TMP_FILE
+exit $1
+}
+
+
+echo "ffprwn: Comparing stdin vs file arg input, more input rows" 2>&1
+TMP_FILE=$(mktemp)
+BIN=../src
+$BIN/ffpry -l 3 *.fna *.fna *.fna | $BIN/ffpcol > $TMP_FILE
+diff <( cat $TMP_FILE | $BIN/ffprwn ) <( $BIN/ffprwn $TMP_FILE ) &> /dev/null || cleanup 1
+
+cleanup 0
diff --git a/tests/ffpry_test_basic.sh b/tests/ffpry_test_basic.sh
new file mode 100755
index 0000000..86db117
--- /dev/null
+++ b/tests/ffpry_test_basic.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env sh
+
+
+
+src="../src"
+
+echo "ffpry: Testing basic functionality." 2>&1
+
+# Output should be:
+#YRYRYRYRYR 3 RYRYRYRYRY 5
+[ $($src/ffpry test1.fna | sum | cut -f1 -d" ") = 59338 ] || exit 1
+
+
+exit 0
diff --git a/tests/ffpry_test_d.sh b/tests/ffpry_test_d.sh
new file mode 100755
index 0000000..3329003
--- /dev/null
+++ b/tests/ffpry_test_d.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+src="../src"
+
+echo "ffpry: Testing option -d, --disable" 2>&1
+# Output
+#ATGC 10 CATG 4 TGCA 4
+
+[ $($src/ffpry -l 4 -d test1.fna | sum | cut -f1 -d" ") = 60920 ] || exit 1
+
+exit 0
+
+
diff --git a/tests/ffpry_test_f.sh b/tests/ffpry_test_f.sh
new file mode 100755
index 0000000..e6f869b
--- /dev/null
+++ b/tests/ffpry_test_f.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+src="../src"
+
+echo "ffpry: Testing option -f, --feature-list" 2>&1
+#Should look like:
+#10 0 0 0
+[ $($src/ffpry -l 3 -d -f fnalist.txt test1.fna | sum | cut -f1 -d" ") = 01325 ] || exit 1
+
+exit 0
+
diff --git a/tests/ffpry_test_fidelity.sh b/tests/ffpry_test_fidelity.sh
new file mode 100755
index 0000000..8886f7e
--- /dev/null
+++ b/tests/ffpry_test_fidelity.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+SUM=$(../src/ffpry -l 10 -r -d ecoli | sed 's/\([[:digit:]]\)\t/\1\n/g' | sort -k 1 | sum | cut -f1 -d" ")
+
+[ "$SUM" != "15826" ] && exit 1
+
+exit 0
+
+# validated run should have checksum of 04150
+
diff --git a/tests/ffpry_test_fidelity2.sh b/tests/ffpry_test_fidelity2.sh
new file mode 100755
index 0000000..3e1f9ae
--- /dev/null
+++ b/tests/ffpry_test_fidelity2.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+SUM=$(../src/ffpry -l 20 -r ecoli.2 | sed 's/\([[:digit:]]\)\t/\1\n/g' | sort -k 1 | sum | cut -f1 -d" ")
+
+[ "$SUM" != "58435" ] && exit 1
+
+exit 0
+
+# validated run should have checksum of 04150
+
diff --git a/tests/ffpry_test_l.sh b/tests/ffpry_test_l.sh
new file mode 100755
index 0000000..e5327d8
--- /dev/null
+++ b/tests/ffpry_test_l.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env sh
+
+src="../src"
+
+echo "ffpry: Testing option -l, --length" 2>&1
+#Output should be:
+#RY 14 YR 11
+[ $($src/ffpry -l 2 test1.fna | sum | cut -f1 -d" ") = 43576 ] || exit 1
+
+exit 0
+
+
+
+
diff --git a/tests/ffpry_test_m.sh b/tests/ffpry_test_m.sh
new file mode 100755
index 0000000..8679b15
--- /dev/null
+++ b/tests/ffpry_test_m.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env sh
+
+src="../src"
+
+echo "ffpry: Testing option -m, --multiple" 2>&1
+# Output should be:
+#YRYR 4 RYRY 5
+#RRRR 19 RRRY 1
+[ $( $src/ffpry -l 4 -m test2.fna| sum | cut -f1 -d" ") = 21944 ] || exit 1
+
+exit 0
+
+
+
diff --git a/tests/ffpry_test_r.sh b/tests/ffpry_test_r.sh
new file mode 100755
index 0000000..1d20293
--- /dev/null
+++ b/tests/ffpry_test_r.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+src="../src"
+
+
+# Output should be:
+#YRYR 9 RYRY 11
+echo "ffpry: Testing option -r, --disable-rev" 2>&1
+[ $($src/ffpry -l 4 -r test1.fna | sum | cut -f1 -d" ") = 17342 ] || exit 1
+
+exit 0
+
+
diff --git a/tests/ffpry_test_stdin.sh b/tests/ffpry_test_stdin.sh
new file mode 100755
index 0000000..33f53bf
--- /dev/null
+++ b/tests/ffpry_test_stdin.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+function cleanup() {
+rm -fr $TMP_FILE
+exit $1
+}
+
+TMP_FILE=$(mktemp)
+BIN=../src
+cat test*.fna > $TMP_FILE
+
+echo "ffpry: Comparing stdin vs file arg input" 2>&1
+#process substitution
+diff <( $BIN/ffpry <(cat test*.fna) ) <( cat test*.fna | $BIN/ffpry ) &> /dev/null || cleanup 1
+#directly vi a file
+diff <( $BIN/ffpry $TMP_FILE ) <( cat test*.fna | $BIN/ffpry ) &> /dev/null || cleanup 1
+
+
+cleanup 0
+
diff --git a/tests/ffpry_test_w.sh b/tests/ffpry_test_w.sh
new file mode 100755
index 0000000..54b4170
--- /dev/null
+++ b/tests/ffpry_test_w.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+src="../src"
+
+echo "ffpry: Testing option -w, --mask" 2>&1
+# Should look like:
+#ATC 3 TCA 1
+[ $($src/ffpry -l 3 -d -w 110 -q test3.fna 2> /dev/null | sum | cut -f1 -d" ") = 33236 ] || exit 1
+
+exit 0
+
diff --git a/tests/ffptxt_test.sh b/tests/ffptxt_test.sh
new file mode 100755
index 0000000..7496f29
--- /dev/null
+++ b/tests/ffptxt_test.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env sh
+
+# Use checksum comparison to perform unit tests
+
+# Test basic functionality
+#should look like:
+
+#MINO 1 QUEN 1 CIDS 1 HIKY 1 HHHI 1 ATGH 1 AAAA 39 AAAG 1 WRAT 1 TNPI 1 PIKQ 1 TATT 1 ENCE 1 UENC 1 DSEQ 1 YTNP 1 HHIK 1 CEAT 1 TTWR 1 RDSC 1 ATTW 1 GHHH 1 TGHH 1 ATAT 1 EQUE 1 KAAA 1 EATA 1 IDSE 1 OACI 1 ACID 1 GRDS 1 IKQK 1 AAGR 1 NOAC 1 QKAA 1 SEQU 1 IKYT 1 TWRA 1 KQKA 1 INOA 1 AGRD 1 RATG 1 KYTN 1 AMIN 1 NCEA 1 NPIK 1
+#AATY 1 MINO 1 QUEN 1 CIDS 1 HIKY 1 HHHI 1 ATGH 1 AAAA 32 AAAG 1 AAAT 1 WRAT 1 TNPI 1 PIKQ 1 TATT 1 ENCE 1 UENC 1 DSEQ 1 YTNP 1 HHIK 1 CEAT 1 TTWR 1 RDSC 1 ATTW 1 GHHH 1 TGHH 1 ATAT 1 EQUE 1 KAAA 1 EATA 1 IDSE 1 OACI 1 ACID 1 ATYP 1 GRDS 1 IKQK 1 AAGR 1 TYPA 1 NOAC 1 QKAA 1 SEQU 1 IKYT 1 TWRA 1 PAAA 1 KQKA 1 INOA 1 AGRD 1 RATG 1 KYTN 1 AMIN 1 NCEA 1 NPIK 1 YPAA 1
+#AATY 1 MINO 1 QUEN 1 CIDS 1 HIKY 1 HHHI 1 ATGH 1 YYAA 1 AAAA 27 AAAG 1 AAAT 1 WRAT 1 TNPI 1 PIKQ 1 TATT 1 ENCE 1 YYYA 1 UENC 1 DSEQ 1 YTNP 1 HHIK 1 CEAT 1 TTWR 1 RDSC 1 ATTW 1 GHHH 1 TGHH 1 ATAT 1 EQUE 1 YAAA 1 EATA 1 IDSE 1 OACI 1 ACID 1 ATYP 1 GRDS 1 IKQK 1 AAGR 1 TYPA 1 NOAC 1 QKAY 1 KAYY 1 SEQU 1 IKYT 1 TWRA 1 PAAA 1 KQKA 1 AYYY 1 INOA 1 AGRD 1 RATG 1 KYTN 1 AMIN 1 NCEA 1 NPIK 1 YPAA 1
+#AATY 2 MINO 2 QUEN 2 CIDS 2 HIKQ 1 HIKY 1 HHHI 1 ATGH 2 YYAA 2 AAAA 42 AAAG 2 AAAT 2 AAAW 2 WRAT 2 TNPI 1 PIKQ 1 TATT 2 ENCE 2 YYYA 2 UENC 2 DSEQ 2 YTNP 1 HHIK 2 CEAT 1 TTWR 2 ATTW 2 GHHH 1 GHHI 1 TGHH 2 ATAT 2 EQUE 2 YAAA 2 WKAA 2 KAAA 2 EATA 1 IDSE 2 RESC 2 OACI 2 ACID 2 ATYP 2 IKQK 2 AAGR 2 TYPA 2 NOAC 2 QKAY 2 KAYY 2 SEQU 2 IKYT 1 TWRA 2 PAAA 2 AWKA 2 AAWK 2 KQKA 2 AYYY 2 INOA 2 AGRE 2 RATG 2 GRES 2 KYTN 1 AMIN 2 NCEA 1 NPIK 1 YPAA 2
+
+[ $(../src/ffptxt -l 4 test*.faa | sum | cut -f1 -d" ") != 46374 ] && exit 1
+
+exit 0
+
+
+
diff --git a/tests/ffpvocab_test.sh b/tests/ffpvocab_test.sh
new file mode 100755
index 0000000..d1aac03
--- /dev/null
+++ b/tests/ffpvocab_test.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+function cleanup() {
+rm -fr $TMP_FILE
+exit $1
+}
+
+
+echo "ffpvocab: Comparing to expected output." 2>&1
+
+# should look like:
+#1.400000e+00
+if [ $( ../src/ffpry -l 3 test*.fna | ../src/ffpvocab -f 3 | sum | cut -f1 -d" ") = 55055 ] ; then
+ exit 0
+else
+ exit 1
+fi
+
+echo "ffpvocab: Comparing stdin vs file arg input" 2>&1
+TMP_FILE=$(mktemp)
+BIN=../src
+$BIN/ffpry *.fna > $TMP_FILE
+diff <( cat $TMP_FILE | $BIN/ffpvocab ) <( $BIN/ffpvocab $TMP_FILE ) &> /dev/null || cleanup 1
+
+cleanup 0
+
diff --git a/tests/ffpvprof_test_basic.sh b/tests/ffpvprof_test_basic.sh
new file mode 100755
index 0000000..cad00dd
--- /dev/null
+++ b/tests/ffpvprof_test_basic.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env sh
+# output should look like this:
+
+#3 4.000000e+00
+#4 1.000000e+01
+#5 1.500000e+01
+
+echo "ffpvprof: Testing basic functionality" 2>&1
+[ $( ../scripts/ffpvprof -s 3 -e 5 -p ../src test5.fna | sum | cut -f1 -d" ") = 18942 ] || exit 1
+
+# Output should look like this:
+#3 8.000000e+00
+#4 1.400000e+01
+#5 2.300000e+01
+
+[ $( ../scripts/ffpvprof -s 3 -e 5 -r -p ../src test5.fna | sum | cut -f1 -d" ") = 19598 ] || exit 1
+
+# Output should look like this
+#3 1.000000e+00
+#4 1.000000e+00
+#5 1.000000e+00
+[ $( ../scripts/ffpvprof -s 3 -e 5 -a -p ../src test1.faa | sum | cut -f1 -d" ") = 51196 ] || exit 1
+
+
+exit 0
+
diff --git a/tests/fnalist.txt b/tests/fnalist.txt
new file mode 100644
index 0000000..4944df8
--- /dev/null
+++ b/tests/fnalist.txt
@@ -0,0 +1,4 @@
+ATG
+TTC
+AAA
+GGG
diff --git a/tests/test1.faa b/tests/test1.faa
new file mode 100644
index 0000000..70bbd73
--- /dev/null
+++ b/tests/test1.faa
@@ -0,0 +1,3 @@
+>Amino acid Sequence
+ATATTWRATGHHHIKYTNPIKQKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGRDSC
+
diff --git a/tests/test1.fna b/tests/test1.fna
new file mode 100644
index 0000000..bcfd2ff
--- /dev/null
+++ b/tests/test1.fna
@@ -0,0 +1,3 @@
+>asdfghjklqwertyuiopzxcvbnm,./';][\=-0987654321`~!@#$%^&*()_+
+ATGCATGCATGCNRY
+ATGCATGCATGCnry
diff --git a/tests/test2.faa b/tests/test2.faa
new file mode 100644
index 0000000..8a2cc13
--- /dev/null
+++ b/tests/test2.faa
@@ -0,0 +1,3 @@
+>Amino acid Sequence
+ATATTWRATGHHHIKYTNPIKQKAAAAAAAAAAAAAAAATYPAAAAAAAAAAAAAAAAAAAAAAGRDSC
+
diff --git a/tests/test2.fna b/tests/test2.fna
new file mode 100644
index 0000000..97f6d8c
--- /dev/null
+++ b/tests/test2.fna
@@ -0,0 +1,4 @@
+>asdfghjklqwertyuiopzxcvbnm,./';][\=-0987654321`~!@#$%^&*()_+
+ATGCATGCATGCNRY
+>asdfghjklqwertyuiopzxcvbnm,./';][\=-0987654321`~!@#$%^&*()_+
+TTTTTTTTTTTTnrytttttttttttt
diff --git a/tests/test3.faa b/tests/test3.faa
new file mode 100644
index 0000000..030bf0f
--- /dev/null
+++ b/tests/test3.faa
@@ -0,0 +1,3 @@
+>Amino acid Sequence
+ATATTWRATGHHHIKYTNPIKQKAYYYAAAAAAAAAAATYPAAAAAAAAAAAAAAAAAAAAAAGRDSC
+
diff --git a/tests/test3.fna b/tests/test3.fna
new file mode 100644
index 0000000..d8595e5
--- /dev/null
+++ b/tests/test3.fna
@@ -0,0 +1,2 @@
+>jasdkfldjafadjskljsfajsf
+ATCATG
diff --git a/tests/test4.faa b/tests/test4.faa
new file mode 100644
index 0000000..8c241f8
--- /dev/null
+++ b/tests/test4.faa
@@ -0,0 +1,4 @@
+>Amino acid Sequence
+ATATTWRATGHHHIKYTNPIKQKAYYYAAAAAAAAAAATYPAAAAAAAAAWKAAAAAAAAAAGRESC
+>Amino acid Sequence 2
+ATATTWRATGHHIKQKAYYYAAAAAAAAAAATYPAAAAAAAAAWKAAAAAAAAAAGRESC
diff --git a/tests/test4.fna b/tests/test4.fna
new file mode 100644
index 0000000..ad15988
--- /dev/null
+++ b/tests/test4.fna
@@ -0,0 +1,2 @@
+>Test for aa translation
+TTCNCTTN
diff --git a/tests/test5.fna b/tests/test5.fna
new file mode 100644
index 0000000..35763dd
--- /dev/null
+++ b/tests/test5.fna
@@ -0,0 +1,2 @@
+>jasdkfldjafadjskljsfajsf
+aacgatcgatcgtactacgacagccccgcgactagtcagctatcgactgtacgatgcagtagctgtcccccgcgcgcgcgcgcggactactagctcatcgatctcactgactatcgtaactagctgcatggcatgcgcgcgcgcccgtactagga
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/ffp.git
More information about the debian-med-commit
mailing list