[Python-checkins] gh-128354: Consistently use LIBS over LDFLAGS in library build checks (#128359)