source: lmdz_wrf/WRFV3/arch/config_old @ 1

Last change on this file since 1 was 1, checked in by lfita, 10 years ago
  • -- --- Opening of the WRF+LMDZ coupling repository --- -- -

WRF: version v3.3
LMDZ: version v1818

More details in:

  • Property svn:executable set to *
File size: 12.8 KB
Line 
1#!/bin/sh
2
3arg1=$1
4
5# lifted from the configure file for mpich; 00/03/10 jm
6#
7# Check for perl and perl version
8for p in perl5 perl
9do
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
13    ac_echo_n=yes
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
17    ac_n= ac_c='
18' ac_t='        '
19      else
20        ac_n=-n ac_c= ac_t=
21      fi
22    else
23      ac_n= ac_c='\c' ac_t=
24    fi
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."
30    fi
31  fi
32  if test -z "$ac_echo_test" -a 1 = 1 ; then
33    echo $ac_n "checking for $ac_word""... $ac_c"
34  else
35    echo $ac_n "checking for $ac_word""... $ac_c" 1>&1
36  fi
37  ac_prog_where=""
38  if test -n "$PERL"; then
39    ac_pg_PERL="$PERL" # Let the user override the test.
40  else
41    ac_first_char=`expr "$p" : "\(.\)"`
42    if test "$ac_first_char" = "/" -a -x "$p" ; then
43         ac_pg_PERL="$p"
44         ac_prog_where=$p
45    else
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
50            ac_pg_PERL="$p"
51            ac_prog_where=$ac_dir/$ac_word
52            break
53          fi
54        done
55        IFS="$ac_save_ifs"
56    fi
57  fi;PERL="$ac_pg_PERL"
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)"
61    else
62      echo "$ac_t""found $ac_prog_where ($PERL)" 1>&1
63    fi
64    PERLFULLPATH=$ac_prog_where 
65  else
66    if test -z "$ac_echo_test" -a 1 = 1 ; then
67      echo "$ac_t""no"
68    else
69      echo "$ac_t""no" 1>&1
70    fi
71  fi
72  test -n "$PERL" && break
73done
74
75if 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
79    # don't override them
80    PERL=""
81fi
82
83if test -n "$PERL" ; then
84    PERL="$PERL"
85   
86    perlversion=`$PERL -v | grep 'This is perl' | \
87       sed -e 's/^.*v[a-z ]*\([0-9]\).*$/\1/'`
88
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 ."
95        PERL=""
96    fi
97   
98fi
99
100# Look for netcdf
101if test -z "$NETCDF" ; then
102  for p in /usr/local/netcdf
103  do
104    if test -d $p ; then
105      NETCDF=$p
106      break
107    fi
108  done
109fi
110if  test -z "$NETCDF"  ; then
111 
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.'
119    else
120      mkdir ./netcdf_links
121      if [ -z "$OBJECT_MODE" ] ; then
122         OBJECT_MODE=32 
123         export OBJECT_MODE
124      fi
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 )
128      else
129        ( cd ./netcdf_links ; ln -s /usr/local/lib64/r4i4 ./lib ; \
130                              ln -s /usr/local/include ./include )
131      fi
132    fi
133    NETCDF=`pwd`/netcdf_links
134    export NETCDF
135
136
137  else
138    bedone=""
139    if [ -d ./netcdf_links ] ; then
140      echo '** There is an existing ./netcdf_links file. Should I use? [y]'
141      read resp
142      if [ "$resp" = "y" ] ; then
143        NETCDF=`pwd`/netcdf_links
144        bedone="yes"
145      else
146        echo 'Removing existing ./netcdf_links directory'
147        /bin/rm -fr ./netcdf_links
148      fi
149    else
150      echo '** WARNING: No path to NETCDF and environment variable NETCDF not set.'
151      echo '** would you like me to try to fix? [y]'
152    fi
153    netcdfipath=""
154    netcdflpath=""
155    while [ -z "$bedone" ] ; do 
156      read resp
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]'
161          read resp
162          if [ "$resp" = "y" ] ; then
163            NETCDF=`pwd`/netcdf_links
164            export NETCDF
165            bedone="yes"
166            continue
167          fi
168        fi
169        if [ -z "$netcdfipath" ] ; then
170          echo 'Enter full path to NetCDF include directory on your system'
171          read resp
172          if [ ! -d "$resp" ] ; then
173            echo "invalid path: $resp. Try again? [y]" ; continue
174          fi
175          netcdfipath=$resp
176        fi
177        if  [ -z "$netcdflpath" ] ; then
178          echo 'Enter full path to NetCDF library directory on your system'
179          read resp
180          if [ ! -d "$resp" ] ; then
181            echo "invalid path: $resp. Try again? [y]" ; continue
182          fi
183          netcdflpath=$resp
184        fi
185
186        if [ -n "$netcdflpath" -a -n "$netcdfipath" ] ; then
187          if [ -d ./netcdf_links ] ; then
188            echo 'Existing ./netcdf_links directory. Okay to remove. [y]'
189            read resp
190            if [ "$resp" = "y" ]  ; then
191              /bin/rm -fr ./netcdf_links
192            fi
193          fi
194          mkdir ./netcdf_links
195          cd ./netcdf_links
196            ln -s "$netcdfipath" include
197            ln -s "$netcdflpath" lib
198          cd ..
199          echo created new ./netcdf_links directory
200          /bin/ls -lF ./netcdf_links
201          NETCDF=`pwd`/netcdf_links
202          export NETCDF
203          bedone="yes"
204        fi
205      else
206        bedone="yes"
207      fi
208    done
209  fi
210fi
211
212if 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
217        export PHDF5
218      fi
219      if [ "$OBJECT_MODE" -eq 64 ] ; then
220            if [ -d ~michalak/hdf5pbin-64 ] ; then
221              PHDF5=~michalak/hdf5pbin-64
222              export PHDF5
223            fi
224      fi
225  fi
226fi
227
228if [ -n "$NETCDF" ] ; then
229  echo "Will use NETCDF in dir: $NETCDF"
230else
231  echo "Will configure for use without NetCDF"
232fi
233
234if [ -n "$PNETCDF" ] ; then
235  echo "Will use PNETCDF in dir: $PNETCDF"
236# experimental, so don't tease the user if it is not there
237#else
238#  echo "Will configure for use without NetCDF"
239fi
240
241if [ -n "$PHDF5" ] ; then
242  echo "Will use PHDF5 in dir: $PHDF5"
243else
244  echo "PHDF5 not set in environment. Will configure WRF for use without."
245fi
246
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. 
253if [ -n "$WRF_OS" ] ; then
254  echo "${0}:  WRF operating system set to \"${WRF_OS}\" via environment variable \$WRF_OS"
255  os=$WRF_OS
256  mach="ARCH"
257  if [ -n "$WRF_MACH" ] ; then
258    echo "${0}:  WRF machine set to \"${WRF_MACH}\" via environment variable \$WRF_MACH"
259    mach=$WRF_MACH
260  fi
261else
262  # if the uname command exists, give it a shot and see if
263  # we can narrow the choices; otherwise, spam 'em
264  os="ARCH"
265  mach="ARCH"
266  type uname > /dev/null
267  if [ $? -eq 0 ] ; then
268    os=`uname`
269    if [ "$os" = "AIX" -o "$os" = "IRIX" -o "$os" = "IRIX64" -o "$os" = "SunOS" -o "$os" = "HP-UX"  -o "$os" = "Darwin" -o "$os" = "Interix" ] ; then
270      mach="ARCH"
271    else
272      if [ "$os" = "OSF1" -o "$os" = "Linux" -o "$os" = "UNICOS/mp" -o "$os" = "UNIX_System_V" -o "$os" = "CYGWIN_NT-5.1" ] ; then
273        mach=`uname -m`
274      else
275        os="ARCH"
276        mach="ARCH"
277      fi
278    fi
279  fi
280fi
281
282# an IBM specific hack to adjust the bmaxstack and bmaxdata options if addressing is 32-bit
283if [ "$os" = "AIX" ] ; then
284      if [ -z "$OBJECT_MODE" ] ; then
285         OBJECT_MODE=32
286         export OBJECT_MODE
287      fi
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
291      fi
292fi
293
294# compile options that come from the environment, such as chemistry
295# the "!" is removed by Config_old.pl
296if [ -n "$WRF_MARS" ] ; then
297  if [ $WRF_MARS = 1 ] ; then
298    echo building WRF for Mars
299    compileflags="${compileflags}!-DPLANET!-DMARS"
300    echo $compileflags
301  fi
302fi
303
304if [ -n "$WRF_TITAN" ] ; then
305  if [ $WRF_TITAN = 1 ] ; then
306    echo building WRF for Mars
307    compileflags="${compileflags}!-DPLANET!-DTITAN"
308  fi
309fi
310
311if [ -n "$WRF_VENUS" ] ; then
312  if [ $WRF_VENUS = 1 ] ; then
313    echo building WRF for Mars
314    compileflags="${compileflags}!-DPLANET!-DVENUS"
315  fi
316fi
317if [ -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"
325      fi
326    fi
327  else
328    compileflags="${compileflags} "
329  fi
330else
331  compileflags="${compileflags} "
332fi
333
334# Found perl, so proceed with configuration
335if 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
339    exit 1
340  fi
341fi
342
343if [ "$arg1" = "-d" ] ; then
344ls -l configure.wrf
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
348   fi
349fi
350
351# new feb 2005.  test whether MPI-2
352if test -f configure.wrf ; then
353  grep 'DMPARALLEL .*=.*1' configure.wrf > /dev/null
354  if [ $? = 0 ] ; then
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
361    else
362      echo "  " MPI_Comm_f2c and MPI_Comm_c2f are not supported
363    fi
364  fi
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
373  fi
374  if test -x tools/fseeko64_test ; then
375    ( tools/fseeko64_test 2> /dev/null ) 1> /dev/null
376    if [ $? = 0 ] ; then
377       echo fseeko64 is supported
378       sed '/^CC .*=/s/$/ -DFSEEKO64_OK /' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf
379    fi
380  else
381    if test -x tools/fseeko_test ; then
382      ( tools/fseeko_test 2> /dev/null ) 1> /dev/null
383      if [ $? = 0 ] ; then
384        echo fseeko is supported and handles 64 bit offsets
385        sed '/^CC .*=/s/$/ -DFSEEKO_OK /' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf
386      else
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
389      fi
390    else
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
393    fi
394  fi
395fi
396
397echo "------------------------------------------------------------------------"
398sed -e '1,/#### Architecture specific settings ####/d' -e '/^externals/,$d' configure.wrf
399
400echo "------------------------------------------------------------------------"
401echo "Settings listed above are written to configure.wrf."
402echo "If you wish to change settings, please edit that file."
403echo "If you wish to change the default options, edit the file:"
404echo "     arch/configure.defaults"
405echo " "
406
Note: See TracBrowser for help on using the repository browser.