changeset 694:7e64e0f70cb6

Switch XSHM with autoconf
author Thinker K.F. Li <thinker@branda.to>
date Mon, 09 Aug 2010 12:03:46 +0800
parents 8b7964869f7a
children 6ddc8b42188f
files configure.ac nodejs/Makefile.am src/Makefile.am src/X_supp.c
diffstat 4 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Aug 09 10:03:54 2010 +0800
+++ b/configure.ac	Mon Aug 09 12:03:46 2010 +0800
@@ -81,6 +81,14 @@
             (*) AC_MSG_ERROR([bad value ${enableval} for --enable-skia]) ;;
         esac],[skia=false])
 
+AC_ARG_ENABLE([xshm],
+	[AS_HELP_STRING([--disable-xshm],[Turn off XSHM supporting])],
+	[case "${enableval}" in
+	    (yes) xshm=true ;;
+	    (no) xshm=false ;;
+	    (*) AC_MSG_ERROR([bad value ${enableval} for --disable-xshm]) ;;
+	esac], [xshm=true])
+
 AM_CONDITIONAL([SKIA_GRAPH_ENGINE], [test x$skia = xtrue])
 AM_CONDITIONAL([CAIRO_GRAPH_ENGINE], [test x$skia != xtrue])
 
@@ -129,6 +137,12 @@
     AC_DEFINE([DFB_BACKEND])
 [fi]
 
+AM_CONDITIONAL([XSHM], [test x"${xshm}" = xtrue -a x"${cairo}" = xtrue -a x$backend = x'X'])
+
+[if [ x"${xshm}" = xtrue -a x"${cairo}" = xtrue -a x$backend = x'X' ]; then]
+    AC_DEFINE([XSHM])
+[fi]
+
 # Checks for libraries.
 
 [if [ x"${cairo}" = xtrue ]; then]
@@ -162,5 +176,6 @@
 AH_TEMPLATE([CAIRO_GRAPH_ENGINE], [Enable Cairo Graphic Engine])
 AH_TEMPLATE([X_BACKEND], [Enable X backend])
 AH_TEMPLATE([DFB_BACKEND], [Enable DirectFB backend])
+AH_TEMPLATE([XSHM], [Enable XSHM])
 
 AC_OUTPUT
--- a/nodejs/Makefile.am	Mon Aug 09 10:03:54 2010 +0800
+++ b/nodejs/Makefile.am	Mon Aug 09 12:03:46 2010 +0800
@@ -5,7 +5,11 @@
 	-I$(abs_top_srcdir)/include \
 	-I$(prefix)/include \
 	@pangocairo_CFLAGS@ $(CFLAGS)
-mbfly_node_LDFLAGS = -L$(abs_top_builddir)/src/.libs @pangocairo_LIBS@ -lXext
+mbfly_node_LDFLAGS = -L$(abs_top_builddir)/src/.libs @pangocairo_LIBS@
+
+if XSHM
+mbfly_node_LDFLAGS += -lXext
+endif
 
 all: mbfly.node
 clean: clean-mbfly-node
--- a/src/Makefile.am	Mon Aug 09 10:03:54 2010 +0800
+++ b/src/Makefile.am	Mon Aug 09 12:03:46 2010 +0800
@@ -36,11 +36,17 @@
 libmbfly_la_SOURCES += X_supp.c
 endif
 
+libmbfly_la_LDFLAGS =
+
 if CAIRO_GRAPH_ENGINE
 libmbfly_la_SOURCES += graph_engine_cairo.c
 
 libmbfly_la_CPPFLAGS = @cairo_CFLAGS@ @pangocairo_CFLAGS@
-libmbfly_la_LDFLAGS = @cairo_LIBS@ @pangocairo_LIBS@ -lXext
+libmbfly_la_LDFLAGS += @cairo_LIBS@ @pangocairo_LIBS@
+endif
+
+if XSHM
+libmbfly_la_LDFLAGS += -lXext
 endif
 
 if SKIA_GRAPH_ENGINE
--- a/src/X_supp.c	Mon Aug 09 10:03:54 2010 +0800
+++ b/src/X_supp.c	Mon Aug 09 12:03:46 2010 +0800
@@ -8,8 +8,7 @@
 #include "mb_redraw_man.h"
 #include "mb_timer.h"
 #include "mb_X_supp.h"
-
-#define XSHM 1
+#include "config.h"
 
 #ifdef XSHM
 /* \sa http://www.xfree86.org/current/mit-shm.html */