diff --git a/Makefile b/Makefile index 6391659ea7..2bdff94d81 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ configcheck: echo "------------------------------------------------------------------------------" ; \ exit 21 ; \ fi - + framework_only : configcheck $(MAKE) MODULE_DIRS="$(ALL_MODULES)" ext @@ -154,7 +154,7 @@ wrfplus : configcheck @echo "build started: $(START_OF_COMPILE)" @echo "build completed:" `date` -all_wrfvar : +all_wrfvar : $(MAKE) MODULE_DIRS="$(DA_WRFVAR_MODULES)" ext $(MAKE) MODULE_DIRS="$(DA_WRFVAR_MODULES)" toolsdir if [ $(CRTM) -ne 0 ] ; then \ @@ -498,7 +498,7 @@ em_scm_xy : wrf ln -sf ../../run/LANDUSE.TBL . ; \ ln -sf ../../run/SOILPARM.TBL . ; \ ln -sf ../../run/VEGPARM.TBL . ; \ - ln -sf ../../run/RRTM_DATA . ) + ln -sf ../../run/RRTM_DATA . ) ( cd run ; /bin/rm -f ideal.exe ; ln -s ../main/ideal.exe . ) ( cd run ; if test -f namelist.input ; then \ /bin/cp -f namelist.input namelist.input.backup.`date +%Y-%m-%d_%H_%M_%S` ; fi ; \ @@ -529,11 +529,11 @@ convert_em : framework_only ( cd main ; $(MAKE) RLFLAGS="$(RLFLAGS)" MODULE_DIRS="$(ALL_MODULES)" convert_em ) ; \ fi -# Link wrf.exe and wrf_SST_ESMF.exe into -# test/em_esmf_exp when ESMF_COUPLING is set. wrf.exe -# can be used for stand-alone testing in this case. -# wrf_SST_ESMF.exe is a coupled application. Note that make -# target $(SOLVER)_wrf_SST_ESMF builds wrf_SST_ESMF.exe. +# Link wrf.exe and wrf_SST_ESMF.exe into +# test/em_esmf_exp when ESMF_COUPLING is set. wrf.exe +# can be used for stand-alone testing in this case. +# wrf_SST_ESMF.exe is a coupled application. Note that make +# target $(SOLVER)_wrf_SST_ESMF builds wrf_SST_ESMF.exe. em_real : wrf @/bin/rm -f real.exe > /dev/null 2>&1 @/bin/rm -f tc.exe > /dev/null 2>&1 @@ -923,31 +923,31 @@ framework : @ echo '--------------------------------------' ( cd frame ; $(MAKE) $(J) LLIST="$(LINKLIST)" framework ; \ cd ../external/io_netcdf ; \ - $(MAKE) NETCDFPATH="$(NETCDFPATH)" \ + $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR" diffwrf; \ cd ../io_netcdf ; \ - $(MAKE) NETCDFPATH="$(NETCDFPATH)" \ + $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR"; \ cd ../io_netcdfpar ; \ - $(NETCDFPAR_BUILD) $(MAKE) NETCDFPARPATH="$(NETCDFPATH)" \ + $(NETCDFPAR_BUILD) $(MAKE) NETCDFPARPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR" diffwrf; \ cd ../io_netcdfpar ; \ - $(NETCDFPAR_BUILD) $(MAKE) NETCDFPARPATH="$(NETCDFPATH)" \ + $(NETCDFPAR_BUILD) $(MAKE) NETCDFPARPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR"; \ cd ../io_pio ; \ - echo SKIPPING PIO BUILD $(MAKE) NETCDFPATH="$(PNETCDFPATH)" \ + echo SKIPPING PIO BUILD $(MAKE) NETCDFPATH="$(PNETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ @@ -964,13 +964,13 @@ framework_plus : @ echo '--------------------------------------' ( cd frame ; $(MAKE) $(J) LLIST="$(MODLL)" framework ; \ cd ../external/io_netcdf ; \ - $(MAKE) NETCDFPATH="$(NETCDFPATH)" \ + $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR" diffwrf; \ cd ../io_netcdf ; \ - $(MAKE) NETCDFPATH="$(NETCDFPATH)" \ + $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ @@ -1070,9 +1070,9 @@ fseek_test : # rule used by configure to test if this will compile with netcdf4 nc4_test: if [ -z "$(USENETCDFPAR)" ] || [ $(USENETCDFPAR) -eq 0 ] ; then \ - ( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(SCC) -o nc4_test.exe nc4_test.c -I$(NETCDF)/include -L$(NETCDF)/lib -lnetcdf $(NETCDF4_DEP_LIB) ; cd .. ) ; \ + ( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(SCC) -o nc4_test.exe nc4_test.c -I$(NETCDF_C)/include $(NETCDF4_DEP_LIB) ; cd .. ) ; \ else \ - ( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(DM_CC) -o nc4_test.exe nc4_test.c -I$(NETCDF)/include -L$(NETCDF)/lib -lnetcdf $(NETCDF4_DEP_LIB) ; cd .. ) ; \ + ( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(DM_CC) -o nc4_test.exe nc4_test.c -I$(NETCDF_C)/include $(NETCDF4_DEP_LIB) ; cd .. ) ; \ fi # rule used by configure to test if Fortran 2003 IEEE signaling is available @@ -1110,8 +1110,8 @@ toolsdir : # ( cd tools ; $(MAKE) CC_TOOLS="$(CC_TOOLS) -DIO_MASK_SIZE=$(IO_MASK_SIZE)" ) -# Use this target to build stand-alone tests of esmf_time_f90. -# Only touches external/esmf_time_f90/. +# Use this target to build stand-alone tests of esmf_time_f90. +# Only touches external/esmf_time_f90/. esmf_time_f90_only : @ echo '--------------------------------------' ( cd external/esmf_time_f90 ; $(MAKE) FC="$(FC) $(FCFLAGS)" CPP="$(CPP) -DTIME_F90_ONLY" tests ) diff --git a/arch/Config.pl b/arch/Config.pl index 385d9adeb2..761c540abe 100644 --- a/arch/Config.pl +++ b/arch/Config.pl @@ -51,7 +51,7 @@ $sw_hdf5 = "-lhdf5_hl -lhdf5"; $sw_hdf5_hl_fortran="-lhdf5_hl_fortran"; $sw_zlib = "-lz"; -$sw_dep_lib_path = ""; +$sw_netcdf4_dep_lib = ""; $sw_gpfs_path = ""; $sw_gpfs_lib = "-lgpfs"; $sw_curl_path = ""; @@ -70,10 +70,10 @@ { $sw_netcdf_path = substr( $ARGV[0], 8 ) ; } - if ( substr( $ARGV[0], 1, 13 ) eq "dep_lib_path=" ) + if ( substr( $ARGV[0], 1, 16 ) eq "netcdf4_dep_lib=" ) { - $sw_dep_lib_path = substr( $ARGV[0], 14 ) ; - $sw_dep_lib_path =~ s/\r|\n/ /g ; + $sw_netcdf4_dep_lib = substr( $ARGV[0], 17 ) ; + $sw_netcdf4_dep_lib =~ s/\r|\n/ /g ; } if ( substr( $ARGV[0], 1, 5 ) eq "gpfs=" ) { @@ -1050,7 +1050,7 @@ $_ =~ s/CONFIGURE_CONFIG_NUM/Compiler choice: $response_opt/g ; $_ =~ s/CONFIGURE_CONFIG_NEST/Nesting option: $response_nesting/g ; - $_ =~ s/CONFIGURE_DEP_LIB_PATH/$sw_dep_lib_path/g ; + $_ =~ s/CONFIGURE_NETCDF4_DEP_LIB/$sw_netcdf4_dep_lib/g ; $_ =~ s/CONFIGURE_COMMS_LIB/$sw_comms_lib/g ; if ( $sw_os ne "CYGWIN_NT" ) { @@ -1180,7 +1180,7 @@ $_ .= " " . $sw_curl_lib . "\n" ; } } - if ( $sw_dep_lib_path ne "" ) + if ( $sw_netcdf4_dep_lib ne "" ) { if (/^HDF5.*=/) { $_ =~ s/\r|\n//g; $_ .= " " . $sw_hdf5 . "\n" ; diff --git a/arch/postamble b/arch/postamble index 061fb4e0da..936f0405c8 100644 --- a/arch/postamble +++ b/arch/postamble @@ -94,15 +94,16 @@ module_dm_rsllite : ( if [ ! -e module_dm.F ] ; then /bin/cp module_dm_warning module_dm.F ; \ cat $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/module_dm.F >> module_dm.F ; fi ) -wrfio_nf : +wrfio_nf : ( cd $(WRF_SRC_ROOT_DIR)/external/io_netcdf ; \ make $(J) NETCDFPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ - CC="$(SCC)" CFLAGS="$(CFLAGS)" \ + CC="$(SCC)" CFLAGS="$(CFLAGS)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(PROMOTION) $(OMP) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) wrfio_nfpar : ( cd $(WRF_SRC_ROOT_DIR)/external/io_netcdfpar ; \ make $(J) NETCDFPARPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP) $(ARCHFLAGS)" \ + NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(FC) $(PROMOTION) $(OMP) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) wrfio_pnf : @@ -118,7 +119,7 @@ wrfio_adios2 : wrfio_grib_share : ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib_share ; \ make $(J) CC="$(SCC)" CFLAGS="$(CFLAGS)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ - FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive) + FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive) wrfio_grib1 : ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib1 ; \ @@ -132,13 +133,13 @@ wrfio_grib2 : FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="-traditional" AR="$(AR)" ARFLAGS="$(ARFLAGS)" \ FIXED="$(FORMAT_FIXED)" archive) -wrfio_int : +wrfio_int : ( cd $(WRF_SRC_ROOT_DIR)/external/io_int ; \ make $(J) CC="$(CC)" CFLAGS_LOCAL="$(CFLAGS_LOCAL)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ FC="$(FC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS) $(OMP)" FGREP="$(FGREP)" \ TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ARCHFLAGS="$(ARCHFLAGS)" all ) -esmf_time : +esmf_time : ( cd $(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 ; \ make $(J) FC="$(SFC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" RANLIB="$(RANLIB)" \ CPP="$(CPP) -I$(WRF_SRC_ROOT_DIR)/inc -I. $(ARCHFLAGS) $(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) @@ -201,12 +202,12 @@ wrfio_esmf : mv $*.f90.tmp $*.f90 ; \ fi $(FC) -o $@ -c $(FCFLAGS) $(OMP) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $*.f90 - + .F.f90: $(RM) $@ sed -e "s/^\!.*'.*//" -e "s/^ *\!.*'.*//" $*.F > $*.G - $(SED_FTN) $*.G > $*.H + $(SED_FTN) $*.G > $*.H $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.H > $@ $(RM) $*.G $*.H diff --git a/arch/preamble b/arch/preamble index ab97abbb4b..4543411e6f 100644 --- a/arch/preamble +++ b/arch/preamble @@ -94,8 +94,7 @@ GPFS = CURL = HDF5 = ZLIB = -DEP_LIB_PATH = CONFIGURE_DEP_LIB_PATH -NETCDF4_DEP_LIB = $(DEP_LIB_PATH) $(HDF5) $(ZLIB) $(GPFS) $(CURL) +NETCDF4_DEP_LIB = CONFIGURE_NETCDF4_DEP_LIB # NETCDF4INCLUDEGOESHERE diff --git a/configure b/configure index 27b01b19ce..41243e2813 100755 --- a/configure +++ b/configure @@ -50,7 +50,7 @@ if [ -n "$print_usage" ] ; then echo '-help print this message' echo '*****************************************************************************' echo ' ' - exit + exit fi if `pwd | grep ' ' > /dev/null ` ; then @@ -123,7 +123,7 @@ do else echo "$ac_t""found $ac_prog_where ($PERL)" 1>&1 fi - PERLFULLPATH=$ac_prog_where + PERLFULLPATH=$ac_prog_where else if test -z "$ac_echo_test" -a 1 = 1 ; then echo "$ac_t""no" @@ -135,16 +135,16 @@ do done if test -z "$PERL" ; then - # We have to set this outside of the loop lest the first failure in + # We have to set this outside of the loop lest the first failure in # PROGRAM_CHECK set the value (which then terminates the effect of the - # loop, since autoconf macros only set values that are null, they + # loop, since autoconf macros only set values that are null, they # don't override them PERL="" fi if test -n "$PERL" ; then PERL="$PERL" - + perlversion=`$PERL -v | grep 'This is perl' | \ sed -e 's/^.*v[a-z ]*\([0-9]\).*$/\1/'` @@ -159,8 +159,31 @@ if test -n "$PERL" ; then fi -if [ -e $NETCDF/bin/nc-config ] ; then - ncversion=`nc-config --version | awk '{print $2}'` +# We just need to find nc-config. First, check if NETCDF_C is set; if not, check +# $NETCDF/bin; otherwise, try `which nc-config`. If all that fails, warn user that WRF +# may fail to build beacuse of an incomplete NetCDF configuration. It could still be +# successfull if NetCDF was built statically because the results of `nf-config --flibs` +# should contain the necessary information for linking as long as NetCDF-Fortran is not +# version 4.5.3 (see https://github.com/Unidata/netcdf-fortran/issues/270) + +if [ -n "$NETCDF_C" ] ; then + if [ -f "$NETCDF_C/bin/nc-config" ] ; then + export NETCDF_C=$NETCDF_C + fi +elif [ -f "${NETCDF}/bin/nc-config" ] ; then + export NETCDF_C=$NETCDF +else + ans="`which nc-config`" + status="$?" + if [ "$ans" != "nc-config:" -a "$ans" != "" -a "$status" = "0" ] ; then + export NETCDF_C=`echo $ans | awk -F/ '{NF=NF-2;$NF=$NF}1' OFS=/` + else + export NETCDF_C="NOT_FOUND" + fi +fi + +if [ -e $NETCDF_C/bin/nc-config ] ; then + ncversion=`$NETCDF_C/bin/nc-config --version | awk '{print $2}'` else ncversion=OLD fi @@ -168,10 +191,10 @@ fi PROBS=FALSE if [ -n "$NETCDFPAR" ] ; then NETCDF="$NETCDFPAR" - if [ ! -e $NETCDF/bin/nc-config ] ; then + if [ ! -e $NETCDF_C/bin/nc-config ] ; then PROBS=TRUE else - ncversion=`nc-config --version | awk '{print $2}'` + ncversion=`$NETCDF_C/bin/nc-config --version | awk '{print $2}'` ncversiona=`echo $ncversion | cut -c 1` ncversionb=`echo $ncversion | cut -c 3` ncversionc=`echo $ncversion | cut -c 5` @@ -224,7 +247,7 @@ if [ -n "$NETCDF" ] ; then else USENETCDFF=" " fi - if [ -f "$NETCDF/lib/libnetcdf.a" -o -f "$NETCDF/lib/libnetcdf.so" -o -f "$NETCDF/lib/libnetcdf.dll.a" ] ; then + if [ -f "$NETCDF_C/lib/libnetcdf.a" -o -f "$NETCDF_C/lib/libnetcdf.so" -o -f "$NETCDF_C/lib/libnetcdf.dll.a" ] ; then USENETCDF="-lnetcdf" else USENETCDF=" " @@ -243,9 +266,7 @@ fi # If the user asked for classic netcdf, acquiesce to the request. -ans="`which nf-config`" -status="$?" -if [ "$ans" = "nf-config:" -o "$ans" = "" -o "$status" != "0" ] ; then +if [ ! -f "$NETCDF/bin/nf-config" ] ; then export NETCDF_classic=1 unset NETCDF4 else @@ -257,7 +278,7 @@ else export NETCDF4=1 fi else - if [ "`nf-config --has-nc4`" = "yes" ] ; then + if [ "`$NETCDF/bin/nf-config --has-nc4`" = "yes" ] ; then unset NETCDF_classic export NETCDF4=1 else @@ -274,76 +295,19 @@ if [ -z "$CURL_PATH" ] ; then CURL_PATH=''; fi if [ -n "$NETCDF4" ] ; then if [ $NETCDF4 -eq 1 ] ; then - DEP_LIB_PATH='' - if [ -f $NETCDF/bin/nf-config ] ; then - nx_config="$NETCDF/bin/nf-config --flibs" - DEP_LIB_PATH="`$nx_config | awk '{for(i=1;i<=NF;i++){if(match($i, /-L.*/)) {print $i} } }'`" - CURL="`$nx_config | awk '{for(i=1;i<=NF;i++){if($i == "-lcurl") {print $i} } }'`" - GPFS="`$nx_config | awk '{for(i=1;i<=NF;i++){if($i == "-lgpfs") {print $i} } }'`" - fi - if [ "$DEP_LIB_PATH" = '' ] ; then - if [ -f $NETCDF/bin/nc-config ] ; then - nx_config="$NETCDF/bin/nc-config --libs" - DEP_LIB_PATH="`$nx_config | awk '{for(i=1;i<=NF;i++){if(match($i, /-L.*/)) {print $i} } }'`" - CURL="`$nx_config | awk '{for(i=1;i<=NF;i++){if($i == "-lcurl") {print $i} } }'`" - GPFS="`$nx_config | awk '{for(i=1;i<=NF;i++){if($i == "-lgpfs") {print $i} } }'`" - if [ "$CURL" != '' -a "$CURL_PATH" = '' ] ; then - CURL_PATH="DEFAULT" - fi - if [ "$GPFS" != '' -a "$GPFS_PATH" = '' ] ; then - GPFS_PATH="DEFAULT" - fi - fi - fi - for P in "$HDF5_PATH" "$ZLIB_PATH" "$GPFS_PATH" "$CURL_PATH" - do - if [ "$P" != '' -a "$P" != "DEFAULT" ] ; then - if [ "${P#${P%?}}" = "/" ] ; then - P=`echo $P | sed 's/\/$//'` - fi - DEP_LIB_PATH="`echo $DEP_LIB_PATH | awk -v VAR=-L$P/lib '{for(i=1;i<=NF;i++){if ($i != VAR ) {print $i} } }'`" - DEP_LIB_PATH="$DEP_LIB_PATH -L$P/lib" - fi - done - if [ "${NETCDF#${NETCDF%?}}" = "/" ] ; then - NETCDF=`echo $NETCDF | sed 's/\/$//'` - fi - buff="`ls -l $NETCDF | sed 's/ */ /g'`" - while [ "`echo $buff | grep lib`" = "" -a "`echo $buff | grep '\->'`" != "" ] - do - buff="`echo $buff | sed -e 's/->//' -e 's/ */ /g'`" - n=`echo $buff | wc -w` - lastword=`echo "$buff" | cut -d' ' -f$n | sed 's/\/$//'` - c="`echo $lastword | cut -c1`" - if [ "$c" = "/" ] ; then - NETCDF=$lastword - else - c="`echo $lastword | cut -c1-2`" - if [ "$c" = "./" ] ; then - lastword="echo $lastword | cut -c3-" - fi - NETCDF=${NETCDF%/*}/$lastword - fi - buff="`ls -l $NETCDF | sed 's/ */ /g'`" - done - if [ "`echo $NETCDF | grep '..'`" != "" ] ; then - buff="`echo $NETCDF | sed -e 's/^\///' -e 's/\// /g'`" - n=`echo $buff | wc -w` - i=1 - while [ $i -le $n ] - do - if [ "`echo $buff | cut -d' ' -f$i`" = ".." ] ; then - m=$i - fi - i=$(( $i + 1 )) - done - m=$(( $m + 1 )) - NETCDF=/"`echo $buff | cut -d' ' -f${m}- | sed 's/ */\//g'`" - fi - if [ "${DEP_LIB_PATH#${DEP_LIB_PATH%?}}" = "/" ] ; then - DEP_LIB_PATH=`echo $DEP_LIB_PATH | sed 's/\/$//'` + NETCDF4_DEP_LIB='' + if [ "$NETCDF_C" != "NOT_FOUND" -a -f $NETCDF_C/bin/nc-config ] ; then + nx_config="`$NETCDF_C/bin/nc-config --libs`" + NETCDF4_DEP_LIB="$NETCDF4_DEP_LIB $nx_config" + else + echo ' ' + echo '*****************************************************************************' + echo 'WARNING! Unable to find nc-config. Linking with NetCDF may fail.' + echo '*****************************************************************************' + echo ' ' fi - DEP_LIB_PATH="`echo $DEP_LIB_PATH | awk -v VAR=-L$NETCDF/lib '{for(i=1;i<=NF;i++){if ($i != VAR ) {print $i} } }'`" + nx_config="`$NETCDF/bin/nf-config --flibs`" + NETCDF4_DEP_LIB="$NETCDF4_DEP_LIB $nx_config" fi fi @@ -398,12 +362,12 @@ else unset WRFPLUS_DIR fi fi -# Users who are cross-compiling can set environment variable -# $WRF_OS to override the value normally obtained from `uname`. -# If $WRF_OS is set, then $WRF_MACH can also be set to override -# the value normally obtained from `uname -m`. If $WRF_OS is -# set and $WRF_MACH is not set, then $WRF_MACH defaults to "ARCH". -# If $WRF_OS is not set then $WRF_MACH is ignored. +# Users who are cross-compiling can set environment variable +# $WRF_OS to override the value normally obtained from `uname`. +# If $WRF_OS is set, then $WRF_MACH can also be set to override +# the value normally obtained from `uname -m`. If $WRF_OS is +# set and $WRF_MACH is not set, then $WRF_MACH defaults to "ARCH". +# If $WRF_OS is not set then $WRF_MACH is ignored. if [ -n "$WRF_OS" ] ; then echo "${0}: WRF operating system set to \"${WRF_OS}\" via environment variable \$WRF_OS" os=$WRF_OS @@ -456,7 +420,7 @@ fi # the "!" is removed by Config.pl if [ -n "$WRF_HYDRO" ] ; then if [ $WRF_HYDRO = 1 ] ; then - echo building WRF-HYDRO + echo building WRF-HYDRO compileflags="${compileflags}!-DWRF_HYDRO" echo $compileflags fi @@ -517,11 +481,11 @@ if [ -n "$WRF_CHEM" ] ; then echo building WRF with chemistry option compileflags="${compileflags}!-DWRF_CHEM!-DBUILD_CHEM=1" if [ -n "$WRF_KPP" ] ; then - if [ $WRF_KPP = 1 ] ; then + if [ $WRF_KPP = 1 ] ; then echo building WRF with KPP chemistry option compileflags="${compileflags}!-DWRF_KPP" fi - fi + fi else compileflags="${compileflags} " fi @@ -575,7 +539,7 @@ if test -n "$PERL" ; then -netcdf=$NETCDF -pnetcdf=$PNETCDF -netcdfpar=$NETCDFPAR -adios2=$ADIOS2 -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \ -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF -USENETCDF=$USENETCDF \ -time=$FORTRAN_COMPILER_TIMER -tfl="$TFL" -cfl="$CFL" -config_line="$config_line" \ - -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH -dep_lib_path="$DEP_LIB_PATH" + -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH -netcdf4_dep_lib="$NETCDF4_DEP_LIB" if test ! -f configure.wrf ; then echo "configure.wrf not created! Exiting configure script..." exit 1 @@ -620,7 +584,7 @@ if test -f configure.wrf ; then if [ "$os" = "Darwin" ] ; then # fseeko64 does not exist under Darwin fseeko does. Remove the 0 length executable # file that might get generated anyway, even though the compiler complains about missing reference. - /bin/rm -f tools/fseeko64_test + /bin/rm -f tools/fseeko64_test fi if test -x tools/fseeko64_test ; then ( tools/fseeko64_test 2> /dev/null ) 1> /dev/null @@ -665,7 +629,7 @@ if test -n "$NETCDF" ; then configure_aaaa=$? ; export configure_aaaa if [ $configure_aaaa -a -z "$WRFIO_NCD_NO_LARGE_FILE_SUPPORT" ] ; then echo "NetCDF users note:" - echo " This installation of NetCDF supports large file support. To DISABLE large file" + echo " This installation of NetCDF supports large file support. To DISABLE large file" echo " support in NetCDF, set the environment variable WRFIO_NCD_NO_LARGE_FILE_SUPPORT" echo " to 1 and run configure again. Set to any other value to avoid this message." fi @@ -690,7 +654,7 @@ if [ -n "$WRFPLUS" ] ; then fi fi -#Checking cross-compiling capability for some particular environment +#Checking cross-compiling capability for some particular environment #on Linux and Mac box if [ $os = "Linux" -o $os = "Darwin" ]; then @@ -724,7 +688,7 @@ EOF rm ${foo} ${foo}.F 2> /dev/null fi -cat > ${foo}.c < ${foo}.c < ${foo}.o + ar p $NETCDF_C/lib/libnetcdf.a `ar t $NETCDF_C/lib/libnetcdf.a | grep -E '\.o' | head -n 1 | sed 's/://'` > ${foo}.o netcdf_arch="`file ${foo}.o | grep -o -E '[0-9]{2}-bit|i386'`" rm ${foo}.o - $SFC -o ${foo} ${foo}.f > /dev/null 2>&1 + $SFC -o ${foo} ${foo}.f > /dev/null 2>&1 SFC_arch="`file ${foo} | grep -o -E '[0-9]{2}-bit|i386'`" rm ${foo} ${foo}.o 2> /dev/null @@ -790,7 +754,7 @@ EOF if [ "$SFC_arch" = "" -o "$SCC_arch" = "" -o "$CCOMP_arch" = "" ]; then echo " One of compilers testing failed!" echo " Please check your compiler" - echo + echo rm -f ${foo} ${foo}.[cfo] 2> /dev/null exit else @@ -901,14 +865,14 @@ EOF echo Please check your NetCDF lib and compiler else echo -m64 is appended to configure.wrf - echo It will be forced to build in 64-bit. + echo It will be forced to build in 64-bit. echo If you don\'t want 64-bit binaries, please use 32-bit NetCDF, and re-run the configure script. fi fi ;; esac - if [ -e configure.wrf.edit ]; then + if [ -e configure.wrf.edit ]; then mv configure.wrf.edit configure.wrf fi @@ -918,10 +882,10 @@ EOF echo " Fortran compiler is $SFC_arch" echo " It will build in $netcdf_arch" echo " " - if [ -e $NETCDF/bin/nc-config ] ; then + if [ -e $NETCDF_C/bin/nc-config ] ; then echo "NetCDF version: ${ncversion}" - echo "Enabled NetCDF-4/HDF-5: `nc-config --has-nc4`" - echo "NetCDF built with PnetCDF: `nc-config --has-pnetcdf`" + echo "Enabled NetCDF-4/HDF-5: `$NETCDF_C/bin/nc-config --has-nc4`" + echo "NetCDF built with PnetCDF: `$NETCDF_C/bin/nc-config --has-pnetcdf`" if [ "$USENETCDFPAR" = "1" ] ; then echo "Using parallel NetCDF via NETCDFPAR option" fi diff --git a/share/mediation_integrate.F b/share/mediation_integrate.F index 98bc99643a..fb12f2eaed 100644 --- a/share/mediation_integrate.F +++ b/share/mediation_integrate.F @@ -1701,6 +1701,8 @@ SUBROUTINE open_hist_w ( grid , config_flags, stream, alarm_id, & ENDIF ierr = 0 + fname = "" + n2 = "" ! Note that computation of fname and n2 are outside of the oid IF statement ! since they are OUT args and may be used by callers even if oid/=0.