aboutsummaryrefslogtreecommitdiff
path: root/m4/curl-functions.m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-09-16 16:42:48 +0000
committerYang Tse <yangsita@gmail.com>2008-09-16 16:42:48 +0000
commitaa41743ebdb8b348b70bcd886395f0ba5f5fac3a (patch)
treea88f8147f6aaf3015bcf1f0679ec1c0bdef97d84 /m4/curl-functions.m4
parentee5f13cb6b2a6e514dd6b2e129c48b7afd2fefae (diff)
rearrange to allow internal/private use of ares_writev to any system
that lacks the writev function.
Diffstat (limited to 'm4/curl-functions.m4')
-rw-r--r--m4/curl-functions.m4104
1 files changed, 104 insertions, 0 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index 0dad50eed..3c11c8df9 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -112,6 +112,27 @@ curl_includes_string="\
])
+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
@@ -1722,3 +1743,86 @@ AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
])
+dnl CURL_CHECK_FUNC_WRITEV
+dnl -------------------------------------------------
+dnl Verify if writev 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_writev, then
+dnl HAVE_WRITEV will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_WRITEV], [
+ AC_REQUIRE([CURL_INCLUDES_SYS_UIO])dnl
+ #
+ tst_links_writev="unknown"
+ tst_proto_writev="unknown"
+ tst_compi_writev="unknown"
+ tst_allow_writev="unknown"
+ #
+ AC_MSG_CHECKING([if writev can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([writev])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_writev="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_writev="no"
+ ])
+ #
+ if test "$tst_links_writev" = "yes"; then
+ AC_MSG_CHECKING([if writev is prototyped])
+ AC_EGREP_CPP([writev],[
+ $curl_includes_sys_uio
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_writev="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_writev="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_writev" = "yes"; then
+ AC_MSG_CHECKING([if writev is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_sys_uio
+ ]],[[
+ if(0 != writev(0, 0, 0))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_writev="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_writev="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_writev" = "yes"; then
+ AC_MSG_CHECKING([if writev usage allowed])
+ if test "x$curl_disallow_writev" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_writev="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_writev="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if writev might be used])
+ if test "$tst_links_writev" = "yes" &&
+ test "$tst_proto_writev" = "yes" &&
+ test "$tst_compi_writev" = "yes" &&
+ test "$tst_allow_writev" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_WRITEV, 1,
+ [Define to 1 if you have the writev function.])
+ ac_cv_func_writev="yes"
+ else
+ AC_MSG_RESULT([no])
+ ac_cv_func_writev="no"
+ fi
+])