From 1292b5a0cc67e943b8fcbddcbb9bcf374e921aeb Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 17 Nov 2013 18:51:14 +0100 Subject: [PATCH] configure: Moved configure's detection of XShape to a dedicated macro The original check was not compliant with autoconf's syntax, did not have a very good behaviour for user and was not easy to make evolve. The new macro: - uses as much as possible autoconf macros for portability and code consistency; - checks also for header usability with the compiler; - provides a consistent behaviour on yes/no/auto (if user explicitly enables support, do not silently disable if not found; if library is found but not the header, complain to let user install it or explicitly disable support) Signed-off-by: Christophe CURIS --- configure.ac | 20 +++++++++----------- m4/wm_xext_check.m4 | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 m4/wm_xext_check.m4 diff --git a/configure.ac b/configure.ac index 6130b675..efa05353 100644 --- a/configure.ac +++ b/configure.ac @@ -158,6 +158,7 @@ AS_IF([test "x$debug" = "xyes"], dnl Tracking on what is detected for final status dnl ============================================= unsupported="" +supported_xext="" supported_gfx="" @@ -490,17 +491,13 @@ AC_ARG_ENABLE(modelock, AS_HELP_STRING([--enable-modelock], [XKB keyboard langua dnl XShape support dnl ============== -shape=yes -AC_ARG_ENABLE(shape, AS_HELP_STRING([--disable-shape], [disable shaped window extension support]), - shape=$enableval, shape=yes) -added_xext=no - -if test "$shape" = yes; then - AC_CHECK_LIB(Xext, XShapeSelectInput, [XLIBS="-lXext $XLIBS" - added_xext=yes - AC_DEFINE(USE_XSHAPE, 1, [define if you want support for shaped windows (set by configure)])], - shape=no, $XLFLAGS $XLIBS) -fi +AC_ARG_ENABLE([shape], + [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])], + [AS_CASE(["$enableval"], + [yes|no], [], + [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ], + [enable_shape=auto]) +WM_XEXT_CHECK_XSHAPE dnl XRandR support dnl ============== @@ -854,6 +851,7 @@ echo "Installation path prefix : $prefix" echo "Installation path for binaries : $_bindir" echo "Installation path for libraries : $libdir" echo "Installation path for WPrefs.app : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|" +echo "Supported X extensions: :$supported_xext" echo "Supported graphic format libraries :$supported_gfx" echo "Unsupported features :$unsupported" echo "Antialiased text support in WINGs : $xft" diff --git a/m4/wm_xext_check.m4 b/m4/wm_xext_check.m4 new file mode 100644 index 00000000..e5355745 --- /dev/null +++ b/m4/wm_xext_check.m4 @@ -0,0 +1,39 @@ +# wm_xext_check.m4 - Macros to check for X extensions support libraries +# +# Copyright (c) 2013 Christophe CURIS +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# WM_XEXT_CHECK_XSHAPE +# -------------------- +# +# Check for the X Shaped Window extension +# The check depends on variable 'enable_xshape' being either: +# yes - detect, fail if not found +# no - do not detect, disable support +# auto - detect, disable if not found +# +# When found, append appropriate stuff in XLIBS, and append info to +# the variable 'supported_xext' +# When not found, append info to variable 'unsupported' +AC_DEFUN_ONCE([WM_XEXT_CHECK_XSHAPE], +[WM_LIB_CHECK([XShape], [-lXext], [XShapeSelectInput], [$XLIBS], + [wm_save_CFLAGS="$CFLAGS" + AS_IF([wm_fn_lib_try_compile "X11/extensions/shape.h" "Window win;" "XShapeSelectInput(NULL, win, 0)" ""], + [], + [AC_MSG_ERROR([found $CACHEVAR but cannot compile using XShape header])]) + CFLAGS="$wm_save_CFLAGS"], + [supported_xext], [XLIBS], [enable_shape], [-])dnl +]) dnl AC_DEFUN -- 2.11.4.GIT