Skip to content
Snippets Groups Projects
curl-functions.m4 154 KiB
Newer Older
  • Learn to ignore specific revisions
  •             (ipv6a[14] != 0x76) ||
                (ipv6a[15] != 0xc8) ||
    
                (ipv6a[16] != 0x01) )
    
              exit(1); /* fail */
            /* - */
            if( (ipv6a[2]  != 0x0) ||
                (ipv6a[3]  != 0x0) ||
                (ipv6a[4]  != 0x0) ||
                (ipv6a[5]  != 0x0) ||
                (ipv6a[6]  != 0x0) ||
    
                (ipv6a[7]  != 0x0) )
    
              exit(1); /* fail */
            /* - */
            exit(0);
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_works_inet_pton="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_works_inet_pton="no"
        ])
      fi
      #
      if test "$tst_compi_inet_pton" = "yes" &&
        test "$tst_works_inet_pton" != "no"; then
        AC_MSG_CHECKING([if inet_pton usage allowed])
        if test "x$curl_disallow_inet_pton" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_inet_pton="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_inet_pton="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if inet_pton might be used])
      if test "$tst_links_inet_pton" = "yes" &&
         test "$tst_proto_inet_pton" = "yes" &&
         test "$tst_compi_inet_pton" = "yes" &&
         test "$tst_allow_inet_pton" = "yes" &&
         test "$tst_works_inet_pton" != "no"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
          [Define to 1 if you have a IPv6 capable working inet_pton function.])
        ac_cv_func_inet_pton="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_inet_pton="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_IOCTL
    dnl -------------------------------------------------
    dnl Verify if ioctl is available, prototyped, and
    dnl can be compiled. If all of these are true, and
    dnl usage has not been previously disallowed with
    dnl shell variable curl_disallow_ioctl, then
    dnl HAVE_IOCTL will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [
      AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl
      #
      tst_links_ioctl="unknown"
      tst_proto_ioctl="unknown"
      tst_compi_ioctl="unknown"
      tst_allow_ioctl="unknown"
      #
      AC_MSG_CHECKING([if ioctl can be linked])
      AC_LINK_IFELSE([
        AC_LANG_FUNC_LINK_TRY([ioctl])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_ioctl="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_ioctl="no"
      ])
      #
      if test "$tst_links_ioctl" = "yes"; then
        AC_MSG_CHECKING([if ioctl is prototyped])
        AC_EGREP_CPP([ioctl],[
          $curl_includes_stropts
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_ioctl="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_ioctl="no"
        ])
      fi
      #
      if test "$tst_proto_ioctl" = "yes"; then
        AC_MSG_CHECKING([if ioctl is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_stropts
          ]],[[
            if(0 != ioctl(0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_ioctl="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_ioctl="no"
        ])
      fi
      #
      if test "$tst_compi_ioctl" = "yes"; then
        AC_MSG_CHECKING([if ioctl usage allowed])
        if test "x$curl_disallow_ioctl" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_ioctl="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_ioctl="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if ioctl might be used])
      if test "$tst_links_ioctl" = "yes" &&
         test "$tst_proto_ioctl" = "yes" &&
         test "$tst_compi_ioctl" = "yes" &&
         test "$tst_allow_ioctl" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1,
          [Define to 1 if you have the ioctl function.])
        ac_cv_func_ioctl="yes"
        CURL_CHECK_FUNC_IOCTL_FIONBIO
    
        CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
    
      else
        AC_MSG_RESULT([no])
        ac_cv_func_ioctl="no"
      fi
    ])
    
    
    dnl CURL_CHECK_FUNC_IOCTL_FIONBIO
    dnl -------------------------------------------------
    dnl Verify if ioctl with the FIONBIO command is
    dnl available, can be compiled, and seems to work. If
    dnl all of these are true, then HAVE_IOCTL_FIONBIO
    dnl will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [
      #
      tst_compi_ioctl_fionbio="unknown"
      tst_allow_ioctl_fionbio="unknown"
      #
      if test "$ac_cv_func_ioctl" = "yes"; then
        AC_MSG_CHECKING([if ioctl FIONBIO is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_stropts
          ]],[[
            int flags = 0;
            if(0 != ioctl(0, FIONBIO, &flags))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_ioctl_fionbio="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_ioctl_fionbio="no"
        ])
      fi
      #
      if test "$tst_compi_ioctl_fionbio" = "yes"; then
        AC_MSG_CHECKING([if ioctl FIONBIO usage allowed])
        if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_ioctl_fionbio="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_ioctl_fionbio="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if ioctl FIONBIO might be used])
      if test "$tst_compi_ioctl_fionbio" = "yes" &&
         test "$tst_allow_ioctl_fionbio" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1,
          [Define to 1 if you have a working ioctl FIONBIO function.])
        ac_cv_func_ioctl_fionbio="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_ioctl_fionbio="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
    dnl -------------------------------------------------
    
    dnl Verify if ioctl with the SIOCGIFADDR command is available,
    dnl struct ifreq is defined, they can be compiled, and seem to
    dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR
    
    dnl will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [
      #
      tst_compi_ioctl_siocgifaddr="unknown"
      tst_allow_ioctl_siocgifaddr="unknown"
      #
      if test "$ac_cv_func_ioctl" = "yes"; then
        AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_stropts
    
            struct ifreq ifr;
            if(0 != ioctl(0, SIOCGIFADDR, &ifr))
    
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_ioctl_siocgifaddr="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_ioctl_siocgifaddr="no"
        ])
      fi
      #
      if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then
        AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed])
        if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_ioctl_siocgifaddr="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_ioctl_siocgifaddr="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used])
      if test "$tst_compi_ioctl_siocgifaddr" = "yes" &&
         test "$tst_allow_ioctl_siocgifaddr" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1,
          [Define to 1 if you have a working ioctl SIOCGIFADDR function.])
        ac_cv_func_ioctl_siocgifaddr="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_ioctl_siocgifaddr="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_IOCTLSOCKET
    dnl -------------------------------------------------
    dnl Verify if ioctlsocket is available, prototyped, and
    dnl can be compiled. If all of these are true, and
    dnl usage has not been previously disallowed with
    dnl shell variable curl_disallow_ioctlsocket, then
    dnl HAVE_IOCTLSOCKET will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [
      AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
      #
      tst_links_ioctlsocket="unknown"
      tst_proto_ioctlsocket="unknown"
      tst_compi_ioctlsocket="unknown"
      tst_allow_ioctlsocket="unknown"
      #
      AC_MSG_CHECKING([if ioctlsocket can be linked])
      AC_LINK_IFELSE([
        AC_LANG_PROGRAM([[
          $curl_includes_winsock2
        ]],[[
          if(0 != ioctlsocket(0, 0, 0))
            return 1;
        ]])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_ioctlsocket="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_ioctlsocket="no"
      ])
      #
      if test "$tst_links_ioctlsocket" = "yes"; then
        AC_MSG_CHECKING([if ioctlsocket is prototyped])
        AC_EGREP_CPP([ioctlsocket],[
          $curl_includes_winsock2
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_ioctlsocket="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_ioctlsocket="no"
        ])
      fi
      #
      if test "$tst_proto_ioctlsocket" = "yes"; then
        AC_MSG_CHECKING([if ioctlsocket is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_winsock2
          ]],[[
            if(0 != ioctlsocket(0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_ioctlsocket="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_ioctlsocket="no"
        ])
      fi
      #
      if test "$tst_compi_ioctlsocket" = "yes"; then
        AC_MSG_CHECKING([if ioctlsocket usage allowed])
        if test "x$curl_disallow_ioctlsocket" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_ioctlsocket="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_ioctlsocket="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if ioctlsocket might be used])
      if test "$tst_links_ioctlsocket" = "yes" &&
         test "$tst_proto_ioctlsocket" = "yes" &&
         test "$tst_compi_ioctlsocket" = "yes" &&
         test "$tst_allow_ioctlsocket" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1,
          [Define to 1 if you have the ioctlsocket function.])
        ac_cv_func_ioctlsocket="yes"
        CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
      else
        AC_MSG_RESULT([no])
        ac_cv_func_ioctlsocket="no"
      fi
    ])
    
    
    dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
    dnl -------------------------------------------------
    dnl Verify if ioctlsocket with the FIONBIO command is
    dnl available, can be compiled, and seems to work. If
    dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO
    dnl will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [
      #
      tst_compi_ioctlsocket_fionbio="unknown"
      tst_allow_ioctlsocket_fionbio="unknown"
      #
      if test "$ac_cv_func_ioctlsocket" = "yes"; then
        AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_winsock2
          ]],[[
            int flags = 0;
            if(0 != ioctlsocket(0, FIONBIO, &flags))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_ioctlsocket_fionbio="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_ioctlsocket_fionbio="no"
        ])
      fi
      #
      if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then
        AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed])
        if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_ioctlsocket_fionbio="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_ioctlsocket_fionbio="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used])
      if test "$tst_compi_ioctlsocket_fionbio" = "yes" &&
         test "$tst_allow_ioctlsocket_fionbio" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1,
          [Define to 1 if you have a working ioctlsocket FIONBIO function.])
        ac_cv_func_ioctlsocket_fionbio="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_ioctlsocket_fionbio="no"
      fi
    ])
    
    
    dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
    dnl -------------------------------------------------
    dnl Verify if IoctlSocket is available, prototyped, and
    dnl can be compiled. If all of these are true, and
    dnl usage has not been previously disallowed with
    dnl shell variable curl_disallow_ioctlsocket_camel,
    dnl then HAVE_IOCTLSOCKET_CAMEL will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
      AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl
      #
      tst_links_ioctlsocket_camel="unknown"
      tst_proto_ioctlsocket_camel="unknown"
      tst_compi_ioctlsocket_camel="unknown"
      tst_allow_ioctlsocket_camel="unknown"
      #
      AC_MSG_CHECKING([if IoctlSocket can be linked])
      AC_LINK_IFELSE([
        AC_LANG_FUNC_LINK_TRY([IoctlSocket])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_ioctlsocket_camel="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_ioctlsocket_camel="no"
      ])
      #
      if test "$tst_links_ioctlsocket_camel" = "yes"; then
        AC_MSG_CHECKING([if IoctlSocket is prototyped])
        AC_EGREP_CPP([IoctlSocket],[
          $curl_includes_stropts
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_ioctlsocket_camel="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_ioctlsocket_camel="no"
        ])
      fi
      #
      if test "$tst_proto_ioctlsocket_camel" = "yes"; then
        AC_MSG_CHECKING([if IoctlSocket is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_stropts
          ]],[[
            if(0 != IoctlSocket(0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_ioctlsocket_camel="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_ioctlsocket_camel="no"
        ])
      fi
      #
      if test "$tst_compi_ioctlsocket_camel" = "yes"; then
        AC_MSG_CHECKING([if IoctlSocket usage allowed])
        if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_ioctlsocket_camel="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_ioctlsocket_camel="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if IoctlSocket might be used])
      if test "$tst_links_ioctlsocket_camel" = "yes" &&
         test "$tst_proto_ioctlsocket_camel" = "yes" &&
         test "$tst_compi_ioctlsocket_camel" = "yes" &&
         test "$tst_allow_ioctlsocket_camel" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1,
          [Define to 1 if you have the IoctlSocket camel case function.])
        ac_cv_func_ioctlsocket_camel="yes"
        CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
      else
        AC_MSG_RESULT([no])
        ac_cv_func_ioctlsocket_camel="no"
      fi
    ])
    
    
    dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
    dnl -------------------------------------------------
    dnl Verify if IoctlSocket with FIONBIO command is available,
    dnl can be compiled, and seems to work. If all of these are
    dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [
      #
      tst_compi_ioctlsocket_camel_fionbio="unknown"
      tst_allow_ioctlsocket_camel_fionbio="unknown"
      #
      if test "$ac_cv_func_ioctlsocket_camel" = "yes"; then
        AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_stropts
          ]],[[
            long flags = 0;
            if(0 != ioctlsocket(0, FIONBIO, &flags))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_ioctlsocket_camel_fionbio="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_ioctlsocket_camel_fionbio="no"
        ])
      fi
      #
      if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then
        AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed])
        if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_ioctlsocket_camel_fionbio="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_ioctlsocket_camel_fionbio="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used])
      if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" &&
         test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1,
          [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.])
        ac_cv_func_ioctlsocket_camel_fionbio="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_ioctlsocket_camel_fionbio="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_LOCALTIME_R
    dnl -------------------------------------------------
    dnl Verify if localtime_r is available, prototyped, can
    dnl be compiled and seems to work. If all of these are
    dnl true, and usage has not been previously disallowed
    dnl with shell variable curl_disallow_localtime_r, then
    dnl HAVE_LOCALTIME_R will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_LOCALTIME_R], [
    
      AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
    
      AC_REQUIRE([CURL_INCLUDES_TIME])dnl
      #
      tst_links_localtime_r="unknown"
      tst_proto_localtime_r="unknown"
      tst_compi_localtime_r="unknown"
      tst_works_localtime_r="unknown"
      tst_allow_localtime_r="unknown"
      #
      AC_MSG_CHECKING([if localtime_r can be linked])
      AC_LINK_IFELSE([
        AC_LANG_FUNC_LINK_TRY([localtime_r])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_localtime_r="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_localtime_r="no"
      ])
      #
      if test "$tst_links_localtime_r" = "yes"; then
        AC_MSG_CHECKING([if localtime_r is prototyped])
        AC_EGREP_CPP([localtime_r],[
          $curl_includes_time
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_localtime_r="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_localtime_r="no"
        ])
      fi
      #
      if test "$tst_proto_localtime_r" = "yes"; then
        AC_MSG_CHECKING([if localtime_r is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_time
          ]],[[
            if(0 != localtime_r(0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_localtime_r="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_localtime_r="no"
        ])
      fi
      #
      dnl only do runtime verification when not cross-compiling
      if test "x$cross_compiling" != "xyes" &&
        test "$tst_compi_localtime_r" = "yes"; then
        AC_MSG_CHECKING([if localtime_r seems to work])
        AC_RUN_IFELSE([
          AC_LANG_PROGRAM([[
    
            $curl_includes_stdlib
    
            $curl_includes_time
          ]],[[
            time_t clock = 1170352587;
            struct tm *tmp = 0;
            struct tm result;
            tmp = localtime_r(&clock, &result);
            if(tmp)
              exit(0);
            else
              exit(1);
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_works_localtime_r="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_works_localtime_r="no"
        ])
      fi
      #
      if test "$tst_compi_localtime_r" = "yes" &&
        test "$tst_works_localtime_r" != "no"; then
        AC_MSG_CHECKING([if localtime_r usage allowed])
        if test "x$curl_disallow_localtime_r" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_localtime_r="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_localtime_r="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if localtime_r might be used])
      if test "$tst_links_localtime_r" = "yes" &&
         test "$tst_proto_localtime_r" = "yes" &&
         test "$tst_compi_localtime_r" = "yes" &&
         test "$tst_allow_localtime_r" = "yes" &&
         test "$tst_works_localtime_r" != "no"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_LOCALTIME_R, 1,
          [Define to 1 if you have a working localtime_r function.])
        ac_cv_func_localtime_r="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_localtime_r="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_MEMRCHR
    dnl -------------------------------------------------
    dnl Verify if memrchr is available, prototyped, and
    dnl can be compiled. If all of these are true, and
    dnl usage has not been previously disallowed with
    dnl shell variable curl_disallow_memrchr, then
    dnl HAVE_MEMRCHR will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [
      AC_REQUIRE([CURL_INCLUDES_STRING])dnl
      #
      tst_links_memrchr="unknown"
      tst_macro_memrchr="unknown"
      tst_proto_memrchr="unknown"
      tst_compi_memrchr="unknown"
      tst_allow_memrchr="unknown"
      #
      AC_MSG_CHECKING([if memrchr can be linked])
      AC_LINK_IFELSE([
        AC_LANG_FUNC_LINK_TRY([memrchr])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_memrchr="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_memrchr="no"
      ])
      #
      if test "$tst_links_memrchr" = "no"; then
        AC_MSG_CHECKING([if memrchr seems a macro])
        AC_LINK_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_string
          ]],[[
            if(0 != memrchr(0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_macro_memrchr="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_macro_memrchr="no"
        ])
      fi
      #
      if test "$tst_links_memrchr" = "yes"; then
        AC_MSG_CHECKING([if memrchr is prototyped])
        AC_EGREP_CPP([memrchr],[
          $curl_includes_string
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_memrchr="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_memrchr="no"
        ])
      fi
      #
      if test "$tst_proto_memrchr" = "yes" ||
         test "$tst_macro_memrchr" = "yes"; then
        AC_MSG_CHECKING([if memrchr is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_string
          ]],[[
            if(0 != memrchr(0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_memrchr="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_memrchr="no"
        ])
      fi
      #
      if test "$tst_compi_memrchr" = "yes"; then
        AC_MSG_CHECKING([if memrchr usage allowed])
        if test "x$curl_disallow_memrchr" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_memrchr="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_memrchr="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if memrchr might be used])
      if (test "$tst_proto_memrchr" = "yes" ||
          test "$tst_macro_memrchr" = "yes") &&
         test "$tst_compi_memrchr" = "yes" &&
         test "$tst_allow_memrchr" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1,
          [Define to 1 if you have the memrchr function or macro.])
        ac_cv_func_memrchr="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_memrchr="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_POLL
    dnl -------------------------------------------------
    dnl Verify if poll is available, prototyped, can
    dnl be compiled and seems to work. If all of these are
    dnl true, and usage has not been previously disallowed
    dnl with shell variable curl_disallow_poll, then
    dnl HAVE_POLL will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_POLL], [
      AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
      AC_REQUIRE([CURL_INCLUDES_POLL])dnl
      #
      tst_links_poll="unknown"
      tst_proto_poll="unknown"
      tst_compi_poll="unknown"
      tst_works_poll="unknown"
      tst_allow_poll="unknown"
      #
      case $host_os in
        darwin*)
          dnl poll does not work on this platform
          curl_disallow_poll="yes"
          ;;
      esac
      #
      AC_MSG_CHECKING([if poll can be linked])
      AC_LINK_IFELSE([
        AC_LANG_PROGRAM([[
          $curl_includes_poll
        ]],[[
          if(0 != poll(0, 0, 0))
            return 1;
        ]])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_poll="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_poll="no"
      ])
      #
      if test "$tst_links_poll" = "yes"; then
        AC_MSG_CHECKING([if poll is prototyped])
        AC_EGREP_CPP([poll],[
          $curl_includes_poll
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_poll="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_poll="no"
        ])
      fi
      #
      if test "$tst_proto_poll" = "yes"; then
        AC_MSG_CHECKING([if poll is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_poll
          ]],[[
            if(0 != poll(0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_poll="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_poll="no"
        ])
      fi
      #
      dnl only do runtime verification when not cross-compiling
      if test "x$cross_compiling" != "xyes" &&
        test "$tst_compi_poll" = "yes"; then
        AC_MSG_CHECKING([if poll seems to work])
        AC_RUN_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_stdlib
            $curl_includes_poll
          ]],[[
            if(0 != poll(0, 0, 10))
              exit(1); /* fail */
            else
              exit(0);
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_works_poll="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_works_poll="no"
        ])
      fi
      #
      if test "$tst_compi_poll" = "yes" &&
        test "$tst_works_poll" != "no"; then
        AC_MSG_CHECKING([if poll usage allowed])
        if test "x$curl_disallow_poll" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_poll="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_poll="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if poll might be used])
      if test "$tst_links_poll" = "yes" &&
         test "$tst_proto_poll" = "yes" &&
         test "$tst_compi_poll" = "yes" &&
         test "$tst_allow_poll" = "yes" &&
         test "$tst_works_poll" != "no"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_POLL, 1,
          [Define to 1 if you have a working poll function.])
        AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1,
          [If you have a fine poll])
        ac_cv_func_poll="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_poll="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_SETSOCKOPT
    dnl -------------------------------------------------
    dnl Verify if setsockopt is available, prototyped, and
    dnl can be compiled. If all of these are true, and
    dnl usage has not been previously disallowed with
    dnl shell variable curl_disallow_setsockopt, then
    dnl HAVE_SETSOCKOPT will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_SETSOCKOPT], [
      AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
      AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
      #
      tst_links_setsockopt="unknown"
      tst_proto_setsockopt="unknown"
      tst_compi_setsockopt="unknown"
      tst_allow_setsockopt="unknown"
      #
      AC_MSG_CHECKING([if setsockopt can be linked])
      AC_LINK_IFELSE([
        AC_LANG_PROGRAM([[
          $curl_includes_winsock2
          $curl_includes_sys_socket
        ]],[[
          if(0 != setsockopt(0, 0, 0, 0, 0))
            return 1;
        ]])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_setsockopt="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_setsockopt="no"
      ])
      #
      if test "$tst_links_setsockopt" = "yes"; then
        AC_MSG_CHECKING([if setsockopt is prototyped])
        AC_EGREP_CPP([setsockopt],[
          $curl_includes_winsock2
          $curl_includes_sys_socket
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_setsockopt="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_setsockopt="no"
        ])
      fi
      #
      if test "$tst_proto_setsockopt" = "yes"; then
        AC_MSG_CHECKING([if setsockopt is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_winsock2
            $curl_includes_sys_socket
          ]],[[
            if(0 != setsockopt(0, 0, 0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_setsockopt="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_setsockopt="no"
        ])
      fi
      #
      if test "$tst_compi_setsockopt" = "yes"; then
        AC_MSG_CHECKING([if setsockopt usage allowed])
        if test "x$curl_disallow_setsockopt" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_setsockopt="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_setsockopt="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if setsockopt might be used])
      if test "$tst_links_setsockopt" = "yes" &&
         test "$tst_proto_setsockopt" = "yes" &&
         test "$tst_compi_setsockopt" = "yes" &&
         test "$tst_allow_setsockopt" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT, 1,
          [Define to 1 if you have the setsockopt function.])
        ac_cv_func_setsockopt="yes"
        CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK
      else
        AC_MSG_RESULT([no])
        ac_cv_func_setsockopt="no"
      fi
    ])
    
    
    dnl CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK
    dnl -------------------------------------------------
    dnl Verify if setsockopt with the SO_NONBLOCK command is
    dnl available, can be compiled, and seems to work. If
    dnl all of these are true, then HAVE_SETSOCKOPT_SO_NONBLOCK
    dnl will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK], [
      #
      tst_compi_setsockopt_so_nonblock="unknown"
      tst_allow_setsockopt_so_nonblock="unknown"
      #
      if test "$ac_cv_func_setsockopt" = "yes"; then
        AC_MSG_CHECKING([if setsockopt SO_NONBLOCK is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_winsock2