diff --git a/Configure.pl b/Configure.pl index 4941a40..b91afa3 100644 --- a/Configure.pl +++ b/Configure.pl @@ -407,6 +407,11 @@ E.g. Use this option if you want imcc's parser and lexer files to be generated. Needs a working parser and lexer. +=item C<--with-llvm> + +Use this option if you have a recent version of LLVM installed and wish Parrot +to link to it. + =back =head1 CONFIGURATION-FILE INTERFACE diff --git a/config/auto/llvm.pm b/config/auto/llvm.pm index f47b972..f2a2bcf 100644 --- a/config/auto/llvm.pm +++ b/config/auto/llvm.pm @@ -7,7 +7,11 @@ config/auto/llvm - Check whether the Low Level Virtual Machine is present =head1 DESCRIPTION Determines whether the Low Level Virtual Machine (LLVM) is installed and -functional on the system. It is OK when it doesn't exist. +functional on the system. It is okay when it is not present. When a +sufficiently up-to-date version of LLVM is present, you will need to +specify C<--with-llvm> as an option to C in order to tell +Parrot to link to LLVM, I building without LLVM is Parrot's default +setting. =cut @@ -30,7 +34,11 @@ sub runstep { my ( $self, $conf ) = @_; my $verbose = $conf->options->get( 'verbose' ); - my $llvm_config = $conf->options->get( 'llvm-config' ) || 'llvm-config'; + unless ( $conf->options->get( 'with-llvm' ) ) { + $self->_handle_result( $conf, 0 ); + print "LLVM not requested\n" if $verbose; + return 1; + } # We will run various probes for LLVM. If the probes are unsuccessful, we # will set_result to 'no', set 'has_llvm' to '', then return from diff --git a/lib/Parrot/Configure/Options/Conf/Shared.pm b/lib/Parrot/Configure/Options/Conf/Shared.pm index 7874ef4..3744a6d 100644 --- a/lib/Parrot/Configure/Options/Conf/Shared.pm +++ b/lib/Parrot/Configure/Options/Conf/Shared.pm @@ -71,6 +71,7 @@ our @shared_valid_options = qw{ verbose verbose-step version + with-llvm without-crypto without-core-nci-thunks without-extra-nci-thunks diff --git a/t/steps/auto/llvm-01.t b/t/steps/auto/llvm-01.t index f5e028c..f1fb0b6 100644 --- a/t/steps/auto/llvm-01.t +++ b/t/steps/auto/llvm-01.t @@ -5,7 +5,7 @@ use strict; use warnings; use File::Temp qw( tempdir ); -use Test::More tests => 48; +use Test::More tests => 56; use Carp; use lib qw( lib t/configure/testlib ); use_ok('config::auto::llvm'); @@ -36,13 +36,13 @@ $conf->options->set( %{$args} ); my $step = test_step_constructor_and_description($conf); my $ret = $step->runstep($conf); ok( $ret, "runstep() returned true value" ); -like( $step->result(), qr/yes|no/, - "Result was either 'yes' or 'no'" ); +like( $step->result(), qr/no/, + "LLVM not requested; hence result is 'no'" ); +ok( ! $conf->data->get( 'has_llvm' ), + "'has_llvm' set to false value, as expected" ); $conf->replenish($serialized); -########## --verbose ########## - ($args, $step_list_ref) = process_options( { argv => [ q{--verbose} ], mode => q{configure}, @@ -58,6 +58,31 @@ $step = test_step_constructor_and_description($conf); \$stdout ); ok( $ret, "runstep() returned true value" ); + like( $step->result(), qr/no/, + "LLVM not requested; hence result is 'no'" ); + ok( ! $conf->data->get( 'has_llvm' ), + "'has_llvm' set to false value, as expected" ); + like( $stdout, qr/LLVM not requested/s, + "LLVM not requested; got expected verbose output" ); +} + +########### --verbose ########## + +($args, $step_list_ref) = process_options( { + argv => [ q{--verbose}, q{--with-llvm} ], + mode => q{configure}, +} ); + +$conf->add_steps($pkg); +$conf->options->set( %{$args} ); +$step = test_step_constructor_and_description($conf); +{ + my $stdout; + my $ret = capture( + sub { $step->runstep($conf) }, + \$stdout + ); + ok( $ret, "runstep() returned true value" ); like( $step->result(), qr/yes|no/, "Result was either 'yes' or 'no'" ); SKIP: {