forked from FIDOSOFT/maximus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·267 lines (229 loc) · 6.54 KB
/
configure
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#! /bin/sh
#
# @description Simple Configuration script for Maximus/UNIX.
# @note This script should stay BOURNE SHELL compatible. No bashisms, please.
#
# @author Wes Garland; [email protected]
# @date May 23 2003
#
# $Id: configure,v 1.7 2003/06/13 04:14:04 wesgarland Exp $
#
OUTPUT='vars_local.mk'
nonlecho()
{
if [ -f "/usr/bin/printf" ] || [ -f "/bin/printf" ]; then
if [ "$2" ]; then
printf '%s' "$*"
else
printf "$1"
fi
else
if [ -f "/usr/ucb/echo" ]; then
/usr/ucb/echo -n "$*"
else
echo -n "$*"
fi
fi
return 0 # true
}
beep()
{
nonlecho "\007"
return 0 # true
}
if [ "${UID}" = "0" ] || [ "`id -u 2>/dev/null`" = "0" ] || [ "${USER}" = "root" ] || [ "${LOGNAME}" = "root" ]; then
echo
echo "WARNING WARNING WARNING WARNING WARNING"
echo
echo "This script should not be run as root!"
nonlecho "Press ^C to abort, or enter to continue:"
read line
echo
fi
locate()
{
search="$1"
shift
prefPath="$*"
[ ! "${search}" ] && return 1
OLDIFS="${IFS}"
IFS=":"
set -- ${prefPath} ${searchPath} ""
IFS="$OLDIFS"
while [ "$1" ]
do
[ -x "$1/${search}" ] && echo "$1/${search}" && return 0
shift
done
}
find()
{
label="$1"
progList="$2"
shift 2
for prog in `echo ${progList} | sed 's/,/ /g'`
do
eval ${label}=\"\`locate ${prog} $*\`\"
eval [ \"\$${label}\" ] && break
done
if eval [ \"\$${label}\" ]; then
eval echo "Found ${prog} as \$${label}"
eval echo "${label}=\$${label}" >> ${OUTPUT}
else
echo "Warning: Did not find ${prog}" >&2
fi
}
PREFIX="/var/max"
SRC="`pwd`"
OLDIFS="${IFS}"
IFS="=${OLDIFS}"
set -- $* ""
IFS="${OLDIFS}"
BUILD=DEVEL
while [ "$1" ]
do
case "$1" in
"--help" | "-h")
echo "Usage: ./configure [options]"
echo "Options:"
echo " --prefix=DIR sets the installation directory [${PREFIX}]"
echo " --help generates this help file"
echo " --source sets the location of the source tree [${SRC}]"
echo " --build=[mode] Sets build mode to DEVEL|DEBUG|PROFILE|RELEASE [${BUILD}]"
exit 0
;;
"--prefix")
PREFIX="$2"
shift 2
;;
"--source" | "--src")
SRC="$2"
shift 2
;;
"--build")
BUILD="$2"
[ "${BUILD}" != "DEVEL" ] && \
[ "${BUILD}" != "RELEASE" ] && \
[ "${BUILD}" != "PROFILE" ] && \
[ "${BUILD}" != "DEBUG" ] && \
echo "Error: --build must be set to DEVEL, DEBUG, PROFILE, or RELEASE" >&2 && exit 1
shift 2
;;
*)
set -- "--help"
;;
esac
done
echo "Configuring Maximus.."
echo
searchPath="${PATH}:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/ccs/bin:/usr/ucb"
if [ ! -f "configure" ] || [ ! -f "vars.mk.configure" ]; then
echo "Error: This script must be run from the directory" >&2
echo " where you unpacked Maximus!" >&2
exit 1
fi
[ ! -f "${OUTPUT}" ] && firstTime=yes
[ -f "${OUTPUT}" ] && mv -f "${OUTPUT}" "${OUTPUT}~"
find CC gcc
find CXX g++,gcc
find MAKE gmake,make
find AR ar
find RANLIB ranlib
find YACC bison,yacc /usr/ccs/bin
find SED sed
find RM rm
find MV mv
find INSTALL install /usr/ucb
find UNAME uname
find MAKEDEPEND makedepend /usr/openwin/bin /usr/X11R6/bin
[ ! "${SED}" ] && SED=sed
[ ! "${UNAME}" ] && UNAME=uname
[ ! "${MAKE}" ] && MAKE=make
export MAKE
PLATFORM=`${UNAME} -s | ${SED} 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
echo
echo "The file 'vars_${PLATFORM}.mk' will be used for various platform-dependant"
echo "rules and build options."
echo
if [ ! -f "${PLATFORM}.mk" ]; then
echo "Please insure that it makes sense for your platform. If it does not,"
echo "fix it, and submit your changes back to the Maximus development team."
else
echo "Your platform has not been tested yet; as such the file does not exist."
echo "Please take a look at the other files, and create one for your platform."
echo "Once you get it working, submit it back to the Maximus development team."
fi
echo
echo "If you have any installation-specific changes to make, you can edit"
echo "the file '${OUTPUT}'."
echo
if [ "${firstTime}" ]; then
nonlecho "Press ^C to abort, or enter to continue:"
read line
fi
echo
echo "Creating vars.mk; using PREFIX=${PREFIX}"
echo "PREFIX=${PREFIX}" > vars.mk
echo "SRC=${SRC}" >> vars.mk
echo "COMP=unix" >> vars.mk
echo "PLATFORM=${PLATFORM}" >> vars.mk
echo "BUILD=${BUILD}" >> vars.mk
echo "" >> vars.mk
echo "# Build platform: `uname -a`" >> vars.mk
if [ "${LOGNAME}" ]; then
BUILDER="${LOGNAME}"
else
BUILDER="${USER}"
fi
[ ! "${BUILDER}" ] && BUILDER="`id -un`" # GNU id
echo "# Configured `date` by ${BUILDER}" >> vars.mk
echo "" >> vars.mk
cat vars.mk.configure >> vars.mk
echo
${MAKE} -f Makefile usage
echo
echo Testing your build environment..
echo
cd configuration-tests
${MAKE} clean >/dev/null 2>&1
./make.sh || exit $?
echo "Testing your C compiler.."
${MAKE} c_compiler >/dev/null || exit $?
./c_compiler || (echo "Your C Compiler does not work!" && exit 1)
echo " - Looks fine to me!"
echo "Determining platform endianness.."
${MAKE} endian >/dev/null || (err=$? && echo "Error $err compiling endian.c" && exit $err)
./endian " - Chose %s" 2>/dev/null
echo
echo "/* Automatically generated by configure */" > ../slib/compiler_details.h
echo "/* Generated: `date` */" >> ../slib/compiler_details.h
echo >> ../slib/compiler_details.h
echo "#ifndef _COMPILER_DETAILS_H" >> ../slib/compiler_details.h
echo "#define _COMPILER_DETAILS_H" >> ../slib/compiler_details.h
echo "#undef BIG_ENDIAN" >> ../slib/compiler_details.h
echo "#undef LITTLE_ENDIAN" >> ../slib/compiler_details.h
./endian '#define %s' >> ../slib/compiler_details.h || (err=$? && echo " + Error $err running endian test" && exit $err)
echo >> ../slib/compiler_details.h
echo "#endif /* _COMPILER_DETAILS_H */" >> ../slib/compiler_details.h
${MAKE} stamp_combo >/dev/null || (err=$? && echo "Error $err compiling stamp_combo.c" && exit $err)
./stamp_combo || exit $?
cd ..
if [ ! -d "install_tree" ]; then
beep
echo "Warning: could not find install_tree. Did you forget to unpack max-3.03-etc.tar.gz?"
exit 1
fi
echo
echo "Configuration complete."
echo
[ ! -d "${PREFIX}" ] && mkdir -p ${PREFIX} 2>/dev/null
if [ ! -d "${PREFIX}" ]; then
echo "You can build Maximus and Squish without creating ${PREFIX},"
echo "however you will probably need to become root to install,"
echo "or at least create ${PREFIX} with appropriate permissions."
echo
fi
echo "Post-Install, it would be wise to make a bbs user and"
echo "group, and change directory ownerships appropriately."
echo "'chmod -R bbs:bbs ${PREFIX}' should work nicely."
echo