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