1 2 3dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) 4dnl ------------------------------------------------- 5dnl Use the C preprocessor to find out if the given object-style symbol 6dnl is defined and get its expansion. This macro will not use default 7dnl includes even if no INCLUDES argument is given. This macro will run 8dnl silently when invoked with three arguments. If the expansion would 9dnl result in a set of double-quoted strings the returned expansion will 10dnl actually be a single double-quoted string concatenating all them. 11 12AC_DEFUN([CURL_CHECK_DEF], [ 13 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl 14 AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl 15 if test -z "$SED"; then 16 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.]) 17 fi 18 if test -z "$GREP"; then 19 AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.]) 20 fi 21 ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])]) 22 tmp_exp="" 23 AC_PREPROC_IFELSE([ 24 AC_LANG_SOURCE( 25ifelse($2,,,[$2])[[ 26#ifdef $1 27CURL_DEF_TOKEN $1 28#endif 29 ]]) 30 ],[ 31 tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \ 32 "$GREP" CURL_DEF_TOKEN 2>/dev/null | \ 33 "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \ 34 "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null` 35 if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then 36 tmp_exp="" 37 fi 38 ]) 39 if test -z "$tmp_exp"; then 40 AS_VAR_SET(ac_HaveDef, no) 41 ifelse($3,,[AC_MSG_RESULT([no])]) 42 else 43 AS_VAR_SET(ac_HaveDef, yes) 44 AS_VAR_SET(ac_Def, $tmp_exp) 45 ifelse($3,,[AC_MSG_RESULT([$tmp_exp])]) 46 fi 47 AS_VAR_POPDEF([ac_Def])dnl 48 AS_VAR_POPDEF([ac_HaveDef])dnl 49]) 50 51 52dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT]) 53dnl ------------------------------------------------- 54dnl Use the C compiler to find out only if the given symbol is defined 55dnl or not, this can not find out its expansion. This macro will not use 56dnl default includes even if no INCLUDES argument is given. This macro 57dnl will run silently when invoked with three arguments. 58 59AC_DEFUN([CURL_CHECK_DEF_CC], [ 60 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl 61 ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])]) 62 AC_COMPILE_IFELSE([ 63 AC_LANG_SOURCE( 64ifelse($2,,,[$2])[[ 65int main (void) 66{ 67#ifdef $1 68 return 0; 69#else 70 force compilation error 71#endif 72} 73 ]]) 74 ],[ 75 tst_symbol_defined="yes" 76 ],[ 77 tst_symbol_defined="no" 78 ]) 79 if test "$tst_symbol_defined" = "yes"; then 80 AS_VAR_SET(ac_HaveDef, yes) 81 ifelse($3,,[AC_MSG_RESULT([yes])]) 82 else 83 AS_VAR_SET(ac_HaveDef, no) 84 ifelse($3,,[AC_MSG_RESULT([no])]) 85 fi 86 AS_VAR_POPDEF([ac_HaveDef])dnl 87]) 88 89 90dnl CARES_CHECK_LIB_XNET 91dnl ------------------------------------------------- 92dnl Verify if X/Open network library is required. 93 94AC_DEFUN([CARES_CHECK_LIB_XNET], [ 95 AC_MSG_CHECKING([if X/Open network library is required]) 96 tst_lib_xnet_required="no" 97 AC_COMPILE_IFELSE([ 98 AC_LANG_SOURCE([[ 99int main (void) 100{ 101#if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) 102 return 0; 103#elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) 104 return 0; 105#else 106 force compilation error 107#endif 108} 109 ]]) 110 ],[ 111 tst_lib_xnet_required="yes" 112 LIBS="$LIBS -lxnet" 113 ]) 114 AC_MSG_RESULT([$tst_lib_xnet_required]) 115]) 116 117 118dnl CARES_CHECK_AIX_ALL_SOURCE 119dnl ------------------------------------------------- 120dnl Provides a replacement of traditional AC_AIX with 121dnl an uniform behaviour across all autoconf versions, 122dnl and with our own placement rules. 123 124AC_DEFUN([CARES_CHECK_AIX_ALL_SOURCE], [ 125 AH_VERBATIM([_ALL_SOURCE], 126 [/* Define to 1 if OS is AIX. */ 127#ifndef _ALL_SOURCE 128# undef _ALL_SOURCE 129#endif]) 130 AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl 131 AC_BEFORE([$0], [CARES_CONFIGURE_REENTRANT])dnl 132 AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)]) 133 AC_EGREP_CPP([yes_this_is_aix],[ 134#ifdef _AIX 135 yes_this_is_aix 136#endif 137 ],[ 138 AC_MSG_RESULT([yes]) 139 AC_DEFINE(_ALL_SOURCE) 140 ],[ 141 AC_MSG_RESULT([no]) 142 ]) 143]) 144 145 146dnl CURL_CHECK_HEADER_WINDOWS 147dnl ------------------------------------------------- 148dnl Check for compilable and valid windows.h header 149 150AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [ 151 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [ 152 AC_COMPILE_IFELSE([ 153 AC_LANG_PROGRAM([[ 154#undef inline 155#ifndef WIN32_LEAN_AND_MEAN 156#define WIN32_LEAN_AND_MEAN 157#endif 158#include <windows.h> 159 ]],[[ 160#if defined(__CYGWIN__) || defined(__CEGCC__) 161 HAVE_WINDOWS_H shall not be defined. 162#else 163 int dummy=2*WINVER; 164#endif 165 ]]) 166 ],[ 167 ac_cv_header_windows_h="yes" 168 ],[ 169 ac_cv_header_windows_h="no" 170 ]) 171 ]) 172 case "$ac_cv_header_windows_h" in 173 yes) 174 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1, 175 [Define to 1 if you have the windows.h header file.]) 176 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1, 177 [Define to avoid automatic inclusion of winsock.h]) 178 ;; 179 esac 180]) 181 182 183dnl CURL_CHECK_NATIVE_WINDOWS 184dnl ------------------------------------------------- 185dnl Check if building a native Windows target 186 187AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [ 188 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl 189 AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [ 190 if test "$ac_cv_header_windows_h" = "no"; then 191 ac_cv_native_windows="no" 192 else 193 AC_COMPILE_IFELSE([ 194 AC_LANG_PROGRAM([[ 195 ]],[[ 196#if defined(__MINGW32__) || defined(__MINGW32CE__) || \ 197 (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))) 198 int dummy=1; 199#else 200 Not a native Windows build target. 201#endif 202 ]]) 203 ],[ 204 ac_cv_native_windows="yes" 205 ],[ 206 ac_cv_native_windows="no" 207 ]) 208 fi 209 ]) 210 AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$ac_cv_native_windows" = xyes) 211]) 212 213 214dnl CURL_CHECK_HEADER_WINSOCK 215dnl ------------------------------------------------- 216dnl Check for compilable and valid winsock.h header 217 218AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [ 219 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl 220 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [ 221 AC_COMPILE_IFELSE([ 222 AC_LANG_PROGRAM([[ 223#undef inline 224#ifndef WIN32_LEAN_AND_MEAN 225#define WIN32_LEAN_AND_MEAN 226#endif 227#include <windows.h> 228#include <winsock.h> 229 ]],[[ 230#if defined(__CYGWIN__) || defined(__CEGCC__) 231 HAVE_WINSOCK_H shall not be defined. 232#else 233 int dummy=WSACleanup(); 234#endif 235 ]]) 236 ],[ 237 ac_cv_header_winsock_h="yes" 238 ],[ 239 ac_cv_header_winsock_h="no" 240 ]) 241 ]) 242 case "$ac_cv_header_winsock_h" in 243 yes) 244 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, 245 [Define to 1 if you have the winsock.h header file.]) 246 ;; 247 esac 248]) 249 250 251dnl CURL_CHECK_HEADER_WINSOCK2 252dnl ------------------------------------------------- 253dnl Check for compilable and valid winsock2.h header 254 255AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [ 256 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl 257 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [ 258 AC_COMPILE_IFELSE([ 259 AC_LANG_PROGRAM([[ 260#undef inline 261#ifndef WIN32_LEAN_AND_MEAN 262#define WIN32_LEAN_AND_MEAN 263#endif 264#include <windows.h> 265#include <winsock2.h> 266 ]],[[ 267#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) 268 HAVE_WINSOCK2_H shall not be defined. 269#else 270 int dummy=2*IPPROTO_ESP; 271#endif 272 ]]) 273 ],[ 274 ac_cv_header_winsock2_h="yes" 275 ],[ 276 ac_cv_header_winsock2_h="no" 277 ]) 278 ]) 279 case "$ac_cv_header_winsock2_h" in 280 yes) 281 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, 282 [Define to 1 if you have the winsock2.h header file.]) 283 ;; 284 esac 285]) 286 287 288dnl CURL_CHECK_HEADER_WS2TCPIP 289dnl ------------------------------------------------- 290dnl Check for compilable and valid ws2tcpip.h header 291 292AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [ 293 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl 294 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [ 295 AC_COMPILE_IFELSE([ 296 AC_LANG_PROGRAM([[ 297#undef inline 298#ifndef WIN32_LEAN_AND_MEAN 299#define WIN32_LEAN_AND_MEAN 300#endif 301#include <windows.h> 302#include <winsock2.h> 303#include <ws2tcpip.h> 304 ]],[[ 305#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) 306 HAVE_WS2TCPIP_H shall not be defined. 307#else 308 int dummy=2*IP_PKTINFO; 309#endif 310 ]]) 311 ],[ 312 ac_cv_header_ws2tcpip_h="yes" 313 ],[ 314 ac_cv_header_ws2tcpip_h="no" 315 ]) 316 ]) 317 case "$ac_cv_header_ws2tcpip_h" in 318 yes) 319 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1, 320 [Define to 1 if you have the ws2tcpip.h header file.]) 321 ;; 322 esac 323]) 324 325 326dnl CURL_CHECK_HEADER_MALLOC 327dnl ------------------------------------------------- 328dnl Check for compilable and valid malloc.h header, 329dnl and check if it is needed even with stdlib.h 330 331AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [ 332 AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [ 333 AC_COMPILE_IFELSE([ 334 AC_LANG_PROGRAM([[ 335#include <malloc.h> 336 ]],[[ 337 void *p = malloc(10); 338 void *q = calloc(10,10); 339 free(p); 340 free(q); 341 ]]) 342 ],[ 343 ac_cv_header_malloc_h="yes" 344 ],[ 345 ac_cv_header_malloc_h="no" 346 ]) 347 ]) 348 if test "$ac_cv_header_malloc_h" = "yes"; then 349 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1, 350 [Define to 1 if you have the malloc.h header file.]) 351 # 352 AC_COMPILE_IFELSE([ 353 AC_LANG_PROGRAM([[ 354#include <stdlib.h> 355 ]],[[ 356 void *p = malloc(10); 357 void *q = calloc(10,10); 358 free(p); 359 free(q); 360 ]]) 361 ],[ 362 curl_cv_need_header_malloc_h="no" 363 ],[ 364 curl_cv_need_header_malloc_h="yes" 365 ]) 366 # 367 case "$curl_cv_need_header_malloc_h" in 368 yes) 369 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1, 370 [Define to 1 if you need the malloc.h header file even with stdlib.h]) 371 ;; 372 esac 373 fi 374]) 375 376 377dnl CURL_CHECK_HEADER_MEMORY 378dnl ------------------------------------------------- 379dnl Check for compilable and valid memory.h header, 380dnl and check if it is needed even with stdlib.h for 381dnl memory related functions. 382 383AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [ 384 AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [ 385 AC_COMPILE_IFELSE([ 386 AC_LANG_PROGRAM([[ 387#include <memory.h> 388 ]],[[ 389 void *p = malloc(10); 390 void *q = calloc(10,10); 391 free(p); 392 free(q); 393 ]]) 394 ],[ 395 ac_cv_header_memory_h="yes" 396 ],[ 397 ac_cv_header_memory_h="no" 398 ]) 399 ]) 400 if test "$ac_cv_header_memory_h" = "yes"; then 401 AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1, 402 [Define to 1 if you have the memory.h header file.]) 403 # 404 AC_COMPILE_IFELSE([ 405 AC_LANG_PROGRAM([[ 406#include <stdlib.h> 407 ]],[[ 408 void *p = malloc(10); 409 void *q = calloc(10,10); 410 free(p); 411 free(q); 412 ]]) 413 ],[ 414 curl_cv_need_header_memory_h="no" 415 ],[ 416 curl_cv_need_header_memory_h="yes" 417 ]) 418 # 419 case "$curl_cv_need_header_memory_h" in 420 yes) 421 AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1, 422 [Define to 1 if you need the memory.h header file even with stdlib.h]) 423 ;; 424 esac 425 fi 426]) 427 428 429dnl CURL_CHECK_FUNC_GETNAMEINFO 430dnl ------------------------------------------------- 431dnl Test if the getnameinfo function is available, 432dnl and check the types of five of its arguments. 433dnl If the function succeeds HAVE_GETNAMEINFO will be 434dnl defined, defining the types of the arguments in 435dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2, 436dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7, 437dnl and also defining the type qualifier of first 438dnl argument in GETNAMEINFO_QUAL_ARG1. 439 440AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ 441 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl 442 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) 443 # 444 AC_MSG_CHECKING([for getnameinfo]) 445 AC_LINK_IFELSE([ 446 AC_LANG_FUNC_LINK_TRY([getnameinfo]) 447 ],[ 448 AC_MSG_RESULT([yes]) 449 curl_cv_getnameinfo="yes" 450 ],[ 451 AC_MSG_RESULT([no]) 452 curl_cv_getnameinfo="no" 453 ]) 454 # 455 if test "$curl_cv_getnameinfo" != "yes"; then 456 AC_MSG_CHECKING([deeper for getnameinfo]) 457 AC_LINK_IFELSE([ 458 AC_LANG_PROGRAM([[ 459 ]],[[ 460 getnameinfo(); 461 ]]) 462 ],[ 463 AC_MSG_RESULT([yes]) 464 curl_cv_getnameinfo="yes" 465 ],[ 466 AC_MSG_RESULT([but still no]) 467 curl_cv_getnameinfo="no" 468 ]) 469 fi 470 # 471 if test "$curl_cv_getnameinfo" != "yes"; then 472 AC_MSG_CHECKING([deeper and deeper for getnameinfo]) 473 AC_LINK_IFELSE([ 474 AC_LANG_PROGRAM([[ 475#undef inline 476#ifdef HAVE_WINDOWS_H 477#ifndef WIN32_LEAN_AND_MEAN 478#define WIN32_LEAN_AND_MEAN 479#endif 480#include <windows.h> 481#ifdef HAVE_WINSOCK2_H 482#include <winsock2.h> 483#ifdef HAVE_WS2TCPIP_H 484#include <ws2tcpip.h> 485#endif 486#endif 487#else 488#ifdef HAVE_SYS_TYPES_H 489#include <sys/types.h> 490#endif 491#ifdef HAVE_SYS_SOCKET_H 492#include <sys/socket.h> 493#endif 494#ifdef HAVE_NETDB_H 495#include <netdb.h> 496#endif 497#endif 498 ]],[[ 499 getnameinfo(0, 0, 0, 0, 0, 0, 0); 500 ]]) 501 ],[ 502 AC_MSG_RESULT([yes]) 503 curl_cv_getnameinfo="yes" 504 ],[ 505 AC_MSG_RESULT([but still no]) 506 curl_cv_getnameinfo="no" 507 ]) 508 fi 509 # 510 if test "$curl_cv_getnameinfo" = "yes"; then 511 AC_CACHE_CHECK([types of arguments for getnameinfo], 512 [curl_cv_func_getnameinfo_args], [ 513 curl_cv_func_getnameinfo_args="unknown" 514 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do 515 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do 516 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do 517 for gni_arg7 in 'int' 'unsigned int'; do 518 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then 519 AC_COMPILE_IFELSE([ 520 AC_LANG_PROGRAM([[ 521#undef inline 522#ifdef HAVE_WINDOWS_H 523#ifndef WIN32_LEAN_AND_MEAN 524#define WIN32_LEAN_AND_MEAN 525#endif 526#if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) 527#undef _WIN32_WINNT 528#define _WIN32_WINNT 0x0501 529#endif 530#include <windows.h> 531#ifdef HAVE_WINSOCK2_H 532#include <winsock2.h> 533#ifdef HAVE_WS2TCPIP_H 534#include <ws2tcpip.h> 535#endif 536#endif 537#define GNICALLCONV WSAAPI 538#else 539#ifdef HAVE_SYS_TYPES_H 540#include <sys/types.h> 541#endif 542#ifdef HAVE_SYS_SOCKET_H 543#include <sys/socket.h> 544#endif 545#ifdef HAVE_NETDB_H 546#include <netdb.h> 547#endif 548#define GNICALLCONV 549#endif 550 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2, 551 char *, $gni_arg46, 552 char *, $gni_arg46, 553 $gni_arg7); 554 ]],[[ 555 $gni_arg2 salen=0; 556 $gni_arg46 hostlen=0; 557 $gni_arg46 servlen=0; 558 $gni_arg7 flags=0; 559 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); 560 ]]) 561 ],[ 562 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" 563 ]) 564 fi 565 done 566 done 567 done 568 done 569 ]) # AC-CACHE-CHECK 570 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then 571 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args]) 572 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined]) 573 else 574 gni_prev_IFS=$IFS; IFS=',' 575 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` 576 IFS=$gni_prev_IFS 577 shift 578 # 579 gni_qual_type_arg1=$[1] 580 # 581 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2], 582 [Define to the type of arg 2 for getnameinfo.]) 583 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3], 584 [Define to the type of args 4 and 6 for getnameinfo.]) 585 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4], 586 [Define to the type of arg 7 for getnameinfo.]) 587 # 588 prev_sh_opts=$- 589 # 590 case $prev_sh_opts in 591 *f*) 592 ;; 593 *) 594 set -f 595 ;; 596 esac 597 # 598 case "$gni_qual_type_arg1" in 599 const*) 600 gni_qual_arg1=const 601 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'` 602 ;; 603 *) 604 gni_qual_arg1= 605 gni_type_arg1=$gni_qual_type_arg1 606 ;; 607 esac 608 # 609 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1, 610 [Define to the type qualifier of arg 1 for getnameinfo.]) 611 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1, 612 [Define to the type of arg 1 for getnameinfo.]) 613 # 614 case $prev_sh_opts in 615 *f*) 616 ;; 617 *) 618 set +f 619 ;; 620 esac 621 # 622 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1, 623 [Define to 1 if you have the getnameinfo function.]) 624 ac_cv_func_getnameinfo="yes" 625 fi 626 fi 627]) 628 629 630dnl TYPE_SOCKADDR_STORAGE 631dnl ------------------------------------------------- 632dnl Check for struct sockaddr_storage. Most IPv6-enabled 633dnl hosts have it, but AIX 4.3 is one known exception. 634 635AC_DEFUN([TYPE_SOCKADDR_STORAGE], 636[ 637 AC_CHECK_TYPE([struct sockaddr_storage], 638 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1, 639 [if struct sockaddr_storage is defined]), , 640 [ 641#undef inline 642#ifdef HAVE_WINDOWS_H 643#ifndef WIN32_LEAN_AND_MEAN 644#define WIN32_LEAN_AND_MEAN 645#endif 646#include <windows.h> 647#ifdef HAVE_WINSOCK2_H 648#include <winsock2.h> 649#endif 650#else 651#ifdef HAVE_SYS_TYPES_H 652#include <sys/types.h> 653#endif 654#ifdef HAVE_SYS_SOCKET_H 655#include <sys/socket.h> 656#endif 657#ifdef HAVE_NETINET_IN_H 658#include <netinet/in.h> 659#endif 660#ifdef HAVE_ARPA_INET_H 661#include <arpa/inet.h> 662#endif 663#endif 664 ]) 665]) 666 667 668dnl CURL_CHECK_NI_WITHSCOPEID 669dnl ------------------------------------------------- 670dnl Check for working NI_WITHSCOPEID in getnameinfo() 671 672AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [ 673 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl 674 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl 675 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \ 676 netdb.h netinet/in.h arpa/inet.h) 677 # 678 AC_CACHE_CHECK([for working NI_WITHSCOPEID], 679 [ac_cv_working_ni_withscopeid], [ 680 AC_RUN_IFELSE([ 681 AC_LANG_PROGRAM([[ 682#ifdef HAVE_STDLIB_H 683#include <stdlib.h> 684#endif 685#ifdef HAVE_STDIO_H 686#include <stdio.h> 687#endif 688#ifdef HAVE_SYS_TYPES_H 689#include <sys/types.h> 690#endif 691#ifdef HAVE_SYS_SOCKET_H 692#include <sys/socket.h> 693#endif 694#ifdef HAVE_NETDB_H 695#include <netdb.h> 696#endif 697#ifdef HAVE_NETINET_IN_H 698#include <netinet/in.h> 699#endif 700#ifdef HAVE_ARPA_INET_H 701#include <arpa/inet.h> 702#endif 703 ]],[[ 704#if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO) 705#ifdef HAVE_STRUCT_SOCKADDR_STORAGE 706 struct sockaddr_storage sa; 707#else 708 unsigned char sa[256]; 709#endif 710 char hostbuf[NI_MAXHOST]; 711 int rc; 712 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa); 713 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf); 714 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; 715 int fd = socket(AF_INET6, SOCK_STREAM, 0); 716 if(fd < 0) { 717 perror("socket()"); 718 return 1; /* Error creating socket */ 719 } 720 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen); 721 if(rc) { 722 perror("getsockname()"); 723 return 2; /* Error retrieving socket name */ 724 } 725 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags); 726 if(rc) { 727 printf("rc = %s\n", gai_strerror(rc)); 728 return 3; /* Error translating socket address */ 729 } 730 return 0; /* Ok, NI_WITHSCOPEID works */ 731#else 732 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */ 733#endif 734 ]]) # AC-LANG-PROGRAM 735 ],[ 736 # Exit code == 0. Program worked. 737 ac_cv_working_ni_withscopeid="yes" 738 ],[ 739 # Exit code != 0. Program failed. 740 ac_cv_working_ni_withscopeid="no" 741 ],[ 742 # Program is not run when cross-compiling. So we assume 743 # NI_WITHSCOPEID will work if we are able to compile it. 744 AC_COMPILE_IFELSE([ 745 AC_LANG_PROGRAM([[ 746#include <sys/types.h> 747#include <sys/socket.h> 748#include <netdb.h> 749 ]],[[ 750 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID; 751 ]]) 752 ],[ 753 ac_cv_working_ni_withscopeid="yes" 754 ],[ 755 ac_cv_working_ni_withscopeid="no" 756 ]) # AC-COMPILE-IFELSE 757 ]) # AC-RUN-IFELSE 758 ]) # AC-CACHE-CHECK 759 case "$ac_cv_working_ni_withscopeid" in 760 yes) 761 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1, 762 [Define to 1 if NI_WITHSCOPEID exists and works.]) 763 ;; 764 esac 765]) 766 767 768dnl CURL_CHECK_FUNC_RECV 769dnl ------------------------------------------------- 770dnl Test if the socket recv() function is available, 771dnl and check its return type and the types of its 772dnl arguments. If the function succeeds HAVE_RECV 773dnl will be defined, defining the types of the arguments 774dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3 775dnl and RECV_TYPE_ARG4, defining the type of the function 776dnl return value in RECV_TYPE_RETV. 777 778AC_DEFUN([CURL_CHECK_FUNC_RECV], [ 779 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl 780 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl 781 AC_CHECK_HEADERS(sys/types.h sys/socket.h) 782 # 783 AC_MSG_CHECKING([for recv]) 784 AC_LINK_IFELSE([ 785 AC_LANG_PROGRAM([[ 786#undef inline 787#ifdef HAVE_WINDOWS_H 788#ifndef WIN32_LEAN_AND_MEAN 789#define WIN32_LEAN_AND_MEAN 790#endif 791#include <windows.h> 792#ifdef HAVE_WINSOCK2_H 793#include <winsock2.h> 794#else 795#ifdef HAVE_WINSOCK_H 796#include <winsock.h> 797#endif 798#endif 799#else 800#ifdef HAVE_SYS_TYPES_H 801#include <sys/types.h> 802#endif 803#ifdef HAVE_SYS_SOCKET_H 804#include <sys/socket.h> 805#endif 806#endif 807 ]],[[ 808 recv(0, 0, 0, 0); 809 ]]) 810 ],[ 811 AC_MSG_RESULT([yes]) 812 curl_cv_recv="yes" 813 ],[ 814 AC_MSG_RESULT([no]) 815 curl_cv_recv="no" 816 ]) 817 # 818 if test "$curl_cv_recv" = "yes"; then 819 AC_CACHE_CHECK([types of args and return type for recv], 820 [curl_cv_func_recv_args], [ 821 curl_cv_func_recv_args="unknown" 822 for recv_retv in 'int' 'ssize_t'; do 823 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do 824 for recv_arg2 in 'char *' 'void *'; do 825 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do 826 for recv_arg4 in 'int' 'unsigned int'; do 827 if test "$curl_cv_func_recv_args" = "unknown"; then 828 AC_COMPILE_IFELSE([ 829 AC_LANG_PROGRAM([[ 830#undef inline 831#ifdef HAVE_WINDOWS_H 832#ifndef WIN32_LEAN_AND_MEAN 833#define WIN32_LEAN_AND_MEAN 834#endif 835#include <windows.h> 836#ifdef HAVE_WINSOCK2_H 837#include <winsock2.h> 838#else 839#ifdef HAVE_WINSOCK_H 840#include <winsock.h> 841#endif 842#endif 843#define RECVCALLCONV PASCAL 844#else 845#ifdef HAVE_SYS_TYPES_H 846#include <sys/types.h> 847#endif 848#ifdef HAVE_SYS_SOCKET_H 849#include <sys/socket.h> 850#endif 851#define RECVCALLCONV 852#endif 853 extern $recv_retv RECVCALLCONV 854 recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4); 855 ]],[[ 856 $recv_arg1 s=0; 857 $recv_arg2 buf=0; 858 $recv_arg3 len=0; 859 $recv_arg4 flags=0; 860 $recv_retv res = recv(s, buf, len, flags); 861 ]]) 862 ],[ 863 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv" 864 ]) 865 fi 866 done 867 done 868 done 869 done 870 done 871 ]) # AC-CACHE-CHECK 872 if test "$curl_cv_func_recv_args" = "unknown"; then 873 AC_MSG_ERROR([Cannot find proper types to use for recv args]) 874 else 875 recv_prev_IFS=$IFS; IFS=',' 876 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'` 877 IFS=$recv_prev_IFS 878 shift 879 # 880 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1], 881 [Define to the type of arg 1 for recv.]) 882 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2], 883 [Define to the type of arg 2 for recv.]) 884 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3], 885 [Define to the type of arg 3 for recv.]) 886 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4], 887 [Define to the type of arg 4 for recv.]) 888 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5], 889 [Define to the function return type for recv.]) 890 # 891 AC_DEFINE_UNQUOTED(HAVE_RECV, 1, 892 [Define to 1 if you have the recv function.]) 893 ac_cv_func_recv="yes" 894 fi 895 else 896 AC_MSG_ERROR([Unable to link function recv]) 897 fi 898]) 899 900 901dnl CURL_CHECK_FUNC_SEND 902dnl ------------------------------------------------- 903dnl Test if the socket send() function is available, 904dnl and check its return type and the types of its 905dnl arguments. If the function succeeds HAVE_SEND 906dnl will be defined, defining the types of the arguments 907dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3 908dnl and SEND_TYPE_ARG4, defining the type of the function 909dnl return value in SEND_TYPE_RETV, and also defining the 910dnl type qualifier of second argument in SEND_QUAL_ARG2. 911 912AC_DEFUN([CURL_CHECK_FUNC_SEND], [ 913 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl 914 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl 915 AC_CHECK_HEADERS(sys/types.h sys/socket.h) 916 # 917 AC_MSG_CHECKING([for send]) 918 AC_LINK_IFELSE([ 919 AC_LANG_PROGRAM([[ 920#undef inline 921#ifdef HAVE_WINDOWS_H 922#ifndef WIN32_LEAN_AND_MEAN 923#define WIN32_LEAN_AND_MEAN 924#endif 925#include <windows.h> 926#ifdef HAVE_WINSOCK2_H 927#include <winsock2.h> 928#else 929#ifdef HAVE_WINSOCK_H 930#include <winsock.h> 931#endif 932#endif 933#else 934#ifdef HAVE_SYS_TYPES_H 935#include <sys/types.h> 936#endif 937#ifdef HAVE_SYS_SOCKET_H 938#include <sys/socket.h> 939#endif 940#endif 941 ]],[[ 942 send(0, 0, 0, 0); 943 ]]) 944 ],[ 945 AC_MSG_RESULT([yes]) 946 curl_cv_send="yes" 947 ],[ 948 AC_MSG_RESULT([no]) 949 curl_cv_send="no" 950 ]) 951 # 952 if test "$curl_cv_send" = "yes"; then 953 AC_CACHE_CHECK([types of args and return type for send], 954 [curl_cv_func_send_args], [ 955 curl_cv_func_send_args="unknown" 956 for send_retv in 'int' 'ssize_t'; do 957 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do 958 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do 959 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do 960 for send_arg4 in 'int' 'unsigned int'; do 961 if test "$curl_cv_func_send_args" = "unknown"; then 962 AC_COMPILE_IFELSE([ 963 AC_LANG_PROGRAM([[ 964#undef inline 965#ifdef HAVE_WINDOWS_H 966#ifndef WIN32_LEAN_AND_MEAN 967#define WIN32_LEAN_AND_MEAN 968#endif 969#include <windows.h> 970#ifdef HAVE_WINSOCK2_H 971#include <winsock2.h> 972#else 973#ifdef HAVE_WINSOCK_H 974#include <winsock.h> 975#endif 976#endif 977#define SENDCALLCONV PASCAL 978#else 979#ifdef HAVE_SYS_TYPES_H 980#include <sys/types.h> 981#endif 982#ifdef HAVE_SYS_SOCKET_H 983#include <sys/socket.h> 984#endif 985#define SENDCALLCONV 986#endif 987 extern $send_retv SENDCALLCONV 988 send($send_arg1, $send_arg2, $send_arg3, $send_arg4); 989 ]],[[ 990 $send_arg1 s=0; 991 $send_arg3 len=0; 992 $send_arg4 flags=0; 993 $send_retv res = send(s, 0, len, flags); 994 ]]) 995 ],[ 996 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv" 997 ]) 998 fi 999 done 1000 done 1001 done 1002 done 1003 done 1004 ]) # AC-CACHE-CHECK 1005 if test "$curl_cv_func_send_args" = "unknown"; then 1006 AC_MSG_ERROR([Cannot find proper types to use for send args]) 1007 else 1008 send_prev_IFS=$IFS; IFS=',' 1009 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'` 1010 IFS=$send_prev_IFS 1011 shift 1012 # 1013 send_qual_type_arg2=$[2] 1014 # 1015 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1], 1016 [Define to the type of arg 1 for send.]) 1017 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3], 1018 [Define to the type of arg 3 for send.]) 1019 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4], 1020 [Define to the type of arg 4 for send.]) 1021 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5], 1022 [Define to the function return type for send.]) 1023 # 1024 prev_sh_opts=$- 1025 # 1026 case $prev_sh_opts in 1027 *f*) 1028 ;; 1029 *) 1030 set -f 1031 ;; 1032 esac 1033 # 1034 case "$send_qual_type_arg2" in 1035 const*) 1036 send_qual_arg2=const 1037 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'` 1038 ;; 1039 *) 1040 send_qual_arg2= 1041 send_type_arg2=$send_qual_type_arg2 1042 ;; 1043 esac 1044 # 1045 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2, 1046 [Define to the type qualifier of arg 2 for send.]) 1047 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2, 1048 [Define to the type of arg 2 for send.]) 1049 # 1050 case $prev_sh_opts in 1051 *f*) 1052 ;; 1053 *) 1054 set +f 1055 ;; 1056 esac 1057 # 1058 AC_DEFINE_UNQUOTED(HAVE_SEND, 1, 1059 [Define to 1 if you have the send function.]) 1060 ac_cv_func_send="yes" 1061 fi 1062 else 1063 AC_MSG_ERROR([Unable to link function send]) 1064 fi 1065]) 1066 1067 1068dnl CURL_CHECK_FUNC_RECVFROM 1069dnl ------------------------------------------------- 1070dnl Test if the socket recvfrom() function is available, 1071dnl and check its return type and the types of its 1072dnl arguments. If the function succeeds HAVE_RECVFROM 1073dnl will be defined, defining the types of the arguments 1074dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on 1075dnl to RECVFROM_TYPE_ARG6, defining also the type of the 1076dnl function return value in RECVFROM_TYPE_RETV. 1077dnl Notice that the types returned for pointer arguments 1078dnl will actually be the type pointed by the pointer. 1079 1080AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [ 1081 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl 1082 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl 1083 AC_CHECK_HEADERS(sys/types.h sys/socket.h) 1084 # 1085 AC_MSG_CHECKING([for recvfrom]) 1086 AC_LINK_IFELSE([ 1087 AC_LANG_PROGRAM([[ 1088#undef inline 1089#ifdef HAVE_WINDOWS_H 1090#ifndef WIN32_LEAN_AND_MEAN 1091#define WIN32_LEAN_AND_MEAN 1092#endif 1093#include <windows.h> 1094#ifdef HAVE_WINSOCK2_H 1095#include <winsock2.h> 1096#else 1097#ifdef HAVE_WINSOCK_H 1098#include <winsock.h> 1099#endif 1100#endif 1101#else 1102#ifdef HAVE_SYS_TYPES_H 1103#include <sys/types.h> 1104#endif 1105#ifdef HAVE_SYS_SOCKET_H 1106#include <sys/socket.h> 1107#endif 1108#endif 1109 ]],[[ 1110 recvfrom(0, 0, 0, 0, 0, 0); 1111 ]]) 1112 ],[ 1113 AC_MSG_RESULT([yes]) 1114 curl_cv_recvfrom="yes" 1115 ],[ 1116 AC_MSG_RESULT([no]) 1117 curl_cv_recvfrom="no" 1118 ]) 1119 # 1120 if test "$curl_cv_recvfrom" = "yes"; then 1121 AC_CACHE_CHECK([types of args and return type for recvfrom], 1122 [curl_cv_func_recvfrom_args], [ 1123 curl_cv_func_recvfrom_args="unknown" 1124 for recvfrom_retv in 'int' 'ssize_t'; do 1125 for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do 1126 for recvfrom_arg2 in 'char *' 'void *'; do 1127 for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do 1128 for recvfrom_arg4 in 'int' 'unsigned int'; do 1129 for recvfrom_arg5 in 'struct sockaddr *' 'void *' 'const struct sockaddr *'; do 1130 for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do 1131 if test "$curl_cv_func_recvfrom_args" = "unknown"; then 1132 AC_COMPILE_IFELSE([ 1133 AC_LANG_PROGRAM([[ 1134#undef inline 1135#ifdef HAVE_WINDOWS_H 1136#ifndef WIN32_LEAN_AND_MEAN 1137#define WIN32_LEAN_AND_MEAN 1138#endif 1139#include <windows.h> 1140#ifdef HAVE_WINSOCK2_H 1141#include <winsock2.h> 1142#else 1143#ifdef HAVE_WINSOCK_H 1144#include <winsock.h> 1145#endif 1146#endif 1147#define RECVFROMCALLCONV PASCAL 1148#else 1149#ifdef HAVE_SYS_TYPES_H 1150#include <sys/types.h> 1151#endif 1152#ifdef HAVE_SYS_SOCKET_H 1153#include <sys/socket.h> 1154#endif 1155#define RECVFROMCALLCONV 1156#endif 1157 extern $recvfrom_retv RECVFROMCALLCONV 1158 recvfrom($recvfrom_arg1, $recvfrom_arg2, 1159 $recvfrom_arg3, $recvfrom_arg4, 1160 $recvfrom_arg5, $recvfrom_arg6); 1161 ]],[[ 1162 $recvfrom_arg1 s=0; 1163 $recvfrom_arg2 buf=0; 1164 $recvfrom_arg3 len=0; 1165 $recvfrom_arg4 flags=0; 1166 $recvfrom_arg5 addr=0; 1167 $recvfrom_arg6 addrlen=0; 1168 $recvfrom_retv res=0; 1169 res = recvfrom(s, buf, len, flags, addr, addrlen); 1170 ]]) 1171 ],[ 1172 curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv" 1173 ]) 1174 fi 1175 done 1176 done 1177 done 1178 done 1179 done 1180 done 1181 done 1182 ]) # AC-CACHE-CHECK 1183 # Nearly last minute change for this release starts here 1184 AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1, 1185 [Define to 1 if you have the recvfrom function.]) 1186 ac_cv_func_recvfrom="yes" 1187 # Nearly last minute change for this release ends here 1188 if test "$curl_cv_func_recvfrom_args" = "unknown"; then 1189 AC_MSG_WARN([Cannot find proper types to use for recvfrom args]) 1190 else 1191 recvfrom_prev_IFS=$IFS; IFS=',' 1192 set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'` 1193 IFS=$recvfrom_prev_IFS 1194 shift 1195 # 1196 recvfrom_ptrt_arg2=$[2] 1197 recvfrom_qual_ptrt_arg5=$[5] 1198 recvfrom_ptrt_arg6=$[6] 1199 # 1200 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1], 1201 [Define to the type of arg 1 for recvfrom.]) 1202 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3], 1203 [Define to the type of arg 3 for recvfrom.]) 1204 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4], 1205 [Define to the type of arg 4 for recvfrom.]) 1206 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7], 1207 [Define to the function return type for recvfrom.]) 1208 # 1209 prev_sh_opts=$- 1210 # 1211 case $prev_sh_opts in 1212 *f*) 1213 ;; 1214 *) 1215 set -f 1216 ;; 1217 esac 1218 # 1219 case "$recvfrom_qual_ptrt_arg5" in 1220 const*) 1221 recvfrom_qual_arg5=const 1222 recvfrom_ptrt_arg5=`echo $recvfrom_qual_ptrt_arg5 | sed 's/^const //'` 1223 ;; 1224 *) 1225 recvfrom_qual_arg5= 1226 recvfrom_ptrt_arg5=$recvfrom_qual_ptrt_arg5 1227 ;; 1228 esac 1229 # 1230 recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'` 1231 recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'` 1232 recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'` 1233 # 1234 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2, 1235 [Define to the type pointed by arg 2 for recvfrom.]) 1236 AC_DEFINE_UNQUOTED(RECVFROM_QUAL_ARG5, $recvfrom_qual_arg5, 1237 [Define to the type qualifier pointed by arg 5 for recvfrom.]) 1238 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5, 1239 [Define to the type pointed by arg 5 for recvfrom.]) 1240 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6, 1241 [Define to the type pointed by arg 6 for recvfrom.]) 1242 # 1243 if test "$recvfrom_type_arg2" = "void"; then 1244 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1, 1245 [Define to 1 if the type pointed by arg 2 for recvfrom is void.]) 1246 fi 1247 if test "$recvfrom_type_arg5" = "void"; then 1248 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1, 1249 [Define to 1 if the type pointed by arg 5 for recvfrom is void.]) 1250 fi 1251 if test "$recvfrom_type_arg6" = "void"; then 1252 AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1, 1253 [Define to 1 if the type pointed by arg 6 for recvfrom is void.]) 1254 fi 1255 # 1256 case $prev_sh_opts in 1257 *f*) 1258 ;; 1259 *) 1260 set +f 1261 ;; 1262 esac 1263 # 1264 AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1, 1265 [Define to 1 if you have the recvfrom function.]) 1266 ac_cv_func_recvfrom="yes" 1267 fi 1268 else 1269 AC_MSG_WARN([Unable to link function recvfrom]) 1270 AC_MSG_WARN([Your system will be vulnerable to some forms of DNS cache poisoning]) 1271 fi 1272]) 1273 1274 1275dnl CURL_CHECK_MSG_NOSIGNAL 1276dnl ------------------------------------------------- 1277dnl Check for MSG_NOSIGNAL 1278 1279AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [ 1280 AC_CHECK_HEADERS(sys/types.h sys/socket.h) 1281 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [ 1282 AC_COMPILE_IFELSE([ 1283 AC_LANG_PROGRAM([[ 1284#undef inline 1285#ifdef HAVE_WINDOWS_H 1286#ifndef WIN32_LEAN_AND_MEAN 1287#define WIN32_LEAN_AND_MEAN 1288#endif 1289#include <windows.h> 1290#ifdef HAVE_WINSOCK2_H 1291#include <winsock2.h> 1292#else 1293#ifdef HAVE_WINSOCK_H 1294#include <winsock.h> 1295#endif 1296#endif 1297#else 1298#ifdef HAVE_SYS_TYPES_H 1299#include <sys/types.h> 1300#endif 1301#ifdef HAVE_SYS_SOCKET_H 1302#include <sys/socket.h> 1303#endif 1304#endif 1305 ]],[[ 1306 int flag=MSG_NOSIGNAL; 1307 ]]) 1308 ],[ 1309 ac_cv_msg_nosignal="yes" 1310 ],[ 1311 ac_cv_msg_nosignal="no" 1312 ]) 1313 ]) 1314 case "$ac_cv_msg_nosignal" in 1315 yes) 1316 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1, 1317 [Define to 1 if you have the MSG_NOSIGNAL flag.]) 1318 ;; 1319 esac 1320]) 1321 1322 1323dnl CURL_CHECK_STRUCT_TIMEVAL 1324dnl ------------------------------------------------- 1325dnl Check for timeval struct 1326 1327AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ 1328 AC_REQUIRE([AC_HEADER_TIME])dnl 1329 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl 1330 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl 1331 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h) 1332 AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [ 1333 AC_COMPILE_IFELSE([ 1334 AC_LANG_PROGRAM([[ 1335#undef inline 1336#ifdef HAVE_WINDOWS_H 1337#ifndef WIN32_LEAN_AND_MEAN 1338#define WIN32_LEAN_AND_MEAN 1339#endif 1340#include <windows.h> 1341#ifdef HAVE_WINSOCK2_H 1342#include <winsock2.h> 1343#else 1344#ifdef HAVE_WINSOCK_H 1345#include <winsock.h> 1346#endif 1347#endif 1348#endif 1349#ifdef HAVE_SYS_TYPES_H 1350#include <sys/types.h> 1351#endif 1352#ifdef HAVE_SYS_TIME_H 1353#include <sys/time.h> 1354#ifdef TIME_WITH_SYS_TIME 1355#include <time.h> 1356#endif 1357#else 1358#ifdef HAVE_TIME_H 1359#include <time.h> 1360#endif 1361#endif 1362#ifdef HAVE_SYS_SOCKET_H 1363#include <sys/socket.h> 1364#endif 1365 ]],[[ 1366 struct timeval ts; 1367 ts.tv_sec = 0; 1368 ts.tv_usec = 0; 1369 ]]) 1370 ],[ 1371 ac_cv_struct_timeval="yes" 1372 ],[ 1373 ac_cv_struct_timeval="no" 1374 ]) 1375 ]) 1376 case "$ac_cv_struct_timeval" in 1377 yes) 1378 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1, 1379 [Define to 1 if you have the timeval struct.]) 1380 ;; 1381 esac 1382]) 1383 1384 1385dnl TYPE_SIG_ATOMIC_T 1386dnl ------------------------------------------------- 1387dnl Check if the sig_atomic_t type is available, and 1388dnl verify if it is already defined as volatile. 1389 1390AC_DEFUN([TYPE_SIG_ATOMIC_T], [ 1391 AC_CHECK_HEADERS(signal.h) 1392 AC_CHECK_TYPE([sig_atomic_t],[ 1393 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1, 1394 [Define to 1 if sig_atomic_t is an available typedef.]) 1395 ], ,[ 1396#ifdef HAVE_SIGNAL_H 1397#include <signal.h> 1398#endif 1399 ]) 1400 case "$ac_cv_type_sig_atomic_t" in 1401 yes) 1402 # 1403 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile]) 1404 AC_LINK_IFELSE([ 1405 AC_LANG_PROGRAM([[ 1406#ifdef HAVE_SIGNAL_H 1407#include <signal.h> 1408#endif 1409 ]],[[ 1410 static volatile sig_atomic_t dummy = 0; 1411 ]]) 1412 ],[ 1413 AC_MSG_RESULT([no]) 1414 ac_cv_sig_atomic_t_volatile="no" 1415 ],[ 1416 AC_MSG_RESULT([yes]) 1417 ac_cv_sig_atomic_t_volatile="yes" 1418 ]) 1419 # 1420 if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then 1421 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1, 1422 [Define to 1 if sig_atomic_t is already defined as volatile.]) 1423 fi 1424 ;; 1425 esac 1426]) 1427 1428 1429dnl TYPE_IN_ADDR_T 1430dnl ------------------------------------------------- 1431dnl Check for in_addr_t: it is used to receive the return code of inet_addr() 1432dnl and a few other things. 1433 1434AC_DEFUN([TYPE_IN_ADDR_T], [ 1435 AC_CHECK_TYPE([in_addr_t], ,[ 1436 dnl in_addr_t not available 1437 AC_CACHE_CHECK([for in_addr_t equivalent], 1438 [curl_cv_in_addr_t_equiv], [ 1439 curl_cv_in_addr_t_equiv="unknown" 1440 for t in "unsigned long" int size_t unsigned long; do 1441 if test "$curl_cv_in_addr_t_equiv" = "unknown"; then 1442 AC_LINK_IFELSE([ 1443 AC_LANG_PROGRAM([[ 1444#undef inline 1445#ifdef HAVE_WINDOWS_H 1446#ifndef WIN32_LEAN_AND_MEAN 1447#define WIN32_LEAN_AND_MEAN 1448#endif 1449#include <windows.h> 1450#ifdef HAVE_WINSOCK2_H 1451#include <winsock2.h> 1452#else 1453#ifdef HAVE_WINSOCK_H 1454#include <winsock.h> 1455#endif 1456#endif 1457#else 1458#ifdef HAVE_SYS_TYPES_H 1459#include <sys/types.h> 1460#endif 1461#ifdef HAVE_SYS_SOCKET_H 1462#include <sys/socket.h> 1463#endif 1464#ifdef HAVE_NETINET_IN_H 1465#include <netinet/in.h> 1466#endif 1467#ifdef HAVE_ARPA_INET_H 1468#include <arpa/inet.h> 1469#endif 1470#endif 1471 ]],[[ 1472 $t data = inet_addr ("1.2.3.4"); 1473 ]]) 1474 ],[ 1475 curl_cv_in_addr_t_equiv="$t" 1476 ]) 1477 fi 1478 done 1479 ]) 1480 case "$curl_cv_in_addr_t_equiv" in 1481 unknown) 1482 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t]) 1483 ;; 1484 *) 1485 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv, 1486 [Type to use in place of in_addr_t when system does not provide it.]) 1487 ;; 1488 esac 1489 ],[ 1490#undef inline 1491#ifdef HAVE_WINDOWS_H 1492#ifndef WIN32_LEAN_AND_MEAN 1493#define WIN32_LEAN_AND_MEAN 1494#endif 1495#include <windows.h> 1496#ifdef HAVE_WINSOCK2_H 1497#include <winsock2.h> 1498#else 1499#ifdef HAVE_WINSOCK_H 1500#include <winsock.h> 1501#endif 1502#endif 1503#else 1504#ifdef HAVE_SYS_TYPES_H 1505#include <sys/types.h> 1506#endif 1507#ifdef HAVE_SYS_SOCKET_H 1508#include <sys/socket.h> 1509#endif 1510#ifdef HAVE_NETINET_IN_H 1511#include <netinet/in.h> 1512#endif 1513#ifdef HAVE_ARPA_INET_H 1514#include <arpa/inet.h> 1515#endif 1516#endif 1517 ]) 1518]) 1519 1520 1521dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC 1522dnl ------------------------------------------------- 1523dnl Check if monotonic clock_gettime is available. 1524 1525AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [ 1526 AC_REQUIRE([AC_HEADER_TIME])dnl 1527 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h) 1528 AC_MSG_CHECKING([for monotonic clock_gettime]) 1529 AC_COMPILE_IFELSE([ 1530 AC_LANG_PROGRAM([[ 1531#ifdef HAVE_SYS_TYPES_H 1532#include <sys/types.h> 1533#endif 1534#ifdef HAVE_SYS_TIME_H 1535#include <sys/time.h> 1536#ifdef TIME_WITH_SYS_TIME 1537#include <time.h> 1538#endif 1539#else 1540#ifdef HAVE_TIME_H 1541#include <time.h> 1542#endif 1543#endif 1544 ]],[[ 1545 struct timespec ts; 1546 (void)clock_gettime(CLOCK_MONOTONIC, &ts); 1547 ]]) 1548 ],[ 1549 AC_MSG_RESULT([yes]) 1550 ac_cv_func_clock_gettime="yes" 1551 ],[ 1552 AC_MSG_RESULT([no]) 1553 ac_cv_func_clock_gettime="no" 1554 ]) 1555 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed 1556 dnl until library linking and run-time checks for clock_gettime succeed. 1557]) 1558 1559 1560dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC 1561dnl ------------------------------------------------- 1562dnl If monotonic clock_gettime is available then, 1563dnl check and prepended to LIBS any needed libraries. 1564 1565AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ 1566 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl 1567 # 1568 if test "$ac_cv_func_clock_gettime" = "yes"; then 1569 # 1570 AC_MSG_CHECKING([for clock_gettime in libraries]) 1571 # 1572 curl_cv_save_LIBS="$LIBS" 1573 curl_cv_gclk_LIBS="unknown" 1574 # 1575 for x_xlibs in '' '-lrt' '-lposix4' ; do 1576 if test "$curl_cv_gclk_LIBS" = "unknown"; then 1577 if test -z "$x_xlibs"; then 1578 LIBS="$curl_cv_save_LIBS" 1579 else 1580 LIBS="$x_xlibs $curl_cv_save_LIBS" 1581 fi 1582 AC_LINK_IFELSE([ 1583 AC_LANG_PROGRAM([[ 1584#ifdef HAVE_SYS_TYPES_H 1585#include <sys/types.h> 1586#endif 1587#ifdef HAVE_SYS_TIME_H 1588#include <sys/time.h> 1589#ifdef TIME_WITH_SYS_TIME 1590#include <time.h> 1591#endif 1592#else 1593#ifdef HAVE_TIME_H 1594#include <time.h> 1595#endif 1596#endif 1597 ]],[[ 1598 struct timespec ts; 1599 (void)clock_gettime(CLOCK_MONOTONIC, &ts); 1600 ]]) 1601 ],[ 1602 curl_cv_gclk_LIBS="$x_xlibs" 1603 ]) 1604 fi 1605 done 1606 # 1607 LIBS="$curl_cv_save_LIBS" 1608 # 1609 case X-"$curl_cv_gclk_LIBS" in 1610 X-unknown) 1611 AC_MSG_RESULT([cannot find clock_gettime]) 1612 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined]) 1613 ac_cv_func_clock_gettime="no" 1614 ;; 1615 X-) 1616 AC_MSG_RESULT([no additional lib required]) 1617 ac_cv_func_clock_gettime="yes" 1618 ;; 1619 *) 1620 if test -z "$curl_cv_save_LIBS"; then 1621 LIBS="$curl_cv_gclk_LIBS" 1622 else 1623 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS" 1624 fi 1625 AC_MSG_RESULT([$curl_cv_gclk_LIBS]) 1626 ac_cv_func_clock_gettime="yes" 1627 ;; 1628 esac 1629 # 1630 dnl only do runtime verification when not cross-compiling 1631 if test "x$cross_compiling" != "xyes" && 1632 test "$ac_cv_func_clock_gettime" = "yes"; then 1633 AC_MSG_CHECKING([if monotonic clock_gettime works]) 1634 AC_RUN_IFELSE([ 1635 AC_LANG_PROGRAM([[ 1636#ifdef HAVE_STDLIB_H 1637#include <stdlib.h> 1638#endif 1639#ifdef HAVE_SYS_TYPES_H 1640#include <sys/types.h> 1641#endif 1642#ifdef HAVE_SYS_TIME_H 1643#include <sys/time.h> 1644#ifdef TIME_WITH_SYS_TIME 1645#include <time.h> 1646#endif 1647#else 1648#ifdef HAVE_TIME_H 1649#include <time.h> 1650#endif 1651#endif 1652 ]],[[ 1653 struct timespec ts; 1654 if (0 == clock_gettime(CLOCK_MONOTONIC, &ts)) 1655 exit(0); 1656 else 1657 exit(1); 1658 ]]) 1659 ],[ 1660 AC_MSG_RESULT([yes]) 1661 ],[ 1662 AC_MSG_RESULT([no]) 1663 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined]) 1664 ac_cv_func_clock_gettime="no" 1665 LIBS="$curl_cv_save_LIBS" 1666 ]) 1667 fi 1668 # 1669 case "$ac_cv_func_clock_gettime" in 1670 yes) 1671 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1, 1672 [Define to 1 if you have the clock_gettime function and monotonic timer.]) 1673 ;; 1674 esac 1675 # 1676 fi 1677 # 1678]) 1679 1680 1681dnl CARES_CHECK_LIBS_CONNECT 1682dnl ------------------------------------------------- 1683dnl Verify if network connect function is already available 1684dnl using current libraries or if another one is required. 1685 1686AC_DEFUN([CARES_CHECK_LIBS_CONNECT], [ 1687 AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl 1688 AC_MSG_CHECKING([for connect in libraries]) 1689 tst_connect_save_LIBS="$LIBS" 1690 tst_connect_need_LIBS="unknown" 1691 for tst_lib in '' '-lsocket' ; do 1692 if test "$tst_connect_need_LIBS" = "unknown"; then 1693 LIBS="$tst_lib $tst_connect_save_LIBS" 1694 AC_LINK_IFELSE([ 1695 AC_LANG_PROGRAM([[ 1696 $cares_includes_winsock2 1697 #ifndef HAVE_WINDOWS_H 1698 int connect(int, void*, int); 1699 #endif 1700 ]],[[ 1701 if(0 != connect(0, 0, 0)) 1702 return 1; 1703 ]]) 1704 ],[ 1705 tst_connect_need_LIBS="$tst_lib" 1706 ]) 1707 fi 1708 done 1709 LIBS="$tst_connect_save_LIBS" 1710 # 1711 case X-"$tst_connect_need_LIBS" in 1712 X-unknown) 1713 AC_MSG_RESULT([cannot find connect]) 1714 AC_MSG_ERROR([cannot find connect function in libraries.]) 1715 ;; 1716 X-) 1717 AC_MSG_RESULT([yes]) 1718 ;; 1719 *) 1720 AC_MSG_RESULT([$tst_connect_need_LIBS]) 1721 LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" 1722 ;; 1723 esac 1724]) 1725 1726 1727dnl CARES_DEFINE_UNQUOTED (VARIABLE, [VALUE]) 1728dnl ------------------------------------------------- 1729dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor 1730dnl symbol that can be further used in custom template configuration 1731dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third 1732dnl argument for the description. Symbol definitions done with this 1733dnl macro are intended to be exclusively used in handcrafted *.h.in 1734dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one 1735dnl prevents autoheader generation and insertion of symbol template 1736dnl stub and definition into the first configuration header file. Do 1737dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each 1738dnl one serves different functional needs. 1739 1740AC_DEFUN([CARES_DEFINE_UNQUOTED], [ 1741cat >>confdefs.h <<_EOF 1742[@%:@define] $1 ifelse($#, 2, [$2], 1) 1743_EOF 1744]) 1745 1746dnl CARES_CONFIGURE_ARES_SOCKLEN_T 1747dnl ------------------------------------------------- 1748dnl Find out suitable ares_socklen_t data type definition and size, making 1749dnl appropriate definitions for template file ares_build.h.in 1750dnl to properly configure and use the library. 1751dnl 1752dnl The need for the ares_socklen_t definition arises mainly to properly 1753dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t 1754dnl data type which is 32 or 64-Bit wide depending on the data model being 1755dnl used, and that on the other hand is only actually used when interfacing 1756dnl the X/Open sockets provided in the xnet library. 1757 1758AC_DEFUN([CARES_CONFIGURE_ARES_SOCKLEN_T], [ 1759 AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl 1760 AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl 1761 AC_REQUIRE([CARES_PREPROCESS_CALLCONV])dnl 1762 # 1763 AC_MSG_CHECKING([for ares_socklen_t data type]) 1764 cares_typeof_ares_socklen_t="unknown" 1765 for arg1 in int SOCKET; do 1766 for arg2 in 'struct sockaddr' void; do 1767 for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do 1768 if test "$cares_typeof_ares_socklen_t" = "unknown"; then 1769 AC_COMPILE_IFELSE([ 1770 AC_LANG_PROGRAM([[ 1771 $cares_includes_ws2tcpip 1772 $cares_includes_sys_socket 1773 $cares_preprocess_callconv 1774 extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); 1775 ]],[[ 1776 $t *lenptr = 0; 1777 if(0 != getpeername(0, 0, lenptr)) 1778 return 1; 1779 ]]) 1780 ],[ 1781 cares_typeof_ares_socklen_t="$t" 1782 ]) 1783 fi 1784 done 1785 done 1786 done 1787 for t in socklen_t int; do 1788 if test "$cares_typeof_ares_socklen_t" = "void"; then 1789 AC_COMPILE_IFELSE([ 1790 AC_LANG_PROGRAM([[ 1791 $cares_includes_sys_socket 1792 typedef $t ares_socklen_t; 1793 ]],[[ 1794 ares_socklen_t dummy; 1795 ]]) 1796 ],[ 1797 cares_typeof_ares_socklen_t="$t" 1798 ]) 1799 fi 1800 done 1801 AC_MSG_RESULT([$cares_typeof_ares_socklen_t]) 1802 if test "$cares_typeof_ares_socklen_t" = "void" || 1803 test "$cares_typeof_ares_socklen_t" = "unknown"; then 1804 AC_MSG_ERROR([cannot find data type for ares_socklen_t.]) 1805 fi 1806 # 1807 AC_MSG_CHECKING([size of ares_socklen_t]) 1808 cares_sizeof_ares_socklen_t="unknown" 1809 cares_pull_headers_socklen_t="unknown" 1810 if test "$ac_cv_header_ws2tcpip_h" = "yes"; then 1811 tst_pull_header_checks='none ws2tcpip' 1812 tst_size_checks='4' 1813 else 1814 tst_pull_header_checks='none systypes syssocket' 1815 tst_size_checks='4 8 2' 1816 fi 1817 for tst_size in $tst_size_checks; do 1818 for tst_pull_headers in $tst_pull_header_checks; do 1819 if test "$cares_sizeof_ares_socklen_t" = "unknown"; then 1820 case $tst_pull_headers in 1821 ws2tcpip) 1822 tmp_includes="$cares_includes_ws2tcpip" 1823 ;; 1824 systypes) 1825 tmp_includes="$cares_includes_sys_types" 1826 ;; 1827 syssocket) 1828 tmp_includes="$cares_includes_sys_socket" 1829 ;; 1830 *) 1831 tmp_includes="" 1832 ;; 1833 esac 1834 AC_COMPILE_IFELSE([ 1835 AC_LANG_PROGRAM([[ 1836 $tmp_includes 1837 typedef $cares_typeof_ares_socklen_t ares_socklen_t; 1838 typedef char dummy_arr[sizeof(ares_socklen_t) == $tst_size ? 1 : -1]; 1839 ]],[[ 1840 ares_socklen_t dummy; 1841 ]]) 1842 ],[ 1843 cares_sizeof_ares_socklen_t="$tst_size" 1844 cares_pull_headers_socklen_t="$tst_pull_headers" 1845 ]) 1846 fi 1847 done 1848 done 1849 AC_MSG_RESULT([$cares_sizeof_ares_socklen_t]) 1850 if test "$cares_sizeof_ares_socklen_t" = "unknown"; then 1851 AC_MSG_ERROR([cannot find out size of ares_socklen_t.]) 1852 fi 1853 # 1854 case $cares_pull_headers_socklen_t in 1855 ws2tcpip) 1856 CARES_DEFINE_UNQUOTED([CARES_PULL_WS2TCPIP_H]) 1857 ;; 1858 systypes) 1859 CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_TYPES_H]) 1860 ;; 1861 syssocket) 1862 CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_TYPES_H]) 1863 CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_SOCKET_H]) 1864 ;; 1865 esac 1866 CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [$cares_typeof_ares_socklen_t]) 1867 CARES_DEFINE_UNQUOTED([CARES_SIZEOF_ARES_SOCKLEN_T], [$cares_sizeof_ares_socklen_t]) 1868]) 1869 1870 1871dnl This macro determines if the specified struct exists in the specified file 1872dnl Syntax: 1873dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found]) 1874 1875AC_DEFUN([CARES_CHECK_STRUCT], [ 1876 AC_MSG_CHECKING([for struct $2]) 1877 AC_TRY_COMPILE([$1], 1878 [ 1879 struct $2 struct_instance; 1880 ], ac_struct="yes", ac_found="no") 1881 if test "$ac_struct" = "yes" ; then 1882 AC_MSG_RESULT(yes) 1883 $3 1884 else 1885 AC_MSG_RESULT(no) 1886 $4 1887 fi 1888]) 1889 1890dnl This macro determines if the specified constant exists in the specified file 1891dnl Syntax: 1892dnl CARES_CHECK_CONSTANT(headers, constant name, if found, [if not found]) 1893 1894AC_DEFUN([CARES_CHECK_CONSTANT], [ 1895 AC_MSG_CHECKING([for $2]) 1896 AC_EGREP_CPP(VARIABLEWASDEFINED, 1897 [ 1898 $1 1899 1900 #ifdef $2 1901 VARIABLEWASDEFINED 1902 #else 1903 NJET 1904 #endif 1905 ], ac_constant="yes", ac_constant="no" 1906 ) 1907 if test "$ac_constant" = "yes" ; then 1908 AC_MSG_RESULT(yes) 1909 $3 1910 else 1911 AC_MSG_RESULT(no) 1912 $4 1913 fi 1914]) 1915 1916