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