diff options
author | Yang Tse <yangsita@gmail.com> | 2012-12-15 17:46:49 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-12-15 17:46:49 +0100 |
commit | 9da14a847fc58a4fb8286155544bf9bbc79c6568 (patch) | |
tree | 4f16953485ee1e78eceafc2c46a5ebcf2edf9cce /m4 | |
parent | a28e44c34448b52159e3e1549d04c4b97e1a6d7b (diff) | |
download | c-ares-9da14a847fc58a4fb8286155544bf9bbc79c6568.tar.gz c-ares-9da14a847fc58a4fb8286155544bf9bbc79c6568.tar.bz2 c-ares-9da14a847fc58a4fb8286155544bf9bbc79c6568.zip |
cares-functions.m4: add gethostname arg 2 data type check and definition
Diffstat (limited to 'm4')
-rw-r--r-- | m4/cares-functions.m4 | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/m4/cares-functions.m4 b/m4/cares-functions.m4 index 0deb6de..7b00aa3 100644 --- a/m4/cares-functions.m4 +++ b/m4/cares-functions.m4 @@ -15,7 +15,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 44 +# serial 45 dnl CARES_INCLUDES_ARPA_INET @@ -1465,6 +1465,34 @@ AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ fi # if test "$tst_compi_gethostname" = "yes"; then + AC_MSG_CHECKING([for gethostname arg 2 data type]) + tst_gethostname_type_arg2="unknown" + for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do + for tst_arg2 in 'int' 'unsigned int' 'size_t'; do + if test "$tst_gethostname_type_arg2" = "unknown"; then + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $cares_includes_winsock2 + $cares_includes_unistd + ]],[[ + int gethostname($tst_arg1 name, $tst_arg2 namelen); + if(0 != gethostname(0, 0)) + return 1; + ]]) + ],[ + tst_gethostname_type_arg2="$tst_arg2" + ]) + fi + done + done + AC_MSG_RESULT([$tst_gethostname_type_arg2]) + if test "$tst_gethostname_type_arg2" != "unknown"; then + AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2, + [Define to the type of arg 2 for gethostname.]) + fi + fi + # + if test "$tst_compi_gethostname" = "yes"; then AC_MSG_CHECKING([if gethostname usage allowed]) if test "x$cares_disallow_gethostname" != "xyes"; then AC_MSG_RESULT([yes]) |