Fix detection of linking against non-fPIC libraries