From xemacs-m  Sat Jan 25 14:02:08 1997
Received: from arioch.tng.oche.de (qmailr@s2m187.dialup.RWTH-Aachen.DE [137.226.3.187])
          by xemacs.org (8.8.4/8.8.4) with SMTP
	  id OAA00024 for <xemacs-beta@xemacs.org>; Sat, 25 Jan 1997 14:02:05 -0600 (CST)
Received: (qmail 28275 invoked by uid 500); 25 Jan 1997 19:38:54 -0000
To: xemacs-beta@xemacs.org
Cc: xemacs-beta-patches@xemacs.org
Subject: Patch for autodetection of PNG
Mime-Version: 1.0 (generated by tm-edit 7.100)
Content-Type: multipart/mixed;
 boundary="Multipart_Sat_Jan_25_20:38:53_1997-1"
Content-Transfer-Encoding: 7bit
From: Carsten Leonhardt <leo@arioch.tng.oche.de>
Date: 25 Jan 1997 20:38:53 +0100
Message-ID: <m3d8uttuia.fsf@arioch.tng.oche.de>
Lines: 56
X-Mailer: Red Gnus v0.82/XEmacs 20.0

--Multipart_Sat_Jan_25_20:38:53_1997-1
Content-Type: text/plain; charset=US-ASCII

This patches configure.in so that PNG is autodetected. The problem was
that -lpng won't link unless either -lz or -lgz is linked, too. PNG
also relies on the presence of the function "pow"; I added a test for
that, too (makes me wonder if XEmacs would build without libm...).

Note that I couldn't find the libgz anywhere, so I couldn't test that
case. Could someone point me to it?


--Multipart_Sat_Jan_25_20:38:53_1997-1
Content-Type: text/plain; charset=US-ASCII

cd /mnt/adisk/src/xt/xemacs-20.0-b91/
diff -c /mnt/adisk/src/xt/xemacs-20.0-b91/configure.in.orig /mnt/adisk/src/xt/xemacs-20.0-b91/configure.in
*** /mnt/adisk/src/xt/xemacs-20.0-b91/configure.in.orig	Sat Jan 25 18:34:38 1997
--- /mnt/adisk/src/xt/xemacs-20.0-b91/configure.in	Sat Jan 25 20:03:40 1997
***************
*** 2460,2469 ****
      exit 1
    fi
  fi
  test -z "${with_png}" && { AC_HEADER_CHECK(png.h, , with_png="no") }
! test -z "${with_png}" && { AC_HAVE_LIBRARY(-lpng, , with_png="no") }
! test -z "${with_png}" && { AC_HAVE_LIBRARY(-lz,  with_png="yes") }
! test -z "${with_png}" && { AC_HAVE_LIBRARY(-lgz, with_png="gnuz", with_png="no") }
  case "${with_png}" in
    yes  ) AC_DEFINE(HAVE_PNG) ;;
    gnuz ) AC_DEFINE(HAVE_PNG) AC_DEFINE(HAVE_PNG_GNUZ) ;;
--- 2460,2481 ----
      exit 1
    fi
  fi
+ # png depends on libz/libgz and the function "pow" while linking
  test -z "${with_png}" && { AC_HEADER_CHECK(png.h, , with_png="no") }
! test -z "${with_png}" && { AC_FUNC_CHECK(pow, , with_png="no") }
! if test -z "${with_png}" ; then
!   AC_HAVE_LIBRARY(-lz, with_png="yes")
!   test -z "${with_png}" && { AC_HAVE_LIBRARY(-lgz, with_png="gnuz", with_png="no") }
!   if test "${with_png}" != "no"; then
!     png_save_libs="${LIBS}"
!     case "${with_png}" in
!       yes  ) LIBS="${LIBS} -lz" ;;
!       gnuz ) LIBS="${LIBS} -lgz" ;;
!     esac
!     AC_HAVE_LIBRARY(-lpng, , with_png="no")
!     LIBS="$png_save_libs"
!   fi
! fi
  case "${with_png}" in
    yes  ) AC_DEFINE(HAVE_PNG) ;;
    gnuz ) AC_DEFINE(HAVE_PNG) AC_DEFINE(HAVE_PNG_GNUZ) ;;

--Multipart_Sat_Jan_25_20:38:53_1997-1--

