33 lines
821 B
Bash
33 lines
821 B
Bash
|
|
#!/bin/bash
|
||
|
|
# 编译libmodbus/mbpoll的核心依赖列表
|
||
|
|
deps=(
|
||
|
|
"gcc:GNU C编译器"
|
||
|
|
"g++:GNU C++编译器"
|
||
|
|
"make:编译构建工具"
|
||
|
|
"autoconf:配置脚本生成工具"
|
||
|
|
"automake:Makefile生成工具"
|
||
|
|
"libtool:库管理工具"
|
||
|
|
"pkg-config:库依赖检测工具"
|
||
|
|
"cmake:mbpoll编译工具"
|
||
|
|
"git:源码克隆工具"
|
||
|
|
)
|
||
|
|
|
||
|
|
# 检测函数
|
||
|
|
check_dep() {
|
||
|
|
local dep_name=$1
|
||
|
|
local dep_desc=$2
|
||
|
|
if command -v $dep_name &> /dev/null; then
|
||
|
|
echo -e "✅ $dep_desc ($dep_name): 已安装"
|
||
|
|
else
|
||
|
|
echo -e "❌ $dep_desc ($dep_name): 缺失"
|
||
|
|
fi
|
||
|
|
}
|
||
|
|
|
||
|
|
# 遍历检测所有依赖
|
||
|
|
echo "===== 编译依赖检测结果 ====="
|
||
|
|
for dep in "${deps[@]}"; do
|
||
|
|
dep_name=$(echo $dep | cut -d: -f1)
|
||
|
|
dep_desc=$(echo $dep | cut -d: -f2)
|
||
|
|
check_dep $dep_name "$dep_desc"
|
||
|
|
done
|