|
| 1 | +#!/bin/sh |
| 2 | +# |
| 3 | +# Copyright (C) 2024, Northwestern University and Argonne National Laboratory |
| 4 | +# See COPYRIGHT notice in top-level directory. |
| 5 | +# |
| 6 | + |
| 7 | +# Exit immediately if a command exits with a non-zero status. |
| 8 | +set -e |
| 9 | + |
| 10 | +# This requires one command-line option, the installation path |
| 11 | +if [ "x$1" = x ] ; then |
| 12 | + echo "Usage: $0 /pnetcdf/install/path" |
| 13 | + exit 1 |
| 14 | +fi |
| 15 | + |
| 16 | +installation_path=$1 |
| 17 | + |
| 18 | +# check if folder installation_path exists |
| 19 | +if [ ! -d $installation_path ]; then |
| 20 | + echo "Error: folder $installation_path cannot be found" |
| 21 | + exit 1 |
| 22 | +fi |
| 23 | + |
| 24 | +# remove trailing '/' character |
| 25 | +# Note on Mac OSX, realpath does not support option -s |
| 26 | +# Ideally, -s should be used to avoid expanding a symlink |
| 27 | +installation_path=$(realpath $installation_path) |
| 28 | + |
| 29 | +# check if pnetcdf_version exists in the install folder |
| 30 | +if [ ! -x $installation_path/bin/pnetcdf_version ]; then |
| 31 | + echo "Error: pnetcdf_version not found in $installation_path/bin" |
| 32 | + exit 1 |
| 33 | +fi |
| 34 | + |
| 35 | +# check if pnetcdf.pc exists in the install folder |
| 36 | +if [ ! -f $installation_path/lib/pkgconfig/pnetcdf.pc ]; then |
| 37 | + echo "Error: pnetcdf.pc not found in $installation_path/lib/pkgconfig" |
| 38 | + exit 1 |
| 39 | +fi |
| 40 | + |
| 41 | +# check if pnetcdf-config exists in the install folder |
| 42 | +if [ ! -x $installation_path/bin/pnetcdf-config ]; then |
| 43 | + echo "Error: pnetcdf-config not found in $installation_path/bin" |
| 44 | + exit 1 |
| 45 | +else |
| 46 | + # check if --prefix is correctly reflecting the install path |
| 47 | + prefixdir=`$installation_path/bin/pnetcdf-config --prefix` |
| 48 | + if [ $prefixdir != $installation_path ] ; then |
| 49 | + echo "Error: expecting '$installation_path' from 'pnetcdf-config --prefix' but got $prefixdir" |
| 50 | + exit 1 |
| 51 | + fi |
| 52 | + # check if --libdir is correctly reflecting the install path |
| 53 | + libdir=`$installation_path/bin/pnetcdf-config --libdir` |
| 54 | + if [ $libdir != $installation_path/lib ] ; then |
| 55 | + echo "Error: expecting '$installation_path/lib' from 'pnetcdf-config --libdir' but got $libdir" |
| 56 | + exit 1 |
| 57 | + fi |
| 58 | + # check if --includedir is correctly reflecting the install path |
| 59 | + incdir=`$installation_path/bin/pnetcdf-config --includedir` |
| 60 | + if [ $incdir != $installation_path/include ] ; then |
| 61 | + echo "Error: expecting '$installation_path/include' from 'pnetcdf-config --includedir' but got $incdir" |
| 62 | + exit 1 |
| 63 | + fi |
| 64 | +fi |
| 65 | + |
0 commit comments