summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-05-23 02:00:17 +0000
committerMike Frysinger <vapier@gentoo.org>2010-05-23 02:00:17 +0000
commit92486e8207b6b66b4c73bc847f630a59496b4912 (patch)
tree3e0f0eab0dd9b4635d563de59a74d79d2227a3aa /eclass
parentClean up ebuild and fix echo/elog usage #294952 by Simeon Maryasin. (diff)
downloadgentoo-2-92486e8207b6b66b4c73bc847f630a59496b4912.tar.gz
gentoo-2-92486e8207b6b66b4c73bc847f630a59496b4912.tar.bz2
gentoo-2-92486e8207b6b66b4c73bc847f630a59496b4912.zip
add new tc-has-openmp helper func #320215 by Samuli Suominen
Diffstat (limited to 'eclass')
-rw-r--r--eclass/toolchain-funcs.eclass26
1 files changed, 25 insertions, 1 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 8811c8b64ef8..11683ad752cd 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.99 2010/04/22 18:28:11 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.100 2010/05/23 02:00:17 vapier Exp $
# @ECLASS: toolchain-funcs.eclass
# @MAINTAINER:
@@ -191,6 +191,30 @@ tc-is-static-only() {
return $([[ ${host} == *-mint* ]])
}
+# @FUNCTION: tc-has-openmp
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# See if the toolchain supports OpenMP.
+tc-has-openmp() {
+ local base="${T}/test-tc-openmp"
+ cat <<-EOF > "${base}.c"
+ #include <omp.h>
+ int main() {
+ int nthreads, tid, ret = 0;
+ #pragma omp parallel private(nthreads, tid)
+ {
+ tid = omp_get_thread_num();
+ nthreads = omp_get_num_threads(); ret += tid + nthreads;
+ }
+ return ret;
+ }
+ EOF
+ $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" >&/dev/null
+ local ret=$?
+ rm -f "${base}"*
+ return ${ret}
+}
+
# @FUNCTION: tc-has-tls
# @USAGE: [-s|-c|-l] [toolchain prefix]
# @DESCRIPTION: