Created attachment 1653 [details]
Diff adding a line to look up LDFLAGS in Makeconf to config
When running R's config script to discover compilation flags ('R CMD config --ldflags') is returns MAIN_LDFLAGS, LDFLAGS, LIBR and LIBS (in case R is a shared lib). Only LDFLAGS is immediately taken from the environment variable, MAIN_LDFLAGS, LDFLAGS, LIBR and LIBS are taken from Makeconf first. I believe LDFLAGS should be looked up in Makeconf first as well, as taking it from the environment might lead to some package building issues. But maybe I miss the point of taking LDFLAGS from the environment alltogether.
If it is preferable to have config I believe this could be achieved by applying the attached patch to the config script.