| 1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| ... | ... | |
| 13 |
13 |
|
| 14 |
14 |
LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
|
| 15 |
15 |
SLOT="0"
|
| 16 |
|
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~x64-macos ~x64-solaris"
|
|
16 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos ~x64-solaris"
|
| 17 |
17 |
IUSE="debug"
|
| 18 |
18 |
|
| 19 |
19 |
MULTILIB_CHOST_TOOLS=(
|
| ... | ... | |
| 96 |
96 |
# that trigger some code conditional to platform & arch. This really
|
| 97 |
97 |
# matters for the few common arches (x86, ppc) but we pass a little
|
| 98 |
98 |
# more of them to be future-proof.
|
| 99 |
|
|
| 100 |
|
# use ABI first, this will work for most cases
|
| 101 |
|
case "${ABI}" in
|
| 102 |
|
alpha|arm|hppa|m68k|o32|ppc|s390|sh|sparc|x86) ;;
|
| 103 |
|
n32) myconf+=( --enable-n32 );;
|
| 104 |
|
x32) myconf+=( --enable-x32 );;
|
| 105 |
|
s390x|*64) myconf+=( --enable-64bit );;
|
| 106 |
|
default) # no abi actually set, fall back to old check
|
| 107 |
|
einfo "Running a short build test to determine 64bit'ness"
|
| 108 |
|
# TODO: Port this to toolchain-funcs tc-get-ptr-size/tc-get-build-ptr-size
|
| 109 |
|
echo > "${T}"/test.c || die
|
| 110 |
|
${CC} ${CFLAGS} ${CPPFLAGS} -fno-lto -c "${T}"/test.c -o "${T}"/test.o || die
|
| 111 |
|
case $(file -S "${T}"/test.o) in
|
| 112 |
|
*32-bit*x86-64*) myconf+=( --enable-x32 );;
|
| 113 |
|
*64-bit*|*ppc64*|*x86_64*) myconf+=( --enable-64bit );;
|
| 114 |
|
*32-bit*|*ppc*|*i386*) ;;
|
| 115 |
|
*) die "Failed to detect whether your arch is 64bits or 32bits, disable distcc if you're using it, please";;
|
| 116 |
|
esac ;;
|
| 117 |
|
*) ;;
|
|
99 |
case $(tc-get-ptr-size) in
|
|
100 |
4) use abi_x86_x32 && myconf+=( --enable-x32 );;
|
|
101 |
8) myconf+=( --enable-64bit );;
|
| 118 |
102 |
esac
|
| 119 |
103 |
|
| 120 |
104 |
# Ancient autoconf needs help finding the right tools.
|