diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2016-11-21 19:59:45 +0100 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2016-11-21 19:59:45 +0100 |
commit | 9e5ee1e7b10670470de538a8c4faf7b4461354fa (patch) | |
tree | 146246cf1e83b5f62a2b134dbf2abbee6e05e598 | |
parent | 59b867127c52335b218f3bc82e29692c9f28e2f2 (diff) | |
download | ratpoison-9e5ee1e7b10670470de538a8c4faf7b4461354fa.zip |
autotools: detect precisely Xrandr support
Bail out if xrandr support can't be found but the user explicitely
requested it.
-rw-r--r-- | configure.ac | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index 033b2c3..feacaac 100644 --- a/configure.ac +++ b/configure.ac @@ -101,6 +101,14 @@ AS_CASE([$enable_mdoc], AC_MSG_RESULT([$manpage_format]) AC_SUBST([manpage_format]) +AC_MSG_CHECKING([Xrandr support]) +AC_ARG_WITH([xrandr], + [AS_HELP_STRING([--without-xrandr], + [Build without Xrandr support, default is to use if available])], + [with_xrandr=$withval], + [with_xrandr=check]) +AC_MSG_RESULT([$with_xrandr]) + dnl Checks for programs. AC_PROG_CC AM_MISSING_PROG([MANDOC], [mandoc]) @@ -163,24 +171,32 @@ AC_CHECK_HEADERS([X11/XKBlib.h], [], [], [ ]) CPPFLAGS="$mysavedCPPFLAGS" -AC_ARG_WITH([xrandr], -[AS_HELP_STRING([--without-xrandr], [Build without xrandr support, even if available])], -[], -[with_xrandr=yes]) - -compile_xrandr=no -AS_IF([test "$with_xrandr" != no], -[AC_CHECK_LIB(Xrandr, XRRGetScreenResources, [compile_xrandr=yes X_LIBS="-lXrandr $X_LIBS" AC_DEFINE(HAVE_LIBXRANDR, 1, [Xrandr])],,$X_LIBS $X_EXTRA_LIBS)] -[]) - -AM_CONDITIONAL(HAVE_LIBXRANDR, test "$compile_xrandr" = yes) - AC_CHECK_LIB(Xtst, XTestFakeButtonEvent, [X_LIBS="-lXtst $X_LIBS"; AC_DEFINE(HAVE_LIBXTST,1,[Xtst])],,$X_LIBS $X_EXTRA_LIBS) AC_CHECK_LIB([X11], [XkbKeycodeToKeysym], [AC_DEFINE(HAVE_XKBKEYCODETOKEYSYM, 1, [Define to 1 if you have the `XkbKeycodeToKeysym' function.])], [], [$X_LIBS $X_EXTRA_LIBS]) +mysavedCPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $X_CFLAGS" +AC_CHECK_HEADERS([X11/extensions/Xrandr.h], [], [], [ +#include <X11/Xlib.h> +]) +CPPFLAGS="$mysavedCPPFLAGS" + +AC_CHECK_LIB(Xrandr, XRRGetScreenResources, + [X_LIBS="-lXrandr $X_LIBS" + AC_DEFINE(HAVE_LIBXRANDR, 1, [Xrandr])], + [], [$X_LIBS $X_EXTRA_LIBS]) + +compile_xrandr=no +AS_CASE(["$with_xrandr:$ac_cv_header_X11_extensions_Xrandr_h:$ac_cv_lib_Xrandr_XRRGetScreenResources"], + [yes:no:*], [AC_MSG_ERROR([*** Can't enable Xrandr support, header Xrandr.h not found.])], + [yes:*:no], [AC_MSG_ERROR([*** Can't enable Xrandr support, libXrandr not found.])], + [yes:yes:yes|check:yes:yes], [compile_xrandr=yes]) + +AM_CONDITIONAL(HAVE_LIBXRANDR, [test "$compile_xrandr" = yes]) + AC_SUBST(X_LIBS) AC_SUBST(X_EXTRA_LIBS) AC_SUBST(X_CFLAGS) |