[PATCH configure,config.gcc] Fix for PR69153 to allow config.gcc to set target_header_dir

Peter Bergner bergner@vnet.ibm.com
Sun Jan 10 17:44:00 GMT 2016


While testing a configure fragment change for an upcoming patch, I noticed
that --with-advance-toolchain=... wasn't correctly setting $target_header_dir
to point to the Advance Toolchain's headers and instead was pointing at
the system headers.  This patch arranges for configure.ac to allow
config.gcc to set $target_header_dir which fixes the problem.

This patch passes bootstrap and regtesting on powerpc64le-linux.
Ok for mainline?

Peter


	PR target/69153
	* config.gcc: Set target_header_dir for --with-advance-toolchain=<xxx>.
	* configure.ac: Only initialize target_header_dir is it isn't already
	initialized from config.gcc.
	* configure: Regenerate.

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 232115)
+++ gcc/config.gcc	(working copy)
@@ -4167,6 +4167,7 @@
 			-d "/opt/$with_advance_toolchain/bin/." -a \
 			-d "/opt/$with_advance_toolchain/include/."; then
 
+			target_header_dir=`find /opt/$with_advance_toolchain/ -path '*/include/features.h' | sed -e 's#/features.h##'`
 			tm_file="$tm_file ./advance-toolchain.h"
 			(at="/opt/$with_advance_toolchain"
 			 echo "/* Use Advance Toolchain $at */"
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 232115)
+++ gcc/configure.ac	(working copy)
@@ -1401,6 +1401,7 @@
 . ${srcdir}/config.host
 
 target_gtfiles=
+target_header_dir=
 
 # Collect target-machine-specific information.
 . ${srcdir}/config.gcc
@@ -1997,20 +1998,22 @@
         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_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}"
+if test "x$target_header_dir" == x; then
+  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="${with_sysroot}${native_system_header_dir}"
+    target_header_dir=${native_system_header_dir}
   fi
-else
-  target_header_dir=${native_system_header_dir}
 fi
 
 # If this is a cross-compiler that does not
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 232115)
+++ gcc/configure	(working copy)
@@ -11458,6 +11458,7 @@
 . ${srcdir}/config.host
 
 target_gtfiles=
+target_header_dir=
 
 # Collect target-machine-specific information.
 . ${srcdir}/config.gcc
@@ -12215,20 +12216,22 @@
         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_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}"
+if test "x$target_header_dir" == x; then
+  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="${with_sysroot}${native_system_header_dir}"
+    target_header_dir=${native_system_header_dir}
   fi
-else
-  target_header_dir=${native_system_header_dir}
 fi
 
 # If this is a cross-compiler that does not
@@ -18406,7 +18409,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18409 "configure"
+#line 18412 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18512,7 +18515,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18515 "configure"
+#line 18518 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H



More information about the Gcc-patches mailing list