From 38ce2e97587e57983ffafac76cd3388c0a9815b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Tue, 11 Jun 2024 17:27:22 +0200 Subject: [PATCH] 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. --- GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake b/GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake index de1ffa515a..0e52da17ad 100644 --- a/GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake +++ b/GraphBLAS/cmake_modules/GraphBLAS_JIT_paths.cmake @@ -43,8 +43,20 @@ if ( SUITESPARSE_HAS_CUDA AND GRAPHBLAS_USE_CUDA ) # set ( GRAPHBLAS_COMPACT on ) # FIXME endif ( ) +include ( CheckSymbolExists ) +check_symbol_exists ( system "stdlib.h" HAVE_C_SYSTEM ) + option ( GRAPHBLAS_COMPACT "ON: do not compile FactoryKernels. OFF (default): compile FactoryKernels" OFF ) -option ( GRAPHBLAS_USE_JIT "ON (default): use the CPU JIT. OFF: do not use the CPU JIT" ON ) +option ( GRAPHBLAS_USE_JIT "ON (default): use the CPU JIT. OFF: do not use the CPU JIT" ${HAVE_C_SYSTEM} ) + +if ( GRAPHBLAS_USE_JIT AND NOT HAVE_C_SYSTEM ) + if ( SUITESPARSE_USE_STRICT ) + message ( FATAL_ERROR "GRAPHBLAS CPU JIT cannot be built without support for the C standard function 'system'." ) + else ( ) + message ( STATUS "C standard function 'system' cannot be used. GRAPHBLAS CPU JIT will be disabled." ) + set ( GRAPHBLAS_USE_JIT OFF CACHE BOOL "ON (default): use the CPU JIT. OFF: do not use the CPU JIT" FORCE ) + endif ( ) +endif ( ) if ( GRAPHBLAS_USE_JIT ) message ( STATUS "GraphBLAS CPU JIT: enabled")