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