[207] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | arg1=$1 |
---|
| 4 | |
---|
| 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 |
---|
| 12 | fi |
---|
| 13 | done |
---|
| 14 | fi |
---|
| 15 | |
---|
| 16 | if test -z "$NETCDF" ; then |
---|
| 17 | |
---|
| 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 |
---|
| 30 | fi |
---|
| 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 ) |
---|
| 37 | fi |
---|
| 38 | fi |
---|
| 39 | NETCDF=`pwd`/netcdf_links |
---|
| 40 | export NETCDF |
---|
| 41 | |
---|
| 42 | |
---|
| 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 |
---|
| 54 | fi |
---|
| 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]' |
---|
| 58 | fi |
---|
| 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 |
---|
| 73 | fi |
---|
| 74 | fi |
---|
| 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 |
---|
| 80 | fi |
---|
| 81 | netcdfipath=$resp |
---|
| 82 | fi |
---|
| 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 |
---|
| 88 | fi |
---|
| 89 | netcdflpath=$resp |
---|
| 90 | fi |
---|
| 91 | |
---|
| 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 |
---|
| 98 | fi |
---|
| 99 | fi |
---|
| 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" |
---|
| 110 | fi |
---|
| 111 | else |
---|
| 112 | bedone="yes" |
---|
| 113 | fi |
---|
| 114 | done |
---|
| 115 | fi |
---|
| 116 | fi |
---|
| 117 | |
---|
| 118 | if [ -n "$NETCDF" ] ; then |
---|
| 119 | echo "Will use NETCDF in dir: $NETCDF" |
---|
| 120 | else |
---|
| 121 | echo "Will configure for use without NetCDF" |
---|
| 122 | fi |
---|
| 123 | |
---|
| 124 | # if the uname command exists, give it a shot and see if |
---|
| 125 | # we can narrow the choices; otherwise, spam 'em |
---|
| 126 | os="ARCH" |
---|
| 127 | mach="ARCH" |
---|
| 128 | type uname > /dev/null |
---|
| 129 | if [ $? -eq 0 ] ; then |
---|
| 130 | os=`uname` |
---|
| 131 | if [ "$os" = "AIX" -o "$os" = "IRIX" -o "$os" = "IRIX64" -o "$os" = "SunOS" -o "$os" = "HP-UX" -o "$os" = "Darwin" ] ; then |
---|
| 132 | mach="ARCH" |
---|
| 133 | else |
---|
| 134 | if [ "$os" = "OSF1" -o "$os" = "Linux" -o "$os" = "UNICOS/mp" -o "$os" = "UNIX_System_V" ] ; then |
---|
| 135 | mach=`uname -m` |
---|
| 136 | else |
---|
| 137 | os="ARCH" |
---|
| 138 | mach="ARCH" |
---|
| 139 | fi |
---|
| 140 | fi |
---|
| 141 | fi |
---|
| 142 | |
---|
| 143 | # Found perl, so proceed with configuration |
---|
| 144 | perl arch/Config.pl -perl=$PERL -netcdf=$NETCDF -os=$os -mach=$mach |
---|