Gentoo Archives: gentoo-dev

From: Philipp Hasse <dream-weaver@×××.net>
To: gentoo-user@l.g.o, gentoo-dev@l.g.o
Subject: [gentoo-dev] Automatically replace -mtune= with -mcpu= if not supported by gcc?!
Date: Sun, 17 Apr 2005 13:50:39
Message-Id: 426269B4.6080503@gmx.net
1 Hi,
2
3 I recently noticed that portage executes the file bashrc located in
4 /etc/portage before every ebuild.
5 This way it can be used to set the -mcpu and -mtune flags correctly.
6 If you add the following to this file everything goes automatically:
7
8 <--- SNIP --->
9 # Automatically replace -mtune= with -mcpu if not supported by gcc
10 # and vice versa.
11 echo "" | gcc -mtune=i386 -E - > /dev/null 2> /dev/null
12 if [ $? == 0 ]; then
13 export CFLAGS=`echo $CFLAGS | /bin/sed 's/-mcpu=/-mtune=/'`
14 export CXXFLAGS=`echo $CXXFLAGS | /bin/sed 's/-mcpu=/-mtune=/'`
15 else
16 export CFLAGS=`echo $CFLAGS | /bin/sed 's/-mtune=/-mcpu=/'`
17 export CXXFLAGS=`echo $CXXFLAGS | /bin/sed 's/-mtune=/-mcpu=/'`
18 fi
19 <--- SNIP --->
20
21 Maybe someone can give me a feedback if this is good idea or if I missed
22 something for some exotic situation this will fail.
23
24 Why doesn't portage do this automatically by itself? If it encounters an
25 -mtune´= option in make.conf and gcc doesn't support it it replaces it
26 with -mcpu=?!
27
28 Regards
29 Philipp Hasse
30
31 --
32 gentoo-dev@g.o mailing list

Replies