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= |
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 |
;; |
46 |
--with-egd-socket=*) |
47 |
extraegdpath=$optarg |
48 |
;; |
49 |
--with-debug) |
50 |
cflags="$cflags -g -DWITH_DEBUG" |
51 |
;; |
52 |
--with-debug-kbd) |
53 |
cflags="$cflags -g -DWITH_DEBUG_KBD" |
54 |
;; |
55 |
--without-debug*) |
56 |
;; |
57 |
*) |
58 |
echo "Target directories:" |
59 |
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 |
echo |
65 |
echo "Build configuration:" |
66 |
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 |
echo |
72 |
rm -f Makeconf |
73 |
exit 1 |
74 |
;; |
75 |
esac |
76 |
done |
77 |
|
78 |
|
79 |
# Find X installation |
80 |
|
81 |
xdirs="$extraxdir /usr/X11R6 /usr/X11 /usr/openwin /usr /usr/local/X11R6 /usr/local/X11 /usr/local" |
82 |
|
83 |
for dir in $xdirs; do |
84 |
if [ -f $dir/include/X11/Xlib.h ]; then |
85 |
xdir=$dir |
86 |
break |
87 |
fi |
88 |
done |
89 |
|
90 |
if [ -z "$xdir" ]; then |
91 |
echo "ERROR: could not find X Window System headers" |
92 |
echo "(searched for include/X11/Xlib.h in: $xdirs)" |
93 |
|
94 |
# additional helpful information for Linux users |
95 |
if [ -f /etc/redhat_release ]; then |
96 |
echo You probably need to install the XFree86-devel package |
97 |
elif [ -f /etc/debian_version ]; then |
98 |
echo You probably need to install the xlibs-dev package |
99 |
fi |
100 |
exit 1 |
101 |
fi |
102 |
|
103 |
echo "X Window System:" |
104 |
echo " includes $xdir/include" |
105 |
echo " libraries $xdir/lib" |
106 |
echo |
107 |
|
108 |
if [ $xdir != "/usr" ]; then |
109 |
cflags="$cflags -I$xdir/include" |
110 |
ldflags="$ldflags -L$xdir/lib" |
111 |
rpath="$rpath:$xdir/lib" |
112 |
fi |
113 |
|
114 |
ldflags="$ldflags -lX11" |
115 |
|
116 |
|
117 |
# Find OpenSSL installation if available |
118 |
|
119 |
ssldirs="$extrassldir /usr/openssl /usr/ssl /usr /usr/local/openssl /usr/local/ssl /usr/local" |
120 |
|
121 |
for dir in $ssldirs; do |
122 |
if [ -f $dir/include/openssl/rc4.h ]; then |
123 |
ssldir=$dir |
124 |
break |
125 |
fi |
126 |
done |
127 |
|
128 |
if [ -z "$ssldir" ]; then |
129 |
echo "WARNING: could not find OpenSSL headers" |
130 |
echo "(searched for include/openssl/rc4.h in: $ssldirs)" |
131 |
echo "Using in-tree crypto; installing OpenSSL is recommended." |
132 |
echo |
133 |
else |
134 |
echo "OpenSSL:" |
135 |
echo " includes $ssldir/include" |
136 |
echo " libraries $ssldir/lib" |
137 |
echo |
138 |
|
139 |
echo "CRYPTOBJ =" >>Makeconf |
140 |
|
141 |
if [ $ssldir != "/usr" ]; then |
142 |
cflags="$cflags -I$ssldir/include" |
143 |
ldflags="$ldflags -L$ssldir/lib" |
144 |
rpath="$rpath:$ssldir/lib" |
145 |
fi |
146 |
|
147 |
cflags="$cflags -DWITH_OPENSSL" |
148 |
ldflags="$ldflags -lcrypto" |
149 |
fi |
150 |
|
151 |
|
152 |
# Find EGD socket if we don't have /dev/urandom or /dev/random |
153 |
|
154 |
if [ ! -c /dev/random -a ! -c /dev/urandom ]; then |
155 |
egdpaths="$extraegdpath /var/run/egd-pool /dev/egd-pool /etc/egd-pool /etc/entropy" |
156 |
|
157 |
for path in $egdpaths; do |
158 |
# -e isn't portable, so we use -r |
159 |
if [ -r $path ]; then |
160 |
egdpath=$path |
161 |
break |
162 |
fi |
163 |
done |
164 |
|
165 |
if [ -z "$egdpath" ]; then |
166 |
echo "WARNING: could not find /dev/urandom, /dev/random or Entropy Gathering Daemon (EGD) socket" |
167 |
echo "(searched: $egdpaths)" |
168 |
echo "Session keys may be less secure; installing a system randomness source is recommended." |
169 |
echo |
170 |
else |
171 |
echo "Entropy Gathering Daemon (EGD):" |
172 |
echo " socket $egdpath" |
173 |
echo |
174 |
cflags="$cflags -DEGD_SOCKET=\\\"$egdpath\\\"" |
175 |
fi |
176 |
fi |
177 |
|
178 |
|
179 |
# Platform-specific options |
180 |
|
181 |
# strip leading colon from rpath |
182 |
rpath=`echo $rpath |sed 's/^://'` |
183 |
|
184 |
case `uname -s` in |
185 |
SunOS) |
186 |
ldflags="$ldflags -lsocket -lnsl -R$rpath" |
187 |
;; |
188 |
OSF1) |
189 |
ldflags="$ldflags -Wl,-rpath,$rpath" |
190 |
;; |
191 |
esac |
192 |
|
193 |
|
194 |
echo "CFLAGS += $cflags" >>Makeconf |
195 |
echo "LDFLAGS += $ldflags" >>Makeconf |
196 |
|
197 |
echo "configure complete - now run make" |
198 |
|