lib/replace: add checks for HAVE_SOCK_SIN_LEN and HAVE_UNIXSOCKET
authorStefan Metzmacher <metze@samba.org>
Fri, 16 May 2008 10:29:21 +0000 (12:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 16 May 2008 20:56:14 +0000 (22:56 +0200)
Moved from the samba specific locations

metze
(This used to be commit e674128ee2f11596f358ed46104c9d25eb2f754f)

source4/lib/replace/libreplace_network.m4

index 5ab71f160adea17d094d539159a26b2be9941458..d29c13196dcce145d112dfbf68be77709020cee5 100644 (file)
@@ -62,6 +62,46 @@ AC_CHECK_MEMBER(struct sockaddr_storage.__ss_family,
 fi
 fi
 
+AC_CACHE_CHECK([for sin_len in sock],libreplace_cv_HAVE_SOCK_SIN_LEN,[
+       AC_TRY_COMPILE(
+               [
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+               ],[
+struct sockaddr_in sock; sock.sin_len = sizeof(sock);
+               ],[
+               libreplace_cv_HAVE_SOCK_SIN_LEN=yes
+               ],[
+               libreplace_cv_HAVE_SOCK_SIN_LEN=no
+               ])
+])
+if test x"$libreplace_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
+       AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
+fi
+
+############################################
+# check for unix domain sockets
+AC_CACHE_CHECK([for unix domain sockets],libreplace_cv_HAVE_UNIXSOCKET,[
+       AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+               ],[
+struct sockaddr_un sunaddr;
+sunaddr.sun_family = AF_UNIX;
+               ],[
+               libreplace_cv_HAVE_UNIXSOCKET=yes
+               ],[
+               libreplace_cv_HAVE_UNIXSOCKET=no
+               ])
+])
+if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"yes"; then
+       AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
+fi
+
 dnl The following test is roughl taken from the cvs sources.
 dnl
 dnl If we can't find connect, try looking in -lsocket, -lnsl, and -linet.