From 980af42c5ba8378b5f2c2ad304ff5bd5722a51b0 Mon Sep 17 00:00:00 2001
From: Pietro Incardona <i-bird@localhost.localdomain>
Date: Mon, 8 Feb 2016 03:39:01 -0500
Subject: [PATCH] Working H5Part installation

---
 configure.ac           | 20 +++++++--
 install                | 95 ++++++++++++++++++++++++++----------------
 script/detect_fortran  |  2 -
 script/install_HDF5.sh |  0
 script/pre_req         |  1 -
 5 files changed, 77 insertions(+), 41 deletions(-)
 mode change 100644 => 100755 script/install_HDF5.sh

diff --git a/configure.ac b/configure.ac
index 352f29055..42dc743c6 100755
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,7 @@ m4_ifdef([AX_LAPACK],,[m4_include([m4/ax_lapack.m4])])
 m4_ifdef([AX_SUITESPARSE],,[m4_include([m4/ax_suitesparse.m4])])
 m4_ifdef([AX_EIGEN],,[m4_include([m4/ax_eigen.m4])])
 m4_ifdef([AX_LIB_HDF5],,[m4_include([m4/ax_lib_hdf5.m4])]])
-
+m4_ifdef([AX_H5HUT],,[m4_include([m4/ax_h5hut.m4])])
 
 CXXFLAGS+=" --std=c++11 "
 NVCCFLAGS=" "
@@ -105,8 +105,22 @@ IMMDX_LIB_METIS([],[echo "Cannot detect metis, use the --with-metis option if it
 
 ## Check for HDF5
 
-AX_LIB_HDF5([],[echo "Cannot detect hdf5, use the --with-hdf5 option if it is not installed in the default location"
-                    exit 206])
+AX_LIB_HDF5([parallel])
+
+if test x"$with_hdf5" = x"no"; then
+    echo "Cannot detect hdf5, use the --with-hdf5 option if it is not installed in the default location"
+    exit 207
+fi
+
+#########
+
+## Check for H5HUT
+
+save_CC=$CC
+CC=$CXX
+AX_H5HUT([],[echo "Cannot detect h5hut, use the --with-h5hut option if it is not installed in the default location"
+                    exit 208])
+CC=$save_CC
 
 ########
 
diff --git a/install b/install
index f26e6d20a..b3eebd1e3 100755
--- a/install
+++ b/install
@@ -1,36 +1,36 @@
-#! /bin/bash
-
-source script/help
-source script/discover_os
-source script/show_solutions
-source script/pre_req
-source script/remove_old
-
-##
-
-install_req=1
-i_dir=" "
-sq=0
-
-while getopts :di:shc: FLAG; do
-  case $FLAG in
-    d)
-      echo "Disable depencencies installation"
-      install_req=0
-      ;;
-    i)
-      echo "Setting dependencies installation dir: $OPTARG"
-      i_dir=$OPTARG
-      ;;
-    s)
-      echo "Skipping user cin"
-      sq=1
-      ;;
-    c)
-      echo "Fowarding options $OPTARG to configure script"
-      configure_options=$OPTARG
-      ;;
-    h)  #show help
+	#! /bin/bash
+
+	source script/help
+	source script/discover_os
+	source script/show_solutions
+	source script/pre_req
+	source script/remove_old
+
+	##
+
+	install_req=1
+	i_dir=" "
+	sq=0
+
+	while getopts :di:shc: FLAG; do
+	  case $FLAG in
+	    d)
+	      echo "Disable depencencies installation"
+	      install_req=0
+	      ;;
+	    i)
+	      echo "Setting dependencies installation dir: $OPTARG"
+	      i_dir=$OPTARG
+	      ;;
+	    s)
+	      echo "Skipping user cin"
+	      sq=1
+	      ;;
+	    c)
+	      echo "Fowarding options $OPTARG to configure script"
+	      configure_options=$OPTARG
+	      ;;
+	    h)  #show help
       HELP
       ;;
     \?) #unrecognized option - are fowarded to configure
@@ -138,6 +138,7 @@ LAPACK_installed=0
 SUITESPARSE_installed=0
 EIGEN_installed=0
 HDF5_installed=0
+H5HUT_installed=0
 blas_options=""
 conf_err=1
 
@@ -217,11 +218,21 @@ else
         elif [ $conf_err -eq 207 ]; then
             echo "HDF5 not found try to install"
             if [ $HDF5_installed -eq 1 ]; then
-                echo "Error the installation of HDF5 failed"	
+                echo "Error the installation of HDF5 failed"
+                exit 1	
             fi
             ./script/install_HDF5.sh $i_dir $compiler_opt
-            configure_options=" $configure_options --with-hdf5=$i_dir/HDF5 "
+            configure_options=" $configure_options --with-hdf5=$i_dir/HDF5/bin/h5pcc "
             HDF5_installed=1
+        elif [ $conf_err -eq 208 ]; then
+            echo "H5HUT not found try to install"
+            if [ $H5HUT_installed -eq 1 ]; then
+                echo "Error the installation of H5HUT failed"
+                exit 1	
+            fi
+            ./script/install_H5HUT.sh $i_dir $compiler_opt
+            configure_options=" $configure_options --with-h5hut=$i_dir/H5HUT/ "
+            H5HUT_installed=1
         elif [ $conf_err -ne 0 ]; then
             echo "I do not know how to recover from this error"
             exit 1
@@ -320,6 +331,20 @@ if [ $SUITESPARSE_installed -eq 1 ]; then
     echo -e "\033[1m  export DYLD_LIBRARY_PATH=\"\$DYLD_LIBRARY_PATH:$i_dir/SUITESPARSE/lib\" \033[0m"
   fi
 fi
+if [ $EIGEN_installed -eq 1 ]; then
+  echo ""
+  echo -e "\033[1;34;5m ---------------------------------------  \033[0m"
+  echo -e "\033[1;34;5m --------------- EIGEN ----------------- \033[0m"
+  echo -e "  EIGEN has been installed into: \033[1m $i_dir/EIGEN \033[0m"
+  echo ""
+fi
+if [ $HDF5_installed -eq 1 ]; then
+  echo ""
+  echo -e "\033[1;34;5m ---------------------------------------  \033[0m"
+  echo -e "\033[1;34;5m ---------------- HDF5 ----------------- \033[0m"
+  echo -e "  HDF5 has been installed into: \033[1m $i_dir/HDF5 \033[0m"
+  echo ""
+fi
 echo ""
 echo ""
 if [ $conf_err -ne 0 ]; then
diff --git a/script/detect_fortran b/script/detect_fortran
index 9508e2399..af29a20e6 100755
--- a/script/detect_fortran
+++ b/script/detect_fortran
@@ -8,8 +8,6 @@ function detect_fortran()
       return
     fi
 
-    echo -e "$1 \033[92;1m SUCCESS \033[0m"
-
     dgc_ret=1
 }
 
diff --git a/script/install_HDF5.sh b/script/install_HDF5.sh
old mode 100644
new mode 100755
diff --git a/script/pre_req b/script/pre_req
index 6890a9ce9..c7d808607 100755
--- a/script/pre_req
+++ b/script/pre_req
@@ -13,7 +13,6 @@ source script/solve_wget
 source script/solve_automake
 source script/solve_brew
 source script/solve_libtool
-source script/solve_fortran
 source script/detect_gcc
 source script/detect_osx
 source script/show_solutions
-- 
GitLab