diff -Naur libX11-1.3.3/configure.ac libX11-1.3.3-haiku/configure.ac
--- libX11-1.3.3/configure.ac	2010-01-16 19:41:21.013369344 +0000
+++ libX11-1.3.3-haiku/configure.ac	2010-04-26 23:39:22.398458880 +0000
@@ -189,6 +189,9 @@
 # Checks for typedefs, structures, and compiler characteristics.
 
 # Checks for library functions.
+AC_SEARCH_LIBS(issetugid, [bsd])
+AC_SEARCH_LIBS(getresuid, [bsd])
+
 AC_CHECK_FUNCS([strtol])
 # Used in lcFile.c (see also --enable-xlocaledir settings below)
 XLOCALEDIR_IS_SAFE="no"
@@ -229,6 +232,9 @@
               [xthreads=$enableval],[xthreads=yes])
 
 AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"])
+if test "x$mtsafeapi" = xno; then
+	AC_CHECK_LIB(root, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"])
+fi
 
 case x$xthreads in
 xyes)
@@ -242,7 +248,9 @@
 	;;
 esac
 
-AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"])
+AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [
+	AC_CHECK_LIB(root, pthread_self, [thrstubs="no"], [thrstubs="yes"])
+])
 AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes)
 
 dnl XXX incomplete, please fill this in
