diff options
author | Yang Tse <yangsita@gmail.com> | 2008-09-22 00:44:10 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-09-22 00:44:10 +0000 |
commit | a36da1298594bd3e5b7b4e865ef3c8158b6a97d2 (patch) | |
tree | 77252abb8b432d5aed5e487d35d831faa410e81b | |
parent | c9b686488d5bc497fb4cff094ba2d6a469f5a851 (diff) | |
download | c-ares-a36da1298594bd3e5b7b4e865ef3c8158b6a97d2.tar.gz c-ares-a36da1298594bd3e5b7b4e865ef3c8158b6a97d2.tar.bz2 c-ares-a36da1298594bd3e5b7b4e865ef3c8158b6a97d2.zip |
attempt to make work the gethostname function
check for winsock build target configurations
-rw-r--r-- | m4/cares-functions.m4 | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/m4/cares-functions.m4 b/m4/cares-functions.m4 index 8f3fa72..8522cb7 100644 --- a/m4/cares-functions.m4 +++ b/m4/cares-functions.m4 @@ -16,7 +16,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 5 +# serial 7 dnl CARES_INCLUDES_NETDB @@ -106,6 +106,34 @@ cares_includes_unistd="\ ]) +dnl CARES_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([CARES_INCLUDES_WINSOCK2], [ +cares_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 CARES_CHECK_FUNC_GETHOSTNAME dnl ------------------------------------------------- dnl Verify if gethostname is available, prototyped, and @@ -115,6 +143,7 @@ dnl shell variable cares_disallow_gethostname, then dnl HAVE_GETHOSTNAME will be defined. AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ + AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl AC_REQUIRE([CARES_INCLUDES_UNISTD])dnl # tst_links_gethostname="unknown" @@ -124,7 +153,13 @@ AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ # AC_MSG_CHECKING([if gethostname can be linked]) AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([gethostname]) + AC_LANG_PROGRAM([[ + $cares_includes_winsock2 + $cares_includes_unistd + ]],[[ + if(0 != gethostname(0, 0)) + return 1; + ]]) ],[ AC_MSG_RESULT([yes]) tst_links_gethostname="yes" @@ -136,6 +171,7 @@ AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ if test "$tst_links_gethostname" = "yes"; then AC_MSG_CHECKING([if gethostname is prototyped]) AC_EGREP_CPP([gethostname],[ + $cares_includes_winsock2 $cares_includes_unistd ],[ AC_MSG_RESULT([yes]) @@ -150,6 +186,7 @@ AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ AC_MSG_CHECKING([if gethostname is compilable]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ + $cares_includes_winsock2 $cares_includes_unistd ]],[[ if(0 != gethostname(0, 0)) |