Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / gamin / abstract-socket-namespace.patch
blobff1610559721efc277b16d92684626bf959f1a1a
1 From 737452159d521aef2041a2767f3ebf9f68f4b6a9 Mon Sep 17 00:00:00 2001
2 From: Christian Kampka <christian@kampka.net>
3 Date: Tue, 1 Sep 2020 13:54:35 +0200
4 Subject: [PATCH] Pin abstract namespace sockets to host_os
6 Running programs with AC_RUN_IFELSE fails when cross-compiling.
7 Since abstract namespace sockets are linux feature, we can easily
8 assume it is available for linux and not for darwin.
9 ---
10 configure.in | 47 ++++++-----------------------------------------
11 1 file changed, 6 insertions(+), 41 deletions(-)
13 diff --git a/configure.in b/configure.in
14 index eb129db..0ed82ba 100644
15 --- a/configure.in
16 +++ b/configure.in
17 @@ -387,47 +387,12 @@ fi
19 #### Abstract sockets
21 -AC_MSG_CHECKING(abstract socket namespace)
22 -AC_LANG_PUSH(C)
23 -AC_RUN_IFELSE([AC_LANG_PROGRAM(
24 -[[
25 -#include <sys/types.h>
26 -#include <stdlib.h>
27 -#include <string.h>
28 -#include <stdio.h>
29 -#include <sys/socket.h>
30 -#include <sys/un.h>
31 -#include <errno.h>
32 -]],
33 -[[
34 - int listen_fd;
35 - struct sockaddr_un addr;
37 - listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
39 - if (listen_fd < 0)
40 - {
41 - fprintf (stderr, "socket() failed: %s\n", strerror (errno));
42 - exit (1);
43 - }
45 - memset (&addr, '\0', sizeof (addr));
46 - addr.sun_family = AF_UNIX;
47 - strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
48 - addr.sun_path[0] = '\0'; /* this is what makes it abstract */
50 - if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
51 - {
52 - fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
53 - strerror (errno));
54 - exit (1);
55 - }
56 - else
57 - exit (0);
58 -]])],
59 - [have_abstract_sockets=yes],
60 - [have_abstract_sockets=no])
61 -AC_LANG_POP(C)
62 +AC_MSG_CHECKING([whether target os has abstract socket namespace])
63 +if test x$target_os = xlinux-gnu ; then
64 + have_abstract_sockets=yes
65 +else
66 + have_abstract_sockets=no
67 +fi
68 AC_MSG_RESULT($have_abstract_sockets)
70 if test x$enable_abstract_sockets = xyes; then
71 --
72 2.25.4