diff --git a/libX11-1.6.12/src/XlibInt.c b/libX11/src/XlibInt.c
index 3f97d72..7d55cec 100644
--- a/libX11-1.6.12/src/XlibInt.c
+++ b/libX11/src/XlibInt.c
@@ -62,13 +62,13 @@ from The Open Group.
 #include <unistd.h>
 #endif
 
-#ifdef XTHREADS
-#include "locking.h"
-
 #ifdef HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
 
+#ifdef XTHREADS
+#include "locking.h"
+
 /* these pointers get initialized by XInitThreads */
 LockInfoPtr _Xglobal_lock = NULL;
 void (*_XCreateMutex_fn)(LockInfoPtr) = NULL;
