-if [ $FOUND -lt 1 ]; then
- echo "Failed to locate library directory!"
- exit 1
-else
- echo "Toolchain successfully patched."
- exit 0
-fi
+ [ $found -gt 0 ]
+ return $?
+}
+
+
+VERSION="$(STAGING_DIR="$DIR" "$CPP" --version | sed -ne 's/^.* (.*) //; s/ .*$//; 1p')"
+VERSION="${VERSION:-unknown}"
+
+case "${VERSION##* }" in
+ 2.*|3.*|4.0.*|4.1.*|4.2.*)
+ echo "The compiler version does not support getenv() in spec files."
+ echo -n "Wrapping binaries instead ... "
+
+ if "${0%/*}/ext-toolchain.sh" --toolchain "$DIR" --wrap "${CPP%/*}"; then
+ echo "ok"
+ exit 0
+ else
+ echo "failed"
+ exit $?
+ fi
+ ;;
+ *)
+ if patch_specs; then
+ echo "Toolchain successfully patched."
+ exit 0
+ else
+ echo "Failed to locate library directory!"
+ exit 1
+ fi
+ ;;
+esac