intel: Protect bufmgr objects with a pthread mutex.

We want to be able to use the bufmgr from multiple threads for GL, and thus
we need to protect the internal structures.

The pthread-stubs package is used so that programs not linked against
pthreads get weak symbols to stubs and don't eat most of the cost.
diff --git a/configure.ac b/configure.ac
index 0cf0974..92507cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,10 @@
 AC_HEADER_STDC
 AC_SYS_LARGEFILE
 
+PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
+AC_SUBST(PTHREADSTUBS_CFLAGS)
+AC_SUBST(PTHREADSTUBS_LIBS)
+
 pkgconfigdir=${libdir}/pkgconfig
 AC_SUBST(pkgconfigdir)
 AC_ARG_ENABLE(udev,	AS_HELP_STRING([--enable-udev],