Ticket #119: conf-libs.patch

File conf-libs.patch, 45.1 KB (added by fperrad, 13 years ago)
  • config/auto/crypto.pm

     
    77 
    88=head1 DESCRIPTION 
    99 
     10This library is linked to a dynamic PMC. 
     11 
    1012See L<http://www.openssl.org> 
    1113 
    1214=cut 
     
    4547        return 1; 
    4648    } 
    4749 
    48     my $cc        = $conf->data->get('cc'); 
    49     my $libs      = $conf->data->get('libs'); 
    50     my $linkflags = $conf->data->get('linkflags'); 
    51     my $ccflags   = $conf->data->get('ccflags'); 
    52  
    5350    my $osname = $conf->data->get_p5('OSNAME'); 
    5451 
    55     $self->_add_to_libs( { 
     52    my $extra_libs = $self->_select_lib( { 
    5653        conf            => $conf, 
    5754        osname          => $osname, 
    58         cc              => $cc, 
     55        cc              => $conf->data->get('cc'), 
    5956        win32_nongcc    => 'libcrypto.lib', 
    6057        default         => '-lcrypto', 
    6158    } ); 
    6259 
    6360    $conf->cc_gen('config/auto/crypto/crypto.in'); 
    64     eval { $conf->cc_build(); }; 
     61    eval { $conf->cc_build( q{}, $extra_libs); }; 
    6562    my $has_crypto = 0; 
    6663    if ( !$@ ) { 
    6764        my $test = $conf->cc_run(); 
    6865        $has_crypto = $self->_evaluate_cc_run($conf, $test, $has_crypto, $verbose); 
    6966    } 
    70     unless ($has_crypto) { 
    71         # The Parrot::Configure settings might have changed while class ran 
    72         $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    73     } 
    7467    $conf->data->set( has_crypto => $has_crypto );    # for dynpmc.in & digest.t 
    7568 
    7669    return 1; 
  • config/auto/gdbm.pm

     
    5050        return 1; 
    5151    } 
    5252 
    53     my $cc        = $conf->data->get('cc'); 
    54     my $libs      = $conf->data->get('libs'); 
    55     my $linkflags = $conf->data->get('linkflags'); 
    56     my $ccflags   = $conf->data->get('ccflags'); 
    57  
    5853    my $osname = $conf->data->get_p5('OSNAME'); 
    5954 
     55    my $extra_libs = $self->_select_lib( { 
     56        conf            => $conf, 
     57        osname          => $osname, 
     58        cc              => $conf->data->get('cc'), 
     59        win32_gcc       => '-llibgdbm', 
     60        win32_nongcc    => 'gdbm.lib', 
     61        default         => '-lgdbm', 
     62    } ); 
     63 
    6064    # On OS X check the presence of the gdbm header in the standard 
    6165    # Fink location. 
    6266    $self->_handle_darwin_for_fink($conf, $osname, 'gdbm.h'); 
    6367 
    6468    $conf->cc_gen('config/auto/gdbm/gdbm.in'); 
    65     if ( $osname =~ /mswin32/i ) { 
    66         if ( $cc =~ /^gcc/i ) { 
    67             eval { $conf->cc_build( '', '-llibgdbm' ); }; 
    68         } 
    69         else { 
    70             eval { $conf->cc_build( '', 'gdbm.lib' ); }; 
    71         } 
    72     } 
    73     else { 
    74         eval { $conf->cc_build( '', '-lgdbm' ); }; 
    75     } 
     69    eval { $conf->cc_build( q{}, $extra_libs ); }; 
    7670    my $has_gdbm = 0; 
    7771    if ( !$@ ) { 
    7872        my $test = $conf->cc_run(); 
    7973        unlink "gdbm_test_db"; 
    8074        $has_gdbm = $self->_evaluate_cc_run($test, $has_gdbm, $verbose); 
    8175    } 
    82     unless ($has_gdbm) { 
    83         # The Parrot::Configure settings might have changed while class ran 
    84         $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    85     } 
    8676    $conf->data->set( has_gdbm => $has_gdbm );    # for gdbmhash.t and dynpmc.in 
    8777 
    8878    return 1; 
  • config/auto/gettext.pm

     
    5050        return 1; 
    5151    } 
    5252 
    53     my $cc        = $conf->data->get('cc'); 
    54     my $libs      = $conf->data->get('libs'); 
    55     my $linkflags = $conf->data->get('linkflags'); 
    56     my $ccflags   = $conf->data->get('ccflags'); 
    57  
    5853    my $osname = $conf->data->get_p5('OSNAME'); 
    5954 
    60     $self->_add_to_libs( { 
     55    my $extra_libs = $self->_select_lib( { 
    6156        conf            => $conf, 
    6257        osname          => $osname, 
    63         cc              => $cc, 
     58        cc              => $conf->data->get('cc'), 
    6459        win32_gcc       => '-lintl', 
    6560        win32_nongcc    => 'intl.lib', 
    6661        default         => defined $conf->data->get('glibc') ? '' : '-lintl', 
     
    7166    $self->_handle_darwin_for_fink($conf, $osname, 'libintl.h'); 
    7267 
    7368    $conf->cc_gen('config/auto/gettext/gettext.in'); 
    74     eval { $conf->cc_build(); }; 
    75     my $has_gettext; 
     69    eval { $conf->cc_build( q{}, $extra_libs ); }; 
     70    my $has_gettext = 0; 
    7671    if ( !$@ ) { 
    7772        my $test = $conf->cc_run(); 
    7873        $has_gettext = $self->_evaluate_cc_run($test, $verbose); 
    7974    } 
    8075    if ($has_gettext) { 
    81         _handle_gettext($conf, $verbose); 
     76        _handle_gettext($conf, $verbose, $extra_libs); 
    8277    } 
    83     else { 
    84         # The Parrot::Configure settings might have changed while class ran 
    85         $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    86     } 
    8778    $conf->data->set( HAS_GETTEXT => $has_gettext ); 
    8879 
    8980    return 1; 
     
    10293} 
    10394 
    10495sub _handle_gettext { 
    105     my ($conf, $verbose) = @_; 
     96    my ($conf, $verbose, $libs) = @_; 
    10697    $conf->data->add( ' ', ccflags => "-DHAS_GETTEXT" ); 
     98    $conf->data->add( ' ', libs => $libs ); 
    10799    $verbose and print "\n  ccflags: ", $conf->data->get("ccflags"), "\n"; 
    108100    return 1; 
    109101} 
  • config/auto/gmp.pm

     
    5656        return 1; 
    5757    } 
    5858 
    59     my $cc        = $conf->data->get('cc'); 
    60     my $libs      = $conf->data->get('libs'); 
    61     my $linkflags = $conf->data->get('linkflags'); 
    62     my $ccflags   = $conf->data->get('ccflags'); 
     59    my $osname = $conf->data->get_p5('OSNAME'); 
    6360 
    64     my $osname    = $conf->data->get_p5('OSNAME'); 
    65  
    66     $self->_add_to_libs( { 
     61    my $extra_libs = $self->_select_lib( { 
    6762        conf            => $conf, 
    6863        osname          => $osname, 
    69         cc              => $cc, 
     64        cc              => $conf->data->get('cc'), 
    7065        win32_nongcc    => 'gmp.lib', 
    7166        default         => '-lgmp', 
    7267    } ); 
     
    7772    $self->_handle_darwin_for_macports($conf, $osname, 'gmp.h'); 
    7873 
    7974    $conf->cc_gen('config/auto/gmp/gmp.in'); 
    80     eval { $conf->cc_build(); }; 
     75    eval { $conf->cc_build( q{}, $extra_libs); }; 
    8176    my $has_gmp = 0; 
    8277    if ( !$@ ) { 
    8378        my $test = $conf->cc_run(); 
    8479        $has_gmp = $self->_evaluate_cc_run( $conf, $test, $has_gmp, $verbose ); 
    8580    } 
    86     unless ($has_gmp) { 
    87         # The Parrot::Configure settings might have changed while class ran 
    88         $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
     81    if ($has_gmp) { 
     82        $conf->data->add( ' ', libs => $extra_libs ); 
    8983    } 
    9084 
    9185    return 1; 
  • config/auto/opengl.pm

     
    1818the steps needed to add OpenGL support for each platform for which we have 
    1919received this information -- details for additional platforms are welcome! 
    2020 
    21  
    2221=head2 Mac OS X 
    2322 
    2423You will need to install the F<OpenGL Framework> and the F<GLUT Framework>. 
     
    160159        return 1; 
    161160    } 
    162161 
    163     my $cc        = $conf->data->get('cc'); 
    164     my $libs      = $conf->data->get('libs'); 
    165     my $linkflags = $conf->data->get('linkflags'); 
    166     my $ccflags   = $conf->data->get('ccflags'); 
    167  
    168162    my $osname = $conf->data->get_p5('OSNAME'); 
    169163 
    170164    # Prefer Cygwin/w32api over Cygwin/X, but use X when DISPLAY is set 
    171     if ($^O eq 'cygwin' and $ENV{DISPLAY}) { 
    172         $self->_add_to_libs( { 
    173             conf        => $conf, 
    174             osname      => $osname, 
    175             cc          => $cc, 
    176             cygwin      => '-lglut -L/usr/X11R6/lib -lGLU -lGL' 
    177         } ) 
    178     } 
    179     else { 
    180         $self->_add_to_libs( { 
    181             conf            => $conf, 
    182             osname          => $osname, 
    183             cc              => $cc, 
    184             win32_gcc       => '-lglut32 -lglu32 -lopengl32', 
    185             win32_nongcc    => 'opengl32.lib glu32.lib glut32.lib', 
    186             darwin          => '-framework OpenGL -framework GLUT', 
    187             default         => '-lglut -lGLU -lGL', 
    188     } ) }; 
     165    my $extra_libs = ($^O eq 'cygwin' and $ENV{DISPLAY}) 
     166                   ? $self->_select_lib( { 
     167                        conf        => $conf, 
     168                        osname      => $osname, 
     169                        cc          => $conf->data->get('cc'), 
     170                        cygwin      => '-lglut -L/usr/X11R6/lib -lGLU -lGL' 
     171                     } ) 
     172                   : $self->_select_lib( { 
     173                        conf            => $conf, 
     174                        osname          => $osname, 
     175                        cc              => $conf->data->get('cc'), 
     176                        win32_gcc       => '-lglut32 -lglu32 -lopengl32', 
     177                        win32_nongcc    => 'opengl32.lib glu32.lib glut32.lib', 
     178                        darwin          => '-framework OpenGL -framework GLUT', 
     179                        default         => '-lglut -lGLU -lGL', 
     180                     } ) 
     181                   ; 
    189182 
    190183    # On OS X check the presence of the OpenGL headers in the standard 
    191184    # Fink/macports locations. 
     
    195188 
    196189    $conf->cc_gen('config/auto/opengl/opengl.in'); 
    197190    my $has_glut = 0; 
    198     eval { $conf->cc_build() }; 
     191    eval { $conf->cc_build( q{}, $extra_libs ) }; 
    199192    if ( !$@ ) { 
    200193        my $test = $conf->cc_run(); 
    201         $has_glut = _handle_glut($conf, $self->_evaluate_cc_run($test, $verbose)); 
     194        $has_glut = _handle_glut($conf, $extra_libs, $self->_evaluate_cc_run($test, $verbose)); 
    202195    } 
    203     unless ($has_glut) { 
    204         # The Parrot::Configure settings might have changed while class ran 
    205         $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    206     } 
    207196 
    208197    return 1; 
    209198} 
     
    219208} 
    220209 
    221210sub _handle_glut { 
    222     my ($conf, $glut_api_version, $glut_brand) = @_; 
     211    my ($conf, $libs, $glut_api_version, $glut_brand) = @_; 
    223212 
    224213    $conf->data->set( 
    225214        # Completely cargo culted 
    226215        opengl     => 'define', 
    227216        has_opengl => 1, 
    228217        HAS_OPENGL => 1, 
     218        opengl_lib => $libs, 
    229219 
    230220        glut       => 'define', 
    231221        glut_brand => $glut_brand, 
  • config/auto/pcre.pm

     
    99 
    1010Determines whether the platform supports pcre library. 
    1111 
     12This library is used via NCI mecanism. 
     13 
    1214=cut 
    1315 
    1416package auto::pcre; 
     
    4446        return 1; 
    4547    } 
    4648 
    47     my $cc        = $conf->data->get('cc'); 
    48     my $libs      = $conf->data->get('libs'); 
    49     my $linkflags = $conf->data->get('linkflags'); 
    50     my $ccflags   = $conf->data->get('ccflags'); 
    51  
    5249    my $osname = $conf->data->get_p5('OSNAME'); 
    5350 
    54     $self->_add_to_libs( { 
     51    my $extra_libs = $self->_select_lib( { 
    5552        conf            => $conf, 
    5653        osname          => $osname, 
    57         cc              => $cc, 
     54        cc              => $conf->data->get('cc'), 
    5855        win32_nongcc    => 'pcre.lib', 
    5956        default         => '-lpcre', 
    6057    } ); 
     
    6562    $self->_handle_darwin_for_macports($conf, $osname, 'pcre.h'); 
    6663 
    6764    $conf->cc_gen('config/auto/pcre/pcre.in'); 
    68     eval { $conf->cc_build() }; 
     65    eval { $conf->cc_build( q{}, $extra_libs ) }; 
    6966    my $has_pcre = 0; 
    7067    if ( !$@ ) { 
    7168        my $test = $conf->cc_run(); 
    7269        $has_pcre = $self->_evaluate_cc_run($test, $verbose); 
    7370    } 
    74     if (! $has_pcre) { 
    75         # The Parrot::Configure settings might have changed while class ran 
    76         $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    77     } 
    7871    $conf->data->set( HAS_PCRE => $has_pcre); 
    7972 
    8073    return 1; 
  • config/auto/readline.pm

     
    3838 
    3939    my $verbose = $conf->options->get('verbose'); 
    4040 
    41     my $cc        = $conf->data->get('cc'); 
    42     my $libs      = $conf->data->get('libs'); 
    43     my $linkflags = $conf->data->get('linkflags'); 
    44     my $ccflags   = $conf->data->get('ccflags'); 
    45  
     41    my $cc     = $conf->data->get('cc'); 
    4642    my $osname = $conf->data->get_p5('OSNAME'); 
    4743 
    48     $self->_add_to_libs( { 
     44    my $extra_libs = $self->_select_lib( { 
    4945        conf            => $conf, 
    5046        osname          => $osname, 
    5147        cc              => $cc, 
     
    6056 
    6157    $conf->cc_gen('config/auto/readline/readline.in'); 
    6258    my $has_readline = 0; 
    63     eval { $conf->cc_build() }; 
     59    eval { $conf->cc_build( q{}, $extra_libs ) }; 
    6460    if ( !$@ ) { 
    6561        if ( $conf->cc_run() ) { 
    6662            $has_readline = $self->_evaluate_cc_run($verbose); 
    6763        } 
    68         _handle_readline($conf, $has_readline); 
     64        _handle_readline($conf, $extra_libs); 
    6965    } 
    7066    else { 
    71         _handle_ncurses_need($conf, $osname, $cc); 
    72         eval { $conf->cc_build() }; 
     67        # a second chance with ncurses 
     68        $extra_libs .= ' '; 
     69        $extra_libs .= $self->_select_lib( { 
     70            conf            => $conf, 
     71            osname          => $osname, 
     72            cc              => $cc, 
     73            win32_nongcc    => 'ncurses.lib', 
     74            default         => '-lncurses', 
     75        } ); 
     76        eval { $conf->cc_build( q{}, $extra_libs) }; 
    7377        if ( !$@ ) { 
    7478            if ( $conf->cc_run() ) { 
    7579                $has_readline = $self->_evaluate_cc_run($verbose); 
    7680            } 
    77             _handle_readline($conf, $has_readline); 
     81            _handle_readline($conf, $extra_libs); 
    7882        } 
    7983    } 
    80     unless ($has_readline) { 
    81         # The Parrot::Configure settings might have changed while class ran 
    82         $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    83     } 
     84    $conf->data->set( HAS_READLINE => $has_readline ); 
    8485 
    8586    return 1; 
    8687} 
    8788 
    88 sub _handle_ncurses_need { 
    89     my ($conf, $osname, $cc) = @_; 
    90     if ( $osname =~ /mswin32/i ) { 
    91         if ( $cc =~ /^gcc/i ) { 
    92             $conf->data->add( ' ', libs => '-lncurses' ); 
    93         } 
    94         else { 
    95             $conf->data->add( ' ', libs => 'ncurses.lib' ); 
    96         } 
    97     } 
    98     else { 
    99         $conf->data->add( ' ', libs => '-lncurses' ); 
    100     } 
    101     return 1; 
    102 } 
    103  
    10489sub _evaluate_cc_run { 
    10590    my ($self, $verbose) = @_; 
    10691    my $has_readline = 1; 
     
    11095} 
    11196 
    11297sub _handle_readline { 
    113     my ($conf, $has_readline) = @_; 
    114     $conf->data->set( 
    115         readline     => 'define', 
    116         HAS_READLINE => $has_readline, 
    117     ); 
     98    my ($conf, $libs) = @_; 
     99    $conf->data->set( readline => 'define' ); 
     100    $conf->data->add( ' ', libs => $libs ); 
    118101    return 1; 
    119102} 
    120103 
  • config/gen/crypto/digest_pmc.in

     
    2323pmclass @md_name@ 
    2424    dynpmc 
    2525    need_ext 
    26     group digest_group { 
     26    group digest_group 
     27    lib crypto { 
    2728 
    2829/* 
    2930 
  • config/gen/makefiles/dynoplibs_pl.in

     
    7878    if ($^O =~ /mswin32/i) { 
    7979        # Need to put various libraries in the link line. 
    8080        $liblist = join( ' ', map { "$_.lib" } keys %$libs ); 
    81         if ($CC =~ /gcc/i) { 
    82             $liblist =~ s/gdbm\.lib/-llibgdbm/i; 
    83         } 
    8481        my $extraLibs = '@libs@ @icu_shared@'; 
    8582        $extraLibs =~ s/blib/..\\blib/g; 
    8683        $extraLibs =~ s/\Q$(A)\E/.lib/g; 
     
    122119    my $core_suffix; 
    123120    foreach $core_suffix (values %cores) { 
    124121        partial_link({}, $_ . "_ops$core_suffix", @objs) foreach (@oplibs); 
    125      } 
     122    } 
    126123} 
    127124elsif ($mode eq 'copy') { 
    128125    # Copy *.so -> destination, where destination is the first 
  • config/gen/makefiles/dynpmc_pl.in

     
    8282    my $liblist; 
    8383    if ($^O =~ /mswin32/i) { 
    8484        # Need to put various libraries in the link line. 
    85         $liblist = join( ' ', map { "$_.lib" } keys %$libs ); 
    8685        if ($CC =~ /gcc/i) { 
    87             $liblist =~ s/libgdbm\.lib/-llibgdbm/i; 
     86            $liblist = join( ' ', map { "-l$_" } keys %$libs ); 
     87            $liblist =~ s/-lgdbm/-llibgdbm/i; 
    8888        } 
     89        else { 
     90            $liblist = join( ' ', map { "$_.lib" } keys %$libs ); 
     91        } 
    8992        my $extraLibs = '@libs@ @icu_shared@'; 
    9093        $extraLibs =~ s/blib/..\\blib/g; 
    9194        $extraLibs =~ s/\Q$(A)\E/.lib/g; 
     
    212215 
    213216        # there can be many libs 
    214217        my %libs = %{ $class->{flags}{lib} || {} }; 
    215         if ($^O eq 'MSWin32' && $CC =~ /^gcc/i) { 
    216             my %newlibs = (); 
    217             $newlibs{"lib$_"} = $libs{$_} for keys %libs; 
    218             %libs = %newlibs; 
    219         } 
    220218        $pmc_libs{$pmc} = \%libs; 
    221219 
    222220        # There should be at most a single group 
  • config/gen/makefiles/root.in

     
    21972197# for use by runtime/parrot/library/OpenGL.pir 
    21982198$(LIBGLUTCB_SO): $(LIBPARROT) $(SRC_DIR)/glut_callbacks$(O) 
    21992199        $(LD) $(LD_LOAD_FLAGS) $(LDFLAGS) \ 
    2200     @ld_out@$@ $(SRC_DIR)/glut_callbacks$(O) $(ALL_PARROT_LIBS) 
     2200    @ld_out@$@ $(SRC_DIR)/glut_callbacks$(O) \ 
     2201    $(ALL_PARROT_LIBS) @opengl_lib@ 
    22012202 
    22022203# emacs etags 
    22032204# this needs exuberant-ctags 
  • lib/Parrot/Configure/Step/Methods.pm

     
    2727 
    2828=head1 METHODS 
    2929 
    30 =head2 C<_recheck_settings()> 
    31  
    32     $self->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    33  
    34 Currently used in configuration step classes auto::gmp, auto::readline, 
    35 auto::gdbm, and auto::opengl. 
    36  
    37 =cut 
    38  
    39 sub _recheck_settings { 
    40     my ($self, $conf, $libs, $ccflags, $linkflags, $verbose) = @_; 
    41     $conf->data->set( 'libs',      $libs ); 
    42     $conf->data->set( 'ccflags',   $ccflags ); 
    43     $conf->data->set( 'linkflags', $linkflags ); 
    44     print " (no) " if $verbose; 
    45     $self->set_result('no'); 
    46 } 
    47  
    4830=head2 C<_handle_darwin_for_fink()> 
    4931 
    5032    $self->_handle_darwin_for_fink($conf, $libs, $osname, $file); 
     
    11193    return 1; 
    11294} 
    11395 
    114 =head2 C<_add_to_libs()> 
     96=head2 C<_select_lib()> 
    11597 
    116     $self->_add_to_libs( { 
     98    $self->_select_lib( { 
    11799        conf            => $conf, 
    118100        osname          => $osname, 
    119101        cc              => $cc, 
     
    192174 
    193175=cut 
    194176 
    195 sub _add_to_libs { 
     177sub _select_lib { 
    196178    my $self = shift; 
    197179    my $args = shift; 
    198     croak "_add_to_libs() takes hashref: $!" unless ref($args) eq 'HASH'; 
     180    croak "_select_lib() takes hashref: $!" unless ref($args) eq 'HASH'; 
    199181    my $platform = 
    200182          (($args->{osname} =~ /mswin32/i || 
    201183           $args->{osname} =~ /cygwin/i) && 
     
    206188    my $libs = defined($args->{$platform}) 
    207189        ? $args->{$platform} 
    208190        : $args->{default}; 
    209     $args->{conf}->data->add(' ', libs => $libs); 
    210     return 1; 
     191    return $libs; 
    211192} 
    212193 
    213194sub _add_flags_not_yet_seen { 
  • t/steps/auto_crypto-01.t

     
    44 
    55use strict; 
    66use warnings; 
    7 use Test::More tests =>  36; 
     7use Test::More tests =>  24; 
    88use Carp; 
    99use lib qw( lib t/configure/testlib ); 
    1010use_ok('config::auto::crypto'); 
     
    4444 
    4545$conf->replenish($serialized); 
    4646 
    47 ########## _add_to_libs() ########## 
     47########## _select_lib() ########## 
    4848 
    4949($args, $step_list_ref) = process_options( { 
    5050    argv => [ ], 
     
    5757$initial_libs = $conf->data->get('libs'); 
    5858$osname = 'mswin32'; 
    5959$cc = 'gcc'; 
    60 ok($step->_add_to_libs( { 
     60is($step->_select_lib( { 
    6161    conf            => $conf, 
    6262    osname          => $osname, 
    6363    cc              => $cc, 
    6464    win32_nongcc    => 'libcrypto.lib', 
    6565    default         => '-lcrypto', 
    6666} ), 
    67    "_add_to_libs() returned true value"); 
    68 like($conf->data->get('libs'), 
    69     qr/-lcrypto/, 
    70     "'libs' attribute modified as expected"); 
    71 # Restore setting for next test 
    72 $conf->data->set( libs => $initial_libs ); 
     67   '-lcrypto', 
     68   "_select_lib() returned expected value"); 
    7369 
    7470$osname = 'mswin32'; 
    7571$cc = 'cc'; 
    76 ok($step->_add_to_libs( { 
     72is($step->_select_lib( { 
    7773    conf            => $conf, 
    7874    osname          => $osname, 
    7975    cc              => $cc, 
    8076    win32_nongcc    => 'libcrypto.lib', 
    8177    default         => '-lcrypto', 
    8278} ), 
    83    "_add_to_libs() returned true value"); 
    84 like($conf->data->get('libs'), 
    85     qr/libcrypto.lib/, 
    86     "'libs' attribute modified as expected"); 
    87 # Restore setting for next test 
    88 $conf->data->set( libs => $initial_libs ); 
     79   'libcrypto.lib', 
     80   "_select_lib() returned expected value"); 
    8981 
    9082$osname = 'foobar'; 
    9183$cc = 'cc'; 
    92 ok($step->_add_to_libs( { 
     84is($step->_select_lib( { 
    9385    conf            => $conf, 
    9486    osname          => $osname, 
    9587    cc              => $cc, 
    9688    win32_nongcc    => 'libcrypto.lib', 
    9789    default         => '-lcrypto', 
    9890} ), 
    99    "_add_to_libs() returned true value"); 
    100 like($conf->data->get('libs'), 
    101     qr/-lcrypto/, 
    102     "'libs' attribute modified as expected"); 
    103 # Restore setting for next test 
    104 $conf->data->set( libs => $initial_libs ); 
     91   '-lcrypto', 
     92   "_select_lib() returned expected value"); 
    10593 
    106 my ($libs, $ccflags, $linkflags, $verbose); 
     94my $verbose = undef; 
    10795 
    108 $libs = q{-lalpha}; 
    109 $ccflags = q{-Ibeta}; 
    110 $linkflags = q{-Lgamma}; 
    111 $verbose = undef; 
    112 $step->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    113 like($conf->data->get('libs'), qr/$libs/, 
    114     "Got expected value for 'libs'"); 
    115 like($conf->data->get('ccflags'), qr/$ccflags/, 
    116     "Got expected value for 'ccflags'"); 
    117 like($conf->data->get('linkflags'), qr/$linkflags/, 
    118     "Got expected value for 'linkflags'"); 
    119 is($step->result, 'no', "Expected result was set"); 
    120  
    121 ########## _recheck_settings() ########## 
    122  
    123 { 
    124     my $stdout; 
    125     $libs = q{-lalpha}; 
    126     $ccflags = q{-Ibeta}; 
    127     $linkflags = q{-Lgamma}; 
    128     $verbose = 1; 
    129     capture( 
    130         sub { $step->_recheck_settings( 
    131             $conf, $libs, $ccflags, $linkflags, $verbose); }, 
    132         \$stdout, 
    133     ); 
    134     like($conf->data->get('libs'), qr/$libs/, 
    135         "Got expected value for 'libs'"); 
    136     like($conf->data->get('ccflags'), qr/$ccflags/, 
    137         "Got expected value for 'ccflags'"); 
    138     like($conf->data->get('linkflags'), qr/$linkflags/, 
    139         "Got expected value for 'linkflags'"); 
    140     is($step->result, 'no', "Expected result was set"); 
    141     like($stdout, qr/\(no\)/, "Got expected verbose output"); 
    142 } 
    143  
    14496$conf->replenish($serialized); 
    14597 
    14698########## --without-crypto; _evaluate_cc_run() ########## 
  • t/steps/auto_gdbm-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests =>  62; 
     8use Test::More tests =>  47; 
    99use Carp; 
    1010use Cwd; 
    1111use File::Spec; 
     
    165165 
    166166$conf->replenish($serialized); 
    167167 
    168 ########## --without-gdbm; _recheck_settings() ########## 
    169  
    170 ($args, $step_list_ref) = process_options( { 
    171     argv => [ q{--without-gdbm} ], 
    172     mode => q{configure}, 
    173 } ); 
    174 rerun_defaults_for_testing($conf, $args ); 
    175 $conf->add_steps($pkg); 
    176 $conf->options->set( %{$args} ); 
    177 $step = test_step_constructor_and_description($conf); 
    178  
    179 my ($libs, $ccflags, $linkflags); 
    180  
    181 $libs = q{-lalpha}; 
    182 $ccflags = q{-Ibeta}; 
    183 $linkflags = q{-Lgamma}; 
    184 $verbose = undef; 
    185 $step->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    186 like($conf->data->get('libs'), qr/$libs/, 
    187     "Got expected value for 'libs'"); 
    188 like($conf->data->get('ccflags'), qr/$ccflags/, 
    189     "Got expected value for 'ccflags'"); 
    190 like($conf->data->get('linkflags'), qr/$linkflags/, 
    191     "Got expected value for 'linkflags'"); 
    192 is($step->result, 'no', "Expected result was set"); 
    193  
    194 { 
    195     my $stdout; 
    196     $libs = q{-lalpha}; 
    197     $ccflags = q{-Ibeta}; 
    198     $linkflags = q{-Lgamma}; 
    199     $verbose = 1; 
    200     capture( 
    201         sub { $step->_recheck_settings( 
    202             $conf, $libs, $ccflags, $linkflags, $verbose); }, 
    203         \$stdout, 
    204     ); 
    205     like($conf->data->get('libs'), qr/$libs/, 
    206         "Got expected value for 'libs'"); 
    207     like($conf->data->get('ccflags'), qr/$ccflags/, 
    208         "Got expected value for 'ccflags'"); 
    209     like($conf->data->get('linkflags'), qr/$linkflags/, 
    210         "Got expected value for 'linkflags'"); 
    211     is($step->result, 'no', "Expected result was set"); 
    212     like($stdout, qr/\(no\)/, "Got expected verbose output"); 
    213 } 
    214  
    215168pass("Completed all tests in $0"); 
    216169 
    217170################### DOCUMENTATION ################### 
  • t/steps/auto_gettext-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests =>  34; 
     8use Test::More tests =>  30; 
    99use Carp; 
    1010use lib qw( lib t/configure/testlib ); 
    1111use_ok('config::auto::gettext'); 
     
    4545 
    4646$conf->replenish($serialized); 
    4747 
    48 ########## _add_to_libs() ########## 
     48########## _select_lib() ########## 
    4949 
    5050($args, $step_list_ref) = process_options( { 
    5151    argv => [ ], 
     
    5959$osname = 'mswin32'; 
    6060$cc = 'gcc'; 
    6161$initial_value = $conf->data->get( 'libs' ); 
    62 ok($step->_add_to_libs( { 
     62is($step->_select_lib( { 
    6363    conf            => $conf, 
    6464    osname          => $osname, 
    6565    cc              => $cc, 
     
    6767    win32_nongcc    => 'intl.lib', 
    6868    default         => defined $conf->data->get('glibc') ? '' : '-lintl', 
    6969} ), 
    70     "_add_to_libs() returned true value"); 
    71 like($conf->data->get( 'libs' ), qr/-lintl/, 
    72     "'libs' modified as expected"); 
    73 # Restore value for next test. 
    74 $conf->data->set( 'libs' => $initial_value ); 
     70   '-lintl', 
     71   "_select_lib() returned expected value"); 
    7572 
    7673$osname = 'mswin32'; 
    7774$cc = 'cc'; 
    78 ok($step->_add_to_libs( { 
     75is($step->_select_lib( { 
    7976    conf            => $conf, 
    8077    osname          => $osname, 
    8178    cc              => $cc, 
     
    8380    win32_nongcc    => 'intl.lib', 
    8481    default         => defined $conf->data->get('glibc') ? '' : '-lintl', 
    8582} ), 
    86     "_add_to_libs() returned true value"); 
    87 like($conf->data->get( 'libs' ), qr/intl.lib/, 
    88     "'libs' modified as expected"); 
    89 # Restore value for next test. 
    90 $conf->data->set( 'libs' => $initial_value ); 
     83   'intl.lib', 
     84   "_select_lib() returned expected value"); 
    9185 
    9286$osname = 'foobar'; 
    9387$cc = 'cc'; 
    9488$conf->data->set( glibc => 1 ); 
    95 ok($step->_add_to_libs( { 
     89isnt($step->_select_lib( { 
    9690    conf            => $conf, 
    9791    osname          => $osname, 
    9892    cc              => $cc, 
     
    10094    win32_nongcc    => 'intl.lib', 
    10195    default         => defined $conf->data->get('glibc') ? '' : '-lintl', 
    10296} ), 
    103     "_add_to_libs() returned true value"); 
    104 unlike($conf->data->get( 'libs' ), qr/-lintl/, 
    105     "'libs' modified as expected"); 
    106 # Restore value for next test. 
    107 $conf->data->set( 'libs' => $initial_value ); 
     97   '-lintl', 
     98   "_select_lib() returned expected value"); 
    10899 
    109100$osname = 'foobar'; 
    110101$cc = 'cc'; 
    111102$conf->data->set( glibc => undef ); 
    112 ok($step->_add_to_libs( { 
     103is($step->_select_lib( { 
    113104    conf            => $conf, 
    114105    osname          => $osname, 
    115106    cc              => $cc, 
     
    117108    win32_nongcc    => 'intl.lib', 
    118109    default         => defined $conf->data->get('glibc') ? '' : '-lintl', 
    119110} ), 
    120     "_add_to_libs() returned true value"); 
    121 like($conf->data->get( 'libs' ), qr/-lintl/, 
    122     "'libs' modified as expected"); 
     111   '-lintl', 
     112   "_select_lib() returned expected value"); 
    123113 
    124114########## _evaluate_cc_run() ########## 
    125115 
  • t/steps/auto_gmp-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests =>  73; 
     8use Test::More tests =>  61; 
    99use Carp; 
    1010use Cwd; 
    1111use File::Spec; 
     
    5555 
    5656$conf->replenish($serialized); 
    5757 
    58 ########### _add_to_libs() ########### 
     58########### _select_lib() ########### 
    5959 
    6060($args, $step_list_ref) = process_options( { 
    6161    argv => [ ], 
     
    6868$osname = 'mswin32'; 
    6969$cc = 'gcc'; 
    7070$initial_value = $conf->data->get( 'libs' ); 
    71 ok($step->_add_to_libs( { 
     71is($step->_select_lib( { 
    7272    conf            => $conf, 
    7373    osname          => $osname, 
    7474    cc              => $cc, 
    7575    win32_nongcc    => 'gmp.lib', 
    7676    default         => '-lgmp', 
    7777} ), 
    78     "_add_to_libs() returned true value"); 
    79 like($conf->data->get( 'libs' ), qr/-lgmp/, 
    80     "'libs' modified as expected"); 
    81 # Restore value for next test. 
    82 $conf->data->set( 'libs' => $initial_value ); 
     78   '-lgmp', 
     79   "_select_lib() returned expected value"); 
    8380 
    8481$osname = 'mswin32'; 
    8582$cc = 'cc'; 
    86 ok($step->_add_to_libs( { 
     83is($step->_select_lib( { 
    8784    conf            => $conf, 
    8885    osname          => $osname, 
    8986    cc              => $cc, 
    9087    win32_nongcc    => 'gmp.lib', 
    9188    default         => '-lgmp', 
    9289} ), 
    93     "_add_to_libs() returned true value"); 
    94 like($conf->data->get( 'libs' ), qr/gmp\.lib/, 
    95     "'libs' modified as expected"); 
    96 # Restore value for next test. 
    97 $conf->data->set( 'libs' => $initial_value ); 
     90   'gmp.lib', 
     91   "_select_lib() returned expected value"); 
    9892 
    9993$osname = 'foobar'; 
    10094$cc = undef; 
    101 ok($step->_add_to_libs( { 
     95is($step->_select_lib( { 
    10296    conf            => $conf, 
    10397    osname          => $osname, 
    10498    cc              => $cc, 
    10599    win32_nongcc    => 'gmp.lib', 
    106100    default         => '-lgmp', 
    107101} ), 
    108     "_handle_mswin32() returned true value"); 
    109 like($conf->data->get( 'libs' ), qr/-lgmp/, 
    110     "'libs' modified as expected"); 
    111 # Restore value for next test. 
    112 $conf->data->set( 'libs' => $initial_value ); 
     102   '-lgmp', 
     103   "_select_lib() returned expected value"); 
    113104 
    114105########### _handle_darwin_for_fink() ########### 
    115106 
     
    219210    $step->set_result(undef); 
    220211} 
    221212 
    222 ########### _recheck_settings() ########### 
    223  
    224 my ($libs, $ccflags, $linkflags); 
    225  
    226 $libs = q{-lalpha}; 
    227 $ccflags = q{-Ibeta}; 
    228 $linkflags = q{-Lgamma}; 
    229 $verbose = undef; 
    230 $step->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    231 like($conf->data->get('libs'), qr/$libs/, 
    232     "Got expected value for 'libs'"); 
    233 like($conf->data->get('ccflags'), qr/$ccflags/, 
    234     "Got expected value for 'ccflags'"); 
    235 like($conf->data->get('linkflags'), qr/$linkflags/, 
    236     "Got expected value for 'linkflags'"); 
    237 is($step->result, 'no', "Expected result was set"); 
    238  
    239 { 
    240     my $stdout; 
    241     $libs = q{-lalpha}; 
    242     $ccflags = q{-Ibeta}; 
    243     $linkflags = q{-Lgamma}; 
    244     $verbose = 1; 
    245     capture( 
    246         sub { $step->_recheck_settings( 
    247             $conf, $libs, $ccflags, $linkflags, $verbose); }, 
    248         \$stdout, 
    249     ); 
    250     like($conf->data->get('libs'), qr/$libs/, 
    251         "Got expected value for 'libs'"); 
    252     like($conf->data->get('ccflags'), qr/$ccflags/, 
    253         "Got expected value for 'ccflags'"); 
    254     like($conf->data->get('linkflags'), qr/$linkflags/, 
    255         "Got expected value for 'linkflags'"); 
    256     is($step->result, 'no', "Expected result was set"); 
    257     like($stdout, qr/\(no\)/, "Got expected verbose output"); 
    258 } 
    259  
    260 $conf->replenish($serialized); 
    261  
    262213########### _handle_darwin_for_fink() ########### 
    263214 
    264215($args, $step_list_ref) = process_options( { 
  • t/steps/auto_opengl-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests => 47; 
     8use Test::More tests => 43; 
    99use Carp; 
    1010use lib qw( lib ); 
    1111use_ok('config::init::defaults'); 
     
    4646 
    4747$conf->replenish($serialized); 
    4848 
    49 ########## _add_to_libs() ########## 
     49########## _select_lib() ########## 
    5050 
    5151($args, $step_list_ref) = process_options( 
    5252    { 
     
    6464$initial_libs = $conf->data->get('libs'); 
    6565$osname = 'mswin32'; 
    6666$cc = 'gcc'; 
    67 ok($step->_add_to_libs( { 
     67is($step->_select_lib( { 
    6868    conf            => $conf, 
    6969    osname          => $osname, 
    7070    cc              => $cc, 
     
    7373    darwin          => '-framework OpenGL -framework GLUT', 
    7474    default         => '-lglut -lGLU -lGL', 
    7575} ), 
    76    "_add_to_libs() returned true value"); 
    77 like($conf->data->get('libs'), 
    78     qr/-lglut32 -lglu32 -lopengl32/, 
    79     "'libs' attribute modified as expected"); 
    80 # Restore setting for next test 
    81 $conf->data->set( libs => $initial_libs ); 
     76    '-lglut32 -lglu32 -lopengl32', 
     77   "_select_lib() returned expected value"); 
    8278 
    8379$osname = 'mswin32'; 
    8480$cc = 'cc'; 
    8581$initial_libs = $conf->data->get('libs'); 
    86 ok($step->_add_to_libs( { 
     82is($step->_select_lib( { 
    8783    conf            => $conf, 
    8884    osname          => $osname, 
    8985    cc              => $cc, 
     
    9288    darwin          => '-framework OpenGL -framework GLUT', 
    9389    default         => '-lglut -lGLU -lGL', 
    9490} ), 
    95    "_add_to_libs() returned true value"); 
    96 like($conf->data->get('libs'), 
    97     qr/glut.lib glu.lib gl.lib/, 
    98     "'libs' attribute modified as expected"); 
    99 # Restore setting for next test 
    100 $conf->data->set( libs => $initial_libs ); 
     91   'glut.lib glu.lib gl.lib', 
     92   "_select_lib() returned expected value"); 
    10193 
    10294$osname = 'darwin'; 
    10395$cc = 'cc'; 
    10496$initial_libs = $conf->data->get('libs'); 
    105 ok($step->_add_to_libs( { 
     97is($step->_select_lib( { 
    10698    conf            => $conf, 
    10799    osname          => $osname, 
    108100    cc              => $cc, 
     
    111103    darwin          => '-framework OpenGL -framework GLUT', 
    112104    default         => '-lglut -lGLU -lGL', 
    113105} ), 
    114    "_add_to_libs() returned true value"); 
    115 like($conf->data->get('libs'), 
    116     qr/-framework OpenGL -framework GLUT/, 
    117     "'libs' attribute modified as expected"); 
    118 # Restore setting for next test 
    119 $conf->data->set( libs => $initial_libs ); 
     106   '-framework OpenGL -framework GLUT', 
     107   "_select_lib() returned expected value"); 
    120108 
    121109$osname = 'foobar'; 
    122110$cc = 'cc'; 
    123111$initial_libs = $conf->data->get('libs'); 
    124 ok($step->_add_to_libs( { 
     112is($step->_select_lib( { 
    125113    conf            => $conf, 
    126114    osname          => $osname, 
    127115    cc              => $cc, 
     
    130118    darwin          => '-framework OpenGL -framework GLUT', 
    131119    default         => '-lglut -lGLU -lGL', 
    132120} ), 
    133    "_add_to_libs() returned true value"); 
    134 like($conf->data->get('libs'), 
    135     qr/-lglut -lGLU -lGL/, 
    136     "'libs' attribute modified as expected"); 
    137 # Restore setting for next test 
    138 $conf->data->set( libs => $initial_libs ); 
     121   '-lglut -lGLU -lGL', 
     122   "_select_lib() returned expected value"); 
    139123 
    140124$conf->replenish($serialized); 
    141125 
     
    200184{ 
    201185    my $glut_api_version = '4'; 
    202186    my $glut_brand = 'freeglut'; 
    203     ok(auto::opengl::_handle_glut( $conf, $glut_api_version, $glut_brand ), 
     187    ok(auto::opengl::_handle_glut( $conf, 'lib', $glut_api_version, $glut_brand ), 
    204188        "_handle_glut() returned true value"); 
    205189    is( $conf->data->get( 'opengl' ),  'define', 
    206190        "Got expected value for opengl"); 
  • t/steps/auto_pcre-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests => 44; 
     8use Test::More tests => 34; 
    99use Carp; 
    1010use lib qw( lib ); 
    1111use_ok('config::init::defaults'); 
     
    4646 
    4747$conf->replenish($serialized); 
    4848 
    49 ########## _add_to_libs() ########## 
     49########## _select_lib() ########## 
    5050 
    5151($args, $step_list_ref) = process_options( { 
    5252    argv => [ ], 
     
    6363$osname = 'mswin32'; 
    6464$cc = 'gcc'; 
    6565$initial_value = $conf->data->get( 'libs' ); 
    66 ok($step->_add_to_libs( { 
     66is($step->_select_lib( { 
    6767    conf            => $conf, 
    6868    osname          => $osname, 
    6969    cc              => $cc, 
    7070    win32_nongcc    => 'pcre.lib', 
    7171    default         => '-lpcre', 
    7272} ), 
    73     "_add_to_libs() returned true value"); 
    74 like($conf->data->get( 'libs' ), qr/-lpcre/, 
    75     "'libs' modified as expected"); 
    76 # Restore value for next test. 
    77 $conf->data->set( 'libs' => $initial_value ); 
     73   '-lpcre', 
     74   "_select_lib() returned expected value"); 
    7875 
    7976$osname = 'mswin32'; 
    8077$cc = 'cc'; 
    8178$initial_value = $conf->data->get( 'libs' ); 
    82 ok($step->_add_to_libs( { 
     79is($step->_select_lib( { 
    8380    conf            => $conf, 
    8481    osname          => $osname, 
    8582    cc              => $cc, 
    8683    win32_nongcc    => 'pcre.lib', 
    8784    default         => '-lpcre', 
    8885} ), 
    89     "_add_to_libs() returned true value"); 
    90 like($conf->data->get( 'libs' ), qr/pcre\.lib/, 
    91     "'libs' modified as expected"); 
    92 # Restore value for next test. 
    93 $conf->data->set( 'libs' => $initial_value ); 
     86   'pcre.lib', 
     87   "_select_lib() returned expected value"); 
    9488 
    9589$osname = 'foobar'; 
    9690$cc = 'gcc'; 
    9791$initial_value = $conf->data->get( 'libs' ); 
    98 ok($step->_add_to_libs( { 
     92is($step->_select_lib( { 
    9993    conf            => $conf, 
    10094    osname          => $osname, 
    10195    cc              => $cc, 
    10296    win32_nongcc    => 'pcre.lib', 
    10397    default         => '-lpcre', 
    10498} ), 
    105     "_add_to_libs() returned true value"); 
    106 like($conf->data->get( 'libs' ), qr/-lpcre/, 
    107     "'libs' modified as expected"); 
    108 # Restore value for next test. 
    109 $conf->data->set( 'libs' => $initial_value ); 
     99   '-lpcre', 
     100   "_select_lib() returned expected value"); 
    110101 
    111102########## _evaluate_cc_run() ########## 
    112103 
     
    123114    "_evaluate_cc_run returned true value as expected"); 
    124115is($step->result(), q{yes, 4.1}, "Got expected PCRE version"); 
    125116 
    126 # Mock different outcomes of _recheck_settings() 
    127 my ($libs, $ccflags, $linkflags); 
    128  
    129 $libs = q{-lalpha}; 
    130 $ccflags = q{-Ibeta}; 
    131 $linkflags = q{-Lgamma}; 
    132 $verbose = undef; 
    133 $step->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    134 like($conf->data->get('libs'), qr/$libs/, 
    135     "Got expected value for 'libs'"); 
    136 like($conf->data->get('ccflags'), qr/$ccflags/, 
    137     "Got expected value for 'ccflags'"); 
    138 like($conf->data->get('linkflags'), qr/$linkflags/, 
    139     "Got expected value for 'linkflags'"); 
    140  
    141117$conf->replenish($serialized); 
    142118 
    143119########## --verbose; _evaluate_cc_run() ########## 
     
    168144    like($stdout, qr/\(yes, 4\.0\)/, "Got expected verbose output"); 
    169145} 
    170146 
    171 # Mock different outcomes of _recheck_settings() 
    172 $libs = q{-ldelta}; 
    173 $ccflags = q{-Iepsilon}; 
    174 $linkflags = q{-Lzeta}; 
    175 { 
    176     my ($stdout, $stderr); 
    177     capture( 
    178         sub { $step->_recheck_settings( 
    179             $conf, $libs, $ccflags, $linkflags, $verbose); }, 
    180         \$stdout, 
    181     ); 
    182     like($conf->data->get('libs'), qr/$libs/, 
    183         "Got expected value for 'libs'"); 
    184     like($conf->data->get('ccflags'), qr/$ccflags/, 
    185         "Got expected value for 'ccflags'"); 
    186     like($conf->data->get('linkflags'), qr/$linkflags/, 
    187         "Got expected value for 'linkflags'"); 
    188     like($stdout, qr/\(no\)/, "Got expected verbose output"); 
    189 } 
    190  
    191147pass("Completed all tests in $0"); 
    192148 
    193149################### DOCUMENTATION ################### 
  • t/steps/auto_readline-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests => 72; 
     8use Test::More tests => 69; 
    99use Carp; 
    1010use Cwd; 
    1111use File::Spec; 
     
    2121); 
    2222use IO::CaptureOutput qw | capture |; 
    2323 
    24 ########## _add_to_libs() ########## 
     24########## _select_lib() ########## 
    2525 
    2626my ($args, $step_list_ref) = process_options( 
    2727    { 
     
    4444my ($osname, $cc); 
    4545$osname = 'mswin32'; 
    4646$cc = 'gcc'; 
    47 ok($step->_add_to_libs( { 
     47is($step->_select_lib( { 
    4848    conf            => $conf, 
    4949    osname          => $osname, 
    5050    cc              => $cc, 
    5151    win32_nongcc    => 'readline.lib', 
    5252    default         => '-lreadline', 
    5353} ), 
    54     "_add_to_libs() returned true value"); 
    55 like($conf->data->get( 'libs' ), qr/-lreadline/, 
    56     "'libs' modified as expected"); 
     54   '-lreadline', 
     55   "_select_lib() returned expected value"); 
    5756 
    5857$osname = 'mswin32'; 
    5958$cc = 'cc'; 
    60 ok($step->_add_to_libs( { 
     59is($step->_select_lib( { 
    6160    conf            => $conf, 
    6261    osname          => $osname, 
    6362    cc              => $cc, 
    6463    win32_nongcc    => 'readline.lib', 
    6564    default         => '-lreadline', 
    6665} ), 
    67     "_add_to_libs() returned true value"); 
    68 like($conf->data->get( 'libs' ), qr/readline\.lib/, 
    69     "'libs' modified as expected"); 
     66   'readline.lib', 
     67   "_select_lib() returned expected value"); 
    7068 
    7169$osname = 'foobar'; 
    7270$cc = undef; 
    73 ok($step->_add_to_libs( { 
     71is($step->_select_lib( { 
    7472    conf            => $conf, 
    7573    osname          => $osname, 
    7674    cc              => $cc, 
    7775    win32_nongcc    => 'readline.lib', 
    7876    default         => '-lreadline', 
    7977} ), 
    80     "_add_to_libs() returned true value"); 
    81 like($conf->data->get( 'libs' ), qr/-lreadline/, 
    82     "'libs' modified as expected"); 
     78   '-lreadline', 
     79   "_select_lib() returned true value"); 
    8380 
    8481$osname = 'foobar'; 
    8582$cc = undef; 
    8683eval { 
    87     $step->_add_to_libs( [ 
     84    $step->_select_lib( [ 
    8885        conf            => $conf, 
    8986        osname          => $osname, 
    9087        cc              => $cc, 
     
    9289        default         => '-lreadline', 
    9390    ] ); 
    9491}; 
    95 like($@, qr/_add_to_libs\(\) takes hashref/, 
    96     "Bad argument to _add_to_libs correctly detected"); 
     92like($@, qr/_select_lib\(\) takes hashref/, 
     93    "Bad argument to _select_lib correctly detected"); 
    9794 
    9895########## _handle_darwin_for_fink() ########## 
    9996 
  • t/steps/auto_readline-02.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests =>  31; 
     8use Test::More tests =>  14; 
    99use Carp; 
    1010use Cwd; 
    1111use lib qw( lib ); 
     
    6161########## _handle_readline() ########## 
    6262 
    6363$has_readline = 0; 
    64 ok(auto::readline::_handle_readline($conf, $has_readline), 
     64ok(auto::readline::_handle_readline($conf, 'lib', $has_readline), 
    6565    "_handle_readline() returned true value"); 
    6666is($conf->data->get('readline'), 'define', 
    6767    "Got expected value for 'readline'"); 
    68 is($conf->data->get('HAS_READLINE'), 0, 
    69     "Got expected value for 'HAS_READLINE'"); 
    7068# Prepare for next test 
    7169$conf->data->set( readline => undef ); 
    7270$conf->data->set( HAS_READLINE => undef ); 
    7371 
    7472$has_readline = 1; 
    75 ok(auto::readline::_handle_readline($conf, $has_readline), 
     73ok(auto::readline::_handle_readline($conf, 'lib', $has_readline), 
    7674    "_handle_readline() returned true value"); 
    7775is($conf->data->get('readline'), 'define', 
    7876    "Got expected value for 'readline'"); 
    79 is($conf->data->get('HAS_READLINE'), 1, 
    80     "Got expected value for 'HAS_READLINE'"); 
    8177# Prepare for next test 
    8278$conf->data->set( readline => undef ); 
    8379$conf->data->set( HAS_READLINE => undef ); 
    8480 
    85 ########## _handle_ncurses_need() ########## 
    86  
    87 my ($osname, $cc); 
    88 my ($libs, $newlibs); 
    89  
    90 $libs = q{-lalpha}; 
    91 $osname = q{mswin32}; 
    92 $cc = q{gcc}; 
    93 $conf->data->set( libs => $libs ); 
    94 ok(auto::readline::_handle_ncurses_need($conf, $osname, $cc), 
    95     "_handle_ncurses_need() returned true value"); 
    96 $newlibs = $conf->data->get( 'libs' ); 
    97 like( 
    98     $newlibs, 
    99     qr/\s+-lncurses/, 
    100     "Value expected for $osname, $cc added to 'libs'" 
    101 ); 
    102 $conf->data->set( libs => undef ); 
    103  
    104 $libs = q{-lalpha}; 
    105 $osname = q{mswin32}; 
    106 $cc = q{cc}; 
    107 $conf->data->set( libs => $libs ); 
    108 ok(auto::readline::_handle_ncurses_need($conf, $osname, $cc), 
    109     "_handle_ncurses_need() returned true value"); 
    110 $newlibs = $conf->data->get( 'libs' ); 
    111 like( 
    112     $newlibs, 
    113     qr/\s+ncurses\.lib/, 
    114     "Value expected for $osname, $cc added to 'libs'" 
    115 ); 
    116 $conf->data->set( libs => undef ); 
    117  
    118 $libs = q{-lalpha}; 
    119 $osname = q{linux}; 
    120 $cc = q{gcc}; 
    121 $conf->data->set( libs => $libs ); 
    122 ok(auto::readline::_handle_ncurses_need($conf, $osname, $cc), 
    123     "_handle_ncurses_need() returned true value"); 
    124 $newlibs = $conf->data->get( 'libs' ); 
    125 like( 
    126     $newlibs, 
    127     qr/\s+-lncurses/, 
    128     "Value expected for $osname, $cc added to 'libs'" 
    129 ); 
    130 $conf->data->set( libs => undef ); 
    131  
    132 ########## _recheck_settings() ########## 
    133  
    134 my ($ccflags, $linkflags); 
    135  
    136 $libs = q{-lalpha}; 
    137 $ccflags = q{-Ibeta}; 
    138 $linkflags = q{-Lgamma}; 
    139 $verbose = undef; 
    140 $step->_recheck_settings($conf, $libs, $ccflags, $linkflags, $verbose); 
    141 like($conf->data->get('libs'), qr/$libs/, 
    142     "Got expected value for 'libs'"); 
    143 like($conf->data->get('ccflags'), qr/$ccflags/, 
    144     "Got expected value for 'ccflags'"); 
    145 like($conf->data->get('linkflags'), qr/$linkflags/, 
    146     "Got expected value for 'linkflags'"); 
    147 is($step->result, 'no', "Expected result was set"); 
    148  
    149 { 
    150     my $stdout; 
    151     $libs = q{-lalpha}; 
    152     $ccflags = q{-Ibeta}; 
    153     $linkflags = q{-Lgamma}; 
    154     $verbose = 1; 
    155     capture( 
    156         sub { $step->_recheck_settings( 
    157             $conf, $libs, $ccflags, $linkflags, $verbose); }, 
    158         \$stdout, 
    159     ); 
    160     like($conf->data->get('libs'), qr/$libs/, 
    161         "Got expected value for 'libs'"); 
    162     like($conf->data->get('ccflags'), qr/$ccflags/, 
    163         "Got expected value for 'ccflags'"); 
    164     like($conf->data->get('linkflags'), qr/$linkflags/, 
    165         "Got expected value for 'linkflags'"); 
    166     is($step->result, 'no', "Expected result was set"); 
    167     like($stdout, qr/\(no\)/, "Got expected verbose output"); 
    168 } 
    169  
    17081pass("Completed all tests in $0"); 
    17182 
    17283################### DOCUMENTATION ###################