7 FORTRAN_COMPILER_TIMER
=""
12 while [ $# -ge 1 ]; do
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 ;;
24 radardfi
) WRF_DFI_RADAR
=1 ;;
25 wrfda
) wrf_core
=DA_CORE
;;
26 4dvar
) wrf_core
=4D_DA_CORE
;;
27 arw
) wrf_core
=EM_CORE
;;
28 nmm
) wrf_core
=NMM_CORE
;;
29 coamps
) wrf_core
=COAMPS_CORE
;;
30 exp
) wrf_core
=EXP_CORE
;;
31 titan
) WRF_TITAN
=1 ; break ;;
32 mars
) WRF_MARS
=1 ; break ;;
33 venus
) WRF_VENUS
=1 ; break ;;
37 if [ -n "$print_usage" ] ; then
38 echo usage
: $thiscmd '[-d|-s|-f|-os os|-mach mach|-time timecommand] [chem] [kpp]'
42 if `pwd | grep ' ' > /dev/null ` ; then
43 echo '************************** W A R N I N G ************************************'
44 echo The current working directory has spaces
in some components of its path name
45 echo and this may cause problems
for your build. This can occur
, for example
, on
46 echo Windows systems. It is strongly recommended that you
install WRF and other
47 echo related software such as NetCDF
in directories whose path names contain no
48 echo white space. On Win
, for example
, create and
install in a directory under C
:.
49 echo '*****************************************************************************'
53 # lifted from the configure file for mpich; 00/03/10 jm
55 # Check for perl and perl version
58 # Extract the first word of "$p", so it can be a program name with args.
59 set dummy
$p; ac_word
=$2
60 if test -z "$ac_echo_n" ; then
62 if (echo "testing\c"; echo 1,2,3) |
grep c
>/dev
/null
; then
63 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
64 if (echo -n testing
; echo 1,2,3) |
sed s
/-n/xn
/ |
grep xn
>/dev
/null
; then
73 ac_echo_test
=`echo foo 1>&1`
74 if test -z "$ac_echo_test" ; then
75 print_error
"Your sh shell does not handle the output redirection"
76 print_error
"1>&1 correctly. Configure will work around this problem,"
77 print_error
"but you should report the problem to your vendor."
80 if test -z "$ac_echo_test" -a 1 = 1 ; then
81 echo $ac_n "checking for $ac_word""... $ac_c"
83 echo $ac_n "checking for $ac_word""... $ac_c" 1>&1
86 if test -n "$PERL"; then
87 ac_pg_PERL
="$PERL" # Let the user override the test.
89 ac_first_char
=`expr "$p" : "\(.\)"`
90 if test "$ac_first_char" = "/" -a -x "$p" ; then
94 IFS
="${IFS= }"; ac_save_ifs
="$IFS"; IFS
="${IFS}:"
95 for ac_dir
in $PATH; do
96 test -z "$ac_dir" && ac_dir
=.
97 if test -f $ac_dir/$ac_word; then
99 ac_prog_where
=$ac_dir/$ac_word
105 fi;PERL
="$ac_pg_PERL"
106 if test -n "$ac_prog_where" ; then
107 if test -z "$ac_echo_test" -a 1 = 1 ; then
108 echo "$ac_t""found $ac_prog_where ($PERL)"
110 echo "$ac_t""found $ac_prog_where ($PERL)" 1>&1
112 PERLFULLPATH
=$ac_prog_where
114 if test -z "$ac_echo_test" -a 1 = 1 ; then
117 echo "$ac_t""no" 1>&1
120 test -n "$PERL" && break
123 if test -z "$PERL" ; then
124 # We have to set this outside of the loop lest the first failure in
125 # PROGRAM_CHECK set the value (which then terminates the effect of the
126 # loop, since autoconf macros only set values that are null, they
127 # don't override them
131 if test -n "$PERL" ; then
134 perlversion
=`$PERL -v | grep 'This is perl' | \
135 sed -e 's/^.*v[a-z ]*\([0-9]\).*$/\1/'`
137 # Should do a test first for ch_p4 etc.
138 if test "$perlversion" -lt 5 ; then
139 echo "WRF build requires perl version 5, which configure did not find."
140 echo "You can set the environment variable PERL to contain the "
141 echo "location of perl version 5."
142 echo "Configure believes that $PERL is version $perlversion ."
149 if test -z "$NETCDF" ; then
150 for p
in /usr
/local
/netcdf
158 if test -z "$NETCDF" ; then
160 if [ `hostname | cut -c 1-2` = "bs" -o \
161 `hostname | cut -c 1-2` = "bd" -o \
162 `hostname` = "tempest" -o `hostname` = "ute" ] ; then
163 echo 'Compiling on an NCAR system with weird paths to NetCDF'
164 echo 'Setting up a local NetCDF directory with symlinks'
165 if ( test -d .
/netcdf_links
) ; then
166 echo 'A directory ./netcdf_links already exists. Continuing.'
169 if [ -z "$OBJECT_MODE" ] ; then
173 if [ $OBJECT_MODE -ne 64 -a \
( `hostname | cut -c 1-2` = "bd" -o `hostname | cut -c 1-2` = "bs" \
) ] ; then
174 ( cd .
/netcdf_links
; ln -s /usr
/local
/lib32
/r4i4 .
/lib
; \
175 ln -s /usr
/local
/include .
/include
)
177 ( cd .
/netcdf_links
; ln -s /usr
/local
/lib64
/r4i4 .
/lib
; \
178 ln -s /usr
/local
/include .
/include
)
181 NETCDF
=`pwd`/netcdf_links
187 if [ -d .
/netcdf_links
] ; then
188 echo '** There is an existing ./netcdf_links file. Should I use? [y]'
190 if [ "$resp" = "y" ] ; then
191 NETCDF
=`pwd`/netcdf_links
194 echo 'Removing existing ./netcdf_links directory'
195 /bin
/rm -fr .
/netcdf_links
198 echo '** WARNING: No path to NETCDF and environment variable NETCDF not set.'
199 echo '** would you like me to try to fix? [y]'
203 while [ -z "$bedone" ] ; do
205 if [ "$resp" = "y" -o -z "$resp" ] ; then
206 if [ -d .
/netcdf_links
] ; then
207 echo 'There is already a ./netcdf_links directory. Okay to use links'
208 echo 'in this directory for NetCDF include and lib dirs? [y]'
210 if [ "$resp" = "y" ] ; then
211 NETCDF
=`pwd`/netcdf_links
217 if [ -z "$netcdfipath" ] ; then
218 echo 'Enter full path to NetCDF include directory on your system'
220 if [ ! -d "$resp" ] ; then
221 echo "invalid path: $resp. Try again? [y]" ; continue
225 if [ -z "$netcdflpath" ] ; then
226 echo 'Enter full path to NetCDF library directory on your system'
228 if [ ! -d "$resp" ] ; then
229 echo "invalid path: $resp. Try again? [y]" ; continue
234 if [ -n "$netcdflpath" -a -n "$netcdfipath" ] ; then
235 if [ -d .
/netcdf_links
] ; then
236 echo 'Existing ./netcdf_links directory. Okay to remove. [y]'
238 if [ "$resp" = "y" ] ; then
239 /bin
/rm -fr .
/netcdf_links
244 ln -s "$netcdfipath" include
245 ln -s "$netcdflpath" lib
247 echo created new .
/netcdf_links directory
248 /bin
/ls -lF .
/netcdf_links
249 NETCDF
=`pwd`/netcdf_links
260 if test -z "$PDHF5" ; then
261 if [ `hostname | cut -c 1-2` = "bb" -o `hostname | cut -c 1-2` = "bf" -o `hostname | cut -c 1-2` = "bs" -o \
262 `hostname` = "dataproc" -o `hostname` = "ute" ] ; then
263 if [ -d ~michalak
/hdf5pbin
] ; then
264 PHDF5
=~michalak
/hdf5pbin
267 if [ "$OBJECT_MODE" -eq 64 ] ; then
268 if [ -d ~michalak
/hdf5pbin-64
] ; then
269 PHDF5
=~michalak
/hdf5pbin-64
276 USENETCDFF
="" # see below
277 if [ -n "$NETCDF" ] ; then
278 echo "Will use NETCDF in dir: $NETCDF"
279 # for 3.6.2 and greater there might be a second library, libnetcdff.a . Check for this and use
281 if [ -f "$NETCDF/lib/libnetcdff.a" ] ; then
282 USENETCDFF
="-lnetcdff"
285 echo "Will configure for use without NetCDF"
288 if [ -n "$PNETCDF" ] ; then
289 echo "Will use PNETCDF in dir: $PNETCDF"
290 # experimental, so don't tease the user if it is not there
292 # echo "Will configure for use without NetCDF"
295 if [ -n "$PHDF5" ] ; then
296 echo "Will use PHDF5 in dir: $PHDF5"
298 echo "PHDF5 not set in environment. Will configure WRF for use without."
301 if [ "$wrf_core" = "DA_CORE" ]; then
302 if [ -n "$WRFPLUS_DIR" ] ; then
303 echo "To compile WRFDA without 4DVAR, please remove \$WRFPLUS_DIR from environment. "
308 if [ "$wrf_core" = "4D_DA_CORE" ]; then
309 if [ -n "$WRFPLUS_DIR" ] ; then
310 echo "Will use WRFPLUS in dir: $WRFPLUS_DIR"
312 echo "WRFPLUS_DIR not set in environment. Please compile WRFPLUS and set WRFPLUS_DIR."
316 # Users who are cross-compiling can set environment variable
317 # $WRF_OS to override the value normally obtained from `uname`.
318 # If $WRF_OS is set, then $WRF_MACH can also be set to override
319 # the value normally obtained from `uname -m`. If $WRF_OS is
320 # set and $WRF_MACH is not set, then $WRF_MACH defaults to "ARCH".
321 # If $WRF_OS is not set then $WRF_MACH is ignored.
322 if [ -n "$WRF_OS" ] ; then
323 echo "${0}: WRF operating system set to \"${WRF_OS}\" via environment variable \$WRF_OS"
326 if [ -n "$WRF_MACH" ] ; then
327 echo "${0}: WRF machine set to \"${WRF_MACH}\" via environment variable \$WRF_MACH"
331 # if the uname command exists, give it a shot and see if
332 # we can narrow the choices; otherwise, spam 'em
335 type uname
> /dev
/null
336 if [ $?
-eq 0 ] ; then
338 if [ "$os" = "AIX" -o "$os" = "IRIX" -o "$os" = "IRIX64" -o "$os" = "SunOS" -o "$os" = "HP-UX" -o "$os" = "Darwin" -o "$os" = "Interix" ] ; then
341 xxx
=`expr "$os" : '\(.........\).*'`
342 if [ "$xxx" = "CYGWIN_NT" ] ; then
345 if [ "$os" = "OSF1" -o "$os" = "Linux" -o "$os" = "UNICOS/mp" -o "$os" = "UNIX_System_V" -o "$os" = "CYGWIN_NT" ] ; then
347 if [ "$mach" = "ia64" -a -f /etc
/sgi-release
] ; then
358 # an IBM specific hack to adjust the bmaxstack and bmaxdata options if addressing is 32-bit
359 if [ "$os" = "AIX" ] ; then
360 if [ -z "$OBJECT_MODE" ] ; then
364 if [ "$OBJECT_MODE" = "32" ] ; then
365 # the bang means nothing to sh in this context; use to represent spaces (perl will unbang)
366 ldflags
=-bmaxstack:256000000!-bmaxdata:2048000000
370 # compile options that come from the environment, such as chemistry
371 # the "!" is removed by Config_new.pl
372 if [ -n "$WRF_MARS" ] ; then
373 if [ $WRF_MARS = 1 ] ; then
374 echo building WRF
for Mars
375 compileflags
="${compileflags}!-DPLANET!-DMARS"
380 if [ -n "$WRF_TITAN" ] ; then
381 if [ $WRF_TITAN = 1 ] ; then
382 echo building WRF
for Mars
383 compileflags
="${compileflags}!-DPLANET!-DTITAN"
387 if [ -n "$WRF_VENUS" ] ; then
388 if [ $WRF_VENUS = 1 ] ; then
389 echo building WRF
for Mars
390 compileflags
="${compileflags}!-DPLANET!-DVENUS"
393 if [ -n "$WRF_NMM_CORE" ]; then
394 if [ $WRF_NMM_CORE = 1 ]; then
395 if [ -n "$HWRF" ]; then
396 if [ $HWRF = 1 ]; then
397 echo building WRF with HWRF option
398 compileflags
="${compileflags}!-DHWRF=1"
399 if [ $HWRFX = 1 ]; then
400 compileflags
="${compileflags}!-DHWRFX=1"
406 if [ -n "$WRF_DFI_RADAR" ] ; then
407 if [ $WRF_DFI_RADAR = 1 ] ; then
408 echo building WRF with radar dfi option
409 compileflags
="${compileflags}!-DWRF_DFI_RADAR=1"
412 if [ -n "$WRF_CHEM" ] ; then
413 if [ $WRF_CHEM = 1 ] ; then
414 echo building WRF with chemistry option
415 compileflags
="${compileflags}!-DWRF_CHEM!-DBUILD_CHEM=1"
416 if [ -n "$WRF_KPP" ] ; then
417 if [ $WRF_KPP = 1 ] ; then
418 echo building WRF with KPP chemistry option
419 compileflags
="${compileflags}!-DWRF_KPP"
423 compileflags
="${compileflags} "
426 compileflags
="${compileflags} "
429 if [ `which timex` ] ; then
430 FORTRAN_COMPILER_TIMER
=timex
433 # Found perl, so proceed with configuration
434 if test -n "$PERL" ; then
435 srch
=`grep -i "^#ARCH.*$os" arch/configure_new.defaults | grep -i "$mach"`
436 if [ -n "$srch" ] ; then
437 $PERL arch
/Config_new.pl
-dmparallel=$COMMLIB -ompparallel=$OMP -perl=$PERL \
438 -netcdf=$NETCDF -pnetcdf=$PNETCDF -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \
439 -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF -time=$FORTRAN_COMPILER_TIMER \
441 if test ! -f configure.wrf
; then
444 if [ "$opt_level" = "-d" ] ; then
445 sed -e 's/FCOPTIM[ ]*=/& # /' -e '/FCDEBUG[ ]*=/s/#//g' configure.wrf
> configure.wrf.edit
446 /bin
/mv configure.wrf.edit configure.wrf
449 WRF_OS
=$os ; export WRF_OS
450 WRF_MACH
=$mach ; export WRF_MACH
451 echo '*** Configuration not found in configure_new.defaults; checking configure_old.defaults ***'
453 # see if we still have an old setting laying around from v2
454 if [ "$opt_level" = "-d" ] ; then
455 arch
/config_old
$opt_level
463 # new feb 2005. test whether MPI-2
464 if test -f configure.wrf
; then
465 grep 'DMPARALLEL *= *1' configure.wrf
> /dev
/null
467 echo testing
for MPI_Comm_f2c and MPI_Comm_c2f
468 /bin
/rm -f tools
/mpi2_test
469 ( make mpi2_test
2> /dev
/null
) 1> /dev
/null
470 if test -e tools
/mpi2_test.o
; then
471 echo " " MPI_Comm_f2c and MPI_Comm_c2f are supported
472 sed '/^DM_CC.*=/s/$/ -DMPI2_SUPPORT/' configure.wrf
> xx$$
; /bin
/mv xx$$ configure.wrf
473 if [ `hostname | cut -c 1-2` = "be" ] ; then
474 sed '/^ARCH_LOCAL.*=/s/$/ -DUSE_MPI_IN_PLACE/' configure.wrf
> xx$$
; /bin
/mv xx$$ configure.wrf
477 echo " " MPI_Comm_f2c and MPI_Comm_c2f are not supported
479 grep 'OMPCPP *= *-D_OPENMP' configure.wrf
> /dev
/null
481 echo testing
for MPI_Init_thread
482 /bin
/rm -f tools
/mpi2_thread_test
483 ( make mpi2_thread_test
2> /dev
/null
) 1> /dev
/null
484 if test -e tools
/mpi2_thread_test.o
; then
485 echo " " MPI_Init_thread is supported
486 sed '/^DM_CC.*=/s/$/ -DMPI2_THREAD_SUPPORT/' configure.wrf
> xx$$
; /bin
/mv xx$$ configure.wrf
488 echo " " MPI_Init_thread is not supported
492 # new dec 2005. test what fseek is supported (needed for share/landread.c to work correctly)
493 echo testing
for fseeko and fseeko64
494 /bin
/rm -f tools
/fseeko_test tools
/fseeko64_test
495 ( make fseek_test
2> /dev
/null
) 1> /dev
/null
496 if [ "$os" = "Darwin" ] ; then
497 # fseeko64 does not exist under Darwin fseeko does. Remove the 0 length executable
498 # file that might get generated anyway, even though the compiler complains about missing reference.
499 /bin
/rm -f tools
/fseeko64_test
501 if test -x tools
/fseeko64_test
; then
502 ( tools
/fseeko64_test
2> /dev
/null
) 1> /dev
/null
504 echo fseeko64 is supported
505 sed '/^CC .*=/s/$/ -DFSEEKO64_OK /' configure.wrf
> xx$$
; /bin
/mv xx$$ configure.wrf
508 if test -x tools
/fseeko_test
; then
509 ( tools
/fseeko_test
2> /dev
/null
) 1> /dev
/null
511 echo fseeko is supported and handles
64 bit offsets
512 sed '/^CC .*=/s/$/ -DFSEEKO_OK /' configure.wrf
> xx$$
; /bin
/mv xx$$ configure.wrf
514 echo neither fseeko64 nor fseeko with
64 bit offsets works
, landread will be compiled with fseek
515 echo but may not work correctly
for very high resolution terrain datasets
518 echo neither fseeko64 nor fseeko with
64 bit offsets works
, landread will be compiled with fseek
519 echo but may not work correctly
for very high resolution terrain datasets
524 echo "------------------------------------------------------------------------"
525 sed -e '1,/#### Architecture specific settings ####/d' -e '/^externals/,$d' configure.wrf
527 echo "------------------------------------------------------------------------"
528 echo "Settings listed above are written to configure.wrf."
529 echo "If you wish to change settings, please edit that file."
530 echo "If you wish to change the default options, edit the file:"
531 echo " arch/configure_new.defaults"
533 if test -n $NETCDF ; then
534 grep nf_format_64bit
$NETCDF/include
/netcdf.inc
> /dev
/null
535 configure_aaaa
=$?
; export configure_aaaa
536 if [ $configure_aaaa -a -z "$WRFIO_NCD_LARGE_FILE_SUPPORT" ] ; then
537 echo "NetCDF users note:"
538 echo " This installation of NetCDF supports large file support. To enable large file"
539 echo " support in NetCDF, set the environment variable WRFIO_NCD_LARGE_FILE_SUPPORT"
540 echo " to 1 and run configure again. Set to any other value to avoid this message."
545 if [ "$wrf_core" = "DA_CORE" ]; then
546 if [ `grep '^SFC' configure.wrf | cut -d= -f2` = "gfortran" ]; then
547 echo "WRFDA using gfortran needs realsize=8"
548 sed -e '/^PROMOTION.*=/s/#//' configure.wrf
> configure.wrf.edit
549 /bin
/mv configure.wrf.edit configure.wrf