Check gcc and its version
时间:2009-08-13 来源:creatory
#!/bin/bash
#
#this script is used to check gcc on your os
#it will be called by another script and action according to its return value
#
printf "Beging to check gcc...\n"
case $CC in
*gcc*)
;;
*)
printf "Not found.\n"
exit 0
;;
esac
if ( $CC -dumpversion > /dev/null 2>&1 );then
GCC_VERSION=`$CC -dumpversion`
elif( $CC --version > /dev/null 2>&1 );then
GCC_VERSION=`$CC --version`
else
GCC_VERSION=unknown
fi
printf "${GCC_VERSION}\n"
case $GCC_VERSION in
unknown|2.*)
printf "$GCC version too old.\n"
printf "To perform the compilation,we need gcc>=3.x.x!\n"
printf "Or you can run \"make NO_GCC_CHECK=1\" to ignore it.\n"
exit 1
;;
*)
printf "OK(`basename $CC` version:$GCC_VERSION)\n"
exit 0;
;;
esac
#
#this script is used to check gcc on your os
#it will be called by another script and action according to its return value
#
printf "Beging to check gcc...\n"
case $CC in
*gcc*)
;;
*)
printf "Not found.\n"
exit 0
;;
esac
if ( $CC -dumpversion > /dev/null 2>&1 );then
GCC_VERSION=`$CC -dumpversion`
elif( $CC --version > /dev/null 2>&1 );then
GCC_VERSION=`$CC --version`
else
GCC_VERSION=unknown
fi
printf "${GCC_VERSION}\n"
case $GCC_VERSION in
unknown|2.*)
printf "$GCC version too old.\n"
printf "To perform the compilation,we need gcc>=3.x.x!\n"
printf "Or you can run \"make NO_GCC_CHECK=1\" to ignore it.\n"
exit 1
;;
*)
printf "OK(`basename $CC` version:$GCC_VERSION)\n"
exit 0;
;;
esac
相关阅读 更多 +