1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

Do not stop compilation if library Xmu is not found

We use only 1 function from this library, and it is in a case that should
be rare nowadays: displays with indexed color.
This commit makes it acceptable to compile if the library is missing.
This commit is contained in:
Christophe CURIS
2019-05-04 14:58:48 +02:00
committed by Carlos R. Mafra
parent 4665972175
commit e2cfed3377
3 changed files with 36 additions and 10 deletions

10
NEWS
View File

@@ -12,6 +12,16 @@ which defaulted to ~/GNUstep. However, this environment variable was deprecated
in gnustep-make v2. Therefore, it has been replaced by the WMAKER_USER_ROOT in gnustep-make v2. Therefore, it has been replaced by the WMAKER_USER_ROOT
environment variable. environment variable.
libXmu is now an optional dependency
------------------------------------
If the library is not found, compilation work, the only limitation will arise
when trying to install the standard colormap on displays which are not TrueColor.
Please note that if you have the library but not the headers, configure will
still stop; there is no user option to explicitly disable the library use.
-- 0.95.8 -- 0.95.8
Move pointer with maximized windows Move pointer with maximized windows

View File

@@ -90,9 +90,8 @@ AC_DEFUN_ONCE([WM_EXT_CHECK_XMU],
AS_IF([wm_fn_lib_try_link "XmuLookupStandardColormap" "-lXmu"], AS_IF([wm_fn_lib_try_link "XmuLookupStandardColormap" "-lXmu"],
[wm_cv_xext_xmu="-lXmu"]) [wm_cv_xext_xmu="-lXmu"])
LIBS="$wm_save_LIBS" LIBS="$wm_save_LIBS"
AS_IF([test "x$wm_cv_xext_xmu" = "xno"], AS_IF([test "x$wm_cv_xext_xmu" != "xno"],
[AC_MSG_ERROR([library Xmu not found])]) [dnl
dnl
dnl A library was found, check if header is available and compile dnl A library was found, check if header is available and compile
wm_save_CFLAGS="$CFLAGS" wm_save_CFLAGS="$CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
@@ -107,8 +106,15 @@ Atom prop;
[], [],
[AC_MSG_ERROR([found $wm_cv_xext_xmu but cannot compile with the header])]) [AC_MSG_ERROR([found $wm_cv_xext_xmu but cannot compile with the header])])
CFLAGS="$wm_save_CFLAGS"]) CFLAGS="$wm_save_CFLAGS"])
])
dnl The cached check already reported problems when not found dnl The cached check already reported problems when not found
AS_IF([test "wm_cv_xext_xmu" = "xno"],
[LIBXMU=""
unsupported="$unsupported Xmu"],
[AC_DEFINE([HAVE_LIBXMU], [1],
[defined when the libXmu library was found])
LIBXMU="$wm_cv_xext_xmu" LIBXMU="$wm_cv_xext_xmu"
supported_xext="$supported_xext Xmu"])
AC_SUBST(LIBXMU)dnl AC_SUBST(LIBXMU)dnl
]) ])

View File

@@ -25,7 +25,10 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#ifdef HAVE_LIBXMU
#include <X11/Xmu/StdCmap.h> #include <X11/Xmu/StdCmap.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -137,6 +140,7 @@ static Bool allocateStandardPseudoColor(RContext * ctx, XStandardColormap * stdc
static Bool setupStandardColormap(RContext * ctx, Atom property) static Bool setupStandardColormap(RContext * ctx, Atom property)
{ {
#ifdef HAVE_LIBXMU
if (!XmuLookupStandardColormap(ctx->dpy, ctx->screen_number, if (!XmuLookupStandardColormap(ctx->dpy, ctx->screen_number,
ctx->visual->visualid, ctx->depth, property, True, True)) { ctx->visual->visualid, ctx->depth, property, True, True)) {
RErrorCode = RERR_STDCMAPFAIL; RErrorCode = RERR_STDCMAPFAIL;
@@ -144,6 +148,12 @@ static Bool setupStandardColormap(RContext * ctx, Atom property)
return False; return False;
} }
return True; return True;
#else
(void) ctx;
(void) property;
RErrorCode = RERR_STDCMAPFAIL;
return False;
#endif
} }
static XColor *allocateColor(RContext *ctx, XColor *colors, int ncolors) static XColor *allocateColor(RContext *ctx, XColor *colors, int ncolors)