Skip to content
Snippets Groups Projects
curl-functions.m4 154 KiB
Newer Older
  • Learn to ignore specific revisions
  • #***************************************************************************
    #                                  _   _ ____  _
    #  Project                     ___| | | |  _ \| |
    #                             / __| | | | |_) | |
    #                            | (__| |_| |  _ <| |___
    #                             \___|\___/|_| \_\_____|
    #
    
    # Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
    
    #
    # This software is licensed as described in the file COPYING, which
    # you should have received as part of this distribution. The terms
    # are also available at http://curl.haxx.se/docs/copyright.html.
    #
    # You may opt to use, copy, modify, merge, publish, distribute and/or sell
    # copies of the Software, and permit persons to whom the Software is
    # furnished to do so, under the terms of the COPYING file.
    #
    # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
    # KIND, either express or implied.
    #
    # $Id$
    #***************************************************************************
    
    # File version for 'aclocal' use. Keep it a single number.
    
    
    
    dnl CURL_INCLUDES_ARPA_INET
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when arpa/inet.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_ARPA_INET], [
    curl_includes_arpa_inet="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_SYS_SOCKET_H
    #  include <sys/socket.h>
    #endif
    #ifdef HAVE_NETINET_IN_H
    #  include <netinet/in.h>
    #endif
    #ifdef HAVE_ARPA_INET_H
    
    #  include <arpa/inet.h>
    
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
        [], [], [$curl_includes_arpa_inet])
    ])
    
    dnl CURL_INCLUDES_FCNTL
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when fcntl.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_FCNTL], [
    curl_includes_fcntl="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_UNISTD_H
    #  include <unistd.h>
    #endif
    
    #ifdef HAVE_FCNTL_H
    
    #  include <fcntl.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h unistd.h fcntl.h,
        [], [], [$curl_includes_fcntl])
    ])
    
    
    
    dnl CURL_INCLUDES_IFADDRS
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when ifaddrs.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_IFADDRS], [
    curl_includes_ifaddrs="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_SYS_SOCKET_H
    #  include <sys/socket.h>
    #endif
    #ifdef HAVE_NETINET_IN_H
    #  include <netinet/in.h>
    #endif
    #ifdef HAVE_IFADDRS_H
    #  include <ifaddrs.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h sys/socket.h netinet/in.h ifaddrs.h,
        [], [], [$curl_includes_ifaddrs])
    ])
    
    
    
    dnl CURL_INCLUDES_INTTYPES
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when inttypes.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_INTTYPES], [
    curl_includes_inttypes="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    # include <sys/types.h>
    #endif
    #ifdef HAVE_STDINT_H
    # include <stdint.h>
    #endif
    #ifdef HAVE_INTTYPES_H
    # include <inttypes.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h stdint.h inttypes.h,
        [], [], [$curl_includes_inttypes])
    ])
    
    
    
    Yang Tse's avatar
     
    Yang Tse committed
    dnl CURL_INCLUDES_LIBGEN
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when libgen.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_LIBGEN], [
    curl_includes_libgen="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_LIBGEN_H
    #  include <libgen.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h libgen.h,
        [], [], [$curl_includes_libgen])
    ])
    
    
    
    dnl CURL_INCLUDES_NETDB
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when netdb.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_NETDB], [
    curl_includes_netdb="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_NETDB_H
    #  include <netdb.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h netdb.h,
        [], [], [$curl_includes_netdb])
    ])
    
    dnl CURL_INCLUDES_POLL
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when poll.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_POLL], [
    curl_includes_poll="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_POLL_H
    #  include <poll.h>
    #endif
    #ifdef HAVE_SYS_POLL_H
    #  include <sys/poll.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h poll.h sys/poll.h,
        [], [], [$curl_includes_poll])
    ])
    
    
    
    dnl CURL_INCLUDES_SETJMP
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when setjmp.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_SETJMP], [
    curl_includes_setjmp="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_SETJMP_H
    #  include <setjmp.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h setjmp.h,
        [], [], [$curl_includes_setjmp])
    ])
    
    
    
    dnl CURL_INCLUDES_SIGNAL
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when signal.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_SIGNAL], [
    curl_includes_signal="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_SIGNAL_H
    #  include <signal.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h signal.h,
        [], [], [$curl_includes_signal])
    ])
    
    
    
    Yang Tse's avatar
     
    Yang Tse committed
    dnl CURL_INCLUDES_SOCKET
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when socket.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_SOCKET], [
    curl_includes_socket="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_SOCKET_H
    #  include <socket.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h socket.h,
        [], [], [$curl_includes_socket])
    ])
    
    
    
    dnl CURL_INCLUDES_STDIO
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when stdio.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_STDIO], [
    curl_includes_stdio="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_STDIO_H
    #  include <stdio.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h stdio.h,
        [], [], [$curl_includes_stdio])
    ])
    
    
    
    dnl CURL_INCLUDES_STDLIB
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when stdlib.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_STDLIB], [
    curl_includes_stdlib="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_STDLIB_H
    #  include <stdlib.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h stdlib.h,
        [], [], [$curl_includes_stdlib])
    ])
    
    
    
    dnl CURL_INCLUDES_STRING
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    
    Yang Tse's avatar
    Yang Tse committed
    dnl included when string(s).h is to be included.
    
    
    AC_DEFUN([CURL_INCLUDES_STRING], [
    curl_includes_string="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_STRING_H
    #  include <string.h>
    #endif
    
    Yang Tse's avatar
    Yang Tse committed
    #ifdef HAVE_STRINGS_H
    #  include <strings.h>
    #endif
    
    /* includes end */"
      AC_CHECK_HEADERS(
    
    Yang Tse's avatar
    Yang Tse committed
        sys/types.h string.h strings.h,
    
        [], [], [$curl_includes_string])
    ])
    
    
    
    dnl CURL_INCLUDES_STROPTS
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when stropts.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_STROPTS], [
    curl_includes_stropts="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_UNISTD_H
    #  include <unistd.h>
    #endif
    #ifdef HAVE_SYS_SOCKET_H
    #  include <sys/socket.h>
    #endif
    #ifdef HAVE_SYS_IOCTL_H
    #  include <sys/ioctl.h>
    #endif
    #ifdef HAVE_STROPTS_H
    #  include <stropts.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h,
        [], [], [$curl_includes_stropts])
    ])
    
    
    
    dnl CURL_INCLUDES_SYS_SOCKET
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when sys/socket.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_SYS_SOCKET], [
    curl_includes_sys_socket="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_SYS_SOCKET_H
    #  include <sys/socket.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h sys/socket.h,
        [], [], [$curl_includes_sys_socket])
    ])
    
    
    
    dnl CURL_INCLUDES_SYS_TYPES
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when sys/types.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_SYS_TYPES], [
    curl_includes_sys_types="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h,
        [], [], [$curl_includes_sys_types])
    ])
    
    
    
    dnl CURL_INCLUDES_SYS_UIO
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when sys/uio.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_SYS_UIO], [
    curl_includes_sys_uio="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_SYS_UIO_H
    #  include <sys/uio.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h sys/uio.h,
        [], [], [$curl_includes_sys_uio])
    ])
    
    
    
    dnl CURL_INCLUDES_TIME
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when time.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_TIME], [
    AC_REQUIRE([AC_HEADER_TIME])dnl
    curl_includes_time="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_SYS_TIME_H
    #  include <sys/time.h>
    #  ifdef TIME_WITH_SYS_TIME
    #    include <time.h>
    #  endif
    #else
    #  ifdef HAVE_TIME_H
    #    include <time.h>
    #  endif
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h sys/time.h time.h,
        [], [], [$curl_includes_time])
    ])
    
    
    
    dnl CURL_INCLUDES_UNISTD
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when unistd.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_UNISTD], [
    curl_includes_unistd="\
    /* includes start */
    #ifdef HAVE_SYS_TYPES_H
    #  include <sys/types.h>
    #endif
    #ifdef HAVE_UNISTD_H
    #  include <unistd.h>
    #endif
    /* includes end */"
      AC_CHECK_HEADERS(
        sys/types.h unistd.h,
        [], [], [$curl_includes_unistd])
    ])
    
    
    
    dnl CURL_INCLUDES_WINSOCK2
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when winsock(2).h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_WINSOCK2], [
    curl_includes_winsock2="\
    /* includes start */
    #ifdef HAVE_WINDOWS_H
    #  ifndef WIN32_LEAN_AND_MEAN
    #    define WIN32_LEAN_AND_MEAN
    #  endif
    #  include <windows.h>
    #  ifdef HAVE_WINSOCK2_H
    #    include <winsock2.h>
    #  else
    #    ifdef HAVE_WINSOCK_H
    #      include <winsock.h>
    #    endif
    #  endif
    #endif
    /* includes end */"
      CURL_CHECK_HEADER_WINDOWS
      CURL_CHECK_HEADER_WINSOCK
      CURL_CHECK_HEADER_WINSOCK2
    ])
    
    
    
    dnl CURL_INCLUDES_WS2TCPIP
    dnl -------------------------------------------------
    dnl Set up variable with list of headers that must be
    dnl included when ws2tcpip.h is to be included.
    
    AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [
    curl_includes_ws2tcpip="\
    /* includes start */
    #ifdef HAVE_WINDOWS_H
    #  ifndef WIN32_LEAN_AND_MEAN
    #    define WIN32_LEAN_AND_MEAN
    #  endif
    #  include <windows.h>
    #  ifdef HAVE_WINSOCK2_H
    #    include <winsock2.h>
    #    ifdef HAVE_WS2TCPIP_H
    #       include <ws2tcpip.h>
    #    endif
    #  endif
    #endif
    /* includes end */"
      CURL_CHECK_HEADER_WINDOWS
      CURL_CHECK_HEADER_WINSOCK2
      CURL_CHECK_HEADER_WS2TCPIP
    ])
    
    
    
    dnl CURL_PREPROCESS_CALLCONV
    dnl -------------------------------------------------
    dnl Set up variable with a preprocessor block which
    dnl defines function calling convention.
    
    AC_DEFUN([CURL_PREPROCESS_CALLCONV], [
    curl_preprocess_callconv="\
    /* preprocess start */
    #ifdef HAVE_WINDOWS_H
    #  define FUNCALLCONV __stdcall
    #else
    #  define FUNCALLCONV
    #endif
    /* preprocess end */"
    ])
    
    
    
    dnl CURL_CHECK_FUNC_ALARM
    dnl -------------------------------------------------
    dnl Verify if alarm 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_alarm, then
    dnl HAVE_ALARM will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_ALARM], [
      AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
      #
      tst_links_alarm="unknown"
      tst_proto_alarm="unknown"
      tst_compi_alarm="unknown"
      tst_allow_alarm="unknown"
      #
      AC_MSG_CHECKING([if alarm can be linked])
      AC_LINK_IFELSE([
        AC_LANG_FUNC_LINK_TRY([alarm])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_alarm="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_alarm="no"
      ])
      #
      if test "$tst_links_alarm" = "yes"; then
        AC_MSG_CHECKING([if alarm is prototyped])
        AC_EGREP_CPP([alarm],[
          $curl_includes_unistd
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_alarm="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_alarm="no"
        ])
      fi
      #
      if test "$tst_proto_alarm" = "yes"; then
        AC_MSG_CHECKING([if alarm is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_unistd
          ]],[[
            if(0 != alarm(0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_alarm="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_alarm="no"
        ])
      fi
      #
      if test "$tst_compi_alarm" = "yes"; then
        AC_MSG_CHECKING([if alarm usage allowed])
        if test "x$curl_disallow_alarm" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_alarm="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_alarm="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if alarm might be used])
      if test "$tst_links_alarm" = "yes" &&
         test "$tst_proto_alarm" = "yes" &&
         test "$tst_compi_alarm" = "yes" &&
         test "$tst_allow_alarm" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_ALARM, 1,
          [Define to 1 if you have the alarm function.])
        ac_cv_func_alarm="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_alarm="no"
      fi
    ])
    
    
    
    Yang Tse's avatar
     
    Yang Tse committed
    dnl CURL_CHECK_FUNC_BASENAME
    dnl -------------------------------------------------
    dnl Verify if basename 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_basename, then
    dnl HAVE_BASENAME will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [
      AC_REQUIRE([CURL_INCLUDES_STRING])dnl
      AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl
      AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
      #
      tst_links_basename="unknown"
      tst_proto_basename="unknown"
      tst_compi_basename="unknown"
      tst_allow_basename="unknown"
      #
      AC_MSG_CHECKING([if basename can be linked])
      AC_LINK_IFELSE([
        AC_LANG_FUNC_LINK_TRY([basename])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_basename="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_basename="no"
      ])
      #
      if test "$tst_links_basename" = "yes"; then
        AC_MSG_CHECKING([if basename is prototyped])
        AC_EGREP_CPP([basename],[
          $curl_includes_string
          $curl_includes_libgen
          $curl_includes_unistd
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_basename="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_basename="no"
        ])
      fi
      #
      if test "$tst_proto_basename" = "yes"; then
        AC_MSG_CHECKING([if basename is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_string
            $curl_includes_libgen
            $curl_includes_unistd
          ]],[[
            if(0 != basename(0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_basename="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_basename="no"
        ])
      fi
      #
      if test "$tst_compi_basename" = "yes"; then
        AC_MSG_CHECKING([if basename usage allowed])
        if test "x$curl_disallow_basename" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_basename="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_basename="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if basename might be used])
      if test "$tst_links_basename" = "yes" &&
         test "$tst_proto_basename" = "yes" &&
         test "$tst_compi_basename" = "yes" &&
         test "$tst_allow_basename" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1,
          [Define to 1 if you have the basename function.])
        ac_cv_func_basename="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_basename="no"
      fi
    ])
    
    
    
    Yang Tse's avatar
     
    Yang Tse committed
    dnl CURL_CHECK_FUNC_CLOSESOCKET
    dnl -------------------------------------------------
    dnl Verify if closesocket 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_closesocket, then
    dnl HAVE_CLOSESOCKET will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET], [
      AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
    
    Yang Tse's avatar
     
    Yang Tse committed
      AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
    
    Yang Tse's avatar
     
    Yang Tse committed
      #
      tst_links_closesocket="unknown"
      tst_proto_closesocket="unknown"
      tst_compi_closesocket="unknown"
      tst_allow_closesocket="unknown"
      #
      AC_MSG_CHECKING([if closesocket can be linked])
      AC_LINK_IFELSE([
        AC_LANG_PROGRAM([[
          $curl_includes_winsock2
    
    Yang Tse's avatar
     
    Yang Tse committed
          $curl_includes_socket
    
    Yang Tse's avatar
     
    Yang Tse committed
        ]],[[
          if(0 != closesocket(0))
            return 1;
        ]])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_closesocket="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_closesocket="no"
      ])
      #
      if test "$tst_links_closesocket" = "yes"; then
        AC_MSG_CHECKING([if closesocket is prototyped])
        AC_EGREP_CPP([closesocket],[
          $curl_includes_winsock2
    
    Yang Tse's avatar
     
    Yang Tse committed
          $curl_includes_socket
    
    Yang Tse's avatar
     
    Yang Tse committed
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_closesocket="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_closesocket="no"
        ])
      fi
      #
      if test "$tst_proto_closesocket" = "yes"; then
        AC_MSG_CHECKING([if closesocket is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_winsock2
    
    Yang Tse's avatar
     
    Yang Tse committed
            $curl_includes_socket
    
    Yang Tse's avatar
     
    Yang Tse committed
          ]],[[
            if(0 != closesocket(0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_closesocket="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_closesocket="no"
        ])
      fi
      #
      if test "$tst_compi_closesocket" = "yes"; then
        AC_MSG_CHECKING([if closesocket usage allowed])
        if test "x$curl_disallow_closesocket" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_closesocket="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_closesocket="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if closesocket might be used])
      if test "$tst_links_closesocket" = "yes" &&
         test "$tst_proto_closesocket" = "yes" &&
         test "$tst_compi_closesocket" = "yes" &&
         test "$tst_allow_closesocket" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1,
          [Define to 1 if you have the closesocket function.])
        ac_cv_func_closesocket="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_closesocket="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
    dnl -------------------------------------------------
    dnl Verify if CloseSocket 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_closesocket_camel,
    dnl then HAVE_CLOSESOCKET_CAMEL will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [
      AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
      #
      tst_links_closesocket_camel="unknown"
      tst_proto_closesocket_camel="unknown"
      tst_compi_closesocket_camel="unknown"
      tst_allow_closesocket_camel="unknown"
      #
      AC_MSG_CHECKING([if CloseSocket can be linked])
      AC_LINK_IFELSE([
        AC_LANG_PROGRAM([[
          $curl_includes_sys_socket
        ]],[[
          if(0 != CloseSocket(0))
            return 1;
        ]])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_closesocket_camel="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_closesocket_camel="no"
      ])
      #
      if test "$tst_links_closesocket_camel" = "yes"; then
        AC_MSG_CHECKING([if CloseSocket is prototyped])
        AC_EGREP_CPP([CloseSocket],[
          $curl_includes_sys_socket
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_closesocket_camel="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_closesocket_camel="no"
        ])
      fi
      #
      if test "$tst_proto_closesocket_camel" = "yes"; then
        AC_MSG_CHECKING([if CloseSocket is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_sys_socket
          ]],[[
            if(0 != CloseSocket(0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_closesocket_camel="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_closesocket_camel="no"
        ])
      fi
      #
      if test "$tst_compi_closesocket_camel" = "yes"; then
        AC_MSG_CHECKING([if CloseSocket usage allowed])
        if test "x$curl_disallow_closesocket_camel" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_closesocket_camel="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_closesocket_camel="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if CloseSocket might be used])
      if test "$tst_links_closesocket_camel" = "yes" &&
         test "$tst_proto_closesocket_camel" = "yes" &&
         test "$tst_compi_closesocket_camel" = "yes" &&
         test "$tst_allow_closesocket_camel" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1,
          [Define to 1 if you have the CloseSocket camel case function.])
        ac_cv_func_closesocket_camel="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_closesocket_camel="no"
      fi
    ])
    
    
    
    Yang Tse's avatar
     
    Yang Tse committed
    dnl CURL_CHECK_FUNC_CONNECT
    dnl -------------------------------------------------
    dnl Verify if connect 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_connect, then
    dnl HAVE_CONNECT will be defined.
    
    AC_DEFUN([CURL_CHECK_FUNC_CONNECT], [
      AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
      AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
      AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
      #
      tst_links_connect="unknown"
      tst_proto_connect="unknown"
      tst_compi_connect="unknown"
      tst_allow_connect="unknown"
      #
      AC_MSG_CHECKING([if connect can be linked])
      AC_LINK_IFELSE([
        AC_LANG_PROGRAM([[
          $curl_includes_winsock2
          $curl_includes_sys_socket
          $curl_includes_socket
        ]],[[
          if(0 != connect(0, 0, 0))
            return 1;
        ]])
      ],[
        AC_MSG_RESULT([yes])
        tst_links_connect="yes"
      ],[
        AC_MSG_RESULT([no])
        tst_links_connect="no"
      ])
      #
      if test "$tst_links_connect" = "yes"; then
        AC_MSG_CHECKING([if connect is prototyped])
        AC_EGREP_CPP([connect],[
          $curl_includes_winsock2
          $curl_includes_sys_socket
          $curl_includes_socket
        ],[
          AC_MSG_RESULT([yes])
          tst_proto_connect="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_proto_connect="no"
        ])
      fi
      #
      if test "$tst_proto_connect" = "yes"; then
        AC_MSG_CHECKING([if connect is compilable])
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
            $curl_includes_winsock2
            $curl_includes_sys_socket
            $curl_includes_socket
          ]],[[
            if(0 != connect(0, 0, 0))
              return 1;
          ]])
        ],[
          AC_MSG_RESULT([yes])
          tst_compi_connect="yes"
        ],[
          AC_MSG_RESULT([no])
          tst_compi_connect="no"
        ])
      fi
      #
      if test "$tst_compi_connect" = "yes"; then
        AC_MSG_CHECKING([if connect usage allowed])
        if test "x$curl_disallow_connect" != "xyes"; then
          AC_MSG_RESULT([yes])
          tst_allow_connect="yes"
        else
          AC_MSG_RESULT([no])
          tst_allow_connect="no"
        fi
      fi
      #
      AC_MSG_CHECKING([if connect might be used])
      if test "$tst_links_connect" = "yes" &&
         test "$tst_proto_connect" = "yes" &&
         test "$tst_compi_connect" = "yes" &&
         test "$tst_allow_connect" = "yes"; then
        AC_MSG_RESULT([yes])
        AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1,
          [Define to 1 if you have the connect function.])
        ac_cv_func_connect="yes"
      else
        AC_MSG_RESULT([no])
        ac_cv_func_connect="no"
      fi
    ])
    
    
    
    dnl CURL_CHECK_FUNC_FCNTL
    dnl -------------------------------------------------
    dnl Verify if fcntl 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_fcntl, then