-
Notifications
You must be signed in to change notification settings - Fork 2
/
starlab_start.csh.in
174 lines (139 loc) · 4.63 KB
/
starlab_start.csh.in
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
# DO NOT EDIT THIS FILE as 'starlab_start' or 'starlab_start.csh'
# -- generated by configure.
# Source this file from your .login file to set up the following environment
# variables:
#
# STARLAB_PATH Root directory of the Starlab source distribution.
# Used by many scripts in sbin, but nowhere else in
# the Starlab make process or by any Starlab program.
#
# STARLAB_INSTALL_PATH Directory in which the Starlab bin, include,
# info, lib, man, and share directories are
# installed. Necessary for running and
# linking with the Starlab software, but
# not used within Starlab itself.
#
# STARLAB A ~convenient synonym for STARLAB_PATH, again never
# used within Starlab, but retained for compatibility.
#
# STARLAB_VERSION The current Starlab version number, derived from the
# "definitive" version in autoconf.ac. Not used by
# Starlab, but retained for compatibility with older
# scripts and other programs.
#
# STARLAB_PATH and STARLAB_INSTALL_PATH are then used to update the search path.
#
#---------------------------------------------------------------------
# See if the version of STARLAB_PATH set at configuration time differs
# from the value (if any) now, and try to correct the environment
# accordingly, to keep this script portable. Note that these paths
# are hard-coded into the automatically generated Makefiles, so we
# will still have to rerun configure if we wish to rebuild the package
# (including the autotools).
set conf_ssp = "@STARLAB_SOURCE_PATH@"
set conf_sip = "@STARLAB_INSTALL_PATH@"
if ($?STARLAB_PATH == 0) then
# No STARLAB_PATH set. Just use the paths from configure.
setenv STARLAB_PATH "$conf_ssp"
setenv STARLAB_INSTALL_PATH "$conf_sip"
else
# Check if the paths conflict.
if ("$STARLAB_PATH" != "$conf_ssp") then
if ($?TERM == 1) then
echo Note: STARLAB_PATH = $STARLAB_PATH \
differs from configured version
endif
# Retain the current STARLAB_PATH, and check to see if the
# install path needs to be modified. (If it is a subdirectory
# of the original STARLAB_PATH, then chances are that it also
# moved when Starlab was relocated.)
set tmp = `echo $conf_sip | grep $conf_ssp`
if ($#tmp > 0) then
# Configured STARLAB_INSTALL_PATH was a subdirectory of STARLAB_PATH.
# Correct STARLAB_INSTALL_PATH to reflect the new STARLAB_PATH.
setenv STARLAB_INSTALL_PATH \
`echo $conf_sip | sed s\%$conf_ssp%$STARLAB_PATH%`
if ($?TERM == 1) then
echo Corrected STARLAB_INSTALL_PATH to $STARLAB_INSTALL_PATH
echo ""
endif
endif
unset tmp
else
# Accept the configure settings without further checking.
setenv STARLAB_PATH "$conf_ssp"
setenv STARLAB_INSTALL_PATH "$conf_sip"
endif
endif
unset conf_ssp conf_sip
setenv STARLAB_PATH $STARLAB_PATH # in case not in the environment
setenv STARLAB $STARLAB_PATH
if (! -e $STARLAB_PATH/VERSION) then
# Should be set by configure. If not, set it here...
set v = $STARLAB_PATH/version.m4
if (! -e $v) then
if ($?TERM == 1) then
echo Starlab version unknown
endif
else
fgrep _define $v | tr -d \[\]\(\) | awk '{print $2;}' \
>! $STARLAB_PATH/VERSION
endif
unset v
endif
if (-e $STARLAB_PATH/VERSION) then
setenv STARLAB_VERSION `cat $STARLAB_PATH/VERSION`
endif
if ($?TERM == 1) then
echo "Starlab version $STARLAB_VERSION loaded with"
echo " STARLAB_PATH = $STARLAB_PATH"
echo " STARLAB_INSTALL_PATH = $STARLAB_INSTALL_PATH"
endif
#---------------------------------------------------------------------
#
# Update the search path (add Starlab directories after . and .. if present).
# Don't add duplicate entries.
set dir1 = $STARLAB_PATH/sbin
set dir2 = $STARLAB_INSTALL_PATH/bin
set idot = 0
set iddot = 0
set add1 = 1
set add2 = 1
@ i = 0
foreach dir ($path)
@ i++
if ($dir == .) then
if ($idot == 0) then
set idot = $i # save first instance
endif
else if ($dir == ..) then
if ($iddot == 0) then
set iddot = $i
endif
else if ($dir == $dir1) then
set add1 = 0
else if ($dir == $dir2) then
set add2 = 0
endif
end
if ($add1 > 0 || $add2 > 0) then
if ($idot < $iddot) set idot = $iddot
# Directories will be added after idot.
# If idot = 0, add the directories at the start.
set save = ($path)
set path = ()
@ i = 0
while ($i < $#save)
if ($i == $idot) then
if ($add1 == 1) then
set path = ($path $dir1)
endif
if ($add2 == 1) then
set path = ($path $dir2)
endif
endif
@ i++
set path = ($path $save[$i])
end
endif
rehash