1#*************************************************************************** 2# _ _ ____ _ 3# Project ___| | | | _ \| | 4# / __| | | | |_) | | 5# | (__| |_| | _ <| |___ 6# \___|\___/|_| \_\_____| 7# 8# Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al. 9# 10# This software is licensed as described in the file COPYING, which 11# you should have received as part of this distribution. The terms 12# are also available at https://curl.se/docs/copyright.html. 13# 14# You may opt to use, copy, modify, merge, publish, distribute and/or sell 15# copies of the Software, and permit persons to whom the Software is 16# furnished to do so, under the terms of the COPYING file. 17# 18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19# KIND, either express or implied. 20# 21#*************************************************************************** 22 23# File version for 'aclocal' use. Keep it a single number. 24# serial 73 25 26 27dnl CURL_INCLUDES_ARPA_INET 28dnl ------------------------------------------------- 29dnl Set up variable with list of headers that must be 30dnl included when arpa/inet.h is to be included. 31 32AC_DEFUN([CURL_INCLUDES_ARPA_INET], [ 33curl_includes_arpa_inet="\ 34/* includes start */ 35#ifdef HAVE_SYS_TYPES_H 36# include <sys/types.h> 37#endif 38#ifdef HAVE_SYS_SOCKET_H 39# include <sys/socket.h> 40#endif 41#ifdef HAVE_NETINET_IN_H 42# include <netinet/in.h> 43#endif 44#ifdef HAVE_ARPA_INET_H 45# include <arpa/inet.h> 46#endif 47#ifdef HAVE_WINSOCK2_H 48#include <winsock2.h> 49#include <ws2tcpip.h> 50#endif 51/* includes end */" 52 AC_CHECK_HEADERS( 53 sys/types.h sys/socket.h netinet/in.h arpa/inet.h, 54 [], [], [$curl_includes_arpa_inet]) 55]) 56 57 58dnl CURL_INCLUDES_FCNTL 59dnl ------------------------------------------------- 60dnl Set up variable with list of headers that must be 61dnl included when fcntl.h is to be included. 62 63AC_DEFUN([CURL_INCLUDES_FCNTL], [ 64curl_includes_fcntl="\ 65/* includes start */ 66#ifdef HAVE_SYS_TYPES_H 67# include <sys/types.h> 68#endif 69#ifdef HAVE_UNISTD_H 70# include <unistd.h> 71#endif 72#ifdef HAVE_FCNTL_H 73# include <fcntl.h> 74#endif 75/* includes end */" 76 AC_CHECK_HEADERS( 77 sys/types.h unistd.h fcntl.h, 78 [], [], [$curl_includes_fcntl]) 79]) 80 81 82dnl CURL_INCLUDES_IFADDRS 83dnl ------------------------------------------------- 84dnl Set up variable with list of headers that must be 85dnl included when ifaddrs.h is to be included. 86 87AC_DEFUN([CURL_INCLUDES_IFADDRS], [ 88curl_includes_ifaddrs="\ 89/* includes start */ 90#ifdef HAVE_SYS_TYPES_H 91# include <sys/types.h> 92#endif 93#ifdef HAVE_SYS_SOCKET_H 94# include <sys/socket.h> 95#endif 96#ifdef HAVE_NETINET_IN_H 97# include <netinet/in.h> 98#endif 99#ifdef HAVE_IFADDRS_H 100# include <ifaddrs.h> 101#endif 102/* includes end */" 103 AC_CHECK_HEADERS( 104 sys/types.h sys/socket.h netinet/in.h ifaddrs.h, 105 [], [], [$curl_includes_ifaddrs]) 106]) 107 108 109dnl CURL_INCLUDES_INTTYPES 110dnl ------------------------------------------------- 111dnl Set up variable with list of headers that must be 112dnl included when inttypes.h is to be included. 113 114AC_DEFUN([CURL_INCLUDES_INTTYPES], [ 115curl_includes_inttypes="\ 116/* includes start */ 117#ifdef HAVE_SYS_TYPES_H 118# include <sys/types.h> 119#endif 120#ifdef HAVE_STDINT_H 121# include <stdint.h> 122#endif 123#ifdef HAVE_INTTYPES_H 124# include <inttypes.h> 125#endif 126/* includes end */" 127 case $host_os in 128 irix*) 129 ac_cv_header_stdint_h="no" 130 ;; 131 esac 132 AC_CHECK_HEADERS( 133 sys/types.h stdint.h inttypes.h, 134 [], [], [$curl_includes_inttypes]) 135]) 136 137 138dnl CURL_INCLUDES_LIBGEN 139dnl ------------------------------------------------- 140dnl Set up variable with list of headers that must be 141dnl included when libgen.h is to be included. 142 143AC_DEFUN([CURL_INCLUDES_LIBGEN], [ 144curl_includes_libgen="\ 145/* includes start */ 146#ifdef HAVE_SYS_TYPES_H 147# include <sys/types.h> 148#endif 149#ifdef HAVE_LIBGEN_H 150# include <libgen.h> 151#endif 152/* includes end */" 153 AC_CHECK_HEADERS( 154 sys/types.h libgen.h, 155 [], [], [$curl_includes_libgen]) 156]) 157 158 159dnl CURL_INCLUDES_NETDB 160dnl ------------------------------------------------- 161dnl Set up variable with list of headers that must be 162dnl included when netdb.h is to be included. 163 164AC_DEFUN([CURL_INCLUDES_NETDB], [ 165curl_includes_netdb="\ 166/* includes start */ 167#ifdef HAVE_SYS_TYPES_H 168# include <sys/types.h> 169#endif 170#ifdef HAVE_NETDB_H 171# include <netdb.h> 172#endif 173/* includes end */" 174 AC_CHECK_HEADERS( 175 sys/types.h netdb.h, 176 [], [], [$curl_includes_netdb]) 177]) 178 179 180dnl CURL_INCLUDES_POLL 181dnl ------------------------------------------------- 182dnl Set up variable with list of headers that must be 183dnl included when poll.h is to be included. 184 185AC_DEFUN([CURL_INCLUDES_POLL], [ 186curl_includes_poll="\ 187/* includes start */ 188#ifdef HAVE_SYS_TYPES_H 189# include <sys/types.h> 190#endif 191#ifdef HAVE_POLL_H 192# include <poll.h> 193#endif 194#ifdef HAVE_SYS_POLL_H 195# include <sys/poll.h> 196#endif 197/* includes end */" 198 AC_CHECK_HEADERS( 199 sys/types.h poll.h sys/poll.h, 200 [], [], [$curl_includes_poll]) 201]) 202 203 204dnl CURL_INCLUDES_SETJMP 205dnl ------------------------------------------------- 206dnl Set up variable with list of headers that must be 207dnl included when setjmp.h is to be included. 208 209AC_DEFUN([CURL_INCLUDES_SETJMP], [ 210curl_includes_setjmp="\ 211/* includes start */ 212#ifdef HAVE_SYS_TYPES_H 213# include <sys/types.h> 214#endif 215#ifdef HAVE_SETJMP_H 216# include <setjmp.h> 217#endif 218/* includes end */" 219 AC_CHECK_HEADERS( 220 sys/types.h setjmp.h, 221 [], [], [$curl_includes_setjmp]) 222]) 223 224 225dnl CURL_INCLUDES_SIGNAL 226dnl ------------------------------------------------- 227dnl Set up variable with list of headers that must be 228dnl included when signal.h is to be included. 229 230AC_DEFUN([CURL_INCLUDES_SIGNAL], [ 231curl_includes_signal="\ 232/* includes start */ 233#ifdef HAVE_SYS_TYPES_H 234# include <sys/types.h> 235#endif 236#ifdef HAVE_SIGNAL_H 237# include <signal.h> 238#endif 239/* includes end */" 240 AC_CHECK_HEADERS( 241 sys/types.h signal.h, 242 [], [], [$curl_includes_signal]) 243]) 244 245 246dnl CURL_INCLUDES_SOCKET 247dnl ------------------------------------------------- 248dnl Set up variable with list of headers that must be 249dnl included when socket.h is to be included. 250 251AC_DEFUN([CURL_INCLUDES_SOCKET], [ 252curl_includes_socket="\ 253/* includes start */ 254#ifdef HAVE_SYS_TYPES_H 255# include <sys/types.h> 256#endif 257#ifdef HAVE_SOCKET_H 258# include <socket.h> 259#endif 260/* includes end */" 261 AC_CHECK_HEADERS( 262 sys/types.h socket.h, 263 [], [], [$curl_includes_socket]) 264]) 265 266 267dnl CURL_INCLUDES_STDIO 268dnl ------------------------------------------------- 269dnl Set up variable with list of headers that must be 270dnl included when stdio.h is to be included. 271 272AC_DEFUN([CURL_INCLUDES_STDIO], [ 273curl_includes_stdio="\ 274/* includes start */ 275#ifdef HAVE_SYS_TYPES_H 276# include <sys/types.h> 277#endif 278#ifdef HAVE_STDIO_H 279# include <stdio.h> 280#endif 281/* includes end */" 282 AC_CHECK_HEADERS( 283 sys/types.h stdio.h, 284 [], [], [$curl_includes_stdio]) 285]) 286 287 288dnl CURL_INCLUDES_STDLIB 289dnl ------------------------------------------------- 290dnl Set up variable with list of headers that must be 291dnl included when stdlib.h is to be included. 292 293AC_DEFUN([CURL_INCLUDES_STDLIB], [ 294curl_includes_stdlib="\ 295/* includes start */ 296#ifdef HAVE_SYS_TYPES_H 297# include <sys/types.h> 298#endif 299#ifdef HAVE_STDLIB_H 300# include <stdlib.h> 301#endif 302/* includes end */" 303 AC_CHECK_HEADERS( 304 sys/types.h stdlib.h, 305 [], [], [$curl_includes_stdlib]) 306]) 307 308 309dnl CURL_INCLUDES_STRING 310dnl ------------------------------------------------- 311dnl Set up variable with list of headers that must be 312dnl included when string(s).h is to be included. 313 314AC_DEFUN([CURL_INCLUDES_STRING], [ 315curl_includes_string="\ 316/* includes start */ 317#ifdef HAVE_SYS_TYPES_H 318# include <sys/types.h> 319#endif 320#ifdef HAVE_STRING_H 321# include <string.h> 322#endif 323#ifdef HAVE_STRINGS_H 324# include <strings.h> 325#endif 326/* includes end */" 327 AC_CHECK_HEADERS( 328 sys/types.h string.h strings.h, 329 [], [], [$curl_includes_string]) 330]) 331 332 333dnl CURL_INCLUDES_STROPTS 334dnl ------------------------------------------------- 335dnl Set up variable with list of headers that must be 336dnl included when stropts.h is to be included. 337 338AC_DEFUN([CURL_INCLUDES_STROPTS], [ 339curl_includes_stropts="\ 340/* includes start */ 341#ifdef HAVE_SYS_TYPES_H 342# include <sys/types.h> 343#endif 344#ifdef HAVE_UNISTD_H 345# include <unistd.h> 346#endif 347#ifdef HAVE_SYS_SOCKET_H 348# include <sys/socket.h> 349#endif 350#ifdef HAVE_SYS_IOCTL_H 351# include <sys/ioctl.h> 352#endif 353#ifdef HAVE_STROPTS_H 354# include <stropts.h> 355#endif 356/* includes end */" 357 AC_CHECK_HEADERS( 358 sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h, 359 [], [], [$curl_includes_stropts]) 360]) 361 362 363dnl CURL_INCLUDES_SYS_SOCKET 364dnl ------------------------------------------------- 365dnl Set up variable with list of headers that must be 366dnl included when sys/socket.h is to be included. 367 368AC_DEFUN([CURL_INCLUDES_SYS_SOCKET], [ 369curl_includes_sys_socket="\ 370/* includes start */ 371#ifdef HAVE_SYS_TYPES_H 372# include <sys/types.h> 373#endif 374#ifdef HAVE_SYS_SOCKET_H 375# include <sys/socket.h> 376#endif 377/* includes end */" 378 AC_CHECK_HEADERS( 379 sys/types.h sys/socket.h, 380 [], [], [$curl_includes_sys_socket]) 381]) 382 383 384dnl CURL_INCLUDES_SYS_TYPES 385dnl ------------------------------------------------- 386dnl Set up variable with list of headers that must be 387dnl included when sys/types.h is to be included. 388 389AC_DEFUN([CURL_INCLUDES_SYS_TYPES], [ 390curl_includes_sys_types="\ 391/* includes start */ 392#ifdef HAVE_SYS_TYPES_H 393# include <sys/types.h> 394#endif 395/* includes end */" 396 AC_CHECK_HEADERS( 397 sys/types.h, 398 [], [], [$curl_includes_sys_types]) 399]) 400 401 402dnl CURL_INCLUDES_SYS_UIO 403dnl ------------------------------------------------- 404dnl Set up variable with list of headers that must be 405dnl included when sys/uio.h is to be included. 406 407AC_DEFUN([CURL_INCLUDES_SYS_UIO], [ 408curl_includes_sys_uio="\ 409/* includes start */ 410#ifdef HAVE_SYS_TYPES_H 411# include <sys/types.h> 412#endif 413#ifdef HAVE_SYS_UIO_H 414# include <sys/uio.h> 415#endif 416/* includes end */" 417 AC_CHECK_HEADERS( 418 sys/types.h sys/uio.h, 419 [], [], [$curl_includes_sys_uio]) 420]) 421 422 423dnl CURL_INCLUDES_SYS_XATTR 424dnl ------------------------------------------------- 425dnl Set up variable with list of headers that must be 426dnl included when sys/xattr.h is to be included. 427 428AC_DEFUN([CURL_INCLUDES_SYS_XATTR], [ 429curl_includes_sys_xattr="\ 430/* includes start */ 431#ifdef HAVE_SYS_TYPES_H 432# include <sys/types.h> 433#endif 434#ifdef HAVE_SYS_XATTR_H 435# include <sys/xattr.h> 436#endif 437/* includes end */" 438 AC_CHECK_HEADERS( 439 sys/types.h sys/xattr.h, 440 [], [], [$curl_includes_sys_xattr]) 441]) 442 443dnl CURL_INCLUDES_TIME 444dnl ------------------------------------------------- 445dnl Set up variable with list of headers that must be 446dnl included when time.h is to be included. 447 448AC_DEFUN([CURL_INCLUDES_TIME], [ 449curl_includes_time="\ 450/* includes start */ 451#ifdef HAVE_SYS_TYPES_H 452# include <sys/types.h> 453#endif 454#ifdef HAVE_SYS_TIME_H 455# include <sys/time.h> 456#endif 457#include <time.h> 458/* includes end */" 459 AC_CHECK_HEADERS( 460 sys/types.h sys/time.h, 461 [], [], [$curl_includes_time]) 462]) 463 464 465dnl CURL_INCLUDES_UNISTD 466dnl ------------------------------------------------- 467dnl Set up variable with list of headers that must be 468dnl included when unistd.h is to be included. 469 470AC_DEFUN([CURL_INCLUDES_UNISTD], [ 471curl_includes_unistd="\ 472/* includes start */ 473#ifdef HAVE_SYS_TYPES_H 474# include <sys/types.h> 475#endif 476#ifdef HAVE_UNISTD_H 477# include <unistd.h> 478#endif 479/* includes end */" 480 AC_CHECK_HEADERS( 481 sys/types.h unistd.h, 482 [], [], [$curl_includes_unistd]) 483]) 484 485 486dnl CURL_INCLUDES_WINSOCK2 487dnl ------------------------------------------------- 488dnl Set up variable with list of headers that must be 489dnl included when winsock2.h is to be included. 490 491AC_DEFUN([CURL_INCLUDES_WINSOCK2], [ 492curl_includes_winsock2="\ 493/* includes start */ 494#ifdef HAVE_WINDOWS_H 495# ifndef WIN32_LEAN_AND_MEAN 496# define WIN32_LEAN_AND_MEAN 497# endif 498# include <windows.h> 499# ifdef HAVE_WINSOCK2_H 500# include <winsock2.h> 501# endif 502#endif 503/* includes end */" 504 CURL_CHECK_HEADER_WINDOWS 505 CURL_CHECK_HEADER_WINSOCK2 506]) 507 508 509dnl CURL_INCLUDES_WS2TCPIP 510dnl ------------------------------------------------- 511dnl Set up variable with list of headers that must be 512dnl included when ws2tcpip.h is to be included. 513 514AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [ 515curl_includes_ws2tcpip="\ 516/* includes start */ 517#ifdef HAVE_WINDOWS_H 518# ifndef WIN32_LEAN_AND_MEAN 519# define WIN32_LEAN_AND_MEAN 520# endif 521# include <windows.h> 522# ifdef HAVE_WINSOCK2_H 523# include <winsock2.h> 524# ifdef HAVE_WS2TCPIP_H 525# include <ws2tcpip.h> 526# endif 527# endif 528#endif 529/* includes end */" 530 CURL_CHECK_HEADER_WINDOWS 531 CURL_CHECK_HEADER_WINSOCK2 532 CURL_CHECK_HEADER_WS2TCPIP 533]) 534 535 536dnl CURL_INCLUDES_BSDSOCKET 537dnl ------------------------------------------------- 538dnl Set up variable with list of headers that must be 539dnl included when bsdsocket.h is to be included. 540 541AC_DEFUN([CURL_INCLUDES_BSDSOCKET], [ 542curl_includes_bsdsocket="\ 543/* includes start */ 544#ifdef HAVE_PROTO_BSDSOCKET_H 545# include <proto/bsdsocket.h> 546 struct Library *SocketBase = NULL; 547#endif 548/* includes end */" 549 AC_CHECK_HEADERS( 550 proto/bsdsocket.h, 551 [], [], [ $curl_includes_bsdsocket]) 552]) 553 554dnl CURL_INCLUDES_NETIF 555dnl ------------------------------------------------- 556dnl Set up variable with list of headers that must be 557dnl included when net/if.h is to be included. 558 559AC_DEFUN([CURL_INCLUDES_NETIF], [ 560curl_includes_netif="\ 561/* includes start */ 562#ifdef HAVE_NET_IF_H 563# include <net/if.h> 564#endif 565/* includes end */" 566 AC_CHECK_HEADERS( 567 net/if.h, 568 [], [], [$curl_includes_netif]) 569]) 570 571 572dnl CURL_PREPROCESS_CALLCONV 573dnl ------------------------------------------------- 574dnl Set up variable with a preprocessor block which 575dnl defines function calling convention. 576 577AC_DEFUN([CURL_PREPROCESS_CALLCONV], [ 578curl_preprocess_callconv="\ 579/* preprocess start */ 580#ifdef HAVE_WINDOWS_H 581# define FUNCALLCONV __stdcall 582#else 583# define FUNCALLCONV 584#endif 585/* preprocess end */" 586]) 587 588 589dnl CURL_CHECK_FUNC_ALARM 590dnl ------------------------------------------------- 591dnl Verify if alarm is available, prototyped, and 592dnl can be compiled. If all of these are true, and 593dnl usage has not been previously disallowed with 594dnl shell variable curl_disallow_alarm, then 595dnl HAVE_ALARM will be defined. 596 597AC_DEFUN([CURL_CHECK_FUNC_ALARM], [ 598 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 599 # 600 tst_links_alarm="unknown" 601 tst_proto_alarm="unknown" 602 tst_compi_alarm="unknown" 603 tst_allow_alarm="unknown" 604 # 605 AC_MSG_CHECKING([if alarm can be linked]) 606 AC_LINK_IFELSE([ 607 AC_LANG_FUNC_LINK_TRY([alarm]) 608 ],[ 609 AC_MSG_RESULT([yes]) 610 tst_links_alarm="yes" 611 ],[ 612 AC_MSG_RESULT([no]) 613 tst_links_alarm="no" 614 ]) 615 # 616 if test "$tst_links_alarm" = "yes"; then 617 AC_MSG_CHECKING([if alarm is prototyped]) 618 AC_EGREP_CPP([alarm],[ 619 $curl_includes_unistd 620 ],[ 621 AC_MSG_RESULT([yes]) 622 tst_proto_alarm="yes" 623 ],[ 624 AC_MSG_RESULT([no]) 625 tst_proto_alarm="no" 626 ]) 627 fi 628 # 629 if test "$tst_proto_alarm" = "yes"; then 630 AC_MSG_CHECKING([if alarm is compilable]) 631 AC_COMPILE_IFELSE([ 632 AC_LANG_PROGRAM([[ 633 $curl_includes_unistd 634 ]],[[ 635 if(0 != alarm(0)) 636 return 1; 637 ]]) 638 ],[ 639 AC_MSG_RESULT([yes]) 640 tst_compi_alarm="yes" 641 ],[ 642 AC_MSG_RESULT([no]) 643 tst_compi_alarm="no" 644 ]) 645 fi 646 # 647 if test "$tst_compi_alarm" = "yes"; then 648 AC_MSG_CHECKING([if alarm usage allowed]) 649 if test "x$curl_disallow_alarm" != "xyes"; then 650 AC_MSG_RESULT([yes]) 651 tst_allow_alarm="yes" 652 else 653 AC_MSG_RESULT([no]) 654 tst_allow_alarm="no" 655 fi 656 fi 657 # 658 AC_MSG_CHECKING([if alarm might be used]) 659 if test "$tst_links_alarm" = "yes" && 660 test "$tst_proto_alarm" = "yes" && 661 test "$tst_compi_alarm" = "yes" && 662 test "$tst_allow_alarm" = "yes"; then 663 AC_MSG_RESULT([yes]) 664 AC_DEFINE_UNQUOTED(HAVE_ALARM, 1, 665 [Define to 1 if you have the alarm function.]) 666 curl_cv_func_alarm="yes" 667 else 668 AC_MSG_RESULT([no]) 669 curl_cv_func_alarm="no" 670 fi 671]) 672 673 674dnl CURL_CHECK_FUNC_BASENAME 675dnl ------------------------------------------------- 676dnl Verify if basename is available, prototyped, and 677dnl can be compiled. If all of these are true, and 678dnl usage has not been previously disallowed with 679dnl shell variable curl_disallow_basename, then 680dnl HAVE_BASENAME will be defined. 681 682AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [ 683 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 684 AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl 685 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 686 # 687 tst_links_basename="unknown" 688 tst_proto_basename="unknown" 689 tst_compi_basename="unknown" 690 tst_allow_basename="unknown" 691 # 692 AC_MSG_CHECKING([if basename can be linked]) 693 AC_LINK_IFELSE([ 694 AC_LANG_FUNC_LINK_TRY([basename]) 695 ],[ 696 AC_MSG_RESULT([yes]) 697 tst_links_basename="yes" 698 ],[ 699 AC_MSG_RESULT([no]) 700 tst_links_basename="no" 701 ]) 702 # 703 if test "$tst_links_basename" = "yes"; then 704 AC_MSG_CHECKING([if basename is prototyped]) 705 AC_EGREP_CPP([basename],[ 706 $curl_includes_string 707 $curl_includes_libgen 708 $curl_includes_unistd 709 ],[ 710 AC_MSG_RESULT([yes]) 711 tst_proto_basename="yes" 712 ],[ 713 AC_MSG_RESULT([no]) 714 tst_proto_basename="no" 715 ]) 716 fi 717 # 718 if test "$tst_proto_basename" = "yes"; then 719 AC_MSG_CHECKING([if basename is compilable]) 720 AC_COMPILE_IFELSE([ 721 AC_LANG_PROGRAM([[ 722 $curl_includes_string 723 $curl_includes_libgen 724 $curl_includes_unistd 725 ]],[[ 726 if(0 != basename(0)) 727 return 1; 728 ]]) 729 ],[ 730 AC_MSG_RESULT([yes]) 731 tst_compi_basename="yes" 732 ],[ 733 AC_MSG_RESULT([no]) 734 tst_compi_basename="no" 735 ]) 736 fi 737 # 738 if test "$tst_compi_basename" = "yes"; then 739 AC_MSG_CHECKING([if basename usage allowed]) 740 if test "x$curl_disallow_basename" != "xyes"; then 741 AC_MSG_RESULT([yes]) 742 tst_allow_basename="yes" 743 else 744 AC_MSG_RESULT([no]) 745 tst_allow_basename="no" 746 fi 747 fi 748 # 749 AC_MSG_CHECKING([if basename might be used]) 750 if test "$tst_links_basename" = "yes" && 751 test "$tst_proto_basename" = "yes" && 752 test "$tst_compi_basename" = "yes" && 753 test "$tst_allow_basename" = "yes"; then 754 AC_MSG_RESULT([yes]) 755 AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1, 756 [Define to 1 if you have the basename function.]) 757 curl_cv_func_basename="yes" 758 else 759 AC_MSG_RESULT([no]) 760 curl_cv_func_basename="no" 761 fi 762]) 763 764 765dnl CURL_CHECK_FUNC_CLOSESOCKET 766dnl ------------------------------------------------- 767dnl Verify if closesocket is available, prototyped, and 768dnl can be compiled. If all of these are true, and 769dnl usage has not been previously disallowed with 770dnl shell variable curl_disallow_closesocket, then 771dnl HAVE_CLOSESOCKET will be defined. 772 773AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET], [ 774 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 775 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl 776 # 777 tst_links_closesocket="unknown" 778 tst_proto_closesocket="unknown" 779 tst_compi_closesocket="unknown" 780 tst_allow_closesocket="unknown" 781 # 782 AC_MSG_CHECKING([if closesocket can be linked]) 783 AC_LINK_IFELSE([ 784 AC_LANG_PROGRAM([[ 785 $curl_includes_winsock2 786 $curl_includes_bsdsocket 787 $curl_includes_socket 788 ]],[[ 789 if(0 != closesocket(0)) 790 return 1; 791 ]]) 792 ],[ 793 AC_MSG_RESULT([yes]) 794 tst_links_closesocket="yes" 795 ],[ 796 AC_MSG_RESULT([no]) 797 tst_links_closesocket="no" 798 ]) 799 # 800 if test "$tst_links_closesocket" = "yes"; then 801 AC_MSG_CHECKING([if closesocket is prototyped]) 802 AC_EGREP_CPP([closesocket],[ 803 $curl_includes_winsock2 804 $curl_includes_bsdsocket 805 $curl_includes_socket 806 ],[ 807 AC_MSG_RESULT([yes]) 808 tst_proto_closesocket="yes" 809 ],[ 810 AC_MSG_RESULT([no]) 811 tst_proto_closesocket="no" 812 ]) 813 fi 814 # 815 if test "$tst_proto_closesocket" = "yes"; then 816 AC_MSG_CHECKING([if closesocket is compilable]) 817 AC_COMPILE_IFELSE([ 818 AC_LANG_PROGRAM([[ 819 $curl_includes_winsock2 820 $curl_includes_bsdsocket 821 $curl_includes_socket 822 ]],[[ 823 if(0 != closesocket(0)) 824 return 1; 825 ]]) 826 ],[ 827 AC_MSG_RESULT([yes]) 828 tst_compi_closesocket="yes" 829 ],[ 830 AC_MSG_RESULT([no]) 831 tst_compi_closesocket="no" 832 ]) 833 fi 834 # 835 if test "$tst_compi_closesocket" = "yes"; then 836 AC_MSG_CHECKING([if closesocket usage allowed]) 837 if test "x$curl_disallow_closesocket" != "xyes"; then 838 AC_MSG_RESULT([yes]) 839 tst_allow_closesocket="yes" 840 else 841 AC_MSG_RESULT([no]) 842 tst_allow_closesocket="no" 843 fi 844 fi 845 # 846 AC_MSG_CHECKING([if closesocket might be used]) 847 if test "$tst_links_closesocket" = "yes" && 848 test "$tst_proto_closesocket" = "yes" && 849 test "$tst_compi_closesocket" = "yes" && 850 test "$tst_allow_closesocket" = "yes"; then 851 AC_MSG_RESULT([yes]) 852 AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1, 853 [Define to 1 if you have the closesocket function.]) 854 curl_cv_func_closesocket="yes" 855 else 856 AC_MSG_RESULT([no]) 857 curl_cv_func_closesocket="no" 858 fi 859]) 860 861 862dnl CURL_CHECK_FUNC_CLOSESOCKET_CAMEL 863dnl ------------------------------------------------- 864dnl Verify if CloseSocket is available, prototyped, and 865dnl can be compiled. If all of these are true, and 866dnl usage has not been previously disallowed with 867dnl shell variable curl_disallow_closesocket_camel, 868dnl then HAVE_CLOSESOCKET_CAMEL will be defined. 869 870AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [ 871 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 872 # 873 tst_links_closesocket_camel="unknown" 874 tst_proto_closesocket_camel="unknown" 875 tst_compi_closesocket_camel="unknown" 876 tst_allow_closesocket_camel="unknown" 877 # 878 AC_MSG_CHECKING([if CloseSocket can be linked]) 879 AC_LINK_IFELSE([ 880 AC_LANG_PROGRAM([[ 881 $curl_includes_sys_socket 882 ]],[[ 883 if(0 != CloseSocket(0)) 884 return 1; 885 ]]) 886 ],[ 887 AC_MSG_RESULT([yes]) 888 tst_links_closesocket_camel="yes" 889 ],[ 890 AC_MSG_RESULT([no]) 891 tst_links_closesocket_camel="no" 892 ]) 893 # 894 if test "$tst_links_closesocket_camel" = "yes"; then 895 AC_MSG_CHECKING([if CloseSocket is prototyped]) 896 AC_EGREP_CPP([CloseSocket],[ 897 $curl_includes_sys_socket 898 ],[ 899 AC_MSG_RESULT([yes]) 900 tst_proto_closesocket_camel="yes" 901 ],[ 902 AC_MSG_RESULT([no]) 903 tst_proto_closesocket_camel="no" 904 ]) 905 fi 906 # 907 if test "$tst_proto_closesocket_camel" = "yes"; then 908 AC_MSG_CHECKING([if CloseSocket is compilable]) 909 AC_COMPILE_IFELSE([ 910 AC_LANG_PROGRAM([[ 911 $curl_includes_sys_socket 912 ]],[[ 913 if(0 != CloseSocket(0)) 914 return 1; 915 ]]) 916 ],[ 917 AC_MSG_RESULT([yes]) 918 tst_compi_closesocket_camel="yes" 919 ],[ 920 AC_MSG_RESULT([no]) 921 tst_compi_closesocket_camel="no" 922 ]) 923 fi 924 # 925 if test "$tst_compi_closesocket_camel" = "yes"; then 926 AC_MSG_CHECKING([if CloseSocket usage allowed]) 927 if test "x$curl_disallow_closesocket_camel" != "xyes"; then 928 AC_MSG_RESULT([yes]) 929 tst_allow_closesocket_camel="yes" 930 else 931 AC_MSG_RESULT([no]) 932 tst_allow_closesocket_camel="no" 933 fi 934 fi 935 # 936 AC_MSG_CHECKING([if CloseSocket might be used]) 937 if test "$tst_links_closesocket_camel" = "yes" && 938 test "$tst_proto_closesocket_camel" = "yes" && 939 test "$tst_compi_closesocket_camel" = "yes" && 940 test "$tst_allow_closesocket_camel" = "yes"; then 941 AC_MSG_RESULT([yes]) 942 AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1, 943 [Define to 1 if you have the CloseSocket camel case function.]) 944 curl_cv_func_closesocket_camel="yes" 945 else 946 AC_MSG_RESULT([no]) 947 curl_cv_func_closesocket_camel="no" 948 fi 949]) 950 951 952dnl CURL_CHECK_FUNC_CONNECT 953dnl ------------------------------------------------- 954dnl Verify if connect is available, prototyped, and 955dnl can be compiled. If all of these are true, and 956dnl usage has not been previously disallowed with 957dnl shell variable curl_disallow_connect, then 958dnl HAVE_CONNECT will be defined. 959 960AC_DEFUN([CURL_CHECK_FUNC_CONNECT], [ 961 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 962 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 963 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl 964 # 965 tst_links_connect="unknown" 966 tst_proto_connect="unknown" 967 tst_compi_connect="unknown" 968 tst_allow_connect="unknown" 969 # 970 AC_MSG_CHECKING([if connect can be linked]) 971 AC_LINK_IFELSE([ 972 AC_LANG_PROGRAM([[ 973 $curl_includes_winsock2 974 $curl_includes_bsdsocket 975 $curl_includes_sys_socket 976 $curl_includes_socket 977 ]],[[ 978 if(0 != connect(0, 0, 0)) 979 return 1; 980 ]]) 981 ],[ 982 AC_MSG_RESULT([yes]) 983 tst_links_connect="yes" 984 ],[ 985 AC_MSG_RESULT([no]) 986 tst_links_connect="no" 987 ]) 988 # 989 if test "$tst_links_connect" = "yes"; then 990 AC_MSG_CHECKING([if connect is prototyped]) 991 AC_EGREP_CPP([connect],[ 992 $curl_includes_winsock2 993 $curl_includes_bsdsocket 994 $curl_includes_sys_socket 995 $curl_includes_socket 996 ],[ 997 AC_MSG_RESULT([yes]) 998 tst_proto_connect="yes" 999 ],[ 1000 AC_MSG_RESULT([no]) 1001 tst_proto_connect="no" 1002 ]) 1003 fi 1004 # 1005 if test "$tst_proto_connect" = "yes"; then 1006 AC_MSG_CHECKING([if connect is compilable]) 1007 AC_COMPILE_IFELSE([ 1008 AC_LANG_PROGRAM([[ 1009 $curl_includes_winsock2 1010 $curl_includes_bsdsocket 1011 $curl_includes_sys_socket 1012 $curl_includes_socket 1013 ]],[[ 1014 if(0 != connect(0, 0, 0)) 1015 return 1; 1016 ]]) 1017 ],[ 1018 AC_MSG_RESULT([yes]) 1019 tst_compi_connect="yes" 1020 ],[ 1021 AC_MSG_RESULT([no]) 1022 tst_compi_connect="no" 1023 ]) 1024 fi 1025 # 1026 if test "$tst_compi_connect" = "yes"; then 1027 AC_MSG_CHECKING([if connect usage allowed]) 1028 if test "x$curl_disallow_connect" != "xyes"; then 1029 AC_MSG_RESULT([yes]) 1030 tst_allow_connect="yes" 1031 else 1032 AC_MSG_RESULT([no]) 1033 tst_allow_connect="no" 1034 fi 1035 fi 1036 # 1037 AC_MSG_CHECKING([if connect might be used]) 1038 if test "$tst_links_connect" = "yes" && 1039 test "$tst_proto_connect" = "yes" && 1040 test "$tst_compi_connect" = "yes" && 1041 test "$tst_allow_connect" = "yes"; then 1042 AC_MSG_RESULT([yes]) 1043 AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1, 1044 [Define to 1 if you have the connect function.]) 1045 curl_cv_func_connect="yes" 1046 else 1047 AC_MSG_RESULT([no]) 1048 curl_cv_func_connect="no" 1049 fi 1050]) 1051 1052 1053dnl CURL_CHECK_FUNC_FCNTL 1054dnl ------------------------------------------------- 1055dnl Verify if fcntl is available, prototyped, and 1056dnl can be compiled. If all of these are true, and 1057dnl usage has not been previously disallowed with 1058dnl shell variable curl_disallow_fcntl, then 1059dnl HAVE_FCNTL will be defined. 1060 1061AC_DEFUN([CURL_CHECK_FUNC_FCNTL], [ 1062 AC_REQUIRE([CURL_INCLUDES_FCNTL])dnl 1063 # 1064 tst_links_fcntl="unknown" 1065 tst_proto_fcntl="unknown" 1066 tst_compi_fcntl="unknown" 1067 tst_allow_fcntl="unknown" 1068 # 1069 AC_MSG_CHECKING([if fcntl can be linked]) 1070 AC_LINK_IFELSE([ 1071 AC_LANG_FUNC_LINK_TRY([fcntl]) 1072 ],[ 1073 AC_MSG_RESULT([yes]) 1074 tst_links_fcntl="yes" 1075 ],[ 1076 AC_MSG_RESULT([no]) 1077 tst_links_fcntl="no" 1078 ]) 1079 # 1080 if test "$tst_links_fcntl" = "yes"; then 1081 AC_MSG_CHECKING([if fcntl is prototyped]) 1082 AC_EGREP_CPP([fcntl],[ 1083 $curl_includes_fcntl 1084 ],[ 1085 AC_MSG_RESULT([yes]) 1086 tst_proto_fcntl="yes" 1087 ],[ 1088 AC_MSG_RESULT([no]) 1089 tst_proto_fcntl="no" 1090 ]) 1091 fi 1092 # 1093 if test "$tst_proto_fcntl" = "yes"; then 1094 AC_MSG_CHECKING([if fcntl is compilable]) 1095 AC_COMPILE_IFELSE([ 1096 AC_LANG_PROGRAM([[ 1097 $curl_includes_fcntl 1098 ]],[[ 1099 if(0 != fcntl(0, 0, 0)) 1100 return 1; 1101 ]]) 1102 ],[ 1103 AC_MSG_RESULT([yes]) 1104 tst_compi_fcntl="yes" 1105 ],[ 1106 AC_MSG_RESULT([no]) 1107 tst_compi_fcntl="no" 1108 ]) 1109 fi 1110 # 1111 if test "$tst_compi_fcntl" = "yes"; then 1112 AC_MSG_CHECKING([if fcntl usage allowed]) 1113 if test "x$curl_disallow_fcntl" != "xyes"; then 1114 AC_MSG_RESULT([yes]) 1115 tst_allow_fcntl="yes" 1116 else 1117 AC_MSG_RESULT([no]) 1118 tst_allow_fcntl="no" 1119 fi 1120 fi 1121 # 1122 AC_MSG_CHECKING([if fcntl might be used]) 1123 if test "$tst_links_fcntl" = "yes" && 1124 test "$tst_proto_fcntl" = "yes" && 1125 test "$tst_compi_fcntl" = "yes" && 1126 test "$tst_allow_fcntl" = "yes"; then 1127 AC_MSG_RESULT([yes]) 1128 AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1, 1129 [Define to 1 if you have the fcntl function.]) 1130 curl_cv_func_fcntl="yes" 1131 CURL_CHECK_FUNC_FCNTL_O_NONBLOCK 1132 else 1133 AC_MSG_RESULT([no]) 1134 curl_cv_func_fcntl="no" 1135 fi 1136]) 1137 1138 1139dnl CURL_CHECK_FUNC_FCNTL_O_NONBLOCK 1140dnl ------------------------------------------------- 1141dnl Verify if fcntl with status flag O_NONBLOCK is 1142dnl available, can be compiled, and seems to work. If 1143dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK 1144dnl will be defined. 1145 1146AC_DEFUN([CURL_CHECK_FUNC_FCNTL_O_NONBLOCK], [ 1147 # 1148 tst_compi_fcntl_o_nonblock="unknown" 1149 tst_allow_fcntl_o_nonblock="unknown" 1150 # 1151 case $host_os in 1152 sunos4* | aix3* | beos*) 1153 dnl O_NONBLOCK does not work on these platforms 1154 curl_disallow_fcntl_o_nonblock="yes" 1155 ;; 1156 esac 1157 # 1158 if test "$curl_cv_func_fcntl" = "yes"; then 1159 AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable]) 1160 AC_COMPILE_IFELSE([ 1161 AC_LANG_PROGRAM([[ 1162 $curl_includes_fcntl 1163 ]],[[ 1164 int flags = 0; 1165 if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) 1166 return 1; 1167 ]]) 1168 ],[ 1169 AC_MSG_RESULT([yes]) 1170 tst_compi_fcntl_o_nonblock="yes" 1171 ],[ 1172 AC_MSG_RESULT([no]) 1173 tst_compi_fcntl_o_nonblock="no" 1174 ]) 1175 fi 1176 # 1177 if test "$tst_compi_fcntl_o_nonblock" = "yes"; then 1178 AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed]) 1179 if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then 1180 AC_MSG_RESULT([yes]) 1181 tst_allow_fcntl_o_nonblock="yes" 1182 else 1183 AC_MSG_RESULT([no]) 1184 tst_allow_fcntl_o_nonblock="no" 1185 fi 1186 fi 1187 # 1188 AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used]) 1189 if test "$tst_compi_fcntl_o_nonblock" = "yes" && 1190 test "$tst_allow_fcntl_o_nonblock" = "yes"; then 1191 AC_MSG_RESULT([yes]) 1192 AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1, 1193 [Define to 1 if you have a working fcntl O_NONBLOCK function.]) 1194 curl_cv_func_fcntl_o_nonblock="yes" 1195 else 1196 AC_MSG_RESULT([no]) 1197 curl_cv_func_fcntl_o_nonblock="no" 1198 fi 1199]) 1200 1201dnl CURL_CHECK_FUNC_FGETXATTR 1202dnl ------------------------------------------------- 1203dnl Verify if fgetxattr is available, prototyped, and 1204dnl can be compiled. If all of these are true, and 1205dnl usage has not been previously disallowed with 1206dnl shell variable curl_disallow_fgetxattr, then 1207dnl HAVE_FGETXATTR will be defined. 1208 1209AC_DEFUN([CURL_CHECK_FUNC_FGETXATTR], [ 1210 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 1211 # 1212 tst_links_fgetxattr="unknown" 1213 tst_proto_fgetxattr="unknown" 1214 tst_compi_fgetxattr="unknown" 1215 tst_allow_fgetxattr="unknown" 1216 tst_nargs_fgetxattr="unknown" 1217 # 1218 AC_MSG_CHECKING([if fgetxattr can be linked]) 1219 AC_LINK_IFELSE([ 1220 AC_LANG_FUNC_LINK_TRY([fgetxattr]) 1221 ],[ 1222 AC_MSG_RESULT([yes]) 1223 tst_links_fgetxattr="yes" 1224 ],[ 1225 AC_MSG_RESULT([no]) 1226 tst_links_fgetxattr="no" 1227 ]) 1228 # 1229 if test "$tst_links_fgetxattr" = "yes"; then 1230 AC_MSG_CHECKING([if fgetxattr is prototyped]) 1231 AC_EGREP_CPP([fgetxattr],[ 1232 $curl_includes_sys_xattr 1233 ],[ 1234 AC_MSG_RESULT([yes]) 1235 tst_proto_fgetxattr="yes" 1236 ],[ 1237 AC_MSG_RESULT([no]) 1238 tst_proto_fgetxattr="no" 1239 ]) 1240 fi 1241 # 1242 if test "$tst_proto_fgetxattr" = "yes"; then 1243 if test "$tst_nargs_fgetxattr" = "unknown"; then 1244 AC_MSG_CHECKING([if fgetxattr takes 4 args.]) 1245 AC_COMPILE_IFELSE([ 1246 AC_LANG_PROGRAM([[ 1247 $curl_includes_sys_xattr 1248 ]],[[ 1249 if(0 != fgetxattr(0, 0, 0, 0)) 1250 return 1; 1251 ]]) 1252 ],[ 1253 AC_MSG_RESULT([yes]) 1254 tst_compi_fgetxattr="yes" 1255 tst_nargs_fgetxattr="4" 1256 ],[ 1257 AC_MSG_RESULT([no]) 1258 tst_compi_fgetxattr="no" 1259 ]) 1260 fi 1261 if test "$tst_nargs_fgetxattr" = "unknown"; then 1262 AC_MSG_CHECKING([if fgetxattr takes 6 args.]) 1263 AC_COMPILE_IFELSE([ 1264 AC_LANG_PROGRAM([[ 1265 $curl_includes_sys_xattr 1266 ]],[[ 1267 if(0 != fgetxattr(0, 0, 0, 0, 0, 0)) 1268 return 1; 1269 ]]) 1270 ],[ 1271 AC_MSG_RESULT([yes]) 1272 tst_compi_fgetxattr="yes" 1273 tst_nargs_fgetxattr="6" 1274 ],[ 1275 AC_MSG_RESULT([no]) 1276 tst_compi_fgetxattr="no" 1277 ]) 1278 fi 1279 AC_MSG_CHECKING([if fgetxattr is compilable]) 1280 if test "$tst_compi_fgetxattr" = "yes"; then 1281 AC_MSG_RESULT([yes]) 1282 else 1283 AC_MSG_RESULT([no]) 1284 fi 1285 fi 1286 # 1287 if test "$tst_compi_fgetxattr" = "yes"; then 1288 AC_MSG_CHECKING([if fgetxattr usage allowed]) 1289 if test "x$curl_disallow_fgetxattr" != "xyes"; then 1290 AC_MSG_RESULT([yes]) 1291 tst_allow_fgetxattr="yes" 1292 else 1293 AC_MSG_RESULT([no]) 1294 tst_allow_fgetxattr="no" 1295 fi 1296 fi 1297 # 1298 AC_MSG_CHECKING([if fgetxattr might be used]) 1299 if test "$tst_links_fgetxattr" = "yes" && 1300 test "$tst_proto_fgetxattr" = "yes" && 1301 test "$tst_compi_fgetxattr" = "yes" && 1302 test "$tst_allow_fgetxattr" = "yes"; then 1303 AC_MSG_RESULT([yes]) 1304 AC_DEFINE_UNQUOTED(HAVE_FGETXATTR, 1, 1305 [Define to 1 if you have the fgetxattr function.]) 1306 dnl AC_DEFINE_UNQUOTED(FGETXATTR_ARGS, $tst_nargs_fgetxattr, 1307 dnl [Specifies the number of arguments to fgetxattr]) 1308 # 1309 if test "$tst_nargs_fgetxattr" -eq "4"; then 1310 AC_DEFINE(HAVE_FGETXATTR_4, 1, [fgetxattr() takes 4 args]) 1311 elif test "$tst_nargs_fgetxattr" -eq "6"; then 1312 AC_DEFINE(HAVE_FGETXATTR_6, 1, [fgetxattr() takes 6 args]) 1313 fi 1314 # 1315 curl_cv_func_fgetxattr="yes" 1316 else 1317 AC_MSG_RESULT([no]) 1318 curl_cv_func_fgetxattr="no" 1319 fi 1320]) 1321 1322 1323dnl CURL_CHECK_FUNC_FLISTXATTR 1324dnl ------------------------------------------------- 1325dnl Verify if flistxattr is available, prototyped, and 1326dnl can be compiled. If all of these are true, and 1327dnl usage has not been previously disallowed with 1328dnl shell variable curl_disallow_flistxattr, then 1329dnl HAVE_FLISTXATTR will be defined. 1330 1331AC_DEFUN([CURL_CHECK_FUNC_FLISTXATTR], [ 1332 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 1333 # 1334 tst_links_flistxattr="unknown" 1335 tst_proto_flistxattr="unknown" 1336 tst_compi_flistxattr="unknown" 1337 tst_allow_flistxattr="unknown" 1338 tst_nargs_flistxattr="unknown" 1339 # 1340 AC_MSG_CHECKING([if flistxattr can be linked]) 1341 AC_LINK_IFELSE([ 1342 AC_LANG_FUNC_LINK_TRY([flistxattr]) 1343 ],[ 1344 AC_MSG_RESULT([yes]) 1345 tst_links_flistxattr="yes" 1346 ],[ 1347 AC_MSG_RESULT([no]) 1348 tst_links_flistxattr="no" 1349 ]) 1350 # 1351 if test "$tst_links_flistxattr" = "yes"; then 1352 AC_MSG_CHECKING([if flistxattr is prototyped]) 1353 AC_EGREP_CPP([flistxattr],[ 1354 $curl_includes_sys_xattr 1355 ],[ 1356 AC_MSG_RESULT([yes]) 1357 tst_proto_flistxattr="yes" 1358 ],[ 1359 AC_MSG_RESULT([no]) 1360 tst_proto_flistxattr="no" 1361 ]) 1362 fi 1363 # 1364 if test "$tst_proto_flistxattr" = "yes"; then 1365 if test "$tst_nargs_flistxattr" = "unknown"; then 1366 AC_MSG_CHECKING([if flistxattr takes 3 args.]) 1367 AC_COMPILE_IFELSE([ 1368 AC_LANG_PROGRAM([[ 1369 $curl_includes_sys_xattr 1370 ]],[[ 1371 if(0 != flistxattr(0, 0, 0)) 1372 return 1; 1373 ]]) 1374 ],[ 1375 AC_MSG_RESULT([yes]) 1376 tst_compi_flistxattr="yes" 1377 tst_nargs_flistxattr="3" 1378 ],[ 1379 AC_MSG_RESULT([no]) 1380 tst_compi_flistxattr="no" 1381 ]) 1382 fi 1383 if test "$tst_nargs_flistxattr" = "unknown"; then 1384 AC_MSG_CHECKING([if flistxattr takes 4 args.]) 1385 AC_COMPILE_IFELSE([ 1386 AC_LANG_PROGRAM([[ 1387 $curl_includes_sys_xattr 1388 ]],[[ 1389 if(0 != flistxattr(0, 0, 0, 0)) 1390 return 1; 1391 ]]) 1392 ],[ 1393 AC_MSG_RESULT([yes]) 1394 tst_compi_flistxattr="yes" 1395 tst_nargs_flistxattr="4" 1396 ],[ 1397 AC_MSG_RESULT([no]) 1398 tst_compi_flistxattr="no" 1399 ]) 1400 fi 1401 AC_MSG_CHECKING([if flistxattr is compilable]) 1402 if test "$tst_compi_flistxattr" = "yes"; then 1403 AC_MSG_RESULT([yes]) 1404 else 1405 AC_MSG_RESULT([no]) 1406 fi 1407 fi 1408 # 1409 if test "$tst_compi_flistxattr" = "yes"; then 1410 AC_MSG_CHECKING([if flistxattr usage allowed]) 1411 if test "x$curl_disallow_flistxattr" != "xyes"; then 1412 AC_MSG_RESULT([yes]) 1413 tst_allow_flistxattr="yes" 1414 else 1415 AC_MSG_RESULT([no]) 1416 tst_allow_flistxattr="no" 1417 fi 1418 fi 1419 # 1420 AC_MSG_CHECKING([if flistxattr might be used]) 1421 if test "$tst_links_flistxattr" = "yes" && 1422 test "$tst_proto_flistxattr" = "yes" && 1423 test "$tst_compi_flistxattr" = "yes" && 1424 test "$tst_allow_flistxattr" = "yes"; then 1425 AC_MSG_RESULT([yes]) 1426 AC_DEFINE_UNQUOTED(HAVE_FLISTXATTR, 1, 1427 [Define to 1 if you have the flistxattr function.]) 1428 dnl AC_DEFINE_UNQUOTED(FLISTXATTR_ARGS, $tst_nargs_flistxattr, 1429 dnl [Specifies the number of arguments to flistxattr]) 1430 # 1431 if test "$tst_nargs_flistxattr" -eq "3"; then 1432 AC_DEFINE(HAVE_FLISTXATTR_3, 1, [flistxattr() takes 3 args]) 1433 elif test "$tst_nargs_flistxattr" -eq "4"; then 1434 AC_DEFINE(HAVE_FLISTXATTR_4, 1, [flistxattr() takes 4 args]) 1435 fi 1436 # 1437 curl_cv_func_flistxattr="yes" 1438 else 1439 AC_MSG_RESULT([no]) 1440 curl_cv_func_flistxattr="no" 1441 fi 1442]) 1443 1444 1445dnl CURL_CHECK_FUNC_FREEADDRINFO 1446dnl ------------------------------------------------- 1447dnl Verify if freeaddrinfo is available, prototyped, 1448dnl and can be compiled. If all of these are true, 1449dnl and usage has not been previously disallowed with 1450dnl shell variable curl_disallow_freeaddrinfo, then 1451dnl HAVE_FREEADDRINFO will be defined. 1452 1453AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [ 1454 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl 1455 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 1456 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 1457 # 1458 tst_links_freeaddrinfo="unknown" 1459 tst_proto_freeaddrinfo="unknown" 1460 tst_compi_freeaddrinfo="unknown" 1461 tst_allow_freeaddrinfo="unknown" 1462 # 1463 AC_MSG_CHECKING([if freeaddrinfo can be linked]) 1464 AC_LINK_IFELSE([ 1465 AC_LANG_PROGRAM([[ 1466 $curl_includes_ws2tcpip 1467 $curl_includes_sys_socket 1468 $curl_includes_netdb 1469 ]],[[ 1470 freeaddrinfo(0); 1471 ]]) 1472 ],[ 1473 AC_MSG_RESULT([yes]) 1474 tst_links_freeaddrinfo="yes" 1475 ],[ 1476 AC_MSG_RESULT([no]) 1477 tst_links_freeaddrinfo="no" 1478 ]) 1479 # 1480 if test "$tst_links_freeaddrinfo" = "yes"; then 1481 AC_MSG_CHECKING([if freeaddrinfo is prototyped]) 1482 AC_EGREP_CPP([freeaddrinfo],[ 1483 $curl_includes_ws2tcpip 1484 $curl_includes_sys_socket 1485 $curl_includes_netdb 1486 ],[ 1487 AC_MSG_RESULT([yes]) 1488 tst_proto_freeaddrinfo="yes" 1489 ],[ 1490 AC_MSG_RESULT([no]) 1491 tst_proto_freeaddrinfo="no" 1492 ]) 1493 fi 1494 # 1495 if test "$tst_proto_freeaddrinfo" = "yes"; then 1496 AC_MSG_CHECKING([if freeaddrinfo is compilable]) 1497 AC_COMPILE_IFELSE([ 1498 AC_LANG_PROGRAM([[ 1499 $curl_includes_ws2tcpip 1500 $curl_includes_sys_socket 1501 $curl_includes_netdb 1502 ]],[[ 1503 freeaddrinfo(0); 1504 ]]) 1505 ],[ 1506 AC_MSG_RESULT([yes]) 1507 tst_compi_freeaddrinfo="yes" 1508 ],[ 1509 AC_MSG_RESULT([no]) 1510 tst_compi_freeaddrinfo="no" 1511 ]) 1512 fi 1513 # 1514 if test "$tst_compi_freeaddrinfo" = "yes"; then 1515 AC_MSG_CHECKING([if freeaddrinfo usage allowed]) 1516 if test "x$curl_disallow_freeaddrinfo" != "xyes"; then 1517 AC_MSG_RESULT([yes]) 1518 tst_allow_freeaddrinfo="yes" 1519 else 1520 AC_MSG_RESULT([no]) 1521 tst_allow_freeaddrinfo="no" 1522 fi 1523 fi 1524 # 1525 AC_MSG_CHECKING([if freeaddrinfo might be used]) 1526 if test "$tst_links_freeaddrinfo" = "yes" && 1527 test "$tst_proto_freeaddrinfo" = "yes" && 1528 test "$tst_compi_freeaddrinfo" = "yes" && 1529 test "$tst_allow_freeaddrinfo" = "yes"; then 1530 AC_MSG_RESULT([yes]) 1531 AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1, 1532 [Define to 1 if you have the freeaddrinfo function.]) 1533 curl_cv_func_freeaddrinfo="yes" 1534 else 1535 AC_MSG_RESULT([no]) 1536 curl_cv_func_freeaddrinfo="no" 1537 fi 1538]) 1539 1540 1541dnl CURL_CHECK_FUNC_FREMOVEXATTR 1542dnl ------------------------------------------------- 1543dnl Verify if fremovexattr is available, prototyped, and 1544dnl can be compiled. If all of these are true, and 1545dnl usage has not been previously disallowed with 1546dnl shell variable curl_disallow_fremovexattr, then 1547dnl HAVE_FREMOVEXATTR will be defined. 1548 1549AC_DEFUN([CURL_CHECK_FUNC_FREMOVEXATTR], [ 1550 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 1551 # 1552 tst_links_fremovexattr="unknown" 1553 tst_proto_fremovexattr="unknown" 1554 tst_compi_fremovexattr="unknown" 1555 tst_allow_fremovexattr="unknown" 1556 tst_nargs_fremovexattr="unknown" 1557 # 1558 AC_MSG_CHECKING([if fremovexattr can be linked]) 1559 AC_LINK_IFELSE([ 1560 AC_LANG_FUNC_LINK_TRY([fremovexattr]) 1561 ],[ 1562 AC_MSG_RESULT([yes]) 1563 tst_links_fremovexattr="yes" 1564 ],[ 1565 AC_MSG_RESULT([no]) 1566 tst_links_fremovexattr="no" 1567 ]) 1568 # 1569 if test "$tst_links_fremovexattr" = "yes"; then 1570 AC_MSG_CHECKING([if fremovexattr is prototyped]) 1571 AC_EGREP_CPP([fremovexattr],[ 1572 $curl_includes_sys_xattr 1573 ],[ 1574 AC_MSG_RESULT([yes]) 1575 tst_proto_fremovexattr="yes" 1576 ],[ 1577 AC_MSG_RESULT([no]) 1578 tst_proto_fremovexattr="no" 1579 ]) 1580 fi 1581 # 1582 if test "$tst_proto_fremovexattr" = "yes"; then 1583 if test "$tst_nargs_fremovexattr" = "unknown"; then 1584 AC_MSG_CHECKING([if fremovexattr takes 2 args.]) 1585 AC_COMPILE_IFELSE([ 1586 AC_LANG_PROGRAM([[ 1587 $curl_includes_sys_xattr 1588 ]],[[ 1589 if(0 != fremovexattr(0, 0)) 1590 return 1; 1591 ]]) 1592 ],[ 1593 AC_MSG_RESULT([yes]) 1594 tst_compi_fremovexattr="yes" 1595 tst_nargs_fremovexattr="2" 1596 ],[ 1597 AC_MSG_RESULT([no]) 1598 tst_compi_fremovexattr="no" 1599 ]) 1600 fi 1601 if test "$tst_nargs_fremovexattr" = "unknown"; then 1602 AC_MSG_CHECKING([if fremovexattr takes 3 args.]) 1603 AC_COMPILE_IFELSE([ 1604 AC_LANG_PROGRAM([[ 1605 $curl_includes_sys_xattr 1606 ]],[[ 1607 if(0 != fremovexattr(0, 0, 0)) 1608 return 1; 1609 ]]) 1610 ],[ 1611 AC_MSG_RESULT([yes]) 1612 tst_compi_fremovexattr="yes" 1613 tst_nargs_fremovexattr="3" 1614 ],[ 1615 AC_MSG_RESULT([no]) 1616 tst_compi_fremovexattr="no" 1617 ]) 1618 fi 1619 AC_MSG_CHECKING([if fremovexattr is compilable]) 1620 if test "$tst_compi_fremovexattr" = "yes"; then 1621 AC_MSG_RESULT([yes]) 1622 else 1623 AC_MSG_RESULT([no]) 1624 fi 1625 fi 1626 # 1627 if test "$tst_compi_fremovexattr" = "yes"; then 1628 AC_MSG_CHECKING([if fremovexattr usage allowed]) 1629 if test "x$curl_disallow_fremovexattr" != "xyes"; then 1630 AC_MSG_RESULT([yes]) 1631 tst_allow_fremovexattr="yes" 1632 else 1633 AC_MSG_RESULT([no]) 1634 tst_allow_fremovexattr="no" 1635 fi 1636 fi 1637 # 1638 AC_MSG_CHECKING([if fremovexattr might be used]) 1639 if test "$tst_links_fremovexattr" = "yes" && 1640 test "$tst_proto_fremovexattr" = "yes" && 1641 test "$tst_compi_fremovexattr" = "yes" && 1642 test "$tst_allow_fremovexattr" = "yes"; then 1643 AC_MSG_RESULT([yes]) 1644 AC_DEFINE_UNQUOTED(HAVE_FREMOVEXATTR, 1, 1645 [Define to 1 if you have the fremovexattr function.]) 1646 dnl AC_DEFINE_UNQUOTED(FREMOVEXATTR_ARGS, $tst_nargs_fremovexattr, 1647 dnl [Specifies the number of arguments to fremovexattr]) 1648 # 1649 if test "$tst_nargs_fremovexattr" -eq "2"; then 1650 AC_DEFINE(HAVE_FREMOVEXATTR_2, 1, [fremovexattr() takes 2 args]) 1651 elif test "$tst_nargs_fremovexattr" -eq "3"; then 1652 AC_DEFINE(HAVE_FREMOVEXATTR_3, 1, [fremovexattr() takes 3 args]) 1653 fi 1654 # 1655 curl_cv_func_fremovexattr="yes" 1656 else 1657 AC_MSG_RESULT([no]) 1658 curl_cv_func_fremovexattr="no" 1659 fi 1660]) 1661 1662 1663dnl CURL_CHECK_FUNC_FSETXATTR 1664dnl ------------------------------------------------- 1665dnl Verify if fsetxattr is available, prototyped, and 1666dnl can be compiled. If all of these are true, and 1667dnl usage has not been previously disallowed with 1668dnl shell variable curl_disallow_fsetxattr, then 1669dnl HAVE_FSETXATTR will be defined. 1670 1671AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [ 1672 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 1673 # 1674 tst_links_fsetxattr="unknown" 1675 tst_proto_fsetxattr="unknown" 1676 tst_compi_fsetxattr="unknown" 1677 tst_allow_fsetxattr="unknown" 1678 tst_nargs_fsetxattr="unknown" 1679 # 1680 AC_MSG_CHECKING([if fsetxattr can be linked]) 1681 AC_LINK_IFELSE([ 1682 AC_LANG_FUNC_LINK_TRY([fsetxattr]) 1683 ],[ 1684 AC_MSG_RESULT([yes]) 1685 tst_links_fsetxattr="yes" 1686 ],[ 1687 AC_MSG_RESULT([no]) 1688 tst_links_fsetxattr="no" 1689 ]) 1690 # 1691 if test "$tst_links_fsetxattr" = "yes"; then 1692 AC_MSG_CHECKING([if fsetxattr is prototyped]) 1693 AC_EGREP_CPP([fsetxattr],[ 1694 $curl_includes_sys_xattr 1695 ],[ 1696 AC_MSG_RESULT([yes]) 1697 tst_proto_fsetxattr="yes" 1698 ],[ 1699 AC_MSG_RESULT([no]) 1700 tst_proto_fsetxattr="no" 1701 ]) 1702 fi 1703 # 1704 if test "$tst_proto_fsetxattr" = "yes"; then 1705 if test "$tst_nargs_fsetxattr" = "unknown"; then 1706 AC_MSG_CHECKING([if fsetxattr takes 5 args.]) 1707 AC_COMPILE_IFELSE([ 1708 AC_LANG_PROGRAM([[ 1709 $curl_includes_sys_xattr 1710 ]],[[ 1711 if(0 != fsetxattr(0, 0, 0, 0, 0)) 1712 return 1; 1713 ]]) 1714 ],[ 1715 AC_MSG_RESULT([yes]) 1716 tst_compi_fsetxattr="yes" 1717 tst_nargs_fsetxattr="5" 1718 ],[ 1719 AC_MSG_RESULT([no]) 1720 tst_compi_fsetxattr="no" 1721 ]) 1722 fi 1723 if test "$tst_nargs_fsetxattr" = "unknown"; then 1724 AC_MSG_CHECKING([if fsetxattr takes 6 args.]) 1725 AC_COMPILE_IFELSE([ 1726 AC_LANG_PROGRAM([[ 1727 $curl_includes_sys_xattr 1728 ]],[[ 1729 if(0 != fsetxattr(0, 0, 0, 0, 0, 0)) 1730 return 1; 1731 ]]) 1732 ],[ 1733 AC_MSG_RESULT([yes]) 1734 tst_compi_fsetxattr="yes" 1735 tst_nargs_fsetxattr="6" 1736 ],[ 1737 AC_MSG_RESULT([no]) 1738 tst_compi_fsetxattr="no" 1739 ]) 1740 fi 1741 AC_MSG_CHECKING([if fsetxattr is compilable]) 1742 if test "$tst_compi_fsetxattr" = "yes"; then 1743 AC_MSG_RESULT([yes]) 1744 else 1745 AC_MSG_RESULT([no]) 1746 fi 1747 fi 1748 # 1749 if test "$tst_compi_fsetxattr" = "yes"; then 1750 AC_MSG_CHECKING([if fsetxattr usage allowed]) 1751 if test "x$curl_disallow_fsetxattr" != "xyes"; then 1752 AC_MSG_RESULT([yes]) 1753 tst_allow_fsetxattr="yes" 1754 else 1755 AC_MSG_RESULT([no]) 1756 tst_allow_fsetxattr="no" 1757 fi 1758 fi 1759 # 1760 AC_MSG_CHECKING([if fsetxattr might be used]) 1761 if test "$tst_links_fsetxattr" = "yes" && 1762 test "$tst_proto_fsetxattr" = "yes" && 1763 test "$tst_compi_fsetxattr" = "yes" && 1764 test "$tst_allow_fsetxattr" = "yes"; then 1765 AC_MSG_RESULT([yes]) 1766 AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1, 1767 [Define to 1 if you have the fsetxattr function.]) 1768 dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr, 1769 dnl [Specifies the number of arguments to fsetxattr]) 1770 # 1771 if test "$tst_nargs_fsetxattr" -eq "5"; then 1772 AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args]) 1773 elif test "$tst_nargs_fsetxattr" -eq "6"; then 1774 AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args]) 1775 fi 1776 # 1777 curl_cv_func_fsetxattr="yes" 1778 else 1779 AC_MSG_RESULT([no]) 1780 curl_cv_func_fsetxattr="no" 1781 fi 1782]) 1783 1784 1785dnl CURL_CHECK_FUNC_FTRUNCATE 1786dnl ------------------------------------------------- 1787dnl Verify if ftruncate is available, prototyped, and 1788dnl can be compiled. If all of these are true, and 1789dnl usage has not been previously disallowed with 1790dnl shell variable curl_disallow_ftruncate, then 1791dnl HAVE_FTRUNCATE will be defined. 1792 1793AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [ 1794 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 1795 # 1796 tst_links_ftruncate="unknown" 1797 tst_proto_ftruncate="unknown" 1798 tst_compi_ftruncate="unknown" 1799 tst_allow_ftruncate="unknown" 1800 # 1801 AC_MSG_CHECKING([if ftruncate can be linked]) 1802 AC_LINK_IFELSE([ 1803 AC_LANG_FUNC_LINK_TRY([ftruncate]) 1804 ],[ 1805 AC_MSG_RESULT([yes]) 1806 tst_links_ftruncate="yes" 1807 ],[ 1808 AC_MSG_RESULT([no]) 1809 tst_links_ftruncate="no" 1810 ]) 1811 # 1812 if test "$tst_links_ftruncate" = "yes"; then 1813 AC_MSG_CHECKING([if ftruncate is prototyped]) 1814 AC_EGREP_CPP([ftruncate],[ 1815 $curl_includes_unistd 1816 ],[ 1817 AC_MSG_RESULT([yes]) 1818 tst_proto_ftruncate="yes" 1819 ],[ 1820 AC_MSG_RESULT([no]) 1821 tst_proto_ftruncate="no" 1822 ]) 1823 fi 1824 # 1825 if test "$tst_proto_ftruncate" = "yes"; then 1826 AC_MSG_CHECKING([if ftruncate is compilable]) 1827 AC_COMPILE_IFELSE([ 1828 AC_LANG_PROGRAM([[ 1829 $curl_includes_unistd 1830 ]],[[ 1831 if(0 != ftruncate(0, 0)) 1832 return 1; 1833 ]]) 1834 ],[ 1835 AC_MSG_RESULT([yes]) 1836 tst_compi_ftruncate="yes" 1837 ],[ 1838 AC_MSG_RESULT([no]) 1839 tst_compi_ftruncate="no" 1840 ]) 1841 fi 1842 # 1843 if test "$tst_compi_ftruncate" = "yes"; then 1844 AC_MSG_CHECKING([if ftruncate usage allowed]) 1845 if test "x$curl_disallow_ftruncate" != "xyes"; then 1846 AC_MSG_RESULT([yes]) 1847 tst_allow_ftruncate="yes" 1848 else 1849 AC_MSG_RESULT([no]) 1850 tst_allow_ftruncate="no" 1851 fi 1852 fi 1853 # 1854 AC_MSG_CHECKING([if ftruncate might be used]) 1855 if test "$tst_links_ftruncate" = "yes" && 1856 test "$tst_proto_ftruncate" = "yes" && 1857 test "$tst_compi_ftruncate" = "yes" && 1858 test "$tst_allow_ftruncate" = "yes"; then 1859 AC_MSG_RESULT([yes]) 1860 AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1, 1861 [Define to 1 if you have the ftruncate function.]) 1862 curl_cv_func_ftruncate="yes" 1863 else 1864 AC_MSG_RESULT([no]) 1865 curl_cv_func_ftruncate="no" 1866 fi 1867]) 1868 1869 1870dnl CURL_CHECK_FUNC_GETADDRINFO 1871dnl ------------------------------------------------- 1872dnl Verify if getaddrinfo is available, prototyped, can 1873dnl be compiled and seems to work. If all of these are 1874dnl true, and usage has not been previously disallowed 1875dnl with shell variable curl_disallow_getaddrinfo, then 1876dnl HAVE_GETADDRINFO will be defined. Additionally when 1877dnl HAVE_GETADDRINFO gets defined this will also attempt 1878dnl to find out if getaddrinfo happens to be threadsafe, 1879dnl defining HAVE_GETADDRINFO_THREADSAFE when true. 1880 1881AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [ 1882 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl 1883 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 1884 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 1885 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 1886 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 1887 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl 1888 # 1889 tst_links_getaddrinfo="unknown" 1890 tst_proto_getaddrinfo="unknown" 1891 tst_compi_getaddrinfo="unknown" 1892 tst_works_getaddrinfo="unknown" 1893 tst_allow_getaddrinfo="unknown" 1894 tst_tsafe_getaddrinfo="unknown" 1895 # 1896 AC_MSG_CHECKING([if getaddrinfo can be linked]) 1897 AC_LINK_IFELSE([ 1898 AC_LANG_PROGRAM([[ 1899 $curl_includes_ws2tcpip 1900 $curl_includes_sys_socket 1901 $curl_includes_netdb 1902 ]],[[ 1903 if(0 != getaddrinfo(0, 0, 0, 0)) 1904 return 1; 1905 ]]) 1906 ],[ 1907 AC_MSG_RESULT([yes]) 1908 tst_links_getaddrinfo="yes" 1909 ],[ 1910 AC_MSG_RESULT([no]) 1911 tst_links_getaddrinfo="no" 1912 ]) 1913 # 1914 if test "$tst_links_getaddrinfo" = "yes"; then 1915 AC_MSG_CHECKING([if getaddrinfo is prototyped]) 1916 AC_EGREP_CPP([getaddrinfo],[ 1917 $curl_includes_ws2tcpip 1918 $curl_includes_sys_socket 1919 $curl_includes_netdb 1920 ],[ 1921 AC_MSG_RESULT([yes]) 1922 tst_proto_getaddrinfo="yes" 1923 ],[ 1924 AC_MSG_RESULT([no]) 1925 tst_proto_getaddrinfo="no" 1926 ]) 1927 fi 1928 # 1929 if test "$tst_proto_getaddrinfo" = "yes"; then 1930 AC_MSG_CHECKING([if getaddrinfo is compilable]) 1931 AC_COMPILE_IFELSE([ 1932 AC_LANG_PROGRAM([[ 1933 $curl_includes_ws2tcpip 1934 $curl_includes_sys_socket 1935 $curl_includes_netdb 1936 ]],[[ 1937 if(0 != getaddrinfo(0, 0, 0, 0)) 1938 return 1; 1939 ]]) 1940 ],[ 1941 AC_MSG_RESULT([yes]) 1942 tst_compi_getaddrinfo="yes" 1943 ],[ 1944 AC_MSG_RESULT([no]) 1945 tst_compi_getaddrinfo="no" 1946 ]) 1947 fi 1948 # 1949 dnl only do runtime verification when not cross-compiling 1950 if test "x$cross_compiling" != "xyes" && 1951 test "$tst_compi_getaddrinfo" = "yes"; then 1952 AC_MSG_CHECKING([if getaddrinfo seems to work]) 1953 CURL_RUN_IFELSE([ 1954 AC_LANG_PROGRAM([[ 1955 $curl_includes_ws2tcpip 1956 $curl_includes_stdlib 1957 $curl_includes_string 1958 $curl_includes_sys_socket 1959 $curl_includes_netdb 1960 ]],[[ 1961 struct addrinfo hints; 1962 struct addrinfo *ai = 0; 1963 int error; 1964 1965 #ifdef HAVE_WINSOCK2_H 1966 WSADATA wsa; 1967 if (WSAStartup(MAKEWORD(2,2), &wsa)) 1968 exit(2); 1969 #endif 1970 1971 memset(&hints, 0, sizeof(hints)); 1972 hints.ai_flags = AI_NUMERICHOST; 1973 hints.ai_family = AF_UNSPEC; 1974 hints.ai_socktype = SOCK_STREAM; 1975 error = getaddrinfo("127.0.0.1", 0, &hints, &ai); 1976 if(error || !ai) 1977 exit(1); /* fail */ 1978 else 1979 exit(0); 1980 ]]) 1981 ],[ 1982 AC_MSG_RESULT([yes]) 1983 tst_works_getaddrinfo="yes" 1984 ],[ 1985 AC_MSG_RESULT([no]) 1986 tst_works_getaddrinfo="no" 1987 ]) 1988 fi 1989 # 1990 if test "$tst_compi_getaddrinfo" = "yes" && 1991 test "$tst_works_getaddrinfo" != "no"; then 1992 AC_MSG_CHECKING([if getaddrinfo usage allowed]) 1993 if test "x$curl_disallow_getaddrinfo" != "xyes"; then 1994 AC_MSG_RESULT([yes]) 1995 tst_allow_getaddrinfo="yes" 1996 else 1997 AC_MSG_RESULT([no]) 1998 tst_allow_getaddrinfo="no" 1999 fi 2000 fi 2001 # 2002 AC_MSG_CHECKING([if getaddrinfo might be used]) 2003 if test "$tst_links_getaddrinfo" = "yes" && 2004 test "$tst_proto_getaddrinfo" = "yes" && 2005 test "$tst_compi_getaddrinfo" = "yes" && 2006 test "$tst_allow_getaddrinfo" = "yes" && 2007 test "$tst_works_getaddrinfo" != "no"; then 2008 AC_MSG_RESULT([yes]) 2009 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1, 2010 [Define to 1 if you have a working getaddrinfo function.]) 2011 curl_cv_func_getaddrinfo="yes" 2012 else 2013 AC_MSG_RESULT([no]) 2014 curl_cv_func_getaddrinfo="no" 2015 curl_cv_func_getaddrinfo_threadsafe="no" 2016 fi 2017 # 2018 if test "$curl_cv_func_getaddrinfo" = "yes"; then 2019 AC_MSG_CHECKING([if getaddrinfo is threadsafe]) 2020 case $host_os in 2021 aix[[1234]].* | aix5.[[01]].*) 2022 dnl aix 5.1 and older 2023 tst_tsafe_getaddrinfo="no" 2024 ;; 2025 aix*) 2026 dnl aix 5.2 and newer 2027 tst_tsafe_getaddrinfo="yes" 2028 ;; 2029 darwin[[12345]].*) 2030 dnl darwin 5.0 and mac os x 10.1.X and older 2031 tst_tsafe_getaddrinfo="no" 2032 ;; 2033 darwin*) 2034 dnl darwin 6.0 and mac os x 10.2.X and newer 2035 tst_tsafe_getaddrinfo="yes" 2036 ;; 2037 freebsd[[1234]].* | freebsd5.[[1234]]*) 2038 dnl freebsd 5.4 and older 2039 tst_tsafe_getaddrinfo="no" 2040 ;; 2041 freebsd*) 2042 dnl freebsd 5.5 and newer 2043 tst_tsafe_getaddrinfo="yes" 2044 ;; 2045 hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*) 2046 dnl hpux 11.10 and older 2047 tst_tsafe_getaddrinfo="no" 2048 ;; 2049 hpux*) 2050 dnl hpux 11.11 and newer 2051 tst_tsafe_getaddrinfo="yes" 2052 ;; 2053 midnightbsd*) 2054 dnl all MidnightBSD versions 2055 tst_tsafe_getaddrinfo="yes" 2056 ;; 2057 netbsd[[123]].*) 2058 dnl netbsd 3.X and older 2059 tst_tsafe_getaddrinfo="no" 2060 ;; 2061 netbsd*) 2062 dnl netbsd 4.X and newer 2063 tst_tsafe_getaddrinfo="yes" 2064 ;; 2065 *bsd*) 2066 dnl All other bsd's 2067 tst_tsafe_getaddrinfo="no" 2068 ;; 2069 solaris2*) 2070 dnl solaris which have it 2071 tst_tsafe_getaddrinfo="yes" 2072 ;; 2073 esac 2074 if test "$tst_tsafe_getaddrinfo" = "unknown" && 2075 test "$curl_cv_native_windows" = "yes"; then 2076 tst_tsafe_getaddrinfo="yes" 2077 fi 2078 if test "$tst_tsafe_getaddrinfo" = "unknown"; then 2079 CURL_CHECK_DEF_CC([h_errno], [ 2080 $curl_includes_sys_socket 2081 $curl_includes_netdb 2082 ], [silent]) 2083 if test "$curl_cv_have_def_h_errno" = "yes"; then 2084 tst_h_errno_macro="yes" 2085 else 2086 tst_h_errno_macro="no" 2087 fi 2088 AC_COMPILE_IFELSE([ 2089 AC_LANG_PROGRAM([[ 2090 $curl_includes_sys_socket 2091 $curl_includes_netdb 2092 ]],[[ 2093 h_errno = 2; 2094 if(0 != h_errno) 2095 return 1; 2096 ]]) 2097 ],[ 2098 tst_h_errno_modifiable_lvalue="yes" 2099 ],[ 2100 tst_h_errno_modifiable_lvalue="no" 2101 ]) 2102 AC_COMPILE_IFELSE([ 2103 AC_LANG_PROGRAM([[ 2104 ]],[[ 2105#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) 2106 return 0; 2107#elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700) 2108 return 0; 2109#else 2110 force compilation error 2111#endif 2112 ]]) 2113 ],[ 2114 tst_h_errno_sbs_issue_7="yes" 2115 ],[ 2116 tst_h_errno_sbs_issue_7="no" 2117 ]) 2118 if test "$tst_h_errno_macro" = "no" && 2119 test "$tst_h_errno_modifiable_lvalue" = "no" && 2120 test "$tst_h_errno_sbs_issue_7" = "no"; then 2121 tst_tsafe_getaddrinfo="no" 2122 else 2123 tst_tsafe_getaddrinfo="yes" 2124 fi 2125 fi 2126 AC_MSG_RESULT([$tst_tsafe_getaddrinfo]) 2127 if test "$tst_tsafe_getaddrinfo" = "yes"; then 2128 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1, 2129 [Define to 1 if the getaddrinfo function is threadsafe.]) 2130 curl_cv_func_getaddrinfo_threadsafe="yes" 2131 else 2132 curl_cv_func_getaddrinfo_threadsafe="no" 2133 fi 2134 fi 2135]) 2136 2137 2138dnl CURL_CHECK_FUNC_GETHOSTBYNAME 2139dnl ------------------------------------------------- 2140dnl Verify if gethostbyname is available, prototyped, 2141dnl and can be compiled. If all of these are true, 2142dnl and usage has not been previously disallowed with 2143dnl shell variable curl_disallow_gethostbyname, then 2144dnl HAVE_GETHOSTBYNAME will be defined. 2145 2146AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME], [ 2147 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 2148 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 2149 # 2150 tst_links_gethostbyname="unknown" 2151 tst_proto_gethostbyname="unknown" 2152 tst_compi_gethostbyname="unknown" 2153 tst_allow_gethostbyname="unknown" 2154 # 2155 AC_MSG_CHECKING([if gethostbyname can be linked]) 2156 AC_LINK_IFELSE([ 2157 AC_LANG_PROGRAM([[ 2158 $curl_includes_winsock2 2159 $curl_includes_bsdsocket 2160 $curl_includes_netdb 2161 ]],[[ 2162 if(0 != gethostbyname(0)) 2163 return 1; 2164 ]]) 2165 ],[ 2166 AC_MSG_RESULT([yes]) 2167 tst_links_gethostbyname="yes" 2168 ],[ 2169 AC_MSG_RESULT([no]) 2170 tst_links_gethostbyname="no" 2171 ]) 2172 # 2173 if test "$tst_links_gethostbyname" = "yes"; then 2174 AC_MSG_CHECKING([if gethostbyname is prototyped]) 2175 AC_EGREP_CPP([gethostbyname],[ 2176 $curl_includes_winsock2 2177 $curl_includes_bsdsocket 2178 $curl_includes_netdb 2179 ],[ 2180 AC_MSG_RESULT([yes]) 2181 tst_proto_gethostbyname="yes" 2182 ],[ 2183 AC_MSG_RESULT([no]) 2184 tst_proto_gethostbyname="no" 2185 ]) 2186 fi 2187 # 2188 if test "$tst_proto_gethostbyname" = "yes"; then 2189 AC_MSG_CHECKING([if gethostbyname is compilable]) 2190 AC_COMPILE_IFELSE([ 2191 AC_LANG_PROGRAM([[ 2192 $curl_includes_winsock2 2193 $curl_includes_bsdsocket 2194 $curl_includes_netdb 2195 ]],[[ 2196 if(0 != gethostbyname(0)) 2197 return 1; 2198 ]]) 2199 ],[ 2200 AC_MSG_RESULT([yes]) 2201 tst_compi_gethostbyname="yes" 2202 ],[ 2203 AC_MSG_RESULT([no]) 2204 tst_compi_gethostbyname="no" 2205 ]) 2206 fi 2207 # 2208 if test "$tst_compi_gethostbyname" = "yes"; then 2209 AC_MSG_CHECKING([if gethostbyname usage allowed]) 2210 if test "x$curl_disallow_gethostbyname" != "xyes"; then 2211 AC_MSG_RESULT([yes]) 2212 tst_allow_gethostbyname="yes" 2213 else 2214 AC_MSG_RESULT([no]) 2215 tst_allow_gethostbyname="no" 2216 fi 2217 fi 2218 # 2219 AC_MSG_CHECKING([if gethostbyname might be used]) 2220 if test "$tst_links_gethostbyname" = "yes" && 2221 test "$tst_proto_gethostbyname" = "yes" && 2222 test "$tst_compi_gethostbyname" = "yes" && 2223 test "$tst_allow_gethostbyname" = "yes"; then 2224 AC_MSG_RESULT([yes]) 2225 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1, 2226 [Define to 1 if you have the gethostbyname function.]) 2227 curl_cv_func_gethostbyname="yes" 2228 else 2229 AC_MSG_RESULT([no]) 2230 curl_cv_func_gethostbyname="no" 2231 fi 2232]) 2233 2234 2235dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R 2236dnl ------------------------------------------------- 2237dnl Verify if gethostbyname_r is available, prototyped, 2238dnl and can be compiled. If all of these are true, and 2239dnl usage has not been previously disallowed with 2240dnl shell variable curl_disallow_gethostbyname_r, then 2241dnl HAVE_GETHOSTBYNAME_R will be defined. 2242 2243AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [ 2244 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 2245 # 2246 tst_links_gethostbyname_r="unknown" 2247 tst_proto_gethostbyname_r="unknown" 2248 tst_compi_gethostbyname_r="unknown" 2249 tst_allow_gethostbyname_r="unknown" 2250 tst_nargs_gethostbyname_r="unknown" 2251 # 2252 AC_MSG_CHECKING([if gethostbyname_r can be linked]) 2253 AC_LINK_IFELSE([ 2254 AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) 2255 ],[ 2256 AC_MSG_RESULT([yes]) 2257 tst_links_gethostbyname_r="yes" 2258 ],[ 2259 AC_MSG_RESULT([no]) 2260 tst_links_gethostbyname_r="no" 2261 ]) 2262 # 2263 if test "$tst_links_gethostbyname_r" = "yes"; then 2264 AC_MSG_CHECKING([if gethostbyname_r is prototyped]) 2265 AC_EGREP_CPP([gethostbyname_r],[ 2266 $curl_includes_netdb 2267 ],[ 2268 AC_MSG_RESULT([yes]) 2269 tst_proto_gethostbyname_r="yes" 2270 ],[ 2271 AC_MSG_RESULT([no]) 2272 tst_proto_gethostbyname_r="no" 2273 ]) 2274 fi 2275 # 2276 if test "$tst_proto_gethostbyname_r" = "yes"; then 2277 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 2278 AC_MSG_CHECKING([if gethostbyname_r takes 3 args.]) 2279 AC_COMPILE_IFELSE([ 2280 AC_LANG_PROGRAM([[ 2281 $curl_includes_netdb 2282 ]],[[ 2283 if(0 != gethostbyname_r(0, 0, 0)) 2284 return 1; 2285 ]]) 2286 ],[ 2287 AC_MSG_RESULT([yes]) 2288 tst_compi_gethostbyname_r="yes" 2289 tst_nargs_gethostbyname_r="3" 2290 ],[ 2291 AC_MSG_RESULT([no]) 2292 tst_compi_gethostbyname_r="no" 2293 ]) 2294 fi 2295 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 2296 AC_MSG_CHECKING([if gethostbyname_r takes 5 args.]) 2297 AC_COMPILE_IFELSE([ 2298 AC_LANG_PROGRAM([[ 2299 $curl_includes_netdb 2300 ]],[[ 2301 if(0 != gethostbyname_r(0, 0, 0, 0, 0)) 2302 return 1; 2303 ]]) 2304 ],[ 2305 AC_MSG_RESULT([yes]) 2306 tst_compi_gethostbyname_r="yes" 2307 tst_nargs_gethostbyname_r="5" 2308 ],[ 2309 AC_MSG_RESULT([no]) 2310 tst_compi_gethostbyname_r="no" 2311 ]) 2312 fi 2313 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 2314 AC_MSG_CHECKING([if gethostbyname_r takes 6 args.]) 2315 AC_COMPILE_IFELSE([ 2316 AC_LANG_PROGRAM([[ 2317 $curl_includes_netdb 2318 ]],[[ 2319 if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0)) 2320 return 1; 2321 ]]) 2322 ],[ 2323 AC_MSG_RESULT([yes]) 2324 tst_compi_gethostbyname_r="yes" 2325 tst_nargs_gethostbyname_r="6" 2326 ],[ 2327 AC_MSG_RESULT([no]) 2328 tst_compi_gethostbyname_r="no" 2329 ]) 2330 fi 2331 AC_MSG_CHECKING([if gethostbyname_r is compilable]) 2332 if test "$tst_compi_gethostbyname_r" = "yes"; then 2333 AC_MSG_RESULT([yes]) 2334 else 2335 AC_MSG_RESULT([no]) 2336 fi 2337 fi 2338 # 2339 if test "$tst_compi_gethostbyname_r" = "yes"; then 2340 AC_MSG_CHECKING([if gethostbyname_r usage allowed]) 2341 if test "x$curl_disallow_gethostbyname_r" != "xyes"; then 2342 AC_MSG_RESULT([yes]) 2343 tst_allow_gethostbyname_r="yes" 2344 else 2345 AC_MSG_RESULT([no]) 2346 tst_allow_gethostbyname_r="no" 2347 fi 2348 fi 2349 # 2350 AC_MSG_CHECKING([if gethostbyname_r might be used]) 2351 if test "$tst_links_gethostbyname_r" = "yes" && 2352 test "$tst_proto_gethostbyname_r" = "yes" && 2353 test "$tst_compi_gethostbyname_r" = "yes" && 2354 test "$tst_allow_gethostbyname_r" = "yes"; then 2355 AC_MSG_RESULT([yes]) 2356 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1, 2357 [Define to 1 if you have the gethostbyname_r function.]) 2358 dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r, 2359 dnl [Specifies the number of arguments to gethostbyname_r]) 2360 # 2361 if test "$tst_nargs_gethostbyname_r" -eq "3"; then 2362 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args]) 2363 elif test "$tst_nargs_gethostbyname_r" -eq "5"; then 2364 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args]) 2365 elif test "$tst_nargs_gethostbyname_r" -eq "6"; then 2366 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args]) 2367 fi 2368 # 2369 curl_cv_func_gethostbyname_r="yes" 2370 else 2371 AC_MSG_RESULT([no]) 2372 curl_cv_func_gethostbyname_r="no" 2373 fi 2374]) 2375 2376 2377dnl CURL_CHECK_FUNC_GETHOSTNAME 2378dnl ------------------------------------------------- 2379dnl Verify if gethostname is available, prototyped, and 2380dnl can be compiled. If all of these are true, and 2381dnl usage has not been previously disallowed with 2382dnl shell variable curl_disallow_gethostname, then 2383dnl HAVE_GETHOSTNAME will be defined. 2384 2385AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [ 2386 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 2387 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 2388 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 2389 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 2390 # 2391 tst_links_gethostname="unknown" 2392 tst_proto_gethostname="unknown" 2393 tst_compi_gethostname="unknown" 2394 tst_allow_gethostname="unknown" 2395 # 2396 AC_MSG_CHECKING([if gethostname can be linked]) 2397 AC_LINK_IFELSE([ 2398 AC_LANG_PROGRAM([[ 2399 $curl_includes_winsock2 2400 $curl_includes_bsdsocket 2401 $curl_includes_unistd 2402 ]],[[ 2403 if(0 != gethostname(0, 0)) 2404 return 1; 2405 ]]) 2406 ],[ 2407 AC_MSG_RESULT([yes]) 2408 tst_links_gethostname="yes" 2409 ],[ 2410 AC_MSG_RESULT([no]) 2411 tst_links_gethostname="no" 2412 ]) 2413 # 2414 if test "$tst_links_gethostname" = "yes"; then 2415 AC_MSG_CHECKING([if gethostname is prototyped]) 2416 AC_EGREP_CPP([gethostname],[ 2417 $curl_includes_winsock2 2418 $curl_includes_bsdsocket 2419 $curl_includes_unistd 2420 ],[ 2421 AC_MSG_RESULT([yes]) 2422 tst_proto_gethostname="yes" 2423 ],[ 2424 AC_MSG_RESULT([no]) 2425 tst_proto_gethostname="no" 2426 ]) 2427 fi 2428 # 2429 if test "$tst_proto_gethostname" = "yes"; then 2430 AC_MSG_CHECKING([if gethostname is compilable]) 2431 AC_COMPILE_IFELSE([ 2432 AC_LANG_PROGRAM([[ 2433 $curl_includes_winsock2 2434 $curl_includes_bsdsocket 2435 $curl_includes_unistd 2436 ]],[[ 2437 if(0 != gethostname(0, 0)) 2438 return 1; 2439 ]]) 2440 ],[ 2441 AC_MSG_RESULT([yes]) 2442 tst_compi_gethostname="yes" 2443 ],[ 2444 AC_MSG_RESULT([no]) 2445 tst_compi_gethostname="no" 2446 ]) 2447 fi 2448 # 2449 if test "$tst_compi_gethostname" = "yes"; then 2450 AC_MSG_CHECKING([for gethostname arg 2 data type]) 2451 tst_gethostname_type_arg2="unknown" 2452 for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do 2453 for tst_arg2 in 'int' 'unsigned int' 'size_t'; do 2454 if test "$tst_gethostname_type_arg2" = "unknown"; then 2455 AC_COMPILE_IFELSE([ 2456 AC_LANG_PROGRAM([[ 2457 $curl_includes_winsock2 2458 $curl_includes_bsdsocket 2459 $curl_includes_unistd 2460 $curl_preprocess_callconv 2461 extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2); 2462 ]],[[ 2463 if(0 != gethostname(0, 0)) 2464 return 1; 2465 ]]) 2466 ],[ 2467 tst_gethostname_type_arg2="$tst_arg2" 2468 ]) 2469 fi 2470 done 2471 done 2472 AC_MSG_RESULT([$tst_gethostname_type_arg2]) 2473 if test "$tst_gethostname_type_arg2" != "unknown"; then 2474 AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2, 2475 [Define to the type of arg 2 for gethostname.]) 2476 fi 2477 fi 2478 # 2479 if test "$tst_compi_gethostname" = "yes"; then 2480 AC_MSG_CHECKING([if gethostname usage allowed]) 2481 if test "x$curl_disallow_gethostname" != "xyes"; then 2482 AC_MSG_RESULT([yes]) 2483 tst_allow_gethostname="yes" 2484 else 2485 AC_MSG_RESULT([no]) 2486 tst_allow_gethostname="no" 2487 fi 2488 fi 2489 # 2490 AC_MSG_CHECKING([if gethostname might be used]) 2491 if test "$tst_links_gethostname" = "yes" && 2492 test "$tst_proto_gethostname" = "yes" && 2493 test "$tst_compi_gethostname" = "yes" && 2494 test "$tst_allow_gethostname" = "yes"; then 2495 AC_MSG_RESULT([yes]) 2496 AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1, 2497 [Define to 1 if you have the gethostname function.]) 2498 curl_cv_func_gethostname="yes" 2499 else 2500 AC_MSG_RESULT([no]) 2501 curl_cv_func_gethostname="no" 2502 fi 2503]) 2504 2505dnl CURL_CHECK_FUNC_GETPEERNAME 2506dnl ------------------------------------------------- 2507dnl Verify if getpeername is available, prototyped, and 2508dnl can be compiled. If all of these are true, and 2509dnl usage has not been previously disallowed with 2510dnl shell variable curl_disallow_getpeername, then 2511dnl HAVE_GETPEERNAME will be defined. 2512 2513AC_DEFUN([CURL_CHECK_FUNC_GETPEERNAME], [ 2514 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 2515 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 2516 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 2517 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 2518 # 2519 tst_links_getpeername="unknown" 2520 tst_proto_getpeername="unknown" 2521 tst_compi_getpeername="unknown" 2522 tst_allow_getpeername="unknown" 2523 # 2524 AC_MSG_CHECKING([if getpeername can be linked]) 2525 AC_LINK_IFELSE([ 2526 AC_LANG_PROGRAM([[ 2527 $curl_includes_winsock2 2528 $curl_includes_bsdsocket 2529 $curl_includes_sys_socket 2530 ]],[[ 2531 if(0 != getpeername(0, (void *)0, (void *)0)) 2532 return 1; 2533 ]]) 2534 ],[ 2535 AC_MSG_RESULT([yes]) 2536 tst_links_getpeername="yes" 2537 ],[ 2538 AC_MSG_RESULT([no]) 2539 tst_links_getpeername="no" 2540 ]) 2541 # 2542 if test "$tst_links_getpeername" = "yes"; then 2543 AC_MSG_CHECKING([if getpeername is prototyped]) 2544 AC_EGREP_CPP([getpeername],[ 2545 $curl_includes_winsock2 2546 $curl_includes_bsdsocket 2547 $curl_includes_sys_socket 2548 ],[ 2549 AC_MSG_RESULT([yes]) 2550 tst_proto_getpeername="yes" 2551 ],[ 2552 AC_MSG_RESULT([no]) 2553 tst_proto_getpeername="no" 2554 ]) 2555 fi 2556 # 2557 if test "$tst_proto_getpeername" = "yes"; then 2558 AC_MSG_CHECKING([if getpeername is compilable]) 2559 AC_COMPILE_IFELSE([ 2560 AC_LANG_PROGRAM([[ 2561 $curl_includes_winsock2 2562 $curl_includes_bsdsocket 2563 $curl_includes_sys_socket 2564 ]],[[ 2565 if(0 != getpeername(0, (void *)0, (void *)0)) 2566 return 1; 2567 ]]) 2568 ],[ 2569 AC_MSG_RESULT([yes]) 2570 tst_compi_getpeername="yes" 2571 ],[ 2572 AC_MSG_RESULT([no]) 2573 tst_compi_getpeername="no" 2574 ]) 2575 fi 2576 # 2577 if test "$tst_compi_getpeername" = "yes"; then 2578 AC_MSG_CHECKING([if getpeername usage allowed]) 2579 if test "x$curl_disallow_getpeername" != "xyes"; then 2580 AC_MSG_RESULT([yes]) 2581 tst_allow_getpeername="yes" 2582 else 2583 AC_MSG_RESULT([no]) 2584 tst_allow_getpeername="no" 2585 fi 2586 fi 2587 # 2588 AC_MSG_CHECKING([if getpeername might be used]) 2589 if test "$tst_links_getpeername" = "yes" && 2590 test "$tst_proto_getpeername" = "yes" && 2591 test "$tst_compi_getpeername" = "yes" && 2592 test "$tst_allow_getpeername" = "yes"; then 2593 AC_MSG_RESULT([yes]) 2594 AC_DEFINE_UNQUOTED(HAVE_GETPEERNAME, 1, 2595 [Define to 1 if you have the getpeername function.]) 2596 curl_cv_func_getpeername="yes" 2597 else 2598 AC_MSG_RESULT([no]) 2599 curl_cv_func_getpeername="no" 2600 fi 2601]) 2602 2603dnl CURL_CHECK_FUNC_GETSOCKNAME 2604dnl ------------------------------------------------- 2605dnl Verify if getsockname is available, prototyped, and 2606dnl can be compiled. If all of these are true, and 2607dnl usage has not been previously disallowed with 2608dnl shell variable curl_disallow_getsockname, then 2609dnl HAVE_GETSOCKNAME will be defined. 2610 2611AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [ 2612 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 2613 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 2614 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 2615 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 2616 # 2617 tst_links_getsockname="unknown" 2618 tst_proto_getsockname="unknown" 2619 tst_compi_getsockname="unknown" 2620 tst_allow_getsockname="unknown" 2621 # 2622 AC_MSG_CHECKING([if getsockname can be linked]) 2623 AC_LINK_IFELSE([ 2624 AC_LANG_PROGRAM([[ 2625 $curl_includes_winsock2 2626 $curl_includes_bsdsocket 2627 $curl_includes_sys_socket 2628 ]],[[ 2629 if(0 != getsockname(0, (void *)0, (void *)0)) 2630 return 1; 2631 ]]) 2632 ],[ 2633 AC_MSG_RESULT([yes]) 2634 tst_links_getsockname="yes" 2635 ],[ 2636 AC_MSG_RESULT([no]) 2637 tst_links_getsockname="no" 2638 ]) 2639 # 2640 if test "$tst_links_getsockname" = "yes"; then 2641 AC_MSG_CHECKING([if getsockname is prototyped]) 2642 AC_EGREP_CPP([getsockname],[ 2643 $curl_includes_winsock2 2644 $curl_includes_bsdsocket 2645 $curl_includes_sys_socket 2646 ],[ 2647 AC_MSG_RESULT([yes]) 2648 tst_proto_getsockname="yes" 2649 ],[ 2650 AC_MSG_RESULT([no]) 2651 tst_proto_getsockname="no" 2652 ]) 2653 fi 2654 # 2655 if test "$tst_proto_getsockname" = "yes"; then 2656 AC_MSG_CHECKING([if getsockname is compilable]) 2657 AC_COMPILE_IFELSE([ 2658 AC_LANG_PROGRAM([[ 2659 $curl_includes_winsock2 2660 $curl_includes_bsdsocket 2661 $curl_includes_sys_socket 2662 ]],[[ 2663 if(0 != getsockname(0, (void *)0, (void *)0)) 2664 return 1; 2665 ]]) 2666 ],[ 2667 AC_MSG_RESULT([yes]) 2668 tst_compi_getsockname="yes" 2669 ],[ 2670 AC_MSG_RESULT([no]) 2671 tst_compi_getsockname="no" 2672 ]) 2673 fi 2674 # 2675 if test "$tst_compi_getsockname" = "yes"; then 2676 AC_MSG_CHECKING([if getsockname usage allowed]) 2677 if test "x$curl_disallow_getsockname" != "xyes"; then 2678 AC_MSG_RESULT([yes]) 2679 tst_allow_getsockname="yes" 2680 else 2681 AC_MSG_RESULT([no]) 2682 tst_allow_getsockname="no" 2683 fi 2684 fi 2685 # 2686 AC_MSG_CHECKING([if getsockname might be used]) 2687 if test "$tst_links_getsockname" = "yes" && 2688 test "$tst_proto_getsockname" = "yes" && 2689 test "$tst_compi_getsockname" = "yes" && 2690 test "$tst_allow_getsockname" = "yes"; then 2691 AC_MSG_RESULT([yes]) 2692 AC_DEFINE_UNQUOTED(HAVE_GETSOCKNAME, 1, 2693 [Define to 1 if you have the getsockname function.]) 2694 curl_cv_func_getsockname="yes" 2695 else 2696 AC_MSG_RESULT([no]) 2697 curl_cv_func_getsockname="no" 2698 fi 2699]) 2700 2701dnl CURL_CHECK_FUNC_IF_NAMETOINDEX 2702dnl ------------------------------------------------- 2703dnl Verify if if_nametoindex is available, prototyped, and 2704dnl can be compiled. If all of these are true, and 2705dnl usage has not been previously disallowed with 2706dnl shell variable curl_disallow_if_nametoindex, then 2707dnl HAVE_IF_NAMETOINDEX will be defined. 2708 2709AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [ 2710 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 2711 AC_REQUIRE([CURL_INCLUDES_NETIF])dnl 2712 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 2713 # 2714 tst_links_if_nametoindex="unknown" 2715 tst_proto_if_nametoindex="unknown" 2716 tst_compi_if_nametoindex="unknown" 2717 tst_allow_if_nametoindex="unknown" 2718 # 2719 AC_MSG_CHECKING([if if_nametoindex can be linked]) 2720 AC_LINK_IFELSE([ 2721 AC_LANG_PROGRAM([[ 2722 $curl_includes_winsock2 2723 $curl_includes_bsdsocket 2724 #include <net/if.h> 2725 ]],[[ 2726 if(0 != if_nametoindex("")) 2727 return 1; 2728 ]]) 2729 ],[ 2730 AC_MSG_RESULT([yes]) 2731 tst_links_if_nametoindex="yes" 2732 ],[ 2733 AC_MSG_RESULT([no]) 2734 tst_links_if_nametoindex="no" 2735 ]) 2736 # 2737 if test "$tst_links_if_nametoindex" = "yes"; then 2738 AC_MSG_CHECKING([if if_nametoindex is prototyped]) 2739 AC_EGREP_CPP([if_nametoindex],[ 2740 $curl_includes_winsock2 2741 $curl_includes_netif 2742 ],[ 2743 AC_MSG_RESULT([yes]) 2744 tst_proto_if_nametoindex="yes" 2745 ],[ 2746 AC_MSG_RESULT([no]) 2747 tst_proto_if_nametoindex="no" 2748 ]) 2749 fi 2750 # 2751 if test "$tst_proto_if_nametoindex" = "yes"; then 2752 AC_MSG_CHECKING([if if_nametoindex is compilable]) 2753 AC_COMPILE_IFELSE([ 2754 AC_LANG_PROGRAM([[ 2755 $curl_includes_winsock2 2756 $curl_includes_netif 2757 ]],[[ 2758 if(0 != if_nametoindex("")) 2759 return 1; 2760 ]]) 2761 ],[ 2762 AC_MSG_RESULT([yes]) 2763 tst_compi_if_nametoindex="yes" 2764 ],[ 2765 AC_MSG_RESULT([no]) 2766 tst_compi_if_nametoindex="no" 2767 ]) 2768 fi 2769 # 2770 if test "$tst_compi_if_nametoindex" = "yes"; then 2771 AC_MSG_CHECKING([if if_nametoindex usage allowed]) 2772 if test "x$curl_disallow_if_nametoindex" != "xyes"; then 2773 AC_MSG_RESULT([yes]) 2774 tst_allow_if_nametoindex="yes" 2775 else 2776 AC_MSG_RESULT([no]) 2777 tst_allow_if_nametoindex="no" 2778 fi 2779 fi 2780 # 2781 AC_MSG_CHECKING([if if_nametoindex might be used]) 2782 if test "$tst_links_if_nametoindex" = "yes" && 2783 test "$tst_proto_if_nametoindex" = "yes" && 2784 test "$tst_compi_if_nametoindex" = "yes" && 2785 test "$tst_allow_if_nametoindex" = "yes"; then 2786 AC_MSG_RESULT([yes]) 2787 AC_DEFINE_UNQUOTED(HAVE_IF_NAMETOINDEX, 1, 2788 [Define to 1 if you have the if_nametoindex function.]) 2789 curl_cv_func_if_nametoindex="yes" 2790 else 2791 AC_MSG_RESULT([no]) 2792 curl_cv_func_if_nametoindex="no" 2793 fi 2794]) 2795 2796 2797dnl CURL_CHECK_FUNC_GETIFADDRS 2798dnl ------------------------------------------------- 2799dnl Verify if getifaddrs is available, prototyped, can 2800dnl be compiled and seems to work. If all of these are 2801dnl true, and usage has not been previously disallowed 2802dnl with shell variable curl_disallow_getifaddrs, then 2803dnl HAVE_GETIFADDRS will be defined. 2804 2805AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [ 2806 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 2807 AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl 2808 # 2809 tst_links_getifaddrs="unknown" 2810 tst_proto_getifaddrs="unknown" 2811 tst_compi_getifaddrs="unknown" 2812 tst_works_getifaddrs="unknown" 2813 tst_allow_getifaddrs="unknown" 2814 # 2815 AC_MSG_CHECKING([if getifaddrs can be linked]) 2816 AC_LINK_IFELSE([ 2817 AC_LANG_FUNC_LINK_TRY([getifaddrs]) 2818 ],[ 2819 AC_MSG_RESULT([yes]) 2820 tst_links_getifaddrs="yes" 2821 ],[ 2822 AC_MSG_RESULT([no]) 2823 tst_links_getifaddrs="no" 2824 ]) 2825 # 2826 if test "$tst_links_getifaddrs" = "yes"; then 2827 AC_MSG_CHECKING([if getifaddrs is prototyped]) 2828 AC_EGREP_CPP([getifaddrs],[ 2829 $curl_includes_ifaddrs 2830 ],[ 2831 AC_MSG_RESULT([yes]) 2832 tst_proto_getifaddrs="yes" 2833 ],[ 2834 AC_MSG_RESULT([no]) 2835 tst_proto_getifaddrs="no" 2836 ]) 2837 fi 2838 # 2839 if test "$tst_proto_getifaddrs" = "yes"; then 2840 AC_MSG_CHECKING([if getifaddrs is compilable]) 2841 AC_COMPILE_IFELSE([ 2842 AC_LANG_PROGRAM([[ 2843 $curl_includes_ifaddrs 2844 ]],[[ 2845 if(0 != getifaddrs(0)) 2846 return 1; 2847 ]]) 2848 ],[ 2849 AC_MSG_RESULT([yes]) 2850 tst_compi_getifaddrs="yes" 2851 ],[ 2852 AC_MSG_RESULT([no]) 2853 tst_compi_getifaddrs="no" 2854 ]) 2855 fi 2856 # 2857 dnl only do runtime verification when not cross-compiling 2858 if test "x$cross_compiling" != "xyes" && 2859 test "$tst_compi_getifaddrs" = "yes"; then 2860 AC_MSG_CHECKING([if getifaddrs seems to work]) 2861 CURL_RUN_IFELSE([ 2862 AC_LANG_PROGRAM([[ 2863 $curl_includes_stdlib 2864 $curl_includes_ifaddrs 2865 ]],[[ 2866 struct ifaddrs *ifa = 0; 2867 int error; 2868 2869 error = getifaddrs(&ifa); 2870 if(error || !ifa) 2871 exit(1); /* fail */ 2872 else 2873 exit(0); 2874 ]]) 2875 ],[ 2876 AC_MSG_RESULT([yes]) 2877 tst_works_getifaddrs="yes" 2878 ],[ 2879 AC_MSG_RESULT([no]) 2880 tst_works_getifaddrs="no" 2881 ]) 2882 fi 2883 # 2884 if test "$tst_compi_getifaddrs" = "yes" && 2885 test "$tst_works_getifaddrs" != "no"; then 2886 AC_MSG_CHECKING([if getifaddrs usage allowed]) 2887 if test "x$curl_disallow_getifaddrs" != "xyes"; then 2888 AC_MSG_RESULT([yes]) 2889 tst_allow_getifaddrs="yes" 2890 else 2891 AC_MSG_RESULT([no]) 2892 tst_allow_getifaddrs="no" 2893 fi 2894 fi 2895 # 2896 AC_MSG_CHECKING([if getifaddrs might be used]) 2897 if test "$tst_links_getifaddrs" = "yes" && 2898 test "$tst_proto_getifaddrs" = "yes" && 2899 test "$tst_compi_getifaddrs" = "yes" && 2900 test "$tst_allow_getifaddrs" = "yes" && 2901 test "$tst_works_getifaddrs" != "no"; then 2902 AC_MSG_RESULT([yes]) 2903 AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1, 2904 [Define to 1 if you have a working getifaddrs function.]) 2905 curl_cv_func_getifaddrs="yes" 2906 else 2907 AC_MSG_RESULT([no]) 2908 curl_cv_func_getifaddrs="no" 2909 fi 2910]) 2911 2912 2913dnl CURL_CHECK_FUNC_GETXATTR 2914dnl ------------------------------------------------- 2915dnl Verify if getxattr is available, prototyped, and 2916dnl can be compiled. If all of these are true, and 2917dnl usage has not been previously disallowed with 2918dnl shell variable curl_disallow_getxattr, then 2919dnl HAVE_GETXATTR will be defined. 2920 2921AC_DEFUN([CURL_CHECK_FUNC_GETXATTR], [ 2922 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 2923 # 2924 tst_links_getxattr="unknown" 2925 tst_proto_getxattr="unknown" 2926 tst_compi_getxattr="unknown" 2927 tst_allow_getxattr="unknown" 2928 tst_nargs_getxattr="unknown" 2929 # 2930 AC_MSG_CHECKING([if getxattr can be linked]) 2931 AC_LINK_IFELSE([ 2932 AC_LANG_FUNC_LINK_TRY([getxattr]) 2933 ],[ 2934 AC_MSG_RESULT([yes]) 2935 tst_links_getxattr="yes" 2936 ],[ 2937 AC_MSG_RESULT([no]) 2938 tst_links_getxattr="no" 2939 ]) 2940 # 2941 if test "$tst_links_getxattr" = "yes"; then 2942 AC_MSG_CHECKING([if getxattr is prototyped]) 2943 AC_EGREP_CPP([getxattr],[ 2944 $curl_includes_sys_xattr 2945 ],[ 2946 AC_MSG_RESULT([yes]) 2947 tst_proto_getxattr="yes" 2948 ],[ 2949 AC_MSG_RESULT([no]) 2950 tst_proto_getxattr="no" 2951 ]) 2952 fi 2953 # 2954 if test "$tst_proto_getxattr" = "yes"; then 2955 if test "$tst_nargs_getxattr" = "unknown"; then 2956 AC_MSG_CHECKING([if getxattr takes 4 args.]) 2957 AC_COMPILE_IFELSE([ 2958 AC_LANG_PROGRAM([[ 2959 $curl_includes_sys_xattr 2960 ]],[[ 2961 if(0 != getxattr(0, 0, 0, 0)) 2962 return 1; 2963 ]]) 2964 ],[ 2965 AC_MSG_RESULT([yes]) 2966 tst_compi_getxattr="yes" 2967 tst_nargs_getxattr="4" 2968 ],[ 2969 AC_MSG_RESULT([no]) 2970 tst_compi_getxattr="no" 2971 ]) 2972 fi 2973 if test "$tst_nargs_getxattr" = "unknown"; then 2974 AC_MSG_CHECKING([if getxattr takes 6 args.]) 2975 AC_COMPILE_IFELSE([ 2976 AC_LANG_PROGRAM([[ 2977 $curl_includes_sys_xattr 2978 ]],[[ 2979 if(0 != getxattr(0, 0, 0, 0, 0, 0)) 2980 return 1; 2981 ]]) 2982 ],[ 2983 AC_MSG_RESULT([yes]) 2984 tst_compi_getxattr="yes" 2985 tst_nargs_getxattr="6" 2986 ],[ 2987 AC_MSG_RESULT([no]) 2988 tst_compi_getxattr="no" 2989 ]) 2990 fi 2991 AC_MSG_CHECKING([if getxattr is compilable]) 2992 if test "$tst_compi_getxattr" = "yes"; then 2993 AC_MSG_RESULT([yes]) 2994 else 2995 AC_MSG_RESULT([no]) 2996 fi 2997 fi 2998 # 2999 if test "$tst_compi_getxattr" = "yes"; then 3000 AC_MSG_CHECKING([if getxattr usage allowed]) 3001 if test "x$curl_disallow_getxattr" != "xyes"; then 3002 AC_MSG_RESULT([yes]) 3003 tst_allow_getxattr="yes" 3004 else 3005 AC_MSG_RESULT([no]) 3006 tst_allow_getxattr="no" 3007 fi 3008 fi 3009 # 3010 AC_MSG_CHECKING([if getxattr might be used]) 3011 if test "$tst_links_getxattr" = "yes" && 3012 test "$tst_proto_getxattr" = "yes" && 3013 test "$tst_compi_getxattr" = "yes" && 3014 test "$tst_allow_getxattr" = "yes"; then 3015 AC_MSG_RESULT([yes]) 3016 AC_DEFINE_UNQUOTED(HAVE_GETXATTR, 1, 3017 [Define to 1 if you have the getxattr function.]) 3018 dnl AC_DEFINE_UNQUOTED(GETXATTR_ARGS, $tst_nargs_getxattr, 3019 dnl [Specifies the number of arguments to getxattr]) 3020 # 3021 if test "$tst_nargs_getxattr" -eq "4"; then 3022 AC_DEFINE(HAVE_GETXATTR_4, 1, [getxattr() takes 4 args]) 3023 elif test "$tst_nargs_getxattr" -eq "6"; then 3024 AC_DEFINE(HAVE_GETXATTR_6, 1, [getxattr() takes 6 args]) 3025 fi 3026 # 3027 curl_cv_func_getxattr="yes" 3028 else 3029 AC_MSG_RESULT([no]) 3030 curl_cv_func_getxattr="no" 3031 fi 3032]) 3033 3034 3035dnl CURL_CHECK_FUNC_GMTIME_R 3036dnl ------------------------------------------------- 3037dnl Verify if gmtime_r is available, prototyped, can 3038dnl be compiled and seems to work. If all of these are 3039dnl true, and usage has not been previously disallowed 3040dnl with shell variable curl_disallow_gmtime_r, then 3041dnl HAVE_GMTIME_R will be defined. 3042 3043AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [ 3044 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 3045 AC_REQUIRE([CURL_INCLUDES_TIME])dnl 3046 # 3047 tst_links_gmtime_r="unknown" 3048 tst_proto_gmtime_r="unknown" 3049 tst_compi_gmtime_r="unknown" 3050 tst_works_gmtime_r="unknown" 3051 tst_allow_gmtime_r="unknown" 3052 # 3053 AC_MSG_CHECKING([if gmtime_r can be linked]) 3054 AC_LINK_IFELSE([ 3055 AC_LANG_FUNC_LINK_TRY([gmtime_r]) 3056 ],[ 3057 AC_MSG_RESULT([yes]) 3058 tst_links_gmtime_r="yes" 3059 ],[ 3060 AC_MSG_RESULT([no]) 3061 tst_links_gmtime_r="no" 3062 ]) 3063 # 3064 if test "$tst_links_gmtime_r" = "yes"; then 3065 AC_MSG_CHECKING([if gmtime_r is prototyped]) 3066 AC_EGREP_CPP([gmtime_r],[ 3067 $curl_includes_time 3068 ],[ 3069 AC_MSG_RESULT([yes]) 3070 tst_proto_gmtime_r="yes" 3071 ],[ 3072 AC_MSG_RESULT([no]) 3073 tst_proto_gmtime_r="no" 3074 ]) 3075 fi 3076 # 3077 if test "$tst_proto_gmtime_r" = "yes"; then 3078 AC_MSG_CHECKING([if gmtime_r is compilable]) 3079 AC_COMPILE_IFELSE([ 3080 AC_LANG_PROGRAM([[ 3081 $curl_includes_time 3082 ]],[[ 3083 if(0 != gmtime_r(0, 0)) 3084 return 1; 3085 ]]) 3086 ],[ 3087 AC_MSG_RESULT([yes]) 3088 tst_compi_gmtime_r="yes" 3089 ],[ 3090 AC_MSG_RESULT([no]) 3091 tst_compi_gmtime_r="no" 3092 ]) 3093 fi 3094 # 3095 dnl only do runtime verification when not cross-compiling 3096 if test "x$cross_compiling" != "xyes" && 3097 test "$tst_compi_gmtime_r" = "yes"; then 3098 AC_MSG_CHECKING([if gmtime_r seems to work]) 3099 CURL_RUN_IFELSE([ 3100 AC_LANG_PROGRAM([[ 3101 $curl_includes_stdlib 3102 $curl_includes_time 3103 ]],[[ 3104 time_t local = 1170352587; 3105 struct tm *gmt = 0; 3106 struct tm result; 3107 gmt = gmtime_r(&local, &result); 3108 if(gmt) 3109 exit(0); 3110 else 3111 exit(1); 3112 ]]) 3113 ],[ 3114 AC_MSG_RESULT([yes]) 3115 tst_works_gmtime_r="yes" 3116 ],[ 3117 AC_MSG_RESULT([no]) 3118 tst_works_gmtime_r="no" 3119 ]) 3120 fi 3121 # 3122 if test "$tst_compi_gmtime_r" = "yes" && 3123 test "$tst_works_gmtime_r" != "no"; then 3124 AC_MSG_CHECKING([if gmtime_r usage allowed]) 3125 if test "x$curl_disallow_gmtime_r" != "xyes"; then 3126 AC_MSG_RESULT([yes]) 3127 tst_allow_gmtime_r="yes" 3128 else 3129 AC_MSG_RESULT([no]) 3130 tst_allow_gmtime_r="no" 3131 fi 3132 fi 3133 # 3134 AC_MSG_CHECKING([if gmtime_r might be used]) 3135 if test "$tst_links_gmtime_r" = "yes" && 3136 test "$tst_proto_gmtime_r" = "yes" && 3137 test "$tst_compi_gmtime_r" = "yes" && 3138 test "$tst_allow_gmtime_r" = "yes" && 3139 test "$tst_works_gmtime_r" != "no"; then 3140 AC_MSG_RESULT([yes]) 3141 AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1, 3142 [Define to 1 if you have a working gmtime_r function.]) 3143 curl_cv_func_gmtime_r="yes" 3144 else 3145 AC_MSG_RESULT([no]) 3146 curl_cv_func_gmtime_r="no" 3147 fi 3148]) 3149 3150 3151dnl CURL_CHECK_FUNC_INET_NTOP 3152dnl ------------------------------------------------- 3153dnl Verify if inet_ntop is available, prototyped, can 3154dnl be compiled and seems to work. If all of these are 3155dnl true, and usage has not been previously disallowed 3156dnl with shell variable curl_disallow_inet_ntop, then 3157dnl HAVE_INET_NTOP will be defined. 3158 3159AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [ 3160 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 3161 AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl 3162 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 3163 # 3164 tst_links_inet_ntop="unknown" 3165 tst_proto_inet_ntop="unknown" 3166 tst_compi_inet_ntop="unknown" 3167 tst_works_inet_ntop="unknown" 3168 tst_allow_inet_ntop="unknown" 3169 # 3170 AC_MSG_CHECKING([if inet_ntop can be linked]) 3171 AC_LINK_IFELSE([ 3172 AC_LANG_FUNC_LINK_TRY([inet_ntop]) 3173 ],[ 3174 AC_MSG_RESULT([yes]) 3175 tst_links_inet_ntop="yes" 3176 ],[ 3177 AC_MSG_RESULT([no]) 3178 tst_links_inet_ntop="no" 3179 ]) 3180 # 3181 if test "$tst_links_inet_ntop" = "yes"; then 3182 AC_MSG_CHECKING([if inet_ntop is prototyped]) 3183 AC_EGREP_CPP([inet_ntop],[ 3184 $curl_includes_arpa_inet 3185 ],[ 3186 AC_MSG_RESULT([yes]) 3187 tst_proto_inet_ntop="yes" 3188 ],[ 3189 AC_MSG_RESULT([no]) 3190 tst_proto_inet_ntop="no" 3191 ]) 3192 fi 3193 # 3194 if test "$tst_proto_inet_ntop" = "yes"; then 3195 AC_MSG_CHECKING([if inet_ntop is compilable]) 3196 AC_COMPILE_IFELSE([ 3197 AC_LANG_PROGRAM([[ 3198 $curl_includes_arpa_inet 3199 ]],[[ 3200 if(0 != inet_ntop(0, 0, 0, 0)) 3201 return 1; 3202 ]]) 3203 ],[ 3204 AC_MSG_RESULT([yes]) 3205 tst_compi_inet_ntop="yes" 3206 ],[ 3207 AC_MSG_RESULT([no]) 3208 tst_compi_inet_ntop="no" 3209 ]) 3210 fi 3211 # 3212 dnl only do runtime verification when not cross-compiling 3213 if test "x$cross_compiling" != "xyes" && 3214 test "$tst_compi_inet_ntop" = "yes"; then 3215 AC_MSG_CHECKING([if inet_ntop seems to work]) 3216 CURL_RUN_IFELSE([ 3217 AC_LANG_PROGRAM([[ 3218 $curl_includes_stdlib 3219 $curl_includes_arpa_inet 3220 $curl_includes_string 3221 ]],[[ 3222 char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; 3223 char ipv4res[sizeof "255.255.255.255"]; 3224 unsigned char ipv6a[26]; 3225 unsigned char ipv4a[5]; 3226 char *ipv6ptr = 0; 3227 char *ipv4ptr = 0; 3228 /* - */ 3229 ipv4res[0] = '\0'; 3230 ipv4a[0] = 0xc0; 3231 ipv4a[1] = 0xa8; 3232 ipv4a[2] = 0x64; 3233 ipv4a[3] = 0x01; 3234 ipv4a[4] = 0x01; 3235 /* - */ 3236 ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); 3237 if(!ipv4ptr) 3238 exit(1); /* fail */ 3239 if(ipv4ptr != ipv4res) 3240 exit(1); /* fail */ 3241 if(!ipv4ptr[0]) 3242 exit(1); /* fail */ 3243 if(memcmp(ipv4res, "192.168.100.1", 13) != 0) 3244 exit(1); /* fail */ 3245 /* - */ 3246 ipv6res[0] = '\0'; 3247 memset(ipv6a, 0, sizeof(ipv6a)); 3248 ipv6a[0] = 0xfe; 3249 ipv6a[1] = 0x80; 3250 ipv6a[8] = 0x02; 3251 ipv6a[9] = 0x14; 3252 ipv6a[10] = 0x4f; 3253 ipv6a[11] = 0xff; 3254 ipv6a[12] = 0xfe; 3255 ipv6a[13] = 0x0b; 3256 ipv6a[14] = 0x76; 3257 ipv6a[15] = 0xc8; 3258 ipv6a[25] = 0x01; 3259 /* - */ 3260 ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); 3261 if(!ipv6ptr) 3262 exit(1); /* fail */ 3263 if(ipv6ptr != ipv6res) 3264 exit(1); /* fail */ 3265 if(!ipv6ptr[0]) 3266 exit(1); /* fail */ 3267 if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) 3268 exit(1); /* fail */ 3269 /* - */ 3270 exit(0); 3271 ]]) 3272 ],[ 3273 AC_MSG_RESULT([yes]) 3274 tst_works_inet_ntop="yes" 3275 ],[ 3276 AC_MSG_RESULT([no]) 3277 tst_works_inet_ntop="no" 3278 ]) 3279 fi 3280 # 3281 if test "$tst_compi_inet_ntop" = "yes" && 3282 test "$tst_works_inet_ntop" != "no"; then 3283 AC_MSG_CHECKING([if inet_ntop usage allowed]) 3284 if test "x$curl_disallow_inet_ntop" != "xyes"; then 3285 AC_MSG_RESULT([yes]) 3286 tst_allow_inet_ntop="yes" 3287 else 3288 AC_MSG_RESULT([no]) 3289 tst_allow_inet_ntop="no" 3290 fi 3291 fi 3292 # 3293 AC_MSG_CHECKING([if inet_ntop might be used]) 3294 if test "$tst_links_inet_ntop" = "yes" && 3295 test "$tst_proto_inet_ntop" = "yes" && 3296 test "$tst_compi_inet_ntop" = "yes" && 3297 test "$tst_allow_inet_ntop" = "yes" && 3298 test "$tst_works_inet_ntop" != "no"; then 3299 AC_MSG_RESULT([yes]) 3300 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1, 3301 [Define to 1 if you have a IPv6 capable working inet_ntop function.]) 3302 curl_cv_func_inet_ntop="yes" 3303 else 3304 AC_MSG_RESULT([no]) 3305 curl_cv_func_inet_ntop="no" 3306 fi 3307]) 3308 3309 3310dnl CURL_CHECK_FUNC_INET_PTON 3311dnl ------------------------------------------------- 3312dnl Verify if inet_pton is available, prototyped, can 3313dnl be compiled and seems to work. If all of these are 3314dnl true, and usage has not been previously disallowed 3315dnl with shell variable curl_disallow_inet_pton, then 3316dnl HAVE_INET_PTON will be defined. 3317 3318AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [ 3319 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 3320 AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl 3321 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 3322 # 3323 tst_links_inet_pton="unknown" 3324 tst_proto_inet_pton="unknown" 3325 tst_compi_inet_pton="unknown" 3326 tst_works_inet_pton="unknown" 3327 tst_allow_inet_pton="unknown" 3328 # 3329 AC_MSG_CHECKING([if inet_pton can be linked]) 3330 AC_LINK_IFELSE([ 3331 AC_LANG_FUNC_LINK_TRY([inet_pton]) 3332 ],[ 3333 AC_MSG_RESULT([yes]) 3334 tst_links_inet_pton="yes" 3335 ],[ 3336 AC_MSG_RESULT([no]) 3337 tst_links_inet_pton="no" 3338 ]) 3339 # 3340 if test "$tst_links_inet_pton" = "yes"; then 3341 AC_MSG_CHECKING([if inet_pton is prototyped]) 3342 AC_EGREP_CPP([inet_pton],[ 3343 $curl_includes_arpa_inet 3344 ],[ 3345 AC_MSG_RESULT([yes]) 3346 tst_proto_inet_pton="yes" 3347 ],[ 3348 AC_MSG_RESULT([no]) 3349 tst_proto_inet_pton="no" 3350 ]) 3351 fi 3352 # 3353 if test "$tst_proto_inet_pton" = "yes"; then 3354 AC_MSG_CHECKING([if inet_pton is compilable]) 3355 AC_COMPILE_IFELSE([ 3356 AC_LANG_PROGRAM([[ 3357 $curl_includes_arpa_inet 3358 ]],[[ 3359 if(0 != inet_pton(0, 0, 0)) 3360 return 1; 3361 ]]) 3362 ],[ 3363 AC_MSG_RESULT([yes]) 3364 tst_compi_inet_pton="yes" 3365 ],[ 3366 AC_MSG_RESULT([no]) 3367 tst_compi_inet_pton="no" 3368 ]) 3369 fi 3370 # 3371 dnl only do runtime verification when not cross-compiling 3372 if test "x$cross_compiling" != "xyes" && 3373 test "$tst_compi_inet_pton" = "yes"; then 3374 AC_MSG_CHECKING([if inet_pton seems to work]) 3375 CURL_RUN_IFELSE([ 3376 AC_LANG_PROGRAM([[ 3377 $curl_includes_stdlib 3378 $curl_includes_arpa_inet 3379 $curl_includes_string 3380 ]],[[ 3381 unsigned char ipv6a[16+1]; 3382 unsigned char ipv4a[4+1]; 3383 const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; 3384 const char *ipv4src = "192.168.100.1"; 3385 /* - */ 3386 memset(ipv4a, 1, sizeof(ipv4a)); 3387 if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) 3388 exit(1); /* fail */ 3389 /* - */ 3390 if( (ipv4a[0] != 0xc0) || 3391 (ipv4a[1] != 0xa8) || 3392 (ipv4a[2] != 0x64) || 3393 (ipv4a[3] != 0x01) || 3394 (ipv4a[4] != 0x01) ) 3395 exit(1); /* fail */ 3396 /* - */ 3397 memset(ipv6a, 1, sizeof(ipv6a)); 3398 if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) 3399 exit(1); /* fail */ 3400 /* - */ 3401 if( (ipv6a[0] != 0xfe) || 3402 (ipv6a[1] != 0x80) || 3403 (ipv6a[8] != 0x02) || 3404 (ipv6a[9] != 0x14) || 3405 (ipv6a[10] != 0x4f) || 3406 (ipv6a[11] != 0xff) || 3407 (ipv6a[12] != 0xfe) || 3408 (ipv6a[13] != 0x0b) || 3409 (ipv6a[14] != 0x76) || 3410 (ipv6a[15] != 0xc8) || 3411 (ipv6a[16] != 0x01) ) 3412 exit(1); /* fail */ 3413 /* - */ 3414 if( (ipv6a[2] != 0x0) || 3415 (ipv6a[3] != 0x0) || 3416 (ipv6a[4] != 0x0) || 3417 (ipv6a[5] != 0x0) || 3418 (ipv6a[6] != 0x0) || 3419 (ipv6a[7] != 0x0) ) 3420 exit(1); /* fail */ 3421 /* - */ 3422 exit(0); 3423 ]]) 3424 ],[ 3425 AC_MSG_RESULT([yes]) 3426 tst_works_inet_pton="yes" 3427 ],[ 3428 AC_MSG_RESULT([no]) 3429 tst_works_inet_pton="no" 3430 ]) 3431 fi 3432 # 3433 if test "$tst_compi_inet_pton" = "yes" && 3434 test "$tst_works_inet_pton" != "no"; then 3435 AC_MSG_CHECKING([if inet_pton usage allowed]) 3436 if test "x$curl_disallow_inet_pton" != "xyes"; then 3437 AC_MSG_RESULT([yes]) 3438 tst_allow_inet_pton="yes" 3439 else 3440 AC_MSG_RESULT([no]) 3441 tst_allow_inet_pton="no" 3442 fi 3443 fi 3444 # 3445 AC_MSG_CHECKING([if inet_pton might be used]) 3446 if test "$tst_links_inet_pton" = "yes" && 3447 test "$tst_proto_inet_pton" = "yes" && 3448 test "$tst_compi_inet_pton" = "yes" && 3449 test "$tst_allow_inet_pton" = "yes" && 3450 test "$tst_works_inet_pton" != "no"; then 3451 AC_MSG_RESULT([yes]) 3452 AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1, 3453 [Define to 1 if you have a IPv6 capable working inet_pton function.]) 3454 curl_cv_func_inet_pton="yes" 3455 else 3456 AC_MSG_RESULT([no]) 3457 curl_cv_func_inet_pton="no" 3458 fi 3459]) 3460 3461 3462dnl CURL_CHECK_FUNC_IOCTL 3463dnl ------------------------------------------------- 3464dnl Verify if ioctl is available, prototyped, and 3465dnl can be compiled. If all of these are true, and 3466dnl usage has not been previously disallowed with 3467dnl shell variable curl_disallow_ioctl, then 3468dnl HAVE_IOCTL will be defined. 3469 3470AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [ 3471 AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl 3472 # 3473 tst_links_ioctl="unknown" 3474 tst_proto_ioctl="unknown" 3475 tst_compi_ioctl="unknown" 3476 tst_allow_ioctl="unknown" 3477 # 3478 AC_MSG_CHECKING([if ioctl can be linked]) 3479 AC_LINK_IFELSE([ 3480 AC_LANG_FUNC_LINK_TRY([ioctl]) 3481 ],[ 3482 AC_MSG_RESULT([yes]) 3483 tst_links_ioctl="yes" 3484 ],[ 3485 AC_MSG_RESULT([no]) 3486 tst_links_ioctl="no" 3487 ]) 3488 # 3489 if test "$tst_links_ioctl" = "yes"; then 3490 AC_MSG_CHECKING([if ioctl is prototyped]) 3491 AC_EGREP_CPP([ioctl],[ 3492 $curl_includes_stropts 3493 ],[ 3494 AC_MSG_RESULT([yes]) 3495 tst_proto_ioctl="yes" 3496 ],[ 3497 AC_MSG_RESULT([no]) 3498 tst_proto_ioctl="no" 3499 ]) 3500 fi 3501 # 3502 if test "$tst_proto_ioctl" = "yes"; then 3503 AC_MSG_CHECKING([if ioctl is compilable]) 3504 AC_COMPILE_IFELSE([ 3505 AC_LANG_PROGRAM([[ 3506 $curl_includes_stropts 3507 ]],[[ 3508 if(0 != ioctl(0, 0, 0)) 3509 return 1; 3510 ]]) 3511 ],[ 3512 AC_MSG_RESULT([yes]) 3513 tst_compi_ioctl="yes" 3514 ],[ 3515 AC_MSG_RESULT([no]) 3516 tst_compi_ioctl="no" 3517 ]) 3518 fi 3519 # 3520 if test "$tst_compi_ioctl" = "yes"; then 3521 AC_MSG_CHECKING([if ioctl usage allowed]) 3522 if test "x$curl_disallow_ioctl" != "xyes"; then 3523 AC_MSG_RESULT([yes]) 3524 tst_allow_ioctl="yes" 3525 else 3526 AC_MSG_RESULT([no]) 3527 tst_allow_ioctl="no" 3528 fi 3529 fi 3530 # 3531 AC_MSG_CHECKING([if ioctl might be used]) 3532 if test "$tst_links_ioctl" = "yes" && 3533 test "$tst_proto_ioctl" = "yes" && 3534 test "$tst_compi_ioctl" = "yes" && 3535 test "$tst_allow_ioctl" = "yes"; then 3536 AC_MSG_RESULT([yes]) 3537 AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1, 3538 [Define to 1 if you have the ioctl function.]) 3539 curl_cv_func_ioctl="yes" 3540 CURL_CHECK_FUNC_IOCTL_FIONBIO 3541 CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR 3542 else 3543 AC_MSG_RESULT([no]) 3544 curl_cv_func_ioctl="no" 3545 fi 3546]) 3547 3548 3549dnl CURL_CHECK_FUNC_IOCTL_FIONBIO 3550dnl ------------------------------------------------- 3551dnl Verify if ioctl with the FIONBIO command is 3552dnl available, can be compiled, and seems to work. If 3553dnl all of these are true, then HAVE_IOCTL_FIONBIO 3554dnl will be defined. 3555 3556AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [ 3557 # 3558 tst_compi_ioctl_fionbio="unknown" 3559 tst_allow_ioctl_fionbio="unknown" 3560 # 3561 if test "$curl_cv_func_ioctl" = "yes"; then 3562 AC_MSG_CHECKING([if ioctl FIONBIO is compilable]) 3563 AC_COMPILE_IFELSE([ 3564 AC_LANG_PROGRAM([[ 3565 $curl_includes_stropts 3566 ]],[[ 3567 int flags = 0; 3568 if(0 != ioctl(0, FIONBIO, &flags)) 3569 return 1; 3570 ]]) 3571 ],[ 3572 AC_MSG_RESULT([yes]) 3573 tst_compi_ioctl_fionbio="yes" 3574 ],[ 3575 AC_MSG_RESULT([no]) 3576 tst_compi_ioctl_fionbio="no" 3577 ]) 3578 fi 3579 # 3580 if test "$tst_compi_ioctl_fionbio" = "yes"; then 3581 AC_MSG_CHECKING([if ioctl FIONBIO usage allowed]) 3582 if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then 3583 AC_MSG_RESULT([yes]) 3584 tst_allow_ioctl_fionbio="yes" 3585 else 3586 AC_MSG_RESULT([no]) 3587 tst_allow_ioctl_fionbio="no" 3588 fi 3589 fi 3590 # 3591 AC_MSG_CHECKING([if ioctl FIONBIO might be used]) 3592 if test "$tst_compi_ioctl_fionbio" = "yes" && 3593 test "$tst_allow_ioctl_fionbio" = "yes"; then 3594 AC_MSG_RESULT([yes]) 3595 AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1, 3596 [Define to 1 if you have a working ioctl FIONBIO function.]) 3597 curl_cv_func_ioctl_fionbio="yes" 3598 else 3599 AC_MSG_RESULT([no]) 3600 curl_cv_func_ioctl_fionbio="no" 3601 fi 3602]) 3603 3604 3605dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR 3606dnl ------------------------------------------------- 3607dnl Verify if ioctl with the SIOCGIFADDR command is available, 3608dnl struct ifreq is defined, they can be compiled, and seem to 3609dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR 3610dnl will be defined. 3611 3612AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [ 3613 # 3614 tst_compi_ioctl_siocgifaddr="unknown" 3615 tst_allow_ioctl_siocgifaddr="unknown" 3616 # 3617 if test "$curl_cv_func_ioctl" = "yes"; then 3618 AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable]) 3619 AC_COMPILE_IFELSE([ 3620 AC_LANG_PROGRAM([[ 3621 $curl_includes_stropts 3622 #include <net/if.h> 3623 ]],[[ 3624 struct ifreq ifr; 3625 if(0 != ioctl(0, SIOCGIFADDR, &ifr)) 3626 return 1; 3627 ]]) 3628 ],[ 3629 AC_MSG_RESULT([yes]) 3630 tst_compi_ioctl_siocgifaddr="yes" 3631 ],[ 3632 AC_MSG_RESULT([no]) 3633 tst_compi_ioctl_siocgifaddr="no" 3634 ]) 3635 fi 3636 # 3637 if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then 3638 AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed]) 3639 if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then 3640 AC_MSG_RESULT([yes]) 3641 tst_allow_ioctl_siocgifaddr="yes" 3642 else 3643 AC_MSG_RESULT([no]) 3644 tst_allow_ioctl_siocgifaddr="no" 3645 fi 3646 fi 3647 # 3648 AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used]) 3649 if test "$tst_compi_ioctl_siocgifaddr" = "yes" && 3650 test "$tst_allow_ioctl_siocgifaddr" = "yes"; then 3651 AC_MSG_RESULT([yes]) 3652 AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1, 3653 [Define to 1 if you have a working ioctl SIOCGIFADDR function.]) 3654 curl_cv_func_ioctl_siocgifaddr="yes" 3655 else 3656 AC_MSG_RESULT([no]) 3657 curl_cv_func_ioctl_siocgifaddr="no" 3658 fi 3659]) 3660 3661 3662dnl CURL_CHECK_FUNC_IOCTLSOCKET 3663dnl ------------------------------------------------- 3664dnl Verify if ioctlsocket is available, prototyped, and 3665dnl can be compiled. If all of these are true, and 3666dnl usage has not been previously disallowed with 3667dnl shell variable curl_disallow_ioctlsocket, then 3668dnl HAVE_IOCTLSOCKET will be defined. 3669 3670AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [ 3671 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 3672 # 3673 tst_links_ioctlsocket="unknown" 3674 tst_proto_ioctlsocket="unknown" 3675 tst_compi_ioctlsocket="unknown" 3676 tst_allow_ioctlsocket="unknown" 3677 # 3678 AC_MSG_CHECKING([if ioctlsocket can be linked]) 3679 AC_LINK_IFELSE([ 3680 AC_LANG_PROGRAM([[ 3681 $curl_includes_winsock2 3682 $curl_includes_bsdsocket 3683 ]],[[ 3684 if(0 != ioctlsocket(0, 0, 0)) 3685 return 1; 3686 ]]) 3687 ],[ 3688 AC_MSG_RESULT([yes]) 3689 tst_links_ioctlsocket="yes" 3690 ],[ 3691 AC_MSG_RESULT([no]) 3692 tst_links_ioctlsocket="no" 3693 ]) 3694 # 3695 if test "$tst_links_ioctlsocket" = "yes"; then 3696 AC_MSG_CHECKING([if ioctlsocket is prototyped]) 3697 AC_EGREP_CPP([ioctlsocket],[ 3698 $curl_includes_winsock2 3699 $curl_includes_bsdsocket 3700 ],[ 3701 AC_MSG_RESULT([yes]) 3702 tst_proto_ioctlsocket="yes" 3703 ],[ 3704 AC_MSG_RESULT([no]) 3705 tst_proto_ioctlsocket="no" 3706 ]) 3707 fi 3708 # 3709 if test "$tst_proto_ioctlsocket" = "yes"; then 3710 AC_MSG_CHECKING([if ioctlsocket is compilable]) 3711 AC_COMPILE_IFELSE([ 3712 AC_LANG_PROGRAM([[ 3713 $curl_includes_winsock2 3714 $curl_includes_bsdsocket 3715 ]],[[ 3716 if(0 != ioctlsocket(0, 0, 0)) 3717 return 1; 3718 ]]) 3719 ],[ 3720 AC_MSG_RESULT([yes]) 3721 tst_compi_ioctlsocket="yes" 3722 ],[ 3723 AC_MSG_RESULT([no]) 3724 tst_compi_ioctlsocket="no" 3725 ]) 3726 fi 3727 # 3728 if test "$tst_compi_ioctlsocket" = "yes"; then 3729 AC_MSG_CHECKING([if ioctlsocket usage allowed]) 3730 if test "x$curl_disallow_ioctlsocket" != "xyes"; then 3731 AC_MSG_RESULT([yes]) 3732 tst_allow_ioctlsocket="yes" 3733 else 3734 AC_MSG_RESULT([no]) 3735 tst_allow_ioctlsocket="no" 3736 fi 3737 fi 3738 # 3739 AC_MSG_CHECKING([if ioctlsocket might be used]) 3740 if test "$tst_links_ioctlsocket" = "yes" && 3741 test "$tst_proto_ioctlsocket" = "yes" && 3742 test "$tst_compi_ioctlsocket" = "yes" && 3743 test "$tst_allow_ioctlsocket" = "yes"; then 3744 AC_MSG_RESULT([yes]) 3745 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1, 3746 [Define to 1 if you have the ioctlsocket function.]) 3747 curl_cv_func_ioctlsocket="yes" 3748 CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO 3749 else 3750 AC_MSG_RESULT([no]) 3751 curl_cv_func_ioctlsocket="no" 3752 fi 3753]) 3754 3755 3756dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO 3757dnl ------------------------------------------------- 3758dnl Verify if ioctlsocket with the FIONBIO command is 3759dnl available, can be compiled, and seems to work. If 3760dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO 3761dnl will be defined. 3762 3763AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [ 3764 # 3765 tst_compi_ioctlsocket_fionbio="unknown" 3766 tst_allow_ioctlsocket_fionbio="unknown" 3767 # 3768 if test "$curl_cv_func_ioctlsocket" = "yes"; then 3769 AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable]) 3770 AC_COMPILE_IFELSE([ 3771 AC_LANG_PROGRAM([[ 3772 $curl_includes_winsock2 3773 $curl_includes_bsdsocket 3774 ]],[[ 3775 int flags = 0; 3776 if(0 != ioctlsocket(0, FIONBIO, &flags)) 3777 return 1; 3778 ]]) 3779 ],[ 3780 AC_MSG_RESULT([yes]) 3781 tst_compi_ioctlsocket_fionbio="yes" 3782 ],[ 3783 AC_MSG_RESULT([no]) 3784 tst_compi_ioctlsocket_fionbio="no" 3785 ]) 3786 fi 3787 # 3788 if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then 3789 AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed]) 3790 if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then 3791 AC_MSG_RESULT([yes]) 3792 tst_allow_ioctlsocket_fionbio="yes" 3793 else 3794 AC_MSG_RESULT([no]) 3795 tst_allow_ioctlsocket_fionbio="no" 3796 fi 3797 fi 3798 # 3799 AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used]) 3800 if test "$tst_compi_ioctlsocket_fionbio" = "yes" && 3801 test "$tst_allow_ioctlsocket_fionbio" = "yes"; then 3802 AC_MSG_RESULT([yes]) 3803 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1, 3804 [Define to 1 if you have a working ioctlsocket FIONBIO function.]) 3805 curl_cv_func_ioctlsocket_fionbio="yes" 3806 else 3807 AC_MSG_RESULT([no]) 3808 curl_cv_func_ioctlsocket_fionbio="no" 3809 fi 3810]) 3811 3812 3813dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL 3814dnl ------------------------------------------------- 3815dnl Verify if IoctlSocket is available, prototyped, and 3816dnl can be compiled. If all of these are true, and 3817dnl usage has not been previously disallowed with 3818dnl shell variable curl_disallow_ioctlsocket_camel, 3819dnl then HAVE_IOCTLSOCKET_CAMEL will be defined. 3820 3821AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [ 3822 AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl 3823 # 3824 tst_links_ioctlsocket_camel="unknown" 3825 tst_proto_ioctlsocket_camel="unknown" 3826 tst_compi_ioctlsocket_camel="unknown" 3827 tst_allow_ioctlsocket_camel="unknown" 3828 # 3829 AC_MSG_CHECKING([if IoctlSocket can be linked]) 3830 AC_LINK_IFELSE([ 3831 AC_LANG_FUNC_LINK_TRY([IoctlSocket]) 3832 ],[ 3833 AC_MSG_RESULT([yes]) 3834 tst_links_ioctlsocket_camel="yes" 3835 ],[ 3836 AC_MSG_RESULT([no]) 3837 tst_links_ioctlsocket_camel="no" 3838 ]) 3839 # 3840 if test "$tst_links_ioctlsocket_camel" = "yes"; then 3841 AC_MSG_CHECKING([if IoctlSocket is prototyped]) 3842 AC_EGREP_CPP([IoctlSocket],[ 3843 $curl_includes_stropts 3844 ],[ 3845 AC_MSG_RESULT([yes]) 3846 tst_proto_ioctlsocket_camel="yes" 3847 ],[ 3848 AC_MSG_RESULT([no]) 3849 tst_proto_ioctlsocket_camel="no" 3850 ]) 3851 fi 3852 # 3853 if test "$tst_proto_ioctlsocket_camel" = "yes"; then 3854 AC_MSG_CHECKING([if IoctlSocket is compilable]) 3855 AC_COMPILE_IFELSE([ 3856 AC_LANG_PROGRAM([[ 3857 $curl_includes_stropts 3858 ]],[[ 3859 if(0 != IoctlSocket(0, 0, 0)) 3860 return 1; 3861 ]]) 3862 ],[ 3863 AC_MSG_RESULT([yes]) 3864 tst_compi_ioctlsocket_camel="yes" 3865 ],[ 3866 AC_MSG_RESULT([no]) 3867 tst_compi_ioctlsocket_camel="no" 3868 ]) 3869 fi 3870 # 3871 if test "$tst_compi_ioctlsocket_camel" = "yes"; then 3872 AC_MSG_CHECKING([if IoctlSocket usage allowed]) 3873 if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then 3874 AC_MSG_RESULT([yes]) 3875 tst_allow_ioctlsocket_camel="yes" 3876 else 3877 AC_MSG_RESULT([no]) 3878 tst_allow_ioctlsocket_camel="no" 3879 fi 3880 fi 3881 # 3882 AC_MSG_CHECKING([if IoctlSocket might be used]) 3883 if test "$tst_links_ioctlsocket_camel" = "yes" && 3884 test "$tst_proto_ioctlsocket_camel" = "yes" && 3885 test "$tst_compi_ioctlsocket_camel" = "yes" && 3886 test "$tst_allow_ioctlsocket_camel" = "yes"; then 3887 AC_MSG_RESULT([yes]) 3888 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1, 3889 [Define to 1 if you have the IoctlSocket camel case function.]) 3890 curl_cv_func_ioctlsocket_camel="yes" 3891 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO 3892 else 3893 AC_MSG_RESULT([no]) 3894 curl_cv_func_ioctlsocket_camel="no" 3895 fi 3896]) 3897 3898 3899dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO 3900dnl ------------------------------------------------- 3901dnl Verify if IoctlSocket with FIONBIO command is available, 3902dnl can be compiled, and seems to work. If all of these are 3903dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined. 3904 3905AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [ 3906 # 3907 tst_compi_ioctlsocket_camel_fionbio="unknown" 3908 tst_allow_ioctlsocket_camel_fionbio="unknown" 3909 # 3910 if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then 3911 AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable]) 3912 AC_COMPILE_IFELSE([ 3913 AC_LANG_PROGRAM([[ 3914 $curl_includes_stropts 3915 ]],[[ 3916 long flags = 0; 3917 if(0 != IoctlSocket(0, FIONBIO, &flags)) 3918 return 1; 3919 ]]) 3920 ],[ 3921 AC_MSG_RESULT([yes]) 3922 tst_compi_ioctlsocket_camel_fionbio="yes" 3923 ],[ 3924 AC_MSG_RESULT([no]) 3925 tst_compi_ioctlsocket_camel_fionbio="no" 3926 ]) 3927 fi 3928 # 3929 if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then 3930 AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed]) 3931 if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then 3932 AC_MSG_RESULT([yes]) 3933 tst_allow_ioctlsocket_camel_fionbio="yes" 3934 else 3935 AC_MSG_RESULT([no]) 3936 tst_allow_ioctlsocket_camel_fionbio="no" 3937 fi 3938 fi 3939 # 3940 AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used]) 3941 if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && 3942 test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then 3943 AC_MSG_RESULT([yes]) 3944 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1, 3945 [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.]) 3946 curl_cv_func_ioctlsocket_camel_fionbio="yes" 3947 else 3948 AC_MSG_RESULT([no]) 3949 curl_cv_func_ioctlsocket_camel_fionbio="no" 3950 fi 3951]) 3952 3953 3954dnl CURL_CHECK_FUNC_LISTXATTR 3955dnl ------------------------------------------------- 3956dnl Verify if listxattr is available, prototyped, and 3957dnl can be compiled. If all of these are true, and 3958dnl usage has not been previously disallowed with 3959dnl shell variable curl_disallow_listxattr, then 3960dnl HAVE_LISTXATTR will be defined. 3961 3962AC_DEFUN([CURL_CHECK_FUNC_LISTXATTR], [ 3963 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 3964 # 3965 tst_links_listxattr="unknown" 3966 tst_proto_listxattr="unknown" 3967 tst_compi_listxattr="unknown" 3968 tst_allow_listxattr="unknown" 3969 tst_nargs_listxattr="unknown" 3970 # 3971 AC_MSG_CHECKING([if listxattr can be linked]) 3972 AC_LINK_IFELSE([ 3973 AC_LANG_FUNC_LINK_TRY([listxattr]) 3974 ],[ 3975 AC_MSG_RESULT([yes]) 3976 tst_links_listxattr="yes" 3977 ],[ 3978 AC_MSG_RESULT([no]) 3979 tst_links_listxattr="no" 3980 ]) 3981 # 3982 if test "$tst_links_listxattr" = "yes"; then 3983 AC_MSG_CHECKING([if listxattr is prototyped]) 3984 AC_EGREP_CPP([listxattr],[ 3985 $curl_includes_sys_xattr 3986 ],[ 3987 AC_MSG_RESULT([yes]) 3988 tst_proto_listxattr="yes" 3989 ],[ 3990 AC_MSG_RESULT([no]) 3991 tst_proto_listxattr="no" 3992 ]) 3993 fi 3994 # 3995 if test "$tst_proto_listxattr" = "yes"; then 3996 if test "$tst_nargs_listxattr" = "unknown"; then 3997 AC_MSG_CHECKING([if listxattr takes 3 args.]) 3998 AC_COMPILE_IFELSE([ 3999 AC_LANG_PROGRAM([[ 4000 $curl_includes_sys_xattr 4001 ]],[[ 4002 if(0 != listxattr(0, 0, 0)) 4003 return 1; 4004 ]]) 4005 ],[ 4006 AC_MSG_RESULT([yes]) 4007 tst_compi_listxattr="yes" 4008 tst_nargs_listxattr="3" 4009 ],[ 4010 AC_MSG_RESULT([no]) 4011 tst_compi_listxattr="no" 4012 ]) 4013 fi 4014 if test "$tst_nargs_listxattr" = "unknown"; then 4015 AC_MSG_CHECKING([if listxattr takes 4 args.]) 4016 AC_COMPILE_IFELSE([ 4017 AC_LANG_PROGRAM([[ 4018 $curl_includes_sys_xattr 4019 ]],[[ 4020 if(0 != listxattr(0, 0, 0, 0)) 4021 return 1; 4022 ]]) 4023 ],[ 4024 AC_MSG_RESULT([yes]) 4025 tst_compi_listxattr="yes" 4026 tst_nargs_listxattr="4" 4027 ],[ 4028 AC_MSG_RESULT([no]) 4029 tst_compi_listxattr="no" 4030 ]) 4031 fi 4032 AC_MSG_CHECKING([if listxattr is compilable]) 4033 if test "$tst_compi_listxattr" = "yes"; then 4034 AC_MSG_RESULT([yes]) 4035 else 4036 AC_MSG_RESULT([no]) 4037 fi 4038 fi 4039 # 4040 if test "$tst_compi_listxattr" = "yes"; then 4041 AC_MSG_CHECKING([if listxattr usage allowed]) 4042 if test "x$curl_disallow_listxattr" != "xyes"; then 4043 AC_MSG_RESULT([yes]) 4044 tst_allow_listxattr="yes" 4045 else 4046 AC_MSG_RESULT([no]) 4047 tst_allow_listxattr="no" 4048 fi 4049 fi 4050 # 4051 AC_MSG_CHECKING([if listxattr might be used]) 4052 if test "$tst_links_listxattr" = "yes" && 4053 test "$tst_proto_listxattr" = "yes" && 4054 test "$tst_compi_listxattr" = "yes" && 4055 test "$tst_allow_listxattr" = "yes"; then 4056 AC_MSG_RESULT([yes]) 4057 AC_DEFINE_UNQUOTED(HAVE_LISTXATTR, 1, 4058 [Define to 1 if you have the listxattr function.]) 4059 dnl AC_DEFINE_UNQUOTED(LISTXATTR_ARGS, $tst_nargs_listxattr, 4060 dnl [Specifies the number of arguments to listxattr]) 4061 # 4062 if test "$tst_nargs_listxattr" -eq "3"; then 4063 AC_DEFINE(HAVE_LISTXATTR_3, 1, [listxattr() takes 3 args]) 4064 elif test "$tst_nargs_listxattr" -eq "4"; then 4065 AC_DEFINE(HAVE_LISTXATTR_4, 1, [listxattr() takes 4 args]) 4066 fi 4067 # 4068 curl_cv_func_listxattr="yes" 4069 else 4070 AC_MSG_RESULT([no]) 4071 curl_cv_func_listxattr="no" 4072 fi 4073]) 4074 4075 4076dnl CURL_CHECK_FUNC_LOCALTIME_R 4077dnl ------------------------------------------------- 4078dnl Verify if localtime_r is available, prototyped, can 4079dnl be compiled and seems to work. If all of these are 4080dnl true, and usage has not been previously disallowed 4081dnl with shell variable curl_disallow_localtime_r, then 4082dnl HAVE_LOCALTIME_R will be defined. 4083 4084AC_DEFUN([CURL_CHECK_FUNC_LOCALTIME_R], [ 4085 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 4086 AC_REQUIRE([CURL_INCLUDES_TIME])dnl 4087 # 4088 tst_links_localtime_r="unknown" 4089 tst_proto_localtime_r="unknown" 4090 tst_compi_localtime_r="unknown" 4091 tst_works_localtime_r="unknown" 4092 tst_allow_localtime_r="unknown" 4093 # 4094 AC_MSG_CHECKING([if localtime_r can be linked]) 4095 AC_LINK_IFELSE([ 4096 AC_LANG_FUNC_LINK_TRY([localtime_r]) 4097 ],[ 4098 AC_MSG_RESULT([yes]) 4099 tst_links_localtime_r="yes" 4100 ],[ 4101 AC_MSG_RESULT([no]) 4102 tst_links_localtime_r="no" 4103 ]) 4104 # 4105 if test "$tst_links_localtime_r" = "yes"; then 4106 AC_MSG_CHECKING([if localtime_r is prototyped]) 4107 AC_EGREP_CPP([localtime_r],[ 4108 $curl_includes_time 4109 ],[ 4110 AC_MSG_RESULT([yes]) 4111 tst_proto_localtime_r="yes" 4112 ],[ 4113 AC_MSG_RESULT([no]) 4114 tst_proto_localtime_r="no" 4115 ]) 4116 fi 4117 # 4118 if test "$tst_proto_localtime_r" = "yes"; then 4119 AC_MSG_CHECKING([if localtime_r is compilable]) 4120 AC_COMPILE_IFELSE([ 4121 AC_LANG_PROGRAM([[ 4122 $curl_includes_time 4123 ]],[[ 4124 if(0 != localtime_r(0, 0)) 4125 return 1; 4126 ]]) 4127 ],[ 4128 AC_MSG_RESULT([yes]) 4129 tst_compi_localtime_r="yes" 4130 ],[ 4131 AC_MSG_RESULT([no]) 4132 tst_compi_localtime_r="no" 4133 ]) 4134 fi 4135 # 4136 dnl only do runtime verification when not cross-compiling 4137 if test "x$cross_compiling" != "xyes" && 4138 test "$tst_compi_localtime_r" = "yes"; then 4139 AC_MSG_CHECKING([if localtime_r seems to work]) 4140 CURL_RUN_IFELSE([ 4141 AC_LANG_PROGRAM([[ 4142 $curl_includes_stdlib 4143 $curl_includes_time 4144 ]],[[ 4145 time_t clock = 1170352587; 4146 struct tm *tmp = 0; 4147 struct tm result; 4148 tmp = localtime_r(&clock, &result); 4149 if(tmp) 4150 exit(0); 4151 else 4152 exit(1); 4153 ]]) 4154 ],[ 4155 AC_MSG_RESULT([yes]) 4156 tst_works_localtime_r="yes" 4157 ],[ 4158 AC_MSG_RESULT([no]) 4159 tst_works_localtime_r="no" 4160 ]) 4161 fi 4162 # 4163 if test "$tst_compi_localtime_r" = "yes" && 4164 test "$tst_works_localtime_r" != "no"; then 4165 AC_MSG_CHECKING([if localtime_r usage allowed]) 4166 if test "x$curl_disallow_localtime_r" != "xyes"; then 4167 AC_MSG_RESULT([yes]) 4168 tst_allow_localtime_r="yes" 4169 else 4170 AC_MSG_RESULT([no]) 4171 tst_allow_localtime_r="no" 4172 fi 4173 fi 4174 # 4175 AC_MSG_CHECKING([if localtime_r might be used]) 4176 if test "$tst_links_localtime_r" = "yes" && 4177 test "$tst_proto_localtime_r" = "yes" && 4178 test "$tst_compi_localtime_r" = "yes" && 4179 test "$tst_allow_localtime_r" = "yes" && 4180 test "$tst_works_localtime_r" != "no"; then 4181 AC_MSG_RESULT([yes]) 4182 AC_DEFINE_UNQUOTED(HAVE_LOCALTIME_R, 1, 4183 [Define to 1 if you have a working localtime_r function.]) 4184 curl_cv_func_localtime_r="yes" 4185 else 4186 AC_MSG_RESULT([no]) 4187 curl_cv_func_localtime_r="no" 4188 fi 4189]) 4190 4191 4192dnl CURL_CHECK_FUNC_MEMRCHR 4193dnl ------------------------------------------------- 4194dnl Verify if memrchr is available, prototyped, and 4195dnl can be compiled. If all of these are true, and 4196dnl usage has not been previously disallowed with 4197dnl shell variable curl_disallow_memrchr, then 4198dnl HAVE_MEMRCHR will be defined. 4199 4200AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [ 4201 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 4202 # 4203 tst_links_memrchr="unknown" 4204 tst_macro_memrchr="unknown" 4205 tst_proto_memrchr="unknown" 4206 tst_compi_memrchr="unknown" 4207 tst_allow_memrchr="unknown" 4208 # 4209 AC_MSG_CHECKING([if memrchr can be linked]) 4210 AC_LINK_IFELSE([ 4211 AC_LANG_FUNC_LINK_TRY([memrchr]) 4212 ],[ 4213 AC_MSG_RESULT([yes]) 4214 tst_links_memrchr="yes" 4215 ],[ 4216 AC_MSG_RESULT([no]) 4217 tst_links_memrchr="no" 4218 ]) 4219 # 4220 if test "$tst_links_memrchr" = "no"; then 4221 AC_MSG_CHECKING([if memrchr seems a macro]) 4222 AC_LINK_IFELSE([ 4223 AC_LANG_PROGRAM([[ 4224 $curl_includes_string 4225 ]],[[ 4226 if(0 != memrchr(0, 0, 0)) 4227 return 1; 4228 ]]) 4229 ],[ 4230 AC_MSG_RESULT([yes]) 4231 tst_macro_memrchr="yes" 4232 ],[ 4233 AC_MSG_RESULT([no]) 4234 tst_macro_memrchr="no" 4235 ]) 4236 fi 4237 # 4238 if test "$tst_links_memrchr" = "yes"; then 4239 AC_MSG_CHECKING([if memrchr is prototyped]) 4240 AC_EGREP_CPP([memrchr],[ 4241 $curl_includes_string 4242 ],[ 4243 AC_MSG_RESULT([yes]) 4244 tst_proto_memrchr="yes" 4245 ],[ 4246 AC_MSG_RESULT([no]) 4247 tst_proto_memrchr="no" 4248 ]) 4249 fi 4250 # 4251 if test "$tst_proto_memrchr" = "yes" || 4252 test "$tst_macro_memrchr" = "yes"; then 4253 AC_MSG_CHECKING([if memrchr is compilable]) 4254 AC_COMPILE_IFELSE([ 4255 AC_LANG_PROGRAM([[ 4256 $curl_includes_string 4257 ]],[[ 4258 if(0 != memrchr(0, 0, 0)) 4259 return 1; 4260 ]]) 4261 ],[ 4262 AC_MSG_RESULT([yes]) 4263 tst_compi_memrchr="yes" 4264 ],[ 4265 AC_MSG_RESULT([no]) 4266 tst_compi_memrchr="no" 4267 ]) 4268 fi 4269 # 4270 if test "$tst_compi_memrchr" = "yes"; then 4271 AC_MSG_CHECKING([if memrchr usage allowed]) 4272 if test "x$curl_disallow_memrchr" != "xyes"; then 4273 AC_MSG_RESULT([yes]) 4274 tst_allow_memrchr="yes" 4275 else 4276 AC_MSG_RESULT([no]) 4277 tst_allow_memrchr="no" 4278 fi 4279 fi 4280 # 4281 AC_MSG_CHECKING([if memrchr might be used]) 4282 if (test "$tst_proto_memrchr" = "yes" || 4283 test "$tst_macro_memrchr" = "yes") && 4284 test "$tst_compi_memrchr" = "yes" && 4285 test "$tst_allow_memrchr" = "yes"; then 4286 AC_MSG_RESULT([yes]) 4287 AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1, 4288 [Define to 1 if you have the memrchr function or macro.]) 4289 curl_cv_func_memrchr="yes" 4290 else 4291 AC_MSG_RESULT([no]) 4292 curl_cv_func_memrchr="no" 4293 fi 4294]) 4295 4296 4297dnl CURL_CHECK_FUNC_POLL 4298dnl ------------------------------------------------- 4299dnl Verify if poll is available, prototyped, can 4300dnl be compiled and seems to work. If all of these are 4301dnl true, and usage has not been previously disallowed 4302dnl with shell variable curl_disallow_poll, then 4303dnl HAVE_POLL will be defined. 4304 4305AC_DEFUN([CURL_CHECK_FUNC_POLL], [ 4306 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 4307 AC_REQUIRE([CURL_INCLUDES_POLL])dnl 4308 # 4309 tst_links_poll="unknown" 4310 tst_proto_poll="unknown" 4311 tst_compi_poll="unknown" 4312 tst_works_poll="unknown" 4313 tst_allow_poll="unknown" 4314 # 4315 case $host_os in 4316 darwin*|interix*) 4317 dnl poll() does not work on these platforms 4318 dnl Interix: "does provide poll(), but the implementing developer must 4319 dnl have been in a bad mood, because poll() only works on the /proc 4320 dnl filesystem here" 4321 dnl macOS: poll() first didn't exist, then was broken until fixed in 10.9 4322 dnl only to break again in 10.12. 4323 curl_disallow_poll="yes" 4324 tst_compi_poll="no" 4325 ;; 4326 esac 4327 # 4328 AC_MSG_CHECKING([if poll can be linked]) 4329 AC_LINK_IFELSE([ 4330 AC_LANG_PROGRAM([[ 4331 $curl_includes_poll 4332 ]],[[ 4333 if(0 != poll(0, 0, 0)) 4334 return 1; 4335 ]]) 4336 ],[ 4337 AC_MSG_RESULT([yes]) 4338 tst_links_poll="yes" 4339 ],[ 4340 AC_MSG_RESULT([no]) 4341 tst_links_poll="no" 4342 ]) 4343 # 4344 if test "$tst_links_poll" = "yes"; then 4345 AC_MSG_CHECKING([if poll is prototyped]) 4346 AC_EGREP_CPP([poll],[ 4347 $curl_includes_poll 4348 ],[ 4349 AC_MSG_RESULT([yes]) 4350 tst_proto_poll="yes" 4351 ],[ 4352 AC_MSG_RESULT([no]) 4353 tst_proto_poll="no" 4354 ]) 4355 fi 4356 # 4357 if test "$tst_proto_poll" = "yes"; then 4358 AC_MSG_CHECKING([if poll is compilable]) 4359 AC_COMPILE_IFELSE([ 4360 AC_LANG_PROGRAM([[ 4361 $curl_includes_poll 4362 ]],[[ 4363 if(0 != poll(0, 0, 0)) 4364 return 1; 4365 ]]) 4366 ],[ 4367 AC_MSG_RESULT([yes]) 4368 tst_compi_poll="yes" 4369 ],[ 4370 AC_MSG_RESULT([no]) 4371 tst_compi_poll="no" 4372 ]) 4373 fi 4374 # 4375 dnl only do runtime verification when not cross-compiling 4376 if test "x$cross_compiling" != "xyes" && 4377 test "$tst_compi_poll" = "yes"; then 4378 AC_MSG_CHECKING([if poll seems to work]) 4379 CURL_RUN_IFELSE([ 4380 AC_LANG_PROGRAM([[ 4381 $curl_includes_stdlib 4382 $curl_includes_poll 4383 $curl_includes_time 4384 ]],[[ 4385 /* detect the original poll() breakage */ 4386 if(0 != poll(0, 0, 10)) 4387 exit(1); /* fail */ 4388 else { 4389 /* detect the 10.12 poll() breakage */ 4390 struct timeval before, after; 4391 int rc; 4392 size_t us; 4393 4394 gettimeofday(&before, NULL); 4395 rc = poll(NULL, 0, 500); 4396 gettimeofday(&after, NULL); 4397 4398 us = (after.tv_sec - before.tv_sec) * 1000000 + 4399 (after.tv_usec - before.tv_usec); 4400 4401 if(us < 400000) 4402 exit(1); 4403 } 4404 ]]) 4405 ],[ 4406 AC_MSG_RESULT([yes]) 4407 tst_works_poll="yes" 4408 ],[ 4409 AC_MSG_RESULT([no]) 4410 tst_works_poll="no" 4411 ]) 4412 fi 4413 # 4414 if test "$tst_compi_poll" = "yes" && 4415 test "$tst_works_poll" != "no"; then 4416 AC_MSG_CHECKING([if poll usage allowed]) 4417 if test "x$curl_disallow_poll" != "xyes"; then 4418 AC_MSG_RESULT([yes]) 4419 tst_allow_poll="yes" 4420 else 4421 AC_MSG_RESULT([no]) 4422 tst_allow_poll="no" 4423 fi 4424 fi 4425 # 4426 AC_MSG_CHECKING([if poll might be used]) 4427 if test "$tst_links_poll" = "yes" && 4428 test "$tst_proto_poll" = "yes" && 4429 test "$tst_compi_poll" = "yes" && 4430 test "$tst_allow_poll" = "yes" && 4431 test "$tst_works_poll" != "no"; then 4432 AC_MSG_RESULT([yes]) 4433 AC_DEFINE_UNQUOTED(HAVE_POLL, 1, 4434 [Define to 1 if you have a working poll function.]) 4435 AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1, 4436 [If you have a fine poll]) 4437 curl_cv_func_poll="yes" 4438 else 4439 AC_MSG_RESULT([no]) 4440 curl_cv_func_poll="no" 4441 fi 4442]) 4443 4444 4445dnl CURL_CHECK_FUNC_REMOVEXATTR 4446dnl ------------------------------------------------- 4447dnl Verify if removexattr is available, prototyped, and 4448dnl can be compiled. If all of these are true, and 4449dnl usage has not been previously disallowed with 4450dnl shell variable curl_disallow_removexattr, then 4451dnl HAVE_REMOVEXATTR will be defined. 4452 4453AC_DEFUN([CURL_CHECK_FUNC_REMOVEXATTR], [ 4454 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 4455 # 4456 tst_links_removexattr="unknown" 4457 tst_proto_removexattr="unknown" 4458 tst_compi_removexattr="unknown" 4459 tst_allow_removexattr="unknown" 4460 tst_nargs_removexattr="unknown" 4461 # 4462 AC_MSG_CHECKING([if removexattr can be linked]) 4463 AC_LINK_IFELSE([ 4464 AC_LANG_FUNC_LINK_TRY([removexattr]) 4465 ],[ 4466 AC_MSG_RESULT([yes]) 4467 tst_links_removexattr="yes" 4468 ],[ 4469 AC_MSG_RESULT([no]) 4470 tst_links_removexattr="no" 4471 ]) 4472 # 4473 if test "$tst_links_removexattr" = "yes"; then 4474 AC_MSG_CHECKING([if removexattr is prototyped]) 4475 AC_EGREP_CPP([removexattr],[ 4476 $curl_includes_sys_xattr 4477 ],[ 4478 AC_MSG_RESULT([yes]) 4479 tst_proto_removexattr="yes" 4480 ],[ 4481 AC_MSG_RESULT([no]) 4482 tst_proto_removexattr="no" 4483 ]) 4484 fi 4485 # 4486 if test "$tst_proto_removexattr" = "yes"; then 4487 if test "$tst_nargs_removexattr" = "unknown"; then 4488 AC_MSG_CHECKING([if removexattr takes 2 args.]) 4489 AC_COMPILE_IFELSE([ 4490 AC_LANG_PROGRAM([[ 4491 $curl_includes_sys_xattr 4492 ]],[[ 4493 if(0 != removexattr(0, 0)) 4494 return 1; 4495 ]]) 4496 ],[ 4497 AC_MSG_RESULT([yes]) 4498 tst_compi_removexattr="yes" 4499 tst_nargs_removexattr="2" 4500 ],[ 4501 AC_MSG_RESULT([no]) 4502 tst_compi_removexattr="no" 4503 ]) 4504 fi 4505 if test "$tst_nargs_removexattr" = "unknown"; then 4506 AC_MSG_CHECKING([if removexattr takes 3 args.]) 4507 AC_COMPILE_IFELSE([ 4508 AC_LANG_PROGRAM([[ 4509 $curl_includes_sys_xattr 4510 ]],[[ 4511 if(0 != removexattr(0, 0, 0)) 4512 return 1; 4513 ]]) 4514 ],[ 4515 AC_MSG_RESULT([yes]) 4516 tst_compi_removexattr="yes" 4517 tst_nargs_removexattr="3" 4518 ],[ 4519 AC_MSG_RESULT([no]) 4520 tst_compi_removexattr="no" 4521 ]) 4522 fi 4523 AC_MSG_CHECKING([if removexattr is compilable]) 4524 if test "$tst_compi_removexattr" = "yes"; then 4525 AC_MSG_RESULT([yes]) 4526 else 4527 AC_MSG_RESULT([no]) 4528 fi 4529 fi 4530 # 4531 if test "$tst_compi_removexattr" = "yes"; then 4532 AC_MSG_CHECKING([if removexattr usage allowed]) 4533 if test "x$curl_disallow_removexattr" != "xyes"; then 4534 AC_MSG_RESULT([yes]) 4535 tst_allow_removexattr="yes" 4536 else 4537 AC_MSG_RESULT([no]) 4538 tst_allow_removexattr="no" 4539 fi 4540 fi 4541 # 4542 AC_MSG_CHECKING([if removexattr might be used]) 4543 if test "$tst_links_removexattr" = "yes" && 4544 test "$tst_proto_removexattr" = "yes" && 4545 test "$tst_compi_removexattr" = "yes" && 4546 test "$tst_allow_removexattr" = "yes"; then 4547 AC_MSG_RESULT([yes]) 4548 AC_DEFINE_UNQUOTED(HAVE_REMOVEXATTR, 1, 4549 [Define to 1 if you have the removexattr function.]) 4550 dnl AC_DEFINE_UNQUOTED(REMOVEXATTR_ARGS, $tst_nargs_removexattr, 4551 dnl [Specifies the number of arguments to removexattr]) 4552 # 4553 if test "$tst_nargs_removexattr" -eq "2"; then 4554 AC_DEFINE(HAVE_REMOVEXATTR_2, 1, [removexattr() takes 2 args]) 4555 elif test "$tst_nargs_removexattr" -eq "3"; then 4556 AC_DEFINE(HAVE_REMOVEXATTR_3, 1, [removexattr() takes 3 args]) 4557 fi 4558 # 4559 curl_cv_func_removexattr="yes" 4560 else 4561 AC_MSG_RESULT([no]) 4562 curl_cv_func_removexattr="no" 4563 fi 4564]) 4565 4566 4567dnl CURL_CHECK_FUNC_SETSOCKOPT 4568dnl ------------------------------------------------- 4569dnl Verify if setsockopt is available, prototyped, and 4570dnl can be compiled. If all of these are true, and 4571dnl usage has not been previously disallowed with 4572dnl shell variable curl_disallow_setsockopt, then 4573dnl HAVE_SETSOCKOPT will be defined. 4574 4575AC_DEFUN([CURL_CHECK_FUNC_SETSOCKOPT], [ 4576 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 4577 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 4578 # 4579 tst_links_setsockopt="unknown" 4580 tst_proto_setsockopt="unknown" 4581 tst_compi_setsockopt="unknown" 4582 tst_allow_setsockopt="unknown" 4583 # 4584 AC_MSG_CHECKING([if setsockopt can be linked]) 4585 AC_LINK_IFELSE([ 4586 AC_LANG_PROGRAM([[ 4587 $curl_includes_winsock2 4588 $curl_includes_bsdsocket 4589 $curl_includes_sys_socket 4590 ]],[[ 4591 if(0 != setsockopt(0, 0, 0, 0, 0)) 4592 return 1; 4593 ]]) 4594 ],[ 4595 AC_MSG_RESULT([yes]) 4596 tst_links_setsockopt="yes" 4597 ],[ 4598 AC_MSG_RESULT([no]) 4599 tst_links_setsockopt="no" 4600 ]) 4601 # 4602 if test "$tst_links_setsockopt" = "yes"; then 4603 AC_MSG_CHECKING([if setsockopt is prototyped]) 4604 AC_EGREP_CPP([setsockopt],[ 4605 $curl_includes_winsock2 4606 $curl_includes_bsdsocket 4607 $curl_includes_sys_socket 4608 ],[ 4609 AC_MSG_RESULT([yes]) 4610 tst_proto_setsockopt="yes" 4611 ],[ 4612 AC_MSG_RESULT([no]) 4613 tst_proto_setsockopt="no" 4614 ]) 4615 fi 4616 # 4617 if test "$tst_proto_setsockopt" = "yes"; then 4618 AC_MSG_CHECKING([if setsockopt is compilable]) 4619 AC_COMPILE_IFELSE([ 4620 AC_LANG_PROGRAM([[ 4621 $curl_includes_winsock2 4622 $curl_includes_bsdsocket 4623 $curl_includes_sys_socket 4624 ]],[[ 4625 if(0 != setsockopt(0, 0, 0, 0, 0)) 4626 return 1; 4627 ]]) 4628 ],[ 4629 AC_MSG_RESULT([yes]) 4630 tst_compi_setsockopt="yes" 4631 ],[ 4632 AC_MSG_RESULT([no]) 4633 tst_compi_setsockopt="no" 4634 ]) 4635 fi 4636 # 4637 if test "$tst_compi_setsockopt" = "yes"; then 4638 AC_MSG_CHECKING([if setsockopt usage allowed]) 4639 if test "x$curl_disallow_setsockopt" != "xyes"; then 4640 AC_MSG_RESULT([yes]) 4641 tst_allow_setsockopt="yes" 4642 else 4643 AC_MSG_RESULT([no]) 4644 tst_allow_setsockopt="no" 4645 fi 4646 fi 4647 # 4648 AC_MSG_CHECKING([if setsockopt might be used]) 4649 if test "$tst_links_setsockopt" = "yes" && 4650 test "$tst_proto_setsockopt" = "yes" && 4651 test "$tst_compi_setsockopt" = "yes" && 4652 test "$tst_allow_setsockopt" = "yes"; then 4653 AC_MSG_RESULT([yes]) 4654 AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT, 1, 4655 [Define to 1 if you have the setsockopt function.]) 4656 curl_cv_func_setsockopt="yes" 4657 CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK 4658 else 4659 AC_MSG_RESULT([no]) 4660 curl_cv_func_setsockopt="no" 4661 fi 4662]) 4663 4664 4665dnl CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK 4666dnl ------------------------------------------------- 4667dnl Verify if setsockopt with the SO_NONBLOCK command is 4668dnl available, can be compiled, and seems to work. If 4669dnl all of these are true, then HAVE_SETSOCKOPT_SO_NONBLOCK 4670dnl will be defined. 4671 4672AC_DEFUN([CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK], [ 4673 # 4674 tst_compi_setsockopt_so_nonblock="unknown" 4675 tst_allow_setsockopt_so_nonblock="unknown" 4676 # 4677 if test "$curl_cv_func_setsockopt" = "yes"; then 4678 AC_MSG_CHECKING([if setsockopt SO_NONBLOCK is compilable]) 4679 AC_COMPILE_IFELSE([ 4680 AC_LANG_PROGRAM([[ 4681 $curl_includes_winsock2 4682 $curl_includes_bsdsocket 4683 $curl_includes_sys_socket 4684 ]],[[ 4685 if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) 4686 return 1; 4687 ]]) 4688 ],[ 4689 AC_MSG_RESULT([yes]) 4690 tst_compi_setsockopt_so_nonblock="yes" 4691 ],[ 4692 AC_MSG_RESULT([no]) 4693 tst_compi_setsockopt_so_nonblock="no" 4694 ]) 4695 fi 4696 # 4697 if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then 4698 AC_MSG_CHECKING([if setsockopt SO_NONBLOCK usage allowed]) 4699 if test "x$curl_disallow_setsockopt_so_nonblock" != "xyes"; then 4700 AC_MSG_RESULT([yes]) 4701 tst_allow_setsockopt_so_nonblock="yes" 4702 else 4703 AC_MSG_RESULT([no]) 4704 tst_allow_setsockopt_so_nonblock="no" 4705 fi 4706 fi 4707 # 4708 AC_MSG_CHECKING([if setsockopt SO_NONBLOCK might be used]) 4709 if test "$tst_compi_setsockopt_so_nonblock" = "yes" && 4710 test "$tst_allow_setsockopt_so_nonblock" = "yes"; then 4711 AC_MSG_RESULT([yes]) 4712 AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT_SO_NONBLOCK, 1, 4713 [Define to 1 if you have a working setsockopt SO_NONBLOCK function.]) 4714 curl_cv_func_setsockopt_so_nonblock="yes" 4715 else 4716 AC_MSG_RESULT([no]) 4717 curl_cv_func_setsockopt_so_nonblock="no" 4718 fi 4719]) 4720 4721 4722dnl CURL_CHECK_FUNC_SETXATTR 4723dnl ------------------------------------------------- 4724dnl Verify if setxattr is available, prototyped, and 4725dnl can be compiled. If all of these are true, and 4726dnl usage has not been previously disallowed with 4727dnl shell variable curl_disallow_setxattr, then 4728dnl HAVE_SETXATTR will be defined. 4729 4730AC_DEFUN([CURL_CHECK_FUNC_SETXATTR], [ 4731 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 4732 # 4733 tst_links_setxattr="unknown" 4734 tst_proto_setxattr="unknown" 4735 tst_compi_setxattr="unknown" 4736 tst_allow_setxattr="unknown" 4737 tst_nargs_setxattr="unknown" 4738 # 4739 AC_MSG_CHECKING([if setxattr can be linked]) 4740 AC_LINK_IFELSE([ 4741 AC_LANG_FUNC_LINK_TRY([setxattr]) 4742 ],[ 4743 AC_MSG_RESULT([yes]) 4744 tst_links_setxattr="yes" 4745 ],[ 4746 AC_MSG_RESULT([no]) 4747 tst_links_setxattr="no" 4748 ]) 4749 # 4750 if test "$tst_links_setxattr" = "yes"; then 4751 AC_MSG_CHECKING([if setxattr is prototyped]) 4752 AC_EGREP_CPP([setxattr],[ 4753 $curl_includes_sys_xattr 4754 ],[ 4755 AC_MSG_RESULT([yes]) 4756 tst_proto_setxattr="yes" 4757 ],[ 4758 AC_MSG_RESULT([no]) 4759 tst_proto_setxattr="no" 4760 ]) 4761 fi 4762 # 4763 if test "$tst_proto_setxattr" = "yes"; then 4764 if test "$tst_nargs_setxattr" = "unknown"; then 4765 AC_MSG_CHECKING([if setxattr takes 5 args.]) 4766 AC_COMPILE_IFELSE([ 4767 AC_LANG_PROGRAM([[ 4768 $curl_includes_sys_xattr 4769 ]],[[ 4770 if(0 != setxattr(0, 0, 0, 0, 0)) 4771 return 1; 4772 ]]) 4773 ],[ 4774 AC_MSG_RESULT([yes]) 4775 tst_compi_setxattr="yes" 4776 tst_nargs_setxattr="5" 4777 ],[ 4778 AC_MSG_RESULT([no]) 4779 tst_compi_setxattr="no" 4780 ]) 4781 fi 4782 if test "$tst_nargs_setxattr" = "unknown"; then 4783 AC_MSG_CHECKING([if setxattr takes 6 args.]) 4784 AC_COMPILE_IFELSE([ 4785 AC_LANG_PROGRAM([[ 4786 $curl_includes_sys_xattr 4787 ]],[[ 4788 if(0 != setxattr(0, 0, 0, 0, 0, 0)) 4789 return 1; 4790 ]]) 4791 ],[ 4792 AC_MSG_RESULT([yes]) 4793 tst_compi_setxattr="yes" 4794 tst_nargs_setxattr="6" 4795 ],[ 4796 AC_MSG_RESULT([no]) 4797 tst_compi_setxattr="no" 4798 ]) 4799 fi 4800 AC_MSG_CHECKING([if setxattr is compilable]) 4801 if test "$tst_compi_setxattr" = "yes"; then 4802 AC_MSG_RESULT([yes]) 4803 else 4804 AC_MSG_RESULT([no]) 4805 fi 4806 fi 4807 # 4808 if test "$tst_compi_setxattr" = "yes"; then 4809 AC_MSG_CHECKING([if setxattr usage allowed]) 4810 if test "x$curl_disallow_setxattr" != "xyes"; then 4811 AC_MSG_RESULT([yes]) 4812 tst_allow_setxattr="yes" 4813 else 4814 AC_MSG_RESULT([no]) 4815 tst_allow_setxattr="no" 4816 fi 4817 fi 4818 # 4819 AC_MSG_CHECKING([if setxattr might be used]) 4820 if test "$tst_links_setxattr" = "yes" && 4821 test "$tst_proto_setxattr" = "yes" && 4822 test "$tst_compi_setxattr" = "yes" && 4823 test "$tst_allow_setxattr" = "yes"; then 4824 AC_MSG_RESULT([yes]) 4825 AC_DEFINE_UNQUOTED(HAVE_SETXATTR, 1, 4826 [Define to 1 if you have the setxattr function.]) 4827 dnl AC_DEFINE_UNQUOTED(SETXATTR_ARGS, $tst_nargs_setxattr, 4828 dnl [Specifies the number of arguments to setxattr]) 4829 # 4830 if test "$tst_nargs_setxattr" -eq "5"; then 4831 AC_DEFINE(HAVE_SETXATTR_5, 1, [setxattr() takes 5 args]) 4832 elif test "$tst_nargs_setxattr" -eq "6"; then 4833 AC_DEFINE(HAVE_SETXATTR_6, 1, [setxattr() takes 6 args]) 4834 fi 4835 # 4836 curl_cv_func_setxattr="yes" 4837 else 4838 AC_MSG_RESULT([no]) 4839 curl_cv_func_setxattr="no" 4840 fi 4841]) 4842 4843 4844dnl CURL_CHECK_FUNC_SIGACTION 4845dnl ------------------------------------------------- 4846dnl Verify if sigaction is available, prototyped, and 4847dnl can be compiled. If all of these are true, and 4848dnl usage has not been previously disallowed with 4849dnl shell variable curl_disallow_sigaction, then 4850dnl HAVE_SIGACTION will be defined. 4851 4852AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [ 4853 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 4854 # 4855 tst_links_sigaction="unknown" 4856 tst_proto_sigaction="unknown" 4857 tst_compi_sigaction="unknown" 4858 tst_allow_sigaction="unknown" 4859 # 4860 AC_MSG_CHECKING([if sigaction can be linked]) 4861 AC_LINK_IFELSE([ 4862 AC_LANG_FUNC_LINK_TRY([sigaction]) 4863 ],[ 4864 AC_MSG_RESULT([yes]) 4865 tst_links_sigaction="yes" 4866 ],[ 4867 AC_MSG_RESULT([no]) 4868 tst_links_sigaction="no" 4869 ]) 4870 # 4871 if test "$tst_links_sigaction" = "yes"; then 4872 AC_MSG_CHECKING([if sigaction is prototyped]) 4873 AC_EGREP_CPP([sigaction],[ 4874 $curl_includes_signal 4875 ],[ 4876 AC_MSG_RESULT([yes]) 4877 tst_proto_sigaction="yes" 4878 ],[ 4879 AC_MSG_RESULT([no]) 4880 tst_proto_sigaction="no" 4881 ]) 4882 fi 4883 # 4884 if test "$tst_proto_sigaction" = "yes"; then 4885 AC_MSG_CHECKING([if sigaction is compilable]) 4886 AC_COMPILE_IFELSE([ 4887 AC_LANG_PROGRAM([[ 4888 $curl_includes_signal 4889 ]],[[ 4890 if(0 != sigaction(0, 0, 0)) 4891 return 1; 4892 ]]) 4893 ],[ 4894 AC_MSG_RESULT([yes]) 4895 tst_compi_sigaction="yes" 4896 ],[ 4897 AC_MSG_RESULT([no]) 4898 tst_compi_sigaction="no" 4899 ]) 4900 fi 4901 # 4902 if test "$tst_compi_sigaction" = "yes"; then 4903 AC_MSG_CHECKING([if sigaction usage allowed]) 4904 if test "x$curl_disallow_sigaction" != "xyes"; then 4905 AC_MSG_RESULT([yes]) 4906 tst_allow_sigaction="yes" 4907 else 4908 AC_MSG_RESULT([no]) 4909 tst_allow_sigaction="no" 4910 fi 4911 fi 4912 # 4913 AC_MSG_CHECKING([if sigaction might be used]) 4914 if test "$tst_links_sigaction" = "yes" && 4915 test "$tst_proto_sigaction" = "yes" && 4916 test "$tst_compi_sigaction" = "yes" && 4917 test "$tst_allow_sigaction" = "yes"; then 4918 AC_MSG_RESULT([yes]) 4919 AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1, 4920 [Define to 1 if you have the sigaction function.]) 4921 curl_cv_func_sigaction="yes" 4922 else 4923 AC_MSG_RESULT([no]) 4924 curl_cv_func_sigaction="no" 4925 fi 4926]) 4927 4928 4929dnl CURL_CHECK_FUNC_SIGINTERRUPT 4930dnl ------------------------------------------------- 4931dnl Verify if siginterrupt is available, prototyped, and 4932dnl can be compiled. If all of these are true, and 4933dnl usage has not been previously disallowed with 4934dnl shell variable curl_disallow_siginterrupt, then 4935dnl HAVE_SIGINTERRUPT will be defined. 4936 4937AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [ 4938 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 4939 # 4940 tst_links_siginterrupt="unknown" 4941 tst_proto_siginterrupt="unknown" 4942 tst_compi_siginterrupt="unknown" 4943 tst_allow_siginterrupt="unknown" 4944 # 4945 AC_MSG_CHECKING([if siginterrupt can be linked]) 4946 AC_LINK_IFELSE([ 4947 AC_LANG_FUNC_LINK_TRY([siginterrupt]) 4948 ],[ 4949 AC_MSG_RESULT([yes]) 4950 tst_links_siginterrupt="yes" 4951 ],[ 4952 AC_MSG_RESULT([no]) 4953 tst_links_siginterrupt="no" 4954 ]) 4955 # 4956 if test "$tst_links_siginterrupt" = "yes"; then 4957 AC_MSG_CHECKING([if siginterrupt is prototyped]) 4958 AC_EGREP_CPP([siginterrupt],[ 4959 $curl_includes_signal 4960 ],[ 4961 AC_MSG_RESULT([yes]) 4962 tst_proto_siginterrupt="yes" 4963 ],[ 4964 AC_MSG_RESULT([no]) 4965 tst_proto_siginterrupt="no" 4966 ]) 4967 fi 4968 # 4969 if test "$tst_proto_siginterrupt" = "yes"; then 4970 AC_MSG_CHECKING([if siginterrupt is compilable]) 4971 AC_COMPILE_IFELSE([ 4972 AC_LANG_PROGRAM([[ 4973 $curl_includes_signal 4974 ]],[[ 4975 if(0 != siginterrupt(0, 0)) 4976 return 1; 4977 ]]) 4978 ],[ 4979 AC_MSG_RESULT([yes]) 4980 tst_compi_siginterrupt="yes" 4981 ],[ 4982 AC_MSG_RESULT([no]) 4983 tst_compi_siginterrupt="no" 4984 ]) 4985 fi 4986 # 4987 if test "$tst_compi_siginterrupt" = "yes"; then 4988 AC_MSG_CHECKING([if siginterrupt usage allowed]) 4989 if test "x$curl_disallow_siginterrupt" != "xyes"; then 4990 AC_MSG_RESULT([yes]) 4991 tst_allow_siginterrupt="yes" 4992 else 4993 AC_MSG_RESULT([no]) 4994 tst_allow_siginterrupt="no" 4995 fi 4996 fi 4997 # 4998 AC_MSG_CHECKING([if siginterrupt might be used]) 4999 if test "$tst_links_siginterrupt" = "yes" && 5000 test "$tst_proto_siginterrupt" = "yes" && 5001 test "$tst_compi_siginterrupt" = "yes" && 5002 test "$tst_allow_siginterrupt" = "yes"; then 5003 AC_MSG_RESULT([yes]) 5004 AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1, 5005 [Define to 1 if you have the siginterrupt function.]) 5006 curl_cv_func_siginterrupt="yes" 5007 else 5008 AC_MSG_RESULT([no]) 5009 curl_cv_func_siginterrupt="no" 5010 fi 5011]) 5012 5013 5014dnl CURL_CHECK_FUNC_SIGNAL 5015dnl ------------------------------------------------- 5016dnl Verify if signal is available, prototyped, and 5017dnl can be compiled. If all of these are true, and 5018dnl usage has not been previously disallowed with 5019dnl shell variable curl_disallow_signal, then 5020dnl HAVE_SIGNAL will be defined. 5021 5022AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [ 5023 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 5024 # 5025 tst_links_signal="unknown" 5026 tst_proto_signal="unknown" 5027 tst_compi_signal="unknown" 5028 tst_allow_signal="unknown" 5029 # 5030 AC_MSG_CHECKING([if signal can be linked]) 5031 AC_LINK_IFELSE([ 5032 AC_LANG_FUNC_LINK_TRY([signal]) 5033 ],[ 5034 AC_MSG_RESULT([yes]) 5035 tst_links_signal="yes" 5036 ],[ 5037 AC_MSG_RESULT([no]) 5038 tst_links_signal="no" 5039 ]) 5040 # 5041 if test "$tst_links_signal" = "yes"; then 5042 AC_MSG_CHECKING([if signal is prototyped]) 5043 AC_EGREP_CPP([signal],[ 5044 $curl_includes_signal 5045 ],[ 5046 AC_MSG_RESULT([yes]) 5047 tst_proto_signal="yes" 5048 ],[ 5049 AC_MSG_RESULT([no]) 5050 tst_proto_signal="no" 5051 ]) 5052 fi 5053 # 5054 if test "$tst_proto_signal" = "yes"; then 5055 AC_MSG_CHECKING([if signal is compilable]) 5056 AC_COMPILE_IFELSE([ 5057 AC_LANG_PROGRAM([[ 5058 $curl_includes_signal 5059 ]],[[ 5060 if(0 != signal(0, 0)) 5061 return 1; 5062 ]]) 5063 ],[ 5064 AC_MSG_RESULT([yes]) 5065 tst_compi_signal="yes" 5066 ],[ 5067 AC_MSG_RESULT([no]) 5068 tst_compi_signal="no" 5069 ]) 5070 fi 5071 # 5072 if test "$tst_compi_signal" = "yes"; then 5073 AC_MSG_CHECKING([if signal usage allowed]) 5074 if test "x$curl_disallow_signal" != "xyes"; then 5075 AC_MSG_RESULT([yes]) 5076 tst_allow_signal="yes" 5077 else 5078 AC_MSG_RESULT([no]) 5079 tst_allow_signal="no" 5080 fi 5081 fi 5082 # 5083 AC_MSG_CHECKING([if signal might be used]) 5084 if test "$tst_links_signal" = "yes" && 5085 test "$tst_proto_signal" = "yes" && 5086 test "$tst_compi_signal" = "yes" && 5087 test "$tst_allow_signal" = "yes"; then 5088 AC_MSG_RESULT([yes]) 5089 AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1, 5090 [Define to 1 if you have the signal function.]) 5091 curl_cv_func_signal="yes" 5092 else 5093 AC_MSG_RESULT([no]) 5094 curl_cv_func_signal="no" 5095 fi 5096]) 5097 5098 5099dnl CURL_CHECK_FUNC_SIGSETJMP 5100dnl ------------------------------------------------- 5101dnl Verify if sigsetjmp is available, prototyped, and 5102dnl can be compiled. If all of these are true, and 5103dnl usage has not been previously disallowed with 5104dnl shell variable curl_disallow_sigsetjmp, then 5105dnl HAVE_SIGSETJMP will be defined. 5106 5107AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [ 5108 AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl 5109 # 5110 tst_links_sigsetjmp="unknown" 5111 tst_macro_sigsetjmp="unknown" 5112 tst_proto_sigsetjmp="unknown" 5113 tst_compi_sigsetjmp="unknown" 5114 tst_allow_sigsetjmp="unknown" 5115 # 5116 AC_MSG_CHECKING([if sigsetjmp can be linked]) 5117 AC_LINK_IFELSE([ 5118 AC_LANG_FUNC_LINK_TRY([sigsetjmp]) 5119 ],[ 5120 AC_MSG_RESULT([yes]) 5121 tst_links_sigsetjmp="yes" 5122 ],[ 5123 AC_MSG_RESULT([no]) 5124 tst_links_sigsetjmp="no" 5125 ]) 5126 # 5127 if test "$tst_links_sigsetjmp" = "no"; then 5128 AC_MSG_CHECKING([if sigsetjmp seems a macro]) 5129 AC_LINK_IFELSE([ 5130 AC_LANG_PROGRAM([[ 5131 $curl_includes_setjmp 5132 ]],[[ 5133 sigjmp_buf env; 5134 if(0 != sigsetjmp(env, 0)) 5135 return 1; 5136 ]]) 5137 ],[ 5138 AC_MSG_RESULT([yes]) 5139 tst_macro_sigsetjmp="yes" 5140 ],[ 5141 AC_MSG_RESULT([no]) 5142 tst_macro_sigsetjmp="no" 5143 ]) 5144 fi 5145 # 5146 if test "$tst_links_sigsetjmp" = "yes"; then 5147 AC_MSG_CHECKING([if sigsetjmp is prototyped]) 5148 AC_EGREP_CPP([sigsetjmp],[ 5149 $curl_includes_setjmp 5150 ],[ 5151 AC_MSG_RESULT([yes]) 5152 tst_proto_sigsetjmp="yes" 5153 ],[ 5154 AC_MSG_RESULT([no]) 5155 tst_proto_sigsetjmp="no" 5156 ]) 5157 fi 5158 # 5159 if test "$tst_proto_sigsetjmp" = "yes" || 5160 test "$tst_macro_sigsetjmp" = "yes"; then 5161 AC_MSG_CHECKING([if sigsetjmp is compilable]) 5162 AC_COMPILE_IFELSE([ 5163 AC_LANG_PROGRAM([[ 5164 $curl_includes_setjmp 5165 ]],[[ 5166 sigjmp_buf env; 5167 if(0 != sigsetjmp(env, 0)) 5168 return 1; 5169 ]]) 5170 ],[ 5171 AC_MSG_RESULT([yes]) 5172 tst_compi_sigsetjmp="yes" 5173 ],[ 5174 AC_MSG_RESULT([no]) 5175 tst_compi_sigsetjmp="no" 5176 ]) 5177 fi 5178 # 5179 if test "$tst_compi_sigsetjmp" = "yes"; then 5180 AC_MSG_CHECKING([if sigsetjmp usage allowed]) 5181 if test "x$curl_disallow_sigsetjmp" != "xyes"; then 5182 AC_MSG_RESULT([yes]) 5183 tst_allow_sigsetjmp="yes" 5184 else 5185 AC_MSG_RESULT([no]) 5186 tst_allow_sigsetjmp="no" 5187 fi 5188 fi 5189 # 5190 AC_MSG_CHECKING([if sigsetjmp might be used]) 5191 if (test "$tst_proto_sigsetjmp" = "yes" || 5192 test "$tst_macro_sigsetjmp" = "yes") && 5193 test "$tst_compi_sigsetjmp" = "yes" && 5194 test "$tst_allow_sigsetjmp" = "yes"; then 5195 AC_MSG_RESULT([yes]) 5196 AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1, 5197 [Define to 1 if you have the sigsetjmp function or macro.]) 5198 curl_cv_func_sigsetjmp="yes" 5199 else 5200 AC_MSG_RESULT([no]) 5201 curl_cv_func_sigsetjmp="no" 5202 fi 5203]) 5204 5205 5206dnl CURL_CHECK_FUNC_SOCKET 5207dnl ------------------------------------------------- 5208dnl Verify if socket is available, prototyped, and 5209dnl can be compiled. If all of these are true, and 5210dnl usage has not been previously disallowed with 5211dnl shell variable curl_disallow_socket, then 5212dnl HAVE_SOCKET will be defined. 5213 5214AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [ 5215 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 5216 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 5217 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl 5218 # 5219 tst_links_socket="unknown" 5220 tst_proto_socket="unknown" 5221 tst_compi_socket="unknown" 5222 tst_allow_socket="unknown" 5223 # 5224 AC_MSG_CHECKING([if socket can be linked]) 5225 AC_LINK_IFELSE([ 5226 AC_LANG_PROGRAM([[ 5227 $curl_includes_winsock2 5228 $curl_includes_bsdsocket 5229 $curl_includes_sys_socket 5230 $curl_includes_socket 5231 ]],[[ 5232 if(0 != socket(0, 0, 0)) 5233 return 1; 5234 ]]) 5235 ],[ 5236 AC_MSG_RESULT([yes]) 5237 tst_links_socket="yes" 5238 ],[ 5239 AC_MSG_RESULT([no]) 5240 tst_links_socket="no" 5241 ]) 5242 # 5243 if test "$tst_links_socket" = "yes"; then 5244 AC_MSG_CHECKING([if socket is prototyped]) 5245 AC_EGREP_CPP([socket],[ 5246 $curl_includes_winsock2 5247 $curl_includes_bsdsocket 5248 $curl_includes_sys_socket 5249 $curl_includes_socket 5250 ],[ 5251 AC_MSG_RESULT([yes]) 5252 tst_proto_socket="yes" 5253 ],[ 5254 AC_MSG_RESULT([no]) 5255 tst_proto_socket="no" 5256 ]) 5257 fi 5258 # 5259 if test "$tst_proto_socket" = "yes"; then 5260 AC_MSG_CHECKING([if socket is compilable]) 5261 AC_COMPILE_IFELSE([ 5262 AC_LANG_PROGRAM([[ 5263 $curl_includes_winsock2 5264 $curl_includes_bsdsocket 5265 $curl_includes_sys_socket 5266 $curl_includes_socket 5267 ]],[[ 5268 if(0 != socket(0, 0, 0)) 5269 return 1; 5270 ]]) 5271 ],[ 5272 AC_MSG_RESULT([yes]) 5273 tst_compi_socket="yes" 5274 ],[ 5275 AC_MSG_RESULT([no]) 5276 tst_compi_socket="no" 5277 ]) 5278 fi 5279 # 5280 if test "$tst_compi_socket" = "yes"; then 5281 AC_MSG_CHECKING([if socket usage allowed]) 5282 if test "x$curl_disallow_socket" != "xyes"; then 5283 AC_MSG_RESULT([yes]) 5284 tst_allow_socket="yes" 5285 else 5286 AC_MSG_RESULT([no]) 5287 tst_allow_socket="no" 5288 fi 5289 fi 5290 # 5291 AC_MSG_CHECKING([if socket might be used]) 5292 if test "$tst_links_socket" = "yes" && 5293 test "$tst_proto_socket" = "yes" && 5294 test "$tst_compi_socket" = "yes" && 5295 test "$tst_allow_socket" = "yes"; then 5296 AC_MSG_RESULT([yes]) 5297 AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1, 5298 [Define to 1 if you have the socket function.]) 5299 curl_cv_func_socket="yes" 5300 else 5301 AC_MSG_RESULT([no]) 5302 curl_cv_func_socket="no" 5303 fi 5304]) 5305 5306 5307dnl CURL_CHECK_FUNC_SOCKETPAIR 5308dnl ------------------------------------------------- 5309dnl Verify if socketpair is available, prototyped, and 5310dnl can be compiled. If all of these are true, and 5311dnl usage has not been previously disallowed with 5312dnl shell variable curl_disallow_socketpair, then 5313dnl HAVE_SOCKETPAIR will be defined. 5314 5315AC_DEFUN([CURL_CHECK_FUNC_SOCKETPAIR], [ 5316 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 5317 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl 5318 # 5319 tst_links_socketpair="unknown" 5320 tst_proto_socketpair="unknown" 5321 tst_compi_socketpair="unknown" 5322 tst_allow_socketpair="unknown" 5323 # 5324 AC_MSG_CHECKING([if socketpair can be linked]) 5325 AC_LINK_IFELSE([ 5326 AC_LANG_FUNC_LINK_TRY([socketpair]) 5327 ],[ 5328 AC_MSG_RESULT([yes]) 5329 tst_links_socketpair="yes" 5330 ],[ 5331 AC_MSG_RESULT([no]) 5332 tst_links_socketpair="no" 5333 ]) 5334 # 5335 if test "$tst_links_socketpair" = "yes"; then 5336 AC_MSG_CHECKING([if socketpair is prototyped]) 5337 AC_EGREP_CPP([socketpair],[ 5338 $curl_includes_sys_socket 5339 $curl_includes_socket 5340 ],[ 5341 AC_MSG_RESULT([yes]) 5342 tst_proto_socketpair="yes" 5343 ],[ 5344 AC_MSG_RESULT([no]) 5345 tst_proto_socketpair="no" 5346 ]) 5347 fi 5348 # 5349 if test "$tst_proto_socketpair" = "yes"; then 5350 AC_MSG_CHECKING([if socketpair is compilable]) 5351 AC_COMPILE_IFELSE([ 5352 AC_LANG_PROGRAM([[ 5353 $curl_includes_sys_socket 5354 $curl_includes_socket 5355 ]],[[ 5356 int sv[2]; 5357 if(0 != socketpair(0, 0, 0, sv)) 5358 return 1; 5359 ]]) 5360 ],[ 5361 AC_MSG_RESULT([yes]) 5362 tst_compi_socketpair="yes" 5363 ],[ 5364 AC_MSG_RESULT([no]) 5365 tst_compi_socketpair="no" 5366 ]) 5367 fi 5368 # 5369 if test "$tst_compi_socketpair" = "yes"; then 5370 AC_MSG_CHECKING([if socketpair usage allowed]) 5371 if test "x$curl_disallow_socketpair" != "xyes"; then 5372 AC_MSG_RESULT([yes]) 5373 tst_allow_socketpair="yes" 5374 else 5375 AC_MSG_RESULT([no]) 5376 tst_allow_socketpair="no" 5377 fi 5378 fi 5379 # 5380 AC_MSG_CHECKING([if socketpair might be used]) 5381 if test "$tst_links_socketpair" = "yes" && 5382 test "$tst_proto_socketpair" = "yes" && 5383 test "$tst_compi_socketpair" = "yes" && 5384 test "$tst_allow_socketpair" = "yes"; then 5385 AC_MSG_RESULT([yes]) 5386 AC_DEFINE_UNQUOTED(HAVE_SOCKETPAIR, 1, 5387 [Define to 1 if you have the socketpair function.]) 5388 curl_cv_func_socketpair="yes" 5389 else 5390 AC_MSG_RESULT([no]) 5391 curl_cv_func_socketpair="no" 5392 fi 5393]) 5394 5395 5396dnl CURL_CHECK_FUNC_STRCASECMP 5397dnl ------------------------------------------------- 5398dnl Verify if strcasecmp is available, prototyped, and 5399dnl can be compiled. If all of these are true, and 5400dnl usage has not been previously disallowed with 5401dnl shell variable curl_disallow_strcasecmp, then 5402dnl HAVE_STRCASECMP will be defined. 5403 5404AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [ 5405 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 5406 # 5407 tst_links_strcasecmp="unknown" 5408 tst_proto_strcasecmp="unknown" 5409 tst_compi_strcasecmp="unknown" 5410 tst_allow_strcasecmp="unknown" 5411 # 5412 AC_MSG_CHECKING([if strcasecmp can be linked]) 5413 AC_LINK_IFELSE([ 5414 AC_LANG_FUNC_LINK_TRY([strcasecmp]) 5415 ],[ 5416 AC_MSG_RESULT([yes]) 5417 tst_links_strcasecmp="yes" 5418 ],[ 5419 AC_MSG_RESULT([no]) 5420 tst_links_strcasecmp="no" 5421 ]) 5422 # 5423 if test "$tst_links_strcasecmp" = "yes"; then 5424 AC_MSG_CHECKING([if strcasecmp is prototyped]) 5425 AC_EGREP_CPP([strcasecmp],[ 5426 $curl_includes_string 5427 ],[ 5428 AC_MSG_RESULT([yes]) 5429 tst_proto_strcasecmp="yes" 5430 ],[ 5431 AC_MSG_RESULT([no]) 5432 tst_proto_strcasecmp="no" 5433 ]) 5434 fi 5435 # 5436 if test "$tst_proto_strcasecmp" = "yes"; then 5437 AC_MSG_CHECKING([if strcasecmp is compilable]) 5438 AC_COMPILE_IFELSE([ 5439 AC_LANG_PROGRAM([[ 5440 $curl_includes_string 5441 ]],[[ 5442 if(0 != strcasecmp(0, 0)) 5443 return 1; 5444 ]]) 5445 ],[ 5446 AC_MSG_RESULT([yes]) 5447 tst_compi_strcasecmp="yes" 5448 ],[ 5449 AC_MSG_RESULT([no]) 5450 tst_compi_strcasecmp="no" 5451 ]) 5452 fi 5453 # 5454 if test "$tst_compi_strcasecmp" = "yes"; then 5455 AC_MSG_CHECKING([if strcasecmp usage allowed]) 5456 if test "x$curl_disallow_strcasecmp" != "xyes"; then 5457 AC_MSG_RESULT([yes]) 5458 tst_allow_strcasecmp="yes" 5459 else 5460 AC_MSG_RESULT([no]) 5461 tst_allow_strcasecmp="no" 5462 fi 5463 fi 5464 # 5465 AC_MSG_CHECKING([if strcasecmp might be used]) 5466 if test "$tst_links_strcasecmp" = "yes" && 5467 test "$tst_proto_strcasecmp" = "yes" && 5468 test "$tst_compi_strcasecmp" = "yes" && 5469 test "$tst_allow_strcasecmp" = "yes"; then 5470 AC_MSG_RESULT([yes]) 5471 AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1, 5472 [Define to 1 if you have the strcasecmp function.]) 5473 curl_cv_func_strcasecmp="yes" 5474 else 5475 AC_MSG_RESULT([no]) 5476 curl_cv_func_strcasecmp="no" 5477 fi 5478]) 5479 5480dnl CURL_CHECK_FUNC_STRCMPI 5481dnl ------------------------------------------------- 5482dnl Verify if strcmpi is available, prototyped, and 5483dnl can be compiled. If all of these are true, and 5484dnl usage has not been previously disallowed with 5485dnl shell variable curl_disallow_strcmpi, then 5486dnl HAVE_STRCMPI will be defined. 5487 5488AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [ 5489 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 5490 # 5491 tst_links_strcmpi="unknown" 5492 tst_proto_strcmpi="unknown" 5493 tst_compi_strcmpi="unknown" 5494 tst_allow_strcmpi="unknown" 5495 # 5496 AC_MSG_CHECKING([if strcmpi can be linked]) 5497 AC_LINK_IFELSE([ 5498 AC_LANG_FUNC_LINK_TRY([strcmpi]) 5499 ],[ 5500 AC_MSG_RESULT([yes]) 5501 tst_links_strcmpi="yes" 5502 ],[ 5503 AC_MSG_RESULT([no]) 5504 tst_links_strcmpi="no" 5505 ]) 5506 # 5507 if test "$tst_links_strcmpi" = "yes"; then 5508 AC_MSG_CHECKING([if strcmpi is prototyped]) 5509 AC_EGREP_CPP([strcmpi],[ 5510 $curl_includes_string 5511 ],[ 5512 AC_MSG_RESULT([yes]) 5513 tst_proto_strcmpi="yes" 5514 ],[ 5515 AC_MSG_RESULT([no]) 5516 tst_proto_strcmpi="no" 5517 ]) 5518 fi 5519 # 5520 if test "$tst_proto_strcmpi" = "yes"; then 5521 AC_MSG_CHECKING([if strcmpi is compilable]) 5522 AC_COMPILE_IFELSE([ 5523 AC_LANG_PROGRAM([[ 5524 $curl_includes_string 5525 ]],[[ 5526 if(0 != strcmpi(0, 0)) 5527 return 1; 5528 ]]) 5529 ],[ 5530 AC_MSG_RESULT([yes]) 5531 tst_compi_strcmpi="yes" 5532 ],[ 5533 AC_MSG_RESULT([no]) 5534 tst_compi_strcmpi="no" 5535 ]) 5536 fi 5537 # 5538 if test "$tst_compi_strcmpi" = "yes"; then 5539 AC_MSG_CHECKING([if strcmpi usage allowed]) 5540 if test "x$curl_disallow_strcmpi" != "xyes"; then 5541 AC_MSG_RESULT([yes]) 5542 tst_allow_strcmpi="yes" 5543 else 5544 AC_MSG_RESULT([no]) 5545 tst_allow_strcmpi="no" 5546 fi 5547 fi 5548 # 5549 AC_MSG_CHECKING([if strcmpi might be used]) 5550 if test "$tst_links_strcmpi" = "yes" && 5551 test "$tst_proto_strcmpi" = "yes" && 5552 test "$tst_compi_strcmpi" = "yes" && 5553 test "$tst_allow_strcmpi" = "yes"; then 5554 AC_MSG_RESULT([yes]) 5555 AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1, 5556 [Define to 1 if you have the strcmpi function.]) 5557 curl_cv_func_strcmpi="yes" 5558 else 5559 AC_MSG_RESULT([no]) 5560 curl_cv_func_strcmpi="no" 5561 fi 5562]) 5563 5564 5565dnl CURL_CHECK_FUNC_STRDUP 5566dnl ------------------------------------------------- 5567dnl Verify if strdup is available, prototyped, and 5568dnl can be compiled. If all of these are true, and 5569dnl usage has not been previously disallowed with 5570dnl shell variable curl_disallow_strdup, then 5571dnl HAVE_STRDUP will be defined. 5572 5573AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [ 5574 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 5575 # 5576 tst_links_strdup="unknown" 5577 tst_proto_strdup="unknown" 5578 tst_compi_strdup="unknown" 5579 tst_allow_strdup="unknown" 5580 # 5581 AC_MSG_CHECKING([if strdup can be linked]) 5582 AC_LINK_IFELSE([ 5583 AC_LANG_FUNC_LINK_TRY([strdup]) 5584 ],[ 5585 AC_MSG_RESULT([yes]) 5586 tst_links_strdup="yes" 5587 ],[ 5588 AC_MSG_RESULT([no]) 5589 tst_links_strdup="no" 5590 ]) 5591 # 5592 if test "$tst_links_strdup" = "yes"; then 5593 AC_MSG_CHECKING([if strdup is prototyped]) 5594 AC_EGREP_CPP([strdup],[ 5595 $curl_includes_string 5596 ],[ 5597 AC_MSG_RESULT([yes]) 5598 tst_proto_strdup="yes" 5599 ],[ 5600 AC_MSG_RESULT([no]) 5601 tst_proto_strdup="no" 5602 ]) 5603 fi 5604 # 5605 if test "$tst_proto_strdup" = "yes"; then 5606 AC_MSG_CHECKING([if strdup is compilable]) 5607 AC_COMPILE_IFELSE([ 5608 AC_LANG_PROGRAM([[ 5609 $curl_includes_string 5610 ]],[[ 5611 if(0 != strdup(0)) 5612 return 1; 5613 ]]) 5614 ],[ 5615 AC_MSG_RESULT([yes]) 5616 tst_compi_strdup="yes" 5617 ],[ 5618 AC_MSG_RESULT([no]) 5619 tst_compi_strdup="no" 5620 ]) 5621 fi 5622 # 5623 if test "$tst_compi_strdup" = "yes"; then 5624 AC_MSG_CHECKING([if strdup usage allowed]) 5625 if test "x$curl_disallow_strdup" != "xyes"; then 5626 AC_MSG_RESULT([yes]) 5627 tst_allow_strdup="yes" 5628 else 5629 AC_MSG_RESULT([no]) 5630 tst_allow_strdup="no" 5631 fi 5632 fi 5633 # 5634 AC_MSG_CHECKING([if strdup might be used]) 5635 if test "$tst_links_strdup" = "yes" && 5636 test "$tst_proto_strdup" = "yes" && 5637 test "$tst_compi_strdup" = "yes" && 5638 test "$tst_allow_strdup" = "yes"; then 5639 AC_MSG_RESULT([yes]) 5640 AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1, 5641 [Define to 1 if you have the strdup function.]) 5642 curl_cv_func_strdup="yes" 5643 else 5644 AC_MSG_RESULT([no]) 5645 curl_cv_func_strdup="no" 5646 fi 5647]) 5648 5649 5650dnl CURL_CHECK_FUNC_STRERROR_R 5651dnl ------------------------------------------------- 5652dnl Verify if strerror_r is available, prototyped, can be compiled and 5653dnl seems to work. If all of these are true, and usage has not been 5654dnl previously disallowed with shell variable curl_disallow_strerror_r, 5655dnl then HAVE_STRERROR_R and STRERROR_R_TYPE_ARG3 will be defined, as 5656dnl well as one of HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R. 5657dnl 5658dnl glibc-style strerror_r: 5659dnl 5660dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize); 5661dnl 5662dnl glibc-style strerror_r returns a pointer to the error string, 5663dnl and might use the provided workbuf as a scratch area if needed. A 5664dnl quick test on a few systems shows that it's usually not used at all. 5665dnl 5666dnl POSIX-style strerror_r: 5667dnl 5668dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize); 5669dnl 5670dnl POSIX-style strerror_r returns 0 upon successful completion and the 5671dnl error string in the provided resultbuf. 5672dnl 5673 5674AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [ 5675 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 5676 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 5677 # 5678 tst_links_strerror_r="unknown" 5679 tst_proto_strerror_r="unknown" 5680 tst_compi_strerror_r="unknown" 5681 tst_glibc_strerror_r="unknown" 5682 tst_posix_strerror_r="unknown" 5683 tst_allow_strerror_r="unknown" 5684 tst_works_glibc_strerror_r="unknown" 5685 tst_works_posix_strerror_r="unknown" 5686 tst_glibc_strerror_r_type_arg3="unknown" 5687 tst_posix_strerror_r_type_arg3="unknown" 5688 # 5689 AC_MSG_CHECKING([if strerror_r can be linked]) 5690 AC_LINK_IFELSE([ 5691 AC_LANG_FUNC_LINK_TRY([strerror_r]) 5692 ],[ 5693 AC_MSG_RESULT([yes]) 5694 tst_links_strerror_r="yes" 5695 ],[ 5696 AC_MSG_RESULT([no]) 5697 tst_links_strerror_r="no" 5698 ]) 5699 # 5700 if test "$tst_links_strerror_r" = "yes"; then 5701 AC_MSG_CHECKING([if strerror_r is prototyped]) 5702 AC_EGREP_CPP([strerror_r],[ 5703 $curl_includes_string 5704 ],[ 5705 AC_MSG_RESULT([yes]) 5706 tst_proto_strerror_r="yes" 5707 ],[ 5708 AC_MSG_RESULT([no]) 5709 tst_proto_strerror_r="no" 5710 ]) 5711 fi 5712 # 5713 if test "$tst_proto_strerror_r" = "yes"; then 5714 AC_MSG_CHECKING([if strerror_r is compilable]) 5715 AC_COMPILE_IFELSE([ 5716 AC_LANG_PROGRAM([[ 5717 $curl_includes_string 5718 ]],[[ 5719 if(0 != strerror_r(0, 0, 0)) 5720 return 1; 5721 ]]) 5722 ],[ 5723 AC_MSG_RESULT([yes]) 5724 tst_compi_strerror_r="yes" 5725 ],[ 5726 AC_MSG_RESULT([no]) 5727 tst_compi_strerror_r="no" 5728 ]) 5729 fi 5730 # 5731 if test "$tst_compi_strerror_r" = "yes"; then 5732 AC_MSG_CHECKING([if strerror_r is glibc like]) 5733 tst_glibc_strerror_r_type_arg3="unknown" 5734 for arg3 in 'size_t' 'int' 'unsigned int'; do 5735 if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then 5736 AC_COMPILE_IFELSE([ 5737 AC_LANG_PROGRAM([[ 5738 $curl_includes_string 5739 char *strerror_r(int errnum, char *workbuf, $arg3 bufsize); 5740 ]],[[ 5741 if(0 != strerror_r(0, 0, 0)) 5742 return 1; 5743 ]]) 5744 ],[ 5745 tst_glibc_strerror_r_type_arg3="$arg3" 5746 ]) 5747 fi 5748 done 5749 case "$tst_glibc_strerror_r_type_arg3" in 5750 unknown) 5751 AC_MSG_RESULT([no]) 5752 tst_glibc_strerror_r="no" 5753 ;; 5754 *) 5755 AC_MSG_RESULT([yes]) 5756 tst_glibc_strerror_r="yes" 5757 ;; 5758 esac 5759 fi 5760 # 5761 dnl only do runtime verification when not cross-compiling 5762 if test "x$cross_compiling" != "xyes" && 5763 test "$tst_glibc_strerror_r" = "yes"; then 5764 AC_MSG_CHECKING([if strerror_r seems to work]) 5765 CURL_RUN_IFELSE([ 5766 AC_LANG_PROGRAM([[ 5767 $curl_includes_stdlib 5768 $curl_includes_string 5769# include <errno.h> 5770 ]],[[ 5771 char buffer[1024]; 5772 char *string = 0; 5773 buffer[0] = '\0'; 5774 string = strerror_r(EACCES, buffer, sizeof(buffer)); 5775 if(!string) 5776 exit(1); /* fail */ 5777 if(!string[0]) 5778 exit(1); /* fail */ 5779 else 5780 exit(0); 5781 ]]) 5782 ],[ 5783 AC_MSG_RESULT([yes]) 5784 tst_works_glibc_strerror_r="yes" 5785 ],[ 5786 AC_MSG_RESULT([no]) 5787 tst_works_glibc_strerror_r="no" 5788 ]) 5789 fi 5790 # 5791 if test "$tst_compi_strerror_r" = "yes" && 5792 test "$tst_works_glibc_strerror_r" != "yes"; then 5793 AC_MSG_CHECKING([if strerror_r is POSIX like]) 5794 tst_posix_strerror_r_type_arg3="unknown" 5795 for arg3 in 'size_t' 'int' 'unsigned int'; do 5796 if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then 5797 AC_COMPILE_IFELSE([ 5798 AC_LANG_PROGRAM([[ 5799 $curl_includes_string 5800 int strerror_r(int errnum, char *resultbuf, $arg3 bufsize); 5801 ]],[[ 5802 if(0 != strerror_r(0, 0, 0)) 5803 return 1; 5804 ]]) 5805 ],[ 5806 tst_posix_strerror_r_type_arg3="$arg3" 5807 ]) 5808 fi 5809 done 5810 case "$tst_posix_strerror_r_type_arg3" in 5811 unknown) 5812 AC_MSG_RESULT([no]) 5813 tst_posix_strerror_r="no" 5814 ;; 5815 *) 5816 AC_MSG_RESULT([yes]) 5817 tst_posix_strerror_r="yes" 5818 ;; 5819 esac 5820 fi 5821 # 5822 dnl only do runtime verification when not cross-compiling 5823 if test "x$cross_compiling" != "xyes" && 5824 test "$tst_posix_strerror_r" = "yes"; then 5825 AC_MSG_CHECKING([if strerror_r seems to work]) 5826 CURL_RUN_IFELSE([ 5827 AC_LANG_PROGRAM([[ 5828 $curl_includes_stdlib 5829 $curl_includes_string 5830# include <errno.h> 5831 ]],[[ 5832 char buffer[1024]; 5833 int error = 1; 5834 buffer[0] = '\0'; 5835 error = strerror_r(EACCES, buffer, sizeof(buffer)); 5836 if(error) 5837 exit(1); /* fail */ 5838 if(buffer[0] == '\0') 5839 exit(1); /* fail */ 5840 else 5841 exit(0); 5842 ]]) 5843 ],[ 5844 AC_MSG_RESULT([yes]) 5845 tst_works_posix_strerror_r="yes" 5846 ],[ 5847 AC_MSG_RESULT([no]) 5848 tst_works_posix_strerror_r="no" 5849 ]) 5850 fi 5851 # 5852 if test "$tst_works_glibc_strerror_r" = "yes"; then 5853 tst_posix_strerror_r="no" 5854 fi 5855 if test "$tst_works_posix_strerror_r" = "yes"; then 5856 tst_glibc_strerror_r="no" 5857 fi 5858 if test "$tst_glibc_strerror_r" = "yes" && 5859 test "$tst_works_glibc_strerror_r" != "no" && 5860 test "$tst_posix_strerror_r" != "yes"; then 5861 tst_allow_strerror_r="check" 5862 fi 5863 if test "$tst_posix_strerror_r" = "yes" && 5864 test "$tst_works_posix_strerror_r" != "no" && 5865 test "$tst_glibc_strerror_r" != "yes"; then 5866 tst_allow_strerror_r="check" 5867 fi 5868 if test "$tst_allow_strerror_r" = "check"; then 5869 AC_MSG_CHECKING([if strerror_r usage allowed]) 5870 if test "x$curl_disallow_strerror_r" != "xyes"; then 5871 AC_MSG_RESULT([yes]) 5872 tst_allow_strerror_r="yes" 5873 else 5874 AC_MSG_RESULT([no]) 5875 tst_allow_strerror_r="no" 5876 fi 5877 fi 5878 # 5879 AC_MSG_CHECKING([if strerror_r might be used]) 5880 if test "$tst_links_strerror_r" = "yes" && 5881 test "$tst_proto_strerror_r" = "yes" && 5882 test "$tst_compi_strerror_r" = "yes" && 5883 test "$tst_allow_strerror_r" = "yes"; then 5884 AC_MSG_RESULT([yes]) 5885 if test "$tst_glibc_strerror_r" = "yes"; then 5886 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1, 5887 [Define to 1 if you have the strerror_r function.]) 5888 AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1, 5889 [Define to 1 if you have a working glibc-style strerror_r function.]) 5890 AC_DEFINE_UNQUOTED(STRERROR_R_TYPE_ARG3, $tst_glibc_strerror_r_type_arg3, 5891 [Define to the type of arg 3 for strerror_r.]) 5892 fi 5893 if test "$tst_posix_strerror_r" = "yes"; then 5894 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1, 5895 [Define to 1 if you have the strerror_r function.]) 5896 AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1, 5897 [Define to 1 if you have a working POSIX-style strerror_r function.]) 5898 AC_DEFINE_UNQUOTED(STRERROR_R_TYPE_ARG3, $tst_posix_strerror_r_type_arg3, 5899 [Define to the type of arg 3 for strerror_r.]) 5900 fi 5901 curl_cv_func_strerror_r="yes" 5902 else 5903 AC_MSG_RESULT([no]) 5904 curl_cv_func_strerror_r="no" 5905 fi 5906 # 5907 if test "$tst_compi_strerror_r" = "yes" && 5908 test "$tst_allow_strerror_r" = "unknown"; then 5909 AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.]) 5910 fi 5911 # 5912]) 5913 5914 5915dnl CURL_CHECK_FUNC_STRICMP 5916dnl ------------------------------------------------- 5917dnl Verify if stricmp is available, prototyped, and 5918dnl can be compiled. If all of these are true, and 5919dnl usage has not been previously disallowed with 5920dnl shell variable curl_disallow_stricmp, then 5921dnl HAVE_STRICMP will be defined. 5922 5923AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [ 5924 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 5925 # 5926 tst_links_stricmp="unknown" 5927 tst_proto_stricmp="unknown" 5928 tst_compi_stricmp="unknown" 5929 tst_allow_stricmp="unknown" 5930 # 5931 AC_MSG_CHECKING([if stricmp can be linked]) 5932 AC_LINK_IFELSE([ 5933 AC_LANG_FUNC_LINK_TRY([stricmp]) 5934 ],[ 5935 AC_MSG_RESULT([yes]) 5936 tst_links_stricmp="yes" 5937 ],[ 5938 AC_MSG_RESULT([no]) 5939 tst_links_stricmp="no" 5940 ]) 5941 # 5942 if test "$tst_links_stricmp" = "yes"; then 5943 AC_MSG_CHECKING([if stricmp is prototyped]) 5944 AC_EGREP_CPP([stricmp],[ 5945 $curl_includes_string 5946 ],[ 5947 AC_MSG_RESULT([yes]) 5948 tst_proto_stricmp="yes" 5949 ],[ 5950 AC_MSG_RESULT([no]) 5951 tst_proto_stricmp="no" 5952 ]) 5953 fi 5954 # 5955 if test "$tst_proto_stricmp" = "yes"; then 5956 AC_MSG_CHECKING([if stricmp is compilable]) 5957 AC_COMPILE_IFELSE([ 5958 AC_LANG_PROGRAM([[ 5959 $curl_includes_string 5960 ]],[[ 5961 if(0 != stricmp(0, 0)) 5962 return 1; 5963 ]]) 5964 ],[ 5965 AC_MSG_RESULT([yes]) 5966 tst_compi_stricmp="yes" 5967 ],[ 5968 AC_MSG_RESULT([no]) 5969 tst_compi_stricmp="no" 5970 ]) 5971 fi 5972 # 5973 if test "$tst_compi_stricmp" = "yes"; then 5974 AC_MSG_CHECKING([if stricmp usage allowed]) 5975 if test "x$curl_disallow_stricmp" != "xyes"; then 5976 AC_MSG_RESULT([yes]) 5977 tst_allow_stricmp="yes" 5978 else 5979 AC_MSG_RESULT([no]) 5980 tst_allow_stricmp="no" 5981 fi 5982 fi 5983 # 5984 AC_MSG_CHECKING([if stricmp might be used]) 5985 if test "$tst_links_stricmp" = "yes" && 5986 test "$tst_proto_stricmp" = "yes" && 5987 test "$tst_compi_stricmp" = "yes" && 5988 test "$tst_allow_stricmp" = "yes"; then 5989 AC_MSG_RESULT([yes]) 5990 AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1, 5991 [Define to 1 if you have the stricmp function.]) 5992 curl_cv_func_stricmp="yes" 5993 else 5994 AC_MSG_RESULT([no]) 5995 curl_cv_func_stricmp="no" 5996 fi 5997]) 5998 5999 6000dnl CURL_CHECK_FUNC_STRNCMPI 6001dnl ------------------------------------------------- 6002dnl Verify if strncmpi is available, prototyped, and 6003dnl can be compiled. If all of these are true, and 6004dnl usage has not been previously disallowed with 6005dnl shell variable curl_disallow_strncmpi, then 6006dnl HAVE_STRNCMPI will be defined. 6007 6008AC_DEFUN([CURL_CHECK_FUNC_STRNCMPI], [ 6009 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 6010 # 6011 tst_links_strncmpi="unknown" 6012 tst_proto_strncmpi="unknown" 6013 tst_compi_strncmpi="unknown" 6014 tst_allow_strncmpi="unknown" 6015 # 6016 AC_MSG_CHECKING([if strncmpi can be linked]) 6017 AC_LINK_IFELSE([ 6018 AC_LANG_FUNC_LINK_TRY([strncmpi]) 6019 ],[ 6020 AC_MSG_RESULT([yes]) 6021 tst_links_strncmpi="yes" 6022 ],[ 6023 AC_MSG_RESULT([no]) 6024 tst_links_strncmpi="no" 6025 ]) 6026 # 6027 if test "$tst_links_strncmpi" = "yes"; then 6028 AC_MSG_CHECKING([if strncmpi is prototyped]) 6029 AC_EGREP_CPP([strncmpi],[ 6030 $curl_includes_string 6031 ],[ 6032 AC_MSG_RESULT([yes]) 6033 tst_proto_strncmpi="yes" 6034 ],[ 6035 AC_MSG_RESULT([no]) 6036 tst_proto_strncmpi="no" 6037 ]) 6038 fi 6039 # 6040 if test "$tst_proto_strncmpi" = "yes"; then 6041 AC_MSG_CHECKING([if strncmpi is compilable]) 6042 AC_COMPILE_IFELSE([ 6043 AC_LANG_PROGRAM([[ 6044 $curl_includes_string 6045 ]],[[ 6046 if(0 != strncmpi(0, 0)) 6047 return 1; 6048 ]]) 6049 ],[ 6050 AC_MSG_RESULT([yes]) 6051 tst_compi_strncmpi="yes" 6052 ],[ 6053 AC_MSG_RESULT([no]) 6054 tst_compi_strncmpi="no" 6055 ]) 6056 fi 6057 # 6058 if test "$tst_compi_strncmpi" = "yes"; then 6059 AC_MSG_CHECKING([if strncmpi usage allowed]) 6060 if test "x$curl_disallow_strncmpi" != "xyes"; then 6061 AC_MSG_RESULT([yes]) 6062 tst_allow_strncmpi="yes" 6063 else 6064 AC_MSG_RESULT([no]) 6065 tst_allow_strncmpi="no" 6066 fi 6067 fi 6068 # 6069 AC_MSG_CHECKING([if strncmpi might be used]) 6070 if test "$tst_links_strncmpi" = "yes" && 6071 test "$tst_proto_strncmpi" = "yes" && 6072 test "$tst_compi_strncmpi" = "yes" && 6073 test "$tst_allow_strncmpi" = "yes"; then 6074 AC_MSG_RESULT([yes]) 6075 AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1, 6076 [Define to 1 if you have the strncmpi function.]) 6077 curl_cv_func_strncmpi="yes" 6078 else 6079 AC_MSG_RESULT([no]) 6080 curl_cv_func_strncmpi="no" 6081 fi 6082]) 6083 6084 6085dnl CURL_CHECK_FUNC_STRNICMP 6086dnl ------------------------------------------------- 6087dnl Verify if strnicmp is available, prototyped, and 6088dnl can be compiled. If all of these are true, and 6089dnl usage has not been previously disallowed with 6090dnl shell variable curl_disallow_strnicmp, then 6091dnl HAVE_STRNICMP will be defined. 6092 6093AC_DEFUN([CURL_CHECK_FUNC_STRNICMP], [ 6094 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 6095 # 6096 tst_links_strnicmp="unknown" 6097 tst_proto_strnicmp="unknown" 6098 tst_compi_strnicmp="unknown" 6099 tst_allow_strnicmp="unknown" 6100 # 6101 AC_MSG_CHECKING([if strnicmp can be linked]) 6102 AC_LINK_IFELSE([ 6103 AC_LANG_FUNC_LINK_TRY([strnicmp]) 6104 ],[ 6105 AC_MSG_RESULT([yes]) 6106 tst_links_strnicmp="yes" 6107 ],[ 6108 AC_MSG_RESULT([no]) 6109 tst_links_strnicmp="no" 6110 ]) 6111 # 6112 if test "$tst_links_strnicmp" = "yes"; then 6113 AC_MSG_CHECKING([if strnicmp is prototyped]) 6114 AC_EGREP_CPP([strnicmp],[ 6115 $curl_includes_string 6116 ],[ 6117 AC_MSG_RESULT([yes]) 6118 tst_proto_strnicmp="yes" 6119 ],[ 6120 AC_MSG_RESULT([no]) 6121 tst_proto_strnicmp="no" 6122 ]) 6123 fi 6124 # 6125 if test "$tst_proto_strnicmp" = "yes"; then 6126 AC_MSG_CHECKING([if strnicmp is compilable]) 6127 AC_COMPILE_IFELSE([ 6128 AC_LANG_PROGRAM([[ 6129 $curl_includes_string 6130 ]],[[ 6131 if(0 != strnicmp(0, 0)) 6132 return 1; 6133 ]]) 6134 ],[ 6135 AC_MSG_RESULT([yes]) 6136 tst_compi_strnicmp="yes" 6137 ],[ 6138 AC_MSG_RESULT([no]) 6139 tst_compi_strnicmp="no" 6140 ]) 6141 fi 6142 # 6143 if test "$tst_compi_strnicmp" = "yes"; then 6144 AC_MSG_CHECKING([if strnicmp usage allowed]) 6145 if test "x$curl_disallow_strnicmp" != "xyes"; then 6146 AC_MSG_RESULT([yes]) 6147 tst_allow_strnicmp="yes" 6148 else 6149 AC_MSG_RESULT([no]) 6150 tst_allow_strnicmp="no" 6151 fi 6152 fi 6153 # 6154 AC_MSG_CHECKING([if strnicmp might be used]) 6155 if test "$tst_links_strnicmp" = "yes" && 6156 test "$tst_proto_strnicmp" = "yes" && 6157 test "$tst_compi_strnicmp" = "yes" && 6158 test "$tst_allow_strnicmp" = "yes"; then 6159 AC_MSG_RESULT([yes]) 6160 AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1, 6161 [Define to 1 if you have the strnicmp function.]) 6162 curl_cv_func_strnicmp="yes" 6163 else 6164 AC_MSG_RESULT([no]) 6165 curl_cv_func_strnicmp="no" 6166 fi 6167]) 6168 6169 6170dnl CURL_CHECK_FUNC_STRSTR 6171dnl ------------------------------------------------- 6172dnl Verify if strstr is available, prototyped, and 6173dnl can be compiled. If all of these are true, and 6174dnl usage has not been previously disallowed with 6175dnl shell variable curl_disallow_strstr, then 6176dnl HAVE_STRSTR will be defined. 6177 6178AC_DEFUN([CURL_CHECK_FUNC_STRSTR], [ 6179 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 6180 # 6181 tst_links_strstr="unknown" 6182 tst_proto_strstr="unknown" 6183 tst_compi_strstr="unknown" 6184 tst_allow_strstr="unknown" 6185 # 6186 AC_MSG_CHECKING([if strstr can be linked]) 6187 AC_LINK_IFELSE([ 6188 AC_LANG_FUNC_LINK_TRY([strstr]) 6189 ],[ 6190 AC_MSG_RESULT([yes]) 6191 tst_links_strstr="yes" 6192 ],[ 6193 AC_MSG_RESULT([no]) 6194 tst_links_strstr="no" 6195 ]) 6196 # 6197 if test "$tst_links_strstr" = "yes"; then 6198 AC_MSG_CHECKING([if strstr is prototyped]) 6199 AC_EGREP_CPP([strstr],[ 6200 $curl_includes_string 6201 ],[ 6202 AC_MSG_RESULT([yes]) 6203 tst_proto_strstr="yes" 6204 ],[ 6205 AC_MSG_RESULT([no]) 6206 tst_proto_strstr="no" 6207 ]) 6208 fi 6209 # 6210 if test "$tst_proto_strstr" = "yes"; then 6211 AC_MSG_CHECKING([if strstr is compilable]) 6212 AC_COMPILE_IFELSE([ 6213 AC_LANG_PROGRAM([[ 6214 $curl_includes_string 6215 ]],[[ 6216 if(0 != strstr(0, 0)) 6217 return 1; 6218 ]]) 6219 ],[ 6220 AC_MSG_RESULT([yes]) 6221 tst_compi_strstr="yes" 6222 ],[ 6223 AC_MSG_RESULT([no]) 6224 tst_compi_strstr="no" 6225 ]) 6226 fi 6227 # 6228 if test "$tst_compi_strstr" = "yes"; then 6229 AC_MSG_CHECKING([if strstr usage allowed]) 6230 if test "x$curl_disallow_strstr" != "xyes"; then 6231 AC_MSG_RESULT([yes]) 6232 tst_allow_strstr="yes" 6233 else 6234 AC_MSG_RESULT([no]) 6235 tst_allow_strstr="no" 6236 fi 6237 fi 6238 # 6239 AC_MSG_CHECKING([if strstr might be used]) 6240 if test "$tst_links_strstr" = "yes" && 6241 test "$tst_proto_strstr" = "yes" && 6242 test "$tst_compi_strstr" = "yes" && 6243 test "$tst_allow_strstr" = "yes"; then 6244 AC_MSG_RESULT([yes]) 6245 AC_DEFINE_UNQUOTED(HAVE_STRSTR, 1, 6246 [Define to 1 if you have the strstr function.]) 6247 curl_cv_func_strstr="yes" 6248 else 6249 AC_MSG_RESULT([no]) 6250 curl_cv_func_strstr="no" 6251 fi 6252]) 6253 6254 6255dnl CURL_CHECK_FUNC_STRTOK_R 6256dnl ------------------------------------------------- 6257dnl Verify if strtok_r is available, prototyped, and 6258dnl can be compiled. If all of these are true, and 6259dnl usage has not been previously disallowed with 6260dnl shell variable curl_disallow_strtok_r, then 6261dnl HAVE_STRTOK_R will be defined. 6262 6263AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [ 6264 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 6265 # 6266 tst_links_strtok_r="unknown" 6267 tst_proto_strtok_r="unknown" 6268 tst_compi_strtok_r="unknown" 6269 tst_allow_strtok_r="unknown" 6270 # 6271 AC_MSG_CHECKING([if strtok_r can be linked]) 6272 AC_LINK_IFELSE([ 6273 AC_LANG_FUNC_LINK_TRY([strtok_r]) 6274 ],[ 6275 AC_MSG_RESULT([yes]) 6276 tst_links_strtok_r="yes" 6277 ],[ 6278 AC_MSG_RESULT([no]) 6279 tst_links_strtok_r="no" 6280 ]) 6281 # 6282 if test "$tst_links_strtok_r" = "yes"; then 6283 AC_MSG_CHECKING([if strtok_r is prototyped]) 6284 AC_EGREP_CPP([strtok_r],[ 6285 $curl_includes_string 6286 ],[ 6287 AC_MSG_RESULT([yes]) 6288 tst_proto_strtok_r="yes" 6289 ],[ 6290 AC_MSG_RESULT([no]) 6291 tst_proto_strtok_r="no" 6292 ]) 6293 fi 6294 # 6295 if test "$tst_proto_strtok_r" = "yes"; then 6296 AC_MSG_CHECKING([if strtok_r is compilable]) 6297 AC_COMPILE_IFELSE([ 6298 AC_LANG_PROGRAM([[ 6299 $curl_includes_string 6300 ]],[[ 6301 if(0 != strtok_r(0, 0, 0)) 6302 return 1; 6303 ]]) 6304 ],[ 6305 AC_MSG_RESULT([yes]) 6306 tst_compi_strtok_r="yes" 6307 ],[ 6308 AC_MSG_RESULT([no]) 6309 tst_compi_strtok_r="no" 6310 ]) 6311 fi 6312 # 6313 if test "$tst_compi_strtok_r" = "yes"; then 6314 AC_MSG_CHECKING([if strtok_r usage allowed]) 6315 if test "x$curl_disallow_strtok_r" != "xyes"; then 6316 AC_MSG_RESULT([yes]) 6317 tst_allow_strtok_r="yes" 6318 else 6319 AC_MSG_RESULT([no]) 6320 tst_allow_strtok_r="no" 6321 fi 6322 fi 6323 # 6324 AC_MSG_CHECKING([if strtok_r might be used]) 6325 if test "$tst_links_strtok_r" = "yes" && 6326 test "$tst_proto_strtok_r" = "yes" && 6327 test "$tst_compi_strtok_r" = "yes" && 6328 test "$tst_allow_strtok_r" = "yes"; then 6329 AC_MSG_RESULT([yes]) 6330 AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1, 6331 [Define to 1 if you have the strtok_r function.]) 6332 curl_cv_func_strtok_r="yes" 6333 else 6334 AC_MSG_RESULT([no]) 6335 curl_cv_func_strtok_r="no" 6336 fi 6337]) 6338 6339 6340dnl CURL_CHECK_FUNC_STRTOLL 6341dnl ------------------------------------------------- 6342dnl Verify if strtoll is available, prototyped, and 6343dnl can be compiled. If all of these are true, and 6344dnl usage has not been previously disallowed with 6345dnl shell variable curl_disallow_strtoll, then 6346dnl HAVE_STRTOLL will be defined. 6347 6348AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [ 6349 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 6350 # 6351 tst_links_strtoll="unknown" 6352 tst_proto_strtoll="unknown" 6353 tst_compi_strtoll="unknown" 6354 tst_allow_strtoll="unknown" 6355 # 6356 AC_MSG_CHECKING([if strtoll can be linked]) 6357 AC_LINK_IFELSE([ 6358 AC_LANG_FUNC_LINK_TRY([strtoll]) 6359 ],[ 6360 AC_MSG_RESULT([yes]) 6361 tst_links_strtoll="yes" 6362 ],[ 6363 AC_MSG_RESULT([no]) 6364 tst_links_strtoll="no" 6365 ]) 6366 # 6367 if test "$tst_links_strtoll" = "yes"; then 6368 AC_MSG_CHECKING([if strtoll is prototyped]) 6369 AC_EGREP_CPP([strtoll],[ 6370 $curl_includes_stdlib 6371 ],[ 6372 AC_MSG_RESULT([yes]) 6373 tst_proto_strtoll="yes" 6374 ],[ 6375 AC_MSG_RESULT([no]) 6376 tst_proto_strtoll="no" 6377 ]) 6378 fi 6379 # 6380 if test "$tst_proto_strtoll" = "yes"; then 6381 AC_MSG_CHECKING([if strtoll is compilable]) 6382 AC_COMPILE_IFELSE([ 6383 AC_LANG_PROGRAM([[ 6384 $curl_includes_stdlib 6385 ]],[[ 6386 if(0 != strtoll(0, 0, 0)) 6387 return 1; 6388 ]]) 6389 ],[ 6390 AC_MSG_RESULT([yes]) 6391 tst_compi_strtoll="yes" 6392 ],[ 6393 AC_MSG_RESULT([no]) 6394 tst_compi_strtoll="no" 6395 ]) 6396 fi 6397 # 6398 if test "$tst_compi_strtoll" = "yes"; then 6399 AC_MSG_CHECKING([if strtoll usage allowed]) 6400 if test "x$curl_disallow_strtoll" != "xyes"; then 6401 AC_MSG_RESULT([yes]) 6402 tst_allow_strtoll="yes" 6403 else 6404 AC_MSG_RESULT([no]) 6405 tst_allow_strtoll="no" 6406 fi 6407 fi 6408 # 6409 AC_MSG_CHECKING([if strtoll might be used]) 6410 if test "$tst_links_strtoll" = "yes" && 6411 test "$tst_proto_strtoll" = "yes" && 6412 test "$tst_compi_strtoll" = "yes" && 6413 test "$tst_allow_strtoll" = "yes"; then 6414 AC_MSG_RESULT([yes]) 6415 AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1, 6416 [Define to 1 if you have the strtoll function.]) 6417 curl_cv_func_strtoll="yes" 6418 else 6419 AC_MSG_RESULT([no]) 6420 curl_cv_func_strtoll="no" 6421 fi 6422]) 6423 6424 6425dnl CURL_CHECK_FUNC_WRITEV 6426dnl ------------------------------------------------- 6427dnl Verify if writev is available, prototyped, and 6428dnl can be compiled. If all of these are true, and 6429dnl usage has not been previously disallowed with 6430dnl shell variable curl_disallow_writev, then 6431dnl HAVE_WRITEV will be defined. 6432 6433AC_DEFUN([CURL_CHECK_FUNC_WRITEV], [ 6434 AC_REQUIRE([CURL_INCLUDES_SYS_UIO])dnl 6435 # 6436 tst_links_writev="unknown" 6437 tst_proto_writev="unknown" 6438 tst_compi_writev="unknown" 6439 tst_allow_writev="unknown" 6440 # 6441 AC_MSG_CHECKING([if writev can be linked]) 6442 AC_LINK_IFELSE([ 6443 AC_LANG_FUNC_LINK_TRY([writev]) 6444 ],[ 6445 AC_MSG_RESULT([yes]) 6446 tst_links_writev="yes" 6447 ],[ 6448 AC_MSG_RESULT([no]) 6449 tst_links_writev="no" 6450 ]) 6451 # 6452 if test "$tst_links_writev" = "yes"; then 6453 AC_MSG_CHECKING([if writev is prototyped]) 6454 AC_EGREP_CPP([writev],[ 6455 $curl_includes_sys_uio 6456 ],[ 6457 AC_MSG_RESULT([yes]) 6458 tst_proto_writev="yes" 6459 ],[ 6460 AC_MSG_RESULT([no]) 6461 tst_proto_writev="no" 6462 ]) 6463 fi 6464 # 6465 if test "$tst_proto_writev" = "yes"; then 6466 AC_MSG_CHECKING([if writev is compilable]) 6467 AC_COMPILE_IFELSE([ 6468 AC_LANG_PROGRAM([[ 6469 $curl_includes_sys_uio 6470 ]],[[ 6471 if(0 != writev(0, 0, 0)) 6472 return 1; 6473 ]]) 6474 ],[ 6475 AC_MSG_RESULT([yes]) 6476 tst_compi_writev="yes" 6477 ],[ 6478 AC_MSG_RESULT([no]) 6479 tst_compi_writev="no" 6480 ]) 6481 fi 6482 # 6483 if test "$tst_compi_writev" = "yes"; then 6484 AC_MSG_CHECKING([if writev usage allowed]) 6485 if test "x$curl_disallow_writev" != "xyes"; then 6486 AC_MSG_RESULT([yes]) 6487 tst_allow_writev="yes" 6488 else 6489 AC_MSG_RESULT([no]) 6490 tst_allow_writev="no" 6491 fi 6492 fi 6493 # 6494 AC_MSG_CHECKING([if writev might be used]) 6495 if test "$tst_links_writev" = "yes" && 6496 test "$tst_proto_writev" = "yes" && 6497 test "$tst_compi_writev" = "yes" && 6498 test "$tst_allow_writev" = "yes"; then 6499 AC_MSG_RESULT([yes]) 6500 AC_DEFINE_UNQUOTED(HAVE_WRITEV, 1, 6501 [Define to 1 if you have the writev function.]) 6502 curl_cv_func_writev="yes" 6503 else 6504 AC_MSG_RESULT([no]) 6505 curl_cv_func_writev="no" 6506 fi 6507]) 6508 6509dnl CURL_RUN_IFELSE 6510dnl ------------------------------------------------- 6511dnl Wrapper macro to use instead of AC_RUN_IFELSE. It 6512dnl sets LD_LIBRARY_PATH locally for this run only, from the 6513dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH 6514dnl changes contained within this macro. 6515 6516AC_DEFUN([CURL_RUN_IFELSE], [ 6517 old=$LD_LIBRARY_PATH 6518 LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old 6519 export LD_LIBRARY_PATH 6520 AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) 6521 LD_LIBRARY_PATH=$old # restore 6522]) 6523 6524dnl CURL_COVERAGE 6525dnl -------------------------------------------------- 6526dnl Switch on options and libs to build with gcc's code coverage. 6527dnl 6528 6529AC_DEFUN([CURL_COVERAGE],[ 6530 AC_REQUIRE([AC_PROG_SED]) 6531 AC_REQUIRE([AC_ARG_ENABLE]) 6532 AC_MSG_CHECKING([for code coverage support]) 6533 coverage="no" 6534 curl_coverage_msg="disabled" 6535 6536 dnl check if enabled by argument 6537 AC_ARG_ENABLE(code-coverage, 6538 AS_HELP_STRING([--enable-code-coverage], [Provide code coverage]), 6539 coverage="$enableval") 6540 6541 dnl if not gcc switch off again 6542 AS_IF([ test "$GCC" != "yes" ], coverage="no" ) 6543 AC_MSG_RESULT($coverage) 6544 6545 if test "x$coverage" = "xyes"; then 6546 curl_coverage_msg="enabled" 6547 6548 AC_CHECK_TOOL([GCOV], [gcov], [gcov]) 6549 if test -z "$GCOV"; then 6550 AC_MSG_ERROR([needs gcov for code coverage]) 6551 fi 6552 AC_CHECK_PROG([LCOV], [lcov], [lcov]) 6553 if test -z "$LCOV"; then 6554 AC_MSG_ERROR([needs lcov for code coverage]) 6555 fi 6556 6557 CPPFLAGS="$CPPFLAGS -DNDEBUG" 6558 CFLAGS="$CLAGS -O0 -g -fprofile-arcs -ftest-coverage" 6559 LIBS="$LIBS -lgcov" 6560 fi 6561]) 6562