annotate setup @ 16:e246e5730173

Removed useless binaries from repository...
author darius
date Wed, 24 Dec 1997 12:36:02 +0000
parents 4d6502ffaa5e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
1 #!/bin/sh
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
2 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
3 # NETREK II -- Paradise server setup script
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
4 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
5 # Permission to use, copy, modify, and distribute this software and its
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
6 # documentation for any NON-COMMERCIAL purpose
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
7 # (read the files 'src/copyright*.h')) and without
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
8 # fee is hereby granted, provided that this copyright notice appear in all
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
9 # copies. No representations are made about the suitability of this
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
10 # software for any purpose. This software is provided "as is" without
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
11 # express or implied warranty.
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
12 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
13 # Xtrek Copyright 1986 Chris Guthrie
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
14 # Netrek (Xtrek II) Copyright 1989 Kevin P. Smith
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
15 # Scott Silvey
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
16 # Paradise (Netrek II) Copyright 1993 Larry Denys
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
17 # Kurt Olsen
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
18 # Brandon Gillespie
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
19 # Rob Forsman
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
20 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
21 # Comprehensive Credits available in the file docs/CREDITS
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
22 #
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
23 # Note: this is just a quick hack I made, we can probably improve it later
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
24 # -Brandon
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
25
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
26 trap "rm -f test.c a.out core $0.tmp; exit" 2 3
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
27
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
28 t=" "
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
29 i="- "
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
30
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
31 echo "-- Netrek II (Paradise) --
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
32
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
33 ${t}Setup script for the Netrek II (Paradise) Server.
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
34
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
35 ${t}To rebuild the Makefile using previous options (in the instance that
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
36 ${t}Makefile.in was changed), use the \"-p\" (previous) flag, \"make
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
37 ${t}makefile\" will also execute \"setup -p\".
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
38 "
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
39
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
40 # figure out what to do with echo -- from perl's Configure
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
41 # This blows chunks on Linux; fixed line from echotmp to $0.tmp.
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
42
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
43 (echo "hi there \c" ; echo " ") > $0.tmp
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
44 if grep c $0.tmp >/dev/null 2>&1 ; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
45 echo "${i}Supressing newlines with -n..."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
46 n='-n'
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
47 c=''
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
48 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
49 echo "${i}Supressing newlines with \\\c..."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
50 n=''
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
51 c='\c'
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
52 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
53
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
54 echo ''
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
55 echo $n "${i}The asterisk should be here => $c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
56 echo '*'
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
57 echo ''
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
58
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
59 if [ X$1 != X -a X$1 = X"-p" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
60 echo "${i}Reading previous setup configuration..."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
61 if [ ! -f etc/$0.conf ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
62 echo
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
63 echo "${t}previous configuration file (etc/$0.conf) not found!"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
64 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
65 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
66 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
67
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
68 ###########################################################################
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
69 # Global vars
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
70 LIBS="-lm"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
71
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
72 ###########################################################################
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
73 SYS=`(/bin/uname || /usr/bin/uname) 2>/dev/null`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
74
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
75 case $SYS in
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
76 SunOS)
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
77 # check for Solaris the hard way
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
78 if [ "`/bin/uname -rs | cut -c0-9`" != "SunOS 4.1" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
79 SYS="SOLARIS"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
80 CCOPTIONS="-DSYSV -DSVR4 ${CCOPTIONS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
81 LIBS="-lnsl -lsocket ${LIBS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
82 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
83 ;;
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
84 HP-UX)
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
85 CCOPTIONS="-Ae -DSYSV ${CCOPTIONS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
86 ;;
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
87 IRIX)
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
88 CCOPTIONS="-mips2 -DSYSV -DSVR4 -DBAD_SVR4_HACKS ${CCOPTIONS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
89 LIBS="-lsun ${LIBS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
90 ;;
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
91 OSF1)
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
92 CCOPTIONS="-DSYSV ${CCOPTIONS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
93 ;;
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
94 *)
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
95 # this is a hack because Unixware returns odd things with /bin/uname
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
96 echo $n "Are you running Unixware? [yn] (default: n) $c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
97 read ANSWER
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
98 if [ X$ANSWER = X"y" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
99 SYS="UNIXWARE"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
100 CCOPTIONS="-DSYSV -DSVR4 -DBAD_SVR4_HACKS ${CCOPTIONS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
101 LIBS="-lnsl -lsocket -lresolv ${LIBS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
102 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
103 ;;
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
104 esac
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
105
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
106 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
107 echo "${i}Looks like you are running ${SYS}..."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
108 # Should probably check for RAND48, will add later if anybody complains
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
109 CCOPTIONS="-D${SYS} -DHAVE_RAND48 ${CCOPTIONS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
110
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
111
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
112 ############################################################################
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
113 ## compiler
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
114 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
115 echo $n "${i}Checking for cc or gcc...$c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
116
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
117 cat > test.c <<EOF
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
118 int main() { exit(0); }
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
119 EOF
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
120 err=`eval "(gcc test.c >/dev/null) 2>&1"`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
121 rm -f test.c a.out
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
122
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
123 if [ X"$err" != X ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
124 echo "using cc"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
125 CC=cc
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
126 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
127 echo "using gcc"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
128 CC=gcc
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
129 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
130
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
131 echo $n "
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
132 1 -- Basic optimization (-O -s)
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
133 2 -- Full optimization (-O2 -s)
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
134 3 -- Debug, no optimization (-g)
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
135
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
136 Specify optimization/debug state. [123] (default: 1) $c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
137
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
138 read DEBUG
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
139
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
140 if [ X${DEBUG} = X ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
141 DEBUG="1"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
142 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
143
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
144 if [ ${DEBUG} = "1" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
145 DEBUG="Basic optimization."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
146 CDEBUGFLAGS="-O -s"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
147 elif [ ${DEBUG} = "2" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
148 DEBUG="Full optimization."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
149 CDEBUGFLAGS="-O2 -s"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
150 elif [ ${DEBUG} = "3" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
151 while [ "${DEBUG}" = "3" ]; do
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
152 echo $n "
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
153 gdb -- GNU Debugger
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
154 dbx -- source level debugger
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
155 none -- no debugger
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
156 <other> -- other debugger
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
157
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
158 Use which debugger? (default: none) $c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
159 read DEBUGGER
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
160 if [ X${DEBUGGER} = X ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
161 DEBUGGER="none"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
162 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
163
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
164 if [ ${DEBUGGER} = "none" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
165 DEBUG="Debug (No debugger), no optimization"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
166 CDEBUGFLAGS="-g"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
167 elif [ ${DEBUGGER} = "gdb" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
168 DEBUG="Debug (GNU debugger), no optimization"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
169 CDEBUGFLAGS="-ggdb"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
170 elif [ ${DEBUGGER} = "dbx" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
171 DEBUG="Debug, no optimization"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
172 CDEBUGFLAGS="-gdbx"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
173 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
174 echo $n "${t}\"${DEBUGGER}\" is an unknown debugger, use anyway? [yn] (default: y) $c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
175 read ANSWER
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
176 if [ X${ANSWER} = X"y" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
177 DEBUG="Debug (Other: ${DEBUGGER}), no optimization"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
178 CDEBUGFLAGS="-g${DEBUGGER}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
179 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
180 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
181 done
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
182 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
183 echo "$0: unknown option \"${DEBUG}\", exiting."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
184 exit 1
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
185 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
186
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
187 #########################################################################
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
188
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
189 if [ -f "rsa/Makefile" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
190 echo $n "
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
191 You seem to have the RSA files. RSA verification is NOT required
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
192 for the server to function, and is usually enabled only on high
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
193 profile public servers.
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
194
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
195 Do you wish to enable RSA verification? [yn] (default: n) $c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
196
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
197 read ANSWER
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
198 if [ X${ANSWER} = X"y" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
199 RSA="-DAUTHORIZE"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
200 AUTHOBJS="rsa-server.o rsa_util.o reserved.o"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
201 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
202 RSA=""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
203 AUTHOBJS=""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
204 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
205 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
206 echo "
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
207 RSA files do not exist, RSA verification is not enabled (RSA
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
208 verification is not required for the server to run, and is
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
209 usually only enabled on high profile public servers)."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
210 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
211
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
212 ###########################################################################
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
213 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
214 echo $n "${i}Does the mp library exist...$c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
215
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
216 cat > test.c <<EOF
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
217 int main() { exit(0); }
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
218 int t() { main(); }
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
219 EOF
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
220
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
221 err=`eval "($CC test.c -lmp >/dev/null) 2>&1"`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
222 rm -f test.c a.out
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
223
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
224 if [ -z "$err" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
225 echo "yes."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
226 LIBS="-lmp ${LIBS}"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
227 if [ ! -z "$RSA" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
228 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
229 echo "${i}Using appropriate mp RSA files."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
230 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
231 AUTHOBJS="rsa-server.o rsa_utilmp.o reserved.o"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
232 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
233 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
234 echo "no."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
235 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
236
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
237 ###########################################################################
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
238 # strdup()
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
239
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
240 echo $n "${i}Does strdup() exist...$c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
241
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
242 cat > test.c <<EOF
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
243 #include <string.h>
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
244 main () { char *str, *str2 = "test\n"; str = strdup(str2); }
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
245 EOF
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
246
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
247 err=`eval "($CC test.c >/dev/null) 2>&1"`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
248 if [ ! -z "$err" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
249 CCOPTIONS="${CCOPTIONS} -DNO_STRDUP "
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
250 echo "no."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
251 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
252 echo "yes."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
253 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
254
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
255 rm -f test.c a.out
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
256
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
257 ##########################################################################
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
258 # qsort()
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
259
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
260 echo $n "${i}Does qsort() exist...$c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
261
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
262 cat > test.c <<EOF
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
263 #include <string.h>
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
264 main () { qsort(); }
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
265 EOF
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
266
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
267 err=`eval "($CC test.c >/dev/null) 2>&1"`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
268 rm -f test.c a.out
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
269
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
270 if [ ! -z "$err" ]; then
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
271 CCOPTIONS="${CCOPTIONS} -DNO_QSORT"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
272 echo "no."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
273 else
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
274 echo "yes."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
275 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
276
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
277 ##########################################################################
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
278
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
279 # This is inefficient to do it seperately for each option, but it is
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
280 # the cleanest way.
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
281
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
282 echo "sed \"s:^#@@LIBS@:LIBS=${LIBS}:g\" src/Makefile.in > /tmp/a\$\$.setup" > etc/$0.conf
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
283 echo "sed \"s:^#@@CC@:CC=${CC}:g\" /tmp/a\$\$.setup > /tmp/\$\$.setup" >> etc/$0.conf
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
284 echo "sed \"s:^#@@CDEBUGFLAGS@:CDEBUGFLAGS=${CDEBUGFLAGS}:g\" /tmp/\$\$.setup > /tmp/a\$\$.setup" >> etc/$0.conf
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
285 echo "sed \"s:^#@@RSA@:RSA=${RSA}:g\" /tmp/a\$\$.setup > /tmp/\$\$.setup" >> etc/$0.conf
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
286 echo "sed \"s:^#@@AUTHOBJS@:AUTHOBJS=${AUTHOBJS}:g\" /tmp/\$\$.setup > /tmp/a\$\$.setup" >> etc/$0.conf
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
287 echo "sed \"s:^#@@CCOPTIONS@:CCOPTIONS=${CCOPTIONS}:g\" /tmp/a\$\$.setup > /tmp/\$\$.setup" >> etc/$0.conf
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
288 echo "echo \$\$" >> etc/$0.conf
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
289
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
290 # This 'fi' is from the first if (checking "-d")
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
291 fi
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
292
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
293 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
294 echo $n "${i}Generating \"src/Makefile\" from \"src/Makefile.in\"...$c"
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
295
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
296 SPID=`sh etc/$0.conf`
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
297
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
298 echo "# This file generated by \"$0\" on `date`." > /tmp/${SPID}.Makefile
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
299 echo "# Make changes to \"Makefile.in\" and run the setup script" >> /tmp/${SPID}.Makefile
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
300 echo "#" >> /tmp/${SPID}.Makefile
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
301
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
302 cat /tmp/${SPID}.Makefile > src/Makefile
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
303 cat /tmp/${SPID}.setup >> src/Makefile
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
304
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
305 rm -f /tmp/${SPID}.setup
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
306 rm -f /tmp/a${SPID}.setup
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
307 rm -f /tmp/${SPID}.Makefile
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
308
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
309 echo "Done."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
310 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
311 echo " use 'make <option>' to compile the server."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
312 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
313 echo " To change the server game configuration check the file \"src/config.h\"."
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
314 echo ""
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
315
4d6502ffaa5e Initial revision
darius
parents:
diff changeset
316 exit