92f2e437515631f6fe7a2adc57b000964fc18030
[charm.git] / src / arch / common / cc-gcc.sh
1 CMK_CPP_CHARM="cpp -P"
2 CMK_CPP_C="gcc$CMK_COMPILER_SUFFIX"
3 CMK_CC="gcc$CMK_COMPILER_SUFFIX"
4 CMK_CXX="g++$CMK_COMPILER_SUFFIX"
5 CMK_LD="gcc$CMK_COMPILER_SUFFIX"
6 CMK_LDXX="g++$CMK_COMPILER_SUFFIX"
7
8 CMK_CPP_C_FLAGS="-E"
9
10 CMK_LD_SHARED='-shared'
11 CMK_LD_LIBRARY_PATH="-Wl,-rpath,$CHARMLIBSO/"
12 CMK_RANLIB='ranlib'
13 CMK_LIBS="$CMK_LIBS -lckqt"
14 CMK_PIC='-fPIC'
15
16 if [ "$CMK_MACOSX" ]; then
17   # find real gcc (not Apple's clang) in $PATH on darwin, works with homebrew/macports
18   candidates=$(which gcc gcc-{4..19} gcc-mp-{4..19} 2>/dev/null)
19   for cand in $candidates; do
20     $cand -v 2>&1 | grep -q clang
21     if [ $? -eq 1 ]; then
22       cppcand=$(echo $cand | sed s,cc,++,)
23       CMK_CPP_C="$cand"
24       CMK_CC="$cand "
25       CMK_LD="$cand "
26       CMK_CXX="$cppcand "
27       CMK_LDXX="$cppcand "
28
29       CMK_CC_FLAGS="-fPIC"
30       CMK_CXX_FLAGS="-fPIC -Wno-deprecated"
31       CMK_LD_FLAGS="-fPIC -Wl,-no_pie "
32       CMK_LDXX_FLAGS="-fPIC -multiply_defined suppress -Wl,-no_pie"
33       found=1
34       break
35     fi
36   done
37   if [ -z "$found" ]; then
38     echo "No suitable non-clang gcc found, exiting"
39     exit 1
40   fi
41 fi
42
43 if [ "$CMK_COMPILER" = "msvc" ]; then
44   CMK_AR='ar q'
45   CMK_LIBS='-lws2_32 -lpsapi -lkernel32'
46   CMK_SEQ_LIBS="$CMK_LIBS"
47
48   CMK_NATIVE_CC="$CMK_CC"
49   CMK_NATIVE_LD="$CMK_LD"
50   CMK_NATIVE_CXX="$CMK_CXX"
51   CMK_NATIVE_LDXX="$CMK_LDXX"
52 fi
53
54 CMK_COMPILER='gcc'