Skip to content

Commit 5c56887

Browse files
committed
Auto merge of #28331 - semarie:openbsd-configure-egcc, r=alexcrichton
under OpenBSD, it could be have present multiples versions of gcc compiler: - gcc-4.2 (with patchs) : c/c++ compiler present in `/usr/bin`. It is unusable to build recent LLVM (so rustc too). - gcc/g++ -4.9 : c/c++ compiler, installed as third-party with "ports" mechanism. The compiler is installed in `/usr/local` as `egcc` (and `eg++`). this PR adds probing for `egcc` for `CFG_GCC`, if the first probed `gcc` is too old. It will set `CC` and `CXX` too, in order to pass the variables to LLVM configure if builded. please note this PR is a first step in order to build rustc under OpenBSD with unpatched tree. r? @alexcrichton cc @brson @dhuseby
2 parents 5ff5594 + 9ac36f4 commit 5c56887

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

configure

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,28 @@ then
885885
CFG_DISABLE_JEMALLOC=1
886886
fi
887887

888+
# default gcc version under OpenBSD maybe too old, try using egcc, which is a
889+
# gcc version from ports
890+
if [ $CFG_OSTYPE = unknown-openbsd ]
891+
then
892+
if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
893+
step_msg "older GCC found, try with egcc instead"
894+
895+
# probe again but using egcc
896+
probe CFG_GCC egcc
897+
898+
# and use egcc/eg++ for CC/CXX too if it was found
899+
# (but user setting has priority)
900+
if [ -n "$CFG_GCC" ]; then
901+
CC="${CC:-egcc}"
902+
CXX="${CXX:-eg++}"
903+
fi
904+
fi
905+
906+
step_msg "on OpenBSD, disabling jemalloc"
907+
CFG_DISABLE_JEMALLOC=1
908+
fi
909+
888910
# OS X 10.9, gcc is actually clang. This can cause some confusion in the build
889911
# system, so if we find that gcc is clang, we should just use clang directly.
890912
if [ $CFG_OSTYPE = apple-darwin -a -z "$CFG_ENABLE_CLANG" ]

0 commit comments

Comments
 (0)