diff options
| author | Eli Zaretskii | 2013-08-12 22:48:04 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-08-12 22:48:04 +0300 |
| commit | aa942e2bf4545365d7fb7e9d787e4a21642fbf4c (patch) | |
| tree | 0cb260daad1d96ecd644cef40e8872921729c317 | |
| parent | 7d8e68fed31cd980eeeb34caf4d10ca5de37cf3b (diff) | |
| download | emacs-aa942e2bf4545365d7fb7e9d787e4a21642fbf4c.tar.gz emacs-aa942e2bf4545365d7fb7e9d787e4a21642fbf4c.zip | |
Fix zlib support on MS-Windows.
configure.ac (HAVE_ZLIB): Don't use -lz on MinGW.
src/decompress.c <zlib_initialized> [WINDOWSNT]: New static variable.
(Fzlib_decompress_region) [WINDOWSNT]: Call init_zlib_functions if
not yet initialized.
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | configure.ac | 4 | ||||
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/decompress.c | 13 |
4 files changed, 24 insertions, 3 deletions
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-08-12 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * configure.ac (HAVE_ZLIB): Don't use -lz on MinGW. | ||
| 4 | |||
| 1 | 2013-08-12 Paul Eggert <eggert@cs.ucla.edu> | 5 | 2013-08-12 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 6 | ||
| 3 | Minor zlib configuration tweaks. | 7 | Minor zlib configuration tweaks. |
diff --git a/configure.ac b/configure.ac index b6c7dacd997..20054fd6d2f 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -2955,6 +2955,10 @@ if test "${with_zlib}" != "no"; then | |||
| 2955 | fi | 2955 | fi |
| 2956 | if test "${HAVE_ZLIB}" = "yes"; then | 2956 | if test "${HAVE_ZLIB}" = "yes"; then |
| 2957 | AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if you have the zlib library (-lz).]) | 2957 | AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if you have the zlib library (-lz).]) |
| 2958 | ### mingw32 doesn't use -lz, since it loads the library dynamically. | ||
| 2959 | if test "${opsys}" = "mingw32"; then | ||
| 2960 | LIBZ= | ||
| 2961 | fi | ||
| 2958 | fi | 2962 | fi |
| 2959 | AC_SUBST(LIBZ) | 2963 | AC_SUBST(LIBZ) |
| 2960 | 2964 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 88e1fdc4e66..04c89b63fa4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-08-12 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * decompress.c <zlib_initialized> [WINDOWSNT]: New static variable. | ||
| 4 | (Fzlib_decompress_region) [WINDOWSNT]: Call init_zlib_functions if | ||
| 5 | not yet initialized. | ||
| 6 | |||
| 1 | 2013-08-12 Lars Magne Ingebrigtsen <larsi@gnus.org> | 7 | 2013-08-12 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 8 | ||
| 3 | * decompress.c (Fzlib_decompress_region): Support zlib | 9 | * decompress.c (Fzlib_decompress_region): Support zlib |
diff --git a/src/decompress.c b/src/decompress.c index b3ad4f7676a..a09033ab8c3 100644 --- a/src/decompress.c +++ b/src/decompress.c | |||
| @@ -38,7 +38,7 @@ static Lisp_Object Qzlib_dll; | |||
| 38 | /* Macro for loading zlib functions from the library. */ | 38 | /* Macro for loading zlib functions from the library. */ |
| 39 | #define LOAD_ZLIB_FN(lib,func) { \ | 39 | #define LOAD_ZLIB_FN(lib,func) { \ |
| 40 | fn_##func = (void *) GetProcAddress (lib, #func); \ | 40 | fn_##func = (void *) GetProcAddress (lib, #func); \ |
| 41 | if (!fn_##func) return 0; \ | 41 | if (!fn_##func) return false; \ |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | DEF_ZLIB_FN (int, inflateInit2_, | 44 | DEF_ZLIB_FN (int, inflateInit2_, |
| @@ -50,6 +50,8 @@ DEF_ZLIB_FN (int, inflate, | |||
| 50 | DEF_ZLIB_FN (int, inflateEnd, | 50 | DEF_ZLIB_FN (int, inflateEnd, |
| 51 | (z_streamp strm)); | 51 | (z_streamp strm)); |
| 52 | 52 | ||
| 53 | static bool zlib_initialized; | ||
| 54 | |||
| 53 | static bool | 55 | static bool |
| 54 | init_zlib_functions (void) | 56 | init_zlib_functions (void) |
| 55 | { | 57 | { |
| @@ -58,13 +60,13 @@ init_zlib_functions (void) | |||
| 58 | if (!library) | 60 | if (!library) |
| 59 | { | 61 | { |
| 60 | message1 ("zlib library not found"); | 62 | message1 ("zlib library not found"); |
| 61 | return 0; | 63 | return false; |
| 62 | } | 64 | } |
| 63 | 65 | ||
| 64 | LOAD_ZLIB_FN (library, inflateInit2_); | 66 | LOAD_ZLIB_FN (library, inflateInit2_); |
| 65 | LOAD_ZLIB_FN (library, inflate); | 67 | LOAD_ZLIB_FN (library, inflate); |
| 66 | LOAD_ZLIB_FN (library, inflateEnd); | 68 | LOAD_ZLIB_FN (library, inflateEnd); |
| 67 | return 1; | 69 | return true; |
| 68 | } | 70 | } |
| 69 | 71 | ||
| 70 | #define fn_inflateInit2(strm, windowBits) \ | 72 | #define fn_inflateInit2(strm, windowBits) \ |
| @@ -139,6 +141,11 @@ This function can be called only in unibyte buffers. */) | |||
| 139 | if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) | 141 | if (! NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 140 | error ("This function can be called only in unibyte buffers"); | 142 | error ("This function can be called only in unibyte buffers"); |
| 141 | 143 | ||
| 144 | #ifdef WINDOWSNT | ||
| 145 | if (!zlib_initialized) | ||
| 146 | zlib_initialized = init_zlib_functions (); | ||
| 147 | #endif | ||
| 148 | |||
| 142 | /* This is a unibyte buffer, so character positions and bytes are | 149 | /* This is a unibyte buffer, so character positions and bytes are |
| 143 | the same. */ | 150 | the same. */ |
| 144 | istart = XINT (start); | 151 | istart = XINT (start); |