Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2001:
[Freeciv-Dev] PATCH: Allowing PNGs under GTK
Home

[Freeciv-Dev] PATCH: Allowing PNGs under GTK

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] PATCH: Allowing PNGs under GTK
From: "Baumans" <baumans@xxxxxxxxxxxxx>
Date: Mon, 12 Mar 2001 16:53:54 -0500

This patch enables the ability to use pngs for the gtk client. Amazingly
enough, the code to check if the system had libpng was longer (by about 9
times) than the code to actually enable its use.  This is still somewhat of
a hack. Next: PNG support for every other client.


--- configure.in.orig Mon Mar 12 15:12:33 2001
+++ configure.in Mon Mar 12 16:26:47 2001
@@ -108,6 +108,12 @@
 WITH_ZLIB="maybe"
 )

+AC_ARG_WITH(png,
+[  --with-png              use png to read some of the graphics in gtk],
+WITH_PNG=$withval,
+WITH_PNG="maybe"
+)
+
 AC_ARG_ENABLE(make_data,
 [  --disable-make-data     do not recurse make into data directories
                           (ok to disable unless you will 'make install')],
@@ -227,8 +233,29 @@
     if test "x$gtk_found" = "xyes"; then
       AM_PATH_GDK_IMLIB(1.9.2, imlib_found="yes", imlib_found="")
       if test "x$imlib_found" = "xyes"; then
+
         CLIENT_CFLAGS="$GDK_IMLIB_CFLAGS"
         CLIENT_LIBS="$GDK_IMLIB_LIBS"
+
+        dnl Got PNG?
+        if test "$WITH_PNG" = "yes"; then
+          AC_CHECK_LIB(png, png_sig_cmp, ,
+          AC_MSG_ERROR([Specified --with-png but did not find png
library.]),
+              $CLIENT_LIBS)
+          AC_CHECK_HEADER(png.h, ,
+          AC_MSG_ERROR([Specified --with-png; png found but not png.h.
+          You may need to install a png \"development\" package.]))
+          found_png=yes
+        elif test "$WITH_PNG" = "maybe"; then
+          AC_CHECK_HEADER(png.h, have_png_h=1, have_png_h=0)
+          if test "$have_png_h" = "1"; then
+            AC_CHECK_LIB(png, png_sig_cmp, found_png=yes, found_png=no,
$CLIENT_LIBS)
+          fi
+        fi
+        if test "x$found_png" = "xyes"; then
+          CLIENT_CFLAGS="$CLIENT_CFLAGS -DPNG"
+          CLIENT_LIBS="$CLIENT_LIBS -lpng"
+        fi
  found_client=yes
       fi
     fi
--- client/gui-gtk/graphics.c.orig Mon Mar 12 16:28:06 2001
+++ client/gui-gtk/graphics.c Mon Mar 12 16:28:40 2001
@@ -293,6 +293,9 @@
   static char *ext[] =
   {
     "xpm",
+#ifdef PNG
+    "png",
+#endif
     NULL
   };






[Prev in Thread] Current Thread [Next in Thread]