eccodes/use/use.grib_api

137 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 20:03:51 BST 2008
######## LOCAL SETTINGS ###########
# default bit mode for this platform
if ($?ARCH == 0) setenv ARCH `arch`
if ("$ARCH" == "ibm_power4") then
set DEFAULT_MODE=64
else
set DEFAULT_MODE=32
endif
set NAME=grib_api
set PACKAGE_DIR=/usr/local/lib/metaps/lib/grib_api/
if ( ! -d ${PACKAGE_DIR} ) then
echo "GRIB API unavailable directory ${PACKAGE_DIR} not present"
else
set DEFAULT_VERSION=`ls -l ${PACKAGE_DIR}/current | awk '{print $NF}' | sed 's/\///'`
set EXP_VERSION=`ls -l ${PACKAGE_DIR}/exp | awk '{print $NF}' | sed 's/\///'`
set NEW_VERSION=`ls -l ${PACKAGE_DIR}/new | awk '{print $NF}' | sed 's/\///'`
set OLD_VERSION=`ls -l ${PACKAGE_DIR}/old | awk '{print $NF}' | sed 's/\///'`
set EMOS_VERSION=`ls -l ${PACKAGE_DIR}/emos | awk '{print $NF}' | sed 's/\///'`
set UNDERSCORE="_"
# Define default version & default mode
if ( $?GRIB_API_VERSION == 0 ) setenv GRIB_API_VERSION $DEFAULT_VERSION
if ( $?GRIB_API_MODE == 0 ) setenv GRIB_API_MODE $DEFAULT_MODE
set 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'
setenv GRIB_API_MODE $DEFAULT_MODE
endif
if ($?noUseEcho == 0) then
/bin/ksh -p -c 'echo "'$NAME' version '$VERSION' support" 1>&2'
endif
switch ($VERSION)
case old:
set VERSION=$OLD_VERSION
breaksw
case current:
set VERSION=$DEFAULT_VERSION
breaksw
case new:
VERSION=$NEW_VERSION
breaksw
case exp:
VERSION=$EXP_VERSION
breaksw
case emos:
VERSION=$EMOS_VERSION
breaksw
endsw
if ( "$GRIB_API_MODE" == "$DEFAULT_MODE" ) then
set local_mode=""
else
if ( "$GRIB_API_MODE" == "32" ) then
set local_mode="32"
else
set local_mode="64"
endif
endif
set PREFIX=/usr/local/lib
set PREFIX_JASPER=$PREFIX
if ( -d $PREFIX$local_mode ) then
set PREFIX="$PREFIX$local_mode"
set UNDERSCORE="$UNDERSCORE$local_mode"
set local_mode=""
endif
set PREFIX="$PREFIX/metaps/lib/$NAME"
set GRIB_API_DIR=$PREFIX/$VERSION
set JASPER_DIR="$PREFIX_JASPER/metaps/lib/$NAME/jasper"
######### DO NOT MODIFY AFTER THIS LINE ############
#
#
if ( -d $GRIB_API_DIR/lib$local_mode ) then
setenv GRIB_API_INCLUDE "-I$GRIB_API_DIR/include$local_mode"
setenv GRIB_API_LIB "-L$GRIB_API_DIR/lib$local_mode -lgrib_api_f90 -lgrib_api"
setenv GRIB_API_LIB_PTHREAD "-L$GRIB_API_DIR/libthread -lgrib_api_f90 -lgrib_api -lpthread"
if ( -d $JASPER_DIR$UNDERSCORE$local_mode/include ) then
setenv GRIB_API_LIB "$GRIB_API_LIB -L$JASPER_DIR$UNDERSCORE$local_mode/lib -ljasper"
setenv GRIB_API_LIB_PTHREAD "$GRIB_API_LIB_PTHREAD -L$JASPER_DIR$UNDERSCORE$local_mode/lib -ljasper"
setenv GRIB_API_INCLUDE "-I$JASPER_DIR$UNDERSCORE$local_mode/include $GRIB_API_INCLUDE"
else
if ( -d $JASPER_DIR/include ) then
setenv GRIB_API_LIB "$GRIB_API_LIB -L$JASPER_DIR/lib -ljasper"
setenv GRIB_API_LIB_PTHREAD "$GRIB_API_LIB_PTHREAD -L$JASPER_DIR/lib -ljasper"
setenv GRIB_API_INCLUDE "-I$JASPER_DIR/include $GRIB_API_INCLUDE"
endif
endif
setenv PATH $GRIB_API_DIR/bin:$PATH
if ( $?noUseEcho == 0 ) 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'
endif
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'
endif
unset VERSION
unset NAME
unset DIRECTORY
unset DEFAULT_MODE
unset DEFAULT_VERSION
unset GRIB_API_DIR
unset PREFIX
unset PREFIX_JASPER
endif
##########################