https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91879
--- Comment #4 from Stas Sergeev <stsp at users dot sourceforge.net> --- (In reply to Harald van Dijk from comment #1) > The ways to handle libc being installed in non-standard locations depend on > your specific use case. GCC provides the --with-sysroot and > --with-native-system-header-dir configure options, These ones specify the locations permanently. My problem is that I need a different sysroot/system-header-dir only for the time of building the gcc libs. This is when DESTDIR is set. When the package is installed on the target, then DESTDIR is unset and the prefix locations should be used. So I think the options you pointed, do not help in my case. Somehow I need the build system to pick up DESTDIR while building its libs. If I could pass the variable name to --with-native-system-header-dir, like -with-native-system-header-dir=\$DESTDIR/somedir (dollar is "escaped" in that example to not expand immediately) then that would work, but I don't suppose passing the variable name is possible?