gallium: link with pthread

Fixes #1069.
Fix the gallium and libdrm libc plugins

This patch adapts the gallium and libdrm libc plugins to the current
workings of the libc.

Fixes #1070.