]>
git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/scripts/detect_cc.sh
12 err
"Detect compiler and linker versions, generate mk/cc.mk"
14 err
"Usage: ./detect_cc.sh [OPTION]..."
16 err
"Defaults for the options are specified in brackets."
19 err
" -h, --help Display this help and exit"
20 err
" --cc=path C compiler to use"
21 err
" --cxx=path C++ compiler to use"
22 err
" --ld=path Linker to use"
23 err
" --lto=[y|n] Attempt to configure for LTO"
35 if [[ -n "${i#*=}" ]]; then
40 if [[ -n "${i#*=}" ]]; then
45 if [[ -n "${i#*=}" ]]; then
50 if [[ -n "${i#*=}" ]]; then
58 err
"Unrecognized option $i"
69 CC_TYPE
=$
($CC -v 2>&1 |
grep -o -E '\w+ version' |
head -1 |
awk '{ print $1 }')
70 CXX_TYPE
=$
($CXX -v 2>&1 |
grep -o -E '\w+ version' |
head -1 |
awk '{ print $1 }')
71 if [ "$CC_TYPE" != "$CXX_TYPE" ]; then
72 err
"C compiler is $CC_TYPE but C++ compiler is $CXX_TYPE"
73 err
"This may result in errors"
76 LD_TYPE
=$
($LD --version 2>&1 |
head -n1 |
awk '{print $1, $2}')
88 err
"Unsupported linker: $LD"
93 if [ "$LTO" = "y" ]; then
94 if [ "$CC_TYPE" = "clang" ]; then
95 if [ "$LD_TYPE" != "gold" ]; then
96 err
"Using LTO with clang requires the gold linker."
105 function set_default
() {
106 echo "ifeq (\$(origin $1),default)"
117 echo "CC_TYPE=$CC_TYPE"
118 echo "LD_TYPE=$LD_TYPE"