summaryrefslogtreecommitdiff
path: root/source4/lib/replace/libreplace.m4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-10-05 23:54:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:07:51 -0500
commite511090a4339221dfd1fa597964af7455f96ec28 (patch)
tree642564ee8fc2222bea72eecf632cac09afd34be0 /source4/lib/replace/libreplace.m4
parentf0bc19ae47d7f06d111713b0dbb00f387621e675 (diff)
downloadsamba-e511090a4339221dfd1fa597964af7455f96ec28.tar.gz
samba-e511090a4339221dfd1fa597964af7455f96ec28.tar.bz2
samba-e511090a4339221dfd1fa597964af7455f96ec28.zip
r25543: Merge libreplace support for inet_pton, inet_ntop, getaddrinfo, getnameinfo
(and friends) from SAMBA_3_2, with some minor tweaks: - avoid including network headers in replace.h unless absolutely required - autoconf tests for getaddrinfo() in lib/replace The heimdal-specific code also no longer looks for these functions anymore. (This used to be commit b6d3fd84a5d7d814035e60d6fa22f19bed9f77da)
Diffstat (limited to 'source4/lib/replace/libreplace.m4')
-rw-r--r--source4/lib/replace/libreplace.m443
1 files changed, 42 insertions, 1 deletions
diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4
index a6b1c4f5e6..29ec2acdab 100644
--- a/source4/lib/replace/libreplace.m4
+++ b/source4/lib/replace/libreplace.m4
@@ -137,6 +137,45 @@ if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
fi
+dnl test for struct addrinfo
+AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>],
+[
+struct addrinfo ai;
+],
+samba_cv_HAVE_STRUCT_ADDRINFO=yes,samba_cv_HAVE_STRUCT_ADDRINFO=no)])
+if test x"$samba_cv_HAVE_STRUCT_ADDRINFO" = x"yes"; then
+ AC_DEFINE(HAVE_STRUCT_ADDRINFO,1,[Whether the system has struct addrinfo])
+fi
+
+dnl test for getaddrinfo/getnameinfo
+AC_CACHE_CHECK([for getaddrinfo],samba_cv_HAVE_GETADDRINFO,[
+AC_TRY_COMPILE([
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netdb.h>],
+[
+struct sockaddr sa;
+struct addrinfo *ai = NULL;
+int ret = getaddrinfo(NULL, NULL, NULL, &ai);
+if (ret != 0) {
+ const char *es = gai_strerror(ret);
+}
+freeaddrinfo(ai);
+ret = getnameinfo(&sa, sizeof(sa),
+ NULL, 0,
+ NULL, 0, 0);
+
+],
+samba_cv_HAVE_GETADDRINFO=yes,samba_cv_HAVE_GETADDRINFO=no)])
+if test x"$samba_cv_HAVE_GETADDRINFO" = x"yes"; then
+ AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo and getnameinfo])
+fi
+
+
dnl Provided by replace.c:
AC_TRY_COMPILE([
#include <sys/types.h>
@@ -304,7 +343,7 @@ AC_TRY_COMPILE([
samba_cv_HAVE_OPEN_O_DIRECT=yes,samba_cv_HAVE_OPEN_O_DIRECT=no)])
if test x"$samba_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then
AC_DEFINE(HAVE_OPEN_O_DIRECT,1,[Whether the open(2) accepts O_DIRECT])
-fi
+fi
dnl Check if the C compiler understands volatile (it should, being ANSI).
@@ -322,6 +361,8 @@ m4_include(getpass.m4)
m4_include(strptime.m4)
m4_include(win32.m4)
m4_include(timegm.m4)
+m4_include(inet_ntop.m4)
+m4_include(inet_pton.m4)
m4_include(repdir.m4)
AC_CHECK_FUNCS([syslog memset memcpy],,[AC_MSG_ERROR([Required function not found])])