https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69153
Bug ID: 69153 Summary: --with-advance-toolchain configure option does not correctly set configure variable target_header_dir Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: bergner at gcc dot gnu.org Target Milestone: --- The --with-advance-toolchain configure option is supposed to build a GCC that uses the header files, libraries and dynamic linker from the specified Advance Toolchain (AT) release, rather than the system files. In testing a new configure fragment for a new builtin that requires a specific GLIBC version, I noticed that the configure testing was using the system header files instead of the AT's header files. This was due to $target_header_dir not being set correctly. The following code which sets it doesn't handle --with-advance-toolchain at all: if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then if test "x$with_headers" != x; then target_header_dir=$with_headers elif test "x$with_sysroot" = x; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" elif test "x$with_build_sysroot" != "x"; then target_header_dir="${with_build_sysroot}${native_system_header_dir}" elif test "x$with_sysroot" = xyes; then target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" else target_header_dir="${with_sysroot}${native_system_header_dir}" fi else target_header_dir=${native_system_header_dir} fi I'm testing the following patch to fix this: Index: configure.ac =================================================================== --- configure.ac (revision 231201) +++ configure.ac (working copy) @@ -1997,7 +1997,9 @@ SYSTEM_HEADER_DIR=$build_system_header_dir fi -if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then +if test "x$with_advance_toolchain" != x; then + target_header_dir=`find /opt/$with_advance_toolchain/ -path '*/include/features.h' | sed -e 's#/features.h##'` +elif test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then if test "x$with_headers" != x; then target_header_dir=$with_headers elif test "x$with_sysroot" = x; then