Ticket #2092: llvm_optin.985e82a5873.diff

File llvm_optin.985e82a5873.diff, 3.9 KB (added by jkeenan, 11 years ago)

Introduce --with-llvm option to explicitly link to LLVM

  • Configure.pl

    diff --git a/Configure.pl b/Configure.pl
    index 4941a40..b91afa3 100644
    a b  
    407407Use this option if you want imcc's parser and lexer files to be generated. 
    408408Needs a working parser and lexer. 
    409409 
     410=item C<--with-llvm> 
     411 
     412Use this option if you have a recent version of LLVM installed and wish Parrot 
     413to link to it. 
     414 
    410415=back 
    411416 
    412417=head1 CONFIGURATION-FILE INTERFACE 
  • config/auto/llvm.pm

    diff --git a/config/auto/llvm.pm b/config/auto/llvm.pm
    index f47b972..f2a2bcf 100644
    a b  
    77=head1 DESCRIPTION 
    88 
    99Determines whether the Low Level Virtual Machine (LLVM) is installed and 
    10 functional on the system.  It is OK when it doesn't exist. 
     10functional on the system.  It is okay when it is not present.  When a 
     11sufficiently up-to-date version of LLVM is present, you will need to 
     12specify C<--with-llvm> as an option to C<perl Configure.pl> in order to tell 
     13Parrot to link to LLVM, I<i.e.,> building without LLVM is Parrot's default 
     14setting. 
    1115 
    1216=cut 
    1317 
     
    3034    my ( $self, $conf ) = @_; 
    3135 
    3236    my $verbose = $conf->options->get( 'verbose' ); 
    33     my $llvm_config = $conf->options->get( 'llvm-config' ) || 'llvm-config'; 
     37    unless ( $conf->options->get( 'with-llvm' ) ) { 
     38        $self->_handle_result( $conf, 0 ); 
     39        print "LLVM not requested\n" if $verbose; 
     40        return 1; 
     41    } 
    3442 
    3543    # We will run various probes for LLVM.  If the probes are unsuccessful, we 
    3644    # will set_result to 'no', set 'has_llvm' to '', then return from 
  • lib/Parrot/Configure/Options/Conf/Shared.pm

    diff --git a/lib/Parrot/Configure/Options/Conf/Shared.pm b/lib/Parrot/Configure/Options/Conf/Shared.pm
    index 7874ef4..3744a6d 100644
    a b  
    7171    verbose 
    7272    verbose-step 
    7373    version 
     74    with-llvm 
    7475    without-crypto 
    7576    without-core-nci-thunks 
    7677    without-extra-nci-thunks 
  • t/steps/auto/llvm-01.t

    diff --git a/t/steps/auto/llvm-01.t b/t/steps/auto/llvm-01.t
    index f5e028c..f1fb0b6 100644
    a b  
    55use strict; 
    66use warnings; 
    77use File::Temp qw( tempdir ); 
    8 use Test::More tests =>  48; 
     8use Test::More tests =>  56; 
    99use Carp; 
    1010use lib qw( lib t/configure/testlib ); 
    1111use_ok('config::auto::llvm'); 
     
    3636my $step = test_step_constructor_and_description($conf); 
    3737my $ret = $step->runstep($conf); 
    3838ok( $ret, "runstep() returned true value" ); 
    39 like( $step->result(), qr/yes|no/, 
    40   "Result was either 'yes' or 'no'" ); 
     39like( $step->result(), qr/no/, 
     40  "LLVM not requested; hence result is 'no'" ); 
     41ok( ! $conf->data->get( 'has_llvm' ), 
     42    "'has_llvm' set to false value, as expected" ); 
    4143 
    4244$conf->replenish($serialized); 
    4345 
    44 ########## --verbose ########## 
    45  
    4646($args, $step_list_ref) = process_options( { 
    4747    argv => [ q{--verbose} ], 
    4848    mode => q{configure}, 
     
    5858        \$stdout 
    5959    ); 
    6060    ok( $ret, "runstep() returned true value" ); 
     61    like( $step->result(), qr/no/, 
     62      "LLVM not requested; hence result is 'no'" ); 
     63    ok( ! $conf->data->get( 'has_llvm' ), 
     64        "'has_llvm' set to false value, as expected" ); 
     65    like( $stdout, qr/LLVM not requested/s, 
     66        "LLVM not requested; got expected verbose output" ); 
     67} 
     68 
     69########### --verbose ########## 
     70 
     71($args, $step_list_ref) = process_options( { 
     72    argv => [ q{--verbose}, q{--with-llvm} ], 
     73    mode => q{configure}, 
     74} ); 
     75 
     76$conf->add_steps($pkg); 
     77$conf->options->set( %{$args} ); 
     78$step = test_step_constructor_and_description($conf); 
     79{ 
     80    my $stdout; 
     81    my $ret = capture( 
     82        sub { $step->runstep($conf) }, 
     83        \$stdout 
     84    ); 
     85    ok( $ret, "runstep() returned true value" ); 
    6186    like( $step->result(), qr/yes|no/, 
    6287        "Result was either 'yes' or 'no'" ); 
    6388    SKIP: {