Skip to content

Commit

Permalink
configure: Miscellaneous small changes to helper functions
Browse files Browse the repository at this point in the history
- Reuse sanitize_var_name() where appropriate
- Add some quotes to enabled()/disabled() to ease readability
- Fix logged names of some helper functions
- Filter LDFLAGS also in test_ldflags()
  • Loading branch information
DonDiego committed Nov 2, 2017
1 parent 67c72f0 commit 61a1742
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,13 @@ disable_weak(){

enable_sanitized(){
for var; do
enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
enable $(sanitize_var_name $var)
done
}

disable_sanitized(){
for var; do
disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
disable $(sanitize_var_name $var)
done
}

Expand Down Expand Up @@ -552,12 +552,12 @@ enable_deep_weak(){
}

enabled(){
test "${1#!}" = "$1" && op== || op=!=
test "${1#!}" = "$1" && op="=" || op="!="
eval test "x\$${1#!}" $op "xyes"
}

disabled(){
test "${1#!}" = "$1" && op== || op=!=
test "${1#!}" = "$1" && op="=" || op="!="
eval test "x\$${1#!}" $op "xno"
}

Expand Down Expand Up @@ -899,6 +899,7 @@ check_objcflags(){

test_ldflags(){
log test_ldflags "$@"
set -- $($ldflags_filter "$@")
check_ld "$@" <<EOF
int main(void){ return 0; }
EOF
Expand Down Expand Up @@ -1125,14 +1126,14 @@ require(){
}

require_header(){
log require "$@"
log require_header "$@"
headers="$1"
shift
check_header "$headers" "$@" || die "ERROR: $headers not found"
}

require_cpp_condition(){
log require "$@"
log require_cpp_condition "$@"
header="$1"
condition="$2"
shift 2
Expand Down

0 comments on commit 61a1742

Please sign in to comment.