-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·280 lines (230 loc) · 6.2 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
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/bin/sh
# configure
#
# Aikido Language System,
# export version: 1.00
# Copyright (c) 2002 Sun Microsystems, Inc.
#
# Sun Public License Notice
#
# The contents of this file are subject to the Sun Public License Version
# 1.0 (the "License"). You may not use this file except in compliance with
# the License. A copy of the License is included as the file "license.terms",
# and also available at http://www.sun.com/
#
# The Original Code is from:
# Aikido Language System release 1.00
# The Initial Developer of the Original Code is: David Allison
# Portions created by David Allison are Copyright (C) Sun Microsystems, Inc.
# All Rights Reserved.
#
# Contributor(s): dallison
#
# Version: 1.5
# Created by dallison on 4/19/2002
# Last modified by dallison on 03/07/29
#/
#
# build the top level Makefile for the platform upon which
# this is being run
#
# enable this for debug
#set -x
# parse the args
prefix=/usr/local
forcegcc=0
gcccmd=gcc
usage="Usage: configure [--prefix=dir] [--gcc=cmd]"
while test $# -gt 0 ; do
case "$1" in
--prefix=*)
prefix="`echo \"$1\" | sed -e 's/^[^=]*=//'`"
shift
;;
--prefix)
shift
test $# -eq 0 && { echo "$usage" 1>&2 ; exit 1; }
prefix=$1
shift
;;
--gcc)
shift
forcegcc=1
;;
--gcc=*)
gcccmd="`echo \"$1\" | sed -e 's/^[^=]*=//'`"
shift
forcegcc=1
;;
*) echo "$usage" ; exit 1 ;;
esac
done
sys=`uname`
# find the OS
os=
case "$sys" in
SunOS) os=solaris ;;
Linux) os=linux ;;
Darwin) os=macosx ;;
CYGWIN*) os=cygwin ;;
*) echo "Unknown operating system $sys" ; exit 1 ;;
esac
echo Configuring for $os compilation
# look for the C++ compiler
SunCC=CC
SunCCVersion="Sun WorkShop 6"
GCC=$gcccmd
makefile=
case $os in
solaris)
# for Solaris, the compiler of choice is the Sun CC compiler
# as the executable generated by the optimizer is a lot
# faster than that generated by gcc 2.95
cc=`type $SunCC` # Sun CC?
if [ $forcegcc -eq 0 ] && [ `echo "$cc" | grep 'not found' | wc -l` -eq 0 ]
then
version=`$SunCC -V 2>&1`
if [ `echo "$version" | grep "$SunCCVersion" | wc -l` -eq 0 ]
then
echo "Can only use version $SunCCVersion of Sun CC"
echo "I found version $version"
exit 3
fi
makefile=Makefile.solaris
echo Compiler is Sun CC
else
cc=`type $GCC`
if [ `echo "$cc" | grep 'not found' | wc -l` -ne 0 ]
then
echo "Cannot find a C++ compiler on your system"
exit 2
fi
makefile=Makefile.gcc
echo Compiler is gcc
fi
;;
linux)
makefile=Makefile.linux
;;
macosx)
makefile=Makefile.macosx
;;
cygwin)
makefile=Makefile.cygwin
;;
esac
# look for the zip command
zipcmd="zip -0 -u -v"
zipexec=`type zip`
if [ `echo "$zipexec" | grep 'not found' | wc -l` -ne 0 ] # can't find zip?
then
zipexec=`type jar`
if [ `echo "$zipexec" | grep 'not found' | wc -l` -ne 0 ]
then
echo "Can't find either zip or jar command, please put one in your path"
exit 4
else
# check for -u in the jar command
jarhelp=`jar -help 2>&1 | grep -- -u | wc -l`
if [ $jarhelp -eq 0 ]
then
echo "The jar command does not support the -u option, you need a newer version"
type jar
exit 6
fi
zipcmd="jar uvf0"
fi
fi
gtkinc=
glibinc=
gtktarget=
findgtk() {
gtk=`type gtk-config 2>&1`
if [ `echo "$gtk" | grep 'not found' | wc -l` -ne 0 ]
then
echo "Warning: Can't find GTK+ (looking for gtk-config)"
else
gtkversion=`gtk-config --version`
if [ `echo "$gtkversion" | grep '1\.2' | wc -l` -ne 0 ]
then
v=`echo "$gtkversion" | sed -e s/1\.2\.//`
if [ "$v" -lt 8 ]
then
echo "Warning: Need at least version 1.2.8 of GTK+"
return
fi
fi
gtkinc=`gtk-config --cflags`
glib=`type glib-config 2>&1`
if [ `echo "$glib" | grep 'not found' | wc -l` -ne 0 ]
then
echo "Warning: Can't find GLIB (looking for glib-config)"
return
fi
glibversion=`glib-config --version`
if [ `echo "$glibversion" | grep '1\.2' | wc -l` -ne 0 ]
then
v=`echo "$glibversion" | sed -e s/1\.2\.//`
if [ "$v" -lt 8 ]
then
echo "Warning: Need at least version 1.2.8 of GLIB"
return
fi
fi
glibinc=`glib-config --cflags`
gtktarget=xgtk
fi
}
findgtk
# now write the Makefile
cat > Makefile <<EOF
#
# Makefile generated by configure. If you modify it by hand you might
# lose the edits if configure is run again
#
EOF
if [ "$gtktarget" = "" ]
then
cat >> Makefile << EOF
# This does not include GTK+ targets. If you download GTK+ and wish
# to use it, please rerun configure
EOF
fi
cat >> Makefile << EOF
dest ?= /usr/local
default:
\$(MAKE) -f $makefile default $gtktarget GTKINC="$gtkinc" GLIBINC="$glibinc" ZIPCMD="$zipcmd" CCCMD="$GCC"
clean:
\$(MAKE) -f $makefile clean
opt:
\$(MAKE) -f $makefile opt GTKINC="$gtkinc" GLIBINC="$glibinc" ZIPCMD="$zipcmd" CCCMD="$GCC"
debug _debug:
\$(MAKE) -f $makefile debug GTKINC="$gtkinc" GLIBINC="$glibinc" ZIPCMD="$zipcmd" CCCMD="$GCC"
rpm:
\$(MAKE) -f $makefile rpm GTKINC="$gtkinc" GLIBINC="$glibinc" ZIPCMD="$zipcmd" CCCMD="$GCC"
qrpm:
\$(MAKE) -f $makefile qrpm GTKINC="$gtkinc" GLIBINC="$glibinc" ZIPCMD="$zipcmd" CCCMD="$GCC"
xtras:
\$(MAKE) -C extras -f $makefile all
EOF
if [ "$gtktarget" != "" ]
then
cat >> Makefile << EOF
gtk:
\$(MAKE) -f $makefile gtk GTKINC="$gtkinc" GLIBINC="$glibinc" CCCMD="$GCC"
EOF
fi
if [ "$os" = linux ]
then
cat >> Makefile << EOF
install:
./aikido-install \$(dest)
EOF
else
cat >> Makefile << EOF
PREFIX=$prefix
install:
./aikido-install \$(PREFIX)
EOF
fi
echo Makefile created