-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·213 lines (189 loc) · 5.42 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
#!/bin/sh
#
# Name of this script
SCRIPT=configure
arg1=$1
#
# Process any command line arguments
args=`getopt :d $*`
if [ $? != 0 ] ; then
echo 'Usage: $0 [-d]'
exit 64 # EX_USAGE
fi
set -- $args
for arg ; do
case "$arg" in
-d) DEBUG=1; echo 'Compiling with DEBUG option'; shift;;
esac
done
# =============================================================================
# Looking for NETCDF libraries / includes:
# 3 ways to get this
# 1> set environment variable NETCDF
# 2> default system installed location
# 3> ./netcdf_links with include and lib directories or links
# 4> EXIT
# =============================================================================
if [ -z "$NETCDF" ] ; then # Enviroment var not set
echo ' '
echo '================================================================= '
echo 'NETCDF environment variable not set :: '
echo ' these libraries and include files are required.'
echo '=================================================================='
echo 'Select an option to set NETCDF to continue ' $SCRIPT
echo ' 1) Use System default'
echo ' 2) Use ./netcdf_links <user supplied>'
echo ' 3) Manually enter these pathes now'
echo ' 4) <default> exit this configure script'
echo ' '
echo -n 'Select => '
read REPLY
case $REPLY in
#
# System default
"1" )
if [ -d /usr/local/netcdf ] ; then
NETCDF=/usr/local/netcdf
else
echo $SCRIPT ': /usr/local/netcdf not found'
exit 2 #ERROR
fi ;;
#
# User supplied
"2" )
if [ -d ./netcdf_links ] ; then
NETCDF=`pwd`/netcdf_links
else
echo $SCRIPT ': ./netcdf_links not found'
exit 2 #ERROR
fi ;;
#
# Manually enter
"3" )
netcdfipath=""
netcdflpath=""
echo 'Enter full path to NetCDF include directory on your system'
read REPLY
if [ ! -d "$REPLY" ] ; then
echo $SCRIPT ': ' $REPLY ' not found'
exit 2 #ERROR
else
netcdfipath=$REPLY
fi
echo 'Enter full path to NetCDF library directory on your system'
read REPLY
if [ ! -d "$REPLY" ] ; then
echo $SCRIPT ' : ' $REPLY ' not found'
exit 2 #ERROR
else
netcdflpath=$REPLY
fi
/bin/rm -fr ./netcdf_links
mkdir ./netcdf_links
cd ./netcdf_links
ln -s "$netcdfipath" include
ln -s "$netcdflpath" lib
cd ..
echo created new ./netcdf_links directory
NETCDF=`pwd`/netcdf_links ;;
#
# Get me out of here - NOW
"4" ) echo $SCRIPT ' : User terminated' ; exit 1 ;;
esac
fi
echo "Will use NETCDF in dir: " $NETCDF
#
# NETCDF 3.6.2 and greater there might be a second library, libnetcdff.a
USENETCDFF=""
if [ -f "$NETCDF/lib/libnetcdff.a" ] ; then
USENETCDFF="-lnetcdff"
fi
# =============================================================================
# Look for WRF libs
#
# 1> Environment variable
# 2> ./../WRFV3
# 3> Manually entered
# =============================================================================
if [ -z "$WRF_DIR" ] ; then # 1> enviro var
p=`pwd`/../WRFV3 # 2> ./../WRFV3
if [ -d $p ]; then
WRF_DIR=$p
else # 3> Manual
wrfpath=""
echo '** WARNING: WRF_DIR enviroment variable not set and WRFV3 not found'
echo '** at ./../WRFV3'
echo ' '
echo 'Do you wish to '
echo ' 1> Enter WRF path name manually'
echo ' 2> Exit'
read REPLY
if [ $REPLY = "1" ] ; then
echo 'Enter full path to WRF install directory on your system (i.e. $HOME/WRFV3)'
echo -n 'wrfpath = '
read REPLY
if [ -d "$REPLY" ] ; then
WRF_DIR=$REPLY
else
echo $SCRIPT ' : ' $REPLY ' directory not found'
exit 2
fi
else
echo $SCRIPT ' : User terminated'
exit 1
fi
fi # WRF found in directory tree
fi # Enviro not set
echo "Will use WRF in dir: $WRF_DIR"
#
# 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" ] ; then
mach="ARCH"
else
if [ "$os" = "OSF1" -o "$os" = "Linux" -o "$os" = "UNICOS/mp" -o "$os" = "UNIX_System_V" ] ; then
mach=`uname -m`
else
os="ARCH"
mach="ARCH"
fi
fi
fi
#
# Add directory support for build
pwd=`pwd`
if [ ! -e ./bin ] ; then
echo "$SCRIPT: making ./bin"
mkdir ./bin
fi
BINDIR=${pwd}/bin
echo "bindir " ${BINDIR}
if [ ! -e ./include ] ; then
echo "$SCRIPT: making ./include"
mkdir ./include
fi
INCMOD=${pwd}/include
echo "incmod " ${INCMOD}
if [ ! -e ./lib ] ; then
echo "$SCRIPT: making ./lib"
mkdir ./lib
fi
LIBDIR=${pwd}/lib
echo "libdir " ${LIBDIR}
#
# See if the env var DEBUG is set (overriding any arguments passed in)
if [ ! -z "$DEBUG" ] ; then
DEBUG=1
fi
#
# so proceed with configuration
perl arch/Config.pl -wrfpath=$WRF_DIR \
-netcdf=$NETCDF -USENETCDFF=$USENETCDFF \
-os=$os -mach=$mach \
-bindir=$BINDIR -incmod=$INCMOD -libdir=$LIBDIR \
-debug=$DEBUG