It would be useful to store the 'PKG_CONFIG_PATH' variable that was used to build R in the ./etc/Makeconf file (along with CC, CXX, etc). This would allow packages to link against the same libraries as R itself.
My immediate use case is on that MacOS, binary packages should be able link against XQuartz libraries, if R itself also does this. The CRAN build for MacOS currently builds against XQuartz as we can see from the comment '/opt/X11/lib/pkgconfig' in:
grep PKG_CONFIG_PATH $(R RHOME)/etc/Makeconf
When building binary packages for this version of R (which already depends on XQuartz) I want take advantage of the same PKG_CONFIG_PATH. However there are also MacOS builds of R that avoid the XQuartz dependency. On these builds we should not include '/opt/X11/lib/pkgconfig' in PKG_CONFIG_PATH when building packages.
Therefore being able to call 'R CMD config PKG_CONFIG_PATH' would be very helpful.
In addition one could even consider letting R automatically set 'PKG_CONFIG_PATH' to match that of R when running package configure scripts. Thereby packages that use pkg-config in their configure script will automatically be able to take advantage of the libraries that R itself already depends on.