summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-06-20 17:24:43 +0000
committerYang Tse <yangsita@gmail.com>2009-06-20 17:24:43 +0000
commitcdcc3aca8ce7811103a51f36fc832a12da0212ae (patch)
tree9d0a34514f57222b66a853811b5062f2ff74c663 /acinclude.m4
parentdab4d1afbc01c576d5026c502e91c00f8ec7c480 (diff)
downloadc-ares-cdcc3aca8ce7811103a51f36fc832a12da0212ae.tar.gz
c-ares-cdcc3aca8ce7811103a51f36fc832a12da0212ae.tar.bz2
c-ares-cdcc3aca8ce7811103a51f36fc832a12da0212ae.zip
Refactor how libraries are checked for connect() function,
and check for connect() as it is done for other functions.
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m441
1 files changed, 41 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 6594b6f..4c5e8c7 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1670,6 +1670,47 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
])
+dnl CARES_CHECK_LIBS_CONNECT
+dnl -------------------------------------------------
+dnl Verify if network connect function is already available
+dnl using current libraries or if another one is required.
+
+AC_DEFUN([CARES_CHECK_LIBS_CONNECT], [
+ AC_MSG_CHECKING([for connect in libraries])
+ tst_connect_save_LIBS="$LIBS"
+ tst_connect_need_LIBS="unknown"
+ for tst_lib in '' '-lsocket' ; do
+ if test "$tst_connect_need_LIBS" = "unknown"; then
+ LIBS="$tst_lib $tst_connect_save_LIBS"
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+ ]],[[
+ if(0 != connect(0, 0, 0))
+ return 1;
+ ]])
+ ],[
+ tst_connect_need_LIBS="$tst_lib"
+ ])
+ fi
+ done
+ LIBS="$tst_connect_save_LIBS"
+ #
+ case X-"$tst_connect_need_LIBS" in
+ X-unknown)
+ AC_MSG_RESULT([cannot find connect])
+ AC_MSG_ERROR([cannot find connect function in libraries.])
+ ;;
+ X-)
+ AC_MSG_RESULT([yes])
+ ;;
+ *)
+ AC_MSG_RESULT([$tst_connect_need_LIBS])
+ LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
+ ;;
+ esac
+])
+
+
dnl CARES_DEFINE_UNQUOTED (VARIABLE, [VALUE])
dnl -------------------------------------------------
dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor