Configure: Added proper check for Xmu library for WRaster
authorChristophe CURIS <christophe.curis@free.fr>
Sun, 17 Nov 2013 17:51:21 +0000 (17 18:51 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Mon, 30 Dec 2013 18:11:06 +0000 (30 18:11 +0000)
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.curis@free.fr>
configure.ac
m4/wm_xext_check.m4

index 2f1fc71..3224f6a 100644 (file)
@@ -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],
index f5b44f3..51da16f 100644 (file)
@@ -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
 # ----------------------
 #