#!/bin/sh
# @function install libmemcached
function InstallLibMemcached()
{
    ShowResult "[green]正在安装LibMemcached库... [/green]" 1
    
    # install libmemcached
    eval cd ${_PATH_COMPILATION_} ${_SYS_SHOW_INSTALL_DETAILS_}
    eval rm -rf ./libmemcached* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval tar zxvf ${_PATH_SOFTWARE_}/libmemcached* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval cd libmemcached* ${_SYS_SHOW_INSTALL_DETAILS_}
    
    # configure
    if [ ${_SYS_BIT_} -eq 64 ]; then # x64
        eval ./configure --with-memcached --prefix=/usr/local/libmemcached ${_SYS_SHOW_INSTALL_DETAILS_}
    else # i686
        eval ./configure --with-memcached --prefix=/usr/local/libmemcached --disable-64bit \
            CFLAGS="-O3 -march=i686" ${_SYS_SHOW_INSTALL_DETAILS_}
    fi
    
    # make
    eval make ${_SYS_MAKE_EXT_} ${_SYS_SHOW_INSTALL_DETAILS_}
    eval make install ${_SYS_SHOW_INSTALL_DETAILS_}
    
    ShowStatus $?
}