From: Christophe CURIS <christophe.cu...@free.fr>

The original code supposed that the library was available and ready to use.
As it may not be the case (modern distro generally don't include dev files
by defaults), add a the appropriate checks to make sure WRaster compilation
will not fail later.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 configure.ac        |  7 +++++--
 m4/wm_xext_check.m4 | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2f1fc71..3224f6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -451,8 +451,6 @@ X_LIBRARY_PATH=$x_libraries
 XCFLAGS="$X_CFLAGS"
 XLFLAGS="$X_LIBS"
 XLIBS="-lX11 $X_EXTRA_LIBS"
-LIBXMU="-lXmu"
-AC_SUBST(LIBXMU)
 
 lib_search_path="$lib_search_path $XLFLAGS"
 inc_search_path="$inc_search_path $XCFLAGS"
@@ -509,6 +507,11 @@ AC_ARG_ENABLE([shm],
     [enable_shm=auto])
 WM_XEXT_CHECK_XSHM
 
+dnl X Misceleanous Utility
+dnl ======================
+# the libXmu is used in WRaster
+WM_EXT_CHECK_XMU
+
 dnl XINERAMA support
 dnl ================
 AC_ARG_ENABLE([xinerama],
diff --git a/m4/wm_xext_check.m4 b/m4/wm_xext_check.m4
index f5b44f3..51da16f 100644
--- a/m4/wm_xext_check.m4
+++ b/m4/wm_xext_check.m4
@@ -75,6 +75,44 @@ AC_DEFUN_ONCE([WM_XEXT_CHECK_XSHM],
 ]) dnl AC_DEFUN
 
 
+# WM_XEXT_CHECK_XMU
+# -----------------
+#
+# Check for the libXmu (X Misceleanous Utilities)
+# When found, append it to LIBXMU
+# When not found, generate an error because we have no work-around for it
+AC_DEFUN_ONCE([WM_EXT_CHECK_XMU],
+[AC_CACHE_CHECK([for Xmu library], [wm_cv_xext_xmu],
+    [wm_cv_xext_xmu=no
+     dnl
+     dnl We check that the library is available
+     wm_save_LIBS="$LIBS"
+     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
+@%:@include <X11/Xlib.h>
+@%:@include <X11/Xutil.h>
+@%:@include <X11/Xmu/StdCmap.h>
+
+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"])
+dnl The cached check already reported problems when not found
+LIBXMU="$wm_cv_xext_xmu"
+AC_SUBST(LIBXMU)dnl
+])
+
+
 # WM_XEXT_CHECK_XINERAMA
 # ----------------------
 #
-- 
1.8.4.rc3


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to