Parcourir la source

port r6495 from 1.0: Fix CUDA compilation test ; add CUDA run test

Samuel Thibault il y a 13 ans
Parent
commit
9d07d3d4c1
1 fichiers modifiés avec 20 ajouts et 4 suppressions
  1. 20 4
      configure.ac

+ 20 - 4
configure.ac

@@ -399,14 +399,30 @@ if test x$enable_cuda = xyes -o x$enable_cuda = xmaybe; then
     if test "$have_valid_cuda" = "yes" ; then
         SAVED_CPPFLAGS="${CPPFLAGS}"
         CPPFLAGS="${CPPFLAGS} ${STARPU_CUDA_CPPFLAGS}"
+	SAVED_LDFLAGS="${LDFLAGS}"
+	LDFLAGS="${LDFLAGS} ${STARPU_CUDA_LDFLAGS} -lcuda"
 	AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 		[[#include <cuda.h>]],
 		[[]]
-		),
-	    [have_valid_cuda="yes"],
-	    [have_valid_cuda="no"]
-	])
+		)],
+	    [
+	      AC_RUN_IFELSE([AC_LANG_PROGRAM(
+	        [[#include <cuda.h>]],
+		[[]]
+		)],
+		[have_valid_cuda="yes"],
+		[
+	          AC_MSG_RESULT([CUDA found and can be compiled, but compiled application can not be run, is the CUDA path missing in LD_LIBRARY_PATH?])
+	          have_valid_cuda="no"
+		])
+	    ],
+	    [
+	    AC_MSG_ERROR([CUDA found, but cuda.h could not be compiled])
+	    have_valid_cuda="no"
+	    ]
+	)
         CPPFLAGS="${SAVED_CPPFLAGS}"
+	LDFLAGS="${SAVED_LDFLAGS}"
     fi
     AC_MSG_RESULT($have_valid_cuda)