mirror of https://github.com/ecmwf/eccodes.git
124 lines
4.3 KiB
Plaintext
124 lines
4.3 KiB
Plaintext
# grib_api use template
|
|
# Author : ECMWF user Support
|
|
# Created the : Wed Apr 18 14:01:11 BST 2007
|
|
# Last modification by : ECMWF User support
|
|
# Last modification the : Tue Jun 10 10:03:51 BST 2008
|
|
|
|
|
|
|
|
|
|
######## LOCAL SETTINGS ###########
|
|
# default bit mode for this platform
|
|
NAME=grib_api
|
|
# Default mode is 32 bits except on the supercomputers
|
|
if [ "$ARCH" = "ibm_power4" ]; then
|
|
DEFAULT_MODE=64
|
|
else
|
|
DEFAULT_MODE=32
|
|
fi
|
|
|
|
PACKAGE_DIR=/usr/local/lib/metaps/lib/grib_api
|
|
|
|
if [ ! -d ${PACKAGE_DIR} ] ; then
|
|
echo "GRIB API unavailable. Directory ${PACKAGE_DIR} not present"
|
|
else
|
|
|
|
DEFAULT_VERSION=`ls -l ${PACKAGE_DIR}/current | awk '{print $NF}' | sed 's/\///'`
|
|
EXP_VERSION=`ls -l ${PACKAGE_DIR}/exp | awk '{print $NF}' | sed 's/\///'`
|
|
EMOS_VERSION=`ls -l ${PACKAGE_DIR}/emos | awk '{print $NF}' | sed 's/\///'`
|
|
NEW_VERSION=`ls -l ${PACKAGE_DIR}/new | awk '{print $NF}' | sed 's/\///'`
|
|
OLD_VERSION=`ls -l ${PACKAGE_DIR}/old | awk '{print $NF}' | sed 's/\///'`
|
|
|
|
UNDERSCORE="_"
|
|
#############################################################
|
|
# Set the version if not specified by the user
|
|
[ "${GRIB_API_VERSION:-}" != "" ] || GRIB_API_VERSION=$DEFAULT_VERSION
|
|
|
|
# Set the mode if not specified by the user
|
|
[ "${GRIB_API_MODE:-}" != "" ] || GRIB_API_MODE=$DEFAULT_MODE
|
|
[ "${noUseEcho:-}" != "" ] || noUseEcho=no
|
|
|
|
VERSION=${GRIB_API_VERSION}
|
|
|
|
if [ "$GRIB_API_MODE" != "64" ] && [ "$GRIB_API_MODE" != "32" ] ; then
|
|
/bin/ksh -p -c 'echo "GRIB_API_MODE forced to '$DEFAULT_MODE' for '$NAME' '$VERSION'" 1>&2'
|
|
GRIB_API_MODE=$DEFAULT_MODE
|
|
|
|
fi
|
|
|
|
######### DO NOT MODIFY AFTER THIS LINE ############
|
|
#
|
|
if [ "$noUseEcho" = "no" ]; then
|
|
/bin/ksh -p -c 'echo "'${NAME}' version '${VERSION}' support" 1>&2'
|
|
fi
|
|
|
|
case $VERSION in
|
|
old)
|
|
VERSION=$OLD_VERSION;;
|
|
current)
|
|
VERSION=$DEFAULT_VERSION;;
|
|
new)
|
|
VERSION=$NEW_VERSION;;
|
|
exp)
|
|
VERSION=$EXP_VERSION;;
|
|
emos)
|
|
VERSION=$EMOS_VERSION;;
|
|
esac
|
|
|
|
if [ "$GRIB_API_MODE" = "$DEFAULT_MODE" ]; then
|
|
local_mode=""
|
|
else
|
|
case $GRIB_API_MODE in
|
|
64)
|
|
local_mode="64";;
|
|
32)
|
|
local_mode="32";;
|
|
*)
|
|
/bin/ksh -p -c 'echo "Please choose either 32 bits or 64 bits mode" 1>&2';;
|
|
esac
|
|
fi
|
|
|
|
PREFIX="/usr/local/lib"
|
|
PREFIX_JASPER=$PREFIX
|
|
if [ -d $PREFIX$local_mode ]; then
|
|
PREFIX="$PREFIX$local_mode"
|
|
UNDERSCORE="$UNDERSCORE$local_mode"
|
|
local_mode=""
|
|
fi
|
|
|
|
PREFIX="$PREFIX/metaps/lib/$NAME"
|
|
|
|
GRIB_API_DIR=$PREFIX/$VERSION
|
|
JASPER_DIR="$PREFIX_JASPER/metaps/lib/$NAME/jasper"
|
|
if [ -d $GRIB_API_DIR/lib$local_mode ]
|
|
then
|
|
GRIB_API_INCLUDE="-I$GRIB_API_DIR/include$local_mode"; export GRIB_API_INCLUDE
|
|
GRIB_API_LIB="-L$GRIB_API_DIR/lib$local_mode -lgrib_api_f90 -lgrib_api"; export GRIB_API_LIB
|
|
GRIB_API_LIB_PTHREAD="-L$GRIB_API_DIR/libpthread -lgrib_api_f90 -lgrib_api -lpthread"; export GRIB_API_LIB_PTHREAD
|
|
|
|
if [ -d $JASPER_DIR$UNDERSCORE$local_mode/include ]; then
|
|
GRIB_API_LIB="$GRIB_API_LIB -L$JASPER_DIR$UNDERSCORE$local_mode/lib -ljasper"; export GRIB_API_LIB
|
|
GRIB_API_LIB_PTHREAD="$GRIB_API_LIB_PTHREAD -L$JASPER_DIR$UNDERSCORE$local_mode/lib -ljasper"; export GRIB_API_LIB_PTHREAD
|
|
GRIB_API_INCLUDE="-I$JASPER_DIR$UNDERSCORE$local_mode/include $GRIB_API_INCLUDE"; export GRIB_API_INCLUDE
|
|
else if [ -d $JASPER_DIR/include ]; then
|
|
GRIB_API_LIB="$GRIB_API_LIB -L$JASPER_DIR/lib -ljasper"; export GRIB_API_LIB
|
|
GRIB_API_LIB_PTHREAD="$GRIB_API_LIB_PTHREAD -L$JASPER_DIR/lib -ljasper"; export GRIB_API_LIB_PTHREAD
|
|
GRIB_API_INCLUDE="-I$JASPER_DIR/include $GRIB_API_INCLUDE"; export GRIB_API_INCLUDE
|
|
fi
|
|
fi
|
|
PATH=$GRIB_API_DIR/bin:$PATH
|
|
if [ "$noUseEcho" = "no" ]; then
|
|
/bin/ksh -p -c 'echo "Note that these are '$GRIB_API_MODE' bit mode versions." 1>&2'
|
|
/bin/ksh -p -c 'echo "grib_api, version '${VERSION}' enabled (GRIB_API_MODE, GRIB_API_VERSION, GRIB_API_INCLUDE, GRIB_API_LIB, GRIB_API_LIB_PTHREAD, PATH)" 1>&2'
|
|
/bin/ksh -p -c 'echo "Look at http://www.ecmwf.int/publications/manuals/grib_api/" 1>&2'
|
|
/bin/ksh -p -c 'echo "for more information." 1>&2'
|
|
fi
|
|
else
|
|
/bin/ksh -p -c 'echo "'${NAME}' '${GRIB_API_MODE}' bits version '${VERSION}' does not exist on this host" 1>&2'
|
|
/bin/ksh -p -c 'echo "The following versions are available on this platform:" 1>&2'
|
|
/bin/ksh -p -c 'echo "`/bin/ls -F '$PREFIX' | /bin/grep \/$ | /usr/bin/cut -f 1 -d / | /bin/grep "\."`" 1>&2'
|
|
|
|
fi
|
|
|
|
fi
|