fix up building in non-GDAL situations
find threads libraries because some platforms don't link them by default