permission mods
[feisty_meow.git] / scripts / clam / cpp / get_version.sh
1 #!/bin/bash
2 COMPILER=$1
3 COMPILER_ROOT_DIR=$2
4 if [ "$COMPILER" = "GNU_LINUX" \
5     -o "$COMPILER" = "GNU_DARWIN" ]; then
6   # compiler version report for the gnu compiler on linux and darwin.
7
8   # older code is needed for some versions of gcc / suse.
9   ver_found=$(gcc -### 2>&1 | grep "gcc version" | sed -e 's/^gcc version \([0-9.][0-9.]*\) .*$/\1/')
10
11 #  if [ ! -d "/usr/include/c++/$ver_found" ]; then
12 #      -a ! -d "/usr/include/c++/$ver_found" ]; then
13
14 #    # newest code takes only first two version numbers, since that's how
15 #    # suse 11.0 at least is listing the includes.
16 #    ver_found=$(gcc -### 2>&1 | grep "gcc version" | sed -e 's/^gcc version \([0-9.][0-9.]*\) .*$/\1/' | sed -e 's/\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1.\2/')
17
18 #  fi
19
20   echo "$ver_found"
21
22 elif [ "$COMPILER" = "GNU_ARM_LINUX" ]; then
23   # compiler version report for the gnu compiler on the arm processor.
24   gcc -### 2>&1 | grep "gcc version" | sed -e 's/^gcc version \([0-9.][0-9.]*\) .*$/\1/' 
25 elif [ "$COMPILER" = "VISUAL_CPP" ]; then
26   # compiler version report for ms visual studio.
27   ver_raw=`$COMPILER_ROOT_DIR/bin/cl 2>&1 | head -1 | sed -e 's/.*Version \([0-9][0-9]*\)\..*$/\1/'`
28   if [ "$ver_raw" = "12" ]; then echo 6;
29   elif [ "$ver_raw" = "13" ]; then echo 7;
30   elif [ "$ver_raw" = "14" ]; then echo 8;
31   elif [ "$ver_raw" = "15" ]; then echo 9;
32   elif [ "$ver_raw" = "16" ]; then echo 10;
33   fi
34 else
35   echo "0"
36 fi