diff --git a/CMakeLists.txt b/CMakeLists.txt index f1bfd61850..ba6b320367 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,6 +115,18 @@ endif() # X11 stuff. It's in a if() so that we can say REQUIRED if(UNIX AND NOT APPLE) find_package(X11 REQUIRED) + if(X11_Xdamage_LIB) + add_definitions(-DHAVE_XDAMAGE) + endif() + if(X11_Xfixes_LIB) + add_definitions(-DHAVE_XFIXES) + endif() + if(X11_Xrandr_LIB) + add_definitions(-DHAVE_XRANDR) + endif() + if(X11_XTest_LIB) + add_definitions(-DHAVE_XTEST) + endif() endif() # Check for zlib @@ -306,6 +318,9 @@ if(UNIX AND NOT APPLE) find_package(PkgConfig) if (PKG_CONFIG_FOUND) pkg_check_modules(LIBSYSTEMD libsystemd) + if (LIBSYSTEMD_FOUND) + add_definitions(-DHAVE_LIBSYSTEMD) + endif() endif() endif() diff --git a/unix/x0vncserver/CMakeLists.txt b/unix/x0vncserver/CMakeLists.txt index b9f6bd0162..5ce9577b8e 100644 --- a/unix/x0vncserver/CMakeLists.txt +++ b/unix/x0vncserver/CMakeLists.txt @@ -23,33 +23,28 @@ target_link_libraries(x0vncserver tx rfb network rdr unixcommon) # systemd support (socket activation) if (LIBSYSTEMD_FOUND) - add_definitions(-DHAVE_SYSTEMD_H) target_link_libraries(x0vncserver ${LIBSYSTEMD_LIBRARIES}) endif() if(X11_XTest_LIB) - add_definitions(-DHAVE_XTEST) target_link_libraries(x0vncserver ${X11_XTest_LIB}) else() message(WARNING "No XTest extension. x0vncserver will be view-only.") endif() if(X11_Xdamage_LIB) - add_definitions(-DHAVE_XDAMAGE) target_link_libraries(x0vncserver ${X11_Xdamage_LIB}) else() message(WARNING "No DAMAGE extension. x0vncserver will have to use the slower polling method.") endif() if(X11_Xfixes_LIB) - add_definitions(-DHAVE_XFIXES) target_link_libraries(x0vncserver ${X11_Xfixes_LIB}) else() message(WARNING "No XFIXES extension. x0vncserver will not be able to show cursors.") endif() if(X11_Xrandr_LIB) - add_definitions(-DHAVE_XRANDR) target_link_libraries(x0vncserver ${X11_Xrandr_LIB}) else() message(WARNING "No Xrandr extension. x0vncserver will not be able to resize session.") diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx index 28567a6e26..8e27e62b8d 100644 --- a/unix/x0vncserver/x0vncserver.cxx +++ b/unix/x0vncserver/x0vncserver.cxx @@ -38,7 +38,7 @@ #include #include #include -#ifdef HAVE_SYSTEMD_H +#ifdef HAVE_LIBSYSTEMD # include #endif @@ -118,7 +118,7 @@ static void CleanupSignalHandler(int /*sig*/) static bool hasSystemdListeners() { -#ifdef HAVE_SYSTEMD_H +#ifdef HAVE_LIBSYSTEMD // This also returns true on errors, because we then assume we were // meant to use systemd but failed somewhere return sd_listen_fds(0) != 0; @@ -129,7 +129,7 @@ static bool hasSystemdListeners() static int createSystemdListeners(std::list *listeners) { -#ifdef HAVE_SYSTEMD_H +#ifdef HAVE_LIBSYSTEMD int count = sd_listen_fds(0); if (count < 0) { vlog.error("Error getting listening sockets from systemd: %s", diff --git a/vncviewer/CMakeLists.txt b/vncviewer/CMakeLists.txt index 1f9c6d39f4..143c8fa0b8 100644 --- a/vncviewer/CMakeLists.txt +++ b/vncviewer/CMakeLists.txt @@ -66,7 +66,6 @@ else() target_link_libraries(vncviewer ${X11_Xi_LIB}) if(X11_Xrandr_LIB) - add_definitions(-DHAVE_XRANDR) target_link_libraries(vncviewer ${X11_Xrandr_LIB}) endif() endif()