CCVER: Add /usr/pkgsrc/lang/gcc-aux as 'gcc47'
[dragonfly.git] / libexec / customcc / cc.sh
CommitLineData
c97b9141
SW
1#!/bin/sh
2
3CDIR=$(dirname $0)
4CNAME=$(basename $0)
5
1c4f2fa4
SW
6# XXX clang needs some special handling
7#
8# it is called only for "cc" and "gcc" and even then it could have been
9# run on c++ files
c97b9141
SW
10#
11if [ "${CCVER}" = "clang" ]; then
12 if [ "${CNAME}" = "cpp" ]; then
13 exec ${CDIR}/../gcc41/cpp "$@"
14 elif [ "${CNAME}" = "c++" -o "${CNAME}" = "g++" ]; then
15 exec ${CDIR}/../gcc41/c++ "$@"
1c4f2fa4
SW
16 elif [ -z $beenhere ]; then
17 export beenhere=1
18 oldargs="$@"
19 export oldargs
61909597
SW
20 INCOPT="-nobuiltininc -nostdinc \
21 -isysroot @@INCPREFIX@@ \
22 -isystem /usr/include \
23 -isystem /usr/libdata/gcc41 \
24 -isystem /usr/include/c++/4.1"
1c4f2fa4
SW
25 elif [ "${CNAME}" = "cc" -o "${CNAME}" = "gcc" ]; then
26 exec ${CDIR}/../gcc41/cc $oldargs
c97b9141 27 fi
b262ad55
SW
28elif [ "${CCVER}" = "clangsvn" ]; then
29 if [ "${CNAME}" = "cpp" ]; then
30 exec ${CDIR}/../gcc41/cpp "$@"
31 else
32 INCOPT="-nobuiltininc -nostdinc \
33 -isysroot @@INCPREFIX@@ \
34 -isystem /usr/include \
30be8470 35 -isystem /usr/include/c++/4.4"
b262ad55 36 fi
127a3eb4 37elif [ "${CCVER}" = "gcc46" ]; then
9dce22ab
JM
38 GCC46VER=`gnatc++ -dumpversion`
39 GCC46MAC=`gnatc++ -dumpmachine`
127a3eb4
SW
40 INCOPT="-nostdinc \
41 -isysroot @@INCPREFIX@@ \
99c914f0 42 -isystem /usr/include \
9dce22ab
JM
43 -isystem /usr/pkg/include/c++/${GCC46VER} \
44 -isystem /usr/pkg/include/c++/${GCC46VER}/${GCC46MAC}"
b0eef83f
JM
45elif [ "${CCVER}" = "gcc47" ]; then
46 GCC47VER=`/usr/pkg/gcc-aux/bin/c++ -dumpversion`
47 GCC47MAC=`/usr/pkg/gcc-aux/bin/c++ -dumpmachine`
48 INCOPT="-nostdinc \
49 -isysroot @@INCPREFIX@@ \
50 -isystem /usr/include \
51 -isystem /usr/pkg/gcc-aux/include/c++/${GCC47VER} \
52 -isystem /usr/pkg/gcc-aux/include/c++/${GCC47VER}/${GCC47MAC}"
c97b9141
SW
53fi
54
55. /etc/defaults/compilers.conf
56[ -f /etc/compilers.conf ] && . /etc/compilers.conf
57
58CUSTOM_CC=`eval echo \$\{${CCVER}_CC\}`
59CUSTOM_CFLAGS=`eval echo \$\{${CCVER}_CFLAGS\}`
60CUSTOM_CXX=`eval echo \$\{${CCVER}_CXX\}`
61CUSTOM_CXXFLAGS=`eval echo \$\{${CCVER}_CXXFLAGS\}`
62CUSTOM_CPP=`eval echo \$\{${CCVER}_CPP\}`
63CUSTOM_CPPFLAGS=`eval echo \$\{${CCVER}_CPPFLAGS\}`
64CUSTOM_VERSION=`eval echo \$\{${CCVER}_VERSION\}`
65
66if [ "${CUSTOM_VERSION}" != "" -a "$1" = "-dumpversion" ]; then
67 echo ${CUSTOM_VERSION}
68elif [ "${CNAME}" = "cc" -o "${CNAME}" = "gcc" ]; then
69 exec ${CUSTOM_CC} ${INCOPT} ${CUSTOM_CFLAGS} "$@"
70elif [ "${CNAME}" = "c++" -o "${CNAME}" = "g++" ]; then
71 exec ${CUSTOM_CXX} ${INCOPT} ${CUSTOM_CXXFLAGS} "$@"
72elif [ "${CNAME}" = "cpp" ]; then
73 exec ${CUSTOM_CPP} ${INCOPT} ${CUSTOM_CPPFLAGS} "$@"
c97b9141 74fi