Skip to content

configure: support --prefix and --llvm-root #1123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,36 @@ probe_need() {
fi
}

valopt() {
local OP=$1
local DEFAULT=$2
shift
shift
local DOC="$*"
if [ $HELP -eq 0 ]
then
local UOP=$(echo $OP | tr 'a-z-' 'A-Z_')
local V="CFG_${UOP}"
eval $V="$DEFAULT"
for arg in $CFG_CONFIGURE_ARGS
do
if echo "$arg" | grep -q -- "--$OP="
then
val=$(echo "$arg" | cut -f2 -d=)
eval $V=$val
fi
done
putvar $V
else
if [ -z "$DEFAULT" ]
then
DEFAULT="<none>"
fi
OP="${OP}=[${DEFAULT}]"
printf " --%-30s %s\n" "$OP" "$DOC"
fi
}

opt() {
local OP=$1
local DEFAULT=$2
Expand Down Expand Up @@ -219,15 +249,14 @@ opt valgrind 1 "run tests with valgrind"
opt docs 1 "build documentation"
opt optimize 1 "build optimized rust code"
opt mingw-cross 0 "cross-compile for win32 using mingw"

valopt prefix "/usr/local" "set installation prefix"
valopt llvm-root "" "set llvm root"

if [ $HELP -eq 1 ]
then
echo ""
echo "Useful environment variables:"
echo ""
printf " %-32s %s\n" "CFG_LLVM_ROOT" "The host LLVM install"
printf " %-32s %s\n" "CFG_PREFIX" "The installation prefix"
printf " %-32s %s\n" "CFG_ONLY_GCC" "Prefer gcc to clang for building the runtime"
printf " %-32s %s\n" "CFG_TARGET_TRIPLES" "LLVM target triples"
echo ""
Expand Down