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
commit1ff4e9008b70ccf521179ad1a2438bdc93554fd4 (patch)
tree595ceb96e6f72cc8e06a314e297b23b4b29dc0d1 /acinclude.m4
parent2d716517a884010f06a03529a4df933a0ba49d77 (diff)
downloadcurl-1ff4e9008b70ccf521179ad1a2438bdc93554fd4.tar.gz
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 092cd4e40..8c6f5bbff 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2202,6 +2202,47 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
])
+dnl CURL_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([CURL_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 CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
dnl -------------------------------------------------
dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor