Skip to content

Instantly share code, notes, and snippets.

@sortie
Last active August 29, 2015 14:25
Show Gist options
  • Save sortie/1e8422d884af30656d54 to your computer and use it in GitHub Desktop.
Save sortie/1e8422d884af30656d54 to your computer and use it in GitHub Desktop.
configure.ac patch fix --with-sysroot='' --with-build-sysroot=/foo/bar
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 07a0c78..ce64b10 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -615,7 +615,7 @@ yes|no|auto) enable_multiarch=$enableval;;
*) AC_MSG_ERROR(bad value ${enableval} given for --enable-multiarch option) ;;
esac], [enable_multiarch=auto])
if test x${enable_multiarch} = xauto; then
- if test x$host != x$target && test "x$with_sysroot" = x; then
+ if test x$host != x$target && test "x$with_sysroot" = x && test "x$with_build_sysroot" = x; then
ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)"
enable_multiarch=no
fi
@@ -1771,7 +1771,7 @@ then
*)
;;
esac
-elif test "x$TARGET_SYSTEM_ROOT" != x; then
+elif test "x$TARGET_SYSTEM_ROOT" != x || test "x$with_build_sysroot" != x; then
SYSTEM_HEADER_DIR=$build_system_header_dir
fi
@@ -1784,7 +1784,7 @@ fi
# This prevents libgcc2 from containing any code which requires libc
# support.
: ${inhibit_libc=false}
-if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
+if { { test x$host != x$target && test "x$with_sysroot" = x && test "x$with_build_sysroot" = x ; } ||
test x$with_newlib = xyes ; } &&
{ test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
inhibit_libc=true
@@ -4336,7 +4336,7 @@ if test x"$gcc_cv_ld_sysroot" = xyes; then
[Define if your linker supports --sysroot.])
fi
-if test x$with_sysroot = x && test x$host = x$target \
+if test x$with_sysroot = x && test x$with_build_sysroot = x && test x$host = x$target \
&& test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \
&& test "$prefix" != "NONE"; then
AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
@@ -4346,10 +4346,10 @@ 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="${exec_prefix}/${target_noncanonical}/sys-include"
elif test "x$with_build_sysroot" != "x"; then
target_header_dir="${with_build_sysroot}/usr/include"
+ elif test "x$with_sysroot" = x; then
+ target_header_dir="${exec_prefix}/${target_noncanonical}/sys-include"
elif test "x$with_sysroot" = xyes; then
target_header_dir="${exec_prefix}/${target_noncanonical}/sys-root/usr/include"
else
diff --git a/gcc/configure.ac b/gcc/configure.ac
index aa506d5..5021629 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -637,7 +637,7 @@ if test x${enable_multiarch} = xauto; then
ma_msg_suffix=", disabled auto check (configured with --native-system-header-dir)"
enable_multiarch=no
fi
- if test x$host != x$target && test "x$with_sysroot" = x; then
+ if test x$host != x$target && test "x$with_sysroot" = x && test "x$with_build_sysroot" = x; then
ma_msg_suffix=", disabled auto check (cross build configured without --with-sysroot)"
enable_multiarch=no
fi
@@ -1885,7 +1885,7 @@ then
*)
;;
esac
-elif test "x$TARGET_SYSTEM_ROOT" != x; then
+elif test "x$TARGET_SYSTEM_ROOT" != x || test "x$with_build_sysroot" != x; then
SYSTEM_HEADER_DIR=$build_system_header_dir
fi
@@ -1898,7 +1898,7 @@ fi
# This prevents libgcc2 from containing any code which requires libc
# support.
: ${inhibit_libc=false}
-if { { test x$host != x$target && test "x$with_sysroot" = x ; } ||
+if { { test x$host != x$target && test "x$with_sysroot" = x && test "x$with_build_sysroot" = x ; } ||
test x$with_newlib = xyes ; } &&
{ test "x$with_headers" = x || test "x$with_headers" = xno ; } ; then
inhibit_libc=true
@@ -4487,7 +4487,7 @@ gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,
[AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1,
[Define if your assembler supports .lcomm with an alignment field.])])
-if test x$with_sysroot = x && test x$host = x$target \
+if test x$with_sysroot = x && test x$with_build_sysroot = x && test x$host = x$target \
&& test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \
&& test "$prefix" != "NONE"; then
AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include",
@@ -4497,10 +4497,10 @@ 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" = x; then
+ target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include"
elif test "x$with_sysroot" = xyes; then
target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}"
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment