3 # Copyright (c) 2009-2012
4 # The DragonFly Project. All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in
14 # the documentation and/or other materials provided with the
16 # 3. Neither the name of The DragonFly Project nor the names of its
17 # contributors may be used to endorse or promote products derived
18 # from this software without specific, prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 # COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 # INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 # XXX clang needs some special handling
39 # it is called only for "cc" and "gcc" and even then it could have been
42 if [ "${CCVER}" = "clang" ]; then
43 if [ "${CNAME}" = "cpp" ]; then
44 exec ${CDIR}/../gcc41/cpp "$@"
45 elif [ "${CNAME}" = "c++" -o "${CNAME}" = "g++" ]; then
46 exec ${CDIR}/../gcc41/c++ "$@"
47 elif [ -z $beenhere ]; then
51 INCOPT="-nobuiltininc -nostdinc \
52 -isysroot @@INCPREFIX@@ \
53 -isystem /usr/include \
54 -isystem /usr/libdata/gcc41 \
55 -isystem /usr/include/c++/4.1"
56 elif [ "${CNAME}" = "cc" -o "${CNAME}" = "gcc" ]; then
57 exec ${CDIR}/../gcc41/cc $oldargs
59 elif [ "${CCVER}" = "clangsvn" ]; then
60 if [ "${CNAME}" = "cpp" ]; then
61 exec ${CDIR}/../gcc41/cpp "$@"
63 INCOPT="-nobuiltininc -nostdinc \
64 -isysroot @@INCPREFIX@@ \
65 -isystem /usr/include \
66 -isystem /usr/include/c++/4.4"
68 elif [ "${CCVER}" = "gcc46" ]; then
69 GCC46VER=`gnatc++ -dumpversion`
70 GCC46MAC=`gnatc++ -dumpmachine`
72 -iprefix @@INCPREFIX@@ \
73 -iwithprefixbefore /usr/include \
74 -isystem /usr/pkg/include/c++/${GCC46VER} \
75 -isystem /usr/pkg/include/c++/${GCC46VER}/${GCC46MAC}"
78 . /etc/defaults/compilers.conf
79 [ -f /etc/compilers.conf ] && . /etc/compilers.conf
81 CUSTOM_CC=`eval echo \$\{${CCVER}_CC\}`
82 CUSTOM_CFLAGS=`eval echo \$\{${CCVER}_CFLAGS\}`
83 CUSTOM_CXX=`eval echo \$\{${CCVER}_CXX\}`
84 CUSTOM_CXXFLAGS=`eval echo \$\{${CCVER}_CXXFLAGS\}`
85 CUSTOM_CPP=`eval echo \$\{${CCVER}_CPP\}`
86 CUSTOM_CPPFLAGS=`eval echo \$\{${CCVER}_CPPFLAGS\}`
87 CUSTOM_VERSION=`eval echo \$\{${CCVER}_VERSION\}`
89 if [ "${CUSTOM_VERSION}" != "" -a "$1" = "-dumpversion" ]; then
90 echo ${CUSTOM_VERSION}
91 elif [ "${CNAME}" = "cc" -o "${CNAME}" = "gcc" ]; then
92 exec ${CUSTOM_CC} ${INCOPT} ${CUSTOM_CFLAGS} "$@"
93 elif [ "${CNAME}" = "c++" -o "${CNAME}" = "g++" ]; then
94 exec ${CUSTOM_CXX} ${INCOPT} ${CUSTOM_CXXFLAGS} "$@"
95 elif [ "${CNAME}" = "cpp" ]; then
96 exec ${CUSTOM_CPP} ${INCOPT} ${CUSTOM_CPPFLAGS} "$@"