[PATCH 1/2] Select directory for MIT-SHM temp files at configure time

Keith Packard keithp at keithp.com
Tue Nov 12 21:33:12 PST 2013


By default, this looks through a list of directories to find one which
exists, but can be overridden with --with-shared-memory-dir=PATH

This patch doesn't actually do anything with this directory, just
makes it available in the configuration

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 configure.ac            | 43 +++++++++++++++++++++++++++++++++++++++++++
 include/dix-config.h.in |  3 +++
 2 files changed, 46 insertions(+)

diff --git a/configure.ac b/configure.ac
index eb90b1a..70f4af3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1092,6 +1092,49 @@ case "$DRI2,$HAVE_DRI2PROTO" in
 esac
 AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
 
+dnl
+dnl Locate a suitable tmp file system for creating shared memeory files
+dnl
+
+AC_ARG_WITH(shared-memory-dir, AS_HELP_STRING([--with-shared-memory-dir=PATH], [Path to directory in a world-writable temporary directory for anonymous shared memory (default: auto)]),
+[],
+[with_shared_memory_dir=yes])
+
+shmdirs="/run/shm /var/tmp /tmp"
+
+case x"$with_shared_memory_dir" in
+xyes)
+	for dir in $shmdirs; do
+		case x"$with_shared_memory_dir" in
+		xyes)
+			echo Checking temp dir "$dir"
+			if test -d "$dir"; then
+				with_shared_memory_dir="$dir"
+			fi
+			;;
+		esac
+	done
+	;;
+x/*)
+	;;
+xno)
+	;;
+*)
+	AC_MSG_ERROR([Invalid directory specified for --with-shared-memory-dir: $with_shared_memory_dir])
+	;;
+esac
+
+case x"$with_shared_memory_dir" in
+xyes)
+	AC_MSG_ERROR([No directory found for shared memory temp files.])
+	;;
+xno)
+	;;
+*)
+	AC_DEFINE_UNQUOTED(SHMDIR, ["$with_shared_memory_dir"], [Directory for shared memory temp files])
+	;;
+esac
+
 AC_ARG_ENABLE(xtrans-send-fds,	AS_HELP_STRING([--disable-xtrans-send-fds], [Use Xtrans support for fd passing (default: auto)]), [XTRANS_SEND_FDS=$enableval], [XTRANS_SEND_FDS=auto])
 
 case "x$XTRANS_SEND_FDS" in
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index d4fbe99..3066100 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -466,4 +466,7 @@
 /* Wrap SIGBUS to catch MIT-SHM faults */
 #undef BUSFAULT
 
+/* Directory for shared memory temp files */
+#undef SHMDIR
+
 #endif /* _DIX_CONFIG_H_ */
-- 
1.8.4.2



More information about the xorg-devel mailing list