Commit | Line | Data |
---|---|---|
68cb962a JN |
1 | Two patches here backporting fixes from Emacs master. |
2 | ||
3 | Upstream status: emailed first patch to latest committer, Robin Templeton | |
4 | <robin@igalia.com>, no response. | |
5 | ||
6 | From dfcb3b6ff318e47b84a28cfc43f50bec42fa3570 Mon Sep 17 00:00:00 2001 | |
7 | From: Jan Nieuwenhuizen <janneke@gnu.org> | |
8 | Date: Tue, 7 Nov 2017 18:48:03 +0100 | |
9 | Subject: [PATCH 1/2] backport: Port jpeg configuration to Solaris 10 with Sun | |
10 | C. | |
11 | ||
12 | * configure.ac: Check for jpeglib 6b by trying to link it, instead | |
13 | of relying on cpp magic that has problems in practice. Check for | |
14 | both jpeglib.h and jerror.h features. Remove special case for | |
15 | mingw32, which should no longer be needed (and if it were needed, | |
16 | should now be addressable by hotwiring emacs_cv_jpeglib). | |
17 | Fixes: bug#20332 | |
18 | ||
19 | From fdf532b9c915ad9ba72155646d29d0f530fd72ec Mon Sep 17 00:00:00 2001 | |
20 | From: Paul Eggert <address@hidden> | |
21 | Date: Wed, 15 Apr 2015 18:30:01 -0700 | |
22 | Subject: [PATCH] Port jpeg configuration to Solaris 10 with Sun C. | |
23 | ||
24 | * configure.ac: Check for jpeglib 6b by trying to link it, instead | |
25 | of relying on cpp magic that has problems in practice. Check for | |
26 | both jpeglib.h and jerror.h features. Remove special case for | |
27 | mingw32, which should no longer be needed (and if it were needed, | |
28 | should now be addressable by hotwiring emacs_cv_jpeglib). | |
29 | Fixes: bug#20332 | |
30 | --- | |
31 | configure.ac | 72 ++++++++++++++++++++++++++++-------------------------------- | |
32 | 1 file changed, 34 insertions(+), 38 deletions(-) | |
33 | ||
34 | diff --git a/configure.ac b/configure.ac | |
35 | index 2445db4886..36fa8eb390 100644 | |
36 | --- a/configure.ac | |
37 | +++ b/configure.ac | |
38 | @@ -3014,44 +3014,40 @@ AC_SUBST(LIBXPM) | |
39 | ### mingw32 doesn't use -ljpeg, since it loads the library dynamically. | |
40 | HAVE_JPEG=no | |
41 | LIBJPEG= | |
42 | -if test "${opsys}" = "mingw32"; then | |
43 | - if test "${with_jpeg}" != "no"; then | |
44 | - dnl Checking for jpeglib.h can lose because of a redefinition of | |
45 | - dnl HAVE_STDLIB_H. | |
46 | - AC_CHECK_HEADER(jerror.h, HAVE_JPEG=yes, HAVE_JPEG=no) | |
47 | - fi | |
48 | - AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl | |
49 | - if test "${HAVE_JPEG}" = "yes"; then | |
50 | - AC_DEFINE(HAVE_JPEG) | |
51 | - AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])], | |
52 | - [#include <jpeglib.h> | |
53 | - version=JPEG_LIB_VERSION | |
54 | -], | |
55 | - [AC_DEFINE(HAVE_JPEG)], | |
56 | - [AC_MSG_WARN([libjpeg found, but not version 6b or later]) | |
57 | - HAVE_JPEG=no]) | |
58 | - fi | |
59 | -elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then | |
60 | - if test "${with_jpeg}" != "no"; then | |
61 | - dnl Checking for jpeglib.h can lose because of a redefinition of | |
62 | - dnl HAVE_STDLIB_H. | |
63 | - AC_CHECK_HEADER(jerror.h, | |
64 | - [AC_CHECK_LIB(jpeg, jpeg_destroy_compress, HAVE_JPEG=yes)]) | |
65 | - fi | |
66 | - | |
67 | - AH_TEMPLATE(HAVE_JPEG, [Define to 1 if you have the jpeg library (-ljpeg).])dnl | |
68 | - if test "${HAVE_JPEG}" = "yes"; then | |
69 | - AC_DEFINE(HAVE_JPEG) | |
70 | - AC_EGREP_CPP([version= *(6[2-9]|[7-9][0-9])], | |
71 | - [#include <jpeglib.h> | |
72 | - version=JPEG_LIB_VERSION | |
73 | -], | |
74 | - [AC_DEFINE(HAVE_JPEG)], | |
75 | - [AC_MSG_WARN([libjpeg found, but not version 6b or later]) | |
76 | - HAVE_JPEG=no]) | |
77 | - fi | |
78 | - if test "${HAVE_JPEG}" = "yes"; then | |
79 | - LIBJPEG=-ljpeg | |
80 | +if test "${with_jpeg}" != "no"; then | |
81 | + AC_CACHE_CHECK([for jpeglib 6b or later], | |
82 | + [emacs_cv_jpeglib], | |
83 | + [OLD_LIBS=$LIBS | |
84 | + for emacs_cv_jpeglib in yes -ljpeg no; do | |
85 | + case $emacs_cv_jpeglib in | |
86 | + yes) ;; | |
87 | + no) break;; | |
88 | + *) LIBS="$LIBS $emacs_cv_jpeglib";; | |
89 | + esac | |
90 | + AC_LINK_IFELSE( | |
91 | + [AC_LANG_PROGRAM( | |
92 | + [[#undef HAVE_STDLIB_H /* Avoid config.h/jpeglib.h collision. */ | |
93 | + #include <stdio.h> /* jpeglib.h needs FILE and size_t. */ | |
94 | + #include <jpeglib.h> | |
95 | + #include <jerror.h> | |
96 | + char verify[JPEG_LIB_VERSION < 62 ? -1 : 1]; | |
97 | + struct jpeg_decompress_struct cinfo; | |
98 | + ]], | |
99 | + [[ | |
100 | + jpeg_create_decompress (&cinfo); | |
101 | + WARNMS (&cinfo, JWRN_JPEG_EOF); | |
102 | + jpeg_destroy_decompress (&cinfo); | |
103 | + ]])], | |
104 | + [emacs_link_ok=yes], | |
105 | + [emacs_link_ok=no]) | |
106 | + LIBS=$OLD_LIBS | |
107 | + test $emacs_link_ok = yes && break | |
108 | + done]) | |
109 | + if test "$emacs_cv_jpeglib" != no; then | |
110 | + HAVE_JPEG=yes | |
111 | + AC_DEFINE([HAVE_JPEG], 1, | |
112 | + [Define to 1 if you have the jpeg library (typically -ljpeg).]) | |
113 | + test "$emacs_cv_jpeglib" != yes && LIBJPEG=$emacs_cv_jpeglib | |
114 | fi | |
115 | fi | |
116 | AC_SUBST(LIBJPEG) | |
117 | -- | |
118 | Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org | |
119 | Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com | |
120 | ||
121 | From f761b92d520b72954be28ad66eb82d1a96c785fb Mon Sep 17 00:00:00 2001 | |
122 | From: Jan Nieuwenhuizen <janneke@gnu.org> | |
123 | Date: Wed, 8 Nov 2017 14:05:43 +0100 | |
124 | Subject: [PATCH 2/2] backport fix for #24065: calloc loop when compiling with | |
125 | -O2. | |
126 | ||
127 | This patch fixes | |
128 | ||
129 | EMACSLOADPATH= '../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp -l autoload \ | |
130 | --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \ | |
131 | --eval "(setq generated-autoload-file (expand-file-name | |
132 | (unmsys--file-name | |
133 | \"../../git-checkout/lisp/calendar/cal-loaddefs.el\")))" \ | |
134 | -f batch-update-autoloads ../../git-checkout/lisp/calendar | |
135 | make[2]: *** [Makefile:466: ../../git-checkout/lisp/calendar/cal-loaddefs.el] Segmentation fault | |
136 | ||
137 | in gdb seen as | |
138 | ||
139 | in calloc (nmemb=<error reading variable: DWARF-2 expression error:Loop detected (257).>, size=size@entry=1) at gmalloc.c:1510 | |
140 | ||
141 | I did not find malloc-fixing commits from emacs master to cleanly | |
142 | cherry-pick, so this patch replaces the relevant part in configure | |
143 | (emacs 53da55b8cc45e76b836ebaadd23f46e92d25abce). | |
144 | ||
145 | * configure.ac: backport system_malloc/hybrid_malloc detection. | |
146 | --- | |
147 | configure.ac | 29 ++++++++++++++++++++++++++++- | |
148 | 1 file changed, 28 insertions(+), 1 deletion(-) | |
149 | ||
150 | diff --git a/configure.ac b/configure.ac | |
151 | index 36fa8eb390..3cc1794f37 100644 | |
152 | --- a/configure.ac | |
153 | +++ b/configure.ac | |
154 | @@ -1966,7 +1966,25 @@ case "$opsys" in | |
155 | darwin|mingw32|sol2-10) system_malloc=yes ;; | |
156 | esac | |
157 | ||
158 | +hybrid_malloc= | |
159 | +system_malloc=yes | |
160 | + | |
161 | +test "$CANNOT_DUMP" = yes || | |
162 | +case "$opsys" in | |
163 | + ## darwin ld insists on the use of malloc routines in the System framework. | |
164 | + darwin | mingw32 | nacl | sol2-10) ;; | |
165 | + cygwin) hybrid_malloc=yes | |
166 | + system_malloc= ;; | |
167 | + *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;; | |
168 | +esac | |
169 | + | |
170 | +if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \ | |
171 | + && test "${UNEXEC_OBJ}" = unexelf.o; then | |
172 | + hybrid_malloc=yes | |
173 | +fi | |
174 | + | |
175 | GMALLOC_OBJ= | |
176 | +HYBRID_MALLOC= | |
177 | if test "${system_malloc}" = "yes"; then | |
178 | AC_DEFINE([SYSTEM_MALLOC], 1, | |
179 | [Define to 1 to use the system memory allocator, even if it is not | |
180 | @@ -1975,6 +1993,14 @@ if test "${system_malloc}" = "yes"; then | |
181 | GNU_MALLOC_reason=" | |
182 | (The GNU allocators don't work with this system configuration.)" | |
183 | VMLIMIT_OBJ= | |
184 | +elif test "$hybrid_malloc" = yes; then | |
185 | + AC_DEFINE(HYBRID_MALLOC, 1, | |
186 | + [Define to use gmalloc before dumping and the system malloc after.]) | |
187 | + HYBRID_MALLOC=1 | |
188 | + GNU_MALLOC=no | |
189 | + GNU_MALLOC_reason=" (only before dumping)" | |
190 | + GMALLOC_OBJ=gmalloc.o | |
191 | + VMLIMIT_OBJ= | |
192 | else | |
193 | test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o | |
194 | VMLIMIT_OBJ=vm-limit.o | |
195 | @@ -1993,10 +2019,11 @@ else | |
196 | of the main data segment.]) | |
197 | fi | |
198 | fi | |
199 | +AC_SUBST([HYBRID_MALLOC]) | |
200 | AC_SUBST(GMALLOC_OBJ) | |
201 | AC_SUBST(VMLIMIT_OBJ) | |
202 | ||
203 | -if test "$doug_lea_malloc" = "yes" ; then | |
204 | +if test "$doug_lea_malloc" = "yes" && test "$hybrid_malloc" != yes; then | |
205 | if test "$GNU_MALLOC" = yes ; then | |
206 | GNU_MALLOC_reason=" | |
207 | (Using Doug Lea's new malloc from the GNU C Library.)" | |
208 | -- | |
209 | Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org | |
210 | Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com | |
211 |