[AD] Configure check for X11/xpm.h and libxpm.a

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


The attached patch adds a configure check for xpm.h and encapsulates 
libxpm.a.
Applied to mainline.

Evert
Index: aclocal.m4
===================================================================
RCS file: /cvsroot/alleg/allegro/aclocal.m4,v
retrieving revision 1.64
diff -u -r1.64 aclocal.m4
--- aclocal.m4	27 Jul 2004 10:33:21 -0000	1.64
+++ aclocal.m4	6 Aug 2004 15:05:36 -0000
@@ -227,8 +227,11 @@
     [LIBS="-lXext $LIBS"])
 
   dnl Test for Xpm library.
-  AC_CHECK_LIB(Xpm, XMissingExtension,
-    [LIBS="-lXpm $LIBS"])
+  AC_CHECK_HEADER(X11/xpm.h, AC_CHECK_LIB(Xpm, XMissingExtension,
+    [LIBS="-lXpm $LIBS"
+    AC_DEFINE(ALLEGRO_XWINDOWS_WITH_XPM,1,[Define if xpm bitmap support is available.])
+    ])
+   )
 
   dnl Test for SHM extension.
   if test -n "$allegro_enable_xwin_shm"; then
Index: src/x/xwin.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xwin.c,v
retrieving revision 1.63
diff -u -r1.63 xwin.c
--- src/x/xwin.c	31 Jul 2004 06:29:42 -0000	1.63
+++ src/x/xwin.c	6 Aug 2004 15:05:40 -0000
@@ -49,7 +49,9 @@
 #endif
 
 
+#ifdef ALLEGRO_XWINDOWS_WITH_XPM
 #include <X11/xpm.h>
+#endif
 #include "alex.xpm"
 
 
@@ -2040,7 +2042,9 @@
 {
    XClassHint hint;
    XWMHints wm_hints;
+#ifdef ALLEGRO_XWINDOWS_WITH_XPM
    XpmAttributes attributes;
+#endif
 
    if (_xwin.window == None)
       return;
@@ -2058,11 +2062,13 @@
    wm_hints.initial_state = NormalState;
    wm_hints.window_group = _xwin.window;
    
+#ifdef ALLEGRO_XWINDOWS_WITH_XPM
    if (allegro_icon) {
       wm_hints.flags |= IconPixmapHint | IconMaskHint;
       attributes.valuemask = XpmReturnAllocPixels | XpmReturnExtensions;
       XpmCreatePixmapFromData(_xwin.display,_xwin.window,allegro_icon,&wm_hints.icon_pixmap,&wm_hints.icon_mask, &attributes);
    }
+#endif
 
    XSetWMHints(_xwin.display, _xwin.window, &wm_hints);
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/