summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-09-28 12:16:29 +0000
committerYang Tse <yangsita@gmail.com>2009-09-28 12:16:29 +0000
commitb64dd3c63d8f1545690ae9fed1c3a33fe8780303 (patch)
treee4bc02ff03c05a8e8729eea0802176c5f1c4252f /m4
parent0ea6abe7df88adac3eb8107ee754c6dd9b55c91c (diff)
downloadcurl-b64dd3c63d8f1545690ae9fed1c3a33fe8780303.tar.gz
Added check for memrchr function or macro
Diffstat (limited to 'm4')
-rw-r--r--m4/curl-functions.m4107
1 files changed, 106 insertions, 1 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index 20887b68f..573560b79 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -22,7 +22,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 51
+# serial 53
dnl CURL_INCLUDES_ARPA_INET
@@ -3494,6 +3494,111 @@ AC_DEFUN([CURL_CHECK_FUNC_LOCALTIME_R], [
])
+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