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