Improved X extension detection in configure and added handling

of dpms.h headers that don't have function prototypes.
This commit is contained in:
crs 2004-10-30 16:16:32 +00:00
parent 91d1fcf38d
commit 719757ca22
2 changed files with 75 additions and 21 deletions

View File

@ -97,37 +97,75 @@ if test x"$acx_host_winapi" = xXWINDOWS; then
AC_PATH_XTRA AC_PATH_XTRA
save_CPPFLAGS="$CPPFLAGS" save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$X_CFLAGS $CPPFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS"
XEXT_LDADD=
AC_CHECK_LIB(Xtst, AC_CHECK_LIB(Xtst,
XTestQueryExtension, XTestQueryExtension,
[X_LIBS="$X_LIBS -lXtst"], [XEXT_LDADD="$XEXT_LDADD -lXtst"],
AC_MSG_ERROR(You must have the XTest library to build synergy), AC_MSG_ERROR(You must have the XTest library to build synergy),
[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
AC_CHECK_HEADERS([X11/extensions/XTest.h],, AC_CHECK_HEADERS([X11/extensions/XTest.h],
,
AC_MSG_ERROR(You must have the XTest headers to compile synergy)) AC_MSG_ERROR(You must have the XTest headers to compile synergy))
AC_CHECK_HEADERS([X11/extensions/Xinerama.h],
[acx_xinerama_lib_ok=yes], acx_have_xinerama=yes
[acx_xinerama_lib_ok=no],
[#include <X11/Xlib.h>])
if test x"$acx_xinerama_lib_ok" = xyes; then
AC_CHECK_LIB(Xinerama, AC_CHECK_LIB(Xinerama,
XineramaQueryExtension, XineramaQueryExtension,
[X_LIBS="$X_LIBS -lXinerama"], [acx_have_xinerama=yes],
[AC_DEFINE(HAVE_X11_EXTENSIONS_XINERAMA_H, 0)], [acx_have_xinerama=no],
[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
fi if test x"$acx_have_xinerama" = xyes; then
AC_CHECK_HEADERS([X11/extensions/dpms.h], AC_CHECK_HEADERS([X11/extensions/Xinerama.h],
[acx_dpms_lib_ok=yes], [acx_have_xinerama=yes],
[acx_dpms_lib_ok=no], [acx_have_xinerama=no],
[#include <X11/Xlib.h>]) [#include <X11/Xlib.h>])
if test x"$acx_dpms_lib_ok" = xyes; then fi
if test x"$acx_have_xinerama" = xyes; then
XEXT_LDADD="$XEXT_LDADD -lXinerama"
fi
X_DPMS_LDADD=
acx_have_dpms=no
AC_CHECK_LIB(Xext, AC_CHECK_LIB(Xext,
DPMSQueryExtension, DPMSQueryExtension,
[true], [acx_have_dpms=yes],
[AC_DEFINE(HAVE_X11_EXTENSIONS_DPMS_H, 0)], [acx_have_dpms=no],
[$X_LIBS -lX11 $X_EXTRA_LIBS])
if test x"$acx_have_dpms" != xyes; then
AC_CHECK_LIB(Xdpms,
DPMSQueryExtension,
[acx_have_dpms=yes; XDPMS_LDADD=-lXdpms],
[acx_have_dpms=no],
[$X_LIBS -lX11 $X_EXTRA_LIBS]) [$X_LIBS -lX11 $X_EXTRA_LIBS])
fi fi
if test x"$acx_have_dpms" = xyes; then
AC_CHECK_HEADERS([X11/extensions/dpms.h],
[acx_have_dpms_h=yes],
[acx_have_dpms_h=no],
[#include <X11/Xlib.h>])
if test x"$acx_have_dpms_h" = xyes; then
XEXT_LDADD="$XEXT_LDADD $XDPMS_LDADD"
AC_MSG_CHECKING(for prototypes in X11/extensions/dpms.h)
acx_have_dpms_protos=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
extern "C" {
#include <X11/extensions/dpms.h>
}
],[
int s = DPMSModeOn;
DPMSQueryExtension(0, 0, 0);
],
[acx_have_dpms_protos=yes])
AC_MSG_RESULT($acx_have_dpms_protos)
if test x"$acx_have_dpms_protos" = xyes; then
AC_DEFINE(HAVE_DPMS_PROTOTYPES,1,[Define if the <X11/extensions/dpms.h> header file declares function prototypes.])
fi
fi
fi
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
ARCH_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $ARCH_LIBS" ARCH_LIBS="$X_LIBS $X_PRE_LIBS $XEXT_LDADD -lXext -lX11 $X_EXTRA_LIBS $ARCH_LIBS"
ARCH_CFLAGS="$ARCH_CFLAGS $X_CFLAGS" ARCH_CFLAGS="$ARCH_CFLAGS $X_CFLAGS"
fi fi

View File

@ -29,6 +29,22 @@
extern "C" { extern "C" {
# include <X11/Xmd.h> # include <X11/Xmd.h>
# include <X11/extensions/dpms.h> # include <X11/extensions/dpms.h>
# if !HAVE_DPMS_PROTOTYPES
# undef DPMSModeOn
# undef DPMSModeStandby
# undef DPMSModeSuspend
# undef DPMSModeOff
# define DPMSModeOn 0
# define DPMSModeStandby 1
# define DPMSModeSuspend 2
# define DPMSModeOff 3
extern Bool DPMSQueryExtension(Display *, int *, int *);
extern Bool DPMSCapable(Display *);
extern Status DPMSEnable(Display *);
extern Status DPMSDisable(Display *);
extern Status DPMSForceLevel(Display *, CARD16);
extern Status DPMSInfo(Display *, CARD16 *, BOOL *);
# endif
} }
#endif #endif