From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A5541138330 for ; Thu, 13 Oct 2016 20:35:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6755DE0C50; Thu, 13 Oct 2016 20:35:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 26529E0B74 for ; Thu, 13 Oct 2016 20:35:13 +0000 (UTC) Received: from MacMini.fritz.box (cable-static-236-115.teleport.ch [213.188.236.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: soap) by smtp.gentoo.org (Postfix) with ESMTPSA id 6EF17341527 for ; Thu, 13 Oct 2016 20:35:11 +0000 (UTC) Message-ID: <1476390907.19719.10.camel@gentoo.org> Subject: [gentoo-dev] [PATCH] toolchain-funcs.eclass: Add tc-check-openmp() function From: David Seifert To: gentoo-dev@lists.gentoo.org Date: Thu, 13 Oct 2016 22:35:07 +0200 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 8fa50ac9-097c-41cd-b53c-959a8ad02a1f X-Archives-Hash: d262df5beecb70e29f5425df8b553e69 Hey all, I'd like to add a new function to toolchain-funcs, which presents a consist interface to users of packages somehow relying on OpenMP. Currently, (most) ebuilds relying on OpenMP test with tc-has-openmp and if OpenMP is not available, do something, like print a message and die, just print a warning, or change some flags implicitly without warning. This new function, tc-check-openmp, checks for OpenMP, dies if it is non-functional, and tells the user how to rectify the situation. This is better than all the current solutions, which, for instance, do not take CC=clang into account. It also makes extending the messages easier for new compilers. In most cases, this should obviate the direct use of tc-has-openmp. >From eaab3e443da8ee1970679b3d4016f12541d84344 Mon Sep 17 00:00:00 2001 From: David Seifert Date: Wed, 12 Oct 2016 22:15:03 +0200 Subject: [PATCH] toolchain-funcs.eclass: Add tc-check-openmp() function ---  eclass/toolchain-funcs.eclass | 19 +++++++++++++++++++  1 file changed, 19 insertions(+) diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain- funcs.eclass index 5bac36b..d8a28af 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -421,6 +421,25 @@ tc-has-openmp() {   return ${ret}  }   +# @FUNCTION: tc-check-openmp +# @DESCRIPTION: +# Test for OpenMP support with the current compiler and error out with +# a clear error message, telling the user how to rectify the missing +# OpenMP support that has been requested by the ebuild. +tc-check-openmp() { + if ! tc-has-openmp; then + ewarn "Your current compiler does not support OpenMP" + + if tc-is-gcc; then + ewarn "Enable OpenMP support by building sys- devel/gcc with USE=\"openmp\"." + elif tc-is-clang; then + ewarn "OpenMP support in sys-devel/clang is provided by sys-libs/libomp." + fi + + die "Active compiler does not have required support for OpenMP" + fi +} +  # @FUNCTION: tc-has-tls  # @USAGE: [-s|-c|-l] [toolchain prefix]  # @DESCRIPTION: --  2.10.1