[Pkg-ofed-commits] [tvflash] 01/02: Imported Upstream version 0.9.0

Ana Beatriz Guerrero López ana at moszumanska.debian.org
Wed Jul 2 14:36:02 UTC 2014


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

ana pushed a commit to branch master
in repository tvflash.

commit 8198c93bb7ed5ea9bddd9619f1a68436a619e98a
Author: Ana Guerrero López <ana at ekaia.org>
Date:   Wed Jul 2 16:36:00 2014 +0200

    Imported Upstream version 0.9.0
---
 .gitignore        |   17 +
 COPYING           |  340 ++++
 ChangeLog         |    0
 Makefile.am       |   12 +
 Makefile.in       |  565 ++++++
 NEWS              |    1 +
 README            |   13 +
 aclocal.m4        |  862 ++++++++
 autogen.sh        |    7 +
 config.h.in       |  101 +
 config/.gitignore |    8 +
 config/compile    |  142 ++
 config/depcomp    |  530 +++++
 config/install-sh |  323 +++
 config/missing    |  360 ++++
 configure         | 5698 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.in      |   40 +
 src/.gitignore    |    3 +
 src/firmware.h    |  326 +++
 src/tvflash.c     | 3680 ++++++++++++++++++++++++++++++++++
 tvflash.spec      |   37 +
 tvflash.spec.in   |   37 +
 22 files changed, 13102 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..78effef
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+*.o
+*.lo
+configure
+Makefile.in
+autom4te.cache
+aclocal.m4
+stamp-h.in
+config.h.in
+config.log
+config.h
+.libs
+.deps
+libibverbs.spec
+Makefile
+config.status
+stamp-h1
+libtool
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  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 Library 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 Library 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..872591e
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,12 @@
+# $Id$
+
+sbin_PROGRAMS = src/tvflash
+
+src_tvflash_CFLAGS = -Wall
+src_tvflash_SOURCES = src/tvflash.c
+
+EXTRA_DIST = src/firmware.h \
+    tvflash.spec.in
+
+dist-hook: tvflash.spec
+	cp tvflash.spec $(distdir)
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..65eceaf
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,565 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  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@
+
+# $Id$
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+sbin_PROGRAMS = src/tvflash$(EXEEXT)
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
+	$(srcdir)/tvflash.spec.in $(top_srcdir)/configure COPYING \
+	ChangeLog NEWS config/compile config/depcomp config/install-sh \
+	config/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 configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = tvflash.spec
+am__installdirs = "$(DESTDIR)$(sbindir)"
+sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(sbin_PROGRAMS)
+am_src_tvflash_OBJECTS = src_tvflash-tvflash.$(OBJEXT)
+src_tvflash_OBJECTS = $(am_src_tvflash_OBJECTS)
+src_tvflash_LDADD = $(LDADD)
+am__dirstamp = $(am__leading_dot)dirstamp
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp = $(SHELL) $(top_srcdir)/config/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 = $(src_tvflash_SOURCES)
+DIST_SOURCES = $(src_tvflash_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+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@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+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@
+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@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+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@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+src_tvflash_CFLAGS = -Wall
+src_tvflash_SOURCES = src/tvflash.c
+EXTRA_DIST = src/firmware.h \
+    tvflash.spec.in
+
+all: config.h
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+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)
+
+config.h: stamp-h1
+	@if test ! -f $@; then \
+	  rm -f stamp-h1; \
+	  $(MAKE) stamp-h1; \
+	else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+	@rm -f stamp-h1
+	cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in:  $(am__configure_deps) 
+	cd $(top_srcdir) && $(AUTOHEADER)
+	rm -f stamp-h1
+	touch $@
+
+distclean-hdr:
+	-rm -f config.h stamp-h1
+tvflash.spec: $(top_builddir)/config.status $(srcdir)/tvflash.spec.in
+	cd $(top_builddir) && $(SHELL) ./config.status $@
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)"
+	@list='$(sbin_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) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-sbinPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(sbindir)/$$f"; \
+	done
+
+clean-sbinPROGRAMS:
+	-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
+src/$(am__dirstamp):
+	@$(mkdir_p) src
+	@: > src/$(am__dirstamp)
+src/tvflash$(EXEEXT): $(src_tvflash_OBJECTS) $(src_tvflash_DEPENDENCIES) src/$(am__dirstamp)
+	@rm -f src/tvflash$(EXEEXT)
+	$(LINK) $(src_tvflash_LDFLAGS) $(src_tvflash_OBJECTS) $(src_tvflash_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/src_tvflash-tvflash.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ 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@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+ 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) '$<'`
+
+src_tvflash-tvflash.o: src/tvflash.c
+ at am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_tvflash_CFLAGS) $(CFLAGS) -MT src_tvflash-tvflash.o -MD -MP -MF "$(DEPDIR)/src_tvflash-tvflash.Tpo" -c -o src_tvflash-tvflash.o `test -f 'src/tvflash.c' || echo '$(srcdir)/'`src/tvflash.c; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_tvflash-tvflash.Tpo" "$(DEPDIR)/src_tvflash-tvflash.Po"; else rm -f "$(DEPDIR)/src_tvflash-tvflash.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/tvflash.c' object='src_tvflash-tvflash.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_tvflash_CFLAGS) $(CFLAGS) -c -o src_tvflash-tvflash.o `test -f 'src/tvflash.c' || echo '$(srcdir)/'`src/tvflash.c
+
+src_tvflash-tvflash.obj: src/tvflash.c
+ at am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_tvflash_CFLAGS) $(CFLAGS) -MT src_tvflash-tvflash.obj -MD -MP -MF "$(DEPDIR)/src_tvflash-tvflash.Tpo" -c -o src_tvflash-tvflash.obj `if test -f 'src/tvflash.c'; then $(CYGPATH_W) 'src/tvflash.c'; else $(CYGPATH_W) '$(srcdir)/src/tvflash.c'; fi`; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/src_tvflash-tvflash.Tpo" "$(DEPDIR)/src_tvflash-tvflash.Po"; else rm -f "$(DEPDIR)/src_tvflash-tvflash.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='src/tvflash.c' object='src_tvflash-tvflash.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_tvflash_CFLAGS) $(CFLAGS) -c -o src_tvflash-tvflash.obj `if test -f 'src/tvflash.c'; then $(CYGPATH_W) 'src/tvflash.c'; else $(CYGPATH_W) '$(srcdir)/src/tvflash.c'; fi`
+uninstall-info-am:
+
+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; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { 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) config.h.in $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { 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)
+	mkdir $(distdir)
+	$(mkdir_p) $(distdir)/. $(distdir)/config $(distdir)/src
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    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
+	$(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 $(SHELL) $(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-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.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 '1{h;s/./=/g;p;x;}' -e '$${p;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-am
+all-am: Makefile $(PROGRAMS) config.h
+installdirs:
+	for dir in "$(DESTDIR)$(sbindir)"; 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)
+	-rm -f src/$(am__dirstamp)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-hdr distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-sbinPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
+	clean-generic clean-sbinPROGRAMS ctags dist dist-all \
+	dist-bzip2 dist-gzip dist-hook dist-shar dist-tarZ dist-zip \
+	distcheck distclean distclean-compile distclean-generic \
+	distclean-hdr distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-sbinPROGRAMS 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-info-am uninstall-sbinPROGRAMS
+
+
+dist-hook: tvflash.spec
+	cp tvflash.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..30463b9
--- /dev/null
+++ b/NEWS
@@ -0,0 +1 @@
+0.9.0 - Initial release.
diff --git a/README b/README
new file mode 100644
index 0000000..00acf98
--- /dev/null
+++ b/README
@@ -0,0 +1,13 @@
+tvflash is used to query and update the firmware flash memory attached
+to Mellanox InfiniBand HCAs.
+
+WARNING! This program may corrupt the flash and render your HCA
+useless.  Please be careful and use at your own risk.
+
+To generate a firmware file for use with tvflash, use Mellanox's
+InfiniBurn tool and save a firmware image in binary format to a file.
+
+On systems where PCI memory space cannot be accessed by mmap()ing
+/dev/mem, (a typical symptom is for tvflash to exit with the message
+"Bus error") use the "-c" option of tvflash.  This uses PCI
+configuration header access, which is quite a bit slower.
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..7d473d5
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,862 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 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.
+
+# 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.
+
+# Copyright (C) 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.
+
+# 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.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+	 [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# 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
+# 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 7
+
+# 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])
+AC_SUBST([$1_FALSE])
+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
+# 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
+
+# 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], 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/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])
+])
+
+# 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.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /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"])
+])
+
+# 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 8
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 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 12
+
+# 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.58])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
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+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
+ 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
+])
+])
+
+
+# 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_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/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-"$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, 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_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
+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  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 whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# 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="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# 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..925561c
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+set -x
+aclocal -I config
+autoheader
+automake --foreign --add-missing --copy
+autoconf
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..c8b35a0
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,101 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `pci' library (-lpci). */
+#undef HAVE_LIBPCI
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+   to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `pci_alloc' function. */
+#undef HAVE_PCI_ALLOC
+
+/* Define to 1 if you have the `pci_cleanup' function. */
+#undef HAVE_PCI_CLEANUP
+
+/* Define to 1 if you have the `pci_fill_info' function. */
+#undef HAVE_PCI_FILL_INFO
+
+/* Define to 1 if you have the `pci_init' function. */
+#undef HAVE_PCI_INIT
+
+/* Define to 1 if you have the `pci_read_long' function. */
+#undef HAVE_PCI_READ_LONG
+
+/* Define to 1 if you have the `pci_read_word' function. */
+#undef HAVE_PCI_READ_WORD
+
+/* Define to 1 if you have the `pci_scan_bus' function. */
+#undef HAVE_PCI_SCAN_BUS
+
+/* Define to 1 if you have the `pci_write_long' function. */
+#undef HAVE_PCI_WRITE_LONG
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtoul' function. */
+#undef HAVE_STRTOUL
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
diff --git a/config/.gitignore b/config/.gitignore
new file mode 100644
index 0000000..4d4c7b1
--- /dev/null
+++ b/config/.gitignore
@@ -0,0 +1,8 @@
+mkinstalldirs
+depcomp
+compile
+missing
+config.guess
+config.sub
+ltmain.sh
+install-sh
diff --git a/config/compile b/config/compile
new file mode 100755
index 0000000..1b1d232
--- /dev/null
+++ b/config/compile
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey at cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, 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.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake at gnu.org> or send patches to
+# <automake-patches at gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+	# configure might choose to run compile as `compile cc -o foo foo.c'.
+	# So we strip `-o arg' only if arg is an object.
+	eat=1
+	case $2 in
+	  *.o | *.obj)
+	    ofile=$2
+	    ;;
+	  *)
+	    set x "$@" -o "$2"
+	    shift
+	    ;;
+	esac
+	;;
+      *.c)
+	cfile=$1
+	set x "$@" "$1"
+	shift
+	;;
+      *)
+	set x "$@" "$1"
+	shift
+	;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# 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/config/depcomp b/config/depcomp
new file mode 100755
index 0000000..04701da
--- /dev/null
+++ b/config/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 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.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  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.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # 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,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$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"
+  ;;
+
+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 mecanism 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 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/config/install-sh b/config/install-sh
new file mode 100755
index 0000000..4d4a951
--- /dev/null
+++ b/config/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# 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.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+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:
+-c         (ignored)
+-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.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
+  esac
+done
+
+if test -z "$1"; 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
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  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 "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # 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: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # 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
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $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 "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 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.
+	   {
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	       || {
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	 }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); 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/config/missing b/config/missing
new file mode 100755
index 0000000..894e786
--- /dev/null
+++ b/config/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   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=:
+
+# 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'
+  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 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    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 [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -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 [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -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 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -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 's/.*-o \([^ ]*\).*/\1/p'`
+    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/configure b/configure
new file mode 100755
index 0000000..ffe1680
--- /dev/null
+++ b/configure
@@ -0,0 +1,5698 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for FULL-PACKAGE-NAME VERSION.
+#
+# Report bugs to <BUG-REPORT-ADDRESS>.
+#
+# Copyright (C) 2003 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 Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; 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 ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  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
+
+       ;;
+  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
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    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=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # 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 before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, 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
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { 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 sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# 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'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# 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`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='FULL-PACKAGE-NAME'
+PACKAGE_TARNAME='full-package-name'
+PACKAGE_VERSION='VERSION'
+PACKAGE_STRING='FULL-PACKAGE-NAME VERSION'
+PACKAGE_BUGREPORT='BUG-REPORT-ADDRESS'
+
+ac_unique_file="src/tvflash.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INS [...]
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# 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.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+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
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -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 | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$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 ;;
+
+  -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 ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    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 ;;
+
+  -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=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 ;;
+
+  -*) { 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 &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      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'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+	      localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+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
+    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
+
+
+# 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 its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    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
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# 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 FULL-PACKAGE-NAME VERSION 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 \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+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]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --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]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_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 FULL-PACKAGE-NAME VERSION:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --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>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <BUG-REPORT-ADDRESS>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style 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
+    elif test -f $ac_srcdir/configure.ac ||
+	   test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd "$ac_popdir"
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+FULL-PACKAGE-NAME configure VERSION
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 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 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by FULL-PACKAGE-NAME $as_me VERSION, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+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`
+hostinfo               = `(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=.
+  echo "PATH: $as_dir"
+done
+
+} >&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_sep=
+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=`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_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    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: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+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,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=$`echo $ac_var`
+	echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf 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 -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >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 explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+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
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+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 `(set) 2>&1 |
+	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+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
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`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
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in config $srcdir/config; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+          ac_config_headers="$ac_config_headers config.h"
+
+am__api_version="1.9"
+# 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.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+
+
+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.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$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'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&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".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+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
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}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 $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# 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=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+	@echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+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=tvflash
+ VERSION=0.9.0
+
+
+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-"$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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(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 -'
+
+
+
+
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$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"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+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
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+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.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  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.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.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+	;;
+    conftest.$ac_ext )
+	# This is the source file.
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	# FIXME: I believe we export ac_cv_exeext for Libtool,
+	# but it would be cool to find out if it's true.  Does anybody
+	# maintain Libtool? --akim.
+	export ac_cv_exeext
+	break;;
+    * )
+	break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+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
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&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'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  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
+	{ { 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
+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
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  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 | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  export ac_cv_exeext
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+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
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+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
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$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
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=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 -std1 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 -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 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
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+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.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&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
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-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=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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/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
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$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
+
+
+
+# Checks for header files.
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&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
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+for ac_header in fcntl.h limits.h stdlib.h string.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to BUG-REPORT-ADDRESS ##
+## --------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+if test "${ac_cv_header_pci_pci_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for pci/pci.h" >&5
+echo $ECHO_N "checking for pci/pci.h... $ECHO_C" >&6
+if test "${ac_cv_header_pci_pci_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_pci_pci_h" >&5
+echo "${ECHO_T}$ac_cv_header_pci_pci_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking pci/pci.h usability" >&5
+echo $ECHO_N "checking pci/pci.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <pci/pci.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking pci/pci.h presence" >&5
+echo $ECHO_N "checking pci/pci.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pci/pci.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: pci/pci.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: pci/pci.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pci/pci.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: pci/pci.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: pci/pci.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: pci/pci.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pci/pci.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: pci/pci.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pci/pci.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: pci/pci.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pci/pci.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: pci/pci.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pci/pci.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: pci/pci.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pci/pci.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: pci/pci.h: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to BUG-REPORT-ADDRESS ##
+## --------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for pci/pci.h" >&5
+echo $ECHO_N "checking for pci/pci.h... $ECHO_C" >&6
+if test "${ac_cv_header_pci_pci_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_pci_pci_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_pci_pci_h" >&5
+echo "${ECHO_T}$ac_cv_header_pci_pci_h" >&6
+
+fi
+if test $ac_cv_header_pci_pci_h = yes; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: <pci/pci.h> not found." >&5
+echo "$as_me: error: <pci/pci.h> not found." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## --------------------------------- ##
+## Report this to BUG-REPORT-ADDRESS ##
+## --------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
+echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_func_malloc_0_nonnull=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if STDC_HEADERS || HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+exit (malloc (0) ? 0 : 1);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_malloc_0_nonnull=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
+if test $ac_cv_func_malloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 0
+_ACEOF
+
+   case $LIBOBJS in
+    "malloc.$ac_objext"   | \
+  *" malloc.$ac_objext"   | \
+    "malloc.$ac_objext "* | \
+  *" malloc.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define malloc rpl_malloc
+_ACEOF
+
+fi
+
+
+
+
+
+
+for ac_func in memset strchr strtoul
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# Search for libz in case libpci depends on it;
+#   it doesn't hurt if we link against it when not strictly needed.
+echo "$as_me:$LINENO: checking for library containing gzopen" >&5
+echo $ECHO_N "checking for library containing gzopen... $ECHO_C" >&6
+if test "${ac_cv_search_gzopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_gzopen=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gzopen ();
+int
+main ()
+{
+gzopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_gzopen="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_gzopen" = no; then
+  for ac_lib in z gz; do
+    LIBS="-l$ac_lib  $ac_func_search_save_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 gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gzopen ();
+int
+main ()
+{
+gzopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_gzopen="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_gzopen" >&5
+echo "${ECHO_T}$ac_cv_search_gzopen" >&6
+if test "$ac_cv_search_gzopen" != no; then
+  test "$ac_cv_search_gzopen" = "none required" || LIBS="$ac_cv_search_gzopen $LIBS"
+
+fi
+
+
+
+echo "$as_me:$LINENO: checking for pci_init in -lpci" >&5
+echo $ECHO_N "checking for pci_init in -lpci... $ECHO_C" >&6
+if test "${ac_cv_lib_pci_pci_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpci  $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 gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char pci_init ();
+int
+main ()
+{
+pci_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_pci_pci_init=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pci_pci_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pci_pci_init" >&5
+echo "${ECHO_T}$ac_cv_lib_pci_pci_init" >&6
+if test $ac_cv_lib_pci_pci_init = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPCI 1
+_ACEOF
+
+  LIBS="-lpci $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: libpci not found.
+" >&5
+echo "$as_me: error: libpci not found.
+" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+for ac_func in pci_init pci_scan_bus pci_alloc \
+		pci_cleanup pci_fill_info pci_write_long pci_read_long \
+		pci_read_word
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  { { echo "$as_me:$LINENO: error: libpci functions not found.
+" >&5
+echo "$as_me: error: libpci functions not found.
+" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+done
+
+
+                    ac_config_files="$ac_config_files Makefile tvflash.spec"
+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, don't put newlines in cache variables' values.
+# 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.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *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 \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!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" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  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}'
+
+# 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
+
+DEFS=-DHAVE_CONFIG_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_i=`echo "$ac_i" |
+	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+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
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+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
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $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
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; 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 ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  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
+
+       ;;
+  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
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    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=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # 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 before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, 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
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+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 sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# 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'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by FULL-PACKAGE-NAME $as_me VERSION, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+		   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf at gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+FULL-PACKAGE-NAME config.status VERSION
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+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
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+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" ;;
+
+  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
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "tvflash.spec" ) CONFIG_FILES="$CONFIG_FILES tvflash.spec" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+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_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s, at SHELL@,$SHELL,;t t
+s, at PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s, at PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s, at PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s, at PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s, at PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s, at PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s, at exec_prefix@,$exec_prefix,;t t
+s, at prefix@,$prefix,;t t
+s, at program_transform_name@,$program_transform_name,;t t
+s, at bindir@,$bindir,;t t
+s, at sbindir@,$sbindir,;t t
+s, at libexecdir@,$libexecdir,;t t
+s, at datadir@,$datadir,;t t
+s, at sysconfdir@,$sysconfdir,;t t
+s, at sharedstatedir@,$sharedstatedir,;t t
+s, at localstatedir@,$localstatedir,;t t
+s, at libdir@,$libdir,;t t
+s, at includedir@,$includedir,;t t
+s, at oldincludedir@,$oldincludedir,;t t
+s, at infodir@,$infodir,;t t
+s, at mandir@,$mandir,;t t
+s, at build_alias@,$build_alias,;t t
+s, at host_alias@,$host_alias,;t t
+s, at target_alias@,$target_alias,;t t
+s, at DEFS@,$DEFS,;t t
+s, at ECHO_C@,$ECHO_C,;t t
+s, at ECHO_N@,$ECHO_N,;t t
+s, at ECHO_T@,$ECHO_T,;t t
+s, at LIBS@,$LIBS,;t t
+s, at INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s, at INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s, at INSTALL_DATA@,$INSTALL_DATA,;t t
+s, at CYGPATH_W@,$CYGPATH_W,;t t
+s, at PACKAGE@,$PACKAGE,;t t
+s, at VERSION@,$VERSION,;t t
+s, at ACLOCAL@,$ACLOCAL,;t t
+s, at AUTOCONF@,$AUTOCONF,;t t
+s, at AUTOMAKE@,$AUTOMAKE,;t t
+s, at AUTOHEADER@,$AUTOHEADER,;t t
+s, at MAKEINFO@,$MAKEINFO,;t t
+s, at install_sh@,$install_sh,;t t
+s, at STRIP@,$STRIP,;t t
+s, at ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s, at INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s, at mkdir_p@,$mkdir_p,;t t
+s, at AWK@,$AWK,;t t
+s, at SET_MAKE@,$SET_MAKE,;t t
+s, at am__leading_dot@,$am__leading_dot,;t t
+s, at AMTAR@,$AMTAR,;t t
+s, at am__tar@,$am__tar,;t t
+s, at am__untar@,$am__untar,;t t
+s, at CC@,$CC,;t t
+s, at CFLAGS@,$CFLAGS,;t t
+s, at LDFLAGS@,$LDFLAGS,;t t
+s, at CPPFLAGS@,$CPPFLAGS,;t t
+s, at ac_ct_CC@,$ac_ct_CC,;t t
+s, at EXEEXT@,$EXEEXT,;t t
+s, at OBJEXT@,$OBJEXT,;t t
+s, at DEPDIR@,$DEPDIR,;t t
+s, at am__include@,$am__include,;t t
+s, at am__quote@,$am__quote,;t t
+s, at AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s, at AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s, at AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s, at CCDEPMODE@,$CCDEPMODE,;t t
+s, at am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s, at am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s, at CPP@,$CPP,;t t
+s, at EGREP@,$EGREP,;t t
+s, at LIBOBJS@,$LIBOBJS,;t t
+s, at LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  # 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.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+				     sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s, at configure_input@,$configure_input,;t t
+s, at srcdir@,$ac_srcdir,;t t
+s, at abs_srcdir@,$ac_abs_srcdir,;t t
+s, at top_srcdir@,$ac_top_srcdir,;t t
+s, at abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s, at builddir@,$ac_builddir,;t t
+s, at abs_builddir@,$ac_abs_builddir,;t t
+s, at top_builddir@,$ac_top_builddir,;t t
+s, at abs_top_builddir@,$ac_abs_top_builddir,;t t
+s, at INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([	 ]*\)#\([	 ]*define[	 ][	 ]*\)'
+ac_dB='[	 ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([	 ]*\)#\([	 ]*\)undef\([	 ][	 ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 # Do quote $f, to prevent DOS paths from being IFS'd.
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[	 ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status.  Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*\)\(([^)]*)\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[	 ]*#[	 ]*undef[	 ][	 ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[	 ]*#[	 ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[	 ]*#[	 ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[	 ]*#[	 ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # 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.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
+  fi
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X$ac_file : 'X\(//\)[^/]' \| \
+	 X$ac_file : 'X\(//\)$' \| \
+	 X$ac_file : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_dest" : 'X\(//\)[^/]' \| \
+	 X"$ac_dest" : 'X\(//\)$' \| \
+	 X"$ac_dest" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    depfiles ) 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.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+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=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# 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
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..d2f696e
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,40 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.57)
+AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
+AC_CONFIG_SRCDIR(src/tvflash.c)
+AC_CONFIG_AUX_DIR(config)
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE(tvflash, 0.9.0)
+
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(fcntl.h limits.h stdlib.h string.h unistd.h)
+
+AC_CHECK_HEADER([pci/pci.h], [],
+    AC_MSG_ERROR([<pci/pci.h> not found.]))
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS(memset strchr strtoul)
+
+# Search for libz in case libpci depends on it;
+#   it doesn't hurt if we link against it when not strictly needed.
+AC_SEARCH_LIBS(gzopen, [z gz])
+
+AC_CHECK_LIB(pci, pci_init, [],
+    AC_MSG_ERROR([libpci not found.
+]))
+AC_CHECK_FUNCS(pci_init pci_scan_bus pci_alloc \
+		pci_cleanup pci_fill_info pci_write_long pci_read_long \
+		pci_read_word, [],
+    AC_MSG_ERROR([libpci functions not found.
+]))
+
+AC_OUTPUT(Makefile tvflash.spec)
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 0000000..7297cbb
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,3 @@
+*.la
+.dirstamp
+.libs
diff --git a/src/firmware.h b/src/firmware.h
new file mode 100644
index 0000000..479ab7f
--- /dev/null
+++ b/src/firmware.h
@@ -0,0 +1,326 @@
+/*
+ * tvflash - update firmware flash memory on Mellanox HCAs
+ * Copyright (c) 2004 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2007 Cisco, Inc.  All rights reserved.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _FIRMWARE_H_
+#define _FIRMWARE_H_
+
+#include <stdint.h>
+#include <endian.h>
+
+enum operation {
+	OP_NONE,
+	OP_IDENTIFY,
+	OP_PRINT_GUIDS,
+	OP_DOWNLOAD,
+	OP_UPLOAD,
+	OP_MODIFY_OPTIONS,
+};
+
+enum identify_mode {
+	IDENTIFY_EXTENDED,
+	IDENTIFY_PRIMARY_FIRMWARE_LABEL,
+	IDENTIFY_HARDWARE_LABEL,
+};
+
+#define TV_FLASH_DEFAULT_SECTOR_SIZE	0x010000	/* 64K */
+
+#define VSD_PREFIX_LENGTH	8
+
+#define VSD_SIGNATURE_TOPSPIN	0x5ad
+
+/*
+ * Note: The first shipped version had an endian problem with the
+ * flags. So it has been changed to make sure we maintain the
+ * endianness and compatibility to the first versions
+ */
+#define VSD_FLAG_AUTOUPGRADE	0x01000000
+#define VSD_FLAG_ALIGN_FIXED	0x00000001	/* Alignment fixed */
+#define VSD_FLAG_NEW_BUILD_NUM	0x00000002	/* Use new build num field */
+#define VSD_FLAG_BOOT_OPTIONS	0x00000004	/* Boot options supported */
+#define VSD_FLAG_BOOT_GID_BIG	0x00000008	/* GID is in big endian */
+
+#define VSD_FLAG_BOOT_OPTIONS_MASK	0x00FF0000
+#define VSD_FLAG_BOOT_ENABLE_PORT_1	0x00010000
+#define VSD_FLAG_BOOT_ENABLE_PORT_2	0x00020000
+#define VSD_FLAG_BOOT_ENABLE_SCAN	0x00040000
+#define VSD_FLAG_BOOT_WAIT_ON_ERROR	0x00080000
+#define VSD_FLAG_BOOT_TRY_FOREVER	0x00100000
+
+#define VSD_FLAG_BOOT_TYPE		0x00C00000
+#define VSD_FLAG_BOOT_TYPE_WELL_KNOWN	0x00000000
+#define VSD_FLAG_BOOT_TYPE_SAVED	0x00400000
+#define VSD_FLAG_BOOT_TYPE_PXE		0x00800000
+#define VSD_FLAG_BOOT_TYPE_DISABLE	0x00C00000
+
+#define BOOT_PXE_SECS_DEFAULT	20
+#define BOOT_VERSION		2
+
+struct topspin_vsd {
+	uint8_t	 vsd_prefix[VSD_PREFIX_LENGTH];
+
+	uint16_t signature1;
+	uint16_t checksum;    /* Calculated over VSD with field set to 0 */
+
+	uint32_t flags;
+
+	uint64_t createtime;
+	uint64_t flashtime;
+
+	uint8_t  major_ver;	/* 1 */
+	uint8_t  minor_ver;	/* 18 */
+	uint16_t micro_ver;	/* 0 */
+	int8_t   revision_ver;	/* 7 (highbit set for rc) */
+	uint8_t  old_build_num;	/* Old build number */
+	/* FIXME: This is in little endian when it should be big endian */
+	uint16_t build_num;	/* For Topspin use (eg 345) */
+
+	char     hw_label[64];	/* Text label unique to this hardware */
+
+	char     build_rev[16];	/* For Topspin use (eg 2.0.0) */
+
+	uint8_t  unused[0xc2 - 0x88];	/* Program as 0 */
+
+	uint8_t  boot_pxe_secs;		/* Number of secs to wait for DHCP (0 = inf) */
+	uint8_t  boot_ioc_num;		/* Saved IOC num */
+	uint8_t  boot_service_name[8];	/* Saved service name */
+	uint8_t  boot_dgid[16];		/* Saved destination GID */
+	uint8_t  boot_port;		/* Port number to use (0 == any) */
+	uint8_t  boot_version;		/* Version of boot firmware options */
+
+	uint16_t signature2;
+} __attribute__((packed));
+
+struct topspin_vsd_old {
+	uint16_t signature1;
+	uint16_t checksum;    /* Calculated over VSD with field set to 0 */
+
+	uint32_t flags;
+
+	uint64_t createtime;
+	uint64_t flashtime;
+
+	uint8_t  major_ver;	/* 1 */
+	uint8_t  minor_ver;	/* 18 */
+	uint16_t micro_ver;	/* 0 */
+	int8_t   revision_ver;	/* 7 (highbit set for rc) */
+	uint8_t  old_build_num;	/* Old build number */
+	/* FIXME: This is in little endian when it should be big endian */
+	uint16_t build_num;	/* For Topspin use (eg 345) */
+
+	char     hw_label[64];	/* Text label unique to this hardware */
+
+	char     build_rev[16];	/* For Topspin use (eg 2.0.0) */
+
+	uint8_t  unused[0xc2 - 0x70];	/* Program as 0 */
+
+	uint8_t  boot_pxe_secs;		/* Number of secs to wait for DHCP (0 = inf) */
+	uint8_t  boot_ioc_num;		/* Saved IOC num */
+	uint8_t  boot_service_name[8];	/* Saved service name */
+	uint8_t  boot_dgid[16];		/* Saved destination GID */
+	uint8_t  boot_port;		/* Port number to use (0 == any) */
+	uint8_t  boot_version;		/* Version of boot firmware options */
+
+	uint16_t signature2;
+} __attribute__((packed));
+
+union vsd {
+	unsigned char		raw[0x100 - 0x30];
+	struct topspin_vsd	topspin;
+	struct topspin_vsd_old	topspin_old;
+};
+
+struct tavor_failsafe {
+	unsigned char valid;
+
+	struct image {
+		unsigned char valid;
+
+		uint32_t addr;
+		uint32_t size;
+
+		union vsd vsd;
+	} images[2];
+};
+
+struct hermon_fw_info {
+	int		base;
+	int		failsafe;
+	int		chunk_size;
+	union vsd	vsd;
+};
+
+enum method {
+	METHOD_MMAP,
+	METHOD_PCI_CFG,
+};
+
+struct pciid;
+
+enum flash_command_set {
+	CS_UNKNOWN,
+	CS_INTEL,
+	CS_AMD,
+	CS_SPI_SINAI,
+	CS_SPI_HERMON,
+};
+
+enum spi_sp_type {
+	SP_UNKNOWN   = 0,
+	SP_ST_M25P80 = 1,	/* ST-25P80 1MByte  serial prom */
+	SP_ST_M25P16 = 2,	/* ST-25P16 2MBytes serial prom */
+};
+
+#define GPIO_DAT	0xF0080
+#define GPIO_DIR	0xF0088
+#define GPIO_POL	0xF0090
+#define GPIO_MOD	0xF0098
+#define GPIO_LOCK	0xF00EC
+
+#define GPIO_DATACLEAR	0xF00F4
+#define GPIO_DATASET	0xF00DC
+
+struct tvdevice {
+	struct tvdevice *next;
+
+	struct pci_dev *pdev;
+	struct pciid *pciid;
+	struct board *board;
+	unsigned char revision;
+
+	unsigned char num;
+	unsigned char flags;
+
+	enum method method;
+	uint8_t *bar0;
+
+	unsigned char flash_bank;
+	unsigned char flush_posted_write;
+
+	union {
+		struct tavor_failsafe tavor_failsafe;
+		struct hermon_fw_info hermon_fw_info;
+	} fw;
+
+	unsigned flash_size;
+
+	enum flash_command_set flash_command_set;
+	unsigned char flash_bank_shift;
+	unsigned int flash_bank_mask;
+	unsigned int flash_sector_sz;
+	unsigned char flash_num_spis;
+	unsigned char flash_spi_sp_size;
+	enum spi_sp_type flash_spi_sp_type;
+
+	unsigned int gpio_data[2], gpio_direction[2];
+	unsigned int gpio_polarity[2], gpio_output_mode[2];
+
+	unsigned char vpd_present;
+
+	/* This is just so we can force alignment for this data */
+	union {
+		unsigned char vpd_char[256];
+		unsigned int vpd_int[256/4];
+	} vpd;
+};
+
+enum hca_chip {
+	CHIP_TAVOR,
+	CHIP_ARBEL,
+	CHIP_SINAI,
+	CHIP_HERMON,
+};
+
+/* Board identification */
+struct board {
+	char *name;
+	enum hca_chip chip;
+	char *fwlabel;
+	int num_ports;
+};
+
+/* Map VPD string to board */
+struct board_vpd {
+	char *str;
+
+	struct board *board;
+};
+
+/* Map PCI id to chip and function to identify board */
+#define PCI_VENDOR_MELLANOX			0x15b3
+#define PCI_VENDOR_TOPSPIN			0x1867
+
+#define PCI_DEVICE_MELLANOX_MT23108		0x5a44
+#define PCI_DEVICE_MELLANOX_MT23108_PCICONF	0x5a45
+#define PCI_DEVICE_MELLANOX_MT23108_PCIBRIDGE	0x5a46
+#define PCI_DEVICE_MELLANOX_MT25208		0x6282
+#define PCI_DEVICE_MELLANOX_MT25208_COMPAT	0x6278
+#define PCI_DEVICE_MELLANOX_MT25208_PCICONF	0x6279
+#define PCI_DEVICE_MELLANOX_MT25204		0x6274
+#define PCI_DEVICE_MELLANOX_MT25204_PCICONF	0x6275
+#define PCI_DEVICE_MELLANOX_MT25408_SDR		0x6340
+#define PCI_DEVICE_MELLANOX_MT25408_DDR		0x634a
+#define PCI_DEVICE_MELLANOX_MT25408_QDR		0x6354
+#define PCI_DEVICE_MELLANOX_MT25408_DDR_PCIE2	0x6732
+#define PCI_DEVICE_MELLANOX_MT25408_QDR_PCIE2	0x673c
+
+struct pciid {
+	uint16_t vendor;
+	uint16_t device;
+	unsigned int flags;
+
+	struct board *(*identify)(struct tvdevice *);
+};
+
+enum {
+	FLAG_RECOVERY		= 1 << 0,
+	FLAG_TAVOR_COMPAT	= 1 << 1
+};
+
+#define MAX_STR			0xB0
+
+#define GUID_LEN		8
+
+#define FLASH_GUID_SECT_FW_RESERVED		0x10
+
+#define TAVOR_FLASH_IMAGE_INFO_OFF		0x1c
+#define TAVOR_FLASH_GUID_OFF			0x24
+#define TAVOR_FLASH_GUID_SECT_CRC_LEN		0x30
+#define TAVOR_FLASH_GUID_SECT_CRC_OFFSET	0x32
+
+#define HERMON_FLASH_IMAGE_INFO_OFF		0x2c
+#define HERMON_FLASH_GUID_OFF			0x34
+#define HERMON_FLASH_GUID_SECT_CRC_LEN		0x40
+#define HERMON_FLASH_GUID_SECT_CRC_OFFSET	0x42
+
+enum {
+	IMAGE_INFO_FORMAT_REVISION	= 0,
+	IMAGE_INFO_FW_VERSION		= 1,
+	IMAGE_INFO_FW_BUILD_TIME	= 2,
+	IMAGE_INFO_DEVICE_TYPE		= 3,
+	IMAGE_INFO_PSID			= 4,
+	IMAGE_INFO_VSD			= 5,
+	IMAGE_INFO_SUPPORTED_PSIDS	= 6,
+	IMAGE_INFO_PRODUCT_VER		= 7,
+	IMAGE_INFO_VSD_VENDOR_ID	= 8,
+	IMAGE_INFO_NUM_TAGS		= 9,
+	IMAGE_INFO_END			= 0XFF
+};
+
+#endif /* _FIRMWARE_H_ */
diff --git a/src/tvflash.c b/src/tvflash.c
new file mode 100644
index 0000000..ecb11f9
--- /dev/null
+++ b/src/tvflash.c
@@ -0,0 +1,3680 @@
+/*
+ * tvflash - update firmware flash memory on Mellanox HCAs
+ * Copyright (c) 2004 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2007 Cisco, Inc.  All rights reserved.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/wait.h>
+#include <sys/mman.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <pci/pci.h>
+#include <sys/utsname.h>
+#include <limits.h>
+#include <ctype.h>
+#include <time.h>
+#include <netinet/in.h>
+
+#include "firmware.h"
+
+static struct tvdevice *tvdevices = NULL;
+static struct tvdevice *tvdevices_tail = NULL;
+
+static unsigned char force = 0;
+static unsigned char verbose = 1;
+static unsigned char use_config_space = 0;
+
+static const char *argv0;
+
+static unsigned short cols;
+
+static const uint32_t hermon_fw_sig[] = {
+	0x4d544657, 0x8cdfd000, 0xdead9270, 0x4154beef
+};
+
+/* Topspin OID */
+static const uint8_t default_oid[] = { 0x00, 0x05, 0xad, 0x00 };
+
+/* Tavor */
+static struct board jaguar	   = { "Jaguar", CHIP_TAVOR, "HCA.Jaguar", 2 };
+static struct board cougar	   = { "Cougar", CHIP_TAVOR, "HCA.Cougar", 2 };
+static struct board cougarcub	   = { "Cougar Cub", CHIP_TAVOR, "HCA.CougarCub", 2 };
+
+/* Arbel */
+static struct board lioncub	   = { "Lion Cub", CHIP_ARBEL, "HCA.LionCub", 2 };
+static struct board lioncub_revc   = { "Lion Cub", CHIP_ARBEL, "HCA.LionCub.RevC", 2 };
+static struct board lioncub_ddr	   = { "Lion Cub DDR", CHIP_ARBEL, "HCA.LionCub-DDR", 2 };
+static struct board glacier	   = { "DLGL", CHIP_ARBEL, "HCA.DLGL", 2 };
+static struct board bc2		   = { "BC2 HSDC", CHIP_ARBEL, "HCA.HSDC", 2 };
+static struct board lionmini	   = { "Lion Mini", CHIP_ARBEL, "HCA.LionMini", 2 };
+static struct board lionmini_ddr   = { "Lion Mini DDR", CHIP_ARBEL, "HCA.LionMini-DDR", 2 };
+static struct board genarbel	   = { "Generic Arbel", CHIP_ARBEL, NULL, 2 };
+
+/* Sinai */
+static struct board tiger	   = { "Tiger", CHIP_SINAI, "HCA.Tiger", 1 };
+static struct board cheetah	   = { "Cheetah", CHIP_SINAI, "HCA.Cheetah", 1 };
+static struct board cheetah_ddr	   = { "Cheetah DDR", CHIP_SINAI, "HCA.Cheetah-DDR", 1 };
+static struct board gensinai	   = { "Generic Sinai", CHIP_SINAI, NULL, 1 };
+
+/* Hermon */
+static struct board eagle_ddr	   = { "Eagle DDR", CHIP_HERMON, "HCA.Eagle-DDR", 2 };
+static struct board genhermon	   = { "Generic Hermon", CHIP_HERMON, NULL, 2 };
+
+static struct board_vpd board_vpds[] = {
+	{ "Cougar cub",		&cougarcub },
+	{ "Lion cub",		&lioncub },
+	{ "Lion cub DDR",	&lioncub_ddr },
+	{ "Lion mini",		&lionmini },
+	{ "Lion mini DDR",	&lionmini_ddr },
+	{ "DLGL",		&glacier },
+	{ "Tiger",		&tiger },
+	{ "Cheetah",		&cheetah },
+	{ "Cheetah DDR",	&cheetah_ddr },
+	{ "BC2 HSDC",		&bc2 },
+	{ "Eagle DDR",		&eagle_ddr },
+};
+
+static struct board *tavor_identify(struct tvdevice *);
+static struct board *arbel_identify(struct tvdevice *);
+static struct board *sinai_identify(struct tvdevice *);
+static struct board *hermon_identify(struct tvdevice *);
+
+static struct pciid pciids[] = {
+	/* Tavor, only one has VPD */
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT23108,
+	  0, tavor_identify },
+	{ PCI_VENDOR_TOPSPIN,	PCI_DEVICE_MELLANOX_MT23108,
+	  0, tavor_identify },
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT23108_PCICONF,
+	  FLAG_RECOVERY, tavor_identify },
+	{ PCI_VENDOR_TOPSPIN,	PCI_DEVICE_MELLANOX_MT23108_PCICONF,
+	  FLAG_RECOVERY, tavor_identify },
+
+	/* Arbel, all have VPDs */
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25208,
+	  0, arbel_identify },
+	{ PCI_VENDOR_TOPSPIN,	PCI_DEVICE_MELLANOX_MT25208,
+	  0, arbel_identify },
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25208_COMPAT,
+	  FLAG_TAVOR_COMPAT, arbel_identify },
+	{ PCI_VENDOR_TOPSPIN,	PCI_DEVICE_MELLANOX_MT25208_COMPAT,
+	  FLAG_TAVOR_COMPAT, arbel_identify },
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25208_PCICONF,
+	  FLAG_RECOVERY, arbel_identify },
+	{ PCI_VENDOR_TOPSPIN,	PCI_DEVICE_MELLANOX_MT25208_PCICONF,
+	  FLAG_RECOVERY, arbel_identify },
+
+	/* Sinai, all have VPDs */
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25204,
+	  0, sinai_identify },
+	{ PCI_VENDOR_TOPSPIN,	PCI_DEVICE_MELLANOX_MT25204,
+	  0, sinai_identify },
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25204_PCICONF,
+	  FLAG_RECOVERY, sinai_identify },
+	{ PCI_VENDOR_TOPSPIN,	PCI_DEVICE_MELLANOX_MT25204_PCICONF,
+	  FLAG_RECOVERY, sinai_identify },
+
+	/* Some old Tiger and Cheetah boards use PCI device id 0x538x (24204) */
+	{ PCI_VENDOR_MELLANOX, 0x5e8c,
+	  0, sinai_identify },
+	{ PCI_VENDOR_MELLANOX, 0x5e8d,
+	  FLAG_RECOVERY, sinai_identify },
+
+	/* Hermon, all have VPDs */
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25408_SDR,
+	  0, hermon_identify },
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25408_DDR,
+	  0, hermon_identify },
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25408_QDR,
+	  0, hermon_identify },
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25408_DDR_PCIE2,
+	  0, hermon_identify },
+	{ PCI_VENDOR_MELLANOX, PCI_DEVICE_MELLANOX_MT25408_QDR_PCIE2,
+	  0, hermon_identify },
+};
+
+/*
+ * Simple utility functions
+ */
+
+/* Calculate the CRC16 of an image (list of bytes) */
+static uint16_t flash_crc16(uint8_t *image, uint32_t size)
+{
+	uint32_t crc = 0xffff;
+	uint32_t i, j;
+	uint32_t word;
+
+	for (j = 0; j < size / 4; j++) {
+		word = (image[4 * j] << 24) | (image[4 * j + 1] << 16) |
+			(image[4 * j + 2] << 8) | image[4 * j + 3];
+		for (i = 0; i < 32; i++) {
+			if (crc & 0x8000)
+				crc = (((crc << 1) | (word >> 31)) ^ 0x100b) & 0xffff;
+			else
+				crc = ((crc << 1) | (word >> 31)) & 0xffff;
+			word = word << 1;
+		}
+	}
+
+	for (i = 0; i < 16; i++) {
+		if (crc & 0x8000)
+			crc = ((crc << 1) ^ 0x100b) & 0xffff;
+		else
+			crc = (crc << 1) & 0xffff;
+	}
+
+	crc = crc ^ 0xffff;
+
+	return (crc & 0xffff);
+}
+
+/*
+ * We need some LE to host macros and those vary depending on the architecture
+ * and there are no standardized ones. So we mix the ntoh* and hton* functions
+ * with an unconditional swab* to get the desired behavior. Not the most
+ * efficient, but it works and is portable.
+ */
+static uint16_t le16_to_cpu(uint16_t x)
+{
+	uint16_t i = htons(x);
+
+	return ((i >> 8) & 0xff) | ((i & 0xff) << 8);
+}
+
+#if 0
+static uint16_t cpu_to_le16(uint16_t x)
+{
+	uint16_t i = ntohs(x);
+
+	return ((i >> 8) & 0xff) | ((i & 0xff) << 8);
+}
+#endif
+
+static uint32_t swab32(uint32_t x)
+{
+	return ((x >> 24) | ((x >> 8) & 0xff00) | ((x & 0xff00) << 8) | (x << 24));
+}
+
+#define be16_to_cpu ntohs
+#define cpu_to_be16 htons
+#define be32_to_cpu ntohl
+#define cpu_to_be32 htonl
+
+static int parse_hex_str(char *arg, unsigned char *hexstr, int octets)
+{
+	if (strchr(arg, ':') != NULL) {
+		char *p;
+		int octetspercolon;
+
+		/* Determine the format of the GUID. Is it single or double octet? */
+		p = strrchr(arg, ':');
+		if (*(p + 1) && *(p + 2) && *(p + 3) && *(p + 4) && !*(p + 5))
+			octetspercolon = 2;
+		else if (*(p + 1) && *(p + 2) && !*(p + 3))
+			octetspercolon = 1;
+		else {
+			fprintf(stderr, "Unknown hex string format\n");
+			return -1;
+		}
+
+		/*
+		 * We don't require a full GUID here. If the user doesn't
+		 * specify a full GUID, we'll put the Topspin OID and 0 pad
+		 * the rest and use as much of a GUID the user gives
+		 */
+		do {
+			unsigned char value, hex;
+
+			p = strrchr(arg, ':');
+			if (p)
+				*(p++) = 0;
+			else
+				p = arg;
+
+			if (octetspercolon == 2) {
+				/* There should be no more characters after this */
+				if (*(p + 4) != 0)
+					return -1;
+
+				hex = toupper(*(p + 2));
+				if (hex >= '0' && hex <= '9')
+					value = (hex - '0') << 4;
+				else if (hex >= 'A' && hex <= 'F')
+					value = (hex - 'A' + 10) << 4;
+				else
+					return -1;
+
+				hex = toupper(*(p + 3));
+				if (hex >= '0' && hex <= '9')
+					value |= hex - '0';
+				else if (hex >= 'A' && hex <= 'F')
+					value |= hex - 'A' + 10;
+				else
+					return -1;
+
+				hexstr[--octets] = value;
+			} else {
+				/* There should be no more characters after this */
+				if (*(p + 2) != 0)
+					return -1;
+			}
+
+			hex = toupper(*p);
+			if (hex >= '0' && hex <= '9')
+				value = (hex - '0') << 4;
+			else if (hex >= 'A' && hex <= 'F')
+				value = (hex - 'A' + 10) << 4;
+			else
+				return -1;
+
+			hex = toupper(*(p + 1));
+			if (hex >= '0' && hex <= '9')
+				value |= hex - '0';
+			else if (hex >= 'A' && hex <= 'F')
+				value |= hex - 'A' + 10;
+			else
+				return -1;
+
+			hexstr[--octets] = value;
+		} while (p > arg && octets > 0);
+
+		/* Data left over */
+		if (p > arg)
+			return 1;
+	} else {
+		unsigned long low_guid = strtol(arg, NULL, 16);
+
+		/* FIXME: Check the result of strtol, or do something more intelligent */
+
+		hexstr[octets - 4] = (low_guid >> 24) & 0xff;
+		hexstr[octets - 3] = (low_guid >> 16) & 0xff;
+		hexstr[octets - 2] = (low_guid >> 8) & 0xff;
+		hexstr[octets - 1] = low_guid & 0xff;
+
+		octets -= 4;
+	}
+
+	return octets;
+}
+
+static int parse_guid(char *arg, unsigned char *new_guid)
+{
+	int octets;
+
+	octets = parse_hex_str(arg, new_guid, GUID_LEN);
+
+	if (octets < 0)
+		return 1;
+
+	if (octets > 0 && octets < 3) {
+		fprintf(stderr, "GUID is not 8 octets, but longer than 4 maximum to automatically generate\n");
+		return 1;
+	}
+
+	if (octets >= 3) {
+		memcpy(new_guid, default_oid, 4);
+
+		if (octets > 3)
+			/* Zero out the non specified portions */
+			memset(new_guid + 3, 0, octets - 3);
+	}
+
+	return 0;
+}
+
+static int parse_change_options(struct topspin_vsd *vsd, char *cmd)
+{
+	char *p = cmd, *end = strchr(cmd, 0);
+
+	while (p && p < end) {
+		char *pc, *pe;
+
+		pc = strchr(p, ',');
+		if (pc) {
+			*pc = 0;
+			pc++;
+		}
+
+		pe = strchr(p, '=');
+		if (!pe) {
+			fprintf(stderr, "Missing = in token '%s'\n", p);
+			return 1;
+		}
+
+		*pe = 0;
+		pe++;
+
+		if (strcasecmp(p, "auto_upgrade") == 0) {
+			if (strcasecmp(pe, "yes") == 0 ||
+			    strcasecmp(pe, "on") == 0 ||
+			    strcasecmp(pe, "1") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_AUTOUPGRADE);
+			else if (strcasecmp(pe, "no") == 0 ||
+				 strcasecmp(pe, "off") == 0 ||
+				 strcasecmp(pe, "0") == 0)
+				vsd->flags &= ~cpu_to_be32(VSD_FLAG_AUTOUPGRADE);
+			else {
+				fprintf(stderr, "Unknown boolean value '%s'\n", pe);
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_enable_port_1") == 0) {
+			if (strcasecmp(pe, "yes") == 0 ||
+			    strcasecmp(pe, "on") == 0 ||
+			    strcasecmp(pe, "1") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_ENABLE_PORT_1);
+			else if (strcasecmp(pe, "no") == 0 ||
+				 strcasecmp(pe, "off") == 0 ||
+				 strcasecmp(pe, "0") == 0)
+				vsd->flags &= ~cpu_to_be32(VSD_FLAG_BOOT_ENABLE_PORT_1);
+			else {
+				fprintf(stderr, "Unknown boolean value '%s'\n", pe);
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_enable_port_2") == 0) {
+			if (strcasecmp(pe, "yes") == 0 ||
+			    strcasecmp(pe, "on") == 0 ||
+			    strcasecmp(pe, "1") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_ENABLE_PORT_2);
+			else if (strcasecmp(pe, "no") == 0 ||
+				 strcasecmp(pe, "off") == 0 ||
+				 strcasecmp(pe, "0") == 0)
+				vsd->flags &= ~cpu_to_be32(VSD_FLAG_BOOT_ENABLE_PORT_2);
+			else {
+				fprintf(stderr, "Unknown boolean value '%s'\n", pe);
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_service_scan") == 0) {
+			if (strcasecmp(pe, "yes") == 0 ||
+			    strcasecmp(pe, "on") == 0 ||
+			    strcasecmp(pe, "1") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_ENABLE_SCAN);
+			else if (strcasecmp(pe, "no") == 0 ||
+				 strcasecmp(pe, "off") == 0 ||
+				 strcasecmp(pe, "0") == 0)
+				vsd->flags &= ~cpu_to_be32(VSD_FLAG_BOOT_ENABLE_SCAN);
+			else {
+				fprintf(stderr, "Unknown boolean value '%s'\n", pe);
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_wait_on_error") == 0) {
+			if (strcasecmp(pe, "yes") == 0 ||
+			    strcasecmp(pe, "on") == 0 ||
+			    strcasecmp(pe, "1") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_WAIT_ON_ERROR);
+			else if (strcasecmp(pe, "no") == 0 ||
+				 strcasecmp(pe, "off") == 0 ||
+				 strcasecmp(pe, "0") == 0)
+				vsd->flags &= ~cpu_to_be32(VSD_FLAG_BOOT_WAIT_ON_ERROR);
+			else {
+				fprintf(stderr, "Unknown boolean value '%s'\n", pe);
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_try_forever") == 0) {
+			if (strcasecmp(pe, "yes") == 0 ||
+			    strcasecmp(pe, "on") == 0 ||
+			    strcasecmp(pe, "1") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_TRY_FOREVER);
+			else if (strcasecmp(pe, "no") == 0 ||
+				 strcasecmp(pe, "off") == 0 ||
+				 strcasecmp(pe, "0") == 0)
+				vsd->flags &= ~cpu_to_be32(VSD_FLAG_BOOT_TRY_FOREVER);
+			else {
+				fprintf(stderr, "Unknown boolean value '%s'\n", pe);
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_type") == 0) {
+			vsd->flags &= ~cpu_to_be32(VSD_FLAG_BOOT_TYPE);
+			if (strcasecmp(pe, "well_known") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_TYPE_WELL_KNOWN);
+			else if (strcasecmp(pe, "saved") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_TYPE_SAVED);
+			else if (strcasecmp(pe, "pxe") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_TYPE_PXE);
+			else if (strcasecmp(pe, "disable") == 0)
+				vsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_TYPE_DISABLE);
+			else {
+				fprintf(stderr, "Unknown boot type '%s'\n", pe);
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_saved_port") == 0) {
+			unsigned long port;
+
+			port = strtoul(pe, NULL, 10);
+			if (port > 2) {
+				fprintf(stderr, "Invalid port number '%s'\n", pe);
+				return 1;
+			}
+
+			vsd->boot_port = port;
+		} else if (strcasecmp(p, "boot_saved_ioc_num") == 0) {
+			unsigned long ioc;
+
+			ioc = strtoul(pe, NULL, 10);
+			if (ioc == ULONG_MAX) {
+				fprintf(stderr, "Invalid ioc number '%s'\n", pe);
+				return 1;
+			}
+
+			vsd->boot_ioc_num = ioc;
+		} else if (strcasecmp(p, "boot_saved_dgid") == 0) {
+			if (parse_hex_str(pe, vsd->boot_dgid, 16) < 0) {
+				fprintf(stderr, "Couldn't parse dgid\n");
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_saved_service_name") == 0) {
+			if (parse_hex_str(pe, vsd->boot_service_name, 8) < 0) {
+				fprintf(stderr, "Couldn't parse service name\n");
+				return 1;
+			}
+		} else if (strcasecmp(p, "boot_pxe_secs") == 0) {
+			unsigned long secs;
+
+			secs = strtoul(pe, NULL, 10);
+			if (secs > 250) {
+				fprintf(stderr, "Invalid number of seconds '%s'\n", pe);
+				return 1;
+			}
+
+			vsd->boot_pxe_secs = secs;
+		} else {
+			fprintf(stderr, "Unknown option '%s'\n", p);
+			return 1;
+		}
+
+		p = pc;
+	}
+
+	return 0;
+}
+
+static void inc_guid(unsigned char *guid, unsigned char *new_guid)
+{
+	int i, carry = 1;
+
+	/* FIXME: Do we really want to try to increment the vendor oid too? */
+	for (i = 7; i >= 0; i--) {
+		if (carry && guid[i] == 0xFF) {
+			new_guid[i] = 0;
+			carry = 1;
+		} else {
+			new_guid[i] = guid[i] + carry;
+			carry = 0;
+		}
+	}
+}
+
+unsigned int status_curpos, status_relpos, status_maxpos;
+unsigned int status_curbar;
+unsigned char status_prev;
+
+static void status_start(unsigned int max)
+{
+	status_curpos = 0;
+	status_relpos = 0;
+	status_maxpos = max;
+
+	status_curbar = 0;
+	status_prev = 0;
+
+	if (verbose)
+		printf("Flashing - ");
+}
+
+static void status_update(unsigned char status, unsigned int curpos)
+{
+	unsigned int bar;
+
+	if (!verbose)
+		return;
+
+	curpos += status_relpos;
+
+	bar = (curpos * (cols - 12)) / status_maxpos;
+	status_curpos = curpos;
+
+	/* Force a character to be printed during a status change */
+	if (status != status_prev && status_curbar >= bar)
+		bar = status_curbar + 1;
+
+	if (status_curbar < bar) {
+		for (; status_curbar < bar; status_curbar++)
+			printf("%c", status);
+
+		fflush(stdout);
+	}
+
+	status_prev = status;
+}
+
+static void status_mark(void)
+{
+	status_relpos = status_curpos;
+}
+
+static void status_stop(void)
+{
+	if (verbose)
+		printf("\n");
+}
+
+/*
+ * HCA card management
+ */
+
+static int vpd_read(struct tvdevice *tvdev);
+
+static int scan_devices(struct pci_access *pacc)
+{
+	struct pci_dev *pdev;
+	struct tvdevice *tvdev;
+	int pci_count = 0, pciconf_count = 0;
+	unsigned short kernel;
+	struct utsname utsname;
+
+	/*
+	 * libpci, depending on the kernel it's running under, will create the
+	 * PCI device list in the correct order, or backwards. As a result, we
+	 * need to create our list appropriately too so the order of the HCAs
+	 * matches what the kernel sees the HCA list (ie ib0 is HCA #0, etc)
+	 */
+	if (uname(&utsname) < 0) {
+		fprintf(stderr, "couldn't get uname information, assuming 2.4 kernel\n");
+		kernel = 0x0204;
+	} else {
+		unsigned int major, minor;
+
+		sscanf(utsname.release, "%d.%d", &major, &minor);
+		kernel = ((major & 0xff) << 8) | (minor & 0xff);
+	}
+
+	/*
+	 * Example of how various configurations appear on the PCI bus.
+	 * A1 is first HCA, A0 is second HCA.
+	 *
+	 * Example of both A1 and A0 HCAs in normal mode:
+	 *
+	 * 07:00:0 5a44 00a0 (MT23108)
+	 * 04:00:0 5a44 00a1 (MT23108)
+	 * 06:01:0 5a46 00a0 (PCI bridge)
+	 * 03:01:0 5a46 00a1 (PCI bridge)
+	 *
+	 * Example of A1 HCA in normal mode, A0 HCA in recovery mode:
+	 *
+	 * 06:01:0 5a45 00a0 (PCI conf)
+	 * 04:00:0 5a44 00a1 (MT23108)
+	 * 03:01:0 5a46 00a1 (PCI bridge)
+	 *
+	 * Example of A1 HCA in recovery mode, A0 HCA in normal mode:
+	 *
+	 * 06:00:0 5a44 00a0 (MT23108)
+	 * 05:01:0 5a46 00a0 (PCI bridge)
+	 * 03:01:0 5a45 00a1 (PCI conf)
+	 */
+	for (pdev = pacc->devices; pdev; pdev = pdev->next) {
+		int i;
+
+		pci_fill_info(pdev, PCI_FILL_IDENT);
+
+		for (i = 0; i < sizeof(pciids) / sizeof(pciids[0]); i++) {
+			if (pciids[i].vendor != pdev->vendor_id ||
+					pciids[i].device != pdev->device_id)
+				continue;
+
+			tvdev = calloc(1, sizeof *tvdev);
+			if (!tvdev) {
+				fprintf(stderr, "couldn't allocate %zd bytes for device struct\n", sizeof *tvdev);
+				return -1;
+			}
+
+			tvdev->pdev = pdev;
+			tvdev->pciid = &pciids[i];
+			tvdev->flags = pciids[i].flags;
+
+			vpd_read(tvdev);
+
+			tvdev->revision = pci_read_word(pdev, PCI_CLASS_REVISION) & 0xff;
+
+			/* According to the documentation, a revision of 0x00 is an A0 */
+			if (tvdev->revision == 0x00)
+				tvdev->revision = 0xA0;
+			else if (tvdev->revision == 0x01)
+				tvdev->revision = 0xA1;
+
+			if (kernel <= 0x0204) {
+				tvdev->next = tvdevices;
+				if (!tvdevices_tail)
+					tvdevices_tail = tvdev;
+				tvdevices = tvdev;
+			} else {
+				if (tvdevices_tail)
+					tvdevices_tail->next = tvdev;
+				else /* first device we found */
+					tvdevices = tvdev;
+				tvdevices_tail = tvdev;
+			}
+		}
+	}
+
+	for (tvdev = tvdevices; tvdev; tvdev = tvdev->next) {
+		if (tvdev->flags & FLAG_RECOVERY)
+			tvdev->num = pciconf_count++;
+		else
+			tvdev->num = pci_count++;
+	}
+
+	return pci_count + pciconf_count;
+}
+
+static struct tvdevice *find_device(int hca)
+{
+	struct tvdevice *tvdev;
+
+	for (tvdev = tvdevices; tvdev && hca; tvdev = tvdev->next, hca--)
+		;
+
+	return tvdev;
+}
+
+/*
+ * Low level flash functions (flash device, GPIO)
+ */
+
+/*
+ * VPD code
+ */
+
+static int read_vpd_data(struct pci_dev *pdev, unsigned int vpd_off,
+	unsigned int addr, unsigned int *data)
+{
+	int i;
+	unsigned int val;
+	struct timeval tstart, tcur;
+	unsigned long elapsed;
+
+	gettimeofday(&tstart, NULL);
+
+	i = pci_write_long(pdev, vpd_off, addr << 16);
+	do {
+		val = pci_read_long(pdev, vpd_off);
+		if ((val >> 31) & 0x01) {
+			val = htonl(pci_read_long(pdev, vpd_off + 4));
+			*data = val;
+			return 0;
+		}
+		gettimeofday(&tcur, NULL);
+		elapsed = ((tcur.tv_sec - tstart.tv_sec) * 1000L) +
+				((tcur.tv_usec - tstart.tv_usec) / 1000L);
+	} while (elapsed < 100);
+
+	if (verbose > 1)
+		fprintf(stderr, "read_vpd_data: timed out at off %x\n", addr);
+
+	return 1;
+}
+
+static int vpd_exists(struct pci_dev *pdev, int *vpd_off)
+{
+	int cap_ptr, cap_id;
+	int val;
+
+	cap_ptr = pci_read_long(pdev, PCI_CAPABILITY_LIST) & 0xff;
+	while (cap_ptr != 0) {
+		val = pci_read_long(pdev, cap_ptr);
+		cap_id = val & 0xff;
+		if (cap_id == PCI_CAP_ID_VPD) {
+			*vpd_off = cap_ptr;
+			return 1;
+		}
+		cap_ptr = (val >> 8) & 0xff;
+	}
+
+	return 0;
+}
+
+static int vpd_read(struct tvdevice *tvdev)
+{
+	int vpd_off;
+
+	tvdev->vpd_present = 0;
+
+	if (vpd_exists(tvdev->pdev, &vpd_off)) {
+		unsigned int *ptr;
+		int i, swap_endian = 0;
+
+		ptr = tvdev->vpd.vpd_int;
+
+		if (read_vpd_data(tvdev->pdev, vpd_off, 0, ptr++) != 0)
+			return 0;
+
+		/* Check to see if we got the endianess swapped on us */
+		if (tvdev->vpd.vpd_char[0] != 0x82 && tvdev->vpd.vpd_char[3] == 0x82)
+			swap_endian = 1;
+
+		for (i = 1; i < 64; i++) {
+			if (read_vpd_data(tvdev->pdev, vpd_off, (i * 4), ptr++) != 0) {
+				if (i < 32)
+					return 0;
+				else
+					break;
+			}
+		}
+
+		tvdev->vpd_present = 1;
+
+		if (swap_endian) {
+			ptr = tvdev->vpd.vpd_int;
+			for (i = 0; i < 64; i++) {
+				*ptr = swab32(*ptr);
+				ptr++;
+			}
+		}
+	}
+
+	return tvdev->vpd_present;
+}
+
+/*
+ * Read/Write from the configuration space
+ */
+static unsigned int read_cfg(struct tvdevice *tvdev, unsigned int addr)
+{
+	unsigned int val;
+
+	switch (tvdev->method) {
+	case METHOD_MMAP:
+		/*
+		 * Work around Hermon errate that allows config space
+		 * writes to be passed by reads (so we avoid reading
+		 * stale data and eg thinking a SPI command is already
+		 * done because the BUSY bit isn't set).
+		 */
+		if (tvdev->flush_posted_write) {
+			*(volatile uint32_t *)(tvdev->bar0 + 0xf0380) = 0;
+			while (*(volatile uint32_t *)(tvdev->bar0 + 0xf0380))
+				; /* nothing */
+			tvdev->flush_posted_write = 0;
+		}
+
+		val = ntohl(*(uint32_t *)(tvdev->bar0 + addr));
+		break;
+
+	case METHOD_PCI_CFG:
+		if (!pci_write_long(tvdev->pdev, 22 * 4, addr)) {
+			fprintf(stderr, "read_cfg: pci_write_long failed\n");
+			exit(1);
+		}
+
+		val = pci_read_long(tvdev->pdev, 23 * 4);
+		break;
+	default:
+		abort();
+	}
+
+	return val;
+}
+
+static void write_cfg(struct tvdevice *tvdev, unsigned int addr,
+	unsigned int data)
+{
+	switch (tvdev->method) {
+	case METHOD_MMAP:
+		*(uint32_t *)(tvdev->bar0 + addr) = htonl(data);
+
+		/*
+		 * This workaround is supposed to be needed only for
+		 * A0 Hermon, but use it workaround for all Hermons
+		 * for now:
+		 */
+		if (tvdev->board && tvdev->board->chip == CHIP_HERMON)
+			tvdev->flush_posted_write = 1;
+		break;
+
+	case METHOD_PCI_CFG:
+		if (!pci_write_long(tvdev->pdev, 22 * 4, addr) ||
+				!pci_write_long(tvdev->pdev, 23 * 4, data)) {
+			fprintf(stderr, "write_cfg: pci_write_long failed\n");
+			exit(1);
+		}
+		break;
+	default:
+		abort();
+	}
+}
+
+#define NUM_SPIS	4
+
+#define FLASH_GW		0xF0400
+#define FLASH_ADDR		0xF0404
+
+#define SINAI_FLASH_DATA	0xF0408
+#define SINAI_FLASH_CS		0xF0418
+
+#define HERMON_FLASH_DATA	0xF0410
+
+#define SPI_READ		(1 <<  0)
+#define BUSY			(1 << 30)
+
+#define SINAI_SPI_NO_DATA	(1 <<  4)
+#define SINAI_SPI_NO_ADDR	(1 <<  5)
+#define SINAI_SPI_SPECIAL	(1 <<  6)
+
+#define HERMON_SPI_INSTR_PHASE	(1 <<  2)
+#define HERMON_SPI_ADDR_PHASE	(1 <<  3)
+#define HERMON_SPI_DATA_PHASE	(1 <<  4)
+#define HERMON_SPI_FLASH_ENABLE	(1 << 13)
+
+#define WIP				 (1 << 24)
+#define WEL				 (1 << 25)
+
+#define FC_SE		0xd8
+#define FC_PP		0x02
+#define FC_RD		0x03
+#define FC_RDSR		0x05
+#define FC_RDID		0x9f
+#define FC_WREN		0x06
+
+#define SPI_RDID_M25P80 0xffffffff
+#define SPI_RDID_M25P16 0x20201500
+
+#define WAIT_INTERVAL 10
+
+static void flash_set_cs(struct tvdevice *tvdev, unsigned int bank)
+{
+	switch (tvdev->flash_command_set) {
+	case CS_SPI_SINAI:
+		write_cfg(tvdev, SINAI_FLASH_CS, bank << 30);
+		break;
+	case CS_SPI_HERMON:
+		/* Nothing to do but save off bank */
+		break;
+	default:
+		/* Set the appropriate data bits */
+		write_cfg(tvdev, GPIO_DAT + 4, (read_cfg(tvdev, GPIO_DAT + 4) & ~(0x07 << 4)) | (bank << 4));
+		break;
+	}
+
+	tvdev->flash_bank = bank;
+}
+
+uint32_t flash_spi_exec_special(struct tvdevice *tvdev, int op, int logsize)
+{
+	uint32_t status;
+
+	switch (tvdev->flash_command_set) {
+	case CS_SPI_SINAI:
+		write_cfg(tvdev, FLASH_ADDR, op << 24);
+		write_cfg(tvdev, FLASH_GW, SPI_READ | SINAI_SPI_NO_ADDR |
+			  SINAI_SPI_SPECIAL | BUSY | logsize << 8);
+
+		do {
+			status = read_cfg(tvdev, FLASH_GW);
+		} while (status & BUSY);
+		return read_cfg(tvdev, SINAI_FLASH_DATA);
+
+	case CS_SPI_HERMON:
+		write_cfg(tvdev, FLASH_GW, SPI_READ | HERMON_SPI_INSTR_PHASE |
+			  HERMON_SPI_DATA_PHASE | HERMON_SPI_FLASH_ENABLE |
+			  tvdev->flash_bank << 11 | op << 16 | BUSY | logsize << 8);
+
+		do {
+			status = read_cfg(tvdev, FLASH_GW);
+		} while (status & BUSY);
+
+		return read_cfg(tvdev, HERMON_FLASH_DATA);
+
+	default:
+		abort();
+	}
+
+}
+
+uint32_t flash_spi_rdsr(struct tvdevice *tvdev)
+{
+	return flash_spi_exec_special(tvdev, FC_RDSR, 2);
+}
+
+/* Discover the devices connected to the Sinai SPI interface */
+void spi_discover_serial_proms(struct tvdevice *tvdev)
+{
+	unsigned int status, sp_num;
+
+	tvdev->flash_num_spis = 0;
+
+	do {
+		status = read_cfg(tvdev, FLASH_GW);
+	} while (status & BUSY);
+
+	switch (tvdev->board->chip) {
+	case CHIP_SINAI:  tvdev->flash_command_set = CS_SPI_SINAI; break;
+	case CHIP_HERMON: tvdev->flash_command_set = CS_SPI_HERMON; break;
+	default:	  tvdev->flash_command_set = CS_UNKNOWN; break;
+	}
+
+	for (sp_num = 0; sp_num < NUM_SPIS; sp_num++) {
+		flash_set_cs(tvdev, sp_num);
+		if (flash_spi_rdsr(tvdev) >> 24 == 0)
+			tvdev->flash_num_spis++;
+	}
+
+	/* Discover the type of the first SPI device - it's assumed they are all the same */
+	flash_set_cs(tvdev, 0);
+
+	switch (flash_spi_exec_special(tvdev, FC_RDID, 2)) {
+	case SPI_RDID_M25P80:
+		tvdev->flash_spi_sp_type = SP_ST_M25P80;
+		tvdev->flash_size = tvdev->flash_num_spis * 0x100000;
+		tvdev->flash_bank_shift = 20;
+		break;
+
+	case SPI_RDID_M25P16:
+		tvdev->flash_spi_sp_type = SP_ST_M25P16;
+		tvdev->flash_size = tvdev->flash_num_spis * 0x200000;
+		tvdev->flash_bank_shift = 21;
+		break;
+
+	default:
+		tvdev->flash_spi_sp_type = SP_UNKNOWN;
+		/* Assume some conservative settings */
+		tvdev->flash_num_spis = 1;
+		tvdev->flash_size = 0x100000;
+		tvdev->flash_bank_shift = 20;
+	}
+
+	tvdev->flash_sector_sz = 0x10000;	/* 64KB */
+}
+
+static void flash_set_bank(struct tvdevice *tvdev, unsigned int addr)
+{
+	unsigned char bank = addr >> tvdev->flash_bank_shift;
+
+	if (bank == tvdev->flash_bank)
+		return;
+
+	flash_set_cs(tvdev, bank);
+}
+
+/* read a dword from the flash, address must be 4 bytes aligned */
+static unsigned int flash_read(struct tvdevice *tvdev, unsigned int addr)
+{
+	unsigned int cmd, status;
+
+	flash_set_bank(tvdev, addr);
+
+	switch (tvdev->flash_command_set) {
+	case CS_SPI_SINAI:
+		write_cfg(tvdev, FLASH_ADDR, (addr & tvdev->flash_bank_mask));
+		write_cfg(tvdev, FLASH_GW, SPI_READ | BUSY | (2 << 8));
+
+		do {
+			status = read_cfg(tvdev, FLASH_GW);
+		} while (status & BUSY);
+
+		return read_cfg(tvdev, SINAI_FLASH_DATA);
+
+	case CS_SPI_HERMON:
+		write_cfg(tvdev, FLASH_ADDR, (addr & tvdev->flash_bank_mask));
+		write_cfg(tvdev, FLASH_GW, SPI_READ | HERMON_SPI_INSTR_PHASE |
+			  HERMON_SPI_ADDR_PHASE | HERMON_SPI_DATA_PHASE |
+			  HERMON_SPI_FLASH_ENABLE | FC_RD << 16 |
+			  tvdev->flash_bank << 11 | BUSY | (2 << 8));
+
+		do {
+			status = read_cfg(tvdev, FLASH_GW);
+		} while (status & BUSY);
+
+		return read_cfg(tvdev, HERMON_FLASH_DATA);
+
+	default:
+		write_cfg(tvdev, 0xF01A4, (addr & (tvdev->flash_bank_mask & ~3)) | (1 << 29));
+		do {
+			cmd = read_cfg(tvdev, 0xF01A4);
+		} while (cmd & 0xE0000000);
+
+		return read_cfg(tvdev, 0xF01A8);
+	}
+}
+
+/* read a byte from the flash */
+static unsigned char flash_byte_read(struct tvdevice *tvdev, unsigned int addr)
+{
+	unsigned int data;
+
+	data = flash_read(tvdev, addr & ~3);
+	return ((data >> ((3 - (addr & 3)) * 8)) & 0xFF);
+}
+
+/* writes a command to the flash */
+static void flash_write_cmd(struct tvdevice *tvdev, unsigned int addr,
+	unsigned char data)
+{
+	unsigned int cmd;
+
+	write_cfg(tvdev, 0xF01A8, data << 24);
+	write_cfg(tvdev, 0xF01A4, (addr & tvdev->flash_bank_mask) | (2 << 29));
+	do {
+		cmd = read_cfg(tvdev, 0xF01A4);
+	} while (cmd & 0xE0000000);
+}
+
+static void flash_chip_reset(struct tvdevice *tvdev)
+{
+	/* Issue Flash Reset Command */
+	switch (tvdev->flash_command_set) {
+	case CS_INTEL:
+		flash_write_cmd(tvdev, 0x555, 0xFF);
+		break;
+	case CS_AMD:
+		flash_write_cmd(tvdev, 0x555, 0xF0);
+		break;
+	default:
+		break;
+	}
+}
+
+static void spi_wait_wip(struct tvdevice *tvdev)
+{
+	unsigned int status;
+	unsigned int count = 0;
+
+	do {
+		status = read_cfg(tvdev, FLASH_GW);
+	} while (status & BUSY);
+
+	do {
+		if (++count > 5000)
+			usleep(WAIT_INTERVAL);
+
+		status = flash_spi_rdsr(tvdev);
+	} while (status & WIP);
+}
+
+static void flash_spi_write_enable(struct tvdevice *tvdev)
+{
+	uint32_t status;
+
+	switch (tvdev->flash_command_set) {
+	case CS_SPI_SINAI:
+		write_cfg(tvdev, FLASH_ADDR, FC_WREN << 24);
+		write_cfg(tvdev, FLASH_GW, SINAI_SPI_NO_ADDR | SINAI_SPI_NO_DATA |
+			  SINAI_SPI_SPECIAL | BUSY);
+		break;
+
+	case CS_SPI_HERMON:
+		write_cfg(tvdev, FLASH_GW, HERMON_SPI_INSTR_PHASE |
+			  HERMON_SPI_FLASH_ENABLE | FC_WREN << 16 |
+			  tvdev->flash_bank << 11 | BUSY);
+		break;
+
+	default:
+		abort();
+	}
+
+	do {
+		status = read_cfg(tvdev, FLASH_GW);
+	} while (status & BUSY);
+}
+
+static void flash_erase_sector(struct tvdevice *tvdev, unsigned int addr)
+{
+	unsigned int status;
+
+	flash_set_bank(tvdev, addr);
+
+	/* Issue Flash Sector Erase Command */
+	switch (tvdev->flash_command_set) {
+	case CS_SPI_SINAI:
+		flash_spi_write_enable(tvdev);
+
+		/* Issue Sector Erase */
+		write_cfg(tvdev, FLASH_ADDR, (FC_SE << 24) | (addr & tvdev->flash_bank_mask));
+		write_cfg(tvdev, FLASH_GW, SINAI_SPI_NO_DATA | SINAI_SPI_SPECIAL | BUSY);
+
+		/* Wait for sector erase completion */
+		spi_wait_wip(tvdev);
+		break;
+
+	case CS_SPI_HERMON:
+		flash_spi_write_enable(tvdev);
+
+		/* Issue Sector Erase*/
+		write_cfg(tvdev, FLASH_ADDR, addr & tvdev->flash_bank_mask);
+		write_cfg(tvdev, FLASH_GW, HERMON_SPI_INSTR_PHASE |
+			  HERMON_SPI_ADDR_PHASE | HERMON_SPI_FLASH_ENABLE |
+			  FC_SE << 16 | tvdev->flash_bank << 11 | BUSY);
+
+		/* Wait for sector erase completion */
+		spi_wait_wip(tvdev);
+		break;
+
+	case CS_INTEL:
+		flash_write_cmd(tvdev, addr & tvdev->flash_bank_mask, 0x20); /* Erase */
+		flash_write_cmd(tvdev, addr & tvdev->flash_bank_mask, 0xD0); /* Confirm */
+
+		/* Wait for sector erase completion */
+		do {
+			usleep(WAIT_INTERVAL);
+			status = flash_read(tvdev, addr);
+		} while (!(status & 0x80));
+		break;
+
+	case CS_AMD:
+		flash_write_cmd(tvdev, 0x555, 0xAA);
+		flash_write_cmd(tvdev, 0x2AA, 0x55);
+		flash_write_cmd(tvdev, 0x555, 0x80);
+		flash_write_cmd(tvdev, 0x555, 0xAA);
+		flash_write_cmd(tvdev, 0x2AA, 0x55);
+		flash_write_cmd(tvdev, addr & tvdev->flash_bank_mask, 0x30);
+
+		/* Wait for sector erase completion */
+		do {
+			usleep(WAIT_INTERVAL);
+			status = flash_read(tvdev, addr);
+		} while (status != 0xFFFFFFFF);
+		break;
+	default:
+		break;
+	}
+
+	flash_chip_reset(tvdev);
+}
+
+static int log2up(unsigned long in)
+{
+	unsigned int i;
+
+	for (i = 0; i < 32; i++) {
+		if (in <= (unsigned long)(1 << i))
+			break;
+	}
+
+	return i;
+}
+
+static void flash_spi_write_block(struct tvdevice *tvdev, unsigned int addr,
+				  unsigned char *sector, unsigned int len)
+{
+	int i;
+
+	flash_spi_write_enable(tvdev);
+
+	switch (tvdev->flash_command_set) {
+	case CS_SPI_SINAI:
+		write_cfg(tvdev, FLASH_ADDR, (FC_PP << 24) | (addr & tvdev->flash_bank_mask));
+
+		for (i = 0; i < len; i += 4) {
+			uint32_t dword = *((uint32_t *)(sector + i));
+
+			write_cfg(tvdev, SINAI_FLASH_DATA + i, be32_to_cpu(dword));
+		}
+
+		write_cfg(tvdev, FLASH_GW, SINAI_SPI_SPECIAL | BUSY | (log2up(len) << 8));
+		break;
+
+	case CS_SPI_HERMON:
+		write_cfg(tvdev, FLASH_ADDR, addr & tvdev->flash_bank_mask);
+
+		for (i = 0; i < len; i += 4) {
+			uint32_t dword = *((uint32_t *)(sector + i));
+
+			write_cfg(tvdev, HERMON_FLASH_DATA + i, be32_to_cpu(dword));
+		}
+
+		write_cfg(tvdev, FLASH_GW, HERMON_SPI_INSTR_PHASE |
+			  HERMON_SPI_ADDR_PHASE | HERMON_SPI_DATA_PHASE |
+			  HERMON_SPI_FLASH_ENABLE | FC_PP << 16 |
+			  tvdev->flash_bank << 11 | BUSY | (log2up(len) << 8));
+		break;
+
+	default:
+		abort();
+	}
+
+	/* Wait for erase to complete */
+	spi_wait_wip(tvdev);
+}
+
+static void flash_write_byte(struct tvdevice *tvdev, unsigned int addr,
+			     unsigned char data)
+{
+	unsigned int status;
+
+	switch (tvdev->flash_command_set) {
+	case CS_INTEL:
+		flash_write_cmd(tvdev, addr & tvdev->flash_bank_mask, 0x40);
+		flash_write_cmd(tvdev, addr & tvdev->flash_bank_mask, data);
+
+		/* Wait for the Byte Program to Complete (Verify Byte Program) */
+		do {
+			status = flash_read(tvdev, addr & ~3);
+		} while (!(status & 0x80));
+		break;
+	case CS_AMD:
+		/* Issue Byte Program Command */
+		flash_write_cmd(tvdev, 0x555, 0xAA);
+		flash_write_cmd(tvdev, 0x2AA, 0x55);
+		flash_write_cmd(tvdev, 0x555, 0xA0);
+		flash_write_cmd(tvdev, addr & tvdev->flash_bank_mask, data);
+
+		/* Wait for the Byte Program to Complete (Verify Byte Program) */
+		do {
+			status = flash_read(tvdev, addr & ~3);
+		} while (data != ((status >> ((3 - (addr & 3)) * 8)) & 0xFF));
+		break;
+	default:
+		/* Not possible, but compiler complains */
+		break;
+	}
+}
+
+static int grab_gpio(struct tvdevice *tvdev)
+{
+	unsigned long elapsed_msec;
+	struct timeval tstart, tcur;
+
+	gettimeofday(&tstart, NULL);
+
+	/* Grab the semaphore first */
+	while (read_cfg(tvdev, 0xF03FC) == 1) {
+		gettimeofday(&tcur, NULL);
+		elapsed_msec = (tcur.tv_sec - tstart.tv_sec) * 1000L +
+			(tcur.tv_usec - tstart.tv_usec) / 1000L;
+		if (elapsed_msec > 10000) {
+			if (force) {
+				write_cfg(tvdev, 0xF03FC, 0);
+				fprintf(stderr, "Forcing release of flash semaphore.\n");
+				exit(1);
+				break;
+			}
+			else
+				return 1;
+		}
+	}
+
+	write_cfg(tvdev, 0xF03FC, 1);
+
+	/* Now copy out the values */
+	tvdev->gpio_data[0] = read_cfg(tvdev, GPIO_DAT) & 0xFF;
+	tvdev->gpio_data[1] = read_cfg(tvdev, GPIO_DAT + 4);
+
+	tvdev->gpio_direction[0] = read_cfg(tvdev, GPIO_DIR) & 0xFF;
+	tvdev->gpio_direction[1] = read_cfg(tvdev, GPIO_DIR + 4);
+
+	tvdev->gpio_polarity[0] = read_cfg(tvdev, GPIO_POL) & 0xFF;
+	tvdev->gpio_polarity[1] = read_cfg(tvdev, GPIO_POL + 4);
+
+	tvdev->gpio_output_mode[0] = read_cfg(tvdev, GPIO_MOD) & 0xFF;
+	tvdev->gpio_output_mode[1] = read_cfg(tvdev, GPIO_MOD + 4);
+
+	return 0;
+}
+
+static void release_gpio(struct tvdevice *tvdev)
+{
+	if (tvdev->board->chip == CHIP_SINAI) {
+		flash_set_bank(tvdev, 0);
+
+		/* Unlock GPIO */
+		write_cfg(tvdev, GPIO_LOCK, 0xAAAA);
+	}
+
+	/* Write back the saved values */
+	write_cfg(tvdev, GPIO_DAT, (read_cfg(tvdev, GPIO_DAT) & ~0xFF) | tvdev->gpio_data[0]);
+	write_cfg(tvdev, GPIO_DAT + 4, tvdev->gpio_data[1]);
+
+	write_cfg(tvdev, GPIO_DIR, (read_cfg(tvdev, GPIO_DIR) & ~0xFF) | tvdev->gpio_direction[0]);
+	write_cfg(tvdev, GPIO_DIR + 4, tvdev->gpio_direction[1]);
+
+	write_cfg(tvdev, GPIO_POL, (read_cfg(tvdev, GPIO_POL) & ~0xFF) | tvdev->gpio_polarity[0]);
+	write_cfg(tvdev, GPIO_POL + 4, tvdev->gpio_polarity[1]);
+
+	write_cfg(tvdev, GPIO_MOD, (read_cfg(tvdev, GPIO_MOD) & ~0xFF) | tvdev->gpio_output_mode[0]);
+	write_cfg(tvdev, GPIO_MOD + 4, tvdev->gpio_output_mode[1]);
+
+	/* Release the semaphore */
+	write_cfg(tvdev, 0xF03FC, 0);
+}
+
+static struct board *vpd_identify(struct tvdevice *tvdev)
+{
+	char str[MAX_STR];
+	int i;
+
+	if (tvdev->vpd_present) {
+		if (tvdev->vpd.vpd_char[0] == 0x82) {
+			unsigned short len16;
+			char *p = (char *)&tvdev->vpd.vpd_char[3];
+
+			memcpy(&len16, tvdev->vpd.vpd_char + 1, sizeof(len16));
+			len16 = le16_to_cpu(len16);
+
+			/* Skip leading whitespace */
+			for (; len16 > 0 && isspace(*p); len16--, p++)
+				;
+
+			/* Make sure we don't copy too much */
+			if (len16 > sizeof(str))
+				len16 = sizeof(str);
+
+			memcpy(str, p, len16);
+			str[len16] = 0;
+
+			/* Strip off any trailing whitespace */
+			for (len16--; len16 > 0 && isspace(str[len16]); len16--)
+				str[len16] = 0;
+		} else
+			fprintf(stderr, " \nError. String Tag not present (found tag %02x instead)\n",
+				tvdev->vpd.vpd_char[0]);
+	} else
+		str[0] = 0;
+
+	for (i = 0; i < sizeof(board_vpds) / sizeof(board_vpds[0]); i++) {
+		if (strcasecmp(str, board_vpds[i].str) == 0)
+			return board_vpds[i].board;
+	}
+
+	return NULL;
+}
+
+static struct board *arbel_identify(struct tvdevice *tvdev)
+{
+	struct board *board;
+
+	board = vpd_identify(tvdev);
+	if (board)
+		return board;
+
+	return &genarbel;
+}
+
+static struct board *sinai_identify(struct tvdevice *tvdev)
+{
+	struct board *board;
+
+	board = vpd_identify(tvdev);
+	if (board)
+		return board;
+
+	return &gensinai;
+}
+
+static struct board *hermon_identify(struct tvdevice *tvdev)
+{
+	struct board *board;
+
+	board = vpd_identify(tvdev);
+	if (board)
+		return board;
+
+	return &genhermon;
+}
+
+static struct board *tavor_identify(struct tvdevice *tvdev)
+{
+	struct board *board;
+
+	/* Detect the difference between a Jaguar and Cougar via the GPIO pins */
+
+	/* Set GPIO pin 12 to input and check the value */
+	write_cfg(tvdev, GPIO_DIR + 4, read_cfg(tvdev, GPIO_DIR + 4) & ~(1 << 12));
+
+	usleep(10);
+
+	/* Check if board is a Jaguar by looking at GPIO pin 12 */
+	if (!(read_cfg(tvdev, GPIO_DAT + 4) & (1 << 12)))
+		return &jaguar;
+
+	/* Check the rest by VPD */
+	board = vpd_identify(tvdev);
+	if (board)
+		return board;
+
+	/*
+	 * FIXME: We shouldn't assume Cougar if the VPD is corrupt. The very
+	 * fact that there is a VPD probably means it's not a Cougar board.
+	 * It's only a Cougar if there is no VPD at all.
+	 */
+
+	return &cougar;
+}
+
+void convert_old_topspin_vsd(union vsd *vsd)
+{
+	struct topspin_vsd_old old_vsd;
+	/* VSD Ascii prefix - prevents flint/mstflint from printing garbage */
+	static const char vsd_prefix_str[VSD_PREFIX_LENGTH] =
+		{ 'c', 's', 'i', 'C', '\0', '\0', '\0', 'o'};
+
+	if (verbose)
+		printf("  converting Topspin VSD format\n");
+
+	/* Make a copy of the old VSD */
+	memcpy(&old_vsd, vsd, sizeof old_vsd);
+
+	/* Setup the new VSD based on the information from the old VSD */
+	memset(vsd->raw, 0, sizeof(vsd->raw));
+
+	memcpy(vsd->topspin.vsd_prefix, vsd_prefix_str, sizeof vsd_prefix_str);
+
+	memcpy((void *) &vsd->topspin.signature1, &old_vsd, 
+	       offsetof(struct topspin_vsd_old, unused));
+
+	memcpy((void *) &vsd->topspin.boot_pxe_secs, &old_vsd.boot_pxe_secs,
+	       sizeof old_vsd - offsetof(struct topspin_vsd_old, boot_pxe_secs));
+}
+
+static void fixup_vsd(union vsd *vsd)
+{
+	struct topspin_vsd *tsvsd;
+
+	if (be16_to_cpu(vsd->topspin_old.signature1) == VSD_SIGNATURE_TOPSPIN &&
+	    be16_to_cpu(vsd->topspin_old.signature2) == VSD_SIGNATURE_TOPSPIN)
+		convert_old_topspin_vsd(vsd);
+
+	if (be16_to_cpu(vsd->topspin.signature1) == VSD_SIGNATURE_TOPSPIN &&
+	    be16_to_cpu(vsd->topspin.signature2) == VSD_SIGNATURE_TOPSPIN)
+		/* Not Topspin VSD */
+		return;
+
+	tsvsd = &vsd->topspin;
+
+	if (!(tsvsd->flags & cpu_to_be32(VSD_FLAG_ALIGN_FIXED))) {
+		/*
+		 * Some images have the hw_label field misaligned by one byte.
+		 * If this is an old image (the flag isn't set), then move
+		 * it back one character
+		 */
+		memmove(tsvsd->hw_label,
+			tsvsd->hw_label + 1,
+			sizeof(tsvsd->hw_label) - 1);
+		tsvsd->flags |= cpu_to_be32(VSD_FLAG_ALIGN_FIXED);
+	}
+
+	if (!(tsvsd->flags & cpu_to_be32(VSD_FLAG_NEW_BUILD_NUM))) {
+		/*
+		 * build_num used to be an 8 bit field, but our build numbers
+		 * quickly outgrew that limitation, so expand to 16 bits and
+		 * a new location
+		 */
+		tsvsd->build_num = tsvsd->old_build_num;
+		tsvsd->flags |= cpu_to_be32(VSD_FLAG_NEW_BUILD_NUM);
+	}
+
+	if ((tsvsd->flags & cpu_to_be32(VSD_FLAG_BOOT_OPTIONS)) &&
+			((tsvsd->boot_version < 1) || (tsvsd->boot_version > BOOT_VERSION))) {
+		/* Invalid, reset to defaults */
+		tsvsd->boot_version = BOOT_VERSION;
+		tsvsd->boot_port = 0;
+		tsvsd->boot_ioc_num = 0;
+		memset(tsvsd->boot_dgid, 0, sizeof(tsvsd->boot_dgid));
+		memset(tsvsd->boot_service_name, 0, sizeof(tsvsd->boot_service_name));
+		tsvsd->boot_pxe_secs = BOOT_PXE_SECS_DEFAULT;
+
+		tsvsd->flags &= ~cpu_to_be32(VSD_FLAG_BOOT_OPTIONS_MASK);
+		tsvsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_ENABLE_PORT_1 |
+					VSD_FLAG_BOOT_ENABLE_PORT_2 |
+					VSD_FLAG_BOOT_ENABLE_SCAN |
+					VSD_FLAG_BOOT_TYPE_WELL_KNOWN |
+					VSD_FLAG_BOOT_GID_BIG);
+	}
+
+	if (!(tsvsd->flags & cpu_to_be32(VSD_FLAG_BOOT_GID_BIG))) {
+		uint8_t dword[4];
+		int i;
+
+		for (i = 0; i < sizeof(tsvsd->boot_dgid); i += 4) {
+			memcpy(dword, &tsvsd->boot_dgid[i], 4);
+			tsvsd->boot_dgid[i + 0] = dword[3];
+			tsvsd->boot_dgid[i + 1] = dword[2];
+			tsvsd->boot_dgid[i + 2] = dword[1];
+			tsvsd->boot_dgid[i + 3] = dword[0];
+		}
+
+		tsvsd->flags |= cpu_to_be32(VSD_FLAG_BOOT_GID_BIG);
+	}
+
+	if (tsvsd->boot_version < 2) {
+		uint8_t dword[4];
+		int i;
+
+		tsvsd->boot_version = BOOT_VERSION;
+		tsvsd->boot_pxe_secs = BOOT_PXE_SECS_DEFAULT;
+
+		for (i = 0; i < sizeof(tsvsd->boot_service_name); i += 4) {
+			memcpy(dword, &tsvsd->boot_service_name[i], 4);
+			tsvsd->boot_service_name[i + 0] = dword[3];
+			tsvsd->boot_service_name[i + 1] = dword[2];
+			tsvsd->boot_service_name[i + 2] = dword[1];
+			tsvsd->boot_service_name[i + 3] = dword[0];
+		}
+	}
+}
+
+static void parse_image_info(uint8_t *buf, union vsd **vsd)
+{
+	int off = 0;
+	int size;
+
+	while (buf[off] != IMAGE_INFO_END) {
+		size = ntohl(*(uint32_t *) &buf[off]) & 0xffffff;
+
+		switch (buf[off]) {
+		case IMAGE_INFO_VSD:
+			*vsd = (union vsd *) (buf + off + 4);
+			break;
+		}
+
+		off += size + 4;
+	}
+}
+
+/*
+ * Mid level flash functions (firmware image)
+ */
+
+static int flash_image_read_from_file(char *fname,
+				      unsigned char **isbuf, unsigned int *isbufsz,
+				      unsigned char **psbuf, unsigned int *psbufsz,
+				      unsigned char **ibuf, unsigned int *ibufsz,
+				      union vsd **vsd)
+{
+	unsigned int sector_sz = 0;
+	uint32_t signature;
+	uint32_t ii_off;
+	unsigned char *buf;
+	struct stat imgstat;
+	FILE *fimg;
+	int i;
+
+	/* Open and read image files */
+	fimg = fopen(fname, "r");
+	if (fimg == NULL) {
+		fprintf(stderr, "tvflash: error opening file %s!\n", fname);
+		return 1;
+	}
+
+	/* Get the size of the image */
+	if (fstat(fileno(fimg), &imgstat) < 0) {
+		fprintf(stderr, "tvflash: cannot do stat on firmware image!\n");
+		return 1;
+	}
+
+	buf = malloc(imgstat.st_size);
+	if (!buf) {
+		fprintf(stderr, "tvflash: cannot allocate memory for the image buffer!\n");
+		return 1;
+	}
+
+	if (fread(buf, imgstat.st_size, 1, fimg) != 1) {
+		fprintf(stderr, "tvflash: error reading file %s!\n", fname);
+		return 1;
+	}
+	fclose(fimg);
+
+	*vsd = NULL;
+
+	/* Check the signature on the IS */
+	signature = be32_to_cpu(*(uint32_t *)(buf + 0x24));
+	if (signature == 0x5a445a44) {
+		unsigned int is_sz;
+
+		is_sz = be32_to_cpu(*(uint32_t *)(buf + 0x2c));
+
+		if (is_sz > 4 && is_sz < 1048576) {
+			uint16_t crc, img_crc;
+
+			/* is_sz is a count of dwords */
+			is_sz = is_sz * 4;
+			img_crc = be32_to_cpu(*(uint32_t *)(buf + 0x28 + is_sz + 12));
+
+			/* Verify the CRC of the IS */
+			crc = flash_crc16(buf + 0x28, is_sz + 16 - 4);
+			if (crc == img_crc) {
+				unsigned int sector_sz_ptr, log2_sector_sz;
+
+				/* Then grab the sector size */
+				sector_sz_ptr	= be16_to_cpu(*(uint16_t *)(buf + 0x16));
+				log2_sector_sz = be16_to_cpu(*(uint16_t *)(buf + sector_sz_ptr + 0x32));
+
+				/*
+				 * Do some sanity checking of the result.
+				 * Anything less than 4KB or more than
+				 * 1MB is suspicious and thrown out
+				 */
+				if (log2_sector_sz >= 12 && log2_sector_sz <= 20)
+					sector_sz = 1 << log2_sector_sz;
+			}
+		}
+	}
+
+	/* Check for PPS */
+	if (sector_sz &&
+	    be32_to_cpu(*(uint32_t *)(buf + sector_sz + 8)) == 0x5a445a44) {
+		/* Failsafe firmware image */
+		*isbuf = buf;
+		*isbufsz = sector_sz;
+		*psbuf = buf + sector_sz;
+		*psbufsz = sector_sz;
+		*ibuf = buf + be32_to_cpu(*(uint32_t *)(buf + sector_sz + 0));
+		*ibufsz = be32_to_cpu(*(uint32_t *)(buf + sector_sz + 4));
+
+		*vsd = (union vsd *) (buf + sector_sz + 0x20);
+	} else {
+		/* Non failsafe firmware image */
+		*isbuf = *psbuf = NULL;
+		*isbufsz = *psbufsz = 0;
+		*ibuf = buf;
+		*ibufsz = imgstat.st_size;
+
+		for (i = 0; i < sizeof hermon_fw_sig / sizeof hermon_fw_sig[0]; ++i)
+			if (ntohl(((uint32_t *) buf)[i]) != hermon_fw_sig[i])
+				break;
+
+		if (i == sizeof hermon_fw_sig / sizeof hermon_fw_sig[0]) {
+			ii_off = ntohl(*(uint32_t *) (buf + HERMON_FLASH_IMAGE_INFO_OFF));
+
+			i = (ii_off & 0xff) + (ii_off >> 8 & 0xff) +
+				(ii_off >> 16 & 0xff) + (ii_off >> 24);
+			if (i & 0xff)
+				printf("  WARNING: firmware has image info pointer %08x "
+				       "with checksum %x != 0\n",
+				       ii_off, i & 0xff);
+			else
+				parse_image_info(buf + (ii_off & 0xffffff), vsd);
+		}
+	}
+
+	if (*vsd)
+		fixup_vsd(*vsd);
+
+	return 0;
+}
+
+static int validate_xps(struct image *image, unsigned char *psbuf)
+{
+	/* Check for signature */
+	image->valid = (be32_to_cpu(*(uint32_t *)(psbuf + 0x8)) == 0x5a445a44);
+	if (image->valid) {
+		image->addr = be32_to_cpu(*(uint32_t *)(psbuf + 0x0));
+		image->size = be32_to_cpu(*(uint32_t *)(psbuf + 0x4));
+		/* Check CRC for xPS */
+		image->valid = (flash_crc16(psbuf, 0x104) == be16_to_cpu(*(uint16_t *)(psbuf + 0x106)));
+
+		memcpy(&image->vsd, psbuf + 0x20, sizeof image->vsd);
+
+		fixup_vsd(&image->vsd);
+	}
+
+	return image->valid;
+}
+
+static int tavor_flash_check_failsafe(struct tvdevice *tvdev)
+{
+	unsigned int sector_sz = 0;
+	struct tavor_failsafe *failsafe = &tvdev->fw.tavor_failsafe;
+	uint32_t signature;
+	unsigned char *psbuf;
+	int i;
+
+	/* Check the signature on the IS */
+	signature = flash_read(tvdev, 0x24);
+	if (signature == 0x5a445a44) {
+		unsigned char *is;
+		unsigned int is_sz;
+
+		is_sz = flash_read(tvdev, 0x2c);
+		if (is_sz > 4 && is_sz < 1048576) {
+			uint16_t crc, img_crc;
+
+			/* is_sz is a count of dwords */
+			is_sz = is_sz * 4;
+			is = malloc(is_sz + 16);
+			if (!is) {
+				fprintf(stderr, "couldn't allocate %d bytes for sector buffer\n",
+					is_sz);
+				exit(1);
+			}
+
+			for (i = 0; i < is_sz + 16; i += 4)
+				*(uint32_t *)(is + i) = be32_to_cpu(flash_read(tvdev, 0x28 + i));
+
+			img_crc = flash_read(tvdev, 0x28 + is_sz + 12);
+
+			/* Verify the CRC of the IS */
+			crc = flash_crc16(is, is_sz + 16 - 4);
+			if (crc == img_crc) {
+				unsigned int sector_sz_ptr, log2_sector_sz;
+
+				/* Then grab the sector size */
+				sector_sz_ptr	= flash_read(tvdev, 0x14) & 0xffff;
+				log2_sector_sz = flash_read(tvdev, sector_sz_ptr + 0x30) & 0xffff;
+
+				/*
+				 * Do some sanity checking of the result.
+				 * Anything less than 4KB or more than
+				 * 1MB is suspicious and thrown out
+				 */
+				if (log2_sector_sz >= 12 && log2_sector_sz <= 20)
+					sector_sz = 1 << log2_sector_sz;
+			}
+
+			free(is);
+		}
+	}
+
+	if (!sector_sz)
+		return 0;
+
+	psbuf = malloc(sector_sz);
+	if (!psbuf) {
+		fprintf(stderr, "couldn't allocate temp buffer for PPS/SPS (size = %d)\n",
+			sector_sz);
+		exit(1);
+	}
+
+	/* Check both PPS and SPS for valid signatures */
+
+	/* Read out the PPS */
+	for (i = 0; i < sector_sz; i += 4)
+		*(uint32_t *)(psbuf + i) = be32_to_cpu(flash_read(tvdev, sector_sz + i));
+
+	validate_xps(&failsafe->images[0], psbuf);
+
+	/* Read out the SPS */
+	for (i = 0; i < sector_sz; i += 4)
+		*(uint32_t *)(psbuf + i) = be32_to_cpu(flash_read(tvdev, sector_sz * 2 + i));
+
+	validate_xps(&failsafe->images[1], psbuf);
+
+	/*
+	 * Last sanity check. We can't say that the IS is programmed correctly
+	 * if we don't see a valid PPS or SPS.
+	 */
+	failsafe->valid = (failsafe->images[0].valid || failsafe->images[1].valid);
+
+	free(psbuf);
+
+	return failsafe->valid;
+}
+
+static int hermon_flash_get_info(struct tvdevice *tvdev)
+{
+	struct hermon_fw_info *fw_info = &tvdev->fw.hermon_fw_info;
+	static const int flash_base[] = {
+		0x0 , 0x10000, 0x20000, 0x40000, 0x80000, 0x100000
+	};
+	int i, j;
+	uint32_t chunk_info, ii_off;
+	uint32_t *ii, ii_size;
+
+	/* First look for a valid FW image */
+	for (i = 0; i < sizeof flash_base / sizeof flash_base[0]; ++i) {
+		for (j = 0; j < sizeof hermon_fw_sig / sizeof hermon_fw_sig[0]; ++j)
+			if (flash_read(tvdev, flash_base[i] + j * 4) !=
+			    hermon_fw_sig[j])
+				break;
+
+		if (j == sizeof hermon_fw_sig / sizeof hermon_fw_sig[0])
+			goto found;
+	}
+
+	if (verbose > 1)
+		printf("  No valid ConnectX FW found.\n");
+
+	return 0;
+
+found:
+	fw_info->base = flash_base[i];
+
+	chunk_info = flash_read(tvdev, fw_info->base + 0x28);
+	i = (chunk_info & 0xff) + (chunk_info >> 8 & 0xff) +
+		(chunk_info >> 16 & 0xff) + (chunk_info >> 24);
+	if (i & 0xff)
+		printf("  WARNING: firmware image at %x has chunk info word %08x "
+		       "with checksum %x != 0\n",
+		       fw_info->base, chunk_info, i & 0xff);
+
+	fw_info->failsafe   = !!(chunk_info & (1 << 3));
+	fw_info->chunk_size = 0x10000 << (chunk_info & 7);
+
+	ii_off = flash_read(tvdev, fw_info->base + HERMON_FLASH_IMAGE_INFO_OFF);
+	i = (ii_off & 0xff) + (ii_off >> 8 & 0xff) +
+		(ii_off >> 16 & 0xff) + (ii_off >> 24);
+	if (i & 0xff)
+		printf("  WARNING: firmware image at %x has image info pointer %08x "
+		       "with checksum %x != 0\n",
+		       fw_info->base, ii_off, i & 0xff);
+	ii_off &= 0xffffff;
+
+	memset(&fw_info->vsd, 0, sizeof fw_info->vsd);
+
+	ii_size = 256;
+	ii = malloc(ii_size);
+	if (!ii)
+		goto out;
+
+	i = 0;
+	while (1) {
+		ii[i] = flash_read(tvdev, fw_info->base + ii_off + i * 4);
+		if (ii[i] >> 24 == IMAGE_INFO_END)
+			break;
+
+		if ((i + 1) * sizeof (uint32_t) + (ii[i] & 0xfffffff) >= ii_size) {
+			ii_size *= 2;
+			ii = realloc(ii, ii_size);
+			if (!ii)
+				goto out;
+		}
+
+		for (j = 1; j <= (ii[i] & 0xffffff) / 4; ++j)
+			ii[i + j] = be32_to_cpu(flash_read(tvdev, fw_info->base + ii_off + (i + j) * 4));
+
+		if (ii[i] >> 24 == IMAGE_INFO_VSD) {
+			memcpy(&fw_info->vsd, &ii[i + 1], ii[i] & 0xffffff);
+			fixup_vsd(&fw_info->vsd);
+		}
+
+		i += j;
+	}
+
+out:
+	return fw_info->failsafe;
+}
+
+static int flash_get_info(struct tvdevice *tvdev)
+{
+	switch (tvdev->board->chip) {
+	case CHIP_TAVOR:
+	case CHIP_ARBEL:
+	case CHIP_SINAI:
+		return tavor_flash_check_failsafe(tvdev);
+
+	case CHIP_HERMON:
+		return hermon_flash_get_info(tvdev);
+
+	default:
+		return 0;
+	}
+}
+
+static int guid_offset(struct tvdevice *tvdev)
+{
+	switch (tvdev->board->chip) {
+	case CHIP_TAVOR:
+	case CHIP_ARBEL:
+	case CHIP_SINAI:
+		return TAVOR_FLASH_GUID_OFF;
+
+	case CHIP_HERMON:
+		return HERMON_FLASH_GUID_OFF;
+
+	default:
+		return 0;
+	}
+}
+
+static unsigned fw_image_addr(struct tvdevice *tvdev)
+{
+	switch (tvdev->board->chip) {
+	case CHIP_TAVOR:
+	case CHIP_ARBEL:
+	case CHIP_SINAI:
+		if (tvdev->fw.tavor_failsafe.valid) {
+			if (tvdev->fw.tavor_failsafe.images[0].valid)
+				return tvdev->fw.tavor_failsafe.images[0].addr;
+			else
+				return tvdev->fw.tavor_failsafe.images[1].addr;
+		} else
+			return 0;
+
+	case CHIP_HERMON:
+		return tvdev->fw.hermon_fw_info.base;
+
+	default:
+		return 0;
+	}
+}
+
+/* Get the GUIDs currently programmed in the flash */
+static int flash_get_curr_guids(struct tvdevice *tvdev, unsigned char *guid_node,
+	unsigned char *guid_port1, unsigned char *guid_port2)
+{
+	unsigned int imageaddr = 0;
+	unsigned char *up;
+	unsigned int paddr;
+	int bcnt;
+
+	imageaddr = fw_image_addr(tvdev);
+
+	paddr = flash_read(tvdev, imageaddr + guid_offset(tvdev)) + imageaddr;
+	if (paddr > tvdev->flash_size) {
+		fprintf(stderr, "GUID offset (0x%X) is larger than flash size (0x%X)!\n",
+			paddr, tvdev->flash_size);
+		return 1;
+	}
+
+	/* Read the Node GUID */
+	up = guid_node;
+	for (bcnt = 0; bcnt < GUID_LEN; bcnt++)
+		*up++ = flash_byte_read(tvdev, paddr++);
+
+	/* Read the Port1 GUID */
+	up = guid_port1;
+	for (bcnt = 0; bcnt < GUID_LEN; bcnt++)
+		*up++ = flash_byte_read(tvdev, paddr++);
+
+	/* Read the Port2 GUID */
+	up = guid_port2;
+	for (bcnt = 0; bcnt < GUID_LEN; bcnt++)
+		*up++ = flash_byte_read(tvdev, paddr++);
+
+	return 0;
+}
+
+static int guid_sect_crc_len(struct tvdevice *tvdev)
+{
+	switch (tvdev->board->chip) {
+	case CHIP_TAVOR:
+	case CHIP_ARBEL:
+	case CHIP_SINAI:
+		return TAVOR_FLASH_GUID_SECT_CRC_LEN;
+
+	case CHIP_HERMON:
+		return HERMON_FLASH_GUID_SECT_CRC_LEN;
+
+	default:
+		return 0;
+	}
+}
+
+static int guid_sect_crc_offset(struct tvdevice *tvdev)
+{
+	switch (tvdev->board->chip) {
+	case CHIP_TAVOR:
+	case CHIP_ARBEL:
+	case CHIP_SINAI:
+		return TAVOR_FLASH_GUID_SECT_CRC_OFFSET;
+
+	case CHIP_HERMON:
+		return HERMON_FLASH_GUID_SECT_CRC_OFFSET;
+
+	default:
+		return 0;
+	}
+}
+
+/* GUID update */
+static int flash_guids_update(struct tvdevice *tvdev, unsigned char *ibuf,
+			      unsigned int ibufsz, unsigned char *guid_node,
+			      unsigned char *guid_port1, unsigned char *guid_port2)
+{
+	unsigned int paddr;
+	void *gsp;
+
+	/* Endianess problems suck */
+	paddr = be32_to_cpu(*(uint32_t *)(ibuf + guid_offset(tvdev)));
+	if (paddr > ibufsz) {
+		fprintf(stderr, "GUID pointer (0x%X) is larger than image size (0x%X)!\n",
+			paddr, ibufsz);
+		return 1;
+	}
+
+	/* Blend in the new GUIDs */
+	memcpy(&ibuf[paddr], guid_node, GUID_LEN);
+	memcpy(&ibuf[paddr + GUID_LEN], guid_port1, GUID_LEN);
+	if (tvdev->board->num_ports > 1)
+		memcpy(&ibuf[paddr + GUID_LEN * 2], guid_port2, GUID_LEN);
+
+	printf("New Node  GUID = %02x%02x%02x%02x%02x%02x%02x%02x\n",
+		guid_node[0], guid_node[1], guid_node[2], guid_node[3],
+		guid_node[4], guid_node[5], guid_node[6], guid_node[7]);
+	printf("New Port1 GUID = %02x%02x%02x%02x%02x%02x%02x%02x\n",
+		guid_port1[0], guid_port1[1], guid_port1[2], guid_port1[3],
+		guid_port1[4], guid_port1[5], guid_port1[6], guid_port1[7]);
+	if (tvdev->board->num_ports > 1)
+		printf("New Port2 GUID = %02x%02x%02x%02x%02x%02x%02x%02x\n",
+			guid_port2[0], guid_port2[1], guid_port2[2], guid_port2[3],
+			guid_port2[4], guid_port2[5], guid_port2[6], guid_port2[7]);
+
+	/* Get pointer to the GUID section in the image buffer */
+	gsp = ibuf + paddr - FLASH_GUID_SECT_FW_RESERVED;
+
+	/* Recalculate GUID section CRC-16 - FW_Reserver_2 and CRC itself excluded */
+	*(uint16_t *) (gsp + guid_sect_crc_offset(tvdev)) =
+		cpu_to_be16(flash_crc16(gsp, guid_sect_crc_len(tvdev)));
+
+	return 0;
+}
+
+/*
+ * High level flash functions (information, read/write firmware images)
+ */
+
+/* Identify */
+static int create_ver_str(union vsd *vsd, char *buf, unsigned int buflen)
+{
+	if (vsd->topspin.revision_ver) {
+		if (vsd->topspin.revision_ver & 0x80)
+			snprintf(buf, buflen, "%d.%d.%03d-rc%d",
+				vsd->topspin.major_ver,
+				vsd->topspin.minor_ver,
+				be16_to_cpu(vsd->topspin.micro_ver),
+				vsd->topspin.revision_ver & ~(-1 << 7));
+		else
+			snprintf(buf, buflen, "%d.%d.%03d_%d",
+				vsd->topspin.major_ver,
+				vsd->topspin.minor_ver,
+				be16_to_cpu(vsd->topspin.micro_ver),
+				vsd->topspin.revision_ver);
+	} else
+		snprintf(buf, buflen, "%d.%d.%03d",
+			vsd->topspin.major_ver,
+			vsd->topspin.minor_ver,
+			be16_to_cpu(vsd->topspin.micro_ver));
+
+	return strlen(buf);
+}
+
+static void print_vpd_info(struct tvdevice *tvdev)
+{
+	char str[MAX_STR];
+	unsigned short i = 0, rlen;
+	unsigned char *ptr = tvdev->vpd.vpd_char;
+	unsigned short len16;
+	unsigned char len8 = 0, cksum = 0;
+	int len = 0;
+	int pn = 0, ec = 0, sn = 0, fp = 0, dc = 0, rv = 0;
+
+	printf("\n  Vital Product Data\n");
+
+	/* First field is string tag */
+	if (ptr[0] != 0x82) {
+		fprintf(stderr, "   Error. String Tag not present (found tag %02x instead)\n",
+			ptr[0]);
+		return;
+	}
+
+	/* print out String Tag */
+	memcpy(&len16, ptr + 1, sizeof(len16));
+	len16 = le16_to_cpu(len16);
+	memcpy(str, &ptr[3], len16);
+	str[len16] = 0;
+	printf("    Product Name: %s\n", str);
+
+	/* string len + 2 bytes of length field + 1 byte of tag */
+	ptr = &ptr[len16 + 3];
+
+	/* check for Read only tag */
+	if (ptr[0] != 0x90) {
+		fprintf(stderr, "    Error. R Tag not present\n");
+		return;
+	}
+	memcpy(&rlen, ptr + 1, sizeof(rlen));	/* Read only resource len */
+	rlen = le16_to_cpu(rlen);
+
+	/* parse and print out each field, till we hit end tag */
+	ptr += 3;		 /* 1 byte rtag + 2 bytes length field */
+	while (i < rlen) {
+		if ((ptr[0] == 'P') && (ptr[1] == 'N')) {
+			len8 = ptr[2];
+			memcpy(str, &ptr[3], len8);
+			str[len8] = 0;
+			printf("    P/N: %s\n", str);
+			pn = 1;
+		} else if ((ptr[0] == 'E') && (ptr[1] == 'C')) {
+			len8 = ptr[2];
+			memcpy(str, &ptr[3], len8);
+			str[len8] = 0;
+			printf("    E/C: %s\n", str);
+			ec = 1;
+		} else if ((ptr[0] == 'S') && (ptr[1] == 'N')) {
+			len8 = ptr[2];
+			memcpy(str, &ptr[3], len8);
+			str[len8] = 0;
+			printf("    S/N: %s\n", str);
+			sn = 1;
+		} else if ((ptr[0] == 'V') && (ptr[1] == '0')) {
+			len8 = ptr[2];
+			memcpy(str, &ptr[3], len8);
+			str[len8] = 0;
+			printf("    Freq/Power: %s\n", str);
+			fp = 1;
+		} else if ((ptr[0] == 'V') && (ptr[1] == '2')) {
+			len8 = ptr[2];
+			memcpy(str, &ptr[3], len8);
+			str[len8] = 0;
+			printf("    Date Code: %s\n", str);
+			dc = 1;
+		} else if ((ptr[0] == 'R') && (ptr[1] == 'V')) {
+			len = &ptr[2] - tvdev->vpd.vpd_char + 1;
+
+			while (len >= 0) {
+				cksum += tvdev->vpd.vpd_char[len];
+				len--;
+			}
+
+			if (cksum == 0)
+				printf("    Checksum: Ok\n");
+			else
+				printf("    Checksum: Incorrect\n");
+
+			rv = 1;
+		} else if (ptr[0] == 0x78)	/* End Tag */
+			 break;
+
+		i += (len8 + 3);
+		ptr += (len8 + 3);
+	}
+	if (!pn)
+		printf("    P/N: N/A\n");
+	if (!ec)
+		printf("    E/C: N/A\n");
+	if (!sn)
+		printf("    S/N: N/A\n");
+	if (!dc)
+		printf("    Date Code: N/A\n");
+	if (!fp)
+		printf("    Freq/Power: N/A\n");
+	if (!rv)
+		printf("    Checksum: N/A\n");
+}
+
+static int open_device(struct tvdevice *tvdev)
+{
+	unsigned short command;
+
+	/* Enable memory regions if it's disabled */
+	command = pci_read_word(tvdev->pdev, PCI_COMMAND);
+	if (!(command & PCI_COMMAND_MEMORY)) {
+		if (verbose)
+			printf("INFO: enabling PCI memory transactions\n");
+		pci_write_word(tvdev->pdev, PCI_COMMAND,
+			       command | PCI_COMMAND_MEMORY);
+	}
+
+	if (!use_config_space && !(tvdev->flags & FLAG_RECOVERY)) {
+		int fd;
+
+		fd = open("/dev/mem", O_RDWR, O_SYNC);
+		if (fd >= 0) {
+			tvdev->bar0 = mmap64(NULL, 1 << 20, PROT_READ | PROT_WRITE, MAP_SHARED,
+					 fd, tvdev->pdev->base_addr[0] & PCI_ADDR_MEM_MASK);
+			close(fd);
+			if (tvdev->bar0 == MAP_FAILED)
+				tvdev->bar0 = NULL;
+		} else
+			tvdev->bar0 = NULL;
+	} else
+		tvdev->bar0 = NULL;
+
+	if (tvdev->bar0) {
+		tvdev->method = METHOD_MMAP;
+		return 0;
+	}
+
+	/* FIXME: Test that we can do this first */
+	tvdev->method = METHOD_PCI_CFG;
+
+	return 0;
+}
+
+static void identify_flash_device(struct tvdevice *tvdev)
+{
+	char cfiq[1024], str[4];
+	int i, width = 0;
+
+	switch (tvdev->board->chip) {
+	case CHIP_SINAI:
+	case CHIP_HERMON:
+		/* SPI device */
+		spi_discover_serial_proms(tvdev);
+		break;
+
+	default:
+		tvdev->flash_size = 0x400000;	/* 4MB */
+		tvdev->flash_bank_shift = 19;
+		tvdev->flash_bank_mask = (1 << tvdev->flash_bank_shift) - 1;
+
+		/* Parallel flash chip */
+
+		/* Get CFI info for flash device */
+		flash_write_cmd(tvdev, 0x55, 0xFF);	/* Reset */
+		flash_write_cmd(tvdev, 0x55, 0x98);	/* CFI Query */
+
+		str[0] = flash_byte_read(tvdev, 0x10);
+		str[1] = flash_byte_read(tvdev, 0x11);
+		str[2] = flash_byte_read(tvdev, 0x12);
+		str[3] = 0;
+
+		if (strcmp(str, "QRY") == 0)
+			width = 1;
+		else {
+			str[0] = flash_byte_read(tvdev, 0x20);
+			str[1] = flash_byte_read(tvdev, 0x22);
+			str[2] = flash_byte_read(tvdev, 0x24);
+			str[3] = 0;
+
+			if (strcmp(str, "QRY") == 0)
+				width = 2;
+		}
+
+		if (!width) {
+			fprintf(stderr, "CFI query failed. Unknown flash device.\n");
+			exit(1);
+		}
+
+		for (i = 0; i < sizeof(cfiq); i++)
+			cfiq[i] = flash_byte_read(tvdev, i * width);
+
+		tvdev->flash_command_set = cfiq[0x13];
+
+		/*
+		 * FIXME: This is a hack for now. We should really get this
+		 * from the CFI query. Careful, MX chips have buggy
+		 * information.
+		 */
+		switch (tvdev->flash_command_set) {
+		case CS_INTEL:
+			tvdev->flash_sector_sz = 0x20000;	/* 128KB */
+			break;
+		case CS_AMD:
+			tvdev->flash_sector_sz = 0x10000;	/* 64KB */
+			break;
+		default:
+			printf("Unknown flash command set.\n");
+			exit(1);
+		}
+
+		break;
+	}
+
+	tvdev->flash_bank_mask = (1 << tvdev->flash_bank_shift) - 1;
+
+	flash_chip_reset(tvdev);
+
+	tvdev->flash_bank = -1;
+	flash_set_bank(tvdev, 0);
+}
+
+static int open_hca(struct tvdevice *tvdev)
+{
+	int ret;
+
+	ret = open_device(tvdev);
+	if (ret)
+		return ret;
+
+	read_cfg(tvdev, 0xF0150);
+	write_cfg(tvdev, 0xF0150, 1 << 30);
+
+	if (grab_gpio(tvdev)) {
+		fprintf(stderr, "unable to acquire flash semaphore\n");
+		return 1;
+	}
+
+	tvdev->board = tvdev->pciid->identify(tvdev);
+	if (!tvdev->board) {
+		fprintf(stderr, "unable to identify board\n");
+		return 1;
+	}
+
+	switch (tvdev->board->chip) {
+	case CHIP_SINAI:
+		/* SPI flash */
+
+		/* Unlock GPIO */
+		write_cfg(tvdev, GPIO_LOCK, 0xAAAA);
+
+#define SPI_ENABLE	((1 << (NUM_SPIS - 1)) - 1)
+		write_cfg(tvdev, GPIO_DIR + 4, SPI_ENABLE << 5);
+		write_cfg(tvdev, GPIO_POL + 4, (SPI_ENABLE ^ 0x07) << 5);
+		write_cfg(tvdev, GPIO_MOD + 4, (SPI_ENABLE ^ 0x07) << 5);
+		break;
+	default:
+		/* Parallel flash */
+
+		/* Set the direction of the flash pins to output */
+		write_cfg(tvdev, GPIO_DIR + 4, read_cfg(tvdev, GPIO_DIR + 4) | (0x07 << 4));
+
+		/* Clear the data for the flash pins to start at bank 0 */
+		write_cfg(tvdev, 0xF0080 + 0x54, 0x07 << 4);
+
+		/* Clear the polarity for the flash pins */
+		write_cfg(tvdev, GPIO_POL + 4, read_cfg(tvdev, GPIO_POL + 4) & ~(0x07 << 4));
+
+		/* Clear the output mode for the flash pins */
+		write_cfg(tvdev, GPIO_MOD + 4, read_cfg(tvdev, GPIO_MOD + 4) & ~(0x07 << 4));
+		break;
+	}
+
+	identify_flash_device(tvdev);
+
+	if (tvdev->flash_command_set == CS_UNKNOWN) {
+		printf("Unknown flash device, cannot continue\n");
+		return 1;
+	}
+
+	/* RevC LionCub boards use Intel flash chips and use a different firmware */
+	if (tvdev->board == &lioncub && tvdev->flash_command_set == CS_INTEL)
+		tvdev->board = &lioncub_revc;
+
+	return 0;
+}
+
+static void close_hca(struct tvdevice *tvdev)
+{
+	release_gpio(tvdev);
+
+	if (tvdev->bar0)
+		munmap(tvdev->bar0, 1 << 20);
+}
+
+static void identify_fw_extended(const char *name, union vsd *vsd)
+{
+	if (vsd) {
+		if (be16_to_cpu(vsd->topspin.signature1) == VSD_SIGNATURE_TOPSPIN &&
+		    be16_to_cpu(vsd->topspin.signature2) == VSD_SIGNATURE_TOPSPIN) {
+			char ver_str[40];
+
+			create_ver_str(vsd, ver_str, sizeof(ver_str));
+			if (vsd->topspin.build_rev[0])
+				printf("  %s is v%s build %s.%d, with label '%s'\n",
+				       name, ver_str,
+				       vsd->topspin.build_rev,
+				       le16_to_cpu(vsd->topspin.build_num),
+				       vsd->topspin.hw_label);
+			else
+				printf("  %s is v%s, with label '%s'\n",
+				       name, ver_str,
+				       vsd->topspin.hw_label);
+		} else
+			printf("  %s is valid, unknown source\n", name);
+	} else
+		printf("  %s is NOT valid\n", name);
+}
+
+static void identify_hca_extended(int num, struct tvdevice *tvdev, int *unreliable)
+{
+	printf("HCA #%d: ", num);
+	switch (tvdev->board->chip) {
+	case CHIP_TAVOR:
+		printf("MT23108");
+		break;
+	case CHIP_ARBEL:
+		printf("MT25208");
+		if (tvdev->flags & FLAG_TAVOR_COMPAT)
+			printf(" Tavor Compat");
+		break;
+	case CHIP_SINAI:
+		printf("MT25204");
+		break;
+	case CHIP_HERMON:
+		printf("MT25408");
+		break;
+	default:
+		printf("Unknown");
+		break;
+	}
+
+	if (tvdev->flags & FLAG_RECOVERY)
+		printf(" (recovery mode)");
+
+	printf(", %s", tvdev->board->name);
+
+	if (tvdev->flags & FLAG_RECOVERY) {
+		printf("(*)");
+		*unreliable = 1;
+	}
+
+	printf(", revision %02X\n", tvdev->revision);
+
+	if (tvdev->board->chip == CHIP_HERMON) {
+		identify_fw_extended("Firmware image", &tvdev->fw.hermon_fw_info.vsd);
+	} else if (tvdev->fw.tavor_failsafe.valid) {
+		identify_fw_extended("Primary image",
+				     tvdev->fw.tavor_failsafe.images[0].valid ?
+				     &tvdev->fw.tavor_failsafe.images[0].vsd : NULL);
+		identify_fw_extended("Secondary image",
+				     tvdev->fw.tavor_failsafe.images[1].valid ?
+				     &tvdev->fw.tavor_failsafe.images[1].vsd : NULL);
+	} else
+		printf("  Firmware is NOT installed in failsafe mode\n");
+
+	/* If vpd is present, read it and print it */
+	if (tvdev->vpd_present)
+		print_vpd_info(tvdev);
+}
+
+static void identify_hca_primary_fw(struct tvdevice *tvdev)
+{
+	union vsd *vsd;
+
+	if (!tvdev->fw.tavor_failsafe.valid ||
+	    !tvdev->fw.tavor_failsafe.images[0].valid) {
+		printf("Invalid\n");
+		return;
+	}
+
+	vsd = &tvdev->fw.tavor_failsafe.images[0].vsd;
+	if (be16_to_cpu(vsd->topspin.signature1) == VSD_SIGNATURE_TOPSPIN &&
+	    be16_to_cpu(vsd->topspin.signature2) == VSD_SIGNATURE_TOPSPIN) {
+		unsigned int build_major = 0, build_minor = 0, build_micro = 0;
+
+		sscanf(vsd->topspin.build_rev, "%u.%u.%u",
+		       &build_major, &build_minor, &build_micro);
+
+		printf("%s:%d:%d:%d:%d:%d:%d:%d:%d:%d\n",
+		       vsd->topspin.hw_label,
+		       (vsd->topspin.flags & cpu_to_be32(VSD_FLAG_AUTOUPGRADE)) ? 1 : 0,
+		       vsd->topspin.major_ver,
+		       vsd->topspin.minor_ver,
+		       be16_to_cpu(vsd->topspin.micro_ver),
+		       vsd->topspin.revision_ver,
+		       build_major, build_minor, build_micro,
+		       le16_to_cpu(vsd->topspin.build_num));
+	} else
+		printf("Unknown\n");
+}
+
+static int identify_hca(int num, struct tvdevice *tvdev,
+			enum identify_mode identify_mode, int *unreliable)
+{
+	if (open_hca(tvdev)) {
+		fprintf(stderr, "couldn't open hca %d\n", num);
+		return 1;
+	}
+
+	flash_get_info(tvdev);
+
+	switch (identify_mode) {
+	case IDENTIFY_EXTENDED:
+		identify_hca_extended(num, tvdev, unreliable);
+		break;
+	case IDENTIFY_PRIMARY_FIRMWARE_LABEL:
+		identify_hca_primary_fw(tvdev);
+		break;
+	case IDENTIFY_HARDWARE_LABEL:
+		/* Print out what we think the firmware label should be */
+		if (tvdev->board->fwlabel)
+			printf("%s.%02X",
+				tvdev->board->fwlabel, tvdev->revision);
+		else
+			printf("Unknown.%02X", tvdev->revision);
+		break;
+	}
+
+	close_hca(tvdev);
+
+	return 0;
+}
+
+static int identify_hcas(int hca, enum identify_mode identify_mode)
+{
+	struct tvdevice *tvdev;
+	int ret = 0, count = 0, unreliable = 0;
+
+	if (hca >= 0) {
+		tvdev = find_device(hca);
+		if (!tvdev) {
+			fprintf(stderr, "couldn't find HCA #%d on the PCI bus\n",
+				hca);
+			return 1;
+		}
+
+		ret = identify_hca(hca, tvdev, identify_mode, &unreliable);
+	} else {
+		for (tvdev = tvdevices; tvdev; tvdev = tvdev->next) {
+			ret = identify_hca(count++, tvdev, identify_mode, &unreliable);
+			if (ret)
+				break;
+		}
+	}
+
+	if (unreliable)
+		printf("\n(*) Unreliable in recovery mode\n");
+
+	return ret;
+}
+
+static int identify_firmware(char *ifname, enum identify_mode identify_mode)
+{
+	unsigned char *isbuf, *psbuf = NULL, *ibuf;
+	unsigned int isbufsz, psbufsz, ibufsz;
+	union vsd *vsd = NULL;
+
+	/* Read the flash image into the memory */
+	if (flash_image_read_from_file(ifname, &isbuf, &isbufsz, &psbuf,
+				       &psbufsz, &ibuf, &ibufsz, &vsd))
+		return 1;
+
+	switch (identify_mode) {
+	case IDENTIFY_EXTENDED:
+		printf("Firmware image %s", ifname);
+
+		if (vsd && vsd->topspin.flags & cpu_to_be32(VSD_FLAG_AUTOUPGRADE))
+			printf(" (firmware autoupgrade)");
+
+		printf("\n");
+
+		if (vsd) {
+			if (be16_to_cpu(vsd->topspin.signature1) == VSD_SIGNATURE_TOPSPIN &&
+			    be16_to_cpu(vsd->topspin.signature2) == VSD_SIGNATURE_TOPSPIN) {
+				char ver_str[40];
+
+				create_ver_str(vsd, ver_str, sizeof(ver_str));
+				if (vsd->topspin.build_rev[0])
+					printf("  Image is v%s build %s.%d, with label '%s'\n",
+						ver_str, vsd->topspin.build_rev,
+						le16_to_cpu(vsd->topspin.build_num),
+						vsd->topspin.hw_label);
+				else
+					printf("  Image is v%s, with label '%s'\n",
+						ver_str,
+						vsd->topspin.hw_label);
+			} else
+				printf("  Image is valid, unknown source\n");
+		} else
+			printf("  Image is NOT valid\n");
+
+		break;
+	case IDENTIFY_PRIMARY_FIRMWARE_LABEL:
+		if (vsd) {
+			if (be16_to_cpu(vsd->topspin.signature1) == VSD_SIGNATURE_TOPSPIN &&
+			    be16_to_cpu(vsd->topspin.signature2) == VSD_SIGNATURE_TOPSPIN) {
+				unsigned int build_major = 0, build_minor = 0, build_micro = 0;
+
+				sscanf(vsd->topspin.build_rev, "%u.%u.%u",
+					 &build_major, &build_minor, &build_micro);
+
+				printf("%s:%d:%d:%d:%d:%d:%d:%d:%d:%d\n",
+					 vsd->topspin.hw_label,
+					 (vsd->topspin.flags & cpu_to_be32(VSD_FLAG_AUTOUPGRADE)) ? 1 : 0,
+					 vsd->topspin.major_ver,
+					 vsd->topspin.minor_ver,
+					 be16_to_cpu(vsd->topspin.micro_ver),
+					 vsd->topspin.revision_ver,
+					 build_major, build_minor, build_micro,
+					 le16_to_cpu(vsd->topspin.build_num));
+			} else
+				printf("Unknown\n");
+		} else
+			printf("Invalid\n");
+
+		break;
+
+	default:
+		printf("Invalid mode\n");
+		break;
+	}
+
+	return 0;
+}
+
+static int print_hca_guids(int num, struct tvdevice *tvdev)
+{
+	unsigned char guid_node[GUID_LEN];
+	unsigned char guid_port1[GUID_LEN];
+	unsigned char guid_port2[GUID_LEN];
+
+	if (open_hca(tvdev)) {
+		fprintf(stderr, "couldn't open hca %d\n", num);
+		return 1;
+	}
+
+	flash_get_info(tvdev);
+
+	if (flash_get_curr_guids(tvdev, guid_node, guid_port1, guid_port2)) {
+		fprintf(stderr, "Cannot determine previous GUID. Corrupted flash?\n");
+		return 1;
+	}
+
+	printf("HCA #%d\n", num);
+	printf("Node  GUID = %02x%02x%02x%02x%02x%02x%02x%02x\n",
+		guid_node[0], guid_node[1], guid_node[2], guid_node[3],
+		guid_node[4], guid_node[5], guid_node[6], guid_node[7]);
+	printf("Port1 GUID = %02x%02x%02x%02x%02x%02x%02x%02x\n",
+		guid_port1[0], guid_port1[1], guid_port1[2], guid_port1[3],
+		guid_port1[4], guid_port1[5], guid_port1[6], guid_port1[7]);
+	if (tvdev->board->num_ports > 1)
+		printf("Port2 GUID = %02x%02x%02x%02x%02x%02x%02x%02x\n",
+			guid_port2[0], guid_port2[1], guid_port2[2], guid_port2[3],
+			guid_port2[4], guid_port2[5], guid_port2[6], guid_port2[7]);
+
+	close_hca(tvdev);
+
+	return 0;
+}
+
+static int print_guids(int hca)
+{
+	struct tvdevice *tvdev;
+	int ret = 0, count = 0;
+
+	if (hca >= 0) {
+		tvdev = find_device(hca);
+		if (!tvdev) {
+			fprintf(stderr, "couldn't find HCA #%d on the PCI bus\n", hca);
+			return 1;
+		}
+
+		ret = print_hca_guids(hca, tvdev);
+	} else {
+		for (tvdev = tvdevices; tvdev; tvdev = tvdev->next) {
+			ret = print_hca_guids(count++, tvdev);
+			if (ret)
+				break;
+		}
+	}
+
+	return ret;
+}
+
+/* Download (from HCA to host) */
+static int flash_image_write_to_file(struct tvdevice *tvdev, char *fname)
+{
+	char *buffer;
+	int i, fd;
+	unsigned int offset;
+
+	buffer = malloc(tvdev->flash_sector_sz);
+	if (!buffer) {
+		fprintf(stderr, "couldn't allocated %d bytes of memory for buffer\n",
+			tvdev->flash_sector_sz);
+		return 1;
+	}
+
+	if (strcmp(fname, "-") == 0)
+		fd = fileno(stdout);
+	else
+		fd = creat(fname, 0644);
+
+	if (fd < 0) {
+		fprintf(stderr, "couldn't open %s to save firmware: %m\n", fname);
+		return 1;
+	}
+
+	offset = 0;
+	while (offset < tvdev->flash_size) {
+		for (i = 0; i < tvdev->flash_sector_sz; i += 4) {
+			unsigned int data;
+
+			data = flash_read(tvdev, offset + i);
+
+			buffer[i + 0] = (data >> 24) & 0xff;
+			buffer[i + 1] = (data >> 16) & 0xff;
+			buffer[i + 2] = (data >> 8) & 0xff;
+			buffer[i + 3] = data & 0xff;
+		}
+
+		write(fd, buffer, tvdev->flash_sector_sz);
+
+		offset += tvdev->flash_sector_sz;
+	}
+
+	close(fd);
+
+	return 0;
+}
+
+static int download_firmware(int hca, char *ofname)
+{
+	struct tvdevice *tvdev;
+	int ret;
+
+	tvdev = find_device(hca);
+	if (!tvdev) {
+		fprintf(stderr, "couldn't find HCA #%d on the PCI bus\n", hca);
+		return 1;
+	}
+
+	if (open_hca(tvdev)) {
+		fprintf(stderr, "couldn't open hca %d\n", hca);
+		return 1;
+	}
+
+	flash_get_info(tvdev);
+
+	ret = flash_image_write_to_file(tvdev, ofname);
+
+	close_hca(tvdev);
+
+	return ret;
+}
+
+static void flash_write_block(struct tvdevice *tvdev, unsigned char status,
+	unsigned int addr, unsigned char *buffer, unsigned int buflen)
+{
+	unsigned int pos = 0, bufsz = buflen;
+
+	while (bufsz > 0) {
+		unsigned int len = 16;
+		int i;
+
+		flash_set_bank(tvdev, addr);
+
+		if (len > bufsz)
+			bufsz = len;
+
+		switch (tvdev->flash_command_set) {
+		case CS_SPI_SINAI:
+		case CS_SPI_HERMON:
+			flash_spi_write_block(tvdev, addr, buffer + pos, len);
+			break;
+
+		default:
+			for (i = 0; i < len; i++)
+				flash_write_byte(tvdev, addr + i, buffer[pos + i]);
+			break;
+		}
+		addr += len;
+		pos += len;
+		bufsz -= len;
+
+		if (status)
+			status_update(status, pos);
+	}
+}
+
+/* Upload (from host to HCA) */
+static int flash_compare_invariant_sector(struct tvdevice *tvdev, unsigned char *isbuf,
+	unsigned int isbufsz)
+{
+	unsigned int addr, data;
+
+	flash_chip_reset(tvdev);
+
+	for (addr = 0; addr < isbufsz; addr += 4) {
+		int i;
+
+		data = flash_read(tvdev, addr);
+		for (i = 0; i < 4; i++) {
+			if (isbuf[addr + i] != ((data >> ((3 - i) * 8)) & 0xFF))
+				return 1;
+		}
+	}
+
+	return 0;
+}
+
+static void flash_move_pps_to_sps(struct tvdevice *tvdev)
+{
+	unsigned int addr;
+	unsigned char *sector;
+
+	flash_chip_reset(tvdev);
+
+	sector = malloc(tvdev->flash_sector_sz);
+	if (!sector) {
+		fprintf(stderr, "Unable to allocate %d bytes of memory for buffer\n",
+			tvdev->flash_sector_sz);
+		exit(1);
+	}
+
+	for (addr = 0; addr < tvdev->flash_sector_sz; addr += 4) {
+		uint32_t data;
+		int i;
+
+		data = flash_read(tvdev, tvdev->flash_sector_sz + addr);
+		for (i = 0; i < 4; i++)
+			sector[addr + i] = ((data >> ((3 - i) * 8)) & 0xFF);
+	}
+
+	/* Erase the SPS sector */
+	status_update('E', 0);
+	flash_erase_sector(tvdev, tvdev->flash_sector_sz * 2);
+
+	/* Write the old PPS as the SPS */
+	flash_write_block(tvdev, 'F', tvdev->flash_sector_sz * 2, sector, tvdev->flash_sector_sz);
+	status_mark();
+
+	flash_chip_reset(tvdev);
+
+	free(sector);
+}
+
+static void flash_write_invariant_sector(struct tvdevice *tvdev, unsigned char *isbuf,
+	unsigned int isbufsz)
+{
+	flash_chip_reset(tvdev);
+
+	status_update('E', 0);
+	flash_erase_sector(tvdev, 0);
+	flash_write_block(tvdev, 'I', 0, isbuf, isbufsz);
+	status_mark();
+
+	flash_chip_reset(tvdev);
+}
+
+static void flash_write_pps(struct tvdevice *tvdev, unsigned int psbufoff,
+	unsigned char *psbuf, unsigned int psbufsz, unsigned int ibufoff,
+	unsigned int ibufsz)
+{
+	/* Set the image offset and size */
+	*(uint32_t *)(psbuf + 0x0) = cpu_to_be32(ibufoff);
+	*(uint32_t *)(psbuf + 0x4) = cpu_to_be32(ibufsz);
+
+	/* Set signature and CRC to all-ones for now */
+	*(uint32_t *)(psbuf + 0x8) = 0xFFFFFFFF;
+	*(uint16_t *)(psbuf + 0x106) = 0xFFFF;
+
+	/* Erase then write the PPS */
+	flash_chip_reset(tvdev);
+
+	status_update('E', 0);
+	flash_erase_sector(tvdev, psbufoff);
+	flash_write_block(tvdev, 'P', psbufoff, psbuf, psbufsz);
+	status_mark();
+
+	flash_chip_reset(tvdev);
+}
+
+static void flash_finish_failsafe(struct tvdevice *tvdev, unsigned int psbufoff,
+	unsigned char *psbuf, unsigned int psbufsz)
+{
+	/* Set signature and CRC to something valid */
+	*(uint32_t *)(psbuf + 0x8) = cpu_to_be32(0x5a445a44);
+	*(uint16_t *)(psbuf + 0x106) = cpu_to_be16(flash_crc16(psbuf, 0x104));
+
+	/* Write CRC and signature */
+	flash_chip_reset(tvdev);
+
+	flash_write_block(tvdev, 0, psbufoff + 0x106, psbuf + 0x106, sizeof(uint16_t));
+	flash_write_block(tvdev, 0, psbufoff + 0x8, psbuf + 0x8, sizeof(uint32_t));
+
+	flash_chip_reset(tvdev);
+}
+
+static void flash_write_image(struct tvdevice *tvdev, unsigned int ibufoff,
+	unsigned char *ibuf, unsigned int ibufsz)
+{
+	unsigned int addr;
+
+	/* Erase then write the firmware image */
+	for (addr = 0; addr < ibufsz; addr += tvdev->flash_sector_sz) {
+		unsigned int len = tvdev->flash_sector_sz;
+
+		if (len > ibufsz - addr)
+			len = ibufsz - addr;
+
+		status_update('E', 0);
+		flash_erase_sector(tvdev, ibufoff + addr);
+		flash_write_block(tvdev, 'W', ibufoff + addr, ibuf + addr, len);
+		status_mark();
+	}
+
+	flash_chip_reset(tvdev);
+}
+
+static unsigned int flash_verify_image(struct tvdevice *tvdev, unsigned int off,
+	unsigned char *buf, unsigned int bufsz)
+{
+	unsigned int addr, data;
+
+	flash_chip_reset(tvdev);
+
+	for (addr = 0; addr < bufsz; addr += 4) {
+		int i;
+
+		status_update('V', addr);
+
+		data = flash_read(tvdev, off + addr);
+		for (i = 0; i < 4; i++) {
+			if (buf[addr + i] != ((data >> ((3 - i) * 8)) & 0xFF))
+				return addr + i;
+		}
+	}
+	status_mark();
+
+	return addr;
+}
+
+static void usage(void)
+{
+	fprintf(stderr, "Usage: %s [OPTION]...\n", argv0);
+	fprintf(stderr, "  -q\t\tProduce less output (quieter)\n");
+	fprintf(stderr, "  -v\t\tProduce more output (verbose)\n");
+	fprintf(stderr, "  -f\t\tForce operation (use cautiously)\n");
+	fprintf(stderr, "  -p\t\tUser PCI config space access instead of memory mapping\n");
+	fprintf(stderr, "  -h <num>\tSelect HCA to use for operation (default: 0)\n");
+	fprintf(stderr, "  -o [<cmd>]\tChange options command (no command shows current values)\n");
+	fprintf(stderr, "    The following commands and values are accepted:\n");
+	fprintf(stderr, "      auto_upgrade              [yes|no]\n");
+	fprintf(stderr, "      boot_enable_port1         [yes|no]\n");
+	fprintf(stderr, "      boot_enable_port2         [yes|no]\n");
+	fprintf(stderr, "      boot_wait_on_error        [yes|no]\n");
+	fprintf(stderr, "      boot_try_forever          [yes|no]\n");
+	fprintf(stderr, "      boot_type                 [well_known|saved|pxe|disable]\n");
+	fprintf(stderr, "      boot_saved_port           [0|1|2]\n");
+	fprintf(stderr, "      boot_saved_ioc_num        ##\n");
+	fprintf(stderr, "      boot_saved_dgid           ####:####:####:####:####:####:####:####\n");
+	fprintf(stderr, "      boot_saved_service_name   ####:####:####:####\n");
+	fprintf(stderr, "      boot_pxe_secs             ##\n");
+	fprintf(stderr, "  -u\t\tDisable autoupgrade of firmware (-o auto_upgrade=no)\n\n");
+
+	fprintf(stderr, "One operation mode must be specified:\n");
+	fprintf(stderr, "  -i\t\tIdentify HCAs\n");
+	fprintf(stderr, "  -g\t\tPrint GUIDs programmed into firmware\n");
+	fprintf(stderr, "  -s <filename>\n\t\tSave firmware programmed on flash device to local file\n");
+	fprintf(stderr, "  [-d] <filename> [<Node GUID>]\n\t\tDownload firmware to flash device from local file\n\n");
+
+	fprintf(stderr, "When specifying a GUID, use only the lower 24 bits in hexadecimal format.\n");
+
+	exit(1);
+}
+
+static int upload_firmware(int hca, char *ifname, char *guid, char *change_option_cmd)
+{
+	struct tvdevice *tvdev;
+	unsigned char *isbuf, *psbuf, *ibuf;
+	unsigned int isbufsz, psbufsz, ibufsz, addr, status_count;
+	unsigned char new_guid_node[GUID_LEN], new_guid_port1[GUID_LEN],
+	new_guid_port2[GUID_LEN];
+	union vsd *vsd;
+	int ret = 1, sector = 0, program_is = 0;
+
+	tvdev = find_device(hca);
+	if (!tvdev) {
+		fprintf(stderr, "couldn't find HCA #%d on the PCI bus\n", hca);
+		return 1;
+	}
+
+	if (open_hca(tvdev)) {
+		fprintf(stderr, "couldn't open hca %d\n", hca);
+		return 1;
+	}
+
+	flash_get_info(tvdev);
+
+	if (guid) {
+		/* GUIDs given to us on command line */
+		if (parse_guid(guid, new_guid_node)) {
+			fprintf(stderr, "Unable to parse GUID from command line\n\n");
+			usage();
+		}
+
+		inc_guid(new_guid_node, new_guid_port1);
+		if (tvdev->board->num_ports > 1)
+			inc_guid(new_guid_port1, new_guid_port2);
+	} else {
+		/* Preserve the current GUIDs */
+		if (flash_get_curr_guids(tvdev, new_guid_node, new_guid_port1,
+					 new_guid_port2)) {
+			fprintf(stderr, "Cannot determine previous GUID. Corrupted flash?\n");
+			fprintf(stderr, "GUID must be specified on command line.\n\n");
+			usage();
+		}
+
+		/*
+		 * Now we check the GUIDs to make sure they are valid or
+		 * could possibly cause some confusion (the default Mellanox
+		 * GUID)
+		 */
+		if (memcmp(new_guid_node,  "\x00\x00\x00\x00\x00\x00\x00\x00", 8) == 0 ||
+		    memcmp(new_guid_port1, "\x00\x00\x00\x00\x00\x00\x00\x00", 8) == 0 ||
+		    (tvdev->board->num_ports > 1 &&
+		     memcmp(new_guid_port2, "\x00\x00\x00\x00\x00\x00\x00\x00", 8) == 0)) {
+			fprintf(stderr, "GUIDs read from flash are all zeros. Corrupted flash?\n");
+			fprintf(stderr, "GUID must be specified on command line.\n\n");
+			usage();
+		}
+
+		if (memcmp(new_guid_node,  "\xff\xff\xff\xff\xff\xff\xff\xff", 8) == 0 ||
+		    memcmp(new_guid_port1, "\xff\xff\xff\xff\xff\xff\xff\xff", 8) == 0 ||
+		    (tvdev->board->num_ports > 1 &&
+		     memcmp(new_guid_port2, "\xff\xff\xff\xff\xff\xff\xff\xff", 8) == 0)) {
+			fprintf(stderr, "GUIDs read from flash are all ones. Device access error?\n");
+			fprintf(stderr, "GUID must be specified on command line.\n\n");
+			usage();
+		}
+
+		if ((memcmp(new_guid_node,  "\x00\x02\xc9\x00\x01\x00\xd0\x50", 8) == 0 ||
+		     memcmp(new_guid_port1, "\x00\x02\xc9\x00\x01\x00\xd0\x51", 8) == 0 ||
+		     (tvdev->board->num_ports > 1 &&
+		      memcmp(new_guid_port2, "\x00\x02\xc9\x00\x01\x00\xd0\x52", 8) == 0)) &&
+		    !force) {
+			fprintf(stderr, "GUIDs read from flash are vendor default GUIDs. It is not recommended\n");
+			fprintf(stderr, "that these GUIDs be used because of a high chance of GUID conflict.\n");
+			fprintf(stderr, "Please specify new GUID on command line, or use -f option.\n");
+			usage();
+		}
+	}
+
+	/* Read the flash image into the memory */
+	if (flash_image_read_from_file(ifname, &isbuf, &isbufsz, &psbuf,
+				       &psbufsz, &ibuf, &ibufsz, &vsd))
+		return 1;
+
+	if (psbuf) {
+		if (be16_to_cpu(vsd->topspin.signature1) == VSD_SIGNATURE_TOPSPIN &&
+		    be16_to_cpu(vsd->topspin.signature2) == VSD_SIGNATURE_TOPSPIN) {
+			union vsd *fvsd = &tvdev->fw.tavor_failsafe.images[0].vsd;
+
+			/* Update the time the image was flashed */
+			vsd->topspin.flashtime = cpu_to_be32(time(NULL));
+
+			/* Set default value, we'll overwrite this if we need to */
+			vsd->topspin.flags |= cpu_to_be32(VSD_FLAG_AUTOUPGRADE);
+
+			/* Copy over boot ROM options from old VSD */
+			vsd->topspin.flags &= ~cpu_to_be32(VSD_FLAG_BOOT_OPTIONS);
+			vsd->topspin.flags |= (fvsd->topspin.flags & cpu_to_be32(VSD_FLAG_BOOT_OPTIONS));
+
+			if (vsd->topspin.flags & cpu_to_be32(VSD_FLAG_BOOT_OPTIONS)) {
+				vsd->topspin.flags &= ~cpu_to_be32(VSD_FLAG_BOOT_OPTIONS_MASK);
+				vsd->topspin.flags |= (fvsd->topspin.flags & cpu_to_be32(VSD_FLAG_BOOT_OPTIONS_MASK));
+
+				vsd->topspin.boot_version = fvsd->topspin.boot_version;
+				vsd->topspin.boot_port = fvsd->topspin.boot_port;
+				vsd->topspin.boot_ioc_num = fvsd->topspin.boot_ioc_num;
+				memcpy(vsd->topspin.boot_dgid,
+					fvsd->topspin.boot_dgid,
+					sizeof(vsd->topspin.boot_dgid));
+				memcpy(vsd->topspin.boot_service_name,
+					fvsd->topspin.boot_service_name,
+					sizeof(vsd->topspin.boot_service_name));
+				vsd->topspin.boot_pxe_secs = fvsd->topspin.boot_pxe_secs;
+			} else {
+				/* Set some sensible defaults */
+				vsd->topspin.flags |= cpu_to_be32(VSD_FLAG_BOOT_OPTIONS |
+					 VSD_FLAG_BOOT_ENABLE_PORT_1 |
+					 VSD_FLAG_BOOT_ENABLE_PORT_2 |
+					 VSD_FLAG_BOOT_ENABLE_SCAN |
+					 VSD_FLAG_BOOT_TYPE_WELL_KNOWN);
+				vsd->topspin.boot_version = BOOT_VERSION;
+				vsd->topspin.boot_pxe_secs = BOOT_PXE_SECS_DEFAULT;
+			}
+
+			if (change_option_cmd &&
+			    parse_change_options(&vsd->topspin, change_option_cmd))
+				return 1;
+
+			/* Calculate the VSD checksum */
+			vsd->topspin.checksum = 0;
+			vsd->topspin.checksum = cpu_to_be16(flash_crc16(vsd->raw, sizeof(vsd->raw)));
+		}
+
+		/* PPS checksum will be updated as a final step */
+
+		if (be16_to_cpu(vsd->topspin.signature1) == VSD_SIGNATURE_TOPSPIN &&
+		    be16_to_cpu(vsd->topspin.signature2) == VSD_SIGNATURE_TOPSPIN &&
+		    !force) {
+			if (tvdev->board->fwlabel) {
+				char hwlabel[64];
+
+				/*
+				 * Check to make sure this file is correct for
+				 * the hardware. We check only as far as the
+				 * hwlabel since boot firmware will have extra
+				 * information appended to the label.
+				 */
+				snprintf(hwlabel, sizeof(hwlabel), "%s.%02X",
+					tvdev->board->fwlabel, tvdev->revision);
+				if (strncasecmp(vsd->topspin.hw_label, hwlabel, strlen(hwlabel)) != 0) {
+					fprintf(stderr, "Firmware image specified has hardware label '%s', but hardware\n",
+						vsd->topspin.hw_label);
+					fprintf(stderr, "is of type '%s'. Please confirm you are using the correct\n",
+						hwlabel);
+					fprintf(stderr, "firmware or use the force option (-f).\n");
+					return 1;
+				}
+			} else {
+				if (tvdev->flags & FLAG_RECOVERY) {
+					fprintf(stderr, "WARNING: Unable to verify firmware image is appropriate for hardware when\n");
+					fprintf(stderr, "hardware is in flash recovery mode.\n");
+				} else
+					fprintf(stderr, "WARNING: Unable to verify firmware image is appropriate for unknown hardware.\n");
+
+				fprintf(stderr, "Will upload flash image in 20 seconds or hit Ctrl-C to exit.\n");
+				sleep(20);
+			}
+		}
+
+		if (tvdev->fw.tavor_failsafe.valid) {
+			if ((tvdev->flash_command_set != CS_SPI_SINAI &&
+			     tvdev->flash_command_set != CS_SPI_HERMON) ||
+			    tvdev->flash_spi_sp_type == SP_ST_M25P80) {
+			/*
+			 * The mainstream case - We'll always use the
+			 * space opposite of the PPS.
+			 */
+				if (tvdev->fw.tavor_failsafe.images[0].addr + tvdev->fw.tavor_failsafe.images[0].size < tvdev->flash_size / 2)
+					sector = (tvdev->flash_size / 2) / tvdev->flash_sector_sz;
+				else if (tvdev->fw.tavor_failsafe.images[0].addr >= tvdev->flash_sector_sz * 3 + ibufsz)
+					sector = 3;
+				else {
+					fprintf(stderr, "Unable to fit new image (size 0x%x) on flash in Failsafe mode\n", ibufsz);
+					exit(1);
+				}
+			} else {
+			/*
+			 * Sinai with 2MB single flash prom has issue
+			 * if the PPS points above 1MB
+			 */
+				if ((tvdev->fw.tavor_failsafe.images[0].addr / tvdev->flash_sector_sz) == 3)
+					sector = ((tvdev->flash_sector_sz * 3 + tvdev->fw.tavor_failsafe.images[1].size) / tvdev->flash_sector_sz) + 1;
+				else if (tvdev->fw.tavor_failsafe.images[0].addr > tvdev->flash_sector_sz * 3)
+					sector = 3;
+				else {
+					fprintf(stderr, "Unable to fit new image (size 0x%x) on flash in Failsafe mode\n", ibufsz);
+					exit(1);
+				}
+			}
+		} else
+			/* No Invariant Sector yet (will be programmed below) */
+			sector = 3;
+	} else if (ibufsz > tvdev->flash_size) {
+		fprintf(stderr, "Image size is larger than size of flash (0x%X)\n",
+			tvdev->flash_size);
+		return 1;
+	}
+
+	if (tvdev->board->chip != CHIP_HERMON && tvdev->fw.tavor_failsafe.valid && !psbuf) {
+		if (!force) {
+			/* Flash is in Failsafe mode, but image doesn't have Failsafe information */
+			printf("Flash is in failsafe mode, but image is not a failsafe firmware image.\n");
+			printf("Please use a failsafe firmware image, or use the force option if you\n");
+			printf("are sure you know what you are doing.\n");
+			exit(1);
+		} else {
+			printf("WARNING: Downgrading flash from Failsafe to non Failsafe. Please hit Ctrl-C\n");
+			printf("now if that is not what you wanted.\n");
+			sleep(5);
+		}
+	}
+
+	if (flash_guids_update(tvdev, ibuf, ibufsz, new_guid_node,
+			       new_guid_port1, new_guid_port2))
+		return 1;
+
+	/* Compare the currently programmed IS with the IS from the file */
+	if (isbuf) {
+		if (force > 1) {
+			/* User specified -ff, always upgrade IS */
+			if (tvdev->fw.tavor_failsafe.valid) {
+				/* But warn if the firmware is already in failsafe mode, just in case */
+				printf("WARNING: Flash reprogramming won't be failsafe, continuing in 10 seconds\n");
+				sleep(10);
+			}
+
+			program_is = 1;
+		} else if (flash_compare_invariant_sector(tvdev, isbuf, isbufsz) != 0) {
+			/* IS is out-of-date, so we need to upgrade it */
+			printf("WARNING: Out-of-date Invariant sector found. Flash reprogramming won't be\n");
+			printf("failsafe, continuing in 10 seconds\n");
+			sleep(10);
+			program_is = 1;
+		} else if (!tvdev->fw.tavor_failsafe.valid)
+			/* Not in failsafe, so it's safe to silently program the IS */
+			program_is = 1;
+	}
+
+	printf("Programming HCA firmware... Flash Image Size = %d\n", ibufsz);
+
+	if (psbuf) {
+		status_count = psbufsz + ibufsz + psbufsz + ibufsz;
+		if (tvdev->fw.tavor_failsafe.images[0].valid)
+			status_count += tvdev->flash_sector_sz;
+	} else
+		status_count = ibufsz + ibufsz;
+
+	if (program_is) {
+		/* Program the Invariant Sector first */
+		status_start(status_count + isbufsz + isbufsz);
+		flash_write_invariant_sector(tvdev, isbuf, isbufsz);
+
+		addr = flash_verify_image(tvdev, 0, isbuf, isbufsz);
+		if (addr < isbufsz) {
+			status_stop();
+			printf("Flash verify of IS FAILED @ %d (%d total)\n",
+				addr, isbufsz);
+			ret = 1;
+			goto verify_failed;
+		}
+	} else
+		status_start(status_count);
+
+	if (psbuf) {
+		if (tvdev->fw.tavor_failsafe.images[0].valid)
+			flash_move_pps_to_sps(tvdev);
+
+		/* Write the PPS and image */
+		flash_write_pps(tvdev, tvdev->flash_sector_sz, psbuf, psbufsz,
+		sector * tvdev->flash_sector_sz, ibufsz);
+		flash_write_image(tvdev, sector * tvdev->flash_sector_sz, ibuf, ibufsz);
+
+		/* Verify the PPS and image */
+		addr = flash_verify_image(tvdev, tvdev->flash_sector_sz, psbuf, psbufsz);
+		if (addr < psbufsz) {
+			status_stop();
+			printf("Flash verify of PPS FAILED @ %d (%d total)\n",
+				addr, psbufsz);
+			ret = 1;
+			goto verify_failed;
+		}
+
+		addr = flash_verify_image(tvdev, sector * tvdev->flash_sector_sz, ibuf, ibufsz);
+		if (addr < ibufsz) {
+			status_stop();
+			printf("Flash verify of image FAILED @ %d (%d total)\n",
+				addr, ibufsz);
+			ret = 1;
+			goto verify_failed;
+		}
+
+		/* Finish writing the PPS */
+		flash_finish_failsafe(tvdev, tvdev->flash_sector_sz, psbuf, psbufsz);
+	} else {
+		flash_write_image(tvdev, 0, ibuf, ibufsz);
+		addr = flash_verify_image(tvdev, 0, ibuf, ibufsz);
+		if (addr < ibufsz) {
+			status_stop();
+			printf("Flash verify of image FAILED @ %d (%d total)\n",
+				addr, ibufsz);
+			ret = 1;
+			goto verify_failed;
+		}
+	}
+
+	status_stop();
+
+	ret = 0;
+
+	printf("Flash verify passed!\n");
+
+verify_failed:
+	close_hca(tvdev);
+
+	return ret;
+}
+
+static int modify_options(int hca, char *change_option_cmd)
+{
+	struct tvdevice *tvdev;
+	union vsd *vsd;
+	unsigned char *psbuf;
+	int ret;
+	int i;
+
+	tvdev = find_device(hca);
+	if (!tvdev) {
+		fprintf(stderr, "couldn't find HCA #%d on the PCI bus\n", hca);
+		return 1;
+	}
+
+	if (open_hca(tvdev)) {
+		fprintf(stderr, "couldn't open hca %d\n", hca);
+		return 1;
+	}
+
+	flash_get_info(tvdev);
+
+	psbuf = malloc(tvdev->flash_sector_sz);
+	if (!psbuf) {
+		fprintf(stderr, "couldn't allocate temp buffer for PPS/SPS (size = %d)\n",
+			tvdev->flash_sector_sz);
+		exit(1);
+	}
+
+	for (i = 0; i < tvdev->flash_sector_sz; i += 4)
+		*(uint32_t *)(psbuf + i) = be32_to_cpu(flash_read(tvdev, tvdev->flash_sector_sz + i));
+
+	vsd = (union vsd *)(psbuf + 0x20);
+
+	fixup_vsd(vsd);
+
+	if (be16_to_cpu(vsd->topspin.signature1) != VSD_SIGNATURE_TOPSPIN ||
+	    be16_to_cpu(vsd->topspin.signature2) != VSD_SIGNATURE_TOPSPIN) {
+		/* Not our VSD format, so nothing to print */
+		printf("error: VSD not in Topspin format\n");
+		ret = 1;
+		goto out;
+	}
+
+	if (change_option_cmd[0] == 0) {
+		if (vsd->topspin.flags & cpu_to_be32(VSD_FLAG_AUTOUPGRADE))
+			printf("  auto_upgrade=yes\n");
+		else
+			printf("  auto_upgrade=no\n");
+
+		if (vsd->topspin.flags & cpu_to_be32(VSD_FLAG_BOOT_ENABLE_PORT_1))
+			printf("  boot_enable_port_1=yes\n");
+		else
+			printf("  boot_enable_port_1=no\n");
+
+		if (vsd->topspin.flags & cpu_to_be32(VSD_FLAG_BOOT_ENABLE_PORT_2))
+			printf("  boot_enable_port_2=yes\n");
+		else
+			printf("  boot_enable_port_2=no\n");
+
+		if (!(vsd->topspin.flags & cpu_to_be32(VSD_FLAG_BOOT_ENABLE_SCAN)))
+			printf("  boot_service_scan=no\n");
+
+		if (vsd->topspin.flags & cpu_to_be32(VSD_FLAG_BOOT_WAIT_ON_ERROR))
+			printf("  boot_wait_on_error=yes\n");
+		else
+			printf("  boot_wait_on_error=no\n");
+
+		if (vsd->topspin.flags & cpu_to_be32(VSD_FLAG_BOOT_TRY_FOREVER))
+			printf("  boot_try_forever=yes\n");
+		else
+			printf("  boot_try_forever=no\n");
+
+		switch (be32_to_cpu(vsd->topspin.flags) & VSD_FLAG_BOOT_TYPE) {
+		case VSD_FLAG_BOOT_TYPE_WELL_KNOWN:
+			printf("  boot_type=well_known\n");
+			break;
+		case VSD_FLAG_BOOT_TYPE_SAVED:
+			printf("  boot_type=saved\n");
+			break;
+		case VSD_FLAG_BOOT_TYPE_PXE:
+			printf("  boot_type=pxe\n");
+			break;
+		case VSD_FLAG_BOOT_TYPE_DISABLE:
+			printf("  boot_type=disable\n");
+			break;
+		default:
+			printf("  boot_type=unknown\n");
+			break;
+		}
+
+		printf("  boot_saved_port=%d\n", vsd->topspin.boot_port);
+		printf("  boot_saved_ioc_num=%d\n", vsd->topspin.boot_ioc_num);
+		printf("  boot_saved_dgid=%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
+			vsd->topspin.boot_dgid[0],  vsd->topspin.boot_dgid[1],
+			vsd->topspin.boot_dgid[2],  vsd->topspin.boot_dgid[3],
+			vsd->topspin.boot_dgid[4],  vsd->topspin.boot_dgid[5],
+			vsd->topspin.boot_dgid[6],  vsd->topspin.boot_dgid[7],
+			vsd->topspin.boot_dgid[8],  vsd->topspin.boot_dgid[9],
+			vsd->topspin.boot_dgid[10], vsd->topspin.boot_dgid[11],
+			vsd->topspin.boot_dgid[12], vsd->topspin.boot_dgid[13],
+			vsd->topspin.boot_dgid[14], vsd->topspin.boot_dgid[15]);
+		printf("  boot_saved_service_name=%02x%02x:%02x%02x:%02x%02x:%02x%02x\n",
+			vsd->topspin.boot_service_name[0],
+			vsd->topspin.boot_service_name[1],
+			vsd->topspin.boot_service_name[2],
+			vsd->topspin.boot_service_name[3],
+			vsd->topspin.boot_service_name[4],
+			vsd->topspin.boot_service_name[5],
+			vsd->topspin.boot_service_name[6],
+			vsd->topspin.boot_service_name[7]);
+		printf("  boot_pxe_secs=%d\n", vsd->topspin.boot_pxe_secs);
+	} else {
+		if (parse_change_options(&vsd->topspin, change_option_cmd)) {
+			ret = 1;
+			goto out;
+		}
+
+		/* Calculate the VSD checksum */
+		vsd->topspin.checksum = 0;
+		vsd->topspin.checksum = cpu_to_be16(flash_crc16(vsd->raw, sizeof(vsd->raw)));
+
+		/* Set signature and CRC to all-ones for now */
+		*(uint32_t *)(psbuf + 0x8) = 0xFFFFFFFF;
+		*(uint16_t *)(psbuf + 0x106) = 0xFFFF;
+
+		flash_chip_reset(tvdev);
+
+		status_start(tvdev->flash_sector_sz);
+
+		status_update('E', 0);
+		flash_erase_sector(tvdev, tvdev->flash_sector_sz);
+		flash_write_block(tvdev, 'F', tvdev->flash_sector_sz, psbuf, tvdev->flash_sector_sz);
+		status_mark();
+
+		flash_chip_reset(tvdev);
+
+		flash_finish_failsafe(tvdev, tvdev->flash_sector_sz, psbuf, tvdev->flash_sector_sz);
+
+		status_stop();
+	}
+
+	free(psbuf);
+
+	ret = 0;
+
+out:
+	close_hca(tvdev);
+
+	return ret;
+}
+
+int main(int argc, char *argv[])
+{
+	char *filename = NULL, *guid = NULL, *change_option_cmd = NULL;
+	struct winsize winsize;
+	struct pci_access *pacc;
+	enum operation operation = OP_NONE;
+	enum identify_mode identify_mode = IDENTIFY_EXTENDED;
+	int ret, autoupgrade = 1, hca = -1;
+
+	/* Check the size is correct. The compiler will optimize this away */
+	{
+		union vsd vsd;
+
+		if (sizeof(vsd.topspin) != sizeof(vsd.raw)) {
+			extern void __sizeof_vsd_data_doesnt_equal_sizeof_vsd_raw();
+
+			__sizeof_vsd_data_doesnt_equal_sizeof_vsd_raw();
+		}
+	}
+
+	/* Figure out the size of the window, but fall back if we can't */
+	if (ioctl(0, TIOCGWINSZ, &winsize) < 0)
+		cols = 80;
+	else
+		cols = winsize.ws_col;
+
+	argv0 = argv[0];
+
+	while (1) {
+		int c;
+
+		c = getopt(argc, argv, "qvfupgh:i::s:d:o::");
+		if (c == -1)
+			break;
+
+		switch (c) {
+		case 'q':
+			verbose--;
+			break;
+		case 'v':
+			verbose++;
+			break;
+		case 'f':
+			force++;
+			break;
+		case 'u':
+			autoupgrade = 0;
+			break;
+		case 'p':
+			use_config_space = 1;
+			break;
+		case 'h': {
+			char *p;
+
+			ret = strtoul(optarg, &p, 0);
+			if (ret == ULONG_MAX || *p) {
+				fprintf(stderr, "parameter to -h option is invalid\n");
+				return 1;
+			}
+
+			hca = (unsigned int)ret;
+			break;
+			}
+		case 'i':
+			if (operation != OP_NONE) {
+				fprintf(stderr, "multiple operations specified on command line\n");
+				usage();
+			}
+
+			operation = OP_IDENTIFY;
+			if (optarg) {
+				if (strcasecmp(optarg, "extended") == 0)
+					identify_mode = IDENTIFY_EXTENDED;
+				else if (strcasecmp(optarg, "pfwlabel") == 0)
+					identify_mode = IDENTIFY_PRIMARY_FIRMWARE_LABEL;
+				else if (strcasecmp(optarg, "hwlabel") == 0)
+					identify_mode = IDENTIFY_HARDWARE_LABEL;
+				else {
+					fprintf(stderr, "unknown identify mode '%s'\n",
+						optarg);
+					usage();
+				}
+			} else
+				identify_mode = IDENTIFY_EXTENDED;
+			break;
+		case 'g':
+			if (operation != OP_NONE) {
+				fprintf(stderr, "multiple operations specified on command line\n");
+				usage();
+			}
+
+			operation = OP_PRINT_GUIDS;
+			break;
+		case 's':
+			if (operation != OP_NONE) {
+				fprintf(stderr, "multiple operations specified on command line\n");
+				usage();
+			}
+
+			operation = OP_DOWNLOAD;	/* Save firmware from HCA to disk */
+			filename = optarg;
+			break;
+		case 'd':
+			if (operation != OP_NONE && operation != OP_MODIFY_OPTIONS) {
+				fprintf(stderr, "multiple operations specified on command line\n");
+				usage();
+			}
+
+			operation = OP_UPLOAD;	/* Download firmware to HCA */
+			filename = optarg;
+			break;
+		case 'o':
+			if (operation != OP_NONE && operation != OP_UPLOAD) {
+				fprintf(stderr, "multiple operations specified on command line\n");
+				usage();
+			}
+
+			if (optarg)
+				change_option_cmd = optarg;
+			else
+				change_option_cmd = "";
+
+			/* operation will be set below */
+			break;
+		}
+	}
+
+	if (operation == OP_NONE) {
+		if (change_option_cmd) {
+			operation = OP_MODIFY_OPTIONS;
+		} else {
+			/* Default to OP_UPLOAD, but we need a filename argument */
+			if (optind >= argc)
+				usage();
+
+			operation = OP_UPLOAD;	/* Download firmware to HCA */
+			filename = argv[optind++];
+		}
+	}
+
+	/* The upload operation can take an optional GUID argument too */
+	if (optind < argc && operation == OP_UPLOAD)
+		guid = argv[optind++];
+
+	/* Identify operation can take an optional filename argument here */
+	if (optind < argc && operation == OP_IDENTIFY) {
+		filename = argv[optind++];
+		if (filename && identify_mode == IDENTIFY_HARDWARE_LABEL) {
+			fprintf(stderr, "cannot print hardware label for firmware image file\n");
+			usage();
+		}
+	}
+
+	/* Change option command can take an optional filename argument here */
+	if (optind < argc && change_option_cmd && change_option_cmd[0] == 0)
+		change_option_cmd = argv[optind++];
+
+	/* Set change_option_cmd correctly */
+	if (!autoupgrade) {
+		if (change_option_cmd && change_option_cmd[0] != 0) {
+			size_t len = strlen(change_option_cmd) + strlen("auto_upgrade=off") + 1;
+			char *p;
+
+			p = malloc(len);
+			if (!p) {
+				fprintf(stderr, "Unable to allocate %Zd bytes for change_option_cmd\n",
+					len);
+				exit(1);
+			}
+
+			snprintf(p, len - 1, "%s,auto_upgrade=off",
+				change_option_cmd);
+			change_option_cmd = p;
+		} else
+			change_option_cmd = "auto_upgrade=off";
+	}
+
+	pacc = pci_alloc();
+	pci_init(pacc);
+	pci_scan_bus(pacc);
+
+	switch (operation) {
+	case OP_IDENTIFY:
+		if (filename)
+			ret = identify_firmware(filename, identify_mode);
+		else {
+			scan_devices(pacc);
+			ret = identify_hcas(hca, identify_mode);
+		}
+		break;
+	case OP_PRINT_GUIDS:
+		scan_devices(pacc);
+		ret = print_guids(hca);
+		break;
+	case OP_DOWNLOAD:
+		scan_devices(pacc);
+		ret = download_firmware(hca >= 0 ? hca : 0, filename);
+		break;
+	case OP_UPLOAD:
+		scan_devices(pacc);
+		ret = upload_firmware(hca >= 0 ? hca : 0, filename, guid, change_option_cmd);
+		break;
+	case OP_MODIFY_OPTIONS:
+		scan_devices(pacc);
+		ret = modify_options(hca >= 0 ? hca : 0, change_option_cmd);
+		break;
+	default:
+		fprintf(stderr, "ERROR: Invalid operation %d\n", operation);
+		ret = 1;
+		break;
+	}
+
+	pci_cleanup(pacc);
+
+	return ret;
+}
diff --git a/tvflash.spec b/tvflash.spec
new file mode 100644
index 0000000..d914984
--- /dev/null
+++ b/tvflash.spec
@@ -0,0 +1,37 @@
+# $Id: ipoibcfg.spec.in 28 2004-04-07 20:00:33Z roland $
+
+%define ver      0.9.0
+%define  RELEASE 1
+%define  rel     %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
+
+Summary: Tool to manage Mellanox HCA firmware flash memory
+Name: tvflash
+Version: 0.9.0
+Release: 1.ofed1.4
+License: GPLv2 or BSD
+Group: Applications/System
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+Source: http://www.openfabrics.org/downloads/tvflash-0.9.0.tar.gz
+Url: http://openib.org/
+
+%description
+tvflash is used to query and update the firmware flash memory attached
+to Mellanox InfiniBand HCAs.
+
+%prep
+%setup -q
+
+%build
+%configure
+make
+
+%install
+make DESTDIR=${RPM_BUILD_ROOT} install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%{_prefix}/sbin/%{name}
+%doc README NEWS ChangeLog COPYING
diff --git a/tvflash.spec.in b/tvflash.spec.in
new file mode 100644
index 0000000..495493d
--- /dev/null
+++ b/tvflash.spec.in
@@ -0,0 +1,37 @@
+# $Id: ipoibcfg.spec.in 28 2004-04-07 20:00:33Z roland $
+
+%define ver      @VERSION@
+%define  RELEASE 1
+%define  rel     %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
+
+Summary: Tool to manage Mellanox HCA firmware flash memory
+Name: tvflash
+Version: %ver
+Release: %rel
+License: GPLv2 or BSD
+Group: Applications/System
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+Source: http://openib.org/downloads/%{name}-%{version}.tar.gz
+Url: http://openib.org/
+
+%description
+tvflash is used to query and update the firmware flash memory attached
+to Mellanox InfiniBand HCAs.
+
+%prep
+%setup -q
+
+%build
+%configure
+make
+
+%install
+make DESTDIR=${RPM_BUILD_ROOT} install
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%{_prefix}/sbin/%{name}
+%doc README NEWS ChangeLog COPYING

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



More information about the Pkg-ofed-commits mailing list