[PATCH 2/9] configure.ac: auto-disable MITSHM if we lack IPC

Jon TURNEY jon.turney at dronecode.org.uk
Wed Jan 11 12:13:22 PST 2012


From: Ryan Pavlik <rpavlik at iastate.edu>

The MITSHM extension uses SYSV IPC, but even if configure's test
for IPC failed, MITSHM was still enabled by default, breaking
MinGW builds by default.

Unfortunately, this exposes the fact that the HAVE_SYSV_IPC test wasn't
being used for anything before and so we hadn't noticed it was failing on
Cygwin.

Change from using SHM_W|SHM_R flags (which aren't required by POSIX) to
S_IRUSR|S_IWUSR flags (which are)

Reviewed-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 configure.ac |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 79d5557..92bd36d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -271,10 +271,11 @@ AC_CACHE_CHECK([for SYSV IPC],
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
+#include <sys/stat.h>
 ],[
 { 
     int id;
-    id = shmget(IPC_PRIVATE, 512, SHM_W | SHM_R);
+    id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR);
     if (id < 0) return -1;
     return shmctl(id, IPC_RMID, 0);
 }],
@@ -592,7 +593,7 @@ AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Pa
 dnl Extensions.
 AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build string registry module (default: enabled)]), [XREGISTRY=$enableval], [XREGISTRY=yes])
 AC_ARG_ENABLE(composite,      AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
-AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
+AC_ARG_ENABLE(mitshm,         AS_HELP_STRING([--disable-mitshm], [Build SHM extension (default: auto)]), [MITSHM=$enableval], [MITSHM=auto])
 AC_ARG_ENABLE(xres,           AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
 AC_ARG_ENABLE(record,         AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
 AC_ARG_ENABLE(xv,             AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
@@ -993,6 +994,9 @@ if test "x$COMPOSITE" = xyes; then
 	COMPOSITE_INC='-I$(top_srcdir)/composite'
 fi
 
+if test "x$MITSHM" = xauto; then
+	MITSHM="$HAVE_SYSV_IPC"
+fi
 AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes])
 if test "x$MITSHM" = xyes; then
 	AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension])
-- 
1.7.5.1



More information about the xorg-devel mailing list