toolchain/helpers: add fortran check
authorSamuel Martin <s.martin49@gmail.com>
Sun, 3 Jul 2016 13:47:44 +0000 (15:47 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 3 Jul 2016 14:58:11 +0000 (16:58 +0200)
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
[Thomas: remove extension for the generated temporary file, since it's
really an executable, not an object file.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
toolchain/helpers.mk

index 108fdaa7486fa16aaa455475bae7b73d5a0a8f1a..3991bc1cf1e36840ca7f34db8bb9948574a7086c 100644 (file)
@@ -310,6 +310,24 @@ check_cplusplus = \
                exit 1 ; \
        fi
 
+#
+#
+# Check that the external toolchain supports Fortran
+#
+# $1: cross-gfortran path
+#
+check_fortran = \
+       __CROSS_FC=$(strip $1) ; \
+       __o=$(BUILD_DIR)/.br-toolchain-test-fortran.tmp ; \
+       printf 'program hello\n\tprint *, "Hello Fortran!\\n"\nend program hello\n' | \
+       $${__CROSS_FC} -x f95 -o $${__o} - ; \
+       if test $$? -ne 0 ; then \
+               rm -f $${__o}* ; \
+               echo "Fortran 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
 #