From 00fa7082c68aa1fd11dfa37b7587b20f58ecb411 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Wed, 9 Jun 2021 12:32:45 -0600 Subject: [PATCH] Fix setup script for p4est>=2.3. --- doc/external-libs/p4est-setup.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) 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 -- 2.39.5