package Cpanel::Easy::PHP5::XmlRPC;

# cpanel - Cpanel/Easy/PHP5/XmlRPC.pm             Copyright(c) 2011 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

our $easyconfig = {
    'name'      => 'XmlRPC',
    'ensurepkg' => [ 'expat', 'expat-devel' ],
    'url'       => 'http://www.php.net/manual/en/ref.xmlrpc.php',
    'dryrun'    => {
        '0' => {
            'name'    => 'Find expat path for PHP 5 XmlRPC',
            'command' => sub {
                my ($self) = @_;
                my @expat;
                for my $pth (qw(/usr /usr/local)) {
                    next if !-d $pth;
                    if ( -e "$pth/lib/libexpat.so" || -e "$pth/lib64/libexpat.so" ) {
                        push @expat, '--with-libexpat-dir', $pth;
                        last;
                    }
                }
                if ( @expat != 2 ) {
                    return ( 0, 'Could not find [_1] path', 'expat' );
                }
                else {
                    $self->{'__'}{'Expat'} = \@expat;

                    return ( 1, 'Ok' );
                }
            },
        },
    },
    'step' => {
        '0' => {
            'name'    => 'to config options',
            'command' => sub {
                my ($self) = @_;
                $self->add_to_configure( { '--with-xmlrpc' => '', @{ $self->{'__'}{'Expat'} } } );
                return ( 1, 'Ok' );
            },
        },
    },
};

1;
