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 "\033[031mYour system have not installed libssl-dev ,command below will be run: \033[0m" echo "sudo apt-get install -y libssl-dev" sudo apt-get install -y libssl-dev if [ $? -ne 0 ]; then echo -e "\033[031mError: Cannot install libssl-dev \033[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 "\033[031mYour system have not installed libssl-dev ,command below will be run: \033[0m"
echo "sudo apt-get install -y libssl-dev"
sudo apt-get install -y libssl-dev
if [ $? -ne 0 ]; then
echo -e "\033[031mError: Cannot install libssl-dev \033[0m"
exit 1
fi
fi
检测libssl-dev安装并编译 OpenSSL 示例
本文提供了一个简单的C程序示例,用于检测系统是否已安装libssl-dev。如果未安装,则通过shell脚本自动进行安装。此脚本适用于使用OpenSSL的开发者,确保其开发环境正确配置。
2898

被折叠的 条评论
为什么被折叠?



