zoukankan      html  css  js  c++  java
  • configure文件中判断某函数或库是否存在的一个方法

        echo "
        #include<stdio.h>
        #include<openssl/ssl.h>
        int main()
        {
            return 0;
        }
        " > openssltest.c
    
        gcc -o  openssltest openssltest.c
        if [ $? -eq 0 ]; then
            rm openssltest*
        else
            rm openssltest*
            echo -e "33[031mYour system have not installed libssl-dev ,command below will be run: 33[0m"
            echo "sudo apt-get install -y libssl-dev"
            sudo apt-get install -y libssl-dev
            if [ $? -ne 0 ]; then
                echo -e "33[031mError: Cannot install libssl-dev 33[0m"
                exit 1
            fi
        fi

        echo "
        #include<stdio.h>
        #include<openssl/ssl.h>
        int main()
        {
            return 0;
        }
        " > openssltest.c

        gcc -o  openssltest openssltest.c
        if [ $? -eq 0 ]; then
            rm openssltest*
        else
            rm openssltest*
            echo -e "33[031mYour system have not installed libssl-dev ,command below will be run: 33[0m"
            echo "sudo apt-get install -y libssl-dev"
            sudo apt-get install -y libssl-dev
            if [ $? -ne 0 ]; then
                echo -e "33[031mError: Cannot install libssl-dev 33[0m"
                exit 1
            fi
        fi

  • 相关阅读:
    python list dict 去重的两种方式
    python 发送邮件
    mongo 查询总结
    vsftpd 安装配置
    简单配置 nginx 反向代理
    python 检查内存
    python ldap
    Centos 7 vsftpd ldap 配置
    centos7虚拟机开启端口后 外部不能访问的问题
    Linux下安装配置rocketmq (单个Master、双Master)
  • 原文地址:https://www.cnblogs.com/jingzhishen/p/4070446.html
Copyright © 2011-2022 走看看