/[gentoo-x86]/eclass/gcc.eclass
Gentoo

Contents of /eclass/gcc.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations) (download)
Wed Jun 25 19:52:53 2003 UTC (17 years ago) by vapier
Branch: MAIN
Branch point for: RELEASE-1_4
Changes since 1.13: +12 -30 lines
visual touchups

1 # Copyright 1999-2003 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/gcc.eclass,v 1.13 2003/06/25 19:22:00 vapier Exp $
4 #
5 # Author: Martin Schlemmer <azarah@gentoo.org>
6 #
7 # This eclass contains (or should) functions to get common info about gcc
8
9 ECLASS=gcc
10 INHERITED="$INHERITED $ECLASS"
11
12 DEPEND="${DEPEND} sys-devel/gcc"
13
14 DESCRIPTION="Based on the ${ECLASS} eclass"
15
16 # NOTE: To force gcc3 if multi ver install, do: export WANT_GCC_3="yes"
17 [ -z "${WANT_GCC_3}" ] && export WANT_GCC_3="no"
18
19 # Returns the name of the C compiler binary
20 gcc-getCC() {
21 if [ "${WANT_GCC_3}" = "yes" -o -z "${CC}" ] ; then
22 local CC="gcc"
23
24 if [ "$(${CC} -dumpversion | cut -f1 -d.)" -ne 3 ] && \
25 [ "${WANT_GCC_3}" = "yes" ]
26 then
27 # We use the dual/multiple install of gcc-3.x if the user
28 # have 2.95.3 as base
29 if [ -x /usr/bin/gcc-3.2 ] ; then
30 CC="gcc-3.2"
31 elif [ -x /usr/bin/gcc-3.1 ] ; then
32 CC="gcc-3.1"
33 elif [ -x /usr/bin/gcc-3.0 ] ; then
34 CC="gcc-3.0"
35 fi
36 fi
37 fi
38
39 echo "${CC}"
40 }
41
42 # Returns the name of the C++ compiler binary
43 gcc-getCXX() {
44 if [ "${WANT_GCC_3}" = "yes" -o -z "${CXX}" ] ; then
45 local CC="$(gcc-getCC)"
46
47 if [ "$(${CC} -dumpversion | cut -f1 -d.)" -ge 3 ] ; then
48 echo "${CC/gcc/g++}"
49 else
50 echo "${CC}"
51 fi
52 else
53 echo "${CXX}"
54 fi
55 }
56
57 # Returns the version as by `$CC -dumpversion`
58 gcc-fullversion() {
59 echo "$($(gcc-getCC) -dumpversion)"
60 }
61
62 # Returns the version, but only the <major>.<minor>
63 gcc-version() {
64 echo "$(gcc-fullversion | cut -f1,2 -d.)"
65 }
66
67 # Returns the Major version
68 gcc-major-version() {
69 echo "$(gcc-version | cut -f1 -d.)"
70 }
71
72 # Returns the Minor version
73 gcc-minor-version() {
74 echo "$(gcc-version | cut -f2 -d.)"
75 }
76
77 # Returns the Micro version
78 gcc-micro-version() {
79 echo "$(gcc-fullversion | cut -f3 -d.)"
80 }
81
82 # Returns gcc's internal library path
83 gcc-libpath() {
84 echo "/usr/lib/gcc-lib/$($(gcc-getCC) -dumpmachine)/$(gcc-fullversion)"
85 }
86
87 # Returns the full version of libstdc++.so
88 gcc-libstdcxx-version() {
89 if [ "$(gcc-major-version)" -ge 3 ] ; then
90 local libstdcxx="$(ls $(gcc-libpath)/libstdc++.so.?.?.?)"
91
92 libstdcxx="${libstdcxx##*/}"
93 echo "${libstdcxx/libstdc++.so.}"
94 else
95 echo
96 fi
97 }
98
99 # Returns the Major version of libstdc++.so
100 gcc-libstdcxx-major-version() {
101 echo "$(echo $(gcc-libstdcxx-version) | cut -f1 -d.)"
102 }
103
104 # This is thanks to great work from Paul de Vrieze <gentoo-user@devrieze.net>,
105 # bug #9016. Also thanks to Jukka Salmi <salmi@gmx.net> (bug #13907) for more
106 # fixes.
107 #
108 # Export CFLAGS and CXXFLAGS that are compadible with gcc-2.95.3
109 gcc2-flags() {
110 CFLAGS=${CFLAGS//pentium-mmx/i586}
111 CFLAGS=${CFLAGS//pentium[234]/i686}
112 CFLAGS=${CFLAGS//k6-[23]/k6}
113 CFLAGS=${CFLAGS//athlon-tbird/i686}
114 CFLAGS=${CFLAGS//athlon-4/i686}
115 CFLAGS=${CFLAGS//athlon-[xm]p/i686}
116 CFLAGS=${CFLAGS//athlon/i686}
117
118 CXXFLAGS=${CXXFLAGS//pentium-mmx/i586}
119 CXXFLAGS=${CXXFLAGS//pentium[234]/i686}
120 CXXFLAGS=${CXXFLAGS//k6-[23]/k6}
121 CXXFLAGS=${CXXFLAGS//athlon-tbird/i686}
122 CXXFLAGS=${CXXFLAGS//athlon-4/i686}
123 CXXFLAGS=${CXXFLAGS//athlon-[xm]p/i686}
124 CXXFLAGS=${CXXFLAGS//athlon/i686}
125
126 export CFLAGS CXXFLAGS
127 }

  ViewVC Help
Powered by ViewVC 1.1.20