Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1From 737452159d521aef2041a2767f3ebf9f68f4b6a9 Mon Sep 17 00:00:00 2001 2From: Christian Kampka <christian@kampka.net> 3Date: Tue, 1 Sep 2020 13:54:35 +0200 4Subject: [PATCH] Pin abstract namespace sockets to host_os 5 6Running programs with AC_RUN_IFELSE fails when cross-compiling. 7Since abstract namespace sockets are linux feature, we can easily 8assume it is available for linux and not for darwin. 9--- 10 configure.in | 47 ++++++----------------------------------------- 11 1 file changed, 6 insertions(+), 41 deletions(-) 12 13diff --git a/configure.in b/configure.in 14index eb129db..0ed82ba 100644 15--- a/configure.in 16+++ b/configure.in 17@@ -387,47 +387,12 @@ fi 18 19 #### Abstract sockets 20 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; 36- 37- listen_fd = socket (PF_UNIX, SOCK_STREAM, 0); 38- 39- if (listen_fd < 0) 40- { 41- fprintf (stderr, "socket() failed: %s\n", strerror (errno)); 42- exit (1); 43- } 44- 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 */ 49- 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) 69 70 if test x$enable_abstract_sockets = xyes; then 71-- 722.25.4 73