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 1022 1023dnl CURL_CHECK_FUNC_FREEADDRINFO 1024dnl ------------------------------------------------- 1025dnl Verify if freeaddrinfo is available, prototyped, 1026dnl and can be compiled. If all of these are true, 1027dnl and usage has not been previously disallowed with 1028dnl shell variable curl_disallow_freeaddrinfo, then 1029dnl HAVE_FREEADDRINFO will be defined. 1030 1031AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [ 1032 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl 1033 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 1034 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 1035 # 1036 tst_links_freeaddrinfo="unknown" 1037 tst_proto_freeaddrinfo="unknown" 1038 tst_compi_freeaddrinfo="unknown" 1039 tst_allow_freeaddrinfo="unknown" 1040 # 1041 AC_MSG_CHECKING([if freeaddrinfo can be linked]) 1042 AC_LINK_IFELSE([ 1043 AC_LANG_PROGRAM([[ 1044 $curl_includes_ws2tcpip 1045 $curl_includes_sys_socket 1046 $curl_includes_netdb 1047 ]],[[ 1048 freeaddrinfo(0); 1049 ]]) 1050 ],[ 1051 AC_MSG_RESULT([yes]) 1052 tst_links_freeaddrinfo="yes" 1053 ],[ 1054 AC_MSG_RESULT([no]) 1055 tst_links_freeaddrinfo="no" 1056 ]) 1057 # 1058 if test "$tst_links_freeaddrinfo" = "yes"; then 1059 AC_MSG_CHECKING([if freeaddrinfo is prototyped]) 1060 AC_EGREP_CPP([freeaddrinfo],[ 1061 $curl_includes_ws2tcpip 1062 $curl_includes_sys_socket 1063 $curl_includes_netdb 1064 ],[ 1065 AC_MSG_RESULT([yes]) 1066 tst_proto_freeaddrinfo="yes" 1067 ],[ 1068 AC_MSG_RESULT([no]) 1069 tst_proto_freeaddrinfo="no" 1070 ]) 1071 fi 1072 # 1073 if test "$tst_proto_freeaddrinfo" = "yes"; then 1074 AC_MSG_CHECKING([if freeaddrinfo is compilable]) 1075 AC_COMPILE_IFELSE([ 1076 AC_LANG_PROGRAM([[ 1077 $curl_includes_ws2tcpip 1078 $curl_includes_sys_socket 1079 $curl_includes_netdb 1080 ]],[[ 1081 freeaddrinfo(0); 1082 ]]) 1083 ],[ 1084 AC_MSG_RESULT([yes]) 1085 tst_compi_freeaddrinfo="yes" 1086 ],[ 1087 AC_MSG_RESULT([no]) 1088 tst_compi_freeaddrinfo="no" 1089 ]) 1090 fi 1091 # 1092 if test "$tst_compi_freeaddrinfo" = "yes"; then 1093 AC_MSG_CHECKING([if freeaddrinfo usage allowed]) 1094 if test "x$curl_disallow_freeaddrinfo" != "xyes"; then 1095 AC_MSG_RESULT([yes]) 1096 tst_allow_freeaddrinfo="yes" 1097 else 1098 AC_MSG_RESULT([no]) 1099 tst_allow_freeaddrinfo="no" 1100 fi 1101 fi 1102 # 1103 AC_MSG_CHECKING([if freeaddrinfo might be used]) 1104 if test "$tst_links_freeaddrinfo" = "yes" && 1105 test "$tst_proto_freeaddrinfo" = "yes" && 1106 test "$tst_compi_freeaddrinfo" = "yes" && 1107 test "$tst_allow_freeaddrinfo" = "yes"; then 1108 AC_MSG_RESULT([yes]) 1109 AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1, 1110 [Define to 1 if you have the freeaddrinfo function.]) 1111 curl_cv_func_freeaddrinfo="yes" 1112 else 1113 AC_MSG_RESULT([no]) 1114 curl_cv_func_freeaddrinfo="no" 1115 fi 1116]) 1117 1118 1119dnl CURL_CHECK_FUNC_FSETXATTR 1120dnl ------------------------------------------------- 1121dnl Verify if fsetxattr is available, prototyped, and 1122dnl can be compiled. If all of these are true, and 1123dnl usage has not been previously disallowed with 1124dnl shell variable curl_disallow_fsetxattr, then 1125dnl HAVE_FSETXATTR will be defined. 1126 1127AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [ 1128 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 1129 # 1130 tst_links_fsetxattr="unknown" 1131 tst_proto_fsetxattr="unknown" 1132 tst_compi_fsetxattr="unknown" 1133 tst_allow_fsetxattr="unknown" 1134 tst_nargs_fsetxattr="unknown" 1135 # 1136 AC_MSG_CHECKING([if fsetxattr can be linked]) 1137 AC_LINK_IFELSE([ 1138 AC_LANG_FUNC_LINK_TRY([fsetxattr]) 1139 ],[ 1140 AC_MSG_RESULT([yes]) 1141 tst_links_fsetxattr="yes" 1142 ],[ 1143 AC_MSG_RESULT([no]) 1144 tst_links_fsetxattr="no" 1145 ]) 1146 # 1147 if test "$tst_links_fsetxattr" = "yes"; then 1148 AC_MSG_CHECKING([if fsetxattr is prototyped]) 1149 AC_EGREP_CPP([fsetxattr],[ 1150 $curl_includes_sys_xattr 1151 ],[ 1152 AC_MSG_RESULT([yes]) 1153 tst_proto_fsetxattr="yes" 1154 ],[ 1155 AC_MSG_RESULT([no]) 1156 tst_proto_fsetxattr="no" 1157 ]) 1158 fi 1159 # 1160 if test "$tst_proto_fsetxattr" = "yes"; then 1161 if test "$tst_nargs_fsetxattr" = "unknown"; then 1162 AC_MSG_CHECKING([if fsetxattr takes 5 args.]) 1163 AC_COMPILE_IFELSE([ 1164 AC_LANG_PROGRAM([[ 1165 $curl_includes_sys_xattr 1166 ]],[[ 1167 if(0 != fsetxattr(0, 0, 0, 0, 0)) 1168 return 1; 1169 ]]) 1170 ],[ 1171 AC_MSG_RESULT([yes]) 1172 tst_compi_fsetxattr="yes" 1173 tst_nargs_fsetxattr="5" 1174 ],[ 1175 AC_MSG_RESULT([no]) 1176 tst_compi_fsetxattr="no" 1177 ]) 1178 fi 1179 if test "$tst_nargs_fsetxattr" = "unknown"; then 1180 AC_MSG_CHECKING([if fsetxattr takes 6 args.]) 1181 AC_COMPILE_IFELSE([ 1182 AC_LANG_PROGRAM([[ 1183 $curl_includes_sys_xattr 1184 ]],[[ 1185 if(0 != fsetxattr(0, 0, 0, 0, 0, 0)) 1186 return 1; 1187 ]]) 1188 ],[ 1189 AC_MSG_RESULT([yes]) 1190 tst_compi_fsetxattr="yes" 1191 tst_nargs_fsetxattr="6" 1192 ],[ 1193 AC_MSG_RESULT([no]) 1194 tst_compi_fsetxattr="no" 1195 ]) 1196 fi 1197 AC_MSG_CHECKING([if fsetxattr is compilable]) 1198 if test "$tst_compi_fsetxattr" = "yes"; then 1199 AC_MSG_RESULT([yes]) 1200 else 1201 AC_MSG_RESULT([no]) 1202 fi 1203 fi 1204 # 1205 if test "$tst_compi_fsetxattr" = "yes"; then 1206 AC_MSG_CHECKING([if fsetxattr usage allowed]) 1207 if test "x$curl_disallow_fsetxattr" != "xyes"; then 1208 AC_MSG_RESULT([yes]) 1209 tst_allow_fsetxattr="yes" 1210 else 1211 AC_MSG_RESULT([no]) 1212 tst_allow_fsetxattr="no" 1213 fi 1214 fi 1215 # 1216 AC_MSG_CHECKING([if fsetxattr might be used]) 1217 if test "$tst_links_fsetxattr" = "yes" && 1218 test "$tst_proto_fsetxattr" = "yes" && 1219 test "$tst_compi_fsetxattr" = "yes" && 1220 test "$tst_allow_fsetxattr" = "yes"; then 1221 AC_MSG_RESULT([yes]) 1222 AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1, 1223 [Define to 1 if you have the fsetxattr function.]) 1224 dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr, 1225 dnl [Specifies the number of arguments to fsetxattr]) 1226 # 1227 if test "$tst_nargs_fsetxattr" -eq "5"; then 1228 AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args]) 1229 elif test "$tst_nargs_fsetxattr" -eq "6"; then 1230 AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args]) 1231 fi 1232 # 1233 curl_cv_func_fsetxattr="yes" 1234 else 1235 AC_MSG_RESULT([no]) 1236 curl_cv_func_fsetxattr="no" 1237 fi 1238]) 1239 1240 1241dnl CURL_CHECK_FUNC_FTRUNCATE 1242dnl ------------------------------------------------- 1243dnl Verify if ftruncate is available, prototyped, and 1244dnl can be compiled. If all of these are true, and 1245dnl usage has not been previously disallowed with 1246dnl shell variable curl_disallow_ftruncate, then 1247dnl HAVE_FTRUNCATE will be defined. 1248 1249AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [ 1250 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 1251 # 1252 tst_links_ftruncate="unknown" 1253 tst_proto_ftruncate="unknown" 1254 tst_compi_ftruncate="unknown" 1255 tst_allow_ftruncate="unknown" 1256 # 1257 AC_MSG_CHECKING([if ftruncate can be linked]) 1258 AC_LINK_IFELSE([ 1259 AC_LANG_FUNC_LINK_TRY([ftruncate]) 1260 ],[ 1261 AC_MSG_RESULT([yes]) 1262 tst_links_ftruncate="yes" 1263 ],[ 1264 AC_MSG_RESULT([no]) 1265 tst_links_ftruncate="no" 1266 ]) 1267 # 1268 if test "$tst_links_ftruncate" = "yes"; then 1269 AC_MSG_CHECKING([if ftruncate is prototyped]) 1270 AC_EGREP_CPP([ftruncate],[ 1271 $curl_includes_unistd 1272 ],[ 1273 AC_MSG_RESULT([yes]) 1274 tst_proto_ftruncate="yes" 1275 ],[ 1276 AC_MSG_RESULT([no]) 1277 tst_proto_ftruncate="no" 1278 ]) 1279 fi 1280 # 1281 if test "$tst_proto_ftruncate" = "yes"; then 1282 AC_MSG_CHECKING([if ftruncate is compilable]) 1283 AC_COMPILE_IFELSE([ 1284 AC_LANG_PROGRAM([[ 1285 $curl_includes_unistd 1286 ]],[[ 1287 if(0 != ftruncate(0, 0)) 1288 return 1; 1289 ]]) 1290 ],[ 1291 AC_MSG_RESULT([yes]) 1292 tst_compi_ftruncate="yes" 1293 ],[ 1294 AC_MSG_RESULT([no]) 1295 tst_compi_ftruncate="no" 1296 ]) 1297 fi 1298 # 1299 if test "$tst_compi_ftruncate" = "yes"; then 1300 AC_MSG_CHECKING([if ftruncate usage allowed]) 1301 if test "x$curl_disallow_ftruncate" != "xyes"; then 1302 AC_MSG_RESULT([yes]) 1303 tst_allow_ftruncate="yes" 1304 else 1305 AC_MSG_RESULT([no]) 1306 tst_allow_ftruncate="no" 1307 fi 1308 fi 1309 # 1310 AC_MSG_CHECKING([if ftruncate might be used]) 1311 if test "$tst_links_ftruncate" = "yes" && 1312 test "$tst_proto_ftruncate" = "yes" && 1313 test "$tst_compi_ftruncate" = "yes" && 1314 test "$tst_allow_ftruncate" = "yes"; then 1315 AC_MSG_RESULT([yes]) 1316 AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1, 1317 [Define to 1 if you have the ftruncate function.]) 1318 curl_cv_func_ftruncate="yes" 1319 else 1320 AC_MSG_RESULT([no]) 1321 curl_cv_func_ftruncate="no" 1322 fi 1323]) 1324 1325 1326dnl CURL_CHECK_FUNC_GETADDRINFO 1327dnl ------------------------------------------------- 1328dnl Verify if getaddrinfo is available, prototyped, can 1329dnl be compiled and seems to work. If all of these are 1330dnl true, and usage has not been previously disallowed 1331dnl with shell variable curl_disallow_getaddrinfo, then 1332dnl HAVE_GETADDRINFO will be defined. Additionally when 1333dnl HAVE_GETADDRINFO gets defined this will also attempt 1334dnl to find out if getaddrinfo happens to be threadsafe, 1335dnl defining HAVE_GETADDRINFO_THREADSAFE when true. 1336 1337AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [ 1338 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl 1339 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 1340 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 1341 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 1342 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 1343 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl 1344 # 1345 tst_links_getaddrinfo="unknown" 1346 tst_proto_getaddrinfo="unknown" 1347 tst_compi_getaddrinfo="unknown" 1348 tst_works_getaddrinfo="unknown" 1349 tst_allow_getaddrinfo="unknown" 1350 tst_tsafe_getaddrinfo="unknown" 1351 # 1352 AC_MSG_CHECKING([if getaddrinfo can be linked]) 1353 AC_LINK_IFELSE([ 1354 AC_LANG_PROGRAM([[ 1355 $curl_includes_ws2tcpip 1356 $curl_includes_sys_socket 1357 $curl_includes_netdb 1358 ]],[[ 1359 if(0 != getaddrinfo(0, 0, 0, 0)) 1360 return 1; 1361 ]]) 1362 ],[ 1363 AC_MSG_RESULT([yes]) 1364 tst_links_getaddrinfo="yes" 1365 ],[ 1366 AC_MSG_RESULT([no]) 1367 tst_links_getaddrinfo="no" 1368 ]) 1369 # 1370 if test "$tst_links_getaddrinfo" = "yes"; then 1371 AC_MSG_CHECKING([if getaddrinfo is prototyped]) 1372 AC_EGREP_CPP([getaddrinfo],[ 1373 $curl_includes_ws2tcpip 1374 $curl_includes_sys_socket 1375 $curl_includes_netdb 1376 ],[ 1377 AC_MSG_RESULT([yes]) 1378 tst_proto_getaddrinfo="yes" 1379 ],[ 1380 AC_MSG_RESULT([no]) 1381 tst_proto_getaddrinfo="no" 1382 ]) 1383 fi 1384 # 1385 if test "$tst_proto_getaddrinfo" = "yes"; then 1386 AC_MSG_CHECKING([if getaddrinfo is compilable]) 1387 AC_COMPILE_IFELSE([ 1388 AC_LANG_PROGRAM([[ 1389 $curl_includes_ws2tcpip 1390 $curl_includes_sys_socket 1391 $curl_includes_netdb 1392 ]],[[ 1393 if(0 != getaddrinfo(0, 0, 0, 0)) 1394 return 1; 1395 ]]) 1396 ],[ 1397 AC_MSG_RESULT([yes]) 1398 tst_compi_getaddrinfo="yes" 1399 ],[ 1400 AC_MSG_RESULT([no]) 1401 tst_compi_getaddrinfo="no" 1402 ]) 1403 fi 1404 # 1405 dnl only do runtime verification when not cross-compiling 1406 if test "x$cross_compiling" != "xyes" && 1407 test "$tst_compi_getaddrinfo" = "yes"; then 1408 AC_MSG_CHECKING([if getaddrinfo seems to work]) 1409 CURL_RUN_IFELSE([ 1410 AC_LANG_PROGRAM([[ 1411 $curl_includes_ws2tcpip 1412 $curl_includes_stdlib 1413 $curl_includes_string 1414 $curl_includes_sys_socket 1415 $curl_includes_netdb 1416 ]],[[ 1417 struct addrinfo hints; 1418 struct addrinfo *ai = 0; 1419 int error; 1420 1421 #ifdef _WIN32 1422 WSADATA wsa; 1423 if(WSAStartup(MAKEWORD(2, 2), &wsa)) 1424 exit(2); 1425 #endif 1426 1427 memset(&hints, 0, sizeof(hints)); 1428 hints.ai_flags = AI_NUMERICHOST; 1429 hints.ai_family = AF_UNSPEC; 1430 hints.ai_socktype = SOCK_STREAM; 1431 error = getaddrinfo("127.0.0.1", 0, &hints, &ai); 1432 if(error || !ai) 1433 exit(1); /* fail */ 1434 else 1435 exit(0); 1436 ]]) 1437 ],[ 1438 AC_MSG_RESULT([yes]) 1439 tst_works_getaddrinfo="yes" 1440 ],[ 1441 AC_MSG_RESULT([no]) 1442 tst_works_getaddrinfo="no" 1443 ]) 1444 fi 1445 # 1446 if test "$tst_compi_getaddrinfo" = "yes" && 1447 test "$tst_works_getaddrinfo" != "no"; then 1448 AC_MSG_CHECKING([if getaddrinfo usage allowed]) 1449 if test "x$curl_disallow_getaddrinfo" != "xyes"; then 1450 AC_MSG_RESULT([yes]) 1451 tst_allow_getaddrinfo="yes" 1452 else 1453 AC_MSG_RESULT([no]) 1454 tst_allow_getaddrinfo="no" 1455 fi 1456 fi 1457 # 1458 AC_MSG_CHECKING([if getaddrinfo might be used]) 1459 if test "$tst_links_getaddrinfo" = "yes" && 1460 test "$tst_proto_getaddrinfo" = "yes" && 1461 test "$tst_compi_getaddrinfo" = "yes" && 1462 test "$tst_allow_getaddrinfo" = "yes" && 1463 test "$tst_works_getaddrinfo" != "no"; then 1464 AC_MSG_RESULT([yes]) 1465 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1, 1466 [Define to 1 if you have a working getaddrinfo function.]) 1467 curl_cv_func_getaddrinfo="yes" 1468 else 1469 AC_MSG_RESULT([no]) 1470 curl_cv_func_getaddrinfo="no" 1471 curl_cv_func_getaddrinfo_threadsafe="no" 1472 fi 1473 # 1474 if test "$curl_cv_func_getaddrinfo" = "yes"; then 1475 AC_MSG_CHECKING([if getaddrinfo is threadsafe]) 1476 case $host_os in 1477 aix[[1234]].* | aix5.[[01]].*) 1478 dnl aix 5.1 and older 1479 tst_tsafe_getaddrinfo="no" 1480 ;; 1481 aix*) 1482 dnl aix 5.2 and newer 1483 tst_tsafe_getaddrinfo="yes" 1484 ;; 1485 darwin[[12345]].*) 1486 dnl darwin 5.0 and mac os x 10.1.X and older 1487 tst_tsafe_getaddrinfo="no" 1488 ;; 1489 darwin*) 1490 dnl darwin 6.0 and mac os x 10.2.X and newer 1491 tst_tsafe_getaddrinfo="yes" 1492 ;; 1493 freebsd[[1234]].* | freebsd5.[[1234]]*) 1494 dnl freebsd 5.4 and older 1495 tst_tsafe_getaddrinfo="no" 1496 ;; 1497 freebsd*) 1498 dnl freebsd 5.5 and newer 1499 tst_tsafe_getaddrinfo="yes" 1500 ;; 1501 hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*) 1502 dnl hpux 11.10 and older 1503 tst_tsafe_getaddrinfo="no" 1504 ;; 1505 hpux*) 1506 dnl hpux 11.11 and newer 1507 tst_tsafe_getaddrinfo="yes" 1508 ;; 1509 midnightbsd*) 1510 dnl all MidnightBSD versions 1511 tst_tsafe_getaddrinfo="yes" 1512 ;; 1513 netbsd[[123]].*) 1514 dnl netbsd 3.X and older 1515 tst_tsafe_getaddrinfo="no" 1516 ;; 1517 netbsd*) 1518 dnl netbsd 4.X and newer 1519 tst_tsafe_getaddrinfo="yes" 1520 ;; 1521 *bsd*) 1522 dnl All other bsd's 1523 tst_tsafe_getaddrinfo="no" 1524 ;; 1525 solaris2*) 1526 dnl solaris which have it 1527 tst_tsafe_getaddrinfo="yes" 1528 ;; 1529 esac 1530 if test "$tst_tsafe_getaddrinfo" = "unknown" && 1531 test "$curl_cv_native_windows" = "yes"; then 1532 tst_tsafe_getaddrinfo="yes" 1533 fi 1534 if test "$tst_tsafe_getaddrinfo" = "unknown"; then 1535 CURL_CHECK_DEF_CC([h_errno], [ 1536 $curl_includes_sys_socket 1537 $curl_includes_netdb 1538 ], [silent]) 1539 if test "$curl_cv_have_def_h_errno" = "yes"; then 1540 tst_h_errno_macro="yes" 1541 else 1542 tst_h_errno_macro="no" 1543 fi 1544 AC_COMPILE_IFELSE([ 1545 AC_LANG_PROGRAM([[ 1546 $curl_includes_sys_socket 1547 $curl_includes_netdb 1548 ]],[[ 1549 h_errno = 2; 1550 if(0 != h_errno) 1551 return 1; 1552 ]]) 1553 ],[ 1554 tst_h_errno_modifiable_lvalue="yes" 1555 ],[ 1556 tst_h_errno_modifiable_lvalue="no" 1557 ]) 1558 AC_COMPILE_IFELSE([ 1559 AC_LANG_PROGRAM([[ 1560 ]],[[ 1561#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) 1562 return 0; 1563#elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700) 1564 return 0; 1565#else 1566 force compilation error 1567#endif 1568 ]]) 1569 ],[ 1570 tst_h_errno_sbs_issue_7="yes" 1571 ],[ 1572 tst_h_errno_sbs_issue_7="no" 1573 ]) 1574 if test "$tst_h_errno_macro" = "no" && 1575 test "$tst_h_errno_modifiable_lvalue" = "no" && 1576 test "$tst_h_errno_sbs_issue_7" = "no"; then 1577 tst_tsafe_getaddrinfo="no" 1578 else 1579 tst_tsafe_getaddrinfo="yes" 1580 fi 1581 fi 1582 AC_MSG_RESULT([$tst_tsafe_getaddrinfo]) 1583 if test "$tst_tsafe_getaddrinfo" = "yes"; then 1584 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1, 1585 [Define to 1 if the getaddrinfo function is threadsafe.]) 1586 curl_cv_func_getaddrinfo_threadsafe="yes" 1587 else 1588 curl_cv_func_getaddrinfo_threadsafe="no" 1589 fi 1590 fi 1591]) 1592 1593 1594dnl CURL_CHECK_FUNC_GETHOSTBYNAME 1595dnl ------------------------------------------------- 1596dnl Verify if gethostbyname is available, prototyped, 1597dnl and can be compiled. If all of these are true, 1598dnl and usage has not been previously disallowed with 1599dnl shell variable curl_disallow_gethostbyname, then 1600dnl HAVE_GETHOSTBYNAME will be defined. 1601 1602AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME], [ 1603 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 1604 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 1605 # 1606 tst_links_gethostbyname="unknown" 1607 tst_proto_gethostbyname="unknown" 1608 tst_compi_gethostbyname="unknown" 1609 tst_allow_gethostbyname="unknown" 1610 # 1611 AC_MSG_CHECKING([if gethostbyname can be linked]) 1612 AC_LINK_IFELSE([ 1613 AC_LANG_PROGRAM([[ 1614 $curl_includes_winsock2 1615 $curl_includes_bsdsocket 1616 $curl_includes_netdb 1617 ]],[[ 1618 if(0 != gethostbyname(0)) 1619 return 1; 1620 ]]) 1621 ],[ 1622 AC_MSG_RESULT([yes]) 1623 tst_links_gethostbyname="yes" 1624 ],[ 1625 AC_MSG_RESULT([no]) 1626 tst_links_gethostbyname="no" 1627 ]) 1628 # 1629 if test "$tst_links_gethostbyname" = "yes"; then 1630 AC_MSG_CHECKING([if gethostbyname is prototyped]) 1631 AC_EGREP_CPP([gethostbyname],[ 1632 $curl_includes_winsock2 1633 $curl_includes_bsdsocket 1634 $curl_includes_netdb 1635 ],[ 1636 AC_MSG_RESULT([yes]) 1637 tst_proto_gethostbyname="yes" 1638 ],[ 1639 AC_MSG_RESULT([no]) 1640 tst_proto_gethostbyname="no" 1641 ]) 1642 fi 1643 # 1644 if test "$tst_proto_gethostbyname" = "yes"; then 1645 AC_MSG_CHECKING([if gethostbyname is compilable]) 1646 AC_COMPILE_IFELSE([ 1647 AC_LANG_PROGRAM([[ 1648 $curl_includes_winsock2 1649 $curl_includes_bsdsocket 1650 $curl_includes_netdb 1651 ]],[[ 1652 if(0 != gethostbyname(0)) 1653 return 1; 1654 ]]) 1655 ],[ 1656 AC_MSG_RESULT([yes]) 1657 tst_compi_gethostbyname="yes" 1658 ],[ 1659 AC_MSG_RESULT([no]) 1660 tst_compi_gethostbyname="no" 1661 ]) 1662 fi 1663 # 1664 if test "$tst_compi_gethostbyname" = "yes"; then 1665 AC_MSG_CHECKING([if gethostbyname usage allowed]) 1666 if test "x$curl_disallow_gethostbyname" != "xyes"; then 1667 AC_MSG_RESULT([yes]) 1668 tst_allow_gethostbyname="yes" 1669 else 1670 AC_MSG_RESULT([no]) 1671 tst_allow_gethostbyname="no" 1672 fi 1673 fi 1674 # 1675 AC_MSG_CHECKING([if gethostbyname might be used]) 1676 if test "$tst_links_gethostbyname" = "yes" && 1677 test "$tst_proto_gethostbyname" = "yes" && 1678 test "$tst_compi_gethostbyname" = "yes" && 1679 test "$tst_allow_gethostbyname" = "yes"; then 1680 AC_MSG_RESULT([yes]) 1681 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1, 1682 [Define to 1 if you have the gethostbyname function.]) 1683 curl_cv_func_gethostbyname="yes" 1684 else 1685 AC_MSG_RESULT([no]) 1686 curl_cv_func_gethostbyname="no" 1687 fi 1688]) 1689 1690 1691dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R 1692dnl ------------------------------------------------- 1693dnl Verify if gethostbyname_r is available, prototyped, 1694dnl and can be compiled. If all of these are true, and 1695dnl usage has not been previously disallowed with 1696dnl shell variable curl_disallow_gethostbyname_r, then 1697dnl HAVE_GETHOSTBYNAME_R will be defined. 1698 1699AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [ 1700 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 1701 # 1702 tst_links_gethostbyname_r="unknown" 1703 tst_proto_gethostbyname_r="unknown" 1704 tst_compi_gethostbyname_r="unknown" 1705 tst_allow_gethostbyname_r="unknown" 1706 tst_nargs_gethostbyname_r="unknown" 1707 # 1708 AC_MSG_CHECKING([if gethostbyname_r can be linked]) 1709 AC_LINK_IFELSE([ 1710 AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) 1711 ],[ 1712 AC_MSG_RESULT([yes]) 1713 tst_links_gethostbyname_r="yes" 1714 ],[ 1715 AC_MSG_RESULT([no]) 1716 tst_links_gethostbyname_r="no" 1717 ]) 1718 # 1719 if test "$tst_links_gethostbyname_r" = "yes"; then 1720 AC_MSG_CHECKING([if gethostbyname_r is prototyped]) 1721 AC_EGREP_CPP([gethostbyname_r],[ 1722 $curl_includes_netdb 1723 ],[ 1724 AC_MSG_RESULT([yes]) 1725 tst_proto_gethostbyname_r="yes" 1726 ],[ 1727 AC_MSG_RESULT([no]) 1728 tst_proto_gethostbyname_r="no" 1729 ]) 1730 fi 1731 # 1732 if test "$tst_proto_gethostbyname_r" = "yes"; then 1733 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 1734 AC_MSG_CHECKING([if gethostbyname_r takes 3 args.]) 1735 AC_COMPILE_IFELSE([ 1736 AC_LANG_PROGRAM([[ 1737 $curl_includes_netdb 1738 $curl_includes_bsdsocket 1739 ]],[[ 1740 if(0 != gethostbyname_r(0, 0, 0)) 1741 return 1; 1742 ]]) 1743 ],[ 1744 AC_MSG_RESULT([yes]) 1745 tst_compi_gethostbyname_r="yes" 1746 tst_nargs_gethostbyname_r="3" 1747 ],[ 1748 AC_MSG_RESULT([no]) 1749 tst_compi_gethostbyname_r="no" 1750 ]) 1751 fi 1752 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 1753 AC_MSG_CHECKING([if gethostbyname_r takes 5 args.]) 1754 AC_COMPILE_IFELSE([ 1755 AC_LANG_PROGRAM([[ 1756 $curl_includes_netdb 1757 $curl_includes_bsdsocket 1758 ]],[[ 1759 if(0 != gethostbyname_r(0, 0, 0, 0, 0)) 1760 return 1; 1761 ]]) 1762 ],[ 1763 AC_MSG_RESULT([yes]) 1764 tst_compi_gethostbyname_r="yes" 1765 tst_nargs_gethostbyname_r="5" 1766 ],[ 1767 AC_MSG_RESULT([no]) 1768 tst_compi_gethostbyname_r="no" 1769 ]) 1770 fi 1771 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 1772 AC_MSG_CHECKING([if gethostbyname_r takes 6 args.]) 1773 AC_COMPILE_IFELSE([ 1774 AC_LANG_PROGRAM([[ 1775 $curl_includes_netdb 1776 $curl_includes_bsdsocket 1777 ]],[[ 1778 if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0)) 1779 return 1; 1780 ]]) 1781 ],[ 1782 AC_MSG_RESULT([yes]) 1783 tst_compi_gethostbyname_r="yes" 1784 tst_nargs_gethostbyname_r="6" 1785 ],[ 1786 AC_MSG_RESULT([no]) 1787 tst_compi_gethostbyname_r="no" 1788 ]) 1789 fi 1790 AC_MSG_CHECKING([if gethostbyname_r is compilable]) 1791 if test "$tst_compi_gethostbyname_r" = "yes"; then 1792 AC_MSG_RESULT([yes]) 1793 else 1794 AC_MSG_RESULT([no]) 1795 fi 1796 fi 1797 # 1798 if test "$tst_compi_gethostbyname_r" = "yes"; then 1799 AC_MSG_CHECKING([if gethostbyname_r usage allowed]) 1800 if test "x$curl_disallow_gethostbyname_r" != "xyes"; then 1801 AC_MSG_RESULT([yes]) 1802 tst_allow_gethostbyname_r="yes" 1803 else 1804 AC_MSG_RESULT([no]) 1805 tst_allow_gethostbyname_r="no" 1806 fi 1807 fi 1808 # 1809 AC_MSG_CHECKING([if gethostbyname_r might be used]) 1810 if test "$tst_links_gethostbyname_r" = "yes" && 1811 test "$tst_proto_gethostbyname_r" = "yes" && 1812 test "$tst_compi_gethostbyname_r" = "yes" && 1813 test "$tst_allow_gethostbyname_r" = "yes"; then 1814 AC_MSG_RESULT([yes]) 1815 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1, 1816 [Define to 1 if you have the gethostbyname_r function.]) 1817 dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r, 1818 dnl [Specifies the number of arguments to gethostbyname_r]) 1819 # 1820 if test "$tst_nargs_gethostbyname_r" -eq "3"; then 1821 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args]) 1822 elif test "$tst_nargs_gethostbyname_r" -eq "5"; then 1823 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args]) 1824 elif test "$tst_nargs_gethostbyname_r" -eq "6"; then 1825 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args]) 1826 fi 1827 # 1828 curl_cv_func_gethostbyname_r="yes" 1829 else 1830 AC_MSG_RESULT([no]) 1831 curl_cv_func_gethostbyname_r="no" 1832 fi 1833]) 1834 1835 1836dnl CURL_CHECK_FUNC_GETHOSTNAME 1837dnl ------------------------------------------------- 1838dnl Verify if gethostname is available, prototyped, and 1839dnl can be compiled. If all of these are true, and 1840dnl usage has not been previously disallowed with 1841dnl shell variable curl_disallow_gethostname, then 1842dnl HAVE_GETHOSTNAME will be defined. 1843 1844AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [ 1845 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 1846 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 1847 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 1848 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 1849 # 1850 tst_links_gethostname="unknown" 1851 tst_proto_gethostname="unknown" 1852 tst_compi_gethostname="unknown" 1853 tst_allow_gethostname="unknown" 1854 # 1855 AC_MSG_CHECKING([if gethostname can be linked]) 1856 AC_LINK_IFELSE([ 1857 AC_LANG_PROGRAM([[ 1858 $curl_includes_winsock2 1859 $curl_includes_unistd 1860 $curl_includes_bsdsocket 1861 ]],[[ 1862 if(0 != gethostname(0, 0)) 1863 return 1; 1864 ]]) 1865 ],[ 1866 AC_MSG_RESULT([yes]) 1867 tst_links_gethostname="yes" 1868 ],[ 1869 AC_MSG_RESULT([no]) 1870 tst_links_gethostname="no" 1871 ]) 1872 # 1873 if test "$tst_links_gethostname" = "yes"; then 1874 AC_MSG_CHECKING([if gethostname is prototyped]) 1875 AC_EGREP_CPP([gethostname],[ 1876 $curl_includes_winsock2 1877 $curl_includes_unistd 1878 $curl_includes_bsdsocket 1879 ],[ 1880 AC_MSG_RESULT([yes]) 1881 tst_proto_gethostname="yes" 1882 ],[ 1883 AC_MSG_RESULT([no]) 1884 tst_proto_gethostname="no" 1885 ]) 1886 fi 1887 # 1888 if test "$tst_proto_gethostname" = "yes"; then 1889 AC_MSG_CHECKING([if gethostname is compilable]) 1890 AC_COMPILE_IFELSE([ 1891 AC_LANG_PROGRAM([[ 1892 $curl_includes_winsock2 1893 $curl_includes_unistd 1894 $curl_includes_bsdsocket 1895 ]],[[ 1896 if(0 != gethostname(0, 0)) 1897 return 1; 1898 ]]) 1899 ],[ 1900 AC_MSG_RESULT([yes]) 1901 tst_compi_gethostname="yes" 1902 ],[ 1903 AC_MSG_RESULT([no]) 1904 tst_compi_gethostname="no" 1905 ]) 1906 fi 1907 # 1908 if test "$tst_compi_gethostname" = "yes"; then 1909 AC_MSG_CHECKING([for gethostname arg 2 data type]) 1910 tst_gethostname_type_arg2="unknown" 1911 for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do 1912 for tst_arg2 in 'int' 'unsigned int' 'size_t'; do 1913 if test "$tst_gethostname_type_arg2" = "unknown"; then 1914 AC_COMPILE_IFELSE([ 1915 AC_LANG_PROGRAM([[ 1916 $curl_includes_winsock2 1917 $curl_includes_unistd 1918 $curl_includes_bsdsocket 1919 $curl_preprocess_callconv 1920 extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2); 1921 ]],[[ 1922 if(0 != gethostname(0, 0)) 1923 return 1; 1924 ]]) 1925 ],[ 1926 tst_gethostname_type_arg2="$tst_arg2" 1927 ]) 1928 fi 1929 done 1930 done 1931 AC_MSG_RESULT([$tst_gethostname_type_arg2]) 1932 if test "$tst_gethostname_type_arg2" != "unknown"; then 1933 AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2, 1934 [Define to the type of arg 2 for gethostname.]) 1935 fi 1936 fi 1937 # 1938 if test "$tst_compi_gethostname" = "yes"; then 1939 AC_MSG_CHECKING([if gethostname usage allowed]) 1940 if test "x$curl_disallow_gethostname" != "xyes"; then 1941 AC_MSG_RESULT([yes]) 1942 tst_allow_gethostname="yes" 1943 else 1944 AC_MSG_RESULT([no]) 1945 tst_allow_gethostname="no" 1946 fi 1947 fi 1948 # 1949 AC_MSG_CHECKING([if gethostname might be used]) 1950 if test "$tst_links_gethostname" = "yes" && 1951 test "$tst_proto_gethostname" = "yes" && 1952 test "$tst_compi_gethostname" = "yes" && 1953 test "$tst_allow_gethostname" = "yes"; then 1954 AC_MSG_RESULT([yes]) 1955 AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1, 1956 [Define to 1 if you have the gethostname function.]) 1957 curl_cv_func_gethostname="yes" 1958 else 1959 AC_MSG_RESULT([no]) 1960 curl_cv_func_gethostname="no" 1961 fi 1962]) 1963 1964dnl CURL_CHECK_FUNC_GETPEERNAME 1965dnl ------------------------------------------------- 1966dnl Verify if getpeername is available, prototyped, and 1967dnl can be compiled. If all of these are true, and 1968dnl usage has not been previously disallowed with 1969dnl shell variable curl_disallow_getpeername, then 1970dnl HAVE_GETPEERNAME will be defined. 1971 1972AC_DEFUN([CURL_CHECK_FUNC_GETPEERNAME], [ 1973 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 1974 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 1975 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 1976 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 1977 # 1978 tst_links_getpeername="unknown" 1979 tst_proto_getpeername="unknown" 1980 tst_compi_getpeername="unknown" 1981 tst_allow_getpeername="unknown" 1982 # 1983 AC_MSG_CHECKING([if getpeername can be linked]) 1984 AC_LINK_IFELSE([ 1985 AC_LANG_PROGRAM([[ 1986 $curl_includes_winsock2 1987 $curl_includes_bsdsocket 1988 $curl_includes_sys_socket 1989 ]],[[ 1990 if(0 != getpeername(0, (void *)0, (void *)0)) 1991 return 1; 1992 ]]) 1993 ],[ 1994 AC_MSG_RESULT([yes]) 1995 tst_links_getpeername="yes" 1996 ],[ 1997 AC_MSG_RESULT([no]) 1998 tst_links_getpeername="no" 1999 ]) 2000 # 2001 if test "$tst_links_getpeername" = "yes"; then 2002 AC_MSG_CHECKING([if getpeername is prototyped]) 2003 AC_EGREP_CPP([getpeername],[ 2004 $curl_includes_winsock2 2005 $curl_includes_bsdsocket 2006 $curl_includes_sys_socket 2007 ],[ 2008 AC_MSG_RESULT([yes]) 2009 tst_proto_getpeername="yes" 2010 ],[ 2011 AC_MSG_RESULT([no]) 2012 tst_proto_getpeername="no" 2013 ]) 2014 fi 2015 # 2016 if test "$tst_proto_getpeername" = "yes"; then 2017 AC_MSG_CHECKING([if getpeername is compilable]) 2018 AC_COMPILE_IFELSE([ 2019 AC_LANG_PROGRAM([[ 2020 $curl_includes_winsock2 2021 $curl_includes_bsdsocket 2022 $curl_includes_sys_socket 2023 ]],[[ 2024 if(0 != getpeername(0, (void *)0, (void *)0)) 2025 return 1; 2026 ]]) 2027 ],[ 2028 AC_MSG_RESULT([yes]) 2029 tst_compi_getpeername="yes" 2030 ],[ 2031 AC_MSG_RESULT([no]) 2032 tst_compi_getpeername="no" 2033 ]) 2034 fi 2035 # 2036 if test "$tst_compi_getpeername" = "yes"; then 2037 AC_MSG_CHECKING([if getpeername usage allowed]) 2038 if test "x$curl_disallow_getpeername" != "xyes"; then 2039 AC_MSG_RESULT([yes]) 2040 tst_allow_getpeername="yes" 2041 else 2042 AC_MSG_RESULT([no]) 2043 tst_allow_getpeername="no" 2044 fi 2045 fi 2046 # 2047 AC_MSG_CHECKING([if getpeername might be used]) 2048 if test "$tst_links_getpeername" = "yes" && 2049 test "$tst_proto_getpeername" = "yes" && 2050 test "$tst_compi_getpeername" = "yes" && 2051 test "$tst_allow_getpeername" = "yes"; then 2052 AC_MSG_RESULT([yes]) 2053 AC_DEFINE_UNQUOTED(HAVE_GETPEERNAME, 1, 2054 [Define to 1 if you have the getpeername function.]) 2055 curl_cv_func_getpeername="yes" 2056 else 2057 AC_MSG_RESULT([no]) 2058 curl_cv_func_getpeername="no" 2059 fi 2060]) 2061 2062dnl CURL_CHECK_FUNC_GETSOCKNAME 2063dnl ------------------------------------------------- 2064dnl Verify if getsockname is available, prototyped, and 2065dnl can be compiled. If all of these are true, and 2066dnl usage has not been previously disallowed with 2067dnl shell variable curl_disallow_getsockname, then 2068dnl HAVE_GETSOCKNAME will be defined. 2069 2070AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [ 2071 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 2072 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 2073 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 2074 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 2075 # 2076 tst_links_getsockname="unknown" 2077 tst_proto_getsockname="unknown" 2078 tst_compi_getsockname="unknown" 2079 tst_allow_getsockname="unknown" 2080 # 2081 AC_MSG_CHECKING([if getsockname can be linked]) 2082 AC_LINK_IFELSE([ 2083 AC_LANG_PROGRAM([[ 2084 $curl_includes_winsock2 2085 $curl_includes_bsdsocket 2086 $curl_includes_sys_socket 2087 ]],[[ 2088 if(0 != getsockname(0, (void *)0, (void *)0)) 2089 return 1; 2090 ]]) 2091 ],[ 2092 AC_MSG_RESULT([yes]) 2093 tst_links_getsockname="yes" 2094 ],[ 2095 AC_MSG_RESULT([no]) 2096 tst_links_getsockname="no" 2097 ]) 2098 # 2099 if test "$tst_links_getsockname" = "yes"; then 2100 AC_MSG_CHECKING([if getsockname is prototyped]) 2101 AC_EGREP_CPP([getsockname],[ 2102 $curl_includes_winsock2 2103 $curl_includes_bsdsocket 2104 $curl_includes_sys_socket 2105 ],[ 2106 AC_MSG_RESULT([yes]) 2107 tst_proto_getsockname="yes" 2108 ],[ 2109 AC_MSG_RESULT([no]) 2110 tst_proto_getsockname="no" 2111 ]) 2112 fi 2113 # 2114 if test "$tst_proto_getsockname" = "yes"; then 2115 AC_MSG_CHECKING([if getsockname is compilable]) 2116 AC_COMPILE_IFELSE([ 2117 AC_LANG_PROGRAM([[ 2118 $curl_includes_winsock2 2119 $curl_includes_bsdsocket 2120 $curl_includes_sys_socket 2121 ]],[[ 2122 if(0 != getsockname(0, (void *)0, (void *)0)) 2123 return 1; 2124 ]]) 2125 ],[ 2126 AC_MSG_RESULT([yes]) 2127 tst_compi_getsockname="yes" 2128 ],[ 2129 AC_MSG_RESULT([no]) 2130 tst_compi_getsockname="no" 2131 ]) 2132 fi 2133 # 2134 if test "$tst_compi_getsockname" = "yes"; then 2135 AC_MSG_CHECKING([if getsockname usage allowed]) 2136 if test "x$curl_disallow_getsockname" != "xyes"; then 2137 AC_MSG_RESULT([yes]) 2138 tst_allow_getsockname="yes" 2139 else 2140 AC_MSG_RESULT([no]) 2141 tst_allow_getsockname="no" 2142 fi 2143 fi 2144 # 2145 AC_MSG_CHECKING([if getsockname might be used]) 2146 if test "$tst_links_getsockname" = "yes" && 2147 test "$tst_proto_getsockname" = "yes" && 2148 test "$tst_compi_getsockname" = "yes" && 2149 test "$tst_allow_getsockname" = "yes"; then 2150 AC_MSG_RESULT([yes]) 2151 AC_DEFINE_UNQUOTED(HAVE_GETSOCKNAME, 1, 2152 [Define to 1 if you have the getsockname function.]) 2153 curl_cv_func_getsockname="yes" 2154 else 2155 AC_MSG_RESULT([no]) 2156 curl_cv_func_getsockname="no" 2157 fi 2158]) 2159 2160dnl CURL_CHECK_FUNC_IF_NAMETOINDEX 2161dnl ------------------------------------------------- 2162dnl Verify if if_nametoindex is available, prototyped, and 2163dnl can be compiled. If all of these are true, and 2164dnl usage has not been previously disallowed with 2165dnl shell variable curl_disallow_if_nametoindex, then 2166dnl HAVE_IF_NAMETOINDEX will be defined. 2167 2168AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [ 2169 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 2170 AC_REQUIRE([CURL_INCLUDES_NETIF])dnl 2171 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 2172 # 2173 tst_links_if_nametoindex="unknown" 2174 tst_proto_if_nametoindex="unknown" 2175 tst_compi_if_nametoindex="unknown" 2176 tst_allow_if_nametoindex="unknown" 2177 # 2178 AC_MSG_CHECKING([if if_nametoindex can be linked]) 2179 AC_LINK_IFELSE([ 2180 AC_LANG_PROGRAM([[ 2181 $curl_includes_winsock2 2182 $curl_includes_bsdsocket 2183 #include <net/if.h> 2184 ]],[[ 2185 if(0 != if_nametoindex("")) 2186 return 1; 2187 ]]) 2188 ],[ 2189 AC_MSG_RESULT([yes]) 2190 tst_links_if_nametoindex="yes" 2191 ],[ 2192 AC_MSG_RESULT([no]) 2193 tst_links_if_nametoindex="no" 2194 ]) 2195 # 2196 if test "$tst_links_if_nametoindex" = "yes"; then 2197 AC_MSG_CHECKING([if if_nametoindex is prototyped]) 2198 AC_EGREP_CPP([if_nametoindex],[ 2199 $curl_includes_winsock2 2200 $curl_includes_netif 2201 ],[ 2202 AC_MSG_RESULT([yes]) 2203 tst_proto_if_nametoindex="yes" 2204 ],[ 2205 AC_MSG_RESULT([no]) 2206 tst_proto_if_nametoindex="no" 2207 ]) 2208 fi 2209 # 2210 if test "$tst_proto_if_nametoindex" = "yes"; then 2211 AC_MSG_CHECKING([if if_nametoindex is compilable]) 2212 AC_COMPILE_IFELSE([ 2213 AC_LANG_PROGRAM([[ 2214 $curl_includes_winsock2 2215 $curl_includes_netif 2216 ]],[[ 2217 if(0 != if_nametoindex("")) 2218 return 1; 2219 ]]) 2220 ],[ 2221 AC_MSG_RESULT([yes]) 2222 tst_compi_if_nametoindex="yes" 2223 ],[ 2224 AC_MSG_RESULT([no]) 2225 tst_compi_if_nametoindex="no" 2226 ]) 2227 fi 2228 # 2229 if test "$tst_compi_if_nametoindex" = "yes"; then 2230 AC_MSG_CHECKING([if if_nametoindex usage allowed]) 2231 if test "x$curl_disallow_if_nametoindex" != "xyes"; then 2232 AC_MSG_RESULT([yes]) 2233 tst_allow_if_nametoindex="yes" 2234 else 2235 AC_MSG_RESULT([no]) 2236 tst_allow_if_nametoindex="no" 2237 fi 2238 fi 2239 # 2240 AC_MSG_CHECKING([if if_nametoindex might be used]) 2241 if test "$tst_links_if_nametoindex" = "yes" && 2242 test "$tst_proto_if_nametoindex" = "yes" && 2243 test "$tst_compi_if_nametoindex" = "yes" && 2244 test "$tst_allow_if_nametoindex" = "yes"; then 2245 AC_MSG_RESULT([yes]) 2246 AC_DEFINE_UNQUOTED(HAVE_IF_NAMETOINDEX, 1, 2247 [Define to 1 if you have the if_nametoindex function.]) 2248 curl_cv_func_if_nametoindex="yes" 2249 else 2250 AC_MSG_RESULT([no]) 2251 curl_cv_func_if_nametoindex="no" 2252 fi 2253]) 2254 2255 2256dnl CURL_CHECK_FUNC_GETIFADDRS 2257dnl ------------------------------------------------- 2258dnl Verify if getifaddrs is available, prototyped, can 2259dnl be compiled and seems to work. If all of these are 2260dnl true, and usage has not been previously disallowed 2261dnl with shell variable curl_disallow_getifaddrs, then 2262dnl HAVE_GETIFADDRS will be defined. 2263 2264AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [ 2265 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 2266 AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl 2267 # 2268 tst_links_getifaddrs="unknown" 2269 tst_proto_getifaddrs="unknown" 2270 tst_compi_getifaddrs="unknown" 2271 tst_works_getifaddrs="unknown" 2272 tst_allow_getifaddrs="unknown" 2273 # 2274 AC_MSG_CHECKING([if getifaddrs can be linked]) 2275 AC_LINK_IFELSE([ 2276 AC_LANG_FUNC_LINK_TRY([getifaddrs]) 2277 ],[ 2278 AC_MSG_RESULT([yes]) 2279 tst_links_getifaddrs="yes" 2280 ],[ 2281 AC_MSG_RESULT([no]) 2282 tst_links_getifaddrs="no" 2283 ]) 2284 # 2285 if test "$tst_links_getifaddrs" = "yes"; then 2286 AC_MSG_CHECKING([if getifaddrs is prototyped]) 2287 AC_EGREP_CPP([getifaddrs],[ 2288 $curl_includes_ifaddrs 2289 ],[ 2290 AC_MSG_RESULT([yes]) 2291 tst_proto_getifaddrs="yes" 2292 ],[ 2293 AC_MSG_RESULT([no]) 2294 tst_proto_getifaddrs="no" 2295 ]) 2296 fi 2297 # 2298 if test "$tst_proto_getifaddrs" = "yes"; then 2299 AC_MSG_CHECKING([if getifaddrs is compilable]) 2300 AC_COMPILE_IFELSE([ 2301 AC_LANG_PROGRAM([[ 2302 $curl_includes_ifaddrs 2303 ]],[[ 2304 if(0 != getifaddrs(0)) 2305 return 1; 2306 ]]) 2307 ],[ 2308 AC_MSG_RESULT([yes]) 2309 tst_compi_getifaddrs="yes" 2310 ],[ 2311 AC_MSG_RESULT([no]) 2312 tst_compi_getifaddrs="no" 2313 ]) 2314 fi 2315 # 2316 dnl only do runtime verification when not cross-compiling 2317 if test "x$cross_compiling" != "xyes" && 2318 test "$tst_compi_getifaddrs" = "yes"; then 2319 AC_MSG_CHECKING([if getifaddrs seems to work]) 2320 CURL_RUN_IFELSE([ 2321 AC_LANG_PROGRAM([[ 2322 $curl_includes_stdlib 2323 $curl_includes_ifaddrs 2324 ]],[[ 2325 struct ifaddrs *ifa = 0; 2326 int error; 2327 2328 error = getifaddrs(&ifa); 2329 if(error || !ifa) 2330 exit(1); /* fail */ 2331 else 2332 exit(0); 2333 ]]) 2334 ],[ 2335 AC_MSG_RESULT([yes]) 2336 tst_works_getifaddrs="yes" 2337 ],[ 2338 AC_MSG_RESULT([no]) 2339 tst_works_getifaddrs="no" 2340 ]) 2341 fi 2342 # 2343 if test "$tst_compi_getifaddrs" = "yes" && 2344 test "$tst_works_getifaddrs" != "no"; then 2345 AC_MSG_CHECKING([if getifaddrs usage allowed]) 2346 if test "x$curl_disallow_getifaddrs" != "xyes"; then 2347 AC_MSG_RESULT([yes]) 2348 tst_allow_getifaddrs="yes" 2349 else 2350 AC_MSG_RESULT([no]) 2351 tst_allow_getifaddrs="no" 2352 fi 2353 fi 2354 # 2355 AC_MSG_CHECKING([if getifaddrs might be used]) 2356 if test "$tst_links_getifaddrs" = "yes" && 2357 test "$tst_proto_getifaddrs" = "yes" && 2358 test "$tst_compi_getifaddrs" = "yes" && 2359 test "$tst_allow_getifaddrs" = "yes" && 2360 test "$tst_works_getifaddrs" != "no"; then 2361 AC_MSG_RESULT([yes]) 2362 AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1, 2363 [Define to 1 if you have a working getifaddrs function.]) 2364 curl_cv_func_getifaddrs="yes" 2365 else 2366 AC_MSG_RESULT([no]) 2367 curl_cv_func_getifaddrs="no" 2368 fi 2369]) 2370 2371 2372dnl CURL_CHECK_FUNC_GMTIME_R 2373dnl ------------------------------------------------- 2374dnl Verify if gmtime_r is available, prototyped, can 2375dnl be compiled and seems to work. If all of these are 2376dnl true, and usage has not been previously disallowed 2377dnl with shell variable curl_disallow_gmtime_r, then 2378dnl HAVE_GMTIME_R will be defined. 2379 2380AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [ 2381 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 2382 AC_REQUIRE([CURL_INCLUDES_TIME])dnl 2383 # 2384 tst_links_gmtime_r="unknown" 2385 tst_proto_gmtime_r="unknown" 2386 tst_compi_gmtime_r="unknown" 2387 tst_works_gmtime_r="unknown" 2388 tst_allow_gmtime_r="unknown" 2389 # 2390 AC_MSG_CHECKING([if gmtime_r can be linked]) 2391 AC_LINK_IFELSE([ 2392 AC_LANG_FUNC_LINK_TRY([gmtime_r]) 2393 ],[ 2394 AC_MSG_RESULT([yes]) 2395 tst_links_gmtime_r="yes" 2396 ],[ 2397 AC_MSG_RESULT([no]) 2398 tst_links_gmtime_r="no" 2399 ]) 2400 # 2401 if test "$tst_links_gmtime_r" = "yes"; then 2402 AC_MSG_CHECKING([if gmtime_r is prototyped]) 2403 AC_EGREP_CPP([gmtime_r],[ 2404 $curl_includes_time 2405 ],[ 2406 AC_MSG_RESULT([yes]) 2407 tst_proto_gmtime_r="yes" 2408 ],[ 2409 AC_MSG_RESULT([no]) 2410 tst_proto_gmtime_r="no" 2411 ]) 2412 fi 2413 # 2414 if test "$tst_proto_gmtime_r" = "yes"; then 2415 AC_MSG_CHECKING([if gmtime_r is compilable]) 2416 AC_COMPILE_IFELSE([ 2417 AC_LANG_PROGRAM([[ 2418 $curl_includes_time 2419 ]],[[ 2420 if(0 != gmtime_r(0, 0)) 2421 return 1; 2422 ]]) 2423 ],[ 2424 AC_MSG_RESULT([yes]) 2425 tst_compi_gmtime_r="yes" 2426 ],[ 2427 AC_MSG_RESULT([no]) 2428 tst_compi_gmtime_r="no" 2429 ]) 2430 fi 2431 # 2432 dnl only do runtime verification when not cross-compiling 2433 if test "x$cross_compiling" != "xyes" && 2434 test "$tst_compi_gmtime_r" = "yes"; then 2435 AC_MSG_CHECKING([if gmtime_r seems to work]) 2436 CURL_RUN_IFELSE([ 2437 AC_LANG_PROGRAM([[ 2438 $curl_includes_stdlib 2439 $curl_includes_time 2440 ]],[[ 2441 time_t local = 1170352587; 2442 struct tm *gmt = 0; 2443 struct tm result; 2444 gmt = gmtime_r(&local, &result); 2445 if(gmt) 2446 exit(0); 2447 else 2448 exit(1); 2449 ]]) 2450 ],[ 2451 AC_MSG_RESULT([yes]) 2452 tst_works_gmtime_r="yes" 2453 ],[ 2454 AC_MSG_RESULT([no]) 2455 tst_works_gmtime_r="no" 2456 ]) 2457 fi 2458 # 2459 if test "$tst_compi_gmtime_r" = "yes" && 2460 test "$tst_works_gmtime_r" != "no"; then 2461 AC_MSG_CHECKING([if gmtime_r usage allowed]) 2462 if test "x$curl_disallow_gmtime_r" != "xyes"; then 2463 AC_MSG_RESULT([yes]) 2464 tst_allow_gmtime_r="yes" 2465 else 2466 AC_MSG_RESULT([no]) 2467 tst_allow_gmtime_r="no" 2468 fi 2469 fi 2470 # 2471 AC_MSG_CHECKING([if gmtime_r might be used]) 2472 if test "$tst_links_gmtime_r" = "yes" && 2473 test "$tst_proto_gmtime_r" = "yes" && 2474 test "$tst_compi_gmtime_r" = "yes" && 2475 test "$tst_allow_gmtime_r" = "yes" && 2476 test "$tst_works_gmtime_r" != "no"; then 2477 AC_MSG_RESULT([yes]) 2478 AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1, 2479 [Define to 1 if you have a working gmtime_r function.]) 2480 curl_cv_func_gmtime_r="yes" 2481 else 2482 AC_MSG_RESULT([no]) 2483 curl_cv_func_gmtime_r="no" 2484 fi 2485]) 2486 2487 2488dnl CURL_CHECK_FUNC_INET_NTOP 2489dnl ------------------------------------------------- 2490dnl Verify if inet_ntop is available, prototyped, can 2491dnl be compiled and seems to work. If all of these are 2492dnl true, and usage has not been previously disallowed 2493dnl with shell variable curl_disallow_inet_ntop, then 2494dnl HAVE_INET_NTOP will be defined. 2495 2496AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [ 2497 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 2498 AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl 2499 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 2500 # 2501 tst_links_inet_ntop="unknown" 2502 tst_proto_inet_ntop="unknown" 2503 tst_compi_inet_ntop="unknown" 2504 tst_works_inet_ntop="unknown" 2505 tst_allow_inet_ntop="unknown" 2506 # 2507 AC_MSG_CHECKING([if inet_ntop can be linked]) 2508 AC_LINK_IFELSE([ 2509 AC_LANG_FUNC_LINK_TRY([inet_ntop]) 2510 ],[ 2511 AC_MSG_RESULT([yes]) 2512 tst_links_inet_ntop="yes" 2513 ],[ 2514 AC_MSG_RESULT([no]) 2515 tst_links_inet_ntop="no" 2516 ]) 2517 # 2518 if test "$tst_links_inet_ntop" = "yes"; then 2519 AC_MSG_CHECKING([if inet_ntop is prototyped]) 2520 AC_EGREP_CPP([inet_ntop],[ 2521 $curl_includes_arpa_inet 2522 ],[ 2523 AC_MSG_RESULT([yes]) 2524 tst_proto_inet_ntop="yes" 2525 ],[ 2526 AC_MSG_RESULT([no]) 2527 tst_proto_inet_ntop="no" 2528 ]) 2529 fi 2530 # 2531 if test "$tst_proto_inet_ntop" = "yes"; then 2532 AC_MSG_CHECKING([if inet_ntop is compilable]) 2533 AC_COMPILE_IFELSE([ 2534 AC_LANG_PROGRAM([[ 2535 $curl_includes_arpa_inet 2536 ]],[[ 2537 if(0 != inet_ntop(0, 0, 0, 0)) 2538 return 1; 2539 ]]) 2540 ],[ 2541 AC_MSG_RESULT([yes]) 2542 tst_compi_inet_ntop="yes" 2543 ],[ 2544 AC_MSG_RESULT([no]) 2545 tst_compi_inet_ntop="no" 2546 ]) 2547 fi 2548 # 2549 dnl only do runtime verification when not cross-compiling 2550 if test "x$cross_compiling" != "xyes" && 2551 test "$tst_compi_inet_ntop" = "yes"; then 2552 AC_MSG_CHECKING([if inet_ntop seems to work]) 2553 CURL_RUN_IFELSE([ 2554 AC_LANG_PROGRAM([[ 2555 $curl_includes_stdlib 2556 $curl_includes_arpa_inet 2557 $curl_includes_string 2558 ]],[[ 2559 char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; 2560 char ipv4res[sizeof "255.255.255.255"]; 2561 unsigned char ipv6a[26]; 2562 unsigned char ipv4a[5]; 2563 char *ipv6ptr = 0; 2564 char *ipv4ptr = 0; 2565 /* - */ 2566 ipv4res[0] = '\0'; 2567 ipv4a[0] = 0xc0; 2568 ipv4a[1] = 0xa8; 2569 ipv4a[2] = 0x64; 2570 ipv4a[3] = 0x01; 2571 ipv4a[4] = 0x01; 2572 /* - */ 2573 ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); 2574 if(!ipv4ptr) 2575 exit(1); /* fail */ 2576 if(ipv4ptr != ipv4res) 2577 exit(1); /* fail */ 2578 if(!ipv4ptr[0]) 2579 exit(1); /* fail */ 2580 if(memcmp(ipv4res, "192.168.100.1", 13) != 0) 2581 exit(1); /* fail */ 2582 /* - */ 2583 ipv6res[0] = '\0'; 2584 memset(ipv6a, 0, sizeof(ipv6a)); 2585 ipv6a[0] = 0xfe; 2586 ipv6a[1] = 0x80; 2587 ipv6a[8] = 0x02; 2588 ipv6a[9] = 0x14; 2589 ipv6a[10] = 0x4f; 2590 ipv6a[11] = 0xff; 2591 ipv6a[12] = 0xfe; 2592 ipv6a[13] = 0x0b; 2593 ipv6a[14] = 0x76; 2594 ipv6a[15] = 0xc8; 2595 ipv6a[25] = 0x01; 2596 /* - */ 2597 ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); 2598 if(!ipv6ptr) 2599 exit(1); /* fail */ 2600 if(ipv6ptr != ipv6res) 2601 exit(1); /* fail */ 2602 if(!ipv6ptr[0]) 2603 exit(1); /* fail */ 2604 if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) 2605 exit(1); /* fail */ 2606 /* - */ 2607 exit(0); 2608 ]]) 2609 ],[ 2610 AC_MSG_RESULT([yes]) 2611 tst_works_inet_ntop="yes" 2612 ],[ 2613 AC_MSG_RESULT([no]) 2614 tst_works_inet_ntop="no" 2615 ]) 2616 fi 2617 # 2618 if test "$tst_compi_inet_ntop" = "yes" && 2619 test "$tst_works_inet_ntop" != "no"; then 2620 AC_MSG_CHECKING([if inet_ntop usage allowed]) 2621 if test "x$curl_disallow_inet_ntop" != "xyes"; then 2622 AC_MSG_RESULT([yes]) 2623 tst_allow_inet_ntop="yes" 2624 else 2625 AC_MSG_RESULT([no]) 2626 tst_allow_inet_ntop="no" 2627 fi 2628 fi 2629 # 2630 AC_MSG_CHECKING([if inet_ntop might be used]) 2631 if test "$tst_links_inet_ntop" = "yes" && 2632 test "$tst_proto_inet_ntop" = "yes" && 2633 test "$tst_compi_inet_ntop" = "yes" && 2634 test "$tst_allow_inet_ntop" = "yes" && 2635 test "$tst_works_inet_ntop" != "no"; then 2636 AC_MSG_RESULT([yes]) 2637 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1, 2638 [Define to 1 if you have a IPv6 capable working inet_ntop function.]) 2639 curl_cv_func_inet_ntop="yes" 2640 else 2641 AC_MSG_RESULT([no]) 2642 curl_cv_func_inet_ntop="no" 2643 fi 2644]) 2645 2646 2647dnl CURL_CHECK_FUNC_INET_PTON 2648dnl ------------------------------------------------- 2649dnl Verify if inet_pton is available, prototyped, can 2650dnl be compiled and seems to work. If all of these are 2651dnl true, and usage has not been previously disallowed 2652dnl with shell variable curl_disallow_inet_pton, then 2653dnl HAVE_INET_PTON will be defined. 2654 2655AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [ 2656 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 2657 AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl 2658 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 2659 # 2660 tst_links_inet_pton="unknown" 2661 tst_proto_inet_pton="unknown" 2662 tst_compi_inet_pton="unknown" 2663 tst_works_inet_pton="unknown" 2664 tst_allow_inet_pton="unknown" 2665 # 2666 AC_MSG_CHECKING([if inet_pton can be linked]) 2667 AC_LINK_IFELSE([ 2668 AC_LANG_FUNC_LINK_TRY([inet_pton]) 2669 ],[ 2670 AC_MSG_RESULT([yes]) 2671 tst_links_inet_pton="yes" 2672 ],[ 2673 AC_MSG_RESULT([no]) 2674 tst_links_inet_pton="no" 2675 ]) 2676 # 2677 if test "$tst_links_inet_pton" = "yes"; then 2678 AC_MSG_CHECKING([if inet_pton is prototyped]) 2679 AC_EGREP_CPP([inet_pton],[ 2680 $curl_includes_arpa_inet 2681 ],[ 2682 AC_MSG_RESULT([yes]) 2683 tst_proto_inet_pton="yes" 2684 ],[ 2685 AC_MSG_RESULT([no]) 2686 tst_proto_inet_pton="no" 2687 ]) 2688 fi 2689 # 2690 if test "$tst_proto_inet_pton" = "yes"; then 2691 AC_MSG_CHECKING([if inet_pton is compilable]) 2692 AC_COMPILE_IFELSE([ 2693 AC_LANG_PROGRAM([[ 2694 $curl_includes_arpa_inet 2695 ]],[[ 2696 if(0 != inet_pton(0, 0, 0)) 2697 return 1; 2698 ]]) 2699 ],[ 2700 AC_MSG_RESULT([yes]) 2701 tst_compi_inet_pton="yes" 2702 ],[ 2703 AC_MSG_RESULT([no]) 2704 tst_compi_inet_pton="no" 2705 ]) 2706 fi 2707 # 2708 dnl only do runtime verification when not cross-compiling 2709 if test "x$cross_compiling" != "xyes" && 2710 test "$tst_compi_inet_pton" = "yes"; then 2711 AC_MSG_CHECKING([if inet_pton seems to work]) 2712 CURL_RUN_IFELSE([ 2713 AC_LANG_PROGRAM([[ 2714 $curl_includes_stdlib 2715 $curl_includes_arpa_inet 2716 $curl_includes_string 2717 ]],[[ 2718 unsigned char ipv6a[16+1]; 2719 unsigned char ipv4a[4+1]; 2720 const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; 2721 const char *ipv4src = "192.168.100.1"; 2722 /* - */ 2723 memset(ipv4a, 1, sizeof(ipv4a)); 2724 if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) 2725 exit(1); /* fail */ 2726 /* - */ 2727 if( (ipv4a[0] != 0xc0) || 2728 (ipv4a[1] != 0xa8) || 2729 (ipv4a[2] != 0x64) || 2730 (ipv4a[3] != 0x01) || 2731 (ipv4a[4] != 0x01) ) 2732 exit(1); /* fail */ 2733 /* - */ 2734 memset(ipv6a, 1, sizeof(ipv6a)); 2735 if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) 2736 exit(1); /* fail */ 2737 /* - */ 2738 if( (ipv6a[0] != 0xfe) || 2739 (ipv6a[1] != 0x80) || 2740 (ipv6a[8] != 0x02) || 2741 (ipv6a[9] != 0x14) || 2742 (ipv6a[10] != 0x4f) || 2743 (ipv6a[11] != 0xff) || 2744 (ipv6a[12] != 0xfe) || 2745 (ipv6a[13] != 0x0b) || 2746 (ipv6a[14] != 0x76) || 2747 (ipv6a[15] != 0xc8) || 2748 (ipv6a[16] != 0x01) ) 2749 exit(1); /* fail */ 2750 /* - */ 2751 if( (ipv6a[2] != 0x0) || 2752 (ipv6a[3] != 0x0) || 2753 (ipv6a[4] != 0x0) || 2754 (ipv6a[5] != 0x0) || 2755 (ipv6a[6] != 0x0) || 2756 (ipv6a[7] != 0x0) ) 2757 exit(1); /* fail */ 2758 /* - */ 2759 exit(0); 2760 ]]) 2761 ],[ 2762 AC_MSG_RESULT([yes]) 2763 tst_works_inet_pton="yes" 2764 ],[ 2765 AC_MSG_RESULT([no]) 2766 tst_works_inet_pton="no" 2767 ]) 2768 fi 2769 # 2770 if test "$tst_compi_inet_pton" = "yes" && 2771 test "$tst_works_inet_pton" != "no"; then 2772 AC_MSG_CHECKING([if inet_pton usage allowed]) 2773 if test "x$curl_disallow_inet_pton" != "xyes"; then 2774 AC_MSG_RESULT([yes]) 2775 tst_allow_inet_pton="yes" 2776 else 2777 AC_MSG_RESULT([no]) 2778 tst_allow_inet_pton="no" 2779 fi 2780 fi 2781 # 2782 AC_MSG_CHECKING([if inet_pton might be used]) 2783 if test "$tst_links_inet_pton" = "yes" && 2784 test "$tst_proto_inet_pton" = "yes" && 2785 test "$tst_compi_inet_pton" = "yes" && 2786 test "$tst_allow_inet_pton" = "yes" && 2787 test "$tst_works_inet_pton" != "no"; then 2788 AC_MSG_RESULT([yes]) 2789 AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1, 2790 [Define to 1 if you have a IPv6 capable working inet_pton function.]) 2791 curl_cv_func_inet_pton="yes" 2792 else 2793 AC_MSG_RESULT([no]) 2794 curl_cv_func_inet_pton="no" 2795 fi 2796]) 2797 2798 2799dnl CURL_CHECK_FUNC_IOCTL 2800dnl ------------------------------------------------- 2801dnl Verify if ioctl is available, prototyped, and 2802dnl can be compiled. If all of these are true, and 2803dnl usage has not been previously disallowed with 2804dnl shell variable curl_disallow_ioctl, then 2805dnl HAVE_IOCTL will be defined. 2806 2807AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [ 2808 AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl 2809 # 2810 tst_links_ioctl="unknown" 2811 tst_proto_ioctl="unknown" 2812 tst_compi_ioctl="unknown" 2813 tst_allow_ioctl="unknown" 2814 # 2815 AC_MSG_CHECKING([if ioctl can be linked]) 2816 AC_LINK_IFELSE([ 2817 AC_LANG_FUNC_LINK_TRY([ioctl]) 2818 ],[ 2819 AC_MSG_RESULT([yes]) 2820 tst_links_ioctl="yes" 2821 ],[ 2822 AC_MSG_RESULT([no]) 2823 tst_links_ioctl="no" 2824 ]) 2825 # 2826 if test "$tst_links_ioctl" = "yes"; then 2827 AC_MSG_CHECKING([if ioctl is prototyped]) 2828 AC_EGREP_CPP([ioctl],[ 2829 $curl_includes_stropts 2830 ],[ 2831 AC_MSG_RESULT([yes]) 2832 tst_proto_ioctl="yes" 2833 ],[ 2834 AC_MSG_RESULT([no]) 2835 tst_proto_ioctl="no" 2836 ]) 2837 fi 2838 # 2839 if test "$tst_proto_ioctl" = "yes"; then 2840 AC_MSG_CHECKING([if ioctl is compilable]) 2841 AC_COMPILE_IFELSE([ 2842 AC_LANG_PROGRAM([[ 2843 $curl_includes_stropts 2844 ]],[[ 2845 if(0 != ioctl(0, 0, 0)) 2846 return 1; 2847 ]]) 2848 ],[ 2849 AC_MSG_RESULT([yes]) 2850 tst_compi_ioctl="yes" 2851 ],[ 2852 AC_MSG_RESULT([no]) 2853 tst_compi_ioctl="no" 2854 ]) 2855 fi 2856 # 2857 if test "$tst_compi_ioctl" = "yes"; then 2858 AC_MSG_CHECKING([if ioctl usage allowed]) 2859 if test "x$curl_disallow_ioctl" != "xyes"; then 2860 AC_MSG_RESULT([yes]) 2861 tst_allow_ioctl="yes" 2862 else 2863 AC_MSG_RESULT([no]) 2864 tst_allow_ioctl="no" 2865 fi 2866 fi 2867 # 2868 AC_MSG_CHECKING([if ioctl might be used]) 2869 if test "$tst_links_ioctl" = "yes" && 2870 test "$tst_proto_ioctl" = "yes" && 2871 test "$tst_compi_ioctl" = "yes" && 2872 test "$tst_allow_ioctl" = "yes"; then 2873 AC_MSG_RESULT([yes]) 2874 AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1, 2875 [Define to 1 if you have the ioctl function.]) 2876 curl_cv_func_ioctl="yes" 2877 CURL_CHECK_FUNC_IOCTL_FIONBIO 2878 CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR 2879 else 2880 AC_MSG_RESULT([no]) 2881 curl_cv_func_ioctl="no" 2882 fi 2883]) 2884 2885 2886dnl CURL_CHECK_FUNC_IOCTL_FIONBIO 2887dnl ------------------------------------------------- 2888dnl Verify if ioctl with the FIONBIO command is 2889dnl available, can be compiled, and seems to work. If 2890dnl all of these are true, then HAVE_IOCTL_FIONBIO 2891dnl will be defined. 2892 2893AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [ 2894 # 2895 tst_compi_ioctl_fionbio="unknown" 2896 tst_allow_ioctl_fionbio="unknown" 2897 # 2898 if test "$curl_cv_func_ioctl" = "yes"; then 2899 AC_MSG_CHECKING([if ioctl FIONBIO is compilable]) 2900 AC_COMPILE_IFELSE([ 2901 AC_LANG_PROGRAM([[ 2902 $curl_includes_stropts 2903 ]],[[ 2904 int flags = 0; 2905 if(0 != ioctl(0, FIONBIO, &flags)) 2906 return 1; 2907 ]]) 2908 ],[ 2909 AC_MSG_RESULT([yes]) 2910 tst_compi_ioctl_fionbio="yes" 2911 ],[ 2912 AC_MSG_RESULT([no]) 2913 tst_compi_ioctl_fionbio="no" 2914 ]) 2915 fi 2916 # 2917 if test "$tst_compi_ioctl_fionbio" = "yes"; then 2918 AC_MSG_CHECKING([if ioctl FIONBIO usage allowed]) 2919 if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then 2920 AC_MSG_RESULT([yes]) 2921 tst_allow_ioctl_fionbio="yes" 2922 else 2923 AC_MSG_RESULT([no]) 2924 tst_allow_ioctl_fionbio="no" 2925 fi 2926 fi 2927 # 2928 AC_MSG_CHECKING([if ioctl FIONBIO might be used]) 2929 if test "$tst_compi_ioctl_fionbio" = "yes" && 2930 test "$tst_allow_ioctl_fionbio" = "yes"; then 2931 AC_MSG_RESULT([yes]) 2932 AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1, 2933 [Define to 1 if you have a working ioctl FIONBIO function.]) 2934 curl_cv_func_ioctl_fionbio="yes" 2935 else 2936 AC_MSG_RESULT([no]) 2937 curl_cv_func_ioctl_fionbio="no" 2938 fi 2939]) 2940 2941 2942dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR 2943dnl ------------------------------------------------- 2944dnl Verify if ioctl with the SIOCGIFADDR command is available, 2945dnl struct ifreq is defined, they can be compiled, and seem to 2946dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR 2947dnl will be defined. 2948 2949AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [ 2950 # 2951 tst_compi_ioctl_siocgifaddr="unknown" 2952 tst_allow_ioctl_siocgifaddr="unknown" 2953 # 2954 if test "$curl_cv_func_ioctl" = "yes"; then 2955 AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable]) 2956 AC_COMPILE_IFELSE([ 2957 AC_LANG_PROGRAM([[ 2958 $curl_includes_stropts 2959 #include <net/if.h> 2960 ]],[[ 2961 struct ifreq ifr; 2962 if(0 != ioctl(0, SIOCGIFADDR, &ifr)) 2963 return 1; 2964 ]]) 2965 ],[ 2966 AC_MSG_RESULT([yes]) 2967 tst_compi_ioctl_siocgifaddr="yes" 2968 ],[ 2969 AC_MSG_RESULT([no]) 2970 tst_compi_ioctl_siocgifaddr="no" 2971 ]) 2972 fi 2973 # 2974 if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then 2975 AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed]) 2976 if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then 2977 AC_MSG_RESULT([yes]) 2978 tst_allow_ioctl_siocgifaddr="yes" 2979 else 2980 AC_MSG_RESULT([no]) 2981 tst_allow_ioctl_siocgifaddr="no" 2982 fi 2983 fi 2984 # 2985 AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used]) 2986 if test "$tst_compi_ioctl_siocgifaddr" = "yes" && 2987 test "$tst_allow_ioctl_siocgifaddr" = "yes"; then 2988 AC_MSG_RESULT([yes]) 2989 AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1, 2990 [Define to 1 if you have a working ioctl SIOCGIFADDR function.]) 2991 curl_cv_func_ioctl_siocgifaddr="yes" 2992 else 2993 AC_MSG_RESULT([no]) 2994 curl_cv_func_ioctl_siocgifaddr="no" 2995 fi 2996]) 2997 2998 2999dnl CURL_CHECK_FUNC_IOCTLSOCKET 3000dnl ------------------------------------------------- 3001dnl Verify if ioctlsocket is available, prototyped, and 3002dnl can be compiled. If all of these are true, and 3003dnl usage has not been previously disallowed with 3004dnl shell variable curl_disallow_ioctlsocket, then 3005dnl HAVE_IOCTLSOCKET will be defined. 3006 3007AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [ 3008 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 3009 # 3010 tst_links_ioctlsocket="unknown" 3011 tst_proto_ioctlsocket="unknown" 3012 tst_compi_ioctlsocket="unknown" 3013 tst_allow_ioctlsocket="unknown" 3014 # 3015 AC_MSG_CHECKING([if ioctlsocket can be linked]) 3016 AC_LINK_IFELSE([ 3017 AC_LANG_PROGRAM([[ 3018 $curl_includes_winsock2 3019 ]],[[ 3020 if(0 != ioctlsocket(0, 0, 0)) 3021 return 1; 3022 ]]) 3023 ],[ 3024 AC_MSG_RESULT([yes]) 3025 tst_links_ioctlsocket="yes" 3026 ],[ 3027 AC_MSG_RESULT([no]) 3028 tst_links_ioctlsocket="no" 3029 ]) 3030 # 3031 if test "$tst_links_ioctlsocket" = "yes"; then 3032 AC_MSG_CHECKING([if ioctlsocket is prototyped]) 3033 AC_EGREP_CPP([ioctlsocket],[ 3034 $curl_includes_winsock2 3035 ],[ 3036 AC_MSG_RESULT([yes]) 3037 tst_proto_ioctlsocket="yes" 3038 ],[ 3039 AC_MSG_RESULT([no]) 3040 tst_proto_ioctlsocket="no" 3041 ]) 3042 fi 3043 # 3044 if test "$tst_proto_ioctlsocket" = "yes"; then 3045 AC_MSG_CHECKING([if ioctlsocket is compilable]) 3046 AC_COMPILE_IFELSE([ 3047 AC_LANG_PROGRAM([[ 3048 $curl_includes_winsock2 3049 ]],[[ 3050 if(0 != ioctlsocket(0, 0, 0)) 3051 return 1; 3052 ]]) 3053 ],[ 3054 AC_MSG_RESULT([yes]) 3055 tst_compi_ioctlsocket="yes" 3056 ],[ 3057 AC_MSG_RESULT([no]) 3058 tst_compi_ioctlsocket="no" 3059 ]) 3060 fi 3061 # 3062 if test "$tst_compi_ioctlsocket" = "yes"; then 3063 AC_MSG_CHECKING([if ioctlsocket usage allowed]) 3064 if test "x$curl_disallow_ioctlsocket" != "xyes"; then 3065 AC_MSG_RESULT([yes]) 3066 tst_allow_ioctlsocket="yes" 3067 else 3068 AC_MSG_RESULT([no]) 3069 tst_allow_ioctlsocket="no" 3070 fi 3071 fi 3072 # 3073 AC_MSG_CHECKING([if ioctlsocket might be used]) 3074 if test "$tst_links_ioctlsocket" = "yes" && 3075 test "$tst_proto_ioctlsocket" = "yes" && 3076 test "$tst_compi_ioctlsocket" = "yes" && 3077 test "$tst_allow_ioctlsocket" = "yes"; then 3078 AC_MSG_RESULT([yes]) 3079 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1, 3080 [Define to 1 if you have the ioctlsocket function.]) 3081 curl_cv_func_ioctlsocket="yes" 3082 CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO 3083 else 3084 AC_MSG_RESULT([no]) 3085 curl_cv_func_ioctlsocket="no" 3086 fi 3087]) 3088 3089 3090dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO 3091dnl ------------------------------------------------- 3092dnl Verify if ioctlsocket with the FIONBIO command is 3093dnl available, can be compiled, and seems to work. If 3094dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO 3095dnl will be defined. 3096 3097AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [ 3098 # 3099 tst_compi_ioctlsocket_fionbio="unknown" 3100 tst_allow_ioctlsocket_fionbio="unknown" 3101 # 3102 if test "$curl_cv_func_ioctlsocket" = "yes"; then 3103 AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable]) 3104 AC_COMPILE_IFELSE([ 3105 AC_LANG_PROGRAM([[ 3106 $curl_includes_winsock2 3107 ]],[[ 3108 unsigned long flags = 0; 3109 if(0 != ioctlsocket(0, FIONBIO, &flags)) 3110 return 1; 3111 ]]) 3112 ],[ 3113 AC_MSG_RESULT([yes]) 3114 tst_compi_ioctlsocket_fionbio="yes" 3115 ],[ 3116 AC_MSG_RESULT([no]) 3117 tst_compi_ioctlsocket_fionbio="no" 3118 ]) 3119 fi 3120 # 3121 if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then 3122 AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed]) 3123 if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then 3124 AC_MSG_RESULT([yes]) 3125 tst_allow_ioctlsocket_fionbio="yes" 3126 else 3127 AC_MSG_RESULT([no]) 3128 tst_allow_ioctlsocket_fionbio="no" 3129 fi 3130 fi 3131 # 3132 AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used]) 3133 if test "$tst_compi_ioctlsocket_fionbio" = "yes" && 3134 test "$tst_allow_ioctlsocket_fionbio" = "yes"; then 3135 AC_MSG_RESULT([yes]) 3136 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1, 3137 [Define to 1 if you have a working ioctlsocket FIONBIO function.]) 3138 curl_cv_func_ioctlsocket_fionbio="yes" 3139 else 3140 AC_MSG_RESULT([no]) 3141 curl_cv_func_ioctlsocket_fionbio="no" 3142 fi 3143]) 3144 3145 3146dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL 3147dnl ------------------------------------------------- 3148dnl Verify if IoctlSocket is available, prototyped, and 3149dnl can be compiled. If all of these are true, and 3150dnl usage has not been previously disallowed with 3151dnl shell variable curl_disallow_ioctlsocket_camel, 3152dnl then HAVE_IOCTLSOCKET_CAMEL will be defined. 3153 3154AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [ 3155 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 3156 # 3157 tst_links_ioctlsocket_camel="unknown" 3158 tst_proto_ioctlsocket_camel="unknown" 3159 tst_compi_ioctlsocket_camel="unknown" 3160 tst_allow_ioctlsocket_camel="unknown" 3161 # 3162 AC_MSG_CHECKING([if IoctlSocket can be linked]) 3163 AC_LINK_IFELSE([ 3164 AC_LANG_PROGRAM([[ 3165 $curl_includes_bsdsocket 3166 ]],[[ 3167 IoctlSocket(0, 0, 0); 3168 ]]) 3169 ],[ 3170 AC_MSG_RESULT([yes]) 3171 tst_links_ioctlsocket_camel="yes" 3172 ],[ 3173 AC_MSG_RESULT([no]) 3174 tst_links_ioctlsocket_camel="no" 3175 ]) 3176 # 3177 if test "$tst_links_ioctlsocket_camel" = "yes"; then 3178 AC_MSG_CHECKING([if IoctlSocket is prototyped]) 3179 AC_EGREP_CPP([IoctlSocket],[ 3180 $curl_includes_bsdsocket 3181 ],[ 3182 AC_MSG_RESULT([yes]) 3183 tst_proto_ioctlsocket_camel="yes" 3184 ],[ 3185 AC_MSG_RESULT([no]) 3186 tst_proto_ioctlsocket_camel="no" 3187 ]) 3188 fi 3189 # 3190 if test "$tst_proto_ioctlsocket_camel" = "yes"; then 3191 AC_MSG_CHECKING([if IoctlSocket is compilable]) 3192 AC_COMPILE_IFELSE([ 3193 AC_LANG_PROGRAM([[ 3194 $curl_includes_bsdsocket 3195 ]],[[ 3196 if(0 != IoctlSocket(0, 0, 0)) 3197 return 1; 3198 ]]) 3199 ],[ 3200 AC_MSG_RESULT([yes]) 3201 tst_compi_ioctlsocket_camel="yes" 3202 ],[ 3203 AC_MSG_RESULT([no]) 3204 tst_compi_ioctlsocket_camel="no" 3205 ]) 3206 fi 3207 # 3208 if test "$tst_compi_ioctlsocket_camel" = "yes"; then 3209 AC_MSG_CHECKING([if IoctlSocket usage allowed]) 3210 if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then 3211 AC_MSG_RESULT([yes]) 3212 tst_allow_ioctlsocket_camel="yes" 3213 else 3214 AC_MSG_RESULT([no]) 3215 tst_allow_ioctlsocket_camel="no" 3216 fi 3217 fi 3218 # 3219 AC_MSG_CHECKING([if IoctlSocket might be used]) 3220 if test "$tst_links_ioctlsocket_camel" = "yes" && 3221 test "$tst_proto_ioctlsocket_camel" = "yes" && 3222 test "$tst_compi_ioctlsocket_camel" = "yes" && 3223 test "$tst_allow_ioctlsocket_camel" = "yes"; then 3224 AC_MSG_RESULT([yes]) 3225 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1, 3226 [Define to 1 if you have the IoctlSocket camel case function.]) 3227 curl_cv_func_ioctlsocket_camel="yes" 3228 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO 3229 else 3230 AC_MSG_RESULT([no]) 3231 curl_cv_func_ioctlsocket_camel="no" 3232 fi 3233]) 3234 3235 3236dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO 3237dnl ------------------------------------------------- 3238dnl Verify if IoctlSocket with FIONBIO command is available, 3239dnl can be compiled, and seems to work. If all of these are 3240dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined. 3241 3242AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [ 3243 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 3244 # 3245 tst_compi_ioctlsocket_camel_fionbio="unknown" 3246 tst_allow_ioctlsocket_camel_fionbio="unknown" 3247 # 3248 if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then 3249 AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable]) 3250 AC_COMPILE_IFELSE([ 3251 AC_LANG_PROGRAM([[ 3252 $curl_includes_bsdsocket 3253 ]],[[ 3254 long flags = 0; 3255 if(0 != IoctlSocket(0, FIONBIO, &flags)) 3256 return 1; 3257 ]]) 3258 ],[ 3259 AC_MSG_RESULT([yes]) 3260 tst_compi_ioctlsocket_camel_fionbio="yes" 3261 ],[ 3262 AC_MSG_RESULT([no]) 3263 tst_compi_ioctlsocket_camel_fionbio="no" 3264 ]) 3265 fi 3266 # 3267 if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then 3268 AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed]) 3269 if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then 3270 AC_MSG_RESULT([yes]) 3271 tst_allow_ioctlsocket_camel_fionbio="yes" 3272 else 3273 AC_MSG_RESULT([no]) 3274 tst_allow_ioctlsocket_camel_fionbio="no" 3275 fi 3276 fi 3277 # 3278 AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used]) 3279 if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && 3280 test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then 3281 AC_MSG_RESULT([yes]) 3282 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1, 3283 [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.]) 3284 curl_cv_func_ioctlsocket_camel_fionbio="yes" 3285 else 3286 AC_MSG_RESULT([no]) 3287 curl_cv_func_ioctlsocket_camel_fionbio="no" 3288 fi 3289]) 3290 3291 3292dnl CURL_CHECK_FUNC_MEMRCHR 3293dnl ------------------------------------------------- 3294dnl Verify if memrchr is available, prototyped, and 3295dnl can be compiled. If all of these are true, and 3296dnl usage has not been previously disallowed with 3297dnl shell variable curl_disallow_memrchr, then 3298dnl HAVE_MEMRCHR will be defined. 3299 3300AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [ 3301 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 3302 # 3303 tst_links_memrchr="unknown" 3304 tst_macro_memrchr="unknown" 3305 tst_proto_memrchr="unknown" 3306 tst_compi_memrchr="unknown" 3307 tst_allow_memrchr="unknown" 3308 # 3309 AC_MSG_CHECKING([if memrchr can be linked]) 3310 AC_LINK_IFELSE([ 3311 AC_LANG_FUNC_LINK_TRY([memrchr]) 3312 ],[ 3313 AC_MSG_RESULT([yes]) 3314 tst_links_memrchr="yes" 3315 ],[ 3316 AC_MSG_RESULT([no]) 3317 tst_links_memrchr="no" 3318 ]) 3319 # 3320 if test "$tst_links_memrchr" = "no"; then 3321 AC_MSG_CHECKING([if memrchr seems a macro]) 3322 AC_LINK_IFELSE([ 3323 AC_LANG_PROGRAM([[ 3324 $curl_includes_string 3325 ]],[[ 3326 if(0 != memrchr(0, 0, 0)) 3327 return 1; 3328 ]]) 3329 ],[ 3330 AC_MSG_RESULT([yes]) 3331 tst_macro_memrchr="yes" 3332 ],[ 3333 AC_MSG_RESULT([no]) 3334 tst_macro_memrchr="no" 3335 ]) 3336 fi 3337 # 3338 if test "$tst_links_memrchr" = "yes"; then 3339 AC_MSG_CHECKING([if memrchr is prototyped]) 3340 AC_EGREP_CPP([memrchr],[ 3341 $curl_includes_string 3342 ],[ 3343 AC_MSG_RESULT([yes]) 3344 tst_proto_memrchr="yes" 3345 ],[ 3346 AC_MSG_RESULT([no]) 3347 tst_proto_memrchr="no" 3348 ]) 3349 fi 3350 # 3351 if test "$tst_proto_memrchr" = "yes" || 3352 test "$tst_macro_memrchr" = "yes"; then 3353 AC_MSG_CHECKING([if memrchr is compilable]) 3354 AC_COMPILE_IFELSE([ 3355 AC_LANG_PROGRAM([[ 3356 $curl_includes_string 3357 ]],[[ 3358 if(0 != memrchr(0, 0, 0)) 3359 return 1; 3360 ]]) 3361 ],[ 3362 AC_MSG_RESULT([yes]) 3363 tst_compi_memrchr="yes" 3364 ],[ 3365 AC_MSG_RESULT([no]) 3366 tst_compi_memrchr="no" 3367 ]) 3368 fi 3369 # 3370 if test "$tst_compi_memrchr" = "yes"; then 3371 AC_MSG_CHECKING([if memrchr usage allowed]) 3372 if test "x$curl_disallow_memrchr" != "xyes"; then 3373 AC_MSG_RESULT([yes]) 3374 tst_allow_memrchr="yes" 3375 else 3376 AC_MSG_RESULT([no]) 3377 tst_allow_memrchr="no" 3378 fi 3379 fi 3380 # 3381 AC_MSG_CHECKING([if memrchr might be used]) 3382 if (test "$tst_proto_memrchr" = "yes" || 3383 test "$tst_macro_memrchr" = "yes") && 3384 test "$tst_compi_memrchr" = "yes" && 3385 test "$tst_allow_memrchr" = "yes"; then 3386 AC_MSG_RESULT([yes]) 3387 AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1, 3388 [Define to 1 if you have the memrchr function or macro.]) 3389 curl_cv_func_memrchr="yes" 3390 else 3391 AC_MSG_RESULT([no]) 3392 curl_cv_func_memrchr="no" 3393 fi 3394]) 3395 3396 3397dnl CURL_CHECK_FUNC_POLL 3398dnl ------------------------------------------------- 3399dnl Verify if poll is available, prototyped, can 3400dnl be compiled and seems to work. 3401 3402AC_DEFUN([CURL_CHECK_FUNC_POLL], [ 3403 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 3404 AC_REQUIRE([CURL_INCLUDES_POLL])dnl 3405 # 3406 tst_links_poll="unknown" 3407 tst_proto_poll="unknown" 3408 tst_compi_poll="unknown" 3409 tst_works_poll="unknown" 3410 tst_allow_poll="unknown" 3411 # 3412 case $host_os in 3413 darwin*|interix*) 3414 dnl poll() does not work on these platforms 3415 dnl Interix: "does provide poll(), but the implementing developer must 3416 dnl have been in a bad mood, because poll() only works on the /proc 3417 dnl filesystem here" 3418 dnl macOS: poll() first didn't exist, then was broken until fixed in 10.9 3419 dnl only to break again in 10.12. 3420 curl_disallow_poll="yes" 3421 tst_compi_poll="no" 3422 ;; 3423 esac 3424 # 3425 AC_MSG_CHECKING([if poll can be linked]) 3426 AC_LINK_IFELSE([ 3427 AC_LANG_PROGRAM([[ 3428 $curl_includes_poll 3429 ]],[[ 3430 if(0 != poll(0, 0, 0)) 3431 return 1; 3432 ]]) 3433 ],[ 3434 AC_MSG_RESULT([yes]) 3435 tst_links_poll="yes" 3436 ],[ 3437 AC_MSG_RESULT([no]) 3438 tst_links_poll="no" 3439 ]) 3440 # 3441 if test "$tst_links_poll" = "yes"; then 3442 AC_MSG_CHECKING([if poll is prototyped]) 3443 AC_EGREP_CPP([poll],[ 3444 $curl_includes_poll 3445 ],[ 3446 AC_MSG_RESULT([yes]) 3447 tst_proto_poll="yes" 3448 ],[ 3449 AC_MSG_RESULT([no]) 3450 tst_proto_poll="no" 3451 ]) 3452 fi 3453 # 3454 if test "$tst_proto_poll" = "yes"; then 3455 AC_MSG_CHECKING([if poll is compilable]) 3456 AC_COMPILE_IFELSE([ 3457 AC_LANG_PROGRAM([[ 3458 $curl_includes_poll 3459 ]],[[ 3460 if(0 != poll(0, 0, 0)) 3461 return 1; 3462 ]]) 3463 ],[ 3464 AC_MSG_RESULT([yes]) 3465 tst_compi_poll="yes" 3466 ],[ 3467 AC_MSG_RESULT([no]) 3468 tst_compi_poll="no" 3469 ]) 3470 fi 3471 # 3472 dnl only do runtime verification when not cross-compiling 3473 if test "x$cross_compiling" != "xyes" && 3474 test "$tst_compi_poll" = "yes"; then 3475 AC_MSG_CHECKING([if poll seems to work]) 3476 CURL_RUN_IFELSE([ 3477 AC_LANG_PROGRAM([[ 3478 $curl_includes_stdlib 3479 $curl_includes_poll 3480 $curl_includes_time 3481 ]],[[ 3482 /* detect the original poll() breakage */ 3483 if(0 != poll(0, 0, 10)) 3484 exit(1); /* fail */ 3485 else { 3486 /* detect the 10.12 poll() breakage */ 3487 struct timeval before, after; 3488 int rc; 3489 size_t us; 3490 3491 gettimeofday(&before, NULL); 3492 rc = poll(NULL, 0, 500); 3493 gettimeofday(&after, NULL); 3494 3495 us = (after.tv_sec - before.tv_sec) * 1000000 + 3496 (after.tv_usec - before.tv_usec); 3497 3498 if(us < 400000) 3499 exit(1); 3500 } 3501 ]]) 3502 ],[ 3503 AC_MSG_RESULT([yes]) 3504 tst_works_poll="yes" 3505 ],[ 3506 AC_MSG_RESULT([no]) 3507 tst_works_poll="no" 3508 ]) 3509 fi 3510 # 3511 if test "$tst_compi_poll" = "yes" && 3512 test "$tst_works_poll" != "no"; then 3513 AC_MSG_CHECKING([if poll usage allowed]) 3514 if test "x$curl_disallow_poll" != "xyes"; then 3515 AC_MSG_RESULT([yes]) 3516 tst_allow_poll="yes" 3517 else 3518 AC_MSG_RESULT([no]) 3519 tst_allow_poll="no" 3520 fi 3521 fi 3522 # 3523 AC_MSG_CHECKING([if poll might be used]) 3524 if test "$tst_links_poll" = "yes" && 3525 test "$tst_proto_poll" = "yes" && 3526 test "$tst_compi_poll" = "yes" && 3527 test "$tst_allow_poll" = "yes" && 3528 test "$tst_works_poll" != "no"; then 3529 AC_MSG_RESULT([yes]) 3530 AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1, 3531 [If you have a fine poll]) 3532 curl_cv_func_poll="yes" 3533 else 3534 AC_MSG_RESULT([no]) 3535 curl_cv_func_poll="no" 3536 fi 3537]) 3538 3539 3540 fi 3541]) 3542 3543 3544dnl CURL_CHECK_FUNC_SIGACTION 3545dnl ------------------------------------------------- 3546dnl Verify if sigaction is available, prototyped, and 3547dnl can be compiled. If all of these are true, and 3548dnl usage has not been previously disallowed with 3549dnl shell variable curl_disallow_sigaction, then 3550dnl HAVE_SIGACTION will be defined. 3551 3552AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [ 3553 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 3554 # 3555 tst_links_sigaction="unknown" 3556 tst_proto_sigaction="unknown" 3557 tst_compi_sigaction="unknown" 3558 tst_allow_sigaction="unknown" 3559 # 3560 AC_MSG_CHECKING([if sigaction can be linked]) 3561 AC_LINK_IFELSE([ 3562 AC_LANG_FUNC_LINK_TRY([sigaction]) 3563 ],[ 3564 AC_MSG_RESULT([yes]) 3565 tst_links_sigaction="yes" 3566 ],[ 3567 AC_MSG_RESULT([no]) 3568 tst_links_sigaction="no" 3569 ]) 3570 # 3571 if test "$tst_links_sigaction" = "yes"; then 3572 AC_MSG_CHECKING([if sigaction is prototyped]) 3573 AC_EGREP_CPP([sigaction],[ 3574 $curl_includes_signal 3575 ],[ 3576 AC_MSG_RESULT([yes]) 3577 tst_proto_sigaction="yes" 3578 ],[ 3579 AC_MSG_RESULT([no]) 3580 tst_proto_sigaction="no" 3581 ]) 3582 fi 3583 # 3584 if test "$tst_proto_sigaction" = "yes"; then 3585 AC_MSG_CHECKING([if sigaction is compilable]) 3586 AC_COMPILE_IFELSE([ 3587 AC_LANG_PROGRAM([[ 3588 $curl_includes_signal 3589 ]],[[ 3590 if(0 != sigaction(0, 0, 0)) 3591 return 1; 3592 ]]) 3593 ],[ 3594 AC_MSG_RESULT([yes]) 3595 tst_compi_sigaction="yes" 3596 ],[ 3597 AC_MSG_RESULT([no]) 3598 tst_compi_sigaction="no" 3599 ]) 3600 fi 3601 # 3602 if test "$tst_compi_sigaction" = "yes"; then 3603 AC_MSG_CHECKING([if sigaction usage allowed]) 3604 if test "x$curl_disallow_sigaction" != "xyes"; then 3605 AC_MSG_RESULT([yes]) 3606 tst_allow_sigaction="yes" 3607 else 3608 AC_MSG_RESULT([no]) 3609 tst_allow_sigaction="no" 3610 fi 3611 fi 3612 # 3613 AC_MSG_CHECKING([if sigaction might be used]) 3614 if test "$tst_links_sigaction" = "yes" && 3615 test "$tst_proto_sigaction" = "yes" && 3616 test "$tst_compi_sigaction" = "yes" && 3617 test "$tst_allow_sigaction" = "yes"; then 3618 AC_MSG_RESULT([yes]) 3619 AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1, 3620 [Define to 1 if you have the sigaction function.]) 3621 curl_cv_func_sigaction="yes" 3622 else 3623 AC_MSG_RESULT([no]) 3624 curl_cv_func_sigaction="no" 3625 fi 3626]) 3627 3628 3629dnl CURL_CHECK_FUNC_SIGINTERRUPT 3630dnl ------------------------------------------------- 3631dnl Verify if siginterrupt is available, prototyped, and 3632dnl can be compiled. If all of these are true, and 3633dnl usage has not been previously disallowed with 3634dnl shell variable curl_disallow_siginterrupt, then 3635dnl HAVE_SIGINTERRUPT will be defined. 3636 3637AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [ 3638 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 3639 # 3640 tst_links_siginterrupt="unknown" 3641 tst_proto_siginterrupt="unknown" 3642 tst_compi_siginterrupt="unknown" 3643 tst_allow_siginterrupt="unknown" 3644 # 3645 AC_MSG_CHECKING([if siginterrupt can be linked]) 3646 AC_LINK_IFELSE([ 3647 AC_LANG_FUNC_LINK_TRY([siginterrupt]) 3648 ],[ 3649 AC_MSG_RESULT([yes]) 3650 tst_links_siginterrupt="yes" 3651 ],[ 3652 AC_MSG_RESULT([no]) 3653 tst_links_siginterrupt="no" 3654 ]) 3655 # 3656 if test "$tst_links_siginterrupt" = "yes"; then 3657 AC_MSG_CHECKING([if siginterrupt is prototyped]) 3658 AC_EGREP_CPP([siginterrupt],[ 3659 $curl_includes_signal 3660 ],[ 3661 AC_MSG_RESULT([yes]) 3662 tst_proto_siginterrupt="yes" 3663 ],[ 3664 AC_MSG_RESULT([no]) 3665 tst_proto_siginterrupt="no" 3666 ]) 3667 fi 3668 # 3669 if test "$tst_proto_siginterrupt" = "yes"; then 3670 AC_MSG_CHECKING([if siginterrupt is compilable]) 3671 AC_COMPILE_IFELSE([ 3672 AC_LANG_PROGRAM([[ 3673 $curl_includes_signal 3674 ]],[[ 3675 if(0 != siginterrupt(0, 0)) 3676 return 1; 3677 ]]) 3678 ],[ 3679 AC_MSG_RESULT([yes]) 3680 tst_compi_siginterrupt="yes" 3681 ],[ 3682 AC_MSG_RESULT([no]) 3683 tst_compi_siginterrupt="no" 3684 ]) 3685 fi 3686 # 3687 if test "$tst_compi_siginterrupt" = "yes"; then 3688 AC_MSG_CHECKING([if siginterrupt usage allowed]) 3689 if test "x$curl_disallow_siginterrupt" != "xyes"; then 3690 AC_MSG_RESULT([yes]) 3691 tst_allow_siginterrupt="yes" 3692 else 3693 AC_MSG_RESULT([no]) 3694 tst_allow_siginterrupt="no" 3695 fi 3696 fi 3697 # 3698 AC_MSG_CHECKING([if siginterrupt might be used]) 3699 if test "$tst_links_siginterrupt" = "yes" && 3700 test "$tst_proto_siginterrupt" = "yes" && 3701 test "$tst_compi_siginterrupt" = "yes" && 3702 test "$tst_allow_siginterrupt" = "yes"; then 3703 AC_MSG_RESULT([yes]) 3704 AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1, 3705 [Define to 1 if you have the siginterrupt function.]) 3706 curl_cv_func_siginterrupt="yes" 3707 else 3708 AC_MSG_RESULT([no]) 3709 curl_cv_func_siginterrupt="no" 3710 fi 3711]) 3712 3713 3714dnl CURL_CHECK_FUNC_SIGNAL 3715dnl ------------------------------------------------- 3716dnl Verify if signal is available, prototyped, and 3717dnl can be compiled. If all of these are true, and 3718dnl usage has not been previously disallowed with 3719dnl shell variable curl_disallow_signal, then 3720dnl HAVE_SIGNAL will be defined. 3721 3722AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [ 3723 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 3724 # 3725 tst_links_signal="unknown" 3726 tst_proto_signal="unknown" 3727 tst_compi_signal="unknown" 3728 tst_allow_signal="unknown" 3729 # 3730 AC_MSG_CHECKING([if signal can be linked]) 3731 AC_LINK_IFELSE([ 3732 AC_LANG_FUNC_LINK_TRY([signal]) 3733 ],[ 3734 AC_MSG_RESULT([yes]) 3735 tst_links_signal="yes" 3736 ],[ 3737 AC_MSG_RESULT([no]) 3738 tst_links_signal="no" 3739 ]) 3740 # 3741 if test "$tst_links_signal" = "yes"; then 3742 AC_MSG_CHECKING([if signal is prototyped]) 3743 AC_EGREP_CPP([signal],[ 3744 $curl_includes_signal 3745 ],[ 3746 AC_MSG_RESULT([yes]) 3747 tst_proto_signal="yes" 3748 ],[ 3749 AC_MSG_RESULT([no]) 3750 tst_proto_signal="no" 3751 ]) 3752 fi 3753 # 3754 if test "$tst_proto_signal" = "yes"; then 3755 AC_MSG_CHECKING([if signal is compilable]) 3756 AC_COMPILE_IFELSE([ 3757 AC_LANG_PROGRAM([[ 3758 $curl_includes_signal 3759 ]],[[ 3760 if(0 != signal(0, 0)) 3761 return 1; 3762 ]]) 3763 ],[ 3764 AC_MSG_RESULT([yes]) 3765 tst_compi_signal="yes" 3766 ],[ 3767 AC_MSG_RESULT([no]) 3768 tst_compi_signal="no" 3769 ]) 3770 fi 3771 # 3772 if test "$tst_compi_signal" = "yes"; then 3773 AC_MSG_CHECKING([if signal usage allowed]) 3774 if test "x$curl_disallow_signal" != "xyes"; then 3775 AC_MSG_RESULT([yes]) 3776 tst_allow_signal="yes" 3777 else 3778 AC_MSG_RESULT([no]) 3779 tst_allow_signal="no" 3780 fi 3781 fi 3782 # 3783 AC_MSG_CHECKING([if signal might be used]) 3784 if test "$tst_links_signal" = "yes" && 3785 test "$tst_proto_signal" = "yes" && 3786 test "$tst_compi_signal" = "yes" && 3787 test "$tst_allow_signal" = "yes"; then 3788 AC_MSG_RESULT([yes]) 3789 AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1, 3790 [Define to 1 if you have the signal function.]) 3791 curl_cv_func_signal="yes" 3792 else 3793 AC_MSG_RESULT([no]) 3794 curl_cv_func_signal="no" 3795 fi 3796]) 3797 3798 3799dnl CURL_CHECK_FUNC_SIGSETJMP 3800dnl ------------------------------------------------- 3801dnl Verify if sigsetjmp is available, prototyped, and 3802dnl can be compiled. If all of these are true, and 3803dnl usage has not been previously disallowed with 3804dnl shell variable curl_disallow_sigsetjmp, then 3805dnl HAVE_SIGSETJMP will be defined. 3806 3807AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [ 3808 AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl 3809 # 3810 tst_links_sigsetjmp="unknown" 3811 tst_macro_sigsetjmp="unknown" 3812 tst_proto_sigsetjmp="unknown" 3813 tst_compi_sigsetjmp="unknown" 3814 tst_allow_sigsetjmp="unknown" 3815 # 3816 AC_MSG_CHECKING([if sigsetjmp can be linked]) 3817 AC_LINK_IFELSE([ 3818 AC_LANG_FUNC_LINK_TRY([sigsetjmp]) 3819 ],[ 3820 AC_MSG_RESULT([yes]) 3821 tst_links_sigsetjmp="yes" 3822 ],[ 3823 AC_MSG_RESULT([no]) 3824 tst_links_sigsetjmp="no" 3825 ]) 3826 # 3827 if test "$tst_links_sigsetjmp" = "no"; then 3828 AC_MSG_CHECKING([if sigsetjmp seems a macro]) 3829 AC_LINK_IFELSE([ 3830 AC_LANG_PROGRAM([[ 3831 $curl_includes_setjmp 3832 ]],[[ 3833 sigjmp_buf env; 3834 if(0 != sigsetjmp(env, 0)) 3835 return 1; 3836 ]]) 3837 ],[ 3838 AC_MSG_RESULT([yes]) 3839 tst_macro_sigsetjmp="yes" 3840 ],[ 3841 AC_MSG_RESULT([no]) 3842 tst_macro_sigsetjmp="no" 3843 ]) 3844 fi 3845 # 3846 if test "$tst_links_sigsetjmp" = "yes"; then 3847 AC_MSG_CHECKING([if sigsetjmp is prototyped]) 3848 AC_EGREP_CPP([sigsetjmp],[ 3849 $curl_includes_setjmp 3850 ],[ 3851 AC_MSG_RESULT([yes]) 3852 tst_proto_sigsetjmp="yes" 3853 ],[ 3854 AC_MSG_RESULT([no]) 3855 tst_proto_sigsetjmp="no" 3856 ]) 3857 fi 3858 # 3859 if test "$tst_proto_sigsetjmp" = "yes" || 3860 test "$tst_macro_sigsetjmp" = "yes"; then 3861 AC_MSG_CHECKING([if sigsetjmp is compilable]) 3862 AC_COMPILE_IFELSE([ 3863 AC_LANG_PROGRAM([[ 3864 $curl_includes_setjmp 3865 ]],[[ 3866 sigjmp_buf env; 3867 if(0 != sigsetjmp(env, 0)) 3868 return 1; 3869 ]]) 3870 ],[ 3871 AC_MSG_RESULT([yes]) 3872 tst_compi_sigsetjmp="yes" 3873 ],[ 3874 AC_MSG_RESULT([no]) 3875 tst_compi_sigsetjmp="no" 3876 ]) 3877 fi 3878 # 3879 if test "$tst_compi_sigsetjmp" = "yes"; then 3880 AC_MSG_CHECKING([if sigsetjmp usage allowed]) 3881 if test "x$curl_disallow_sigsetjmp" != "xyes"; then 3882 AC_MSG_RESULT([yes]) 3883 tst_allow_sigsetjmp="yes" 3884 else 3885 AC_MSG_RESULT([no]) 3886 tst_allow_sigsetjmp="no" 3887 fi 3888 fi 3889 # 3890 AC_MSG_CHECKING([if sigsetjmp might be used]) 3891 if (test "$tst_proto_sigsetjmp" = "yes" || 3892 test "$tst_macro_sigsetjmp" = "yes") && 3893 test "$tst_compi_sigsetjmp" = "yes" && 3894 test "$tst_allow_sigsetjmp" = "yes"; then 3895 AC_MSG_RESULT([yes]) 3896 AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1, 3897 [Define to 1 if you have the sigsetjmp function or macro.]) 3898 curl_cv_func_sigsetjmp="yes" 3899 else 3900 AC_MSG_RESULT([no]) 3901 curl_cv_func_sigsetjmp="no" 3902 fi 3903]) 3904 3905 3906dnl CURL_CHECK_FUNC_SOCKET 3907dnl ------------------------------------------------- 3908dnl Verify if socket is available, prototyped, and 3909dnl can be compiled. If all of these are true, and 3910dnl usage has not been previously disallowed with 3911dnl shell variable curl_disallow_socket, then 3912dnl HAVE_SOCKET will be defined. 3913 3914AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [ 3915 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 3916 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 3917 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl 3918 # 3919 tst_links_socket="unknown" 3920 tst_proto_socket="unknown" 3921 tst_compi_socket="unknown" 3922 tst_allow_socket="unknown" 3923 # 3924 AC_MSG_CHECKING([if socket can be linked]) 3925 AC_LINK_IFELSE([ 3926 AC_LANG_PROGRAM([[ 3927 $curl_includes_winsock2 3928 $curl_includes_bsdsocket 3929 $curl_includes_sys_socket 3930 $curl_includes_socket 3931 ]],[[ 3932 if(0 != socket(0, 0, 0)) 3933 return 1; 3934 ]]) 3935 ],[ 3936 AC_MSG_RESULT([yes]) 3937 tst_links_socket="yes" 3938 ],[ 3939 AC_MSG_RESULT([no]) 3940 tst_links_socket="no" 3941 ]) 3942 # 3943 if test "$tst_links_socket" = "yes"; then 3944 AC_MSG_CHECKING([if socket is prototyped]) 3945 AC_EGREP_CPP([socket],[ 3946 $curl_includes_winsock2 3947 $curl_includes_bsdsocket 3948 $curl_includes_sys_socket 3949 $curl_includes_socket 3950 ],[ 3951 AC_MSG_RESULT([yes]) 3952 tst_proto_socket="yes" 3953 ],[ 3954 AC_MSG_RESULT([no]) 3955 tst_proto_socket="no" 3956 ]) 3957 fi 3958 # 3959 if test "$tst_proto_socket" = "yes"; then 3960 AC_MSG_CHECKING([if socket is compilable]) 3961 AC_COMPILE_IFELSE([ 3962 AC_LANG_PROGRAM([[ 3963 $curl_includes_winsock2 3964 $curl_includes_bsdsocket 3965 $curl_includes_sys_socket 3966 $curl_includes_socket 3967 ]],[[ 3968 if(0 != socket(0, 0, 0)) 3969 return 1; 3970 ]]) 3971 ],[ 3972 AC_MSG_RESULT([yes]) 3973 tst_compi_socket="yes" 3974 ],[ 3975 AC_MSG_RESULT([no]) 3976 tst_compi_socket="no" 3977 ]) 3978 fi 3979 # 3980 if test "$tst_compi_socket" = "yes"; then 3981 AC_MSG_CHECKING([if socket usage allowed]) 3982 if test "x$curl_disallow_socket" != "xyes"; then 3983 AC_MSG_RESULT([yes]) 3984 tst_allow_socket="yes" 3985 else 3986 AC_MSG_RESULT([no]) 3987 tst_allow_socket="no" 3988 fi 3989 fi 3990 # 3991 AC_MSG_CHECKING([if socket might be used]) 3992 if test "$tst_links_socket" = "yes" && 3993 test "$tst_proto_socket" = "yes" && 3994 test "$tst_compi_socket" = "yes" && 3995 test "$tst_allow_socket" = "yes"; then 3996 AC_MSG_RESULT([yes]) 3997 AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1, 3998 [Define to 1 if you have the socket function.]) 3999 curl_cv_func_socket="yes" 4000 else 4001 AC_MSG_RESULT([no]) 4002 curl_cv_func_socket="no" 4003 fi 4004]) 4005 4006 4007dnl CURL_CHECK_FUNC_SOCKETPAIR 4008dnl ------------------------------------------------- 4009dnl Verify if socketpair is available, prototyped, and 4010dnl can be compiled. If all of these are true, and 4011dnl usage has not been previously disallowed with 4012dnl shell variable curl_disallow_socketpair, then 4013dnl HAVE_SOCKETPAIR will be defined. 4014 4015AC_DEFUN([CURL_CHECK_FUNC_SOCKETPAIR], [ 4016 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 4017 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl 4018 # 4019 tst_links_socketpair="unknown" 4020 tst_proto_socketpair="unknown" 4021 tst_compi_socketpair="unknown" 4022 tst_allow_socketpair="unknown" 4023 # 4024 AC_MSG_CHECKING([if socketpair can be linked]) 4025 AC_LINK_IFELSE([ 4026 AC_LANG_FUNC_LINK_TRY([socketpair]) 4027 ],[ 4028 AC_MSG_RESULT([yes]) 4029 tst_links_socketpair="yes" 4030 ],[ 4031 AC_MSG_RESULT([no]) 4032 tst_links_socketpair="no" 4033 ]) 4034 # 4035 if test "$tst_links_socketpair" = "yes"; then 4036 AC_MSG_CHECKING([if socketpair is prototyped]) 4037 AC_EGREP_CPP([socketpair],[ 4038 $curl_includes_sys_socket 4039 $curl_includes_socket 4040 ],[ 4041 AC_MSG_RESULT([yes]) 4042 tst_proto_socketpair="yes" 4043 ],[ 4044 AC_MSG_RESULT([no]) 4045 tst_proto_socketpair="no" 4046 ]) 4047 fi 4048 # 4049 if test "$tst_proto_socketpair" = "yes"; then 4050 AC_MSG_CHECKING([if socketpair is compilable]) 4051 AC_COMPILE_IFELSE([ 4052 AC_LANG_PROGRAM([[ 4053 $curl_includes_sys_socket 4054 $curl_includes_socket 4055 ]],[[ 4056 int sv[2]; 4057 if(0 != socketpair(0, 0, 0, sv)) 4058 return 1; 4059 ]]) 4060 ],[ 4061 AC_MSG_RESULT([yes]) 4062 tst_compi_socketpair="yes" 4063 ],[ 4064 AC_MSG_RESULT([no]) 4065 tst_compi_socketpair="no" 4066 ]) 4067 fi 4068 # 4069 if test "$tst_compi_socketpair" = "yes"; then 4070 AC_MSG_CHECKING([if socketpair usage allowed]) 4071 if test "x$curl_disallow_socketpair" != "xyes"; then 4072 AC_MSG_RESULT([yes]) 4073 tst_allow_socketpair="yes" 4074 else 4075 AC_MSG_RESULT([no]) 4076 tst_allow_socketpair="no" 4077 fi 4078 fi 4079 # 4080 AC_MSG_CHECKING([if socketpair might be used]) 4081 if test "$tst_links_socketpair" = "yes" && 4082 test "$tst_proto_socketpair" = "yes" && 4083 test "$tst_compi_socketpair" = "yes" && 4084 test "$tst_allow_socketpair" = "yes"; then 4085 AC_MSG_RESULT([yes]) 4086 AC_DEFINE_UNQUOTED(HAVE_SOCKETPAIR, 1, 4087 [Define to 1 if you have the socketpair function.]) 4088 curl_cv_func_socketpair="yes" 4089 else 4090 AC_MSG_RESULT([no]) 4091 curl_cv_func_socketpair="no" 4092 fi 4093]) 4094 4095 4096dnl CURL_CHECK_FUNC_STRCASECMP 4097dnl ------------------------------------------------- 4098dnl Verify if strcasecmp is available, prototyped, and 4099dnl can be compiled. If all of these are true, and 4100dnl usage has not been previously disallowed with 4101dnl shell variable curl_disallow_strcasecmp, then 4102dnl HAVE_STRCASECMP will be defined. 4103 4104AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [ 4105 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 4106 # 4107 tst_links_strcasecmp="unknown" 4108 tst_proto_strcasecmp="unknown" 4109 tst_compi_strcasecmp="unknown" 4110 tst_allow_strcasecmp="unknown" 4111 # 4112 AC_MSG_CHECKING([if strcasecmp can be linked]) 4113 AC_LINK_IFELSE([ 4114 AC_LANG_FUNC_LINK_TRY([strcasecmp]) 4115 ],[ 4116 AC_MSG_RESULT([yes]) 4117 tst_links_strcasecmp="yes" 4118 ],[ 4119 AC_MSG_RESULT([no]) 4120 tst_links_strcasecmp="no" 4121 ]) 4122 # 4123 if test "$tst_links_strcasecmp" = "yes"; then 4124 AC_MSG_CHECKING([if strcasecmp is prototyped]) 4125 AC_EGREP_CPP([strcasecmp],[ 4126 $curl_includes_string 4127 ],[ 4128 AC_MSG_RESULT([yes]) 4129 tst_proto_strcasecmp="yes" 4130 ],[ 4131 AC_MSG_RESULT([no]) 4132 tst_proto_strcasecmp="no" 4133 ]) 4134 fi 4135 # 4136 if test "$tst_proto_strcasecmp" = "yes"; then 4137 AC_MSG_CHECKING([if strcasecmp is compilable]) 4138 AC_COMPILE_IFELSE([ 4139 AC_LANG_PROGRAM([[ 4140 $curl_includes_string 4141 ]],[[ 4142 if(0 != strcasecmp(0, 0)) 4143 return 1; 4144 ]]) 4145 ],[ 4146 AC_MSG_RESULT([yes]) 4147 tst_compi_strcasecmp="yes" 4148 ],[ 4149 AC_MSG_RESULT([no]) 4150 tst_compi_strcasecmp="no" 4151 ]) 4152 fi 4153 # 4154 if test "$tst_compi_strcasecmp" = "yes"; then 4155 AC_MSG_CHECKING([if strcasecmp usage allowed]) 4156 if test "x$curl_disallow_strcasecmp" != "xyes"; then 4157 AC_MSG_RESULT([yes]) 4158 tst_allow_strcasecmp="yes" 4159 else 4160 AC_MSG_RESULT([no]) 4161 tst_allow_strcasecmp="no" 4162 fi 4163 fi 4164 # 4165 AC_MSG_CHECKING([if strcasecmp might be used]) 4166 if test "$tst_links_strcasecmp" = "yes" && 4167 test "$tst_proto_strcasecmp" = "yes" && 4168 test "$tst_compi_strcasecmp" = "yes" && 4169 test "$tst_allow_strcasecmp" = "yes"; then 4170 AC_MSG_RESULT([yes]) 4171 AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1, 4172 [Define to 1 if you have the strcasecmp function.]) 4173 curl_cv_func_strcasecmp="yes" 4174 else 4175 AC_MSG_RESULT([no]) 4176 curl_cv_func_strcasecmp="no" 4177 fi 4178]) 4179 4180dnl CURL_CHECK_FUNC_STRCMPI 4181dnl ------------------------------------------------- 4182dnl Verify if strcmpi is available, prototyped, and 4183dnl can be compiled. If all of these are true, and 4184dnl usage has not been previously disallowed with 4185dnl shell variable curl_disallow_strcmpi, then 4186dnl HAVE_STRCMPI will be defined. 4187 4188AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [ 4189 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 4190 # 4191 tst_links_strcmpi="unknown" 4192 tst_proto_strcmpi="unknown" 4193 tst_compi_strcmpi="unknown" 4194 tst_allow_strcmpi="unknown" 4195 # 4196 AC_MSG_CHECKING([if strcmpi can be linked]) 4197 AC_LINK_IFELSE([ 4198 AC_LANG_FUNC_LINK_TRY([strcmpi]) 4199 ],[ 4200 AC_MSG_RESULT([yes]) 4201 tst_links_strcmpi="yes" 4202 ],[ 4203 AC_MSG_RESULT([no]) 4204 tst_links_strcmpi="no" 4205 ]) 4206 # 4207 if test "$tst_links_strcmpi" = "yes"; then 4208 AC_MSG_CHECKING([if strcmpi is prototyped]) 4209 AC_EGREP_CPP([strcmpi],[ 4210 $curl_includes_string 4211 ],[ 4212 AC_MSG_RESULT([yes]) 4213 tst_proto_strcmpi="yes" 4214 ],[ 4215 AC_MSG_RESULT([no]) 4216 tst_proto_strcmpi="no" 4217 ]) 4218 fi 4219 # 4220 if test "$tst_proto_strcmpi" = "yes"; then 4221 AC_MSG_CHECKING([if strcmpi is compilable]) 4222 AC_COMPILE_IFELSE([ 4223 AC_LANG_PROGRAM([[ 4224 $curl_includes_string 4225 ]],[[ 4226 if(0 != strcmpi(0, 0)) 4227 return 1; 4228 ]]) 4229 ],[ 4230 AC_MSG_RESULT([yes]) 4231 tst_compi_strcmpi="yes" 4232 ],[ 4233 AC_MSG_RESULT([no]) 4234 tst_compi_strcmpi="no" 4235 ]) 4236 fi 4237 # 4238 if test "$tst_compi_strcmpi" = "yes"; then 4239 AC_MSG_CHECKING([if strcmpi usage allowed]) 4240 if test "x$curl_disallow_strcmpi" != "xyes"; then 4241 AC_MSG_RESULT([yes]) 4242 tst_allow_strcmpi="yes" 4243 else 4244 AC_MSG_RESULT([no]) 4245 tst_allow_strcmpi="no" 4246 fi 4247 fi 4248 # 4249 AC_MSG_CHECKING([if strcmpi might be used]) 4250 if test "$tst_links_strcmpi" = "yes" && 4251 test "$tst_proto_strcmpi" = "yes" && 4252 test "$tst_compi_strcmpi" = "yes" && 4253 test "$tst_allow_strcmpi" = "yes"; then 4254 AC_MSG_RESULT([yes]) 4255 AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1, 4256 [Define to 1 if you have the strcmpi function.]) 4257 curl_cv_func_strcmpi="yes" 4258 else 4259 AC_MSG_RESULT([no]) 4260 curl_cv_func_strcmpi="no" 4261 fi 4262]) 4263 4264 4265dnl CURL_CHECK_FUNC_STRDUP 4266dnl ------------------------------------------------- 4267dnl Verify if strdup is available, prototyped, and 4268dnl can be compiled. If all of these are true, and 4269dnl usage has not been previously disallowed with 4270dnl shell variable curl_disallow_strdup, then 4271dnl HAVE_STRDUP will be defined. 4272 4273AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [ 4274 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 4275 # 4276 tst_links_strdup="unknown" 4277 tst_proto_strdup="unknown" 4278 tst_compi_strdup="unknown" 4279 tst_allow_strdup="unknown" 4280 # 4281 AC_MSG_CHECKING([if strdup can be linked]) 4282 AC_LINK_IFELSE([ 4283 AC_LANG_FUNC_LINK_TRY([strdup]) 4284 ],[ 4285 AC_MSG_RESULT([yes]) 4286 tst_links_strdup="yes" 4287 ],[ 4288 AC_MSG_RESULT([no]) 4289 tst_links_strdup="no" 4290 ]) 4291 # 4292 if test "$tst_links_strdup" = "yes"; then 4293 AC_MSG_CHECKING([if strdup is prototyped]) 4294 AC_EGREP_CPP([strdup],[ 4295 $curl_includes_string 4296 ],[ 4297 AC_MSG_RESULT([yes]) 4298 tst_proto_strdup="yes" 4299 ],[ 4300 AC_MSG_RESULT([no]) 4301 tst_proto_strdup="no" 4302 ]) 4303 fi 4304 # 4305 if test "$tst_proto_strdup" = "yes"; then 4306 AC_MSG_CHECKING([if strdup is compilable]) 4307 AC_COMPILE_IFELSE([ 4308 AC_LANG_PROGRAM([[ 4309 $curl_includes_string 4310 ]],[[ 4311 if(0 != strdup(0)) 4312 return 1; 4313 ]]) 4314 ],[ 4315 AC_MSG_RESULT([yes]) 4316 tst_compi_strdup="yes" 4317 ],[ 4318 AC_MSG_RESULT([no]) 4319 tst_compi_strdup="no" 4320 ]) 4321 fi 4322 # 4323 if test "$tst_compi_strdup" = "yes"; then 4324 AC_MSG_CHECKING([if strdup usage allowed]) 4325 if test "x$curl_disallow_strdup" != "xyes"; then 4326 AC_MSG_RESULT([yes]) 4327 tst_allow_strdup="yes" 4328 else 4329 AC_MSG_RESULT([no]) 4330 tst_allow_strdup="no" 4331 fi 4332 fi 4333 # 4334 AC_MSG_CHECKING([if strdup might be used]) 4335 if test "$tst_links_strdup" = "yes" && 4336 test "$tst_proto_strdup" = "yes" && 4337 test "$tst_compi_strdup" = "yes" && 4338 test "$tst_allow_strdup" = "yes"; then 4339 AC_MSG_RESULT([yes]) 4340 AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1, 4341 [Define to 1 if you have the strdup function.]) 4342 curl_cv_func_strdup="yes" 4343 else 4344 AC_MSG_RESULT([no]) 4345 curl_cv_func_strdup="no" 4346 fi 4347]) 4348 4349 4350dnl CURL_CHECK_FUNC_STRERROR_R 4351dnl ------------------------------------------------- 4352dnl Verify if strerror_r is available, prototyped, can be compiled and 4353dnl seems to work. If all of these are true, and usage has not been 4354dnl previously disallowed with shell variable curl_disallow_strerror_r, 4355dnl then HAVE_STRERROR_R will be defined, as well as one of 4356dnl HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R. 4357dnl 4358dnl glibc-style strerror_r: 4359dnl 4360dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize); 4361dnl 4362dnl glibc-style strerror_r returns a pointer to the error string, 4363dnl and might use the provided workbuf as a scratch area if needed. A 4364dnl quick test on a few systems shows that it's usually not used at all. 4365dnl 4366dnl POSIX-style strerror_r: 4367dnl 4368dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize); 4369dnl 4370dnl POSIX-style strerror_r returns 0 upon successful completion and the 4371dnl error string in the provided resultbuf. 4372dnl 4373 4374AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [ 4375 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 4376 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 4377 # 4378 tst_links_strerror_r="unknown" 4379 tst_proto_strerror_r="unknown" 4380 tst_compi_strerror_r="unknown" 4381 tst_glibc_strerror_r="unknown" 4382 tst_posix_strerror_r="unknown" 4383 tst_allow_strerror_r="unknown" 4384 tst_works_glibc_strerror_r="unknown" 4385 tst_works_posix_strerror_r="unknown" 4386 tst_glibc_strerror_r_type_arg3="unknown" 4387 tst_posix_strerror_r_type_arg3="unknown" 4388 # 4389 AC_MSG_CHECKING([if strerror_r can be linked]) 4390 AC_LINK_IFELSE([ 4391 AC_LANG_FUNC_LINK_TRY([strerror_r]) 4392 ],[ 4393 AC_MSG_RESULT([yes]) 4394 tst_links_strerror_r="yes" 4395 ],[ 4396 AC_MSG_RESULT([no]) 4397 tst_links_strerror_r="no" 4398 ]) 4399 # 4400 if test "$tst_links_strerror_r" = "yes"; then 4401 AC_MSG_CHECKING([if strerror_r is prototyped]) 4402 AC_EGREP_CPP([strerror_r],[ 4403 $curl_includes_string 4404 ],[ 4405 AC_MSG_RESULT([yes]) 4406 tst_proto_strerror_r="yes" 4407 ],[ 4408 AC_MSG_RESULT([no]) 4409 tst_proto_strerror_r="no" 4410 ]) 4411 fi 4412 # 4413 if test "$tst_proto_strerror_r" = "yes"; then 4414 AC_MSG_CHECKING([if strerror_r is compilable]) 4415 AC_COMPILE_IFELSE([ 4416 AC_LANG_PROGRAM([[ 4417 $curl_includes_string 4418 ]],[[ 4419 if(0 != strerror_r(0, 0, 0)) 4420 return 1; 4421 ]]) 4422 ],[ 4423 AC_MSG_RESULT([yes]) 4424 tst_compi_strerror_r="yes" 4425 ],[ 4426 AC_MSG_RESULT([no]) 4427 tst_compi_strerror_r="no" 4428 ]) 4429 fi 4430 # 4431 if test "$tst_compi_strerror_r" = "yes"; then 4432 AC_MSG_CHECKING([if strerror_r is glibc like]) 4433 tst_glibc_strerror_r_type_arg3="unknown" 4434 for arg3 in 'size_t' 'int' 'unsigned int'; do 4435 if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then 4436 AC_COMPILE_IFELSE([ 4437 AC_LANG_PROGRAM([[ 4438 $curl_includes_string 4439 char *strerror_r(int errnum, char *workbuf, $arg3 bufsize); 4440 ]],[[ 4441 if(0 != strerror_r(0, 0, 0)) 4442 return 1; 4443 ]]) 4444 ],[ 4445 tst_glibc_strerror_r_type_arg3="$arg3" 4446 ]) 4447 fi 4448 done 4449 case "$tst_glibc_strerror_r_type_arg3" in 4450 unknown) 4451 AC_MSG_RESULT([no]) 4452 tst_glibc_strerror_r="no" 4453 ;; 4454 *) 4455 AC_MSG_RESULT([yes]) 4456 tst_glibc_strerror_r="yes" 4457 ;; 4458 esac 4459 fi 4460 # 4461 dnl only do runtime verification when not cross-compiling 4462 if test "x$cross_compiling" != "xyes" && 4463 test "$tst_glibc_strerror_r" = "yes"; then 4464 AC_MSG_CHECKING([if strerror_r seems to work]) 4465 CURL_RUN_IFELSE([ 4466 AC_LANG_PROGRAM([[ 4467 $curl_includes_stdlib 4468 $curl_includes_string 4469# include <errno.h> 4470 ]],[[ 4471 char buffer[1024]; 4472 char *string = 0; 4473 buffer[0] = '\0'; 4474 string = strerror_r(EACCES, buffer, sizeof(buffer)); 4475 if(!string) 4476 exit(1); /* fail */ 4477 if(!string[0]) 4478 exit(1); /* fail */ 4479 else 4480 exit(0); 4481 ]]) 4482 ],[ 4483 AC_MSG_RESULT([yes]) 4484 tst_works_glibc_strerror_r="yes" 4485 ],[ 4486 AC_MSG_RESULT([no]) 4487 tst_works_glibc_strerror_r="no" 4488 ]) 4489 fi 4490 # 4491 if test "$tst_compi_strerror_r" = "yes" && 4492 test "$tst_works_glibc_strerror_r" != "yes"; then 4493 AC_MSG_CHECKING([if strerror_r is POSIX like]) 4494 tst_posix_strerror_r_type_arg3="unknown" 4495 for arg3 in 'size_t' 'int' 'unsigned int'; do 4496 if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then 4497 AC_COMPILE_IFELSE([ 4498 AC_LANG_PROGRAM([[ 4499 $curl_includes_string 4500 int strerror_r(int errnum, char *resultbuf, $arg3 bufsize); 4501 ]],[[ 4502 if(0 != strerror_r(0, 0, 0)) 4503 return 1; 4504 ]]) 4505 ],[ 4506 tst_posix_strerror_r_type_arg3="$arg3" 4507 ]) 4508 fi 4509 done 4510 case "$tst_posix_strerror_r_type_arg3" in 4511 unknown) 4512 AC_MSG_RESULT([no]) 4513 tst_posix_strerror_r="no" 4514 ;; 4515 *) 4516 AC_MSG_RESULT([yes]) 4517 tst_posix_strerror_r="yes" 4518 ;; 4519 esac 4520 fi 4521 # 4522 dnl only do runtime verification when not cross-compiling 4523 if test "x$cross_compiling" != "xyes" && 4524 test "$tst_posix_strerror_r" = "yes"; then 4525 AC_MSG_CHECKING([if strerror_r seems to work]) 4526 CURL_RUN_IFELSE([ 4527 AC_LANG_PROGRAM([[ 4528 $curl_includes_stdlib 4529 $curl_includes_string 4530# include <errno.h> 4531 ]],[[ 4532 char buffer[1024]; 4533 int error = 1; 4534 buffer[0] = '\0'; 4535 error = strerror_r(EACCES, buffer, sizeof(buffer)); 4536 if(error) 4537 exit(1); /* fail */ 4538 if(buffer[0] == '\0') 4539 exit(1); /* fail */ 4540 else 4541 exit(0); 4542 ]]) 4543 ],[ 4544 AC_MSG_RESULT([yes]) 4545 tst_works_posix_strerror_r="yes" 4546 ],[ 4547 AC_MSG_RESULT([no]) 4548 tst_works_posix_strerror_r="no" 4549 ]) 4550 fi 4551 # 4552 if test "$tst_works_glibc_strerror_r" = "yes"; then 4553 tst_posix_strerror_r="no" 4554 fi 4555 if test "$tst_works_posix_strerror_r" = "yes"; then 4556 tst_glibc_strerror_r="no" 4557 fi 4558 if test "$tst_glibc_strerror_r" = "yes" && 4559 test "$tst_works_glibc_strerror_r" != "no" && 4560 test "$tst_posix_strerror_r" != "yes"; then 4561 tst_allow_strerror_r="check" 4562 fi 4563 if test "$tst_posix_strerror_r" = "yes" && 4564 test "$tst_works_posix_strerror_r" != "no" && 4565 test "$tst_glibc_strerror_r" != "yes"; then 4566 tst_allow_strerror_r="check" 4567 fi 4568 if test "$tst_allow_strerror_r" = "check"; then 4569 AC_MSG_CHECKING([if strerror_r usage allowed]) 4570 if test "x$curl_disallow_strerror_r" != "xyes"; then 4571 AC_MSG_RESULT([yes]) 4572 tst_allow_strerror_r="yes" 4573 else 4574 AC_MSG_RESULT([no]) 4575 tst_allow_strerror_r="no" 4576 fi 4577 fi 4578 # 4579 AC_MSG_CHECKING([if strerror_r might be used]) 4580 if test "$tst_links_strerror_r" = "yes" && 4581 test "$tst_proto_strerror_r" = "yes" && 4582 test "$tst_compi_strerror_r" = "yes" && 4583 test "$tst_allow_strerror_r" = "yes"; then 4584 AC_MSG_RESULT([yes]) 4585 if test "$tst_glibc_strerror_r" = "yes"; then 4586 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1, 4587 [Define to 1 if you have the strerror_r function.]) 4588 AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1, 4589 [Define to 1 if you have a working glibc-style strerror_r function.]) 4590 fi 4591 if test "$tst_posix_strerror_r" = "yes"; then 4592 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1, 4593 [Define to 1 if you have the strerror_r function.]) 4594 AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1, 4595 [Define to 1 if you have a working POSIX-style strerror_r function.]) 4596 fi 4597 curl_cv_func_strerror_r="yes" 4598 else 4599 AC_MSG_RESULT([no]) 4600 curl_cv_func_strerror_r="no" 4601 fi 4602 # 4603 if test "$tst_compi_strerror_r" = "yes" && 4604 test "$tst_allow_strerror_r" = "unknown"; then 4605 AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.]) 4606 fi 4607 # 4608]) 4609 4610 4611dnl CURL_CHECK_FUNC_STRICMP 4612dnl ------------------------------------------------- 4613dnl Verify if stricmp is available, prototyped, and 4614dnl can be compiled. If all of these are true, and 4615dnl usage has not been previously disallowed with 4616dnl shell variable curl_disallow_stricmp, then 4617dnl HAVE_STRICMP will be defined. 4618 4619AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [ 4620 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 4621 # 4622 tst_links_stricmp="unknown" 4623 tst_proto_stricmp="unknown" 4624 tst_compi_stricmp="unknown" 4625 tst_allow_stricmp="unknown" 4626 # 4627 AC_MSG_CHECKING([if stricmp can be linked]) 4628 AC_LINK_IFELSE([ 4629 AC_LANG_FUNC_LINK_TRY([stricmp]) 4630 ],[ 4631 AC_MSG_RESULT([yes]) 4632 tst_links_stricmp="yes" 4633 ],[ 4634 AC_MSG_RESULT([no]) 4635 tst_links_stricmp="no" 4636 ]) 4637 # 4638 if test "$tst_links_stricmp" = "yes"; then 4639 AC_MSG_CHECKING([if stricmp is prototyped]) 4640 AC_EGREP_CPP([stricmp],[ 4641 $curl_includes_string 4642 ],[ 4643 AC_MSG_RESULT([yes]) 4644 tst_proto_stricmp="yes" 4645 ],[ 4646 AC_MSG_RESULT([no]) 4647 tst_proto_stricmp="no" 4648 ]) 4649 fi 4650 # 4651 if test "$tst_proto_stricmp" = "yes"; then 4652 AC_MSG_CHECKING([if stricmp is compilable]) 4653 AC_COMPILE_IFELSE([ 4654 AC_LANG_PROGRAM([[ 4655 $curl_includes_string 4656 ]],[[ 4657 if(0 != stricmp(0, 0)) 4658 return 1; 4659 ]]) 4660 ],[ 4661 AC_MSG_RESULT([yes]) 4662 tst_compi_stricmp="yes" 4663 ],[ 4664 AC_MSG_RESULT([no]) 4665 tst_compi_stricmp="no" 4666 ]) 4667 fi 4668 # 4669 if test "$tst_compi_stricmp" = "yes"; then 4670 AC_MSG_CHECKING([if stricmp usage allowed]) 4671 if test "x$curl_disallow_stricmp" != "xyes"; then 4672 AC_MSG_RESULT([yes]) 4673 tst_allow_stricmp="yes" 4674 else 4675 AC_MSG_RESULT([no]) 4676 tst_allow_stricmp="no" 4677 fi 4678 fi 4679 # 4680 AC_MSG_CHECKING([if stricmp might be used]) 4681 if test "$tst_links_stricmp" = "yes" && 4682 test "$tst_proto_stricmp" = "yes" && 4683 test "$tst_compi_stricmp" = "yes" && 4684 test "$tst_allow_stricmp" = "yes"; then 4685 AC_MSG_RESULT([yes]) 4686 AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1, 4687 [Define to 1 if you have the stricmp function.]) 4688 curl_cv_func_stricmp="yes" 4689 else 4690 AC_MSG_RESULT([no]) 4691 curl_cv_func_stricmp="no" 4692 fi 4693]) 4694 4695 4696dnl CURL_CHECK_FUNC_STRTOK_R 4697dnl ------------------------------------------------- 4698dnl Verify if strtok_r is available, prototyped, and 4699dnl can be compiled. If all of these are true, and 4700dnl usage has not been previously disallowed with 4701dnl shell variable curl_disallow_strtok_r, then 4702dnl HAVE_STRTOK_R will be defined. 4703 4704AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [ 4705 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 4706 # 4707 tst_links_strtok_r="unknown" 4708 tst_proto_strtok_r="unknown" 4709 tst_compi_strtok_r="unknown" 4710 tst_allow_strtok_r="unknown" 4711 # 4712 AC_MSG_CHECKING([if strtok_r can be linked]) 4713 AC_LINK_IFELSE([ 4714 AC_LANG_FUNC_LINK_TRY([strtok_r]) 4715 ],[ 4716 AC_MSG_RESULT([yes]) 4717 tst_links_strtok_r="yes" 4718 ],[ 4719 AC_MSG_RESULT([no]) 4720 tst_links_strtok_r="no" 4721 ]) 4722 # 4723 if test "$tst_links_strtok_r" = "yes"; then 4724 AC_MSG_CHECKING([if strtok_r is prototyped]) 4725 AC_EGREP_CPP([strtok_r],[ 4726 $curl_includes_string 4727 ],[ 4728 AC_MSG_RESULT([yes]) 4729 tst_proto_strtok_r="yes" 4730 ],[ 4731 AC_MSG_RESULT([no]) 4732 tst_proto_strtok_r="no" 4733 ]) 4734 fi 4735 # 4736 if test "$tst_proto_strtok_r" = "yes"; then 4737 AC_MSG_CHECKING([if strtok_r is compilable]) 4738 AC_COMPILE_IFELSE([ 4739 AC_LANG_PROGRAM([[ 4740 $curl_includes_string 4741 ]],[[ 4742 if(0 != strtok_r(0, 0, 0)) 4743 return 1; 4744 ]]) 4745 ],[ 4746 AC_MSG_RESULT([yes]) 4747 tst_compi_strtok_r="yes" 4748 ],[ 4749 AC_MSG_RESULT([no]) 4750 tst_compi_strtok_r="no" 4751 ]) 4752 fi 4753 # 4754 if test "$tst_compi_strtok_r" = "yes"; then 4755 AC_MSG_CHECKING([if strtok_r usage allowed]) 4756 if test "x$curl_disallow_strtok_r" != "xyes"; then 4757 AC_MSG_RESULT([yes]) 4758 tst_allow_strtok_r="yes" 4759 else 4760 AC_MSG_RESULT([no]) 4761 tst_allow_strtok_r="no" 4762 fi 4763 fi 4764 # 4765 AC_MSG_CHECKING([if strtok_r might be used]) 4766 if test "$tst_links_strtok_r" = "yes" && 4767 test "$tst_proto_strtok_r" = "yes" && 4768 test "$tst_compi_strtok_r" = "yes" && 4769 test "$tst_allow_strtok_r" = "yes"; then 4770 AC_MSG_RESULT([yes]) 4771 AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1, 4772 [Define to 1 if you have the strtok_r function.]) 4773 curl_cv_func_strtok_r="yes" 4774 else 4775 AC_MSG_RESULT([no]) 4776 curl_cv_func_strtok_r="no" 4777 fi 4778]) 4779 4780 4781dnl CURL_CHECK_FUNC_STRTOLL 4782dnl ------------------------------------------------- 4783dnl Verify if strtoll is available, prototyped, and 4784dnl can be compiled. If all of these are true, and 4785dnl usage has not been previously disallowed with 4786dnl shell variable curl_disallow_strtoll, then 4787dnl HAVE_STRTOLL will be defined. 4788 4789AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [ 4790 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 4791 # 4792 tst_links_strtoll="unknown" 4793 tst_proto_strtoll="unknown" 4794 tst_compi_strtoll="unknown" 4795 tst_allow_strtoll="unknown" 4796 # 4797 AC_MSG_CHECKING([if strtoll can be linked]) 4798 AC_LINK_IFELSE([ 4799 AC_LANG_FUNC_LINK_TRY([strtoll]) 4800 ],[ 4801 AC_MSG_RESULT([yes]) 4802 tst_links_strtoll="yes" 4803 ],[ 4804 AC_MSG_RESULT([no]) 4805 tst_links_strtoll="no" 4806 ]) 4807 # 4808 if test "$tst_links_strtoll" = "yes"; then 4809 AC_MSG_CHECKING([if strtoll is prototyped]) 4810 AC_EGREP_CPP([strtoll],[ 4811 $curl_includes_stdlib 4812 ],[ 4813 AC_MSG_RESULT([yes]) 4814 tst_proto_strtoll="yes" 4815 ],[ 4816 AC_MSG_RESULT([no]) 4817 tst_proto_strtoll="no" 4818 ]) 4819 fi 4820 # 4821 if test "$tst_proto_strtoll" = "yes"; then 4822 AC_MSG_CHECKING([if strtoll is compilable]) 4823 AC_COMPILE_IFELSE([ 4824 AC_LANG_PROGRAM([[ 4825 $curl_includes_stdlib 4826 ]],[[ 4827 if(0 != strtoll(0, 0, 0)) 4828 return 1; 4829 ]]) 4830 ],[ 4831 AC_MSG_RESULT([yes]) 4832 tst_compi_strtoll="yes" 4833 ],[ 4834 AC_MSG_RESULT([no]) 4835 tst_compi_strtoll="no" 4836 ]) 4837 fi 4838 # 4839 if test "$tst_compi_strtoll" = "yes"; then 4840 AC_MSG_CHECKING([if strtoll usage allowed]) 4841 if test "x$curl_disallow_strtoll" != "xyes"; then 4842 AC_MSG_RESULT([yes]) 4843 tst_allow_strtoll="yes" 4844 else 4845 AC_MSG_RESULT([no]) 4846 tst_allow_strtoll="no" 4847 fi 4848 fi 4849 # 4850 AC_MSG_CHECKING([if strtoll might be used]) 4851 if test "$tst_links_strtoll" = "yes" && 4852 test "$tst_proto_strtoll" = "yes" && 4853 test "$tst_compi_strtoll" = "yes" && 4854 test "$tst_allow_strtoll" = "yes"; then 4855 AC_MSG_RESULT([yes]) 4856 AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1, 4857 [Define to 1 if you have the strtoll function.]) 4858 curl_cv_func_strtoll="yes" 4859 else 4860 AC_MSG_RESULT([no]) 4861 curl_cv_func_strtoll="no" 4862 fi 4863]) 4864 4865dnl CURL_RUN_IFELSE 4866dnl ------------------------------------------------- 4867dnl Wrapper macro to use instead of AC_RUN_IFELSE. It 4868dnl sets LD_LIBRARY_PATH locally for this run only, from the 4869dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH 4870dnl changes contained within this macro. 4871 4872AC_DEFUN([CURL_RUN_IFELSE], [ 4873 case $host_os in 4874 darwin*) 4875 AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) 4876 ;; 4877 *) 4878 oldcc=$CC 4879 old=$LD_LIBRARY_PATH 4880 CC="sh ./run-compiler" 4881 LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old 4882 export LD_LIBRARY_PATH 4883 AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) 4884 LD_LIBRARY_PATH=$old # restore 4885 CC=$oldcc 4886 ;; 4887 esac 4888]) 4889 4890dnl CURL_COVERAGE 4891dnl -------------------------------------------------- 4892dnl Switch on options and libs to build with gcc's code coverage. 4893dnl 4894 4895AC_DEFUN([CURL_COVERAGE],[ 4896 AC_REQUIRE([AC_PROG_SED]) 4897 AC_REQUIRE([AC_ARG_ENABLE]) 4898 AC_MSG_CHECKING([for code coverage support]) 4899 coverage="no" 4900 curl_coverage_msg="disabled" 4901 4902 dnl check if enabled by argument 4903 AC_ARG_ENABLE(code-coverage, 4904 AS_HELP_STRING([--enable-code-coverage], [Provide code coverage]), 4905 coverage="$enableval") 4906 4907 dnl if not gcc switch off again 4908 AS_IF([ test "$GCC" != "yes" ], coverage="no" ) 4909 AC_MSG_RESULT($coverage) 4910 4911 if test "x$coverage" = "xyes"; then 4912 curl_coverage_msg="enabled" 4913 4914 AC_CHECK_TOOL([GCOV], [gcov], [gcov]) 4915 if test -z "$GCOV"; then 4916 AC_MSG_ERROR([needs gcov for code coverage]) 4917 fi 4918 AC_CHECK_PROG([LCOV], [lcov], [lcov]) 4919 if test -z "$LCOV"; then 4920 AC_MSG_ERROR([needs lcov for code coverage]) 4921 fi 4922 4923 CPPFLAGS="$CPPFLAGS -DNDEBUG" 4924 CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage" 4925 LIBS="$LIBS -lgcov" 4926 fi 4927]) 4928 4929dnl CURL_ATOMIC 4930dnl ------------------------------------------------------------- 4931dnl Check if _Atomic works. But only check if stdatomic.h exists. 4932dnl 4933AC_DEFUN([CURL_ATOMIC],[ 4934 AC_CHECK_HEADERS(stdatomic.h, [ 4935 AC_MSG_CHECKING([if _Atomic is available]) 4936 AC_LINK_IFELSE([ 4937 AC_LANG_PROGRAM([[ 4938 $curl_includes_unistd 4939 ]],[[ 4940 _Atomic int i = 0; 4941 i = 4; // Force an atomic-write operation. 4942 ]]) 4943 ],[ 4944 AC_MSG_RESULT([yes]) 4945 AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1, 4946 [Define to 1 if you have _Atomic support.]) 4947 tst_atomic="yes" 4948 ],[ 4949 AC_MSG_RESULT([no]) 4950 tst_atomic="no" 4951 ]) 4952 ]) 4953]) 4954 4955# Rewrite inspired by the functionality once provided by 4956# AX_COMPILE_CHECK_SIZEOF. Uses the switch() "trick" to find the size of the 4957# given type. 4958# 4959# This code fails to compile: 4960# 4961# switch() { case 0: case 0: } 4962# 4963# By making the second case number a boolean check, it fails to compile the 4964# test code when the boolean is false and thus creating a zero, making it a 4965# duplicated case label. If the boolean equals true, it becomes a one, the 4966# code compiles and we know it was a match. 4967# 4968# The check iterates over all possible sizes and stops as soon it compiles 4969# error-free. 4970# 4971# Usage: 4972# 4973# CURL_SIZEOF(TYPE, [HEADERS]) 4974# 4975 4976AC_DEFUN([CURL_SIZEOF], [ 4977 dnl The #define name to make autoheader put the name in curl_config.h.in 4978 define(TYPE, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl 4979 4980 AC_MSG_CHECKING(size of $1) 4981 r=0 4982 dnl Check the sizes in a reasonable order 4983 for typesize in 8 4 2 16 1; do 4984 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 4985#include <sys/types.h> 4986$2 4987]], 4988 [switch(0) { 4989 case 0: 4990 case (sizeof($1) == $typesize):; 4991 } 4992 ]) ], 4993 [ 4994 r=$typesize], 4995 [ 4996 r=0]) 4997 dnl get out of the loop once matched 4998 if test $r -gt 0; then 4999 break; 5000 fi 5001 done 5002 if test $r -eq 0; then 5003 AC_MSG_ERROR([Failed to find size of $1]) 5004 fi 5005 AC_MSG_RESULT($r) 5006 dnl lowercase and underscore instead of space 5007 tname=$(echo "ac_cv_sizeof_$1" | tr A-Z a-z | tr " " "_") 5008 eval "$tname=$r" 5009 5010 AC_DEFINE_UNQUOTED(TYPE, [$r], [Size of $1 in number of bytes]) 5011 5012]) 5013