From: Marc Fehling <mafehling.git@gmail.com>
Date: Wed, 9 Jun 2021 18:32:45 +0000 (-0600)
Subject: Fix setup script for p4est>=2.3.
X-Git-Tag: v9.4.0-rc1~1245^2~1
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00fa7082c68aa1fd11dfa37b7587b20f58ecb411;p=dealii.git

Fix setup script for p4est>=2.3.
---

diff --git a/doc/external-libs/p4est-setup.sh b/doc/external-libs/p4est-setup.sh
index 9bf283b265..b939491ba5 100755
--- a/doc/external-libs/p4est-setup.sh
+++ b/doc/external-libs/p4est-setup.sh
@@ -72,6 +72,11 @@ else
     fi
 fi
 
+# extract version number from file name
+VERSION=`echo $TGZ | sed 's/^p4est-\(.*\).tar.gz$/\1/g'`
+VERSION_MAJOR=`echo $VERSION | cut -d. -f1`
+VERSION_MINOR=`echo $VERSION | cut -d. -f2`
+
 # choose names for fast and debug installation directories
 INSTALL_DIR="$1"; shift
 if test -z "$INSTALL_DIR" ; then
@@ -122,8 +127,14 @@ cd "$BUILD_FAST"
 make -C sc -j 8 > make.output || bdie "Error in make sc"
 make -j 8 >> make.output || bdie "Error in make p4est"
 # ensure that we built p4est with zlib
-grep -q 'P4EST_HAVE_ZLIB *1' "$BUILD_FAST/src/p4est_config.h" \
-    || bdie "$MISSING_ZLIB_MESSAGE"
+if test "$VERSION_MAJOR" -gt 2 || \
+   ( test "$VERSION_MAJOR" -eq 2 && test "$VERSION_MINOR" -gt 2 ) ; then
+    grep -q 'P4EST_HAVE_ZLIB *1' "$BUILD_FAST/config/p4est_config.h" \
+        || bdie "$MISSING_ZLIB_MESSAGE"
+else
+    grep -q 'P4EST_HAVE_ZLIB *1' "$BUILD_FAST/src/p4est_config.h" \
+        || bdie "$MISSING_ZLIB_MESSAGE"
+fi
 make install >> make.output || bdie "Error in make install"
 echo "FAST version installed in $INSTALL_FAST"
 
@@ -139,8 +150,14 @@ cd "$BUILD_DEBUG"
 make -C sc -j 8 > make.output || bdie "Error in make sc"
 make -j 8 >> make.output || bdie "Error in make p4est"
 # ensure that we built p4est with zlib
-grep -q 'P4EST_HAVE_ZLIB *1' "$BUILD_DEBUG/src/p4est_config.h" \
-    || bdie "$MISSING_ZLIB_MESSAGE"
+if test "$VERSION_MAJOR" -gt 2 || \
+   ( test "$VERSION_MAJOR" -eq 2 && test "$VERSION_MINOR" -gt 2 ) ; then
+    grep -q 'P4EST_HAVE_ZLIB *1' "$BUILD_FAST/config/p4est_config.h" \
+        || bdie "$MISSING_ZLIB_MESSAGE"
+else
+    grep -q 'P4EST_HAVE_ZLIB *1' "$BUILD_FAST/src/p4est_config.h" \
+        || bdie "$MISSING_ZLIB_MESSAGE"
+fi
 make install >> make.output || bdie "Error in make install"
 echo "DEBUG version installed in $INSTALL_DEBUG"
 echo