curl-functions.m4 (119152B)
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 29 dnl CURL_INCLUDES_ARPA_INET 30 dnl ------------------------------------------------- 31 dnl Set up variable with list of headers that must be 32 dnl included when arpa/inet.h is to be included. 33 34 AC_DEFUN([CURL_INCLUDES_ARPA_INET], [ 35 curl_includes_arpa_inet="\ 36 /* includes start */ 37 #ifdef HAVE_SYS_TYPES_H 38 # include <sys/types.h> 39 #endif 40 #ifdef HAVE_NETINET_IN_H 41 # include <netinet/in.h> 42 #endif 43 #ifdef HAVE_ARPA_INET_H 44 # include <arpa/inet.h> 45 #endif 46 #ifdef _WIN32 47 #include <winsock2.h> 48 #include <ws2tcpip.h> 49 #else 50 #include <sys/socket.h> 51 #endif 52 /* includes end */" 53 AC_CHECK_HEADERS( 54 sys/types.h netinet/in.h arpa/inet.h, 55 [], [], [$curl_includes_arpa_inet]) 56 ]) 57 58 59 dnl CURL_INCLUDES_FCNTL 60 dnl ------------------------------------------------- 61 dnl Set up variable with list of headers that must be 62 dnl included when fcntl.h is to be included. 63 64 AC_DEFUN([CURL_INCLUDES_FCNTL], [ 65 curl_includes_fcntl="\ 66 /* includes start */ 67 #ifdef HAVE_SYS_TYPES_H 68 # include <sys/types.h> 69 #endif 70 #ifdef HAVE_UNISTD_H 71 # include <unistd.h> 72 #endif 73 #ifdef HAVE_FCNTL_H 74 # include <fcntl.h> 75 #endif 76 /* includes end */" 77 AC_CHECK_HEADERS( 78 sys/types.h unistd.h fcntl.h, 79 [], [], [$curl_includes_fcntl]) 80 ]) 81 82 83 dnl CURL_INCLUDES_IFADDRS 84 dnl ------------------------------------------------- 85 dnl Set up variable with list of headers that must be 86 dnl included when ifaddrs.h is to be included. 87 88 AC_DEFUN([CURL_INCLUDES_IFADDRS], [ 89 curl_includes_ifaddrs="\ 90 /* includes start */ 91 #ifdef HAVE_SYS_TYPES_H 92 # include <sys/types.h> 93 #endif 94 #ifndef _WIN32 95 # include <sys/socket.h> 96 #endif 97 #ifdef HAVE_NETINET_IN_H 98 # include <netinet/in.h> 99 #endif 100 #ifdef HAVE_IFADDRS_H 101 # include <ifaddrs.h> 102 #endif 103 /* includes end */" 104 AC_CHECK_HEADERS( 105 sys/types.h netinet/in.h ifaddrs.h, 106 [], [], [$curl_includes_ifaddrs]) 107 ]) 108 109 110 dnl CURL_INCLUDES_LIBGEN 111 dnl ------------------------------------------------- 112 dnl Set up variable with list of headers that must be 113 dnl included when libgen.h is to be included. 114 115 AC_DEFUN([CURL_INCLUDES_LIBGEN], [ 116 curl_includes_libgen="\ 117 /* includes start */ 118 #ifdef HAVE_SYS_TYPES_H 119 # include <sys/types.h> 120 #endif 121 #ifdef HAVE_LIBGEN_H 122 # include <libgen.h> 123 #endif 124 /* includes end */" 125 AC_CHECK_HEADERS( 126 sys/types.h libgen.h, 127 [], [], [$curl_includes_libgen]) 128 ]) 129 130 131 dnl CURL_INCLUDES_NETDB 132 dnl ------------------------------------------------- 133 dnl Set up variable with list of headers that must be 134 dnl included when netdb.h is to be included. 135 136 AC_DEFUN([CURL_INCLUDES_NETDB], [ 137 curl_includes_netdb="\ 138 /* includes start */ 139 #ifdef HAVE_SYS_TYPES_H 140 # include <sys/types.h> 141 #endif 142 #ifdef HAVE_NETDB_H 143 # include <netdb.h> 144 #endif 145 /* includes end */" 146 AC_CHECK_HEADERS( 147 sys/types.h netdb.h, 148 [], [], [$curl_includes_netdb]) 149 ]) 150 151 152 dnl CURL_INCLUDES_SETJMP 153 dnl ------------------------------------------------- 154 dnl Set up variable with list of headers that must be 155 dnl included when setjmp.h is to be included. 156 157 AC_DEFUN([CURL_INCLUDES_SETJMP], [ 158 curl_includes_setjmp="\ 159 /* includes start */ 160 #ifdef HAVE_SYS_TYPES_H 161 # include <sys/types.h> 162 #endif 163 #include <setjmp.h> 164 /* includes end */" 165 AC_CHECK_HEADERS( 166 sys/types.h, 167 [], [], [$curl_includes_setjmp]) 168 ]) 169 170 171 dnl CURL_INCLUDES_SIGNAL 172 dnl ------------------------------------------------- 173 dnl Set up variable with list of headers that must be 174 dnl included when signal.h is to be included. 175 176 AC_DEFUN([CURL_INCLUDES_SIGNAL], [ 177 curl_includes_signal="\ 178 /* includes start */ 179 #ifdef HAVE_SYS_TYPES_H 180 # include <sys/types.h> 181 #endif 182 #include <signal.h> 183 /* includes end */" 184 AC_CHECK_HEADERS( 185 sys/types.h, 186 [], [], [$curl_includes_signal]) 187 ]) 188 189 190 dnl CURL_INCLUDES_STDLIB 191 dnl ------------------------------------------------- 192 dnl Set up variable with list of headers that must be 193 dnl included when stdlib.h is to be included. 194 195 AC_DEFUN([CURL_INCLUDES_STDLIB], [ 196 curl_includes_stdlib="\ 197 /* includes start */ 198 #ifdef HAVE_SYS_TYPES_H 199 # include <sys/types.h> 200 #endif 201 #include <stdlib.h> 202 /* includes end */" 203 AC_CHECK_HEADERS( 204 sys/types.h, 205 [], [], [$curl_includes_stdlib]) 206 ]) 207 208 209 dnl CURL_INCLUDES_STRING 210 dnl ------------------------------------------------- 211 dnl Set up variable with list of headers that must be 212 dnl included when string(s).h is to be included. 213 214 AC_DEFUN([CURL_INCLUDES_STRING], [ 215 curl_includes_string="\ 216 /* includes start */ 217 #ifdef HAVE_SYS_TYPES_H 218 # include <sys/types.h> 219 #endif 220 #include <string.h> 221 #ifdef HAVE_STRINGS_H 222 # include <strings.h> 223 #endif 224 /* includes end */" 225 AC_CHECK_HEADERS( 226 sys/types.h strings.h, 227 [], [], [$curl_includes_string]) 228 ]) 229 230 231 dnl CURL_INCLUDES_STROPTS 232 dnl ------------------------------------------------- 233 dnl Set up variable with list of headers that must be 234 dnl included when stropts.h is to be included. 235 236 AC_DEFUN([CURL_INCLUDES_STROPTS], [ 237 curl_includes_stropts="\ 238 /* includes start */ 239 #ifdef HAVE_SYS_TYPES_H 240 # include <sys/types.h> 241 #endif 242 #ifdef HAVE_UNISTD_H 243 # include <unistd.h> 244 #endif 245 #ifndef _WIN32 246 # include <sys/socket.h> 247 #endif 248 #ifdef HAVE_SYS_IOCTL_H 249 # include <sys/ioctl.h> 250 #endif 251 #ifdef HAVE_STROPTS_H 252 # include <stropts.h> 253 #endif 254 /* includes end */" 255 AC_CHECK_HEADERS( 256 sys/types.h unistd.h sys/ioctl.h stropts.h, 257 [], [], [$curl_includes_stropts]) 258 ]) 259 260 261 dnl CURL_INCLUDES_SYS_SOCKET 262 dnl ------------------------------------------------- 263 dnl Set up variable with list of headers that must be 264 dnl included when sys/socket.h is to be included. 265 266 AC_DEFUN([CURL_INCLUDES_SYS_SOCKET], [ 267 curl_includes_sys_socket="\ 268 /* includes start */ 269 #ifdef HAVE_SYS_TYPES_H 270 # include <sys/types.h> 271 #endif 272 #ifndef _WIN32 273 # include <sys/socket.h> 274 #endif 275 /* includes end */" 276 AC_CHECK_HEADERS( 277 sys/types.h, 278 [], [], [$curl_includes_sys_socket]) 279 ]) 280 281 282 dnl CURL_INCLUDES_SYS_TYPES 283 dnl ------------------------------------------------- 284 dnl Set up variable with list of headers that must be 285 dnl included when sys/types.h is to be included. 286 287 AC_DEFUN([CURL_INCLUDES_SYS_TYPES], [ 288 curl_includes_sys_types="\ 289 /* includes start */ 290 #ifdef HAVE_SYS_TYPES_H 291 # include <sys/types.h> 292 #endif 293 /* includes end */" 294 AC_CHECK_HEADERS( 295 sys/types.h, 296 [], [], [$curl_includes_sys_types]) 297 ]) 298 299 300 dnl CURL_INCLUDES_SYS_XATTR 301 dnl ------------------------------------------------- 302 dnl Set up variable with list of headers that must be 303 dnl included when sys/xattr.h is to be included. 304 305 AC_DEFUN([CURL_INCLUDES_SYS_XATTR], [ 306 curl_includes_sys_xattr="\ 307 /* includes start */ 308 #ifdef HAVE_SYS_TYPES_H 309 # include <sys/types.h> 310 #endif 311 #ifdef HAVE_SYS_XATTR_H 312 # include <sys/xattr.h> 313 #endif 314 /* includes end */" 315 AC_CHECK_HEADERS( 316 sys/types.h sys/xattr.h, 317 [], [], [$curl_includes_sys_xattr]) 318 ]) 319 320 dnl CURL_INCLUDES_TIME 321 dnl ------------------------------------------------- 322 dnl Set up variable with list of headers that must be 323 dnl included when time.h is to be included. 324 325 AC_DEFUN([CURL_INCLUDES_TIME], [ 326 curl_includes_time="\ 327 /* includes start */ 328 #ifdef HAVE_SYS_TYPES_H 329 # include <sys/types.h> 330 #endif 331 #if !defined(_WIN32) || defined(__MINGW32__) 332 # include <sys/time.h> 333 #endif 334 #include <time.h> 335 /* includes end */" 336 AC_CHECK_HEADERS( 337 sys/types.h, 338 [], [], [$curl_includes_time]) 339 ]) 340 341 342 dnl CURL_INCLUDES_UNISTD 343 dnl ------------------------------------------------- 344 dnl Set up variable with list of headers that must be 345 dnl included when unistd.h is to be included. 346 347 AC_DEFUN([CURL_INCLUDES_UNISTD], [ 348 curl_includes_unistd="\ 349 /* includes start */ 350 #ifdef HAVE_SYS_TYPES_H 351 # include <sys/types.h> 352 #endif 353 #ifdef HAVE_UNISTD_H 354 # include <unistd.h> 355 #endif 356 /* includes end */" 357 AC_CHECK_HEADERS( 358 sys/types.h unistd.h, 359 [], [], [$curl_includes_unistd]) 360 ]) 361 362 363 dnl CURL_INCLUDES_WINSOCK2 364 dnl ------------------------------------------------- 365 dnl Set up variable with list of headers that must be 366 dnl included when winsock2.h is to be included. 367 368 AC_DEFUN([CURL_INCLUDES_WINSOCK2], [ 369 curl_includes_winsock2="\ 370 /* includes start */ 371 #ifdef _WIN32 372 # ifndef WIN32_LEAN_AND_MEAN 373 # define WIN32_LEAN_AND_MEAN 374 # endif 375 # include <winsock2.h> 376 #endif 377 /* includes end */" 378 CURL_CHECK_NATIVE_WINDOWS 379 ]) 380 381 382 dnl CURL_INCLUDES_WS2TCPIP 383 dnl ------------------------------------------------- 384 dnl Set up variable with list of headers that must be 385 dnl included when ws2tcpip.h is to be included. 386 387 AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [ 388 curl_includes_ws2tcpip="\ 389 /* includes start */ 390 #ifdef _WIN32 391 # ifndef WIN32_LEAN_AND_MEAN 392 # define WIN32_LEAN_AND_MEAN 393 # endif 394 # include <winsock2.h> 395 # include <ws2tcpip.h> 396 #endif 397 /* includes end */" 398 CURL_CHECK_NATIVE_WINDOWS 399 ]) 400 401 402 dnl CURL_INCLUDES_BSDSOCKET 403 dnl ------------------------------------------------- 404 dnl Set up variable with list of headers that must be 405 dnl included when bsdsocket.h is to be included. 406 407 AC_DEFUN([CURL_INCLUDES_BSDSOCKET], [ 408 curl_includes_bsdsocket="\ 409 /* includes start */ 410 #if defined(HAVE_PROTO_BSDSOCKET_H) 411 # define __NO_NET_API 412 # define __USE_INLINE__ 413 # include <proto/bsdsocket.h> 414 # ifdef HAVE_SYS_IOCTL_H 415 # include <sys/ioctl.h> 416 # endif 417 # ifdef __amigaos4__ 418 struct SocketIFace *ISocket = NULL; 419 # else 420 struct Library *SocketBase = NULL; 421 # endif 422 # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) 423 #endif 424 /* includes end */" 425 AC_CHECK_HEADERS( 426 proto/bsdsocket.h, 427 [], [], [$curl_includes_bsdsocket]) 428 ]) 429 430 dnl CURL_INCLUDES_NETIF 431 dnl ------------------------------------------------- 432 dnl Set up variable with list of headers that must be 433 dnl included when net/if.h is to be included. 434 435 AC_DEFUN([CURL_INCLUDES_NETIF], [ 436 curl_includes_netif="\ 437 /* includes start */ 438 #ifdef HAVE_NET_IF_H 439 # include <net/if.h> 440 #endif 441 /* includes end */" 442 AC_CHECK_HEADERS( 443 net/if.h, 444 [], [], [$curl_includes_netif]) 445 ]) 446 447 448 dnl CURL_PREPROCESS_CALLCONV 449 dnl ------------------------------------------------- 450 dnl Set up variable with a preprocessor block which 451 dnl defines function calling convention. 452 453 AC_DEFUN([CURL_PREPROCESS_CALLCONV], [ 454 curl_preprocess_callconv="\ 455 /* preprocess start */ 456 #ifdef _WIN32 457 # define FUNCALLCONV __stdcall 458 #else 459 # define FUNCALLCONV 460 #endif 461 /* preprocess end */" 462 ]) 463 464 465 dnl CURL_CHECK_FUNC_ALARM 466 dnl ------------------------------------------------- 467 dnl Verify if alarm is available, prototyped, and 468 dnl can be compiled. If all of these are true, and 469 dnl usage has not been previously disallowed with 470 dnl shell variable curl_disallow_alarm, then 471 dnl HAVE_ALARM will be defined. 472 473 AC_DEFUN([CURL_CHECK_FUNC_ALARM], [ 474 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 475 # 476 tst_links_alarm="unknown" 477 tst_proto_alarm="unknown" 478 tst_compi_alarm="unknown" 479 tst_allow_alarm="unknown" 480 # 481 AC_MSG_CHECKING([if alarm can be linked]) 482 AC_LINK_IFELSE([ 483 AC_LANG_FUNC_LINK_TRY([alarm]) 484 ],[ 485 AC_MSG_RESULT([yes]) 486 tst_links_alarm="yes" 487 ],[ 488 AC_MSG_RESULT([no]) 489 tst_links_alarm="no" 490 ]) 491 # 492 if test "$tst_links_alarm" = "yes"; then 493 AC_MSG_CHECKING([if alarm is prototyped]) 494 AC_EGREP_CPP([alarm],[ 495 $curl_includes_unistd 496 ],[ 497 AC_MSG_RESULT([yes]) 498 tst_proto_alarm="yes" 499 ],[ 500 AC_MSG_RESULT([no]) 501 tst_proto_alarm="no" 502 ]) 503 fi 504 # 505 if test "$tst_proto_alarm" = "yes"; then 506 AC_MSG_CHECKING([if alarm is compilable]) 507 AC_COMPILE_IFELSE([ 508 AC_LANG_PROGRAM([[ 509 $curl_includes_unistd 510 ]],[[ 511 if(0 != alarm(0)) 512 return 1; 513 ]]) 514 ],[ 515 AC_MSG_RESULT([yes]) 516 tst_compi_alarm="yes" 517 ],[ 518 AC_MSG_RESULT([no]) 519 tst_compi_alarm="no" 520 ]) 521 fi 522 # 523 if test "$tst_compi_alarm" = "yes"; then 524 AC_MSG_CHECKING([if alarm usage allowed]) 525 if test "x$curl_disallow_alarm" != "xyes"; then 526 AC_MSG_RESULT([yes]) 527 tst_allow_alarm="yes" 528 else 529 AC_MSG_RESULT([no]) 530 tst_allow_alarm="no" 531 fi 532 fi 533 # 534 AC_MSG_CHECKING([if alarm might be used]) 535 if test "$tst_links_alarm" = "yes" && 536 test "$tst_proto_alarm" = "yes" && 537 test "$tst_compi_alarm" = "yes" && 538 test "$tst_allow_alarm" = "yes"; then 539 AC_MSG_RESULT([yes]) 540 AC_DEFINE_UNQUOTED(HAVE_ALARM, 1, 541 [Define to 1 if you have the alarm function.]) 542 curl_cv_func_alarm="yes" 543 else 544 AC_MSG_RESULT([no]) 545 curl_cv_func_alarm="no" 546 fi 547 ]) 548 549 550 dnl CURL_CHECK_FUNC_BASENAME 551 dnl ------------------------------------------------- 552 dnl Verify if basename is available, prototyped, and 553 dnl can be compiled. If all of these are true, and 554 dnl usage has not been previously disallowed with 555 dnl shell variable curl_disallow_basename, then 556 dnl HAVE_BASENAME will be defined. 557 558 AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [ 559 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 560 AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl 561 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 562 # 563 tst_links_basename="unknown" 564 tst_proto_basename="unknown" 565 tst_compi_basename="unknown" 566 tst_allow_basename="unknown" 567 # 568 AC_MSG_CHECKING([if basename can be linked]) 569 AC_LINK_IFELSE([ 570 AC_LANG_FUNC_LINK_TRY([basename]) 571 ],[ 572 AC_MSG_RESULT([yes]) 573 tst_links_basename="yes" 574 ],[ 575 AC_MSG_RESULT([no]) 576 tst_links_basename="no" 577 ]) 578 # 579 if test "$tst_links_basename" = "yes"; then 580 AC_MSG_CHECKING([if basename is prototyped]) 581 AC_EGREP_CPP([basename],[ 582 $curl_includes_string 583 $curl_includes_libgen 584 $curl_includes_unistd 585 ],[ 586 AC_MSG_RESULT([yes]) 587 tst_proto_basename="yes" 588 ],[ 589 AC_MSG_RESULT([no]) 590 tst_proto_basename="no" 591 ]) 592 fi 593 # 594 if test "$tst_proto_basename" = "yes"; then 595 AC_MSG_CHECKING([if basename is compilable]) 596 AC_COMPILE_IFELSE([ 597 AC_LANG_PROGRAM([[ 598 $curl_includes_string 599 $curl_includes_libgen 600 $curl_includes_unistd 601 ]],[[ 602 if(0 != basename(0)) 603 return 1; 604 ]]) 605 ],[ 606 AC_MSG_RESULT([yes]) 607 tst_compi_basename="yes" 608 ],[ 609 AC_MSG_RESULT([no]) 610 tst_compi_basename="no" 611 ]) 612 fi 613 # 614 if test "$tst_compi_basename" = "yes"; then 615 AC_MSG_CHECKING([if basename usage allowed]) 616 if test "x$curl_disallow_basename" != "xyes"; then 617 AC_MSG_RESULT([yes]) 618 tst_allow_basename="yes" 619 else 620 AC_MSG_RESULT([no]) 621 tst_allow_basename="no" 622 fi 623 fi 624 # 625 AC_MSG_CHECKING([if basename might be used]) 626 if test "$tst_links_basename" = "yes" && 627 test "$tst_proto_basename" = "yes" && 628 test "$tst_compi_basename" = "yes" && 629 test "$tst_allow_basename" = "yes"; then 630 AC_MSG_RESULT([yes]) 631 AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1, 632 [Define to 1 if you have the basename function.]) 633 curl_cv_func_basename="yes" 634 else 635 AC_MSG_RESULT([no]) 636 curl_cv_func_basename="no" 637 fi 638 ]) 639 640 641 dnl CURL_CHECK_FUNC_CLOSESOCKET 642 dnl ------------------------------------------------- 643 dnl Verify if closesocket is available, prototyped, and 644 dnl can be compiled. If all of these are true, and 645 dnl usage has not been previously disallowed with 646 dnl shell variable curl_disallow_closesocket, then 647 dnl HAVE_CLOSESOCKET will be defined. 648 649 AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET], [ 650 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 651 # 652 tst_links_closesocket="unknown" 653 tst_proto_closesocket="unknown" 654 tst_compi_closesocket="unknown" 655 tst_allow_closesocket="unknown" 656 # 657 AC_MSG_CHECKING([if closesocket can be linked]) 658 AC_LINK_IFELSE([ 659 AC_LANG_PROGRAM([[ 660 $curl_includes_winsock2 661 ]],[[ 662 if(0 != closesocket(0)) 663 return 1; 664 ]]) 665 ],[ 666 AC_MSG_RESULT([yes]) 667 tst_links_closesocket="yes" 668 ],[ 669 AC_MSG_RESULT([no]) 670 tst_links_closesocket="no" 671 ]) 672 # 673 if test "$tst_links_closesocket" = "yes"; then 674 AC_MSG_CHECKING([if closesocket is prototyped]) 675 AC_EGREP_CPP([closesocket],[ 676 $curl_includes_winsock2 677 ],[ 678 AC_MSG_RESULT([yes]) 679 tst_proto_closesocket="yes" 680 ],[ 681 AC_MSG_RESULT([no]) 682 tst_proto_closesocket="no" 683 ]) 684 fi 685 # 686 if test "$tst_proto_closesocket" = "yes"; then 687 AC_MSG_CHECKING([if closesocket is compilable]) 688 AC_COMPILE_IFELSE([ 689 AC_LANG_PROGRAM([[ 690 $curl_includes_winsock2 691 ]],[[ 692 if(0 != closesocket(0)) 693 return 1; 694 ]]) 695 ],[ 696 AC_MSG_RESULT([yes]) 697 tst_compi_closesocket="yes" 698 ],[ 699 AC_MSG_RESULT([no]) 700 tst_compi_closesocket="no" 701 ]) 702 fi 703 # 704 if test "$tst_compi_closesocket" = "yes"; then 705 AC_MSG_CHECKING([if closesocket usage allowed]) 706 if test "x$curl_disallow_closesocket" != "xyes"; then 707 AC_MSG_RESULT([yes]) 708 tst_allow_closesocket="yes" 709 else 710 AC_MSG_RESULT([no]) 711 tst_allow_closesocket="no" 712 fi 713 fi 714 # 715 AC_MSG_CHECKING([if closesocket might be used]) 716 if test "$tst_links_closesocket" = "yes" && 717 test "$tst_proto_closesocket" = "yes" && 718 test "$tst_compi_closesocket" = "yes" && 719 test "$tst_allow_closesocket" = "yes"; then 720 AC_MSG_RESULT([yes]) 721 AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1, 722 [Define to 1 if you have the closesocket function.]) 723 curl_cv_func_closesocket="yes" 724 else 725 AC_MSG_RESULT([no]) 726 curl_cv_func_closesocket="no" 727 fi 728 ]) 729 730 731 dnl CURL_CHECK_FUNC_CLOSESOCKET_CAMEL 732 dnl ------------------------------------------------- 733 dnl Verify if CloseSocket is available, prototyped, and 734 dnl can be compiled. If all of these are true, and 735 dnl usage has not been previously disallowed with 736 dnl shell variable curl_disallow_closesocket_camel, 737 dnl then HAVE_CLOSESOCKET_CAMEL will be defined. 738 739 AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [ 740 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 741 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 742 # 743 tst_links_closesocket_camel="unknown" 744 tst_compi_closesocket_camel="unknown" 745 tst_allow_closesocket_camel="unknown" 746 # 747 AC_MSG_CHECKING([if CloseSocket can be linked]) 748 AC_LINK_IFELSE([ 749 AC_LANG_PROGRAM([[ 750 $curl_includes_bsdsocket 751 $curl_includes_sys_socket 752 ]],[[ 753 if(0 != CloseSocket(0)) 754 return 1; 755 ]]) 756 ],[ 757 AC_MSG_RESULT([yes]) 758 tst_links_closesocket_camel="yes" 759 ],[ 760 AC_MSG_RESULT([no]) 761 tst_links_closesocket_camel="no" 762 ]) 763 # 764 if test "$tst_links_closesocket_camel" = "yes"; then 765 AC_MSG_CHECKING([if CloseSocket is compilable]) 766 AC_COMPILE_IFELSE([ 767 AC_LANG_PROGRAM([[ 768 $curl_includes_bsdsocket 769 $curl_includes_sys_socket 770 ]],[[ 771 if(0 != CloseSocket(0)) 772 return 1; 773 ]]) 774 ],[ 775 AC_MSG_RESULT([yes]) 776 tst_compi_closesocket_camel="yes" 777 ],[ 778 AC_MSG_RESULT([no]) 779 tst_compi_closesocket_camel="no" 780 ]) 781 fi 782 # 783 if test "$tst_compi_closesocket_camel" = "yes"; then 784 AC_MSG_CHECKING([if CloseSocket usage allowed]) 785 if test "x$curl_disallow_closesocket_camel" != "xyes"; then 786 AC_MSG_RESULT([yes]) 787 tst_allow_closesocket_camel="yes" 788 else 789 AC_MSG_RESULT([no]) 790 tst_allow_closesocket_camel="no" 791 fi 792 fi 793 # 794 AC_MSG_CHECKING([if CloseSocket might be used]) 795 if test "$tst_links_closesocket_camel" = "yes" && 796 test "$tst_compi_closesocket_camel" = "yes" && 797 test "$tst_allow_closesocket_camel" = "yes"; then 798 AC_MSG_RESULT([yes]) 799 AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1, 800 [Define to 1 if you have the CloseSocket camel case function.]) 801 curl_cv_func_closesocket_camel="yes" 802 else 803 AC_MSG_RESULT([no]) 804 curl_cv_func_closesocket_camel="no" 805 fi 806 ]) 807 808 dnl CURL_CHECK_FUNC_FCNTL 809 dnl ------------------------------------------------- 810 dnl Verify if fcntl is available, prototyped, and 811 dnl can be compiled. If all of these are true, and 812 dnl usage has not been previously disallowed with 813 dnl shell variable curl_disallow_fcntl, then 814 dnl HAVE_FCNTL will be defined. 815 816 AC_DEFUN([CURL_CHECK_FUNC_FCNTL], [ 817 AC_REQUIRE([CURL_INCLUDES_FCNTL])dnl 818 # 819 tst_links_fcntl="unknown" 820 tst_proto_fcntl="unknown" 821 tst_compi_fcntl="unknown" 822 tst_allow_fcntl="unknown" 823 # 824 AC_MSG_CHECKING([if fcntl can be linked]) 825 AC_LINK_IFELSE([ 826 AC_LANG_FUNC_LINK_TRY([fcntl]) 827 ],[ 828 AC_MSG_RESULT([yes]) 829 tst_links_fcntl="yes" 830 ],[ 831 AC_MSG_RESULT([no]) 832 tst_links_fcntl="no" 833 ]) 834 # 835 if test "$tst_links_fcntl" = "yes"; then 836 AC_MSG_CHECKING([if fcntl is prototyped]) 837 AC_EGREP_CPP([fcntl],[ 838 $curl_includes_fcntl 839 ],[ 840 AC_MSG_RESULT([yes]) 841 tst_proto_fcntl="yes" 842 ],[ 843 AC_MSG_RESULT([no]) 844 tst_proto_fcntl="no" 845 ]) 846 fi 847 # 848 if test "$tst_proto_fcntl" = "yes"; then 849 AC_MSG_CHECKING([if fcntl is compilable]) 850 AC_COMPILE_IFELSE([ 851 AC_LANG_PROGRAM([[ 852 $curl_includes_fcntl 853 ]],[[ 854 if(0 != fcntl(0, 0, 0)) 855 return 1; 856 ]]) 857 ],[ 858 AC_MSG_RESULT([yes]) 859 tst_compi_fcntl="yes" 860 ],[ 861 AC_MSG_RESULT([no]) 862 tst_compi_fcntl="no" 863 ]) 864 fi 865 # 866 if test "$tst_compi_fcntl" = "yes"; then 867 AC_MSG_CHECKING([if fcntl usage allowed]) 868 if test "x$curl_disallow_fcntl" != "xyes"; then 869 AC_MSG_RESULT([yes]) 870 tst_allow_fcntl="yes" 871 else 872 AC_MSG_RESULT([no]) 873 tst_allow_fcntl="no" 874 fi 875 fi 876 # 877 AC_MSG_CHECKING([if fcntl might be used]) 878 if test "$tst_links_fcntl" = "yes" && 879 test "$tst_proto_fcntl" = "yes" && 880 test "$tst_compi_fcntl" = "yes" && 881 test "$tst_allow_fcntl" = "yes"; then 882 AC_MSG_RESULT([yes]) 883 AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1, 884 [Define to 1 if you have the fcntl function.]) 885 curl_cv_func_fcntl="yes" 886 CURL_CHECK_FUNC_FCNTL_O_NONBLOCK 887 else 888 AC_MSG_RESULT([no]) 889 curl_cv_func_fcntl="no" 890 fi 891 ]) 892 893 894 dnl CURL_CHECK_FUNC_FCNTL_O_NONBLOCK 895 dnl ------------------------------------------------- 896 dnl Verify if fcntl with status flag O_NONBLOCK is 897 dnl available, can be compiled, and seems to work. If 898 dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK 899 dnl will be defined. 900 901 AC_DEFUN([CURL_CHECK_FUNC_FCNTL_O_NONBLOCK], [ 902 # 903 tst_compi_fcntl_o_nonblock="unknown" 904 tst_allow_fcntl_o_nonblock="unknown" 905 # 906 case $host_os in 907 sunos4* | aix3*) 908 dnl O_NONBLOCK does not work on these platforms 909 curl_disallow_fcntl_o_nonblock="yes" 910 ;; 911 esac 912 # 913 if test "$curl_cv_func_fcntl" = "yes"; then 914 AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable]) 915 AC_COMPILE_IFELSE([ 916 AC_LANG_PROGRAM([[ 917 $curl_includes_fcntl 918 ]],[[ 919 int flags = 0; 920 if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) 921 return 1; 922 ]]) 923 ],[ 924 AC_MSG_RESULT([yes]) 925 tst_compi_fcntl_o_nonblock="yes" 926 ],[ 927 AC_MSG_RESULT([no]) 928 tst_compi_fcntl_o_nonblock="no" 929 ]) 930 fi 931 # 932 if test "$tst_compi_fcntl_o_nonblock" = "yes"; then 933 AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed]) 934 if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then 935 AC_MSG_RESULT([yes]) 936 tst_allow_fcntl_o_nonblock="yes" 937 else 938 AC_MSG_RESULT([no]) 939 tst_allow_fcntl_o_nonblock="no" 940 fi 941 fi 942 # 943 AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used]) 944 if test "$tst_compi_fcntl_o_nonblock" = "yes" && 945 test "$tst_allow_fcntl_o_nonblock" = "yes"; then 946 AC_MSG_RESULT([yes]) 947 AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1, 948 [Define to 1 if you have a working fcntl O_NONBLOCK function.]) 949 curl_cv_func_fcntl_o_nonblock="yes" 950 else 951 AC_MSG_RESULT([no]) 952 curl_cv_func_fcntl_o_nonblock="no" 953 fi 954 ]) 955 956 957 dnl CURL_CHECK_FUNC_FREEADDRINFO 958 dnl ------------------------------------------------- 959 dnl Verify if freeaddrinfo is available, prototyped, 960 dnl and can be compiled. If all of these are true, 961 dnl and usage has not been previously disallowed with 962 dnl shell variable curl_disallow_freeaddrinfo, then 963 dnl HAVE_FREEADDRINFO will be defined. 964 965 AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [ 966 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl 967 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 968 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 969 # 970 tst_links_freeaddrinfo="unknown" 971 tst_proto_freeaddrinfo="unknown" 972 tst_compi_freeaddrinfo="unknown" 973 tst_allow_freeaddrinfo="unknown" 974 # 975 AC_MSG_CHECKING([if freeaddrinfo can be linked]) 976 AC_LINK_IFELSE([ 977 AC_LANG_PROGRAM([[ 978 $curl_includes_ws2tcpip 979 $curl_includes_sys_socket 980 $curl_includes_netdb 981 ]],[[ 982 freeaddrinfo(0); 983 ]]) 984 ],[ 985 AC_MSG_RESULT([yes]) 986 tst_links_freeaddrinfo="yes" 987 ],[ 988 AC_MSG_RESULT([no]) 989 tst_links_freeaddrinfo="no" 990 ]) 991 # 992 if test "$tst_links_freeaddrinfo" = "yes"; then 993 AC_MSG_CHECKING([if freeaddrinfo is prototyped]) 994 AC_EGREP_CPP([freeaddrinfo],[ 995 $curl_includes_ws2tcpip 996 $curl_includes_sys_socket 997 $curl_includes_netdb 998 ],[ 999 AC_MSG_RESULT([yes]) 1000 tst_proto_freeaddrinfo="yes" 1001 ],[ 1002 AC_MSG_RESULT([no]) 1003 tst_proto_freeaddrinfo="no" 1004 ]) 1005 fi 1006 # 1007 if test "$tst_proto_freeaddrinfo" = "yes"; then 1008 AC_MSG_CHECKING([if freeaddrinfo is compilable]) 1009 AC_COMPILE_IFELSE([ 1010 AC_LANG_PROGRAM([[ 1011 $curl_includes_ws2tcpip 1012 $curl_includes_sys_socket 1013 $curl_includes_netdb 1014 ]],[[ 1015 freeaddrinfo(0); 1016 ]]) 1017 ],[ 1018 AC_MSG_RESULT([yes]) 1019 tst_compi_freeaddrinfo="yes" 1020 ],[ 1021 AC_MSG_RESULT([no]) 1022 tst_compi_freeaddrinfo="no" 1023 ]) 1024 fi 1025 # 1026 if test "$tst_compi_freeaddrinfo" = "yes"; then 1027 AC_MSG_CHECKING([if freeaddrinfo usage allowed]) 1028 if test "x$curl_disallow_freeaddrinfo" != "xyes"; then 1029 AC_MSG_RESULT([yes]) 1030 tst_allow_freeaddrinfo="yes" 1031 else 1032 AC_MSG_RESULT([no]) 1033 tst_allow_freeaddrinfo="no" 1034 fi 1035 fi 1036 # 1037 AC_MSG_CHECKING([if freeaddrinfo might be used]) 1038 if test "$tst_links_freeaddrinfo" = "yes" && 1039 test "$tst_proto_freeaddrinfo" = "yes" && 1040 test "$tst_compi_freeaddrinfo" = "yes" && 1041 test "$tst_allow_freeaddrinfo" = "yes"; then 1042 AC_MSG_RESULT([yes]) 1043 AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1, 1044 [Define to 1 if you have the freeaddrinfo function.]) 1045 curl_cv_func_freeaddrinfo="yes" 1046 else 1047 AC_MSG_RESULT([no]) 1048 curl_cv_func_freeaddrinfo="no" 1049 fi 1050 ]) 1051 1052 1053 dnl CURL_CHECK_FUNC_FSETXATTR 1054 dnl ------------------------------------------------- 1055 dnl Verify if fsetxattr is available, prototyped, and 1056 dnl can be compiled. If all of these are true, and 1057 dnl usage has not been previously disallowed with 1058 dnl shell variable curl_disallow_fsetxattr, then 1059 dnl HAVE_FSETXATTR will be defined. 1060 1061 AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [ 1062 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl 1063 # 1064 tst_links_fsetxattr="unknown" 1065 tst_proto_fsetxattr="unknown" 1066 tst_compi_fsetxattr="unknown" 1067 tst_allow_fsetxattr="unknown" 1068 tst_nargs_fsetxattr="unknown" 1069 # 1070 AC_MSG_CHECKING([if fsetxattr can be linked]) 1071 AC_LINK_IFELSE([ 1072 AC_LANG_FUNC_LINK_TRY([fsetxattr]) 1073 ],[ 1074 AC_MSG_RESULT([yes]) 1075 tst_links_fsetxattr="yes" 1076 ],[ 1077 AC_MSG_RESULT([no]) 1078 tst_links_fsetxattr="no" 1079 ]) 1080 # 1081 if test "$tst_links_fsetxattr" = "yes"; then 1082 AC_MSG_CHECKING([if fsetxattr is prototyped]) 1083 AC_EGREP_CPP([fsetxattr],[ 1084 $curl_includes_sys_xattr 1085 ],[ 1086 AC_MSG_RESULT([yes]) 1087 tst_proto_fsetxattr="yes" 1088 ],[ 1089 AC_MSG_RESULT([no]) 1090 tst_proto_fsetxattr="no" 1091 ]) 1092 fi 1093 # 1094 if test "$tst_proto_fsetxattr" = "yes"; then 1095 if test "$tst_nargs_fsetxattr" = "unknown"; then 1096 AC_MSG_CHECKING([if fsetxattr takes 5 args.]) 1097 AC_COMPILE_IFELSE([ 1098 AC_LANG_PROGRAM([[ 1099 $curl_includes_sys_xattr 1100 ]],[[ 1101 if(0 != fsetxattr(0, "", 0, 0, 0)) 1102 return 1; 1103 ]]) 1104 ],[ 1105 AC_MSG_RESULT([yes]) 1106 tst_compi_fsetxattr="yes" 1107 tst_nargs_fsetxattr="5" 1108 ],[ 1109 AC_MSG_RESULT([no]) 1110 tst_compi_fsetxattr="no" 1111 ]) 1112 fi 1113 if test "$tst_nargs_fsetxattr" = "unknown"; then 1114 AC_MSG_CHECKING([if fsetxattr takes 6 args.]) 1115 AC_COMPILE_IFELSE([ 1116 AC_LANG_PROGRAM([[ 1117 $curl_includes_sys_xattr 1118 ]],[[ 1119 if(0 != fsetxattr(0, 0, 0, 0, 0, 0)) 1120 return 1; 1121 ]]) 1122 ],[ 1123 AC_MSG_RESULT([yes]) 1124 tst_compi_fsetxattr="yes" 1125 tst_nargs_fsetxattr="6" 1126 ],[ 1127 AC_MSG_RESULT([no]) 1128 tst_compi_fsetxattr="no" 1129 ]) 1130 fi 1131 AC_MSG_CHECKING([if fsetxattr is compilable]) 1132 if test "$tst_compi_fsetxattr" = "yes"; then 1133 AC_MSG_RESULT([yes]) 1134 else 1135 AC_MSG_RESULT([no]) 1136 fi 1137 fi 1138 # 1139 if test "$tst_compi_fsetxattr" = "yes"; then 1140 AC_MSG_CHECKING([if fsetxattr usage allowed]) 1141 if test "x$curl_disallow_fsetxattr" != "xyes"; then 1142 AC_MSG_RESULT([yes]) 1143 tst_allow_fsetxattr="yes" 1144 else 1145 AC_MSG_RESULT([no]) 1146 tst_allow_fsetxattr="no" 1147 fi 1148 fi 1149 # 1150 AC_MSG_CHECKING([if fsetxattr might be used]) 1151 if test "$tst_links_fsetxattr" = "yes" && 1152 test "$tst_proto_fsetxattr" = "yes" && 1153 test "$tst_compi_fsetxattr" = "yes" && 1154 test "$tst_allow_fsetxattr" = "yes"; then 1155 AC_MSG_RESULT([yes]) 1156 AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1, 1157 [Define to 1 if you have the fsetxattr function.]) 1158 dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr, 1159 dnl [Specifies the number of arguments to fsetxattr]) 1160 # 1161 if test "$tst_nargs_fsetxattr" -eq "5"; then 1162 AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args]) 1163 elif test "$tst_nargs_fsetxattr" -eq "6"; then 1164 AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args]) 1165 fi 1166 # 1167 curl_cv_func_fsetxattr="yes" 1168 else 1169 AC_MSG_RESULT([no]) 1170 curl_cv_func_fsetxattr="no" 1171 fi 1172 ]) 1173 1174 1175 dnl CURL_CHECK_FUNC_FTRUNCATE 1176 dnl ------------------------------------------------- 1177 dnl Verify if ftruncate is available, prototyped, and 1178 dnl can be compiled. If all of these are true, and 1179 dnl usage has not been previously disallowed with 1180 dnl shell variable curl_disallow_ftruncate, then 1181 dnl HAVE_FTRUNCATE will be defined. 1182 1183 AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [ 1184 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 1185 # 1186 tst_links_ftruncate="unknown" 1187 tst_proto_ftruncate="unknown" 1188 tst_compi_ftruncate="unknown" 1189 tst_allow_ftruncate="unknown" 1190 # 1191 AC_MSG_CHECKING([if ftruncate can be linked]) 1192 AC_LINK_IFELSE([ 1193 AC_LANG_FUNC_LINK_TRY([ftruncate]) 1194 ],[ 1195 AC_MSG_RESULT([yes]) 1196 tst_links_ftruncate="yes" 1197 ],[ 1198 AC_MSG_RESULT([no]) 1199 tst_links_ftruncate="no" 1200 ]) 1201 # 1202 if test "$tst_links_ftruncate" = "yes"; then 1203 AC_MSG_CHECKING([if ftruncate is prototyped]) 1204 AC_EGREP_CPP([ftruncate],[ 1205 $curl_includes_unistd 1206 ],[ 1207 AC_MSG_RESULT([yes]) 1208 tst_proto_ftruncate="yes" 1209 ],[ 1210 AC_MSG_RESULT([no]) 1211 tst_proto_ftruncate="no" 1212 ]) 1213 fi 1214 # 1215 if test "$tst_proto_ftruncate" = "yes"; then 1216 AC_MSG_CHECKING([if ftruncate is compilable]) 1217 AC_COMPILE_IFELSE([ 1218 AC_LANG_PROGRAM([[ 1219 $curl_includes_unistd 1220 ]],[[ 1221 if(0 != ftruncate(0, 0)) 1222 return 1; 1223 ]]) 1224 ],[ 1225 AC_MSG_RESULT([yes]) 1226 tst_compi_ftruncate="yes" 1227 ],[ 1228 AC_MSG_RESULT([no]) 1229 tst_compi_ftruncate="no" 1230 ]) 1231 fi 1232 # 1233 if test "$tst_compi_ftruncate" = "yes"; then 1234 AC_MSG_CHECKING([if ftruncate usage allowed]) 1235 if test "x$curl_disallow_ftruncate" != "xyes"; then 1236 AC_MSG_RESULT([yes]) 1237 tst_allow_ftruncate="yes" 1238 else 1239 AC_MSG_RESULT([no]) 1240 tst_allow_ftruncate="no" 1241 fi 1242 fi 1243 # 1244 AC_MSG_CHECKING([if ftruncate might be used]) 1245 if test "$tst_links_ftruncate" = "yes" && 1246 test "$tst_proto_ftruncate" = "yes" && 1247 test "$tst_compi_ftruncate" = "yes" && 1248 test "$tst_allow_ftruncate" = "yes"; then 1249 AC_MSG_RESULT([yes]) 1250 AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1, 1251 [Define to 1 if you have the ftruncate function.]) 1252 curl_cv_func_ftruncate="yes" 1253 else 1254 AC_MSG_RESULT([no]) 1255 curl_cv_func_ftruncate="no" 1256 fi 1257 ]) 1258 1259 1260 dnl CURL_CHECK_FUNC_GETADDRINFO 1261 dnl ------------------------------------------------- 1262 dnl Verify if getaddrinfo is available, prototyped, can 1263 dnl be compiled and seems to work. If all of these are 1264 dnl true, and usage has not been previously disallowed 1265 dnl with shell variable curl_disallow_getaddrinfo, then 1266 dnl HAVE_GETADDRINFO will be defined. Additionally when 1267 dnl HAVE_GETADDRINFO gets defined this will also attempt 1268 dnl to find out if getaddrinfo happens to be threadsafe, 1269 dnl defining HAVE_GETADDRINFO_THREADSAFE when true. 1270 1271 AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [ 1272 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl 1273 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 1274 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 1275 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 1276 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 1277 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl 1278 # 1279 tst_links_getaddrinfo="unknown" 1280 tst_proto_getaddrinfo="unknown" 1281 tst_compi_getaddrinfo="unknown" 1282 tst_works_getaddrinfo="unknown" 1283 tst_allow_getaddrinfo="unknown" 1284 tst_tsafe_getaddrinfo="unknown" 1285 # 1286 AC_MSG_CHECKING([if getaddrinfo can be linked]) 1287 AC_LINK_IFELSE([ 1288 AC_LANG_PROGRAM([[ 1289 $curl_includes_ws2tcpip 1290 $curl_includes_sys_socket 1291 $curl_includes_netdb 1292 ]],[[ 1293 struct addrinfo *ai = 0; 1294 if(0 != getaddrinfo(0, 0, 0, &ai)) 1295 return 1; 1296 ]]) 1297 ],[ 1298 AC_MSG_RESULT([yes]) 1299 tst_links_getaddrinfo="yes" 1300 ],[ 1301 AC_MSG_RESULT([no]) 1302 tst_links_getaddrinfo="no" 1303 ]) 1304 # 1305 if test "$tst_links_getaddrinfo" = "yes"; then 1306 AC_MSG_CHECKING([if getaddrinfo is prototyped]) 1307 AC_EGREP_CPP([getaddrinfo],[ 1308 $curl_includes_ws2tcpip 1309 $curl_includes_sys_socket 1310 $curl_includes_netdb 1311 ],[ 1312 AC_MSG_RESULT([yes]) 1313 tst_proto_getaddrinfo="yes" 1314 ],[ 1315 AC_MSG_RESULT([no]) 1316 tst_proto_getaddrinfo="no" 1317 ]) 1318 fi 1319 # 1320 if test "$tst_proto_getaddrinfo" = "yes"; then 1321 AC_MSG_CHECKING([if getaddrinfo is compilable]) 1322 AC_COMPILE_IFELSE([ 1323 AC_LANG_PROGRAM([[ 1324 $curl_includes_ws2tcpip 1325 $curl_includes_sys_socket 1326 $curl_includes_netdb 1327 ]],[[ 1328 struct addrinfo *ai = 0; 1329 if(0 != getaddrinfo(0, 0, 0, &ai)) 1330 return 1; 1331 ]]) 1332 ],[ 1333 AC_MSG_RESULT([yes]) 1334 tst_compi_getaddrinfo="yes" 1335 ],[ 1336 AC_MSG_RESULT([no]) 1337 tst_compi_getaddrinfo="no" 1338 ]) 1339 fi 1340 # 1341 dnl only do runtime verification when not cross-compiling 1342 if test "x$cross_compiling" != "xyes" && 1343 test "$tst_compi_getaddrinfo" = "yes"; then 1344 AC_MSG_CHECKING([if getaddrinfo seems to work]) 1345 CURL_RUN_IFELSE([ 1346 AC_LANG_PROGRAM([[ 1347 $curl_includes_ws2tcpip 1348 $curl_includes_stdlib 1349 $curl_includes_string 1350 $curl_includes_sys_socket 1351 $curl_includes_netdb 1352 ]],[[ 1353 struct addrinfo hints; 1354 struct addrinfo *ai = 0; 1355 int error; 1356 int exitcode; 1357 1358 #ifdef _WIN32 1359 WSADATA wsa; 1360 if(WSAStartup(MAKEWORD(2, 2), &wsa)) 1361 return 2; 1362 #endif 1363 1364 memset(&hints, 0, sizeof(hints)); 1365 hints.ai_flags = AI_NUMERICHOST; 1366 hints.ai_family = AF_UNSPEC; 1367 hints.ai_socktype = SOCK_STREAM; 1368 error = getaddrinfo("127.0.0.1", 0, &hints, &ai); 1369 if(error || !ai) 1370 exitcode = 1; /* fail */ 1371 else { 1372 freeaddrinfo(ai); 1373 exitcode = 0; 1374 } 1375 #ifdef _WIN32 1376 WSACleanup(); 1377 #endif 1378 return exitcode; 1379 ]]) 1380 ],[ 1381 AC_MSG_RESULT([yes]) 1382 tst_works_getaddrinfo="yes" 1383 ],[ 1384 AC_MSG_RESULT([no]) 1385 tst_works_getaddrinfo="no" 1386 ]) 1387 fi 1388 # 1389 if test "$tst_compi_getaddrinfo" = "yes" && 1390 test "$tst_works_getaddrinfo" != "no"; then 1391 AC_MSG_CHECKING([if getaddrinfo usage allowed]) 1392 if test "x$curl_disallow_getaddrinfo" != "xyes"; then 1393 AC_MSG_RESULT([yes]) 1394 tst_allow_getaddrinfo="yes" 1395 else 1396 AC_MSG_RESULT([no]) 1397 tst_allow_getaddrinfo="no" 1398 fi 1399 fi 1400 # 1401 AC_MSG_CHECKING([if getaddrinfo might be used]) 1402 if test "$tst_proto_getaddrinfo" = "yes" && 1403 test "$tst_compi_getaddrinfo" = "yes" && 1404 test "$tst_allow_getaddrinfo" = "yes" && 1405 test "$tst_works_getaddrinfo" != "no"; then 1406 AC_MSG_RESULT([yes]) 1407 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1, 1408 [Define to 1 if you have a working getaddrinfo function.]) 1409 curl_cv_func_getaddrinfo="yes" 1410 else 1411 AC_MSG_RESULT([no]) 1412 curl_cv_func_getaddrinfo="no" 1413 curl_cv_func_getaddrinfo_threadsafe="no" 1414 fi 1415 # 1416 if test "$curl_cv_func_getaddrinfo" = "yes"; then 1417 AC_MSG_CHECKING([if getaddrinfo is threadsafe]) 1418 if test "$curl_cv_apple" = 'yes'; then 1419 dnl Darwin 6.0 and macOS 10.2.X and newer 1420 tst_tsafe_getaddrinfo="yes" 1421 fi 1422 case $host_os in 1423 aix[[1234]].* | aix5.[[01]].*) 1424 dnl AIX 5.1 and older 1425 tst_tsafe_getaddrinfo="no" 1426 ;; 1427 aix*) 1428 dnl AIX 5.2 and newer 1429 tst_tsafe_getaddrinfo="yes" 1430 ;; 1431 darwin[[12345]].*) 1432 dnl Darwin 5.0 and macOS 10.1.X and older 1433 tst_tsafe_getaddrinfo="no" 1434 ;; 1435 freebsd[[1234]].* | freebsd5.[[1234]]*) 1436 dnl FreeBSD 5.4 and older 1437 tst_tsafe_getaddrinfo="no" 1438 ;; 1439 freebsd*) 1440 dnl FreeBSD 5.5 and newer 1441 tst_tsafe_getaddrinfo="yes" 1442 ;; 1443 hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*) 1444 dnl HP-UX 11.10 and older 1445 tst_tsafe_getaddrinfo="no" 1446 ;; 1447 hpux*) 1448 dnl HP-UX 11.11 and newer 1449 tst_tsafe_getaddrinfo="yes" 1450 ;; 1451 midnightbsd*) 1452 dnl all MidnightBSD versions 1453 tst_tsafe_getaddrinfo="yes" 1454 ;; 1455 netbsd[[123]].*) 1456 dnl NetBSD 3.X and older 1457 tst_tsafe_getaddrinfo="no" 1458 ;; 1459 netbsd*) 1460 dnl NetBSD 4.X and newer 1461 tst_tsafe_getaddrinfo="yes" 1462 ;; 1463 *bsd*) 1464 dnl All other BSD's 1465 tst_tsafe_getaddrinfo="no" 1466 ;; 1467 solaris2*) 1468 dnl Solaris which have it 1469 tst_tsafe_getaddrinfo="yes" 1470 ;; 1471 esac 1472 if test "$tst_tsafe_getaddrinfo" = "unknown" && 1473 test "$curl_cv_native_windows" = "yes"; then 1474 tst_tsafe_getaddrinfo="yes" 1475 fi 1476 if test "$tst_tsafe_getaddrinfo" = "unknown"; then 1477 tst_tsafe_getaddrinfo="yes" 1478 fi 1479 AC_MSG_RESULT([$tst_tsafe_getaddrinfo]) 1480 if test "$tst_tsafe_getaddrinfo" = "yes"; then 1481 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1, 1482 [Define to 1 if the getaddrinfo function is threadsafe.]) 1483 curl_cv_func_getaddrinfo_threadsafe="yes" 1484 else 1485 curl_cv_func_getaddrinfo_threadsafe="no" 1486 fi 1487 fi 1488 ]) 1489 1490 1491 dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R 1492 dnl ------------------------------------------------- 1493 dnl Verify if gethostbyname_r is available, prototyped, 1494 dnl and can be compiled. If all of these are true, and 1495 dnl usage has not been previously disallowed with 1496 dnl shell variable curl_disallow_gethostbyname_r, then 1497 dnl HAVE_GETHOSTBYNAME_R will be defined. 1498 1499 AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [ 1500 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl 1501 # 1502 tst_links_gethostbyname_r="unknown" 1503 tst_proto_gethostbyname_r="unknown" 1504 tst_compi_gethostbyname_r="unknown" 1505 tst_allow_gethostbyname_r="unknown" 1506 tst_nargs_gethostbyname_r="unknown" 1507 # 1508 AC_MSG_CHECKING([if gethostbyname_r can be linked]) 1509 AC_LINK_IFELSE([ 1510 AC_LANG_FUNC_LINK_TRY([gethostbyname_r]) 1511 ],[ 1512 AC_MSG_RESULT([yes]) 1513 tst_links_gethostbyname_r="yes" 1514 ],[ 1515 AC_MSG_RESULT([no]) 1516 tst_links_gethostbyname_r="no" 1517 ]) 1518 # 1519 if test "$tst_links_gethostbyname_r" = "yes"; then 1520 AC_MSG_CHECKING([if gethostbyname_r is prototyped]) 1521 AC_EGREP_CPP([gethostbyname_r],[ 1522 $curl_includes_netdb 1523 ],[ 1524 AC_MSG_RESULT([yes]) 1525 tst_proto_gethostbyname_r="yes" 1526 ],[ 1527 AC_MSG_RESULT([no]) 1528 tst_proto_gethostbyname_r="no" 1529 ]) 1530 fi 1531 # 1532 if test "$tst_proto_gethostbyname_r" = "yes"; then 1533 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 1534 AC_MSG_CHECKING([if gethostbyname_r takes 3 args.]) 1535 AC_COMPILE_IFELSE([ 1536 AC_LANG_PROGRAM([[ 1537 $curl_includes_netdb 1538 $curl_includes_bsdsocket 1539 ]],[[ 1540 if(0 != gethostbyname_r(0, 0, 0)) 1541 return 1; 1542 ]]) 1543 ],[ 1544 AC_MSG_RESULT([yes]) 1545 tst_compi_gethostbyname_r="yes" 1546 tst_nargs_gethostbyname_r="3" 1547 ],[ 1548 AC_MSG_RESULT([no]) 1549 tst_compi_gethostbyname_r="no" 1550 ]) 1551 fi 1552 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 1553 AC_MSG_CHECKING([if gethostbyname_r takes 5 args.]) 1554 AC_COMPILE_IFELSE([ 1555 AC_LANG_PROGRAM([[ 1556 $curl_includes_netdb 1557 $curl_includes_bsdsocket 1558 ]],[[ 1559 if(0 != gethostbyname_r(0, 0, 0, 0, 0)) 1560 return 1; 1561 ]]) 1562 ],[ 1563 AC_MSG_RESULT([yes]) 1564 tst_compi_gethostbyname_r="yes" 1565 tst_nargs_gethostbyname_r="5" 1566 ],[ 1567 AC_MSG_RESULT([no]) 1568 tst_compi_gethostbyname_r="no" 1569 ]) 1570 fi 1571 if test "$tst_nargs_gethostbyname_r" = "unknown"; then 1572 AC_MSG_CHECKING([if gethostbyname_r takes 6 args.]) 1573 AC_COMPILE_IFELSE([ 1574 AC_LANG_PROGRAM([[ 1575 $curl_includes_netdb 1576 $curl_includes_bsdsocket 1577 ]],[[ 1578 if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0)) 1579 return 1; 1580 ]]) 1581 ],[ 1582 AC_MSG_RESULT([yes]) 1583 tst_compi_gethostbyname_r="yes" 1584 tst_nargs_gethostbyname_r="6" 1585 ],[ 1586 AC_MSG_RESULT([no]) 1587 tst_compi_gethostbyname_r="no" 1588 ]) 1589 fi 1590 AC_MSG_CHECKING([if gethostbyname_r is compilable]) 1591 if test "$tst_compi_gethostbyname_r" = "yes"; then 1592 AC_MSG_RESULT([yes]) 1593 else 1594 AC_MSG_RESULT([no]) 1595 fi 1596 fi 1597 # 1598 if test "$tst_compi_gethostbyname_r" = "yes"; then 1599 AC_MSG_CHECKING([if gethostbyname_r usage allowed]) 1600 if test "x$curl_disallow_gethostbyname_r" != "xyes"; then 1601 AC_MSG_RESULT([yes]) 1602 tst_allow_gethostbyname_r="yes" 1603 else 1604 AC_MSG_RESULT([no]) 1605 tst_allow_gethostbyname_r="no" 1606 fi 1607 fi 1608 # 1609 AC_MSG_CHECKING([if gethostbyname_r might be used]) 1610 if test "$tst_links_gethostbyname_r" = "yes" && 1611 test "$tst_proto_gethostbyname_r" = "yes" && 1612 test "$tst_compi_gethostbyname_r" = "yes" && 1613 test "$tst_allow_gethostbyname_r" = "yes"; then 1614 AC_MSG_RESULT([yes]) 1615 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1, 1616 [Define to 1 if you have the gethostbyname_r function.]) 1617 dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r, 1618 dnl [Specifies the number of arguments to gethostbyname_r]) 1619 # 1620 if test "$tst_nargs_gethostbyname_r" -eq "3"; then 1621 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args]) 1622 elif test "$tst_nargs_gethostbyname_r" -eq "5"; then 1623 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args]) 1624 elif test "$tst_nargs_gethostbyname_r" -eq "6"; then 1625 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args]) 1626 fi 1627 # 1628 curl_cv_func_gethostbyname_r="yes" 1629 else 1630 AC_MSG_RESULT([no]) 1631 curl_cv_func_gethostbyname_r="no" 1632 fi 1633 ]) 1634 1635 1636 dnl CURL_CHECK_FUNC_GETHOSTNAME 1637 dnl ------------------------------------------------- 1638 dnl Verify if gethostname is available, prototyped, and 1639 dnl can be compiled. If all of these are true, and 1640 dnl usage has not been previously disallowed with 1641 dnl shell variable curl_disallow_gethostname, then 1642 dnl HAVE_GETHOSTNAME will be defined. 1643 1644 AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [ 1645 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 1646 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 1647 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 1648 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 1649 # 1650 tst_links_gethostname="unknown" 1651 tst_proto_gethostname="unknown" 1652 tst_compi_gethostname="unknown" 1653 tst_allow_gethostname="unknown" 1654 # 1655 AC_MSG_CHECKING([if gethostname can be linked]) 1656 AC_LINK_IFELSE([ 1657 AC_LANG_PROGRAM([[ 1658 $curl_includes_winsock2 1659 $curl_includes_unistd 1660 $curl_includes_bsdsocket 1661 ]],[[ 1662 char s[1]; 1663 if(0 != gethostname((void *)s, 0)) 1664 return 1; 1665 ]]) 1666 ],[ 1667 AC_MSG_RESULT([yes]) 1668 tst_links_gethostname="yes" 1669 ],[ 1670 AC_MSG_RESULT([no]) 1671 tst_links_gethostname="no" 1672 ]) 1673 # 1674 if test "$tst_links_gethostname" = "yes"; then 1675 AC_MSG_CHECKING([if gethostname is prototyped]) 1676 AC_EGREP_CPP([gethostname],[ 1677 $curl_includes_winsock2 1678 $curl_includes_unistd 1679 $curl_includes_bsdsocket 1680 ],[ 1681 AC_MSG_RESULT([yes]) 1682 tst_proto_gethostname="yes" 1683 ],[ 1684 AC_MSG_RESULT([no]) 1685 tst_proto_gethostname="no" 1686 ]) 1687 fi 1688 # 1689 if test "$tst_proto_gethostname" = "yes"; then 1690 AC_MSG_CHECKING([if gethostname is compilable]) 1691 AC_COMPILE_IFELSE([ 1692 AC_LANG_PROGRAM([[ 1693 $curl_includes_winsock2 1694 $curl_includes_unistd 1695 $curl_includes_bsdsocket 1696 ]],[[ 1697 char s[1]; 1698 if(0 != gethostname((void *)s, 0)) 1699 return 1; 1700 ]]) 1701 ],[ 1702 AC_MSG_RESULT([yes]) 1703 tst_compi_gethostname="yes" 1704 ],[ 1705 AC_MSG_RESULT([no]) 1706 tst_compi_gethostname="no" 1707 ]) 1708 fi 1709 # 1710 if test "$tst_compi_gethostname" = "yes"; then 1711 AC_MSG_CHECKING([for gethostname arg 2 data type]) 1712 tst_gethostname_type_arg2="unknown" 1713 for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do 1714 for tst_arg2 in 'int' 'unsigned int' 'size_t'; do 1715 if test "$tst_gethostname_type_arg2" = "unknown"; then 1716 AC_COMPILE_IFELSE([ 1717 AC_LANG_PROGRAM([[ 1718 $curl_includes_winsock2 1719 $curl_includes_unistd 1720 $curl_includes_bsdsocket 1721 $curl_preprocess_callconv 1722 #if defined(_WIN32) && defined(WINSOCK_API_LINKAGE) 1723 WINSOCK_API_LINKAGE 1724 #else 1725 extern 1726 #endif 1727 int FUNCALLCONV gethostname($tst_arg1, $tst_arg2); 1728 ]],[[ 1729 char s[1]; 1730 if(0 != gethostname(($tst_arg1)s, 0)) 1731 return 1; 1732 ]]) 1733 ],[ 1734 tst_gethostname_type_arg2="$tst_arg2" 1735 ]) 1736 fi 1737 done 1738 done 1739 AC_MSG_RESULT([$tst_gethostname_type_arg2]) 1740 if test "$tst_gethostname_type_arg2" != "unknown"; then 1741 AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2, 1742 [Define to the type of arg 2 for gethostname.]) 1743 fi 1744 fi 1745 # 1746 if test "$tst_compi_gethostname" = "yes"; then 1747 AC_MSG_CHECKING([if gethostname usage allowed]) 1748 if test "x$curl_disallow_gethostname" != "xyes"; then 1749 AC_MSG_RESULT([yes]) 1750 tst_allow_gethostname="yes" 1751 else 1752 AC_MSG_RESULT([no]) 1753 tst_allow_gethostname="no" 1754 fi 1755 fi 1756 # 1757 AC_MSG_CHECKING([if gethostname might be used]) 1758 if test "$tst_links_gethostname" = "yes" && 1759 test "$tst_proto_gethostname" = "yes" && 1760 test "$tst_compi_gethostname" = "yes" && 1761 test "$tst_allow_gethostname" = "yes"; then 1762 AC_MSG_RESULT([yes]) 1763 AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1, 1764 [Define to 1 if you have the gethostname function.]) 1765 curl_cv_func_gethostname="yes" 1766 else 1767 AC_MSG_RESULT([no]) 1768 curl_cv_func_gethostname="no" 1769 fi 1770 ]) 1771 1772 dnl CURL_CHECK_FUNC_GETPEERNAME 1773 dnl ------------------------------------------------- 1774 dnl Verify if getpeername is available, prototyped, and 1775 dnl can be compiled. If all of these are true, and 1776 dnl usage has not been previously disallowed with 1777 dnl shell variable curl_disallow_getpeername, then 1778 dnl HAVE_GETPEERNAME will be defined. 1779 1780 AC_DEFUN([CURL_CHECK_FUNC_GETPEERNAME], [ 1781 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 1782 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 1783 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 1784 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 1785 # 1786 tst_links_getpeername="unknown" 1787 tst_proto_getpeername="unknown" 1788 tst_compi_getpeername="unknown" 1789 tst_allow_getpeername="unknown" 1790 # 1791 AC_MSG_CHECKING([if getpeername can be linked]) 1792 AC_LINK_IFELSE([ 1793 AC_LANG_PROGRAM([[ 1794 $curl_includes_winsock2 1795 $curl_includes_bsdsocket 1796 $curl_includes_sys_socket 1797 ]],[[ 1798 if(0 != getpeername(0, (void *)0, (void *)0)) 1799 return 1; 1800 ]]) 1801 ],[ 1802 AC_MSG_RESULT([yes]) 1803 tst_links_getpeername="yes" 1804 ],[ 1805 AC_MSG_RESULT([no]) 1806 tst_links_getpeername="no" 1807 ]) 1808 # 1809 if test "$tst_links_getpeername" = "yes"; then 1810 AC_MSG_CHECKING([if getpeername is prototyped]) 1811 AC_EGREP_CPP([getpeername],[ 1812 $curl_includes_winsock2 1813 $curl_includes_bsdsocket 1814 $curl_includes_sys_socket 1815 ],[ 1816 AC_MSG_RESULT([yes]) 1817 tst_proto_getpeername="yes" 1818 ],[ 1819 AC_MSG_RESULT([no]) 1820 tst_proto_getpeername="no" 1821 ]) 1822 fi 1823 # 1824 if test "$tst_proto_getpeername" = "yes"; then 1825 AC_MSG_CHECKING([if getpeername is compilable]) 1826 AC_COMPILE_IFELSE([ 1827 AC_LANG_PROGRAM([[ 1828 $curl_includes_winsock2 1829 $curl_includes_bsdsocket 1830 $curl_includes_sys_socket 1831 ]],[[ 1832 if(0 != getpeername(0, (void *)0, (void *)0)) 1833 return 1; 1834 ]]) 1835 ],[ 1836 AC_MSG_RESULT([yes]) 1837 tst_compi_getpeername="yes" 1838 ],[ 1839 AC_MSG_RESULT([no]) 1840 tst_compi_getpeername="no" 1841 ]) 1842 fi 1843 # 1844 if test "$tst_compi_getpeername" = "yes"; then 1845 AC_MSG_CHECKING([if getpeername usage allowed]) 1846 if test "x$curl_disallow_getpeername" != "xyes"; then 1847 AC_MSG_RESULT([yes]) 1848 tst_allow_getpeername="yes" 1849 else 1850 AC_MSG_RESULT([no]) 1851 tst_allow_getpeername="no" 1852 fi 1853 fi 1854 # 1855 AC_MSG_CHECKING([if getpeername might be used]) 1856 if test "$tst_links_getpeername" = "yes" && 1857 test "$tst_proto_getpeername" = "yes" && 1858 test "$tst_compi_getpeername" = "yes" && 1859 test "$tst_allow_getpeername" = "yes"; then 1860 AC_MSG_RESULT([yes]) 1861 AC_DEFINE_UNQUOTED(HAVE_GETPEERNAME, 1, 1862 [Define to 1 if you have the getpeername function.]) 1863 curl_cv_func_getpeername="yes" 1864 else 1865 AC_MSG_RESULT([no]) 1866 curl_cv_func_getpeername="no" 1867 fi 1868 ]) 1869 1870 dnl CURL_CHECK_FUNC_GETSOCKNAME 1871 dnl ------------------------------------------------- 1872 dnl Verify if getsockname is available, prototyped, and 1873 dnl can be compiled. If all of these are true, and 1874 dnl usage has not been previously disallowed with 1875 dnl shell variable curl_disallow_getsockname, then 1876 dnl HAVE_GETSOCKNAME will be defined. 1877 1878 AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [ 1879 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 1880 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl 1881 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl 1882 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 1883 # 1884 tst_links_getsockname="unknown" 1885 tst_proto_getsockname="unknown" 1886 tst_compi_getsockname="unknown" 1887 tst_allow_getsockname="unknown" 1888 # 1889 AC_MSG_CHECKING([if getsockname can be linked]) 1890 AC_LINK_IFELSE([ 1891 AC_LANG_PROGRAM([[ 1892 $curl_includes_winsock2 1893 $curl_includes_bsdsocket 1894 $curl_includes_sys_socket 1895 ]],[[ 1896 if(0 != getsockname(0, (void *)0, (void *)0)) 1897 return 1; 1898 ]]) 1899 ],[ 1900 AC_MSG_RESULT([yes]) 1901 tst_links_getsockname="yes" 1902 ],[ 1903 AC_MSG_RESULT([no]) 1904 tst_links_getsockname="no" 1905 ]) 1906 # 1907 if test "$tst_links_getsockname" = "yes"; then 1908 AC_MSG_CHECKING([if getsockname is prototyped]) 1909 AC_EGREP_CPP([getsockname],[ 1910 $curl_includes_winsock2 1911 $curl_includes_bsdsocket 1912 $curl_includes_sys_socket 1913 ],[ 1914 AC_MSG_RESULT([yes]) 1915 tst_proto_getsockname="yes" 1916 ],[ 1917 AC_MSG_RESULT([no]) 1918 tst_proto_getsockname="no" 1919 ]) 1920 fi 1921 # 1922 if test "$tst_proto_getsockname" = "yes"; then 1923 AC_MSG_CHECKING([if getsockname is compilable]) 1924 AC_COMPILE_IFELSE([ 1925 AC_LANG_PROGRAM([[ 1926 $curl_includes_winsock2 1927 $curl_includes_bsdsocket 1928 $curl_includes_sys_socket 1929 ]],[[ 1930 if(0 != getsockname(0, (void *)0, (void *)0)) 1931 return 1; 1932 ]]) 1933 ],[ 1934 AC_MSG_RESULT([yes]) 1935 tst_compi_getsockname="yes" 1936 ],[ 1937 AC_MSG_RESULT([no]) 1938 tst_compi_getsockname="no" 1939 ]) 1940 fi 1941 # 1942 if test "$tst_compi_getsockname" = "yes"; then 1943 AC_MSG_CHECKING([if getsockname usage allowed]) 1944 if test "x$curl_disallow_getsockname" != "xyes"; then 1945 AC_MSG_RESULT([yes]) 1946 tst_allow_getsockname="yes" 1947 else 1948 AC_MSG_RESULT([no]) 1949 tst_allow_getsockname="no" 1950 fi 1951 fi 1952 # 1953 AC_MSG_CHECKING([if getsockname might be used]) 1954 if test "$tst_links_getsockname" = "yes" && 1955 test "$tst_proto_getsockname" = "yes" && 1956 test "$tst_compi_getsockname" = "yes" && 1957 test "$tst_allow_getsockname" = "yes"; then 1958 AC_MSG_RESULT([yes]) 1959 AC_DEFINE_UNQUOTED(HAVE_GETSOCKNAME, 1, 1960 [Define to 1 if you have the getsockname function.]) 1961 curl_cv_func_getsockname="yes" 1962 else 1963 AC_MSG_RESULT([no]) 1964 curl_cv_func_getsockname="no" 1965 fi 1966 ]) 1967 1968 1969 dnl CURL_CHECK_FUNC_GETIFADDRS 1970 dnl ------------------------------------------------- 1971 dnl Verify if getifaddrs is available, prototyped, can 1972 dnl be compiled and seems to work. If all of these are 1973 dnl true, and usage has not been previously disallowed 1974 dnl with shell variable curl_disallow_getifaddrs, then 1975 dnl HAVE_GETIFADDRS will be defined. 1976 1977 AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [ 1978 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 1979 AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl 1980 # 1981 tst_links_getifaddrs="unknown" 1982 tst_proto_getifaddrs="unknown" 1983 tst_compi_getifaddrs="unknown" 1984 tst_works_getifaddrs="unknown" 1985 tst_allow_getifaddrs="unknown" 1986 # 1987 AC_MSG_CHECKING([if getifaddrs can be linked]) 1988 AC_LINK_IFELSE([ 1989 AC_LANG_FUNC_LINK_TRY([getifaddrs]) 1990 ],[ 1991 AC_MSG_RESULT([yes]) 1992 tst_links_getifaddrs="yes" 1993 ],[ 1994 AC_MSG_RESULT([no]) 1995 tst_links_getifaddrs="no" 1996 ]) 1997 # 1998 if test "$tst_links_getifaddrs" = "yes"; then 1999 AC_MSG_CHECKING([if getifaddrs is prototyped]) 2000 AC_EGREP_CPP([getifaddrs],[ 2001 $curl_includes_ifaddrs 2002 ],[ 2003 AC_MSG_RESULT([yes]) 2004 tst_proto_getifaddrs="yes" 2005 ],[ 2006 AC_MSG_RESULT([no]) 2007 tst_proto_getifaddrs="no" 2008 ]) 2009 fi 2010 # 2011 if test "$tst_proto_getifaddrs" = "yes"; then 2012 AC_MSG_CHECKING([if getifaddrs is compilable]) 2013 AC_COMPILE_IFELSE([ 2014 AC_LANG_PROGRAM([[ 2015 $curl_includes_ifaddrs 2016 ]],[[ 2017 if(0 != getifaddrs(0)) 2018 return 1; 2019 ]]) 2020 ],[ 2021 AC_MSG_RESULT([yes]) 2022 tst_compi_getifaddrs="yes" 2023 ],[ 2024 AC_MSG_RESULT([no]) 2025 tst_compi_getifaddrs="no" 2026 ]) 2027 fi 2028 # 2029 dnl only do runtime verification when not cross-compiling 2030 if test "x$cross_compiling" != "xyes" && 2031 test "$tst_compi_getifaddrs" = "yes"; then 2032 AC_MSG_CHECKING([if getifaddrs seems to work]) 2033 CURL_RUN_IFELSE([ 2034 AC_LANG_PROGRAM([[ 2035 $curl_includes_stdlib 2036 $curl_includes_ifaddrs 2037 ]],[[ 2038 struct ifaddrs *ifa = 0; 2039 int error; 2040 2041 error = getifaddrs(&ifa); 2042 if(error || !ifa) 2043 return 1; /* fail */ 2044 else { 2045 freeifaddrs(ifa); 2046 return 0; 2047 } 2048 ]]) 2049 ],[ 2050 AC_MSG_RESULT([yes]) 2051 tst_works_getifaddrs="yes" 2052 ],[ 2053 AC_MSG_RESULT([no]) 2054 tst_works_getifaddrs="no" 2055 ]) 2056 fi 2057 # 2058 if test "$tst_compi_getifaddrs" = "yes" && 2059 test "$tst_works_getifaddrs" != "no"; then 2060 AC_MSG_CHECKING([if getifaddrs usage allowed]) 2061 if test "x$curl_disallow_getifaddrs" != "xyes"; then 2062 AC_MSG_RESULT([yes]) 2063 tst_allow_getifaddrs="yes" 2064 else 2065 AC_MSG_RESULT([no]) 2066 tst_allow_getifaddrs="no" 2067 fi 2068 fi 2069 # 2070 AC_MSG_CHECKING([if getifaddrs might be used]) 2071 if test "$tst_links_getifaddrs" = "yes" && 2072 test "$tst_proto_getifaddrs" = "yes" && 2073 test "$tst_compi_getifaddrs" = "yes" && 2074 test "$tst_allow_getifaddrs" = "yes" && 2075 test "$tst_works_getifaddrs" != "no"; then 2076 AC_MSG_RESULT([yes]) 2077 AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1, 2078 [Define to 1 if you have a working getifaddrs function.]) 2079 curl_cv_func_getifaddrs="yes" 2080 else 2081 AC_MSG_RESULT([no]) 2082 curl_cv_func_getifaddrs="no" 2083 fi 2084 ]) 2085 2086 2087 dnl CURL_CHECK_FUNC_GMTIME_R 2088 dnl ------------------------------------------------- 2089 dnl Verify if gmtime_r is available, prototyped, can 2090 dnl be compiled and seems to work. If all of these are 2091 dnl true, and usage has not been previously disallowed 2092 dnl with shell variable curl_disallow_gmtime_r, then 2093 dnl HAVE_GMTIME_R will be defined. 2094 2095 AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [ 2096 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 2097 AC_REQUIRE([CURL_INCLUDES_TIME])dnl 2098 # 2099 tst_links_gmtime_r="unknown" 2100 tst_proto_gmtime_r="unknown" 2101 tst_compi_gmtime_r="unknown" 2102 tst_works_gmtime_r="unknown" 2103 tst_allow_gmtime_r="unknown" 2104 # 2105 AC_MSG_CHECKING([if gmtime_r can be linked]) 2106 AC_LINK_IFELSE([ 2107 AC_LANG_FUNC_LINK_TRY([gmtime_r]) 2108 ],[ 2109 AC_MSG_RESULT([yes]) 2110 tst_links_gmtime_r="yes" 2111 ],[ 2112 AC_MSG_RESULT([no]) 2113 tst_links_gmtime_r="no" 2114 ]) 2115 # 2116 if test "$tst_links_gmtime_r" = "yes"; then 2117 AC_MSG_CHECKING([if gmtime_r is prototyped]) 2118 AC_EGREP_CPP([gmtime_r],[ 2119 $curl_includes_time 2120 ],[ 2121 AC_MSG_RESULT([yes]) 2122 tst_proto_gmtime_r="yes" 2123 ],[ 2124 AC_MSG_RESULT([no]) 2125 tst_proto_gmtime_r="no" 2126 ]) 2127 fi 2128 # 2129 if test "$tst_proto_gmtime_r" = "yes"; then 2130 AC_MSG_CHECKING([if gmtime_r is compilable]) 2131 AC_COMPILE_IFELSE([ 2132 AC_LANG_PROGRAM([[ 2133 $curl_includes_time 2134 ]],[[ 2135 time_t tm = 1170352587; 2136 struct tm result; 2137 if(0 != gmtime_r(&tm, &result)) 2138 return 1; 2139 (void)result; 2140 ]]) 2141 ],[ 2142 AC_MSG_RESULT([yes]) 2143 tst_compi_gmtime_r="yes" 2144 ],[ 2145 AC_MSG_RESULT([no]) 2146 tst_compi_gmtime_r="no" 2147 ]) 2148 fi 2149 # 2150 dnl only do runtime verification when not cross-compiling 2151 if test "x$cross_compiling" != "xyes" && 2152 test "$tst_compi_gmtime_r" = "yes"; then 2153 AC_MSG_CHECKING([if gmtime_r seems to work]) 2154 CURL_RUN_IFELSE([ 2155 AC_LANG_PROGRAM([[ 2156 $curl_includes_stdlib 2157 $curl_includes_time 2158 ]],[[ 2159 time_t local = 1170352587; 2160 struct tm *gmt = 0; 2161 struct tm result; 2162 gmt = gmtime_r(&local, &result); 2163 (void)result; 2164 if(gmt) 2165 return 0; 2166 else 2167 return 1; 2168 ]]) 2169 ],[ 2170 AC_MSG_RESULT([yes]) 2171 tst_works_gmtime_r="yes" 2172 ],[ 2173 AC_MSG_RESULT([no]) 2174 tst_works_gmtime_r="no" 2175 ]) 2176 fi 2177 # 2178 if test "$tst_compi_gmtime_r" = "yes" && 2179 test "$tst_works_gmtime_r" != "no"; then 2180 AC_MSG_CHECKING([if gmtime_r usage allowed]) 2181 if test "x$curl_disallow_gmtime_r" != "xyes"; then 2182 AC_MSG_RESULT([yes]) 2183 tst_allow_gmtime_r="yes" 2184 else 2185 AC_MSG_RESULT([no]) 2186 tst_allow_gmtime_r="no" 2187 fi 2188 fi 2189 # 2190 AC_MSG_CHECKING([if gmtime_r might be used]) 2191 if test "$tst_links_gmtime_r" = "yes" && 2192 test "$tst_proto_gmtime_r" = "yes" && 2193 test "$tst_compi_gmtime_r" = "yes" && 2194 test "$tst_allow_gmtime_r" = "yes" && 2195 test "$tst_works_gmtime_r" != "no"; then 2196 AC_MSG_RESULT([yes]) 2197 AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1, 2198 [Define to 1 if you have a working gmtime_r function.]) 2199 curl_cv_func_gmtime_r="yes" 2200 else 2201 AC_MSG_RESULT([no]) 2202 curl_cv_func_gmtime_r="no" 2203 fi 2204 ]) 2205 2206 2207 dnl CURL_CHECK_FUNC_INET_NTOP 2208 dnl ------------------------------------------------- 2209 dnl Verify if inet_ntop is available, prototyped, can 2210 dnl be compiled and seems to work. If all of these are 2211 dnl true, and usage has not been previously disallowed 2212 dnl with shell variable curl_disallow_inet_ntop, then 2213 dnl HAVE_INET_NTOP will be defined. 2214 2215 AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [ 2216 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 2217 AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl 2218 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 2219 # 2220 tst_links_inet_ntop="unknown" 2221 tst_proto_inet_ntop="unknown" 2222 tst_compi_inet_ntop="unknown" 2223 tst_works_inet_ntop="unknown" 2224 tst_allow_inet_ntop="unknown" 2225 # 2226 AC_MSG_CHECKING([if inet_ntop can be linked]) 2227 AC_LINK_IFELSE([ 2228 AC_LANG_FUNC_LINK_TRY([inet_ntop]) 2229 ],[ 2230 AC_MSG_RESULT([yes]) 2231 tst_links_inet_ntop="yes" 2232 ],[ 2233 AC_MSG_RESULT([no]) 2234 tst_links_inet_ntop="no" 2235 ]) 2236 # 2237 if test "$tst_links_inet_ntop" = "yes"; then 2238 AC_MSG_CHECKING([if inet_ntop is prototyped]) 2239 AC_EGREP_CPP([inet_ntop],[ 2240 $curl_includes_arpa_inet 2241 ],[ 2242 AC_MSG_RESULT([yes]) 2243 tst_proto_inet_ntop="yes" 2244 ],[ 2245 AC_MSG_RESULT([no]) 2246 tst_proto_inet_ntop="no" 2247 ]) 2248 fi 2249 # 2250 if test "$tst_proto_inet_ntop" = "yes"; then 2251 AC_MSG_CHECKING([if inet_ntop is compilable]) 2252 AC_COMPILE_IFELSE([ 2253 AC_LANG_PROGRAM([[ 2254 $curl_includes_arpa_inet 2255 ]],[[ 2256 char ipv4res[sizeof("255.255.255.255")]; 2257 unsigned char ipv4a[5] = ""; 2258 if(0 != inet_ntop(0, ipv4a, ipv4res, 0)) 2259 return 1; 2260 ]]) 2261 ],[ 2262 AC_MSG_RESULT([yes]) 2263 tst_compi_inet_ntop="yes" 2264 ],[ 2265 AC_MSG_RESULT([no]) 2266 tst_compi_inet_ntop="no" 2267 ]) 2268 fi 2269 # 2270 dnl only do runtime verification when not cross-compiling 2271 if test "x$cross_compiling" != "xyes" && 2272 test "$tst_compi_inet_ntop" = "yes"; then 2273 AC_MSG_CHECKING([if inet_ntop seems to work]) 2274 CURL_RUN_IFELSE([ 2275 AC_LANG_PROGRAM([[ 2276 $curl_includes_stdlib 2277 $curl_includes_arpa_inet 2278 $curl_includes_string 2279 ]],[[ 2280 char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; 2281 char ipv4res[sizeof("255.255.255.255")]; 2282 unsigned char ipv6a[26]; 2283 unsigned char ipv4a[5]; 2284 const char *ipv6ptr = 0; 2285 const char *ipv4ptr = 0; 2286 /* - */ 2287 ipv4res[0] = '\0'; 2288 ipv4a[0] = 0xc0; 2289 ipv4a[1] = 0xa8; 2290 ipv4a[2] = 0x64; 2291 ipv4a[3] = 0x01; 2292 ipv4a[4] = 0x01; 2293 /* - */ 2294 ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); 2295 if(!ipv4ptr) 2296 return 1; /* fail */ 2297 if(ipv4ptr != ipv4res) 2298 return 1; /* fail */ 2299 if(!ipv4ptr[0]) 2300 return 1; /* fail */ 2301 if(memcmp(ipv4res, "192.168.100.1", 13) != 0) 2302 return 1; /* fail */ 2303 /* - */ 2304 ipv6res[0] = '\0'; 2305 memset(ipv6a, 0, sizeof(ipv6a)); 2306 ipv6a[0] = 0xfe; 2307 ipv6a[1] = 0x80; 2308 ipv6a[8] = 0x02; 2309 ipv6a[9] = 0x14; 2310 ipv6a[10] = 0x4f; 2311 ipv6a[11] = 0xff; 2312 ipv6a[12] = 0xfe; 2313 ipv6a[13] = 0x0b; 2314 ipv6a[14] = 0x76; 2315 ipv6a[15] = 0xc8; 2316 ipv6a[25] = 0x01; 2317 /* - */ 2318 ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); 2319 if(!ipv6ptr) 2320 return 1; /* fail */ 2321 if(ipv6ptr != ipv6res) 2322 return 1; /* fail */ 2323 if(!ipv6ptr[0]) 2324 return 1; /* fail */ 2325 if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) 2326 return 1; /* fail */ 2327 /* - */ 2328 return 0; 2329 ]]) 2330 ],[ 2331 AC_MSG_RESULT([yes]) 2332 tst_works_inet_ntop="yes" 2333 ],[ 2334 AC_MSG_RESULT([no]) 2335 tst_works_inet_ntop="no" 2336 ]) 2337 fi 2338 # 2339 if test "$tst_compi_inet_ntop" = "yes" && 2340 test "$tst_works_inet_ntop" != "no"; then 2341 AC_MSG_CHECKING([if inet_ntop usage allowed]) 2342 if test "x$curl_disallow_inet_ntop" != "xyes"; then 2343 AC_MSG_RESULT([yes]) 2344 tst_allow_inet_ntop="yes" 2345 else 2346 AC_MSG_RESULT([no]) 2347 tst_allow_inet_ntop="no" 2348 fi 2349 fi 2350 # 2351 AC_MSG_CHECKING([if inet_ntop might be used]) 2352 if test "$tst_links_inet_ntop" = "yes" && 2353 test "$tst_proto_inet_ntop" = "yes" && 2354 test "$tst_compi_inet_ntop" = "yes" && 2355 test "$tst_allow_inet_ntop" = "yes" && 2356 test "$tst_works_inet_ntop" != "no"; then 2357 AC_MSG_RESULT([yes]) 2358 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1, 2359 [Define to 1 if you have an IPv6 capable working inet_ntop function.]) 2360 curl_cv_func_inet_ntop="yes" 2361 else 2362 AC_MSG_RESULT([no]) 2363 curl_cv_func_inet_ntop="no" 2364 fi 2365 ]) 2366 2367 2368 dnl CURL_CHECK_FUNC_INET_PTON 2369 dnl ------------------------------------------------- 2370 dnl Verify if inet_pton is available, prototyped, can 2371 dnl be compiled and seems to work. If all of these are 2372 dnl true, and usage has not been previously disallowed 2373 dnl with shell variable curl_disallow_inet_pton, then 2374 dnl HAVE_INET_PTON will be defined. 2375 2376 AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [ 2377 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 2378 AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl 2379 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 2380 # 2381 tst_links_inet_pton="unknown" 2382 tst_proto_inet_pton="unknown" 2383 tst_compi_inet_pton="unknown" 2384 tst_works_inet_pton="unknown" 2385 tst_allow_inet_pton="unknown" 2386 # 2387 AC_MSG_CHECKING([if inet_pton can be linked]) 2388 AC_LINK_IFELSE([ 2389 AC_LANG_FUNC_LINK_TRY([inet_pton]) 2390 ],[ 2391 AC_MSG_RESULT([yes]) 2392 tst_links_inet_pton="yes" 2393 ],[ 2394 AC_MSG_RESULT([no]) 2395 tst_links_inet_pton="no" 2396 ]) 2397 # 2398 if test "$tst_links_inet_pton" = "yes"; then 2399 AC_MSG_CHECKING([if inet_pton is prototyped]) 2400 AC_EGREP_CPP([inet_pton],[ 2401 $curl_includes_arpa_inet 2402 ],[ 2403 AC_MSG_RESULT([yes]) 2404 tst_proto_inet_pton="yes" 2405 ],[ 2406 AC_MSG_RESULT([no]) 2407 tst_proto_inet_pton="no" 2408 ]) 2409 fi 2410 # 2411 if test "$tst_proto_inet_pton" = "yes"; then 2412 AC_MSG_CHECKING([if inet_pton is compilable]) 2413 AC_COMPILE_IFELSE([ 2414 AC_LANG_PROGRAM([[ 2415 $curl_includes_arpa_inet 2416 ]],[[ 2417 unsigned char ipv4a[4+1] = ""; 2418 const char *ipv4src = "192.168.100.1"; 2419 if(0 != inet_pton(0, ipv4src, ipv4a)) 2420 return 1; 2421 ]]) 2422 ],[ 2423 AC_MSG_RESULT([yes]) 2424 tst_compi_inet_pton="yes" 2425 ],[ 2426 AC_MSG_RESULT([no]) 2427 tst_compi_inet_pton="no" 2428 ]) 2429 fi 2430 # 2431 dnl only do runtime verification when not cross-compiling 2432 if test "x$cross_compiling" != "xyes" && 2433 test "$tst_compi_inet_pton" = "yes"; then 2434 AC_MSG_CHECKING([if inet_pton seems to work]) 2435 CURL_RUN_IFELSE([ 2436 AC_LANG_PROGRAM([[ 2437 $curl_includes_stdlib 2438 $curl_includes_arpa_inet 2439 $curl_includes_string 2440 ]],[[ 2441 unsigned char ipv6a[16+1]; 2442 unsigned char ipv4a[4+1]; 2443 const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; 2444 const char *ipv4src = "192.168.100.1"; 2445 /* - */ 2446 memset(ipv4a, 1, sizeof(ipv4a)); 2447 if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) 2448 return 1; /* fail */ 2449 /* - */ 2450 if( (ipv4a[0] != 0xc0) || 2451 (ipv4a[1] != 0xa8) || 2452 (ipv4a[2] != 0x64) || 2453 (ipv4a[3] != 0x01) || 2454 (ipv4a[4] != 0x01) ) 2455 return 1; /* fail */ 2456 /* - */ 2457 memset(ipv6a, 1, sizeof(ipv6a)); 2458 if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) 2459 return 1; /* fail */ 2460 /* - */ 2461 if( (ipv6a[0] != 0xfe) || 2462 (ipv6a[1] != 0x80) || 2463 (ipv6a[8] != 0x02) || 2464 (ipv6a[9] != 0x14) || 2465 (ipv6a[10] != 0x4f) || 2466 (ipv6a[11] != 0xff) || 2467 (ipv6a[12] != 0xfe) || 2468 (ipv6a[13] != 0x0b) || 2469 (ipv6a[14] != 0x76) || 2470 (ipv6a[15] != 0xc8) || 2471 (ipv6a[16] != 0x01) ) 2472 return 1; /* fail */ 2473 /* - */ 2474 if( (ipv6a[2] != 0x0) || 2475 (ipv6a[3] != 0x0) || 2476 (ipv6a[4] != 0x0) || 2477 (ipv6a[5] != 0x0) || 2478 (ipv6a[6] != 0x0) || 2479 (ipv6a[7] != 0x0) ) 2480 return 1; /* fail */ 2481 /* - */ 2482 return 0; 2483 ]]) 2484 ],[ 2485 AC_MSG_RESULT([yes]) 2486 tst_works_inet_pton="yes" 2487 ],[ 2488 AC_MSG_RESULT([no]) 2489 tst_works_inet_pton="no" 2490 ]) 2491 fi 2492 # 2493 if test "$tst_compi_inet_pton" = "yes" && 2494 test "$tst_works_inet_pton" != "no"; then 2495 AC_MSG_CHECKING([if inet_pton usage allowed]) 2496 if test "x$curl_disallow_inet_pton" != "xyes"; then 2497 AC_MSG_RESULT([yes]) 2498 tst_allow_inet_pton="yes" 2499 else 2500 AC_MSG_RESULT([no]) 2501 tst_allow_inet_pton="no" 2502 fi 2503 fi 2504 # 2505 AC_MSG_CHECKING([if inet_pton might be used]) 2506 if test "$tst_links_inet_pton" = "yes" && 2507 test "$tst_proto_inet_pton" = "yes" && 2508 test "$tst_compi_inet_pton" = "yes" && 2509 test "$tst_allow_inet_pton" = "yes" && 2510 test "$tst_works_inet_pton" != "no"; then 2511 AC_MSG_RESULT([yes]) 2512 AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1, 2513 [Define to 1 if you have an IPv6 capable working inet_pton function.]) 2514 curl_cv_func_inet_pton="yes" 2515 else 2516 AC_MSG_RESULT([no]) 2517 curl_cv_func_inet_pton="no" 2518 fi 2519 ]) 2520 2521 2522 dnl CURL_CHECK_FUNC_IOCTL 2523 dnl ------------------------------------------------- 2524 dnl Verify if ioctl is available, prototyped, and 2525 dnl can be compiled. If all of these are true, and 2526 dnl usage has not been previously disallowed with 2527 dnl shell variable curl_disallow_ioctl, then 2528 dnl curl_cv_func_ioctl is set to "yes". 2529 2530 AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [ 2531 AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl 2532 # 2533 tst_links_ioctl="unknown" 2534 tst_proto_ioctl="unknown" 2535 tst_compi_ioctl="unknown" 2536 tst_allow_ioctl="unknown" 2537 # 2538 AC_MSG_CHECKING([if ioctl can be linked]) 2539 AC_LINK_IFELSE([ 2540 AC_LANG_FUNC_LINK_TRY([ioctl]) 2541 ],[ 2542 AC_MSG_RESULT([yes]) 2543 tst_links_ioctl="yes" 2544 ],[ 2545 AC_MSG_RESULT([no]) 2546 tst_links_ioctl="no" 2547 ]) 2548 # 2549 if test "$tst_links_ioctl" = "yes"; then 2550 AC_MSG_CHECKING([if ioctl is prototyped]) 2551 AC_EGREP_CPP([ioctl],[ 2552 $curl_includes_stropts 2553 ],[ 2554 AC_MSG_RESULT([yes]) 2555 tst_proto_ioctl="yes" 2556 ],[ 2557 AC_MSG_RESULT([no]) 2558 tst_proto_ioctl="no" 2559 ]) 2560 fi 2561 # 2562 if test "$tst_proto_ioctl" = "yes"; then 2563 AC_MSG_CHECKING([if ioctl is compilable]) 2564 AC_COMPILE_IFELSE([ 2565 AC_LANG_PROGRAM([[ 2566 $curl_includes_stropts 2567 ]],[[ 2568 if(0 != ioctl(0, 0, 0)) 2569 return 1; 2570 ]]) 2571 ],[ 2572 AC_MSG_RESULT([yes]) 2573 tst_compi_ioctl="yes" 2574 ],[ 2575 AC_MSG_RESULT([no]) 2576 tst_compi_ioctl="no" 2577 ]) 2578 fi 2579 # 2580 if test "$tst_compi_ioctl" = "yes"; then 2581 AC_MSG_CHECKING([if ioctl usage allowed]) 2582 if test "x$curl_disallow_ioctl" != "xyes"; then 2583 AC_MSG_RESULT([yes]) 2584 tst_allow_ioctl="yes" 2585 else 2586 AC_MSG_RESULT([no]) 2587 tst_allow_ioctl="no" 2588 fi 2589 fi 2590 # 2591 AC_MSG_CHECKING([if ioctl might be used]) 2592 if test "$tst_links_ioctl" = "yes" && 2593 test "$tst_proto_ioctl" = "yes" && 2594 test "$tst_compi_ioctl" = "yes" && 2595 test "$tst_allow_ioctl" = "yes"; then 2596 AC_MSG_RESULT([yes]) 2597 curl_cv_func_ioctl="yes" 2598 CURL_CHECK_FUNC_IOCTL_FIONBIO 2599 CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR 2600 else 2601 AC_MSG_RESULT([no]) 2602 curl_cv_func_ioctl="no" 2603 fi 2604 ]) 2605 2606 2607 dnl CURL_CHECK_FUNC_IOCTL_FIONBIO 2608 dnl ------------------------------------------------- 2609 dnl Verify if ioctl with the FIONBIO command is 2610 dnl available, can be compiled, and seems to work. If 2611 dnl all of these are true, then HAVE_IOCTL_FIONBIO 2612 dnl will be defined. 2613 2614 AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [ 2615 # 2616 tst_compi_ioctl_fionbio="unknown" 2617 tst_allow_ioctl_fionbio="unknown" 2618 # 2619 if test "$curl_cv_func_ioctl" = "yes"; then 2620 AC_MSG_CHECKING([if ioctl FIONBIO is compilable]) 2621 AC_COMPILE_IFELSE([ 2622 AC_LANG_PROGRAM([[ 2623 $curl_includes_stropts 2624 ]],[[ 2625 int flags = 0; 2626 if(0 != ioctl(0, FIONBIO, &flags)) 2627 return 1; 2628 ]]) 2629 ],[ 2630 AC_MSG_RESULT([yes]) 2631 tst_compi_ioctl_fionbio="yes" 2632 ],[ 2633 AC_MSG_RESULT([no]) 2634 tst_compi_ioctl_fionbio="no" 2635 ]) 2636 fi 2637 # 2638 if test "$tst_compi_ioctl_fionbio" = "yes"; then 2639 AC_MSG_CHECKING([if ioctl FIONBIO usage allowed]) 2640 if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then 2641 AC_MSG_RESULT([yes]) 2642 tst_allow_ioctl_fionbio="yes" 2643 else 2644 AC_MSG_RESULT([no]) 2645 tst_allow_ioctl_fionbio="no" 2646 fi 2647 fi 2648 # 2649 AC_MSG_CHECKING([if ioctl FIONBIO might be used]) 2650 if test "$tst_compi_ioctl_fionbio" = "yes" && 2651 test "$tst_allow_ioctl_fionbio" = "yes"; then 2652 AC_MSG_RESULT([yes]) 2653 AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1, 2654 [Define to 1 if you have a working ioctl FIONBIO function.]) 2655 curl_cv_func_ioctl_fionbio="yes" 2656 else 2657 AC_MSG_RESULT([no]) 2658 curl_cv_func_ioctl_fionbio="no" 2659 fi 2660 ]) 2661 2662 2663 dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR 2664 dnl ------------------------------------------------- 2665 dnl Verify if ioctl with the SIOCGIFADDR command is available, 2666 dnl struct ifreq is defined, they can be compiled, and seem to 2667 dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR 2668 dnl will be defined. 2669 2670 AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [ 2671 # 2672 tst_compi_ioctl_siocgifaddr="unknown" 2673 tst_allow_ioctl_siocgifaddr="unknown" 2674 # 2675 if test "$curl_cv_func_ioctl" = "yes"; then 2676 AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable]) 2677 AC_COMPILE_IFELSE([ 2678 AC_LANG_PROGRAM([[ 2679 $curl_includes_stropts 2680 #include <net/if.h> 2681 ]],[[ 2682 struct ifreq ifr; 2683 if(0 != ioctl(0, SIOCGIFADDR, &ifr)) 2684 return 1; 2685 ]]) 2686 ],[ 2687 AC_MSG_RESULT([yes]) 2688 tst_compi_ioctl_siocgifaddr="yes" 2689 ],[ 2690 AC_MSG_RESULT([no]) 2691 tst_compi_ioctl_siocgifaddr="no" 2692 ]) 2693 fi 2694 # 2695 if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then 2696 AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed]) 2697 if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then 2698 AC_MSG_RESULT([yes]) 2699 tst_allow_ioctl_siocgifaddr="yes" 2700 else 2701 AC_MSG_RESULT([no]) 2702 tst_allow_ioctl_siocgifaddr="no" 2703 fi 2704 fi 2705 # 2706 AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used]) 2707 if test "$tst_compi_ioctl_siocgifaddr" = "yes" && 2708 test "$tst_allow_ioctl_siocgifaddr" = "yes"; then 2709 AC_MSG_RESULT([yes]) 2710 AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1, 2711 [Define to 1 if you have a working ioctl SIOCGIFADDR function.]) 2712 curl_cv_func_ioctl_siocgifaddr="yes" 2713 else 2714 AC_MSG_RESULT([no]) 2715 curl_cv_func_ioctl_siocgifaddr="no" 2716 fi 2717 ]) 2718 2719 2720 dnl CURL_CHECK_FUNC_IOCTLSOCKET 2721 dnl ------------------------------------------------- 2722 dnl Verify if ioctlsocket is available, prototyped, and 2723 dnl can be compiled. If all of these are true, and 2724 dnl usage has not been previously disallowed with 2725 dnl shell variable curl_disallow_ioctlsocket, then 2726 dnl HAVE_IOCTLSOCKET will be defined. 2727 2728 AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [ 2729 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 2730 # 2731 tst_links_ioctlsocket="unknown" 2732 tst_proto_ioctlsocket="unknown" 2733 tst_compi_ioctlsocket="unknown" 2734 tst_allow_ioctlsocket="unknown" 2735 # 2736 AC_MSG_CHECKING([if ioctlsocket can be linked]) 2737 AC_LINK_IFELSE([ 2738 AC_LANG_PROGRAM([[ 2739 $curl_includes_winsock2 2740 ]],[[ 2741 if(0 != ioctlsocket(0, 0, 0)) 2742 return 1; 2743 ]]) 2744 ],[ 2745 AC_MSG_RESULT([yes]) 2746 tst_links_ioctlsocket="yes" 2747 ],[ 2748 AC_MSG_RESULT([no]) 2749 tst_links_ioctlsocket="no" 2750 ]) 2751 # 2752 if test "$tst_links_ioctlsocket" = "yes"; then 2753 AC_MSG_CHECKING([if ioctlsocket is prototyped]) 2754 AC_EGREP_CPP([ioctlsocket],[ 2755 $curl_includes_winsock2 2756 ],[ 2757 AC_MSG_RESULT([yes]) 2758 tst_proto_ioctlsocket="yes" 2759 ],[ 2760 AC_MSG_RESULT([no]) 2761 tst_proto_ioctlsocket="no" 2762 ]) 2763 fi 2764 # 2765 if test "$tst_proto_ioctlsocket" = "yes"; then 2766 AC_MSG_CHECKING([if ioctlsocket is compilable]) 2767 AC_COMPILE_IFELSE([ 2768 AC_LANG_PROGRAM([[ 2769 $curl_includes_winsock2 2770 ]],[[ 2771 if(0 != ioctlsocket(0, 0, 0)) 2772 return 1; 2773 ]]) 2774 ],[ 2775 AC_MSG_RESULT([yes]) 2776 tst_compi_ioctlsocket="yes" 2777 ],[ 2778 AC_MSG_RESULT([no]) 2779 tst_compi_ioctlsocket="no" 2780 ]) 2781 fi 2782 # 2783 if test "$tst_compi_ioctlsocket" = "yes"; then 2784 AC_MSG_CHECKING([if ioctlsocket usage allowed]) 2785 if test "x$curl_disallow_ioctlsocket" != "xyes"; then 2786 AC_MSG_RESULT([yes]) 2787 tst_allow_ioctlsocket="yes" 2788 else 2789 AC_MSG_RESULT([no]) 2790 tst_allow_ioctlsocket="no" 2791 fi 2792 fi 2793 # 2794 AC_MSG_CHECKING([if ioctlsocket might be used]) 2795 if test "$tst_links_ioctlsocket" = "yes" && 2796 test "$tst_proto_ioctlsocket" = "yes" && 2797 test "$tst_compi_ioctlsocket" = "yes" && 2798 test "$tst_allow_ioctlsocket" = "yes"; then 2799 AC_MSG_RESULT([yes]) 2800 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1, 2801 [Define to 1 if you have the ioctlsocket function.]) 2802 curl_cv_func_ioctlsocket="yes" 2803 CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO 2804 else 2805 AC_MSG_RESULT([no]) 2806 curl_cv_func_ioctlsocket="no" 2807 fi 2808 ]) 2809 2810 2811 dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO 2812 dnl ------------------------------------------------- 2813 dnl Verify if ioctlsocket with the FIONBIO command is 2814 dnl available, can be compiled, and seems to work. If 2815 dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO 2816 dnl will be defined. 2817 2818 AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [ 2819 # 2820 tst_compi_ioctlsocket_fionbio="unknown" 2821 tst_allow_ioctlsocket_fionbio="unknown" 2822 # 2823 if test "$curl_cv_func_ioctlsocket" = "yes"; then 2824 AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable]) 2825 AC_COMPILE_IFELSE([ 2826 AC_LANG_PROGRAM([[ 2827 $curl_includes_winsock2 2828 ]],[[ 2829 unsigned long flags = 0; 2830 if(0 != ioctlsocket(0, FIONBIO, &flags)) 2831 return 1; 2832 ]]) 2833 ],[ 2834 AC_MSG_RESULT([yes]) 2835 tst_compi_ioctlsocket_fionbio="yes" 2836 ],[ 2837 AC_MSG_RESULT([no]) 2838 tst_compi_ioctlsocket_fionbio="no" 2839 ]) 2840 fi 2841 # 2842 if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then 2843 AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed]) 2844 if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then 2845 AC_MSG_RESULT([yes]) 2846 tst_allow_ioctlsocket_fionbio="yes" 2847 else 2848 AC_MSG_RESULT([no]) 2849 tst_allow_ioctlsocket_fionbio="no" 2850 fi 2851 fi 2852 # 2853 AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used]) 2854 if test "$tst_compi_ioctlsocket_fionbio" = "yes" && 2855 test "$tst_allow_ioctlsocket_fionbio" = "yes"; then 2856 AC_MSG_RESULT([yes]) 2857 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1, 2858 [Define to 1 if you have a working ioctlsocket FIONBIO function.]) 2859 curl_cv_func_ioctlsocket_fionbio="yes" 2860 else 2861 AC_MSG_RESULT([no]) 2862 curl_cv_func_ioctlsocket_fionbio="no" 2863 fi 2864 ]) 2865 2866 2867 dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL 2868 dnl ------------------------------------------------- 2869 dnl Verify if IoctlSocket is available, prototyped, and 2870 dnl can be compiled. If all of these are true, and 2871 dnl usage has not been previously disallowed with 2872 dnl shell variable curl_disallow_ioctlsocket_camel, 2873 dnl then HAVE_IOCTLSOCKET_CAMEL will be defined. 2874 2875 AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [ 2876 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 2877 # 2878 tst_links_ioctlsocket_camel="unknown" 2879 tst_compi_ioctlsocket_camel="unknown" 2880 tst_allow_ioctlsocket_camel="unknown" 2881 # 2882 AC_MSG_CHECKING([if IoctlSocket can be linked]) 2883 AC_LINK_IFELSE([ 2884 AC_LANG_PROGRAM([[ 2885 $curl_includes_bsdsocket 2886 ]],[[ 2887 if(0 != IoctlSocket(0, 0, 0)) 2888 return 1; 2889 ]]) 2890 ],[ 2891 AC_MSG_RESULT([yes]) 2892 tst_links_ioctlsocket_camel="yes" 2893 ],[ 2894 AC_MSG_RESULT([no]) 2895 tst_links_ioctlsocket_camel="no" 2896 ]) 2897 # 2898 if test "$tst_links_ioctlsocket_camel" = "yes"; then 2899 AC_MSG_CHECKING([if IoctlSocket is compilable]) 2900 AC_COMPILE_IFELSE([ 2901 AC_LANG_PROGRAM([[ 2902 $curl_includes_bsdsocket 2903 ]],[[ 2904 if(0 != IoctlSocket(0, 0, 0)) 2905 return 1; 2906 ]]) 2907 ],[ 2908 AC_MSG_RESULT([yes]) 2909 tst_compi_ioctlsocket_camel="yes" 2910 ],[ 2911 AC_MSG_RESULT([no]) 2912 tst_compi_ioctlsocket_camel="no" 2913 ]) 2914 fi 2915 # 2916 if test "$tst_compi_ioctlsocket_camel" = "yes"; then 2917 AC_MSG_CHECKING([if IoctlSocket usage allowed]) 2918 if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then 2919 AC_MSG_RESULT([yes]) 2920 tst_allow_ioctlsocket_camel="yes" 2921 else 2922 AC_MSG_RESULT([no]) 2923 tst_allow_ioctlsocket_camel="no" 2924 fi 2925 fi 2926 # 2927 AC_MSG_CHECKING([if IoctlSocket might be used]) 2928 if test "$tst_links_ioctlsocket_camel" = "yes" && 2929 test "$tst_compi_ioctlsocket_camel" = "yes" && 2930 test "$tst_allow_ioctlsocket_camel" = "yes"; then 2931 AC_MSG_RESULT([yes]) 2932 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1, 2933 [Define to 1 if you have the IoctlSocket camel case function.]) 2934 curl_cv_func_ioctlsocket_camel="yes" 2935 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO 2936 else 2937 AC_MSG_RESULT([no]) 2938 curl_cv_func_ioctlsocket_camel="no" 2939 fi 2940 ]) 2941 2942 2943 dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO 2944 dnl ------------------------------------------------- 2945 dnl Verify if IoctlSocket with FIONBIO command is available, 2946 dnl can be compiled, and seems to work. If all of these are 2947 dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined. 2948 2949 AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [ 2950 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl 2951 # 2952 tst_compi_ioctlsocket_camel_fionbio="unknown" 2953 tst_allow_ioctlsocket_camel_fionbio="unknown" 2954 # 2955 if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then 2956 AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable]) 2957 AC_COMPILE_IFELSE([ 2958 AC_LANG_PROGRAM([[ 2959 $curl_includes_bsdsocket 2960 ]],[[ 2961 long flags = 0; 2962 if(0 != IoctlSocket(0, FIONBIO, &flags)) 2963 return 1; 2964 ]]) 2965 ],[ 2966 AC_MSG_RESULT([yes]) 2967 tst_compi_ioctlsocket_camel_fionbio="yes" 2968 ],[ 2969 AC_MSG_RESULT([no]) 2970 tst_compi_ioctlsocket_camel_fionbio="no" 2971 ]) 2972 fi 2973 # 2974 if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then 2975 AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed]) 2976 if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then 2977 AC_MSG_RESULT([yes]) 2978 tst_allow_ioctlsocket_camel_fionbio="yes" 2979 else 2980 AC_MSG_RESULT([no]) 2981 tst_allow_ioctlsocket_camel_fionbio="no" 2982 fi 2983 fi 2984 # 2985 AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used]) 2986 if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && 2987 test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then 2988 AC_MSG_RESULT([yes]) 2989 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1, 2990 [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.]) 2991 curl_cv_func_ioctlsocket_camel_fionbio="yes" 2992 else 2993 AC_MSG_RESULT([no]) 2994 curl_cv_func_ioctlsocket_camel_fionbio="no" 2995 fi 2996 ]) 2997 2998 2999 dnl CURL_CHECK_FUNC_MEMRCHR 3000 dnl ------------------------------------------------- 3001 dnl Verify if memrchr is available, prototyped, and 3002 dnl can be compiled. If all of these are true, and 3003 dnl usage has not been previously disallowed with 3004 dnl shell variable curl_disallow_memrchr, then 3005 dnl HAVE_MEMRCHR will be defined. 3006 3007 AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [ 3008 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 3009 # 3010 tst_links_memrchr="unknown" 3011 tst_macro_memrchr="unknown" 3012 tst_proto_memrchr="unknown" 3013 tst_compi_memrchr="unknown" 3014 tst_allow_memrchr="unknown" 3015 # 3016 AC_MSG_CHECKING([if memrchr can be linked]) 3017 AC_LINK_IFELSE([ 3018 AC_LANG_FUNC_LINK_TRY([memrchr]) 3019 ],[ 3020 AC_MSG_RESULT([yes]) 3021 tst_links_memrchr="yes" 3022 ],[ 3023 AC_MSG_RESULT([no]) 3024 tst_links_memrchr="no" 3025 ]) 3026 # 3027 if test "$tst_links_memrchr" = "no"; then 3028 AC_MSG_CHECKING([if memrchr seems a macro]) 3029 AC_LINK_IFELSE([ 3030 AC_LANG_PROGRAM([[ 3031 $curl_includes_string 3032 ]],[[ 3033 if(0 != memrchr("", 0, 0)) 3034 return 1; 3035 ]]) 3036 ],[ 3037 AC_MSG_RESULT([yes]) 3038 tst_macro_memrchr="yes" 3039 ],[ 3040 AC_MSG_RESULT([no]) 3041 tst_macro_memrchr="no" 3042 ]) 3043 fi 3044 # 3045 if test "$tst_links_memrchr" = "yes"; then 3046 AC_MSG_CHECKING([if memrchr is prototyped]) 3047 AC_EGREP_CPP([memrchr],[ 3048 $curl_includes_string 3049 ],[ 3050 AC_MSG_RESULT([yes]) 3051 tst_proto_memrchr="yes" 3052 ],[ 3053 AC_MSG_RESULT([no]) 3054 tst_proto_memrchr="no" 3055 ]) 3056 fi 3057 # 3058 if test "$tst_proto_memrchr" = "yes" || 3059 test "$tst_macro_memrchr" = "yes"; then 3060 AC_MSG_CHECKING([if memrchr is compilable]) 3061 AC_COMPILE_IFELSE([ 3062 AC_LANG_PROGRAM([[ 3063 $curl_includes_string 3064 ]],[[ 3065 if(0 != memrchr("", 0, 0)) 3066 return 1; 3067 ]]) 3068 ],[ 3069 AC_MSG_RESULT([yes]) 3070 tst_compi_memrchr="yes" 3071 ],[ 3072 AC_MSG_RESULT([no]) 3073 tst_compi_memrchr="no" 3074 ]) 3075 fi 3076 # 3077 if test "$tst_compi_memrchr" = "yes"; then 3078 AC_MSG_CHECKING([if memrchr usage allowed]) 3079 if test "x$curl_disallow_memrchr" != "xyes"; then 3080 AC_MSG_RESULT([yes]) 3081 tst_allow_memrchr="yes" 3082 else 3083 AC_MSG_RESULT([no]) 3084 tst_allow_memrchr="no" 3085 fi 3086 fi 3087 # 3088 AC_MSG_CHECKING([if memrchr might be used]) 3089 if (test "$tst_proto_memrchr" = "yes" || 3090 test "$tst_macro_memrchr" = "yes") && 3091 test "$tst_compi_memrchr" = "yes" && 3092 test "$tst_allow_memrchr" = "yes"; then 3093 AC_MSG_RESULT([yes]) 3094 AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1, 3095 [Define to 1 if you have the memrchr function or macro.]) 3096 curl_cv_func_memrchr="yes" 3097 else 3098 AC_MSG_RESULT([no]) 3099 curl_cv_func_memrchr="no" 3100 fi 3101 ]) 3102 3103 3104 dnl CURL_CHECK_FUNC_SIGACTION 3105 dnl ------------------------------------------------- 3106 dnl Verify if sigaction is available, prototyped, and 3107 dnl can be compiled. If all of these are true, and 3108 dnl usage has not been previously disallowed with 3109 dnl shell variable curl_disallow_sigaction, then 3110 dnl HAVE_SIGACTION will be defined. 3111 3112 AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [ 3113 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 3114 # 3115 tst_links_sigaction="unknown" 3116 tst_proto_sigaction="unknown" 3117 tst_compi_sigaction="unknown" 3118 tst_allow_sigaction="unknown" 3119 # 3120 AC_MSG_CHECKING([if sigaction can be linked]) 3121 AC_LINK_IFELSE([ 3122 AC_LANG_FUNC_LINK_TRY([sigaction]) 3123 ],[ 3124 AC_MSG_RESULT([yes]) 3125 tst_links_sigaction="yes" 3126 ],[ 3127 AC_MSG_RESULT([no]) 3128 tst_links_sigaction="no" 3129 ]) 3130 # 3131 if test "$tst_links_sigaction" = "yes"; then 3132 AC_MSG_CHECKING([if sigaction is prototyped]) 3133 AC_EGREP_CPP([sigaction],[ 3134 $curl_includes_signal 3135 ],[ 3136 AC_MSG_RESULT([yes]) 3137 tst_proto_sigaction="yes" 3138 ],[ 3139 AC_MSG_RESULT([no]) 3140 tst_proto_sigaction="no" 3141 ]) 3142 fi 3143 # 3144 if test "$tst_proto_sigaction" = "yes"; then 3145 AC_MSG_CHECKING([if sigaction is compilable]) 3146 AC_COMPILE_IFELSE([ 3147 AC_LANG_PROGRAM([[ 3148 $curl_includes_signal 3149 ]],[[ 3150 if(0 != sigaction(0, 0, 0)) 3151 return 1; 3152 ]]) 3153 ],[ 3154 AC_MSG_RESULT([yes]) 3155 tst_compi_sigaction="yes" 3156 ],[ 3157 AC_MSG_RESULT([no]) 3158 tst_compi_sigaction="no" 3159 ]) 3160 fi 3161 # 3162 if test "$tst_compi_sigaction" = "yes"; then 3163 AC_MSG_CHECKING([if sigaction usage allowed]) 3164 if test "x$curl_disallow_sigaction" != "xyes"; then 3165 AC_MSG_RESULT([yes]) 3166 tst_allow_sigaction="yes" 3167 else 3168 AC_MSG_RESULT([no]) 3169 tst_allow_sigaction="no" 3170 fi 3171 fi 3172 # 3173 AC_MSG_CHECKING([if sigaction might be used]) 3174 if test "$tst_links_sigaction" = "yes" && 3175 test "$tst_proto_sigaction" = "yes" && 3176 test "$tst_compi_sigaction" = "yes" && 3177 test "$tst_allow_sigaction" = "yes"; then 3178 AC_MSG_RESULT([yes]) 3179 AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1, 3180 [Define to 1 if you have the sigaction function.]) 3181 curl_cv_func_sigaction="yes" 3182 else 3183 AC_MSG_RESULT([no]) 3184 curl_cv_func_sigaction="no" 3185 fi 3186 ]) 3187 3188 3189 dnl CURL_CHECK_FUNC_SIGINTERRUPT 3190 dnl ------------------------------------------------- 3191 dnl Verify if siginterrupt is available, prototyped, and 3192 dnl can be compiled. If all of these are true, and 3193 dnl usage has not been previously disallowed with 3194 dnl shell variable curl_disallow_siginterrupt, then 3195 dnl HAVE_SIGINTERRUPT will be defined. 3196 3197 AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [ 3198 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 3199 # 3200 tst_links_siginterrupt="unknown" 3201 tst_proto_siginterrupt="unknown" 3202 tst_compi_siginterrupt="unknown" 3203 tst_allow_siginterrupt="unknown" 3204 # 3205 AC_MSG_CHECKING([if siginterrupt can be linked]) 3206 AC_LINK_IFELSE([ 3207 AC_LANG_FUNC_LINK_TRY([siginterrupt]) 3208 ],[ 3209 AC_MSG_RESULT([yes]) 3210 tst_links_siginterrupt="yes" 3211 ],[ 3212 AC_MSG_RESULT([no]) 3213 tst_links_siginterrupt="no" 3214 ]) 3215 # 3216 if test "$tst_links_siginterrupt" = "yes"; then 3217 AC_MSG_CHECKING([if siginterrupt is prototyped]) 3218 AC_EGREP_CPP([siginterrupt],[ 3219 $curl_includes_signal 3220 ],[ 3221 AC_MSG_RESULT([yes]) 3222 tst_proto_siginterrupt="yes" 3223 ],[ 3224 AC_MSG_RESULT([no]) 3225 tst_proto_siginterrupt="no" 3226 ]) 3227 fi 3228 # 3229 if test "$tst_proto_siginterrupt" = "yes"; then 3230 AC_MSG_CHECKING([if siginterrupt is compilable]) 3231 AC_COMPILE_IFELSE([ 3232 AC_LANG_PROGRAM([[ 3233 $curl_includes_signal 3234 ]],[[ 3235 if(0 != siginterrupt(0, 0)) 3236 return 1; 3237 ]]) 3238 ],[ 3239 AC_MSG_RESULT([yes]) 3240 tst_compi_siginterrupt="yes" 3241 ],[ 3242 AC_MSG_RESULT([no]) 3243 tst_compi_siginterrupt="no" 3244 ]) 3245 fi 3246 # 3247 if test "$tst_compi_siginterrupt" = "yes"; then 3248 AC_MSG_CHECKING([if siginterrupt usage allowed]) 3249 if test "x$curl_disallow_siginterrupt" != "xyes"; then 3250 AC_MSG_RESULT([yes]) 3251 tst_allow_siginterrupt="yes" 3252 else 3253 AC_MSG_RESULT([no]) 3254 tst_allow_siginterrupt="no" 3255 fi 3256 fi 3257 # 3258 AC_MSG_CHECKING([if siginterrupt might be used]) 3259 if test "$tst_links_siginterrupt" = "yes" && 3260 test "$tst_proto_siginterrupt" = "yes" && 3261 test "$tst_compi_siginterrupt" = "yes" && 3262 test "$tst_allow_siginterrupt" = "yes"; then 3263 AC_MSG_RESULT([yes]) 3264 AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1, 3265 [Define to 1 if you have the siginterrupt function.]) 3266 curl_cv_func_siginterrupt="yes" 3267 else 3268 AC_MSG_RESULT([no]) 3269 curl_cv_func_siginterrupt="no" 3270 fi 3271 ]) 3272 3273 3274 dnl CURL_CHECK_FUNC_SIGNAL 3275 dnl ------------------------------------------------- 3276 dnl Verify if signal is available, prototyped, and 3277 dnl can be compiled. If all of these are true, and 3278 dnl usage has not been previously disallowed with 3279 dnl shell variable curl_disallow_signal, then 3280 dnl HAVE_SIGNAL will be defined. 3281 3282 AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [ 3283 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl 3284 # 3285 tst_links_signal="unknown" 3286 tst_proto_signal="unknown" 3287 tst_compi_signal="unknown" 3288 tst_allow_signal="unknown" 3289 # 3290 AC_MSG_CHECKING([if signal can be linked]) 3291 AC_LINK_IFELSE([ 3292 AC_LANG_FUNC_LINK_TRY([signal]) 3293 ],[ 3294 AC_MSG_RESULT([yes]) 3295 tst_links_signal="yes" 3296 ],[ 3297 AC_MSG_RESULT([no]) 3298 tst_links_signal="no" 3299 ]) 3300 # 3301 if test "$tst_links_signal" = "yes"; then 3302 AC_MSG_CHECKING([if signal is prototyped]) 3303 AC_EGREP_CPP([signal],[ 3304 $curl_includes_signal 3305 ],[ 3306 AC_MSG_RESULT([yes]) 3307 tst_proto_signal="yes" 3308 ],[ 3309 AC_MSG_RESULT([no]) 3310 tst_proto_signal="no" 3311 ]) 3312 fi 3313 # 3314 if test "$tst_proto_signal" = "yes"; then 3315 AC_MSG_CHECKING([if signal is compilable]) 3316 AC_COMPILE_IFELSE([ 3317 AC_LANG_PROGRAM([[ 3318 $curl_includes_signal 3319 ]],[[ 3320 if(0 != signal(0, 0)) 3321 return 1; 3322 ]]) 3323 ],[ 3324 AC_MSG_RESULT([yes]) 3325 tst_compi_signal="yes" 3326 ],[ 3327 AC_MSG_RESULT([no]) 3328 tst_compi_signal="no" 3329 ]) 3330 fi 3331 # 3332 if test "$tst_compi_signal" = "yes"; then 3333 AC_MSG_CHECKING([if signal usage allowed]) 3334 if test "x$curl_disallow_signal" != "xyes"; then 3335 AC_MSG_RESULT([yes]) 3336 tst_allow_signal="yes" 3337 else 3338 AC_MSG_RESULT([no]) 3339 tst_allow_signal="no" 3340 fi 3341 fi 3342 # 3343 AC_MSG_CHECKING([if signal might be used]) 3344 if test "$tst_links_signal" = "yes" && 3345 test "$tst_proto_signal" = "yes" && 3346 test "$tst_compi_signal" = "yes" && 3347 test "$tst_allow_signal" = "yes"; then 3348 AC_MSG_RESULT([yes]) 3349 AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1, 3350 [Define to 1 if you have the signal function.]) 3351 curl_cv_func_signal="yes" 3352 else 3353 AC_MSG_RESULT([no]) 3354 curl_cv_func_signal="no" 3355 fi 3356 ]) 3357 3358 3359 dnl CURL_CHECK_FUNC_SIGSETJMP 3360 dnl ------------------------------------------------- 3361 dnl Verify if sigsetjmp is available, prototyped, and 3362 dnl can be compiled. If all of these are true, and 3363 dnl usage has not been previously disallowed with 3364 dnl shell variable curl_disallow_sigsetjmp, then 3365 dnl HAVE_SIGSETJMP will be defined. 3366 3367 AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [ 3368 AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl 3369 # 3370 tst_links_sigsetjmp="unknown" 3371 tst_macro_sigsetjmp="unknown" 3372 tst_proto_sigsetjmp="unknown" 3373 tst_compi_sigsetjmp="unknown" 3374 tst_allow_sigsetjmp="unknown" 3375 # 3376 AC_MSG_CHECKING([if sigsetjmp can be linked]) 3377 AC_LINK_IFELSE([ 3378 AC_LANG_FUNC_LINK_TRY([sigsetjmp]) 3379 ],[ 3380 AC_MSG_RESULT([yes]) 3381 tst_links_sigsetjmp="yes" 3382 ],[ 3383 AC_MSG_RESULT([no]) 3384 tst_links_sigsetjmp="no" 3385 ]) 3386 # 3387 if test "$tst_links_sigsetjmp" = "no"; then 3388 AC_MSG_CHECKING([if sigsetjmp seems a macro]) 3389 AC_LINK_IFELSE([ 3390 AC_LANG_PROGRAM([[ 3391 $curl_includes_setjmp 3392 ]],[[ 3393 sigjmp_buf env; 3394 if(0 != sigsetjmp(env, 0)) 3395 return 1; 3396 ]]) 3397 ],[ 3398 AC_MSG_RESULT([yes]) 3399 tst_macro_sigsetjmp="yes" 3400 ],[ 3401 AC_MSG_RESULT([no]) 3402 tst_macro_sigsetjmp="no" 3403 ]) 3404 fi 3405 # 3406 if test "$tst_links_sigsetjmp" = "yes"; then 3407 AC_MSG_CHECKING([if sigsetjmp is prototyped]) 3408 AC_EGREP_CPP([sigsetjmp],[ 3409 $curl_includes_setjmp 3410 ],[ 3411 AC_MSG_RESULT([yes]) 3412 tst_proto_sigsetjmp="yes" 3413 ],[ 3414 AC_MSG_RESULT([no]) 3415 tst_proto_sigsetjmp="no" 3416 ]) 3417 fi 3418 # 3419 if test "$tst_proto_sigsetjmp" = "yes" || 3420 test "$tst_macro_sigsetjmp" = "yes"; then 3421 AC_MSG_CHECKING([if sigsetjmp is compilable]) 3422 AC_COMPILE_IFELSE([ 3423 AC_LANG_PROGRAM([[ 3424 $curl_includes_setjmp 3425 ]],[[ 3426 sigjmp_buf env; 3427 if(0 != sigsetjmp(env, 0)) 3428 return 1; 3429 ]]) 3430 ],[ 3431 AC_MSG_RESULT([yes]) 3432 tst_compi_sigsetjmp="yes" 3433 ],[ 3434 AC_MSG_RESULT([no]) 3435 tst_compi_sigsetjmp="no" 3436 ]) 3437 fi 3438 # 3439 if test "$tst_compi_sigsetjmp" = "yes"; then 3440 AC_MSG_CHECKING([if sigsetjmp usage allowed]) 3441 if test "x$curl_disallow_sigsetjmp" != "xyes"; then 3442 AC_MSG_RESULT([yes]) 3443 tst_allow_sigsetjmp="yes" 3444 else 3445 AC_MSG_RESULT([no]) 3446 tst_allow_sigsetjmp="no" 3447 fi 3448 fi 3449 # 3450 AC_MSG_CHECKING([if sigsetjmp might be used]) 3451 if (test "$tst_proto_sigsetjmp" = "yes" || 3452 test "$tst_macro_sigsetjmp" = "yes") && 3453 test "$tst_compi_sigsetjmp" = "yes" && 3454 test "$tst_allow_sigsetjmp" = "yes"; then 3455 AC_MSG_RESULT([yes]) 3456 AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1, 3457 [Define to 1 if you have the sigsetjmp function or macro.]) 3458 curl_cv_func_sigsetjmp="yes" 3459 else 3460 AC_MSG_RESULT([no]) 3461 curl_cv_func_sigsetjmp="no" 3462 fi 3463 ]) 3464 3465 3466 dnl CURL_CHECK_FUNC_SOCKET 3467 dnl ------------------------------------------------- 3468 dnl Verify if socket is available, prototyped, and 3469 dnl can be compiled. If all of these are true, and 3470 dnl usage has not been previously disallowed with 3471 dnl shell variable curl_disallow_socket, then 3472 dnl HAVE_SOCKET will be defined. 3473 3474 AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [ 3475 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl 3476 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 3477 # 3478 tst_links_socket="unknown" 3479 tst_proto_socket="unknown" 3480 tst_compi_socket="unknown" 3481 tst_allow_socket="unknown" 3482 # 3483 AC_MSG_CHECKING([if socket can be linked]) 3484 AC_LINK_IFELSE([ 3485 AC_LANG_PROGRAM([[ 3486 $curl_includes_winsock2 3487 $curl_includes_bsdsocket 3488 $curl_includes_sys_socket 3489 ]],[[ 3490 if(0 != socket(0, 0, 0)) 3491 return 1; 3492 ]]) 3493 ],[ 3494 AC_MSG_RESULT([yes]) 3495 tst_links_socket="yes" 3496 ],[ 3497 AC_MSG_RESULT([no]) 3498 tst_links_socket="no" 3499 ]) 3500 # 3501 if test "$tst_links_socket" = "yes"; then 3502 AC_MSG_CHECKING([if socket is prototyped]) 3503 AC_EGREP_CPP([socket],[ 3504 $curl_includes_winsock2 3505 $curl_includes_bsdsocket 3506 $curl_includes_sys_socket 3507 ],[ 3508 AC_MSG_RESULT([yes]) 3509 tst_proto_socket="yes" 3510 ],[ 3511 AC_MSG_RESULT([no]) 3512 tst_proto_socket="no" 3513 ]) 3514 fi 3515 # 3516 if test "$tst_proto_socket" = "yes"; then 3517 AC_MSG_CHECKING([if socket is compilable]) 3518 AC_COMPILE_IFELSE([ 3519 AC_LANG_PROGRAM([[ 3520 $curl_includes_winsock2 3521 $curl_includes_bsdsocket 3522 $curl_includes_sys_socket 3523 ]],[[ 3524 if(0 != socket(0, 0, 0)) 3525 return 1; 3526 ]]) 3527 ],[ 3528 AC_MSG_RESULT([yes]) 3529 tst_compi_socket="yes" 3530 ],[ 3531 AC_MSG_RESULT([no]) 3532 tst_compi_socket="no" 3533 ]) 3534 fi 3535 # 3536 if test "$tst_compi_socket" = "yes"; then 3537 AC_MSG_CHECKING([if socket usage allowed]) 3538 if test "x$curl_disallow_socket" != "xyes"; then 3539 AC_MSG_RESULT([yes]) 3540 tst_allow_socket="yes" 3541 else 3542 AC_MSG_RESULT([no]) 3543 tst_allow_socket="no" 3544 fi 3545 fi 3546 # 3547 AC_MSG_CHECKING([if socket might be used]) 3548 if test "$tst_links_socket" = "yes" && 3549 test "$tst_proto_socket" = "yes" && 3550 test "$tst_compi_socket" = "yes" && 3551 test "$tst_allow_socket" = "yes"; then 3552 AC_MSG_RESULT([yes]) 3553 AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1, 3554 [Define to 1 if you have the socket function.]) 3555 curl_cv_func_socket="yes" 3556 else 3557 AC_MSG_RESULT([no]) 3558 curl_cv_func_socket="no" 3559 fi 3560 ]) 3561 3562 3563 dnl CURL_CHECK_FUNC_SOCKETPAIR 3564 dnl ------------------------------------------------- 3565 dnl Verify if socketpair is available, prototyped, and 3566 dnl can be compiled. If all of these are true, and 3567 dnl usage has not been previously disallowed with 3568 dnl shell variable curl_disallow_socketpair, then 3569 dnl HAVE_SOCKETPAIR will be defined. 3570 3571 AC_DEFUN([CURL_CHECK_FUNC_SOCKETPAIR], [ 3572 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl 3573 # 3574 tst_links_socketpair="unknown" 3575 tst_proto_socketpair="unknown" 3576 tst_compi_socketpair="unknown" 3577 tst_allow_socketpair="unknown" 3578 # 3579 AC_MSG_CHECKING([if socketpair can be linked]) 3580 AC_LINK_IFELSE([ 3581 AC_LANG_FUNC_LINK_TRY([socketpair]) 3582 ],[ 3583 AC_MSG_RESULT([yes]) 3584 tst_links_socketpair="yes" 3585 ],[ 3586 AC_MSG_RESULT([no]) 3587 tst_links_socketpair="no" 3588 ]) 3589 # 3590 if test "$tst_links_socketpair" = "yes"; then 3591 AC_MSG_CHECKING([if socketpair is prototyped]) 3592 AC_EGREP_CPP([socketpair],[ 3593 $curl_includes_sys_socket 3594 ],[ 3595 AC_MSG_RESULT([yes]) 3596 tst_proto_socketpair="yes" 3597 ],[ 3598 AC_MSG_RESULT([no]) 3599 tst_proto_socketpair="no" 3600 ]) 3601 fi 3602 # 3603 if test "$tst_proto_socketpair" = "yes"; then 3604 AC_MSG_CHECKING([if socketpair is compilable]) 3605 AC_COMPILE_IFELSE([ 3606 AC_LANG_PROGRAM([[ 3607 $curl_includes_sys_socket 3608 ]],[[ 3609 int sv[2]; 3610 if(0 != socketpair(0, 0, 0, sv)) 3611 return 1; 3612 ]]) 3613 ],[ 3614 AC_MSG_RESULT([yes]) 3615 tst_compi_socketpair="yes" 3616 ],[ 3617 AC_MSG_RESULT([no]) 3618 tst_compi_socketpair="no" 3619 ]) 3620 fi 3621 # 3622 if test "$tst_compi_socketpair" = "yes"; then 3623 AC_MSG_CHECKING([if socketpair usage allowed]) 3624 if test "x$curl_disallow_socketpair" != "xyes"; then 3625 AC_MSG_RESULT([yes]) 3626 tst_allow_socketpair="yes" 3627 else 3628 AC_MSG_RESULT([no]) 3629 tst_allow_socketpair="no" 3630 fi 3631 fi 3632 # 3633 AC_MSG_CHECKING([if socketpair might be used]) 3634 if test "$tst_links_socketpair" = "yes" && 3635 test "$tst_proto_socketpair" = "yes" && 3636 test "$tst_compi_socketpair" = "yes" && 3637 test "$tst_allow_socketpair" = "yes"; then 3638 AC_MSG_RESULT([yes]) 3639 AC_DEFINE_UNQUOTED(HAVE_SOCKETPAIR, 1, 3640 [Define to 1 if you have the socketpair function.]) 3641 curl_cv_func_socketpair="yes" 3642 else 3643 AC_MSG_RESULT([no]) 3644 curl_cv_func_socketpair="no" 3645 fi 3646 ]) 3647 3648 3649 dnl CURL_CHECK_FUNC_STRCASECMP 3650 dnl ------------------------------------------------- 3651 dnl Verify if strcasecmp is available, prototyped, and 3652 dnl can be compiled. If all of these are true, and 3653 dnl usage has not been previously disallowed with 3654 dnl shell variable curl_disallow_strcasecmp, then 3655 dnl HAVE_STRCASECMP will be defined. 3656 3657 AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [ 3658 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 3659 # 3660 tst_links_strcasecmp="unknown" 3661 tst_proto_strcasecmp="unknown" 3662 tst_compi_strcasecmp="unknown" 3663 tst_allow_strcasecmp="unknown" 3664 # 3665 AC_MSG_CHECKING([if strcasecmp can be linked]) 3666 AC_LINK_IFELSE([ 3667 AC_LANG_FUNC_LINK_TRY([strcasecmp]) 3668 ],[ 3669 AC_MSG_RESULT([yes]) 3670 tst_links_strcasecmp="yes" 3671 ],[ 3672 AC_MSG_RESULT([no]) 3673 tst_links_strcasecmp="no" 3674 ]) 3675 # 3676 if test "$tst_links_strcasecmp" = "yes"; then 3677 AC_MSG_CHECKING([if strcasecmp is prototyped]) 3678 AC_EGREP_CPP([strcasecmp],[ 3679 $curl_includes_string 3680 ],[ 3681 AC_MSG_RESULT([yes]) 3682 tst_proto_strcasecmp="yes" 3683 ],[ 3684 AC_MSG_RESULT([no]) 3685 tst_proto_strcasecmp="no" 3686 ]) 3687 fi 3688 # 3689 if test "$tst_proto_strcasecmp" = "yes"; then 3690 AC_MSG_CHECKING([if strcasecmp is compilable]) 3691 AC_COMPILE_IFELSE([ 3692 AC_LANG_PROGRAM([[ 3693 $curl_includes_string 3694 ]],[[ 3695 if(0 != strcasecmp("", "")) 3696 return 1; 3697 ]]) 3698 ],[ 3699 AC_MSG_RESULT([yes]) 3700 tst_compi_strcasecmp="yes" 3701 ],[ 3702 AC_MSG_RESULT([no]) 3703 tst_compi_strcasecmp="no" 3704 ]) 3705 fi 3706 # 3707 if test "$tst_compi_strcasecmp" = "yes"; then 3708 AC_MSG_CHECKING([if strcasecmp usage allowed]) 3709 if test "x$curl_disallow_strcasecmp" != "xyes"; then 3710 AC_MSG_RESULT([yes]) 3711 tst_allow_strcasecmp="yes" 3712 else 3713 AC_MSG_RESULT([no]) 3714 tst_allow_strcasecmp="no" 3715 fi 3716 fi 3717 # 3718 AC_MSG_CHECKING([if strcasecmp might be used]) 3719 if test "$tst_links_strcasecmp" = "yes" && 3720 test "$tst_proto_strcasecmp" = "yes" && 3721 test "$tst_compi_strcasecmp" = "yes" && 3722 test "$tst_allow_strcasecmp" = "yes"; then 3723 AC_MSG_RESULT([yes]) 3724 AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1, 3725 [Define to 1 if you have the strcasecmp function.]) 3726 curl_cv_func_strcasecmp="yes" 3727 else 3728 AC_MSG_RESULT([no]) 3729 curl_cv_func_strcasecmp="no" 3730 fi 3731 ]) 3732 3733 dnl CURL_CHECK_FUNC_STRCMPI 3734 dnl ------------------------------------------------- 3735 dnl Verify if strcmpi is available, prototyped, and 3736 dnl can be compiled. If all of these are true, and 3737 dnl usage has not been previously disallowed with 3738 dnl shell variable curl_disallow_strcmpi, then 3739 dnl HAVE_STRCMPI will be defined. 3740 3741 AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [ 3742 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 3743 # 3744 tst_links_strcmpi="unknown" 3745 tst_proto_strcmpi="unknown" 3746 tst_compi_strcmpi="unknown" 3747 tst_allow_strcmpi="unknown" 3748 # 3749 AC_MSG_CHECKING([if strcmpi can be linked]) 3750 AC_LINK_IFELSE([ 3751 AC_LANG_FUNC_LINK_TRY([strcmpi]) 3752 ],[ 3753 AC_MSG_RESULT([yes]) 3754 tst_links_strcmpi="yes" 3755 ],[ 3756 AC_MSG_RESULT([no]) 3757 tst_links_strcmpi="no" 3758 ]) 3759 # 3760 if test "$tst_links_strcmpi" = "yes"; then 3761 AC_MSG_CHECKING([if strcmpi is prototyped]) 3762 AC_EGREP_CPP([strcmpi],[ 3763 $curl_includes_string 3764 ],[ 3765 AC_MSG_RESULT([yes]) 3766 tst_proto_strcmpi="yes" 3767 ],[ 3768 AC_MSG_RESULT([no]) 3769 tst_proto_strcmpi="no" 3770 ]) 3771 fi 3772 # 3773 if test "$tst_proto_strcmpi" = "yes"; then 3774 AC_MSG_CHECKING([if strcmpi is compilable]) 3775 AC_COMPILE_IFELSE([ 3776 AC_LANG_PROGRAM([[ 3777 $curl_includes_string 3778 ]],[[ 3779 if(0 != strcmpi(0, 0)) 3780 return 1; 3781 ]]) 3782 ],[ 3783 AC_MSG_RESULT([yes]) 3784 tst_compi_strcmpi="yes" 3785 ],[ 3786 AC_MSG_RESULT([no]) 3787 tst_compi_strcmpi="no" 3788 ]) 3789 fi 3790 # 3791 if test "$tst_compi_strcmpi" = "yes"; then 3792 AC_MSG_CHECKING([if strcmpi usage allowed]) 3793 if test "x$curl_disallow_strcmpi" != "xyes"; then 3794 AC_MSG_RESULT([yes]) 3795 tst_allow_strcmpi="yes" 3796 else 3797 AC_MSG_RESULT([no]) 3798 tst_allow_strcmpi="no" 3799 fi 3800 fi 3801 # 3802 AC_MSG_CHECKING([if strcmpi might be used]) 3803 if test "$tst_links_strcmpi" = "yes" && 3804 test "$tst_proto_strcmpi" = "yes" && 3805 test "$tst_compi_strcmpi" = "yes" && 3806 test "$tst_allow_strcmpi" = "yes"; then 3807 AC_MSG_RESULT([yes]) 3808 AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1, 3809 [Define to 1 if you have the strcmpi function.]) 3810 curl_cv_func_strcmpi="yes" 3811 else 3812 AC_MSG_RESULT([no]) 3813 curl_cv_func_strcmpi="no" 3814 fi 3815 ]) 3816 3817 3818 dnl CURL_CHECK_FUNC_STRDUP 3819 dnl ------------------------------------------------- 3820 dnl Verify if strdup is available, prototyped, and 3821 dnl can be compiled. If all of these are true, and 3822 dnl usage has not been previously disallowed with 3823 dnl shell variable curl_disallow_strdup, then 3824 dnl HAVE_STRDUP will be defined. 3825 3826 AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [ 3827 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 3828 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 3829 # 3830 tst_links_strdup="unknown" 3831 tst_proto_strdup="unknown" 3832 tst_compi_strdup="unknown" 3833 tst_allow_strdup="unknown" 3834 # 3835 AC_MSG_CHECKING([if strdup can be linked]) 3836 AC_LINK_IFELSE([ 3837 AC_LANG_FUNC_LINK_TRY([strdup]) 3838 ],[ 3839 AC_MSG_RESULT([yes]) 3840 tst_links_strdup="yes" 3841 ],[ 3842 AC_MSG_RESULT([no]) 3843 tst_links_strdup="no" 3844 ]) 3845 # 3846 if test "$tst_links_strdup" = "yes"; then 3847 AC_MSG_CHECKING([if strdup is prototyped]) 3848 AC_EGREP_CPP([strdup],[ 3849 $curl_includes_string 3850 ],[ 3851 AC_MSG_RESULT([yes]) 3852 tst_proto_strdup="yes" 3853 ],[ 3854 AC_MSG_RESULT([no]) 3855 tst_proto_strdup="no" 3856 ]) 3857 fi 3858 # 3859 if test "$tst_proto_strdup" = "yes"; then 3860 AC_MSG_CHECKING([if strdup is compilable]) 3861 AC_COMPILE_IFELSE([ 3862 AC_LANG_PROGRAM([[ 3863 $curl_includes_string 3864 $curl_includes_stdlib 3865 ]],[[ 3866 free(strdup("")); 3867 ]]) 3868 ],[ 3869 AC_MSG_RESULT([yes]) 3870 tst_compi_strdup="yes" 3871 ],[ 3872 AC_MSG_RESULT([no]) 3873 tst_compi_strdup="no" 3874 ]) 3875 fi 3876 # 3877 if test "$tst_compi_strdup" = "yes"; then 3878 AC_MSG_CHECKING([if strdup usage allowed]) 3879 if test "x$curl_disallow_strdup" != "xyes"; then 3880 AC_MSG_RESULT([yes]) 3881 tst_allow_strdup="yes" 3882 else 3883 AC_MSG_RESULT([no]) 3884 tst_allow_strdup="no" 3885 fi 3886 fi 3887 # 3888 AC_MSG_CHECKING([if strdup might be used]) 3889 if test "$tst_links_strdup" = "yes" && 3890 test "$tst_proto_strdup" = "yes" && 3891 test "$tst_compi_strdup" = "yes" && 3892 test "$tst_allow_strdup" = "yes"; then 3893 AC_MSG_RESULT([yes]) 3894 AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1, 3895 [Define to 1 if you have the strdup function.]) 3896 curl_cv_func_strdup="yes" 3897 else 3898 AC_MSG_RESULT([no]) 3899 curl_cv_func_strdup="no" 3900 fi 3901 ]) 3902 3903 3904 dnl CURL_CHECK_FUNC_STRERROR_R 3905 dnl ------------------------------------------------- 3906 dnl Verify if strerror_r is available, prototyped, can be compiled and 3907 dnl seems to work. If all of these are true, and usage has not been 3908 dnl previously disallowed with shell variable curl_disallow_strerror_r, 3909 dnl then HAVE_STRERROR_R will be defined, as well as one of 3910 dnl HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R. 3911 dnl 3912 dnl glibc-style strerror_r: 3913 dnl 3914 dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize); 3915 dnl 3916 dnl glibc-style strerror_r returns a pointer to the error string, 3917 dnl and might use the provided workbuf as a scratch area if needed. A 3918 dnl quick test on a few systems shows that it's usually not used at all. 3919 dnl 3920 dnl POSIX-style strerror_r: 3921 dnl 3922 dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize); 3923 dnl 3924 dnl POSIX-style strerror_r returns 0 upon successful completion and the 3925 dnl error string in the provided resultbuf. 3926 dnl 3927 3928 AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [ 3929 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl 3930 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 3931 # 3932 tst_links_strerror_r="unknown" 3933 tst_proto_strerror_r="unknown" 3934 tst_compi_strerror_r="unknown" 3935 tst_glibc_strerror_r="unknown" 3936 tst_posix_strerror_r="unknown" 3937 tst_allow_strerror_r="unknown" 3938 tst_works_glibc_strerror_r="unknown" 3939 tst_works_posix_strerror_r="unknown" 3940 tst_glibc_strerror_r_type_arg3="unknown" 3941 tst_posix_strerror_r_type_arg3="unknown" 3942 # 3943 AC_MSG_CHECKING([if strerror_r can be linked]) 3944 AC_LINK_IFELSE([ 3945 AC_LANG_FUNC_LINK_TRY([strerror_r]) 3946 ],[ 3947 AC_MSG_RESULT([yes]) 3948 tst_links_strerror_r="yes" 3949 ],[ 3950 AC_MSG_RESULT([no]) 3951 tst_links_strerror_r="no" 3952 ]) 3953 # 3954 if test "$tst_links_strerror_r" = "yes"; then 3955 AC_MSG_CHECKING([if strerror_r is prototyped]) 3956 AC_EGREP_CPP([strerror_r],[ 3957 $curl_includes_string 3958 ],[ 3959 AC_MSG_RESULT([yes]) 3960 tst_proto_strerror_r="yes" 3961 ],[ 3962 AC_MSG_RESULT([no]) 3963 tst_proto_strerror_r="no" 3964 ]) 3965 fi 3966 # 3967 if test "$tst_proto_strerror_r" = "yes"; then 3968 AC_MSG_CHECKING([if strerror_r is compilable]) 3969 AC_COMPILE_IFELSE([ 3970 AC_LANG_PROGRAM([[ 3971 $curl_includes_string 3972 ]],[[ 3973 char s[1]; 3974 if(0 != strerror_r(0, s, 0)) 3975 return 1; 3976 ]]) 3977 ],[ 3978 AC_MSG_RESULT([yes]) 3979 tst_compi_strerror_r="yes" 3980 ],[ 3981 AC_MSG_RESULT([no]) 3982 tst_compi_strerror_r="no" 3983 ]) 3984 fi 3985 # 3986 if test "$tst_compi_strerror_r" = "yes"; then 3987 AC_MSG_CHECKING([if strerror_r is glibc like]) 3988 tst_glibc_strerror_r_type_arg3="unknown" 3989 for arg3 in 'size_t' 'int' 'unsigned int'; do 3990 if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then 3991 AC_COMPILE_IFELSE([ 3992 AC_LANG_PROGRAM([[ 3993 $curl_includes_string 3994 char *strerror_r(int errnum, char *workbuf, $arg3 bufsize); 3995 ]],[[ 3996 char s[1]; 3997 if(0 != strerror_r(0, s, 0)) 3998 return 1; 3999 (void)s; 4000 ]]) 4001 ],[ 4002 tst_glibc_strerror_r_type_arg3="$arg3" 4003 ]) 4004 fi 4005 done 4006 case "$tst_glibc_strerror_r_type_arg3" in 4007 unknown) 4008 AC_MSG_RESULT([no]) 4009 tst_glibc_strerror_r="no" 4010 ;; 4011 *) 4012 AC_MSG_RESULT([yes]) 4013 tst_glibc_strerror_r="yes" 4014 ;; 4015 esac 4016 fi 4017 # 4018 dnl only do runtime verification when not cross-compiling 4019 if test "x$cross_compiling" != "xyes" && 4020 test "$tst_glibc_strerror_r" = "yes"; then 4021 AC_MSG_CHECKING([if strerror_r seems to work]) 4022 CURL_RUN_IFELSE([ 4023 AC_LANG_PROGRAM([[ 4024 $curl_includes_stdlib 4025 $curl_includes_string 4026 #include <errno.h> 4027 ]],[[ 4028 char buffer[1024]; 4029 char *string = 0; 4030 buffer[0] = '\0'; 4031 string = strerror_r(EACCES, buffer, sizeof(buffer)); 4032 if(!string) 4033 return 1; /* fail */ 4034 if(!string[0]) 4035 return 1; /* fail */ 4036 else 4037 return 0; 4038 ]]) 4039 ],[ 4040 AC_MSG_RESULT([yes]) 4041 tst_works_glibc_strerror_r="yes" 4042 ],[ 4043 AC_MSG_RESULT([no]) 4044 tst_works_glibc_strerror_r="no" 4045 ]) 4046 fi 4047 # 4048 if test "$tst_compi_strerror_r" = "yes" && 4049 test "$tst_works_glibc_strerror_r" != "yes"; then 4050 AC_MSG_CHECKING([if strerror_r is POSIX like]) 4051 tst_posix_strerror_r_type_arg3="unknown" 4052 for arg3 in 'size_t' 'int' 'unsigned int'; do 4053 if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then 4054 AC_COMPILE_IFELSE([ 4055 AC_LANG_PROGRAM([[ 4056 $curl_includes_string 4057 int strerror_r(int errnum, char *resultbuf, $arg3 bufsize); 4058 ]],[[ 4059 char s[1]; 4060 if(0 != strerror_r(0, s, 0)) 4061 return 1; 4062 (void)s; 4063 ]]) 4064 ],[ 4065 tst_posix_strerror_r_type_arg3="$arg3" 4066 ]) 4067 fi 4068 done 4069 case "$tst_posix_strerror_r_type_arg3" in 4070 unknown) 4071 AC_MSG_RESULT([no]) 4072 tst_posix_strerror_r="no" 4073 ;; 4074 *) 4075 AC_MSG_RESULT([yes]) 4076 tst_posix_strerror_r="yes" 4077 ;; 4078 esac 4079 fi 4080 # 4081 dnl only do runtime verification when not cross-compiling 4082 if test "x$cross_compiling" != "xyes" && 4083 test "$tst_posix_strerror_r" = "yes"; then 4084 AC_MSG_CHECKING([if strerror_r seems to work]) 4085 CURL_RUN_IFELSE([ 4086 AC_LANG_PROGRAM([[ 4087 $curl_includes_stdlib 4088 $curl_includes_string 4089 #include <errno.h> 4090 ]],[[ 4091 char buffer[1024]; 4092 int error = 1; 4093 buffer[0] = '\0'; 4094 error = strerror_r(EACCES, buffer, sizeof(buffer)); 4095 if(error) 4096 return 1; /* fail */ 4097 if(buffer[0] == '\0') 4098 return 1; /* fail */ 4099 else 4100 return 0; 4101 ]]) 4102 ],[ 4103 AC_MSG_RESULT([yes]) 4104 tst_works_posix_strerror_r="yes" 4105 ],[ 4106 AC_MSG_RESULT([no]) 4107 tst_works_posix_strerror_r="no" 4108 ]) 4109 fi 4110 # 4111 if test "$tst_works_glibc_strerror_r" = "yes"; then 4112 tst_posix_strerror_r="no" 4113 fi 4114 if test "$tst_works_posix_strerror_r" = "yes"; then 4115 tst_glibc_strerror_r="no" 4116 fi 4117 if test "$tst_glibc_strerror_r" = "yes" && 4118 test "$tst_works_glibc_strerror_r" != "no" && 4119 test "$tst_posix_strerror_r" != "yes"; then 4120 tst_allow_strerror_r="check" 4121 fi 4122 if test "$tst_posix_strerror_r" = "yes" && 4123 test "$tst_works_posix_strerror_r" != "no" && 4124 test "$tst_glibc_strerror_r" != "yes"; then 4125 tst_allow_strerror_r="check" 4126 fi 4127 if test "$tst_allow_strerror_r" = "check"; then 4128 AC_MSG_CHECKING([if strerror_r usage allowed]) 4129 if test "x$curl_disallow_strerror_r" != "xyes"; then 4130 AC_MSG_RESULT([yes]) 4131 tst_allow_strerror_r="yes" 4132 else 4133 AC_MSG_RESULT([no]) 4134 tst_allow_strerror_r="no" 4135 fi 4136 fi 4137 # 4138 AC_MSG_CHECKING([if strerror_r might be used]) 4139 if test "$tst_links_strerror_r" = "yes" && 4140 test "$tst_proto_strerror_r" = "yes" && 4141 test "$tst_compi_strerror_r" = "yes" && 4142 test "$tst_allow_strerror_r" = "yes"; then 4143 AC_MSG_RESULT([yes]) 4144 if test "$tst_glibc_strerror_r" = "yes"; then 4145 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1, 4146 [Define to 1 if you have the strerror_r function.]) 4147 AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1, 4148 [Define to 1 if you have a working glibc-style strerror_r function.]) 4149 fi 4150 if test "$tst_posix_strerror_r" = "yes"; then 4151 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1, 4152 [Define to 1 if you have the strerror_r function.]) 4153 AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1, 4154 [Define to 1 if you have a working POSIX-style strerror_r function.]) 4155 fi 4156 curl_cv_func_strerror_r="yes" 4157 else 4158 AC_MSG_RESULT([no]) 4159 curl_cv_func_strerror_r="no" 4160 fi 4161 # 4162 if test "$tst_compi_strerror_r" = "yes" && 4163 test "$tst_allow_strerror_r" = "unknown"; then 4164 AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.]) 4165 fi 4166 # 4167 ]) 4168 4169 4170 dnl CURL_CHECK_FUNC_STRICMP 4171 dnl ------------------------------------------------- 4172 dnl Verify if stricmp is available, prototyped, and 4173 dnl can be compiled. If all of these are true, and 4174 dnl usage has not been previously disallowed with 4175 dnl shell variable curl_disallow_stricmp, then 4176 dnl HAVE_STRICMP will be defined. 4177 4178 AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [ 4179 AC_REQUIRE([CURL_INCLUDES_STRING])dnl 4180 # 4181 tst_links_stricmp="unknown" 4182 tst_proto_stricmp="unknown" 4183 tst_compi_stricmp="unknown" 4184 tst_allow_stricmp="unknown" 4185 # 4186 AC_MSG_CHECKING([if stricmp can be linked]) 4187 AC_LINK_IFELSE([ 4188 AC_LANG_FUNC_LINK_TRY([stricmp]) 4189 ],[ 4190 AC_MSG_RESULT([yes]) 4191 tst_links_stricmp="yes" 4192 ],[ 4193 AC_MSG_RESULT([no]) 4194 tst_links_stricmp="no" 4195 ]) 4196 # 4197 if test "$tst_links_stricmp" = "yes"; then 4198 AC_MSG_CHECKING([if stricmp is prototyped]) 4199 AC_EGREP_CPP([stricmp],[ 4200 $curl_includes_string 4201 ],[ 4202 AC_MSG_RESULT([yes]) 4203 tst_proto_stricmp="yes" 4204 ],[ 4205 AC_MSG_RESULT([no]) 4206 tst_proto_stricmp="no" 4207 ]) 4208 fi 4209 # 4210 if test "$tst_proto_stricmp" = "yes"; then 4211 AC_MSG_CHECKING([if stricmp is compilable]) 4212 AC_COMPILE_IFELSE([ 4213 AC_LANG_PROGRAM([[ 4214 $curl_includes_string 4215 ]],[[ 4216 if(0 != stricmp(0, 0)) 4217 return 1; 4218 ]]) 4219 ],[ 4220 AC_MSG_RESULT([yes]) 4221 tst_compi_stricmp="yes" 4222 ],[ 4223 AC_MSG_RESULT([no]) 4224 tst_compi_stricmp="no" 4225 ]) 4226 fi 4227 # 4228 if test "$tst_compi_stricmp" = "yes"; then 4229 AC_MSG_CHECKING([if stricmp usage allowed]) 4230 if test "x$curl_disallow_stricmp" != "xyes"; then 4231 AC_MSG_RESULT([yes]) 4232 tst_allow_stricmp="yes" 4233 else 4234 AC_MSG_RESULT([no]) 4235 tst_allow_stricmp="no" 4236 fi 4237 fi 4238 # 4239 AC_MSG_CHECKING([if stricmp might be used]) 4240 if test "$tst_links_stricmp" = "yes" && 4241 test "$tst_proto_stricmp" = "yes" && 4242 test "$tst_compi_stricmp" = "yes" && 4243 test "$tst_allow_stricmp" = "yes"; then 4244 AC_MSG_RESULT([yes]) 4245 AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1, 4246 [Define to 1 if you have the stricmp function.]) 4247 curl_cv_func_stricmp="yes" 4248 else 4249 AC_MSG_RESULT([no]) 4250 curl_cv_func_stricmp="no" 4251 fi 4252 ]) 4253 4254 dnl CURL_RUN_IFELSE 4255 dnl ------------------------------------------------- 4256 dnl Wrapper macro to use instead of AC_RUN_IFELSE. It 4257 dnl sets LD_LIBRARY_PATH locally for this run only, from the 4258 dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH 4259 dnl changes contained within this macro. 4260 4261 AC_DEFUN([CURL_RUN_IFELSE], [ 4262 if test "$curl_cv_apple" = 'yes'; then 4263 AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) 4264 else 4265 oldcc=$CC 4266 old=$LD_LIBRARY_PATH 4267 CC="sh ./run-compiler" 4268 LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old 4269 export LD_LIBRARY_PATH 4270 AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4) 4271 LD_LIBRARY_PATH=$old # restore 4272 CC=$oldcc 4273 fi 4274 ]) 4275 4276 dnl CURL_COVERAGE 4277 dnl -------------------------------------------------- 4278 dnl Switch on options and libs to build with gcc's code coverage. 4279 dnl 4280 4281 AC_DEFUN([CURL_COVERAGE],[ 4282 AC_REQUIRE([AC_PROG_SED]) 4283 AC_REQUIRE([AC_ARG_ENABLE]) 4284 AC_MSG_CHECKING([for code coverage support]) 4285 coverage="no" 4286 curl_coverage_msg="disabled" 4287 4288 dnl check if enabled by argument 4289 AC_ARG_ENABLE(code-coverage, 4290 AS_HELP_STRING([--enable-code-coverage], [Provide code coverage]), 4291 coverage="$enableval") 4292 4293 dnl if not gcc switch off again 4294 AS_IF([ test "$GCC" != "yes" ], coverage="no" ) 4295 AC_MSG_RESULT($coverage) 4296 4297 if test "x$coverage" = "xyes"; then 4298 curl_coverage_msg="enabled" 4299 4300 AC_CHECK_TOOL([GCOV], [gcov], [gcov]) 4301 if test -z "$GCOV"; then 4302 AC_MSG_ERROR([needs gcov for code coverage]) 4303 fi 4304 AC_CHECK_PROG([LCOV], [lcov], [lcov]) 4305 if test -z "$LCOV"; then 4306 AC_MSG_ERROR([needs lcov for code coverage]) 4307 fi 4308 4309 CPPFLAGS="$CPPFLAGS -DNDEBUG" 4310 CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage" 4311 LIBS="$LIBS -lgcov" 4312 fi 4313 ]) 4314 4315 dnl CURL_ATOMIC 4316 dnl ------------------------------------------------------------- 4317 dnl Check if _Atomic works. But only check if stdatomic.h exists. 4318 dnl 4319 AC_DEFUN([CURL_ATOMIC],[ 4320 AC_CHECK_HEADERS(stdatomic.h, [ 4321 AC_MSG_CHECKING([if _Atomic is available]) 4322 AC_LINK_IFELSE([ 4323 AC_LANG_PROGRAM([[ 4324 $curl_includes_unistd 4325 ]],[[ 4326 _Atomic int i = 0; 4327 i = 4; // Force an atomic-write operation. 4328 (void)i; 4329 ]]) 4330 ],[ 4331 AC_MSG_RESULT([yes]) 4332 AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1, 4333 [Define to 1 if you have _Atomic support.]) 4334 tst_atomic="yes" 4335 ],[ 4336 AC_MSG_RESULT([no]) 4337 tst_atomic="no" 4338 ]) 4339 ]) 4340 ]) 4341 4342 # Rewrite inspired by the functionality once provided by 4343 # AX_COMPILE_CHECK_SIZEOF. Uses the switch() "trick" to find the size of the 4344 # given type. 4345 # 4346 # This code fails to compile: 4347 # 4348 # switch() { case 0: case 0: } 4349 # 4350 # By making the second case number a boolean check, it fails to compile the 4351 # test code when the boolean is false and thus creating a zero, making it a 4352 # duplicated case label. If the boolean equals true, it becomes a one, the 4353 # code compiles and we know it was a match. 4354 # 4355 # The check iterates over all possible sizes and stops as soon it compiles 4356 # error-free. 4357 # 4358 # Usage: 4359 # 4360 # CURL_SIZEOF(TYPE, [HEADERS]) 4361 # 4362 4363 AC_DEFUN([CURL_SIZEOF], [ 4364 dnl The #define name to make autoheader put the name in curl_config.h.in 4365 define(TYPE, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl 4366 4367 AC_MSG_CHECKING(size of $1) 4368 r=0 4369 dnl Check the sizes in a reasonable order 4370 for typesize in 8 4 2 16 1; do 4371 AC_COMPILE_IFELSE([ 4372 AC_LANG_PROGRAM([[ 4373 #include <sys/types.h> 4374 $2 4375 ]],[ 4376 switch(0) { 4377 case 0: 4378 case (sizeof($1) == $typesize):; 4379 } 4380 ]) 4381 ],[ 4382 r=$typesize 4383 ],[ 4384 r=0 4385 ]) 4386 dnl get out of the loop once matched 4387 if test $r -gt 0; then 4388 break; 4389 fi 4390 done 4391 if test $r -eq 0; then 4392 AC_MSG_ERROR([Failed to find size of $1]) 4393 fi 4394 AC_MSG_RESULT($r) 4395 dnl lowercase and underscore instead of space 4396 tname=`echo "ac_cv_sizeof_$1" | tr A-Z a-z | tr " " "_"` 4397 eval "$tname=$r" 4398 4399 AC_DEFINE_UNQUOTED(TYPE, [$r], [Size of $1 in number of bytes]) 4400 4401 ])