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