summaryrefslogtreecommitdiff
path: root/toolchain
diff options
context:
space:
mode:
authorEd Blake <ed.blake@sondrel.com>2019-03-28 18:48:15 +0000
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>2019-03-28 19:49:51 +0100
commitef206d8cc71d05e8a82c03677145f3435fe5007a (patch)
treee79c14651f99ade8d9e8c93844e866895e5cea7c /toolchain
parent25ae113445853b1ed1cfc94785f066139f959667 (diff)
toolchain-external: add a check for OpenMP support
Signed-off-by: Ed Blake <ed.blake@sondrel.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/helpers.mk18
-rw-r--r--toolchain/toolchain-external/pkg-toolchain-external.mk3
2 files changed, 21 insertions, 0 deletions
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index e5520c00c3..03355f56dd 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -360,6 +360,24 @@ check_fortran = \
rm -f $${__o}* \
#
+#
+# Check that the external toolchain supports OpenMP
+#
+# $1: cross-gcc path
+#
+check_openmp = \
+ __CROSS_CC=$(strip $1) ; \
+ __o=$(BUILD_DIR)/.br-toolchain-test-openmp.tmp ; \
+ printf '\#include <omp.h>\nint main(void) { return omp_get_thread_num(); }' | \
+ $${__CROSS_CC} -fopenmp -x c -o $${__o} - ; \
+ if test $$? -ne 0 ; then \
+ rm -f $${__o}* ; \
+ echo "OpenMP support is selected but is not available in external toolchain"; \
+ exit 1 ; \
+ fi ; \
+ rm -f $${__o}* \
+
+#
# Check that the cross-compiler given in the configuration exists
#
# $1: cross-gcc path
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 747837fdc6..baf719ad1f 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -545,6 +545,9 @@ define $(2)_CONFIGURE_CMDS
if test "$$(BR2_TOOLCHAIN_HAS_FORTRAN)" = "y" ; then \
$$(call check_fortran,$$(TOOLCHAIN_EXTERNAL_FC)) ; \
fi ; \
+ if test "$$(BR2_TOOLCHAIN_HAS_OPENMP)" = "y" ; then \
+ $$(call check_openmp,$$(TOOLCHAIN_EXTERNAL_CC)) ; \
+ fi ; \
if test "$$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
$$(call check_uclibc,$$$${SYSROOT_DIR}) ; \
elif test "$$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \