Select directory for MIT-SHM temp files at configure time
authorKeith Packard <keithp@keithp.com>
Wed, 13 Nov 2013 03:17:10 +0000 (12:17 +0900)
committerKeith Packard <keithp@keithp.com>
Mon, 2 Dec 2013 20:56:33 +0000 (12:56 -0800)
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@keithp.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
configure.ac
include/dix-config.h.in

index 6197e9b..f6ecdc6 100644 (file)
@@ -1086,6 +1086,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
index d4fbe99..3066100 100644 (file)
 /* Wrap SIGBUS to catch MIT-SHM faults */
 #undef BUSFAULT
 
+/* Directory for shared memory temp files */
+#undef SHMDIR
+
 #endif /* _DIX_CONFIG_H_ */