diff options
| author | Hartmut Holzgraefe <hholzgra@php.net> | 2000-11-20 21:36:38 +0000 |
|---|---|---|
| committer | Hartmut Holzgraefe <hholzgra@php.net> | 2000-11-20 21:36:38 +0000 |
| commit | 67bb9d1ae23fe4c7e4160dabfb4f07b51dccabf1 (patch) | |
| tree | faee1ab09e668291c9b5ba1a54432b54c458d1ab | |
| parent | b2c957d4b16c6eb208266983b6505f0a3ee70e4e (diff) | |
| download | php-git-67bb9d1ae23fe4c7e4160dabfb4f07b51dccabf1.tar.gz | |
fixed a compile problem with glibc<=2.1.1 (#7327, #7892)
# zlib.c still produces a warning, perhaps i should move
# the fopen wrapper to a seperate file to get things right
# but i think i will wait for the autoconf book to arrive
| -rw-r--r-- | ext/zlib/config.m4 | 40 | ||||
| -rw-r--r-- | ext/zlib/zlib.c | 3 |
2 files changed, 41 insertions, 2 deletions
diff --git a/ext/zlib/config.m4 b/ext/zlib/config.m4 index 1c4df2eee7..86a7106ebd 100644 --- a/ext/zlib/config.m4 +++ b/ext/zlib/config.m4 @@ -42,5 +42,43 @@ if test "$PHP_ZLIB" != "no"; then AC_ADD_INCLUDE($ZLIB_INCDIR) - AC_CHECK_FUNC(fopencookie, [AC_DEFINE(HAVE_FOPENCOOKIE,1,[ ])]) + dnl check for fopencookie() from glibc + AC_CHECK_FUNC(fopencookie, [ have_glibc_fopencookie=yes ]) + + if test "$have_glibc_fopencookie" = "yes" ; then + dnl this comes in two flavors: + dnl newer glibcs (since 2.1.2 ? ) + dnl have a type called cookie_io_functions_t + AC_TRY_COMPILE([ #define _GNU_SOURCE + #include <stdio.h> + ], + [ cookie_io_functions_t cookie; ], + [ have_cookie_io_functions_t=yes ], + [ ] ) + + if test "$have_cookie_io_functions_t" = "yes" ; then + cookie_io_functions_t=cookie_io_functions_t + have_fopen_cookie=yes + else + dnl older glibc versions (up to 2.1.2 ?) + dnl call it _IO_cookie_io_functions_t + AC_TRY_COMPILE([ #define _GNU_SOURCE + #include <stdio.h> + ], + [ _IO_cookie_io_functions_t cookie; ], + [ have_IO_cookie_io_functions_t=yes ], + [] ) + if test "$have_cookie_io_functions_t" = "yes" ; then + cookie_io_functions_t=_IO_cookie_io_functions_t + have_fopen_cookie=yes + fi + fi + + if test "$have_fopen_cookie" = "yes" ; then + AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ]) + AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ]) + fi + + fi + fi diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 3b706449f6..695fc37abf 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -967,7 +967,8 @@ static int gz_closer(void *cookie) { } -static cookie_io_functions_t gz_cookie_functions = + +static COOKIE_IO_FUNCTIONS_T gz_cookie_functions = { gz_reader , gz_writer , gz_seeker |
