From xemacs-m  Fri Dec  6 03:33:21 1996
Received: from venus.Sun.COM (venus.Sun.COM [192.9.25.5]) by xemacs.cs.uiuc.edu (8.8.3/8.8.3) with SMTP id DAA09643 for <xemacs-beta@xemacs.org>; Fri, 6 Dec 1996 03:33:20 -0600 (CST)
Received: from Eng.Sun.COM ([129.146.1.25]) by venus.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id BAA23643; Fri, 6 Dec 1996 01:32:51 -0800
Received: from kindra.eng.sun.com by Eng.Sun.COM (SMI-8.6/SMI-5.3)
	id BAA24909; Fri, 6 Dec 1996 01:32:50 -0800
Received: from xemacs.eng.sun.com by kindra.eng.sun.com (SMI-8.6/SMI-SVR4)
	id BAA23096; Fri, 6 Dec 1996 01:32:49 -0800
Received: by xemacs.eng.sun.com (SMI-8.6/SMI-SVR4)
	id BAA03911; Fri, 6 Dec 1996 01:32:45 -0800
Date: Fri, 6 Dec 1996 01:32:45 -0800
Message-Id: <199612060932.BAA03911@xemacs.eng.sun.com>
From: Martin Buchholz <mrb@Eng.Sun.COM>
To: Steven L Baur <steve@miranova.com>
Cc: xemacs-beta@xemacs.org
Subject: Re: b30 success
In-Reply-To: <m2sp5knsna.fsf@altair.xemacs.org>
References: <199612052210.RAA20759@nvwls.cc.purdue.edu>
	<m2ral4plfg.fsf@altair.xemacs.org>
	<199612060443.UAA03346@xemacs.eng.sun.com>
	<m2sp5knsna.fsf@altair.xemacs.org>
Reply-To: Martin Buchholz <mrb@Eng.Sun.COM>
Mime-Version: 1.0 (generated by tm-edit 7.94)
Content-Type: text/plain; charset=US-ASCII

>>>>> "Steven" == Steven L Baur <steve@miranova.com> writes:

Steven> Here is the pertinent output from `./configure ... --extra-verbose':
Steven> checking for png.h
Steven> checking for -lpng

Steven> /usr/lib/libpng.so: undefined reference to `deflate'
Steven> /usr/lib/libpng.so: undefined reference to `inflate'
Steven> /usr/lib/libpng.so: undefined reference to `inflateInit_'
Steven> /usr/lib/libpng.so: undefined reference to `deflateInit2_'
Steven> /usr/lib/libpng.so: undefined reference to `inflateReset'
Steven> /usr/lib/libpng.so: undefined reference to `deflateReset'
Steven> /usr/lib/libpng.so: undefined reference to `inflateEnd'
Steven> /usr/lib/libpng.so: undefined reference to `deflateEnd'

I bet if you built a static libpng, it would work.  Recommended as it
makes the binary more portable.  But yes, this is a configure bug.

This is one thing that gets fixed by upgrading to autoconf 2.  Its
AC_CHECK_LIB leads us to the promised land of library detection.  In
particular, one can specify other libraries.

 - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
          ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
     Try to ensure that C function FUNCTION is available by checking
     whether a test C program can be linked with the library LIBRARY to
     get the function.  LIBRARY is the base name of the library; e.g.,
     to check for `-lmp', use `mp' as the LIBRARY argument.

     ACTION-IF-FOUND is a list of shell commands to run if the link
     with the library succeeds; ACTION-IF-NOT-FOUND is a list of shell
     commands to run if the link fails.  If ACTION-IF-FOUND and
     ACTION-IF-NOT-FOUND are not specified, the default action is to
     add `-lLIBRARY' to `LIBS' and define `HAVE_LIBLIBRARY' (in all
     capitals).

     If linking with LIBRARY results in unresolved symbols, which would
     be resolved by linking with additional libraries, give those
     libraries as the OTHER-LIBRARIES argument, separated by spaces:
     `-lXt -lX11'.  Otherwise this macro will fail to detect that
     LIBRARY is present, because linking the test program will always
     fail with unresolved symbols.

Perhaps the following code works (untested):

test -z "${with_png}" && { AC_HAVE_LIBRARY(-lpng -lz,  with_png="yes"}
test -z "${with_png}" && { AC_HAVE_LIBRARY(-lpng -lgz, with_png="gnus"}
test -z "${with_png}" && with_png="no"

Martin

