configure: Check if -lpthread is required

On Android for example the pthread api is part of the C library and so
an explicit -lpthread is not required.