1 |
AC_INIT(rdesktop, 1.3.1) |
2 |
|
3 |
AC_CONFIG_SRCDIR([rdesktop.c]) |
4 |
|
5 |
AC_PROG_CC |
6 |
if test "$GCC" = yes; then |
7 |
CFLAGS="$CFLAGS -Wall" |
8 |
fi |
9 |
|
10 |
AC_PROG_INSTALL |
11 |
AC_LANG_C |
12 |
AC_HEADER_STDC |
13 |
AC_C_BIGENDIAN([AC_DEFINE(B_ENDIAN)], [AC_DEFINE(L_ENDIAN)]) |
14 |
AC_PATH_XTRA |
15 |
|
16 |
AC_SEARCH_LIBS(socket, socket) |
17 |
AC_SEARCH_LIBS(inet_aton, resolv) |
18 |
|
19 |
AC_CHECK_HEADER(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H)) |
20 |
AC_CHECK_HEADER(sys/modem.h, AC_DEFINE(HAVE_SYS_MODEM_H)) |
21 |
AC_CHECK_HEADER(sys/filio.h, AC_DEFINE(HAVE_SYS_FILIO_H)) |
22 |
AC_CHECK_HEADER(sys/strtio.h, AC_DEFINE(HAVE_SYS_STRTIO_H)) |
23 |
|
24 |
rpath="" |
25 |
|
26 |
# |
27 |
# OpenSSL detection borrowed from stunnel |
28 |
# |
29 |
checkssldir() { : |
30 |
if test -f "$1/include/openssl/ssl.h"; then |
31 |
ssldir="$1" |
32 |
return 0 |
33 |
fi |
34 |
return 1 |
35 |
} |
36 |
AC_MSG_CHECKING([for OpenSSL directory]) |
37 |
AC_ARG_WITH(openssl, |
38 |
[ --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib], |
39 |
[ |
40 |
dnl Check the specified location only |
41 |
checkssldir "$withval" |
42 |
], |
43 |
[ |
44 |
dnl Search default locations of OpenSSL library |
45 |
for maindir in /usr/local /usr/lib /usr/pkg /usr /var/ssl /opt; do |
46 |
for dir in $maindir $maindir/openssl $maindir/ssl; do |
47 |
checkssldir $dir && break 2 |
48 |
done |
49 |
done |
50 |
] |
51 |
) |
52 |
if test -z "$ssldir"; then |
53 |
AC_MSG_RESULT([Not found]) |
54 |
echo |
55 |
echo "Couldn't find your OpenSSL library installation dir" |
56 |
echo "Use --with-openssl option to fix this problem" |
57 |
echo |
58 |
exit 1 |
59 |
fi |
60 |
AC_MSG_RESULT([$ssldir]) |
61 |
AC_SUBST(ssldir) |
62 |
AC_DEFINE_UNQUOTED(ssldir, "$ssldir") |
63 |
|
64 |
dnl Add OpenSSL includes and libraries |
65 |
CFLAGS="$CFLAGS -I$ssldir/include" |
66 |
AC_ARG_ENABLE(static-openssl, |
67 |
[ --enable-static-openssl link OpenSSL statically], |
68 |
[ |
69 |
LIBS="$LIBS $ssldir/lib/libcrypto.a" |
70 |
], |
71 |
[ |
72 |
LIBS="$LIBS -L$ssldir/lib -lcrypto" |
73 |
rpath="$rpath:$ssldir/lib" |
74 |
]) |
75 |
|
76 |
|
77 |
# |
78 |
# Alignment |
79 |
# |
80 |
AC_MSG_CHECKING([if architecture needs alignment]) |
81 |
AC_TRY_RUN([ |
82 |
#include <stdlib.h> |
83 |
#include <signal.h> |
84 |
int main(int argc, char **argv) |
85 |
{ |
86 |
unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 }; |
87 |
signal(SIGBUS, exit); |
88 |
signal(SIGABRT, exit); |
89 |
signal(SIGSEGV, exit); |
90 |
if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) { |
91 |
return 1; |
92 |
} |
93 |
return 0; |
94 |
}], |
95 |
[AC_MSG_RESULT(no)], |
96 |
[AC_MSG_RESULT(yes) |
97 |
AC_DEFINE(NEED_ALIGN)], |
98 |
[AC_MSG_RESULT(assuming yes) |
99 |
AC_DEFINE(NEED_ALIGN)]) |
100 |
|
101 |
|
102 |
# |
103 |
# EGD |
104 |
# |
105 |
AC_ARG_WITH(egd-socket, |
106 |
[ --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH], |
107 |
[EGD_SOCKET="$withval"], |
108 |
[EGD_SOCKET="/var/run/egd-pool"] |
109 |
) |
110 |
AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET") |
111 |
|
112 |
|
113 |
# |
114 |
# rdp2vnc |
115 |
# |
116 |
vncserverconfig=libvncserver-config |
117 |
AC_ARG_WITH(libvncserver-config, |
118 |
[ --with-libvncserver-config=CMD use CMD as libvncserver-config], |
119 |
[vncserverconfig="$withval"] |
120 |
) |
121 |
AC_ARG_WITH(libvncserver, |
122 |
[ --with-libvncserver make rdp2vnc], |
123 |
[ |
124 |
VNCINC=`$vncserverconfig --cflags` |
125 |
AC_SUBST(VNCINC) |
126 |
LDVNC=`$vncserverconfig --libs` |
127 |
AC_SUBST(LDVNC) |
128 |
VNCLINK=`$vncserverconfig --link` |
129 |
AC_SUBST(VNCLINK) |
130 |
RDP2VNCTARGET="rdp2vnc" |
131 |
AC_SUBST(RDP2VNCTARGET) |
132 |
] |
133 |
) |
134 |
|
135 |
# |
136 |
# sound |
137 |
# |
138 |
sound="yes" |
139 |
AC_ARG_WITH(sound, |
140 |
[ --with-sound select sound system ("oss", "sgi" or "sun") ], |
141 |
[ |
142 |
sound="$withval" |
143 |
]) |
144 |
if test "$sound" = yes; then |
145 |
AC_CHECK_HEADER(sys/soundcard.h, [sound=oss]) |
146 |
AC_CHECK_HEADER(dmedia/audio.h, [sound=sgi]) |
147 |
AC_CHECK_HEADER(sys/audioio.h, [sound=sun]) |
148 |
fi |
149 |
if test "$sound" = no; then |
150 |
break |
151 |
elif test "$sound" = oss; then |
152 |
SOUNDOBJ="rdpsnd.o rdpsnd_oss.o" |
153 |
AC_DEFINE(WITH_RDPSND) |
154 |
elif test "$sound" = sgi; then |
155 |
SOUNDOBJ="rdpsnd.o rdpsnd_sgi.o" |
156 |
LDFLAGS="$LDFLAGS -laudio" |
157 |
AC_DEFINE(WITH_RDPSND) |
158 |
elif test "$sound" = sun; then |
159 |
SOUNDOBJ="rdpsnd.o rdpsnd_sun.o" |
160 |
AC_DEFINE(WITH_RDPSND) |
161 |
else |
162 |
AC_MSG_WARN([sound support disabled (no sys/soundcard.h or sys/audioio.h)]) |
163 |
AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi) and Sun/BSD (sun)]) |
164 |
fi |
165 |
AC_SUBST(SOUNDOBJ) |
166 |
|
167 |
# |
168 |
# dirfd |
169 |
# |
170 |
dnl Find out how to get the file descriptor associated with an open DIR*. |
171 |
dnl From Jim Meyering |
172 |
|
173 |
AC_DEFUN([UTILS_FUNC_DIRFD], |
174 |
[ |
175 |
|
176 |
AC_HEADER_DIRENT |
177 |
dirfd_headers=' |
178 |
#if HAVE_DIRENT_H |
179 |
# include <dirent.h> |
180 |
#else /* not HAVE_DIRENT_H */ |
181 |
# define dirent direct |
182 |
# if HAVE_SYS_NDIR_H |
183 |
# include <sys/ndir.h> |
184 |
# endif /* HAVE_SYS_NDIR_H */ |
185 |
# if HAVE_SYS_DIR_H |
186 |
# include <sys/dir.h> |
187 |
# endif /* HAVE_SYS_DIR_H */ |
188 |
# if HAVE_NDIR_H |
189 |
# include <ndir.h> |
190 |
# endif /* HAVE_NDIR_H */ |
191 |
#endif /* HAVE_DIRENT_H */ |
192 |
' |
193 |
AC_CHECK_FUNCS(dirfd) |
194 |
AC_CHECK_DECLS([dirfd], , , $dirfd_headers) |
195 |
|
196 |
AC_CACHE_CHECK([whether dirfd is a macro], |
197 |
jm_cv_func_dirfd_macro, |
198 |
[AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers |
199 |
#ifdef dirfd |
200 |
dirent_header_defines_dirfd |
201 |
#endif], |
202 |
jm_cv_func_dirfd_macro=yes, |
203 |
jm_cv_func_dirfd_macro=no)]) |
204 |
|
205 |
# Use the replacement only if we have no function, macro, |
206 |
# or declaration with that name. |
207 |
if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \ |
208 |
= no,no,no; then |
209 |
AC_REPLACE_FUNCS([dirfd]) |
210 |
AC_CACHE_CHECK( |
211 |
[how to get the file descriptor associated with an open DIR*], |
212 |
gl_cv_sys_dir_fd_member_name, |
213 |
[ |
214 |
dirfd_save_CFLAGS=$CFLAGS |
215 |
for ac_expr in d_fd dd_fd; do |
216 |
|
217 |
CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr" |
218 |
AC_TRY_COMPILE( |
219 |
[$dirfd_headers |
220 |
], |
221 |
[DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;], |
222 |
dir_fd_found=yes |
223 |
) |
224 |
CFLAGS=$dirfd_save_CFLAGS |
225 |
test "$dir_fd_found" = yes && break |
226 |
done |
227 |
test "$dir_fd_found" = yes || ac_expr=no_such_member |
228 |
|
229 |
gl_cv_sys_dir_fd_member_name=$ac_expr |
230 |
] |
231 |
) |
232 |
if test $gl_cv_sys_dir_fd_member_name != no_such_member; then |
233 |
AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME, |
234 |
$gl_cv_sys_dir_fd_member_name, |
235 |
[the name of the file descriptor member of DIR]) |
236 |
fi |
237 |
AH_VERBATIM(DIR_TO_FD, |
238 |
[#ifdef DIR_FD_MEMBER_NAME |
239 |
# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) |
240 |
#else |
241 |
# define DIR_TO_FD(Dir_p) -1 |
242 |
#endif |
243 |
] |
244 |
) |
245 |
fi |
246 |
]) |
247 |
|
248 |
UTILS_FUNC_DIRFD |
249 |
|
250 |
|
251 |
# |
252 |
# IPv6 |
253 |
# |
254 |
AC_ARG_WITH(ipv6, |
255 |
[ --with-ipv6 enable IPv6-support], |
256 |
[ AC_DEFINE(IPv6) ]) |
257 |
|
258 |
|
259 |
# |
260 |
# debugging |
261 |
# |
262 |
AC_ARG_WITH(debug, |
263 |
[ --with-debug enable protocol debugging output], |
264 |
[ AC_DEFINE(WITH_DEBUG) ]) |
265 |
|
266 |
AC_ARG_WITH(debug-kbd, |
267 |
[ --with-debug-kbd enable debugging of keyboard handling], |
268 |
[ AC_DEFINE(WITH_DEBUG_KBD) ]) |
269 |
|
270 |
AC_ARG_WITH(debug-rdp5, |
271 |
[ --with-debug-rdp5 enable debugging of RDP5 code], |
272 |
[ AC_DEFINE(WITH_DEBUG_RDP5) ]) |
273 |
|
274 |
AC_ARG_WITH(debug-clipboard, |
275 |
[ --with-debug-clipboard enable debugging of clipboard code], |
276 |
[ AC_DEFINE(WITH_DEBUG_CLIPBOARD) ]) |
277 |
|
278 |
|
279 |
# |
280 |
# target-specific stuff |
281 |
# |
282 |
# strip leading colon from rpath |
283 |
rpath=`echo $rpath |sed 's/^://'` |
284 |
AC_CANONICAL_HOST |
285 |
case "$host" in |
286 |
*-*-solaris*) |
287 |
LDFLAGS="$LDFLAGS -R$rpath" |
288 |
;; |
289 |
*-dec-osf*) |
290 |
LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath" |
291 |
;; |
292 |
*-*-hpux*) |
293 |
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" |
294 |
;; |
295 |
*-*-irix6.5*) |
296 |
LIBS="$LIBS -L$ssldir/lib32 -lcrypto" |
297 |
CFLAGS="$CFLAGS -D__SGI_IRIX__" |
298 |
;; |
299 |
esac |
300 |
|
301 |
|
302 |
AC_OUTPUT(Makefile) |
303 |
|
304 |
dnl Local Variables: |
305 |
dnl comment-start: "dnl " |
306 |
dnl comment-end: "" |
307 |
dnl comment-start-skip: "\\bdnl\\b\\s *" |
308 |
dnl compile-command: "autoconf" |
309 |
dnl End: |