Skip to content

Commit d952553

Browse files
committed
provide an error at at configure time if gcc, and g++ point to a mixture of clang and gcc. Fixes issue #10959
Signed-off-by: Carter Tazio Schonwald <[email protected]>
1 parent 8d52dfb commit d952553

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

configure

+21
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,27 @@ then
559559
step_msg "on OS X 10.9, forcing use of clang"
560560
CFG_ENABLE_CLANG=1
561561
putvar CFG_ENABLE_CLANG
562+
else
563+
# on OS X, with xcode 5 and newer, certain developers may have
564+
# cc, gcc and g++ point to a mixture of clang and gcc
565+
# if so, this will create very strange build errors
566+
# this last stanza is to detect some such problems and save the future rust
567+
# contributor some time solving that issue.
568+
# this detection could be generalized to other OSes aside from OS X
569+
# but the issue seems most likely to happen on OS X
570+
571+
chk_cc () {
572+
$1 --version 2> /dev/null | grep -q $2
573+
}
574+
# check that gcc, cc and g++ all point to the same compiler.
575+
# note that for xcode 5, g++ points to clang, not clang++
576+
if !((chk_cc gcc clang && chk_cc g++ clang) ||
577+
(chk_cc gcc gcc &&( chk_cc g++ g++ || chk g++ gcc))) then
578+
err "the gcc and g++ in your path point to different compilers.
579+
Check which versions are in your path with cc --version and g++ --version.
580+
To resolve this problem, either fix your PATH or run configure with --enable-clang"
581+
fi
582+
562583
fi
563584
fi
564585

0 commit comments

Comments
 (0)