diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f3b42fc7..d5410d922 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -607,6 +607,10 @@ endif() if(USE_ELF) list(APPEND FEATURES ELF) include_directories(AFTER ${LIBELF_INCLUDE_DIRS}) + find_file(ELF_REPL_H elf_repl.h PATHS ${LIBELF_INCLUDE_DIRS}) + if (ELF_REPL_H) + add_definitions(-DUSE_ELF_REPL) + endif() list(APPEND DEPENDENCY_LIB ${LIBELF_LIBRARIES}) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libelfg0") endif() diff --git a/include/mgba-util/elf-read.h b/include/mgba-util/elf-read.h index e98ce0828..e3886ac64 100644 --- a/include/mgba-util/elf-read.h +++ b/include/mgba-util/elf-read.h @@ -13,7 +13,12 @@ CXX_GUARD_START #ifdef USE_ELF #include + +#if USE_ELF_REPL #include +#else +#include +#endif #include