blob: 027343a3f180030acdfe4d64f0ff3203ec07c3dd (
plain) (
blame)
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
|
#!/bin/bash
#
# CL.SH -- Startup the version of the CL executable compiled for the
# architecture or floating point hardware appropriate for the current
# machine. This script can be used to invoke a number of CL flavors
# depending on how it is called. The install script will create a 'cl'
# and 'ecl' command link to this script with the intent that a different
# binary would be started for each command.
# Determine CL binary to run based on how we were called.
nm=${0##*/}
cl_binary="vocl.e"
case "$nm" in
"cl" | "cl.sh")
cl_binary="cl.e"
;;
"ecl" | "ecl.sh")
cl_binary="ecl.e"
;;
"vocl" | "vocl.sh")
cl_binary="vocl.e"
;;
*)
if (( $# > 1 )); then
if [ $1 == "-old" -o $1 == "-o" ]; then
cl_binary="cl.e"
elif [ $1 == "-ecl" -o $1 == "-e" ]; then
cl_binary="ecl.e"
elif [ $1 == "-vo" ]; then
cl_binary="vocl.e"
elif [ ${1##*.} == "c" ]; then
# Workaround for autoconf scripts attempting to use this
# command as a valid compiler option. On some systems (mostly
# Debian) a valid CC command can't be found and eventually
# the 'cl' (lisp) compiler is tried. It will always apparently
# have the conftest.c test file, so simply exit with a code to
# tell autoconf it won't work.
exit 1
fi
fi
esac
# Determine IRAF root directory (value set in install script).
d_iraf="/iraf/iraf/"
if [ -n $iraf ]; then
if [ ! -e $iraf ]; then
echo "Warning: iraf=$iraf does not exist (check .cshrc or .login)"
echo "Session will default to iraf=$d_iraf"
unset iraf ; sleep 3
fi
fi
if [ -z $iraf ]; then
export iraf="$d_iraf"
fi
# Check for a version query.
if [ $# > 1 ]; then
case "$1" in
"-v" | "-V" | "-version" | "--version")
head -1 $iraf/unix/hlib/motd
exit 0
;;
*)
;;
esac
fi
# Determine platform architecture.
if [ -e $iraf/unix/hlib/irafarch.sh ]; then
ACTUAL_ARCH=`$iraf/unix/hlib/irafarch.sh -actual`
else
ACTUAL_ARCH=$IRAFARCH
fi
if [ -n "$IRAFARCH" ]; then
if [ -e $iraf/bin.${IRAFARCH}/${cl_binary} ]; then
MACH=$IRAFARCH
else
echo "ERROR: No $iraf/bin.${IRAFARCH}/${cl_binary} binary found."
if [ "$ACTUAL_ARCH" != "$IRAFARCH" ]; then
echo "ERROR: IRAFARCH set to '$IRAFARCH', should be '$ACTUAL_ARCH'"
fi
exit 1
fi
export arch=".$MACH"
else
os_mach=`uname -s | tr '[A-Z]' '[a-z]' | cut -c1-6`
if [ -e $iraf/unix/hlib/irafarch.csh ]; then
MACH=`$iraf/unix/hlib/irafarch.csh`
else
MACH=$os_mach
fi
if [ "$os_mach" == "linux" ]; then # handle linux systems
if [ `uname -m` == "x86_64" ]; then
export mach="linux64"
else
export mach="linux"
fi
elif [ "$os_mach" == "darwin" ]; then # handle Mac systems
if [ "`uname -m`" == "x86_64" ]; then
export mach="macintel"
else
export mach="macosx"
fi
elif [ "$os_mach" == "cygwin" ]; then
export mach="cygwin"
else
mach=`uname -s | tr '[A-Z]' '[a-z]'`
fi
export arch=".$MACH"
if [ -z $IRAFARCH ]; then
export IRAFARCH="$MACH"
fi
if [ ! -e $iraf/bin.${MACH}/${cl_binary} ]; then
echo "ERROR: No $iraf/bin.${IRAFARCH}/${cl_binary} binary found."
exit 1
fi
fi
# Recent linux systems display a problem in how pointer addresses
# interact with the stack and can result in a segfault. Remove the
# stacksize limit for IRAF processes until this is better understood.
if [ "$IRAFARCH" == "redhat" -o \
"$IRAFARCH" == "linux64" -o \
"$IRAFARCH" == "linux" ]; then
ulimit -s unlimited
fi
# Just run the CL if IRAFARCH already defined.
if [ -n "$IRAFARCH" ]; then
if [ -z $IRAFARCH ]; then
export arch=""
else
export arch=".$IRAFARCH"
fi
export IRAFBIN=${iraf}bin$arch/
file=${IRAFBIN}$cl_binary
if [ -e $file ]; then
exec $file
else
echo "$file not found"
fi
fi
# Set the architecture to be used.
export IRAFARCH=$MACH
export arch=.$IRAFARCH
export IRAFBIN=${iraf}bin$arch/
# Run the desired CL.
exec ${IRAFBIN}$cl_binary
|