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