[Pkg-ofed-commits] [qperf] 01/02: New upstream version 0.4.9

Brian Smith bsmith-guest at moszumanska.debian.org
Thu Nov 9 02:24:32 UTC 2017


This is an automated email from the git hooks/post-receive script.

bsmith-guest pushed a commit to branch master
in repository qperf.

commit 3e87daffc6c114fab953a23270d10901914ef2dc
Author: Brian T. Smith <bsmith at systemfabricworks.com>
Date:   Wed Nov 8 16:52:46 2017 -0600

    New upstream version 0.4.9
---
 AUTHORS         |    7 +
 COPYING         |  339 ++++
 ChangeLog       |    0
 Makefile.am     |    6 +
 Makefile.in     |  583 +++++++
 NEWS            |    0
 README          |   18 +
 aclocal.m4      |  868 ++++++++++
 autogen.sh      |    9 +
 cleanup         |   38 +
 configure       | 4905 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.in    |   10 +
 depcomp         |  589 +++++++
 install-sh      |  519 ++++++
 missing         |  367 +++++
 qperf.spec      |   39 +
 qperf.spec.in   |   39 +
 src/Makefile.am |   28 +
 src/Makefile.in |  481 ++++++
 src/help.txt    |  981 +++++++++++
 src/mkhelp      |  113 ++
 src/mkman       |  198 +++
 src/qperf.c     | 2866 ++++++++++++++++++++++++++++++++
 src/qperf.h     |  373 +++++
 src/rdma.c      | 2617 +++++++++++++++++++++++++++++
 src/rds.c       |  520 ++++++
 src/socket.c    |  819 ++++++++++
 src/support.c   |  673 ++++++++
 28 files changed, 18005 insertions(+)

diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..42391d1
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,7 @@
+Written by Johann George
+
+Thanks to the following for their contributions:
+    Dotan Barak
+    Ralph Campbell
+    Yevgeny Kliteynik
+    Dave Olson
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..0ae8019
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,6 @@
+SUBDIRS = src
+
+EXTRA_DIST = qperf.spec.in
+
+dist-hook: qperf.spec
+	cp qperf.spec $(distdir)
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..9c8f661
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,583 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@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 = :
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/qperf.spec.in \
+	$(top_srcdir)/configure AUTHORS COPYING ChangeLog NEWS depcomp \
+	install-sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+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_CLEAN_FILES = qperf.spec
+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
+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); }; }
+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@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EXEEXT = @EXEEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+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_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+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@
+SUBDIRS = src
+EXTRA_DIST = qperf.spec.in
+all: 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 '; \
+	      cd $(srcdir) && $(AUTOMAKE) --foreign  \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
+	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)
+	cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+qperf.spec: $(top_builddir)/config.status $(srcdir)/qperf.spec.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+
+# 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):
+	@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; \
+	  (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):
+	@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; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (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; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	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 || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	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; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	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)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && 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 $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$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; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+	$(MAKE) $(AM_MAKEFLAGS) \
+	  top_distdir="$(top_distdir)" distdir="$(distdir)" \
+	  dist-hook
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -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-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) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lzma*) \
+	  unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(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)
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && 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
+	$(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:
+	@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
+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)
+
+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-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+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) install-am \
+	install-strip
+
+.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-zip distcheck \
+	distclean distclean-generic 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: qperf.spec
+	cp qperf.spec $(distdir)
+# 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..e69de29
diff --git a/README b/README
new file mode 100644
index 0000000..f943c47
--- /dev/null
+++ b/README
@@ -0,0 +1,18 @@
+To build
+    ./cleanup
+    ./autogen.sh
+    ./configure
+    make
+
+Changing version
+    * src/qperf.c: Change VER_MAJ, VER_MIN and VER_INC.
+    * configure.in: Change in AC_INIT and AM_INIT_AUTOMAKE
+    * qperf.spec: Change line beginning with Version:
+    * Note ensure that qperf.spec is modified last so that cleanup does not
+      delete it.
+
+Notes
+    * If the library ibverbs is not found, a version of qperf is built that
+      does not support the RDMA tests.
+    * Running "make clean" does not seem to clean up everything.  Run
+      "./cleanup" instead.
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..132e431
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,868 @@
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 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.
+
+# 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(AC_AUTOCONF_VERSION, [2.63],,
+[m4_warning([this file was generated for autoconf 2.63.
+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  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.10'
+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.10.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 AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(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
+# 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 8
+
+# 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
+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
+# 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
+
+# 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
+  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
+
+    case $depmode in
+    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
+      ;;
+    none) break ;;
+    esac
+    # 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.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} 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 sub/conftest.${OBJEXT-o} 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
+# 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 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; 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 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 13
+
+# 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.60])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)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+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
+])
+])
+
+
+# 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  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
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+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  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 3
+
+# 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 done
+.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
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+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
+# 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_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
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# 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  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 3
+
+# _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],
+[AC_FOREACH([_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
+# 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_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# 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  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_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_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/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..b39d514
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -x
+for f in NEWS README ChangeLog; do
+    [ -e "$f" ] || touch "$f"
+done
+aclocal &&
+    automake --foreign --add-missing --copy &&
+    autoconf
diff --git a/cleanup b/cleanup
new file mode 100755
index 0000000..46ea5db
--- /dev/null
+++ b/cleanup
@@ -0,0 +1,38 @@
+#!/bin/sh
+# autotools makes such a mess.  Clean up after it.
+#
+for f in AUTHORS NEWS README ChangeLog; do
+    [ -s "$f" ] || rm -f "$f"
+done
+rm -r -f autom4te.cache .deps src/.deps
+rm -f `cat <<EOF
+    INSTALL
+    Makefile
+    Makefile.in
+    aclocal.m4
+    config.log
+    config.status
+    configure
+    depcomp
+    install-sh
+    missing
+    src/Makefile
+    src/Makefile.in
+    src/*.o
+    src/help.c
+    src/qperf.1
+    src/qperf
+EOF`
+
+# We need to keep qperf.spec around for the OFED scripts but delete it if we do
+# not think it is correct.  This might be due to three reasons: (1) it does not
+# represent the RDMA version, (2) qperf.spec.in is newer and (3) configure.in
+# is newer.
+#
+if
+    ! grep -q -s '^BuildRequires: *libibverbs-devel' qperf.spec ||
+    [ qperf.spec.in -nt qperf.spec ] ||
+    [ configure.in -nt qperf.spec ]
+then
+    rm -f qperf.spec
+fi
diff --git a/configure b/configure
new file mode 100755
index 0000000..024de9d
--- /dev/null
+++ b/configure
@@ -0,0 +1,4905 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.63 for qperf 0.4.9.
+#
+# Report bugs to <general at lists.openfabrics.org>.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008 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
+
+
+
+
+# PATH needs CR
+# 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_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
+if (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
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+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.
+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); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+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
+
+
+# Name of the executable.
+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'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes &&	 (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  case $as_dir in
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+	 # Try only shells that exist, to save several forks.
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+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
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+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_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+	do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+	done
+	export CONFIG_SHELL
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell bug-autoconf at gnu.org about your system,
+  echo including any error possibly output before this message.
+  echo This can help us improve future autoconf versions.
+  echo Configuration will now proceed without shell functions.
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  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
+   { (exit 1); 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
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+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=:
+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 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, 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=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='qperf'
+PACKAGE_TARNAME='qperf'
+PACKAGE_VERSION='0.4.9'
+PACKAGE_STRING='qperf 0.4.9'
+PACKAGE_BUGREPORT='general at lists.openfabrics.org'
+
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+HAS_XRC_FALSE
+HAS_XRC_TRUE
+RDMA_FALSE
+RDMA_TRUE
+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
+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_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS'
+
+
+# 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=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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+   { (exit 1); exit 1; }; }
+    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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+   { (exit 1); exit 1; }; }
+    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_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+   { (exit 1); exit 1; }; }
+    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_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+   { (exit 1); exit 1; }; }
+    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_echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    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_echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
+   { (exit 1); exit 1; }; } ;;
+    *)     $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_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
+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_echo "$as_me: error: working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
+# 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_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
+   { (exit 1); exit 1; }; }
+	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 qperf 0.4.9 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/qperf]
+  --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
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of qperf 0.4.9:";;
+   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-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    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+
+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 <general at lists.openfabrics.org>.
+_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
+qperf configure 0.4.9
+generated by GNU Autoconf 2.63
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 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
+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 qperf $as_me 0.4.9, which was
+generated by GNU Autoconf 2.63.  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) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$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
+      ac_configure_args="$ac_configure_args '$ac_arg'"
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    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:$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= ;; #(
+      *) $as_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
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    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
+      cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+      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
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      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'; { (exit 1); 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
+
+# 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
+
+
+# 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
+  ac_site_file1=$CONFIG_SITE
+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 -r "$ac_site_file"; then
+    { $as_echo "$as_me:$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"
+  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.
+  if test -f "$cache_file"; then
+    { $as_echo "$as_me:$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:$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:$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:$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:$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:$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:$LINENO:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:$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.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+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
+
+
+am__api_version='1.10'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; 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_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+   { (exit 1); exit 1; }; }
+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.
+
+
+# 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:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; 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:$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:$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
+# 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_echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+$as_echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+$as_echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+{ $as_echo "$as_me:$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`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+{ $as_echo "$as_me:$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 test "${ac_cv_path_mkdir+set}" = set; 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
+
+  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.
+    test -d ./--version && rmdir ./--version
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; 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:$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:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:$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 { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; 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:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+  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=qperf
+ VERSION=0.4.9
+
+
+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"}
+
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+
+# 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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; 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:$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:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; 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:$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:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:$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:$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"
+
+# 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_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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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:$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:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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:$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:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:$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:$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:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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:$LINENO: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; 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
+
+{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:$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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:$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 test "${ac_cv_c_compiler_gnu+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	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:$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:$LINENO: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; 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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+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:$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:$LINENO: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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"
+  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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+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:$LINENO: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+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
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:$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
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+{ $as_echo "$as_me:$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
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; 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
+  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
+
+    case $depmode in
+    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
+      ;;
+    none) break ;;
+    esac
+    # 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.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} 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 sub/conftest.${OBJEXT-o} 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:$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
+
+
+
+{ $as_echo "$as_me:$LINENO: checking for ibv_open_device in -libverbs" >&5
+$as_echo_n "checking for ibv_open_device in -libverbs... " >&6; }
+if test "${ac_cv_lib_ibverbs_ibv_open_device+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-libverbs  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ibv_open_device ();
+int
+main ()
+{
+return ibv_open_device ();
+  ;
+  return 0;
+}
+_ACEOF
+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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 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_cv_lib_ibverbs_ibv_open_device=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_ibverbs_ibv_open_device=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ibverbs_ibv_open_device" >&5
+$as_echo "$ac_cv_lib_ibverbs_ibv_open_device" >&6; }
+if test "x$ac_cv_lib_ibverbs_ibv_open_device" = x""yes; then
+  RDMA=1
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for ibv_open_xrc_domain in -libverbs" >&5
+$as_echo_n "checking for ibv_open_xrc_domain in -libverbs... " >&6; }
+if test "${ac_cv_lib_ibverbs_ibv_open_xrc_domain+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-libverbs  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ibv_open_xrc_domain ();
+int
+main ()
+{
+return ibv_open_xrc_domain ();
+  ;
+  return 0;
+}
+_ACEOF
+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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 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_cv_lib_ibverbs_ibv_open_xrc_domain=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_ibverbs_ibv_open_xrc_domain=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ibverbs_ibv_open_xrc_domain" >&5
+$as_echo "$ac_cv_lib_ibverbs_ibv_open_xrc_domain" >&6; }
+if test "x$ac_cv_lib_ibverbs_ibv_open_xrc_domain" = x""yes; then
+  HAS_XRC=1
+fi
+
+
+{ $as_echo "$as_me:$LINENO: checking for rdma_create_id in -lrdmacm" >&5
+$as_echo_n "checking for rdma_create_id in -lrdmacm... " >&6; }
+if test "${ac_cv_lib_rdmacm_rdma_create_id+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrdmacm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char rdma_create_id ();
+int
+main ()
+{
+return rdma_create_id ();
+  ;
+  return 0;
+}
+_ACEOF
+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:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 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_cv_lib_rdmacm_rdma_create_id=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_rdmacm_rdma_create_id=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_rdmacm_rdma_create_id" >&5
+$as_echo "$ac_cv_lib_rdmacm_rdma_create_id" >&6; }
+if test "x$ac_cv_lib_rdmacm_rdma_create_id" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBRDMACM 1
+_ACEOF
+
+  LIBS="-lrdmacm $LIBS"
+
+fi
+
+ if test -n "$RDMA"; then
+  RDMA_TRUE=
+  RDMA_FALSE='#'
+else
+  RDMA_TRUE='#'
+  RDMA_FALSE=
+fi
+
+ if test -n "$HAS_XRC"; then
+  HAS_XRC_TRUE=
+  HAS_XRC_FALSE='#'
+else
+  HAS_XRC_TRUE='#'
+  HAS_XRC_FALSE=
+fi
+
+ac_config_files="$ac_config_files qperf.spec"
+
+ac_config_files="$ac_config_files Makefile src/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:$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= ;; #(
+      *) $as_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
+    test "x$cache_file" != "x/dev/null" &&
+      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { $as_echo "$as_me:$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}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+	g
+	s/^\n//
+	s/\n/ /g
+	p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+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.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${RDMA_TRUE}" && test -z "${RDMA_FALSE}"; then
+  { { $as_echo "$as_me:$LINENO: error: conditional \"RDMA\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"RDMA\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAS_XRC_TRUE}" && test -z "${HAS_XRC_FALSE}"; then
+  { { $as_echo "$as_me:$LINENO: error: conditional \"HAS_XRC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"HAS_XRC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+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:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_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}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_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
+
+
+
+
+# PATH needs CR
+# 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_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
+if (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
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+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.
+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); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+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
+
+
+# Name of the executable.
+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'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  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
+   { (exit 1); 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
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+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=:
+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
+
+# 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 qperf $as_me 0.4.9, which was
+generated by GNU Autoconf 2.63.  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
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTION]... [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, 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
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf at gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+qperf config.status 0.4.9
+configured by $0, generated by GNU Autoconf 2.63,
+  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2008 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=$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 ;;
+  --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"` ;;
+    esac
+    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h |  --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_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$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
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "qperf.spec") CONFIG_FILES="$CONFIG_FILES qperf.spec" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+
+  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  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_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=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   $as_echo "$as_me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+# 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='
'
+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 {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+
+  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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  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 >>"\$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 >>"\$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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+   { (exit 1); exit 1; }; }
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ 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[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X "  :F $CONFIG_FILES      :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_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
+   { (exit 1); exit 1; }; };;
+  :[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="$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_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      ac_file_inputs="$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:$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 >"$tmp/stdin" \
+      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; } ;;
+    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"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  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:$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 "$tmp/subs.awk" >$tmp/out \
+  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; }
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:$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 "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  esac \
+  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; }
+ ;;
+
+
+  :C)  { $as_echo "$as_me:$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"" || for mf in $CONFIG_FILES; 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
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+
+  esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+
+
+# 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 || { (exit 1); exit 1; }
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..751ef6d
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,10 @@
+AC_INIT(qperf, 0.4.9, general at lists.openfabrics.org)
+AM_INIT_AUTOMAKE(qperf, 0.4.9)
+AC_PROG_CC
+AC_CHECK_LIB(ibverbs, ibv_open_device, RDMA=1)
+AC_CHECK_LIB(ibverbs, ibv_open_xrc_domain, HAS_XRC=1)
+AC_CHECK_LIB(rdmacm, rdma_create_id)
+AM_CONDITIONAL(RDMA, test -n "$RDMA")
+AM_CONDITIONAL(HAS_XRC, test -n "$HAS_XRC")
+AC_CONFIG_FILES([qperf.spec])
+AC_OUTPUT(Makefile src/Makefile)
diff --git a/depcomp b/depcomp
new file mode 100755
index 0000000..e5f9736
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,589 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2007-03-29.01
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 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 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
+
+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 $1 != '--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 $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    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.
+    -*|$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 $1 != '--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, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+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-end: "$"
+# End:
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..a5897de
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,519 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2006-12-25.00
+
+# 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-end: "$"
+# End:
diff --git a/missing b/missing
new file mode 100755
index 0000000..1c8ff70
--- /dev/null
+++ b/missing
@@ -0,0 +1,367 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2006-05-10.23
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
+#   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, 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.
+
+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]
+
+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
+
+# 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).
+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 $1 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 1
+    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-end: "$"
+# End:
diff --git a/qperf.spec b/qperf.spec
new file mode 100644
index 0000000..bb23259
--- /dev/null
+++ b/qperf.spec
@@ -0,0 +1,39 @@
+Name:           qperf
+Summary:        Measure socket and RDMA performance
+Version:        0.4.9
+Release:        1
+License:        BSD 3-Clause, GPL v2
+Group:          Networking/Diagnostic
+Source:         http://www.openfabrics.org/downloads/qperf/%{name}-%{version}.tar.gz
+Url:            http://www.openfabrics.org
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+BuildRequires:  libibverbs-devel
+BuildRequires:  librdmacm-devel
+
+%description
+Measure socket and RDMA performance.
+
+%prep
+%setup -q
+
+%build
+%configure
+export CFLAGS="$RPM_OPT_FLAGS"
+%{__make}
+
+%install
+install -D -m 0755 src/qperf $RPM_BUILD_ROOT%{_bindir}/qperf
+install -D -m 0644 src/qperf.1 $RPM_BUILD_ROOT%{_mandir}/man1/qperf.1
+
+%clean
+rm -rf ${RPM_BUILD_ROOT}
+
+%files
+%defattr(-, root, root)
+%doc COPYING
+%_bindir/qperf
+%_mandir/man1/qperf.1*
+
+%changelog
+* Sat Oct 20 2007 - johann at georgex.org
+- Initial package
diff --git a/qperf.spec.in b/qperf.spec.in
new file mode 100644
index 0000000..4fd4f0a
--- /dev/null
+++ b/qperf.spec.in
@@ -0,0 +1,39 @@
+Name:           qperf
+Summary:        Measure socket and RDMA performance
+Version:        @VERSION@
+Release:        1
+License:        BSD 3-Clause, GPL v2
+Group:          Networking/Diagnostic
+Source:         http://www.openfabrics.org/downloads/qperf/%{name}-%{version}.tar.gz
+Url:            http://www.openfabrics.org
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+ at RDMA_TRUE@BuildRequires:  libibverbs-devel
+ at RDMA_TRUE@BuildRequires:  librdmacm-devel
+
+%description
+Measure socket and RDMA performance.
+
+%prep
+%setup -q
+
+%build
+%configure
+export CFLAGS="$RPM_OPT_FLAGS"
+%{__make}
+
+%install
+install -D -m 0755 src/qperf $RPM_BUILD_ROOT%{_bindir}/qperf
+install -D -m 0644 src/qperf.1 $RPM_BUILD_ROOT%{_mandir}/man1/qperf.1
+
+%clean
+rm -rf ${RPM_BUILD_ROOT}
+
+%files
+%defattr(-, root, root)
+%doc COPYING
+%_bindir/qperf
+%_mandir/man1/qperf.1*
+
+%changelog
+* Sat Oct 20 2007 - johann at georgex.org
+- Initial package
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..bd91c70
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,28 @@
+bin_PROGRAMS = qperf
+
+if RDMA
+AM_CFLAGS = -Wall -O -DRDMA
+if HAS_XRC
+AM_CFLAGS += -DHAS_XRC=1
+endif
+qperf_SOURCES = qperf.c socket.c rds.c rdma.c support.c help.c qperf.h
+qperf_LDADD = -libverbs
+else
+AM_CFLAGS = -Wall -O
+qperf_SOURCES = qperf.c socket.c rds.c support.c help.c qperf.h
+endif
+
+man_MANS = qperf.1
+
+qperf.1: help.txt
+	./mkman >qperf.1
+
+help.c: help.txt
+if RDMA
+	./mkhelp RDMA
+else
+	./mkhelp
+endif
+
+clean-local:
+	-rm -f qperf.1
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..7f2debc
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,481 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@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 = :
+bin_PROGRAMS = qperf$(EXEEXT)
+ at HAS_XRC_TRUE@@RDMA_TRUE at am__append_1 = -DHAS_XRC=1
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am__qperf_SOURCES_DIST = qperf.c socket.c rds.c support.c help.c \
+	qperf.h rdma.c
+ at RDMA_FALSE@am_qperf_OBJECTS = qperf.$(OBJEXT) socket.$(OBJEXT) \
+ at RDMA_FALSE@	rds.$(OBJEXT) support.$(OBJEXT) help.$(OBJEXT)
+ at RDMA_TRUE@am_qperf_OBJECTS = qperf.$(OBJEXT) socket.$(OBJEXT) \
+ at RDMA_TRUE@	rds.$(OBJEXT) rdma.$(OBJEXT) support.$(OBJEXT) \
+ at RDMA_TRUE@	help.$(OBJEXT)
+qperf_OBJECTS = $(am_qperf_OBJECTS)
+qperf_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. at am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(qperf_SOURCES)
+DIST_SOURCES = $(am__qperf_SOURCES_DIST)
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+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@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EXEEXT = @EXEEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+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_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+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 RDMA_FALSE@AM_CFLAGS = -Wall -O
+ at RDMA_TRUE@AM_CFLAGS = -Wall -O -DRDMA $(am__append_1)
+ at RDMA_FALSE@qperf_SOURCES = qperf.c socket.c rds.c support.c help.c qperf.h
+ at RDMA_TRUE@qperf_SOURCES = qperf.c socket.c rds.c rdma.c support.c help.c qperf.h
+ at RDMA_TRUE@qperf_LDADD = -libverbs
+man_MANS = qperf.1
+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 \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
+	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
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(bindir)/$$f"; \
+	done
+
+clean-binPROGRAMS:
+	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+qperf$(EXEEXT): $(qperf_OBJECTS) $(qperf_DEPENDENCIES) 
+	@rm -f qperf$(EXEEXT)
+	$(LINK) $(qperf_OBJECTS) $(qperf_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/help.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/qperf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rdma.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rds.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/socket.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/support.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@	mv -f $(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@	mv -f $(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) '$<'`
+install-man1: $(man1_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+	done
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+	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; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	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; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	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)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && 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 $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$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) $(MANS)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-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)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-local 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
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-ps: 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 uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-local 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-man1 \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-binPROGRAMS \
+	uninstall-man uninstall-man1
+
+
+qperf.1: help.txt
+	./mkman >qperf.1
+
+help.c: help.txt
+ at RDMA_TRUE@	./mkhelp RDMA
+ at RDMA_FALSE@	./mkhelp
+
+clean-local:
+	-rm -f qperf.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/src/help.txt b/src/help.txt
new file mode 100644
index 0000000..051803f
--- /dev/null
+++ b/src/help.txt
@@ -0,0 +1,981 @@
+Main
+    Synopsis
+        qperf
+        qperf SERVERNODE [OPTIONS] TESTS
+
+    Description
+        qperf measures bandwidth and latency between two nodes.  It can work
+        over TCP/IP as well as the RDMA transports.  On one of the nodes, qperf
+        is typically run with no arguments designating it the server node.  One
+        may then run qperf on a client node to obtain measurements such as
+        bandwidth, latency and cpu utilization.
+
+        In its most basic form, qperf is run on one node in server mode by
+        invoking it with no arguments.  On the other node, it is run with two
+        arguments: the name of the server node followed by the name of the
+        test.  A list of tests can be found in the section, TESTS.  A variety
+        of options may also be specified.
+
+        One can get more detailed information on qperf by using the --help
+        option.  Below are examples of using the --help option:
+
+            qperf --help examples       Some examples of using qperf
+            qperf --help opts           Summary of options
+            qperf --help options        Description of options
+            qperf --help tests          Short summary and description of tests
+            qperf --help TESTNAME       More information on test TESTNAME
+Author
+    Written by Johann George.
+Bugs
+    None of the RDMA tests are available if qperf is compiled without the RDMA
+    libraries.  None of the XRC tests are available if qperf is compiled
+    without the XRC extensions.  The -f option is not yet implemented in many
+    of the tests.
+Categories -RDMA
+    To get help on a particular category, you may type:
+        qperf --help CATEGORY
+    where CATEGORY might be one of the following:
+        categories          This current list being displayed
+        examples            Some examples
+        options             A long list of options
+        opts                A short description of the options
+        tests               A list and description of the various tests
+    or one of the following tests:
+        conf
+        quit
+        rds_bw
+        rds_lat
+        sctp_bw
+        sctp_lat
+        sdp_bw
+        sdp_lat
+        tcp_bw
+        tcp_lat
+        udp_bw
+        udp_lat
+Categories +RDMA
+    To get help on a particular category, you may type:
+        qperf --help CATEGORY
+    where CATEGORY might be one of the following:
+        categories          This current list being displayed
+        examples            Some examples
+        options             A long list of options
+        opts                A short description of the options
+        tests               A list of tests
+    CATEGORY may also be one of the following tests
+        conf
+        quit
+        rc_bi_bw
+        rc_bw
+        rc_compare_swap_mr
+        rc_fetch_add_mr
+        rc_lat
+        rc_rdma_read_bw
+        rc_rdma_read_lat
+        rc_rdma_write_bw
+        rc_rdma_write_lat
+        rc_rdma_write_poll_lat
+        rds_bw
+        rds_lat
+        sctp_bw
+        sctp_lat
+        sdp_bw
+        sdp_lat
+        tcp_bw
+        tcp_lat
+        uc_bi_bw
+        uc_bw
+        uc_lat
+        uc_rdma_write_bw
+        uc_rdma_write_lat
+        uc_rdma_write_poll_lat
+        ud_bi_bw
+        ud_bw
+        ud_lat
+        udp_bw
+        udp_lat
+        ver_rc_compare_swap
+        ver_rc_fetch_add
+        xrc_bi_bw
+        xrc_bw
+        xrc_lat
+Examples
+    In these examples, we first run qperf on a node called myserver in server
+    mode by invoking it with no arguments.  In all the subsequent examples, we
+    run qperf on another node and connect to the server which we assume has a
+    hostname of myserver.
+        * To run a TCP bandwidth and latency test:
+            qperf myserver tcp_bw tcp_lat
+        * To run a SDP bandwidth test for 10 seconds:
+            qperf myserver -t 10 sdp_bw
+        * To run a UDP latency test and then cause the server to terminate:
+            qperf myserver udp_lat quit
+        * To measure the RDMA UD latency and bandwidth:
+            qperf myserver ud_lat ud_bw
+        * To measure RDMA UC bi-directional bandwidth:
+            qperf myserver rc_bi_bw
+        * To get a range of TCP latencies with a message size from 1 to 64K
+            qperf myserver -oo msg_size:1:64K:*2 -vu tcp_lat
+Opts
+    --access_recv OnOff (-ar)           Turn on/off accessing received data
+      -ar1                              Cause received data to be accessed
+    --alt_port Port (-ap)               Set alternate path port
+      --loc_alt_port Port (-lap)        Set local alternate path port
+      --rem_alt_port Port (-rap)        Set remote alternate path port
+    --cpu_affinity PN (-ca)             Set processor affinity
+      --loc_cpu_affinity PN (-lca)      Set local processor affinity
+      --rem_cpu_affinity PN (-rca)      Set remote processor affinity
+    --flip OnOff (-f)                   Flip on/off sender and receiver
+      -f1                               Flip (on) sender and receiver
+    --help Topic (-h)                   Get more information on a topic
+    --host Node (-H)                    Identify server node
+    --id Device:Port (-i)               Set RDMA device and port
+      --loc_id Device:Port (-li)        Set local RDMA device and port
+      --rem_id Device:Port (-ri)        Set remote RDMA device and port
+    --listen_port Port (-lp)            Set server listen port
+    --loop Var:Init:Last:Incr (-oo)     Sequence through values
+    --msg_size Size (-m)                Set message size
+    --mtu_size Size (-mt)               Set MTU size (RDMA only)
+    --no_msgs Count (-n)                Send Count messages
+    --cq_poll OnOff                     Set polling mode on/off
+      --loc_cq_poll OnOff (-lcp)        Set local polling mode on/off
+      --rem_cq_poll OnOff (-rcp)        Set remote polling mode on/off
+      -cp1                              Turn polling mode on
+      -lcp1                             Turn local polling mode on
+      -rcp1                             Turn remote polling mode on
+    --ip_port Port (-ip)                Set TCP port used for tests
+    --precision Digits (-e)             Set precision reported
+    --rd_atomic Max (-nr)               Set RDMA read/atomic count
+        --loc_rd_atomic Max (-lnr)      Set local RDMA read/atomic count
+        --rem_rd_atomic Max (-rnr)      Set remote RDMA read/atomic count
+    --service_level SL (-sl)            Set service level
+      --service_level SL (-lsl)         Set local service level
+      --service_level SL (-rsl)         Set remote service level
+    --sock_buf_size Size (-sb)          Set socket buffer size
+      --loc_sock_buf_size Size (-lsb)   Set local socket buffer size
+      --rem_sock_buf_size Size (-rsb)   Set remote socket buffer size
+    --src_path_bits num (-sp)           Set source path bits
+      --loc_src_path_bits num (-lsp)    Set local source path bits
+      --rem_src_path_bits num (-rsp)    Set remote source path bits
+    --static_rate (-sr)                 Set IB static rate
+      --loc_static_rate (-lsr)          Set local IB static rate
+      --rem_static_rate (-rsr)          Set remote IB static rate
+    --time Time (-t)                    Set test duration
+    --timeout Time (-to)                Set timeout
+      --loc_timeout Time (-lto)         Set local timeout
+      --rem_timeout Time (-rto)         Set remote timeout
+    --unify_nodes (-un)                 Unify nodes
+    --unify_units (-uu)                 Unify units
+    --use_bits_per_sec (-ub)            Use bits/sec rather than bytes/sec
+    --use_cm OnOff (-cm)                Use RDMA Connection Manager or not
+      -cm1                              Use RDMA Connection Manager
+    --verbose (-v)                      Verbose; turn on all of -v[cstu]
+      --verbose_conf (-vc)              Show configuration information
+      --verbose_stat (-vs)              Show statistical information
+      --verbose_time (-vt)              Show timing information
+      --verbose_used (-vu)              Show information on parameters
+      --verbose_more (-vv)              More verbose; turn on all of -v[CSTU]
+      --verbose_more_conf (-vvc)        Show more configuration information
+      --verbose_more_stat (-vvs)        Show more statistical information
+      --verbose_more_time (-vvt)        Show more timing information
+      --verbose_more_used (-vvu)        Show more information on parameters
+    --version (-V)                      Print out version
+    --wait_server Time (-ws)            Set time to wait for server
+Options
+    --access_recv OnOff (-ar)
+          If OnOff is non-zero, data is accessed once received.  Otherwise,
+          data is ignored.  By default, OnOff is 0.  This can help to mimic
+          some applications.
+      -ar1
+          Cause received data to be accessed.
+    --alt_port Port (-ap)
+          Set alternate path port. This enables automatic path failover.
+      --loc_alt_port Port (-lap)
+          Set local alternate path port. This enables automatic path failover.
+      --rem_alt_port Port (-rap)
+          Set remote alternate path port. This enables automatic path failover.
+    --cpu_affinity PN (-ca)
+          Set cpu affinity to PN.  CPUs are numbered sequentially from 0.  If
+          PN is "any", any cpu is allowed otherwise the cpu is limited to the
+          one specified.
+      --loc_cpu_affinity PN (-lca)
+          Set local processor affinity to PN.
+      --rem_cpu_affinity PN (-rca)
+          Set remote processor affinity to PN.
+    --flip OnOff (-f)
+          If non-zero, cause sender and receiver to play opposite roles.
+      -f1
+          Cause sender and receiver to play opposite roles.
+    --help Topic (-h)
+          Print out information about Topic.  To see the list of topics, type
+              qperf --help
+    --host Host (-H)
+          Run test between the current node and the qperf running on node Host.
+          This can also be specified as the first non-option argument.
+    --id Device:Port (-i)
+          Use RDMA Device and Port.
+      --loc_id Device:Port (-li)
+          Use local RDMA Device and Port.
+      --rem_id Device:Port (-ri)
+          Use remote RDMA Device and Port.
+    --listen_port Port (-lp)
+          Set the port we listen on to ListenPort.  This must be set to the
+          same port on both the server and client machines.  The default value
+          is 19765.
+    --loop Var:Init:Last:Incr (-oo)
+        Run a test multiple times sequencing through a series of values.  Var
+        is the loop variable; Init is the initial value; Last is the value it
+        must not exceed and Incr is the increment.  It is useful to set the
+        --verbose_used (-vu) option in conjunction with this option.
+    --msg_size Size (-m)
+          Set the message size to Size.  The default value varies by test.  It
+          is assumed that the value is specified in bytes however, a trailing
+          kib or K, mib or M, or gib or G indicates that the size is being
+          specified in kibibytes, mebibytes or gibibytes respectively while a
+          trailing kb or k, mb or m, or gb or g indicates kilobytes, megabytes
+          or gigabytes respectively.
+    --mtu_size Size (-mt)
+          Set the MTU size.  Only relevant to the RDMA UC/RC tests.  Units are
+          specified in the same manner as the --msg_size option.
+    --no_msgs N (-n)
+        Set test duration by number of messages sent instead of time.
+    --cq_poll OnOff (-cp)
+          Turn polling mode on or off.  This is only relevant to the RDMA tests
+          and determines whether they poll or wait on the completion queues.
+          If OnOff is 0, they wait; otherwise they poll.
+      --loc_cq_poll OnOff (-lcp)
+          Locally turn polling mode on or off.
+      --rem_cq_poll OnOff (-rcp)
+          Remotely turn polling mode on or off.
+      -cp1
+          Turn polling mode on.
+      -lcp1
+          Turn local polling mode on.
+      -rcp1
+          Turn remote polling mode on.
+    --ip_port Port (-ip)
+          Use Port to run the socket tests.  This is different from
+          --listen_port which is used for synchronization.  This is only
+          relevant for the socket tests and refers to the TCP/UDP/SDP/RDS/SCTP
+          port that the test is run on.
+    --precision Digits (-e)
+          Set the number of significant digits that are used to report results.
+    --rd_atomic Max (-nr)
+          Set the number of in-flight operations that can be handled for a RDMA
+          read or atomic operation to Max.  This is only relevant to the RDMA
+          Read and Atomic tests.
+      --loc_rd_atomic Max (-lnr)
+          Set local read/atomic count.
+      --rem_rd_atomic Max (-rnr)
+          Set remote read/atomic count.
+    --service_level SL (-sl)
+          Set RDMA service level to SL.  This is only used by the RDMA tests.
+          The service level must be between 0 and 15.  The default service
+          level is 0.
+      --loc_service_level SL (-lsl)
+          Set local service level.
+      --rem_service_level SL (-rsl)
+          Set remote service level.
+    --sock_buf_size Size (-sb)
+          Set the socket buffer size.  This is only relevant to the socket
+          tests.
+      --loc_sock_buf_size Size (-lsb)
+          Set local socket buffer size.
+      --rem_sock_buf_size Size (-rsb)
+          Set remote socket buffer size.
+    --src_path_bits N (-sp)
+          Set source path bits. If the LMC is not zero, this will cause the
+          connection to use a LID with the low order LMC bits set to N.
+      --loc_src_path_bits N (-lsp)
+          Set local source path bits.
+      --rem_src_path_bits N (-rsp)
+          Set remote source path bits.
+    --static_rate Rate (-sr)
+          Force InfiniBand static rate.  Rate can be one of: 2.5, 5, 10, 20,
+          30, 40, 60, 80, 120, 1xSDR (2.5 Gbps), 1xDDR (5 Gbps), 1xQDR (10
+          Gbps), 4xSDR (2.5 Gbps), 4xDDR (5 Gbps), 4xQDR (10 Gbps), 8xSDR (2.5
+          Gbps), 8xDDR (5 Gbps), 8xQDR (10 Gbps).
+      --loc_static_rate (-lsr)
+          Force local InfiniBand static rate
+      --rem_static_rate (-rsr)
+          Force remote InfiniBand static rate
+    --time Time (-t)
+          Set test duration to Time.  Specified in seconds however a trailing
+          m, h or d indicates that the time is specified in minutes, hours or
+          days respectively.
+    --timeout Time (-to)
+          Set timeout to Time.  This is the timeout used for various things
+          such as exchanging messages.  The default is 5 seconds.
+      --loc_timeout Time (-lto)
+          Set local timeout to Time.  This may be used on the server to set
+          the timeout when initially exchanging data with each client.
+          However, as soon as we receive the client's parameters, the client's
+          remote timeout will override this parameter.
+      --rem_timeout Time (-rto)
+          Set remote timeout to Time.
+    --unify_nodes (-un)
+          Unify the nodes.  Describe them in terms of local and remote rather
+          than send and receive.
+    --unify_units (-uu)
+          Unify the units that results are shown in.  Uses the lowest common
+          denominator.  Helpful for scripts.
+    --use_bits_per_sec (-ub)
+          Use bits/sec rather than bytes/sec when displaying networking speed.
+    --use_cm OnOff (-cm)
+          Use the RDMA Connection Manager (CM) if OnOff is non-zero.  It is
+          necessary to use the CM for iWARP devices.  The default is to
+          establish the connection without using the CM.  This only works for
+          the tests that use the RC transport.
+      -cm1
+          Use RDMA Connection Manager.
+    --verbose (-v)
+          Provide more detailed output.  Turns on -vc, -vs, -vt and -vu.
+      --verbose_conf (-vc)
+          Provide information on configuration.
+      --verbose_stat (-vs)
+          Provide information on statistics.
+      --verbose_time (-vt)
+          Provide information on timing.
+      --verbose_used (-vu)
+          Provide information on parameters used.
+      --verbose_more (-vv)
+          Provide even more detailed output.  Turns on -vvc, -vvs, -vvt and
+          -vvu.
+      --verbose_more_conf (-vvc)
+          Provide more information on configuration.
+      --verbose_more_stat (-vvs)
+          Provide more information on statistics.
+      --verbose_more_time (-vvt)
+          Provide more information on timing.
+      --verbose_more_used (-vvu)
+          Provide more information on parameters used.
+    --version (-V)
+          The current version of qperf is printed.
+    --wait_server Time (-ws)
+          If the server is not ready, continue to try connecting for Time
+          seconds before giving up.  The default is 5 seconds.
+Tests -RDMA
+    Miscellaneous
+        conf                    Show configuration
+        quit                    Cause the server to quit
+    Socket Based
+        rds_bw                  RDS streaming one way bandwidth
+        rds_lat                 RDS one way latency
+        sctp_bw                 SCTP streaming one way bandwidth
+        sctp_lat                SCTP one way latency
+        sdp_bw                  SDP streaming one way bandwidth
+        sdp_lat                 SDP one way latency
+        tcp_bw                  TCP streaming one way bandwidth
+        tcp_lat                 TCP one way latency
+        udp_bw                  UDP streaming one way bandwidth
+        udp_lat                 UDP one way latency
+Tests +RDMA
+    Miscellaneous
+        conf                    Show configuration
+        quit                    Cause the server to quit
+    Socket Based
+        rds_bw                  RDS streaming one way bandwidth
+        rds_lat                 RDS one way latency
+        sctp_bw                 SCTP streaming one way bandwidth
+        sctp_lat                SCTP one way latency
+        sdp_bw                  SDP streaming one way bandwidth
+        sdp_lat                 SDP one way latency
+        tcp_bw                  TCP streaming one way bandwidth
+        tcp_lat                 TCP one way latency
+        udp_bw                  UDP streaming one way bandwidth
+        udp_lat                 UDP one way latency
+    RDMA Send/Receive
+        rc_bi_bw                RC streaming two way bandwidth
+        rc_bw                   RC streaming one way bandwidth
+        rc_lat                  RC one way latency
+        uc_bi_bw                UC streaming two way bandwidth
+        uc_bw                   UC streaming one way bandwidth
+        uc_lat                  UC one way latency
+        ud_bi_bw                UD streaming two way bandwidth
+        ud_bw                   UD streaming one way bandwidth
+        ud_lat                  UD one way latency
+        xrc_bi_bw               XRC streaming two way bandwidth
+        xrc_bw                  XRC streaming one way bandwidth
+        xrc_lat                 XRC one way latency
+    RDMA
+        rc_rdma_read_bw         RC RDMA read streaming one way bandwidth
+        rc_rdma_read_lat        RC RDMA read one way latency
+        rc_rdma_write_bw        RC RDMA write streaming one way bandwidth
+        rc_rdma_write_lat       RC RDMA write one way latency
+        rc_rdma_write_poll_lat  RC RDMA write one way polling latency
+        uc_rdma_write_bw        UC RDMA write streaming one way bandwidth
+        uc_rdma_write_lat       UC RDMA write one way latency
+        uc_rdma_write_poll_lat  UC RDMA write one way polling latency
+    InfiniBand Atomics
+        rc_compare_swap_mr      RC compare and swap messaging rate
+        rc_fetch_add_mr         RC fetch and add messaging rate
+    Verification
+        ver_rc_compare_swap     Verify RC compare and swap
+        ver_rc_fetch_add        Verify RC fetch and add
+conf
+    Purpose
+        Show configuration
+    Common Options
+        None
+    Description
+        Shows the node name, CPUs and OS of both nodes being used.
+quit
+    Purpose
+        Quit
+    Common Options
+        None
+    Description
+        Causes the server to quit.
+rds_bw
+    Purpose
+        RDS streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client repeatedly sends messages to the server while the server
+        notes how many were received.
+rds_lat
+    Purpose
+        RDS one way latency
+    Common Options
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using RDS sockets.
+sctp_bw
+    Purpose
+        SCTP streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client repeatedly sends messages to the server while the server
+        notes how many were received.
+sctp_lat
+    Purpose
+        SCTP one way latency
+    Common Options
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using STCP sockets.
+sdp_bw
+    Purpose
+        SDP streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client repeatedly sends messages to the server while the server
+        notes how many were received.
+sdp_lat
+    Purpose
+        SDP one way latency
+    Common Options
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using SDP sockets.
+tcp_bw
+    Purpose
+        TCP streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client repeatedly sends messages to the server while the server
+        notes how many were received.
+tcp_lat
+    Purpose
+        TCP one way latency
+    Common Options
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using TCP sockets.
+udp_bw
+    Purpose
+        UDP streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client repeatedly sends messages to the server while the server
+        notes how many were received.
+udp_lat
+    Purpose
+        UDP one way latency
+    Common Options
+        --cpu_affinity PN (-ca)     Set processor affinity
+        --msg_size Size (-m)        Set message size
+        --sock_buf_size Size (-sb)  Set socket buffer size
+        --time (-t)                 Set test duration
+    Other Options
+        --listen_port, --ip_port, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using UDP sockets.
+ud_bw +RDMA
+    Purpose
+        UD streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client sends messages to the server who notes how many it received.
+        The UD Send/Receive mechanism is used.
+ud_bi_bw +RDMA
+    Purpose
+        UD streaming two way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        Both the client and server exchange messages with each other using the
+        UD Send/Receive mechanism and note how many were received.
+ud_lat +RDMA
+    Purpose
+        UD one way latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using UD Send/Receive.
+rc_bw +RDMA
+    Purpose
+        RC streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client sends messages to the server who notes how many it received.
+        The RC Send/Receive mechanism is used.
+rc_bi_bw +RDMA
+    Purpose
+        RC streaming two way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        Both the client and server exchange messages with each other using the
+        RC Send/Receive mechanism and note how many were received.
+rc_lat +RDMA
+    Purpose
+        RC one way latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using RC Send/Receive.
+uc_bw +RDMA
+    Purpose
+        UC streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client sends messages to the server who notes how many it received.
+        The UC Send/Receive mechanism is used.
+uc_bi_bw +RDMA
+    Purpose
+        UC streaming two way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        Both the client and server exchange messages with each other using the
+        UC Send/Receive mechanism and note how many were received.
+uc_lat +RDMA
+    Purpose
+        UC one way latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using UC Send/Receive.
+rc_rdma_read_bw +RDMA
+    Purpose
+        RC RDMA read streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --rd_atomic, --static_rate,
+        --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client repeatedly performs RC RDMA Read operations and notes how
+        many of them complete.
+rc_rdma_read_lat +RDMA
+    Purpose
+        RC RDMA read one way latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        The client repeatedly performs RC RDMA Read operations waiting for
+        completion before starting the next one.
+rc_rdma_write_bw +RDMA
+    Purpose
+        RC RDMA write streaming one way bandwidth
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client repeatedly performs RC RDMA Write operations and notes how
+        many of them complete.
+rc_rdma_write_lat +RDMA
+    Purpose
+        RC RDMA write one way latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        using RC RDMA write operations.
+rc_rdma_write_poll_lat +RDMA
+    Purpose
+        RC RDMA write one way polling latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test using RC RDMA Write operations.  First the
+        client performs an RDMA Write while the server stays in a tight loop
+        waiting for the memory buffer to change.  The first and last bytes of
+        the memory buffer are tested to ensure that the entire message was
+        received.  This is then repeated with both sides playing opposite
+        roles.  Since this does not use completion queues, the --cq_poll flag
+        has no effect.
+uc_rdma_write_bw +RDMA
+    Purpose
+        UC RDMA write streaming one way bandwidth
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client repeatedly performs UC RDMA Write operations and notes how
+        many of them complete.
+uc_rdma_write_lat +RDMA
+    Purpose
+        UC RDMA write one way latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        using UC RDMA write operations.
+uc_rdma_write_poll_lat +RDMA
+    Purpose
+        UC RDMA write one way polling latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test using UC RDMA Write operations.  First the
+        client performs an RDMA Write while the server stays in a tight loop
+        waiting for the memory buffer to change.  The first and last bytes of
+        the memory buffer are tested to ensure that the entire message was
+        received.  This is then repeated with both sides playing opposite
+        roles.  Since this does not use completion queues, the --cq_poll flag
+        has no effect.
+rc_compare_swap_mr +RDMA
+    Purpose
+        RC compare and swap messaging rate
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --rd_atomic, --static_rate,
+        --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        The client repeatedly performs the RC Atomic Compare and Swap operation
+        and determines how many of them complete.
+rc_fetch_add_mr +RDMA
+    Purpose
+        RC fetch and add messaging rate
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --rd_atomic, --static_rate,
+        --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        The client repeatedly performs the RC Atomic Fetch and Add operation
+        and determines how many of them complete.
+ver_rc_compare_swap +RDMA
+    Purpose
+        Verify RC compare and swap
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --msg_size, --mtu_size, --rd_atomic,
+        --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        Test the RC Compare and Swap Atomic operation.  The server's memory
+        location starts with zero and the client successively makes exchanges
+        with a variety of different values.  The results are checked for
+        correctness.
+ver_rc_fetch_add +RDMA
+    Purpose
+        Verify RC fetch and add
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --msg_size, --mtu_size, --rd_atomic,
+        --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        Tests the RC Fetch and Add Atomic operation.  The server's memory
+        location starts with zero and the client successively adds one.  The
+        results are checked for correctness.
+xrc_bw +RDMA
+    Purpose
+        XRC streaming one way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        The client sends messages to the server who notes how many it received.
+        The XRC Send/Receive mechanism is used.
+xrc_bi_bw +RDMA
+    Purpose
+        XRC streaming two way bandwidth
+    Common Options
+        --access_recv OnOff (-ar)   Access received data
+        --id Device:Port (-i)       Set RDMA device and port
+        --msg_size Size (-m)        Set message size
+        --cq_poll OnOff             Set polling mode on/off
+        --time (-t)                 Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --use_bits_per_sec,
+        --verbose
+    Description
+        Both the client and server exchange messages with each other using the
+        XRC Send/Receive mechanism and note how many were received.
+xrc_lat +RDMA
+    Purpose
+        XRC one way latency
+    Common Options
+        --id Device:Port (-i)   Set RDMA device and port
+        --msg_size Size (-m)    Set message size
+        --cq_poll OnOff         Set polling mode on/off
+        --time (-t)             Set test duration
+    Other Options
+        --cpu_affinity, --listen_port, --mtu_size, --static_rate, --timeout
+    Display Options
+        --precision, --unify_nodes, --unify_units, --verbose
+    Description
+        A ping pong latency test where the server and client exchange messages
+        repeatedly using XRC Send/Receive.
diff --git a/src/mkhelp b/src/mkhelp
new file mode 100755
index 0000000..5161cf1
--- /dev/null
+++ b/src/mkhelp
@@ -0,0 +1,113 @@
+#!/usr/bin/env perl
+#
+use strict;
+use warnings;
+use diagnostics;
+
+my $help_txt = "help.txt";
+my $help_c   = "help.c";
+my $top = "
+/*
+ * This was generated from $help_txt.  Do not modify directly.
+ *
+ * Copyright (c) 2002-2009 Johann George.  All rights reserved.
+ * Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+char *Usage[] ={
+";
+my $end = "
+    0,
+};
+";
+
+sub panic {
+    print STDERR @_, "\n";
+    exit 1;
+}
+
+sub main() {
+    my %defs;
+        $defs{$_} = 1 for (@ARGV);
+    my $iFile;
+    open($iFile, "<", $help_txt) or
+        panic("cannot find $help_txt");
+    my $str = "";
+    my $keep = 1;
+    while (<$iFile>) {
+        chomp;
+        s/\s+$//;
+        if (/^    / or /^$/) {
+            if ($keep) {
+                s///;
+                s/(["\\])/\\$1/g;
+                s/$/\\n/;
+                if (/^(.{68}(?>[^\\]?))(..*)/) {
+                    $str .= " "x8  . "\"$1\"\n";
+                    $str .= " "x12 . "\"$2\"\n";
+                } else {
+                    $str .= " "x8 . "\"$_\"\n";
+                }
+            }
+        } else {
+            my @args = split;
+            my $arg0 = lc(shift @args);
+            $keep = 1;
+            for (@args) {
+                if (/^\+(.*)/) {
+                    $keep = 0 unless ($defs{$1});
+                } elsif (/^-(.*)/) {
+                    $keep = 0 if ($defs{$1});
+                }
+            }
+            if ($keep) {
+                if ($str) {
+                    chop $str;
+                    $str .= ",\n";
+                }
+                $str .= " "x4 . "\"$arg0\",\n";
+            }
+        }
+    }
+    close $iFile;
+    if ($str) {
+        chop $str;
+        $str .= ",\n";
+    }
+    $top =~ s/^\n//;
+    $end =~ s/^\n//;
+    my $oFile;
+    open($oFile, ">", $help_c) or
+        panic("cannot create $help_c");
+    print $oFile $top, $str, $end;
+    close $oFile;
+}
+
+main();
diff --git a/src/mkman b/src/mkman
new file mode 100755
index 0000000..64dea86
--- /dev/null
+++ b/src/mkman
@@ -0,0 +1,198 @@
+#!/usr/bin/env perl
+# Make qperf man page.
+#
+use strict;
+use warnings;
+use diagnostics;
+use POSIX;
+
+
+my $help_txt  = "help.txt";
+
+
+# Print out an error message and exit.
+#
+sub panic {
+    print STDERR @_, "\n";
+    exit 1;
+}
+
+
+# Print arguments to stdout.
+#
+sub printx {
+    print STDOUT "@_";
+}
+
+
+# Print arguments along with a newline to stdout.
+#
+sub printn {
+    print STDOUT "@_\n";
+}
+
+
+# Print a sub-heading as required in upper-case.
+#
+sub printh ($) {
+    my $name = shift;
+    printn ".SH ", uc $name;
+}
+
+
+# Undent some text by four columns.
+#
+sub undent {
+    my $str = shift;
+    $str =~ s/^    //gm;
+    return $str;
+}
+
+
+# Generate the list of tests from the help.txt file.
+#
+sub do_tests ($$) {
+    my $dict = shift;
+    my $name = shift;
+    my $text = $dict->{"Tests +RDMA"};
+    printh $name;
+    $text =~ s/^\s*//;
+    my @lines = split(/\n/, $text);
+    for (@lines) {
+        next unless /^ {8}(\w+)\s+(.*)/;
+        printn '.TP';
+        printn "\\fB$1\\fP";
+        printn $2;
+    }
+}
+
+
+# Generate the list of options from the help.txt file.
+#
+sub do_options ($$) {
+    my $dict = shift;
+    my $name = shift;
+    my $text = $dict->{$name};
+    printh $name;
+    $text =~ s/^\s*//;
+    my @options = split(/^\s{4,6}(?=-)/m, $text);
+    for my $option (@options) {
+        $option =~ s/(.*)\n\s*//;
+        my $head = $1;
+        my $line = "";
+        ($head =~ s/(.*)\s+\((-\w+)\)/$1/) and
+            $line = "\\fB$2\\fP, ";
+        $head =~ /(\S+)\s*(.*)/;
+        $line .= "\\fB$1\\fP";
+        $line .= " \\fI$2\\fP" if $2;
+        printn '.TP';
+        printn $line;
+        $option =~ s/^\s+//mg;
+        $option =~ s/\s+$//;
+        printn $option;
+    }
+}
+
+
+# Generate the list of examples from the help.txt file.
+#
+sub do_examples ($$) {
+    my $dict = shift;
+    my $name = shift;
+    my $text = $dict->{$name};
+    printh $name;
+    my @lines = split(/^ {8}\* /m, $text);
+    printx undent(shift @lines);
+    for (@lines) {
+        s/(.*)\n//;
+        printn '.TP';
+        printn $1;
+        s/^\s+//m;
+        print $_;
+    }
+}
+
+
+# Generate the synopsis from the help.txt file.
+#
+sub do_synopsis ($$) {
+    my $dict = shift;
+    my $name = shift;
+    my $text = $dict->{$name};
+    printh $name;
+    $text =~ s/([A-Z]+)/\\fI$1\\fP/g;
+    $text =~ s/(qperf)/\\fB$1\\fP/g;
+    $text =~ s/\n/\n.br\n/g;
+    printx undent $text;
+}
+
+
+# Put out a sub-section that is gotten from a subsection within the Main
+# section of the help.txt file.
+#
+sub do_general ($$) {
+    my $dict = shift;
+    my $name = shift;
+    printh $name;
+    printx undent $dict->{$name};
+}
+
+
+# Return the month and year that the help.txt file was last modified.
+#
+sub help_date() {
+    my @info = stat $help_txt or
+        panic("Cannot find $help_txt");
+    return POSIX::strftime "%B %Y", localtime($info[9]);
+}
+
+
+# Make a dictionary from text with the keys generated from text that is flush
+# agains the left column and its associated data being the text that is
+# subsequently indented.
+#
+sub make_dict ($) {
+    my %dict;
+    my $data = shift;
+    my @entrys = split(/^(?=\S)/m, $data);
+    (s/^(.*)\n//) and
+        $dict{$1} = $_
+            for (@entrys);
+    return \%dict;
+}
+
+
+# Return the contents of the help.txt file.
+#
+sub read_file ($) {
+    my $name = shift;
+    my $file;
+    local $/;
+    open($file, "<", $name) or
+        panic("Cannot find $name");
+    my $data = <$file>;
+    close $file;
+    return $data;
+}
+
+
+sub main() {
+    my $data = read_file $help_txt;
+    my $help = make_dict $data;
+    my $main = make_dict undent $help->{Main};
+
+    printn '.\" Generated by mkman';
+    printn '.TH QPERF 1 "' . help_date . '" "qperf" "User Commands"';
+    printn '.SH NAME';
+    printn 'qperf \- Measure RDMA and IP performance';
+
+    do_synopsis ($main, 'Synopsis');
+    do_general  ($main, 'Description');
+    do_examples ($help, 'Examples');
+    do_options  ($help, 'Options');
+    do_tests    ($help, 'Tests');
+    do_general  ($help, 'Author');
+    do_general  ($help, 'Bugs');
+}
+
+main();
diff --git a/src/qperf.c b/src/qperf.c
new file mode 100644
index 0000000..2a5fa65
--- /dev/null
+++ b/src/qperf.c
@@ -0,0 +1,2866 @@
+/*
+ * qperf - main.
+ * Measure socket and RDMA performance.
+ *
+ * Copyright (c) 2002-2009 Johann George.  All rights reserved.
+ * Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#define _GNU_SOURCE
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <sched.h>
+#include <stdio.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <sys/times.h>
+#include <sys/select.h>
+#include <sys/utsname.h>
+#include "qperf.h"
+
+
+/*
+ * Configurable parameters.  If your change makes this version of qperf
+ * incompatible with previous versions (usually a change to the Req structure),
+ * increment VER_MIN and set VER_INC to 0.  Otherwise, just increment VER_INC.
+ * VER_MAJ is reserved for major changes.
+ */
+#define VER_MAJ 0                       /* Major version */
+#define VER_MIN 4                       /* Minor version */
+#define VER_INC 9                       /* Incremental version */
+#define LISTENQ 5                       /* Size of listen queue */
+#define BUFSIZE 1024                    /* Size of buffers */
+
+
+/*
+ * Default parameter values.
+ */
+#define DEF_TIME        2               /* Test duration */
+#define DEF_TIMEOUT     5               /* Timeout */
+#define DEF_PRECISION   3               /* Precision displayed */
+#define DEF_LISTEN_PORT 19765           /* Listen port */
+
+
+/*
+ * Option list.
+ */
+typedef struct OPTION {
+    char       *name;                   /* Name of option */
+    char       *type;                   /* Type */
+    int         arg1;                   /* First argument */
+    int         arg2;                   /* Second argument */
+} OPTION;
+
+
+/*
+ * Used to loop through a range of values.
+ */
+typedef struct LOOP {
+    struct LOOP  *next;                 /* Pointer to next loop */
+    OPTION       *option;               /* Loop variable */
+    long          init;                 /* Initial value */
+    long          last;                 /* Last value */
+    long          incr;                 /* Increment */
+    int           mult;                 /* If set, multiply, otherwise add */
+} LOOP;
+
+
+/*
+ * Parameter information.
+ */
+typedef struct PAR_INFO {
+    PAR_INDEX   index;                  /* Index into parameter table */
+    int         type;                   /* Type */
+    void       *ptr;                    /* Pointer to value */
+    char       *name;                   /* Option name */
+    int         set;                    /* Parameter has been set */
+    int         used;                   /* Parameter has been used */
+    int         inuse;                  /* Parameter is in use */
+} PAR_INFO;
+
+
+/*
+ * Parameter name association.
+ */
+typedef struct PAR_NAME {
+    char       *name;                   /* Name */
+    PAR_INDEX   loc_i;                  /* Local index */
+    PAR_INDEX   rem_i;                  /* Remote index */
+} PAR_NAME;
+
+
+/*
+ * A simple mapping between two strings.
+ */
+typedef struct DICT {
+    char       *str1;                   /* String 1 */
+    char       *str2;                   /* String 2 */
+} DICT;
+
+
+/*
+ * Test prototype.
+ */
+typedef struct TEST {
+    char       *name;                   /* Test name */
+    void      (*client)(void);          /* Client function */
+    void      (*server)(void);          /* Server function */
+} TEST;
+
+
+/*
+ * Used to save output data for formatting.
+ */
+typedef struct SHOW {
+    char    *pref;                      /* Name prefix */
+    char    *name;                      /* Name */
+    char    *data;                      /* Data */
+    char    *unit;                      /* Unit */
+    char    *altn;                      /* Alternative value */
+} SHOW;
+
+
+/*
+ * Configuration information.
+ */
+typedef struct CONF {
+    char        node[STRSIZE];          /* Node */
+    char        cpu[STRSIZE];           /* CPU */
+    char        os[STRSIZE];            /* Operating System */
+    char        qperf[STRSIZE];         /* Qperf version */
+} CONF;
+
+
+/*
+ * Function prototypes.
+ */
+static void      add_ustat(USTAT *l, USTAT *r);
+static long      arg_long(char ***argvp);
+static long      arg_size(char ***argvp);
+static char     *arg_strn(char ***argvp);
+static long      arg_time(char ***argvp);
+static void      calc_node(RESN *resn, STAT *stat);
+static void      calc_results(void);
+static void      client(TEST *test);
+static int       cmpsub(char *s2, char *s1);
+static char     *commify(char *data);
+static void      dec_req_data(REQ *host);
+static void      dec_req_version(REQ *host);
+static void      dec_stat(STAT *host);
+static void      dec_ustat(USTAT *host);
+static void      do_args(char *args[]);
+static void      do_loop(LOOP *loop, TEST *test);
+static void      do_option(OPTION *option, char ***argvp);
+static void      enc_req(REQ *host);
+static void      enc_stat(STAT *host);
+static void      enc_ustat(USTAT *host);
+static TEST     *find_test(char *name);
+static OPTION   *find_option(char *name);
+static void      get_conf(CONF *conf);
+static void      get_cpu(CONF *conf);
+static void      get_times(CLOCK timex[T_N]);
+static void      initialize(void);
+static void      init_lstat(void);
+static char     *loop_arg(char **pp);
+static int       nice_1024(char *pref, char *name, long long value);
+static PAR_INFO *par_info(PAR_INDEX index);
+static PAR_INFO *par_set(char *name, PAR_INDEX index);
+static int       par_isset(PAR_INDEX index);
+static void      parse_loop(char ***argvp);
+static void      place_any(char *pref, char *name, char *unit, char *data,
+                           char *altn);
+static void      place_show(void);
+static void      place_val(char *pref, char *name, char *unit, double value);
+static void      remotefd_close(void);
+static void      remotefd_setup(void);
+static void      run_client_conf(void);
+static void      run_client_quit(void);
+static void      run_server_conf(void);
+static void      run_server_quit(void);
+static void      server(void);
+static void      server_listen(void);
+static int       server_recv_request(void);
+static void      set_affinity(void);
+static void      set_signals(void);
+static void      show_debug(void);
+static void      show_info(MEASURE measure);
+static void      show_rest(void);
+static void      show_used(void);
+static void      sig_alrm(int signo, siginfo_t *siginfo, void *ucontext);
+static void      sig_quit(int signo, siginfo_t *siginfo, void *ucontext);
+static void      sig_urg(int signo, siginfo_t *siginfo, void *ucontext);
+static char     *skip_colon(char *s);
+static void      start_test_timer(int seconds);
+static long      str_size(char *arg, char *str);
+static void      strncopy(char *d, char *s, int n);
+static char     *two_args(char ***argvp);
+static int       verbose(int type, double value);
+static void      version_error(void);
+static void      view_band(int type, char *pref, char *name, double value);
+static void      view_cost(int type, char *pref, char *name, double value);
+static void      view_cpus(int type, char *pref, char *name, double value);
+static void      view_rate(int type, char *pref, char *name, double value);
+static void      view_long(int type, char *pref, char *name, long long value);
+static void      view_size(int type, char *pref, char *name, long long value);
+static void      view_strn(int type, char *pref, char *name, char *value);
+static void      view_time(int type, char *pref, char *name, double value);
+
+
+/*
+ * Configurable variables.
+ */
+static int  ListenPort      = DEF_LISTEN_PORT;
+static int  Precision       = DEF_PRECISION;
+static int  ServerWait      = DEF_TIMEOUT;
+static int  UseBitsPerSec   = 0;
+
+
+/*
+ * Static variables.
+ */
+static REQ      RReq;
+static STAT     IStat;
+static int      ListenFD;
+static LOOP    *Loops;
+static int      ProcStatFD;
+static STAT     RStat;
+static int      ShowIndex;
+static SHOW     ShowTable[256];
+static int      UnifyUnits;
+static int      UnifyNodes;
+static int      VerboseConf;
+static int      VerboseStat;
+static int      VerboseTime;
+static int      VerboseUsed;
+
+
+/*
+ * Global variables.
+ */
+RES          Res;
+REQ          Req;
+STAT         LStat;
+char        *TestName;
+char        *ServerName;
+SS           ServerAddr;
+int          ServerAddrLen;
+int          RemoteFD;
+int          Debug;
+volatile int Finished;
+
+
+/*
+ * Parameter names.  This is used to print out the names of the parameters that
+ * have been set.
+ */
+PAR_NAME ParName[] ={
+    { "access_recv",    L_ACCESS_RECV,    R_ACCESS_RECV   },
+    { "affinity",       L_AFFINITY,       R_AFFINITY      },
+    { "alt_port",       L_ALT_PORT,       R_ALT_PORT      },
+    { "flip",           L_FLIP,           R_FLIP          },
+    { "id",             L_ID,             R_ID            },
+    { "msg_size",       L_MSG_SIZE,       R_MSG_SIZE      },
+    { "mtu_size",       L_MTU_SIZE,       R_MTU_SIZE      },
+    { "no_msgs",        L_NO_MSGS,        R_NO_MSGS       },
+    { "poll_mode",      L_POLL_MODE,      R_POLL_MODE     },
+    { "port",           L_PORT,           R_PORT          },
+    { "rd_atomic",      L_RD_ATOMIC,      R_RD_ATOMIC     },
+    { "service_level",  L_SL,             R_SL            },
+    { "sock_buf_size",  L_SOCK_BUF_SIZE,  R_SOCK_BUF_SIZE },
+    { "src_path_bits",  L_SRC_PATH_BITS,  R_SRC_PATH_BITS },
+    { "time",           L_TIME,           R_TIME          },
+    { "timeout",        L_TIMEOUT,        R_TIMEOUT       },
+    { "use_cm",         L_USE_CM,         R_USE_CM        },
+};
+
+
+/*
+ * Parameters.  These must be listed in the same order as the indices are
+ * defined.
+ */
+PAR_INFO ParInfo[P_N] ={
+    { P_NULL,                                       },
+    { L_ACCESS_RECV,    'l',  &Req.access_recv      },
+    { R_ACCESS_RECV,    'l',  &RReq.access_recv     },
+    { L_AFFINITY,       'l',  &Req.affinity         },
+    { R_AFFINITY,       'l',  &RReq.affinity        },
+    { L_ALT_PORT,       'l',  &Req.alt_port         },
+    { R_ALT_PORT,       'l',  &RReq.alt_port        },
+    { L_FLIP,           'l',  &Req.flip             },
+    { R_FLIP,           'l',  &RReq.flip            },
+    { L_ID,             'p',  &Req.id               },
+    { R_ID,             'p',  &RReq.id              },
+    { L_MSG_SIZE,       's',  &Req.msg_size         },
+    { R_MSG_SIZE,       's',  &RReq.msg_size        },
+    { L_MTU_SIZE,       's',  &Req.mtu_size         },
+    { R_MTU_SIZE,       's',  &RReq.mtu_size        },
+    { L_NO_MSGS,        'l',  &Req.no_msgs          },
+    { R_NO_MSGS,        'l',  &RReq.no_msgs         },
+    { L_POLL_MODE,      'l',  &Req.poll_mode        },
+    { R_POLL_MODE,      'l',  &RReq.poll_mode       },
+    { L_PORT,           'l',  &Req.port             },
+    { R_PORT,           'l',  &RReq.port            },
+    { L_RD_ATOMIC,      'l',  &Req.rd_atomic        },
+    { R_RD_ATOMIC,      'l',  &RReq.rd_atomic       },
+    { L_SL,             'l',  &Req.sl               },
+    { R_SL,             'l',  &RReq.sl              },
+    { L_SOCK_BUF_SIZE,  's',  &Req.sock_buf_size    },
+    { R_SOCK_BUF_SIZE,  's',  &RReq.sock_buf_size   },
+    { L_SRC_PATH_BITS,  's',  &Req.src_path_bits    },
+    { R_SRC_PATH_BITS,  's',  &RReq.src_path_bits   },
+    { L_STATIC_RATE,    'p',  &Req.static_rate      },
+    { R_STATIC_RATE,    'p',  &RReq.static_rate     },
+    { L_TIME,           't',  &Req.time             },
+    { R_TIME,           't',  &RReq.time            },
+    { L_TIMEOUT,        't',  &Req.timeout          },
+    { R_TIMEOUT,        't',  &RReq.timeout         },
+    { L_USE_CM,         'l',  &Req.use_cm           },
+    { R_USE_CM,         'l',  &RReq.use_cm          },
+};
+
+
+/*
+ * Renamed options.  First is old, second is new.
+ */
+DICT Renamed[] = {
+    /* -a becomes -ca (--cpu_affinity) */
+    { "--affinity",         "--cpu_affinity"        },
+    {   "-a",               "-ca"                   },
+    {  "--loc_affinity",    "--loc_cpu_affinity"    },
+    {   "-la",              "-lca"                  },
+    {  "--rem_affinity",    "--rem_cpu_affinity"    },
+    {   "-ra",              "-rca"                  },
+    /* -r becomes -sr (--static_rate) */
+    { "--rate",             "--static_rate"         },
+    {   "-r",               "-sr"                   },
+    {  "--loc_rate",        "--loc_static_rate"     },
+    {   "-lr",              "-lsr"                  },
+    {  "--rem_rate",        "--rem_static_rate"     },
+    {   "-rr",              "-rsr"                  },
+    /* -p becomes -ip (--ip_port) */
+    { "--port",             "--ip_port"             },
+    {   "-p",               "-ip"                   },
+    /* -P becomes -cp (--cq_poll) */
+    { "--poll",             "--cq_poll"             },
+    {   "-P",               "-cp"                   },
+    {  "--loc_poll",        "--loc_cq_poll"         },
+    {   "-lP",              "-lcp"                  },
+    {  "--rem_poll",        "--rem_cq_poll"         },
+    {   "-rP",              "-rcp"                  },
+    /* -R becomes -nr (--rd_atomic) */
+    {   "-R",               "-nr"                   },
+    {   "-lR",              "-lnr"                  },
+    {   "-rR",              "-rnr"                  },
+    /* -T becomes -to (--timeout) */
+    {   "-T",               "-to"                   },
+    {   "-lT",              "-lto"                  },
+    {   "-rT",              "-rto"                  },
+    /* -S becomes -sb (--sock_buf_size) */
+    {   "-S",               "-sb"                   },
+    {   "-lS",              "-lsb"                  },
+    {   "-rS",              "-rsb"                  },
+    /* -W becomes -ws (--wait_server) */
+    { "--wait",             "--wait_server"         },
+    {   "-W",               "-ws"                   },
+    /* verbose options */
+    {   "-vC",              "-vvc",                 },
+    {   "-vS",              "-vvs",                 },
+    {   "-vT",              "-vvt",                 },
+    {   "-vU",              "-vvu",                 },
+    /* options that are on */
+    {   "-aro",             "-ar1"                  },
+    {   "-cmo",             "-cm1"                  },
+    {   "-fo",              "-f1"                   },
+    {   "-cpo",             "-cp1"                  },
+    {   "-lcpo",            "-lcp1"                 },
+    {   "-rcpo",            "-rcp1"                 },
+    /* miscellaneous */
+    {   "-Ar",              "-ar"                   },
+    {   "-M",               "-mt"                   },
+    {   "-u",               "-uu",                  },
+};
+
+
+/*
+ * Options.  The type field (2nd column) is used by do_option.  If it begins
+ * with a S, it is a valid server option.  If it begins with a X, it is
+ * obsolete and will eventually go away.
+ */
+OPTION Options[] ={
+    { "--access_recv",        "int",   L_ACCESS_RECV,   R_ACCESS_RECV   },
+    {   "-ar",                "int",   L_ACCESS_RECV,   R_ACCESS_RECV   },
+    {   "-ar1",               "set1",  L_ACCESS_RECV,   R_ACCESS_RECV   },
+    { "--alt_port",           "int",   L_ALT_PORT,      R_ALT_PORT      },
+    {   "-ap",                "int",   L_ALT_PORT,      R_ALT_PORT      },
+    {  "--loc_alt_port",      "int",   L_ALT_PORT,                      },
+    {   "-lap",               "int",   L_ALT_PORT,                      },
+    {  "--rem_alt_port",      "int",   R_ALT_PORT                       },
+    {   "-rap",               "int",   R_ALT_PORT                       },
+    { "--cpu_affinity",       "int",   L_AFFINITY,      R_AFFINITY      },
+    {   "-ca",                "int",   L_AFFINITY,      R_AFFINITY      },
+    {  "--loc_cpu_affinity",  "int",   L_AFFINITY,                      },
+    {   "-lca",               "int",   L_AFFINITY,                      },
+    {  "--rem_cpu_affinity",  "int",   R_AFFINITY                       },
+    {   "-rca",               "int",   R_AFFINITY                       },
+    { "--debug",              "Sdebug",                                 },
+    {   "-D",                 "Sdebug",                                 },
+    { "--flip",               "int",   L_FLIP,          R_FLIP          },
+    {   "-f",                 "int",   L_FLIP,          R_FLIP          },
+    {   "-f1",                "set1",  L_FLIP,          R_FLIP          },
+    { "--help",               "help"                                    }, 
+    {   "-h",                 "help"                                    }, 
+    { "--host",               "host",                                   },
+    {   "-H",                 "host",                                   },
+    { "--id",                 "str",   L_ID,            R_ID            },
+    {   "-i",                 "str",   L_ID,            R_ID            },
+    {  "--loc_id",            "str",   L_ID,                            },
+    {   "-li",                "str",   L_ID,                            },
+    {  "--rem_id",            "str",   R_ID                             },
+    {   "-ri",                "str",   R_ID                             },
+    { "--listen_port",        "Slp",                                    },
+    {   "-lp",                "Slp",                                    },
+    { "--loop",               "loop",                                   },
+    {   "-oo",                "loop",                                   },
+    { "--msg_size",           "size",  L_MSG_SIZE,      R_MSG_SIZE      },
+    {   "-m",                 "size",  L_MSG_SIZE,      R_MSG_SIZE      },
+    { "--mtu_size",           "size",  L_MTU_SIZE,      R_MTU_SIZE      },
+    {   "-mt",                "size",  L_MTU_SIZE,      R_MTU_SIZE      },
+    { "--no_msgs",            "int",   L_NO_MSGS,       R_NO_MSGS       },
+    {   "-n",                 "int",   L_NO_MSGS,       R_NO_MSGS       },
+    { "--cq_poll",            "int",   L_POLL_MODE,     R_POLL_MODE     },
+    {  "-cp",                 "int",   L_POLL_MODE,     R_POLL_MODE     },
+    {   "-cp1",               "set1",  L_POLL_MODE,     R_POLL_MODE     },
+    {  "--loc_cq_poll",       "int",   L_POLL_MODE,                     },
+    {   "-lcp",               "int",   L_POLL_MODE,                     },
+    {   "-lcp1",              "set1",  L_POLL_MODE                      },
+    {  "--rem_cq_poll",       "int",   R_POLL_MODE                      },
+    {   "-rcp",               "int",   R_POLL_MODE                      },
+    {   "-rcp1",              "set1",  R_POLL_MODE                      },
+    { "--ip_port",            "int",   L_PORT,          R_PORT          },
+    {   "-ip",                "int",   L_PORT,          R_PORT          },
+    { "--precision",          "precision",                              },
+    {   "-e",                 "precision",                              },
+    { "--rd_atomic",          "int",   L_RD_ATOMIC,     R_RD_ATOMIC     },
+    {   "-nr",                "int",   L_RD_ATOMIC,     R_RD_ATOMIC     },
+    {  "--loc_rd_atomic",     "int",   L_RD_ATOMIC,                     },
+    {   "-lnr",               "int",   L_RD_ATOMIC,                     },
+    {  "--rem_rd_atomic",     "int",   R_RD_ATOMIC                      },
+    {   "-rnr",               "int",   R_RD_ATOMIC                      },
+    { "--service_level",      "sl",    L_SL,            R_SL            },
+    {   "-sl",                "sl",    L_SL,            R_SL            },
+    {  "--loc_service_level", "sl",    L_SL                             },
+    {   "-lsl",               "sl",    L_SL                             },
+    {  "--rem_service_level", "sl",    R_SL                             },
+    {   "-rsl",               "sl",    R_SL                             },
+    { "--sock_buf_size",      "size",  L_SOCK_BUF_SIZE, R_SOCK_BUF_SIZE },
+    {   "-sb",                "size",  L_SOCK_BUF_SIZE, R_SOCK_BUF_SIZE },
+    {  "--loc_sock_buf_size", "size",  L_SOCK_BUF_SIZE                  },
+    {   "-lsb",               "size",  L_SOCK_BUF_SIZE                  },
+    {  "--rem_sock_buf_size", "size",  R_SOCK_BUF_SIZE                  },
+    {   "-rsb",               "size",  R_SOCK_BUF_SIZE                  },
+    { "--src_path_bits",      "size",  L_SRC_PATH_BITS, R_SRC_PATH_BITS },
+    {   "-sp",                "size",  L_SRC_PATH_BITS, R_SRC_PATH_BITS },
+    {  "--loc_src_path_bits", "size",  L_SRC_PATH_BITS                  },
+    {   "-lsp",               "size",  L_SRC_PATH_BITS                  },
+    {  "--rem_src_path_bits", "size",  R_SRC_PATH_BITS                  },
+    {   "-rsp",               "size",  R_SRC_PATH_BITS                  },
+    { "--static_rate",        "str",   L_STATIC_RATE,   R_STATIC_RATE   },
+    {   "-sr",                "str",   L_STATIC_RATE,   R_STATIC_RATE   },
+    {  "--loc_static_rate",   "str",   L_STATIC_RATE                    },
+    {   "-lsr",               "str",   L_STATIC_RATE                    },
+    {  "--rem_static_rate",   "str",   R_STATIC_RATE                    },
+    {   "-rsr",               "str",   R_STATIC_RATE                    },
+    { "--time",               "time",  L_TIME,          R_TIME          },
+    {   "-t",                 "time",  L_TIME,          R_TIME          },
+    { "--timeout",            "time",  L_TIMEOUT,       R_TIMEOUT       },
+    {   "-to",                "time",  L_TIMEOUT,       R_TIMEOUT       },
+    {  "--loc_timeout",       "Stime", L_TIMEOUT                        },
+    {   "-lto",               "Stime", L_TIMEOUT                        },
+    {  "--rem_timeout",       "time",  R_TIMEOUT                        },
+    {   "-rto",               "time",  R_TIMEOUT                        },
+    { "--unify_nodes",        "un",                                     },
+    {   "-un",                "un",                                     },
+    { "--unify_units",        "uu",                                     },
+    {   "-uu",                "uu",                                     },
+    { "--use_bits_per_sec",   "ub",                                     },
+    {   "-ub",                "ub",                                     },
+    { "--use_cm",             "int",   L_USE_CM,        R_USE_CM        },
+    {   "-cm",                "int",   L_USE_CM,        R_USE_CM        },
+    {   "-cm1",               "set1",  L_USE_CM,        R_USE_CM        },
+    { "--verbose",            "v",                                      },
+    {   "-v",                 "v",                                      },
+    { "--verbose_conf",       "vc",                                     },
+    {   "-vc",                "vc",                                     },
+    { "--verbose_stat",       "vs",                                     },
+    {   "-vs",                "vs",                                     },
+    { "--verbose_time",       "vt",                                     },
+    {   "-vt",                "vt",                                     },
+    { "--verbose_used",       "vu",                                     },
+    {   "-vu",                "vu",                                     },
+    { "--verbose_more",       "vv",                                     },
+    {   "-vv",                "vv",                                     },
+    { "--verbose_more_conf",  "vvc",                                    },
+    {   "-vvc",               "vvc",                                    },
+    { "--verbose_more_stat",  "vvs",                                    },
+    {   "-vvs",               "vvs",                                    },
+    { "--verbose_more_time",  "vvt",                                    },
+    {   "-vvt",               "vvt",                                    },
+    { "--verbose_more_used",  "vvu",                                    },
+    {   "-vvu",               "vvu",                                    },
+    { "--version",            "version",                                },
+    {   "-V",                 "version",                                },
+    { "--wait_server",        "wait",                                   },
+    {   "-ws",                "wait",                                   },
+};
+
+
+/*
+ * Tests.
+ */
+#define test(n) { #n, run_client_##n, run_server_##n }
+TEST Tests[] ={
+    test(conf),
+    test(quit),
+    test(rds_bw),
+    test(rds_lat),
+    test(sctp_bw),
+    test(sctp_lat),
+    test(sdp_bw),
+    test(sdp_lat),
+    test(tcp_bw),
+    test(tcp_lat),
+    test(udp_bw),
+    test(udp_lat),
+#ifdef RDMA
+    test(rc_bi_bw),
+    test(rc_bw),
+    test(rc_compare_swap_mr),
+    test(rc_fetch_add_mr),
+    test(rc_lat),
+    test(rc_rdma_read_bw),
+    test(rc_rdma_read_lat),
+    test(rc_rdma_write_bw),
+    test(rc_rdma_write_lat),
+    test(rc_rdma_write_poll_lat),
+    test(uc_bi_bw),
+    test(uc_bw),
+    test(uc_lat),
+    test(uc_rdma_write_bw),
+    test(uc_rdma_write_lat),
+    test(uc_rdma_write_poll_lat),
+    test(ud_bi_bw),
+    test(ud_bw),
+    test(ud_lat),
+    test(ver_rc_compare_swap),
+    test(ver_rc_fetch_add),
+#ifdef HAS_XRC
+    test(xrc_bi_bw),
+    test(xrc_bw),
+    test(xrc_lat),
+#endif /* HAS_XRC */
+#endif
+};
+
+
+int
+main(int argc, char *argv[])
+{
+    initialize();
+    set_signals();
+    do_args(&argv[1]);
+    return 0;
+}
+
+
+/*
+ * Initialize variables.
+ */
+static void
+initialize(void)
+{
+    int i;
+
+    RemoteFD = -1;
+    for (i = 0; i < P_N; ++i)
+        if (ParInfo[i].index != i)
+            error(BUG, "initialize: ParInfo: out of order: %d", i);
+    ProcStatFD = open("/proc/stat", 0);
+    if (ProcStatFD < 0)
+        error(SYS, "cannot open /proc/stat");
+    IStat.no_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+    IStat.no_ticks = sysconf(_SC_CLK_TCK);
+}
+
+
+/*
+ * Look for a colon and skip past it and any spaces.
+ */
+static char *
+skip_colon(char *s)
+{
+    for (;;) {
+        int c = *s++;
+
+        if (c == ':')
+            break;
+        if (c == '\0')
+            return 0;
+    }
+    while (*s == ' ')
+        s++;
+    return s;
+}
+
+
+/*
+ * A case insensitive string compare.  s2 must at least contain all of s1 but
+ * can be longer.
+ */
+static int
+cmpsub(char *s2, char *s1)
+{
+    for (;;) {
+        int c1 = *s1++;
+        int c2 = *s2++;
+
+        if (c1 == '\0')
+            return 1;
+        if (c2 == '\0')
+            return 0;
+        if (tolower(c1) != tolower(c2))
+            return 0;
+    }
+}
+
+
+/*
+ * Set up signal handlers.
+ */
+static void
+set_signals(void)
+{
+    struct sigaction act ={
+        .sa_flags = SA_SIGINFO
+    };
+
+    act.sa_sigaction = sig_alrm;
+    sigaction(SIGALRM, &act, 0);
+    sigaction(SIGPIPE, &act, 0);
+
+    act.sa_sigaction = sig_quit;
+    sigaction(SIGQUIT, &act, 0);
+
+    act.sa_sigaction = sig_urg;
+    sigaction(SIGURG, &act, 0);
+}
+
+
+/*
+ * Note that time is up.
+ */
+static void
+sig_alrm(int signo, siginfo_t *siginfo, void *ucontext)
+{
+    set_finished();
+}
+
+
+/*
+ * Our child sends us a quit when it wishes us to exit.
+ */
+static void
+sig_quit(int signo, siginfo_t *siginfo, void *ucontext)
+{
+    exit(0);
+}
+
+
+/*
+ * Called when a TCP/IP out-of-band message is received.
+ */
+static void
+sig_urg(int signo, siginfo_t *siginfo, void *ucontext)
+{
+    urgent();
+}
+
+
+/*
+ * Parse arguments.
+ */
+static void
+do_args(char *args[])
+{
+    int isClient = 0;
+    int testSpecified = 0;
+
+    while (*args) {
+        char *arg = *args;
+        if (arg[0] == '-') {
+            OPTION *option = find_option(arg);
+            if (!option)
+                error(0, "%s: bad option; try: qperf --help options", arg);
+            if (option->type[0] != 'S')
+                isClient = 1;
+            do_option(option, &args);
+        } else {
+            isClient = 1;
+            if (!ServerName)
+                ServerName = arg;
+            else {
+                TEST *test = find_test(arg);
+
+                if (!test)
+                    error(0, "%s: bad test; try: qperf --help tests", arg);
+                do_loop(Loops, test);
+                testSpecified = 1;
+            }
+            ++args;
+        }
+    }
+
+    if (!isClient)
+        server();
+    else if (!testSpecified) {
+        if (!ServerName)
+            error(0, "you used a client-only option but did not specify the "
+                      "server name.\nDo you want to be a client or server?");
+        if (find_test(ServerName))
+            error(0, "must specify host name first; try: qperf --help");
+        error(0, "must specify a test type; try: qperf --help");
+    }
+}
+
+
+/*
+ * Loop through a series of tests.
+ */
+static void
+do_loop(LOOP *loop, TEST *test)
+{
+    if (!loop)
+        client(test);
+    else {
+        long l = loop->init;
+
+        while (l <= loop->last) {
+            char   buf[64];
+            char  *args[2] = {loop->option->name, buf};
+            char **argv = args;
+
+            snprintf(buf, sizeof(buf), "%ld", l);
+            do_option(loop->option, &argv);
+            do_loop(loop->next, test);
+            if (loop->mult)
+                l *= loop->incr;
+            else
+                l += loop->incr;
+        }
+    }
+}
+
+
+/*
+ * Given the name of an option, find it.
+ */
+static OPTION *
+find_option(char *name)
+{
+    int n;
+    DICT *d;
+    OPTION *p;
+
+    n = cardof(Renamed);
+    d = Renamed;
+    for (; n--; ++d) {
+        if (streq(name, d->str1)) {
+            char *msg = "warning: obsolete option: %s; use %s instead";
+            error(RET, msg, name, d->str2);
+            name = d->str2;
+            break;
+        }
+    }
+
+    n = cardof(Options);
+    p = Options;
+    for (; n--; ++p)
+        if (streq(name, p->name))
+            return p;
+    return 0;
+}
+
+
+/*
+ * Given the name of a test, find it.
+ */
+static TEST *
+find_test(char *name)
+{
+    int n = cardof(Tests);
+    TEST *p = Tests;
+
+    for (; n--; ++p)
+        if (streq(name, p->name))
+            return p;
+    return 0;
+}
+
+
+/*
+ * Handle options.
+ */
+static void
+do_option(OPTION *option, char ***argvp)
+{
+    char *t = option->type;
+
+    if (*t == 'S')
+        ++t;
+
+    if (streq(t, "debug")) {
+        Debug = 1;
+        *argvp += 1;
+    } else if (streq(t, "help")) {
+        /* Help */
+        char **usage;
+        char *category = (*argvp)[1];
+
+        if (!category)
+            category = "main";
+        for (usage = Usage; *usage; usage += 2)
+            if (streq(*usage, category))
+                break;
+        if (!*usage) {
+            error(0,
+                "cannot find help category %s; try: qperf --help categories",
+                                                                    category);
+        }
+        printf("%s", usage[1]);
+        exit(0);
+    } else if (streq(t, "host")) {
+        ServerName = arg_strn(argvp);
+    } else if (streq(t, "int")) {
+        long v = arg_long(argvp);
+        setp_u32(option->name, option->arg1, v);
+        setp_u32(option->name, option->arg2, v);
+    } else if (streq(t, "loop")) {
+        parse_loop(argvp);
+    } else if (streq(t, "lp")) {
+        ListenPort = arg_long(argvp);
+    } else if (streq(t, "precision")) {
+        Precision = arg_long(argvp);
+    } else if (streq(t, "set1")) {
+        setp_u32(option->name, option->arg1, 1);
+        setp_u32(option->name, option->arg2, 1);
+        *argvp += 1;
+    } else if (streq(t, "size")) {
+        long v = arg_size(argvp);
+        setp_u32(option->name, option->arg1, v);
+        setp_u32(option->name, option->arg2, v);
+    } else if (streq(t, "sl")) {
+        long v = arg_long(argvp);
+        if (v < 0 || v > 15)
+            error(0, "service level must be between 0 and 15: %d given", v);
+        setp_u32(option->name, option->arg1, v);
+        setp_u32(option->name, option->arg2, v);
+    } else if (streq(t, "str")) {
+        char *s = arg_strn(argvp);
+        setp_str(option->name, option->arg1, s);
+        setp_str(option->name, option->arg2, s);
+    } else if (streq(t, "time")) {
+        long v = arg_time(argvp);
+        setp_u32(option->name, option->arg1, v);
+        setp_u32(option->name, option->arg2, v);
+    } else if (streq(t, "ub")) {
+        UseBitsPerSec = 1;
+        *argvp += 1;
+    } else if (streq(t, "un")) {
+        UnifyNodes = 1;
+        *argvp += 1;
+    } else if (streq(t, "uu")) {
+        UnifyUnits = 1;
+        *argvp += 1;
+    } else if (streq(t, "v")) {
+        if (VerboseConf < 1)
+            VerboseConf = 1;
+        if (VerboseStat < 1)
+            VerboseStat = 1;
+        if (VerboseTime < 1)
+            VerboseTime = 1;
+        if (VerboseUsed < 1)
+            VerboseUsed = 1;
+        *argvp += 1;
+    } else if (streq(t, "vc")) {
+        VerboseConf = 1;
+        *argvp += 1;
+    } else if (streq(t, "version")) {
+        printf("qperf %d.%d.%d\n", VER_MAJ, VER_MIN, VER_INC);
+        exit(0);
+    } else if (streq(t, "vs")) {
+        VerboseStat = 1;
+        *argvp += 1;
+    } else if (streq(t, "vt")) {
+        VerboseTime = 1;
+        *argvp += 1;
+    } else if (streq(t, "vu")) {
+        VerboseUsed = 1;
+        *argvp += 1;
+    } else if (streq(t, "vv")) {
+        VerboseConf = 2;
+        VerboseStat = 2;
+        VerboseTime = 2;
+        VerboseUsed = 2;
+        *argvp += 1;
+    } else if (streq(t, "vvc")) {
+        VerboseConf = 2;
+        *argvp += 1;
+    } else if (streq(t, "vvs")) {
+        VerboseStat = 2;
+        *argvp += 1;
+    } else if (streq(t, "vvt")) {
+        VerboseTime = 2;
+        *argvp += 1;
+    } else if (streq(t, "vvu")) {
+        VerboseUsed = 2;
+        *argvp += 1;
+    } else if (streq(t, "wait")) {
+        ServerWait = arg_time(argvp);
+    } else
+        error(BUG, "do_option: unknown type: %s", t);
+}
+
+
+/*
+ * Parse a loop option.
+ */
+static void
+parse_loop(char ***argvp)
+{
+    char *opt  = **argvp;
+    char *s    = two_args(argvp);
+    char *name = loop_arg(&s);
+    char *init = loop_arg(&s);
+    char *last = loop_arg(&s);
+    char *incr = loop_arg(&s);
+    LOOP *loop = qmalloc(sizeof(LOOP));
+
+    memset(loop, 0, sizeof(*loop));
+
+    /* Parse variable name */
+    {
+        int n = cardof(Options);
+        OPTION *p = Options;
+
+        if (!name)
+            name = "msg_size";
+        for (;;) {
+            char *s = p->name;
+
+            if (n-- == 0)
+                error(0, "%s: %s: no such variable", opt, name);
+            if (*s++ != '-')
+                continue;
+            if (*s == '-')
+                s++;
+            if (streq(name, s))
+                break;
+            p++;
+        }
+        loop->option = p;
+    }
+
+    /* Parse increment */
+    if (!incr)
+        loop->incr = 0;
+    else {
+        if (incr[0] == '*') {
+            incr++;
+            loop->mult = 1;
+        }
+        loop->incr = str_size(incr, opt);
+        if (loop->incr < 1)
+            error(0, "%s: %s: increment must be positive", opt, incr);
+    }
+
+    /* Parse initial value */
+    if (init)
+        loop->init = str_size(init, opt);
+    else
+        loop->init = loop->mult ? 1 : 0;
+
+    /* Parse last value */
+    if (!last)
+        error(0, "%s: must specify limit", opt);
+    loop->last = str_size(last, opt);
+
+    /* Insert into loop list */
+    if (!Loops)
+        Loops = loop;
+    else {
+        LOOP *l = Loops;
+
+        while (l->next)
+            l = l->next;
+        l->next = loop;
+    }
+}
+
+
+/*
+ * Given a string consisting of arguments separated by colons, return the next
+ * argument and prepare for scanning the next one.
+ */
+static char *
+loop_arg(char **pp)
+{
+    char *a = *pp;
+    char *p = a;
+
+    while (*p) {
+        if (*p == ':') {
+            *p = '\0';
+            *pp = p + 1;
+            break;
+        }
+        ++p;
+    }
+    return a[0] ? a : 0;
+}
+
+
+/*
+ * Ensure that two arguments exist.
+ */
+static char *
+two_args(char ***argvp)
+{
+    char **argv = *argvp;
+
+    if (!argv[1])
+        error(0, "%s: missing argument", argv[0]);
+    *argvp += 2;
+    return argv[1];
+}
+
+
+/*
+ * Return the value of a long argument.  It must be non-negative.
+ */
+static long
+arg_long(char ***argvp)
+{
+    char **argv = *argvp;
+    char *p;
+    long l;
+
+    if (!argv[1])
+        error(0, "missing argument to %s", argv[0]);
+    l = strtol(argv[1], &p, 10);
+    if (p[0] != '\0')
+        error(0, "bad argument: %s", argv[1]);
+    if (l < 0)
+        error(0, "%s requires a non-negative number", argv[0]);
+    *argvp += 2;
+    return l;
+}
+
+
+/*
+ * Return the value of a size argument.
+ */
+static long
+arg_size(char ***argvp)
+{
+    long l;
+    char **argv = *argvp;
+
+    *argvp += 2;
+    if (!argv[1])
+        error(0, "missing argument to %s", argv[0]);
+    l = str_size(argv[1], argv[0]);
+    if (l < 0)
+        error(0, "%s requires a non-negative number", argv[0]);
+    return l;
+}
+
+
+/*
+ * Scan a size argument from a string.
+ */
+static long
+str_size(char *str, char *arg)
+{
+    char *p;
+    long m = 1;
+    long double d = strtold(str, &p);
+
+    if (p[0] == '\0')
+        m = 1;
+    else if (streq(p, "kb") || streq(p, "k"))
+        m = 1000;
+    else if (streq(p, "mb") || streq(p, "m"))
+        m = 1000 * 1000;
+    else if (streq(p, "gb") || streq(p, "g"))
+        m = 1000 * 1000 * 1000;
+    else if (streq(p, "kib") || streq(p, "K"))
+        m = 1024;
+    else if (streq(p, "mib") || streq(p, "M"))
+        m = 1024 * 1024;
+    else if (streq(p, "gib") || streq(p, "G"))
+        m = 1024 * 1024 * 1024;
+    else
+        error(0, "%s: bad size: %s", arg, str);
+
+    return d * m;
+}
+
+
+/*
+ * Return the value of a string argument.
+ */
+static char *
+arg_strn(char ***argvp)
+{
+    char **argv = *argvp;
+
+    if (!argv[1])
+        error(0, "missing argument to %s", argv[0]);
+    *argvp += 2;
+    return argv[1];
+}
+
+
+/*
+ * Return the value of a size argument.
+ */
+static long
+arg_time(char ***argvp)
+{
+    char *p;
+    long double d;
+    long l = 0;
+    char **argv = *argvp;
+
+    if (!argv[1])
+        error(0, "missing argument to %s", argv[0]);
+
+    d = strtold(argv[1], &p);
+    if (d < 0)
+        error(0, "%s requires a non-negative number", argv[0]);
+
+    if (p[0] == '\0')
+        l = (long)d;
+    else {
+        int u = *p;
+        if (p[1] != '\0')
+            error(0, "bad argument: %s", argv[1]);
+        if (u == 's' || u == 'S')
+            l = (long)d;
+        else if (u == 'm' || u == 'M')
+            l = (long)(d * (60));
+        else if (u == 'h' || u == 'H')
+            l = (long)(d * (60 * 60));
+        else if (u == 'd' || u == 'D')
+            l = (long)(d * (60 * 60 * 24));
+        else
+            error(0, "bad argument: %s", argv[1]);
+    }
+
+    *argvp += 2;
+    return l;
+}
+
+
+/*
+ * Set a value stored in a 32 bit value without letting anyone know we set it.
+ */
+void
+setv_u32(PAR_INDEX index, uint32_t l)
+{
+    PAR_INFO *p = par_info(index);
+    *((uint32_t *)p->ptr) = l;
+}
+
+
+/*
+ * Set an option stored in a 32 bit value.
+ */
+void
+setp_u32(char *name, PAR_INDEX index, uint32_t l)
+{
+    PAR_INFO *p = par_set(name, index);
+
+    if (!p)
+        return;
+    *((uint32_t *)p->ptr) = l;
+}
+
+
+/*
+ * Set an option stored in a string vector.
+ */
+void
+setp_str(char *name, PAR_INDEX index, char *s)
+{
+    PAR_INFO *p = par_set(name, index);
+
+    if (!p)
+        return;
+    if (strlen(s) >= STRSIZE)
+        error(0, "%s: too long", s);
+    strcpy(p->ptr, s);
+}
+
+
+/*
+ * Note a parameter as being used.
+ */
+void
+par_use(PAR_INDEX index)
+{
+    PAR_INFO *p = par_info(index);
+
+    p->used = 1;
+    p->inuse = 1;
+}
+
+
+/*
+ * Set the PAR_INFO.name value.
+ */
+static PAR_INFO *
+par_set(char *name, PAR_INDEX index)
+{
+    PAR_INFO *p = par_info(index);
+
+    if (index == P_NULL)
+        return 0;
+    if (name) {
+        p->name = name;
+        p->set = 1;
+    } else {
+        p->used = 1;
+        p->inuse = 1;
+        if (p->name)
+            return 0;
+    }
+    return p;
+}
+
+
+/*
+ * Determine if a parameter is set.
+ */
+static int
+par_isset(PAR_INDEX index)
+{
+    return par_info(index)->name != 0;
+}
+
+
+/*
+ * Index the ParInfo table.
+ */
+static PAR_INFO *
+par_info(PAR_INDEX index)
+{
+    PAR_INFO *p = &ParInfo[index];
+
+    if (index != p->index)
+        error(BUG, "par_info: table out of order: %d != %d", index, p-index);
+    return p;
+}
+
+
+/*
+ * If any options were set but were not used, print out a warning message for
+ * the user.
+ */
+void
+opt_check(void)
+{
+    PAR_INFO *p;
+    PAR_INFO *q;
+    PAR_INFO *r = endof(ParInfo);
+
+    for (p = ParInfo; p < r; ++p) {
+        if (p->used || !p->set)
+            continue;
+        error(RET, "warning: %s set but not used in test %s",
+                                                        p->name, TestName);
+        for (q = p+1; q < r; ++q)
+            if (q->set && q->name == p->name)
+                q->set = 0;
+    }
+}
+
+
+/*
+ * Server.
+ */
+static void
+server(void)
+{
+    server_listen();
+    for (;;) {
+        REQ req;
+        pid_t pid;
+        TEST *test;
+        int s = offset(REQ, req_index);
+
+        debug("ready for requests");
+        if (!server_recv_request())
+            continue;
+        pid = fork();
+        if (pid < 0) {
+            error(SYS|RET, "fork failed");
+            continue;
+        }
+        if (pid > 0) {
+            remotefd_close();
+            waitpid(pid, 0, 0);
+            continue;
+        }
+        remotefd_setup();
+
+        recv_mesg(&req, s, "request version");
+        dec_init(&req);
+        dec_req_version(&Req);
+        if (Req.ver_maj != VER_MAJ || Req.ver_min != VER_MIN)
+            version_error();
+        recv_mesg(&req.req_index, sizeof(req)-s, "request data");
+        dec_req_data(&Req);
+        if (Req.req_index >= cardof(Tests))
+            error(0, "bad request index: %d", Req.req_index);
+
+        test = &Tests[Req.req_index];
+        TestName = test->name;
+        debug("received request: %s", TestName);
+        init_lstat();
+        set_affinity();
+        (test->server)();
+        exit(0);
+    }
+    close(ListenFD);
+}
+
+
+/*
+ * If there is a version mismatch of qperf between the client and server, tell
+ * the user which needs to be upgraded.
+ */
+static void
+version_error(void)
+{
+    int hi_maj = Req.ver_maj;
+    int hi_min = Req.ver_min;
+    int hi_inc = Req.ver_inc;
+    int lo_maj = VER_MAJ;
+    int lo_min = VER_MIN;
+    int lo_inc = VER_INC;
+    char *msg = "upgrade qperf on %s from %d.%d.%d to %d.%d.%d";
+    char *low = "server";
+
+    if (lo_maj > hi_maj || (lo_maj == hi_maj && lo_min > hi_min)) {
+        hi_maj = VER_MAJ;
+        hi_min = VER_MIN;
+        hi_inc = VER_INC;
+        lo_maj = Req.ver_maj;
+        lo_min = Req.ver_min;
+        lo_inc = Req.ver_inc;
+        low   = "client";
+    }
+    error(0, msg, low, lo_maj, lo_min, lo_inc, hi_maj, hi_min, hi_inc);
+}
+
+
+/*
+ * Listen for any requests.
+ */
+static void
+server_listen(void)
+{
+    AI *ai;
+    AI hints ={
+        .ai_flags    = AI_PASSIVE | AI_NUMERICSERV,
+        .ai_family   = AF_UNSPEC,
+        .ai_socktype = SOCK_STREAM
+    };
+    AI *ailist = getaddrinfo_port(0, ListenPort, &hints);
+
+    for (ai = ailist; ai; ai = ai->ai_next) {
+        ListenFD = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+        if (ListenFD < 0)
+            continue;
+        setsockopt_one(ListenFD, SO_REUSEADDR);
+        if (bind(ListenFD, ai->ai_addr, ai->ai_addrlen) == SUCCESS0)
+            break;
+        close(ListenFD);
+    }
+    freeaddrinfo(ailist);
+    if (!ai)
+        error(0, "unable to bind to listen port");
+
+    if (!Req.timeout)
+        Req.timeout = DEF_TIMEOUT;
+    if (listen(ListenFD, LISTENQ) < 0)
+        error(SYS, "listen failed");
+}
+
+
+/*
+ * Accept a request from a client.
+ */
+static int
+server_recv_request(void)
+{
+    socklen_t clientLen;
+    struct sockaddr_in clientAddr;
+
+    clientLen = sizeof(clientAddr);
+    RemoteFD = accept(ListenFD, (struct sockaddr *)&clientAddr, &clientLen);
+    if (RemoteFD < 0)
+        return error(SYS|RET, "accept failed");
+    return 1;
+}
+
+
+/*
+ * Client.
+ */
+static void
+client(TEST *test)
+{
+    int i;
+
+    for (i = 0; i < P_N; ++i)
+        ParInfo[i].inuse = 0;
+    if (!par_isset(L_NO_MSGS))
+        setp_u32(0, L_TIME, DEF_TIME);
+    if (!par_isset(R_NO_MSGS))
+        setp_u32(0, R_TIME, DEF_TIME);
+    setp_u32(0, L_TIMEOUT, DEF_TIMEOUT);
+    setp_u32(0, R_TIMEOUT, DEF_TIMEOUT);
+    par_use(L_AFFINITY);
+    par_use(R_AFFINITY);
+    par_use(L_TIME);
+    par_use(R_TIME);
+
+    set_affinity();
+    RReq.ver_maj = VER_MAJ;
+    RReq.ver_min = VER_MIN;
+    RReq.ver_inc = VER_INC;
+    RReq.req_index = test - Tests;
+    TestName = test->name;
+    debug("sending request: %s", TestName);
+    init_lstat();
+    printf("%s:\n", TestName);
+    (*test->client)();
+    remotefd_close();
+    place_show();
+}
+
+
+/*
+ * Send a request to the server.
+ */
+void
+client_send_request(void)
+{
+    REQ req;
+    AI *a;
+    AI hints ={
+        .ai_family   = AF_UNSPEC,
+        .ai_socktype = SOCK_STREAM
+    };
+    AI *ailist = getaddrinfo_port(ServerName, ListenPort, &hints);
+
+    RemoteFD = -1;
+    if (ServerWait)
+        start_test_timer(ServerWait);
+    for (;;) {
+        for (a = ailist; a; a = a->ai_next) {
+            if (Finished)
+                break;
+            RemoteFD = socket(a->ai_family, a->ai_socktype, a->ai_protocol);
+            if (RemoteFD < 0)
+                continue;
+            if (connect(RemoteFD, a->ai_addr, a->ai_addrlen) != SUCCESS0) {
+                remotefd_close();
+                continue;
+            }
+            ServerAddrLen = a->ai_addrlen;
+            memcpy(&ServerAddr, a->ai_addr, ServerAddrLen);
+            break;
+        }
+        if (RemoteFD >= 0 || !ServerWait || Finished)
+            break;
+        sleep(1);
+    }
+
+    if (ServerWait)
+        stop_test_timer();
+    freeaddrinfo(ailist);
+
+    if (RemoteFD < 0)
+        error(0, "%s: failed to connect", ServerName);
+    remotefd_setup();
+    enc_init(&req);
+    enc_req(&RReq);
+    send_mesg(&req, sizeof(req), "request data");
+}
+
+
+/*
+ * Configure the remote file descriptor.
+ */
+static void
+remotefd_setup(void)
+{
+    int one = 1;
+
+    if (ioctl(RemoteFD, FIONBIO, &one) < 0)
+        error(SYS, "ioctl FIONBIO failed");
+    if (fcntl(RemoteFD, F_SETOWN, getpid()) < 0)
+        error(SYS, "fcntl F_SETOWN failed");
+}
+
+
+/*
+ * Close the remote file descriptor.
+ * Set a file descriptor to non-blocking.
+ */
+static void
+remotefd_close(void)
+{
+    close(RemoteFD);
+    RemoteFD = -1;
+}
+
+
+/*
+ * Exchange results.  We sync up only to ensure that the client is out of its
+ * loop so we can close our socket or whatever communication medium we are
+ * using.
+ */
+void
+exchange_results(void)
+{
+    STAT stat;
+
+    if (is_client()) {
+        recv_mesg(&stat, sizeof(stat), "results");
+        dec_init(&stat);
+        dec_stat(&RStat);
+        send_sync("synchronization after test");
+    } else {
+        enc_init(&stat);
+        enc_stat(&LStat);
+        send_mesg(&stat, sizeof(stat), "results");
+        recv_sync("synchronization after test");
+    }
+}
+
+
+/*
+ * Initialize local status information.
+ */
+static void
+init_lstat(void)
+{
+    memcpy(&LStat, &IStat, sizeof(LStat));
+}
+
+
+/*
+ * Show configuration (client side).
+ */
+static void
+run_client_conf(void)
+{
+    CONF lconf;
+    CONF rconf;
+
+    client_send_request();
+    recv_mesg(&rconf, sizeof(rconf), "configuration");
+    get_conf(&lconf);
+    view_strn('a', "", "loc_node",  lconf.node);
+    view_strn('a', "", "loc_cpu",   lconf.cpu);
+    view_strn('a', "", "loc_os",    lconf.os);
+    view_strn('a', "", "loc_qperf", lconf.qperf);
+    view_strn('a', "", "rem_node",  rconf.node);
+    view_strn('a', "", "rem_cpu",   rconf.cpu);
+    view_strn('a', "", "rem_os",    rconf.os);
+    view_strn('a', "", "rem_qperf", rconf.qperf);
+}
+
+
+/*
+ * Show configuration (server side).
+ */
+static void
+run_server_conf(void)
+{
+    CONF conf;
+
+    get_conf(&conf);
+    send_mesg(&conf, sizeof(conf), "configuration");
+}
+
+
+/*
+ * Get configuration.
+ */
+static void
+get_conf(CONF *conf)
+{
+    struct utsname utsname;
+
+    uname(&utsname);
+    strncopy(conf->node, utsname.nodename, sizeof(conf->node));
+    snprintf(conf->os, sizeof(conf->os), "%s %s", utsname.sysname,
+                                                  utsname.release);
+    get_cpu(conf);
+    snprintf(conf->qperf, sizeof(conf->qperf), "%d.%d.%d",
+                                        VER_MAJ, VER_MIN, VER_INC);
+}
+
+
+/*
+ * Get CPU information.
+ */
+static void
+get_cpu(CONF *conf)
+{
+    char count[STRSIZE];
+    char speed[STRSIZE];
+    char buf[BUFSIZE];
+    char cpu[BUFSIZE];
+    char mhz[BUFSIZE];
+    int cpus = 0;
+    int mixed = 0;
+    FILE *fp = fopen("/proc/cpuinfo", "r");
+
+    if (!fp)
+        error(0, "cannot open /proc/cpuinfo");
+    cpu[0] = '\0';
+    mhz[0] = '\0';
+    while (fgets(buf, sizeof(buf), fp)) {
+        int n = strlen(buf);
+        if (cmpsub(buf, "model name")) {
+            ++cpus;
+            if (!mixed) {
+                if (cpu[0] == '\0')
+                    strncopy(cpu, buf, sizeof(cpu));
+                else if (!streq(buf, cpu))
+                    mixed = 1;
+            }
+        } else if (cmpsub(buf, "cpu MHz")) {
+            if (!mixed) {
+                if (mhz[0] == '\0')
+                    strncopy(mhz, buf, sizeof(mhz));
+                else if (!streq(buf, mhz))
+                    mixed = 1;
+            }
+        }
+        while (n && buf[n-1] != '\n') {
+            if (!fgets(buf, sizeof(buf), fp))
+                break;
+            n = strlen(buf);
+        }
+    }
+    fclose(fp);
+
+    /* CPU name */
+    if (mixed)
+        strncopy(cpu, "Mixed CPUs", sizeof(cpu));
+    else {
+        char *p = cpu;
+        char *q = skip_colon(cpu);
+        if (!q)
+            return;
+        for (;;) {
+            if (*q == '(' && cmpsub(q, "(r)"))
+                q += 3;
+            else if (*q == '(' && cmpsub(q, "(tm)"))
+                q += 4;
+            if (tolower(*q) == 'c' && cmpsub(q, "cpu "))
+                q += 4;
+            if (tolower(*q) == 'p' && cmpsub(q, "processor "))
+                q += 10;
+            else if (q[0] == ' ' && q[1] == ' ')
+                q += 1;
+            else if (q[0] == '\n')
+                q += 1;
+            else if (!(*p++ = *q++))
+                break;
+        }
+    }
+
+    /* CPU speed */
+    speed[0] = '\0';
+    if (!mixed) {
+        int n = strlen(cpu);
+        if (n < 3 || cpu[n-2] != 'H' || cpu[n-1] != 'z') {
+            char *q = skip_colon(mhz);
+            if (q) {
+                int freq = atoi(q);
+                if (freq < 1000)
+                    snprintf(speed, sizeof(speed), " %dMHz", freq);
+                else
+                    snprintf(speed, sizeof(speed), " %.1fGHz", freq/1000.0);
+            }
+        }
+    }
+
+    /* Number of CPUs */
+    if (cpus == 1)
+        count[0] = '\0';
+    else
+        snprintf(count, sizeof(count), "%d Cores: ", cpus);
+
+    snprintf(conf->cpu, sizeof(conf->cpu), "%s%s%s", count, cpu, speed);
+}
+
+
+/*
+ * Quit (client side).
+ */
+static void
+run_client_quit(void)
+{
+    opt_check();
+    client_send_request();
+    sync_test();
+    exit(0);
+}
+
+
+/*
+ * Quit (server side).  The read is to ensure that the client first quits to
+ * ensure that everything closes down cleanly.
+ */
+static void
+run_server_quit(void)
+{
+    char buf[1];
+
+    sync_test();
+    (void) read(RemoteFD, buf, sizeof(buf));
+    kill(getppid(), SIGQUIT);
+    exit(0);
+}
+
+
+/*
+ * Synchronize the client and server.
+ */
+void
+sync_test(void)
+{
+    synchronize("synchronization before test");
+    start_test_timer(Req.time);
+}
+
+
+/*
+ * Start test timer.
+ */
+static void
+start_test_timer(int seconds)
+{
+    struct itimerval itimerval = {{0}};
+
+    Finished = 0;
+    get_times(LStat.time_s);
+    setitimer(ITIMER_REAL, &itimerval, 0);
+    if (!seconds)
+        return;
+
+    debug("starting timer for %d seconds", seconds);
+    itimerval.it_value.tv_sec = seconds;
+    /*
+     * SLES11 has high precision timers; too low an interval will cause timer
+     * to fire extremely rapidly after first occurrence.  We set it to 10 ms.
+     */
+    itimerval.it_interval.tv_usec = 10000;
+    setitimer(ITIMER_REAL, &itimerval, 0);
+}
+
+
+/*
+ * Stop timing.  Note that the end time is obtained by the first call to
+ * set_finished.  In the tests, when SIGALRM goes off, it may be executing a
+ * system call which gets interrupted.  If SIGALRM goes off after Finished is
+ * checked but before the system call is initiated, the system call will be
+ * executed and it will take the second SIGALRM call generated by the interval
+ * timer to wake it up.  Hence, we save the end times in sig_alrm.  Note that
+ * if Finished is set, we reject any packets that are sent or arrive in order
+ * not to cheat.  We clear Finished since code assumes that it is the default
+ * state.
+ */
+void
+stop_test_timer(void)
+{
+    struct itimerval itimerval = {{0}};
+
+    set_finished();
+    setitimer(ITIMER_REAL, &itimerval, 0);
+    Finished = 0;
+    debug("stopping timer");
+}
+
+
+/*
+ * Establish the current test as finished.
+ */
+void
+set_finished(void)
+{
+    if (Finished++ == 0)
+        get_times(LStat.time_e);
+}
+
+
+/*
+ * Show results.
+ */
+void
+show_results(MEASURE measure)
+{
+    calc_results();
+    show_info(measure);
+}
+
+
+/*
+ * Calculate results.
+ */
+static void
+calc_results(void)
+{
+    double no_msgs;
+    double locTime;
+    double remTime;
+    double midTime;
+    double gB = 1000 * 1000 * 1000;
+
+    add_ustat(&LStat.s, &RStat.rem_s);
+    add_ustat(&LStat.r, &RStat.rem_r);
+    add_ustat(&RStat.s, &LStat.rem_s);
+    add_ustat(&RStat.r, &LStat.rem_r);
+
+    memset(&Res, 0, sizeof(Res));
+    calc_node(&Res.l, &LStat);
+    calc_node(&Res.r, &RStat);
+    no_msgs = LStat.r.no_msgs + RStat.r.no_msgs;
+    if (no_msgs)
+        Res.latency = Res.l.time_real / no_msgs;
+
+    locTime = Res.l.time_real;
+    remTime = Res.r.time_real;
+    midTime = (locTime + remTime) / 2;
+
+    if (locTime == 0 || remTime == 0)
+        return;
+
+    /* Calculate messaging rate */
+    if (!RStat.r.no_msgs)
+        Res.msg_rate = LStat.r.no_msgs / remTime;
+    else if (!LStat.r.no_msgs)
+        Res.msg_rate = RStat.r.no_msgs / locTime;
+    else
+        Res.msg_rate = (LStat.r.no_msgs + RStat.r.no_msgs) / midTime;
+
+    /* Calculate send bandwidth */
+    if (!RStat.s.no_bytes)
+        Res.send_bw = LStat.s.no_bytes / locTime;
+    else if (!LStat.s.no_bytes)
+        Res.send_bw = RStat.s.no_bytes / remTime;
+    else
+        Res.send_bw = (LStat.s.no_bytes + RStat.s.no_bytes) / midTime;
+
+    /* Calculate receive bandwidth. */
+    if (!RStat.r.no_bytes)
+        Res.recv_bw = LStat.r.no_bytes / locTime;
+    else if (!LStat.r.no_bytes)
+        Res.recv_bw = RStat.r.no_bytes / remTime;
+    else
+        Res.recv_bw = (LStat.r.no_bytes + RStat.r.no_bytes) / midTime;
+
+    /* Calculate costs */
+    if (LStat.s.no_bytes && !LStat.r.no_bytes && !RStat.s.no_bytes)
+        Res.send_cost = Res.l.time_cpu*gB / LStat.s.no_bytes;
+    else if (RStat.s.no_bytes && !RStat.r.no_bytes && !LStat.s.no_bytes)
+        Res.send_cost = Res.r.time_cpu*gB / RStat.s.no_bytes;
+    if (RStat.r.no_bytes && !RStat.s.no_bytes && !LStat.r.no_bytes)
+        Res.recv_cost = Res.r.time_cpu*gB / RStat.r.no_bytes;
+    else if (LStat.r.no_bytes && !LStat.s.no_bytes && !RStat.r.no_bytes)
+        Res.recv_cost = Res.l.time_cpu*gB / LStat.r.no_bytes;
+}
+
+
+/*
+ * Determine the number of packets left to send.
+ */
+int
+left_to_send(long *sentp, int room)
+{
+    int n;
+
+    if (!Req.no_msgs)
+        return room;
+    n = Req.no_msgs - *sentp;
+    if (n <= 0)
+        return 0;
+    if (n > room)
+        return room;
+    return n;
+}
+
+
+/*
+ * Combine statistics that the remote node kept track of with those that the
+ * local node kept.
+ */
+static void
+add_ustat(USTAT *l, USTAT *r)
+{
+    l->no_bytes += r->no_bytes;
+    l->no_msgs  += r->no_msgs;
+    l->no_errs  += r->no_errs;
+}
+
+
+/*
+ * Calculate time values for a node.
+ */
+static void
+calc_node(RESN *resn, STAT *stat)
+{
+    int i;
+    CLOCK cpu;
+    double s = stat->time_e[T_REAL] - stat->time_s[T_REAL];
+
+    memset(resn, 0, sizeof(*resn));
+    if (s == 0)
+        return;
+    if (stat->no_ticks == 0)
+        return;
+
+    resn->time_real = s / stat->no_ticks;
+
+    cpu = 0;
+    for (i = 0; i < T_N; ++i)
+        if (i != T_REAL && i != T_IDLE)
+            cpu += stat->time_e[i] - stat->time_s[i];
+    resn->time_cpu = (float) cpu / stat->no_ticks;
+
+    resn->cpu_user = (stat->time_e[T_USER] - stat->time_s[T_USER]
+                   + stat->time_e[T_NICE] - stat->time_s[T_NICE]) / s;
+
+    resn->cpu_intr = (stat->time_e[T_IRQ] - stat->time_s[T_IRQ]
+                   +  stat->time_e[T_SOFTIRQ] - stat->time_s[T_SOFTIRQ]) / s;
+
+    resn->cpu_idle = (stat->time_e[T_IDLE] - stat->time_s[T_IDLE]) / s;
+
+    resn->cpu_kernel = (stat->time_e[T_KERNEL] - stat->time_s[T_KERNEL]
+                     +  stat->time_e[T_STEAL] - stat->time_s[T_STEAL]) / s;
+
+    resn->cpu_io_wait = (stat->time_e[T_IOWAIT] - stat->time_s[T_IOWAIT]) / s;
+
+    resn->cpu_total = resn->cpu_user + resn->cpu_intr
+                    + resn->cpu_kernel + resn->cpu_io_wait;
+}
+
+
+/*
+ * Show relevant values.
+ */
+static void
+show_info(MEASURE measure)
+{
+    if (measure == LATENCY) {
+        view_time('a', "", "latency", Res.latency);
+        view_rate('s', "", "msg_rate", Res.msg_rate);
+    } else if (measure == MSG_RATE) {
+        view_rate('a', "", "msg_rate", Res.msg_rate);
+    } else if (measure == BANDWIDTH) {
+        view_band('a', "", "bw", Res.recv_bw);
+        view_rate('s', "", "msg_rate", Res.msg_rate);
+    } else if (measure == BANDWIDTH_SR) {
+        view_band('a', "", "send_bw", Res.send_bw);
+        view_band('a', "", "recv_bw", Res.recv_bw);
+        view_rate('s', "", "msg_rate", Res.msg_rate);
+    }
+    show_used();
+    view_cost('t', "", "send_cost", Res.send_cost);
+    view_cost('t', "", "recv_cost", Res.recv_cost);
+    show_rest();
+    if (Debug)
+        show_debug();
+}
+
+
+/*
+ * Show parameters the user set.
+ */
+static void
+show_used(void)
+{
+    PAR_NAME *p;
+    PAR_NAME *q = endof(ParName);
+
+    if (!VerboseUsed)
+        return;
+    for (p = ParName; p < q; ++p) {
+        PAR_INFO *l = par_info(p->loc_i);
+        PAR_INFO *r = par_info(p->rem_i);
+
+        if (!l->inuse && !r->inuse)
+            continue;
+        if (VerboseUsed < 2 && !l->set & !r->set)
+            continue;
+        if (l->type == 'l') {
+            uint32_t lv = *(uint32_t *)l->ptr;
+            uint32_t rv = *(uint32_t *)r->ptr;
+            if (lv == rv)
+                view_long('u', "", p->name, lv);
+            else {
+                view_long('u', "loc_", p->name, lv);
+                view_long('u', "rem_", p->name, rv);
+            }
+        } else if (l->type == 'p') {
+            if (streq(l->ptr, r->ptr))
+                view_strn('u', "", p->name, l->ptr);
+            else {
+                view_strn('u', "loc_", p->name, l->ptr);
+                view_strn('u', "rem_", p->name, r->ptr);
+            }
+        } else if (l->type == 's') {
+            uint32_t lv = *(uint32_t *)l->ptr;
+            uint32_t rv = *(uint32_t *)r->ptr;
+            if (lv == rv)
+                view_size('u', "", p->name, lv);
+            else {
+                view_size('u', "loc_", p->name, lv);
+                view_size('u', "rem_", p->name, rv);
+            }
+        } else if (l->type == 't') {
+            uint32_t lv = *(uint32_t *)l->ptr;
+            uint32_t rv = *(uint32_t *)r->ptr;
+            if (lv == rv)
+                view_time('u', "", p->name, lv);
+            else {
+                view_time('u', "loc_", p->name, lv);
+                view_time('u', "rem_", p->name, rv);
+            }
+        }
+    }
+}
+
+
+/*
+ * Show the remaining parameters.
+ */
+static void
+show_rest(void)
+{
+    RESN *resnS;
+    RESN *resnR;
+    STAT *statS;
+    STAT *statR;
+    int srmode = 0;
+
+    if (!UnifyNodes) {
+        uint64_t ls = LStat.s.no_bytes;
+        uint64_t lr = LStat.r.no_bytes;
+        uint64_t rs = RStat.s.no_bytes;
+        uint64_t rr = RStat.r.no_bytes;
+        
+        if (ls && !rs && rr && !lr) {
+            srmode = 1;
+            resnS = &Res.l;
+            resnR = &Res.r;
+            statS = &LStat;
+            statR = &RStat;
+        } else if (rs && !ls && lr && !rr) {
+            srmode = 1;
+            resnS = &Res.r;
+            resnR = &Res.l;
+            statS = &RStat;
+            statR = &LStat;
+        }
+    }
+
+    if (srmode) {
+        view_cpus('t', "", "send_cpus_used",   resnS->cpu_total);
+        view_cpus('T', "", "send_cpus_user",   resnS->cpu_user);
+        view_cpus('T', "", "send_cpus_intr",   resnS->cpu_intr);
+        view_cpus('T', "", "send_cpus_kernel", resnS->cpu_kernel);
+        view_cpus('T', "", "send_cpus_iowait", resnS->cpu_io_wait);
+        view_time('T', "", "send_real_time",   resnS->time_real);
+        view_time('T', "", "send_cpu_time",    resnS->time_cpu);
+        view_long('S', "", "send_errors",      statS->s.no_errs);
+        view_size('S', "", "send_bytes",       statS->s.no_bytes);
+        view_long('S', "", "send_msgs",        statS->s.no_msgs);
+        view_long('S', "", "send_max_cqe",     statS->max_cqes);
+
+        view_cpus('t', "", "recv_cpus_used",   resnR->cpu_total);
+        view_cpus('T', "", "recv_cpus_user",   resnR->cpu_user);
+        view_cpus('T', "", "recv_cpus_intr",   resnR->cpu_intr);
+        view_cpus('T', "", "recv_cpus_kernel", resnR->cpu_kernel);
+        view_cpus('T', "", "recv_cpus_iowait", resnR->cpu_io_wait);
+        view_time('T', "", "recv_real_time",   resnR->time_real);
+        view_time('T', "", "recv_cpu_time",    resnR->time_cpu);
+        view_long('S', "", "recv_errors",      statR->r.no_errs);
+        view_size('S', "", "recv_bytes",       statR->r.no_bytes);
+        view_long('S', "", "recv_msgs",        statR->r.no_msgs);
+        view_long('S', "", "recv_max_cqe",     statR->max_cqes);
+    } else {
+        view_cpus('t', "", "loc_cpus_used",    Res.l.cpu_total);
+        view_cpus('T', "", "loc_cpus_user",    Res.l.cpu_user);
+        view_cpus('T', "", "loc_cpus_intr",    Res.l.cpu_intr);
+        view_cpus('T', "", "loc_cpus_kernel",  Res.l.cpu_kernel);
+        view_cpus('T', "", "loc_cpus_iowait",  Res.l.cpu_io_wait);
+        view_time('T', "", "loc_real_time",    Res.l.time_real);
+        view_time('T', "", "loc_cpu_time",     Res.l.time_cpu);
+        view_long('S', "", "loc_send_errors",  LStat.s.no_errs);
+        view_long('S', "", "loc_recv_errors",  LStat.r.no_errs);
+        view_size('S', "", "loc_send_bytes",   LStat.s.no_bytes);
+        view_size('S', "", "loc_recv_bytes",   LStat.r.no_bytes);
+        view_long('S', "", "loc_send_msgs",    LStat.s.no_msgs);
+        view_long('S', "", "loc_recv_msgs",    LStat.r.no_msgs);
+        view_long('S', "", "loc_max_cqe",      LStat.max_cqes);
+
+        view_cpus('t', "", "rem_cpus_used",    Res.r.cpu_total);
+        view_cpus('T', "", "rem_cpus_user",    Res.r.cpu_user);
+        view_cpus('T', "", "rem_cpus_intr",    Res.r.cpu_intr);
+        view_cpus('T', "", "rem_cpus_kernel",  Res.r.cpu_kernel);
+        view_cpus('T', "", "rem_cpus_iowait",  Res.r.cpu_io_wait);
+        view_time('T', "", "rem_real_time",    Res.r.time_real);
+        view_time('T', "", "rem_cpu_time",     Res.r.time_cpu);
+        view_long('S', "", "rem_send_errors",  RStat.s.no_errs);
+        view_long('S', "", "rem_recv_errors",  RStat.r.no_errs);
+        view_size('S', "", "rem_send_bytes",   RStat.s.no_bytes);
+        view_size('S', "", "rem_recv_bytes",   RStat.r.no_bytes);
+        view_long('S', "", "rem_send_msgs",    RStat.s.no_msgs);
+        view_long('S', "", "rem_recv_msgs",    RStat.r.no_msgs);
+        view_long('S', "", "rem_max_cqe",      RStat.max_cqes);
+    }
+}
+
+
+/*
+ * Show all values.
+ */
+static void
+show_debug(void)
+{
+    /* Local node */
+    view_long('d', "", "l_no_cpus",  LStat.no_cpus);
+    view_long('d', "", "l_no_ticks", LStat.no_ticks);
+    view_long('d', "", "l_max_cqes", LStat.max_cqes);
+
+    if (LStat.no_ticks) {
+        double t = LStat.no_ticks;
+        CLOCK *s = LStat.time_s;
+        CLOCK *e = LStat.time_e;
+        double real    = (e[T_REAL]    - s[T_REAL])    / t;
+        double user    = (e[T_USER]    - s[T_USER])    / t;
+        double nice    = (e[T_NICE]    - s[T_NICE])    / t;
+        double system  = (e[T_KERNEL]  - s[T_KERNEL])  / t;
+        double idle    = (e[T_IDLE]    - s[T_IDLE])    / t;
+        double iowait  = (e[T_IOWAIT]  - s[T_IOWAIT])  / t;
+        double irq     = (e[T_IRQ]     - s[T_IRQ])     / t;
+        double softirq = (e[T_SOFTIRQ] - s[T_SOFTIRQ]) / t;
+        double steal   = (e[T_STEAL]   - s[T_STEAL])   / t;
+
+        view_time('d', "", "l_timer_real",    real);
+        view_time('d', "", "l_timer_user",    user);
+        view_time('d', "", "l_timer_nice",    nice);
+        view_time('d', "", "l_timer_system",  system);
+        view_time('d', "", "l_timer_idle",    idle);
+        view_time('d', "", "l_timer_iowait",  iowait);
+        view_time('d', "", "l_timer_irq",     irq);
+        view_time('d', "", "l_timer_softirq", softirq);
+        view_time('d', "", "l_timer_steal",   steal);
+    }
+
+    view_size('d', "", "l_s_no_bytes", LStat.s.no_bytes);
+    view_long('d', "", "l_s_no_msgs",  LStat.s.no_msgs);
+    view_long('d', "", "l_s_no_errs",  LStat.s.no_errs);
+
+    view_size('d', "", "l_r_no_bytes", LStat.r.no_bytes);
+    view_long('d', "", "l_r_no_msgs",  LStat.r.no_msgs);
+    view_long('d', "", "l_r_no_errs",  LStat.r.no_errs);
+
+    view_size('d', "", "l_rem_s_no_bytes", LStat.rem_s.no_bytes);
+    view_long('d', "", "l_rem_s_no_msgs",  LStat.rem_s.no_msgs);
+    view_long('d', "", "l_rem_s_no_errs",  LStat.rem_s.no_errs);
+
+    view_size('d', "", "l_rem_r_no_bytes", LStat.rem_r.no_bytes);
+    view_long('d', "", "l_rem_r_no_msgs",  LStat.rem_r.no_msgs);
+    view_long('d', "", "l_rem_r_no_errs",  LStat.rem_r.no_errs);
+
+    /* Remote node */
+    view_long('d', "", "r_no_cpus",  RStat.no_cpus);
+    view_long('d', "", "r_no_ticks", RStat.no_ticks);
+    view_long('d', "", "r_max_cqes", RStat.max_cqes);
+
+    if (RStat.no_ticks) {
+        double t = RStat.no_ticks;
+        CLOCK *s = RStat.time_s;
+        CLOCK *e = RStat.time_e;
+
+        double real    = (e[T_REAL]    - s[T_REAL])    / t;
+        double user    = (e[T_USER]    - s[T_USER])    / t;
+        double nice    = (e[T_NICE]    - s[T_NICE])    / t;
+        double system  = (e[T_KERNEL]  - s[T_KERNEL])  / t;
+        double idle    = (e[T_IDLE]    - s[T_IDLE])    / t;
+        double iowait  = (e[T_IOWAIT]  - s[T_IOWAIT])  / t;
+        double irq     = (e[T_IRQ]     - s[T_IRQ])     / t;
+        double softirq = (e[T_SOFTIRQ] - s[T_SOFTIRQ]) / t;
+        double steal   = (e[T_STEAL]   - s[T_STEAL])   / t;
+
+        view_time('d', "", "r_timer_real",    real);
+        view_time('d', "", "r_timer_user",    user);
+        view_time('d', "", "r_timer_nice",    nice);
+        view_time('d', "", "r_timer_system",  system);
+        view_time('d', "", "r_timer_idle",    idle);
+        view_time('d', "", "r_timer_iowait",  iowait);
+        view_time('d', "", "r_timer_irq",     irq);
+        view_time('d', "", "r_timer_softirq", softirq);
+        view_time('d', "", "r_timer_steal",   steal);
+    }
+
+    view_size('d', "", "r_s_no_bytes", RStat.s.no_bytes);
+    view_long('d', "", "r_s_no_msgs",  RStat.s.no_msgs);
+    view_long('d', "", "r_s_no_errs",  RStat.s.no_errs);
+
+    view_size('d', "", "r_r_no_bytes", RStat.r.no_bytes);
+    view_long('d', "", "r_r_no_msgs",  RStat.r.no_msgs);
+    view_long('d', "", "r_r_no_errs",  RStat.r.no_errs);
+
+    view_size('d', "", "r_rem_s_no_bytes", RStat.rem_s.no_bytes);
+    view_long('d', "", "r_rem_s_no_msgs",  RStat.rem_s.no_msgs);
+    view_long('d', "", "r_rem_s_no_errs",  RStat.rem_s.no_errs);
+
+    view_size('d', "", "r_rem_r_no_bytes", RStat.rem_r.no_bytes);
+    view_long('d', "", "r_rem_r_no_msgs",  RStat.rem_r.no_msgs);
+    view_long('d', "", "r_rem_r_no_errs",  RStat.rem_r.no_errs);
+}
+
+
+/*
+ * Show a cost in terms of seconds per gigabyte.
+ */
+static void
+view_cost(int type, char *pref, char *name, double value)
+{
+    int n = 0;
+    char *tab[] ={ "ns/GB", "us/GB", "ms/GB", "sec/GB" };
+
+    value *=  1E9;
+    if (!verbose(type, value))
+        return;
+    if (!UnifyUnits) {
+        while (value >= 1000 && n < (int)cardof(tab)-1) {
+            value /= 1000;
+            ++n;
+        }
+    }
+    place_val(pref, name, tab[n], value);
+}
+
+
+/*
+ * Show the number of cpus.
+ */
+static void
+view_cpus(int type, char *pref, char *name, double value)
+{
+    value *= 100;
+    if (!verbose(type, value))
+        return;
+    place_val(pref, name, "% cpus", value);
+}
+
+
+/*
+ * Show a messaging rate.
+ */
+static void
+view_rate(int type, char *pref, char *name, double value)
+{
+    int n = 0;
+    char *tab[] ={ "/sec", "K/sec", "M/sec", "G/sec", "T/sec" };
+
+    if (!verbose(type, value))
+        return;
+    if (!UnifyUnits) {
+        while (value >= 1000 && n < (int)cardof(tab)-1) {
+            value /= 1000;
+            ++n;
+        }
+    }
+    place_val(pref, name, tab[n], value);
+}
+
+
+/*
+ * Show a number.
+ */
+static void
+view_long(int type, char *pref, char *name, long long value)
+{
+    int n = 0;
+    double val = value;
+    char *tab[] ={ "", "thousand", "million", "billion", "trillion" };
+
+    if (!verbose(type, val))
+        return;
+    if (!UnifyUnits && val >= 1000*1000) {
+        while (val >= 1000 && n < (int)cardof(tab)-1) {
+            val /= 1000;
+            ++n;
+        }
+    }
+    place_val(pref, name, tab[n], val);
+}
+
+
+/*
+ * Show a bandwidth value.
+ */
+static void
+view_band(int type, char *pref, char *name, double value)
+{
+    int n, s;
+    char **tab;
+
+    if (!verbose(type, value))
+        return;
+    if (UseBitsPerSec) {
+        static char *t[] ={ "bits/sec", "Kb/sec", "Mb/sec", "Gb/sec", "Tb/sec" };
+        s = cardof(t);
+        tab = t;
+        value *= 8;
+    } else {
+        static char *t[] ={ "bytes/sec", "KB/sec", "MB/sec", "GB/sec", "TB/sec" };
+        s = cardof(t);
+        tab = t;
+    }
+
+    n = 0;
+    if (!UnifyUnits) {
+        while (value >= 1000 && n < s-1) {
+            value /= 1000;
+            ++n;
+        }
+    }
+    place_val(pref, name, tab[n], value);
+}
+
+
+/*
+ * Show a size.
+ */
+static void
+view_size(int type, char *pref, char *name, long long value)
+{
+    int n = 0;
+    double val = value;
+    char *tab[] ={ "bytes", "KB", "MB", "GB", "TB" };
+
+    if (!verbose(type, val))
+        return;
+    if (!UnifyUnits) {
+        if (nice_1024(pref, name, value))
+            return;
+        while (val >= 1000 && n < (int)cardof(tab)-1) {
+            val /= 1000;
+            ++n;
+        }
+    }
+    place_val(pref, name, tab[n], val);
+}
+
+
+/*
+ * Show a number if it can be expressed as a nice multiple of a power of 1024.
+ */
+static int
+nice_1024(char *pref, char *name, long long value)
+{
+    char *data;
+    char *altn;
+    int n = 0;
+    long long val = value;
+    char *tab[] ={ "KiB", "MiB", "GiB", "TiB" };
+
+    if (val < 1024 || val % 1024)
+        return 0;
+    val /= 1024;
+    while (val >= 1024 && n < (int)cardof(tab)-1) {
+        if (val % 1024)
+            return 0;
+        val /= 1024;
+        ++n;
+    }
+    data = qasprintf("%lld", val);
+    altn = qasprintf("%lld", value);
+    place_any(pref, name, tab[n], commify(data), commify(altn));
+    return 1;
+}
+
+
+/*
+ * Show a string.
+ */
+static void
+view_strn(int type, char *pref, char *name, char *value)
+{
+    if (!verbose(type, value[0] != '\0'))
+        return;
+    place_any(pref, name, 0, strdup(value), 0);
+}
+
+
+/*
+ * Show a time.
+ */
+static void
+view_time(int type, char *pref, char *name, double value)
+{
+    int n = 0;
+    char *tab[] ={ "ns", "us", "ms", "sec" };
+
+    value *= 1E9;
+    if (!verbose(type, value))
+        return;
+    if (!UnifyUnits) {
+        while (value >= 1000 && n < (int)cardof(tab)-1) {
+            value /= 1000;
+            ++n;
+        }
+    }
+    place_val(pref, name, tab[n], value);
+}
+
+
+/*
+ * Determine if we are verbose enough to show a value.
+ */
+static int
+verbose(int type, double value)
+{
+    if (type == 'a')
+        return 1;
+    if (value <= 0)
+        return 0;
+    switch (type) {
+    case 'd': return Debug;
+    case 'c': return VerboseConf >= 1;
+    case 's': return VerboseStat >= 1;
+    case 't': return VerboseTime >= 1;
+    case 'u': return VerboseUsed >= 1;
+    case 'C': return VerboseConf >= 2;
+    case 'S': return VerboseStat >= 2;
+    case 'T': return VerboseTime >= 2;
+    case 'U': return VerboseUsed >= 2;
+    default:  error(BUG, "verbose: bad type: %c (%o)", type, type);
+    }
+    return 0;
+}
+
+
+/*
+ * Place a value to be shown later.
+ */
+static void
+place_val(char *pref, char *name, char *unit, double value)
+{
+    char *data = qasprintf("%.0f", value);
+    char *p    = data;
+    int   n    = Precision;
+
+    if (*p == '-')
+        ++p;
+    while (isdigit(*p++))
+        --n;
+    if (n > 0) {
+        free(data);
+        data = qasprintf("%.*f", n, value);
+        p = &data[strlen(data)];
+        while (p > data && *--p == '0')
+            ;
+        if (p > data && *p == '.')
+            --p;
+        p[1] = '\0';
+    }
+    place_any(pref, name, unit, commify(data), 0);
+}
+
+
+/*
+ * Place an entry in our show table.
+ */
+static void
+place_any(char *pref, char *name, char *unit, char *data, char *altn)
+{
+    SHOW *show = &ShowTable[ShowIndex++];
+
+    if (ShowIndex > cardof(ShowTable))
+        error(BUG, "need to increase size of ShowTable");
+    show->pref = pref;
+    show->name = name;
+    show->unit = unit;
+    show->data = data;
+    show->altn = altn;
+}
+
+
+/*
+ * Show all saved values.
+ */
+static void
+place_show(void)
+{
+    int i;
+    int nameLen = 0;
+    int dataLen = 0;
+    int unitLen = 0;
+
+    /* First compute formating sizes */
+    for (i = 0; i < ShowIndex; ++i) {
+        int n;
+        SHOW *show = &ShowTable[i];
+        n = (show->pref ? strlen(show->pref) : 0) + strlen(show->name);
+        if (n > nameLen)
+            nameLen = n;
+        n = strlen(show->data);
+        if (show->unit) {
+            if (n > dataLen)
+                dataLen = n;
+            n = strlen(show->unit);
+            if (n > unitLen)
+                unitLen = n;
+        }
+    }
+
+    /* Then display results */
+    for (i = 0; i < ShowIndex; ++i) {
+        int n = 0;
+        SHOW *show = &ShowTable[i];
+
+        printf("    ");
+        if (show->pref) {
+            n = strlen(show->pref);
+            printf("%s", show->pref);
+        }
+        printf("%-*s", nameLen-n, show->name);
+        if (show->unit) {
+            printf("  =  %*s", dataLen, show->data);
+            printf(" %s", show->unit);
+        } else
+            printf("  =  %s", show->data);
+        if (show->altn)
+            printf(" (%s)", show->altn);
+        printf("\n");
+        free(show->data);
+        free(show->altn);
+    }
+    ShowIndex = 0;
+}
+
+
+/*
+ * Set the processor affinity.
+ */
+static void
+set_affinity(void)
+{
+    cpu_set_t set;
+    int a = Req.affinity;
+
+    if (!a)
+        return;
+    CPU_ZERO(&set);
+    CPU_SET(a-1, &set);
+    if (sched_setaffinity(0, sizeof(set), &set) < 0)
+        error(SYS, "cannot set processor affinity (cpu %d)", a-1);
+}
+
+
+/*
+ * Encode a REQ structure into a data stream.
+ */
+static void
+enc_req(REQ *host)
+{
+    enc_int(host->ver_maj,       sizeof(host->ver_maj));
+    enc_int(host->ver_min,       sizeof(host->ver_min));
+    enc_int(host->ver_inc,       sizeof(host->ver_inc));
+    enc_int(host->req_index,     sizeof(host->req_index));
+    enc_int(host->access_recv,   sizeof(host->access_recv));
+    enc_int(host->affinity,      sizeof(host->affinity));
+    enc_int(host->alt_port,      sizeof(host->alt_port));
+    enc_int(host->flip,          sizeof(host->flip));
+    enc_int(host->msg_size,      sizeof(host->msg_size));
+    enc_int(host->mtu_size,      sizeof(host->mtu_size));
+    enc_int(host->no_msgs,       sizeof(host->no_msgs));
+    enc_int(host->poll_mode,     sizeof(host->poll_mode));
+    enc_int(host->port,          sizeof(host->port));
+    enc_int(host->rd_atomic,     sizeof(host->rd_atomic));
+    enc_int(host->sl,            sizeof(host->sl));
+    enc_int(host->sock_buf_size, sizeof(host->sock_buf_size));
+    enc_int(host->src_path_bits, sizeof(host->src_path_bits));
+    enc_int(host->time,          sizeof(host->time));
+    enc_int(host->timeout,       sizeof(host->timeout));
+    enc_int(host->use_cm,        sizeof(host->use_cm));
+    enc_str(host->id,            sizeof(host->id));
+    enc_str(host->static_rate,   sizeof(host->static_rate));
+}
+
+
+/*
+ * Decode the version part of a REQ structure from a data stream.  To decode
+ * the entire REQ structure, call dec_req_version and dec_req_data in
+ * succession.
+ */
+static void
+dec_req_version(REQ *host)
+{
+    host->ver_maj       = dec_int(sizeof(host->ver_maj));
+    host->ver_min       = dec_int(sizeof(host->ver_min));
+    host->ver_inc       = dec_int(sizeof(host->ver_inc));
+}
+
+
+/*
+ * Decode the data part of a REQ structure from a data stream.
+ */
+static void
+dec_req_data(REQ *host)
+{
+    host->req_index     = dec_int(sizeof(host->req_index));
+    host->access_recv   = dec_int(sizeof(host->access_recv));
+    host->affinity      = dec_int(sizeof(host->affinity));
+    host->alt_port      = dec_int(sizeof(host->alt_port));
+    host->flip          = dec_int(sizeof(host->flip));
+    host->msg_size      = dec_int(sizeof(host->msg_size));
+    host->mtu_size      = dec_int(sizeof(host->mtu_size));
+    host->no_msgs       = dec_int(sizeof(host->no_msgs));
+    host->poll_mode     = dec_int(sizeof(host->poll_mode));
+    host->port          = dec_int(sizeof(host->port));
+    host->rd_atomic     = dec_int(sizeof(host->rd_atomic));
+    host->sl            = dec_int(sizeof(host->sl));
+    host->sock_buf_size = dec_int(sizeof(host->sock_buf_size));
+    host->src_path_bits = dec_int(sizeof(host->src_path_bits));
+    host->time          = dec_int(sizeof(host->time));
+    host->timeout       = dec_int(sizeof(host->timeout));
+    host->use_cm        = dec_int(sizeof(host->use_cm));
+                          dec_str(host->id, sizeof(host->id));
+                          dec_str(host->static_rate,sizeof(host->static_rate));
+}
+
+
+/*
+ * Encode a STAT structure into a data stream.
+ */
+static void
+enc_stat(STAT *host)
+{
+    int i;
+
+    enc_int(host->no_cpus,  sizeof(host->no_cpus));
+    enc_int(host->no_ticks, sizeof(host->no_ticks));
+    enc_int(host->max_cqes, sizeof(host->max_cqes));
+    for (i = 0; i < T_N; ++i)
+        enc_int(host->time_s[i], sizeof(host->time_s[i]));
+    for (i = 0; i < T_N; ++i)
+        enc_int(host->time_e[i], sizeof(host->time_e[i]));
+    enc_ustat(&host->s);
+    enc_ustat(&host->r);
+    enc_ustat(&host->rem_s);
+    enc_ustat(&host->rem_r);
+}
+
+
+/*
+ * Decode a STAT structure from a data stream.
+ */
+static void
+dec_stat(STAT *host)
+{
+    int i;
+
+    host->no_cpus  = dec_int(sizeof(host->no_cpus));
+    host->no_ticks = dec_int(sizeof(host->no_ticks));
+    host->max_cqes = dec_int(sizeof(host->max_cqes));
+    for (i = 0; i < T_N; ++i)
+        host->time_s[i] = dec_int(sizeof(host->time_s[i]));
+    for (i = 0; i < T_N; ++i)
+        host->time_e[i] = dec_int(sizeof(host->time_e[i]));
+    dec_ustat(&host->s);
+    dec_ustat(&host->r);
+    dec_ustat(&host->rem_s);
+    dec_ustat(&host->rem_r);
+}
+
+
+/*
+ * Encode a USTAT structure into a data stream.
+ */
+static void
+enc_ustat(USTAT *host)
+{
+    enc_int(host->no_bytes, sizeof(host->no_bytes));
+    enc_int(host->no_msgs,  sizeof(host->no_msgs));
+    enc_int(host->no_errs,  sizeof(host->no_errs));
+}
+
+
+/*
+ * Decode a USTAT structure from a data stream.
+ */
+static void
+dec_ustat(USTAT *host)
+{
+    host->no_bytes = dec_int(sizeof(host->no_bytes));
+    host->no_msgs  = dec_int(sizeof(host->no_msgs));
+    host->no_errs  = dec_int(sizeof(host->no_errs));
+}
+
+
+/*
+ * Get various temporal parameters.
+ */
+static void
+get_times(CLOCK timex[T_N])
+{
+    int n;
+    char *p;
+    char buf[BUFSIZE];
+    struct tms tms;
+
+    timex[0] = times(&tms);
+    if (lseek(ProcStatFD, 0, 0) < 0)
+        error(SYS, "failed to seek /proc/stat");
+    n = read(ProcStatFD, buf, sizeof(buf)-1);
+    buf[n] = '\0';
+    if (strncmp(buf, "cpu ", 4))
+        error(0, "/proc/stat does not start with 'cpu '");
+    p = &buf[3];
+    for (n = 1; n < T_N; ++n) {
+        while (*p == ' ')
+            ++p;
+        if (!isdigit(*p)) {
+            if (*p != '\n' || n < T_N-1)
+                error(0, "/proc/stat has bad format");
+            break;
+        }
+        timex[n] = strtoll(p, 0, 10);
+        while (*p != ' ' && *p != '\n' && *p != '\0')
+            ++p;
+    }
+    while (n < T_N)
+        timex[n++] = 0;
+}
+
+
+/*
+ * Insert commas within a number for readability.
+ */
+static char *
+commify(char *data)
+{
+    int s;
+    int d;
+    int seqS;
+    int seqE;
+    int dataLen;
+    int noCommas;
+
+    if (!data)
+        return data;
+    if (UnifyUnits)
+        return data;
+    dataLen = strlen(data);
+    seqS = seqE = dataLen;
+    while (--seqS >= 0)
+        if (!isdigit(data[seqS]))
+            break;
+    if (seqS >= 0 && data[seqS] == '.') {
+        seqE = seqS;
+        while (--seqS >= 0)
+            if (!isdigit(data[seqS]))
+                break;
+    }
+    noCommas = (--seqE - ++seqS) / 3;
+    if (noCommas == 0)
+        return data;
+    data = realloc(data, dataLen+noCommas+1);
+    if (!data)
+        error(0, "out of space");
+    s = dataLen;
+    d = dataLen + noCommas;
+    for (;;) {
+        int n;
+        data[d--] = data[s--];
+        n = seqE - s;
+        if (n > 0 && n%3 == 0) {
+            data[d--] = ',';
+            if (--noCommas == 0)
+                break;
+        }
+    }
+    return data;
+}
+
+
+/*
+ * Like strncpy but ensures the destination is null terminated.
+ */
+static void
+strncopy(char *d, char *s, int n)
+{
+    strncpy(d, s, n);
+    d[n-1] = '\0';
+}
diff --git a/src/qperf.h b/src/qperf.h
new file mode 100644
index 0000000..95613e3
--- /dev/null
+++ b/src/qperf.h
@@ -0,0 +1,373 @@
+/*
+ * qperf - general header file.
+ *
+ * Copyright (c) 2002-2009 Johann George.  All rights reserved.
+ * Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#define _GNU_SOURCE
+#include <netdb.h>
+
+
+/*
+ * Parameters.
+ */
+#define STRSIZE 64
+
+
+/*
+ * For convenience and readability.
+ */
+#define SUCCESS0        0
+#define cardof(a)       (sizeof(a)/sizeof(*a))
+#define endof(a)        (&a[cardof(a)])
+#define streq(a, b)     (strcmp(a, b) == 0)
+#define offset(t, e)    ((long)&((t *)0)->e)
+#define is_client()     (ServerName != 0)
+#define is_sender()     (Req.flip ? !is_client() : is_client())
+
+
+/*
+ * Type definitions.
+ */
+typedef uint64_t CLOCK;
+typedef struct addrinfo AI;
+typedef struct sockaddr SA;
+typedef struct sockaddr_storage SS;
+
+
+/*
+ * Error actions.
+ */
+#define BUG 1                           /* Internal error */
+#define SYS 2                           /* System error */
+#define RET 4                           /* Return, don't exit */
+
+
+/*
+ * Time indices.
+ */
+typedef enum {
+    T_REAL,
+    T_USER,
+    T_NICE,
+    T_KERNEL,
+    T_IDLE,
+    T_IOWAIT,
+    T_IRQ,
+    T_SOFTIRQ,
+    T_STEAL,
+    T_N
+} TIME_INDEX;
+
+
+/*
+ * Parameter indices.  P_NULL must be 0.
+ */
+typedef enum {
+    P_NULL,
+    L_ACCESS_RECV,
+    R_ACCESS_RECV,
+    L_AFFINITY,
+    R_AFFINITY,
+    L_ALT_PORT,
+    R_ALT_PORT,
+    L_FLIP,
+    R_FLIP,
+    L_ID,
+    R_ID,
+    L_MSG_SIZE,
+    R_MSG_SIZE,
+    L_MTU_SIZE,
+    R_MTU_SIZE,
+    L_NO_MSGS,
+    R_NO_MSGS,
+    L_POLL_MODE,
+    R_POLL_MODE,
+    L_PORT,
+    R_PORT,
+    L_RD_ATOMIC,
+    R_RD_ATOMIC,
+    L_SL,
+    R_SL,
+    L_SOCK_BUF_SIZE,
+    R_SOCK_BUF_SIZE,
+    L_SRC_PATH_BITS,
+    R_SRC_PATH_BITS,
+    L_STATIC_RATE,
+    R_STATIC_RATE,
+    L_TIME,
+    R_TIME,
+    L_TIMEOUT,
+    R_TIMEOUT,
+    L_USE_CM,
+    R_USE_CM,
+    P_N
+} PAR_INDEX;
+
+
+/*
+ * What we are measuring.
+ */
+typedef enum {
+    LATENCY,
+    MSG_RATE,
+    BANDWIDTH,
+    BANDWIDTH_SR
+} MEASURE;
+
+
+/*
+ * Request to the server.  Note that most of these must be of type uint32_t
+ * because of the way options are set.  The minor version must be changed if
+ * there is a change to this data structure.  Do not move or change the first
+ * four elements.
+ */
+typedef struct REQ {
+    uint16_t    ver_maj;                /* Major version */
+    uint16_t    ver_min;                /* Minor version */
+    uint16_t    ver_inc;                /* Incremental version */
+    uint16_t    req_index;              /* Request index (into Tests) */
+    uint32_t    access_recv;            /* Access data after receiving */
+    uint32_t    affinity;               /* Processor affinity */
+    uint32_t    alt_port;               /* Alternate path port number */
+    uint32_t    flip;                   /* Flip sender/receiver */
+    uint32_t    msg_size;               /* Message Size */
+    uint32_t    mtu_size;               /* MTU Size */
+    uint32_t    no_msgs;                /* Number of messages */
+    uint32_t    poll_mode;              /* Poll mode */
+    uint32_t    port;                   /* Port number requested */
+    uint32_t    rd_atomic;              /* Number of pending RDMA or atomics */
+    uint32_t    sl;                     /* Service level */
+    uint32_t    sock_buf_size;          /* Socket buffer size */
+    uint32_t    src_path_bits;          /* Source path bits */
+    uint32_t    time;                   /* Duration in seconds */
+    uint32_t    timeout;                /* Timeout for messages */
+    uint32_t    use_cm;                 /* Use Connection Manager */
+    char        id[STRSIZE];            /* Identifier */
+    char        static_rate[STRSIZE];   /* Static rate */
+} REQ;
+
+
+/*
+ * Transfer statistics.
+ */
+typedef struct USTAT {
+    uint64_t    no_bytes;               /* Number of bytes transfered */
+    uint64_t    no_msgs;                /* Number of messages */
+    uint64_t    no_errs;                /* Number of errors */
+} USTAT;
+
+
+/*
+ * Statistics.
+ */
+typedef struct STAT {
+    uint32_t    no_cpus;                /* Number of processors */
+    uint32_t    no_ticks;               /* Ticks per second */
+    uint32_t    max_cqes;               /* Maximum CQ entries */
+    CLOCK       time_s[T_N];            /* Start times */
+    CLOCK       time_e[T_N];            /* End times */
+    USTAT       s;                      /* Send statistics */
+    USTAT       r;                      /* Receive statistics */
+    USTAT       rem_s;                  /* Remote send statistics */
+    USTAT       rem_r;                  /* Remote receive statistics */
+} STAT;
+
+
+/*
+ * Results per node.
+ */
+typedef struct RESN {
+    double      time_real;              /* Real (elapsed) time in seconds */
+    double      time_cpu;               /* Cpu time in seconds */
+    double      cpu_total;              /* Cpu time (as a fraction of a cpu) */
+    double      cpu_user;               /* User time (fraction of cpu) */
+    double      cpu_intr;               /* Interrupt time (fraction of cpu) */
+    double      cpu_idle;               /* Idle time (fraction of cpu) */
+    double      cpu_kernel;             /* Kernel time (fraction of cpu) */
+    double      cpu_io_wait;            /* IO wait time (fraction of cpu) */
+} RESN;
+
+
+/*
+ * Results.
+ */
+typedef struct RES {
+    RESN        l;                      /* Local information */
+    RESN        r;                      /* Remote information */
+    double      send_bw;                /* Send bandwidth */
+    double      recv_bw;                /* Receive bandwidth */
+    double      msg_rate;               /* Messaging rate */
+    double      send_cost;              /* Send cost */
+    double      recv_cost;              /* Receive cost */
+    double      latency;                /* Latency */
+} RES;
+
+
+/*
+ * Functions prototypes in qperf.c.
+ */
+void        client_send_request(void);
+void        exchange_results(void);
+int         left_to_send(long *sentp, int room);
+void        opt_check(void);
+void        par_use(PAR_INDEX index);
+int         recv_mesg(void *ptr, int len, char *item);
+int         send_mesg(void *ptr, int len, char *item);
+void        set_finished(void);
+void        setp_u32(char *name, PAR_INDEX index, uint32_t l);
+void        setp_str(char *name, PAR_INDEX index, char *s);
+void        setv_u32(PAR_INDEX index, uint32_t l);
+void        show_results(MEASURE measure);
+void        stop_test_timer(void);
+void        sync_test(void);
+
+
+/*
+ * Functions prototypes in support.c.
+ */
+void        check_remote_error(void);
+void        debug(char *fmt, ...);
+void        dec_init(void *p);
+int64_t     dec_int(int n);
+void        dec_str(char *s, int  n);
+uint32_t    decode_uint32(uint32_t *p);
+void        die(void);
+void        enc_init(void *p);
+void        enc_int(int64_t l, int n);
+void        enc_str(char *s, int n);
+void        encode_uint32(uint32_t *p, uint32_t v);
+int         error(int actions, char *fmt, ...);
+AI         *getaddrinfo_port(char *node, int port, AI *hints);
+char       *qasprintf(char *fmt, ...);
+void       *qmalloc(long n);
+void        recv_sync(char *msg);
+void        send_sync(char *msg);
+void        setsockopt_one(int fd, int optname);
+void        synchronize(char *msg);
+void        touch_data(void *p, int n);
+void        urgent(void);
+
+
+/*
+ * Socket tests in socket.c.
+ */
+void    run_client_rds_bw(void);
+void    run_server_rds_bw(void);
+void    run_client_rds_lat(void);
+void    run_server_rds_lat(void);
+void    run_client_sctp_bw(void);
+void    run_server_sctp_bw(void);
+void    run_client_sctp_lat(void);
+void    run_server_sctp_lat(void);
+void    run_client_sdp_bw(void);
+void    run_server_sdp_bw(void);
+void    run_client_sdp_lat(void);
+void    run_server_sdp_lat(void);
+void    run_client_tcp_bw(void);
+void    run_server_tcp_bw(void);
+void    run_client_tcp_lat(void);
+void    run_server_tcp_lat(void);
+void    run_client_udp_bw(void);
+void    run_server_udp_bw(void);
+void    run_client_udp_lat(void);
+void    run_server_udp_lat(void);
+
+
+/*
+ * RDMA tests in rdma.c.
+ */
+void    run_client_bug(void);
+void    run_server_bug(void);
+void    run_client_rc_bi_bw(void);
+void    run_server_rc_bi_bw(void);
+void    run_client_rc_bw(void);
+void    run_server_rc_bw(void);
+void    run_client_rc_compare_swap_mr(void);
+void    run_server_rc_compare_swap_mr(void);
+void    run_client_rc_fetch_add_mr(void);
+void    run_server_rc_fetch_add_mr(void);
+void    run_client_rc_lat(void);
+void    run_server_rc_lat(void);
+void    run_client_rc_rdma_read_bw(void);
+void    run_server_rc_rdma_read_bw(void);
+void    run_client_rc_rdma_read_lat(void);
+void    run_server_rc_rdma_read_lat(void);
+void    run_client_rc_rdma_write_bw(void);
+void    run_server_rc_rdma_write_bw(void);
+void    run_client_rc_rdma_write_lat(void);
+void    run_server_rc_rdma_write_lat(void);
+void    run_client_rc_rdma_write_poll_lat(void);
+void    run_server_rc_rdma_write_poll_lat(void);
+void    run_client_uc_bi_bw(void);
+void    run_server_uc_bi_bw(void);
+void    run_client_uc_bw(void);
+void    run_server_uc_bw(void);
+void    run_client_uc_lat(void);
+void    run_server_uc_lat(void);
+void    run_client_uc_rdma_write_bw(void);
+void    run_server_uc_rdma_write_bw(void);
+void    run_client_uc_rdma_write_lat(void);
+void    run_server_uc_rdma_write_lat(void);
+void    run_client_uc_rdma_write_poll_lat(void);
+void    run_server_uc_rdma_write_poll_lat(void);
+void    run_client_ud_bi_bw(void);
+void    run_server_ud_bi_bw(void);
+void    run_client_ud_bw(void);
+void    run_server_ud_bw(void);
+void    run_client_ud_lat(void);
+void    run_server_ud_lat(void);
+void    run_client_ver_rc_compare_swap(void);
+void    run_server_ver_rc_compare_swap(void);
+void    run_client_ver_rc_fetch_add(void);
+void    run_server_ver_rc_fetch_add(void);
+void    run_client_xrc_bi_bw(void);
+void    run_server_xrc_bi_bw(void);
+void    run_client_xrc_bw(void);
+void    run_server_xrc_bw(void);
+void    run_client_xrc_lat(void);
+void    run_server_xrc_lat(void);
+
+
+/*
+ * Variables.
+ */
+extern RES          Res;
+extern REQ          Req;
+extern STAT         LStat;
+extern char        *Usage[];
+extern char        *TestName;
+extern char        *ServerName;
+extern SS           ServerAddr;
+extern int          ServerAddrLen;
+extern int          RemoteFD;
+extern int          Debug;
+extern volatile int Finished;
diff --git a/src/rdma.c b/src/rdma.c
new file mode 100644
index 0000000..0d370bd
--- /dev/null
+++ b/src/rdma.c
@@ -0,0 +1,2617 @@
+/*
+ * qperf - handle RDMA tests.
+ *
+ * Copyright (c) 2002-2009 Johann George.  All rights reserved.
+ * Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#define _GNU_SOURCE
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <rdma/rdma_cma.h>
+#include <infiniband/verbs.h>
+#include "qperf.h"
+
+
+/*
+ * RDMA parameters.
+ */
+#define QKEY                0x11111111  /* Q_Key */
+#define NCQE                1024        /* Number of CQ entries */
+#define GRH_SIZE            40          /* InfiniBand GRH size */
+#define MTU_SIZE            2048        /* Default MTU Size */
+#define RETRY_CNT           7           /* RC retry count */
+#define RNR_RETRY_CNT       7           /* RC RNR retry count */
+#define MIN_RNR_TIMER       12          /* RC Minimum RNR timer */
+#define LOCAL_ACK_TIMEOUT   14          /* RC local ACK timeout */
+
+
+/*
+ * Work request IDs.
+ */
+#define WRID_SEND   1                   /* Send */
+#define WRID_RECV   2                   /* Receive */
+#define WRID_RDMA   3                   /* RDMA */
+
+
+/*
+ * Constants.
+ */
+#define K2      (2*1024)
+#define K64     (64*1024)
+
+
+/*
+ * For convenience.
+ */
+typedef enum ibv_wr_opcode ibv_op;
+typedef struct ibv_comp_channel ibv_cc;
+typedef struct ibv_xrc_domain ibv_xrc;
+
+
+/*
+ * Atomic operations.
+ */
+typedef enum ATOMIC {
+    COMPARE_SWAP,
+    FETCH_ADD
+} ATOMIC;
+
+
+/*
+ * IO Mode.
+ */
+typedef enum IOMODE {
+    IO_SR,                              /* Send/Receive */
+    IO_RDMA                             /* RDMA */
+} IOMODE;
+
+
+/*
+ * Information specific to a node.
+ */
+typedef struct NODE {
+    uint64_t    vaddr;                  /* Virtual address */
+    uint32_t    lid;                    /* Local ID */
+    uint32_t    qpn;                    /* Queue pair number */
+    uint32_t    psn;                    /* Packet sequence number */
+    uint32_t    srqn;                   /* Shared queue number */
+    uint32_t    rkey;                   /* Remote key */
+    uint32_t    alt_lid;                /* Alternate Path Local LID */
+    uint32_t    rd_atomic;              /* Number of read/atomics supported */
+} NODE;
+
+
+/*
+ * InfiniBand specific information.
+ */
+typedef struct IBINFO {
+    int                 mtu;            /* MTU */
+    int                 port;           /* Port */
+    int                 rate;           /* Static rate */
+    struct ibv_context *context;        /* Context */
+    struct ibv_device **devlist;        /* Device list */
+} IBINFO;
+
+
+/*
+ * Connection Manager specific information.
+ */
+typedef struct CMINFO {
+    struct rdma_event_channel *channel; /* Channel */
+    struct rdma_cm_id         *id;      /* RDMA id */
+    struct rdma_cm_event      *event;   /* Event */
+} CMINFO;
+
+
+/*
+ * RDMA device descriptor.
+ */
+typedef struct DEVICE {
+    NODE             lnode;             /* Local node information */
+    NODE             rnode;             /* Remote node information */
+    IBINFO           ib;                /* InfiniBand information */
+    CMINFO           cm;                /* Connection Manager information */
+    uint32_t         qkey;              /* Q Key for UD */
+    int              trans;             /* QP transport */
+    int              msg_size;          /* Message size */
+    int              buf_size;          /* Buffer size */
+    int              max_send_wr;       /* Maximum send work requests */
+    int              max_recv_wr;       /* Maximum receive work requests */
+    int              max_inline;        /* Maximum amount of inline data */
+    char            *buffer;            /* Buffer */
+    ibv_cc          *channel;           /* Channel */
+    struct ibv_pd   *pd;                /* Protection domain */
+    struct ibv_mr   *mr;                /* Memory region */
+    struct ibv_cq   *cq;                /* Completion queue */
+    struct ibv_qp   *qp;                /* Queue Pair */
+    struct ibv_ah   *ah;                /* Address handle */
+    struct ibv_srq  *srq;               /* Shared receive queue */
+    ibv_xrc         *xrc;               /* XRC domain */
+} DEVICE;
+
+
+/*
+ * Names associated with a value.
+ */
+typedef struct NAMES {
+    int     value;                       /* Value */
+    char    *name;                       /* Name */
+} NAMES;
+
+
+/*
+ * RDMA speeds and names.
+ */
+typedef struct RATES {
+    const char *name;                   /* Name */
+    uint32_t    rate;                   /* Rate */
+} RATES;
+
+
+/*
+ * Function prototypes.
+ */
+static void     atomic_seq(ATOMIC atomic, int i,
+                                            uint64_t *value, uint64_t *args);
+static void     cm_ack_event(DEVICE *dev);
+static void     cm_close(DEVICE *dev);
+static char    *cm_event_name(int event, char *data, int size);
+static void     cm_expect_event(DEVICE *dev, int expected);
+static void     cm_init(DEVICE *dev);
+static void     cm_open(DEVICE *dev);
+static void     cm_open_client(DEVICE *dev);
+static void     cm_open_server(DEVICE *dev);
+static void     cm_prep(DEVICE *dev);
+static void     cq_error(int status);
+static void     dec_node(NODE *host);
+static void     do_error(int status, uint64_t *errors);
+static void     enc_node(NODE *host);
+static void     ib_client_atomic(ATOMIC atomic);
+static void     ib_client_verify_atomic(ATOMIC atomic);
+static void     ib_close1(DEVICE *dev);
+static void     ib_close2(DEVICE *dev);
+static void     ib_migrate(DEVICE *dev);
+static void     ib_open(DEVICE *dev);
+static void     ib_post_atomic(DEVICE *dev, ATOMIC atomic, int wrid,
+                            int offset, uint64_t compare_add, uint64_t swap);
+static void     ib_prep(DEVICE *dev);
+static void     rd_bi_bw(int transport);
+static void     rd_client_bw(int transport);
+static void     rd_client_rdma_bw(int transport, ibv_op opcode);
+static void     rd_client_rdma_read_lat(int transport);
+static void     rd_close(DEVICE *dev);
+static void     rd_mralloc(DEVICE *dev, int size);
+static void     rd_mrfree(DEVICE *dev);
+static void     rd_open(DEVICE *dev, int trans, int max_send_wr, int max_recv_wr);
+static void     rd_params(int transport, long msg_size, int poll, int atomic);
+static int      rd_poll(DEVICE *dev, struct ibv_wc *wc, int nwc);
+static void     rd_post_rdma_std(DEVICE *dev, ibv_op opcode, int n);
+static void     rd_post_recv_std(DEVICE *dev, int n);
+static void     rd_post_send(DEVICE *dev, int off, int len,
+                                                int inc, int rep, int stat);
+static void     rd_post_send_std(DEVICE *dev, int n);
+static void     rd_pp_lat(int transport, IOMODE iomode);
+static void     rd_pp_lat_loop(DEVICE *dev, IOMODE iomode);
+static void     rd_prep(DEVICE *dev, int size);
+static void     rd_rdma_write_poll_lat(int transport);
+static void     rd_server_def(int transport);
+static void     rd_server_nop(int transport, int size);
+static int      maybe(int val, char *msg);
+static char    *opcode_name(int opcode);
+static void     show_node_info(DEVICE *dev);
+
+
+/*
+ * List of errors we can get from a CQE.
+ */
+NAMES CQErrors[] ={
+    { IBV_WC_SUCCESS,                   "Success"                       },
+    { IBV_WC_LOC_LEN_ERR,               "Local length error"            },
+    { IBV_WC_LOC_QP_OP_ERR,             "Local QP operation failure"    },
+    { IBV_WC_LOC_EEC_OP_ERR,            "Local EEC operation failure"   },
+    { IBV_WC_LOC_PROT_ERR,              "Local protection error"        },
+    { IBV_WC_WR_FLUSH_ERR,              "WR flush failure"              },
+    { IBV_WC_MW_BIND_ERR,               "Memory window bind failure"    },
+    { IBV_WC_BAD_RESP_ERR,              "Bad response"                  },
+    { IBV_WC_LOC_ACCESS_ERR,            "Local access failure"          },
+    { IBV_WC_REM_INV_REQ_ERR,           "Remote invalid request"        },
+    { IBV_WC_REM_ACCESS_ERR,            "Remote access failure"         },
+    { IBV_WC_REM_OP_ERR,                "Remote operation failure"      },
+    { IBV_WC_RETRY_EXC_ERR,             "Retries exceeded"              },
+    { IBV_WC_RNR_RETRY_EXC_ERR,         "RNR retry exceeded"            },
+    { IBV_WC_LOC_RDD_VIOL_ERR,          "Local RDD violation"           },
+    { IBV_WC_REM_INV_RD_REQ_ERR,        "Remote invalid read request"   },
+    { IBV_WC_REM_ABORT_ERR,             "Remote abort"                  },
+    { IBV_WC_INV_EECN_ERR,              "Invalid EECN"                  },
+    { IBV_WC_INV_EEC_STATE_ERR,         "Invalid EEC state"             },
+    { IBV_WC_FATAL_ERR,                 "Fatal error"                   },
+    { IBV_WC_RESP_TIMEOUT_ERR,          "Responder timeout"             },
+    { IBV_WC_GENERAL_ERR,               "General error"                 },
+};
+
+
+/*
+ * Opcodes.
+ */
+NAMES Opcodes[] ={
+    { IBV_WR_ATOMIC_CMP_AND_SWP,        "compare and swap"              },
+    { IBV_WR_ATOMIC_FETCH_AND_ADD,      "fetch and add"                 },
+    { IBV_WR_RDMA_READ,                 "rdma read"                     },
+    { IBV_WR_RDMA_WRITE,                "rdma write"                    },
+    { IBV_WR_RDMA_WRITE_WITH_IMM,       "rdma write with immediate"     },
+    { IBV_WR_SEND,                      "send"                          },
+    { IBV_WR_SEND_WITH_IMM,             "send with immediate"           },
+};
+
+
+/*
+ * Events from the Connection Manager.
+ */
+NAMES CMEvents[] ={
+    { RDMA_CM_EVENT_ADDR_RESOLVED,      "Address resolved"              },
+    { RDMA_CM_EVENT_ADDR_ERROR,         "Address error"                 },
+    { RDMA_CM_EVENT_ROUTE_RESOLVED,     "Route resolved"                },
+    { RDMA_CM_EVENT_ROUTE_ERROR,        "Route error"                   },
+    { RDMA_CM_EVENT_CONNECT_REQUEST,    "Connect request"               },
+    { RDMA_CM_EVENT_CONNECT_RESPONSE,   "Connect response"              },
+    { RDMA_CM_EVENT_CONNECT_ERROR,      "Connect error"                 },
+    { RDMA_CM_EVENT_UNREACHABLE,        "Event unreachable"             },
+    { RDMA_CM_EVENT_REJECTED,           "Event rejected"                },
+    { RDMA_CM_EVENT_ESTABLISHED,        "Event established"             },
+    { RDMA_CM_EVENT_DISCONNECTED,       "Event disconnected"            },
+    { RDMA_CM_EVENT_DEVICE_REMOVAL,     "Device removal"                },
+    { RDMA_CM_EVENT_MULTICAST_JOIN,     "Multicast join"                },
+    { RDMA_CM_EVENT_MULTICAST_ERROR,    "Multicast error"               },
+};
+
+
+/*
+ * Opcodes.
+ */
+RATES Rates[] ={
+    { "",       IBV_RATE_MAX        },
+    { "max",    IBV_RATE_MAX        },
+    { "1xSDR",  IBV_RATE_2_5_GBPS   },
+    { "1xDDR",  IBV_RATE_5_GBPS     },
+    { "1xQDR",  IBV_RATE_10_GBPS    },
+    { "4xSDR",  IBV_RATE_10_GBPS    },
+    { "4xDDR",  IBV_RATE_20_GBPS    },
+    { "4xQDR",  IBV_RATE_40_GBPS    },
+    { "8xSDR",  IBV_RATE_20_GBPS    },
+    { "8xDDR",  IBV_RATE_40_GBPS    },
+    { "8xQDR",  IBV_RATE_80_GBPS    },
+    { "2.5",    IBV_RATE_2_5_GBPS   },
+    { "5",      IBV_RATE_5_GBPS     },
+    { "10",     IBV_RATE_10_GBPS    },
+    { "20",     IBV_RATE_20_GBPS    },
+    { "30",     IBV_RATE_30_GBPS    },
+    { "40",     IBV_RATE_40_GBPS    },
+    { "60",     IBV_RATE_60_GBPS    },
+    { "80",     IBV_RATE_80_GBPS    },
+    { "120",    IBV_RATE_120_GBPS   },
+};
+
+
+/*
+ * This routine is never called and is solely to avoid compiler warnings for
+ * functions that are not currently being used.
+ */
+void
+rdma_not_called(void)
+{
+    if (0)
+        ib_migrate(NULL);
+}
+
+
+/*
+ * Measure RC bi-directional bandwidth (client side).
+ */
+void
+run_client_rc_bi_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    rd_params(IBV_QPT_RC, K64, 1, 0);
+    rd_bi_bw(IBV_QPT_RC);
+    show_results(BANDWIDTH);
+}
+
+
+/*
+ * Measure RC bi-directional bandwidth (server side).
+ */
+void
+run_server_rc_bi_bw(void)
+{
+    rd_bi_bw(IBV_QPT_RC);
+}
+
+
+/*
+ * Measure RC bandwidth (client side).
+ */
+void
+run_client_rc_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    par_use(L_NO_MSGS);
+    par_use(R_NO_MSGS);
+    rd_params(IBV_QPT_RC, K64, 1, 0);
+    rd_client_bw(IBV_QPT_RC);
+    show_results(BANDWIDTH);
+}
+
+
+/*
+ * Measure RC bandwidth (server side).
+ */
+void
+run_server_rc_bw(void)
+{
+    rd_server_def(IBV_QPT_RC);
+}
+
+
+/*
+ * Measure RC compare and swap messaging rate (client side).
+ */
+void
+run_client_rc_compare_swap_mr(void)
+{
+    ib_client_atomic(COMPARE_SWAP);
+}
+
+
+/*
+ * Measure RC compare and swap messaging rate (server side).
+ */
+void
+run_server_rc_compare_swap_mr(void)
+{
+    rd_server_nop(IBV_QPT_RC, sizeof(uint64_t));
+}
+
+
+/*
+ * Measure RC fetch and add messaging rate (client side).
+ */
+void
+run_client_rc_fetch_add_mr(void)
+{
+    ib_client_atomic(FETCH_ADD);
+}
+
+
+/*
+ * Measure RC fetch and add messaging rate (server side).
+ */
+void
+run_server_rc_fetch_add_mr(void)
+{
+    rd_server_nop(IBV_QPT_RC, sizeof(uint64_t));
+}
+
+
+/*
+ * Measure RC latency (client side).
+ */
+void
+run_client_rc_lat(void)
+{
+    rd_params(IBV_QPT_RC, 1, 1, 0);
+    rd_pp_lat(IBV_QPT_RC, IO_SR);
+}
+
+
+/*
+ * Measure RC latency (server side).
+ */
+void
+run_server_rc_lat(void)
+{
+    rd_pp_lat(IBV_QPT_RC, IO_SR);
+}
+
+
+/*
+ * Measure RC RDMA read bandwidth (client side).
+ */
+void
+run_client_rc_rdma_read_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    par_use(L_RD_ATOMIC);
+    par_use(R_RD_ATOMIC);
+    rd_params(IBV_QPT_RC, K64, 1, 0);
+    rd_client_rdma_bw(IBV_QPT_RC, IBV_WR_RDMA_READ);
+    show_results(BANDWIDTH);
+}
+
+
+/*
+ * Measure RC RDMA read bandwidth (server side).
+ */
+void
+run_server_rc_rdma_read_bw(void)
+{
+    rd_server_nop(IBV_QPT_RC, 0);
+}
+
+
+/*
+ * Measure RC RDMA read latency (client side).
+ */
+void
+run_client_rc_rdma_read_lat(void)
+{
+    rd_params(IBV_QPT_RC, 1, 1, 0);
+    rd_client_rdma_read_lat(IBV_QPT_RC);
+}
+
+
+/*
+ * Measure RC RDMA read latency (server side).
+ */
+void
+run_server_rc_rdma_read_lat(void)
+{
+    rd_server_nop(IBV_QPT_RC, 0);
+}
+
+
+/*
+ * Measure RC RDMA write bandwidth (client side).
+ */
+void
+run_client_rc_rdma_write_bw(void)
+{
+    rd_params(IBV_QPT_RC, K64, 1, 0);
+    rd_client_rdma_bw(IBV_QPT_RC, IBV_WR_RDMA_WRITE_WITH_IMM);
+    show_results(BANDWIDTH);
+}
+
+
+/*
+ * Measure RC RDMA write bandwidth (server side).
+ */
+void
+run_server_rc_rdma_write_bw(void)
+{
+    rd_server_def(IBV_QPT_RC);
+}
+
+
+/*
+ * Measure RC RDMA write latency (client side).
+ */
+void
+run_client_rc_rdma_write_lat(void)
+{
+    rd_params(IBV_QPT_RC, 1, 1, 0);
+    rd_pp_lat(IBV_QPT_RC, IO_RDMA);
+}
+
+
+/*
+ * Measure RC RDMA write latency (server side).
+ */
+void
+run_server_rc_rdma_write_lat(void)
+{
+    rd_pp_lat(IBV_QPT_RC, IO_RDMA);
+}
+
+
+/*
+ * Measure RC RDMA write polling latency (client side).
+ */
+void
+run_client_rc_rdma_write_poll_lat(void)
+{
+    rd_params(IBV_QPT_RC, 1, 0, 0);
+    rd_rdma_write_poll_lat(IBV_QPT_RC);
+    show_results(LATENCY);
+}
+
+
+/*
+ * Measure RC RDMA write polling latency (server side).
+ */
+void
+run_server_rc_rdma_write_poll_lat(void)
+{
+    rd_rdma_write_poll_lat(IBV_QPT_RC);
+}
+
+
+/*
+ * Measure UC bi-directional bandwidth (client side).
+ */
+void
+run_client_uc_bi_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    rd_params(IBV_QPT_UC, K64, 1, 0);
+    rd_bi_bw(IBV_QPT_UC);
+    show_results(BANDWIDTH_SR);
+}
+
+
+/*
+ * Measure UC bi-directional bandwidth (server side).
+ */
+void
+run_server_uc_bi_bw(void)
+{
+    rd_bi_bw(IBV_QPT_UC);
+}
+
+
+/*
+ * Measure UC bandwidth (client side).
+ */
+void
+run_client_uc_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    par_use(L_NO_MSGS);
+    par_use(R_NO_MSGS);
+    rd_params(IBV_QPT_UC, K64, 1, 0);
+    rd_client_bw(IBV_QPT_UC);
+    show_results(BANDWIDTH_SR);
+}
+
+
+/*
+ * Measure UC bandwidth (server side).
+ */
+void
+run_server_uc_bw(void)
+{
+    rd_server_def(IBV_QPT_UC);
+}
+
+
+/*
+ * Measure UC latency (client side).
+ */
+void
+run_client_uc_lat(void)
+{
+    rd_params(IBV_QPT_UC, 1, 1, 0);
+    rd_pp_lat(IBV_QPT_UC, IO_SR);
+}
+
+
+/*
+ * Measure UC latency (server side).
+ */
+void
+run_server_uc_lat(void)
+{
+    rd_pp_lat(IBV_QPT_UC, IO_SR);
+}
+
+
+/*
+ * Measure UC RDMA write bandwidth (client side).
+ */
+void
+run_client_uc_rdma_write_bw(void)
+{
+    rd_params(IBV_QPT_UC, K64, 1, 0);
+    rd_client_rdma_bw(IBV_QPT_UC, IBV_WR_RDMA_WRITE_WITH_IMM);
+    show_results(BANDWIDTH_SR);
+}
+
+
+/*
+ * Measure UC RDMA write bandwidth (server side).
+ */
+void
+run_server_uc_rdma_write_bw(void)
+{
+    rd_server_def(IBV_QPT_UC);
+}
+
+
+/*
+ * Measure UC RDMA write latency (client side).
+ */
+void
+run_client_uc_rdma_write_lat(void)
+{
+    rd_params(IBV_QPT_UC, 1, 1, 0);
+    rd_pp_lat(IBV_QPT_UC, IO_RDMA);
+}
+
+
+/*
+ * Measure UC RDMA write latency (server side).
+ */
+void
+run_server_uc_rdma_write_lat(void)
+{
+    rd_pp_lat(IBV_QPT_UC, IO_RDMA);
+}
+
+
+/*
+ * Measure UC RDMA write polling latency (client side).
+ */
+void
+run_client_uc_rdma_write_poll_lat(void)
+{
+    rd_params(IBV_QPT_UC, 1, 1, 0);
+    rd_rdma_write_poll_lat(IBV_QPT_UC);
+    show_results(LATENCY);
+}
+
+
+/*
+ * Measure UC RDMA write polling latency (server side).
+ */
+void
+run_server_uc_rdma_write_poll_lat(void)
+{
+    rd_rdma_write_poll_lat(IBV_QPT_UC);
+}
+
+
+/*
+ * Measure UD bi-directional bandwidth (client side).
+ */
+void
+run_client_ud_bi_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    rd_params(IBV_QPT_UD, K2, 1, 0);
+    rd_bi_bw(IBV_QPT_UD);
+    show_results(BANDWIDTH_SR);
+}
+
+
+/*
+ * Measure UD bi-directional bandwidth (server side).
+ */
+void
+run_server_ud_bi_bw(void)
+{
+    rd_bi_bw(IBV_QPT_UD);
+}
+
+
+/*
+ * Measure UD bandwidth (client side).
+ */
+void
+run_client_ud_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    par_use(L_NO_MSGS);
+    par_use(R_NO_MSGS);
+    rd_params(IBV_QPT_UD, K2, 1, 0);
+    rd_client_bw(IBV_QPT_UD);
+    show_results(BANDWIDTH_SR);
+}
+
+
+/*
+ * Measure UD bandwidth (server side).
+ */
+void
+run_server_ud_bw(void)
+{
+    rd_server_def(IBV_QPT_UD);
+}
+
+
+/*
+ * Measure UD latency (client side).
+ */
+void
+run_client_ud_lat(void)
+{
+    rd_params(IBV_QPT_UD, 1, 1, 0);
+    rd_pp_lat(IBV_QPT_UD, IO_SR);
+}
+
+
+/*
+ * Measure UD latency (server side).
+ */
+void
+run_server_ud_lat(void)
+{
+    rd_pp_lat(IBV_QPT_UD, IO_SR);
+}
+
+
+#ifdef HAS_XRC
+/*
+ * Measure XRC bi-directional bandwidth (client side).
+ */
+void
+run_client_xrc_bi_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    rd_params(IBV_QPT_XRC, K64, 1, 0);
+    rd_bi_bw(IBV_QPT_XRC);
+    show_results(BANDWIDTH);
+}
+
+
+/*
+ * Measure XRC bi-directional bandwidth (server side).
+ */
+void
+run_server_xrc_bi_bw(void)
+{
+    rd_bi_bw(IBV_QPT_XRC);
+}
+
+
+/*
+ * Measure XRC bandwidth (client side).
+ */
+void
+run_client_xrc_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    par_use(L_NO_MSGS);
+    par_use(R_NO_MSGS);
+    rd_params(IBV_QPT_XRC, K64, 1, 0);
+    rd_client_bw(IBV_QPT_XRC);
+    show_results(BANDWIDTH);
+}
+
+
+/*
+ * Measure XRC bandwidth (server side).
+ */
+void
+run_server_xrc_bw(void)
+{
+    rd_server_def(IBV_QPT_XRC);
+}
+
+
+/*
+ * Measure XRC latency (client side).
+ */
+void
+run_client_xrc_lat(void)
+{
+    rd_params(IBV_QPT_XRC, 1, 1, 0);
+    rd_pp_lat(IBV_QPT_XRC, IO_SR);
+}
+
+
+/*
+ * Measure XRC latency (server side).
+ */
+void
+run_server_xrc_lat(void)
+{
+    rd_pp_lat(IBV_QPT_XRC, IO_SR);
+}
+#endif /* HAS_XRC */
+
+/*
+ * Verify RC compare and swap (client side).
+ */
+void
+run_client_ver_rc_compare_swap(void)
+{
+    ib_client_verify_atomic(COMPARE_SWAP);
+}
+
+
+/*
+ * Verify RC compare and swap (server side).
+ */
+void
+run_server_ver_rc_compare_swap(void)
+{
+    rd_server_nop(IBV_QPT_RC, sizeof(uint64_t));
+}
+
+
+/*
+ * Verify RC fetch and add (client side).
+ */
+void
+run_client_ver_rc_fetch_add(void)
+{
+    ib_client_verify_atomic(FETCH_ADD);
+}
+
+
+/*
+ * Verify RC fetch and add (server side).
+ */
+void
+run_server_ver_rc_fetch_add(void)
+{
+    rd_server_nop(IBV_QPT_RC, sizeof(uint64_t));
+}
+
+
+/*
+ * Measure RDMA bandwidth (client side).
+ */
+static void
+rd_client_bw(int transport)
+{
+    DEVICE dev;
+    long sent = 0;
+
+    rd_open(&dev, transport, NCQE, 0);
+    rd_prep(&dev, 0);
+    sync_test();
+    rd_post_send_std(&dev, left_to_send(&sent, NCQE));
+    sent = NCQE;
+    while (!Finished) {
+        int i;
+        struct ibv_wc wc[NCQE];
+        int n = rd_poll(&dev, wc, cardof(wc));
+
+        if (n > LStat.max_cqes)
+            LStat.max_cqes = n;
+        if (Finished)
+            break;
+        for (i = 0; i < n; ++i) {
+            int id = wc[i].wr_id;
+            int status = wc[i].status;
+
+            if (id != WRID_SEND)
+                debug("bad WR ID %d", id);
+            else if (status != IBV_WC_SUCCESS)
+                do_error(status, &LStat.s.no_errs);
+        }
+        if (Req.no_msgs) {
+            if (LStat.s.no_msgs + LStat.s.no_errs >= Req.no_msgs)
+                break;
+            n = left_to_send(&sent, n);
+        }
+        rd_post_send_std(&dev, n);
+        sent += n;
+    }
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+}
+
+
+/*
+ * Default action for the server is to post receive buffers and whenever it
+ * gets a completion entry, compute statistics and post more buffers.
+ */
+static void
+rd_server_def(int transport)
+{
+    DEVICE dev;
+
+    rd_open(&dev, transport, 0, NCQE);
+    rd_prep(&dev, 0);
+    rd_post_recv_std(&dev, NCQE);
+    sync_test();
+    while (!Finished) {
+        int i;
+        struct ibv_wc wc[NCQE];
+        int n = rd_poll(&dev, wc, cardof(wc));
+
+        if (Finished)
+            break;
+        if (n > LStat.max_cqes)
+            LStat.max_cqes = n;
+        for (i = 0; i < n; ++i) {
+            int status = wc[i].status;
+
+            if (status == IBV_WC_SUCCESS) {
+                LStat.r.no_bytes += dev.msg_size;
+                LStat.r.no_msgs++;
+                if (Req.access_recv)
+                    touch_data(dev.buffer, dev.msg_size);
+            } else
+                do_error(status, &LStat.r.no_errs);
+        }
+        if (Req.no_msgs)
+            if (LStat.r.no_msgs + LStat.r.no_errs >= Req.no_msgs)
+                break;
+        rd_post_recv_std(&dev, n);
+    }
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+}
+
+
+/*
+ * Measure bi-directional RDMA bandwidth.
+ */
+static void
+rd_bi_bw(int transport)
+{
+    DEVICE dev;
+
+    rd_open(&dev, transport, NCQE, NCQE);
+    rd_prep(&dev, 0);
+    rd_post_recv_std(&dev, NCQE);
+    sync_test();
+    rd_post_send_std(&dev, NCQE);
+    while (!Finished) {
+        int i;
+        struct ibv_wc wc[NCQE];
+        int numSent = 0;
+        int numRecv = 0;
+        int n = rd_poll(&dev, wc, cardof(wc));
+
+        if (Finished)
+            break;
+        if (n > LStat.max_cqes)
+            LStat.max_cqes = n;
+        for (i = 0; i < n; ++i) {
+            int id = wc[i].wr_id;
+            int status = wc[i].status;
+
+            switch (id) {
+            case WRID_SEND:
+                if (status != IBV_WC_SUCCESS)
+                    do_error(status, &LStat.s.no_errs);
+                ++numSent;
+                break;
+            case WRID_RECV:
+                if (status == IBV_WC_SUCCESS) {
+                    LStat.r.no_bytes += dev.msg_size;
+                    LStat.r.no_msgs++;
+                    if (Req.access_recv)
+                        touch_data(dev.buffer, dev.msg_size);
+                } else
+                    do_error(status, &LStat.r.no_errs);
+                ++numRecv;
+                break;
+            default:
+                debug("bad WR ID %d", id);
+            }
+        }
+        if (numRecv)
+            rd_post_recv_std(&dev, numRecv);
+        if (numSent)
+            rd_post_send_std(&dev, numSent);
+    }
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+}
+
+
+/*
+ * Measure ping-pong latency (client and server side).
+ */
+static void
+rd_pp_lat(int transport, IOMODE iomode)
+{
+    DEVICE dev;
+
+    rd_open(&dev, transport, 1, 1);
+    rd_prep(&dev, 0);
+    rd_pp_lat_loop(&dev, iomode);
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+    if (is_client())
+        show_results(LATENCY);
+}
+
+
+/*
+ * Loop sending packets back and forth to measure ping-pong latency.
+ */
+static void
+rd_pp_lat_loop(DEVICE *dev, IOMODE iomode)
+{
+    int done = 1;
+
+    rd_post_recv_std(dev, 1);
+    sync_test();
+    if (is_client()) {
+        if (iomode == IO_SR)
+            rd_post_send_std(dev, 1);
+        else
+            rd_post_rdma_std(dev, IBV_WR_RDMA_WRITE_WITH_IMM, 1);
+        done = 0;
+    }
+
+    while (!Finished) {
+        int i;
+        struct ibv_wc wc[2];
+        int n = rd_poll(dev, wc, cardof(wc));
+
+        if (Finished)
+            break;
+        for (i = 0; i < n; ++i) {
+            int id = wc[i].wr_id;
+            int status = wc[i].status;
+
+            switch (id) {
+            case WRID_SEND:
+            case WRID_RDMA:
+                if (status != IBV_WC_SUCCESS)
+                    do_error(status, &LStat.s.no_errs);
+                done |= 1;
+                continue;
+            case WRID_RECV:
+                if (status == IBV_WC_SUCCESS) {
+                    LStat.r.no_bytes += dev->msg_size;
+                    LStat.r.no_msgs++;
+                    rd_post_recv_std(dev, 1);
+                } else
+                    do_error(status, &LStat.r.no_errs);
+                done |= 2;
+                continue;
+            default:
+                debug("bad WR ID %d", id);
+                continue;
+            }
+            break;
+        }
+        if (done == 3) {
+            if (iomode == IO_SR)
+                rd_post_send_std(dev, 1);
+            else
+                rd_post_rdma_std(dev, IBV_WR_RDMA_WRITE_WITH_IMM, 1);
+            done = 0;
+        }
+    }
+}
+
+
+/*
+ * Loop sending packets back and forth using RDMA Write and polling to measure
+ * latency.  This is the strategy used by some of the MPIs.  Note that it does
+ * not matter what characters clientid and serverid are set to as long as they
+ * are different.  Note also that we must set *p and *q before calling
+ * sync_test to avoid a race condition.
+ */
+static void
+rd_rdma_write_poll_lat(int transport)
+{
+    DEVICE dev;
+    volatile unsigned char *p, *q;
+    int send, locid, remid;
+    int clientid = 0x55;
+    int serverid = 0xaa;
+
+    if (is_client())
+        send = 1, locid = clientid, remid = serverid;
+    else
+        send = 0, locid = serverid, remid = clientid;
+    rd_open(&dev, transport, NCQE, 0);
+    rd_prep(&dev, 0);
+    p = (unsigned char *)dev.buffer;
+    q = p + dev.msg_size-1;
+    *p = locid;
+    *q = locid;
+    sync_test();
+    while (!Finished) {
+        if (send) {
+            int i;
+            int n;
+            struct ibv_wc wc[2];
+
+            rd_post_rdma_std(&dev, IBV_WR_RDMA_WRITE, 1);
+            if (Finished)
+                break;
+            n = ibv_poll_cq(dev.cq, cardof(wc), wc);
+            if (n < 0)
+                error(SYS, "CQ poll failed");
+            for (i = 0; i < n; ++i) {
+                int id = wc[i].wr_id;
+                int status = wc[i].status;
+
+                if (id != WRID_RDMA)
+                    debug("bad WR ID %d", id);
+                else if (status != IBV_WC_SUCCESS)
+                    do_error(status, &LStat.s.no_errs);
+            }
+        }
+        while (!Finished)
+            if (*p == remid && *q == remid)
+                break;
+        LStat.r.no_bytes += dev.msg_size;
+        LStat.r.no_msgs++;
+        *p = locid;
+        *q = locid;
+        send = 1;
+    }
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+}
+
+
+/*
+ * Measure RDMA Read latency (client side).
+ */
+static void
+rd_client_rdma_read_lat(int transport)
+{
+    DEVICE dev;
+
+    rd_open(&dev, transport, 1, 0);
+    rd_prep(&dev, 0);
+    sync_test();
+    rd_post_rdma_std(&dev, IBV_WR_RDMA_READ, 1);
+    while (!Finished) {
+        struct ibv_wc wc;
+        int n = rd_poll(&dev, &wc, 1);
+
+        if (n == 0)
+            continue;
+        if (Finished)
+            break;
+        if (wc.wr_id != WRID_RDMA) {
+            debug("bad WR ID %d", (int)wc.wr_id);
+            continue;
+        }
+        if (wc.status == IBV_WC_SUCCESS) {
+            LStat.r.no_bytes += dev.msg_size;
+            LStat.r.no_msgs++;
+            LStat.rem_s.no_bytes += dev.msg_size;
+            LStat.rem_s.no_msgs++;
+        } else
+            do_error(wc.status, &LStat.s.no_errs);
+        rd_post_rdma_std(&dev, IBV_WR_RDMA_READ, 1);
+    }
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+    show_results(LATENCY);
+}
+
+
+/*
+ * Measure RDMA bandwidth (client side).
+ */
+static void
+rd_client_rdma_bw(int transport, ibv_op opcode)
+{
+    DEVICE dev;
+
+    rd_open(&dev, transport, NCQE, 0);
+    rd_prep(&dev, 0);
+    sync_test();
+    rd_post_rdma_std(&dev, opcode, NCQE);
+    while (!Finished) {
+        int i;
+        struct ibv_wc wc[NCQE];
+        int n = rd_poll(&dev, wc, cardof(wc));
+
+        if (Finished)
+            break;
+        if (n > LStat.max_cqes)
+            LStat.max_cqes = n;
+        for (i = 0; i < n; ++i) {
+            int status = wc[i].status;
+
+            if (status == IBV_WC_SUCCESS) {
+                if (opcode == IBV_WR_RDMA_READ) {
+                    LStat.r.no_bytes += dev.msg_size;
+                    LStat.r.no_msgs++;
+                    LStat.rem_s.no_bytes += dev.msg_size;
+                    LStat.rem_s.no_msgs++;
+                    if (Req.access_recv)
+                        touch_data(dev.buffer, dev.msg_size);
+                }
+            } else
+                do_error(status, &LStat.s.no_errs);
+        }
+        rd_post_rdma_std(&dev, opcode, n);
+    }
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+}
+
+
+/*
+ * Server just waits and lets driver take care of any requests.
+ */
+static void
+rd_server_nop(int transport, int size)
+{
+    DEVICE dev;
+
+    /* workaround: Size of RQ should be 0; bug in Mellanox driver */
+    rd_open(&dev, transport, 0, 1);
+    rd_prep(&dev, size);
+    sync_test();
+    while (!Finished)
+        pause();
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+}
+
+
+/*
+ * Measure messaging rate for an atomic operation.
+ */
+static void
+ib_client_atomic(ATOMIC atomic)
+{
+    int i;
+    DEVICE dev;
+
+    rd_params(IBV_QPT_RC, 0, 1, 1);
+    rd_open(&dev, IBV_QPT_RC, NCQE, 0);
+    rd_prep(&dev, sizeof(uint64_t));
+    sync_test();
+
+    for (i = 0; i < NCQE; ++i) {
+        if (Finished)
+            break;
+        ib_post_atomic(&dev, atomic, 0, 0, 0, 0);
+    }
+
+    while (!Finished) {
+        struct ibv_wc wc[NCQE];
+        int n = rd_poll(&dev, wc, cardof(wc));
+
+        if (Finished)
+            break;
+        if (n > LStat.max_cqes)
+            LStat.max_cqes = n;
+        for (i = 0; i < n; ++i) {
+            int status = wc[i].status;
+
+            if (status == IBV_WC_SUCCESS) {
+                LStat.rem_r.no_bytes += sizeof(uint64_t);
+                LStat.rem_r.no_msgs++;
+            } else
+                do_error(status, &LStat.s.no_errs);
+            ib_post_atomic(&dev, atomic, 0, 0, 0, 0);
+        }
+    }
+
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+    show_results(MSG_RATE);
+}
+
+
+/*
+ * Verify RC compare and swap (client side).
+ */
+static void
+ib_client_verify_atomic(ATOMIC atomic)
+{
+    int i;
+    int slots;
+    DEVICE dev;
+    int head = 0;
+    int tail = 0;
+    uint64_t args[2] = {0};
+
+    rd_params(IBV_QPT_RC, K64, 1, 1);
+    rd_open(&dev, IBV_QPT_RC, NCQE, 0);
+    slots = Req.msg_size / sizeof(uint64_t);
+    if (slots < 1)
+        error(0, "message size must be at least %d", sizeof(uint64_t));
+    if (slots > NCQE)
+        slots = NCQE;
+    rd_prep(&dev, 0);
+    sync_test();
+
+    for (i = 0; i < slots; ++i) {
+        if (Finished)
+            break;
+        atomic_seq(atomic, head++, 0, args);
+        ib_post_atomic(&dev, atomic, i, i*sizeof(uint64_t), args[0], args[1]);
+    }
+
+    while (!Finished) {
+        struct ibv_wc wc[NCQE];
+        int n = rd_poll(&dev, wc, cardof(wc));
+
+        if (Finished)
+            break;
+        if (n > LStat.max_cqes)
+            LStat.max_cqes = n;
+        for (i = 0; i < n; ++i) {
+            uint64_t seen;
+            uint64_t want = 0;
+            int x = wc[i].wr_id;
+            int status = wc[i].status;
+
+            if (status == IBV_WC_SUCCESS) {
+                LStat.rem_r.no_bytes += sizeof(uint64_t);
+                LStat.rem_r.no_msgs++;
+            } else
+                do_error(status, &LStat.s.no_errs);
+
+            atomic_seq(atomic, tail++, &want, 0);
+            seen = ((uint64_t *)dev.buffer)[x];
+            if (seen != want) {
+                error(0, "mismatch, sequence %d, expected %llx, got %llx",
+                                    tail, (long long)want, (long long)seen);
+            }
+            atomic_seq(atomic, head++, 0, args);
+            ib_post_atomic(&dev, atomic, x, x*sizeof(uint64_t),
+                                                            args[0], args[1]);
+        }
+    }
+    stop_test_timer();
+    exchange_results();
+    rd_close(&dev);
+    show_results(MSG_RATE);
+}
+
+
+/*
+ * Given an atomic operation and an index, return the next value associated
+ * with that index and the arguments we might pass to post that atomic.
+ */
+static void
+atomic_seq(ATOMIC atomic, int i, uint64_t *value, uint64_t *args)
+{
+    if (atomic == COMPARE_SWAP) {
+        uint64_t v;
+        uint64_t magic = 0x0123456789abcdefULL;
+
+        v = i ? magic + i-1 : 0;
+        if (value)
+            *value = v;
+        if (args) {
+            args[0] = v;
+            args[1] = magic + i;
+        }
+    } else if (atomic == FETCH_ADD) {
+        if (value)
+            *value = i;
+        if (args)
+            args[0] = 1;
+    }
+}
+
+
+/*
+ * Set default parameters.
+ */
+static void
+rd_params(int transport, long msg_size, int poll, int atomic)
+{
+    //if (transport == IBV_QPT_RC || transport == IBV_QPT_UD) {
+    if (transport == IBV_QPT_RC) {
+        par_use(L_USE_CM);
+        par_use(R_USE_CM);
+    } else {
+        setv_u32(L_USE_CM, 0);
+        setv_u32(R_USE_CM, 0);
+    }
+
+    if (!Req.use_cm) {
+        setp_u32(0, L_MTU_SIZE, MTU_SIZE);
+        setp_u32(0, R_MTU_SIZE, MTU_SIZE);
+        par_use(L_ID);
+        par_use(R_ID);
+        par_use(L_SL);
+        par_use(R_SL);
+        par_use(L_STATIC_RATE);
+        par_use(R_STATIC_RATE);
+        par_use(L_SRC_PATH_BITS);
+        par_use(R_SRC_PATH_BITS);
+    }
+
+    if (msg_size) {
+        setp_u32(0, L_MSG_SIZE, msg_size);
+        setp_u32(0, R_MSG_SIZE, msg_size);
+    }
+
+    if (poll) {
+        par_use(L_POLL_MODE);
+        par_use(R_POLL_MODE);
+    }
+
+    if (atomic) {
+        par_use(L_RD_ATOMIC);
+        par_use(R_RD_ATOMIC);
+    }
+    opt_check();
+}
+
+
+/*
+ * Open a RDMA device.
+ */
+static void
+rd_open(DEVICE *dev, int trans, int max_send_wr, int max_recv_wr)
+{
+    /* Send request to client */
+    if (is_client())
+        client_send_request();
+
+    /* Clear structure */
+    memset(dev, 0, sizeof(*dev));
+
+    /* Set transport type and maximum work request parameters */
+    dev->trans = trans;
+    dev->max_send_wr = max_send_wr;
+    dev->max_recv_wr = max_recv_wr;
+
+    /* Open device */
+    if (Req.use_cm)
+        cm_open(dev);
+    else
+        ib_open(dev);
+
+    /* Get QP attributes */
+    {
+        struct ibv_qp_attr qp_attr;
+        struct ibv_qp_init_attr qp_init_attr;
+
+        if (ibv_query_qp(dev->qp, &qp_attr, 0, &qp_init_attr) != 0)
+            error(SYS, "query QP failed");
+        dev->max_inline = qp_attr.cap.max_inline_data;
+    }
+}
+
+
+/*
+ * Called after rd_open to prepare both ends.
+ */
+static void
+rd_prep(DEVICE *dev, int size)
+{
+    /* Set the size of the messages we transfer */
+    if (size == 0)
+        dev->msg_size = Req.msg_size;
+
+    /* Allocate memory region */
+    if (size == 0)
+        size = dev->msg_size;
+    if (dev->trans == IBV_QPT_UD)
+        size += GRH_SIZE;
+    rd_mralloc(dev, size);
+
+    /* Exchange node information */
+    {
+        NODE node;
+
+        enc_init(&node);
+        enc_node(&dev->lnode);
+        send_mesg(&node, sizeof(node), "node information");
+        recv_mesg(&node, sizeof(node), "node information");
+        dec_init(&node);
+        dec_node(&dev->rnode);
+    }
+
+    /* Second phase of open for devices */
+    if (Req.use_cm) 
+        cm_prep(dev);
+    else
+        ib_prep(dev);
+
+    /* Request CQ notification if not polling */
+    if (!Req.poll_mode) {
+        if (ibv_req_notify_cq(dev->cq, 0) != 0)
+            error(SYS, "failed to request CQ notification");
+    }
+
+    /* Show node information if debugging */
+    show_node_info(dev);
+}
+
+
+/*
+ * Show node information when debugging.
+ */
+static void
+show_node_info(DEVICE *dev)
+{
+    NODE *n;
+
+    if (!Debug)
+        return;
+    n = &dev->lnode;
+
+    if (Req.use_cm) 
+        debug("L: rkey=%08x vaddr=%010x", n->rkey, n->vaddr);
+#ifdef HAS_XRC
+    else if (dev->trans == IBV_QPT_XRC) {
+        debug("L: lid=%04x qpn=%06x psn=%06x rkey=%08x vaddr=%010x srqn=%08x",
+                        n->lid, n->qpn, n->psn, n->rkey, n->vaddr, n->srqn);
+    }
+#endif
+    else {
+        debug("L: lid=%04x qpn=%06x psn=%06x rkey=%08x vaddr=%010x",
+                            n->lid, n->qpn, n->psn, n->rkey, n->vaddr);
+    }
+
+    n = &dev->rnode;
+    if (Req.use_cm) 
+        debug("R: rkey=%08x vaddr=%010x", n->rkey, n->vaddr);
+#ifdef HAS_XRC
+    else if (dev->trans == IBV_QPT_XRC) {
+        debug("R: lid=%04x qpn=%06x psn=%06x rkey=%08x vaddr=%010x srqn=%08x",
+                            n->lid, n->qpn, n->psn, n->rkey, n->vaddr);
+    }
+#endif
+    else {
+        debug("R: lid=%04x qpn=%06x psn=%06x rkey=%08x vaddr=%010x",
+                        n->lid, n->qpn, n->psn, n->rkey, n->vaddr, n->srqn);
+    }
+}
+
+
+/*
+ * Close a RDMA device.  We must destroy the CQ before the QP otherwise the
+ * ibv_destroy_qp call seems to sometimes hang.  We must also destroy the QP
+ * before destroying the memory region as we cannot destroy the memory region
+ * if there are references still outstanding.  Hopefully we now have things in
+ * the right order.
+ */
+static void
+rd_close(DEVICE *dev)
+{
+    if (Req.use_cm)
+        cm_close(dev);
+    else
+        ib_close1(dev);
+
+    if (dev->ah)
+        ibv_destroy_ah(dev->ah);
+    if (dev->cq)
+        ibv_destroy_cq(dev->cq);
+    if (dev->pd)
+        ibv_dealloc_pd(dev->pd);
+    if (dev->channel)
+        ibv_destroy_comp_channel(dev->channel);
+    rd_mrfree(dev);
+
+    if (!Req.use_cm)
+        ib_close2(dev);
+
+    memset(dev, 0, sizeof(*dev));
+}
+
+
+/*
+ * Create a queue pair.
+ */
+static void
+rd_create_qp(DEVICE *dev, struct ibv_context *context, struct rdma_cm_id *id)
+{
+    /* Set up and verify rd_atomic parameters */
+    {
+        struct ibv_device_attr dev_attr;
+
+        if (ibv_query_device(context, &dev_attr) != SUCCESS0)
+            error(SYS, "query device failed");
+        if (Req.rd_atomic == 0)
+            dev->lnode.rd_atomic = dev_attr.max_qp_rd_atom;
+        else if (Req.rd_atomic <= dev_attr.max_qp_rd_atom)
+            dev->lnode.rd_atomic = Req.rd_atomic;
+        else
+            error(0, "device only supports %d (< %d) RDMA reads or atomics",
+                                    dev_attr.max_qp_rd_atom, Req.rd_atomic);
+    }
+
+    /* Allocate completion channel */
+    dev->channel = ibv_create_comp_channel(context);
+    if (!dev->channel)
+        error(SYS, "failed to create completion channel");
+
+    /* Allocate protection domain */
+    dev->pd = ibv_alloc_pd(context);
+    if (!dev->pd)
+        error(SYS, "failed to allocate protection domain");
+
+    /* Create completion queue */
+    dev->cq = ibv_create_cq(context,
+                        dev->max_send_wr+dev->max_recv_wr, 0, dev->channel, 0);
+    if (!dev->cq)
+        error(SYS, "failed to create completion queue");
+
+    /* Create queue pair */
+    {
+        struct ibv_qp_init_attr qp_attr ={
+            .send_cq = dev->cq,
+            .recv_cq = dev->cq,
+            .cap     ={
+                .max_send_wr     = dev->max_send_wr,
+                .max_recv_wr     = dev->max_recv_wr,
+                .max_send_sge    = 1,
+                .max_recv_sge    = 1,
+            },
+            .qp_type = dev->trans
+        };
+
+        if (Req.use_cm) {
+            if (rdma_create_qp(id, dev->pd, &qp_attr) != 0)
+                error(SYS, "failed to create QP");
+            dev->qp = id->qp;
+        } else {
+#ifdef HAS_XRC
+            if (dev->trans == IBV_QPT_XRC) {
+                struct ibv_srq_init_attr srq_attr ={
+                    .attr ={
+                        .max_wr  = dev->max_recv_wr,
+                        .max_sge = 1
+                    }
+                };
+
+                dev->xrc = ibv_open_xrc_domain(context, -1, O_CREAT);
+                if (!dev->xrc)
+                    error(SYS, "failed to open XRC domain");
+
+                dev->srq = ibv_create_xrc_srq(dev->pd, dev->xrc, dev->cq,
+                                                                    &srq_attr);
+                if (!dev->srq)
+                    error(SYS, "failed to create SRQ");
+
+                qp_attr.cap.max_recv_wr  = 0;
+                qp_attr.cap.max_recv_sge = 0;
+                qp_attr.xrc_domain       = dev->xrc;
+            }
+#endif /* HAS_XRC */
+
+            dev->qp = ibv_create_qp(dev->pd, &qp_attr);
+            if (!dev->qp)
+                error(SYS, "failed to create QP");
+        }
+    }
+}
+
+
+/*
+ * Allocate a memory region and register it.  I thought this routine should
+ * never be called with a size of 0 as prior code checks for that and sets it
+ * to some default value.  I appear to be wrong.  In that case, size is set to
+ * 1 so other code does not break.
+ */
+static void
+rd_mralloc(DEVICE *dev, int size)
+{
+    int flags;
+    int pagesize;
+
+    if (dev->buffer)
+        error(BUG, "rd_mralloc: memory region already allocated");
+    if (size == 0)
+        size = 1;
+
+    pagesize = sysconf(_SC_PAGESIZE);
+    if (posix_memalign((void **)&dev->buffer, pagesize, size) != 0)
+        error(SYS, "failed to allocate memory");
+    memset(dev->buffer, 0, size);
+    dev->buf_size = size;
+    flags = IBV_ACCESS_LOCAL_WRITE  |
+            IBV_ACCESS_REMOTE_READ  |
+            IBV_ACCESS_REMOTE_WRITE |
+            IBV_ACCESS_REMOTE_ATOMIC;
+    dev->mr = ibv_reg_mr(dev->pd, dev->buffer, size, flags);
+    if (!dev->mr)
+        error(SYS, "failed to allocate memory region");
+    dev->lnode.rkey = dev->mr->rkey;
+    dev->lnode.vaddr = (unsigned long)dev->buffer;
+}
+
+
+/*
+ * Free the memory region.
+ */
+static void
+rd_mrfree(DEVICE *dev)
+{
+    if (dev->mr)
+        ibv_dereg_mr(dev->mr);
+    dev->mr = NULL;
+
+    if (dev->buffer)
+        free(dev->buffer);
+    dev->buffer = NULL;
+    dev->buf_size = 0;
+
+    dev->lnode.rkey = 0;
+    dev->lnode.vaddr = 0;
+}
+
+
+/*
+ * Open a device using the Connection Manager.
+ */
+static void
+cm_open(DEVICE *dev)
+{
+    cm_init(dev);
+    if (is_client())
+        cm_open_client(dev);
+    else
+        cm_open_server(dev);
+}
+
+
+/*
+ * Open a channel to report communication events and allocate a communication
+ * id.
+ */
+static void
+cm_init(DEVICE *dev)
+{
+    CMINFO *cm = &dev->cm;
+    int portspace = (dev->trans == IBV_QPT_RC) ? RDMA_PS_TCP : RDMA_PS_UDP;
+
+    cm->channel = rdma_create_event_channel();
+    if (!cm->channel)
+        error(0, "rdma_create_event_channel failed");
+    if (rdma_create_id(cm->channel, &cm->id, 0, portspace) != 0)
+        error(0, "rdma_create_id failed");
+}
+
+
+/*
+ * Open a device using the Connection Manager when we are the client.
+ */
+static void
+cm_open_client(DEVICE *dev)
+{
+    AI *aip;
+    uint32_t port;
+    struct addrinfo hints ={
+        .ai_family   = AF_INET,
+        .ai_socktype = SOCK_STREAM
+    };
+    int timeout = Req.timeout * 1000;
+    CMINFO *cm = &dev->cm;
+
+    recv_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
+    port = decode_uint32(&port);
+    aip = getaddrinfo_port(ServerName, port, &hints);
+    cm_init(dev);
+
+    if (rdma_resolve_addr(cm->id, 0, (SA *)aip->ai_addr, timeout) != 0)
+        error(0, "rdma_resolve_addr failed");
+    freeaddrinfo(aip);
+    cm_expect_event(dev, RDMA_CM_EVENT_ADDR_RESOLVED);
+    cm_ack_event(dev);
+
+    if (rdma_resolve_route(cm->id, timeout) != 0)
+        error(0, "rdma_resolve_route failed");
+    cm_expect_event(dev, RDMA_CM_EVENT_ROUTE_RESOLVED);
+    cm_ack_event(dev);
+    rd_create_qp(dev, cm->id->verbs, cm->id);
+
+    if (dev->trans == IBV_QPT_RC) {
+        struct rdma_conn_param param ={
+            .responder_resources = 1,
+            .initiator_depth     = 1,
+            .rnr_retry_count     = RNR_RETRY_CNT,
+            .retry_count         = RETRY_CNT
+        };
+
+        if (rdma_connect(cm->id, &param) != 0)
+            error(0, "rdma_connect failed");
+        cm_expect_event(dev, RDMA_CM_EVENT_ESTABLISHED);
+        cm_ack_event(dev);
+    } else if (dev->trans == IBV_QPT_UD) {
+        struct rdma_conn_param param ={
+            .qp_num = cm->id->qp->qp_num
+        };
+
+        if (rdma_connect(cm->id, &param) != 0)
+            error(0, "rdma_connect failed");
+        cm_expect_event(dev, RDMA_CM_EVENT_ESTABLISHED);
+        dev->qkey = cm->event->param.ud.qkey;
+        dev->ah = ibv_create_ah(dev->pd, &cm->event->param.ud.ah_attr);
+        if (!dev->ah)
+            error(SYS, "failed to create address handle");
+        cm_ack_event(dev);
+    } else
+        error(BUG, "cm_open_client: bad transport: %d", dev->trans);
+}
+
+
+/*
+ * Open a device using the Connection Manager when we are the client.
+ */
+static void
+cm_open_server(DEVICE *dev)
+{
+    uint32_t port;
+    struct sockaddr_in saddr ={
+        .sin_family      = AF_INET,
+        .sin_addr.s_addr = htonl(INADDR_ANY),
+        .sin_port        = htons(0)
+    };
+    CMINFO *cm = &dev->cm;
+
+    if (rdma_bind_addr(cm->id, (SA *)&saddr) != 0)
+        error(0, "rdma_bind_addr failed");
+    port = ntohs(rdma_get_src_port(cm->id));
+    encode_uint32(&port, port);
+    send_mesg(&port, sizeof(port), "RDMA CM TCP IPv4 server port");
+
+    if (rdma_listen(cm->id, 0) != 0)
+        error(0, "rdma_listen failed");
+    cm_expect_event(dev, RDMA_CM_EVENT_CONNECT_REQUEST);
+    rd_create_qp(dev, cm->event->id->verbs, cm->event->id);
+
+    if (dev->trans == IBV_QPT_RC) {
+        struct rdma_conn_param param ={
+            .responder_resources = 1,
+            .initiator_depth     = 1,
+            .rnr_retry_count     = RNR_RETRY_CNT,
+            .retry_count         = RETRY_CNT
+        };
+        struct ibv_qp_attr rtr_attr ={
+            .min_rnr_timer = MIN_RNR_TIMER,
+        };
+
+        if (rdma_accept(cm->event->id, &param) != 0)
+            error(0, "rdma_accept failed");
+        cm_ack_event(dev);
+        cm_expect_event(dev, RDMA_CM_EVENT_ESTABLISHED);
+        cm_ack_event(dev);
+
+        /* Do not complain on error as we might be on a iWARP device */
+        ibv_modify_qp(dev->qp, &rtr_attr, IBV_QP_MIN_RNR_TIMER);
+    } else if (dev->trans == IBV_QPT_UD) {
+        struct rdma_conn_param param ={
+            .qp_num = cm->event->id->qp->qp_num
+        };
+
+        if (rdma_accept(cm->event->id, &param) != 0)
+            error(0, "rdma_accept failed");
+        dev->qkey = cm->event->param.ud.qkey;
+        dev->ah = ibv_create_ah(dev->pd, &cm->event->param.ud.ah_attr);
+        if (!dev->ah)
+            error(SYS, "failed to create address handle");
+        cm_ack_event(dev);
+    } else
+        error(BUG, "cm_open_server: bad transport: %d", dev->trans);
+}
+
+
+/*
+ * Prepare a device using the Connection Manager.  Final stage of open.
+ */
+static void
+cm_prep(DEVICE *dev)
+{
+}
+
+
+/*
+ * Close a device using the Connection Manager.
+ */
+static void
+cm_close(DEVICE *dev)
+{
+    if (is_client())
+        if (rdma_disconnect(dev->cm.id) != 0)
+            error(SYS, "rdma_disconnect failed");
+    cm_expect_event(dev, RDMA_CM_EVENT_DISCONNECTED);
+    cm_ack_event(dev);
+    rdma_destroy_id(dev->cm.id);
+    rdma_destroy_event_channel(dev->cm.channel);
+}
+
+
+/*
+ * Get an event from the Connection Manager.  If it is not what we expect,
+ * complain.
+ */
+static void
+cm_expect_event(DEVICE *dev, int expected)
+{
+    char msg1[64];
+    char msg2[64];
+    CMINFO *cm = &dev->cm;
+
+    if (rdma_get_cm_event(cm->channel, &cm->event) != 0)
+        error(0, "failed to receive event from RDMA CM channel");
+    if (cm->event->event != expected) {
+        error(0, "unexpected event from RDMA CM: %s\n    expecting: %s",
+                        cm_event_name(cm->event->event, msg1, sizeof(msg1)),
+                        cm_event_name(expected, msg2, sizeof(msg2)));
+    }
+}
+
+
+/*
+ * Return a name given a RDMA CM event number.  We first look at our list.  If
+ * that fails, we call the standard rdma_event_str routine.
+ */
+static char *
+cm_event_name(int event, char *data, int size)
+{
+    int i;
+
+    for (i = 0; i < cardof(CMEvents); ++i)
+        if (event == CMEvents[i].value)
+            return CMEvents[i].name;
+    strncpy(data, rdma_event_str(event), size);
+    data[size-1] = '\0';
+    return data;
+}
+
+
+/*
+ * Acknowledge and free a communication event.
+ */
+static void
+cm_ack_event(DEVICE *dev)
+{
+    if (rdma_ack_cm_event(dev->cm.event) != 0)
+        error(0, "rdma_ack_cm_event failed");
+}
+
+
+/*
+ * Open an InfiniBand device.
+ */
+static void
+ib_open(DEVICE *dev)
+{
+    /* Determine MTU */
+    {
+        int mtu = Req.mtu_size;
+
+        if (mtu == 256)
+            dev->ib.mtu = IBV_MTU_256;
+        else if (mtu == 512)
+            dev->ib.mtu = IBV_MTU_512;
+        else if (mtu == 1024)
+            dev->ib.mtu = IBV_MTU_1024;
+        else if (mtu == 2048)
+            dev->ib.mtu = IBV_MTU_2048;
+        else if (mtu == 4096)
+            dev->ib.mtu = IBV_MTU_4096;
+        else
+            error(0, "bad MTU: %d; must be 256/512/1K/2K/4K", mtu);
+    }
+
+    /* Determine port */
+    {
+        int port = 1;
+        char *p = index(Req.id, ':');
+
+        if (p) {
+            *p++ = '\0';
+            port = atoi(p);
+            if (port < 1)
+                error(0, "bad IB port: %d; must be at least 1", port);
+        }
+        dev->ib.port = port;
+    }
+
+    /* Determine static rate */
+    {
+        RATES *q = Rates;
+        RATES *r = q + cardof(Rates);
+
+        for (;; ++q) {
+            if (q >= r)
+                error(SYS, "bad static rate: %s", Req.static_rate);
+            if (streq(Req.static_rate, q->name)) {
+                dev->ib.rate = q->rate;
+                break;
+            }
+        }
+    }
+
+    /* Set up Q Key */
+    dev->qkey = QKEY;
+
+    /* Open device */
+    {
+        struct ibv_device *device;
+        char *name = Req.id[0] ? Req.id : 0;
+
+        dev->ib.devlist = ibv_get_device_list(0);
+        if (!dev->ib.devlist)
+            error(SYS, "failed to find any InfiniBand devices");
+        if (!name)
+            device = *dev->ib.devlist;
+        else {
+            struct ibv_device **d = dev->ib.devlist;
+            while ((device = *d++))
+                if (streq(ibv_get_device_name(device), name))
+                    break;
+        }
+        if (!device)
+            error(SYS, "failed to find InfiniBand device");
+        dev->ib.context = ibv_open_device(device);
+        if (!dev->ib.context) {
+            const char *s = ibv_get_device_name(device);
+            error(SYS, "failed to open device %s", s);
+        }
+    }
+
+    /* Set up local node LID */
+    {
+        struct ibv_port_attr port_attr;
+        int stat = ibv_query_port(dev->ib.context, dev->ib.port, &port_attr);
+
+        if (stat != 0)
+            error(SYS, "query port failed");
+        srand48(getpid()*time(0));
+        dev->lnode.lid = port_attr.lid;
+	if (port_attr.lmc > 0)
+	    dev->lnode.lid += Req.src_path_bits & ((1 << port_attr.lmc) - 1);
+    }
+
+    /* Create QP */
+    rd_create_qp(dev, dev->ib.context, 0);
+
+    /* Modify queue pair to INIT state */
+    {
+        struct ibv_qp_attr attr ={
+            .qp_state       = IBV_QPS_INIT,
+            .pkey_index     = 0,
+            .port_num       = dev->ib.port
+        };
+        int flags = IBV_QP_STATE | IBV_QP_PKEY_INDEX | IBV_QP_PORT;
+
+        if (dev->trans == IBV_QPT_UD) {
+            flags |= IBV_QP_QKEY;
+            attr.qkey = dev->qkey;
+#ifdef HAS_XRC
+        } else if (dev->trans == IBV_QPT_RC || dev->trans == IBV_QPT_XRC) {
+#else
+        } else if (dev->trans == IBV_QPT_RC) {
+#endif
+            flags |= IBV_QP_ACCESS_FLAGS;
+            attr.qp_access_flags =
+                IBV_ACCESS_REMOTE_READ  |
+                IBV_ACCESS_REMOTE_WRITE |
+                IBV_ACCESS_REMOTE_ATOMIC;
+        } else if (dev->trans == IBV_QPT_UC) {
+            flags |= IBV_QP_ACCESS_FLAGS;
+            attr.qp_access_flags = IBV_ACCESS_REMOTE_WRITE;
+        }
+        if (ibv_modify_qp(dev->qp, &attr, flags) != SUCCESS0)
+            error(SYS, "failed to modify QP to INIT state");
+    }
+
+    /* Set up local node QP number, PSN and SRQ number */
+    dev->lnode.qpn = dev->qp->qp_num;
+    dev->lnode.psn = lrand48() & 0xffffff;
+#ifdef HAS_XRC
+    if (dev->trans == IBV_QPT_XRC)
+        dev->lnode.srqn = dev->srq->xrc_srq_num;
+#endif
+
+    /* Set up alternate port LID */
+    if (Req.alt_port) {
+        struct ibv_port_attr port_attr;
+        int stat = ibv_query_port(dev->ib.context, Req.alt_port, &port_attr);
+
+        if (stat != SUCCESS0)
+            error(SYS, "query port failed");
+        dev->lnode.alt_lid = port_attr.lid;
+	if (port_attr.lmc > 0)
+	    dev->lnode.alt_lid +=
+                Req.src_path_bits & ((1 << port_attr.lmc) - 1);
+    }
+}
+
+
+/*
+ * Prepare the InfiniBand device for receiving and sending.  Final stage of
+ * open.
+ */
+static void
+ib_prep(DEVICE *dev)
+{
+    int flags;
+    struct ibv_qp_attr rtr_attr ={
+        .qp_state           = IBV_QPS_RTR,
+        .path_mtu           = dev->ib.mtu,
+        .dest_qp_num        = dev->rnode.qpn,
+        .rq_psn             = dev->rnode.psn,
+        .min_rnr_timer      = MIN_RNR_TIMER,
+        .max_dest_rd_atomic = dev->lnode.rd_atomic,
+        .ah_attr            = {
+            .dlid           = dev->rnode.lid,
+            .port_num       = dev->ib.port,
+            .static_rate    = dev->ib.rate,
+	    .src_path_bits  = Req.src_path_bits,
+            .sl             = Req.sl
+        }
+    };
+    struct ibv_qp_attr rts_attr ={
+        .qp_state          = IBV_QPS_RTS,
+        .timeout           = LOCAL_ACK_TIMEOUT,
+        .retry_cnt         = RETRY_CNT,
+        .rnr_retry         = RNR_RETRY_CNT,
+        .sq_psn            = dev->lnode.psn,
+        .max_rd_atomic     = dev->rnode.rd_atomic,
+        .path_mig_state    = IBV_MIG_REARM,
+        .alt_port_num      = Req.alt_port,
+        .alt_ah_attr       = {
+            .dlid          = dev->rnode.alt_lid,
+            .port_num      = Req.alt_port,
+            .static_rate   = dev->ib.rate,
+	    .src_path_bits = Req.src_path_bits,
+            .sl            = Req.sl
+        }
+    };
+    struct ibv_ah_attr ah_attr ={
+        .dlid          = dev->rnode.lid,
+        .port_num      = dev->ib.port,
+        .static_rate   = dev->ib.rate,
+	.src_path_bits = Req.src_path_bits,
+        .sl            = Req.sl
+    };
+
+    if (dev->trans == IBV_QPT_UD) {
+        /* Modify queue pair to RTR */
+        flags = IBV_QP_STATE;
+        if (ibv_modify_qp(dev->qp, &rtr_attr, flags) != 0)
+            error(SYS, "failed to modify QP to RTR");
+
+        /* Modify queue pair to RTS */
+        flags = IBV_QP_STATE | IBV_QP_SQ_PSN;
+        if (ibv_modify_qp(dev->qp, &rts_attr, flags) != 0)
+            error(SYS, "failed to modify QP to RTS");
+
+        /* Create address handle */
+        dev->ah = ibv_create_ah(dev->pd, &ah_attr);
+        if (!dev->ah)
+            error(SYS, "failed to create address handle");
+#ifdef HAS_XRC
+    } else if (dev->trans == IBV_QPT_RC || dev->trans == IBV_QPT_XRC) {
+#else
+    } else if (dev->trans == IBV_QPT_RC) {
+#endif
+        /* Modify queue pair to RTR */
+        flags = IBV_QP_STATE              |
+                IBV_QP_AV                 |
+                IBV_QP_PATH_MTU           |
+                IBV_QP_DEST_QPN           |
+                IBV_QP_RQ_PSN             |
+                IBV_QP_MAX_DEST_RD_ATOMIC |
+                IBV_QP_MIN_RNR_TIMER;
+        if (ibv_modify_qp(dev->qp, &rtr_attr, flags) != 0)
+            error(SYS, "failed to modify QP to RTR");
+
+        /* Modify queue pair to RTS */
+        flags = IBV_QP_STATE     |
+                IBV_QP_TIMEOUT   |
+                IBV_QP_RETRY_CNT |
+                IBV_QP_RNR_RETRY |
+                IBV_QP_SQ_PSN    |
+                IBV_QP_MAX_QP_RD_ATOMIC;
+        if (dev->trans == IBV_QPT_RC && dev->rnode.alt_lid)
+            flags |= IBV_QP_ALT_PATH | IBV_QP_PATH_MIG_STATE;
+        if (ibv_modify_qp(dev->qp, &rts_attr, flags) != 0)
+            error(SYS, "failed to modify QP to RTS");
+    } else if (dev->trans == IBV_QPT_UC) {
+        /* Modify queue pair to RTR */
+        flags = IBV_QP_STATE    |
+                IBV_QP_AV       |
+                IBV_QP_PATH_MTU |
+                IBV_QP_DEST_QPN |
+                IBV_QP_RQ_PSN;
+        if (ibv_modify_qp(dev->qp, &rtr_attr, flags) != 0)
+            error(SYS, "failed to modify QP to RTR");
+
+        /* Modify queue pair to RTS */
+        flags = IBV_QP_STATE |
+                IBV_QP_SQ_PSN;
+        if (dev->rnode.alt_lid)
+            flags |= IBV_QP_ALT_PATH | IBV_QP_PATH_MIG_STATE;
+        if (ibv_modify_qp(dev->qp, &rts_attr, flags) != 0)
+            error(SYS, "failed to modify QP to RTS");
+    }
+}
+
+
+/*
+ * Close an InfiniBand device, part 1.
+ */
+static void
+ib_close1(DEVICE *dev)
+{
+    if (dev->qp)
+        ibv_destroy_qp(dev->qp);
+    if (dev->srq)
+        ibv_destroy_srq(dev->srq);
+#ifdef HAS_XRC
+    if (dev->xrc)
+        ibv_close_xrc_domain(dev->xrc);
+#endif
+}
+
+
+/*
+ * Close an InfiniBand device, part 2.
+ */
+static void
+ib_close2(DEVICE *dev)
+{
+    if (dev->ib.context)
+        ibv_close_device(dev->ib.context);
+    if (dev->ib.devlist)
+        free(dev->ib.devlist);
+}
+
+
+/*
+ * Cause a path migration to happen.
+ */
+static void
+ib_migrate(DEVICE *dev)
+{
+    if (!Req.alt_port)
+        return;
+    /* Only migrate once. */
+    Req.alt_port = 0;
+    if (dev->trans != IBV_QPT_RC && dev->trans != IBV_QPT_UC)
+        return;
+
+    {
+        struct ibv_qp_attr attr ={
+            .path_mig_state  = IBV_MIG_MIGRATED,
+        };
+
+        if (ibv_modify_qp(dev->qp, &attr, IBV_QP_PATH_MIG_STATE) != SUCCESS0)
+            error(SYS, "failed to modify QP to Migrated state");
+    }
+}
+
+
+/*
+ * Post an atomic.
+ */
+static void
+ib_post_atomic(DEVICE *dev, ATOMIC atomic, int wrid,
+                            int offset, uint64_t compare_add, uint64_t swap)
+{
+    struct ibv_sge sge ={
+        .addr   = (uintptr_t)dev->buffer + offset,
+        .length = sizeof(uint64_t),
+        .lkey   = dev->mr->lkey
+    };
+    struct ibv_send_wr wr ={
+        .wr_id      = wrid,
+        .sg_list    = &sge,
+        .num_sge    = 1,
+        .send_flags = IBV_SEND_SIGNALED,
+        .wr = {
+            .atomic = {
+                .remote_addr = dev->rnode.vaddr,
+                .rkey        = dev->rnode.rkey,
+            }
+        }
+    };
+    struct ibv_send_wr *badwr;
+
+    if (atomic == COMPARE_SWAP) {
+        wr.opcode = IBV_WR_ATOMIC_CMP_AND_SWP;
+        wr.wr.atomic.compare_add = compare_add;
+        wr.wr.atomic.swap = swap;
+    } else if (atomic == FETCH_ADD) {
+        wr.opcode = IBV_WR_ATOMIC_FETCH_AND_ADD;
+        wr.wr.atomic.compare_add = compare_add;
+    }
+
+    errno = 0;
+    if (ibv_post_send(dev->qp, &wr, &badwr) != SUCCESS0) {
+        if (Finished && errno == EINTR)
+            return;
+        if (atomic == COMPARE_SWAP)
+            error(SYS, "failed to post compare and swap");
+        else if (atomic == FETCH_ADD)
+            error(SYS, "failed to post fetch and add");
+        else
+            error(BUG, "bad atomic: %d", atomic);
+    }
+
+    LStat.s.no_bytes += sizeof(uint64_t);
+    LStat.s.no_msgs++;
+}
+
+
+/*
+ * The standard version to post sends that most of the test routines call.
+ * Post n sends.
+ */
+static void
+rd_post_send_std(DEVICE *dev, int n)
+{
+    rd_post_send(dev, 0, dev->msg_size, 0, n, 1);
+}
+
+
+/*
+ * Post one or more sends.
+ */
+static void
+rd_post_send(DEVICE *dev, int off, int len, int inc, int rep, int stat)
+{
+    struct ibv_sge sge ={
+        .addr   = (uintptr_t) &dev->buffer[off],
+        .length = len,
+        .lkey   = dev->mr->lkey
+    };
+    struct ibv_send_wr wr ={
+        .wr_id      = WRID_SEND,
+        .sg_list    = &sge,
+        .num_sge    = 1,
+        .opcode     = IBV_WR_SEND,
+        .send_flags = IBV_SEND_SIGNALED,
+    };
+    struct ibv_send_wr *badwr;
+
+    if (dev->trans == IBV_QPT_UD) {
+        wr.wr.ud.ah          = dev->ah;
+        wr.wr.ud.remote_qpn  = dev->rnode.qpn;
+        wr.wr.ud.remote_qkey = dev->qkey;
+    }
+#ifdef HAS_XRC
+    else if (dev->trans == IBV_QPT_XRC)
+        wr.xrc_remote_srq_num = dev->rnode.srqn;
+#endif
+
+    if (dev->msg_size <= dev->max_inline)
+        wr.send_flags |= IBV_SEND_INLINE;
+
+    errno = 0;
+    while (!Finished && rep-- > 0) {
+        if (ibv_post_send(dev->qp, &wr, &badwr) != SUCCESS0) {
+            if (Finished && errno == EINTR)
+                return;
+            error(SYS, "failed to post send");
+        }
+        sge.addr += inc;
+        sge.length += inc;
+        if (stat) {
+            LStat.s.no_bytes += dev->msg_size;
+            LStat.s.no_msgs++;
+        }
+    }
+}
+
+
+/*
+ * Post n receives.
+ */
+static void
+rd_post_recv_std(DEVICE *dev, int n)
+{
+    struct ibv_sge sge ={
+        .addr   = (uintptr_t) dev->buffer,
+        .length = dev->buf_size,
+        .lkey   = dev->mr->lkey
+    };
+    struct ibv_recv_wr wr ={
+        .wr_id      = WRID_RECV,
+        .sg_list    = &sge,
+        .num_sge    = 1,
+    };
+    struct ibv_recv_wr *badwr;
+
+    errno = 0;
+    while (!Finished && n-- > 0) {
+        int stat;
+
+        if (dev->srq)
+            stat = ibv_post_srq_recv(dev->srq, &wr, &badwr);
+        else
+            stat = ibv_post_recv(dev->qp, &wr, &badwr);
+
+        if (stat != SUCCESS0) {
+            if (Finished && errno == EINTR)
+                return;
+            error(SYS, "failed to post receive");
+        }
+    }
+}
+
+
+/*
+ * Post n RDMA requests.
+ */
+static void
+rd_post_rdma_std(DEVICE *dev, ibv_op opcode, int n)
+{
+    struct ibv_sge sge ={
+        .addr   = (uintptr_t) dev->buffer,
+        .length = dev->msg_size,
+        .lkey   = dev->mr->lkey
+    };
+    struct ibv_send_wr wr ={
+        .wr_id      = WRID_RDMA,
+        .sg_list    = &sge,
+        .num_sge    = 1,
+        .opcode     = opcode,
+        .send_flags = IBV_SEND_SIGNALED,
+        .wr = {
+            .rdma = {
+                .remote_addr = dev->rnode.vaddr,
+                .rkey        = dev->rnode.rkey
+            }
+        }
+    };
+    struct ibv_send_wr *badwr;
+
+    if (opcode != IBV_WR_RDMA_READ && dev->msg_size <= dev->max_inline)
+        wr.send_flags |= IBV_SEND_INLINE;
+    errno = 0;
+    while (!Finished && n--) {
+        if (ibv_post_send(dev->qp, &wr, &badwr) != SUCCESS0) {
+            if (Finished && errno == EINTR)
+                return;
+            error(SYS, "failed to post %s", opcode_name(wr.opcode));
+        }
+        if (opcode != IBV_WR_RDMA_READ) {
+            LStat.s.no_bytes += dev->msg_size;
+            LStat.s.no_msgs++;
+        }
+    }
+}
+
+
+/*
+ * Poll the completion queue.
+ */
+static int
+rd_poll(DEVICE *dev, struct ibv_wc *wc, int nwc)
+{
+    int n;
+
+    if (!Req.poll_mode && !Finished) {
+        void *ectx;
+        struct ibv_cq *ecq;
+
+        if (ibv_get_cq_event(dev->channel, &ecq, &ectx) != SUCCESS0)
+            return maybe(0, "failed to get CQ event");
+        if (ecq != dev->cq)
+            error(0, "CQ event for unknown CQ");
+        if (ibv_req_notify_cq(dev->cq, 0) != SUCCESS0)
+            return maybe(0, "failed to request CQ notification");
+	ibv_ack_cq_events(dev->cq, 1);
+    }
+    n = ibv_poll_cq(dev->cq, nwc, wc);
+    if (n < 0)
+        return maybe(0, "CQ poll failed");
+    return n;
+}
+
+
+/*
+ * We encountered an error in a system call which might simply have been
+ * interrupted by the alarm that signaled completion of the test.  Generate the
+ * error if appropriate or return the requested value.  Final return is just to
+ * silence the compiler.
+ */
+static int
+maybe(int val, char *msg)
+{
+    if (Finished && errno == EINTR)
+        return val;
+    error(SYS, msg);
+    return 0;
+}
+
+
+/*
+ * Encode a NODE structure into a data stream.
+ */
+static void
+enc_node(NODE *host)
+{
+    enc_int(host->vaddr,     sizeof(host->vaddr));
+    enc_int(host->lid,       sizeof(host->lid));
+    enc_int(host->qpn,       sizeof(host->qpn));
+    enc_int(host->psn,       sizeof(host->psn));
+    enc_int(host->srqn,      sizeof(host->srqn));
+    enc_int(host->rkey,      sizeof(host->rkey));
+    enc_int(host->alt_lid,   sizeof(host->alt_lid));
+    enc_int(host->rd_atomic, sizeof(host->rd_atomic));
+}
+
+
+/*
+ * Decode a NODE structure from a data stream.
+ */
+static void
+dec_node(NODE *host)
+{
+    host->vaddr     = dec_int(sizeof(host->vaddr));
+    host->lid       = dec_int(sizeof(host->lid));
+    host->qpn       = dec_int(sizeof(host->qpn));
+    host->psn       = dec_int(sizeof(host->psn));
+    host->srqn      = dec_int(sizeof(host->srqn));
+    host->rkey      = dec_int(sizeof(host->rkey));
+    host->alt_lid   = dec_int(sizeof(host->alt_lid));
+    host->rd_atomic = dec_int(sizeof(host->rd_atomic));
+}
+
+
+/*
+ * Handle a CQ error and return true if it is recoverable.
+ */
+static void
+do_error(int status, uint64_t *errors)
+{
+    ++*errors;
+    cq_error(status);
+}
+
+
+/*
+ * Print out a CQ error given a status.
+ */
+static void
+cq_error(int status)
+{
+    int i;
+
+    for (i = 0; i < cardof(CQErrors); ++i)
+        if (CQErrors[i].value == status)
+            error(0, "%s failed: %s", TestName, CQErrors[i].name);
+    error(0, "%s failed: CQ error %d", TestName, status);
+}
+
+
+/*
+ * Return the name of an opcode.
+ */
+static char *
+opcode_name(int opcode)
+{
+    int i;
+
+    for (i = 0; i < cardof(Opcodes); ++i)
+        if (Opcodes[i].value == opcode)
+            return Opcodes[i].name;
+    return "unknown operation";
+}
diff --git a/src/rds.c b/src/rds.c
new file mode 100644
index 0000000..c9b6023
--- /dev/null
+++ b/src/rds.c
@@ -0,0 +1,520 @@
+/*
+ * qperf - handle RDS tests.
+ *
+ * Copyright (c) 2012 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2002-2009 Johann George.  All rights reserved.
+ * Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#define _GNU_SOURCE
+#include <errno.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include "qperf.h"
+
+
+/*
+ * Parameters.
+ */
+#ifndef AF_RDS
+/*
+ * Before RDS was part of the Linux kernel, it was a module that picked
+ * an address famiy value and exported it via /proc.  Use the /proc
+ * value, if present, otherwise fall back to the actual value.
+ */
+#define DEFAULT_AF_RDS 21		/* actual value for AF_RDS */
+static int get_af_rds(void)
+{
+	static int af_rds = -1;
+
+	if (af_rds == -1) {
+		FILE *fp;
+		int read_fail = 0;
+
+		if ((fp = fopen("/proc/sys/net/rds/pf_rds", "r")) != NULL) {
+			int n, val;
+
+			n = fscanf(fp, "%d", &val);
+			fclose(fp);
+			if ((n == 1)) {
+				/* success */
+				af_rds = val;
+			} else {
+				read_fail = 1;
+				goto read_fail;
+			}
+		} else {
+read_fail:
+			error(RET, "AF_RDS not defined.  Unable to %s "
+				"/proc/sys/net/rds/pf_rds.  Using %d.\n",
+				read_fail ? "read":"open", DEFAULT_AF_RDS);
+			af_rds = DEFAULT_AF_RDS;
+		}
+	}
+
+	return af_rds;
+}
+#define AF_RDS get_af_rds()
+#endif
+
+
+/*
+ * Function prototypes.
+ */
+static void     client_get_hosts(char *lhost, char *rhost);
+static void     connect_tcp(char *server, char *port, SS *addr,
+                                                    socklen_t *len, int *fd);
+static void     get_socket_ip(SA *saptr, int salen, char *ip, int n);
+static int      get_socket_port(int fd);
+static int      init(void);
+static void     qgetnameinfo(SA *sa, socklen_t salen, char *host,
+                    size_t hostlen, char *serv, size_t servlen, int flags);
+static int      rds_socket(char *host, int port);
+static void     rds_makeaddr(SS *addr, socklen_t *len, char *host, int port);
+static void     set_parameters(long msgSize);
+static void     server_get_hosts(char *lhost, char *rhost);
+static void     set_socket_buffer_size(int fd);
+
+
+/*
+ * Static variables.
+ */
+static SS        RAddr;
+static socklen_t RLen;
+
+
+/*
+ * Measure RDS bandwidth (client side).
+ */
+void
+run_client_rds_bw(void)
+{
+    char *buf;
+    int sockfd;
+
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    set_parameters(8*1024);
+    client_send_request();
+    sockfd = init();
+    buf = qmalloc(Req.msg_size);
+    sync_test();
+    while (!Finished) {
+        int n = sendto(sockfd, buf, Req.msg_size, 0, (SA *)&RAddr, RLen);
+
+        if (Finished)
+            break;
+        if (n != Req.msg_size) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockfd);
+    show_results(BANDWIDTH);
+}
+
+
+/*
+ * Measure RDS bandwidth (server side).
+ */
+void
+run_server_rds_bw(void)
+{
+    char *buf;
+    int sockfd;
+
+    sockfd = init();
+    sync_test();
+    buf = qmalloc(Req.msg_size);
+    while (!Finished) {
+        int n = read(sockfd, buf, Req.msg_size);
+        if (Finished)
+            break;
+        if (n != Req.msg_size) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+        if (Req.access_recv)
+            touch_data(buf, Req.msg_size);
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockfd);
+}
+
+
+/*
+ * Measure RDS latency (client side).
+ */
+void
+run_client_rds_lat(void)
+{
+    char *buf;
+    int sockfd;
+
+    set_parameters(1);
+    client_send_request();
+    sockfd = init();
+    buf = qmalloc(Req.msg_size);
+    sync_test();
+    while (!Finished) {
+        int n = sendto(sockfd, buf, Req.msg_size, 0, (SA *)&RAddr, RLen);
+
+        if (Finished)
+            break;
+        if (n != Req.msg_size) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+
+        n = read(sockfd, buf, Req.msg_size);
+        if (Finished)
+            break;
+        if (n != Req.msg_size) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockfd);
+    show_results(LATENCY);
+}
+
+
+/*
+ * Measure RDS latency (server side).
+ */
+void
+run_server_rds_lat(void)
+{
+    char *buf;
+    int sockfd;
+
+    sockfd = init();
+    sync_test();
+    buf = qmalloc(Req.msg_size);
+    while (!Finished) {
+        SS raddr;
+        socklen_t rlen = sizeof(raddr);
+        int n = recvfrom(sockfd, buf, Req.msg_size, 0, (SA *)&raddr, &rlen);
+
+        if (Finished)
+            break;
+        if (n != Req.msg_size) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+
+        n = sendto(sockfd, buf, Req.msg_size, 0, (SA *)&raddr, rlen);
+        if (Finished)
+            break;
+        if (n != Req.msg_size) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockfd);
+}
+
+
+/*
+ * Set default IP parameters and ensure that any that are set are being used.
+ */
+static void
+set_parameters(long msgSize)
+{
+    setp_u32(0, L_MSG_SIZE, msgSize);
+    setp_u32(0, R_MSG_SIZE, msgSize);
+    par_use(L_PORT);
+    par_use(R_PORT);
+    par_use(L_SOCK_BUF_SIZE);
+    par_use(R_SOCK_BUF_SIZE);
+    opt_check();
+}
+
+
+/*
+ * Initialize and return open socket.
+ */
+static int
+init(void)
+{
+    int sockfd;
+    uint32_t lport;
+    uint32_t rport;
+    char lhost[NI_MAXHOST];
+    char rhost[NI_MAXHOST];
+
+    if (is_client())
+        client_get_hosts(lhost, rhost);
+    else
+        server_get_hosts(lhost, rhost);
+    sockfd = rds_socket(lhost, Req.port);
+    lport = get_socket_port(sockfd);
+    encode_uint32(&lport, lport);
+    send_mesg(&lport, sizeof(lport), "RDS port");
+    recv_mesg(&rport, sizeof(rport), "RDS port");
+    rport = decode_uint32(&rport);
+    rds_makeaddr(&RAddr, &RLen, rhost, rport);
+    return sockfd;
+}
+
+
+/*
+ * Have an exchange with the client over TCP/IP and get the IP of our local
+ * host.
+ */
+static void
+server_get_hosts(char *lhost, char *rhost)
+{
+    int fd, lfd;
+    uint32_t port;
+    struct sockaddr_in laddr, raddr;
+    socklen_t rlen;
+
+    lfd = socket(AF_INET, SOCK_STREAM, 0);
+    if (lfd < 0)
+        error(SYS, "socket failed");
+    setsockopt_one(lfd, SO_REUSEADDR);
+
+    memset(&laddr, 0, sizeof(laddr));
+    laddr.sin_family = AF_INET;
+    laddr.sin_addr.s_addr = INADDR_ANY;
+    laddr.sin_port = htons(0);
+    if (bind(lfd, (SA *)&laddr, sizeof(laddr)) < 0)
+        error(SYS, "bind INET failed");
+
+    port = get_socket_port(lfd);
+    encode_uint32(&port, port);
+    send_mesg(&port, sizeof(port), "TCP IPv4 server port");
+
+    if (listen(lfd, 1) < 0)
+        error(SYS, "listen failed");
+
+    rlen = sizeof(raddr);
+    fd = accept(lfd, (SA *)&raddr, &rlen);
+    if (fd < 0)
+        error(SYS, "accept failed");
+    close(lfd);
+    get_socket_ip((SA *)&raddr, rlen, rhost, NI_MAXHOST);
+    send_mesg(rhost, NI_MAXHOST, "client IP");
+    recv_mesg(lhost, NI_MAXHOST, "server IP");
+    close(fd);
+}
+
+
+/*
+ * Have an exchange with the server over TCP/IP and get the IPs of our local
+ * and the remote host.
+ */
+static void
+client_get_hosts(char *lhost, char *rhost)
+{
+    SS raddr;
+    socklen_t rlen;
+    char *service;
+    uint32_t port;
+    int fd = -1;
+
+    recv_mesg(&port, sizeof(port), "TCP IPv4 server port");
+    port = decode_uint32(&port);
+    service = qasprintf("%d", port);
+    connect_tcp(ServerName, service, &raddr, &rlen, &fd);
+    free(service);
+    get_socket_ip((SA *)&raddr, rlen, rhost, NI_MAXHOST);
+    send_mesg(rhost, NI_MAXHOST, "server IP");
+    recv_mesg(lhost, NI_MAXHOST, "client IP");
+    close(fd);
+}
+
+
+/*
+ * Make a RDS socket.
+ */
+static int
+rds_socket(char *host, int port)
+{
+    int sockfd;
+    SS sockaddr;
+    socklen_t socklen;
+
+    sockfd = socket(AF_RDS, SOCK_SEQPACKET, 0);
+    if (sockfd < 0)
+        error(SYS, "socket failed");
+    setsockopt_one(sockfd, SO_REUSEADDR);
+    rds_makeaddr(&sockaddr, &socklen, host, port);
+    if (bind(sockfd, (SA *)&sockaddr, socklen) != SUCCESS0)
+        error(SYS, "bind RDS failed");
+    set_socket_buffer_size(sockfd);
+    return sockfd;
+}
+
+
+/*
+ * Make a RDS address.
+ */
+static void
+rds_makeaddr(SS *addr, socklen_t *len, char *host, int port)
+{
+    struct sockaddr_in *sap = (struct sockaddr_in *)addr;
+
+    memset(sap, 0, sizeof(*sap));
+    sap->sin_family = AF_INET;
+    inet_pton(AF_INET, host, &sap->sin_addr.s_addr);
+    sap->sin_port = htons(port);
+    *len = sizeof(struct sockaddr_in);
+}
+
+
+/*
+ * Connect over TCP/IP to the server/port and return the socket structure, its
+ * length and the open socket file descriptor.
+ */
+static void
+connect_tcp(char *server, char *port, SS *addr, socklen_t *len, int *fd)
+{
+    int stat;
+    struct addrinfo *aip, *ailist;
+    struct addrinfo hints ={
+        .ai_flags    = AI_NUMERICSERV,
+        .ai_family   = AF_INET,
+        .ai_socktype = SOCK_STREAM
+    };
+
+    stat = getaddrinfo(server, port, &hints, &ailist);
+    if (stat != 0)
+        error(0, "getaddrinfo failed: %s", gai_strerror(stat));
+    for (aip = ailist; aip; aip = aip->ai_next) {
+        if (fd) {
+            *fd = socket(aip->ai_family, aip->ai_socktype, aip->ai_protocol);
+            if (*fd < 0)
+                error(SYS, "socket failed");
+            if (connect(*fd, aip->ai_addr, aip->ai_addrlen) < 0)
+                error(SYS, "connect failed");
+            break;
+        }
+        break;
+    }
+    if (!aip)
+        error(0, "connect_tcp failed");
+    memcpy(addr, aip->ai_addr, aip->ai_addrlen);
+    *len = aip->ai_addrlen;
+    freeaddrinfo(ailist);
+}
+
+
+/*
+ * Given an open socket, return the port associated with it.  There must be a
+ * more efficient way to do this that is portable.
+ */
+static int
+get_socket_port(int fd)
+{
+    int port;
+    char p[NI_MAXSERV];
+    SS sa;
+    socklen_t salen = sizeof(sa);
+
+    if (getsockname(fd, (SA *)&sa, &salen) < 0)
+        error(SYS, "getsockname failed");
+    qgetnameinfo((SA *)&sa, salen, 0, 0, p, sizeof(p), NI_NUMERICSERV);
+    port = atoi(p);
+    if (!port)
+        error(SYS, "invalid port");
+    return port;
+}
+
+
+/*
+ * Given a socket, return its IP address.
+ */
+static void
+get_socket_ip(SA *saptr, int salen, char *ip, int n)
+{
+    qgetnameinfo(saptr, salen, ip, n, 0, 0, NI_NUMERICHOST);
+}
+
+
+/*
+ * Call getnameinfo and exit with an error on failure.
+ */
+static void
+qgetnameinfo(SA *sa, socklen_t salen, char *host, size_t hostlen,
+                                      char *serv, size_t servlen, int flags)
+{
+    int stat = getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
+
+    if (stat < 0)
+        error(0, "getnameinfo failed: %s", gai_strerror(stat));
+}
+
+
+/*
+ * Set both the send and receive socket buffer sizes.
+ */
+static void
+set_socket_buffer_size(int fd)
+{
+    int size = Req.sock_buf_size;
+
+    if (!size)
+        return;
+    if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0)
+        error(SYS, "failed to set send buffer size on socket");
+    if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) < 0)
+        error(SYS, "failed to set receive buffer size on socket");
+}
diff --git a/src/socket.c b/src/socket.c
new file mode 100644
index 0000000..bdabf7d
--- /dev/null
+++ b/src/socket.c
@@ -0,0 +1,819 @@
+/*
+ * qperf - handle socket tests.
+ *
+ * Copyright (c) 2002-2009 Johann George.  All rights reserved.
+ * Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#define _GNU_SOURCE
+#include <errno.h>
+#include <netdb.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "qperf.h"
+
+
+/*
+ * Parameters.
+ */
+#define AF_INET_SDP 27                  /* Family for SDP */
+
+
+/*
+ * Kinds.
+ */
+typedef enum {
+    K_SCTP,
+    K_SDP,
+    K_TCP,
+    K_UDP,
+} KIND;
+
+char *Kinds[] ={ "SCTP", "SDP", "TCP", "UDP", };
+
+
+/*
+ * Function prototypes.
+ */
+static void     client_init(int *fd, KIND kind);
+static void     datagram_client_bw(KIND kind);
+static void     datagram_client_lat(KIND kind);
+static void     datagram_server_bw(KIND kind);
+static void     datagram_server_init(int *fd, KIND kind);
+static void     datagram_server_lat(KIND kind);
+static void     get_socket_port(int fd, uint32_t *port);
+static AI      *getaddrinfo_kind(int serverflag, KIND kind, int port);
+static void     ip_parameters(long msgSize);
+static char    *kind_name(KIND kind);
+static int      recv_full(int fd, void *ptr, int len);
+static int      send_full(int fd, void *ptr, int len);
+static void     set_socket_buffer_size(int fd);
+static void     stream_client_bw(KIND kind);
+static void     stream_client_lat(KIND kind);
+static void     stream_server_bw(KIND kind);
+static void     stream_server_init(int *fd, KIND kind);
+static void     stream_server_lat(KIND kind);
+
+
+/*
+ * Measure SCTP bandwidth (client side).
+ */
+void
+run_client_sctp_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    ip_parameters(32*1024);
+    stream_client_bw(K_SCTP);
+}
+
+
+/*
+ * Measure SCTP bandwidth (server side).
+ */
+void
+run_server_sctp_bw(void)
+{
+    stream_server_bw(K_SCTP);
+}
+
+
+/*
+ * Measure SCTP latency (client side).
+ */
+void
+run_client_sctp_lat(void)
+{
+    ip_parameters(1);
+    stream_client_lat(K_SCTP);
+}
+
+
+/*
+ * Measure SCTP latency (server side).
+ */
+void
+run_server_sctp_lat(void)
+{
+    stream_server_lat(K_SCTP);
+}
+
+
+/*
+ * Measure SDP bandwidth (client side).
+ */
+void
+run_client_sdp_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    ip_parameters(64*1024);
+    stream_client_bw(K_SDP);
+}
+
+
+/*
+ * Measure SDP bandwidth (server side).
+ */
+void
+run_server_sdp_bw(void)
+{
+    stream_server_bw(K_SDP);
+}
+
+
+/*
+ * Measure SDP latency (client side).
+ */
+void
+run_client_sdp_lat(void)
+{
+    ip_parameters(1);
+    stream_client_lat(K_SDP);
+}
+
+
+/*
+ * Measure SDP latency (server side).
+ */
+void
+run_server_sdp_lat(void)
+{
+    stream_server_lat(K_SDP);
+}
+
+
+/*
+ * Measure TCP bandwidth (client side).
+ */
+void
+run_client_tcp_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    ip_parameters(64*1024);
+    stream_client_bw(K_TCP);
+}
+
+
+/*
+ * Measure TCP bandwidth (server side).
+ */
+void
+run_server_tcp_bw(void)
+{
+    stream_server_bw(K_TCP);
+}
+
+
+/*
+ * Measure TCP latency (client side).
+ */
+void
+run_client_tcp_lat(void)
+{
+    ip_parameters(1);
+    stream_client_lat(K_TCP);
+}
+
+
+/*
+ * Measure TCP latency (server side).
+ */
+void
+run_server_tcp_lat(void)
+{
+    stream_server_lat(K_TCP);
+}
+
+
+/*
+ * Measure UDP bandwidth (client side).
+ */
+void
+run_client_udp_bw(void)
+{
+    par_use(L_ACCESS_RECV);
+    par_use(R_ACCESS_RECV);
+    ip_parameters(32*1024);
+    datagram_client_bw(K_UDP);
+}
+
+
+/*
+ * Measure UDP bandwidth (server side).
+ */
+void
+run_server_udp_bw(void)
+{
+    datagram_server_bw(K_UDP);
+}
+
+
+/*
+ * Measure UDP latency (client side).
+ */
+void
+run_client_udp_lat(void)
+{
+    ip_parameters(1);
+    datagram_client_lat(K_UDP);
+}
+
+
+/*
+ * Measure UDP latency (server side).
+ */
+void
+run_server_udp_lat(void)
+{
+    datagram_server_lat(K_UDP);
+}
+
+
+/*
+ * Measure stream bandwidth (client side).
+ */
+static void
+stream_client_bw(KIND kind)
+{
+    char *buf;
+    int sockFD;
+
+    client_init(&sockFD, kind);
+    buf = qmalloc(Req.msg_size);
+    sync_test();
+    while (!Finished) {
+        int n = send_full(sockFD, buf, Req.msg_size);
+
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockFD);
+    show_results(BANDWIDTH);
+}
+
+
+/*
+ * Measure stream bandwidth (server side).
+ */
+static void
+stream_server_bw(KIND kind)
+{
+    int sockFD = -1;
+    char *buf = 0;
+
+    stream_server_init(&sockFD, kind);
+    sync_test();
+    buf = qmalloc(Req.msg_size);
+    while (!Finished) {
+        int n = recv_full(sockFD, buf, Req.msg_size);
+
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+        if (Req.access_recv)
+            touch_data(buf, Req.msg_size);
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    if (sockFD >= 0)
+        close(sockFD);
+}
+
+
+/*
+ * Measure stream latency (client side).
+ */
+static void
+stream_client_lat(KIND kind)
+{
+    char *buf;
+    int sockFD;
+
+    client_init(&sockFD, kind);
+    buf = qmalloc(Req.msg_size);
+    sync_test();
+    while (!Finished) {
+        int n = send_full(sockFD, buf, Req.msg_size);
+
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+
+        n = recv_full(sockFD, buf, Req.msg_size);
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockFD);
+    show_results(LATENCY);
+}
+
+
+/*
+ * Measure stream latency (server side).
+ */
+static void
+stream_server_lat(KIND kind)
+{
+    int sockFD = -1;
+    char *buf = 0;
+
+    stream_server_init(&sockFD, kind);
+    sync_test();
+    buf = qmalloc(Req.msg_size);
+    while (!Finished) {
+        int n = recv_full(sockFD, buf, Req.msg_size);
+
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+
+        n = send_full(sockFD, buf, Req.msg_size);
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockFD);
+}
+
+
+/*
+ * Measure datagram bandwidth (client side).
+ */
+static void
+datagram_client_bw(KIND kind)
+{
+    char *buf;
+    int sockFD;
+
+    client_init(&sockFD, kind);
+    buf = qmalloc(Req.msg_size);
+    sync_test();
+    while (!Finished) {
+        int n = write(sockFD, buf, Req.msg_size);
+
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockFD);
+    show_results(BANDWIDTH_SR);
+}
+
+
+/*
+ * Measure datagram bandwidth (server side).
+ */
+static void
+datagram_server_bw(KIND kind)
+{
+    int sockFD;
+    char *buf = 0;
+
+    datagram_server_init(&sockFD, kind);
+    sync_test();
+    buf = qmalloc(Req.msg_size);
+    while (!Finished) {
+        int n = recv(sockFD, buf, Req.msg_size, 0);
+
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+        if (Req.access_recv)
+            touch_data(buf, Req.msg_size);
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockFD);
+}
+
+
+/*
+ * Measure datagram latency (client side).
+ */
+static void
+datagram_client_lat(KIND kind)
+{
+    char *buf;
+    int sockFD;
+
+    client_init(&sockFD, kind);
+    buf = qmalloc(Req.msg_size);
+    sync_test();
+    while (!Finished) {
+        int n = write(sockFD, buf, Req.msg_size);
+
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+
+        n = read(sockFD, buf, Req.msg_size);
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockFD);
+    show_results(LATENCY);
+}
+
+
+/*
+ * Measure datagram latency (server side).
+ */
+static void
+datagram_server_lat(KIND kind)
+{
+    int sockfd;
+    char *buf = 0;
+
+    datagram_server_init(&sockfd, kind);
+    sync_test();
+    buf = qmalloc(Req.msg_size);
+    while (!Finished) {
+        SS clientAddr;
+        socklen_t clientLen = sizeof(clientAddr);
+        int n = recvfrom(sockfd, buf, Req.msg_size, 0,
+                         (SA *)&clientAddr, &clientLen);
+
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.r.no_errs++;
+            continue;
+        }
+        LStat.r.no_bytes += n;
+        LStat.r.no_msgs++;
+
+        n = sendto(sockfd, buf, Req.msg_size, 0, (SA *)&clientAddr, clientLen);
+        if (Finished)
+            break;
+        if (n < 0) {
+            LStat.s.no_errs++;
+            continue;
+        }
+        LStat.s.no_bytes += n;
+        LStat.s.no_msgs++;
+    }
+    stop_test_timer();
+    exchange_results();
+    free(buf);
+    close(sockfd);
+}
+
+
+/*
+ * Set default IP parameters and ensure that any that are set are being used.
+ */
+static void
+ip_parameters(long msgSize)
+{
+    setp_u32(0, L_MSG_SIZE, msgSize);
+    setp_u32(0, R_MSG_SIZE, msgSize);
+    par_use(L_PORT);
+    par_use(R_PORT);
+    par_use(L_SOCK_BUF_SIZE);
+    par_use(R_SOCK_BUF_SIZE);
+    opt_check();
+}
+
+
+/*
+ * Socket client initialization.
+ */
+static void
+client_init(int *fd, KIND kind)
+{
+    uint32_t rport;
+    AI *ai, *ailist;
+
+    client_send_request();
+    recv_mesg(&rport, sizeof(rport), "port");
+    rport = decode_uint32(&rport);
+    ailist = getaddrinfo_kind(0, kind, rport);
+    for (ai = ailist; ai; ai = ai->ai_next) {
+        if (!ai->ai_family)
+            continue;
+        *fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+	setsockopt_one(*fd, SO_REUSEADDR);
+        if (connect(*fd, ai->ai_addr, ai->ai_addrlen) == SUCCESS0)
+            break;
+        close(*fd);
+    }
+    freeaddrinfo(ailist);
+    if (!ai)
+        error(0, "could not make %s connection to server", kind_name(kind));
+    if (Debug) {
+        uint32_t lport;
+        get_socket_port(*fd, &lport);
+        debug("sending from %s port %d to %d", kind_name(kind), lport, rport);
+    }
+}
+
+
+/*
+ * Socket server initialization.
+ */
+static void
+stream_server_init(int *fd, KIND kind)
+{
+    uint32_t port;
+    AI *ai;
+    int listenFD = -1;
+
+    AI *ailist = getaddrinfo_kind(1, kind,  Req.port);
+    for (ai = ailist; ai; ai = ai->ai_next) {
+        if (!ai->ai_family)
+            continue;
+        listenFD = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+        if (listenFD < 0)
+            continue;
+        setsockopt_one(listenFD, SO_REUSEADDR);
+        if (bind(listenFD, ai->ai_addr, ai->ai_addrlen) == SUCCESS0)
+            break;
+        close(listenFD);
+        listenFD = -1;
+    }
+    freeaddrinfo(ailist);
+    if (!ai)
+        error(0, "unable to make %s socket", kind_name(kind));
+    if (listen(listenFD, 1) < 0)
+        error(SYS, "listen failed");
+
+    get_socket_port(listenFD, &port);
+    encode_uint32(&port, port);
+    send_mesg(&port, sizeof(port), "port");
+    *fd = accept(listenFD, 0, 0);
+    if (*fd < 0)
+        error(SYS, "accept failed");
+    debug("accepted %s connection", kind_name(kind));
+    set_socket_buffer_size(*fd);
+    close(listenFD);
+    debug("receiving to %s port %d", kind_name(kind), port);
+}
+
+
+/*
+ * Datagram server initialization.
+ */
+static void
+datagram_server_init(int *fd, KIND kind)
+{
+    uint32_t port;
+    AI *ai;
+    int sockfd = -1;
+
+    AI *ailist = getaddrinfo_kind(1, kind, Req.port);
+    for (ai = ailist; ai; ai = ai->ai_next) {
+        if (!ai->ai_family)
+            continue;
+        sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+        if (sockfd < 0)
+            continue;
+        setsockopt_one(sockfd, SO_REUSEADDR);
+        if (bind(sockfd, ai->ai_addr, ai->ai_addrlen) == SUCCESS0)
+            break;
+        close(sockfd);
+        sockfd = -1;
+    }
+    freeaddrinfo(ailist);
+    if (!ai)
+        error(0, "unable to make %s socket", kind_name(kind));
+
+    set_socket_buffer_size(sockfd);
+    get_socket_port(sockfd, &port);
+    encode_uint32(&port, port);
+    send_mesg(&port, sizeof(port), "port");
+    *fd = sockfd;
+}
+
+
+/*
+ * A version of getaddrinfo that takes a numeric port and prints out an error
+ * on failure.
+ */
+static AI *
+getaddrinfo_kind(int serverflag, KIND kind, int port)
+{
+    AI *aip, *ailist;
+    AI hints ={
+        .ai_flags    = AI_NUMERICSERV,
+        .ai_family   = AF_UNSPEC,
+        .ai_socktype = SOCK_STREAM
+    };
+
+    if (serverflag)
+        hints.ai_flags |= AI_PASSIVE;
+    if (kind == K_UDP)
+        hints.ai_socktype = SOCK_DGRAM;
+
+    ailist = getaddrinfo_port(serverflag ? 0 : ServerName, port, &hints);
+    for (aip = ailist; aip; aip = aip->ai_next) {
+        if (kind == K_SDP) {
+            if (aip->ai_family == AF_INET || aip->ai_family == AF_INET6)
+                aip->ai_family = AF_INET_SDP;
+            else
+                aip->ai_family = 0;
+        } else if (kind == K_SCTP) {
+            if (aip->ai_protocol == IPPROTO_TCP)
+                aip->ai_protocol = IPPROTO_SCTP;
+            else
+                aip->ai_family = 0;
+        }
+    }
+    return ailist;
+}
+
+
+/*
+ * Set both the send and receive socket buffer sizes.
+ */
+static void
+set_socket_buffer_size(int fd)
+{
+    int size = Req.sock_buf_size;
+
+    if (!size)
+        return;
+    if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0)
+        error(SYS, "Failed to set send buffer size on socket");
+    if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) < 0)
+        error(SYS, "Failed to set receive buffer size on socket");
+}
+
+
+/*
+ * Given an open socket, return the port associated with it.  There must be a
+ * more efficient way to do this that is portable.
+ */
+static void
+get_socket_port(int fd, uint32_t *port)
+{
+    char p[NI_MAXSERV];
+    SS sa;
+    socklen_t salen = sizeof(sa);
+
+    if (getsockname(fd, (SA *)&sa, &salen) < 0)
+        error(SYS, "getsockname failed");
+    if (getnameinfo((SA *)&sa, salen, 0, 0, p, sizeof(p), NI_NUMERICSERV) < 0)
+        error(SYS, "getnameinfo failed");
+    *port = atoi(p);
+    if (!port)
+        error(0, "invalid port");
+}
+
+
+/*
+ * Send a complete message to a socket.  A zero byte write indicates an end of
+ * file which suggests that we are finished.
+ */
+static int
+send_full(int fd, void *ptr, int len)
+{
+    int n = len;
+
+    while (!Finished && n) {
+        int i = write(fd, ptr, n);
+
+        if (i < 0)
+            return i;
+        ptr += i;
+        n   -= i;
+        if (i == 0)
+            set_finished();
+    }
+    return len-n;
+}
+
+
+/*
+ * Receive a complete message from a socket.  A zero byte read indicates an end
+ * of file which suggests that we are finished.
+ */
+static int
+recv_full(int fd, void *ptr, int len)
+{
+    int n = len;
+
+    while (!Finished && n) {
+        int i = read(fd, ptr, n);
+
+        if (i < 0)
+            return i;
+        ptr += i;
+        n   -= i;
+        if (i == 0)
+            set_finished();
+    }
+    return len-n;
+}
+
+
+/*
+ * Return the name of a transport kind.
+ */
+static char *
+kind_name(KIND kind)
+{
+    if (kind < 0 || kind >= cardof(Kinds))
+        return "unknown type";
+    else
+        return Kinds[kind];
+}
diff --git a/src/support.c b/src/support.c
new file mode 100644
index 0000000..6c82bb0
--- /dev/null
+++ b/src/support.c
@@ -0,0 +1,673 @@
+/*
+ * qperf - support routines.
+ * Measure socket and RDMA performance.
+ *
+ * Copyright (c) 2002-2009 Johann George.  All rights reserved.
+ * Copyright (c) 2006-2009 QLogic Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#define _GNU_SOURCE
+#include <errno.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <signal.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include "qperf.h"
+
+
+/*
+ * Configurable parameters.
+ */
+#define ERROR_TIMEOUT   3               /* Error timeout in seconds */
+
+
+/*
+ * For convenience.
+ */
+typedef void (SIGFUNC)(int signo, siginfo_t *siginfo, void *ucontext);
+
+
+/*
+ * Function prototypes.
+ */
+static void     buf_app(char **pp, char *end, char *str);
+static void     buf_end(char **pp, char *end);
+static double   get_seconds(void);
+static void     remote_failure_error(void);
+static char    *remote_name(void);
+static int      send_recv_mesg(int sr, char *item, int fd, char *buf, int len);
+static SIGFUNC  sig_alrm_remote_failure;
+static SIGFUNC  sig_alrm_die;
+static void     timeout_set(int seconds, SIGFUNC sigfunc);
+static void     timeout_end(void);
+
+
+/*
+ * Static variables.
+ */
+static uint8_t *DecodePtr;
+static uint8_t *EncodePtr;
+
+
+/*
+ * Initialize encode pointer.
+ */
+void
+enc_init(void *p)
+{
+    EncodePtr = p;
+}
+
+
+/*
+ * Initialize decode pointer.
+ */
+void
+dec_init(void *p)
+{
+    DecodePtr = p;
+}
+
+
+/*
+ * Encode a string.
+ */
+void
+enc_str(char *s, int n)
+{
+    memcpy(EncodePtr, s, n);
+    EncodePtr += n;
+}
+
+
+/*
+ * Decode a string.
+ */
+void
+dec_str(char *s, int  n)
+{
+    memcpy(s, DecodePtr, n);
+    DecodePtr += n;
+}
+
+
+/*
+ * Encode an integer.
+ */
+void
+enc_int(int64_t l, int n)
+{
+    while (n--) {
+        *EncodePtr++ = l;
+        l >>= 8;
+    }
+}
+
+
+/*
+ * Decode an integer.
+ */
+int64_t
+dec_int(int n)
+{
+    uint64_t l = 0;
+    uint8_t *p = (DecodePtr += n);
+
+    while (n--)
+        l = (l << 8) | (*--p & 0xFF);
+    return l;
+}
+
+
+/*
+ * Encode a 32 bit unsigned integer.
+ */
+void
+encode_uint32(uint32_t *p, uint32_t v)
+{
+    enc_init(p);
+    enc_int(v, sizeof(v));
+}
+
+
+/*
+ * Decode a 32 bit unsigned integer.
+ */
+uint32_t
+decode_uint32(uint32_t *p)
+{
+    dec_init(p);
+    return dec_int(sizeof(uint32_t));
+}
+
+
+/*
+ * Call malloc and exit with an error on failure.
+ */
+void *
+qmalloc(long n)
+{
+    void *p = malloc(n);
+
+    if (!p)
+        error(0, "malloc failed");
+    return p;
+}
+
+
+/*
+ * Attempt to print out a string allocating the necessary storage and exit with
+ * an error on failure.
+ */
+char *
+qasprintf(char *fmt, ...)
+{
+    int stat;
+    char *str;
+    va_list alist;
+
+    va_start(alist, fmt);
+    stat = vasprintf(&str, fmt, alist);
+    va_end(alist);
+    if (stat < 0)
+        error(0, "out of space");
+    return str;
+}
+
+
+/*
+ * Touch data.
+ */
+void
+touch_data(void *p, int n)
+{
+    volatile uint64_t *p64 = p;
+
+    while (n >= sizeof(*p64)) {
+        (void) *p64++;
+        n -= sizeof(*p64);
+    }
+    if (n) {
+        volatile uint8_t *p8 = (uint8_t *)p64;
+        while (n >= sizeof(*p8)) {
+            (void) *p8++;
+            n -= sizeof(*p8);
+        }
+    }
+}
+
+
+/*
+ * Synchronize the client and server.
+ */
+void
+synchronize(char *msg)
+{
+    send_sync(msg);
+    recv_sync(msg);
+    debug("synchronization complete");
+}
+
+
+/*
+ * Send a synchronize message.
+ */
+void
+send_sync(char *msg)
+{
+    int n = strlen(msg);
+
+    send_mesg(msg, n, msg);
+}
+
+
+/*
+ * Receive a synchronize message.
+ */
+void
+recv_sync(char *msg)
+{
+    char data[64];
+    int n = strlen(msg);
+
+    if (n > sizeof(data))
+        error(BUG, "buffer in recv_sync() too small");
+    recv_mesg(data, n, msg);
+    if (memcmp(data, msg, n) != 0)
+        error(0, "synchronize %s failure: data does not match", msg);
+}
+
+
+/*
+ * Send a message to the client.
+ */
+int
+send_mesg(void *ptr, int len, char *item)
+{
+    if (item)
+        debug("sending %s", item);
+    return send_recv_mesg('s', item, RemoteFD, ptr, len);
+}
+
+
+/*
+ * Receive a response from the server.
+ */
+int
+recv_mesg(void *ptr, int len, char *item)
+{
+    if (item)
+        debug("waiting for %s", item);
+    return send_recv_mesg('r', item, RemoteFD, ptr, len);
+}
+
+
+/*
+ * Send or receive a message to a file descriptor timing out after a certain
+ * amount of time.
+ */
+static int
+send_recv_mesg(int sr, char *item, int fd, char *buf, int len)
+{
+    typedef ssize_t (IO)(int fd, void *buf, size_t count);
+    double  etime;
+    fd_set *fdset;
+    fd_set  rfdset;
+    fd_set  wfdset;
+    char   *action;
+    IO     *func;
+    int     ioc = 0;
+
+    if (sr == 'r') {
+        func = (IO *)read;
+        fdset = &rfdset;
+        action = "receive";
+    } else {
+        func = (IO *)write;
+        fdset = &wfdset;
+        action = "send";
+    }
+
+    etime = get_seconds() + Req.timeout;
+    while (len) {
+        int n;
+        double time;
+        struct timeval timeval;
+
+        errno = 0;
+        time = etime - get_seconds();
+        if (time <= 0) {
+            if (!item)
+                return ioc;
+            error(0, "failed to %s %s: timed out", action, item);
+        }
+        n = time += 1.0 / (1000*1000);
+        timeval.tv_sec  = n;
+        timeval.tv_usec = (time-n) * 1000*1000;
+
+        FD_ZERO(&rfdset);
+        FD_ZERO(&wfdset);
+        FD_SET(fd, fdset);
+        if (select(fd+1, &rfdset, &wfdset, 0, &timeval) < 0)
+            error(SYS, "failed to %s %s: select failed", action, item);
+        if (!FD_ISSET(fd, fdset))
+            continue;
+        n = func(fd, buf, len);
+        if (n <= 0) {
+            if (!item)
+                return ioc;
+            if (n < 0)
+                error(SYS, "failed to %s %s", action, item);
+            if (n == 0) {
+                error(0, "failed to %s %s: %s not responding",
+                                                action, item, remote_name());
+            }
+        }
+        len -= n;
+        ioc += n;
+        buf += n;
+    }
+    return ioc;
+}
+
+
+/*
+ * Get the time of day in seconds as a floating point number.
+ */
+static double
+get_seconds(void)
+{
+    struct timeval timeval;
+
+    if (gettimeofday(&timeval, 0) < 0)
+        error(SYS, "gettimeofday failed");
+    return timeval.tv_sec + timeval.tv_usec/(1000.0*1000.0);
+}
+
+
+/*
+ * Call getaddrinfo given a numeric port.  Complain on error.
+ */
+struct addrinfo *
+getaddrinfo_port(char *node, int port, struct addrinfo *hints)
+{
+    struct addrinfo *res;
+    char *service = qasprintf("%d", port);
+    int stat = getaddrinfo(node, service, hints, &res);
+
+    free(service);
+    if (stat != 0)
+        error(0, "getaddrinfo failed: %s", gai_strerror(stat));
+    if (!res)
+        error(0, "getaddrinfo failed: no valid entries");
+    return res;
+}
+
+
+/*
+ * A version of setsockopt that sets a parameter to 1 and exits with an error
+ * on failure.
+ */
+void
+setsockopt_one(int fd, int optname)
+{
+    int one = 1;
+
+    if (setsockopt(fd, SOL_SOCKET, optname, &one, sizeof(one)) >= 0)
+        return;
+    error(SYS, "setsockopt %d %d to 1 failed", SOL_SOCKET, optname);
+}
+
+
+/*
+ * This is called when a SIGURG signal is received indicating that TCP
+ * out-of-band data has arrived.  This is used by the remote end to indicate
+ * one of two conditions: the test has completed or an error has occurred.
+ */
+void
+urgent(void)
+{
+    char *p, *q;
+    char buffer[256];
+
+    /*
+     * There is a slim chance that an urgent message arrived before accept
+     * returned.  This is likely not even possible with the current code flow
+     * but we check just in case.
+     */
+    if (RemoteFD < 0)
+        return;
+
+    /*
+     * This recv could fail if for some reason our socket buffer was full of
+     * in-band data and the remote side could not send the out of band data.
+     * If the recv fails with EWOULDBLOCK, we should keep reading in-band data
+     * until we clear the in-band data.  Since we do not send enough data for
+     * this case to cause us concern in the normal case, we do not expect this
+     * to ever occur.  If it does, we let the lower levels deal with it.
+     */
+    if (recv(RemoteFD, buffer, 1, MSG_OOB) != 1)
+        return;
+
+    /*
+     * If the indication is that the other side has completed its testing,
+     * indicate completion on our side also.
+     */
+    if (buffer[0] == '.') {
+        set_finished();
+        return;
+    }
+
+    /*
+     * If we are the server, we only print out client error messages if we are
+     * in debug mode.
+     */
+    if (!Debug && !is_client())
+        die();
+
+    p = buffer;
+    q = p + sizeof(buffer);
+    buf_app(&p, q, remote_name());
+    buf_app(&p, q, ": ");
+    timeout_set(ERROR_TIMEOUT, sig_alrm_remote_failure);
+
+    for (;;) {
+        int s = sockatmark(RemoteFD);
+
+        if (s < 0)
+            remote_failure_error();
+        if (s)
+            break;
+        (void) read(RemoteFD, p, q-p);
+    }
+
+    while (p < q) {
+        int n = read(RemoteFD, p, q-p);
+
+        if (n <= 0)
+            break;
+        p += n;
+    }
+    timeout_end();
+
+    buf_end(&p, q);
+    (void) write(2, buffer, p+1-buffer);
+    die();
+}
+
+
+/*
+ * Remote end timed out in an attempt to find the error.
+ */
+static void
+sig_alrm_remote_failure(int signo, siginfo_t *siginfo, void *ucontext)
+{
+    remote_failure_error();
+}
+
+
+/*
+ * The remote timed out while attempting to convey an error.  Tell the user.
+ */
+static void
+remote_failure_error(void)
+{
+    char buffer[256];
+    char *p = buffer;
+    char *q = p + sizeof(buffer);
+
+    buf_app(&p, q, remote_name());
+    buf_app(&p, q, " failure");
+    buf_end(&p, q);
+    (void) write(2, buffer, p+1-buffer);
+    die();
+}
+
+
+/*
+ * Return a string describing whether the remote is a client or a server.
+ */
+static char *
+remote_name(void)
+{
+    if (is_client())
+        return "server";
+    else
+        return "client";
+}
+
+
+/*
+ * Print out an error message.  actions contain a set of flags that determine
+ * what needs to get done.  If BUG is set, it is an internal error.  If SYS is
+ * set, a system error is printed.  If RET is set, we return rather than exit.
+ */
+int
+error(int actions, char *fmt, ...)
+{
+    va_list alist;
+    char buffer[256];
+    char *p = buffer;
+    char *q = p + sizeof(buffer);
+
+    if ((actions & BUG) != 0)
+        buf_app(&p, q, "internal error: ");
+    va_start(alist, fmt);
+    p += vsnprintf(p, q-p, fmt, alist);
+    va_end(alist);
+    if ((actions & SYS) != 0 && errno) {
+        buf_app(&p, q, ": ");
+        buf_app(&p, q, strerror(errno));
+    }
+    buf_end(&p, q);
+    fwrite(buffer, 1, p+1-buffer, stdout);
+    if ((actions & RET) != 0)
+        return 0;
+
+    if (RemoteFD >= 0) {
+        send(RemoteFD, "?", 1, MSG_OOB);
+        (void) write(RemoteFD, buffer, p-buffer);
+        shutdown(RemoteFD, SHUT_WR);
+        timeout_set(ERROR_TIMEOUT, sig_alrm_die);
+        while (read(RemoteFD, buffer, sizeof(buffer)) > 0)
+            ;
+    }
+    die();
+    return 0;
+}
+
+
+/*
+ * Remote end timed out while waiting for acknowledgement that it received
+ * error.
+ */
+static void
+sig_alrm_die(int signo, siginfo_t *siginfo, void *ucontext)
+{
+    die();
+}
+
+
+/*
+ * Start timeout.
+ */
+static void
+timeout_set(int seconds, SIGFUNC sigfunc)
+{
+    struct itimerval itimerval = {{0}};
+    struct sigaction act ={
+        .sa_sigaction = sigfunc,
+        .sa_flags = SA_SIGINFO
+    };
+
+    setitimer(ITIMER_REAL, &itimerval, 0);
+    sigaction(SIGALRM, &act, 0);
+    itimerval.it_value.tv_sec = seconds;
+    setitimer(ITIMER_REAL, &itimerval, 0);
+}
+
+
+/*
+ * End timeout.
+ */
+static void
+timeout_end(void)
+{
+    struct itimerval itimerval = {{0}};
+
+    setitimer(ITIMER_REAL, &itimerval, 0);
+}
+
+
+/*
+ * Add a string to a buffer.
+ */
+static void
+buf_app(char **pp, char *end, char *str)
+{
+    char *p = *pp;
+    int n = strlen(str);
+    int l = end - p;
+
+    if (n > l)
+        n = l;
+    memcpy(p, str, n);
+    *pp = p + n;
+}
+
+
+/*
+ * End a buffer.
+ */
+static void
+buf_end(char **pp, char *end)
+{
+    char *p = *pp;
+
+    if (p == end) {
+        char *s = " ...";
+        int n = strlen(s);
+        memcpy(--p-n, s, n);
+    }
+    *p = '\n';
+    *pp = p;
+}
+
+
+/*
+ * Print out a debug message.
+ */
+void
+debug(char *fmt, ...)
+{
+    va_list alist;
+
+    if (!Debug)
+        return;
+    va_start(alist, fmt);
+    vfprintf(stderr, fmt, alist);
+    va_end(alist);
+    fprintf(stderr, "\n");
+    fflush(stderr);
+}
+
+
+/*
+ * Exit unsuccessfully.
+ */
+void
+die(void)
+{
+    exit(1);
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/qperf.git



More information about the Pkg-ofed-commits mailing list