3 # Configuration script for WRF prototype code
5 # Be sure to run as ./configure (to avoid getting a system configure command by mistake)
9 $wrf_cmaq_option = $ENV{'WRF_CMAQ'}; # determine building WRF-CMAQ coupled model or not
11 select((select(STDOUT
), $|=1)[0]);
12 $sw_perl_path = perl
;
13 $sw_netcdf_path = "" ;
14 $sw_pnetcdf_path = "" ;
15 $sw_netcdfpar_path = "" ;
16 $sw_adios2_path = "" ;
19 $sw_jasperlib_path="";
20 $sw_jasperinc_path="";
23 $sw_ctsm_mkfile_path="";
27 $sw_rwordsize="\$\(NATIVE_RWORDSIZE\)";
32 $sw_cloudcv_flag = "" ;
34 $sw_wrfplus_path = "" ;
35 $sw_wavelet_flag = "" ;
37 $sw_os = "ARCH" ; # ARCH will match any
38 $sw_mach = "ARCH" ; # ARCH will match any
40 $sw_da_core = "-DDA_CORE=\$\(WRF_DA_CORE\)" ;
41 $sw_wrfplus_core = "-DWRFPLUS=\$\(WRF_PLUS_CORE\)" ;
42 $sw_nmm_core = "-DNMM_CORE=\$\(WRF_NMM_CORE\)" ;
43 $sw_em_core = "-DEM_CORE=\$\(WRF_EM_CORE\)" ;
45 $sw_ompparallel = "" ;
47 $sw_usenetcdff = "" ; # UNIDATA switches around library names a bit
49 $sw_time = "" ; # name of a timer to time fortran compiles, e.g. timex or time
51 $sw_hdf5 = "-lhdf5_hl -lhdf5";
52 $sw_hdf5_hl_fortran="-lhdf5_hl_fortran";
54 $sw_netcdf4_dep_lib = "";
56 $sw_gpfs_lib = "-lgpfs";
58 $sw_curl_lib = "-lcurl";
59 $sw_terrain_and_landuse = "";
62 $sw_config_line = "" ;
63 while ( substr( $ARGV[0], 0, 1 ) eq "-" )
65 if ( substr( $ARGV[0], 1, 5 ) eq "perl=" )
67 $sw_perl_path = substr( $ARGV[0], 6 ) ;
69 if ( substr( $ARGV[0], 1, 7 ) eq "netcdf=" )
71 $sw_netcdf_path = substr( $ARGV[0], 8 ) ;
73 if ( substr( $ARGV[0], 1, 16 ) eq "netcdf4_dep_lib=" )
75 $sw_netcdf4_dep_lib = substr( $ARGV[0], 17 ) ;
76 $sw_netcdf4_dep_lib =~ s/\r|\n/ /g ;
78 if ( substr( $ARGV[0], 1, 5 ) eq "gpfs=" )
80 $sw_gpfs_path = substr( $ARGV[0], 6 ) ;
81 if ( $sw_gpfs_path ne "" )
83 if ( substr( $sw_gpfs_path, -1, 1 ) eq "/" )
85 $sw_gpfs_path = substr($sw_gpfs_path, 0, length($sw_gpfs_path)-1 ) ;
89 if ( substr( $ARGV[0], 1, 5 ) eq "curl=" )
91 $sw_curl_path = substr( $ARGV[0], 6 ) ;
92 if ( $sw_curl_path ne "" )
94 if ( substr( $sw_curl_path, -1, 1 ) eq "/" )
96 $sw_curl_path = substr($sw_curl_path, 0, length($sw_curl_path)-1 ) ;
100 if ( substr( $ARGV[0], 1, 8 ) eq "pnetcdf=" )
102 $sw_pnetcdf_path = substr( $ARGV[0], 9 ) ;
104 if ( substr( $ARGV[0], 1, 10 ) eq "netcdfpar=" )
106 $sw_netcdfpar_path = substr( $ARGV[0], 11 ) ;
108 if ( substr( $ARGV[0], 1, 7 ) eq "adios2=" )
110 $sw_adios2_path = substr( $ARGV[0], 8 ) ;
112 if ( substr( $ARGV[0], 1, 5 ) eq "hdf5=" )
114 $sw_hdf5_path = substr( $ARGV[0], 6 ) ;
116 if ( substr( $ARGV[0], 1, 6 ) eq "phdf5=" )
118 $sw_phdf5_path = substr( $ARGV[0], 7 ) ;
120 if ( substr( $ARGV[0], 1, 3 ) eq "os=" )
122 $sw_os = substr( $ARGV[0], 4 ) ;
124 if ( substr( $ARGV[0], 1, 5 ) eq "mach=" )
126 $sw_mach = substr( $ARGV[0], 6 ) ;
128 if ( substr( $ARGV[0], 1, 10 ) eq "opt_level=" )
130 $sw_opt_level = substr( $ARGV[0], 11 ) ;
132 if ( substr( $ARGV[0], 1, 11 ) eq "USENETCDFF=" )
134 $sw_usenetcdff = substr( $ARGV[0], 12 ) ;
136 if ( substr( $ARGV[0], 1, 10 ) eq "USENETCDF=" )
138 $sw_usenetcdf = substr( $ARGV[0], 11 ) ;
140 if ( substr( $ARGV[0], 1, 5 ) eq "time=" )
142 $sw_time = substr( $ARGV[0], 6 ) ;
144 if ( substr( $ARGV[0], 1, 8 ) eq "ldflags=" )
146 $sw_ldflags = substr( $ARGV[0], 9 ) ;
147 # multiple options separated by spaces are passed in from sh script
148 # separated by ! instead. Replace with spaces here.
149 $sw_ldflags =~ s/!/ /g ;
151 if ( substr( $ARGV[0], 1, 9 ) eq "wrf_core=" )
153 $sw_wrf_core = substr( $ARGV[0], 10 ) ;
154 if ( index ( $sw_wrf_core , "EM_CORE" ) > -1 )
156 $sw_em_core = "-DEM_CORE=1" ;
157 $sw_da_core = "-DDA_CORE=0" ;
158 $sw_wrfplus_core = "-DWRFPLUS=0" ;
159 $sw_nmm_core = "-DNMM_CORE=0" ;
161 if ( index ( $sw_wrf_core , "WRF_PLUS_CORE" ) > -1 )
163 $sw_em_core = "-DEM_CORE=1" ;
164 $sw_da_core = "-DDA_CORE=0" ;
165 $sw_wrfplus_core = "-DWRFPLUS=1" ;
166 $sw_nmm_core = "-DNMM_CORE=0" ;
167 $sw_dfi_radar = "-DDFI_RADAR=0" ;
169 if ( index ( $sw_wrf_core , "DA_CORE" ) > -1 )
171 $sw_em_core = "-DEM_CORE=1" ;
172 $sw_da_core = "-DDA_CORE=1" ;
173 $sw_wrfplus_core = "-DWRFPLUS=0" ;
174 $sw_nmm_core = "-DNMM_CORE=0" ;
176 if ( index ( $sw_wrf_core , "4D_DA_CORE" ) > -1 )
178 $sw_em_core = "-DEM_CORE=1" ;
179 $sw_da_core = "-DDA_CORE=1" ;
180 $sw_nmm_core = "-DNMM_CORE=0" ;
182 if ( index ( $sw_wrf_core , "4D_DA_CORE" ) > -1 )
184 $sw_em_core = "-DEM_CORE=1" ;
185 $sw_da_core = "-DDA_CORE=1" ;
186 $sw_nmm_core = "-DNMM_CORE=0" ;
188 if ( index ( $sw_wrf_core , "NMM_CORE" ) > -1 )
190 $sw_em_core = "-DEM_CORE=0" ;
191 $sw_da_core = "-DDA_CORE=0" ;
192 $sw_wrfplus_core = "-DWRFPLUS=0" ;
193 $sw_nmm_core = "-DNMM_CORE=1" ;
196 if ( substr( $ARGV[0], 1, 13 ) eq "compileflags=" )
198 $sw_compileflags = substr( $ARGV[0], 14 ) ;
199 $sw_compileflags =~ s/!/ /g ;
200 # look for each known option
201 $where_index = index ( $sw_compileflags , "-DWRF_CHEM" ) ;
202 if ( $where_index eq -1 )
211 if ( substr( $ARGV[0], 1, 11 ) eq "dmparallel=" )
213 $sw_dmparallel=substr( $ARGV[0], 12 ) ;
215 if ( substr( $ARGV[0], 1, 12 ) eq "ompparallel=" )
217 $sw_ompparallel=substr( $ARGV[0], 13 ) ;
219 if ( substr( $ARGV[0], 1, 4 ) eq "tfl=" )
221 $sw_tfl=substr( $ARGV[0], 5 ) ;
223 if ( substr( $ARGV[0], 1, 4 ) eq "cfl=" )
225 $sw_cfl=substr( $ARGV[0], 5 ) ;
227 if ( substr( $ARGV[0], 1, 12 ) eq "config_line=" )
229 $sw_config_line=substr( $ARGV[0], 13 ) ;
237 $sw_comms_include = "" ;
238 $sw_dmparallelflag = "" ;
240 $sw_comms_external = "gen_comms_serial module_dm_serial" ;
243 if ( $sw_dmparallel eq "RSL_LITE" )
245 $sw_fc = "\$(DM_FC)" ;
246 $sw_cc = "\$(DM_CC)" ;
247 $sw_dmparallelflag = "-DDM_PARALLEL" ;
248 $sw_comms_lib = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a" ;
249 $sw_comms_external = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite" ;
250 $sw_comms_include = "-I\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE" ;
253 # The jasper library is required to build Grib2 I/O. User must set
254 # environment variables JASPERLIB and JASPERINC to paths to library and
255 # include files to enable this feature prior to running configure.
257 $I_really_want_to_output_grib2_from_WRF = "FALSE" ;
259 if ( $ENV{JASPERLIB
} && $ENV{JASPERINC
} && $I_really_want_to_output_grib2_from_WRF eq "TRUE" )
261 printf "Configuring to use jasper library to build Grib2 I/O...\n" ;
262 printf(" \$JASPERLIB = %s\n",$ENV{JASPERLIB
});
263 printf(" \$JASPERINC = %s\n",$ENV{JASPERINC
});
264 $sw_jasperlib_path = $ENV{JASPERLIB
};
265 $sw_jasperinc_path = $ENV{JASPERINC
};
269 if ( $ENV{JASPERLIB
} && $ENV{JASPERINC
} )
271 printf "\n\nIf you REALLY want Grib2 output from WRF, modify the arch/Config.pl script.\n" ;
272 printf "Right now you are not getting the Jasper lib, from the environment, compiled into WRF.\n\n" ;
276 printf "\$JASPERLIB or \$JASPERINC not found in environment, configuring to build without grib2 I/O...\n" ;
280 # When compiling DA and WRFPLUS code, we need to always use 8-byte reals.
281 if ( $ENV{WRF_DA_CORE
} eq "1" || $sw_da_core eq "-DDA_CORE=1" )
284 if(defined $ENV{'CRTM'})
286 if ( $ENV{CRTM
} ne "0" )
288 $sw_crtm_flag = "-DCRTM";
294 $sw_crtm_flag = "-DCRTM";
299 $sw_rttov_flag = "-DRTTOV";
300 $sw_rttov_inc = "-I$ENV{RTTOV}/include -I$ENV{RTTOV}/mod";
301 $sw_rttov_path= $ENV{RTTOV
};
303 if ( $ENV{CLOUD_CV
} )
305 $sw_cloudcv_flag = "-DCLOUD_CV";
307 if ( $sw_wrf_core eq "4D_DA_CORE" )
309 $sw_4dvar_flag = "-DVAR4D";
310 $sw_wrfplus_path= $ENV{WRFPLUS_DIR
};
314 $sw_wavelet_flag = "-DWAVELET";
318 $sw_rwordsize = "8" if ( $sw_wrfplus_core eq "-DWRFPLUS=1" );
320 # A separately-installed ESMF library is required to build the ESMF
321 # implementation of WRF IOAPI in external/io_esmf. This is needed
322 # to couple WRF with other ESMF components. User must set environment
323 # variables ESMFLIB and ESMFINC to paths ESMF to library and include
324 # files to enable this feature prior to running configure.
325 if ( $ENV{ESMFLIB
} && $ENV{ESMFINC
} )
327 printf "Configuring to use ESMF library to build WRF...\n" ;
328 printf "WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING\n" ;
329 printf "WARNING: THIS IS AN EXPERIMENTAL CONFIGURATION\n" ;
330 printf "WARNING: IT DOES NOT WORK WITH NESTING\n" ;
331 printf "WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING\n" ;
332 printf(" \$ESMFLIB = %s\n",$ENV{ESMFLIB
});
333 printf(" \$ESMFINC = %s\n",$ENV{ESMFINC
});
334 $sw_esmflib_path = $ENV{ESMFLIB
};
335 $sw_esmfinc_path = $ENV{ESMFINC
};
336 $sw_esmf_ldflag = "yes" ;
339 # A separately-installed CTSM library and its dependencies are required
340 # to build WRF with the CTSM land surface model (the next generation of
341 # the CLM model, coupled via LILAC). The user must set the environment
342 # variable WRF_CTSM_MKFILE, which should be a path to a make-formatted
343 # file containing settings of CTSM_INCLUDES and CTSM_LIBS. When this
344 # environment variable is set, this also triggers adding -DWRF_USE_CTSM;
345 # when this env var is not set, then we instead use -DWRF_USE_CLM, which
346 # builds an old version of CLM that is included in the WRF source code.
347 # (We currently cannot build with both at once because of namespace
348 # collisions at link time.)
349 if ( $ENV{WRF_CTSM_MKFILE
} ) {
350 $sw_ctsm_mkfile_path = $ENV{WRF_CTSM_MKFILE
};
353 if ( $sw_hdf5_path ) {
354 opendir(my $dh, "$sw_hdf5_path/lib");
355 ($hl) = grep(/hdf5hl_fortran/i, readdir $dh);
358 $sw_hdf5_hl_fortran="-lhdf5hl_fortran";
362 # parse the configure.wrf file
366 if ( ($sw_wrf_core eq "WRF_PLUS_CORE") || ($sw_wrf_core eq "4D_DA_CORE") )
367 { @platforms = qw
( serial dmpar
) ; }
369 { @platforms = qw
( serial smpar dmpar dm
+sm
) ; }
371 # Display the choices to the user and get selection
372 until ( $validresponse ) {
373 printf "------------------------------------------------------------------------\n" ;
374 printf "Please select from among the following $sw_os $sw_mach options:\n\n" ;
378 open CONFIGURE_DEFAULTS
, "< ./arch/configure.defaults"
379 or die "Cannot open ./arch/configure.defaults for reading" ;
380 while ( <CONFIGURE_DEFAULTS
> ) {
384 # Look for our platform in the configuration option header.
385 # If we're going to list it, print parallelism options
386 if ( substr( $currline, 0, 5 ) eq "#ARCH" && ( index( $currline, $sw_os ) >= 0 )
387 && ( index( $currline, $sw_mach ) >= 0 ) ) {
388 $optstr = substr($currline,6) ;
390 foreach ( @platforms ) { # Check which parallelism options are valid for this configuration option
392 if ( index($optstr, $paropt) >= 0 ) { #If parallelism option is valid, print and assign number
393 printf "%3d. (%s) ",$opt,$paropt ;
394 $pararray[$opt] = $paropt ;
396 $opttemp =~ s/#.*$//g ;
398 $optarray[$opt] = $opttemp." (".$paropt.")" ;
400 } else { #If parallelism option is not valid, print spaces for formatting/readability
402 printf " %s ",$paropt ;
408 next unless ( length $optstr ) ; # Don't read option lines unless it's valid for our platform
410 if ( substr( $currline, 0, 11 ) eq "DESCRIPTION" ) {
411 $optstr = $currline ; #Initial value of $optstr is DESCRIPTION line
415 if ( substr( $currline, 0, 3 ) eq "SFC" ) {
416 $currline =~ s/^SFC\s*=\s*//g; #remove "SFC ="
417 $currline =~ s/ (\-\S*)*$//g; #remove trailing arguments and/or spaces
418 $optstr =~ s/\$SFC/$currline/g; #Substitute the fortran compiler name into optstr
419 $optstr =~ s/DESCRIPTION\s*=\s*//g; #Remove "DESCRIPTION ="
423 if ( substr( $currline, 0, 3 ) eq "SCC" ) {
424 $currline =~ s/^SCC\s*=\s*//g; #remove "SCC ="
425 $currline =~ s/ (\-\S*)*$//g; #remove trailing arguments and/or spaces
426 $optstr =~ s/\$SCC/$currline/g; #Substitute the C compiler name into optstr
430 if ( substr( $currline, 0, 4 ) eq "####" ) { #reached the end of this option's entry
432 printf " %s\n",$optstr ;
438 close CONFIGURE_DEFAULTS
;
442 printf "\nEnter selection [%d-%d] : ",1,$opt ;
443 $response = <STDIN
> ;
445 if ( $response == -1 ) { exit ; }
447 if ( $response >= 1 && $response <= $opt )
448 { $validresponse = 1 ; }
450 { printf("\nInvalid response (%d)\n",$response);}
451 $response_opt = $response ;
454 printf "------------------------------------------------------------------------\n" ;
456 $optchoice = $response ;
457 if ( $response == 2 || $response == 3 ) {
458 if ( $ENV{'TERRAIN_AND_LANDUSE'} eq "1" && index($sw_wrf_core, "EM_CORE") > -1 ) {
459 $sw_terrain_and_landuse =" -DTERRAIN_AND_LANDUSE" ;
461 $sw_terrain_and_landuse =" -DLANDREAD_STUB=1" ;
464 $sw_terrain_and_landuse =" -DLANDREAD_STUB=1" ;
467 open CONFIGURE_DEFAULTS
, "cat ./arch/configure.defaults |" ;
469 while ( <CONFIGURE_DEFAULTS
> )
471 if ( $_ =~ /ifort compiler/ )
472 { $lioapi_temp = 'Linux2_x86_64ifort';
474 elsif ( $_ =~ /PGI compiler/ )
475 { $lioapi_temp = 'Linux2_x86_64pg';
477 elsif ( $_ =~ /gfortran compiler/ )
478 { $lioapi_temp = 'Linux2_x86_64gfort';
481 if ( substr( $_, 0, 5 ) eq "#ARCH" && $latchon == 1 )
483 close CONFIGURE_DEFAULTS
;
484 if ( $sw_opt_level eq "-f" ) {
486 # determine whether variable EM_MODULE_DIR contains -I../cmaq or not
487 my $file = "Makefile";
488 open(FH
, $file) or die("File $file not found");
490 $lib_path_wo_cmaq = 1;
491 while ( my $String = <FH
> )
492 { if($String =~ /-I..\/dyn_em
-I
..\
/cmaq/)
493 { $lib_path_wo_cmaq = 0;
498 # determine whether declarations in Registry/registry.CMAQ is commented out or not
499 my $file = "Registry/registry.CMAQ";
500 open (FH
, $file) or die("File $file not found");
502 $registry_wo_cmaq = 0;
503 while ( my $String = <FH
> )
504 { if($String =~ /#state/)
505 { $registry_wo_cmaq = 1;
510 # determine whether express #NOWIN LIB_BUNDLED contains $(IOAPI_LIB) or not
511 my $file = "arch/preamble";
512 open (FH
, $file) or die("File $file not found");
514 $bundle_wo_ioapi = 1;
515 while ( my $String = <FH
> )
516 { if ( $String =~ /IOAPI_LIB/ )
517 { $bundle_wo_ioapi = 0;
522 if ( $wrf_cmaq_option eq 1 ) # build WRF-CMAQ coupled model
523 { if ( $lib_path_wo_cmaq == 1 )
524 { open (FILE
, "<Makefile") || die "File not found";
529 { $_ =~ s/ -I..\/dyn_em/ -I
..\
/dyn_em -I..\/cmaq
/g
;
532 open (FILE
, ">Makefile") || die "File not found";
537 if ( $registry_wo_cmaq == 1 )
538 { open (FILE
, "<Registry/registry.CMAQ") || die "File not found";
543 { $_ =~ s/#state/state/g;
546 open (FILE
, ">Registry/registry.CMAQ") || die "File not found";
551 if ( $bundle_wo_ioapi == 1 )
552 { open (FILE
, "<arch/preamble") || die "File not found";
557 { $_ =~ s/#NOWIN LIB_BUNDLED = \\/#NOWIN LIB_BUNDLED = \$(IOAPI_LIB) \\/g;
560 open (FILE
, ">arch/preamble") || die "File not found";
565 open (FH
, '>', wrf_cmaq_path
) or die $! ;
566 $ioapi_path = $ENV{'IOAPI'} ;
567 print FH
"CMAQLIB = libcmaqlib.a \n" ;
568 print FH
"IOAPI = $ioapi_path\n" ;
569 print FH
"LIOAPI = $lioapi\n" ;
570 print FH
"IOAPI_LIB = -L$ioapi_path/$lioapi -lioapi \n" ;
572 open CONFIGURE_DEFAULTS
, "cat wrf_cmaq_path ./arch/postamble ./arch/noopt_exceptions_f |" or die "horribly" ;
575 { if ( $lib_path_wo_cmaq == 0 )
576 { open (FILE
, "<Makefile") || die "File not found";
581 { $_ =~ s/ -I..\/cmaq//g
;
584 open (FILE
, ">Makefile") || die "File not found";
590 if ( $registry_wo_cmaq == 0 )
591 { open (FILE
, "<Registry/registry.CMAQ") || die "File not found";
596 { $_ =~ s/state/#state/g;
599 open (FILE
, ">Registry/registry.CMAQ") || die "File not found";
604 if ( $bundle_wo_ioapi == 0 )
605 { open (FILE
, "<arch/preamble") || die "File not found";
610 { $_ =~ s/ \$\(IOAPI_LIB\)//g;
613 open (FILE
, ">arch/preamble") || die "File not found";
618 open CONFIGURE_DEFAULTS
, "cat ./arch/postamble ./arch/noopt_exceptions_f |" or die "horribly" ;
621 open CONFIGURE_DEFAULTS
, "cat ./arch/postamble ./arch/noopt_exceptions |" or die "horribly" ;
624 $_ =~ s
:CONFIGURE_NMM_CORE
:$sw_nmm_core:g
;
627 $_ =~ s/CONFIGURE_PERL_PATH/$sw_perl_path/g ;
628 $_ =~ s/CONFIGURE_NETCDF_PATH/$sw_netcdf_path/g ;
629 $_ =~ s/CONFIGURE_PNETCDF_PATH/$sw_pnetcdf_path/g ;
630 $_ =~ s/CONFIGURE_NETCDFPAR_PATH/$sw_netcdfpar_path/g ;
631 $_ =~ s/CONFIGURE_ADIOS2_PATH/$sw_adios2_path/g ;
632 $_ =~ s/CONFIGURE_HDF5_PATH/$sw_hdf5_path/g ;
633 $_ =~ s/CONFIGURE_PHDF5_PATH/$sw_phdf5_path/g ;
634 $_ =~ s/CONFIGURE_LDFLAGS/$sw_ldflags/g ;
635 $_ =~ s/CONFIGURE_COMPILEFLAGS/$sw_compileflags/g ;
636 $_ =~ s/CONFIGURE_RWORDSIZE/$sw_rwordsize/g ;
637 $_ =~ s/CONFIGURE_FC/$sw_time $sw_fc/g ;
638 $_ =~ s/CONFIGURE_CC/$sw_cc/g ;
639 $_ =~ s/CONFIGURE_COMMS_LIB/$sw_comms_lib/g ;
640 $_ =~ s/CONFIGURE_COMMS_INCLUDE/$sw_comms_include/g ;
641 $_ =~ s/CONFIGURE_COMMS_EXTERNAL/$sw_comms_external/g ;
642 if ( $sw_os ne "CYGWIN_NT" ) {
645 $_ =~ s/CONFIGURE_DMPARALLEL/$sw_dmparallelflag/g ;
646 $_ =~ s/CONFIGURE_STUBMPI/$sw_stubmpi/g ;
647 $_ =~ s/CONFIGURE_NESTOPT/$sw_nest_opt/g ;
648 $_ =~ s/CONFIGURE_TRADFLAG/$sw_tfl/g ;
649 $_ =~ s/CONFIGURE_CPPFLAGS/$sw_cfl/g ;
650 $_ =~ s/CONFIGURE_4DVAR_FLAG/$sw_4dvar_flag/g ;
651 $_ =~ s/CONFIGURE_WRFPLUS_PATH/$sw_wrfplus_path/g ;
652 $_ =~ s/CONFIGURE_CRTM_FLAG/$sw_crtm_flag/g ;
653 $_ =~ s/CONFIGURE_RTTOV_FLAG/$sw_rttov_flag/g ;
654 $_ =~ s/CONFIGURE_RTTOV_INC/$sw_rttov_inc/g ;
655 $_ =~ s/CONFIGURE_RTTOV_PATH/$sw_rttov_path/g ;
656 $_ =~ s/CONFIGURE_CLOUDCV_FLAG/$sw_cloudcv_flag/g ;
657 $_ =~ s/CONFIGURE_WAVELET_FLAG/$sw_wavelet_flag/g ;
658 if ( $sw_ifort_r8 ) {
659 $_ =~ s/^PROMOTION.*=/PROMOTION = -r8 /g ;
661 if ( $sw_dmparallel ne "" && ($_ =~ /^DMPARALLEL[=\t ]/) ) {
664 if ( $sw_ompparallel ne "" && ( $_ =~ /^OMPCPP[=\t ]/ || $_ =~ /^OMPCC[=\t ]/ || $_ =~ /^OMP[=\t ]/ ) ) {
670 # put netcdfpar ahead of netcdf so that part of the name does not get clobbered
671 if ( $sw_netcdfpar_path )
672 { $_ =~ s/CONFIGURE_WRFIO_NFPAR/wrfio_nfpar/g ;
673 $_ =~ s
:CONFIGURE_NETCDFPAR_FLAG
:-DNETCDFPAR
: ;
674 $_ =~ s
:CONFIGURE_NETCDFPAR_BUILD
:: ;
675 if ( $ENV{NETCDFPAR_LDFLAGS
} ) {
676 $_ =~ s
:CONFIGURE_NETCDFPAR_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdfpar
/libwrfio_nfpar
.a
$ENV{NETCDFPAR_LDFLAGS
} : ;
677 } elsif ( $sw_os eq "Interix" ) {
678 $_ =~ s
:CONFIGURE_NETCDFPAR_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdfpar
/libwrfio_nfpar.a -L$sw_netcdfpar_path/lib
$sw_usenetcdff $sw_usenetcdf : ;
680 $_ =~ s
:CONFIGURE_NETCDFPAR_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdfpar
-lwrfio_nfpar
-L
$sw_netcdfpar_path/lib
$sw_usenetcdff $sw_usenetcdf : ;
684 { $_ =~ s/CONFIGURE_WRFIO_NFPAR//g ;
685 $_ =~ s
:CONFIGURE_NETCDFPAR_FLAG
::g
;
686 $_ =~ s
:CONFIGURE_NETCDFPAR_BUILD
:echo SKIPPING
: ;
687 $_ =~ s
:CONFIGURE_NETCDFPAR_LIB_PATH
::g
;
690 if ( $sw_netcdf_path )
691 { $_ =~ s/CONFIGURE_WRFIO_NF/wrfio_nf/g ;
692 $_ =~ s
:CONFIGURE_NETCDF_FLAG
:-DNETCDF
: ;
693 if ( $ENV{NETCDF_LDFLAGS
} ) {
694 $_ =~ s
:CONFIGURE_NETCDF_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdf
/libwrfio_nf
.a
$ENV{NETCDF_LDFLAGS
} : ;
695 } elsif ( $sw_os eq "Interix" ) {
696 $_ =~ s
:CONFIGURE_NETCDF_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdf
/libwrfio_nf.a -L$sw_netcdf_path/lib
$sw_usenetcdff $sw_usenetcdf : ;
698 $_ =~ s
:CONFIGURE_NETCDF_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdf
-lwrfio_nf
-L
$sw_netcdf_path/lib
$sw_usenetcdff $sw_usenetcdf : ;
702 { $_ =~ s/CONFIGURE_WRFIO_NF//g ;
703 $_ =~ s
:CONFIGURE_NETCDF_FLAG
::g
;
704 $_ =~ s
:CONFIGURE_NETCDF_LIB_PATH
::g
;
707 if ( $sw_pnetcdf_path )
708 { $_ =~ s/CONFIGURE_WRFIO_PNF/wrfio_pnf/g ;
709 $_ =~ s
:CONFIGURE_PNETCDF_FLAG
:-DPNETCDF
: ;
710 if ( $sw_os eq "Interix" ) {
711 $_ =~ s
:CONFIGURE_PNETCDF_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_pnetcdf
/libwrfio_pnf.a -L$sw_pnetcdf_path/lib
-lpnetcdf
: ;
713 $_ =~ s
:CONFIGURE_PNETCDF_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_pnetcdf
-lwrfio_pnf
-L
$sw_pnetcdf_path/lib
-lpnetcdf
: ;
717 { $_ =~ s/CONFIGURE_WRFIO_PNF//g ;
718 $_ =~ s
:CONFIGURE_PNETCDF_FLAG
::g
;
719 $_ =~ s
:CONFIGURE_PNETCDF_LIB_PATH
::g
;
722 if ( $sw_adios2_path )
723 { $_ =~ s/CONFIGURE_WRFIO_ADIOS2/wrfio_adios2/g ;
724 $_ =~ s
:CONFIGURE_ADIOS2_FLAG
:-DADIOS2
: ;
725 if ( -d
"$sw_adios2_path/lib" )
727 $adios2_libdir = "$sw_adios2_path/lib" ;
729 elsif ( -d
"$sw_adios2_path/lib64" )
731 $adios2_libdir = "$sw_adios2_path/lib64" ;
735 die "ADIOS2 environment variable was set, but neither $sw_adios2_path/lib nor $sw_adios2_path/lib64 were found." ;
737 $_ =~ s
:CONFIGURE_ADIOS2_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_adios
2 -lwrfio_adios2
-L
$adios2_libdir -ladios2_fortran_mpi
-ladios2_fortran
:;
740 { $_ =~ s/CONFIGURE_WRFIO_ADIOS2//g ;
741 $_ =~ s
:CONFIGURE_ADIOS2_FLAG
::g
;
742 $_ =~ s
:CONFIGURE_ADIOS2_LIB_PATH
::g
;
746 { $_ =~ s
:CONFIGURE_HDF5_LIB_PATH
:-L
$sw_hdf5_path/lib
$sw_hdf5_hl_fortran -lhdf5_hl
-lhdf5_fortran
-lhdf5
-lm
-lz
: ;
747 $_ =~ s
:CONFIGURE_HDF5_FLAG
:-DHDF5
: ;
750 { $_ =~ s
:CONFIGURE_HDF5_LIB_PATH
::g
;
751 $_ =~ s
:CONFIGURE_HDF5_FLAG
::g
;
754 if ( $sw_phdf5_path )
756 { $_ =~ s/CONFIGURE_WRFIO_PHDF5/wrfio_phdf5/g ;
757 $_ =~ s
:CONFIGURE_PHDF5_FLAG
:-DPHDF5
: ;
758 $_ =~ s
:CONFIGURE_PHDF5_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_phdf
5 -lwrfio_phdf5
-L
$sw_phdf5_path/lib -lhdf5_fortran -lhdf5 -lm -lz -L$sw_phdf5_path/lib
-lsz
: ;
761 { $_ =~ s/CONFIGURE_WRFIO_PHDF5//g ;
762 $_ =~ s
:CONFIGURE_PHDF5_FLAG
::g
;
763 $_ =~ s
:CONFIGURE_PHDF5_LIB_PATH
::g
;
766 if ( $sw_jasperlib_path && $sw_jasperinc_path )
767 { $_ =~ s/CONFIGURE_WRFIO_GRIB2/wrfio_grib2/g ;
768 $_ =~ s
:CONFIGURE_GRIB2_FLAG
:-DGRIB2
:g
;
769 $_ =~ s
:CONFIGURE_GRIB2_INC
:-I
$sw_jasperinc_path:g
;
770 $_ =~ s
:CONFIGURE_GRIB2_LIB
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_grib
2 -lio_grib2
-L
$sw_jasperlib_path -ljasper
:g
;
773 { $_ =~ s/CONFIGURE_WRFIO_GRIB2//g ;
774 $_ =~ s
:CONFIGURE_GRIB2_FLAG
::g
;
775 $_ =~ s
:CONFIGURE_GRIB2_INC
::g
;
776 $_ =~ s
:CONFIGURE_GRIB2_LIB
::g
;
779 if ( $sw_terrain_and_landuse )
781 $_ =~ s/CONFIGURE_TERRAIN_AND_LANDUSE/$sw_terrain_and_landuse/g;
785 $_ =~ s
:CONFIGURE_TERRAIN_AND_LANDUSE
:-DLANDREAD_STUB
=1:g
;
788 # ESMF substitutions in configure.defaults
789 if ( $sw_esmflib_path && $sw_esmfinc_path )
791 $_ =~ s
:CONFIGURE_ESMF_FLAG
:-DESMFIO
:g
;
793 # $_ =~ s:ESMFIOLIB:-L$sw_esmflib_path -lesmf -L\$\(WRF_SRC_ROOT_DIR\)/external/io_esmf -lwrfio_esmf \$\(ESMF_LIB_FLAGS\):g ;
794 # $_ =~ s:ESMFIOEXTLIB:-L$sw_esmflib_path -lesmf -L\$\(WRF_SRC_ROOT_DIR\)/external/io_esmf -lwrfio_esmf \$\(ESMF_LIB_FLAGS\):g ;
796 $_ =~ s
:ESMFIOLIB
:\
$\
(ESMF_F90LINKPATHS\
) \
$\
(ESMF_F90ESMFLINKLIBS\
) -L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_esmf
-lwrfio_esmf
: ;
797 $_ =~ s
:ESMFIOEXTLIB
:\
$\
(ESMF_IO_LIB\
): ;
800 $_ =~ s
:ESMFLIBFLAG
:\
$\
(ESMF_LDFLAG\
):g
;
801 # $_ =~ s:ESMFINCLUDEGOESHERE:'include $(ESMFLIB)/esmf.mk': ;
806 $_ =~ s
:CONFIGURE_ESMF_FLAG
::g
;
807 $_ =~ s
:ESMFLIBFLAG
::g
;
808 if ( $sw_os eq "Interix" ) {
809 $_ =~ s
:ESMFIOLIB
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/esmf_time_f90
/libesmf_time
.a
:g
;
810 $_ =~ s
:ESMFIOEXTLIB
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/esmf_time_f90
/libesmf_time
.a
:g
;
812 $_ =~ s
:ESMFIOLIB
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/esmf_time_f90
-lesmf_time
:g
;
813 $_ =~ s
:ESMFIOEXTLIB
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/esmf_time_f90
-lesmf_time
:g
;
817 # CTSM substitutions in configure.defaults and postamble
818 if ( $sw_ctsm_mkfile_path ) {
819 $_ =~ s
:CONFIGURE_D_CTSM
:-DWRF_USE_CTSM
:g
;
820 $_ =~ s
:CONFIGURE_CTSM_INC
:\
$\
(CTSM_INCLUDES\
):g
;
821 $_ =~ s
:CONFIGURE_CTSM_LIB
:\
$\
(CTSM_LIBS\
):g
;
824 $_ =~ s
:CONFIGURE_D_CTSM
:-DWRF_USE_CLM
:g
;
825 $_ =~ s
:CONFIGURE_CTSM_INC
::g
;
826 $_ =~ s
:CONFIGURE_CTSM_LIB
::g
;
831 $_ =~ s
:CONFIGURE_ATMOCN_LIB
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/atm_ocn
-latm_ocn
:g
;
832 $_ =~ s
:CONFIGURE_ATMOCN_INC
:-I\
$\
(WRF_SRC_ROOT_DIR\
)/external/atm_ocn
:g
;
833 $_ =~ s/CONFIGURE_ATMOCN/atm_ocn/g ;
837 $_ =~ s
:CONFIGURE_ATMOCN_LIB
::g
;
838 $_ =~ s/CONFIGURE_ATMOCN//g ;
839 $_ =~ s
:CONFIGURE_ATMOCN_INC
::g
;
842 { if ( $ENV{NETCDF4
} eq "1" )
844 if ( /(^ARCH_LOCAL.*=|^TRADFLAG.*=)/ )
846 $_ .= " \$\(NETCDF4_IO_OPTS\)\n" ;
849 { $_ =~ s/(\\?)[\r\n]/ \$\(NETCDF4_DEP_LIB\)\1\n/g ;
854 if ( ! (substr( $_, 0, 5 ) eq "#ARCH") ) { @machopts = ( @machopts, $_ ) ; }
855 if ( substr( $_, 0, 10 ) eq "ENVCOMPDEF" )
857 @machopts = ( @machopts, "WRF_CHEM\t=\t$WRFCHEM \n" ) ;
862 # 0 = no nesting (only selectable for serial and smpar)
863 # 1 = basic nesting (serial and smpar compile with RSL_LITE and STUBMPI; dmpar and dm+sm use RSL_LITE and MPI)
864 # 2 = nesting with prescribed moves (add -DMOVE_NESTS to ARCHFLAGS)
865 # 3 = nesting with prescribed moves (add -DMOVE_NESTS and -DVORTEX_CENTER to ARCHFLAGS)
867 for $paropt ( @platforms )
869 if ( substr( $_, 0, 5 ) eq "#ARCH" && $latchon == 0
870 && ( index( $_, $sw_os ) >= 0 ) && ( index( $_, $sw_mach ) >= 0 )
871 && ( index($_, $paropt) >= 0 ) )
873 # We are cycling through the configure.defaults file again.
874 # This bit tries to match the line corresponding to the option we previously selected.
878 $x = $x." (".$paropt.")" ;
879 if ( $x eq $optarray[$optchoice] )
882 if($ENV{WRF_HYDRO
} eq 1) {
883 $tt = `cd hydro; ./wrf_hydro_config "$x" "$paropt"`;
887 $sw_ompparallel = "" ;
888 $sw_dmparallel = "" ;
890 #only allow parallel netcdf if the user has chosen parallel option
891 if ( $paropt ne 'dmpar' && $paropt ne 'dm+sm' ) { $sw_pnetcdf_path = "" ; }
893 until ( $validresponse ) {
894 if ( $ENV{WRF_DA_CORE
} eq "1" || $sw_da_core eq "-DDA_CORE=1" ) {
896 } elsif ( $sw_wrfplus_core eq "-DWRFPLUS=1" ) {
898 } elsif ( $ENV{HWRF
} ) {
899 printf "HWRF requires moving nests";
902 if ( $paropt eq 'serial' || $paropt eq 'smpar' ) {
903 printf "Compile for nesting? (0=no nesting, 1=basic, 2=preset moves, 3=vortex following) [default 0]: " ;
904 } elsif ( $ENV{WRF_NMM_CORE
} eq "1" ) {
905 printf "Compile for nesting? (1=basic, 2=preset moves) [default 1]: " ;
907 printf "Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: " ;
909 $response = <STDIN
> ;
910 $lioapi = $lioapi_temp;
915 if ( $response == "" || ($response >= 0 && $response <= 3) )
916 { $validresponse = 1 ; }
918 { printf("\nInvalid response (%d)\n",$response);}
920 if ( $response == "" ) {
921 if ( ( $paropt eq 'serial' || $paropt eq 'smpar' ) ) { $response = 0 ; }
922 else { $response = 1 ; }
924 if ( $response == 0 ) {
925 if ( ! ( $paropt eq 'serial' || $paropt eq 'smpar' ) ) { $response = 1 ; }
927 $response_nesting = $response ;
928 if ( ( $response == 1 ) || ( $response == 2 ) || ( $response == 3 ) ) {
929 if ( ( $paropt eq 'serial' || $paropt eq 'smpar' ) ) { # nesting without MPI
930 $sw_stubmpi = "-DSTUBMPI" ;
931 if ( $sw_os ne "CYGWIN_NT" ) {
932 $sw_comms_lib = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a" ;
934 $sw_comms_lib = "../external/RSL_LITE/librsl_lite.a" ;
936 $sw_comms_external = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite" ;
937 $sw_dmparallel = "RSL_LITE" ;
938 $sw_dmparallelflag = "-DDM_PARALLEL" ;
941 if ( $response == 2 ) {
942 $sw_nest_opt = "-DMOVE_NESTS" ;
943 if ( $ENV{'TERRAIN_AND_LANDUSE'} eq "1" ) {
944 $sw_terrain_and_landuse =" -DTERRAIN_AND_LANDUSE" ;
945 $sw_nest_opt = $sw_nest_opt . $sw_terrain_and_landuse;
947 } elsif ( $response == 3 ) {
948 $sw_nest_opt = "-DMOVE_NESTS -DVORTEX_CENTER" ;
949 if ( $ENV{'TERRAIN_AND_LANDUSE'} eq "1" ) {
950 $sw_terrain_and_landuse =" -DTERRAIN_AND_LANDUSE" ;
951 $sw_nest_opt = $sw_nest_opt . $sw_terrain_and_landuse;
954 if ( $paropt eq 'smpar' || $paropt eq 'dm+sm' ) { $sw_ompparallel = "OMP" ; }
955 if ( $paropt eq 'dmpar' || $paropt eq 'dm+sm' ) {
956 if ( $sw_os ne "CYGWIN_NT" ) {
957 $sw_comms_lib = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a" ;
958 if ( $sw_wrf_core eq "4D_DA_CORE" )
960 $sw_comms_lib = "\$(WRFPLUS_DIR)/external/RSL_LITE/librsl_lite.a" ;
963 $sw_comms_lib = "../external/RSL_LITE/librsl_lite.a" ;
965 $sw_comms_external = "\$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite" ;
966 $sw_dmparallel = "RSL_LITE" ;
967 $sw_dmparallelflag = "-DDM_PARALLEL" ;
968 $sw_fc = "\$(DM_FC)" ;
969 $sw_cc = "\$(DM_CC)" ;
970 } # only one option in v3.0
973 if ( index ( $x, "ifort" ) > -1 || index ( $x, "intel compiler" ) > -1 ) {
974 if ( $sw_rwordsize == 8 ) {
983 if ($latchon == 0) { # Never hurts to check that we actually found the option again.
984 unlink "configure.wrf";
985 print "\nERROR ERROR ERROR ERROR\n\n";
986 print "SOMETHING TERRIBLE HAS HAPPENED: configure.wrf not created correctly.\n";
987 print 'Check "$x" and "$optarray[$optchoice]"';
988 die "\n\nERROR ERROR ERROR ERROR\n\n";
991 close CONFIGURE_DEFAULTS
;
993 close ARCH_NOOPT_EXCEPTIONS
;
995 if ( $wrf_cmaq_option eq 1 )
996 { unlink "wrf_cmaq_path";
999 open CONFIGURE_WRF
, "> configure.wrf" or die "cannot append configure.wrf" ;
1000 open ARCH_PREAMBLE
, "< arch/preamble" or die "cannot open arch/preamble" ;
1002 # apply substitutions to the preamble...
1003 while ( <ARCH_PREAMBLE
> )
1005 if ( $sw_os ne "CYGWIN_NT" ) {
1008 # ESMF substitutions in preamble
1009 if ( $sw_esmflib_path && $sw_esmfinc_path )
1011 $_ =~ s/ESMFCOUPLING/1/g ;
1012 $_ =~ s
:ESMFMODDEPENDENCE
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_esmf
/module_utility
.o
:g
;
1013 $_ =~ s
:ESMFMODINC
:-I
$sw_esmfinc_path -I\
$\
(WRF_SRC_ROOT_DIR\
)/main
:g
;
1014 $_ =~ s
:ESMFIOINC
:-I\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_esmf
:g
;
1015 $_ =~ s
:ESMFIODEFS
:-DESMFIO
:g
;
1016 $_ =~ s
:ESMFTARGET
:wrfio_esmf
:g
;
1017 $_ =~ s
:\# ESMFINCLUDEGOESHERE
:include \
$\
(ESMFLIB\
)/esmf
.mk
: ;
1022 $_ =~ s/ESMFCOUPLING/0/g ;
1023 $_ =~ s
:ESMFMODDEPENDENCE
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/esmf_time_f90
/module_utility
.o
:g
;
1024 $_ =~ s
:ESMFMODINC
::g
;
1025 $_ =~ s
:ESMFIOINC
:-I\
$\
(WRF_SRC_ROOT_DIR\
)/external/esmf_time_f90
:g
;
1026 $_ =~ s
:ESMFIODEFS
::g
;
1027 $_ =~ s
:ESMFTARGET
:esmf_time
:g
;
1030 # CTSM substitutions in preamble
1031 if ( $sw_ctsm_mkfile_path ) {
1032 $_ =~ s
:\# CTSMINCLUDEGOESHERE
:include
$sw_ctsm_mkfile_path: ;
1037 $_ =~ s
:CONFIGURE_ATMOCN_LIB
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/atm_ocn
-latm_ocn
:g
;
1038 $_ =~ s/CONFIGURE_ATMOCN/atm_ocn/g ;
1042 $_ =~ s
:CONFIGURE_ATMOCN_LIB
::g
;
1043 $_ =~ s/CONFIGURE_ATMOCN//g ;
1045 $_ =~ s
:CONFIGURE_EM_CORE
:$sw_em_core:g
;
1046 $_ =~ s
:CONFIGURE_DA_CORE
:$sw_da_core:g
;
1047 $_ =~ s
:CONFIGURE_WRFPLUS_CORE
:$sw_wrfplus_core:g
;
1048 $_ =~ s
:CONFIGURE_NMM_CORE
:$sw_nmm_core:g
;
1049 $_ =~ s/CONFIGURE_CONFIG_LINE/$sw_config_line/g ;
1050 $_ =~ s/CONFIGURE_CONFIG_NUM/Compiler choice: $response_opt/g ;
1051 $_ =~ s/CONFIGURE_CONFIG_NEST/Nesting option: $response_nesting/g ;
1053 $_ =~ s/CONFIGURE_NETCDF4_DEP_LIB/$sw_netcdf4_dep_lib/g ;
1055 $_ =~ s/CONFIGURE_COMMS_LIB/$sw_comms_lib/g ;
1056 if ( $sw_os ne "CYGWIN_NT" ) {
1060 if ( $sw_netcdfpar_path )
1061 { #print("set sw_netcdfpar_path stuff\n");
1062 $_ =~ s/CONFIGURE_WRFIO_NFPAR/wrfio_nfpar/g ;
1063 $_ =~ s
:CONFIGURE_NETCDFPAR_FLAG
:-DNETCDFPAR
: ;
1064 if ( $ENV{NETCDFPAR_LDFLAGS
} ) {
1065 $_ =~ s
:CONFIGURE_NETCDFPAR_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdfpar
/libwrfio_nfpar
.a
$ENV{NETCDFPAR_LDFLAGS
} : ;
1066 } elsif ( $sw_os eq "Interix" ) {
1067 $_ =~ s
:CONFIGURE_NETCDFPAR_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdfpar
/libwrfio_nfpar.a -L$sw_netcdfpar_path/lib
$sw_usenetcdff $sw_usenetcdf : ;
1069 $_ =~ s
:CONFIGURE_NETCDFPAR_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdfpar
-lwrfio_nfpar
-L
$sw_netcdfpar_path/lib
$sw_usenetcdff $sw_usenetcdf : ;
1073 { $_ =~ s/CONFIGURE_WRFIO_NFPAR//g ;
1074 $_ =~ s
:CONFIGURE_NETCDFPAR_FLAG
::g
;
1075 $_ =~ s
:CONFIGURE_NETCDFPAR_LIB_PATH
::g
;
1078 if ( $sw_netcdf_path )
1079 { $_ =~ s/CONFIGURE_WRFIO_NF/wrfio_nf/g ;
1080 $_ =~ s
:CONFIGURE_NETCDF_FLAG
:-DNETCDF
: ;
1081 if ( $ENV{NETCDF_LDFLAGS
} ) {
1082 $_ =~ s
:CONFIGURE_NETCDF_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdf
/libwrfio_nf
.a
$ENV{NETCDF_LDFLAGS
} : ;
1083 } elsif ( $sw_os eq "Interix" ) {
1084 $_ =~ s
:CONFIGURE_NETCDF_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdf
/libwrfio_nf.a -L$sw_netcdf_path/lib
$sw_usenetcdff $sw_usenetcdf : ;
1086 $_ =~ s
:CONFIGURE_NETCDF_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_netcdf
-lwrfio_nf
-L
$sw_netcdf_path/lib
$sw_usenetcdff $sw_usenetcdf : ;
1090 { $_ =~ s/CONFIGURE_WRFIO_NF//g ;
1091 $_ =~ s
:CONFIGURE_NETCDF_FLAG
::g
;
1092 $_ =~ s
:CONFIGURE_NETCDF_LIB_PATH
::g
;
1095 if ( $sw_pnetcdf_path )
1096 { $_ =~ s/CONFIGURE_WRFIO_PNF/wrfio_pnf/g ;
1097 $_ =~ s
:CONFIGURE_PNETCDF_FLAG
:-DPNETCDF
: ;
1098 if ( $sw_os eq "Interix" ) {
1099 $_ =~ s
:CONFIGURE_PNETCDF_LIB_PATH
:\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_pnetcdf
/libwrfio_pnf.a -L$sw_pnetcdf_path/lib
-lpnetcdf
: ;
1101 $_ =~ s
:CONFIGURE_PNETCDF_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_pnetcdf
-lwrfio_pnf
-L
$sw_pnetcdf_path/lib
-lpnetcdf
: ;
1105 { $_ =~ s/CONFIGURE_WRFIO_PNF//g ;
1106 $_ =~ s
:CONFIGURE_PNETCDF_FLAG
::g
;
1107 $_ =~ s
:CONFIGURE_PNETCDF_LIB_PATH
::g
;
1110 if ( $sw_adios2_path )
1111 { $_ =~ s/CONFIGURE_WRFIO_ADIOS2/wrfio_adios2/g ;
1112 $_ =~ s
:CONFIGURE_ADIOS2_FLAG
:-DADIOS2
: ;
1113 if ( -d
"$sw_adios2_path/lib" )
1115 $adios2_libdir = "$sw_adios2_path/lib" ;
1117 elsif ( -d
"$sw_adios2_path/lib64" )
1119 $adios2_libdir = "$sw_adios2_path/lib64" ;
1123 die "ADIOS2 environment variable was set, but neither $sw_adios2_path/lib nor $sw_adios2_path/lib64 were found." ;
1125 $_ =~ s
:CONFIGURE_ADIOS2_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_adios
2 -lwrfio_adios2
-L
$adios2_libdir -ladios2_fortran_mpi
-ladios2_fortran
:;
1128 { $_ =~ s/CONFIGURE_WRFIO_ADIOS2//g ;
1129 $_ =~ s
:CONFIGURE_ADIOS2_FLAG
::g
;
1130 $_ =~ s
:CONFIGURE_ADIOS2_LIB_PATH
::g
;
1133 if ( $sw_hdf5_path )
1134 { $_ =~ s
:CONFIGURE_HDF5_LIB_PATH
:-L
$sw_hdf5_path/lib
$sw_hdf5_hl_fortran -lhdf5_hl
-lhdf5_fortran
-lhdf5
-lm
-lz
: ;
1135 $_ =~ s
:CONFIGURE_HDF5_FLAG
:-DHDF5
: ;
1138 { $_ =~ s
:CONFIGURE_HDF5_LIB_PATH
::g
;
1139 $_ =~ s
:CONFIGURE_HDF5_FLAG
::g
;
1142 if ( $sw_phdf5_path )
1144 { $_ =~ s/CONFIGURE_WRFIO_PHDF5/wrfio_phdf5/g ;
1145 $_ =~ s
:CONFIGURE_PHDF5_FLAG
:-DPHDF5
: ;
1146 $_ =~ s
:CONFIGURE_PHDF5_LIB_PATH
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_phdf
5 -lwrfio_phdf5
-L
$sw_phdf5_path/lib -lhdf5_fortran -lhdf5 -lm -lz -L$sw_phdf5_path/lib
-lsz
: ;
1149 { $_ =~ s/CONFIGURE_WRFIO_PHDF5//g ;
1150 $_ =~ s
:CONFIGURE_PHDF5_FLAG
::g
;
1151 $_ =~ s
:CONFIGURE_PHDF5_LIB_PATH
::g
;
1154 if ( $sw_jasperlib_path && $sw_jasperinc_path )
1155 { $_ =~ s/CONFIGURE_WRFIO_GRIB2/wrfio_grib2/g ;
1156 $_ =~ s
:CONFIGURE_GRIB2_FLAG
:-DGRIB2
:g
;
1157 $_ =~ s
:CONFIGURE_GRIB2_INC
:-I
$sw_jasperinc_path:g
;
1158 $_ =~ s
:CONFIGURE_GRIB2_LIB
:-L\
$\
(WRF_SRC_ROOT_DIR\
)/external/io_grib
2 -lio_grib2
-L
$sw_jasperlib_path -ljasper
:g
;
1161 { $_ =~ s/CONFIGURE_WRFIO_GRIB2//g ;
1162 $_ =~ s
:CONFIGURE_GRIB2_FLAG
::g
;
1163 $_ =~ s
:CONFIGURE_GRIB2_INC
::g
;
1164 $_ =~ s
:CONFIGURE_GRIB2_LIB
::g
;
1167 if ( $sw_gpfs_path ne "" )
1170 if ( $sw_gpfs_path ne "DEFAULT" )
1171 { $_ .= " -L" . $sw_gpfs_path ; }
1172 $_ .= " " . $sw_gpfs_lib . "\n" ;
1175 if ( $sw_curl_path ne "" )
1178 if ( $sw_curl_path ne "DEFAULT" )
1179 { $_ .= " -L" . $sw_curl_path ; }
1180 $_ .= " " . $sw_curl_lib . "\n" ;
1183 if ( $sw_netcdf4_dep_lib ne "" )
1186 $_ .= " " . $sw_hdf5 . "\n" ;
1190 $_ .= " " . $sw_zlib . "\n" ;
1194 @preamble = ( @preamble, $_ ) ;
1196 close ARCH_PREAMBLE
;
1197 print CONFIGURE_WRF
@preamble ;
1198 close ARCH_PREAMBLE
;
1199 printf CONFIGURE_WRF
"# Settings for %s\n", $optarray[$optchoice] ;
1200 print CONFIGURE_WRF
@machopts ;
1201 print "$ENV{WRF_MARS}" ;
1202 if ( $ENV{WRF_MARS
} || $ENV{WRF_TITAN
} || $ENV{WRF_VENUS
} )
1204 open ARCH_PLANETAMBLE
, "< arch/planetamble" or die "cannot open arch/planetamble" ;
1205 while ( <ARCH_PLANETAMBLE
> ) { print CONFIGURE_WRF
} ;
1206 close ARCH_PLANETAMBLE
;
1209 close CONFIGURE_WRF
;
1211 printf "Configuration successful! \n" ;
1212 printf "------------------------------------------------------------------------\n" ;