Commit f4315eff authored by Axel Auweter's avatar Axel Auweter
Browse files

Add a check script to test how to compile c++11 code.

parent 783ee350
#!/bin/bash
function test_flags {
CXX=$1
shift 1
FLAGS+=$*
cat << EOF | $CXX -c $FLAGS -x c++ - -o /dev/null
#include <system_error>
int main() {return 0;}
EOF
}
if [ "$#" -lt "1" ]; then
echo "Usage: $0 <C++_compiler_name> [additional compiler flags]"
exit 0
fi
# Test c++ 11 flags for g++...
FLAGS="--std=c++11 "
test_flags $@
if [ "$?" -eq "0" ]; then
echo $FLAGS
exit 0
fi
# Test c++ 11 flags for llvm clang
FLAGS="-std=c++11 -stdlib=libc++ "
if [ "$?" -eq "0" ]; then
echo $FLAGS
exit 0
fi
# No idea how to get c++11 code compiled on this machine -> return error!
exit 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment