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