Port: Add macro for socket linking on solaris
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 17 Sep 2015 16:43:40 +0000 (12:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 19 Oct 2015 04:14:08 +0000 (00:14 -0400)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
config/ax_lib_socket_nsl.m4 [new file with mode: 0644]
configure.ac
src/common/compat/socket.h

diff --git a/config/ax_lib_socket_nsl.m4 b/config/ax_lib_socket_nsl.m4
new file mode 100644 (file)
index 0000000..058e975
--- /dev/null
@@ -0,0 +1,40 @@
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_LIB_SOCKET_NSL
+#
+# DESCRIPTION
+#
+#   This macro figures out what libraries are required on this platform to
+#   link sockets programs.
+#
+#   The common cases are not to need any extra libraries, or to need
+#   -lsocket and -lnsl. We need to avoid linking with libnsl unless we need
+#   it, though, since on some OSes where it isn't necessary it will totally
+#   break networking. Unisys also includes gethostbyname() in libsocket but
+#   needs libnsl for socket().
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Russ Allbery <rra@stanford.edu>
+#   Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
+#   Copyright (c) 2008 Warren Young <warren@etr-usa.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL])
+AC_DEFUN([AX_LIB_SOCKET_NSL],
+[
+       AC_SEARCH_LIBS([gethostbyname], [nsl])
+       AC_SEARCH_LIBS([socket], [socket], [], [
+               AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
+               [], [-lnsl])])
+])
index dda8f27ca94bb8a1698d85bb333069cb06d784c1..e80ccc8b43a3bf8d040472f1e1f79134d486705d 100644 (file)
@@ -362,6 +362,8 @@ else
 
 fi
 
+AX_LIB_SOCKET_NSL
+
 # Epoll check. If not present, the build will fallback on poll() API
 AX_HAVE_EPOLL(
        [AX_CONFIG_FEATURE_ENABLE(epoll)],
index 6a490bebbdaf5cef5bc24a8a8f16dc07ab025810..5a6802aacd77720f72e7de93dfd4aeac61161b25 100644 (file)
@@ -74,8 +74,9 @@ typedef struct lttng_sock_cred lttng_sock_cred;
 
 
 #include <ucred.h>
-static int
-getpeereid(int s, uid_t *euid, gid_t *gid)
+
+static inline
+int getpeereid(int s, uid_t *euid, gid_t *gid)
 {
        int ret = 0;
        ucred_t *ucred = NULL;
This page took 0.026698 seconds and 4 git commands to generate.