diff --git a/CMakeLists.txt b/CMakeLists.txt index 41818e96d..977f194aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -564,8 +564,13 @@ if (NOT WIN32 AND NOT APPLE) CHECK_INCLUDE_FILE(linux/input.h LINUX_INPUT_FOUND) CHECK_INCLUDE_FILE(linux/kd.h LINUX_KD_FOUND) if (SYS_IO_FOUND) - list(APPEND DEPENDENCIES_DEFINES HAVE_SYS_IO) - message(STATUS "PC speaker output: outb()") + try_compile(HAVE_INOUTB ${CMAKE_BINARY_DIR}/check SOURCES ${CMAKE_SOURCE_DIR}/src/check/check_sysIO.c) + if (HAVE_INOUTB) + list(APPEND DEPENDENCIES_DEFINES HAVE_SYS_IO) + message(STATUS "PC speaker output: outb()") + else() + message(STATUS "sys/io.h found but inb()/outb() not present") + endif() endif() if (LINUX_INPUT_FOUND) list(APPEND DEPENDENCIES_DEFINES HAVE_LINUX_INPUT) diff --git a/src/check/check_sysIO.c b/src/check/check_sysIO.c new file mode 100644 index 000000000..653721e6d --- /dev/null +++ b/src/check/check_sysIO.c @@ -0,0 +1,6 @@ +#include + +int main(int, char**) { + inb(0x61); + outb(0x00,0x61); +}