toolchain-external: add a check for OpenMP support
authorEd Blake <ed.blake@sondrel.com>
Thu, 28 Mar 2019 18:48:15 +0000 (18:48 +0000)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Thu, 28 Mar 2019 18:49:51 +0000 (19:49 +0100)
Signed-off-by: Ed Blake <ed.blake@sondrel.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
toolchain/helpers.mk
toolchain/toolchain-external/pkg-toolchain-external.mk

index e5520c00c321997436aca2105d586f0363095c9d..03355f56dd611ce3207bfad452870716c949c23d 100644 (file)
@@ -359,6 +359,24 @@ check_fortran = \
        fi ; \
        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
 #
index 747837fdc68fb901f3485dbf99ffbd9c53ce629d..baf719ad1f0916f752311a9875ec91e0e894d18a 100644 (file)
@@ -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 \