summaryrefslogtreecommitdiff
path: root/src/print-cc.sh
blob: 2a46533d34aed5c7d371dab1b49d50556efc5144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cc="`head -1 ../conf-cc`"
systype="`cat systype`"

ccqlibs="`head -1 ../conf-qlibs`"
[ -d "$ccqlibs"/include ] && ccqlibs="-I${ccqlibs}/include" \
|| ccqlibs=""

cc -c trycpp.c -malign-double >/dev/null 2>&1 \
&& ccad="-malign-double"

cc -c trycpp.c -march=ultrasparc >/dev/null 2>&1 \
&& ccus="-march=ultrasparc"

cc -c trycpp.c -march=powerpc >/dev/null 2>&1 \
&& ccpp="-march=powerpc"

cc -c trycpp.c -march=21164 >/dev/null 2>&1 \
&& cc21="-march=21164"

cc -c trycpp.c -march=native >/dev/null 2>&1 \
&& ccarm="-march=native"

rm -f trycpp.o

ccssl="`head -1 ../conf-ssl`"
eval cc -c tryssl.c ${ccssl} >/dev/null 2>&1 \
|| ccssl=""

ccbase="cc -fomit-frame-pointer -Wall"

case "$cc:$systype" in
  auto:*:i386-*:*)
    cc="$ccbase -O1 $ccad"
    ;;
  auto:*:amd64-*:*)
    cc="$ccbase -O2 $ccad"
    ;;
  auto:*:x86_64-*:*)
    cc="$ccbase -O2 $ccad"
    ;;
  auto:*:sparc-*:*:*:*)
    cc="$ccbase -O1 $ccus"
    ;;
  auto:*:ppc-*:*:*:*)
    cc="$ccbase -O2 $ccpp"
    ;;
  auto:*:alpha-*:*:*:*)
    cc="$ccbase -O2 $cc21"
    ;;
  auto:aix-*:-:-:*:-)
    cc="$ccbase -O2 $ccpp"
    ;;
  auto:*:armv7l-:*)
    cc="$ccbase -O2 $ccarm"
    ;;
  auto:*)
    cc="$ccbase -O2"
    ;;
esac

cat warn-auto.sh
echo exec "$cc" ${ccqlibs} ${ccssl} '-c ${1+"$@"}'