Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-release improvements: remove unnecessary JASPER check, check that CRTM exists in configure script #53

Merged
merged 2 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 13 additions & 45 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ for arg ; do
esac
done

# First, check if CRTM submodule has been properly checked out; quit if not
if [ ! -f "sorc/comlibs/crtm2/src/makefile" ] ; then
echo "sorc/comlibs/crtm2/src/makefile does not exist!"
echo "If you cloned the code from github, you probably have not checked out the crtm submodule"
echo ""
echo "Try the following command to fix this issue:"
echo ""
echo "git submodule update --init --recursive --progress"
echo ""
exit 2
fi

# =============================================================================
# If NETCDF is not set, look for legacy locations:
# =============================================================================
Expand Down Expand Up @@ -331,40 +343,6 @@ else
fi
fi

# Legacy variables; accept with or without underscores
if [ ! -z "$JASPERLIB" ]; then
export JASPER_LIB=$JASPERLIB
fi
if [ ! -z "$JASPERINC" ]; then
export JASPER_INC=$JASPERINC
fi

# Find location of JASPER libs and includes (for GRIB2 support)
if [ -z "$NOGRIB2" ]; then
if [ -z "$JASPER_LIB" ] || [ -z "$JASPER_INC" ]; then
if [ -z "$JASPER" ]; then
echo "ERROR: You must define the locations of JASPER library (JASPER_LIB) and include (JASPER_INC) files"
echo " to compile UPP with GRIB2 support"
echo ""
echo " To disable GRIB2 support, set the environment variable NOGRIB2 (NOT RECOMMENDED)"
exit 1
else
export JASPER_LIB="$JASPER/lib"
export JASPER_INC="$JASPER/include"
fi
else
echo "Will use JASPER libraries in: " $JASPER_LIB
echo "Will use JASPER includes in: " $JASPER_INC
fi
if [ ! -d "$JASPER_LIB" ] || [ ! -d "$JASPER_INC" ]; then
echo "ERROR: Check your JASPER location; one or both of these paths does not exist:"
echo $JASPER_LIB
echo $JASPER_INC
exit 2
fi
fi


#
# if the uname command exists, give it a shot and see if
# we can narrow the choices; otherwise, spam 'em
Expand Down Expand Up @@ -421,8 +399,7 @@ fi
# proceed with configuration if OS is supported
srch=`grep -i "^#ARCH.*$os" sorc/arch/configure.defaults | grep -i "$mach"`
if [ -n "$srch" ] ; then
perl sorc/arch/Config.pl -jasperlib=$JASPER_LIB -jasperinc=$JASPER_INC \
-netcdf=$NETCDF -USENETCDFF=$USENETCDFF \
perl sorc/arch/Config.pl -netcdf=$NETCDF -USENETCDFF=$USENETCDFF \
-os=$os -mach=$mach \
-bindir=$BINDIR -incmod=$INCMOD -libdir=$LIBDIR \
-debug=$DEBUG -spv=$SPLIB_VERSION \
Expand Down Expand Up @@ -454,12 +431,3 @@ NCEPLIBINCESC=$(echo $NCEPLIBINCESC | sed 's|/|\\/|g') #Of course, this assumes
sed "s|CONFIGURE_NCEPLIBS_LIB|$NCEPLIBLIBESC|g" configure.upp > .configure.upp.edit
sed "s/CONFIGURE_NCEPLIBS_INC/$NCEPLIBINCESC/g" .configure.upp.edit > configure.upp

if [ ! -z "$NOGRIB2" ]; then
echo "Variable NOGRIB2 is set; compiling UPP without GRIB2 support"
echo ""
echo "WARNING WARNING WARNING"
echo " GRIB1 support for UPP will be deprecated in a future release"
echo " Compiling for GRIB2 is strongly recommended"
echo "WARNING WARNING WARNING"
echo ""
fi
54 changes: 0 additions & 54 deletions sorc/arch/Config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
$sw_netcdf_path = "" ;
$sw_usenetcdff = "" ; # for 3.6.2 and greater, the fortran bindings
# might be in a separate lib file
$sw_jasperlib_path = "" ;
$sw_jasperinc_path = "" ;
$sw_os = "ARCH" ; # ARCH will match any
$sw_mach = "ARCH" ; # ARCH will match any
$sw_fc = "\$(SFC)" ;
Expand Down Expand Up @@ -58,14 +56,6 @@
{
$sw_netcdf_path = substr( $ARGV[0], 8 ) ;
}
if ( substr( $ARGV[0], 1, 10 ) eq "jasperlib=" )
{
$sw_jasperlib_path = substr( $ARGV[0], 11 ) ;
}
if ( substr( $ARGV[0], 1, 10 ) eq "jasperinc=" )
{
$sw_jasperinc_path = substr( $ARGV[0], 11 ) ;
}
if ( substr( $ARGV[0], 1, 3 ) eq "os=" )
{
$sw_os = substr( $ARGV[0], 4 ) ;
Expand Down Expand Up @@ -133,50 +123,6 @@
shift @ARGV ;
}

#
# Check for compression libraries needed in support of GRIB2 format
# As of today unipost will not compile without these libraries
if (($sw_jasperlib_path ne '') && ($sw_jasperinc_path ne '')) {
$sw_grib2_libs= "-L$sw_jasperlib_path -lpng -lz -ljasper";
$sw_grib2_inc= "-I$sw_jasperinc_path";
print "JASPER Environment found :: GRIB2 library ::\n";
}

# Try and set these based on what we can find
else
{
# most LIUX boxes have this
$tmp1 = '/usr/lib/libjasper.a';
if (-e $tmp1) {
$sw_grib2_libs = '-L/usr/lib -ljasper -lpng12 -lpng -lz' ;
$sw_grib2_inc = '-I/usr/include -I/usr/include/jasper' ;
printf "\$JASPER_LIB or \$JASPER_INC not found in environment. Using ...\n";
}

else {
# JET has this
$tmp1 = '/opt/local/lib';
if (-e $tmp1) {
$sw_grib2_libs = '-L/opt/local/lib -ljasper -lpng -lz';
$sw_grib2_inc = '-I/opt/local/include';
printf "\$JASPER_LIB or \$JASPER_INC not found in environment. Using ...\n";
}

# Bluefire has this (AIX)
elsif (-d '/contrib/jasper') {
$sw_grib2_libs = '-L/contrib/jasper/lib -L/opt/freeware/lib -ljasper -lpng -lz';
$sw_grib2_inc = '-I/contrib/libpng/include -I/contrib/zlib/include -I/contrib/jasper/include';
printf "\$JASPER_LIB or \$JASPER_INC not found in environment. Using ...\n";
}
else {
die "FATAL ERROR: JASPER libraries not found for GRIB2.\nYou really shouldn't ever get here...." unless defined($ENV{NOGRIB2});
}
}
}
if (not defined($ENV{NOGRIB2})) {
print "grib2lib = $sw_grib2_libs\n";
print "grib2inc = $sw_grib2_inc\n";
}
# Build string of nceplib flags based off input from configure script
$nceplib_flags = "-lwrfio -lg2_v${sw_g2v}_4 -lg2tmpl_v${sw_g2tmplv} -lnemsio_d -lsigio_v${sw_sigiov}_4 -lsfcio_v${sw_sfciov}_4 -lgfsio_4 -lsp_v${sw_spv}_d -lw3nco_v${sw_w3ncov}_4 -lw3emc_v${sw_w3emcv}_4 -lbacio_4" ;

Expand Down