1 |
AC_INIT(rdesktop, 1.5.0) |
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_PATH_PROG(PKG_CONFIG, pkg-config) |
17 |
|
18 |
AC_SEARCH_LIBS(socket, socket) |
19 |
AC_SEARCH_LIBS(inet_aton, resolv) |
20 |
|
21 |
AC_CHECK_HEADER(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H)) |
22 |
AC_CHECK_HEADER(sys/modem.h, AC_DEFINE(HAVE_SYS_MODEM_H)) |
23 |
AC_CHECK_HEADER(sys/filio.h, AC_DEFINE(HAVE_SYS_FILIO_H)) |
24 |
AC_CHECK_HEADER(sys/strtio.h, AC_DEFINE(HAVE_SYS_STRTIO_H)) |
25 |
AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H)) |
26 |
AC_CHECK_HEADER(langinfo.h, AC_DEFINE(HAVE_LANGINFO_H)) |
27 |
|
28 |
AC_CHECK_TOOL(STRIP, strip, :) |
29 |
|
30 |
dnl Don't depend on pkg-config |
31 |
m4_ifdef([PKG_CHECK_MODULES], [], [ |
32 |
m4_errprint([warning: pkg-config checks are not available]) |
33 |
m4_defun([PKG_CHECK_MODULES], [ |
34 |
AC_MSG_WARN([pkg-config not available, cannot check for $2]) |
35 |
$4 |
36 |
]) |
37 |
]) |
38 |
|
39 |
rpath="" |
40 |
|
41 |
# |
42 |
# OpenSSL detection borrowed from stunnel |
43 |
# |
44 |
checkssldir() { : |
45 |
if test -f "$1/include/openssl/ssl.h"; then |
46 |
ssldir="$1" |
47 |
return 0 |
48 |
fi |
49 |
return 1 |
50 |
} |
51 |
AC_MSG_CHECKING([for OpenSSL directory]) |
52 |
AC_ARG_WITH(openssl, |
53 |
[ --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib], |
54 |
[ |
55 |
dnl Check the specified location only |
56 |
checkssldir "$withval" |
57 |
], |
58 |
[ |
59 |
dnl Search default locations of OpenSSL library |
60 |
for maindir in /usr/local /usr/lib /usr/pkg /usr /var/ssl /opt; do |
61 |
for dir in $maindir $maindir/openssl $maindir/ssl; do |
62 |
checkssldir $dir && break 2 |
63 |
done |
64 |
done |
65 |
] |
66 |
) |
67 |
if test -z "$ssldir"; then |
68 |
AC_MSG_RESULT([Not found]) |
69 |
echo |
70 |
echo "Couldn't find your OpenSSL library installation dir" |
71 |
echo "Use --with-openssl option to fix this problem" |
72 |
echo |
73 |
exit 1 |
74 |
fi |
75 |
AC_MSG_RESULT([$ssldir]) |
76 |
AC_SUBST(ssldir) |
77 |
AC_DEFINE_UNQUOTED(ssldir, "$ssldir") |
78 |
|
79 |
dnl Add OpenSSL includes and libraries |
80 |
CFLAGS="$CFLAGS -I$ssldir/include" |
81 |
AC_ARG_ENABLE(static-openssl, |
82 |
[ --enable-static-openssl link OpenSSL statically], |
83 |
[ |
84 |
LIBS="$LIBS $ssldir/lib/libcrypto.a" |
85 |
], |
86 |
[ |
87 |
LIBS="$LIBS -L$ssldir/lib -lcrypto" |
88 |
rpath="$rpath:$ssldir/lib" |
89 |
]) |
90 |
|
91 |
AC_ARG_ENABLE(smartcard, |
92 |
[ --enable-smartcard Enables smart-card support. |
93 |
], |
94 |
[ |
95 |
case "$OSTYPE" in |
96 |
darwin*) |
97 |
AC_CHECK_HEADER(PCSC/pcsclite.h, [WITH_SCARD=1], [WITH_SCARD=0]) |
98 |
PCSCLITE_CFLAGS="" |
99 |
PCSCLITE_LIBS="-framework PCSC" |
100 |
;; |
101 |
*) |
102 |
if test -n "$PKG_CONFIG"; then |
103 |
PKG_CHECK_MODULES(PCSCLITE, libpcsclite, [WITH_SCARD=1], [WITH_SCARD=0]) |
104 |
fi |
105 |
;; |
106 |
esac |
107 |
|
108 |
if test x"$WITH_SCARD" = "x1"; then |
109 |
SCARDOBJ="scard.o" |
110 |
CFLAGS="$CFLAGS $PCSCLITE_CFLAGS" |
111 |
LIBS="$LIBS $PCSCLITE_LIBS" |
112 |
AC_DEFINE(WITH_SCARD) |
113 |
fi |
114 |
|
115 |
AC_MSG_CHECKING([for old version of PCSC]) |
116 |
AC_TRY_LINK([ |
117 |
#include <stdlib.h> |
118 |
#ifdef __APPLE__ |
119 |
#include <PCSC/wintypes.h> |
120 |
#include <PCSC/winscard.h> |
121 |
#else |
122 |
#include <winscard.h> |
123 |
#endif |
124 |
], |
125 |
[SCardControl(NULL, NULL, 0, NULL, NULL);], |
126 |
[AC_MSG_RESULT(yes) AC_DEFINE(WITH_PCSC120, 1, [old version of PCSC])], |
127 |
[AC_MSG_RESULT(no)] |
128 |
) |
129 |
]) |
130 |
|
131 |
AC_SUBST(SCARDOBJ) |
132 |
|
133 |
# |
134 |
# Alignment |
135 |
# |
136 |
AC_MSG_CHECKING([if architecture needs alignment]) |
137 |
AC_TRY_RUN([ |
138 |
#include <stdlib.h> |
139 |
#include <signal.h> |
140 |
int main(int argc, char **argv) |
141 |
{ |
142 |
unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 }; |
143 |
signal(SIGBUS, exit); |
144 |
signal(SIGABRT, exit); |
145 |
signal(SIGSEGV, exit); |
146 |
if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) { |
147 |
return 1; |
148 |
} |
149 |
return 0; |
150 |
}], |
151 |
[AC_MSG_RESULT(no)], |
152 |
[AC_MSG_RESULT(yes) |
153 |
AC_DEFINE(NEED_ALIGN)], |
154 |
[AC_MSG_RESULT(assuming yes) |
155 |
AC_DEFINE(NEED_ALIGN)]) |
156 |
|
157 |
|
158 |
# |
159 |
# EGD |
160 |
# |
161 |
AC_ARG_WITH(egd-socket, |
162 |
[ --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH], |
163 |
[EGD_SOCKET="$withval"], |
164 |
[EGD_SOCKET="/var/run/egd-pool"] |
165 |
) |
166 |
AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET") |
167 |
|
168 |
|
169 |
# |
170 |
# rdp2vnc |
171 |
# |
172 |
vncserverconfig=libvncserver-config |
173 |
AC_ARG_WITH(libvncserver-config, |
174 |
[ --with-libvncserver-config=CMD use CMD as libvncserver-config], |
175 |
[vncserverconfig="$withval"] |
176 |
) |
177 |
AC_ARG_WITH(libvncserver, |
178 |
[ --with-libvncserver make rdp2vnc], |
179 |
[ |
180 |
VNCINC=`$vncserverconfig --cflags` |
181 |
AC_SUBST(VNCINC) |
182 |
LDVNC=`$vncserverconfig --libs` |
183 |
AC_SUBST(LDVNC) |
184 |
VNCLINK=`$vncserverconfig --link` |
185 |
AC_SUBST(VNCLINK) |
186 |
RDP2VNCTARGET="rdp2vnc" |
187 |
AC_SUBST(RDP2VNCTARGET) |
188 |
] |
189 |
) |
190 |
|
191 |
# |
192 |
# sound |
193 |
# |
194 |
|
195 |
sound="yes" |
196 |
AC_ARG_WITH(sound, |
197 |
[ --with-sound select sound system ("oss", "sgi", "sun", "alsa" or "libao") ], |
198 |
[ |
199 |
sound="$withval" |
200 |
]) |
201 |
|
202 |
AC_CHECK_HEADER(sys/soundcard.h, [HAVE_OSS=1], [HAVE_OSS=0]) |
203 |
AC_CHECK_HEADER(dmedia/audio.h, [HAVE_SGI=1], [HAVE_SGI=0]) |
204 |
AC_CHECK_HEADER(sys/audioio.h, [HAVE_SUN=1], [HAVE_SUN=0]) |
205 |
|
206 |
AC_ARG_ENABLE(static-libsamplerate, |
207 |
[ --enable-static-libsamplerate link libsamplerate statically], |
208 |
[static_libsamplerate=yes], |
209 |
[static_libsamplerate=no]) |
210 |
|
211 |
if test -n "$PKG_CONFIG"; then |
212 |
PKG_CHECK_MODULES(LIBAO, ao, [HAVE_LIBAO=1], [HAVE_LIBAO=0]) |
213 |
PKG_CHECK_MODULES(ALSA, alsa, [HAVE_ALSA=1], [HAVE_ALSA=0]) |
214 |
PKG_CHECK_MODULES(LIBSAMPLERATE, samplerate, [HAVE_LIBSAMPLERATE=1], [HAVE_LIBSAMPLERATE=0]) |
215 |
if test x"$HAVE_LIBSAMPLERATE" = "x1"; then |
216 |
AC_DEFINE(HAVE_LIBSAMPLERATE) |
217 |
if test x"$static_libsamplerate" = "xyes"; then |
218 |
_libsamplerate_libdir=`$PKG_CONFIG --errors-to-stdout --variable=libdir samplerate` |
219 |
LIBSAMPLERATE_LIBS="$_libsamplerate_libdir""/libsamplerate.a" |
220 |
fi |
221 |
LIBSAMPLERATE_LIBS="$LIBSAMPLERATE_LIBS -lm" |
222 |
fi |
223 |
fi |
224 |
|
225 |
if test "$sound" != "no"; then |
226 |
SOUNDOBJ="$SOUNDOBJ rdpsnd.o rdpsnd_dsp.o" |
227 |
CFLAGS="$CFLAGS $LIBSAMPLERATE_CFLAGS" |
228 |
LIBS="$LIBS $LIBSAMPLERATE_LIBS" |
229 |
AC_DEFINE(WITH_RDPSND) |
230 |
fi |
231 |
|
232 |
case $sound in |
233 |
yes) |
234 |
if test x"$HAVE_OSS" = "x1"; then |
235 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_oss.o" |
236 |
AC_DEFINE(RDPSND_OSS) |
237 |
fi |
238 |
|
239 |
if test x"$HAVE_SGI" = "x1"; then |
240 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_sgi.o" |
241 |
LIBS="$LIBS -laudio" |
242 |
AC_DEFINE(RDPSND_SGI) |
243 |
fi |
244 |
|
245 |
if test x"$HAVE_SUN" = "x1"; then |
246 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_sun.o" |
247 |
AC_DEFINE(RDPSND_SUN) |
248 |
fi |
249 |
|
250 |
if test x"$HAVE_ALSA" = "x1"; then |
251 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_alsa.o" |
252 |
CFLAGS="$CFLAGS $ALSA_CFLAGS" |
253 |
LIBS="$LIBS $ALSA_LIBS" |
254 |
AC_DEFINE(RDPSND_ALSA) |
255 |
fi |
256 |
|
257 |
if test x"$HAVE_LIBAO" = "x1"; then |
258 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_libao.o" |
259 |
CFLAGS="$CFLAGS $LIBAO_CFLAGS" |
260 |
LIBS="$LIBS $LIBAO_LIBS" |
261 |
AC_DEFINE(RDPSND_LIBAO) |
262 |
fi |
263 |
|
264 |
;; |
265 |
|
266 |
oss) |
267 |
if test x"$HAVE_OSS" = "x1"; then |
268 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_oss.o" |
269 |
AC_DEFINE(RDPSND_OSS) |
270 |
else |
271 |
AC_MSG_ERROR([Selected sound system is not available.]) |
272 |
fi |
273 |
;; |
274 |
|
275 |
sgi) |
276 |
if test x"$HAVE_SGI" = "x1"; then |
277 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_sgi.o" |
278 |
LIBS="$LIBS -laudio" |
279 |
AC_DEFINE(RDPSND_SGI) |
280 |
else |
281 |
AC_MSG_ERROR([Selected sound system is not available.]) |
282 |
fi |
283 |
;; |
284 |
|
285 |
sun) |
286 |
if test x"$HAVE_SUN" = "x1"; then |
287 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_sun.o" |
288 |
AC_DEFINE(RDPSND_SUN) |
289 |
else |
290 |
AC_MSG_ERROR([Selected sound system is not available.]) |
291 |
fi |
292 |
;; |
293 |
|
294 |
alsa) |
295 |
if test x"$HAVE_ALSA" = "x1"; then |
296 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_alsa.o" |
297 |
CFLAGS="$CFLAGS $ALSA_CFLAGS" |
298 |
LIBS="$LIBS $ALSA_LIBS" |
299 |
AC_DEFINE(RDPSND_ALSA) |
300 |
else |
301 |
AC_MSG_ERROR([Selected sound system is not available.]) |
302 |
fi |
303 |
;; |
304 |
|
305 |
libao) |
306 |
if test x"$HAVE_LIBAO" = "x1"; then |
307 |
SOUNDOBJ="$SOUNDOBJ rdpsnd_libao.o" |
308 |
CFLAGS="$CFLAGS $LIBAO_CFLAGS" |
309 |
LIBS="$LIBS $LIBAO_LIBS" |
310 |
AC_DEFINE(RDPSND_LIBAO) |
311 |
else |
312 |
AC_MSG_ERROR([Selected sound system is not available.]) |
313 |
fi |
314 |
;; |
315 |
|
316 |
no) |
317 |
;; |
318 |
|
319 |
*) |
320 |
AC_MSG_WARN([sound support disabled]) |
321 |
AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun), ALSA (alsa) and libao]) |
322 |
;; |
323 |
esac |
324 |
|
325 |
AC_SUBST(SOUNDOBJ) |
326 |
|
327 |
# |
328 |
# dirfd |
329 |
# |
330 |
dnl Find out how to get the file descriptor associated with an open DIR*. |
331 |
dnl From Jim Meyering |
332 |
|
333 |
AC_DEFUN([UTILS_FUNC_DIRFD], |
334 |
[ |
335 |
|
336 |
AC_HEADER_DIRENT |
337 |
dirfd_headers=' |
338 |
#if HAVE_DIRENT_H |
339 |
# include <dirent.h> |
340 |
#else /* not HAVE_DIRENT_H */ |
341 |
# define dirent direct |
342 |
# if HAVE_SYS_NDIR_H |
343 |
# include <sys/ndir.h> |
344 |
# endif /* HAVE_SYS_NDIR_H */ |
345 |
# if HAVE_SYS_DIR_H |
346 |
# include <sys/dir.h> |
347 |
# endif /* HAVE_SYS_DIR_H */ |
348 |
# if HAVE_NDIR_H |
349 |
# include <ndir.h> |
350 |
# endif /* HAVE_NDIR_H */ |
351 |
#endif /* HAVE_DIRENT_H */ |
352 |
' |
353 |
AC_CHECK_FUNCS(dirfd) |
354 |
AC_CHECK_DECLS([dirfd], , , $dirfd_headers) |
355 |
|
356 |
AC_CACHE_CHECK([whether dirfd is a macro], |
357 |
jm_cv_func_dirfd_macro, |
358 |
[AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers |
359 |
#ifdef dirfd |
360 |
dirent_header_defines_dirfd |
361 |
#endif], |
362 |
jm_cv_func_dirfd_macro=yes, |
363 |
jm_cv_func_dirfd_macro=no)]) |
364 |
|
365 |
# Use the replacement only if we have no function, macro, |
366 |
# or declaration with that name. |
367 |
if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \ |
368 |
= no,no,no; then |
369 |
AC_REPLACE_FUNCS([dirfd]) |
370 |
AC_CACHE_CHECK( |
371 |
[how to get the file descriptor associated with an open DIR*], |
372 |
gl_cv_sys_dir_fd_member_name, |
373 |
[ |
374 |
dirfd_save_CFLAGS=$CFLAGS |
375 |
for ac_expr in d_fd dd_fd; do |
376 |
|
377 |
CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr" |
378 |
AC_TRY_COMPILE( |
379 |
[$dirfd_headers |
380 |
], |
381 |
[DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;], |
382 |
dir_fd_found=yes |
383 |
) |
384 |
CFLAGS=$dirfd_save_CFLAGS |
385 |
test "$dir_fd_found" = yes && break |
386 |
done |
387 |
test "$dir_fd_found" = yes || ac_expr=no_such_member |
388 |
|
389 |
gl_cv_sys_dir_fd_member_name=$ac_expr |
390 |
] |
391 |
) |
392 |
if test $gl_cv_sys_dir_fd_member_name != no_such_member; then |
393 |
AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME, |
394 |
$gl_cv_sys_dir_fd_member_name, |
395 |
[the name of the file descriptor member of DIR]) |
396 |
fi |
397 |
AH_VERBATIM(DIR_TO_FD, |
398 |
[#ifdef DIR_FD_MEMBER_NAME |
399 |
# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) |
400 |
#else |
401 |
# define DIR_TO_FD(Dir_p) -1 |
402 |
#endif |
403 |
] |
404 |
) |
405 |
fi |
406 |
]) |
407 |
|
408 |
UTILS_FUNC_DIRFD |
409 |
|
410 |
# |
411 |
# iconv |
412 |
# |
413 |
|
414 |
dnl This macros shamelessly stolen from |
415 |
dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html. |
416 |
dnl Written by Bruno Haible. |
417 |
|
418 |
AC_DEFUN([UTILS_FUNC_ICONV], |
419 |
[ |
420 |
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and |
421 |
dnl those with the standalone portable GNU libiconv installed). |
422 |
|
423 |
AC_ARG_WITH([libiconv-prefix], |
424 |
[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ |
425 |
for dir in `echo "$withval" | tr : ' '`; do |
426 |
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi |
427 |
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi |
428 |
done |
429 |
]) |
430 |
AC_CHECK_HEADER(iconv.h, AC_DEFINE(HAVE_ICONV_H)) |
431 |
|
432 |
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ |
433 |
am_cv_func_iconv="no, consider installing GNU libiconv" |
434 |
am_cv_lib_iconv=no |
435 |
AC_TRY_LINK([#include <stdlib.h> |
436 |
#include <iconv.h>], |
437 |
[iconv_t cd = iconv_open("",""); |
438 |
iconv(cd,NULL,NULL,NULL,NULL); |
439 |
iconv_close(cd);], |
440 |
am_cv_func_iconv=yes) |
441 |
if test "$am_cv_func_iconv" != yes; then |
442 |
am_save_LIBS="$LIBS" |
443 |
LIBS="$LIBS -liconv" |
444 |
AC_TRY_LINK([#include <stdlib.h> |
445 |
#include <iconv.h>], |
446 |
[iconv_t cd = iconv_open("",""); |
447 |
iconv(cd,NULL,NULL,NULL,NULL); |
448 |
iconv_close(cd);], |
449 |
am_cv_lib_iconv=yes |
450 |
am_cv_func_iconv=yes) |
451 |
LIBS="$am_save_LIBS" |
452 |
fi |
453 |
]) |
454 |
if test "$am_cv_func_iconv" = yes; then |
455 |
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) |
456 |
AC_MSG_CHECKING([for iconv declaration]) |
457 |
AC_CACHE_VAL(am_cv_proto_iconv, [ |
458 |
AC_TRY_COMPILE([ |
459 |
#include <stdlib.h> |
460 |
#include <iconv.h> |
461 |
extern |
462 |
#ifdef __cplusplus |
463 |
"C" |
464 |
#endif |
465 |
#if defined(__STDC__) || defined(__cplusplus) |
466 |
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); |
467 |
#else |
468 |
size_t iconv(); |
469 |
#endif |
470 |
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") |
471 |
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) |
472 |
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` |
473 |
AC_MSG_RESULT([$]{ac_t:- |
474 |
}[$]am_cv_proto_iconv) |
475 |
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, |
476 |
[Define as const if the declaration of iconv() needs const.]) |
477 |
fi |
478 |
LIBICONV= |
479 |
if test "$am_cv_lib_iconv" = yes; then |
480 |
LIBICONV="-liconv" |
481 |
fi |
482 |
AC_SUBST(LIBICONV) |
483 |
]) |
484 |
|
485 |
UTILS_FUNC_ICONV |
486 |
LIBS="$LIBS $LIBICONV" |
487 |
|
488 |
# |
489 |
# socklen_t |
490 |
# from curl |
491 |
|
492 |
dnl Check for socklen_t: historically on BSD it is an int, and in |
493 |
dnl POSIX 1g it is a type of its own, but some platforms use different |
494 |
dnl types for the argument to getsockopt, getpeername, etc. So we |
495 |
dnl have to test to find something that will work. |
496 |
AC_DEFUN([TYPE_SOCKLEN_T], |
497 |
[ |
498 |
AC_CHECK_TYPE([socklen_t], ,[ |
499 |
AC_MSG_CHECKING([for socklen_t equivalent]) |
500 |
AC_CACHE_VAL([socklen_t_equiv], |
501 |
[ |
502 |
# Systems have either "struct sockaddr *" or |
503 |
# "void *" as the second argument to getpeername |
504 |
socklen_t_equiv= |
505 |
for arg2 in "struct sockaddr" void; do |
506 |
for t in int size_t unsigned long "unsigned long"; do |
507 |
AC_TRY_COMPILE([ |
508 |
#include <sys/types.h> |
509 |
#include <sys/socket.h> |
510 |
|
511 |
int getpeername (int, $arg2 *, $t *); |
512 |
],[ |
513 |
$t len; |
514 |
getpeername(0,0,&len); |
515 |
],[ |
516 |
socklen_t_equiv="$t" |
517 |
break |
518 |
]) |
519 |
done |
520 |
done |
521 |
|
522 |
if test "x$socklen_t_equiv" = x; then |
523 |
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) |
524 |
fi |
525 |
]) |
526 |
AC_MSG_RESULT($socklen_t_equiv) |
527 |
AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_equiv, |
528 |
[type to use in place of socklen_t if not defined])], |
529 |
[#include <sys/types.h> |
530 |
#include <sys/socket.h>]) |
531 |
]) |
532 |
|
533 |
TYPE_SOCKLEN_T |
534 |
|
535 |
# |
536 |
# statfs stuff |
537 |
# |
538 |
AC_CHECK_HEADERS(sys/vfs.h) |
539 |
AC_CHECK_HEADERS(sys/statvfs.h) |
540 |
AC_CHECK_HEADERS(sys/statfs.h) |
541 |
AC_CHECK_HEADERS(sys/param.h) |
542 |
|
543 |
mount_includes="\ |
544 |
$ac_includes_default |
545 |
#if HAVE_SYS_PARAM_H |
546 |
# include <sys/param.h> |
547 |
#endif |
548 |
" |
549 |
|
550 |
AC_CHECK_HEADERS(sys/mount.h,,,[$mount_includes]) |
551 |
|
552 |
################################################# |
553 |
# these tests are taken from the GNU fileutils package |
554 |
AC_CHECKING(how to get filesystem space usage) |
555 |
space=no |
556 |
|
557 |
# Test for statvfs64. |
558 |
if test $space = no; then |
559 |
# SVR4 |
560 |
AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64, |
561 |
[AC_TRY_RUN([ |
562 |
#if defined(HAVE_UNISTD_H) |
563 |
#include <unistd.h> |
564 |
#endif |
565 |
#include <sys/types.h> |
566 |
#include <sys/statvfs.h> |
567 |
main () |
568 |
{ |
569 |
struct statvfs64 fsd; |
570 |
exit (statvfs64 (".", &fsd)); |
571 |
}], |
572 |
fu_cv_sys_stat_statvfs64=yes, |
573 |
fu_cv_sys_stat_statvfs64=no, |
574 |
fu_cv_sys_stat_statvfs64=cross)]) |
575 |
if test $fu_cv_sys_stat_statvfs64 = yes; then |
576 |
space=yes |
577 |
AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available]) |
578 |
fi |
579 |
fi |
580 |
|
581 |
# Perform only the link test since it seems there are no variants of the |
582 |
# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs) |
583 |
# because that got a false positive on SCO OSR5. Adding the declaration |
584 |
# of a `struct statvfs' causes this test to fail (as it should) on such |
585 |
# systems. That system is reported to work fine with STAT_STATFS4 which |
586 |
# is what it gets when this test fails. |
587 |
if test $space = no; then |
588 |
# SVR4 |
589 |
AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs, |
590 |
[AC_TRY_LINK([#include <sys/types.h> |
591 |
#include <sys/statvfs.h>], |
592 |
[struct statvfs fsd; statvfs (0, &fsd);], |
593 |
fu_cv_sys_stat_statvfs=yes, |
594 |
fu_cv_sys_stat_statvfs=no)]) |
595 |
if test $fu_cv_sys_stat_statvfs = yes; then |
596 |
space=yes |
597 |
AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available]) |
598 |
fi |
599 |
fi |
600 |
|
601 |
if test $space = no; then |
602 |
# DEC Alpha running OSF/1 |
603 |
AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) |
604 |
AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1, |
605 |
[AC_TRY_RUN([ |
606 |
#include <sys/param.h> |
607 |
#include <sys/types.h> |
608 |
#include <sys/mount.h> |
609 |
main () |
610 |
{ |
611 |
struct statfs fsd; |
612 |
fsd.f_fsize = 0; |
613 |
exit (statfs (".", &fsd, sizeof (struct statfs))); |
614 |
}], |
615 |
fu_cv_sys_stat_statfs3_osf1=yes, |
616 |
fu_cv_sys_stat_statfs3_osf1=no, |
617 |
fu_cv_sys_stat_statfs3_osf1=no)]) |
618 |
|
619 |
|
620 |
#C_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1) |
621 |
if test $fu_cv_sys_stat_statfs3_osf1 = yes; then |
622 |
space=yes |
623 |
AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments]) |
624 |
fi |
625 |
fi |
626 |
|
627 |
if test $space = no; then |
628 |
# AIX |
629 |
AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl |
630 |
member (AIX, 4.3BSD)]) |
631 |
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize, |
632 |
[AC_TRY_RUN([ |
633 |
#ifdef HAVE_SYS_PARAM_H |
634 |
#include <sys/param.h> |
635 |
#endif |
636 |
#ifdef HAVE_SYS_MOUNT_H |
637 |
#include <sys/mount.h> |
638 |
#endif |
639 |
#ifdef HAVE_SYS_VFS_H |
640 |
#include <sys/vfs.h> |
641 |
#endif |
642 |
main () |
643 |
{ |
644 |
struct statfs fsd; |
645 |
fsd.f_bsize = 0; |
646 |
exit (statfs (".", &fsd)); |
647 |
}], |
648 |
fu_cv_sys_stat_statfs2_bsize=yes, |
649 |
fu_cv_sys_stat_statfs2_bsize=no, |
650 |
fu_cv_sys_stat_statfs2_bsize=no)]) |
651 |
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize) |
652 |
if test $fu_cv_sys_stat_statfs2_bsize = yes; then |
653 |
space=yes |
654 |
AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property]) |
655 |
fi |
656 |
fi |
657 |
|
658 |
if test $space = no; then |
659 |
# SVR3 |
660 |
AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) |
661 |
AC_CACHE_VAL(fu_cv_sys_stat_statfs4, |
662 |
[AC_TRY_RUN([#include <sys/types.h> |
663 |
#include <sys/statfs.h> |
664 |
main () |
665 |
{ |
666 |
struct statfs fsd; |
667 |
exit (statfs (".", &fsd, sizeof fsd, 0)); |
668 |
}], |
669 |
fu_cv_sys_stat_statfs4=yes, |
670 |
fu_cv_sys_stat_statfs4=no, |
671 |
fu_cv_sys_stat_statfs4=no)]) |
672 |
AC_MSG_RESULT($fu_cv_sys_stat_statfs4) |
673 |
if test $fu_cv_sys_stat_statfs4 = yes; then |
674 |
space=yes |
675 |
AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments]) |
676 |
fi |
677 |
fi |
678 |
|
679 |
if test $space = no; then |
680 |
# 4.4BSD and NetBSD |
681 |
AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl |
682 |
member (4.4BSD and NetBSD)]) |
683 |
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize, |
684 |
[AC_TRY_RUN([#include <sys/types.h> |
685 |
#ifdef HAVE_SYS_PARAM_H |
686 |
#include <sys/param.h> |
687 |
#endif |
688 |
#ifdef HAVE_SYS_MOUNT_H |
689 |
#include <sys/mount.h> |
690 |
#endif |
691 |
main () |
692 |
{ |
693 |
struct statfs fsd; |
694 |
fsd.f_fsize = 0; |
695 |
exit (statfs (".", &fsd)); |
696 |
}], |
697 |
fu_cv_sys_stat_statfs2_fsize=yes, |
698 |
fu_cv_sys_stat_statfs2_fsize=no, |
699 |
fu_cv_sys_stat_statfs2_fsize=no)]) |
700 |
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize) |
701 |
if test $fu_cv_sys_stat_statfs2_fsize = yes; then |
702 |
space=yes |
703 |
AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize]) |
704 |
fi |
705 |
fi |
706 |
|
707 |
if test $space = no; then |
708 |
# Ultrix |
709 |
AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) |
710 |
AC_CACHE_VAL(fu_cv_sys_stat_fs_data, |
711 |
[AC_TRY_RUN([#include <sys/types.h> |
712 |
#ifdef HAVE_SYS_PARAM_H |
713 |
#include <sys/param.h> |
714 |
#endif |
715 |
#ifdef HAVE_SYS_MOUNT_H |
716 |
#include <sys/mount.h> |
717 |
#endif |
718 |
#ifdef HAVE_SYS_FS_TYPES_H |
719 |
#include <sys/fs_types.h> |
720 |
#endif |
721 |
main () |
722 |
{ |
723 |
struct fs_data fsd; |
724 |
/* Ultrix's statfs returns 1 for success, |
725 |
0 for not mounted, -1 for failure. */ |
726 |
exit (statfs (".", &fsd) != 1); |
727 |
}], |
728 |
fu_cv_sys_stat_fs_data=yes, |
729 |
fu_cv_sys_stat_fs_data=no, |
730 |
fu_cv_sys_stat_fs_data=no)]) |
731 |
AC_MSG_RESULT($fu_cv_sys_stat_fs_data) |
732 |
if test $fu_cv_sys_stat_fs_data = yes; then |
733 |
space=yes |
734 |
AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available]) |
735 |
fi |
736 |
fi |
737 |
|
738 |
statxfs_includes="\ |
739 |
$ac_includes_default |
740 |
#if HAVE_SYS_STATVFS_H |
741 |
# include <sys/statvfs.h> |
742 |
#endif |
743 |
#if HAVE_SYS_VFS_H |
744 |
# include <sys/vfs.h> |
745 |
#endif |
746 |
#if !HAVE_SYS_STATVFS_H && !HAVE_SYS_VFS_H |
747 |
# if HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H |
748 |
/* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */ |
749 |
# include <sys/param.h> |
750 |
# include <sys/mount.h> |
751 |
# elif HAVE_NETINET_IN_H && HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H |
752 |
/* Ultrix 4.4 needs these for the declaration of struct statfs. */ |
753 |
# include <netinet/in.h> |
754 |
# include <nfs/nfs_clnt.h> |
755 |
# include <nfs/vfs.h> |
756 |
# endif |
757 |
#endif |
758 |
" |
759 |
|
760 |
AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes]) |
761 |
AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes]) |
762 |
AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes]) |
763 |
AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes]) |
764 |
|
765 |
# |
766 |
# Large file support |
767 |
# |
768 |
AC_SYS_LARGEFILE |
769 |
|
770 |
# |
771 |
# mntent |
772 |
# |
773 |
AC_CHECK_HEADER(mntent.h, AC_DEFINE(HAVE_MNTENT_H)) |
774 |
AC_CHECK_FUNCS(setmntent) |
775 |
|
776 |
# |
777 |
# IPv6 |
778 |
# |
779 |
AC_ARG_WITH(ipv6, |
780 |
[ --with-ipv6 enable IPv6-support], |
781 |
[ |
782 |
if test $withval != "no"; |
783 |
then |
784 |
AC_DEFINE(IPv6,1) |
785 |
fi |
786 |
]) |
787 |
|
788 |
|
789 |
# |
790 |
# debugging |
791 |
# |
792 |
AC_ARG_WITH(debug, |
793 |
[ --with-debug enable protocol debugging output], |
794 |
[ |
795 |
if test $withval != "no"; |
796 |
then |
797 |
AC_DEFINE(WITH_DEBUG,1) |
798 |
fi |
799 |
]) |
800 |
|
801 |
AC_ARG_WITH(debug-kbd, |
802 |
[ --with-debug-kbd enable debugging of keyboard handling], |
803 |
[ |
804 |
if test $withval != "no"; |
805 |
then |
806 |
AC_DEFINE(WITH_DEBUG_KBD,1) |
807 |
fi |
808 |
]) |
809 |
|
810 |
AC_ARG_WITH(debug-rdp5, |
811 |
[ --with-debug-rdp5 enable debugging of RDP5 code], |
812 |
[ |
813 |
if test $withval != "no"; |
814 |
then |
815 |
AC_DEFINE(WITH_DEBUG_RDP5,1) |
816 |
fi |
817 |
]) |
818 |
|
819 |
AC_ARG_WITH(debug-clipboard, |
820 |
[ --with-debug-clipboard enable debugging of clipboard code], |
821 |
[ |
822 |
if test $withval != "no"; |
823 |
then |
824 |
AC_DEFINE(WITH_DEBUG_CLIPBOARD,1) |
825 |
fi |
826 |
]) |
827 |
|
828 |
AC_ARG_WITH(debug-sound, |
829 |
[ --with-debug-sound enable debugging of sound code], |
830 |
[ |
831 |
if test $withval != "no"; |
832 |
then |
833 |
AC_DEFINE(WITH_DEBUG_SOUND,1) |
834 |
fi |
835 |
]) |
836 |
|
837 |
AC_ARG_WITH(debug-channel, |
838 |
[ --with-debug-channel enable debugging of virtual channel code], |
839 |
[ |
840 |
if test $withval != "no"; |
841 |
then |
842 |
AC_DEFINE(WITH_DEBUG_CHANNEL,1) |
843 |
fi |
844 |
]) |
845 |
|
846 |
AC_ARG_WITH(debug-seamless, |
847 |
[ --with-debug-seamless enable debugging of SeamlessRDP code], |
848 |
[ |
849 |
if test $withval != "no"; |
850 |
then |
851 |
AC_DEFINE(WITH_DEBUG_SEAMLESS,1) |
852 |
fi |
853 |
]) |
854 |
|
855 |
AC_ARG_WITH(debug-smartcard, |
856 |
[ --with-debug-smartcard enable debugging of smart-card code], |
857 |
[ |
858 |
if test $withval != "no"; |
859 |
then |
860 |
if test x"$WITH_SCARD" = "x1"; then |
861 |
AC_DEFINE(WITH_DEBUG_SCARD,1) |
862 |
fi |
863 |
fi |
864 |
]) |
865 |
|
866 |
# |
867 |
# target-specific stuff |
868 |
# |
869 |
# strip leading colon from rpath |
870 |
rpath=`echo $rpath |sed 's/^://'` |
871 |
AC_CANONICAL_HOST |
872 |
case "$host" in |
873 |
*-*-solaris*) |
874 |
LDFLAGS="$LDFLAGS -R$rpath" |
875 |
;; |
876 |
*-dec-osf*) |
877 |
LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath" |
878 |
;; |
879 |
*-*-hpux*) |
880 |
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" |
881 |
;; |
882 |
*-*-irix6.5*) |
883 |
LIBS="$LIBS -L$ssldir/lib32 -lcrypto" |
884 |
CFLAGS="$CFLAGS -D__SGI_IRIX__" |
885 |
;; |
886 |
esac |
887 |
|
888 |
|
889 |
AC_OUTPUT(Makefile) |
890 |
|
891 |
dnl Local Variables: |
892 |
dnl comment-start: "dnl " |
893 |
dnl comment-end: "" |
894 |
dnl comment-start-skip: "\\bdnl\\b\\s *" |
895 |
dnl compile-command: "autoconf" |
896 |
dnl End: |