From 684bc9f48bbd560618bb2c07f5482d28d1519644 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 8 Jun 2007 04:45:16 +0000 Subject: Image driver libgd dependancy fix git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@803 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- config.h.in | 3 +++ configure | 5 +++++ drivers.m4 | 1 + drv.c | 3 +-- drv_Image.c | 25 +++++++++++++++++++++---- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/config.h.in b/config.h.in index fb06ab4..69bc14c 100644 --- a/config.h.in +++ b/config.h.in @@ -416,6 +416,9 @@ /* G-15 driver */ #undef WITH_G15 +/* GD library */ +#undef WITH_GD + /* HD44780 driver */ #undef WITH_HD44780 diff --git a/configure b/configure index eadd029..121b2ff 100755 --- a/configure +++ b/configure @@ -8011,6 +8011,11 @@ if test "$GRAPHIC" = "yes"; then DRIVERS="$DRIVERS widget_image.o" DRVLIBS="$DRVLIBS -lgd" +cat >>confdefs.h <<\_ACEOF +#define WITH_GD 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF #define WITH_IMAGE 1 _ACEOF diff --git a/drivers.m4 b/drivers.m4 index 7c7b942..4fed7e7 100644 --- a/drivers.m4 +++ b/drivers.m4 @@ -549,6 +549,7 @@ if test "$GRAPHIC" = "yes"; then if test "$has_gd" = "true"; then DRIVERS="$DRIVERS widget_image.o" DRVLIBS="$DRVLIBS -lgd" + AC_DEFINE(WITH_GD, 1, [GD library]) AC_DEFINE(WITH_IMAGE, 1, [image widget]) fi fi diff --git a/drv.c b/drv.c index ae0b5b3..d02ed1e 100644 --- a/drv.c +++ b/drv.c @@ -110,7 +110,7 @@ DRIVER *Driver[] = { #ifdef WITH_HD44780 &drv_HD44780, #endif -#if (defined (WITH_PNG) || defined(WITH_PPM)) && defined(WITH_GD) +#if (defined(WITH_PNG) && defined(WITH_GD)) || defined(WITH_PPM) &drv_Image, #endif #ifdef WITH_LCD2USB @@ -149,7 +149,6 @@ DRIVER *Driver[] = { #ifdef WITH_picoLCD &drv_picoLCD, #endif - #ifdef WITH_ROUTERBOARD &drv_RouterBoard, #endif diff --git a/drv_Image.c b/drv_Image.c index 82521a7..15be190 100644 --- a/drv_Image.c +++ b/drv_Image.c @@ -80,7 +80,7 @@ static char Name[] = "Image"; -static enum { PPM, PNG } Format; +static enum { NIL, PPM, PNG } Format; static int pixel = -1; /* pointsize in pixel */ static int pgap = 0; /* gap between points */ @@ -266,6 +266,8 @@ static void drv_IMG_flush(void) drv_IMG_flush_PNG(); #endif break; + default: + break; } } @@ -315,11 +317,21 @@ static int drv_IMG_start(const char *section) return -1; } + Format = NIL; + +#ifdef WITH_PPM if (strcmp(s, "PPM") == 0) { Format = PPM; - } else if (strcmp(s, "PNG") == 0) { + } +#endif + +#ifdef WITH_PNG + if (strcmp(s, "PNG") == 0) { Format = PNG; - } else { + } +#endif + + if (Format == NIL) { error("%s: bad %s.Format '%s' from %s", Name, section, s, cfg_source()); free(s); return -1; @@ -411,7 +423,12 @@ static int drv_IMG_start(const char *section) /* list models */ int drv_IMG_list(void) { - printf("PPM PNG"); +#ifdef WITH_PPM + printf("PPM "); +#endif +#ifdef WITH_PNG + printf("PNG "); +#endif return 0; } -- cgit v1.2.3