aboutsummaryrefslogtreecommitdiff
path: root/m4/curl-functions.m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-09-22 00:44:10 +0000
committerYang Tse <yangsita@gmail.com>2008-09-22 00:44:10 +0000
commit54e49d10d2d47fae72472e27d97891b1de5451ae (patch)
tree9ea1821f63d09715749690f379e08ba3a784353e /m4/curl-functions.m4
parentef758298789ff97d88821d7501737f22f02619a5 (diff)
attempt to make work the gethostname function
check for winsock build target configurations
Diffstat (limited to 'm4/curl-functions.m4')
-rw-r--r--m4/curl-functions.m441
1 files changed, 39 insertions, 2 deletions
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index bb8eef542..09af726b4 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 13
+# serial 20
dnl CURL_INCLUDES_NETDB
@@ -204,6 +204,34 @@ 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_CHECK_FUNC_ALARM
dnl -------------------------------------------------
dnl Verify if alarm is available, prototyped, and
@@ -752,6 +780,7 @@ dnl shell variable curl_disallow_gethostname, then
dnl HAVE_GETHOSTNAME will be defined.
AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
+ AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
#
tst_links_gethostname="unknown"
@@ -761,7 +790,13 @@ AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
#
AC_MSG_CHECKING([if gethostname can be linked])
AC_LINK_IFELSE([
- AC_LANG_FUNC_LINK_TRY([gethostname])
+ AC_LANG_PROGRAM([[
+ $curl_includes_winsock2
+ $curl_includes_unistd
+ ]],[[
+ if(0 != gethostname(0, 0))
+ return 1;
+ ]])
],[
AC_MSG_RESULT([yes])
tst_links_gethostname="yes"
@@ -773,6 +808,7 @@ AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
if test "$tst_links_gethostname" = "yes"; then
AC_MSG_CHECKING([if gethostname is prototyped])
AC_EGREP_CPP([gethostname],[
+ $curl_includes_winsock2
$curl_includes_unistd
],[
AC_MSG_RESULT([yes])
@@ -787,6 +823,7 @@ AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
AC_MSG_CHECKING([if gethostname is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
+ $curl_includes_winsock2
$curl_includes_unistd
]],[[
if(0 != gethostname(0, 0))