diff --git a/configure.ac b/configure.ac
index a05f7b5372bd187118f588575346ea66717ba3a0..763adbf6551c88bf099eb05c5a5d494ff41fb7c3 100755
--- a/configure.ac
+++ b/configure.ac
@@ -108,16 +108,10 @@ IMMDX_LIB_METIS([],[echo "Cannot detect metis, use the --with-metis option if it
 IMMDX_LIB_PARMETIS([],[echo "Cannot detect parmetis, use the --with-parmetis option if it is not installed in the default location"
                     exit 203])
 
-## Check for PETSC
-
-AX_LIB_PETSC()
-
-#########
-
 ## Check for HDF5
 
 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
@@ -126,6 +120,12 @@ fi
 
 ##########
 
+## Check for PETSC
+
+AX_LIB_PETSC()
+
+#########
+
 ## Check for quadmath
 
 AC_CHECK_LIB(quadmath, sinq, [AC_DEFINE(HAVE_LIBQUADMATH,[],[Have quad math lib])