configure: Fix detection of libdir in ldconfig configuration