From 243340ad57e30de3c15cffe6e4af0381995f15d9 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sun, 29 Mar 2015 07:12:38 -0700 Subject: Add --with-system-zlib in bfd This patch adds --with-system-zlib and remove --with-zlib in bfd. * Makefile.am (ZLIB): New. (ZLIBINC): Likewise. (AM_CFLAGS): Add $(ZLIBINC). (libbfd_la_LIBADD): Add $(ZLIB). * compress.c: Don't check HAVE_ZLIB_H to include . (decompress_contents): Don't check HAVE_ZLIB_H. (decompress_contents): Likewise. (bfd_compress_section_contents): Likewise. (bfd_get_full_section_contents): Likewise. (bfd_init_section_decompress_status): Likewise. (bfd_init_section_compress_status): Likewise. * configure.ac (AM_ZLIB): Removed (zlibdir): New. AC_SUBST. (zlibinc): Likewise. Add --with-system-zlib. * Makefile.in: Regenerated. * acinclude.m4: Likewise. * config.in: Likewise. * configure: Likewise. * doc/Makefile.in: Likewise. --- bfd/compress.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) (limited to 'bfd/compress.c') diff --git a/bfd/compress.c b/bfd/compress.c index 993a1d3..7e498fa 100644 --- a/bfd/compress.c +++ b/bfd/compress.c @@ -19,14 +19,11 @@ MA 02110-1301, USA. */ #include "sysdep.h" +#include #include "bfd.h" #include "libbfd.h" -#ifdef HAVE_ZLIB_H -#include -#endif #include "safe-ctype.h" -#ifdef HAVE_ZLIB_H static bfd_boolean decompress_contents (bfd_byte *compressed_buffer, bfd_size_type compressed_size, @@ -72,10 +69,9 @@ decompress_contents (bfd_byte *compressed_buffer, successfully. */ static bfd_boolean -bfd_compress_section_contents (bfd *abfd ATTRIBUTE_UNUSED, - sec_ptr sec ATTRIBUTE_UNUSED, - bfd_byte *uncompressed_buffer ATTRIBUTE_UNUSED, - bfd_size_type uncompressed_size ATTRIBUTE_UNUSED) +bfd_compress_section_contents (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr sec, + bfd_byte *uncompressed_buffer, + bfd_size_type uncompressed_size) { uLong compressed_size; bfd_byte *compressed_buffer; @@ -127,7 +123,6 @@ bfd_compress_section_contents (bfd *abfd ATTRIBUTE_UNUSED, return TRUE; } -#endif /* HAVE_ZLIB_H */ /* FUNCTION @@ -152,12 +147,10 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) { bfd_size_type sz; bfd_byte *p = *ptr; -#ifdef HAVE_ZLIB_H bfd_boolean ret; bfd_size_type save_size; bfd_size_type save_rawsize; bfd_byte *compressed_buffer; -#endif if (abfd->direction != write_direction && sec->rawsize != 0) sz = sec->rawsize; @@ -189,10 +182,6 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) return TRUE; case DECOMPRESS_SECTION_SIZED: -#ifndef HAVE_ZLIB_H - bfd_set_error (bfd_error_invalid_operation); - return FALSE; -#else /* Read in the full compressed section contents. */ compressed_buffer = (bfd_byte *) bfd_malloc (sec->compressed_size); if (compressed_buffer == NULL) @@ -232,7 +221,6 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) free (compressed_buffer); *ptr = p; return TRUE; -#endif case COMPRESS_SECTION_DONE: if (sec->contents == NULL) @@ -337,13 +325,8 @@ DESCRIPTION */ bfd_boolean -bfd_init_section_decompress_status (bfd *abfd ATTRIBUTE_UNUSED, - sec_ptr sec ATTRIBUTE_UNUSED) +bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) { -#ifndef HAVE_ZLIB_H - bfd_set_error (bfd_error_invalid_operation); - return FALSE; -#else bfd_byte compressed_buffer [12]; bfd_size_type uncompressed_size; @@ -378,7 +361,6 @@ bfd_init_section_decompress_status (bfd *abfd ATTRIBUTE_UNUSED, sec->compress_status = DECOMPRESS_SECTION_SIZED; return TRUE; -#endif } /* @@ -399,13 +381,8 @@ DESCRIPTION */ bfd_boolean -bfd_init_section_compress_status (bfd *abfd ATTRIBUTE_UNUSED, - sec_ptr sec ATTRIBUTE_UNUSED) +bfd_init_section_compress_status (bfd *abfd, sec_ptr sec) { -#ifndef HAVE_ZLIB_H - bfd_set_error (bfd_error_invalid_operation); - return FALSE; -#else bfd_size_type uncompressed_size; bfd_byte *uncompressed_buffer; bfd_boolean ret; @@ -433,5 +410,4 @@ bfd_init_section_compress_status (bfd *abfd ATTRIBUTE_UNUSED, uncompressed_size); return ret; -#endif } -- cgit v1.1