summaryrefslogtreecommitdiff
path: root/source4/lib/socket
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-08-04 16:49:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:13 -0500
commit56c112bbbc028bf7b74b47b22d41b74c7a3f9855 (patch)
tree821cb50bb21b77eb083370d11c3dd8eb93680ee5 /source4/lib/socket
parent2ba1fa7b593706bdd1ad5bae982ed51b16dc3a83 (diff)
downloadsamba-56c112bbbc028bf7b74b47b22d41b74c7a3f9855.tar.gz
samba-56c112bbbc028bf7b74b47b22d41b74c7a3f9855.tar.bz2
samba-56c112bbbc028bf7b74b47b22d41b74c7a3f9855.zip
r9063: - don't pollute the global $LIBS variable with -ldl
- -lresolve seems to not being needed any more (it's actually not used, and the build farm seem to happy with it) - move socket and netif configure test to seperate files - don't pollute the global $LIBS variable with -lsocket ... - actually make use of the -lsocket when needed (should fix the solaris build) metze (This used to be commit adebd56be6f62323d56b6666ca0e02f85a33438e)
Diffstat (limited to 'source4/lib/socket')
-rw-r--r--source4/lib/socket/config.m490
-rw-r--r--source4/lib/socket/config.mk3
2 files changed, 92 insertions, 1 deletions
diff --git a/source4/lib/socket/config.m4 b/source4/lib/socket/config.m4
index b301c6060c..786d6c72bc 100644
--- a/source4/lib/socket/config.m4
+++ b/source4/lib/socket/config.m4
@@ -1,3 +1,92 @@
+AC_CHECK_HEADERS(sys/socket.h sys/sockio.h sys/un.h)
+
+AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#include <sys/socket.h>],[socklen_t i = 0],
+ samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
+if test x"$samba_cv_socklen_t" = x"yes"; then
+ AC_DEFINE(HAVE_SOCKLEN_T_TYPE,1,[Whether we have the variable type socklen_t])
+fi
+
+AC_CACHE_CHECK([for sin_len in sock],samba_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);],
+samba_cv_HAVE_SOCK_SIN_LEN=yes,samba_cv_HAVE_SOCK_SIN_LEN=no)])
+if test x"$samba_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
+
+# The following test taken from the cvs sources
+# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
+# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
+# libsocket.so which has a bad implementation of gethostbyname (it
+# only looks in /etc/hosts), so we only look for -lsocket if we need
+# it.
+AC_CHECK_FUNCS(connect)
+if test x"$ac_cv_func_connect" = x"no"; then
+ case "$LIBS $SOCKET_LIBS" in
+ *-lnsl*) ;;
+ *) AC_CHECK_LIB_EXT(nsl_s, SOCKET_LIBS, printf) ;;
+ esac
+ case "$LIBS $SOCKET_LIBS" in
+ *-lnsl*) ;;
+ *) AC_CHECK_LIB_EXT(nsl, SOCKET_LIBS, printf) ;;
+ esac
+ case "$LIBS $SOCKET_LIBS" in
+ *-lsocket*) ;;
+ *) AC_CHECK_LIB_EXT(socket, SOCKET_LIBS, connect) ;;
+ esac
+ case "$LIBS $SOCKET_LIBS" in
+ *-linet*) ;;
+ *) AC_CHECK_LIB_EXT(inet, SOCKET_LIBS, connect) ;;
+ esac
+ dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
+ dnl has been cached.
+ if test x"$ac_cv_lib_ext_socket_connect" = x"yes" ||
+ test x"$ac_cv_lib_ext_inet_connect" = x"yes"; then
+ # ac_cv_func_connect=yes
+ # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
+ AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
+ fi
+fi
+SMB_EXT_LIB(SOCKET,[${SOCKET_LIBS}],[${SOCKET_CFLAGS}],[${SOCKET_CPPFLAGS}],[${SOCKET_LDFLAGS}])
+
+############################################
+# check for unix domain sockets
+AC_CACHE_CHECK([for unix domain sockets],samba_cv_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;
+],
+ samba_cv_unixsocket=yes,samba_cv_unixsocket=no)])
+SMB_MODULE_DEFAULT(socket_unix, NOT)
+if test x"$samba_cv_unixsocket" = x"yes"; then
+ SMB_MODULE_DEFAULT(socket_unix, STATIC)
+ AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
+fi
+
+AC_CACHE_CHECK([for AF_LOCAL socket support], samba_cv_HAVE_WORKING_AF_LOCAL, [
+AC_TRY_RUN([#include "${srcdir-.}/build/tests/unixsock.c"],
+ samba_cv_HAVE_WORKING_AF_LOCAL=yes,
+ samba_cv_HAVE_WORKING_AF_LOCAL=no,
+ samba_cv_HAVE_WORKING_AF_LOCAL=cross)])
+if test x"$samba_cv_HAVE_WORKING_AF_LOCAL" != xno
+then
+ AC_DEFINE(HAVE_WORKING_AF_LOCAL, 1, [Define if you have working AF_LOCAL sockets])
+fi
dnl test for ipv6 using the gethostbyname2() function. That should be sufficient
dnl for now
@@ -7,6 +96,5 @@ if $have_ipv6 = true; then
SMB_MODULE_DEFAULT(socket_ipv6, STATIC)
AC_DEFINE(HAVE_SOCKET_IPV6,1,[Whether the system has ipv6 support])
fi
-
dnl don't build ipv6 by default, unless the above test enables it, or
dnl the configure uses --with-static-modules=socket_ipv6
diff --git a/source4/lib/socket/config.mk b/source4/lib/socket/config.mk
index 13fe584373..e007b01725 100644
--- a/source4/lib/socket/config.mk
+++ b/source4/lib/socket/config.mk
@@ -6,6 +6,7 @@ SUBSYSTEM = SOCKET
INIT_OBJ_FILES = \
lib/socket/socket_ipv4.o
NOPROTO=YES
+REQUIRED_SUBSYSTEMS = EXT_LIB_SOCKET
# End MODULE socket_ipv4
################################################
@@ -16,6 +17,7 @@ SUBSYSTEM = SOCKET
INIT_OBJ_FILES = \
lib/socket/socket_ipv6.o
NOPROTO=YES
+REQUIRED_SUBSYSTEMS = EXT_LIB_SOCKET
# End MODULE socket_ipv6
################################################
@@ -26,6 +28,7 @@ SUBSYSTEM = SOCKET
INIT_OBJ_FILES = \
lib/socket/socket_unix.o
NOPROTO=YES
+REQUIRED_SUBSYSTEMS = EXT_LIB_SOCKET
# End MODULE socket_unix
################################################