--- x11.c.old	2009-11-19 12:27:42.000000000 +0100
+++ x11.c	2009-11-19 13:32:41.000000000 +0100
@@ -102,6 +102,10 @@
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <X11/extensions/XShm.h>
+#ifndef X_ShmAttach
+#include <X11/Xmd.h>
+#include <X11/extensions/shmproto.h>
+#endif
 #endif
 
 #endif /* HAVE_X */
