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