package Cpanel::Easy::PHP5::MysqlOfSystem;

# cpanel - Cpanel/Easy/PHP5/MysqlOfSystem.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'   => "Mysql of the system",
    'note'   => 'compile mysql (and mysqli if its checked) support against the system libraries',
    'url'    => 'http://www.php.net/manual/en/ref.mysql.php',
    'dryrun' => {
        '0' => {
            'name'    => 'mysql compilation test',
            'command' => sub {
                my ($self) = @_;
                return $self->do_mysql_h_test_compile();
            },
        },
    },
    'step' => {
        '0' => {
            'name'    => 'to config options',
            'command' => sub {
                my ($self) = @_;

                # boolean for behavior of Mysql and Mysqli opt mods
                my ( $prefix, $config, $socket, $version ) = $self->get_system_mysql_info();
                if ($prefix) {
                    $self->add_to_configure( { '--with-mysql' => $prefix } );
                    $self->add_to_configure( { '--with-mysql-sock' => $socket } ) if $socket;
                    if ( $version =~ '5.7' ) {
                        $self->add_to_configure( { 'LIBS' => '-L/usr/lib64/mysql' } );
                    }
                }
                else {
                    return ( 0, q{Could not find '[_]'}, 'mysql prefix' );
                }

                return ( 1, 'Ok' );
            },
        },
    },
};

1;
