1 |
matty |
30 |
#!/bin/sh |
2 |
|
|
# |
3 |
|
|
# rdesktop: A Remote Desktop Protocol client |
4 |
|
|
# configure script |
5 |
matthewc |
207 |
# Copyright (C) Matthew Chapman 1999-2002 |
6 |
matty |
30 |
# |
7 |
|
|
|
8 |
matthewc |
202 |
echo "rdesktop build configuration script" |
9 |
|
|
echo |
10 |
|
|
|
11 |
matty |
30 |
echo "# Generated by $0 $*" >Makeconf |
12 |
|
|
|
13 |
matthewc |
156 |
|
14 |
matthewc |
189 |
# Process command line options |
15 |
matthewc |
156 |
|
16 |
matthewc |
298 |
cflags='-DKEYMAP_PATH=\"$(KEYMAP_PATH)\"' |
17 |
|
|
ldflags='' |
18 |
matthewc |
221 |
rpath= |
19 |
matthewc |
156 |
|
20 |
matty |
30 |
for arg in $*; do |
21 |
matthewc |
220 |
optarg=`echo $arg | sed 's/[-a-z]*=//'` |
22 |
matty |
30 |
case $arg in |
23 |
|
|
--prefix=*) |
24 |
matthewc |
156 |
echo "prefix = $optarg" >>Makeconf |
25 |
matty |
30 |
;; |
26 |
|
|
--exec-prefix=*) |
27 |
matthewc |
156 |
echo "exec_prefix = $optarg" >>Makeconf |
28 |
matty |
30 |
;; |
29 |
|
|
--bindir=*) |
30 |
matthewc |
156 |
echo "bindir = $optarg" >>Makeconf |
31 |
matty |
30 |
;; |
32 |
|
|
--mandir=*) |
33 |
matthewc |
156 |
echo "mandir = $optarg" >>Makeconf |
34 |
matty |
30 |
;; |
35 |
astrand |
98 |
--sharedir=*) |
36 |
matthewc |
156 |
echo "datadir = $optarg" >>Makeconf |
37 |
astrand |
98 |
;; |
38 |
matthewc |
220 |
--with-x*) |
39 |
|
|
extraxdir=$optarg |
40 |
|
|
;; |
41 |
matty |
32 |
--with-openssl*) |
42 |
matthewc |
220 |
extrassldir=$optarg |
43 |
matty |
32 |
;; |
44 |
|
|
--without-openssl*) |
45 |
astrand |
267 |
withoutopenssl=yes |
46 |
matty |
32 |
;; |
47 |
matthewc |
220 |
--with-egd-socket=*) |
48 |
|
|
extraegdpath=$optarg |
49 |
|
|
;; |
50 |
astrand |
333 |
--with-libvncserver) |
51 |
|
|
withvncserver=yes |
52 |
|
|
;; |
53 |
|
|
--with-libvncserver-config=*) |
54 |
|
|
vncserverconfig=$optarg |
55 |
|
|
;; |
56 |
astrand |
63 |
--with-debug) |
57 |
matthewc |
189 |
cflags="$cflags -g -DWITH_DEBUG" |
58 |
matty |
30 |
;; |
59 |
astrand |
63 |
--with-debug-kbd) |
60 |
matthewc |
189 |
cflags="$cflags -g -DWITH_DEBUG_KBD" |
61 |
astrand |
63 |
;; |
62 |
forsberg |
341 |
--with-debug-rdp5) |
63 |
|
|
cflags="$cflags -g -DWITH_DEBUG_RDP5" |
64 |
|
|
;; |
65 |
forsberg |
403 |
--with-debug-clipboard) |
66 |
|
|
cflags="$cflags -g -DWITH_DEBUG_CLIPBOARD" |
67 |
|
|
;; |
68 |
matty |
30 |
--without-debug*) |
69 |
|
|
;; |
70 |
stargo |
605 |
--with-ipv6) |
71 |
|
|
cflags="$cflags -DIPv6" |
72 |
|
|
;; |
73 |
matty |
30 |
*) |
74 |
|
|
echo "Target directories:" |
75 |
matthewc |
220 |
echo " --prefix=PREFIX location for architecture-independent files" |
76 |
|
|
echo " --exec-prefix=EPREFIX location for architecture-dependent files" |
77 |
|
|
echo " --bindir=BINDIR location for program binaries [EPREFIX/bin]" |
78 |
|
|
echo " --mandir=MANDIR location for man pages [PREFIX/man]" |
79 |
|
|
echo " --sharedir=SHAREDIR location for architecture-independent shared files [PREFIX/share/rdesktop]" |
80 |
matty |
30 |
echo |
81 |
|
|
echo "Build configuration:" |
82 |
matthewc |
220 |
echo " --with-x=DIR look for X Window System at DIR/include, DIR/lib" |
83 |
|
|
echo " --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib" |
84 |
matthewc |
523 |
#echo " --without-openssl use in-tree crypto, even if OpenSSL is available" |
85 |
matthewc |
220 |
echo " --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH" |
86 |
astrand |
333 |
echo " --with-libvncserver make rdp2vnc" |
87 |
|
|
echo " --with-libvncserver-config=CMD" |
88 |
|
|
echo " use CMD as libvncserver-config" |
89 |
matthewc |
220 |
echo " --with-debug enable protocol debugging output" |
90 |
|
|
echo " --with-debug-kbd enable debugging of keyboard handling" |
91 |
forsberg |
403 |
echo " --with-debug-rdp5 enable debugging of RDP5 code" |
92 |
|
|
echo " --with-debug-clipboard enable debugging of clipboard code" |
93 |
stargo |
605 |
echo " --with-ipv6 enable support for IPv6" |
94 |
matty |
30 |
echo |
95 |
|
|
rm -f Makeconf |
96 |
|
|
exit 1 |
97 |
|
|
;; |
98 |
|
|
esac |
99 |
|
|
done |
100 |
|
|
|
101 |
matthewc |
189 |
|
102 |
matthewc |
258 |
# Find compiler |
103 |
|
|
|
104 |
|
|
compilers="$CC gcc cc" |
105 |
|
|
|
106 |
|
|
for compiler in $compilers; do |
107 |
|
|
if [ -x "`which $compiler`" ]; then |
108 |
|
|
cc=$compiler |
109 |
|
|
break |
110 |
|
|
fi |
111 |
|
|
done |
112 |
|
|
|
113 |
|
|
if [ -z "$cc" ]; then |
114 |
|
|
echo "ERROR: could not find a C compiler (tried: $compilers)" |
115 |
|
|
echo "You probably want to install gcc" |
116 |
|
|
exit 1 |
117 |
|
|
fi |
118 |
|
|
|
119 |
|
|
echo "CC = $cc" >>Makeconf |
120 |
|
|
|
121 |
|
|
if $cc -v 2>&1 |grep '^gcc' >/dev/null; then |
122 |
|
|
cflags="$cflags -Wall -O2" |
123 |
|
|
else |
124 |
|
|
cflags="$cflags -O" |
125 |
|
|
fi |
126 |
|
|
|
127 |
|
|
|
128 |
matthewc |
515 |
# Find install program |
129 |
|
|
|
130 |
|
|
if [ -z "$INSTALL" ]; then |
131 |
|
|
# Want BSD install |
132 |
|
|
if [ -x /usr/ucb/installbsd ]; then |
133 |
|
|
INSTALL=/usr/ucb/installbsd |
134 |
|
|
elif [ -x /usr/ucb/install ]; then |
135 |
|
|
INSTALL=/usr/ucb/install |
136 |
|
|
else |
137 |
|
|
INSTALL=install |
138 |
|
|
fi |
139 |
|
|
fi |
140 |
|
|
|
141 |
|
|
echo "INSTALL = $INSTALL" >>Makeconf |
142 |
|
|
|
143 |
|
|
|
144 |
matthewc |
189 |
# Find X installation |
145 |
|
|
|
146 |
matthewc |
220 |
xdirs="$extraxdir /usr/X11R6 /usr/X11 /usr/openwin /usr /usr/local/X11R6 /usr/local/X11 /usr/local" |
147 |
matthewc |
189 |
|
148 |
|
|
for dir in $xdirs; do |
149 |
|
|
if [ -f $dir/include/X11/Xlib.h ]; then |
150 |
|
|
xdir=$dir |
151 |
|
|
break |
152 |
|
|
fi |
153 |
|
|
done |
154 |
|
|
|
155 |
|
|
if [ -z "$xdir" ]; then |
156 |
|
|
echo "ERROR: could not find X Window System headers" |
157 |
matthewc |
220 |
echo "(searched for include/X11/Xlib.h in: $xdirs)" |
158 |
matthewc |
189 |
|
159 |
|
|
# additional helpful information for Linux users |
160 |
matthewc |
451 |
if [ -f /etc/redhat-release ]; then |
161 |
matthewc |
189 |
echo You probably need to install the XFree86-devel package |
162 |
|
|
elif [ -f /etc/debian_version ]; then |
163 |
|
|
echo You probably need to install the xlibs-dev package |
164 |
|
|
fi |
165 |
|
|
exit 1 |
166 |
|
|
fi |
167 |
|
|
|
168 |
matthewc |
202 |
echo "X Window System:" |
169 |
|
|
echo " includes $xdir/include" |
170 |
|
|
echo " libraries $xdir/lib" |
171 |
|
|
echo |
172 |
|
|
|
173 |
matthewc |
189 |
if [ $xdir != "/usr" ]; then |
174 |
|
|
cflags="$cflags -I$xdir/include" |
175 |
|
|
ldflags="$ldflags -L$xdir/lib" |
176 |
matthewc |
221 |
rpath="$rpath:$xdir/lib" |
177 |
matthewc |
189 |
fi |
178 |
|
|
|
179 |
astrand |
333 |
ldflags="$ldflags" |
180 |
|
|
targets="$targets rdesktop" |
181 |
matthewc |
189 |
|
182 |
matthewc |
523 |
#withoutopenssl not currently supported |
183 |
|
|
#if [ -z "$withoutopenssl" ]; then |
184 |
astrand |
267 |
# Find OpenSSL installation if available |
185 |
|
|
ssldirs="$extrassldir /usr/openssl /usr/ssl /usr /usr/local/openssl /usr/local/ssl /usr/local" |
186 |
|
|
|
187 |
|
|
for dir in $ssldirs; do |
188 |
|
|
if [ -f $dir/include/openssl/rc4.h ]; then |
189 |
|
|
ssldir=$dir |
190 |
|
|
break |
191 |
|
|
fi |
192 |
|
|
done |
193 |
|
|
|
194 |
|
|
if [ -z "$ssldir" ]; then |
195 |
matthewc |
523 |
echo "ERROR: could not find OpenSSL headers" |
196 |
|
|
echo "(searched for include/openssl/rc4.h in: $ssldirs)" |
197 |
|
|
# additional helpful information for Linux users |
198 |
|
|
if [ -f /etc/redhat-release ]; then |
199 |
|
|
echo You probably need to install the openssl-devel package |
200 |
|
|
elif [ -f /etc/debian_version ]; then |
201 |
|
|
echo You probably need to install the libssl-dev package |
202 |
|
|
fi |
203 |
|
|
exit 1 |
204 |
astrand |
267 |
else |
205 |
|
|
echo "OpenSSL:" |
206 |
|
|
echo " includes $ssldir/include" |
207 |
|
|
echo " libraries $ssldir/lib" |
208 |
|
|
echo |
209 |
|
|
|
210 |
|
|
echo "CRYPTOBJ =" >>Makeconf |
211 |
|
|
|
212 |
|
|
if [ $ssldir != "/usr" ]; then |
213 |
|
|
cflags="$cflags -I$ssldir/include" |
214 |
|
|
ldflags="$ldflags -L$ssldir/lib" |
215 |
|
|
rpath="$rpath:$ssldir/lib" |
216 |
|
|
fi |
217 |
|
|
|
218 |
|
|
cflags="$cflags -DWITH_OPENSSL" |
219 |
|
|
ldflags="$ldflags -lcrypto" |
220 |
matthewc |
189 |
fi |
221 |
matthewc |
523 |
#fi |
222 |
astrand |
267 |
|
223 |
astrand |
333 |
if [ ! -z "$withvncserver" ]; then |
224 |
|
|
if [ -z "$vncserverconfig" ]; then |
225 |
|
|
vncserverconfig=libvncserver-config |
226 |
|
|
fi |
227 |
matthewc |
189 |
|
228 |
astrand |
333 |
echo "VNCINC=`$vncserverconfig --cflags`" >> Makeconf |
229 |
|
|
echo "LDVNC=`$vncserverconfig --libs`" >> Makeconf |
230 |
|
|
echo "CCLD=`$vncserverconfig --link`" >> Makeconf |
231 |
|
|
echo >> Makeconf |
232 |
|
|
targets="$targets rdp2vnc" |
233 |
|
|
|
234 |
|
|
echo "Found libvncserver: Building rdp2vnc" |
235 |
|
|
fi |
236 |
|
|
|
237 |
|
|
|
238 |
matthewc |
220 |
# Find EGD socket if we don't have /dev/urandom or /dev/random |
239 |
matthewc |
221 |
|
240 |
matthewc |
220 |
if [ ! -c /dev/random -a ! -c /dev/urandom ]; then |
241 |
|
|
egdpaths="$extraegdpath /var/run/egd-pool /dev/egd-pool /etc/egd-pool /etc/entropy" |
242 |
|
|
|
243 |
|
|
for path in $egdpaths; do |
244 |
|
|
# -e isn't portable, so we use -r |
245 |
|
|
if [ -r $path ]; then |
246 |
|
|
egdpath=$path |
247 |
|
|
break |
248 |
|
|
fi |
249 |
|
|
done |
250 |
|
|
|
251 |
|
|
if [ -z "$egdpath" ]; then |
252 |
|
|
echo "WARNING: could not find /dev/urandom, /dev/random or Entropy Gathering Daemon (EGD) socket" |
253 |
|
|
echo "(searched: $egdpaths)" |
254 |
|
|
echo "Session keys may be less secure; installing a system randomness source is recommended." |
255 |
|
|
echo |
256 |
|
|
else |
257 |
|
|
echo "Entropy Gathering Daemon (EGD):" |
258 |
|
|
echo " socket $egdpath" |
259 |
|
|
echo |
260 |
|
|
cflags="$cflags -DEGD_SOCKET=\\\"$egdpath\\\"" |
261 |
|
|
fi |
262 |
|
|
fi |
263 |
|
|
|
264 |
matthewc |
474 |
# Check for OSS sound support |
265 |
matthewc |
221 |
|
266 |
matthewc |
474 |
if [ -f /usr/include/sys/soundcard.h ]; then |
267 |
|
|
echo Sound support enabled: Open Sound System |
268 |
|
|
echo |
269 |
|
|
echo "SOUNDOBJ = rdpsnd.o rdpsnd_oss.o" >>Makeconf |
270 |
|
|
cflags="$cflags -DWITH_RDPSND" |
271 |
matthewc |
477 |
elif [ -f /usr/include/sys/audioio.h ]; then |
272 |
stargo |
560 |
echo Sound support enabled: Sun/BSD |
273 |
matthewc |
476 |
echo |
274 |
|
|
echo "SOUNDOBJ = rdpsnd.o rdpsnd_sun.o" >>Makeconf |
275 |
|
|
cflags="$cflags -DWITH_RDPSND" |
276 |
matthewc |
474 |
else |
277 |
stargo |
603 |
echo "WARNING: sound support disabled (no /usr/include/sys/soundcard.h or /usr/include/sys/audioio.h)" |
278 |
matthewc |
476 |
echo "Currently supported systems are Open Sound System and Sun" |
279 |
matthewc |
474 |
echo |
280 |
|
|
fi |
281 |
|
|
|
282 |
|
|
|
283 |
matthewc |
221 |
# Platform-specific options |
284 |
|
|
|
285 |
|
|
# strip leading colon from rpath |
286 |
|
|
rpath=`echo $rpath |sed 's/^://'` |
287 |
|
|
|
288 |
|
|
case `uname -s` in |
289 |
|
|
SunOS) |
290 |
|
|
ldflags="$ldflags -lsocket -lnsl -R$rpath" |
291 |
|
|
;; |
292 |
|
|
OSF1) |
293 |
|
|
ldflags="$ldflags -Wl,-rpath,$rpath" |
294 |
|
|
;; |
295 |
matthewc |
536 |
HP-UX) |
296 |
|
|
cflags="$cflags -D_XOPEN_SOURCE_EXTENDED" |
297 |
|
|
;; |
298 |
matthewc |
221 |
esac |
299 |
|
|
|
300 |
|
|
|
301 |
matthewc |
298 |
echo "CFLAGS = $cflags" >>Makeconf |
302 |
|
|
echo "LDFLAGS = $ldflags" >>Makeconf |
303 |
astrand |
333 |
echo "TARGETS = $targets" >>Makeconf |
304 |
matthewc |
189 |
|
305 |
matty |
30 |
echo "configure complete - now run make" |
306 |
matthewc |
221 |
|