diff options
author | Mark Allen <[email protected]> | 2017-02-02 18:08:09 -0600 |
---|---|---|
committer | Mark Allen <[email protected]> | 2017-02-02 18:08:09 -0600 |
commit | 3647703c4fd9079475c5ac5661c5b98f43ac2a27 (patch) | |
tree | 98d841a7b86b21eb993053dd97824807d66ac1a1 /kerl | |
parent | 0484b5cfaf72e44be5d058e623f28b70d3cac311 (diff) | |
download | kerl-3647703c4fd9079475c5ac5661c5b98f43ac2a27.tar.gz kerl-3647703c4fd9079475c5ac5661c5b98f43ac2a27.tar.bz2 kerl-3647703c4fd9079475c5ac5661c5b98f43ac2a27.zip |
Assert perl exists before builds (#170)gh170
Perl 5 is required to compile Erlang from source. It's used (among other
things) to assemble BEAM opcodes, NIF jump tables and more. We now
assert perl exists on the PATH before we proceed to build Erlang or test
for Perl's version string.
We also now test for Java before we try to find its version. Java is not
required to compile Erlang though, so we don't output any warnings or
errors if its not found.
Diffstat (limited to 'kerl')
-rwxr-xr-x | kerl | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -382,13 +382,35 @@ get_otp_version() get_perl_version() { - perl -v | grep version | sed $SED_OPT -e 's/.*v5\.([0-9]+)\.[0-9].*/\1/' + if assert_perl; then + perl -v | grep version | sed $SED_OPT -e 's/.*v5\.([0-9]+)\.[0-9].*/\1/' + else + echo "FATAL: I couldn't find perl which is required to compile Erlang." + exit 1 + fi +} + +assert_perl() +{ + perl_loc=$(which perl) + if [ -z "$perl_loc" ]; then + return 1 + else + # 0 to bash is "true" because of Unix exit code conventions + return 0 + fi } get_javac_version() { - javaout=$(javac -version 2>&1) - echo "$javaout" | cut -d' ' -f2 | cut -d'.' -f2 + java_loc=$(which javac) + if [ -z "$java_loc" ]; then + # Java's not installed, so just return 0 + 0 + else + javaout=$(javac -version 2>&1) + echo "$javaout" | cut -d' ' -f2 | cut -d'.' -f2 + fi } show_configuration_warnings() |