| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | # parse argument list |
|---|
| 4 | |
|---|
| 5 | thiscmd=$0 |
|---|
| 6 | |
|---|
| 7 | FORTRAN_COMPILER_TIMER="" |
|---|
| 8 | opt_level="-f" |
|---|
| 9 | print_usage="" |
|---|
| 10 | chemistry="" |
|---|
| 11 | wrf_core="" |
|---|
| 12 | while [ $# -ge 1 ]; do |
|---|
| 13 | case $1 in |
|---|
| 14 | -d) opt_level="-d" ;; |
|---|
| 15 | -s) opt_level="-s" ;; |
|---|
| 16 | -f) opt_level="-f" ;; |
|---|
| 17 | -h) print_usage="yes" ;; |
|---|
| 18 | -help) print_usage="yes" ;; |
|---|
| 19 | -os) shift ; WRF_OS=$1 ;; |
|---|
| 20 | -mach) shift ; WRF_MACH=$1 ;; |
|---|
| 21 | -time) shift ; FORTRAN_COMPILER_TIMER=$1 ;; |
|---|
| 22 | chem) WRF_CHEM=1 ;; |
|---|
| 23 | kpp) WRF_KPP=1 ;; |
|---|
| 24 | wrfda) wrf_core=DA_CORE ;; |
|---|
| 25 | arw) wrf_core=EM_CORE ;; |
|---|
| 26 | nmm) wrf_core=NMM_CORE ;; |
|---|
| 27 | coamps) wrf_core=COAMPS_CORE ;; |
|---|
| 28 | exp) wrf_core=EXP_CORE ;; |
|---|
| 29 | titan) WRF_TITAN=1 ; break ;; |
|---|
| 30 | mars) WRF_MARS=1 ; break ;; |
|---|
| 31 | venus) WRF_VENUS=1 ; break ;; |
|---|
| 32 | esac |
|---|
| 33 | shift |
|---|
| 34 | done |
|---|
| 35 | if [ -n "$print_usage" ] ; then |
|---|
| 36 | echo usage: $thiscmd '[-d|-s|-f|-os os|-mach mach|-time timecommand] [chem] [kpp]' |
|---|
| 37 | exit |
|---|
| 38 | fi |
|---|
| 39 | |
|---|
| 40 | if `pwd | grep ' ' > /dev/null ` ; then |
|---|
| 41 | echo '************************** W A R N I N G ************************************' |
|---|
| 42 | echo The current working directory has spaces in some components of its path name |
|---|
| 43 | echo and this may cause problems for your build. This can occur, for example, on |
|---|
| 44 | echo Windows systems. It is strongly recommended that you install WRF and other |
|---|
| 45 | echo related software such as NetCDF in directories whose path names contain no |
|---|
| 46 | echo white space. On Win, for example, create and install in a directory under C:. |
|---|
| 47 | echo '*****************************************************************************' |
|---|
| 48 | fi |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | # lifted from the configure file for mpich; 00/03/10 jm |
|---|
| 52 | # |
|---|
| 53 | # Check for perl and perl version |
|---|
| 54 | for p in perl5 perl |
|---|
| 55 | do |
|---|
| 56 | # Extract the first word of "$p", so it can be a program name with args. |
|---|
| 57 | set dummy $p; ac_word=$2 |
|---|
| 58 | if test -z "$ac_echo_n" ; then |
|---|
| 59 | ac_echo_n=yes |
|---|
| 60 | if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then |
|---|
| 61 | # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. |
|---|
| 62 | if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then |
|---|
| 63 | ac_n= ac_c=' |
|---|
| 64 | ' ac_t=' ' |
|---|
| 65 | else |
|---|
| 66 | ac_n=-n ac_c= ac_t= |
|---|
| 67 | fi |
|---|
| 68 | else |
|---|
| 69 | ac_n= ac_c='\c' ac_t= |
|---|
| 70 | fi |
|---|
| 71 | ac_echo_test=`echo foo 1>&1` |
|---|
| 72 | if test -z "$ac_echo_test" ; then |
|---|
| 73 | print_error "Your sh shell does not handle the output redirection" |
|---|
| 74 | print_error "1>&1 correctly. Configure will work around this problem," |
|---|
| 75 | print_error "but you should report the problem to your vendor." |
|---|
| 76 | fi |
|---|
| 77 | fi |
|---|
| 78 | if test -z "$ac_echo_test" -a 1 = 1 ; then |
|---|
| 79 | echo $ac_n "checking for $ac_word""... $ac_c" |
|---|
| 80 | else |
|---|
| 81 | echo $ac_n "checking for $ac_word""... $ac_c" 1>&1 |
|---|
| 82 | fi |
|---|
| 83 | ac_prog_where="" |
|---|
| 84 | if test -n "$PERL"; then |
|---|
| 85 | ac_pg_PERL="$PERL" # Let the user override the test. |
|---|
| 86 | else |
|---|
| 87 | ac_first_char=`expr "$p" : "\(.\)"` |
|---|
| 88 | if test "$ac_first_char" = "/" -a -x "$p" ; then |
|---|
| 89 | ac_pg_PERL="$p" |
|---|
| 90 | ac_prog_where=$p |
|---|
| 91 | else |
|---|
| 92 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" |
|---|
| 93 | for ac_dir in $PATH; do |
|---|
| 94 | test -z "$ac_dir" && ac_dir=. |
|---|
| 95 | if test -f $ac_dir/$ac_word; then |
|---|
| 96 | ac_pg_PERL="$p" |
|---|
| 97 | ac_prog_where=$ac_dir/$ac_word |
|---|
| 98 | break |
|---|
| 99 | fi |
|---|
| 100 | done |
|---|
| 101 | IFS="$ac_save_ifs" |
|---|
| 102 | fi |
|---|
| 103 | fi;PERL="$ac_pg_PERL" |
|---|
| 104 | if test -n "$ac_prog_where" ; then |
|---|
| 105 | if test -z "$ac_echo_test" -a 1 = 1 ; then |
|---|
| 106 | echo "$ac_t""found $ac_prog_where ($PERL)" |
|---|
| 107 | else |
|---|
| 108 | echo "$ac_t""found $ac_prog_where ($PERL)" 1>&1 |
|---|
| 109 | fi |
|---|
| 110 | PERLFULLPATH=$ac_prog_where |
|---|
| 111 | else |
|---|
| 112 | if test -z "$ac_echo_test" -a 1 = 1 ; then |
|---|
| 113 | echo "$ac_t""no" |
|---|
| 114 | else |
|---|
| 115 | echo "$ac_t""no" 1>&1 |
|---|
| 116 | fi |
|---|
| 117 | fi |
|---|
| 118 | test -n "$PERL" && break |
|---|
| 119 | done |
|---|
| 120 | |
|---|
| 121 | if test -z "$PERL" ; then |
|---|
| 122 | # We have to set this outside of the loop lest the first failure in |
|---|
| 123 | # PROGRAM_CHECK set the value (which then terminates the effect of the |
|---|
| 124 | # loop, since autoconf macros only set values that are null, they |
|---|
| 125 | # don't override them |
|---|
| 126 | PERL="" |
|---|
| 127 | fi |
|---|
| 128 | |
|---|
| 129 | if test -n "$PERL" ; then |
|---|
| 130 | PERL="$PERL" |
|---|
| 131 | |
|---|
| 132 | perlversion=`$PERL -v | grep 'This is perl' | \ |
|---|
| 133 | sed -e 's/^.*v[a-z ]*\([0-9]\).*$/\1/'` |
|---|
| 134 | |
|---|
| 135 | # Should do a test first for ch_p4 etc. |
|---|
| 136 | if test "$perlversion" -lt 5 ; then |
|---|
| 137 | echo "WRF build requires perl version 5, which configure did not find." |
|---|
| 138 | echo "You can set the environment variable PERL to contain the " |
|---|
| 139 | echo "location of perl version 5." |
|---|
| 140 | echo "Configure believes that $PERL is version $perlversion ." |
|---|
| 141 | PERL="" |
|---|
| 142 | fi |
|---|
| 143 | |
|---|
| 144 | fi |
|---|
| 145 | |
|---|
| 146 | # Look for netcdf |
|---|
| 147 | if test -z "$NETCDF" ; then |
|---|
| 148 | for p in /usr/local/netcdf |
|---|
| 149 | do |
|---|
| 150 | if test -d $p ; then |
|---|
| 151 | NETCDF=$p |
|---|
| 152 | break |
|---|
| 153 | fi |
|---|
| 154 | done |
|---|
| 155 | fi |
|---|
| 156 | if test -z "$NETCDF" ; then |
|---|
| 157 | |
|---|
| 158 | if [ `hostname | cut -c 1-2` = "bs" -o \ |
|---|
| 159 | `hostname | cut -c 1-2` = "bd" -o \ |
|---|
| 160 | `hostname` = "tempest" -o `hostname` = "ute" ] ; then |
|---|
| 161 | echo 'Compiling on an NCAR system with weird paths to NetCDF' |
|---|
| 162 | echo 'Setting up a local NetCDF directory with symlinks' |
|---|
| 163 | if ( test -d ./netcdf_links ) ; then |
|---|
| 164 | echo 'A directory ./netcdf_links already exists. Continuing.' |
|---|
| 165 | else |
|---|
| 166 | mkdir ./netcdf_links |
|---|
| 167 | if [ -z "$OBJECT_MODE" ] ; then |
|---|
| 168 | OBJECT_MODE=32 |
|---|
| 169 | export OBJECT_MODE |
|---|
| 170 | fi |
|---|
| 171 | if [ $OBJECT_MODE -ne 64 -a \( `hostname | cut -c 1-2` = "bd" -o `hostname | cut -c 1-2` = "bs" \) ] ; then |
|---|
| 172 | ( cd ./netcdf_links ; ln -s /usr/local/lib32/r4i4 ./lib ; \ |
|---|
| 173 | ln -s /usr/local/include ./include ) |
|---|
| 174 | else |
|---|
| 175 | ( cd ./netcdf_links ; ln -s /usr/local/lib64/r4i4 ./lib ; \ |
|---|
| 176 | ln -s /usr/local/include ./include ) |
|---|
| 177 | fi |
|---|
| 178 | fi |
|---|
| 179 | NETCDF=`pwd`/netcdf_links |
|---|
| 180 | export NETCDF |
|---|
| 181 | |
|---|
| 182 | |
|---|
| 183 | else |
|---|
| 184 | bedone="" |
|---|
| 185 | if [ -d ./netcdf_links ] ; then |
|---|
| 186 | echo '** There is an existing ./netcdf_links file. Should I use? [y]' |
|---|
| 187 | read resp |
|---|
| 188 | if [ "$resp" = "y" ] ; then |
|---|
| 189 | NETCDF=`pwd`/netcdf_links |
|---|
| 190 | bedone="yes" |
|---|
| 191 | else |
|---|
| 192 | echo 'Removing existing ./netcdf_links directory' |
|---|
| 193 | /bin/rm -fr ./netcdf_links |
|---|
| 194 | fi |
|---|
| 195 | else |
|---|
| 196 | echo '** WARNING: No path to NETCDF and environment variable NETCDF not set.' |
|---|
| 197 | echo '** would you like me to try to fix? [y]' |
|---|
| 198 | fi |
|---|
| 199 | netcdfipath="" |
|---|
| 200 | netcdflpath="" |
|---|
| 201 | while [ -z "$bedone" ] ; do |
|---|
| 202 | read resp |
|---|
| 203 | if [ "$resp" = "y" -o -z "$resp" ] ; then |
|---|
| 204 | if [ -d ./netcdf_links ] ; then |
|---|
| 205 | echo 'There is already a ./netcdf_links directory. Okay to use links' |
|---|
| 206 | echo 'in this directory for NetCDF include and lib dirs? [y]' |
|---|
| 207 | read resp |
|---|
| 208 | if [ "$resp" = "y" ] ; then |
|---|
| 209 | NETCDF=`pwd`/netcdf_links |
|---|
| 210 | export NETCDF |
|---|
| 211 | bedone="yes" |
|---|
| 212 | continue |
|---|
| 213 | fi |
|---|
| 214 | fi |
|---|
| 215 | if [ -z "$netcdfipath" ] ; then |
|---|
| 216 | echo 'Enter full path to NetCDF include directory on your system' |
|---|
| 217 | read resp |
|---|
| 218 | if [ ! -d "$resp" ] ; then |
|---|
| 219 | echo "invalid path: $resp. Try again? [y]" ; continue |
|---|
| 220 | fi |
|---|
| 221 | netcdfipath=$resp |
|---|
| 222 | fi |
|---|
| 223 | if [ -z "$netcdflpath" ] ; then |
|---|
| 224 | echo 'Enter full path to NetCDF library directory on your system' |
|---|
| 225 | read resp |
|---|
| 226 | if [ ! -d "$resp" ] ; then |
|---|
| 227 | echo "invalid path: $resp. Try again? [y]" ; continue |
|---|
| 228 | fi |
|---|
| 229 | netcdflpath=$resp |
|---|
| 230 | fi |
|---|
| 231 | |
|---|
| 232 | if [ -n "$netcdflpath" -a -n "$netcdfipath" ] ; then |
|---|
| 233 | if [ -d ./netcdf_links ] ; then |
|---|
| 234 | echo 'Existing ./netcdf_links directory. Okay to remove. [y]' |
|---|
| 235 | read resp |
|---|
| 236 | if [ "$resp" = "y" ] ; then |
|---|
| 237 | /bin/rm -fr ./netcdf_links |
|---|
| 238 | fi |
|---|
| 239 | fi |
|---|
| 240 | mkdir ./netcdf_links |
|---|
| 241 | cd ./netcdf_links |
|---|
| 242 | ln -s "$netcdfipath" include |
|---|
| 243 | ln -s "$netcdflpath" lib |
|---|
| 244 | cd .. |
|---|
| 245 | echo created new ./netcdf_links directory |
|---|
| 246 | /bin/ls -lF ./netcdf_links |
|---|
| 247 | NETCDF=`pwd`/netcdf_links |
|---|
| 248 | export NETCDF |
|---|
| 249 | bedone="yes" |
|---|
| 250 | fi |
|---|
| 251 | else |
|---|
| 252 | bedone="yes" |
|---|
| 253 | fi |
|---|
| 254 | done |
|---|
| 255 | fi |
|---|
| 256 | fi |
|---|
| 257 | |
|---|
| 258 | if test -z "$PDHF5" ; then |
|---|
| 259 | if [ `hostname | cut -c 1-2` = "bb" -o `hostname | cut -c 1-2` = "bf" -o `hostname | cut -c 1-2` = "bs" -o \ |
|---|
| 260 | `hostname` = "dataproc" -o `hostname` = "ute" ] ; then |
|---|
| 261 | if [ -d ~michalak/hdf5pbin ] ; then |
|---|
| 262 | PHDF5=~michalak/hdf5pbin |
|---|
| 263 | export PHDF5 |
|---|
| 264 | fi |
|---|
| 265 | if [ "$OBJECT_MODE" -eq 64 ] ; then |
|---|
| 266 | if [ -d ~michalak/hdf5pbin-64 ] ; then |
|---|
| 267 | PHDF5=~michalak/hdf5pbin-64 |
|---|
| 268 | export PHDF5 |
|---|
| 269 | fi |
|---|
| 270 | fi |
|---|
| 271 | fi |
|---|
| 272 | fi |
|---|
| 273 | |
|---|
| 274 | USENETCDFF="" # see below |
|---|
| 275 | if [ -n "$NETCDF" ] ; then |
|---|
| 276 | echo "Will use NETCDF in dir: $NETCDF" |
|---|
| 277 | # for 3.6.2 and greater there might be a second library, libnetcdff.a . Check for this and use |
|---|
| 278 | # if available |
|---|
| 279 | if [ -f "$NETCDF/lib/libnetcdff.a" ] ; then |
|---|
| 280 | USENETCDFF="-lnetcdff" |
|---|
| 281 | fi |
|---|
| 282 | else |
|---|
| 283 | echo "Will configure for use without NetCDF" |
|---|
| 284 | fi |
|---|
| 285 | |
|---|
| 286 | if [ -n "$PNETCDF" ] ; then |
|---|
| 287 | echo "Will use PNETCDF in dir: $PNETCDF" |
|---|
| 288 | # experimental, so don't tease the user if it is not there |
|---|
| 289 | #else |
|---|
| 290 | # echo "Will configure for use without NetCDF" |
|---|
| 291 | fi |
|---|
| 292 | |
|---|
| 293 | if [ -n "$PHDF5" ] ; then |
|---|
| 294 | echo "Will use PHDF5 in dir: $PHDF5" |
|---|
| 295 | else |
|---|
| 296 | echo "PHDF5 not set in environment. Will configure WRF for use without." |
|---|
| 297 | fi |
|---|
| 298 | |
|---|
| 299 | # Users who are cross-compiling can set environment variable |
|---|
| 300 | # $WRF_OS to override the value normally obtained from `uname`. |
|---|
| 301 | # If $WRF_OS is set, then $WRF_MACH can also be set to override |
|---|
| 302 | # the value normally obtained from `uname -m`. If $WRF_OS is |
|---|
| 303 | # set and $WRF_MACH is not set, then $WRF_MACH defaults to "ARCH". |
|---|
| 304 | # If $WRF_OS is not set then $WRF_MACH is ignored. |
|---|
| 305 | if [ -n "$WRF_OS" ] ; then |
|---|
| 306 | echo "${0}: WRF operating system set to \"${WRF_OS}\" via environment variable \$WRF_OS" |
|---|
| 307 | os=$WRF_OS |
|---|
| 308 | mach="ARCH" |
|---|
| 309 | if [ -n "$WRF_MACH" ] ; then |
|---|
| 310 | echo "${0}: WRF machine set to \"${WRF_MACH}\" via environment variable \$WRF_MACH" |
|---|
| 311 | mach=$WRF_MACH |
|---|
| 312 | fi |
|---|
| 313 | else |
|---|
| 314 | # if the uname command exists, give it a shot and see if |
|---|
| 315 | # we can narrow the choices; otherwise, spam 'em |
|---|
| 316 | os="ARCH" |
|---|
| 317 | mach="ARCH" |
|---|
| 318 | type uname > /dev/null |
|---|
| 319 | if [ $? -eq 0 ] ; then |
|---|
| 320 | os=`uname` |
|---|
| 321 | if [ "$os" = "AIX" -o "$os" = "IRIX" -o "$os" = "IRIX64" -o "$os" = "SunOS" -o "$os" = "HP-UX" -o "$os" = "Darwin" -o "$os" = "Interix" ] ; then |
|---|
| 322 | mach="ARCH" |
|---|
| 323 | else |
|---|
| 324 | if [ "$os" = "OSF1" -o "$os" = "Linux" -o "$os" = "UNICOS/mp" -o "$os" = "UNIX_System_V" -o "$os" = "CYGWIN_NT-5.1" ] ; then |
|---|
| 325 | mach=`uname -m` |
|---|
| 326 | if [ "$mach" = "ia64" -a -f /etc/sgi-release ] ; then |
|---|
| 327 | mach="Altix" |
|---|
| 328 | fi |
|---|
| 329 | else |
|---|
| 330 | os="ARCH" |
|---|
| 331 | mach="ARCH" |
|---|
| 332 | fi |
|---|
| 333 | fi |
|---|
| 334 | fi |
|---|
| 335 | fi |
|---|
| 336 | |
|---|
| 337 | # an IBM specific hack to adjust the bmaxstack and bmaxdata options if addressing is 32-bit |
|---|
| 338 | if [ "$os" = "AIX" ] ; then |
|---|
| 339 | if [ -z "$OBJECT_MODE" ] ; then |
|---|
| 340 | OBJECT_MODE=32 |
|---|
| 341 | export OBJECT_MODE |
|---|
| 342 | fi |
|---|
| 343 | if [ "$OBJECT_MODE" = "32" ] ; then |
|---|
| 344 | # the bang means nothing to sh in this context; use to represent spaces (perl will unbang) |
|---|
| 345 | ldflags=-bmaxstack:256000000!-bmaxdata:2048000000 |
|---|
| 346 | fi |
|---|
| 347 | fi |
|---|
| 348 | |
|---|
| 349 | # compile options that come from the environment, such as chemistry |
|---|
| 350 | # the "!" is removed by Config_new.pl |
|---|
| 351 | if [ -n "$WRF_MARS" ] ; then |
|---|
| 352 | if [ $WRF_MARS = 1 ] ; then |
|---|
| 353 | echo building WRF for Mars |
|---|
| 354 | compileflags="${compileflags}!-DPLANET!-DMARS" |
|---|
| 355 | echo $compileflags |
|---|
| 356 | fi |
|---|
| 357 | fi |
|---|
| 358 | |
|---|
| 359 | if [ -n "$WRF_TITAN" ] ; then |
|---|
| 360 | if [ $WRF_TITAN = 1 ] ; then |
|---|
| 361 | echo building WRF for Mars |
|---|
| 362 | compileflags="${compileflags}!-DPLANET!-DTITAN" |
|---|
| 363 | fi |
|---|
| 364 | fi |
|---|
| 365 | |
|---|
| 366 | if [ -n "$WRF_VENUS" ] ; then |
|---|
| 367 | if [ $WRF_VENUS = 1 ] ; then |
|---|
| 368 | echo building WRF for Mars |
|---|
| 369 | compileflags="${compileflags}!-DPLANET!-DVENUS" |
|---|
| 370 | fi |
|---|
| 371 | fi |
|---|
| 372 | if [ -n "$WRF_CHEM" ] ; then |
|---|
| 373 | if [ $WRF_CHEM = 1 ] ; then |
|---|
| 374 | echo building WRF with chemistry option |
|---|
| 375 | compileflags="${compileflags}!-DWRF_CHEM" |
|---|
| 376 | if [ -n "$WRF_KPP" ] ; then |
|---|
| 377 | if [ $WRF_KPP = 1 ] ; then |
|---|
| 378 | echo building WRF with KPP chemistry option |
|---|
| 379 | compileflags="${compileflags}!-DWRF_KPP" |
|---|
| 380 | fi |
|---|
| 381 | fi |
|---|
| 382 | else |
|---|
| 383 | compileflags="${compileflags} " |
|---|
| 384 | fi |
|---|
| 385 | else |
|---|
| 386 | compileflags="${compileflags} " |
|---|
| 387 | fi |
|---|
| 388 | |
|---|
| 389 | # Found perl, so proceed with configuration |
|---|
| 390 | if test -n "$PERL" ; then |
|---|
| 391 | srch=`grep -i "^#ARCH.*$os" arch/configure_new.defaults | grep -i "$mach"` |
|---|
| 392 | if [ -n "$srch" ] ; then |
|---|
| 393 | $PERL arch/Config_new.pl -dmparallel=$COMMLIB -ompparallel=$OMP -perl=$PERL \ |
|---|
| 394 | -netcdf=$NETCDF -pnetcdf=$PNETCDF -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \ |
|---|
| 395 | -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF -time=$FORTRAN_COMPILER_TIMER \ |
|---|
| 396 | -wrf_core=$wrf_core |
|---|
| 397 | if test ! -f configure.wrf ; then |
|---|
| 398 | exit 1 |
|---|
| 399 | fi |
|---|
| 400 | if [ "$opt_level" = "-d" ] ; then |
|---|
| 401 | sed -e 's/FCOPTIM[ ]*=/& # /' -e '/FCDEBUG[ ]*=/s/#//g' configure.wrf > configure.wrf.edit |
|---|
| 402 | /bin/mv configure.wrf.edit configure.wrf |
|---|
| 403 | fi |
|---|
| 404 | else |
|---|
| 405 | WRF_OS=$os ; export WRF_OS |
|---|
| 406 | WRF_MACH=$mach ; export WRF_MACH |
|---|
| 407 | echo '*** Configuration not found in configure_new.defaults; checking configure_old.defaults ***' |
|---|
| 408 | |
|---|
| 409 | # see if we still have an old setting laying around from v2 |
|---|
| 410 | if [ "$opt_level" = "-d" ] ; then |
|---|
| 411 | arch/config_old $opt_level |
|---|
| 412 | else |
|---|
| 413 | arch/config_old |
|---|
| 414 | fi |
|---|
| 415 | |
|---|
| 416 | fi |
|---|
| 417 | fi |
|---|
| 418 | |
|---|
| 419 | # new feb 2005. test whether MPI-2 |
|---|
| 420 | if test -f configure.wrf ; then |
|---|
| 421 | grep 'DMPARALLEL *= *1' configure.wrf > /dev/null |
|---|
| 422 | if [ $? = 0 ] ; then |
|---|
| 423 | echo testing for MPI_Comm_f2c and MPI_Comm_c2f |
|---|
| 424 | /bin/rm -f tools/mpi2_test |
|---|
| 425 | ( make mpi2_test 2> /dev/null ) 1> /dev/null |
|---|
| 426 | if test -e tools/mpi2_test.o ; then |
|---|
| 427 | echo " " MPI_Comm_f2c and MPI_Comm_c2f are supported |
|---|
| 428 | sed '/^DM_CC.*=/s/$/ -DMPI2_SUPPORT/' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf |
|---|
| 429 | else |
|---|
| 430 | echo " " MPI_Comm_f2c and MPI_Comm_c2f are not supported |
|---|
| 431 | fi |
|---|
| 432 | grep 'OMPCPP *= *-D_OPENMP' configure.wrf > /dev/null |
|---|
| 433 | if [ $? = 0 ] ; then |
|---|
| 434 | echo testing for MPI_Init_thread |
|---|
| 435 | /bin/rm -f tools/mpi2_thread_test |
|---|
| 436 | ( make mpi2_thread_test 2> /dev/null ) 1> /dev/null |
|---|
| 437 | if test -e tools/mpi2_thread_test.o ; then |
|---|
| 438 | echo " " MPI_Init_thread is supported |
|---|
| 439 | sed '/^DM_CC.*=/s/$/ -DMPI2_THREAD_SUPPORT/' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf |
|---|
| 440 | else |
|---|
| 441 | echo " " MPI_Init_thread is not supported |
|---|
| 442 | fi |
|---|
| 443 | fi |
|---|
| 444 | fi |
|---|
| 445 | # new dec 2005. test what fseek is supported (needed for share/landread.c to work correctly) |
|---|
| 446 | echo testing for fseeko and fseeko64 |
|---|
| 447 | /bin/rm -f tools/fseeko_test tools/fseeko64_test |
|---|
| 448 | ( make fseek_test 2> /dev/null ) 1> /dev/null |
|---|
| 449 | if [ "$os" = "Darwin" ] ; then |
|---|
| 450 | # fseeko64 does not exist under Darwin fseeko does. Remove the 0 length executable |
|---|
| 451 | # file that might get generated anyway, even though the compiler complains about missing reference. |
|---|
| 452 | /bin/rm -f tools/fseeko64_test |
|---|
| 453 | fi |
|---|
| 454 | if test -x tools/fseeko64_test ; then |
|---|
| 455 | ( tools/fseeko64_test 2> /dev/null ) 1> /dev/null |
|---|
| 456 | if [ $? = 0 ] ; then |
|---|
| 457 | echo fseeko64 is supported |
|---|
| 458 | sed '/^CC .*=/s/$/ -DFSEEKO64_OK /' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf |
|---|
| 459 | fi |
|---|
| 460 | else |
|---|
| 461 | if test -x tools/fseeko_test ; then |
|---|
| 462 | ( tools/fseeko_test 2> /dev/null ) 1> /dev/null |
|---|
| 463 | if [ $? = 0 ] ; then |
|---|
| 464 | echo fseeko is supported and handles 64 bit offsets |
|---|
| 465 | sed '/^CC .*=/s/$/ -DFSEEKO_OK /' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf |
|---|
| 466 | else |
|---|
| 467 | echo neither fseeko64 nor fseeko with 64 bit offsets works, landread will be compiled with fseek |
|---|
| 468 | echo but may not work correctly for very high resolution terrain datasets |
|---|
| 469 | fi |
|---|
| 470 | else |
|---|
| 471 | echo neither fseeko64 nor fseeko with 64 bit offsets works, landread will be compiled with fseek |
|---|
| 472 | echo but may not work correctly for very high resolution terrain datasets |
|---|
| 473 | fi |
|---|
| 474 | fi |
|---|
| 475 | fi |
|---|
| 476 | |
|---|
| 477 | echo "------------------------------------------------------------------------" |
|---|
| 478 | sed -e '1,/#### Architecture specific settings ####/d' -e '/^externals/,$d' configure.wrf |
|---|
| 479 | |
|---|
| 480 | echo "------------------------------------------------------------------------" |
|---|
| 481 | echo "Settings listed above are written to configure.wrf." |
|---|
| 482 | echo "If you wish to change settings, please edit that file." |
|---|
| 483 | echo "If you wish to change the default options, edit the file:" |
|---|
| 484 | echo " arch/configure_new.defaults" |
|---|
| 485 | |
|---|
| 486 | if test -n $NETCDF ; then |
|---|
| 487 | grep nf_format_64bit $NETCDF/include/netcdf.inc > /dev/null |
|---|
| 488 | configure_aaaa=$? ; export configure_aaaa |
|---|
| 489 | if [ $configure_aaaa -a -z "$WRFIO_NCD_LARGE_FILE_SUPPORT" ] ; then |
|---|
| 490 | echo "NetCDF users note:" |
|---|
| 491 | echo " This installation of NetCDF supports large file support. To enable large file" |
|---|
| 492 | echo " support in NetCDF, set the environment variable WRFIO_NCD_LARGE_FILE_SUPPORT" |
|---|
| 493 | echo " to 1 and run configure again. Set to any other value to avoid this message." |
|---|
| 494 | fi |
|---|
| 495 | fi |
|---|
| 496 | echo " " |
|---|
| 497 | |
|---|