Skip to content

Commit

Permalink
Check for execinfo.h and add libexecinfo if needed
Browse files Browse the repository at this point in the history
Some systems (e.g. musl) do not have execinfo.h header.
Check if libexecinfo (library that provides execinfo.h header
and its functions) is installed in the system, and add
its linker flag if needed.
  • Loading branch information
danyspin97 authored and madame-rachelle committed Jun 7, 2019
1 parent d34b355 commit fb74832
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Expand Up @@ -323,6 +323,19 @@ else()
set( ZLIB_LIBRARY z )
endif()

if( HAVE_VM_JIT AND UNIX )
check_symbol_exists( "backtrace" "execinfo.h" HAVE_BACKTRACE )
if( NOT HAVE_BACKTRACE )
set( CMAKE_REQUIRED_FLAGS "-lexecinfo" )
check_symbol_exists( "backtrace" "execinfo.h" HAVE_LIBEXECINFO )
if( HAVE_LIBEXECINFO )
set( ALL_C_FLAGS "${ALL_C_FLAGS} -lexecinfo" )
else( HAVE_LIBEXECINFO )
set( HAVE_VM_JIT NO )
endif( HAVE_LIBEXECINFO )
endif( NOT HAVE_BACKTRACE )
endif( HAVE_VM_JIT AND UNIX )

if( ${HAVE_VM_JIT} )
if( ASMJIT_FOUND AND NOT FORCE_INTERNAL_ASMJIT )
message( STATUS "Using system asmjit, includes found at ${ASMJIT_INCLUDE_DIR}" )
Expand Down

0 comments on commit fb74832

Please sign in to comment.