cpp0 doesn't seem to like -undef
[suif.git] / setup_suif.csh
blob809fd1da64e8edb0d364d14a97643623492abcef
1 #!/bin/csh
3 set envvars=(SUIFHOME MACHINE SUIFPATH COMPILER_NAME \
4 MANPATH LD_LIBRARY_PATH PATH TCL_INCLUDE_FLAGS \
5 CC CXX \
6 DEFAULT_SYSTEM_SPECIFIC_CXXFLAGS \
7 DEFAULT_SYSTEM_SPECIFIC_CFLAGS \
8 CC_OVERRIDE \
9 CXX_OVERRIDE \
10 SYSTEM_SPECIFIC_CFLAGS \
11 SYSTEM_SPECIFIC_CXXFLAGS \
12 INCLDIR SRCDIR MANDIR INFODIR HTMLDIR DOCDIR SCRIPTDIR TCLDIR \
13 MACHDIR BINDIR LIBDIR SODIR \
14 AUTOINITDIR VERDATADIR \
15 PUREHOME \
16 PURE \
17 PURE_FLAGS \
18 PURE_COLLECTOR \
19 VISUAL_TCL)
21 set flag='-csh'
22 set limits_off=0
24 while ($#argv)
25 set flag1=$argv[1]
26 if ("$flag1" == '-limits') then
27 set limits_off=1
28 shift
29 continue
30 endif
31 if ("$flag1" == '-suifhome') then
32 shift
33 if ($#argv < 0) then
34 echo "-suifhome must have an argument"
35 exit 1
36 endif
37 setenv $SUIFHOME $argv[1]
38 shift
39 continue
40 endif
41 if (("$flag1" == '-csh') || ("$flag1" == '-sh') || ("$flag1" == '-perl')) then
42 set flag=$flag1
43 shift
44 continue
45 endif
46 break
47 end
49 if (($#argv > 0) || \
50 ((x"$flag" != 'x-csh') && (x"$flag" != 'x-sh') && \
51 (x"$flag" != 'x-perl'))) then
52 echo "Usage: $0 [-limits] [-suifhome home] { -sh | -csh | -perl }"
53 echo " Defaults to csh"
54 exit 1
55 else if (! $?SUIFHOME) then
56 echo "Need SUIFHOME to be set or use the -suifhome option"
57 exit 1
58 endif
60 set gccver=`gcc -v |& fgrep 'Reading specs' |& head -1`
61 if (! $?MACHINE) then
62 setenv MACHINE `echo $gccver | sed -e s'/^.*gcc-lib\///' | \
63 sed -e s'/\/.*$//'`
64 endif
66 if (! $?SUIFPATH) then
67 setenv SUIFPATH `echo $gccver | sed -e 's/Reading specs from //' | \
68 set -e 's/\/specs//'`
69 endif
71 if (! $?COMPILER_NAME) then
72 echo $MACHINE | grep '^sparc-sun-solaris[.0-9]*$' >& /dev/null
73 if ((! $status) && ($COMPILER_NAME == 'sun_procompiler')) then
74 setenv MACHINE "${MACHINE}-sunpro"
75 else if (($MACHINE == 'mips-sgi-irix5.3) && \
76 ($COMPILER_NAME =~ gcc*)) then
77 setenv MACHINE "${MACHINE}-gcc"
78 endif
79 else if ($MACHINE == "mips-sgi-irix5.3") then
80 setenv COMPILER_NAME 'sgi_c++'
81 else if ($MACHINE =~ i386-*-solaris2.4) then
82 setenv COMPILER_NAME 'sun_procompiler'
83 else if ($MACHINE == 'i586-linux') then
84 setenv COMPILER_NAME 'egcs'
85 setenv CC_OVERRIDE 'gcc'
86 setenv CXX_OVERRIDE 'g++'
87 else
88 setenv COMPILER_NAME 'egcs'
89 setenv CC_OVERRIDE 'egcc'
90 setenv CXX_OVERRIDE 'eg++'
91 endif
93 if ($?MANPATH) then
94 echo $MANPATH | fgrep "$SUIFHOME/man" >& /dev/null
95 if ($status) then
96 setenv MANPATH "$SUIFHOME/man:$MANPATH"
97 endif
98 else
99 set oldmanpath=`man -w`
100 if ($status) then
101 # have to guess
102 $oldmanpath="/krb5/man:/usr/share/catman:/usr/share/man:/usr/catman:/usr/man:/opt/SUNWspro/man:/usr/local/man"
103 endif
104 setenv MANPATH "$SUIFHOME/man:$oldmanpath"
105 endif
107 if ($?LD_LIBRARY_PATH) then
108 setenv LD_LIBRARY_PATH "$SUIFHOME/$MACHINE/solib:$LD_LIBRARY_PATH"
109 else
110 setenv LD_LIBRARY_PATH "$SUIFHOME/$MACHINE/solib"
111 endif
113 # put SUIFHOME dirs in path
114 echo $PATH | fgrep "${SUIFHOME}/${MACHINE}/bin" >& /dev/null
115 if ($status) then
116 setenv PATH "${SUIFHOME}/${MACHINE}/bin:${PATH}"
117 endif
118 echo $SUIFPATH | fgrep "${SUIFHOME}/${MACHINE}/bin" >& /dev/null
119 if ($status) then
120 setenv SUIFPATH "${SUIFHOME}/${MACHINE}/bin:${SUIFPATH}"
121 endif
123 # For the vbrowser, we need to include <tcl.h>, which isn't in
124 # /usr/include on all our machines. The following handles that issue.
126 if ($MACHINE == 'mips-sgi-irix5.3') then
127 setenv TCL_INCLUDE_FLAGS '-I/usr/local/include'
128 else if ($MACHINE == 'sparc-sun-solaris2.3') then
129 setenv TCL_INCLUDE_FLAGS '-I/usr/openwin/include -DTK4_1 -L/usr/openwin/lib'
130 else if ($MACHINE =~ i386-*-solaris2.4) then
131 setenv TCL_INCLUDE_FLAGS '-I/usr/local/include -I/usr/openwin/include -L/usr/local/lib -L/usr/openwin/lib'
132 else if ($MACHINE =~ sparc-sun-solaris*) then
133 setenv TCL_INCLUDE_FLAGS '-I/usr/local/include -I/usr/local/ultra/include -I/usr/openwin/include -L/usr/local/lib -L/usr/local/ultra/lib -L/usr/openwin/lib'
134 else if ($MACHINE == 'alpha-dec-osf3.2') then
135 setenv TCL_INCLUDE_FLAGS '-I/usr/local/ultra/include -L/usr/local/ultra/lib'
136 else
137 echo $MACHINE | grep linux >& /dev/null
138 if (! $status) then
139 setenv TCL_INCLUDE_FLAGS '-L/usr/X11R6/lib'
140 endif
141 endif
143 # shared directories
144 if (! $?SRCDIR) setenv SRCDIR "$SUIFHOME/src"
145 if (! $?INFODIR) setenv INFODIR "$SUIFHOME/info"
146 if (! $?DOCDIR) setenv DOCDIR "$SUIFHOME/docs"
148 if (! $?HTMLDIR) setenv HTMLDIR "$SUIFHOME/html"
149 if (! $?MANDIR) setenv MANDIR "$SUIFHOME/man"
150 if (! $?SCRIPTDIR) setenv SCRIPTDIR "$SUIFHOME/scripts"
151 if (! $?TCLDIR) setenv TCLDIR "$SUIFHOME/tcl"
153 # machine-specific directories
154 if (! $?MACHDIR) setenv MACHDIR "$SUIFHOME/$MACHINE"
155 if (! $?INCLDIR) setenv INCLDIR "$MACHDIR/include"
156 if (! $?BINDIR) setenv BINDIR "$MACHDIR/bin"
157 if (! $?LIBDIR) setenv LIBDIR "$MACHDIR/lib"
158 if (! $?SODIR) setenv SODIR "$MACHDIR/solib"
159 if (! $?AUTOINITDIR) setenv AUTOINITDIR "$MACHDIR/auto_init_libs"
160 if (! $?VERDATADIR) setenv VERDATADIR "$MACHDIR/verdata"
162 # different name is used by vbrowser
163 setenv VISUAL_TCL $TCLDIR
165 # purify stuff
166 if (! $?PUREHOME) setenv PUREHOME '/usr/local/pure'
168 setenv PURE "$PUREHOME/purify"
169 if ($?PURE_COLLECTOR) then
170 setenv PURE_FLAGS "-collector=$PURE_COLLECTOR"
171 endif
174 while ($#envvars)
175 set var=${envvars[1]}
176 shift envvars
177 set val=`printenv $var`
178 if (! $status) then
179 if (x$flag == 'x-csh') then
180 echo "setenv $var '$val'"
181 else if (x$flag == 'x-sh') then
182 echo "export $var; $var='$val';"
183 else if (x$flag == 'x-perl') then
184 echo '$'"ENV{$var}='"$val"';"
185 endif
186 endif
188 if ($limits_off) then
189 echo "unlimit datasize;\n";
190 endif