Fix the cd problem in ungrib/src/ngl/Makefile
[WPS.git] / configure
blob93f81c97a6b9d0c4a5b2acbdafe29d2268a153b6
1 #!/bin/sh
3 arg1=$1
5 # Look for netcdf
6 if test -z "$NETCDF" ; then
7 for p in /usr/local/netcdf
8 do
9 if test -d $p ; then
10 NETCDF=$p
11 break
13 done
16 if test -z "$NETCDF" ; then
18 if [ `hostname | cut -c 1-2` = "bs" -o \
19 `hostname | cut -c 1-2` = "bv" -o \
20 `hostname` = "tempest" -o `hostname` = "lightning" ] ; then
21 echo 'Compiling on an NCAR system with weird paths to NetCDF'
22 echo 'Setting up a local NetCDF directory with symlinks'
23 if ( test -d ./netcdf_links ) ; then
24 echo 'A directory ./netcdf_links already exists. Continuing.'
25 else
26 mkdir ./netcdf_links
27 if [ -z "$OBJECT_MODE" ] ; then
28 OBJECT_MODE=32
29 export OBJECT_MODE
31 if [ $OBJECT_MODE -ne 64 -a \( `hostname | cut -c 1-2` = "bs" \) ] ; then
32 ( cd ./netcdf_links ; ln -s /usr/local/lib32/r4i4 ./lib ; \
33 ln -s /usr/local/include ./include )
34 else
35 ( cd ./netcdf_links ; ln -s /usr/local/lib64/r4i4 ./lib ; \
36 ln -s /usr/local/include ./include )
39 NETCDF=`pwd`/netcdf_links
40 export NETCDF
43 else
44 bedone=""
45 if [ -d ./netcdf_links ] ; then
46 echo '** There is an existing ./netcdf_links file. Should I use? [y]'
47 read resp
48 if [ "$resp" = "y" ] ; then
49 NETCDF=`pwd`/netcdf_links
50 bedone="yes"
51 else
52 echo 'Removing existing ./netcdf_links directory'
53 /bin/rm -fr ./netcdf_links
55 else
56 echo '** WARNING: No path to NETCDF and environment variable NETCDF not set.'
57 echo '** would you like me to try to fix? [y]'
59 netcdfipath=""
60 netcdflpath=""
61 while [ -z "$bedone" ] ; do
62 read resp
63 if [ "$resp" = "y" -o -z "$resp" ] ; then
64 if [ -d ./netcdf_links ] ; then
65 echo 'There is already a ./netcdf_links directory. Okay to use links'
66 echo 'in this directory for NetCDF include and lib dirs? [y]'
67 read resp
68 if [ "$resp" = "y" ] ; then
69 NETCDF=`pwd`/netcdf_links
70 export NETCDF
71 bedone="yes"
72 continue
75 if [ -z "$netcdfipath" ] ; then
76 echo 'Enter full path to NetCDF include directory on your system'
77 read resp
78 if [ ! -d "$resp" ] ; then
79 echo "invalid path: $resp. Try again? [y]" ; continue
81 netcdfipath=$resp
83 if [ -z "$netcdflpath" ] ; then
84 echo 'Enter full path to NetCDF library directory on your system'
85 read resp
86 if [ ! -d "$resp" ] ; then
87 echo "invalid path: $resp. Try again? [y]" ; continue
89 netcdflpath=$resp
92 if [ -n "$netcdflpath" -a -n "$netcdfipath" ] ; then
93 if [ -d ./netcdf_links ] ; then
94 echo 'Existing ./netcdf_links directory. Okay to remove. [y]'
95 read resp
96 if [ "$resp" = "y" ] ; then
97 /bin/rm -fr ./netcdf_links
100 mkdir ./netcdf_links
101 cd ./netcdf_links
102 ln -s "$netcdfipath" include
103 ln -s "$netcdflpath" lib
104 cd ..
105 echo created new ./netcdf_links directory
106 /bin/ls -lF ./netcdf_links
107 NETCDF=`pwd`/netcdf_links
108 export NETCDF
109 bedone="yes"
111 else
112 bedone="yes"
114 done
118 if [ -n "$NETCDF" ] ; then
119 echo "Will use NETCDF in dir: $NETCDF"
120 # for 3.6.2 and greater there might be a second library, libnetcdff.a . Check for this and use
121 # if available
122 if [ -f "$NETCDF/lib/libnetcdff.a" ] ; then
123 NETCDFF="-lnetcdff"
125 else
126 echo "Will configure for use without NetCDF"
129 # if the uname command exists, give it a shot and see if
130 # we can narrow the choices; otherwise, spam 'em
131 os="ARCH"
132 mach="ARCH"
133 type uname > /dev/null
134 if [ $? -eq 0 ] ; then
135 os=`uname`
136 if [ "$os" = "AIX" -o "$os" = "IRIX" -o "$os" = "IRIX64" -o "$os" = "SunOS" -o "$os" = "HP-UX" -o "$os" = "Darwin" ] ; then
137 mach="ARCH"
138 else
139 xxx=`expr "$os" : '\(.........\).*'`
140 if [ "$xxx" = "CYGWIN_NT" ] ; then
141 os=$xxx
143 if [ "$os" = "OSF1" -o "$os" = "Linux" -o "$os" = "UNICOS/mp" -o "$os" = "UNIX_System_V" -o "$os" = "CYGWIN_NT" ] ; then
144 mach=`uname -m`
145 else
146 os="ARCH"
147 mach="ARCH"
152 # Found perl, so proceed with configuration
153 perl arch/Config.pl -perl=$PERL -netcdf=$NETCDF -netcdff=$NETCDFF -os=$os -mach=$mach