Skip to content

Commit 38ce2e9

Browse files
committed
GraphBLAS: Check if C standard function "system" can be used
Support for the CPU JIT compiler requires that a compiler can be executed on the host using the `system` function. Disable the JIT compiler if the `system` function cannot be used on the target system.
1 parent e27567c commit 38ce2e9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,20 @@ if ( SUITESPARSE_HAS_CUDA AND GRAPHBLAS_USE_CUDA )
4343
# set ( GRAPHBLAS_COMPACT on ) # FIXME
4444
endif ( )
4545

46+
include ( CheckSymbolExists )
47+
check_symbol_exists ( system "stdlib.h" HAVE_C_SYSTEM )
48+
4649
option ( GRAPHBLAS_COMPACT "ON: do not compile FactoryKernels. OFF (default): compile FactoryKernels" OFF )
47-
option ( GRAPHBLAS_USE_JIT "ON (default): use the CPU JIT. OFF: do not use the CPU JIT" ON )
50+
option ( GRAPHBLAS_USE_JIT "ON (default): use the CPU JIT. OFF: do not use the CPU JIT" ${HAVE_C_SYSTEM} )
51+
52+
if ( GRAPHBLAS_USE_JIT AND NOT HAVE_C_SYSTEM )
53+
if ( SUITESPARSE_USE_STRICT )
54+
message ( FATAL_ERROR "GRAPHBLAS CPU JIT cannot be built without support for the C standard function 'system'." )
55+
else ( )
56+
message ( STATUS "C standard function 'system' cannot be used. GRAPHBLAS CPU JIT will be disabled." )
57+
set ( GRAPHBLAS_USE_JIT OFF CACHE BOOL "ON (default): use the CPU JIT. OFF: do not use the CPU JIT" FORCE )
58+
endif ( )
59+
endif ( )
4860

4961
if ( GRAPHBLAS_USE_JIT )
5062
message ( STATUS "GraphBLAS CPU JIT: enabled")

0 commit comments

Comments
 (0)