tools: Add missing socket.h and thread.h to fix make distcheck