changeset 435:2bdd4f5dd2ca

Make sh_text and sh_stext optional. Since sh_text depends on pango, and we want a version of MadButterfly without Pango (lite version), we make sh_text and sh_stext optional. User can choice which one to enable.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 29 Jul 2009 20:22:36 +0800
parents b5c7670b524b
children c02d2aa2c45e dae45d3c27a6
files configure.ac src/Makefile.am src/redraw_man.c
diffstat 3 files changed, 64 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Jul 29 16:35:13 2009 +0800
+++ b/configure.ac	Wed Jul 29 20:22:36 2009 +0800
@@ -35,9 +35,38 @@
 AC_FUNC_SELECT_ARGTYPES
 AC_CHECK_FUNCS([gettimeofday memset select sqrt strdup])
 
-AC_ARG_ENABLE([testcase],[enable testcase for unittest],
-	[AC_SUBST([TESTCASE],[testcase])],
-	[AC_SUBST([TESTCASE],)])
+AC_ARG_ENABLE([testcase],
+	[--enable-testcase	Turn on sh_text],
+[case "${enableval}" in
+  yes) testcase=true ;;
+  no) testcase=false ;;
+  *) AC_MSG_ERROR([bad value ${enableval} for --enable-testcase]) ;;
+esac],[testcase=false])
+AM_CONDITIONAL([TESTCASE], [test x$testcase = xtrue])
+
+AC_ARG_ENABLE([sh_text],
+	[--disable-sh_text	Turn off sh_text],
+[case "${enableval}" in
+  yes) sh_text=true ;;
+  no) sh_text=false ;;
+  *) AC_MSG_ERROR([bad value ${enableval} for --disable-sh_text]) ;;
+esac],[sh_text=true])
+AM_CONDITIONAL([SH_TEXT], [test x$sh_text = xtrue])
+[if [ x"${sh_text}" = xtrue ]; then]
+AC_DEFINE([SH_TEXT])
+[fi]
+
+AC_ARG_ENABLE([sh_stext],
+	[--disable-sh_stext	Turn off sh_stext],
+[case "${enableval}" in
+  yes) sh_stext=true ;;
+  no) sh_stext=false ;;
+  *) AC_MSG_ERROR([bad value ${enableval} for --disable-sh_stext]) ;;
+esac],[sh_stext=true])
+AM_CONDITIONAL([SH_STEXT], [test x$sh_stext = xtrue])
+[if [ x"${sh_stext}" = xtrue ]; then]
+AC_DEFINE([SH_STEXT])
+[fi]
 
 AC_CONFIG_FILES([Makefile
                  libmbfly.pc
@@ -53,4 +82,8 @@
                  include/Makefile
                  inkscape/Makefile
                  tools/Makefile])
+
+AH_TEMPLATE([SH_TEXT],[Enable sh_text object])
+AH_TEMPLATE([SH_STEXT],[Enable sh_stext object])
+
 AC_OUTPUT
--- a/src/Makefile.am	Wed Jul 29 16:35:13 2009 +0800
+++ b/src/Makefile.am	Wed Jul 29 20:22:36 2009 +0800
@@ -2,16 +2,31 @@
 
 lib_LTLIBRARIES = libmbfly.la
 
-noinst_PROGRAMS = X_main $(TESTCASE)
+noinst_PROGRAMS =
+
+if SH_TEXT
+noinst_PROGRAMS += X_main
+endif
+
+if TESTCASE
+noinst_PROGRAMS += testcase
+endif
 
 MBAF_SOURCES=mbaf/mbapp.c mbaf/mbbutton.c mbaf/mbobject.c mbaf/animated_menu.c
-libmbfly_la_SOURCES = animate.c chgcolor.c coord.c event.c geo.c	\
+libmbfly_la_SOURCES= animate.c chgcolor.c coord.c event.c geo.c	\
 	observer.c paint.c redraw_man.c rotate.c shape_path.c		\
-	shape_stext.c \
-	shape_rect.c shape_text.c shift.c subtree_free.c timer.c 	\
+	shape_rect.c shift.c subtree_free.c timer.c 			\
 	timertool.c tools.c visibility.c X_supp.c prop.c sprite.c	\
 	mouse.c shape_image.c img_ldr.c $(MBAF_SOURCES)
 
+if SH_TEXT
+libmbfly_la_SOURCES += shape_text.c
+endif
+
+if SH_STEXT
+libmbfly_la_SOURCES += shape_stext.c
+endif
+
 libmbfly_la_CPPFLAGS = @cairo_CFLAGS@ @pangocairo_CFLAGS@
 libmbfly_la_LDFLAGS = @cairo_LIBS@ @pangocairo_LIBS@
 
--- a/src/redraw_man.c	Wed Jul 29 16:35:13 2009 +0800
+++ b/src/redraw_man.c	Wed Jul 29 20:22:36 2009 +0800
@@ -9,6 +9,7 @@
 #include "mb_redraw_man.h"
 #include "mb_observer.h"
 #include "mb_prop.h"
+#include "../config.h"
 
 /* required by rdman_img_ldr_load_paint() */
 #include "mb_paint.h"
@@ -1163,18 +1164,22 @@
     case MBO_PATH:
 	sh_path_transform(shape);
 	break;
+#ifdef SH_TEXT
     case MBO_TEXT:
 	sh_text_transform(shape);
 	break;
+#endif
     case MBO_RECT:
 	sh_rect_transform(shape);
 	break;
     case MBO_IMAGE:
 	sh_image_transform(shape);
 	break;
+#ifdef SH_STEXT
     case MBO_STEXT:
 	sh_stext_transform(shape);
 	break;
+#endif
 #ifdef UNITTEST
     default:
 	sh_dummy_transform(shape);
@@ -1817,18 +1822,22 @@
 	case MBO_PATH:
 	    sh_path_draw(shape, cr);
 	    break;
+#ifdef SH_TEXT
 	case MBO_TEXT:
 	    sh_text_draw(shape, cr);
 	    break;
+#endif
 	case MBO_RECT:
 	    sh_rect_draw(shape, cr);
 	    break;
 	case MBO_IMAGE:
 	    sh_image_draw(shape, cr);
 	    break;
+#ifdef SH_STEXT
 	case MBO_STEXT:
 	    sh_stext_draw(shape, cr);
 	    break;
+#endif
 #ifdef UNITTEST
 	default:
 	    sh_dummy_fill(shape, cr);