From 59b6bb412383ca68669f605ae7673af75ee7f4bb Mon Sep 17 00:00:00 2001 From: Brian Fraser Date: Mon, 13 Jan 2014 02:00:43 -0300 Subject: [PATCH] Configure: use $sysroot, if available, in checkccflags If the user specified -Dsysroot but we don't use it, then the results can be entirely off. This also introduces an internal variable for Configure, _sysroot, which is just "--sysroot=$sysroot", for use in places like checkccflags that need --sysroot but don't need the other flags. --- Configure | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Configure b/Configure index 0d505d7..c62b9e8 100755 --- a/Configure +++ b/Configure @@ -1960,20 +1960,23 @@ if test "X$sysroot" != X; then case "$cc" in *gcc*|*g++*) echo "Using $sysroot to find your headers and libraries, adding to ccflags" + # _sysroot is used in places where we need --sysroot=foo + # but using the rest of the flags could cause issues. + _sysroot="--sysroot=$sysroot"; case "$ccflags" in *sysroot*) ;; 'undef'|*) - ccflags="$ccflags --sysroot=$sysroot" + ccflags="$ccflags $_sysroot" esac case "$ldflags" in *sysroot*) ;; 'undef'|*) - ldflags="$ldflags --sysroot=$sysroot" + ldflags="$ldflags $_sysroot" esac case "$cppflags" in *sysroot*) ;; 'undef'|*) - cppflags="$cppflags --sysroot=$sysroot" + cppflags="$cppflags $_sysroot" esac # lddlflags updated below in lddlflags section; # same with cccdlflags @@ -5152,7 +5155,7 @@ checkccflag='check=$1; flag=$2; callback=$3; echo " "; echo "Checking if your compiler accepts $flag" 2>&1; echo "int main(void) { return 0; }" > gcctest.c; -if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then +if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then echo "Yes, it does." 2>&1; if $test -s gcctest.out ; then echo "But your platform does not like it:"; -- 2.7.4