1 |
#!/bin/sh |
2 |
# |
3 |
# rdesktop: A Remote Desktop Protocol client |
4 |
# configure script |
5 |
# Copyright (C) Matthew Chapman 1999-2002 |
6 |
# |
7 |
|
8 |
echo "rdesktop build configuration script" |
9 |
echo |
10 |
|
11 |
echo "# Generated by $0 $*" >Makeconf |
12 |
|
13 |
|
14 |
# Process command line options |
15 |
|
16 |
cflags='-DKEYMAP_PATH=\"$(KEYMAP_PATH)\"' |
17 |
ldflags='' |
18 |
rpath= |
19 |
|
20 |
for arg in $*; do |
21 |
optarg=`echo $arg | sed 's/[-a-z]*=//'` |
22 |
case $arg in |
23 |
--prefix=*) |
24 |
echo "prefix = $optarg" >>Makeconf |
25 |
;; |
26 |
--exec-prefix=*) |
27 |
echo "exec_prefix = $optarg" >>Makeconf |
28 |
;; |
29 |
--bindir=*) |
30 |
echo "bindir = $optarg" >>Makeconf |
31 |
;; |
32 |
--mandir=*) |
33 |
echo "mandir = $optarg" >>Makeconf |
34 |
;; |
35 |
--sharedir=*) |
36 |
echo "datadir = $optarg" >>Makeconf |
37 |
;; |
38 |
--with-x*) |
39 |
extraxdir=$optarg |
40 |
;; |
41 |
--with-openssl*) |
42 |
extrassldir=$optarg |
43 |
;; |
44 |
--without-openssl*) |
45 |
withoutopenssl=yes |
46 |
;; |
47 |
--with-egd-socket=*) |
48 |
extraegdpath=$optarg |
49 |
;; |
50 |
--with-libvncserver) |
51 |
withvncserver=yes |
52 |
;; |
53 |
--with-libvncserver-config=*) |
54 |
vncserverconfig=$optarg |
55 |
;; |
56 |
--with-debug) |
57 |
cflags="$cflags -g -DWITH_DEBUG" |
58 |
;; |
59 |
--with-debug-kbd) |
60 |
cflags="$cflags -g -DWITH_DEBUG_KBD" |
61 |
;; |
62 |
--with-debug-rdp5) |
63 |
cflags="$cflags -g -DWITH_DEBUG_RDP5" |
64 |
;; |
65 |
--with-debug-clipboard) |
66 |
cflags="$cflags -g -DWITH_DEBUG_CLIPBOARD" |
67 |
;; |
68 |
--without-debug*) |
69 |
;; |
70 |
*) |
71 |
echo "Target directories:" |
72 |
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 |
echo |
78 |
echo "Build configuration:" |
79 |
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 |
echo " --without-openssl use in-tree crypto, even if OpenSSL is available" |
82 |
echo " --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH" |
83 |
echo " --with-libvncserver make rdp2vnc" |
84 |
echo " --with-libvncserver-config=CMD" |
85 |
echo " use CMD as libvncserver-config" |
86 |
echo " --with-debug enable protocol debugging output" |
87 |
echo " --with-debug-kbd enable debugging of keyboard handling" |
88 |
echo " --with-debug-rdp5 enable debugging of RDP5 code" |
89 |
echo " --with-debug-clipboard enable debugging of clipboard code" |
90 |
echo |
91 |
rm -f Makeconf |
92 |
exit 1 |
93 |
;; |
94 |
esac |
95 |
done |
96 |
|
97 |
|
98 |
# 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 |
# Find X installation |
125 |
|
126 |
xdirs="$extraxdir /usr/X11R6 /usr/X11 /usr/openwin /usr /usr/local/X11R6 /usr/local/X11 /usr/local" |
127 |
|
128 |
for dir in $xdirs; do |
129 |
if [ -f $dir/include/X11/Xlib.h ]; then |
130 |
xdir=$dir |
131 |
break |
132 |
fi |
133 |
done |
134 |
|
135 |
if [ -z "$xdir" ]; then |
136 |
echo "ERROR: could not find X Window System headers" |
137 |
echo "(searched for include/X11/Xlib.h in: $xdirs)" |
138 |
|
139 |
# additional helpful information for Linux users |
140 |
if [ -f /etc/redhat_release ]; then |
141 |
echo You probably need to install the XFree86-devel package |
142 |
elif [ -f /etc/debian_version ]; then |
143 |
echo You probably need to install the xlibs-dev package |
144 |
fi |
145 |
exit 1 |
146 |
fi |
147 |
|
148 |
echo "X Window System:" |
149 |
echo " includes $xdir/include" |
150 |
echo " libraries $xdir/lib" |
151 |
echo |
152 |
|
153 |
if [ $xdir != "/usr" ]; then |
154 |
cflags="$cflags -I$xdir/include" |
155 |
ldflags="$ldflags -L$xdir/lib" |
156 |
rpath="$rpath:$xdir/lib" |
157 |
fi |
158 |
|
159 |
ldflags="$ldflags" |
160 |
targets="$targets rdesktop" |
161 |
|
162 |
if [ -z "$withoutopenssl" ]; then |
163 |
# Find OpenSSL installation if available |
164 |
ssldirs="$extrassldir /usr/openssl /usr/ssl /usr /usr/local/openssl /usr/local/ssl /usr/local" |
165 |
|
166 |
for dir in $ssldirs; do |
167 |
if [ -f $dir/include/openssl/rc4.h ]; then |
168 |
ssldir=$dir |
169 |
break |
170 |
fi |
171 |
done |
172 |
|
173 |
if [ -z "$ssldir" ]; then |
174 |
echo "WARNING: could not find OpenSSL headers" |
175 |
echo "(searched for include/openssl/rc4.h in: $ssldirs)" |
176 |
echo "Using in-tree crypto; installing OpenSSL is recommended." |
177 |
echo |
178 |
else |
179 |
echo "OpenSSL:" |
180 |
echo " includes $ssldir/include" |
181 |
echo " libraries $ssldir/lib" |
182 |
echo |
183 |
|
184 |
echo "CRYPTOBJ =" >>Makeconf |
185 |
|
186 |
if [ $ssldir != "/usr" ]; then |
187 |
cflags="$cflags -I$ssldir/include" |
188 |
ldflags="$ldflags -L$ssldir/lib" |
189 |
rpath="$rpath:$ssldir/lib" |
190 |
fi |
191 |
|
192 |
cflags="$cflags -DWITH_OPENSSL" |
193 |
ldflags="$ldflags -lcrypto" |
194 |
fi |
195 |
fi |
196 |
|
197 |
if [ ! -z "$withvncserver" ]; then |
198 |
if [ -z "$vncserverconfig" ]; then |
199 |
vncserverconfig=libvncserver-config |
200 |
fi |
201 |
|
202 |
echo "VNCINC=`$vncserverconfig --cflags`" >> Makeconf |
203 |
echo "LDVNC=`$vncserverconfig --libs`" >> Makeconf |
204 |
echo "CCLD=`$vncserverconfig --link`" >> Makeconf |
205 |
echo >> Makeconf |
206 |
targets="$targets rdp2vnc" |
207 |
|
208 |
echo "Found libvncserver: Building rdp2vnc" |
209 |
fi |
210 |
|
211 |
|
212 |
# Find EGD socket if we don't have /dev/urandom or /dev/random |
213 |
|
214 |
if [ ! -c /dev/random -a ! -c /dev/urandom ]; then |
215 |
egdpaths="$extraegdpath /var/run/egd-pool /dev/egd-pool /etc/egd-pool /etc/entropy" |
216 |
|
217 |
for path in $egdpaths; do |
218 |
# -e isn't portable, so we use -r |
219 |
if [ -r $path ]; then |
220 |
egdpath=$path |
221 |
break |
222 |
fi |
223 |
done |
224 |
|
225 |
if [ -z "$egdpath" ]; then |
226 |
echo "WARNING: could not find /dev/urandom, /dev/random or Entropy Gathering Daemon (EGD) socket" |
227 |
echo "(searched: $egdpaths)" |
228 |
echo "Session keys may be less secure; installing a system randomness source is recommended." |
229 |
echo |
230 |
else |
231 |
echo "Entropy Gathering Daemon (EGD):" |
232 |
echo " socket $egdpath" |
233 |
echo |
234 |
cflags="$cflags -DEGD_SOCKET=\\\"$egdpath\\\"" |
235 |
fi |
236 |
fi |
237 |
|
238 |
|
239 |
# Platform-specific options |
240 |
|
241 |
# strip leading colon from rpath |
242 |
rpath=`echo $rpath |sed 's/^://'` |
243 |
|
244 |
case `uname -s` in |
245 |
SunOS) |
246 |
ldflags="$ldflags -lsocket -lnsl -R$rpath" |
247 |
;; |
248 |
OSF1) |
249 |
ldflags="$ldflags -Wl,-rpath,$rpath" |
250 |
;; |
251 |
esac |
252 |
|
253 |
|
254 |
echo "CFLAGS = $cflags" >>Makeconf |
255 |
echo "LDFLAGS = $ldflags" >>Makeconf |
256 |
echo "TARGETS = $targets" >>Makeconf |
257 |
|
258 |
echo "configure complete - now run make" |
259 |
|