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