Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 18766 | Differences between
and this patch

Collapse All | Expand All

(-)gcc-config.old (-11 / +36 lines)
Lines 2-8 Link Here
2
# Copyright 1999-2003 Gentoo Technologies, Inc.
2
# Copyright 1999-2003 Gentoo Technologies, Inc.
3
# Distributed under the terms of the GNU General Public License, v2 or later
3
# Distributed under the terms of the GNU General Public License, v2 or later
4
# Author:  Martin Schlemmer <azarah@gentoo.org>
4
# Author:  Martin Schlemmer <azarah@gentoo.org>
5
# $Header: /home/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.1,v 1.1 2003/01/19 19:14:52 azarah Exp $
5
# $Header: /home/cvsroot/gentoo-x86/sys-devel/gcc-config/files/gcc-config-1.3.1,v 1.2 2003/02/19 23:23:26 azarah Exp $
6
6
7
7
8
source /etc/init.d/functions.sh || {
8
source /etc/init.d/functions.sh || {
Lines 59-79 Link Here
59
	usage
59
	usage
60
fi
60
fi
61
61
62
HAVE_WHICH="no"
63
if [ -n "$(which which 2> /dev/null)" ]
64
then
65
	HAVE_WHICH="yes"
66
fi
67
62
find_path() {
68
find_path() {
63
	[ -z "$1" ] && return 0
69
	[ -z "$1" ] && return 0
64
70
65
	if [ -n "$(which which 2> /dev/null)" -a -x "$(which $1)" ]
71
	if [ "${HAVE_WHICH}" = "yes" ]
66
	then
72
	then
67
		echo "$(which $1)"
73
		local fullpath="$(which $1 2> /dev/null)"
68
		return 0
74
		
75
		if [ -x "${fullpath}" ]
76
		then
77
			echo "${fullpath}"
78
			return 0
79
		fi
69
	fi
80
	fi
70
81
71
	for x in /bin /sbin /usr/bin /usr/sbin
82
	for x in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin
72
	do
83
	do
73
		if [ -x "${x}/$1" -a -r "${x}/$1" ]
84
		if [ -x "${x}/$1" -a -r "${x}/$1" ]
74
		then
85
		then
75
			echo "${x}/$1"
86
			echo "${x}/$1"
76
			break
87
			return 0
77
		fi
88
		fi
78
	done
89
	done
79
90
Lines 98-104 Link Here
98
}
109
}
99
110
100
CC_COMP=""
111
CC_COMP=""
101
REAL_CHOST="$(/usr/bin/python -c 'import portage; print portage.settings["CHOST"];')"
112
113
get_real_chost() {
114
	[ -n "$REAL_CHOST" ] && return 0
115
116
	REAL_CHOST="$(/usr/bin/python -c 'import portage;
117
		print portage.settings["CHOST"]' 2> /dev/null)"
118
119
	if [ -z "${REAL_CHOST}" ]
120
	then
121
		eerror "$0:  Could not get portage CHOST!"
122
		return 1
123
	fi
124
}
102
125
103
switch_profile() {
126
switch_profile() {
104
	local MY_LDPATH=""
127
	local MY_LDPATH=""
Lines 132-137 Link Here
132
	# first in /etc/ld.so.conf, as the logical is that all
155
	# first in /etc/ld.so.conf, as the logical is that all
133
	# compilers for default CHOST will be used to compile stuff,
156
	# compilers for default CHOST will be used to compile stuff,
134
	# and thus we want all their lib paths in /etc/ld.so.conf ...
157
	# and thus we want all their lib paths in /etc/ld.so.conf ...
158
	get_real_chost
135
	GCC_PROFILES="$(${FIND} /etc/env.d/gcc/ -name "${REAL_CHOST}-*")"
159
	GCC_PROFILES="$(${FIND} /etc/env.d/gcc/ -name "${REAL_CHOST}-*")"
136
	GCC_PROFILES="${GCC_PROFILES/\/etc\/env.d\/gcc\/${CC_COMP}}"
160
	GCC_PROFILES="${GCC_PROFILES/\/etc\/env.d\/gcc\/${CC_COMP}}"
137
	GCC_PROFILES="/etc/env.d/gcc/${CC_COMP} ${GCC_PROFILES}"
161
	GCC_PROFILES="/etc/env.d/gcc/${CC_COMP} ${GCC_PROFILES}"
Lines 381-391 Link Here
381
	exit 1
405
	exit 1
382
fi
406
fi
383
407
384
# Chosen CHOST are not the same as the real CHOST according to make.conf,
408
if [ "${CHECK_CHOST}" = "yes" ]
385
# and --use-portage-chost option was given, so do nothing ...
386
if [ "${CHECK_CHOST}" = "yes" -a "${CC_COMP%-*}" != "${REAL_CHOST}" ]
387
then
409
then
388
	exit 0
410
	# Chosen CHOST are not the same as the real CHOST according to
411
	# make.conf, and --use-portage-chost option was given, so do nothing
412
	get_real_chost
413
	[ "${CC_COMP%-*}" != "${REAL_CHOST}" ] && exit 0
389
fi
414
fi
390
415
391
eval ${DOIT}
416
eval ${DOIT}

Return to bug 18766