From e2cfed3377aa2a46de81eea19876cbb7c69350ae Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 4 May 2019 14:58:48 +0200 Subject: [PATCH] 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. --- NEWS | 10 ++++++++++ m4/wm_xext_check.m4 | 26 ++++++++++++++++---------- wrlib/context.c | 10 ++++++++++ 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index b469a9ca..8ed766f6 100644 --- a/NEWS +++ b/NEWS @@ -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 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 Move pointer with maximized windows diff --git a/m4/wm_xext_check.m4 b/m4/wm_xext_check.m4 index cf6c70ff..8bcaf8c9 100644 --- a/m4/wm_xext_check.m4 +++ b/m4/wm_xext_check.m4 @@ -90,12 +90,11 @@ AC_DEFUN_ONCE([WM_EXT_CHECK_XMU], AS_IF([wm_fn_lib_try_link "XmuLookupStandardColormap" "-lXmu"], [wm_cv_xext_xmu="-lXmu"]) LIBS="$wm_save_LIBS" - AS_IF([test "x$wm_cv_xext_xmu" = "xno"], - [AC_MSG_ERROR([library Xmu not found])]) - dnl - dnl A library was found, check if header is available and compile - wm_save_CFLAGS="$CFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl + AS_IF([test "x$wm_cv_xext_xmu" != "xno"], + [dnl + dnl A library was found, check if header is available and compile + wm_save_CFLAGS="$CFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl @%:@include @%:@include @%:@include @@ -104,11 +103,18 @@ Display *dpy; Atom prop; ], [dnl XmuLookupStandardColormap(dpy, 0, 0, 0, prop, False, True);]) ], - [], - [AC_MSG_ERROR([found $wm_cv_xext_xmu but cannot compile with the header])]) - CFLAGS="$wm_save_CFLAGS"]) + [], + [AC_MSG_ERROR([found $wm_cv_xext_xmu but cannot compile with the header])]) + CFLAGS="$wm_save_CFLAGS"]) + ]) dnl The cached check already reported problems when not found -LIBXMU="$wm_cv_xext_xmu" +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" + supported_xext="$supported_xext Xmu"]) AC_SUBST(LIBXMU)dnl ]) diff --git a/wrlib/context.c b/wrlib/context.c index ee0b9931..8e30a63f 100644 --- a/wrlib/context.c +++ b/wrlib/context.c @@ -25,7 +25,10 @@ #include #include #include + +#ifdef HAVE_LIBXMU #include +#endif #include #include @@ -137,6 +140,7 @@ static Bool allocateStandardPseudoColor(RContext * ctx, XStandardColormap * stdc static Bool setupStandardColormap(RContext * ctx, Atom property) { +#ifdef HAVE_LIBXMU if (!XmuLookupStandardColormap(ctx->dpy, ctx->screen_number, ctx->visual->visualid, ctx->depth, property, True, True)) { RErrorCode = RERR_STDCMAPFAIL; @@ -144,6 +148,12 @@ static Bool setupStandardColormap(RContext * ctx, Atom property) return False; } return True; +#else + (void) ctx; + (void) property; + RErrorCode = RERR_STDCMAPFAIL; + return False; +#endif } static XColor *allocateColor(RContext *ctx, XColor *colors, int ncolors) -- 2.11.4.GIT