summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-06-04 05:20:20 +0000
committerHavoc Pennington <hp@redhat.com>2003-06-04 05:20:20 +0000
commita70b042f0dcebb10689975c65a2c45b52b7a4437 (patch)
tree46a45a6933e1f9fbf6ac30cc819e96f60536342f /configure.in
parent0e024fc53a5effadedd56427ffe261c417e45222 (diff)
2003-06-04 Havoc Pennington <hp@pobox.com>
* dbus/dbus-server.c (dbus_server_listen): allow abstract sockets using unix:abstract=/foo, and when listening in a tmpdir i.e. unix:tmpdir=/tmp, always use abstract sockets if we can. * dbus/dbus-transport.c (_dbus_transport_open): support unix:abstract=/foo * dbus/dbus-server-unix.c (_dbus_server_new_for_domain_socket): support abstract sockets * dbus/dbus-transport-unix.c (_dbus_transport_new_for_domain_socket): support abstract sockets * dbus/dbus-sysdeps.c (_dbus_connect_unix_socket): add "abstract" toggle as an argument, implement abstract namespace support (_dbus_listen_unix_socket): ditto * configure.in: add --enable-abstract-sockets and implement a configure check for autodetection of the right value.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in90
1 files changed, 81 insertions, 9 deletions
diff --git a/configure.in b/configure.in
index a47d1109..613bf2dc 100644
--- a/configure.in
+++ b/configure.in
@@ -23,15 +23,17 @@ AC_ISC_POSIX
AC_HEADER_STDC
AM_PROG_LIBTOOL
-AC_ARG_ENABLE(qt, [ --enable-qt enable Qt-friendly client library],enable_qt=$enableval,enable_qt=auto)
-AC_ARG_ENABLE(glib, [ --enable-glib enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
-AC_ARG_ENABLE(tests, [ --enable-tests enable unit test code],enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
-AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
-AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
-AC_ARG_ENABLE(asserts, [ --enable-asserts include assertion checks],enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
-AC_ARG_ENABLE(checks, [ --enable-checks include sanity checks on public API],enable_checks=$enableval,enable_checks=yes)
-AC_ARG_ENABLE(docs, [ --enable-docs build documentation (requires Doxygen and jade)],enable_docs=$enableval,enable_docs=auto)
-AC_ARG_ENABLE(gcov, [ --enable-gcov compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
+AC_ARG_ENABLE(qt, [ --enable-qt enable Qt-friendly client library],enable_qt=$enableval,enable_qt=auto)
+AC_ARG_ENABLE(glib, [ --enable-glib enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
+AC_ARG_ENABLE(tests, [ --enable-tests enable unit test code],enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
+AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
+AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
+AC_ARG_ENABLE(asserts, [ --enable-asserts include assertion checks],enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
+AC_ARG_ENABLE(checks, [ --enable-checks include sanity checks on public API],enable_checks=$enableval,enable_checks=yes)
+AC_ARG_ENABLE(docs, [ --enable-docs build documentation (requires Doxygen and jade)],enable_docs=$enableval,enable_docs=auto)
+AC_ARG_ENABLE(gcov, [ --enable-gcov compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
+AC_ARG_ENABLE(abstract-sockets, [ --enable-abstract-sockets use abstract socket namespace (linux only)],enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
+
AC_ARG_WITH(xml, [ --with-xml=[libxml/expat] XML library to use])
AC_ARG_WITH(init-scripts, [ --with-init-scripts=[redhat] Style of init scripts to install])
@@ -317,6 +319,75 @@ if test x$dbus_have_struct_cmsgcred = xyes; then
fi
+#### Abstract sockets
+
+AC_MSG_CHECKING(abstract socket namespace)
+AC_LANG_PUSH(C)
+AC_RUN_IFELSE([AC_LANG_PROGRAM(
+[[
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <errno.h>
+]],
+[[
+ int listen_fd;
+ struct sockaddr_un addr;
+
+ listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
+
+ if (listen_fd < 0)
+ {
+ fprintf (stderr, "socket() failed: %s\n", strerror (errno));
+ exit (1);
+ }
+
+ memset (&addr, '\0', sizeof (addr));
+ addr.sun_family = AF_UNIX;
+ strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
+ addr.sun_path[0] = '\0'; /* this is what makes it abstract */
+
+ if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
+ {
+ fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
+ strerror (errno));
+ exit (1);
+ }
+ else
+ exit (0);
+]])],
+ [have_abstract_sockets=yes],
+ [have_abstract_sockets=no])
+AC_LANG_POP(C)
+AC_MSG_RESULT($have_abstract_sockets)
+
+if test x$enable_abstract_sockets = xyes; then
+ if test x$have_abstract_sockets = xno; then
+ AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.])
+ fi
+fi
+
+if test x$enable_abstract_sockets = xno; then
+ have_abstract_sockets=no;
+fi
+
+if test x$have_abstract_sockets = xyes ; then
+ abstract_sockets=1
+ DBUS_PATH_OR_ABSTRACT=abstract
+else
+ abstract_sockets=0
+ DBUS_PATH_OR_ABSTRACT=path
+fi
+
+AC_DEFINE_UNQUOTED(HAVE_ABSTRACT_SOCKETS, $abstract_sockets, [Have abstract socket namespace])
+
+# this is used in addresses to prefer abstract, e.g.
+# unix:path=/foo or unix:abstract=/foo
+AC_SUBST(DBUS_PATH_OR_ABSTRACT)
+
#### Sort out XML library
# see what we have
@@ -692,6 +763,7 @@ echo "
Building documentation: ${enable_docs}
Using XML parser: ${with_xml}
Init scripts style: ${with_init_scripts}
+ Abstract socket names: ${have_abstract_sockets}
System bus socket: ${DBUS_SYSTEM_SOCKET}
System bus PID file: ${DBUS_SYSTEM_PID_FILE}
Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR}