- Introduced the use of gethostbyname_r() if available. As siproxd
uses threads it probably is a very good idea (some funny things seen with Linux 2.4.18 kernel & RTP proxy - gethostbyname() did return a NULL result but has h_errno set to 0 "every fine, thanks") Future will show it this helps. - Had overlooked one inet_aton in register.c - replaced to utils_inet_aton - Fixed a compiler warning in log.c for Solaris. Siproxd now at least builds on Solaris (tested on: SunOS 5.9 sun4u sparc SUNW,Ultra-60)
This commit is contained in:
@@ -224,3 +224,74 @@ fi
|
||||
|
||||
])dnl ACX_PTHREAD
|
||||
|
||||
dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R
|
||||
dnl
|
||||
dnl Provides a test to determine the correct
|
||||
dnl way to call gethostbyname_r
|
||||
dnl
|
||||
dnl defines HAVE_FUNC_GETHOSTBYNAME_R_6 if it needs 6 arguments (e.g linux)
|
||||
dnl defines HAVE_FUNC_GETHOSTBYNAME_R_5 if it needs 5 arguments (e.g. solaris)
|
||||
dnl defines HAVE_FUNC_GETHOSTBYNAME_R_3 if it needs 3 arguments (e.g. osf/1)
|
||||
dnl
|
||||
dnl if used in conjunction in gethostname.c the api demonstrated
|
||||
dnl in test.c can be used regardless of which gethostbyname_r
|
||||
dnl exists. These example files found at
|
||||
dnl http://www.csn.ul.ie/~caolan/publink/gethostbyname_r
|
||||
dnl
|
||||
dnl @version $Id$
|
||||
dnl @author Caolan McNamara <caolan@skynet.ie>
|
||||
dnl
|
||||
dnl based on David Arnold's autoconf suggestion in the threads faq
|
||||
dnl
|
||||
AC_DEFUN([ACX_WHICH_GETHOSTBYNAME_R], [
|
||||
|
||||
AC_CHECK_FUNC(gethostbyname_r, [
|
||||
AC_MSG_CHECKING(how many arguments takes gethostbyname_r)
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <netdb.h>], [
|
||||
char *name;
|
||||
struct hostent *he;
|
||||
struct hostent_data data;
|
||||
(void) gethostbyname_r(name, he, &data);
|
||||
],acx_which_gethostname_r=three, [
|
||||
dnl
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <netdb.h>], [
|
||||
char *name;
|
||||
struct hostent *he, *res;
|
||||
char buffer[2048];
|
||||
int buflen = 2048;
|
||||
int h_errnop;
|
||||
(void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
|
||||
],acx_which_gethostname_r=six, [
|
||||
dnl
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <netdb.h>], [
|
||||
char *name;
|
||||
struct hostent *he;
|
||||
char buffer[2048];
|
||||
int buflen = 2048;
|
||||
int h_errnop;
|
||||
(void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
|
||||
],acx_which_gethostname_r=five,acx_which_gethostname_r=no)
|
||||
|
||||
])
|
||||
])
|
||||
], acx_which_gethostname_r=no)
|
||||
|
||||
if test $acx_which_gethostname_r = six; then
|
||||
AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_6,,[gethostbyname_r takes 6 arguments])
|
||||
elif test $acx_which_gethostname_r = five; then
|
||||
AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_5,,[gethostbyname_r takes 5 arguments])
|
||||
elif test $acx_which_gethostname_r = three; then
|
||||
AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_3,,[gethostbyname_r takes 3 arguments])
|
||||
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT($acx_which_gethostname_r)
|
||||
|
||||
])dnl ACX_WHICH_GETHOSTBYNAME_R
|
||||
|
||||
|
||||
Reference in New Issue
Block a user