1 AC_INIT(rdesktop, 1.4.1)
3 AC_CONFIG_SRCDIR([rdesktop.c])
6 if test "$GCC" = yes; then
13 AC_C_BIGENDIAN([AC_DEFINE(B_ENDIAN)], [AC_DEFINE(L_ENDIAN)])
16 AC_SEARCH_LIBS(socket, socket)
17 AC_SEARCH_LIBS(inet_aton, resolv)
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 AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
24 AC_CHECK_HEADER(langinfo.h, AC_DEFINE(HAVE_LANGINFO_H))
26 AC_CHECK_TOOL(STRIP, strip, :)
31 # OpenSSL detection borrowed from stunnel
34 if test -f "$1/include/openssl/ssl.h"; then
40 AC_MSG_CHECKING([for OpenSSL directory])
42 [ --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib],
44 dnl Check the specified location only
45 checkssldir "$withval"
48 dnl Search default locations of OpenSSL library
49 for maindir in /usr/local /usr/lib /usr/pkg /usr /var/ssl /opt; do
50 for dir in $maindir $maindir/openssl $maindir/ssl; do
51 checkssldir $dir && break 2
56 if test -z "$ssldir"; then
57 AC_MSG_RESULT([Not found])
59 echo "Couldn't find your OpenSSL library installation dir"
60 echo "Use --with-openssl option to fix this problem"
64 AC_MSG_RESULT([$ssldir])
66 AC_DEFINE_UNQUOTED(ssldir, "$ssldir")
68 dnl Add OpenSSL includes and libraries
69 CFLAGS="$CFLAGS -I$ssldir/include"
70 AC_ARG_ENABLE(static-openssl,
71 [ --enable-static-openssl link OpenSSL statically],
73 LIBS="$LIBS $ssldir/lib/libcrypto.a"
76 LIBS="$LIBS -L$ssldir/lib -lcrypto"
77 rpath="$rpath:$ssldir/lib"
84 AC_MSG_CHECKING([if architecture needs alignment])
88 int main(int argc, char **argv)
90 unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 };
92 signal(SIGABRT, exit);
93 signal(SIGSEGV, exit);
94 if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) {
101 AC_DEFINE(NEED_ALIGN)],
102 [AC_MSG_RESULT(assuming yes)
103 AC_DEFINE(NEED_ALIGN)])
109 AC_ARG_WITH(egd-socket,
110 [ --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH],
111 [EGD_SOCKET="$withval"],
112 [EGD_SOCKET="/var/run/egd-pool"]
114 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
120 vncserverconfig=libvncserver-config
121 AC_ARG_WITH(libvncserver-config,
122 [ --with-libvncserver-config=CMD use CMD as libvncserver-config],
123 [vncserverconfig="$withval"]
125 AC_ARG_WITH(libvncserver,
126 [ --with-libvncserver make rdp2vnc],
128 VNCINC=`$vncserverconfig --cflags`
130 LDVNC=`$vncserverconfig --libs`
132 VNCLINK=`$vncserverconfig --link`
134 RDP2VNCTARGET="rdp2vnc"
135 AC_SUBST(RDP2VNCTARGET)
143 [ --with-libao=DIR look for libao at DIR/include, DIR/lib],
145 CFLAGS="$CFLAGS -I$withval/include"
146 CPPFLAGS="$CPPFLAGS -I$withval/include"
147 LIBS="$LIBS -L$withval/lib"
148 rpath="$rpath:$withval/lib"
154 [ --with-sound select sound system ("oss", "sgi", "sun" or "libao") ],
158 if test "$sound" = yes; then
159 AC_CHECK_HEADER(ao/ao.h, [sound=libao])
160 AC_CHECK_HEADER(sys/soundcard.h, [sound=oss])
161 AC_CHECK_HEADER(dmedia/audio.h, [sound=sgi])
162 AC_CHECK_HEADER(sys/audioio.h, [sound=sun])
164 if test "$sound" = no; then
166 elif test "$sound" = oss; then
167 SOUNDOBJ="rdpsnd.o rdpsnd_oss.o"
168 AC_DEFINE(WITH_RDPSND)
169 elif test "$sound" = sgi; then
170 SOUNDOBJ="rdpsnd.o rdpsnd_sgi.o"
171 LDFLAGS="$LDFLAGS -laudio"
172 AC_DEFINE(WITH_RDPSND)
173 elif test "$sound" = sun; then
174 SOUNDOBJ="rdpsnd.o rdpsnd_sun.o"
175 AC_DEFINE(WITH_RDPSND)
176 elif test "$sound" = libao; then
177 SOUNDOBJ="rdpsnd.o rdpsnd_libao.o"
178 LDFLAGS="$LDFLAGS -lao"
179 AC_DEFINE(WITH_RDPSND)
181 AC_MSG_WARN([sound support disabled])
182 AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun) and libao])
189 dnl Find out how to get the file descriptor associated with an open DIR*.
190 dnl From Jim Meyering
192 AC_DEFUN([UTILS_FUNC_DIRFD],
199 #else /* not HAVE_DIRENT_H */
200 # define dirent direct
202 # include <sys/ndir.h>
203 # endif /* HAVE_SYS_NDIR_H */
205 # include <sys/dir.h>
206 # endif /* HAVE_SYS_DIR_H */
209 # endif /* HAVE_NDIR_H */
210 #endif /* HAVE_DIRENT_H */
212 AC_CHECK_FUNCS(dirfd)
213 AC_CHECK_DECLS([dirfd], , , $dirfd_headers)
215 AC_CACHE_CHECK([whether dirfd is a macro],
216 jm_cv_func_dirfd_macro,
217 [AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers
219 dirent_header_defines_dirfd
221 jm_cv_func_dirfd_macro=yes,
222 jm_cv_func_dirfd_macro=no)])
224 # Use the replacement only if we have no function, macro,
225 # or declaration with that name.
226 if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \
228 AC_REPLACE_FUNCS([dirfd])
230 [how to get the file descriptor associated with an open DIR*],
231 gl_cv_sys_dir_fd_member_name,
233 dirfd_save_CFLAGS=$CFLAGS
234 for ac_expr in d_fd dd_fd; do
236 CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
240 [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;],
243 CFLAGS=$dirfd_save_CFLAGS
244 test "$dir_fd_found" = yes && break
246 test "$dir_fd_found" = yes || ac_expr=no_such_member
248 gl_cv_sys_dir_fd_member_name=$ac_expr
251 if test $gl_cv_sys_dir_fd_member_name != no_such_member; then
252 AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME,
253 $gl_cv_sys_dir_fd_member_name,
254 [the name of the file descriptor member of DIR])
256 AH_VERBATIM(DIR_TO_FD,
257 [#ifdef DIR_FD_MEMBER_NAME
258 # define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME)
260 # define DIR_TO_FD(Dir_p) -1
273 dnl This macros shamelessly stolen from
274 dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html.
275 dnl Written by Bruno Haible.
277 AC_DEFUN([UTILS_FUNC_ICONV],
279 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
280 dnl those with the standalone portable GNU libiconv installed).
282 AC_ARG_WITH([libiconv-prefix],
283 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
284 for dir in `echo "$withval" | tr : ' '`; do
285 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
286 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
289 AC_CHECK_HEADER(iconv.h, AC_DEFINE(HAVE_ICONV_H))
291 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
292 am_cv_func_iconv="no, consider installing GNU libiconv"
294 AC_TRY_LINK([#include <stdlib.h>
296 [iconv_t cd = iconv_open("","");
297 iconv(cd,NULL,NULL,NULL,NULL);
299 am_cv_func_iconv=yes)
300 if test "$am_cv_func_iconv" != yes; then
303 AC_TRY_LINK([#include <stdlib.h>
305 [iconv_t cd = iconv_open("","");
306 iconv(cd,NULL,NULL,NULL,NULL);
309 am_cv_func_iconv=yes)
313 if test "$am_cv_func_iconv" = yes; then
314 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
315 AC_MSG_CHECKING([for iconv declaration])
316 AC_CACHE_VAL(am_cv_proto_iconv, [
324 #if defined(__STDC__) || defined(__cplusplus)
325 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
329 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
330 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);"])
331 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
332 AC_MSG_RESULT([$]{ac_t:-
333 }[$]am_cv_proto_iconv)
334 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
335 [Define as const if the declaration of iconv() needs const.])
338 if test "$am_cv_lib_iconv" = yes; then
345 LIBS="$LIBS $LIBICONV"
351 dnl Check for socklen_t: historically on BSD it is an int, and in
352 dnl POSIX 1g it is a type of its own, but some platforms use different
353 dnl types for the argument to getsockopt, getpeername, etc. So we
354 dnl have to test to find something that will work.
355 AC_DEFUN([TYPE_SOCKLEN_T],
357 AC_CHECK_TYPE([socklen_t], ,[
358 AC_MSG_CHECKING([for socklen_t equivalent])
359 AC_CACHE_VAL([socklen_t_equiv],
361 # Systems have either "struct sockaddr *" or
362 # "void *" as the second argument to getpeername
364 for arg2 in "struct sockaddr" void; do
365 for t in int size_t unsigned long "unsigned long"; do
367 #include <sys/types.h>
368 #include <sys/socket.h>
370 int getpeername (int, $arg2 *, $t *);
373 getpeername(0,0,&len);
381 if test "x$socklen_t_equiv" = x; then
382 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
385 AC_MSG_RESULT($socklen_t_equiv)
386 AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_equiv,
387 [type to use in place of socklen_t if not defined])],
388 [#include <sys/types.h>
389 #include <sys/socket.h>])
397 AC_CHECK_HEADERS(sys/vfs.h)
398 AC_CHECK_HEADERS(sys/statvfs.h)
399 AC_CHECK_HEADERS(sys/statfs.h)
400 AC_CHECK_HEADERS(sys/param.h)
405 # include <sys/param.h>
409 AC_CHECK_HEADERS(sys/mount.h,,,[$mount_includes])
411 #################################################
412 # these tests are taken from the GNU fileutils package
413 AC_CHECKING(how to get filesystem space usage)
416 # Test for statvfs64.
417 if test $space = no; then
419 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
421 #if defined(HAVE_UNISTD_H)
424 #include <sys/types.h>
425 #include <sys/statvfs.h>
428 struct statvfs64 fsd;
429 exit (statvfs64 (".", &fsd));
431 fu_cv_sys_stat_statvfs64=yes,
432 fu_cv_sys_stat_statvfs64=no,
433 fu_cv_sys_stat_statvfs64=cross)])
434 if test $fu_cv_sys_stat_statvfs64 = yes; then
436 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
440 # Perform only the link test since it seems there are no variants of the
441 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
442 # because that got a false positive on SCO OSR5. Adding the declaration
443 # of a `struct statvfs' causes this test to fail (as it should) on such
444 # systems. That system is reported to work fine with STAT_STATFS4 which
445 # is what it gets when this test fails.
446 if test $space = no; then
448 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
449 [AC_TRY_LINK([#include <sys/types.h>
450 #include <sys/statvfs.h>],
451 [struct statvfs fsd; statvfs (0, &fsd);],
452 fu_cv_sys_stat_statvfs=yes,
453 fu_cv_sys_stat_statvfs=no)])
454 if test $fu_cv_sys_stat_statvfs = yes; then
456 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
460 if test $space = no; then
461 # DEC Alpha running OSF/1
462 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
463 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
465 #include <sys/param.h>
466 #include <sys/types.h>
467 #include <sys/mount.h>
472 exit (statfs (".", &fsd, sizeof (struct statfs)));
474 fu_cv_sys_stat_statfs3_osf1=yes,
475 fu_cv_sys_stat_statfs3_osf1=no,
476 fu_cv_sys_stat_statfs3_osf1=no)])
479 #C_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
480 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
482 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
486 if test $space = no; then
488 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
489 member (AIX, 4.3BSD)])
490 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
492 #ifdef HAVE_SYS_PARAM_H
493 #include <sys/param.h>
495 #ifdef HAVE_SYS_MOUNT_H
496 #include <sys/mount.h>
498 #ifdef HAVE_SYS_VFS_H
505 exit (statfs (".", &fsd));
507 fu_cv_sys_stat_statfs2_bsize=yes,
508 fu_cv_sys_stat_statfs2_bsize=no,
509 fu_cv_sys_stat_statfs2_bsize=no)])
510 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
511 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
513 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
517 if test $space = no; then
519 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
520 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
521 [AC_TRY_RUN([#include <sys/types.h>
522 #include <sys/statfs.h>
526 exit (statfs (".", &fsd, sizeof fsd, 0));
528 fu_cv_sys_stat_statfs4=yes,
529 fu_cv_sys_stat_statfs4=no,
530 fu_cv_sys_stat_statfs4=no)])
531 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
532 if test $fu_cv_sys_stat_statfs4 = yes; then
534 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
538 if test $space = no; then
540 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
541 member (4.4BSD and NetBSD)])
542 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
543 [AC_TRY_RUN([#include <sys/types.h>
544 #ifdef HAVE_SYS_PARAM_H
545 #include <sys/param.h>
547 #ifdef HAVE_SYS_MOUNT_H
548 #include <sys/mount.h>
554 exit (statfs (".", &fsd));
556 fu_cv_sys_stat_statfs2_fsize=yes,
557 fu_cv_sys_stat_statfs2_fsize=no,
558 fu_cv_sys_stat_statfs2_fsize=no)])
559 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
560 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
562 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
566 if test $space = no; then
568 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
569 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
570 [AC_TRY_RUN([#include <sys/types.h>
571 #ifdef HAVE_SYS_PARAM_H
572 #include <sys/param.h>
574 #ifdef HAVE_SYS_MOUNT_H
575 #include <sys/mount.h>
577 #ifdef HAVE_SYS_FS_TYPES_H
578 #include <sys/fs_types.h>
583 /* Ultrix's statfs returns 1 for success,
584 0 for not mounted, -1 for failure. */
585 exit (statfs (".", &fsd) != 1);
587 fu_cv_sys_stat_fs_data=yes,
588 fu_cv_sys_stat_fs_data=no,
589 fu_cv_sys_stat_fs_data=no)])
590 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
591 if test $fu_cv_sys_stat_fs_data = yes; then
593 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
599 #if HAVE_SYS_STATVFS_H
600 # include <sys/statvfs.h>
603 # include <sys/vfs.h>
605 #if !HAVE_SYS_STATVFS_H && !HAVE_SYS_VFS_H
606 # if HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H
607 /* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */
608 # include <sys/param.h>
609 # include <sys/mount.h>
610 # elif HAVE_NETINET_IN_H && HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H
611 /* Ultrix 4.4 needs these for the declaration of struct statfs. */
612 # include <netinet/in.h>
613 # include <nfs/nfs_clnt.h>
614 # include <nfs/vfs.h>
619 AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes])
620 AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes])
621 AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes])
622 AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes])
632 AC_CHECK_HEADER(mntent.h, AC_DEFINE(HAVE_MNTENT_H))
633 AC_CHECK_FUNCS(setmntent)
639 [ --with-ipv6 enable IPv6-support],
641 if test $withval != "no";
652 [ --with-debug enable protocol debugging output],
654 if test $withval != "no";
656 AC_DEFINE(WITH_DEBUG,1)
660 AC_ARG_WITH(debug-kbd,
661 [ --with-debug-kbd enable debugging of keyboard handling],
663 if test $withval != "no";
665 AC_DEFINE(WITH_DEBUG_KBD,1)
669 AC_ARG_WITH(debug-rdp5,
670 [ --with-debug-rdp5 enable debugging of RDP5 code],
672 if test $withval != "no";
674 AC_DEFINE(WITH_DEBUG_RDP5,1)
678 AC_ARG_WITH(debug-clipboard,
679 [ --with-debug-clipboard enable debugging of clipboard code],
681 if test $withval != "no";
683 AC_DEFINE(WITH_DEBUG_CLIPBOARD,1)
687 AC_ARG_WITH(debug-channel,
688 [ --with-debug-channel enable debugging of virtual channel code],
690 if test $withval != "no";
692 AC_DEFINE(WITH_DEBUG_CHANNEL,1)
698 # target-specific stuff
700 # strip leading colon from rpath
701 rpath=`echo $rpath |sed 's/^://'`
705 LDFLAGS="$LDFLAGS -R$rpath"
708 LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath"
711 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
714 LIBS="$LIBS -L$ssldir/lib32 -lcrypto"
715 CFLAGS="$CFLAGS -D__SGI_IRIX__"
723 dnl comment-start: "dnl "
725 dnl comment-start-skip: "\\bdnl\\b\\s *"
726 dnl compile-command: "autoconf"