From 91d1fcf38d0a1763a186cc4d981ded842b1d4274 Mon Sep 17 00:00:00 2001 From: crs Date: Thu, 28 Oct 2004 21:40:56 +0000 Subject: [PATCH] Fixed bugs in configuration. Wasn't doing configuration for DPMS and Xinerama correctly. Also was using '#if defined(...)' instead of '#if ...' for testing configure macros in some places. This yields the wrong answer if the macro is set to 0, which means missing/disabled. --- configure.in | 28 ++++++++++++++---------- lib/arch/CArchNetworkBSD.h | 2 +- lib/common/stdistream.h | 2 +- lib/common/stdostream.h | 2 +- lib/common/stdsstream.h | 2 +- lib/platform/CXWindowsClipboard.h | 2 +- lib/platform/CXWindowsEventQueueBuffer.h | 2 +- lib/platform/CXWindowsKeyState.cpp | 6 ++--- lib/platform/CXWindowsKeyState.h | 4 ++-- lib/platform/CXWindowsScreen.cpp | 4 ++-- lib/platform/CXWindowsScreen.h | 2 +- lib/platform/CXWindowsScreenSaver.cpp | 14 ++++++------ lib/platform/CXWindowsScreenSaver.h | 2 +- lib/platform/CXWindowsUtil.h | 2 +- 14 files changed, 39 insertions(+), 35 deletions(-) diff --git a/configure.in b/configure.in index a066a4d1..884b3481 100644 --- a/configure.in +++ b/configure.in @@ -104,23 +104,27 @@ if test x"$acx_host_winapi" = xXWINDOWS; then [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) AC_CHECK_HEADERS([X11/extensions/XTest.h],, AC_MSG_ERROR(You must have the XTest headers to compile synergy)) - AC_CHECK_LIB(Xinerama, - XineramaQueryExtension, - [X_LIBS="$X_LIBS -lXinerama"], + AC_CHECK_HEADERS([X11/extensions/Xinerama.h], + [acx_xinerama_lib_ok=yes], [acx_xinerama_lib_ok=no], - [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) - if test x"$acx_xinerama_lib_ok" != xno; then - AC_CHECK_HEADERS([X11/extensions/Xinerama.h],,, - [#include ]) + [#include ]) + if test x"$acx_xinerama_lib_ok" = xyes; then + AC_CHECK_LIB(Xinerama, + XineramaQueryExtension, + [X_LIBS="$X_LIBS -lXinerama"], + [AC_DEFINE(HAVE_X11_EXTENSIONS_XINERAMA_H, 0)], + [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) fi - AC_CHECK_LIB(Xext, - DPMSQueryExtension, + AC_CHECK_HEADERS([X11/extensions/dpms.h], [acx_dpms_lib_ok=yes], [acx_dpms_lib_ok=no], - [$X_LIBS -lX11 $X_EXTRA_LIBS]) + [#include ]) if test x"$acx_dpms_lib_ok" = xyes; then - AC_CHECK_HEADERS([X11/extensions/dpms.h],,, - [#include ]) + AC_CHECK_LIB(Xext, + DPMSQueryExtension, + [true], + [AC_DEFINE(HAVE_X11_EXTENSIONS_DPMS_H, 0)], + [$X_LIBS -lX11 $X_EXTRA_LIBS]) fi CPPFLAGS="$save_CPPFLAGS" ARCH_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $ARCH_LIBS" diff --git a/lib/arch/CArchNetworkBSD.h b/lib/arch/CArchNetworkBSD.h index 671e653e..3915b3ff 100644 --- a/lib/arch/CArchNetworkBSD.h +++ b/lib/arch/CArchNetworkBSD.h @@ -24,7 +24,7 @@ # include #endif -#if !defined(HAVE_SOCKLEN_T) +#if !HAVE_SOCKLEN_T typedef int socklen_t; #endif diff --git a/lib/common/stdistream.h b/lib/common/stdistream.h index bd903578..33667398 100644 --- a/lib/common/stdistream.h +++ b/lib/common/stdistream.h @@ -13,7 +13,7 @@ */ #include "stdpre.h" -#if defined(HAVE_ISTREAM) +#if HAVE_ISTREAM #include #else #include diff --git a/lib/common/stdostream.h b/lib/common/stdostream.h index e7496f5b..48e89862 100644 --- a/lib/common/stdostream.h +++ b/lib/common/stdostream.h @@ -13,7 +13,7 @@ */ #include "stdpre.h" -#if defined(HAVE_OSTREAM) +#if HAVE_OSTREAM #include #else #include diff --git a/lib/common/stdsstream.h b/lib/common/stdsstream.h index ed8e723f..45b28124 100644 --- a/lib/common/stdsstream.h +++ b/lib/common/stdsstream.h @@ -14,7 +14,7 @@ #include "stdpre.h" -#if defined(HAVE_SSTREAM) || !defined(__GNUC__) || (__GNUC__ >= 3) +#if HAVE_SSTREAM || !defined(__GNUC__) || (__GNUC__ >= 3) #include diff --git a/lib/platform/CXWindowsClipboard.h b/lib/platform/CXWindowsClipboard.h index 25c221bd..5fe126f8 100644 --- a/lib/platform/CXWindowsClipboard.h +++ b/lib/platform/CXWindowsClipboard.h @@ -20,7 +20,7 @@ #include "stdmap.h" #include "stdlist.h" #include "stdvector.h" -#if defined(X_DISPLAY_MISSING) +#if X_DISPLAY_MISSING # error X11 is required to build synergy #else # include diff --git a/lib/platform/CXWindowsEventQueueBuffer.h b/lib/platform/CXWindowsEventQueueBuffer.h index 9c2bdfa3..5d9b6dd4 100644 --- a/lib/platform/CXWindowsEventQueueBuffer.h +++ b/lib/platform/CXWindowsEventQueueBuffer.h @@ -18,7 +18,7 @@ #include "IEventQueueBuffer.h" #include "CMutex.h" #include "stdvector.h" -#if defined(X_DISPLAY_MISSING) +#if X_DISPLAY_MISSING # error X11 is required to build synergy #else # include diff --git a/lib/platform/CXWindowsKeyState.cpp b/lib/platform/CXWindowsKeyState.cpp index c0ec6f75..09058653 100644 --- a/lib/platform/CXWindowsKeyState.cpp +++ b/lib/platform/CXWindowsKeyState.cpp @@ -16,7 +16,7 @@ #include "CXWindowsUtil.h" #include "CLog.h" #include "CStringUtil.h" -#if defined(X_DISPLAY_MISSING) +#if X_DISPLAY_MISSING # error X11 is required to build synergy #else # include @@ -92,7 +92,7 @@ #endif // map special KeyID keys to KeySyms -#if defined(HAVE_X11_XF86KEYSYM_H) +#if HAVE_X11_XF86KEYSYM_H static const KeySym g_mapE000[] = { /* 0x00 */ 0, XF86XK_Eject, 0, 0, 0, 0, 0, 0, @@ -647,7 +647,7 @@ CXWindowsKeyState::keyIDToKeySym(KeyID id, KeyModifierMask mask) const if ((id & 0xfffff000) == 0xe000) { // special character switch (id & 0x0000ff00) { -#if defined(HAVE_X11_XF86KEYSYM_H) +#if HAVE_X11_XF86KEYSYM_H case 0xe000: return g_mapE000[id & 0xff]; #endif diff --git a/lib/platform/CXWindowsKeyState.h b/lib/platform/CXWindowsKeyState.h index 36abeeb2..15d8f894 100644 --- a/lib/platform/CXWindowsKeyState.h +++ b/lib/platform/CXWindowsKeyState.h @@ -17,11 +17,11 @@ #include "CKeyState.h" #include "stdmap.h" -#if defined(X_DISPLAY_MISSING) +#if X_DISPLAY_MISSING # error X11 is required to build synergy #else # include -# if defined(HAVE_X11_EXTENSIONS_XTEST_H) +# if HAVE_X11_EXTENSIONS_XTEST_H # include # else # error The XTest extension is required to build synergy diff --git a/lib/platform/CXWindowsScreen.cpp b/lib/platform/CXWindowsScreen.cpp index 86d9a780..082e9a0e 100644 --- a/lib/platform/CXWindowsScreen.cpp +++ b/lib/platform/CXWindowsScreen.cpp @@ -26,14 +26,14 @@ #include "IEventQueue.h" #include "TMethodEventJob.h" #include -#if defined(X_DISPLAY_MISSING) +#if X_DISPLAY_MISSING # error X11 is required to build synergy #else # include # include # define XK_XKB_KEYS # include -# if defined(HAVE_X11_EXTENSIONS_XTEST_H) +# if HAVE_X11_EXTENSIONS_XTEST_H # include # else # error The XTest extension is required to build synergy diff --git a/lib/platform/CXWindowsScreen.h b/lib/platform/CXWindowsScreen.h index f9adfd9d..131cfb60 100644 --- a/lib/platform/CXWindowsScreen.h +++ b/lib/platform/CXWindowsScreen.h @@ -17,7 +17,7 @@ #include "CPlatformScreen.h" #include "stdvector.h" -#if defined(X_DISPLAY_MISSING) +#if X_DISPLAY_MISSING # error X11 is required to build synergy #else # include diff --git a/lib/platform/CXWindowsScreenSaver.cpp b/lib/platform/CXWindowsScreenSaver.cpp index 0b69f08f..222c9a31 100644 --- a/lib/platform/CXWindowsScreenSaver.cpp +++ b/lib/platform/CXWindowsScreenSaver.cpp @@ -20,12 +20,12 @@ #include "IEventQueue.h" #include "TMethodEventJob.h" #include -#if defined(HAVE_X11_EXTENSIONS_XTEST_H) +#if HAVE_X11_EXTENSIONS_XTEST_H # include #else # error The XTest extension is required to build synergy #endif -#if defined(HAVE_X11_EXTENSIONS_DPMS_H) +#if HAVE_X11_EXTENSIONS_DPMS_H extern "C" { # include # include @@ -60,7 +60,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver( // check for DPMS extension. this is an alternative screen saver // that powers down the display. -#if defined(HAVE_X11_EXTENSIONS_DPMS_H) +#if HAVE_X11_EXTENSIONS_DPMS_H int eventBase, errorBase; if (DPMSQueryExtension(m_display, &eventBase, &errorBase)) { if (DPMSCapable(m_display)) { @@ -509,7 +509,7 @@ CXWindowsScreenSaver::handleDisableTimer(const CEvent&, void*) void CXWindowsScreenSaver::activateDPMS(bool activate) { -#if defined(HAVE_X11_EXTENSIONS_DPMS_H) +#if HAVE_X11_EXTENSIONS_DPMS_H if (m_dpms) { // DPMSForceLevel will generate a BadMatch if DPMS is disabled CXWindowsUtil::CErrorLock lock(m_display); @@ -521,7 +521,7 @@ CXWindowsScreenSaver::activateDPMS(bool activate) void CXWindowsScreenSaver::enableDPMS(bool enable) { -#if defined(HAVE_X11_EXTENSIONS_DPMS_H) +#if HAVE_X11_EXTENSIONS_DPMS_H if (m_dpms) { if (enable) { DPMSEnable(m_display); @@ -536,7 +536,7 @@ CXWindowsScreenSaver::enableDPMS(bool enable) bool CXWindowsScreenSaver::isDPMSEnabled() const { -#if defined(HAVE_X11_EXTENSIONS_DPMS_H) +#if HAVE_X11_EXTENSIONS_DPMS_H if (m_dpms) { CARD16 level; BOOL state; @@ -554,7 +554,7 @@ CXWindowsScreenSaver::isDPMSEnabled() const bool CXWindowsScreenSaver::isDPMSActivated() const { -#if defined(HAVE_X11_EXTENSIONS_DPMS_H) +#if HAVE_X11_EXTENSIONS_DPMS_H if (m_dpms) { CARD16 level; BOOL state; diff --git a/lib/platform/CXWindowsScreenSaver.h b/lib/platform/CXWindowsScreenSaver.h index 20c2237d..193e1e7b 100644 --- a/lib/platform/CXWindowsScreenSaver.h +++ b/lib/platform/CXWindowsScreenSaver.h @@ -17,7 +17,7 @@ #include "IScreenSaver.h" #include "stdmap.h" -#if defined(X_DISPLAY_MISSING) +#if X_DISPLAY_MISSING # error X11 is required to build synergy #else # include diff --git a/lib/platform/CXWindowsUtil.h b/lib/platform/CXWindowsUtil.h index fb3fb9e7..5765c94a 100644 --- a/lib/platform/CXWindowsUtil.h +++ b/lib/platform/CXWindowsUtil.h @@ -19,7 +19,7 @@ #include "BasicTypes.h" #include "stdmap.h" #include "stdvector.h" -#if defined(X_DISPLAY_MISSING) +#if X_DISPLAY_MISSING # error X11 is required to build synergy #else # include