summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2016-10-12 22:15:03 +0200
committerDavid Seifert <soap@gentoo.org>2016-10-22 11:27:09 +0200
commitc096c11de359ed69fda9dee31675f5f1536e79ea (patch)
treea23d786f558a93a2da4b877de7d10282c81f95ca /eclass
parentdev-util/pkgconf: bump to version 1.0.1 (diff)
downloadgentoo-c096c11de359ed69fda9dee31675f5f1536e79ea.tar.gz
gentoo-c096c11de359ed69fda9dee31675f5f1536e79ea.tar.bz2
gentoo-c096c11de359ed69fda9dee31675f5f1536e79ea.zip
toolchain-funcs.eclass: Add tc-check-openmp() function
Closes: https://github.com/gentoo/gentoo/pull/2547 Signed-off-by: David Seifert <soap@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/toolchain-funcs.eclass21
1 files changed, 21 insertions, 0 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 5bac36b6737c..63f0d6b20912 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -421,6 +421,27 @@ 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. Using this function
+# to test for OpenMP support should be preferred over tc-has-openmp and
+# printing a custom message, as it presents a uniform interface to the user.
+tc-check-openmp() {
+ if ! tc-has-openmp; then
+ eerror "Your current compiler does not support OpenMP!"
+
+ if tc-is-gcc; then
+ eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\"."
+ elif tc-is-clang; then
+ eerror "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: