5 # lifted from the configure file for mpich; 00/03/10 jm
7 # Check for perl and perl version
10 # Extract the first word of "$p", so it can be a program name with args.
11 set dummy
$p; ac_word
=$2
12 if test -z "$ac_echo_n" ; then
14 if (echo "testing\c"; echo 1,2,3) |
grep c
>/dev
/null
; then
15 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
16 if (echo -n testing
; echo 1,2,3) |
sed s
/-n/xn
/ |
grep xn
>/dev
/null
; then
25 ac_echo_test
=`echo foo 1>&1`
26 if test -z "$ac_echo_test" ; then
27 print_error
"Your sh shell does not handle the output redirection"
28 print_error
"1>&1 correctly. Configure will work around this problem,"
29 print_error
"but you should report the problem to your vendor."
32 if test -z "$ac_echo_test" -a 1 = 1 ; then
33 echo $ac_n "checking for $ac_word""... $ac_c"
35 echo $ac_n "checking for $ac_word""... $ac_c" 1>&1
38 if test -n "$PERL"; then
39 ac_pg_PERL
="$PERL" # Let the user override the test.
41 ac_first_char
=`expr "$p" : "\(.\)"`
42 if test "$ac_first_char" = "/" -a -x "$p" ; then
46 IFS
="${IFS= }"; ac_save_ifs
="$IFS"; IFS
="${IFS}:"
47 for ac_dir
in $PATH; do
48 test -z "$ac_dir" && ac_dir
=.
49 if test -f $ac_dir/$ac_word; then
51 ac_prog_where
=$ac_dir/$ac_word
58 if test -n "$ac_prog_where" ; then
59 if test -z "$ac_echo_test" -a 1 = 1 ; then
60 echo "$ac_t""found $ac_prog_where ($PERL)"
62 echo "$ac_t""found $ac_prog_where ($PERL)" 1>&1
64 PERLFULLPATH
=$ac_prog_where
66 if test -z "$ac_echo_test" -a 1 = 1 ; then
72 test -n "$PERL" && break
75 if test -z "$PERL" ; then
76 # We have to set this outside of the loop lest the first failure in
77 # PROGRAM_CHECK set the value (which then terminates the effect of the
78 # loop, since autoconf macros only set values that are null, they
83 if test -n "$PERL" ; then
86 perlversion
=`$PERL -v | grep 'This is perl' | \
87 sed -e 's/^.*v[a-z ]*\([0-9]\).*$/\1/'`
89 # Should do a test first for ch_p4 etc.
90 if test "$perlversion" -lt 5 ; then
91 echo "WRF build requires perl version 5, which configure did not find."
92 echo "You can set the environment variable PERL to contain the "
93 echo "location of perl version 5."
94 echo "Configure believes that $PERL is version $perlversion ."
101 if test -z "$NETCDF" ; then
102 for p
in /usr
/local
/netcdf
110 if test -z "$NETCDF" ; then
112 if [ `hostname | cut -c 1-2` = "bs" -o \
113 `hostname | cut -c 1-2` = "bd" -o \
114 `hostname` = "tempest" -o `hostname` = "ute" ] ; then
115 echo 'Compiling on an NCAR system with weird paths to NetCDF'
116 echo 'Setting up a local NetCDF directory with symlinks'
117 if ( test -d .
/netcdf_links
) ; then
118 echo 'A directory ./netcdf_links already exists. Continuing.'
121 if [ -z "$OBJECT_MODE" ] ; then
125 if [ $OBJECT_MODE -ne 64 -a \
( `hostname | cut -c 1-2` = "bd" -o `hostname | cut -c 1-2` = "bs" \
) ] ; then
126 ( cd .
/netcdf_links
; ln -s /usr
/local
/lib32
/r4i4 .
/lib
; \
127 ln -s /usr
/local
/include .
/include
)
129 ( cd .
/netcdf_links
; ln -s /usr
/local
/lib64
/r4i4 .
/lib
; \
130 ln -s /usr
/local
/include .
/include
)
133 NETCDF
=`pwd`/netcdf_links
139 if [ -d .
/netcdf_links
] ; then
140 echo '** There is an existing ./netcdf_links file. Should I use? [y]'
142 if [ "$resp" = "y" ] ; then
143 NETCDF
=`pwd`/netcdf_links
146 echo 'Removing existing ./netcdf_links directory'
147 /bin
/rm -fr .
/netcdf_links
150 echo '** WARNING: No path to NETCDF and environment variable NETCDF not set.'
151 echo '** would you like me to try to fix? [y]'
155 while [ -z "$bedone" ] ; do
157 if [ "$resp" = "y" -o -z "$resp" ] ; then
158 if [ -d .
/netcdf_links
] ; then
159 echo 'There is already a ./netcdf_links directory. Okay to use links'
160 echo 'in this directory for NetCDF include and lib dirs? [y]'
162 if [ "$resp" = "y" ] ; then
163 NETCDF
=`pwd`/netcdf_links
169 if [ -z "$netcdfipath" ] ; then
170 echo 'Enter full path to NetCDF include directory on your system'
172 if [ ! -d "$resp" ] ; then
173 echo "invalid path: $resp. Try again? [y]" ; continue
177 if [ -z "$netcdflpath" ] ; then
178 echo 'Enter full path to NetCDF library directory on your system'
180 if [ ! -d "$resp" ] ; then
181 echo "invalid path: $resp. Try again? [y]" ; continue
186 if [ -n "$netcdflpath" -a -n "$netcdfipath" ] ; then
187 if [ -d .
/netcdf_links
] ; then
188 echo 'Existing ./netcdf_links directory. Okay to remove. [y]'
190 if [ "$resp" = "y" ] ; then
191 /bin
/rm -fr .
/netcdf_links
196 ln -s "$netcdfipath" include
197 ln -s "$netcdflpath" lib
199 echo created new .
/netcdf_links directory
200 /bin
/ls -lF .
/netcdf_links
201 NETCDF
=`pwd`/netcdf_links
212 if test -z "$PDHF5" ; then
213 if [ `hostname | cut -c 1-2` = "bb" -o `hostname | cut -c 1-2` = "bf" -o `hostname | cut -c 1-2` = "bs" -o \
214 `hostname` = "dataproc" -o `hostname` = "ute" ] ; then
215 if [ -d ~michalak
/hdf5pbin
] ; then
216 PHDF5
=~michalak
/hdf5pbin
219 if [ "$OBJECT_MODE" -eq 64 ] ; then
220 if [ -d ~michalak
/hdf5pbin-64
] ; then
221 PHDF5
=~michalak
/hdf5pbin-64
228 if [ -n "$NETCDF" ] ; then
229 echo "Will use NETCDF in dir: $NETCDF"
231 echo "Will configure for use without NetCDF"
234 if [ -n "$PNETCDF" ] ; then
235 echo "Will use PNETCDF in dir: $PNETCDF"
236 # experimental, so don't tease the user if it is not there
238 # echo "Will configure for use without NetCDF"
241 if [ -n "$PHDF5" ] ; then
242 echo "Will use PHDF5 in dir: $PHDF5"
244 echo "PHDF5 not set in environment. Will configure WRF for use without."
247 # Users who are cross-compiling can set environment variable
248 # $WRF_OS to override the value normally obtained from `uname`.
249 # If $WRF_OS is set, then $WRF_MACH can also be set to override
250 # the value normally obtained from `uname -m`. If $WRF_OS is
251 # set and $WRF_MACH is not set, then $WRF_MACH defaults to "ARCH".
252 # If $WRF_OS is not set then $WRF_MACH is ignored.
253 if [ -n "$WRF_OS" ] ; then
254 echo "${0}: WRF operating system set to \"${WRF_OS}\" via environment variable \$WRF_OS"
257 if [ -n "$WRF_MACH" ] ; then
258 echo "${0}: WRF machine set to \"${WRF_MACH}\" via environment variable \$WRF_MACH"
262 # if the uname command exists, give it a shot and see if
263 # we can narrow the choices; otherwise, spam 'em
266 type uname
> /dev
/null
267 if [ $?
-eq 0 ] ; then
269 if [ "$os" = "AIX" -o "$os" = "IRIX" -o "$os" = "IRIX64" -o "$os" = "SunOS" -o "$os" = "HP-UX" -o "$os" = "Darwin" -o "$os" = "Interix" ] ; then
272 if [ "$os" = "OSF1" -o "$os" = "Linux" -o "$os" = "UNICOS/mp" -o "$os" = "UNIX_System_V" -o "$os" = "CYGWIN_NT-5.1" ] ; then
282 # an IBM specific hack to adjust the bmaxstack and bmaxdata options if addressing is 32-bit
283 if [ "$os" = "AIX" ] ; then
284 if [ -z "$OBJECT_MODE" ] ; then
288 if [ "$OBJECT_MODE" = "32" ] ; then
289 # the bang means nothing to sh in this context; use to represent spaces (perl will unbang)
290 ldflags
=-bmaxstack:256000000!-bmaxdata:2048000000
294 # compile options that come from the environment, such as chemistry
295 # the "!" is removed by Config_old.pl
296 if [ -n "$WRF_MARS" ] ; then
297 if [ $WRF_MARS = 1 ] ; then
298 echo building WRF
for Mars
299 compileflags
="${compileflags}!-DPLANET!-DMARS"
304 if [ -n "$WRF_TITAN" ] ; then
305 if [ $WRF_TITAN = 1 ] ; then
306 echo building WRF
for Mars
307 compileflags
="${compileflags}!-DPLANET!-DTITAN"
311 if [ -n "$WRF_VENUS" ] ; then
312 if [ $WRF_VENUS = 1 ] ; then
313 echo building WRF
for Mars
314 compileflags
="${compileflags}!-DPLANET!-DVENUS"
317 if [ -n "$WRF_CHEM" ] ; then
318 if [ $WRF_CHEM = 1 ] ; then
319 echo building WRF with chemistry option
320 compileflags
="${compileflags}!-DWRF_CHEM"
321 if [ -n "$WRF_KPP" ] ; then
322 if [ $WRF_KPP = 1 ] ; then
323 echo building WRF with KPP chemistry option
324 compileflags
="${compileflags}!-DWRF_KPP"
328 compileflags
="${compileflags} "
331 compileflags
="${compileflags} "
334 # Found perl, so proceed with configuration
335 if test -n "$PERL" ; then
336 $PERL arch
/Config_old.pl
-perl=$PERL -netcdf=$NETCDF -pnetcdf=$PNETCDF -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \
337 -compileflags=$compileflags
338 if test ! -f configure.wrf
; then
343 if [ "$arg1" = "-d" ] ; then
345 if [ -e configure.wrf
] ; then
346 sed -e 's/FCOPTIM[ ]*=/& # /' -e '/FCDEBUG[ ]*=/s/#//g' configure.wrf
> configure.wrf.edit
347 /bin
/mv configure.wrf.edit configure.wrf
351 # new feb 2005. test whether MPI-2
352 if test -f configure.wrf
; then
353 grep 'DMPARALLEL .*=.*1' configure.wrf
> /dev
/null
355 echo testing
for MPI_Comm_f2c and MPI_Comm_c2f
356 /bin
/rm -f tools
/mpi2_test
357 ( make mpi2_test
2> /dev
/null
) 1> /dev
/null
358 if test -e tools
/mpi2_test.o
; then
359 echo " " MPI_Comm_f2c and MPI_Comm_c2f are supported
360 sed '/^CC .*=/s/$/ -DMPI2_SUPPORT/' configure.wrf
> xx$$
; /bin
/mv xx$$ configure.wrf
362 echo " " MPI_Comm_f2c and MPI_Comm_c2f are not supported
365 # new dec 2005. test what fseek is supported (needed for share/landread.c to work correctly)
366 echo testing
for fseeko and fseeko64
367 /bin
/rm -f tools
/fseeko_test tools
/fseeko64_test
368 ( make fseek_test
2> /dev
/null
) 1> /dev
/null
369 if [ "$os" = "Darwin" ] ; then
370 # fseeko64 does not exist under Darwin fseeko does. Remove the 0 length executable
371 # file that might get generated anyway, even though the compiler complains about missing reference.
372 /bin
/rm -f tools
/fseeko64_test
374 if test -x tools
/fseeko64_test
; then
375 ( tools
/fseeko64_test
2> /dev
/null
) 1> /dev
/null
377 echo fseeko64 is supported
378 sed '/^CC .*=/s/$/ -DFSEEKO64_OK /' configure.wrf
> xx$$
; /bin
/mv xx$$ configure.wrf
381 if test -x tools
/fseeko_test
; then
382 ( tools
/fseeko_test
2> /dev
/null
) 1> /dev
/null
384 echo fseeko is supported and handles
64 bit offsets
385 sed '/^CC .*=/s/$/ -DFSEEKO_OK /' configure.wrf
> xx$$
; /bin
/mv xx$$ configure.wrf
387 echo neither fseeko64 nor fseeko with
64 bit offsets works
, landread will be compiled with fseek
388 echo but may not work correctly
for very high resolution terrain datasets
391 echo neither fseeko64 nor fseeko with
64 bit offsets works
, landread will be compiled with fseek
392 echo but may not work correctly
for very high resolution terrain datasets
397 echo "------------------------------------------------------------------------"
398 sed -e '1,/#### Architecture specific settings ####/d' -e '/^externals/,$d' configure.wrf
400 echo "------------------------------------------------------------------------"
401 echo "Settings listed above are written to configure.wrf."
402 echo "If you wish to change settings, please edit that file."
403 echo "If you wish to change the default options, edit the file:"
404 echo " arch/configure.defaults"