?? configure
字號:
}die "ERROR: invalid number of vertical levels: $cfg\n" unless ($cfg>=1);$cfg{'nlev'} = $cfg;if ($print>=2) { print "Setting number of levels to $cfg{'nlev'}$eol"; }# Number of advected constituentsif (defined $opts{'nadv'}) { $cfg = $opts{'nadv'};} elsif (defined $usr_defaults{'nadv'}) { $cfg = $usr_defaults{'nadv'};} else { $cfg = $bld_defaults{'nadv'};}if ($interactive) { print "Enter number of advected constituents [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/ and $ans>=1) { $cfg = $ans; }}$cfg{'nadv'} = $cfg;if ($print>=2) { print "Setting number of advected constituents to $cfg{'nadv'}$eol"; }# Number of non-advected constituentsif (defined $opts{'nnadv'}) { $cfg = $opts{'nnadv'};} elsif (defined $usr_defaults{'nnadv'}) { $cfg = $usr_defaults{'nnadv'};} else { $cfg = $bld_defaults{'nnadv'};}if ($interactive) { print "Enter number of non-advected constituents [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/ and $ans>=0) { $cfg = $ans; }}unless ($expert) { if ($cfg==0) { die "Setting number of non-advected constituents to 0 requires source code modifications\n". "Use expert user mode (-x) to disable this check\n"; }}$cfg{'nnadv'} = $cfg;if ($print>=2) { print "Setting number of non-advected constituents to $cfg{'nnadv'}$eol"; }#-----------------------------------------------------------------------------------------------# Read system defaults file.%sys_defaults = get_sys_defaults("$cfgdir/$sys_defaults", $OSNAME);#-----------------------------------------------------------------------------------------------# Makefile configuration# Name of CAM executable.if (defined $cam_exe) { $cfg = $cam_exe;} elsif (defined $usr_defaults{'cam_exe'}) { $cfg = $usr_defaults{'cam_exe'};} else { $cfg = $bld_defaults{'cam_exe'};}if ($interactive) { print "Enter name of CAM executable [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; }}$cfg{'cam_exe'} = $cfg;if ($print>=2) { print "CAM executable will be called $cfg{'cam_exe'}$eol"; }# Allow override of Makefile default Fortran compiler$cfg = 'default';if (defined $opts{'fc'}) { $cfg = $opts{'fc'};} elsif (defined $usr_defaults{'fc'}) { $cfg = $usr_defaults{'fc'};} elsif (defined $ENV{USER_FC}) { $cfg = $ENV{USER_FC};}if ($interactive) { print "Enter Fortran compiler ('default' will use Makefile setting) [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; }}$cfg{'fc'} = ($cfg eq 'default') ? '' : $cfg;if ($print>=2) { print "Setting Fortran compiler to $cfg$eol"; }# Allow override of Makefile default C compiler (linux platform only)if ($OSNAME eq 'linux') { $cfg = 'default'; if (defined $opts{'cc'}) { $cfg = $opts{'cc'}; } elsif (defined $usr_defaults{'cc'}) { $cfg = $usr_defaults{'cc'}; } elsif (defined $ENV{USER_CC}) { $cfg = $ENV{USER_CC}; } if ($interactive) { print "Enter C compiler ('default' will use Makefile setting) [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; } } $cfg{'cc'} = ($cfg eq 'default') ? '' : $cfg; if ($print>=2) { print "Setting C compiler to $cfg$eol"; }}# Use compiler debugging options?if (defined $opts{'debug'}) { $cfg = $opts{'debug'} ? 'y' : 'n';} elsif (defined $usr_defaults{'debug'}) { $cfg = $usr_defaults{'debug'} ? 'y' : 'n';} else { $cfg = $bld_defaults{'debug'} ? 'y' : 'n';}if ($interactive) { print "Enable compiler debugging options? [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; }}$cfg{'debug'} = ($cfg =~ /[Yy]/) ? 1 : 0;if ($print>=2) { if ($cfg{'debug'}) { print "Enabling compiler debugging options.$eol"; } else { print "DISabling compiler debugging options.$eol"; }}# Append user specified compiler options to Makefile defaults$cfg = '';if (defined $opts{'fflags'}) { $cfg = $opts{'fflags'};} elsif (defined $usr_defaults{'fflags'}) { $cfg = $usr_defaults{'fflags'};}if ($interactive) { print "Enter Fortran compiler options to be appended to Makefile defaults: [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; }}$cfg{'fflags'} = $cfg;if ($print>=2) { print "Setting additional Fortran compiler options \'$cfg\'$eol"; }# SPMDif (defined $opts{'spmd'}) { $cfg = $opts{'spmd'} ? 'y' : 'n';} elsif (defined $usr_defaults{'spmd'}) { $cfg = $usr_defaults{'spmd'} ? 'y' : 'n';} else { $cfg = $sys_defaults{'spmd'} ? 'y' : 'n';}if ($interactive) { print "Enable SPMD parallelism? [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; }}$cfg{'spmd'} = ($cfg =~ /[Yy]/) ? 1 : 0;if ($print>=2) { if ($cfg{'spmd'}) { print "Enabling SPMD parallelism.$eol"; } else { print "DISabling SPMD parallelism.$eol"; }}# Threads#if (defined $opts{'omp'}) {# $cfg = 'y';#} elsif (defined $usr_defaults{'omp'}) {# $cfg = $usr_defaults{'omp'} ? 'y' : 'n';#} else {# $cfg = $sys_defaults{'omp'} ? 'y' : 'n';#}#if ($interactive) {# print "Enable threaded parallelism (openMP)? [$cfg]: ";# $ans = <>; chomp $ans;# if ($ans =~ /\S+/) { $cfg = $ans; }#}#$cfg{'omp'} = ($cfg =~ /[Yy]/) ? 1 : 0;# NetCDF includeif (defined $opts{'nc_inc'}) { $cfg = $opts{'nc_inc'};} elsif (defined $usr_defaults{'nc_inc'}) { $cfg = $usr_defaults{'nc_inc'};} elsif (defined $ENV{INC_NETCDF}) { $cfg = $ENV{INC_NETCDF};} else { $cfg = '/usr/local/include';}if ($interactive) { print "Enter directory containing NetCDF include files [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; }}if (-f "$cfg/netcdf.h") { $cfg{'nc_inc'} = $cfg;} else { die <<"EOF";** Cannot find netcdf.h in specified directory: $cfg** ** The NetCDF include directory is determined from the following set of options listed** from highest to lowest precedence:** * interactively, enabled by command-line option -i** * by the command-line option -nc_inc** * by a default configuration file, specified by -defaults ** * by the environment variable INC_NETCDF** * by the default value /usr/local/includeEOF}if ($print>=2) { print "Found netCDF include file in $cfg{'nc_inc'}$eol"; }# NetCDF libraryif (defined $opts{'nc_lib'}) { $cfg = $opts{'nc_lib'};} elsif (defined $usr_defaults{'nc_lib'}) { $cfg = $usr_defaults{'nc_lib'};} elsif (defined $ENV{LIB_NETCDF}) { $cfg = $ENV{LIB_NETCDF};} else { $cfg = '/usr/local/lib';}if ($interactive) { print "Enter directory containing NetCDF library [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; }}if (-f "$cfg/libnetcdf.a") { $cfg{'nc_lib'} = $cfg;} else { die <<"EOF";** Cannot find libnetcdf.a in specified directory: $cfg** ** The NetCDF library directory is determined from the following set of options listed** from highest to lowest precedence:** * interactively, enabled by command-line option -i** * by the command-line option -nc_lib** * by a default configuration file, specified by -defaults ** * by the environment variable LIB_NETCDF** * by the default value /usr/local/libEOF}if ($print>=2) { print "Found netCDF library in $cfg{'nc_lib'}$eol"; }$cfg{'mpi_inc'} = '';$cfg{'mpi_lib'} = '';if ($cfg{'spmd'}) { # MPI include if (defined $opts{'mpi_inc'}) { $cfg = $opts{'mpi_inc'}; } elsif (defined $usr_defaults{'mpi_inc'}) { $cfg = $usr_defaults{'mpi_inc'}; } elsif (defined $ENV{INC_MPI}) { $cfg = $ENV{INC_MPI}; } else { if ($OSNAME eq 'aix' || $OSNAME eq 'dec_osf') { $cfg = ''; } else { $cfg = '/usr/local/include'; } } if ($interactive) { print "Enter directory containing MPI include files [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; } } if ($cfg eq '' or -f "$cfg/mpif.h") { $cfg{'mpi_inc'} = $cfg; } else { die <<"EOF";** Cannot find mpif.h in specified directory: $cfg** ** The MPI include directory is determined from the following set of options listed** from highest to lowest precedence:** * interactively, enabled by command-line option -i** * by the command-line option -mpi_inc** * by a default configuration file, specified by -defaults ** * by the environment variable INC_MPI** * by the default value /usr/local/includeEOF } if ($print>=2 and $cfg{'mpi_inc'}) { print "Found MPI include file in $cfg{'mpi_inc'}$eol"; } # MPI library if (defined $opts{'mpi_lib'}) { $cfg = $opts{'mpi_lib'}; } elsif (defined $usr_defaults{'mpi_lib'}) { $cfg = $usr_defaults{'mpi_lib'}; } elsif (defined $ENV{LIB_MPI}) { $cfg = $ENV{LIB_MPI}; } else { if ($OSNAME eq 'aix' || $OSNAME eq 'dec_osf') { $cfg = ''; } else { $cfg = '/usr/local/lib'; } } if ($interactive) { print "Enter directory containing MPI library [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; } } if ($cfg eq '' or -f "$cfg/libmpi.so" or -f "$cfg/libmpich.a") { $cfg{'mpi_lib'} = $cfg; } else { die <<"EOF";** Cannot find libmpi.so or libmpich.a in specified directory: $cfg** ** The MPI library directory is determined from the following set of options listed** from highest to lowest precedence:** * interactively, enabled by command-line option -i** * by the command-line option -mpi_lib** * by a default configuration file, specified by -defaults ** * by the environment variable LIB_MPI** * by the default value /usr/local/libEOF } if ($print>=2 and $cfg{'mpi_lib'}) { print "Found MPI library in $cfg{'mpi_lib'}$eol"; }}#-----------------------------------------------------------------------------------------------# Write configuration files:# Write the filepath file.write_filepath("$cfg{'cam_bld'}/$fp_filename", %cfg);if ($print) { print "creating $cfg{'cam_bld'}/$fp_filename\n"; }# Write the params.h file.write_params_h("$cfg{'cam_bld'}/$params_filename", %cfg);if ($print) { print "creating $cfg{'cam_bld'}/$params_filename\n"; }# Write the misc.h file.write_misc_h("$cfg{'cam_bld'}/$misc_filename", %cfg);if ($print) { print "creating $cfg{'cam_bld'}/$misc_filename\n"; }# Write the preproc.h file.write_preproc_h("$cfg{'cam_bld'}/$preproc_filename", %cfg);if ($print) { print "creating $cfg{'cam_bld'}/$preproc_filename\n"; }# Write the Makefile.write_makefile("$cfgdir/Makefile", "$cfg{'cam_bld'}/Makefile", %cfg);if ($print) { print "creating $cfg{'cam_bld'}/Makefile\n"; }# Write the configuration file.write_cfg_file("$cfg{'cam_bld'}/$cfg_filename", %cfg);if ($print) { print "creating $cfg{'cam_bld'}/$cfg_filename$eol"; }#-----------------------------------------------------------------------------------------------# Check if testing requested$cfg = $opts{'test'} ? 'y' : 'n';if ($interactive) { print "Run tests on the Fortran compiler and external libraries? y or n [$cfg]: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { $cfg = $ans; }}$opts{'test'} = ($cfg =~ /[Yy]/) ? 1 : 0;#-----------------------------------------------------------------------------------------------# Finished unless testing requested#-----------------------------------------------------------------------------------------------unless ($opts{'test'}) { if ($print) { print "configure done.\n"; } exit;}# check for GNU make in the user's pathif ($print) { print "Looking for a valid GNU make... "; }my @makenames = qw(gmake gnumake make);if ($opts{'gmake'}) { unshift @makenames, $opts{'gmake'}; }my $gmake = get_gmake(@makenames);if ($gmake) { if ($print) { print "using $gmake$eol"; }} else { print "\n". "** Cannot find a valid GNU make. Tried:\n". "@makenames\n"; if ($interactive) { print "Enter the name of the GNU Make utility on your system.\n". "This name must be in your path, or be specified with\n". "an absolute pathname: "; $ans = <>; chomp $ans; if ($ans =~ /\S+/) { print "Checking if $ans is a GNU Make... "; my $retval = `$ans -v 2>&1`; if ($retval =~ /GNU Make/) { $gmake = $ans; print "using $gmake$eol"; } else { die "\nEither $ans isn't in your path, or it doesn't appear to be\n". "a GNU Make. The output from testing the -v option is\n". "$retval\n". "Stopping.\n"; } } else { die "Can't find valid GNU Make for testing. Stopping.\n";
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -