#!/bin/bash
# Force use of clang instead of GCC.
function setup_clang() {
    local GCC_VERSION=$(readlink /usr/bin/gcc | sed 's/^gcc\-//')

    apt-get -y "${APTGETOPT[@]}" install clang

    echo -e "\e[33mReplace gcc, g++ & cpp by clang\e[m"
    for compiler in gcc-"$GCC_VERSION" cpp-"$GCC_VERSION" g++-"$GCC_VERSION"; do
	rm /usr/bin/$compiler &&
	ln -s /usr/bin/clang /usr/bin/$compiler 
    done
    
    echo -e "\e[33mCheck if gcc, g++ & cpp are actually clang\e[m"
    usr/bin/gcc --version| grep clang > /dev/null || exit 1
}

setup_clang
