1 Star 0 Fork 0

souhoiryo / opensips

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ccver.sh 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
Bogdan-Andrei Iancu 提交于 2005-06-13 16:47 . Initial revision
#!/bin/sh
#$Id$
#
# finds CC version and prints it in the following format:
# compiler_name version major_version
#
if [ $# -lt 1 ]
then
echo "Error: you must specify the compiler name" 1>&2
exit 1
fi
if [ "$1" = "-h" ]
then
echo "Usage: "
echo " $0 compiler_name"
exit 1
fi
CC=$1
if which $CC >/dev/null
then
(test ! -x `which $CC`) && echo "Error: $CC not executable" 1>&2 && exit 1
else
echo "Error: $CC not found or not executable" 1>&2
exit 1
fi
if $CC -v 2>/dev/null 1>/dev/null
then
FULLVER=`$CC -v 2>&1`
else
FULLVER=`$CC -V 2>&1`
fi
if [ -n "$FULLVER" ]
then
# check if gcc
if echo "$FULLVER"|grep gcc >/dev/null
then
NAME=gcc
VER=`$CC --version|head -n 1| \
sed -e 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
-e 's/^[^.0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`
elif echo "$FULLVER"|grep Sun >/dev/null
then
NAME=suncc
VER=`echo "$FULLVER"|head -n 1| \
sed -e 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`
elif echo "$FULLVER"|grep "Intel(R) C++ Compiler" >/dev/null
then
NAME=icc
VER=`echo "$FULLVER"|head -n 1| \
sed -e 's/.*Version \([0-9]\.[0-9]\.[0-9]*\).*/\1/' `
fi
# find major ver
if [ -n "$VER" -a -z "$MAJOR_VER" ]
then
MAJOR_VER=`echo "$VER" |cut -d. -f1`
fi
fi
#unknown
if [ -z "$NAME" ]
then
NAME="unknown"
VER="unknown"
MAJOR_VER="unknown"
fi
echo "$NAME $VER $MAJOR_VER"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/maplerain/opensips.git
git@gitee.com:maplerain/opensips.git
maplerain
opensips
opensips
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891