1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: epunt-cxx.eclass
6 # base-system@gentoo.org
7 # @BLURB: A function to punt C++ compiler checks from autoconf
9 # Support for punting C++ compiler checks from autoconf (based
12 if [[ -z ${_EPUNT_CXX_ECLASS} ]]; then
14 # TODO: replace this with 'inherit eutils' once eutils stops inheriting
16 if ! declare -F eqawarn >/dev/null ; then
18 has qa ${PORTAGE_ELOG_CLASSES} && ewarn "$@"
23 # If an overlay has eclass overrides, but doesn't actually override the
24 # libtool.eclass, we'll have ECLASSDIR pointing to the active overlay's
25 # eclass/ dir, but libtool.eclass is still in the main Gentoo tree. So
26 # add a check to locate the ELT-patches/ regardless of what's going on.
27 # Note: Duplicated in libtool.eclass.
28 _EUTILS_ECLASSDIR_LOCAL=${BASH_SOURCE[0]%/*}
29 eutils_elt_patch_dir() {
30 local d="${ECLASSDIR}/ELT-patches"
31 if [[ ! -d ${d} ]] ; then
32 d="${_EUTILS_ECLASSDIR_LOCAL}/ELT-patches"
37 # @FUNCTION: epunt_cxx
38 # @USAGE: [dir to scan]
40 # Many configure scripts wrongly bail when a C++ compiler could not be
41 # detected. If dir is not specified, then it defaults to ${S}.
43 # https://bugs.gentoo.org/73450
46 [[ -z ${dir} ]] && dir=${S}
47 ebegin "Removing useless C++ checks"
49 while IFS= read -r -d '' f; do
50 for p in "$(eutils_elt_patch_dir)"/nocxx/*.patch ; do
51 if patch --no-backup-if-mismatch -p1 "${f}" "${p}" >/dev/null ; then
56 done < <(find "${dir}" -name configure -print0)
58 if [[ -z ${any_found} ]]; then
59 eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt)."