We have to export LDFLAGS including the libdir of libsm to succesfully complete a test configure runs for detecting libsm support.