]> git.webhop.me Git - lcd4linux.git/commitdiff
Image driver libgd dependancy fix
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 8 Jun 2007 04:45:16 +0000 (04:45 +0000)
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Fri, 8 Jun 2007 04:45:16 +0000 (04:45 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@803 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

config.h.in
configure
drivers.m4
drv.c
drv_Image.c

index fb06ab4aaf478fb448a043f5ff8e36e9c49635fc..69bc14c7d4fc0d2b401998eeae6981e48b63f387 100644 (file)
 /* G-15 driver */
 #undef WITH_G15
 
+/* GD library */
+#undef WITH_GD
+
 /* HD44780 driver */
 #undef WITH_HD44780
 
index eadd0292aa352eb38c16ac3c8e006e0cc1086f2e..121b2ff3dc9bfdc4c544bb9e625f28a553385a14 100755 (executable)
--- 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
index 7c7b942dbcca8317df16bc522b31fa2056a4fd81..4fed7e78732386afddea9762bd2fecd9bafde442 100644 (file)
@@ -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 ae0b5b373923e7812e6c8fe90e0700c8fc31f56e..d02ed1efd77fa1952f17d296df4399f1ebc1a96f 100644 (file)
--- 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
index 82521a7eb141138ac4cae16f5fb026f0022d3423..15be190914d285b48086bbeb56d2df52bb23b775 100644 (file)
@@ -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;
 }