--- hypre-2.4.0b.orig/debian/rules
+++ hypre-2.4.0b/debian/rules
@@ -0,0 +1,90 @@
+#!/usr/bin/make -f
+# Made with the aid of debmake, by Christoph Lameter,
+# based on the sample debian/rules file for GNU hello by Ian Jackson.
+
+package=hypre
+
+# This tells us which MPI implementation is in use
+HYPRE_MPI=$(shell readlink /etc/alternatives/mpi | sed s/usr//g | sed s/include//g | sed s/lib//g | sed s/\\///g)
+
+stamp-patch:
+	if [ ! -e stamp-patch ]; then \
+	  QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2; \
+	  ln -s ../krylov/HYPRE_flexgmres.c ../krylov/flexgmres.c src/parcsr_ls/; \
+	  touch $@; \
+	fi
+
+unpatch:
+	if [ -e stamp-patch ]; then \
+	  QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2; \
+	  rm -f src/parcsr_ls/flexgmres.c src/parcsr_ls/HYPRE_flexgmres.c; \
+	  rm -f stamp-patch; \
+	fi
+
+# Override compiler settings to avoid using mpicc etc. to build shlibs
+build: stamp-build
+stamp-build: stamp-patch
+	dh_testdir
+	(cd src && ./configure --enable-shared --without-superlu \
+	  --with-blas-libs="blas-3gf" --with-blas-lib-dirs="/usr/lib" \
+	  --with-lapack-libs="lapackgf-3" --with-lapack-lib-dirs="/usr/lib")
+	$(MAKE) -C src
+#	Remove PIC object files
+#	rm -f `find . -name \*.o -print`
+#	(cd src && ./configure --without-superlu \
+#	  --with-blas-libs="blas-3" --with-blas-lib-dirs="/usr/lib" \
+#	  --with-lapack-libs="lapack-3" --with-lapack-lib-dirs="/usr/lib")
+#	$(MAKE) -C src
+	touch $@
+
+clean: unpatch
+	dh_testdir
+	rm -f stamp-configure build
+	rm -rf .pc
+	if [ -e src/Makefile ]; then \
+	  $(MAKE) -C src clean; fi
+	rm -f src/config.log src/config.status src/HYPRE_config.h
+	dh_clean
+
+install: stamp-install
+stamp-install: stamp-build
+	install -d `pwd`/debian/tmp/usr/include
+	install -d `pwd`/debian/tmp/usr/lib
+	$(MAKE) -C src install HYPRE_INSTALL_DIR=`pwd`/debian/tmp/usr \
+	  prefix=`pwd`/debian/tmp/usr exec_prefix=`pwd`/debian/tmp/usr
+	touch $@
+
+binary-indep: install
+	dh_testdir -i
+	dh_testroot -i
+	dh_installdirs -i
+	dh_movefiles -i
+	dh_installdocs -i
+	dh_installchangelogs -i
+	dh_compress -i
+	dh_fixperms -i
+	dh_installdeb -i
+	dh_gencontrol -i
+	dh_md5sums -i
+	dh_builddeb -i
+
+binary-arch: install
+	dh_testdir -a
+	dh_testroot -a
+	dh_installdirs -a
+	dh_movefiles -a
+	dh_installdocs -a
+	dh_installchangelogs -a
+	dh_strip -a
+	dh_makeshlibs -a
+	dh_compress -a
+	dh_fixperms -a
+	dh_installdeb -a
+	dh_shlibdeps -a
+	dh_gencontrol -a
+	dh_md5sums -a
+	dh_builddeb -a
+
+binary: binary-arch binary-indep
+
+.PHONY: binary binary-arch binary-indep install build clean
--- hypre-2.4.0b.orig/debian/control
+++ hypre-2.4.0b/debian/control
@@ -0,0 +1,32 @@
+Source: hypre
+Section: math
+Priority: extra
+Maintainer: Adam C. Powell, IV <hazelsct@debian.org>
+Standards-Version: 3.8.0
+Build-Depends: debhelper (>= 3.0), quilt, libsuperlu3-dev, mpi-default-dev, \
+ gfortran, libblas-dev | libblas-3gf.so, liblapack-dev | liblapack-3gf.so
+Homepage: http://acts.nersc.gov/hypre/
+
+Package: libhypre-2.4.0
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}
+Description: High Performance Matrix Preconditioners - Shared Library
+ Hypre is a set of matrix preconditioning libraries to aid in the solution of
+ large systems of linear equations.
+ .
+ This package contains the shared libraries.
+
+Package: libhypre-dev
+Architecture: all
+Section: libdevel
+Depends: libhypre-2.4.0 (>= ${source:Version}), libsuperlu3-dev, \
+ mpi-default-dev, libatlas-base-dev | libblas-dev | libblas-3gf.so, \
+ libatlas-base-dev | liblapack-dev | liblapack-3gf.so
+Suggests: hypre-doc
+Description: High Performance Matrix Preconditioners - Development Files
+ Hypre is a set of matrix preconditioning libraries to aid in the solution of
+ large systems of linear equations.
+ .
+ This package contains the headers and symlinks necessary to develop programs
+ which use hypre.
--- hypre-2.4.0b.orig/debian/compat
+++ hypre-2.4.0b/debian/compat
@@ -0,0 +1 @@
+5
--- hypre-2.4.0b.orig/debian/copyright
+++ hypre-2.4.0b/debian/copyright
@@ -0,0 +1,46 @@
+This package was debianized by Adam C. Powell, IV <hazelsct@debian.org> on
+August 27, 2003.
+
+It was downloaded from http://www.llnl.gov/CASC/hypre/ .
+
+The 2.4.0 copyright notice itself is given in the upstream source COPYRIGHT
+file, which is reproduced below.  The GNU Lesser General Public License version
+2.1 mentioned therein is in the upstream source COPYING.LESSER file, and is
+also in /usr/share/common-licenses/LGPL-2.1 on Debian systems.
+
+------------------------------------------------------------------------------
+
+COPYRIGHT
+
+The following copyright applies to each file in the HYPRE distribution, unless
+otherwise stated in the file:
+
+Copyright (c) 2008,  Lawrence Livermore National Security, LLC.
+Produced at the Lawrence Livermore National Laboratory under
+Contract No. DE-AC52-07NA27344 with the DOE.
+
+This file is part of HYPRE.
+
+
+LICENSE
+
+HYPRE is free software; you can redistribute it and/or modify it under the
+terms of the GNU Lesser General Public License (as published by the Free
+Software Foundation) version 2.1 dated February 1999.
+
+HYPRE 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 terms and conditions of the GNU Lesser
+General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this library (file COPYING.LESSER); if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+CONTACT INFORMATION
+
+The HYPRE team can be contacted at hypre-support@mail.llnl.gov.  The software is
+released under UCRL_CODE_222953.  Please see http://www.llnl.gov/CASC/hypre for
+more information and source code availability.
+
--- hypre-2.4.0b.orig/debian/libhypre-2.4.0.files
+++ hypre-2.4.0b/debian/libhypre-2.4.0.files
@@ -0,0 +1 @@
+usr/lib/*-2.4.0.so
--- hypre-2.4.0b.orig/debian/changelog
+++ hypre-2.4.0b/debian/changelog
@@ -0,0 +1,115 @@
+hypre (2.4.0b-1) unstable; urgency=low
+
+  * New upstream release (closes: #498291, #498733).
+  * Documentation source from upstream is now in src/docs.
+  * Using quilt now to manage patches.
+  * Changed to libtool-revision style of shared library naming libXX-version.so
+    and changed shlib package name accordingly.
+  * Using mpi-default-dev instead of explicitly depending on openmpi or lam
+    (closes: #509780).
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Fri, 26 Dec 2008 01:35:57 -0500
+
+hypre (2.0.0.dfsg-7) unstable; urgency=low
+
+  * Changed libhypre-dev Depends to pull in proper MPI implementation
+    using type-handling (closes: #487253).
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Mon, 23 Jun 2008 15:38:19 -0400
+
+hypre (2.0.0.dfsg-6) unstable; urgency=low
+
+  * Changed -lmpi_cxx to more generic -lmpi++, and removed -lstdc++,
+    instead using BUILD_CXX_SHARED (closes: #484341, #484196).
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Tue, 03 Jun 2008 23:36:05 -0400
+
+hypre (2.0.0.dfsg-5) unstable; urgency=low
+
+  * Added LAPACK to Build-Depends, corrected lib names (closes: #484341,
+    #484196).
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Tue, 03 Jun 2008 19:03:39 -0400
+
+hypre (2.0.0.dfsg-4) unstable; urgency=low
+
+  * Build-Depends on BLAS instead of ATLAS, same with -dev Depends.
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Tue, 27 May 2008 15:57:37 -0400
+
+hypre (2.0.0.dfsg-3) unstable; urgency=low
+
+  * Build-depends on OpenMPI where it exists, LAM otherwise.
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Wed, 30 Apr 2008 15:02:25 -0400
+
+hypre (2.0.0.dfsg-2) unstable; urgency=low
+
+  * Added gfortran to Build-Depends (closes: #477744).
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Mon, 28 Apr 2008 18:59:19 -0400
+
+hypre (2.0.0.dfsg-1) unstable; urgency=low
+
+  * Removed docs directory because of lack of source.
+  * New package closes same bugs as rejected hypre 2.0.0-1 (closes: #451738,
+    #447673, #349885, #436230).
+  * Updated atlas dependency to new libatlas-base-dev name.
+  * Because -dev has only headers and symlinks (no static libs), made it
+    arch all.
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Wed, 16 Apr 2008 12:02:12 -0400
+
+hypre (2.0.0-1) unstable; urgency=low
+
+  * New upstream release (closes: #451738).
+  * Builds against OpenMPI (closes: #447673).
+  * libhypre2.0.0 doesn't need to conflict with and replace older versions
+    (closes: #349885).
+  * No longer builds or installs included SuperLU (closes: #436230).
+  * Only builds shared libs for now, will change this if somebody bugs me.
+  * Forward-ported shared library versioning.
+  * Forward-ported inter-lib links to satisfy dh_shlibdeps.
+  * Created a new lib to resolve HYPRE_FEI and HYPRE_mli inter-lib dependency.
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Wed, 21 Nov 2007 13:21:32 -0500
+
+hypre (1.6.0-4) unstable; urgency=low
+
+  * Rebuild with new mpich and linked against libblas-3.so.
+  * Fixed configure to actually use -with-blas= value.
+  * Fixed build-depends, replacing obsolete mpich with libmpich1.0-dev and
+    adding version 3 BLAS dev.
+  * Appended c2 to shared lib package name since it includes C++ objects.
+  * Massive changes to link shared libs with all of their dependent libs.
+  * Removed HYPRE_BuildIJMatrixFromDistributedMatrix() because it uses an
+    obsolete IJ_mv API.
+  * Got rid of a bunch of @s in Makefiles to make build more transparent.
+  * Added libHYPRE_Euclid to SSTRUCT_LFLAGS in test/Makefile.in so it works.
+  * Added Makefile removal to clean target to avoid bloated .diff.gz.
+  * Added installation of lintian overrides files.
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Thu,  8 Sep 2005 23:22:43 -0400
+
+hypre (1.6.0-3) unstable; urgency=low
+
+  * Commented -DBOOL_NOT_SUPPORTED erroneous flags in
+    src/FEI_mv/fei-hypre/Makefile.in (closes: #249525).
+  * Removed gcc | c-compiler from Build-Depends.
+  * Added lintian overrides for GPL false positives in copyright file.
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Wed, 11 Aug 2004 22:25:09 -0400
+
+hypre (1.6.0-2) unstable; urgency=low
+
+  * Added mpich to build-depends (closes: #220591).
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Thu, 13 Nov 2003 10:28:17 -0500
+
+hypre (1.6.0-1) unstable; urgency=low
+
+  * First packaging attempt (closes: #207414).
+  * Added shared library building to each Makefile.in.
+  * doc-base index for user and reference manuals.
+
+ -- Adam C. Powell, IV <hazelsct@debian.org>  Thu,  2 Oct 2003 14:52:22 -0400
--- hypre-2.4.0b.orig/debian/libhypre-dev.files
+++ hypre-2.4.0b/debian/libhypre-dev.files
@@ -0,0 +1,3 @@
+usr/lib/*.a
+usr/lib/*.so
+usr/include/*.h
--- hypre-2.4.0b.orig/debian/patches/series
+++ hypre-2.4.0b/debian/patches/series
@@ -0,0 +1 @@
+shlibs.patch
--- hypre-2.4.0b.orig/debian/patches/shlibs.patch
+++ hypre-2.4.0b/debian/patches/shlibs.patch
@@ -0,0 +1,1359 @@
+This patch has several purposes:
+
+ * Reorder the directory build order so libraries are built in dependency
+   order.
+ * Add libHYPRE_FEI_fgmres.[a|so] to resolve a circular dependency:
+   libHYPRE_FEI with fgmres.c depends on libHYPRE_mli.so which links with
+   symbols in fgmres.c .  (Resolves issue 182.)
+ * Move (HYPRE_)flexgmres.c from krylov to parcsr_ls to resolve another
+   circular dependency between those two libraries.
+ * Add "HYPRE_LIBS" and "SYSTEM_LIBS" for each library, and link to them.
+ * Build shared libraries with filename and soname linker flag including the
+   version extension -2.4.0.so, and link the .so to that file.
+ * Also pass "-z defs" to the linker.
+ * Add the -d flag to cp commands in order to preserve symlinks.
+ * Change libHYPRE-2.4.0.so (and libHYPRE.so link) to link with all of the
+   hypre libs instead of duplicating all of the object files, cutting the
+   installed size roughly in half.
+
+--- hypre-2.4.0b.orig/src/Makefile
++++ hypre-2.4.0b/src/Makefile
+@@ -45,8 +45,8 @@
+  parcsr_mv\
+  parcsr_block_mv\
+  distributed_matrix\
+- matrix_matrix\
+  IJ_mv\
++ matrix_matrix\
+  distributed_ls\
+  parcsr_ls
+ 
+@@ -68,11 +68,11 @@
+ # These are directories that are officially in HYPRE
+ HYPRE_DIRS =\
+  ${HYPRE_BASIC_DIRS}\
++ ${HYPRE_MULTIVEC_DIRS}\
+  ${HYPRE_KRYLOV_DIRS}\
+- ${HYPRE_STRUCT_DIRS}\
+- ${HYPRE_SSTRUCT_DIRS}\
+  ${HYPRE_IJ_DIRS}\
+- ${HYPRE_MULTIVEC_DIRS}\
++ ${HYPRE_STRUCT_DIRS}\
++ ${HYPRE_SSTRUCT_DIRS}\
+  ${HYPRE_FEI_DIRS}\
+  ${HYPRE_LIBS_DIRS}
+ 
+@@ -90,9 +90,9 @@
+ 	@ \
+ 	mkdir -p ${HYPRE_BUILD_DIR}/include; \
+ 	mkdir -p ${HYPRE_BUILD_DIR}/lib; \
+-	cp -fp HYPRE_config.h ${HYPRE_BUILD_DIR}/include/.; \
+-	cp -fp $(srcdir)/HYPRE.h ${HYPRE_BUILD_DIR}/include/.; \
+-	cp -fp $(srcdir)/HYPREf.h ${HYPRE_BUILD_DIR}/include/.; \
++	cp -fpd HYPRE_config.h ${HYPRE_BUILD_DIR}/include/.; \
++	cp -fpd $(srcdir)/HYPRE.h ${HYPRE_BUILD_DIR}/include/.; \
++	cp -fpd $(srcdir)/HYPREf.h ${HYPRE_BUILD_DIR}/include/.; \
+ 	for i in ${HYPRE_DIRS} ${HYPRE_BABEL_DIRS} ${HYPRE_EXAMPLE_DIRS}; \
+ 	do \
+ 	  echo "Making $$i ..."; \
+@@ -181,7 +181,7 @@
+ 	rm -Rf hypre; \
+ 	for i in ${HYPRE_DIRS} ${HYPRE_EXTRA_DIRS} ${HYPRE_BABEL_DIRS} ${HYPRE_EXAMPLE_DIRS}; \
+ 	do \
+-	  if [ -d $$i ]; \
++	  if [ -f $$i/Makefile ]; \
+ 	  then \
+ 	    echo "Cleaning $$i ..."; \
+ 	    (cd $$i && $(MAKE) $@); \
+--- hypre-2.4.0b.orig/src/configure
++++ hypre-2.4.0b/src/configure
+@@ -9715,7 +9715,7 @@
+ if test "$casc_using_fei" = "yes"
+ then
+    HYPRE_FEI_SRC_DIR="`pwd`/FEI_mv"
+-   HYPRE_FEI_SUBDIRS="fei-hypre femli"
++   HYPRE_FEI_SUBDIRS="fgmres femli fei-hypre"
+    HYPRE_FEI_HYPRE_FILES="`pwd`/FEI_mv/fei-hypre/*.o"
+    HYPRE_FEI_FEMLI_FILES="`pwd`/FEI_mv/femli/lib/*.o"
+    if test "$casc_using_superlu" = "yes"
+--- hypre-2.4.0b.orig/src/FEI_mv/fei-hypre/Makefile
++++ hypre-2.4.0b/src/FEI_mv/fei-hypre/Makefile
+@@ -67,6 +67,19 @@
+  ${SUPERLU_INCLUDE}\
+  ${CXXINCLUDES}
+ 
++
++HYPRE_LIBS = \
++  ../../utilities/libHYPRE_utilities.so \
++  ../../seq_mv/libHYPRE_seq_mv.so \
++  ../../parcsr_mv/libHYPRE_parcsr_mv.so \
++  ../../IJ_mv/libHYPRE_IJ_mv.so \
++  ../../parcsr_ls/libHYPRE_parcsr_ls.so \
++  ../fgmres/libHYPRE_FEI_fgmres.so \
++  ../femli/lib/libHYPRE_mli.so \
++  ../../krylov/libHYPRE_krylov.so
++
++SYSTEM_LIBS = -lmpi -lm -lmpi++ -lsuperlu
++
+ HEADERS =\
+  cfei-hypre.h\
+  cfei_hypre.h\
+@@ -119,7 +132,6 @@
+  HYPRE_parcsr_TFQmr.c\
+  HYPRE_parcsr_bicgs.c\
+  HYPRE_parcsr_bicgstabl.c\
+- HYPRE_parcsr_fgmres.c\
+  HYPRE_parcsr_lsicg.c\
+  HYPRE_parcsr_symqmr.c\
+  HYPRE_parcsr_maxwell.c\
+@@ -127,11 +139,12 @@
+  TFQmr.c\
+  bicgs.c\
+  bicgstabl.c\
+- fgmres.c\
+  hypre_lsi_amge.c\
+  hypre_lsi_ddamg.c\
+  hypre_lsi_misc.c\
+  lsicg.c
++# HYPRE_parcsr_fgmres.c
++# fgmres.c
+ 
+ FILESCXX = \
+  FEI_HYPRE_Impl.cxx\
+@@ -163,30 +176,30 @@
+ ##################################################################
+ 
+ all: libHYPRE_FEI${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/cfei-hypre.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/cfei_hypre.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/hypre_cfei.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/HYPRE_LinSysCore.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/HYPRE_FEI*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/LLNL_FEI*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(BASE_DIR)/base/Data.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(BASE_DIR)/base/Lookup.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(BASE_DIR)/base/LinearSystemCore.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(BASE_DIR)/fei_defs.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/cfei-hypre.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/cfei_hypre.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/hypre_cfei.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/HYPRE_LinSysCore.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/HYPRE_FEI*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/LLNL_FEI*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(BASE_DIR)/base/Data.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(BASE_DIR)/base/Lookup.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(BASE_DIR)/base/LinearSystemCore.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(BASE_DIR)/fei_defs.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_FEI${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/cfei-hypre.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/cfei_hypre.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/hypre_cfei.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/HYPRE_LinSysCore.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/HYPRE_FEI*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/LLNL_FEI*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(BASE_DIR)/base/Data.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(BASE_DIR)/base/Lookup.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(BASE_DIR)/base/LinearSystemCore.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(BASE_DIR)/fei_defs.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/cfei-hypre.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/cfei_hypre.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/hypre_cfei.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/HYPRE_LinSysCore.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_FEI*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/LLNL_FEI*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(BASE_DIR)/base/Data.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(BASE_DIR)/base/Lookup.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(BASE_DIR)/base/LinearSystemCore.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(BASE_DIR)/fei_defs.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 	@echo  ""
+ 
+ clean:
+@@ -198,10 +211,16 @@
+ ##################################################################
+ # Rules
+ ##################################################################
+-libHYPRE_FEI${HYPRE_LIB_SUFFIX}: ${OBJS}
++libHYPRE_FEI.a: ${OBJS}
+ 	@echo  "Building $@ ... "
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+-                                                                                
++
++libHYPRE_FEI.so: ${OBJS} ${HYPRE_LIBS}
++	@echo  "Building $@ ... "
++	${BUILD_CXX_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_FEI-2.4.0.so -Wl,-soname,libHYPRE_FEI-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_FEI-2.4.0.so $@
++
+ ${OBJS}: ${HEADERS}
+ 
+--- hypre-2.4.0b.orig/src/FEI_mv/femli/Makefile
++++ hypre-2.4.0b/src/FEI_mv/femli/Makefile
+@@ -93,11 +93,11 @@
+ 	@ \
+ 	for head in ${HEADERS}; \
+ 	do \
+-	    (cp -fp $$head ./lib); \
++	    (cp -fpd $$head ./lib); \
+ 	done;\
+ 	for file in ${FILES}; \
+ 	do \
+-	    (cp -fp $$file ./lib); \
++	    (cp -fpd $$file ./lib); \
+ 	done;\
+ 	(cd ./lib && $(MAKE) $@)
+ 
+@@ -105,11 +105,11 @@
+ 	@ \
+ 	for head in ${HEADERS}; \
+ 	do \
+-	    (cp -fp $$head ./lib); \
++	    (cp -fpd $$head ./lib); \
+ 	done;\
+ 	for file in ${FILES}; \
+ 	do \
+-	    (cp -fp $$file ./lib); \
++	    (cp -fpd $$file ./lib); \
+ 	done;\
+ 	(cd ./lib && $(MAKE) $@)
+ 
+--- hypre-2.4.0b.orig/src/FEI_mv/femli/lib/Makefile
++++ hypre-2.4.0b/src/FEI_mv/femli/lib/Makefile
+@@ -48,6 +48,18 @@
+  ${MLI_INCLUDES}\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = \
++  ../../../utilities/libHYPRE_utilities.so \
++  ../../../krylov/libHYPRE_krylov.so \
++  ../../../seq_mv/libHYPRE_seq_mv.so \
++  ../../../parcsr_mv/libHYPRE_parcsr_mv.so \
++  ../../../IJ_mv/libHYPRE_IJ_mv.so \
++  ../../../distributed_ls/ParaSails/libHYPRE_ParaSails.so \
++  ../../../parcsr_ls/libHYPRE_parcsr_ls.so \
++  ../../fgmres/libHYPRE_FEI_fgmres.so
++
++SYSTEM_LIBS = -lmpi -lm -lmpi++ -lsuperlu \
++  ${LAPACKLIBDIRS} ${LAPACKLIBS}
+ 
+ HEADERS =\
+  ../amgs/mli_method.h\
+@@ -138,10 +150,10 @@
+ ##################################################################
+ 
+ all: libHYPRE_mli${HYPRE_LIB_SUFFIX}
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_mli${HYPRE_LIB_SUFFIX}
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 	@echo  " "
+ 
+ clean:
+@@ -160,8 +172,9 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_mli.so: ${OBJS}
++libHYPRE_mli.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CXX_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_mli-2.4.0.so -Wl,-soname,libHYPRE_mli-2.4.0.so -Wl,-z,defs
++	ln -s libHYPRE_mli-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/FEI_mv/fgmres/Makefile
++++ hypre-2.4.0b/src/FEI_mv/fgmres/Makefile
+@@ -0,0 +1,136 @@
++#BHEADER**********************************************************************
++# Copyright (c) 2006   The Regents of the University of California.
++# Produced at the Lawrence Livermore National Laboratory.
++# Written by the HYPRE team. UCRL-CODE-222953.
++# All rights reserved.
++#
++# This file is part of HYPRE (see http://www.llnl.gov/CASC/hypre/).
++# Please see the COPYRIGHT_and_LICENSE file for the copyright notice, 
++# disclaimer, contact information and the GNU Lesser General Public License.
++#
++# HYPRE 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) version 2.1 dated February 1999.
++#
++# HYPRE 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 terms and conditions of the GNU General
++# Public License for more details.
++#
++# You should have received a copy of the GNU Lesser 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
++#
++# $Revision: 2.17 $
++#EHEADER**********************************************************************
++
++# why do we create this variable, asked by Charles
++HYPRE_LIB_SUFFIX = .a
++
++include ../../config/Makefile.config
++
++BASE_DIR = ${HYPRE_FEI_BASE_DIR}
++
++SUPERLU_INCLUDE = -I$(srcdir)/../SuperLU
++SUPERLU_LIB     = -L$(srcdir)/../SuperLU
++
++CINCLUDES=${INCLUDES} ${MPIINCLUDE} -I../ml/src/Include
++CXXINCLUDES=${INCLUDES} ${MPIINCLUDE} -I../ml/src/Include
++CDEFS = -DHAVE_SUPERLU -DBOOL_NOT_SUPPORTED
++CXXDEFS = -DHAVE_SUPERLU -DBOOL_NOT_SUPPORTED -DMPICH_SKIP_MPICXX
++
++C_COMPILE_FLAGS = \
++ ${CDEFS}\
++ -I../..\
++ -I$(BASE_DIR)\
++ -I$(srcdir)\
++ -I$(srcdir)/../..\
++ -I$(srcdir)/../../IJ_mv\
++ -I$(srcdir)/../../utilities\
++ -I$(srcdir)/../../multivector\
++ -I$(srcdir)/../../krylov\
++ -I$(srcdir)/../../parcsr_mv\
++ -I$(srcdir)/../../parcsr_ls\
++ -I$(srcdir)/../../seq_mv\
++ -I$(srcdir)/../../distributed_matrix\
++ -I$(srcdir)/../../distributed_ls\
++ -I$(srcdir)/../fei-base\
++ ${SUPERLU_INCLUDE}\
++ ${CINCLUDES}
++
++CXX_COMPILE_FLAGS = \
++ ${CXXDEFS}\
++ -I../..\
++ -I$(BASE_DIR)\
++ -I$(srcdir)/../..\
++ -I$(srcdir)/../../IJ_mv\
++ -I$(srcdir)/../../utilities\
++ -I$(srcdir)/../../multivector\
++ -I$(srcdir)/../../krylov\
++ -I$(srcdir)/../../parcsr_mv\
++ -I$(srcdir)/../../parcsr_ls\
++ -I$(srcdir)/../../seq_mv\
++ -I$(srcdir)/../../distributed_matrix\
++ -I$(srcdir)/../../distributed_ls\
++ -I$(srcdir)/../femli\
++ -I$(srcdir)/../fei-base\
++ ${SUPERLU_INCLUDE}\
++ ${CXXINCLUDES}
++
++HYPRE_LIBS = \
++  ../../utilities/libHYPRE_utilities.so \
++  ../../parcsr_ls/libHYPRE_parcsr_ls.so
++#  ../../krylov/libHYPRE_krylov.so
++#  ../../seq_mv/libHYPRE_seq_mv.so
++#  ../../parcsr_mv/libHYPRE_parcsr_mv.so
++#  ../../IJ_mv/libHYPRE_IJ_mv.so
++
++SYSTEM_LIBS = -lm
++
++HEADERS = 
++
++FILESC = \
++ ../fei-hypre/HYPRE_parcsr_fgmres.c\
++ ../fei-hypre/fgmres.c
++
++FILESCXX = 
++
++OBJSC = ${FILESC:.c=.o}
++OBJSCXX = ${FILESCXX:.cxx=.o}
++OBJS = ${OBJSC} ${OBJSCXX}
++
++##################################################################
++# Targets
++##################################################################
++
++all: libHYPRE_FEI_fgmres${HYPRE_LIB_SUFFIX}
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
++
++install: libHYPRE_FEI_fgmres${HYPRE_LIB_SUFFIX}
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
++	@echo  ""
++
++clean:
++	rm -rf *.o libHYPRE*
++	rm -rf pchdir tca.map *inslog*
++
++distclean: clean
++
++##################################################################
++# Rules
++##################################################################
++libHYPRE_FEI_fgmres.a: ${OBJS}
++	@echo  "Building $@ ... "
++	mv -f *.o ../fei-hypre/
++	${AR} $@ ${OBJS}
++	${RANLIB} $@
++
++libHYPRE_FEI_fgmres.so: ${OBJS} ${HYPRE_LIBS}
++	@echo  "Building $@ ... "
++	mv -f *.o ../fei-hypre/
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_FEI_fgmres-2.4.0.so -Wl,-soname,libHYPRE_FEI_fgmres-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_FEI_fgmres-2.4.0.so $@
++
++${OBJS}: ${HEADERS}
++
+--- hypre-2.4.0b.orig/src/IJ_mv/Makefile
++++ hypre-2.4.0b/src/IJ_mv/Makefile
+@@ -31,6 +31,13 @@
+  -I$(srcdir)/../parcsr_ls\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = \
++  ../utilities/libHYPRE_utilities.so \
++  ../seq_mv/libHYPRE_seq_mv.so \
++  ../parcsr_mv/libHYPRE_parcsr_mv.so
++
++SYSTEM_LIBS = -lmpi
++
+ HEADERS =\
+  aux_parcsr_matrix.h\
+  aux_par_vector.h\
+@@ -64,14 +71,14 @@
+ ##################################################################
+ 
+ all: libHYPRE_IJ_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/_hypre_IJ_mv.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/_hypre_IJ_mv.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_IJ_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/_hypre_IJ_mv.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/_hypre_IJ_mv.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -88,8 +95,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_IJ_mv.so: ${OBJS}
++libHYPRE_IJ_mv.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_IJ_mv-2.4.0.so -Wl,-soname,libHYPRE_IJ_mv-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_IJ_mv-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/config/configure.in
++++ hypre-2.4.0b/src/config/configure.in
+@@ -1027,7 +1027,7 @@
+ if test "$casc_using_fei" = "yes"
+ then
+    HYPRE_FEI_SRC_DIR="HYPRE_TOP_SRC_DIR/FEI_mv"
+-   HYPRE_FEI_SUBDIRS="fei-hypre femli"
++   HYPRE_FEI_SUBDIRS="fgmres femli fei-hypre"
+    HYPRE_FEI_HYPRE_FILES="HYPRE_TOP_SRC_DIR/FEI_mv/fei-hypre/*.o"
+    HYPRE_FEI_FEMLI_FILES="HYPRE_TOP_SRC_DIR/FEI_mv/femli/lib/*.o"
+    if test "$casc_using_superlu" = "yes"
+--- hypre-2.4.0b.orig/src/distributed_ls/Euclid/Makefile
++++ hypre-2.4.0b/src/distributed_ls/Euclid/Makefile
+@@ -37,6 +37,10 @@
+  -I$(srcdir)/../../hypre/include\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = ../../parcsr_mv/libHYPRE_parcsr_mv.so
++
++SYSTEM_LIBS = -lmpi -lm
++
+ HEADERS =\
+  blas_dh.h\
+  euclid_common.h\
+@@ -105,10 +109,10 @@
+ ##################################################################
+ 
+ all: libHYPRE_Euclid${HYPRE_LIB_SUFFIX}
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_Euclid${HYPRE_LIB_SUFFIX}
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -126,8 +130,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_Euclid.so: ${OBJS}
++libHYPRE_Euclid.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED}  -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_Euclid-2.4.0.so -Wl,-soname,libHYPRE_Euclid-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_Euclid-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/distributed_ls/ParaSails/Makefile
++++ hypre-2.4.0b/src/distributed_ls/ParaSails/Makefile
+@@ -29,6 +29,13 @@
+  -I$(srcdir)/../../distributed_matrix\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = \
++  ../../utilities/libHYPRE_utilities.so \
++  ../../IJ_mv/libHYPRE_IJ_mv.so \
++  ../../distributed_matrix/libHYPRE_DistributedMatrix.so
++
++SYSTEM_LIBS = -lmpi -lm ${BLASLIBDIRS} ${BLASLIBS} ${LAPACKLIBDIRS} ${LAPACKLIBS}
++
+ HEADERS =\
+  Common.h\
+  ConjGrad.h\
+@@ -68,10 +75,10 @@
+ ##################################################################
+ 
+ all: libHYPRE_ParaSails${HYPRE_LIB_SUFFIX}
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_ParaSails${HYPRE_LIB_SUFFIX}
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -89,8 +96,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_ParaSails.so: ${OBJS}
++libHYPRE_ParaSails.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_ParaSails-2.4.0.so -Wl,-soname,libHYPRE_ParaSails-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_ParaSails-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/distributed_ls/pilut/Makefile
++++ hypre-2.4.0b/src/distributed_ls/pilut/Makefile
+@@ -29,6 +29,12 @@
+  -I$(srcdir)/../../distributed_matrix\
+ ${CINCLUDES}
+ 
++HYPRE_LIBS = \
++  ../../utilities/libHYPRE_utilities.so \
++  ../../distributed_matrix/libHYPRE_DistributedMatrix.so
++
++SYSTEM_LIBS = -lmpi -lm ${BLASLIBDIRS} ${BLASLIBS}
++
+ HEADERS = \
+  HYPRE_DistributedMatrixPilutSolver_protos.h\
+  HYPRE_DistributedMatrixPilutSolver_types.h\
+@@ -61,12 +67,12 @@
+ ##################################################################
+ 
+ all: libHYPRE_DistributedMatrixPilutSolver${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_DistributedMatrixPilutSolver${HYPRE_LIB_SUFFIX}
+-	cp -f $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -f libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -83,8 +89,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_DistributedMatrixPilutSolver.so: ${OBJS}
++libHYPRE_DistributedMatrixPilutSolver.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_DistributedMatrixPilutSolver-2.4.0.so -Wl,-soname,libHYPRE_DistributedMatrixPilutSolver-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_DistributedMatrixPilutSolver-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/distributed_matrix/Makefile
++++ hypre-2.4.0b/src/distributed_matrix/Makefile
+@@ -29,6 +29,8 @@
+  -I$(srcdir)/../seq_mv\
+  ${CINCLUDES}
+ 
++LIBS = ../utilities/libHYPRE_utilities.so ../parcsr_mv/libHYPRE_parcsr_mv.so
++
+ EXTRA_HEADERS = internal_protos.h
+ 
+ HEADERS =\
+@@ -51,12 +53,12 @@
+ ##################################################################
+ 
+ all: libHYPRE_DistributedMatrix${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/distributed_matrix.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/distributed_matrix.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_DistributedMatrix${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/distributed_matrix.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/distributed_matrix.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ clean:
+ 	rm -f *.o libHYPRE*
+ 	rm -rf pchdir tca.map *inslog*
+@@ -73,8 +75,9 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_DistributedMatrix.so: ${OBJS}
++libHYPRE_DistributedMatrix.so: ${OBJS} ${LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ -o libHYPRE_DistributedMatrix-2.4.0.so -Wl,-soname,libHYPRE_DistributedMatrix-2.4.0.so -Wl,-z,defs
++	ln -s libHYPRE_DistributedMatrix-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/krylov/Makefile
++++ hypre-2.4.0b/src/krylov/Makefile
+@@ -28,6 +28,10 @@
+  -I$(srcdir)/../utilities\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = ../utilities/libHYPRE_utilities.so ../multivector/libHYPRE_multivector.so
++
++SYSTEM_LIBS = ${LAPACKLIBDIRS} ${LAPACKLIBS} -lm
++
+ HEADERS =\
+  HYPRE_krylov.h\
+  krylov.h\
+@@ -45,17 +49,17 @@
+  bicgstab.c\
+  cgnr.c\
+  gmres.c\
+- flexgmres.c\
+  lgmres.c\
+  HYPRE_bicgstab.c\
+  HYPRE_cgnr.c\
+  HYPRE_gmres.c\
+  HYPRE_lgmres.c\
+- HYPRE_flexgmres.c\
+  HYPRE_pcg.c\
+  pcg.c\
+  HYPRE_lobpcg.c\
+  lobpcg.c
++# flexgmres.c
++# HYPRE_flexgmres.c
+ 
+ OBJS = ${FILES:.c=.o}
+ 
+@@ -64,16 +68,16 @@
+ ##################################################################
+ 
+ all: libHYPRE_krylov${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/krylov.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/lobpcg.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/krylov.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/lobpcg.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: all
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/krylov.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/lobpcg.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/krylov.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/lobpcg.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -91,8 +95,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_krylov.so: ${OBJS}
++libHYPRE_krylov.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_krylov-2.4.0.so -Wl,-soname,libHYPRE_krylov-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_krylov-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/lib/Makefile
++++ hypre-2.4.0b/src/lib/Makefile
+@@ -19,27 +19,6 @@
+ 
+ include ../config/Makefile.config
+ 
+- 
+-SUPERLUFILES = ${HYPRE_FEI_SUPERLU_FILES}
+-FEIHYPREFILES = ${HYPRE_FEI_HYPRE_FILES}
+-FEMLIFILES = ${HYPRE_FEI_FEMLI_FILES}
+-IJMVFILES = ${HYPRE_SRC_TOP_DIR}/IJ_mv/*.o
+-EUCLIDFILES = ${HYPRE_SRC_TOP_DIR}/distributed_ls/Euclid/*.o
+-PARASAILSFILES = ${HYPRE_SRC_TOP_DIR}/distributed_ls/ParaSails/*.o
+-PILUTFILES = ${HYPRE_SRC_TOP_DIR}/distributed_ls/pilut/*.o
+-DISTMATRIXFILES = ${HYPRE_SRC_TOP_DIR}/distributed_matrix/*.o
+-KRYLOVFILES = ${HYPRE_SRC_TOP_DIR}/krylov/*.o
+-MATMATFILES = ${HYPRE_SRC_TOP_DIR}/matrix_matrix/*.o
+-MULTIVECFILES = ${HYPRE_SRC_TOP_DIR}/multivector/*.o
+-PARCSRLSFILES = ${HYPRE_SRC_TOP_DIR}/parcsr_ls/*.o
+-PARCSRMVFILES = ${HYPRE_SRC_TOP_DIR}/parcsr_mv/*.o
+-PARCSRBLOCKMVFILES = ${HYPRE_SRC_TOP_DIR}/parcsr_block_mv/*.o
+-SEQMVFILES = ${HYPRE_SRC_TOP_DIR}/seq_mv/*.o
+-SSTRUCTLSFILES = ${HYPRE_SRC_TOP_DIR}/sstruct_ls/*.o
+-SSTRUCTMVFILES = ${HYPRE_SRC_TOP_DIR}/sstruct_mv/*.o
+-STRUCTLSFILES = ${HYPRE_SRC_TOP_DIR}/struct_ls/*.o
+-STRUCTMVFILES = ${HYPRE_SRC_TOP_DIR}/struct_mv/*.o
+-UTILITIESFILES = ${HYPRE_SRC_TOP_DIR}/utilities/*.o
+ 
+ UTILFILES = \
+  ${HYPRE_SRC_TOP_DIR}/utilities/amg_linklist.o\
+@@ -81,6 +60,30 @@
+ $(STRUCTMVFILES)\
+ $(UTILITIESFILES)
+ 
++LIBS_BOTH = \
++  ../utilities/libHYPRE_utilities.so \
++  ../multivector/libHYPRE_multivector.so \
++  ../krylov/libHYPRE_krylov.so \
++  ../struct_mv/libHYPRE_struct_mv.so \
++  ../struct_ls/libHYPRE_struct_ls.so \
++  ../sstruct_mv/libHYPRE_sstruct_mv.so \
++  ../sstruct_ls/libHYPRE_sstruct_ls.so \
++  ../seq_mv/libHYPRE_seq_mv.so \
++  ../parcsr_mv/libHYPRE_parcsr_mv.so \
++  ../parcsr_block_mv/libHYPRE_parcsr_block_mv.so \
++  ../distributed_matrix/libHYPRE_DistributedMatrix.so \
++  ../matrix_matrix/libHYPRE_MatrixMatrix.so \
++  ../IJ_mv/libHYPRE_IJ_mv.so \
++  ../distributed_ls/Euclid/libHYPRE_Euclid.so \
++  ../distributed_ls/ParaSails/libHYPRE_ParaSails.so \
++  ../distributed_ls/pilut/libHYPRE_DistributedMatrixPilutSolver.so \
++  ../parcsr_ls/libHYPRE_parcsr_ls.so \
++  ../FEI_mv/fgmres/libHYPRE_FEI_fgmres.so \
++  ../FEI_mv/femli/lib/libHYPRE_mli.so \
++  ../FEI_mv/fei-hypre/libHYPRE_FEI.so
++
++LIBS_HYPRE = ../utilities/libHYPRE_utilities.so ${LIBS_BOTH}
++
+ FILES_LSI = \
+ $(FEIHYPREFILES)\
+ $(FEMLIFILES)\
+@@ -107,10 +110,10 @@
+ ##################################################################
+ 
+ all: libHYPRE${HYPRE_LIB_SUFFIX} libHYPRE_LSI${HYPRE_LIB_SUFFIX}
+-	cp -fp libHYPRE* ${HYPRE_BUILD_DIR}/lib
++	cp -fpd libHYPRE* ${HYPRE_BUILD_DIR}/lib
+ 
+ install: all
+-	cp -fp libHYPRE* ${HYPRE_LIB_INSTALL}
++	cp -fpd libHYPRE* ${HYPRE_LIB_INSTALL}
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -143,9 +146,10 @@
+ 	${AR} $@ $(UTILITIESFILES)
+ 	${RANLIB} $@
+ 
+-libHYPRE.so: ${FILES_HYPRE}
++libHYPRE.so: ${LIBS_HYPRE}
+ 	@echo  "Building libHYPRE ... "
+-	${BUILD_CC_SHARED} -o $@ ${FILES_HYPRE}
++	${BUILD_CC_SHARED} $^ -o libHYPRE-2.4.0.so -Wl,-soname,libHYPRE-2.4.0.so -Wl,-z,defs
++	ln -s libHYPRE-2.4.0.so $@
+ 
+ libHYPRE_LSI.a: ${FILES_LSI}
+ 	@echo  "Building libHYPRE_LSI ... "
+@@ -170,5 +174,6 @@
+ 
+ libHYPRE_LSI.so: ${FILES_LSI}
+ 	@echo  "Building libHYPRE_LSI ... "
+-	${BUILD_CC_SHARED} -o $@ ${FILES_LSI}
++	${BUILD_CC_SHARED} $^ -lmpi -lm -o libHYPRE_LSI-2.4.0.so -Wl,-soname,libHYPRE_LSI-2.4.0.so -Wl,-z,defs
++	ln -s libHYPRE_LSI-2.4.0.so $@
+ 
+--- hypre-2.4.0b.orig/src/matrix_matrix/Makefile
++++ hypre-2.4.0b/src/matrix_matrix/Makefile
+@@ -30,6 +30,11 @@
+  -I$(srcdir)/../parcsr_mv\
+  ${CINCLUDES}
+ 
++LIBS =  \
++  ../parcsr_mv/libHYPRE_parcsr_mv.so \
++  ../distributed_matrix/libHYPRE_DistributedMatrix.so
++#  ../IJ_mv/libHYPRE_IJ_mv.so
++
+ EXTRA_FILES =\
+  internal_protos.h
+ 
+@@ -46,12 +51,12 @@
+ ##################################################################
+ 
+ all: libHYPRE_MatrixMatrix${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_MatrixMatrix${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o lib*
+@@ -68,8 +73,9 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_MatrixMatrix.so: ${OBJS}
++libHYPRE_MatrixMatrix.so: ${OBJS} ${LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ -o libHYPRE_MatrixMatrix-2.4.0.so -Wl,-soname,libHYPRE_MatrixMatrix-2.4.0.so -Wl,-z,defs
++	ln -s libHYPRE_MatrixMatrix-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/multivector/Makefile
++++ hypre-2.4.0b/src/multivector/Makefile
+@@ -42,12 +42,12 @@
+ ##################################################################
+ 
+ all: libHYPRE_multivector${HYPRE_LIB_SUFFIX}
+-	cp -fp *.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd *.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_multivector${HYPRE_LIB_SUFFIX}
+-	cp -f *.h $(HYPRE_INC_INSTALL)
+-	cp -f libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd *.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -64,8 +64,9 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_multivector.so: ${OBJS}
++libHYPRE_multivector.so: ${OBJS} ../utilities/libHYPRE_utilities.so
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ -o libHYPRE_multivector-2.4.0.so -Wl,-soname,libHYPRE_multivector-2.4.0.so -Wl,-z,defs
++	ln -s libHYPRE_multivector-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/parcsr_block_mv/Makefile
++++ hypre-2.4.0b/src/parcsr_block_mv/Makefile
+@@ -34,8 +34,15 @@
+  -I$(srcdir)/../krylov\
+  ${CINCLUDES}
+  
++HYPRE_LIBS = \
++  ../utilities/libHYPRE_utilities.so \
++  ../seq_mv/libHYPRE_seq_mv.so \
++  ../parcsr_mv/libHYPRE_parcsr_mv.so
++
++SYSTEM_LIBS = -lmpi -lm
++
+ LFLAGS = \
+-  -L. -lHYPRE_parcsr_block_mv -L../hypre/lib -lHYPRE_krylov \
++  -L../hypre/lib -lHYPRE_krylov \
+       -lHYPRE_parcsr_ls -lHYPRE_ParaSails -lHYPRE_Euclid \
+       -lHYPRE_DistributedMatrixPilutSolver -lHYPRE_IJ_mv \
+       -lHYPRE_parcsr_mv -lHYPRE_seq_mv -lHYPRE_DistributedMatrix \
+@@ -70,9 +77,9 @@
+ ##################################################################
+ 
+ all: libHYPRE_parcsr_block_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/par_csr_block_matrix.h $(HYPRE_BUILD_DIR)/include	
+-	cp -fp $(srcdir)/csr_block_matrix.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE_* $(HYPRE_BUILD_DIR)/lib/.
++	cp -fpd $(srcdir)/par_csr_block_matrix.h $(HYPRE_BUILD_DIR)/include	
++	cp -fpd $(srcdir)/csr_block_matrix.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE_* $(HYPRE_BUILD_DIR)/lib/.
+  
+ driver: driver.o libHYPRE_parcsr_block_mv${HYPRE_LIB_SUFFIX}
+ 	@echo  "Linking" $@ "... "
+@@ -99,9 +106,9 @@
+ 	${CC} -o driver_boolaat driver_boolaat.o ${LFLAGS} 
+ 
+ install: libHYPRE_parcsr_block_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/par_csr_block_matrix.h $(HYPRE_INC_INSTALL)/.
+-	cp -fp $(srcdir)/csr_block_matrix.h $(HYPRE_INC_INSTALL)/.
+-	cp -fp libHYPRE_* $(HYPRE_LIB_INSTALL)/.
++	cp -fpd $(srcdir)/par_csr_block_matrix.h $(HYPRE_INC_INSTALL)/.
++	cp -fpd $(srcdir)/csr_block_matrix.h $(HYPRE_INC_INSTALL)/.
++	cp -fpd libHYPRE_* $(HYPRE_LIB_INSTALL)/.
+  
+ clean:
+ 	rm -rf *.o libHYPRE_*
+@@ -118,9 +125,11 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_parcsr_block_mv.so: ${OBJS}
++libHYPRE_parcsr_block_mv.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_parcsr_block_mv-2.4.0.so -Wl,-soname,libHYPRE_parcsr_block_mv-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_parcsr_block_mv-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+ 
+--- hypre-2.4.0b.orig/src/parcsr_ls/Makefile
++++ hypre-2.4.0b/src/parcsr_ls/Makefile
+@@ -42,7 +42,22 @@
+  -I$(srcdir)/../parcsr_block_mv\
+  ${CINCLUDES}
+  
+- 
++HYPRE_LIBS = \
++  ../utilities/libHYPRE_utilities.so \
++  ../multivector/libHYPRE_multivector.so \
++  ../krylov/libHYPRE_krylov.so \
++  ../seq_mv/libHYPRE_seq_mv.so \
++  ../parcsr_mv/libHYPRE_parcsr_mv.so \
++  ../parcsr_block_mv/libHYPRE_parcsr_block_mv.so \
++  ../distributed_matrix/libHYPRE_DistributedMatrix.so \
++  ../IJ_mv/libHYPRE_IJ_mv.so \
++  ../matrix_matrix/libHYPRE_MatrixMatrix.so \
++  ../distributed_ls/pilut/libHYPRE_DistributedMatrixPilutSolver.so \
++  ../distributed_ls/ParaSails/libHYPRE_ParaSails.so \
++  ../distributed_ls/Euclid/libHYPRE_Euclid.so
++
++SYSTEM_LIBS = -lmpi -lm $(LAPACKLIBDIRS) $(LAPACKLIBS)
++
+ HEADERS =\
+  aux_interp.h\
+  Common.h\
+@@ -124,7 +141,9 @@
+  schwarz.c\
+  block_tridiag.c\
+  ams.c\
+- ame.c
++ ame.c\
++ flexgmres.c\
++ HYPRE_flexgmres.c
+ 
+ OBJS = ${FILES:.c=.o}
+ 
+@@ -133,14 +152,14 @@
+ ##################################################################
+ 
+ all: libHYPRE_parcsr_ls${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/_hypre_parcsr_ls.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/_hypre_parcsr_ls.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+  
+ install: libHYPRE_parcsr_ls${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/_hypre_parcsr_ls.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/_hypre_parcsr_ls.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+  
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -158,8 +177,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_parcsr_ls.so: ${OBJS}
++libHYPRE_parcsr_ls.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_parcsr_ls-2.4.0.so -Wl,-soname,libHYPRE_parcsr_ls-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_parcsr_ls-2.4.0.so $@
+  
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/parcsr_mv/Makefile
++++ hypre-2.4.0b/src/parcsr_mv/Makefile
+@@ -29,6 +29,10 @@
+  -I$(srcdir)/../seq_mv\
+  ${CINCLUDES}
+  
++HYPRE_LIBS = ../seq_mv/libHYPRE_seq_mv.so ../utilities/libHYPRE_utilities.so
++
++SYSTEM_LIBS = -lmpi
++
+ HEADERS =\
+  headers.h\
+  HYPRE_parcsr_mv.h\
+@@ -83,9 +87,9 @@
+ ##################################################################
+ 
+ all: libHYPRE_parcsr_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/_hypre_parcsr_mv.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/_hypre_parcsr_mv.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+  
+ driver: driver.o libHYPRE_parcsr_mv${HYPRE_LIB_SUFFIX} 
+ 	@echo  "Linking" $@ "... "
+@@ -112,9 +116,9 @@
+ 	${CC} -o driver_boolaat driver_boolaat.o ${LFLAGS} 
+ 
+ install: libHYPRE_parcsr_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/_hypre_parcsr_mv.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/_hypre_parcsr_mv.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+  
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -132,9 +136,11 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_parcsr_mv.so: ${OBJS}
++libHYPRE_parcsr_mv.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_parcsr_mv-2.4.0.so -Wl,-soname,libHYPRE_parcsr_mv-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_parcsr_mv-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+ 
+--- hypre-2.4.0b.orig/src/seq_mv/Makefile
++++ hypre-2.4.0b/src/seq_mv/Makefile
+@@ -58,14 +58,14 @@
+ ##################################################################
+  
+ all: libHYPRE_seq_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/seq_mv.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/seq_mv.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+  
+ install: libHYPRE_seq_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/seq_mv.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/seq_mv.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -83,8 +83,9 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_seq_mv.so: ${OBJS}
++libHYPRE_seq_mv.so: ${OBJS} ../utilities/libHYPRE_utilities.so
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ -o libHYPRE_seq_mv-2.4.0.so -Wl,-soname,libHYPRE_seq_mv-2.4.0.so -Wl,-z,defs
++	ln -s libHYPRE_seq_mv-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/seq_ls/pamg/Makefile
++++ hypre-2.4.0b/src/seq_ls/pamg/Makefile
+@@ -34,11 +34,9 @@
+  
+ LFLAGS =\
+  ${LD_LINK_FLAGS}\
+- -L.\
+  -L../../seq_mv\
+  -L../../utilities\
+  -L../../krylov\
+- -lHYPRE_amg_ls\
+  -lHYPRE_seq_mv\
+  -lHYPRE_utilities\
+  -lHYPRE_krylov\
+@@ -124,6 +122,7 @@
+ 
+ libHYPRE_amg_ls.so: ${OBJS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} -o libHYPRE_amg_ls-2.4.0.so -Wl,-soname,libHYPRE_amg_ls-2.4.0.so ${LFLAGS} ${OBJS}
++	ln -s libHYPRE_amg_ls-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/sstruct_ls/Makefile
++++ hypre-2.4.0b/src/sstruct_ls/Makefile
+@@ -37,6 +37,20 @@
+  -I$(srcdir)/../parcsr_ls\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = \
++  ../utilities/libHYPRE_utilities.so \
++  ../multivector/libHYPRE_multivector.so \
++  ../krylov/libHYPRE_krylov.so \
++  ../struct_mv/libHYPRE_struct_mv.so \
++  ../struct_ls/libHYPRE_struct_ls.so \
++  ../seq_mv/libHYPRE_seq_mv.so \
++  ../parcsr_mv/libHYPRE_parcsr_mv.so \
++  ../IJ_mv/libHYPRE_IJ_mv.so \
++  ../parcsr_ls/libHYPRE_parcsr_ls.so \
++  ../sstruct_mv/libHYPRE_sstruct_mv.so
++
++SYSTEM_LIBS = -lmpi -lm
++
+ HEADERS =\
+  HYPRE_sstruct_int.h\
+  HYPRE_sstruct_ls.h\
+@@ -122,14 +136,14 @@
+ ##################################################################
+ 
+ all: libHYPRE_sstruct_ls${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/_hypre_sstruct_ls.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/_hypre_sstruct_ls.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_sstruct_ls${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/_hypre_sstruct_ls.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/_hypre_sstruct_ls.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -146,8 +160,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_sstruct_ls.so: ${OBJS}
++libHYPRE_sstruct_ls.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_sstruct_ls-2.4.0.so -Wl,-soname,libHYPRE_sstruct_ls-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_sstruct_ls-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/sstruct_mv/Makefile
++++ hypre-2.4.0b/src/sstruct_mv/Makefile
+@@ -32,6 +32,14 @@
+  -I$(srcdir)/../IJ_mv\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = \
++  ../utilities/libHYPRE_utilities.so \
++  ../struct_mv/libHYPRE_struct_mv.so \
++  ../parcsr_mv/libHYPRE_parcsr_mv.so \
++  ../IJ_mv/libHYPRE_IJ_mv.so
++
++SYSTEM_LIBS = -lmpi
++
+ HEADERS =\
+  HYPRE_sstruct_mv.h\
+  _hypre_sstruct_mv.h\
+@@ -74,14 +82,14 @@
+ ##################################################################
+ 
+ all: libHYPRE_sstruct_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/_hypre_sstruct_mv.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/_hypre_sstruct_mv.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_sstruct_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/_hypre_sstruct_mv.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/_hypre_sstruct_mv.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -98,8 +106,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_sstruct_mv.so: ${OBJS}
++libHYPRE_sstruct_mv.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_sstruct_mv-2.4.0.so -Wl,-soname,libHYPRE_sstruct_mv-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_sstruct_mv-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/struct_ls/Makefile
++++ hypre-2.4.0b/src/struct_ls/Makefile
+@@ -31,6 +31,15 @@
+  -I$(srcdir)/../struct_mv\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = \
++  ../utilities/libHYPRE_utilities.so \
++  ../multivector/libHYPRE_multivector.so \
++  ../krylov/libHYPRE_krylov.so \
++  ../parcsr_ls/libHYPRE_parcsr_ls.so \
++  ../struct_mv/libHYPRE_struct_mv.so
++
++SYSTEM_LIBS = -lmpi -lm
++
+ HEADERS =\
+  HYPRE_struct_int.h\
+  HYPRE_struct_ls.h\
+@@ -113,14 +122,14 @@
+ ##################################################################
+ 
+ all: libHYPRE_struct_ls${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/_hypre_struct_ls.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/_hypre_struct_ls.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_struct_ls${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/_hypre_struct_ls.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/_hypre_struct_ls.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -138,8 +147,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_struct_ls.so: ${OBJS}
++libHYPRE_struct_ls.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_struct_ls-2.4.0.so -Wl,-soname,libHYPRE_struct_ls-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_struct_ls-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/struct_mv/Makefile
++++ hypre-2.4.0b/src/struct_mv/Makefile
+@@ -27,6 +27,9 @@
+  -I$(srcdir)/../utilities\
+  ${CINCLUDES}
+ 
++HYPRE_LIBS = ../utilities/libHYPRE_utilities.so
++
++SYSTEM_LIBS = -lmpi -lm
+ HEADERS =\
+  HYPRE_struct_mv.h\
+  _hypre_struct_mv.h\
+@@ -83,14 +86,14 @@
+ ##################################################################
+ 
+ all: libHYPRE_struct_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/_hypre_struct_mv.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/_hypre_struct_mv.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_struct_mv${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/_hypre_struct_mv.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/_hypre_struct_mv.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE*
+@@ -107,8 +110,10 @@
+ 	${AR} $@ ${OBJS}
+ 	${RANLIB} $@
+ 
+-libHYPRE_struct_mv.so: ${OBJS}
++libHYPRE_struct_mv.so: ${OBJS} ${HYPRE_LIBS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ ${OBJS}
++	${BUILD_CC_SHARED} $^ ${SYSTEM_LIBS} -o libHYPRE_struct_mv-2.4.0.so -Wl,-soname,libHYPRE_struct_mv-2.4.0.so \
++	  -Wl,-z,defs
++	ln -s libHYPRE_struct_mv-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
+--- hypre-2.4.0b.orig/src/utilities/Makefile
++++ hypre-2.4.0b/src/utilities/Makefile
+@@ -73,16 +73,16 @@
+ ##################################################################
+ 
+ all: libHYPRE_utilities${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/_hypre_utilities.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp $(srcdir)/fortran*.h $(HYPRE_BUILD_DIR)/include
+-	cp -fp libHYPRE* $(HYPRE_BUILD_DIR)/lib
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/_hypre_utilities.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd $(srcdir)/fortran*.h $(HYPRE_BUILD_DIR)/include
++	cp -fpd libHYPRE* $(HYPRE_BUILD_DIR)/lib
+ 
+ install: libHYPRE_utilities${HYPRE_LIB_SUFFIX}
+-	cp -fp $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/_hypre_utilities.h $(HYPRE_INC_INSTALL)
+-	cp -fp $(srcdir)/fortran*.h $(HYPRE_INC_INSTALL)
+-	cp -fp libHYPRE* $(HYPRE_LIB_INSTALL)
++	cp -fpd $(srcdir)/HYPRE_*.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/_hypre_utilities.h $(HYPRE_INC_INSTALL)
++	cp -fpd $(srcdir)/fortran*.h $(HYPRE_INC_INSTALL)
++	cp -fpd libHYPRE* $(HYPRE_LIB_INSTALL)
+ 
+ clean:
+ 	rm -f *.o libHYPRE* f2c.h *blas.h *lapack.h 
+@@ -101,6 +101,7 @@
+  
+ libHYPRE_utilities.so: ${OBJS}
+ 	@echo  "Building $@ ... "
+-	${BUILD_CC_SHARED} -o $@ *.o
++	${BUILD_CC_SHARED} $^ -lm -lmpi -o libHYPRE_utilities-2.4.0.so -Wl,-soname,libHYPRE_utilities-2.4.0.so -Wl,-z,defs
++	ln -s libHYPRE_utilities-2.4.0.so $@
+ 
+ ${OBJS}: ${HEADERS}
