From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Revision 110444 breaks the native MS-Windows build Date: Mon, 08 Oct 2012 03:20:12 -0700 Message-ID: <5072A8DC.6010208@dancol.org> References: <83y5jh4auz.fsf@gnu.org> <50729174.6070103@dancol.org> <83wqz149ot.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigB6FAE6AAB2CB5EBD48DEEC02" X-Trace: ger.gmane.org 1349691635 14009 80.91.229.3 (8 Oct 2012 10:20:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Oct 2012 10:20:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 08 12:20:41 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TLARz-00081K-Eg for ged-emacs-devel@m.gmane.org; Mon, 08 Oct 2012 12:20:39 +0200 Original-Received: from localhost ([::1]:57159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLARt-0000Yf-Cs for ged-emacs-devel@m.gmane.org; Mon, 08 Oct 2012 06:20:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:44148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLARm-0000YH-PV for emacs-devel@gnu.org; Mon, 08 Oct 2012 06:20:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLARl-0005cR-Gi for emacs-devel@gnu.org; Mon, 08 Oct 2012 06:20:26 -0400 Original-Received: from dancol.org ([96.126.100.184]:55654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLARe-0005Tg-UZ; Mon, 08 Oct 2012 06:20:19 -0400 Original-Received: from c-76-22-66-162.hsd1.wa.comcast.net ([76.22.66.162] helo=[0.0.0.0]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1TLARe-0004mh-As; Mon, 08 Oct 2012 03:20:18 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: <83wqz149ot.fsf@gnu.org> X-Enigmail-Version: 1.4.2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 96.126.100.184 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:154224 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB6FAE6AAB2CB5EBD48DEEC02 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 10/8/2012 2:03 AM, Eli Zaretskii wrote: > #if defined (HAVE_NTGUI) && !defined (WINDOWSNT) Thanks. > and in jconfig.h, a jpeglib header included by jpeglib.h, I see this: >=20 > #ifdef _WIN32 > # include > /* Define "boolean" as unsigned char, not int, per Windows custom */ > # if !defined __RPCNDR_H__ || defined __MINGW32__ /* don't conflic= t if rpcndr.h already read */ > # ifndef boolean /* don't conflict if rpcndr.h already read */ > typedef unsigned char boolean; > # endif /* boolean */ > # endif /* __RPCNDR_H__ */ > # define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */= > # define USE_WINDOWS_MESSAGEBOX 1 > #endif /* _WIN32 */ >=20 > This seems to be in perfect order, so I don't understand the conflict > you were seeing. >=20 > In any case, you cannot hope for the above to compile unless you also > typedef jpeg_boolean. My jpeglib doesn't have that code. The redefinition actually works fine = under Cygwin --- the jpeglib headers there just define a type they call "boolea= n", which, thanks to our preprocessor macro, is substituted with jpeg_boolean= =2E Presumably, my hack breaks native Windows because there jpeglib _doesn't_= define boolean. I tried replacing my hack with the approach below. It does _not_ work ---= although this patch allows Emacs to compile under both Cygwin and native Windows, it doesn't result in successful JPEG loading under Cygwin, presu= mably due to the ABI we've made the jpeglib headers declare no longer matching = the compiled libjpeg we're using. +/* rpcndr.h and jpeglib.h both define boolean types. In certain + configurations, jpeglib won't detect that rpcndr.h has already + defined a boolean type and will instead try to define its own + conflicting type. + + At this point, we know we've included windows.h and with it + rpcndr.h. First, include the jpeglib configuration file: if + jpeglib thinks the system doesn't have a boolean type, correct this + misconception before including the rest of jpeglib. + + */ +#include +#ifndef HAVE_BOOLEAN +#define HAVE_BOOLEAN 1 +#endif #include #include Instead, let's do this: +/* rpcndr.h (via windows.h) and jpeglib.h both define boolean types. + Some versions of jpeglib try to detect whether rpcndr.h is loaded, + using the Windows boolean type instead of the jpeglib boolean type + if so. Cygwin jpeglib, however, doesn't try to detect whether its + headers are included along with windows.h, so under Cygwin, jpeglib + attempts to define a conflicting boolean type. Worse, forcing + Cygwin jpeglib headers to use the Windows boolean type doesn't work + because it created an ABI incompatibility between the + already-compiled jpeg library and the header interface definition. + + The best we can do is to define jpeglib's boolean type to a + different name. This name, jpeg_boolean, remains in effect through + the rest of image.c. +*/ +#if defined (CYGWIN) && defined (HAVE_NTGUI) #define boolean jpeg_boolean +#endif #include #include --------------enigB6FAE6AAB2CB5EBD48DEEC02 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlByqOAACgkQ17c2LVA10VvwngCdGwhVyRjK3goFP1zBWzo0zADS /PsAoMg8jJLhx2B+pXm7wAQIWVr1yhrY =5oa3 -----END PGP SIGNATURE----- --------------enigB6FAE6AAB2CB5EBD48DEEC02--