lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #*************************************************************************** |
| 2 | # |
| 3 | # Copyright (C) 2008 - 2012 by Daniel Stenberg et al |
| 4 | # |
| 5 | # Permission to use, copy, modify, and distribute this software and its |
| 6 | # documentation for any purpose and without fee is hereby granted, provided |
| 7 | # that the above copyright notice appear in all copies and that both that |
| 8 | # copyright notice and this permission notice appear in supporting |
| 9 | # documentation, and that the name of M.I.T. not be used in advertising or |
| 10 | # publicity pertaining to distribution of the software without specific, |
| 11 | # written prior permission. M.I.T. makes no representations about the |
| 12 | # suitability of this software for any purpose. It is provided "as is" |
| 13 | # without express or implied warranty. |
| 14 | # |
| 15 | #*************************************************************************** |
| 16 | |
| 17 | # File version for 'aclocal' use. Keep it a single number. |
| 18 | # serial 46 |
| 19 | |
| 20 | |
| 21 | dnl CARES_INCLUDES_ARPA_INET |
| 22 | dnl ------------------------------------------------- |
| 23 | dnl Set up variable with list of headers that must be |
| 24 | dnl included when arpa/inet.h is to be included. |
| 25 | |
| 26 | AC_DEFUN([CARES_INCLUDES_ARPA_INET], [ |
| 27 | cares_includes_arpa_inet="\ |
| 28 | /* includes start */ |
| 29 | #ifdef HAVE_SYS_TYPES_H |
| 30 | # include <sys/types.h> |
| 31 | #endif |
| 32 | #ifdef HAVE_SYS_SOCKET_H |
| 33 | # include <sys/socket.h> |
| 34 | #endif |
| 35 | #ifdef HAVE_NETINET_IN_H |
| 36 | # include <netinet/in.h> |
| 37 | #endif |
| 38 | #ifdef HAVE_ARPA_INET_H |
| 39 | # include <arpa/inet.h> |
| 40 | #endif |
| 41 | /* includes end */" |
| 42 | AC_CHECK_HEADERS( |
| 43 | sys/types.h sys/socket.h netinet/in.h arpa/inet.h, |
| 44 | [], [], [$cares_includes_arpa_inet]) |
| 45 | ]) |
| 46 | |
| 47 | |
| 48 | dnl CARES_INCLUDES_FCNTL |
| 49 | dnl ------------------------------------------------- |
| 50 | dnl Set up variable with list of headers that must be |
| 51 | dnl included when fcntl.h is to be included. |
| 52 | |
| 53 | AC_DEFUN([CARES_INCLUDES_FCNTL], [ |
| 54 | cares_includes_fcntl="\ |
| 55 | /* includes start */ |
| 56 | #ifdef HAVE_SYS_TYPES_H |
| 57 | # include <sys/types.h> |
| 58 | #endif |
| 59 | #ifdef HAVE_UNISTD_H |
| 60 | # include <unistd.h> |
| 61 | #endif |
| 62 | #ifdef HAVE_FCNTL_H |
| 63 | # include <fcntl.h> |
| 64 | #endif |
| 65 | /* includes end */" |
| 66 | AC_CHECK_HEADERS( |
| 67 | sys/types.h unistd.h fcntl.h, |
| 68 | [], [], [$cares_includes_fcntl]) |
| 69 | ]) |
| 70 | |
| 71 | |
| 72 | dnl CARES_INCLUDES_NETDB |
| 73 | dnl ------------------------------------------------- |
| 74 | dnl Set up variable with list of headers that must be |
| 75 | dnl included when netdb.h is to be included. |
| 76 | |
| 77 | AC_DEFUN([CARES_INCLUDES_NETDB], [ |
| 78 | cares_includes_netdb="\ |
| 79 | /* includes start */ |
| 80 | #ifdef HAVE_SYS_TYPES_H |
| 81 | # include <sys/types.h> |
| 82 | #endif |
| 83 | #ifdef HAVE_NETDB_H |
| 84 | # include <netdb.h> |
| 85 | #endif |
| 86 | /* includes end */" |
| 87 | AC_CHECK_HEADERS( |
| 88 | sys/types.h netdb.h, |
| 89 | [], [], [$cares_includes_netdb]) |
| 90 | ]) |
| 91 | |
| 92 | |
| 93 | dnl CARES_INCLUDES_SOCKET |
| 94 | dnl ------------------------------------------------- |
| 95 | dnl Set up variable with list of headers that must be |
| 96 | dnl included when socket.h is to be included. |
| 97 | |
| 98 | AC_DEFUN([CARES_INCLUDES_SOCKET], [ |
| 99 | cares_includes_socket="\ |
| 100 | /* includes start */ |
| 101 | #ifdef HAVE_SYS_TYPES_H |
| 102 | # include <sys/types.h> |
| 103 | #endif |
| 104 | #ifdef HAVE_SOCKET_H |
| 105 | # include <socket.h> |
| 106 | #endif |
| 107 | /* includes end */" |
| 108 | AC_CHECK_HEADERS( |
| 109 | sys/types.h socket.h, |
| 110 | [], [], [$cares_includes_socket]) |
| 111 | ]) |
| 112 | |
| 113 | |
| 114 | dnl CARES_INCLUDES_STDLIB |
| 115 | dnl ------------------------------------------------- |
| 116 | dnl Set up variable with list of headers that must be |
| 117 | dnl included when stdlib.h is to be included. |
| 118 | |
| 119 | AC_DEFUN([CARES_INCLUDES_STDLIB], [ |
| 120 | cares_includes_stdlib="\ |
| 121 | /* includes start */ |
| 122 | #ifdef HAVE_SYS_TYPES_H |
| 123 | # include <sys/types.h> |
| 124 | #endif |
| 125 | #ifdef HAVE_STDLIB_H |
| 126 | # include <stdlib.h> |
| 127 | #endif |
| 128 | /* includes end */" |
| 129 | AC_CHECK_HEADERS( |
| 130 | sys/types.h stdlib.h, |
| 131 | [], [], [$cares_includes_stdlib]) |
| 132 | ]) |
| 133 | |
| 134 | |
| 135 | dnl CARES_INCLUDES_STRING |
| 136 | dnl ------------------------------------------------- |
| 137 | dnl Set up variable with list of headers that must be |
| 138 | dnl included when string(s).h is to be included. |
| 139 | |
| 140 | AC_DEFUN([CARES_INCLUDES_STRING], [ |
| 141 | cares_includes_string="\ |
| 142 | /* includes start */ |
| 143 | #ifdef HAVE_SYS_TYPES_H |
| 144 | # include <sys/types.h> |
| 145 | #endif |
| 146 | #ifdef HAVE_STRING_H |
| 147 | # include <string.h> |
| 148 | #endif |
| 149 | #ifdef HAVE_STRINGS_H |
| 150 | # include <strings.h> |
| 151 | #endif |
| 152 | /* includes end */" |
| 153 | AC_CHECK_HEADERS( |
| 154 | sys/types.h string.h strings.h, |
| 155 | [], [], [$cares_includes_string]) |
| 156 | ]) |
| 157 | |
| 158 | |
| 159 | dnl CARES_INCLUDES_STROPTS |
| 160 | dnl ------------------------------------------------- |
| 161 | dnl Set up variable with list of headers that must be |
| 162 | dnl included when stropts.h is to be included. |
| 163 | |
| 164 | AC_DEFUN([CARES_INCLUDES_STROPTS], [ |
| 165 | cares_includes_stropts="\ |
| 166 | /* includes start */ |
| 167 | #ifdef HAVE_SYS_TYPES_H |
| 168 | # include <sys/types.h> |
| 169 | #endif |
| 170 | #ifdef HAVE_UNISTD_H |
| 171 | # include <unistd.h> |
| 172 | #endif |
| 173 | #ifdef HAVE_SYS_SOCKET_H |
| 174 | # include <sys/socket.h> |
| 175 | #endif |
| 176 | #ifdef HAVE_SYS_IOCTL_H |
| 177 | # include <sys/ioctl.h> |
| 178 | #endif |
| 179 | #ifdef HAVE_STROPTS_H |
| 180 | # include <stropts.h> |
| 181 | #endif |
| 182 | /* includes end */" |
| 183 | AC_CHECK_HEADERS( |
| 184 | sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h, |
| 185 | [], [], [$cares_includes_stropts]) |
| 186 | ]) |
| 187 | |
| 188 | |
| 189 | dnl CARES_INCLUDES_SYS_SOCKET |
| 190 | dnl ------------------------------------------------- |
| 191 | dnl Set up variable with list of headers that must be |
| 192 | dnl included when sys/socket.h is to be included. |
| 193 | |
| 194 | AC_DEFUN([CARES_INCLUDES_SYS_SOCKET], [ |
| 195 | cares_includes_sys_socket="\ |
| 196 | /* includes start */ |
| 197 | #ifdef HAVE_SYS_TYPES_H |
| 198 | # include <sys/types.h> |
| 199 | #endif |
| 200 | #ifdef HAVE_SYS_SOCKET_H |
| 201 | # include <sys/socket.h> |
| 202 | #endif |
| 203 | /* includes end */" |
| 204 | AC_CHECK_HEADERS( |
| 205 | sys/types.h sys/socket.h, |
| 206 | [], [], [$cares_includes_sys_socket]) |
| 207 | ]) |
| 208 | |
| 209 | |
| 210 | dnl CARES_INCLUDES_SYS_TYPES |
| 211 | dnl ------------------------------------------------- |
| 212 | dnl Set up variable with list of headers that must be |
| 213 | dnl included when sys/types.h is to be included. |
| 214 | |
| 215 | AC_DEFUN([CARES_INCLUDES_SYS_TYPES], [ |
| 216 | cares_includes_sys_types="\ |
| 217 | /* includes start */ |
| 218 | #ifdef HAVE_SYS_TYPES_H |
| 219 | # include <sys/types.h> |
| 220 | #endif |
| 221 | /* includes end */" |
| 222 | AC_CHECK_HEADERS( |
| 223 | sys/types.h, |
| 224 | [], [], [$cares_includes_sys_types]) |
| 225 | ]) |
| 226 | |
| 227 | |
| 228 | dnl CARES_INCLUDES_SYS_UIO |
| 229 | dnl ------------------------------------------------- |
| 230 | dnl Set up variable with list of headers that must be |
| 231 | dnl included when sys/uio.h is to be included. |
| 232 | |
| 233 | AC_DEFUN([CARES_INCLUDES_SYS_UIO], [ |
| 234 | cares_includes_sys_uio="\ |
| 235 | /* includes start */ |
| 236 | #ifdef HAVE_SYS_TYPES_H |
| 237 | # include <sys/types.h> |
| 238 | #endif |
| 239 | #ifdef HAVE_SYS_UIO_H |
| 240 | # include <sys/uio.h> |
| 241 | #endif |
| 242 | /* includes end */" |
| 243 | AC_CHECK_HEADERS( |
| 244 | sys/types.h sys/uio.h, |
| 245 | [], [], [$cares_includes_sys_uio]) |
| 246 | ]) |
| 247 | |
| 248 | |
| 249 | dnl CARES_INCLUDES_UNISTD |
| 250 | dnl ------------------------------------------------- |
| 251 | dnl Set up variable with list of headers that must be |
| 252 | dnl included when unistd.h is to be included. |
| 253 | |
| 254 | AC_DEFUN([CARES_INCLUDES_UNISTD], [ |
| 255 | cares_includes_unistd="\ |
| 256 | /* includes start */ |
| 257 | #ifdef HAVE_SYS_TYPES_H |
| 258 | # include <sys/types.h> |
| 259 | #endif |
| 260 | #ifdef HAVE_UNISTD_H |
| 261 | # include <unistd.h> |
| 262 | #endif |
| 263 | /* includes end */" |
| 264 | AC_CHECK_HEADERS( |
| 265 | sys/types.h unistd.h, |
| 266 | [], [], [$cares_includes_unistd]) |
| 267 | ]) |
| 268 | |
| 269 | |
| 270 | dnl CARES_INCLUDES_WINSOCK2 |
| 271 | dnl ------------------------------------------------- |
| 272 | dnl Set up variable with list of headers that must be |
| 273 | dnl included when winsock(2).h is to be included. |
| 274 | |
| 275 | AC_DEFUN([CARES_INCLUDES_WINSOCK2], [ |
| 276 | cares_includes_winsock2="\ |
| 277 | /* includes start */ |
| 278 | #ifdef HAVE_WINDOWS_H |
| 279 | # ifndef WIN32_LEAN_AND_MEAN |
| 280 | # define WIN32_LEAN_AND_MEAN |
| 281 | # endif |
| 282 | # include <windows.h> |
| 283 | # ifdef HAVE_WINSOCK2_H |
| 284 | # include <winsock2.h> |
| 285 | # else |
| 286 | # ifdef HAVE_WINSOCK_H |
| 287 | # include <winsock.h> |
| 288 | # endif |
| 289 | # endif |
| 290 | #endif |
| 291 | /* includes end */" |
| 292 | CURL_CHECK_HEADER_WINDOWS |
| 293 | CURL_CHECK_HEADER_WINSOCK |
| 294 | CURL_CHECK_HEADER_WINSOCK2 |
| 295 | ]) |
| 296 | |
| 297 | |
| 298 | dnl CARES_INCLUDES_WS2TCPIP |
| 299 | dnl ------------------------------------------------- |
| 300 | dnl Set up variable with list of headers that must be |
| 301 | dnl included when ws2tcpip.h is to be included. |
| 302 | |
| 303 | AC_DEFUN([CARES_INCLUDES_WS2TCPIP], [ |
| 304 | cares_includes_ws2tcpip="\ |
| 305 | /* includes start */ |
| 306 | #ifdef HAVE_WINDOWS_H |
| 307 | # ifndef WIN32_LEAN_AND_MEAN |
| 308 | # define WIN32_LEAN_AND_MEAN |
| 309 | # endif |
| 310 | # include <windows.h> |
| 311 | # ifdef HAVE_WINSOCK2_H |
| 312 | # include <winsock2.h> |
| 313 | # ifdef HAVE_WS2TCPIP_H |
| 314 | # include <ws2tcpip.h> |
| 315 | # endif |
| 316 | # endif |
| 317 | #endif |
| 318 | /* includes end */" |
| 319 | CURL_CHECK_HEADER_WINDOWS |
| 320 | CURL_CHECK_HEADER_WINSOCK2 |
| 321 | CURL_CHECK_HEADER_WS2TCPIP |
| 322 | ]) |
| 323 | |
| 324 | |
| 325 | dnl CARES_PREPROCESS_CALLCONV |
| 326 | dnl ------------------------------------------------- |
| 327 | dnl Set up variable with a preprocessor block which |
| 328 | dnl defines function calling convention. |
| 329 | |
| 330 | AC_DEFUN([CARES_PREPROCESS_CALLCONV], [ |
| 331 | cares_preprocess_callconv="\ |
| 332 | /* preprocess start */ |
| 333 | #ifdef HAVE_WINDOWS_H |
| 334 | # define FUNCALLCONV __stdcall |
| 335 | #else |
| 336 | # define FUNCALLCONV |
| 337 | #endif |
| 338 | /* preprocess end */" |
| 339 | ]) |
| 340 | |
| 341 | |
| 342 | dnl CARES_CHECK_FUNC_CLOSESOCKET |
| 343 | dnl ------------------------------------------------- |
| 344 | dnl Verify if closesocket is available, prototyped, and |
| 345 | dnl can be compiled. If all of these are true, and |
| 346 | dnl usage has not been previously disallowed with |
| 347 | dnl shell variable cares_disallow_closesocket, then |
| 348 | dnl HAVE_CLOSESOCKET will be defined. |
| 349 | |
| 350 | AC_DEFUN([CARES_CHECK_FUNC_CLOSESOCKET], [ |
| 351 | AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl |
| 352 | AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl |
| 353 | # |
| 354 | tst_links_closesocket="unknown" |
| 355 | tst_proto_closesocket="unknown" |
| 356 | tst_compi_closesocket="unknown" |
| 357 | tst_allow_closesocket="unknown" |
| 358 | # |
| 359 | AC_MSG_CHECKING([if closesocket can be linked]) |
| 360 | AC_LINK_IFELSE([ |
| 361 | AC_LANG_PROGRAM([[ |
| 362 | $cares_includes_winsock2 |
| 363 | $cares_includes_socket |
| 364 | ]],[[ |
| 365 | if(0 != closesocket(0)) |
| 366 | return 1; |
| 367 | ]]) |
| 368 | ],[ |
| 369 | AC_MSG_RESULT([yes]) |
| 370 | tst_links_closesocket="yes" |
| 371 | ],[ |
| 372 | AC_MSG_RESULT([no]) |
| 373 | tst_links_closesocket="no" |
| 374 | ]) |
| 375 | # |
| 376 | if test "$tst_links_closesocket" = "yes"; then |
| 377 | AC_MSG_CHECKING([if closesocket is prototyped]) |
| 378 | AC_EGREP_CPP([closesocket],[ |
| 379 | $cares_includes_winsock2 |
| 380 | $cares_includes_socket |
| 381 | ],[ |
| 382 | AC_MSG_RESULT([yes]) |
| 383 | tst_proto_closesocket="yes" |
| 384 | ],[ |
| 385 | AC_MSG_RESULT([no]) |
| 386 | tst_proto_closesocket="no" |
| 387 | ]) |
| 388 | fi |
| 389 | # |
| 390 | if test "$tst_proto_closesocket" = "yes"; then |
| 391 | AC_MSG_CHECKING([if closesocket is compilable]) |
| 392 | AC_COMPILE_IFELSE([ |
| 393 | AC_LANG_PROGRAM([[ |
| 394 | $cares_includes_winsock2 |
| 395 | $cares_includes_socket |
| 396 | ]],[[ |
| 397 | if(0 != closesocket(0)) |
| 398 | return 1; |
| 399 | ]]) |
| 400 | ],[ |
| 401 | AC_MSG_RESULT([yes]) |
| 402 | tst_compi_closesocket="yes" |
| 403 | ],[ |
| 404 | AC_MSG_RESULT([no]) |
| 405 | tst_compi_closesocket="no" |
| 406 | ]) |
| 407 | fi |
| 408 | # |
| 409 | if test "$tst_compi_closesocket" = "yes"; then |
| 410 | AC_MSG_CHECKING([if closesocket usage allowed]) |
| 411 | if test "x$cares_disallow_closesocket" != "xyes"; then |
| 412 | AC_MSG_RESULT([yes]) |
| 413 | tst_allow_closesocket="yes" |
| 414 | else |
| 415 | AC_MSG_RESULT([no]) |
| 416 | tst_allow_closesocket="no" |
| 417 | fi |
| 418 | fi |
| 419 | # |
| 420 | AC_MSG_CHECKING([if closesocket might be used]) |
| 421 | if test "$tst_links_closesocket" = "yes" && |
| 422 | test "$tst_proto_closesocket" = "yes" && |
| 423 | test "$tst_compi_closesocket" = "yes" && |
| 424 | test "$tst_allow_closesocket" = "yes"; then |
| 425 | AC_MSG_RESULT([yes]) |
| 426 | AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1, |
| 427 | [Define to 1 if you have the closesocket function.]) |
| 428 | ac_cv_func_closesocket="yes" |
| 429 | else |
| 430 | AC_MSG_RESULT([no]) |
| 431 | ac_cv_func_closesocket="no" |
| 432 | fi |
| 433 | ]) |
| 434 | |
| 435 | |
| 436 | dnl CARES_CHECK_FUNC_CLOSESOCKET_CAMEL |
| 437 | dnl ------------------------------------------------- |
| 438 | dnl Verify if CloseSocket is available, prototyped, and |
| 439 | dnl can be compiled. If all of these are true, and |
| 440 | dnl usage has not been previously disallowed with |
| 441 | dnl shell variable cares_disallow_closesocket_camel, |
| 442 | dnl then HAVE_CLOSESOCKET_CAMEL will be defined. |
| 443 | |
| 444 | AC_DEFUN([CARES_CHECK_FUNC_CLOSESOCKET_CAMEL], [ |
| 445 | AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl |
| 446 | # |
| 447 | tst_links_closesocket_camel="unknown" |
| 448 | tst_proto_closesocket_camel="unknown" |
| 449 | tst_compi_closesocket_camel="unknown" |
| 450 | tst_allow_closesocket_camel="unknown" |
| 451 | # |
| 452 | AC_MSG_CHECKING([if CloseSocket can be linked]) |
| 453 | AC_LINK_IFELSE([ |
| 454 | AC_LANG_PROGRAM([[ |
| 455 | $cares_includes_sys_socket |
| 456 | ]],[[ |
| 457 | if(0 != CloseSocket(0)) |
| 458 | return 1; |
| 459 | ]]) |
| 460 | ],[ |
| 461 | AC_MSG_RESULT([yes]) |
| 462 | tst_links_closesocket_camel="yes" |
| 463 | ],[ |
| 464 | AC_MSG_RESULT([no]) |
| 465 | tst_links_closesocket_camel="no" |
| 466 | ]) |
| 467 | # |
| 468 | if test "$tst_links_closesocket_camel" = "yes"; then |
| 469 | AC_MSG_CHECKING([if CloseSocket is prototyped]) |
| 470 | AC_EGREP_CPP([CloseSocket],[ |
| 471 | $cares_includes_sys_socket |
| 472 | ],[ |
| 473 | AC_MSG_RESULT([yes]) |
| 474 | tst_proto_closesocket_camel="yes" |
| 475 | ],[ |
| 476 | AC_MSG_RESULT([no]) |
| 477 | tst_proto_closesocket_camel="no" |
| 478 | ]) |
| 479 | fi |
| 480 | # |
| 481 | if test "$tst_proto_closesocket_camel" = "yes"; then |
| 482 | AC_MSG_CHECKING([if CloseSocket is compilable]) |
| 483 | AC_COMPILE_IFELSE([ |
| 484 | AC_LANG_PROGRAM([[ |
| 485 | $cares_includes_sys_socket |
| 486 | ]],[[ |
| 487 | if(0 != CloseSocket(0)) |
| 488 | return 1; |
| 489 | ]]) |
| 490 | ],[ |
| 491 | AC_MSG_RESULT([yes]) |
| 492 | tst_compi_closesocket_camel="yes" |
| 493 | ],[ |
| 494 | AC_MSG_RESULT([no]) |
| 495 | tst_compi_closesocket_camel="no" |
| 496 | ]) |
| 497 | fi |
| 498 | # |
| 499 | if test "$tst_compi_closesocket_camel" = "yes"; then |
| 500 | AC_MSG_CHECKING([if CloseSocket usage allowed]) |
| 501 | if test "x$cares_disallow_closesocket_camel" != "xyes"; then |
| 502 | AC_MSG_RESULT([yes]) |
| 503 | tst_allow_closesocket_camel="yes" |
| 504 | else |
| 505 | AC_MSG_RESULT([no]) |
| 506 | tst_allow_closesocket_camel="no" |
| 507 | fi |
| 508 | fi |
| 509 | # |
| 510 | AC_MSG_CHECKING([if CloseSocket might be used]) |
| 511 | if test "$tst_links_closesocket_camel" = "yes" && |
| 512 | test "$tst_proto_closesocket_camel" = "yes" && |
| 513 | test "$tst_compi_closesocket_camel" = "yes" && |
| 514 | test "$tst_allow_closesocket_camel" = "yes"; then |
| 515 | AC_MSG_RESULT([yes]) |
| 516 | AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1, |
| 517 | [Define to 1 if you have the CloseSocket camel case function.]) |
| 518 | ac_cv_func_closesocket_camel="yes" |
| 519 | else |
| 520 | AC_MSG_RESULT([no]) |
| 521 | ac_cv_func_closesocket_camel="no" |
| 522 | fi |
| 523 | ]) |
| 524 | |
| 525 | |
| 526 | dnl CARES_CHECK_FUNC_CONNECT |
| 527 | dnl ------------------------------------------------- |
| 528 | dnl Verify if connect is available, prototyped, and |
| 529 | dnl can be compiled. If all of these are true, and |
| 530 | dnl usage has not been previously disallowed with |
| 531 | dnl shell variable cares_disallow_connect, then |
| 532 | dnl HAVE_CONNECT will be defined. |
| 533 | |
| 534 | AC_DEFUN([CARES_CHECK_FUNC_CONNECT], [ |
| 535 | AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl |
| 536 | AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl |
| 537 | AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl |
| 538 | # |
| 539 | tst_links_connect="unknown" |
| 540 | tst_proto_connect="unknown" |
| 541 | tst_compi_connect="unknown" |
| 542 | tst_allow_connect="unknown" |
| 543 | # |
| 544 | AC_MSG_CHECKING([if connect can be linked]) |
| 545 | AC_LINK_IFELSE([ |
| 546 | AC_LANG_PROGRAM([[ |
| 547 | $cares_includes_winsock2 |
| 548 | $cares_includes_sys_socket |
| 549 | $cares_includes_socket |
| 550 | ]],[[ |
| 551 | if(0 != connect(0, 0, 0)) |
| 552 | return 1; |
| 553 | ]]) |
| 554 | ],[ |
| 555 | AC_MSG_RESULT([yes]) |
| 556 | tst_links_connect="yes" |
| 557 | ],[ |
| 558 | AC_MSG_RESULT([no]) |
| 559 | tst_links_connect="no" |
| 560 | ]) |
| 561 | # |
| 562 | if test "$tst_links_connect" = "yes"; then |
| 563 | AC_MSG_CHECKING([if connect is prototyped]) |
| 564 | AC_EGREP_CPP([connect],[ |
| 565 | $cares_includes_winsock2 |
| 566 | $cares_includes_sys_socket |
| 567 | $cares_includes_socket |
| 568 | ],[ |
| 569 | AC_MSG_RESULT([yes]) |
| 570 | tst_proto_connect="yes" |
| 571 | ],[ |
| 572 | AC_MSG_RESULT([no]) |
| 573 | tst_proto_connect="no" |
| 574 | ]) |
| 575 | fi |
| 576 | # |
| 577 | if test "$tst_proto_connect" = "yes"; then |
| 578 | AC_MSG_CHECKING([if connect is compilable]) |
| 579 | AC_COMPILE_IFELSE([ |
| 580 | AC_LANG_PROGRAM([[ |
| 581 | $cares_includes_winsock2 |
| 582 | $cares_includes_sys_socket |
| 583 | $cares_includes_socket |
| 584 | ]],[[ |
| 585 | if(0 != connect(0, 0, 0)) |
| 586 | return 1; |
| 587 | ]]) |
| 588 | ],[ |
| 589 | AC_MSG_RESULT([yes]) |
| 590 | tst_compi_connect="yes" |
| 591 | ],[ |
| 592 | AC_MSG_RESULT([no]) |
| 593 | tst_compi_connect="no" |
| 594 | ]) |
| 595 | fi |
| 596 | # |
| 597 | if test "$tst_compi_connect" = "yes"; then |
| 598 | AC_MSG_CHECKING([if connect usage allowed]) |
| 599 | if test "x$cares_disallow_connect" != "xyes"; then |
| 600 | AC_MSG_RESULT([yes]) |
| 601 | tst_allow_connect="yes" |
| 602 | else |
| 603 | AC_MSG_RESULT([no]) |
| 604 | tst_allow_connect="no" |
| 605 | fi |
| 606 | fi |
| 607 | # |
| 608 | AC_MSG_CHECKING([if connect might be used]) |
| 609 | if test "$tst_links_connect" = "yes" && |
| 610 | test "$tst_proto_connect" = "yes" && |
| 611 | test "$tst_compi_connect" = "yes" && |
| 612 | test "$tst_allow_connect" = "yes"; then |
| 613 | AC_MSG_RESULT([yes]) |
| 614 | AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1, |
| 615 | [Define to 1 if you have the connect function.]) |
| 616 | ac_cv_func_connect="yes" |
| 617 | else |
| 618 | AC_MSG_RESULT([no]) |
| 619 | ac_cv_func_connect="no" |
| 620 | fi |
| 621 | ]) |
| 622 | |
| 623 | |
| 624 | dnl CARES_CHECK_FUNC_FCNTL |
| 625 | dnl ------------------------------------------------- |
| 626 | dnl Verify if fcntl is available, prototyped, and |
| 627 | dnl can be compiled. If all of these are true, and |
| 628 | dnl usage has not been previously disallowed with |
| 629 | dnl shell variable cares_disallow_fcntl, then |
| 630 | dnl HAVE_FCNTL will be defined. |
| 631 | |
| 632 | AC_DEFUN([CARES_CHECK_FUNC_FCNTL], [ |
| 633 | AC_REQUIRE([CARES_INCLUDES_FCNTL])dnl |
| 634 | # |
| 635 | tst_links_fcntl="unknown" |
| 636 | tst_proto_fcntl="unknown" |
| 637 | tst_compi_fcntl="unknown" |
| 638 | tst_allow_fcntl="unknown" |
| 639 | # |
| 640 | AC_MSG_CHECKING([if fcntl can be linked]) |
| 641 | AC_LINK_IFELSE([ |
| 642 | AC_LANG_FUNC_LINK_TRY([fcntl]) |
| 643 | ],[ |
| 644 | AC_MSG_RESULT([yes]) |
| 645 | tst_links_fcntl="yes" |
| 646 | ],[ |
| 647 | AC_MSG_RESULT([no]) |
| 648 | tst_links_fcntl="no" |
| 649 | ]) |
| 650 | # |
| 651 | if test "$tst_links_fcntl" = "yes"; then |
| 652 | AC_MSG_CHECKING([if fcntl is prototyped]) |
| 653 | AC_EGREP_CPP([fcntl],[ |
| 654 | $cares_includes_fcntl |
| 655 | ],[ |
| 656 | AC_MSG_RESULT([yes]) |
| 657 | tst_proto_fcntl="yes" |
| 658 | ],[ |
| 659 | AC_MSG_RESULT([no]) |
| 660 | tst_proto_fcntl="no" |
| 661 | ]) |
| 662 | fi |
| 663 | # |
| 664 | if test "$tst_proto_fcntl" = "yes"; then |
| 665 | AC_MSG_CHECKING([if fcntl is compilable]) |
| 666 | AC_COMPILE_IFELSE([ |
| 667 | AC_LANG_PROGRAM([[ |
| 668 | $cares_includes_fcntl |
| 669 | ]],[[ |
| 670 | if(0 != fcntl(0, 0, 0)) |
| 671 | return 1; |
| 672 | ]]) |
| 673 | ],[ |
| 674 | AC_MSG_RESULT([yes]) |
| 675 | tst_compi_fcntl="yes" |
| 676 | ],[ |
| 677 | AC_MSG_RESULT([no]) |
| 678 | tst_compi_fcntl="no" |
| 679 | ]) |
| 680 | fi |
| 681 | # |
| 682 | if test "$tst_compi_fcntl" = "yes"; then |
| 683 | AC_MSG_CHECKING([if fcntl usage allowed]) |
| 684 | if test "x$cares_disallow_fcntl" != "xyes"; then |
| 685 | AC_MSG_RESULT([yes]) |
| 686 | tst_allow_fcntl="yes" |
| 687 | else |
| 688 | AC_MSG_RESULT([no]) |
| 689 | tst_allow_fcntl="no" |
| 690 | fi |
| 691 | fi |
| 692 | # |
| 693 | AC_MSG_CHECKING([if fcntl might be used]) |
| 694 | if test "$tst_links_fcntl" = "yes" && |
| 695 | test "$tst_proto_fcntl" = "yes" && |
| 696 | test "$tst_compi_fcntl" = "yes" && |
| 697 | test "$tst_allow_fcntl" = "yes"; then |
| 698 | AC_MSG_RESULT([yes]) |
| 699 | AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1, |
| 700 | [Define to 1 if you have the fcntl function.]) |
| 701 | ac_cv_func_fcntl="yes" |
| 702 | CARES_CHECK_FUNC_FCNTL_O_NONBLOCK |
| 703 | else |
| 704 | AC_MSG_RESULT([no]) |
| 705 | ac_cv_func_fcntl="no" |
| 706 | fi |
| 707 | ]) |
| 708 | |
| 709 | |
| 710 | dnl CARES_CHECK_FUNC_FCNTL_O_NONBLOCK |
| 711 | dnl ------------------------------------------------- |
| 712 | dnl Verify if fcntl with status flag O_NONBLOCK is |
| 713 | dnl available, can be compiled, and seems to work. If |
| 714 | dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK |
| 715 | dnl will be defined. |
| 716 | |
| 717 | AC_DEFUN([CARES_CHECK_FUNC_FCNTL_O_NONBLOCK], [ |
| 718 | # |
| 719 | tst_compi_fcntl_o_nonblock="unknown" |
| 720 | tst_allow_fcntl_o_nonblock="unknown" |
| 721 | # |
| 722 | case $host_os in |
| 723 | sunos4* | aix3* | beos*) |
| 724 | dnl O_NONBLOCK does not work on these platforms |
| 725 | cares_disallow_fcntl_o_nonblock="yes" |
| 726 | ;; |
| 727 | esac |
| 728 | # |
| 729 | if test "$ac_cv_func_fcntl" = "yes"; then |
| 730 | AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable]) |
| 731 | AC_COMPILE_IFELSE([ |
| 732 | AC_LANG_PROGRAM([[ |
| 733 | $cares_includes_fcntl |
| 734 | ]],[[ |
| 735 | int flags = 0; |
| 736 | if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) |
| 737 | return 1; |
| 738 | ]]) |
| 739 | ],[ |
| 740 | AC_MSG_RESULT([yes]) |
| 741 | tst_compi_fcntl_o_nonblock="yes" |
| 742 | ],[ |
| 743 | AC_MSG_RESULT([no]) |
| 744 | tst_compi_fcntl_o_nonblock="no" |
| 745 | ]) |
| 746 | fi |
| 747 | # |
| 748 | if test "$tst_compi_fcntl_o_nonblock" = "yes"; then |
| 749 | AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed]) |
| 750 | if test "x$cares_disallow_fcntl_o_nonblock" != "xyes"; then |
| 751 | AC_MSG_RESULT([yes]) |
| 752 | tst_allow_fcntl_o_nonblock="yes" |
| 753 | else |
| 754 | AC_MSG_RESULT([no]) |
| 755 | tst_allow_fcntl_o_nonblock="no" |
| 756 | fi |
| 757 | fi |
| 758 | # |
| 759 | AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used]) |
| 760 | if test "$tst_compi_fcntl_o_nonblock" = "yes" && |
| 761 | test "$tst_allow_fcntl_o_nonblock" = "yes"; then |
| 762 | AC_MSG_RESULT([yes]) |
| 763 | AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1, |
| 764 | [Define to 1 if you have a working fcntl O_NONBLOCK function.]) |
| 765 | ac_cv_func_fcntl_o_nonblock="yes" |
| 766 | else |
| 767 | AC_MSG_RESULT([no]) |
| 768 | ac_cv_func_fcntl_o_nonblock="no" |
| 769 | fi |
| 770 | ]) |
| 771 | |
| 772 | |
| 773 | dnl CARES_CHECK_FUNC_FREEADDRINFO |
| 774 | dnl ------------------------------------------------- |
| 775 | dnl Verify if freeaddrinfo is available, prototyped, |
| 776 | dnl and can be compiled. If all of these are true, |
| 777 | dnl and usage has not been previously disallowed with |
| 778 | dnl shell variable cares_disallow_freeaddrinfo, then |
| 779 | dnl HAVE_FREEADDRINFO will be defined. |
| 780 | |
| 781 | AC_DEFUN([CARES_CHECK_FUNC_FREEADDRINFO], [ |
| 782 | AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl |
| 783 | AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl |
| 784 | AC_REQUIRE([CARES_INCLUDES_NETDB])dnl |
| 785 | # |
| 786 | tst_links_freeaddrinfo="unknown" |
| 787 | tst_proto_freeaddrinfo="unknown" |
| 788 | tst_compi_freeaddrinfo="unknown" |
| 789 | tst_allow_freeaddrinfo="unknown" |
| 790 | # |
| 791 | AC_MSG_CHECKING([if freeaddrinfo can be linked]) |
| 792 | AC_LINK_IFELSE([ |
| 793 | AC_LANG_PROGRAM([[ |
| 794 | $cares_includes_ws2tcpip |
| 795 | $cares_includes_sys_socket |
| 796 | $cares_includes_netdb |
| 797 | ]],[[ |
| 798 | freeaddrinfo(0); |
| 799 | ]]) |
| 800 | ],[ |
| 801 | AC_MSG_RESULT([yes]) |
| 802 | tst_links_freeaddrinfo="yes" |
| 803 | ],[ |
| 804 | AC_MSG_RESULT([no]) |
| 805 | tst_links_freeaddrinfo="no" |
| 806 | ]) |
| 807 | # |
| 808 | if test "$tst_links_freeaddrinfo" = "yes"; then |
| 809 | AC_MSG_CHECKING([if freeaddrinfo is prototyped]) |
| 810 | AC_EGREP_CPP([freeaddrinfo],[ |
| 811 | $cares_includes_ws2tcpip |
| 812 | $cares_includes_sys_socket |
| 813 | $cares_includes_netdb |
| 814 | ],[ |
| 815 | AC_MSG_RESULT([yes]) |
| 816 | tst_proto_freeaddrinfo="yes" |
| 817 | ],[ |
| 818 | AC_MSG_RESULT([no]) |
| 819 | tst_proto_freeaddrinfo="no" |
| 820 | ]) |
| 821 | fi |
| 822 | # |
| 823 | if test "$tst_proto_freeaddrinfo" = "yes"; then |
| 824 | AC_MSG_CHECKING([if freeaddrinfo is compilable]) |
| 825 | AC_COMPILE_IFELSE([ |
| 826 | AC_LANG_PROGRAM([[ |
| 827 | $cares_includes_ws2tcpip |
| 828 | $cares_includes_sys_socket |
| 829 | $cares_includes_netdb |
| 830 | ]],[[ |
| 831 | freeaddrinfo(0); |
| 832 | ]]) |
| 833 | ],[ |
| 834 | AC_MSG_RESULT([yes]) |
| 835 | tst_compi_freeaddrinfo="yes" |
| 836 | ],[ |
| 837 | AC_MSG_RESULT([no]) |
| 838 | tst_compi_freeaddrinfo="no" |
| 839 | ]) |
| 840 | fi |
| 841 | # |
| 842 | if test "$tst_compi_freeaddrinfo" = "yes"; then |
| 843 | AC_MSG_CHECKING([if freeaddrinfo usage allowed]) |
| 844 | if test "x$cares_disallow_freeaddrinfo" != "xyes"; then |
| 845 | AC_MSG_RESULT([yes]) |
| 846 | tst_allow_freeaddrinfo="yes" |
| 847 | else |
| 848 | AC_MSG_RESULT([no]) |
| 849 | tst_allow_freeaddrinfo="no" |
| 850 | fi |
| 851 | fi |
| 852 | # |
| 853 | AC_MSG_CHECKING([if freeaddrinfo might be used]) |
| 854 | if test "$tst_links_freeaddrinfo" = "yes" && |
| 855 | test "$tst_proto_freeaddrinfo" = "yes" && |
| 856 | test "$tst_compi_freeaddrinfo" = "yes" && |
| 857 | test "$tst_allow_freeaddrinfo" = "yes"; then |
| 858 | AC_MSG_RESULT([yes]) |
| 859 | AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1, |
| 860 | [Define to 1 if you have the freeaddrinfo function.]) |
| 861 | ac_cv_func_freeaddrinfo="yes" |
| 862 | else |
| 863 | AC_MSG_RESULT([no]) |
| 864 | ac_cv_func_freeaddrinfo="no" |
| 865 | fi |
| 866 | ]) |
| 867 | |
| 868 | |
| 869 | dnl CARES_CHECK_FUNC_GETADDRINFO |
| 870 | dnl ------------------------------------------------- |
| 871 | dnl Verify if getaddrinfo is available, prototyped, can |
| 872 | dnl be compiled and seems to work. If all of these are |
| 873 | dnl true, and usage has not been previously disallowed |
| 874 | dnl with shell variable cares_disallow_getaddrinfo, then |
| 875 | dnl HAVE_GETADDRINFO will be defined. Additionally when |
| 876 | dnl HAVE_GETADDRINFO gets defined this will also attempt |
| 877 | dnl to find out if getaddrinfo happens to be threadsafe, |
| 878 | dnl defining HAVE_GETADDRINFO_THREADSAFE when true. |
| 879 | |
| 880 | AC_DEFUN([CARES_CHECK_FUNC_GETADDRINFO], [ |
| 881 | AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl |
| 882 | AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl |
| 883 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 884 | AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl |
| 885 | AC_REQUIRE([CARES_INCLUDES_NETDB])dnl |
| 886 | AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl |
| 887 | # |
| 888 | tst_links_getaddrinfo="unknown" |
| 889 | tst_proto_getaddrinfo="unknown" |
| 890 | tst_compi_getaddrinfo="unknown" |
| 891 | tst_works_getaddrinfo="unknown" |
| 892 | tst_allow_getaddrinfo="unknown" |
| 893 | tst_tsafe_getaddrinfo="unknown" |
| 894 | # |
| 895 | AC_MSG_CHECKING([if getaddrinfo can be linked]) |
| 896 | AC_LINK_IFELSE([ |
| 897 | AC_LANG_PROGRAM([[ |
| 898 | $cares_includes_ws2tcpip |
| 899 | $cares_includes_sys_socket |
| 900 | $cares_includes_netdb |
| 901 | ]],[[ |
| 902 | if(0 != getaddrinfo(0, 0, 0, 0)) |
| 903 | return 1; |
| 904 | ]]) |
| 905 | ],[ |
| 906 | AC_MSG_RESULT([yes]) |
| 907 | tst_links_getaddrinfo="yes" |
| 908 | ],[ |
| 909 | AC_MSG_RESULT([no]) |
| 910 | tst_links_getaddrinfo="no" |
| 911 | ]) |
| 912 | # |
| 913 | if test "$tst_links_getaddrinfo" = "yes"; then |
| 914 | AC_MSG_CHECKING([if getaddrinfo is prototyped]) |
| 915 | AC_EGREP_CPP([getaddrinfo],[ |
| 916 | $cares_includes_ws2tcpip |
| 917 | $cares_includes_sys_socket |
| 918 | $cares_includes_netdb |
| 919 | ],[ |
| 920 | AC_MSG_RESULT([yes]) |
| 921 | tst_proto_getaddrinfo="yes" |
| 922 | ],[ |
| 923 | AC_MSG_RESULT([no]) |
| 924 | tst_proto_getaddrinfo="no" |
| 925 | ]) |
| 926 | fi |
| 927 | # |
| 928 | if test "$tst_proto_getaddrinfo" = "yes"; then |
| 929 | AC_MSG_CHECKING([if getaddrinfo is compilable]) |
| 930 | AC_COMPILE_IFELSE([ |
| 931 | AC_LANG_PROGRAM([[ |
| 932 | $cares_includes_ws2tcpip |
| 933 | $cares_includes_sys_socket |
| 934 | $cares_includes_netdb |
| 935 | ]],[[ |
| 936 | if(0 != getaddrinfo(0, 0, 0, 0)) |
| 937 | return 1; |
| 938 | ]]) |
| 939 | ],[ |
| 940 | AC_MSG_RESULT([yes]) |
| 941 | tst_compi_getaddrinfo="yes" |
| 942 | ],[ |
| 943 | AC_MSG_RESULT([no]) |
| 944 | tst_compi_getaddrinfo="no" |
| 945 | ]) |
| 946 | fi |
| 947 | # |
| 948 | dnl only do runtime verification when not cross-compiling |
| 949 | if test "x$cross_compiling" != "xyes" && |
| 950 | test "$tst_compi_getaddrinfo" = "yes"; then |
| 951 | AC_MSG_CHECKING([if getaddrinfo seems to work]) |
| 952 | AC_RUN_IFELSE([ |
| 953 | AC_LANG_PROGRAM([[ |
| 954 | $cares_includes_ws2tcpip |
| 955 | $cares_includes_stdlib |
| 956 | $cares_includes_string |
| 957 | $cares_includes_sys_socket |
| 958 | $cares_includes_netdb |
| 959 | ]],[[ |
| 960 | struct addrinfo hints; |
| 961 | struct addrinfo *ai = 0; |
| 962 | int error; |
| 963 | |
| 964 | memset(&hints, 0, sizeof(hints)); |
| 965 | hints.ai_flags = AI_NUMERICHOST; |
| 966 | hints.ai_family = AF_UNSPEC; |
| 967 | hints.ai_socktype = SOCK_STREAM; |
| 968 | error = getaddrinfo("127.0.0.1", 0, &hints, &ai); |
| 969 | if(error || !ai) |
| 970 | exit(1); /* fail */ |
| 971 | else |
| 972 | exit(0); |
| 973 | ]]) |
| 974 | ],[ |
| 975 | AC_MSG_RESULT([yes]) |
| 976 | tst_works_getaddrinfo="yes" |
| 977 | ],[ |
| 978 | AC_MSG_RESULT([no]) |
| 979 | tst_works_getaddrinfo="no" |
| 980 | ]) |
| 981 | fi |
| 982 | # |
| 983 | if test "$tst_compi_getaddrinfo" = "yes" && |
| 984 | test "$tst_works_getaddrinfo" != "no"; then |
| 985 | AC_MSG_CHECKING([if getaddrinfo usage allowed]) |
| 986 | if test "x$cares_disallow_getaddrinfo" != "xyes"; then |
| 987 | AC_MSG_RESULT([yes]) |
| 988 | tst_allow_getaddrinfo="yes" |
| 989 | else |
| 990 | AC_MSG_RESULT([no]) |
| 991 | tst_allow_getaddrinfo="no" |
| 992 | fi |
| 993 | fi |
| 994 | # |
| 995 | AC_MSG_CHECKING([if getaddrinfo might be used]) |
| 996 | if test "$tst_links_getaddrinfo" = "yes" && |
| 997 | test "$tst_proto_getaddrinfo" = "yes" && |
| 998 | test "$tst_compi_getaddrinfo" = "yes" && |
| 999 | test "$tst_allow_getaddrinfo" = "yes" && |
| 1000 | test "$tst_works_getaddrinfo" != "no"; then |
| 1001 | AC_MSG_RESULT([yes]) |
| 1002 | AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1, |
| 1003 | [Define to 1 if you have a working getaddrinfo function.]) |
| 1004 | ac_cv_func_getaddrinfo="yes" |
| 1005 | else |
| 1006 | AC_MSG_RESULT([no]) |
| 1007 | ac_cv_func_getaddrinfo="no" |
| 1008 | ac_cv_func_getaddrinfo_threadsafe="no" |
| 1009 | fi |
| 1010 | # |
| 1011 | if test "$ac_cv_func_getaddrinfo" = "yes"; then |
| 1012 | AC_MSG_CHECKING([if getaddrinfo is threadsafe]) |
| 1013 | case $host_os in |
| 1014 | aix[[1234]].* | aix5.[[01]].*) |
| 1015 | dnl aix 5.1 and older |
| 1016 | tst_tsafe_getaddrinfo="no" |
| 1017 | ;; |
| 1018 | aix*) |
| 1019 | dnl aix 5.2 and newer |
| 1020 | tst_tsafe_getaddrinfo="yes" |
| 1021 | ;; |
| 1022 | darwin[[12345]].*) |
| 1023 | dnl darwin 5.0 and mac os x 10.1.X and older |
| 1024 | tst_tsafe_getaddrinfo="no" |
| 1025 | ;; |
| 1026 | darwin*) |
| 1027 | dnl darwin 6.0 and mac os x 10.2.X and newer |
| 1028 | tst_tsafe_getaddrinfo="yes" |
| 1029 | ;; |
| 1030 | freebsd[[1234]].* | freebsd5.[[1234]]*) |
| 1031 | dnl freebsd 5.4 and older |
| 1032 | tst_tsafe_getaddrinfo="no" |
| 1033 | ;; |
| 1034 | freebsd*) |
| 1035 | dnl freebsd 5.5 and newer |
| 1036 | tst_tsafe_getaddrinfo="yes" |
| 1037 | ;; |
| 1038 | hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*) |
| 1039 | dnl hpux 11.10 and older |
| 1040 | tst_tsafe_getaddrinfo="no" |
| 1041 | ;; |
| 1042 | hpux*) |
| 1043 | dnl hpux 11.11 and newer |
| 1044 | tst_tsafe_getaddrinfo="yes" |
| 1045 | ;; |
| 1046 | netbsd[[123]].*) |
| 1047 | dnl netbsd 3.X and older |
| 1048 | tst_tsafe_getaddrinfo="no" |
| 1049 | ;; |
| 1050 | netbsd*) |
| 1051 | dnl netbsd 4.X and newer |
| 1052 | tst_tsafe_getaddrinfo="yes" |
| 1053 | ;; |
| 1054 | *bsd*) |
| 1055 | dnl All other bsd's |
| 1056 | tst_tsafe_getaddrinfo="no" |
| 1057 | ;; |
| 1058 | solaris2*) |
| 1059 | dnl solaris which have it |
| 1060 | tst_tsafe_getaddrinfo="yes" |
| 1061 | ;; |
| 1062 | esac |
| 1063 | if test "$tst_tsafe_getaddrinfo" = "unknown" && |
| 1064 | test "$ac_cv_native_windows" = "yes"; then |
| 1065 | tst_tsafe_getaddrinfo="yes" |
| 1066 | fi |
| 1067 | if test "$tst_tsafe_getaddrinfo" = "unknown"; then |
| 1068 | CURL_CHECK_DEF_CC([h_errno], [ |
| 1069 | $cares_includes_sys_socket |
| 1070 | $cares_includes_netdb |
| 1071 | ], [silent]) |
| 1072 | if test "$curl_cv_have_def_h_errno" = "yes"; then |
| 1073 | tst_h_errno_macro="yes" |
| 1074 | else |
| 1075 | tst_h_errno_macro="no" |
| 1076 | fi |
| 1077 | AC_COMPILE_IFELSE([ |
| 1078 | AC_LANG_PROGRAM([[ |
| 1079 | $cares_includes_sys_socket |
| 1080 | $cares_includes_netdb |
| 1081 | ]],[[ |
| 1082 | h_errno = 2; |
| 1083 | if(0 != h_errno) |
| 1084 | return 1; |
| 1085 | ]]) |
| 1086 | ],[ |
| 1087 | tst_h_errno_modifiable_lvalue="yes" |
| 1088 | ],[ |
| 1089 | tst_h_errno_modifiable_lvalue="no" |
| 1090 | ]) |
| 1091 | AC_COMPILE_IFELSE([ |
| 1092 | AC_LANG_PROGRAM([[ |
| 1093 | ]],[[ |
| 1094 | #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) |
| 1095 | return 0; |
| 1096 | #elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700) |
| 1097 | return 0; |
| 1098 | #else |
| 1099 | force compilation error |
| 1100 | #endif |
| 1101 | ]]) |
| 1102 | ],[ |
| 1103 | tst_h_errno_sbs_issue_7="yes" |
| 1104 | ],[ |
| 1105 | tst_h_errno_sbs_issue_7="no" |
| 1106 | ]) |
| 1107 | if test "$tst_h_errno_macro" = "no" && |
| 1108 | test "$tst_h_errno_modifiable_lvalue" = "no" && |
| 1109 | test "$tst_h_errno_sbs_issue_7" = "no"; then |
| 1110 | tst_tsafe_getaddrinfo="no" |
| 1111 | else |
| 1112 | tst_tsafe_getaddrinfo="yes" |
| 1113 | fi |
| 1114 | fi |
| 1115 | AC_MSG_RESULT([$tst_tsafe_getaddrinfo]) |
| 1116 | if test "$tst_tsafe_getaddrinfo" = "yes"; then |
| 1117 | AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1, |
| 1118 | [Define to 1 if the getaddrinfo function is threadsafe.]) |
| 1119 | ac_cv_func_getaddrinfo_threadsafe="yes" |
| 1120 | else |
| 1121 | ac_cv_func_getaddrinfo_threadsafe="no" |
| 1122 | fi |
| 1123 | fi |
| 1124 | ]) |
| 1125 | |
| 1126 | |
| 1127 | dnl CARES_CHECK_FUNC_GETENV |
| 1128 | dnl ------------------------------------------------- |
| 1129 | dnl Verify if getenv is available, prototyped, and |
| 1130 | dnl can be compiled. If all of these are true, and |
| 1131 | dnl usage has not been previously disallowed with |
| 1132 | dnl shell variable cares_disallow_getenv, then |
| 1133 | dnl HAVE_GETENV will be defined. |
| 1134 | |
| 1135 | AC_DEFUN([CARES_CHECK_FUNC_GETENV], [ |
| 1136 | AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl |
| 1137 | # |
| 1138 | tst_links_getenv="unknown" |
| 1139 | tst_proto_getenv="unknown" |
| 1140 | tst_compi_getenv="unknown" |
| 1141 | tst_allow_getenv="unknown" |
| 1142 | # |
| 1143 | AC_MSG_CHECKING([if getenv can be linked]) |
| 1144 | AC_LINK_IFELSE([ |
| 1145 | AC_LANG_FUNC_LINK_TRY([getenv]) |
| 1146 | ],[ |
| 1147 | AC_MSG_RESULT([yes]) |
| 1148 | tst_links_getenv="yes" |
| 1149 | ],[ |
| 1150 | AC_MSG_RESULT([no]) |
| 1151 | tst_links_getenv="no" |
| 1152 | ]) |
| 1153 | # |
| 1154 | if test "$tst_links_getenv" = "yes"; then |
| 1155 | AC_MSG_CHECKING([if getenv is prototyped]) |
| 1156 | AC_EGREP_CPP([getenv],[ |
| 1157 | $cares_includes_stdlib |
| 1158 | ],[ |
| 1159 | AC_MSG_RESULT([yes]) |
| 1160 | tst_proto_getenv="yes" |
| 1161 | ],[ |
| 1162 | AC_MSG_RESULT([no]) |
| 1163 | tst_proto_getenv="no" |
| 1164 | ]) |
| 1165 | fi |
| 1166 | # |
| 1167 | if test "$tst_proto_getenv" = "yes"; then |
| 1168 | AC_MSG_CHECKING([if getenv is compilable]) |
| 1169 | AC_COMPILE_IFELSE([ |
| 1170 | AC_LANG_PROGRAM([[ |
| 1171 | $cares_includes_stdlib |
| 1172 | ]],[[ |
| 1173 | if(0 != getenv(0)) |
| 1174 | return 1; |
| 1175 | ]]) |
| 1176 | ],[ |
| 1177 | AC_MSG_RESULT([yes]) |
| 1178 | tst_compi_getenv="yes" |
| 1179 | ],[ |
| 1180 | AC_MSG_RESULT([no]) |
| 1181 | tst_compi_getenv="no" |
| 1182 | ]) |
| 1183 | fi |
| 1184 | # |
| 1185 | if test "$tst_compi_getenv" = "yes"; then |
| 1186 | AC_MSG_CHECKING([if getenv usage allowed]) |
| 1187 | if test "x$cares_disallow_getenv" != "xyes"; then |
| 1188 | AC_MSG_RESULT([yes]) |
| 1189 | tst_allow_getenv="yes" |
| 1190 | else |
| 1191 | AC_MSG_RESULT([no]) |
| 1192 | tst_allow_getenv="no" |
| 1193 | fi |
| 1194 | fi |
| 1195 | # |
| 1196 | AC_MSG_CHECKING([if getenv might be used]) |
| 1197 | if test "$tst_links_getenv" = "yes" && |
| 1198 | test "$tst_proto_getenv" = "yes" && |
| 1199 | test "$tst_compi_getenv" = "yes" && |
| 1200 | test "$tst_allow_getenv" = "yes"; then |
| 1201 | AC_MSG_RESULT([yes]) |
| 1202 | AC_DEFINE_UNQUOTED(HAVE_GETENV, 1, |
| 1203 | [Define to 1 if you have the getenv function.]) |
| 1204 | ac_cv_func_getenv="yes" |
| 1205 | else |
| 1206 | AC_MSG_RESULT([no]) |
| 1207 | ac_cv_func_getenv="no" |
| 1208 | fi |
| 1209 | ]) |
| 1210 | |
| 1211 | |
| 1212 | dnl CARES_CHECK_FUNC_GETHOSTBYADDR |
| 1213 | dnl ------------------------------------------------- |
| 1214 | dnl Verify if gethostbyaddr is available, prototyped, |
| 1215 | dnl and can be compiled. If all of these are true, |
| 1216 | dnl and usage has not been previously disallowed with |
| 1217 | dnl shell variable cares_disallow_gethostbyaddr, then |
| 1218 | dnl HAVE_GETHOSTBYADDR will be defined. |
| 1219 | |
| 1220 | AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYADDR], [ |
| 1221 | AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl |
| 1222 | AC_REQUIRE([CARES_INCLUDES_NETDB])dnl |
| 1223 | # |
| 1224 | tst_links_gethostbyaddr="unknown" |
| 1225 | tst_proto_gethostbyaddr="unknown" |
| 1226 | tst_compi_gethostbyaddr="unknown" |
| 1227 | tst_allow_gethostbyaddr="unknown" |
| 1228 | # |
| 1229 | AC_MSG_CHECKING([if gethostbyaddr can be linked]) |
| 1230 | AC_LINK_IFELSE([ |
| 1231 | AC_LANG_PROGRAM([[ |
| 1232 | $cares_includes_winsock2 |
| 1233 | $cares_includes_netdb |
| 1234 | ]],[[ |
| 1235 | if(0 != gethostbyaddr(0, 0, 0)) |
| 1236 | return 1; |
| 1237 | ]]) |
| 1238 | ],[ |
| 1239 | AC_MSG_RESULT([yes]) |
| 1240 | tst_links_gethostbyaddr="yes" |
| 1241 | ],[ |
| 1242 | AC_MSG_RESULT([no]) |
| 1243 | tst_links_gethostbyaddr="no" |
| 1244 | ]) |
| 1245 | # |
| 1246 | if test "$tst_links_gethostbyaddr" = "yes"; then |
| 1247 | AC_MSG_CHECKING([if gethostbyaddr is prototyped]) |
| 1248 | AC_EGREP_CPP([gethostbyaddr],[ |
| 1249 | $cares_includes_winsock2 |
| 1250 | $cares_includes_netdb |
| 1251 | ],[ |
| 1252 | AC_MSG_RESULT([yes]) |
| 1253 | tst_proto_gethostbyaddr="yes" |
| 1254 | ],[ |
| 1255 | AC_MSG_RESULT([no]) |
| 1256 | tst_proto_gethostbyaddr="no" |
| 1257 | ]) |
| 1258 | fi |
| 1259 | # |
| 1260 | if test "$tst_proto_gethostbyaddr" = "yes"; then |
| 1261 | AC_MSG_CHECKING([if gethostbyaddr is compilable]) |
| 1262 | AC_COMPILE_IFELSE([ |
| 1263 | AC_LANG_PROGRAM([[ |
| 1264 | $cares_includes_winsock2 |
| 1265 | $cares_includes_netdb |
| 1266 | ]],[[ |
| 1267 | if(0 != gethostbyaddr(0, 0, 0)) |
| 1268 | return 1; |
| 1269 | ]]) |
| 1270 | ],[ |
| 1271 | AC_MSG_RESULT([yes]) |
| 1272 | tst_compi_gethostbyaddr="yes" |
| 1273 | ],[ |
| 1274 | AC_MSG_RESULT([no]) |
| 1275 | tst_compi_gethostbyaddr="no" |
| 1276 | ]) |
| 1277 | fi |
| 1278 | # |
| 1279 | if test "$tst_compi_gethostbyaddr" = "yes"; then |
| 1280 | AC_MSG_CHECKING([if gethostbyaddr usage allowed]) |
| 1281 | if test "x$cares_disallow_gethostbyaddr" != "xyes"; then |
| 1282 | AC_MSG_RESULT([yes]) |
| 1283 | tst_allow_gethostbyaddr="yes" |
| 1284 | else |
| 1285 | AC_MSG_RESULT([no]) |
| 1286 | tst_allow_gethostbyaddr="no" |
| 1287 | fi |
| 1288 | fi |
| 1289 | # |
| 1290 | AC_MSG_CHECKING([if gethostbyaddr might be used]) |
| 1291 | if test "$tst_links_gethostbyaddr" = "yes" && |
| 1292 | test "$tst_proto_gethostbyaddr" = "yes" && |
| 1293 | test "$tst_compi_gethostbyaddr" = "yes" && |
| 1294 | test "$tst_allow_gethostbyaddr" = "yes"; then |
| 1295 | AC_MSG_RESULT([yes]) |
| 1296 | AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYADDR, 1, |
| 1297 | [Define to 1 if you have the gethostbyaddr function.]) |
| 1298 | ac_cv_func_gethostbyaddr="yes" |
| 1299 | else |
| 1300 | AC_MSG_RESULT([no]) |
| 1301 | ac_cv_func_gethostbyaddr="no" |
| 1302 | fi |
| 1303 | ]) |
| 1304 | |
| 1305 | |
| 1306 | dnl CARES_CHECK_FUNC_GETHOSTBYNAME |
| 1307 | dnl ------------------------------------------------- |
| 1308 | dnl Verify if gethostbyname is available, prototyped, |
| 1309 | dnl and can be compiled. If all of these are true, |
| 1310 | dnl and usage has not been previously disallowed with |
| 1311 | dnl shell variable cares_disallow_gethostbyname, then |
| 1312 | dnl HAVE_GETHOSTBYNAME will be defined. |
| 1313 | |
| 1314 | AC_DEFUN([CARES_CHECK_FUNC_GETHOSTBYNAME], [ |
| 1315 | AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl |
| 1316 | AC_REQUIRE([CARES_INCLUDES_NETDB])dnl |
| 1317 | # |
| 1318 | tst_links_gethostbyname="unknown" |
| 1319 | tst_proto_gethostbyname="unknown" |
| 1320 | tst_compi_gethostbyname="unknown" |
| 1321 | tst_allow_gethostbyname="unknown" |
| 1322 | # |
| 1323 | AC_MSG_CHECKING([if gethostbyname can be linked]) |
| 1324 | AC_LINK_IFELSE([ |
| 1325 | AC_LANG_PROGRAM([[ |
| 1326 | $cares_includes_winsock2 |
| 1327 | $cares_includes_netdb |
| 1328 | ]],[[ |
| 1329 | if(0 != gethostbyname(0)) |
| 1330 | return 1; |
| 1331 | ]]) |
| 1332 | ],[ |
| 1333 | AC_MSG_RESULT([yes]) |
| 1334 | tst_links_gethostbyname="yes" |
| 1335 | ],[ |
| 1336 | AC_MSG_RESULT([no]) |
| 1337 | tst_links_gethostbyname="no" |
| 1338 | ]) |
| 1339 | # |
| 1340 | if test "$tst_links_gethostbyname" = "yes"; then |
| 1341 | AC_MSG_CHECKING([if gethostbyname is prototyped]) |
| 1342 | AC_EGREP_CPP([gethostbyname],[ |
| 1343 | $cares_includes_winsock2 |
| 1344 | $cares_includes_netdb |
| 1345 | ],[ |
| 1346 | AC_MSG_RESULT([yes]) |
| 1347 | tst_proto_gethostbyname="yes" |
| 1348 | ],[ |
| 1349 | AC_MSG_RESULT([no]) |
| 1350 | tst_proto_gethostbyname="no" |
| 1351 | ]) |
| 1352 | fi |
| 1353 | # |
| 1354 | if test "$tst_proto_gethostbyname" = "yes"; then |
| 1355 | AC_MSG_CHECKING([if gethostbyname is compilable]) |
| 1356 | AC_COMPILE_IFELSE([ |
| 1357 | AC_LANG_PROGRAM([[ |
| 1358 | $cares_includes_winsock2 |
| 1359 | $cares_includes_netdb |
| 1360 | ]],[[ |
| 1361 | if(0 != gethostbyname(0)) |
| 1362 | return 1; |
| 1363 | ]]) |
| 1364 | ],[ |
| 1365 | AC_MSG_RESULT([yes]) |
| 1366 | tst_compi_gethostbyname="yes" |
| 1367 | ],[ |
| 1368 | AC_MSG_RESULT([no]) |
| 1369 | tst_compi_gethostbyname="no" |
| 1370 | ]) |
| 1371 | fi |
| 1372 | # |
| 1373 | if test "$tst_compi_gethostbyname" = "yes"; then |
| 1374 | AC_MSG_CHECKING([if gethostbyname usage allowed]) |
| 1375 | if test "x$cares_disallow_gethostbyname" != "xyes"; then |
| 1376 | AC_MSG_RESULT([yes]) |
| 1377 | tst_allow_gethostbyname="yes" |
| 1378 | else |
| 1379 | AC_MSG_RESULT([no]) |
| 1380 | tst_allow_gethostbyname="no" |
| 1381 | fi |
| 1382 | fi |
| 1383 | # |
| 1384 | AC_MSG_CHECKING([if gethostbyname might be used]) |
| 1385 | if test "$tst_links_gethostbyname" = "yes" && |
| 1386 | test "$tst_proto_gethostbyname" = "yes" && |
| 1387 | test "$tst_compi_gethostbyname" = "yes" && |
| 1388 | test "$tst_allow_gethostbyname" = "yes"; then |
| 1389 | AC_MSG_RESULT([yes]) |
| 1390 | AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1, |
| 1391 | [Define to 1 if you have the gethostbyname function.]) |
| 1392 | ac_cv_func_gethostbyname="yes" |
| 1393 | else |
| 1394 | AC_MSG_RESULT([no]) |
| 1395 | ac_cv_func_gethostbyname="no" |
| 1396 | fi |
| 1397 | ]) |
| 1398 | |
| 1399 | |
| 1400 | dnl CARES_CHECK_FUNC_GETHOSTNAME |
| 1401 | dnl ------------------------------------------------- |
| 1402 | dnl Verify if gethostname is available, prototyped, and |
| 1403 | dnl can be compiled. If all of these are true, and |
| 1404 | dnl usage has not been previously disallowed with |
| 1405 | dnl shell variable cares_disallow_gethostname, then |
| 1406 | dnl HAVE_GETHOSTNAME will be defined. |
| 1407 | |
| 1408 | AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ |
| 1409 | AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl |
| 1410 | AC_REQUIRE([CARES_INCLUDES_UNISTD])dnl |
| 1411 | AC_REQUIRE([CARES_PREPROCESS_CALLCONV])dnl |
| 1412 | # |
| 1413 | tst_links_gethostname="unknown" |
| 1414 | tst_proto_gethostname="unknown" |
| 1415 | tst_compi_gethostname="unknown" |
| 1416 | tst_allow_gethostname="unknown" |
| 1417 | # |
| 1418 | AC_MSG_CHECKING([if gethostname can be linked]) |
| 1419 | AC_LINK_IFELSE([ |
| 1420 | AC_LANG_PROGRAM([[ |
| 1421 | $cares_includes_winsock2 |
| 1422 | $cares_includes_unistd |
| 1423 | ]],[[ |
| 1424 | if(0 != gethostname(0, 0)) |
| 1425 | return 1; |
| 1426 | ]]) |
| 1427 | ],[ |
| 1428 | AC_MSG_RESULT([yes]) |
| 1429 | tst_links_gethostname="yes" |
| 1430 | ],[ |
| 1431 | AC_MSG_RESULT([no]) |
| 1432 | tst_links_gethostname="no" |
| 1433 | ]) |
| 1434 | # |
| 1435 | if test "$tst_links_gethostname" = "yes"; then |
| 1436 | AC_MSG_CHECKING([if gethostname is prototyped]) |
| 1437 | AC_EGREP_CPP([gethostname],[ |
| 1438 | $cares_includes_winsock2 |
| 1439 | $cares_includes_unistd |
| 1440 | ],[ |
| 1441 | AC_MSG_RESULT([yes]) |
| 1442 | tst_proto_gethostname="yes" |
| 1443 | ],[ |
| 1444 | AC_MSG_RESULT([no]) |
| 1445 | tst_proto_gethostname="no" |
| 1446 | ]) |
| 1447 | fi |
| 1448 | # |
| 1449 | if test "$tst_proto_gethostname" = "yes"; then |
| 1450 | AC_MSG_CHECKING([if gethostname is compilable]) |
| 1451 | AC_COMPILE_IFELSE([ |
| 1452 | AC_LANG_PROGRAM([[ |
| 1453 | $cares_includes_winsock2 |
| 1454 | $cares_includes_unistd |
| 1455 | ]],[[ |
| 1456 | if(0 != gethostname(0, 0)) |
| 1457 | return 1; |
| 1458 | ]]) |
| 1459 | ],[ |
| 1460 | AC_MSG_RESULT([yes]) |
| 1461 | tst_compi_gethostname="yes" |
| 1462 | ],[ |
| 1463 | AC_MSG_RESULT([no]) |
| 1464 | tst_compi_gethostname="no" |
| 1465 | ]) |
| 1466 | fi |
| 1467 | # |
| 1468 | if test "$tst_compi_gethostname" = "yes"; then |
| 1469 | AC_MSG_CHECKING([for gethostname arg 2 data type]) |
| 1470 | tst_gethostname_type_arg2="unknown" |
| 1471 | for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do |
| 1472 | for tst_arg2 in 'int' 'unsigned int' 'size_t'; do |
| 1473 | if test "$tst_gethostname_type_arg2" = "unknown"; then |
| 1474 | AC_COMPILE_IFELSE([ |
| 1475 | AC_LANG_PROGRAM([[ |
| 1476 | $cares_includes_winsock2 |
| 1477 | $cares_includes_unistd |
| 1478 | $cares_preprocess_callconv |
| 1479 | extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2); |
| 1480 | ]],[[ |
| 1481 | if(0 != gethostname(0, 0)) |
| 1482 | return 1; |
| 1483 | ]]) |
| 1484 | ],[ |
| 1485 | tst_gethostname_type_arg2="$tst_arg2" |
| 1486 | ]) |
| 1487 | fi |
| 1488 | done |
| 1489 | done |
| 1490 | AC_MSG_RESULT([$tst_gethostname_type_arg2]) |
| 1491 | if test "$tst_gethostname_type_arg2" != "unknown"; then |
| 1492 | AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2, |
| 1493 | [Define to the type of arg 2 for gethostname.]) |
| 1494 | fi |
| 1495 | fi |
| 1496 | # |
| 1497 | if test "$tst_compi_gethostname" = "yes"; then |
| 1498 | AC_MSG_CHECKING([if gethostname usage allowed]) |
| 1499 | if test "x$cares_disallow_gethostname" != "xyes"; then |
| 1500 | AC_MSG_RESULT([yes]) |
| 1501 | tst_allow_gethostname="yes" |
| 1502 | else |
| 1503 | AC_MSG_RESULT([no]) |
| 1504 | tst_allow_gethostname="no" |
| 1505 | fi |
| 1506 | fi |
| 1507 | # |
| 1508 | AC_MSG_CHECKING([if gethostname might be used]) |
| 1509 | if test "$tst_links_gethostname" = "yes" && |
| 1510 | test "$tst_proto_gethostname" = "yes" && |
| 1511 | test "$tst_compi_gethostname" = "yes" && |
| 1512 | test "$tst_allow_gethostname" = "yes"; then |
| 1513 | AC_MSG_RESULT([yes]) |
| 1514 | AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1, |
| 1515 | [Define to 1 if you have the gethostname function.]) |
| 1516 | ac_cv_func_gethostname="yes" |
| 1517 | else |
| 1518 | AC_MSG_RESULT([no]) |
| 1519 | ac_cv_func_gethostname="no" |
| 1520 | fi |
| 1521 | ]) |
| 1522 | |
| 1523 | |
| 1524 | dnl CARES_CHECK_FUNC_GETSERVBYPORT_R |
| 1525 | dnl ------------------------------------------------- |
| 1526 | dnl Verify if getservbyport_r is available, prototyped, |
| 1527 | dnl and can be compiled. If all of these are true, and |
| 1528 | dnl usage has not been previously disallowed with |
| 1529 | dnl shell variable cares_disallow_getservbyport_r, then |
| 1530 | dnl HAVE_GETSERVBYPORT_R will be defined. |
| 1531 | |
| 1532 | AC_DEFUN([CARES_CHECK_FUNC_GETSERVBYPORT_R], [ |
| 1533 | AC_REQUIRE([CARES_INCLUDES_NETDB])dnl |
| 1534 | # |
| 1535 | tst_links_getservbyport_r="unknown" |
| 1536 | tst_proto_getservbyport_r="unknown" |
| 1537 | tst_compi_getservbyport_r="unknown" |
| 1538 | tst_allow_getservbyport_r="unknown" |
| 1539 | tst_nargs_getservbyport_r="unknown" |
| 1540 | # |
| 1541 | AC_MSG_CHECKING([if getservbyport_r can be linked]) |
| 1542 | AC_LINK_IFELSE([ |
| 1543 | AC_LANG_FUNC_LINK_TRY([getservbyport_r]) |
| 1544 | ],[ |
| 1545 | AC_MSG_RESULT([yes]) |
| 1546 | tst_links_getservbyport_r="yes" |
| 1547 | ],[ |
| 1548 | AC_MSG_RESULT([no]) |
| 1549 | tst_links_getservbyport_r="no" |
| 1550 | ]) |
| 1551 | # |
| 1552 | if test "$tst_links_getservbyport_r" = "yes"; then |
| 1553 | AC_MSG_CHECKING([if getservbyport_r is prototyped]) |
| 1554 | AC_EGREP_CPP([getservbyport_r],[ |
| 1555 | $cares_includes_netdb |
| 1556 | ],[ |
| 1557 | AC_MSG_RESULT([yes]) |
| 1558 | tst_proto_getservbyport_r="yes" |
| 1559 | ],[ |
| 1560 | AC_MSG_RESULT([no]) |
| 1561 | tst_proto_getservbyport_r="no" |
| 1562 | ]) |
| 1563 | fi |
| 1564 | # |
| 1565 | if test "$tst_proto_getservbyport_r" = "yes"; then |
| 1566 | if test "$tst_nargs_getservbyport_r" = "unknown"; then |
| 1567 | AC_MSG_CHECKING([if getservbyport_r takes 4 args.]) |
| 1568 | AC_COMPILE_IFELSE([ |
| 1569 | AC_LANG_PROGRAM([[ |
| 1570 | $cares_includes_netdb |
| 1571 | ]],[[ |
| 1572 | if(0 != getservbyport_r(0, 0, 0, 0)) |
| 1573 | return 1; |
| 1574 | ]]) |
| 1575 | ],[ |
| 1576 | AC_MSG_RESULT([yes]) |
| 1577 | tst_compi_getservbyport_r="yes" |
| 1578 | tst_nargs_getservbyport_r="4" |
| 1579 | ],[ |
| 1580 | AC_MSG_RESULT([no]) |
| 1581 | tst_compi_getservbyport_r="no" |
| 1582 | ]) |
| 1583 | fi |
| 1584 | if test "$tst_nargs_getservbyport_r" = "unknown"; then |
| 1585 | AC_MSG_CHECKING([if getservbyport_r takes 5 args.]) |
| 1586 | AC_COMPILE_IFELSE([ |
| 1587 | AC_LANG_PROGRAM([[ |
| 1588 | $cares_includes_netdb |
| 1589 | ]],[[ |
| 1590 | if(0 != getservbyport_r(0, 0, 0, 0, 0)) |
| 1591 | return 1; |
| 1592 | ]]) |
| 1593 | ],[ |
| 1594 | AC_MSG_RESULT([yes]) |
| 1595 | tst_compi_getservbyport_r="yes" |
| 1596 | tst_nargs_getservbyport_r="5" |
| 1597 | ],[ |
| 1598 | AC_MSG_RESULT([no]) |
| 1599 | tst_compi_getservbyport_r="no" |
| 1600 | ]) |
| 1601 | fi |
| 1602 | if test "$tst_nargs_getservbyport_r" = "unknown"; then |
| 1603 | AC_MSG_CHECKING([if getservbyport_r takes 6 args.]) |
| 1604 | AC_COMPILE_IFELSE([ |
| 1605 | AC_LANG_PROGRAM([[ |
| 1606 | $cares_includes_netdb |
| 1607 | ]],[[ |
| 1608 | if(0 != getservbyport_r(0, 0, 0, 0, 0, 0)) |
| 1609 | return 1; |
| 1610 | ]]) |
| 1611 | ],[ |
| 1612 | AC_MSG_RESULT([yes]) |
| 1613 | tst_compi_getservbyport_r="yes" |
| 1614 | tst_nargs_getservbyport_r="6" |
| 1615 | ],[ |
| 1616 | AC_MSG_RESULT([no]) |
| 1617 | tst_compi_getservbyport_r="no" |
| 1618 | ]) |
| 1619 | fi |
| 1620 | AC_MSG_CHECKING([if getservbyport_r is compilable]) |
| 1621 | if test "$tst_compi_getservbyport_r" = "yes"; then |
| 1622 | AC_MSG_RESULT([yes]) |
| 1623 | else |
| 1624 | AC_MSG_RESULT([no]) |
| 1625 | fi |
| 1626 | fi |
| 1627 | # |
| 1628 | if test "$tst_compi_getservbyport_r" = "yes"; then |
| 1629 | AC_MSG_CHECKING([if getservbyport_r usage allowed]) |
| 1630 | if test "x$cares_disallow_getservbyport_r" != "xyes"; then |
| 1631 | AC_MSG_RESULT([yes]) |
| 1632 | tst_allow_getservbyport_r="yes" |
| 1633 | else |
| 1634 | AC_MSG_RESULT([no]) |
| 1635 | tst_allow_getservbyport_r="no" |
| 1636 | fi |
| 1637 | fi |
| 1638 | # |
| 1639 | AC_MSG_CHECKING([if getservbyport_r might be used]) |
| 1640 | if test "$tst_links_getservbyport_r" = "yes" && |
| 1641 | test "$tst_proto_getservbyport_r" = "yes" && |
| 1642 | test "$tst_compi_getservbyport_r" = "yes" && |
| 1643 | test "$tst_allow_getservbyport_r" = "yes"; then |
| 1644 | AC_MSG_RESULT([yes]) |
| 1645 | AC_DEFINE_UNQUOTED(HAVE_GETSERVBYPORT_R, 1, |
| 1646 | [Define to 1 if you have the getservbyport_r function.]) |
| 1647 | AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $tst_nargs_getservbyport_r, |
| 1648 | [Specifies the number of arguments to getservbyport_r]) |
| 1649 | if test "$tst_nargs_getservbyport_r" -eq "4"; then |
| 1650 | AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data), |
| 1651 | [Specifies the size of the buffer to pass to getservbyport_r]) |
| 1652 | else |
| 1653 | AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096, |
| 1654 | [Specifies the size of the buffer to pass to getservbyport_r]) |
| 1655 | fi |
| 1656 | ac_cv_func_getservbyport_r="yes" |
| 1657 | else |
| 1658 | AC_MSG_RESULT([no]) |
| 1659 | ac_cv_func_getservbyport_r="no" |
| 1660 | fi |
| 1661 | ]) |
| 1662 | |
| 1663 | |
| 1664 | dnl CARES_CHECK_FUNC_INET_NET_PTON |
| 1665 | dnl ------------------------------------------------- |
| 1666 | dnl Verify if inet_net_pton is available, prototyped, can |
| 1667 | dnl be compiled and seems to work. If all of these are |
| 1668 | dnl true, and usage has not been previously disallowed |
| 1669 | dnl with shell variable cares_disallow_inet_net_pton, then |
| 1670 | dnl HAVE_INET_NET_PTON will be defined. |
| 1671 | |
| 1672 | AC_DEFUN([CARES_CHECK_FUNC_INET_NET_PTON], [ |
| 1673 | AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl |
| 1674 | AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl |
| 1675 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 1676 | # |
| 1677 | tst_links_inet_net_pton="unknown" |
| 1678 | tst_proto_inet_net_pton="unknown" |
| 1679 | tst_compi_inet_net_pton="unknown" |
| 1680 | tst_works_inet_net_pton="unknown" |
| 1681 | tst_allow_inet_net_pton="unknown" |
| 1682 | # |
| 1683 | AC_MSG_CHECKING([if inet_net_pton can be linked]) |
| 1684 | AC_LINK_IFELSE([ |
| 1685 | AC_LANG_FUNC_LINK_TRY([inet_net_pton]) |
| 1686 | ],[ |
| 1687 | AC_MSG_RESULT([yes]) |
| 1688 | tst_links_inet_net_pton="yes" |
| 1689 | ],[ |
| 1690 | AC_MSG_RESULT([no]) |
| 1691 | tst_links_inet_net_pton="no" |
| 1692 | ]) |
| 1693 | # |
| 1694 | if test "$tst_links_inet_net_pton" = "yes"; then |
| 1695 | AC_MSG_CHECKING([if inet_net_pton is prototyped]) |
| 1696 | AC_EGREP_CPP([inet_net_pton],[ |
| 1697 | $cares_includes_arpa_inet |
| 1698 | ],[ |
| 1699 | AC_MSG_RESULT([yes]) |
| 1700 | tst_proto_inet_net_pton="yes" |
| 1701 | ],[ |
| 1702 | AC_MSG_RESULT([no]) |
| 1703 | tst_proto_inet_net_pton="no" |
| 1704 | ]) |
| 1705 | fi |
| 1706 | # |
| 1707 | if test "$tst_proto_inet_net_pton" = "yes"; then |
| 1708 | AC_MSG_CHECKING([if inet_net_pton is compilable]) |
| 1709 | AC_COMPILE_IFELSE([ |
| 1710 | AC_LANG_PROGRAM([[ |
| 1711 | $cares_includes_arpa_inet |
| 1712 | ]],[[ |
| 1713 | if(0 != inet_net_pton(0, 0, 0, 0)) |
| 1714 | return 1; |
| 1715 | ]]) |
| 1716 | ],[ |
| 1717 | AC_MSG_RESULT([yes]) |
| 1718 | tst_compi_inet_net_pton="yes" |
| 1719 | ],[ |
| 1720 | AC_MSG_RESULT([no]) |
| 1721 | tst_compi_inet_net_pton="no" |
| 1722 | ]) |
| 1723 | fi |
| 1724 | # |
| 1725 | dnl only do runtime verification when not cross-compiling |
| 1726 | if test "x$cross_compiling" != "xyes" && |
| 1727 | test "$tst_compi_inet_net_pton" = "yes"; then |
| 1728 | AC_MSG_CHECKING([if inet_net_pton seems to work]) |
| 1729 | AC_RUN_IFELSE([ |
| 1730 | AC_LANG_PROGRAM([[ |
| 1731 | $cares_includes_stdlib |
| 1732 | $cares_includes_arpa_inet |
| 1733 | $cares_includes_string |
| 1734 | ]],[[ |
| 1735 | unsigned char ipv6a[16+1]; |
| 1736 | unsigned char ipv4a[4+1]; |
| 1737 | const char *ipv6net1 = "fe80::214:4fff:fe0b:76c8"; |
| 1738 | const char *ipv6net2 = "::fffe:7f00:1"; |
| 1739 | const char *ipv6net3 = "7f20:1::/64"; |
| 1740 | const char *ipv6net4 = "7f20:1::/2147483649"; |
| 1741 | const char *ipv4net1 = "192.168.100.1"; |
| 1742 | const char *ipv4net2 = "192.168.100/32"; |
| 1743 | const char *ipv4net3 = "192.168.100.1/2147483649"; |
| 1744 | /* - */ |
| 1745 | memset(ipv4a, 1, sizeof(ipv4a)); |
| 1746 | if(32 != inet_net_pton(AF_INET, ipv4net1, ipv4a, 4)) |
| 1747 | exit(1); /* fail */ |
| 1748 | /* - */ |
| 1749 | if( (ipv4a[0x00] != 0xc0) || |
| 1750 | (ipv4a[0x01] != 0xa8) || |
| 1751 | (ipv4a[0x02] != 0x64) || |
| 1752 | (ipv4a[0x03] != 0x01) || |
| 1753 | (ipv4a[0x04] != 0x01) ) |
| 1754 | exit(1); /* fail */ |
| 1755 | /* - */ |
| 1756 | memset(ipv4a, 1, sizeof(ipv4a)); |
| 1757 | if(32 != inet_net_pton(AF_INET, ipv4net2, ipv4a, 4)) |
| 1758 | exit(1); /* fail */ |
| 1759 | /* - */ |
| 1760 | if( (ipv4a[0x00] != 0xc0) || |
| 1761 | (ipv4a[0x01] != 0xa8) || |
| 1762 | (ipv4a[0x02] != 0x64) || |
| 1763 | (ipv4a[0x03] != 0x00) || |
| 1764 | (ipv4a[0x04] != 0x01) ) |
| 1765 | exit(1); /* fail */ |
| 1766 | /* - */ |
| 1767 | memset(ipv4a, 1, sizeof(ipv4a)); |
| 1768 | if(-1 != inet_net_pton(AF_INET, ipv4net3, ipv4a, 4)) |
| 1769 | exit(1); /* fail */ |
| 1770 | /* - */ |
| 1771 | memset(ipv6a, 1, sizeof(ipv6a)); |
| 1772 | if(128 != inet_net_pton(AF_INET6, ipv6net1, ipv6a, 16)) |
| 1773 | exit(1); /* fail */ |
| 1774 | /* - */ |
| 1775 | if( (ipv6a[0x00] != 0xfe) || |
| 1776 | (ipv6a[0x01] != 0x80) || |
| 1777 | (ipv6a[0x08] != 0x02) || |
| 1778 | (ipv6a[0x09] != 0x14) || |
| 1779 | (ipv6a[0x0a] != 0x4f) || |
| 1780 | (ipv6a[0x0b] != 0xff) || |
| 1781 | (ipv6a[0x0c] != 0xfe) || |
| 1782 | (ipv6a[0x0d] != 0x0b) || |
| 1783 | (ipv6a[0x0e] != 0x76) || |
| 1784 | (ipv6a[0x0f] != 0xc8) || |
| 1785 | (ipv6a[0x10] != 0x01) ) |
| 1786 | exit(1); /* fail */ |
| 1787 | /* - */ |
| 1788 | if( (ipv6a[0x02] != 0x0) || |
| 1789 | (ipv6a[0x03] != 0x0) || |
| 1790 | (ipv6a[0x04] != 0x0) || |
| 1791 | (ipv6a[0x05] != 0x0) || |
| 1792 | (ipv6a[0x06] != 0x0) || |
| 1793 | (ipv6a[0x07] != 0x0) ) |
| 1794 | exit(1); /* fail */ |
| 1795 | /* - */ |
| 1796 | memset(ipv6a, 0, sizeof(ipv6a)); |
| 1797 | ipv6a[0x10] = 0x01; |
| 1798 | if(128 != inet_net_pton(AF_INET6, ipv6net2, ipv6a, 16)) |
| 1799 | exit(1); /* fail */ |
| 1800 | /* - */ |
| 1801 | if( (ipv6a[0x0a] != 0xff) || |
| 1802 | (ipv6a[0x0b] != 0xfe) || |
| 1803 | (ipv6a[0x0c] != 0x7f) || |
| 1804 | (ipv6a[0x0f] != 0x01) || |
| 1805 | (ipv6a[0x10] != 0x01) ) |
| 1806 | exit(1); /* fail */ |
| 1807 | /* - */ |
| 1808 | if( (ipv6a[0x00] != 0x0) || |
| 1809 | (ipv6a[0x01] != 0x0) || |
| 1810 | (ipv6a[0x02] != 0x0) || |
| 1811 | (ipv6a[0x03] != 0x0) || |
| 1812 | (ipv6a[0x04] != 0x0) || |
| 1813 | (ipv6a[0x05] != 0x0) || |
| 1814 | (ipv6a[0x06] != 0x0) || |
| 1815 | (ipv6a[0x07] != 0x0) || |
| 1816 | (ipv6a[0x08] != 0x0) || |
| 1817 | (ipv6a[0x09] != 0x0) || |
| 1818 | (ipv6a[0x0d] != 0x0) || |
| 1819 | (ipv6a[0x0e] != 0x0) ) |
| 1820 | exit(1); /* fail */ |
| 1821 | /* - */ |
| 1822 | memset(ipv6a, 1, sizeof(ipv6a)); |
| 1823 | if(64 != inet_net_pton(AF_INET6, ipv6net3, ipv6a, 16)) |
| 1824 | exit(1); /* fail */ |
| 1825 | if( (ipv6a[0x00] != 0x7f) || |
| 1826 | (ipv6a[0x01] != 0x20) || |
| 1827 | (ipv6a[0x03] != 0x01) || |
| 1828 | (ipv6a[0x08] != 0x01) || |
| 1829 | (ipv6a[0x09] != 0x01) || |
| 1830 | (ipv6a[0x0a] != 0x01) || |
| 1831 | (ipv6a[0x0b] != 0x01) || |
| 1832 | (ipv6a[0x0c] != 0x01) || |
| 1833 | (ipv6a[0x0d] != 0x01) || |
| 1834 | (ipv6a[0x0e] != 0x01) || |
| 1835 | (ipv6a[0x0f] != 0x01) || |
| 1836 | (ipv6a[0x10] != 0x01) ) |
| 1837 | exit(1); /* fail */ |
| 1838 | if( (ipv6a[0x02] != 0x0) || |
| 1839 | (ipv6a[0x04] != 0x0) || |
| 1840 | (ipv6a[0x05] != 0x0) || |
| 1841 | (ipv6a[0x06] != 0x0) || |
| 1842 | (ipv6a[0x07] != 0x0) || |
| 1843 | (ipv6a[0x07] != 0x0) ) |
| 1844 | exit(1); /* fail */ |
| 1845 | /* - */ |
| 1846 | memset(ipv6a, 1, sizeof(ipv6a)); |
| 1847 | if(-1 != inet_net_pton(AF_INET6, ipv6net4, ipv6a, 16)) |
| 1848 | exit(1); /* fail */ |
| 1849 | /* - */ |
| 1850 | exit(0); |
| 1851 | ]]) |
| 1852 | ],[ |
| 1853 | AC_MSG_RESULT([yes]) |
| 1854 | tst_works_inet_net_pton="yes" |
| 1855 | ],[ |
| 1856 | AC_MSG_RESULT([no]) |
| 1857 | tst_works_inet_net_pton="no" |
| 1858 | ]) |
| 1859 | fi |
| 1860 | # |
| 1861 | if test "$tst_compi_inet_net_pton" = "yes" && |
| 1862 | test "$tst_works_inet_net_pton" != "no"; then |
| 1863 | AC_MSG_CHECKING([if inet_net_pton usage allowed]) |
| 1864 | if test "x$cares_disallow_inet_net_pton" != "xyes"; then |
| 1865 | AC_MSG_RESULT([yes]) |
| 1866 | tst_allow_inet_net_pton="yes" |
| 1867 | else |
| 1868 | AC_MSG_RESULT([no]) |
| 1869 | tst_allow_inet_net_pton="no" |
| 1870 | fi |
| 1871 | fi |
| 1872 | # |
| 1873 | AC_MSG_CHECKING([if inet_net_pton might be used]) |
| 1874 | if test "$tst_links_inet_net_pton" = "yes" && |
| 1875 | test "$tst_proto_inet_net_pton" = "yes" && |
| 1876 | test "$tst_compi_inet_net_pton" = "yes" && |
| 1877 | test "$tst_allow_inet_net_pton" = "yes" && |
| 1878 | test "$tst_works_inet_net_pton" != "no"; then |
| 1879 | AC_MSG_RESULT([yes]) |
| 1880 | AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON, 1, |
| 1881 | [Define to 1 if you have a IPv6 capable working inet_net_pton function.]) |
| 1882 | ac_cv_func_inet_net_pton="yes" |
| 1883 | else |
| 1884 | AC_MSG_RESULT([no]) |
| 1885 | ac_cv_func_inet_net_pton="no" |
| 1886 | fi |
| 1887 | ]) |
| 1888 | |
| 1889 | |
| 1890 | dnl CARES_CHECK_FUNC_INET_NTOP |
| 1891 | dnl ------------------------------------------------- |
| 1892 | dnl Verify if inet_ntop is available, prototyped, can |
| 1893 | dnl be compiled and seems to work. If all of these are |
| 1894 | dnl true, and usage has not been previously disallowed |
| 1895 | dnl with shell variable cares_disallow_inet_ntop, then |
| 1896 | dnl HAVE_INET_NTOP will be defined. |
| 1897 | |
| 1898 | AC_DEFUN([CARES_CHECK_FUNC_INET_NTOP], [ |
| 1899 | AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl |
| 1900 | AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl |
| 1901 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 1902 | # |
| 1903 | tst_links_inet_ntop="unknown" |
| 1904 | tst_proto_inet_ntop="unknown" |
| 1905 | tst_compi_inet_ntop="unknown" |
| 1906 | tst_works_inet_ntop="unknown" |
| 1907 | tst_allow_inet_ntop="unknown" |
| 1908 | # |
| 1909 | AC_MSG_CHECKING([if inet_ntop can be linked]) |
| 1910 | AC_LINK_IFELSE([ |
| 1911 | AC_LANG_FUNC_LINK_TRY([inet_ntop]) |
| 1912 | ],[ |
| 1913 | AC_MSG_RESULT([yes]) |
| 1914 | tst_links_inet_ntop="yes" |
| 1915 | ],[ |
| 1916 | AC_MSG_RESULT([no]) |
| 1917 | tst_links_inet_ntop="no" |
| 1918 | ]) |
| 1919 | # |
| 1920 | if test "$tst_links_inet_ntop" = "yes"; then |
| 1921 | AC_MSG_CHECKING([if inet_ntop is prototyped]) |
| 1922 | AC_EGREP_CPP([inet_ntop],[ |
| 1923 | $cares_includes_arpa_inet |
| 1924 | ],[ |
| 1925 | AC_MSG_RESULT([yes]) |
| 1926 | tst_proto_inet_ntop="yes" |
| 1927 | ],[ |
| 1928 | AC_MSG_RESULT([no]) |
| 1929 | tst_proto_inet_ntop="no" |
| 1930 | ]) |
| 1931 | fi |
| 1932 | # |
| 1933 | if test "$tst_proto_inet_ntop" = "yes"; then |
| 1934 | AC_MSG_CHECKING([if inet_ntop is compilable]) |
| 1935 | AC_COMPILE_IFELSE([ |
| 1936 | AC_LANG_PROGRAM([[ |
| 1937 | $cares_includes_arpa_inet |
| 1938 | ]],[[ |
| 1939 | if(0 != inet_ntop(0, 0, 0, 0)) |
| 1940 | return 1; |
| 1941 | ]]) |
| 1942 | ],[ |
| 1943 | AC_MSG_RESULT([yes]) |
| 1944 | tst_compi_inet_ntop="yes" |
| 1945 | ],[ |
| 1946 | AC_MSG_RESULT([no]) |
| 1947 | tst_compi_inet_ntop="no" |
| 1948 | ]) |
| 1949 | fi |
| 1950 | # |
| 1951 | dnl only do runtime verification when not cross-compiling |
| 1952 | if test "x$cross_compiling" != "xyes" && |
| 1953 | test "$tst_compi_inet_ntop" = "yes"; then |
| 1954 | AC_MSG_CHECKING([if inet_ntop seems to work]) |
| 1955 | AC_RUN_IFELSE([ |
| 1956 | AC_LANG_PROGRAM([[ |
| 1957 | $cares_includes_stdlib |
| 1958 | $cares_includes_arpa_inet |
| 1959 | $cares_includes_string |
| 1960 | ]],[[ |
| 1961 | char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; |
| 1962 | char ipv4res[sizeof "255.255.255.255"]; |
| 1963 | unsigned char ipv6a[26]; |
| 1964 | unsigned char ipv4a[5]; |
| 1965 | char *ipv6ptr = 0; |
| 1966 | char *ipv4ptr = 0; |
| 1967 | /* - */ |
| 1968 | ipv4res[0] = '\0'; |
| 1969 | ipv4a[0] = 0xc0; |
| 1970 | ipv4a[1] = 0xa8; |
| 1971 | ipv4a[2] = 0x64; |
| 1972 | ipv4a[3] = 0x01; |
| 1973 | ipv4a[4] = 0x01; |
| 1974 | /* - */ |
| 1975 | ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res)); |
| 1976 | if(!ipv4ptr) |
| 1977 | exit(1); /* fail */ |
| 1978 | if(ipv4ptr != ipv4res) |
| 1979 | exit(1); /* fail */ |
| 1980 | if(!ipv4ptr[0]) |
| 1981 | exit(1); /* fail */ |
| 1982 | if(memcmp(ipv4res, "192.168.100.1", 13) != 0) |
| 1983 | exit(1); /* fail */ |
| 1984 | /* - */ |
| 1985 | ipv6res[0] = '\0'; |
| 1986 | memset(ipv6a, 0, sizeof(ipv6a)); |
| 1987 | ipv6a[0] = 0xfe; |
| 1988 | ipv6a[1] = 0x80; |
| 1989 | ipv6a[8] = 0x02; |
| 1990 | ipv6a[9] = 0x14; |
| 1991 | ipv6a[10] = 0x4f; |
| 1992 | ipv6a[11] = 0xff; |
| 1993 | ipv6a[12] = 0xfe; |
| 1994 | ipv6a[13] = 0x0b; |
| 1995 | ipv6a[14] = 0x76; |
| 1996 | ipv6a[15] = 0xc8; |
| 1997 | ipv6a[25] = 0x01; |
| 1998 | /* - */ |
| 1999 | ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res)); |
| 2000 | if(!ipv6ptr) |
| 2001 | exit(1); /* fail */ |
| 2002 | if(ipv6ptr != ipv6res) |
| 2003 | exit(1); /* fail */ |
| 2004 | if(!ipv6ptr[0]) |
| 2005 | exit(1); /* fail */ |
| 2006 | if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0) |
| 2007 | exit(1); /* fail */ |
| 2008 | /* - */ |
| 2009 | exit(0); |
| 2010 | ]]) |
| 2011 | ],[ |
| 2012 | AC_MSG_RESULT([yes]) |
| 2013 | tst_works_inet_ntop="yes" |
| 2014 | ],[ |
| 2015 | AC_MSG_RESULT([no]) |
| 2016 | tst_works_inet_ntop="no" |
| 2017 | ]) |
| 2018 | fi |
| 2019 | # |
| 2020 | if test "$tst_compi_inet_ntop" = "yes" && |
| 2021 | test "$tst_works_inet_ntop" != "no"; then |
| 2022 | AC_MSG_CHECKING([if inet_ntop usage allowed]) |
| 2023 | if test "x$cares_disallow_inet_ntop" != "xyes"; then |
| 2024 | AC_MSG_RESULT([yes]) |
| 2025 | tst_allow_inet_ntop="yes" |
| 2026 | else |
| 2027 | AC_MSG_RESULT([no]) |
| 2028 | tst_allow_inet_ntop="no" |
| 2029 | fi |
| 2030 | fi |
| 2031 | # |
| 2032 | AC_MSG_CHECKING([if inet_ntop might be used]) |
| 2033 | if test "$tst_links_inet_ntop" = "yes" && |
| 2034 | test "$tst_proto_inet_ntop" = "yes" && |
| 2035 | test "$tst_compi_inet_ntop" = "yes" && |
| 2036 | test "$tst_allow_inet_ntop" = "yes" && |
| 2037 | test "$tst_works_inet_ntop" != "no"; then |
| 2038 | AC_MSG_RESULT([yes]) |
| 2039 | AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1, |
| 2040 | [Define to 1 if you have a IPv6 capable working inet_ntop function.]) |
| 2041 | ac_cv_func_inet_ntop="yes" |
| 2042 | else |
| 2043 | AC_MSG_RESULT([no]) |
| 2044 | ac_cv_func_inet_ntop="no" |
| 2045 | fi |
| 2046 | ]) |
| 2047 | |
| 2048 | |
| 2049 | dnl CARES_CHECK_FUNC_INET_PTON |
| 2050 | dnl ------------------------------------------------- |
| 2051 | dnl Verify if inet_pton is available, prototyped, can |
| 2052 | dnl be compiled and seems to work. If all of these are |
| 2053 | dnl true, and usage has not been previously disallowed |
| 2054 | dnl with shell variable cares_disallow_inet_pton, then |
| 2055 | dnl HAVE_INET_PTON will be defined. |
| 2056 | |
| 2057 | AC_DEFUN([CARES_CHECK_FUNC_INET_PTON], [ |
| 2058 | AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl |
| 2059 | AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl |
| 2060 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 2061 | # |
| 2062 | tst_links_inet_pton="unknown" |
| 2063 | tst_proto_inet_pton="unknown" |
| 2064 | tst_compi_inet_pton="unknown" |
| 2065 | tst_works_inet_pton="unknown" |
| 2066 | tst_allow_inet_pton="unknown" |
| 2067 | # |
| 2068 | AC_MSG_CHECKING([if inet_pton can be linked]) |
| 2069 | AC_LINK_IFELSE([ |
| 2070 | AC_LANG_FUNC_LINK_TRY([inet_pton]) |
| 2071 | ],[ |
| 2072 | AC_MSG_RESULT([yes]) |
| 2073 | tst_links_inet_pton="yes" |
| 2074 | ],[ |
| 2075 | AC_MSG_RESULT([no]) |
| 2076 | tst_links_inet_pton="no" |
| 2077 | ]) |
| 2078 | # |
| 2079 | if test "$tst_links_inet_pton" = "yes"; then |
| 2080 | AC_MSG_CHECKING([if inet_pton is prototyped]) |
| 2081 | AC_EGREP_CPP([inet_pton],[ |
| 2082 | $cares_includes_arpa_inet |
| 2083 | ],[ |
| 2084 | AC_MSG_RESULT([yes]) |
| 2085 | tst_proto_inet_pton="yes" |
| 2086 | ],[ |
| 2087 | AC_MSG_RESULT([no]) |
| 2088 | tst_proto_inet_pton="no" |
| 2089 | ]) |
| 2090 | fi |
| 2091 | # |
| 2092 | if test "$tst_proto_inet_pton" = "yes"; then |
| 2093 | AC_MSG_CHECKING([if inet_pton is compilable]) |
| 2094 | AC_COMPILE_IFELSE([ |
| 2095 | AC_LANG_PROGRAM([[ |
| 2096 | $cares_includes_arpa_inet |
| 2097 | ]],[[ |
| 2098 | if(0 != inet_pton(0, 0, 0)) |
| 2099 | return 1; |
| 2100 | ]]) |
| 2101 | ],[ |
| 2102 | AC_MSG_RESULT([yes]) |
| 2103 | tst_compi_inet_pton="yes" |
| 2104 | ],[ |
| 2105 | AC_MSG_RESULT([no]) |
| 2106 | tst_compi_inet_pton="no" |
| 2107 | ]) |
| 2108 | fi |
| 2109 | # |
| 2110 | dnl only do runtime verification when not cross-compiling |
| 2111 | if test "x$cross_compiling" != "xyes" && |
| 2112 | test "$tst_compi_inet_pton" = "yes"; then |
| 2113 | AC_MSG_CHECKING([if inet_pton seems to work]) |
| 2114 | AC_RUN_IFELSE([ |
| 2115 | AC_LANG_PROGRAM([[ |
| 2116 | $cares_includes_stdlib |
| 2117 | $cares_includes_arpa_inet |
| 2118 | $cares_includes_string |
| 2119 | ]],[[ |
| 2120 | unsigned char ipv6a[16+1]; |
| 2121 | unsigned char ipv4a[4+1]; |
| 2122 | const char *ipv6src = "fe80::214:4fff:fe0b:76c8"; |
| 2123 | const char *ipv4src = "192.168.100.1"; |
| 2124 | /* - */ |
| 2125 | memset(ipv4a, 1, sizeof(ipv4a)); |
| 2126 | if(1 != inet_pton(AF_INET, ipv4src, ipv4a)) |
| 2127 | exit(1); /* fail */ |
| 2128 | /* - */ |
| 2129 | if( (ipv4a[0] != 0xc0) || |
| 2130 | (ipv4a[1] != 0xa8) || |
| 2131 | (ipv4a[2] != 0x64) || |
| 2132 | (ipv4a[3] != 0x01) || |
| 2133 | (ipv4a[4] != 0x01) ) |
| 2134 | exit(1); /* fail */ |
| 2135 | /* - */ |
| 2136 | memset(ipv6a, 1, sizeof(ipv6a)); |
| 2137 | if(1 != inet_pton(AF_INET6, ipv6src, ipv6a)) |
| 2138 | exit(1); /* fail */ |
| 2139 | /* - */ |
| 2140 | if( (ipv6a[0] != 0xfe) || |
| 2141 | (ipv6a[1] != 0x80) || |
| 2142 | (ipv6a[8] != 0x02) || |
| 2143 | (ipv6a[9] != 0x14) || |
| 2144 | (ipv6a[10] != 0x4f) || |
| 2145 | (ipv6a[11] != 0xff) || |
| 2146 | (ipv6a[12] != 0xfe) || |
| 2147 | (ipv6a[13] != 0x0b) || |
| 2148 | (ipv6a[14] != 0x76) || |
| 2149 | (ipv6a[15] != 0xc8) || |
| 2150 | (ipv6a[16] != 0x01) ) |
| 2151 | exit(1); /* fail */ |
| 2152 | /* - */ |
| 2153 | if( (ipv6a[2] != 0x0) || |
| 2154 | (ipv6a[3] != 0x0) || |
| 2155 | (ipv6a[4] != 0x0) || |
| 2156 | (ipv6a[5] != 0x0) || |
| 2157 | (ipv6a[6] != 0x0) || |
| 2158 | (ipv6a[7] != 0x0) ) |
| 2159 | exit(1); /* fail */ |
| 2160 | /* - */ |
| 2161 | exit(0); |
| 2162 | ]]) |
| 2163 | ],[ |
| 2164 | AC_MSG_RESULT([yes]) |
| 2165 | tst_works_inet_pton="yes" |
| 2166 | ],[ |
| 2167 | AC_MSG_RESULT([no]) |
| 2168 | tst_works_inet_pton="no" |
| 2169 | ]) |
| 2170 | fi |
| 2171 | # |
| 2172 | if test "$tst_compi_inet_pton" = "yes" && |
| 2173 | test "$tst_works_inet_pton" != "no"; then |
| 2174 | AC_MSG_CHECKING([if inet_pton usage allowed]) |
| 2175 | if test "x$cares_disallow_inet_pton" != "xyes"; then |
| 2176 | AC_MSG_RESULT([yes]) |
| 2177 | tst_allow_inet_pton="yes" |
| 2178 | else |
| 2179 | AC_MSG_RESULT([no]) |
| 2180 | tst_allow_inet_pton="no" |
| 2181 | fi |
| 2182 | fi |
| 2183 | # |
| 2184 | AC_MSG_CHECKING([if inet_pton might be used]) |
| 2185 | if test "$tst_links_inet_pton" = "yes" && |
| 2186 | test "$tst_proto_inet_pton" = "yes" && |
| 2187 | test "$tst_compi_inet_pton" = "yes" && |
| 2188 | test "$tst_allow_inet_pton" = "yes" && |
| 2189 | test "$tst_works_inet_pton" != "no"; then |
| 2190 | AC_MSG_RESULT([yes]) |
| 2191 | AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1, |
| 2192 | [Define to 1 if you have a IPv6 capable working inet_pton function.]) |
| 2193 | ac_cv_func_inet_pton="yes" |
| 2194 | else |
| 2195 | AC_MSG_RESULT([no]) |
| 2196 | ac_cv_func_inet_pton="no" |
| 2197 | fi |
| 2198 | ]) |
| 2199 | |
| 2200 | |
| 2201 | dnl CARES_CHECK_FUNC_IOCTL |
| 2202 | dnl ------------------------------------------------- |
| 2203 | dnl Verify if ioctl is available, prototyped, and |
| 2204 | dnl can be compiled. If all of these are true, and |
| 2205 | dnl usage has not been previously disallowed with |
| 2206 | dnl shell variable cares_disallow_ioctl, then |
| 2207 | dnl HAVE_IOCTL will be defined. |
| 2208 | |
| 2209 | AC_DEFUN([CARES_CHECK_FUNC_IOCTL], [ |
| 2210 | AC_REQUIRE([CARES_INCLUDES_STROPTS])dnl |
| 2211 | # |
| 2212 | tst_links_ioctl="unknown" |
| 2213 | tst_proto_ioctl="unknown" |
| 2214 | tst_compi_ioctl="unknown" |
| 2215 | tst_allow_ioctl="unknown" |
| 2216 | # |
| 2217 | AC_MSG_CHECKING([if ioctl can be linked]) |
| 2218 | AC_LINK_IFELSE([ |
| 2219 | AC_LANG_FUNC_LINK_TRY([ioctl]) |
| 2220 | ],[ |
| 2221 | AC_MSG_RESULT([yes]) |
| 2222 | tst_links_ioctl="yes" |
| 2223 | ],[ |
| 2224 | AC_MSG_RESULT([no]) |
| 2225 | tst_links_ioctl="no" |
| 2226 | ]) |
| 2227 | # |
| 2228 | if test "$tst_links_ioctl" = "yes"; then |
| 2229 | AC_MSG_CHECKING([if ioctl is prototyped]) |
| 2230 | AC_EGREP_CPP([ioctl],[ |
| 2231 | $cares_includes_stropts |
| 2232 | ],[ |
| 2233 | AC_MSG_RESULT([yes]) |
| 2234 | tst_proto_ioctl="yes" |
| 2235 | ],[ |
| 2236 | AC_MSG_RESULT([no]) |
| 2237 | tst_proto_ioctl="no" |
| 2238 | ]) |
| 2239 | fi |
| 2240 | # |
| 2241 | if test "$tst_proto_ioctl" = "yes"; then |
| 2242 | AC_MSG_CHECKING([if ioctl is compilable]) |
| 2243 | AC_COMPILE_IFELSE([ |
| 2244 | AC_LANG_PROGRAM([[ |
| 2245 | $cares_includes_stropts |
| 2246 | ]],[[ |
| 2247 | if(0 != ioctl(0, 0, 0)) |
| 2248 | return 1; |
| 2249 | ]]) |
| 2250 | ],[ |
| 2251 | AC_MSG_RESULT([yes]) |
| 2252 | tst_compi_ioctl="yes" |
| 2253 | ],[ |
| 2254 | AC_MSG_RESULT([no]) |
| 2255 | tst_compi_ioctl="no" |
| 2256 | ]) |
| 2257 | fi |
| 2258 | # |
| 2259 | if test "$tst_compi_ioctl" = "yes"; then |
| 2260 | AC_MSG_CHECKING([if ioctl usage allowed]) |
| 2261 | if test "x$cares_disallow_ioctl" != "xyes"; then |
| 2262 | AC_MSG_RESULT([yes]) |
| 2263 | tst_allow_ioctl="yes" |
| 2264 | else |
| 2265 | AC_MSG_RESULT([no]) |
| 2266 | tst_allow_ioctl="no" |
| 2267 | fi |
| 2268 | fi |
| 2269 | # |
| 2270 | AC_MSG_CHECKING([if ioctl might be used]) |
| 2271 | if test "$tst_links_ioctl" = "yes" && |
| 2272 | test "$tst_proto_ioctl" = "yes" && |
| 2273 | test "$tst_compi_ioctl" = "yes" && |
| 2274 | test "$tst_allow_ioctl" = "yes"; then |
| 2275 | AC_MSG_RESULT([yes]) |
| 2276 | AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1, |
| 2277 | [Define to 1 if you have the ioctl function.]) |
| 2278 | ac_cv_func_ioctl="yes" |
| 2279 | CARES_CHECK_FUNC_IOCTL_FIONBIO |
| 2280 | CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR |
| 2281 | else |
| 2282 | AC_MSG_RESULT([no]) |
| 2283 | ac_cv_func_ioctl="no" |
| 2284 | fi |
| 2285 | ]) |
| 2286 | |
| 2287 | |
| 2288 | dnl CARES_CHECK_FUNC_IOCTL_FIONBIO |
| 2289 | dnl ------------------------------------------------- |
| 2290 | dnl Verify if ioctl with the FIONBIO command is |
| 2291 | dnl available, can be compiled, and seems to work. If |
| 2292 | dnl all of these are true, then HAVE_IOCTL_FIONBIO |
| 2293 | dnl will be defined. |
| 2294 | |
| 2295 | AC_DEFUN([CARES_CHECK_FUNC_IOCTL_FIONBIO], [ |
| 2296 | # |
| 2297 | tst_compi_ioctl_fionbio="unknown" |
| 2298 | tst_allow_ioctl_fionbio="unknown" |
| 2299 | # |
| 2300 | if test "$ac_cv_func_ioctl" = "yes"; then |
| 2301 | AC_MSG_CHECKING([if ioctl FIONBIO is compilable]) |
| 2302 | AC_COMPILE_IFELSE([ |
| 2303 | AC_LANG_PROGRAM([[ |
| 2304 | $cares_includes_stropts |
| 2305 | ]],[[ |
| 2306 | int flags = 0; |
| 2307 | if(0 != ioctl(0, FIONBIO, &flags)) |
| 2308 | return 1; |
| 2309 | ]]) |
| 2310 | ],[ |
| 2311 | AC_MSG_RESULT([yes]) |
| 2312 | tst_compi_ioctl_fionbio="yes" |
| 2313 | ],[ |
| 2314 | AC_MSG_RESULT([no]) |
| 2315 | tst_compi_ioctl_fionbio="no" |
| 2316 | ]) |
| 2317 | fi |
| 2318 | # |
| 2319 | if test "$tst_compi_ioctl_fionbio" = "yes"; then |
| 2320 | AC_MSG_CHECKING([if ioctl FIONBIO usage allowed]) |
| 2321 | if test "x$cares_disallow_ioctl_fionbio" != "xyes"; then |
| 2322 | AC_MSG_RESULT([yes]) |
| 2323 | tst_allow_ioctl_fionbio="yes" |
| 2324 | else |
| 2325 | AC_MSG_RESULT([no]) |
| 2326 | tst_allow_ioctl_fionbio="no" |
| 2327 | fi |
| 2328 | fi |
| 2329 | # |
| 2330 | AC_MSG_CHECKING([if ioctl FIONBIO might be used]) |
| 2331 | if test "$tst_compi_ioctl_fionbio" = "yes" && |
| 2332 | test "$tst_allow_ioctl_fionbio" = "yes"; then |
| 2333 | AC_MSG_RESULT([yes]) |
| 2334 | AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1, |
| 2335 | [Define to 1 if you have a working ioctl FIONBIO function.]) |
| 2336 | ac_cv_func_ioctl_fionbio="yes" |
| 2337 | else |
| 2338 | AC_MSG_RESULT([no]) |
| 2339 | ac_cv_func_ioctl_fionbio="no" |
| 2340 | fi |
| 2341 | ]) |
| 2342 | |
| 2343 | |
| 2344 | dnl CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR |
| 2345 | dnl ------------------------------------------------- |
| 2346 | dnl Verify if ioctl with the SIOCGIFADDR command is available, |
| 2347 | dnl struct ifreq is defined, they can be compiled, and seem to |
| 2348 | dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR |
| 2349 | dnl will be defined. |
| 2350 | |
| 2351 | AC_DEFUN([CARES_CHECK_FUNC_IOCTL_SIOCGIFADDR], [ |
| 2352 | # |
| 2353 | tst_compi_ioctl_siocgifaddr="unknown" |
| 2354 | tst_allow_ioctl_siocgifaddr="unknown" |
| 2355 | # |
| 2356 | if test "$ac_cv_func_ioctl" = "yes"; then |
| 2357 | AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable]) |
| 2358 | AC_COMPILE_IFELSE([ |
| 2359 | AC_LANG_PROGRAM([[ |
| 2360 | $cares_includes_stropts |
| 2361 | #include <net/if.h> |
| 2362 | ]],[[ |
| 2363 | struct ifreq ifr; |
| 2364 | if(0 != ioctl(0, SIOCGIFADDR, &ifr)) |
| 2365 | return 1; |
| 2366 | ]]) |
| 2367 | ],[ |
| 2368 | AC_MSG_RESULT([yes]) |
| 2369 | tst_compi_ioctl_siocgifaddr="yes" |
| 2370 | ],[ |
| 2371 | AC_MSG_RESULT([no]) |
| 2372 | tst_compi_ioctl_siocgifaddr="no" |
| 2373 | ]) |
| 2374 | fi |
| 2375 | # |
| 2376 | if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then |
| 2377 | AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed]) |
| 2378 | if test "x$cares_disallow_ioctl_siocgifaddr" != "xyes"; then |
| 2379 | AC_MSG_RESULT([yes]) |
| 2380 | tst_allow_ioctl_siocgifaddr="yes" |
| 2381 | else |
| 2382 | AC_MSG_RESULT([no]) |
| 2383 | tst_allow_ioctl_siocgifaddr="no" |
| 2384 | fi |
| 2385 | fi |
| 2386 | # |
| 2387 | AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used]) |
| 2388 | if test "$tst_compi_ioctl_siocgifaddr" = "yes" && |
| 2389 | test "$tst_allow_ioctl_siocgifaddr" = "yes"; then |
| 2390 | AC_MSG_RESULT([yes]) |
| 2391 | AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1, |
| 2392 | [Define to 1 if you have a working ioctl SIOCGIFADDR function.]) |
| 2393 | ac_cv_func_ioctl_siocgifaddr="yes" |
| 2394 | else |
| 2395 | AC_MSG_RESULT([no]) |
| 2396 | ac_cv_func_ioctl_siocgifaddr="no" |
| 2397 | fi |
| 2398 | ]) |
| 2399 | |
| 2400 | |
| 2401 | dnl CARES_CHECK_FUNC_IOCTLSOCKET |
| 2402 | dnl ------------------------------------------------- |
| 2403 | dnl Verify if ioctlsocket is available, prototyped, and |
| 2404 | dnl can be compiled. If all of these are true, and |
| 2405 | dnl usage has not been previously disallowed with |
| 2406 | dnl shell variable cares_disallow_ioctlsocket, then |
| 2407 | dnl HAVE_IOCTLSOCKET will be defined. |
| 2408 | |
| 2409 | AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET], [ |
| 2410 | AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl |
| 2411 | # |
| 2412 | tst_links_ioctlsocket="unknown" |
| 2413 | tst_proto_ioctlsocket="unknown" |
| 2414 | tst_compi_ioctlsocket="unknown" |
| 2415 | tst_allow_ioctlsocket="unknown" |
| 2416 | # |
| 2417 | AC_MSG_CHECKING([if ioctlsocket can be linked]) |
| 2418 | AC_LINK_IFELSE([ |
| 2419 | AC_LANG_PROGRAM([[ |
| 2420 | $cares_includes_winsock2 |
| 2421 | ]],[[ |
| 2422 | if(0 != ioctlsocket(0, 0, 0)) |
| 2423 | return 1; |
| 2424 | ]]) |
| 2425 | ],[ |
| 2426 | AC_MSG_RESULT([yes]) |
| 2427 | tst_links_ioctlsocket="yes" |
| 2428 | ],[ |
| 2429 | AC_MSG_RESULT([no]) |
| 2430 | tst_links_ioctlsocket="no" |
| 2431 | ]) |
| 2432 | # |
| 2433 | if test "$tst_links_ioctlsocket" = "yes"; then |
| 2434 | AC_MSG_CHECKING([if ioctlsocket is prototyped]) |
| 2435 | AC_EGREP_CPP([ioctlsocket],[ |
| 2436 | $cares_includes_winsock2 |
| 2437 | ],[ |
| 2438 | AC_MSG_RESULT([yes]) |
| 2439 | tst_proto_ioctlsocket="yes" |
| 2440 | ],[ |
| 2441 | AC_MSG_RESULT([no]) |
| 2442 | tst_proto_ioctlsocket="no" |
| 2443 | ]) |
| 2444 | fi |
| 2445 | # |
| 2446 | if test "$tst_proto_ioctlsocket" = "yes"; then |
| 2447 | AC_MSG_CHECKING([if ioctlsocket is compilable]) |
| 2448 | AC_COMPILE_IFELSE([ |
| 2449 | AC_LANG_PROGRAM([[ |
| 2450 | $cares_includes_winsock2 |
| 2451 | ]],[[ |
| 2452 | if(0 != ioctlsocket(0, 0, 0)) |
| 2453 | return 1; |
| 2454 | ]]) |
| 2455 | ],[ |
| 2456 | AC_MSG_RESULT([yes]) |
| 2457 | tst_compi_ioctlsocket="yes" |
| 2458 | ],[ |
| 2459 | AC_MSG_RESULT([no]) |
| 2460 | tst_compi_ioctlsocket="no" |
| 2461 | ]) |
| 2462 | fi |
| 2463 | # |
| 2464 | if test "$tst_compi_ioctlsocket" = "yes"; then |
| 2465 | AC_MSG_CHECKING([if ioctlsocket usage allowed]) |
| 2466 | if test "x$cares_disallow_ioctlsocket" != "xyes"; then |
| 2467 | AC_MSG_RESULT([yes]) |
| 2468 | tst_allow_ioctlsocket="yes" |
| 2469 | else |
| 2470 | AC_MSG_RESULT([no]) |
| 2471 | tst_allow_ioctlsocket="no" |
| 2472 | fi |
| 2473 | fi |
| 2474 | # |
| 2475 | AC_MSG_CHECKING([if ioctlsocket might be used]) |
| 2476 | if test "$tst_links_ioctlsocket" = "yes" && |
| 2477 | test "$tst_proto_ioctlsocket" = "yes" && |
| 2478 | test "$tst_compi_ioctlsocket" = "yes" && |
| 2479 | test "$tst_allow_ioctlsocket" = "yes"; then |
| 2480 | AC_MSG_RESULT([yes]) |
| 2481 | AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1, |
| 2482 | [Define to 1 if you have the ioctlsocket function.]) |
| 2483 | ac_cv_func_ioctlsocket="yes" |
| 2484 | CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO |
| 2485 | else |
| 2486 | AC_MSG_RESULT([no]) |
| 2487 | ac_cv_func_ioctlsocket="no" |
| 2488 | fi |
| 2489 | ]) |
| 2490 | |
| 2491 | |
| 2492 | dnl CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO |
| 2493 | dnl ------------------------------------------------- |
| 2494 | dnl Verify if ioctlsocket with the FIONBIO command is |
| 2495 | dnl available, can be compiled, and seems to work. If |
| 2496 | dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO |
| 2497 | dnl will be defined. |
| 2498 | |
| 2499 | AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [ |
| 2500 | # |
| 2501 | tst_compi_ioctlsocket_fionbio="unknown" |
| 2502 | tst_allow_ioctlsocket_fionbio="unknown" |
| 2503 | # |
| 2504 | if test "$ac_cv_func_ioctlsocket" = "yes"; then |
| 2505 | AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable]) |
| 2506 | AC_COMPILE_IFELSE([ |
| 2507 | AC_LANG_PROGRAM([[ |
| 2508 | $cares_includes_winsock2 |
| 2509 | ]],[[ |
| 2510 | int flags = 0; |
| 2511 | if(0 != ioctlsocket(0, FIONBIO, &flags)) |
| 2512 | return 1; |
| 2513 | ]]) |
| 2514 | ],[ |
| 2515 | AC_MSG_RESULT([yes]) |
| 2516 | tst_compi_ioctlsocket_fionbio="yes" |
| 2517 | ],[ |
| 2518 | AC_MSG_RESULT([no]) |
| 2519 | tst_compi_ioctlsocket_fionbio="no" |
| 2520 | ]) |
| 2521 | fi |
| 2522 | # |
| 2523 | if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then |
| 2524 | AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed]) |
| 2525 | if test "x$cares_disallow_ioctlsocket_fionbio" != "xyes"; then |
| 2526 | AC_MSG_RESULT([yes]) |
| 2527 | tst_allow_ioctlsocket_fionbio="yes" |
| 2528 | else |
| 2529 | AC_MSG_RESULT([no]) |
| 2530 | tst_allow_ioctlsocket_fionbio="no" |
| 2531 | fi |
| 2532 | fi |
| 2533 | # |
| 2534 | AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used]) |
| 2535 | if test "$tst_compi_ioctlsocket_fionbio" = "yes" && |
| 2536 | test "$tst_allow_ioctlsocket_fionbio" = "yes"; then |
| 2537 | AC_MSG_RESULT([yes]) |
| 2538 | AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1, |
| 2539 | [Define to 1 if you have a working ioctlsocket FIONBIO function.]) |
| 2540 | ac_cv_func_ioctlsocket_fionbio="yes" |
| 2541 | else |
| 2542 | AC_MSG_RESULT([no]) |
| 2543 | ac_cv_func_ioctlsocket_fionbio="no" |
| 2544 | fi |
| 2545 | ]) |
| 2546 | |
| 2547 | |
| 2548 | dnl CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL |
| 2549 | dnl ------------------------------------------------- |
| 2550 | dnl Verify if IoctlSocket is available, prototyped, and |
| 2551 | dnl can be compiled. If all of these are true, and |
| 2552 | dnl usage has not been previously disallowed with |
| 2553 | dnl shell variable cares_disallow_ioctlsocket_camel, |
| 2554 | dnl then HAVE_IOCTLSOCKET_CAMEL will be defined. |
| 2555 | |
| 2556 | AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL], [ |
| 2557 | AC_REQUIRE([CARES_INCLUDES_STROPTS])dnl |
| 2558 | # |
| 2559 | tst_links_ioctlsocket_camel="unknown" |
| 2560 | tst_proto_ioctlsocket_camel="unknown" |
| 2561 | tst_compi_ioctlsocket_camel="unknown" |
| 2562 | tst_allow_ioctlsocket_camel="unknown" |
| 2563 | # |
| 2564 | AC_MSG_CHECKING([if IoctlSocket can be linked]) |
| 2565 | AC_LINK_IFELSE([ |
| 2566 | AC_LANG_FUNC_LINK_TRY([IoctlSocket]) |
| 2567 | ],[ |
| 2568 | AC_MSG_RESULT([yes]) |
| 2569 | tst_links_ioctlsocket_camel="yes" |
| 2570 | ],[ |
| 2571 | AC_MSG_RESULT([no]) |
| 2572 | tst_links_ioctlsocket_camel="no" |
| 2573 | ]) |
| 2574 | # |
| 2575 | if test "$tst_links_ioctlsocket_camel" = "yes"; then |
| 2576 | AC_MSG_CHECKING([if IoctlSocket is prototyped]) |
| 2577 | AC_EGREP_CPP([IoctlSocket],[ |
| 2578 | $cares_includes_stropts |
| 2579 | ],[ |
| 2580 | AC_MSG_RESULT([yes]) |
| 2581 | tst_proto_ioctlsocket_camel="yes" |
| 2582 | ],[ |
| 2583 | AC_MSG_RESULT([no]) |
| 2584 | tst_proto_ioctlsocket_camel="no" |
| 2585 | ]) |
| 2586 | fi |
| 2587 | # |
| 2588 | if test "$tst_proto_ioctlsocket_camel" = "yes"; then |
| 2589 | AC_MSG_CHECKING([if IoctlSocket is compilable]) |
| 2590 | AC_COMPILE_IFELSE([ |
| 2591 | AC_LANG_PROGRAM([[ |
| 2592 | $cares_includes_stropts |
| 2593 | ]],[[ |
| 2594 | if(0 != IoctlSocket(0, 0, 0)) |
| 2595 | return 1; |
| 2596 | ]]) |
| 2597 | ],[ |
| 2598 | AC_MSG_RESULT([yes]) |
| 2599 | tst_compi_ioctlsocket_camel="yes" |
| 2600 | ],[ |
| 2601 | AC_MSG_RESULT([no]) |
| 2602 | tst_compi_ioctlsocket_camel="no" |
| 2603 | ]) |
| 2604 | fi |
| 2605 | # |
| 2606 | if test "$tst_compi_ioctlsocket_camel" = "yes"; then |
| 2607 | AC_MSG_CHECKING([if IoctlSocket usage allowed]) |
| 2608 | if test "x$cares_disallow_ioctlsocket_camel" != "xyes"; then |
| 2609 | AC_MSG_RESULT([yes]) |
| 2610 | tst_allow_ioctlsocket_camel="yes" |
| 2611 | else |
| 2612 | AC_MSG_RESULT([no]) |
| 2613 | tst_allow_ioctlsocket_camel="no" |
| 2614 | fi |
| 2615 | fi |
| 2616 | # |
| 2617 | AC_MSG_CHECKING([if IoctlSocket might be used]) |
| 2618 | if test "$tst_links_ioctlsocket_camel" = "yes" && |
| 2619 | test "$tst_proto_ioctlsocket_camel" = "yes" && |
| 2620 | test "$tst_compi_ioctlsocket_camel" = "yes" && |
| 2621 | test "$tst_allow_ioctlsocket_camel" = "yes"; then |
| 2622 | AC_MSG_RESULT([yes]) |
| 2623 | AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1, |
| 2624 | [Define to 1 if you have the IoctlSocket camel case function.]) |
| 2625 | ac_cv_func_ioctlsocket_camel="yes" |
| 2626 | CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO |
| 2627 | else |
| 2628 | AC_MSG_RESULT([no]) |
| 2629 | ac_cv_func_ioctlsocket_camel="no" |
| 2630 | fi |
| 2631 | ]) |
| 2632 | |
| 2633 | |
| 2634 | dnl CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO |
| 2635 | dnl ------------------------------------------------- |
| 2636 | dnl Verify if IoctlSocket with FIONBIO command is available, |
| 2637 | dnl can be compiled, and seems to work. If all of these are |
| 2638 | dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined. |
| 2639 | |
| 2640 | AC_DEFUN([CARES_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [ |
| 2641 | # |
| 2642 | tst_compi_ioctlsocket_camel_fionbio="unknown" |
| 2643 | tst_allow_ioctlsocket_camel_fionbio="unknown" |
| 2644 | # |
| 2645 | if test "$ac_cv_func_ioctlsocket_camel" = "yes"; then |
| 2646 | AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable]) |
| 2647 | AC_COMPILE_IFELSE([ |
| 2648 | AC_LANG_PROGRAM([[ |
| 2649 | $cares_includes_stropts |
| 2650 | ]],[[ |
| 2651 | long flags = 0; |
| 2652 | if(0 != ioctlsocket(0, FIONBIO, &flags)) |
| 2653 | return 1; |
| 2654 | ]]) |
| 2655 | ],[ |
| 2656 | AC_MSG_RESULT([yes]) |
| 2657 | tst_compi_ioctlsocket_camel_fionbio="yes" |
| 2658 | ],[ |
| 2659 | AC_MSG_RESULT([no]) |
| 2660 | tst_compi_ioctlsocket_camel_fionbio="no" |
| 2661 | ]) |
| 2662 | fi |
| 2663 | # |
| 2664 | if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then |
| 2665 | AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed]) |
| 2666 | if test "x$cares_disallow_ioctlsocket_camel_fionbio" != "xyes"; then |
| 2667 | AC_MSG_RESULT([yes]) |
| 2668 | tst_allow_ioctlsocket_camel_fionbio="yes" |
| 2669 | else |
| 2670 | AC_MSG_RESULT([no]) |
| 2671 | tst_allow_ioctlsocket_camel_fionbio="no" |
| 2672 | fi |
| 2673 | fi |
| 2674 | # |
| 2675 | AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used]) |
| 2676 | if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" && |
| 2677 | test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then |
| 2678 | AC_MSG_RESULT([yes]) |
| 2679 | AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1, |
| 2680 | [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.]) |
| 2681 | ac_cv_func_ioctlsocket_camel_fionbio="yes" |
| 2682 | else |
| 2683 | AC_MSG_RESULT([no]) |
| 2684 | ac_cv_func_ioctlsocket_camel_fionbio="no" |
| 2685 | fi |
| 2686 | ]) |
| 2687 | |
| 2688 | |
| 2689 | dnl CARES_CHECK_FUNC_SETSOCKOPT |
| 2690 | dnl ------------------------------------------------- |
| 2691 | dnl Verify if setsockopt is available, prototyped, and |
| 2692 | dnl can be compiled. If all of these are true, and |
| 2693 | dnl usage has not been previously disallowed with |
| 2694 | dnl shell variable cares_disallow_setsockopt, then |
| 2695 | dnl HAVE_SETSOCKOPT will be defined. |
| 2696 | |
| 2697 | AC_DEFUN([CARES_CHECK_FUNC_SETSOCKOPT], [ |
| 2698 | AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl |
| 2699 | AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl |
| 2700 | # |
| 2701 | tst_links_setsockopt="unknown" |
| 2702 | tst_proto_setsockopt="unknown" |
| 2703 | tst_compi_setsockopt="unknown" |
| 2704 | tst_allow_setsockopt="unknown" |
| 2705 | # |
| 2706 | AC_MSG_CHECKING([if setsockopt can be linked]) |
| 2707 | AC_LINK_IFELSE([ |
| 2708 | AC_LANG_PROGRAM([[ |
| 2709 | $cares_includes_winsock2 |
| 2710 | $cares_includes_sys_socket |
| 2711 | ]],[[ |
| 2712 | if(0 != setsockopt(0, 0, 0, 0, 0)) |
| 2713 | return 1; |
| 2714 | ]]) |
| 2715 | ],[ |
| 2716 | AC_MSG_RESULT([yes]) |
| 2717 | tst_links_setsockopt="yes" |
| 2718 | ],[ |
| 2719 | AC_MSG_RESULT([no]) |
| 2720 | tst_links_setsockopt="no" |
| 2721 | ]) |
| 2722 | # |
| 2723 | if test "$tst_links_setsockopt" = "yes"; then |
| 2724 | AC_MSG_CHECKING([if setsockopt is prototyped]) |
| 2725 | AC_EGREP_CPP([setsockopt],[ |
| 2726 | $cares_includes_winsock2 |
| 2727 | $cares_includes_sys_socket |
| 2728 | ],[ |
| 2729 | AC_MSG_RESULT([yes]) |
| 2730 | tst_proto_setsockopt="yes" |
| 2731 | ],[ |
| 2732 | AC_MSG_RESULT([no]) |
| 2733 | tst_proto_setsockopt="no" |
| 2734 | ]) |
| 2735 | fi |
| 2736 | # |
| 2737 | if test "$tst_proto_setsockopt" = "yes"; then |
| 2738 | AC_MSG_CHECKING([if setsockopt is compilable]) |
| 2739 | AC_COMPILE_IFELSE([ |
| 2740 | AC_LANG_PROGRAM([[ |
| 2741 | $cares_includes_winsock2 |
| 2742 | $cares_includes_sys_socket |
| 2743 | ]],[[ |
| 2744 | if(0 != setsockopt(0, 0, 0, 0, 0)) |
| 2745 | return 1; |
| 2746 | ]]) |
| 2747 | ],[ |
| 2748 | AC_MSG_RESULT([yes]) |
| 2749 | tst_compi_setsockopt="yes" |
| 2750 | ],[ |
| 2751 | AC_MSG_RESULT([no]) |
| 2752 | tst_compi_setsockopt="no" |
| 2753 | ]) |
| 2754 | fi |
| 2755 | # |
| 2756 | if test "$tst_compi_setsockopt" = "yes"; then |
| 2757 | AC_MSG_CHECKING([if setsockopt usage allowed]) |
| 2758 | if test "x$cares_disallow_setsockopt" != "xyes"; then |
| 2759 | AC_MSG_RESULT([yes]) |
| 2760 | tst_allow_setsockopt="yes" |
| 2761 | else |
| 2762 | AC_MSG_RESULT([no]) |
| 2763 | tst_allow_setsockopt="no" |
| 2764 | fi |
| 2765 | fi |
| 2766 | # |
| 2767 | AC_MSG_CHECKING([if setsockopt might be used]) |
| 2768 | if test "$tst_links_setsockopt" = "yes" && |
| 2769 | test "$tst_proto_setsockopt" = "yes" && |
| 2770 | test "$tst_compi_setsockopt" = "yes" && |
| 2771 | test "$tst_allow_setsockopt" = "yes"; then |
| 2772 | AC_MSG_RESULT([yes]) |
| 2773 | AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT, 1, |
| 2774 | [Define to 1 if you have the setsockopt function.]) |
| 2775 | ac_cv_func_setsockopt="yes" |
| 2776 | CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK |
| 2777 | else |
| 2778 | AC_MSG_RESULT([no]) |
| 2779 | ac_cv_func_setsockopt="no" |
| 2780 | fi |
| 2781 | ]) |
| 2782 | |
| 2783 | |
| 2784 | dnl CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK |
| 2785 | dnl ------------------------------------------------- |
| 2786 | dnl Verify if setsockopt with the SO_NONBLOCK command is |
| 2787 | dnl available, can be compiled, and seems to work. If |
| 2788 | dnl all of these are true, then HAVE_SETSOCKOPT_SO_NONBLOCK |
| 2789 | dnl will be defined. |
| 2790 | |
| 2791 | AC_DEFUN([CARES_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK], [ |
| 2792 | # |
| 2793 | tst_compi_setsockopt_so_nonblock="unknown" |
| 2794 | tst_allow_setsockopt_so_nonblock="unknown" |
| 2795 | # |
| 2796 | if test "$ac_cv_func_setsockopt" = "yes"; then |
| 2797 | AC_MSG_CHECKING([if setsockopt SO_NONBLOCK is compilable]) |
| 2798 | AC_COMPILE_IFELSE([ |
| 2799 | AC_LANG_PROGRAM([[ |
| 2800 | $cares_includes_winsock2 |
| 2801 | $cares_includes_sys_socket |
| 2802 | ]],[[ |
| 2803 | if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) |
| 2804 | return 1; |
| 2805 | ]]) |
| 2806 | ],[ |
| 2807 | AC_MSG_RESULT([yes]) |
| 2808 | tst_compi_setsockopt_so_nonblock="yes" |
| 2809 | ],[ |
| 2810 | AC_MSG_RESULT([no]) |
| 2811 | tst_compi_setsockopt_so_nonblock="no" |
| 2812 | ]) |
| 2813 | fi |
| 2814 | # |
| 2815 | if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then |
| 2816 | AC_MSG_CHECKING([if setsockopt SO_NONBLOCK usage allowed]) |
| 2817 | if test "x$cares_disallow_setsockopt_so_nonblock" != "xyes"; then |
| 2818 | AC_MSG_RESULT([yes]) |
| 2819 | tst_allow_setsockopt_so_nonblock="yes" |
| 2820 | else |
| 2821 | AC_MSG_RESULT([no]) |
| 2822 | tst_allow_setsockopt_so_nonblock="no" |
| 2823 | fi |
| 2824 | fi |
| 2825 | # |
| 2826 | AC_MSG_CHECKING([if setsockopt SO_NONBLOCK might be used]) |
| 2827 | if test "$tst_compi_setsockopt_so_nonblock" = "yes" && |
| 2828 | test "$tst_allow_setsockopt_so_nonblock" = "yes"; then |
| 2829 | AC_MSG_RESULT([yes]) |
| 2830 | AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT_SO_NONBLOCK, 1, |
| 2831 | [Define to 1 if you have a working setsockopt SO_NONBLOCK function.]) |
| 2832 | ac_cv_func_setsockopt_so_nonblock="yes" |
| 2833 | else |
| 2834 | AC_MSG_RESULT([no]) |
| 2835 | ac_cv_func_setsockopt_so_nonblock="no" |
| 2836 | fi |
| 2837 | ]) |
| 2838 | |
| 2839 | |
| 2840 | dnl CARES_CHECK_FUNC_SOCKET |
| 2841 | dnl ------------------------------------------------- |
| 2842 | dnl Verify if socket is available, prototyped, and |
| 2843 | dnl can be compiled. If all of these are true, and |
| 2844 | dnl usage has not been previously disallowed with |
| 2845 | dnl shell variable cares_disallow_socket, then |
| 2846 | dnl HAVE_SOCKET will be defined. |
| 2847 | |
| 2848 | AC_DEFUN([CARES_CHECK_FUNC_SOCKET], [ |
| 2849 | AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl |
| 2850 | AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl |
| 2851 | AC_REQUIRE([CARES_INCLUDES_SOCKET])dnl |
| 2852 | # |
| 2853 | tst_links_socket="unknown" |
| 2854 | tst_proto_socket="unknown" |
| 2855 | tst_compi_socket="unknown" |
| 2856 | tst_allow_socket="unknown" |
| 2857 | # |
| 2858 | AC_MSG_CHECKING([if socket can be linked]) |
| 2859 | AC_LINK_IFELSE([ |
| 2860 | AC_LANG_PROGRAM([[ |
| 2861 | $cares_includes_winsock2 |
| 2862 | $cares_includes_sys_socket |
| 2863 | $cares_includes_socket |
| 2864 | ]],[[ |
| 2865 | if(0 != socket(0, 0, 0)) |
| 2866 | return 1; |
| 2867 | ]]) |
| 2868 | ],[ |
| 2869 | AC_MSG_RESULT([yes]) |
| 2870 | tst_links_socket="yes" |
| 2871 | ],[ |
| 2872 | AC_MSG_RESULT([no]) |
| 2873 | tst_links_socket="no" |
| 2874 | ]) |
| 2875 | # |
| 2876 | if test "$tst_links_socket" = "yes"; then |
| 2877 | AC_MSG_CHECKING([if socket is prototyped]) |
| 2878 | AC_EGREP_CPP([socket],[ |
| 2879 | $cares_includes_winsock2 |
| 2880 | $cares_includes_sys_socket |
| 2881 | $cares_includes_socket |
| 2882 | ],[ |
| 2883 | AC_MSG_RESULT([yes]) |
| 2884 | tst_proto_socket="yes" |
| 2885 | ],[ |
| 2886 | AC_MSG_RESULT([no]) |
| 2887 | tst_proto_socket="no" |
| 2888 | ]) |
| 2889 | fi |
| 2890 | # |
| 2891 | if test "$tst_proto_socket" = "yes"; then |
| 2892 | AC_MSG_CHECKING([if socket is compilable]) |
| 2893 | AC_COMPILE_IFELSE([ |
| 2894 | AC_LANG_PROGRAM([[ |
| 2895 | $cares_includes_winsock2 |
| 2896 | $cares_includes_sys_socket |
| 2897 | $cares_includes_socket |
| 2898 | ]],[[ |
| 2899 | if(0 != socket(0, 0, 0)) |
| 2900 | return 1; |
| 2901 | ]]) |
| 2902 | ],[ |
| 2903 | AC_MSG_RESULT([yes]) |
| 2904 | tst_compi_socket="yes" |
| 2905 | ],[ |
| 2906 | AC_MSG_RESULT([no]) |
| 2907 | tst_compi_socket="no" |
| 2908 | ]) |
| 2909 | fi |
| 2910 | # |
| 2911 | if test "$tst_compi_socket" = "yes"; then |
| 2912 | AC_MSG_CHECKING([if socket usage allowed]) |
| 2913 | if test "x$cares_disallow_socket" != "xyes"; then |
| 2914 | AC_MSG_RESULT([yes]) |
| 2915 | tst_allow_socket="yes" |
| 2916 | else |
| 2917 | AC_MSG_RESULT([no]) |
| 2918 | tst_allow_socket="no" |
| 2919 | fi |
| 2920 | fi |
| 2921 | # |
| 2922 | AC_MSG_CHECKING([if socket might be used]) |
| 2923 | if test "$tst_links_socket" = "yes" && |
| 2924 | test "$tst_proto_socket" = "yes" && |
| 2925 | test "$tst_compi_socket" = "yes" && |
| 2926 | test "$tst_allow_socket" = "yes"; then |
| 2927 | AC_MSG_RESULT([yes]) |
| 2928 | AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1, |
| 2929 | [Define to 1 if you have the socket function.]) |
| 2930 | ac_cv_func_socket="yes" |
| 2931 | else |
| 2932 | AC_MSG_RESULT([no]) |
| 2933 | ac_cv_func_socket="no" |
| 2934 | fi |
| 2935 | ]) |
| 2936 | |
| 2937 | |
| 2938 | dnl CARES_CHECK_FUNC_STRCASECMP |
| 2939 | dnl ------------------------------------------------- |
| 2940 | dnl Verify if strcasecmp is available, prototyped, and |
| 2941 | dnl can be compiled. If all of these are true, and |
| 2942 | dnl usage has not been previously disallowed with |
| 2943 | dnl shell variable cares_disallow_strcasecmp, then |
| 2944 | dnl HAVE_STRCASECMP will be defined. |
| 2945 | |
| 2946 | AC_DEFUN([CARES_CHECK_FUNC_STRCASECMP], [ |
| 2947 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 2948 | # |
| 2949 | tst_links_strcasecmp="unknown" |
| 2950 | tst_proto_strcasecmp="unknown" |
| 2951 | tst_compi_strcasecmp="unknown" |
| 2952 | tst_allow_strcasecmp="unknown" |
| 2953 | # |
| 2954 | AC_MSG_CHECKING([if strcasecmp can be linked]) |
| 2955 | AC_LINK_IFELSE([ |
| 2956 | AC_LANG_FUNC_LINK_TRY([strcasecmp]) |
| 2957 | ],[ |
| 2958 | AC_MSG_RESULT([yes]) |
| 2959 | tst_links_strcasecmp="yes" |
| 2960 | ],[ |
| 2961 | AC_MSG_RESULT([no]) |
| 2962 | tst_links_strcasecmp="no" |
| 2963 | ]) |
| 2964 | # |
| 2965 | if test "$tst_links_strcasecmp" = "yes"; then |
| 2966 | AC_MSG_CHECKING([if strcasecmp is prototyped]) |
| 2967 | AC_EGREP_CPP([strcasecmp],[ |
| 2968 | $cares_includes_string |
| 2969 | ],[ |
| 2970 | AC_MSG_RESULT([yes]) |
| 2971 | tst_proto_strcasecmp="yes" |
| 2972 | ],[ |
| 2973 | AC_MSG_RESULT([no]) |
| 2974 | tst_proto_strcasecmp="no" |
| 2975 | ]) |
| 2976 | fi |
| 2977 | # |
| 2978 | if test "$tst_proto_strcasecmp" = "yes"; then |
| 2979 | AC_MSG_CHECKING([if strcasecmp is compilable]) |
| 2980 | AC_COMPILE_IFELSE([ |
| 2981 | AC_LANG_PROGRAM([[ |
| 2982 | $cares_includes_string |
| 2983 | ]],[[ |
| 2984 | if(0 != strcasecmp(0, 0)) |
| 2985 | return 1; |
| 2986 | ]]) |
| 2987 | ],[ |
| 2988 | AC_MSG_RESULT([yes]) |
| 2989 | tst_compi_strcasecmp="yes" |
| 2990 | ],[ |
| 2991 | AC_MSG_RESULT([no]) |
| 2992 | tst_compi_strcasecmp="no" |
| 2993 | ]) |
| 2994 | fi |
| 2995 | # |
| 2996 | if test "$tst_compi_strcasecmp" = "yes"; then |
| 2997 | AC_MSG_CHECKING([if strcasecmp usage allowed]) |
| 2998 | if test "x$cares_disallow_strcasecmp" != "xyes"; then |
| 2999 | AC_MSG_RESULT([yes]) |
| 3000 | tst_allow_strcasecmp="yes" |
| 3001 | else |
| 3002 | AC_MSG_RESULT([no]) |
| 3003 | tst_allow_strcasecmp="no" |
| 3004 | fi |
| 3005 | fi |
| 3006 | # |
| 3007 | AC_MSG_CHECKING([if strcasecmp might be used]) |
| 3008 | if test "$tst_links_strcasecmp" = "yes" && |
| 3009 | test "$tst_proto_strcasecmp" = "yes" && |
| 3010 | test "$tst_compi_strcasecmp" = "yes" && |
| 3011 | test "$tst_allow_strcasecmp" = "yes"; then |
| 3012 | AC_MSG_RESULT([yes]) |
| 3013 | AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1, |
| 3014 | [Define to 1 if you have the strcasecmp function.]) |
| 3015 | ac_cv_func_strcasecmp="yes" |
| 3016 | else |
| 3017 | AC_MSG_RESULT([no]) |
| 3018 | ac_cv_func_strcasecmp="no" |
| 3019 | fi |
| 3020 | ]) |
| 3021 | |
| 3022 | |
| 3023 | dnl CARES_CHECK_FUNC_STRCMPI |
| 3024 | dnl ------------------------------------------------- |
| 3025 | dnl Verify if strcmpi is available, prototyped, and |
| 3026 | dnl can be compiled. If all of these are true, and |
| 3027 | dnl usage has not been previously disallowed with |
| 3028 | dnl shell variable cares_disallow_strcmpi, then |
| 3029 | dnl HAVE_STRCMPI will be defined. |
| 3030 | |
| 3031 | AC_DEFUN([CARES_CHECK_FUNC_STRCMPI], [ |
| 3032 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 3033 | # |
| 3034 | tst_links_strcmpi="unknown" |
| 3035 | tst_proto_strcmpi="unknown" |
| 3036 | tst_compi_strcmpi="unknown" |
| 3037 | tst_allow_strcmpi="unknown" |
| 3038 | # |
| 3039 | AC_MSG_CHECKING([if strcmpi can be linked]) |
| 3040 | AC_LINK_IFELSE([ |
| 3041 | AC_LANG_FUNC_LINK_TRY([strcmpi]) |
| 3042 | ],[ |
| 3043 | AC_MSG_RESULT([yes]) |
| 3044 | tst_links_strcmpi="yes" |
| 3045 | ],[ |
| 3046 | AC_MSG_RESULT([no]) |
| 3047 | tst_links_strcmpi="no" |
| 3048 | ]) |
| 3049 | # |
| 3050 | if test "$tst_links_strcmpi" = "yes"; then |
| 3051 | AC_MSG_CHECKING([if strcmpi is prototyped]) |
| 3052 | AC_EGREP_CPP([strcmpi],[ |
| 3053 | $cares_includes_string |
| 3054 | ],[ |
| 3055 | AC_MSG_RESULT([yes]) |
| 3056 | tst_proto_strcmpi="yes" |
| 3057 | ],[ |
| 3058 | AC_MSG_RESULT([no]) |
| 3059 | tst_proto_strcmpi="no" |
| 3060 | ]) |
| 3061 | fi |
| 3062 | # |
| 3063 | if test "$tst_proto_strcmpi" = "yes"; then |
| 3064 | AC_MSG_CHECKING([if strcmpi is compilable]) |
| 3065 | AC_COMPILE_IFELSE([ |
| 3066 | AC_LANG_PROGRAM([[ |
| 3067 | $cares_includes_string |
| 3068 | ]],[[ |
| 3069 | if(0 != strcmpi(0, 0)) |
| 3070 | return 1; |
| 3071 | ]]) |
| 3072 | ],[ |
| 3073 | AC_MSG_RESULT([yes]) |
| 3074 | tst_compi_strcmpi="yes" |
| 3075 | ],[ |
| 3076 | AC_MSG_RESULT([no]) |
| 3077 | tst_compi_strcmpi="no" |
| 3078 | ]) |
| 3079 | fi |
| 3080 | # |
| 3081 | if test "$tst_compi_strcmpi" = "yes"; then |
| 3082 | AC_MSG_CHECKING([if strcmpi usage allowed]) |
| 3083 | if test "x$cares_disallow_strcmpi" != "xyes"; then |
| 3084 | AC_MSG_RESULT([yes]) |
| 3085 | tst_allow_strcmpi="yes" |
| 3086 | else |
| 3087 | AC_MSG_RESULT([no]) |
| 3088 | tst_allow_strcmpi="no" |
| 3089 | fi |
| 3090 | fi |
| 3091 | # |
| 3092 | AC_MSG_CHECKING([if strcmpi might be used]) |
| 3093 | if test "$tst_links_strcmpi" = "yes" && |
| 3094 | test "$tst_proto_strcmpi" = "yes" && |
| 3095 | test "$tst_compi_strcmpi" = "yes" && |
| 3096 | test "$tst_allow_strcmpi" = "yes"; then |
| 3097 | AC_MSG_RESULT([yes]) |
| 3098 | AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1, |
| 3099 | [Define to 1 if you have the strcmpi function.]) |
| 3100 | ac_cv_func_strcmpi="yes" |
| 3101 | else |
| 3102 | AC_MSG_RESULT([no]) |
| 3103 | ac_cv_func_strcmpi="no" |
| 3104 | fi |
| 3105 | ]) |
| 3106 | |
| 3107 | |
| 3108 | dnl CARES_CHECK_FUNC_STRDUP |
| 3109 | dnl ------------------------------------------------- |
| 3110 | dnl Verify if strdup is available, prototyped, and |
| 3111 | dnl can be compiled. If all of these are true, and |
| 3112 | dnl usage has not been previously disallowed with |
| 3113 | dnl shell variable cares_disallow_strdup, then |
| 3114 | dnl HAVE_STRDUP will be defined. |
| 3115 | |
| 3116 | AC_DEFUN([CARES_CHECK_FUNC_STRDUP], [ |
| 3117 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 3118 | # |
| 3119 | tst_links_strdup="unknown" |
| 3120 | tst_proto_strdup="unknown" |
| 3121 | tst_compi_strdup="unknown" |
| 3122 | tst_allow_strdup="unknown" |
| 3123 | # |
| 3124 | AC_MSG_CHECKING([if strdup can be linked]) |
| 3125 | AC_LINK_IFELSE([ |
| 3126 | AC_LANG_FUNC_LINK_TRY([strdup]) |
| 3127 | ],[ |
| 3128 | AC_MSG_RESULT([yes]) |
| 3129 | tst_links_strdup="yes" |
| 3130 | ],[ |
| 3131 | AC_MSG_RESULT([no]) |
| 3132 | tst_links_strdup="no" |
| 3133 | ]) |
| 3134 | # |
| 3135 | if test "$tst_links_strdup" = "yes"; then |
| 3136 | AC_MSG_CHECKING([if strdup is prototyped]) |
| 3137 | AC_EGREP_CPP([strdup],[ |
| 3138 | $cares_includes_string |
| 3139 | ],[ |
| 3140 | AC_MSG_RESULT([yes]) |
| 3141 | tst_proto_strdup="yes" |
| 3142 | ],[ |
| 3143 | AC_MSG_RESULT([no]) |
| 3144 | tst_proto_strdup="no" |
| 3145 | ]) |
| 3146 | fi |
| 3147 | # |
| 3148 | if test "$tst_proto_strdup" = "yes"; then |
| 3149 | AC_MSG_CHECKING([if strdup is compilable]) |
| 3150 | AC_COMPILE_IFELSE([ |
| 3151 | AC_LANG_PROGRAM([[ |
| 3152 | $cares_includes_string |
| 3153 | ]],[[ |
| 3154 | if(0 != strdup(0)) |
| 3155 | return 1; |
| 3156 | ]]) |
| 3157 | ],[ |
| 3158 | AC_MSG_RESULT([yes]) |
| 3159 | tst_compi_strdup="yes" |
| 3160 | ],[ |
| 3161 | AC_MSG_RESULT([no]) |
| 3162 | tst_compi_strdup="no" |
| 3163 | ]) |
| 3164 | fi |
| 3165 | # |
| 3166 | if test "$tst_compi_strdup" = "yes"; then |
| 3167 | AC_MSG_CHECKING([if strdup usage allowed]) |
| 3168 | if test "x$cares_disallow_strdup" != "xyes"; then |
| 3169 | AC_MSG_RESULT([yes]) |
| 3170 | tst_allow_strdup="yes" |
| 3171 | else |
| 3172 | AC_MSG_RESULT([no]) |
| 3173 | tst_allow_strdup="no" |
| 3174 | fi |
| 3175 | fi |
| 3176 | # |
| 3177 | AC_MSG_CHECKING([if strdup might be used]) |
| 3178 | if test "$tst_links_strdup" = "yes" && |
| 3179 | test "$tst_proto_strdup" = "yes" && |
| 3180 | test "$tst_compi_strdup" = "yes" && |
| 3181 | test "$tst_allow_strdup" = "yes"; then |
| 3182 | AC_MSG_RESULT([yes]) |
| 3183 | AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1, |
| 3184 | [Define to 1 if you have the strdup function.]) |
| 3185 | ac_cv_func_strdup="yes" |
| 3186 | else |
| 3187 | AC_MSG_RESULT([no]) |
| 3188 | ac_cv_func_strdup="no" |
| 3189 | fi |
| 3190 | ]) |
| 3191 | |
| 3192 | |
| 3193 | dnl CARES_CHECK_FUNC_STRICMP |
| 3194 | dnl ------------------------------------------------- |
| 3195 | dnl Verify if stricmp is available, prototyped, and |
| 3196 | dnl can be compiled. If all of these are true, and |
| 3197 | dnl usage has not been previously disallowed with |
| 3198 | dnl shell variable cares_disallow_stricmp, then |
| 3199 | dnl HAVE_STRICMP will be defined. |
| 3200 | |
| 3201 | AC_DEFUN([CARES_CHECK_FUNC_STRICMP], [ |
| 3202 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 3203 | # |
| 3204 | tst_links_stricmp="unknown" |
| 3205 | tst_proto_stricmp="unknown" |
| 3206 | tst_compi_stricmp="unknown" |
| 3207 | tst_allow_stricmp="unknown" |
| 3208 | # |
| 3209 | AC_MSG_CHECKING([if stricmp can be linked]) |
| 3210 | AC_LINK_IFELSE([ |
| 3211 | AC_LANG_FUNC_LINK_TRY([stricmp]) |
| 3212 | ],[ |
| 3213 | AC_MSG_RESULT([yes]) |
| 3214 | tst_links_stricmp="yes" |
| 3215 | ],[ |
| 3216 | AC_MSG_RESULT([no]) |
| 3217 | tst_links_stricmp="no" |
| 3218 | ]) |
| 3219 | # |
| 3220 | if test "$tst_links_stricmp" = "yes"; then |
| 3221 | AC_MSG_CHECKING([if stricmp is prototyped]) |
| 3222 | AC_EGREP_CPP([stricmp],[ |
| 3223 | $cares_includes_string |
| 3224 | ],[ |
| 3225 | AC_MSG_RESULT([yes]) |
| 3226 | tst_proto_stricmp="yes" |
| 3227 | ],[ |
| 3228 | AC_MSG_RESULT([no]) |
| 3229 | tst_proto_stricmp="no" |
| 3230 | ]) |
| 3231 | fi |
| 3232 | # |
| 3233 | if test "$tst_proto_stricmp" = "yes"; then |
| 3234 | AC_MSG_CHECKING([if stricmp is compilable]) |
| 3235 | AC_COMPILE_IFELSE([ |
| 3236 | AC_LANG_PROGRAM([[ |
| 3237 | $cares_includes_string |
| 3238 | ]],[[ |
| 3239 | if(0 != stricmp(0, 0)) |
| 3240 | return 1; |
| 3241 | ]]) |
| 3242 | ],[ |
| 3243 | AC_MSG_RESULT([yes]) |
| 3244 | tst_compi_stricmp="yes" |
| 3245 | ],[ |
| 3246 | AC_MSG_RESULT([no]) |
| 3247 | tst_compi_stricmp="no" |
| 3248 | ]) |
| 3249 | fi |
| 3250 | # |
| 3251 | if test "$tst_compi_stricmp" = "yes"; then |
| 3252 | AC_MSG_CHECKING([if stricmp usage allowed]) |
| 3253 | if test "x$cares_disallow_stricmp" != "xyes"; then |
| 3254 | AC_MSG_RESULT([yes]) |
| 3255 | tst_allow_stricmp="yes" |
| 3256 | else |
| 3257 | AC_MSG_RESULT([no]) |
| 3258 | tst_allow_stricmp="no" |
| 3259 | fi |
| 3260 | fi |
| 3261 | # |
| 3262 | AC_MSG_CHECKING([if stricmp might be used]) |
| 3263 | if test "$tst_links_stricmp" = "yes" && |
| 3264 | test "$tst_proto_stricmp" = "yes" && |
| 3265 | test "$tst_compi_stricmp" = "yes" && |
| 3266 | test "$tst_allow_stricmp" = "yes"; then |
| 3267 | AC_MSG_RESULT([yes]) |
| 3268 | AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1, |
| 3269 | [Define to 1 if you have the stricmp function.]) |
| 3270 | ac_cv_func_stricmp="yes" |
| 3271 | else |
| 3272 | AC_MSG_RESULT([no]) |
| 3273 | ac_cv_func_stricmp="no" |
| 3274 | fi |
| 3275 | ]) |
| 3276 | |
| 3277 | |
| 3278 | dnl CARES_CHECK_FUNC_STRNCASECMP |
| 3279 | dnl ------------------------------------------------- |
| 3280 | dnl Verify if strncasecmp is available, prototyped, and |
| 3281 | dnl can be compiled. If all of these are true, and |
| 3282 | dnl usage has not been previously disallowed with |
| 3283 | dnl shell variable cares_disallow_strncasecmp, then |
| 3284 | dnl HAVE_STRNCASECMP will be defined. |
| 3285 | |
| 3286 | AC_DEFUN([CARES_CHECK_FUNC_STRNCASECMP], [ |
| 3287 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 3288 | # |
| 3289 | tst_links_strncasecmp="unknown" |
| 3290 | tst_proto_strncasecmp="unknown" |
| 3291 | tst_compi_strncasecmp="unknown" |
| 3292 | tst_allow_strncasecmp="unknown" |
| 3293 | # |
| 3294 | AC_MSG_CHECKING([if strncasecmp can be linked]) |
| 3295 | AC_LINK_IFELSE([ |
| 3296 | AC_LANG_FUNC_LINK_TRY([strncasecmp]) |
| 3297 | ],[ |
| 3298 | AC_MSG_RESULT([yes]) |
| 3299 | tst_links_strncasecmp="yes" |
| 3300 | ],[ |
| 3301 | AC_MSG_RESULT([no]) |
| 3302 | tst_links_strncasecmp="no" |
| 3303 | ]) |
| 3304 | # |
| 3305 | if test "$tst_links_strncasecmp" = "yes"; then |
| 3306 | AC_MSG_CHECKING([if strncasecmp is prototyped]) |
| 3307 | AC_EGREP_CPP([strncasecmp],[ |
| 3308 | $cares_includes_string |
| 3309 | ],[ |
| 3310 | AC_MSG_RESULT([yes]) |
| 3311 | tst_proto_strncasecmp="yes" |
| 3312 | ],[ |
| 3313 | AC_MSG_RESULT([no]) |
| 3314 | tst_proto_strncasecmp="no" |
| 3315 | ]) |
| 3316 | fi |
| 3317 | # |
| 3318 | if test "$tst_proto_strncasecmp" = "yes"; then |
| 3319 | AC_MSG_CHECKING([if strncasecmp is compilable]) |
| 3320 | AC_COMPILE_IFELSE([ |
| 3321 | AC_LANG_PROGRAM([[ |
| 3322 | $cares_includes_string |
| 3323 | ]],[[ |
| 3324 | if(0 != strncasecmp(0, 0, 0)) |
| 3325 | return 1; |
| 3326 | ]]) |
| 3327 | ],[ |
| 3328 | AC_MSG_RESULT([yes]) |
| 3329 | tst_compi_strncasecmp="yes" |
| 3330 | ],[ |
| 3331 | AC_MSG_RESULT([no]) |
| 3332 | tst_compi_strncasecmp="no" |
| 3333 | ]) |
| 3334 | fi |
| 3335 | # |
| 3336 | if test "$tst_compi_strncasecmp" = "yes"; then |
| 3337 | AC_MSG_CHECKING([if strncasecmp usage allowed]) |
| 3338 | if test "x$cares_disallow_strncasecmp" != "xyes"; then |
| 3339 | AC_MSG_RESULT([yes]) |
| 3340 | tst_allow_strncasecmp="yes" |
| 3341 | else |
| 3342 | AC_MSG_RESULT([no]) |
| 3343 | tst_allow_strncasecmp="no" |
| 3344 | fi |
| 3345 | fi |
| 3346 | # |
| 3347 | AC_MSG_CHECKING([if strncasecmp might be used]) |
| 3348 | if test "$tst_links_strncasecmp" = "yes" && |
| 3349 | test "$tst_proto_strncasecmp" = "yes" && |
| 3350 | test "$tst_compi_strncasecmp" = "yes" && |
| 3351 | test "$tst_allow_strncasecmp" = "yes"; then |
| 3352 | AC_MSG_RESULT([yes]) |
| 3353 | AC_DEFINE_UNQUOTED(HAVE_STRNCASECMP, 1, |
| 3354 | [Define to 1 if you have the strncasecmp function.]) |
| 3355 | ac_cv_func_strncasecmp="yes" |
| 3356 | else |
| 3357 | AC_MSG_RESULT([no]) |
| 3358 | ac_cv_func_strncasecmp="no" |
| 3359 | fi |
| 3360 | ]) |
| 3361 | |
| 3362 | |
| 3363 | dnl CARES_CHECK_FUNC_STRNCMPI |
| 3364 | dnl ------------------------------------------------- |
| 3365 | dnl Verify if strncmpi is available, prototyped, and |
| 3366 | dnl can be compiled. If all of these are true, and |
| 3367 | dnl usage has not been previously disallowed with |
| 3368 | dnl shell variable cares_disallow_strncmpi, then |
| 3369 | dnl HAVE_STRNCMPI will be defined. |
| 3370 | |
| 3371 | AC_DEFUN([CARES_CHECK_FUNC_STRNCMPI], [ |
| 3372 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 3373 | # |
| 3374 | tst_links_strncmpi="unknown" |
| 3375 | tst_proto_strncmpi="unknown" |
| 3376 | tst_compi_strncmpi="unknown" |
| 3377 | tst_allow_strncmpi="unknown" |
| 3378 | # |
| 3379 | AC_MSG_CHECKING([if strncmpi can be linked]) |
| 3380 | AC_LINK_IFELSE([ |
| 3381 | AC_LANG_FUNC_LINK_TRY([strncmpi]) |
| 3382 | ],[ |
| 3383 | AC_MSG_RESULT([yes]) |
| 3384 | tst_links_strncmpi="yes" |
| 3385 | ],[ |
| 3386 | AC_MSG_RESULT([no]) |
| 3387 | tst_links_strncmpi="no" |
| 3388 | ]) |
| 3389 | # |
| 3390 | if test "$tst_links_strncmpi" = "yes"; then |
| 3391 | AC_MSG_CHECKING([if strncmpi is prototyped]) |
| 3392 | AC_EGREP_CPP([strncmpi],[ |
| 3393 | $cares_includes_string |
| 3394 | ],[ |
| 3395 | AC_MSG_RESULT([yes]) |
| 3396 | tst_proto_strncmpi="yes" |
| 3397 | ],[ |
| 3398 | AC_MSG_RESULT([no]) |
| 3399 | tst_proto_strncmpi="no" |
| 3400 | ]) |
| 3401 | fi |
| 3402 | # |
| 3403 | if test "$tst_proto_strncmpi" = "yes"; then |
| 3404 | AC_MSG_CHECKING([if strncmpi is compilable]) |
| 3405 | AC_COMPILE_IFELSE([ |
| 3406 | AC_LANG_PROGRAM([[ |
| 3407 | $cares_includes_string |
| 3408 | ]],[[ |
| 3409 | if(0 != strncmpi(0, 0)) |
| 3410 | return 1; |
| 3411 | ]]) |
| 3412 | ],[ |
| 3413 | AC_MSG_RESULT([yes]) |
| 3414 | tst_compi_strncmpi="yes" |
| 3415 | ],[ |
| 3416 | AC_MSG_RESULT([no]) |
| 3417 | tst_compi_strncmpi="no" |
| 3418 | ]) |
| 3419 | fi |
| 3420 | # |
| 3421 | if test "$tst_compi_strncmpi" = "yes"; then |
| 3422 | AC_MSG_CHECKING([if strncmpi usage allowed]) |
| 3423 | if test "x$cares_disallow_strncmpi" != "xyes"; then |
| 3424 | AC_MSG_RESULT([yes]) |
| 3425 | tst_allow_strncmpi="yes" |
| 3426 | else |
| 3427 | AC_MSG_RESULT([no]) |
| 3428 | tst_allow_strncmpi="no" |
| 3429 | fi |
| 3430 | fi |
| 3431 | # |
| 3432 | AC_MSG_CHECKING([if strncmpi might be used]) |
| 3433 | if test "$tst_links_strncmpi" = "yes" && |
| 3434 | test "$tst_proto_strncmpi" = "yes" && |
| 3435 | test "$tst_compi_strncmpi" = "yes" && |
| 3436 | test "$tst_allow_strncmpi" = "yes"; then |
| 3437 | AC_MSG_RESULT([yes]) |
| 3438 | AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1, |
| 3439 | [Define to 1 if you have the strncmpi function.]) |
| 3440 | ac_cv_func_strncmpi="yes" |
| 3441 | else |
| 3442 | AC_MSG_RESULT([no]) |
| 3443 | ac_cv_func_strncmpi="no" |
| 3444 | fi |
| 3445 | ]) |
| 3446 | |
| 3447 | |
| 3448 | dnl CARES_CHECK_FUNC_STRNICMP |
| 3449 | dnl ------------------------------------------------- |
| 3450 | dnl Verify if strnicmp is available, prototyped, and |
| 3451 | dnl can be compiled. If all of these are true, and |
| 3452 | dnl usage has not been previously disallowed with |
| 3453 | dnl shell variable cares_disallow_strnicmp, then |
| 3454 | dnl HAVE_STRNICMP will be defined. |
| 3455 | |
| 3456 | AC_DEFUN([CARES_CHECK_FUNC_STRNICMP], [ |
| 3457 | AC_REQUIRE([CARES_INCLUDES_STRING])dnl |
| 3458 | # |
| 3459 | tst_links_strnicmp="unknown" |
| 3460 | tst_proto_strnicmp="unknown" |
| 3461 | tst_compi_strnicmp="unknown" |
| 3462 | tst_allow_strnicmp="unknown" |
| 3463 | # |
| 3464 | AC_MSG_CHECKING([if strnicmp can be linked]) |
| 3465 | AC_LINK_IFELSE([ |
| 3466 | AC_LANG_FUNC_LINK_TRY([strnicmp]) |
| 3467 | ],[ |
| 3468 | AC_MSG_RESULT([yes]) |
| 3469 | tst_links_strnicmp="yes" |
| 3470 | ],[ |
| 3471 | AC_MSG_RESULT([no]) |
| 3472 | tst_links_strnicmp="no" |
| 3473 | ]) |
| 3474 | # |
| 3475 | if test "$tst_links_strnicmp" = "yes"; then |
| 3476 | AC_MSG_CHECKING([if strnicmp is prototyped]) |
| 3477 | AC_EGREP_CPP([strnicmp],[ |
| 3478 | $cares_includes_string |
| 3479 | ],[ |
| 3480 | AC_MSG_RESULT([yes]) |
| 3481 | tst_proto_strnicmp="yes" |
| 3482 | ],[ |
| 3483 | AC_MSG_RESULT([no]) |
| 3484 | tst_proto_strnicmp="no" |
| 3485 | ]) |
| 3486 | fi |
| 3487 | # |
| 3488 | if test "$tst_proto_strnicmp" = "yes"; then |
| 3489 | AC_MSG_CHECKING([if strnicmp is compilable]) |
| 3490 | AC_COMPILE_IFELSE([ |
| 3491 | AC_LANG_PROGRAM([[ |
| 3492 | $cares_includes_string |
| 3493 | ]],[[ |
| 3494 | if(0 != strnicmp(0, 0)) |
| 3495 | return 1; |
| 3496 | ]]) |
| 3497 | ],[ |
| 3498 | AC_MSG_RESULT([yes]) |
| 3499 | tst_compi_strnicmp="yes" |
| 3500 | ],[ |
| 3501 | AC_MSG_RESULT([no]) |
| 3502 | tst_compi_strnicmp="no" |
| 3503 | ]) |
| 3504 | fi |
| 3505 | # |
| 3506 | if test "$tst_compi_strnicmp" = "yes"; then |
| 3507 | AC_MSG_CHECKING([if strnicmp usage allowed]) |
| 3508 | if test "x$cares_disallow_strnicmp" != "xyes"; then |
| 3509 | AC_MSG_RESULT([yes]) |
| 3510 | tst_allow_strnicmp="yes" |
| 3511 | else |
| 3512 | AC_MSG_RESULT([no]) |
| 3513 | tst_allow_strnicmp="no" |
| 3514 | fi |
| 3515 | fi |
| 3516 | # |
| 3517 | AC_MSG_CHECKING([if strnicmp might be used]) |
| 3518 | if test "$tst_links_strnicmp" = "yes" && |
| 3519 | test "$tst_proto_strnicmp" = "yes" && |
| 3520 | test "$tst_compi_strnicmp" = "yes" && |
| 3521 | test "$tst_allow_strnicmp" = "yes"; then |
| 3522 | AC_MSG_RESULT([yes]) |
| 3523 | AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1, |
| 3524 | [Define to 1 if you have the strnicmp function.]) |
| 3525 | ac_cv_func_strnicmp="yes" |
| 3526 | else |
| 3527 | AC_MSG_RESULT([no]) |
| 3528 | ac_cv_func_strnicmp="no" |
| 3529 | fi |
| 3530 | ]) |
| 3531 | |
| 3532 | |
| 3533 | dnl CARES_CHECK_FUNC_WRITEV |
| 3534 | dnl ------------------------------------------------- |
| 3535 | dnl Verify if writev is available, prototyped, and |
| 3536 | dnl can be compiled. If all of these are true, and |
| 3537 | dnl usage has not been previously disallowed with |
| 3538 | dnl shell variable cares_disallow_writev, then |
| 3539 | dnl HAVE_WRITEV will be defined. |
| 3540 | |
| 3541 | AC_DEFUN([CARES_CHECK_FUNC_WRITEV], [ |
| 3542 | AC_REQUIRE([CARES_INCLUDES_SYS_UIO])dnl |
| 3543 | # |
| 3544 | tst_links_writev="unknown" |
| 3545 | tst_proto_writev="unknown" |
| 3546 | tst_compi_writev="unknown" |
| 3547 | tst_allow_writev="unknown" |
| 3548 | # |
| 3549 | AC_MSG_CHECKING([if writev can be linked]) |
| 3550 | AC_LINK_IFELSE([ |
| 3551 | AC_LANG_FUNC_LINK_TRY([writev]) |
| 3552 | ],[ |
| 3553 | AC_MSG_RESULT([yes]) |
| 3554 | tst_links_writev="yes" |
| 3555 | ],[ |
| 3556 | AC_MSG_RESULT([no]) |
| 3557 | tst_links_writev="no" |
| 3558 | ]) |
| 3559 | # |
| 3560 | if test "$tst_links_writev" = "yes"; then |
| 3561 | AC_MSG_CHECKING([if writev is prototyped]) |
| 3562 | AC_EGREP_CPP([writev],[ |
| 3563 | $cares_includes_sys_uio |
| 3564 | ],[ |
| 3565 | AC_MSG_RESULT([yes]) |
| 3566 | tst_proto_writev="yes" |
| 3567 | ],[ |
| 3568 | AC_MSG_RESULT([no]) |
| 3569 | tst_proto_writev="no" |
| 3570 | ]) |
| 3571 | fi |
| 3572 | # |
| 3573 | if test "$tst_proto_writev" = "yes"; then |
| 3574 | AC_MSG_CHECKING([if writev is compilable]) |
| 3575 | AC_COMPILE_IFELSE([ |
| 3576 | AC_LANG_PROGRAM([[ |
| 3577 | $cares_includes_sys_uio |
| 3578 | ]],[[ |
| 3579 | if(0 != writev(0, 0, 0)) |
| 3580 | return 1; |
| 3581 | ]]) |
| 3582 | ],[ |
| 3583 | AC_MSG_RESULT([yes]) |
| 3584 | tst_compi_writev="yes" |
| 3585 | ],[ |
| 3586 | AC_MSG_RESULT([no]) |
| 3587 | tst_compi_writev="no" |
| 3588 | ]) |
| 3589 | fi |
| 3590 | # |
| 3591 | if test "$tst_compi_writev" = "yes"; then |
| 3592 | AC_MSG_CHECKING([if writev usage allowed]) |
| 3593 | if test "x$cares_disallow_writev" != "xyes"; then |
| 3594 | AC_MSG_RESULT([yes]) |
| 3595 | tst_allow_writev="yes" |
| 3596 | else |
| 3597 | AC_MSG_RESULT([no]) |
| 3598 | tst_allow_writev="no" |
| 3599 | fi |
| 3600 | fi |
| 3601 | # |
| 3602 | AC_MSG_CHECKING([if writev might be used]) |
| 3603 | if test "$tst_links_writev" = "yes" && |
| 3604 | test "$tst_proto_writev" = "yes" && |
| 3605 | test "$tst_compi_writev" = "yes" && |
| 3606 | test "$tst_allow_writev" = "yes"; then |
| 3607 | AC_MSG_RESULT([yes]) |
| 3608 | AC_DEFINE_UNQUOTED(HAVE_WRITEV, 1, |
| 3609 | [Define to 1 if you have the writev function.]) |
| 3610 | ac_cv_func_writev="yes" |
| 3611 | else |
| 3612 | AC_MSG_RESULT([no]) |
| 3613 | ac_cv_func_writev="no" |
| 3614 | fi |
| 3615 | ]) |