#!/bin/sh
# functions - install modules
# @function install jemalloc
function InstallJemalloc()
{
    ShowResult "[green]正在安装Nginx服务器... [/green]" 1
    
    cd ${_PATH_COMPILATION_}
    # prepare
    eval rm -rf ./jemalloc-4.* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval tar jxvf ${_PATH_SOFTWARE_}/jemalloc-4.* ${_SYS_SHOW_INSTALL_DETAILS_}
    # install
    eval cd jemalloc-4.* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval ./configure --prefix=/usr/local/jemalloc --libdir=/usr/local/lib ${_SYS_SHOW_INSTALL_DETAILS_}
    eval make ${_SYS_MAKE_EXT_} ${_SYS_SHOW_INSTALL_DETAILS_}
    eval make install ${_SYS_SHOW_INSTALL_DETAILS_}
    ShowStatus $? 1
    
    if [ ! -f /etc/ld.so.conf.d/usr_local_lib.conf ] || [ $(grep -c "/usr/local/lib" /etc/ld.so.conf.d/usr_local_lib.conf) -eq 0 ]; then
        echo "/usr/local/lib" >> /etc/ld.so.conf.d/usr_local_lib.conf
    fi
    ldconfig
    
    ShowStatus 0
}