From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#30431: 27.0.50; "Work even if libpng is install in /usr/local" causes build failure Date: Mon, 12 Feb 2018 16:42:45 -0800 Organization: UCLA Computer Science Department Message-ID: <0e2b60fc-396d-d802-a090-7b856edc008c@cs.ucla.edu> References: <87y3jypw87.fsf@cochranmail.com> <90f70518-cdff-d8b6-de82-6e406947d5d4@cs.ucla.edu> <20180212.223132.979071447450060549.wl@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------330D51B412AE486F4993DA21" X-Trace: blaine.gmane.org 1518482486 16526 195.159.176.226 (13 Feb 2018 00:41:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 13 Feb 2018 00:41:26 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: 30431@debbugs.gnu.org To: Werner LEMBERG Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 13 01:41:22 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elOei-00036U-0Q for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 Feb 2018 01:41:08 +0100 Original-Received: from localhost ([::1]:46257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elOgj-0002V8-Jj for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Feb 2018 19:43:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elOgb-0002UG-93 for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2018 19:43:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elOgY-0006dB-Kz for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2018 19:43:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60606) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elOgY-0006d7-GN for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2018 19:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1elOgY-000198-9j for bug-gnu-emacs@gnu.org; Mon, 12 Feb 2018 19:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Feb 2018 00:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30431 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30431-submit@debbugs.gnu.org id=B30431.15184825794397 (code B ref 30431); Tue, 13 Feb 2018 00:43:02 +0000 Original-Received: (at 30431) by debbugs.gnu.org; 13 Feb 2018 00:42:59 +0000 Original-Received: from localhost ([127.0.0.1]:40270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elOgU-00018r-Pw for submit@debbugs.gnu.org; Mon, 12 Feb 2018 19:42:59 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:45892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1elOgS-00018Z-56 for 30431@debbugs.gnu.org; Mon, 12 Feb 2018 19:42:57 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 474EE160156; Mon, 12 Feb 2018 16:42:50 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 7uHfgGBTfWLC; Mon, 12 Feb 2018 16:42:45 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D8C7616017C; Mon, 12 Feb 2018 16:42:45 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UMbW0-pjj22z; Mon, 12 Feb 2018 16:42:45 -0800 (PST) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id BB449160156; Mon, 12 Feb 2018 16:42:45 -0800 (PST) In-Reply-To: <20180212.223132.979071447450060549.wl@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143235 Archived-At: This is a multi-part message in MIME format. --------------330D51B412AE486F4993DA21 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 02/12/2018 01:31 PM, Werner LEMBERG wrote: >>> - if test $HAVE_PNG = no; then >>> + if test $HAVE_PNG = yes; then >>> + LIBPNG="$PNG_LIBS" >>> + else >> Thanks, Glenn. Werner, does that work for you? > It works just fine, thanks! > > > Werner Thanks for checking. I installed the attached patch, which attempts to implement Glenn's suggestion. --------------330D51B412AE486F4993DA21 Content-Type: text/x-patch; name="0001-Work-if-libpng-is-in-usr-local-2nd-try.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Work-if-libpng-is-in-usr-local-2nd-try.patch" >From 52d34fbc84c1d87a41c435a0db9494d768ebc667 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 12 Feb 2018 16:39:56 -0800 Subject: [PATCH] Work if libpng is in /usr/local (2nd try) Problem reported by Werner Lemberg in: https://lists.gnu.org/r/emacs-devel/2018-02/msg00304.html with a further fix suggested by Glenn Morris in Bug#30431#14. * configure.ac: Try pkg-config before libpng-config. Adjust LIBPNG accordingly, and append -lz regardless of whether it was pkg-config. --- configure.ac | 75 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/configure.ac b/configure.ac index f2a8332d71..cb452e053b 100644 --- a/configure.ac +++ b/configure.ac @@ -3612,39 +3612,48 @@ AC_DEFUN if test "$opsys" = mingw32; then AC_CHECK_HEADER([png.h], [HAVE_PNG=yes]) elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then - AC_MSG_CHECKING([for png]) - png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` && - png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || { - # libpng-config does not work; configure by hand. - # Debian unstable as of July 2003 has multiple libpngs, and puts png.h - # in /usr/include/libpng. - if test -r /usr/include/libpng/png.h && - test ! -r /usr/include/png.h; then - png_cflags=-I/usr/include/libpng - else - png_cflags= - fi - png_ldflags='-lpng' - } - SAVE_CFLAGS=$CFLAGS - SAVE_LIBS=$LIBS - CFLAGS="$CFLAGS $png_cflags" - LIBS="$png_ldflags -lz -lm $LIBS" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[return !png_get_channels (0, 0);]])], - [HAVE_PNG=yes - PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"` - LIBPNG=$png_ldflags - # $LIBPNG requires explicit -lz in some cases. - # We don't know what those cases are, exactly, so play it safe and - # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ. - if test -n "$LIBPNG" && test -z "$LIBZ"; then - LIBPNG="$LIBPNG -lz" - fi]) - CFLAGS=$SAVE_CFLAGS - LIBS=$SAVE_LIBS - AC_MSG_RESULT([$HAVE_PNG]) + EMACS_CHECK_MODULES([PNG], [libpng >= 1.0.0]) + if test $HAVE_PNG = yes; then + LIBPNG=$PNG_LIBS + else + # Test old way in case pkg-config doesn't have it (older machines). + AC_MSG_CHECKING([for libpng not configured by pkg-config]) + + png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` && + png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || { + # libpng-config does not work; configure by hand. + # Debian unstable as of July 2003 has multiple libpngs, and puts png.h + # in /usr/include/libpng. + if test -r /usr/include/libpng/png.h && + test ! -r /usr/include/png.h; then + png_cflags=-I/usr/include/libpng + else + png_cflags= + fi + png_ldflags='-lpng' + } + SAVE_CFLAGS=$CFLAGS + SAVE_LIBS=$LIBS + CFLAGS="$CFLAGS $png_cflags" + LIBS="$png_ldflags -lz -lm $LIBS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[return !png_get_channels (0, 0);]])], + [HAVE_PNG=yes + PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"` + LIBPNG=$png_ldflags]) + CFLAGS=$SAVE_CFLAGS + LIBS=$SAVE_LIBS + AC_MSG_RESULT([$HAVE_PNG]) + fi + + # $LIBPNG requires explicit -lz in some cases. + # We don't know what those cases are, exactly, so play it safe and + # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ. + case " $LIBPNG ",$LIBZ in + *' -lz '*, | *' ',?*) ;; + *) LIBPNG="$LIBPNG -lz" ;; + esac fi fi if test $HAVE_PNG = yes; then -- 2.14.3 --------------330D51B412AE486F4993DA21--